- Timestamp:
- Jun 24, 2012, 9:18:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GrumPluginClasses/classes/CommonPlugin.class.inc.php
r15340 r16012 2 2 /* ----------------------------------------------------------------------------- 3 3 class name: CommonPlugin 4 class version : 2. 2.05 plugin version : 3. 2.06 date : 201 0-07-284 class version : 2.3.0 5 plugin version : 3.5.2 6 date : 2012-06-24 7 7 8 8 ------------------------------------------------------------------------------ … … 51 51 | | | function 52 52 | | | 53 | 2.3.0 | 2012/06/24 | * Add loadCSS() function 54 | | | 53 55 | | | 54 56 | | | … … 64 66 private $page_link; //link to admin page 65 67 private $fileLocation; //files plugin location on server 68 private $pluginDirectory; //directory of plugin 66 69 private $displayResult_ok; 67 70 private $displayResult_ko; … … 122 125 } 123 126 124 /* constructor allows to initialize $prefixeTable value */ 127 /** 128 * constructor allows to initialize $prefixeTable value 129 * @param String $prefixeTable: prefix used for tables 130 * @param String $filelocation: file calling the constructor (__FILE__) 131 */ 125 132 public function __construct($prefixeTable, $filelocation) 126 133 { … … 129 136 $this->fileLocation=$filelocation; 130 137 $this->prefixeTable=$prefixeTable; 138 $this->pluginDirectory=basename(dirname($filelocation)); 131 139 $this->page_link=get_root_url().'admin.php?page=plugin-'.basename(dirname($this->getFileLocation())); 132 140 //$this->page_link="admin.php?page=plugin§ion=".basename(dirname($this->getFileLocation()))."/admin/".$this->plugin_admin_file.".php"; … … 150 158 } 151 159 160 /** 161 * return the file location 162 * @return String: file location 163 */ 152 164 public function getFileLocation() 153 165 { … … 155 167 } 156 168 169 /** 170 * return the plugin directory 171 * @return String: directory 172 */ 173 public function getDirectory() 174 { 175 return($this->pluginDirectory); 176 } 177 178 /** 179 * return the link of plugin in admin pages 180 * @return String: url 181 */ 157 182 public function getAdminLink() 158 183 { … … 160 185 } 161 186 187 /** 188 * set the link of plugin in admin pages 189 * @param String $link: url to set 190 * @return String: url 191 */ 162 192 public function setAdminLink($link) 163 193 { … … 166 196 } 167 197 198 /** 199 * set the plugin name 200 * @param String $name: plugin's name 201 * @return String: plugin's name 202 */ 168 203 public function setPluginName($name) 169 204 { … … 172 207 } 173 208 209 /** 210 * set the plugin name for file system useage 211 * @param String $name: plugin's name 212 * @return String: plugin's name 213 */ 174 214 public function setPluginNameFiles($name) 175 215 { … … 178 218 } 179 219 220 /** 221 * get the plugin name 222 * @return String: plugin's name 223 */ 180 224 public function getPluginName() 181 225 { … … 183 227 } 184 228 229 /** 230 * get the plugin name for file system useage 231 * @return String: plugin's name 232 */ 185 233 public function getPluginNameFiles() 186 234 { … … 192 240 --------------------------------------------------------------------------- */ 193 241 194 /* this function initialize var $config with default values */ 242 /** 243 * this function initialize var $this->config with default values 244 */ 195 245 public function initConfig() 196 246 { … … 198 248 } 199 249 200 /* load config from CONFIG_TABLE into var $my_config */ 250 /** 251 * load config from CONFIG_TABLE into var $this->config 252 * @return Boolean: true if config is loaded, otherwiser false 253 */ 201 254 public function loadConfig() 202 255 { … … 206 259 207 260 /** 208 * load config from a file into var $ my_config261 * load config from a file into var $this->config 209 262 * 210 263 * this function don't initialize the default value ! … … 212 265 * 213 266 * @param String $fileName : name of file to load 267 * @return Boolean: true if file is loaded, otherwise false 214 268 */ 215 269 public function loadConfigFromFile($fileName) … … 218 272 } 219 273 220 /* save var $my_config into CONFIG_TABLE */ 274 /** 275 * save var $this->config into CONFIG_TABLE 276 * @return Boolean: true if config is saved, otherwise false 277 */ 221 278 public function saveConfig() 222 279 { … … 224 281 } 225 282 226 /* delete config from CONFIG_TABLE */ 283 /** 284 * delete config from CONFIG_TABLE 285 * @return Boolean: true if config is deleted, otherwise false 286 */ 227 287 public function deleteConfig() 228 288 { … … 234 294 --------------------------------------------------------------------------- */ 235 295 236 /* 237 initialize tables list used by the plugin 238 $list = array('table1', 'table2') 239 $this->tables_list['table1'] = $prefixeTable.$plugin_name.'_table1' 240 */ 296 /** 297 * initialize tables list used by the plugin; tables name will be prefixed 298 * automatically 299 * $list = array('table1', 'table2') 300 * $this->tables_list['table1'] = $prefixeTable.$plugin_name.'_table1' 301 * @param Array $list: a list of table name 302 */ 241 303 protected function setTablesList($list) 242 304 { … … 251 313 --------------------------------------------------------------------------- */ 252 314 253 /* add plugin into administration menu */ 315 /** 316 * add plugin into administration menu; url is built automatically 317 * @param String $menu: 318 */ 254 319 public function pluginAdminMenu($menu) 255 320 { … … 261 326 ) 262 327 ); 263 /* 264 array_push($menu, 265 array( 266 'NAME' => $this->plugin_name, 267 'URL' => get_admin_plugin_menu_link(dirname($this->getFileLocation()). 268 '/admin/'.$this->plugin_admin_file.'.php') 269 ));*/ 270 return $menu; 271 } 272 273 /* 274 manage plugin integration into piwigo's admin interface 275 276 to be surcharged by child's classes 277 */ 328 return($menu); 329 } 330 331 /** 332 * manage plugin integration into piwigo's admin interface 333 * 334 * to be surcharged by child's classes 335 */ 278 336 public function manage() 279 337 { 280 338 } 281 339 282 /* 283 initialize plugin's events 284 to be surcharged by child's classes 285 */ 340 /** 341 * initialize plugin's events 342 * by default, call the loadCSS() function on the 'loc_begin_page_header' events 343 * 344 * to be surcharged by child's classes 345 */ 286 346 public function initEvents() 287 347 { 288 } 348 global $plugin_id; 349 350 if($plugin_id==$this->getDirectory() or !defined('IN_ADMIN')) 351 add_event_handler('loc_begin_page_header', array(&$this, 'loadCSS')); 352 } 353 354 /** 355 * called on the 'loc_begin_page_header' event 356 * 357 * to be surcharged by child's classes 358 */ 359 public function loadCSS() 360 { 361 } 362 289 363 290 364 protected function debug($text, $rewrite=false) … … 306 380 } 307 381 308 /*309 manage infos & errors display310 */311 382 protected function displayResult($action_msg, $result) 312 383 {
Note: See TracChangeset
for help on using the changeset viewer.