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.media.php

    r3872 r3874  
    2323    protected $file_sort = 'name-asc'; 
    2424 
    25     protected $file_handler = array(); ///< <b>array</b> Array of callbacks 
     25    protected $file_handler = []; ///< <b>array</b> Array of callbacks 
    2626 
    2727    public $thumb_tp       = '%s/.%s_%s.jpg'; ///< <b>string</b> Thumbnail file pattern 
     
    3535    - sq: square image 
    3636     */ 
    37     public $thumb_sizes = array( 
    38         'm'  => array(448, 'ratio', 'medium'), 
    39         's'  => array(240, 'ratio', 'small'), 
    40         't'  => array(100, 'ratio', 'thumbnail'), 
    41         'sq' => array(48, 'crop', 'square') 
    42     ); 
     37    public $thumb_sizes = [ 
     38        'm'  => [448, 'ratio', 'medium'], 
     39        's'  => [240, 'ratio', 'small'], 
     40        't'  => [100, 'ratio', 'thumbnail'], 
     41        'sq' => [48, 'crop', 'square'] 
     42    ]; 
    4343 
    4444    public $icon_img = 'images/media/%s.png'; ///< <b>string</b> Icon file pattern 
     
    9191 
    9292        # Event handlers 
    93         $this->addFileHandler('image/jpeg', 'create', array($this, 'imageThumbCreate')); 
    94         $this->addFileHandler('image/png', 'create', array($this, 'imageThumbCreate')); 
    95         $this->addFileHandler('image/gif', 'create', array($this, 'imageThumbCreate')); 
    96  
    97         $this->addFileHandler('image/png', 'update', array($this, 'imageThumbUpdate')); 
    98         $this->addFileHandler('image/jpeg', 'update', array($this, 'imageThumbUpdate')); 
    99         $this->addFileHandler('image/gif', 'update', array($this, 'imageThumbUpdate')); 
    100  
    101         $this->addFileHandler('image/png', 'remove', array($this, 'imageThumbRemove')); 
    102         $this->addFileHandler('image/jpeg', 'remove', array($this, 'imageThumbRemove')); 
    103         $this->addFileHandler('image/gif', 'remove', array($this, 'imageThumbRemove')); 
    104  
    105         $this->addFileHandler('image/jpeg', 'create', array($this, 'imageMetaCreate')); 
    106  
    107         $this->addFileHandler('image/jpeg', 'recreate', array($this, 'imageThumbCreate')); 
    108         $this->addFileHandler('image/png', 'recreate', array($this, 'imageThumbCreate')); 
    109         $this->addFileHandler('image/gif', 'recreate', array($this, 'imageThumbCreate')); 
    110  
    111         $this->addFileHandler('image/jpeg', 'recreate', array($this, 'imageThumbCreate')); 
    112         $this->addFileHandler('image/png', 'recreate', array($this, 'imageThumbCreate')); 
    113         $this->addFileHandler('image/gif', 'recreate', array($this, 'imageThumbCreate')); 
     93        $this->addFileHandler('image/jpeg', 'create', [$this, 'imageThumbCreate']); 
     94        $this->addFileHandler('image/png', 'create', [$this, 'imageThumbCreate']); 
     95        $this->addFileHandler('image/gif', 'create', [$this, 'imageThumbCreate']); 
     96 
     97        $this->addFileHandler('image/png', 'update', [$this, 'imageThumbUpdate']); 
     98        $this->addFileHandler('image/jpeg', 'update', [$this, 'imageThumbUpdate']); 
     99        $this->addFileHandler('image/gif', 'update', [$this, 'imageThumbUpdate']); 
     100 
     101        $this->addFileHandler('image/png', 'remove', [$this, 'imageThumbRemove']); 
     102        $this->addFileHandler('image/jpeg', 'remove', [$this, 'imageThumbRemove']); 
     103        $this->addFileHandler('image/gif', 'remove', [$this, 'imageThumbRemove']); 
     104 
     105        $this->addFileHandler('image/jpeg', 'create', [$this, 'imageMetaCreate']); 
     106 
     107        $this->addFileHandler('image/jpeg', 'recreate', [$this, 'imageThumbCreate']); 
     108        $this->addFileHandler('image/png', 'recreate', [$this, 'imageThumbCreate']); 
     109        $this->addFileHandler('image/gif', 'recreate', [$this, 'imageThumbCreate']); 
     110 
     111        $this->addFileHandler('image/jpeg', 'recreate', [$this, 'imageThumbCreate']); 
     112        $this->addFileHandler('image/png', 'recreate', [$this, 'imageThumbCreate']); 
     113        $this->addFileHandler('image/gif', 'recreate', [$this, 'imageThumbCreate']); 
    114114 
    115115        # Thumbnails sizes 
     
    291291 
    292292            # Thumbnails 
    293             $f->media_thumb = array(); 
     293            $f->media_thumb = []; 
    294294            $p              = path::info($f->relname); 
    295295 
     
    331331    public function setFileSort($type = 'name') 
    332332    { 
    333         if (in_array($type, array('name-asc', 'name-desc', 'date-asc', 'date-desc'))) { 
     333        if (in_array($type, ['name-asc', 'name-desc', 'date-asc', 'date-desc'])) { 
    334334            $this->file_sort = $type; 
    335335        } 
     
    402402        parent::getDir(); 
    403403 
    404         $f_res = array(); 
     404        $f_res = []; 
    405405        $p_dir = $this->dir; 
    406406 
     
    414414        } 
    415415 
    416         $f_reg = array(); 
     416        $f_reg = []; 
    417417 
    418418        while ($rs->fetch()) { 
     
    467467        } 
    468468        try { 
    469             usort($this->dir['files'], array($this, 'sortFileHandler')); 
     469            usort($this->dir['files'], [$this, 'sortFileHandler']); 
    470470        } catch (Exception $e) {} 
    471471    } 
     
    532532        $rs = $this->con->select($strReq); 
    533533 
    534         $this->dir = array('dirs' => array(), 'files' => array()); 
    535         $f_res     = array(); 
     534        $this->dir = ['dirs' => [], 'files' => []]; 
     535        $f_res     = []; 
    536536        while ($rs->fetch()) { 
    537537            $fr = $this->fileRecord($rs); 
     
    543543 
    544544        try { 
    545             usort($this->dir['files'], array($this, 'sortFileHandler')); 
     545            usort($this->dir['files'], [$this, 'sortFileHandler']); 
    546546        } catch (Exception $e) {} 
    547547 
     
    560560    public function getPostMedia($post_id, $media_id = null, $link_type = null) 
    561561    { 
    562         $params = array( 
     562        $params = [ 
    563563            'post_id'    => $post_id, 
    564564            'media_path' => $this->path 
    565         ); 
     565        ]; 
    566566        if ($media_id) { 
    567567            $params['media_id'] = (integer) $media_id; 
     
    572572        $rs = $this->postmedia->getPostMedia($params); 
    573573 
    574         $res = array(); 
     574        $res = []; 
    575575 
    576576        while ($rs->fetch()) { 
     
    647647        $delReq = 'DELETE FROM ' . $this->table . ' ' . 
    648648            'WHERE media_id IN (%s) '; 
    649         $del_ids = array(); 
     649        $del_ids = []; 
    650650 
    651651        while ($rs->fetch()) { 
     
    11151115 
    11161116            if (!is_array($args)) { 
    1117                 $args = array( 
     1117                $args = [ 
    11181118                    'showvolume'      => 1, 
    11191119                    'loadingcolor'    => 'ff9900', 
     
    11251125                    'slidercolor2'    => '999999', 
    11261126                    'sliderovercolor' => '0066cc' 
    1127                 ); 
     1127                ]; 
    11281128            } 
    11291129 
     
    11371137            } 
    11381138 
    1139             $vars = array(); 
     1139            $vars = []; 
    11401140            foreach ($args as $k => $v) { 
    11411141                $vars[] = $k . '=' . $v; 
     
    12011201 
    12021202            if (!is_array($args)) { 
    1203                 $args = array( 
     1203                $args = [ 
    12041204                    'margin'          => 1, 
    12051205                    'showvolume'      => 1, 
     
    12101210                    'slidercolor2'    => '999999', 
    12111211                    'sliderovercolor' => '0066cc' 
    1212                 ); 
     1212                ]; 
    12131213            } 
    12141214 
     
    12221222            } 
    12231223 
    1224             $vars = array(); 
     1224            $vars = []; 
    12251225            foreach ($args as $k => $v) { 
    12261226                $vars[] = $k . '=' . $v; 
     
    12641264 
    12651265        if (!is_array($args)) { 
    1266             $args = array( 
     1266            $args = [ 
    12671267                'showvolume'      => 1, 
    12681268                'loadingcolor'    => 'ff9900', 
     
    12741274                'slidercolor2'    => '999999', 
    12751275                'sliderovercolor' => '0066cc' 
    1276             ); 
     1276            ]; 
    12771277        } 
    12781278 
     
    12861286        } 
    12871287 
    1288         $vars = array(); 
     1288        $vars = []; 
    12891289        foreach ($args as $k => $v) { 
    12901290            $vars[] = $k . '=' . $v; 
     
    13211321 
    13221322        if (!is_array($args)) { 
    1323             $args = array( 
     1323            $args = [ 
    13241324                'margin'          => 1, 
    13251325                'showvolume'      => 1, 
     
    13301330                'slidercolor2'    => '999999', 
    13311331                'sliderovercolor' => '0066cc' 
    1332             ); 
     1332            ]; 
    13331333        } 
    13341334 
     
    13421342        } 
    13431343 
    1344         $vars = array(); 
     1344        $vars = []; 
    13451345        foreach ($args as $k => $v) { 
    13461346            $vars[] = $k . '=' . $v; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map