Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!($this->value >= $this->min && $this->value <= $this->max));
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(strlen($this->value) != $this->length);
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!preg_match($this->preg, $this->value));
 }
Ejemplo n.º 7
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value == '' || $this->value == null);
 }
Ejemplo n.º 8
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(true);
 }
Ejemplo n.º 9
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!is_numeric($this->value));
 }
Ejemplo n.º 10
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value != 0 && $this->value != 1);
 }
Ejemplo n.º 11
0
 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!(strlen($this->value) >= $this->min && strlen($this->value) <= $this->max));
 }