Changeset 5975 in subversion


Ignore:
Timestamp:
Mar 7, 2012 5:07:57 AM (16 months ago)
Author:
alec
Message:
Location:
trunk/roundcubemail/program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_plugin.php

    r5787 r5975  
    8282    $this->urlbase = $api->url . $this->ID . '/'; 
    8383  } 
    84    
     84 
    8585  /** 
    8686   * Initialization method, needs to be implemented by the plugin itself 
     
    118118      return false; 
    119119    } 
    120      
     120 
    121121    return true; 
    122122  } 
     
    132132    $this->api->register_hook($hook, $callback); 
    133133  } 
    134    
     134 
     135  /** 
     136   * Unregister a callback function for a specific (server-side) hook. 
     137   * 
     138   * @param string $hook Hook name 
     139   * @param mixed  $callback Callback function as string or array with object reference and method name 
     140   */ 
     141  public function remove_hook($hook, $callback) 
     142  { 
     143    $this->api->unregister_hook($hook, $callback); 
     144  } 
     145 
    135146  /** 
    136147   * Load localized texts from the plugins dir 
     
    142153  { 
    143154    $domain = $this->ID; 
    144      
     155 
    145156    $lang = $_SESSION['language']; 
    146157    $locdir = slashify(realpath(slashify($this->home) . $dir)); 
     
    168179      $rcmail = rcmail::get_instance(); 
    169180      $rcmail->load_language($lang, $add); 
    170        
     181 
    171182      // add labels to client 
    172183      if ($add2client) { 
     
    176187    } 
    177188  } 
    178    
     189 
    179190  /** 
    180191   * Wrapper for rcmail::gettext() adding the plugin ID as domain 
     
    246257    $this->api->include_stylesheet($this->resource_url($fn)); 
    247258  } 
    248    
     259 
    249260  /** 
    250261   * Append a button to a certain container 
     
    261272        if ($p[$key]) 
    262273          $p[$key] = $this->api->url . $this->resource_url($p[$key]); 
    263        
     274 
    264275      $this->api->add_content($this->api->output->button($p), $container); 
    265276    } 
    266277  } 
    267    
     278 
    268279  /** 
    269280   * Generate an absolute URL to the given resource within the current 
     
    316327  } 
    317328 
    318  
    319329} 
    320  
  • trunk/roundcubemail/program/include/rcube_plugin_api.php

    r5812 r5975  
    231231  } 
    232232 
     233  /** 
     234   * Allow a plugin object to unregister a callback. 
     235   * 
     236   * @param string $hook Hook name 
     237   * @param mixed  $callback String with global function name or array($obj, 'methodname') 
     238   */ 
     239  public function unregister_hook($hook, $callback) 
     240  { 
     241    $callback_id = array_search($callback, $this->handlers[$hook]); 
     242    if ($callback_id !== false) { 
     243      unset($this->handlers[$hook][$callback_id]); 
     244    } 
     245  } 
     246 
    233247 
    234248  /** 
Note: See TracChangeset for help on using the changeset viewer.