includes/plugins.php
changeset 825 9d5c04c1414f
parent 812 68060328e9c6
child 832 7152ca0a0ce9
equal deleted inserted replaced
817:880c4b7eb658 825:9d5c04c1414f
   119    </code>
   119    </code>
   120    * @param string The name of the hook.
   120    * @param string The name of the hook.
   121    * @param array Deprecated.
   121    * @param array Deprecated.
   122    */
   122    */
   123   
   123   
   124   function setHook($name, $opts = Array()) {
   124   function setHook($name, $opts = Array())
   125     if(isset($this->hook_list[$name]) && is_array($this->hook_list[$name]))
   125   {
       
   126     if ( !empty($this->hook_list[$name]) && is_array($this->hook_list[$name]) )
   126     {
   127     {
   127       return array(implode("\n", $this->hook_list[$name]));
   128       return array(implode("\n", $this->hook_list[$name]));
   128     }
   129     }
   129     else
   130     else
   130     {
   131     {
   147      $text = str_replace("Goodbye, Mr. Chips", "Hello, Mr. Carrots", $text);
   148      $text = str_replace("Goodbye, Mr. Chips", "Hello, Mr. Carrots", $text);
   148    }
   149    }
   149    </code>
   150    </code>
   150    */
   151    */
   151   
   152   
   152   function attachHook($name, $code) {
   153   function attachHook($name, $code)
   153     if(!isset($this->hook_list[$name]))
   154   {
       
   155     if ( !isset($this->hook_list[$name]) )
   154     {
   156     {
   155       $this->hook_list[$name] = Array();
   157       $this->hook_list[$name] = Array();
   156     }
   158     }
   157     $this->hook_list[$name][] = $code;
   159     $this->hook_list[$name][] = $code;
   158   }
   160   }