Version Description
SSL support and faster page loads
=
Download this release
Release Info
Developer | eoigal |
Plugin | Crowdsignal Dashboard – Polls, Surveys & more |
Version | 2.0.14 |
Comparing to | |
See all releases |
Code changes from version 2.0.13 to 2.0.14
- ajax.php +19 -14
- common.js +0 -112
- css/polldaddy-rtl.css +69 -0
- polldaddy.css → css/polldaddy.css +8 -10
- style-editor.css → css/style-editor.css +0 -0
- img/box-texture.png +0 -0
- img/draggy-handle.png +0 -0
- img/error-blue.png +0 -0
- img/error-gray.png +0 -0
- img/icon-clear-search.png +0 -0
- img/icon-reorder.png +0 -0
- img/icon-report-ip-analysis.png +0 -0
- img/pd-wp-icon-blue-lrg.png +0 -0
- img/pd-wp-icon-blue.png +0 -0
- img/pd-wp-icon-gray-lrg.png +0 -0
- img/pd-wp-icon-gray.png +0 -0
- img/pd-wp-icon.png +0 -0
- img/pd-wp-icons.png +0 -0
- polldaddy.png → img/polldaddy.png +0 -0
- img/rate-graph-dn.png +0 -0
- img/rate-graph-up.png +0 -0
- img/st-alum-light.png +0 -0
- img/st-loader.gif +0 -0
- img/st-manga.png +0 -0
- img/st-micro.png +0 -0
- img/st-music.png +0 -0
- img/st-paper.png +0 -0
- img/st-plain-dark.png +0 -0
- img/st-plain-light.png +0 -0
- img/st-plastic-black.png +0 -0
- img/st-plastic-grey.png +0 -0
- img/st-plastic-white.png +0 -0
- img/st-skull-dark.png +0 -0
- img/st-skull-light.png +0 -0
- img/st-sunset.png +0 -0
- img/st-tech-dark.png +0 -0
- img/st-tech-grey.png +0 -0
- img/st-tech-light.png +0 -0
- img/st-thinking-female.png +0 -0
- img/st-thinking-male.png +0 -0
- img/st-working-female.png +0 -0
- img/st-working-male.png +0 -0
- img/star-yellow-med.png +0 -0
- js/common.js +1 -0
- js/jscolor.js +1 -0
- js/poll-style-picker.js +1 -0
- js/polldaddy.js +1 -0
- js/rating.js +1 -0
- js/style-editor.js +1 -0
- polldaddy-client.php +7 -4
- polldaddy-org.php +261 -156
- polldaddy-rtl.css +0 -17
- polldaddy-xml.php +1 -0
- polldaddy.js +0 -244
- polldaddy.php +54 -34
- rating.php +11 -33
- readme.txt +13 -7
ajax.php
CHANGED
@@ -3,12 +3,7 @@
|
|
3 |
add_action( 'wp_ajax_myajax-submit', 'myajax_submit' );
|
4 |
|
5 |
class Polldaddy_Ajax {
|
6 |
-
|
7 |
-
function Polldaddy_Ajax() {
|
8 |
-
$this->__construct();
|
9 |
-
}
|
10 |
-
|
11 |
-
function __construct() {
|
12 |
// Catch AJAX
|
13 |
add_action( 'wp_ajax_polls_upload_image', array( &$this, 'ajax_upload_image' ) );
|
14 |
add_action( 'wp_ajax_polls_add_answer', array( &$this, 'ajax_add_answer' ) );
|
@@ -21,17 +16,20 @@ class Polldaddy_Ajax {
|
|
21 |
}
|
22 |
}
|
23 |
|
24 |
-
function ajax_upload_image() {
|
25 |
require_once dirname( __FILE__ ) . '/polldaddy-client.php';
|
26 |
|
27 |
check_admin_referer( 'send-media' );
|
28 |
|
29 |
-
$attach_id = $user_code = 0;
|
30 |
$name = $url = '';
|
31 |
|
32 |
if ( isset( $_POST['attach-id'] ) )
|
33 |
$attach_id = (int) $_POST['attach-id'];
|
34 |
|
|
|
|
|
|
|
35 |
if ( isset( $_POST['uc'] ) )
|
36 |
$user_code = $_POST['uc'];
|
37 |
|
@@ -39,16 +37,23 @@ class Polldaddy_Ajax {
|
|
39 |
$url = $_POST['url'];
|
40 |
|
41 |
$parts = pathinfo( $url );
|
42 |
-
$name = $parts['basename'];
|
43 |
$polldaddy = new api_client( WP_POLLDADDY__PARTNERGUID, $user_code );
|
44 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
if ( is_a( $response, "
|
47 |
-
echo urldecode( $response->upload_result ).'||'.$
|
48 |
die();
|
49 |
}
|
50 |
|
51 |
-
function ajax_add_answer() {
|
52 |
check_admin_referer( 'add-answer' );
|
53 |
|
54 |
$a = 0;
|
@@ -115,4 +120,4 @@ function polldaddy_ajax_init() {
|
|
115 |
}
|
116 |
|
117 |
add_action( 'init', 'polldaddy_ajax_init' );
|
118 |
-
?>
|
3 |
add_action( 'wp_ajax_myajax-submit', 'myajax_submit' );
|
4 |
|
5 |
class Polldaddy_Ajax {
|
6 |
+
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
7 |
// Catch AJAX
|
8 |
add_action( 'wp_ajax_polls_upload_image', array( &$this, 'ajax_upload_image' ) );
|
9 |
add_action( 'wp_ajax_polls_add_answer', array( &$this, 'ajax_add_answer' ) );
|
16 |
}
|
17 |
}
|
18 |
|
19 |
+
public function ajax_upload_image() {
|
20 |
require_once dirname( __FILE__ ) . '/polldaddy-client.php';
|
21 |
|
22 |
check_admin_referer( 'send-media' );
|
23 |
|
24 |
+
$attach_id = $media_id = $user_code = 0;
|
25 |
$name = $url = '';
|
26 |
|
27 |
if ( isset( $_POST['attach-id'] ) )
|
28 |
$attach_id = (int) $_POST['attach-id'];
|
29 |
|
30 |
+
if ( isset( $_POST['media-id'] ) )
|
31 |
+
$media_id = (int) $_POST['media-id'];
|
32 |
+
|
33 |
if ( isset( $_POST['uc'] ) )
|
34 |
$user_code = $_POST['uc'];
|
35 |
|
37 |
$url = $_POST['url'];
|
38 |
|
39 |
$parts = pathinfo( $url );
|
40 |
+
$name = preg_replace('/\?.*/', '', $parts['basename']);
|
41 |
$polldaddy = new api_client( WP_POLLDADDY__PARTNERGUID, $user_code );
|
42 |
+
$data = '';
|
43 |
+
|
44 |
+
if ( function_exists( 'is_private_blog' ) && is_private_blog() ) {
|
45 |
+
$file_path = get_attached_file( $attach_id );
|
46 |
+
$data = base64_encode( @file_get_contents($file_path) );
|
47 |
+
}
|
48 |
+
|
49 |
+
$response = $polldaddy->upload_image( $name, $url, 'poll', ($media_id>1000?$media_id:0), $data );
|
50 |
|
51 |
+
if ( is_a( $response, "PollDaddy_Media" ) )
|
52 |
+
echo urldecode( $response->upload_result ).'||'.$media_id;
|
53 |
die();
|
54 |
}
|
55 |
|
56 |
+
public function ajax_add_answer() {
|
57 |
check_admin_referer( 'add-answer' );
|
58 |
|
59 |
$a = 0;
|
120 |
}
|
121 |
|
122 |
add_action( 'init', 'polldaddy_ajax_init' );
|
123 |
+
?>
|
common.js
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
function _$(id) {
|
2 |
-
return document.getElementById(id)
|
3 |
-
}
|
4 |
-
function pd_style() {
|
5 |
-
this.name = '';
|
6 |
-
this.n_id = 0;
|
7 |
-
this.n_desc = '';
|
8 |
-
this.m_id = 0;
|
9 |
-
this.m_desc = '';
|
10 |
-
this.w_id = 0;
|
11 |
-
this.w_desc = '';
|
12 |
-
this.tag = ''
|
13 |
-
}
|
14 |
-
function preload_pd_style() {
|
15 |
-
if (_$('preload_value').value != '0') {
|
16 |
-
url = window.location.href;
|
17 |
-
fnd = '';
|
18 |
-
qs = window.location.search.substring(1);
|
19 |
-
qv = qs.split("&");
|
20 |
-
for (i = 0; i < qv.length; i++) {
|
21 |
-
ft = qv[i].split("=");
|
22 |
-
if (ft[0] == 'preload') {
|
23 |
-
fnd = '&preload=' + ft[1];
|
24 |
-
url = url.replace(fnd, '')
|
25 |
-
}
|
26 |
-
}
|
27 |
-
window.location = url + "&preload=" + _$('preload_value').value
|
28 |
-
}
|
29 |
-
}
|
30 |
-
function pd_bind(obj) {
|
31 |
-
if (obj.id == 'font_bold') {
|
32 |
-
if (obj.checked) {
|
33 |
-
PDRTJS_1.font_bold = 'bold';
|
34 |
-
PDRTJS_settings.font_bold = 'bold';
|
35 |
-
}
|
36 |
-
else {
|
37 |
-
PDRTJS_1.font_bold = 'normal';
|
38 |
-
PDRTJS_settings.font_bold = 'normal';
|
39 |
-
}
|
40 |
-
} else if (obj.id == 'font_italic') {
|
41 |
-
if (obj.checked) {
|
42 |
-
PDRTJS_1.font_italic = 'italic';
|
43 |
-
PDRTJS_settings.font_italic = 'italic';
|
44 |
-
}
|
45 |
-
else {
|
46 |
-
PDRTJS_1.font_italic = 'normal';
|
47 |
-
PDRTJS_settings.font_italic = 'normal';
|
48 |
-
}
|
49 |
-
} else if (obj.id == 'size_sml' || obj.id == 'size_med' || obj.id == 'size_lrg') {
|
50 |
-
PDRTJS_1.size = obj.value;
|
51 |
-
PDRTJS_settings.size = obj.value;
|
52 |
-
} else if (obj.id == 'nero_style') {
|
53 |
-
PDRTJS_1.star_color = obj.value;
|
54 |
-
PDRTJS_settings.star_color = obj.value;
|
55 |
-
} else if (obj.id == 'font_color') {
|
56 |
-
PDRTJS_1.font_color = obj.value;
|
57 |
-
PDRTJS_settings.font_color = obj.value;
|
58 |
-
} else if (obj.id == 'polldaddy-rating-popup') {
|
59 |
-
if (obj.checked) {
|
60 |
-
PDRTJS_1.popup = 'on';
|
61 |
-
PDRTJS_settings.popup = 'on';
|
62 |
-
_$('pd_popup_holder_1').style.width = '350px';
|
63 |
-
} else {
|
64 |
-
PDRTJS_1.popup = 'off';
|
65 |
-
PDRTJS_settings.popup = 'off';
|
66 |
-
_$('pd_popup_holder_1').style.width = '175px';
|
67 |
-
}
|
68 |
-
}
|
69 |
-
else {
|
70 |
-
eval('PDRTJS_1.' + obj.id + ' = "' + obj.value.replace('"', '"').replace("'", ''') + '";');
|
71 |
-
eval('PDRTJS_settings.' + obj.id + ' = "' + obj.value.replace('"', '"') + '";');
|
72 |
-
}
|
73 |
-
PDRTJS_1.build();
|
74 |
-
}
|
75 |
-
function pd_change_type(type) {
|
76 |
-
var dd_label = _$('editor_star_color_text');
|
77 |
-
var size_label = _$('editor_star_size_text');
|
78 |
-
var obj_star = _$('star_color');
|
79 |
-
var obj_nero = _$('nero_style');
|
80 |
-
if (type == 1) {
|
81 |
-
PDRTJS_1.type = 'nero';
|
82 |
-
PDRTJS_1.build();
|
83 |
-
dd_label.innerHTML = adminRatingsL10n.nero_type;
|
84 |
-
size_label.innerHTML = adminRatingsL10n.nero_size;
|
85 |
-
obj_star.style.display = 'none';
|
86 |
-
obj_nero.style.display = 'block';
|
87 |
-
pd_bind(obj_nero);
|
88 |
-
} else {
|
89 |
-
PDRTJS_1.type = 'stars';
|
90 |
-
PDRTJS_1.build();
|
91 |
-
dd_label.innerHTML = adminRatingsL10n.star_colors;
|
92 |
-
size_label.innerHTML = adminRatingsL10n.star_size;
|
93 |
-
obj_star.style.display = 'block';
|
94 |
-
obj_nero.style.display = 'none';
|
95 |
-
pd_bind(obj_star);
|
96 |
-
}
|
97 |
-
}
|
98 |
-
function show_options(id) {
|
99 |
-
if (_$('pd_show_' + id).checked == true) {
|
100 |
-
_$('span_' + id).style.display = 'inline-block';
|
101 |
-
} else {
|
102 |
-
_$('span_' + id).style.display = 'none';
|
103 |
-
}
|
104 |
-
}
|
105 |
-
function show_settings() {
|
106 |
-
var div = _$('poststuff');
|
107 |
-
if (div.style.display == 'block') {
|
108 |
-
div.style.display = 'none';
|
109 |
-
} else {
|
110 |
-
div.style.display = 'block';
|
111 |
-
}
|
112 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/polldaddy-rtl.css
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* NEW STYLES, 2.0+ ------------------------------------------------------------
|
2 |
+
---------------------------------------------------------------------------------------------------*/
|
3 |
+
h2 a.button{
|
4 |
+
font-family: Tahom, Arial, sans-serif;
|
5 |
+
}
|
6 |
+
|
7 |
+
#pd-wrap table td label.small{
|
8 |
+
padding-left:0;
|
9 |
+
padding-right:18px;
|
10 |
+
}
|
11 |
+
|
12 |
+
td#signup-button{
|
13 |
+
border-left: none;
|
14 |
+
border-right:1px #ebebeb solid;
|
15 |
+
}
|
16 |
+
|
17 |
+
.poll-votes.num.column-vote{
|
18 |
+
text-align:left;
|
19 |
+
}
|
20 |
+
|
21 |
+
ul#answer-options li label{
|
22 |
+
padding-left: 0;
|
23 |
+
padding-right: 5px;
|
24 |
+
}
|
25 |
+
|
26 |
+
ul.pd-tabs li{
|
27 |
+
float: right;
|
28 |
+
}
|
29 |
+
|
30 |
+
ul.pd-tabs li.selected{
|
31 |
+
margin-right: 0;
|
32 |
+
margin-left: 5px;
|
33 |
+
}
|
34 |
+
|
35 |
+
.pd-embed-col{
|
36 |
+
float: right;
|
37 |
+
}
|
38 |
+
|
39 |
+
.pd-label{
|
40 |
+
float:right;
|
41 |
+
}
|
42 |
+
|
43 |
+
.answer-media li{
|
44 |
+
padding-right: 0;
|
45 |
+
padding-left: 10px;
|
46 |
+
float: right;
|
47 |
+
}
|
48 |
+
|
49 |
+
.answer-media li:last-of-type{
|
50 |
+
padding-left: 0px;
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
/* OLD STYLES, PRE-2.0 ------------------------------------------------------------
|
55 |
+
---------------------------------------------------------------------------------------------------*/
|
56 |
+
body.poll-preview-iframe div#manage-polls.wrap{text-align:right;}
|
57 |
+
table.poll-results .column-vote{padding:3px 3px 3px 5px;}
|
58 |
+
table.poll-results span.result-total{right:.75em;left:auto;}
|
59 |
+
table.poll-results span.result-percent{right:auto;left:.75em;}
|
60 |
+
ul#answers input{float:right;margin-left: 3px; margin-right: 3px;}
|
61 |
+
p#add-answer-holder{text-align:right;padding-left:0;padding-right:10px}
|
62 |
+
.inner-sidebar-ratings{clear:left;float:left;}
|
63 |
+
#poststuff #post-body.has-sidebar,.has-sidebar{clear:right;float:right;margin-left:-240px;margin-right:0;}
|
64 |
+
.has-sidebar .has-sidebar-content{margin-left:245px;margin-right:0;}
|
65 |
+
tr.polldaddy-shortcode-row pre{float:right;}
|
66 |
+
tr.polldaddy-shortcode-row input{float:right;}
|
67 |
+
.st_selector .dir_left{padding:0 0 0 10px;}
|
68 |
+
.polldaddy-show-design-options,.pollStyle .customSelect,body.poll-preview-iframe div#manage-polls.wrap,#design h3,.pollStyle TH{text-align:right;}
|
69 |
+
#design_standard,.st_selector .dir_right{padding:0 20px 0 0;}
|
polldaddy.css → css/polldaddy.css
RENAMED
@@ -247,21 +247,19 @@ table.answer td.answer-media-icons ul, table.question td.answer-media-icons ul{
|
|
247 |
z-index: -1;
|
248 |
}
|
249 |
|
250 |
-
hardbreak {
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
}
|
257 |
-
|
258 |
-
|
259 |
|
260 |
|
261 |
/* OLD STYLES, PRE-2.0 ------------------------------------------------------------
|
262 |
---------------------------------------------------------------------------------------------------*/
|
263 |
body.poll-preview-iframe{min-width:0;}
|
264 |
-
body.poll-preview-iframe #sidemenu, body.poll-preview-iframe #submenu, body.poll-preview-iframe #
|
265 |
body.poll-preview-iframe h2{padding-top:0;}
|
266 |
body.poll-preview-iframe{margin:0 !important;padding:0 !important;}
|
267 |
body.poll-preview-iframe .wrap{max-width:100%;}
|
@@ -312,5 +310,5 @@ tr.polldaddy-shortcode-row input{float:left;background-color:#fff;border:1px sol
|
|
312 |
#st_image{width:150px;padding:0px;margin:0px;height:200px;}
|
313 |
#st_sizes{width:152px;text-align:center;font-size:12px;}
|
314 |
#st_sizes a{width:150px;text-align:center;font-size:12px;}
|
315 |
-
.st_image_loader{width:150px;padding:0px;margin:0px;background:url(
|
316 |
#st_description{padding:6px 0px;font-size:9px;width:300px;text-align:center;}
|
247 |
z-index: -1;
|
248 |
}
|
249 |
|
250 |
+
.hardbreak {
|
251 |
+
white-space: pre-wrap; /* css-3 */
|
252 |
+
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
253 |
+
white-space: -pre-wrap; /* Opera 4-6 */
|
254 |
+
white-space: -o-pre-wrap; /* Opera 7 */
|
255 |
+
word-wrap: break-word;
|
256 |
}
|
|
|
|
|
257 |
|
258 |
|
259 |
/* OLD STYLES, PRE-2.0 ------------------------------------------------------------
|
260 |
---------------------------------------------------------------------------------------------------*/
|
261 |
body.poll-preview-iframe{min-width:0;}
|
262 |
+
body.poll-preview-iframe #sidemenu, body.poll-preview-iframe #submenu, body.poll-preview-iframe #wpadminbar, body.poll-preview-iframe #wphead, body.poll-preview-iframe #gears-info-box, body.poll-preview-iframe #user_info, body.poll-preview-iframe #dashmenu, body.poll-preview-iframe #adminmenu, body.poll-preview-iframe #sidemenu-bg, body.poll-preview-iframe #footer, body.poll-preview-iframe #feedbacklink, body.poll-preview-iframe #screen-meta, body.poll-preview-iframe #manage-polls h2#preview-header{display:none;} body.poll-preview-iframe-editor #manage-polls h2#preview-header{display:block;}
|
263 |
body.poll-preview-iframe h2{padding-top:0;}
|
264 |
body.poll-preview-iframe{margin:0 !important;padding:0 !important;}
|
265 |
body.poll-preview-iframe .wrap{max-width:100%;}
|
310 |
#st_image{width:150px;padding:0px;margin:0px;height:200px;}
|
311 |
#st_sizes{width:152px;text-align:center;font-size:12px;}
|
312 |
#st_sizes a{width:150px;text-align:center;font-size:12px;}
|
313 |
+
.st_image_loader{width:150px;padding:0px;margin:0px;background:url(../img/st-loader.gif) no-repeat center center;}
|
314 |
#st_description{padding:6px 0px;font-size:9px;width:300px;text-align:center;}
|
style-editor.css → css/style-editor.css
RENAMED
File without changes
|
img/box-texture.png
CHANGED
Binary file
|
img/draggy-handle.png
CHANGED
Binary file
|
img/error-blue.png
CHANGED
Binary file
|
img/error-gray.png
CHANGED
Binary file
|
img/icon-clear-search.png
CHANGED
Binary file
|
img/icon-reorder.png
CHANGED
Binary file
|
img/icon-report-ip-analysis.png
ADDED
Binary file
|
img/pd-wp-icon-blue-lrg.png
CHANGED
Binary file
|
img/pd-wp-icon-blue.png
CHANGED
Binary file
|
img/pd-wp-icon-gray-lrg.png
CHANGED
Binary file
|
img/pd-wp-icon-gray.png
CHANGED
Binary file
|
img/pd-wp-icon.png
CHANGED
Binary file
|
img/pd-wp-icons.png
CHANGED
Binary file
|
polldaddy.png → img/polldaddy.png
RENAMED
File without changes
|
img/rate-graph-dn.png
ADDED
Binary file
|
img/rate-graph-up.png
ADDED
Binary file
|
img/st-alum-light.png
ADDED
Binary file
|
img/st-loader.gif
ADDED
Binary file
|
img/st-manga.png
ADDED
Binary file
|
img/st-micro.png
ADDED
Binary file
|
img/st-music.png
ADDED
Binary file
|
img/st-paper.png
ADDED
Binary file
|
img/st-plain-dark.png
ADDED
Binary file
|
img/st-plain-light.png
ADDED
Binary file
|
img/st-plastic-black.png
ADDED
Binary file
|
img/st-plastic-grey.png
ADDED
Binary file
|
img/st-plastic-white.png
ADDED
Binary file
|
img/st-skull-dark.png
ADDED
Binary file
|
img/st-skull-light.png
ADDED
Binary file
|
img/st-sunset.png
ADDED
Binary file
|
img/st-tech-dark.png
ADDED
Binary file
|
img/st-tech-grey.png
ADDED
Binary file
|
img/st-tech-light.png
ADDED
Binary file
|
img/st-thinking-female.png
ADDED
Binary file
|
img/st-thinking-male.png
ADDED
Binary file
|
img/st-working-female.png
ADDED
Binary file
|
img/st-working-male.png
ADDED
Binary file
|
img/star-yellow-med.png
ADDED
Binary file
|
js/common.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function _$(a){return document.getElementById(a)}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";PDRTJS_settings.font_bold="bold"}else{PDRTJS_1.font_bold="normal";PDRTJS_settings.font_bold="normal"}}else if(obj.id=="font_italic"){if(obj.checked){PDRTJS_1.font_italic="italic";PDRTJS_settings.font_italic="italic"}else{PDRTJS_1.font_italic="normal";PDRTJS_settings.font_italic="normal"}}else if(obj.id=="size_sml"||obj.id=="size_med"||obj.id=="size_lrg"){PDRTJS_1.size=obj.value;PDRTJS_settings.size=obj.value}else if(obj.id=="nero_style"){PDRTJS_1.star_color=obj.value;PDRTJS_settings.star_color=obj.value}else if(obj.id=="font_color"){PDRTJS_1.font_color=obj.value;PDRTJS_settings.font_color=obj.value}else if(obj.id=="polldaddy-rating-popup"){if(obj.checked){PDRTJS_1.popup="on";PDRTJS_settings.popup="on";_$("pd_popup_holder_1").style.width="350px"}else{PDRTJS_1.popup="off";PDRTJS_settings.popup="off";_$("pd_popup_holder_1").style.width="175px"}}else{eval('PDRTJS_1.' + obj.id + ' = "' + obj.value.replace('"', '"').replace("'", ''') + '";');eval('PDRTJS_settings.' + obj.id + ' = "' + obj.value.replace('"', '"') + '";');}PDRTJS_1.build()}function pd_change_type(a){var b=_$("editor_star_color_text");var c=_$("editor_star_size_text");var d=_$("star_color");var e=_$("nero_style");if(a==1){PDRTJS_1.type="nero";PDRTJS_1.build();b.innerHTML=adminRatingsL10n.nero_type;c.innerHTML=adminRatingsL10n.nero_size;d.style.display="none";e.style.display="block";pd_bind(e)}else{PDRTJS_1.type="stars";PDRTJS_1.build();b.innerHTML=adminRatingsL10n.star_colors;c.innerHTML=adminRatingsL10n.star_size;d.style.display="block";e.style.display="none";pd_bind(d)}}function show_options(a){if(_$("pd_show_"+a).checked==true){_$("span_"+a).style.display="inline-block"}else{_$("span_"+a).style.display="none"}}function show_settings(){var a=_$("poststuff");if(a.style.display=="block"){a.style.display="none"}else{a.style.display="block"}}
|
js/jscolor.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var jscolor={dir:("https:"==document.location.protocol?"https://polldaddy.com":"http://i0.poll.fm")+"/images/",bindClass:"jscolor",binding:true,preloading:true,install:function(){jscolor.addEvent(window,"load",jscolor.init)},init:function(){if(jscolor.binding){jscolor.bind()}if(jscolor.preloading){jscolor.preload()}},getDir:function(){if(!jscolor.dir){var a=jscolor.detectDir();jscolor.dir=a!==false?a:"jscolor/"}return jscolor.dir},detectDir:function(){var a=location.href;var b=document.getElementsByTagName("base");for(var c=0;c<b.length;c+=1){if(b[c].href){a=b[c].href}}var b=document.getElementsByTagName("script");for(var c=0;c<b.length;c+=1){if(b[c].src&&/(^|\/)jscolor\.js([?#].*)?$/i.test(b[c].src)){var d=new jscolor.URI(b[c].src);var e=d.toAbsolute(a);e.path=e.path.replace(/[^\/]+$/,"");e.query=null;e.fragment=null;return e.toString()}}return false},bind:function(){var matchClass=new RegExp("(^|\\s)("+jscolor.bindClass+")\\s*(\\{[^}]*\\})?","i");var e=document.getElementsByTagName("input");for(var i=0;i<e.length;i+=1){var m;if(!e[i].color&&e[i].className&&(m=e[i].className.match(matchClass))){var prop={};if(m[3]){try{eval("prop="+m[3])}catch(eInvalidProp){}}e[i].color=new jscolor.color(e[i],prop)}}},preload:function(){for(var a in jscolor.imgRequire){if(jscolor.imgRequire.hasOwnProperty(a)){jscolor.loadImage(a)}}},images:{pad:[181,101],sld:[16,101],cross:[15,15],arrow:[7,11]},imgRequire:{},imgLoaded:{},requireImage:function(a){jscolor.imgRequire[a]=true},loadImage:function(a){if(!jscolor.imgLoaded[a]){jscolor.imgLoaded[a]=new Image;jscolor.imgLoaded[a].src=jscolor.getDir()+a}},fetchElement:function(a){return typeof a==="string"?document.getElementById(a):a},addEvent:function(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else if(a.attachEvent){a.attachEvent("on"+b,c)}},fireEvent:function(a,b){if(!a){return}if(document.createEvent){var c=document.createEvent("HTMLEvents");c.initEvent(b,true,true);a.dispatchEvent(c)}else if(document.createEventObject){var c=document.createEventObject();a.fireEvent("on"+b,c)}else if(a["on"+b]){a["on"+b]()}},getElementPos:function(a){var b=a,c=a;var d=0,e=0;if(b.offsetParent){do{d+=b.offsetLeft;e+=b.offsetTop}while(b=b.offsetParent)}while((c=c.parentNode)&&c.nodeName.toUpperCase()!=="BODY"){d-=c.scrollLeft;e-=c.scrollTop}return[d,e]},getElementSize:function(a){return[a.offsetWidth,a.offsetHeight]},getRelMousePos:function(a){var b=0,c=0;if(!a){a=window.event}if(typeof a.offsetX==="number"){b=a.offsetX;c=a.offsetY}else if(typeof a.layerX==="number"){b=a.layerX;c=a.layerY}return{x:b,y:c}},getViewPos:function(){if(typeof window.pageYOffset==="number"){return[window.pageXOffset,window.pageYOffset]}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return[document.body.scrollLeft,document.body.scrollTop]}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return[document.documentElement.scrollLeft,document.documentElement.scrollTop]}else{return[0,0]}},getViewSize:function(){if(typeof window.innerWidth==="number"){return[window.innerWidth,window.innerHeight]}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return[document.body.clientWidth,document.body.clientHeight]}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return[document.documentElement.clientWidth,document.documentElement.clientHeight]}else{return[0,0]}},URI:function(a){function b(a){var b="";while(a){if(a.substr(0,3)==="../"||a.substr(0,2)==="./"){a=a.replace(/^\.+/,"").substr(1)}else if(a.substr(0,3)==="/./"||a==="/."){a="/"+a.substr(3)}else if(a.substr(0,4)==="/../"||a==="/.."){a="/"+a.substr(4);b=b.replace(/\/?[^\/]*$/,"")}else if(a==="."||a===".."){a=""}else{var c=a.match(/^\/?[^\/]*/)[0];a=a.substr(c.length);b=b+c}}return b}this.scheme=null;this.authority=null;this.path="";this.query=null;this.fragment=null;this.parse=function(a){var b=a.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);this.scheme=b[3]?b[2]:null;this.authority=b[5]?b[6]:null;this.path=b[7];this.query=b[9]?b[10]:null;this.fragment=b[12]?b[13]:null;return this};this.toString=function(){var a="";if(this.scheme!==null){a=a+this.scheme+":"}if(this.authority!==null){a=a+"//"+this.authority}if(this.path!==null){a=a+this.path}if(this.query!==null){a=a+"?"+this.query}if(this.fragment!==null){a=a+"#"+this.fragment}return a};this.toAbsolute=function(a){var a=new jscolor.URI(a);var c=this;var d=new jscolor.URI;if(a.scheme===null){return false}if(c.scheme!==null&&c.scheme.toLowerCase()===a.scheme.toLowerCase()){c.scheme=null}if(c.scheme!==null){d.scheme=c.scheme;d.authority=c.authority;d.path=b(c.path);d.query=c.query}else{if(c.authority!==null){d.authority=c.authority;d.path=b(c.path);d.query=c.query}else{if(c.path===""){d.path=a.path;if(c.query!==null){d.query=c.query}else{d.query=a.query}}else{if(c.path.substr(0,1)==="/"){d.path=b(c.path)}else{if(a.authority!==null&&a.path===""){d.path="/"+c.path}else{d.path=a.path.replace(/[^\/]+$/,"")+c.path}d.path=b(d.path)}d.query=c.query}d.authority=a.authority}d.scheme=a.scheme}d.fragment=c.fragment;return d};if(a){this.parse(a)}},color:function(a,b){function d(a,b,c){var d=Math.min(Math.min(a,b),c);var e=Math.max(Math.max(a,b),c);var f=e-d;if(f===0){return[null,0,e]}var g=a===d?3+(c-b)/f:b===d?5+(a-c)/f:1+(b-a)/f;return[g===6?0:g,f/e,e]}function e(a,b,c){if(a===null){return[c,c,c]}var d=Math.floor(a);var e=d%2?a-d:1-(a-d);var f=c*(1-b);var g=c*(1-b*e);switch(d){case 6:case 0:return[c,g,f];case 1:return[g,c,f];case 2:return[f,c,g];case 3:return[f,g,c];case 4:return[g,f,c];case 5:return[c,f,g]}}function f(){delete jscolor.picker.owner;document.getElementsByTagName("body")[0].removeChild(jscolor.picker.boxB)}function g(b,c){function m(){var a=p.pickerInsetColor.split(/\s+/);var b=a.length<2?a[0]:a[1]+" "+a[0]+" "+a[0]+" "+a[1];g.btn.style.borderColor=b}if(!jscolor.picker){jscolor.picker={box:document.createElement("div"),boxB:document.createElement("div"),pad:document.createElement("div"),padB:document.createElement("div"),padM:document.createElement("div"),sld:document.createElement("div"),sldB:document.createElement("div"),sldM:document.createElement("div"),btn:document.createElement("div"),btnS:document.createElement("span"),btnT:document.createTextNode(p.pickerCloseText)};for(var d=0,e=4;d<jscolor.images.sld[1];d+=e){var f=document.createElement("div");f.style.height=e+"px";f.style.fontSize="1px";f.style.lineHeight="0";jscolor.picker.sld.appendChild(f)}jscolor.picker.sldB.appendChild(jscolor.picker.sld);jscolor.picker.box.appendChild(jscolor.picker.sldB);jscolor.picker.box.appendChild(jscolor.picker.sldM);jscolor.picker.padB.appendChild(jscolor.picker.pad);jscolor.picker.box.appendChild(jscolor.picker.padB);jscolor.picker.box.appendChild(jscolor.picker.padM);jscolor.picker.btnS.appendChild(jscolor.picker.btnT);jscolor.picker.btn.appendChild(jscolor.picker.btnS);jscolor.picker.box.appendChild(jscolor.picker.btn);jscolor.picker.boxB.appendChild(jscolor.picker.box)}var g=jscolor.picker;g.box.onmouseup=g.box.onmouseout=function(){a.focus()};g.box.onmousedown=function(){r=true};g.box.onmousemove=function(a){if(u||v){u&&n(a);v&&o(a);if(document.selection){document.selection.empty()}else if(window.getSelection){window.getSelection().removeAllRanges()}}};g.padM.onmouseup=g.padM.onmouseout=function(){if(u){u=false;jscolor.fireEvent(s,"change")}};g.padM.onmousedown=function(a){u=true;n(a)};g.sldM.onmouseup=g.sldM.onmouseout=function(){if(v){v=false;jscolor.fireEvent(s,"change")}};g.sldM.onmousedown=function(a){v=true;o(a)};var k=h(p);g.box.style.width=k[0]+"px";g.box.style.height=k[1]+"px";g.boxB.style.position="absolute";g.boxB.style.clear="both";g.boxB.style.left=b+"px";g.boxB.style.top=c+"px";g.boxB.style.zIndex=p.pickerZIndex;g.boxB.style.border=p.pickerBorder+"px solid";g.boxB.style.borderColor=p.pickerBorderColor;g.boxB.style.background=p.pickerFaceColor;g.pad.style.width=jscolor.images.pad[0]+"px";g.pad.style.height=jscolor.images.pad[1]+"px";g.padB.style.position="absolute";g.padB.style.left=p.pickerFace+"px";g.padB.style.top=p.pickerFace+"px";g.padB.style.border=p.pickerInset+"px solid";g.padB.style.borderColor=p.pickerInsetColor;g.padM.style.position="absolute";g.padM.style.left="0";g.padM.style.top="0";g.padM.style.width=p.pickerFace+2*p.pickerInset+jscolor.images.pad[0]+jscolor.images.arrow[0]+"px";g.padM.style.height=g.box.style.height;g.padM.style.cursor="crosshair";g.sld.style.overflow="hidden";g.sld.style.width=jscolor.images.sld[0]+"px";g.sld.style.height=jscolor.images.sld[1]+"px";g.sldB.style.display=p.slider?"block":"none";g.sldB.style.position="absolute";g.sldB.style.right=p.pickerFace+"px";g.sldB.style.top=p.pickerFace+"px";g.sldB.style.border=p.pickerInset+"px solid";g.sldB.style.borderColor=p.pickerInsetColor;g.sldM.style.display=p.slider?"block":"none";g.sldM.style.position="absolute";g.sldM.style.right="0";g.sldM.style.top="0";g.sldM.style.width=jscolor.images.sld[0]+jscolor.images.arrow[0]+p.pickerFace+2*p.pickerInset+"px";g.sldM.style.height=g.box.style.height;try{g.sldM.style.cursor="pointer"}catch(l){g.sldM.style.cursor="hand"}g.btn.style.display=p.pickerClosable?"block":"none";g.btn.style.position="absolute";g.btn.style.left=p.pickerFace+"px";g.btn.style.bottom=p.pickerFace+"px";g.btn.style.padding="0 15px";g.btn.style.height="18px";g.btn.style.border=p.pickerInset+"px solid";m();g.btn.style.color=p.pickerButtonColor;g.btn.style.font="12px sans-serif";g.btn.style.textAlign="center";try{g.btn.style.cursor="pointer"}catch(l){g.btn.style.cursor="hand"}g.btn.onmousedown=function(){p.hidePicker()};g.btnS.style.lineHeight=g.btn.style.height;switch(q){case 0:var t="hs.png";break;case 1:var t="hv.png";break}g.padM.style.backgroundImage="url('"+jscolor.getDir()+"cross.gif')";g.padM.style.backgroundRepeat="no-repeat";g.sldM.style.backgroundImage="url('"+jscolor.getDir()+"arrow.gif')";g.sldM.style.backgroundRepeat="no-repeat";g.pad.style.backgroundImage="url('"+jscolor.getDir()+t+"')";g.pad.style.backgroundRepeat="no-repeat";g.pad.style.backgroundPosition="0 0";i();j();jscolor.picker.owner=p;document.getElementsByTagName("body")[0].appendChild(g.boxB)}function h(a){var b=[2*a.pickerInset+2*a.pickerFace+jscolor.images.pad[0]+(a.slider?2*a.pickerInset+2*jscolor.images.arrow[0]+jscolor.images.sld[0]:0),a.pickerClosable?4*a.pickerInset+3*a.pickerFace+jscolor.images.pad[1]+a.pickerButtonHeight:2*a.pickerInset+2*a.pickerFace+jscolor.images.pad[1]];return b}function i(){switch(q){case 0:var a=1;break;case 1:var a=2;break}var b=Math.round(p.hsv[0]/6*(jscolor.images.pad[0]-1));var c=Math.round((1-p.hsv[a])*(jscolor.images.pad[1]-1));jscolor.picker.padM.style.backgroundPosition=p.pickerFace+p.pickerInset+b-Math.floor(jscolor.images.cross[0]/2)+"px "+(p.pickerFace+p.pickerInset+c-Math.floor(jscolor.images.cross[1]/2))+"px";var d=jscolor.picker.sld.childNodes;switch(q){case 0:var f=e(p.hsv[0],p.hsv[1],1);for(var g=0;g<d.length;g+=1){d[g].style.backgroundColor="rgb("+f[0]*(1-g/d.length)*100+"%,"+f[1]*(1-g/d.length)*100+"%,"+f[2]*(1-g/d.length)*100+"%)"}break;case 1:var f,h,i=[p.hsv[2],0,0];var g=Math.floor(p.hsv[0]);var j=g%2?p.hsv[0]-g:1-(p.hsv[0]-g);switch(g){case 6:case 0:f=[0,1,2];break;case 1:f=[1,0,2];break;case 2:f=[2,0,1];break;case 3:f=[2,1,0];break;case 4:f=[1,2,0];break;case 5:f=[0,2,1];break}for(var g=0;g<d.length;g+=1){h=1-1/(d.length-1)*g;i[1]=i[0]*(1-h*j);i[2]=i[0]*(1-h);d[g].style.backgroundColor="rgb("+i[f[0]]*100+"%,"+i[f[1]]*100+"%,"+i[f[2]]*100+"%)"}break}}function j(){switch(q){case 0:var a=2;break;case 1:var a=1;break}var b=Math.round((1-p.hsv[a])*(jscolor.images.sld[1]-1));jscolor.picker.sldM.style.backgroundPosition="0 "+(p.pickerFace+p.pickerInset+b-Math.floor(jscolor.images.arrow[1]/2))+"px"}function k(){return jscolor.picker&&jscolor.picker.owner===p}function l(){if(s===a){p.importColor()}if(p.pickerOnfocus){p.hidePicker()}}function m(){if(s!==a){p.importColor()}}function n(a){var b=jscolor.getRelMousePos(a);var c=b.x-p.pickerFace-p.pickerInset;var d=b.y-p.pickerFace-p.pickerInset;switch(q){case 0:p.fromHSV(c*(6/(jscolor.images.pad[0]-1)),1-d/(jscolor.images.pad[1]-1),null,z);break;case 1:p.fromHSV(c*(6/(jscolor.images.pad[0]-1)),null,1-d/(jscolor.images.pad[1]-1),z);break}}function o(a){var b=jscolor.getRelMousePos(a);var c=b.y-p.pickerFace-p.pickerInset;switch(q){case 0:p.fromHSV(null,null,1-c/(jscolor.images.sld[1]-1),y);break;case 1:p.fromHSV(null,1-c/(jscolor.images.sld[1]-1),null,y);break}}this.required=true;this.adjust=true;this.hash=false;this.caps=true;this.slider=true;this.valueElement=a;this.styleElement=a;this.hsv=[0,0,1];this.rgb=[1,1,1];this.styleElement=false;this.pickerOnfocus=true;this.pickerMode="HSV";this.pickerPosition="bottom";this.pickerButtonHeight=20;this.pickerClosable=false;this.pickerCloseText="Close";this.pickerButtonColor="ButtonText";this.pickerFace=10;this.pickerFaceColor="ThreeDFace";this.pickerBorder=1;this.pickerBorderColor="ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight";this.pickerInset=1;this.pickerInsetColor="ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow";this.pickerZIndex=1e4;for(var c in b){if(b.hasOwnProperty(c)){this[c]=b[c]}}this.hidePicker=function(){if(k()){f()}};this.showPicker=function(){if(!k()){var b=jscolor.getElementPos(a);var c=jscolor.getElementSize(a);var d=jscolor.getViewPos();var e=jscolor.getViewSize();var f=h(this);var i,j,l;switch(this.pickerPosition.toLowerCase()){case"left":i=1;j=0;l=-1;break;case"right":i=1;j=0;l=1;break;case"top":i=0;j=1;l=-1;break;default:i=0;j=1;l=1;break}var m=(c[j]+f[j])/2;var n=[-d[i]+b[i]+f[i]>e[i]?-d[i]+b[i]+c[i]/2>e[i]/2&&b[i]+c[i]-f[i]>=0?b[i]+c[i]-f[i]:b[i]:b[i],-d[j]+b[j]+c[j]+f[j]-m+m*l>e[j]?-d[j]+b[j]+c[j]/2>e[j]/2&&b[j]+c[j]-m-m*l>=0?b[j]+c[j]-m-m*l:b[j]+c[j]-m+m*l:b[j]+c[j]-m+m*l>=0?b[j]+c[j]-m+m*l:b[j]+c[j]-m-m*l];g(n[i],n[j])}};this.importColor=function(){if(!s){this.exportColor()}else{if(!this.adjust){if(!this.fromString(s.value,w)){t.style.backgroundColor=t.jscStyle.backgroundColor;t.style.color=t.jscStyle.color;this.exportColor(w|x)}}else if(!this.required&&/^\s*$/.test(s.value)){s.value="";t.style.backgroundColor=t.jscStyle.backgroundColor;t.style.color=t.jscStyle.color;this.exportColor(w|x)}else if(this.fromString(s.value)){}else{this.exportColor()}}};this.exportColor=function(a){if(!(a&w)&&s){var b=this.toString();if(this.caps){b=b.toUpperCase()}if(this.hash){b="#"+b}s.value=b}if(!(a&x)&&t){t.style.backgroundColor="#"+this.toString();t.style.color=.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]<.5?"#FFF":"#000"}if(!(a&y)&&k()){i()}if(!(a&z)&&k()){j()}};this.fromHSV=function(a,b,c,d){a<0&&(a=0)||a>6&&(a=6);b<0&&(b=0)||b>1&&(b=1);c<0&&(c=0)||c>1&&(c=1);this.rgb=e(a===null?this.hsv[0]:this.hsv[0]=a,b===null?this.hsv[1]:this.hsv[1]=b,c===null?this.hsv[2]:this.hsv[2]=c);this.exportColor(d)};this.fromRGB=function(a,b,c,e){a<0&&(a=0)||a>1&&(a=1);b<0&&(b=0)||b>1&&(b=1);c<0&&(c=0)||c>1&&(c=1);var f=d(a===null?this.rgb[0]:this.rgb[0]=a,b===null?this.rgb[1]:this.rgb[1]=b,c===null?this.rgb[2]:this.rgb[2]=c);if(f[0]!==null){this.hsv[0]=f[0]}if(f[2]!==0){this.hsv[1]=f[1]}this.hsv[2]=f[2];this.exportColor(e)};this.fromString=function(a,b){var c=a.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);if(!c){return false}else{if(c[1].length===6){this.fromRGB(parseInt(c[1].substr(0,2),16)/255,parseInt(c[1].substr(2,2),16)/255,parseInt(c[1].substr(4,2),16)/255,b)}else{this.fromRGB(parseInt(c[1].charAt(0)+c[1].charAt(0),16)/255,parseInt(c[1].charAt(1)+c[1].charAt(1),16)/255,parseInt(c[1].charAt(2)+c[1].charAt(2),16)/255,b)}return true}};this.toString=function(){return(256|Math.round(255*this.rgb[0])).toString(16).substr(1)+(256|Math.round(255*this.rgb[1])).toString(16).substr(1)+(256|Math.round(255*this.rgb[2])).toString(16).substr(1)};var p=this;var q=this.pickerMode.toLowerCase()==="hvs"?1:0;var r=false;var s=jscolor.fetchElement(this.valueElement),t=jscolor.fetchElement(this.styleElement);var u=false,v=false;var w=1<<0,x=1<<1,y=1<<2,z=1<<3;jscolor.addEvent(a,"focus",function(){if(p.pickerOnfocus){p.showPicker()}});jscolor.addEvent(a,"blur",function(){if(!r){window.setTimeout(function(){r||l();r=false},0)}else{r=false}});if(s){var A=function(){p.fromString(s.value,w)};jscolor.addEvent(s,"keyup",A);jscolor.addEvent(s,"input",A);jscolor.addEvent(s,"blur",m);s.setAttribute("autocomplete","off")}if(t){t.jscStyle={backgroundColor:t.style.backgroundColor,color:t.style.color}}switch(q){case 0:jscolor.requireImage("hs.png");break;case 1:jscolor.requireImage("hv.png");break}jscolor.requireImage("cross.gif");jscolor.requireImage("arrow.gif");this.importColor()}};jscolor.install();
|
js/poll-style-picker.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function pd_build_styles(a){var b=styles_array[a];_$("st_name").innerHTML=b.name;var c="";if(style_id==0){if(b.m_id>0){style_id=b.m_id}else if(b.w_id>0){style_id=b.w_id}else if(b.n_id>0){style_id=b.n_id}}if(b.w_id>0){if(style_id==b.w_id){c+=pd_map.wide+" | ";if(b.w_desc==""){_$("st_description").innerHTML=pd_map.style_desc_wide}else{_$("st_description").innerHTML=b.w_desc}}else{c+='<a href="javascript:pd_change_style('+b.w_id+');">'+pd_map.wide+"</a> | "}}if(b.m_id>0){if(style_id==b.m_id){c+=pd_map.medium+" ";if(b.n_id>0){c+=" | "}if(b.m_desc==""){_$("st_description").innerHTML=pd_map.style_desc_medium}else{_$("st_description").innerHTML=b.m_desc}}else{c+='<a href="javascript:pd_change_style('+b.m_id+');">'+pd_map.medium+"</a>";if(b.n_id>0){c+=" | "}}}if(b.n_id>0){if(style_id==b.n_id){c+=pd_map.narrow+" ";if(b.n_desc==""){_$("st_description").innerHTML=pd_map.style_desc_narrow}else{_$("st_description").innerHTML=b.n_desc}}else{c+='<a href="javascript:pd_change_style('+b.n_id+');">'+pd_map.narrow+"</a> "}}_$("st_sizes").innerHTML=c;_$("st_number").innerHTML=a+1+" of "+styles_array.length;_$("st_image").style.background="url( "+pd_map.image_path+"/"+b.tag+".png) no-repeat top left";_$("regular").checked=true;_$("styleID").value=style_id}function pd_pick_style(a){found=false;for(x=0;x<=styles_array.length-1;x++){if(styles_array[x].n_id==a||styles_array[x].m_id==a||styles_array[x].w_id==a){current_pos=x;pd_change_style(a);found=true;break}}if(!found){current_pos=0;pd_build_styles(current_pos)}}function pd_change_style(a){style_id=a;if(style_id<1e3){_$("regular").checked=true;pd_build_styles(current_pos)}else{_$("custom").checked=true}_$("styleID").value=style_id}function pd_move(a){if(a=="next"){if(styles_array.length<=current_pos+1){current_pos=0}else{current_pos=current_pos+1}}else if(a=="prev"){if(current_pos==0){current_pos=styles_array.length-1}else{current_pos=current_pos-1}}style_id=0;pd_build_styles(current_pos)}function st_results(a,b){if(b=="show"){a.style.backgroundPosition="top right"}else if(b=="hide"){a.style.backgroundPosition="top left"}}var pd_map={wide:"Wide",medium:"Medium",narrow:"Narrow",style_desc_wide:"Width: 630px, the wide style is good for blog posts.",style_desc_medium:"Width: 300px, the medium style is good for general use.",style_desc_narrow:"Width 150px, the narrow style is good for sidebars etc.",style_desc_micro:"Width 150px, the micro style is useful when space is tight.",image_path:""};var styles_array=new Array;var s=new pd_style;s.name="Aluminum";s.n_id=101;s.m_id=102;s.w_id=103;s.tag="st-alum-light";styles_array.push(s);var s=new pd_style;s.name="Plain White";s.n_id=104;s.m_id=105;s.w_id=106;s.tag="st-plain-light";styles_array.push(s);var s=new pd_style;s.name="Plain Black";s.n_id=107;s.m_id=108;s.w_id=109;s.tag="st-plain-dark";styles_array.push(s);var s=new pd_style;s.name="Paper";s.n_id=110;s.m_id=111;s.w_id=112;s.tag="st-paper";styles_array.push(s);var s=new pd_style;s.name="Skull Dark";s.n_id=113;s.m_id=114;s.w_id=115;s.tag="st-skull-dark";styles_array.push(s);var s=new pd_style;s.name="Skull Light";s.n_id=116;s.m_id=117;s.w_id=118;s.tag="st-skull-light";styles_array.push(s);var s=new pd_style;s.name="Micro";s.n_id=157;s.n_desc=pd_map.style_desc_micro;s.tag="st-micro";styles_array.push(s);var s=new pd_style;s.name="Plastic White";s.n_id=119;s.m_id=120;s.w_id=121;s.tag="st-plastic-white";styles_array.push(s);var s=new pd_style;s.name="Plastic Grey";s.n_id=122;s.m_id=123;s.w_id=124;s.tag="st-plastic-grey";styles_array.push(s);var s=new pd_style;s.name="Plastic Black";s.n_id=125;s.m_id=126;s.w_id=127;s.tag="st-plastic-black";styles_array.push(s);var s=new pd_style;s.name="Manga";s.n_id=128;s.m_id=129;s.w_id=130;s.tag="st-manga";styles_array.push(s);var s=new pd_style;s.name="Tech Dark";s.n_id=131;s.m_id=132;s.w_id=133;s.tag="st-tech-dark";styles_array.push(s);var s=new pd_style;s.name="Tech Grey";s.n_id=134;s.m_id=135;s.w_id=136;s.tag="st-tech-grey";styles_array.push(s);var s=new pd_style;s.name="Tech Light";s.n_id=137;s.m_id=138;s.w_id=139;s.tag="st-tech-light";styles_array.push(s);var s=new pd_style;s.name="Working Male";s.n_id=140;s.m_id=141;s.w_id=142;s.tag="st-working-male";styles_array.push(s);var s=new pd_style;s.name="Working Female";s.n_id=143;s.m_id=144;s.w_id=145;s.tag="st-working-female";styles_array.push(s);var s=new pd_style;s.name="Thinking Male";s.n_id=146;s.m_id=147;s.w_id=148;s.tag="st-thinking-male";styles_array.push(s);var s=new pd_style;s.name="Thinking Female";s.n_id=149;s.m_id=150;s.w_id=151;s.tag="st-thinking-female";styles_array.push(s);var s=new pd_style;s.name="Sunset";s.n_id=152;s.m_id=153;s.w_id=154;s.tag="st-sunset";styles_array.push(s);var s=new pd_style;s.name="Music";s.n_id=155;s.m_id=156;s.tag="st-music";styles_array.push(s);var style_id=0;
|
js/polldaddy.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(function(a){if(typeof window.$=="undefined"){window.$=jQuery}Plugin=function(b){function c(a,b){return false}function d(){return"https:"==document.location.protocol?true:false}function e(){a(".image").unbind("click").click(function(){var b=a(this).attr("id").replace("add_poll_image","");tb_show("Add an Image","media-upload.php?type=image&&polls_media=1TB_iframe=1");l.send_to_editor=function(c){var e=a("<div/>").html(c);img=e.find("img");attach_id=0;url=img.attr("src");if(d())url=url.replace("http://","https://");match=img.attr("class").match(/wp-image-(\d+)/);if(a.isArray(match)&&match[1]!==undefined)attach_id=match[1];tb_remove();f(url,b,attach_id)};return false});a(".video").unbind("click").click(function(){var b=a(this).attr("id").replace("add_poll_video","");tb_show("Add Video","media-upload.php?type=video&tab=type_url&polls_media=1&TB_iframe=1");l.send_to_editor=function(a){tb_remove();g(b,a,'<img height="16" width="16" src="images/icon-report-ip-analysis.png" alt="Video Embed">')};return false});a(".audio").unbind("click").click(function(){var b=a(this).attr("id").replace("add_poll_audio","");tb_show("Add Audio","media-upload.php?type=audio&polls_media=1&TB_iframe=1");l.send_to_editor=function(c){var e=a("<div/>").html(c);img=e.find("img");attach_id=0;url=img.attr("src");if(d())url=url.replace("http://","https://");match=img.attr("class").match(/wp-image-(\d+)/);if(a.isArray(match)&&match[1]!==undefined)attach_id=match[1];tb_remove();f(url,b,attach_id)};return false})}function f(b,c,d){if(p==true)return false;p=true;a('input[name="media['+c+']"]').parents("td").find(".media-preview").addClass("st_image_loader");a("form[name=send-media] input[name=media-id]").val(c);a("form[name=send-media] input[name=attach-id]").val(d);a("form[name=send-media] input[name=url]").val(b);a("form[name=send-media] input[name=action]").val("polls_upload_image");a("form[name=send-media]").ajaxSubmit(function(a){p=false;a=a.replace(/<div.*/,"");if(a.substr(0,4)=="true"){var b=a.split("||");g(b[4],b[1],b[2])}});return false}function g(b,c,e){if(parseInt(c)>0)a('input[name="mediaType['+b+']"]').val(1);else a('input[name="mediaType['+b+']"]').val(2);if(d())e.replace("http://","https://");a('input[name="media['+b+']"]').val(c);a('input[name="media['+b+']"]').parents("td.answer-media-icons").find("li.media-preview").removeClass("st_image_loader");a('input[name="media['+b+']"]').parents("td.answer-media-icons").find("li.media-preview").html(e)}function h(){var b=parseInt(a(".answer").size());a("input.answer-text").each(function(){var c=this;if(a(c).val()==i.new_answer||a(c).hasClass("idle"))b--});return b}var i=a.extend({delete_rating:'Are you sure you want to delete the rating for "%s"?',delete_poll:'Are you sure you want to delete "%s"?',delete_answer:"Are you sure you want to delete this answer?",new_answer:"Enter an answer here",delete_answer_title:"delete this answer",reorder_answer_title:"click and drag to reorder",add_image_title:"Add an Image",add_audio_title:"Add Audio",add_video_title:"Add Video",standard_styles:"Standard Styles",custom_styles:"Custom Styles"},b);a(".hide-if-js").hide();a(".empty-if-js").empty();a(".hide-if-no-js").removeClass("hide-if-no-js");a(".polldaddy-shortcode-row pre").click(function(){var b=a(this)[0];if(a.browser.msie){var c=document.body.createTextRange();c.moveToElementText(b);c.select()}else if(a.browser.mozilla||a.browser.opera){var d=window.getSelection();var c=document.createRange();c.selectNodeContents(b);d.removeAllRanges();d.addRange(c)}else if(a.browser.safari){var d=window.getSelection();d.setBaseAndExtent(b,0,b,1)}});a("input#shortcode-field").click(function(){a(this).select()});a("a.delete-rating").click(function(){return confirm(i.delete_rating.replace("%s",a(this).parents("td").find("strong").text()))});a("a.delete-poll").click(function(){return confirm(i.delete_poll.replace("%s",a(this).parents("td").find("strong").text()))});a("span.view a.thickbox").attr("href",function(){return a(this).attr("href")+"&iframe&TB_iframe=true"});var j=function(b){a("a.delete-answer",b||null).click(function(){if(confirm(i.delete_answer)){a(this).parents("li").remove();a("#choices option:last-child").remove()}return false})};j();a("#answers").sortable({axis:"y",containment:"parent",handle:".handle",tolerance:"pointer"});var k=false;a("#add-answer-holder").show().find("button").click(function(){if(!k){k=true;var b=(1+h()).toString();var c=a(this).closest("p").attr("class");a("form[name=add-answer] input[name=aa]").val(b);a("form[name=add-answer] input[name=src]").val(c);a("form[name=add-answer] input[name=action]").val("polls_add_answer");a("form[name=add-answer]").ajaxSubmit(function(c){j(a("#answers").append(c).find("li:last"));a("#choices").append('<option value="'+(b-1)+'">'+(b-1)+"</option>");k=false;e()})}return false});var l=window.dialogArguments||opener||parent||top;a(".polldaddy-send-to-editor").click(function(){var b=a(this).parents("div.row-actions").find(".polldaddy-poll-id").val();if(!b)b=a(".polldaddy-poll-id:first").val();if(b){b=parseInt(b);if(b>0){l.send_to_editor("[polldaddy poll="+b.toString()+"]")}}});a(".polldaddy-show-shortcode").toggle(function(b){b.preventDefault();a(this).parents("tr:first").next("tr").fadeIn();a(this).parents("tr:first").next("tr").show();a(this).closest("tr").css("display","none");return false},function(){a(this).parents("tr:first").next("tr").fadeOut();a(this).parents("tr:first").next("tr").hide();return false});a(".pd-embed-done").click(function(b){b.preventDefault();a(this).closest("tr").hide();a(this).closest("tr").prev("tr").show()});a(".pd-tabs a").click(function(){if(!jQuery(this).closest("li").hasClass("selected")){jQuery(".pd-tabs li").removeClass("selected");jQuery(this).closest("li").addClass("selected");jQuery(".pd-tab-panel").removeClass("show");jQuery(".pd-tab-panel#"+a(this).closest("li").attr("id")+"-panel").addClass("show")}});var m=a(":input[name=styleID]");var n=a(":input[name=customSelect]");var o=parseInt(n.val());if(o>0){m.val(o.toString());a("#pd-custom-styles a").click()}a("#multipleChoice").click(function(){if(a("#multipleChoice").is(":checked")){a("#numberChoices").show("fast")}else{a("#numberChoices").hide("fast")}});a(".block-repeat").click(function(){var b=jQuery(this).val();if(b=="off"){a("#cookieip_expiration_label").hide();a("#cookieip_expiration").hide()}else{a("#cookieip_expiration_label").show();a("#cookieip_expiration").show()}});var p=false;e();var q={add_media:g};return q}});
|
js/rating.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function PDRTJS_url_encode(a){return encodeURIComponent(a).replace(/\%20/g,"+").replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\~/g,"%7E")}function PDRTJS_is_defined(a){return typeof a=="undefined"?false:true}function PDRTJS_RATING(settings){function $(a){return document.getElementById(a)}var server=("https:"==document.location.protocol?"https:":"http:")+"//polldaddy.com";for(var property in settings){this[property]=settings[property]}var pc='<p style="padding: 0px; margin: 0px; clear: both;"></p>';var c=0;var token="";this.make_call=function(a){if(this.override!=null){a=a+"&override=true"}var b=document.createElement("SCRIPT");b.charset="utf-8";b.src=server+a;var c=document.getElementsByTagName("head").item(0);c.appendChild(b)};this.callback=function(a,b,c,d,e,f){if(this.callback_url!=null){true_callback_url=this.callback_url.replace(/{id}/,a);true_callback_url=true_callback_url.replace(/{unique_id}/,b);true_callback_url=true_callback_url.replace(/{type}/,c);true_callback_url=true_callback_url.replace(/{r}/,d);true_callback_url=true_callback_url.replace(/{voter_id}/,e);if(c=="stars"){true_callback_url=true_callback_url.replace(/{scores}/,this.votes+","+this.avg_rating)}else{true_callback_url=true_callback_url.replace(/{scores}/,this.nero_up+","+this.nero_dn)}if(f){true_callback_url=true_callback_url+"&change=true"}var g=document.createElement("SCRIPT");g.charset="utf-8";g.src=true_callback_url;var h=document.getElementsByTagName("head").item(0);h.appendChild(g)}};this.get_rating=function(){this.varname="PDRTJS_"+this.id+this.item_id;this.make_call("/ratings/rate.php?cmd=get&id="+this.id+"&uid="+this.unique_id+"&item_id="+this.item_id)};this.init=function(){eval("settings = PDRTJS_settings_"+this.id+this.item_id+";");for(var property in settings){this[property]=settings[property]}this.build()};this.build=function(){this.font=this.font_italic+" "+this.font_bold+" "+this.font_size+"/"+this.font_line_height+" "+this.font_family;var a=$("pd_rating_holder_"+this.id+this.item_id);a.style.display="inline-block";this.star_margin="1px";if(this.custom_star.length>0){this.star_image=this.custom_star;this.star_margin="1px"}else{if(this.type=="stars"){this.star_image=(this.is_secure()?"https://polldaddy.com":"http://i0.poll.fm")+"/ratings/images/star-"+this.star_color+"-"+this.size+".png"}else{this.star_image=(this.is_secure()?"https://polldaddy.com":"http://i0.poll.fm")+"/ratings/images/nero-"+this.star_color+"-"+this.size+".png"}}this.image_size="16px";if(this.size=="med"){this.image_size="20px"}else{if(this.size=="lrg"){this.image_size="24px"}}if(this.type=="stars"){var b="";var c="";var d="bottom left";var e=this.text_rate_this;if(this.votes>0){d="top left";e=this.votes+" ";if(this.votes==1&&typeof this.text_vote!="undefined"){e+=this.text_vote}else{e+=this.text_votes}}if(this.font_position=="right"){c='<div id="'+this.varname+'_msg" style="float:left; padding-left: 5px; text-align: '+this.font_align+"; font:"+this.font+"; color: #"+this.font_color+';">'+e+"</div>"}else{c='<div id="'+this.varname+'_msg" style="text-align: '+this.font_align+";font:"+this.font+";color: #"+this.font_color+';">'+e+"</div>"}if(this.font_position=="top"){b+=c+pc}b+='<div id="pd_rate_'+this.id+this.item_id+'" style="float:left;">';for(h=1;h<=5;h++){if(this.avg_rating>0){if(this.avg_rating<h){d="bottom left"}if(this.avg_rating==h-1+.5){d="center left"}}b+='<div onmouseout="'+this.varname+'.rebuild();" onclick="'+this.varname+".rate("+h+');" onmouseover="'+this.varname+".hover("+h+');" id="'+this.varname+"_stars_"+h+'" style="cursor: pointer; width: '+this.image_size+"; height: "+this.image_size+"; line-height: "+this.image_size+"; background: url("+this.star_image+") "+d+"; float: left; padding: 0px; marging: 0px; margin-right: "+this.star_margin+';"> </div>'}b+="</div>"}else{var b="";var c="";var f="bottom";var g="left";var e=new Array;e[0]=this.text_rate_this;e[1]="";e[2]="";var h=0;if(this.nero_up!=null){e[1]=this.nero_up}else{this.nero_up=0;e[1]="0"}if(this.nero_dn!=null){e[2]=this.nero_dn}else{this.nero_dn=0;e[2]="0"}if(this.font_position=="right"){c='<div id="'+this.varname+'_msg" style="float:left; padding-left: 5px; text-align: '+this.font_align+"; font:"+this.font+"; color: #"+this.font_color+';">'+e[0]+"</div>"}else{c='<div id="'+this.varname+'_msg" style="text-align: '+this.font_align+"; font:"+this.font+"; color: #"+this.font_color+';">'+e[0]+"</div>"}if(this.font_position=="top"){b+=c+pc}b+='<div id="pd_rate_'+this.id+this.item_id+'" style="float:left;">';for(h=1;h<=2;h++){if(h==2){g="right"}b+='<div onmouseout="'+this.varname+'.rebuild();" onclick="'+this.varname+".rate("+h+');" onmouseover="'+this.varname+".hover("+h+');" id="'+this.varname+"_nero_"+h+'" style="cursor: pointer; width: '+this.image_size+"; height: "+this.image_size+"; line-height: "+this.image_size+"; background: url("+this.star_image+") "+f+" "+g+'; float: left; padding: 0px; marging: 0px; margin: 0px;"> </div>';b+='<div id="'+this.varname+"_msg_"+h+'" style="text-align: center; font:'+this.font+"; color: #"+this.font_color+'; float:left; padding: 0px 4px;">'+e[h]+"</div>"}b+="</div>"}b+=this.buildPopup();if(this.font_position=="bottom"){b+=pc+c+pc}else{if(this.font_position=="right"){b+=c+pc}}a.innerHTML=b+'<img src="'+(this.is_secure()?"https:":"http:")+'//pixel.quantserve.com/pixel/p-ab3gTb8xb3dLg.gif" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/>'};this.buildPopup=function(){var a=true;if(this.popup=="off"){a=false;this.get_results(99)}if($("pd_popup_holder_"+this.id+this.item_id)==null){var b="#pd_popup_holder_"+this.id+this.item_id+" { position:absolute; display:none; width:"+(a?"350":"175")+"px; height:auto; top:0px; left:0px; z-index:10000; border:solid 1px #CCC; background-color:white; padding:0px 15px;font-family:Arial,Sans;box-shadow: -10px 10px 20px rgba(0, 0, 0, .5);-webkit-box-shadow: 0px 0px 6px rgba(0, 0, 0, .25);-moz-box-shadow: 0px 0px 6px rgba(0, 0, 0, .25); }";var c=document.createElement("style");c.setAttribute("type","text/css");c.setAttribute("id","pd_popup_holder_style_"+this.id+this.item_id);if(c.styleSheet){c.styleSheet.cssText=b}else{c.appendChild(document.createTextNode(b))}var d=document.getElementsByTagName("head").item(0);d.appendChild(c)}return'<span style="float:left;"> </span><div id="rating_info_'+this.id+this.item_id+'" style="display:'+(a?"block":"none")+";float:left;background:url("+(this.is_secure()?"https://polldaddy.com":"http://i0.poll.fm")+'/images/ratings/info.png) no-repeat 3px 2px;width:16px;height:16px;cursor:pointer;" onclick="javascript:'+this.varname+'.togglePopup();return false;"><span style="display:none;">i</span></div><div class="pd_popup_holder" id="pd_popup_holder_'+this.id+this.item_id+'"> </div>'};this.togglePopup=function(){var a=$("pd_popup_holder_"+this.id+this.item_id);if(a.style.display=="block"){a.style.display="none";$("rating_info_"+this.id+this.item_id).style.border=""}else{this.get_results(0)}};this.showPopup=function(){var a=$("pd_popup_holder_"+this.id+this.item_id);var b=$("rating_info_"+this.id+this.item_id);a.style.display="block";var c=this.getElementPos(b);var d=this.getElementSize(b);var e=this.getViewPos();var f=this.getViewSize();var g=this.getElementSize(a);var h=x=y=0;var i=border=1;var j=$("pd_rate_"+this.id+this.item_id).offsetWidth+border*2;var k=x=c[h]-j;var l=f[h];var m=e[h];var n=g[h];var o=d[h];var p=0;if(k+n-m>l){p=k+j-n+o;if(p<l+m&&p>0){x=p}}var q=d[i]+border*2;k=y=c[i]+q;var r=f[i];var s=e[i];var t=g[i];var u=d[i];var v=0;if(k+t-s>r){v=k-q-t;if(v<r+s&&v>0){y=v}}a.style.left=x+"px";a.style.top=y+"px"};this.popdown=function(a){$("pd_popup_holder_"+this.id+this.item_id).style.display="none"};this.getElementPos=function(a){var b=e2=a;var c=y=0;if(b.offsetParent){do{c+=b.offsetLeft;y+=b.offsetTop}while(b=b.offsetParent)}while((e2=e2.parentNode)&&e2.nodeName.toUpperCase()!=="BODY"){c-=e2.scrollLeft;y-=e2.scrollTop}return[c,y]};this.getElementSize=function(a){return[a.offsetWidth,a.offsetHeight]};this.getViewPos=function(){if(typeof window.pageYOffset==="number"){return[window.pageXOffset,window.pageYOffset]}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return[document.documentElement.scrollLeft,document.documentElement.scrollTop]}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return[document.body.scrollLeft,document.body.scrollTop]}else{return[0,0]}}}};this.getViewSize=function(){if(typeof window.innerWidth==="number"){return[window.innerWidth,window.innerHeight]}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return[document.documentElement.clientWidth,document.documentElement.clientHeight]}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return[document.body.clientWidth,document.body.clientHeight]}else{return[0,0]}}}};this.get_results=function(a){var b="";var c="";if(typeof document.lastChild.attributes!=="undefined"&&document.lastChild.attributes!=null){if(typeof document.lastChild.attributes.dir!=="undefined"&&document.lastChild.attributes.dir!=null){c="&dir="+document.lastChild.attributes.dir.textContent}}for(var d in ratings_text){if(PDRTJS_is_defined(this[d])&&this[d]!=ratings_text[d]){b+="&"+d+"="+PDRTJS_url_encode(this[d])}}var e=this.id;if(this.override!=null){e=this.override}this.make_call("/ratings/rating-results.php?id="+e+"&item_id="+this.item_id+"&period="+a+"&item_count=3"+(this.popup=="off"?"&off":"")+b+c)};this.rebuild=function(){if(!this.kill_hover){this.timeout_id=setTimeout(this.varname+".build()",800)}};this.cancel_rebuild=function(){if(this.timeout_id!=null){clearTimeout(this.timeout_id);this.timeout_id=null}};this.rate=function(a){if(!this.kill_hover){var b=this.get_voter_id();if(this.type=="stars"){$(this.varname+"_msg").innerHTML=this.text_thank_you}else{$(this.varname+"_msg").innerHTML=this.text_thank_you;if(b==0){if(a==1){$(this.varname+"_msg_1").innerHTML=this.nero_up+1}else{$(this.varname+"_msg_2").innerHTML=this.nero_dn+1}}}this.kill_hover=true;var c="";var d="&cmd=rate";var e="";if(this.type=="stars"){e="&votes="+this.votes+"&avg="+this.avg_rating}else{e="&up="+this.nero_up+"&down="+this.nero_dn}if(b!=0){d="&cmd=change&vid="+PDRTJS_url_encode(b)}else{d="&cmd=rate"}c="/ratings/rate.php?title="+PDRTJS_url_encode(this.title)+"&permalink="+PDRTJS_url_encode(this.permalink)+"&type="+this.type+"&id="+this.id+"&r="+a+"&uid="+this.unique_id+"&item_id="+this.item_id+e+d+"&token="+this.token;this.make_call(c);setTimeout(this.varname+".build()",2e3);setTimeout(this.varname+".kill_hover = false",6e3)}};this.hover=function(rating){if(!this.kill_hover){if(this.type=="stars"){this.cancel_rebuild();for(c=1;c<=5;c++){if(c<=rating){$(this.varname+"_stars_"+c).style.background="url("+this.star_image+") top right"}else{$(this.varname+"_stars_"+c).style.background="url("+this.star_image+") bottom right"}}$(this.varname+"_msg").innerHTML=eval("this.text_"+rating+"_star")}else{this.cancel_rebuild();var image_pos=" top left";var msg=this.text_rate_up;if(rating==2){image_pos=" top right";msg=this.text_rate_down}$(this.varname+"_nero_"+rating).style.background="url("+this.star_image+") "+image_pos;$(this.varname+"_msg_"+rating).style.fontWeight="bold";$(this.varname+"_msg").innerHTML=msg}}};this.set_voter_id=function(a){if(this.voter_id!=null){if(document.cookie.length>4e3){var b=document.cookie.split(";");var c=new Array;var d=0;var e=0;for(var f=0;f<b.length;f++){var g=b[f];if(g.indexOf("PDRTJS_")!=-1){g=g.replace(/^\s\s*/,"").replace(/\s\s*$/,"");e+=g.length;c[d++]=g}}if(e>3e3){for(var f=0;f<c.length;f++){var g=c[f];e-=g.length;var h=g.indexOf("=");if(h>0){g=unescape(g.substring(0,h))}document.cookie=g+"=0;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/;";if(e<3e3){break}}}}a=typeof a=="undefined"?30:parseInt(a);var i=new Date;i.setTime(i.getTime());var j=60*60*24*a*1e3;var k=new Date(i.getTime()+j);var l="PDRTJS_"+this.type+"_"+this.id+(this.item_id.length>0?this.item_id:escape(this.unique_id));document.cookie=l+"="+escape(this.voter_id)+";expires="+k.toGMTString()+";path=/;"}};this.get_voter_id=function(){var a="PDRTJS_"+this.type+"_"+this.id+(this.item_id.length>0?this.item_id:escape(this.unique_id));var b=""+document.cookie;var c=b.indexOf(a+"=");if(c==-1||a==""){return 0}else{var d=b.indexOf(";",c);if(d==-1){d=b.length}return unescape(b.substring(c+a.length+1,d))}};this.is_secure=function(){return"https:"==document.location.protocol?true:false};if(this.item_id==null){this.item_id=""}this.get_rating()}var ratings_text=new Array;ratings_text.text_vote="Vote";ratings_text.text_votes="Votes";ratings_text.text_rate_this="Rate This";ratings_text.text_1_star="1 star";ratings_text.text_2_star="2 stars";ratings_text.text_3_star="3 stars";ratings_text.text_4_star="4 stars";ratings_text.text_5_star="5 stars";ratings_text.text_thank_you="Thank You";ratings_text.text_rate_up="Rate Up";ratings_text.text_rate_down="Rate Down";ratings_text.text_popcontent="Most Popular Content";ratings_text.text_close="Close";ratings_text.text_all="All";ratings_text.text_today="Today";ratings_text.text_thisweek="This Week";ratings_text.text_thismonth="This Month";ratings_text.text_rated="Rated";ratings_text.text_noratings="There are no rated items for this period";var PDRTJS_doc=document.getElementsByTagName("div");var PDRTJS_id="";for(var i=0;i<PDRTJS_doc.length;i++){if(PDRTJS_doc[i].id.substring(0,17)=="pd_rating_holder_"){PDRTJS_id=PDRTJS_doc[i].id.replace(/pd_rating_holder_/,"");eval("if ( typeof PDRTJS_"+PDRTJS_id+" == 'undefined' ){PDRTJS_"+PDRTJS_id+" = new PDRTJS_RATING( PDRTJS_settings_"+PDRTJS_id+" );}")}}
|
js/style-editor.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function mouseDown(a){a=a||window.event;var b=a.target||a.srcElement;if(_$("P_tab")){if(_$("P_tab").style.display=="block"){try{if(b.parentNode.parentNode.parentNode.parentNode.parentNode.id!="P_tab"){_$("P_tab").style.display="none"}}catch(c){_$("P_tab").style.display="none"}}}}function submitCSSEditor(){if(_$("styleTitle").value.trim().length>0){_$("formXML").submit()}else{_$("styleTitleErr").style.display="block"}}function CSSE_changeView(a){_$("A_"+currentTag).className="Aoff";_$("D_"+currentTag).className="off";_$("edit"+currentTag).style.display="none";_$("A_"+a).className="Aon";_$("D_"+a).className="on";_$("edit"+a).style.display="block";currentTag=a}function CSSE_showTag(a){if(a!=null){_$("D_"+a).style.display="block"}else{_$("D_Border").style.display="none";_$("D_Font").style.display="none";_$("D_Background").style.display="none";_$("D_Margin").style.display="none";_$("D_Padding").style.display="none";_$("D_Scale").style.display="none";_$("D_Height").style.display="none"}}function showResults(a){if(a){_$("divAnswers").style.display="none";_$("divResults").style.display="block";_$("pds-links-back").style.display="block";_$("pds-links").style.display="none";_$("pds-totalvotes-inner").style.display="block";_$("pds-question-top").innerHTML=pd_map.thankyou}else{_$("divAnswers").style.display="block";_$("divResults").style.display="none";_$("pds-links-back").style.display="none";_$("pds-links").style.display="block";_$("pds-totalvotes-inner").style.display="none";_$("pds-question-top").innerHTML=pd_map.question}}function renderStyleEdit(a){firstRun=true;switch(a){case"pds-box":{showResults(false);break};case"pds-question-top":{showResults(false);break};case"pds-box":{showResults(false);break};case"pds-answer-group":{showResults(false);break};case"pds-answer-input":{showResults(false);break};case"pds-answer":{showResults(false);break};case"pds-link":{showResults(false);break};case"pds-textfield":{showResults(false);break};case"pds-vote-button":{showResults(false);break};case"pds-answer-feedback":{showResults(true);break};case"pds-answer-feedback-bar":{showResults(true);break};case"pds-totalvotes-inner":{showResults(true);break}}_$("editBorder").style.display="none";_$("editFont").style.display="none";_$("editBackground").style.display="none";_$("editMargin").style.display="none";_$("editPadding").style.display="none";_$("editScale").style.display="none";_$("editHeight").style.display="none";CSSE_showTag(null);currentStyle=a;for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){styleGroup=CSSXML.childNodes[i].childNodes[x];if(styleGroup.nodeName==a){for(y=0;y<styleGroup.childNodes.length;y++){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){attrName=styleGroup.childNodes[y].attributes[z].name;attrValue=styleGroup.childNodes[y].attributes[z].value;switch(_$(attrName).nodeName){case"SELECT":{for(q=0;q<_$(attrName).length;q++){if(_$(attrName).options[q].value==attrValue){_$(attrName).options[q].selected=true;break}}break};case"INPUT":{if(_$(attrName).attributes["type"].value=="checkbox"){if(attrValue!="none"&&attrValue!="normal"){_$(attrName).checked=true}else{_$(attrName).checked=false}}else{if(attrValue=="Transparent"){_$(attrName).value=""}else{_$(attrName).value=attrValue}}break}}}if(firstRun==true){switch(styleGroup.childNodes[y].nodeName){case"border":{CSSE_changeView("Border");CSSE_showTag("Border");break};case"font":{CSSE_changeView("Font");CSSE_showTag("Font");break};case"background":{CSSE_changeView("Background");CSSE_showTag("Background");break};case"margin":{CSSE_changeView("Margin");CSSE_showTag("Margin");break};case"padding":{CSSE_changeView("Padding");CSSE_showTag("Padding");break};case"scale":{CSSE_changeView("Scale");CSSE_showTag("Scale");break};case"height":{CSSE_changeView("Height");CSSE_showTag("Height");break}}firstRun=false}switch(styleGroup.childNodes[y].nodeName){case"border":{CSSE_showTag("Border");break};case"font":{CSSE_showTag("Font");break};case"background":{CSSE_showTag("Background");break};case"margin":{CSSE_showTag("Margin");break};case"padding":{CSSE_showTag("Padding");break};case"scale":{CSSE_showTag("Scale");break};case"height":{CSSE_showTag("Height");break}}}}}}break}}}function loadStyle(){loadCSSXML();for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){currentStyle=CSSXML.childNodes[i].childNodes[x].nodeName;styleGroup=CSSXML.childNodes[i].childNodes[x];for(y=0;y<styleGroup.childNodes.length;y++){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){bind(styleGroup.childNodes[y].attributes[z].name,styleGroup.childNodes[y].attributes[z].value,true)}}}}break}}}function bindToXML(a,b){for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){styleGroup=CSSXML.childNodes[i].childNodes[x];if(styleGroup.nodeName==currentStyle){for(y=0;y<styleGroup.childNodes.length;y++){if(styleGroup.childNodes[y].nodeType!=3){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){if(styleGroup.childNodes[y].attributes[z].name==a){switch(_$(a).nodeName){case"SELECT":{styleGroup.childNodes[y].attributes[z].value=b;break};case"INPUT":{if(_$(a).attributes["type"].value=="checkbox"){if(_$(a).id=="font-weight"&&_$(a).checked==false){styleGroup.childNodes[y].attributes[z].value="normal"}else if(_$(a).id=="font-style"&&_$(a).checked==false){styleGroup.childNodes[y].attributes[z].value="normal"}else if(_$(a).id=="text-decoration"&&_$(a).checked==false){styleGroup.childNodes[y].attributes[z].value="none"}else{styleGroup.childNodes[y].attributes[z].value=b}}else{styleGroup.childNodes[y].attributes[z].value=b}break}}break}}}}}}}break}}}function isNumeric(a){var b=/^[0-9]+$/;if(a.match(b)){return true}else{return false}}function isUrl(a){var b=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return b.test(a)}function isHex(a){if(a=="transparent"){return true}else{var b=/^#[0-9a-fA-F]{3,6}$/i;return b.test(a)}}function bind(a,b,c){var d=new bindObject(a,b);if(verifyBindValue(d)==null){return false}if(!c){bindToXML(d.elm,d.value)}bindToElement(d.elm,d.value,c);ShowXML()}function bindObject(a,b){this.elm=a;this.value=b}function verifyBindValue(a){elm=a.elm;value=a.value;if(!value){value=elm.value}if(elm.id){elm=elm.id}if(elm=="width"){if(isNumeric(value)==false){return null}}if(elm=="height"){if(isNumeric(value)==false){return null}}if(elm=="background-image"){if(value&&value.length&&value.length>0&&value!=elm){if(isUrl(value)==false){return null}}else return null}if(elm=="border-color"||elm=="color"||elm=="background-color"){if(value){if(value.indexOf("#")==-1)value="#"+value;if(isHex(value.toLowerCase())==false)return null}}a.elm=elm;a.value=value;return true}function bindToElement(a,b,c){var d=new bindObject(a,b);if(verifyBindValue(d)==null){return false}if(_$(currentStyle)==null||_$(currentStyle)=="undefined"){return false}var b=d.value;var e=_$(currentStyle).style;switch(d.elm){case"border-width":{e.borderWidth=b;break};case"border-radius":{e.MozBorderRadius=b;e.WebkitBorderRadius=b;break};case"border-style":{e.borderStyle=b;break};case"border-color":{if(b=="Transpa"){_$("border-color").value=""}e.borderColor=b;break};case"font-size":{e.fontSize=b;break};case"font-family":{e.fontFamily=b;break};case"font-weight":{if(c==true&&firstRun==true){e.fontWeight=b}else{if(_$(a).checked){e.fontWeight=b}else{e.fontWeight="normal"}}break};case"font-style":{if(c==true&&firstRun==true){e.fontStyle=b}else{if(_$(a).checked){e.fontStyle=b}else{e.fontStyle="normal"}}break};case"text-decoration":{if(c==true&&firstRun==true){e.textDecoration=b}else{if(_$(a).checked){e.textDecoration=b}else{e.textDecoration="none"}}break};case"line-height":{e.lineHeight=b;break};case"text-align":{e.textAlign=b;break};case"float":{e.cssFloat=b;break};case"color":{if(b=="Transpa"){_$("color").value=""}e.color=b;break};case"background-color":{if(b=="Transpa"){_$("background-color").value=""}e.backgroundColor=b;break};case"background-image":{if(b!=="undefined")e.backgroundImage="url("+b+")";break};case"background-repeat":{e.backgroundRepeat=b;break};case"background-position":{e.backgroundPosition=b;break};case"margin-top":{e.marginTop=b;break};case"margin-right":{e.marginRight=b;break};case"margin-bottom":{e.marginBottom=b;break};case"margin-left":{e.marginLeft=b;break};case"padding-top":{e.paddingTop=b;break};case"padding-right":{e.paddingRight=b;break};case"padding-bottom":{e.paddingBottom=b;break};case"padding-left":{e.paddingLeft=b;break};case"width":{e.width=b+"px";break};case"height":{e.height=b+"px";break};case"direction":{e.direction=b;break}}var f=["pds-link","pds-answer-group","pds-answer-input","pds-answer-feedback","pds-answer-feedback-bar","pds-feedback-group","pds-feedback-result","pds-feedback-per","pds-feedback-votes","pds-answer-text","pds-answer"];for(var g in f){var h=f[g];if(currentStyle.indexOf(h)==-1)continue;if(currentStyle==h){currentStyle=h+"1";if(!bindToElement(d.elm,b,c))currentStyle=h;break}else if(currentStyle==h+"1"){currentStyle=h+"2";if(!bindToElement(d.elm,b,c))currentStyle=h;break}else if(currentStyle==h+"2"){currentStyle=h+"3";if(!bindToElement(d.elm,b,c))currentStyle=h;break}else if(currentStyle==h+"3"){currentStyle=h;break}}return true}function force_rtl(){_$("style-force-rtl").style.display="none";_$("style-force-ltr").style.display="inline";var a=["pds-feedback-per","pds-feedback-votes"];var b=["pds-answer-input","pds-link","pds-textfield","pds-vote-button","pds-answer-feedback-bar","pds-totalvotes-inner","pds-answer-text","pds-answer-text","pds-answer"];var c=["pds-question-top","pds-answer","pds-link","pds-textfield","pds-vote-button","pds-totalvotes-inner","pds-answer-text","pds-feedback-per","pds-feedback-votes","pds-textfield"];for(var d in a){currentStyle=a[d];bind("float","left",false)}for(var d in b){currentStyle=b[d];bind("float","right",false)}for(var d in c){currentStyle=c[d];bind("text-align","right",false)}currentStyle="pds-box";bind("direction","rtl",false)}function force_ltr(){_$("style-force-rtl").style.display="inline";_$("style-force-ltr").style.display="none";var a=["pds-feedback-per","pds-feedback-votes"];var b=["pds-answer-input","pds-link","pds-textfield","pds-vote-button","pds-answer-feedback-bar","pds-totalvotes-inner","pds-answer-text","pds-answer-text","pds-answer"];var c=["pds-question-top","pds-answer","pds-link","pds-textfield","pds-vote-button","pds-totalvotes-inner","pds-answer-text","pds-feedback-per","pds-feedback-votes","pds-textfield"];for(var d in b){currentStyle=b[d];bind("float","left",false)}for(var d in a){currentStyle=a[d];bind("float","right",false)}for(var d in c){currentStyle=c[d];bind("text-align","left",false)}currentStyle="pds-box";bind("direction","ltr",false)}function loadCSSXML(){if(window.ActiveXObject){CSSXML=new ActiveXObject("Microsoft.XMLDOM");CSSXML.loadXML(CSSXMLString)}else{CSSXML=document.implementation.createDocument("","",null);objDOMParser=new DOMParser;CSSXML=objDOMParser.parseFromString(CSSXMLString,"text/xml")}}function ShowXML(){if(window.ActiveXObject){var a=CSSXML.xml}else if(document.implementation&&document.implementation.createDocument){var b=new XMLSerializer;var a=b.serializeToString(CSSXML)}document.getElementById("S_www").value=a}function submitStyleCSS(){pass=true;if(_$("styleName").value.trim().length==0){pass=false;_$("styleNameErr").style.display="block"}else{_$("styleNameErr").style.display="none"}if(_$("styleCSS").value.trim().length==0){pass=false;_$("styleCSSErr").style.display="block"}else{_$("styleCSSErr").style.display="none"}if(pass){_$("editStyle").submit()}}function preload_style(){if(_$("preload_value").value!="0"){window.location=window.location.href.replace(/(\&preload=(\d+))/g,"")+"&preload="+_$("preload_value").value}}document.onmousedown=mouseDown;var pd_map={thankyou:"Thank you for voting!",question:"Do you mostly use the internet at work, in school or at home?"};var currentTag="Background";var currentStyle;firstRun=true;
|
polldaddy-client.php
CHANGED
@@ -905,9 +905,12 @@ function sync_rating( ){
|
|
905 |
* @return array|false Polldaddy Media or false on failure
|
906 |
*/
|
907 |
|
908 |
-
function upload_image( $name, $url, $type, $id = 0 ){
|
909 |
|
910 |
-
|
|
|
|
|
|
|
911 |
|
912 |
$this->send_request(30);
|
913 |
|
@@ -1167,7 +1170,7 @@ function &polldaddy_poll( $args = null, $id = null, $_require_data = true ) {
|
|
1167 |
}
|
1168 |
|
1169 |
global $wpdb;
|
1170 |
-
$public = (int) $wpdb->get_var( $wpdb->prepare( "SELECT public FROM
|
1171 |
if( $public == -1 )
|
1172 |
$args['makePublic'] = 'no';
|
1173 |
|
@@ -1362,4 +1365,4 @@ function stripslashes_deep($value) {
|
|
1362 |
return $value;
|
1363 |
}
|
1364 |
endif;
|
1365 |
-
?>
|
905 |
* @return array|false Polldaddy Media or false on failure
|
906 |
*/
|
907 |
|
908 |
+
function upload_image( $name, $url, $type, $id = 0, $data = '' ){
|
909 |
|
910 |
+
if ( !empty( $data ) )
|
911 |
+
$pos = $this->add_request( 'uploadimagebinary', new Polldaddy_Media( compact( 'name', 'type', 'data' ) , compact( 'id' ) ) );
|
912 |
+
else
|
913 |
+
$pos = $this->add_request( 'uploadimageurl', new Polldaddy_Media( compact( 'name', 'type', 'url' ) , compact( 'id' ) ) );
|
914 |
|
915 |
$this->send_request(30);
|
916 |
|
1170 |
}
|
1171 |
|
1172 |
global $wpdb;
|
1173 |
+
$public = (int) $wpdb->get_var( $wpdb->prepare( "SELECT public FROM {$wpdb->blogs} WHERE blog_id = %d", $wpdb->blogid ) );
|
1174 |
if( $public == -1 )
|
1175 |
$args['makePublic'] = 'no';
|
1176 |
|
1365 |
return $value;
|
1366 |
}
|
1367 |
endif;
|
1368 |
+
?>
|
polldaddy-org.php
CHANGED
@@ -446,47 +446,33 @@ function polldaddy_loader() {
|
|
446 |
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
447 |
}
|
448 |
|
449 |
-
if ( !
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
function polldaddy_add_rating_js() {
|
456 |
-
wp_print_scripts( 'polldaddy-rating-js' );
|
457 |
-
}
|
458 |
-
|
459 |
-
class pd_poll_shortcodes {
|
460 |
-
private $poll_id;
|
461 |
-
|
462 |
-
public function pd_poll_shortcodes( $poll_id ){
|
463 |
-
$this->poll_id = (int) $poll_id;
|
464 |
-
}
|
465 |
-
|
466 |
-
public function polldaddy_add_poll_js() {
|
467 |
-
wp_print_scripts( 'polldaddy-poll-js-'. $this->poll_id );
|
468 |
-
}
|
469 |
-
}
|
470 |
|
471 |
-
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
}
|
474 |
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
476 |
global $post;
|
477 |
global $content_width;
|
478 |
-
|
479 |
-
$inline = false;
|
480 |
-
$no_script = false;
|
481 |
-
|
482 |
-
if ( defined( 'PADPRESS_LOADED' ) )
|
483 |
-
$inline = true;
|
484 |
-
|
485 |
-
if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) )
|
486 |
-
$inline = true;
|
487 |
-
|
488 |
-
if ( is_feed() || defined( 'DOING_AJAX' ) )
|
489 |
-
$no_script = true;
|
490 |
|
491 |
extract( shortcode_atts( array(
|
492 |
'survey' => null,
|
@@ -512,9 +498,170 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
512 |
'domain' => '',
|
513 |
'id' => ''
|
514 |
), $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
if ( in_array( $type, array( 'iframe', 'button', 'banner', 'slider' ) ) ) {
|
519 |
|
520 |
if ( empty( $title ) ) {
|
@@ -527,7 +674,7 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
527 |
$survey_url = esc_url( "http://polldaddy.com/s/{$survey}" );
|
528 |
$survey_link = sprintf( '<a href="%s">%s</a>', $survey_url, esc_html( $title ) );
|
529 |
|
530 |
-
if ( $no_script || $inline )
|
531 |
return $survey_link;
|
532 |
|
533 |
if ( $type == 'iframe' ) {
|
@@ -545,20 +692,20 @@ if ( !function_exists( 'polldaddy_shortcode_handler' ) ) {
|
|
545 |
else
|
546 |
$height = (int) $height;
|
547 |
|
548 |
-
return <<<
|
549 |
<iframe src="{$survey_url}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">{$survey_link}</iframe>
|
550 |
-
|
551 |
}
|
552 |
-
|
553 |
|
554 |
$auto_src = esc_url( "http://{$domain}.polldaddy.com/s/{$id}" );
|
555 |
$auto_src = parse_url( $auto_src );
|
556 |
|
557 |
if ( !is_array( $auto_src ) || count( $auto_src ) == 0 )
|
558 |
-
return '<!-- no
|
559 |
|
560 |
if ( !isset( $auto_src['host'] ) || !isset( $auto_src['path'] ) )
|
561 |
-
return '<!-- no
|
562 |
|
563 |
$domain = $auto_src['host'].'/s/';
|
564 |
$id = str_ireplace( '/s/', '', $auto_src['path'] );
|
@@ -597,145 +744,103 @@ EOD;
|
|
597 |
'id' => $survey
|
598 |
) ) );
|
599 |
}
|
600 |
-
return <<<
|
601 |
<script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
|
602 |
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
603 |
polldaddy.add( {$settings} );
|
604 |
//--><!]]></script>
|
605 |
<noscript>{$survey_link}</noscript>
|
606 |
-
|
607 |
}
|
608 |
}
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
$unique_id = is_page() ? 'wp-page-'.$post->ID : 'wp-post-'.$post->ID;
|
613 |
-
|
614 |
-
if ( empty( $item_id ) )
|
615 |
-
$item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
|
616 |
-
|
617 |
-
if ( empty( $title ) )
|
618 |
-
$title = apply_filters( 'wp_title', $post->post_title, '', '' );
|
619 |
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
'
|
630 |
-
'unique_id' => $unique_id,
|
631 |
-
'title' => rawurlencode( trim( $title ) ),
|
632 |
-
'permalink' => esc_url( $permalink ),
|
633 |
-
'item_id' => $item_id
|
634 |
-
) );
|
635 |
-
|
636 |
-
$item_id = esc_js( $item_id );
|
637 |
|
638 |
-
if ( $inline ) {
|
639 |
-
return <<<EOD
|
640 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
641 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
642 |
-
PDRTJS_settings_{$rating}{$item_id}={$settings};
|
643 |
-
//--><!]]></script>
|
644 |
-
<script type="text/javascript" charset="UTF-8" src="http://i.polldaddy.com/ratings/rating.js"></script>
|
645 |
-
EOD;
|
646 |
}
|
647 |
-
else {
|
648 |
-
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
649 |
-
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
650 |
-
|
651 |
-
return <<<EOD
|
652 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
653 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
654 |
-
PDRTJS_settings_{$rating}{$item_id}={$settings};
|
655 |
-
//--><!]]></script>
|
656 |
-
EOD;
|
657 |
-
}
|
658 |
-
}
|
659 |
-
elseif ( intval( $poll ) > 0 ) { //poll embed
|
660 |
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
$poll_link = sprintf( '<a href="%s">Take Our Poll</a>', $poll_url );
|
665 |
-
|
666 |
-
if ( $no_script )
|
667 |
-
return $poll_link;
|
668 |
-
else {
|
669 |
-
if ( $type == 'slider' && !$inline ) {
|
670 |
-
|
671 |
-
if( !in_array( $visit, array( 'single', 'multiple' ) ) )
|
672 |
-
$visit = 'single';
|
673 |
-
|
674 |
-
$settings = json_encode( array(
|
675 |
-
'type' => 'slider',
|
676 |
-
'embed' => 'poll',
|
677 |
-
'delay' => intval( $delay ),
|
678 |
-
'visit' => $visit,
|
679 |
-
'id' => intval( $poll )
|
680 |
-
) );
|
681 |
-
|
682 |
-
return <<<EOD
|
683 |
-
<script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
|
684 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
685 |
-
polldaddy.add( {$settings} );
|
686 |
-
//--><!]]></script><noscript>{$poll_link}</noscript>
|
687 |
-
EOD;
|
688 |
}
|
689 |
-
else {
|
690 |
-
$cb = ( $cb == 1 ? '?cb='.mktime() : false );
|
691 |
-
$margins = '';
|
692 |
-
$float = '';
|
693 |
-
|
694 |
-
if ( in_array( $align, array( 'right', 'left' ) ) ) {
|
695 |
-
$float = sprintf( 'float: %s;', $align );
|
696 |
-
|
697 |
-
if ( $align == 'left')
|
698 |
-
$margins = 'margin: 0px 10px 0px 0px;';
|
699 |
-
else if ( $align == 'right' )
|
700 |
-
$margins = 'margin: 0px 0px 0px 10px';
|
701 |
-
}
|
702 |
-
|
703 |
-
if ( $cb === false && !$inline ) {
|
704 |
-
$pd_poll_shortcodes = new pd_poll_shortcodes( $poll );
|
705 |
-
wp_register_script( "polldaddy-poll-js-{$poll}", $poll_js );
|
706 |
-
add_filter( 'wp_footer', array( &$pd_poll_shortcodes, 'polldaddy_add_poll_js' ) );
|
707 |
-
|
708 |
-
return <<<EOD
|
709 |
-
<a name="pd_a_{$poll}"></a><div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div><div id="PD_superContainer"></div><noscript>{$poll_link}</noscript>
|
710 |
-
EOD;
|
711 |
-
}
|
712 |
-
else {
|
713 |
-
if ( $inline )
|
714 |
-
$cb = '';
|
715 |
-
|
716 |
-
return <<<EOD
|
717 |
-
<a name="pd_a_{$poll}"></a><div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div><div id="PD_superContainer"></div>
|
718 |
-
<script type="text/javascript" charset="UTF-8" src="{$poll_js}{$cb}"></script><noscript>{$poll_link}</noscript>
|
719 |
-
EOD;
|
720 |
-
}
|
721 |
-
}
|
722 |
}
|
723 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
|
725 |
-
|
726 |
}
|
|
|
|
|
|
|
|
|
727 |
|
|
|
728 |
// http://polldaddy.com/poll/1562975/?view=results&msg=voted
|
729 |
function polldaddy_link( $content ) {
|
730 |
return preg_replace( '!(?:\n|\A)http://polldaddy.com/poll/([0-9]+?)/(.+)?(?:\n|\Z)!i', "\n<script type='text/javascript' language='javascript' charset='utf-8' src='http://static.polldaddy.com/p/$1.js'></script><noscript> <a href='http://polldaddy.com/poll/$1/'>View Poll</a></noscript>\n", $content );
|
731 |
}
|
732 |
-
|
733 |
// higher priority because we need it before auto-link and autop get to it
|
734 |
add_filter( 'the_content', 'polldaddy_link', 1 );
|
735 |
add_filter( 'the_content_rss', 'polldaddy_link', 1 );
|
736 |
add_filter( 'comment_text', 'polldaddy_link', 1 );
|
|
|
737 |
|
738 |
-
add_shortcode( 'polldaddy', 'polldaddy_shortcode_handler' );
|
739 |
}
|
740 |
|
741 |
add_action( 'init', 'polldaddy_loader' );
|
446 |
add_action( 'admin_menu', array( &$polldaddy_object, 'admin_menu' ) );
|
447 |
}
|
448 |
|
449 |
+
if ( !class_exists( 'PolldaddyShortcode' ) ) {
|
450 |
+
/**
|
451 |
+
* Class wrapper for polldaddy shortcodes
|
452 |
+
*/
|
453 |
+
class PolldaddyShortcode {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
+
static $add_script = false;
|
456 |
+
static $scripts = false;
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Add all the actions & resgister the shortcode
|
460 |
+
*/
|
461 |
+
function __construct() {
|
462 |
+
if ( defined( 'GLOBAL_TAGS' ) == false )
|
463 |
+
add_shortcode( 'polldaddy', array( $this, 'polldaddy_shortcode' ) );
|
464 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) );
|
465 |
+
add_action( 'infinite_scroll_render', array( $this, 'polldaddy_shortcode_infinite' ), 11 );
|
466 |
}
|
467 |
|
468 |
+
/**
|
469 |
+
* Shortcode for polldadddy
|
470 |
+
* [polldaddy poll|survey|rating="123456"]
|
471 |
+
*
|
472 |
+
* */
|
473 |
+
function polldaddy_shortcode( $atts ) {
|
474 |
global $post;
|
475 |
global $content_width;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
extract( shortcode_atts( array(
|
478 |
'survey' => null,
|
498 |
'domain' => '',
|
499 |
'id' => ''
|
500 |
), $atts ) );
|
501 |
+
|
502 |
+
if ( ! is_array( $atts ) ) {
|
503 |
+
return '<!-- Polldaddy shortcode passed invalid attributes -->';
|
504 |
+
}
|
505 |
+
|
506 |
+
$inline = false;
|
507 |
+
$no_script = false;
|
508 |
+
$infinite_scroll = false;
|
509 |
+
|
510 |
+
if ( is_home() && current_theme_supports( 'infinite-scroll' ) )
|
511 |
+
$infinite_scroll = true;
|
512 |
+
|
513 |
+
if ( defined( 'PADPRESS_LOADED' ) )
|
514 |
+
$inline = true;
|
515 |
|
516 |
+
if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) )
|
517 |
+
$inline = true;
|
518 |
+
|
519 |
+
if ( is_feed() || ( defined( 'DOING_AJAX' ) && !$infinite_scroll ) )
|
520 |
+
$no_script = false;
|
521 |
+
|
522 |
+
self::$add_script = $infinite_scroll;
|
523 |
+
|
524 |
+
if ( intval( $rating ) > 0 && !$no_script ) { //rating embed
|
525 |
+
|
526 |
+
if ( empty( $unique_id ) )
|
527 |
+
$unique_id = is_page() ? 'wp-page-'.$post->ID : 'wp-post-'.$post->ID;
|
528 |
+
|
529 |
+
if ( empty( $item_id ) )
|
530 |
+
$item_id = is_page() ? '_page_'.$post->ID : '_post_'.$post->ID;
|
531 |
+
|
532 |
+
if ( empty( $title ) )
|
533 |
+
$title = apply_filters( 'wp_title', $post->post_title );
|
534 |
+
|
535 |
+
if ( empty( $permalink ) )
|
536 |
+
$permalink = get_permalink( $post->ID );
|
537 |
|
538 |
+
$rating = intval( $rating );
|
539 |
+
$unique_id = wp_strip_all_tags( $unique_id );
|
540 |
+
$item_id = wp_strip_all_tags( $item_id );
|
541 |
+
$item_id = preg_replace( '/[^_a-z0-9]/i', '', $item_id );
|
542 |
+
|
543 |
+
$settings = json_encode( array(
|
544 |
+
'id' => $rating,
|
545 |
+
'unique_id' => $unique_id,
|
546 |
+
'title' => rawurlencode( trim( $title ) ),
|
547 |
+
'permalink' => esc_url( $permalink ),
|
548 |
+
'item_id' => $item_id
|
549 |
+
) );
|
550 |
+
|
551 |
+
$item_id = esc_js( $item_id );
|
552 |
+
|
553 |
+
if ( $inline ) {
|
554 |
+
return <<<SCRIPT
|
555 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
556 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
557 |
+
PDRTJS_settings_{$rating}{$item_id}={$settings};
|
558 |
+
//--><!]]></script>
|
559 |
+
<script type="text/javascript" charset="UTF-8" src="http://i.polldaddy.com/ratings/rating.js"></script>
|
560 |
+
SCRIPT;
|
561 |
+
}
|
562 |
+
else {
|
563 |
+
if ( self::$scripts === false )
|
564 |
+
self::$scripts = array();
|
565 |
+
|
566 |
+
$data = array( 'id' => $rating, 'item_id' => $item_id, 'settings' => $settings );
|
567 |
+
|
568 |
+
self::$scripts['rating'][] = $data;
|
569 |
+
|
570 |
+
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
571 |
+
|
572 |
+
$data = esc_attr( json_encode( $data ) );
|
573 |
+
|
574 |
+
if ( $infinite_scroll )
|
575 |
+
return <<<CONTAINER
|
576 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}" data-settings="{$data}"></div>
|
577 |
+
CONTAINER;
|
578 |
+
else
|
579 |
+
return <<<CONTAINER
|
580 |
+
<div class="pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
|
581 |
+
CONTAINER;
|
582 |
+
}
|
583 |
+
}
|
584 |
+
elseif ( intval( $poll ) > 0 ) { //poll embed
|
585 |
+
|
586 |
+
$poll = intval( $poll );
|
587 |
+
$poll_url = sprintf( 'http://polldaddy.com/poll/%d', $poll );
|
588 |
+
$poll_js = sprintf( '%s.polldaddy.com/p/%d.js', ( is_ssl() ? 'https://secure' : 'http://static' ), $poll );
|
589 |
+
$poll_link = sprintf( '<a href="%s">Take Our Poll</a>', $poll_url );
|
590 |
+
|
591 |
+
if ( $no_script )
|
592 |
+
return $poll_link;
|
593 |
+
else {
|
594 |
+
if ( $type == 'slider' && !$inline ) {
|
595 |
+
|
596 |
+
if( !in_array( $visit, array( 'single', 'multiple' ) ) )
|
597 |
+
$visit = 'single';
|
598 |
+
|
599 |
+
$settings = json_encode( array(
|
600 |
+
'type' => 'slider',
|
601 |
+
'embed' => 'poll',
|
602 |
+
'delay' => intval( $delay ),
|
603 |
+
'visit' => $visit,
|
604 |
+
'id' => intval( $poll )
|
605 |
+
) );
|
606 |
+
|
607 |
+
return <<<SCRIPT
|
608 |
+
<script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
|
609 |
+
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
610 |
+
polldaddy.add( {$settings} );
|
611 |
+
//--><!]]></script>
|
612 |
+
<noscript>{$poll_link}</noscript>
|
613 |
+
SCRIPT;
|
614 |
+
}
|
615 |
+
else {
|
616 |
+
$cb = ( $cb == 1 ? '?cb='.mktime() : false );
|
617 |
+
$margins = '';
|
618 |
+
$float = '';
|
619 |
+
|
620 |
+
if ( in_array( $align, array( 'right', 'left' ) ) ) {
|
621 |
+
$float = sprintf( 'float: %s;', $align );
|
622 |
+
|
623 |
+
if ( $align == 'left')
|
624 |
+
$margins = 'margin: 0px 10px 0px 0px;';
|
625 |
+
elseif ( $align == 'right' )
|
626 |
+
$margins = 'margin: 0px 0px 0px 10px';
|
627 |
+
}
|
628 |
+
|
629 |
+
if ( $cb === false && !$inline ) {
|
630 |
+
if ( self::$scripts === false )
|
631 |
+
self::$scripts = array();
|
632 |
+
|
633 |
+
$data = array( 'url' => $poll_js );
|
634 |
+
|
635 |
+
self::$scripts['poll'][] = $data;
|
636 |
+
|
637 |
+
add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
|
638 |
+
|
639 |
+
$data = esc_attr( json_encode( $data ) );
|
640 |
+
|
641 |
+
return <<<CONTAINER
|
642 |
+
<a name="pd_a_{$poll}"></a>
|
643 |
+
<div class="PDS_Poll" id="PDI_container{$poll}" data-settings="{$data}" style="display:inline-block;{$float}{$margins}"></div>
|
644 |
+
<div id="PD_superContainer"></div>
|
645 |
+
<noscript>{$poll_link}</noscript>
|
646 |
+
CONTAINER;
|
647 |
+
}
|
648 |
+
else {
|
649 |
+
if ( $inline )
|
650 |
+
$cb = '';
|
651 |
+
|
652 |
+
return <<<CONTAINER
|
653 |
+
<a name="pd_a_{$poll}"></a>
|
654 |
+
<div class="PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div>
|
655 |
+
<div id="PD_superContainer"></div>
|
656 |
+
<script type="text/javascript" charset="UTF-8" src="{$poll_js}{$cb}"></script>
|
657 |
+
<noscript>{$poll_link}</noscript>
|
658 |
+
CONTAINER;
|
659 |
+
}
|
660 |
+
}
|
661 |
+
}
|
662 |
+
}
|
663 |
+
elseif ( !empty( $survey ) ) { //survey embed
|
664 |
+
|
665 |
if ( in_array( $type, array( 'iframe', 'button', 'banner', 'slider' ) ) ) {
|
666 |
|
667 |
if ( empty( $title ) ) {
|
674 |
$survey_url = esc_url( "http://polldaddy.com/s/{$survey}" );
|
675 |
$survey_link = sprintf( '<a href="%s">%s</a>', $survey_url, esc_html( $title ) );
|
676 |
|
677 |
+
if ( $no_script || $inline || $infinite_scroll )
|
678 |
return $survey_link;
|
679 |
|
680 |
if ( $type == 'iframe' ) {
|
692 |
else
|
693 |
$height = (int) $height;
|
694 |
|
695 |
+
return <<<CONTAINER
|
696 |
<iframe src="{$survey_url}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">{$survey_link}</iframe>
|
697 |
+
CONTAINER;
|
698 |
}
|
699 |
+
elseif ( !empty( $domain ) && !empty( $id ) ) {
|
700 |
|
701 |
$auto_src = esc_url( "http://{$domain}.polldaddy.com/s/{$id}" );
|
702 |
$auto_src = parse_url( $auto_src );
|
703 |
|
704 |
if ( !is_array( $auto_src ) || count( $auto_src ) == 0 )
|
705 |
+
return '<!-- no polldaddy output -->';
|
706 |
|
707 |
if ( !isset( $auto_src['host'] ) || !isset( $auto_src['path'] ) )
|
708 |
+
return '<!-- no polldaddy output -->';
|
709 |
|
710 |
$domain = $auto_src['host'].'/s/';
|
711 |
$id = str_ireplace( '/s/', '', $auto_src['path'] );
|
744 |
'id' => $survey
|
745 |
) ) );
|
746 |
}
|
747 |
+
return <<<CONTAINER
|
748 |
<script type="text/javascript" charset="UTF-8" src="http://i0.poll.fm/survey.js"></script>
|
749 |
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
750 |
polldaddy.add( {$settings} );
|
751 |
//--><!]]></script>
|
752 |
<noscript>{$survey_link}</noscript>
|
753 |
+
CONTAINER;
|
754 |
}
|
755 |
}
|
756 |
+
else
|
757 |
+
return '<!-- no polldaddy output -->';
|
758 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
|
760 |
+
function generate_scripts() {
|
761 |
+
$script = '';
|
762 |
+
|
763 |
+
if ( is_array( self::$scripts ) ) {
|
764 |
+
if ( isset( self::$scripts['rating'] ) ) {
|
765 |
+
$script = "<script type='text/javascript' charset='UTF-8' id='polldaddyRatings'><!--//--><![CDATA[//><!--\n";
|
766 |
+
foreach( self::$scripts['rating'] as $rating ) {
|
767 |
+
$script .= "PDRTJS_settings_{$rating['id']}{$rating['item_id']}={$rating['settings']}; if ( typeof PDRTJS_RATING !== 'undefined' ){if ( typeof PDRTJS_{$rating['id']}{$rating['item_id']} == 'undefined' ){PDRTJS_{$rating['id']}{$rating['item_id']} = new PDRTJS_RATING( PDRTJS_settings_{$rating['id']}{$rating['item_id']} );}}";
|
768 |
+
}
|
769 |
+
$script .= "\n//--><!]]></script><script type='text/javascript' charset='UTF-8' src='http://i.polldaddy.com/ratings/rating.js'></script>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
771 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
772 |
|
773 |
+
if ( isset( self::$scripts['poll'] ) ) {
|
774 |
+
foreach( self::$scripts['poll'] as $poll ) {
|
775 |
+
$script .= "<script type='text/javascript' charset='UTF-8' src='{$poll['url']}'></script>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
777 |
}
|
778 |
}
|
779 |
+
|
780 |
+
self::$scripts = false;
|
781 |
+
echo $script;
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* If the theme uses infinite scroll, include jquery at the start
|
786 |
+
*/
|
787 |
+
function check_infinite() {
|
788 |
+
if ( current_theme_supports( 'infinite-scroll' ) ) {
|
789 |
+
wp_enqueue_script( 'jquery' );
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Dynamically load the .js, if needed
|
795 |
+
*
|
796 |
+
* This hooks in late (priority 11) to infinite_scroll_render to determine
|
797 |
+
* a posteriori if a shortcode has been called.
|
798 |
+
*/
|
799 |
+
function polldaddy_shortcode_infinite() {
|
800 |
+
// only try to load if a shortcode has been called and theme supports infinite scroll
|
801 |
+
if( self::$add_script ) {
|
802 |
+
$script_url = json_encode( esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) ) );
|
803 |
+
|
804 |
+
// if the script hasn't been loaded, load it
|
805 |
+
// if the script loads successfully, fire an 'as-script-load' event
|
806 |
+
echo <<<SCRIPT
|
807 |
+
<script type='text/javascript'>
|
808 |
+
//<![CDATA[
|
809 |
+
if ( typeof window.polldaddyshortcode === 'undefined' ) {
|
810 |
+
var wp_pd_js = document.createElement( 'script' );
|
811 |
+
wp_pd_js.type = 'text/javascript';
|
812 |
+
wp_pd_js.src = $script_url;
|
813 |
+
wp_pd_js.async = true;
|
814 |
+
wp_pd_js.onload = function() {
|
815 |
+
jQuery( document.body ).trigger( 'pd-script-load' );
|
816 |
+
};
|
817 |
+
document.getElementsByTagName( 'head' )[0].appendChild( wp_pd_js );
|
818 |
+
} else {
|
819 |
+
jQuery( document.body ).trigger( 'pd-script-load' );
|
820 |
+
}
|
821 |
+
//]]>
|
822 |
+
</script>
|
823 |
+
SCRIPT;
|
824 |
|
825 |
+
}
|
826 |
}
|
827 |
+
}
|
828 |
+
|
829 |
+
// kick it all off
|
830 |
+
new PolldaddyShortcode();
|
831 |
|
832 |
+
if ( !in_array( 'jetpack/jetpack.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && !function_exists( 'polldaddy_link' ) ) {
|
833 |
// http://polldaddy.com/poll/1562975/?view=results&msg=voted
|
834 |
function polldaddy_link( $content ) {
|
835 |
return preg_replace( '!(?:\n|\A)http://polldaddy.com/poll/([0-9]+?)/(.+)?(?:\n|\Z)!i', "\n<script type='text/javascript' language='javascript' charset='utf-8' src='http://static.polldaddy.com/p/$1.js'></script><noscript> <a href='http://polldaddy.com/poll/$1/'>View Poll</a></noscript>\n", $content );
|
836 |
}
|
837 |
+
|
838 |
// higher priority because we need it before auto-link and autop get to it
|
839 |
add_filter( 'the_content', 'polldaddy_link', 1 );
|
840 |
add_filter( 'the_content_rss', 'polldaddy_link', 1 );
|
841 |
add_filter( 'comment_text', 'polldaddy_link', 1 );
|
842 |
+
}
|
843 |
|
|
|
844 |
}
|
845 |
|
846 |
add_action( 'init', 'polldaddy_loader' );
|
polldaddy-rtl.css
DELETED
@@ -1,17 +0,0 @@
|
|
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 |
-
tr.polldaddy-shortcode-row input{float:right;}
|
15 |
-
.st_selector .dir_left{padding:0 0 0 10px;}
|
16 |
-
.polldaddy-show-design-options,.pollStyle .customSelect,body.poll-preview-iframe div#manage-polls.wrap,#design h3,.pollStyle TH{text-align:right;}
|
17 |
-
#design_standard,.st_selector .dir_right{padding:0 20px 0 0;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
polldaddy-xml.php
CHANGED
@@ -442,6 +442,7 @@ class Polldaddy_Style extends Polldaddy_XML_Object {
|
|
442 |
var $_id;
|
443 |
var $_type;
|
444 |
var $_retro;
|
|
|
445 |
|
446 |
var $title;
|
447 |
var $date;
|
442 |
var $_id;
|
443 |
var $_type;
|
444 |
var $_retro;
|
445 |
+
var $_direction;
|
446 |
|
447 |
var $title;
|
448 |
var $date;
|
polldaddy.js
DELETED
@@ -1,244 +0,0 @@
|
|
1 |
-
jQuery(function ($) {
|
2 |
-
if (typeof(window.$) == 'undefined') { window.$ = jQuery; }
|
3 |
-
Plugin = function (args) {
|
4 |
-
var opts = $.extend( {
|
5 |
-
delete_rating: 'Are you sure you want to delete the rating for "%s"?',
|
6 |
-
delete_poll: 'Are you sure you want to delete "%s"?',
|
7 |
-
delete_answer: 'Are you sure you want to delete this answer?',
|
8 |
-
new_answer: 'Enter an answer here',
|
9 |
-
delete_answer_title: 'delete this answer',
|
10 |
-
reorder_answer_title: 'click and drag to reorder',
|
11 |
-
add_image_title: 'Add an Image',
|
12 |
-
add_audio_title: 'Add Audio',
|
13 |
-
add_video_title: 'Add Video',
|
14 |
-
standard_styles: 'Standard Styles',
|
15 |
-
custom_styles: 'Custom Styles'
|
16 |
-
}, args);
|
17 |
-
$('.hide-if-js').hide();
|
18 |
-
$('.empty-if-js').empty();
|
19 |
-
$('.hide-if-no-js').removeClass('hide-if-no-js');
|
20 |
-
$('.polldaddy-shortcode-row pre').click(function () {
|
21 |
-
var refNode = $(this)[0];
|
22 |
-
if ($.browser.msie) {
|
23 |
-
var range = document.body.createTextRange();
|
24 |
-
range.moveToElementText(refNode);
|
25 |
-
range.select();
|
26 |
-
} else if ($.browser.mozilla || $.browser.opera) {
|
27 |
-
var selection = window.getSelection();
|
28 |
-
var range = document.createRange();
|
29 |
-
range.selectNodeContents(refNode);
|
30 |
-
selection.removeAllRanges();
|
31 |
-
selection.addRange(range);
|
32 |
-
} else if ($.browser.safari) {
|
33 |
-
var selection = window.getSelection();
|
34 |
-
selection.setBaseAndExtent(refNode, 0, refNode, 1);
|
35 |
-
}
|
36 |
-
});
|
37 |
-
$('input#shortcode-field').click( function(){
|
38 |
-
|
39 |
-
$( this ).select();
|
40 |
-
|
41 |
-
} );
|
42 |
-
|
43 |
-
$('a.delete-rating').click(function () {
|
44 |
-
return confirm( opts.delete_rating.replace( "%s", "'" + $(this).parents('td').find('strong').text() + "'" ) );
|
45 |
-
});
|
46 |
-
$('a.delete-poll').click(function () {
|
47 |
-
return confirm( opts.delete_poll.replace( "%s", "'" + $(this).parents('td').find('strong').text() + "'" ) );
|
48 |
-
});
|
49 |
-
$('span.view a.thickbox').attr('href', function () {
|
50 |
-
return $(this).attr('href') + '&iframe&TB_iframe=true';
|
51 |
-
});
|
52 |
-
var delAnswerPrep = function (context) {
|
53 |
-
$('a.delete-answer', context || null).click(function () {
|
54 |
-
if (confirm( opts.delete_answer )) {
|
55 |
-
$(this).parents('li').remove();
|
56 |
-
$('#choices option:last-child').remove();
|
57 |
-
}
|
58 |
-
return false;
|
59 |
-
});
|
60 |
-
};
|
61 |
-
delAnswerPrep();
|
62 |
-
$('#answers').sortable({
|
63 |
-
axis: 'y',
|
64 |
-
containment: 'parent',
|
65 |
-
handle: '.handle',
|
66 |
-
tolerance: 'pointer'
|
67 |
-
});
|
68 |
-
|
69 |
-
function add_answer( aa, src ) {
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
|
73 |
-
var busy = false;
|
74 |
-
$('#add-answer-holder').show().find('button').click(function () {
|
75 |
-
if ( !busy ) {
|
76 |
-
busy = true;
|
77 |
-
var aa = (1 + get_number_answers()).toString();
|
78 |
-
var src = $( this ).closest( 'p' ).attr( 'class' );
|
79 |
-
|
80 |
-
$( 'form[name=add-answer] input[name=aa]' ).val( aa );
|
81 |
-
$( 'form[name=add-answer] input[name=src]' ).val( src );
|
82 |
-
$( 'form[name=add-answer] input[name=action]' ).val( 'polls_add_answer' );
|
83 |
-
|
84 |
-
$( 'form[name=add-answer]' ).ajaxSubmit( function( response ) {
|
85 |
-
delAnswerPrep( $( '#answers' ).append( response ).find( 'li:last' ) );
|
86 |
-
$('#choices').append('<option value="' + (aa-1) + '">' + (aa-1) + '</option>');
|
87 |
-
busy = false;
|
88 |
-
init();
|
89 |
-
} );
|
90 |
-
}
|
91 |
-
return false;
|
92 |
-
});
|
93 |
-
var win = window.dialogArguments || opener || parent || top;
|
94 |
-
$('.polldaddy-send-to-editor').click(function () {
|
95 |
-
var pollID = $(this).parents('div.row-actions').find('.polldaddy-poll-id').val();
|
96 |
-
if (!pollID) pollID = $('.polldaddy-poll-id:first').val();
|
97 |
-
if (pollID){
|
98 |
-
pollID = parseInt(pollID);
|
99 |
-
if ( pollID > 0 ) {
|
100 |
-
win.send_to_editor('[polldaddy poll=' + pollID.toString() + ']');
|
101 |
-
}
|
102 |
-
}
|
103 |
-
});
|
104 |
-
$('.polldaddy-show-shortcode').toggle(function (ev) {
|
105 |
-
ev.preventDefault();
|
106 |
-
$(this).parents('tr:first').next('tr').fadeIn();
|
107 |
-
$(this).parents('tr:first').next('tr').show();
|
108 |
-
$(this).closest('tr').css('display','none');
|
109 |
-
|
110 |
-
return false;
|
111 |
-
}, function () {
|
112 |
-
$(this).parents('tr:first').next('tr').fadeOut();
|
113 |
-
$(this).parents('tr:first').next('tr').hide();
|
114 |
-
return false;
|
115 |
-
});
|
116 |
-
|
117 |
-
$('.pd-embed-done').click(function(ev){
|
118 |
-
ev.preventDefault();
|
119 |
-
$( this ).closest('tr').hide();
|
120 |
-
$( this ).closest('tr').prev('tr').show();
|
121 |
-
|
122 |
-
});
|
123 |
-
|
124 |
-
$( '.pd-tabs a' ).click( function(){
|
125 |
-
if( !jQuery( this ).closest('li').hasClass( 'selected' ) ){
|
126 |
-
|
127 |
-
jQuery( '.pd-tabs li' ).removeClass( 'selected' );
|
128 |
-
jQuery( this ).closest( 'li' ).addClass( 'selected' );
|
129 |
-
|
130 |
-
jQuery( '.pd-tab-panel' ).removeClass( 'show' );
|
131 |
-
jQuery( '.pd-tab-panel#' + $( this ).closest( 'li' ).attr( 'id' ) + '-panel' ).addClass( 'show' );
|
132 |
-
}
|
133 |
-
} );
|
134 |
-
var hiddenStyleID = $(':input[name=styleID]');
|
135 |
-
var customStyle = $(':input[name=customSelect]');
|
136 |
-
var customStyleVal = parseInt(customStyle.val());
|
137 |
-
|
138 |
-
if (customStyleVal > 0) {
|
139 |
-
hiddenStyleID.val(customStyleVal.toString());
|
140 |
-
$( '#pd-custom-styles a' ).click();
|
141 |
-
}
|
142 |
-
|
143 |
-
$("#multipleChoice").click(function () {
|
144 |
-
if ($("#multipleChoice").is(":checked")) {
|
145 |
-
$("#numberChoices").show("fast");
|
146 |
-
} else {
|
147 |
-
$("#numberChoices").hide("fast");
|
148 |
-
}
|
149 |
-
});
|
150 |
-
$('.block-repeat').click(function () {
|
151 |
-
var repeat = jQuery(this).val();
|
152 |
-
if (repeat == 'off') {
|
153 |
-
$('#cookieip_expiration_label').hide();
|
154 |
-
$('#cookieip_expiration').hide();
|
155 |
-
} else {
|
156 |
-
$('#cookieip_expiration_label').show();
|
157 |
-
$('#cookieip_expiration').show();
|
158 |
-
}
|
159 |
-
});
|
160 |
-
var uploading = false;
|
161 |
-
function init() {
|
162 |
-
$('.image').unbind( 'click' ).click(function() {
|
163 |
-
var media_id = $( this ).attr('id').replace('add_poll_image', '');
|
164 |
-
tb_show('Add an Image', 'media-upload.php?type=image&&polls_media=1TB_iframe=1');
|
165 |
-
win.send_to_editor = function(html) {
|
166 |
-
var $h = $('<div/>').html(html);
|
167 |
-
url = $h.find('img').attr('src');
|
168 |
-
tb_remove();
|
169 |
-
send_media( url, media_id );
|
170 |
-
}
|
171 |
-
return false;
|
172 |
-
});
|
173 |
-
$('.video').unbind( 'click' ).click(function() {
|
174 |
-
var media_id = $( this ).attr('id').replace('add_poll_video', '');
|
175 |
-
tb_show('Add Video', 'media-upload.php?type=video&tab=type_url&polls_media=1&TB_iframe=1');
|
176 |
-
win.send_to_editor = function(shortcode) {
|
177 |
-
tb_remove();
|
178 |
-
add_media( media_id, shortcode, '<img height="16" width="16" src="http://i0.poll.fm/images/icon-report-ip-analysis.png" alt="Video Embed">' );
|
179 |
-
}
|
180 |
-
return false;
|
181 |
-
});
|
182 |
-
$('.audio').unbind( 'click' ).click(function() {
|
183 |
-
var media_id = $( this ).attr('id').replace('add_poll_audio', '');
|
184 |
-
tb_show('Add Audio', 'media-upload.php?type=audio&polls_media=1&TB_iframe=1');
|
185 |
-
win.send_to_editor = function(html) {
|
186 |
-
var $h = $('<div/>').html(html);
|
187 |
-
url = $h.find('a').attr('href');
|
188 |
-
tb_remove();
|
189 |
-
send_media( url, media_id );
|
190 |
-
}
|
191 |
-
return false;
|
192 |
-
});
|
193 |
-
}
|
194 |
-
function send_media( url, media_id ) {
|
195 |
-
if ( uploading == true )
|
196 |
-
return false;
|
197 |
-
|
198 |
-
uploading = true;
|
199 |
-
$('input[name="media\[' + media_id + '\]"]').parents('td').find('.media-preview').addClass('st_image_loader');
|
200 |
-
|
201 |
-
$( 'form[name=send-media] input[name=attach-id]' ).val( media_id );
|
202 |
-
$( 'form[name=send-media] input[name=url]' ).val( url );
|
203 |
-
$( 'form[name=send-media] input[name=action]' ).val( 'polls_upload_image' );
|
204 |
-
|
205 |
-
$( 'form[name=send-media]' ).ajaxSubmit( function( response ) {
|
206 |
-
uploading = false;
|
207 |
-
response = response.replace( /<div.*/, '' );
|
208 |
-
|
209 |
-
|
210 |
-
if ( response.substr( 0, 4 ) == 'true' ) {
|
211 |
-
var parts = response.split( '||' );
|
212 |
-
|
213 |
-
add_media( parts[4], parts[1], parts[2] );
|
214 |
-
}
|
215 |
-
} );
|
216 |
-
|
217 |
-
return false;
|
218 |
-
}
|
219 |
-
function add_media( media_id, upload_id, img ) {
|
220 |
-
if (parseInt(upload_id) > 0) $('input[name="mediaType\[' + media_id + '\]"]').val(1);
|
221 |
-
else $('input[name="mediaType\[' + media_id + '\]"]').val(2);
|
222 |
-
|
223 |
-
$('input[name="media\[' + media_id + '\]"]').val(upload_id);
|
224 |
-
$('input[name="media\[' + media_id + '\]"]').parents('td.answer-media-icons').find('li.media-preview').removeClass('st_image_loader');
|
225 |
-
$('input[name="media\[' + media_id + '\]"]').parents('td.answer-media-icons').find('li.media-preview').html(img);
|
226 |
-
};
|
227 |
-
function get_number_answers() {
|
228 |
-
var num_answers = parseInt($('.answer').size());
|
229 |
-
$('input.answer-text').each(function () {
|
230 |
-
var item = this;
|
231 |
-
if ($(item).val() == opts.new_answer || $(item).hasClass('idle')) num_answers--;
|
232 |
-
});
|
233 |
-
return num_answers;
|
234 |
-
}
|
235 |
-
|
236 |
-
init();
|
237 |
-
|
238 |
-
var api = {
|
239 |
-
add_media: add_media
|
240 |
-
};
|
241 |
-
|
242 |
-
return api;
|
243 |
-
}
|
244 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
polldaddy.php
CHANGED
@@ -6,11 +6,11 @@ Plugin URI: http://wordpress.org/extend/plugins/polldaddy/
|
|
6 |
Description: Create and manage Polldaddy polls and ratings in WordPress
|
7 |
Author: Automattic, Inc.
|
8 |
Author URL: http://automattic.com/
|
9 |
-
Version: 2.0.
|
10 |
*/
|
11 |
|
12 |
// You can hardcode your Polldaddy PartnerGUID (API Key) here
|
13 |
-
//define( 'WP_POLLDADDY__PARTNERGUID', '12345
|
14 |
|
15 |
class WP_Polldaddy {
|
16 |
var $errors;
|
@@ -41,10 +41,9 @@ class WP_Polldaddy {
|
|
41 |
$this->polldaddy_clients = array();
|
42 |
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
43 |
$this->is_author = true;
|
44 |
-
$this->id = (int) $current_user->ID;
|
45 |
$this->user_code = null;
|
46 |
$this->rating_user_code = null;
|
47 |
-
|
48 |
}
|
49 |
|
50 |
function &get_client( $api_key, $userCode = null ) {
|
@@ -313,7 +312,7 @@ class WP_Polldaddy {
|
|
313 |
|
314 |
function media_buttons() {
|
315 |
$title = __( 'Add Poll', 'polldaddy' );
|
316 |
-
echo "<a href='admin.php?page=polls&iframe&TB_iframe=true' onclick='return false;' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}polldaddy.png' alt='$title' /></a>";
|
317 |
}
|
318 |
|
319 |
function set_api_user_code() {
|
@@ -345,8 +344,8 @@ class WP_Polldaddy {
|
|
345 |
|
346 |
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
347 |
|
348 |
-
wp_enqueue_script( 'polls', "{$this->base_url}polldaddy.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-form' ), $this->version );
|
349 |
-
wp_enqueue_script( 'polls-common', "{$this->base_url}common.js", array(), $this->version );
|
350 |
|
351 |
if ( $page == 'polls' ) {
|
352 |
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
|
@@ -359,7 +358,7 @@ class WP_Polldaddy {
|
|
359 |
case 'create-poll' :
|
360 |
case 'add-media' :
|
361 |
wp_enqueue_script( 'media-upload', array(), $this->version );
|
362 |
-
wp_enqueue_script( 'polls-style', "
|
363 |
|
364 |
if ( $action == 'create-poll' )
|
365 |
$plugin_page = 'polls&action=create-poll';
|
@@ -367,9 +366,9 @@ class WP_Polldaddy {
|
|
367 |
break;
|
368 |
case 'edit-style' :
|
369 |
case 'create-style' :
|
370 |
-
wp_enqueue_script( 'polls-style', "
|
371 |
-
wp_enqueue_script( 'polls-style-color', "
|
372 |
-
wp_enqueue_style( 'polls', "{$this->base_url}style-editor.css", array(), $this->version );
|
373 |
$plugin_page = 'polls&action=list-styles';
|
374 |
break;
|
375 |
case 'list-styles' :
|
@@ -391,22 +390,24 @@ class WP_Polldaddy {
|
|
391 |
$plugin_page = 'ratings&action=reports';
|
392 |
break;
|
393 |
default :
|
394 |
-
wp_enqueue_script( 'rating-text-color', "
|
395 |
-
wp_enqueue_script( 'ratings',
|
396 |
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
397 |
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
398 |
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
399 |
}//end switch
|
400 |
}
|
401 |
|
402 |
-
wp_enqueue_style( 'polldaddy', "{$this->base_url}polldaddy.css", array(), $this->version );
|
403 |
wp_enqueue_script( 'admin-forms' );
|
404 |
add_thickbox();
|
405 |
-
|
406 |
-
|
|
|
|
|
407 |
|
408 |
if ( isset( $wp_locale->text_direction ) && 'rtl' == $wp_locale->text_direction )
|
409 |
-
wp_enqueue_style( 'polls-rtl', "{$this->base_url}polldaddy-rtl.css", array( 'global', 'wp-admin' ), $this->version );
|
410 |
add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
|
411 |
|
412 |
add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
|
@@ -1027,6 +1028,10 @@ class WP_Polldaddy {
|
|
1027 |
wp_safe_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
1028 |
exit;
|
1029 |
}
|
|
|
|
|
|
|
|
|
1030 |
|
1031 |
function management_page_load_signup() {
|
1032 |
|
@@ -1198,11 +1203,7 @@ class WP_Polldaddy {
|
|
1198 |
case 'results' :
|
1199 |
?>
|
1200 |
|
1201 |
-
|
1202 |
-
if ( $this->is_author )
|
1203 |
-
_e( 'Poll Results', 'polldaddy');
|
1204 |
-
else
|
1205 |
-
_e( 'Poll Results', 'polldaddy'); ?></h2>
|
1206 |
|
1207 |
<?php
|
1208 |
$this->poll_results_page( $poll );
|
@@ -1334,6 +1335,7 @@ class WP_Polldaddy {
|
|
1334 |
|
1335 |
?>
|
1336 |
<form method="post" action="">
|
|
|
1337 |
<div class="tablenav">
|
1338 |
|
1339 |
<?php if ( $this->is_author ) { ?>
|
@@ -1659,6 +1661,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
1659 |
<input type="hidden" value="" name="action">
|
1660 |
<input type="hidden" value="<?php echo $this->user_code; ?>" name="uc">
|
1661 |
<input type="hidden" value="" name="attach-id">
|
|
|
1662 |
<input type="hidden" value="" name="url">
|
1663 |
</form>
|
1664 |
|
@@ -1852,9 +1855,17 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
1852 |
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
1853 |
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
1854 |
<?php if ( $mediaType[999999999] == 2 ) { ?>
|
1855 |
-
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="
|
1856 |
<?php } else { ?>
|
1857 |
-
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1858 |
<?php }
|
1859 |
|
1860 |
if ( !isset( $_GET['iframe'] ) ) : ?>
|
@@ -1911,9 +1922,17 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
1911 |
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
1912 |
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
1913 |
<?php if ( isset( $mediaType[$answer_id] ) && $mediaType[$answer_id] == 2 ) { ?>
|
1914 |
-
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="
|
1915 |
<?php } else { ?>
|
1916 |
-
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1917 |
<?php }
|
1918 |
|
1919 |
if ( !isset( $_GET['iframe'] ) ) : ?>
|
@@ -2252,7 +2271,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
2252 |
<div style="padding:20px;">
|
2253 |
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
2254 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
2255 |
-
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style
|
2256 |
<?php if ( $show_custom ) : foreach ( (array)$styles->style as $style ) :
|
2257 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
2258 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
@@ -2366,7 +2385,8 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
2366 |
style_desc_wide : '<?php echo esc_attr( __( 'Width: 630px, the wide style is good for blog posts.', 'polldaddy' ) ); ?>',
|
2367 |
style_desc_medium : '<?php echo esc_attr( __( 'Width: 300px, the medium style is good for general use.', 'polldaddy' ) ); ?>',
|
2368 |
style_desc_narrow : '<?php echo esc_attr( __( 'Width 150px, the narrow style is good for sidebars etc.', 'polldaddy' ) ); ?>',
|
2369 |
-
style_desc_micro : '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>'
|
|
|
2370 |
}
|
2371 |
pd_build_styles( current_pos );
|
2372 |
<?php if ( $style_ID > 0 && $style_ID <= 1000 ) { ?>
|
@@ -2416,7 +2436,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
2416 |
}
|
2417 |
|
2418 |
$class = $class ? '' : ' class="alternate"';
|
2419 |
-
$content = $results->others && 'Other answer
|
2420 |
|
2421 |
?>
|
2422 |
|
@@ -2664,7 +2684,7 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
2664 |
<option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
|
2665 |
<option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
|
2666 |
</select>
|
2667 |
-
<a tabindex="4" id="style-preload" href="javascript:
|
2668 |
</div>
|
2669 |
</td>
|
2670 |
</tr>
|
@@ -4636,15 +4656,15 @@ src="http://static.polldaddy.com/p/<?php echo (int) $poll_id; ?>.js"></scr
|
|
4636 |
if ( $avg_rating == ( $c - 1 + 0.5 ) )
|
4637 |
$image_pos = 'center left';
|
4638 |
} ?>
|
4639 |
-
<div style="width: 20px; height: 20px; background: url(
|
4640 |
endfor; ?>
|
4641 |
<br class="clear" />
|
4642 |
</div><?php
|
4643 |
} else { ?>
|
4644 |
<div>
|
4645 |
-
<div style="margin: 0px 0px 0px 20px; background: transparent url(
|
4646 |
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total1 );?></div>
|
4647 |
-
<div style="margin: 0px; background: transparent url(
|
4648 |
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total2 );?></div>
|
4649 |
<br class="clear" />
|
4650 |
</div><?php
|
@@ -4958,4 +4978,4 @@ require dirname( __FILE__ ).'/ajax.php';
|
|
4958 |
require dirname( __FILE__ ).'/popups.php';
|
4959 |
require dirname( __FILE__ ).'/polldaddy-org.php';
|
4960 |
|
4961 |
-
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
6 |
Description: Create and manage Polldaddy polls and ratings in WordPress
|
7 |
Author: Automattic, Inc.
|
8 |
Author URL: http://automattic.com/
|
9 |
+
Version: 2.0.14
|
10 |
*/
|
11 |
|
12 |
// You can hardcode your Polldaddy PartnerGUID (API Key) here
|
13 |
+
//define( 'WP_POLLDADDY__PARTNERGUID', '12345…' );
|
14 |
|
15 |
class WP_Polldaddy {
|
16 |
var $errors;
|
41 |
$this->polldaddy_clients = array();
|
42 |
$this->is_admin = (bool) current_user_can( 'manage_options' );
|
43 |
$this->is_author = true;
|
|
|
44 |
$this->user_code = null;
|
45 |
$this->rating_user_code = null;
|
46 |
+
$this->id = ($current_user instanceof WP_User) ? intval( $current_user->ID ): 0;
|
47 |
}
|
48 |
|
49 |
function &get_client( $api_key, $userCode = null ) {
|
312 |
|
313 |
function media_buttons() {
|
314 |
$title = __( 'Add Poll', 'polldaddy' );
|
315 |
+
echo "<a href='admin.php?page=polls&iframe&TB_iframe=true' onclick='return false;' id='add_poll' class='thickbox' title='$title'><img src='{$this->base_url}img/polldaddy.png' alt='$title' /></a>";
|
316 |
}
|
317 |
|
318 |
function set_api_user_code() {
|
344 |
|
345 |
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
|
346 |
|
347 |
+
wp_enqueue_script( 'polls', "{$this->base_url}js/polldaddy.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-form' ), $this->version );
|
348 |
+
wp_enqueue_script( 'polls-common', "{$this->base_url}js/common.js", array(), $this->version );
|
349 |
|
350 |
if ( $page == 'polls' ) {
|
351 |
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
|
358 |
case 'create-poll' :
|
359 |
case 'add-media' :
|
360 |
wp_enqueue_script( 'media-upload', array(), $this->version );
|
361 |
+
wp_enqueue_script( 'polls-style', "{$this->base_url}js/poll-style-picker.js", array( 'polls', 'polls-common' ), $this->version );
|
362 |
|
363 |
if ( $action == 'create-poll' )
|
364 |
$plugin_page = 'polls&action=create-poll';
|
366 |
break;
|
367 |
case 'edit-style' :
|
368 |
case 'create-style' :
|
369 |
+
wp_enqueue_script( 'polls-style', "{$this->base_url}js/style-editor.js", array( 'polls', 'polls-common' ), $this->version );
|
370 |
+
wp_enqueue_script( 'polls-style-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
371 |
+
wp_enqueue_style( 'polls', "{$this->base_url}css/style-editor.css", array(), $this->version );
|
372 |
$plugin_page = 'polls&action=list-styles';
|
373 |
break;
|
374 |
case 'list-styles' :
|
390 |
$plugin_page = 'ratings&action=reports';
|
391 |
break;
|
392 |
default :
|
393 |
+
wp_enqueue_script( 'rating-text-color', "{$this->base_url}js/jscolor.js", array(), $this->version );
|
394 |
+
wp_enqueue_script( 'ratings', "{$this->base_url}js/rating.js", array(), $this->version );
|
395 |
wp_localize_script( 'polls-common', 'adminRatingsL10n', array(
|
396 |
'star_colors' => __( 'Star Colors', 'polldaddy' ), 'star_size' => __( 'Star Size', 'polldaddy' ),
|
397 |
'nero_type' => __( 'Nero Type', 'polldaddy' ), 'nero_size' => __( 'Nero Size', 'polldaddy' ), ) );
|
398 |
}//end switch
|
399 |
}
|
400 |
|
401 |
+
wp_enqueue_style( 'polldaddy', "{$this->base_url}css/polldaddy.css", array(), $this->version );
|
402 |
wp_enqueue_script( 'admin-forms' );
|
403 |
add_thickbox();
|
404 |
+
|
405 |
+
if ( isset( $_GET['iframe'] ) ) {
|
406 |
+
add_action( 'admin_head', array( &$this, 'hide_admin_menu' ) );
|
407 |
+
}
|
408 |
|
409 |
if ( isset( $wp_locale->text_direction ) && 'rtl' == $wp_locale->text_direction )
|
410 |
+
wp_enqueue_style( 'polls-rtl', "{$this->base_url}css/polldaddy-rtl.css", array( 'global', 'wp-admin' ), $this->version );
|
411 |
add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
|
412 |
|
413 |
add_action( 'admin_notices', array( &$this, 'management_page_notices' ) );
|
1028 |
wp_safe_redirect( add_query_arg( $query_args, wp_get_referer() ) );
|
1029 |
exit;
|
1030 |
}
|
1031 |
+
|
1032 |
+
function hide_admin_menu() {
|
1033 |
+
echo '<style>#adminmenuback,#adminmenuwrap,#screen-meta-links,#footer{display:none;visibility:hidden;}#wpcontent{margin-left:10px;}</style>';
|
1034 |
+
}
|
1035 |
|
1036 |
function management_page_load_signup() {
|
1037 |
|
1203 |
case 'results' :
|
1204 |
?>
|
1205 |
|
1206 |
+
<h2 id="poll-list-header"><?php printf( __( 'Poll Results <a href="%s" class="button add-new-h2">All Polls</a>', 'polldaddy' ), esc_url( add_query_arg( array( 'action' => 'polls', 'poll' => false, 'message' => false ) ) ) ); ?></h2>
|
|
|
|
|
|
|
|
|
1207 |
|
1208 |
<?php
|
1209 |
$this->poll_results_page( $poll );
|
1335 |
|
1336 |
?>
|
1337 |
<form method="post" action="">
|
1338 |
+
<input type="hidden" name="iframe" id="iframe1" value="<?php echo isset( $_GET['iframe'] ) ? 1: 0;?>">
|
1339 |
<div class="tablenav">
|
1340 |
|
1341 |
<?php if ( $this->is_author ) { ?>
|
1661 |
<input type="hidden" value="" name="action">
|
1662 |
<input type="hidden" value="<?php echo $this->user_code; ?>" name="uc">
|
1663 |
<input type="hidden" value="" name="attach-id">
|
1664 |
+
<input type="hidden" value="" name="media-id">
|
1665 |
<input type="hidden" value="" name="url">
|
1666 |
</form>
|
1667 |
|
1855 |
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
1856 |
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
1857 |
<?php if ( $mediaType[999999999] == 2 ) { ?>
|
1858 |
+
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo plugins_url( 'img/icon-report-ip-analysis', __FILE__ ); ?>" alt="Video Embed"></li>
|
1859 |
<?php } else { ?>
|
1860 |
+
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php
|
1861 |
+
$url = '';
|
1862 |
+
if ( isset($media[999999999]) ) {
|
1863 |
+
$url = urldecode( $media[999999999]->img_small );
|
1864 |
+
|
1865 |
+
if ( is_ssl() )
|
1866 |
+
$url = preg_replace( '/http\:/', 'https:', $url );
|
1867 |
+
}
|
1868 |
+
echo $url; ?></li>
|
1869 |
<?php }
|
1870 |
|
1871 |
if ( !isset( $_GET['iframe'] ) ) : ?>
|
1922 |
<td class="answer-media-icons" <?php echo isset( $_GET['iframe'] ) ? 'style="width: 55px !important;"' : '';?>>
|
1923 |
<ul class="answer-media" <?php echo isset( $_GET['iframe'] ) ? 'style="min-width: 30px;"' : '';?>>
|
1924 |
<?php if ( isset( $mediaType[$answer_id] ) && $mediaType[$answer_id] == 2 ) { ?>
|
1925 |
+
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><img height="16" width="16" src="<?php echo plugins_url( 'img/icon-report-ip-analysis', __FILE__ ); ?>" alt="Video Embed"></li>
|
1926 |
<?php } else { ?>
|
1927 |
+
<li class="media-preview" style="width: 20px; height: 16px; padding-left: 5px;"><?php
|
1928 |
+
$url = '';
|
1929 |
+
if ( isset($media[$answer_id]) ) {
|
1930 |
+
$url = urldecode( $media[$answer_id]->img_small );
|
1931 |
+
|
1932 |
+
if ( is_ssl() )
|
1933 |
+
$url = preg_replace( '/http\:/', 'https:', $url );
|
1934 |
+
}
|
1935 |
+
echo $url; ?></li>
|
1936 |
<?php }
|
1937 |
|
1938 |
if ( !isset( $_GET['iframe'] ) ) : ?>
|
2271 |
<div style="padding:20px;">
|
2272 |
<select id="customSelect" name="customSelect" onchange="javascript:pd_change_style(this.value);">
|
2273 |
<?php $selected = $custom_style_ID == 0 ? ' selected="selected"' : ''; ?>
|
2274 |
+
<option value="x"<?php echo $selected; ?>><?php _e( 'Please choose a custom style…', 'polldaddy' ); ?></option>
|
2275 |
<?php if ( $show_custom ) : foreach ( (array)$styles->style as $style ) :
|
2276 |
$selected = $style->_id == $custom_style_ID ? ' selected="selected"' : ''; ?>
|
2277 |
<option value="<?php echo (int) $style->_id; ?>"<?php echo $selected; ?>><?php echo esc_html( $style->title ); ?></option>
|
2385 |
style_desc_wide : '<?php echo esc_attr( __( 'Width: 630px, the wide style is good for blog posts.', 'polldaddy' ) ); ?>',
|
2386 |
style_desc_medium : '<?php echo esc_attr( __( 'Width: 300px, the medium style is good for general use.', 'polldaddy' ) ); ?>',
|
2387 |
style_desc_narrow : '<?php echo esc_attr( __( 'Width 150px, the narrow style is good for sidebars etc.', 'polldaddy' ) ); ?>',
|
2388 |
+
style_desc_micro : '<?php echo esc_attr( __( 'Width 150px, the micro style is useful when space is tight.', 'polldaddy' ) ); ?>',
|
2389 |
+
image_path : '<?php echo plugins_url( 'img', __FILE__ );?>'
|
2390 |
}
|
2391 |
pd_build_styles( current_pos );
|
2392 |
<?php if ( $style_ID > 0 && $style_ID <= 1000 ) { ?>
|
2436 |
}
|
2437 |
|
2438 |
$class = $class ? '' : ' class="alternate"';
|
2439 |
+
$content = $results->others && 'Other answer…' === $answer->text ? sprintf( __( 'Other (<a href="%s">see below</a>)', 'polldaddy' ), '#other-answers-results' ) : esc_html( $answer->text );
|
2440 |
|
2441 |
?>
|
2442 |
|
2684 |
<option value="117"><?php _e( 'Skull Light', 'polldaddy' ); ?></option>
|
2685 |
<option value="157"><?php _e( 'Micro', 'polldaddy' ); ?></option>
|
2686 |
</select>
|
2687 |
+
<a tabindex="4" id="style-preload" href="javascript:preload_style();" class="button"><?php echo esc_attr( __( 'Load Style', 'polldaddy' ) ); ?></a>
|
2688 |
</div>
|
2689 |
</td>
|
2690 |
</tr>
|
4656 |
if ( $avg_rating == ( $c - 1 + 0.5 ) )
|
4657 |
$image_pos = 'center left';
|
4658 |
} ?>
|
4659 |
+
<div style="width: 20px; height: 20px; background: url(<?php echo plugins_url( 'img/star-yellow-med.png', __FILE__ ); ?>) <?php echo $image_pos; ?>; float: left;"></div><?php
|
4660 |
endfor; ?>
|
4661 |
<br class="clear" />
|
4662 |
</div><?php
|
4663 |
} else { ?>
|
4664 |
<div>
|
4665 |
+
<div style="margin: 0px 0px 0px 20px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-up.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
4666 |
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total1 );?></div>
|
4667 |
+
<div style="margin: 0px; background: transparent url(<?php echo plugins_url( 'img/rate-graph-dn.png', __FILE__ ); ?>); width: 20px; height: 20px; float: left;"></div>
|
4668 |
<div style="float:left; line-height: 20px; padding: 0px 10px 0px 5px;"><?php echo number_format( $rating->total2 );?></div>
|
4669 |
<br class="clear" />
|
4670 |
</div><?php
|
4978 |
require dirname( __FILE__ ).'/popups.php';
|
4979 |
require dirname( __FILE__ ).'/polldaddy-org.php';
|
4980 |
|
4981 |
+
$GLOBALS[ 'wp_log_plugins' ][] = 'polldaddy';
|
rating.php
CHANGED
@@ -18,13 +18,10 @@ function polldaddy_show_rating_comments( $content ) {
|
|
18 |
$title = mb_substr( preg_replace( '/[\x00-\x1F\x80-\xFF]/', '', $comment->comment_content ), 0, 195 ) . '...';
|
19 |
$permalink = get_permalink( $post->ID ) . '#comment-' . $comment->comment_ID;
|
20 |
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, '_comm_' . $comment->comment_ID );
|
21 |
-
|
22 |
-
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
23 |
-
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
24 |
}
|
25 |
|
26 |
if ( $rating_pos == 0 )
|
27 |
-
$content = $html . $content;
|
28 |
else
|
29 |
$content .= $html;
|
30 |
}
|
@@ -49,7 +46,7 @@ function polldaddy_show_rating( $content ) {
|
|
49 |
}
|
50 |
|
51 |
if ( $rating_pos == 0 )
|
52 |
-
$content = $html . $content;
|
53 |
else
|
54 |
$content .= $html;
|
55 |
}
|
@@ -109,7 +106,7 @@ function polldaddy_get_rating_html( $condition = '' ) {
|
|
109 |
$rating_title_filter = get_option( 'pd-rating-title-filter' );
|
110 |
|
111 |
if ( $rating_title_filter === false )
|
112 |
-
$title = apply_filters( 'wp_title', $post->post_title
|
113 |
elseif ( strlen( $rating_title_filter ) > 0 )
|
114 |
$title = apply_filters( $rating_title_filter, $post->post_title );
|
115 |
else
|
@@ -117,8 +114,6 @@ function polldaddy_get_rating_html( $condition = '' ) {
|
|
117 |
|
118 |
$permalink = get_permalink( $post->ID );
|
119 |
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id );
|
120 |
-
wp_register_script( 'polldaddy-rating-js', 'http://i.polldaddy.com/ratings/rating.js' );
|
121 |
-
add_filter( 'wp_footer', 'polldaddy_add_rating_js' );
|
122 |
}
|
123 |
}
|
124 |
return $html;
|
@@ -135,31 +130,14 @@ function polldaddy_get_rating_html( $condition = '' ) {
|
|
135 |
* @param string $item_id
|
136 |
* @return HTML snippet with a ratings container and a related JS block defining a new variable
|
137 |
*/
|
138 |
-
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
139 |
-
$
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
$settings = array(
|
144 |
-
'id' => $rating_id,
|
145 |
-
'unique_id' => $unique_id,
|
146 |
-
'title' => rawurlencode( trim( $title ) ),
|
147 |
-
'permalink' => esc_url_raw( $permalink )
|
148 |
-
);
|
149 |
-
|
150 |
-
if ( !empty( $item_id ) )
|
151 |
-
$settings['item_id'] = $item_id;
|
152 |
-
|
153 |
-
$settings = json_encode( $settings );
|
154 |
-
|
155 |
-
$html .= <<<EOD
|
156 |
-
<div class="pd-rating" id="pd_rating_holder_{$rating_id}{$item_id}"></div>
|
157 |
-
<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
|
158 |
-
PDRTJS_settings_{$rating_id}{$item_id}={$settings};
|
159 |
-
//--><!]]></script>
|
160 |
-
EOD;
|
161 |
|
162 |
-
|
|
|
|
|
163 |
}
|
164 |
|
165 |
function polldaddy_show_rating_excerpt( $content ) {
|
@@ -178,4 +156,4 @@ if ( (int) get_option( 'pd-rating-pages' ) > 0 || (int) get_option( 'pd-rating-p
|
|
178 |
}
|
179 |
|
180 |
add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
|
181 |
-
?>
|
18 |
$title = mb_substr( preg_replace( '/[\x00-\x1F\x80-\xFF]/', '', $comment->comment_content ), 0, 195 ) . '...';
|
19 |
$permalink = get_permalink( $post->ID ) . '#comment-' . $comment->comment_ID;
|
20 |
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, '_comm_' . $comment->comment_ID );
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
if ( $rating_pos == 0 )
|
24 |
+
$content = $html . '<br/>' . $content;
|
25 |
else
|
26 |
$content .= $html;
|
27 |
}
|
46 |
}
|
47 |
|
48 |
if ( $rating_pos == 0 )
|
49 |
+
$content = $html . '<br/>' . $content;
|
50 |
else
|
51 |
$content .= $html;
|
52 |
}
|
106 |
$rating_title_filter = get_option( 'pd-rating-title-filter' );
|
107 |
|
108 |
if ( $rating_title_filter === false )
|
109 |
+
$title = apply_filters( 'wp_title', $post->post_title );
|
110 |
elseif ( strlen( $rating_title_filter ) > 0 )
|
111 |
$title = apply_filters( $rating_title_filter, $post->post_title );
|
112 |
else
|
114 |
|
115 |
$permalink = get_permalink( $post->ID );
|
116 |
$html = polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id );
|
|
|
|
|
117 |
}
|
118 |
}
|
119 |
return $html;
|
130 |
* @param string $item_id
|
131 |
* @return HTML snippet with a ratings container and a related JS block defining a new variable
|
132 |
*/
|
133 |
+
function polldaddy_get_rating_code( $rating_id, $unique_id, $title, $permalink, $item_id = '' ) {
|
134 |
+
$html = sprintf( '[polldaddy rating="%d" item_id="%s" unique_id="%s" title="%s" permalink="%s"]', absint( $rating_id ), polldaddy_sanitize_shortcode( $item_id ), polldaddy_sanitize_shortcode( $unique_id ), polldaddy_sanitize_shortcode( $title ), polldaddy_sanitize_shortcode( $permalink ) );
|
135 |
+
return do_shortcode( $html );
|
136 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
+
function polldaddy_sanitize_shortcode( $text ) {
|
139 |
+
$text = preg_replace( array( '/\[/', '/\]/' ), array( '[', ']' ), $text );
|
140 |
+
return esc_attr( $text );
|
141 |
}
|
142 |
|
143 |
function polldaddy_show_rating_excerpt( $content ) {
|
156 |
}
|
157 |
|
158 |
add_filter( 'comment_text', 'polldaddy_show_rating_comments', 50 );
|
159 |
+
?>
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: eoigal, alternatekev, mdawaffe, donncha, johnny5
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 3.2
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 2.0.
|
7 |
|
8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
9 |
|
@@ -77,9 +77,9 @@ Want to help translate the plugin or keep an existing translation up-to-date? He
|
|
77 |
|
78 |
== Installation ==
|
79 |
|
80 |
-
Upload the plugin to your blog,
|
81 |
|
82 |
-
You can find further help on our [support page](http://support.polldaddy.com/
|
83 |
|
84 |
== Screenshots ==
|
85 |
|
@@ -112,7 +112,7 @@ More info here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
|
|
112 |
|
113 |
= I cannot access my ratings settings, I am getting a "Sorry! There was an error creating your rating widget. Please contact Polldaddy support to fix this." message. =
|
114 |
|
115 |
-
You need to select the synchronize ratings account in the
|
116 |
|
117 |
= When I try to use a rating on a page, I get a PHP warning about the post title. =
|
118 |
|
@@ -124,11 +124,17 @@ Your theme is getting the post content, without necessarily showing it. If the p
|
|
124 |
|
125 |
|
126 |
== Upgrade Notice ==
|
127 |
-
= 2.0.
|
128 |
-
|
129 |
|
130 |
== Changelog ==
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
= 2.0.13 =
|
133 |
* Updated translation files and fixed gettext domain in plugin strings
|
134 |
* Fixed wp_title filter parameter
|
2 |
Contributors: eoigal, alternatekev, mdawaffe, donncha, johnny5
|
3 |
Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
|
4 |
Requires at least: 3.2
|
5 |
+
Tested up to: 3.4.1
|
6 |
+
Stable tag: 2.0.14
|
7 |
|
8 |
Create and manage Polldaddy polls and ratings from within WordPress.
|
9 |
|
77 |
|
78 |
== Installation ==
|
79 |
|
80 |
+
Upload the plugin to your blog (or search for it and install it on your plugins page), activate it, then go to the Polls page. Enter your [Polldaddy.com](http://polldaddy.com/) email address and password to sync your account and pull in your existing polls and ratings.
|
81 |
|
82 |
+
You can find further help on our [support page](http://support.polldaddy.com/). If you have any problems please use the [support forum](http://wordpress.org/tags/polldaddy?forum_id=10). The plugin also logs activity to a file using the [WP Debug Logger](http://wordpress.org/extend/plugins/wp-debug-logger/) plugin which can be useful in determining the cause of a problem.
|
83 |
|
84 |
== Screenshots ==
|
85 |
|
112 |
|
113 |
= I cannot access my ratings settings, I am getting a "Sorry! There was an error creating your rating widget. Please contact Polldaddy support to fix this." message. =
|
114 |
|
115 |
+
You need to select the synchronize ratings account in the WordPress options page at Settings->Polls & Ratings to make sure the ratings API key is valid.
|
116 |
|
117 |
= When I try to use a rating on a page, I get a PHP warning about the post title. =
|
118 |
|
124 |
|
125 |
|
126 |
== Upgrade Notice ==
|
127 |
+
= 2.0.14 =
|
128 |
+
SSL support and faster page loads
|
129 |
|
130 |
== Changelog ==
|
131 |
|
132 |
+
= 2.0.14
|
133 |
+
* Added support for SSL on the admin dashboard.
|
134 |
+
* Updated the shortcodes to load more efficiently in the footer.
|
135 |
+
* Fixed number of minor javascript errors.
|
136 |
+
* Fixed bug with admin menu and toolbar showing in popup
|
137 |
+
|
138 |
= 2.0.13 =
|
139 |
* Updated translation files and fixed gettext domain in plugin strings
|
140 |
* Fixed wp_title filter parameter
|