Example #1
0
 public static function merge(array $input, $message_list, $options = array())
 {
     $context = isset($options['context']) ? $options['context'] : null;
     $mixables = array();
     foreach (Util::splitDelimList($message_list) as $message) {
         if ($result = self::call($message, $context)) {
             $mixables = array_merge($mixables, $result);
         }
     }
     while ($mixable = array_shift($mixables)) {
         if ($mixable instanceof Declaration) {
             $input[] = $mixable;
         } else {
             list($property, $value) = $mixable;
             if ($property === 'mixin') {
                 $input = Mixin::merge($input, $value, $options);
             } elseif (!empty($options['keyed'])) {
                 $input[$property] = $value;
             } else {
                 $input[] = array($property, $value);
             }
         }
     }
     return $input;
 }
 public function walk()
 {
     // Look for a walk() method in this object's parent classes
     // (in this case, it would be Animal's walk() method), call it,
     // and pass it the number of legs for this dog
     $mixin = Mixin::getMixin($this);
     $mixin->parentCall($this, 'walk', $this->legs);
 }
 function get_checkout_buttons()
 {
     $buttons = parent::call_parent('get_checkout_buttons');
     if ($this->is_paypal_express_checkout_enabled()) {
         $buttons[] = 'paypal_express_checkout';
     }
     return $buttons;
 }
 function get_checkout_buttons()
 {
     $buttons = parent::call_parent('get_checkout_buttons');
     if (C_NextGen_Settings::get_instance()->get('ecommerce_cheque_enable', FALSE)) {
         $buttons[] = 'cheque_checkout';
     }
     return $buttons;
 }
 function get_checkout_buttons()
 {
     $buttons = parent::call_parent('get_checkout_buttons');
     if (C_NextGen_Settings::get_instance()->ecommerce_test_gateway_enable) {
         $buttons[] = 'test_gateway_checkout';
     }
     return $buttons;
 }
 function get_checkout_buttons()
 {
     $buttons = parent::call_parent('get_checkout_buttons');
     if ($this->is_stripe_enabled()) {
         $buttons[] = 'stripe_checkout';
     }
     return $buttons;
 }
 public function flatten($rule_context)
 {
     if ($this->flattened) {
         return;
     }
     $new_set = array();
     foreach ($this->store as $declaration) {
         if (is_array($declaration) && $declaration[0] === 'mixin') {
             foreach (Mixin::merge(array(), $declaration[1], array('context' => $rule_context)) as $mixable) {
                 if ($mixable instanceof Declaration) {
                     $clone = clone $mixable;
                     $clone->index = count($new_set);
                     $new_set[] = $clone;
                 } else {
                     $new_set[] = new Declaration($mixable[0], $mixable[1], count($new_set));
                 }
             }
         } else {
             $declaration->index = count($new_set);
             $new_set[] = $declaration;
         }
     }
     $this->reset($new_set);
     $this->flattened = true;
 }
 function initialize()
 {
     parent::initialize();
     $this->add_mixin('Mixin_NextGen_Basic_Pagination');
 }
 public function init()
 {
     parent::init();
     $this->model(array('user_basic_info_model'));
 }
Example #10
0
 public function init()
 {
     parent::init();
     $this->duck = 'Hello';
     $this->model(array('group_model', 'user_model'));
 }
Example #11
0
 protected function applyMixin($text)
 {
     return preg_replace_callback('/\\$([\\w\\-]+)(?::\\s*(.*?);)?/m', function ($m) {
         $name = $m[1];
         $value = $m[2] ?? null;
         if (isset($this->mixin[$name])) {
             return $this->mixin[$name];
         }
         return Mixin::call($name, $value);
     }, $text);
 }
Example #12
0
 public function addMixin(Mixin $mixin)
 {
     $mixin->setObject($this);
     $this->mixins[$mixin->getName()] = $mixin;
 }