当前位置: 首页>>代码示例>>PHP>>正文


PHP df_o函数代码示例

本文整理汇总了PHP中df_o函数的典型用法代码示例。如果您正苦于以下问题:PHP df_o函数的具体用法?PHP df_o怎么用?PHP df_o使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了df_o函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registered

 /**
  * 2016-05-04
  * @param int $cartId
  * @param IPayment $paymentMethod
  * @param IAddress|null $billingAddress
  * @return mixed
  * @throws CouldNotSaveException
  */
 public function registered($cartId, IPayment $paymentMethod, IAddress $billingAddress = null)
 {
     /** @var IRegistered|Registered $iRegistered */
     $iRegistered = df_o(IRegistered::class);
     $iRegistered->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
     return PlaceOrderInternal::p($cartId, false);
 }
开发者ID:mage2pro,项目名称:core,代码行数:15,代码来源:PlaceOrder.php

示例2: loginByEmail

 /**
  * 2016-04-10
  * It is implemented by analogy with @see \Magento\Backend\Model\Auth::login()
  * https://github.com/magento/magento2/blob/052e789/app/code/Magento/Backend/Model/Auth.php#L137-L182
  *
  * @param string $email
  * @return void
  * @throws \Magento\Framework\Exception\AuthenticationException
  */
 public function loginByEmail($email)
 {
     $this->_initCredentialStorage();
     /** @var \Magento\Backend\Model\Auth\Credential\StorageInterface|\Magento\User\Model\User $user */
     $user = $this->getCredentialStorage();
     $user->{\Df\User\Plugin\Model\User::LOGIN_BY_EMAIL} = true;
     $user->login($email, null);
     if ($user->getId()) {
         /** @var \Magento\Backend\Model\Auth\StorageInterface|\Magento\Backend\Model\Auth\Session $authSession */
         $authSession = $this->getAuthStorage();
         $authSession->setUser($user);
         $authSession->processLogin();
         //$cookieManager->setSensitiveCookie($session->getName(), session_id());
         $_COOKIE[$authSession->getName()] = session_id();
         /** @var SessionManagerInterface|\Magento\Backend\Model\Session $session */
         $session = df_o(SessionManagerInterface::class);
         $session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, df_request('form_key'));
         df_dispatch('backend_auth_user_login_success', ['user' => $user]);
         /**
          * 2016-04-10
          * Обязательно, иначе авторизация работать не будет.
          * https://mage2.pro/t/1199
          */
         /** @var SecurityPlugin $securityPlugin */
         $securityPlugin = df_o(SecurityPlugin::class);
         $securityPlugin->afterLogin($this);
     }
 }
开发者ID:mage2pro,项目名称:core,代码行数:37,代码来源:Auth.php

示例3: df_currencies_ctn

/**
 * 2015-12-28
 * @param int|string|null|bool|StoreInterface $store [optional]
 * @return array(string => string)
 */
function df_currencies_ctn($store = null)
{
    return dfcf(function ($store = null) {
        $store = df_store($store);
        /** @var Currency $currency */
        $currency = df_o(Currency::class);
        /** @var string[] $codes */
        $codes = df_currencies_codes_allowed($store);
        // 2016-02-17
        // $rates ниже не содержит базовую валюту.
        /** @var string $baseCode */
        $baseCode = $store->getBaseCurrency()->getCode();
        /** @var array(string => float) $rates */
        $rates = $currency->getCurrencyRates($store->getBaseCurrency(), $codes);
        /** @var array(string => string) $result */
        $result = [];
        foreach ($codes as $code) {
            /** @var string $code */
            if ($baseCode === $code || isset($rates[$code])) {
                $result[$code] = df_currency_name($code);
            }
        }
        return $result;
    }, func_get_args());
}
开发者ID:mage2pro,项目名称:core,代码行数:30,代码来源:currency.php

示例4: composer

 /**
  * 2016-07-01
  * @return \Composer\Composer
  */
 private function composer()
 {
     if (!isset($this->{__METHOD__})) {
         /** @var ComposerFactory $factory */
         $factory = df_o(ComposerFactory::class);
         $this->{__METHOD__} = $factory->create();
     }
     return $this->{__METHOD__};
 }
开发者ID:mage2pro,项目名称:core,代码行数:13,代码来源:ComposerInformation.php

示例5: df_sales_seq_meta

/**
 * 2016-01-26
 * @param string $entityType
 * @param int|string|null|bool|StoreInterface $store [optional]
 * @return _Meta|Meta
 */
function df_sales_seq_meta($entityType, $store = null)
{
    return dfcf(function ($entityType, $store = null) {
        /** @var RMeta $r */
        $r = df_o(RMeta::class);
        /**
         * 2016-01-26
         * По аналогии с @see \Magento\SalesSequence\Model\Manager::getSequence()
         * https://github.com/magento/magento2/blob/d50ee5/app/code/Magento/SalesSequence/Model/Manager.php#L48
         */
        return $r->loadByEntityTypeAndStore($entityType, df_store_id($store));
    }, func_get_args());
}
开发者ID:mage2pro,项目名称:core,代码行数:19,代码来源:sequence.php

示例6: _getHeaderCommentHtml

 /**
  * 2016-07-01
  * @override
  * @see \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderCommentHtml()
  * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L166-L175
  * @used-by \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderHtml()
  * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L121
  * @param AE|F $element
  * @return string
  */
 protected function _getHeaderCommentHtml($element)
 {
     /** @var string|null $infoClass */
     $infoClass = dfa_deep($element->getData(), 'group/dfExtension');
     /** @var string $result */
     if (!$infoClass) {
         $result = parent::_getHeaderCommentHtml($element);
     } else {
         /** @var \Df\Config\Ext $extensionInfo */
         $info = df_o($infoClass);
         $result = df_tag('div', 'comment', df_tag_ab(__('Have a question?'), $info->url()));
     }
     return $result;
 }
开发者ID:mage2pro,项目名称:core,代码行数:24,代码来源:Ext.php

示例7: afterGetComment

 /**
  * 2016-11-20
  * У класса @see \Magento\Framework\Data\Form\Element\AbstractElement
  * метод getComment() — магический.
  * К магическим методам плагины не применяются.
  * Поэтому для задействования плагина необходимо унаследоваться от класса ядра
  * и явно объявить в своём классе метод getComment().
  * Примеры:
  * @see \Df\Framework\Form\Element\Checkbox::getComment()
  * @see \Df\Framework\Form\Element\Text::getComment()
  * @used-by \Magento\Config\Block\System\Config\Form\Field::_renderValue()
  * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Field.php#L82-L84
  * @param Sb $sb
  * @param string $result
  * @return string
  */
 public function afterGetComment(Sb $sb, $result)
 {
     /** @var string|null $vc */
     $vc = df_fe_fc($sb, 'dfValidator');
     if ($vc) {
         /** @var \Df\Framework\IValidator $v */
         $v = df_o($vc);
         /** @var Phrase|Phrase[]|true $messages */
         $messages = $v->check($sb);
         if (true !== $messages) {
             $result .= df_tag_list(df_array($messages), false, 'df-enabler-warnings');
         }
     }
     return $result;
 }
开发者ID:mage2pro,项目名称:core,代码行数:31,代码来源:AbstractElement.php

示例8: _place

 /**
  * 2016-07-18
  * @return mixed|null
  * @throws CouldNotSaveException
  */
 private function _place()
 {
     /** @var IQM|QM $qm */
     $qm = df_o(IQM::class);
     /** @var mixed $result */
     try {
         BillingAddress::disable(!$this->ss()->askForBillingAddress());
         try {
             /** @var int $orderId */
             $orderId = $qm->placeOrder($this->quoteId());
         } finally {
             BillingAddress::restore();
         }
         $result = df_order($orderId)->getPayment()->getAdditionalInformation(PlaceOrder::DATA);
     } catch (\Exception $e) {
         throw new CouldNotSaveException(__($this->message($e)), $e);
     }
     return $result;
 }
开发者ID:mage2pro,项目名称:core,代码行数:24,代码来源:PlaceOrderInternal.php

示例9: df_asset_source

/**
 * 2015-12-29
 * @return \Magento\Framework\View\Asset\Source
 */
function df_asset_source()
{
    return df_o(\Magento\Framework\View\Asset\Source::class);
}
开发者ID:mage2pro,项目名称:core,代码行数:8,代码来源:asset.php

示例10: select

 /**
 * 2015-11-30
 * 2015-12-13
 * Обратите внимание, что $label может быть как пустой строкой, так и null,
 * и система будет вести себя по-разному в этих случаях.
 * Если $label равно null, то подпись у элемента будет отсутствовать.
 * Если $label равно пустой строке, то у элемента будет пустая подпись:
 * пустые теги <label><span></span></label>
 * Пустая подпись позволяет нам задействовать в качестве подписи FontAwesome:
 * мы цепляем к пустому тегу label правила типа:
 			> label:not(.addafter) {
 				display: inline-block;
 				font-family: FontAwesome;
 				// http://fortawesome.github.io/Font-Awesome/icon/text-width/
 				&:before {content: "\f035";}
 			}
 *
 * 2015-12-28
 * Добавил возможность передачи в качестве $values простого одномерного массива,
 * например: $this->select('decimalSeparator', 'Decimal Separator', ['.', ',']);
 *
 * @used-by \Df\Framework\Form\Element\Fieldset::yesNo()
 * @param string $name
 * @param string|null|Phrase $label
 * @param array(array(string => string|int))|string[]|string|OptionSourceInterface $values
 * @param array(string => mixed)|string $data [optional]
 * @param string|null $type [optional]
 * @return \Magento\Framework\Data\Form\Element\Select|E
 */
 protected function select($name, $label, $values, $data = [], $type = 'select')
 {
     if (!is_array($values)) {
         if (!$values instanceof OptionSourceInterface) {
             $values = df_o($values);
         }
         df_assert($values instanceof OptionSourceInterface);
         $values = $values->toOptionArray();
     }
     if (!is_array($data)) {
         $data = ['note' => $data];
     }
     return $this->field($name, $type, $label, $data + ['values' => df_a_to_options($values)]);
 }
开发者ID:mage2pro,项目名称:core,代码行数:43,代码来源:Fieldset.php

示例11: df_scope_pool

/**
 * 2016-07-30
 * @return ScopePool
 */
function df_scope_pool()
{
    return df_o(ScopePool::class);
}
开发者ID:mage2pro,项目名称:core,代码行数:8,代码来源:scope.php

示例12: df_visitor_ip

/** @return string */
function df_visitor_ip()
{
    /** @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $a */
    $a = df_o(\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class);
    return df_my_local() ? '92.243.166.8' : $a->getRemoteAddress();
}
开发者ID:mage2pro,项目名称:core,代码行数:7,代码来源:visitor.php

示例13: s

 /**
  * 2016-05-19
  * 2016-05-20
  * Создавать коллекцию надо обязательно через Object Manager,
  * потому что родительский конструктор использует Dependency Injection.
  * @used-by df_countries()
  * @used-by \Df\Directory\Model\Country::cs()
  * @return self
  */
 public static function s()
 {
     static $r;
     return $r ? $r : ($r = df_o(__CLASS__));
 }
开发者ID:mage2pro,项目名称:core,代码行数:14,代码来源:Collection.php

示例14: df_address_registry

/**
 * 2016-04-05
 * @return AddressRegistry
 */
function df_address_registry()
{
    return df_o(AddressRegistry::class);
}
开发者ID:mage2pro,项目名称:core,代码行数:8,代码来源:address.php

示例15: df_order_send_email

/**
 * 2016-05-06
 * https://mage2.pro/t/1543
 * @see df_invoice_send_email()
 * 2016-07-15
 * Usually, when you have received a payment confirmation from a payment system,
 * you should use @see df_order_send_email() instead of @see df_invoice_send_email()
 * What is the difference between InvoiceSender and OrderSender? https://mage2.pro/t/1872
 * @param O $order
 * @return void
 */
function df_order_send_email(O $order)
{
    /** @var OrderSender $sender */
    $sender = df_o(OrderSender::class);
    $sender->send($order);
    /** @var History|IHistory $history */
    $history = $order->addStatusHistoryComment(__('You have confirmed the order to the customer via email.'));
    $history->setIsCustomerNotified(true);
    $history->save();
}
开发者ID:mage2pro,项目名称:core,代码行数:21,代码来源:order.php


注:本文中的df_o函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。