示例#1
0
 protected function beforeSave()
 {
     if (!empty($this->{'excluded.ips'}) && !is_array($this->{'excluded.ips'})) {
         $excluded_ips = array_filter(array_unique(array_values(\Base::instance()->split($this->{'excluded.ips'}))));
         $this->{'excluded.ips'} = $excluded_ips;
     }
     return parent::beforeSave();
 }
示例#2
0
 public function __construct($source = array(), $options = array())
 {
     parent::__construct($source, $options);
     $this->set('social.providers.GitHub.wrapper.path', \Base::instance()->get('PATH_ROOT') . 'vendor/hybridauth/hybridauth/additional-providers/hybridauth-github/Providers/GitHub.php');
     $this->set('social.providers.GitHub.wrapper.class', 'Hybrid_Providers_GitHub');
     $this->set('social.providers.PaypalOpenID.wrapper.path', \Base::instance()->get('PATH_ROOT') . 'vendor/hybridauth/hybridauth/additional-providers/hybridauth-paypal-openid/Providers/PaypalOpenID.php');
     $this->set('social.providers.PaypalOpenID.wrapper.class', 'Hybrid_Providers_PaypalOpenID');
     $this->set('social.providers.Instagram.wrapper.path', \Base::instance()->get('PATH_ROOT') . 'vendor/hybridauth/hybridauth/additional-providers/hybridauth-instagram/Providers/Instagram.php');
     $this->set('social.providers.Instagram.wrapper.class', 'Hybrid_Providers_Instagram');
     return $this;
 }
示例#3
0
 protected function fetchConditions()
 {
     parent::fetchConditions();
     $this->setCondition('type', $this->__type);
     $filter_lang = $this->getState('filter.lang');
     if (strlen($filter_lang)) {
         $this->setCondition('language_code', $filter_lang);
     }
     $filter_lang_id = $this->getState('filter.lang_id');
     if (strlen($filter_lang_id)) {
         $this->setCondition('language_id', $filter_lang_id);
     }
     return $this;
 }
示例#4
0
 public static function throttledCleanup()
 {
     $settings = \Dsc\Mongo\Collections\Settings::fetch();
     if (empty($settings->last_sessions_cleanup) || $settings->last_sessions_cleanup < time() - 3600) {
         $settings->last_sessions_cleanup = time();
         if (empty($settings->id)) {
             $settings->save();
         } else {
             $settings->store();
         }
         return static::cleanup();
     }
     return null;
 }
示例#5
0
 protected function beforeValidate()
 {
     if (!empty($this->abandoned_cart_emails) && is_array($this->abandoned_cart_emails)) {
         // TODO: update all emails that are already scheduled to send? and add any additional emails to already abandoned carts, if any were added right now
         $this->abandoned_cart_emails = array_filter(array_values($this->abandoned_cart_emails));
         usort($this->abandoned_cart_emails, function ($a, $b) {
             return $a['delay'] - $b['delay'];
         });
     }
     return parent::beforeValidate();
 }