Changeset 3874:ab8368569446 for inc/core/class.dc.xmlrpc.php
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.xmlrpc.php
r3731 r3874 28 28 29 29 # 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'], 32 32 'New post'); 33 33 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'], 36 36 'Edit a post'); 37 37 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'], 40 40 'Return a posts by ID'); 41 41 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'], 44 44 'Delete a post'); 45 45 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'], 48 48 'Return a list of recent posts'); 49 49 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'], 52 52 "Return user's blog"); 53 53 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'], 56 56 'Return User Info'); 57 57 58 58 # 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'], 61 61 'Creates a new post, and optionnaly publishes it.'); 62 62 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'], 65 65 'Updates information about an existing entry'); 66 66 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'], 69 69 'Returns information about a specific post'); 70 70 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'], 73 73 'List of most recent posts in the system'); 74 74 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'], 77 77 'List of all categories defined in the weblog'); 78 78 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'], 81 81 'Upload a file on the web server'); 82 82 83 83 # 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'], 86 86 'List of most recent posts in the system'); 87 87 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'], 90 90 'List of all categories defined in the weblog'); 91 91 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'], 94 94 'List of all categories to which the post is assigned'); 95 95 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'], 98 98 'Sets the categories for a post'); 99 99 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'], 102 102 'Retrieve pings list for a post'); 103 103 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.'); 109 109 110 110 # 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'], 113 113 'Retrieve the blogs of the user.'); 114 114 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'], 117 117 'Get the page identified by the page ID.'); 118 118 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'], 121 121 'Get an array of all the pages on a blog.'); 122 122 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'], 125 125 'Create a new page.'); 126 126 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'], 129 129 'Removes a page from the blog.'); 130 130 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'], 133 133 'Make changes to a blog page.'); 134 134 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'], 137 137 'Get an array of all the pages on a blog. Just the minimum details, lighter than wp.getPages.'); 138 138 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'], 141 141 'Get an array of users for the blog.'); 142 142 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'], 145 145 'Get an array of available categories on a blog.'); 146 146 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'], 149 149 'Get list of all tags for the blog.'); 150 150 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'], 153 153 'Create a new category.'); 154 154 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'], 157 157 'Delete a category with a given ID.'); 158 158 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'], 161 161 'Get an array of categories that start with a given string.'); 162 162 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'], 165 165 'Upload a file'); 166 166 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'], 169 169 'Retrieve all of the post statuses.'); 170 170 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'], 173 173 'Retrieve all of the pages statuses.'); 174 174 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'], 177 177 'Retrieve page templates.'); 178 178 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'], 181 181 'Retrieve blog options'); 182 182 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'], 185 185 'Update blog options'); 186 186 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'], 189 189 "Gets a comment, given it's comment ID."); 190 190 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'], 193 193 'Retrieve comment count.'); 194 194 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'], 197 197 'Gets a set of comments for a given post.'); 198 198 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'], 201 201 'Delete a comment with given ID.'); 202 202 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'], 205 205 'Edit a comment with given ID.'); 206 206 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'], 209 209 'Create a new comment for a given post ID.'); 210 210 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'], 213 213 'Retrieve all of the comment statuses.'); 214 214 215 215 # 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'], 218 218 'Notify a link to a post.'); 219 219 } … … 231 231 return $rsp; 232 232 } catch (Exception $e) { 233 $this->debugTrace($methodname, $args, array($e->getMessage(), $e->getCode()));233 $this->debugTrace($methodname, $args, [$e->getMessage(), $e->getCode()]); 234 234 throw $e; 235 235 } … … 304 304 $this->setUser($user, $pwd); 305 305 $this->setBlog(); 306 $rs = $this->core->blog->getPosts( array(306 $rs = $this->core->blog->getPosts([ 307 307 'post_id' => (integer) $post_id, 308 308 'post_type' => $post_type 309 ));309 ]); 310 310 311 311 if ($rs->isEmpty()) { … … 318 318 private function getCatID($cat_url) 319 319 { 320 $rs = $this->core->blog->getCategories( array('cat_url' => $cat_url));320 $rs = $this->core->blog->getCategories(['cat_url' => $cat_url]); 321 321 322 322 return $rs->isEmpty() ? null : $rs->cat_id; … … 325 325 /* Generic methods 326 326 --------------------------------------------------- */ 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) 328 328 { 329 329 $this->setUser($user, $pwd); … … 418 418 } 419 419 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) 421 421 { 422 422 $post_id = (integer) $post_id; … … 527 527 528 528 if ($post->cat_id) { 529 $res['categories'] = array($post->cat_url);529 $res['categories'] = [$post->cat_url]; 530 530 } 531 531 … … 550 550 551 551 # --BEHAVIOR-- xmlrpcGetPostInfo 552 $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, array(&$res));552 $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, [&$res]); 553 553 554 554 return $res; … … 576 576 } 577 577 578 $params = array();578 $params = []; 579 579 $params['limit'] = $nb_post; 580 580 581 581 $posts = $this->core->blog->getPosts($params); 582 582 583 $res = array();583 $res = []; 584 584 while ($posts->fetch()) { 585 $tres = array();585 $tres = []; 586 586 587 587 $tres['dateCreated'] = new xmlrpcDate($posts->getTS()); … … 590 590 591 591 if ($posts->cat_id) { 592 $tres['categories'] = array($posts->cat_url);592 $tres['categories'] = [$posts->cat_url]; 593 593 } 594 594 … … 613 613 614 614 # --BEHAVIOR-- xmlrpcGetPostInfo 615 $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, array(&$tres));615 $this->core->callBehavior('xmlrpcGetPostInfo', $this, $type, [&$tres]); 616 616 617 617 $res[] = $tres; … … 626 626 $this->setBlog(); 627 627 628 return array(array(628 return [[ 629 629 'url' => $this->core->blog->url, 630 630 'blogid' => '1', 631 631 'blogName' => $this->core->blog->name 632 ));632 ]]; 633 633 } 634 634 … … 637 637 $this->setUser($user, $pwd); 638 638 639 return array(639 return [ 640 640 'userid' => $this->core->auth->userID(), 641 641 'firstname' => $this->core->auth->getInfo('user_firstname'), … … 644 644 'email' => $this->core->auth->getInfo('user_email'), 645 645 'url' => $this->core->auth->getInfo('user_url') 646 );646 ]; 647 647 } 648 648 … … 653 653 $rs = $this->core->blog->getCategories(); 654 654 655 $res = array();655 $res = []; 656 656 657 657 $l = $rs->level; 658 $stack = array('', $rs->cat_url);658 $stack = ['', $rs->cat_url]; 659 659 660 660 while ($rs->fetch()) { … … 673 673 } 674 674 675 $res[] = array(675 $res[] = [ 676 676 'categoryId' => $rs->cat_url, 677 677 'parentId' => $parent, … … 682 682 'rssUrl' => $this->core->blog->url . 683 683 $this->core->url->getURLFor('feed', 'category/' . $rs->cat_url . '/rss2') 684 );684 ]; 685 685 686 686 $stack[] = $rs->cat_url; … … 697 697 $post = $this->getPostRS($post_id, $user, $pwd); 698 698 699 return array(700 array(699 return [ 700 [ 701 701 'categoryName' => $post->cat_url, 702 702 'categoryId' => (string) $post->cat_url, 703 703 'isPrimary' => true 704 )705 );704 ] 705 ]; 706 706 } 707 707 … … 788 788 789 789 $f = $media->getFile($media_id); 790 return array(790 return [ 791 791 'file' => $file_name, 792 792 'url' => $f->file_url, 793 793 'type' => files::getMimeType($file_name) 794 );794 ]; 795 795 } 796 796 797 797 private function translateWpStatus($s) 798 798 { 799 $status = array(799 $status = [ 800 800 'draft' => -2, 801 801 'pending' => -2, … … 803 803 'publish' => 1, 804 804 'scheduled' => -1 805 );805 ]; 806 806 807 807 if (is_int($s)) { … … 815 815 private function translateWpCommentstatus($s) 816 816 { 817 $status = array(817 $status = [ 818 818 'hold' => -1, 819 819 'approve' => 0, 820 820 'spam' => -2 821 );821 ]; 822 822 823 823 if (is_int($s)) { … … 829 829 } 830 830 831 private function translateWpOptions($options = array())831 private function translateWpOptions($options = []) 832 832 { 833 833 $timezone = 0; … … 836 836 } 837 837 838 $res = array(839 'software_name' => array(838 $res = [ 839 'software_name' => [ 840 840 'desc' => 'Software Name', 841 841 'readonly' => true, 842 842 'value' => 'Dotclear' 843 ),844 'software_version' => array(843 ], 844 'software_version' => [ 845 845 'desc' => 'Software Version', 846 846 'readonly' => true, 847 847 'value' => DC_VERSION 848 ),849 'blog_url' => array(848 ], 849 'blog_url' => [ 850 850 'desc' => 'Blog URL', 851 851 'readonly' => true, 852 852 'value' => $this->core->blog->url 853 ),854 'time_zone' => array(853 ], 854 'time_zone' => [ 855 855 'desc' => 'Time Zone', 856 856 'readonly' => true, 857 857 'value' => (string) $timezone 858 ),859 'blog_title' => array(858 ], 859 'blog_title' => [ 860 860 'desc' => 'Blog Title', 861 861 'readonly' => false, 862 862 'value' => $this->core->blog->name 863 ),864 'blog_tagline' => array(863 ], 864 'blog_tagline' => [ 865 865 'desc' => 'Blog Tagline', 866 866 'readonly' => false, 867 867 'value' => $this->core->blog->desc 868 ),869 'date_format' => array(868 ], 869 'date_format' => [ 870 870 'desc' => 'Date Format', 871 871 'readonly' => false, 872 872 'value' => $this->core->blog->settings->system->date_format 873 ),874 'time_format' => array(873 ], 874 'time_format' => [ 875 875 'desc' => 'Time Format', 876 876 'readonly' => false, 877 877 'value' => $this->core->blog->settings->system->time_format 878 )879 );878 ] 879 ]; 880 880 881 881 if (!empty($options)) { 882 $r = array();882 $r = []; 883 883 foreach ($options as $v) { 884 884 if (isset($res[$v])) { … … 897 897 $this->setBlog(); 898 898 899 return array(899 return [ 900 900 'draft' => 'Draft', 901 901 'pending' => 'Pending Review', … … 903 903 'publish' => 'Published', 904 904 'scheduled' => 'Scheduled' 905 );905 ]; 906 906 } 907 907 … … 912 912 $this->checkPagesPermission(); 913 913 914 return array(914 return [ 915 915 'draft' => 'Draft', 916 916 'private' => 'Private', 917 917 'published' => 'Published', 918 918 'scheduled' => 'Scheduled' 919 );919 ]; 920 920 } 921 921 … … 937 937 $this->checkPagesPermission(); 938 938 939 $params = array(939 $params = [ 940 940 'post_type' => 'page', 941 941 'order' => 'post_position ASC, post_title ASC' 942 );942 ]; 943 943 944 944 if ($id) { … … 951 951 $posts = $this->core->blog->getPosts($params); 952 952 953 $res = array();953 $res = []; 954 954 while ($posts->fetch()) { 955 $tres = array(955 $tres = [ 956 956 "dateCreated" => new xmlrpcDate($posts->getTS()), 957 957 "userid" => $posts->user_id, … … 962 962 "link" => $posts->getURL(), 963 963 "permaLink" => $posts->getURL(), 964 "categories" => array(),964 "categories" => [], 965 965 "excerpt" => $posts->post_excerpt_xhtml, 966 966 "text_more" => '', … … 976 976 "wp_author_display_name" => $posts->getAuthorCN(), 977 977 "date_created_gmt" => new xmlrpcDate(dt::iso8601($posts->getTS(), $posts->post_tz)), 978 "custom_fields" => array(),978 "custom_fields" => [], 979 979 "wp_page_template" => 'default' 980 );980 ]; 981 981 982 982 # --BEHAVIOR-- xmlrpcGetPageInfo 983 $this->core->callBehavior('xmlrpcGetPageInfo', $this, array(&$tres));983 $this->core->callBehavior('xmlrpcGetPageInfo', $this, [&$tres]); 984 984 985 985 $res[] = $tres; … … 1031 1031 1032 1032 $rs = $this->core->getBlogPermissions($this->core->blog->id); 1033 $res = array();1033 $res = []; 1034 1034 1035 1035 foreach ($rs as $k => $v) { 1036 $res[] = array(1036 $res[] = [ 1037 1037 'user_id' => $k, 1038 1038 'user_login' => $k, 1039 1039 'display_name' => dcUtils::getUserCN($k, $v['name'], $v['firstname'], $v['displayname']) 1040 );1040 ]; 1041 1041 } 1042 1042 return $res; … … 1051 1051 $tags->sort('meta_id_lower', 'asc'); 1052 1052 1053 $res = array();1053 $res = []; 1054 1054 $url = $this->core->blog->url . 1055 1055 $this->core->url->getURLFor('tag', '%s'); … … 1057 1057 $this->core->url->getURLFor('tag_feed', '%s'); 1058 1058 while ($tags->fetch()) { 1059 $res[] = array(1059 $res[] = [ 1060 1060 'tag_id' => $tags->meta_id, 1061 1061 'name' => $tags->meta_id, … … 1064 1064 'html_url' => sprintf($url, $tags->meta_id), 1065 1065 'rss_url' => sprintf($f_url, $tags->meta_id) 1066 );1066 ]; 1067 1067 } 1068 1068 return $res; … … 1103 1103 $this->setBlog(); 1104 1104 1105 $c = $this->core->blog->getCategories( array('cat_url' => $cat_id));1105 $c = $this->core->blog->getCategories(['cat_url' => $cat_id]); 1106 1106 if ($c->isEmpty()) { 1107 1107 throw new Exception(__('This category does not exist.')); … … 1127 1127 $rs = $this->core->con->select($strReq); 1128 1128 1129 $res = array();1129 $res = []; 1130 1130 while ($rs->fetch()) { 1131 $res[] = array(1131 $res[] = [ 1132 1132 'category_id' => $rs->cat_url, 1133 1133 'category_name' => $rs->cat_url 1134 );1134 ]; 1135 1135 } 1136 1136 return $res; … … 1142 1142 $this->setBlog(); 1143 1143 1144 $res = array(1144 $res = [ 1145 1145 'approved' => 0, 1146 1146 'awaiting_moderation' => 0, 1147 1147 'spam' => 0, 1148 1148 '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]); 1151 1151 1152 1152 while ($rs->fetch()) { … … 1168 1168 $this->setBlog(); 1169 1169 1170 $params = array();1170 $params = []; 1171 1171 1172 1172 if (!empty($struct['status'])) { … … 1184 1184 $offset = !empty($struct['offset']) ? (integer) $struct['offset'] : 0; 1185 1185 $limit = !empty($struct['number']) ? (integer) $struct['number'] : 10; 1186 $params['limit'] = array($offset, $limit);1186 $params['limit'] = [$offset, $limit]; 1187 1187 1188 1188 $rs = $this->core->blog->getComments($params); 1189 $res = array();1189 $res = []; 1190 1190 while ($rs->fetch()) { 1191 $res[] = array(1191 $res[] = [ 1192 1192 'date_created_gmt' => new xmlrpcDate($rs->getTS()), 1193 1193 'user_id' => $rs->user_id, … … 1203 1203 'author_email' => $rs->comment_email, 1204 1204 'author_ip' => $rs->comment_ip 1205 );1205 ]; 1206 1206 } 1207 1207 return $res; … … 1293 1293 public function blogger_newPost($appkey, $blogid, $username, $password, $content, $publish) 1294 1294 { 1295 return $this->newPost($blogid, $username, $password, $content, array(), $publish);1295 return $this->newPost($blogid, $username, $password, $content, [], $publish); 1296 1296 } 1297 1297 1298 1298 public function blogger_editPost($appkey, $postid, $username, $password, $content, $publish) 1299 1299 { 1300 return $this->editPost($postid, $username, $password, $content, array(), $publish);1300 return $this->editPost($postid, $username, $password, $content, [], $publish); 1301 1301 } 1302 1302 … … 1387 1387 public function mt_supportedTextFilters() 1388 1388 { 1389 return array();1389 return []; 1390 1390 } 1391 1391 … … 1431 1431 { 1432 1432 $A = $this->getPages($blogid, $username, $password); 1433 $res = array();1433 $res = []; 1434 1434 foreach ($A as $v) { 1435 $res[] = array(1435 $res[] = [ 1436 1436 'page_id' => $v['page_id'], 1437 1437 'page_title' => $v['title'], … … 1439 1439 'dateCreated' => $v['dateCreated'], 1440 1440 'date_created_gmt' => $v['date_created_gmt'] 1441 );1441 ]; 1442 1442 } 1443 1443 return $res; … … 1491 1491 public function wp_getPageTemplates($blogid, $username, $password) 1492 1492 { 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 = []) 1497 1497 { 1498 1498 $this->setUser($username, $password); … … 1513 1513 $opt = $this->translateWpOptions(); 1514 1514 1515 $done = array();1515 $done = []; 1516 1516 $blog_changes = false; 1517 1517 $cur = $this->core->con->openCursor($this->core->prefix . 'blog'); … … 1556 1556 public function wp_getComment($blogid, $username, $password, $commentid) 1557 1557 { 1558 $res = $this->getComments($username, $password, array(), $commentid);1558 $res = $this->getComments($username, $password, [], $commentid); 1559 1559 1560 1560 if (empty($res)) { … … 1595 1595 $this->setBlog(); 1596 1596 1597 return array(1597 return [ 1598 1598 'hold' => 'Unapproved', 1599 1599 'approve' => 'Approved', 1600 1600 'spam' => 'Spam' 1601 );1601 ]; 1602 1602 } 1603 1603 … … 1608 1608 dcTrackback::checkURLs($from_url, $to_url); 1609 1609 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]; 1611 1611 1612 1612 # Time to get things done...
Note: See TracChangeset
for help on using the changeset viewer.