repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
mage2pro/core
OAuth/ReturnT.php
ReturnT.redirectUrl
protected function redirectUrl() {return df_starts_with($r = df_request($this->redirectUrlKey()) ?: df_url(), 'http') ? $r : base64_decode($r) ;}
php
protected function redirectUrl() {return df_starts_with($r = df_request($this->redirectUrlKey()) ?: df_url(), 'http') ? $r : base64_decode($r) ;}
[ "protected", "function", "redirectUrl", "(", ")", "{", "return", "df_starts_with", "(", "$", "r", "=", "df_request", "(", "$", "this", "->", "redirectUrlKey", "(", ")", ")", "?", ":", "df_url", "(", ")", ",", "'http'", ")", "?", "$", "r", ":", "base6...
2016-06-05 @see urldecode() здесь вызывать уже не надо, проверял. 2016-12-02 Если адрес для перенаправления покупателя передётся в адресе возврата, то адрес для перенаправления там може быть закодирован посредством @see base64_encode() @see \Dfe\BlackbaudNetCommunity\Url::get() @used-by execute() @used-by \Df\Sso\CustomerReturn::redirectUrl() @see \Df\OAuth\ReturnT\GeneralPurpose::redirectUrl() @see \Df\Sso\CustomerReturn::redirectUrl() @return string
[ "2016", "-", "06", "-", "05" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/OAuth/ReturnT.php#L53-L56
train
mage2pro/core
Payment/Plugin/Model/Checks/CanUseForCountry.php
CanUseForCountry.aroundIsApplicable
function aroundIsApplicable(Sb $sb, \Closure $f, IM $m, Q $q) {return !dfp_my($m) ? $f($m, $q) : ( $m->canUseForCountry(df_oq_country_sb($q)) );}
php
function aroundIsApplicable(Sb $sb, \Closure $f, IM $m, Q $q) {return !dfp_my($m) ? $f($m, $q) : ( $m->canUseForCountry(df_oq_country_sb($q)) );}
[ "function", "aroundIsApplicable", "(", "Sb", "$", "sb", ",", "\\", "Closure", "$", "f", ",", "IM", "$", "m", ",", "Q", "$", "q", ")", "{", "return", "!", "dfp_my", "(", "$", "m", ")", "?", "$", "f", "(", "$", "m", ",", "$", "q", ")", ":", ...
2017-12-13 "Improve @see \Magento\Payment\Model\Checks\CanUseForCountry: it should give priority to the shipping country over the billing country for my modules": https://github.com/mage2pro/core/issues/62 @see \Magento\Payment\Model\Checks\CanUseForCountry::isApplicable() https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php#L27-L36 https://github.com/magento/magento2/blob/2.2.2/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php#L33-L42 @used-by \Df\Payment\Settings::applicableForQuoteByCountry() @param Sb $sb @param \Closure $f @param IM $m @param Q $q @return string
[ "2017", "-", "12", "-", "13", "Improve" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Plugin/Model/Checks/CanUseForCountry.php#L23-L25
train
mage2pro/core
Payment/ConfigProvider.php
ConfigProvider.config
protected function config() { $s = $this->s(); /** @var S $s */ $currency = $this->currency(); /** @var Currency $currency */ $currencyC = $currency->iso3(); /** @var string $currencyC */ return [ /** * 2017-11-05 * @todo «Passing `amountF` to the client side is incorrect, * because a payment's amount could be changed client-side * (e.g., after a discount code application)» * https://github.com/mage2pro/core/issues/45 */ 'amountF' => $this->m()->amountFormat($this->amount()) ,'requireBillingAddress' => $s->requireBillingAddress() ,'isTest' => $s->test() // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.7/Payment/view/frontend/web/mixin.js?ts=4#L249-L258 ,'paymentCurrency' => [ // 2016-09-06 // Код платёжной валюты. // Это значение индивидуально для каждого платёжного модуля. // 2017-02-07 // https://github.com/mage2pro/2checkout/blob/1.1.18/view/frontend/web/main.js?ts=4#L23 // https://github.com/mage2pro/paymill/blob/0.1.2/view/frontend/web/main.js?ts=4#L46 'code' => $currencyC // 2016-09-06 // Правила форматирования платёжной валюты. // How to get the display format for a particular currency and locale programmatically? // https://mage2.pro/t/2022 // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.9/Payment/view/frontend/web/mixin.js?ts=4#L205 ,'format' => df_locale_f()->getPriceFormat($locale = null, $currencyC) // 2017-02-07 // https://github.com/checkout/checkout-magento2-plugin/blob/1.1.21/view/frontend/web/main.js?ts=4#L27 // https://github.com/mage2pro/2checkout/blob/1.1.18/view/frontend/web/main.js?ts=4#L26 // https://github.com/mage2pro/securepay/blob/1.1.19/view/frontend/web/main.js?ts=4#L37 // https://github.com/mage2pro/securepay/blob/1.1.19/view/frontend/web/main.js?ts=4#L51 ,'name' => df_currency_name($currencyC) // 2016-09-06 // Курс обмена учётной валюты на платёжную. // Это значение индивидуально для каждого платёжного модуля. // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.7/Payment/view/frontend/web/mixin.js?ts=4#L60 ,'rate' => $currency->rateToPayment() ] ,'titleBackend' => $this->m()->titleB() ] ;}
php
protected function config() { $s = $this->s(); /** @var S $s */ $currency = $this->currency(); /** @var Currency $currency */ $currencyC = $currency->iso3(); /** @var string $currencyC */ return [ /** * 2017-11-05 * @todo «Passing `amountF` to the client side is incorrect, * because a payment's amount could be changed client-side * (e.g., after a discount code application)» * https://github.com/mage2pro/core/issues/45 */ 'amountF' => $this->m()->amountFormat($this->amount()) ,'requireBillingAddress' => $s->requireBillingAddress() ,'isTest' => $s->test() // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.7/Payment/view/frontend/web/mixin.js?ts=4#L249-L258 ,'paymentCurrency' => [ // 2016-09-06 // Код платёжной валюты. // Это значение индивидуально для каждого платёжного модуля. // 2017-02-07 // https://github.com/mage2pro/2checkout/blob/1.1.18/view/frontend/web/main.js?ts=4#L23 // https://github.com/mage2pro/paymill/blob/0.1.2/view/frontend/web/main.js?ts=4#L46 'code' => $currencyC // 2016-09-06 // Правила форматирования платёжной валюты. // How to get the display format for a particular currency and locale programmatically? // https://mage2.pro/t/2022 // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.9/Payment/view/frontend/web/mixin.js?ts=4#L205 ,'format' => df_locale_f()->getPriceFormat($locale = null, $currencyC) // 2017-02-07 // https://github.com/checkout/checkout-magento2-plugin/blob/1.1.21/view/frontend/web/main.js?ts=4#L27 // https://github.com/mage2pro/2checkout/blob/1.1.18/view/frontend/web/main.js?ts=4#L26 // https://github.com/mage2pro/securepay/blob/1.1.19/view/frontend/web/main.js?ts=4#L37 // https://github.com/mage2pro/securepay/blob/1.1.19/view/frontend/web/main.js?ts=4#L51 ,'name' => df_currency_name($currencyC) // 2016-09-06 // Курс обмена учётной валюты на платёжную. // Это значение индивидуально для каждого платёжного модуля. // 2017-02-07 // https://github.com/mage2pro/core/blob/1.12.7/Payment/view/frontend/web/mixin.js?ts=4#L60 ,'rate' => $currency->rateToPayment() ] ,'titleBackend' => $this->m()->titleB() ] ;}
[ "protected", "function", "config", "(", ")", "{", "$", "s", "=", "$", "this", "->", "s", "(", ")", ";", "/** @var S $s */", "$", "currency", "=", "$", "this", "->", "currency", "(", ")", ";", "/** @var Currency $currency */", "$", "currencyC", "=", "$", ...
2016-08-04 @used-by \Df\Payment\ConfigProvider::getConfig() @see \Df\Payment\ConfigProvider\BankCard::config() @see \Dfe\AllPay\ConfigProvider::config() @see \Dfe\AlphaCommerceHub\ConfigProvider::config() @see \Dfe\IPay88\ConfigProvider::config() @see \Dfe\Robokassa\ConfigProvider::config() @see \Dfe\TBCBank\ConfigProvider::config() @see \Dfe\YandexKassa\ConfigProvider::config() @return array(string => mixed)
[ "2016", "-", "08", "-", "04" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/ConfigProvider.php#L115-L162
train
mage2pro/core
Payment/ConfigProvider.php
ConfigProvider.configOptions
final protected static function configOptions(IOptions $o) {$s = $o->s(); /** @var Settings $s */ return [ // 2017-09-19 «Where to ask for a payment option?» 'needShowOptions' => Options::needShow($s) /** * 2017-09-18 * @used-by Df_Payments/withOptions::options() * https://github.com/mage2pro/core/blob/2.12.5/Payment/view/frontend/web/withOptions.js#L72-L80 * 2017-10-29 * Note 1. * «JavaScript does not guarantee the properties order in objects, * so \Df\Payment\ConfigProvider::configOptions() should * specify the payment options orderings exactly in a separate property, * or pass the options to the client side as an array instead of an object»: * https://github.com/mage2pro/core/issues/41 * Note 2. * It is important to use @uses array_values() * for the result to be interpreted as an array? not object, on the client side. */ ,'options' => !df_is_assoc($oo = $o->options()) ? $oo : /** * */ array_values(df_map_k($oo, function($v, $l) {return ['label' => $l, 'value' => $v];})) // 2017-09-19 A text to be shown on the Magento checkout page instead of the payment options dialog. ,'optionsDescription' => $s->v('optionsDescription') /** * 2017-09-21 * «Payment options display mode» (`images` or `text`). * *) iPay88: https://github.com/mage2pro/ipay88/blob/1.3.3/etc/adminhtml/system.xml#L151-L164 * *) Robokassa: https://github.com/mage2pro/robokassa/blob/1.2.4/etc/adminhtml/system.xml#L230-L243 * *) Yandex.Kassa: https://github.com/mage2pro/yandex-kassa/blob/0.1.5/etc/adminhtml/system.xml#L178-L192 */ ,'optionsDisplayMode' => $s->v('optionsDisplayMode', null, DisplayMode::IMAGES) // 2017-09-19 A text above the payment options on the Magento checkout page. ,'optionsPrompt' => $s->v('optionsPrompt') ];}
php
final protected static function configOptions(IOptions $o) {$s = $o->s(); /** @var Settings $s */ return [ // 2017-09-19 «Where to ask for a payment option?» 'needShowOptions' => Options::needShow($s) /** * 2017-09-18 * @used-by Df_Payments/withOptions::options() * https://github.com/mage2pro/core/blob/2.12.5/Payment/view/frontend/web/withOptions.js#L72-L80 * 2017-10-29 * Note 1. * «JavaScript does not guarantee the properties order in objects, * so \Df\Payment\ConfigProvider::configOptions() should * specify the payment options orderings exactly in a separate property, * or pass the options to the client side as an array instead of an object»: * https://github.com/mage2pro/core/issues/41 * Note 2. * It is important to use @uses array_values() * for the result to be interpreted as an array? not object, on the client side. */ ,'options' => !df_is_assoc($oo = $o->options()) ? $oo : /** * */ array_values(df_map_k($oo, function($v, $l) {return ['label' => $l, 'value' => $v];})) // 2017-09-19 A text to be shown on the Magento checkout page instead of the payment options dialog. ,'optionsDescription' => $s->v('optionsDescription') /** * 2017-09-21 * «Payment options display mode» (`images` or `text`). * *) iPay88: https://github.com/mage2pro/ipay88/blob/1.3.3/etc/adminhtml/system.xml#L151-L164 * *) Robokassa: https://github.com/mage2pro/robokassa/blob/1.2.4/etc/adminhtml/system.xml#L230-L243 * *) Yandex.Kassa: https://github.com/mage2pro/yandex-kassa/blob/0.1.5/etc/adminhtml/system.xml#L178-L192 */ ,'optionsDisplayMode' => $s->v('optionsDisplayMode', null, DisplayMode::IMAGES) // 2017-09-19 A text above the payment options on the Magento checkout page. ,'optionsPrompt' => $s->v('optionsPrompt') ];}
[ "final", "protected", "static", "function", "configOptions", "(", "IOptions", "$", "o", ")", "{", "$", "s", "=", "$", "o", "->", "s", "(", ")", ";", "/** @var Settings $s */", "return", "[", "// 2017-09-19 «Where to ask for a payment option?»", "'needShowOptions'", ...
2017-09-18 @used-by \Df\GingerPaymentsBase\ConfigProvider::config() @used-by \Dfe\IPay88\ConfigProvider::config() @used-by \Dfe\Robokassa\ConfigProvider::config() @used-by \Dfe\YandexKassa\ConfigProvider::config() @param IOptions $o @return array(string => mixed)
[ "2017", "-", "09", "-", "18" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/ConfigProvider.php#L214-L248
train
mage2pro/core
Sso/Upgrade/Data.php
Data.attribute
final protected function attribute($name, $label) { static $ordering = 1000; /** @var int $ordering */ df_eav_setup()->addAttribute('customer', $name, [ 'input' => 'text' ,'label' => "{$this->labelPrefix()} $label" ,'position' => $ordering++ ,'required' => false ,'sort_order' => $ordering ,'system' => false ,'type' => 'static' ,'visible' => false ]); /** @var int $attributeId */ $attributeId = df_first(df_fetch_col('eav_attribute', 'attribute_id', 'attribute_code', $name)); df_conn()->insert(df_table('customer_form_attribute'), [ 'attribute_id' => $attributeId, 'form_code' => 'adminhtml_customer' ]); }
php
final protected function attribute($name, $label) { static $ordering = 1000; /** @var int $ordering */ df_eav_setup()->addAttribute('customer', $name, [ 'input' => 'text' ,'label' => "{$this->labelPrefix()} $label" ,'position' => $ordering++ ,'required' => false ,'sort_order' => $ordering ,'system' => false ,'type' => 'static' ,'visible' => false ]); /** @var int $attributeId */ $attributeId = df_first(df_fetch_col('eav_attribute', 'attribute_id', 'attribute_code', $name)); df_conn()->insert(df_table('customer_form_attribute'), [ 'attribute_id' => $attributeId, 'form_code' => 'adminhtml_customer' ]); }
[ "final", "protected", "function", "attribute", "(", "$", "name", ",", "$", "label", ")", "{", "static", "$", "ordering", "=", "1000", ";", "/** @var int $ordering */", "df_eav_setup", "(", ")", "->", "addAttribute", "(", "'customer'", ",", "$", "name", ",", ...
2015-10-10 @used-by _process() @used-by \Dfe\FacebookLogin\Setup\UpgradeData::_process() @param string $name @param string $label
[ "2015", "-", "10", "-", "10" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sso/Upgrade/Data.php#L40-L57
train
mage2pro/core
Framework/App/Action/Image.php
Image.execute
function execute() { /** * 2015-11-29 * @see \Magento\Framework\App\Response\Http::setNoCacheHeaders() * https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/App/Response/Http.php#L133-L138 */ df_response_code(200); df_response_content_type("image/{$this->type()}"); df_response_cache_max(); $c = $this->contents(); /** @var string $c */ df_response_headers(['Content-Length' => strlen($c), 'Content-Transfer-Encoding' => 'binary']); $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); df_response()->setBody($c); }
php
function execute() { /** * 2015-11-29 * @see \Magento\Framework\App\Response\Http::setNoCacheHeaders() * https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/App/Response/Http.php#L133-L138 */ df_response_code(200); df_response_content_type("image/{$this->type()}"); df_response_cache_max(); $c = $this->contents(); /** @var string $c */ df_response_headers(['Content-Length' => strlen($c), 'Content-Transfer-Encoding' => 'binary']); $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); df_response()->setBody($c); }
[ "function", "execute", "(", ")", "{", "/**\n\t\t * 2015-11-29\n\t\t * @see \\Magento\\Framework\\App\\Response\\Http::setNoCacheHeaders()\n\t\t * https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/App/Response/Http.php#L133-L138\n\t\t */", "df_response_code", "(", "200", ...
2015-11-29 @override @see \Magento\Framework\App\Action\Action::execute() @used-by \Magento\Framework\App\Action\Action::dispatch(): $result = $this->execute(); https://github.com/magento/magento2/blob/2.2.1/lib/internal/Magento/Framework/App/Action/Action.php#L84-L125
[ "2015", "-", "11", "-", "29" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/App/Action/Image.php#L31-L44
train
mage2pro/core
Core/State.php
State.blockSet
function blockSet(BlockInterface $block, $templateFile) { $this->_blockStack[]= $block; $this->_templateFileStack[]= $templateFile; }
php
function blockSet(BlockInterface $block, $templateFile) { $this->_blockStack[]= $block; $this->_templateFileStack[]= $templateFile; }
[ "function", "blockSet", "(", "BlockInterface", "$", "block", ",", "$", "templateFile", ")", "{", "$", "this", "->", "_blockStack", "[", "]", "=", "$", "block", ";", "$", "this", "->", "_templateFileStack", "[", "]", "=", "$", "templateFile", ";", "}" ]
2015-08-13 @used-by \Df\Framework\Plugin\View\TemplateEngineInterface::aroundRender() @param BlockInterface|null $block @param string|null $templateFile
[ "2015", "-", "08", "-", "13" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Core/State.php#L51-L54
train
mage2pro/core
Core/State.php
State.renderingTitle
function renderingTitle($state = null) { if (!is_null($state)) { $this->_renderingTitle = $state; } return $this->_renderingTitle; }
php
function renderingTitle($state = null) { if (!is_null($state)) { $this->_renderingTitle = $state; } return $this->_renderingTitle; }
[ "function", "renderingTitle", "(", "$", "state", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "state", ")", ")", "{", "$", "this", "->", "_renderingTitle", "=", "$", "state", ";", "}", "return", "$", "this", "->", "_renderingTitle", ";...
2015-09-27 @used-by \Df\Framework\Plugin\View\Page\Title::aroundGet() @used-by \Dfr\Core\Realtime\Dictionary::handleForController() @param bool|null $state [optional] @return bool
[ "2015", "-", "09", "-", "27" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Core/State.php#L131-L136
train
mage2pro/core
Framework/Upgrade/Data.php
Data.attributeCA
final protected function attributeCA($name, $label, $ordering = 1000) { $asId = df_eav_ca()->getDefaultAttributeSetId(); /** @var int $asId */ $as = df_new_om(_AS::class); /** @var _AS $as */ df_eav_setup()->addAttribute(IAddressMetadata::ENTITY_TYPE_ADDRESS, $name, [ 'input' => 'text' ,'label' => $label ,'position' => $ordering++ ,'required' => false ,'sort_order' => $ordering ,'system' => false /** * 2019-03-06 * `varchar` (a solution without @see \Verdepieno\Core\Setup\UpgradeSchema ) * does not work for me. * I guess it is a bug in the Magento 2 Community core. */ ,'type' => 'static' ,'visible' => true ]); $a = df_eav_config()->getAttribute(IAddressMetadata::ENTITY_TYPE_ADDRESS, $name); /** @var A $a */ $a->addData([ IGroup::ATTRIBUTE_SET_ID => $asId ,'attribute_group_id' => $as->getDefaultGroupId($asId) ,'used_in_forms' => [ 'adminhtml_customer_address' ,'customer_address_edit' ,'customer_register_address' ,'customer_address' ] ]); $a->save(); }
php
final protected function attributeCA($name, $label, $ordering = 1000) { $asId = df_eav_ca()->getDefaultAttributeSetId(); /** @var int $asId */ $as = df_new_om(_AS::class); /** @var _AS $as */ df_eav_setup()->addAttribute(IAddressMetadata::ENTITY_TYPE_ADDRESS, $name, [ 'input' => 'text' ,'label' => $label ,'position' => $ordering++ ,'required' => false ,'sort_order' => $ordering ,'system' => false /** * 2019-03-06 * `varchar` (a solution without @see \Verdepieno\Core\Setup\UpgradeSchema ) * does not work for me. * I guess it is a bug in the Magento 2 Community core. */ ,'type' => 'static' ,'visible' => true ]); $a = df_eav_config()->getAttribute(IAddressMetadata::ENTITY_TYPE_ADDRESS, $name); /** @var A $a */ $a->addData([ IGroup::ATTRIBUTE_SET_ID => $asId ,'attribute_group_id' => $as->getDefaultGroupId($asId) ,'used_in_forms' => [ 'adminhtml_customer_address' ,'customer_address_edit' ,'customer_register_address' ,'customer_address' ] ]); $a->save(); }
[ "final", "protected", "function", "attributeCA", "(", "$", "name", ",", "$", "label", ",", "$", "ordering", "=", "1000", ")", "{", "$", "asId", "=", "df_eav_ca", "(", ")", "->", "getDefaultAttributeSetId", "(", ")", ";", "/** @var int $asId */", "$", "as",...
2019-03-05 @see \Df\Sso\Upgrade\Data::attribute() @used-by \Verdepieno\Core\Setup\UpgradeData::_process() @param string $name @param string $label @param int $ordering [optional]
[ "2019", "-", "03", "-", "05" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Upgrade/Data.php#L74-L105
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.checkbox
protected function checkbox($name, $label = null, $value = null, $note = null) { $data = is_array($value) ? $value + ['note' => $note] : ( is_bool($value) ? ['checked' => $value, 'note' => $note] : ['note' => $value] ); return $this->field($name, Checkbox::class, $label, [ 'checked' => Checkbox::b($this->v($name), df_bool(dfa($data, 'checked'))) ] + $data); }
php
protected function checkbox($name, $label = null, $value = null, $note = null) { $data = is_array($value) ? $value + ['note' => $note] : ( is_bool($value) ? ['checked' => $value, 'note' => $note] : ['note' => $value] ); return $this->field($name, Checkbox::class, $label, [ 'checked' => Checkbox::b($this->v($name), df_bool(dfa($data, 'checked'))) ] + $data); }
[ "protected", "function", "checkbox", "(", "$", "name", ",", "$", "label", "=", "null", ",", "$", "value", "=", "null", ",", "$", "note", "=", "null", ")", "{", "$", "data", "=", "is_array", "(", "$", "value", ")", "?", "$", "value", "+", "[", "...
2015-11-17 @param string $name @param string|null|Phrase $label [optional] @param array(string => mixed)|bool|string $value [optional] @param string|null $note [optional] @return \Magento\Framework\Data\Form\Element\Checkbox|E
[ "2015", "-", "11", "-", "17" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L159-L168
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.fieldset
protected function fieldset($class = null, $cssClass = null) { if (!$class) { $class = __CLASS__; } /** @var Fieldset $result */ // 2015-12-29 // Раньше имя создавалось так: df_uid(4, 'fs') $result = $this->addField($this->cn('fs' . $this->_childFieldsetNextId++), $class, [ /** * 2015-12-07 * Важно скопировать значения опций сюда, * чтобы дочерний филдсет мог создавать свои элементы * типа $fsCheckboxes->checkbox('bold', 'B'); * Что интересно, добавление вместо этого метода getValue * почему-то не работает: * function getValue() {return $this->top()->getData('value');} */ 'value' => $this['value'] ]); /** * 2015-12-12 * Флаг анонимности филдсета. * Анонимные филдсеты не добавляют своё имя в качестве префикса имён полей. */ $result->_anonymous = true; if ($cssClass) { $result->addClass($cssClass); } return $result; }
php
protected function fieldset($class = null, $cssClass = null) { if (!$class) { $class = __CLASS__; } /** @var Fieldset $result */ // 2015-12-29 // Раньше имя создавалось так: df_uid(4, 'fs') $result = $this->addField($this->cn('fs' . $this->_childFieldsetNextId++), $class, [ /** * 2015-12-07 * Важно скопировать значения опций сюда, * чтобы дочерний филдсет мог создавать свои элементы * типа $fsCheckboxes->checkbox('bold', 'B'); * Что интересно, добавление вместо этого метода getValue * почему-то не работает: * function getValue() {return $this->top()->getData('value');} */ 'value' => $this['value'] ]); /** * 2015-12-12 * Флаг анонимности филдсета. * Анонимные филдсеты не добавляют своё имя в качестве префикса имён полей. */ $result->_anonymous = true; if ($cssClass) { $result->addClass($cssClass); } return $result; }
[ "protected", "function", "fieldset", "(", "$", "class", "=", "null", ",", "$", "cssClass", "=", "null", ")", "{", "if", "(", "!", "$", "class", ")", "{", "$", "class", "=", "__CLASS__", ";", "}", "/** @var Fieldset $result */", "// 2015-12-29", "// Раньше ...
2015-12-29 @todo Видимо, от этого метода надо избавляться. Обратите внимание, как работает, например, @see \Df\Framework\Form\Element\Fieldset::size() Этот метод использует способ, который кажется мне более оптимальным: https://github.com/mage2pro/core/tree/e7fcbd9c04a904e9e0d196c56e6a60d6eab0835a/Framework/Data/Form/Element/Fieldset.php#L443 @param string|null $class [optional] @param string|null $cssClass [optional] @return Fieldset
[ "2015", "-", "12", "-", "29" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L311-L340
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.hidden
protected function hidden($name, $value, $label = null) { $result = $this->field($name, Hidden::class, $label, ['value' => $value]); $result->setAfterElementHtml($label); return $result; }
php
protected function hidden($name, $value, $label = null) { $result = $this->field($name, Hidden::class, $label, ['value' => $value]); $result->setAfterElementHtml($label); return $result; }
[ "protected", "function", "hidden", "(", "$", "name", ",", "$", "value", ",", "$", "label", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "field", "(", "$", "name", ",", "Hidden", "::", "class", ",", "$", "label", ",", "[", "'value...
2015-12-28 @param string $name @param string $value @param string|null|Phrase $label [optional] @return Hidden
[ "2015", "-", "12", "-", "28" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L358-L362
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.size
protected function size($name, $label = null, $data = []) {return $this->quantity( $name, $label, $data + [Quantity::P__VALUES => SizeUnit::s()->toOptionArray()] );}
php
protected function size($name, $label = null, $data = []) {return $this->quantity( $name, $label, $data + [Quantity::P__VALUES => SizeUnit::s()->toOptionArray()] );}
[ "protected", "function", "size", "(", "$", "name", ",", "$", "label", "=", "null", ",", "$", "data", "=", "[", "]", ")", "{", "return", "$", "this", "->", "quantity", "(", "$", "name", ",", "$", "label", ",", "$", "data", "+", "[", "Quantity", ...
2015-12-11 @param string $name @param string|null|Phrase $label [optional] @param array(string => mixed) $data [optional] @return Quantity|E
[ "2015", "-", "12", "-", "11" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L508-L510
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.text
final protected function text($name, $label = null, $data = []) {return $this->field( $name, Text::class, $label, $data );}
php
final protected function text($name, $label = null, $data = []) {return $this->field( $name, Text::class, $label, $data );}
[ "final", "protected", "function", "text", "(", "$", "name", ",", "$", "label", "=", "null", ",", "$", "data", "=", "[", "]", ")", "{", "return", "$", "this", "->", "field", "(", "$", "name", ",", "Text", "::", "class", ",", "$", "label", ",", "...
2015-12-12 @used-by \Df\Framework\Form\Element\Quantity::onFormInitialized() @param string $name @param string|null|Phrase $label [optional] @param array(string => mixed) $data [optional] @return Text|E
[ "2015", "-", "12", "-", "12" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L520-L522
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.textarea
final protected function textarea($name, $label = null, $data = []) {return $this->field( $name, Textarea::class, $label, $data );}
php
final protected function textarea($name, $label = null, $data = []) {return $this->field( $name, Textarea::class, $label, $data );}
[ "final", "protected", "function", "textarea", "(", "$", "name", ",", "$", "label", "=", "null", ",", "$", "data", "=", "[", "]", ")", "{", "return", "$", "this", "->", "field", "(", "$", "name", ",", "Textarea", "::", "class", ",", "$", "label", ...
2018-04-20 @used-by \Doormall\Shipping\Partner\FE::onFormInitialized() @param string $name @param string|null|Phrase $label [optional] @param array(string => mixed) $data [optional] @return Textarea|E
[ "2018", "-", "04", "-", "20" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L532-L534
train
mage2pro/core
Framework/Form/Element/Fieldset.php
Fieldset.v
final protected function v($name = null) {return dfak($this, function() { $result = dfa($this->_data, 'value', []); /** * 2016-06-29 * Что интересно, при смене области действия настроек с глобальной на другую (сайт или магазин) * поле «value» может почему-то содержать не массив, * а строку JSON, соответствующую запакованному в JSON массиву: * https://code.dmitry-fedyuk.com/m2e/currency-format/issues/1 * Заметил это только для модуля «Price Format». */ return is_array($result) ? $result : df_json_decode($result); }, $name);}
php
final protected function v($name = null) {return dfak($this, function() { $result = dfa($this->_data, 'value', []); /** * 2016-06-29 * Что интересно, при смене области действия настроек с глобальной на другую (сайт или магазин) * поле «value» может почему-то содержать не массив, * а строку JSON, соответствующую запакованному в JSON массиву: * https://code.dmitry-fedyuk.com/m2e/currency-format/issues/1 * Заметил это только для модуля «Price Format». */ return is_array($result) ? $result : df_json_decode($result); }, $name);}
[ "final", "protected", "function", "v", "(", "$", "name", "=", "null", ")", "{", "return", "dfak", "(", "$", "this", ",", "function", "(", ")", "{", "$", "result", "=", "dfa", "(", "$", "this", "->", "_data", ",", "'value'", ",", "[", "]", ")", ...
2015-12-07 @used-by \Df\Framework\Form\Element\ArrayT::onFormInitialized() @param string|null $name [optional] @return string|null @throws DFE
[ "2015", "-", "12", "-", "07" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Fieldset.php#L543-L554
train
mage2pro/core
Payment/Init/Action.php
Action.sg
final static function sg(M $m) {return dfcf(function(M $m) { $c = df_con_hier($m, self::class); /** @var string $c */ return new $c($m); }, [$m]);}
php
final static function sg(M $m) {return dfcf(function(M $m) { $c = df_con_hier($m, self::class); /** @var string $c */ return new $c($m); }, [$m]);}
[ "final", "static", "function", "sg", "(", "M", "$", "m", ")", "{", "return", "dfcf", "(", "function", "(", "M", "$", "m", ")", "{", "$", "c", "=", "df_con_hier", "(", "$", "m", ",", "self", "::", "class", ")", ";", "/** @var string $c */", "return"...
2017-11-01 @used-by \Df\Payment\Method::getConfigPaymentAction() @used-by \Dfe\AlphaCommerceHub\Charge::pCharge() @used-by \Dfe\Stripe\W\Event\Source::ttCurrent() @used-by \Dfe\TBCBank\Charge::pCharge() @used-by \Dfe\TBCBank\W\Event::ttCurrent() @used-by \Dfe\Vantiv\Charge::pCharge() @param M $m @return self
[ "2017", "-", "11", "-", "01" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Init/Action.php#L318-L321
train
mage2pro/core
Sso/Button/Js.php
Js.attributes
protected function attributes() {return df_widget( $this, 'button', $this->jsOptions() + [ 'redirect' => $this->getUrl(df_route($this), df_clean([ '_secure' => $this->redirectShouldBeSecure()], false )) ,'type' => $this->s()->type() ] ) + parent::attributes();}
php
protected function attributes() {return df_widget( $this, 'button', $this->jsOptions() + [ 'redirect' => $this->getUrl(df_route($this), df_clean([ '_secure' => $this->redirectShouldBeSecure()], false )) ,'type' => $this->s()->type() ] ) + parent::attributes();}
[ "protected", "function", "attributes", "(", ")", "{", "return", "df_widget", "(", "$", "this", ",", "'button'", ",", "$", "this", "->", "jsOptions", "(", ")", "+", "[", "'redirect'", "=>", "$", "this", "->", "getUrl", "(", "df_route", "(", "$", "this",...
2016-11-28 @override @see \Df\Sso\Button::attributes() @used-by \Df\Sso\Button::loggedOut() @see \Dfe\FacebookLogin\Button::attributes() @return array(string => string)
[ "2016", "-", "11", "-", "28" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sso/Button/Js.php#L17-L24
train
mage2pro/core
Payment/Charge.php
Charge.description
final protected function description() {$s = $this->s(); return $this->text( $s->description(), $s->v('description_rules/maxLength/value') );}
php
final protected function description() {$s = $this->s(); return $this->text( $s->description(), $s->v('description_rules/maxLength/value') );}
[ "final", "protected", "function", "description", "(", ")", "{", "$", "s", "=", "$", "this", "->", "s", "(", ")", ";", "return", "$", "this", "->", "text", "(", "$", "s", "->", "description", "(", ")", ",", "$", "s", "->", "v", "(", "'description_...
2017-03-06 @used-by \Df\GingerPaymentsBase\Charge::pCustomer() @used-by \Df\StripeClone\P\Charge::request() @used-by \Dfe\AllPay\Charge::pCharge() @used-by \Dfe\AlphaCommerceHub\Charge::pCharge() @used-by \Dfe\CheckoutCom\Charge::_build() @used-by \Dfe\Dragonpay\Charge::pCharge() @used-by \Dfe\IPay88\Charge::pCharge() @used-by \Dfe\Qiwi\Charge::pBill() @used-by \Dfe\Robokassa\Charge::pCharge() @used-by \Dfe\TBCBank\Charge::common() @return string
[ "2017", "-", "03", "-", "06" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Charge.php#L61-L63
train
mage2pro/core
Customer/Observer/RegisterSuccess.php
RegisterSuccess.execute
function execute(O $o) { $c = df_customer($o['customer']); /** @var Customer $c */ $s = df_customer_session(); /** @var Session $s */ if ($s->getDfSsoId()) { $c[Schema::fIdC($s->getDfSsoProvider())] = $s->getDfSsoId(); /** * 2016-12-04 * Нельзя использовать здесь @see df_eav_update(), * потому что наше поле не является атрибутом EAV, * а является просто полем таблицы customer_entity. */ $c->save(); } $s->unsDfSsoId()->unsDfSsoProvider()->unsDfSsoRegistrationData(); $s->setDfNeedConfirm(df_customer_is_need_confirm($c)); }
php
function execute(O $o) { $c = df_customer($o['customer']); /** @var Customer $c */ $s = df_customer_session(); /** @var Session $s */ if ($s->getDfSsoId()) { $c[Schema::fIdC($s->getDfSsoProvider())] = $s->getDfSsoId(); /** * 2016-12-04 * Нельзя использовать здесь @see df_eav_update(), * потому что наше поле не является атрибутом EAV, * а является просто полем таблицы customer_entity. */ $c->save(); } $s->unsDfSsoId()->unsDfSsoProvider()->unsDfSsoRegistrationData(); $s->setDfNeedConfirm(df_customer_is_need_confirm($c)); }
[ "function", "execute", "(", "O", "$", "o", ")", "{", "$", "c", "=", "df_customer", "(", "$", "o", "[", "'customer'", "]", ")", ";", "/** @var Customer $c */", "$", "s", "=", "df_customer_session", "(", ")", ";", "/** @var Session $s */", "if", "(", "$", ...
2016-12-03 @override @see ObserverInterface::execute() @used-by \Magento\Framework\Event\Invoker\InvokerDefault::_callObserverMethod() @param O $o
[ "2016", "-", "12", "-", "03" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Customer/Observer/RegisterSuccess.php#L22-L37
train
mage2pro/core
Core/T/lib/csv.php
csv.t01
function t01() { $l = 'Test,Тест'; /** @var string $l */ $d = '"'; /** @var string $d */ if (!df_starts_with($l, $d)) { $p = mb_strpos($l, ','); $l = $d . mb_substr($l, 0, $p) . $d . mb_substr($l, $p); } if (!df_ends_with($l, $d)) { $p = mb_strrpos($l, ','); $l = mb_substr($l, 0, $p + 1) . $d . mb_substr($l, $p + 1) . $d; } print_r($l); }
php
function t01() { $l = 'Test,Тест'; /** @var string $l */ $d = '"'; /** @var string $d */ if (!df_starts_with($l, $d)) { $p = mb_strpos($l, ','); $l = $d . mb_substr($l, 0, $p) . $d . mb_substr($l, $p); } if (!df_ends_with($l, $d)) { $p = mb_strrpos($l, ','); $l = mb_substr($l, 0, $p + 1) . $d . mb_substr($l, $p + 1) . $d; } print_r($l); }
[ "function", "t01", "(", ")", "{", "$", "l", "=", "'Test,Тест'; /*", "*", "@var string $l */", "$", "d", "=", "'\"'", ";", "/** @var string $d */", "if", "(", "!", "df_starts_with", "(", "$", "l", ",", "$", "d", ")", ")", "{", "$", "p", "=", "mb_strpo...
2017-06-23
[ "2017", "-", "06", "-", "23" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Core/T/lib/csv.php#L9-L21
train
mage2pro/core
Sentry/ErrorHandler.php
ErrorHandler.registerExceptionHandler
function registerExceptionHandler($call_existing = true) { $this->old_exception_handler = set_exception_handler(array($this, 'handleException')); $this->call_existing_exception_handler = $call_existing; return $this; }
php
function registerExceptionHandler($call_existing = true) { $this->old_exception_handler = set_exception_handler(array($this, 'handleException')); $this->call_existing_exception_handler = $call_existing; return $this; }
[ "function", "registerExceptionHandler", "(", "$", "call_existing", "=", "true", ")", "{", "$", "this", "->", "old_exception_handler", "=", "set_exception_handler", "(", "array", "(", "$", "this", ",", "'handleException'", ")", ")", ";", "$", "this", "->", "cal...
Register a handler which will intercept unhnalded exceptions and report them to the associated Sentry client. @param bool $call_existing Call any existing exception handlers after processing this instance. @return $this
[ "Register", "a", "handler", "which", "will", "intercept", "unhnalded", "exceptions", "and", "report", "them", "to", "the", "associated", "Sentry", "client", "." ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sentry/ErrorHandler.php#L131-L136
train
mage2pro/core
Sentry/ErrorHandler.php
ErrorHandler.registerErrorHandler
function registerErrorHandler($call_existing = true, $error_types = null) { if ($error_types !== null) { $this->error_types = $error_types; } $this->old_error_handler = set_error_handler(array($this, 'handleError'), E_ALL); $this->call_existing_error_handler = $call_existing; return $this; }
php
function registerErrorHandler($call_existing = true, $error_types = null) { if ($error_types !== null) { $this->error_types = $error_types; } $this->old_error_handler = set_error_handler(array($this, 'handleError'), E_ALL); $this->call_existing_error_handler = $call_existing; return $this; }
[ "function", "registerErrorHandler", "(", "$", "call_existing", "=", "true", ",", "$", "error_types", "=", "null", ")", "{", "if", "(", "$", "error_types", "!==", "null", ")", "{", "$", "this", "->", "error_types", "=", "$", "error_types", ";", "}", "$", ...
Register a handler which will intercept standard PHP errors and report them to the associated Sentry client. @param bool $call_existing Call any existing errors handlers after processing this instance. @param array $error_types All error types that should be sent. @return $this
[ "Register", "a", "handler", "which", "will", "intercept", "standard", "PHP", "errors", "and", "report", "them", "to", "the", "associated", "Sentry", "client", "." ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sentry/ErrorHandler.php#L147-L155
train
mage2pro/core
Framework/Form/Element/GoogleFont.php
GoogleFont.onFormInitialized
final function onFormInitialized() { parent::onFormInitialized(); $this->addClass('df-google-font'); df_fe_init($this, __CLASS__, df_asset_third_party('Select2/main.css'), [ 'dataSource' => df_url_frontend('df-google-font') ,'value' => $this['value'] // 2015-12-07 It is the selected value. ]); }
php
final function onFormInitialized() { parent::onFormInitialized(); $this->addClass('df-google-font'); df_fe_init($this, __CLASS__, df_asset_third_party('Select2/main.css'), [ 'dataSource' => df_url_frontend('df-google-font') ,'value' => $this['value'] // 2015-12-07 It is the selected value. ]); }
[ "final", "function", "onFormInitialized", "(", ")", "{", "parent", "::", "onFormInitialized", "(", ")", ";", "$", "this", "->", "addClass", "(", "'df-google-font'", ")", ";", "df_fe_init", "(", "$", "this", ",", "__CLASS__", ",", "df_asset_third_party", "(", ...
2015-11-28 @override @see \Df\Framework\Form\Hidden::onFormInitialized() @used-by \Df\Framework\Plugin\Data\Form\Element\AbstractElement::afterSetForm()
[ "2015", "-", "11", "-", "28" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/GoogleFont.php#L12-L19
train
mage2pro/core
Sso/CustomerReturn.php
CustomerReturn.c
protected function c() {return dfc($this, function() { $result = df_new(df_con_heir($this, DC::class)); /** @var DC $result */ $result->validate(); return $result; });}
php
protected function c() {return dfc($this, function() { $result = df_new(df_con_heir($this, DC::class)); /** @var DC $result */ $result->validate(); return $result; });}
[ "protected", "function", "c", "(", ")", "{", "return", "dfc", "(", "$", "this", ",", "function", "(", ")", "{", "$", "result", "=", "df_new", "(", "df_con_heir", "(", "$", "this", ",", "DC", "::", "class", ")", ")", ";", "/** @var DC $result */", "$"...
2016-06-04 2016-12-01 @see \Dfe\AmazonLogin\Customer @see \Dfe\FacebookLogin\Customer 2017-02-26 @final I do not use the PHP «final» keyword here to allow refine the return type using PHPDoc. @see \Dfe\FacebookLogin\Controller\Index\Index @see \Dfe\AmazonLogin\Controller\Index\Index @return DC
[ "2016", "-", "06", "-", "04", "2016", "-", "12", "-", "01" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sso/CustomerReturn.php#L84-L88
train
mage2pro/core
Payment/W/Reader.php
Reader.t
final function t() {return dfc($this, function() {return is_null($r = $this->tRaw()) ? null : $this->te2i($r) ;});}
php
final function t() {return dfc($this, function() {return is_null($r = $this->tRaw()) ? null : $this->te2i($r) ;});}
[ "final", "function", "t", "(", ")", "{", "return", "dfc", "(", "$", "this", ",", "function", "(", ")", "{", "return", "is_null", "(", "$", "r", "=", "$", "this", "->", "tRaw", "(", ")", ")", "?", "null", ":", "$", "this", "->", "te2i", "(", "...
2017-03-10 Some PSP send only one type of notifications. In such case, a notification does not denote its own type, and this method returns null. 2017-03-13 The result is in our internal format, not in the PSP format. @used-by tl() @used-by \Df\Payment\W\Event::t() @used-by \Df\Payment\W\F::c() @used-by \Dfe\AllPay\W\Reader::isOffline() @return string|null
[ "2017", "-", "03", "-", "10", "Some", "PSP", "send", "only", "one", "type", "of", "notifications", ".", "In", "such", "case", "a", "notification", "does", "not", "denote", "its", "own", "type", "and", "this", "method", "returns", "null", ".", "2017", "...
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/W/Reader.php#L94-L96
train
mage2pro/core
Payment/W/Reader.php
Reader.error
private function error($reason) { ($r = $this->r()) ? df_sentry_extra($this, 'Request', $r) : null; throw new Critical($this->_m, $this, "The request is invalid because $reason."); }
php
private function error($reason) { ($r = $this->r()) ? df_sentry_extra($this, 'Request', $r) : null; throw new Critical($this->_m, $this, "The request is invalid because $reason."); }
[ "private", "function", "error", "(", "$", "reason", ")", "{", "(", "$", "r", "=", "$", "this", "->", "r", "(", ")", ")", "?", "df_sentry_extra", "(", "$", "this", ",", "'Request'", ",", "$", "r", ")", ":", "null", ";", "throw", "new", "Critical",...
2017-03-10 @used-by errorP() @param string $reason @throws Critical
[ "2017", "-", "03", "-", "10" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/W/Reader.php#L179-L182
train
mage2pro/core
Config/Source/WaitPeriodType.php
WaitPeriodType.calculate
static function calculate(S $s, $k = null, $kType = 'waitPeriodType') { $k = $k ?: df_caller_f(); /** @type string */ return dfcf(function(S $s, $k, $kType) { $r = $s->nat($k); /** @var int $r */ return self::$WORKING_DAYS === $s->v($kType) ? $r : df_num_calendar_days_by_num_working_days(ZD::now(), $r, $s->scope()) ; }, [$s, $k, $kType]); }
php
static function calculate(S $s, $k = null, $kType = 'waitPeriodType') { $k = $k ?: df_caller_f(); /** @type string */ return dfcf(function(S $s, $k, $kType) { $r = $s->nat($k); /** @var int $r */ return self::$WORKING_DAYS === $s->v($kType) ? $r : df_num_calendar_days_by_num_working_days(ZD::now(), $r, $s->scope()) ; }, [$s, $k, $kType]); }
[ "static", "function", "calculate", "(", "S", "$", "s", ",", "$", "k", "=", "null", ",", "$", "kType", "=", "'waitPeriodType'", ")", "{", "$", "k", "=", "$", "k", "?", ":", "df_caller_f", "(", ")", ";", "/** @type string */", "return", "dfcf", "(", ...
2017-07-30 @used-by \Dfe\AllPay\Settings::waitPeriodATM() @used-by \Dfe\Moip\Settings\Boleto::waitPeriod() @used-by \Dfe\Qiwi\Settings::waitPeriod() @param S $s @param string|null $k [optional] @param string $kType [optional] @return int
[ "2017", "-", "07", "-", "30" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Config/Source/WaitPeriodType.php#L30-L38
train
mage2pro/core
Shipping/Method.php
Method.getConfigData
final function getConfigData($k) { static $map = [ /** * 2018-04-21 * @used-by \Magento\Shipping\Model\Config::getActiveCarriers(): * public function getActiveCarriers($store = null) { * $carriers = []; * $config = $this->_scopeConfig->getValue('carriers', * \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store * ); * foreach (array_keys($config) as $carrierCode) { * if ($this->_scopeConfig->isSetFlag( * 'carriers/' . $carrierCode . '/active', * \Magento\Store\Model\ScopeInterface::SCOPE_STORE, * $store * )) { * $carrierModel = $this->_carrierFactory->create($carrierCode, $store); * if ($carrierModel) { * $carriers[$carrierCode] = $carrierModel; * } * } * } * return $carriers; * } * https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Config.php#L58-L77 * @uses \Df\Shipping\Method::isActive() */ 'active' => 'isActive' /** * 2018-04-21 * @used-by \Magento\Shipping\Model\Shipping::collectCarrierRates(): * if ($carrier->getConfigData('showmethod') == 0 && $result->getError()) { * return $this; * } * https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Shipping.php#L311-L313 * @uses \Df\Shipping\Method::showMethod() */ ,'showmethod' => 'showMethod' ]; return isset($map[$k]) ? call_user_func([$this, $map[$k]]) : $this->s($k); }
php
final function getConfigData($k) { static $map = [ /** * 2018-04-21 * @used-by \Magento\Shipping\Model\Config::getActiveCarriers(): * public function getActiveCarriers($store = null) { * $carriers = []; * $config = $this->_scopeConfig->getValue('carriers', * \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store * ); * foreach (array_keys($config) as $carrierCode) { * if ($this->_scopeConfig->isSetFlag( * 'carriers/' . $carrierCode . '/active', * \Magento\Store\Model\ScopeInterface::SCOPE_STORE, * $store * )) { * $carrierModel = $this->_carrierFactory->create($carrierCode, $store); * if ($carrierModel) { * $carriers[$carrierCode] = $carrierModel; * } * } * } * return $carriers; * } * https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Config.php#L58-L77 * @uses \Df\Shipping\Method::isActive() */ 'active' => 'isActive' /** * 2018-04-21 * @used-by \Magento\Shipping\Model\Shipping::collectCarrierRates(): * if ($carrier->getConfigData('showmethod') == 0 && $result->getError()) { * return $this; * } * https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Shipping.php#L311-L313 * @uses \Df\Shipping\Method::showMethod() */ ,'showmethod' => 'showMethod' ]; return isset($map[$k]) ? call_user_func([$this, $map[$k]]) : $this->s($k); }
[ "final", "function", "getConfigData", "(", "$", "k", ")", "{", "static", "$", "map", "=", "[", "/**\n\t\t\t * 2018-04-21\n\t\t\t * @used-by \\Magento\\Shipping\\Model\\Config::getActiveCarriers():\n\t\t\t * \tpublic function getActiveCarriers($store = null) {\n\t\t\t * \t\t$carriers = [];\...
2018-04-17 @override @see IAC::getConfigData() https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php#L15-L22 @see AC::getConfigData(): public function getConfigData($field) { if (empty($this->_code)) { return false; } $path = 'carriers/' . $this->_code . '/' . $field; return $this->_scopeConfig->getValue( $path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStore() ); } https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php#L122-L140 1) @used-by \Magento\Shipping\Model\Shipping::collectCarrierRates(): if ($carrier->getConfigData('shipment_requesttype')) { https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Shipping.php#L270-L306 2) @used-by \Magento\Shipping\Model\Shipping::collectCarrierRates(): if ($carrier->getConfigData('showmethod') == 0 && $result->getError()) { return $this; } https://github.com/magento/magento2/blob/2.2.3/app/code/Magento/Shipping/Model/Shipping.php#L311-L313 @param string $k @return mixed
[ "2018", "-", "04", "-", "17" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Shipping/Method.php#L195-L235
train
mage2pro/core
Framework/Composer/ComposerFactory.php
ComposerFactory.create
function create() { if (!getenv('COMPOSER_HOME')) { putenv('COMPOSER_HOME=' . $this->directoryList->getPath(DirectoryList::COMPOSER_HOME)); } return \Composer\Factory::create( new BufferIO(), $this->composerJsonFinder->findComposerJson() ); }
php
function create() { if (!getenv('COMPOSER_HOME')) { putenv('COMPOSER_HOME=' . $this->directoryList->getPath(DirectoryList::COMPOSER_HOME)); } return \Composer\Factory::create( new BufferIO(), $this->composerJsonFinder->findComposerJson() ); }
[ "function", "create", "(", ")", "{", "if", "(", "!", "getenv", "(", "'COMPOSER_HOME'", ")", ")", "{", "putenv", "(", "'COMPOSER_HOME='", ".", "$", "this", "->", "directoryList", "->", "getPath", "(", "DirectoryList", "::", "COMPOSER_HOME", ")", ")", ";", ...
Create \Composer\Composer @return \Composer\Composer @throws \Exception
[ "Create", "\\", "Composer", "\\", "Composer" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Composer/ComposerFactory.php#L45-L54
train
mage2pro/core
Sso/Button.php
Button.attributes
protected function attributes() {return ($this->isNative() ? $this->attributesN() : ['href' => $this->lHref(), 'title' => $this->s()->label()] ) + [ 'class' => df_cc_s( 'df-sso-button', $this->cssClass(), $this->s()->type(), $this->cssClass2() ) ,'id' => df_uid(4, "{$this->cssClass()}-") ,'rel' => 'nofollow' ] ;}
php
protected function attributes() {return ($this->isNative() ? $this->attributesN() : ['href' => $this->lHref(), 'title' => $this->s()->label()] ) + [ 'class' => df_cc_s( 'df-sso-button', $this->cssClass(), $this->s()->type(), $this->cssClass2() ) ,'id' => df_uid(4, "{$this->cssClass()}-") ,'rel' => 'nofollow' ] ;}
[ "protected", "function", "attributes", "(", ")", "{", "return", "(", "$", "this", "->", "isNative", "(", ")", "?", "$", "this", "->", "attributesN", "(", ")", ":", "[", "'href'", "=>", "$", "this", "->", "lHref", "(", ")", ",", "'title'", "=>", "$"...
2016-11-26 @used-by loggedOut() @see \Df\Sso\Button\Js::attributes() @see \Dfe\FacebookLogin\Button::attributes() @return array(string => string)
[ "2016", "-", "11", "-", "26" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sso/Button.php#L70-L81
train
mage2pro/core
Payment/Observer/VoidT.php
VoidT.execute
function execute(Observer $ob) { /** @var OP $op */ if (dfp_my($op = $ob['payment'])) { $op->getOrder()->setState(O::STATE_CLOSED)->setStatus(df_order_ds(O::STATE_CLOSED)); } }
php
function execute(Observer $ob) { /** @var OP $op */ if (dfp_my($op = $ob['payment'])) { $op->getOrder()->setState(O::STATE_CLOSED)->setStatus(df_order_ds(O::STATE_CLOSED)); } }
[ "function", "execute", "(", "Observer", "$", "ob", ")", "{", "/** @var OP $op */", "if", "(", "dfp_my", "(", "$", "op", "=", "$", "ob", "[", "'payment'", "]", ")", ")", "{", "$", "op", "->", "getOrder", "(", ")", "->", "setState", "(", "O", "::", ...
2017-01-17 @override @see ObserverInterface::execute() @used-by \Magento\Framework\Event\Invoker\InvokerDefault::_callObserverMethod() @param Observer $ob
[ "2017", "-", "01", "-", "17" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Observer/VoidT.php#L63-L68
train
mage2pro/core
API/Facade.php
Facade.path
protected function path($id, $suffix) {return df_cc_path( $this->prefix(), strtolower(df_class_l($this)) . 's', urlencode($id), $suffix );}
php
protected function path($id, $suffix) {return df_cc_path( $this->prefix(), strtolower(df_class_l($this)) . 's', urlencode($id), $suffix );}
[ "protected", "function", "path", "(", "$", "id", ",", "$", "suffix", ")", "{", "return", "df_cc_path", "(", "$", "this", "->", "prefix", "(", ")", ",", "strtolower", "(", "df_class_l", "(", "$", "this", ")", ")", ".", "'s'", ",", "urlencode", "(", ...
2017-12-03 @used-by p() @see \Dfe\AlphaCommerceHub\API\Facade::path() @see \Dfe\TBCBank\API\Facade::path() @see \Dfe\Vantiv\API\Facade::path() @see \Inkifi\Mediaclip\API\Facade\User::path() @param int|string|null $id @param string|null $suffix @return string
[ "2017", "-", "12", "-", "03" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/API/Facade.php#L231-L233
train
mage2pro/core
Sentry/Breadcrumbs/ErrorHandler.php
ErrorHandler.handleError
final function handleError($code, $m, $file = '', $line = 0, $context=[]) { // 2017-07-10 // «Magento 2.1 php7.1 will not be supported due to mcrypt deprecation» // https://github.com/magento/magento2/issues/5880 // [PHP 7.1] How to fix the «Function mcrypt_module_open() is deprecated» bug? // https://mage2.pro/t/2392 if (E_DEPRECATED !== $code || !df_contains($m, 'mcrypt') && !df_contains($m, 'mdecrypt')) { $this->ravenClient->breadcrumbs->record([ 'category' => 'error_reporting', 'message' => $m, 'level' => $this->ravenClient->translateSeverity($code), 'data' => ['code' => $code, 'line' => $line, 'file' => $file] ]); } return !$this->existingHandler ? false : call_user_func( $this->existingHandler, $code, $m, $file, $line, $context ); }
php
final function handleError($code, $m, $file = '', $line = 0, $context=[]) { // 2017-07-10 // «Magento 2.1 php7.1 will not be supported due to mcrypt deprecation» // https://github.com/magento/magento2/issues/5880 // [PHP 7.1] How to fix the «Function mcrypt_module_open() is deprecated» bug? // https://mage2.pro/t/2392 if (E_DEPRECATED !== $code || !df_contains($m, 'mcrypt') && !df_contains($m, 'mdecrypt')) { $this->ravenClient->breadcrumbs->record([ 'category' => 'error_reporting', 'message' => $m, 'level' => $this->ravenClient->translateSeverity($code), 'data' => ['code' => $code, 'line' => $line, 'file' => $file] ]); } return !$this->existingHandler ? false : call_user_func( $this->existingHandler, $code, $m, $file, $line, $context ); }
[ "final", "function", "handleError", "(", "$", "code", ",", "$", "m", ",", "$", "file", "=", "''", ",", "$", "line", "=", "0", ",", "$", "context", "=", "[", "]", ")", "{", "// 2017-07-10", "// «Magento 2.1 php7.1 will not be supported due to mcrypt deprecation...
2017-07-10 @param int $code @param string $m @param string $file @param int $line @param array $context @return bool|mixed
[ "2017", "-", "07", "-", "10" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sentry/Breadcrumbs/ErrorHandler.php#L31-L48
train
mage2pro/core
Framework/Module/PackageInfoFactory.php
PackageInfoFactory.create
function create() {$om = $this->objectManager; return $om->create(PackageInfo::class, [ 'reader' => $om->create(Reader::class, ['moduleList' => $om->create(FullModuleList::class)]) ]);}
php
function create() {$om = $this->objectManager; return $om->create(PackageInfo::class, [ 'reader' => $om->create(Reader::class, ['moduleList' => $om->create(FullModuleList::class)]) ]);}
[ "function", "create", "(", ")", "{", "$", "om", "=", "$", "this", "->", "objectManager", ";", "return", "$", "om", "->", "create", "(", "PackageInfo", "::", "class", ",", "[", "'reader'", "=>", "$", "om", "->", "create", "(", "Reader", "::", "class",...
2017-07-26 2017-08-09 We override the parent's method to use @see \Df\Framework\Module\Dir\Reader instead of @see \Magento\Framework\Module\Dir\Reader @override @see \Magento\Framework\Module\PackageInfoFactory::create(): public function create() { $fullModuleList = $this->objectManager->create(\Magento\Framework\Module\FullModuleList::class); $reader = $this->objectManager->create( \Magento\Framework\Module\Dir\Reader::class, ['moduleList' => $fullModuleList] ); return $this->objectManager->create( \Magento\Framework\Module\PackageInfo::class, ['reader' => $reader] ); } https://github.com/magento/magento2/blob/2.2.0-RC1.8/lib/internal/Magento/Framework/Module/PackageInfoFactory.php#L30-L43 @used-by \Magento\Framework\Module\DependencyChecker::__construct(): $this->packageInfo = $packageInfoFactory->create(); https://github.com/magento/magento2/blob/2.2.0-RC1.8/lib/internal/Magento/Framework/Module/DependencyChecker.php#L41-L53 @return PackageInfo
[ "2017", "-", "07", "-", "26", "2017", "-", "08", "-", "09", "We", "override", "the", "parent", "s", "method", "to", "use" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Module/PackageInfoFactory.php#L38-L40
train
mage2pro/core
Payment/Observer/Multishipping.php
Multishipping.execute
function execute(O $o) { if (df_is_checkout_multishipping()) { $p = $o['payment']; /** @var OP $p */ /** * 2017-08-28 * I intentionally do not use @see dfp_my() here, * because this function will instantiate a @see \Df\Payment\Method instance * (or use a previously cached instance). */ if (df_starts_with(($code = $p->getMethod()), 'dfe_')) { /** @var string $code */ Method::sgReset(); if ($cardId = Token::exchangedGet($code)) { /** @var string|null $cardId */ dfp_add_info($p, [Token::KEY => $cardId]); } } } }
php
function execute(O $o) { if (df_is_checkout_multishipping()) { $p = $o['payment']; /** @var OP $p */ /** * 2017-08-28 * I intentionally do not use @see dfp_my() here, * because this function will instantiate a @see \Df\Payment\Method instance * (or use a previously cached instance). */ if (df_starts_with(($code = $p->getMethod()), 'dfe_')) { /** @var string $code */ Method::sgReset(); if ($cardId = Token::exchangedGet($code)) { /** @var string|null $cardId */ dfp_add_info($p, [Token::KEY => $cardId]); } } } }
[ "function", "execute", "(", "O", "$", "o", ")", "{", "if", "(", "df_is_checkout_multishipping", "(", ")", ")", "{", "$", "p", "=", "$", "o", "[", "'payment'", "]", ";", "/** @var OP $p */", "/**\n\t\t\t * 2017-08-28\n\t\t\t * I intentionally do not use @see dfp_my()...
2017-08-28 @override @see ObserverInterface::execute() @used-by \Magento\Framework\Event\Invoker\InvokerDefault::_callObserverMethod() @param O $o
[ "2017", "-", "08", "-", "28" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Observer/Multishipping.php#L44-L60
train
mage2pro/core
Framework/Plugin/Mail/TransportInterfaceFactory.php
TransportInterfaceFactory.aroundCreate
function aroundCreate(Sb $sb, \Closure $f, array $data = []) { $container = new O; /** @var O $container */ /** 2018-01-28 @used-by \Df\Framework\Mail\TransportObserver::execute() */ df_dispatch('df_mail_transport', [self::CONTAINER => $container]); /** @var string|null $c */ return ($c = $container[self::K_TRANSPORT]) ? df_new_om($c, $data) : $f($data); }
php
function aroundCreate(Sb $sb, \Closure $f, array $data = []) { $container = new O; /** @var O $container */ /** 2018-01-28 @used-by \Df\Framework\Mail\TransportObserver::execute() */ df_dispatch('df_mail_transport', [self::CONTAINER => $container]); /** @var string|null $c */ return ($c = $container[self::K_TRANSPORT]) ? df_new_om($c, $data) : $f($data); }
[ "function", "aroundCreate", "(", "Sb", "$", "sb", ",", "\\", "Closure", "$", "f", ",", "array", "$", "data", "=", "[", "]", ")", "{", "$", "container", "=", "new", "O", ";", "/** @var O $container */", "/** 2018-01-28 @used-by \\Df\\Framework\\Mail\\TransportObs...
2018-01-28 The purpose of this plugin is to provide an ability to my Dfe_Mailgun and Dfe_SMTP modules to use an alternative mail transport instead of \Zend\Mail\Transport\Sendmail @see \Magento\Email\Model\Transport::__construct(): $this->zendTransport = new Sendmail($parameters); https://github.com/magento/magento2/blob/1a81e05b/app/code/Magento/Email/Model/Transport.php#L73 https://github.com/mage2pro/mailgun https://github.com/mage2pro/smtp @see \Magento\Framework\Mail\TransportInterfaceFactory::create(): public function create(array $data = []) { return $this->_objectManager->create($this->_instanceName, $data); } https://github.com/magento/magento2/blob/2.2.2/lib/internal/Magento/Framework/Mail/TransportInterfaceFactory.php#L42-L51 https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/Mail/TransportInterfaceFactory.php#L42-L51 @param Sb $sb @param \Closure $f @param array $data [optional] @return string
[ "2018", "-", "01", "-", "28", "The", "purpose", "of", "this", "plugin", "is", "to", "provide", "an", "ability", "to", "my", "Dfe_Mailgun", "and", "Dfe_SMTP", "modules", "to", "use", "an", "alternative", "mail", "transport", "instead", "of", "\\", "Zend", ...
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Plugin/Mail/TransportInterfaceFactory.php#L27-L33
train
mage2pro/core
Payment/Operation/Source.php
Source.addressBS
final function addressBS() { $a = $this->addressB(); /** @var OA|QA $r */ return $a->getFirstname() ? $a : $this->addressS(true); }
php
final function addressBS() { $a = $this->addressB(); /** @var OA|QA $r */ return $a->getFirstname() ? $a : $this->addressS(true); }
[ "final", "function", "addressBS", "(", ")", "{", "$", "a", "=", "$", "this", "->", "addressB", "(", ")", ";", "/** @var OA|QA $r */", "return", "$", "a", "->", "getFirstname", "(", ")", "?", "$", "a", ":", "$", "this", "->", "addressS", "(", "true", ...
2016-07-02 2017-12-21 Previously, I used @see addressMixed() here: return $this->addressMixed($bs = true); https://github.com/mage2pro/core/blob/3.5.2/Payment/Operation/Source.php#L80-L86 https://github.com/mage2pro/core/blob/3.5.2/Payment/Operation/Source.php#L217-L267 Now I think that such address mix is a bad idea. because the result address could contain components of completely different addresses. @see addressSB() @used-by \Df\Payment\Operation::addressBS() @return OA|QA|null
[ "2016", "-", "07", "-", "02", "2017", "-", "12", "-", "21", "Previously", "I", "used" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Operation/Source.php#L93-L96
train
mage2pro/core
StripeClone/CardFormatter.php
CardFormatter.exp
final function exp() {/** @var int $e */ /** @var int $m */return !($m = $this->_c->expMonth()) || !($e = $this->_c->expYear()) ? null : implode(' / ', [sprintf('%02d', $m), $e]) ;}
php
final function exp() {/** @var int $e */ /** @var int $m */return !($m = $this->_c->expMonth()) || !($e = $this->_c->expYear()) ? null : implode(' / ', [sprintf('%02d', $m), $e]) ;}
[ "final", "function", "exp", "(", ")", "{", "/** @var int $e */", "/** @var int $m */", "return", "!", "(", "$", "m", "=", "$", "this", "->", "_c", "->", "expMonth", "(", ")", ")", "||", "!", "(", "$", "e", "=", "$", "this", "->", "_c", "->", "expYe...
2017-02-11 2017-07-19 Some PSPs like Moip does not return the card's expiration date. @see \Dfe\Moip\Facade\Card::expMonth() @see \Dfe\Moip\Facade\Card::expYear() https://github.com/mage2pro/moip/blob/0.7.6/Facade/Card.php#L84-L104 @used-by \Df\StripeClone\Block\Info::prepare() @return string|null
[ "2017", "-", "02", "-", "11", "2017", "-", "07", "-", "19", "Some", "PSPs", "like", "Moip", "does", "not", "return", "the", "card", "s", "expiration", "date", "." ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/StripeClone/CardFormatter.php#L38-L41
train
mage2pro/core
StripeClone/CardFormatter.php
CardFormatter.s
final static function s($m, C $c) {return dfcf(function($m, C $c) { /** * 2017-07-19 * Unable to reduce the implementation to: * df_new(df_con_hier($m, self::class), $c); * because @uses __construct() is protected. * It is similar to @see \Df\Payment\Facade::s() * https://github.com/mage2pro/core/blob/2.8.25/Payment/Facade.php#L75-L87 */ $class = df_con_hier($m, self::class); /** @var string $class */ return new $class($c); }, func_get_args());}
php
final static function s($m, C $c) {return dfcf(function($m, C $c) { /** * 2017-07-19 * Unable to reduce the implementation to: * df_new(df_con_hier($m, self::class), $c); * because @uses __construct() is protected. * It is similar to @see \Df\Payment\Facade::s() * https://github.com/mage2pro/core/blob/2.8.25/Payment/Facade.php#L75-L87 */ $class = df_con_hier($m, self::class); /** @var string $class */ return new $class($c); }, func_get_args());}
[ "final", "static", "function", "s", "(", "$", "m", ",", "C", "$", "c", ")", "{", "return", "dfcf", "(", "function", "(", "$", "m", ",", "C", "$", "c", ")", "{", "/**\n\t\t * 2017-07-19\n\t\t * Unable to reduce the implementation to:\n\t\t * \t\tdf_new(df_con_hier(...
2017-07-19 @used-by \Df\StripeClone\Block\Info::cf() @used-by \Df\StripeClone\ConfigProvider::cards() @used-by \Df\StripeClone\Method::chargeNew() @param string|object $m @param C $c @return self
[ "2017", "-", "07", "-", "19" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/StripeClone/CardFormatter.php#L94-L105
train
mage2pro/core
Payment/Choice.php
Choice.f
final static function f($op) {return dfcf(function(OP $op) { $c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */ return new $c($m); }, [dfp($op)]);}
php
final static function f($op) {return dfcf(function(OP $op) { $c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */ return new $c($m); }, [dfp($op)]);}
[ "final", "static", "function", "f", "(", "$", "op", ")", "{", "return", "dfcf", "(", "function", "(", "OP", "$", "op", ")", "{", "$", "c", "=", "df_con_hier", "(", "$", "m", "=", "df_ar", "(", "dfpm", "(", "$", "op", ")", ",", "M", "::", "cla...
2017-04-17 @used-by dfp_choice() @param II|OP|QP|O|Q|T $op @return self
[ "2017", "-", "04", "-", "17" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Choice.php#L119-L122
train
mage2pro/core
Xml/Parser/Entity.php
Entity.leaf
function leaf($name, $default = null, $function = 'df_leaf') { /** @var string $key */ $key = "$name::$function"; if (!isset($this->{__METHOD__}[$key])) { $this->{__METHOD__}[$key] = df_n_set(call_user_func($function, $this->e()->{$name})); } /** @var string|null $result */ $result = df_n_get($this->{__METHOD__}[$key]); return df_if1(is_null($result), $default, $result); }
php
function leaf($name, $default = null, $function = 'df_leaf') { /** @var string $key */ $key = "$name::$function"; if (!isset($this->{__METHOD__}[$key])) { $this->{__METHOD__}[$key] = df_n_set(call_user_func($function, $this->e()->{$name})); } /** @var string|null $result */ $result = df_n_get($this->{__METHOD__}[$key]); return df_if1(is_null($result), $default, $result); }
[ "function", "leaf", "(", "$", "name", ",", "$", "default", "=", "null", ",", "$", "function", "=", "'df_leaf'", ")", "{", "/** @var string $key */", "$", "key", "=", "\"$name::$function\"", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "{", "__...
2015-08-16 @used-by leafB() @used-by leafF() @used-by leafI() @used-by leafSne() @param string $name @param string|null|callable $default [optional] @param string $function [optional] @return string|null
[ "2015", "-", "08", "-", "16" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Xml/Parser/Entity.php#L119-L128
train
mage2pro/core
Payment/Method.php
Method.amountFactor
protected function amountFactor() {return df_find(function($factor, $list) {return in_array($this->cPayment(), df_csv_parse($list)) ? $factor : null ;}, $this->amountFactorTable(), [], [], DF_BEFORE) ?: 100;}
php
protected function amountFactor() {return df_find(function($factor, $list) {return in_array($this->cPayment(), df_csv_parse($list)) ? $factor : null ;}, $this->amountFactorTable(), [], [], DF_BEFORE) ?: 100;}
[ "protected", "function", "amountFactor", "(", ")", "{", "return", "df_find", "(", "function", "(", "$", "factor", ",", "$", "list", ")", "{", "return", "in_array", "(", "$", "this", "->", "cPayment", "(", ")", ",", "df_csv_parse", "(", "$", "list", ")"...
2016-11-13 @used-by \Df\Payment\Method::amountFormat() @used-by \Df\Payment\Method::amountParse() @see \Dfe\AllPay\Method::amountFactor() @see \Dfe\AlphaCommerceHub\Method::amountFactor() @see \Dfe\Dragonpay\Method::amountFactor() @see \Dfe\IPay88\Method::amountFactor() @see \Dfe\Robokassa\Method::amountFactor() @see \Dfe\TwoCheckout\Method::amountFactor() @return int
[ "2016", "-", "11", "-", "13" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Method.php#L1862-L1864
train
mage2pro/core
Payment/Method.php
Method.convert
private function convert($a) {return call_user_func( [$this->currency(), lcfirst(substr(df_caller_f(), 1))], $a, $this->oq() );}
php
private function convert($a) {return call_user_func( [$this->currency(), lcfirst(substr(df_caller_f(), 1))], $a, $this->oq() );}
[ "private", "function", "convert", "(", "$", "a", ")", "{", "return", "call_user_func", "(", "[", "$", "this", "->", "currency", "(", ")", ",", "lcfirst", "(", "substr", "(", "df_caller_f", "(", ")", ",", "1", ")", ")", "]", ",", "$", "a", ",", "$...
2016-09-06 @uses \Df\Payment\Currency::fromBase() @uses \Df\Payment\Currency::fromOrder() @uses \Df\Payment\Currency::toBase() @uses \Df\Payment\Currency::toOrder() @used-by cFromBase() @used-by cToBase() @used-by cToOrder() @param float $a @return float
[ "2016", "-", "09", "-", "06" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Method.php#L2052-L2054
train
mage2pro/core
Config/Settings.php
Settings.b
final function b($k = null, $s = null, $d = false) {return df_bool($this->v( $k ?: df_caller_f(), $s, $d ));}
php
final function b($k = null, $s = null, $d = false) {return df_bool($this->v( $k ?: df_caller_f(), $s, $d ));}
[ "final", "function", "b", "(", "$", "k", "=", "null", ",", "$", "s", "=", "null", ",", "$", "d", "=", "false", ")", "{", "return", "df_bool", "(", "$", "this", "->", "v", "(", "$", "k", "?", ":", "df_caller_f", "(", ")", ",", "$", "s", ",",...
2015-11-09 @used-by \Df\API\Settings::test() @used-by \Df\Payment\Settings\_3DS::disable_() @used-by \Df\Payment\Settings\_3DS::enable_() @used-by \Df\Payment\Settings\Options::isLimited() @used-by \Df\Payment\Settings\Proxy::enable() @used-by \Dfe\AlphaCommerceHub\ConfigProvider::option() @used-by \Dfe\Moip\ConfigProvider::config() @used-by \Dfe\Stripe\ConfigProvider::config() @used-by \Dfe\TBCBank\Settings::tokenization() @used-by \Dfe\YandexKassa\Charge::pLoan() @used-by \Dfe\YandexKassa\Charge::pTax() @param string|null $k [optional] @param null|string|int|S|Store $s [optional] @param bool $d [optional] @return int
[ "2015", "-", "11", "-", "09" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Config/Settings.php#L90-L92
train
mage2pro/core
Config/Settings.php
Settings.scope
final function scope($s = null) {return !is_null($s) ? $s : ( df_is_backend() && df_is_system_config() ? df_scope() : $this->scopeDefault() );}
php
final function scope($s = null) {return !is_null($s) ? $s : ( df_is_backend() && df_is_system_config() ? df_scope() : $this->scopeDefault() );}
[ "final", "function", "scope", "(", "$", "s", "=", "null", ")", "{", "return", "!", "is_null", "(", "$", "s", ")", "?", "$", "s", ":", "(", "df_is_backend", "(", ")", "&&", "df_is_system_config", "(", ")", "?", "df_scope", "(", ")", ":", "$", "thi...
2016-03-08 2017-10-25 @uses df_is_backend() is a dirty hack here: a call for @see df_is_system_config() from @see \Dfe\Portal\Plugin\Theme\Model\View\Design::beforeGetConfigurationDesignTheme() breaks my frontend... https://github.com/mage2pro/portal/blob/0.4.4/Plugin/Theme/Model/View/Design.php#L13-L33 Maybe @see \Dfe\Portal\Plugin\Store\Model\PathConfig::afterGetDefaultPath() is also an offender... https://github.com/mage2pro/portal/blob/0.4.4/Plugin/Store/Model/PathConfig.php#L7-L17 @used-by _a() @used-by _font() @used-by _matrix() @used-by v() @used-by \Df\Config\Source\WaitPeriodType::calculate() @param null|string|int|S|Store|array(string, int) $s [optional] @return null|string|int|S|Store|array(string, int)
[ "2016", "-", "03", "-", "08", "2017", "-", "10", "-", "25" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Config/Settings.php#L201-L203
train
mage2pro/core
Config/Settings.php
Settings._matrix
final protected function _matrix($i, $j, $k = null, $s = null, $d = null) {return dfa(dfa(dfc($this, function($k, $s) {return $this->json($k, $s) ;}, [$k ?: df_caller_f(), df_scope_code($this->scope($s))]), $i, []), $j, $d) ;}
php
final protected function _matrix($i, $j, $k = null, $s = null, $d = null) {return dfa(dfa(dfc($this, function($k, $s) {return $this->json($k, $s) ;}, [$k ?: df_caller_f(), df_scope_code($this->scope($s))]), $i, []), $j, $d) ;}
[ "final", "protected", "function", "_matrix", "(", "$", "i", ",", "$", "j", ",", "$", "k", "=", "null", ",", "$", "s", "=", "null", ",", "$", "d", "=", "null", ")", "{", "return", "dfa", "(", "dfa", "(", "dfc", "(", "$", "this", ",", "function...
2016-01-29 @param int $i Номер строки @param int $j Номер столбца @param string|null $k [optional] @param null|string|int|S|Store $s [optional] @param string|null $d [optonal] @return Font
[ "2016", "-", "01", "-", "29" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Config/Settings.php#L323-L327
train
mage2pro/core
StripeClone/Payer.php
Payer.customerIdSaved
private function customerIdSaved() {return dfc($this, function() {return df_ci_get( $this->m(), !($id = df_order($this->ii())->getCustomerId()) ? null : df_customer($id) );});}
php
private function customerIdSaved() {return dfc($this, function() {return df_ci_get( $this->m(), !($id = df_order($this->ii())->getCustomerId()) ? null : df_customer($id) );});}
[ "private", "function", "customerIdSaved", "(", ")", "{", "return", "dfc", "(", "$", "this", ",", "function", "(", ")", "{", "return", "df_ci_get", "(", "$", "this", "->", "m", "(", ")", ",", "!", "(", "$", "id", "=", "df_order", "(", "$", "this", ...
2016-08-23 @used-by customerId() @used-by newCard() @return string
[ "2016", "-", "08", "-", "23" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/StripeClone/Payer.php#L99-L101
train
mage2pro/core
Payment/W/Strategy/ConfirmPending.php
ConfirmPending._handle
protected function _handle() { $o = $this->o(); /** @var O $o */ /** * 2016-03-15 * Если оставить открытой транзакцию «capture», * то операция «void» (отмена авторизации платежа) будет недоступна: * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Sales/Model/Order/Payment.php#L540-L555 * @used-by \Magento\Sales\Model\Order\Payment::canVoid() * Транзакция считается закрытой, если явно не указать «false». * * 2017-01-16 * Наоборот: если закрыть транзакцию типа «authorize», * то операция «Capture Online» из административного интерфейса будет недоступна: * @see \Magento\Sales\Model\Order\Payment::canCapture() * if ($authTransaction && $authTransaction->getIsClosed()) { * $orderTransaction = $this->transactionRepository->getByTransactionType( * Transaction::TYPE_ORDER, * $this->getId(), * $this->getOrder()->getId() * ); * if (!$orderTransaction) { * return false; * } * } * https://github.com/magento/magento2/blob/2.1.3/app/code/Magento/Sales/Model/Order/Payment.php#L263-L281 * «How is \Magento\Sales\Model\Order\Payment::canCapture() implemented and used?» * https://mage2.pro/t/650 * «How does Magento 2 decide whether to show the «Capture Online» dropdown * on a backend's invoice screen?»: https://mage2.pro/t/2475 */ $op = $this->op(); /** @var OP $op */ // 2017-03-29 // Сегодня заметил, что Kassa Compleet долбится несколько раз для одного и того же платежа. // Это приводило к повторному созданию invoice (второй invoice был с нулевой суммой). if (!$o->getTotalDue()) { $this->softFailure('This payment is already confirmed.'); } else { $e = $this->e(); /** @var Ev $e */ /** * 2016-07-14 * Если покупатель не смог или не захотел оплатить заказ, то мы заказ отменяем, * а затем, когда платёжная система возвратит покупателя в магазин, * то мы проверим, не отменён ли последний заказ, * и если он отменён — то восстановим корзину покупателя. * 2017-11-17 * From now on, a webhook and customer return can be the same: * "@see \Df\Payment\W\Action should optionally make the same processing * as @see \Df\Payment\CustomerReturn": https://github.com/mage2pro/core/issues/52 * * 2017-08-30 * If you want to ignore an event here, then: * 1) Return `true` from @see \Df\Payment\W\Event::isSuccessful() * 2) Return any value except \Df\Payment\W\Event::T_AUTHORIZE and \Df\Payment\W\Event::T_CAPTURE * from @see \Df\Payment\W\Event::ttCurrent(). * This value will be the current transaction suffix: * @used-by \Df\PaypalClone\W\Nav::id() * @used-by \Df\StripeClone\W\Nav::id() * so it should be unique in a payment processing cycle: * a particular payment can not have multiple transactions with the same suffix. */ if ($succ = !df_request(Operation::FAILURE) && $e->isSuccessful()) { /** @var bool $succ */ df_redirect_to_success(); if ($action = dfa([Ev::T_AUTHORIZE => AC::A, Ev::T_CAPTURE => AC::C], $e->ttCurrent())) { /** @var string|null $action */ $op->setIsTransactionClosed(AC::C === $action); /** * 2017-01-15 * $this->m()->setStore($o->getStoreId()); здесь не нужно, * потому что это делается автоматически в ядре: * @see \Magento\Sales\Model\Order\Payment\Operations\AuthorizeOperation::authorize(): * $method->setStore($order->getStoreId()); * https://github.com/magento/magento2/blob/2.1.3/app/code/Magento/Sales/Model/Order/Payment/Operations/AuthorizeOperation.php#L44 * * 2017-03-26 * Этот вызов приводит к добавлению транзакции типа $action: * https://github.com/mage2pro/core/blob/2.4.2/Payment/W/Nav.php#L100-L114 * Идентификатор и данные транзакции мы уже установили в методе @see \Df\Payment\W\Nav::op() */ dfp_action($op, $action); } $this->onSuccess(); } else { /** * 2016-07-10 * @uses \Magento\Sales\Model\Order\Payment\Transaction::TYPE_PAYMENT — * это единственная транзакции без специального назначения, * и поэтому мы можем безопасно его использовать. * 2017-01-16 * Идентификатор и данные транзакции мы уже установили в методе @see \Df\Payment\W\Nav::op() */ $op->addTransaction(T::TYPE_PAYMENT); if ($o->canCancel()) { $o->cancel(); } $ss = df_checkout_session(); /** @var Session|DfSession $ss */ /** * 2017-11-17 * Note 1. * "@see \Df\Payment\W\Action should optionally make the same processing * as @see \Df\Payment\CustomerReturn": https://github.com/mage2pro/core/issues/52 * Note 2. * I have implemented it by analowi with @see \Df\Payment\CustomerReturn::execute(): * if ($o && $o->canCancel()) { * $o->cancel()->save(); * } * $ss->restoreQuote(); * https://github.com/mage2pro/core/blob/3.3.16/Payment/CustomerReturn.php#L47-L50 * 2017-11-18 * "Implement a function to distinguish between a customer return from a PSP payment page * and a PSP webhook notification": https://github.com/mage2pro/core/issues/53 */ if ($ss->getLastRealOrderId()) { $ss->restoreQuote(); /** @var string $msg */ $msg = $this->s()->messageFailure($e->statusT(), $o->getStore()); // 2017-04-13 // @todo Надо бы здесь дополнительно сохранять в транзакции ответ ПС. // У меня-то он логируется в Sentry, но вот администратор магазина его не видит. df_order_comment($o, $msg, true, true); $this->h()->responder()->setError($msg); // 2016-05-06 // «How to redirect a customer to the checkout payment step?» // https://mage2.pro/t/1523 df_redirect_to_payment(); } } $o->save(); // 2016-08-17 // https://code.dmitry-fedyuk.com/m2e/allpay/issues/17 // Письмо отсылаем только если isSuccessful() вернуло true // (при этом не факт, что оплата уже прошла: при оффлайновом способе оплаты // isSuccessful() говорит лишь о том, что покупатель успешно выбрал оффлайновый способ оплаты, // а подтверждение платежа придёт лишь потом, через несколько дней). if ($succ) { dfp_mail($o); } // 2017-09-13 // We do not set a response here, because PayPal clones require a specific response on success. } }
php
protected function _handle() { $o = $this->o(); /** @var O $o */ /** * 2016-03-15 * Если оставить открытой транзакцию «capture», * то операция «void» (отмена авторизации платежа) будет недоступна: * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Sales/Model/Order/Payment.php#L540-L555 * @used-by \Magento\Sales\Model\Order\Payment::canVoid() * Транзакция считается закрытой, если явно не указать «false». * * 2017-01-16 * Наоборот: если закрыть транзакцию типа «authorize», * то операция «Capture Online» из административного интерфейса будет недоступна: * @see \Magento\Sales\Model\Order\Payment::canCapture() * if ($authTransaction && $authTransaction->getIsClosed()) { * $orderTransaction = $this->transactionRepository->getByTransactionType( * Transaction::TYPE_ORDER, * $this->getId(), * $this->getOrder()->getId() * ); * if (!$orderTransaction) { * return false; * } * } * https://github.com/magento/magento2/blob/2.1.3/app/code/Magento/Sales/Model/Order/Payment.php#L263-L281 * «How is \Magento\Sales\Model\Order\Payment::canCapture() implemented and used?» * https://mage2.pro/t/650 * «How does Magento 2 decide whether to show the «Capture Online» dropdown * on a backend's invoice screen?»: https://mage2.pro/t/2475 */ $op = $this->op(); /** @var OP $op */ // 2017-03-29 // Сегодня заметил, что Kassa Compleet долбится несколько раз для одного и того же платежа. // Это приводило к повторному созданию invoice (второй invoice был с нулевой суммой). if (!$o->getTotalDue()) { $this->softFailure('This payment is already confirmed.'); } else { $e = $this->e(); /** @var Ev $e */ /** * 2016-07-14 * Если покупатель не смог или не захотел оплатить заказ, то мы заказ отменяем, * а затем, когда платёжная система возвратит покупателя в магазин, * то мы проверим, не отменён ли последний заказ, * и если он отменён — то восстановим корзину покупателя. * 2017-11-17 * From now on, a webhook and customer return can be the same: * "@see \Df\Payment\W\Action should optionally make the same processing * as @see \Df\Payment\CustomerReturn": https://github.com/mage2pro/core/issues/52 * * 2017-08-30 * If you want to ignore an event here, then: * 1) Return `true` from @see \Df\Payment\W\Event::isSuccessful() * 2) Return any value except \Df\Payment\W\Event::T_AUTHORIZE and \Df\Payment\W\Event::T_CAPTURE * from @see \Df\Payment\W\Event::ttCurrent(). * This value will be the current transaction suffix: * @used-by \Df\PaypalClone\W\Nav::id() * @used-by \Df\StripeClone\W\Nav::id() * so it should be unique in a payment processing cycle: * a particular payment can not have multiple transactions with the same suffix. */ if ($succ = !df_request(Operation::FAILURE) && $e->isSuccessful()) { /** @var bool $succ */ df_redirect_to_success(); if ($action = dfa([Ev::T_AUTHORIZE => AC::A, Ev::T_CAPTURE => AC::C], $e->ttCurrent())) { /** @var string|null $action */ $op->setIsTransactionClosed(AC::C === $action); /** * 2017-01-15 * $this->m()->setStore($o->getStoreId()); здесь не нужно, * потому что это делается автоматически в ядре: * @see \Magento\Sales\Model\Order\Payment\Operations\AuthorizeOperation::authorize(): * $method->setStore($order->getStoreId()); * https://github.com/magento/magento2/blob/2.1.3/app/code/Magento/Sales/Model/Order/Payment/Operations/AuthorizeOperation.php#L44 * * 2017-03-26 * Этот вызов приводит к добавлению транзакции типа $action: * https://github.com/mage2pro/core/blob/2.4.2/Payment/W/Nav.php#L100-L114 * Идентификатор и данные транзакции мы уже установили в методе @see \Df\Payment\W\Nav::op() */ dfp_action($op, $action); } $this->onSuccess(); } else { /** * 2016-07-10 * @uses \Magento\Sales\Model\Order\Payment\Transaction::TYPE_PAYMENT — * это единственная транзакции без специального назначения, * и поэтому мы можем безопасно его использовать. * 2017-01-16 * Идентификатор и данные транзакции мы уже установили в методе @see \Df\Payment\W\Nav::op() */ $op->addTransaction(T::TYPE_PAYMENT); if ($o->canCancel()) { $o->cancel(); } $ss = df_checkout_session(); /** @var Session|DfSession $ss */ /** * 2017-11-17 * Note 1. * "@see \Df\Payment\W\Action should optionally make the same processing * as @see \Df\Payment\CustomerReturn": https://github.com/mage2pro/core/issues/52 * Note 2. * I have implemented it by analowi with @see \Df\Payment\CustomerReturn::execute(): * if ($o && $o->canCancel()) { * $o->cancel()->save(); * } * $ss->restoreQuote(); * https://github.com/mage2pro/core/blob/3.3.16/Payment/CustomerReturn.php#L47-L50 * 2017-11-18 * "Implement a function to distinguish between a customer return from a PSP payment page * and a PSP webhook notification": https://github.com/mage2pro/core/issues/53 */ if ($ss->getLastRealOrderId()) { $ss->restoreQuote(); /** @var string $msg */ $msg = $this->s()->messageFailure($e->statusT(), $o->getStore()); // 2017-04-13 // @todo Надо бы здесь дополнительно сохранять в транзакции ответ ПС. // У меня-то он логируется в Sentry, но вот администратор магазина его не видит. df_order_comment($o, $msg, true, true); $this->h()->responder()->setError($msg); // 2016-05-06 // «How to redirect a customer to the checkout payment step?» // https://mage2.pro/t/1523 df_redirect_to_payment(); } } $o->save(); // 2016-08-17 // https://code.dmitry-fedyuk.com/m2e/allpay/issues/17 // Письмо отсылаем только если isSuccessful() вернуло true // (при этом не факт, что оплата уже прошла: при оффлайновом способе оплаты // isSuccessful() говорит лишь о том, что покупатель успешно выбрал оффлайновый способ оплаты, // а подтверждение платежа придёт лишь потом, через несколько дней). if ($succ) { dfp_mail($o); } // 2017-09-13 // We do not set a response here, because PayPal clones require a specific response on success. } }
[ "protected", "function", "_handle", "(", ")", "{", "$", "o", "=", "$", "this", "->", "o", "(", ")", ";", "/** @var O $o */", "/**\n\t\t * 2016-03-15\n\t\t * Если оставить открытой транзакцию «capture»,\n\t\t * то операция «void» (отмена авторизации платежа) будет недоступна:\n\t\t ...
2017-01-15 @override @see \Df\Payment\W\Strategy::_handle() @used-by \Df\Payment\W\Strategy::::handle()
[ "2017", "-", "01", "-", "15" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/W/Strategy/ConfirmPending.php#L27-L168
train
mage2pro/core
Config/FrontendModel.php
FrontendModel.render
function render(AE $element) { /** * Система использует frontend_model как одиночки: * https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Config/Block/System/Config/Form.php#L319 * А нам удобнее для каждого рисования создавать отдельный экземпляр. */ $i = clone $this; $i->_element = $element; return $i->_render(); }
php
function render(AE $element) { /** * Система использует frontend_model как одиночки: * https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Config/Block/System/Config/Form.php#L319 * А нам удобнее для каждого рисования создавать отдельный экземпляр. */ $i = clone $this; $i->_element = $element; return $i->_render(); }
[ "function", "render", "(", "AE", "$", "element", ")", "{", "/**\n\t\t * Система использует frontend_model как одиночки:\n\t\t * https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Config/Block/System/Config/Form.php#L319\n\t\t * А нам удобнее для каждого рисования создавать отдельный экз...
2015-12-15 @override @see RendererInterface::render() @used-by \Magento\Framework\Data\Form\Element\AbstractElement::getHtml() https://github.com/magento/magento2/blob/2.0.0/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php#L465 @param AE $element @return string
[ "2015", "-", "12", "-", "15" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Config/FrontendModel.php#L33-L42
train
mage2pro/core
PaypalClone/W/Event.php
Event.statusT
final function statusT() {return ($k = $this->k_statusT()) ? $this->r($k) : dftr( $this->status(), df_module_json($this, 'statuses', false) );}
php
final function statusT() {return ($k = $this->k_statusT()) ? $this->r($k) : dftr( $this->status(), df_module_json($this, 'statuses', false) );}
[ "final", "function", "statusT", "(", ")", "{", "return", "(", "$", "k", "=", "$", "this", "->", "k_statusT", "(", ")", ")", "?", "$", "this", "->", "r", "(", "$", "k", ")", ":", "dftr", "(", "$", "this", "->", "status", "(", ")", ",", "df_mod...
2017-01-02 @override @see \Df\Payment\W\Event::statusT() @used-by \Df\Payment\W\Handler::log() @used-by \Df\Payment\W\Strategy\ConfirmPending::_handle() @return string|null
[ "2017", "-", "01", "-", "02" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/PaypalClone/W/Event.php#L135-L137
train
mage2pro/core
Framework/W/Result.php
Result.renderResult
function renderResult(IResponse $r) { if ($this->_code) { $r->setHttpResponseCode($this->_code); } foreach ($this->_headers as $headerData) { $r->setHeader($headerData['name'], $headerData['value'], $headerData['replace']); } $this->render($r); return null; }
php
function renderResult(IResponse $r) { if ($this->_code) { $r->setHttpResponseCode($this->_code); } foreach ($this->_headers as $headerData) { $r->setHeader($headerData['name'], $headerData['value'], $headerData['replace']); } $this->render($r); return null; }
[ "function", "renderResult", "(", "IResponse", "$", "r", ")", "{", "if", "(", "$", "this", "->", "_code", ")", "{", "$", "r", "->", "setHttpResponseCode", "(", "$", "this", "->", "_code", ")", ";", "}", "foreach", "(", "$", "this", "->", "_headers", ...
2016-08-24 Render content. @final Unable to use the PHP «final» keyword here because of the M2 code generation. @override @see \Magento\Framework\Controller\ResultInterface::renderResult() @see \Magento\Framework\Controller\AbstractResult::renderResult() @used-by \Magento\Framework\App\Http::launch(): // TODO: Temporary solution until all controllers return ResultInterface (MAGETWO-28359) if ($result instanceof ResultInterface) { $this->registry->register('use_page_cache_plugin', true, true); $result->renderResult($this->_response); } elseif ($result instanceof HttpInterface) { $this->_response = $result; } else { throw new \InvalidArgumentException('Invalid return type'); } https://github.com/magento/magento2/blob/2.2.1/lib/internal/Magento/Framework/App/Http.php#L122-L149 @param IResponse|IHttpResponse|HttpResponse $r @return null It is not used.
[ "2016", "-", "08", "-", "24", "Render", "content", "." ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/W/Result.php#L76-L85
train
mage2pro/core
Payment/Block/Info.php
Info.ci
final protected function ci() {return dfc($this, function() {return /** @var C $c */ /** @var string $id */ /** @var array(string => mixed) $ci */ !($c = $this->c()) || !($id = $this->ciId()) || !($ci = df_ci_get($this->m(), $c)) ? [] : dfa($ci, $id) ;});}
php
final protected function ci() {return dfc($this, function() {return /** @var C $c */ /** @var string $id */ /** @var array(string => mixed) $ci */ !($c = $this->c()) || !($id = $this->ciId()) || !($ci = df_ci_get($this->m(), $c)) ? [] : dfa($ci, $id) ;});}
[ "final", "protected", "function", "ci", "(", ")", "{", "return", "dfc", "(", "$", "this", ",", "function", "(", ")", "{", "return", "/** @var C $c */", "/** @var string $id */", "/** @var array(string => mixed) $ci */", "!", "(", "$", "c", "=", "$", "this", "-...
2018-11-16 @used-by \Dfe\TBCBank\Block\Info::cardData() @return array(string => mixed)|null
[ "2018", "-", "11", "-", "16" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Block/Info.php#L238-L242
train
mage2pro/core
Payment/Block/Info.php
Info.iia
final protected function iia(...$keys) {$i = $this->ii(); return !$keys ? $i->getAdditionalInformation() : ( 1 === count($keys) ? $i->getAdditionalInformation(df_first($keys)) : dfa_select_ordered($i->getAdditionalInformation(), $keys) ) ;}
php
final protected function iia(...$keys) {$i = $this->ii(); return !$keys ? $i->getAdditionalInformation() : ( 1 === count($keys) ? $i->getAdditionalInformation(df_first($keys)) : dfa_select_ordered($i->getAdditionalInformation(), $keys) ) ;}
[ "final", "protected", "function", "iia", "(", "...", "$", "keys", ")", "{", "$", "i", "=", "$", "this", "->", "ii", "(", ")", ";", "return", "!", "$", "keys", "?", "$", "i", "->", "getAdditionalInformation", "(", ")", ":", "(", "1", "===", "count...
2016-05-21 @used-by \Dfe\TwoCheckout\Block\Info::cardNumber() @used-by \Dfe\TwoCheckout\Block\Info::prepare() @param string[] ...$keys @return mixed|array(string => mixed)
[ "2016", "-", "05", "-", "21" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Block/Info.php#L343-L349
train
mage2pro/core
Payment/Block/Info.php
Info.siEx
final protected function siEx($k, $v = null) { if ($this->extended()) { $this->si($k, $v); } }
php
final protected function siEx($k, $v = null) { if ($this->extended()) { $this->si($k, $v); } }
[ "final", "protected", "function", "siEx", "(", "$", "k", ",", "$", "v", "=", "null", ")", "{", "if", "(", "$", "this", "->", "extended", "(", ")", ")", "{", "$", "this", "->", "si", "(", "$", "k", ",", "$", "v", ")", ";", "}", "}" ]
2016-11-17 @used-by siID() @used-by \Df\GingerPaymentsBase\Block\Info::prepare() @used-by \Df\StripeClone\Block\Info::prepare() @used-by \Dfe\AllPay\Block\Info::prepare() @used-by \Dfe\AlphaCommerceHub\Block\Info::prepare() @used-by \Dfe\AlphaCommerceHub\Block\Info::prepare() @used-by \Dfe\IPay88\Block\Info::prepare() @used-by \Dfe\PostFinance\Block\Info::prepare() @used-by \Dfe\SecurePay\Block\Info::prepare() @used-by \Dfe\TBCBank\Block\Info::prepare() @used-by \Dfe\TwoCheckout\Block\Info::prepare() @param string|Phrase|null|array(string => string) $k @param string|null $v [optional]
[ "2016", "-", "11", "-", "17" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Block/Info.php#L588-L592
train
mage2pro/core
Payment/Block/Info.php
Info.siID
final protected function siID() {return $this->siEx( $this->transIDLabel(), $this->m()->tidFormat($this->tm()->tReq(), true) );}
php
final protected function siID() {return $this->siEx( $this->transIDLabel(), $this->m()->tidFormat($this->tm()->tReq(), true) );}
[ "final", "protected", "function", "siID", "(", ")", "{", "return", "$", "this", "->", "siEx", "(", "$", "this", "->", "transIDLabel", "(", ")", ",", "$", "this", "->", "m", "(", ")", "->", "tidFormat", "(", "$", "this", "->", "tm", "(", ")", "->"...
2017-03-29 @used-by \Df\GingerPaymentsBase\Block\Info::prepareCommon() @used-by \Df\StripeClone\Block\Info::prepare()
[ "2017", "-", "03", "-", "29" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Block/Info.php#L599-L601
train
mage2pro/core
Payment/Block/Info.php
Info.rTable
private function rTable() {return !$this->dic()->count() ? '' : df_tag('table', !df_is_backend() ? 'data table' : df_cc_s( 'data-table admin__table-secondary df-payment-info', $this->ii('method') ) ,df_cc_n(df_map($this->dic(), function(Entry $e) {return df_tag('tr', [], !$e->name() ? df_tag('td', ['colspan' => 2], $e->value()) : // 2017-07-19 // The previous code for the second argument was: $b ? [] : ['scope' => 'row']. // It was ported from the core. // But it looks like `scope=row` is not used anywhere. df_tag('th', [], $e->name()) . df_tag('td', [], $e->value()) ) ;})) );}
php
private function rTable() {return !$this->dic()->count() ? '' : df_tag('table', !df_is_backend() ? 'data table' : df_cc_s( 'data-table admin__table-secondary df-payment-info', $this->ii('method') ) ,df_cc_n(df_map($this->dic(), function(Entry $e) {return df_tag('tr', [], !$e->name() ? df_tag('td', ['colspan' => 2], $e->value()) : // 2017-07-19 // The previous code for the second argument was: $b ? [] : ['scope' => 'row']. // It was ported from the core. // But it looks like `scope=row` is not used anywhere. df_tag('th', [], $e->name()) . df_tag('td', [], $e->value()) ) ;})) );}
[ "private", "function", "rTable", "(", ")", "{", "return", "!", "$", "this", "->", "dic", "(", ")", "->", "count", "(", ")", "?", "''", ":", "df_tag", "(", "'table'", ",", "!", "df_is_backend", "(", ")", "?", "'data table'", ":", "df_cc_s", "(", "'d...
2017-03-25 @used-by _toHtml() @return string
[ "2017", "-", "03", "-", "25" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Block/Info.php#L720-L734
train
mage2pro/core
Sso/Css.php
Css._toHtml
final protected function _toHtml() { $hhl = df_style_inline_hide('.header.links', '#switcher-currency'); /** @var string $hhl */ return self::isAccConfirmation() ? $hhl . df_style_inline_hide('.login-container') : (self::isRegCompletion() ? $hhl . df_js(__CLASS__, 'reg-completion') : '') ;}
php
final protected function _toHtml() { $hhl = df_style_inline_hide('.header.links', '#switcher-currency'); /** @var string $hhl */ return self::isAccConfirmation() ? $hhl . df_style_inline_hide('.login-container') : (self::isRegCompletion() ? $hhl . df_js(__CLASS__, 'reg-completion') : '') ;}
[ "final", "protected", "function", "_toHtml", "(", ")", "{", "$", "hhl", "=", "df_style_inline_hide", "(", "'.header.links'", ",", "'#switcher-currency'", ")", ";", "/** @var string $hhl */", "return", "self", "::", "isAccConfirmation", "(", ")", "?", "$", "hhl", ...
2016-12-04 @override @see _P::_toHtml() @used-by _P::toHtml(): $html = $this->_loadCache(); if ($html === false) { if ($this->hasData('translate_inline')) { $this->inlineTranslation->suspend($this->getData('translate_inline')); } $this->_beforeToHtml(); $html = $this->_toHtml(); $this->_saveCache($html); if ($this->hasData('translate_inline')) { $this->inlineTranslation->resume(); } } $html = $this->_afterToHtml($html); https://github.com/magento/magento2/blob/2.2.0/lib/internal/Magento/Framework/View/Element/AbstractBlock.php#L643-L689 @return string
[ "2016", "-", "12", "-", "04" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sso/Css.php#L33-L37
train
mage2pro/core
Payment/Currency.php
Currency.f
final static function f($m) {return dfcf(function(M $m) { /** @var self $i */ $i = df_new(df_con_heir($m, __CLASS__)); $i->_m = $m; return $i; }, [dfpm($m)]);}
php
final static function f($m) {return dfcf(function(M $m) { /** @var self $i */ $i = df_new(df_con_heir($m, __CLASS__)); $i->_m = $m; return $i; }, [dfpm($m)]);}
[ "final", "static", "function", "f", "(", "$", "m", ")", "{", "return", "dfcf", "(", "function", "(", "M", "$", "m", ")", "{", "/** @var self $i */", "$", "i", "=", "df_new", "(", "df_con_heir", "(", "$", "m", ",", "__CLASS__", ")", ")", ";", "$", ...
2017-10-12 @used-by dfp_currency() @param object|string $m @return self
[ "2017", "-", "10", "-", "12" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/Currency.php#L151-L153
train
mage2pro/core
Framework/Form/Element/Url.php
Url.getElementHtml
function getElementHtml() {return df_tag('div', ['class' => 'df-url', 'id' => $this->getId()], $this->thirdPartyLocalhost() ? $this->messageForThirdPartyLocalhost() : $this->messageForOthers() );}
php
function getElementHtml() {return df_tag('div', ['class' => 'df-url', 'id' => $this->getId()], $this->thirdPartyLocalhost() ? $this->messageForThirdPartyLocalhost() : $this->messageForOthers() );}
[ "function", "getElementHtml", "(", ")", "{", "return", "df_tag", "(", "'div'", ",", "[", "'class'", "=>", "'df-url'", ",", "'id'", "=>", "$", "this", "->", "getId", "(", ")", "]", ",", "$", "this", "->", "thirdPartyLocalhost", "(", ")", "?", "$", "th...
2016-05-30 2016-06-07 @final Unable to use the PHP «final» keyword here because of the M2 code generation. 'id' => $this->getId() нужно для совместимости с 2.0.6, иначе там сбой в выражении inputs = $(idTo).up(this._config.levels_up) https://mail.google.com/mail/u/0/#search/maged%40wrapco.com.au/15510135c446afdb @override @see \Magento\Framework\Data\Form\Element\AbstractElement::getElementHtml() @used-by \Magento\Framework\Data\Form\Element\AbstractElement::getDefaultHtml(): public function getDefaultHtml() { $html = $this->getData('default_html'); if ($html === null) { $html = $this->getNoSpan() === true ? '' : '<div class="admin__field">' . "\n"; $html .= $this->getLabelHtml(); $html .= $this->getElementHtml(); $html .= $this->getNoSpan() === true ? '' : '</div>' . "\n"; } return $html; } https://github.com/magento/magento2/blob/2.2.0-RC1.8/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php#L426-L441 @return string
[ "2016", "-", "05", "-", "30", "2016", "-", "06", "-", "07" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Url.php#L48-L50
train
mage2pro/core
API/Client.php
Client.resPath
final protected function resPath($k) {$this->addFilterResAV(function(array $a) use($k) {return dfa_deep($a, $k, $a) ;});}
php
final protected function resPath($k) {$this->addFilterResAV(function(array $a) use($k) {return dfa_deep($a, $k, $a) ;});}
[ "final", "protected", "function", "resPath", "(", "$", "k", ")", "{", "$", "this", "->", "addFilterResAV", "(", "function", "(", "array", "$", "a", ")", "use", "(", "$", "k", ")", "{", "return", "dfa_deep", "(", "$", "a", ",", "$", "k", ",", "$",...
2019-04-04 @used-by \Inkifi\Pwinty\API\Client::_construct() @param string $k
[ "2019", "-", "04", "-", "04" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/API/Client.php#L256-L258
train
mage2pro/core
API/Client.php
Client.setup
private function setup(array $config) { $r = new C(null, $config + [ 'timeout' => 120 /** * 2017-07-16 * By default it is «Zend_Http_Client»: @see C::$config * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126 */ ,'useragent' => 'Mage2.PRO' ]); /** @var C $r */ /** @var aProxy|aSocket $a */ if (!($p = $this->proxy())) { /** @var IProxy $p */ $a = new aSocket; } else { // 2019-01-14 // https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy $a = new aProxy; $r->setConfig([ 'proxy_host' => $p->host() ,'proxy_pass' => $p->password() ,'proxy_port' => $p->port() ,'proxy_user' => $p->username() ]); } if ($p || !$this->verifyCertificate()) { $ssl = ['allow_self_signed' => true, 'verify_peer' => false]; /** @var array(string => bool) $ssl */ if ($p) { // 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219 $ssl['verify_peer_name'] = false; } $a->setStreamContext(['ssl' => $ssl]); } $r->setAdapter($a); return $r; }
php
private function setup(array $config) { $r = new C(null, $config + [ 'timeout' => 120 /** * 2017-07-16 * By default it is «Zend_Http_Client»: @see C::$config * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126 */ ,'useragent' => 'Mage2.PRO' ]); /** @var C $r */ /** @var aProxy|aSocket $a */ if (!($p = $this->proxy())) { /** @var IProxy $p */ $a = new aSocket; } else { // 2019-01-14 // https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy $a = new aProxy; $r->setConfig([ 'proxy_host' => $p->host() ,'proxy_pass' => $p->password() ,'proxy_port' => $p->port() ,'proxy_user' => $p->username() ]); } if ($p || !$this->verifyCertificate()) { $ssl = ['allow_self_signed' => true, 'verify_peer' => false]; /** @var array(string => bool) $ssl */ if ($p) { // 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219 $ssl['verify_peer_name'] = false; } $a->setStreamContext(['ssl' => $ssl]); } $r->setAdapter($a); return $r; }
[ "private", "function", "setup", "(", "array", "$", "config", ")", "{", "$", "r", "=", "new", "C", "(", "null", ",", "$", "config", "+", "[", "'timeout'", "=>", "120", "/**\n\t\t\t * 2017-07-16\n\t\t\t * By default it is «Zend_Http_Client»: @see C::$config\n\t\t\t * ht...
2019-01-14 @used-by __construct() @param array(string => mixed) $config @return C
[ "2019", "-", "01", "-", "14" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/API/Client.php#L440-L475
train
mage2pro/core
Core/T/lib/url.php
url.t01
function t01() { print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/index/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/index') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill') . "\n"); print_r(df_url_trim_index('https://mage2.pro') . "\n"); print_r(df_url_trim_index('/sandbox/dfe-paymill/index/index/') . "\n"); }
php
function t01() { print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/index/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/index') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/index') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill/') . "\n"); print_r(df_url_trim_index('https://mage2.pro/sandbox/dfe-paymill') . "\n"); print_r(df_url_trim_index('https://mage2.pro') . "\n"); print_r(df_url_trim_index('/sandbox/dfe-paymill/index/index/') . "\n"); }
[ "function", "t01", "(", ")", "{", "print_r", "(", "df_url_trim_index", "(", "'https://mage2.pro/sandbox/dfe-paymill/index/index/'", ")", ".", "\"\\n\"", ")", ";", "print_r", "(", "df_url_trim_index", "(", "'https://mage2.pro/sandbox/dfe-paymill/index/index'", ")", ".", "\...
2017-02-13
[ "2017", "-", "02", "-", "13" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Core/T/lib/url.php#L9-L18
train
mage2pro/core
Framework/Form/Element/Multiselect.php
Multiselect.getElementHtml
function getElementHtml() { /** @var string $r */ if (!$this->ordered()) { $r = parent::getElementHtml(); } else { $r = ''; $this->addClass('select multiselect admin__control-multiselect'); if ($this->getCanBeEmpty()) { $r .= '<input type="hidden" name="' . parent::getName() . '" value="" />'; } $r .= '<select id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" ' . $this->serialize($this->getHtmlAttributes()) . $this->_getUiId() . ' multiple="multiple">' . "\n" ; $selectedA = $this->getValue(); if (!is_array($selectedA)) { $selectedA = explode(',', $selectedA); } if ($options = $this->getValues()) { // 2017-09-23 BEGIN PATCH $options = df_map_r(function(array $o) {return [ is_array($o['value']) ? df_uid() : $o['value'], $o ];}, $options); $prepend = []; /** @var array $prepend */ foreach ($selectedA as $selectedI) { /** @var string $selectedI */ if (isset($options[$selectedI])) { $prepend[]= $options[$selectedI]; unset($options[$selectedI]); } } $options = array_merge($prepend, $options); // 2017-09-23 END PATCH foreach ($options as $option) { if (is_array($option['value'])) { $r .= '<optgroup label="' . $option['label'] . '">' . "\n"; foreach ($option['value'] as $groupItem) { $r .= $this->_optionToHtml($groupItem, $selectedA); } $r .= '</optgroup>' . "\n"; } else { $r .= $this->_optionToHtml($option, $selectedA); } } } $r .= '</select>' . "\n"; $r .= $this->getAfterElementHtml(); } return $r; }
php
function getElementHtml() { /** @var string $r */ if (!$this->ordered()) { $r = parent::getElementHtml(); } else { $r = ''; $this->addClass('select multiselect admin__control-multiselect'); if ($this->getCanBeEmpty()) { $r .= '<input type="hidden" name="' . parent::getName() . '" value="" />'; } $r .= '<select id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" ' . $this->serialize($this->getHtmlAttributes()) . $this->_getUiId() . ' multiple="multiple">' . "\n" ; $selectedA = $this->getValue(); if (!is_array($selectedA)) { $selectedA = explode(',', $selectedA); } if ($options = $this->getValues()) { // 2017-09-23 BEGIN PATCH $options = df_map_r(function(array $o) {return [ is_array($o['value']) ? df_uid() : $o['value'], $o ];}, $options); $prepend = []; /** @var array $prepend */ foreach ($selectedA as $selectedI) { /** @var string $selectedI */ if (isset($options[$selectedI])) { $prepend[]= $options[$selectedI]; unset($options[$selectedI]); } } $options = array_merge($prepend, $options); // 2017-09-23 END PATCH foreach ($options as $option) { if (is_array($option['value'])) { $r .= '<optgroup label="' . $option['label'] . '">' . "\n"; foreach ($option['value'] as $groupItem) { $r .= $this->_optionToHtml($groupItem, $selectedA); } $r .= '</optgroup>' . "\n"; } else { $r .= $this->_optionToHtml($option, $selectedA); } } } $r .= '</select>' . "\n"; $r .= $this->getAfterElementHtml(); } return $r; }
[ "function", "getElementHtml", "(", ")", "{", "/** @var string $r */", "if", "(", "!", "$", "this", "->", "ordered", "(", ")", ")", "{", "$", "r", "=", "parent", "::", "getElementHtml", "(", ")", ";", "}", "else", "{", "$", "r", "=", "''", ";", "$",...
2017-09-23 @override @see _Multiselect::getElementHtml() @used-by \Magento\Config\Block\System\Config\Form\Field::_getElementHtml() protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) { return $element->getElementHtml(); } https://github.com/magento/magento2/blob/2.2.0/app/code/Magento/Config/Block/System/Config/Form/Field.php#L21-L30 @return string
[ "2017", "-", "09", "-", "23" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Form/Element/Multiselect.php#L24-L75
train
mage2pro/core
Framework/Plugin/Reflection/DataObjectProcessor.php
DataObjectProcessor.aroundBuildOutputDataArray
function aroundBuildOutputDataArray(Sb $sb, \Closure $f, $object, $type) { $result = $f($object, $type); /** @var array(string => mixed) $result */ if ($object instanceof DC) { $result += df_clean([Schema::F__DF => df_api_object_get($object, Schema::F__DF)]); } return $result; }
php
function aroundBuildOutputDataArray(Sb $sb, \Closure $f, $object, $type) { $result = $f($object, $type); /** @var array(string => mixed) $result */ if ($object instanceof DC) { $result += df_clean([Schema::F__DF => df_api_object_get($object, Schema::F__DF)]); } return $result; }
[ "function", "aroundBuildOutputDataArray", "(", "Sb", "$", "sb", ",", "\\", "Closure", "$", "f", ",", "$", "object", ",", "$", "type", ")", "{", "$", "result", "=", "$", "f", "(", "$", "object", ",", "$", "type", ")", ";", "/** @var array(string => mixe...
2017-05-22 @see \Magento\Framework\Reflection\DataObjectProcessor::buildOutputDataArray() @param Sb $sb @param \Closure $f @param object|DC $object @param string $type @return array(string => mixed)
[ "2017", "-", "05", "-", "22" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Plugin/Reflection/DataObjectProcessor.php#L17-L23
train
mage2pro/core
API/Settings.php
Settings.key
private function key($method, $type, $alt, $s = null, $throw = true) {return $this->$method("{$type}Key", $s, function() use($method, $alt, $s) {return $this->$method("{$alt}Key", $s);} ) ?: ($throw ? df_error("Please set your {$this->titleB()} $type key in the Magento backend.") : null) ;}
php
private function key($method, $type, $alt, $s = null, $throw = true) {return $this->$method("{$type}Key", $s, function() use($method, $alt, $s) {return $this->$method("{$alt}Key", $s);} ) ?: ($throw ? df_error("Please set your {$this->titleB()} $type key in the Magento backend.") : null) ;}
[ "private", "function", "key", "(", "$", "method", ",", "$", "type", ",", "$", "alt", ",", "$", "s", "=", "null", ",", "$", "throw", "=", "true", ")", "{", "return", "$", "this", "->", "$", "method", "(", "\"{$type}Key\"", ",", "$", "s", ",", "f...
2017-02-08 @used-by privateKey() @used-by publicKey() @uses testable() @uses testableP() @param string $method @param string $type @param string $alt @param null|string|int|S|Store $s [optional] @param bool $throw [optional] @return string|null @throws DFE
[ "2017", "-", "02", "-", "08" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/API/Settings.php#L193-L197
train
mage2pro/core
Framework/Config/Dom.php
Dom.validate
function validate($schemaFileName, &$errors = []) { parent::validate($schemaFileName, $errors); $errors = array_filter($errors, function($message) { /** @var string $message */ // 2015-11-15 // Не отключаем валидацию составного файла полностью, // а лишь убираем их диагностического отчёта сообщения о сбоях в наших полях. return // 2015-11-15 // «Element 'dfSample': This element is not expected. Line: 55» // https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L207 !df_contains($message, 'Element \'df') // 2015-12-29 // https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L70 // «Element 'field', attribute 'dfItemFormElement': The attribute 'dfItemFormElement' is not allowed.» && !df_contains($message, 'attribute \'df') ; }); return !$errors; }
php
function validate($schemaFileName, &$errors = []) { parent::validate($schemaFileName, $errors); $errors = array_filter($errors, function($message) { /** @var string $message */ // 2015-11-15 // Не отключаем валидацию составного файла полностью, // а лишь убираем их диагностического отчёта сообщения о сбоях в наших полях. return // 2015-11-15 // «Element 'dfSample': This element is not expected. Line: 55» // https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L207 !df_contains($message, 'Element \'df') // 2015-12-29 // https://github.com/mage2pro/core/tree/57607cc23405c3dcde50999d063b2a7f49499260/Config/etc/system_file.xsd#L70 // «Element 'field', attribute 'dfItemFormElement': The attribute 'dfItemFormElement' is not allowed.» && !df_contains($message, 'attribute \'df') ; }); return !$errors; }
[ "function", "validate", "(", "$", "schemaFileName", ",", "&", "$", "errors", "=", "[", "]", ")", "{", "parent", "::", "validate", "(", "$", "schemaFileName", ",", "$", "errors", ")", ";", "$", "errors", "=", "array_filter", "(", "$", "errors", ",", "...
2015-11-15 @override @see \Magento\Framework\Config\Dom::validate() @param string $schemaFileName @param array $errors @return bool @throws \Exception
[ "2015", "-", "11", "-", "15" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Config/Dom.php#L28-L47
train
mage2pro/core
Payment/W/F.php
F.aspect
private function aspect($base, ...$a) {return dfc($this, function($base, ...$a) {return df_newa($this->c(df_class_l($base)), $base, ...$a) ;}, func_get_args());}
php
private function aspect($base, ...$a) {return dfc($this, function($base, ...$a) {return df_newa($this->c(df_class_l($base)), $base, ...$a) ;}, func_get_args());}
[ "private", "function", "aspect", "(", "$", "base", ",", "...", "$", "a", ")", "{", "return", "dfc", "(", "$", "this", ",", "function", "(", "$", "base", ",", "...", "$", "a", ")", "{", "return", "df_newa", "(", "$", "this", "->", "c", "(", "df_...
2017-03-15 @used-by event() @used-by handler() @param string $base @param mixed[] ...$a @return object @throws Critical|Ignored
[ "2017", "-", "03", "-", "15" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/W/F.php#L101-L103
train
mage2pro/core
Payment/W/F.php
F.s
final static function s($m, $req = null) {return dfcf(function(M $m, $req = null) { $c = df_con_hier($m, self::class); /** @var string $c */ return new $c($m, $req); }, [dfpm($m), $req]);}
php
final static function s($m, $req = null) {return dfcf(function(M $m, $req = null) { $c = df_con_hier($m, self::class); /** @var string $c */ return new $c($m, $req); }, [dfpm($m), $req]);}
[ "final", "static", "function", "s", "(", "$", "m", ",", "$", "req", "=", "null", ")", "{", "return", "dfcf", "(", "function", "(", "M", "$", "m", ",", "$", "req", "=", "null", ")", "{", "$", "c", "=", "df_con_hier", "(", "$", "m", ",", "self"...
2017-03-13 @used-by \Df\Payment\W\Action::execute() @used-by \Df\Payment\TM::responses() @used-by \Dfe\SecurePay\Signer\Response::values() @param string|object $m @param array(string => mixed)|null $req [optional] @return self @throws Critical|Ignored
[ "2017", "-", "03", "-", "13" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Payment/W/F.php#L202-L205
train
mage2pro/core
OAuth/FE/Button.php
Button.getCommentText
function getCommentText($v) {return (string)__($this->s()->authenticatedB() ? "<b>Your Magento instance is <span class='df-ok'>successfully authenticated</span> to your %1 instance.</b>" : "<b>You <span class='df-warning'>need to authenticate</span> your Magento instance to your %1 instance.</b>" ,df_api_name($this->m()));}
php
function getCommentText($v) {return (string)__($this->s()->authenticatedB() ? "<b>Your Magento instance is <span class='df-ok'>successfully authenticated</span> to your %1 instance.</b>" : "<b>You <span class='df-warning'>need to authenticate</span> your Magento instance to your %1 instance.</b>" ,df_api_name($this->m()));}
[ "function", "getCommentText", "(", "$", "v", ")", "{", "return", "(", "string", ")", "__", "(", "$", "this", "->", "s", "(", ")", "->", "authenticatedB", "(", ")", "?", "\"<b>Your Magento instance is <span class='df-ok'>successfully authenticated</span> to your %1 ins...
2017-06-29 @final Unable to use the PHP «final» keyword here because of the M2 code generation. «How to implement a dynamically generated comment for a backend configuration field?» https://mage2.pro/t/4076 @override @see IComment::getCommentText() @used-by \Magento\Config\Model\Config\Structure\Element\Field::getComment(): public function getComment($currentValue = '') { $comment = ''; if (isset($this->_data['comment']) && $this->_data['comment']) { if (is_array($this->_data['comment'])) { if (isset($this->_data['comment']['model'])) { $model = $this->_commentFactory->create($this->_data['comment']['model']); $comment = $model->getCommentText($currentValue); } } else { $comment = parent::getComment(); } } return $comment; } https://github.com/magento/magento2/blob/2.2.0-RC1.8/app/code/Magento/Config/Model/Config/Structure/Element/Field.php#L106-L126 @param string $v @return string
[ "2017", "-", "06", "-", "29" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/OAuth/FE/Button.php#L42-L45
train
mage2pro/core
Sales/Block/Order/Total.php
Total.addBefore
final protected function addBefore($code, $label, $value, $valueBase, $before = null) {$this->add( 'addTotalBefore', $code, $label, $value, $valueBase, $before );}
php
final protected function addBefore($code, $label, $value, $valueBase, $before = null) {$this->add( 'addTotalBefore', $code, $label, $value, $valueBase, $before );}
[ "final", "protected", "function", "addBefore", "(", "$", "code", ",", "$", "label", ",", "$", "value", ",", "$", "valueBase", ",", "$", "before", "=", "null", ")", "{", "$", "this", "->", "add", "(", "'addTotalBefore'", ",", "$", "code", ",", "$", ...
2016-08-14 Add new total to totals array before specific total or after first total by default. @used-by \Dfe\AllPay\Block\Total::initTotals() @uses \Magento\Sales\Block\Order\Totals::addTotalBefore() @param string $code @param string $label @param float $value @param float $valueBase @param string|null $before [optional]
[ "2016", "-", "08", "-", "14", "Add", "new", "total", "to", "totals", "array", "before", "specific", "total", "or", "after", "first", "total", "by", "default", "." ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sales/Block/Order/Total.php#L45-L47
train
mage2pro/core
StripeClone/Facade/Card.php
Card.isActive
final function isActive() {return /** @var int $y1 */ /** @var int $y2 */ ($y1 = df_year()) < ($y2 = $this->expYear()) || ($y1 === $y2 && df_month() <= $this->expMonth()) ;}
php
final function isActive() {return /** @var int $y1 */ /** @var int $y2 */ ($y1 = df_year()) < ($y2 = $this->expYear()) || ($y1 === $y2 && df_month() <= $this->expMonth()) ;}
[ "final", "function", "isActive", "(", ")", "{", "return", "/** @var int $y1 */", "/** @var int $y2 */", "(", "$", "y1", "=", "df_year", "(", ")", ")", "<", "(", "$", "y2", "=", "$", "this", "->", "expYear", "(", ")", ")", "||", "(", "$", "y1", "===",...
2018-11-13 @used-by \Df\StripeClone\Facade\Customer::cardsActive() @return bool
[ "2018", "-", "11", "-", "13" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/StripeClone/Facade/Card.php#L97-L99
train
mage2pro/core
Core/T/lib/date.php
date.t03
function t03() { $d = ZD::now(); /** @var ZD $d */ /** * 2017-09-05 * Эта операция конвертирует время из пояса @see date_default_timezone_get() в пояс аргумента. * Пример: * $dateS = «2016/07/28 11:35:03», * date_default_timezone_get() = «Asia/Taipei» * пояс аргумента = «Europe/Moscow» * $result->toString() = 'Jul 28, 2016 6:35:03 AM' */ $d->setTimezone('Europe/Moscow'); $d->addDay(45); print_r($d->toString('y-MM-ddTHH:mm:ss')); }
php
function t03() { $d = ZD::now(); /** @var ZD $d */ /** * 2017-09-05 * Эта операция конвертирует время из пояса @see date_default_timezone_get() в пояс аргумента. * Пример: * $dateS = «2016/07/28 11:35:03», * date_default_timezone_get() = «Asia/Taipei» * пояс аргумента = «Europe/Moscow» * $result->toString() = 'Jul 28, 2016 6:35:03 AM' */ $d->setTimezone('Europe/Moscow'); $d->addDay(45); print_r($d->toString('y-MM-ddTHH:mm:ss')); }
[ "function", "t03", "(", ")", "{", "$", "d", "=", "ZD", "::", "now", "(", ")", ";", "/** @var ZD $d */", "/**\n\t\t * 2017-09-05\n\t\t * Эта операция конвертирует время из пояса @see date_default_timezone_get() в пояс аргумента.\n\t\t * Пример:\n\t\t * $dateS = «2016/07/28 11:35:03»,\n\...
2017-09-05
[ "2017", "-", "09", "-", "05" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Core/T/lib/date.php#L20-L34
train
mage2pro/core
Zf/Validate/Between.php
Between.i
static function i($min, $max = null, $inclusive = true) {return new self( is_null($min) ? PHP_INT_MIN : $min, is_null($max) ? PHP_INT_MAX : $max, $inclusive );}
php
static function i($min, $max = null, $inclusive = true) {return new self( is_null($min) ? PHP_INT_MIN : $min, is_null($max) ? PHP_INT_MAX : $max, $inclusive );}
[ "static", "function", "i", "(", "$", "min", ",", "$", "max", "=", "null", ",", "$", "inclusive", "=", "true", ")", "{", "return", "new", "self", "(", "is_null", "(", "$", "min", ")", "?", "PHP_INT_MIN", ":", "$", "min", ",", "is_null", "(", "$", ...
2017-01-14 @used-by \Df\Qa\Method::assertParamIsBetween() @used-by \Df\Qa\Method::assertResultIsBetween() @used-by \Df\Qa\Method::assertValueIsBetween() @param int|float|null $min @param int|float|null $max [optional] @param bool $inclusive [optional] @return self
[ "2017", "-", "01", "-", "14" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Zf/Validate/Between.php#L14-L16
train
mage2pro/core
Framework/Module/Dir/Reader.php
Reader.getComposerJsonFiles
function getComposerJsonFiles() {$r = parent::getComposerJsonFiles(); /** @var I $r */return dfI::pathsSet($r, array_filter(dfI::pathsGet($r), function($f) {return '/composer.json' !== $f;})) ;}
php
function getComposerJsonFiles() {$r = parent::getComposerJsonFiles(); /** @var I $r */return dfI::pathsSet($r, array_filter(dfI::pathsGet($r), function($f) {return '/composer.json' !== $f;})) ;}
[ "function", "getComposerJsonFiles", "(", ")", "{", "$", "r", "=", "parent", "::", "getComposerJsonFiles", "(", ")", ";", "/** @var I $r */", "return", "dfI", "::", "pathsSet", "(", "$", "r", ",", "array_filter", "(", "dfI", "::", "pathsGet", "(", "$", "r",...
2017-07-26 @final Unable to use the PHP «final» keyword here because of the M2 code generation. @override @see \Magento\Framework\Module\Dir\Reader::getComposerJsonFiles(): public function getComposerJsonFiles() { return $this->getFilesIterator('composer.json'); } https://github.com/magento/magento2/blob/2.2.0-RC1.8/lib/internal/Magento/Framework/Module/Dir/Reader.php#L89-L97 @used-by \Magento\Framework\Module\PackageInfo::load(): $jsonData = $this->reader->getComposerJsonFiles()->toArray(); https://github.com/magento/magento2/blob/2.2.0-RC1.8/lib/internal/Magento/Framework/Module/PackageInfo.php#L73-L114 @return I
[ "2017", "-", "07", "-", "26" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Framework/Module/Dir/Reader.php#L53-L55
train
mage2pro/core
Sentry/SanitizeDataProcessor.php
SanitizeDataProcessor.setProcessorOptions
function setProcessorOptions(array $options) { if (isset($options['fields_re'])) { $this->fields_re = $options['fields_re']; } if (isset($options['values_re'])) { $this->values_re = $options['values_re']; } }
php
function setProcessorOptions(array $options) { if (isset($options['fields_re'])) { $this->fields_re = $options['fields_re']; } if (isset($options['values_re'])) { $this->values_re = $options['values_re']; } }
[ "function", "setProcessorOptions", "(", "array", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'fields_re'", "]", ")", ")", "{", "$", "this", "->", "fields_re", "=", "$", "options", "[", "'fields_re'", "]", ";", "}", "if", ...
Override the default processor options @param array $options Associative array of processor options
[ "Override", "the", "default", "processor", "options" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sentry/SanitizeDataProcessor.php#L32-L41
train
mage2pro/core
Sentry/SanitizeDataProcessor.php
SanitizeDataProcessor.sanitize
function sanitize(&$item, $key) { if (empty($item)) { return; } if (preg_match($this->values_re, $item)) { $item = self::MASK; } if (empty($key)) { return; } if (preg_match($this->fields_re, $key)) { $item = self::MASK; } }
php
function sanitize(&$item, $key) { if (empty($item)) { return; } if (preg_match($this->values_re, $item)) { $item = self::MASK; } if (empty($key)) { return; } if (preg_match($this->fields_re, $key)) { $item = self::MASK; } }
[ "function", "sanitize", "(", "&", "$", "item", ",", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "item", ")", ")", "{", "return", ";", "}", "if", "(", "preg_match", "(", "$", "this", "->", "values_re", ",", "$", "item", ")", ")", "{", ...
Replace any array values with our mask if the field name or the value matches a respective regex @param mixed $item Associative array value @param string $key Associative array key
[ "Replace", "any", "array", "values", "with", "our", "mask", "if", "the", "field", "name", "or", "the", "value", "matches", "a", "respective", "regex" ]
e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f
https://github.com/mage2pro/core/blob/e04c31bb8a91376df2c2c8a9b29dbad5e8f0cc3f/Sentry/SanitizeDataProcessor.php#L49-L66
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.list_item
public function list_item( $object, $li_class, $icon_class = 'dashicons-plus' ) { // Build our list item printf( '<li data-id="%1$d" class="%2$s" target="_blank">%3$s<a title="' . __( 'Edit' ) . '" href="%4$s">%5$s</a>%6$s<span class="dashicons %7$s add-remove"></span></li>', $this->get_id( $object ), $li_class, $this->get_thumb( $object ), $this->get_edit_link( $object ), $this->get_title( $object ), $this->get_object_label( $object ), $icon_class ); }
php
public function list_item( $object, $li_class, $icon_class = 'dashicons-plus' ) { // Build our list item printf( '<li data-id="%1$d" class="%2$s" target="_blank">%3$s<a title="' . __( 'Edit' ) . '" href="%4$s">%5$s</a>%6$s<span class="dashicons %7$s add-remove"></span></li>', $this->get_id( $object ), $li_class, $this->get_thumb( $object ), $this->get_edit_link( $object ), $this->get_title( $object ), $this->get_object_label( $object ), $icon_class ); }
[ "public", "function", "list_item", "(", "$", "object", ",", "$", "li_class", ",", "$", "icon_class", "=", "'dashicons-plus'", ")", "{", "// Build our list item", "printf", "(", "'<li data-id=\"%1$d\" class=\"%2$s\" target=\"_blank\">%3$s<a title=\"'", ".", "__", "(", "'...
Outputs a column list item. @since 1.2.5 @param mixed $object Post or User. @param string $li_class The list item (zebra) class. @param string $icon_class The icon class. Either 'dashicons-plus' or 'dashicons-minus'. @return void
[ "Outputs", "a", "column", "list", "item", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L287-L299
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_thumb
public function get_thumb( $object ) { $thumbnail = ''; if ( $this->field->options( 'show_thumbnails' ) ) { // Set thumbnail if the options is true $thumbnail = $this->field->options( 'query_users' ) ? get_avatar( $object->ID, 25 ) : get_the_post_thumbnail( $object->ID, array( 50, 50 ) ); } return $thumbnail; }
php
public function get_thumb( $object ) { $thumbnail = ''; if ( $this->field->options( 'show_thumbnails' ) ) { // Set thumbnail if the options is true $thumbnail = $this->field->options( 'query_users' ) ? get_avatar( $object->ID, 25 ) : get_the_post_thumbnail( $object->ID, array( 50, 50 ) ); } return $thumbnail; }
[ "public", "function", "get_thumb", "(", "$", "object", ")", "{", "$", "thumbnail", "=", "''", ";", "if", "(", "$", "this", "->", "field", "->", "options", "(", "'show_thumbnails'", ")", ")", "{", "// Set thumbnail if the options is true", "$", "thumbnail", "...
Get thumbnail for the object. @since 1.2.4 @param mixed $object Post or User @return string The thumbnail, if endabled/found.
[ "Get", "thumbnail", "for", "the", "object", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L310-L321
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_title
public function get_title( $object ) { return $this->field->options( 'query_users' ) ? $object->data->display_name : get_the_title( $object ); }
php
public function get_title( $object ) { return $this->field->options( 'query_users' ) ? $object->data->display_name : get_the_title( $object ); }
[ "public", "function", "get_title", "(", "$", "object", ")", "{", "return", "$", "this", "->", "field", "->", "options", "(", "'query_users'", ")", "?", "$", "object", "->", "data", "->", "display_name", ":", "get_the_title", "(", "$", "object", ")", ";",...
Get title for the object. @since 1.2.4 @param mixed $object Post or User @return string The object title.
[ "Get", "title", "for", "the", "object", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L345-L349
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_object_label
public function get_object_label( $object ) { if ( ! $this->do_type_label ) { return ''; } $post_type_obj = get_post_type_object( $object->post_type ); $label = isset( $post_type_obj->labels->singular_name ) ? $post_type_obj->labels->singular_name : $post_type_obj->label; return ' &mdash; <span class="object-label">'. $label .'</span>'; }
php
public function get_object_label( $object ) { if ( ! $this->do_type_label ) { return ''; } $post_type_obj = get_post_type_object( $object->post_type ); $label = isset( $post_type_obj->labels->singular_name ) ? $post_type_obj->labels->singular_name : $post_type_obj->label; return ' &mdash; <span class="object-label">'. $label .'</span>'; }
[ "public", "function", "get_object_label", "(", "$", "object", ")", "{", "if", "(", "!", "$", "this", "->", "do_type_label", ")", "{", "return", "''", ";", "}", "$", "post_type_obj", "=", "get_post_type_object", "(", "$", "object", "->", "post_type", ")", ...
Get object label. @since 1.2.6 @param mixed $object Post or User @return string The object label.
[ "Get", "object", "label", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L360-L369
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_edit_link
public function get_edit_link( $object ) { return $this->field->options( 'query_users' ) ? get_edit_user_link( $object->ID ) : get_edit_post_link( $object ); }
php
public function get_edit_link( $object ) { return $this->field->options( 'query_users' ) ? get_edit_user_link( $object->ID ) : get_edit_post_link( $object ); }
[ "public", "function", "get_edit_link", "(", "$", "object", ")", "{", "return", "$", "this", "->", "field", "->", "options", "(", "'query_users'", ")", "?", "get_edit_user_link", "(", "$", "object", "->", "ID", ")", ":", "get_edit_post_link", "(", "$", "obj...
Get edit link for the object. @since 1.2.4 @param mixed $object Post or User @return string The object edit link.
[ "Get", "edit", "link", "for", "the", "object", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L380-L384
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_object
public function get_object( $id ) { return $this->field->options( 'query_users' ) ? get_user_by( 'id', absint( $id ) ) : get_post( absint( $id ) ); }
php
public function get_object( $id ) { return $this->field->options( 'query_users' ) ? get_user_by( 'id', absint( $id ) ) : get_post( absint( $id ) ); }
[ "public", "function", "get_object", "(", "$", "id", ")", "{", "return", "$", "this", "->", "field", "->", "options", "(", "'query_users'", ")", "?", "get_user_by", "(", "'id'", ",", "absint", "(", "$", "id", ")", ")", ":", "get_post", "(", "absint", ...
Get object by id. @since 1.2.4 @param int $id Post or User ID. @return mixed Post or User if found.
[ "Get", "object", "by", "id", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L395-L399
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.get_all_objects
public function get_all_objects( $args, $attached = array() ) { $objects = $this->get_objects( $args ); $attached_objects = array(); foreach ( $objects as $object ) { $attached_objects[ $this->get_id( $object ) ] = $object; } if ( ! empty( $attached ) ) { $is_users = $this->field->options( 'query_users' ); $args[ $is_users ? 'include' : 'post__in' ] = $attached; $args[ $is_users ? 'number' : 'posts_per_page' ] = count( $attached ); $new = $this->get_objects( $args ); foreach ( $new as $object ) { if ( ! isset( $attached_objects[ $this->get_id( $object ) ] ) ) { $attached_objects[ $this->get_id( $object ) ] = $object; } } } return $attached_objects; }
php
public function get_all_objects( $args, $attached = array() ) { $objects = $this->get_objects( $args ); $attached_objects = array(); foreach ( $objects as $object ) { $attached_objects[ $this->get_id( $object ) ] = $object; } if ( ! empty( $attached ) ) { $is_users = $this->field->options( 'query_users' ); $args[ $is_users ? 'include' : 'post__in' ] = $attached; $args[ $is_users ? 'number' : 'posts_per_page' ] = count( $attached ); $new = $this->get_objects( $args ); foreach ( $new as $object ) { if ( ! isset( $attached_objects[ $this->get_id( $object ) ] ) ) { $attached_objects[ $this->get_id( $object ) ] = $object; } } } return $attached_objects; }
[ "public", "function", "get_all_objects", "(", "$", "args", ",", "$", "attached", "=", "array", "(", ")", ")", "{", "$", "objects", "=", "$", "this", "->", "get_objects", "(", "$", "args", ")", ";", "$", "attached_objects", "=", "array", "(", ")", ";"...
Fetches the default query for items, and combines with any objects attached. @since 1.2.4 @param array $args Array of query args. @param array $attached Array of attached object ids. @return array Array of attached object ids.
[ "Fetches", "the", "default", "query", "for", "items", "and", "combines", "with", "any", "objects", "attached", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L411-L434
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.setup_scripts
protected static function setup_scripts() { static $once = false; $dir = CMB2_ATTACHED_POSTS_FIELD_DIR; if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { // Windows $content_dir = str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ); $content_url = str_replace( $content_dir, WP_CONTENT_URL, $dir ); $url = str_replace( DIRECTORY_SEPARATOR, '/', $content_url ); } else { $url = str_replace( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ), array( WP_CONTENT_URL, WP_PLUGIN_URL ), $dir ); } $url = set_url_scheme( $url ); $url = apply_filters( 'cmb2_attached_posts_field_assets_url', $url ); $requirements = array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'wp-backbone', ); wp_enqueue_script( 'cmb2-attached-posts-field', $url . 'js/attached-posts.js', $requirements, self::VERSION, true ); wp_enqueue_style( 'cmb2-attached-posts-field', $url . 'css/attached-posts-admin.css', array(), self::VERSION ); if ( ! $once ) { wp_localize_script( 'cmb2-attached-posts-field', 'CMBAP', array( 'edit_link_template' => str_replace( get_the_ID(), 'REPLACEME', get_edit_post_link( get_the_ID() ) ), 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), ) ); $once = true; } }
php
protected static function setup_scripts() { static $once = false; $dir = CMB2_ATTACHED_POSTS_FIELD_DIR; if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { // Windows $content_dir = str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ); $content_url = str_replace( $content_dir, WP_CONTENT_URL, $dir ); $url = str_replace( DIRECTORY_SEPARATOR, '/', $content_url ); } else { $url = str_replace( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ), array( WP_CONTENT_URL, WP_PLUGIN_URL ), $dir ); } $url = set_url_scheme( $url ); $url = apply_filters( 'cmb2_attached_posts_field_assets_url', $url ); $requirements = array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'wp-backbone', ); wp_enqueue_script( 'cmb2-attached-posts-field', $url . 'js/attached-posts.js', $requirements, self::VERSION, true ); wp_enqueue_style( 'cmb2-attached-posts-field', $url . 'css/attached-posts-admin.css', array(), self::VERSION ); if ( ! $once ) { wp_localize_script( 'cmb2-attached-posts-field', 'CMBAP', array( 'edit_link_template' => str_replace( get_the_ID(), 'REPLACEME', get_edit_post_link( get_the_ID() ) ), 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), ) ); $once = true; } }
[ "protected", "static", "function", "setup_scripts", "(", ")", "{", "static", "$", "once", "=", "false", ";", "$", "dir", "=", "CMB2_ATTACHED_POSTS_FIELD_DIR", ";", "if", "(", "'WIN'", "===", "strtoupper", "(", "substr", "(", "PHP_OS", ",", "0", ",", "3", ...
Enqueue admin scripts for our attached posts field
[ "Enqueue", "admin", "scripts", "for", "our", "attached", "posts", "field" ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L452-L495
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.ajax_find_posts
public function ajax_find_posts() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['cmb2_attached_search'], $_POST['retrieved'], $_POST['action'], $_POST['search_types'] ) && 'find_posts' == $_POST['action'] && ! empty( $_POST['search_types'] ) ) { // This is not working until we fix the user query bit. if ( ! empty( $_POST['query_users'] ) ) { add_action( 'pre_get_users', array( $this, 'modify_query' ) ); } else { add_action( 'pre_get_posts', array( $this, 'modify_query' ) ); } } }
php
public function ajax_find_posts() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['cmb2_attached_search'], $_POST['retrieved'], $_POST['action'], $_POST['search_types'] ) && 'find_posts' == $_POST['action'] && ! empty( $_POST['search_types'] ) ) { // This is not working until we fix the user query bit. if ( ! empty( $_POST['query_users'] ) ) { add_action( 'pre_get_users', array( $this, 'modify_query' ) ); } else { add_action( 'pre_get_posts', array( $this, 'modify_query' ) ); } } }
[ "public", "function", "ajax_find_posts", "(", ")", "{", "if", "(", "defined", "(", "'DOING_AJAX'", ")", "&&", "DOING_AJAX", "&&", "isset", "(", "$", "_POST", "[", "'cmb2_attached_search'", "]", ",", "$", "_POST", "[", "'retrieved'", "]", ",", "$", "_POST",...
Check to see if we have a post type set and, if so, add the pre_get_posts action to set the queried post type @since 1.2.4 @return void
[ "Check", "to", "see", "if", "we", "have", "a", "post", "type", "set", "and", "if", "so", "add", "the", "pre_get_posts", "action", "to", "set", "the", "queried", "post", "type" ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L531-L546
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.modify_query
public function modify_query( $query ) { $is_users = 'pre_get_users' === current_filter(); if ( $is_users ) { // This is not working until we fix the user query bit. } else { $types = $_POST['search_types']; $types = is_array( $types ) ? array_map( 'esc_attr', $types ) : esc_attr( $types ); $query->set( 'post_type', $types ); } if ( ! empty( $_POST['retrieved'] ) && is_array( $_POST['retrieved'] ) ) { // Exclude posts/users already existing. $ids = array_map( 'absint', $_POST['retrieved'] ); if ( ! empty( $_POST['exclude'] ) && is_array( $_POST['exclude'] ) ) { // Exclude the post that we're looking at. $exclude = array_map( 'absint', $_POST['exclude'] ); $ids = array_merge( $ids, $exclude ); } $query->set( $is_users ? 'exclude' : 'post__not_in', $ids ); } $this->maybe_callback( $query, $_POST ); }
php
public function modify_query( $query ) { $is_users = 'pre_get_users' === current_filter(); if ( $is_users ) { // This is not working until we fix the user query bit. } else { $types = $_POST['search_types']; $types = is_array( $types ) ? array_map( 'esc_attr', $types ) : esc_attr( $types ); $query->set( 'post_type', $types ); } if ( ! empty( $_POST['retrieved'] ) && is_array( $_POST['retrieved'] ) ) { // Exclude posts/users already existing. $ids = array_map( 'absint', $_POST['retrieved'] ); if ( ! empty( $_POST['exclude'] ) && is_array( $_POST['exclude'] ) ) { // Exclude the post that we're looking at. $exclude = array_map( 'absint', $_POST['exclude'] ); $ids = array_merge( $ids, $exclude ); } $query->set( $is_users ? 'exclude' : 'post__not_in', $ids ); } $this->maybe_callback( $query, $_POST ); }
[ "public", "function", "modify_query", "(", "$", "query", ")", "{", "$", "is_users", "=", "'pre_get_users'", "===", "current_filter", "(", ")", ";", "if", "(", "$", "is_users", ")", "{", "// This is not working until we fix the user query bit.", "}", "else", "{", ...
Modify the search query. @since 1.2.4 @param WP_Query $query WP_Query instance during the pre_get_posts hook. @return void
[ "Modify", "the", "search", "query", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L557-L582
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.maybe_callback
public function maybe_callback( $query, $post_args ) { $cmb = isset( $post_args['cmb_id'] ) ? $post_args['cmb_id'] : ''; $group = isset( $post_args['group_id'] ) ? $post_args['group_id'] : ''; $field = isset( $post_args['field_id'] ) ? $post_args['field_id'] : ''; $cmb = cmb2_get_metabox( $cmb ); if ( $cmb && $group ) { $group = $cmb->get_field( $group ); } if ( $cmb && $field ) { $group = $group ? $group : null; $field = $cmb->get_field( $field, $group ); } if ( $field && ( $cb = $field->maybe_callback( 'attached_posts_search_query_cb' ) ) ) { call_user_func( $cb, $query, $field, $this ); } }
php
public function maybe_callback( $query, $post_args ) { $cmb = isset( $post_args['cmb_id'] ) ? $post_args['cmb_id'] : ''; $group = isset( $post_args['group_id'] ) ? $post_args['group_id'] : ''; $field = isset( $post_args['field_id'] ) ? $post_args['field_id'] : ''; $cmb = cmb2_get_metabox( $cmb ); if ( $cmb && $group ) { $group = $cmb->get_field( $group ); } if ( $cmb && $field ) { $group = $group ? $group : null; $field = $cmb->get_field( $field, $group ); } if ( $field && ( $cb = $field->maybe_callback( 'attached_posts_search_query_cb' ) ) ) { call_user_func( $cb, $query, $field, $this ); } }
[ "public", "function", "maybe_callback", "(", "$", "query", ",", "$", "post_args", ")", "{", "$", "cmb", "=", "isset", "(", "$", "post_args", "[", "'cmb_id'", "]", ")", "?", "$", "post_args", "[", "'cmb_id'", "]", ":", "''", ";", "$", "group", "=", ...
If field has a 'attached_posts_search_query_cb', run the callback. @since 1.2.4 @param WP_Query $query WP_Query instance during the pre_get_posts hook. @param array $post_args The $_POST array. @return void
[ "If", "field", "has", "a", "attached_posts_search_query_cb", "run", "the", "callback", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L594-L612
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field.display_render
public function display_render( $pre_output, $field, $display ) { if ( ! empty( $pre_output ) ) { return $pre_output; } $return = ''; // If repeatable if ( $display->field->args( 'repeatable' ) ) { $rows = array(); // And has a repeatable value if ( is_array( $display->field->value ) ) { // Then loop and output. foreach ( $display->field->value as $val ) { $rows[] = $this->_display_render( $display->field, $val ); } } if ( ! empty( $rows ) ) { $return .= '<ul class="cmb2-' . str_replace( '_', '-', $display->field->type() ) . '"><li>'; foreach ( (array) $rows as $row ) { $return .= sprintf( '<li>%s</a>', $row ); } $return .= '</ul>'; } else { $return .= '&mdash;'; } } else { $return .= $this->_display_render( $display->field, $display->field->value ); } return $return ? $return : $pre_output; }
php
public function display_render( $pre_output, $field, $display ) { if ( ! empty( $pre_output ) ) { return $pre_output; } $return = ''; // If repeatable if ( $display->field->args( 'repeatable' ) ) { $rows = array(); // And has a repeatable value if ( is_array( $display->field->value ) ) { // Then loop and output. foreach ( $display->field->value as $val ) { $rows[] = $this->_display_render( $display->field, $val ); } } if ( ! empty( $rows ) ) { $return .= '<ul class="cmb2-' . str_replace( '_', '-', $display->field->type() ) . '"><li>'; foreach ( (array) $rows as $row ) { $return .= sprintf( '<li>%s</a>', $row ); } $return .= '</ul>'; } else { $return .= '&mdash;'; } } else { $return .= $this->_display_render( $display->field, $display->field->value ); } return $return ? $return : $pre_output; }
[ "public", "function", "display_render", "(", "$", "pre_output", ",", "$", "field", ",", "$", "display", ")", "{", "if", "(", "!", "empty", "(", "$", "pre_output", ")", ")", "{", "return", "$", "pre_output", ";", "}", "$", "return", "=", "''", ";", ...
Outputs the display of our custom field. @since 1.2.7 @param bool|mixed $pre_output Default null value. @param CMB2_Field $field This field object. @param CMB2_Field_Display $display The `CMB2_Field_Display` object.
[ "Outputs", "the", "display", "of", "our", "custom", "field", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L623-L660
train
CMB2/cmb2-attached-posts
init.php
WDS_CMB2_Attached_Posts_Field._display_render
public function _display_render( $field, $val ) { $return = ''; $posts = array(); if ( ! empty( $val ) ) { foreach ( (array) $val as $id ) { $title = get_the_title( $id ); if ( $title ) { $edit_link = get_edit_post_link( $id ); $posts[ $id ] = compact( 'title', 'edit_link' ); } } } if ( ! empty( $posts ) ) { $return .= '<ol>'; foreach ( (array) $posts as $id => $post ) { $return .= sprintf( '<li id="attached-%d"><a href="%s">%s</a></li>', $id, $post['edit_link'], $post['title'] ); } $return .= '</ol>'; } else { $return .= '&mdash;'; } return $return; }
php
public function _display_render( $field, $val ) { $return = ''; $posts = array(); if ( ! empty( $val ) ) { foreach ( (array) $val as $id ) { $title = get_the_title( $id ); if ( $title ) { $edit_link = get_edit_post_link( $id ); $posts[ $id ] = compact( 'title', 'edit_link' ); } } } if ( ! empty( $posts ) ) { $return .= '<ol>'; foreach ( (array) $posts as $id => $post ) { $return .= sprintf( '<li id="attached-%d"><a href="%s">%s</a></li>', $id, $post['edit_link'], $post['title'] ); } $return .= '</ol>'; } else { $return .= '&mdash;'; } return $return; }
[ "public", "function", "_display_render", "(", "$", "field", ",", "$", "val", ")", "{", "$", "return", "=", "''", ";", "$", "posts", "=", "array", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "val", ")", ")", "{", "foreach", "(", "(", "arra...
Outputs the display of our custom field per repeatable value, if applicable. @since 1.2.7 @param CMB2_Field $field This field object. @param mixed $val The field value.
[ "Outputs", "the", "display", "of", "our", "custom", "field", "per", "repeatable", "value", "if", "applicable", "." ]
556701d8f032931838c524ddc55c40b177a0e1a8
https://github.com/CMB2/cmb2-attached-posts/blob/556701d8f032931838c524ddc55c40b177a0e1a8/init.php#L670-L702
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.publish
public function publish($isSynced = false) { // Logical checks prior to publish if ($this->State !== static::STATE_OPEN) { throw new BadMethodCallException( "ChangeSet can't be published if it has been already published or reverted." ); } if (!$isSynced && !$this->isSynced()) { throw new ValidationException( "ChangeSet does not include all necessary changes and cannot be published." ); } DB::get_conn()->withTransaction(function () { foreach ($this->Changes() as $change) { /** @var ChangeSetItem $change */ $change->publish(); } // Once this changeset is published, unlink any objects linking to // records in this changeset as unlinked (set RelationID to 0). // This is done as a safer alternative to deleting records on live that // are deleted on stage. foreach ($this->Changes() as $change) { /** @var ChangeSetItem $change */ $change->unlinkDisownedObjects(); } $this->State = static::STATE_PUBLISHED; $this->PublisherID = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0; $this->PublishDate = DBDatetime::now()->Rfc2822(); $this->write(); }); return true; }
php
public function publish($isSynced = false) { // Logical checks prior to publish if ($this->State !== static::STATE_OPEN) { throw new BadMethodCallException( "ChangeSet can't be published if it has been already published or reverted." ); } if (!$isSynced && !$this->isSynced()) { throw new ValidationException( "ChangeSet does not include all necessary changes and cannot be published." ); } DB::get_conn()->withTransaction(function () { foreach ($this->Changes() as $change) { /** @var ChangeSetItem $change */ $change->publish(); } // Once this changeset is published, unlink any objects linking to // records in this changeset as unlinked (set RelationID to 0). // This is done as a safer alternative to deleting records on live that // are deleted on stage. foreach ($this->Changes() as $change) { /** @var ChangeSetItem $change */ $change->unlinkDisownedObjects(); } $this->State = static::STATE_PUBLISHED; $this->PublisherID = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0; $this->PublishDate = DBDatetime::now()->Rfc2822(); $this->write(); }); return true; }
[ "public", "function", "publish", "(", "$", "isSynced", "=", "false", ")", "{", "// Logical checks prior to publish", "if", "(", "$", "this", "->", "State", "!==", "static", "::", "STATE_OPEN", ")", "{", "throw", "new", "BadMethodCallException", "(", "\"ChangeSet...
Publish this changeset, then closes it. User code should call {@see canPublish()} prior to invoking this method. @throws BadMethodCallException ChangeSet has already been published or reverted. @throws ValidationException ChangeSet is not synced an can not be published. @param boolean $isSynced Whatever to assume the ChangeSet is synced. Only set this to true if the ChangetSet just got built. Defaults to false. @return bool True if successful
[ "Publish", "this", "changeset", "then", "closes", "it", "." ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L124-L162
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.addObject
public function addObject(DataObject $object) { if (!$this->isInDB()) { throw new BadMethodCallException("ChangeSet must be saved before adding items"); } if (!$object->isInDB()) { throw new BadMethodCallException("Items must be saved before adding to a changeset"); } $references = [ 'ObjectID' => $object->ID, 'ObjectClass' => $object->baseClass(), ]; // Get existing item in case already added $item = $this->Changes()->filter($references)->first(); if (!$item) { $item = new ChangeSetItem($references); $this->Changes()->add($item); } $item->ReferencedBy()->removeAll(); $item->Added = ChangeSetItem::EXPLICITLY; $item->write(); $this->sync(); }
php
public function addObject(DataObject $object) { if (!$this->isInDB()) { throw new BadMethodCallException("ChangeSet must be saved before adding items"); } if (!$object->isInDB()) { throw new BadMethodCallException("Items must be saved before adding to a changeset"); } $references = [ 'ObjectID' => $object->ID, 'ObjectClass' => $object->baseClass(), ]; // Get existing item in case already added $item = $this->Changes()->filter($references)->first(); if (!$item) { $item = new ChangeSetItem($references); $this->Changes()->add($item); } $item->ReferencedBy()->removeAll(); $item->Added = ChangeSetItem::EXPLICITLY; $item->write(); $this->sync(); }
[ "public", "function", "addObject", "(", "DataObject", "$", "object", ")", "{", "if", "(", "!", "$", "this", "->", "isInDB", "(", ")", ")", "{", "throw", "new", "BadMethodCallException", "(", "\"ChangeSet must be saved before adding items\"", ")", ";", "}", "if...
Add a new change to this changeset. Will automatically include all owned changes as those are dependencies of this item. @param DataObject $object
[ "Add", "a", "new", "change", "to", "this", "changeset", ".", "Will", "automatically", "include", "all", "owned", "changes", "as", "those", "are", "dependencies", "of", "this", "item", "." ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L170-L199
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.implicitKey
protected function implicitKey(DataObject $item) { if ($item instanceof ChangeSetItem) { return $item->ObjectClass . '.' . $item->ObjectID; } return $item->baseClass() . '.' . $item->ID; }
php
protected function implicitKey(DataObject $item) { if ($item instanceof ChangeSetItem) { return $item->ObjectClass . '.' . $item->ObjectID; } return $item->baseClass() . '.' . $item->ID; }
[ "protected", "function", "implicitKey", "(", "DataObject", "$", "item", ")", "{", "if", "(", "$", "item", "instanceof", "ChangeSetItem", ")", "{", "return", "$", "item", "->", "ObjectClass", ".", "'.'", ".", "$", "item", "->", "ObjectID", ";", "}", "retu...
Build identifying string key for this object @param DataObject $item @return string
[ "Build", "identifying", "string", "key", "for", "this", "object" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L230-L236
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.calculateImplicit
protected function calculateImplicit() { /** @var string[][] $explicit List of all items that have been explicitly added to this ChangeSet */ $explicit = []; /** @var string[][] $referenced List of all items that are "referenced" by items in $explicit */ $referenced = []; /** @var string[][] $references List of which explicit items reference each thing in referenced */ $references = []; /** @var ChangeSetItem $item */ foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $item) { $explicitKey = $this->implicitKey($item); $explicit[$explicitKey] = true; foreach ($item->findReferenced() as $referee) { try { /** @var DataObject $referee */ $key = $this->implicitKey($referee); $referenced[$key] = [ 'ObjectID' => $referee->ID, 'ObjectClass' => $referee->baseClass(), ]; $references[$key][] = $item->ID; // Skip any bad records } catch (UnexpectedDataException $e) { } } } /** @var string[][] $explicit List of all items that are either in $explicit, $referenced or both */ $all = array_merge($referenced, $explicit); /** @var string[][] $implicit Anything that is in $all, but not in $explicit, is an implicit inclusion */ $implicit = array_diff_key($all, $explicit); foreach ($implicit as $key => $object) { $implicit[$key]['ReferencedBy'] = $references[$key]; } return $implicit; }
php
protected function calculateImplicit() { /** @var string[][] $explicit List of all items that have been explicitly added to this ChangeSet */ $explicit = []; /** @var string[][] $referenced List of all items that are "referenced" by items in $explicit */ $referenced = []; /** @var string[][] $references List of which explicit items reference each thing in referenced */ $references = []; /** @var ChangeSetItem $item */ foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $item) { $explicitKey = $this->implicitKey($item); $explicit[$explicitKey] = true; foreach ($item->findReferenced() as $referee) { try { /** @var DataObject $referee */ $key = $this->implicitKey($referee); $referenced[$key] = [ 'ObjectID' => $referee->ID, 'ObjectClass' => $referee->baseClass(), ]; $references[$key][] = $item->ID; // Skip any bad records } catch (UnexpectedDataException $e) { } } } /** @var string[][] $explicit List of all items that are either in $explicit, $referenced or both */ $all = array_merge($referenced, $explicit); /** @var string[][] $implicit Anything that is in $all, but not in $explicit, is an implicit inclusion */ $implicit = array_diff_key($all, $explicit); foreach ($implicit as $key => $object) { $implicit[$key]['ReferencedBy'] = $references[$key]; } return $implicit; }
[ "protected", "function", "calculateImplicit", "(", ")", "{", "/** @var string[][] $explicit List of all items that have been explicitly added to this ChangeSet */", "$", "explicit", "=", "[", "]", ";", "/** @var string[][] $referenced List of all items that are \"referenced\" by items in $...
List of all implicit items inferred from all currently assigned explicit changes @return array
[ "List", "of", "all", "implicit", "items", "inferred", "from", "all", "currently", "assigned", "explicit", "changes" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L243-L288
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.sync
public function sync() { // Only sync open changesets if ($this->State !== static::STATE_OPEN) { return; } // Start a transaction (if we can) DB::get_conn()->withTransaction(function () { // Get the implicitly included items for this ChangeSet $implicit = $this->calculateImplicit(); // Adjust the existing implicit ChangeSetItems for this ChangeSet /** @var ChangeSetItem $item */ foreach ($this->Changes()->filter(['Added' => ChangeSetItem::IMPLICITLY]) as $item) { $objectKey = $this->implicitKey($item); // If a ChangeSetItem exists, but isn't in $implicit, it's no longer required, so delete it if (!array_key_exists($objectKey, $implicit)) { $item->delete(); } else { // Otherwise it is required, so update ReferencedBy and remove from $implicit $item->ReferencedBy()->setByIDList($implicit[$objectKey]['ReferencedBy']); unset($implicit[$objectKey]); } } // Now $implicit is all those items that are implicitly included, but don't currently have a ChangeSetItem. // So create new ChangeSetItems to match foreach ($implicit as $key => $props) { $item = new ChangeSetItem($props); $item->Added = ChangeSetItem::IMPLICITLY; $item->ChangeSetID = $this->ID; $item->ReferencedBy()->setByIDList($props['ReferencedBy']); $item->write(); } // Mark last synced $this->LastSynced = DBDatetime::now()->getValue(); $this->write(); }); }
php
public function sync() { // Only sync open changesets if ($this->State !== static::STATE_OPEN) { return; } // Start a transaction (if we can) DB::get_conn()->withTransaction(function () { // Get the implicitly included items for this ChangeSet $implicit = $this->calculateImplicit(); // Adjust the existing implicit ChangeSetItems for this ChangeSet /** @var ChangeSetItem $item */ foreach ($this->Changes()->filter(['Added' => ChangeSetItem::IMPLICITLY]) as $item) { $objectKey = $this->implicitKey($item); // If a ChangeSetItem exists, but isn't in $implicit, it's no longer required, so delete it if (!array_key_exists($objectKey, $implicit)) { $item->delete(); } else { // Otherwise it is required, so update ReferencedBy and remove from $implicit $item->ReferencedBy()->setByIDList($implicit[$objectKey]['ReferencedBy']); unset($implicit[$objectKey]); } } // Now $implicit is all those items that are implicitly included, but don't currently have a ChangeSetItem. // So create new ChangeSetItems to match foreach ($implicit as $key => $props) { $item = new ChangeSetItem($props); $item->Added = ChangeSetItem::IMPLICITLY; $item->ChangeSetID = $this->ID; $item->ReferencedBy()->setByIDList($props['ReferencedBy']); $item->write(); } // Mark last synced $this->LastSynced = DBDatetime::now()->getValue(); $this->write(); }); }
[ "public", "function", "sync", "(", ")", "{", "// Only sync open changesets", "if", "(", "$", "this", "->", "State", "!==", "static", "::", "STATE_OPEN", ")", "{", "return", ";", "}", "// Start a transaction (if we can)", "DB", "::", "get_conn", "(", ")", "->",...
Add implicit changes that should be included in this changeset When an item is created or changed, all it's owned items which have changes are implicitly added When an item is deleted, it's owner (even if that owner does not have changes) is implicitly added
[ "Add", "implicit", "changes", "that", "should", "be", "included", "in", "this", "changeset" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L299-L342
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.isSynced
public function isSynced() { $implicit = $this->calculateImplicit(); // Check the existing implicit ChangeSetItems for this ChangeSet foreach ($this->Changes()->filter(['Added' => ChangeSetItem::IMPLICITLY]) as $item) { $objectKey = $this->implicitKey($item); // If a ChangeSetItem exists, but isn't in $implicit -> validation failure if (!array_key_exists($objectKey, $implicit)) { return false; } // Exists, remove from $implicit unset($implicit[$objectKey]); } // If there's anything left in $implicit -> validation failure return empty($implicit); }
php
public function isSynced() { $implicit = $this->calculateImplicit(); // Check the existing implicit ChangeSetItems for this ChangeSet foreach ($this->Changes()->filter(['Added' => ChangeSetItem::IMPLICITLY]) as $item) { $objectKey = $this->implicitKey($item); // If a ChangeSetItem exists, but isn't in $implicit -> validation failure if (!array_key_exists($objectKey, $implicit)) { return false; } // Exists, remove from $implicit unset($implicit[$objectKey]); } // If there's anything left in $implicit -> validation failure return empty($implicit); }
[ "public", "function", "isSynced", "(", ")", "{", "$", "implicit", "=", "$", "this", "->", "calculateImplicit", "(", ")", ";", "// Check the existing implicit ChangeSetItems for this ChangeSet", "foreach", "(", "$", "this", "->", "Changes", "(", ")", "->", "filter"...
Verify that any objects in this changeset include all owned changes
[ "Verify", "that", "any", "objects", "in", "this", "changeset", "include", "all", "owned", "changes" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L345-L364
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.canPublish
public function canPublish($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // Check all explicitly added items foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $change) { /** @var ChangeSetItem $change */ if (!$change->canPublish($member)) { return false; } } return true; }
php
public function canPublish($member = null) { if (!$member) { $member = Security::getCurrentUser(); } // Check all explicitly added items foreach ($this->Changes()->filter(['Added' => ChangeSetItem::EXPLICITLY]) as $change) { /** @var ChangeSetItem $change */ if (!$change->canPublish($member)) { return false; } } return true; }
[ "public", "function", "canPublish", "(", "$", "member", "=", "null", ")", "{", "if", "(", "!", "$", "member", ")", "{", "$", "member", "=", "Security", "::", "getCurrentUser", "(", ")", ";", "}", "// Check all explicitly added items", "foreach", "(", "$", ...
Check if this item is allowed to be published @param Member $member @return bool
[ "Check", "if", "this", "item", "is", "allowed", "to", "be", "published" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L392-L406
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.getDetails
public function getDetails() { // Check each change item /** @var ChangeSetItem $change */ $total = 0; $withChanges = 0; foreach ($this->Changes() as $change) { $total++; if ($change->hasChange()) { $withChanges++; } } // Empty state if (empty($total)) { return _t(__CLASS__ . '.EMPTY', 'Empty'); } // Count all items $totalText = _t( __CLASS__ . '.ITEMS_TOTAL', '1 total|{count} total', ['count' => $total] ); if (empty($withChanges)) { return $totalText; } // Interpolate with changes text return _t( __CLASS__ . '.ITEMS_CHANGES', '{total} (1 change)|{total} ({count} changes)', [ 'total' => $totalText, 'count' => $withChanges, ] ); }
php
public function getDetails() { // Check each change item /** @var ChangeSetItem $change */ $total = 0; $withChanges = 0; foreach ($this->Changes() as $change) { $total++; if ($change->hasChange()) { $withChanges++; } } // Empty state if (empty($total)) { return _t(__CLASS__ . '.EMPTY', 'Empty'); } // Count all items $totalText = _t( __CLASS__ . '.ITEMS_TOTAL', '1 total|{count} total', ['count' => $total] ); if (empty($withChanges)) { return $totalText; } // Interpolate with changes text return _t( __CLASS__ . '.ITEMS_CHANGES', '{total} (1 change)|{total} ({count} changes)', [ 'total' => $totalText, 'count' => $withChanges, ] ); }
[ "public", "function", "getDetails", "(", ")", "{", "// Check each change item", "/** @var ChangeSetItem $change */", "$", "total", "=", "0", ";", "$", "withChanges", "=", "0", ";", "foreach", "(", "$", "this", "->", "Changes", "(", ")", "as", "$", "change", ...
Gets summary of items in changeset @return string
[ "Gets", "summary", "of", "items", "in", "changeset" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L514-L551
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.getPublishedLabel
public function getPublishedLabel() { $dateObj = $this->obj('PublishDate'); if (!$dateObj) { return null; } $publisher = $this->getPublisherName(); // Use "today" if ($dateObj->IsToday()) { if ($publisher) { return _t( __CLASS__ . '.PUBLISHED_TODAY_BY', 'Today {time} by {name}', [ 'time' => $dateObj->Time12(), 'name' => $publisher, ] ); } // Today, no publisher return _t( __CLASS__ . '.PUBLISHED_TODAY', 'Today {time}', ['time' => $dateObj->Time12()] ); } // Use date if ($publisher) { return _t( __CLASS__ . '.PUBLISHED_DATE_BY', '{date} by {name}', [ 'date' => $dateObj->FormatFromSettings(), 'name' => $publisher, ] ); } // Date, no publisher return $dateObj->FormatFromSettings(); }
php
public function getPublishedLabel() { $dateObj = $this->obj('PublishDate'); if (!$dateObj) { return null; } $publisher = $this->getPublisherName(); // Use "today" if ($dateObj->IsToday()) { if ($publisher) { return _t( __CLASS__ . '.PUBLISHED_TODAY_BY', 'Today {time} by {name}', [ 'time' => $dateObj->Time12(), 'name' => $publisher, ] ); } // Today, no publisher return _t( __CLASS__ . '.PUBLISHED_TODAY', 'Today {time}', ['time' => $dateObj->Time12()] ); } // Use date if ($publisher) { return _t( __CLASS__ . '.PUBLISHED_DATE_BY', '{date} by {name}', [ 'date' => $dateObj->FormatFromSettings(), 'name' => $publisher, ] ); } // Date, no publisher return $dateObj->FormatFromSettings(); }
[ "public", "function", "getPublishedLabel", "(", ")", "{", "$", "dateObj", "=", "$", "this", "->", "obj", "(", "'PublishDate'", ")", ";", "if", "(", "!", "$", "dateObj", ")", "{", "return", "null", ";", "}", "$", "publisher", "=", "$", "this", "->", ...
Gets the label for the "last published" date. Special case for "today" @return string
[ "Gets", "the", "label", "for", "the", "last", "published", "date", ".", "Special", "case", "for", "today" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L568-L611
train
silverstripe/silverstripe-versioned
src/ChangeSet.php
ChangeSet.getStateLabel
public function getStateLabel() { switch ($this->State) { case self::STATE_OPEN: return _t(__CLASS__.'.STATE_OPEN', 'Active'); case self::STATE_PUBLISHED: return _t(__CLASS__.'.STATE_PUBLISHED', 'Published'); case self::STATE_REVERTED: return _t(__CLASS__.'.STATE_REVERTED', 'Reverted'); default: return null; } }
php
public function getStateLabel() { switch ($this->State) { case self::STATE_OPEN: return _t(__CLASS__.'.STATE_OPEN', 'Active'); case self::STATE_PUBLISHED: return _t(__CLASS__.'.STATE_PUBLISHED', 'Published'); case self::STATE_REVERTED: return _t(__CLASS__.'.STATE_REVERTED', 'Reverted'); default: return null; } }
[ "public", "function", "getStateLabel", "(", ")", "{", "switch", "(", "$", "this", "->", "State", ")", "{", "case", "self", "::", "STATE_OPEN", ":", "return", "_t", "(", "__CLASS__", ".", "'.STATE_OPEN'", ",", "'Active'", ")", ";", "case", "self", "::", ...
Description for state @return string
[ "Description", "for", "state" ]
bddf25fd3a713e7ed7a861d6c6992febc3c7998b
https://github.com/silverstripe/silverstripe-versioned/blob/bddf25fd3a713e7ed7a861d6c6992febc3c7998b/src/ChangeSet.php#L618-L630
train