Changeset e6ce006 in github


Ignore:
Timestamp:
Jul 30, 2010 2:34:02 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
95fd49e4
Parents:
ee09d46
Message:
  • Unify hooks names, see rcube_plugin_api::deprecated_hooks for complete list (old names are supported without errors nor warnings)
Location:
program
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcmail.php

    r9048094 re6ce006  
    256256    $abook_type = strtolower($this->config->get('address_book_type')); 
    257257 
    258     $plugin = $this->plugins->exec_hook('get_address_book', array('id' => $id, 'writeable' => $writeable)); 
     258    $plugin = $this->plugins->exec_hook('addressbook_get', array('id' => $id, 'writeable' => $writeable)); 
    259259 
    260260    // plugin returned instance of a rcube_addressbook 
     
    322322    } 
    323323 
    324     $plugin = $this->plugins->exec_hook('address_sources', array('sources' => $list)); 
     324    $plugin = $this->plugins->exec_hook('addressbooks_list', array('sources' => $list)); 
    325325    $list = $plugin['sources']; 
    326326 
     
    929929  public function kill_session() 
    930930  { 
    931     $this->plugins->exec_hook('kill_session'); 
     931    $this->plugins->exec_hook('session_destroy'); 
    932932 
    933933    $this->session->remove(); 
  • program/include/rcube_imap.php

    rc51304d re6ce006  
    25902590 
    25912591        // Give plugins a chance to provide a list of mailboxes 
    2592         $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes', 
     2592        $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', 
    25932593            array('root' => $root, 'filter' => $filter, 'mode' => 'LSUB')); 
    25942594 
     
    26212621    { 
    26222622        // Give plugins a chance to provide a list of mailboxes 
    2623         $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes', 
     2623        $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', 
    26242624            array('root' => $root, 'filter' => $filter, 'mode' => 'LIST')); 
    26252625 
  • program/include/rcube_plugin_api.php

    rd5d9680 re6ce006  
    4343  private $required_plugins = array('filesystem_attachments'); 
    4444  private $active_hook = false; 
     45 
     46  // Deprecated names of hooks, will be removed after 0.5-stable release 
     47  private $deprecated_hooks = array( 
     48    'create_user'       => 'user_create', 
     49    'kill_session'      => 'session_destroy', 
     50    'upload_attachment' => 'attachment_upload', 
     51    'save_attachment'   => 'attachment_save', 
     52    'get_attachment'    => 'attachment_get', 
     53    'cleanup_attachments' => 'attachments_cleanup', 
     54    'display_attachment' => 'attachment_display', 
     55    'remove_attachment' => 'attachment_delete', 
     56    'outgoing_message_headers' => 'message_outgoing_headers', 
     57    'outgoing_message_body' => 'message_outgoing_body', 
     58    'address_sources'   => 'addressbooks_list', 
     59    'get_address_book'  => 'addressbook_get', 
     60    'create_contact'    => 'contact_create', 
     61    'save_contact'      => 'contact_save', 
     62    'delete_contact'    => 'contact_delete', 
     63    'manage_folders'    => 'folders_list', 
     64    'list_mailboxes'    => 'mailboxes_list', 
     65    'save_preferences'  => 'preferences_save', 
     66    'user_preferences'  => 'preferences_list', 
     67    'list_prefs_sections' => 'preferences_sections_list', 
     68    'list_identities'   => 'identities_list', 
     69    'create_identity'   => 'identity_create', 
     70    'save_identity'     => 'identity_save', 
     71  ); 
    4572 
    4673  /** 
     
    165192  public function register_hook($hook, $callback) 
    166193  { 
    167     if (is_callable($callback)) 
     194    if (is_callable($callback)) { 
     195      if (isset($this->deprecated_hooks[$hook])) { 
     196        /* Uncoment after 0.4-stable release 
     197        raise_error(array('code' => 522, 'type' => 'php', 
     198          'file' => __FILE__, 'line' => __LINE__, 
     199          'message' => "Deprecated hook name. ".$hook.' -> '.$this->deprecated_hooks[$hook]), true, false); 
     200        */ 
     201        $hook = $this->deprecated_hooks[$hook]; 
     202      } 
    168203      $this->handlers[$hook][] = $callback; 
     204    } 
    169205    else 
    170206      raise_error(array('code' => 521, 'type' => 'php', 
  • program/include/rcube_user.php

    r8dfe51e re6ce006  
    386386        } 
    387387 
    388         $data = $rcmail->plugins->exec_hook('create_user', 
     388        $data = $rcmail->plugins->exec_hook('user_create', 
    389389                array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email)); 
    390390 
     
    445445                $record['standard'] = $standard; 
    446446 
    447                 $plugin = $rcmail->plugins->exec_hook('create_identity', 
     447                $plugin = $rcmail->plugins->exec_hook('identity_create', 
    448448                        array('login' => true, 'record' => $record)); 
    449449           
  • program/steps/addressbook/copy.inc

    rb25dfd0 re6ce006  
    3838 
    3939    foreach ($arr_cids as $cid) { 
    40       $plugin = $RCMAIL->plugins->exec_hook('create_contact', array( 
     40      $plugin = $RCMAIL->plugins->exec_hook('contact_create', array( 
    4141        'record' => $CONTACTS->get_record($cid, true), 
    4242        'source' => $target, 
  • program/steps/addressbook/delete.inc

    rb25dfd0 re6ce006  
    2424    preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid) 
    2525) { 
    26   $plugin = $RCMAIL->plugins->exec_hook('delete_contact', array('id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
     26  $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array('id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
    2727 
    2828  $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : false; 
  • program/steps/addressbook/import.inc

    rb25dfd0 re6ce006  
    156156      ); 
    157157       
    158       $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $a_record, 'source' => null)); 
     158      $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $a_record, 'source' => null)); 
    159159      $a_record = $plugin['record']; 
    160160 
  • program/steps/addressbook/save.inc

    rb25dfd0 re6ce006  
    5555if (!empty($cid)) 
    5656{ 
    57   $plugin = $RCMAIL->plugins->exec_hook('save_contact', array('id' => $cid, 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
     57  $plugin = $RCMAIL->plugins->exec_hook('contact_save', array('id' => $cid, 'record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
    5858  $a_record = $plugin['record']; 
    5959   
     
    103103  } 
    104104 
    105   $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
     105  $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $a_record, 'source' => get_input_value('_source', RCUBE_INPUT_GPC))); 
    106106  $a_record = $plugin['record']; 
    107107 
  • program/steps/mail/addcontact.inc

    rb25dfd0 re6ce006  
    4848    else 
    4949    { 
    50       $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $contact, 'source' => null)); 
     50      $plugin = $RCMAIL->plugins->exec_hook('contact_create', array('record' => $contact, 'source' => null)); 
    5151      $contact = $plugin['record']; 
    5252 
  • program/steps/mail/attachments.inc

    rb25dfd0 re6ce006  
    3333    $id = $regs[1]; 
    3434  if ($attachment = $_SESSION['compose']['attachments'][$id]) 
    35     $attachment = $RCMAIL->plugins->exec_hook('remove_attachment', $attachment); 
     35    $attachment = $RCMAIL->plugins->exec_hook('attachment_delete', $attachment); 
    3636  if ($attachment['status']) { 
    3737    if (is_array($_SESSION['compose']['attachments'][$id])) { 
     
    5151    $id = $regs[1]; 
    5252  if ($attachment = $_SESSION['compose']['attachments'][$id]) 
    53     $attachment = $RCMAIL->plugins->exec_hook('display_attachment', $attachment); 
     53    $attachment = $RCMAIL->plugins->exec_hook('attachment_display', $attachment); 
    5454     
    5555  if ($attachment['status']) { 
     
    8888    ); 
    8989 
    90     $attachment = $RCMAIL->plugins->exec_hook('upload_attachment', $attachment); 
     90    $attachment = $RCMAIL->plugins->exec_hook('attachment_upload', $attachment); 
    9191 
    9292    if ($attachment['status'] && !$attachment['abort']) { 
  • program/steps/mail/compose.inc

    r90e7080 re6ce006  
    8282      // save attachment if valid 
    8383      if (($attachment['data'] && $attachment['name']) || ($attachment['path'] && file_exists($attachment['path']))) { 
    84         $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 
     84        $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); 
    8585      } 
    8686       
     
    830830  ); 
    831831 
    832   $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 
     832  $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); 
    833833 
    834834  if ($attachment['status']) { 
     
    854854  ); 
    855855 
    856   $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 
     856  $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); 
    857857 
    858858  if ($attachment['status']) { 
  • program/steps/mail/func.inc

    rdb1f1e3 re6ce006  
    13261326 
    13271327  $rcmail = rcmail::get_instance(); 
    1328   $rcmail->plugins->exec_hook('cleanup_attachments',array()); 
     1328  $rcmail->plugins->exec_hook('attachments_cleanup', array()); 
    13291329  $rcmail->session->remove('compose'); 
    13301330  } 
  • program/steps/mail/sendmail.inc

    rb25dfd0 re6ce006  
    359359 
    360360// exec hook for header checking and manipulation 
    361 $data = $RCMAIL->plugins->exec_hook('outgoing_message_headers', array('headers' => $headers)); 
     361$data = $RCMAIL->plugins->exec_hook('message_outgoing_headers', array('headers' => $headers)); 
    362362 
    363363// sending aborted by plugin 
     
    429429 
    430430if ($isHtml) { 
    431   $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', 
     431  $plugin = $RCMAIL->plugins->exec_hook('message_outgoing_body', 
    432432    array('body' => $message_body, 'type' => 'html', 'message' => $MAIL_MIME)); 
    433433 
     
    447447  } 
    448448 
    449   $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', 
     449  $plugin = $RCMAIL->plugins->exec_hook('message_outgoing_body', 
    450450    array('body' => $plainTextPart, 'type' => 'alternative', 'message' => $MAIL_MIME)); 
    451451 
     
    457457} 
    458458else { 
    459   $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', 
     459  $plugin = $RCMAIL->plugins->exec_hook('message_outgoing_body', 
    460460    array('body' => $message_body, 'type' => 'plain', 'message' => $MAIL_MIME)); 
    461461 
     
    482482  foreach ($_SESSION['compose']['attachments'] as $id => $attachment) { 
    483483    // This hook retrieves the attachment contents from the file storage backend 
    484     $attachment = $RCMAIL->plugins->exec_hook('get_attachment', $attachment); 
     484    $attachment = $RCMAIL->plugins->exec_hook('attachment_get', $attachment); 
    485485 
    486486    $dispurl = '/\ssrc\s*=\s*[\'"]*\S+display-attachment\S+file=rcmfile' . preg_quote($attachment['id']) . '[\s\'"]*/'; 
  • program/steps/settings/func.inc

    rb25dfd0 re6ce006  
    7676 
    7777  // get all identites from DB and define list of cols to be displayed 
    78   $plugin = $RCMAIL->plugins->exec_hook('list_identities', array( 
     78  $plugin = $RCMAIL->plugins->exec_hook('identities_list', array( 
    7979    'list' => $list, 
    8080    'cols' => array('mail'))); 
     
    132132 
    133133  // hook + define list cols 
    134   $plugin = $RCMAIL->plugins->exec_hook('list_prefs_sections', 
     134  $plugin = $RCMAIL->plugins->exec_hook('preferences_sections_list', 
    135135        array('list' => $sections, 'cols' => array('section'))); 
    136136 
     
    677677    } 
    678678 
    679     $data = $RCMAIL->plugins->exec_hook('user_preferences', array('section' => $sect['id'], 'blocks' => $blocks)); 
     679    $data = $RCMAIL->plugins->exec_hook('preferences_list', array('section' => $sect['id'], 'blocks' => $blocks)); 
    680680    $found = false; 
    681681     
  • program/steps/settings/manage_folders.inc

    rb25dfd0 re6ce006  
    313313  } 
    314314 
    315   rcmail::get_instance()->plugins->exec_hook('manage_folders', array('table'=>$table)); 
     315  rcmail::get_instance()->plugins->exec_hook('folders_list', array('table'=>$table)); 
    316316 
    317317  $OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); 
  • program/steps/settings/save_identity.inc

    rb25dfd0 re6ce006  
    6262{ 
    6363  $iid = get_input_value('_iid', RCUBE_INPUT_POST); 
    64   $plugin = $RCMAIL->plugins->exec_hook('save_identity', array('id' => $iid, 'record' => $save_data)); 
     64  $plugin = $RCMAIL->plugins->exec_hook('identity_save', array('id' => $iid, 'record' => $save_data)); 
    6565  $save_data = $plugin['record']; 
    6666 
     
    9393    $save_data['email'] = $RCMAIL->user->get_username(); 
    9494 
    95   $plugin = $RCMAIL->plugins->exec_hook('create_identity', array('record' => $save_data)); 
     95  $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data)); 
    9696  $save_data = $plugin['record']; 
    9797 
  • program/steps/settings/save_prefs.inc

    rb25dfd0 re6ce006  
    9696} 
    9797 
    98 $data = rcmail::get_instance()->plugins->exec_hook('save_preferences', 
     98$data = rcmail::get_instance()->plugins->exec_hook('preferences_save', 
    9999  array('prefs' => $a_user_prefs, 'section' => $CURR_SECTION)); 
    100100 
Note: See TracChangeset for help on using the changeset viewer.