Changeset 2682 in subversion


Ignore:
Timestamp:
Jun 27, 2009 10:28:04 AM (4 years ago)
Author:
alec
Message:
  • make private methods really private
  • rename _mod_mailbox() to mod_mailbox() and make it public
File:
1 edited

Legend:

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

    r2680 r2682  
    255255  function set_mailbox($new_mbox) 
    256256    { 
    257     $mailbox = $this->_mod_mailbox($new_mbox); 
     257    $mailbox = $this->mod_mailbox($new_mbox); 
    258258 
    259259    if ($this->mailbox == $mailbox) 
     
    331331  function get_mailbox_name() 
    332332    { 
    333     return $this->conn ? $this->_mod_mailbox($this->mailbox, 'out') : ''; 
     333    return $this->conn ? $this->mod_mailbox($this->mailbox, 'out') : ''; 
    334334    } 
    335335 
     
    399399    foreach ($a_mboxes as $mbox_row) 
    400400      { 
    401       $name = $this->_mod_mailbox($mbox_row, 'out'); 
     401      $name = $this->mod_mailbox($mbox_row, 'out'); 
    402402      if (strlen($name)) 
    403403        $a_out[] = $name; 
     
    422422   * @access  private 
    423423   */ 
    424   function _list_mailboxes($root='', $filter='*') 
     424  private function _list_mailboxes($root='', $filter='*') 
    425425    { 
    426426    $a_defaults = $a_out = array(); 
     
    438438    else{ 
    439439        // retrieve list of folders from IMAP server 
    440         $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); 
     440        $a_folders = iil_C_ListSubscribed($this->conn, $this->mod_mailbox($root), $filter); 
    441441    } 
    442442 
     
    463463  function messagecount($mbox_name='', $mode='ALL', $force=FALSE) 
    464464    { 
    465     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     465    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    466466    return $this->_messagecount($mailbox, $mode, $force); 
    467467    } 
     
    474474   * @see     rcube_imap::messagecount() 
    475475   */ 
    476   function _messagecount($mailbox='', $mode='ALL', $force=FALSE) 
     476  private function _messagecount($mailbox='', $mode='ALL', $force=FALSE) 
    477477    { 
    478478    $a_mailbox_cache = FALSE; 
     
    543543  function list_headers($mbox_name='', $page=NULL, $sort_field=NULL, $sort_order=NULL) 
    544544    { 
    545     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     545    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    546546    return $this->_list_headers($mailbox, $page, $sort_field, $sort_order); 
    547547    } 
     
    554554   * @see     rcube_imap::list_headers 
    555555   */ 
    556   function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE) 
     556  private function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE) 
    557557    { 
    558558    if (!strlen($mailbox)) 
     
    646646   * @see     rcube_imap::list_header_set() 
    647647   */ 
    648   function _list_header_set($mailbox, $page=NULL, $sort_field=NULL, $sort_order=NULL) 
     648  private function _list_header_set($mailbox, $page=NULL, $sort_field=NULL, $sort_order=NULL) 
    649649    { 
    650650    if (!strlen($mailbox) || empty($this->search_set)) 
     
    732732   * @access private 
    733733   */ 
    734   function _get_message_range($max, $page) 
     734  private function _get_message_range($max, $page) 
    735735    { 
    736736    $start_msg = ($page-1) * $this->page_size; 
     
    771771   * @access private 
    772772   */ 
    773   function _fetch_headers($mailbox, $msgs, &$a_msg_headers, $cache_key) 
     773  private function _fetch_headers($mailbox, $msgs, &$a_msg_headers, $cache_key) 
    774774    { 
    775775    // fetch reqested headers from server 
     
    818818    $this->_set_sort_order($sort_field, $sort_order); 
    819819 
    820     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     820    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    821821    $key = "{$mailbox}:{$this->sort_field}:{$this->sort_order}:{$this->search_string}.msgi"; 
    822822 
     
    959959      return false; 
    960960     
    961     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     961    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    962962 
    963963    $results = $this->_search_index($mailbox, $str, $charset, $sort_field); 
     
    10021002   * @see rcube_imap::search() 
    10031003   */ 
    1004   function _search_index($mailbox, $criteria='ALL', $charset=NULL, $sort_field=NULL) 
     1004  private function _search_index($mailbox, $criteria='ALL', $charset=NULL, $sort_field=NULL) 
    10051005    { 
    10061006    $orig_criteria = $criteria; 
     
    10731073  function get_headers($id, $mbox_name=NULL, $is_uid=TRUE, $bodystr=FALSE) 
    10741074    { 
    1075     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     1075    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    10761076    $uid = $is_uid ? $id : $this->_id2uid($id); 
    10771077 
     
    12881288   * @param  string Part's raw headers 
    12891289   */ 
    1290   function _set_part_filename(&$part, $headers=null) 
     1290  private function _set_part_filename(&$part, $headers=null) 
    12911291    { 
    12921292    if (!empty($part->d_parameters['filename'])) 
     
    15321532  function set_flag($uids, $flag, $mbox_name=NULL) 
    15331533    { 
    1534     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     1534    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    15351535 
    15361536    $flag = strtoupper($flag); 
     
    15821582  function save_message($mbox_name, &$message) 
    15831583    { 
    1584     $mailbox = $this->_mod_mailbox($mbox_name); 
     1584    $mailbox = $this->mod_mailbox($mbox_name); 
    15851585 
    15861586    // make sure mailbox exists 
     
    16081608  function move_message($uids, $to_mbox, $from_mbox='') 
    16091609    { 
    1610     $to_mbox = $this->_mod_mailbox($to_mbox); 
    1611     $from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox; 
     1610    $to_mbox = $this->mod_mailbox($to_mbox); 
     1611    $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
    16121612 
    16131613    // make sure mailbox exists 
     
    16681668  function delete_message($uids, $mbox_name='') 
    16691669    { 
    1670     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     1670    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    16711671 
    16721672    // convert the list of uids to array 
     
    17141714  function clear_mailbox($mbox_name=NULL) 
    17151715    { 
    1716     $mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     1716    $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    17171717    $msg_count = $this->_messagecount($mailbox, 'ALL'); 
    17181718     
     
    17461746  function expunge($mbox_name='', $clear_cache=TRUE) 
    17471747    { 
    1748     $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     1748    $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    17491749    return $this->_expunge($mailbox, $clear_cache); 
    17501750    } 
     
    17611761   * @access private 
    17621762   */ 
    1763   function _expunge($mailbox, $clear_cache=TRUE, $uids=NULL) 
     1763  private function _expunge($mailbox, $clear_cache=TRUE, $uids=NULL) 
    17641764    { 
    17651765    if ($uids && $this->get_capability('UIDPLUS'))  
     
    17991799       
    18001800    // retrieve list of folders from IMAP server 
    1801     $a_mboxes = iil_C_ListMailboxes($this->conn, $this->_mod_mailbox($root), '*'); 
     1801    $a_mboxes = iil_C_ListMailboxes($this->conn, $this->mod_mailbox($root), '*'); 
    18021802 
    18031803    // modify names with root dir 
    18041804    foreach ($a_mboxes as $mbox_name) 
    18051805      { 
    1806       $name = $this->_mod_mailbox($mbox_name, 'out'); 
     1806      $name = $this->mod_mailbox($mbox_name, 'out'); 
    18071807      if (strlen($name)) 
    18081808        $a_folders[] = $name; 
     
    18761876    $name = substr($name, 0, 100); 
    18771877 
    1878     $abs_name = $this->_mod_mailbox($name); 
     1878    $abs_name = $this->mod_mailbox($name); 
    18791879    $a_mailbox_cache = $this->get_cache('mailboxes'); 
    18801880 
     
    19051905 
    19061906    // make absolute path 
    1907     $mailbox = $this->_mod_mailbox($mbox_name); 
    1908     $abs_name = $this->_mod_mailbox($name); 
     1907    $mailbox = $this->mod_mailbox($mbox_name); 
     1908    $abs_name = $this->mod_mailbox($name); 
    19091909     
    19101910    // check if mailbox is subscribed 
     
    19591959      $a_mboxes = explode(',', $mbox_name); 
    19601960 
    1961     $all_mboxes = iil_C_ListMailboxes($this->conn, $this->_mod_mailbox($root), '*'); 
     1961    $all_mboxes = iil_C_ListMailboxes($this->conn, $this->mod_mailbox($root), '*'); 
    19621962 
    19631963    if (is_array($a_mboxes)) 
    19641964      foreach ($a_mboxes as $mbox_name) 
    19651965        { 
    1966         $mailbox = $this->_mod_mailbox($mbox_name); 
     1966        $mailbox = $this->mod_mailbox($mbox_name); 
    19671967 
    19681968        // unsubscribe mailbox before deleting 
     
    20052005  function create_default_folders() 
    20062006    { 
    2007     $a_folders = iil_C_ListMailboxes($this->conn, $this->_mod_mailbox(''), '*'); 
    2008     $a_subscribed = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox(''), '*'); 
     2007    $a_folders = iil_C_ListMailboxes($this->conn, $this->mod_mailbox(''), '*'); 
     2008    $a_subscribed = iil_C_ListSubscribed($this->conn, $this->mod_mailbox(''), '*'); 
    20092009     
    20102010    // create default folders if they do not exist 
    20112011    foreach ($this->default_folders as $folder) 
    20122012      { 
    2013       $abs_name = $this->_mod_mailbox($folder); 
     2013      $abs_name = $this->mod_mailbox($folder); 
    20142014      if (!in_array_nocase($abs_name, $a_folders)) 
    20152015        $this->create_mailbox($folder, TRUE); 
     
    21032103   * @access private 
    21042104   */ 
    2105   function _read_cache_record($key) 
     2105  private function _read_cache_record($key) 
    21062106    { 
    21072107    if ($this->db) 
     
    21292129   * @access private 
    21302130   */ 
    2131   function _write_cache_record($key, $data) 
     2131  private function _write_cache_record($key, $data) 
    21322132    { 
    21332133    if (!$this->db) 
     
    21792179   * @access private 
    21802180   */ 
    2181   function _clear_cache_record($key) 
     2181  private function _clear_cache_record($key) 
    21822182    { 
    21832183    $this->db->query( 
     
    26322632   * @access private 
    26332633   */ 
    2634   function _decode_mime_string_part($str) 
     2634  private function _decode_mime_string_part($str) 
    26352635    { 
    26362636    $a = explode('?', $str); 
     
    26642664   * @param string Part encoding 
    26652665   * @return string Decoded string 
    2666    * @access private 
    26672666   */ 
    26682667  function mime_decode($input, $encoding='7bit') 
     
    27182717  function get_id($uid, $mbox_name=NULL)  
    27192718    { 
    2720       $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     2719      $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    27212720      return $this->_uid2id($uid, $mailbox); 
    27222721    } 
     
    27322731  function get_uid($id,$mbox_name=NULL) 
    27332732    { 
    2734       $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 
     2733      $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    27352734      return $this->_id2uid($id, $mailbox); 
    27362735    } 
    27372736 
    27382737 
    2739  
    2740   /* -------------------------------- 
    2741    *         private methods 
    2742    * --------------------------------*/ 
    2743  
    2744  
    2745   /** 
    2746    * @access private 
    2747    */ 
    2748   function _mod_mailbox($mbox_name, $mode='in') 
     2738  /** 
     2739   * Modify folder name for input/output according to root dir and namespace 
     2740   * 
     2741   * @param string  Folder name 
     2742   * @param string  Mode 
     2743   * @return string Folder name 
     2744   */ 
     2745  function mod_mailbox($mbox_name, $mode='in') 
    27492746    { 
    27502747    if ((!empty($this->root_ns) && $this->root_ns == $mbox_name) || $mbox_name == 'INBOX') 
     
    27592756    } 
    27602757 
     2758 
     2759  /* -------------------------------- 
     2760   *         private methods 
     2761   * --------------------------------*/ 
     2762 
    27612763  /** 
    27622764   * Validate the given input and save to local properties 
    27632765   * @access private 
    27642766   */ 
    2765   function _set_sort_order($sort_field, $sort_order) 
     2767  private function _set_sort_order($sort_field, $sort_order) 
    27662768  { 
    27672769    if ($sort_field != null) 
     
    27752777   * @access private 
    27762778   */ 
    2777   function _sort_mailbox_list($a_folders) 
     2779  private function _sort_mailbox_list($a_folders) 
    27782780    { 
    27792781    $a_out = $a_defaults = $folders = array(); 
     
    28162818   * @access private 
    28172819   */ 
    2818   function _rsort($folder, $delimiter, &$list, &$out) 
     2820  private function _rsort($folder, $delimiter, &$list, &$out) 
    28192821    { 
    28202822      while (list($key, $name) = each($list)) { 
     
    28332835   * @access private 
    28342836   */ 
    2835   function _uid2id($uid, $mbox_name=NULL) 
     2837  private function _uid2id($uid, $mbox_name=NULL) 
    28362838    { 
    28372839    if (!$mbox_name) 
     
    28472849   * @access private 
    28482850   */ 
    2849   function _id2uid($id, $mbox_name=NULL) 
     2851  private function _id2uid($id, $mbox_name=NULL) 
    28502852    { 
    28512853    if (!$mbox_name) 
     
    28692871   * @access private 
    28702872   */ 
    2871   function _change_subscription($a_mboxes, $mode) 
     2873  private function _change_subscription($a_mboxes, $mode) 
    28722874    { 
    28732875    $updated = FALSE; 
     
    28762878      foreach ($a_mboxes as $i => $mbox_name) 
    28772879        { 
    2878         $mailbox = $this->_mod_mailbox($mbox_name); 
     2880        $mailbox = $this->mod_mailbox($mbox_name); 
    28792881        $a_mboxes[$i] = $mailbox; 
    28802882 
     
    29132915   * @access private 
    29142916   */ 
    2915   function _set_messagecount($mbox_name, $mode, $increment) 
     2917  private function _set_messagecount($mbox_name, $mode, $increment) 
    29162918    { 
    29172919    $a_mailbox_cache = FALSE; 
     
    29422944   * @access private 
    29432945   */ 
    2944   function _clear_messagecount($mbox_name='') 
     2946  private function _clear_messagecount($mbox_name='') 
    29452947    { 
    29462948    $a_mailbox_cache = FALSE; 
     
    29612963   * @access private 
    29622964   */ 
    2963   function _parse_headers($headers) 
     2965  private function _parse_headers($headers) 
    29642966    { 
    29652967    $a_headers = array(); 
     
    29842986   * @access private 
    29852987   */ 
    2986   function _parse_address_list($str, $decode=true) 
     2988  private function _parse_address_list($str, $decode=true) 
    29872989    { 
    29882990    // remove any newlines and carriage returns before 
Note: See TracChangeset for help on using the changeset viewer.