Changeset 1c932d5 in github for program/include/rcube_plugin.php


Ignore:
Timestamp:
Apr 26, 2009 12:33:22 PM (4 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
99d8660
Parents:
d4d1a25
Message:

Allow plugins to define their own tasks + add 'domain' parameter for rcube_template::button()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_plugin.php

    rcc97ea0 r1c932d5  
    102102   * @see rcmail::gettext() 
    103103   */ 
    104   function gettext($p) 
     104  public function gettext($p) 
    105105  { 
    106106    return rcmail::get_instance()->gettext($p, $this->ID); 
    107107  } 
    108    
     108 
     109  /** 
     110   * Register this plugin to be responsible for a specific task 
     111   * 
     112   * @param string Task name (only characters [a-z0-9_.-] are allowed) 
     113   */ 
     114  public function register_task($task) 
     115  { 
     116    if ($task != asciiwords($task)) { 
     117      raise_error(array('code' => 526, 'type' => 'php', 'message' => "Invalid task name: $task. Only characters [a-z0-9_.-] are allowed"), true, false); 
     118    } 
     119    else if (in_array(rcmail::$main_tasks, $task)) { 
     120      raise_error(array('code' => 526, 'type' => 'php', 'message' => "Cannot register taks $task; already taken by another plugin or the application itself"), true, false); 
     121    } 
     122    else { 
     123      rcmail::$main_tasks[] = $task; 
     124    } 
     125  } 
     126 
    109127  /** 
    110128    * Register a handler for a specific client-request action 
Note: See TracChangeset for help on using the changeset viewer.