Example #1
0
 /**
  * A general Utility method that merges HTML_Template_Flexy_Elements
  * Static method - no native debug avaiable..
  *
  * @param    HTML_Template_Flexy_Element   $original  (eg. from getElements())
  * @param    HTML_Template_Flexy_Element   $new (with data to replace/merge)
  * @return   HTML_Template_Flexy_Element   the combined/merged data.
  * @static
  * @access   public
  */
 function mergeElement($original, $new)
 {
     // no original - return new
     if (!$original) {
         return $new;
     }
     // no new - return original
     if (!$new) {
         return $original;
     }
     // If the properties of $original differ from those of $new and
     // they are set on $new, set them to $new's. Otherwise leave them
     // as they are.
     if ($new->tag && $new->tag != $original->tag) {
         $original->tag = $new->tag;
     }
     if ($new->override !== false) {
         $original->override = $new->override;
     }
     if (count($new->children)) {
         //echo "<PRE> COPY CHILDREN"; print_r($from->children);
         $original->children = $new->children;
     }
     if (is_array($new->attributes)) {
         foreach ($new->attributes as $key => $value) {
             $original->attributes[$key] = $value;
         }
     }
     // originals never have prefixes or suffixes..
     $original->prefix = $new->prefix;
     $original->suffix = $new->suffix;
     if ($new->value !== null) {
         $original->setValue($new->value);
     }
     return $original;
 }
Example #2
0
 public static function imgChecker($img)
 {
     global $_conf;
     $is_xhtml = !$_conf['ktai'];
     $chk = array();
     $mfa_checkbox = array('type' => 'checkbox', 'name' => 'change[]', 'id' => "img{$img['id']}_change", 'value' => $img['id'], 'onclick' => 'iv2_checked(this, event)', 'flexy:xhtml' => $is_xhtml, '/' => $is_xhtml);
     if ($_conf['ktai']) {
         unset($mfa_checkbox['id'], $mfa_checkbox['onclick']);
     }
     $mf_change = new HTML_Template_Flexy_Element('input', $mfa_checkbox);
     $chk['f_change'] = $mf_change->toHtml();
     return $chk;
 }