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


PHP EEM_Base::_create_objects方法代码示例

本文整理汇总了PHP中EEM_Base::_create_objects方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base::_create_objects方法的具体用法?PHP EEM_Base::_create_objects怎么用?PHP EEM_Base::_create_objects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EEM_Base的用法示例。


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

示例1: _create_objects

 /**
  * Overrides parent to not only turn wpdb results into EE_Payment_Method objects,
  * but also verifies the payment method type of each is a usable object. If not,
  * deactivate it, sets a notification, and deactivates it
  * @param array $rows
  * @return EE_Payment_Method[]
  */
 protected function _create_objects($rows = array())
 {
     $payment_methods = parent::_create_objects($rows);
     /* @var $payment_methods EE_Payment_Method[] */
     $usable_payment_methods = array();
     foreach ($payment_methods as $key => $payment_method) {
         try {
             $payment_method->type_obj();
             $usable_payment_methods[$key] = $payment_method;
         } catch (EE_Error $e) {
             //if it threw an exception, its because the payment type object
             //isn't defined (probably because somehow the DB got borked,
             //or an addon which defined it got deactivated
             //so deactivate it and move on
             $payment_method->deactivate();
             $payment_method->save();
             EE_Error::add_attention(sprintf(__("There is no payment method type '%s', so the payment method '%s' was deactivated", "event_espresso"), $payment_method->type(), $payment_method->name()), __FILE__, __FUNCTION__, __LINE__);
         }
     }
     return $usable_payment_methods;
 }
开发者ID:rheator,项目名称:event-espresso-core,代码行数:28,代码来源:EEM_Payment_Method.model.php

示例2: _create_objects

 /**
  * Overrides parent to not only turn wpdb results into EE_Payment_Method objects,
  * but also verifies the payment method type of each is a usable object. If not,
  * deactivate it, sets a notification, and deactivates it
  * @param array $rows
  * @return EE_Payment_Method[]
  */
 protected function _create_objects($rows = array())
 {
     $payment_methods = parent::_create_objects($rows);
     /* @var $payment_methods EE_Payment_Method[] */
     $usable_payment_methods = array();
     foreach ($payment_methods as $key => $payment_method) {
         try {
             $payment_method->type_obj();
             $usable_payment_methods[$key] = $payment_method;
         } catch (EE_Error $e) {
             //if it threw an exception, its because the payment type object
             //isn't defined (probably because somehow the DB got borked,
             //or an addon which defined it got deactivated
             //so deactivate it and move on
             $payment_method->deactivate();
             $payment_method->save();
             EE_Error::add_attention(sprintf(__('An error occurred while attempting to use the "%1$s" payment method, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated?%2$sIt can be reactivated on the %3$sPlugins admin page%4$s||%2$sThe actual error was:%2$s%5$s', 'event_espresso'), $payment_method->name(), '<br />', '<a href="' . admin_url('plugins.php') . '">', '</a>', $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
         }
     }
     return $usable_payment_methods;
 }
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:28,代码来源:EEM_Payment_Method.model.php

示例3: _create_objects

 /**
  * Overrides parent to not only turn wpdb results into EE_Payment_Method objects,
  * but also verifies the payment method type of each is a usable object. If not,
  * deactivate it, sets a notification, and deactivates it
  * @param array $rows
  * @return EE_Payment_Method[]
  */
 protected function _create_objects($rows = array())
 {
     EE_Registry::instance()->load_lib('Payment_Method_Manager');
     $payment_methods = parent::_create_objects($rows);
     /* @var $payment_methods EE_Payment_Method[] */
     $usable_payment_methods = array();
     foreach ($payment_methods as $key => $payment_method) {
         if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) {
             $usable_payment_methods[$key] = $payment_method;
             //some payment methods enqueue their scripts in EE_PMT_*::__construct
             //which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue
             //its scripts). but for backwards-compat we should continue to do that
             $payment_method->type_obj();
         } elseif ($payment_method->active()) {
             //only deactivate and notify the admin if the payment is active somewhere
             $payment_method->deactivate();
             $payment_method->save();
             EE_Error::add_persistent_admin_notice('auto-deactivated-' . $payment_method->type(), sprintf(__('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'), $payment_method->admin_name(), '<br />', '<a href="' . admin_url('plugins.php') . '">', '</a>'), true);
         }
     }
     return $usable_payment_methods;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:29,代码来源:EEM_Payment_Method.model.php


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