Changeset 5766 in subversion


Ignore:
Timestamp:
Jan 13, 2012 4:25:11 AM (17 months ago)
Author:
alec
Message:
  • CS fixes on method names in rcube_result_*
Location:
branches/devel-framework/roundcubemail/program
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-framework/roundcubemail/program/include/rcube_imap.php

    r5765 r5766  
    546546        if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS') && !$force) { 
    547547            if ($mode == 'ALL') { 
    548                 return $this->search_set->countMessages(); 
     548                return $this->search_set->count_messages(); 
    549549            } 
    550550            else { 
     
    569569 
    570570            if ($status) { 
    571                 $msg_count = $res->countMessages(); 
     571                $msg_count = $res->count_messages(); 
    572572                $this->set_folder_stats($folder, 'cnt', $msg_count); 
    573573                $this->set_folder_stats($folder, 'maxuid', $msg_count ? $this->id2uid($msg_count, $folder) : 0); 
     
    692692        $index = $this->index($folder, $this->sort_field, $this->sort_order); 
    693693 
    694         if ($index->isEmpty()) { 
     694        if ($index->is_empty()) { 
    695695            return array(); 
    696696        } 
     
    820820        $parents = array(); 
    821821 
    822         list ($msg_depth, $msg_children) = $threads->getThreadData(); 
     822        list ($msg_depth, $msg_children) = $threads->get_thread_data(); 
    823823 
    824824        foreach ($headers as $uid => $header) { 
     
    850850    protected function list_search_messages($folder, $page, $slice=0) 
    851851    { 
    852         if (!strlen($folder) || empty($this->search_set) || $this->search_set->isEmpty()) { 
     852        if (!strlen($folder) || empty($this->search_set) || $this->search_set->is_empty()) { 
    853853            return array(); 
    854854        } 
     
    869869 
    870870        // return empty array if no messages found 
    871         if ($index->isEmpty()) { 
     871        if ($index->is_empty()) { 
    872872            return array(); 
    873873        } 
     
    887887 
    888888                // return empty array if no messages found 
    889                 if ($index->isEmpty()) { 
     889                if ($index->is_empty()) { 
    890890                    return array(); 
    891891                } 
     
    894894 
    895895        if ($got_index) { 
    896             if ($this->sort_order != $index->getParameters('ORDER')) { 
     896            if ($this->sort_order != $index->get_parameters('ORDER')) { 
    897897                $index->revert(); 
    898898            } 
     
    977977        // update search_set if previous data was fetched with disabled threading 
    978978        if (!$this->search_threads) { 
    979             if ($this->search_set->isEmpty()) { 
     979            if ($this->search_set->is_empty()) { 
    980980                return array(); 
    981981            } 
     
    11511151            } 
    11521152 
    1153             if ($this->sort_order != $index->getParameters('ORDER')) { 
     1153            if ($this->sort_order != $index->get_parameters('ORDER')) { 
    11541154                $index->revert(); 
    11551155            } 
     
    11911191        else if (!$sort_field) { 
    11921192            if ($this->options['skip_deleted'] && !empty($this->icache['undeleted_idx']) 
    1193                 && $this->icache['undeleted_idx']->getParameters('MAILBOX') == $folder 
     1193                && $this->icache['undeleted_idx']->get_parameters('MAILBOX') == $folder 
    11941194            ) { 
    11951195                $index = $this->icache['undeleted_idx']; 
     
    12131213            } 
    12141214 
    1215             if (empty($index) || $index->isError()) { 
     1215            if (empty($index) || $index->is_error()) { 
    12161216                $index = $this->conn->index($folder, "1:*", $sort_field, 
    12171217                    $this->options['skip_deleted'], false, true); 
     
    12191219        } 
    12201220 
    1221         if ($sort_order != $index->getParameters('ORDER')) { 
     1221        if ($sort_order != $index->get_parameters('ORDER')) { 
    12221222            $index->revert(); 
    12231223        } 
     
    12651265    protected function sort_threads($threads) 
    12661266    { 
    1267         if ($threads->isEmpty()) { 
     1267        if ($threads->is_empty()) { 
    12681268            return; 
    12691269        } 
     
    12761276            $index = $this->index_direct($this->folder, $this->sort_field, $this->sort_order, false); 
    12771277 
    1278             if (!$index->isEmpty()) { 
     1278            if (!$index->is_empty()) { 
    12791279                $threads->sort($index); 
    12801280            } 
    12811281        } 
    12821282        else { 
    1283             if ($this->sort_order != $threads->getParameters('ORDER')) { 
     1283            if ($this->sort_order != $threads->get_parameters('ORDER')) { 
    12841284                $threads->revert(); 
    12851285            } 
     
    13761376            // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 
    13771377            // but I've seen that Courier doesn't support UTF-8) 
    1378             if ($threads->isError() && $charset && $charset != 'US-ASCII') { 
     1378            if ($threads->is_error() && $charset && $charset != 'US-ASCII') { 
    13791379                $threads = $this->conn->thread($folder, $this->threading, 
    13801380                    $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 
     
    13901390            // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 
    13911391            // but I've seen Courier with disabled UTF-8 support) 
    1392             if ($messages->isError() && $charset && $charset != 'US-ASCII') { 
     1392            if ($messages->is_error() && $charset && $charset != 'US-ASCII') { 
    13931393                $messages = $this->conn->sort($folder, $sort_field, 
    13941394                    $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 
    13951395            } 
    13961396 
    1397             if (!$messages->isError()) { 
     1397            if (!$messages->is_error()) { 
    13981398                $this->search_sorted = true; 
    13991399                return $messages; 
     
    14051405 
    14061406        // Error, try with US-ASCII (some servers may support only US-ASCII) 
    1407         if ($messages->isError() && $charset && $charset != 'US-ASCII') { 
     1407        if ($messages->is_error() && $charset && $charset != 'US-ASCII') { 
    14081408            $messages = $this->conn->search($folder, 
    14091409                $this->convert_criteria($criteria, $charset), true); 
     
    30973097        // add (E)SEARCH result for ALL UNDELETED query 
    30983098        if (!empty($this->icache['undeleted_idx']) 
    3099             && $this->icache['undeleted_idx']->getParameters('MAILBOX') == $folder 
     3099            && $this->icache['undeleted_idx']->get_parameters('MAILBOX') == $folder 
    31003100        ) { 
    31013101            $data['UNDELETED'] = $this->icache['undeleted_idx']; 
  • branches/devel-framework/roundcubemail/program/include/rcube_imap_cache.php

    r5759 r5766  
    136136            else if ($sort_field == 'ANY' || $this->icache[$mailbox]['index']['sort_field'] == $sort_field) { 
    137137                $result = $this->icache[$mailbox]['index']['object']; 
    138                 if ($result->getParameters('ORDER') != $sort_order) { 
     138                if ($result->get_parameters('ORDER') != $sort_order) { 
    139139                    $result->revert(); 
    140140                } 
     
    179179                $data = $index['object']; 
    180180                // revert the order if needed 
    181                 if ($data->getParameters('ORDER') != $sort_order) { 
     181                if ($data->get_parameters('ORDER') != $sort_order) { 
    182182                    $data->revert(); 
    183183                } 
     
    758758        // Folder is empty but cache isn't 
    759759        if (empty($mbox_data['EXISTS'])) { 
    760             if (!$object->isEmpty()) { 
     760            if (!$object->is_empty()) { 
    761761                $this->clear($mailbox); 
    762762                $exists = false; 
     
    765765        } 
    766766        // Folder is not empty but cache is 
    767         else if ($object->isEmpty()) { 
     767        else if ($object->is_empty()) { 
    768768            unset($this->icache[$mailbox][$is_thread ? 'thread' : 'index']); 
    769769            return false; 
     
    797797        if ($is_thread) { 
    798798            // check messages number... 
    799             if (!$this->skip_deleted && $mbox_data['EXISTS'] != $object->countMessages()) { 
     799            if (!$this->skip_deleted && $mbox_data['EXISTS'] != $object->count_messages()) { 
    800800                return false; 
    801801            } 
     
    831831                    rcube_imap_generic::compressMessageSet($object->get())); 
    832832 
    833                 if (!$ids->isEmpty()) { 
     833                if (!$ids->is_empty()) { 
    834834                    return false; 
    835835                } 
     
    10091009 
    10101010        $sort_field = $index['sort_field']; 
    1011         $sort_order = $index['object']->getParameters('ORDER'); 
     1011        $sort_order = $index['object']->get_parameters('ORDER'); 
    10121012        $exists     = true; 
    10131013 
  • branches/devel-framework/roundcubemail/program/include/rcube_result_index.php

    r5622 r5766  
    2828class rcube_result_index 
    2929{ 
    30     private $raw_data; 
    31     private $mailbox; 
    32     private $meta = array(); 
    33     private $params = array(); 
    34     private $order = 'ASC'; 
     30    protected $raw_data; 
     31    protected $mailbox; 
     32    protected $meta = array(); 
     33    protected $params = array(); 
     34    protected $order = 'ASC'; 
    3535 
    3636    const SEPARATOR_ELEMENT = ' '; 
     
    127127     * @return bool True if the result is an error, False otherwise 
    128128     */ 
    129     public function isError() 
     129    public function is_error() 
    130130    { 
    131131        return $this->raw_data === null ? true : false; 
     
    138138     * @return bool True if the result is empty, False otherwise 
    139139     */ 
    140     public function isEmpty() 
     140    public function is_empty() 
    141141    { 
    142142        return empty($this->raw_data) ? true : false; 
     
    172172     * @return int Number of elements 
    173173     */ 
    174     public function countMessages() 
     174    public function count_messages() 
    175175    { 
    176176        return $this->count(); 
     
    306306                    $idx = 1 + substr_count($this->raw_data, self::SEPARATOR_ELEMENT, 0, $m[0][1]); 
    307307                } 
    308                 // cache position of this element, so we can use it in getElement() 
     308                // cache position of this element, so we can use it in get_element() 
    309309                $this->meta['pos'][$idx] = (int)$m[0][1]; 
    310310 
     
    337337     * @return array List of message IDs 
    338338     */ 
    339     public function getCompressed() 
     339    public function get_compressed() 
    340340    { 
    341341        if (empty($this->raw_data)) { 
     
    354354     * @return int Element value 
    355355     */ 
    356     public function getElement($index) 
     356    public function get_element($index) 
    357357    { 
    358358        $count = $this->count(); 
     
    415415     * @return array|string Response parameters or parameter value 
    416416     */ 
    417     public function getParameters($param=null) 
     417    public function get_parameters($param=null) 
    418418    { 
    419419        $params = $this->params; 
     
    434434     * @return int Data length 
    435435     */ 
    436     private function length() 
     436    protected function length() 
    437437    { 
    438438        if (!isset($this->meta['length'])) { 
  • branches/devel-framework/roundcubemail/program/include/rcube_result_thread.php

    r5622 r5766  
    2828class rcube_result_thread 
    2929{ 
    30     private $raw_data; 
    31     private $mailbox; 
    32     private $meta = array(); 
    33     private $order = 'ASC'; 
     30    protected $raw_data; 
     31    protected $mailbox; 
     32    protected $meta = array(); 
     33    protected $order = 'ASC'; 
    3434 
    3535    const SEPARATOR_ELEMENT = ' '; 
     
    7878        $data = preg_replace('/\s+/', ' ', $data); 
    7979 
    80         $this->raw_data = $this->parseThread($data); 
     80        $this->raw_data = $this->parse_thread($data); 
    8181    } 
    8282 
     
    8787     * @return bool True if the result is an error, False otherwise 
    8888     */ 
    89     public function isError() 
     89    public function is_error() 
    9090    { 
    9191        return $this->raw_data === null ? true : false; 
     
    9898     * @return bool True if the result is empty, False otherwise 
    9999     */ 
    100     public function isEmpty() 
     100    public function is_empty() 
    101101    { 
    102102        return empty($this->raw_data) ? true : false; 
     
    133133     * @return int Number of elements 
    134134     */ 
    135     public function countMessages() 
     135    public function count_messages() 
    136136    { 
    137137        if ($this->meta['messages'] !== null) 
     
    301301                        + substr_count($this->raw_data, self::SEPARATOR_ITEM, 0, $m[0][1]+1); 
    302302                } 
    303                 // cache position of this element, so we can use it in getElement() 
     303                // cache position of this element, so we can use it in get_element() 
    304304                $this->meta['pos'][$idx] = (int)$m[0][1]; 
    305305 
     
    337337     * @return array List of message identifiers 
    338338     */ 
    339     public function getCompressed() 
     339    public function get_compressed() 
    340340    { 
    341341        if (empty($this->raw_data)) { 
     
    354354     * @return int Element value 
    355355     */ 
    356     public function getElement($index) 
     356    public function get_element($index) 
    357357    { 
    358358        $count = $this->count(); 
     
    424424     * @return array|string Response parameters or parameter value 
    425425     */ 
    426     public function getParameters($param=null) 
     426    public function get_parameters($param=null) 
    427427    { 
    428428        $params = $this->params; 
     
    445445    public function sort($index) 
    446446    { 
    447         $this->sort_order = $index->getParameters('ORDER'); 
     447        $this->sort_order = $index->get_parameters('ORDER'); 
    448448 
    449449        if (empty($this->raw_data)) { 
     
    452452 
    453453        // when sorting search result it's good to make the index smaller 
    454         if ($index->count() != $this->countMessages()) { 
     454        if ($index->count() != $this->count_messages()) { 
    455455            $index->intersect($this->get()); 
    456456        } 
     
    511511     * @return array Data tree 
    512512     */ 
    513     public function getTree() 
     513    public function get_tree() 
    514514    { 
    515515        $datalen = strlen($this->raw_data); 
     
    523523            $elem  = substr($this->raw_data, $start, $len); 
    524524            $items = explode(self::SEPARATOR_ITEM, $elem); 
    525             $result[array_shift($items)] = $this->buildThread($items); 
     525            $result[array_shift($items)] = $this->build_thread($items); 
    526526            $start = $pos + 1; 
    527527        } 
     
    536536     * @return array Thread data 
    537537     */ 
    538     public function getThreadData() 
    539     { 
    540         $data     = $this->getTree(); 
     538    public function get_thread_data() 
     539    { 
     540        $data     = $this->get_tree(); 
    541541        $depth    = array(); 
    542542        $children = array(); 
    543543 
    544         $this->buildThreadData($data, $depth, $children); 
     544        $this->build_thread_data($data, $depth, $children); 
    545545 
    546546        return array($depth, $children); 
     
    551551     * Creates 'depth' and 'children' arrays from stored thread 'tree' data. 
    552552     */ 
    553     private function buildThreadData($data, &$depth, &$children, $level = 0) 
     553    protected function build_thread_data($data, &$depth, &$children, $level = 0) 
    554554    { 
    555555        foreach ((array)$data as $key => $val) { 
     
    557557            $depth[$key] = $level; 
    558558            if (!empty($val)) 
    559                 $this->buildThreadData($val, $depth, $children, $level + 1); 
     559                $this->build_thread_data($val, $depth, $children, $level + 1); 
    560560        } 
    561561    } 
     
    565565     * Converts part of the raw thread into an array 
    566566     */ 
    567     private function buildThread($items, $level = 1, &$pos = 0) 
     567    protected function build_thread($items, $level = 1, &$pos = 0) 
    568568    { 
    569569        $result = array(); 
     
    573573            if ($level == $lv) { 
    574574                $pos++; 
    575                 $result[$id] = $this->buildThread($items, $level+1, $pos); 
     575                $result[$id] = $this->build_thread($items, $level+1, $pos); 
    576576            } 
    577577            else { 
     
    588588     * IMAP THREAD response parser 
    589589     */ 
    590     private function parseThread($str, $begin = 0, $end = 0, $depth = 0) 
     590    protected function parse_thread($str, $begin = 0, $end = 0, $depth = 0) 
    591591    { 
    592592        // Don't be tempted to change $str to pass by reference to speed this up - it will slow it down by about 
     
    626626 
    627627            if ($stop + 1 < $end) { 
    628                 $node .= $this->parseThread($str, $stop + 1, $end, $depth + 1); 
     628                $node .= $this->parse_thread($str, $stop + 1, $end, $depth + 1); 
    629629            } 
    630630        } else { 
     
    651651                } 
    652652 
    653                 $thread = $this->parseThread($str, $start + 1, $off - 1, $depth); 
     653                $thread = $this->parse_thread($str, $start + 1, $off - 1, $depth); 
    654654                if ($thread) { 
    655655                    if (!$depth) { 
  • branches/devel-framework/roundcubemail/program/steps/mail/pagenav.inc

    r5758 r5766  
    2222$uid   = get_input_value('_uid', RCUBE_INPUT_GET); 
    2323$index = $RCMAIL->storage->index(null, $_SESSION['sort_col'], $_SESSION['sort_order']); 
    24 $cnt   = $index->countMessages(); 
     24$cnt   = $index->count_messages(); 
    2525 
    2626if ($cnt && ($pos = $index->exists($uid, true)) !== false) { 
    27     $prev  = $pos ? $index->getElement($pos-1) : 0; 
    28     $first = $pos ? $index->getElement('FIRST') : 0; 
    29     $next  = $pos < $cnt-1 ? $index->getElement($pos+1) : 0; 
    30     $last  = $pos < $cnt-1 ? $index->getElement('LAST') : 0; 
     27    $prev  = $pos ? $index->get_element($pos-1) : 0; 
     28    $first = $pos ? $index->get_element('FIRST') : 0; 
     29    $next  = $pos < $cnt-1 ? $index->get_element($pos+1) : 0; 
     30    $last  = $pos < $cnt-1 ? $index->get_element('LAST') : 0; 
    3131} 
    3232 
Note: See TracChangeset for help on using the changeset viewer.