Example #1
0
 public function repeat($val, $element)
 {
     $data = $this->parseFunction($val, $element);
     //$this->dataStorage[$element] = $data;
     foreach ($data as $iteration) {
         $clone = $element->cloneNode(true);
         $this->dataStorage[$clone] = $iteration;
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRule = $this->rule;
         //Don't run repeat on the clones element or it will loop forever
         unset($newRule['rules']['repeat']);
         $hook = new Rule($newRule, $iteration, $this->dataStorage);
         $hook->run($clone);
     }
     //Remove the original element so only the ones that have been looped over will show
     $element->parentNode->removeChild($element);
     return false;
 }
Example #2
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!($this->value >= $this->min && $this->value <= $this->max));
 }
 public function repeat($value, $element, $rule)
 {
     foreach ($value as $iteration) {
         $clone = $element->cloneNode(true);
         $this->data->bind($clone, $iteration);
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRules = $rule->getRules();
         //Don't run repeat on the clones element or it will loop forever
         unset($newRules['repeat']);
         $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data);
         foreach ($rule->getProperties() as $obj) {
             $hook->registerProperties($obj);
         }
         $hook->run($clone);
     }
     //Remove the original element so only the ones that have been looped over will show
     $element->parentNode->removeChild($element);
     return false;
 }
Example #4
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(strlen($this->value) != $this->length);
 }
 public function repeat($value, $element, $rule)
 {
     if ($element->getAttribute('transphporm') === 'added') {
         return $element->parentNode->removeChild($element);
     }
     foreach ($value as $key => $iteration) {
         $clone = $element->cloneNode(true);
         //Mark this node as having been added by transphporm
         $clone->setAttribute('transphporm', 'added');
         $this->data->bind($clone, $iteration, 'iteration');
         $this->data->bind($clone, $key, 'key');
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRules = $rule->getRules();
         //Don't run repeat on the clones element or it will loop forever
         unset($newRules['repeat']);
         $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data);
         foreach ($rule->getProperties() as $obj) {
             $hook->registerProperties($obj);
         }
         $hook->run($clone);
     }
     //Flag the original element for removal
     $element->setAttribute('transphporm', 'remove');
     return false;
 }
Example #6
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!preg_match($this->preg, $this->value));
 }
Example #7
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value == '' || $this->value == null);
 }
Example #8
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(true);
 }
Example #9
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!is_numeric($this->value));
 }
Example #10
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value != 0 && $this->value != 1);
 }
Example #11
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!(strlen($this->value) >= $this->min && strlen($this->value) <= $this->max));
 }