Version Description
N/A
Download this release
Release Info
Developer | yoffegil |
Plugin | Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page |
Version | 12.3.0 |
Comparing to | |
See all releases |
Code changes from version 12.2.0 to 12.3.0
- opinionstage-article-placement-functions.php +13 -11
- opinionstage-callback.php +4 -4
- opinionstage-functions.php +81 -82
- opinionstage-polls.php +3 -3
- opinionstage-utility-functions.php +10 -5
- opinionstage-widget.php +59 -68
- opinionstage_plugin.js +21 -1
- readme.txt +2 -0
- style.css +14 -0
opinionstage-article-placement-functions.php
CHANGED
@@ -7,18 +7,20 @@
|
|
7 |
static function the_content($content) {
|
8 |
global $post;
|
9 |
$type = $post->post_type;
|
10 |
-
if(
|
11 |
-
|
12 |
}
|
13 |
-
$
|
14 |
-
|
15 |
-
$
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
}
|
23 |
return $content;
|
24 |
}
|
7 |
static function the_content($content) {
|
8 |
global $post;
|
9 |
$type = $post->post_type;
|
10 |
+
if (is_front_page() && is_home()) {
|
11 |
+
return $content;
|
12 |
}
|
13 |
+
if($type == "post") {
|
14 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
15 |
+
if (!empty($os_options['article_placement_id']) && $os_options['article_placement_active'] == 'true' && !is_admin() ) {
|
16 |
+
$shortcode = do_shortcode(
|
17 |
+
sprintf(
|
18 |
+
'[osplacement id="%s"]',
|
19 |
+
$os_options['article_placement_id']
|
20 |
+
)
|
21 |
+
);
|
22 |
+
return $content . $shortcode;
|
23 |
+
}
|
24 |
}
|
25 |
return $content;
|
26 |
}
|
opinionstage-callback.php
CHANGED
@@ -15,9 +15,9 @@
|
|
15 |
'fly_id',
|
16 |
'article_placement_id',
|
17 |
'sidebar_placement_id'));
|
18 |
-
|
19 |
-
$
|
20 |
?>
|
21 |
<script type="text/javascript">
|
22 |
-
window.location = "<?php echo($
|
23 |
-
</script>
|
15 |
'fly_id',
|
16 |
'article_placement_id',
|
17 |
'sidebar_placement_id'));
|
18 |
+
|
19 |
+
$redirect_url = get_admin_url('', '', 'admin').'admin.php?page='.OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-polls.php';
|
20 |
?>
|
21 |
<script type="text/javascript">
|
22 |
+
window.location = "<?php echo($redirect_url) ?>";
|
23 |
+
</script>
|
opinionstage-functions.php
CHANGED
@@ -64,88 +64,66 @@ function opinionstage_poll_menu() {
|
|
64 |
* Instructions page for adding a poll
|
65 |
*/
|
66 |
function opinionstage_add_poll_page() {
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
};
|
80 |
-
|
81 |
-
if(input.val().trim() != "") {
|
82 |
-
input.removeClass('os-watermark');
|
83 |
-
} else {
|
84 |
-
input.val(input.data('watermark'));
|
85 |
-
input.addClass('os-watermark');
|
86 |
-
}
|
87 |
-
};
|
88 |
-
var toggleSettingsAjax = function(currObject, action) {
|
89 |
-
$.post(ajaxurl, {action: action, activate: currObject.is(':checked')}, function(response) { });
|
90 |
-
};
|
91 |
-
|
92 |
-
$('#start-login').click(function(){
|
93 |
-
var emailInput = $('#os-email');
|
94 |
-
var email = $(emailInput).val();
|
95 |
-
if (email == emailInput.data('watermark')) {
|
96 |
-
email = "";
|
97 |
-
}
|
98 |
-
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL()) + "&email=" + email;
|
99 |
-
window.location = new_location;
|
100 |
-
});
|
101 |
-
|
102 |
-
$('#switch-email').click(function(){
|
103 |
-
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL());
|
104 |
-
window.location = new_location;
|
105 |
-
});
|
106 |
-
|
107 |
-
$('#os-email').keypress(function(e){
|
108 |
-
if (e.keyCode == 13) {
|
109 |
-
$('#start-login').click();
|
110 |
-
}
|
111 |
-
});
|
112 |
-
|
113 |
-
$('input.watermark').focus(function(){
|
114 |
-
var input = $(this);
|
115 |
-
if (input.data('watermark') == input.val()) {
|
116 |
-
input.val("");
|
117 |
-
input.removeClass('os-watermark');
|
118 |
-
}
|
119 |
-
}).each(function(){
|
120 |
-
handleWatermark($(this));
|
121 |
-
}).blur(function(){
|
122 |
-
handleWatermark($(this));
|
123 |
-
});
|
124 |
-
|
125 |
-
$('#fly-out-switch').change(function(){
|
126 |
-
toggleSettingsAjax($(this), "opinionstage_ajax_toggle_flyout");
|
127 |
-
});
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
132 |
});
|
133 |
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
<div id="opinionstage-head"></div>
|
137 |
<div class="section">
|
138 |
-
|
139 |
<h2>Connect to Opinion Stage</h3>
|
140 |
-
<p>Connect WordPress with Opinion Stage to enable all features</p>
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
<p>You are connected to Opinion Stage with the following email</p>
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
</div>
|
150 |
|
151 |
<div class="section">
|
@@ -154,7 +132,7 @@ function opinionstage_add_poll_page() {
|
|
154 |
<li><?php echo opinionstage_create_poll_link(); ?></li>
|
155 |
<li><?php echo opinionstage_dashboard_link('Manage Polls', 'polls'); ?></li>
|
156 |
<li><?php echo opinionstage_create_set_link(); ?></li>
|
157 |
-
<li><?php echo opinionstage_dashboard_link('Manage Sets', 'sets'); ?></li>
|
158 |
</ul>
|
159 |
</div>
|
160 |
<div class="section">
|
@@ -164,7 +142,7 @@ function opinionstage_add_poll_page() {
|
|
164 |
<div class="text">
|
165 |
Fly-out
|
166 |
</div>
|
167 |
-
<a href="http://blog.opinionstage.com/fly-out-placements
|
168 |
</div>
|
169 |
<div class="onoffswitch left <?php echo($first_time ? "disabled" : "")?>">
|
170 |
<input type="checkbox" name="fly-out-switch" class="onoffswitch-checkbox" <?php echo($first_time ? "disabled" : "")?> id="fly-out-switch" <?php echo($os_options['fly_out_active'] == 'true' ? "checked" : "") ?>>
|
@@ -175,14 +153,14 @@ function opinionstage_add_poll_page() {
|
|
175 |
</div>
|
176 |
<?php if(!$first_time) {?>
|
177 |
<a href="<?php echo opinionstage_flyout_edit_url(); ?>" target="_blank">Configure</a>
|
178 |
-
|
179 |
</div>
|
180 |
<div class="placement_wrapper">
|
181 |
<div class='description'>
|
182 |
<div class="text">
|
183 |
Article Section
|
184 |
</div>
|
185 |
-
<a href="http://blog.opinionstage.com/
|
186 |
</div>
|
187 |
<div class="onoffswitch left <?php echo($first_time ? "disabled" : "")?>">
|
188 |
<input type="checkbox" name="article-placement-switch" class="onoffswitch-checkbox" <?php echo($first_time ? "disabled" : "")?> id="article-placement-switch" <?php echo($os_options['article_placement_active'] == 'true' ? "checked" : "") ?>>
|
@@ -193,8 +171,29 @@ function opinionstage_add_poll_page() {
|
|
193 |
</div>
|
194 |
<?php if(!$first_time) {?>
|
195 |
<a href="<?php echo opinionstage_article_placement_edit_url(); ?>" target="_blank">Configure</a>
|
196 |
-
|
197 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
</div>
|
199 |
<div class="section">
|
200 |
<h2>Monetization</h2>
|
@@ -210,8 +209,8 @@ function opinionstage_add_poll_page() {
|
|
210 |
<li><a href="https://opinionstage.zendesk.com/anonymous_requests/new" target="_blank">Contact Us</a></li>
|
211 |
</ul>
|
212 |
</div>
|
213 |
-
|
214 |
-
|
215 |
}
|
216 |
|
217 |
/**
|
64 |
* Instructions page for adding a poll
|
65 |
*/
|
66 |
function opinionstage_add_poll_page() {
|
67 |
+
opinionstage_add_stylesheet();
|
68 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
69 |
+
if (empty($os_options["uid"])) {
|
70 |
+
$first_time = true;
|
71 |
+
} else {
|
72 |
+
$first_time = false;
|
73 |
+
}
|
74 |
+
?>
|
75 |
+
<script type='text/javascript'>
|
76 |
+
jQuery(document).ready(function($) {
|
77 |
+
var callbackURL = "<?php echo opinionstage_callback_url()?>";
|
78 |
+
var toggleSettingsAjax = function(currObject, action) {
|
79 |
+
$.post(ajaxurl, {action: action, activate: currObject.is(':checked')}, function(response) { });
|
80 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
$('#os-start-login').click(function(){
|
83 |
+
var emailInput = $('#os-email');
|
84 |
+
var email = $(emailInput).val();
|
85 |
+
if (email == emailInput.data('watermark')) {
|
86 |
+
email = "";
|
87 |
+
}
|
88 |
+
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL) + "&email=" + email;
|
89 |
+
window.location = new_location;
|
90 |
});
|
91 |
|
92 |
+
$('#os-switch-email').click(function(){
|
93 |
+
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL);
|
94 |
+
window.location = new_location;
|
95 |
+
});
|
96 |
+
|
97 |
+
$('#os-email').keypress(function(e){
|
98 |
+
if (e.keyCode == 13) {
|
99 |
+
$('#os-start-login').click();
|
100 |
+
}
|
101 |
+
});
|
102 |
+
|
103 |
+
$('#fly-out-switch').change(function(){
|
104 |
+
toggleSettingsAjax($(this), "opinionstage_ajax_toggle_flyout");
|
105 |
+
});
|
106 |
+
|
107 |
+
$('#article-placement-switch').change(function(){
|
108 |
+
toggleSettingsAjax($(this), "opinionstage_ajax_toggle_article_placement");
|
109 |
+
});
|
110 |
+
});
|
111 |
+
|
112 |
+
</script>
|
113 |
+
<div class="opinionstage-wrap">
|
114 |
<div id="opinionstage-head"></div>
|
115 |
<div class="section">
|
116 |
+
<?php if($first_time) {?>
|
117 |
<h2>Connect to Opinion Stage</h3>
|
118 |
+
<p class='os-notice'>Connect WordPress with Opinion Stage to enable all features</p>
|
119 |
+
<input id="os-email" type="text" value="" class="watermark" data-watermark="Enter Your Email"/>
|
120 |
+
<a href="javascript:void(0)" class="os-button" id="os-start-login">Connect</a>
|
121 |
+
<?php } else { ?>
|
122 |
<p>You are connected to Opinion Stage with the following email</p>
|
123 |
+
<label class="checked" for="user-email"></label>
|
124 |
+
<input id="os-email" type="text" disabled="disabled" value="<?php echo($os_options["email"]) ?>"/>
|
125 |
+
<a href="javascript:void(0)" class="os-button" id="os-switch-email" >Switch Account</a>
|
126 |
+
<?php } ?>
|
127 |
</div>
|
128 |
|
129 |
<div class="section">
|
132 |
<li><?php echo opinionstage_create_poll_link(); ?></li>
|
133 |
<li><?php echo opinionstage_dashboard_link('Manage Polls', 'polls'); ?></li>
|
134 |
<li><?php echo opinionstage_create_set_link(); ?></li>
|
135 |
+
<li><?php echo opinionstage_dashboard_link('Manage Sets', 'sets'); ?></li>
|
136 |
</ul>
|
137 |
</div>
|
138 |
<div class="section">
|
142 |
<div class="text">
|
143 |
Fly-out
|
144 |
</div>
|
145 |
+
<a href="http://blog.opinionstage.com/fly-out-placements-in-wordpress/" class="question-link" target="_blank">(?)</a>
|
146 |
</div>
|
147 |
<div class="onoffswitch left <?php echo($first_time ? "disabled" : "")?>">
|
148 |
<input type="checkbox" name="fly-out-switch" class="onoffswitch-checkbox" <?php echo($first_time ? "disabled" : "")?> id="fly-out-switch" <?php echo($os_options['fly_out_active'] == 'true' ? "checked" : "") ?>>
|
153 |
</div>
|
154 |
<?php if(!$first_time) {?>
|
155 |
<a href="<?php echo opinionstage_flyout_edit_url(); ?>" target="_blank">Configure</a>
|
156 |
+
<?php } ?>
|
157 |
</div>
|
158 |
<div class="placement_wrapper">
|
159 |
<div class='description'>
|
160 |
<div class="text">
|
161 |
Article Section
|
162 |
</div>
|
163 |
+
<a href="http://blog.opinionstage.com/article-placements/" class="question-link" target="_blank">(?)</a>
|
164 |
</div>
|
165 |
<div class="onoffswitch left <?php echo($first_time ? "disabled" : "")?>">
|
166 |
<input type="checkbox" name="article-placement-switch" class="onoffswitch-checkbox" <?php echo($first_time ? "disabled" : "")?> id="article-placement-switch" <?php echo($os_options['article_placement_active'] == 'true' ? "checked" : "") ?>>
|
171 |
</div>
|
172 |
<?php if(!$first_time) {?>
|
173 |
<a href="<?php echo opinionstage_article_placement_edit_url(); ?>" target="_blank">Configure</a>
|
174 |
+
<?php } ?>
|
175 |
</div>
|
176 |
+
<div class="placement_wrapper">
|
177 |
+
<div class='description'>
|
178 |
+
<div class="text">
|
179 |
+
Sidebar Section
|
180 |
+
</div>
|
181 |
+
<a href="http://blog.opinionstage.com/poll-placements/?o=wp35e8" class="question-link" target="_blank">(?)</a>
|
182 |
+
</div>
|
183 |
+
<?php if($first_time) {?>
|
184 |
+
<div class="onoffswitch left disabled">
|
185 |
+
<input type="checkbox" name="sidebar-placement-switch" class="onoffswitch-checkbox" disabled id="sidebar-placement-switch">
|
186 |
+
<label class="onoffswitch-label" for="sidebar-placement-switch">
|
187 |
+
<div class="onoffswitch-inner"></div>
|
188 |
+
<div class="onoffswitch-switch"></div>
|
189 |
+
</label>
|
190 |
+
</div>
|
191 |
+
<?php } else { ?>
|
192 |
+
<div class="left long-text">
|
193 |
+
Add sidebar using the <a href="<?php echo $url = get_admin_url('', '', 'admin') . 'widgets.php' ?>">Widgets Menu</a>
|
194 |
+
</div>
|
195 |
+
<?php } ?>
|
196 |
+
</div>
|
197 |
</div>
|
198 |
<div class="section">
|
199 |
<h2>Monetization</h2>
|
209 |
<li><a href="https://opinionstage.zendesk.com/anonymous_requests/new" target="_blank">Contact Us</a></li>
|
210 |
</ul>
|
211 |
</div>
|
212 |
+
</div>
|
213 |
+
<?php
|
214 |
}
|
215 |
|
216 |
/**
|
opinionstage-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Polls by OpinionStage
|
4 |
Plugin URI: http://www.opinionstage.com
|
5 |
Description: Adds a highly engaging social polling system to your site. Easily add polls to any post/page or to your sites sidebar.
|
6 |
-
Version: 12.
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: http://www.opinionstage.com
|
9 |
*/
|
@@ -11,7 +11,7 @@ Author URI: http://www.opinionstage.com
|
|
11 |
/* --- Static initializer for Wordpress hooks --- */
|
12 |
|
13 |
define('OPINIONSTAGE_SERVER_BASE', "www.opinionstage.com"); /* Don't include the protocol, added dynamically */
|
14 |
-
define('OPINIONSTAGE_WIDGET_VERSION', '12.
|
15 |
define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
|
16 |
define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
|
17 |
define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
|
@@ -24,9 +24,9 @@ define('OPINIONSTAGE_LOGIN_PATH', OPINIONSTAGE_SERVER_BASE."/integrations/wordpr
|
|
24 |
|
25 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-utility-functions.php");
|
26 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-functions.php");
|
27 |
-
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-widget.php");
|
28 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-ajax-functions.php");
|
29 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-article-placement-functions.php");
|
|
|
30 |
|
31 |
/* --- Static initializer for Wordpress hooks --- */
|
32 |
|
3 |
Plugin Name: Polls by OpinionStage
|
4 |
Plugin URI: http://www.opinionstage.com
|
5 |
Description: Adds a highly engaging social polling system to your site. Easily add polls to any post/page or to your sites sidebar.
|
6 |
+
Version: 12.3.0
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: http://www.opinionstage.com
|
9 |
*/
|
11 |
/* --- Static initializer for Wordpress hooks --- */
|
12 |
|
13 |
define('OPINIONSTAGE_SERVER_BASE', "www.opinionstage.com"); /* Don't include the protocol, added dynamically */
|
14 |
+
define('OPINIONSTAGE_WIDGET_VERSION', '12.3.0');
|
15 |
define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
|
16 |
define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
|
17 |
define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
|
24 |
|
25 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-utility-functions.php");
|
26 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-functions.php");
|
|
|
27 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-ajax-functions.php");
|
28 |
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-article-placement-functions.php");
|
29 |
+
require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-widget.php");
|
30 |
|
31 |
/* --- Static initializer for Wordpress hooks --- */
|
32 |
|
opinionstage-utility-functions.php
CHANGED
@@ -101,12 +101,10 @@ function opinionstage_create_placement_embed_code($id) {
|
|
101 |
/**
|
102 |
* Utility function to create a link with the correct host and all the required information.
|
103 |
*/
|
104 |
-
function opinionstage_create_link($caption, $page, $params = "", $
|
105 |
-
$style = empty($options['style']) ? '' : $options['style'];
|
106 |
-
$new_page = empty($options['new_page']) ? true : $options['new_page'];
|
107 |
$params_prefix = empty($params) ? "" : "&";
|
108 |
$link = "http://".OPINIONSTAGE_SERVER_BASE."/".$page."?" . "o=".OPINIONSTAGE_WIDGET_API_KEY.$params_prefix.$params;
|
109 |
-
return "<a href=\"".$link."\"".($new_page ? " target='_blank'" : "")."
|
110 |
}
|
111 |
|
112 |
/**
|
@@ -147,14 +145,21 @@ function opinionstage_article_placement_edit_url() {
|
|
147 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
148 |
return 'http://'.OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['article_placement_id'].'/edit?token='.$os_options['token'];
|
149 |
}
|
|
|
|
|
|
|
|
|
150 |
function opinionstage_create_poll_link() {
|
151 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
152 |
-
if (empty($os_options["uid"])) {
|
153 |
return opinionstage_create_link('Create a Poll', 'new_poll', '');
|
154 |
} else {
|
155 |
return opinionstage_create_link('Create a Poll', 'new_poll', 'token='.$os_options['token']);
|
156 |
}
|
157 |
}
|
|
|
|
|
|
|
158 |
function opinionstage_create_set_link() {
|
159 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
160 |
if (empty($os_options["uid"])) {
|
101 |
/**
|
102 |
* Utility function to create a link with the correct host and all the required information.
|
103 |
*/
|
104 |
+
function opinionstage_create_link($caption, $page, $params = "", $new_page = true) {
|
|
|
|
|
105 |
$params_prefix = empty($params) ? "" : "&";
|
106 |
$link = "http://".OPINIONSTAGE_SERVER_BASE."/".$page."?" . "o=".OPINIONSTAGE_WIDGET_API_KEY.$params_prefix.$params;
|
107 |
+
return "<a href=\"".$link."\"".($new_page ? " target='_blank'" : "").">".$caption."</a>";
|
108 |
}
|
109 |
|
110 |
/**
|
145 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
146 |
return 'http://'.OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['article_placement_id'].'/edit?token='.$os_options['token'];
|
147 |
}
|
148 |
+
function opinionstage_sidebar_placement_edit_url() {
|
149 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
150 |
+
return 'http://'.OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['sidebar_placement_id'].'/edit?token='.$os_options['token'];
|
151 |
+
}
|
152 |
function opinionstage_create_poll_link() {
|
153 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
154 |
+
if (empty($os_options["uid"])) {
|
155 |
return opinionstage_create_link('Create a Poll', 'new_poll', '');
|
156 |
} else {
|
157 |
return opinionstage_create_link('Create a Poll', 'new_poll', 'token='.$os_options['token']);
|
158 |
}
|
159 |
}
|
160 |
+
function opinionstage_callback_url() {
|
161 |
+
return get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php';
|
162 |
+
}
|
163 |
function opinionstage_create_set_link() {
|
164 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
165 |
if (empty($os_options["uid"])) {
|
opinionstage-widget.php
CHANGED
@@ -1,102 +1,93 @@
|
|
1 |
<?php
|
2 |
class OpinionStageWidget extends WP_Widget {
|
3 |
-
function OpinionStageWidget() {
|
4 |
-
$widget_ops = array('classname' => 'opinionstage_widget', 'description' => __('Adds a highly engaging
|
5 |
-
$this->WP_Widget('opinionstage_widget', __('
|
6 |
}
|
7 |
|
8 |
function widget($args, $instance) {
|
9 |
extract($args);
|
10 |
echo $before_widget;
|
11 |
$title = @$instance['title'];
|
12 |
-
$
|
13 |
-
|
14 |
-
$type = !isset($type) || empty($type) ? 0 : $type;
|
15 |
if (!empty($title)) echo $before_title . apply_filters('widget_title', $title) . $after_title;
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
echo $after_widget;
|
18 |
}
|
19 |
|
20 |
function update($new_instance, $old_instance) {
|
21 |
$instance = $old_instance;
|
22 |
$instance['title'] = strip_tags($new_instance['title']);
|
23 |
-
$instance['id'] = strip_tags($new_instance['id']);
|
24 |
-
$instance['type'] = strip_tags($new_instance['type']);
|
25 |
return $instance;
|
26 |
}
|
27 |
|
28 |
function form($instance) {
|
29 |
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
30 |
-
$
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
32 |
?>
|
33 |
-
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?></label>
|
34 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
35 |
-
|
36 |
-
<p>
|
37 |
-
<label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Content type:', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?></label>
|
38 |
-
<select class="widefat" name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>">
|
39 |
-
<option value="poll" <?php selected($type, 'poll') ?>>Poll</option>
|
40 |
-
<option value="set" <?php selected($type, 'set') ?>>Set</option>
|
41 |
-
<option value="0" <?php selected($type, 0) ?>>Disable</option>
|
42 |
-
</select>
|
43 |
-
</p>
|
44 |
-
|
45 |
-
<p>
|
46 |
-
<label for="<?php echo $this->get_field_id('id'); ?>">
|
47 |
-
<span class="pollWrp" style="display: none;">
|
48 |
-
<?php _e('Poll ID:', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?>
|
49 |
-
</span>
|
50 |
-
<span class="setWrp" style="display: none;">
|
51 |
-
<?php _e('Set ID:', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?>
|
52 |
-
</span>
|
53 |
-
</label>
|
54 |
-
<input class="widefat" id="<?php echo $this->get_field_id('id'); ?>" name="<?php echo $this->get_field_name('id'); ?>" type="text" value="<?php echo $id; ?>" />
|
55 |
-
</p>
|
56 |
-
|
57 |
-
<div class="pollWrp" style="display: none;">
|
58 |
-
<p><?php echo opinionstage_create_link('Locate the Poll ID', 'dashboard', ''); ?></p>
|
59 |
-
</div>
|
60 |
-
<div class="setWrp" style="display: none;">
|
61 |
-
<p><?php echo opinionstage_create_link('Locate the Set ID', 'dashboard', 'tab=sets'); ?></p>
|
62 |
-
</div>
|
63 |
-
|
64 |
<script type="text/javascript">
|
65 |
-
jQuery(function
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
$(
|
70 |
-
|
71 |
-
var
|
72 |
-
|
73 |
-
|
74 |
-
{
|
75 |
-
$setWrp.stop(false, true).fadeOut(0, function ()
|
76 |
-
{
|
77 |
-
$pollWrp.stop(false, true).fadeIn(e.isTrigger ? 0 : "fast");
|
78 |
-
});
|
79 |
}
|
80 |
-
|
81 |
-
|
82 |
-
$pollWrp.stop(false, true).fadeOut(0, function ()
|
83 |
-
{
|
84 |
-
$setWrp.stop(false, true).fadeIn(e.isTrigger ? 0 : "fast");
|
85 |
-
});
|
86 |
-
}
|
87 |
-
}).trigger("change");
|
88 |
-
$(window).load(function ()
|
89 |
-
{
|
90 |
-
$("#<?php echo $this->get_field_id('type'); ?>").trigger("change");
|
91 |
});
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
<?php
|
95 |
}
|
96 |
}
|
97 |
|
98 |
function opinionstage_init_widget() {
|
99 |
register_widget('OpinionStageWidget');
|
|
|
100 |
}
|
101 |
|
102 |
add_action('widgets_init', 'opinionstage_init_widget');
|
1 |
<?php
|
2 |
class OpinionStageWidget extends WP_Widget {
|
3 |
+
function OpinionStageWidget() {
|
4 |
+
$widget_ops = array('classname' => 'opinionstage_widget', 'description' => __('Adds a highly engaging polls to your widget section.', OPINIONSTAGE_WIDGET_UNIQUE_ID));
|
5 |
+
$this->WP_Widget('opinionstage_widget', __('Opinion Stage Sidebar Widget', OPINIONSTAGE_WIDGET_UNIQUE_ID), $widget_ops);
|
6 |
}
|
7 |
|
8 |
function widget($args, $instance) {
|
9 |
extract($args);
|
10 |
echo $before_widget;
|
11 |
$title = @$instance['title'];
|
12 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
13 |
+
|
|
|
14 |
if (!empty($title)) echo $before_title . apply_filters('widget_title', $title) . $after_title;
|
15 |
+
|
16 |
+
if (!empty($os_options["sidebar_placement_id"])) {
|
17 |
+
echo opinionstage_create_placement_embed_code($os_options["sidebar_placement_id"]);
|
18 |
+
}
|
19 |
+
|
20 |
echo $after_widget;
|
21 |
}
|
22 |
|
23 |
function update($new_instance, $old_instance) {
|
24 |
$instance = $old_instance;
|
25 |
$instance['title'] = strip_tags($new_instance['title']);
|
|
|
|
|
26 |
return $instance;
|
27 |
}
|
28 |
|
29 |
function form($instance) {
|
30 |
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
|
31 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
32 |
+
if (empty($os_options["uid"])) {
|
33 |
+
$first_time = true;
|
34 |
+
} else {
|
35 |
+
$first_time = false;
|
36 |
+
}
|
37 |
+
|
38 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
<script type="text/javascript">
|
40 |
+
jQuery(document).ready(function($) {
|
41 |
+
var callbackURL = function() {
|
42 |
+
return "<?php echo $url = get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php' ?>";
|
43 |
+
};
|
44 |
+
$('.os-sidebar-widget').on('click', '.start-login', function(){
|
45 |
+
var emailInput = $('#os-email');
|
46 |
+
var email = $(emailInput).val();
|
47 |
+
if (email == emailInput.data('watermark')) {
|
48 |
+
email = "";
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
+
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL()) + "&email=" + email;
|
51 |
+
window.location = new_location;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
});
|
53 |
+
|
54 |
+
$('.os-sidebar-widget').on('click', '.switch-email', function(){
|
55 |
+
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL());
|
56 |
+
window.location = new_location;
|
57 |
+
});
|
58 |
+
|
59 |
+
$('#os-email').keypress(function(e){
|
60 |
+
if (e.keyCode == 13) {
|
61 |
+
$('#os-start-login').click();
|
62 |
+
}
|
63 |
+
});
|
64 |
+
});
|
65 |
</script>
|
66 |
+
|
67 |
+
<div class="os-sidebar-widget">
|
68 |
+
<?php if($first_time) {?>
|
69 |
+
<p>Connect WordPress with Opinion Stage to enable the widget</p>
|
70 |
+
<input id="os-email" type="text" value="" class="watermark os-email" data-watermark="Enter Your Email"/>
|
71 |
+
<a href="javascript:void(0)" class="os-button start-login" id="os-start-login">Connect</a>
|
72 |
+
<?php } else { ?>
|
73 |
+
<p>You are connected to Opinion Stage with the following email</p>
|
74 |
+
<label class="checked" for="user-email"></label>
|
75 |
+
<input id="os-email" type="text" disabled="disabled" value="<?php echo($os_options["email"]) ?>"/>
|
76 |
+
<a href="javascript:void(0)" class="os-button switch-email" id="os-switch-email" >Switch Account</a>
|
77 |
+
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?></label>
|
78 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" class="watermark" data-watermark="Enter the title here" value="<?php echo $title; ?>" /></p>
|
79 |
+
<div class="left text">
|
80 |
+
<a href="<?php echo opinionstage_sidebar_placement_edit_url(); ?>" target="_blank">Configure content</a>
|
81 |
+
</div>
|
82 |
+
<?php } ?>
|
83 |
+
</div>
|
84 |
<?php
|
85 |
}
|
86 |
}
|
87 |
|
88 |
function opinionstage_init_widget() {
|
89 |
register_widget('OpinionStageWidget');
|
90 |
+
opinionstage_add_stylesheet();
|
91 |
}
|
92 |
|
93 |
add_action('widgets_init', 'opinionstage_init_widget');
|
opinionstage_plugin.js
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
(function(){
|
2 |
-
jQuery(function($){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
$("#content_ospolls").click(function() {
|
4 |
$("os_insert_poll").click();
|
5 |
return false;
|
@@ -24,5 +33,16 @@
|
|
24 |
tb_remove();
|
25 |
$("#opinionstage-type").trigger("change");
|
26 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
});
|
28 |
})();
|
1 |
(function(){
|
2 |
+
jQuery(document).ready(function($) {
|
3 |
+
var handleWatermark = function(input){
|
4 |
+
if(input.val().trim() != "") {
|
5 |
+
input.removeClass('os-watermark');
|
6 |
+
} else {
|
7 |
+
input.val(input.data('watermark'));
|
8 |
+
input.addClass('os-watermark');
|
9 |
+
}
|
10 |
+
};
|
11 |
+
|
12 |
$("#content_ospolls").click(function() {
|
13 |
$("os_insert_poll").click();
|
14 |
return false;
|
33 |
tb_remove();
|
34 |
$("#opinionstage-type").trigger("change");
|
35 |
});
|
36 |
+
$('input.watermark').focus(function(){
|
37 |
+
var input = $(this);
|
38 |
+
if (input.data('watermark') == input.val()) {
|
39 |
+
input.val("");
|
40 |
+
input.removeClass('os-watermark');
|
41 |
+
}
|
42 |
+
}).each(function(){
|
43 |
+
handleWatermark($(this));
|
44 |
+
}).blur(function(){
|
45 |
+
handleWatermark($(this));
|
46 |
+
});
|
47 |
});
|
48 |
})();
|
readme.txt
CHANGED
@@ -123,6 +123,8 @@ We support both regular multiple-sided polls and a special head-to-head poll fla
|
|
123 |
N/A
|
124 |
|
125 |
== Changelog ==
|
|
|
|
|
126 |
= Version 12.2.0 =
|
127 |
* Added the option to connect the plugin to Opinion Stage account
|
128 |
* Added plug & play integration for fly-out placement
|
123 |
N/A
|
124 |
|
125 |
== Changelog ==
|
126 |
+
= Version 12.3.0 =
|
127 |
+
* Added Sidebar placement as a widget
|
128 |
= Version 12.2.0 =
|
129 |
* Added the option to connect the plugin to Opinion Stage account
|
130 |
* Added plug & play integration for fly-out placement
|
style.css
CHANGED
@@ -187,4 +187,18 @@ input.onoffswitch-checkbox {
|
|
187 |
-webkit-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
188 |
-moz-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
189 |
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
187 |
-webkit-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
188 |
-moz-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
189 |
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(74, 121, 221, 0.2), inset 2px -1px 4px -1px rgba(74, 121, 221, 0.9);
|
190 |
+
}
|
191 |
+
.os-sidebar-widget {
|
192 |
+
overflow: hidden;
|
193 |
+
margin-bottom: 15px;
|
194 |
+
}
|
195 |
+
.os-sidebar-widget .text {
|
196 |
+
margin-top: 10px;
|
197 |
+
}
|
198 |
+
.os-sidebar-widget #os-email {
|
199 |
+
margin-left: 8px;
|
200 |
+
}
|
201 |
+
.os-notice {
|
202 |
+
color: red;
|
203 |
+
font-weight: bold;
|
204 |
}
|