Example #1
0
 /**
  * Initiation of a new module.
  * 
  * @param array  &$args    argument passed during HTML call 
  * @param array  &$options (tag)-options added to the module
  * @param string &$called  original call if module has alias
  * 
  * @return void
  */
 public final function init(&$args, &$options, &$called)
 {
     $this->args =& $args;
     $this->options =& $options;
     $this->called =& $called;
     /*
      * Execute Module generated Hook if Wordpress is available.
      */
     if (class_exists('\\WP')) {
         call_user_func_array('do_action', array('Xiphe\\HTML\\ModuleCreated', &$this, Config::getHTMLInstance()));
     }
 }
Example #2
0
File: Tag.php Project: xiphe/html
 /**
  * Constructor method
  *
  * @param string $name    the tags name
  * @param array  $args    additional arguments
  * @param array  $options the tags options
  */
 public function __construct($name, $args = array(), $options = array())
 {
     /*
      * Store initiation arguments.
      */
     $this->ID = Store::getNewID();
     $this->name = $name;
     $this->options = $options;
     $this->realName = $this->name;
     /*
      * Get default brackets
      */
     $this->brackets =& TagInfo::$defaultBrackets;
     /*
      * Check if name is an alias and set realName or custom brackets.
      * @see TagInfo::$aliasTags
      */
     if (isset(TagInfo::$aliasTags[$this->name])) {
         if (is_array(TagInfo::$aliasTags[$this->name])) {
             $this->brackets =& TagInfo::$aliasTags[$this->name];
         } else {
             $this->realName = TagInfo::$aliasTags[$this->name];
         }
     }
     $this->bindDefaultCallbacks();
     /*
      * Default to empty array if no arguments were passed.
      */
     if (empty($args[0])) {
         $args[0] = '';
     }
     /*
      * Default to empty array if no arguments were passed.
      */
     if (empty($args[1])) {
         $args[1] = array();
     }
     /*
      * Add Default Options
      */
     Generator::addDefaultOptions($this);
     /*
      * Set attributes and content according to options and self-closing
      */
     if ($this->isSelfclosing() || $this->hasOption('start') || is_array($args[0])) {
         $this->attributes = $args[0];
     } else {
         $this->content = $args[0];
         if (isset($args[1])) {
             $this->attributes = $args[1];
         }
     }
     if (empty($this->content) && !$this->hasOption('start') || $this->hasOption('inlineInner')) {
         $this->inlineInner = true;
     }
     /*
      * Parse the attributes
      */
     $this->attributes = Generator::parseAtts($this);
     /*
      * Add Defaults
      */
     Generator::addDefaultAttributes($this);
     /*
      * Add potential doubled attributes
      */
     Generator::addDoubleAttributes($this);
     $this->update();
     $this->update('content');
     /*
      * Additional Arguments were passed - try to sprintf them.
      */
     if (isset($this->content) && count($args) > 2) {
         array_splice($args, 0, 2);
         $this->content = vsprintf($this->content, $args);
     }
     /*
      * Execute Tag generated Hook if Wordpress is available.
      */
     if (class_exists('\\WP')) {
         call_user_func_array('do_action', array('Xiphe\\HTML\\TagCreated', &$this, Config::getHTMLInstance()));
     }
 }
Example #3
0
File: Store.php Project: xiphe/html
 /**
  * Checks if some Tags are stored.
  *
  * @return boolean
  */
 public static function hasTags()
 {
     if (Config::get('store') == 'global') {
         return count(self::$_tagStore);
     } elseif (Config::get('store') == 'internal') {
         return count(Config::getHTMLInstance()->tagStore);
     }
 }