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

    r3731 r3874  
    2828 
    2929        # Blogger methods 
    30         $this->addCallback('blogger.newPost', array($this, 'blogger_newPost'), 
    31             array('string', 'string', 'string', 'string', 'string', 'string', 'integer'), 
     30        $this->addCallback('blogger.newPost', [$this, 'blogger_newPost'], 
     31            ['string', 'string', 'string', 'string', 'string', 'string', 'integer'], 
    3232            'New post'); 
    3333 
    34         $this->addCallback('blogger.editPost', array($this, 'blogger_editPost'), 
    35             array('boolean', 'string', 'string', 'string', 'string', 'string', 'integer'), 
     34        $this->addCallback('blogger.editPost', [$this, 'blogger_editPost'], 
     35            ['boolean', 'string', 'string', 'string', 'string', 'string', 'integer'], 
    3636            'Edit a post'); 
    3737 
    38         $this->addCallback('blogger.getPost', array($this, 'blogger_getPost'), 
    39             array('struct', 'string', 'integer', 'string', 'string'), 
     38        $this->addCallback('blogger.getPost', [$this, 'blogger_getPost'], 
     39            ['struct', 'string', 'integer', 'string', 'string'], 
    4040            'Return a posts by ID'); 
    4141 
    42         $this->addCallback('blogger.deletePost', array($this, 'blogger_deletePost'), 
    43             array('string', 'string', 'string', 'string', 'string', 'integer'), 
     42        $this->addCallback('blogger.deletePost', [$this, 'blogger_deletePost'], 
     43            ['string', 'string', 'string', 'string', 'string', 'integer'], 
    4444            'Delete a post'); 
    4545 
    46         $this->addCallback('blogger.getRecentPosts', array($this, 'blogger_getRecentPosts'), 
    47             array('array', 'string', 'string', 'string', 'string', 'integer'), 
     46        $this->addCallback('blogger.getRecentPosts', [$this, 'blogger_getRecentPosts'], 
     47            ['array', 'string', 'string', 'string', 'string', 'integer'], 
    4848            'Return a list of recent posts'); 
    4949 
    50         $this->addCallback('blogger.getUsersBlogs', array($this, 'blogger_getUserBlogs'), 
    51             array('struct', 'string', 'string', 'string'), 
     50        $this->addCallback('blogger.getUsersBlogs', [$this, 'blogger_getUserBlogs'], 
     51            ['struct', 'string', 'string', 'string'], 
    5252            "Return user's blog"); 
    5353 
    54         $this->addCallback('blogger.getUserInfo', array($this, 'blogger_getUserInfo'), 
    55             array('struct', 'string', 'string', 'string'), 
     54        $this->addCallback('blogger.getUserInfo', [$this, 'blogger_getUserInfo'], 
     55            ['struct', 'string', 'string', 'string'], 
    5656            'Return User Info'); 
    5757 
    5858        # Metaweblog methods 
    59         $this->addCallback('metaWeblog.newPost', array($this, 'mw_newPost'), 
    60             array('string', 'string', 'string', 'string', 'struct', 'boolean'), 
     59        $this->addCallback('metaWeblog.newPost', [$this, 'mw_newPost'], 
     60            ['string', 'string', 'string', 'string', 'struct', 'boolean'], 
    6161            'Creates a new post, and optionnaly publishes it.'); 
    6262 
    63         $this->addCallback('metaWeblog.editPost', array($this, 'mw_editPost'), 
    64             array('boolean', 'string', 'string', 'string', 'struct', 'boolean'), 
     63        $this->addCallback('metaWeblog.editPost', [$this, 'mw_editPost'], 
     64            ['boolean', 'string', 'string', 'string', 'struct', 'boolean'], 
    6565            'Updates information about an existing entry'); 
    6666 
    67         $this->addCallback('metaWeblog.getPost', array($this, 'mw_getPost'), 
    68             array('struct', 'string', 'string', 'string'), 
     67        $this->addCallback('metaWeblog.getPost', [$this, 'mw_getPost'], 
     68            ['struct', 'string', 'string', 'string'], 
    6969            'Returns information about a specific post'); 
    7070 
    71         $this->addCallback('metaWeblog.getRecentPosts', array($this, 'mw_getRecentPosts'), 
    72             array('array', 'string', 'string', 'string', 'integer'), 
     71        $this->addCallback('metaWeblog.getRecentPosts', [$this, 'mw_getRecentPosts'], 
     72            ['array', 'string', 'string', 'string', 'integer'], 
    7373            'List of most recent posts in the system'); 
    7474 
    75         $this->addCallback('metaWeblog.getCategories', array($this, 'mw_getCategories'), 
    76             array('array', 'string', 'string', 'string'), 
     75        $this->addCallback('metaWeblog.getCategories', [$this, 'mw_getCategories'], 
     76            ['array', 'string', 'string', 'string'], 
    7777            'List of all categories defined in the weblog'); 
    7878 
    79         $this->addCallback('metaWeblog.newMediaObject', array($this, 'mw_newMediaObject'), 
    80             array('struct', 'string', 'string', 'string', 'struct'), 
     79        $this->addCallback('metaWeblog.newMediaObject', [$this, 'mw_newMediaObject'], 
     80            ['struct', 'string', 'string', 'string', 'struct'], 
    8181            'Upload a file on the web server'); 
    8282 
    8383        # MovableType methods 
    84         $this->addCallback('mt.getRecentPostTitles', array($this, 'mt_getRecentPostTitles'), 
    85             array('array', 'string', 'string', 'string', 'integer'), 
     84        $this->addCallback('mt.getRecentPostTitles', [$this, 'mt_getRecentPostTitles'], 
     85            ['array', 'string', 'string', 'string', 'integer'], 
    8686            'List of most recent posts in the system'); 
    8787 
    88         $this->addCallback('mt.getCategoryList', array($this, 'mt_getCategoryList'), 
    89             array('array', 'string', 'string', 'string'), 
     88        $this->addCallback('mt.getCategoryList', [$this, 'mt_getCategoryList'], 
     89            ['array', 'string', 'string', 'string'], 
    9090            'List of all categories defined in the weblog'); 
    9191 
    92         $this->addCallback('mt.getPostCategories', array($this, 'mt_getPostCategories'), 
    93             array('array', 'string', 'string', 'string'), 
     92        $this->addCallback('mt.getPostCategories', [$this, 'mt_getPostCategories'], 
     93            ['array', 'string', 'string', 'string'], 
    9494            'List of all categories to which the post is assigned'); 
    9595 
    96         $this->addCallback('mt.setPostCategories', array($this, 'mt_setPostCategories'), 
    97             array('boolean', 'string', 'string', 'string', 'array'), 
     96        $this->addCallback('mt.setPostCategories', [$this, 'mt_setPostCategories'], 
     97            ['boolean', 'string', 'string', 'string', 'array'], 
    9898            'Sets the categories for a post'); 
    9999 
    100         $this->addCallback('mt.publishPost', array($this, 'mt_publishPost'), 
    101             array('boolean', 'string', 'string', 'string'), 
     100        $this->addCallback('mt.publishPost', [$this, 'mt_publishPost'], 
     101            ['boolean', 'string', 'string', 'string'], 
    102102            'Retrieve pings list for a post'); 
    103103 
    104         $this->addCallback('mt.supportedMethods', array($this, 'listMethods'), 
    105             array(), 'Retrieve information about the XML-RPC methods supported by the server.'); 
    106  
    107         $this->addCallback('mt.supportedTextFilters', array($this, 'mt_supportedTextFilters'), 
    108             array(), 'Retrieve information about supported text filters.'); 
     104        $this->addCallback('mt.supportedMethods', [$this, 'listMethods'], 
     105            [], 'Retrieve information about the XML-RPC methods supported by the server.'); 
     106 
     107        $this->addCallback('mt.supportedTextFilters', [$this, 'mt_supportedTextFilters'], 
     108            [], 'Retrieve information about supported text filters.'); 
    109109 
    110110        # WordPress methods 
    111         $this->addCallback('wp.getUsersBlogs', array($this, 'wp_getUsersBlogs'), 
    112             array('array', 'string', 'string'), 
     111        $this->addCallback('wp.getUsersBlogs', [$this, 'wp_getUsersBlogs'], 
     112            ['array', 'string', 'string'], 
    113113            'Retrieve the blogs of the user.'); 
    114114 
    115         $this->addCallback('wp.getPage', array($this, 'wp_getPage'), 
    116             array('struct', 'integer', 'integer', 'string', 'string'), 
     115        $this->addCallback('wp.getPage', [$this, 'wp_getPage'], 
     116            ['struct', 'integer', 'integer', 'string', 'string'], 
    117117            'Get the page identified by the page ID.'); 
    118118 
    119         $this->addCallback('wp.getPages', array($this, 'wp_getPages'), 
    120             array('array', 'integer', 'string', 'string', 'integer'), 
     119        $this->addCallback('wp.getPages', [$this, 'wp_getPages'], 
     120            ['array', 'integer', 'string', 'string', 'integer'], 
    121121            'Get an array of all the pages on a blog.'); 
    122122 
    123         $this->addCallback('wp.newPage', array($this, 'wp_newPage'), 
    124             array('integer', 'integer', 'string', 'string', 'struct', 'boolean'), 
     123        $this->addCallback('wp.newPage', [$this, 'wp_newPage'], 
     124            ['integer', 'integer', 'string', 'string', 'struct', 'boolean'], 
    125125            'Create a new page.'); 
    126126 
    127         $this->addCallback('wp.deletePage', array($this, 'wp_deletePage'), 
    128             array('boolean', 'integer', 'string', 'string', 'integer'), 
     127        $this->addCallback('wp.deletePage', [$this, 'wp_deletePage'], 
     128            ['boolean', 'integer', 'string', 'string', 'integer'], 
    129129            'Removes a page from the blog.'); 
    130130 
    131         $this->addCallback('wp.editPage', array($this, 'wp_editPage'), 
    132             array('boolean', 'integer', 'integer', 'string', 'string', 'struct', 'boolean'), 
     131        $this->addCallback('wp.editPage', [$this, 'wp_editPage'], 
     132            ['boolean', 'integer', 'integer', 'string', 'string', 'struct', 'boolean'], 
    133133            'Make changes to a blog page.'); 
    134134 
    135         $this->addCallback('wp.getPageList', array($this, 'wp_getPageList'), 
    136             array('array', 'integer', 'string', 'string'), 
     135        $this->addCallback('wp.getPageList', [$this, 'wp_getPageList'], 
     136            ['array', 'integer', 'string', 'string'], 
    137137            'Get an array of all the pages on a blog. Just the minimum details, lighter than wp.getPages.'); 
    138138 
    139         $this->addCallback('wp.getAuthors', array($this, 'wp_getAuthors'), 
    140             array('array', 'integer', 'string', 'string'), 
     139        $this->addCallback('wp.getAuthors', [$this, 'wp_getAuthors'], 
     140            ['array', 'integer', 'string', 'string'], 
    141141            'Get an array of users for the blog.'); 
    142142 
    143         $this->addCallback('wp.getCategories', array($this, 'wp_getCategories'), 
    144             array('array', 'integer', 'string', 'string'), 
     143        $this->addCallback('wp.getCategories', [$this, 'wp_getCategories'], 
     144            ['array', 'integer', 'string', 'string'], 
    145145            'Get an array of available categories on a blog.'); 
    146146 
    147         $this->addCallback('wp.getTags', array($this, 'wp_getTags'), 
    148             array('array', 'integer', 'string', 'string'), 
     147        $this->addCallback('wp.getTags', [$this, 'wp_getTags'], 
     148            ['array', 'integer', 'string', 'string'], 
    149149            'Get list of all tags for the blog.'); 
    150150 
    151         $this->addCallback('wp.newCategory', array($this, 'wp_newCategory'), 
    152             array('integer', 'integer', 'string', 'string', 'struct'), 
     151        $this->addCallback('wp.newCategory', [$this, 'wp_newCategory'], 
     152            ['integer', 'integer', 'string', 'string', 'struct'], 
    153153            'Create a new category.'); 
    154154 
    155         $this->addCallback('wp.deleteCategory', array($this, 'wp_deleteCategory'), 
    156             array('boolean', 'integer', 'string', 'string', 'integer'), 
     155        $this->addCallback('wp.deleteCategory', [$this, 'wp_deleteCategory'], 
     156            ['boolean', 'integer', 'string', 'string', 'integer'], 
    157157            'Delete a category with a given ID.'); 
    158158 
    159         $this->addCallback('wp.suggestCategories', array($this, 'wp_suggestCategories'), 
    160             array('array', 'integer', 'string', 'string', 'string', 'integer'), 
     159        $this->addCallback('wp.suggestCategories', [$this, 'wp_suggestCategories'], 
     160            ['array', 'integer', 'string', 'string', 'string', 'integer'], 
    161161            'Get an array of categories that start with a given string.'); 
    162162 
    163         $this->addCallback('wp.uploadFile', array($this, 'wp_uploadFile'), 
    164             array('struct', 'integer', 'string', 'string', 'struct'), 
     163        $this->addCallback('wp.uploadFile', [$this, 'wp_uploadFile'], 
     164            ['struct', 'integer', 'string', 'string', 'struct'], 
    165165            'Upload a file'); 
    166166 
    167         $this->addCallback('wp.getPostStatusList', array($this, 'wp_getPostStatusList'), 
    168             array('array', 'integer', 'string', 'string'), 
     167        $this->addCallback('wp.getPostStatusList', [$this, 'wp_getPostStatusList'], 
     168            ['array', 'integer', 'string', 'string'], 
    169169            'Retrieve all of the post statuses.'); 
    170170 
    171         $this->addCallback('wp.getPageStatusList', array($this, 'wp_getPageStatusList'), 
    172             array('array', 'integer', 'string', 'string'), 
     171        $this->addCallback('wp.getPageStatusList', [$this, 'wp_getPageStatusList'], 
     172            ['array', 'integer', 'string', 'string'], 
    173173            'Retrieve all of the pages statuses.'); 
    174174 
    175         $this->addCallback('wp.getPageTemplates', array($this, 'wp_getPageTemplates'), 
    176             array('struct', 'integer', 'string', 'string'), 
     175        $this->addCallback('wp.getPageTemplates', [$this, 'wp_getPageTemplates'], 
     176            ['struct', 'integer', 'string', 'string'], 
    177177            'Retrieve page templates.'); 
    178178 
    179         $this->addCallback('wp.getOptions', array($this, 'wp_getOptions'), 
    180             array('struct', 'integer', 'string', 'string', 'array'), 
     179        $this->addCallback('wp.getOptions', [$this, 'wp_getOptions'], 
     180            ['struct', 'integer', 'string', 'string', 'array'], 
    181181            'Retrieve blog options'); 
    182182 
    183         $this->addCallback('wp.setOptions', array($this, 'wp_setOptions'), 
    184             array('struct', 'integer', 'string', 'string', 'struct'), 
     183        $this->addCallback('wp.setOptions', [$this, 'wp_setOptions'], 
     184            ['struct', 'integer', 'string', 'string', 'struct'], 
    185185            'Update blog options'); 
    186186 
    187         $this->addCallback('wp.getComment', array($this, 'wp_getComment'), 
    188             array('struct', 'integer', 'string', 'string', 'integer'), 
     187        $this->addCallback('wp.getComment', [$this, 'wp_getComment'], 
     188            ['struct', 'integer', 'string', 'string', 'integer'], 
    189189            "Gets a comment, given it's comment ID."); 
    190190 
    191         $this->addCallback('wp.getCommentCount', array($this, 'wp_getCommentCount'), 
    192             array('array', 'integer', 'string', 'string', 'integer'), 
     191        $this->addCallback('wp.getCommentCount', [$this, 'wp_getCommentCount'], 
     192            ['array', 'integer', 'string', 'string', 'integer'], 
    193193            'Retrieve comment count.'); 
    194194 
    195         $this->addCallback('wp.getComments', array($this, 'wp_getComments'), 
    196             array('array', 'integer', 'string', 'string', 'struct'), 
     195        $this->addCallback('wp.getComments', [$this, 'wp_getComments'], 
     196            ['array', 'integer', 'string', 'string', 'struct'], 
    197197            'Gets a set of comments for a given post.'); 
    198198 
    199         $this->addCallback('wp.deleteComment', array($this, 'wp_deleteComment'), 
    200             array('boolean', 'integer', 'string', 'string', 'integer'), 
     199        $this->addCallback('wp.deleteComment', [$this, 'wp_deleteComment'], 
     200            ['boolean', 'integer', 'string', 'string', 'integer'], 
    201201            'Delete a comment with given ID.'); 
    202202 
    203         $this->addCallback('wp.editComment', array($this, 'wp_editComment'), 
    204             array('boolean', 'integer', 'string', 'string', 'integer', 'struct'), 
     203        $this->addCallback('wp.editComment', [$this, 'wp_editComment'], 
     204            ['boolean', 'integer', 'string', 'string', 'integer', 'struct'], 
    205205            'Edit a comment with given ID.'); 
    206206 
    207         $this->addCallback('wp.newComment', array($this, 'wp_newComment'), 
    208             array('integer', 'integer', 'string', 'string', 'integer', 'struct'), 
     207        $this->addCallback('wp.newComment', [$this, 'wp_newComment'], 
     208            ['integer', 'integer', 'string', 'string', 'integer', 'struct'], 
    209209            'Create a new comment for a given post ID.'); 
    210210 
    211         $this->addCallback('wp.getCommentStatusList', array($this, 'wp_getCommentStatusList'), 
    212             array('array', 'integer', 'string', 'string'), 
     211        $this->addCallback('wp.getCommentStatusList', [$this, 'wp_getCommentStatusList'], 
     212            ['array', 'integer', 'string', 'string'], 
    213213            'Retrieve all of the comment statuses.'); 
    214214 
    215215        # Pingback support 
    216         $this->addCallback('pingback.ping', array($this, 'pingback_ping'), 
    217             array('string', 'string', 'string'), 
     216        $this->addCallback('pingback.ping', [$this, 'pingback_ping'], 
     217            ['string', 'string', 'string'], 
    218218            'Notify a link to a post.'); 
    219219    } 
     
    231231            return $rsp; 
    232232        } catch (Exception $e) { 
    233             $this->debugTrace($methodname, $args, array($e->getMessage(), $e->getCode())); 
     233            $this->debugTrace($methodname, $args, [$e->getMessage(), $e->getCode()]); 
    234234            throw $e; 
    235235        } 
     
    304304        $this->setUser($user, $pwd); 
    305305        $this->setBlog(); 
    306         $rs = $this->core->blog->getPosts(array( 
     306        $rs = $this->core->blog->getPosts([ 
    307307            'post_id'   => (integer) $post_id, 
    308308            'post_type' => $post_type 
    309         )); 
     309        ]); 
    310310 
    311311        if ($rs->isEmpty()) { 
     
    318318    private function getCatID($cat_url) 
    319319    { 
    320         $rs = $this->core->blog->getCategories(array('cat_url' => $cat_url)); 
     320        $rs = $this->core->blog->getCategories(['cat_url' => $cat_url]); 
    321321 
    322322        return $rs->isEmpty() ? null : $rs->cat_id; 
     
    325325    /* Generic methods 
    326326    --------------------------------------------------- */ 
    327     private function newPost($blog_id, $user, $pwd, $content, $struct = array(), $publish = true) 
     327    private function newPost($blog_id, $user, $pwd, $content, $struct = [], $publish = true) 
    328328    { 
    329329        $this->setUser($user, $pwd); 
     
    418418    } 
    419419 
    420     private function editPost($post_id, $user, $pwd, $content, $struct = array(), $publish = true) 
     420    private function editPost($post_id, $user, $pwd, $content, $struct = [], $publish = true) 
    421421    { 
    422422        $post_id = (integer) $post_id; 
     
    527527 
    528528        if ($post->cat_id) { 
    529             $res['categories'] = array($post->cat_url); 
     529            $res['categories'] = [$post->cat_url]; 
    530530        } 
    531531 
     
    550550 
    551551        # --BEHAVIOR-- xmlrpcGetPostInfo 
    552         $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, array(&$res)); 
     552        $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, [&$res]); 
    553553 
    554554        return $res; 
     
    576576        } 
    577577 
    578         $params          = array(); 
     578        $params          = []; 
    579579        $params['limit'] = $nb_post; 
    580580 
    581581        $posts = $this->core->blog->getPosts($params); 
    582582 
    583         $res = array(); 
     583        $res = []; 
    584584        while ($posts->fetch()) { 
    585             $tres = array(); 
     585            $tres = []; 
    586586 
    587587            $tres['dateCreated'] = new xmlrpcDate($posts->getTS()); 
     
    590590 
    591591            if ($posts->cat_id) { 
    592                 $tres['categories'] = array($posts->cat_url); 
     592                $tres['categories'] = [$posts->cat_url]; 
    593593            } 
    594594 
     
    613613 
    614614            # --BEHAVIOR-- xmlrpcGetPostInfo 
    615             $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, array(&$tres)); 
     615            $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, [&$tres]); 
    616616 
    617617            $res[] = $tres; 
     
    626626        $this->setBlog(); 
    627627 
    628         return array(array( 
     628        return [[ 
    629629            'url'      => $this->core->blog->url, 
    630630            'blogid'   => '1', 
    631631            'blogName' => $this->core->blog->name 
    632         )); 
     632        ]]; 
    633633    } 
    634634 
     
    637637        $this->setUser($user, $pwd); 
    638638 
    639         return array( 
     639        return [ 
    640640            'userid'    => $this->core->auth->userID(), 
    641641            'firstname' => $this->core->auth->getInfo('user_firstname'), 
     
    644644            'email'     => $this->core->auth->getInfo('user_email'), 
    645645            'url'       => $this->core->auth->getInfo('user_url') 
    646         ); 
     646        ]; 
    647647    } 
    648648 
     
    653653        $rs = $this->core->blog->getCategories(); 
    654654 
    655         $res = array(); 
     655        $res = []; 
    656656 
    657657        $l     = $rs->level; 
    658         $stack = array('', $rs->cat_url); 
     658        $stack = ['', $rs->cat_url]; 
    659659 
    660660        while ($rs->fetch()) { 
     
    673673            } 
    674674 
    675             $res[] = array( 
     675            $res[] = [ 
    676676                'categoryId'   => $rs->cat_url, 
    677677                'parentId'     => $parent, 
     
    682682                'rssUrl'       => $this->core->blog->url . 
    683683                $this->core->url->getURLFor('feed', 'category/' . $rs->cat_url . '/rss2') 
    684             ); 
     684            ]; 
    685685 
    686686            $stack[] = $rs->cat_url; 
     
    697697        $post = $this->getPostRS($post_id, $user, $pwd); 
    698698 
    699         return array( 
    700             array( 
     699        return [ 
     700            [ 
    701701                'categoryName' => $post->cat_url, 
    702702                'categoryId'   => (string) $post->cat_url, 
    703703                'isPrimary'    => true 
    704             ) 
    705         ); 
     704            ] 
     705        ]; 
    706706    } 
    707707 
     
    788788 
    789789        $f = $media->getFile($media_id); 
    790         return array( 
     790        return [ 
    791791            'file' => $file_name, 
    792792            'url'  => $f->file_url, 
    793793            'type' => files::getMimeType($file_name) 
    794         ); 
     794        ]; 
    795795    } 
    796796 
    797797    private function translateWpStatus($s) 
    798798    { 
    799         $status = array( 
     799        $status = [ 
    800800            'draft'     => -2, 
    801801            'pending'   => -2, 
     
    803803            'publish'   => 1, 
    804804            'scheduled' => -1 
    805         ); 
     805        ]; 
    806806 
    807807        if (is_int($s)) { 
     
    815815    private function translateWpCommentstatus($s) 
    816816    { 
    817         $status = array( 
     817        $status = [ 
    818818            'hold'    => -1, 
    819819            'approve' => 0, 
    820820            'spam'    => -2 
    821         ); 
     821        ]; 
    822822 
    823823        if (is_int($s)) { 
     
    829829    } 
    830830 
    831     private function translateWpOptions($options = array()) 
     831    private function translateWpOptions($options = []) 
    832832    { 
    833833        $timezone = 0; 
     
    836836        } 
    837837 
    838         $res = array( 
    839             'software_name'    => array( 
     838        $res = [ 
     839            'software_name'    => [ 
    840840                'desc'     => 'Software Name', 
    841841                'readonly' => true, 
    842842                'value'    => 'Dotclear' 
    843             ), 
    844             'software_version' => array( 
     843            ], 
     844            'software_version' => [ 
    845845                'desc'     => 'Software Version', 
    846846                'readonly' => true, 
    847847                'value'    => DC_VERSION 
    848             ), 
    849             'blog_url'         => array( 
     848            ], 
     849            'blog_url'         => [ 
    850850                'desc'     => 'Blog URL', 
    851851                'readonly' => true, 
    852852                'value'    => $this->core->blog->url 
    853             ), 
    854             'time_zone'        => array( 
     853            ], 
     854            'time_zone'        => [ 
    855855                'desc'     => 'Time Zone', 
    856856                'readonly' => true, 
    857857                'value'    => (string) $timezone 
    858             ), 
    859             'blog_title'       => array( 
     858            ], 
     859            'blog_title'       => [ 
    860860                'desc'     => 'Blog Title', 
    861861                'readonly' => false, 
    862862                'value'    => $this->core->blog->name 
    863             ), 
    864             'blog_tagline'     => array( 
     863            ], 
     864            'blog_tagline'     => [ 
    865865                'desc'     => 'Blog Tagline', 
    866866                'readonly' => false, 
    867867                'value'    => $this->core->blog->desc 
    868             ), 
    869             'date_format'      => array( 
     868            ], 
     869            'date_format'      => [ 
    870870                'desc'     => 'Date Format', 
    871871                'readonly' => false, 
    872872                'value'    => $this->core->blog->settings->system->date_format 
    873             ), 
    874             'time_format'      => array( 
     873            ], 
     874            'time_format'      => [ 
    875875                'desc'     => 'Time Format', 
    876876                'readonly' => false, 
    877877                'value'    => $this->core->blog->settings->system->time_format 
    878             ) 
    879         ); 
     878            ] 
     879        ]; 
    880880 
    881881        if (!empty($options)) { 
    882             $r = array(); 
     882            $r = []; 
    883883            foreach ($options as $v) { 
    884884                if (isset($res[$v])) { 
     
    897897        $this->setBlog(); 
    898898 
    899         return array( 
     899        return [ 
    900900            'draft'     => 'Draft', 
    901901            'pending'   => 'Pending Review', 
     
    903903            'publish'   => 'Published', 
    904904            'scheduled' => 'Scheduled' 
    905         ); 
     905        ]; 
    906906    } 
    907907 
     
    912912        $this->checkPagesPermission(); 
    913913 
    914         return array( 
     914        return [ 
    915915            'draft'     => 'Draft', 
    916916            'private'   => 'Private', 
    917917            'published' => 'Published', 
    918918            'scheduled' => 'Scheduled' 
    919         ); 
     919        ]; 
    920920    } 
    921921 
     
    937937        $this->checkPagesPermission(); 
    938938 
    939         $params = array( 
     939        $params = [ 
    940940            'post_type' => 'page', 
    941941            'order'     => 'post_position ASC, post_title ASC' 
    942         ); 
     942        ]; 
    943943 
    944944        if ($id) { 
     
    951951        $posts = $this->core->blog->getPosts($params); 
    952952 
    953         $res = array(); 
     953        $res = []; 
    954954        while ($posts->fetch()) { 
    955             $tres = array( 
     955            $tres = [ 
    956956                "dateCreated"            => new xmlrpcDate($posts->getTS()), 
    957957                "userid"                 => $posts->user_id, 
     
    962962                "link"                   => $posts->getURL(), 
    963963                "permaLink"              => $posts->getURL(), 
    964                 "categories"             => array(), 
     964                "categories"             => [], 
    965965                "excerpt"                => $posts->post_excerpt_xhtml, 
    966966                "text_more"              => '', 
     
    976976                "wp_author_display_name" => $posts->getAuthorCN(), 
    977977                "date_created_gmt"       => new xmlrpcDate(dt::iso8601($posts->getTS(), $posts->post_tz)), 
    978                 "custom_fields"          => array(), 
     978                "custom_fields"          => [], 
    979979                "wp_page_template"       => 'default' 
    980             ); 
     980            ]; 
    981981 
    982982            # --BEHAVIOR-- xmlrpcGetPageInfo 
    983             $this->core->callBehavior('xmlrpcGetPageInfo', $this, array(&$tres)); 
     983            $this->core->callBehavior('xmlrpcGetPageInfo', $this, [&$tres]); 
    984984 
    985985            $res[] = $tres; 
     
    10311031 
    10321032        $rs  = $this->core->getBlogPermissions($this->core->blog->id); 
    1033         $res = array(); 
     1033        $res = []; 
    10341034 
    10351035        foreach ($rs as $k => $v) { 
    1036             $res[] = array( 
     1036            $res[] = [ 
    10371037                'user_id'      => $k, 
    10381038                'user_login'   => $k, 
    10391039                'display_name' => dcUtils::getUserCN($k, $v['name'], $v['firstname'], $v['displayname']) 
    1040             ); 
     1040            ]; 
    10411041        } 
    10421042        return $res; 
     
    10511051        $tags->sort('meta_id_lower', 'asc'); 
    10521052 
    1053         $res = array(); 
     1053        $res = []; 
    10541054        $url = $this->core->blog->url . 
    10551055        $this->core->url->getURLFor('tag', '%s'); 
     
    10571057        $this->core->url->getURLFor('tag_feed', '%s'); 
    10581058        while ($tags->fetch()) { 
    1059             $res[] = array( 
     1059            $res[] = [ 
    10601060                'tag_id'   => $tags->meta_id, 
    10611061                'name'     => $tags->meta_id, 
     
    10641064                'html_url' => sprintf($url, $tags->meta_id), 
    10651065                'rss_url'  => sprintf($f_url, $tags->meta_id) 
    1066             ); 
     1066            ]; 
    10671067        } 
    10681068        return $res; 
     
    11031103        $this->setBlog(); 
    11041104 
    1105         $c = $this->core->blog->getCategories(array('cat_url' => $cat_id)); 
     1105        $c = $this->core->blog->getCategories(['cat_url' => $cat_id]); 
    11061106        if ($c->isEmpty()) { 
    11071107            throw new Exception(__('This category does not exist.')); 
     
    11271127        $rs = $this->core->con->select($strReq); 
    11281128 
    1129         $res = array(); 
     1129        $res = []; 
    11301130        while ($rs->fetch()) { 
    1131             $res[] = array( 
     1131            $res[] = [ 
    11321132                'category_id'   => $rs->cat_url, 
    11331133                'category_name' => $rs->cat_url 
    1134             ); 
     1134            ]; 
    11351135        } 
    11361136        return $res; 
     
    11421142        $this->setBlog(); 
    11431143 
    1144         $res = array( 
     1144        $res = [ 
    11451145            'approved'            => 0, 
    11461146            'awaiting_moderation' => 0, 
    11471147            'spam'                => 0, 
    11481148            'total'               => 0 
    1149         ); 
    1150         $rs = $this->core->blog->getComments(array('post_id' => $post_id)); 
     1149        ]; 
     1150        $rs = $this->core->blog->getComments(['post_id' => $post_id]); 
    11511151 
    11521152        while ($rs->fetch()) { 
     
    11681168        $this->setBlog(); 
    11691169 
    1170         $params = array(); 
     1170        $params = []; 
    11711171 
    11721172        if (!empty($struct['status'])) { 
     
    11841184        $offset          = !empty($struct['offset']) ? (integer) $struct['offset'] : 0; 
    11851185        $limit           = !empty($struct['number']) ? (integer) $struct['number'] : 10; 
    1186         $params['limit'] = array($offset, $limit); 
     1186        $params['limit'] = [$offset, $limit]; 
    11871187 
    11881188        $rs  = $this->core->blog->getComments($params); 
    1189         $res = array(); 
     1189        $res = []; 
    11901190        while ($rs->fetch()) { 
    1191             $res[] = array( 
     1191            $res[] = [ 
    11921192                'date_created_gmt' => new xmlrpcDate($rs->getTS()), 
    11931193                'user_id'          => $rs->user_id, 
     
    12031203                'author_email'     => $rs->comment_email, 
    12041204                'author_ip'        => $rs->comment_ip 
    1205             ); 
     1205            ]; 
    12061206        } 
    12071207        return $res; 
     
    12931293    public function blogger_newPost($appkey, $blogid, $username, $password, $content, $publish) 
    12941294    { 
    1295         return $this->newPost($blogid, $username, $password, $content, array(), $publish); 
     1295        return $this->newPost($blogid, $username, $password, $content, [], $publish); 
    12961296    } 
    12971297 
    12981298    public function blogger_editPost($appkey, $postid, $username, $password, $content, $publish) 
    12991299    { 
    1300         return $this->editPost($postid, $username, $password, $content, array(), $publish); 
     1300        return $this->editPost($postid, $username, $password, $content, [], $publish); 
    13011301    } 
    13021302 
     
    13871387    public function mt_supportedTextFilters() 
    13881388    { 
    1389         return array(); 
     1389        return []; 
    13901390    } 
    13911391 
     
    14311431    { 
    14321432        $A   = $this->getPages($blogid, $username, $password); 
    1433         $res = array(); 
     1433        $res = []; 
    14341434        foreach ($A as $v) { 
    1435             $res[] = array( 
     1435            $res[] = [ 
    14361436                'page_id'          => $v['page_id'], 
    14371437                'page_title'       => $v['title'], 
     
    14391439                'dateCreated'      => $v['dateCreated'], 
    14401440                'date_created_gmt' => $v['date_created_gmt'] 
    1441             ); 
     1441            ]; 
    14421442        } 
    14431443        return $res; 
     
    14911491    public function wp_getPageTemplates($blogid, $username, $password) 
    14921492    { 
    1493         return array('Default' => 'default'); 
    1494     } 
    1495  
    1496     public function wp_getOptions($blogid, $username, $password, $options = array()) 
     1493        return ['Default' => 'default']; 
     1494    } 
     1495 
     1496    public function wp_getOptions($blogid, $username, $password, $options = []) 
    14971497    { 
    14981498        $this->setUser($username, $password); 
     
    15131513        $opt = $this->translateWpOptions(); 
    15141514 
    1515         $done         = array(); 
     1515        $done         = []; 
    15161516        $blog_changes = false; 
    15171517        $cur          = $this->core->con->openCursor($this->core->prefix . 'blog'); 
     
    15561556    public function wp_getComment($blogid, $username, $password, $commentid) 
    15571557    { 
    1558         $res = $this->getComments($username, $password, array(), $commentid); 
     1558        $res = $this->getComments($username, $password, [], $commentid); 
    15591559 
    15601560        if (empty($res)) { 
     
    15951595        $this->setBlog(); 
    15961596 
    1597         return array( 
     1597        return [ 
    15981598            'hold'    => 'Unapproved', 
    15991599            'approve' => 'Approved', 
    16001600            'spam'    => 'Spam' 
    1601         ); 
     1601        ]; 
    16021602    } 
    16031603 
     
    16081608        dcTrackback::checkURLs($from_url, $to_url); 
    16091609 
    1610         $args = array('type' => 'pingback', 'from_url' => $from_url, 'to_url' => $to_url); 
     1610        $args = ['type' => 'pingback', 'from_url' => $from_url, 'to_url' => $to_url]; 
    16111611 
    16121612        # Time to get things done... 
Note: See TracChangeset for help on using the changeset viewer.

Sites map