Ignore:
Timestamp:
Feb 9, 2009 1:22:12 PM (4 years ago)
Author:
thomasb
Message:

Allow plugins to add stylesheets + use common event interface with event 'init' to start plugin scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-api/program/include/rcube_plugin.php

    r2279 r2285  
    131131  public function include_script($fn) 
    132132  { 
    133     // relative file name 
    134     if ($fn[0] != '/' && !eregi('^https?://', $fn)) { 
    135       $fn = $this->ID.'/'.$fn; 
    136     } 
    137      
    138     $this->api->include_script($fn); 
     133    $this->api->include_script($this->ressource_url($fn)); 
     134  } 
     135 
     136  /** 
     137   * Make this stylesheet available on the client 
     138   * 
     139   * @param string File path; absolute or relative to the plugin directory 
     140   */ 
     141  public function include_stylesheet($fn) 
     142  { 
     143    $this->api->include_stylesheet($this->ressource_url($fn)); 
     144  } 
     145 
     146  /** 
     147   * Make the given file name link into the plugin directory 
     148   */ 
     149  private function ressource_url($fn) 
     150  { 
     151    if ($fn[0] != '/' && !eregi('^https?://', $fn)) 
     152      return $this->ID . '/' . $fn; 
     153    else 
     154      return $fn; 
    139155  } 
    140156 
Note: See TracChangeset for help on using the changeset viewer.