line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WordPress::XMLRPC; |
2
|
10
|
|
|
10
|
|
224724
|
use warnings; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
376
|
|
3
|
10
|
|
|
10
|
|
52
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
318
|
|
4
|
10
|
|
|
10
|
|
60
|
use Carp; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
968
|
|
5
|
10
|
|
|
10
|
|
8666
|
use LEOCHARRE::Debug; |
|
10
|
|
|
|
|
4485
|
|
|
10
|
|
|
|
|
215
|
|
6
|
10
|
|
|
10
|
|
594
|
use vars qw($VERSION $DEBUG); |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
64691
|
|
7
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.23 $ =~ /(\d+)/g; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
1
|
|
my ($class,$self) = @_; |
11
|
0
|
|
0
|
|
|
|
$self||={}; |
12
|
0
|
|
|
|
|
|
bless $self, $class; |
13
|
0
|
|
|
|
|
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub proxy { |
17
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
my $val = shift; |
19
|
0
|
0
|
|
|
|
|
if( defined $val ){ |
20
|
0
|
|
|
|
|
|
$self->{proxy} = $val; |
21
|
|
|
|
|
|
|
} |
22
|
0
|
0
|
|
|
|
|
defined $self->{proxy} or carp("missing 'proxy'". (caller(1))[3]); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return $self->{proxy}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub username { |
28
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
29
|
0
|
|
|
|
|
|
my $val = shift; |
30
|
0
|
0
|
|
|
|
|
if( defined $val ){ |
31
|
0
|
|
|
|
|
|
$self->{username} = $val; |
32
|
|
|
|
|
|
|
} |
33
|
0
|
0
|
|
|
|
|
defined $self->{username} or carp("missing 'username'". (caller(1))[3]); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self->{username}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub password { |
39
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
40
|
0
|
|
|
|
|
|
my $val = shift; |
41
|
0
|
0
|
|
|
|
|
if( defined $val ){ |
42
|
0
|
|
|
|
|
|
$self->{password} = $val; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
0
|
|
|
|
|
defined $self->{password} or carp("missing 'username'". (caller(1))[3]); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return $self->{password}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub blog_id { |
50
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my $val = shift; |
52
|
0
|
0
|
|
|
|
|
if( defined $val ){ |
53
|
0
|
0
|
|
|
|
|
$val=~/^\d+$/ or croak('argument must be digits'); |
54
|
0
|
|
|
|
|
|
$self->{blog_id} = $val; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
0
|
|
|
|
$self->{blog_id} ||= 1; |
57
|
0
|
|
|
|
|
|
return $self->{blog_id}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# post and page use 'publish' variable |
61
|
|
|
|
|
|
|
sub publish { |
62
|
0
|
|
|
0
|
1
|
|
my ($self,$val) = @_; |
63
|
0
|
0
|
|
|
|
|
$self->{publish} = $val if defined $val; |
64
|
0
|
0
|
|
|
|
|
defined $self->{publish} or $self->{publish} = 1; |
65
|
0
|
|
|
|
|
|
return $self->{publish}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub server { |
71
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
72
|
0
|
0
|
|
|
|
|
unless( $self->{server} ){ |
73
|
0
|
0
|
|
|
|
|
$self->proxy or confess('missing proxy'); |
74
|
0
|
|
|
|
|
|
require XMLRPC::Lite; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
0
|
|
|
|
$self->{server} ||= XMLRPC::Lite->proxy( $self->proxy ); |
77
|
|
|
|
|
|
|
} |
78
|
0
|
|
|
|
|
|
return $self->{server}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
|
sub server_methods { qw/wp.getUsersBlogs wp.getPage wp.getPages wp.newPage wp.deletePage wp.editPage wp.getPageList wp.getAuthors wp.getCategories wp.getTags wp.newCategory wp.deleteCategory wp.suggestCategories wp.uploadFile wp.getCommentCount wp.getPostStatusList wp.getPageStatusList wp.getPageTemplates wp.getOptions wp.setOptions wp.getComment wp.getComments wp.deleteComment wp.editComment wp.newComment wp.getCommentStatusList blogger.getUsersBlogs blogger.getUserInfo blogger.getPost blogger.getRecentPosts blogger.getTemplate blogger.setTemplate blogger.newPost blogger.editPost blogger.deletePost metaWeblog.newPost metaWeblog.editPost metaWeblog.getPost metaWeblog.getRecentPosts metaWeblog.getCategories metaWeblog.newMediaObject metaWeblog.deletePost metaWeblog.getTemplate metaWeblog.setTemplate metaWeblog.getUsersBlogs mt.getCategoryList mt.getRecentPostTitles mt.getPostCategories mt.setPostCategories mt.supportedMethods mt.supportedTextFilters mt.getTrackbackPings mt.publishPost pingback.ping demo.sayHello demo.addTwoNumbers/ } |
82
|
0
|
|
|
0
|
1
|
|
sub xmlrpc_methods { qw/getUsersBlogs getPage getPages newPage deletePage editPage getPageList getAuthors getCategories getTags newCategory deleteCategory suggestCategories uploadFile getCommentCount getPostStatusList getPageStatusList getPageTemplates getOptions setOptions getComment getComments deleteComment editComment newComment getCommentStatusList newPost editPost getPost getRecentPosts getCategories newMediaObject deletePost getTemplate setTemplate getUsersBlogs/ } |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _call_has_fault { |
85
|
0
|
|
|
0
|
|
|
my $self = shift; |
86
|
0
|
|
|
|
|
|
my $call = shift; |
87
|
0
|
0
|
|
|
|
|
defined $call or confess('no call passed'); |
88
|
0
|
0
|
|
|
|
|
my $err = $call->fault or return 0; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#my $from = caller(); |
91
|
|
|
|
|
|
|
#my($package, $filename, $line, $subroutine, $hasargs, |
92
|
|
|
|
|
|
|
# $wantarray, $evaltext, $is_require, $hints, $bitmask) = caller(1); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $_err; |
96
|
0
|
|
|
|
|
|
for my $k( keys %$err ){ |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
$_err.= sprintf "# %s() - ERROR %s, %s\n", |
99
|
|
|
|
|
|
|
(caller(1))[3], # sub name |
100
|
|
|
|
|
|
|
$k, # error label, from XMLRPC::Simple call |
101
|
|
|
|
|
|
|
$err->{$k}, # error text |
102
|
|
|
|
|
|
|
; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
|
|
|
|
|
$self->errstr($_err); |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
return $self->errstr; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub errstr { |
111
|
0
|
|
|
0
|
1
|
|
my ($self,$val) = @_; |
112
|
0
|
0
|
|
|
|
|
$self->{errstr} = $val if defined $val; |
113
|
0
|
0
|
0
|
|
|
|
($self->{errstr} and $DEBUG) and Carp::cluck($self->{errstr}); |
114
|
0
|
|
|
|
|
|
return $self->{errstr}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# helper for uploading media.. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub abs_path_to_media_object_data { |
122
|
0
|
|
|
0
|
0
|
|
my $abs_path = shift; |
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
0
|
|
|
|
-f $abs_path or Carp::cluck("not on disk: $abs_path") and return; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my $data; |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
$data->{name} = get_file_name($abs_path) or die('cant get filename'); |
129
|
0
|
0
|
|
|
|
|
$data->{type} = get_mime_type($abs_path) or die("cant get mime type"); |
130
|
0
|
0
|
|
|
|
|
$data->{bits} = get_file_bits($abs_path) or die('cant get file bits'); |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
return $data; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# optionally we can request other files to get mime on |
135
|
|
|
|
|
|
|
sub get_mime_type { |
136
|
0
|
|
|
0
|
0
|
|
my $abs = shift; |
137
|
0
|
0
|
|
|
|
|
$abs or confess('missing arg'); |
138
|
0
|
|
|
|
|
|
require File::Type; |
139
|
0
|
|
|
|
|
|
my $ft = new File::Type; |
140
|
0
|
0
|
|
|
|
|
my $type = $ft->mime_type($abs) or die('missing mime'); |
141
|
0
|
|
|
|
|
|
return $type; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub get_file_bits { |
145
|
0
|
|
|
0
|
0
|
|
my $abs_path = shift; |
146
|
0
|
0
|
|
|
|
|
$abs_path or die; |
147
|
|
|
|
|
|
|
# from http://search.cpan.org/~gaas/MIME-Base64-3.07/Base64.pm |
148
|
0
|
|
|
|
|
|
require MIME::Base64; |
149
|
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
|
open(FILE, $abs_path) or die($!); |
151
|
0
|
|
|
|
|
|
my $bits; |
152
|
|
|
|
|
|
|
my $buffer; |
153
|
0
|
|
|
|
|
|
while( read(FILE, $buffer, (60*57)) ) { |
154
|
0
|
|
|
|
|
|
$bits.= $buffer; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
return $bits; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub get_file_name { |
161
|
0
|
|
|
0
|
0
|
|
my $string = shift; |
162
|
0
|
0
|
|
|
|
|
$string or croak('missing path'); |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
$string=~s/^.+\/+|\/+$//g; |
165
|
0
|
|
|
|
|
|
return $string; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
# XML RPC METHODS |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPage |
177
|
|
|
|
|
|
|
sub getPage { |
178
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
179
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
180
|
0
|
|
|
|
|
|
my $page_id = shift; |
181
|
0
|
|
|
|
|
|
my $username = $self->username; |
182
|
0
|
|
|
|
|
|
my $password = $self->password; |
183
|
|
|
|
|
|
|
|
184
|
0
|
0
|
|
|
|
|
$page_id or confess('missing page id'); |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
187
|
|
|
|
|
|
|
'wp.getPage', |
188
|
|
|
|
|
|
|
$blog_id, |
189
|
|
|
|
|
|
|
$page_id, |
190
|
|
|
|
|
|
|
$username, |
191
|
|
|
|
|
|
|
$password, |
192
|
|
|
|
|
|
|
); |
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
195
|
0
|
|
|
|
|
|
return; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
|
my $result = $call->result; |
199
|
0
|
0
|
|
|
|
|
defined $result |
200
|
|
|
|
|
|
|
or die('no result'); |
201
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
return $result; |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPages |
206
|
|
|
|
|
|
|
sub getPages { |
207
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
208
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
209
|
0
|
|
|
|
|
|
my $username = $self->username; |
210
|
0
|
|
|
|
|
|
my $password = $self->password; |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
214
|
|
|
|
|
|
|
'wp.getPages', |
215
|
|
|
|
|
|
|
$blog_id, |
216
|
|
|
|
|
|
|
$username, |
217
|
|
|
|
|
|
|
$password, |
218
|
|
|
|
|
|
|
); |
219
|
|
|
|
|
|
|
|
220
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
221
|
0
|
|
|
|
|
|
return; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
my $result = $call->result; |
225
|
0
|
0
|
|
|
|
|
defined $result |
226
|
|
|
|
|
|
|
or die('no result'); |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
return $result; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
# xmlrpc.php: function wp_newPage |
232
|
|
|
|
|
|
|
sub newPage { |
233
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
234
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
235
|
0
|
|
|
|
|
|
my $username = $self->username; |
236
|
0
|
|
|
|
|
|
my $password = $self->password; |
237
|
0
|
|
|
|
|
|
my $page = shift; |
238
|
|
|
|
|
|
|
|
239
|
0
|
0
|
|
|
|
|
defined $page or confess('missing page arg'); |
240
|
0
|
0
|
|
|
|
|
ref $page eq 'HASH' or croak('arg is not hash ref'); |
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
my $publish = shift; |
243
|
0
|
0
|
|
|
|
|
unless (defined $publish) { |
244
|
0
|
|
|
|
|
|
$publish = $self->publish; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
250
|
|
|
|
|
|
|
'wp.newPage', |
251
|
|
|
|
|
|
|
$blog_id, # ignored |
252
|
|
|
|
|
|
|
$username, # i had missed these!!! |
253
|
|
|
|
|
|
|
$password, |
254
|
|
|
|
|
|
|
$page, |
255
|
|
|
|
|
|
|
$publish, |
256
|
|
|
|
|
|
|
); |
257
|
|
|
|
|
|
|
|
258
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
259
|
0
|
|
|
|
|
|
return; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
my $result = $call->result; |
263
|
0
|
0
|
|
|
|
|
defined $result |
264
|
|
|
|
|
|
|
or die('no result'); |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
return $result; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# xmlrpc.php: function wp_deletePage |
270
|
|
|
|
|
|
|
sub deletePage { |
271
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
272
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
273
|
0
|
|
|
|
|
|
my $username = $self->username; |
274
|
0
|
|
|
|
|
|
my $password = $self->password; |
275
|
0
|
|
|
|
|
|
my $page_id = shift; |
276
|
|
|
|
|
|
|
|
277
|
0
|
0
|
|
|
|
|
defined $page_id or confess('missing page id arg'); |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
280
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
281
|
|
|
|
|
|
|
'wp.deletePage', |
282
|
|
|
|
|
|
|
$blog_id, |
283
|
|
|
|
|
|
|
$username, |
284
|
|
|
|
|
|
|
$password, |
285
|
|
|
|
|
|
|
$page_id, |
286
|
|
|
|
|
|
|
); |
287
|
|
|
|
|
|
|
|
288
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
289
|
0
|
|
|
|
|
|
return; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
|
my $result = $call->result; |
293
|
0
|
0
|
|
|
|
|
defined $result |
294
|
|
|
|
|
|
|
or die('no result'); |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
return $result; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# xmlrpc.php: function wp_editPage |
300
|
|
|
|
|
|
|
sub editPage { |
301
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
302
|
0
|
|
|
|
|
|
my($blog_id, $page_id, $content, $publish); |
303
|
0
|
|
|
|
|
|
$blog_id = $self->blog_id; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# the following hack is a workaround for getting args as one of: |
306
|
|
|
|
|
|
|
# $id, $content, $publish |
307
|
|
|
|
|
|
|
# $content, $publish |
308
|
|
|
|
|
|
|
# $content |
309
|
|
|
|
|
|
|
# $id, $content |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
# i know.. this is a very ugly hack |
312
|
0
|
|
|
|
|
|
my $_arg_1 = shift; |
313
|
0
|
0
|
|
|
|
|
if ($_arg_1=~/^\d+$/){ |
314
|
0
|
|
|
|
|
|
$page_id=$_arg_1; |
315
|
0
|
|
|
|
|
|
$content = shift; |
316
|
0
|
|
|
|
|
|
$publish = shift; |
317
|
|
|
|
|
|
|
|
318
|
0
|
0
|
0
|
|
|
|
(defined $content and ( ref $content ) and ( ref $content eq 'HASH' )) |
|
|
|
0
|
|
|
|
|
319
|
|
|
|
|
|
|
or confess('content arg is not hash ref'); |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
else { |
323
|
0
|
|
|
|
|
|
$content = $_arg_1; |
324
|
0
|
|
|
|
|
|
$publish = shift; |
325
|
0
|
0
|
0
|
|
|
|
( defined $content and (ref $content) and (ref $content eq 'HASH')) |
|
|
|
0
|
|
|
|
|
326
|
|
|
|
|
|
|
or confess('content arg is not hash ref'); |
327
|
|
|
|
|
|
|
|
328
|
0
|
0
|
|
|
|
|
$page_id = $content->{page_id} |
329
|
|
|
|
|
|
|
or confess("missing page_id in content hashref"); |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
my $password = $self->password; |
335
|
0
|
|
|
|
|
|
my $username = $self->username; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
|
338
|
0
|
0
|
0
|
|
|
|
( defined $page_id and $page_id=~/^\d+$/ ) |
339
|
|
|
|
|
|
|
or confess('missing page id arg'); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
|
342
|
0
|
0
|
|
|
|
|
unless (defined $publish) { |
343
|
0
|
|
|
|
|
|
$publish = $self->publish; |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
348
|
|
|
|
|
|
|
'wp.editPage', |
349
|
|
|
|
|
|
|
$blog_id, |
350
|
|
|
|
|
|
|
$page_id, |
351
|
|
|
|
|
|
|
$username, |
352
|
|
|
|
|
|
|
$password, |
353
|
|
|
|
|
|
|
$content, |
354
|
|
|
|
|
|
|
$publish, |
355
|
|
|
|
|
|
|
); |
356
|
|
|
|
|
|
|
|
357
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
358
|
0
|
|
|
|
|
|
return; |
359
|
|
|
|
|
|
|
} |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
my $result = $call->result; |
362
|
0
|
0
|
|
|
|
|
defined $result |
363
|
|
|
|
|
|
|
or die('no result'); |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
|
|
|
return $result; |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPageList |
369
|
|
|
|
|
|
|
sub getPageList { |
370
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
371
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
372
|
0
|
|
|
|
|
|
my $username = $self->username; |
373
|
0
|
|
|
|
|
|
my $password = $self->password; |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
|
376
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
377
|
|
|
|
|
|
|
'wp.getPageList', |
378
|
|
|
|
|
|
|
$blog_id, |
379
|
|
|
|
|
|
|
$username, |
380
|
|
|
|
|
|
|
$password, |
381
|
|
|
|
|
|
|
); |
382
|
|
|
|
|
|
|
|
383
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
384
|
0
|
|
|
|
|
|
return; |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
0
|
|
|
|
|
|
my $result = $call->result; |
388
|
0
|
0
|
|
|
|
|
defined $result |
389
|
|
|
|
|
|
|
or die('no result'); |
390
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
return $result; |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getAuthors |
395
|
|
|
|
|
|
|
sub getAuthors { |
396
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
397
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
398
|
0
|
|
|
|
|
|
my $username = $self->username; |
399
|
0
|
|
|
|
|
|
my $password = $self->password; |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
403
|
|
|
|
|
|
|
'wp.getAuthors', |
404
|
|
|
|
|
|
|
$blog_id, |
405
|
|
|
|
|
|
|
$username, |
406
|
|
|
|
|
|
|
$password, |
407
|
|
|
|
|
|
|
); |
408
|
|
|
|
|
|
|
|
409
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
410
|
0
|
|
|
|
|
|
return; |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
my $result = $call->result; |
414
|
0
|
0
|
|
|
|
|
defined $result |
415
|
|
|
|
|
|
|
or die('no result'); |
416
|
|
|
|
|
|
|
|
417
|
0
|
|
|
|
|
|
return $result; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
# xmlrpc.php: function wp_newCategory |
422
|
|
|
|
|
|
|
sub newCategory { |
423
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
424
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
425
|
0
|
|
|
|
|
|
my $username = $self->username; |
426
|
0
|
|
|
|
|
|
my $password = $self->password; |
427
|
0
|
|
|
|
|
|
my $category = shift; |
428
|
0
|
0
|
0
|
|
|
|
(ref $category and ref $category eq 'HASH') |
429
|
|
|
|
|
|
|
or croak("category must be a hash ref"); |
430
|
|
|
|
|
|
|
|
431
|
0
|
0
|
|
|
|
|
$category->{name} or confess('missing name in category struct'); |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
### $category |
435
|
|
|
|
|
|
|
|
436
|
0
|
0
|
|
|
|
|
defined $category or confess('missing category string'); |
437
|
|
|
|
|
|
|
|
438
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
439
|
|
|
|
|
|
|
'wp.newCategory', |
440
|
|
|
|
|
|
|
$blog_id, |
441
|
|
|
|
|
|
|
$username, |
442
|
|
|
|
|
|
|
$password, |
443
|
|
|
|
|
|
|
$category, |
444
|
|
|
|
|
|
|
); |
445
|
|
|
|
|
|
|
|
446
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
447
|
0
|
|
|
|
|
|
return; |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
0
|
|
|
|
|
|
my $result = $call->result; |
451
|
0
|
0
|
|
|
|
|
defined $result |
452
|
|
|
|
|
|
|
or die('no result'); |
453
|
|
|
|
|
|
|
|
454
|
0
|
|
|
|
|
|
return $result; |
455
|
|
|
|
|
|
|
} |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
# xmlrpc.php: function wp_suggestCategories |
458
|
|
|
|
|
|
|
sub suggestCategories { |
459
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
460
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
461
|
0
|
|
|
|
|
|
my $username = $self->username; |
462
|
0
|
|
|
|
|
|
my $password = $self->password; |
463
|
0
|
|
|
|
|
|
my $category = shift; |
464
|
0
|
|
|
|
|
|
my $max_results = shift; # optional |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
|
468
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
469
|
|
|
|
|
|
|
'wp.suggestCategories', |
470
|
|
|
|
|
|
|
$blog_id, |
471
|
|
|
|
|
|
|
$username, |
472
|
|
|
|
|
|
|
$password, |
473
|
|
|
|
|
|
|
$category, |
474
|
|
|
|
|
|
|
$max_results, |
475
|
|
|
|
|
|
|
); |
476
|
|
|
|
|
|
|
|
477
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
478
|
0
|
|
|
|
|
|
return; |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
0
|
|
|
|
|
|
my $result = $call->result; |
482
|
0
|
0
|
|
|
|
|
defined $result |
483
|
|
|
|
|
|
|
or die('no result'); |
484
|
|
|
|
|
|
|
|
485
|
0
|
|
|
|
|
|
return $result; |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# xmlrpc.php: function mw_newMediaObject |
492
|
|
|
|
|
|
|
*uploadFile = \&newMediaObject; |
493
|
|
|
|
|
|
|
sub newMediaObject { |
494
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
495
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
496
|
0
|
|
|
|
|
|
my $data = shift; |
497
|
|
|
|
|
|
|
|
498
|
0
|
0
|
|
|
|
|
defined $data or confess('missing data hash ref arg'); |
499
|
0
|
0
|
|
|
|
|
ref $data eq 'HASH' or croak('arg is not hash ref'); |
500
|
|
|
|
|
|
|
|
501
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
502
|
|
|
|
|
|
|
'metaWeblog.newMediaObject', |
503
|
|
|
|
|
|
|
$blog_id, |
504
|
|
|
|
|
|
|
$self->username, |
505
|
|
|
|
|
|
|
$self->password, |
506
|
|
|
|
|
|
|
$data, |
507
|
|
|
|
|
|
|
); |
508
|
|
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
510
|
0
|
|
|
|
|
|
return; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
0
|
|
|
|
|
|
my $result = $call->result; |
514
|
0
|
0
|
|
|
|
|
defined $result |
515
|
|
|
|
|
|
|
or die('no result'); |
516
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
|
return $result; |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
# xmlrpc.php: function mw_newPost |
523
|
|
|
|
|
|
|
sub newPost { |
524
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
525
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
526
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
527
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
528
|
0
|
|
|
|
|
|
my $content_struct = shift; |
529
|
0
|
|
|
|
|
|
my $publish = shift; |
530
|
0
|
0
|
|
|
|
|
unless (defined $publish) { |
531
|
0
|
|
|
|
|
|
$publish = $self->publish; |
532
|
|
|
|
|
|
|
} |
533
|
0
|
0
|
|
|
|
|
defined $content_struct or confess('missing post hash ref arg'); |
534
|
0
|
0
|
|
|
|
|
ref $content_struct eq 'HASH' or croak('arg is not hash ref'); |
535
|
|
|
|
|
|
|
|
536
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
537
|
|
|
|
|
|
|
'metaWeblog.newPost', |
538
|
|
|
|
|
|
|
$blog_id, |
539
|
|
|
|
|
|
|
$user_login, |
540
|
|
|
|
|
|
|
$user_pass, |
541
|
|
|
|
|
|
|
$content_struct, |
542
|
|
|
|
|
|
|
$publish, |
543
|
|
|
|
|
|
|
); |
544
|
|
|
|
|
|
|
|
545
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
546
|
0
|
|
|
|
|
|
return; |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
|
549
|
0
|
|
|
|
|
|
my $result = $call->result; |
550
|
0
|
0
|
|
|
|
|
defined $result |
551
|
|
|
|
|
|
|
or die('no result'); |
552
|
|
|
|
|
|
|
|
553
|
0
|
|
|
|
|
|
return $result; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
# xmlrpc.php: function mw_editPost |
557
|
|
|
|
|
|
|
sub editPost { |
558
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
559
|
0
|
|
|
|
|
|
my $post_id = shift; |
560
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
561
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
562
|
0
|
|
|
|
|
|
my $content_struct = shift; |
563
|
0
|
|
|
|
|
|
my $publish = shift; |
564
|
0
|
0
|
|
|
|
|
unless (defined $publish) { |
565
|
0
|
|
|
|
|
|
$publish = $self->publish; |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
|
568
|
0
|
0
|
|
|
|
|
defined $post_id or confess('missing post id'); |
569
|
0
|
0
|
|
|
|
|
defined $content_struct or confess('missing content struct hash ref arg'); |
570
|
0
|
0
|
|
|
|
|
ref $content_struct eq 'HASH' or croak('arg is not hash ref'); |
571
|
|
|
|
|
|
|
|
572
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
573
|
|
|
|
|
|
|
'metaWeblog.editPost', |
574
|
|
|
|
|
|
|
$post_id, |
575
|
|
|
|
|
|
|
$user_login, |
576
|
|
|
|
|
|
|
$user_pass, |
577
|
|
|
|
|
|
|
$content_struct, |
578
|
|
|
|
|
|
|
$publish, |
579
|
|
|
|
|
|
|
); |
580
|
|
|
|
|
|
|
|
581
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
582
|
0
|
|
|
|
|
|
return; |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
my $result = $call->result; |
586
|
0
|
0
|
|
|
|
|
defined $result |
587
|
|
|
|
|
|
|
or die('no result'); |
588
|
|
|
|
|
|
|
|
589
|
0
|
|
|
|
|
|
return $result; |
590
|
|
|
|
|
|
|
} |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
# xmlrpc.php: function mw_getPost |
593
|
|
|
|
|
|
|
sub getPost { |
594
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
595
|
0
|
|
|
|
|
|
my $post_id = shift; |
596
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
597
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
598
|
0
|
0
|
|
|
|
|
defined $post_id or confess('missing post id arg'); |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
|
601
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
602
|
|
|
|
|
|
|
'metaWeblog.getPost', |
603
|
|
|
|
|
|
|
$post_id, |
604
|
|
|
|
|
|
|
$user_login, |
605
|
|
|
|
|
|
|
$user_pass, |
606
|
|
|
|
|
|
|
); |
607
|
|
|
|
|
|
|
|
608
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
609
|
0
|
|
|
|
|
|
return; |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
|
612
|
0
|
|
|
|
|
|
my $result = $call->result; |
613
|
0
|
0
|
|
|
|
|
defined $result |
614
|
|
|
|
|
|
|
or die('no result'); |
615
|
|
|
|
|
|
|
|
616
|
0
|
|
|
|
|
|
return $result; |
617
|
|
|
|
|
|
|
} |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
# xmlrpc.php: function mw_getRecentPosts |
620
|
|
|
|
|
|
|
sub getRecentPosts { |
621
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
622
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
623
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
624
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
625
|
0
|
|
|
|
|
|
my $num_posts = shift; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
|
628
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
629
|
|
|
|
|
|
|
'metaWeblog.getRecentPosts', |
630
|
|
|
|
|
|
|
$blog_id, |
631
|
|
|
|
|
|
|
$user_login, |
632
|
|
|
|
|
|
|
$user_pass, |
633
|
|
|
|
|
|
|
$num_posts, |
634
|
|
|
|
|
|
|
); |
635
|
|
|
|
|
|
|
|
636
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
637
|
0
|
|
|
|
|
|
return; |
638
|
|
|
|
|
|
|
} |
639
|
|
|
|
|
|
|
|
640
|
0
|
|
|
|
|
|
my $result = $call->result; |
641
|
0
|
0
|
|
|
|
|
defined $result |
642
|
|
|
|
|
|
|
or die('no result'); |
643
|
|
|
|
|
|
|
|
644
|
0
|
|
|
|
|
|
return $result; |
645
|
|
|
|
|
|
|
} |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
# xmlrpc.php: function mw_getCategories |
648
|
|
|
|
|
|
|
sub getCategories { |
649
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
650
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
651
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
652
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
|
655
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
656
|
|
|
|
|
|
|
'metaWeblog.getCategories', |
657
|
|
|
|
|
|
|
$blog_id, |
658
|
|
|
|
|
|
|
$user_login, |
659
|
|
|
|
|
|
|
$user_pass, |
660
|
|
|
|
|
|
|
); |
661
|
|
|
|
|
|
|
|
662
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
663
|
0
|
|
|
|
|
|
return; |
664
|
|
|
|
|
|
|
} |
665
|
|
|
|
|
|
|
|
666
|
0
|
|
|
|
|
|
my $result = $call->result; |
667
|
0
|
0
|
|
|
|
|
defined $result |
668
|
|
|
|
|
|
|
or die('no result'); |
669
|
|
|
|
|
|
|
|
670
|
0
|
|
|
|
|
|
return $result; |
671
|
|
|
|
|
|
|
} |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
# this nextone doesn't really exist.. this is a hack .. |
675
|
|
|
|
|
|
|
# this is not keeping in par with xmlrpc.php but.. shikes.. |
676
|
|
|
|
|
|
|
sub getCategory { |
677
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
678
|
0
|
|
|
|
|
|
my $id = shift; |
679
|
0
|
0
|
|
|
|
|
$id or croak('missing id argument'); |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
# get all categorise |
682
|
|
|
|
|
|
|
|
683
|
0
|
|
|
|
|
|
my @cat = grep { $_->{categoryId} == $id } @{$self->getCategories}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
|
685
|
0
|
0
|
0
|
|
|
|
@cat and scalar @cat |
|
|
|
0
|
|
|
|
|
686
|
|
|
|
|
|
|
or $self->errstr("Category id $id not found.") |
687
|
|
|
|
|
|
|
and return; |
688
|
|
|
|
|
|
|
|
689
|
0
|
|
|
|
|
|
return $cat[0]; |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
# xmlrpc.php: function blogger_deletePost |
696
|
|
|
|
|
|
|
sub deletePost { |
697
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
698
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
699
|
0
|
|
|
|
|
|
my $post_id = shift; |
700
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
701
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
702
|
0
|
|
|
|
|
|
my $publish = shift; |
703
|
0
|
0
|
|
|
|
|
unless (defined $publish) { |
704
|
0
|
|
|
|
|
|
$publish = $self->publish; |
705
|
|
|
|
|
|
|
} |
706
|
|
|
|
|
|
|
|
707
|
0
|
0
|
|
|
|
|
defined $post_id or confess('missing post id'); |
708
|
|
|
|
|
|
|
|
709
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
710
|
|
|
|
|
|
|
'metaWeblog.deletePost', |
711
|
|
|
|
|
|
|
$blog_id, #ignored |
712
|
|
|
|
|
|
|
$post_id, |
713
|
|
|
|
|
|
|
$user_login, |
714
|
|
|
|
|
|
|
$user_pass, |
715
|
|
|
|
|
|
|
$publish, |
716
|
|
|
|
|
|
|
); |
717
|
|
|
|
|
|
|
|
718
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
719
|
0
|
|
|
|
|
|
return; |
720
|
|
|
|
|
|
|
} |
721
|
|
|
|
|
|
|
|
722
|
0
|
|
|
|
|
|
my $result = $call->result; |
723
|
0
|
0
|
|
|
|
|
defined $result |
724
|
|
|
|
|
|
|
or die('no result'); |
725
|
|
|
|
|
|
|
|
726
|
0
|
|
|
|
|
|
return $result; |
727
|
|
|
|
|
|
|
} |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
# xmlrpc.php: function blogger_getTemplate |
730
|
|
|
|
|
|
|
sub getTemplate { # TODO this fails, why???? |
731
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
732
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
733
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
734
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
735
|
0
|
|
|
|
|
|
my $template = shift; |
736
|
|
|
|
|
|
|
|
737
|
0
|
0
|
|
|
|
|
defined $template or confess('missing template string'); |
738
|
|
|
|
|
|
|
### $template |
739
|
|
|
|
|
|
|
### $blog_id |
740
|
|
|
|
|
|
|
### $user_login |
741
|
|
|
|
|
|
|
### $user_pass |
742
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
743
|
|
|
|
|
|
|
'metaWeblog.getTemplate', |
744
|
|
|
|
|
|
|
$blog_id, |
745
|
|
|
|
|
|
|
$user_login, |
746
|
|
|
|
|
|
|
$user_pass, |
747
|
|
|
|
|
|
|
$template, |
748
|
|
|
|
|
|
|
); |
749
|
|
|
|
|
|
|
|
750
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
751
|
0
|
|
|
|
|
|
return; |
752
|
|
|
|
|
|
|
} |
753
|
|
|
|
|
|
|
|
754
|
0
|
|
|
|
|
|
my $result = $call->result; |
755
|
0
|
0
|
|
|
|
|
defined $result |
756
|
|
|
|
|
|
|
or die('no result'); |
757
|
|
|
|
|
|
|
|
758
|
0
|
|
|
|
|
|
return $result; |
759
|
|
|
|
|
|
|
} |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
# xmlrpc.php: function blogger_setTemplate |
762
|
|
|
|
|
|
|
sub setTemplate { |
763
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
764
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
765
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
766
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
767
|
0
|
|
|
|
|
|
my $content = shift; |
768
|
0
|
|
|
|
|
|
my $template = shift; |
769
|
|
|
|
|
|
|
|
770
|
0
|
0
|
|
|
|
|
defined $template or confess('missing template string arg'); |
771
|
0
|
0
|
|
|
|
|
defined $content or confess('missing content hash ref arg'); |
772
|
0
|
0
|
|
|
|
|
ref $content eq 'HASH' or croak('arg is not hash ref'); |
773
|
|
|
|
|
|
|
|
774
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
775
|
|
|
|
|
|
|
'metaWeblog.setTemplate', |
776
|
|
|
|
|
|
|
$blog_id, |
777
|
|
|
|
|
|
|
$user_login, |
778
|
|
|
|
|
|
|
$user_pass, |
779
|
|
|
|
|
|
|
$content, |
780
|
|
|
|
|
|
|
$template, |
781
|
|
|
|
|
|
|
); |
782
|
|
|
|
|
|
|
|
783
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
784
|
0
|
|
|
|
|
|
return; |
785
|
|
|
|
|
|
|
} |
786
|
|
|
|
|
|
|
|
787
|
0
|
|
|
|
|
|
my $result = $call->result; |
788
|
0
|
0
|
|
|
|
|
defined $result |
789
|
|
|
|
|
|
|
or die('no result'); |
790
|
|
|
|
|
|
|
|
791
|
0
|
|
|
|
|
|
return $result; |
792
|
|
|
|
|
|
|
} |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
# xmlrpc.php: function blogger_getUsersBlogs |
795
|
|
|
|
|
|
|
sub getUsersBlogs { |
796
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
797
|
0
|
|
|
|
|
|
my $user_login = $self->username; |
798
|
0
|
|
|
|
|
|
my $user_pass = $self->password; |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
|
801
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
802
|
|
|
|
|
|
|
'metaWeblog.getUsersBlogs', |
803
|
|
|
|
|
|
|
$self->blog_id, # ignored |
804
|
|
|
|
|
|
|
$user_login, |
805
|
|
|
|
|
|
|
$user_pass, |
806
|
|
|
|
|
|
|
); |
807
|
|
|
|
|
|
|
|
808
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call)){ |
809
|
0
|
|
|
|
|
|
return; |
810
|
|
|
|
|
|
|
} |
811
|
|
|
|
|
|
|
|
812
|
0
|
|
|
|
|
|
my $result = $call->result; |
813
|
0
|
0
|
|
|
|
|
defined $result |
814
|
|
|
|
|
|
|
or die('no result'); |
815
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
|
return $result; |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
# new methods as of 2.8.4 ... |
823
|
|
|
|
|
|
|
# deleteCategory deleteComment editComment getComment getCommentCount getCommentStatusList |
824
|
|
|
|
|
|
|
# getComments getOptions getPageStatusList getPageTemplates getPostStatusList |
825
|
|
|
|
|
|
|
# getTags newComment setOptions |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
# xmlrpc.php: function wp_deleteCategory |
828
|
|
|
|
|
|
|
sub deleteCategory { |
829
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
830
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
831
|
0
|
|
|
|
|
|
my $username = $self->username; |
832
|
0
|
|
|
|
|
|
my $password = $self->password; |
833
|
0
|
|
|
|
|
|
my $category_id = shift; |
834
|
0
|
|
|
|
|
|
_is_number($category_id); |
835
|
|
|
|
|
|
|
|
836
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
837
|
|
|
|
|
|
|
'wp.deleteCategory', |
838
|
|
|
|
|
|
|
$blog_id, |
839
|
|
|
|
|
|
|
$username, |
840
|
|
|
|
|
|
|
$password, |
841
|
|
|
|
|
|
|
$category_id, |
842
|
|
|
|
|
|
|
); |
843
|
|
|
|
|
|
|
|
844
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
845
|
0
|
|
|
|
|
|
return; |
846
|
|
|
|
|
|
|
} |
847
|
|
|
|
|
|
|
|
848
|
0
|
|
|
|
|
|
my $result = $call->result; |
849
|
0
|
0
|
|
|
|
|
defined $result |
850
|
|
|
|
|
|
|
or die('no result'); |
851
|
|
|
|
|
|
|
|
852
|
0
|
|
|
|
|
|
return $result; |
853
|
|
|
|
|
|
|
} |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
# xmlrpc.php: function wp_deleteComment |
856
|
|
|
|
|
|
|
sub deleteComment { |
857
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
858
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
859
|
0
|
|
|
|
|
|
my $username = $self->username; |
860
|
0
|
|
|
|
|
|
my $password = $self->password; |
861
|
0
|
|
|
|
|
|
my $comment_id = shift; |
862
|
0
|
|
|
|
|
|
_is_number($comment_id); |
863
|
|
|
|
|
|
|
|
864
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
865
|
|
|
|
|
|
|
'wp.deleteComment', |
866
|
|
|
|
|
|
|
$blog_id, |
867
|
|
|
|
|
|
|
$username, |
868
|
|
|
|
|
|
|
$password, |
869
|
|
|
|
|
|
|
$comment_id, |
870
|
|
|
|
|
|
|
); |
871
|
|
|
|
|
|
|
|
872
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
873
|
0
|
|
|
|
|
|
return; |
874
|
|
|
|
|
|
|
} |
875
|
|
|
|
|
|
|
|
876
|
0
|
|
|
|
|
|
my $result = $call->result; |
877
|
0
|
0
|
|
|
|
|
defined $result |
878
|
|
|
|
|
|
|
or die('no result'); |
879
|
|
|
|
|
|
|
|
880
|
0
|
|
|
|
|
|
return $result; |
881
|
|
|
|
|
|
|
} |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
# xmlrpc.php: function wp_editComment |
884
|
|
|
|
|
|
|
sub editComment { |
885
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
886
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
887
|
0
|
|
|
|
|
|
my $username = $self->username; |
888
|
0
|
|
|
|
|
|
my $password = $self->password; |
889
|
0
|
|
|
|
|
|
my $comment_id = shift; |
890
|
0
|
|
|
|
|
|
_is_number($comment_id); |
891
|
|
|
|
|
|
|
|
892
|
0
|
|
|
|
|
|
my $content_struct = shift; |
893
|
0
|
|
|
|
|
|
_is_href($content_struct); |
894
|
|
|
|
|
|
|
|
895
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
896
|
|
|
|
|
|
|
'wp.editComment', |
897
|
|
|
|
|
|
|
$blog_id, |
898
|
|
|
|
|
|
|
$username, |
899
|
|
|
|
|
|
|
$password, |
900
|
|
|
|
|
|
|
$comment_id, |
901
|
|
|
|
|
|
|
$content_struct, |
902
|
|
|
|
|
|
|
); |
903
|
|
|
|
|
|
|
|
904
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
905
|
0
|
|
|
|
|
|
return; |
906
|
|
|
|
|
|
|
} |
907
|
|
|
|
|
|
|
|
908
|
0
|
|
|
|
|
|
my $result = $call->result; |
909
|
0
|
0
|
|
|
|
|
defined $result |
910
|
|
|
|
|
|
|
or die('no result'); |
911
|
|
|
|
|
|
|
|
912
|
0
|
|
|
|
|
|
return $result; |
913
|
|
|
|
|
|
|
} |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getComment |
917
|
|
|
|
|
|
|
sub getComment { |
918
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
919
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
920
|
0
|
|
|
|
|
|
my $username = $self->username; |
921
|
0
|
|
|
|
|
|
my $password = $self->password; |
922
|
0
|
|
|
|
|
|
my $comment_id = shift; |
923
|
0
|
|
|
|
|
|
_is_number($comment_id); |
924
|
|
|
|
|
|
|
|
925
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
926
|
|
|
|
|
|
|
'wp.getComment', |
927
|
|
|
|
|
|
|
$blog_id, |
928
|
|
|
|
|
|
|
$username, |
929
|
|
|
|
|
|
|
$password, |
930
|
|
|
|
|
|
|
$comment_id, |
931
|
|
|
|
|
|
|
); |
932
|
|
|
|
|
|
|
|
933
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
934
|
0
|
|
|
|
|
|
return; |
935
|
|
|
|
|
|
|
} |
936
|
|
|
|
|
|
|
|
937
|
0
|
|
|
|
|
|
my $result = $call->result; |
938
|
0
|
0
|
|
|
|
|
defined $result |
939
|
|
|
|
|
|
|
or die('no result'); |
940
|
|
|
|
|
|
|
|
941
|
0
|
|
|
|
|
|
return $result; |
942
|
|
|
|
|
|
|
} |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getCommentCount |
945
|
|
|
|
|
|
|
sub getCommentCount { |
946
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
947
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
948
|
0
|
|
|
|
|
|
my $username = $self->username; |
949
|
0
|
|
|
|
|
|
my $password = $self->password; |
950
|
0
|
|
|
|
|
|
my $post_id = shift; |
951
|
0
|
|
|
|
|
|
_is_number($post_id); |
952
|
|
|
|
|
|
|
|
953
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
954
|
|
|
|
|
|
|
'wp.getCommentCount', |
955
|
|
|
|
|
|
|
$blog_id, |
956
|
|
|
|
|
|
|
$username, |
957
|
|
|
|
|
|
|
$password, |
958
|
|
|
|
|
|
|
$post_id, |
959
|
|
|
|
|
|
|
); |
960
|
|
|
|
|
|
|
|
961
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
962
|
0
|
|
|
|
|
|
return; |
963
|
|
|
|
|
|
|
} |
964
|
|
|
|
|
|
|
|
965
|
0
|
|
|
|
|
|
my $result = $call->result; |
966
|
0
|
0
|
|
|
|
|
defined $result |
967
|
|
|
|
|
|
|
or die('no result'); |
968
|
|
|
|
|
|
|
|
969
|
0
|
|
|
|
|
|
return $result; |
970
|
|
|
|
|
|
|
} |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getCommentStatusList |
974
|
|
|
|
|
|
|
sub getCommentStatusList { |
975
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
976
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
977
|
0
|
|
|
|
|
|
my $username = $self->username; |
978
|
0
|
|
|
|
|
|
my $password = $self->password; |
979
|
|
|
|
|
|
|
|
980
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
981
|
|
|
|
|
|
|
'wp.getCommentStatusList', |
982
|
|
|
|
|
|
|
$blog_id, |
983
|
|
|
|
|
|
|
$username, |
984
|
|
|
|
|
|
|
$password, |
985
|
|
|
|
|
|
|
); |
986
|
|
|
|
|
|
|
|
987
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
988
|
0
|
|
|
|
|
|
return; |
989
|
|
|
|
|
|
|
} |
990
|
|
|
|
|
|
|
|
991
|
0
|
|
|
|
|
|
my $result = $call->result; |
992
|
0
|
0
|
|
|
|
|
defined $result |
993
|
|
|
|
|
|
|
or die('no result'); |
994
|
|
|
|
|
|
|
|
995
|
0
|
|
|
|
|
|
return $result; |
996
|
|
|
|
|
|
|
} |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getComments |
1000
|
|
|
|
|
|
|
sub getComments { |
1001
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1002
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1003
|
0
|
|
|
|
|
|
my $username = $self->username; |
1004
|
0
|
|
|
|
|
|
my $password = $self->password; |
1005
|
0
|
|
|
|
|
|
my $struct = shift; |
1006
|
0
|
|
|
|
|
|
_is_href($struct); |
1007
|
|
|
|
|
|
|
|
1008
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1009
|
|
|
|
|
|
|
'wp.getComments', |
1010
|
|
|
|
|
|
|
$blog_id, |
1011
|
|
|
|
|
|
|
$username, |
1012
|
|
|
|
|
|
|
$password, |
1013
|
|
|
|
|
|
|
$struct, |
1014
|
|
|
|
|
|
|
); |
1015
|
|
|
|
|
|
|
|
1016
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
1017
|
0
|
|
|
|
|
|
return; |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
|
1020
|
0
|
|
|
|
|
|
my $result = $call->result; |
1021
|
0
|
0
|
|
|
|
|
defined $result |
1022
|
|
|
|
|
|
|
or die('no result'); |
1023
|
|
|
|
|
|
|
|
1024
|
0
|
|
|
|
|
|
return $result; |
1025
|
|
|
|
|
|
|
} |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getOptions |
1029
|
|
|
|
|
|
|
sub getOptions { |
1030
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1031
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1032
|
0
|
|
|
|
|
|
my $username = $self->username; |
1033
|
0
|
|
|
|
|
|
my $password = $self->password; |
1034
|
0
|
|
|
|
|
|
my $options = shift; |
1035
|
|
|
|
|
|
|
|
1036
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1037
|
|
|
|
|
|
|
'wp.getOptions', |
1038
|
|
|
|
|
|
|
$blog_id, |
1039
|
|
|
|
|
|
|
$username, |
1040
|
|
|
|
|
|
|
$password, |
1041
|
|
|
|
|
|
|
$options, |
1042
|
|
|
|
|
|
|
); |
1043
|
|
|
|
|
|
|
|
1044
|
0
|
0
|
|
|
|
|
$call or warn("no call"); |
1045
|
|
|
|
|
|
|
|
1046
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
1047
|
0
|
|
|
|
|
|
return; |
1048
|
|
|
|
|
|
|
} |
1049
|
|
|
|
|
|
|
|
1050
|
0
|
|
|
|
|
|
my $result = $call->result; |
1051
|
0
|
0
|
|
|
|
|
defined $result |
1052
|
|
|
|
|
|
|
or die('no result'); |
1053
|
|
|
|
|
|
|
|
1054
|
0
|
|
|
|
|
|
return $result; |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPageStatusList |
1059
|
|
|
|
|
|
|
sub getPageStatusList { |
1060
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
1061
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1062
|
0
|
|
|
|
|
|
my $username = $self->username; |
1063
|
0
|
|
|
|
|
|
my $password = $self->password; |
1064
|
|
|
|
|
|
|
|
1065
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1066
|
|
|
|
|
|
|
'wp.getPageStatusList', |
1067
|
|
|
|
|
|
|
$blog_id, |
1068
|
|
|
|
|
|
|
$username, |
1069
|
|
|
|
|
|
|
$password, |
1070
|
|
|
|
|
|
|
); |
1071
|
|
|
|
|
|
|
|
1072
|
0
|
0
|
|
|
|
|
if ( $self->_call_has_fault($call) ){ |
1073
|
0
|
|
|
|
|
|
return; |
1074
|
|
|
|
|
|
|
} |
1075
|
|
|
|
|
|
|
|
1076
|
0
|
|
|
|
|
|
my $result = $call->result; |
1077
|
0
|
0
|
|
|
|
|
defined $result |
1078
|
|
|
|
|
|
|
or die('no result'); |
1079
|
|
|
|
|
|
|
|
1080
|
0
|
|
|
|
|
|
return $result; |
1081
|
|
|
|
|
|
|
} |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPageTemplates |
1084
|
|
|
|
|
|
|
sub getPageTemplates { |
1085
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1086
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1087
|
0
|
|
|
|
|
|
my $username = $self->username; |
1088
|
0
|
|
|
|
|
|
my $password = $self->password; |
1089
|
|
|
|
|
|
|
|
1090
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1091
|
|
|
|
|
|
|
'wp.getPageTemplates', |
1092
|
|
|
|
|
|
|
$blog_id, |
1093
|
|
|
|
|
|
|
$username, |
1094
|
|
|
|
|
|
|
$password, |
1095
|
|
|
|
|
|
|
); |
1096
|
|
|
|
|
|
|
|
1097
|
0
|
0
|
|
|
|
|
if ($self->_call_has_fault($call)){ |
1098
|
0
|
|
|
|
|
|
return; |
1099
|
|
|
|
|
|
|
} |
1100
|
|
|
|
|
|
|
|
1101
|
0
|
|
|
|
|
|
my $result = $call->result; |
1102
|
0
|
0
|
|
|
|
|
defined $result |
1103
|
|
|
|
|
|
|
or die('no result'); |
1104
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
return $result; |
1106
|
|
|
|
|
|
|
} |
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getPostStatusList |
1111
|
|
|
|
|
|
|
sub getPostStatusList { |
1112
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
1113
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1114
|
0
|
|
|
|
|
|
my $username = $self->username; |
1115
|
0
|
|
|
|
|
|
my $password = $self->password; |
1116
|
|
|
|
|
|
|
|
1117
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1118
|
|
|
|
|
|
|
'wp.getPostStatusList', |
1119
|
|
|
|
|
|
|
$blog_id, |
1120
|
|
|
|
|
|
|
$username, |
1121
|
|
|
|
|
|
|
$password, |
1122
|
|
|
|
|
|
|
); |
1123
|
|
|
|
|
|
|
|
1124
|
0
|
0
|
|
|
|
|
if ($self->_call_has_fault($call)){ |
1125
|
0
|
|
|
|
|
|
return; |
1126
|
|
|
|
|
|
|
} |
1127
|
|
|
|
|
|
|
|
1128
|
0
|
|
|
|
|
|
my $result = $call->result; |
1129
|
0
|
0
|
|
|
|
|
defined $result |
1130
|
|
|
|
|
|
|
or die('no result'); |
1131
|
|
|
|
|
|
|
|
1132
|
0
|
|
|
|
|
|
return $result; |
1133
|
|
|
|
|
|
|
} |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
# xmlrpc.php: function wp_getTags |
1136
|
|
|
|
|
|
|
sub getTags { |
1137
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1138
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1139
|
0
|
|
|
|
|
|
my $username = $self->username; |
1140
|
0
|
|
|
|
|
|
my $password = $self->password; |
1141
|
|
|
|
|
|
|
|
1142
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1143
|
|
|
|
|
|
|
'wp.getTags', |
1144
|
|
|
|
|
|
|
$blog_id, |
1145
|
|
|
|
|
|
|
$username, |
1146
|
|
|
|
|
|
|
$password, |
1147
|
|
|
|
|
|
|
); |
1148
|
|
|
|
|
|
|
|
1149
|
0
|
0
|
|
|
|
|
if ($self->_call_has_fault($call)){ |
1150
|
0
|
|
|
|
|
|
return; |
1151
|
|
|
|
|
|
|
} |
1152
|
|
|
|
|
|
|
|
1153
|
0
|
|
|
|
|
|
my $result = $call->result; |
1154
|
0
|
0
|
|
|
|
|
defined $result |
1155
|
|
|
|
|
|
|
or die('no result'); |
1156
|
|
|
|
|
|
|
|
1157
|
0
|
|
|
|
|
|
return $result; |
1158
|
|
|
|
|
|
|
} |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
# xmlrpc.php: function wp_newComment |
1162
|
|
|
|
|
|
|
sub newComment { |
1163
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1164
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1165
|
0
|
|
|
|
|
|
my $username = $self->username; |
1166
|
0
|
|
|
|
|
|
my $password = $self->password; |
1167
|
0
|
|
|
|
|
|
my $post = shift; |
1168
|
0
|
|
|
|
|
|
my $content_struct = shift; |
1169
|
0
|
|
|
|
|
|
_is_href($content_struct); |
1170
|
|
|
|
|
|
|
|
1171
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1172
|
|
|
|
|
|
|
'wp.newComment', |
1173
|
|
|
|
|
|
|
$blog_id, |
1174
|
|
|
|
|
|
|
$username, |
1175
|
|
|
|
|
|
|
$password, |
1176
|
|
|
|
|
|
|
$post, |
1177
|
|
|
|
|
|
|
$content_struct, |
1178
|
|
|
|
|
|
|
); |
1179
|
|
|
|
|
|
|
|
1180
|
0
|
0
|
|
|
|
|
if ($self->_call_has_fault($call)){ |
1181
|
0
|
|
|
|
|
|
return; |
1182
|
|
|
|
|
|
|
} |
1183
|
|
|
|
|
|
|
|
1184
|
0
|
|
|
|
|
|
my $result = $call->result; |
1185
|
0
|
0
|
|
|
|
|
defined $result |
1186
|
|
|
|
|
|
|
or die('no result'); |
1187
|
|
|
|
|
|
|
|
1188
|
0
|
|
|
|
|
|
return $result; |
1189
|
|
|
|
|
|
|
} |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
# xmlrpc.php: function wp_setOptions |
1193
|
|
|
|
|
|
|
sub setOptions { |
1194
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
1195
|
0
|
|
|
|
|
|
my $blog_id = $self->blog_id; |
1196
|
0
|
|
|
|
|
|
my $username = $self->username; |
1197
|
0
|
|
|
|
|
|
my $password = $self->password; |
1198
|
0
|
|
|
|
|
|
my $options = shift; |
1199
|
|
|
|
|
|
|
|
1200
|
0
|
|
|
|
|
|
my $call = $self->server->call( |
1201
|
|
|
|
|
|
|
'wp.setOptions', |
1202
|
|
|
|
|
|
|
$blog_id, |
1203
|
|
|
|
|
|
|
$username, |
1204
|
|
|
|
|
|
|
$password, |
1205
|
|
|
|
|
|
|
$options, |
1206
|
|
|
|
|
|
|
); |
1207
|
|
|
|
|
|
|
|
1208
|
0
|
0
|
|
|
|
|
if ($self->_call_has_fault($call)){ |
1209
|
0
|
|
|
|
|
|
return; |
1210
|
|
|
|
|
|
|
} |
1211
|
|
|
|
|
|
|
|
1212
|
0
|
|
|
|
|
|
my $result = $call->result; |
1213
|
0
|
0
|
|
|
|
|
defined $result |
1214
|
|
|
|
|
|
|
or die('no result'); |
1215
|
|
|
|
|
|
|
|
1216
|
0
|
|
|
|
|
|
return $result; |
1217
|
|
|
|
|
|
|
} |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
|
1220
|
0
|
0
|
|
0
|
|
|
sub _is_number { $_[0]=~/^\d+$/ ? $_[0] : confess("Argument '$_[0] ' is not number") } |
1221
|
0
|
0
|
0
|
0
|
|
|
sub _is_href { ($_[0] and (ref $_[0]) and (ref $_[0] eq 'HASH')) ? $_[0] : confess("Expected argument to be hashref/struct") } |
1222
|
|
|
|
|
|
|
1; |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
__END__ |