Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page - Version 12.2.0

Version Description

N/A

Download this release

Release Info

Developer yoffegil
Plugin Icon 128x128 Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page
Version 12.2.0
Comparing to
See all releases

Code changes from version 12.1.0 to 12.2.0

opinionstage-ajax-functions.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action( 'wp_ajax_opinionstage_ajax_toggle_flyout', 'opinionstage_ajax_toggle_flyout');
4
+ add_action( 'wp_ajax_opinionstage_ajax_toggle_article_placement', 'opinionstage_ajax_toggle_article_placement');
5
+
6
+ function opinionstage_ajax_toggle_flyout() {
7
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
8
+ $os_options['fly_out_active'] = $_POST['activate'];
9
+ update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
10
+ }
11
+
12
+ function opinionstage_ajax_toggle_article_placement() {
13
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
14
+ $os_options['article_placement_active'] = $_POST['activate'];
15
+ update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
16
+ }
17
+ ?>
opinionstage-article-placement-functions.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class OpinionStageArticlePlacement {
3
+ static function initialize() {
4
+ add_filter($hook = 'the_content', array(__CLASS__, $hook));
5
+ }
6
+
7
+ static function the_content($content) {
8
+ global $post;
9
+ $type = $post->post_type;
10
+ if($type == "post") {
11
+
12
+ }
13
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
14
+ if (!empty($os_options['article_placement_id']) && $os_options['article_placement_active'] == 'true' && !is_admin() ) {
15
+ $shortcode = do_shortcode(
16
+ sprintf(
17
+ '[osplacement id="%s"]',
18
+ $os_options['article_placement_id']
19
+ )
20
+ );
21
+ return $content . $shortcode;
22
+ }
23
+ return $content;
24
+ }
25
+
26
+ }
27
+ return OpinionStageArticlePlacement::initialize();
28
+ ?>
opinionstage-callback.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $success = $_GET['success'];
3
+ $uid = $_GET['uid'];
4
+ $token = $_GET['token'];
5
+ $email = $_GET['email'];
6
+ $fly_id = $_GET['fly_id'];
7
+ $article_placement_id = $_GET['article_placement_id'];
8
+ $sidebar_placement_id = $_GET['sidebar_placement_id'];
9
+ opinionstage_uninstall();
10
+ opinionstage_parse_client_data(compact(
11
+ 'success',
12
+ 'uid',
13
+ 'token',
14
+ 'email',
15
+ 'fly_id',
16
+ 'article_placement_id',
17
+ 'sidebar_placement_id'));
18
+
19
+ $redirectURL = 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($redirectURL) ?>";
23
+ </script>
opinionstage-functions.php CHANGED
@@ -2,97 +2,28 @@
2
  /* --- Wordpress Hooks Implementations --- */
3
 
4
  /**
5
- * Main function for creating the widget html representation.
6
- * Transforms the shortcode parameters to the desired iframe call.
7
- *
8
- * Syntax as follows:
9
- * shortcode name - OPINIONSTAGE_WIDGET_SHORTCODE
10
- *
11
- * Arguments:
12
- * @param id - Id of the poll
13
- *
14
  */
15
- function opinionstage_add_poll($atts) {
16
- extract(shortcode_atts(array('id' => 0, 'type' => 'poll'), $atts));
17
- if(!is_feed()) {
18
- $id = intval($id);
19
- return opinionstage_create_embed_code($id, $type);
20
- } else {
21
- return __('Note: There is a poll embedded within this post, please visit the site to participate in this post\'s poll.', OPINIONSTAGE_WIDGET_UNIQUE_ID);
22
- }
23
- }
24
-
25
- /**
26
- * Create the The iframe HTML Tag according to the given parameters.
27
- * Either get the embed code or embeds it directly in case
28
- *
29
- * Arguments:
30
- * @param id - Id of the poll
31
- */
32
- function opinionstage_create_embed_code($id, $type) {
33
-
34
- // Only present if id is available
35
- if (isset($id) && !empty($id)) {
36
- // Load embed code from the cache if possible
37
- $is_homepage = is_home();
38
- $transient_name = 'embed_code' . $id . '_' . $type . '_' . ($is_homepage ? "1" : "0");
39
- $code = get_transient($transient_name);
40
- if ( false === $code || '' === $code ) {
41
- if ($type == 'set') {
42
- $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/sets/" . $id . "/embed_code.json";
43
- } else {
44
- $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/debates/" . $id . "/embed_code.json";
45
- }
46
-
47
- if ($is_homepage) {
48
- $embed_code_url .= "?h=1";
49
- }
50
-
51
- extract(opinionstage_get_contents($embed_code_url));
52
- $data = json_decode($raw_data);
53
- if ($success) {
54
- $code = $data->{'code'};
55
- // Set the embed code to be cached for an hour
56
- set_transient($transient_name, $code, 3600);
57
- }
58
- }
59
- }
60
- return $code;
61
  }
62
 
63
  /**
64
- * Perform an HTTP GET Call to retrieve the data for the required content.
65
- *
66
- * Arguments:
67
- * @param $url
68
- * @return array - raw_data and a success flag
69
  */
70
- function opinionstage_get_contents($url) {
71
- $response = wp_remote_get($url, array('header' => array('Accept' => 'application/json; charset=utf-8')));
72
-
73
- return opinionstage_parse_response($response);
 
74
  }
75
 
76
  /**
77
- * Parse the HTTP response and return the data and if was successful or not.
78
  */
79
- function opinionstage_parse_response($response) {
80
- $success = false;
81
- $raw_data = "Unknown error";
82
-
83
- if (is_wp_error($response)) {
84
- $raw_data = $response->get_error_message();
85
-
86
- } elseif (!empty($response['response'])) {
87
- if ($response['response']['code'] != 200) {
88
- $raw_data = $response['response']['message'];
89
- } else {
90
- $success = true;
91
- $raw_data = $response['body'];
92
- }
93
- }
94
-
95
- return compact('raw_data', 'success');
96
  }
97
 
98
  /**
@@ -123,8 +54,9 @@ function opinionstage_poll_footer_admin() {
123
  */
124
  function opinionstage_poll_menu() {
125
  if (function_exists('add_menu_page')) {
126
- add_menu_page(__('Add Polls', OPINIONSTAGE_WIDGET_UNIQUE_ID), __('Polls', OPINIONSTAGE_WIDGET_UNIQUE_ID), 'edit_posts', OPINIONSTAGE_WIDGET_UNIQUE_LOCATION, 'opinionstage_add_poll_page',
127
  plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/images/os.png'), '25.234323221');
 
128
  }
129
  }
130
 
@@ -133,22 +65,147 @@ function opinionstage_poll_menu() {
133
  */
134
  function opinionstage_add_poll_page() {
135
  opinionstage_add_stylesheet();
 
 
 
 
 
 
136
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  <div class="opinionstage-wrap">
138
  <div id="opinionstage-head"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  <div class="section">
140
- <h2>Actions</h2>
141
  <ul class="os_links_list">
142
- <li><?php echo opinionstage_create_link('Create a Poll', 'new_poll', ''); ?></li>
143
- <li><?php echo opinionstage_create_link('View Polls', 'dashboard', ''); ?></li>
144
- <li><?php echo opinionstage_create_link('Create a Set', 'sets/new', ''); ?></li>
145
- <li><?php echo opinionstage_create_link('View Sets', 'dashboard', 'tab=sets'); ?></li>
146
- <li><?php echo opinionstage_create_link('View Placements', 'dashboard', 'tab=containers'); ?></li>
147
- <li><a href="<?php _e(admin_url('admin.php?page=addpollstoallposts')) ?>">Add Polls to all articles</a></li>
148
  </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  <h2>Help</h2>
150
  <ul class="os_links_list">
151
- <li><a href="http://blog.opinionstage.com/wordpress-poll-how-to-add-polls-to-wordpress-sites/?o=wp35e8" target="_blank">Help</a></li>
152
  <li><?php echo opinionstage_create_link('View Examples', 'showcase', ''); ?></li>
153
  <li><a href="https://opinionstage.zendesk.com/anonymous_requests/new" target="_blank">Contact Us</a></li>
154
  </ul>
@@ -214,10 +271,10 @@ function opinionstage_add_poll_popup() {
214
  <input type="button" class="opinionstage-submit button-primary" value="Insert Poll" name="submit" />
215
  </p>
216
  <p><strong>Haven't created a poll yet?</strong></br></br>
217
- <?php echo opinionstage_create_link('Create a new poll', 'new_poll', ''); ?>
218
  </p>
219
  <p><strong>Don't know the poll ID?</strong></br></br>
220
- <?php echo opinionstage_create_link('Locate ID of an existing poll', 'dashboard', ''); ?>
221
  </p>
222
  </div>
223
  <div class="setWrp" style="display: none;">
@@ -227,10 +284,10 @@ function opinionstage_add_poll_popup() {
227
  <input type="button" class="opinionstage-submit button-primary" value="Insert Set" name="submit" />
228
  </p>
229
  <p><strong>Haven't created a set yet?</strong></br></br>
230
- <?php echo opinionstage_create_link('Create a new set', 'sets/new', ''); ?>
231
  </p>
232
  <p><strong>Don't know the set ID?</strong></br></br>
233
- <?php echo opinionstage_create_link('Locate ID of an existing set', 'dashboard', 'tab=sets', array()); ?>
234
  </p>
235
  </div>
236
  </div>
@@ -239,48 +296,33 @@ function opinionstage_add_poll_popup() {
239
  }
240
 
241
  /**
242
- * Utility function to create a link with the correct host and all the required information.
243
- */
244
- function opinionstage_create_link($caption, $page, $params = "", $options = array()) {
245
- $style = empty($options['style']) ? '' : $options['style'];
246
- $new_page = empty($options['new_page']) ? true : $options['new_page'];
247
- $params_prefix = empty($params) ? "" : "&";
248
- $link = "http://".OPINIONSTAGE_SERVER_BASE."/".$page."?" . "o=".OPINIONSTAGE_WIDGET_API_KEY.$params_prefix.$params;
249
- return "<a href=\"".$link."\"".($new_page ? " target='_blank'" : "")." style=".$style.">".$caption."</a>";
250
- }
251
-
252
- /**
253
- * CSS file loading
254
- */
255
- function opinionstage_add_stylesheet() {
256
- // Respects SSL, Style.css is relative to the current file
257
- wp_register_style( 'opinionstage-style', plugins_url('style.css', __FILE__) );
258
- wp_enqueue_style( 'opinionstage-style' );
259
- }
260
-
261
- /**
262
- * Adds the poll button to the edit bar for new/edited post/page In TinyMCE >= WordPress 2.5
263
  */
264
- function opinionstage_poll_tinymce_addbuttons() {
265
- if(!current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
266
- return;
267
- }
268
- if(get_user_option('rich_editing') == 'true') {
269
- add_filter("mce_external_plugins", "opinionstage_poll_tinymce_addplugin");
270
- add_filter('mce_buttons', 'opinionstage_poll_tinymce_registerbutton');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  }
272
  }
273
- function opinionstage_poll_tinymce_registerbutton($buttons) {
274
- array_push($buttons, 'separator', 'ospolls');
275
- return $buttons;
276
- }
277
- function opinionstage_poll_tinymce_addplugin($plugin_array) {
278
- $plugin_array['ospolls'] = plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/tinymce/plugins/polls/editor_plugin.js');
279
- return $plugin_array;
280
- }
281
 
282
- /**
283
- * Add polls to all posts admin page
284
- */
285
- require_once('opinionstage_add_polls_to_all_posts.php');
286
  ?>
2
  /* --- Wordpress Hooks Implementations --- */
3
 
4
  /**
5
+ * Initialize the plugin
 
 
 
 
 
 
 
 
6
  */
7
+ function opinionstage_init() {
8
+ opinionstage_initialize_data();
9
+ register_uninstall_hook(OPINIONSTAGE_WIDGET_UNIQUE_LOCATION, 'opinionstage_uninstall');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  /**
13
+ * Initialiaze the data options
 
 
 
 
14
  */
15
+ function opinionstage_initialize_data() {
16
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
17
+ $os_options['version'] = OPINIONSTAGE_WIDGET_VERSION;
18
+
19
+ update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
20
  }
21
 
22
  /**
23
+ * Remove the plugin data
24
  */
25
+ function opinionstage_uninstall() {
26
+ delete_option(OPINIONSTAGE_OPTIONS_KEY);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
  /**
54
  */
55
  function opinionstage_poll_menu() {
56
  if (function_exists('add_menu_page')) {
57
+ add_menu_page(__(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_UNIQUE_ID), __(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_MENU_NAME), 'edit_posts', OPINIONSTAGE_WIDGET_UNIQUE_LOCATION, 'opinionstage_add_poll_page',
58
  plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/images/os.png'), '25.234323221');
59
+ add_submenu_page(null, __('', OPINIONSTAGE_WIDGET_MENU_NAME), __('', OPINIONSTAGE_WIDGET_MENU_NAME), 'edit_posts', OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php');
60
  }
61
  }
62
 
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(function ($) {
77
+ var callbackURL = function() {
78
+ return "<?php echo $url = get_admin_url('', '', 'admin') . 'admin.php?page='.OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php' ?>";
79
+ };
80
+ var handleWatermark = function(input){
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
+ $('#article-placement-switch').change(function(){
130
+ toggleSettingsAjax($(this), "opinionstage_ajax_toggle_article_placement");
131
+ });
132
+ });
133
+
134
+ </script>
135
  <div class="opinionstage-wrap">
136
  <div id="opinionstage-head"></div>
137
+ <div class="section">
138
+ <?php if($first_time) {?>
139
+ <h2>Connect to Opinion Stage</h3>
140
+ <p>Connect WordPress with Opinion Stage to enable all features</p>
141
+ <input id="os-email" type="text" value="" class="watermark" data-watermark="Enter Your Email"/>
142
+ <a href="javascript:void(0)" class="os-button" id="start-login">Connect</a>
143
+ <?php } else { ?>
144
+ <p>You are connected to Opinion Stage with the following email</p>
145
+ <label class="checked" for="user-email"></label>
146
+ <input id="os-email" type="text" disabled="disabled" value="<?php echo($os_options["email"]) ?>"/>
147
+ <a href="javascript:void(0)" class="os-button" id="switch-email" >Switch Account</a>
148
+ <?php } ?>
149
+ </div>
150
+
151
  <div class="section">
152
+ <h2>Content</h2>
153
  <ul class="os_links_list">
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">
161
+ <h2>Placements</h2>
162
+ <div class="placement_wrapper">
163
+ <div class='description'>
164
+ <div class="text">
165
+ Fly-out
166
+ </div>
167
+ <a href="http://blog.opinionstage.com/fly-out-placements/?o=wp35e8" class="question-link" target="_blank">(?)</a>
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" : "") ?>>
171
+ <label class="onoffswitch-label" for="fly-out-switch">
172
+ <div class="onoffswitch-inner"></div>
173
+ <div class="onoffswitch-switch"></div>
174
+ </label>
175
+ </div>
176
+ <?php if(!$first_time) {?>
177
+ <a href="<?php echo opinionstage_flyout_edit_url(); ?>" target="_blank">Configure</a>
178
+ <?php } ?>
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/poll-placements/?o=wp35e8" class="question-link" target="_blank">(?)</a>
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" : "") ?>>
189
+ <label class="onoffswitch-label" for="article-placement-switch">
190
+ <div class="onoffswitch-inner"></div>
191
+ <div class="onoffswitch-switch"></div>
192
+ </label>
193
+ </div>
194
+ <?php if(!$first_time) {?>
195
+ <a href="<?php echo opinionstage_article_placement_edit_url(); ?>" target="_blank">Configure</a>
196
+ <?php } ?>
197
+ </div>
198
+ </div>
199
+ <div class="section">
200
+ <h2>Monetization</h2>
201
+ <ul class="os_links_list">
202
+ <li><?php echo opinionstage_logged_in_link('Contact us to monetize your traffic', "http://".OPINIONSTAGE_SERVER_BASE."/advanced-solutions"); ?></li>
203
+ </ul>
204
+ </div>
205
+ <div class="section">
206
  <h2>Help</h2>
207
  <ul class="os_links_list">
208
+ <li><a href="http://blog.opinionstage.com/wordpress-poll-how-to-add-polls-to-wordpress-sites/?o=wp35e8" target="_blank">How to use this plugin</a></li>
209
  <li><?php echo opinionstage_create_link('View Examples', 'showcase', ''); ?></li>
210
  <li><a href="https://opinionstage.zendesk.com/anonymous_requests/new" target="_blank">Contact Us</a></li>
211
  </ul>
271
  <input type="button" class="opinionstage-submit button-primary" value="Insert Poll" name="submit" />
272
  </p>
273
  <p><strong>Haven't created a poll yet?</strong></br></br>
274
+ <?php echo opinionstage_create_poll_link(); ?>
275
  </p>
276
  <p><strong>Don't know the poll ID?</strong></br></br>
277
+ <?php echo opinionstage_dashboard_link('Locate ID of an existing poll', 'polls'); ?>
278
  </p>
279
  </div>
280
  <div class="setWrp" style="display: none;">
284
  <input type="button" class="opinionstage-submit button-primary" value="Insert Set" name="submit" />
285
  </p>
286
  <p><strong>Haven't created a set yet?</strong></br></br>
287
+ <?php echo opinionstage_create_set_link(); ?>
288
  </p>
289
  <p><strong>Don't know the set ID?</strong></br></br>
290
+ <?php echo opinionstage_dashboard_link('Locate ID of an existing set', 'sets'); ?>
291
  </p>
292
  </div>
293
  </div>
296
  }
297
 
298
  /**
299
+ * Add the flyout embed code to the page header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  */
301
+ function opinionstage_add_flyout() {
302
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
303
+
304
+ if (!empty($os_options['fly_id']) && $os_options['fly_out_active'] == 'true' && !is_admin() ) {
305
+ // Will be added to the head of the page
306
+ ?>
307
+ <script type="text/javascript">//<![CDATA[
308
+ window.AutoEngageSettings = {
309
+ id : '<?php echo $os_options['fly_id']; ?>'
310
+ };
311
+ (function(d, s, id){
312
+ var js,
313
+ fjs = d.getElementsByTagName(s)[0],
314
+ p = (('https:' == d.location.protocol) ? 'https://' : 'http://'),
315
+ r = Math.floor(new Date().getTime() / 1000000);
316
+ if (d.getElementById(id)) {return;}
317
+ js = d.createElement(s); js.id = id; js.async=1;
318
+ js.src = p + '<?php echo OPINIONSTAGE_SERVER_BASE; ?>' + '/assets/autoengage.js?' + r;
319
+ fjs.parentNode.insertBefore(js, fjs);
320
+ }(document, 'script', 'os-jssdk'));
321
+
322
+ //]]></script>
323
+
324
+ <?php
325
  }
326
  }
 
 
 
 
 
 
 
 
327
 
 
 
 
 
328
  ?>
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.1.0
7
  Author: OpinionStage.com
8
  Author URI: http://www.opinionstage.com
9
  */
@@ -11,20 +11,27 @@ 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.1.0');
15
  define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
16
  define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
 
17
  define('OPINIONSTAGE_WIDGET_SHORTCODE', 'socialpoll');
 
18
  define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
19
  define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
 
 
20
 
 
21
  require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-functions.php");
22
  require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-widget.php");
23
-
 
24
 
25
  /* --- Static initializer for Wordpress hooks --- */
26
 
27
  add_shortcode(OPINIONSTAGE_WIDGET_SHORTCODE, 'opinionstage_add_poll');
 
28
 
29
  // Post creation/edit hooks
30
  add_action('admin_footer-post-new.php', 'opinionstage_poll_footer_admin');
@@ -35,12 +42,15 @@ add_action('admin_footer-page.php', 'opinionstage_poll_footer_admin');
35
  // Post creation/edit hook for visual editing
36
  add_action('init', 'opinionstage_poll_tinymce_addbuttons');
37
 
 
 
38
  // Side menu
39
  add_action('admin_menu', 'opinionstage_poll_menu');
40
-
41
  add_action('admin_enqueue_scripts', 'opinionstage_load_scripts');
42
 
43
  // Insert poll popup
44
  add_filter('admin_footer_text', 'opinionstage_add_poll_popup');
45
 
 
 
46
  ?>
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.2.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.2.0');
15
  define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
16
  define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
17
+ define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
18
  define('OPINIONSTAGE_WIDGET_SHORTCODE', 'socialpoll');
19
+ define('OPINIONSTAGE_PLACEMENT_SHORTCODE', 'osplacement');
20
  define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
21
  define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
22
+ define('OPINIONSTAGE_WIDGET_MENU_NAME', 'Polls by Opinion Stage');
23
+ define('OPINIONSTAGE_LOGIN_PATH', OPINIONSTAGE_SERVER_BASE."/integrations/wordpress/new");
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
 
33
  add_shortcode(OPINIONSTAGE_WIDGET_SHORTCODE, 'opinionstage_add_poll');
34
+ add_shortcode(OPINIONSTAGE_PLACEMENT_SHORTCODE, 'opinionstage_add_placement');
35
 
36
  // Post creation/edit hooks
37
  add_action('admin_footer-post-new.php', 'opinionstage_poll_footer_admin');
42
  // Post creation/edit hook for visual editing
43
  add_action('init', 'opinionstage_poll_tinymce_addbuttons');
44
 
45
+ add_action('plugins_loaded', 'opinionstage_init');
46
+
47
  // Side menu
48
  add_action('admin_menu', 'opinionstage_poll_menu');
 
49
  add_action('admin_enqueue_scripts', 'opinionstage_load_scripts');
50
 
51
  // Insert poll popup
52
  add_filter('admin_footer_text', 'opinionstage_add_poll_popup');
53
 
54
+ // Add fly-out to header
55
+ add_action('wp_head', 'opinionstage_add_flyout');
56
  ?>
opinionstage-utility-functions.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main function for creating the widget html representation.
4
+ * Transforms the shortcode parameters to the desired iframe call.
5
+ *
6
+ * Syntax as follows:
7
+ * shortcode name - OPINIONSTAGE_WIDGET_SHORTCODE
8
+ *
9
+ * Arguments:
10
+ * @param id - Id of the poll
11
+ *
12
+ */
13
+ function opinionstage_add_poll($atts) {
14
+ extract(shortcode_atts(array('id' => 0, 'type' => 'poll'), $atts));
15
+ if(!is_feed()) {
16
+ $id = intval($id);
17
+ return opinionstage_create_embed_code($id, $type);
18
+ } else {
19
+ return __('Note: There is a poll embedded within this post, please visit the site to participate in this post\'s poll.', OPINIONSTAGE_WIDGET_UNIQUE_ID);
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Main function for creating the placement html representation.
25
+ * Transforms the shortcode parameters to the desired code.
26
+ *
27
+ * Syntax as follows:
28
+ * shortcode name - OPINIONSTAGE_PLACEMENT_SHORTCODE
29
+ *
30
+ * Arguments:
31
+ * @param id - Id of the placement
32
+ *
33
+ */
34
+ function opinionstage_add_placement($atts) {
35
+ extract(shortcode_atts(array('id' => 0), $atts));
36
+ if(!is_feed()) {
37
+ $id = intval($id);
38
+ return opinionstage_create_placement_embed_code($id);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Create the The iframe HTML Tag according to the given parameters.
44
+ * Either get the embed code or embeds it directly in case
45
+ *
46
+ * Arguments:
47
+ * @param id - Id of the poll
48
+ */
49
+ function opinionstage_create_embed_code($id, $type) {
50
+
51
+ // Only present if id is available
52
+ if (isset($id) && !empty($id)) {
53
+ // Load embed code from the cache if possible
54
+ $is_homepage = is_home();
55
+ $transient_name = 'embed_code' . $id . '_' . $type . '_' . ($is_homepage ? "1" : "0");
56
+ $code = get_transient($transient_name);
57
+ if ( false === $code || '' === $code ) {
58
+ if ($type == 'set') {
59
+ $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/sets/" . $id . "/embed_code.json";
60
+ } else {
61
+ $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/debates/" . $id . "/embed_code.json";
62
+ }
63
+
64
+ if ($is_homepage) {
65
+ $embed_code_url .= "?h=1";
66
+ }
67
+
68
+ extract(opinionstage_get_contents($embed_code_url));
69
+ $data = json_decode($raw_data);
70
+ if ($success) {
71
+ $code = $data->{'code'};
72
+ // Set the embed code to be cached for an hour
73
+ set_transient($transient_name, $code, 3600);
74
+ }
75
+ }
76
+ }
77
+ return $code;
78
+ }
79
+
80
+ function opinionstage_create_placement_embed_code($id) {
81
+
82
+ // Only present if id is available
83
+ if (isset($id) && !empty($id)) {
84
+ // Load embed code from the cache if possible
85
+ $is_homepage = is_home();
86
+ $transient_name = 'embed_code' . $id . '_' . 'placement';
87
+ $code = get_transient($transient_name);
88
+ if ( false === $code || '' === $code ) {
89
+ $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/containers/" . $id . "/embed_code.json";
90
+ extract(opinionstage_get_contents($embed_code_url));
91
+ $data = json_decode($raw_data);
92
+ if ($success) {
93
+ $code = $data->{'code'};
94
+ // Set the embed code to be cached for an hour
95
+ set_transient($transient_name, $code, 3600);
96
+ }
97
+ }
98
+ }
99
+ return $code;
100
+ }
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 = "", $options = array()) {
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'" : "")." style=".$style.">".$caption."</a>";
110
+ }
111
+
112
+ /**
113
+ * CSS file loading
114
+ */
115
+ function opinionstage_add_stylesheet() {
116
+ // Respects SSL, Style.css is relative to the current file
117
+ wp_register_style( 'opinionstage-style', plugins_url('style.css', __FILE__) );
118
+ wp_enqueue_style( 'opinionstage-style' );
119
+ }
120
+
121
+ /**
122
+ * Adds the poll button to the edit bar for new/edited post/page In TinyMCE >= WordPress 2.5
123
+ */
124
+ function opinionstage_poll_tinymce_addbuttons() {
125
+ if(!current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
126
+ return;
127
+ }
128
+ if(get_user_option('rich_editing') == 'true') {
129
+ add_filter("mce_external_plugins", "opinionstage_poll_tinymce_addplugin");
130
+ add_filter('mce_buttons', 'opinionstage_poll_tinymce_registerbutton');
131
+ }
132
+ }
133
+ function opinionstage_poll_tinymce_registerbutton($buttons) {
134
+ array_push($buttons, 'separator', 'ospolls');
135
+ return $buttons;
136
+ }
137
+
138
+ function opinionstage_poll_tinymce_addplugin($plugin_array) {
139
+ $plugin_array['ospolls'] = plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/tinymce/plugins/polls/editor_plugin.js');
140
+ return $plugin_array;
141
+ }
142
+ function opinionstage_flyout_edit_url() {
143
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
144
+ return 'http://'.OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['fly_id'].'/edit?token='.$os_options['token'];
145
+ }
146
+ 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"])) {
161
+ return opinionstage_create_link('Create a Set', 'sets/new', '');
162
+ } else {
163
+ return opinionstage_create_link('Create a Set', 'sets/new', 'token='.$os_options['token']);
164
+ }
165
+ }
166
+ function opinionstage_dashboard_link($text, $tab) {
167
+ $os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
168
+ if (empty($os_options["uid"])) {
169
+ return opinionstage_create_link($text, 'dashboard', 'tab='.$tab);
170
+ } else {
171
+ return opinionstage_create_link($text, 'dashboard', 'tab='.$tab.'&token='.$os_options['token']);
172
+ }
173
+ }
174
+ function opinionstage_logged_in_link($text, $link) {
175
+ return opinionstage_create_link($text, 'registrations/new', 'return_to='.$link);
176
+ }
177
+
178
+
179
+ /**
180
+ * Perform an HTTP GET Call to retrieve the data for the required content.
181
+ *
182
+ * Arguments:
183
+ * @param $url
184
+ * @return array - raw_data and a success flag
185
+ */
186
+ function opinionstage_get_contents($url) {
187
+ $response = wp_remote_get($url, array('header' => array('Accept' => 'application/json; charset=utf-8')));
188
+
189
+ return opinionstage_parse_response($response);
190
+ }
191
+
192
+ /**
193
+ * Parse the HTTP response and return the data and if was successful or not.
194
+ */
195
+ function opinionstage_parse_response($response) {
196
+ $success = false;
197
+ $raw_data = "Unknown error";
198
+
199
+ if (is_wp_error($response)) {
200
+ $raw_data = $response->get_error_message();
201
+
202
+ } elseif (!empty($response['response'])) {
203
+ if ($response['response']['code'] != 200) {
204
+ $raw_data = $response['response']['message'];
205
+ } else {
206
+ $success = true;
207
+ $raw_data = $response['body'];
208
+ }
209
+ }
210
+
211
+ return compact('raw_data', 'success');
212
+ }
213
+ /**
214
+ * Take the received data and parse it
215
+ *
216
+ * Returns the newly updated widgets parameters.
217
+ */
218
+ function opinionstage_parse_client_data($raw_data) {
219
+ $os_options = array('uid' => $raw_data['uid'],
220
+ 'email' => $raw_data['email'],
221
+ 'fly_id' => $raw_data['fly_id'],
222
+ 'article_placement_id' => $raw_data['article_placement_id'],
223
+ 'sidebar_placement_id' => $raw_data['sidebar_placement_id'],
224
+ 'version' => OPINIONSTAGE_WIDGET_VERSION,
225
+ 'fly_out_active' => 'false',
226
+ 'article_placement_active' => 'false',
227
+ 'token' => $raw_data['token']);
228
+
229
+ update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
230
+ }
231
+
232
+ ?>
opinionstage_add_polls_to_all_posts.php DELETED
@@ -1,167 +0,0 @@
1
- <?php
2
- class AddPollsToAllPosts {
3
- static $identifier = 'addpollstoallposts';
4
-
5
- static function bootstrap() {
6
- add_action($hook = 'admin_menu', array(__CLASS__, $hook));
7
- add_filter($hook = 'the_content', array(__CLASS__, $hook));
8
- add_action($hook = 'add_meta_boxes', array(__CLASS__, $hook));
9
- add_action($hook = 'save_post', array(__CLASS__, $hook));
10
- }
11
-
12
- static function admin_menu() {
13
- $page_callback = array(__CLASS__, 'render_page');
14
- $url = self::register_admin_page($page_callback);
15
- }
16
-
17
- static function add_meta_boxes() {
18
- $post_types = get_post_types(array('public' => true));
19
- foreach ($post_types as $pt) {
20
- if ($pt == 'attachment') continue;
21
- add_meta_box('aptap_meta', 'Poll Display', array(__CLASS__, 'render_meta_box'), $pt, 'normal', 'high');
22
- }
23
- }
24
-
25
- static function get_aptap_post_setting($post_id) {
26
- $aptap_post_setting = get_post_meta($post_id, 'aptap_post_setting', true);
27
- if (empty($aptap_post_setting) || !is_numeric($aptap_post_setting) || ($aptap_post_setting <= 0 && $aptap_post_setting >= 4)) $aptap_post_setting = 1;
28
- return $aptap_post_setting;
29
- }
30
-
31
- static function render_meta_box() {
32
- global $post;
33
- $aptap_post_setting = AddPollsToAllPosts::get_aptap_post_setting($post->ID);
34
- ?>
35
- <label for="aptap_post_setting_1" class="selectit"><input name="aptap_post_setting" type="radio" id="aptap_post_setting_1" value="1" <?php checked($aptap_post_setting, 1) ?>>Use global setting for this post type.</label><br />
36
- <!--<label for="aptap_post_setting_2" class="selectit"><input name="aptap_post_setting" type="radio" id="aptap_post_setting_2" value="2" <?php checked($aptap_post_setting, 2) ?>>Show selected poll at the end of this post.</label><br />-->
37
- <label for="aptap_post_setting_3" class="selectit"><input name="aptap_post_setting" type="radio" id="aptap_post_setting_3" value="3" <?php checked($aptap_post_setting, 3) ?>>Don't show any polls at the end of this post.</label>
38
- <?php
39
- }
40
-
41
- static function save_post($post_id) {
42
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
43
- $aptap_post_setting = isset($_POST['aptap_post_setting']) && !empty($_POST['aptap_post_setting']) ? $_POST['aptap_post_setting'] : 1;
44
- update_post_meta($post_id, 'aptap_post_setting', $aptap_post_setting);
45
- }
46
-
47
- static function the_content($content) {
48
- global $post;
49
- $aptap_post_setting = AddPollsToAllPosts::get_aptap_post_setting($post->ID);
50
- if ($aptap_post_setting == 3) {
51
- return $content;
52
- /*
53
- } else if ($aptap_post_setting == 2) {
54
- $opinionstage_aptap = get_option('opinionstage_aptap');
55
- $shortcode = do_shortcode(
56
- sprintf(
57
- '[socialpoll id="%s" type="%s"]',
58
- $opinionstage_aptap['configure_id'],
59
- $opinionstage_aptap['content_types']
60
- )
61
- );
62
- return $content . $shortcode;
63
- */
64
- } else {
65
- $opinionstage_aptap = get_option('opinionstage_aptap');
66
- if (is_array($opinionstage_aptap)) {
67
- if (isset($opinionstage_aptap['post_types']) && !empty($opinionstage_aptap['post_types']) && is_array($opinionstage_aptap['post_types'])) {
68
- if (in_array($post->post_type, $opinionstage_aptap['post_types'])) {
69
- $shortcode = do_shortcode(
70
- sprintf(
71
- '[socialpoll id="%s" type="%s"]',
72
- $opinionstage_aptap['configure_id'],
73
- $opinionstage_aptap['content_types']
74
- )
75
- );
76
- return $content . $shortcode;
77
- }
78
- }
79
- }
80
- }
81
-
82
- return $content;
83
- }
84
-
85
- static function register_admin_page($callback) {
86
- $parent_slug = 'admin.php';
87
- $hookname = get_plugin_page_hookname(AddPollsToAllPosts::$identifier, $parent_slug);
88
- add_filter($hookname, $callback);
89
- $GLOBALS['_registered_pages'][$hookname] = true;
90
- $url = admin_url($parent_slug . '?page=' . AddPollsToAllPosts::$identifier);
91
- return $url;
92
- }
93
-
94
- static function render_page() {
95
- if (isset($_POST['opinionstage_aptap']) && is_array($_POST['opinionstage_aptap'])) {
96
- $opinionstage_aptap = $_POST['opinionstage_aptap'];
97
- update_option('opinionstage_aptap', $opinionstage_aptap);
98
- ?><div class="updated"><p><strong>Options saved.</strong></p></div><?php
99
- }
100
- opinionstage_add_stylesheet();
101
- $post_types = get_post_types(array('public' => true));
102
- function os_get_option($options, $option_name) {
103
- if (is_array($options))
104
- return isset($options[$option_name]) && !empty($options[$option_name]) ? $options[$option_name] : '';
105
- return '';
106
- }
107
- $opinionstage_aptap = get_option('opinionstage_aptap');
108
- ?>
109
- <div class="opinionstage-wrap">
110
- <div id="opinionstage-head"></div>
111
- <div class="section">
112
- <form action="" method="POST"
113
- <h2>Add Polls to all articles</h2>
114
- <hr />
115
- <h3>Where to add:</h3>
116
- <div class="chkboxs" style="background-color: #FFF; border: 1px solid #DDD; padding: 5px 20px 5px 10px; display: inline-block;">
117
- <?php foreach ($post_types as $pt) { ?>
118
- <?php
119
- if ($pt == 'attachment') continue;
120
- $is_checked = false;
121
- if (is_array(os_get_option($opinionstage_aptap, 'post_types'))) {
122
- $post_types = os_get_option($opinionstage_aptap, 'post_types');
123
- if (in_array($pt, $post_types)) $is_checked = true;
124
- }
125
- ?>
126
- <label for="pt-<?php _e($pt) ?>"><input type="checkbox" name="opinionstage_aptap[post_types][]" value="<?php _e($pt) ?>" id="pt-<?php _e($pt) ?>" <?php _e($is_checked ? 'checked="checked"' : '') ?> />&nbsp;&nbsp;&nbsp;<?php _e($pt) ?></label><br />
127
- <?php } ?>
128
- </div>
129
- <br />
130
- <h3><label for="pt-ct">What to add:</label></h3>
131
- <select name="opinionstage_aptap[content_types]" id="pt-ct">
132
- <option value="poll" <?php _e(os_get_option($opinionstage_aptap, 'content_types') == 'poll' ? 'selected="selected"' : '') ?>>Poll</option>
133
- <option value="set" <?php _e(os_get_option($opinionstage_aptap, 'content_types') == 'set' ? 'selected="selected"' : '') ?>>Set</option>
134
- </select>
135
- <br />
136
- <h3><label for="pt-cnfid">Configure ID</label></h3>
137
- <input type="text" value="<?php _e(os_get_option($opinionstage_aptap, 'configure_id')) ?>" name="opinionstage_aptap[configure_id]" id="pt-cnfid" />
138
- <div><a href="#" id="pt-locid" target="_blank">Locate ID in Dashboard</a></div>
139
- <br />
140
- <p class="submit"><input type="submit" class="button button-primary" value="Save Changes"></p>
141
- <br />
142
- <div style="background-color: #FFF; border: 1px solid #DDD; padding: 5px 20px 5px 10px; display: inline-block; max-width: 300px;">Note: If you would like to add a poll/set to only one post/page, click on the Opinion Stage icon from the create post/page visual editor.</div>
143
- <br />
144
- <p>Need more help? <a href="http://blog.opinionstage.com/wordpress-poll-how-to-add-polls-to-wordpress-sites/">Click here!</a></p>
145
- </form>
146
- </div>
147
- </div>
148
- <script type="text/javascript">
149
- jQuery(function ($)
150
- {
151
- $("#toplevel_page_social-polls-by-opinionstage-opinionstage-polls").addClass("current").find(" > a").addClass("current");
152
- $("#pt-ct").on("change", function ()
153
- {
154
- var $this = $(this),
155
- v = $this.val(),
156
- $locid = $("#pt-locid");
157
- var rootURL = "http://www.opinionstage.com/dashboard?o=wp35e8";
158
- if (v == "set") rootURL += "&tab=sets";
159
- $locid.attr("href", rootURL);
160
- }).trigger("change");
161
- });
162
- </script>
163
- <?php
164
- }
165
- }
166
- return AddPollsToAllPosts::bootstrap();
167
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -123,6 +123,10 @@ We support both regular multiple-sided polls and a special head-to-head poll fla
123
  N/A
124
 
125
  == Changelog ==
 
 
 
 
126
  = Version 12.1.0 =
127
  * Additional fix for supporting SSL
128
  = Version 12.0.0 =
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
129
+ * Replaced the option of adding polls to all posts with plug & play article section placement
130
  = Version 12.1.0 =
131
  * Additional fix for supporting SSL
132
  = Version 12.0.0 =
style.css CHANGED
@@ -20,7 +20,7 @@ h2 {
20
  }
21
  .os_links_list {
22
  list-style-type: none;
23
- margin: 0 0 35px 0;
24
  padding: 0;
25
  }
26
  .os_links_list li {
@@ -30,4 +30,161 @@ h2 {
30
  color: #5db5d4;
31
  font-size: 17px;
32
  text-decoration: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
20
  }
21
  .os_links_list {
22
  list-style-type: none;
23
+ margin: 0;
24
  padding: 0;
25
  }
26
  .os_links_list li {
30
  color: #5db5d4;
31
  font-size: 17px;
32
  text-decoration: none;
33
+ }
34
+ input.os-watermark {
35
+ color: rgb(131, 131, 131);
36
+ font-style: italic;
37
+ }
38
+ input[type="text"] {
39
+ border: 1px solid #CECECE;
40
+ height: 28px;
41
+ line-height: 28px;
42
+ width: 238px;
43
+ padding-left: 10px;
44
+ margin-right: 5px;
45
+ }
46
+ input[type="text"][disabled="disabled"] {
47
+ background-color: #DFDFDF;
48
+ }
49
+ .os-button {
50
+ text-decoration: none !important;
51
+ border-top: 1px solid #E7E5E3;
52
+ border-bottom: 1px solid #CFCCC8;
53
+ border-right: 1px solid #CFCCC8;
54
+ border-left: 1px solid #CFCCC8;
55
+ -webkit-border-radius: 3px;
56
+ -moz-border-radius: 3px;
57
+ border-radius: 3px;
58
+ text-align: center;
59
+ color: #ffffff !important;
60
+ background-color: #289ec4;
61
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #289ec4), color-stop(100%, #278fb5));
62
+ background-image: -webkit-linear-gradient(top, #289ec4, #278fb5);
63
+ background-image: -moz-linear-gradient(top, #289ec4, #278fb5);
64
+ background-image: -ms-linear-gradient(top, #289ec4, #278fb5);
65
+ background-image: -o-linear-gradient(top, #289ec4, #278fb5);
66
+ background-image: linear-gradient(top, #289ec4, #278fb5);
67
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#289ec4, endColorstr=#278fb5);
68
+ padding: 5px 10px;
69
+ }
70
+ .os-button:hover {
71
+ background-color: #40aacd;
72
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #40aacd), color-stop(100%, #40aacd));
73
+ background-image: -webkit-linear-gradient(top, #40aacd, #40aacd);
74
+ background-image: -moz-linear-gradient(top, #40aacd, #40aacd);
75
+ background-image: -ms-linear-gradient(top, #40aacd, #40aacd);
76
+ background-image: -o-linear-gradient(top, #40aacd, #40aacd);
77
+ background-image: linear-gradient(top, #40aacd, #40aacd);
78
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#40aacd, endColorstr=#40aacd);
79
+ color: #ffffff !important;
80
+ }
81
+ .question-link {
82
+ text-decoration: none;
83
+ margin-right: 15px;
84
+ }
85
+ .placement_wrapper {
86
+ margin-bottom: 25px;
87
+ }
88
+ .placement_wrapper .description {
89
+ width: 190px;
90
+ float: left;
91
+ }
92
+ .placement_wrapper .description .text {
93
+ display: inline-block;
94
+ font-size: 17px;
95
+ }
96
+ .placement_wrapper .onoffswitch {
97
+ vertical-align: text-bottom;
98
+ margin-right: 15px;
99
+ }
100
+ .onoffswitch {
101
+ position: relative;
102
+ width: 74px;
103
+ -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
104
+ display: inline-block;
105
+ margin: 0px 0px -8px;
106
+ }
107
+ .onoffswitch.disabled {
108
+ opacity: 0.5;
109
+ }
110
+ input.onoffswitch-checkbox {
111
+ display: none;
112
+ }
113
+ .onoffswitch-label {
114
+ display: block;
115
+ overflow: hidden;
116
+ cursor: pointer;
117
+ border: 2px solid #D5D5D5;
118
+ border-radius: 15px;
119
+ box-shadow: 0px 0px 4px 0px rgba(32, 32, 32, 0.5);
120
+ }
121
+ .onoffswitch-inner {
122
+ width: 200%; margin-left: -100%;
123
+ -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
124
+ -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
125
+ }
126
+ .onoffswitch-inner:before, .onoffswitch-inner:after {
127
+ float: left;
128
+ width: 50%;
129
+ height: 23px;
130
+ padding: 0;
131
+ line-height: 24px;
132
+ font-size: 13px;
133
+ color: rgba(0, 0, 0, 0.9);
134
+ font-family: Trebuchet, Arial, sans-serif;
135
+ font-weight: bold;
136
+ -moz-box-sizing: border-box;
137
+ -webkit-box-sizing: border-box;
138
+ box-sizing: border-box;
139
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.63);
140
+ }
141
+ .onoffswitch-inner:before {
142
+ content: "ON";
143
+ padding-left: 15px;
144
+ background-color: #40aacd;
145
+ box-shadow: inset 5px 4px 10px 1px rgba(0, 0, 0, 0.2);
146
+ }
147
+ .onoffswitch-inner:after {
148
+ content: "OFF";
149
+ padding-left: 18px;
150
+ background-color: #BEC9CA;
151
+ text-align: center;
152
+ box-shadow: inset -5px 4px 10px 1px rgba(0, 0, 0, 0.2);
153
+ }
154
+ .onoffswitch-switch {
155
+ width: 25px;
156
+ margin: 0px;
157
+ background: rgb(254,254,254); /* Old browsers */
158
+ background: -moz-linear-gradient(top, rgba(254, 256, 256, 1) 55%,rgba(217, 217, 217, 1) 45%,white 90%); /* FF3.6+ */
159
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(55%,rgba(254,256,256,1)), color-stop(45%,rgba(217,217,217,1)), color-stop(90%, white)); /* Chrome,Safari4+ */
160
+ background: -webkit-linear-gradient(top, rgba(254, 256, 256, 1) 55%,rgba(217, 217, 217, 1) 45%,white 90%); /* Chrome10+,Safari5.1+ */
161
+ background: -o-linear-gradient(top, rgba(254, 256, 256, 1) 55%,rgba(217, 217, 217, 1) 45%,white 90%); /* Opera 11.10+ */
162
+ background: -ms-linear-gradient(top, rgba(254, 256, 256, 1) 55%,rgba(217, 217, 217, 1) 45%,white 90%); /* IE10+ */
163
+ background: linear-gradient(to bottom, rgba(254, 256, 256, 1) 55%,rgba(217, 217, 217, 1) 45%,white 90%); /* W3C */
164
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#e9e9e9',GradientType=0 ); /* IE6-9 */
165
+ border-radius: 50%;
166
+ position: absolute;
167
+ top: 1px;
168
+ bottom: 0;
169
+ right: 45px;
170
+ -moz-transition: all 0.3s ease-in 0s;
171
+ -webkit-transition: all 0.3s ease-in 0s;
172
+ -o-transition: all 0.3s ease-in 0s;
173
+ transition: all 0.3s ease-in 0s;
174
+ height: 25px;
175
+
176
+ -webkit-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(0, 0, 0, 0.2);
177
+ -moz-box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(0, 0, 0, 0.2);
178
+ box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.75), 0px -1px 0px rgba(0, 0, 0, 0.2);
179
+
180
+ }
181
+ .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
182
+ margin-left: 0;
183
+ }
184
+ .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
185
+ right: 2px;
186
+
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
  }