コード例 #1
0
 /**
  * Add theme
  * Accepts properties to create new theme or previously-created theme instance
  * @uses parent::add()
  * @param string|object $id Theme ID (or Theme object)
  * @param array $props Theme properties
  * @return object Current instance
  */
 public function add($id, $props = array())
 {
     //Prepare parent
     if (isset($props['parent']) && !$props['parent'] instanceof $this->item_type) {
         $pid = $props['parent'];
         $items = $this->get(array('include_private' => true));
         if (isset($items[$pid])) {
             $props['parent'] = $items[$pid];
         }
     }
     $o = is_string($id) ? new $this->item_type($id, $props) : $id;
     //Add to collection
     return parent::add($o);
 }
コード例 #2
0
 /**
  * Add content type handler
  * Accepts properties to create new handler OR previously-initialized handler instance
  * @uses clear_cache()
  * @see parent::add()
  * @param string $id Handler ID
  * @param array $props Handler properties
  * @return object Current instance
  */
 public function add($id, $props = array(), $priority = 10)
 {
     $this->clear_cache();
     if (is_string($id)) {
         // Initialize new handler
         $handler = new $this->item_type($id, $props);
     } else {
         // Remap parameters
         $handler = func_get_arg(0);
         if (func_num_args() == 2) {
             $priority = func_get_arg(1);
         }
     }
     if (!is_int($priority)) {
         $priority = 10;
     }
     // Add to collection
     return parent::add($handler, array('priority' => $priority));
 }
コード例 #3
0
 /**
  * Add template tag
  * Accepts properties to create new template tag OR previously-initialized tag instance
  * @see parent::add()
  * @param string $id Tag ID
  * @param array $props Tag properties
  * @return object Current instance
  */
 public function add($id, $props = array())
 {
     $o = is_string($id) ? new $this->item_type($id, $props) : $id;
     //Add to collection
     return parent::add($o);
 }