Dotclear


Ignore:
Timestamp:
09/14/18 12:16:17 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

short notation for array (array() → [])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.meta.php

    r3733 r3874  
    4242    public function splitMetaValues($str) 
    4343    { 
    44         $res = array(); 
     44        $res = []; 
    4545        foreach (explode(',', $str) as $i => $tag) { 
    4646            $tag = trim($tag); 
     
    8080 
    8181        if (!is_array($meta)) { 
    82             return array(); 
     82            return []; 
    8383        } 
    8484 
     
    118118    { 
    119119        $meta = $this->getMetaArray($str); 
    120         $data = array(); 
     120        $data = []; 
    121121 
    122122        if (isset($meta[$type])) { 
    123123            foreach ($meta[$type] as $v) { 
    124                 $data[] = array( 
     124                $data[] = [ 
    125125                    'meta_id'       => $v, 
    126126                    'meta_type'     => $type, 
     
    129129                    'percent'       => 0, 
    130130                    'roundpercent'  => 0 
    131                 ); 
     131                ]; 
    132132            } 
    133133        } 
     
    191191        $rs = $this->con->select($strReq); 
    192192 
    193         $meta = array(); 
     193        $meta = []; 
    194194        while ($rs->fetch()) { 
    195195            $meta[$rs->meta_type][] = $rs->meta_id; 
     
    216216    @return    <b>record</b>    the resulting posts record 
    217217     */ 
    218     public function getPostsByMeta($params = array(), $count_only = false) 
     218    public function getPostsByMeta($params = [], $count_only = false) 
    219219    { 
    220220        if (!isset($params['meta_id'])) { 
     
    248248    @return    <b>record</b>    the resulting comments record 
    249249     */ 
    250     public function getCommentsByMeta($params = array(), $count_only = false) 
     250    public function getCommentsByMeta($params = [], $count_only = false) 
    251251    { 
    252252        if (!isset($params['meta_id'])) { 
     
    282282    public function getMeta($type = null, $limit = null, $meta_id = null, $post_id = null) 
    283283    { 
    284         $params = array(); 
     284        $params = []; 
    285285 
    286286        if ($type != null) { 
     
    320320    @return    <b>record</b>    the resulting comments record 
    321321     */ 
    322     public function getMetadata($params = array(), $count_only = false) 
     322    public function getMetadata($params = [], $count_only = false) 
    323323    { 
    324324        if ($count_only) { 
     
    390390        $rs_static = $rs->toStatic(); 
    391391 
    392         $max = array(); 
     392        $max = []; 
    393393        while ($rs_static->fetch()) { 
    394394            $type = $rs_static->meta_type; 
     
    513513        } 
    514514 
    515         $to_update = $to_remove = array(); 
     515        $to_update = $to_remove = []; 
    516516 
    517517        $rs = $this->con->select(sprintf($getReq, $this->con->escape($meta_id), 
     
    587587 
    588588        if ($rs->isEmpty()) { 
    589             return array(); 
    590         } 
    591  
    592         $ids = array(); 
     589            return []; 
     590        } 
     591 
     592        $ids = []; 
    593593        while ($rs->fetch()) { 
    594594            $ids[] = $rs->post_id; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map