Crowdsignal Dashboard – Polls, Surveys & more - Version 1.8.0

Version Description

  • Added option to Rating settings to allow ratings on the front page.
  • Added more phrases to the pot file.
  • Added stylesheet for blos that have a right to left language.
  • Bug Fix: Fixed javascript bug, clash with prototype in P2 theme, use of $ function.
Download this release

Release Info

Developer eoigal
Plugin Icon 128x128 Crowdsignal Dashboard – Polls, Surveys & more
Version 1.8.0
Comparing to
See all releases

Code changes from version 1.7.9 to 1.8.0

Files changed (9) hide show
  1. common.js +1 -1
  2. polldaddy-org.php +32 -10
  3. polldaddy-rtl.css +16 -0
  4. polldaddy-xml.php +743 -743
  5. polldaddy.js +1 -1
  6. polldaddy.php +3997 -4053
  7. polldaddy.pot +302 -255
  8. rating.php +23 -6
  9. readme.txt +8 -2
common.js CHANGED
@@ -1 +1 @@
1
- function $(id){return document.getElementById(id)} function pd_style(){this.name = '';this.n_id = 0;this.n_desc = '';this.m_id = 0;this.m_desc = '';this.w_id = 0;this.w_desc = '';this.tag = ''} function preload_pd_style(){if ($('preload_value').value != '0'){url = window.location.href;fnd = '';qs = window.location.search.substring(1);qv = qs.split("&");for (i = 0;i < qv.length;i++){ft = qv[i].split("=");if (ft[0] == 'preload'){fnd = '&preload=' + ft[1];url = url.replace(fnd,'')}}window.location = url + "&preload=" + $('preload_value').value}} function pd_bind(obj){if (obj.id == 'font_bold'){if (obj.checked){PDRTJS_1.font_bold = 'bold';}else{PDRTJS_1.font_bold = 'normal';}}else if (obj.id == 'font_italic'){if (obj.checked){PDRTJS_1.font_italic = 'italic';}else{PDRTJS_1.font_italic = 'normal';}}else if (obj.id == 'nero_style'){PDRTJS_1.star_color = obj.value;}else{eval('PDRTJS_1.' + obj.id + ' = "' + obj.value.replace('"','&quot;') + '";');}PDRTJS_1.build();}function pd_change_type(type){var dd_label = $('editor_star_color_text');var size_label = $('editor_star_size_text');var obj_star = $('star_color');var obj_nero = $('nero_style');if (type == 1){PDRTJS_1.type = 'nero';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.nero_type;size_label.innerHTML = adminRatingsL10n.nero_size;obj_star.style.display = 'none';obj_nero.style.display = 'block';pd_bind(obj_nero);}else{PDRTJS_1.type = 'stars';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.star_colors;size_label.innerHTML = adminRatingsL10n.star_size;obj_star.style.display = 'block';obj_nero.style.display = 'none';pd_bind(obj_star);}} function show_options(id){if ($('pd_show_' + id).checked == true){$('span_' + id).style.display = 'inline-block';}else{$('span_' + id).style.display = 'none';}} function show_settings(){var div = $('poststuff');if (div.style.display == 'block'){div.style.display = 'none';}else{div.style.display = 'block';}}
1
+ function _$(id){return document.getElementById(id)} function pd_style(){this.name = '';this.n_id = 0;this.n_desc = '';this.m_id = 0;this.m_desc = '';this.w_id = 0;this.w_desc = '';this.tag = ''} function preload_pd_style(){if (_$('preload_value').value != '0'){url = window.location.href;fnd = '';qs = window.location.search.substring(1);qv = qs.split("&");for (i = 0;i < qv.length;i++){ft = qv[i].split("=");if (ft[0] == 'preload'){fnd = '&preload=' + ft[1];url = url.replace(fnd,'')}}window.location = url + "&preload=" + _$('preload_value').value}} function pd_bind(obj){if (obj.id == 'font_bold'){if (obj.checked){PDRTJS_1.font_bold = 'bold';}else{PDRTJS_1.font_bold = 'normal';}}else if (obj.id == 'font_italic'){if (obj.checked){PDRTJS_1.font_italic = 'italic';}else{PDRTJS_1.font_italic = 'normal';}}else if (obj.id == 'nero_style'){PDRTJS_1.star_color = obj.value;}else{eval('PDRTJS_1.' + obj.id + ' = "' + obj.value.replace('"','&quot;') + '";');}PDRTJS_1.build();}function pd_change_type(type){var dd_label = _$('editor_star_color_text');var size_label = _$('editor_star_size_text');var obj_star = _$('star_color');var obj_nero = _$('nero_style');if (type == 1){PDRTJS_1.type = 'nero';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.nero_type;size_label.innerHTML = adminRatingsL10n.nero_size;obj_star.style.display = 'none';obj_nero.style.display = 'block';pd_bind(obj_nero);}else{PDRTJS_1.type = 'stars';PDRTJS_1.build();dd_label.innerHTML = adminRatingsL10n.star_colors;size_label.innerHTML = adminRatingsL10n.star_size;obj_star.style.display = 'block';obj_nero.style.display = 'none';pd_bind(obj_star);}} function show_options(id){if (_$('pd_show_' + id).checked == true){_$('span_' + id).style.display = 'inline-block';}else{_$('span_' + id).style.display = 'none';}} function show_settings(){var div = _$('poststuff');if (div.style.display == 'block'){div.style.display = 'none';}else{div.style.display = 'block';}}
polldaddy-org.php CHANGED
@@ -10,29 +10,51 @@ class WPORG_PollDaddy extends WP_PollDaddy {
10
  }
11
 
12
  function __construct() {
13
- parent::__construct();
 
14
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
15
  $this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
16
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
17
  $this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
18
  $this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
19
  return;
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  function management_page_load() {
23
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
24
- $polldaddy->reset();
25
-
26
- if ( empty( $this->user_code ) ){
27
- $this->user_code = $polldaddy->get_usercode( $this->id );
28
- }
29
-
30
  require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
31
 
32
  $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
33
  wp_reset_vars( array( 'action', 'page' ) );
34
  global $action, $page;
35
 
 
 
36
  if( $page == 'polls' ) {
37
  switch ( $action ) :
38
  case 'update-options' :
@@ -233,7 +255,7 @@ class WPORG_PollDaddy extends WP_PollDaddy {
233
  }
234
 
235
  function plugin_options_add(){
236
- if( !$this->is_admin ) {
237
  $checked = '';
238
  if ( $this->multiple_accounts )
239
  $checked = 'checked="checked"';
10
  }
11
 
12
  function __construct() {
13
+ parent::__construct();
14
+ $this->version = '1.8.1';
15
  $this->base_url = plugins_url() . '/' . dirname( plugin_basename( __FILE__ ) ) . '/';
16
  $this->polldaddy_client_class = 'WPORG_PollDaddy_Client';
17
  $this->use_ssl = (int) get_option( 'polldaddy_use_ssl' );
18
  $this->multiple_accounts = (bool) get_option( 'polldaddy_multiple_accounts' );
19
  $this->is_author = ( ( (bool) current_user_can('edit_others_posts')) or ( $this->multiple_accounts ) );
20
  return;
21
+ }
22
+
23
+ function set_api_user_code(){
24
+ if ( empty( $this->rating_user_code ) ){
25
+ $this->rating_user_code = get_option( 'pd-rating-usercode' );
26
+
27
+ if ( empty( $this->rating_user_code ) ){
28
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
29
+ $polldaddy->reset();
30
+
31
+ if( $this->multiple_accounts ){
32
+ //need to retrieve initial admin user code to use as ratings user code
33
+ $polldaddy_multiple_accounts = 0;
34
+ $partner = array( 'role' => $polldaddy_multiple_accounts );
35
+ $polldaddy->update_partner_account( $partner );
36
+ update_option( 'polldaddy_multiple_accounts', $polldaddy_multiple_accounts );
37
+ }
38
+
39
+ $this->rating_user_code = $polldaddy->get_usercode( $this->id );
40
+
41
+ if ( !empty( $this->rating_user_code ) ){
42
+ update_option( 'pd-rating-usercode', $this->rating_user_code );
43
+ }
44
+ }
45
+ }
46
+ parent::set_api_user_code();
47
+ }
48
 
49
  function management_page_load() {
 
 
 
 
 
 
 
50
  require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
51
 
52
  $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
53
  wp_reset_vars( array( 'action', 'page' ) );
54
  global $action, $page;
55
 
56
+ $this->set_api_user_code();
57
+
58
  if( $page == 'polls' ) {
59
  switch ( $action ) :
60
  case 'update-options' :
255
  }
256
 
257
  function plugin_options_add(){
258
+ if( $this->is_admin ) {
259
  $checked = '';
260
  if ( $this->multiple_accounts )
261
  $checked = 'checked="checked"';
polldaddy-rtl.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body.poll-preview-iframe div#manage-polls.wrap{text-align:right;}
2
+ table.poll-results .column-vote{padding:3px 3px 3px 5px;}
3
+ table.poll-results span.result-total{right:.75em;left:auto;}
4
+ table.poll-results span.result-percent{right:auto;left:.75em;}
5
+ ul#answers li span.handle{right:0;left:auto;}
6
+ ul#answers li a.delete{left:0;right:auto;}
7
+ ul#answer-options{margin-right:20px;margin-left:0;}
8
+ ul#answer-options li{margin-left:1em;margin-right:0;}
9
+ p#add-answer-holder{text-align:left;}
10
+ .inner-sidebar-ratings{clear:left;float:left;}
11
+ #poststuff #post-body.has-sidebar,.has-sidebar{clear:right;float:right;margin-left:-240px;margin-right:0;}
12
+ .has-sidebar .has-sidebar-content{margin-left:245px;margin-right:0;}
13
+ tr.polldaddy-shortcode-row pre{float:right;}
14
+ .st_selector .dir_left{padding:0 0 0 10px;}
15
+ .polldaddy-show-design-options,.pollStyle .customSelect,body.poll-preview-iframe div#manage-polls.wrap,#design h3,.pollStyle TH{text-align:right;}
16
+ #design_standard,.st_selector .dir_right{padding:0 20px 0 0;}
polldaddy-xml.php CHANGED
@@ -1,743 +1,743 @@
1
- <?php
2
-
3
- class Ghetto_XML_Object {
4
- function Ghetto_XML_Object( $args = null, $attributes = null ) {
5
- if ( get_object_vars( $this ) )
6
- $this->___restrict = true;
7
- else
8
- $this->___restrict = false;
9
-
10
- if ( !is_null( $args ) )
11
- $this->set_args( $args );
12
- if ( !is_array( $attributes ) )
13
- return false;
14
-
15
- $atts = array();
16
- foreach ( $attributes as $key => $value )
17
- $atts["_$key"] = $value;
18
-
19
- $this->set_args( $atts );
20
- }
21
-
22
- function xml( $prepend_ns = true, $pad = 0 ) {
23
- $x = '';
24
- $atts = get_object_vars( $this );
25
-
26
- $ns = $atts['___ns'];
27
- if ( $prepend_ns )
28
- $name = "$ns:{$atts['___name']}";
29
- else
30
- $name = $atts['___name'];
31
-
32
- $_prepend_ns = $prepend_ns;
33
-
34
- $prepend_ns = 'all' === $prepend_ns;
35
-
36
- // added this to remove the Warning ( PHP Notice: Undefined index ) in following condition
37
- if ( !isset( $atts['___cdata'] ) )
38
- $atts['___cdata'] = '';
39
-
40
- if ( !$cdata = $atts['___cdata'] )
41
- $cdata = array();
42
-
43
- $x = "<$name";
44
-
45
- if ( isset( $atts['___content'] ) ) {
46
- $inner = in_array( '___content', $cdata ) ? '<![CDATA[' . $atts['___content'] . ']]>' : $atts['___content'];
47
- $empty = false;
48
- } else {
49
- $inner = "\n";
50
- $empty = true;
51
- }
52
-
53
- unset($atts['___ns'], $atts['___name'], $atts['___content'], $atts['___ns_full'], $atts['___restrict'], $atts['___cdata']);
54
-
55
- $_pad = str_repeat( "\t", $pad + 1 );
56
-
57
- foreach ( $atts as $key => $value ) {
58
- if ( is_null( $value ) )
59
- continue;
60
- if ( '_' == $key[0] ) {
61
- $key = substr( $key, 1 );
62
- $x .= " $key='$value'";
63
- continue;
64
- }
65
-
66
- $_key = $key;
67
- if ( $prepend_ns )
68
- $key = "$ns:$key";
69
-
70
- $empty = false;
71
- if ( false === $value ) {
72
- $inner .= "$_pad<$key />\n";
73
- }
74
- elseif ( is_array( $value ) ) {
75
- foreach ( $value as $array_value ) {
76
- if ( is_a( $array_value, 'Ghetto_XML_Object' ) )
77
- $inner .= $_pad . $array_value->xml( $_prepend_ns, $pad + 1 ) . "\n";
78
- else
79
- $inner .= in_array( $_key, $cdata ) ? "$_pad<$key>" . '<![CDATA[' . $array_value . ']]>' . "</$key>\n" : "$_pad<$key>$array_value</$key>\n";
80
- }
81
- }
82
- else {
83
- if ( is_a( $value, 'Ghetto_XML_Object' ) )
84
- $inner .= $_pad . $value->xml( $_prepend_ns, $pad + 1 ) . "\n";
85
- else{
86
- $inner .= in_array( $_key, $cdata ) ? "$_pad<$key>" . '<![CDATA[' . $value . ']]>' . "</$key>\n" : "$_pad<$key>$value</$key>\n";
87
- }
88
- }
89
- }
90
- if ( $empty )
91
- return $x . ' />';
92
- if ( "\n" == substr( $inner, -1 ) )
93
- $inner .= str_repeat( "\t", $pad );
94
-
95
- return $x . ">$inner</$name>";
96
- }
97
-
98
- function set_args( $array ) {
99
- if ( is_scalar( $array ) ) {
100
- $this->___content = $array;
101
- return;
102
- }
103
-
104
- $atts = get_object_vars( $this );
105
- foreach ( $array as $key => $value ) {
106
- if ( 0 === strpos( $key, $this->___ns_full ) )
107
- $key = substr( $key, strlen( $this->___ns_full ) + 1 );
108
- if ( is_null( $value ) || ( $this->___restrict && !array_key_exists( $key, $atts ) ) )
109
- continue;
110
-
111
- $this->$key = $value;
112
- }
113
- }
114
- }
115
-
116
- class PollDaddy_XML_Object extends Ghetto_XML_Object {
117
- var $___ns = 'pd';
118
- var $___ns_full = 'http://api.polldaddy.com/pdapi.xsd';
119
- }
120
-
121
- class PollDaddy_XML_Root extends PollDaddy_XML_Object {
122
- function xml( $prepend_ns = true, $pad = 0 ) {
123
- $xml = parent::xml( $prepend_ns, $pad );
124
- if ( !$pad ) {
125
- $pos = strpos( $xml, '>' );
126
- $xml = substr_replace( $xml, " xmlns:$this->___ns='$this->___ns_full'", $pos, 0 );
127
- }
128
- return $xml;
129
- }
130
- }
131
-
132
- class PollDaddy_Access extends PollDaddy_XML_Root {
133
- var $___name = 'pdAccess';
134
-
135
- var $_partnerGUID;
136
- var $_partnerUserID;
137
-
138
- var $demands;
139
- }
140
-
141
- class PollDaddy_Initiate extends PollDaddy_XML_Root {
142
- var $___cdata = array( 'Email', 'Password' );
143
- var $___name = 'pdInitiate';
144
-
145
- var $_partnerGUID;
146
- var $_partnerUserID;
147
-
148
- var $Email;
149
- var $Password;
150
- }
151
-
152
- class PollDaddy_Request extends PollDaddy_XML_Root {
153
- var $___name = 'pdRequest';
154
-
155
- var $_partnerGUID;
156
- var $_version;
157
- var $_admin;
158
-
159
- var $userCode;
160
- var $demands;
161
- }
162
-
163
- class PollDaddy_Response extends PollDaddy_XML_Root {
164
- var $___name = 'pdResponse';
165
-
166
- var $_partnerGUID;
167
- var $_partnerUserID;
168
-
169
- var $userCode;
170
- var $demands;
171
- var $errors;
172
- var $queries;
173
- }
174
-
175
- class PollDaddy_Errors extends PollDaddy_XML_Object {
176
- var $___name = 'errors';
177
-
178
- var $error;
179
- }
180
-
181
- class PollDaddy_Error extends PollDaddy_XML_Object {
182
- var $___cdata = array( '___content' );
183
- var $___name = 'error';
184
-
185
- var $___content;
186
-
187
- var $_id;
188
- }
189
-
190
- class PollDaddy_Queries extends PollDaddy_XML_Object {
191
- var $___name = 'queries';
192
-
193
- var $query;
194
- }
195
-
196
- class PollDaddy_Query extends PollDaddy_XML_Object {
197
- var $___cdata = array( 'text' );
198
- var $___name = 'query';
199
-
200
- var $_id;
201
-
202
- var $time;
203
- var $text;
204
- var $caller;
205
- }
206
-
207
- class PollDaddy_Demands extends PollDaddy_XML_Object {
208
- var $___name = 'demands';
209
-
210
- var $demand;
211
- }
212
-
213
- class PollDaddy_Demand extends PollDaddy_XML_Object {
214
- var $___name = 'demand';
215
-
216
- var $_id;
217
-
218
- var $account;
219
- var $poll;
220
- var $polls;
221
- var $emailAddress;
222
- var $message;
223
- var $list;
224
- var $search;
225
- var $result;
226
- var $comments; //need to add an request object for each new type
227
- var $comment;
228
- var $extensions;
229
- var $folders;
230
- var $styles;
231
- var $style;
232
- var $packs;
233
- var $pack;
234
- var $languages;
235
- var $activity;
236
- var $rating_result;
237
- var $rating;
238
- var $nonce;
239
- var $partner;
240
- }
241
-
242
- class PollDaddy_Partner extends PollDaddy_XML_Object {
243
- var $___cdata = array( 'name' );
244
- var $___name = 'partner';
245
-
246
- var $_role;
247
- var $_users;
248
-
249
- var $name;
250
- }
251
-
252
- class PollDaddy_Account extends PollDaddy_XML_Object {
253
- var $___cdata = array( 'userName', 'email', 'password', 'firstName', 'lastName', 'websiteURL', 'avatarURL', 'bio' );
254
- var $___name = 'account';
255
-
256
- var $userName;
257
- var $email;
258
- var $password;
259
- var $firstName;
260
- var $lastName;
261
- var $countryCode;
262
- var $gender;
263
- var $yearOfBirth;
264
- var $websiteURL;
265
- var $avatarURL;
266
- var $bio;
267
- }
268
-
269
- class PollDaddy_List extends PollDaddy_XML_Object {
270
- var $___name = 'list';
271
-
272
- var $_start;
273
- var $_end;
274
- var $_id;
275
-
276
- var $period;
277
- }
278
-
279
- class PollDaddy_Polls extends PollDaddy_XML_Object {
280
- var $___name = 'polls';
281
-
282
- var $_total;
283
-
284
- var $poll;
285
- }
286
-
287
- class PollDaddy_Search extends PollDaddy_XML_Object {
288
- var $___cdata = array( '___content' );
289
- var $___name = 'search';
290
-
291
- var $___content;
292
-
293
- var $poll;
294
- }
295
-
296
- class PollDaddy_Poll extends PollDaddy_XML_Object {
297
- var $___cdata = array( '___content', 'question', 'mediaCode', 'url' );
298
- var $___name = 'poll';
299
-
300
- var $___content;
301
-
302
- var $_id;
303
- var $_created;
304
- var $_responses;
305
- var $_folderID;
306
- var $_owner;
307
- var $_closed;
308
-
309
- var $question;
310
- var $multipleChoice;
311
- var $randomiseAnswers;
312
- var $otherAnswer;
313
- var $resultsType;
314
- var $blockRepeatVotersType;
315
- var $blockExpiration;
316
- var $comments;
317
- var $makePublic;
318
- var $closePoll;
319
- var $closePollNow;
320
- var $closeDate;
321
- var $styleID;
322
- var $packID;
323
- var $folderID;
324
- var $languageID;
325
- var $parentID;
326
- var $keyword;
327
- var $sharing;
328
- var $rank;
329
- var $url;
330
- var $choices;
331
- var $mediaType; // new
332
- var $mediaCode; // new
333
- var $answers;
334
- }
335
-
336
- class PollDaddy_Poll_Result extends PollDaddy_XML_Object {
337
- var $___name = 'result';
338
-
339
- var $_id;
340
-
341
- var $answers;
342
- var $otherAnswers;
343
- }
344
-
345
- class PollDaddy_Poll_Answers extends PollDaddy_XML_Object {
346
- var $___name = 'answers';
347
-
348
- var $answer;
349
- }
350
-
351
- class PollDaddy_Poll_Answer extends PollDaddy_XML_Object {
352
- var $___cdata = array( '___content', 'text', 'mediaCode' );
353
- var $___name = 'answer';
354
-
355
- var $_id;
356
- var $_total;
357
- var $_percent;
358
- var $_mediaType; // old way
359
- var $_mediaCode; // old way
360
-
361
- var $___content;
362
-
363
- var $text; //removed ___content and replaced it with text node
364
- var $mediaType; // new
365
- var $mediaCode; // new
366
- }
367
-
368
- class PollDaddy_Other_Answers extends PollDaddy_XML_Object {
369
- var $___name = 'otherAnswers';
370
-
371
- var $otherAnswer;
372
- }
373
-
374
- class PollDaddy_Other_Answer extends PollDaddy_XML_Object {
375
- var $___cdata = array( '___content' );
376
- var $___name = 'otherAnswer';
377
-
378
- var $___content;
379
- }
380
-
381
- class PollDaddy_Comments extends PollDaddy_XML_Object {
382
- var $___cdata = array( '___content' );
383
- var $___name = 'comments';
384
-
385
- var $___content;
386
-
387
- var $_id;
388
-
389
- var $comment;
390
- }
391
-
392
- class PollDaddy_Comment extends PollDaddy_XML_Object {
393
- var $___cdata = array( 'name', 'email', 'text', 'url' );
394
- var $___name = 'comment';
395
-
396
- var $_id; //_ means variable corresponds to an attribute
397
- var $_method;
398
- var $_type;
399
-
400
- var $poll; // without _ means variable corresponds to an element
401
- var $name;
402
- var $email;
403
- var $text;
404
- var $url;
405
- var $date;
406
- var $ip;
407
- }
408
-
409
- class PollDaddy_Extensions extends PollDaddy_XML_Object {
410
- var $___name = 'extensions';
411
-
412
- var $folders;
413
- var $styles;
414
- var $packs;
415
- var $languages;
416
- }
417
-
418
- class PollDaddy_Folders extends PollDaddy_XML_Object {
419
- var $___name = 'folders';
420
-
421
- var $folder;
422
- }
423
-
424
- class PollDaddy_Folder extends PollDaddy_XML_Object {
425
- var $___cdata = array( '___content' );
426
- var $___name = 'folder';
427
-
428
- var $___content;
429
-
430
- var $_id;
431
- }
432
-
433
- class PollDaddy_Styles extends PollDaddy_XML_Object {
434
- var $___name = 'styles';
435
-
436
- var $style;
437
- }
438
-
439
- class PollDaddy_Style extends PollDaddy_XML_Object {
440
- var $___cdata = array( 'title', 'css' );
441
- var $___name = 'style';
442
-
443
- var $_id;
444
- var $_type;
445
- var $_retro;
446
-
447
- var $title;
448
- var $date;
449
- var $css;
450
- }
451
-
452
- class PollDaddy_Packs extends PollDaddy_XML_Object {
453
- var $___name = 'packs';
454
-
455
- var $pack;
456
- }
457
-
458
- class PollDaddy_Pack extends PollDaddy_XML_Object {
459
- var $___name = 'pack';
460
-
461
- var $_id;
462
- var $_date;
463
- var $_retro;
464
-
465
- var $pack;
466
- }
467
-
468
- class Custom_Pack extends PollDaddy_XML_Object {
469
- var $___name = 'pack';
470
-
471
- var $_type = 'user'; //type attribute is constant (for now)
472
-
473
- var $title;
474
- var $phrase;
475
-
476
- function xml( $prepend_ns = true, $pad = 0 ) {
477
- $xml = parent::xml( false, $pad );
478
- return $xml;
479
- }
480
- }
481
-
482
- class Custom_Pack_Phrase extends PollDaddy_XML_Object {
483
- var $___cdata = array( '___content' );
484
- var $___name = 'phrase';
485
-
486
- var $___content;
487
-
488
- var $_phraseID;
489
-
490
- function xml( $prepend_ns = true, $pad = 0 ) {
491
- $xml = parent::xml( false, $pad );
492
- return $xml;
493
- }
494
- }
495
-
496
- class PollDaddy_Languages extends PollDaddy_XML_Object {
497
- var $___name = 'languages';
498
-
499
- var $language;
500
- }
501
-
502
- class PollDaddy_Language extends PollDaddy_XML_Object {
503
- var $___cdata = array( '___content' );
504
- var $___name = 'language';
505
-
506
- var $___content;
507
-
508
- var $_id;
509
- }
510
-
511
- class PollDaddy_Activity extends PollDaddy_XML_Object {
512
- var $___cdata = array( '___content' );
513
- var $___name = 'activity';
514
-
515
- var $___content;
516
- }
517
-
518
- class PollDaddy_Nonce extends PollDaddy_XML_Object {
519
- var $___cdata = array( 'text', 'action' );
520
- var $___name = 'nonce';
521
-
522
- var $text;
523
- var $action;
524
- var $userCode;
525
- }
526
-
527
- class PollDaddy_Rating_Result extends PollDaddy_XML_Object {
528
- var $___name = 'rating_result';
529
-
530
- var $_id;
531
-
532
- var $ratings;
533
- }
534
-
535
- class PollDaddy_Ratings extends PollDaddy_XML_Object {
536
- var $___name = 'ratings';
537
-
538
- var $_total;
539
- var $rating;
540
- }
541
-
542
- class PollDaddy_Rating extends PollDaddy_XML_Object {
543
- var $___name = 'rating';
544
- var $___cdata = array( 'settings' );
545
-
546
- var $_id;
547
-
548
- var $_type;
549
- var $_votes;
550
- var $uid;
551
- var $total1;
552
- var $total2;
553
- var $total3;
554
- var $total4;
555
- var $total5;
556
- var $average_rating;
557
- var $date;
558
- var $title;
559
- var $permalink;
560
-
561
- var $name;
562
- var $folder_id;
563
- var $settings;
564
- }
565
-
566
- class PollDaddy_Email extends PollDaddy_XML_Object {
567
- var $___cdata = array( 'custom' );
568
- var $___name = 'emailAddress';
569
-
570
- var $_id;
571
- var $_owner;
572
-
573
- var $folderID;
574
- var $address;
575
- var $firstname;
576
- var $lastname;
577
- var $custom;
578
- var $status;
579
- }
580
-
581
- class PollDaddy_Email_Message extends PollDaddy_XML_Object {
582
- var $___cdata = array( 'text' );
583
- var $___name = 'message';
584
-
585
- var $_id;
586
- var $_owner;
587
-
588
- var $text;
589
- var $groups;
590
- }
591
-
592
- class PollDaddy_XML_Parser {
593
- var $parser;
594
- var $polldaddy_objects = array(
595
- 'http://api.polldaddy.com/pdapi.xsd:pdAccess' => 'PollDaddy_Access',
596
- 'http://api.polldaddy.com/pdapi.xsd:pdInitiate' => 'PollDaddy_Initiate',
597
- 'http://api.polldaddy.com/pdapi.xsd:pdRequest' => 'PollDaddy_Request',
598
- 'http://api.polldaddy.com/pdapi.xsd:pdResponse' => 'PollDaddy_Response',
599
- 'http://api.polldaddy.com/pdapi.xsd:errors' => 'PollDaddy_Errors',
600
- 'http://api.polldaddy.com/pdapi.xsd:error' => 'PollDaddy_Error',
601
- 'http://api.polldaddy.com/pdapi.xsd:demands' => 'PollDaddy_Demands',
602
- 'http://api.polldaddy.com/pdapi.xsd:demand' => 'PollDaddy_Demand',
603
- 'http://api.polldaddy.com/pdapi.xsd:queries' => 'PollDaddy_Queries',
604
- 'http://api.polldaddy.com/pdapi.xsd:query' => 'PollDaddy_Query',
605
- 'http://api.polldaddy.com/pdapi.xsd:account' => 'PollDaddy_Account',
606
- 'http://api.polldaddy.com/pdapi.xsd:list' => 'PollDaddy_List',
607
- 'http://api.polldaddy.com/pdapi.xsd:polls' => 'PollDaddy_Polls',
608
- 'http://api.polldaddy.com/pdapi.xsd:search' => 'PollDaddy_Search',
609
- 'http://api.polldaddy.com/pdapi.xsd:poll' => 'PollDaddy_Poll',
610
- 'http://api.polldaddy.com/pdapi.xsd:emailAddress' => 'PollDaddy_Email',
611
- 'http://api.polldaddy.com/pdapi.xsd:message' => 'PollDaddy_Email_Message',
612
- 'http://api.polldaddy.com/pdapi.xsd:answers' => 'PollDaddy_Poll_Answers',
613
- 'http://api.polldaddy.com/pdapi.xsd:answer' => 'PollDaddy_Poll_Answer',
614
- 'http://api.polldaddy.com/pdapi.xsd:otherAnswers' => 'PollDaddy_Other_Answers',
615
- 'http://api.polldaddy.com/pdapi.xsd:result' => 'PollDaddy_Poll_Result',
616
- 'http://api.polldaddy.com/pdapi.xsd:comments' => 'PollDaddy_Comments',
617
- 'http://api.polldaddy.com/pdapi.xsd:comment' => 'PollDaddy_Comment',
618
- 'http://api.polldaddy.com/pdapi.xsd:extensions' => 'PollDaddy_Extensions',
619
- 'http://api.polldaddy.com/pdapi.xsd:folders' => 'PollDaddy_Folders',
620
- 'http://api.polldaddy.com/pdapi.xsd:folder' => 'PollDaddy_Folder',
621
- 'http://api.polldaddy.com/pdapi.xsd:styles' => 'PollDaddy_Styles',
622
- 'http://api.polldaddy.com/pdapi.xsd:style' => 'PollDaddy_Style',
623
- 'http://api.polldaddy.com/pdapi.xsd:packs' => 'PollDaddy_Packs',
624
- 'http://api.polldaddy.com/pdapi.xsd:pack' => 'PollDaddy_Pack',
625
- 'http://api.polldaddy.com/pdapi.xsd:languages' => 'PollDaddy_Languages',
626
- 'http://api.polldaddy.com/pdapi.xsd:language' => 'PollDaddy_Language',
627
- 'http://api.polldaddy.com/pdapi.xsd:activity' => 'PollDaddy_Activity',
628
- 'pack' => 'Custom_Pack',
629
- 'phrase' => 'Custom_Pack_Phrase',
630
- 'http://api.polldaddy.com/pdapi.xsd:rating_result' => 'PollDaddy_Rating_Result',
631
- 'http://api.polldaddy.com/pdapi.xsd:ratings' => 'PollDaddy_Ratings',
632
- 'http://api.polldaddy.com/pdapi.xsd:rating' => 'PollDaddy_Rating',
633
- 'http://api.polldaddy.com/pdapi.xsd:nonce' => 'PollDaddy_Nonce',
634
- 'http://api.polldaddy.com/pdapi.xsd:partner' => 'PollDaddy_Partner'
635
- );// the parser matches the tag names to the class name and creates an object defined by that class
636
-
637
- var $object_stack = array();
638
- var $object_pos = null;
639
-
640
- var $objects = array();
641
-
642
- function PollDaddy_XML_Parser( $xml = null ) {
643
- if ( is_null( $xml ) )
644
- return;
645
-
646
- return $this->parse( $xml );
647
- }
648
-
649
- function parse( $xml ) {
650
- $this->parser = xml_parser_create_ns( 'UTF-8' );
651
- xml_set_object( $this->parser, $this );
652
- xml_set_element_handler( $this->parser, 'tag_open', 'tag_close' );
653
- xml_set_character_data_handler( $this->parser, 'text' );
654
- xml_parser_set_option( $this->parser, XML_OPTION_CASE_FOLDING, 0 );
655
- xml_parser_set_option( $this->parser, XML_OPTION_SKIP_WHITE, 1 );
656
-
657
- xml_parse( $this->parser, $xml );
658
- xml_parser_free( $this->parser );
659
- return $this->objects;
660
- }
661
-
662
- function tag_open( &$parser, $tag, $attributes ) {
663
- $object_pos = $this->object_pos;
664
- if ( $this->object_stack ) {
665
- if ( isset( $this->object_stack[$object_pos]['args'][$tag] ) ) {
666
- if ( is_array( $this->object_stack[$object_pos]['args'][$tag] ) ) {
667
- $this->object_stack[$object_pos]['args'][$tag][] = false;
668
- } else {
669
- $this->object_stack[$object_pos]['args'][$tag] = array( $this->object_stack[$object_pos]['args'][$tag], false );
670
- }
671
- end( $this->object_stack[$object_pos]['args'][$tag] );
672
- $this->object_stack[$object_pos]['args_tag_pos'] = key( $this->object_stack[$object_pos]['args'][$tag] );
673
- } else {
674
- $this->object_stack[$object_pos]['args'][$tag] = false;
675
- }
676
- $this->object_stack[$object_pos]['args_tag'] = $tag;
677
- }
678
-
679
- if ( isset( $this->polldaddy_objects[$tag] ) ) {
680
- $this->object_stack[] = array(
681
- 'tag' => $tag,
682
- 'atts' => $attributes,
683
- 'args' => array(),
684
- 'parent' => $this->object_pos,
685
- 'args_tag' => null,
686
- 'args_tag_pos' => null
687
- );
688
- end( $this->object_stack );
689
- $this->object_pos = key( $this->object_stack );
690
- }
691
- }
692
-
693
- function text( &$parser, $text ) {
694
- if ( !$this->object_stack )
695
- return;
696
-
697
- $text = trim( $text );
698
- if ( !strlen( $text ) )
699
- return;
700
-
701
- if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
702
- if ( isset($this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']]) )
703
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] .= $text;
704
- else
705
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] = $text;
706
- } elseif ( $this->object_stack[$this->object_pos]['args_tag'] ) {
707
- if ( isset($this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']]) )
708
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] .= $text;
709
- else
710
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] = $text;
711
- } else {
712
- if ( isset($this->object_stack[$this->object_pos]['args']['___content']) )
713
- $this->object_stack[$this->object_pos]['args']['___content'] .= $text;
714
- else
715
- $this->object_stack[$this->object_pos]['args']['___content'] = $text;
716
- }
717
- }
718
-
719
- function tag_close( &$parser, $tag ) {
720
- if ( isset( $this->polldaddy_objects[$tag] ) ) {
721
- if ( $tag !== $this->object_stack[$this->object_pos]['tag'] )
722
- die( 'damn' );
723
-
724
- $new = $this->polldaddy_objects[$tag];
725
- $new_object =& new $new( $this->object_stack[$this->object_pos]['args'], $this->object_stack[$this->object_pos]['atts'] );
726
-
727
- if ( is_numeric( $this->object_stack[$this->object_pos]['parent'] ) ) {
728
- $this->object_pos = $this->object_stack[$this->object_pos]['parent'];
729
- if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
730
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] =& $new_object;
731
- } elseif ( $this->object_stack[$this->object_pos]['args_tag'] ) {
732
- $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] =& $new_object;
733
- }
734
- } else {
735
- $this->object_pos = null;
736
- $this->objects[] =& $new_object;
737
- }
738
-
739
- array_pop( $this->object_stack );
740
- }
741
- }
742
- }
743
- ?>
1
+ <?php
2
+
3
+ class Ghetto_XML_Object {
4
+ function Ghetto_XML_Object( $args = null, $attributes = null ) {
5
+ if ( get_object_vars( $this ) )
6
+ $this->___restrict = true;
7
+ else
8
+ $this->___restrict = false;
9
+
10
+ if ( !is_null( $args ) )
11
+ $this->set_args( $args );
12
+ if ( !is_array( $attributes ) )
13
+ return false;
14
+
15
+ $atts = array();
16
+ foreach ( $attributes as $key => $value )
17
+ $atts["_$key"] = $value;
18
+
19
+ $this->set_args( $atts );
20
+ }
21
+
22
+ function xml( $prepend_ns = true, $pad = 0 ) {
23
+ $x = '';
24
+ $atts = get_object_vars( $this );
25
+
26
+ $ns = $atts['___ns'];
27
+ if ( $prepend_ns )
28
+ $name = "$ns:{$atts['___name']}";
29
+ else
30
+ $name = $atts['___name'];
31
+
32
+ $_prepend_ns = $prepend_ns;
33
+
34
+ $prepend_ns = 'all' === $prepend_ns;
35
+
36
+ // added this to remove the Warning ( PHP Notice: Undefined index ) in following condition
37
+ if ( !isset( $atts['___cdata'] ) )
38
+ $atts['___cdata'] = '';
39
+
40
+ if ( !$cdata = $atts['___cdata'] )
41
+ $cdata = array();
42
+
43
+ $x = "<$name";
44
+
45
+ if ( isset( $atts['___content'] ) ) {
46
+ $inner = in_array( '___content', $cdata ) ? '<![CDATA[' . $atts['___content'] . ']]>' : $atts['___content'];
47
+ $empty = false;
48
+ } else {
49
+ $inner = "\n";
50
+ $empty = true;
51
+ }
52
+
53
+ unset($atts['___ns'], $atts['___name'], $atts['___content'], $atts['___ns_full'], $atts['___restrict'], $atts['___cdata']);
54
+
55
+ $_pad = str_repeat( "\t", $pad + 1 );
56
+
57
+ foreach ( $atts as $key => $value ) {
58
+ if ( is_null( $value ) )
59
+ continue;
60
+ if ( '_' == $key[0] ) {
61
+ $key = substr( $key, 1 );
62
+ $x .= " $key='$value'";
63
+ continue;
64
+ }
65
+
66
+ $_key = $key;
67
+ if ( $prepend_ns )
68
+ $key = "$ns:$key";
69
+
70
+ $empty = false;
71
+ if ( false === $value ) {
72
+ $inner .= "$_pad<$key />\n";
73
+ }
74
+ elseif ( is_array( $value ) ) {
75
+ foreach ( $value as $array_value ) {
76
+ if ( is_a( $array_value, 'Ghetto_XML_Object' ) )
77
+ $inner .= $_pad . $array_value->xml( $_prepend_ns, $pad + 1 ) . "\n";
78
+ else
79
+ $inner .= in_array( $_key, $cdata ) ? "$_pad<$key>" . '<![CDATA[' . $array_value . ']]>' . "</$key>\n" : "$_pad<$key>$array_value</$key>\n";
80
+ }
81
+ }
82
+ else {
83
+ if ( is_a( $value, 'Ghetto_XML_Object' ) )
84
+ $inner .= $_pad . $value->xml( $_prepend_ns, $pad + 1 ) . "\n";
85
+ else{
86
+ $inner .= in_array( $_key, $cdata ) ? "$_pad<$key>" . '<![CDATA[' . $value . ']]>' . "</$key>\n" : "$_pad<$key>$value</$key>\n";
87
+ }
88
+ }
89
+ }
90
+ if ( $empty )
91
+ return $x . ' />';
92
+ if ( "\n" == substr( $inner, -1 ) )
93
+ $inner .= str_repeat( "\t", $pad );
94
+
95
+ return $x . ">$inner</$name>";
96
+ }
97
+
98
+ function set_args( $array ) {
99
+ if ( is_scalar( $array ) ) {
100
+ $this->___content = $array;
101
+ return;
102
+ }
103
+
104
+ $atts = get_object_vars( $this );
105
+ foreach ( $array as $key => $value ) {
106
+ if ( 0 === strpos( $key, $this->___ns_full ) )
107
+ $key = substr( $key, strlen( $this->___ns_full ) + 1 );
108
+ if ( is_null( $value ) || ( $this->___restrict && !array_key_exists( $key, $atts ) ) )
109
+ continue;
110
+
111
+ $this->$key = $value;
112
+ }
113
+ }
114
+ }
115
+
116
+ class PollDaddy_XML_Object extends Ghetto_XML_Object {
117
+ var $___ns = 'pd';
118
+ var $___ns_full = 'http://api.polldaddy.com/pdapi.xsd';
119
+ }
120
+
121
+ class PollDaddy_XML_Root extends PollDaddy_XML_Object {
122
+ function xml( $prepend_ns = true, $pad = 0 ) {
123
+ $xml = parent::xml( $prepend_ns, $pad );
124
+ if ( !$pad ) {
125
+ $pos = strpos( $xml, '>' );
126
+ $xml = substr_replace( $xml, " xmlns:$this->___ns='$this->___ns_full'", $pos, 0 );
127
+ }
128
+ return $xml;
129
+ }
130
+ }
131
+
132
+ class PollDaddy_Access extends PollDaddy_XML_Root {
133
+ var $___name = 'pdAccess';
134
+
135
+ var $_partnerGUID;
136
+ var $_partnerUserID;
137
+
138
+ var $demands;
139
+ }
140
+
141
+ class PollDaddy_Initiate extends PollDaddy_XML_Root {
142
+ var $___cdata = array( 'Email', 'Password' );
143
+ var $___name = 'pdInitiate';
144
+
145
+ var $_partnerGUID;
146
+ var $_partnerUserID;
147
+
148
+ var $Email;
149
+ var $Password;
150
+ }
151
+
152
+ class PollDaddy_Request extends PollDaddy_XML_Root {
153
+ var $___name = 'pdRequest';
154
+
155
+ var $_partnerGUID;
156
+ var $_version;
157
+ var $_admin;
158
+
159
+ var $userCode;
160
+ var $demands;
161
+ }
162
+
163
+ class PollDaddy_Response extends PollDaddy_XML_Root {
164
+ var $___name = 'pdResponse';
165
+
166
+ var $_partnerGUID;
167
+ var $_partnerUserID;
168
+
169
+ var $userCode;
170
+ var $demands;
171
+ var $errors;
172
+ var $queries;
173
+ }
174
+
175
+ class PollDaddy_Errors extends PollDaddy_XML_Object {
176
+ var $___name = 'errors';
177
+
178
+ var $error;
179
+ }
180
+
181
+ class PollDaddy_Error extends PollDaddy_XML_Object {
182
+ var $___cdata = array( '___content' );
183
+ var $___name = 'error';
184
+
185
+ var $___content;
186
+
187
+ var $_id;
188
+ }
189
+
190
+ class PollDaddy_Queries extends PollDaddy_XML_Object {
191
+ var $___name = 'queries';
192
+
193
+ var $query;
194
+ }
195
+
196
+ class PollDaddy_Query extends PollDaddy_XML_Object {
197
+ var $___cdata = array( 'text' );
198
+ var $___name = 'query';
199
+
200
+ var $_id;
201
+
202
+ var $time;
203
+ var $text;
204
+ var $caller;
205
+ }
206
+
207
+ class PollDaddy_Demands extends PollDaddy_XML_Object {
208
+ var $___name = 'demands';
209
+
210
+ var $demand;
211
+ }
212
+
213
+ class PollDaddy_Demand extends PollDaddy_XML_Object {
214
+ var $___name = 'demand';
215
+
216
+ var $_id;
217
+
218
+ var $account;
219
+ var $poll;
220
+ var $polls;
221
+ var $emailAddress;
222
+ var $message;
223
+ var $list;
224
+ var $search;
225
+ var $result;
226
+ var $comments; //need to add an request object for each new type
227
+ var $comment;
228
+ var $extensions;
229
+ var $folders;
230
+ var $styles;
231
+ var $style;
232
+ var $packs;
233
+ var $pack;
234
+ var $languages;
235
+ var $activity;
236
+ var $rating_result;
237
+ var $rating;
238
+ var $nonce;
239
+ var $partner;
240
+ }
241
+
242
+ class PollDaddy_Partner extends PollDaddy_XML_Object {
243
+ var $___cdata = array( 'name' );
244
+ var $___name = 'partner';
245
+
246
+ var $_role;
247
+ var $_users;
248
+
249
+ var $name;
250
+ }
251
+
252
+ class PollDaddy_Account extends PollDaddy_XML_Object {
253
+ var $___cdata = array( 'userName', 'email', 'password', 'firstName', 'lastName', 'websiteURL', 'avatarURL', 'bio' );
254
+ var $___name = 'account';
255
+
256
+ var $userName;
257
+ var $email;
258
+ var $password;
259
+ var $firstName;
260
+ var $lastName;
261
+ var $countryCode;
262
+ var $gender;
263
+ var $yearOfBirth;
264
+ var $websiteURL;
265
+ var $avatarURL;
266
+ var $bio;
267
+ }
268
+
269
+ class PollDaddy_List extends PollDaddy_XML_Object {
270
+ var $___name = 'list';
271
+
272
+ var $_start;
273
+ var $_end;
274
+ var $_id;
275
+
276
+ var $period;
277
+ }
278
+
279
+ class PollDaddy_Polls extends PollDaddy_XML_Object {
280
+ var $___name = 'polls';
281
+
282
+ var $_total;
283
+
284
+ var $poll;
285
+ }
286
+
287
+ class PollDaddy_Search extends PollDaddy_XML_Object {
288
+ var $___cdata = array( '___content' );
289
+ var $___name = 'search';
290
+
291
+ var $___content;
292
+
293
+ var $poll;
294
+ }
295
+
296
+ class PollDaddy_Poll extends PollDaddy_XML_Object {
297
+ var $___cdata = array( '___content', 'question', 'mediaCode', 'url' );
298
+ var $___name = 'poll';
299
+
300
+ var $___content;
301
+
302
+ var $_id;
303
+ var $_created;
304
+ var $_responses;
305
+ var $_folderID;
306
+ var $_owner;
307
+ var $_closed;
308
+
309
+ var $question;
310
+ var $multipleChoice;
311
+ var $randomiseAnswers;
312
+ var $otherAnswer;
313
+ var $resultsType;
314
+ var $blockRepeatVotersType;
315
+ var $blockExpiration;
316
+ var $comments;
317
+ var $makePublic;
318
+ var $closePoll;
319
+ var $closePollNow;
320
+ var $closeDate;
321
+ var $styleID;
322
+ var $packID;
323
+ var $folderID;
324
+ var $languageID;
325
+ var $parentID;
326
+ var $keyword;
327
+ var $sharing;
328
+ var $rank;
329
+ var $url;
330
+ var $choices;
331
+ var $mediaType; // new
332
+ var $mediaCode; // new
333
+ var $answers;
334
+ }
335
+
336
+ class PollDaddy_Poll_Result extends PollDaddy_XML_Object {
337
+ var $___name = 'result';
338
+
339
+ var $_id;
340
+
341
+ var $answers;
342
+ var $otherAnswers;
343
+ }
344
+
345
+ class PollDaddy_Poll_Answers extends PollDaddy_XML_Object {
346
+ var $___name = 'answers';
347
+
348
+ var $answer;
349
+ }
350
+
351
+ class PollDaddy_Poll_Answer extends PollDaddy_XML_Object {
352
+ var $___cdata = array( '___content', 'text', 'mediaCode' );
353
+ var $___name = 'answer';
354
+
355
+ var $_id;
356
+ var $_total;
357
+ var $_percent;
358
+ var $_mediaType; // old way
359
+ var $_mediaCode; // old way
360
+
361
+ var $___content;
362
+
363
+ var $text; //removed ___content and replaced it with text node
364
+ var $mediaType; // new
365
+ var $mediaCode; // new
366
+ }
367
+
368
+ class PollDaddy_Other_Answers extends PollDaddy_XML_Object {
369
+ var $___name = 'otherAnswers';
370
+
371
+ var $otherAnswer;
372
+ }
373
+
374
+ class PollDaddy_Other_Answer extends PollDaddy_XML_Object {
375
+ var $___cdata = array( '___content' );
376
+ var $___name = 'otherAnswer';
377
+
378
+ var $___content;
379
+ }
380
+
381
+ class PollDaddy_Comments extends PollDaddy_XML_Object {
382
+ var $___cdata = array( '___content' );
383
+ var $___name = 'comments';
384
+
385
+ var $___content;
386
+
387
+ var $_id;
388
+
389
+ var $comment;
390
+ }
391
+
392
+ class PollDaddy_Comment extends PollDaddy_XML_Object {
393
+ var $___cdata = array( 'name', 'email', 'text', 'url' );
394
+ var $___name = 'comment';
395
+
396
+ var $_id; //_ means variable corresponds to an attribute
397
+ var $_method;
398
+ var $_type;
399
+
400
+ var $poll; // without _ means variable corresponds to an element
401
+ var $name;
402
+ var $email;
403
+ var $text;
404
+ var $url;
405
+ var $date;
406
+ var $ip;
407
+ }
408
+
409
+ class PollDaddy_Extensions extends PollDaddy_XML_Object {
410
+ var $___name = 'extensions';
411
+
412
+ var $folders;
413
+ var $styles;
414
+ var $packs;
415
+ var $languages;
416
+ }
417
+
418
+ class PollDaddy_Folders extends PollDaddy_XML_Object {
419
+ var $___name = 'folders';
420
+
421
+ var $folder;
422
+ }
423
+
424
+ class PollDaddy_Folder extends PollDaddy_XML_Object {
425
+ var $___cdata = array( '___content' );
426
+ var $___name = 'folder';
427
+
428
+ var $___content;
429
+
430
+ var $_id;
431
+ }
432
+
433
+ class PollDaddy_Styles extends PollDaddy_XML_Object {
434
+ var $___name = 'styles';
435
+
436
+ var $style;
437
+ }
438
+
439
+ class PollDaddy_Style extends PollDaddy_XML_Object {
440
+ var $___cdata = array( 'title', 'css' );
441
+ var $___name = 'style';
442
+
443
+ var $_id;
444
+ var $_type;
445
+ var $_retro;
446
+
447
+ var $title;
448
+ var $date;
449
+ var $css;
450
+ }
451
+
452
+ class PollDaddy_Packs extends PollDaddy_XML_Object {
453
+ var $___name = 'packs';
454
+
455
+ var $pack;
456
+ }
457
+
458
+ class PollDaddy_Pack extends PollDaddy_XML_Object {
459
+ var $___name = 'pack';
460
+
461
+ var $_id;
462
+ var $_date;
463
+ var $_retro;
464
+
465
+ var $pack;
466
+ }
467
+
468
+ class Custom_Pack extends PollDaddy_XML_Object {
469
+ var $___name = 'pack';
470
+
471
+ var $_type = 'user'; //type attribute is constant (for now)
472
+
473
+ var $title;
474
+ var $phrase;
475
+
476
+ function xml( $prepend_ns = true, $pad = 0 ) {
477
+ $xml = parent::xml( false, $pad );
478
+ return $xml;
479
+ }
480
+ }
481
+
482
+ class Custom_Pack_Phrase extends PollDaddy_XML_Object {
483
+ var $___cdata = array( '___content' );
484
+ var $___name = 'phrase';
485
+
486
+ var $___content;
487
+
488
+ var $_phraseID;
489
+
490
+ function xml( $prepend_ns = true, $pad = 0 ) {
491
+ $xml = parent::xml( false, $pad );
492
+ return $xml;
493
+ }
494
+ }
495
+
496
+ class PollDaddy_Languages extends PollDaddy_XML_Object {
497
+ var $___name = 'languages';
498
+
499
+ var $language;
500
+ }
501
+
502
+ class PollDaddy_Language extends PollDaddy_XML_Object {
503
+ var $___cdata = array( '___content' );
504
+ var $___name = 'language';
505
+
506
+ var $___content;
507
+
508
+ var $_id;
509
+ }
510
+
511
+ class PollDaddy_Activity extends PollDaddy_XML_Object {
512
+ var $___cdata = array( '___content' );
513
+ var $___name = 'activity';
514
+
515
+ var $___content;
516
+ }
517
+
518
+ class PollDaddy_Nonce extends PollDaddy_XML_Object {
519
+ var $___cdata = array( 'text', 'action' );
520
+ var $___name = 'nonce';
521
+
522
+ var $text;
523
+ var $action;
524
+ var $userCode;
525
+ }
526
+
527
+ class PollDaddy_Rating_Result extends PollDaddy_XML_Object {
528
+ var $___name = 'rating_result';
529
+
530
+ var $_id;
531
+
532
+ var $ratings;
533
+ }
534
+
535
+ class PollDaddy_Ratings extends PollDaddy_XML_Object {
536
+ var $___name = 'ratings';
537
+
538
+ var $_total;
539
+ var $rating;
540
+ }
541
+
542
+ class PollDaddy_Rating extends PollDaddy_XML_Object {
543
+ var $___name = 'rating';
544
+ var $___cdata = array( 'settings', 'name', 'title', 'permalink' );
545
+
546
+ var $_id;
547
+
548
+ var $_type;
549
+ var $_votes;
550
+ var $uid;
551
+ var $total1;
552
+ var $total2;
553
+ var $total3;
554
+ var $total4;
555
+ var $total5;
556
+ var $average_rating;
557
+ var $date;
558
+ var $title;
559
+ var $permalink;
560
+
561
+ var $name;
562
+ var $folder_id;
563
+ var $settings;
564
+ }
565
+
566
+ class PollDaddy_Email extends PollDaddy_XML_Object {
567
+ var $___cdata = array( 'custom' );
568
+ var $___name = 'emailAddress';
569
+
570
+ var $_id;
571
+ var $_owner;
572
+
573
+ var $folderID;
574
+ var $address;
575
+ var $firstname;
576
+ var $lastname;
577
+ var $custom;
578
+ var $status;
579
+ }
580
+
581
+ class PollDaddy_Email_Message extends PollDaddy_XML_Object {
582
+ var $___cdata = array( 'text' );
583
+ var $___name = 'message';
584
+
585
+ var $_id;
586
+ var $_owner;
587
+
588
+ var $text;
589
+ var $groups;
590
+ }
591
+
592
+ class PollDaddy_XML_Parser {
593
+ var $parser;
594
+ var $polldaddy_objects = array(
595
+ 'http://api.polldaddy.com/pdapi.xsd:pdAccess' => 'PollDaddy_Access',
596
+ 'http://api.polldaddy.com/pdapi.xsd:pdInitiate' => 'PollDaddy_Initiate',
597
+ 'http://api.polldaddy.com/pdapi.xsd:pdRequest' => 'PollDaddy_Request',
598
+ 'http://api.polldaddy.com/pdapi.xsd:pdResponse' => 'PollDaddy_Response',
599
+ 'http://api.polldaddy.com/pdapi.xsd:errors' => 'PollDaddy_Errors',
600
+ 'http://api.polldaddy.com/pdapi.xsd:error' => 'PollDaddy_Error',
601
+ 'http://api.polldaddy.com/pdapi.xsd:demands' => 'PollDaddy_Demands',
602
+ 'http://api.polldaddy.com/pdapi.xsd:demand' => 'PollDaddy_Demand',
603
+ 'http://api.polldaddy.com/pdapi.xsd:queries' => 'PollDaddy_Queries',
604
+ 'http://api.polldaddy.com/pdapi.xsd:query' => 'PollDaddy_Query',
605
+ 'http://api.polldaddy.com/pdapi.xsd:account' => 'PollDaddy_Account',
606
+ 'http://api.polldaddy.com/pdapi.xsd:list' => 'PollDaddy_List',
607
+ 'http://api.polldaddy.com/pdapi.xsd:polls' => 'PollDaddy_Polls',
608
+ 'http://api.polldaddy.com/pdapi.xsd:search' => 'PollDaddy_Search',
609
+ 'http://api.polldaddy.com/pdapi.xsd:poll' => 'PollDaddy_Poll',
610
+ 'http://api.polldaddy.com/pdapi.xsd:emailAddress' => 'PollDaddy_Email',
611
+ 'http://api.polldaddy.com/pdapi.xsd:message' => 'PollDaddy_Email_Message',
612
+ 'http://api.polldaddy.com/pdapi.xsd:answers' => 'PollDaddy_Poll_Answers',
613
+ 'http://api.polldaddy.com/pdapi.xsd:answer' => 'PollDaddy_Poll_Answer',
614
+ 'http://api.polldaddy.com/pdapi.xsd:otherAnswers' => 'PollDaddy_Other_Answers',
615
+ 'http://api.polldaddy.com/pdapi.xsd:result' => 'PollDaddy_Poll_Result',
616
+ 'http://api.polldaddy.com/pdapi.xsd:comments' => 'PollDaddy_Comments',
617
+ 'http://api.polldaddy.com/pdapi.xsd:comment' => 'PollDaddy_Comment',
618
+ 'http://api.polldaddy.com/pdapi.xsd:extensions' => 'PollDaddy_Extensions',
619
+ 'http://api.polldaddy.com/pdapi.xsd:folders' => 'PollDaddy_Folders',
620
+ 'http://api.polldaddy.com/pdapi.xsd:folder' => 'PollDaddy_Folder',
621
+ 'http://api.polldaddy.com/pdapi.xsd:styles' => 'PollDaddy_Styles',
622
+ 'http://api.polldaddy.com/pdapi.xsd:style' => 'PollDaddy_Style',
623
+ 'http://api.polldaddy.com/pdapi.xsd:packs' => 'PollDaddy_Packs',
624
+ 'http://api.polldaddy.com/pdapi.xsd:pack' => 'PollDaddy_Pack',
625
+ 'http://api.polldaddy.com/pdapi.xsd:languages' => 'PollDaddy_Languages',
626
+ 'http://api.polldaddy.com/pdapi.xsd:language' => 'PollDaddy_Language',
627
+ 'http://api.polldaddy.com/pdapi.xsd:activity' => 'PollDaddy_Activity',
628
+ 'pack' => 'Custom_Pack',
629
+ 'phrase' => 'Custom_Pack_Phrase',
630
+ 'http://api.polldaddy.com/pdapi.xsd:rating_result' => 'PollDaddy_Rating_Result',
631
+ 'http://api.polldaddy.com/pdapi.xsd:ratings' => 'PollDaddy_Ratings',
632
+ 'http://api.polldaddy.com/pdapi.xsd:rating' => 'PollDaddy_Rating',
633
+ 'http://api.polldaddy.com/pdapi.xsd:nonce' => 'PollDaddy_Nonce',
634
+ 'http://api.polldaddy.com/pdapi.xsd:partner' => 'PollDaddy_Partner'
635
+ );// the parser matches the tag names to the class name and creates an object defined by that class
636
+
637
+ var $object_stack = array();
638
+ var $object_pos = null;
639
+
640
+ var $objects = array();
641
+
642
+ function PollDaddy_XML_Parser( $xml = null ) {
643
+ if ( is_null( $xml ) )
644
+ return;
645
+
646
+ return $this->parse( $xml );
647
+ }
648
+
649
+ function parse( $xml ) {
650
+ $this->parser = xml_parser_create_ns( 'UTF-8' );
651
+ xml_set_object( $this->parser, $this );
652
+ xml_set_element_handler( $this->parser, 'tag_open', 'tag_close' );
653
+ xml_set_character_data_handler( $this->parser, 'text' );
654
+ xml_parser_set_option( $this->parser, XML_OPTION_CASE_FOLDING, 0 );
655
+ xml_parser_set_option( $this->parser, XML_OPTION_SKIP_WHITE, 1 );
656
+
657
+ xml_parse( $this->parser, $xml );
658
+ xml_parser_free( $this->parser );
659
+ return $this->objects;
660
+ }
661
+
662
+ function tag_open( &$parser, $tag, $attributes ) {
663
+ $object_pos = $this->object_pos;
664
+ if ( $this->object_stack ) {
665
+ if ( isset( $this->object_stack[$object_pos]['args'][$tag] ) ) {
666
+ if ( is_array( $this->object_stack[$object_pos]['args'][$tag] ) ) {
667
+ $this->object_stack[$object_pos]['args'][$tag][] = false;
668
+ } else {
669
+ $this->object_stack[$object_pos]['args'][$tag] = array( $this->object_stack[$object_pos]['args'][$tag], false );
670
+ }
671
+ end( $this->object_stack[$object_pos]['args'][$tag] );
672
+ $this->object_stack[$object_pos]['args_tag_pos'] = key( $this->object_stack[$object_pos]['args'][$tag] );
673
+ } else {
674
+ $this->object_stack[$object_pos]['args'][$tag] = false;
675
+ }
676
+ $this->object_stack[$object_pos]['args_tag'] = $tag;
677
+ }
678
+
679
+ if ( isset( $this->polldaddy_objects[$tag] ) ) {
680
+ $this->object_stack[] = array(
681
+ 'tag' => $tag,
682
+ 'atts' => $attributes,
683
+ 'args' => array(),
684
+ 'parent' => $this->object_pos,
685
+ 'args_tag' => null,
686
+ 'args_tag_pos' => null
687
+ );
688
+ end( $this->object_stack );
689
+ $this->object_pos = key( $this->object_stack );
690
+ }
691
+ }
692
+
693
+ function text( &$parser, $text ) {
694
+ if ( !$this->object_stack )
695
+ return;
696
+
697
+ $text = trim( $text );
698
+ if ( !strlen( $text ) )
699
+ return;
700
+
701
+ if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
702
+ if ( isset($this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']]) )
703
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] .= $text;
704
+ else
705
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] = $text;
706
+ } elseif ( $this->object_stack[$this->object_pos]['args_tag'] ) {
707
+ if ( isset($this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']]) )
708
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] .= $text;
709
+ else
710
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] = $text;
711
+ } else {
712
+ if ( isset($this->object_stack[$this->object_pos]['args']['___content']) )
713
+ $this->object_stack[$this->object_pos]['args']['___content'] .= $text;
714
+ else
715
+ $this->object_stack[$this->object_pos]['args']['___content'] = $text;
716
+ }
717
+ }
718
+
719
+ function tag_close( &$parser, $tag ) {
720
+ if ( isset( $this->polldaddy_objects[$tag] ) ) {
721
+ if ( $tag !== $this->object_stack[$this->object_pos]['tag'] )
722
+ die( 'damn' );
723
+
724
+ $new = $this->polldaddy_objects[$tag];
725
+ $new_object =& new $new( $this->object_stack[$this->object_pos]['args'], $this->object_stack[$this->object_pos]['atts'] );
726
+
727
+ if ( is_numeric( $this->object_stack[$this->object_pos]['parent'] ) ) {
728
+ $this->object_pos = $this->object_stack[$this->object_pos]['parent'];
729
+ if ( $this->object_stack[$this->object_pos]['args_tag_pos'] ) {
730
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']][$this->object_stack[$this->object_pos]['args_tag_pos']] =& $new_object;
731
+ } elseif ( $this->object_stack[$this->object_pos]['args_tag'] ) {
732
+ $this->object_stack[$this->object_pos]['args'][$this->object_stack[$this->object_pos]['args_tag']] =& $new_object;
733
+ }
734
+ } else {
735
+ $this->object_pos = null;
736
+ $this->objects[] =& $new_object;
737
+ }
738
+
739
+ array_pop( $this->object_stack );
740
+ }
741
+ }
742
+ }
743
+ ?>
polldaddy.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){ $('.hide-if-js').hide(); $('.empty-if-js').empty(); $('.hide-if-no-js').removeClass( 'hide-if-no-js' ); $('a.delete-poll').click( function() { return confirm( 'Are you sure you want to delete "' + $(this).parents( 'td' ).find( 'strong' ).text() + '"?' ); } ); $('span.view a.thickbox').attr( 'href', function() { return $(this).attr( 'href' ) + '&iframe&TB_iframe=true'; } ); var delAnswerPrep = function( context ) { $('a.delete-answer', context || null ).click( function() { if ( confirm( 'Are you sure you want to delete this answer?' ) ) { $(this).parents( 'li' ).remove(); $('#choices option:last-child').remove(); } return false; } ); }; delAnswerPrep(); $('#answers').sortable( { axis: 'y', containment: 'parent', handle: '.handle', tolerance: 'pointer' } ); $('#add-answer-holder').show().find( 'button').click( function() { var aa = ( 1 + $('#answers li').size() ).toString();delAnswerPrep( $('#answers').append( '<li><span class="handle">&#x2195;</span><div><input type="text" name="answer[new' + aa + ']" size="30" tabindex="2" value="" autocomplete="off" /></div><a title="delete this answer" class="delete-answer delete" href="#">&times;</a></li>' ).find( 'li:last' ) ); $('#choices').append('<option value="'+aa+'">'+aa+'</option>'); return false; } ); var win = window.dialogArguments || opener || parent || top; $('.polldaddy-send-to-editor').click( function() { var pollID = $(this).siblings('.polldaddy-poll-id').val(); if ( !pollID ) pollID = $('.polldaddy-poll-id:first').val(); win.send_to_editor( '[polldaddy poll=' + parseInt( pollID ).toString() + ']' ); } ); $('.polldaddy-show-shortcode').toggle( function() { $(this).parents('tr:first').next('tr').fadeIn(); $(this).parents('tr:first').next('tr').show(); return false; }, function() { $(this).parents('tr:first').next('tr').fadeOut(); $(this).parents('tr:first').next('tr').hide(); return false; } );var hiddenStyleID = $(':input[name=styleID]'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); customStyle.change(function() { var customStyleVal = parseInt( customStyle.val() ); hiddenStyleID.val( customStyleVal.toString() ); }); if ( customStyleVal > 0 ) { $('#design_standard').hide(); $('#design_custom').show(); $('.polldaddy-show-design-options').html('Standard Styles'); hiddenStyleID.val( customStyleVal.toString() ); $('.polldaddy-show-design-options').toggle( function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; }, function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{hiddenStyleID.val( 'x' ); } return false; } ); } else{ $('#design_custom').hide(); $('#design_standard').show(); $('.polldaddy-show-design-options').toggle( function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{ hiddenStyleID.val( 'x' ); } return false; }, function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; } ); } $("#multipleChoice").click(function(){ if ($("#multipleChoice").is(":checked")) { $("#numberChoices").show("fast"); } else { $("#numberChoices").hide("fast"); } });$( '.block-repeat' ).click( function(){var repeat = jQuery( this ).val();if( repeat == 'off' ){$( '#cookieip_expiration_label' ).hide();$( '#cookieip_expiration' ).hide();}else{$( '#cookieip_expiration_label' ).show();$( '#cookieip_expiration' ).show();} } ); });
1
+ jQuery(function($){ if ( typeof(window.$) == 'undefined' ){window.$ = jQuery;} $('.hide-if-js').hide(); $('.empty-if-js').empty(); $('.hide-if-no-js').removeClass( 'hide-if-no-js' ); $('a.delete-poll').click( function() { return confirm( 'Are you sure you want to delete "' + $(this).parents( 'td' ).find( 'strong' ).text() + '"?' ); } ); $('span.view a.thickbox').attr( 'href', function() { return $(this).attr( 'href' ) + '&iframe&TB_iframe=true'; } ); var delAnswerPrep = function( context ) { $('a.delete-answer', context || null ).click( function() { if ( confirm( 'Are you sure you want to delete this answer?' ) ) { $(this).parents( 'li' ).remove(); $('#choices option:last-child').remove(); } return false; } ); }; delAnswerPrep(); $('#answers').sortable( { axis: 'y', containment: 'parent', handle: '.handle', tolerance: 'pointer' } ); $('#add-answer-holder').show().find( 'button').click( function() { var aa = ( 1 + $('#answers li').size() ).toString();delAnswerPrep( $('#answers').append( '<li><span class="handle">&#x2195;</span><div><input type="text" name="answer[new' + aa + ']" size="30" tabindex="2" value="" autocomplete="off" /></div><a title="delete this answer" class="delete-answer delete" href="#">&times;</a></li>' ).find( 'li:last' ) ); $('#choices').append('<option value="'+aa+'">'+aa+'</option>'); return false; } ); var win = window.dialogArguments || opener || parent || top; $('.polldaddy-send-to-editor').click( function() { var pollID = $(this).siblings('.polldaddy-poll-id').val(); if ( !pollID ) pollID = $('.polldaddy-poll-id:first').val(); win.send_to_editor( '[polldaddy poll=' + parseInt( pollID ).toString() + ']' ); } ); $('.polldaddy-show-shortcode').toggle( function() { $(this).parents('tr:first').next('tr').fadeIn(); $(this).parents('tr:first').next('tr').show(); return false; }, function() { $(this).parents('tr:first').next('tr').fadeOut(); $(this).parents('tr:first').next('tr').hide(); return false; } );var hiddenStyleID = $(':input[name=styleID]'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); customStyle.change(function() { var customStyleVal = parseInt( customStyle.val() ); hiddenStyleID.val( customStyleVal.toString() ); }); if ( customStyleVal > 0 ) { $('#design_standard').hide(); $('#design_custom').show(); $('.polldaddy-show-design-options').html('Standard Styles'); hiddenStyleID.val( customStyleVal.toString() ); $('.polldaddy-show-design-options').toggle( function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; }, function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{hiddenStyleID.val( 'x' ); } return false; } ); } else{ $('#design_custom').hide(); $('#design_standard').show(); $('.polldaddy-show-design-options').toggle( function() { $('#design_standard').hide(); $('#design_custom').fadeIn(); $('.polldaddy-show-design-options').html('Standard Styles'); var customStyle = $(':input[name=customSelect]'); var customStyleVal = parseInt( customStyle.val() ); if ( customStyleVal > 0 ){ hiddenStyleID.val( customStyleVal.toString() ); } else{ hiddenStyleID.val( 'x' ); } return false; }, function() { $('#design_custom').hide(); $('#design_standard').fadeIn(); $('.polldaddy-show-design-options').html('Custom Styles'); hiddenStyleID.val( 'x' ); return false; } ); } $("#multipleChoice").click(function(){ if ($("#multipleChoice").is(":checked")) { $("#numberChoices").show("fast"); } else { $("#numberChoices").hide("fast"); } });$( '.block-repeat' ).click( function(){var repeat = jQuery( this ).val();if( repeat == 'off' ){$( '#cookieip_expiration_label' ).hide();$( '#cookieip_expiration' ).hide();}else{$( '#cookieip_expiration_label' ).show();$( '#cookieip_expiration' ).show();} } ); });
polldaddy.php CHANGED
@@ -1,4053 +1,3997 @@
1
- <?php
2
-
3
- /*
4
- Plugin Name: PollDaddy Polls
5
- Description: Create and manage PollDaddy polls and ratings in WordPress
6
- Author: Automattic, Inc.
7
- Author URL: http://automattic.com/
8
- Version: 1.7.9
9
- */
10
-
11
- // You can hardcode your PollDaddy PartnerGUID (API Key) here
12
- //define( 'WP_POLLDADDY__PARTNERGUID', '12345...' );
13
-
14
- class WP_PollDaddy {
15
- var $errors;
16
- var $base_url;
17
- var $is_admin;
18
- var $is_author;
19
- var $scheme;
20
- var $version;
21
- var $polldaddy_client_class;
22
- var $polldaddy_clients;
23
- var $id;
24
- var $multiple_accounts;
25
- var $user_code;
26
-
27
- function WP_PollDaddy(){
28
- $this ->__construct();
29
- }
30
-
31
- function __construct() {
32
- global $current_user;
33
- $this->errors = new WP_Error;
34
- $this->scheme = 'https';
35
- $this->version = '1.7.9';
36
- $this->multiple_accounts = true;
37
- $this->polldaddy_client_class = 'api_client';
38
- $this->polldaddy_clients = array();
39
- $this->is_admin = (bool) current_user_can('manage_options');
40
- $this->is_author = true;
41
- $this->id = (int) $current_user->ID;
42
- $this->user_code = null;
43
- }
44
-
45
- function &get_client( $api_key, $userCode = null ) {
46
- if ( isset( $this->polldaddy_clients[$api_key] ) ) {
47
- if ( !is_null( $userCode ) )
48
- $this->polldaddy_clients[$api_key]->userCode = $userCode;
49
- return $this->polldaddy_clients[$api_key];
50
- }
51
- require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
52
- $this->polldaddy_clients[$api_key] = new $this->polldaddy_client_class( $api_key, $userCode );
53
- return $this->polldaddy_clients[$api_key];
54
- }
55
-
56
- function admin_menu() {
57
- if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
58
- $guid = get_option( 'polldaddy_api_key' );
59
- if ( !$guid || !is_string( $guid ) )
60
- $guid = false;
61
- define( 'WP_POLLDADDY__PARTNERGUID', $guid );
62
- }
63
-
64
- if ( !WP_POLLDADDY__PARTNERGUID ) {
65
- if ( function_exists( 'add_object_page' ) ) // WP 2.7+
66
- $hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
67
- else
68
- $hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ) );
69
-
70
- add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
71
-
72
- if ( function_exists( 'add_object_page' ) ) // WP 2.7+
73
- $hook = add_object_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
74
- else
75
- $hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
76
-
77
- add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
78
- if ( ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] ) && ( empty( $_GET['page'] ) || 'ratings' != $_GET['page'] ) )
79
- add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
80
- return false;
81
- }
82
-
83
- if ( function_exists( 'add_object_page' ) ) // WP 2.7+
84
- $hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
85
- else
86
- $hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
87
-
88
- add_action( "load-$hook", array( &$this, 'management_page_load' ) );
89
-
90
- if ( function_exists( 'add_object_page' ) ) // WP 2.7+
91
- $hook = add_object_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
92
- else
93
- $hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
94
-
95
- add_action( "load-$hook", array( &$this, 'management_page_load' ) );
96
-
97
- if ( $this->is_admin ) {
98
- add_submenu_page( 'ratings', __( 'Ratings &ndash; Settings', 'polldaddy' ), __( 'Settings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
99
- add_submenu_page( 'ratings', __( 'Ratings &ndash; Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings&amp;action=reports', array( &$this, 'management_page' ) );
100
- }
101
- else{
102
- add_submenu_page( 'ratings', __( 'Ratings &ndash; Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
103
- }
104
-
105
- add_submenu_page( 'polls', __( 'Polls', 'polldaddy' ), __( 'Edit', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
106
-
107
- if ( $this->is_author ) {
108
- add_submenu_page( 'polls', __( 'Add New Poll', 'polldaddy' ), __( 'Add New', 'polldaddy' ), 'edit_posts', 'polls&amp;action=create-poll', array( &$this, 'management_page' ) );
109
- add_submenu_page( 'polls', __( 'Custom Styles', 'polldaddy' ), __( 'Custom Styles', 'polldaddy' ), 'edit_posts', 'polls&amp;action=list-styles', array( &$this, 'management_page' ) );
110
- add_submenu_page( 'polls', __( 'Options', 'polldaddy' ), __( 'Options', 'polldaddy' ), 'edit_posts', 'polls&amp;action=options', array( &$this, 'management_page' ) );
111
- }
112
-
113
- add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
114
- }
115
-
116
- function api_key_page_load() {
117
- if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
118
- return false;
119
-
120
- check_admin_referer( 'polldaddy-account' );
121
-
122
- $polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
123
- $polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
124
-
125
- if ( !$polldaddy_email )
126
- $this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
127
-
128
- if ( !$polldaddy_password )
129
- $this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
130
-
131
- if ( $this->errors->get_error_codes() )
132
- return false;
133
-
134
- $details = array(
135
- 'uName' => get_bloginfo( 'name' ),
136
- 'uEmail' => $polldaddy_email,
137
- 'uPass' => $polldaddy_password,
138
- 'partner_userid' => $this->id
139
- );
140
- if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
141
- $polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
142
- 'body' => $details
143
- ) );
144
- if ( is_wp_error( $polldaddy_api_key ) ) {
145
- $this->errors = $polldaddy_api_key;
146
- return false;
147
- }
148
- $polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
149
- } else {
150
- $fp = fsockopen(
151
- 'api.polldaddy.com',
152
- 80,
153
- $err_num,
154
- $err_str,
155
- 3
156
- );
157
-
158
- if ( !$fp ) {
159
- $this->errors->add( 'connect', __( "Can't connect to PollDaddy.com", 'polldaddy' ) );
160
- return false;
161
- }
162
-
163
- if ( function_exists( 'stream_set_timeout' ) )
164
- stream_set_timeout( $fp, 3 );
165
-
166
- global $wp_version;
167
-
168
- $request_body = http_build_query( $details, null, '&' );
169
-
170
- $request = "POST /key.php HTTP/1.0\r\n";
171
- $request .= "Host: api.polldaddy.com\r\n";
172
- $request .= "User-agent: WordPress/$wp_version\r\n";
173
- $request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
174
- $request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
175
-
176
- fwrite( $fp, "$request\r\n$request_body" );
177
-
178
- $response = '';
179
- while ( !feof( $fp ) )
180
- $response .= fread( $fp, 4096 );
181
- fclose( $fp );
182
- list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
183
- }
184
-
185
- if ( !$polldaddy_api_key ) {
186
- $this->errors->add( 'polldaddy_password', __( 'Invalid Account', 'polldaddy' ) );
187
- return false;
188
- }
189
-
190
- update_option( 'polldaddy_api_key', $polldaddy_api_key );
191
-
192
- $polldaddy = $this->get_client( $polldaddy_api_key );
193
- $polldaddy->reset();
194
- if ( !$polldaddy->get_usercode( $this->id ) ) {
195
- $this->parse_errors( $polldaddy );
196
- $this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
197
- return false;
198
- }
199
-
200
- return true;
201
- }
202
-
203
- function parse_errors( &$polldaddy ) {
204
- if ( $polldaddy->errors )
205
- foreach ( $polldaddy->errors as $code => $error )
206
- $this->errors->add( $code, $error );
207
- if ( isset( $this->errors->errors[4] ) ) {
208
- $this->errors->errors[4] = array( sprintf( __( 'Obsolete PollDaddy User API Key: <a href="%s">Sign in again to re-authenticate</a>', 'polldaddy' ), add_query_arg( array( 'action' => 'signup', 'reaction' => empty( $_GET['action'] ) ? false : $_GET['action'] ) ) ) );
209
- $this->errors->add_data( true, 4 );
210
- }
211
- }
212
-
213
- function print_errors() {
214
- if ( !$error_codes = $this->errors->get_error_codes() )
215
- return;
216
- ?>
217
-
218
- <div class="error">
219
-
220
- <?php
221
-
222
- foreach ( $error_codes as $error_code ) :
223
- foreach ( $this->errors->get_error_messages( $error_code ) as $error_message ) :
224
- ?>
225
-
226
- <p><?php echo $this->errors->get_error_data( $error_code ) ? $error_message : wp_specialchars( $error_message ); ?></p>
227
-
228
- <?php
229
- endforeach;
230
- endforeach;
231
-
232
- $this->errors = new WP_Error;
233
- ?>
234
-
235
- </div>
236
- <br class="clear" />
237
-
238
- <?php
239
- }
240
-
241
- function api_key_page() {
242
- $this->print_errors();
243
- ?>
244
-
245
- <div class="wrap">
246
-
247
- <h2><?php _e( 'PollDaddy Account', 'polldaddy' ); ?></h2>
248
-
249
- <p><?php printf( __( 'Before you can use the PollDaddy plugin, you need to enter your <a href="%s">PollDaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
250
-
251
- <form action="" method="post">
252
- <table class="form-table">
253
- <tbody>
254
- <tr class="form-field form-required">
255
- <th valign="top" scope="row">
256
- <label for="polldaddy-email"><?php _e( 'PollDaddy Email Address', 'polldaddy' ); ?></label>
257
- </th>
258
- <td>
259
- <input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" />
260
- </td>
261
- </tr>
262
- <tr class="form-field form-required">
263
- <th valign="top" scope="row">
264
- <label for="polldaddy-password"><?php _e( 'PollDaddy Password', 'polldaddy' ); ?></label>
265
- </th>
266
- <td>
267
- <input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
268
- </td>
269
- </tr>
270
- </tbody>
271
- </table>
272
- <p class="submit">
273
- <?php wp_nonce_field( 'polldaddy-account' ); ?>
274
- <input type="hidden" name="action" value="account" />
275
- <input type="hidden" name="account" value="import" />
276
- <input type="submit" value="<?php echo attribute_escape( __( 'Submit', 'polldaddy' ) ); ?>" />
277
- </p>
278
- </form>
279
- </div>
280
-
281
- <?php
282
- }
283
-
284
- function media_buttons() {
285
- $title = __( 'Add Poll', 'polldaddy' );
286
- echo "<a href='admin.php?page=polls&amp;iframe&amp;TB_iframe=true' onclick='return false;' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}polldaddy.png' alt='$title' /></a>";
287
- }
288
-
289
- function management_page_load() {
290
- global $plugin_page;
291
-
292
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
293
- $polldaddy->reset();
294
-
295
- if ( empty( $this->user_code ) ){
296
- $this->user_code = $polldaddy->get_usercode( $this->id );
297
- }
298
-
299
- wp_reset_vars( array( 'page', 'action', 'poll', 'style', 'rating' ) );
300
- global $page, $action, $poll, $style, $rating;
301
-
302
- if ( empty( $this->user_code ) ){
303
- $action = 'signup';
304
- $page = 'polls';
305
- }
306
-
307
- require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
308
-
309
- wp_enqueue_script( 'polls', "{$this->base_url}polldaddy.js", array( 'jquery', 'jquery-ui-sortable' ), $this->version );
310
- wp_enqueue_script( 'polls-common', "{$this->base_url}common.js", array(), $this->version );
311
-
312
- if( $page == 'polls' ) {
313
- if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
314
- $action = '';
315
- }
316
-
317
- switch ( $action ) :
318
- case 'edit' :
319
- case 'edit-poll' :
320
- case 'create-poll' :
321
- wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/poll-style-picker.js", array(), $this->version );
322
-
323
- if ( $action == 'create-poll' )
324
- $plugin_page = 'polls&amp;action=create-poll';
325
-
326
- break;
327
- case 'edit-style' :
328
- case 'create-style' :
329
- wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/style-editor.js", array(), $this->version );
330
- wp_enqueue_script( 'polls-style-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
331
- wp_enqueue_style( 'polls', "{$this->base_url}style-editor.css", array(), $this->version );
332
- break;
333
- case 'list-styles' :
334
- $plugin_page = 'polls&amp;action=list-styles';
335
- break;
336
- case 'options' :
337
- case 'update-options' :
338
- case 'import-account' :
339
- $plugin_page = 'polls&amp;action=options';
340
- break;
341
- endswitch;
342
- } elseif( $page == 'ratings' ) {
343
- if ( !$this->is_admin && !in_array( $action, array( 'change-report', 'reports' ) ) ) {//check user privileges has access to action
344
- $action = 'reports';
345
- }
346
- switch ( $action ) :
347
- case 'change-report' :
348
- case 'reports' :
349
- $plugin_page = 'ratings&amp;action=reports';
350
- break;
351
- default :
352
- wp_enqueue_script( 'rating-text-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
353
- wp_enqueue_script( 'ratings', 'http://i.polldaddy.com/ratings/rating.js', array(), $this->version );
354
- wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
355
- 'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
356
- 'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
357
- endswitch;
358
- }
359
-
360
- wp_enqueue_script( 'admin-forms' );
361
- add_thickbox();
362
-
363
- wp_enqueue_style( 'polls', "{$this->base_url}polldaddy.css", array( 'global', 'wp-admin' ), $this->version );
364
- add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
365
-
366
- add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
367
-
368
- $query_args = array();
369
- $args = array();
370
-
371
- $allowedtags = array(
372
- 'a' => array(
373
- 'href' => array (),
374
- 'title' => array (),
375
- 'target' => array ()),
376
- 'img' => array(
377
- 'alt' => array (),
378
- 'align' => array (),
379
- 'border' => array (),
380
- 'class' => array (),
381
- 'height' => array (),
382
- 'hspace' => array (),
383
- 'longdesc' => array (),
384
- 'vspace' => array (),
385
- 'src' => array (),
386
- 'width' => array ()),
387
- 'abbr' => array(
388
- 'title' => array ()),
389
- 'acronym' => array(
390
- 'title' => array ()),
391
- 'b' => array(),
392
- 'blockquote' => array(
393
- 'cite' => array ()),
394
- 'cite' => array (),
395
- 'em' => array (),
396
- 'i' => array (),
397
- 'q' => array(
398
- 'cite' => array ()),
399
- 'strike' => array(),
400
- 'strong' => array()
401
- );
402
-
403
- $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
404
-
405
- if( $page == 'polls' ) {
406
- switch ( $action ) :
407
- case 'signup' : // sign up for first time
408
- case 'account' : // reauthenticate
409
- case 'import-account' : // reauthenticate
410
- if ( !$is_POST )
411
- return;
412
-
413
- check_admin_referer( 'polldaddy-account' );
414
-
415
- if ( $new_args = $this->management_page_load_signup() )
416
- $query_args = array_merge( $query_args, $new_args );
417
- if ( $this->errors->get_error_codes() )
418
- return false;
419
-
420
- $query_args['message'] = 'imported-account';
421
-
422
- wp_reset_vars( array( 'action' ) );
423
- if ( !empty( $_GET['reaction'] ) )
424
- $query_args['action'] = $_GET['reaction'];
425
- elseif ( !empty( $_GET['action'] ) && 'account' == $_GET['action'] )
426
- $query_args['action'] = $_GET['action'];
427
- else
428
- $query_args['action'] = false;
429
- break;
430
-
431
- case 'delete' :
432
- if ( empty( $poll ) )
433
- return;
434
-
435
- if ( is_array( $poll ) )
436
- check_admin_referer( 'action-poll_bulk' );
437
- else
438
- check_admin_referer( "delete-poll_$poll" );
439
-
440
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
441
-
442
- foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
443
- $polldaddy->reset();
444
- $poll_object = $polldaddy->get_poll( $poll );
445
-
446
- if ( !$this->can_edit( $poll_object ) ) {
447
- $this->errors->add( 'permission', __( 'You are not allowed to delete this poll.', 'polldaddy' ) );
448
- return false;
449
- }
450
-
451
- // Send Poll Author credentials
452
- if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
453
- $polldaddy->reset();
454
- if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
455
- $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
456
- }
457
- $polldaddy->userCode = $userCode;
458
- }
459
-
460
- $polldaddy->reset();
461
- $polldaddy->delete_poll( $poll_id );
462
- }
463
-
464
- $query_args['message'] = 'deleted';
465
- $query_args['deleted'] = count( (array) $poll );
466
- break;
467
- case 'open' :
468
- if ( empty( $poll ) )
469
- return;
470
-
471
- if ( is_array( $poll ) )
472
- check_admin_referer( 'action-poll_bulk' );
473
- else
474
- check_admin_referer( "open-poll_$poll" );
475
-
476
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
477
-
478
- foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
479
- $polldaddy->reset();
480
- $poll_object = $polldaddy->get_poll( $poll );
481
-
482
- if ( !$this->can_edit( $poll_object ) ) {
483
- $this->errors->add( 'permission', __( 'You are not allowed to open this poll.', 'polldaddy' ) );
484
- return false;
485
- }
486
-
487
- // Send Poll Author credentials
488
- if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
489
- $polldaddy->reset();
490
- if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
491
- $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
492
- }
493
- $polldaddy->userCode = $userCode;
494
- }
495
-
496
- $polldaddy->reset();
497
- $polldaddy->open_poll( $poll_id );
498
- }
499
-
500
- $query_args['message'] = 'opened';
501
- $query_args['opened'] = count( (array) $poll );
502
- break;
503
- case 'close' :
504
- if ( empty( $poll ) )
505
- return;
506
-
507
- if ( is_array( $poll ) )
508
- check_admin_referer( 'action-poll_bulk' );
509
- else
510
- check_admin_referer( "close-poll_$poll" );
511
-
512
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
513
-
514
- foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
515
- $polldaddy->reset();
516
- $poll_object = $polldaddy->get_poll( $poll );
517
-
518
- if ( !$this->can_edit( $poll_object ) ) {
519
- $this->errors->add( 'permission', __( 'You are not allowed to close this poll.', 'polldaddy' ) );
520
- return false;
521
- }
522
-
523
- // Send Poll Author credentials
524
- if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
525
- $polldaddy->reset();
526
- if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
527
- $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
528
- }
529
- $polldaddy->userCode = $userCode;
530
- }
531
-
532
- $polldaddy->reset();
533
- $polldaddy->close_poll( $poll_id );
534
- }
535
-
536
- $query_args['message'] = 'closed';
537
- $query_args['closed'] = count( (array) $poll );
538
- break;
539
- case 'edit-poll' : // TODO: use polldaddy_poll
540
- if ( !$is_POST || !$poll = (int) $poll )
541
- return;
542
-
543
- check_admin_referer( "edit-poll_$poll" );
544
-
545
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
546
- $polldaddy->reset();
547
-
548
- $poll_object = $polldaddy->get_poll( $poll );
549
- $this->parse_errors( $polldaddy );
550
-
551
- if ( !$this->can_edit( $poll_object ) ) {
552
- $this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
553
- return false;
554
- }
555
-
556
- // Send Poll Author credentials
557
-
558
- if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
559
- $polldaddy->reset();
560
- if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
561
- $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
562
- }
563
- $this->parse_errors( $polldaddy );
564
- $polldaddy->userCode = $userCode;
565
- }
566
-
567
- if ( !$poll_object )
568
- $this->errors->add( 'GetPoll', __( 'Poll not found', 'polldaddy' ) );
569
-
570
- if ( $this->errors->get_error_codes() )
571
- return false;
572
-
573
- $poll_data = get_object_vars( $poll_object );
574
- foreach ( $poll_data as $key => $value )
575
- if ( '_' === $key[0] )
576
- unset( $poll_data[$key] );
577
-
578
- foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
579
- if ( isset( $_POST[$option] ) && $_POST[$option] )
580
- $poll_data[$option] = 'yes';
581
- else
582
- $poll_data[$option] = 'no';
583
- }
584
-
585
- $blocks = array( 'off', 'cookie', 'cookieip' );
586
- if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
587
- $poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
588
-
589
- $results = array( 'show', 'percent', 'hide' );
590
- if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
591
- $poll_data['resultsType'] = $_POST['resultsType'];
592
- $poll_data['question'] = stripslashes( $_POST['question'] );
593
-
594
- if ( empty( $_POST['answer'] ) || !is_array( $_POST['answer'] ) )
595
- $this->errors->add( 'answer', __( 'Invalid answers', 'polldaddy' ) );
596
-
597
- $answers = array();
598
- foreach ( $_POST['answer'] as $answer_id => $answer ) {
599
- if ( !$answer = trim( stripslashes( $answer ) ) )
600
- continue;
601
-
602
- $args['text'] = wp_kses( $answer, $allowedtags );
603
-
604
- if ( is_numeric( $answer_id ) )
605
- $answers[] = polldaddy_poll_answer( $args, $answer_id );
606
- else
607
- $answers[] = polldaddy_poll_answer( $args );
608
- }
609
-
610
- if ( 2 > count( $answers ) )
611
- $this->errors->add( 'answer', __( 'You must include at least 2 answers', 'polldaddy' ) );
612
-
613
- if ( $this->errors->get_error_codes() )
614
- return false;
615
-
616
- $poll_data['answers'] = $answers;
617
-
618
- $poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
619
-
620
- if ( isset ( $_POST['styleID'] ) ){
621
- if ( $_POST['styleID'] == 'x' ){
622
- $this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
623
- return false;
624
- }
625
- }
626
- $poll_data['styleID'] = (int) $_POST['styleID'];
627
- $poll_data['choices'] = (int) $_POST['choices'];
628
-
629
- if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
630
- if( isset( $_POST['cookieip_expiration'] ) )
631
- $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
632
- } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
633
- if( isset( $_POST['cookieip_expiration'] ) )
634
- $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
635
- }
636
-
637
- $polldaddy->reset();
638
-
639
- $update_response = $polldaddy->update_poll( $poll, $poll_data );
640
-
641
- $this->parse_errors( $polldaddy );
642
-
643
- if ( !$update_response )
644
- $this->errors->add( 'UpdatePoll', __( 'Poll could not be updated', 'polldaddy' ) );
645
-
646
- if ( $this->errors->get_error_codes() )
647
- return false;
648
-
649
- $query_args['message'] = 'updated';
650
- if ( isset($_POST['iframe']) )
651
- $query_args['iframe'] = '';
652
- break;
653
- case 'create-poll' :
654
- if ( !$is_POST )
655
- return;
656
-
657
- check_admin_referer( 'create-poll' );
658
-
659
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
660
- $polldaddy->reset();
661
-
662
- $answers = array();
663
- foreach ( $_POST['answer'] as $answer ){
664
- if ( !$answer = trim( stripslashes( $answer ) ) )
665
- continue;
666
-
667
- $args['text'] = wp_kses( $answer, $allowedtags );
668
-
669
- $answers[] = polldaddy_poll_answer( $args );
670
- }
671
-
672
- if ( !$answers )
673
- return false;
674
-
675
- $poll_data = _polldaddy_poll_defaults();
676
-
677
- foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
678
- if ( isset( $_POST[$option] ) && $_POST[$option] )
679
- $poll_data[$option] = 'yes';
680
- else
681
- $poll_data[$option] = 'no';
682
- }
683
-
684
- $blocks = array( 'off', 'cookie', 'cookieip' );
685
- if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
686
- $poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
687
-
688
- $results = array( 'show', 'percent', 'hide' );
689
- if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
690
- $poll_data['resultsType'] = $_POST['resultsType'];
691
-
692
- $poll_data['answers'] = $answers;
693
-
694
- $poll_data['question'] = stripslashes( $_POST['question'] );
695
- $poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
696
-
697
- if ( isset ( $_POST['styleID'] ) ){
698
- if ( $_POST['styleID'] == 'x' ){
699
- $this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
700
- return false;
701
- }
702
- }
703
- $poll_data['styleID'] = (int) $_POST['styleID'];
704
- $poll_data['choices'] = (int) $_POST['choices'];
705
-
706
- if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
707
- if( isset( $_POST['cookieip_expiration'] ) )
708
- $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
709
- } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
710
- if( isset( $_POST['cookieip_expiration'] ) )
711
- $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
712
- }
713
-
714
- $poll = $polldaddy->create_poll( $poll_data );
715
- $this->parse_errors( $polldaddy );
716
-
717
- if ( !$poll || empty( $poll->_id ) )
718
- $this->errors->add( 'CreatePoll', __( 'Poll could not be created', 'polldaddy' ) );
719
-
720
- if ( $this->errors->get_error_codes() )
721
- return false;
722
-
723
- $query_args['message'] = 'created';
724
- $query_args['action'] = 'edit-poll';
725
- $query_args['poll'] = $poll->_id;
726
- if ( isset($_POST['iframe']) )
727
- $query_args['iframe'] = '';
728
- break;
729
- case 'delete-style' :
730
- if ( empty( $style ) )
731
- return;
732
-
733
- if ( is_array( $style ) )
734
- check_admin_referer( 'action-style_bulk' );
735
- else
736
- check_admin_referer( "delete-style_$style" );
737
-
738
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
739
-
740
- foreach ( (array) $_REQUEST['style'] as $style_id ) {
741
- $polldaddy->reset();
742
- $polldaddy->delete_style( $style_id );
743
- }
744
-
745
- $query_args['message'] = 'deleted-style';
746
- $query_args['deleted'] = count( (array) $style );
747
- break;
748
- case 'edit-style' :
749
- if ( !$is_POST || !$style = (int) $style )
750
- return;
751
-
752
- check_admin_referer( "edit-style$style" );
753
-
754
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
755
- $polldaddy->reset();
756
-
757
- $style_data = _polldaddy_style_defaults();
758
-
759
- if ( isset($_POST['style-title'] ) )
760
- $style_data['title'] = stripslashes( trim ( (string) $_POST['style-title'] ) );
761
-
762
- if ( isset($_POST['CSSXML'] ) )
763
- $style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
764
-
765
- $update_response = $polldaddy->update_style( $style, $style_data );
766
-
767
- $this->parse_errors( $polldaddy );
768
-
769
- if ( !$update_response )
770
- $this->errors->add( 'UpdateStyle', __( 'Style could not be updated', 'polldaddy' ) );
771
-
772
- if ( $this->errors->get_error_codes() )
773
- return false;
774
-
775
- $query_args['message'] = 'updated-style';
776
- if ( isset($_POST['iframe']) )
777
- $query_args['iframe'] = '';
778
- break;
779
- case 'create-style' :
780
- if ( !$is_POST )
781
- return;
782
-
783
- check_admin_referer( 'create-style' );
784
-
785
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
786
- $polldaddy->reset();
787
-
788
- $style_data = _polldaddy_style_defaults();
789
-
790
- if ( isset($_POST['style-title'] ) )
791
- $style_data['title'] = stripslashes( strip_tags( trim ( (string) $_POST['style-title'] ) ) );
792
-
793
- if ( isset($_POST['CSSXML'] ) )
794
- $style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
795
-
796
- $style = $polldaddy->create_style( $style_data );
797
- $this->parse_errors( $polldaddy );
798
-
799
- if ( !$style || empty( $style->_id ) )
800
- $this->errors->add( 'CreateStyle', __( 'Style could not be created', 'polldaddy' ) );
801
-
802
- if ( $this->errors->get_error_codes() )
803
- return false;
804
-
805
- $query_args['message'] = 'created-style';
806
- $query_args['action'] = 'edit-style';
807
- $query_args['style'] = $style->_id;
808
- if ( isset($_POST['iframe']) )
809
- $query_args['iframe'] = '';
810
- break;
811
- case 'update-options' :
812
- if ( !$is_POST )
813
- return;
814
-
815
- check_admin_referer( 'polldaddy-account' );
816
-
817
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
818
- $polldaddy->reset();
819
-
820
- $poll_defaults = _polldaddy_poll_defaults();
821
-
822
- $user_defaults = array();
823
-
824
- foreach( array( "multipleChoice", "randomiseAnswers", "otherAnswer", "sharing", "resultsType", "styleID", "blockRepeatVotersType", "blockExpiration" ) as $option ){
825
- if ( isset( $poll_defaults[$option] ) && $poll_defaults[$option] )
826
- $user_defaults[$option] = $poll_defaults[$option];
827
- }
828
-
829
- foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
830
- if ( isset( $_POST[$option] ) && $_POST[$option] )
831
- $user_defaults[$option] = 'yes';
832
- else
833
- $user_defaults[$option] = 'no';
834
- }
835
-
836
- $results = array( 'show', 'percent', 'hide' );
837
- if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
838
- $user_defaults['resultsType'] = $_POST['resultsType'];
839
-
840
- if ( isset ( $_POST['styleID'] ) ){
841
- $user_defaults['styleID'] = (int) $_POST['styleID'];
842
- }
843
-
844
- $blocks = array( 'off', 'cookie', 'cookieip' );
845
- if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
846
- $user_defaults['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
847
-
848
- if( isset( $_POST['blockExpiration'] ) )
849
- $user_defaults['blockExpiration'] = (int) $_POST['blockExpiration'];
850
-
851
- $polldaddy->update_poll_defaults( 0, $user_defaults );
852
-
853
- $this->parse_errors( $polldaddy );
854
- if ( $this->errors->get_error_codes() )
855
- return false;
856
-
857
- $query_args['message'] = 'updated-options';
858
- break;
859
- default :
860
- return;
861
- endswitch;
862
- } elseif( $page == 'ratings' ) {
863
- return;
864
- }
865
-
866
- wp_redirect( add_query_arg( $query_args, wp_get_referer() ) );
867
- exit;
868
- }
869
-
870
- function management_page_load_signup() {
871
- switch ( $_POST['account'] ) :
872
- case 'import' :
873
- return $this->import_account();
874
- break;
875
- default :
876
- return;
877
- endswitch;
878
- }
879
-
880
- function import_account(){
881
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
882
- $polldaddy->reset();
883
- $email = trim( stripslashes( $_POST['polldaddy_email'] ) );
884
- $password = trim( stripslashes( $_POST['polldaddy_password'] ) );
885
-
886
- if ( !is_email( $email ) )
887
- $this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
888
-
889
- if ( !$password )
890
- $this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
891
-
892
- if ( $this->errors->get_error_codes() )
893
- return false;
894
-
895
- if ( $usercode = $polldaddy->initiate( $email, $password, $this->id ) ) {
896
- $this->user_code = $usercode;
897
- } else {
898
- $this->parse_errors( $polldaddy );
899
- $this->errors->add( 'import-account', __( 'Account could not be imported. Are your email address and password correct?', 'polldaddy' ) );
900
- return false;
901
- }
902
- }
903
-
904
- function admin_body_class( $class ) {
905
- if ( isset( $_GET['iframe'] ) )
906
- $class .= 'poll-preview-iframe ';
907
- if ( isset( $_GET['TB_iframe'] ) )
908
- $class .= 'poll-preview-iframe-editor ';
909
- return $class;
910
- }
911
-
912
- function management_page_notices( $message = false ) {
913
- switch ( (string) @$_GET['message'] ) :
914
- case 'deleted' :
915
- $deleted = (int) $_GET['deleted'];
916
- if ( 1 == $deleted )
917
- $message = __( 'Poll deleted.', 'polldaddy' );
918
- else
919
- $message = sprintf( __ngettext( '%s Poll Deleted.', '%s Polls Deleted.', $deleted ), number_format_i18n( $deleted ) );
920
- break;
921
- case 'opened' :
922
- $opened = (int) $_GET['opened'];
923
- if ( 1 == $opened )
924
- $message = __( 'Poll opened.', 'polldaddy' );
925
- else
926
- $message = sprintf( __ngettext( '%s Poll Opened.', '%s Polls Opened.', $opened ), number_format_i18n( $opened ) );
927
- break;
928
- case 'closed' :
929
- $closed = (int) $_GET['closed'];
930
- if ( 1 == $closed )
931
- $message = __( 'Poll closed.', 'polldaddy' );
932
- else
933
- $message = sprintf( __ngettext( '%s Poll Closed.', '%s Polls Closed.', $closed ), number_format_i18n( $closed ) );
934
- break;
935
- case 'updated' :
936
- $message = __( 'Poll updated.', 'polldaddy' );
937
- break;
938
- case 'created' :
939
- $message = __( 'Poll created.', 'polldaddy' );
940
- if ( isset( $_GET['iframe'] ) )
941
- $message .= ' <input type="button" class="button polldaddy-send-to-editor" value="' . attribute_escape( __( 'Send to Editor', 'polldaddy' ) ) . '" />';
942
- break;
943
- case 'updated-style' :
944
- $message = __( 'Custom Style updated.', 'polldaddy' );
945
- break;
946
- case 'created-style' :
947
- $message = __( 'Custom Style created.', 'polldaddy' );
948
- break;
949
- case 'deleted-style' :
950
- $deleted = (int) $_GET['deleted'];
951
- if ( 1 == $deleted )
952
- $message = __( 'Custom Style deleted.', 'polldaddy' );
953
- else
954
- $message = sprintf( __ngettext( '%s Style Deleted.', '%s Custom Styles Deleted.', $deleted ), number_format_i18n( $deleted ) );
955
- break;
956
- case 'imported-account' :
957
- $message = __( 'Account Imported.', 'polldaddy' );
958
- break;
959
- case 'updated-options' :
960
- $message = __( 'Options Updated.', 'polldaddy' );
961
- break;
962
- endswitch;
963
-
964
- $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
965
-
966
- if ( $is_POST ) {
967
- switch ( $GLOBALS['action'] ) :
968
- case 'create-poll' :
969
- $message = __( 'Error: An error has occurred; Poll not created.', 'polldaddy' );
970
- break;
971
- case 'edit-poll' :
972
- $message = __( 'Error: An error has occurred; Poll not updated.', 'polldaddy' );
973
- break;
974
- case 'account' :
975
- if ( 'import' == $_POST['account'] )
976
- $message = __( 'Error: An error has occurred; Account could not be imported. Perhaps your email address or password is incorrect?', 'polldaddy' );
977
- else
978
- $message = __( 'Error: An error has occurred; Account could not be created.', 'polldaddy' );
979
- break;
980
- endswitch;
981
- }
982
-
983
- if ( !$message )
984
- return;
985
- ?>
986
- <div class='updated'><p><?php echo $message; ?></p></div>
987
- <?php
988
- $this->print_errors();
989
- }
990
-
991
- function management_page() {
992
- global $page, $action, $poll, $style, $rating;
993
- $poll = (int) $poll;
994
- $style = (int) $style;
995
- $rating = wp_specialchars( $rating );
996
- ?>
997
-
998
- <div class="wrap" id="manage-polls">
999
-
1000
- <?php
1001
- if( $page == 'polls' ) {
1002
- if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
1003
- $action = '';
1004
- }
1005
- switch ( $action ) :
1006
- case 'signup' :
1007
- case 'account' :
1008
- $this->signup();
1009
- break;
1010
- case 'preview' :
1011
- ?>
1012
-
1013
- <h2 id="preview-header"><?php
1014
- if( $this->is_author )
1015
- printf( __( 'Poll Preview (<a href="%s">Edit Poll</a>, <a href="%s">List Polls</a>)', 'polldaddy' ),
1016
- clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll, 'message' => false ) ) ),
1017
- clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ));
1018
- else
1019
- printf( __( 'Poll Preview (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1020
-
1021
- <?php
1022
- echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
1023
- break;
1024
- case 'results' :
1025
- ?>
1026
-
1027
- <h2><?php
1028
- if( $this->is_author )
1029
- printf( __( 'Poll Results (<a href="%s">Edit Poll</a>)', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll, 'message' => false ) ) ) );
1030
- else
1031
- printf( __( 'Poll Results (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1032
-
1033
- <?php
1034
- $this->poll_results_page( $poll );
1035
- break;
1036
- case 'edit' :
1037
- case 'edit-poll' :
1038
- ?>
1039
-
1040
- <h2><?php printf( __('Edit Poll (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1041
-
1042
- <?php
1043
-
1044
- $this->poll_edit_form( $poll );
1045
- break;
1046
- case 'create-poll' :
1047
- ?>
1048
-
1049
- <h2><?php printf( __('Create Poll (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1050
-
1051
- <?php
1052
- $this->poll_edit_form();
1053
- break;
1054
- case 'list-styles' :
1055
- ?>
1056
-
1057
- <h2><?php
1058
- if( $this->is_author )
1059
- printf( __('Custom Styles (<a href="%s">Add New</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => 'create-style', 'poll' => false, 'message' => false ) ) ) );
1060
- else
1061
- _e('Custom Styles', 'polldaddy'); ?></h2>
1062
-
1063
- <?php
1064
- $this->styles_table();
1065
- break;
1066
- case 'edit-style' :
1067
- ?>
1068
-
1069
- <h2><?php printf( __('Edit Style (<a href="%s">List Styles</a>)'), clean_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
1070
-
1071
- <?php
1072
-
1073
- $this->style_edit_form( $style );
1074
- break;
1075
- case 'create-style' :
1076
- ?>
1077
-
1078
- <h2><?php printf( __('Create Style (<a href="%s">List Styles</a>)'), clean_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
1079
-
1080
- <?php
1081
- $this->style_edit_form();
1082
- break;
1083
- case 'options' :
1084
- case 'import-account' :
1085
- case 'update-options' :
1086
- $this->plugin_options();
1087
- break;
1088
- default :
1089
-
1090
- ?>
1091
-
1092
- <h2 id="poll-list-header"><?php
1093
- if( $this->is_author )
1094
- printf( __( 'Polls (<a href="%s">Add New</a>)', 'polldaddy' ), clean_url( add_query_arg( array('action' => 'create-poll','poll' => false,'message' => false) ) ) );
1095
- else
1096
- _e( 'Polls', 'polldaddy'); ?></h2>
1097
-
1098
- <?php
1099
- $this->polls_table( isset( $_GET['view'] ) && 'user' == $_GET['view'] ? 'user' : 'blog' );
1100
- endswitch;
1101
- } elseif( $page == 'ratings' ) {
1102
- if ( !$this->is_admin && !in_array( $action, array( 'change-report', 'reports' ) ) ) {//check user privileges has access to action
1103
- $action = 'reports';
1104
- }
1105
-
1106
- switch ( $action ) :
1107
- case 'change-report' :
1108
- case 'reports' :
1109
- $this->rating_reports();
1110
- break;
1111
- case 'update-rating' :
1112
- $this->update_rating();
1113
- $this->rating_settings( $action );
1114
- break;
1115
- default :
1116
- $this->rating_settings();
1117
- endswitch;
1118
- }
1119
- ?>
1120
-
1121
- </div>
1122
-
1123
- <?php
1124
-
1125
- }
1126
-
1127
- function polls_table( $view = 'blog' ) {
1128
- $page = 1;
1129
- if ( isset( $_GET['paged'] ) )
1130
- $page = absint($_GET['paged']);
1131
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1132
- $polldaddy->reset();
1133
-
1134
- if( !$this->is_author )
1135
- $view = '';
1136
-
1137
- if ( 'user' == $view )
1138
- $polls_object = $polldaddy->get_polls( ( $page - 1 ) * 10 + 1, $page * 10 );
1139
- else
1140
- $polls_object = $polldaddy->get_polls_by_parent_id( ( $page - 1 ) * 10 + 1, $page * 10 );
1141
- $this->parse_errors( $polldaddy );
1142
- $this->print_errors();
1143
- $polls = & $polls_object->poll;
1144
- if( isset( $polls_object->_total ) )
1145
- $total_polls = $polls_object->_total;
1146
- else
1147
- $total_polls = count( $polls );
1148
- $class = '';
1149
-
1150
- $page_links = paginate_links( array(
1151
- 'base' => add_query_arg( 'paged', '%#%' ),
1152
- 'format' => '',
1153
- 'total' => ceil( $total_polls / 10 ),
1154
- 'current' => $page
1155
- ) );
1156
-
1157
- if( $this->is_author ){ ?>
1158
- <ul class="subsubsub">
1159
- <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => false, 'paged' => false ) ) ); ?>"<?php if ( 'blog' == $view ) echo ' class="current"'; ?>><?php _e( "All Blog's Polls", 'polldaddy' ); ?></a> | </li>
1160
- <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => 'user', 'paged' => false ) ) ); ?>"<?php if ( 'user' == $view ) echo ' class="current"'; ?>><?php _e( "All My Polls", 'polldaddy' ); ?></a></li>
1161
- </ul>
1162
- <?php } ?>
1163
- <form method="post" action="">
1164
- <?php if( $this->is_author ){ ?>
1165
- <div class="tablenav">
1166
- <div class="alignleft">
1167
- <select name="action">
1168
- <option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
1169
- <option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
1170
- <option value="close"><?php _e( 'Close', 'polldaddy' ); ?></option>
1171
- <option value="open"><?php _e( 'Open', 'polldaddy' ); ?></option>
1172
- </select>
1173
- <input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
1174
- <?php wp_nonce_field( 'action-poll_bulk' ); ?>
1175
- </div>
1176
- <div class="tablenav-pages"><?php echo $page_links; ?></div>
1177
- </div>
1178
- <br class="clear" />
1179
- <?php } ?>
1180
- <table class="widefat">
1181
- <thead>
1182
- <tr>
1183
- <th id="cb" class="manage-column column-cb check-column" scope="col" /><?php if( $this->is_author ){ ?><input type="checkbox" /><?php } ?></th>
1184
- <th id="title" class="manage-column column-title" scope="col">Poll</th>
1185
- <th id="votes" class="manage-column column-vote" scope="col">Votes</th>
1186
- <th id="date" class="manage-column column-date" scope="col">Created</th>
1187
- </tr>
1188
- </thead>
1189
- <tbody>
1190
-
1191
- <?php
1192
- if ( $polls ) :
1193
- foreach ( $polls as $poll ) :
1194
- $poll_id = (int) $poll->_id;
1195
-
1196
- $poll->___content = trim( strip_tags( $poll->___content ) );
1197
- if( strlen( $poll->___content ) == 0 ){
1198
- $poll->___content = '-- empty HTML tag --';
1199
- }
1200
-
1201
- $poll_closed = (int) $poll->_closed;
1202
-
1203
- if ( $this->is_author and $this->can_edit( $poll ) ) {
1204
- $edit_link = clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
1205
- $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
1206
- $open_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'open', 'poll' => $poll_id, 'message' => false ) ), "open-poll_$poll_id" ) );
1207
- $close_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'close', 'poll' => $poll_id, 'message' => false ) ), "close-poll_$poll_id" ) );
1208
- }
1209
- else {
1210
- $edit_link = false;
1211
- $delete_link = false;
1212
- $open_link = false;
1213
- $close_link = false;
1214
- }
1215
-
1216
- $class = $class ? '' : ' class="alternate"';
1217
- $results_link = clean_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
1218
- $preview_link = clean_url( add_query_arg( array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false ) ) ); //, 'iframe' => '', 'TB_iframe' => 'true' ) ) );
1219
- list($poll_time) = explode( '.', $poll->_created );
1220
- $poll_time = strtotime( $poll_time );
1221
- ?>
1222
-
1223
- <tr<?php echo $class; ?>>
1224
- <th class="check-column" scope="row"><?php if( $this->is_author and $this->can_edit( $poll ) ){ ?><input type="checkbox" value="<?php echo (int) $poll_id; ?>" name="poll[]" /><?php } ?></th>
1225
- <td class="post-title column-title">
1226
- <?php if ( $edit_link ) { ?>
1227
- <strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo wp_specialchars( $poll->___content ); ?></a></strong>
1228
- <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
1229
- <?php } else { ?>
1230
- <strong><?php echo wp_specialchars( $poll->___content ); ?></strong>
1231
- <?php } ?>
1232
- <span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a> | </span>
1233
- <?php if ( $delete_link ) { ?>
1234
- <span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a> | </span>
1235
- <?php }
1236
- if ( $poll_closed == 2 ) {
1237
- if ( $open_link ) { ?>
1238
- <span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a> | </span>
1239
- <?php } } else {
1240
- if ( $close_link ) { ?>
1241
- <span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a> | </span>
1242
- <?php } } ?>
1243
- <?php if ( isset( $_GET['iframe'] ) ) { ?>
1244
- <span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a> | </span>
1245
- <span class="editor">
1246
- <a href="#" class="polldaddy-send-to-editor"><?php _e( 'Send to editor', 'polldaddy' ); ?></a>
1247
- <input type="hidden" class="polldaddy-poll-id hack" value="<?php echo (int) $poll_id; ?>" /> |
1248
- </span>
1249
- <?php } else { ?>
1250
- <span class="view"><a class="thickbox" href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a> | </span>
1251
- <?php } ?>
1252
- <span class="shortcode"><a href="#" class="polldaddy-show-shortcode"><?php _e( 'HTML code', 'polldaddy' ); ?></a></span>
1253
- <?php $this->poll_table_add_option( $poll_id ); ?>
1254
- </td>
1255
- <td class="poll-votes column-vote"><?php echo number_format_i18n( $poll->_responses ); ?></td>
1256
- <td class="date column-date"><abbr title="<?php echo date( __('Y/m/d g:i:s A'), $poll_time ); ?>"><?php echo date( __('Y/m/d'), $poll_time ); ?></abbr></td>
1257
- </tr>
1258
- <tr class="polldaddy-shortcode-row" style="display: none;">
1259
- <td colspan="4">
1260
- <h4><?php _e( 'Shortcode', 'polldaddy' ); ?></h4>
1261
- <pre>[polldaddy poll=<?php echo (int) $poll_id; ?>]</pre>
1262
-
1263
- <h4><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
1264
- <pre>&lt;script type="text/javascript" language="javascript"
1265
- src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/script&gt;
1266
- &lt;noscript&gt;
1267
- &lt;a href="http://answers.polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"&gt;<?php echo trim( strip_tags( $poll->___content ) ); ?>&lt;/a&gt;&lt;br/&gt;
1268
- &lt;span style="font:9px;"&gt;(&lt;a href="http://www.polldaddy.com"&gt;polls&lt;/a&gt;)&lt;/span&gt;
1269
- &lt;/noscript&gt;</pre>
1270
- </td>
1271
- </tr>
1272
-
1273
- <?php
1274
- endforeach;
1275
- elseif ( $total_polls ) : // $polls
1276
- ?>
1277
-
1278
- <tr>
1279
- <td colspan="4"><?php printf( __( 'What are you doing here? <a href="%s">Go back</a>.', 'polldaddy' ), clean_url( add_query_arg( 'paged', false ) ) ); ?></td>
1280
- </tr>
1281
-
1282
- <?php
1283
- else : // $polls
1284
- ?>
1285
-
1286
- <tr>
1287
- <td colspan="4"><?php
1288
- if( $this->is_author )
1289
- printf( __( 'No polls yet. <a href="%s">Create one</a>', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'create-poll' ) ) ) );
1290
- else
1291
- _e( 'No polls yet.', 'polldaddy' ); ?></td>
1292
- </tr>
1293
- <?php endif; // $polls ?>
1294
-
1295
- </tbody>
1296
- </table>
1297
- <?php $this->poll_table_extra(); ?>
1298
- </form>
1299
- <div class="tablenav">
1300
- <div class="tablenav-pages"><?php echo $page_links; ?></div>
1301
- </div>
1302
- <br class="clear" />
1303
-
1304
- <?php
1305
- }
1306
-
1307
- function poll_table_add_option(){}
1308
-
1309
- function poll_table_extra(){}
1310
-
1311
- function poll_edit_form( $poll_id = 1 ) {
1312
- $poll_id = (int) $poll_id;
1313
-
1314
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1315
- $polldaddy->reset();
1316
-
1317
- $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
1318
-
1319
- if ( $poll_id ) {
1320
- $poll = $polldaddy->get_poll( $poll_id );
1321
- $this->parse_errors( $polldaddy );
1322
-
1323
- if ( !$this->can_edit( $poll ) ) {
1324
- $this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
1325
- }
1326
-
1327
- if( $poll_id == 1 ){
1328
- $poll->answers = array();
1329
- $poll_id = 0;
1330
- }
1331
-
1332
- } else {
1333
- $poll = polldaddy_poll( array(), null, false );
1334
- }
1335
-
1336
- $question = $is_POST ? attribute_escape( stripslashes( $_POST['question'] ) ) : attribute_escape( $poll->question );
1337
-
1338
- $this->print_errors();
1339
- ?>
1340
-
1341
- <form action="" method="post">
1342
- <div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar">
1343
-
1344
- <div class="inner-sidebar" id="side-info-column">
1345
- <div id="submitdiv" class="postbox">
1346
- <h3><?php _e( 'Publish', 'polldaddy' ); ?></h3>
1347
- <div class="inside">
1348
- <div id="major-publishing-actions">
1349
- <p id="publishing-action">
1350
- <?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
1351
- <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
1352
- <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
1353
- <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Save Poll', 'polldaddy' ) ); ?>" />
1354
-
1355
- <?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
1356
-
1357
- <input type="button" class="button polldaddy-send-to-editor" value="<?php echo attribute_escape( __( 'Send to Editor', 'polldaddy' ) ); ?>" />
1358
-
1359
- <?php endif; ?>
1360
-
1361
- </p>
1362
- <br class="clear" />
1363
- </div>
1364
- </div>
1365
- </div>
1366
-
1367
- <div class="postbox">
1368
- <h3><?php _e( 'Poll results', 'polldaddy' ); ?></h3>
1369
- <div class="inside">
1370
- <ul class="poll-options">
1371
-
1372
- <?php
1373
- foreach ( array( 'show' => __( 'Show results to voters', 'polldaddy' ), 'percent' => __( 'Only show percentages', 'polldaddy' ), 'hide' => __( 'Hide all results', 'polldaddy' ) ) as $value => $label ) :
1374
- if ( $is_POST )
1375
- $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
1376
- else
1377
- $checked = $value === $poll->resultsType ? ' checked="checked"' : '';
1378
- ?>
1379
-
1380
- <li>
1381
- <label for="resultsType-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="resultsType" id="resultsType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1382
- </li>
1383
-
1384
- <?php endforeach; ?>
1385
-
1386
- </ul>
1387
- </div>
1388
- </div>
1389
-
1390
- <div class="postbox">
1391
- <h3><?php _e( 'Block repeat voters', 'polldaddy' ); ?></h3>
1392
- <div class="inside">
1393
- <ul class="poll-options">
1394
-
1395
- <?php
1396
- foreach ( array( 'off' => __( "Don't block repeat voters", 'polldaddy' ), 'cookie' => __( 'Block by cookie (recommended)', 'polldaddy' ), 'cookieip' => __( 'Block by cookie and by IP address', 'polldaddy' ) ) as $value => $label ) :
1397
- if ( $is_POST )
1398
- $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
1399
- else
1400
- $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
1401
- ?>
1402
-
1403
- <li>
1404
- <label for="blockRepeatVotersType-<?php echo $value; ?>"><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1405
- </li>
1406
-
1407
- <?php endforeach; ?>
1408
-
1409
- </ul>
1410
-
1411
- <span style="margin:6px 6px 8px;" id="cookieip_expiration_label"><label><?php _e( 'Expires: ', 'polldaddy' ); ?></label></span>
1412
- <select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>">
1413
- <option value="0" <?php echo (int) $poll->blockExpiration == 0 ? 'selected' : ''; ?>><?php _e( 'Never', 'polldaddy' ); ?></option>
1414
- <option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?>><?php printf( __('%d hour'), 1 ); ?></option>
1415
- <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 3 ); ?></option>
1416
- <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 6 ); ?></option>
1417
- <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?>><?php printf( __('%d hours'), 12 ); ?></option>
1418
- <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?>><?php printf( __('%d day'), 1 ); ?></option>
1419
- <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?>><?php printf( __('%d week'), 1 ); ?></option>
1420
- <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected' : ''; ?>><?php printf( __('%d month'), 1 ); ?></option>
1421
- </select>
1422
- <p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.'); ?></p>
1423
- </div>
1424
- </div>
1425
- </div>
1426
-
1427
-
1428
- <div id="post-body-content" class="has-sidebar-content">
1429
-
1430
- <div id="titlediv">
1431
- <div id="titlewrap">
1432
- <input type="text" autocomplete="off" id="title" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
1433
- </div>
1434
- </div>
1435
-
1436
- <div id="answersdiv" class="postbox">
1437
- <h3><?php _e( 'Answers', 'polldaddy' ); ?></h3>
1438
-
1439
- <div id="answerswrap" class="inside">
1440
- <ul id="answers">
1441
- <?php
1442
- $a = 0;
1443
- $answers = array();
1444
- if ( $is_POST && $_POST['answer'] ) {
1445
- foreach( $_POST['answer'] as $answer_id => $answer )
1446
- $answers[attribute_escape($answer_id)] = attribute_escape( stripslashes($answer) );
1447
- } elseif ( isset( $poll->answers->answer ) ) {
1448
- foreach ( $poll->answers->answer as $answer )
1449
- $answers[(int) $answer->_id] = attribute_escape( $answer->text );
1450
- }
1451
-
1452
- foreach ( $answers as $answer_id => $answer ) :
1453
- $a++;
1454
- $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false ) ), "delete-answer_$answer_id" ) );
1455
- ?>
1456
-
1457
- <li>
1458
- <span class="handle" title="<?php echo attribute_escape( 'click and drag to move' ); ?>">&#x2195;</span>
1459
- <div><input type="text" autocomplete="off" id="answer-<?php echo $answer_id; ?>" value="<?php echo $answer; ?>" tabindex="2" size="30" name="answer[<?php echo $answer_id; ?>]" /></div>
1460
- <a href="<?php echo $delete_link; ?>" class="delete-answer delete" title="<?php echo attribute_escape( 'delete this answer' ); ?>">&times;</a>
1461
- </li>
1462
-
1463
- <?php
1464
- endforeach;
1465
-
1466
- while ( 3 - $a > 0 ) :
1467
- $a++;
1468
- ?>
1469
-
1470
- <li>
1471
- <span class="handle" title="<?php echo attribute_escape( 'click and drag to move' ); ?>">&#x2195;</span>
1472
- <div><input type="text" autocomplete="off" value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?>]" /></div>
1473
- <a href="#" class="delete-answer delete" title="<?php echo attribute_escape( 'delete this answer' ); ?>">&times;</a>
1474
- </li>
1475
-
1476
- <?php
1477
- endwhile;
1478
- ?>
1479
-
1480
- </ul>
1481
-
1482
- <p id="add-answer-holder">
1483
- <button class="button"><?php echo wp_specialchars( __( 'Add another', 'polldaddy' ) ); ?></button>
1484
- </p>
1485
-
1486
- <ul id="answer-options">
1487
-
1488
- <?php
1489
- foreach ( array( 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'sharing' => __( "'Share This' link", 'polldaddy' ) ) as $option => $label ) :
1490
- if ( $is_POST )
1491
- $checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
1492
- else
1493
- $checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
1494
- ?>
1495
-
1496
- <li>
1497
- <label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1498
- </li>
1499
-
1500
- <?php endforeach; ?>
1501
-
1502
- </ul>
1503
- <?php
1504
- if ( $is_POST )
1505
- $style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;';
1506
- else
1507
- $style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;';
1508
- ?>
1509
- <div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?>">
1510
- <p>Number of choices: <select name="choices" id="choices"><option value="0">No Limit</option>
1511
- <?php
1512
- if ( $is_POST )
1513
- $choices = (int) $_POST['choices'];
1514
- else
1515
- $choices = (int) $poll->choices;
1516
-
1517
- if( $a > 1 ) :
1518
- for( $i=2; $i<=$a; $i++ ) :
1519
- $selected = $i == $choices ? 'selected="true"' : '';
1520
- echo "<option value='$i' $selected>$i</option>";
1521
- endfor;
1522
- endif; ?>
1523
- </select>
1524
- </p>
1525
- </div>
1526
- </div>
1527
- </div>
1528
-
1529
- <div id="design" class="postbox">
1530
-
1531
- <?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
1532
-
1533
- $iframe_view = false;
1534
- if ( isset($_GET['iframe']) )
1535
- $iframe_view = true;
1536
-
1537
- $options = array(
1538
- 101 => 'Aluminum Narrow',
1539
- 102 => 'Aluminum Medium',
1540
- 103 => 'Aluminum Wide',
1541
- 104 => 'Plain White Narrow',
1542
- 105 => 'Plain White Medium',
1543
- 106 => 'Plain White Wide',
1544
- 107 => 'Plain Black Narrow',
1545
- 108 => 'Plain Black Medium',
1546
- 109 => 'Plain Black Wide',
1547
- 110 => 'Paper Narrow',
1548
- 111 => 'Paper Medium',
1549
- 112 => 'Paper Wide',
1550
- 113 => 'Skull Dark Narrow',
1551
- 114 => 'Skull Dark Medium',
1552
- 115 => 'Skull Dark Wide',
1553
- 116 => 'Skull Light Narrow',
1554
- 117 => 'Skull Light Medium',
1555
- 118 => 'Skull Light Wide',
1556
- 157 => 'Micro',
1557
- 119 => 'Plastic White Narrow',
1558
- 120 => 'Plastic White Medium',
1559
- 121 => 'Plastic White Wide',
1560
- 122 => 'Plastic Grey Narrow',
1561
- 123 => 'Plastic Grey Medium',
1562
- 124 => 'Plastic Grey Wide',
1563
- 125 => 'Plastic Black Narrow',
1564
- 126 => 'Plastic Black Medium',
1565
- 127 => 'Plastic Black Wide',
1566
- 128 => 'Manga Narrow',
1567
- 129 => 'Manga Medium',
1568
- 130 => 'Manga Wide',
1569
- 131 => 'Tech Dark Narrow',
1570
- 132 => 'Tech Dark Medium',
1571
- 133 => 'Tech Dark Wide',
1572
- 134 => 'Tech Grey Narrow',
1573
- 135 => 'Tech Grey Medium',
1574
- 136 => 'Tech Grey Wide',
1575
- 137 => 'Tech Light Narrow',
1576
- 138 => 'Tech Light Medium',
1577
- 139 => 'Tech Light Wide',
1578
- 140 => 'Working Male Narrow',
1579
- 141 => 'Working Male Medium',
1580
- 142 => 'Working Male Wide',
1581
- 143 => 'Working Female Narrow',
1582
- 144 => 'Working Female Medium',
1583
- 145 => 'Working Female Wide',
1584
- 146 => 'Thinking Male Narrow',
1585
- 147 => 'Thinking Male Medium',
1586
- 148 => 'Thinking Male Wide',
1587
- 149 => 'Thinking Female Narrow',
1588
- 150 => 'Thinking Female Medium',
1589
- 151 => 'Thinking Female Wide',
1590
- 152 => 'Sunset Narrow',
1591
- 153 => 'Sunset Medium',
1592
- 154 => 'Sunset Wide',
1593
- 155 => 'Music Medium',
1594
- 156 => 'Music Wide'
1595
- );
1596
-
1597
- $polldaddy->reset();
1598
- $styles = $polldaddy->get_styles();
1599
-
1600
- $show_custom = false;
1601
- if( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ){
1602
- foreach( (array) $styles->style as $style ){
1603
- $options[ (int) $style->_id ] = $style->title;
1604
- }
1605
- $show_custom = true;
1606
- }
1607
-
1608
- if ( $style_ID > 18 ){
1609
- $standard_style_ID = 0;
1610
- $custom_style_ID = $style_ID;
1611
- }
1612
- else{
1613
- $standard_style_ID = $style_ID;
1614
- $custom_style_ID = 0;
1615
- }
1616
- ?>
1617
-
1618
- <h3><?php _e( 'Design', 'polldaddy' ); ?></h3>
1619
- <input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID ?>">
1620
- <div class="inside">
1621
- <?php if ( $iframe_view ){ ?>
1622
- <div id="design_standard" style="padding:0px;">
1623
- <div class="hide-if-no-js">
1624
- <table class="pollStyle">
1625
- <thead>
1626
- <tr>
1627
- <th>
1628
- <div style="display:none;">
1629
- <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
1630
- </div>
1631
- </th>
1632
- </tr>
1633
- </thead>
1634
- <tr>
1635
- <td class="selector">
1636
- <table class="st_selector">
1637
- <tr>
1638
- <td class="dir_left">
1639
- <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#171;</a>
1640
- </td>
1641
- <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
1642
- <td class="dir_right">
1643
- <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#187;</a>
1644
- </td>
1645
- </tr>
1646
- <tr>
1647
- <td></td>
1648
- <td class="counter">
1649
- <div id="st_number"></div>
1650
- </td>
1651
- <td></td>
1652
- </tr>
1653
- <tr>
1654
- <td></td>
1655
- <td class="title">
1656
- <div id="st_name"></div>
1657
- </td>
1658
- <td></td>
1659
- </tr>
1660
- <tr>
1661
- <td></td>
1662
- <td>
1663
- <div id="st_sizes"></div>
1664
- </td>
1665
- <td></td>
1666
- </tr>
1667
- <tr>
1668
- <td colspan="3">
1669
- <div id="st_description"></div>
1670
- </td>
1671
- </tr>
1672
- </table>
1673
- </td>
1674
- </tr>
1675
- </table>
1676
- </div>
1677
-
1678
- <p class="empty-if-js" id="no-js-styleID">
1679
- <select id="styleID" name="styleID">
1680
-
1681
- <?php foreach ( $options as $styleID => $label ) :
1682
- $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
1683
- <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
1684
- <?php endforeach; ?>
1685
-
1686
- </select>
1687
- </p>
1688
- </div>
1689
- <?php if ( $show_custom ){ ?>
1690
- <div id="design_custom">
1691
- <p class="hide-if-no-js">
1692
- <table class="pollStyle">
1693
- <thead>
1694
- <tr>
1695
- <th>
1696
- <div style="display:none;">
1697
- <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
1698
- <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
1699
- <label onclick="javascript:pd_change_style($('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
1700
- </div>
1701
- </th>
1702
- </tr>
1703
- </thead>
1704
- <tbody>
1705
- <tr>
1706
- <td class="customSelect">
1707
- <table>
1708
- <tr>
1709
- <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
1710
- <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
1711
- <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
1712
- <option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...', 'polldaddy' ); ?></option>
1713
- <?php if( $show_custom) : foreach ( (array)$styles->style as $style ) :
1714
- $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
1715
- <option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
1716
- <?php endforeach; endif; ?>
1717
- </select>
1718
- <div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div></td>
1719
- </tr>
1720
- <tr>
1721
- <td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
1722
- <p><?php echo $extra ?></p>
1723
- <p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
1724
- </td>
1725
- </tr>
1726
- </table>
1727
- </td>
1728
- </tr>
1729
- </tbody>
1730
- </table>
1731
- </p>
1732
- </div>
1733
- <div id="design_options">
1734
- <a href="#" class="polldaddy-show-design-options"><?php _e( 'Custom Styles', 'polldaddy' ); ?></a>
1735
- </div>
1736
- <?php }}else{?>
1737
- <div class="design_standard">
1738
- <div class="hide-if-no-js">
1739
- <table class="pollStyle">
1740
- <thead>
1741
- <tr>
1742
- <th class="cb">
1743
- <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
1744
- </th>
1745
- <th>
1746
- <label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e( 'PollDaddy Style', 'polldaddy' ); ?></label>
1747
- </th>
1748
- <th/>
1749
- <th class="cb">
1750
- <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
1751
- <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style($('customSelect').value);" <?php echo $disabled; ?>></input>
1752
- </th>
1753
- <th>
1754
- <label onclick="javascript:pd_change_style($('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
1755
- </th>
1756
- </tr>
1757
- </thead>
1758
- <tbody>
1759
- <tr>
1760
- <td/>
1761
- <td class="selector">
1762
- <table class="st_selector">
1763
- <tr>
1764
- <td class="dir_left">
1765
- <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#171;</a>
1766
- </td>
1767
- <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
1768
- <td class="dir_right">
1769
- <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#187;</a>
1770
- </td>
1771
- </tr>
1772
- <tr>
1773
- <td></td>
1774
- <td class="counter">
1775
- <div id="st_number"></div>
1776
- </td>
1777
- <td></td>
1778
- </tr>
1779
- <tr>
1780
- <td></td>
1781
- <td class="title">
1782
- <div id="st_name"></div>
1783
- </td>
1784
- <td></td>
1785
- </tr>
1786
- <tr>
1787
- <td></td>
1788
- <td>
1789
- <div id="st_sizes"></div>
1790
- </td>
1791
- <td></td>
1792
- </tr>
1793
- <tr>
1794
- <td colspan="3">
1795
- <div id="st_description"></div>
1796
- </td>
1797
- </tr>
1798
- </table>
1799
- </td>
1800
- <td width="100"></td>
1801
- <td/>
1802
- <td class="customSelect">
1803
- <table>
1804
- <tr>
1805
- <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
1806
- <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
1807
- <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
1808
- <option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...'); ?></option>
1809
- <?php if( $show_custom) : foreach ( (array)$styles->style as $style ) :
1810
- $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
1811
- <option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
1812
- <?php endforeach; endif;?>
1813
- </select>
1814
- <div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.'); ?></div></td>
1815
- </tr>
1816
- <tr>
1817
- <td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
1818
- <p><?php echo $extra ?></p>
1819
- <p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
1820
- </td>
1821
- </tr>
1822
- </table>
1823
- </td>
1824
- </tr>
1825
- </tbody>
1826
- </table>
1827
- </div>
1828
- <p class="empty-if-js" id="no-js-styleID">
1829
- <select id="styleID" name="styleID">
1830
-
1831
- <?php foreach ( $options as $styleID => $label ) :
1832
- $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
1833
- <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
1834
- <?php endforeach; ?>
1835
-
1836
- </select>
1837
- </p>
1838
- </div>
1839
- <?php } ?>
1840
- <script language="javascript">
1841
- current_pos = 0;
1842
- pd_build_styles( current_pos );
1843
- <?php if( $style_ID > 0 && $style_ID <= 1000 ){ ?>
1844
- pd_pick_style( <?php echo $style_ID ?> );
1845
- <?php }else{ ?>
1846
- pd_change_style( <?php echo $style_ID ?> );
1847
- <?php } ?>
1848
- </script>
1849
- </div>
1850
-
1851
- </div>
1852
-
1853
- </div>
1854
- </div></div>
1855
- </form>
1856
- <br class="clear" />
1857
-
1858
- <?php
1859
- }
1860
-
1861
- function poll_results_page( $poll_id ) {
1862
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1863
- $polldaddy->reset();
1864
-
1865
- $results = $polldaddy->get_poll_results( $poll_id );
1866
- ?>
1867
-
1868
- <table class="poll-results widefat">
1869
- <thead>
1870
- <tr>
1871
- <th scope="col" class="column-title"><?php _e( 'Answer', 'polldaddy' ); ?></th>
1872
- <th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
1873
- </tr>
1874
- </thead>
1875
- <tbody>
1876
-
1877
- <?php
1878
- $class = '';
1879
- foreach ( $results->answers as $answer ) :
1880
- $answer->text = trim( strip_tags( $answer->text ) );
1881
- if( strlen( $answer->text ) == 0 ){
1882
- $answer->text = '-- empty HTML tag --';
1883
- }
1884
-
1885
- $class = $class ? '' : ' class="alternate"';
1886
- $content = $results->others && 'Other answer...' === $answer->text ? sprintf( __( 'Other (<a href="%s">see below</a>)', 'polldaddy' ), '#other-answers-results' ) : wp_specialchars( $answer->text );
1887
-
1888
- ?>
1889
-
1890
- <tr<?php echo $class; ?>>
1891
- <th scope="row" class="column-title"><?php echo $content; ?></th>
1892
- <td class="column-vote">
1893
- <div class="result-holder">
1894
- <span class="result-bar" style="width: <?php echo number_format( $answer->_percent, 2 ); ?>%;">&nbsp;</span>
1895
- <span class="result-total alignleft"><?php echo number_format_i18n( $answer->_total ); ?></span>
1896
- <span class="result-percent alignright"><?php echo number_format_i18n( $answer->_percent ); ?>%</span>
1897
- </div>
1898
- </td>
1899
- </tr>
1900
- <?php
1901
- endforeach;
1902
- ?>
1903
-
1904
- </tbody>
1905
- </table>
1906
-
1907
- <?php
1908
-
1909
- if ( !$results->others )
1910
- return;
1911
- ?>
1912
-
1913
- <table id="other-answers-results" class="poll-others widefat">
1914
- <thead>
1915
- <tr>
1916
- <th scope="col" class="column-title"><?php _e( 'Other Answer', 'polldaddy' ); ?></th>
1917
- <th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
1918
- </tr>
1919
- </thead>
1920
- <tbody>
1921
-
1922
- <?php
1923
- $class = '';
1924
- $others = array_count_values( $results->others );
1925
- arsort( $others );
1926
- foreach ( $others as $other => $freq ) :
1927
- $class = $class ? '' : ' class="alternate"';
1928
- ?>
1929
-
1930
- <tr<?php echo $class; ?>>
1931
- <th scope="row" class="column-title"><?php echo wp_specialchars( $other ); ?></th>
1932
- <td class="column-vote"><?php echo number_format_i18n( $freq ); ?></td>
1933
- </tr>
1934
- <?php
1935
- endforeach;
1936
- ?>
1937
-
1938
- </tbody>
1939
- </table>
1940
-
1941
- <?php
1942
- }
1943
-
1944
- function styles_table() {
1945
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1946
- $polldaddy->reset();
1947
-
1948
- $styles_object = $polldaddy->get_styles();
1949
-
1950
- $this->parse_errors( $polldaddy );
1951
- $this->print_errors();
1952
- $styles = & $styles_object->style;
1953
- $class = '';
1954
- $styles_exist = false;
1955
-
1956
- foreach ( (array)$styles as $style ) :
1957
- if( (int) $style->_type == 1 ):
1958
- $styles_exist = true;
1959
- break;
1960
- endif;
1961
- endforeach;
1962
- ?>
1963
-
1964
- <form method="post" action="">
1965
- <div class="tablenav">
1966
- <div class="alignleft">
1967
- <select name="action">
1968
- <option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
1969
- <option value="delete-style"><?php _e( 'Delete', 'polldaddy' ); ?></option>
1970
- </select>
1971
- <input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
1972
- <?php wp_nonce_field( 'action-style_bulk' ); ?>
1973
- </div>
1974
- <div class="tablenav-pages"></div>
1975
- </div>
1976
- <br class="clear" />
1977
- <table class="widefat">
1978
- <thead>
1979
- <tr>
1980
- <th id="cb" class="manage-column column-cb check-column" scope="col" /><input type="checkbox" /></th>
1981
- <th id="title" class="manage-column column-title" scope="col"><?php _e( 'Style', 'polldaddy' ); ?></th>
1982
- <th id="date" class="manage-column column-date" scope="col"><?php _e( 'Last Modified', 'polldaddy' ); ?></th>
1983
- </tr>
1984
- </thead>
1985
- <tbody>
1986
-
1987
- <?php
1988
- if ( $styles_exist ) :
1989
- foreach ( $styles as $style ) :
1990
- if( (int) $style->_type == 1 ):
1991
- $style_id = (int) $style->_id;
1992
-
1993
- $class = $class ? '' : ' class="alternate"';
1994
- $edit_link = clean_url( add_query_arg( array( 'action' => 'edit-style', 'style' => $style_id, 'message' => false ) ) );
1995
- $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-style', 'style' => $style_id, 'message' => false ) ), "delete-style_$style_id" ) );
1996
- list($style_time) = explode( '.', $style->date );
1997
- $style_time = strtotime( $style_time );
1998
- ?>
1999
-
2000
- <tr<?php echo $class; ?>>
2001
- <th class="check-column" scope="row"><input type="checkbox" value="<?php echo (int) $style_id; ?>" name="style[]" /></th>
2002
- <td class="post-title column-title">
2003
- <?php if ( $edit_link ) : ?>
2004
- <strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo wp_specialchars( $style->title ); ?></a></strong>
2005
- <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
2006
- <?php else : ?>
2007
- <strong><?php echo wp_specialchars( $style->title ); ?></strong>
2008
- <?php endif; ?>
2009
-
2010
- <span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
2011
- </td>
2012
- <td class="date column-date"><abbr title="<?php echo date( __('Y/m/d g:i:s A'), $style_time ); ?>"><?php echo date( __('Y/m/d'), $style_time ); ?></abbr></td>
2013
- </tr>
2014
-
2015
- <?php
2016
- endif;
2017
- endforeach;
2018
- else : // $styles
2019
- ?>
2020
-
2021
- <tr>
2022
- <td colspan="4"><?php printf( __( 'No custom styles yet. <a href="%s">Create one</a>', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'create-style' ) ) ) ); ?></td>
2023
- </tr>
2024
- <?php endif; // $styles ?>
2025
-
2026
- </tbody>
2027
- </table>
2028
- </form>
2029
- <div class="tablenav">
2030
- <div class="tablenav-pages"></div>
2031
- </div>
2032
- <br class="clear" />
2033
-
2034
- <?php
2035
- }
2036
-
2037
- function style_edit_form( $style_id = 105 ) {
2038
- $style_id = (int) $style_id;
2039
-
2040
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
2041
- $polldaddy->reset();
2042
-
2043
- $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
2044
-
2045
- if ( $style_id ) {
2046
- $style = $polldaddy->get_style( $style_id );
2047
- $this->parse_errors( $polldaddy );
2048
- } else {
2049
- $style = polldaddy_style( array(), null, false );
2050
- }
2051
-
2052
- $style->css = trim( urldecode( $style->css ) );
2053
-
2054
- if ( $start = stripos( $style->css, '<data>' ) )
2055
- $style->css = substr( $style->css, $start );
2056
-
2057
- $style->css = addslashes( $style->css );
2058
-
2059
- $preload_style_id = 0;
2060
- $preload_style = null;
2061
-
2062
- if ( isset ( $_REQUEST['preload'] ) )
2063
- {
2064
- $preload_style_id = (int) $_REQUEST['preload'];
2065
-
2066
- if ( $preload_style_id > 1000 || $preload_style_id < 100 )
2067
- $preload_style_id = 0;
2068
-
2069
- if ( $preload_style_id > 0 ) {
2070
- $polldaddy->reset();
2071
- $preload_style = $polldaddy->get_style( $preload_style_id );
2072
- $this->parse_errors( $polldaddy );
2073
- }
2074
-
2075
- $preload_style->css = trim( urldecode( $preload_style->css ) );
2076
-
2077
- if ( $start = stripos( $preload_style->css, '<data>' ) )
2078
- $preload_style->css = substr( $preload_style->css, $start );
2079
-
2080
- $style->css = addslashes( $preload_style->css );
2081
- }
2082
-
2083
- $this->print_errors();
2084
-
2085
- echo '<script language="javascript">var CSSXMLString = "' . $style->css .'";</script>';
2086
- ?>
2087
-
2088
- <form action="" method="post">
2089
- <div id="poststuff">
2090
- <div id="post-body">
2091
- <br/>
2092
- <table width="100%">
2093
- <tr>
2094
- <td colspan="2">
2095
- <table width="100%">
2096
- <tr>
2097
- <td valign="middle" width="8%">
2098
- <label class="CSSE_title_label"><?php _e( 'Style Name', 'polldaddy' ); ?></label>
2099
- </td>
2100
- <td>
2101
- <div id="titlediv" style="margin:0px;">
2102
- <div id="titlewrap">
2103
- <input type="text" autocomplete="off" id="title" value="<?php echo $style_id > 1000 ? $style->title : ''; ?>" tabindex="1" size="30" name="style-title"></input>
2104
- </div>
2105
- </div>
2106
- </td>
2107
- </tr>
2108
- </table>
2109
- </td>
2110
- </tr>
2111
- <tr>
2112
- <td width="13%">
2113
- <label class="CSSE_title_label"><?php _e( 'Preload Basic Style', 'polldaddy' ); ?></label>
2114
- </td>
2115
- <td>
2116
- <div class="CSSE_preload">
2117
- <select id="preload_value">
2118
- <option value="0"></option>
2119
- <option value="102">Aluminum</option>
2120
- <option value="105">Plain White</option>
2121
- <option value="108">Plain Black</option>
2122
- <option value="111">Paper</option>
2123
- <option value="114">Skull Dark</option>
2124
- <option value="117">Skull Light</option>
2125
- <option value="157">Micro</option>
2126
- </select>
2127
- <a tabindex="4" id="style-preload" href="javascript:preload_pd_style();" class="button"><?php echo attribute_escape( __( 'Load Style', 'polldaddy' ) ); ?></a>
2128
- </div>
2129
- </td>
2130
- </tr>
2131
- <tr>
2132
- <td width="13%">
2133
- <p>Choose a part to edit...</p>
2134
- </td>
2135
- <td>
2136
- <select id="styleName" onchange="renderStyleEdit(this.value);">
2137
- <option value="pds-box" selected="selected">Poll Box</option>
2138
- <option value="pds-question-top">Question</option>
2139
- <option value="pds-answer-group">Answer Group</option>
2140
- <option value="pds-answer-input">Answer Check</option>
2141
- <option value="pds-answer">Answers</option>
2142
- <option value="pds-textfield">Other Input</option>
2143
- <option value="pds-vote-button">Vote Button</option>
2144
- <option value="pds-link">Links</option>
2145
- <option value="pds-answer-feedback">Result Background</option>
2146
- <option value="pds-answer-feedback-bar">Result Bar</option>
2147
- <option value="pds-totalvotes-inner">Total Votes</option>
2148
- </select>
2149
- </td>
2150
- </tr>
2151
- </table>
2152
- <table width="100%">
2153
- <tr>
2154
- <td valign="top">
2155
- <table class="CSSE_main">
2156
- <tr>
2157
- <td class="CSSE_main_l" valign="top">
2158
- <div class="off" id="D_Font">
2159
- <a href="javascript:CSSE_changeView('Font');" id="A_Font" class="Aoff">Font</a>
2160
- </div>
2161
- <div class="on" id="D_Background">
2162
- <a href="javascript:CSSE_changeView('Background');" id="A_Background" class="Aon">Background</a>
2163
- </div>
2164
- <div class="off" id="D_Border">
2165
- <a href="javascript:CSSE_changeView('Border');" id="A_Border" class="Aoff">Border</a>
2166
- </div>
2167
- <div class="off" id="D_Margin">
2168
- <a href="javascript:CSSE_changeView('Margin');" id="A_Margin" class="Aoff">Margin</a>
2169
- </div>
2170
- <div class="off" id="D_Padding">
2171
- <a href="javascript:CSSE_changeView('Padding');" id="A_Padding" class="Aoff">Padding</a>
2172
- </div>
2173
- <div class="off" id="D_Scale">
2174
- <a href="javascript:CSSE_changeView('Scale');" id="A_Scale" class="Aoff">Width</a>
2175
- </div>
2176
- <div class="off" id="D_Height">
2177
- <a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff">Height</a>
2178
- </div>
2179
- </td>
2180
- <td class="CSSE_main_r" valign="top">
2181
- <table class="CSSE_sub">
2182
- <tr>
2183
- <td class="top"/>
2184
- </tr>
2185
- <tr>
2186
- <td class="mid">
2187
- <!-- Font Table -->
2188
- <table class="CSSE_edit" id="editFont" style="display:none;">
2189
- <tr>
2190
- <td width="85">Font Size:</td>
2191
- <td>
2192
- <select id="font-size" onchange="bind(this);">
2193
- <option value="6px">6px</option>
2194
- <option value="8px">8px</option>
2195
- <option value="9px">9px</option>
2196
- <option value="10px">10px</option>
2197
- <option value="11px">11px</option>
2198
- <option value="12px">12px</option>
2199
- <option value="13px">13px</option>
2200
- <option value="14px">14px</option>
2201
- <option value="15px">15px</option>
2202
- <option value="16px">16px</option>
2203
- <option value="18px">18px</option>
2204
- <option value="20px">20px</option>
2205
- <option value="24px">24px</option>
2206
- <option value="30px">30px</option>
2207
- <option value="36px">36px</option>
2208
- </select>
2209
- </td>
2210
- </tr>
2211
- <tr>
2212
- <td>Font Size</td>
2213
- <td>
2214
- <select id="font-family" onchange="bind(this);">
2215
- <option value="Arial">Arial</option>
2216
- <option value="Comic Sans MS">Comic Sans MS</option>
2217
- <option value="Courier">Courier</option>
2218
- <option value="Georgia">Georgia</option>
2219
- <option value="Lucida Grande">Lucida Grande</option>
2220
- <option value="Trebuchet MS">Trebuchet MS</option>
2221
- <option value="Times">Times</option>
2222
- <option value="Verdana">Verdana</option>
2223
- </select>
2224
- </td>
2225
- </tr>
2226
- <tr>
2227
- <td>Color (#hex):</td>
2228
- <td>
2229
- <input type="text" maxlength="11" id="color" class="elmColor jscolor-picker" onblur="bind(this);" style="float:left;"/>
2230
- </td>
2231
- </tr>
2232
- <tr>
2233
- <td>Bold:</td>
2234
- <td>
2235
- <input type="checkbox" id="font-weight" value="bold" onclick="bind(this);"/>
2236
- </td>
2237
- </tr>
2238
- <tr>
2239
- <td>Italic:</td>
2240
- <td>
2241
- <input type="checkbox" id="font-style" value="italic" onclick="bind(this);"/>
2242
- </td>
2243
- </tr>
2244
- <tr>
2245
- <td>Underline:</td>
2246
- <td>
2247
- <input type="checkbox" id="text-decoration" value="underline" onclick="bind(this);"/>
2248
- </td>
2249
- </tr>
2250
- <tr>
2251
- <td>Line Height:</td>
2252
- <td>
2253
- <select id="line-height" onchange="bind(this);">
2254
- <option value="6px">6px</option>
2255
- <option value="8px">8px</option>
2256
- <option value="9px">9px</option>
2257
- <option value="10px">10px</option>
2258
- <option value="11px">11px</option>
2259
- <option value="12px">12px</option>
2260
- <option value="13px">13px</option>
2261
- <option value="14px">14px</option>
2262
- <option value="15px">15px</option>
2263
- <option value="16px">16px</option>
2264
- <option value="18px">18px</option>
2265
- <option value="20px">20px</option>
2266
- <option value="24px">24px</option>
2267
- <option value="30px">30px</option>
2268
- <option value="36px">36px</option>
2269
- </select>
2270
- </td>
2271
- </tr>
2272
- <tr>
2273
- <td>Align:</td>
2274
- <td>
2275
- <select id="text-align" onchange="bind(this);">
2276
- <option value="left">Left</option>
2277
- <option value="center">Center</option>
2278
- <option value="right">Right</option>
2279
- </select>
2280
- </td>
2281
- </tr>
2282
- </table>
2283
- <!-- Background Table -->
2284
- <table class="CSSE_edit" id="editBackground" style="display:none;">
2285
- <tr>
2286
- <td width="85">Color (#hex):</td>
2287
- <td>
2288
- <input type="text" maxlength="11" id="background-color" class="elmColor jscolor-picker" onblur="bind(this);"/>
2289
- </td>
2290
- </tr>
2291
- <tr>
2292
- <td>Image URL: <a class="noteLink" title="Click here for more information" onclick="showNote('noteImageURL',this, 'Image URL');">(?)</a></td>
2293
- <td>
2294
- <input type="text" id="background-image" onblur="bind(this);"/>
2295
- </td>
2296
- </tr>
2297
- <tr>
2298
- <td>Image Repeat:</td>
2299
- <td>
2300
- <select id="background-repeat" onchange="bind(this);">
2301
- <option value="repeat">repeat</option>
2302
- <option value="no-repeat">no-repeat</option>
2303
- <option value="repeat-x">repeat-x</option>
2304
- <option value="repeat-y">repeat-y</option>
2305
- </select>
2306
- </td>
2307
- </tr>
2308
- <tr>
2309
- <td>Image Position:</td>
2310
- <td>
2311
- <select id="background-position" onchange="bind(this);">
2312
- <option value="left top">left top</option>
2313
- <option value="left center">left center</option>
2314
- <option value="left bottom">left bottom</option>
2315
- <option value="center top">center top</option>
2316
- <option value="center center">center center</option>
2317
- <option value="center bottom">center bottom</option>
2318
- <option value="right top">right top</option>
2319
- <option value="right center">right center</option>
2320
- <option value="right bottom">right bottom</option>
2321
- </select>
2322
- </td>
2323
- </tr>
2324
- </table>
2325
- <!-- Border Table -->
2326
- <table class="CSSE_edit" id="editBorder" style="display:none;">
2327
- <tr>
2328
- <td width="85">Width:</td>
2329
- <td>
2330
- <select id="border-width" onchange="bind(this);">
2331
- <option value="0px">0px</option>
2332
- <option value="1px">1px</option>
2333
- <option value="2px">2px</option>
2334
- <option value="3px">3px</option>
2335
- <option value="4px">4px</option>
2336
- <option value="5px">5px</option>
2337
- <option value="6px">6px</option>
2338
- <option value="7px">7px</option>
2339
- <option value="8px">8px</option>
2340
- <option value="9px">9px</option>
2341
- <option value="10px">10px</option>
2342
- <option value="11px">11px</option>
2343
- <option value="12px">12px</option>
2344
- <option value="13px">13px</option>
2345
- <option value="14px">14px</option>
2346
- <option value="15px">15px</option>
2347
- <option value="16px">16px</option>
2348
- <option value="17px">17px</option>
2349
- <option value="18px">18px</option>
2350
- <option value="19px">19px</option>
2351
- <option value="20px">20px</option>
2352
- <option value="21px">21px</option>
2353
- <option value="22px">22px</option>
2354
- <option value="23px">23px</option>
2355
- <option value="24px">24px</option>
2356
- <option value="25px">25px</option>
2357
- <option value="26px">26px</option>
2358
- <option value="27px">27px</option>
2359
- <option value="28px">28px</option>
2360
- <option value="29px">29px</option>
2361
- <option value="30px">30px</option>
2362
- </select>
2363
- </td>
2364
- </tr>
2365
- <tr>
2366
- <td>Style:</td>
2367
- <td>
2368
- <select id="border-style" onchange="bind(this);">
2369
- <option value="none">none</option>
2370
- <option value="solid">solid</option>
2371
- <option value="dotted">dotted</option>
2372
- <option value="dashed">dashed</option>
2373
- <option value="double">double</option>
2374
- <option value="groove">groove</option>
2375
- <option value="inset">inset</option>
2376
- <option value="outset">outset</option>
2377
- <option value="ridge">ridge</option>
2378
- <option value="hidden">hidden</option>
2379
- </select>
2380
- </td>
2381
- </tr>
2382
- <tr>
2383
- <td>Color (#hex):</td>
2384
- <td>
2385
- <input type="text" maxlength="11" class="elmColor jscolor-picker" id="border-color" onblur="bind(this);"/>
2386
- </td>
2387
- </tr>
2388
- <tr>
2389
- <td width="85">Rounded Corners:</td>
2390
- <td>
2391
- <select id="border-radius" onchange="bind(this);">
2392
- <option value="0px">0px</option>
2393
- <option value="1px">1px</option>
2394
- <option value="2px">2px</option>
2395
- <option value="3px">3px</option>
2396
- <option value="4px">4px</option>
2397
- <option value="5px">5px</option>
2398
- <option value="6px">6px</option>
2399
- <option value="7px">7px</option>
2400
- <option value="8px">8px</option>
2401
- <option value="9px">9px</option>
2402
- <option value="10px">10px</option>
2403
- <option value="11px">11px</option>
2404
- <option value="12px">12px</option>
2405
- <option value="13px">13px</option>
2406
- <option value="14px">14px</option>
2407
- <option value="15px">15px</option>
2408
- <option value="16px">16px</option>
2409
- <option value="17px">17px</option>
2410
- <option value="18px">18px</option>
2411
- <option value="19px">19px</option>
2412
- <option value="20px">20px</option>
2413
- <option value="21px">21px</option>
2414
- <option value="22px">22px</option>
2415
- <option value="23px">23px</option>
2416
- <option value="24px">24px</option>
2417
- <option value="25px">25px</option>
2418
- <option value="26px">26px</option>
2419
- <option value="27px">27px</option>
2420
- <option value="28px">28px</option>
2421
- <option value="29px">29px</option>
2422
- <option value="30px">30px</option>
2423
- </select>
2424
- <br/>
2425
- Not supported in Internet Explorer.
2426
- </td>
2427
- </tr>
2428
- </table>
2429
- <!-- Margin Table -->
2430
- <table class="CSSE_edit" id="editMargin" style="display:none;">
2431
- <tr>
2432
- <td width="85">Top: </td>
2433
- <td>
2434
- <select id="margin-top" onchange="bind(this);">
2435
- <option value="0px">0px</option>
2436
- <option value="1px">1px</option>
2437
- <option value="2px">2px</option>
2438
- <option value="3px">3px</option>
2439
- <option value="4px">4px</option>
2440
- <option value="5px">5px</option>
2441
- <option value="6px">6px</option>
2442
- <option value="7px">7px</option>
2443
- <option value="8px">8px</option>
2444
- <option value="9px">9px</option>
2445
- <option value="10px">10px</option>
2446
- <option value="11px">11px</option>
2447
- <option value="12px">12px</option>
2448
- <option value="13px">13px</option>
2449
- <option value="14px">14px</option>
2450
- <option value="15px">15px</option>
2451
- <option value="16px">16px</option>
2452
- <option value="17px">17px</option>
2453
- <option value="18px">18px</option>
2454
- <option value="19px">19px</option>
2455
- <option value="20px">20px</option>
2456
- <option value="21px">21px</option>
2457
- <option value="22px">22px</option>
2458
- <option value="23px">23px</option>
2459
- <option value="24px">24px</option>
2460
- <option value="25px">25px</option>
2461
- <option value="26px">26px</option>
2462
- <option value="27px">27px</option>
2463
- <option value="28px">28px</option>
2464
- <option value="29px">29px</option>
2465
- <option value="30px">30px</option>
2466
- </select>
2467
- </td>
2468
- </tr>
2469
- <tr>
2470
- <td>Right:</td>
2471
- <td>
2472
- <select id="margin-right" onchange="bind(this);">
2473
- <option value="0px">0px</option>
2474
- <option value="1px">1px</option>
2475
- <option value="2px">2px</option>
2476
- <option value="3px">3px</option>
2477
- <option value="4px">4px</option>
2478
- <option value="5px">5px</option>
2479
- <option value="6px">6px</option>
2480
- <option value="7px">7px</option>
2481
- <option value="8px">8px</option>
2482
- <option value="9px">9px</option>
2483
- <option value="10px">10px</option>
2484
- <option value="11px">11px</option>
2485
- <option value="12px">12px</option>
2486
- <option value="13px">13px</option>
2487
- <option value="14px">14px</option>
2488
- <option value="15px">15px</option>
2489
- <option value="16px">16px</option>
2490
- <option value="17px">17px</option>
2491
- <option value="18px">18px</option>
2492
- <option value="19px">19px</option>
2493
- <option value="20px">20px</option>
2494
- <option value="21px">21px</option>
2495
- <option value="22px">22px</option>
2496
- <option value="23px">23px</option>
2497
- <option value="24px">24px</option>
2498
- <option value="25px">25px</option>
2499
- <option value="26px">26px</option>
2500
- <option value="27px">27px</option>
2501
- <option value="28px">28px</option>
2502
- <option value="29px">29px</option>
2503
- <option value="30px">30px</option>
2504
- </select>
2505
- </td>
2506
- </tr>
2507
- <tr>
2508
- <td>Bottom:</td>
2509
- <td>
2510
- <select id="margin-bottom" onchange="bind(this);">
2511
- <option value="0px">0px</option>
2512
- <option value="1px">1px</option>
2513
- <option value="2px">2px</option>
2514
- <option value="3px">3px</option>
2515
- <option value="4px">4px</option>
2516
- <option value="5px">5px</option>
2517
- <option value="6px">6px</option>
2518
- <option value="7px">7px</option>
2519
- <option value="8px">8px</option>
2520
- <option value="9px">9px</option>
2521
- <option value="10px">10px</option>
2522
- <option value="11px">11px</option>
2523
- <option value="12px">12px</option>
2524
- <option value="13px">13px</option>
2525
- <option value="14px">14px</option>
2526
- <option value="15px">15px</option>
2527
- <option value="16px">16px</option>
2528
- <option value="17px">17px</option>
2529
- <option value="18px">18px</option>
2530
- <option value="19px">19px</option>
2531
- <option value="20px">20px</option>
2532
- <option value="21px">21px</option>
2533
- <option value="22px">22px</option>
2534
- <option value="23px">23px</option>
2535
- <option value="24px">24px</option>
2536
- <option value="25px">25px</option>
2537
- <option value="26px">26px</option>
2538
- <option value="27px">27px</option>
2539
- <option value="28px">28px</option>
2540
- <option value="29px">29px</option>
2541
- <option value="30px">30px</option>
2542
- </select>
2543
- </td>
2544
- </tr>
2545
- <tr>
2546
- <td>Left:</td>
2547
- <td>
2548
- <select id="margin-left" onchange="bind(this);">
2549
- <option value="0px">0px</option>
2550
- <option value="1px">1px</option>
2551
- <option value="2px">2px</option>
2552
- <option value="3px">3px</option>
2553
- <option value="4px">4px</option>
2554
- <option value="5px">5px</option>
2555
- <option value="6px">6px</option>
2556
- <option value="7px">7px</option>
2557
- <option value="8px">8px</option>
2558
- <option value="9px">9px</option>
2559
- <option value="10px">10px</option>
2560
- <option value="11px">11px</option>
2561
- <option value="12px">12px</option>
2562
- <option value="13px">13px</option>
2563
- <option value="14px">14px</option>
2564
- <option value="15px">15px</option>
2565
- <option value="16px">16px</option>
2566
- <option value="17px">17px</option>
2567
- <option value="18px">18px</option>
2568
- <option value="19px">19px</option>
2569
- <option value="20px">20px</option>
2570
- <option value="21px">21px</option>
2571
- <option value="22px">22px</option>
2572
- <option value="23px">23px</option>
2573
- <option value="24px">24px</option>
2574
- <option value="25px">25px</option>
2575
- <option value="26px">26px</option>
2576
- <option value="27px">27px</option>
2577
- <option value="28px">28px</option>
2578
- <option value="29px">29px</option>
2579
- <option value="30px">30px</option>
2580
- </select>
2581
- </td>
2582
- </tr>
2583
- </table>
2584
- <!-- Padding Table -->
2585
- <table class="CSSE_edit" id="editPadding" style="display:none;">
2586
- <tr>
2587
- <td width="85">Top:</td>
2588
- <td>
2589
- <select id="padding-top" onchange="bind(this);">
2590
- <option value="0px">0px</option>
2591
- <option value="1px">1px</option>
2592
- <option value="2px">2px</option>
2593
- <option value="3px">3px</option>
2594
- <option value="4px">4px</option>
2595
- <option value="5px">5px</option>
2596
- <option value="6px">6px</option>
2597
- <option value="7px">7px</option>
2598
- <option value="8px">8px</option>
2599
- <option value="9px">9px</option>
2600
- <option value="10px">10px</option>
2601
- <option value="11px">11px</option>
2602
- <option value="12px">12px</option>
2603
- <option value="13px">13px</option>
2604
- <option value="14px">14px</option>
2605
- <option value="15px">15px</option>
2606
- <option value="16px">16px</option>
2607
- <option value="17px">17px</option>
2608
- <option value="18px">18px</option>
2609
- <option value="19px">19px</option>
2610
- <option value="20px">20px</option>
2611
- <option value="21px">21px</option>
2612
- <option value="22px">22px</option>
2613
- <option value="23px">23px</option>
2614
- <option value="24px">24px</option>
2615
- <option value="25px">25px</option>
2616
- <option value="26px">26px</option>
2617
- <option value="27px">27px</option>
2618
- <option value="28px">28px</option>
2619
- <option value="29px">29px</option>
2620
- <option value="30px">30px</option>
2621
- </select>
2622
- </td>
2623
- </tr>
2624
- <tr>
2625
- <td>Right:</td>
2626
- <td>
2627
- <select id="padding-right" onchange="bind(this);">
2628
- <option value="0px">0px</option>
2629
- <option value="1px">1px</option>
2630
- <option value="2px">2px</option>
2631
- <option value="3px">3px</option>
2632
- <option value="4px">4px</option>
2633
- <option value="5px">5px</option>
2634
- <option value="6px">6px</option>
2635
- <option value="7px">7px</option>
2636
- <option value="8px">8px</option>
2637
- <option value="9px">9px</option>
2638
- <option value="10px">10px</option>
2639
- <option value="11px">11px</option>
2640
- <option value="12px">12px</option>
2641
- <option value="13px">13px</option>
2642
- <option value="14px">14px</option>
2643
- <option value="15px">15px</option>
2644
- <option value="16px">16px</option>
2645
- <option value="17px">17px</option>
2646
- <option value="18px">18px</option>
2647
- <option value="19px">19px</option>
2648
- <option value="20px">20px</option>
2649
- <option value="21px">21px</option>
2650
- <option value="22px">22px</option>
2651
- <option value="23px">23px</option>
2652
- <option value="24px">24px</option>
2653
- <option value="25px">25px</option>
2654
- <option value="26px">26px</option>
2655
- <option value="27px">27px</option>
2656
- <option value="28px">28px</option>
2657
- <option value="29px">29px</option>
2658
- <option value="30px">30px</option>
2659
- </select>
2660
- </td>
2661
- </tr>
2662
- <tr>
2663
- <td>Bottom:</td>
2664
- <td>
2665
- <select id="padding-bottom" onchange="bind(this);">
2666
- <option value="0px">0px</option>
2667
- <option value="1px">1px</option>
2668
- <option value="2px">2px</option>
2669
- <option value="3px">3px</option>
2670
- <option value="4px">4px</option>
2671
- <option value="5px">5px</option>
2672
- <option value="6px">6px</option>
2673
- <option value="7px">7px</option>
2674
- <option value="8px">8px</option>
2675
- <option value="9px">9px</option>
2676
- <option value="10px">10px</option>
2677
- <option value="11px">11px</option>
2678
- <option value="12px">12px</option>
2679
- <option value="13px">13px</option>
2680
- <option value="14px">14px</option>
2681
- <option value="15px">15px</option>
2682
- <option value="16px">16px</option>
2683
- <option value="17px">17px</option>
2684
- <option value="18px">18px</option>
2685
- <option value="19px">19px</option>
2686
- <option value="20px">20px</option>
2687
- <option value="21px">21px</option>
2688
- <option value="22px">22px</option>
2689
- <option value="23px">23px</option>
2690
- <option value="24px">24px</option>
2691
- <option value="25px">25px</option>
2692
- <option value="26px">26px</option>
2693
- <option value="27px">27px</option>
2694
- <option value="28px">28px</option>
2695
- <option value="29px">29px</option>
2696
- <option value="30px">30px</option>
2697
- </select>
2698
- </td>
2699
- </tr>
2700
- <tr>
2701
- <td>Left:</td>
2702
- <td>
2703
- <select id="padding-left" onchange="bind(this);">
2704
- <option value="0px">0px</option>
2705
- <option value="1px">1px</option>
2706
- <option value="2px">2px</option>
2707
- <option value="3px">3px</option>
2708
- <option value="4px">4px</option>
2709
- <option value="5px">5px</option>
2710
- <option value="6px">6px</option>
2711
- <option value="7px">7px</option>
2712
- <option value="8px">8px</option>
2713
- <option value="9px">9px</option>
2714
- <option value="10px">10px</option>
2715
- <option value="11px">11px</option>
2716
- <option value="12px">12px</option>
2717
- <option value="13px">13px</option>
2718
- <option value="14px">14px</option>
2719
- <option value="15px">15px</option>
2720
- <option value="16px">16px</option>
2721
- <option value="17px">17px</option>
2722
- <option value="18px">18px</option>
2723
- <option value="19px">19px</option>
2724
- <option value="20px">20px</option>
2725
- <option value="21px">21px</option>
2726
- <option value="22px">22px</option>
2727
- <option value="23px">23px</option>
2728
- <option value="24px">24px</option>
2729
- <option value="25px">25px</option>
2730
- <option value="26px">26px</option>
2731
- <option value="27px">27px</option>
2732
- <option value="28px">28px</option>
2733
- <option value="29px">29px</option>
2734
- <option value="30px">30px</option>
2735
- </select>
2736
- </td>
2737
- </tr>
2738
- </table>
2739
- <!-- Scale Table -->
2740
- <table class="CSSE_edit" id="editScale" style="display:none;">
2741
- <tr>
2742
- <td width="85">Width (px): <a class="noteLink" title="Click here for more information" onclick="showNote('noteWidth',this, 'Width');">(?)</a></td>
2743
- <td>
2744
- <input type="text" maxlength="4" class="elmColor" id="width" onblur="bind(this);"/>
2745
- </td>
2746
- </tr>
2747
- <tr>
2748
- <td width="85"></td>
2749
- <td>
2750
- If you change the width of the<br/> poll you may also need to change<br/> the width of your answers.
2751
- </td>
2752
- </tr>
2753
- </table>
2754
-
2755
- <!-- Height Table -->
2756
- <table class="CSSE_edit" id="editHeight" style="display:none;">
2757
- <tr>
2758
- <td width="85">Height (px):</td>
2759
- <td>
2760
- <input type="text" maxlength="4" class="elmColor" id="height" onblur="bind(this);"/>
2761
- </td>
2762
- </tr>
2763
- </table>
2764
- </td>
2765
- </tr>
2766
- <tr>
2767
- <td class="btm"/>
2768
- </tr>
2769
- </table>
2770
- </td>
2771
- </tr>
2772
- </table>
2773
- </td>
2774
- <td width="10"> </td>
2775
- <td valign="top">
2776
- <div style="overflow-x:auto;width:633px;">
2777
- <!-- POLL XHTML START -->
2778
- <div class="pds-box" id="pds-box">
2779
- <div class="pds-box-outer">
2780
- <div class="pds-box-inner">
2781
- <div class="pds-box-top">
2782
- <div class="pds-question">
2783
- <div class="pds-question-outer">
2784
- <div class="pds-question-inner">
2785
- <div class="pds-question-top" id="pds-question-top">Do you mostly use the internet at work, in school or at home?</div>
2786
- </div>
2787
- </div>
2788
- </div>
2789
- <div>
2790
- <!-- divAnswers -->
2791
- <div id="divAnswers">
2792
- <span id="pds-answer143974">
2793
-
2794
- <span class="pds-answer-group" id="pds-answer-group">
2795
- <span class="pds-answer-input" id="pds-answer-input">
2796
- <input type="radio" name="PDI_answer" value="1" id="p1" class="pds-checkbox"/>
2797
- </span>
2798
- <label for="p1" class="pds-answer" id="pds-answer"><span class="pds-answer-span">I use it in school.</span></label>
2799
- <span class="pds-clear"></span>
2800
- </span>
2801
-
2802
- <span class="pds-answer-group" id="pds-answer-group1">
2803
- <span class="pds-answer-input" id="pds-answer-input1">
2804
- <input type="radio" name="PDI_answer" value="2" id="p2" class="pds-checkbox"/>
2805
- </span>
2806
- <label for="p2" class="pds-answer" id="pds-answer1"><span class="pds-answer-span">I use it at home.</span></label>
2807
- <span class="pds-clear"></span>
2808
- </span>
2809
-
2810
- <span class="pds-answer-group" id="pds-answer-group2">
2811
- <span class="pds-answer-input" id="pds-answer-input2">
2812
- <input type="radio" name="PDI_answer" value="3" id="p3" class="pds-checkbox"/>
2813
- </span>
2814
- <label for="p3" class="pds-answer" id="pds-answer2"><span class="pds-answer-span">I use it every where I go, at work and home and anywhere else that I can!</span></label>
2815
- <span class="pds-clear"></span>
2816
- </span>
2817
-
2818
- <span class="pds-answer-group" id="pds-answer-group3">
2819
- <span class="pds-answer-input" id="pds-answer-input3">
2820
- <input type="radio" name="PDI_answer" value="4" id="p4" class="pds-checkbox"/>
2821
- </span>
2822
- <label for="p4" class="pds-answer" id="pds-answer3"><span class="pds-answer-span">Other:</span></label>
2823
- <span class="pds-clear"></span>
2824
- <span class="pds-answer-other">
2825
- <input type="text" name="PDI_OtherText1761982" id="pds-textfield" maxlength="80" class="pds-textfield"/>
2826
- </span>
2827
- <span class="pds-clear"></span>
2828
- </span>
2829
-
2830
- </span>
2831
- <br/>
2832
- <div class="pds-vote" id="pds-links">
2833
- <div class="pds-votebutton-outer">
2834
- <a href="javascript:renderStyleEdit('pds-answer-feedback');" id="pds-vote-button" style="display:block;float:left;" class="pds-vote-button"><span>Vote</span></a>
2835
- <span class="pds-links">
2836
- <div style="padding: 0px 0px 0px 15px; float:left;"><a href="javascript:renderStyleEdit('pds-answer-feedback');" class="pds-link" id="pds-link">View Results</a></div>
2837
- <span class="pds-clear"></span>
2838
- </span>
2839
- <span class="pds-clear"></span>
2840
- </div>
2841
- </div>
2842
-
2843
- </div>
2844
- <!-- End divAnswers -->
2845
- <!-- divResults -->
2846
- <div id="divResults">
2847
-
2848
- <div class="pds-answer-group" id="pds-answer-group4">
2849
- <label for="PDI_feedback1" class="pds-answer" id="pds-answer4"><span class="pds-answer-text">I use it in school!</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>46%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(620 votes)</span></label>
2850
- <span class="pds-clear"></span>
2851
- <div id="pds-answer-feedback">
2852
- <div style="width:46%;" id="pds-answer-feedback-bar" class="pds-answer-feedback-bar"></div>
2853
- </div>
2854
- <span class="pds-clear"></span>
2855
- </div>
2856
-
2857
- <div class="pds-answer-group" id="pds-answer-group5">
2858
- <label for="PDI_feedback2" class="pds-answer" id="pds-answer5"><span class="pds-answer-text">I use it at home.</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>30%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(400 votes)</span></label>
2859
- <span class="pds-clear"></span>
2860
- <div id="pds-answer-feedback2">
2861
- <div style="width:46%;" id="pds-answer-feedback-bar2" class="pds-answer-feedback-bar"></div>
2862
- </div>
2863
- <span class="pds-clear"></span>
2864
- </div>
2865
-
2866
- <div class="pds-answer-group" id="pds-answer-group6">
2867
- <label for="PDI_feedback3" class="pds-answer" id="pds-answer6"><span class="pds-answer-text">I use it every where I go, at work and home and anywhere else that I can!</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>16%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(220 votes)</span></label>
2868
- <span class="pds-clear"></span>
2869
- <div id="pds-answer-feedback3">
2870
- <div style="width:16%;" id="pds-answer-feedback-bar3" class="pds-answer-feedback-bar"></div>
2871
- </div>
2872
- <span class="pds-clear"></span>
2873
- </div>
2874
-
2875
- <div class="pds-answer-group" id="pds-answer-group7">
2876
- <label for="PDI_feedback4" class="pds-answer" id="pds-answer7"><span class="pds-answer-text">Other</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>8%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(110 votes)</span></label>
2877
- <span class="pds-clear"></span>
2878
- <div id="pds-answer-feedback4">
2879
- <div style="width:8%;" id="pds-answer-feedback-bar4" class="pds-answer-feedback-bar"></div>
2880
- </div>
2881
- <span class="pds-clear"></span>
2882
- </div>
2883
-
2884
- </div>
2885
- <!-- End divResults -->
2886
- <span class="pds-clear"></span>
2887
- <div style="height: 10px;"></div>
2888
- <div id="pds-totalvotes-inner">Total Votes: <strong>1,350</strong></div>
2889
- </div>
2890
- <div class="pds-vote" id="pds-links-back">
2891
- <div class="pds-totalvotes-outer">
2892
- <span class="pds-links-back">
2893
- <br/>
2894
- <a href="javascript:" class="pds-link" id="pds-link1">Comments <strong>(19)</strong></a>
2895
- <xsl:text> </xsl:text>
2896
- <a href="javascript:renderStyleEdit('pds-box');" class="pds-link" id="pds-link2">Return To Poll</a>
2897
- <span class="pds-clear"></span>
2898
- </span>
2899
- <span class="pds-clear"></span>
2900
- </div>
2901
- </div>
2902
- </div>
2903
- </div>
2904
- </div>
2905
- </div>
2906
- <!-- POLL XHTML END -->
2907
- </div>
2908
- </td>
2909
- </tr>
2910
- </table>
2911
- <div id="editBox"></div>
2912
-
2913
- <p class="pds-clear"></p>
2914
-
2915
- <?php wp_nonce_field( $style_id > 1000 ? "edit-style$style_id" : 'create-style' ); ?>
2916
- <input type="hidden" name="action" value="<?php echo $style_id > 1000 ? 'edit-style' : 'create-style'; ?>" />
2917
- <input type="hidden" class="polldaddy-style-id" name="style" value="<?php echo $style_id; ?>" />
2918
- <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Save Style', 'polldaddy' ) ); ?>" />
2919
-
2920
- </div>
2921
- </div>
2922
- <textarea id="S_www" name="CSSXML" style="display:none;width: 1000px; height: 500px;" rows="10" cols="10"> </textarea>
2923
- </form>
2924
- <div id="S_js"/>
2925
- <div id="P_tab"/>
2926
- <script type="text/javascript" language="javascript">window.onload = function() {
2927
- var CSSXML;
2928
- loadStyle();
2929
- showResults( false );
2930
- renderStyleEdit( $('styleName').value );
2931
- }</script>
2932
- <div id="noteImageURL" style="display:none">
2933
- You can place a link to an image here and it<br/>
2934
- will appear in your poll. You must use a URL<br/>
2935
- linking to an image already hosted somewhere<br/>
2936
- on the internet.
2937
- </div>
2938
- <div id="noteWidth" style="display:none">
2939
- To control the width of this element you must<br/>
2940
- enter a numeric value in pixels.
2941
- </div>
2942
- <br class="clear" />
2943
-
2944
- <?php
2945
- }
2946
-
2947
- function rating_settings(){
2948
- global $action, $rating;
2949
- $show_pages = $show_comments = $pos_posts = $pos_pages = $pos_comments = 0;
2950
- $show_settings = $rating_updated = ( $action == 'update-rating' ? true : false );
2951
- $error = false;
2952
-
2953
- $settings_style = 'display: none;';
2954
- if( $show_settings )
2955
- $settings_style = 'display: block;';
2956
-
2957
- if ( isset( $_POST[ 'pd_rating_action_type' ] ) ){
2958
-
2959
- switch ( $_POST[ 'pd_rating_action_type' ] ) :
2960
-
2961
- case 'posts' :
2962
- if ( isset( $_POST[ 'pd_show_posts' ] ) && (int) $_POST[ 'pd_show_posts' ] == 1 )
2963
- $show_posts = get_option( 'pd-rating-posts-id' );
2964
-
2965
- update_option( 'pd-rating-posts', $show_posts );
2966
-
2967
- if ( isset( $_POST[ 'posts_pos' ] ) && (int) $_POST[ 'posts_pos' ] == 1 )
2968
- $pos_posts = 1;
2969
-
2970
- update_option( 'pd-rating-posts-pos', $pos_posts );
2971
- $rating_updated = true;
2972
- break;
2973
-
2974
- case 'pages';
2975
- if ( isset( $_POST[ 'pd_show_pages' ] ) && (int) $_POST[ 'pd_show_pages' ] == 1 )
2976
- $show_pages = get_option( 'pd-rating-pages-id' );
2977
-
2978
- update_option( 'pd-rating-pages', $show_pages );
2979
-
2980
- if ( isset( $_POST[ 'pages_pos' ] ) && (int) $_POST[ 'pages_pos' ] == 1 )
2981
- $pos_pages = 1;
2982
-
2983
- update_option( 'pd-rating-pages-pos', $pos_pages );
2984
- $rating_updated = true;
2985
- break;
2986
-
2987
- case 'comments':
2988
- if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
2989
- $show_comments = get_option( 'pd-rating-comments-id' );
2990
-
2991
- update_option( 'pd-rating-comments', $show_comments );
2992
- if ( isset( $_POST[ 'comments_pos' ] ) && (int) $_POST[ 'comments_pos' ] == 1 )
2993
- $pos_comments = 1;
2994
-
2995
- update_option( 'pd-rating-comments-pos', $pos_comments );
2996
-
2997
- $rating_updated = true;
2998
- break;
2999
- endswitch;
3000
- }
3001
-
3002
- $show_posts = (int) get_option( 'pd-rating-posts' );
3003
- $show_pages = (int) get_option( 'pd-rating-pages' );
3004
- $show_comments = (int) get_option( 'pd-rating-comments' );
3005
-
3006
- $pos_posts = (int) get_option( 'pd-rating-posts-pos' );
3007
- $pos_pages = (int) get_option( 'pd-rating-pages-pos' );
3008
- $pos_comments = (int) get_option( 'pd-rating-comments-pos' );
3009
-
3010
- $rating_id = get_option( 'pd-rating-posts-id' );
3011
- $report_type = 'posts';
3012
- $updated = false;
3013
-
3014
- if ( isset( $rating ) ) {
3015
- switch ( $rating ) :
3016
- case 'pages':
3017
- $report_type = 'pages';
3018
- $rating_id = get_option( 'pd-rating-pages-id' );
3019
- break;
3020
-
3021
- case 'comments':
3022
- $report_type = 'comments';
3023
- $rating_id = get_option( 'pd-rating-comments-id' );
3024
- break;
3025
-
3026
- case 'posts':
3027
- $report_type = 'posts';
3028
- $rating_id = get_option( 'pd-rating-posts-id' );
3029
- break;
3030
- endswitch;
3031
- }
3032
-
3033
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
3034
- $polldaddy->reset();
3035
- $response = $polldaddy->get_rating( $rating_id );
3036
-
3037
- if ( empty( $response ) || (int) $response->_id == 0 ) {
3038
- $polldaddy->reset();
3039
- $new_type = 0;
3040
- if ( $report_type == 'comments' )
3041
- $new_type = 1;
3042
-
3043
- $blog_name = get_option( 'blogname' );
3044
-
3045
- if ( empty( $blog_name ) )
3046
- $blog_name = 'WPORG Blog';
3047
-
3048
- $blog_name .= ' - ' . $report_type;
3049
-
3050
- $response = $polldaddy->create_rating( $blog_name , $new_type );
3051
-
3052
- if( empty( $response ) ) {
3053
- echo '<div class="error"><p>'.sprintf(__('Sorry! There was an error creating your rating widget. Please contact <a href="%1$s" %2$s>PollDaddy support</a> to fix this.'), 'http://polldaddy.com/feedback/', 'target="_blank"') . '</p></div>';
3054
- $error = true;
3055
- } else {
3056
- $rating_id = (int) $response->_id;
3057
- update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
3058
- update_option ( 'pd-rating-' . $report_type, 0 );
3059
-
3060
- switch ( $report_type ) :
3061
- case 'posts':
3062
- $show_posts = 0;
3063
- break;
3064
- case 'pages':
3065
- $show_pages = 0;
3066
- break;
3067
- case 'comments':
3068
- $show_comments = 0;
3069
- break;
3070
- endswitch;
3071
- }
3072
- $polldaddy->reset();
3073
- $response = $polldaddy->get_rating( $rating_id );
3074
- }
3075
-
3076
- if ( !empty( $response ) ) {
3077
- $settings_text = $response->settings;
3078
- $settings = json_decode( $settings_text );
3079
-
3080
- $rating_type = 0;
3081
-
3082
- if( $settings->type == 'stars' )
3083
- $rating_type = 0;
3084
- else
3085
- $rating_type = 1;
3086
-
3087
- if( empty( $settings->font_color ) )
3088
- $settings->font_color = '#000000';
3089
- }
3090
-
3091
- ?>
3092
- <div class="wrap">
3093
- <h2><?php _e('Rating Settings'); ?></h2>
3094
- <?php
3095
- if ( $rating_updated )
3096
- echo( '<div class="updated"><p>'.__('Rating updated').'</p></div>' );
3097
-
3098
- if ( !$error ){
3099
- ?>
3100
- <div id="side-sortables">
3101
- <div id="categorydiv">
3102
- <ul id="category-tabs">
3103
- <?php
3104
- $this_class = '';
3105
- $posts_link = clean_url( add_query_arg( array( 'rating' => 'posts', 'message' => false ) ) );
3106
- $pages_link = clean_url( add_query_arg( array( 'rating' => 'pages', 'message' => false ) ) );
3107
- $comments_link = clean_url( add_query_arg( array( 'rating' => 'comments', 'message' => false ) ) );
3108
- if ( $report_type == 'posts' )
3109
- $this_class = ' class="tabs"';
3110
- ?>
3111
- <li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $posts_link; ?>"><?php _e('Posts');?></a></li>
3112
- <?php
3113
- $this_class = '';
3114
- if ( $report_type == 'pages' )
3115
- $this_class = ' class="tabs"';
3116
- ?>
3117
- <li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $pages_link; ?>"><?php _e('Pages');?></a></li>
3118
- <?php
3119
- $this_class = '';
3120
- if ( $report_type == 'comments' )
3121
- $this_class = ' class="tabs"';
3122
- ?>
3123
- <li <?php echo( $this_class ); ?>><a href="<?php echo $comments_link; ?>"><?php _e('Comments');?></a></li>
3124
- </ul>
3125
- <div class="tabs-panel" id="categories-all" style="background: #FFFFFF;height: auto; overflow: visible;">
3126
- <form action="" method="post">
3127
- <input type="hidden" name="pd_rating_action_type" value="<?php echo ( $report_type ); ?>" />
3128
- <table class="form-table" style="width: normal;">
3129
- <tbody>
3130
- <?php
3131
- if ( $report_type == 'posts' ){
3132
- ?>
3133
- <tr valign="top">
3134
- <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3135
- <label for="pd_show_posts">
3136
- <input type="checkbox" name="pd_show_posts" id="pd_show_posts" <?php if( $show_posts > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for blog posts');?>
3137
- </label>
3138
-
3139
- <span id="span_posts">
3140
- <select name="posts_pos">
3141
- <?php
3142
- $select = array( __('Above each blog post') => '0', __('Below each blog post') => '1' );
3143
- foreach( $select as $option => $value ) :
3144
- $selected = '';
3145
- if ( $value == $pos_posts )
3146
- $selected = ' selected="selected"';
3147
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3148
- endforeach;
3149
- ?>
3150
- </select>
3151
- </span>
3152
- </td>
3153
- </tr>
3154
- <?php
3155
- }
3156
- if ( $report_type == 'pages' ){
3157
- ?>
3158
- <tr valign="top">
3159
- <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3160
- <label for="pd_show_pages">
3161
- <input type="checkbox" name="pd_show_pages" id="pd_show_pages" <?php if( $show_pages > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for pages');?>
3162
- </label>
3163
-
3164
- <span id="span_pages">
3165
- <select name="pages_pos">
3166
- <?php
3167
- $select = array( __('Above each page') => '0', __('Below each page') => '1' );
3168
- foreach( $select as $option => $value ) :
3169
- $selected = '';
3170
- if ( $value == $pos_pages )
3171
- $selected = ' selected="selected"';
3172
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3173
- endforeach;
3174
- ?>
3175
- </select>
3176
- </span>
3177
- </td>
3178
- </tr>
3179
- <?php
3180
- }
3181
- if ( $report_type == 'comments' ){
3182
- ?>
3183
- <tr valign="top">
3184
- <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3185
- <label for="pd_show_comments">
3186
- <input type="checkbox" name="pd_show_comments" id="pd_show_comments" <?php if( $show_comments > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for comments');?>
3187
- </label>
3188
-
3189
- <span id="span_comments">
3190
- <select name="comments_pos">
3191
- <?php
3192
- $select = array( __('Above each comment') => '0', __('Below each comment') => '1' );
3193
- foreach( $select as $option => $value ) :
3194
- $selected = '';
3195
- if ( $value == $pos_comments )
3196
- $selected = ' selected="selected"';
3197
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3198
- endforeach;
3199
- ?>
3200
- </select>
3201
- </span>
3202
- </td>
3203
- </tr>
3204
- <?php } ?>
3205
- </tbody>
3206
- </table>
3207
- <p class="submit">
3208
- <input class="button-primary" type="submit" value="<?php esc_attr_e('Save Changes');?>" name="Submit" />
3209
- </p>
3210
- <?php
3211
- if ( $report_type == 'posts' && $show_posts > 0 )
3212
- $show_settings = true;
3213
- if ( $report_type == 'pages' && $show_pages > 0 )
3214
- $show_settings = true;
3215
- if ( $report_type == 'comments' && $show_comments > 0 )
3216
- $show_settings = true;
3217
- if ( $show_settings == true )
3218
- echo ( '<a href="javascript:" onclick="show_settings();">'.__('Advanced Settings').'</a>' );
3219
- ?>
3220
- </form>
3221
- </div>
3222
- </div>
3223
- </div>
3224
-
3225
- <?php if ( $show_settings == true ){ ?>
3226
- <br/>
3227
- <form method="post" action="">
3228
- <div id="poststuff" style="<?php echo( $settings_style ); ?>">
3229
- <div class="has-sidebar has-right-sidebar">
3230
- <div class="inner-sidebar-ratings">
3231
- <div class="postbox" id="submitdiv">
3232
- <h3><?php _e('Save');?></h3>
3233
- <div class="inside">
3234
- <div id="major-publishing-actions">
3235
- <input type="hidden" name="type" value="<?php echo( $report_type ); ?>" />
3236
- <input type="hidden" name="rating_id" value="<?php echo( $rating_id ); ?>" />
3237
- <input type="hidden" name="action" value="update-rating" />
3238
- <p id="publishing-action">
3239
- <input type="submit" value="<?php _e('Save Changes');?>" class="button-primary"/>
3240
- </p>
3241
- <br class="clear"/>
3242
- </div>
3243
- </div>
3244
- </div>
3245
- <div class="postbox">
3246
- <h3><?php _e('Preview');?></h3>
3247
- <div class="inside">
3248
- <p><?php _e('This is a demo of what your rating widget will look like'); ?>.</p>
3249
- <p>
3250
- <div id="pd_rating_holder_1"></div>
3251
- </p>
3252
- </div>
3253
- </div>
3254
- <div class="postbox">
3255
- <h3><?php _e('Customize Labels');?></h3>
3256
- <div class="inside">
3257
- <table>
3258
- <tr>
3259
- <td width="100" height="30"><?php _e('votes');?></td>
3260
- <td><input onblur="pd_bind(this);" type="text" name="text_votes" id="text_votes" value="<?php echo( wp_specialchars( $settings->text_votes ) ); ?>" maxlength="20" />
3261
- </tr>
3262
- <tr>
3263
- <td height="30"><?php _e('rate this');?></td>
3264
- <td><input onblur="pd_bind(this);" type="text" name="text_rate_this" id="text_rate_this" value="<?php echo( wp_specialchars( $settings->text_rate_this ) ); ?>" maxlength="20" />
3265
- </tr>
3266
- <tr>
3267
- <td height="30"><?php printf(__( '%d star', 'polldaddy' ), 1);?></td>
3268
- <td><input onblur="pd_bind(this);" type="text" name="text_1_star" id="text_1_star" value="<?php echo( wp_specialchars( $settings->text_1_star ) ); ?>" maxlength="20" />
3269
- </tr>
3270
- <tr>
3271
- <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 2);?></td>
3272
- <td><input onblur="pd_bind(this);" type="text" name="text_2_star" id="text_2_star" value="<?php echo( wp_specialchars( $settings->text_2_star ) ); ?>" maxlength="20" />
3273
- </tr>
3274
- <tr>
3275
- <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 3);?></td>
3276
- <td><input onblur="pd_bind(this);" type="text" name="text_3_star" id="text_3_star" value="<?php echo( wp_specialchars( $settings->text_3_star ) ); ?>" maxlength="20" />
3277
- </tr>
3278
- <tr>
3279
- <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 4);?></td>
3280
- <td><input onblur="pd_bind(this);" type="text" name="text_4_star" id="text_4_star" value="<?php echo( wp_specialchars( $settings->text_4_star ) ); ?>" maxlength="20" />
3281
- </tr>
3282
- <tr>
3283
- <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 5);?></td>
3284
- <td><input onblur="pd_bind(this);" type="text" name="text_5_star" id="text_5_star" value="<?php echo( wp_specialchars( $settings->text_5_star ) ); ?>" maxlength="20" />
3285
- </tr>
3286
- <tr>
3287
- <td height="30"><?php _e('Thank You');?></td>
3288
- <td><input onblur="pd_bind(this);" type="text" name="text_thank_you" id="text_thank_you" value="<?php echo( wp_specialchars( $settings->text_thank_you ) ); ?>" maxlength="20" />
3289
- </tr>
3290
- <tr>
3291
- <td height="30"><?php _e('Rate Up');?></td>
3292
- <td><input onblur="pd_bind(this);" type="text" name="text_rate_up" id="text_rate_up" value="<?php echo( wp_specialchars( $settings->text_rate_up ) ); ?>" maxlength="20" />
3293
- </tr>
3294
- <tr>
3295
- <td height="30"><?php _e('Rate Down');?></td>
3296
- <td><input onblur="pd_bind(this);" type="text" name="text_rate_down" id="text_rate_down" value="<?php echo( wp_specialchars( $settings->text_rate_down ) ); ?>" maxlength="20" />
3297
- </tr>
3298
- </table>
3299
- </div>
3300
- </div>
3301
-
3302
- </div>
3303
- <div id="post-body-content" class="has-sidebar-content">
3304
-
3305
- <div class="postbox">
3306
- <h3><?php _e('Rating Type');?></h3>
3307
- <div class="inside">
3308
- <p><?php _e('Here you can choose how you want your rating to display. The 5 star rating is the most commonly used. The Nero rating is useful for keeping it simple.'); ?></p>
3309
- <ul>
3310
- <li style="display: inline;margin-right: 10px;">
3311
- <label for="stars">
3312
- <?php
3313
- $checked = '';
3314
- if ( $settings->type == 'stars' )
3315
- $checked = ' checked="checked"';
3316
- ?>
3317
- <input type="radio" onchange="pd_change_type( 0 );" <?php echo ( $checked ); ?> value="stars" id="stars" name="rating_type" />
3318
- <?php printf(__( '%d Star Rating', 'polldaddy' ), 5);?>
3319
- </label>
3320
- </li>
3321
- <li style="display: inline;">
3322
- <label>
3323
- <?php
3324
- $checked = '';
3325
- if ( $settings->type == 'nero' )
3326
- $checked = ' checked="checked"';
3327
- ?>
3328
- <input type="radio" onchange="pd_change_type( 1 );" <?php echo( $checked ); ?> value="nero" id="nero" name="rating_type" />
3329
- <?php _e('Nero Rating');?>
3330
- </label>
3331
- </li>
3332
- </ul>
3333
- </div>
3334
- </div>
3335
- <div class="postbox">
3336
- <h3><?php _e('Rating Style');?></h3>
3337
- <div class="inside">
3338
- <table>
3339
- <tr>
3340
- <td height="30" width="100" id="editor_star_size_text"><?php _e('Star Size');?></td>
3341
- <td>
3342
- <select name="size" id="size" onchange="pd_bind(this);">
3343
- <?php
3344
- $select = array( __('Small')." (16px)" => "sml", __('Medium')." (20px)" => "med", __('Large')." (24px)" => "lrg" );
3345
-
3346
- foreach ( $select as $option => $value ) :
3347
- $selected = '';
3348
- if ( $settings->size == $value )
3349
- $selected = ' selected="selected"';
3350
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3351
- endforeach;
3352
-
3353
- ?>
3354
- </select>
3355
- </td>
3356
- </tr>
3357
- <tr>
3358
- <td height="30" id="editor_star_color_text"><?php echo 'bubu'; _e('Star Color');?></td>
3359
- <td>
3360
- <select name="star_color" id="star_color" onchange="pd_bind(this);" style="display: none;">
3361
- <?php
3362
- $select = array( __('Yellow') => "yellow", __('Red') => "red", __('Blue') => "blue", __('Green') => "green", __('Grey') => "grey" );
3363
- foreach ( $select as $option => $value ) :
3364
- $selected = '';
3365
- if ( $settings->star_color == $value )
3366
- $selected = ' selected="selected"';
3367
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3368
- endforeach;
3369
- ?>
3370
- </select>
3371
- <select name="nero_style" id="nero_style" onchange="pd_bind(this);" style="display: none;">
3372
- <?php
3373
- $select = array( __('Hand') => "hand" );
3374
- foreach ( $select as $option => $value ) :
3375
- $selected = '';
3376
- if ( $settings->star_color == $value )
3377
- $selected = ' selected="selected"';
3378
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3379
- endforeach;
3380
- ?>
3381
- </select>
3382
-
3383
- </td>
3384
- </tr>
3385
- <tr>
3386
- <td height="30"><?php _e('Custom Image');?></td>
3387
- <td><input type="text" onblur="pd_bind(this);" name="custom_star" id="custom_star" value="<?php echo( clean_url( $settings->custom_star ) ); ?>" maxlength="200" />
3388
- </tr>
3389
- </table>
3390
- </div>
3391
- </div>
3392
- <div class="postbox">
3393
- <h3><?php _e('Text Layout & Font');?></h3>
3394
- <div class="inside">
3395
- <table>
3396
- <tr>
3397
- <td width="100" height="30"><?php _e('Align');?></td>
3398
- <td>
3399
- <select id="font_align" onchange="pd_bind(this);" name="font_align">
3400
- <?php
3401
- $select = array( __('Left') => "left", __('Center') => "center", __('Right') => "right" );
3402
- foreach( $select as $option => $value ):
3403
- $selected = '';
3404
- if ( $settings->font_align == $value )
3405
- $selected = ' selected="selected"';
3406
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
3407
- endforeach;
3408
- ?>
3409
- </select>
3410
- </td>
3411
- </tr>
3412
- <tr>
3413
- <td height="30"><?php _e('Position');?></td>
3414
- <td>
3415
- <select name="font_position" onchange="pd_bind(this);" id="font_position">
3416
- <?php
3417
- $select = array( __('Top') => "top", __('Right') => "right", __('Bottom') => "bottom" );
3418
- foreach( $select as $option => $value ) :
3419
- $selected = '';
3420
- if ( $settings->font_position == $value )
3421
- $selected = ' selected="selected"';
3422
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
3423
- endforeach;
3424
- ?>
3425
- </select>
3426
- </td>
3427
- </tr>
3428
- <tr>
3429
- <td height="30"><?php _e('Font');?></td>
3430
- <td>
3431
- <select name="font_family" id="font_family" onchange="pd_bind(this);">
3432
- <?php
3433
- $select = array( "Inherit" => "", "Arial" => "arial", "Comic Sans MS" => "comic sans ms", "Courier" => "courier", "Georgia" => "georgia", "Lucida Grande" => "lucida grande", "Tahoma" => "tahoma", "Times" => "times", "Trebuchet MS" => "trebuchet ms", "Verdana" => "verdana" );
3434
-
3435
- foreach( $select as $option => $value ) :
3436
- $selected = '';
3437
- if ( $settings->font_family == $value )
3438
- $selected = ' selected="selected"';
3439
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3440
- endforeach;
3441
- ?>
3442
- </select>
3443
- </td>
3444
- </tr>
3445
- <tr>
3446
- <td height="30"><?php _e('Color');?></td>
3447
- <td><input type="text" onblur="pd_bind(this);" class="elmColor jscolor-picker" name="font_color" id="font_color" value="<?php echo( wp_specialchars( $settings->font_color ) ); ?>" maxlength="11" autocomplete="off"/>
3448
- </td>
3449
- </tr>
3450
- <tr>
3451
- <td><?php _e('Size');?></td>
3452
- <td>
3453
- <select name="font_size" id="font_size" onchange="pd_bind(this);">
3454
- <?php
3455
- $select = array( __('Inherit') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
3456
-
3457
- foreach ( $select as $option => $value ) :
3458
- $selected = '';
3459
- if ( $settings->font_size == $value )
3460
- $selected = ' selected="selected"';
3461
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3462
- endforeach;
3463
- ?>
3464
- </select>
3465
- </td>
3466
- </tr>
3467
- <tr>
3468
- <td height="30"><?php _e('Line Height');?></td>
3469
- <td>
3470
- <select name="font_line_height" id="font_line_height" onchange="pd_bind(this);">
3471
- <?php
3472
- $select = array( __('Inherit') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
3473
-
3474
- foreach ( $select as $option => $value ) :
3475
- $selected = '';
3476
- if ( $settings->font_line_height == $value )
3477
- $selected = ' selected="selected"';
3478
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3479
- endforeach;
3480
- ?>
3481
- </select>
3482
- </td>
3483
- </tr>
3484
- <tr>
3485
- <td height="30"><?php _e('Bold');?></td>
3486
- <td><?php
3487
- $checked = '';
3488
- if ( $settings->font_bold == 'bold' )
3489
- $checked = ' checked="checked"';
3490
- ?><input type="checkbox" name="font_bold" onclick="pd_bind(this);" id="font_bold" value="bold" <?php echo( $checked ); ?> /></td>
3491
- </tr>
3492
- <tr>
3493
- <td height="30"><?php _e('Italic');?></td>
3494
- <?php
3495
- $checked = '';
3496
- if( $settings->font_italic == 'italic' )
3497
- $checked = ' checked="checked"';
3498
- ?>
3499
- <td><input type="checkbox" name="font_italic" onclick="pd_bind(this);" id="font_italic" value="italic" <?php echo( $checked ); ?>/></td>
3500
- </tr>
3501
- </table>
3502
- </div>
3503
- </div>
3504
- </div>
3505
- </div>
3506
- </form>
3507
- <script type="text/javascript">
3508
- PDRTJS_settings = <?php echo ( $settings_text ); ?>;
3509
- PDRTJS_settings.id = "1";
3510
- PDRTJS_settings.unique_id = "xxx";
3511
- PDRTJS_settings.title = "";
3512
- PDRTJS_settings.override = "<?php echo( $rating_id ); ?>";
3513
- PDRTJS_settings.permalink = "";
3514
- PDRTJS_1 = new PDRTJS_RATING( PDRTJS_settings );
3515
- pd_change_type( <?php echo ( $rating_type ) ?> );
3516
- </script>
3517
- <?php } ?>
3518
- </div>
3519
- <?php } // from if !error ?>
3520
- </div>
3521
-
3522
- <?php
3523
- }
3524
-
3525
- function update_rating(){
3526
- $rating_type = 0;
3527
- $rating_id = 0;
3528
- $set = null;
3529
-
3530
- if( isset( $_REQUEST['rating_id'] ) )
3531
- $rating_id = (int) $_REQUEST['rating_id'];
3532
-
3533
- if( isset( $_REQUEST['rating_type'] ) && $_REQUEST['rating_type'] == 'stars' ) {
3534
- $set->type = 'stars';
3535
- $rating_type = 0;
3536
- if( isset( $_REQUEST['star_color'] ) )
3537
- $set->star_color = attribute_escape( $_REQUEST['star_color'] );
3538
- } else {
3539
- $set->type = 'nero';
3540
- $rating_type = 1;
3541
- if( isset( $_REQUEST['nero_style'] ) )
3542
- $set->star_color = attribute_escape( $_REQUEST['nero_style'] );
3543
- }
3544
-
3545
- $set->size = wp_specialchars( $_REQUEST['size'], 1 );
3546
- $set->custom_star = wp_specialchars( clean_url( $_REQUEST['custom_star'] ) , 1 );
3547
- $set->font_align = wp_specialchars( $_REQUEST['font_align'], 1 );
3548
- $set->font_position = wp_specialchars( $_REQUEST['font_position'], 1 );
3549
- $set->font_family = wp_specialchars( $_REQUEST['font_family'], 1);
3550
- $set->font_size = wp_specialchars( $_REQUEST['font_size'], 1 );
3551
- $set->font_line_height = wp_specialchars( $_REQUEST['font_line_height'], 1 );
3552
-
3553
- if ( isset( $_REQUEST['font_bold'] ) && $_REQUEST['font_bold'] == 'bold' )
3554
- $set->font_bold = 'bold';
3555
- else
3556
- $set->font_bold = 'normal';
3557
-
3558
- if ( isset( $_REQUEST['font_italic'] ) && $_REQUEST['font_italic'] == 'italic' )
3559
- $set->font_italic = 'italic';
3560
- else
3561
- $set->font_italic = 'normal';
3562
-
3563
- $set->text_votes = wp_specialchars( $_REQUEST['text_votes'], 1 );
3564
- $set->text_rate_this = wp_specialchars( $_REQUEST['text_rate_this'], 1 );
3565
- $set->text_1_star = wp_specialchars( $_REQUEST['text_1_star'], 1 );
3566
- $set->text_2_star = wp_specialchars( $_REQUEST['text_2_star'], 1 );
3567
- $set->text_3_star = wp_specialchars( $_REQUEST['text_3_star'], 1 );
3568
- $set->text_4_star = wp_specialchars( $_REQUEST['text_4_star'], 1 );
3569
- $set->text_5_star = wp_specialchars( $_REQUEST['text_5_star'], 1 );
3570
- $set->text_thank_you = wp_specialchars( $_REQUEST['text_thank_you'], 1 );
3571
- $set->text_rate_up = wp_specialchars( $_REQUEST['text_rate_up'], 1 );
3572
- $set->text_rate_down = wp_specialchars( $_REQUEST['text_rate_down'], 1 );
3573
- $set->font_color = wp_specialchars( $_REQUEST['font_color'], 1 );
3574
-
3575
- $settings_text = json_encode( $set );
3576
-
3577
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
3578
- $polldaddy->reset();
3579
- $response = $polldaddy->update_rating( $rating_id, $settings_text, $rating_type );
3580
- }
3581
- function rating_reports() {
3582
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
3583
- $rating_id = get_option( 'pd-rating-posts-id' );
3584
-
3585
- $report_type = 'posts';
3586
- $period = '7';
3587
- $show_rating = 0;
3588
-
3589
- if ( isset( $_REQUEST['rating'] ) ){
3590
- switch ( $_REQUEST['rating'] ) :
3591
- case 'pages':
3592
- $report_type = 'pages';
3593
- $rating_id = (int) get_option( 'pd-rating-pages-id' );
3594
- break;
3595
-
3596
- case 'comments':
3597
- $report_type = 'comments';
3598
- $rating_id = get_option( 'pd-rating-comments-id' );
3599
- break;
3600
-
3601
- case 'posts':
3602
- $report_type = 'posts';
3603
- $rating_id = get_option( 'pd-rating-posts-id' );
3604
- break;
3605
- endswitch;
3606
- }
3607
-
3608
- if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] ){
3609
- switch ( $_REQUEST['filter'] ) :
3610
- case '1':
3611
- $period = '1';
3612
- break;
3613
-
3614
- case '7':
3615
- $period = '7';
3616
- break;
3617
-
3618
- case '31':
3619
- $period = '31';
3620
- break;
3621
-
3622
- case '90':
3623
- $period = '90';
3624
- break;
3625
-
3626
- case '365':
3627
- $period = '365';
3628
- break;
3629
-
3630
- case 'all':
3631
- $period = 'all';
3632
- break;
3633
- endswitch;
3634
- }
3635
-
3636
- $page_size = 15;
3637
- $current_page = 1;
3638
-
3639
- if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'change-report' ){
3640
- $current_page = 1;
3641
- } else {
3642
- if ( isset( $_REQUEST['paged'] ) ) {
3643
- $current_page = (int) $_REQUEST['paged'];
3644
- if ( $current_page == 0 )
3645
- $current_page = 1;
3646
- }
3647
- }
3648
-
3649
- $start = ( $current_page * $page_size ) - $page_size;
3650
- $end = $page_size;
3651
-
3652
- $response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
3653
-
3654
- $total = $total_pages = 0;
3655
- $ratings = null;
3656
-
3657
- if( !empty($response) ){
3658
- $ratings = $response->rating;
3659
- $total = (int) $response->_total;
3660
- $total_pages = ceil( $total / $page_size );
3661
- }
3662
-
3663
- $page_links = paginate_links( array(
3664
- 'base' => add_query_arg( array ('paged' => '%#%', 'rating' => $report_type, 'filter' => $period ) ),
3665
- 'format' => '',
3666
- 'prev_text' => __('&laquo;'),
3667
- 'next_text' => __('&raquo;'),
3668
- 'total' => $total_pages,
3669
- 'current' => $current_page
3670
- ));
3671
- ?>
3672
- <div class="wrap">
3673
- <h2><?php _e('Rating Reports');?> <span style="font-size: 16px;">(<?php echo ( $report_type ); ?>)</span></h2>
3674
- <div class="clear"></div>
3675
- <form method="post" action="">
3676
- <div class="tablenav">
3677
- <div class="alignleft">
3678
- <select name="rating">
3679
- <?php
3680
- $select = array( __('Posts') => "posts", __('Pages') => "pages", __('Comments') => "comments" );
3681
-
3682
- foreach ( $select as $option => $value ) :
3683
- $selected = '';
3684
- if ( $value == $report_type )
3685
- $selected = ' selected="selected"';
3686
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3687
- endforeach;
3688
- ?>
3689
- </select>
3690
- <input type="hidden" name="action" value="change-report" />
3691
- <input class="button-secondary action" type="submit" value="<?php esc_attr_e('View Report');?>" />
3692
-
3693
- <select name="filter">
3694
- <?php
3695
- $select = array( __('Last 24 hours') => "1", __('Last 7 days') => "7", __('Last 31 days') => "31", __('Last 3 months') => "90", __('Last 12 months') => "365", __('All time') => "all" );
3696
- foreach ( $select as $option => $value ) :
3697
- $selected = '';
3698
- if ( $value == $period )
3699
- $selected = ' selected="selected"';
3700
- echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3701
- endforeach;
3702
- ?>
3703
- </select>
3704
- <input class="button-secondary action" type="submit" value="<?php _e('Filter Report');?>" />
3705
- </div>
3706
- <div class="alignright">
3707
- <div class="tablenav-pages">
3708
- <?php echo( $page_links ); ?>
3709
- </div>
3710
- </div>
3711
- </div>
3712
- </form>
3713
-
3714
- <table class="widefat">
3715
- <?php
3716
- if ( count( $ratings ) == 0 ) {
3717
- ?>
3718
- <tbody>
3719
- <tr>
3720
- <td colspan="4"><?php printf(__('No ratings have been collected for your %s yet.'), $report_type); ?></td>
3721
- </tr>
3722
- </tbody>
3723
- <?php
3724
- }
3725
- else{
3726
- ?>
3727
- <thead>
3728
- <tr>
3729
- <th><?php _e('Start Date');?></th>
3730
- <th><?php _e('Title');?></th>
3731
- <th><?php _e('Votes');?></th>
3732
- <th style="width: 120px;"><?php _e('Average Rating');?></th>
3733
- </tr>
3734
- </thead>
3735
- <?php
3736
- echo ( '<tbody>' );
3737
- $alt_counter = 0;
3738
- $alt = '';
3739
-
3740
- foreach ( $ratings as $rating ) :
3741
- $alt_counter++;
3742
-
3743
- if ( ( $alt_counter % 2 ) == 0 )
3744
- $alt = ' class="alternate"';
3745
- else
3746
- $alt = '';
3747
- ?>
3748
- <tr <?php echo( $alt ); ?>>
3749
- <td>
3750
- <?php echo( str_replace( '-', '/', substr( wp_specialchars( $rating->date ), 0, 10 ) ) ); ?><br/>
3751
- <?php echo( wp_specialchars( $rating->uid ) ); ?>
3752
- </td>
3753
- <td>
3754
- <?php echo( wp_specialchars( $rating->title ) ); ?>
3755
- <br/>
3756
- <a href="<?php echo( clean_url( $rating->permalink ) ); ?>" target="_blank"><?php echo( clean_url( $rating->permalink ) ); ?></a>
3757
- </td>
3758
- <td style="padding-top: 10px; font-weight: bold;"><?php echo( number_format( $rating->_votes ) ); ?></td>
3759
- <td style="padding-top: 10px;">
3760
- <?php
3761
- if ( $rating->_type == 0 ){
3762
- $avg_rating = $this->round( $rating->average_rating, 0.5 );
3763
-
3764
- echo ( '<div>' );
3765
- $image_pos = '';
3766
-
3767
- for ( $c = 1; $c <= 5; $c++ ){
3768
- if ( $avg_rating > 0 ){
3769
- if ( $avg_rating < $c ){
3770
- $image_pos = 'bottom left';
3771
- }
3772
- if ( $avg_rating == ( $c - 1 + 0.5 ) ){
3773
- $image_pos = 'center left';
3774
- }
3775
- }
3776
- echo ('<div style="width: 20px; height: 20px; background: url(http://i.polldaddy.com/ratings/images/star-yellow-med.png) ' . $image_pos . '; float: left;"></div>' );
3777
- }
3778
- echo ( '<br class="clear" /></div>' );
3779
- }
3780
- else{
3781
- echo ( '<div>' );
3782
- echo ( '<div style="margin: 0px 0px 0px 20px; background: transparent url(http://i.polldaddy.com/images/rate-graph-up.png); width: 20px; height: 20px; float: left;"></div>' );
3783
- echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format ( $rating->total1 ) . '</div>' );
3784
- echo ( '<div style="margin: 0px; background: transparent url(http://i.polldaddy.com/images/rate-graph-dn.png); width: 20px; height: 20px; float: left;"></div>' );
3785
- echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format( $rating->total2 ) . '</div>' );
3786
- echo ( '<br class="clear" /></div>' );
3787
-
3788
- }
3789
- ?>
3790
- </td>
3791
- </tr>
3792
-
3793
- <?php
3794
- endforeach;
3795
- echo ( '</tbody>' );
3796
- }
3797
-
3798
- ?>
3799
- </table>
3800
- <div class="tablenav">
3801
- <div class="alignright">
3802
- <div class="tablenav-pages">
3803
- <?php echo( $page_links ); ?>
3804
- </div>
3805
- </div>
3806
- </div>
3807
- </div>
3808
- <p></p>
3809
- <?php
3810
- }
3811
-
3812
- function plugin_options() {
3813
- if ( isset( $_POST['polldaddy_email'] ) ){
3814
- $account_email = attribute_escape( $_POST['polldaddy_email'] );
3815
- }
3816
- else{
3817
- $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
3818
- $account = $polldaddy->get_account();
3819
-
3820
- if( !empty($account) )
3821
- $account_email = attribute_escape( $account->email );
3822
-
3823
- $polldaddy->reset();
3824
- $poll = $polldaddy->get_poll( 1 );
3825
-
3826
- $options = array(
3827
- 101 => 'Aluminum Narrow',
3828
- 102 => 'Aluminum Medium',
3829
- 103 => 'Aluminum Wide',
3830
- 104 => 'Plain White Narrow',
3831
- 105 => 'Plain White Medium',
3832
- 106 => 'Plain White Wide',
3833
- 107 => 'Plain Black Narrow',
3834
- 108 => 'Plain Black Medium',
3835
- 109 => 'Plain Black Wide',
3836
- 110 => 'Paper Narrow',
3837
- 111 => 'Paper Medium',
3838
- 112 => 'Paper Wide',
3839
- 113 => 'Skull Dark Narrow',
3840
- 114 => 'Skull Dark Medium',
3841
- 115 => 'Skull Dark Wide',
3842
- 116 => 'Skull Light Narrow',
3843
- 117 => 'Skull Light Medium',
3844
- 118 => 'Skull Light Wide',
3845
- 157 => 'Micro',
3846
- 119 => 'Plastic White Narrow',
3847
- 120 => 'Plastic White Medium',
3848
- 121 => 'Plastic White Wide',
3849
- 122 => 'Plastic Grey Narrow',
3850
- 123 => 'Plastic Grey Medium',
3851
- 124 => 'Plastic Grey Wide',
3852
- 125 => 'Plastic Black Narrow',
3853
- 126 => 'Plastic Black Medium',
3854
- 127 => 'Plastic Black Wide',
3855
- 128 => 'Manga Narrow',
3856
- 129 => 'Manga Medium',
3857
- 130 => 'Manga Wide',
3858
- 131 => 'Tech Dark Narrow',
3859
- 132 => 'Tech Dark Medium',
3860
- 133 => 'Tech Dark Wide',
3861
- 134 => 'Tech Grey Narrow',
3862
- 135 => 'Tech Grey Medium',
3863
- 136 => 'Tech Grey Wide',
3864
- 137 => 'Tech Light Narrow',
3865
- 138 => 'Tech Light Medium',
3866
- 139 => 'Tech Light Wide',
3867
- 140 => 'Working Male Narrow',
3868
- 141 => 'Working Male Medium',
3869
- 142 => 'Working Male Wide',
3870
- 143 => 'Working Female Narrow',
3871
- 144 => 'Working Female Medium',
3872
- 145 => 'Working Female Wide',
3873
- 146 => 'Thinking Male Narrow',
3874
- 147 => 'Thinking Male Medium',
3875
- 148 => 'Thinking Male Wide',
3876
- 149 => 'Thinking Female Narrow',
3877
- 150 => 'Thinking Female Medium',
3878
- 151 => 'Thinking Female Wide',
3879
- 152 => 'Sunset Narrow',
3880
- 153 => 'Sunset Medium',
3881
- 154 => 'Sunset Wide',
3882
- 155 => 'Music Medium',
3883
- 156 => 'Music Wide'
3884
- );
3885
-
3886
- $polldaddy->reset();
3887
- $styles = $polldaddy->get_styles();
3888
-
3889
- if( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ){
3890
- foreach( (array) $styles->style as $style ){
3891
- $options[ (int) $style->_id ] = $style->title;
3892
- }
3893
- }
3894
- }
3895
- $this->print_errors();
3896
- ?>
3897
- <div id="options-page" class="wrap">
3898
- <div class="icon32" id="icon-options-general"><br/></div>
3899
- <h2>
3900
- <?php _e( 'Options', 'polldaddy' ); ?>
3901
- </h2>
3902
- <h3>
3903
- <?php _e( 'PollDaddy Account Info', 'polldaddy' ); ?>
3904
- </h3>
3905
- <p>
3906
- <?php _e( 'This is the PollDadddy account you currently have imported into your WordPress account', 'polldaddy' ); ?>.
3907
- </p>
3908
- <form action="" method="post">
3909
- <table class="form-table">
3910
- <tbody>
3911
- <tr class="form-field form-required">
3912
- <th valign="top" scope="row">
3913
- <label for="polldaddy-email">
3914
- <?php _e( 'PollDaddy Email Address', 'polldaddy' ); ?>
3915
- </label>
3916
- </th>
3917
- <td>
3918
- <input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php echo $account_email; ?>" />
3919
- </td>
3920
- </tr>
3921
- <tr class="form-field form-required">
3922
- <th valign="top" scope="row">
3923
- <label for="polldaddy-password">
3924
- <?php _e( 'PollDaddy Password', 'polldaddy' ); ?>
3925
- </label>
3926
- </th>
3927
- <td>
3928
- <input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
3929
- </td>
3930
- </tr>
3931
- </tbody>
3932
- </table>
3933
- <p class="submit">
3934
- <?php wp_nonce_field( 'polldaddy-account' ); ?>
3935
- <input type="hidden" name="action" value="import-account" />
3936
- <input type="hidden" name="account" value="import" />
3937
- <input type="submit" value="<?php echo attribute_escape( __( 'Import Account', 'polldaddy' ) ); ?>" />
3938
- </p>
3939
- </form>
3940
- <br />
3941
- <h3>
3942
- <?php _e( 'General Settings', 'polldaddy' ); ?>
3943
- </h3>
3944
- <form action="" method="post">
3945
- <table class="form-table">
3946
- <tbody>
3947
- <tr valign="top">
3948
- <th valign="top" scope="row">
3949
- <label>
3950
- <?php _e( 'Default poll settings', 'polldaddy' ); ?>
3951
- </label>
3952
- </th>
3953
- <td>
3954
- <fieldset>
3955
- <legend class="screen-reader-text"><span>poll-defaults</span></legend><?php
3956
- $selected = '';
3957
- if ( $poll->multipleChoice == 'yes' )
3958
- $selected = 'checked="checked"';?>
3959
- <label for="multipleChoice"><input type="checkbox" <?php echo $selected; ?> value="1" id="multipleChoice" name="multipleChoice"> <?php _e( 'Multiple Choice', 'polldaddy' ); ?></label>
3960
- <br /><?php
3961
- $selected = '';
3962
- if ( $poll->randomiseAnswers == 'yes' )
3963
- $selected = 'checked="checked"';?>
3964
- <label for="randomiseAnswers"><input type="checkbox" <?php echo $selected; ?> value="1" id="randomiseAnswers" name="randomiseAnswers"> <?php _e( 'Randomise Answers', 'polldaddy' ); ?></label>
3965
- <br /><?php
3966
- $selected = '';
3967
- if ( $poll->otherAnswer == 'yes' )
3968
- $selected = 'checked="checked"';?>
3969
- <label for="otherAnswer"><input type="checkbox" <?php echo $selected; ?> value="1" id="otherAnswer" name="otherAnswer"> <?php _e( 'Other Answer', 'polldaddy' ); ?></label>
3970
- <br /><?php
3971
- $selected = '';
3972
- if ( $poll->sharing == 'yes' )
3973
- $selected = 'checked="checked"';?>
3974
- <label for="sharing"><input type="checkbox" <?php echo $selected; ?> value="1" id="sharing" name="sharing"> <?php _e( 'Sharing', 'polldaddy' ); ?></label>
3975
- <br />
3976
- <label for="resultsType">
3977
- <select id="resultsType" name="resultsType">
3978
- <option <?php echo $poll->resultsType == 'show' ? 'selected="selected"':''; ?> value="show"><?php _e('Show', 'polldaddy'); ?></option>
3979
- <option <?php echo $poll->resultsType == 'hide' ? 'selected="selected"':''; ?> value="hide"><?php _e('Hide', 'polldaddy'); ?></option>
3980
- <option <?php echo $poll->resultsType == 'percent' ? 'selected="selected"':''; ?> value="percent"><?php _e('Percentages', 'polldaddy'); ?></option>
3981
- </select> <?php _e( 'Poll results', 'polldaddy' ); ?>
3982
- </label>
3983
- <br />
3984
- <label for="styleID">
3985
- <select id="styleID" name="styleID"><?php
3986
- foreach ( (array) $options as $styleID => $label ) :
3987
- $selected = $styleID == $poll->styleID ? ' selected="selected"' : ''; ?>
3988
- <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option><?php
3989
- endforeach;?>
3990
- </select> <?php _e( 'Poll style', 'polldaddy' ); ?>
3991
- </label>
3992
- <br />
3993
- <label for="blockRepeatVotersType">
3994
- <select id="poll-block-repeat" name="blockRepeatVotersType">
3995
- <option <?php echo $poll->blockRepeatVotersType == 'off' ? 'selected="selected"':''; ?> value="off"><?php _e('Off', 'polldaddy'); ?></option>
3996
- <option <?php echo $poll->blockRepeatVotersType == 'cookie' ? 'selected="selected"':''; ?> value="cookie"><?php _e('Cookie', 'polldaddy'); ?></option>
3997
- <option <?php echo $poll->blockRepeatVotersType == 'cookieip' ? 'selected="selected"':''; ?> value="cookieip"><?php _e('Cookie & IP address', 'polldaddy'); ?></option>
3998
- </select> <?php _e( 'Block repeat voters', 'polldaddy' ); ?>
3999
- </label>
4000
- <br />
4001
- <label for="blockExpiration">
4002
- <select id="blockExpiration" name="blockExpiration">
4003
- <option value="0" <?php echo $poll->blockExpiration == 0 ? 'selected="selected"':''; ?>><?php _e('Never', 'polldaddy'); ?></option>
4004
- <option value="3600" <?php echo $poll->blockExpiration == 3600 ? 'selected="selected"':''; ?>><?php printf( __('%d hour', 'polldaddy'), 1 ); ?></option>
4005
- <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 3 ); ?></option>
4006
- <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 6 ); ?></option>
4007
- <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 12 ); ?></option>
4008
- <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected="selected"' : ''; ?>><?php printf( __('%d day', 'polldaddy'), 1 ); ?></option>
4009
- <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected="selected"' : ''; ?>><?php printf( __('%d week', 'polldaddy'), 1 ); ?></option>
4010
- <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected="selected"' : ''; ?>><?php printf( __('%d month', 'polldaddy'), 1 ); ?></option>
4011
- </select> <?php _e( 'Block expiration limit', 'polldaddy' ); ?>
4012
- </label>
4013
- <br />
4014
- </fieldset>
4015
- </td>
4016
- </tr>
4017
- <?php $this->plugin_options_add(); ?>
4018
- </tbody>
4019
- </table>
4020
- <p class="submit">
4021
- <?php wp_nonce_field( 'polldaddy-account' ); ?>
4022
- <input type="hidden" name="action" value="update-options" />
4023
- <input type="submit" value="<?php echo attribute_escape( __( 'Save Options', 'polldaddy' ) ); ?>" />
4024
- </p>
4025
- </form>
4026
- </div>
4027
- <?php
4028
- }
4029
-
4030
- function plugin_options_add(){}
4031
-
4032
- function round($number, $increments) {
4033
- $increments = 1 / $increments;
4034
- return ( round ( $number * $increments ) / $increments );
4035
- }
4036
-
4037
- function signup() {
4038
- return $this->api_key_page();
4039
- }
4040
-
4041
- function can_edit( &$poll ) {
4042
- if ( empty( $poll->_owner ) )
4043
- return true;
4044
-
4045
- if ( $this->id == $poll->_owner )
4046
- return true;
4047
-
4048
- return (bool) current_user_can( 'edit_others_posts' );
4049
- }
4050
- }
4051
-
4052
- require 'rating.php';
4053
- require 'polldaddy-org.php';
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: PollDaddy Polls
5
+ Description: Create and manage PollDaddy polls and ratings in WordPress
6
+ Author: Automattic, Inc.
7
+ Author URL: http://automattic.com/
8
+ Version: 1.8.0
9
+ */
10
+
11
+ // You can hardcode your PollDaddy PartnerGUID (API Key) here
12
+ //define( 'WP_POLLDADDY__PARTNERGUID', '12345...' );
13
+
14
+ class WP_PollDaddy {
15
+ var $errors;
16
+ var $base_url;
17
+ var $is_admin;
18
+ var $is_author;
19
+ var $scheme;
20
+ var $version;
21
+ var $polldaddy_client_class;
22
+ var $polldaddy_clients;
23
+ var $id;
24
+ var $multiple_accounts;
25
+ var $user_code;
26
+ var $rating_user_code;
27
+
28
+ function WP_PollDaddy(){
29
+ $this ->__construct();
30
+ }
31
+
32
+ function __construct() {
33
+ global $current_user;
34
+ $this->errors = new WP_Error;
35
+ $this->scheme = 'https';
36
+ $this->version = '1.8.0';
37
+ $this->multiple_accounts = true;
38
+ $this->polldaddy_client_class = 'api_client';
39
+ $this->polldaddy_clients = array();
40
+ $this->is_admin = (bool) current_user_can('manage_options');
41
+ $this->is_author = true;
42
+ $this->id = (int) $current_user->ID;
43
+ $this->user_code = null;
44
+ $this->rating_user_code = null;
45
+ }
46
+
47
+ function &get_client( $api_key, $userCode = null ) {
48
+ if ( isset( $this->polldaddy_clients[$api_key] ) ) {
49
+ if ( !is_null( $userCode ) )
50
+ $this->polldaddy_clients[$api_key]->userCode = $userCode;
51
+ return $this->polldaddy_clients[$api_key];
52
+ }
53
+ require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
54
+ $this->polldaddy_clients[$api_key] = new $this->polldaddy_client_class( $api_key, $userCode );
55
+ return $this->polldaddy_clients[$api_key];
56
+ }
57
+
58
+ function admin_menu() {
59
+ if ( !defined( 'WP_POLLDADDY__PARTNERGUID' ) ) {
60
+ $guid = get_option( 'polldaddy_api_key' );
61
+ if ( !$guid || !is_string( $guid ) )
62
+ $guid = false;
63
+ define( 'WP_POLLDADDY__PARTNERGUID', $guid );
64
+ }
65
+
66
+ if ( !WP_POLLDADDY__PARTNERGUID ) {
67
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
68
+ $hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
69
+ else
70
+ $hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'api_key_page' ) );
71
+
72
+ add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
73
+
74
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
75
+ $hook = add_object_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ), "{$this->base_url}polldaddy.png" );
76
+ else
77
+ $hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'api_key_page' ) );
78
+
79
+ add_action( "load-$hook", array( &$this, 'api_key_page_load' ) );
80
+ if ( ( empty( $_GET['page'] ) || 'polls' != $_GET['page'] ) && ( empty( $_GET['page'] ) || 'ratings' != $_GET['page'] ) )
81
+ add_action( 'admin_notices', create_function( '', 'echo "<div class=\"error\"><p>" . sprintf( "You need to <a href=\"%s\">input your PollDaddy.com account details</a>.", "edit.php?page=polls" ) . "</p></div>";' ) );
82
+ return false;
83
+ }
84
+
85
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
86
+ $hook = add_object_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
87
+ else
88
+ $hook = add_management_page( __( 'Ratings', 'polldaddy' ), __( 'Ratings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
89
+
90
+ add_action( "load-$hook", array( &$this, 'management_page_load' ) );
91
+
92
+ if ( function_exists( 'add_object_page' ) ) // WP 2.7+
93
+ $hook = add_object_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ), "{$this->base_url}polldaddy.png" );
94
+ else
95
+ $hook = add_management_page( __( 'Polls', 'polldaddy' ), __( 'Polls', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
96
+
97
+ add_action( "load-$hook", array( &$this, 'management_page_load' ) );
98
+
99
+ if ( $this->is_admin ) {
100
+ add_submenu_page( 'ratings', __( 'Ratings &ndash; Settings', 'polldaddy' ), __( 'Settings', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
101
+ add_submenu_page( 'ratings', __( 'Ratings &ndash; Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings&amp;action=reports', array( &$this, 'management_page' ) );
102
+ }
103
+ else{
104
+ add_submenu_page( 'ratings', __( 'Ratings &ndash; Reports', 'polldaddy' ), __( 'Reports', 'polldaddy' ), 'edit_posts', 'ratings', array( &$this, 'management_page' ) );
105
+ }
106
+
107
+ add_submenu_page( 'polls', __( 'Polls', 'polldaddy' ), __( 'Edit', 'polldaddy' ), 'edit_posts', 'polls', array( &$this, 'management_page' ) );
108
+
109
+ if ( $this->is_author ) {
110
+ add_submenu_page( 'polls', __( 'Add New Poll', 'polldaddy' ), __( 'Add New', 'polldaddy' ), 'edit_posts', 'polls&amp;action=create-poll', array( &$this, 'management_page' ) );
111
+ add_submenu_page( 'polls', __( 'Custom Styles', 'polldaddy' ), __( 'Custom Styles', 'polldaddy' ), 'edit_posts', 'polls&amp;action=list-styles', array( &$this, 'management_page' ) );
112
+ add_submenu_page( 'polls', __( 'Options', 'polldaddy' ), __( 'Options', 'polldaddy' ), 'edit_posts', 'polls&amp;action=options', array( &$this, 'management_page' ) );
113
+ }
114
+
115
+ add_action( 'media_buttons', array( &$this, 'media_buttons' ) );
116
+ }
117
+
118
+ function api_key_page_load() {
119
+ if ( 'post' != strtolower( $_SERVER['REQUEST_METHOD'] ) || empty( $_POST['action'] ) || 'account' != $_POST['action'] )
120
+ return false;
121
+
122
+ check_admin_referer( 'polldaddy-account' );
123
+
124
+ $polldaddy_email = stripslashes( $_POST['polldaddy_email'] );
125
+ $polldaddy_password = stripslashes( $_POST['polldaddy_password'] );
126
+
127
+ if ( !$polldaddy_email )
128
+ $this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
129
+
130
+ if ( !$polldaddy_password )
131
+ $this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
132
+
133
+ if ( $this->errors->get_error_codes() )
134
+ return false;
135
+
136
+ $details = array(
137
+ 'uName' => get_bloginfo( 'name' ),
138
+ 'uEmail' => $polldaddy_email,
139
+ 'uPass' => $polldaddy_password,
140
+ 'partner_userid' => $this->id
141
+ );
142
+ if ( function_exists( 'wp_remote_post' ) ) { // WP 2.7+
143
+ $polldaddy_api_key = wp_remote_post( $this->scheme . '://api.polldaddy.com/key.php', array(
144
+ 'body' => $details
145
+ ) );
146
+ if ( is_wp_error( $polldaddy_api_key ) ) {
147
+ $this->errors = $polldaddy_api_key;
148
+ return false;
149
+ }
150
+ $polldaddy_api_key = wp_remote_retrieve_body( $polldaddy_api_key );
151
+ } else {
152
+ $fp = fsockopen(
153
+ 'api.polldaddy.com',
154
+ 80,
155
+ $err_num,
156
+ $err_str,
157
+ 3
158
+ );
159
+
160
+ if ( !$fp ) {
161
+ $this->errors->add( 'connect', __( "Can't connect to PollDaddy.com", 'polldaddy' ) );
162
+ return false;
163
+ }
164
+
165
+ if ( function_exists( 'stream_set_timeout' ) )
166
+ stream_set_timeout( $fp, 3 );
167
+
168
+ global $wp_version;
169
+
170
+ $request_body = http_build_query( $details, null, '&' );
171
+
172
+ $request = "POST /key.php HTTP/1.0\r\n";
173
+ $request .= "Host: api.polldaddy.com\r\n";
174
+ $request .= "User-agent: WordPress/$wp_version\r\n";
175
+ $request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
176
+ $request .= 'Content-Length: ' . strlen( $request_body ) . "\r\n";
177
+
178
+ fwrite( $fp, "$request\r\n$request_body" );
179
+
180
+ $response = '';
181
+ while ( !feof( $fp ) )
182
+ $response .= fread( $fp, 4096 );
183
+ fclose( $fp );
184
+ list($headers, $polldaddy_api_key) = explode( "\r\n\r\n", $response, 2 );
185
+ }
186
+
187
+ if ( !$polldaddy_api_key ) {
188
+ $this->errors->add( 'polldaddy_password', __( 'Invalid Account', 'polldaddy' ) );
189
+ return false;
190
+ }
191
+
192
+ update_option( 'polldaddy_api_key', $polldaddy_api_key );
193
+
194
+ $polldaddy = $this->get_client( $polldaddy_api_key );
195
+ $polldaddy->reset();
196
+ if ( !$polldaddy->get_usercode( $this->id ) ) {
197
+ $this->parse_errors( $polldaddy );
198
+ $this->errors->add( 'GetUserCode', __( 'Account could not be accessed. Are your email address and password correct?', 'polldaddy' ) );
199
+ return false;
200
+ }
201
+
202
+ return true;
203
+ }
204
+
205
+ function parse_errors( &$polldaddy ) {
206
+ if ( $polldaddy->errors )
207
+ foreach ( $polldaddy->errors as $code => $error )
208
+ $this->errors->add( $code, $error );
209
+ if ( isset( $this->errors->errors[4] ) ) {
210
+ $this->errors->errors[4] = array( sprintf( __( 'Obsolete PollDaddy User API Key: <a href="%s">Sign in again to re-authenticate</a>', 'polldaddy' ), add_query_arg( array( 'action' => 'signup', 'reaction' => empty( $_GET['action'] ) ? false : $_GET['action'] ) ) ) );
211
+ $this->errors->add_data( true, 4 );
212
+ }
213
+ }
214
+
215
+ function print_errors() {
216
+ if ( !$error_codes = $this->errors->get_error_codes() )
217
+ return;
218
+ ?>
219
+
220
+ <div class="error">
221
+
222
+ <?php
223
+
224
+ foreach ( $error_codes as $error_code ) :
225
+ foreach ( $this->errors->get_error_messages( $error_code ) as $error_message ) :
226
+ ?>
227
+
228
+ <p><?php echo $this->errors->get_error_data( $error_code ) ? $error_message : wp_specialchars( $error_message ); ?></p>
229
+
230
+ <?php
231
+ endforeach;
232
+ endforeach;
233
+
234
+ $this->errors = new WP_Error;
235
+ ?>
236
+
237
+ </div>
238
+ <br class="clear" />
239
+
240
+ <?php
241
+ }
242
+
243
+ function api_key_page() {
244
+ $this->print_errors();
245
+ ?>
246
+
247
+ <div class="wrap">
248
+
249
+ <h2><?php _e( 'PollDaddy Account', 'polldaddy' ); ?></h2>
250
+
251
+ <p><?php printf( __( 'Before you can use the PollDaddy plugin, you need to enter your <a href="%s">PollDaddy.com</a> account details.', 'polldaddy' ), 'http://polldaddy.com/' ); ?></p>
252
+
253
+ <form action="" method="post">
254
+ <table class="form-table">
255
+ <tbody>
256
+ <tr class="form-field form-required">
257
+ <th valign="top" scope="row">
258
+ <label for="polldaddy-email"><?php _e( 'PollDaddy Email Address', 'polldaddy' ); ?></label>
259
+ </th>
260
+ <td>
261
+ <input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" />
262
+ </td>
263
+ </tr>
264
+ <tr class="form-field form-required">
265
+ <th valign="top" scope="row">
266
+ <label for="polldaddy-password"><?php _e( 'PollDaddy Password', 'polldaddy' ); ?></label>
267
+ </th>
268
+ <td>
269
+ <input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
270
+ </td>
271
+ </tr>
272
+ </tbody>
273
+ </table>
274
+ <p class="submit">
275
+ <?php wp_nonce_field( 'polldaddy-account' ); ?>
276
+ <input type="hidden" name="action" value="account" />
277
+ <input type="hidden" name="account" value="import" />
278
+ <input type="submit" value="<?php echo attribute_escape( __( 'Submit', 'polldaddy' ) ); ?>" />
279
+ </p>
280
+ </form>
281
+ </div>
282
+
283
+ <?php
284
+ }
285
+
286
+ function media_buttons() {
287
+ $title = __( 'Add Poll', 'polldaddy' );
288
+ echo "<a href='admin.php?page=polls&amp;iframe&amp;TB_iframe=true' onclick='return false;' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}polldaddy.png' alt='$title' /></a>";
289
+ }
290
+
291
+ function set_api_user_code(){
292
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
293
+ $polldaddy->reset();
294
+
295
+ if ( empty( $this->user_code ) ){
296
+ $this->user_code = $polldaddy->get_usercode( $this->id );
297
+ }
298
+ }
299
+
300
+ function management_page_load() {
301
+ wp_reset_vars( array( 'page', 'action', 'poll', 'style', 'rating' ) );
302
+ global $plugin_page, $page, $action, $poll, $style, $rating, $wp_locale;
303
+
304
+ $this->set_api_user_code();
305
+
306
+ if ( empty( $this->user_code ) && $page == 'polls' ){
307
+ $action = 'signup';
308
+ }
309
+
310
+ require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
311
+
312
+ wp_enqueue_script( 'polls', "{$this->base_url}polldaddy.js", array( 'jquery', 'jquery-ui-sortable' ), $this->version );
313
+ wp_enqueue_script( 'polls-common', "{$this->base_url}common.js", array(), $this->version );
314
+
315
+ if( $page == 'polls' ) {
316
+ if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
317
+ $action = '';
318
+ }
319
+
320
+ switch ( $action ) :
321
+ case 'edit' :
322
+ case 'edit-poll' :
323
+ case 'create-poll' :
324
+ wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/poll-style-picker.js", array(), $this->version );
325
+
326
+ if ( $action == 'create-poll' )
327
+ $plugin_page = 'polls&amp;action=create-poll';
328
+
329
+ break;
330
+ case 'edit-style' :
331
+ case 'create-style' :
332
+ wp_enqueue_script( 'polls-style', "http://i.polldaddy.com/js/style-editor.js", array(), $this->version );
333
+ wp_enqueue_script( 'polls-style-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
334
+ wp_enqueue_style( 'polls', "{$this->base_url}style-editor.css", array(), $this->version );
335
+ break;
336
+ case 'list-styles' :
337
+ $plugin_page = 'polls&amp;action=list-styles';
338
+ break;
339
+ case 'options' :
340
+ case 'update-options' :
341
+ case 'import-account' :
342
+ $plugin_page = 'polls&amp;action=options';
343
+ break;
344
+ endswitch;
345
+ } elseif( $page == 'ratings' ) {
346
+ if ( !$this->is_admin && !in_array( $action, array( 'change-report', 'reports' ) ) ) {//check user privileges has access to action
347
+ $action = 'reports';
348
+ }
349
+ switch ( $action ) :
350
+ case 'change-report' :
351
+ case 'reports' :
352
+ $plugin_page = 'ratings&amp;action=reports';
353
+ break;
354
+ default :
355
+ wp_enqueue_script( 'rating-text-color', "http://i.polldaddy.com/js/jscolor.js", array(), $this->version );
356
+ wp_enqueue_script( 'ratings', 'http://i.polldaddy.com/ratings/rating.js', array(), $this->version );
357
+ wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
358
+ 'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
359
+ 'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
360
+ endswitch;
361
+ }
362
+
363
+ wp_enqueue_script( 'admin-forms' );
364
+ add_thickbox();
365
+
366
+ wp_enqueue_style( 'polls', "{$this->base_url}polldaddy.css", array( 'global', 'wp-admin' ), $this->version );
367
+ if ( isset($wp_locale->text_direction) && 'rtl' == $wp_locale->text_direction )
368
+ wp_enqueue_style( 'polls-rtl', "{$this->base_url}polldaddy-rtl.css", array( 'global', 'wp-admin' ), $this->version );
369
+ add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
370
+
371
+ add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
372
+
373
+ $query_args = array();
374
+ $args = array();
375
+
376
+ $allowedtags = array(
377
+ 'a' => array(
378
+ 'href' => array (),
379
+ 'title' => array (),
380
+ 'target' => array ()),
381
+ 'img' => array(
382
+ 'alt' => array (),
383
+ 'align' => array (),
384
+ 'border' => array (),
385
+ 'class' => array (),
386
+ 'height' => array (),
387
+ 'hspace' => array (),
388
+ 'longdesc' => array (),
389
+ 'vspace' => array (),
390
+ 'src' => array (),
391
+ 'width' => array ()),
392
+ 'abbr' => array(
393
+ 'title' => array ()),
394
+ 'acronym' => array(
395
+ 'title' => array ()),
396
+ 'b' => array(),
397
+ 'blockquote' => array(
398
+ 'cite' => array ()),
399
+ 'cite' => array (),
400
+ 'em' => array (),
401
+ 'i' => array (),
402
+ 'q' => array(
403
+ 'cite' => array ()),
404
+ 'strike' => array(),
405
+ 'strong' => array()
406
+ );
407
+
408
+ $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
409
+
410
+ if( $page == 'polls' ) {
411
+ switch ( $action ) :
412
+ case 'signup' : // sign up for first time
413
+ case 'account' : // reauthenticate
414
+ case 'import-account' : // reauthenticate
415
+ if ( !$is_POST )
416
+ return;
417
+
418
+ check_admin_referer( 'polldaddy-account' );
419
+
420
+ if ( $new_args = $this->management_page_load_signup() )
421
+ $query_args = array_merge( $query_args, $new_args );
422
+ if ( $this->errors->get_error_codes() )
423
+ return false;
424
+
425
+ $query_args['message'] = 'imported-account';
426
+
427
+ wp_reset_vars( array( 'action' ) );
428
+ if ( !empty( $_GET['reaction'] ) )
429
+ $query_args['action'] = $_GET['reaction'];
430
+ elseif ( !empty( $_GET['action'] ) && 'account' == $_GET['action'] )
431
+ $query_args['action'] = $_GET['action'];
432
+ else
433
+ $query_args['action'] = false;
434
+ break;
435
+
436
+ case 'delete' :
437
+ if ( empty( $poll ) )
438
+ return;
439
+
440
+ if ( is_array( $poll ) )
441
+ check_admin_referer( 'action-poll_bulk' );
442
+ else
443
+ check_admin_referer( "delete-poll_$poll" );
444
+
445
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
446
+
447
+ foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
448
+ $polldaddy->reset();
449
+ $poll_object = $polldaddy->get_poll( $poll );
450
+
451
+ if ( !$this->can_edit( $poll_object ) ) {
452
+ $this->errors->add( 'permission', __( 'You are not allowed to delete this poll.', 'polldaddy' ) );
453
+ return false;
454
+ }
455
+
456
+ // Send Poll Author credentials
457
+ if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
458
+ $polldaddy->reset();
459
+ if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
460
+ $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
461
+ }
462
+ $polldaddy->userCode = $userCode;
463
+ }
464
+
465
+ $polldaddy->reset();
466
+ $polldaddy->delete_poll( $poll_id );
467
+ }
468
+
469
+ $query_args['message'] = 'deleted';
470
+ $query_args['deleted'] = count( (array) $poll );
471
+ break;
472
+ case 'open' :
473
+ if ( empty( $poll ) )
474
+ return;
475
+
476
+ if ( is_array( $poll ) )
477
+ check_admin_referer( 'action-poll_bulk' );
478
+ else
479
+ check_admin_referer( "open-poll_$poll" );
480
+
481
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
482
+
483
+ foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
484
+ $polldaddy->reset();
485
+ $poll_object = $polldaddy->get_poll( $poll );
486
+
487
+ if ( !$this->can_edit( $poll_object ) ) {
488
+ $this->errors->add( 'permission', __( 'You are not allowed to open this poll.', 'polldaddy' ) );
489
+ return false;
490
+ }
491
+
492
+ // Send Poll Author credentials
493
+ if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
494
+ $polldaddy->reset();
495
+ if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
496
+ $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
497
+ }
498
+ $polldaddy->userCode = $userCode;
499
+ }
500
+
501
+ $polldaddy->reset();
502
+ $polldaddy->open_poll( $poll_id );
503
+ }
504
+
505
+ $query_args['message'] = 'opened';
506
+ $query_args['opened'] = count( (array) $poll );
507
+ break;
508
+ case 'close' :
509
+ if ( empty( $poll ) )
510
+ return;
511
+
512
+ if ( is_array( $poll ) )
513
+ check_admin_referer( 'action-poll_bulk' );
514
+ else
515
+ check_admin_referer( "close-poll_$poll" );
516
+
517
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
518
+
519
+ foreach ( (array) $_REQUEST['poll'] as $poll_id ) {
520
+ $polldaddy->reset();
521
+ $poll_object = $polldaddy->get_poll( $poll );
522
+
523
+ if ( !$this->can_edit( $poll_object ) ) {
524
+ $this->errors->add( 'permission', __( 'You are not allowed to close this poll.', 'polldaddy' ) );
525
+ return false;
526
+ }
527
+
528
+ // Send Poll Author credentials
529
+ if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
530
+ $polldaddy->reset();
531
+ if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
532
+ $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
533
+ }
534
+ $polldaddy->userCode = $userCode;
535
+ }
536
+
537
+ $polldaddy->reset();
538
+ $polldaddy->close_poll( $poll_id );
539
+ }
540
+
541
+ $query_args['message'] = 'closed';
542
+ $query_args['closed'] = count( (array) $poll );
543
+ break;
544
+ case 'edit-poll' : // TODO: use polldaddy_poll
545
+ if ( !$is_POST || !$poll = (int) $poll )
546
+ return;
547
+
548
+ check_admin_referer( "edit-poll_$poll" );
549
+
550
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
551
+ $polldaddy->reset();
552
+
553
+ $poll_object = $polldaddy->get_poll( $poll );
554
+ $this->parse_errors( $polldaddy );
555
+
556
+ if ( !$this->can_edit( $poll_object ) ) {
557
+ $this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
558
+ return false;
559
+ }
560
+
561
+ // Send Poll Author credentials
562
+
563
+ if ( !empty( $poll_object->_owner ) && $this->id != $poll_object->_owner ) {
564
+ $polldaddy->reset();
565
+ if ( !$userCode = $polldaddy->get_usercode( $poll_object->_owner ) ) {
566
+ $this->errors->add( 'no_usercode', __( 'Invalid Poll Author', 'polldaddy' ) );
567
+ }
568
+ $this->parse_errors( $polldaddy );
569
+ $polldaddy->userCode = $userCode;
570
+ }
571
+
572
+ if ( !$poll_object )
573
+ $this->errors->add( 'GetPoll', __( 'Poll not found', 'polldaddy' ) );
574
+
575
+ if ( $this->errors->get_error_codes() )
576
+ return false;
577
+
578
+ $poll_data = get_object_vars( $poll_object );
579
+ foreach ( $poll_data as $key => $value )
580
+ if ( '_' === $key[0] )
581
+ unset( $poll_data[$key] );
582
+
583
+ foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
584
+ if ( isset( $_POST[$option] ) && $_POST[$option] )
585
+ $poll_data[$option] = 'yes';
586
+ else
587
+ $poll_data[$option] = 'no';
588
+ }
589
+
590
+ $blocks = array( 'off', 'cookie', 'cookieip' );
591
+ if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
592
+ $poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
593
+
594
+ $results = array( 'show', 'percent', 'hide' );
595
+ if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
596
+ $poll_data['resultsType'] = $_POST['resultsType'];
597
+ $poll_data['question'] = stripslashes( $_POST['question'] );
598
+
599
+ if ( empty( $_POST['answer'] ) || !is_array( $_POST['answer'] ) )
600
+ $this->errors->add( 'answer', __( 'Invalid answers', 'polldaddy' ) );
601
+
602
+ $answers = array();
603
+ foreach ( $_POST['answer'] as $answer_id => $answer ) {
604
+ if ( !$answer = trim( stripslashes( $answer ) ) )
605
+ continue;
606
+
607
+ $args['text'] = wp_kses( $answer, $allowedtags );
608
+
609
+ if ( is_numeric( $answer_id ) )
610
+ $answers[] = polldaddy_poll_answer( $args, $answer_id );
611
+ else
612
+ $answers[] = polldaddy_poll_answer( $args );
613
+ }
614
+
615
+ if ( 2 > count( $answers ) )
616
+ $this->errors->add( 'answer', __( 'You must include at least 2 answers', 'polldaddy' ) );
617
+
618
+ if ( $this->errors->get_error_codes() )
619
+ return false;
620
+
621
+ $poll_data['answers'] = $answers;
622
+
623
+ $poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
624
+
625
+ if ( isset ( $_POST['styleID'] ) ){
626
+ if ( $_POST['styleID'] == 'x' ){
627
+ $this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
628
+ return false;
629
+ }
630
+ }
631
+ $poll_data['styleID'] = (int) $_POST['styleID'];
632
+ $poll_data['choices'] = (int) $_POST['choices'];
633
+
634
+ if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
635
+ if( isset( $_POST['cookieip_expiration'] ) )
636
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
637
+ } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
638
+ if( isset( $_POST['cookieip_expiration'] ) )
639
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
640
+ }
641
+
642
+ $polldaddy->reset();
643
+
644
+ $update_response = $polldaddy->update_poll( $poll, $poll_data );
645
+
646
+ $this->parse_errors( $polldaddy );
647
+
648
+ if ( !$update_response )
649
+ $this->errors->add( 'UpdatePoll', __( 'Poll could not be updated', 'polldaddy' ) );
650
+
651
+ if ( $this->errors->get_error_codes() )
652
+ return false;
653
+
654
+ $query_args['message'] = 'updated';
655
+ if ( isset($_POST['iframe']) )
656
+ $query_args['iframe'] = '';
657
+ break;
658
+ case 'create-poll' :
659
+ if ( !$is_POST )
660
+ return;
661
+
662
+ check_admin_referer( 'create-poll' );
663
+
664
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
665
+ $polldaddy->reset();
666
+
667
+ $answers = array();
668
+ foreach ( $_POST['answer'] as $answer ){
669
+ if ( !$answer = trim( stripslashes( $answer ) ) )
670
+ continue;
671
+
672
+ $args['text'] = wp_kses( $answer, $allowedtags );
673
+
674
+ $answers[] = polldaddy_poll_answer( $args );
675
+ }
676
+
677
+ if ( !$answers )
678
+ return false;
679
+
680
+ $poll_data = _polldaddy_poll_defaults();
681
+
682
+ foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
683
+ if ( isset( $_POST[$option] ) && $_POST[$option] )
684
+ $poll_data[$option] = 'yes';
685
+ else
686
+ $poll_data[$option] = 'no';
687
+ }
688
+
689
+ $blocks = array( 'off', 'cookie', 'cookieip' );
690
+ if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
691
+ $poll_data['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
692
+
693
+ $results = array( 'show', 'percent', 'hide' );
694
+ if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
695
+ $poll_data['resultsType'] = $_POST['resultsType'];
696
+
697
+ $poll_data['answers'] = $answers;
698
+
699
+ $poll_data['question'] = stripslashes( $_POST['question'] );
700
+ $poll_data['question'] = wp_kses( $poll_data['question'], $allowedtags );
701
+
702
+ if ( isset ( $_POST['styleID'] ) ){
703
+ if ( $_POST['styleID'] == 'x' ){
704
+ $this->errors->add( 'UpdatePoll', __( 'Please choose a poll style', 'polldaddy' ) );
705
+ return false;
706
+ }
707
+ }
708
+ $poll_data['styleID'] = (int) $_POST['styleID'];
709
+ $poll_data['choices'] = (int) $_POST['choices'];
710
+
711
+ if ( $poll_data['blockRepeatVotersType'] == 'cookie' ){
712
+ if( isset( $_POST['cookieip_expiration'] ) )
713
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
714
+ } elseif ( $poll_data['blockRepeatVotersType'] == 'cookieip' ){
715
+ if( isset( $_POST['cookieip_expiration'] ) )
716
+ $poll_data['blockExpiration'] = (int) $_POST['cookieip_expiration'];
717
+ }
718
+
719
+ $poll = $polldaddy->create_poll( $poll_data );
720
+ $this->parse_errors( $polldaddy );
721
+
722
+ if ( !$poll || empty( $poll->_id ) )
723
+ $this->errors->add( 'CreatePoll', __( 'Poll could not be created', 'polldaddy' ) );
724
+
725
+ if ( $this->errors->get_error_codes() )
726
+ return false;
727
+
728
+ $query_args['message'] = 'created';
729
+ $query_args['action'] = 'edit-poll';
730
+ $query_args['poll'] = $poll->_id;
731
+ if ( isset($_POST['iframe']) )
732
+ $query_args['iframe'] = '';
733
+ break;
734
+ case 'delete-style' :
735
+ if ( empty( $style ) )
736
+ return;
737
+
738
+ if ( is_array( $style ) )
739
+ check_admin_referer( 'action-style_bulk' );
740
+ else
741
+ check_admin_referer( "delete-style_$style" );
742
+
743
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
744
+
745
+ foreach ( (array) $_REQUEST['style'] as $style_id ) {
746
+ $polldaddy->reset();
747
+ $polldaddy->delete_style( $style_id );
748
+ }
749
+
750
+ $query_args['message'] = 'deleted-style';
751
+ $query_args['deleted'] = count( (array) $style );
752
+ break;
753
+ case 'edit-style' :
754
+ if ( !$is_POST || !$style = (int) $style )
755
+ return;
756
+
757
+ check_admin_referer( "edit-style$style" );
758
+
759
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
760
+ $polldaddy->reset();
761
+
762
+ $style_data = _polldaddy_style_defaults();
763
+
764
+ if ( isset($_POST['style-title'] ) )
765
+ $style_data['title'] = stripslashes( trim ( (string) $_POST['style-title'] ) );
766
+
767
+ if ( isset($_POST['CSSXML'] ) )
768
+ $style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
769
+
770
+ $update_response = $polldaddy->update_style( $style, $style_data );
771
+
772
+ $this->parse_errors( $polldaddy );
773
+
774
+ if ( !$update_response )
775
+ $this->errors->add( 'UpdateStyle', __( 'Style could not be updated', 'polldaddy' ) );
776
+
777
+ if ( $this->errors->get_error_codes() )
778
+ return false;
779
+
780
+ $query_args['message'] = 'updated-style';
781
+ if ( isset($_POST['iframe']) )
782
+ $query_args['iframe'] = '';
783
+ break;
784
+ case 'create-style' :
785
+ if ( !$is_POST )
786
+ return;
787
+
788
+ check_admin_referer( 'create-style' );
789
+
790
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
791
+ $polldaddy->reset();
792
+
793
+ $style_data = _polldaddy_style_defaults();
794
+
795
+ if ( isset($_POST['style-title'] ) )
796
+ $style_data['title'] = stripslashes( strip_tags( trim ( (string) $_POST['style-title'] ) ) );
797
+
798
+ if ( isset($_POST['CSSXML'] ) )
799
+ $style_data['css'] = urlencode( stripslashes( trim ( (string) $_POST['CSSXML'] ) ) );
800
+
801
+ $style = $polldaddy->create_style( $style_data );
802
+ $this->parse_errors( $polldaddy );
803
+
804
+ if ( !$style || empty( $style->_id ) )
805
+ $this->errors->add( 'CreateStyle', __( 'Style could not be created', 'polldaddy' ) );
806
+
807
+ if ( $this->errors->get_error_codes() )
808
+ return false;
809
+
810
+ $query_args['message'] = 'created-style';
811
+ $query_args['action'] = 'edit-style';
812
+ $query_args['style'] = $style->_id;
813
+ if ( isset($_POST['iframe']) )
814
+ $query_args['iframe'] = '';
815
+ break;
816
+ case 'update-options' :
817
+ if ( !$is_POST )
818
+ return;
819
+
820
+ check_admin_referer( 'polldaddy-account' );
821
+
822
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
823
+ $polldaddy->reset();
824
+
825
+ $poll_defaults = _polldaddy_poll_defaults();
826
+
827
+ $user_defaults = array();
828
+
829
+ foreach( array( "multipleChoice", "randomiseAnswers", "otherAnswer", "sharing", "resultsType", "styleID", "blockRepeatVotersType", "blockExpiration" ) as $option ){
830
+ if ( isset( $poll_defaults[$option] ) && $poll_defaults[$option] )
831
+ $user_defaults[$option] = $poll_defaults[$option];
832
+ }
833
+
834
+ foreach ( array( 'multipleChoice', 'randomiseAnswers', 'otherAnswer', 'sharing' ) as $option ) {
835
+ if ( isset( $_POST[$option] ) && $_POST[$option] )
836
+ $user_defaults[$option] = 'yes';
837
+ else
838
+ $user_defaults[$option] = 'no';
839
+ }
840
+
841
+ $results = array( 'show', 'percent', 'hide' );
842
+ if ( isset( $_POST['resultsType'] ) && in_array( $_POST['resultsType'], $results ) )
843
+ $user_defaults['resultsType'] = $_POST['resultsType'];
844
+
845
+ if ( isset ( $_POST['styleID'] ) ){
846
+ $user_defaults['styleID'] = (int) $_POST['styleID'];
847
+ }
848
+
849
+ $blocks = array( 'off', 'cookie', 'cookieip' );
850
+ if ( isset( $_POST['blockRepeatVotersType'] ) && in_array( $_POST['blockRepeatVotersType'], $blocks ) )
851
+ $user_defaults['blockRepeatVotersType'] = $_POST['blockRepeatVotersType'];
852
+
853
+ if( isset( $_POST['blockExpiration'] ) )
854
+ $user_defaults['blockExpiration'] = (int) $_POST['blockExpiration'];
855
+
856
+ $polldaddy->update_poll_defaults( 0, $user_defaults );
857
+
858
+ $this->parse_errors( $polldaddy );
859
+ if ( $this->errors->get_error_codes() )
860
+ return false;
861
+
862
+ $query_args['message'] = 'updated-options';
863
+ break;
864
+ default :
865
+ return;
866
+ endswitch;
867
+ } elseif( $page == 'ratings' ) {
868
+ return;
869
+ }
870
+
871
+ wp_redirect( add_query_arg( $query_args, wp_get_referer() ) );
872
+ exit;
873
+ }
874
+
875
+ function management_page_load_signup() {
876
+ switch ( $_POST['account'] ) :
877
+ case 'import' :
878
+ return $this->import_account();
879
+ break;
880
+ default :
881
+ return;
882
+ endswitch;
883
+ }
884
+
885
+ function import_account(){
886
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID );
887
+ $polldaddy->reset();
888
+ $email = trim( stripslashes( $_POST['polldaddy_email'] ) );
889
+ $password = trim( stripslashes( $_POST['polldaddy_password'] ) );
890
+
891
+ if ( !is_email( $email ) )
892
+ $this->errors->add( 'polldaddy_email', __( 'Email address required', 'polldaddy' ) );
893
+
894
+ if ( !$password )
895
+ $this->errors->add( 'polldaddy_password', __( 'Password required', 'polldaddy' ) );
896
+
897
+ if ( $this->errors->get_error_codes() )
898
+ return false;
899
+
900
+ if ( $usercode = $polldaddy->initiate( $email, $password, $this->id ) ) {
901
+ $this->user_code = $usercode;
902
+ } else {
903
+ $this->parse_errors( $polldaddy );
904
+ $this->errors->add( 'import-account', __( 'Account could not be imported. Are your email address and password correct?', 'polldaddy' ) );
905
+ return false;
906
+ }
907
+ }
908
+
909
+ function admin_body_class( $class ) {
910
+ if ( isset( $_GET['iframe'] ) )
911
+ $class .= 'poll-preview-iframe ';
912
+ if ( isset( $_GET['TB_iframe'] ) )
913
+ $class .= 'poll-preview-iframe-editor ';
914
+ return $class;
915
+ }
916
+
917
+ function management_page_notices( $message = false ) {
918
+ switch ( (string) @$_GET['message'] ) :
919
+ case 'deleted' :
920
+ $deleted = (int) $_GET['deleted'];
921
+ if ( 1 == $deleted )
922
+ $message = __( 'Poll deleted.', 'polldaddy' );
923
+ else
924
+ $message = sprintf( __ngettext( '%s Poll Deleted.', '%s Polls Deleted.', $deleted ), number_format_i18n( $deleted ) );
925
+ break;
926
+ case 'opened' :
927
+ $opened = (int) $_GET['opened'];
928
+ if ( 1 == $opened )
929
+ $message = __( 'Poll opened.', 'polldaddy' );
930
+ else
931
+ $message = sprintf( __ngettext( '%s Poll Opened.', '%s Polls Opened.', $opened ), number_format_i18n( $opened ) );
932
+ break;
933
+ case 'closed' :
934
+ $closed = (int) $_GET['closed'];
935
+ if ( 1 == $closed )
936
+ $message = __( 'Poll closed.', 'polldaddy' );
937
+ else
938
+ $message = sprintf( __ngettext( '%s Poll Closed.', '%s Polls Closed.', $closed ), number_format_i18n( $closed ) );
939
+ break;
940
+ case 'updated' :
941
+ $message = __( 'Poll updated.', 'polldaddy' );
942
+ break;
943
+ case 'created' :
944
+ $message = __( 'Poll created.', 'polldaddy' );
945
+ if ( isset( $_GET['iframe'] ) )
946
+ $message .= ' <input type="button" class="button polldaddy-send-to-editor" value="' . attribute_escape( __( 'Send to Editor', 'polldaddy' ) ) . '" />';
947
+ break;
948
+ case 'updated-style' :
949
+ $message = __( 'Custom Style updated.', 'polldaddy' );
950
+ break;
951
+ case 'created-style' :
952
+ $message = __( 'Custom Style created.', 'polldaddy' );
953
+ break;
954
+ case 'deleted-style' :
955
+ $deleted = (int) $_GET['deleted'];
956
+ if ( 1 == $deleted )
957
+ $message = __( 'Custom Style deleted.', 'polldaddy' );
958
+ else
959
+ $message = sprintf( __ngettext( '%s Style Deleted.', '%s Custom Styles Deleted.', $deleted ), number_format_i18n( $deleted ) );
960
+ break;
961
+ case 'imported-account' :
962
+ $message = __( 'Account Imported.', 'polldaddy' );
963
+ break;
964
+ case 'updated-options' :
965
+ $message = __( 'Options Updated.', 'polldaddy' );
966
+ break;
967
+ endswitch;
968
+
969
+ $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
970
+
971
+ if ( $is_POST ) {
972
+ switch ( $GLOBALS['action'] ) :
973
+ case 'create-poll' :
974
+ $message = __( 'Error: An error has occurred; Poll not created.', 'polldaddy' );
975
+ break;
976
+ case 'edit-poll' :
977
+ $message = __( 'Error: An error has occurred; Poll not updated.', 'polldaddy' );
978
+ break;
979
+ case 'account' :
980
+ if ( 'import' == $_POST['account'] )
981
+ $message = __( 'Error: An error has occurred; Account could not be imported. Perhaps your email address or password is incorrect?', 'polldaddy' );
982
+ else
983
+ $message = __( 'Error: An error has occurred; Account could not be created.', 'polldaddy' );
984
+ break;
985
+ endswitch;
986
+ }
987
+
988
+ if ( !$message )
989
+ return;
990
+ ?>
991
+ <div class='updated'><p><?php echo $message; ?></p></div>
992
+ <?php
993
+ $this->print_errors();
994
+ }
995
+
996
+ function management_page() {
997
+ global $page, $action, $poll, $style, $rating;
998
+ $poll = (int) $poll;
999
+ $style = (int) $style;
1000
+ $rating = wp_specialchars( $rating );
1001
+ ?>
1002
+
1003
+ <div class="wrap" id="manage-polls">
1004
+
1005
+ <?php
1006
+ if( $page == 'polls' ) {
1007
+ if ( !$this->is_author && in_array( $action, array( 'edit', 'edit-poll', 'create-poll', 'edit-style', 'create-style', 'list-styles', 'options', 'update-options', 'import-account' ) ) ) {//check user privileges has access to action
1008
+ $action = '';
1009
+ }
1010
+ switch ( $action ) :
1011
+ case 'signup' :
1012
+ case 'account' :
1013
+ $this->signup();
1014
+ break;
1015
+ case 'preview' :
1016
+ ?>
1017
+
1018
+ <h2 id="preview-header"><?php
1019
+ if( $this->is_author )
1020
+ printf( __( 'Poll Preview (<a href="%s">Edit Poll</a>, <a href="%s">List Polls</a>)', 'polldaddy' ),
1021
+ clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll, 'message' => false ) ) ),
1022
+ clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ));
1023
+ else
1024
+ printf( __( 'Poll Preview (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1025
+
1026
+ <?php
1027
+ echo do_shortcode( "[polldaddy poll=$poll cb=1]" );
1028
+ break;
1029
+ case 'results' :
1030
+ ?>
1031
+
1032
+ <h2><?php
1033
+ if( $this->is_author )
1034
+ printf( __( 'Poll Results (<a href="%s">Edit Poll</a>)', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll, 'message' => false ) ) ) );
1035
+ else
1036
+ printf( __( 'Poll Results (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1037
+
1038
+ <?php
1039
+ $this->poll_results_page( $poll );
1040
+ break;
1041
+ case 'edit' :
1042
+ case 'edit-poll' :
1043
+ ?>
1044
+
1045
+ <h2><?php printf( __('Edit Poll (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1046
+
1047
+ <?php
1048
+
1049
+ $this->poll_edit_form( $poll );
1050
+ break;
1051
+ case 'create-poll' :
1052
+ ?>
1053
+
1054
+ <h2><?php printf( __('Create Poll (<a href="%s">List Polls</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => false, 'poll' => false, 'message' => false ) ) ) ); ?></h2>
1055
+
1056
+ <?php
1057
+ $this->poll_edit_form();
1058
+ break;
1059
+ case 'list-styles' :
1060
+ ?>
1061
+
1062
+ <h2><?php
1063
+ if( $this->is_author )
1064
+ printf( __('Custom Styles (<a href="%s">Add New</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => 'create-style', 'poll' => false, 'message' => false ) ) ) );
1065
+ else
1066
+ _e('Custom Styles', 'polldaddy'); ?></h2>
1067
+
1068
+ <?php
1069
+ $this->styles_table();
1070
+ break;
1071
+ case 'edit-style' :
1072
+ ?>
1073
+
1074
+ <h2><?php printf( __('Edit Style (<a href="%s">List Styles</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
1075
+
1076
+ <?php
1077
+
1078
+ $this->style_edit_form( $style );
1079
+ break;
1080
+ case 'create-style' :
1081
+ ?>
1082
+
1083
+ <h2><?php printf( __('Create Style (<a href="%s">List Styles</a>)', 'polldaddy'), clean_url( add_query_arg( array( 'action' => 'list-styles', 'style' => false, 'message' => false, 'preload' => false ) ) ) ); ?></h2>
1084
+
1085
+ <?php
1086
+ $this->style_edit_form();
1087
+ break;
1088
+ case 'options' :
1089
+ case 'import-account' :
1090
+ case 'update-options' :
1091
+ $this->plugin_options();
1092
+ break;
1093
+ default :
1094
+
1095
+ ?>
1096
+
1097
+ <h2 id="poll-list-header"><?php
1098
+ if( $this->is_author )
1099
+ printf( __( 'Polls (<a href="%s">Add New</a>)', 'polldaddy' ), clean_url( add_query_arg( array('action' => 'create-poll','poll' => false,'message' => false) ) ) );
1100
+ else
1101
+ _e( 'Polls', 'polldaddy'); ?></h2>
1102
+
1103
+ <?php
1104
+ $this->polls_table( isset( $_GET['view'] ) && 'user' == $_GET['view'] ? 'user' : 'blog' );
1105
+ endswitch;
1106
+ } elseif( $page == 'ratings' ) {
1107
+ if ( !$this->is_admin && !in_array( $action, array( 'change-report', 'reports' ) ) ) {//check user privileges has access to action
1108
+ $action = 'reports';
1109
+ }
1110
+
1111
+ switch ( $action ) :
1112
+ case 'change-report' :
1113
+ case 'reports' :
1114
+ $this->rating_reports();
1115
+ break;
1116
+ case 'update-rating' :
1117
+ $this->update_rating();
1118
+ $this->rating_settings( $action );
1119
+ break;
1120
+ default :
1121
+ $this->rating_settings();
1122
+ endswitch;
1123
+ }
1124
+ ?>
1125
+
1126
+ </div>
1127
+
1128
+ <?php
1129
+
1130
+ }
1131
+
1132
+ function polls_table( $view = 'blog' ) {
1133
+ $page = 1;
1134
+ if ( isset( $_GET['paged'] ) )
1135
+ $page = absint($_GET['paged']);
1136
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1137
+ $polldaddy->reset();
1138
+
1139
+ if( !$this->is_author )
1140
+ $view = '';
1141
+
1142
+ if ( 'user' == $view )
1143
+ $polls_object = $polldaddy->get_polls( ( $page - 1 ) * 10 + 1, $page * 10 );
1144
+ else
1145
+ $polls_object = $polldaddy->get_polls_by_parent_id( ( $page - 1 ) * 10 + 1, $page * 10 );
1146
+ $this->parse_errors( $polldaddy );
1147
+ $this->print_errors();
1148
+ $polls = & $polls_object->poll;
1149
+ if( isset( $polls_object->_total ) )
1150
+ $total_polls = $polls_object->_total;
1151
+ else
1152
+ $total_polls = count( $polls );
1153
+ $class = '';
1154
+
1155
+ $page_links = paginate_links( array(
1156
+ 'base' => add_query_arg( 'paged', '%#%' ),
1157
+ 'format' => '',
1158
+ 'total' => ceil( $total_polls / 10 ),
1159
+ 'current' => $page
1160
+ ) );
1161
+
1162
+ if( $this->is_author ){ ?>
1163
+ <ul class="subsubsub">
1164
+ <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => false, 'paged' => false ) ) ); ?>"<?php if ( 'blog' == $view ) echo ' class="current"'; ?>><?php _e( "All Blog's Polls", 'polldaddy' ); ?></a> | </li>
1165
+ <li><a href="<?php echo clean_url( add_query_arg( array( 'view' => 'user', 'paged' => false ) ) ); ?>"<?php if ( 'user' == $view ) echo ' class="current"'; ?>><?php _e( "All My Polls", 'polldaddy' ); ?></a></li>
1166
+ </ul>
1167
+ <?php } ?>
1168
+ <form method="post" action="">
1169
+ <?php if( $this->is_author ){ ?>
1170
+ <div class="tablenav">
1171
+ <div class="alignleft">
1172
+ <select name="action">
1173
+ <option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
1174
+ <option value="delete"><?php _e( 'Delete', 'polldaddy' ); ?></option>
1175
+ <option value="close"><?php _e( 'Close', 'polldaddy' ); ?></option>
1176
+ <option value="open"><?php _e( 'Open', 'polldaddy' ); ?></option>
1177
+ </select>
1178
+ <input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
1179
+ <?php wp_nonce_field( 'action-poll_bulk' ); ?>
1180
+ </div>
1181
+ <div class="tablenav-pages"><?php echo $page_links; ?></div>
1182
+ </div>
1183
+ <br class="clear" />
1184
+ <?php } ?>
1185
+ <table class="widefat">
1186
+ <thead>
1187
+ <tr>
1188
+ <th id="cb" class="manage-column column-cb check-column" scope="col" /><?php if( $this->is_author ){ ?><input type="checkbox" /><?php } ?></th>
1189
+ <th id="title" class="manage-column column-title" scope="col">Poll</th>
1190
+ <th id="votes" class="manage-column column-vote" scope="col">Votes</th>
1191
+ <th id="date" class="manage-column column-date" scope="col">Created</th>
1192
+ </tr>
1193
+ </thead>
1194
+ <tbody>
1195
+
1196
+ <?php
1197
+ if ( $polls ) :
1198
+ foreach ( $polls as $poll ) :
1199
+ $poll_id = (int) $poll->_id;
1200
+
1201
+ $poll->___content = trim( strip_tags( $poll->___content ) );
1202
+ if( strlen( $poll->___content ) == 0 ){
1203
+ $poll->___content = '-- empty HTML tag --';
1204
+ }
1205
+
1206
+ $poll_closed = (int) $poll->_closed;
1207
+
1208
+ if ( $this->is_author and $this->can_edit( $poll ) ) {
1209
+ $edit_link = clean_url( add_query_arg( array( 'action' => 'edit', 'poll' => $poll_id, 'message' => false ) ) );
1210
+ $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'poll' => $poll_id, 'message' => false ) ), "delete-poll_$poll_id" ) );
1211
+ $open_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'open', 'poll' => $poll_id, 'message' => false ) ), "open-poll_$poll_id" ) );
1212
+ $close_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'close', 'poll' => $poll_id, 'message' => false ) ), "close-poll_$poll_id" ) );
1213
+ }
1214
+ else {
1215
+ $edit_link = false;
1216
+ $delete_link = false;
1217
+ $open_link = false;
1218
+ $close_link = false;
1219
+ }
1220
+
1221
+ $class = $class ? '' : ' class="alternate"';
1222
+ $results_link = clean_url( add_query_arg( array( 'action' => 'results', 'poll' => $poll_id, 'message' => false ) ) );
1223
+ $preview_link = clean_url( add_query_arg( array( 'action' => 'preview', 'poll' => $poll_id, 'message' => false ) ) ); //, 'iframe' => '', 'TB_iframe' => 'true' ) ) );
1224
+ list($poll_time) = explode( '.', $poll->_created );
1225
+ $poll_time = strtotime( $poll_time );
1226
+ ?>
1227
+
1228
+ <tr<?php echo $class; ?>>
1229
+ <th class="check-column" scope="row"><?php if( $this->is_author and $this->can_edit( $poll ) ){ ?><input type="checkbox" value="<?php echo (int) $poll_id; ?>" name="poll[]" /><?php } ?></th>
1230
+ <td class="post-title column-title">
1231
+ <?php if ( $edit_link ) { ?>
1232
+ <strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo wp_specialchars( $poll->___content ); ?></a></strong>
1233
+ <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
1234
+ <?php } else { ?>
1235
+ <strong><?php echo wp_specialchars( $poll->___content ); ?></strong>
1236
+ <?php } ?>
1237
+ <span class="results"><a href="<?php echo $results_link; ?>"><?php _e( 'Results', 'polldaddy' ); ?></a> | </span>
1238
+ <?php if ( $delete_link ) { ?>
1239
+ <span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a> | </span>
1240
+ <?php }
1241
+ if ( $poll_closed == 2 ) {
1242
+ if ( $open_link ) { ?>
1243
+ <span class="open"><a class="open-poll" href="<?php echo $open_link; ?>"><?php _e( 'Open', 'polldaddy' ); ?></a> | </span>
1244
+ <?php } } else {
1245
+ if ( $close_link ) { ?>
1246
+ <span class="close"><a class="close-poll" href="<?php echo $close_link; ?>"><?php _e( 'Close', 'polldaddy' ); ?></a> | </span>
1247
+ <?php } } ?>
1248
+ <?php if ( isset( $_GET['iframe'] ) ) { ?>
1249
+ <span class="view"><a href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a> | </span>
1250
+ <span class="editor">
1251
+ <a href="#" class="polldaddy-send-to-editor"><?php _e( 'Send to editor', 'polldaddy' ); ?></a>
1252
+ <input type="hidden" class="polldaddy-poll-id hack" value="<?php echo (int) $poll_id; ?>" /> |
1253
+ </span>
1254
+ <?php } else { ?>
1255
+ <span class="view"><a class="thickbox" href="<?php echo $preview_link; ?>"><?php _e( 'Preview', 'polldaddy' ); ?></a> | </span>
1256
+ <?php } ?>
1257
+ <span class="shortcode"><a href="#" class="polldaddy-show-shortcode"><?php _e( 'HTML code', 'polldaddy' ); ?></a></span>
1258
+ <?php $this->poll_table_add_option( $poll_id ); ?>
1259
+ </td>
1260
+ <td class="poll-votes column-vote"><?php echo number_format_i18n( $poll->_responses ); ?></td>
1261
+ <td class="date column-date"><abbr title="<?php echo date( __('Y/m/d g:i:s A', 'polldaddy'), $poll_time ); ?>"><?php echo date( __('Y/m/d', 'polldaddy'), $poll_time ); ?></abbr></td>
1262
+ </tr>
1263
+ <tr class="polldaddy-shortcode-row" style="display: none;">
1264
+ <td colspan="4">
1265
+ <h4><?php _e( 'Shortcode', 'polldaddy' ); ?></h4>
1266
+ <pre>[polldaddy poll=<?php echo (int) $poll_id; ?>]</pre>
1267
+
1268
+ <h4><?php _e( 'JavaScript', 'polldaddy' ); ?></h4>
1269
+ <pre>&lt;script type="text/javascript" language="javascript"
1270
+ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"&gt;&lt;/script&gt;
1271
+ &lt;noscript&gt;
1272
+ &lt;a href="http://answers.polldaddy.com/poll/<?php echo (int) $poll_id; ?>/"&gt;<?php echo trim( strip_tags( $poll->___content ) ); ?>&lt;/a&gt;&lt;br/&gt;
1273
+ &lt;span style="font:9px;"&gt;(&lt;a href="http://www.polldaddy.com"&gt;polls&lt;/a&gt;)&lt;/span&gt;
1274
+ &lt;/noscript&gt;</pre>
1275
+ </td>
1276
+ </tr>
1277
+
1278
+ <?php
1279
+ endforeach;
1280
+ elseif ( $total_polls ) : // $polls
1281
+ ?>
1282
+
1283
+ <tr>
1284
+ <td colspan="4"><?php printf( __( 'What are you doing here? <a href="%s">Go back</a>.', 'polldaddy' ), clean_url( add_query_arg( 'paged', false ) ) ); ?></td>
1285
+ </tr>
1286
+
1287
+ <?php
1288
+ else : // $polls
1289
+ ?>
1290
+
1291
+ <tr>
1292
+ <td colspan="4"><?php
1293
+ if( $this->is_author )
1294
+ printf( __( 'No polls yet. <a href="%s">Create one</a>', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'create-poll' ) ) ) );
1295
+ else
1296
+ _e( 'No polls yet.', 'polldaddy' ); ?></td>
1297
+ </tr>
1298
+ <?php endif; // $polls ?>
1299
+
1300
+ </tbody>
1301
+ </table>
1302
+ <?php $this->poll_table_extra(); ?>
1303
+ </form>
1304
+ <div class="tablenav">
1305
+ <div class="tablenav-pages"><?php echo $page_links; ?></div>
1306
+ </div>
1307
+ <br class="clear" />
1308
+
1309
+ <?php
1310
+ }
1311
+
1312
+ function poll_table_add_option(){}
1313
+
1314
+ function poll_table_extra(){}
1315
+
1316
+ function poll_edit_form( $poll_id = 1 ) {
1317
+ $poll_id = (int) $poll_id;
1318
+
1319
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1320
+ $polldaddy->reset();
1321
+
1322
+ $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
1323
+
1324
+ if ( $poll_id ) {
1325
+ $poll = $polldaddy->get_poll( $poll_id );
1326
+ $this->parse_errors( $polldaddy );
1327
+
1328
+ if ( !$this->can_edit( $poll ) ) {
1329
+ $this->errors->add( 'permission', __( 'You are not allowed to edit this poll.', 'polldaddy' ) );
1330
+ }
1331
+
1332
+ if( $poll_id == 1 ){
1333
+ $poll->answers = array();
1334
+ $poll_id = 0;
1335
+ }
1336
+
1337
+ } else {
1338
+ $poll = polldaddy_poll( array(), null, false );
1339
+ }
1340
+
1341
+ $question = $is_POST ? attribute_escape( stripslashes( $_POST['question'] ) ) : attribute_escape( $poll->question );
1342
+
1343
+ $this->print_errors();
1344
+ ?>
1345
+
1346
+ <form action="" method="post">
1347
+ <div id="poststuff"><div id="post-body" class="has-sidebar has-right-sidebar">
1348
+
1349
+ <div class="inner-sidebar" id="side-info-column">
1350
+ <div id="submitdiv" class="postbox">
1351
+ <h3><?php _e( 'Publish', 'polldaddy' ); ?></h3>
1352
+ <div class="inside">
1353
+ <div id="major-publishing-actions">
1354
+ <p id="publishing-action">
1355
+ <?php wp_nonce_field( $poll_id ? "edit-poll_$poll_id" : 'create-poll' ); ?>
1356
+ <input type="hidden" name="action" value="<?php echo $poll_id ? 'edit-poll' : 'create-poll'; ?>" />
1357
+ <input type="hidden" class="polldaddy-poll-id" name="poll" value="<?php echo $poll_id; ?>" />
1358
+ <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Save Poll', 'polldaddy' ) ); ?>" />
1359
+
1360
+ <?php if ( isset( $_GET['iframe'] ) && $poll_id ) : ?>
1361
+
1362
+ <input type="button" class="button polldaddy-send-to-editor" value="<?php echo attribute_escape( __( 'Send to Editor', 'polldaddy' ) ); ?>" />
1363
+
1364
+ <?php endif; ?>
1365
+
1366
+ </p>
1367
+ <br class="clear" />
1368
+ </div>
1369
+ </div>
1370
+ </div>
1371
+
1372
+ <div class="postbox">
1373
+ <h3><?php _e( 'Poll results', 'polldaddy' ); ?></h3>
1374
+ <div class="inside">
1375
+ <ul class="poll-options">
1376
+
1377
+ <?php
1378
+ foreach ( array( 'show' => __( 'Show results to voters', 'polldaddy' ), 'percent' => __( 'Only show percentages', 'polldaddy' ), 'hide' => __( 'Hide all results', 'polldaddy' ) ) as $value => $label ) :
1379
+ if ( $is_POST )
1380
+ $checked = $value === $_POST['resultsType'] ? ' checked="checked"' : '';
1381
+ else
1382
+ $checked = $value === $poll->resultsType ? ' checked="checked"' : '';
1383
+ ?>
1384
+
1385
+ <li>
1386
+ <label for="resultsType-<?php echo $value; ?>"><input type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="resultsType" id="resultsType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1387
+ </li>
1388
+
1389
+ <?php endforeach; ?>
1390
+
1391
+ </ul>
1392
+ </div>
1393
+ </div>
1394
+
1395
+ <div class="postbox">
1396
+ <h3><?php _e( 'Block repeat voters', 'polldaddy' ); ?></h3>
1397
+ <div class="inside">
1398
+ <ul class="poll-options">
1399
+
1400
+ <?php
1401
+ foreach ( array( 'off' => __( "Don't block repeat voters", 'polldaddy' ), 'cookie' => __( 'Block by cookie (recommended)', 'polldaddy' ), 'cookieip' => __( 'Block by cookie and by IP address', 'polldaddy' ) ) as $value => $label ) :
1402
+ if ( $is_POST )
1403
+ $checked = $value === $_POST['blockRepeatVotersType'] ? ' checked="checked"' : '';
1404
+ else
1405
+ $checked = $value === $poll->blockRepeatVotersType ? ' checked="checked"' : '';
1406
+ ?>
1407
+
1408
+ <li>
1409
+ <label for="blockRepeatVotersType-<?php echo $value; ?>"><input class="block-repeat" type="radio"<?php echo $checked; ?> value="<?php echo $value; ?>" name="blockRepeatVotersType" id="blockRepeatVotersType-<?php echo $value; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1410
+ </li>
1411
+
1412
+ <?php endforeach; ?>
1413
+
1414
+ </ul>
1415
+
1416
+ <span style="margin:6px 6px 8px;" id="cookieip_expiration_label"><label><?php _e( 'Expires: ', 'polldaddy' ); ?></label></span>
1417
+ <select id="cookieip_expiration" name="cookieip_expiration" style="width: auto;<?php echo $poll->blockRepeatVotersType == 'off' ? 'display:none;' : ''; ?>">
1418
+ <option value="0" <?php echo (int) $poll->blockExpiration == 0 ? 'selected' : ''; ?>><?php _e( 'Never', 'polldaddy' ); ?></option>
1419
+ <option value="3600" <?php echo (int) $poll->blockExpiration == 3600 ? 'selected' : ''; ?>><?php printf( __('%d hour', 'polldaddy'), 1 ); ?></option>
1420
+ <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 3 ); ?></option>
1421
+ <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 6 ); ?></option>
1422
+ <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 12 ); ?></option>
1423
+ <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected' : ''; ?>><?php printf( __('%d day', 'polldaddy'), 1 ); ?></option>
1424
+ <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected' : ''; ?>><?php printf( __('%d week', 'polldaddy'), 1 ); ?></option>
1425
+ <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected' : ''; ?>><?php printf( __('%d month', 'polldaddy'), 1 ); ?></option>
1426
+ </select>
1427
+ <p><?php _e( 'Note: Blocking by cookie and IP address can be problematic for some voters.', 'polldaddy'); ?></p>
1428
+ </div>
1429
+ </div>
1430
+ </div>
1431
+
1432
+
1433
+ <div id="post-body-content" class="has-sidebar-content">
1434
+
1435
+ <div id="titlediv">
1436
+ <div id="titlewrap">
1437
+ <input type="text" autocomplete="off" id="title" value="<?php echo $question; ?>" tabindex="1" size="30" name="question" />
1438
+ </div>
1439
+ </div>
1440
+
1441
+ <div id="answersdiv" class="postbox">
1442
+ <h3><?php _e( 'Answers', 'polldaddy' ); ?></h3>
1443
+
1444
+ <div id="answerswrap" class="inside">
1445
+ <ul id="answers">
1446
+ <?php
1447
+ $a = 0;
1448
+ $answers = array();
1449
+ if ( $is_POST && $_POST['answer'] ) {
1450
+ foreach( $_POST['answer'] as $answer_id => $answer )
1451
+ $answers[attribute_escape($answer_id)] = attribute_escape( stripslashes($answer) );
1452
+ } elseif ( isset( $poll->answers->answer ) ) {
1453
+ foreach ( $poll->answers->answer as $answer )
1454
+ $answers[(int) $answer->_id] = attribute_escape( $answer->text );
1455
+ }
1456
+
1457
+ foreach ( $answers as $answer_id => $answer ) :
1458
+ $a++;
1459
+ $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-answer', 'poll' => $poll_id, 'answer' => $answer_id, 'message' => false ) ), "delete-answer_$answer_id" ) );
1460
+ ?>
1461
+
1462
+ <li>
1463
+ <span class="handle" title="<?php echo attribute_escape( 'click and drag to move' ); ?>">&#x2195;</span>
1464
+ <div><input type="text" autocomplete="off" id="answer-<?php echo $answer_id; ?>" value="<?php echo $answer; ?>" tabindex="2" size="30" name="answer[<?php echo $answer_id; ?>]" /></div>
1465
+ <a href="<?php echo $delete_link; ?>" class="delete-answer delete" title="<?php echo attribute_escape( 'delete this answer' ); ?>">&times;</a>
1466
+ </li>
1467
+
1468
+ <?php
1469
+ endforeach;
1470
+
1471
+ while ( 3 - $a > 0 ) :
1472
+ $a++;
1473
+ ?>
1474
+
1475
+ <li>
1476
+ <span class="handle" title="<?php echo attribute_escape( 'click and drag to move' ); ?>">&#x2195;</span>
1477
+ <div><input type="text" autocomplete="off" value="" tabindex="2" size="30" name="answer[new<?php echo $a; ?>]" /></div>
1478
+ <a href="#" class="delete-answer delete" title="<?php echo attribute_escape( 'delete this answer' ); ?>">&times;</a>
1479
+ </li>
1480
+
1481
+ <?php
1482
+ endwhile;
1483
+ ?>
1484
+
1485
+ </ul>
1486
+
1487
+ <p id="add-answer-holder">
1488
+ <button class="button"><?php echo wp_specialchars( __( 'Add another', 'polldaddy' ) ); ?></button>
1489
+ </p>
1490
+
1491
+ <ul id="answer-options">
1492
+
1493
+ <?php
1494
+ foreach ( array( 'multipleChoice' => __( 'Multiple choice', 'polldaddy' ), 'randomiseAnswers' => __( 'Randomize answer order', 'polldaddy' ), 'otherAnswer' => __( 'Allow other answers', 'polldaddy' ), 'sharing' => __( "'Share This' link", 'polldaddy' ) ) as $option => $label ) :
1495
+ if ( $is_POST )
1496
+ $checked = 'yes' === $_POST[$option] ? ' checked="checked"' : '';
1497
+ else
1498
+ $checked = 'yes' === $poll->$option ? ' checked="checked"' : '';
1499
+ ?>
1500
+
1501
+ <li>
1502
+ <label for="<?php echo $option; ?>"><input type="checkbox"<?php echo $checked; ?> value="yes" id="<?php echo $option; ?>" name="<?php echo $option; ?>" /> <?php echo wp_specialchars( $label ); ?></label>
1503
+ </li>
1504
+
1505
+ <?php endforeach; ?>
1506
+
1507
+ </ul>
1508
+ <?php
1509
+ if ( $is_POST )
1510
+ $style = 'yes' === $_POST['multipleChoice'] ? 'display:block;' : 'display:none;';
1511
+ else
1512
+ $style = 'yes' === $poll->multipleChoice ? 'display:block;' : 'display:none;';
1513
+ ?>
1514
+ <div id="numberChoices" name="numberChoices" style="padding-left:15px;<?php echo $style; ?>">
1515
+ <p>Number of choices: <select name="choices" id="choices"><option value="0">No Limit</option>
1516
+ <?php
1517
+ if ( $is_POST )
1518
+ $choices = (int) $_POST['choices'];
1519
+ else
1520
+ $choices = (int) $poll->choices;
1521
+
1522
+ if( $a > 1 ) :
1523
+ for( $i=2; $i<=$a; $i++ ) :
1524
+ $selected = $i == $choices ? 'selected="true"' : '';
1525
+ echo "<option value='$i' $selected>$i</option>";
1526
+ endfor;
1527
+ endif; ?>
1528
+ </select>
1529
+ </p>
1530
+ </div>
1531
+ </div>
1532
+ </div>
1533
+
1534
+ <div id="design" class="postbox">
1535
+
1536
+ <?php $style_ID = (int) ( $is_POST ? $_POST['styleID'] : $poll->styleID );
1537
+
1538
+ $iframe_view = false;
1539
+ if ( isset($_GET['iframe']) )
1540
+ $iframe_view = true;
1541
+
1542
+ $options = array(
1543
+ 101 => 'Aluminum Narrow',
1544
+ 102 => 'Aluminum Medium',
1545
+ 103 => 'Aluminum Wide',
1546
+ 104 => 'Plain White Narrow',
1547
+ 105 => 'Plain White Medium',
1548
+ 106 => 'Plain White Wide',
1549
+ 107 => 'Plain Black Narrow',
1550
+ 108 => 'Plain Black Medium',
1551
+ 109 => 'Plain Black Wide',
1552
+ 110 => 'Paper Narrow',
1553
+ 111 => 'Paper Medium',
1554
+ 112 => 'Paper Wide',
1555
+ 113 => 'Skull Dark Narrow',
1556
+ 114 => 'Skull Dark Medium',
1557
+ 115 => 'Skull Dark Wide',
1558
+ 116 => 'Skull Light Narrow',
1559
+ 117 => 'Skull Light Medium',
1560
+ 118 => 'Skull Light Wide',
1561
+ 157 => 'Micro',
1562
+ 119 => 'Plastic White Narrow',
1563
+ 120 => 'Plastic White Medium',
1564
+ 121 => 'Plastic White Wide',
1565
+ 122 => 'Plastic Grey Narrow',
1566
+ 123 => 'Plastic Grey Medium',
1567
+ 124 => 'Plastic Grey Wide',
1568
+ 125 => 'Plastic Black Narrow',
1569
+ 126 => 'Plastic Black Medium',
1570
+ 127 => 'Plastic Black Wide',
1571
+ 128 => 'Manga Narrow',
1572
+ 129 => 'Manga Medium',
1573
+ 130 => 'Manga Wide',
1574
+ 131 => 'Tech Dark Narrow',
1575
+ 132 => 'Tech Dark Medium',
1576
+ 133 => 'Tech Dark Wide',
1577
+ 134 => 'Tech Grey Narrow',
1578
+ 135 => 'Tech Grey Medium',
1579
+ 136 => 'Tech Grey Wide',
1580
+ 137 => 'Tech Light Narrow',
1581
+ 138 => 'Tech Light Medium',
1582
+ 139 => 'Tech Light Wide',
1583
+ 140 => 'Working Male Narrow',
1584
+ 141 => 'Working Male Medium',
1585
+ 142 => 'Working Male Wide',
1586
+ 143 => 'Working Female Narrow',
1587
+ 144 => 'Working Female Medium',
1588
+ 145 => 'Working Female Wide',
1589
+ 146 => 'Thinking Male Narrow',
1590
+ 147 => 'Thinking Male Medium',
1591
+ 148 => 'Thinking Male Wide',
1592
+ 149 => 'Thinking Female Narrow',
1593
+ 150 => 'Thinking Female Medium',
1594
+ 151 => 'Thinking Female Wide',
1595
+ 152 => 'Sunset Narrow',
1596
+ 153 => 'Sunset Medium',
1597
+ 154 => 'Sunset Wide',
1598
+ 155 => 'Music Medium',
1599
+ 156 => 'Music Wide'
1600
+ );
1601
+
1602
+ $polldaddy->reset();
1603
+ $styles = $polldaddy->get_styles();
1604
+
1605
+ $show_custom = false;
1606
+ if( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ){
1607
+ foreach( (array) $styles->style as $style ){
1608
+ $options[ (int) $style->_id ] = $style->title;
1609
+ }
1610
+ $show_custom = true;
1611
+ }
1612
+
1613
+ if ( $style_ID > 18 ){
1614
+ $standard_style_ID = 0;
1615
+ $custom_style_ID = $style_ID;
1616
+ }
1617
+ else{
1618
+ $standard_style_ID = $style_ID;
1619
+ $custom_style_ID = 0;
1620
+ }
1621
+ ?>
1622
+
1623
+ <h3><?php _e( 'Design', 'polldaddy' ); ?></h3>
1624
+ <input type="hidden" name="styleID" id="styleID" value="<?php echo $style_ID ?>">
1625
+ <div class="inside">
1626
+ <?php if ( $iframe_view ){ ?>
1627
+ <div id="design_standard" style="padding:0px;">
1628
+ <div class="hide-if-no-js">
1629
+ <table class="pollStyle">
1630
+ <thead>
1631
+ <tr>
1632
+ <th>
1633
+ <div style="display:none;">
1634
+ <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
1635
+ </div>
1636
+ </th>
1637
+ </tr>
1638
+ </thead>
1639
+ <tr>
1640
+ <td class="selector">
1641
+ <table class="st_selector">
1642
+ <tr>
1643
+ <td class="dir_left">
1644
+ <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#171;</a>
1645
+ </td>
1646
+ <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
1647
+ <td class="dir_right">
1648
+ <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#187;</a>
1649
+ </td>
1650
+ </tr>
1651
+ <tr>
1652
+ <td></td>
1653
+ <td class="counter">
1654
+ <div id="st_number"></div>
1655
+ </td>
1656
+ <td></td>
1657
+ </tr>
1658
+ <tr>
1659
+ <td></td>
1660
+ <td class="title">
1661
+ <div id="st_name"></div>
1662
+ </td>
1663
+ <td></td>
1664
+ </tr>
1665
+ <tr>
1666
+ <td></td>
1667
+ <td>
1668
+ <div id="st_sizes"></div>
1669
+ </td>
1670
+ <td></td>
1671
+ </tr>
1672
+ <tr>
1673
+ <td colspan="3">
1674
+ <div id="st_description"></div>
1675
+ </td>
1676
+ </tr>
1677
+ </table>
1678
+ </td>
1679
+ </tr>
1680
+ </table>
1681
+ </div>
1682
+
1683
+ <p class="empty-if-js" id="no-js-styleID">
1684
+ <select id="styleID" name="styleID">
1685
+
1686
+ <?php foreach ( $options as $styleID => $label ) :
1687
+ $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
1688
+ <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
1689
+ <?php endforeach; ?>
1690
+
1691
+ </select>
1692
+ </p>
1693
+ </div>
1694
+ <?php if ( $show_custom ){ ?>
1695
+ <div id="design_custom">
1696
+ <p class="hide-if-no-js">
1697
+ <table class="pollStyle">
1698
+ <thead>
1699
+ <tr>
1700
+ <th>
1701
+ <div style="display:none;">
1702
+ <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
1703
+ <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?>></input>
1704
+ <label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
1705
+ </div>
1706
+ </th>
1707
+ </tr>
1708
+ </thead>
1709
+ <tbody>
1710
+ <tr>
1711
+ <td class="customSelect">
1712
+ <table>
1713
+ <tr>
1714
+ <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
1715
+ <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
1716
+ <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
1717
+ <option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...', 'polldaddy' ); ?></option>
1718
+ <?php if( $show_custom) : foreach ( (array)$styles->style as $style ) :
1719
+ $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
1720
+ <option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
1721
+ <?php endforeach; endif; ?>
1722
+ </select>
1723
+ <div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.', 'polldaddy' ); ?></div></td>
1724
+ </tr>
1725
+ <tr>
1726
+ <td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
1727
+ <p><?php echo $extra ?></p>
1728
+ <p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
1729
+ </td>
1730
+ </tr>
1731
+ </table>
1732
+ </td>
1733
+ </tr>
1734
+ </tbody>
1735
+ </table>
1736
+ </p>
1737
+ </div>
1738
+ <div id="design_options">
1739
+ <a href="#" class="polldaddy-show-design-options"><?php _e( 'Custom Styles', 'polldaddy' ); ?></a>
1740
+ </div>
1741
+ <?php }}else{?>
1742
+ <div class="design_standard">
1743
+ <div class="hide-if-no-js">
1744
+ <table class="pollStyle">
1745
+ <thead>
1746
+ <tr>
1747
+ <th class="cb">
1748
+ <input type="radio" name="styleTypeCB" id="regular" onclick="javascript:pd_build_styles( 0 );"/>
1749
+ </th>
1750
+ <th>
1751
+ <label for="skin" onclick="javascript:pd_build_styles( 0 );"><?php _e( 'PollDaddy Style', 'polldaddy' ); ?></label>
1752
+ </th>
1753
+ <th/>
1754
+ <th class="cb">
1755
+ <?php $disabled = $show_custom == false ? ' disabled="true"' : ''; ?>
1756
+ <input type="radio" name="styleTypeCB" id="custom" onclick="javascript:pd_change_style(_$('customSelect').value);" <?php echo $disabled; ?>></input>
1757
+ </th>
1758
+ <th>
1759
+ <label onclick="javascript:pd_change_style(_$('customSelect').value);"><?php _e( 'Custom Style', 'polldaddy' ); ?></label>
1760
+ </th>
1761
+ </tr>
1762
+ </thead>
1763
+ <tbody>
1764
+ <tr>
1765
+ <td/>
1766
+ <td class="selector">
1767
+ <table class="st_selector">
1768
+ <tr>
1769
+ <td class="dir_left">
1770
+ <a href="javascript:pd_move('prev');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#171;</a>
1771
+ </td>
1772
+ <td class="img"><div class="st_image_loader"><div id="st_image" onmouseover="st_results(this, 'show');" onmouseout="st_results(this, 'hide');"></div></div></td>
1773
+ <td class="dir_right">
1774
+ <a href="javascript:pd_move('next');" style="width: 1em;display: block;font-size: 4em;text-decoration: none;">&#187;</a>
1775
+ </td>
1776
+ </tr>
1777
+ <tr>
1778
+ <td></td>
1779
+ <td class="counter">
1780
+ <div id="st_number"></div>
1781
+ </td>
1782
+ <td></td>
1783
+ </tr>
1784
+ <tr>
1785
+ <td></td>
1786
+ <td class="title">
1787
+ <div id="st_name"></div>
1788
+ </td>
1789
+ <td></td>
1790
+ </tr>
1791
+ <tr>
1792
+ <td></td>
1793
+ <td>
1794
+ <div id="st_sizes"></div>
1795
+ </td>
1796
+ <td></td>
1797
+ </tr>
1798
+ <tr>
1799
+ <td colspan="3">
1800
+ <div id="st_description"></div>
1801
+ </td>
1802
+ </tr>
1803
+ </table>
1804
+ </td>
1805
+ <td width="100"></td>
1806
+ <td/>
1807
+ <td class="customSelect">
1808
+ <table>
1809
+ <tr>
1810
+ <td><?php $hide = $show_custom == true ? ' style="display:block;"' : ' style="display:none;"'; ?>
1811
+ <select id="customSelect" name="customSelect" onclick="pd_change_style(this.value);" <?php echo $hide ?>>
1812
+ <?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
1813
+ <option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style...'); ?></option>
1814
+ <?php if( $show_custom) : foreach ( (array)$styles->style as $style ) :
1815
+ $selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
1816
+ <option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $style->title ); ?></option>
1817
+ <?php endforeach; endif;?>
1818
+ </select>
1819
+ <div id="styleIDErr" class="formErr" style="display:none;"><?php _e( 'Please choose a style.'); ?></div></td>
1820
+ </tr>
1821
+ <tr>
1822
+ <td><?php $extra = $show_custom == false ? 'You currently have no custom styles created.' : ''; ?>
1823
+ <p><?php echo $extra ?></p>
1824
+ <p><?php printf( __( 'Did you know we have a new editor for building your own custom poll styles? Find out more <a href="%s" target="_blank">here</a>.', 'polldaddy' ), 'http://support.polldaddy.com/custom-poll-styles/' ); ?></p>
1825
+ </td>
1826
+ </tr>
1827
+ </table>
1828
+ </td>
1829
+ </tr>
1830
+ </tbody>
1831
+ </table>
1832
+ </div>
1833
+ <p class="empty-if-js" id="no-js-styleID">
1834
+ <select id="styleID" name="styleID">
1835
+
1836
+ <?php foreach ( $options as $styleID => $label ) :
1837
+ $selected = $styleID == $style_ID ? ' selected="selected"' : ''; ?>
1838
+ <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option>
1839
+ <?php endforeach; ?>
1840
+
1841
+ </select>
1842
+ </p>
1843
+ </div>
1844
+ <?php } ?>
1845
+ <script language="javascript">
1846
+ current_pos = 0;
1847
+ pd_build_styles( current_pos );
1848
+ <?php if( $style_ID > 0 && $style_ID <= 1000 ){ ?>
1849
+ pd_pick_style( <?php echo $style_ID ?> );
1850
+ <?php }else{ ?>
1851
+ pd_change_style( <?php echo $style_ID ?> );
1852
+ <?php } ?>
1853
+ </script>
1854
+ </div>
1855
+
1856
+ </div>
1857
+
1858
+ </div>
1859
+ </div></div>
1860
+ </form>
1861
+ <br class="clear" />
1862
+
1863
+ <?php
1864
+ }
1865
+
1866
+ function poll_results_page( $poll_id ) {
1867
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1868
+ $polldaddy->reset();
1869
+
1870
+ $results = $polldaddy->get_poll_results( $poll_id );
1871
+ ?>
1872
+
1873
+ <table class="poll-results widefat">
1874
+ <thead>
1875
+ <tr>
1876
+ <th scope="col" class="column-title"><?php _e( 'Answer', 'polldaddy' ); ?></th>
1877
+ <th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
1878
+ </tr>
1879
+ </thead>
1880
+ <tbody>
1881
+
1882
+ <?php
1883
+ $class = '';
1884
+ foreach ( $results->answers as $answer ) :
1885
+ $answer->text = trim( strip_tags( $answer->text ) );
1886
+ if( strlen( $answer->text ) == 0 ){
1887
+ $answer->text = '-- empty HTML tag --';
1888
+ }
1889
+
1890
+ $class = $class ? '' : ' class="alternate"';
1891
+ $content = $results->others && 'Other answer...' === $answer->text ? sprintf( __( 'Other (<a href="%s">see below</a>)', 'polldaddy' ), '#other-answers-results' ) : wp_specialchars( $answer->text );
1892
+
1893
+ ?>
1894
+
1895
+ <tr<?php echo $class; ?>>
1896
+ <th scope="row" class="column-title"><?php echo $content; ?></th>
1897
+ <td class="column-vote">
1898
+ <div class="result-holder">
1899
+ <span class="result-bar" style="width: <?php echo number_format( $answer->_percent, 2 ); ?>%;">&nbsp;</span>
1900
+ <span class="result-total alignleft"><?php echo number_format_i18n( $answer->_total ); ?></span>
1901
+ <span class="result-percent alignright"><?php echo number_format_i18n( $answer->_percent ); ?>%</span>
1902
+ </div>
1903
+ </td>
1904
+ </tr>
1905
+ <?php
1906
+ endforeach;
1907
+ ?>
1908
+
1909
+ </tbody>
1910
+ </table>
1911
+
1912
+ <?php
1913
+
1914
+ if ( !$results->others )
1915
+ return;
1916
+ ?>
1917
+
1918
+ <table id="other-answers-results" class="poll-others widefat">
1919
+ <thead>
1920
+ <tr>
1921
+ <th scope="col" class="column-title"><?php _e( 'Other Answer', 'polldaddy' ); ?></th>
1922
+ <th scope="col" class="column-vote"><?php _e( 'Votes', 'polldaddy' ); ?></th>
1923
+ </tr>
1924
+ </thead>
1925
+ <tbody>
1926
+
1927
+ <?php
1928
+ $class = '';
1929
+ $others = array_count_values( $results->others );
1930
+ arsort( $others );
1931
+ foreach ( $others as $other => $freq ) :
1932
+ $class = $class ? '' : ' class="alternate"';
1933
+ ?>
1934
+
1935
+ <tr<?php echo $class; ?>>
1936
+ <th scope="row" class="column-title"><?php echo wp_specialchars( $other ); ?></th>
1937
+ <td class="column-vote"><?php echo number_format_i18n( $freq ); ?></td>
1938
+ </tr>
1939
+ <?php
1940
+ endforeach;
1941
+ ?>
1942
+
1943
+ </tbody>
1944
+ </table>
1945
+
1946
+ <?php
1947
+ }
1948
+
1949
+ function styles_table() {
1950
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
1951
+ $polldaddy->reset();
1952
+
1953
+ $styles_object = $polldaddy->get_styles();
1954
+
1955
+ $this->parse_errors( $polldaddy );
1956
+ $this->print_errors();
1957
+ $styles = & $styles_object->style;
1958
+ $class = '';
1959
+ $styles_exist = false;
1960
+
1961
+ foreach ( (array)$styles as $style ) :
1962
+ if( (int) $style->_type == 1 ):
1963
+ $styles_exist = true;
1964
+ break;
1965
+ endif;
1966
+ endforeach;
1967
+ ?>
1968
+
1969
+ <form method="post" action="">
1970
+ <div class="tablenav">
1971
+ <div class="alignleft">
1972
+ <select name="action">
1973
+ <option selected="selected" value=""><?php _e( 'Actions', 'polldaddy' ); ?></option>
1974
+ <option value="delete-style"><?php _e( 'Delete', 'polldaddy' ); ?></option>
1975
+ </select>
1976
+ <input class="button-secondary action" type="submit" name="doaction" value="<?php _e( 'Apply', 'polldaddy' ); ?>" />
1977
+ <?php wp_nonce_field( 'action-style_bulk' ); ?>
1978
+ </div>
1979
+ <div class="tablenav-pages"></div>
1980
+ </div>
1981
+ <br class="clear" />
1982
+ <table class="widefat">
1983
+ <thead>
1984
+ <tr>
1985
+ <th id="cb" class="manage-column column-cb check-column" scope="col" /><input type="checkbox" /></th>
1986
+ <th id="title" class="manage-column column-title" scope="col"><?php _e( 'Style', 'polldaddy' ); ?></th>
1987
+ <th id="date" class="manage-column column-date" scope="col"><?php _e( 'Last Modified', 'polldaddy' ); ?></th>
1988
+ </tr>
1989
+ </thead>
1990
+ <tbody>
1991
+
1992
+ <?php
1993
+ if ( $styles_exist ) :
1994
+ foreach ( $styles as $style ) :
1995
+ if( (int) $style->_type == 1 ):
1996
+ $style_id = (int) $style->_id;
1997
+
1998
+ $class = $class ? '' : ' class="alternate"';
1999
+ $edit_link = clean_url( add_query_arg( array( 'action' => 'edit-style', 'style' => $style_id, 'message' => false ) ) );
2000
+ $delete_link = clean_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete-style', 'style' => $style_id, 'message' => false ) ), "delete-style_$style_id" ) );
2001
+ list($style_time) = explode( '.', $style->date );
2002
+ $style_time = strtotime( $style_time );
2003
+ ?>
2004
+
2005
+ <tr<?php echo $class; ?>>
2006
+ <th class="check-column" scope="row"><input type="checkbox" value="<?php echo (int) $style_id; ?>" name="style[]" /></th>
2007
+ <td class="post-title column-title">
2008
+ <?php if ( $edit_link ) : ?>
2009
+ <strong><a class="row-title" href="<?php echo $edit_link; ?>"><?php echo wp_specialchars( $style->title ); ?></a></strong>
2010
+ <span class="edit"><a href="<?php echo $edit_link; ?>"><?php _e( 'Edit', 'polldaddy' ); ?></a> | </span>
2011
+ <?php else : ?>
2012
+ <strong><?php echo wp_specialchars( $style->title ); ?></strong>
2013
+ <?php endif; ?>
2014
+
2015
+ <span class="delete"><a class="delete-poll delete" href="<?php echo $delete_link; ?>"><?php _e( 'Delete', 'polldaddy' ); ?></a></span>
2016
+ </td>
2017
+ <td class="date column-date"><abbr title="<?php echo date( __('Y/m/d g:i:s A', 'polldaddy'), $style_time ); ?>"><?php echo date( __('Y/m/d', 'polldaddy'), $style_time ); ?></abbr></td>
2018
+ </tr>
2019
+
2020
+ <?php
2021
+ endif;
2022
+ endforeach;
2023
+ else : // $styles
2024
+ ?>
2025
+
2026
+ <tr>
2027
+ <td colspan="4"><?php printf( __( 'No custom styles yet. <a href="%s">Create one</a>', 'polldaddy' ), clean_url( add_query_arg( array( 'action' => 'create-style' ) ) ) ); ?></td>
2028
+ </tr>
2029
+ <?php endif; // $styles ?>
2030
+
2031
+ </tbody>
2032
+ </table>
2033
+ </form>
2034
+ <div class="tablenav">
2035
+ <div class="tablenav-pages"></div>
2036
+ </div>
2037
+ <br class="clear" />
2038
+
2039
+ <?php
2040
+ }
2041
+
2042
+ function style_edit_form( $style_id = 105 ) {
2043
+ $style_id = (int) $style_id;
2044
+
2045
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
2046
+ $polldaddy->reset();
2047
+
2048
+ $is_POST = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] );
2049
+
2050
+ if ( $style_id ) {
2051
+ $style = $polldaddy->get_style( $style_id );
2052
+ $this->parse_errors( $polldaddy );
2053
+ } else {
2054
+ $style = polldaddy_style( array(), null, false );
2055
+ }
2056
+
2057
+ $style->css = trim( urldecode( $style->css ) );
2058
+
2059
+ if ( $start = stripos( $style->css, '<data>' ) )
2060
+ $style->css = substr( $style->css, $start );
2061
+
2062
+ $style->css = addslashes( $style->css );
2063
+
2064
+ $preload_style_id = 0;
2065
+ $preload_style = null;
2066
+
2067
+ if ( isset ( $_REQUEST['preload'] ) )
2068
+ {
2069
+ $preload_style_id = (int) $_REQUEST['preload'];
2070
+
2071
+ if ( $preload_style_id > 1000 || $preload_style_id < 100 )
2072
+ $preload_style_id = 0;
2073
+
2074
+ if ( $preload_style_id > 0 ) {
2075
+ $polldaddy->reset();
2076
+ $preload_style = $polldaddy->get_style( $preload_style_id );
2077
+ $this->parse_errors( $polldaddy );
2078
+ }
2079
+
2080
+ $preload_style->css = trim( urldecode( $preload_style->css ) );
2081
+
2082
+ if ( $start = stripos( $preload_style->css, '<data>' ) )
2083
+ $preload_style->css = substr( $preload_style->css, $start );
2084
+
2085
+ $style->css = addslashes( $preload_style->css );
2086
+ }
2087
+
2088
+ $this->print_errors();
2089
+
2090
+ echo '<script language="javascript">var CSSXMLString = "' . $style->css .'";</script>';
2091
+ ?>
2092
+
2093
+ <form action="" method="post">
2094
+ <div id="poststuff">
2095
+ <div id="post-body">
2096
+ <br/>
2097
+ <table width="100%">
2098
+ <tr>
2099
+ <td colspan="2">
2100
+ <table width="100%">
2101
+ <tr>
2102
+ <td valign="middle" width="8%">
2103
+ <label class="CSSE_title_label"><?php _e( 'Style Name', 'polldaddy' ); ?></label>
2104
+ </td>
2105
+ <td>
2106
+ <div id="titlediv" style="margin:0px;">
2107
+ <div id="titlewrap">
2108
+ <input type="text" autocomplete="off" id="title" value="<?php echo $style_id > 1000 ? $style->title : ''; ?>" tabindex="1" size="30" name="style-title"></input>
2109
+ </div>
2110
+ </div>
2111
+ </td>
2112
+ </tr>
2113
+ </table>
2114
+ </td>
2115
+ </tr>
2116
+ <tr>
2117
+ <td width="13%">
2118
+ <label class="CSSE_title_label"><?php _e( 'Preload Basic Style', 'polldaddy' ); ?></label>
2119
+ </td>
2120
+ <td>
2121
+ <div class="CSSE_preload">
2122
+ <select id="preload_value">
2123
+ <option value="0"></option>
2124
+ <option value="102">Aluminum</option>
2125
+ <option value="105">Plain White</option>
2126
+ <option value="108">Plain Black</option>
2127
+ <option value="111">Paper</option>
2128
+ <option value="114">Skull Dark</option>
2129
+ <option value="117">Skull Light</option>
2130
+ <option value="157">Micro</option>
2131
+ </select>
2132
+ <a tabindex="4" id="style-preload" href="javascript:preload_pd_style();" class="button"><?php echo attribute_escape( __( 'Load Style', 'polldaddy' ) ); ?></a>
2133
+ </div>
2134
+ </td>
2135
+ </tr>
2136
+ <tr>
2137
+ <td width="13%">
2138
+ <p>Choose a part to edit...</p>
2139
+ </td>
2140
+ <td>
2141
+ <select id="styleName" onchange="renderStyleEdit(this.value);">
2142
+ <option value="pds-box" selected="selected">Poll Box</option>
2143
+ <option value="pds-question-top">Question</option>
2144
+ <option value="pds-answer-group">Answer Group</option>
2145
+ <option value="pds-answer-input">Answer Check</option>
2146
+ <option value="pds-answer">Answers</option>
2147
+ <option value="pds-textfield">Other Input</option>
2148
+ <option value="pds-vote-button">Vote Button</option>
2149
+ <option value="pds-link">Links</option>
2150
+ <option value="pds-answer-feedback">Result Background</option>
2151
+ <option value="pds-answer-feedback-bar">Result Bar</option>
2152
+ <option value="pds-totalvotes-inner">Total Votes</option>
2153
+ </select>
2154
+ </td>
2155
+ </tr>
2156
+ </table>
2157
+ <table width="100%">
2158
+ <tr>
2159
+ <td valign="top">
2160
+ <table class="CSSE_main">
2161
+ <tr>
2162
+ <td class="CSSE_main_l" valign="top">
2163
+ <div class="off" id="D_Font">
2164
+ <a href="javascript:CSSE_changeView('Font');" id="A_Font" class="Aoff">Font</a>
2165
+ </div>
2166
+ <div class="on" id="D_Background">
2167
+ <a href="javascript:CSSE_changeView('Background');" id="A_Background" class="Aon">Background</a>
2168
+ </div>
2169
+ <div class="off" id="D_Border">
2170
+ <a href="javascript:CSSE_changeView('Border');" id="A_Border" class="Aoff">Border</a>
2171
+ </div>
2172
+ <div class="off" id="D_Margin">
2173
+ <a href="javascript:CSSE_changeView('Margin');" id="A_Margin" class="Aoff">Margin</a>
2174
+ </div>
2175
+ <div class="off" id="D_Padding">
2176
+ <a href="javascript:CSSE_changeView('Padding');" id="A_Padding" class="Aoff">Padding</a>
2177
+ </div>
2178
+ <div class="off" id="D_Scale">
2179
+ <a href="javascript:CSSE_changeView('Scale');" id="A_Scale" class="Aoff">Width</a>
2180
+ </div>
2181
+ <div class="off" id="D_Height">
2182
+ <a href="javascript:CSSE_changeView('Height');" id="A_Height" class="Aoff">Height</a>
2183
+ </div>
2184
+ </td>
2185
+ <td class="CSSE_main_r" valign="top">
2186
+ <table class="CSSE_sub">
2187
+ <tr>
2188
+ <td class="top"/>
2189
+ </tr>
2190
+ <tr>
2191
+ <td class="mid">
2192
+ <!-- Font Table -->
2193
+ <table class="CSSE_edit" id="editFont" style="display:none;">
2194
+ <tr>
2195
+ <td width="85">Font Size:</td>
2196
+ <td>
2197
+ <select id="font-size" onchange="bind(this);">
2198
+ <option value="6px">6px</option>
2199
+ <option value="8px">8px</option>
2200
+ <option value="9px">9px</option>
2201
+ <option value="10px">10px</option>
2202
+ <option value="11px">11px</option>
2203
+ <option value="12px">12px</option>
2204
+ <option value="13px">13px</option>
2205
+ <option value="14px">14px</option>
2206
+ <option value="15px">15px</option>
2207
+ <option value="16px">16px</option>
2208
+ <option value="18px">18px</option>
2209
+ <option value="20px">20px</option>
2210
+ <option value="24px">24px</option>
2211
+ <option value="30px">30px</option>
2212
+ <option value="36px">36px</option>
2213
+ </select>
2214
+ </td>
2215
+ </tr>
2216
+ <tr>
2217
+ <td>Font Size</td>
2218
+ <td>
2219
+ <select id="font-family" onchange="bind(this);">
2220
+ <option value="Arial">Arial</option>
2221
+ <option value="Comic Sans MS">Comic Sans MS</option>
2222
+ <option value="Courier">Courier</option>
2223
+ <option value="Georgia">Georgia</option>
2224
+ <option value="Lucida Grande">Lucida Grande</option>
2225
+ <option value="Trebuchet MS">Trebuchet MS</option>
2226
+ <option value="Times">Times</option>
2227
+ <option value="Verdana">Verdana</option>
2228
+ </select>
2229
+ </td>
2230
+ </tr>
2231
+ <tr>
2232
+ <td>Color (#hex):</td>
2233
+ <td>
2234
+ <input type="text" maxlength="11" id="color" class="elmColor jscolor-picker" onblur="bind(this);" style="float:left;"/>
2235
+ </td>
2236
+ </tr>
2237
+ <tr>
2238
+ <td>Bold:</td>
2239
+ <td>
2240
+ <input type="checkbox" id="font-weight" value="bold" onclick="bind(this);"/>
2241
+ </td>
2242
+ </tr>
2243
+ <tr>
2244
+ <td>Italic:</td>
2245
+ <td>
2246
+ <input type="checkbox" id="font-style" value="italic" onclick="bind(this);"/>
2247
+ </td>
2248
+ </tr>
2249
+ <tr>
2250
+ <td>Underline:</td>
2251
+ <td>
2252
+ <input type="checkbox" id="text-decoration" value="underline" onclick="bind(this);"/>
2253
+ </td>
2254
+ </tr>
2255
+ <tr>
2256
+ <td>Line Height:</td>
2257
+ <td>
2258
+ <select id="line-height" onchange="bind(this);">
2259
+ <option value="6px">6px</option>
2260
+ <option value="8px">8px</option>
2261
+ <option value="9px">9px</option>
2262
+ <option value="10px">10px</option>
2263
+ <option value="11px">11px</option>
2264
+ <option value="12px">12px</option>
2265
+ <option value="13px">13px</option>
2266
+ <option value="14px">14px</option>
2267
+ <option value="15px">15px</option>
2268
+ <option value="16px">16px</option>
2269
+ <option value="18px">18px</option>
2270
+ <option value="20px">20px</option>
2271
+ <option value="24px">24px</option>
2272
+ <option value="30px">30px</option>
2273
+ <option value="36px">36px</option>
2274
+ </select>
2275
+ </td>
2276
+ </tr>
2277
+ <tr>
2278
+ <td>Align:</td>
2279
+ <td>
2280
+ <select id="text-align" onchange="bind(this);">
2281
+ <option value="left">Left</option>
2282
+ <option value="center">Center</option>
2283
+ <option value="right">Right</option>
2284
+ </select>
2285
+ </td>
2286
+ </tr>
2287
+ </table>
2288
+ <!-- Background Table -->
2289
+ <table class="CSSE_edit" id="editBackground" style="display:none;">
2290
+ <tr>
2291
+ <td width="85">Color (#hex):</td>
2292
+ <td>
2293
+ <input type="text" maxlength="11" id="background-color" class="elmColor jscolor-picker" onblur="bind(this);"/>
2294
+ </td>
2295
+ </tr>
2296
+ <tr>
2297
+ <td>Image URL: <a class="noteLink" title="Click here for more information" onclick="showNote('noteImageURL',this, 'Image URL');">(?)</a></td>
2298
+ <td>
2299
+ <input type="text" id="background-image" onblur="bind(this);"/>
2300
+ </td>
2301
+ </tr>
2302
+ <tr>
2303
+ <td>Image Repeat:</td>
2304
+ <td>
2305
+ <select id="background-repeat" onchange="bind(this);">
2306
+ <option value="repeat">repeat</option>
2307
+ <option value="no-repeat">no-repeat</option>
2308
+ <option value="repeat-x">repeat-x</option>
2309
+ <option value="repeat-y">repeat-y</option>
2310
+ </select>
2311
+ </td>
2312
+ </tr>
2313
+ <tr>
2314
+ <td>Image Position:</td>
2315
+ <td>
2316
+ <select id="background-position" onchange="bind(this);">
2317
+ <option value="left top">left top</option>
2318
+ <option value="left center">left center</option>
2319
+ <option value="left bottom">left bottom</option>
2320
+ <option value="center top">center top</option>
2321
+ <option value="center center">center center</option>
2322
+ <option value="center bottom">center bottom</option>
2323
+ <option value="right top">right top</option>
2324
+ <option value="right center">right center</option>
2325
+ <option value="right bottom">right bottom</option>
2326
+ </select>
2327
+ </td>
2328
+ </tr>
2329
+ </table>
2330
+ <!-- Border Table -->
2331
+ <table class="CSSE_edit" id="editBorder" style="display:none;">
2332
+ <tr>
2333
+ <td width="85">Width:</td>
2334
+ <td>
2335
+ <select id="border-width" onchange="bind(this);">
2336
+ <option value="0px">0px</option>
2337
+ <option value="1px">1px</option>
2338
+ <option value="2px">2px</option>
2339
+ <option value="3px">3px</option>
2340
+ <option value="4px">4px</option>
2341
+ <option value="5px">5px</option>
2342
+ <option value="6px">6px</option>
2343
+ <option value="7px">7px</option>
2344
+ <option value="8px">8px</option>
2345
+ <option value="9px">9px</option>
2346
+ <option value="10px">10px</option>
2347
+ <option value="11px">11px</option>
2348
+ <option value="12px">12px</option>
2349
+ <option value="13px">13px</option>
2350
+ <option value="14px">14px</option>
2351
+ <option value="15px">15px</option>
2352
+ <option value="16px">16px</option>
2353
+ <option value="17px">17px</option>
2354
+ <option value="18px">18px</option>
2355
+ <option value="19px">19px</option>
2356
+ <option value="20px">20px</option>
2357
+ <option value="21px">21px</option>
2358
+ <option value="22px">22px</option>
2359
+ <option value="23px">23px</option>
2360
+ <option value="24px">24px</option>
2361
+ <option value="25px">25px</option>
2362
+ <option value="26px">26px</option>
2363
+ <option value="27px">27px</option>
2364
+ <option value="28px">28px</option>
2365
+ <option value="29px">29px</option>
2366
+ <option value="30px">30px</option>
2367
+ </select>
2368
+ </td>
2369
+ </tr>
2370
+ <tr>
2371
+ <td>Style:</td>
2372
+ <td>
2373
+ <select id="border-style" onchange="bind(this);">
2374
+ <option value="none">none</option>
2375
+ <option value="solid">solid</option>
2376
+ <option value="dotted">dotted</option>
2377
+ <option value="dashed">dashed</option>
2378
+ <option value="double">double</option>
2379
+ <option value="groove">groove</option>
2380
+ <option value="inset">inset</option>
2381
+ <option value="outset">outset</option>
2382
+ <option value="ridge">ridge</option>
2383
+ <option value="hidden">hidden</option>
2384
+ </select>
2385
+ </td>
2386
+ </tr>
2387
+ <tr>
2388
+ <td>Color (#hex):</td>
2389
+ <td>
2390
+ <input type="text" maxlength="11" class="elmColor jscolor-picker" id="border-color" onblur="bind(this);"/>
2391
+ </td>
2392
+ </tr>
2393
+ <tr>
2394
+ <td width="85">Rounded Corners:</td>
2395
+ <td>
2396
+ <select id="border-radius" onchange="bind(this);">
2397
+ <option value="0px">0px</option>
2398
+ <option value="1px">1px</option>
2399
+ <option value="2px">2px</option>
2400
+ <option value="3px">3px</option>
2401
+ <option value="4px">4px</option>
2402
+ <option value="5px">5px</option>
2403
+ <option value="6px">6px</option>
2404
+ <option value="7px">7px</option>
2405
+ <option value="8px">8px</option>
2406
+ <option value="9px">9px</option>
2407
+ <option value="10px">10px</option>
2408
+ <option value="11px">11px</option>
2409
+ <option value="12px">12px</option>
2410
+ <option value="13px">13px</option>
2411
+ <option value="14px">14px</option>
2412
+ <option value="15px">15px</option>
2413
+ <option value="16px">16px</option>
2414
+ <option value="17px">17px</option>
2415
+ <option value="18px">18px</option>
2416
+ <option value="19px">19px</option>
2417
+ <option value="20px">20px</option>
2418
+ <option value="21px">21px</option>
2419
+ <option value="22px">22px</option>
2420
+ <option value="23px">23px</option>
2421
+ <option value="24px">24px</option>
2422
+ <option value="25px">25px</option>
2423
+ <option value="26px">26px</option>
2424
+ <option value="27px">27px</option>
2425
+ <option value="28px">28px</option>
2426
+ <option value="29px">29px</option>
2427
+ <option value="30px">30px</option>
2428
+ </select>
2429
+ <br/>
2430
+ Not supported in Internet Explorer.
2431
+ </td>
2432
+ </tr>
2433
+ </table>
2434
+ <!-- Margin Table -->
2435
+ <table class="CSSE_edit" id="editMargin" style="display:none;">
2436
+ <tr>
2437
+ <td width="85">Top: </td>
2438
+ <td>
2439
+ <select id="margin-top" onchange="bind(this);">
2440
+ <option value="0px">0px</option>
2441
+ <option value="1px">1px</option>
2442
+ <option value="2px">2px</option>
2443
+ <option value="3px">3px</option>
2444
+ <option value="4px">4px</option>
2445
+ <option value="5px">5px</option>
2446
+ <option value="6px">6px</option>
2447
+ <option value="7px">7px</option>
2448
+ <option value="8px">8px</option>
2449
+ <option value="9px">9px</option>
2450
+ <option value="10px">10px</option>
2451
+ <option value="11px">11px</option>
2452
+ <option value="12px">12px</option>
2453
+ <option value="13px">13px</option>
2454
+ <option value="14px">14px</option>
2455
+ <option value="15px">15px</option>
2456
+ <option value="16px">16px</option>
2457
+ <option value="17px">17px</option>
2458
+ <option value="18px">18px</option>
2459
+ <option value="19px">19px</option>
2460
+ <option value="20px">20px</option>
2461
+ <option value="21px">21px</option>
2462
+ <option value="22px">22px</option>
2463
+ <option value="23px">23px</option>
2464
+ <option value="24px">24px</option>
2465
+ <option value="25px">25px</option>
2466
+ <option value="26px">26px</option>
2467
+ <option value="27px">27px</option>
2468
+ <option value="28px">28px</option>
2469
+ <option value="29px">29px</option>
2470
+ <option value="30px">30px</option>
2471
+ </select>
2472
+ </td>
2473
+ </tr>
2474
+ <tr>
2475
+ <td>Right:</td>
2476
+ <td>
2477
+ <select id="margin-right" onchange="bind(this);">
2478
+ <option value="0px">0px</option>
2479
+ <option value="1px">1px</option>
2480
+ <option value="2px">2px</option>
2481
+ <option value="3px">3px</option>
2482
+ <option value="4px">4px</option>
2483
+ <option value="5px">5px</option>
2484
+ <option value="6px">6px</option>
2485
+ <option value="7px">7px</option>
2486
+ <option value="8px">8px</option>
2487
+ <option value="9px">9px</option>
2488
+ <option value="10px">10px</option>
2489
+ <option value="11px">11px</option>
2490
+ <option value="12px">12px</option>
2491
+ <option value="13px">13px</option>
2492
+ <option value="14px">14px</option>
2493
+ <option value="15px">15px</option>
2494
+ <option value="16px">16px</option>
2495
+ <option value="17px">17px</option>
2496
+ <option value="18px">18px</option>
2497
+ <option value="19px">19px</option>
2498
+ <option value="20px">20px</option>
2499
+ <option value="21px">21px</option>
2500
+ <option value="22px">22px</option>
2501
+ <option value="23px">23px</option>
2502
+ <option value="24px">24px</option>
2503
+ <option value="25px">25px</option>
2504
+ <option value="26px">26px</option>
2505
+ <option value="27px">27px</option>
2506
+ <option value="28px">28px</option>
2507
+ <option value="29px">29px</option>
2508
+ <option value="30px">30px</option>
2509
+ </select>
2510
+ </td>
2511
+ </tr>
2512
+ <tr>
2513
+ <td>Bottom:</td>
2514
+ <td>
2515
+ <select id="margin-bottom" onchange="bind(this);">
2516
+ <option value="0px">0px</option>
2517
+ <option value="1px">1px</option>
2518
+ <option value="2px">2px</option>
2519
+ <option value="3px">3px</option>
2520
+ <option value="4px">4px</option>
2521
+ <option value="5px">5px</option>
2522
+ <option value="6px">6px</option>
2523
+ <option value="7px">7px</option>
2524
+ <option value="8px">8px</option>
2525
+ <option value="9px">9px</option>
2526
+ <option value="10px">10px</option>
2527
+ <option value="11px">11px</option>
2528
+ <option value="12px">12px</option>
2529
+ <option value="13px">13px</option>
2530
+ <option value="14px">14px</option>
2531
+ <option value="15px">15px</option>
2532
+ <option value="16px">16px</option>
2533
+ <option value="17px">17px</option>
2534
+ <option value="18px">18px</option>
2535
+ <option value="19px">19px</option>
2536
+ <option value="20px">20px</option>
2537
+ <option value="21px">21px</option>
2538
+ <option value="22px">22px</option>
2539
+ <option value="23px">23px</option>
2540
+ <option value="24px">24px</option>
2541
+ <option value="25px">25px</option>
2542
+ <option value="26px">26px</option>
2543
+ <option value="27px">27px</option>
2544
+ <option value="28px">28px</option>
2545
+ <option value="29px">29px</option>
2546
+ <option value="30px">30px</option>
2547
+ </select>
2548
+ </td>
2549
+ </tr>
2550
+ <tr>
2551
+ <td>Left:</td>
2552
+ <td>
2553
+ <select id="margin-left" onchange="bind(this);">
2554
+ <option value="0px">0px</option>
2555
+ <option value="1px">1px</option>
2556
+ <option value="2px">2px</option>
2557
+ <option value="3px">3px</option>
2558
+ <option value="4px">4px</option>
2559
+ <option value="5px">5px</option>
2560
+ <option value="6px">6px</option>
2561
+ <option value="7px">7px</option>
2562
+ <option value="8px">8px</option>
2563
+ <option value="9px">9px</option>
2564
+ <option value="10px">10px</option>
2565
+ <option value="11px">11px</option>
2566
+ <option value="12px">12px</option>
2567
+ <option value="13px">13px</option>
2568
+ <option value="14px">14px</option>
2569
+ <option value="15px">15px</option>
2570
+ <option value="16px">16px</option>
2571
+ <option value="17px">17px</option>
2572
+ <option value="18px">18px</option>
2573
+ <option value="19px">19px</option>
2574
+ <option value="20px">20px</option>
2575
+ <option value="21px">21px</option>
2576
+ <option value="22px">22px</option>
2577
+ <option value="23px">23px</option>
2578
+ <option value="24px">24px</option>
2579
+ <option value="25px">25px</option>
2580
+ <option value="26px">26px</option>
2581
+ <option value="27px">27px</option>
2582
+ <option value="28px">28px</option>
2583
+ <option value="29px">29px</option>
2584
+ <option value="30px">30px</option>
2585
+ </select>
2586
+ </td>
2587
+ </tr>
2588
+ </table>
2589
+ <!-- Padding Table -->
2590
+ <table class="CSSE_edit" id="editPadding" style="display:none;">
2591
+ <tr>
2592
+ <td width="85">Top:</td>
2593
+ <td>
2594
+ <select id="padding-top" onchange="bind(this);">
2595
+ <option value="0px">0px</option>
2596
+ <option value="1px">1px</option>
2597
+ <option value="2px">2px</option>
2598
+ <option value="3px">3px</option>
2599
+ <option value="4px">4px</option>
2600
+ <option value="5px">5px</option>
2601
+ <option value="6px">6px</option>
2602
+ <option value="7px">7px</option>
2603
+ <option value="8px">8px</option>
2604
+ <option value="9px">9px</option>
2605
+ <option value="10px">10px</option>
2606
+ <option value="11px">11px</option>
2607
+ <option value="12px">12px</option>
2608
+ <option value="13px">13px</option>
2609
+ <option value="14px">14px</option>
2610
+ <option value="15px">15px</option>
2611
+ <option value="16px">16px</option>
2612
+ <option value="17px">17px</option>
2613
+ <option value="18px">18px</option>
2614
+ <option value="19px">19px</option>
2615
+ <option value="20px">20px</option>
2616
+ <option value="21px">21px</option>
2617
+ <option value="22px">22px</option>
2618
+ <option value="23px">23px</option>
2619
+ <option value="24px">24px</option>
2620
+ <option value="25px">25px</option>
2621
+ <option value="26px">26px</option>
2622
+ <option value="27px">27px</option>
2623
+ <option value="28px">28px</option>
2624
+ <option value="29px">29px</option>
2625
+ <option value="30px">30px</option>
2626
+ </select>
2627
+ </td>
2628
+ </tr>
2629
+ <tr>
2630
+ <td>Right:</td>
2631
+ <td>
2632
+ <select id="padding-right" onchange="bind(this);">
2633
+ <option value="0px">0px</option>
2634
+ <option value="1px">1px</option>
2635
+ <option value="2px">2px</option>
2636
+ <option value="3px">3px</option>
2637
+ <option value="4px">4px</option>
2638
+ <option value="5px">5px</option>
2639
+ <option value="6px">6px</option>
2640
+ <option value="7px">7px</option>
2641
+ <option value="8px">8px</option>
2642
+ <option value="9px">9px</option>
2643
+ <option value="10px">10px</option>
2644
+ <option value="11px">11px</option>
2645
+ <option value="12px">12px</option>
2646
+ <option value="13px">13px</option>
2647
+ <option value="14px">14px</option>
2648
+ <option value="15px">15px</option>
2649
+ <option value="16px">16px</option>
2650
+ <option value="17px">17px</option>
2651
+ <option value="18px">18px</option>
2652
+ <option value="19px">19px</option>
2653
+ <option value="20px">20px</option>
2654
+ <option value="21px">21px</option>
2655
+ <option value="22px">22px</option>
2656
+ <option value="23px">23px</option>
2657
+ <option value="24px">24px</option>
2658
+ <option value="25px">25px</option>
2659
+ <option value="26px">26px</option>
2660
+ <option value="27px">27px</option>
2661
+ <option value="28px">28px</option>
2662
+ <option value="29px">29px</option>
2663
+ <option value="30px">30px</option>
2664
+ </select>
2665
+ </td>
2666
+ </tr>
2667
+ <tr>
2668
+ <td>Bottom:</td>
2669
+ <td>
2670
+ <select id="padding-bottom" onchange="bind(this);">
2671
+ <option value="0px">0px</option>
2672
+ <option value="1px">1px</option>
2673
+ <option value="2px">2px</option>
2674
+ <option value="3px">3px</option>
2675
+ <option value="4px">4px</option>
2676
+ <option value="5px">5px</option>
2677
+ <option value="6px">6px</option>
2678
+ <option value="7px">7px</option>
2679
+ <option value="8px">8px</option>
2680
+ <option value="9px">9px</option>
2681
+ <option value="10px">10px</option>
2682
+ <option value="11px">11px</option>
2683
+ <option value="12px">12px</option>
2684
+ <option value="13px">13px</option>
2685
+ <option value="14px">14px</option>
2686
+ <option value="15px">15px</option>
2687
+ <option value="16px">16px</option>
2688
+ <option value="17px">17px</option>
2689
+ <option value="18px">18px</option>
2690
+ <option value="19px">19px</option>
2691
+ <option value="20px">20px</option>
2692
+ <option value="21px">21px</option>
2693
+ <option value="22px">22px</option>
2694
+ <option value="23px">23px</option>
2695
+ <option value="24px">24px</option>
2696
+ <option value="25px">25px</option>
2697
+ <option value="26px">26px</option>
2698
+ <option value="27px">27px</option>
2699
+ <option value="28px">28px</option>
2700
+ <option value="29px">29px</option>
2701
+ <option value="30px">30px</option>
2702
+ </select>
2703
+ </td>
2704
+ </tr>
2705
+ <tr>
2706
+ <td>Left:</td>
2707
+ <td>
2708
+ <select id="padding-left" onchange="bind(this);">
2709
+ <option value="0px">0px</option>
2710
+ <option value="1px">1px</option>
2711
+ <option value="2px">2px</option>
2712
+ <option value="3px">3px</option>
2713
+ <option value="4px">4px</option>
2714
+ <option value="5px">5px</option>
2715
+ <option value="6px">6px</option>
2716
+ <option value="7px">7px</option>
2717
+ <option value="8px">8px</option>
2718
+ <option value="9px">9px</option>
2719
+ <option value="10px">10px</option>
2720
+ <option value="11px">11px</option>
2721
+ <option value="12px">12px</option>
2722
+ <option value="13px">13px</option>
2723
+ <option value="14px">14px</option>
2724
+ <option value="15px">15px</option>
2725
+ <option value="16px">16px</option>
2726
+ <option value="17px">17px</option>
2727
+ <option value="18px">18px</option>
2728
+ <option value="19px">19px</option>
2729
+ <option value="20px">20px</option>
2730
+ <option value="21px">21px</option>
2731
+ <option value="22px">22px</option>
2732
+ <option value="23px">23px</option>
2733
+ <option value="24px">24px</option>
2734
+ <option value="25px">25px</option>
2735
+ <option value="26px">26px</option>
2736
+ <option value="27px">27px</option>
2737
+ <option value="28px">28px</option>
2738
+ <option value="29px">29px</option>
2739
+ <option value="30px">30px</option>
2740
+ </select>
2741
+ </td>
2742
+ </tr>
2743
+ </table>
2744
+ <!-- Scale Table -->
2745
+ <table class="CSSE_edit" id="editScale" style="display:none;">
2746
+ <tr>
2747
+ <td width="85">Width (px): <a class="noteLink" title="Click here for more information" onclick="showNote('noteWidth',this, 'Width');">(?)</a></td>
2748
+ <td>
2749
+ <input type="text" maxlength="4" class="elmColor" id="width" onblur="bind(this);"/>
2750
+ </td>
2751
+ </tr>
2752
+ <tr>
2753
+ <td width="85"></td>
2754
+ <td>
2755
+ If you change the width of the<br/> poll you may also need to change<br/> the width of your answers.
2756
+ </td>
2757
+ </tr>
2758
+ </table>
2759
+
2760
+ <!-- Height Table -->
2761
+ <table class="CSSE_edit" id="editHeight" style="display:none;">
2762
+ <tr>
2763
+ <td width="85">Height (px):</td>
2764
+ <td>
2765
+ <input type="text" maxlength="4" class="elmColor" id="height" onblur="bind(this);"/>
2766
+ </td>
2767
+ </tr>
2768
+ </table>
2769
+ </td>
2770
+ </tr>
2771
+ <tr>
2772
+ <td class="btm"/>
2773
+ </tr>
2774
+ </table>
2775
+ </td>
2776
+ </tr>
2777
+ </table>
2778
+ </td>
2779
+ <td width="10"> </td>
2780
+ <td valign="top">
2781
+ <div style="overflow-x:auto;width:633px;">
2782
+ <!-- POLL XHTML START -->
2783
+ <div class="pds-box" id="pds-box">
2784
+ <div class="pds-box-outer">
2785
+ <div class="pds-box-inner">
2786
+ <div class="pds-box-top">
2787
+ <div class="pds-question">
2788
+ <div class="pds-question-outer">
2789
+ <div class="pds-question-inner">
2790
+ <div class="pds-question-top" id="pds-question-top">Do you mostly use the internet at work, in school or at home?</div>
2791
+ </div>
2792
+ </div>
2793
+ </div>
2794
+ <div>
2795
+ <!-- divAnswers -->
2796
+ <div id="divAnswers">
2797
+ <span id="pds-answer143974">
2798
+
2799
+ <span class="pds-answer-group" id="pds-answer-group">
2800
+ <span class="pds-answer-input" id="pds-answer-input">
2801
+ <input type="radio" name="PDI_answer" value="1" id="p1" class="pds-checkbox"/>
2802
+ </span>
2803
+ <label for="p1" class="pds-answer" id="pds-answer"><span class="pds-answer-span">I use it in school.</span></label>
2804
+ <span class="pds-clear"></span>
2805
+ </span>
2806
+
2807
+ <span class="pds-answer-group" id="pds-answer-group1">
2808
+ <span class="pds-answer-input" id="pds-answer-input1">
2809
+ <input type="radio" name="PDI_answer" value="2" id="p2" class="pds-checkbox"/>
2810
+ </span>
2811
+ <label for="p2" class="pds-answer" id="pds-answer1"><span class="pds-answer-span">I use it at home.</span></label>
2812
+ <span class="pds-clear"></span>
2813
+ </span>
2814
+
2815
+ <span class="pds-answer-group" id="pds-answer-group2">
2816
+ <span class="pds-answer-input" id="pds-answer-input2">
2817
+ <input type="radio" name="PDI_answer" value="3" id="p3" class="pds-checkbox"/>
2818
+ </span>
2819
+ <label for="p3" class="pds-answer" id="pds-answer2"><span class="pds-answer-span">I use it every where I go, at work and home and anywhere else that I can!</span></label>
2820
+ <span class="pds-clear"></span>
2821
+ </span>
2822
+
2823
+ <span class="pds-answer-group" id="pds-answer-group3">
2824
+ <span class="pds-answer-input" id="pds-answer-input3">
2825
+ <input type="radio" name="PDI_answer" value="4" id="p4" class="pds-checkbox"/>
2826
+ </span>
2827
+ <label for="p4" class="pds-answer" id="pds-answer3"><span class="pds-answer-span">Other:</span></label>
2828
+ <span class="pds-clear"></span>
2829
+ <span class="pds-answer-other">
2830
+ <input type="text" name="PDI_OtherText1761982" id="pds-textfield" maxlength="80" class="pds-textfield"/>
2831
+ </span>
2832
+ <span class="pds-clear"></span>
2833
+ </span>
2834
+
2835
+ </span>
2836
+ <br/>
2837
+ <div class="pds-vote" id="pds-links">
2838
+ <div class="pds-votebutton-outer">
2839
+ <a href="javascript:renderStyleEdit('pds-answer-feedback');" id="pds-vote-button" style="display:block;float:left;" class="pds-vote-button"><span>Vote</span></a>
2840
+ <span class="pds-links">
2841
+ <div style="padding: 0px 0px 0px 15px; float:left;"><a href="javascript:renderStyleEdit('pds-answer-feedback');" class="pds-link" id="pds-link">View Results</a></div>
2842
+ <span class="pds-clear"></span>
2843
+ </span>
2844
+ <span class="pds-clear"></span>
2845
+ </div>
2846
+ </div>
2847
+
2848
+ </div>
2849
+ <!-- End divAnswers -->
2850
+ <!-- divResults -->
2851
+ <div id="divResults">
2852
+
2853
+ <div class="pds-answer-group" id="pds-answer-group4">
2854
+ <label for="PDI_feedback1" class="pds-answer" id="pds-answer4"><span class="pds-answer-text">I use it in school!</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>46%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(620 votes)</span></label>
2855
+ <span class="pds-clear"></span>
2856
+ <div id="pds-answer-feedback">
2857
+ <div style="width:46%;" id="pds-answer-feedback-bar" class="pds-answer-feedback-bar"></div>
2858
+ </div>
2859
+ <span class="pds-clear"></span>
2860
+ </div>
2861
+
2862
+ <div class="pds-answer-group" id="pds-answer-group5">
2863
+ <label for="PDI_feedback2" class="pds-answer" id="pds-answer5"><span class="pds-answer-text">I use it at home.</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>30%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(400 votes)</span></label>
2864
+ <span class="pds-clear"></span>
2865
+ <div id="pds-answer-feedback2">
2866
+ <div style="width:46%;" id="pds-answer-feedback-bar2" class="pds-answer-feedback-bar"></div>
2867
+ </div>
2868
+ <span class="pds-clear"></span>
2869
+ </div>
2870
+
2871
+ <div class="pds-answer-group" id="pds-answer-group6">
2872
+ <label for="PDI_feedback3" class="pds-answer" id="pds-answer6"><span class="pds-answer-text">I use it every where I go, at work and home and anywhere else that I can!</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>16%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(220 votes)</span></label>
2873
+ <span class="pds-clear"></span>
2874
+ <div id="pds-answer-feedback3">
2875
+ <div style="width:16%;" id="pds-answer-feedback-bar3" class="pds-answer-feedback-bar"></div>
2876
+ </div>
2877
+ <span class="pds-clear"></span>
2878
+ </div>
2879
+
2880
+ <div class="pds-answer-group" id="pds-answer-group7">
2881
+ <label for="PDI_feedback4" class="pds-answer" id="pds-answer7"><span class="pds-answer-text">Other</span><xsl:text> </xsl:text><span class="pds-feedback-per"><strong>8%</strong></span><xsl:text> </xsl:text><span class="pds-feedback-votes">(110 votes)</span></label>
2882
+ <span class="pds-clear"></span>
2883
+ <div id="pds-answer-feedback4">
2884
+ <div style="width:8%;" id="pds-answer-feedback-bar4" class="pds-answer-feedback-bar"></div>
2885
+ </div>
2886
+ <span class="pds-clear"></span>
2887
+ </div>
2888
+
2889
+ </div>
2890
+ <!-- End divResults -->
2891
+ <span class="pds-clear"></span>
2892
+ <div style="height: 10px;"></div>
2893
+ <div id="pds-totalvotes-inner">Total Votes: <strong>1,350</strong></div>
2894
+ </div>
2895
+ <div class="pds-vote" id="pds-links-back">
2896
+ <div class="pds-totalvotes-outer">
2897
+ <span class="pds-links-back">
2898
+ <br/>
2899
+ <a href="javascript:" class="pds-link" id="pds-link1">Comments <strong>(19)</strong></a>
2900
+ <xsl:text> </xsl:text>
2901
+ <a href="javascript:renderStyleEdit('pds-box');" class="pds-link" id="pds-link2">Return To Poll</a>
2902
+ <span class="pds-clear"></span>
2903
+ </span>
2904
+ <span class="pds-clear"></span>
2905
+ </div>
2906
+ </div>
2907
+ </div>
2908
+ </div>
2909
+ </div>
2910
+ </div>
2911
+ <!-- POLL XHTML END -->
2912
+ </div>
2913
+ </td>
2914
+ </tr>
2915
+ </table>
2916
+ <div id="editBox"></div>
2917
+ <p class="pds-clear"></p>
2918
+ <?php wp_nonce_field( $style_id > 1000 ? "edit-style$style_id" : 'create-style' ); ?>
2919
+ <input type="hidden" name="action" value="<?php echo $style_id > 1000 ? 'edit-style' : 'create-style'; ?>" />
2920
+ <input type="hidden" class="polldaddy-style-id" name="style" value="<?php echo $style_id; ?>" />
2921
+ <input type="submit" class="button-primary" value="<?php echo attribute_escape( __( 'Save Style', 'polldaddy' ) ); ?>" />
2922
+ </div>
2923
+ </div>
2924
+ <textarea id="S_www" name="CSSXML" style="display:none;width: 1000px; height: 500px;" rows="10" cols="10"> </textarea>
2925
+ </form>
2926
+ <script type="text/javascript" language="javascript">window.onload = function() {
2927
+ var CSSXML;
2928
+ loadStyle();
2929
+ showResults( false );
2930
+ renderStyleEdit( _$('styleName').value );
2931
+ }</script>
2932
+ <br class="clear" />
2933
+
2934
+ <?php
2935
+ }
2936
+
2937
+ function rating_settings(){
2938
+ global $action, $rating;
2939
+ $show_posts = $show_posts_index = $show_pages = $show_comments = $pos_posts = $pos_posts_index = $pos_pages = $pos_comments = 0;
2940
+ $show_settings = $rating_updated = ( $action == 'update-rating' ? true : false );
2941
+ $error = false;
2942
+
2943
+ $settings_style = 'display: none;';
2944
+ if( $show_settings )
2945
+ $settings_style = 'display: block;';
2946
+
2947
+ if ( isset( $_POST[ 'pd_rating_action_type' ] ) ){
2948
+ switch ( $_POST[ 'pd_rating_action_type' ] ) :
2949
+
2950
+ case 'posts' :
2951
+ if ( isset( $_POST[ 'pd_show_posts' ] ) && (int) $_POST[ 'pd_show_posts' ] == 1 )
2952
+ $show_posts = get_option( 'pd-rating-posts-id' );
2953
+
2954
+ update_option( 'pd-rating-posts', $show_posts );
2955
+
2956
+ if ( isset( $_POST[ 'pd_show_posts_index' ] ) && (int) $_POST[ 'pd_show_posts_index' ] == 1 )
2957
+ $show_posts_index = get_option( 'pd-rating-posts-id' );
2958
+
2959
+ update_option( 'pd-rating-posts-index', $show_posts_index );
2960
+
2961
+ if ( isset( $_POST[ 'posts_pos' ] ) && (int) $_POST[ 'posts_pos' ] == 1 )
2962
+ $pos_posts = 1;
2963
+
2964
+ update_option( 'pd-rating-posts-pos', $pos_posts );
2965
+
2966
+ if ( isset( $_POST[ 'posts_index_pos' ] ) && (int) $_POST[ 'posts_index_pos' ] == 1 )
2967
+ $pos_posts_index = 1;
2968
+
2969
+ update_option( 'pd-rating-posts-index-pos', $pos_posts_index );
2970
+ $rating_updated = true;
2971
+ break;
2972
+
2973
+ case 'pages';
2974
+ if ( isset( $_POST[ 'pd_show_pages' ] ) && (int) $_POST[ 'pd_show_pages' ] == 1 )
2975
+ $show_pages = get_option( 'pd-rating-pages-id' );
2976
+
2977
+ update_option( 'pd-rating-pages', $show_pages );
2978
+
2979
+ if ( isset( $_POST[ 'pages_pos' ] ) && (int) $_POST[ 'pages_pos' ] == 1 )
2980
+ $pos_pages = 1;
2981
+
2982
+ update_option( 'pd-rating-pages-pos', $pos_pages );
2983
+ $rating_updated = true;
2984
+ break;
2985
+
2986
+ case 'comments':
2987
+ if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
2988
+ $show_comments = get_option( 'pd-rating-comments-id' );
2989
+
2990
+ update_option( 'pd-rating-comments', $show_comments );
2991
+ if ( isset( $_POST[ 'comments_pos' ] ) && (int) $_POST[ 'comments_pos' ] == 1 )
2992
+ $pos_comments = 1;
2993
+
2994
+ update_option( 'pd-rating-comments-pos', $pos_comments );
2995
+
2996
+ $rating_updated = true;
2997
+ break;
2998
+ endswitch;
2999
+ }
3000
+
3001
+ $show_posts = (int) get_option( 'pd-rating-posts' );
3002
+ $show_pages = (int) get_option( 'pd-rating-pages' );
3003
+ $show_comments = (int) get_option( 'pd-rating-comments' );
3004
+ $show_posts_index = (int) get_option( 'pd-rating-posts-index' );
3005
+
3006
+ $pos_posts = (int) get_option( 'pd-rating-posts-pos' );
3007
+ $pos_pages = (int) get_option( 'pd-rating-pages-pos' );
3008
+ $pos_comments = (int) get_option( 'pd-rating-comments-pos' );
3009
+ $pos_posts_index = (int) get_option( 'pd-rating-posts-index-pos' );
3010
+
3011
+ $rating_id = get_option( 'pd-rating-posts-id' );
3012
+ $report_type = 'posts';
3013
+ $updated = false;
3014
+
3015
+ if ( isset( $rating ) ) {
3016
+ switch ( $rating ) :
3017
+ case 'pages':
3018
+ $report_type = 'pages';
3019
+ $rating_id = get_option( 'pd-rating-pages-id' );
3020
+ break;
3021
+
3022
+ case 'comments':
3023
+ $report_type = 'comments';
3024
+ $rating_id = get_option( 'pd-rating-comments-id' );
3025
+ break;
3026
+
3027
+ case 'posts':
3028
+ $report_type = 'posts';
3029
+ $rating_id = get_option( 'pd-rating-posts-id' );
3030
+ break;
3031
+ endswitch;
3032
+ }
3033
+
3034
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3035
+ $polldaddy->reset();
3036
+
3037
+ $response = $polldaddy->get_rating( $rating_id );
3038
+
3039
+ if ( empty( $response ) || (int) $response->_id == 0 ) {
3040
+ $polldaddy->reset();
3041
+ $new_type = 0;
3042
+ if ( $report_type == 'comments' )
3043
+ $new_type = 1;
3044
+
3045
+ $blog_name = get_option( 'blogname' );
3046
+
3047
+ if ( empty( $blog_name ) )
3048
+ $blog_name = 'WPORG Blog';
3049
+
3050
+ $blog_name .= ' - ' . $report_type;
3051
+
3052
+ $response = $polldaddy->create_rating( $blog_name , $new_type );
3053
+ if( empty( $response ) ) {
3054
+ echo '<div class="error"><p>'.sprintf(__('Sorry! There was an error creating your rating widget. Please contact <a href="%1$s" %2$s>PollDaddy support</a> to fix this.', 'polldaddy'), 'http://polldaddy.com/feedback/', 'target="_blank"') . '</p></div>';
3055
+ $error = true;
3056
+ } else {
3057
+ $rating_id = (int) $response->_id;
3058
+ update_option ( 'pd-rating-' . $report_type . '-id', $rating_id );
3059
+ update_option ( 'pd-rating-' . $report_type, 0 );
3060
+
3061
+ switch ( $report_type ) :
3062
+ case 'posts':
3063
+ $show_posts = 0;
3064
+ break;
3065
+
3066
+ case 'pages':
3067
+ $show_pages = 0;
3068
+ break;
3069
+
3070
+ case 'comments':
3071
+ $show_comments = 0;
3072
+ break;
3073
+ endswitch;
3074
+ }
3075
+ $polldaddy->reset();
3076
+ $response = $polldaddy->get_rating( $rating_id );
3077
+ }
3078
+
3079
+ if ( !empty( $response ) ) {
3080
+ $settings_text = $response->settings;
3081
+ $settings = json_decode( $settings_text );
3082
+ $rating_type = 0;
3083
+
3084
+ if( $settings->type == 'stars' )
3085
+ $rating_type = 0;
3086
+ else
3087
+ $rating_type = 1;
3088
+
3089
+ if( empty( $settings->font_color ) )
3090
+ $settings->font_color = '#000000';
3091
+ }?>
3092
+ <div class="wrap">
3093
+ <h2><?php _e('Rating Settings', 'polldaddy'); ?></h2><?php
3094
+ if ( $rating_updated )
3095
+ echo( '<div class="updated"><p>'.__('Rating updated', 'polldaddy').'</p></div>' );
3096
+
3097
+ if ( !$error ) { ?>
3098
+ <div id="side-sortables">
3099
+ <div id="categorydiv">
3100
+ <ul id="category-tabs"><?php
3101
+ $this_class = '';
3102
+ $posts_link = clean_url( add_query_arg( array( 'rating' => 'posts', 'message' => false ) ) );
3103
+ $pages_link = clean_url( add_query_arg( array( 'rating' => 'pages', 'message' => false ) ) );
3104
+ $comments_link = clean_url( add_query_arg( array( 'rating' => 'comments', 'message' => false ) ) );
3105
+ if ( $report_type == 'posts' )
3106
+ $this_class = ' class="tabs"';?>
3107
+ <li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $posts_link; ?>"><?php _e('Posts', 'polldaddy');?></a></li><?php
3108
+ $this_class = '';
3109
+ if ( $report_type == 'pages' )
3110
+ $this_class = ' class="tabs"'; ?>
3111
+ <li <?php echo( $this_class ); ?>><a tabindex="3" href="<?php echo $pages_link; ?>"><?php _e('Pages', 'polldaddy');?></a></li><?php
3112
+ $this_class = '';
3113
+ if ( $report_type == 'comments' )
3114
+ $this_class = ' class="tabs"'; ?>
3115
+ <li <?php echo( $this_class ); ?>><a href="<?php echo $comments_link; ?>"><?php _e('Comments', 'polldaddy');?></a></li>
3116
+ </ul>
3117
+ <div class="tabs-panel" id="categories-all" style="background: #FFFFFF;height: auto; overflow: visible;">
3118
+ <form action="" method="post">
3119
+ <input type="hidden" name="pd_rating_action_type" value="<?php echo ( $report_type ); ?>" />
3120
+ <table class="form-table" style="width: normal;">
3121
+ <tbody><?php
3122
+ if ( $report_type == 'posts' ) { ?>
3123
+ <tr valign="top">
3124
+ <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3125
+ <label for="pd_show_posts">
3126
+ <input type="checkbox" name="pd_show_posts" id="pd_show_posts" <?php if( $show_posts > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for blog posts', 'polldaddy');?>
3127
+ </label>
3128
+ <span id="span_posts">
3129
+ <select name="posts_pos"><?php
3130
+ $select = array( __('Above each blog post', 'polldaddy') => '0', __('Below each blog post', 'polldaddy') => '1' );
3131
+ foreach( $select as $option => $value ) :
3132
+ $selected = '';
3133
+ if ( $value == $pos_posts )
3134
+ $selected = ' selected="selected"';
3135
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3136
+ endforeach;?>
3137
+ </select>
3138
+ </span>
3139
+ </td>
3140
+ </tr>
3141
+ <tr valign="top">
3142
+ <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3143
+ <label for="pd_show_posts_index">
3144
+ <input type="checkbox" name="pd_show_posts_index" id="pd_show_posts_index" <?php if( $show_posts_index > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for front page', 'polldaddy');?>
3145
+ </label>
3146
+ <span id="span_posts">
3147
+ <select name="posts_index_pos"><?php
3148
+ $select = array( __('Above each blog post', 'polldaddy') => '0', __('Below each blog post', 'polldaddy') => '1' );
3149
+ foreach( $select as $option => $value ) :
3150
+ $selected = '';
3151
+ if ( $value == $pos_posts_index )
3152
+ $selected = ' selected="selected"';
3153
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3154
+ endforeach;?>
3155
+ </select>
3156
+ </span>
3157
+ </td>
3158
+ </tr><?php
3159
+ }
3160
+ if ( $report_type == 'pages' ) {?>
3161
+ <tr valign="top">
3162
+ <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3163
+ <label for="pd_show_pages">
3164
+ <input type="checkbox" name="pd_show_pages" id="pd_show_pages" <?php if( $show_pages > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for pages', 'polldaddy');?>
3165
+ </label>
3166
+ <span id="span_pages">
3167
+ <select name="pages_pos"><?php
3168
+ $select = array( __('Above each page', 'polldaddy') => '0', __('Below each page', 'polldaddy') => '1' );
3169
+ foreach( $select as $option => $value ) :
3170
+ $selected = '';
3171
+ if ( $value == $pos_pages )
3172
+ $selected = ' selected="selected"';
3173
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3174
+ endforeach; ?>
3175
+ </select>
3176
+ </span>
3177
+ </td>
3178
+ </tr><?php
3179
+ }
3180
+ if ( $report_type == 'comments' ) {?>
3181
+ <tr valign="top">
3182
+ <td style="padding-left: 0px; padding-right: 0px; padding-top: 7px;">
3183
+ <label for="pd_show_comments">
3184
+ <input type="checkbox" name="pd_show_comments" id="pd_show_comments" <?php if( $show_comments > 0 ) echo( ' checked="checked" ' ); ?> value="1" /> <?php _e('Enable for comments', 'polldaddy');?>
3185
+ </label>
3186
+ <span id="span_comments">
3187
+ <select name="comments_pos"><?php
3188
+ $select = array( __('Above each comment', 'polldaddy') => '0', __('Below each comment', 'polldaddy') => '1' );
3189
+ foreach( $select as $option => $value ) :
3190
+ $selected = '';
3191
+ if ( $value == $pos_comments )
3192
+ $selected = ' selected="selected"';
3193
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3194
+ endforeach; ?>
3195
+ </select>
3196
+ </span>
3197
+ </td>
3198
+ </tr><?php
3199
+ } ?>
3200
+ </tbody>
3201
+ </table>
3202
+ <p class="submit">
3203
+ <input class="button-primary" type="submit" value="<?php esc_attr_e('Save Changes', 'polldaddy');?>" name="Submit" />
3204
+ </p><?php
3205
+ if ( $report_type == 'posts' ) {
3206
+ if( $show_posts > 0 || $show_posts_index > 0 )
3207
+ $show_settings = true;
3208
+ }
3209
+ if ( $report_type == 'pages' && $show_pages > 0 )
3210
+ $show_settings = true;
3211
+ if ( $report_type == 'comments' && $show_comments > 0 )
3212
+ $show_settings = true;
3213
+ if ( $show_settings == true )
3214
+ echo ( '<a href="javascript:" onclick="show_settings();">'.__('Advanced Settings', 'polldaddy').'</a>' );?>
3215
+ </form>
3216
+ </div>
3217
+ </div>
3218
+ </div>
3219
+
3220
+ <?php if ( $show_settings == true ){ ?>
3221
+ <br />
3222
+ <form method="post" action="">
3223
+ <div id="poststuff" style="<?php echo( $settings_style ); ?>">
3224
+ <div class="has-sidebar has-right-sidebar">
3225
+ <div class="inner-sidebar-ratings">
3226
+ <div class="postbox" id="submitdiv">
3227
+ <h3><?php _e('Save', 'polldaddy');?></h3>
3228
+ <div class="inside">
3229
+ <div id="major-publishing-actions">
3230
+ <input type="hidden" name="type" value="<?php echo( $report_type ); ?>" />
3231
+ <input type="hidden" name="rating_id" value="<?php echo( $rating_id ); ?>" />
3232
+ <input type="hidden" name="action" value="update-rating" />
3233
+ <p id="publishing-action">
3234
+ <input type="submit" value="<?php _e('Save Changes', 'polldaddy');?>" class="button-primary"/>
3235
+ </p>
3236
+ <br class="clear"/>
3237
+ </div>
3238
+ </div>
3239
+ </div>
3240
+ <div class="postbox">
3241
+ <h3><?php _e('Preview', 'polldaddy');?></h3>
3242
+ <div class="inside">
3243
+ <p><?php _e('This is a demo of what your rating widget will look like', 'polldaddy'); ?>.</p>
3244
+ <p>
3245
+ <div id="pd_rating_holder_1"></div>
3246
+ </p>
3247
+ </div>
3248
+ </div>
3249
+ <div class="postbox">
3250
+ <h3><?php _e('Customize Labels', 'polldaddy');?></h3>
3251
+ <div class="inside">
3252
+ <table>
3253
+ <tr>
3254
+ <td width="100" height="30"><?php _e('votes', 'polldaddy');?></td>
3255
+ <td><input onblur="pd_bind(this);" type="text" name="text_votes" id="text_votes" value="<?php echo( wp_specialchars( $settings->text_votes ) ); ?>" maxlength="20" />
3256
+ </tr>
3257
+ <tr>
3258
+ <td height="30"><?php _e('rate this', 'polldaddy');?></td>
3259
+ <td><input onblur="pd_bind(this);" type="text" name="text_rate_this" id="text_rate_this" value="<?php echo( wp_specialchars( $settings->text_rate_this ) ); ?>" maxlength="20" />
3260
+ </tr>
3261
+ <tr>
3262
+ <td height="30"><?php printf(__( '%d star', 'polldaddy' ), 1);?></td>
3263
+ <td><input onblur="pd_bind(this);" type="text" name="text_1_star" id="text_1_star" value="<?php echo( wp_specialchars( $settings->text_1_star ) ); ?>" maxlength="20" />
3264
+ </tr>
3265
+ <tr>
3266
+ <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 2);?></td>
3267
+ <td><input onblur="pd_bind(this);" type="text" name="text_2_star" id="text_2_star" value="<?php echo( wp_specialchars( $settings->text_2_star ) ); ?>" maxlength="20" />
3268
+ </tr>
3269
+ <tr>
3270
+ <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 3);?></td>
3271
+ <td><input onblur="pd_bind(this);" type="text" name="text_3_star" id="text_3_star" value="<?php echo( wp_specialchars( $settings->text_3_star ) ); ?>" maxlength="20" />
3272
+ </tr>
3273
+ <tr>
3274
+ <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 4);?></td>
3275
+ <td><input onblur="pd_bind(this);" type="text" name="text_4_star" id="text_4_star" value="<?php echo( wp_specialchars( $settings->text_4_star ) ); ?>" maxlength="20" />
3276
+ </tr>
3277
+ <tr>
3278
+ <td height="30"><?php printf(__( '%d stars', 'polldaddy' ), 5);?></td>
3279
+ <td><input onblur="pd_bind(this);" type="text" name="text_5_star" id="text_5_star" value="<?php echo( wp_specialchars( $settings->text_5_star ) ); ?>" maxlength="20" />
3280
+ </tr>
3281
+ <tr>
3282
+ <td height="30"><?php _e('Thank You', 'polldaddy');?></td>
3283
+ <td><input onblur="pd_bind(this);" type="text" name="text_thank_you" id="text_thank_you" value="<?php echo( wp_specialchars( $settings->text_thank_you ) ); ?>" maxlength="20" />
3284
+ </tr>
3285
+ <tr>
3286
+ <td height="30"><?php _e('Rate Up', 'polldaddy');?></td>
3287
+ <td><input onblur="pd_bind(this);" type="text" name="text_rate_up" id="text_rate_up" value="<?php echo( wp_specialchars( $settings->text_rate_up ) ); ?>" maxlength="20" />
3288
+ </tr>
3289
+ <tr>
3290
+ <td height="30"><?php _e('Rate Down', 'polldaddy');?></td>
3291
+ <td><input onblur="pd_bind(this);" type="text" name="text_rate_down" id="text_rate_down" value="<?php echo( wp_specialchars( $settings->text_rate_down ) ); ?>" maxlength="20" />
3292
+ </tr>
3293
+ </table>
3294
+ </div>
3295
+ </div>
3296
+ </div>
3297
+ <div id="post-body-content" class="has-sidebar-content">
3298
+ <div class="postbox">
3299
+ <h3><?php _e('Rating Type', 'polldaddy');?></h3>
3300
+ <div class="inside">
3301
+ <p><?php _e('Here you can choose how you want your rating to display. The 5 star rating is the most commonly used. The Nero rating is useful for keeping it simple.', 'polldaddy'); ?></p>
3302
+ <ul>
3303
+ <li style="display: inline;margin-right: 10px;">
3304
+ <label for="stars"><?php
3305
+ $checked = '';
3306
+ if ( $settings->type == 'stars' )
3307
+ $checked = ' checked="checked"';?>
3308
+ <input type="radio" onchange="pd_change_type( 0 );" <?php echo ( $checked ); ?> value="stars" id="stars" name="rating_type" />
3309
+ <?php printf(__( '%d Star Rating', 'polldaddy' ), 5);?>
3310
+ </label>
3311
+ </li>
3312
+ <li style="display: inline;">
3313
+ <label><?php
3314
+ $checked = '';
3315
+ if ( $settings->type == 'nero' )
3316
+ $checked = ' checked="checked"';?>
3317
+ <input type="radio" onchange="pd_change_type( 1 );" <?php echo( $checked ); ?> value="nero" id="nero" name="rating_type" />
3318
+ <?php _e('Nero Rating', 'polldaddy' );?>
3319
+ </label>
3320
+ </li>
3321
+ </ul>
3322
+ </div>
3323
+ </div>
3324
+ <div class="postbox">
3325
+ <h3><?php _e('Rating Style', 'polldaddy');?></h3>
3326
+ <div class="inside">
3327
+ <table>
3328
+ <tr>
3329
+ <td height="30" width="100" id="editor_star_size_text"><?php _e('Star Size', 'polldaddy');?></td>
3330
+ <td>
3331
+ <select name="size" id="size" onchange="pd_bind(this);"><?php
3332
+ $select = array( __('Small', 'polldaddy')." (16px)" => "sml", __('Medium', 'polldaddy')." (20px)" => "med", __('Large', 'polldaddy')." (24px)" => "lrg" );
3333
+ foreach ( $select as $option => $value ) :
3334
+ $selected = '';
3335
+ if ( $settings->size == $value )
3336
+ $selected = ' selected="selected"';
3337
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3338
+ endforeach;?>
3339
+ </select>
3340
+ </td>
3341
+ </tr>
3342
+ <tr>
3343
+ <td height="30" id="editor_star_color_text"><?php echo 'bubu'; _e('Star Color', 'polldaddy');?></td>
3344
+ <td>
3345
+ <select name="star_color" id="star_color" onchange="pd_bind(this);" style="display: none;"><?php
3346
+ $select = array( __('Yellow', 'polldaddy') => "yellow", __('Red', 'polldaddy') => "red", __('Blue', 'polldaddy') => "blue", __('Green', 'polldaddy') => "green", __('Grey', 'polldaddy') => "grey" );
3347
+ foreach ( $select as $option => $value ) :
3348
+ $selected = '';
3349
+ if ( $settings->star_color == $value )
3350
+ $selected = ' selected="selected"';
3351
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3352
+ endforeach;?>
3353
+ </select>
3354
+ <select name="nero_style" id="nero_style" onchange="pd_bind(this);" style="display: none;"><?php
3355
+ $select = array( __('Hand', 'polldaddy') => "hand" );
3356
+ foreach ( $select as $option => $value ) :
3357
+ $selected = '';
3358
+ if ( $settings->star_color == $value )
3359
+ $selected = ' selected="selected"';
3360
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3361
+ endforeach;?>
3362
+ </select>
3363
+ </td>
3364
+ </tr>
3365
+ <tr>
3366
+ <td height="30"><?php _e('Custom Image', 'polldaddy');?></td>
3367
+ <td><input type="text" onblur="pd_bind(this);" name="custom_star" id="custom_star" value="<?php echo( clean_url( $settings->custom_star ) ); ?>" maxlength="200" />
3368
+ </tr>
3369
+ </table>
3370
+ </div>
3371
+ </div>
3372
+ <div class="postbox">
3373
+ <h3><?php _e('Text Layout & Font', 'polldaddy');?></h3>
3374
+ <div class="inside">
3375
+ <table>
3376
+ <tr>
3377
+ <td width="100" height="30"><?php _e('Align', 'polldaddy');?></td>
3378
+ <td>
3379
+ <select id="font_align" onchange="pd_bind(this);" name="font_align"><?php
3380
+ $select = array( __('Left', 'polldaddy') => "left", __('Center', 'polldaddy') => "center", __('Right', 'polldaddy') => "right" );
3381
+ foreach( $select as $option => $value ):
3382
+ $selected = '';
3383
+ if ( $settings->font_align == $value )
3384
+ $selected = ' selected="selected"';
3385
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
3386
+ endforeach;?>
3387
+ </select>
3388
+ </td>
3389
+ </tr>
3390
+ <tr>
3391
+ <td height="30"><?php _e('Position', 'polldaddy');?></td>
3392
+ <td>
3393
+ <select name="font_position" onchange="pd_bind(this);" id="font_position"><?php
3394
+ $select = array( __('Top', 'polldaddy') => "top", __('Right', 'polldaddy') => "right", __('Bottom', 'polldaddy') => "bottom" );
3395
+ foreach( $select as $option => $value ) :
3396
+ $selected = '';
3397
+ if ( $settings->font_position == $value )
3398
+ $selected = ' selected="selected"';
3399
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>');
3400
+ endforeach;?>
3401
+ </select>
3402
+ </td>
3403
+ </tr>
3404
+ <tr>
3405
+ <td height="30"><?php _e('Font', 'polldaddy');?></td>
3406
+ <td>
3407
+ <select name="font_family" id="font_family" onchange="pd_bind(this);"><?php
3408
+ $select = array( __('Inherit', 'polldaddy') => "", "Arial" => "arial", "Comic Sans MS" => "comic sans ms", "Courier" => "courier", "Georgia" => "georgia", "Lucida Grande" => "lucida grande", "Tahoma" => "tahoma", "Times" => "times", "Trebuchet MS" => "trebuchet ms", "Verdana" => "verdana" );
3409
+ foreach( $select as $option => $value ) :
3410
+ $selected = '';
3411
+ if ( $settings->font_family == $value )
3412
+ $selected = ' selected="selected"';
3413
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' );
3414
+ endforeach;?>
3415
+ </select>
3416
+ </td>
3417
+ </tr>
3418
+ <tr>
3419
+ <td height="30"><?php _e('Color', 'polldaddy');?></td>
3420
+ <td><input type="text" onblur="pd_bind(this);" class="elmColor jscolor-picker" name="font_color" id="font_color" value="<?php echo( wp_specialchars( $settings->font_color ) ); ?>" maxlength="11" autocomplete="off"/>
3421
+ </td>
3422
+ </tr>
3423
+ <tr>
3424
+ <td><?php _e('Size', 'polldaddy');?></td>
3425
+ <td>
3426
+ <select name="font_size" id="font_size" onchange="pd_bind(this);"><?php
3427
+ $select = array( __('Inherit', 'polldaddy') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
3428
+ foreach ( $select as $option => $value ) :
3429
+ $selected = '';
3430
+ if ( $settings->font_size == $value )
3431
+ $selected = ' selected="selected"';
3432
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3433
+ endforeach;?>
3434
+ </select>
3435
+ </td>
3436
+ </tr>
3437
+ <tr>
3438
+ <td height="30"><?php _e('Line Height', 'polldaddy');?></td>
3439
+ <td>
3440
+ <select name="font_line_height" id="font_line_height" onchange="pd_bind(this);"><?php
3441
+ $select = array( __('Inherit', 'polldaddy') => "", "6px" => "6px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "14px" => "14px", "16px" => "16px", "18px" => "18px", "20px" => "20px", "24px" => "24px", "30px" => "30px", "36px" => "36px", );
3442
+ foreach ( $select as $option => $value ) :
3443
+ $selected = '';
3444
+ if ( $settings->font_line_height == $value )
3445
+ $selected = ' selected="selected"';
3446
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3447
+ endforeach; ?>
3448
+ </select>
3449
+ </td>
3450
+ </tr>
3451
+ <tr>
3452
+ <td height="30"><?php _e('Bold', 'polldaddy');?></td>
3453
+ <td><?php
3454
+ $checked = '';
3455
+ if ( $settings->font_bold == 'bold' )
3456
+ $checked = ' checked="checked"';?>
3457
+ <input type="checkbox" name="font_bold" onclick="pd_bind(this);" id="font_bold" value="bold" <?php echo( $checked ); ?> />
3458
+ </td>
3459
+ </tr>
3460
+ <tr>
3461
+ <td height="30"><?php _e('Italic', 'polldaddy');?></td><?php
3462
+ $checked = '';
3463
+ if( $settings->font_italic == 'italic' )
3464
+ $checked = ' checked="checked"';?>
3465
+ <td><input type="checkbox" name="font_italic" onclick="pd_bind(this);" id="font_italic" value="italic" <?php echo( $checked ); ?>/></td>
3466
+ </tr>
3467
+ </table>
3468
+ </div>
3469
+ </div>
3470
+ </div>
3471
+ </div>
3472
+ </form>
3473
+ <script type="text/javascript">
3474
+ PDRTJS_settings = <?php echo ( $settings_text ); ?>;
3475
+ PDRTJS_settings.id = "1";
3476
+ PDRTJS_settings.unique_id = "xxx";
3477
+ PDRTJS_settings.title = "";
3478
+ PDRTJS_settings.override = "<?php echo( $rating_id ); ?>";
3479
+ PDRTJS_settings.permalink = "";
3480
+ PDRTJS_1 = new PDRTJS_RATING( PDRTJS_settings );
3481
+ pd_change_type( <?php echo ( $rating_type ) ?> );
3482
+ </script><?php
3483
+ } ?>
3484
+ </div><?php
3485
+ } // from if !error ?>
3486
+ </div><?php
3487
+ }
3488
+
3489
+ function update_rating(){
3490
+ $rating_type = 0;
3491
+ $rating_id = 0;
3492
+ $set = null;
3493
+
3494
+ if( isset( $_REQUEST['rating_id'] ) )
3495
+ $rating_id = (int) $_REQUEST['rating_id'];
3496
+
3497
+ if( isset( $_REQUEST['rating_type'] ) && $_REQUEST['rating_type'] == 'stars' ) {
3498
+ $set->type = 'stars';
3499
+ $rating_type = 0;
3500
+ if( isset( $_REQUEST['star_color'] ) )
3501
+ $set->star_color = attribute_escape( $_REQUEST['star_color'] );
3502
+ } else {
3503
+ $set->type = 'nero';
3504
+ $rating_type = 1;
3505
+ if( isset( $_REQUEST['nero_style'] ) )
3506
+ $set->star_color = attribute_escape( $_REQUEST['nero_style'] );
3507
+ }
3508
+
3509
+ $set->size = wp_specialchars( $_REQUEST['size'], 1 );
3510
+ $set->custom_star = wp_specialchars( clean_url( $_REQUEST['custom_star'] ) , 1 );
3511
+ $set->font_align = wp_specialchars( $_REQUEST['font_align'], 1 );
3512
+ $set->font_position = wp_specialchars( $_REQUEST['font_position'], 1 );
3513
+ $set->font_family = wp_specialchars( $_REQUEST['font_family'], 1);
3514
+ $set->font_size = wp_specialchars( $_REQUEST['font_size'], 1 );
3515
+ $set->font_line_height = wp_specialchars( $_REQUEST['font_line_height'], 1 );
3516
+
3517
+ if ( isset( $_REQUEST['font_bold'] ) && $_REQUEST['font_bold'] == 'bold' )
3518
+ $set->font_bold = 'bold';
3519
+ else
3520
+ $set->font_bold = 'normal';
3521
+
3522
+ if ( isset( $_REQUEST['font_italic'] ) && $_REQUEST['font_italic'] == 'italic' )
3523
+ $set->font_italic = 'italic';
3524
+ else
3525
+ $set->font_italic = 'normal';
3526
+
3527
+ $set->text_votes = wp_specialchars( $_REQUEST['text_votes'], 1 );
3528
+ $set->text_rate_this = wp_specialchars( $_REQUEST['text_rate_this'], 1 );
3529
+ $set->text_1_star = wp_specialchars( $_REQUEST['text_1_star'], 1 );
3530
+ $set->text_2_star = wp_specialchars( $_REQUEST['text_2_star'], 1 );
3531
+ $set->text_3_star = wp_specialchars( $_REQUEST['text_3_star'], 1 );
3532
+ $set->text_4_star = wp_specialchars( $_REQUEST['text_4_star'], 1 );
3533
+ $set->text_5_star = wp_specialchars( $_REQUEST['text_5_star'], 1 );
3534
+ $set->text_thank_you = wp_specialchars( $_REQUEST['text_thank_you'], 1 );
3535
+ $set->text_rate_up = wp_specialchars( $_REQUEST['text_rate_up'], 1 );
3536
+ $set->text_rate_down = wp_specialchars( $_REQUEST['text_rate_down'], 1 );
3537
+ $set->font_color = wp_specialchars( $_REQUEST['font_color'], 1 );
3538
+
3539
+ $settings_text = json_encode( $set );
3540
+
3541
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3542
+ $polldaddy->reset();
3543
+ $response = $polldaddy->update_rating( $rating_id, $settings_text, $rating_type );
3544
+ }
3545
+ function rating_reports() {
3546
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3547
+ $rating_id = get_option( 'pd-rating-posts-id' );
3548
+
3549
+ $report_type = 'posts';
3550
+ $period = '7';
3551
+ $show_rating = 0;
3552
+
3553
+ if ( isset( $_REQUEST['rating'] ) ){
3554
+ switch ( $_REQUEST['rating'] ) :
3555
+ case 'pages':
3556
+ $report_type = 'pages';
3557
+ $rating_id = (int) get_option( 'pd-rating-pages-id' );
3558
+ break;
3559
+
3560
+ case 'comments':
3561
+ $report_type = 'comments';
3562
+ $rating_id = get_option( 'pd-rating-comments-id' );
3563
+ break;
3564
+
3565
+ case 'posts':
3566
+ $report_type = 'posts';
3567
+ $rating_id = get_option( 'pd-rating-posts-id' );
3568
+ break;
3569
+ endswitch;
3570
+ }
3571
+
3572
+ if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] ){
3573
+ switch ( $_REQUEST['filter'] ) :
3574
+ case '1':
3575
+ $period = '1';
3576
+ break;
3577
+
3578
+ case '7':
3579
+ $period = '7';
3580
+ break;
3581
+
3582
+ case '31':
3583
+ $period = '31';
3584
+ break;
3585
+
3586
+ case '90':
3587
+ $period = '90';
3588
+ break;
3589
+
3590
+ case '365':
3591
+ $period = '365';
3592
+ break;
3593
+
3594
+ case 'all':
3595
+ $period = 'all';
3596
+ break;
3597
+ endswitch;
3598
+ }
3599
+
3600
+ $page_size = 15;
3601
+ $current_page = 1;
3602
+
3603
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'change-report' ){
3604
+ $current_page = 1;
3605
+ } else {
3606
+ if ( isset( $_REQUEST['paged'] ) ) {
3607
+ $current_page = (int) $_REQUEST['paged'];
3608
+ if ( $current_page == 0 )
3609
+ $current_page = 1;
3610
+ }
3611
+ }
3612
+
3613
+ $start = ( $current_page * $page_size ) - $page_size;
3614
+ $end = $page_size;
3615
+
3616
+ $response = $polldaddy->get_rating_results( $rating_id, $period, $start, $end );
3617
+
3618
+ $total = $total_pages = 0;
3619
+ $ratings = null;
3620
+
3621
+ if( !empty($response) ){
3622
+ $ratings = $response->rating;
3623
+ $total = (int) $response->_total;
3624
+ $total_pages = ceil( $total / $page_size );
3625
+ }
3626
+
3627
+ $page_links = paginate_links( array(
3628
+ 'base' => add_query_arg( array ('paged' => '%#%', 'rating' => $report_type, 'filter' => $period ) ),
3629
+ 'format' => '',
3630
+ 'prev_text' => __('&laquo;', 'polldaddy'),
3631
+ 'next_text' => __('&raquo;', 'polldaddy'),
3632
+ 'total' => $total_pages,
3633
+ 'current' => $current_page
3634
+ ));
3635
+ ?>
3636
+ <div class="wrap">
3637
+ <h2><?php _e('Rating Reports', 'polldaddy');?> <span style="font-size: 16px;">(<?php echo ( $report_type ); ?>)</span></h2>
3638
+ <div class="clear"></div>
3639
+ <form method="post" action="">
3640
+ <div class="tablenav">
3641
+ <div class="alignleft">
3642
+ <select name="rating"><?php
3643
+ $select = array( __('Posts', 'polldaddy') => "posts", __('Pages', 'polldaddy') => "pages", __('Comments', 'polldaddy') => "comments" );
3644
+ foreach ( $select as $option => $value ) :
3645
+ $selected = '';
3646
+ if ( $value == $report_type )
3647
+ $selected = ' selected="selected"';
3648
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3649
+ endforeach; ?>
3650
+ </select>
3651
+ <input type="hidden" name="action" value="change-report" />
3652
+ <input class="button-secondary action" type="submit" value="<?php esc_attr_e('View Report', 'polldaddy');?>" />
3653
+ <select name="filter"><?php
3654
+ $select = array( __('Last 24 hours', 'polldaddy') => "1", __('Last 7 days', 'polldaddy') => "7", __('Last 31 days', 'polldaddy') => "31", __('Last 3 months', 'polldaddy') => "90", __('Last 12 months', 'polldaddy') => "365", __('All time', 'polldaddy') => "all" );
3655
+ foreach ( $select as $option => $value ) :
3656
+ $selected = '';
3657
+ if ( $value == $period )
3658
+ $selected = ' selected="selected"';
3659
+ echo ( '<option value="' . $value . '" ' . $selected . '>' . $option . '</option>' . "\n" );
3660
+ endforeach; ?>
3661
+ </select>
3662
+ <input class="button-secondary action" type="submit" value="<?php _e('Filter Report', 'polldaddy');?>" />
3663
+ </div>
3664
+ <div class="alignright">
3665
+ <div class="tablenav-pages">
3666
+ <?php echo( $page_links ); ?>
3667
+ </div>
3668
+ </div>
3669
+ </div>
3670
+ </form>
3671
+
3672
+ <table class="widefat"><?php
3673
+ if ( count( $ratings ) == 0 ) { ?>
3674
+ <tbody>
3675
+ <tr>
3676
+ <td colspan="4"><?php printf(__('No ratings have been collected for your %s yet.', 'polldaddy'), $report_type); ?></td>
3677
+ </tr>
3678
+ </tbody><?php
3679
+ } else { ?>
3680
+ <thead>
3681
+ <tr>
3682
+ <th><?php _e('Start Date', 'polldaddy');?></th>
3683
+ <th><?php _e('Title', 'polldaddy');?></th>
3684
+ <th><?php _e('Votes', 'polldaddy');?></th>
3685
+ <th style="width: 120px;"><?php _e('Average Rating', 'polldaddy');?></th>
3686
+ </tr>
3687
+ </thead><?php
3688
+ echo ( '<tbody>' );
3689
+ $alt_counter = 0;
3690
+ $alt = '';
3691
+
3692
+ foreach ( $ratings as $rating ) :
3693
+ $alt_counter++;
3694
+
3695
+ if ( ( $alt_counter % 2 ) == 0 )
3696
+ $alt = ' class="alternate"';
3697
+ else
3698
+ $alt = ''; ?>
3699
+ <tr <?php echo( $alt ); ?>>
3700
+ <td>
3701
+ <?php echo( str_replace( '-', '/', substr( wp_specialchars( $rating->date ), 0, 10 ) ) ); ?><br/>
3702
+ <?php echo( wp_specialchars( $rating->uid ) ); ?>
3703
+ </td>
3704
+ <td>
3705
+ <?php echo( wp_specialchars( $rating->title ) ); ?>
3706
+ <br />
3707
+ <a href="<?php echo( clean_url( $rating->permalink ) ); ?>" target="_blank"><?php echo( clean_url( $rating->permalink ) ); ?></a>
3708
+ </td>
3709
+ <td style="padding-top: 10px; font-weight: bold;"><?php echo( number_format( $rating->_votes ) ); ?></td>
3710
+ <td style="padding-top: 10px;"><?php
3711
+ if ( $rating->_type == 0 ) {
3712
+ $avg_rating = $this->round( $rating->average_rating, 0.5 );
3713
+
3714
+ echo ( '<div>' );
3715
+ $image_pos = '';
3716
+
3717
+ for ( $c = 1; $c <= 5; $c++ ){
3718
+ if ( $avg_rating > 0 ){
3719
+ if ( $avg_rating < $c ){
3720
+ $image_pos = 'bottom left';
3721
+ }
3722
+ if ( $avg_rating == ( $c - 1 + 0.5 ) ){
3723
+ $image_pos = 'center left';
3724
+ }
3725
+ }
3726
+ echo ('<div style="width: 20px; height: 20px; background: url(http://i.polldaddy.com/ratings/images/star-yellow-med.png) ' . $image_pos . '; float: left;"></div>' );
3727
+ }
3728
+ echo ( '<br class="clear" /></div>' );
3729
+ } else {
3730
+ echo ( '<div>' );
3731
+ echo ( '<div style="margin: 0px 0px 0px 20px; background: transparent url(http://i.polldaddy.com/images/rate-graph-up.png); width: 20px; height: 20px; float: left;"></div>' );
3732
+ echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format ( $rating->total1 ) . '</div>' );
3733
+ echo ( '<div style="margin: 0px; background: transparent url(http://i.polldaddy.com/images/rate-graph-dn.png); width: 20px; height: 20px; float: left;"></div>' );
3734
+ echo ( '<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;">' . number_format( $rating->total2 ) . '</div>' );
3735
+ echo ( '<br class="clear" /></div>' );
3736
+ } ?>
3737
+ </td>
3738
+ </tr><?php
3739
+ endforeach;
3740
+ echo ( '</tbody>' );
3741
+ } ?>
3742
+ </table>
3743
+ <div class="tablenav">
3744
+ <div class="alignright">
3745
+ <div class="tablenav-pages">
3746
+ <?php echo( $page_links ); ?>
3747
+ </div>
3748
+ </div>
3749
+ </div>
3750
+ </div>
3751
+ <p></p><?php
3752
+ }
3753
+
3754
+ function plugin_options() {
3755
+ if ( isset( $_POST['polldaddy_email'] ) ){
3756
+ $account_email = attribute_escape( $_POST['polldaddy_email'] );
3757
+ }
3758
+ else{
3759
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
3760
+ $account = $polldaddy->get_account();
3761
+
3762
+ if( !empty($account) )
3763
+ $account_email = attribute_escape( $account->email );
3764
+
3765
+ $polldaddy->reset();
3766
+ $poll = $polldaddy->get_poll( 1 );
3767
+
3768
+ $options = array(
3769
+ 101 => 'Aluminum Narrow',
3770
+ 102 => 'Aluminum Medium',
3771
+ 103 => 'Aluminum Wide',
3772
+ 104 => 'Plain White Narrow',
3773
+ 105 => 'Plain White Medium',
3774
+ 106 => 'Plain White Wide',
3775
+ 107 => 'Plain Black Narrow',
3776
+ 108 => 'Plain Black Medium',
3777
+ 109 => 'Plain Black Wide',
3778
+ 110 => 'Paper Narrow',
3779
+ 111 => 'Paper Medium',
3780
+ 112 => 'Paper Wide',
3781
+ 113 => 'Skull Dark Narrow',
3782
+ 114 => 'Skull Dark Medium',
3783
+ 115 => 'Skull Dark Wide',
3784
+ 116 => 'Skull Light Narrow',
3785
+ 117 => 'Skull Light Medium',
3786
+ 118 => 'Skull Light Wide',
3787
+ 157 => 'Micro',
3788
+ 119 => 'Plastic White Narrow',
3789
+ 120 => 'Plastic White Medium',
3790
+ 121 => 'Plastic White Wide',
3791
+ 122 => 'Plastic Grey Narrow',
3792
+ 123 => 'Plastic Grey Medium',
3793
+ 124 => 'Plastic Grey Wide',
3794
+ 125 => 'Plastic Black Narrow',
3795
+ 126 => 'Plastic Black Medium',
3796
+ 127 => 'Plastic Black Wide',
3797
+ 128 => 'Manga Narrow',
3798
+ 129 => 'Manga Medium',
3799
+ 130 => 'Manga Wide',
3800
+ 131 => 'Tech Dark Narrow',
3801
+ 132 => 'Tech Dark Medium',
3802
+ 133 => 'Tech Dark Wide',
3803
+ 134 => 'Tech Grey Narrow',
3804
+ 135 => 'Tech Grey Medium',
3805
+ 136 => 'Tech Grey Wide',
3806
+ 137 => 'Tech Light Narrow',
3807
+ 138 => 'Tech Light Medium',
3808
+ 139 => 'Tech Light Wide',
3809
+ 140 => 'Working Male Narrow',
3810
+ 141 => 'Working Male Medium',
3811
+ 142 => 'Working Male Wide',
3812
+ 143 => 'Working Female Narrow',
3813
+ 144 => 'Working Female Medium',
3814
+ 145 => 'Working Female Wide',
3815
+ 146 => 'Thinking Male Narrow',
3816
+ 147 => 'Thinking Male Medium',
3817
+ 148 => 'Thinking Male Wide',
3818
+ 149 => 'Thinking Female Narrow',
3819
+ 150 => 'Thinking Female Medium',
3820
+ 151 => 'Thinking Female Wide',
3821
+ 152 => 'Sunset Narrow',
3822
+ 153 => 'Sunset Medium',
3823
+ 154 => 'Sunset Wide',
3824
+ 155 => 'Music Medium',
3825
+ 156 => 'Music Wide'
3826
+ );
3827
+
3828
+ $polldaddy->reset();
3829
+ $styles = $polldaddy->get_styles();
3830
+
3831
+ if( !empty( $styles ) && !empty( $styles->style ) && count( $styles->style ) > 0 ){
3832
+ foreach( (array) $styles->style as $style ){
3833
+ $options[ (int) $style->_id ] = $style->title;
3834
+ }
3835
+ }
3836
+ }
3837
+ $this->print_errors();
3838
+ ?>
3839
+ <div id="options-page" class="wrap">
3840
+ <div class="icon32" id="icon-options-general"><br/></div>
3841
+ <h2>
3842
+ <?php _e( 'Options', 'polldaddy' ); ?>
3843
+ </h2>
3844
+ <?php if( $this->is_admin || $this->multiple_accounts ) {?>
3845
+ <h3>
3846
+ <?php _e( 'PollDaddy Account Info', 'polldaddy' ); ?>
3847
+ </h3>
3848
+ <p>
3849
+ <?php _e( 'This is the PollDadddy account you currently have imported into your WordPress account', 'polldaddy' ); ?>.
3850
+ </p>
3851
+ <form action="" method="post">
3852
+ <table class="form-table">
3853
+ <tbody>
3854
+ <tr class="form-field form-required">
3855
+ <th valign="top" scope="row">
3856
+ <label for="polldaddy-email">
3857
+ <?php _e( 'PollDaddy Email Address', 'polldaddy' ); ?>
3858
+ </label>
3859
+ </th>
3860
+ <td>
3861
+ <input type="text" name="polldaddy_email" id="polldaddy-email" aria-required="true" size="40" value="<?php echo $account_email; ?>" />
3862
+ </td>
3863
+ </tr>
3864
+ <tr class="form-field form-required">
3865
+ <th valign="top" scope="row">
3866
+ <label for="polldaddy-password">
3867
+ <?php _e( 'PollDaddy Password', 'polldaddy' ); ?>
3868
+ </label>
3869
+ </th>
3870
+ <td>
3871
+ <input type="password" name="polldaddy_password" id="polldaddy-password" aria-required="true" size="40" />
3872
+ </td>
3873
+ </tr>
3874
+ </tbody>
3875
+ </table>
3876
+ <p class="submit">
3877
+ <?php wp_nonce_field( 'polldaddy-account' ); ?>
3878
+ <input type="hidden" name="action" value="import-account" />
3879
+ <input type="hidden" name="account" value="import" />
3880
+ <input type="submit" value="<?php echo attribute_escape( __( 'Import Account', 'polldaddy' ) ); ?>" />
3881
+ </p>
3882
+ </form>
3883
+ <br />
3884
+ <?php } ?>
3885
+ <h3>
3886
+ <?php _e( 'General Settings', 'polldaddy' ); ?>
3887
+ </h3>
3888
+ <form action="" method="post">
3889
+ <table class="form-table">
3890
+ <tbody>
3891
+ <tr valign="top">
3892
+ <th valign="top" scope="row">
3893
+ <label>
3894
+ <?php _e( 'Default poll settings', 'polldaddy' ); ?>
3895
+ </label>
3896
+ </th>
3897
+ <td>
3898
+ <fieldset>
3899
+ <legend class="screen-reader-text"><span>poll-defaults</span></legend><?php
3900
+ $selected = '';
3901
+ if ( $poll->multipleChoice == 'yes' )
3902
+ $selected = 'checked="checked"';?>
3903
+ <label for="multipleChoice"><input type="checkbox" <?php echo $selected; ?> value="1" id="multipleChoice" name="multipleChoice"> <?php _e( 'Multiple Choice', 'polldaddy' ); ?></label>
3904
+ <br /><?php
3905
+ $selected = '';
3906
+ if ( $poll->randomiseAnswers == 'yes' )
3907
+ $selected = 'checked="checked"';?>
3908
+ <label for="randomiseAnswers"><input type="checkbox" <?php echo $selected; ?> value="1" id="randomiseAnswers" name="randomiseAnswers"> <?php _e( 'Randomise Answers', 'polldaddy' ); ?></label>
3909
+ <br /><?php
3910
+ $selected = '';
3911
+ if ( $poll->otherAnswer == 'yes' )
3912
+ $selected = 'checked="checked"';?>
3913
+ <label for="otherAnswer"><input type="checkbox" <?php echo $selected; ?> value="1" id="otherAnswer" name="otherAnswer"> <?php _e( 'Other Answer', 'polldaddy' ); ?></label>
3914
+ <br /><?php
3915
+ $selected = '';
3916
+ if ( $poll->sharing == 'yes' )
3917
+ $selected = 'checked="checked"';?>
3918
+ <label for="sharing"><input type="checkbox" <?php echo $selected; ?> value="1" id="sharing" name="sharing"> <?php _e( 'Sharing', 'polldaddy' ); ?></label>
3919
+ <br />
3920
+ <label for="resultsType">
3921
+ <select id="resultsType" name="resultsType">
3922
+ <option <?php echo $poll->resultsType == 'show' ? 'selected="selected"':''; ?> value="show"><?php _e('Show', 'polldaddy'); ?></option>
3923
+ <option <?php echo $poll->resultsType == 'hide' ? 'selected="selected"':''; ?> value="hide"><?php _e('Hide', 'polldaddy'); ?></option>
3924
+ <option <?php echo $poll->resultsType == 'percent' ? 'selected="selected"':''; ?> value="percent"><?php _e('Percentages', 'polldaddy'); ?></option>
3925
+ </select> <?php _e( 'Poll results', 'polldaddy' ); ?>
3926
+ </label>
3927
+ <br />
3928
+ <label for="styleID">
3929
+ <select id="styleID" name="styleID"><?php
3930
+ foreach ( (array) $options as $styleID => $label ) :
3931
+ $selected = $styleID == $poll->styleID ? ' selected="selected"' : ''; ?>
3932
+ <option value="<?php echo (int) $styleID; ?>"<?php echo $selected; ?>><?php echo wp_specialchars( $label ); ?></option><?php
3933
+ endforeach;?>
3934
+ </select> <?php _e( 'Poll style', 'polldaddy' ); ?>
3935
+ </label>
3936
+ <br />
3937
+ <label for="blockRepeatVotersType">
3938
+ <select id="poll-block-repeat" name="blockRepeatVotersType">
3939
+ <option <?php echo $poll->blockRepeatVotersType == 'off' ? 'selected="selected"':''; ?> value="off"><?php _e('Off', 'polldaddy'); ?></option>
3940
+ <option <?php echo $poll->blockRepeatVotersType == 'cookie' ? 'selected="selected"':''; ?> value="cookie"><?php _e('Cookie', 'polldaddy'); ?></option>
3941
+ <option <?php echo $poll->blockRepeatVotersType == 'cookieip' ? 'selected="selected"':''; ?> value="cookieip"><?php _e('Cookie & IP address', 'polldaddy'); ?></option>
3942
+ </select> <?php _e( 'Block repeat voters', 'polldaddy' ); ?>
3943
+ </label>
3944
+ <br />
3945
+ <label for="blockExpiration">
3946
+ <select id="blockExpiration" name="blockExpiration">
3947
+ <option value="0" <?php echo $poll->blockExpiration == 0 ? 'selected="selected"':''; ?>><?php _e('Never', 'polldaddy'); ?></option>
3948
+ <option value="3600" <?php echo $poll->blockExpiration == 3600 ? 'selected="selected"':''; ?>><?php printf( __('%d hour', 'polldaddy'), 1 ); ?></option>
3949
+ <option value="10800" <?php echo (int) $poll->blockExpiration == 10800 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 3 ); ?></option>
3950
+ <option value="21600" <?php echo (int) $poll->blockExpiration == 21600 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 6 ); ?></option>
3951
+ <option value="43200" <?php echo (int) $poll->blockExpiration == 43200 ? 'selected="selected"' : ''; ?>><?php printf( __('%d hours', 'polldaddy'), 12 ); ?></option>
3952
+ <option value="86400" <?php echo (int) $poll->blockExpiration == 86400 ? 'selected="selected"' : ''; ?>><?php printf( __('%d day', 'polldaddy'), 1 ); ?></option>
3953
+ <option value="604800" <?php echo (int) $poll->blockExpiration == 604800 ? 'selected="selected"' : ''; ?>><?php printf( __('%d week', 'polldaddy'), 1 ); ?></option>
3954
+ <option value="2419200" <?php echo (int) $poll->blockExpiration == 2419200 ? 'selected="selected"' : ''; ?>><?php printf( __('%d month', 'polldaddy'), 1 ); ?></option>
3955
+ </select> <?php _e( 'Block expiration limit', 'polldaddy' ); ?>
3956
+ </label>
3957
+ <br />
3958
+ </fieldset>
3959
+ </td>
3960
+ </tr>
3961
+ <?php $this->plugin_options_add(); ?>
3962
+ </tbody>
3963
+ </table>
3964
+ <p class="submit">
3965
+ <?php wp_nonce_field( 'polldaddy-account' ); ?>
3966
+ <input type="hidden" name="action" value="update-options" />
3967
+ <input type="submit" value="<?php echo attribute_escape( __( 'Save Options', 'polldaddy' ) ); ?>" />
3968
+ </p>
3969
+ </form>
3970
+ </div>
3971
+ <?php
3972
+ }
3973
+
3974
+ function plugin_options_add(){}
3975
+
3976
+ function round($number, $increments) {
3977
+ $increments = 1 / $increments;
3978
+ return ( round ( $number * $increments ) / $increments );
3979
+ }
3980
+
3981
+ function signup() {
3982
+ return $this->api_key_page();
3983
+ }
3984
+
3985
+ function can_edit( &$poll ) {
3986
+ if ( empty( $poll->_owner ) )
3987
+ return true;
3988
+
3989
+ if ( $this->id == $poll->_owner )
3990
+ return true;
3991
+
3992
+ return (bool) current_user_can( 'edit_others_posts' );
3993
+ }
3994
+ }
3995
+
3996
+ require 'rating.php';
3997
+ require 'polldaddy-org.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
polldaddy.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Translation of the WordPress plugin PollDaddy Polls 1.7.8 by Automattic, Inc..
2
  # Copyright (C) 2010 Automattic, Inc.
3
  # This file is distributed under the same license as the PollDaddy Polls package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: PollDaddy Polls 1.7.8\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/polldaddy\n"
11
- "POT-Creation-Date: 2010-01-26 15:25+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,571 +17,614 @@ msgstr ""
17
  "Content-Transfer-Encoding: 8bit\n"
18
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
 
20
- #: polldaddy.php:66 polldaddy.php:68 polldaddy.php:84 polldaddy.php:86
21
- msgid "Ratings"
22
  msgstr ""
23
 
24
- #: polldaddy.php:73 polldaddy.php:75 polldaddy.php:91 polldaddy.php:93
25
- #: polldaddy.php:105 polldaddy.php:1096
26
- msgid "Polls"
27
  msgstr ""
28
 
29
- #: polldaddy.php:98
30
- msgid "Ratings &ndash; Settings"
31
  msgstr ""
32
 
33
- #: polldaddy.php:98
34
- msgid "Settings"
35
  msgstr ""
36
 
37
- #: polldaddy.php:99 polldaddy.php:102
38
- msgid "Ratings &ndash; Reports"
 
39
  msgstr ""
40
 
41
- #: polldaddy.php:99 polldaddy.php:102
42
- msgid "Reports"
 
 
43
  msgstr ""
44
 
45
- #: polldaddy.php:105 polldaddy.php:1228 polldaddy.php:2005
46
- msgid "Edit"
 
 
47
  msgstr ""
48
 
49
- #: polldaddy.php:108
50
- msgid "Add New Poll"
 
51
  msgstr ""
52
 
53
- #: polldaddy.php:108
54
- msgid "Add New"
55
  msgstr ""
56
 
57
- #: polldaddy.php:109 polldaddy.php:1061 polldaddy.php:1734
58
- msgid "Custom Styles"
 
 
 
59
  msgstr ""
60
 
61
- #: polldaddy.php:110 polldaddy.php:3900
62
- msgid "Options"
63
  msgstr ""
64
 
65
- #: polldaddy.php:126 polldaddy.php:887
66
- msgid "Email address required"
67
  msgstr ""
68
 
69
- #: polldaddy.php:129 polldaddy.php:890
70
- msgid "Password required"
71
  msgstr ""
72
 
73
- #: polldaddy.php:159
74
- msgid "Can't connect to PollDaddy.com"
 
 
75
  msgstr ""
76
 
77
- #: polldaddy.php:186
78
- msgid "Invalid Account"
79
  msgstr ""
80
 
81
- #: polldaddy.php:196
82
- msgid ""
83
- "Account could not be accessed. Are your email address and password correct?"
84
  msgstr ""
85
 
86
- #: polldaddy.php:208
87
- #, php-format
88
- msgid ""
89
- "Obsolete PollDaddy User API Key: <a href=\"%s\">Sign in again to re-"
90
- "authenticate</a>"
91
  msgstr ""
92
 
93
- #: polldaddy.php:247
94
- msgid "PollDaddy Account"
95
  msgstr ""
96
 
97
- #: polldaddy.php:249
98
- #, php-format
99
- msgid ""
100
- "Before you can use the PollDaddy plugin, you need to enter your <a href=\"%s"
101
- "\">PollDaddy.com</a> account details."
102
  msgstr ""
103
 
104
- #: polldaddy.php:256 polldaddy.php:3914
105
- msgid "PollDaddy Email Address"
 
106
  msgstr ""
107
 
108
- #: polldaddy.php:264 polldaddy.php:3924
109
- msgid "PollDaddy Password"
110
  msgstr ""
111
 
112
- #: polldaddy.php:276
113
- msgid "Submit"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  msgstr ""
115
 
116
- #: polldaddy.php:285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  msgid "Add Poll"
118
  msgstr ""
119
 
120
- #: polldaddy.php:355
121
  msgid "Star Colors"
122
  msgstr ""
123
 
124
- #: polldaddy.php:355 polldaddy.php:3340
125
  msgid "Star Size"
126
  msgstr ""
127
 
128
- #: polldaddy.php:356
129
  msgid "Nero Type"
130
  msgstr ""
131
 
132
- #: polldaddy.php:356
133
  msgid "Nero Size"
134
  msgstr ""
135
 
136
- #: polldaddy.php:447
137
  msgid "You are not allowed to delete this poll."
138
  msgstr ""
139
 
140
- #: polldaddy.php:455 polldaddy.php:491 polldaddy.php:527 polldaddy.php:561
141
  msgid "Invalid Poll Author"
142
  msgstr ""
143
 
144
- #: polldaddy.php:483
145
  msgid "You are not allowed to open this poll."
146
  msgstr ""
147
 
148
- #: polldaddy.php:519
149
  msgid "You are not allowed to close this poll."
150
  msgstr ""
151
 
152
- #: polldaddy.php:552 polldaddy.php:1324
153
  msgid "You are not allowed to edit this poll."
154
  msgstr ""
155
 
156
- #: polldaddy.php:568
157
  msgid "Poll not found"
158
  msgstr ""
159
 
160
- #: polldaddy.php:595
161
  msgid "Invalid answers"
162
  msgstr ""
163
 
164
- #: polldaddy.php:611
165
  msgid "You must include at least 2 answers"
166
  msgstr ""
167
 
168
- #: polldaddy.php:622 polldaddy.php:699
169
  msgid "Please choose a poll style"
170
  msgstr ""
171
 
172
- #: polldaddy.php:644
173
  msgid "Poll could not be updated"
174
  msgstr ""
175
 
176
- #: polldaddy.php:718
177
  msgid "Poll could not be created"
178
  msgstr ""
179
 
180
- #: polldaddy.php:770
181
  msgid "Style could not be updated"
182
  msgstr ""
183
 
184
- #: polldaddy.php:800
185
  msgid "Style could not be created"
186
  msgstr ""
187
 
188
- #: polldaddy.php:899
189
  msgid ""
190
  "Account could not be imported. Are your email address and password correct?"
191
  msgstr ""
192
 
193
- #: polldaddy.php:917
194
  msgid "Poll deleted."
195
  msgstr ""
196
 
197
- #: polldaddy.php:919
198
  #, php-format
199
  msgid "%s Poll Deleted."
200
  msgid_plural "%s Polls Deleted."
201
  msgstr[0] ""
202
  msgstr[1] ""
203
 
204
- #: polldaddy.php:924
205
  msgid "Poll opened."
206
  msgstr ""
207
 
208
- #: polldaddy.php:926
209
  #, php-format
210
  msgid "%s Poll Opened."
211
  msgid_plural "%s Polls Opened."
212
  msgstr[0] ""
213
  msgstr[1] ""
214
 
215
- #: polldaddy.php:931
216
  msgid "Poll closed."
217
  msgstr ""
218
 
219
- #: polldaddy.php:933
220
  #, php-format
221
  msgid "%s Poll Closed."
222
  msgid_plural "%s Polls Closed."
223
  msgstr[0] ""
224
  msgstr[1] ""
225
 
226
- #: polldaddy.php:936
227
  msgid "Poll updated."
228
  msgstr ""
229
 
230
- #: polldaddy.php:939
231
  msgid "Poll created."
232
  msgstr ""
233
 
234
- #: polldaddy.php:941 polldaddy.php:1357
235
  msgid "Send to Editor"
236
  msgstr ""
237
 
238
- #: polldaddy.php:944
239
  msgid "Custom Style updated."
240
  msgstr ""
241
 
242
- #: polldaddy.php:947
243
  msgid "Custom Style created."
244
  msgstr ""
245
 
246
- #: polldaddy.php:952
247
  msgid "Custom Style deleted."
248
  msgstr ""
249
 
250
- #: polldaddy.php:954
251
  #, php-format
252
  msgid "%s Style Deleted."
253
  msgid_plural "%s Custom Styles Deleted."
254
  msgstr[0] ""
255
  msgstr[1] ""
256
 
257
- #: polldaddy.php:957
258
  msgid "Account Imported."
259
  msgstr ""
260
 
261
- #: polldaddy.php:960
262
  msgid "Options Updated."
263
  msgstr ""
264
 
265
- #: polldaddy.php:969
266
  msgid "Error: An error has occurred; Poll not created."
267
  msgstr ""
268
 
269
- #: polldaddy.php:972
270
  msgid "Error: An error has occurred; Poll not updated."
271
  msgstr ""
272
 
273
- #: polldaddy.php:976
274
  msgid ""
275
  "Error: An error has occurred; Account could not be imported. Perhaps your "
276
  "email address or password is incorrect?"
277
  msgstr ""
278
 
279
- #: polldaddy.php:978
280
  msgid "Error: An error has occurred; Account could not be created."
281
  msgstr ""
282
 
283
- #: polldaddy.php:1015
284
  #, php-format
285
  msgid ""
286
  "Poll Preview (<a href=\"%s\">Edit Poll</a>, <a href=\"%s\">List Polls</a>)"
287
  msgstr ""
288
 
289
- #: polldaddy.php:1019
290
  #, php-format
291
  msgid "Poll Preview (<a href=\"%s\">List Polls</a>)"
292
  msgstr ""
293
 
294
- #: polldaddy.php:1029
295
  #, php-format
296
  msgid "Poll Results (<a href=\"%s\">Edit Poll</a>)"
297
  msgstr ""
298
 
299
- #: polldaddy.php:1031
300
  #, php-format
301
  msgid "Poll Results (<a href=\"%s\">List Polls</a>)"
302
  msgstr ""
303
 
304
- #: polldaddy.php:1040
305
  #, php-format
306
  msgid "Edit Poll (<a href=\"%s\">List Polls</a>)"
307
  msgstr ""
308
 
309
- #: polldaddy.php:1049
310
  #, php-format
311
  msgid "Create Poll (<a href=\"%s\">List Polls</a>)"
312
  msgstr ""
313
 
314
- #: polldaddy.php:1059
315
  #, php-format
316
  msgid "Custom Styles (<a href=\"%s\">Add New</a>)"
317
  msgstr ""
318
 
319
- #: polldaddy.php:1069
320
  #, php-format
321
  msgid "Edit Style (<a href=\"%s\">List Styles</a>)"
322
  msgstr ""
323
 
324
- #: polldaddy.php:1078
325
  #, php-format
326
  msgid "Create Style (<a href=\"%s\">List Styles</a>)"
327
  msgstr ""
328
 
329
- #: polldaddy.php:1094
330
  #, php-format
331
  msgid "Polls (<a href=\"%s\">Add New</a>)"
332
  msgstr ""
333
 
334
- #: polldaddy.php:1159
335
  msgid "All Blog's Polls"
336
  msgstr ""
337
 
338
- #: polldaddy.php:1160
339
  msgid "All My Polls"
340
  msgstr ""
341
 
342
- #: polldaddy.php:1168 polldaddy.php:1968
343
  msgid "Actions"
344
  msgstr ""
345
 
346
- #: polldaddy.php:1169 polldaddy.php:1234 polldaddy.php:1969 polldaddy.php:2010
347
  msgid "Delete"
348
  msgstr ""
349
 
350
- #: polldaddy.php:1170 polldaddy.php:1241
351
  msgid "Close"
352
  msgstr ""
353
 
354
- #: polldaddy.php:1171 polldaddy.php:1238
355
  msgid "Open"
356
  msgstr ""
357
 
358
- #: polldaddy.php:1173 polldaddy.php:1971
359
  msgid "Apply"
360
  msgstr ""
361
 
362
- #: polldaddy.php:1232
363
  msgid "Results"
364
  msgstr ""
365
 
366
- #: polldaddy.php:1244 polldaddy.php:1250 polldaddy.php:3246
367
  msgid "Preview"
368
  msgstr ""
369
 
370
- #: polldaddy.php:1246
371
  msgid "Send to editor"
372
  msgstr ""
373
 
374
- #: polldaddy.php:1252
375
  msgid "HTML code"
376
  msgstr ""
377
 
378
- #: polldaddy.php:1256 polldaddy.php:2012
379
  msgid "Y/m/d g:i:s A"
380
  msgstr ""
381
 
382
- #: polldaddy.php:1256 polldaddy.php:2012
383
  msgid "Y/m/d"
384
  msgstr ""
385
 
386
- #: polldaddy.php:1260
387
  msgid "Shortcode"
388
  msgstr ""
389
 
390
- #: polldaddy.php:1263
391
  msgid "JavaScript"
392
  msgstr ""
393
 
394
- #: polldaddy.php:1279
395
  #, php-format
396
  msgid "What are you doing here? <a href=\"%s\">Go back</a>."
397
  msgstr ""
398
 
399
- #: polldaddy.php:1289
400
  #, php-format
401
  msgid "No polls yet. <a href=\"%s\">Create one</a>"
402
  msgstr ""
403
 
404
- #: polldaddy.php:1291
405
  msgid "No polls yet."
406
  msgstr ""
407
 
408
- #: polldaddy.php:1346
409
  msgid "Publish"
410
  msgstr ""
411
 
412
- #: polldaddy.php:1353
413
  msgid "Save Poll"
414
  msgstr ""
415
 
416
- #: polldaddy.php:1368 polldaddy.php:3981
417
  msgid "Poll results"
418
  msgstr ""
419
 
420
- #: polldaddy.php:1373
421
  msgid "Show results to voters"
422
  msgstr ""
423
 
424
- #: polldaddy.php:1373
425
  msgid "Only show percentages"
426
  msgstr ""
427
 
428
- #: polldaddy.php:1373
429
  msgid "Hide all results"
430
  msgstr ""
431
 
432
- #: polldaddy.php:1391 polldaddy.php:3998
433
  msgid "Block repeat voters"
434
  msgstr ""
435
 
436
- #: polldaddy.php:1396
437
  msgid "Don't block repeat voters"
438
  msgstr ""
439
 
440
- #: polldaddy.php:1396
441
  msgid "Block by cookie (recommended)"
442
  msgstr ""
443
 
444
- #: polldaddy.php:1396
445
  msgid "Block by cookie and by IP address"
446
  msgstr ""
447
 
448
- #: polldaddy.php:1411
449
  msgid "Expires: "
450
  msgstr ""
451
 
452
- #: polldaddy.php:1413 polldaddy.php:4003
453
  msgid "Never"
454
  msgstr ""
455
 
456
- #: polldaddy.php:1414 polldaddy.php:4004
457
  #, php-format
458
  msgid "%d hour"
459
  msgstr ""
460
 
461
- #: polldaddy.php:1415 polldaddy.php:1416 polldaddy.php:1417 polldaddy.php:4005
462
- #: polldaddy.php:4006 polldaddy.php:4007
463
  #, php-format
464
  msgid "%d hours"
465
  msgstr ""
466
 
467
- #: polldaddy.php:1418 polldaddy.php:4008
468
  #, php-format
469
  msgid "%d day"
470
  msgstr ""
471
 
472
- #: polldaddy.php:1419 polldaddy.php:4009
473
  #, php-format
474
  msgid "%d week"
475
  msgstr ""
476
 
477
- #: polldaddy.php:1420 polldaddy.php:4010
478
  #, php-format
479
  msgid "%d month"
480
  msgstr ""
481
 
482
- #: polldaddy.php:1422
483
  msgid ""
484
  "Note: Blocking by cookie and IP address can be problematic for some voters."
485
  msgstr ""
486
 
487
- #: polldaddy.php:1437
488
  msgid "Answers"
489
  msgstr ""
490
 
491
- #: polldaddy.php:1483
492
  msgid "Add another"
493
  msgstr ""
494
 
495
- #: polldaddy.php:1489
496
  msgid "Multiple choice"
497
  msgstr ""
498
 
499
- #: polldaddy.php:1489
500
  msgid "Randomize answer order"
501
  msgstr ""
502
 
503
- #: polldaddy.php:1489
504
  msgid "Allow other answers"
505
  msgstr ""
506
 
507
- #: polldaddy.php:1489
508
  msgid "'Share This' link"
509
  msgstr ""
510
 
511
- #: polldaddy.php:1618
512
  msgid "Design"
513
  msgstr ""
514
 
515
- #: polldaddy.php:1699 polldaddy.php:1754
516
  msgid "Custom Style"
517
  msgstr ""
518
 
519
- #: polldaddy.php:1712 polldaddy.php:1808
520
  msgid "Please choose a custom style..."
521
  msgstr ""
522
 
523
- #: polldaddy.php:1718 polldaddy.php:1814
524
  msgid "Please choose a style."
525
  msgstr ""
526
 
527
- #: polldaddy.php:1723 polldaddy.php:1819
528
  #, php-format
529
  msgid ""
530
  "Did you know we have a new editor for building your own custom poll styles? "
531
  "Find out more <a href=\"%s\" target=\"_blank\">here</a>."
532
  msgstr ""
533
 
534
- #: polldaddy.php:1746
535
  msgid "PollDaddy Style"
536
  msgstr ""
537
 
538
- #: polldaddy.php:1871
539
  msgid "Answer"
540
  msgstr ""
541
 
542
- #: polldaddy.php:1872 polldaddy.php:1917 polldaddy.php:3731
543
  msgid "Votes"
544
  msgstr ""
545
 
546
- #: polldaddy.php:1886
547
  #, php-format
548
  msgid "Other (<a href=\"%s\">see below</a>)"
549
  msgstr ""
550
 
551
- #: polldaddy.php:1916 polldaddy.php:3969
552
  msgid "Other Answer"
553
  msgstr ""
554
 
555
- #: polldaddy.php:1981
556
  msgid "Style"
557
  msgstr ""
558
 
559
- #: polldaddy.php:1982
560
  msgid "Last Modified"
561
  msgstr ""
562
 
563
- #: polldaddy.php:2022
564
  #, php-format
565
  msgid "No custom styles yet. <a href=\"%s\">Create one</a>"
566
  msgstr ""
567
 
568
- #: polldaddy.php:2098
569
  msgid "Style Name"
570
  msgstr ""
571
 
572
- #: polldaddy.php:2113
573
  msgid "Preload Basic Style"
574
  msgstr ""
575
 
576
- #: polldaddy.php:2127
577
  msgid "Load Style"
578
  msgstr ""
579
 
580
- #: polldaddy.php:2918
581
  msgid "Save Style"
582
  msgstr ""
583
 
584
- #: polldaddy.php:3053
585
  #, php-format
586
  msgid ""
587
  "Sorry! There was an error creating your rating widget. Please contact <a "
@@ -592,363 +635,367 @@ msgstr ""
592
  msgid "Rating Settings"
593
  msgstr ""
594
 
595
- #: polldaddy.php:3096
596
  msgid "Rating updated"
597
  msgstr ""
598
 
599
- #: polldaddy.php:3111 polldaddy.php:3680
600
  msgid "Posts"
601
  msgstr ""
602
 
603
- #: polldaddy.php:3117 polldaddy.php:3680
604
  msgid "Pages"
605
  msgstr ""
606
 
607
- #: polldaddy.php:3123 polldaddy.php:3680
608
  msgid "Comments"
609
  msgstr ""
610
 
611
- #: polldaddy.php:3136
612
  msgid "Enable for blog posts"
613
  msgstr ""
614
 
615
- #: polldaddy.php:3142
616
  msgid "Above each blog post"
617
  msgstr ""
618
 
619
- #: polldaddy.php:3142
620
  msgid "Below each blog post"
621
  msgstr ""
622
 
623
- #: polldaddy.php:3161
 
 
 
 
624
  msgid "Enable for pages"
625
  msgstr ""
626
 
627
- #: polldaddy.php:3167
628
  msgid "Above each page"
629
  msgstr ""
630
 
631
- #: polldaddy.php:3167
632
  msgid "Below each page"
633
  msgstr ""
634
 
635
- #: polldaddy.php:3186
636
  msgid "Enable for comments"
637
  msgstr ""
638
 
639
- #: polldaddy.php:3192
640
  msgid "Above each comment"
641
  msgstr ""
642
 
643
- #: polldaddy.php:3192
644
  msgid "Below each comment"
645
  msgstr ""
646
 
647
- #: polldaddy.php:3208 polldaddy.php:3239
648
  msgid "Save Changes"
649
  msgstr ""
650
 
651
- #: polldaddy.php:3218
652
  msgid "Advanced Settings"
653
  msgstr ""
654
 
655
- #: polldaddy.php:3232
656
  msgid "Save"
657
  msgstr ""
658
 
659
- #: polldaddy.php:3248
660
  msgid "This is a demo of what your rating widget will look like"
661
  msgstr ""
662
 
663
- #: polldaddy.php:3255
664
  msgid "Customize Labels"
665
  msgstr ""
666
 
667
- #: polldaddy.php:3259
668
  msgid "votes"
669
  msgstr ""
670
 
671
- #: polldaddy.php:3263
672
  msgid "rate this"
673
  msgstr ""
674
 
675
- #: polldaddy.php:3267
676
  #, php-format
677
  msgid "%d star"
678
  msgstr ""
679
 
680
- #: polldaddy.php:3271 polldaddy.php:3275 polldaddy.php:3279 polldaddy.php:3283
681
  #, php-format
682
  msgid "%d stars"
683
  msgstr ""
684
 
685
- #: polldaddy.php:3287
686
  msgid "Thank You"
687
  msgstr ""
688
 
689
- #: polldaddy.php:3291
690
  msgid "Rate Up"
691
  msgstr ""
692
 
693
- #: polldaddy.php:3295
694
  msgid "Rate Down"
695
  msgstr ""
696
 
697
- #: polldaddy.php:3306
698
  msgid "Rating Type"
699
  msgstr ""
700
 
701
- #: polldaddy.php:3308
702
  msgid ""
703
  "Here you can choose how you want your rating to display. The 5 star rating "
704
  "is the most commonly used. The Nero rating is useful for keeping it simple."
705
  msgstr ""
706
 
707
- #: polldaddy.php:3318
708
  #, php-format
709
  msgid "%d Star Rating"
710
  msgstr ""
711
 
712
- #: polldaddy.php:3329
713
  msgid "Nero Rating"
714
  msgstr ""
715
 
716
- #: polldaddy.php:3336
717
  msgid "Rating Style"
718
  msgstr ""
719
 
720
- #: polldaddy.php:3344
721
  msgid "Small"
722
  msgstr ""
723
 
724
- #: polldaddy.php:3344
725
  msgid "Medium"
726
  msgstr ""
727
 
728
- #: polldaddy.php:3344
729
  msgid "Large"
730
  msgstr ""
731
 
732
- #: polldaddy.php:3358
733
  msgid "Star Color"
734
  msgstr ""
735
 
736
- #: polldaddy.php:3362
737
  msgid "Yellow"
738
  msgstr ""
739
 
740
- #: polldaddy.php:3362
741
  msgid "Red"
742
  msgstr ""
743
 
744
- #: polldaddy.php:3362
745
  msgid "Blue"
746
  msgstr ""
747
 
748
- #: polldaddy.php:3362
749
  msgid "Green"
750
  msgstr ""
751
 
752
- #: polldaddy.php:3362
753
  msgid "Grey"
754
  msgstr ""
755
 
756
- #: polldaddy.php:3373
757
  msgid "Hand"
758
  msgstr ""
759
 
760
- #: polldaddy.php:3386
761
  msgid "Custom Image"
762
  msgstr ""
763
 
764
- #: polldaddy.php:3393
765
  msgid "Text Layout & Font"
766
  msgstr ""
767
 
768
- #: polldaddy.php:3397
769
  msgid "Align"
770
  msgstr ""
771
 
772
- #: polldaddy.php:3401
773
  msgid "Left"
774
  msgstr ""
775
 
776
- #: polldaddy.php:3401
777
  msgid "Center"
778
  msgstr ""
779
 
780
- #: polldaddy.php:3401 polldaddy.php:3417
781
  msgid "Right"
782
  msgstr ""
783
 
784
- #: polldaddy.php:3413
785
  msgid "Position"
786
  msgstr ""
787
 
788
- #: polldaddy.php:3417
789
  msgid "Top"
790
  msgstr ""
791
 
792
- #: polldaddy.php:3417
793
  msgid "Bottom"
794
  msgstr ""
795
 
796
- #: polldaddy.php:3429
797
  msgid "Font"
798
  msgstr ""
799
 
800
- #: polldaddy.php:3446
801
- msgid "Color"
802
  msgstr ""
803
 
804
- #: polldaddy.php:3451
805
- msgid "Size"
806
  msgstr ""
807
 
808
- #: polldaddy.php:3455 polldaddy.php:3472
809
- msgid "Inherit"
810
  msgstr ""
811
 
812
- #: polldaddy.php:3468
813
  msgid "Line Height"
814
  msgstr ""
815
 
816
- #: polldaddy.php:3485
817
  msgid "Bold"
818
  msgstr ""
819
 
820
- #: polldaddy.php:3493
821
  msgid "Italic"
822
  msgstr ""
823
 
824
- #: polldaddy.php:3666
825
  msgid "&laquo;"
826
  msgstr ""
827
 
828
- #: polldaddy.php:3667
829
  msgid "&raquo;"
830
  msgstr ""
831
 
832
- #: polldaddy.php:3673
833
  msgid "Rating Reports"
834
  msgstr ""
835
 
836
- #: polldaddy.php:3691
837
  msgid "View Report"
838
  msgstr ""
839
 
840
- #: polldaddy.php:3695
841
  msgid "Last 24 hours"
842
  msgstr ""
843
 
844
- #: polldaddy.php:3695
845
  msgid "Last 7 days"
846
  msgstr ""
847
 
848
- #: polldaddy.php:3695
849
  msgid "Last 31 days"
850
  msgstr ""
851
 
852
- #: polldaddy.php:3695
853
  msgid "Last 3 months"
854
  msgstr ""
855
 
856
- #: polldaddy.php:3695
857
  msgid "Last 12 months"
858
  msgstr ""
859
 
860
- #: polldaddy.php:3695
861
  msgid "All time"
862
  msgstr ""
863
 
864
- #: polldaddy.php:3704
865
  msgid "Filter Report"
866
  msgstr ""
867
 
868
- #: polldaddy.php:3720
869
  #, php-format
870
  msgid "No ratings have been collected for your %s yet."
871
  msgstr ""
872
 
873
- #: polldaddy.php:3729
874
  msgid "Start Date"
875
  msgstr ""
876
 
877
- #: polldaddy.php:3730
878
  msgid "Title"
879
  msgstr ""
880
 
881
- #: polldaddy.php:3732
882
  msgid "Average Rating"
883
  msgstr ""
884
 
885
- #: polldaddy.php:3903
886
  msgid "PollDaddy Account Info"
887
  msgstr ""
888
 
889
- #: polldaddy.php:3906
890
  msgid ""
891
  "This is the PollDadddy account you currently have imported into your "
892
  "WordPress account"
893
  msgstr ""
894
 
895
- #: polldaddy.php:3937
896
  msgid "Import Account"
897
  msgstr ""
898
 
899
- #: polldaddy.php:3942
900
  msgid "General Settings"
901
  msgstr ""
902
 
903
- #: polldaddy.php:3950
904
  msgid "Default poll settings"
905
  msgstr ""
906
 
907
- #: polldaddy.php:3959
908
  msgid "Multiple Choice"
909
  msgstr ""
910
 
911
- #: polldaddy.php:3964
912
  msgid "Randomise Answers"
913
  msgstr ""
914
 
915
- #: polldaddy.php:3974
916
  msgid "Sharing"
917
  msgstr ""
918
 
919
- #: polldaddy.php:3978
920
  msgid "Show"
921
  msgstr ""
922
 
923
- #: polldaddy.php:3979
924
  msgid "Hide"
925
  msgstr ""
926
 
927
- #: polldaddy.php:3980
928
  msgid "Percentages"
929
  msgstr ""
930
 
931
- #: polldaddy.php:3990
932
  msgid "Poll style"
933
  msgstr ""
934
 
935
- #: polldaddy.php:3995
936
  msgid "Off"
937
  msgstr ""
938
 
939
- #: polldaddy.php:3996
940
  msgid "Cookie"
941
  msgstr ""
942
 
943
- #: polldaddy.php:3997
944
  msgid "Cookie & IP address"
945
  msgstr ""
946
 
947
- #: polldaddy.php:4011
948
  msgid "Block expiration limit"
949
  msgstr ""
950
 
951
- #: polldaddy.php:4023
952
  msgid "Save Options"
953
  msgstr ""
954
 
1
+ # Translation of the WordPress plugin PollDaddy Polls 1.8.0 by Automattic, Inc..
2
  # Copyright (C) 2010 Automattic, Inc.
3
  # This file is distributed under the same license as the PollDaddy Polls package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: PollDaddy Polls 1.8.0\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/polldaddy\n"
11
+ "POT-Creation-Date: 2010-02-02 18:21+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
 
20
+ #: polldaddy-org.php:98 polldaddy.php:128 polldaddy.php:892
21
+ msgid "Email address required"
22
  msgstr ""
23
 
24
+ #: polldaddy-org.php:101 polldaddy.php:131 polldaddy.php:895
25
+ msgid "Password required"
 
26
  msgstr ""
27
 
28
+ #: polldaddy-org.php:133
29
+ msgid "Could not connect to PollDaddy API Key service"
30
  msgstr ""
31
 
32
+ #: polldaddy-org.php:147 polldaddy.php:161
33
+ msgid "Can't connect to PollDaddy.com"
34
  msgstr ""
35
 
36
+ #: polldaddy-org.php:177
37
+ msgid ""
38
+ "Login to PollDaddy failed. Double check your email address and password."
39
  msgstr ""
40
 
41
+ #: polldaddy-org.php:179
42
+ msgid ""
43
+ "If your email address and password are correct, your host may not support "
44
+ "secure logins."
45
  msgstr ""
46
 
47
+ #: polldaddy-org.php:180
48
+ msgid ""
49
+ "In that case, you may be able to log in to PollDaddy by unchecking the \"Use "
50
+ "SSL to Log in\" checkbox."
51
  msgstr ""
52
 
53
+ #: polldaddy-org.php:191 polldaddy.php:198
54
+ msgid ""
55
+ "Account could not be accessed. Are your email address and password correct?"
56
  msgstr ""
57
 
58
+ #: polldaddy-org.php:205 polldaddy.php:249
59
+ msgid "PollDaddy Account"
60
  msgstr ""
61
 
62
+ #: polldaddy-org.php:207 polldaddy.php:251
63
+ #, php-format
64
+ msgid ""
65
+ "Before you can use the PollDaddy plugin, you need to enter your <a href=\"%s"
66
+ "\">PollDaddy.com</a> account details."
67
  msgstr ""
68
 
69
+ #: polldaddy-org.php:214 polldaddy.php:258 polldaddy.php:3857
70
+ msgid "PollDaddy Email Address"
71
  msgstr ""
72
 
73
+ #: polldaddy-org.php:222 polldaddy.php:266 polldaddy.php:3867
74
+ msgid "PollDaddy Password"
75
  msgstr ""
76
 
77
+ #: polldaddy-org.php:235
78
+ msgid "Use SSL to Log in"
79
  msgstr ""
80
 
81
+ #: polldaddy-org.php:239
82
+ msgid ""
83
+ "This ensures a secure login to your PollDaddy account. Only uncheck if you "
84
+ "are having problems logging in."
85
  msgstr ""
86
 
87
+ #: polldaddy-org.php:249 polldaddy.php:278
88
+ msgid "Submit"
89
  msgstr ""
90
 
91
+ #: polldaddy-org.php:265
92
+ msgid "Multiple PollDaddy Accounts"
 
93
  msgstr ""
94
 
95
+ #: polldaddy-org.php:271
96
+ msgid "This setting will allow each blog user to import a PollDaddy account."
 
 
 
97
  msgstr ""
98
 
99
+ #: polldaddy-org.php:514
100
+ msgid "How many items would you like to display?"
101
  msgstr ""
102
 
103
+ #: polldaddy.php:68 polldaddy.php:70 polldaddy.php:86 polldaddy.php:88
104
+ msgid "Ratings"
 
 
 
105
  msgstr ""
106
 
107
+ #: polldaddy.php:75 polldaddy.php:77 polldaddy.php:93 polldaddy.php:95
108
+ #: polldaddy.php:107 polldaddy.php:1101
109
+ msgid "Polls"
110
  msgstr ""
111
 
112
+ #: polldaddy.php:100
113
+ msgid "Ratings &ndash; Settings"
114
  msgstr ""
115
 
116
+ #: polldaddy.php:100
117
+ msgid "Settings"
118
+ msgstr ""
119
+
120
+ #: polldaddy.php:101 polldaddy.php:104
121
+ msgid "Ratings &ndash; Reports"
122
+ msgstr ""
123
+
124
+ #: polldaddy.php:101 polldaddy.php:104
125
+ msgid "Reports"
126
+ msgstr ""
127
+
128
+ #: polldaddy.php:107 polldaddy.php:1233 polldaddy.php:2010
129
+ msgid "Edit"
130
+ msgstr ""
131
+
132
+ #: polldaddy.php:110
133
+ msgid "Add New Poll"
134
+ msgstr ""
135
+
136
+ #: polldaddy.php:110
137
+ msgid "Add New"
138
+ msgstr ""
139
+
140
+ #: polldaddy.php:111 polldaddy.php:1066 polldaddy.php:1739
141
+ msgid "Custom Styles"
142
  msgstr ""
143
 
144
+ #: polldaddy.php:112 polldaddy.php:3842
145
+ msgid "Options"
146
+ msgstr ""
147
+
148
+ #: polldaddy.php:188
149
+ msgid "Invalid Account"
150
+ msgstr ""
151
+
152
+ #: polldaddy.php:210
153
+ #, php-format
154
+ msgid ""
155
+ "Obsolete PollDaddy User API Key: <a href=\"%s\">Sign in again to re-"
156
+ "authenticate</a>"
157
+ msgstr ""
158
+
159
+ #: polldaddy.php:287
160
  msgid "Add Poll"
161
  msgstr ""
162
 
163
+ #: polldaddy.php:358
164
  msgid "Star Colors"
165
  msgstr ""
166
 
167
+ #: polldaddy.php:358 polldaddy.php:3329
168
  msgid "Star Size"
169
  msgstr ""
170
 
171
+ #: polldaddy.php:359
172
  msgid "Nero Type"
173
  msgstr ""
174
 
175
+ #: polldaddy.php:359
176
  msgid "Nero Size"
177
  msgstr ""
178
 
179
+ #: polldaddy.php:452
180
  msgid "You are not allowed to delete this poll."
181
  msgstr ""
182
 
183
+ #: polldaddy.php:460 polldaddy.php:496 polldaddy.php:532 polldaddy.php:566
184
  msgid "Invalid Poll Author"
185
  msgstr ""
186
 
187
+ #: polldaddy.php:488
188
  msgid "You are not allowed to open this poll."
189
  msgstr ""
190
 
191
+ #: polldaddy.php:524
192
  msgid "You are not allowed to close this poll."
193
  msgstr ""
194
 
195
+ #: polldaddy.php:557 polldaddy.php:1329
196
  msgid "You are not allowed to edit this poll."
197
  msgstr ""
198
 
199
+ #: polldaddy.php:573
200
  msgid "Poll not found"
201
  msgstr ""
202
 
203
+ #: polldaddy.php:600
204
  msgid "Invalid answers"
205
  msgstr ""
206
 
207
+ #: polldaddy.php:616
208
  msgid "You must include at least 2 answers"
209
  msgstr ""
210
 
211
+ #: polldaddy.php:627 polldaddy.php:704
212
  msgid "Please choose a poll style"
213
  msgstr ""
214
 
215
+ #: polldaddy.php:649
216
  msgid "Poll could not be updated"
217
  msgstr ""
218
 
219
+ #: polldaddy.php:723
220
  msgid "Poll could not be created"
221
  msgstr ""
222
 
223
+ #: polldaddy.php:775
224
  msgid "Style could not be updated"
225
  msgstr ""
226
 
227
+ #: polldaddy.php:805
228
  msgid "Style could not be created"
229
  msgstr ""
230
 
231
+ #: polldaddy.php:904
232
  msgid ""
233
  "Account could not be imported. Are your email address and password correct?"
234
  msgstr ""
235
 
236
+ #: polldaddy.php:922
237
  msgid "Poll deleted."
238
  msgstr ""
239
 
240
+ #: polldaddy.php:924
241
  #, php-format
242
  msgid "%s Poll Deleted."
243
  msgid_plural "%s Polls Deleted."
244
  msgstr[0] ""
245
  msgstr[1] ""
246
 
247
+ #: polldaddy.php:929
248
  msgid "Poll opened."
249
  msgstr ""
250
 
251
+ #: polldaddy.php:931
252
  #, php-format
253
  msgid "%s Poll Opened."
254
  msgid_plural "%s Polls Opened."
255
  msgstr[0] ""
256
  msgstr[1] ""
257
 
258
+ #: polldaddy.php:936
259
  msgid "Poll closed."
260
  msgstr ""
261
 
262
+ #: polldaddy.php:938
263
  #, php-format
264
  msgid "%s Poll Closed."
265
  msgid_plural "%s Polls Closed."
266
  msgstr[0] ""
267
  msgstr[1] ""
268
 
269
+ #: polldaddy.php:941
270
  msgid "Poll updated."
271
  msgstr ""
272
 
273
+ #: polldaddy.php:944
274
  msgid "Poll created."
275
  msgstr ""
276
 
277
+ #: polldaddy.php:946 polldaddy.php:1362
278
  msgid "Send to Editor"
279
  msgstr ""
280
 
281
+ #: polldaddy.php:949
282
  msgid "Custom Style updated."
283
  msgstr ""
284
 
285
+ #: polldaddy.php:952
286
  msgid "Custom Style created."
287
  msgstr ""
288
 
289
+ #: polldaddy.php:957
290
  msgid "Custom Style deleted."
291
  msgstr ""
292
 
293
+ #: polldaddy.php:959
294
  #, php-format
295
  msgid "%s Style Deleted."
296
  msgid_plural "%s Custom Styles Deleted."
297
  msgstr[0] ""
298
  msgstr[1] ""
299
 
300
+ #: polldaddy.php:962
301
  msgid "Account Imported."
302
  msgstr ""
303
 
304
+ #: polldaddy.php:965
305
  msgid "Options Updated."
306
  msgstr ""
307
 
308
+ #: polldaddy.php:974
309
  msgid "Error: An error has occurred; Poll not created."
310
  msgstr ""
311
 
312
+ #: polldaddy.php:977
313
  msgid "Error: An error has occurred; Poll not updated."
314
  msgstr ""
315
 
316
+ #: polldaddy.php:981
317
  msgid ""
318
  "Error: An error has occurred; Account could not be imported. Perhaps your "
319
  "email address or password is incorrect?"
320
  msgstr ""
321
 
322
+ #: polldaddy.php:983
323
  msgid "Error: An error has occurred; Account could not be created."
324
  msgstr ""
325
 
326
+ #: polldaddy.php:1020
327
  #, php-format
328
  msgid ""
329
  "Poll Preview (<a href=\"%s\">Edit Poll</a>, <a href=\"%s\">List Polls</a>)"
330
  msgstr ""
331
 
332
+ #: polldaddy.php:1024
333
  #, php-format
334
  msgid "Poll Preview (<a href=\"%s\">List Polls</a>)"
335
  msgstr ""
336
 
337
+ #: polldaddy.php:1034
338
  #, php-format
339
  msgid "Poll Results (<a href=\"%s\">Edit Poll</a>)"
340
  msgstr ""
341
 
342
+ #: polldaddy.php:1036
343
  #, php-format
344
  msgid "Poll Results (<a href=\"%s\">List Polls</a>)"
345
  msgstr ""
346
 
347
+ #: polldaddy.php:1045
348
  #, php-format
349
  msgid "Edit Poll (<a href=\"%s\">List Polls</a>)"
350
  msgstr ""
351
 
352
+ #: polldaddy.php:1054
353
  #, php-format
354
  msgid "Create Poll (<a href=\"%s\">List Polls</a>)"
355
  msgstr ""
356
 
357
+ #: polldaddy.php:1064
358
  #, php-format
359
  msgid "Custom Styles (<a href=\"%s\">Add New</a>)"
360
  msgstr ""
361
 
362
+ #: polldaddy.php:1074
363
  #, php-format
364
  msgid "Edit Style (<a href=\"%s\">List Styles</a>)"
365
  msgstr ""
366
 
367
+ #: polldaddy.php:1083
368
  #, php-format
369
  msgid "Create Style (<a href=\"%s\">List Styles</a>)"
370
  msgstr ""
371
 
372
+ #: polldaddy.php:1099
373
  #, php-format
374
  msgid "Polls (<a href=\"%s\">Add New</a>)"
375
  msgstr ""
376
 
377
+ #: polldaddy.php:1164
378
  msgid "All Blog's Polls"
379
  msgstr ""
380
 
381
+ #: polldaddy.php:1165
382
  msgid "All My Polls"
383
  msgstr ""
384
 
385
+ #: polldaddy.php:1173 polldaddy.php:1973
386
  msgid "Actions"
387
  msgstr ""
388
 
389
+ #: polldaddy.php:1174 polldaddy.php:1239 polldaddy.php:1974 polldaddy.php:2015
390
  msgid "Delete"
391
  msgstr ""
392
 
393
+ #: polldaddy.php:1175 polldaddy.php:1246
394
  msgid "Close"
395
  msgstr ""
396
 
397
+ #: polldaddy.php:1176 polldaddy.php:1243
398
  msgid "Open"
399
  msgstr ""
400
 
401
+ #: polldaddy.php:1178 polldaddy.php:1976
402
  msgid "Apply"
403
  msgstr ""
404
 
405
+ #: polldaddy.php:1237
406
  msgid "Results"
407
  msgstr ""
408
 
409
+ #: polldaddy.php:1249 polldaddy.php:1255 polldaddy.php:3241
410
  msgid "Preview"
411
  msgstr ""
412
 
413
+ #: polldaddy.php:1251
414
  msgid "Send to editor"
415
  msgstr ""
416
 
417
+ #: polldaddy.php:1257
418
  msgid "HTML code"
419
  msgstr ""
420
 
421
+ #: polldaddy.php:1261 polldaddy.php:2017
422
  msgid "Y/m/d g:i:s A"
423
  msgstr ""
424
 
425
+ #: polldaddy.php:1261 polldaddy.php:2017
426
  msgid "Y/m/d"
427
  msgstr ""
428
 
429
+ #: polldaddy.php:1265
430
  msgid "Shortcode"
431
  msgstr ""
432
 
433
+ #: polldaddy.php:1268
434
  msgid "JavaScript"
435
  msgstr ""
436
 
437
+ #: polldaddy.php:1284
438
  #, php-format
439
  msgid "What are you doing here? <a href=\"%s\">Go back</a>."
440
  msgstr ""
441
 
442
+ #: polldaddy.php:1294
443
  #, php-format
444
  msgid "No polls yet. <a href=\"%s\">Create one</a>"
445
  msgstr ""
446
 
447
+ #: polldaddy.php:1296
448
  msgid "No polls yet."
449
  msgstr ""
450
 
451
+ #: polldaddy.php:1351
452
  msgid "Publish"
453
  msgstr ""
454
 
455
+ #: polldaddy.php:1358
456
  msgid "Save Poll"
457
  msgstr ""
458
 
459
+ #: polldaddy.php:1373 polldaddy.php:3925
460
  msgid "Poll results"
461
  msgstr ""
462
 
463
+ #: polldaddy.php:1378
464
  msgid "Show results to voters"
465
  msgstr ""
466
 
467
+ #: polldaddy.php:1378
468
  msgid "Only show percentages"
469
  msgstr ""
470
 
471
+ #: polldaddy.php:1378
472
  msgid "Hide all results"
473
  msgstr ""
474
 
475
+ #: polldaddy.php:1396 polldaddy.php:3942
476
  msgid "Block repeat voters"
477
  msgstr ""
478
 
479
+ #: polldaddy.php:1401
480
  msgid "Don't block repeat voters"
481
  msgstr ""
482
 
483
+ #: polldaddy.php:1401
484
  msgid "Block by cookie (recommended)"
485
  msgstr ""
486
 
487
+ #: polldaddy.php:1401
488
  msgid "Block by cookie and by IP address"
489
  msgstr ""
490
 
491
+ #: polldaddy.php:1416
492
  msgid "Expires: "
493
  msgstr ""
494
 
495
+ #: polldaddy.php:1418 polldaddy.php:3947
496
  msgid "Never"
497
  msgstr ""
498
 
499
+ #: polldaddy.php:1419 polldaddy.php:3948
500
  #, php-format
501
  msgid "%d hour"
502
  msgstr ""
503
 
504
+ #: polldaddy.php:1420 polldaddy.php:1421 polldaddy.php:1422 polldaddy.php:3949
505
+ #: polldaddy.php:3950 polldaddy.php:3951
506
  #, php-format
507
  msgid "%d hours"
508
  msgstr ""
509
 
510
+ #: polldaddy.php:1423 polldaddy.php:3952
511
  #, php-format
512
  msgid "%d day"
513
  msgstr ""
514
 
515
+ #: polldaddy.php:1424 polldaddy.php:3953
516
  #, php-format
517
  msgid "%d week"
518
  msgstr ""
519
 
520
+ #: polldaddy.php:1425 polldaddy.php:3954
521
  #, php-format
522
  msgid "%d month"
523
  msgstr ""
524
 
525
+ #: polldaddy.php:1427
526
  msgid ""
527
  "Note: Blocking by cookie and IP address can be problematic for some voters."
528
  msgstr ""
529
 
530
+ #: polldaddy.php:1442
531
  msgid "Answers"
532
  msgstr ""
533
 
534
+ #: polldaddy.php:1488
535
  msgid "Add another"
536
  msgstr ""
537
 
538
+ #: polldaddy.php:1494
539
  msgid "Multiple choice"
540
  msgstr ""
541
 
542
+ #: polldaddy.php:1494
543
  msgid "Randomize answer order"
544
  msgstr ""
545
 
546
+ #: polldaddy.php:1494
547
  msgid "Allow other answers"
548
  msgstr ""
549
 
550
+ #: polldaddy.php:1494
551
  msgid "'Share This' link"
552
  msgstr ""
553
 
554
+ #: polldaddy.php:1623
555
  msgid "Design"
556
  msgstr ""
557
 
558
+ #: polldaddy.php:1704 polldaddy.php:1759
559
  msgid "Custom Style"
560
  msgstr ""
561
 
562
+ #: polldaddy.php:1717 polldaddy.php:1813
563
  msgid "Please choose a custom style..."
564
  msgstr ""
565
 
566
+ #: polldaddy.php:1723 polldaddy.php:1819
567
  msgid "Please choose a style."
568
  msgstr ""
569
 
570
+ #: polldaddy.php:1728 polldaddy.php:1824
571
  #, php-format
572
  msgid ""
573
  "Did you know we have a new editor for building your own custom poll styles? "
574
  "Find out more <a href=\"%s\" target=\"_blank\">here</a>."
575
  msgstr ""
576
 
577
+ #: polldaddy.php:1751
578
  msgid "PollDaddy Style"
579
  msgstr ""
580
 
581
+ #: polldaddy.php:1876
582
  msgid "Answer"
583
  msgstr ""
584
 
585
+ #: polldaddy.php:1877 polldaddy.php:1922 polldaddy.php:3684
586
  msgid "Votes"
587
  msgstr ""
588
 
589
+ #: polldaddy.php:1891
590
  #, php-format
591
  msgid "Other (<a href=\"%s\">see below</a>)"
592
  msgstr ""
593
 
594
+ #: polldaddy.php:1921 polldaddy.php:3913
595
  msgid "Other Answer"
596
  msgstr ""
597
 
598
+ #: polldaddy.php:1986
599
  msgid "Style"
600
  msgstr ""
601
 
602
+ #: polldaddy.php:1987
603
  msgid "Last Modified"
604
  msgstr ""
605
 
606
+ #: polldaddy.php:2027
607
  #, php-format
608
  msgid "No custom styles yet. <a href=\"%s\">Create one</a>"
609
  msgstr ""
610
 
611
+ #: polldaddy.php:2103
612
  msgid "Style Name"
613
  msgstr ""
614
 
615
+ #: polldaddy.php:2118
616
  msgid "Preload Basic Style"
617
  msgstr ""
618
 
619
+ #: polldaddy.php:2132
620
  msgid "Load Style"
621
  msgstr ""
622
 
623
+ #: polldaddy.php:2921
624
  msgid "Save Style"
625
  msgstr ""
626
 
627
+ #: polldaddy.php:3054
628
  #, php-format
629
  msgid ""
630
  "Sorry! There was an error creating your rating widget. Please contact <a "
635
  msgid "Rating Settings"
636
  msgstr ""
637
 
638
+ #: polldaddy.php:3095
639
  msgid "Rating updated"
640
  msgstr ""
641
 
642
+ #: polldaddy.php:3107 polldaddy.php:3643
643
  msgid "Posts"
644
  msgstr ""
645
 
646
+ #: polldaddy.php:3111 polldaddy.php:3643
647
  msgid "Pages"
648
  msgstr ""
649
 
650
+ #: polldaddy.php:3115 polldaddy.php:3643
651
  msgid "Comments"
652
  msgstr ""
653
 
654
+ #: polldaddy.php:3126
655
  msgid "Enable for blog posts"
656
  msgstr ""
657
 
658
+ #: polldaddy.php:3130 polldaddy.php:3148
659
  msgid "Above each blog post"
660
  msgstr ""
661
 
662
+ #: polldaddy.php:3130 polldaddy.php:3148
663
  msgid "Below each blog post"
664
  msgstr ""
665
 
666
+ #: polldaddy.php:3144
667
+ msgid "Enable for front page"
668
+ msgstr ""
669
+
670
+ #: polldaddy.php:3164
671
  msgid "Enable for pages"
672
  msgstr ""
673
 
674
+ #: polldaddy.php:3168
675
  msgid "Above each page"
676
  msgstr ""
677
 
678
+ #: polldaddy.php:3168
679
  msgid "Below each page"
680
  msgstr ""
681
 
682
+ #: polldaddy.php:3184
683
  msgid "Enable for comments"
684
  msgstr ""
685
 
686
+ #: polldaddy.php:3188
687
  msgid "Above each comment"
688
  msgstr ""
689
 
690
+ #: polldaddy.php:3188
691
  msgid "Below each comment"
692
  msgstr ""
693
 
694
+ #: polldaddy.php:3203 polldaddy.php:3234
695
  msgid "Save Changes"
696
  msgstr ""
697
 
698
+ #: polldaddy.php:3214
699
  msgid "Advanced Settings"
700
  msgstr ""
701
 
702
+ #: polldaddy.php:3227
703
  msgid "Save"
704
  msgstr ""
705
 
706
+ #: polldaddy.php:3243
707
  msgid "This is a demo of what your rating widget will look like"
708
  msgstr ""
709
 
710
+ #: polldaddy.php:3250
711
  msgid "Customize Labels"
712
  msgstr ""
713
 
714
+ #: polldaddy.php:3254
715
  msgid "votes"
716
  msgstr ""
717
 
718
+ #: polldaddy.php:3258
719
  msgid "rate this"
720
  msgstr ""
721
 
722
+ #: polldaddy.php:3262
723
  #, php-format
724
  msgid "%d star"
725
  msgstr ""
726
 
727
+ #: polldaddy.php:3266 polldaddy.php:3270 polldaddy.php:3274 polldaddy.php:3278
728
  #, php-format
729
  msgid "%d stars"
730
  msgstr ""
731
 
732
+ #: polldaddy.php:3282
733
  msgid "Thank You"
734
  msgstr ""
735
 
736
+ #: polldaddy.php:3286
737
  msgid "Rate Up"
738
  msgstr ""
739
 
740
+ #: polldaddy.php:3290
741
  msgid "Rate Down"
742
  msgstr ""
743
 
744
+ #: polldaddy.php:3299
745
  msgid "Rating Type"
746
  msgstr ""
747
 
748
+ #: polldaddy.php:3301
749
  msgid ""
750
  "Here you can choose how you want your rating to display. The 5 star rating "
751
  "is the most commonly used. The Nero rating is useful for keeping it simple."
752
  msgstr ""
753
 
754
+ #: polldaddy.php:3309
755
  #, php-format
756
  msgid "%d Star Rating"
757
  msgstr ""
758
 
759
+ #: polldaddy.php:3318
760
  msgid "Nero Rating"
761
  msgstr ""
762
 
763
+ #: polldaddy.php:3325
764
  msgid "Rating Style"
765
  msgstr ""
766
 
767
+ #: polldaddy.php:3332
768
  msgid "Small"
769
  msgstr ""
770
 
771
+ #: polldaddy.php:3332
772
  msgid "Medium"
773
  msgstr ""
774
 
775
+ #: polldaddy.php:3332
776
  msgid "Large"
777
  msgstr ""
778
 
779
+ #: polldaddy.php:3343
780
  msgid "Star Color"
781
  msgstr ""
782
 
783
+ #: polldaddy.php:3346
784
  msgid "Yellow"
785
  msgstr ""
786
 
787
+ #: polldaddy.php:3346
788
  msgid "Red"
789
  msgstr ""
790
 
791
+ #: polldaddy.php:3346
792
  msgid "Blue"
793
  msgstr ""
794
 
795
+ #: polldaddy.php:3346
796
  msgid "Green"
797
  msgstr ""
798
 
799
+ #: polldaddy.php:3346
800
  msgid "Grey"
801
  msgstr ""
802
 
803
+ #: polldaddy.php:3355
804
  msgid "Hand"
805
  msgstr ""
806
 
807
+ #: polldaddy.php:3366
808
  msgid "Custom Image"
809
  msgstr ""
810
 
811
+ #: polldaddy.php:3373
812
  msgid "Text Layout & Font"
813
  msgstr ""
814
 
815
+ #: polldaddy.php:3377
816
  msgid "Align"
817
  msgstr ""
818
 
819
+ #: polldaddy.php:3380
820
  msgid "Left"
821
  msgstr ""
822
 
823
+ #: polldaddy.php:3380
824
  msgid "Center"
825
  msgstr ""
826
 
827
+ #: polldaddy.php:3380 polldaddy.php:3394
828
  msgid "Right"
829
  msgstr ""
830
 
831
+ #: polldaddy.php:3391
832
  msgid "Position"
833
  msgstr ""
834
 
835
+ #: polldaddy.php:3394
836
  msgid "Top"
837
  msgstr ""
838
 
839
+ #: polldaddy.php:3394
840
  msgid "Bottom"
841
  msgstr ""
842
 
843
+ #: polldaddy.php:3405
844
  msgid "Font"
845
  msgstr ""
846
 
847
+ #: polldaddy.php:3408 polldaddy.php:3427 polldaddy.php:3441
848
+ msgid "Inherit"
849
  msgstr ""
850
 
851
+ #: polldaddy.php:3419
852
+ msgid "Color"
853
  msgstr ""
854
 
855
+ #: polldaddy.php:3424
856
+ msgid "Size"
857
  msgstr ""
858
 
859
+ #: polldaddy.php:3438
860
  msgid "Line Height"
861
  msgstr ""
862
 
863
+ #: polldaddy.php:3452
864
  msgid "Bold"
865
  msgstr ""
866
 
867
+ #: polldaddy.php:3461
868
  msgid "Italic"
869
  msgstr ""
870
 
871
+ #: polldaddy.php:3630
872
  msgid "&laquo;"
873
  msgstr ""
874
 
875
+ #: polldaddy.php:3631
876
  msgid "&raquo;"
877
  msgstr ""
878
 
879
+ #: polldaddy.php:3637
880
  msgid "Rating Reports"
881
  msgstr ""
882
 
883
+ #: polldaddy.php:3652
884
  msgid "View Report"
885
  msgstr ""
886
 
887
+ #: polldaddy.php:3654
888
  msgid "Last 24 hours"
889
  msgstr ""
890
 
891
+ #: polldaddy.php:3654
892
  msgid "Last 7 days"
893
  msgstr ""
894
 
895
+ #: polldaddy.php:3654
896
  msgid "Last 31 days"
897
  msgstr ""
898
 
899
+ #: polldaddy.php:3654
900
  msgid "Last 3 months"
901
  msgstr ""
902
 
903
+ #: polldaddy.php:3654
904
  msgid "Last 12 months"
905
  msgstr ""
906
 
907
+ #: polldaddy.php:3654
908
  msgid "All time"
909
  msgstr ""
910
 
911
+ #: polldaddy.php:3662
912
  msgid "Filter Report"
913
  msgstr ""
914
 
915
+ #: polldaddy.php:3676
916
  #, php-format
917
  msgid "No ratings have been collected for your %s yet."
918
  msgstr ""
919
 
920
+ #: polldaddy.php:3682
921
  msgid "Start Date"
922
  msgstr ""
923
 
924
+ #: polldaddy.php:3683
925
  msgid "Title"
926
  msgstr ""
927
 
928
+ #: polldaddy.php:3685
929
  msgid "Average Rating"
930
  msgstr ""
931
 
932
+ #: polldaddy.php:3846
933
  msgid "PollDaddy Account Info"
934
  msgstr ""
935
 
936
+ #: polldaddy.php:3849
937
  msgid ""
938
  "This is the PollDadddy account you currently have imported into your "
939
  "WordPress account"
940
  msgstr ""
941
 
942
+ #: polldaddy.php:3880
943
  msgid "Import Account"
944
  msgstr ""
945
 
946
+ #: polldaddy.php:3886
947
  msgid "General Settings"
948
  msgstr ""
949
 
950
+ #: polldaddy.php:3894
951
  msgid "Default poll settings"
952
  msgstr ""
953
 
954
+ #: polldaddy.php:3903
955
  msgid "Multiple Choice"
956
  msgstr ""
957
 
958
+ #: polldaddy.php:3908
959
  msgid "Randomise Answers"
960
  msgstr ""
961
 
962
+ #: polldaddy.php:3918
963
  msgid "Sharing"
964
  msgstr ""
965
 
966
+ #: polldaddy.php:3922
967
  msgid "Show"
968
  msgstr ""
969
 
970
+ #: polldaddy.php:3923
971
  msgid "Hide"
972
  msgstr ""
973
 
974
+ #: polldaddy.php:3924
975
  msgid "Percentages"
976
  msgstr ""
977
 
978
+ #: polldaddy.php:3934
979
  msgid "Poll style"
980
  msgstr ""
981
 
982
+ #: polldaddy.php:3939
983
  msgid "Off"
984
  msgstr ""
985
 
986
+ #: polldaddy.php:3940
987
  msgid "Cookie"
988
  msgstr ""
989
 
990
+ #: polldaddy.php:3941
991
  msgid "Cookie & IP address"
992
  msgstr ""
993
 
994
+ #: polldaddy.php:3955
995
  msgid "Block expiration limit"
996
  msgstr ""
997
 
998
+ #: polldaddy.php:3967
999
  msgid "Save Options"
1000
  msgstr ""
1001
 
rating.php CHANGED
@@ -34,7 +34,7 @@ function polldaddy_show_rating_comments( $content ){
34
 
35
  function polldaddy_show_rating( $content ) {
36
  if ( !is_feed() && !is_attachment() ) {
37
- if ( is_single() || is_page() ) {
38
  global $post;
39
 
40
  if ( $post->ID > 0 ) {
@@ -53,7 +53,14 @@ function polldaddy_show_rating( $content ) {
53
  $rating_pos = (int) get_option( 'pd-rating-pages-pos' );
54
  $item_id = '_page_' . $post->ID;
55
  }
56
- } else {
 
 
 
 
 
 
 
57
  if ( (int) get_option( 'pd-rating-posts' ) > 0 ) {
58
  $rating_id = (int) get_option( 'pd-rating-posts' );
59
  $unique_id = 'wp-post-' . $post->ID;
@@ -82,8 +89,7 @@ function polldaddy_show_rating( $content ) {
82
  }
83
 
84
  function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
85
-
86
- $html = '<p><div class="pd-rating" id="pd_rating_holder_' . $rating_id . $item_id . '"></div></p>
87
  <script type="text/javascript">
88
  PDRTJS_settings_' . (int)$rating_id . $item_id . ' = {
89
  "id" : "' . (int)$rating_id . '",
@@ -95,11 +101,22 @@ function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink,
95
 
96
  $html .= ' "permalink" : "' . urlencode( clean_url( $permalink ) ) . '"';
97
  $html .= "\n }\n";
98
- $html .= '</script>';
99
 
100
  return $html;
101
  }
102
 
103
- add_filter( 'the_content', 'polldaddy_show_rating', 1 );
 
 
 
 
 
 
 
 
 
 
 
104
  add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
105
  ?>
34
 
35
  function polldaddy_show_rating( $content ) {
36
  if ( !is_feed() && !is_attachment() ) {
37
+ if ( is_single() || is_page() || is_home() ) {
38
  global $post;
39
 
40
  if ( $post->ID > 0 ) {
53
  $rating_pos = (int) get_option( 'pd-rating-pages-pos' );
54
  $item_id = '_page_' . $post->ID;
55
  }
56
+ } else if( is_home() ) {
57
+ if ( (int) get_option( 'pd-rating-posts-index' ) > 0 ) {
58
+ $rating_id = (int) get_option( 'pd-rating-posts-index' );
59
+ $unique_id = 'wp-post-' . $post->ID;
60
+ $rating_pos = (int) get_option( 'pd-rating-posts-index-pos' );
61
+ $item_id = '_post_' . $post->ID;
62
+ }
63
+ } else {
64
  if ( (int) get_option( 'pd-rating-posts' ) > 0 ) {
65
  $rating_id = (int) get_option( 'pd-rating-posts' );
66
  $unique_id = 'wp-post-' . $post->ID;
89
  }
90
 
91
  function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
92
+ $html = "\n".'<p><div class="pd-rating" id="pd_rating_holder_' . $rating_id . $item_id . '"></div></p>
 
93
  <script type="text/javascript">
94
  PDRTJS_settings_' . (int)$rating_id . $item_id . ' = {
95
  "id" : "' . (int)$rating_id . '",
101
 
102
  $html .= ' "permalink" : "' . urlencode( clean_url( $permalink ) ) . '"';
103
  $html .= "\n }\n";
104
+ $html .= "</script>\n";
105
 
106
  return $html;
107
  }
108
 
109
+ function polldaddy_show_rating_excerpt( $content ) {
110
+ remove_filter( 'the_content', 'polldaddy_show_rating', 5 );
111
+ return $content;
112
+ }
113
+
114
+ function polldaddy_show_rating_excerpt_for_real( $content ) {
115
+ return polldaddy_show_rating( $content );
116
+ }
117
+
118
+ add_filter( 'the_content', 'polldaddy_show_rating', 5 );
119
+ add_filter( 'get_the_excerpt', 'polldaddy_show_rating_excerpt', 5 );
120
+ add_filter( 'the_excerpt', 'polldaddy_show_rating_excerpt_for_real' );
121
  add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
122
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mdawaffe, eoigal
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 2.9.1
6
- Stable tag: 1.7.9
7
 
8
  Create and manage PollDaddy polls and ratings from within WordPress.
9
 
@@ -47,8 +47,14 @@ Yes. You'll be able to edit the polls they create from your blog. (You won't be
47
  Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
48
 
49
  == Change Log ==
 
 
 
 
 
 
50
  = 1.7.9 =
51
- * Bug Fix: Fixed typo in API request URL
52
 
53
  = 1.7.8 =
54
  * Added Options menu, that will allow users to set poll defaults settings, import another PollDaddy account and there is also a setting to allow each blog user to import their own PollDaddy account.
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 2.9.1
6
+ Stable tag: 1.8.0
7
 
8
  Create and manage PollDaddy polls and ratings from within WordPress.
9
 
47
  Nope. The permissions are the same as for posts. So Editors and Administrators can edit anyone's polls for that blog. Authors can only edit their own.
48
 
49
  == Change Log ==
50
+ = 1.8.0 =
51
+ * Added option to Rating settings to allow ratings on the front page.
52
+ * Added more phrases to the pot file.
53
+ * Added stylesheet for blos that have a right to left language.
54
+ * Bug Fix: Fixed javascript bug, clash with prototype in P2 theme, use of $ function.
55
+
56
  = 1.7.9 =
57
+ * Bug Fix: Fixed typo in API request URL.
58
 
59
  = 1.7.8 =
60
  * Added Options menu, that will allow users to set poll defaults settings, import another PollDaddy account and there is also a setting to allow each blog user to import their own PollDaddy account.