Version Description
N/A
Download this release
Release Info
Developer | kucaahbe |
Plugin | Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page |
Version | 18.1.0 |
Comparing to | |
See all releases |
Code changes from version 18.0.5 to 18.1.0
- admin/init.php +3 -3
- opinionstage-menu-page.php → admin/menu-page-template.php +7 -10
- admin/menu-page.php +44 -0
- css/menu-page.css +7 -11
- css/sidebar-widget.css +0 -4
- js/shortcodes.js +15 -0
- opinionstage-functions.php +1 -55
- opinionstage-polls.php +17 -6
- opinionstage-sidebar-widget.php +6 -9
- opinionstage-utility-functions.php +21 -247
- opinionstage_plugin.js +0 -23
- readme.txt +4 -1
- site/init.php +7 -4
- site/shortcodes.php +100 -0
admin/init.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
// block direct access to plugin PHP files:
|
3 |
defined( 'ABSPATH' ) or die();
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
add_action('
|
8 |
?>
|
2 |
// block direct access to plugin PHP files:
|
3 |
defined( 'ABSPATH' ) or die();
|
4 |
|
5 |
+
require( plugin_dir_path( __FILE__ ).'menu-page.php' );
|
6 |
+
|
7 |
+
add_action('admin_menu', 'opinionstage_register_menu_page');
|
8 |
?>
|
opinionstage-menu-page.php → admin/menu-page-template.php
RENAMED
@@ -17,15 +17,12 @@ defined( 'ABSPATH' ) or die();
|
|
17 |
$('#os-start-login').click(function(){
|
18 |
var emailInput = $('#os-email');
|
19 |
var email = $(emailInput).val();
|
20 |
-
|
21 |
-
email = "";
|
22 |
-
}
|
23 |
-
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?o='.OPINIONSTAGE_WIDGET_API_KEY.'&callback=' ?>" + encodeURIComponent(callbackURL) + "&email=" + email;
|
24 |
window.location = new_location;
|
25 |
});
|
26 |
|
27 |
$('#os-switch-email').click(function(){
|
28 |
-
var new_location = "
|
29 |
window.location = new_location;
|
30 |
});
|
31 |
|
@@ -74,13 +71,13 @@ defined( 'ABSPATH' ) or die();
|
|
74 |
<?php if($first_time) {?>
|
75 |
<div class='opinionstage-status-title'>Connect WordPress with Opinion Stage to enable all features</div>
|
76 |
<i class="os-icon icon-os-poll-client"></i>
|
77 |
-
<input id="os-email" type="
|
78 |
-
<
|
79 |
<?php } else { ?>
|
80 |
<div class='opinionstage-status-title'><b>You are connected</b> to Opinion Stage with the following email</div>
|
81 |
<i class="os-icon icon-os-form-success"></i>
|
82 |
<label class="checked" for="user-email"></label>
|
83 |
-
<input id="os-email" type="
|
84 |
<a href="javascript:void(0)" id="os-switch-email" >Switch account</a>
|
85 |
<?php } ?>
|
86 |
</div>
|
@@ -90,8 +87,8 @@ defined( 'ABSPATH' ) or die();
|
|
90 |
<div id="opinionstage-section-create" class="opinionstage-dashboard-section">
|
91 |
<div class="opinionstage-section-header">
|
92 |
<div class="opinionstage-section-title">Content</div>
|
93 |
-
<?php if(!$first_time) {?>
|
94 |
-
<a href="<?php echo
|
95 |
<?php } ?>
|
96 |
</div>
|
97 |
<div class="opinionstage-section-content">
|
17 |
$('#os-start-login').click(function(){
|
18 |
var emailInput = $('#os-email');
|
19 |
var email = $(emailInput).val();
|
20 |
+
var new_location = "<?php echo OPINIONSTAGE_LOGIN_PATH.'?o='.OPINIONSTAGE_WIDGET_API_KEY.'&callback=' ?>" + encodeURIComponent(callbackURL) + "&email=" + email;
|
|
|
|
|
|
|
21 |
window.location = new_location;
|
22 |
});
|
23 |
|
24 |
$('#os-switch-email').click(function(){
|
25 |
+
var new_location = "<?php echo OPINIONSTAGE_LOGIN_PATH.'?o='.OPINIONSTAGE_WIDGET_API_KEY.'&callback=' ?>" + encodeURIComponent(callbackURL);
|
26 |
window.location = new_location;
|
27 |
});
|
28 |
|
71 |
<?php if($first_time) {?>
|
72 |
<div class='opinionstage-status-title'>Connect WordPress with Opinion Stage to enable all features</div>
|
73 |
<i class="os-icon icon-os-poll-client"></i>
|
74 |
+
<input id="os-email" type="email" placeholder="Enter Your Email">
|
75 |
+
<button class="opinionstage-blue-btn" id="os-start-login">CONNECT</button>
|
76 |
<?php } else { ?>
|
77 |
<div class='opinionstage-status-title'><b>You are connected</b> to Opinion Stage with the following email</div>
|
78 |
<i class="os-icon icon-os-form-success"></i>
|
79 |
<label class="checked" for="user-email"></label>
|
80 |
+
<input id="os-email" type="email" disabled="disabled" value="<?php echo($os_options["email"]) ?>">
|
81 |
<a href="javascript:void(0)" id="os-switch-email" >Switch account</a>
|
82 |
<?php } ?>
|
83 |
</div>
|
87 |
<div id="opinionstage-section-create" class="opinionstage-dashboard-section">
|
88 |
<div class="opinionstage-section-header">
|
89 |
<div class="opinionstage-section-title">Content</div>
|
90 |
+
<?php if ( !$first_time ) {?>
|
91 |
+
<a href="<?php echo OPINIONSTAGE_SERVER_BASE.'/dashboard/content'; ?>" target="_blank" class="opinionstage-section-action opinionstage-blue-bordered-btn">VIEW MY CONTENT</a>
|
92 |
<?php } ?>
|
93 |
</div>
|
94 |
<div class="opinionstage-section-content">
|
admin/menu-page.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// block direct access to plugin PHP files:
|
3 |
+
defined( 'ABSPATH' ) or die();
|
4 |
+
|
5 |
+
function opinionstage_register_menu_page() {
|
6 |
+
if (function_exists('add_menu_page')) {
|
7 |
+
add_menu_page(
|
8 |
+
__(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_UNIQUE_ID),
|
9 |
+
__(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_MENU_NAME),
|
10 |
+
'edit_posts',
|
11 |
+
OPINIONSTAGE_WIDGET_UNIQUE_LOCATION,
|
12 |
+
'opinionstage_menu_page',
|
13 |
+
plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/images/os.png'),
|
14 |
+
'25.234323221'
|
15 |
+
);
|
16 |
+
|
17 |
+
add_submenu_page(
|
18 |
+
null,
|
19 |
+
__('', OPINIONSTAGE_WIDGET_MENU_NAME),
|
20 |
+
__('', OPINIONSTAGE_WIDGET_MENU_NAME),
|
21 |
+
'edit_posts',
|
22 |
+
OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php'
|
23 |
+
);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
function opinionstage_menu_page() {
|
28 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
29 |
+
|
30 |
+
if (empty($os_options["uid"])) {
|
31 |
+
$first_time = true;
|
32 |
+
} else {
|
33 |
+
$first_time = false;
|
34 |
+
}
|
35 |
+
|
36 |
+
opinionstage_register_css_asset( 'menu-page', 'menu-page.css' );
|
37 |
+
opinionstage_register_css_asset( 'icon-font', 'icon-font.css' );
|
38 |
+
|
39 |
+
opinionstage_enqueue_css_asset('menu-page');
|
40 |
+
opinionstage_enqueue_css_asset('icon-font');
|
41 |
+
|
42 |
+
require( plugin_dir_path( __FILE__ ).'menu-page-template.php' );
|
43 |
+
}
|
44 |
+
?>
|
css/menu-page.css
CHANGED
@@ -25,12 +25,13 @@
|
|
25 |
#opinionstage-content .opinionstage-status-content {
|
26 |
background: url("../images/top-bg.png") no-repeat 0px 0px;
|
27 |
height: 116px;
|
28 |
-
padding
|
29 |
-
padding-top: 30px;
|
30 |
color: white;
|
31 |
}
|
32 |
#opinionstage-content #os-start-login{
|
33 |
-
padding:
|
|
|
|
|
34 |
}
|
35 |
#opinionstage-content .opinionstage-status-title {
|
36 |
font-size: 23px;
|
@@ -40,15 +41,13 @@
|
|
40 |
}
|
41 |
#opinionstage-content .opinionstage-status-content .os-icon {
|
42 |
font-size: 19px;
|
43 |
-
margin: 0;
|
44 |
margin-right: 7px;
|
45 |
-
margin-top: 9px;
|
46 |
}
|
47 |
#opinionstage-content #os-switch-email {
|
48 |
padding: 11px 0;
|
49 |
font-size: 14px;
|
50 |
}
|
51 |
-
#opinionstage-content
|
52 |
text-align: center;
|
53 |
color: #ffffff;
|
54 |
text-decoration: none;
|
@@ -59,9 +58,10 @@
|
|
59 |
-webkit-border-radius: 3px;
|
60 |
-moz-border-radius: 3px;
|
61 |
border-radius: 3px;
|
|
|
62 |
width: 95px;
|
63 |
}
|
64 |
-
#opinionstage-content
|
65 |
opacity: 0.9;
|
66 |
}
|
67 |
#opinionstage-content a.opinionstage-blue-bordered-btn {
|
@@ -94,10 +94,6 @@
|
|
94 |
background-color: #f9f9f9;
|
95 |
cursor: default;
|
96 |
}
|
97 |
-
#opinionstage-content .os-watermark, .opinionstage-sidebar-widget .os-watermark {
|
98 |
-
font-style: italic;
|
99 |
-
color: #b1b1b1 !important;
|
100 |
-
}
|
101 |
#opinionstage-content input#os-email {
|
102 |
margin: 0 15px 0 0;
|
103 |
border: none;
|
25 |
#opinionstage-content .opinionstage-status-content {
|
26 |
background: url("../images/top-bg.png") no-repeat 0px 0px;
|
27 |
height: 116px;
|
28 |
+
padding: 30px 30px 0;
|
|
|
29 |
color: white;
|
30 |
}
|
31 |
#opinionstage-content #os-start-login{
|
32 |
+
padding: 6.5px 18px;
|
33 |
+
position: relative;
|
34 |
+
top: -3px;
|
35 |
}
|
36 |
#opinionstage-content .opinionstage-status-title {
|
37 |
font-size: 23px;
|
41 |
}
|
42 |
#opinionstage-content .opinionstage-status-content .os-icon {
|
43 |
font-size: 19px;
|
|
|
44 |
margin-right: 7px;
|
|
|
45 |
}
|
46 |
#opinionstage-content #os-switch-email {
|
47 |
padding: 11px 0;
|
48 |
font-size: 14px;
|
49 |
}
|
50 |
+
#opinionstage-content .opinionstage-blue-btn {
|
51 |
text-align: center;
|
52 |
color: #ffffff;
|
53 |
text-decoration: none;
|
58 |
-webkit-border-radius: 3px;
|
59 |
-moz-border-radius: 3px;
|
60 |
border-radius: 3px;
|
61 |
+
border-style: hidden;
|
62 |
width: 95px;
|
63 |
}
|
64 |
+
#opinionstage-content .opinionstage-blue-btn:hover {
|
65 |
opacity: 0.9;
|
66 |
}
|
67 |
#opinionstage-content a.opinionstage-blue-bordered-btn {
|
94 |
background-color: #f9f9f9;
|
95 |
cursor: default;
|
96 |
}
|
|
|
|
|
|
|
|
|
97 |
#opinionstage-content input#os-email {
|
98 |
margin: 0 15px 0 0;
|
99 |
border: none;
|
css/sidebar-widget.css
CHANGED
@@ -16,10 +16,6 @@
|
|
16 |
background-color: #3499c2;
|
17 |
cursor: pointer;
|
18 |
}
|
19 |
-
.opinionstage-sidebar-widget .os-watermark {
|
20 |
-
font-style: italic;
|
21 |
-
color: #b1b1b1 !important;
|
22 |
-
}
|
23 |
|
24 |
.opinionstage-sidebar-widget {
|
25 |
overflow: hidden;
|
16 |
background-color: #3499c2;
|
17 |
cursor: pointer;
|
18 |
}
|
|
|
|
|
|
|
|
|
19 |
|
20 |
.opinionstage-sidebar-widget {
|
21 |
overflow: hidden;
|
js/shortcodes.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$( document ).ready(function() {
|
3 |
+
$('[data-opinionstage-embed-url]').each(function( ) {
|
4 |
+
var $widgetPlacement = $(this);
|
5 |
+
var url = $widgetPlacement.data('opinionstage-embed-url');
|
6 |
+
|
7 |
+
$.getJSON( url ).done( function( data ) {
|
8 |
+
$widgetPlacement.after(data.code);
|
9 |
+
})
|
10 |
+
.fail(function(jqxhr, textStatus, error) {
|
11 |
+
console.error( "[social-polls-by-opinionstage] can't load widget embed code" );
|
12 |
+
});
|
13 |
+
});
|
14 |
+
});
|
15 |
+
})( jQuery );
|
opinionstage-functions.php
CHANGED
@@ -35,31 +35,6 @@ function opinionstage_uninstall() {
|
|
35 |
delete_option(OPINIONSTAGE_OPTIONS_KEY);
|
36 |
}
|
37 |
|
38 |
-
/**
|
39 |
-
* Sidebar menu
|
40 |
-
*/
|
41 |
-
function opinionstage_poll_menu() {
|
42 |
-
if (function_exists('add_menu_page')) {
|
43 |
-
add_menu_page(
|
44 |
-
__(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_UNIQUE_ID),
|
45 |
-
__(OPINIONSTAGE_WIDGET_MENU_NAME, OPINIONSTAGE_WIDGET_MENU_NAME),
|
46 |
-
'edit_posts',
|
47 |
-
OPINIONSTAGE_WIDGET_UNIQUE_LOCATION,
|
48 |
-
'opinionstage_add_poll_page',
|
49 |
-
plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/images/os.png'),
|
50 |
-
'25.234323221'
|
51 |
-
);
|
52 |
-
|
53 |
-
add_submenu_page(
|
54 |
-
null,
|
55 |
-
__('', OPINIONSTAGE_WIDGET_MENU_NAME),
|
56 |
-
__('', OPINIONSTAGE_WIDGET_MENU_NAME),
|
57 |
-
'edit_posts',
|
58 |
-
OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage-callback.php'
|
59 |
-
);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
/**
|
64 |
* Check if the requested plugin is already available
|
65 |
*/
|
@@ -77,34 +52,6 @@ function opinionstage_other_plugin_installed_warning() {
|
|
77 |
echo "<div id='opinionstage-warning' class='error'><p><B>".__("Opinion Stage Plugin is already installed")."</B>".__(', please remove "<B>Popup for Interactive Content by Opinion Stage</B>" and use the available "<B>Poll & Quiz tools by Opinion Stage</B>" plugin')."</p></div>";
|
78 |
}
|
79 |
|
80 |
-
/**
|
81 |
-
* Instructions page for adding a poll
|
82 |
-
*/
|
83 |
-
function opinionstage_add_poll_page() {
|
84 |
-
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
85 |
-
|
86 |
-
if (empty($os_options["uid"])) {
|
87 |
-
$first_time = true;
|
88 |
-
} else {
|
89 |
-
$first_time = false;
|
90 |
-
}
|
91 |
-
|
92 |
-
opinionstage_register_css_asset( 'menu-page', 'menu-page.css' );
|
93 |
-
opinionstage_register_css_asset( 'icon-font', 'icon-font.css' );
|
94 |
-
|
95 |
-
opinionstage_enqueue_css_asset('menu-page');
|
96 |
-
opinionstage_enqueue_css_asset('icon-font');
|
97 |
-
|
98 |
-
require dirname(OPINIONSTAGE_WIDGET_UNIQUE_LOCATION).'/opinionstage-menu-page.php';
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Load the js script
|
103 |
-
*/
|
104 |
-
function opinionstage_load_scripts() {
|
105 |
-
wp_enqueue_script( 'ospolls', plugins_url(OPINIONSTAGE_WIDGET_UNIQUE_ID.'/opinionstage_plugin.js'), array( 'jquery', 'thickbox' ), '3' );
|
106 |
-
}
|
107 |
-
|
108 |
/**
|
109 |
* Add the flyout embed code to the page header
|
110 |
*/
|
@@ -121,11 +68,10 @@ function opinionstage_add_flyout() {
|
|
121 |
(function(d, s, id){
|
122 |
var js,
|
123 |
fjs = d.getElementsByTagName(s)[0],
|
124 |
-
p = (('https:' == d.location.protocol) ? 'https://' : 'http://'),
|
125 |
r = Math.floor(new Date().getTime() / 1000000);
|
126 |
if (d.getElementById(id)) {return;}
|
127 |
js = d.createElement(s); js.id = id; js.async=1;
|
128 |
-
js.src =
|
129 |
fjs.parentNode.insertBefore(js, fjs);
|
130 |
}(document, 'script', 'os-jssdk'));
|
131 |
|
35 |
delete_option(OPINIONSTAGE_OPTIONS_KEY);
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* Check if the requested plugin is already available
|
40 |
*/
|
52 |
echo "<div id='opinionstage-warning' class='error'><p><B>".__("Opinion Stage Plugin is already installed")."</B>".__(', please remove "<B>Popup for Interactive Content by Opinion Stage</B>" and use the available "<B>Poll & Quiz tools by Opinion Stage</B>" plugin')."</p></div>";
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Add the flyout embed code to the page header
|
57 |
*/
|
68 |
(function(d, s, id){
|
69 |
var js,
|
70 |
fjs = d.getElementsByTagName(s)[0],
|
|
|
71 |
r = Math.floor(new Date().getTime() / 1000000);
|
72 |
if (d.getElementById(id)) {return;}
|
73 |
js = d.createElement(s); js.id = id; js.async=1;
|
74 |
+
js.src = '<?php echo OPINIONSTAGE_SERVER_BASE; ?>' + '/assets/autoengage.js?' + r;
|
75 |
fjs.parentNode.insertBefore(js, fjs);
|
76 |
}(document, 'script', 'os-jssdk'));
|
77 |
|
opinionstage-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Poll, Survey, Quiz, Slideshow & Form Builder
|
4 |
Plugin URI: http://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
-
Version: 18.0
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: http://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
@@ -12,20 +12,31 @@ Text Domain: social-polls-by-opinionstage
|
|
12 |
// block direct access to plugin PHP files:
|
13 |
defined( 'ABSPATH' ) or die();
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Poll, Survey, Quiz, Slideshow & Form Builder');
|
18 |
define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
|
19 |
define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
|
20 |
define('OPINIONSTAGE_POLL_SHORTCODE', 'socialpoll');
|
21 |
define('OPINIONSTAGE_WIDGET_SHORTCODE', 'os-widget');
|
22 |
-
define('OPINIONSTAGE_FEED_SHORTCODE', 'os-section');
|
23 |
define('OPINIONSTAGE_PLACEMENT_SHORTCODE', 'osplacement');
|
24 |
define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
|
25 |
define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
|
26 |
define('OPINIONSTAGE_WIDGET_MENU_NAME', 'Poll, Survey, Quiz, Slider & Form');
|
27 |
-
define('OPINIONSTAGE_LOGIN_PATH', OPINIONSTAGE_SERVER_BASE.
|
28 |
-
define('OPINIONSTAGE_API_PATH', OPINIONSTAGE_SERVER_BASE.
|
29 |
|
30 |
require_once( plugin_dir_path( __FILE__ ).'/opinionstage-functions.php' );
|
31 |
|
3 |
Plugin Name: Poll, Survey, Quiz, Slideshow & Form Builder
|
4 |
Plugin URI: http://www.opinionstage.com
|
5 |
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
+
Version: 18.1.0
|
7 |
Author: OpinionStage.com
|
8 |
Author URI: http://www.opinionstage.com
|
9 |
Text Domain: social-polls-by-opinionstage
|
12 |
// block direct access to plugin PHP files:
|
13 |
defined( 'ABSPATH' ) or die();
|
14 |
|
15 |
+
$opinionstage_settings = array();
|
16 |
+
|
17 |
+
// don't even try to load any configuration settings,
|
18 |
+
// if wordpress is not in debug mode,
|
19 |
+
// as configuration settings are only for plugin development.
|
20 |
+
if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
|
21 |
+
if ( file_exists( $opinionstage_dev_cfg_path = plugin_dir_path( __FILE__ ).'dev.ini' ) ) {
|
22 |
+
error_log( "[opinionstage plugin] loading configuration from file $opinionstage_dev_cfg_path" );
|
23 |
+
$opinionstage_settings = parse_ini_file( $opinionstage_dev_cfg_path );
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
define('OPINIONSTAGE_SERVER_BASE', isset($opinionstage_settings['server_base']) ? $opinionstage_settings['server_base'] : 'https://www.opinionstage.com');
|
28 |
+
define('OPINIONSTAGE_WIDGET_VERSION', '18.1.0');
|
29 |
define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Poll, Survey, Quiz, Slideshow & Form Builder');
|
30 |
define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
|
31 |
define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
|
32 |
define('OPINIONSTAGE_POLL_SHORTCODE', 'socialpoll');
|
33 |
define('OPINIONSTAGE_WIDGET_SHORTCODE', 'os-widget');
|
|
|
34 |
define('OPINIONSTAGE_PLACEMENT_SHORTCODE', 'osplacement');
|
35 |
define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
|
36 |
define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
|
37 |
define('OPINIONSTAGE_WIDGET_MENU_NAME', 'Poll, Survey, Quiz, Slider & Form');
|
38 |
+
define('OPINIONSTAGE_LOGIN_PATH', OPINIONSTAGE_SERVER_BASE.'/integrations/wordpress/new');
|
39 |
+
define('OPINIONSTAGE_API_PATH', OPINIONSTAGE_SERVER_BASE.'/api/v1');
|
40 |
|
41 |
require_once( plugin_dir_path( __FILE__ ).'/opinionstage-functions.php' );
|
42 |
|
opinionstage-sidebar-widget.php
CHANGED
@@ -32,7 +32,7 @@ defined( 'ABSPATH' ) or die();
|
|
32 |
|
33 |
// Add the placement shortcode once widget is enabled
|
34 |
if (!empty($os_options["sidebar_placement_id"]) && $os_options['sidebar_placement_active'] == 'true') {
|
35 |
-
echo
|
36 |
}
|
37 |
|
38 |
echo $after_widget;
|
@@ -79,15 +79,12 @@ defined( 'ABSPATH' ) or die();
|
|
79 |
$('.opinionstage-sidebar-widget').on('click', '.start-login', function(){
|
80 |
var emailInput = $('#os-email');
|
81 |
var email = $(emailInput).val();
|
82 |
-
|
83 |
-
email = "";
|
84 |
-
}
|
85 |
-
var new_location = "http://" + "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL()) + "&email=" + email;
|
86 |
window.location = new_location;
|
87 |
});
|
88 |
|
89 |
$('.opinionstage-sidebar-widget').on('click', '.switch-email', function(){
|
90 |
-
var new_location = "
|
91 |
window.location = new_location;
|
92 |
});
|
93 |
|
@@ -103,20 +100,20 @@ defined( 'ABSPATH' ) or die();
|
|
103 |
<?php if($first_time) {?>
|
104 |
<p>Connect WordPress with Opinion Stage to enable the widget</p>
|
105 |
<div class="os-icon icon-os-poll-client"></div>
|
106 |
-
<input id="os-email" type="
|
107 |
<a href="javascript:void(0)" class="os-button start-login" id="os-start-login">Connect</a>
|
108 |
<?php } else { ?>
|
109 |
<div class="opinionstage-sidebar-connected">
|
110 |
<div class="os-icon icon-os-form-success"></div>
|
111 |
<div class="opinionstage-connected-info">
|
112 |
<div class="opinionstage-connected-title"><b>You are connected</b> to Opinion Stage with:</div>
|
113 |
-
<input id="os-email" type="
|
114 |
<a href="javascript:void(0)" class="switch-email" id="os-switch-email" >Switch Account</a>
|
115 |
</div>
|
116 |
</div>
|
117 |
<p>
|
118 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?></label>
|
119 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text"
|
120 |
</p>
|
121 |
<div class="opinionstage-sidebar-actions">
|
122 |
<div class="opinionstage-sidebar-enabled">
|
32 |
|
33 |
// Add the placement shortcode once widget is enabled
|
34 |
if (!empty($os_options["sidebar_placement_id"]) && $os_options['sidebar_placement_active'] == 'true') {
|
35 |
+
echo opinionstage_widget_placement( opinionstage_placement_embed_code_url($os_options["sidebar_placement_id"]) );
|
36 |
}
|
37 |
|
38 |
echo $after_widget;
|
79 |
$('.opinionstage-sidebar-widget').on('click', '.start-login', function(){
|
80 |
var emailInput = $('#os-email');
|
81 |
var email = $(emailInput).val();
|
82 |
+
var new_location = "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL()) + "&email=" + email;
|
|
|
|
|
|
|
83 |
window.location = new_location;
|
84 |
});
|
85 |
|
86 |
$('.opinionstage-sidebar-widget').on('click', '.switch-email', function(){
|
87 |
+
var new_location = "<?php echo OPINIONSTAGE_LOGIN_PATH.'?callback=' ?>" + encodeURIComponent(callbackURL());
|
88 |
window.location = new_location;
|
89 |
});
|
90 |
|
100 |
<?php if($first_time) {?>
|
101 |
<p>Connect WordPress with Opinion Stage to enable the widget</p>
|
102 |
<div class="os-icon icon-os-poll-client"></div>
|
103 |
+
<input id="os-email" type="email" class="os-email" placeholder="Enter Your Email">
|
104 |
<a href="javascript:void(0)" class="os-button start-login" id="os-start-login">Connect</a>
|
105 |
<?php } else { ?>
|
106 |
<div class="opinionstage-sidebar-connected">
|
107 |
<div class="os-icon icon-os-form-success"></div>
|
108 |
<div class="opinionstage-connected-info">
|
109 |
<div class="opinionstage-connected-title"><b>You are connected</b> to Opinion Stage with:</div>
|
110 |
+
<input id="os-email" type="email" disabled="disabled" value="<?php echo($os_options["email"]) ?>">
|
111 |
<a href="javascript:void(0)" class="switch-email" id="os-switch-email" >Switch Account</a>
|
112 |
</div>
|
113 |
</div>
|
114 |
<p>
|
115 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', OPINIONSTAGE_WIDGET_UNIQUE_ID); ?></label>
|
116 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" placeholder="Enter the title here" value="<?php echo $title; ?>" >
|
117 |
</p>
|
118 |
<div class="opinionstage-sidebar-actions">
|
119 |
<div class="opinionstage-sidebar-enabled">
|
opinionstage-utility-functions.php
CHANGED
@@ -3,220 +3,25 @@
|
|
3 |
// block direct access to plugin PHP files:
|
4 |
defined( 'ABSPATH' ) or die();
|
5 |
|
6 |
-
/**
|
7 |
-
* Main function for creating the poll html representation.
|
8 |
-
* Transforms the shortcode parameters to the desired iframe call.
|
9 |
-
*
|
10 |
-
* Syntax as follows:
|
11 |
-
* shortcode name - OPINIONSTAGE_POLL_SHORTCODE
|
12 |
-
*
|
13 |
-
* Arguments:
|
14 |
-
* @param id - Id of the poll
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
function opinionstage_add_poll_or_set($atts) {
|
19 |
-
extract(shortcode_atts(array('id' => 0, 'type' => 'poll', 'width' => ''), $atts));
|
20 |
-
if(!is_feed()) {
|
21 |
-
$id = intval($id);
|
22 |
-
return opinionstage_create_poll_embed_code($id, $type, $width);
|
23 |
-
} else {
|
24 |
-
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);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Main function for creating the widget html representation.
|
30 |
-
* Transforms the shortcode parameters to the desired iframe call.
|
31 |
-
*
|
32 |
-
* Syntax as follows:
|
33 |
-
* shortcode name - OPINIONSTAGE_WIDGET_SHORTCODE
|
34 |
-
*
|
35 |
-
* Arguments:
|
36 |
-
* @param path - Path of the widget
|
37 |
-
*
|
38 |
-
*/
|
39 |
-
function opinionstage_add_widget($atts) {
|
40 |
-
extract(shortcode_atts(array('path' => 0, 'comments' => 'true', 'sharing' => 'true', 'recommendations' => 'false', 'width' => ''), $atts));
|
41 |
-
|
42 |
-
if(!is_feed()) {
|
43 |
-
return opinionstage_create_widget_embed_code($path, $comments, $sharing, $recommendations, $width);
|
44 |
-
} else {
|
45 |
-
return __('Note: There is a widget embedded within this post, please visit the site to participate in this post\'s widget.', OPINIONSTAGE_WIDGET_UNIQUE_ID);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Main function for creating the feed html representation.
|
52 |
-
* Transforms the shortcode parameters to the desired embed code.
|
53 |
-
*
|
54 |
-
* Syntax as follows:
|
55 |
-
* shortcode name - OPINIONSTAGE_FEED_SHORTCODE
|
56 |
-
*
|
57 |
-
* Arguments:
|
58 |
-
* @param kind - Feed kind - top / mine
|
59 |
-
*
|
60 |
-
*/
|
61 |
-
function opinionstage_add_feed($atts) {
|
62 |
-
extract(shortcode_atts(array('kind' => 'top'), $atts));
|
63 |
-
|
64 |
-
if(!is_feed()) {
|
65 |
-
return opinionstage_create_feed_embed_code($kind);
|
66 |
-
} else {
|
67 |
-
return __('Note: There is a quiz section embedded within this post, please visit the site to view this post\'s quiz section.', OPINIONSTAGE_WIDGET_UNIQUE_ID);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
/**
|
71 |
-
* Main function for creating the placement html representation.
|
72 |
-
* Transforms the shortcode parameters to the desired code.
|
73 |
-
*
|
74 |
-
* Syntax as follows:
|
75 |
-
* shortcode name - OPINIONSTAGE_PLACEMENT_SHORTCODE
|
76 |
-
*
|
77 |
-
* Arguments:
|
78 |
-
* @param id - Id of the placement
|
79 |
-
*
|
80 |
-
*/
|
81 |
-
function opinionstage_add_placement($atts) {
|
82 |
-
extract(shortcode_atts(array('id' => 0), $atts));
|
83 |
-
if(!is_feed()) {
|
84 |
-
$id = intval($id);
|
85 |
-
return opinionstage_create_placement_embed_code($id);
|
86 |
-
}
|
87 |
-
}
|
88 |
-
/**
|
89 |
-
* Create the The iframe HTML Tag according to the given parameters.
|
90 |
-
* Either get the embed code or embeds it directly in case
|
91 |
-
*
|
92 |
-
* Arguments:
|
93 |
-
* @param id - Id of the poll
|
94 |
-
*/
|
95 |
-
function opinionstage_create_poll_embed_code($id, $type, $width) {
|
96 |
-
|
97 |
-
// Only present if id is available
|
98 |
-
if (isset($id) && !empty($id)) {
|
99 |
-
// Load embed code from the cache if possible
|
100 |
-
$is_homepage = is_home();
|
101 |
-
$transient_name = 'embed_code' . $id . '_' . $type . '_' . ($is_homepage ? "1" : "0") .'_' . $width;
|
102 |
-
$code = get_transient($transient_name);
|
103 |
-
if ( false === $code || '' === $code ) {
|
104 |
-
if ($type == 'set') {
|
105 |
-
$embed_code_url = "http://".OPINIONSTAGE_API_PATH."/sets/" . $id . "/code.json";
|
106 |
-
} else {
|
107 |
-
$embed_code_url = "http://".OPINIONSTAGE_API_PATH."/polls/" . $id . "/code.json?width=".$width;
|
108 |
-
}
|
109 |
-
|
110 |
-
if ($is_homepage) {
|
111 |
-
$embed_code_url .= "?h=1";
|
112 |
-
}
|
113 |
-
|
114 |
-
extract(opinionstage_get_contents($embed_code_url));
|
115 |
-
$data = json_decode($raw_data);
|
116 |
-
if ($success) {
|
117 |
-
$code = $data->{'code'};
|
118 |
-
// Set the embed code to be cached for an hour
|
119 |
-
set_transient($transient_name, $code, 3600);
|
120 |
-
}
|
121 |
-
}
|
122 |
-
}
|
123 |
-
return $code;
|
124 |
-
}
|
125 |
-
/**
|
126 |
-
* Create the The iframe HTML Tag according to the given parameters.
|
127 |
-
* Either get the embed code or embeds it directly in case
|
128 |
-
*
|
129 |
-
* Arguments:
|
130 |
-
* @param path - Path of the widget
|
131 |
-
*/
|
132 |
-
function opinionstage_create_widget_embed_code($path, $comments, $sharing, $recommendations, $width) {
|
133 |
-
|
134 |
-
// Only present if path is available
|
135 |
-
if (isset($path) && !empty($path)) {
|
136 |
-
// Load embed code from the cache if possible
|
137 |
-
$transient_name = 'embed_code' . $path . '.' . $comments . '.' . $sharing . $recommendations . $width;
|
138 |
-
$code = get_transient($transient_name);
|
139 |
-
if ( false === $code || '' === $code ) {
|
140 |
-
$embed_code_url = "http://".OPINIONSTAGE_API_PATH."/widgets" . $path . "/code.json?comments=".$comments."&sharing=".$sharing."&recommendations=".$recommendations."&width=".$width;
|
141 |
-
|
142 |
-
extract(opinionstage_get_contents($embed_code_url));
|
143 |
-
$data = json_decode($raw_data);
|
144 |
-
if ($success) {
|
145 |
-
$code = $data->{'code'};
|
146 |
-
// Set the embed code to be cached for an hour
|
147 |
-
set_transient($transient_name, $code, 3600);
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
return $code;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Create the The HTML code Tag according to the given parameters.
|
156 |
-
*
|
157 |
-
* Arguments:
|
158 |
-
* @param kind - Kind of feed to embed (top content / my content)
|
159 |
-
*/
|
160 |
-
function opinionstage_create_feed_embed_code($kind) {
|
161 |
-
|
162 |
-
// Load embed code from the cache if possible
|
163 |
-
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
164 |
-
$email = '';
|
165 |
-
if ($kind == 'my' && !empty($os_options["email"])) {
|
166 |
-
$email = $os_options["email"];
|
167 |
-
$transient_name = 'embed_code_feed_my';
|
168 |
-
} else {
|
169 |
-
$transient_name = 'embed_code_feed_top';
|
170 |
-
}
|
171 |
-
|
172 |
-
$code = get_transient($transient_name);
|
173 |
-
|
174 |
-
if ( false === $code || '' === $code ) {
|
175 |
-
$embed_code_url = "http://".OPINIONSTAGE_API_PATH."/feed/code.json?email=".$email;
|
176 |
-
|
177 |
-
extract(opinionstage_get_contents($embed_code_url));
|
178 |
-
$data = json_decode($raw_data);
|
179 |
-
if ($success) {
|
180 |
-
$code = $data->{'code'};
|
181 |
-
// Set the embed code to be cached for an hour
|
182 |
-
set_transient($transient_name, $code, 3600);
|
183 |
-
}
|
184 |
-
}
|
185 |
-
return $code;
|
186 |
-
}
|
187 |
-
/**
|
188 |
-
* Returns the embed code of a placement by fetching it from Opinion Stage api
|
189 |
-
*/
|
190 |
-
function opinionstage_create_placement_embed_code($id) {
|
191 |
-
|
192 |
-
// Only present if id is available
|
193 |
-
if (isset($id) && !empty($id)) {
|
194 |
-
// Load embed code from the cache if possible
|
195 |
-
$is_homepage = is_home();
|
196 |
-
$transient_name = 'embed_code' . $id . '_' . 'placement';
|
197 |
-
$code = get_transient($transient_name);
|
198 |
-
if ( false === $code || '' === $code ) {
|
199 |
-
$embed_code_url = "http://".OPINIONSTAGE_API_PATH."/placements/" . $id . "/code.json";
|
200 |
-
extract(opinionstage_get_contents($embed_code_url));
|
201 |
-
$data = json_decode($raw_data);
|
202 |
-
if ($success) {
|
203 |
-
$code = $data->{'code'};
|
204 |
-
// Set the embed code to be cached for an hour
|
205 |
-
set_transient($transient_name, $code, 3600);
|
206 |
-
}
|
207 |
-
}
|
208 |
-
}
|
209 |
-
return $code;
|
210 |
-
}
|
211 |
/**
|
212 |
* Utility function to create a link with the correct host and all the required information.
|
213 |
*/
|
214 |
function opinionstage_create_link($caption, $page, $params = "", $css_class = '') {
|
215 |
$params_prefix = empty($params) ? "" : "&";
|
216 |
-
$link =
|
217 |
return "<a href=\"".$link."\" target='_blank' class=\"".$css_class."\">".$caption."</a>";
|
218 |
}
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
function opinionstage_register_css_asset($name, $relative_path) {
|
221 |
wp_register_style(
|
222 |
'opinionstage-'.$name,
|
@@ -226,6 +31,10 @@ function opinionstage_register_css_asset($name, $relative_path) {
|
|
226 |
);
|
227 |
}
|
228 |
|
|
|
|
|
|
|
|
|
229 |
function opinionstage_enqueue_css_asset($name) {
|
230 |
wp_enqueue_style( 'opinionstage-'.$name );
|
231 |
}
|
@@ -236,9 +45,9 @@ function opinionstage_enqueue_css_asset($name) {
|
|
236 |
function opinionstage_flyout_edit_url($tab) {
|
237 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
238 |
if (empty($os_options["uid"])) {
|
239 |
-
return
|
240 |
}
|
241 |
-
return
|
242 |
}
|
243 |
|
244 |
|
@@ -248,9 +57,9 @@ function opinionstage_flyout_edit_url($tab) {
|
|
248 |
function opinionstage_article_placement_edit_url($tab) {
|
249 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
250 |
if (empty($os_options["uid"])) {
|
251 |
-
return
|
252 |
}
|
253 |
-
return
|
254 |
}
|
255 |
/**
|
256 |
* Generates a link for editing the sidebar placement on Opinion Stage site
|
@@ -258,9 +67,9 @@ function opinionstage_article_placement_edit_url($tab) {
|
|
258 |
function opinionstage_sidebar_placement_edit_url($tab) {
|
259 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
260 |
if (empty($os_options["uid"])) {
|
261 |
-
return
|
262 |
}
|
263 |
-
return
|
264 |
}
|
265 |
/**
|
266 |
* Generates a link for creating a poll
|
@@ -312,40 +121,6 @@ function opinionstage_callback_url() {
|
|
312 |
function opinionstage_logged_in_link($text, $link) {
|
313 |
return opinionstage_create_link($text, 'registrations/new', 'return_to='.$link);
|
314 |
}
|
315 |
-
/**
|
316 |
-
* Perform an HTTP GET Call to retrieve the data for the required content.
|
317 |
-
*
|
318 |
-
* Arguments:
|
319 |
-
* @param $url
|
320 |
-
* @return array - raw_data and a success flag
|
321 |
-
*/
|
322 |
-
function opinionstage_get_contents($url) {
|
323 |
-
$response = wp_remote_get($url, array('header' => array('Accept' => 'application/json; charset=utf-8')));
|
324 |
-
|
325 |
-
return opinionstage_parse_response($response);
|
326 |
-
}
|
327 |
-
|
328 |
-
/**
|
329 |
-
* Parse the HTTP response and return the data and if was successful or not.
|
330 |
-
*/
|
331 |
-
function opinionstage_parse_response($response) {
|
332 |
-
$success = false;
|
333 |
-
$raw_data = "Unknown error";
|
334 |
-
|
335 |
-
if (is_wp_error($response)) {
|
336 |
-
$raw_data = $response->get_error_message();
|
337 |
-
|
338 |
-
} elseif (!empty($response['response'])) {
|
339 |
-
if ($response['response']['code'] != 200) {
|
340 |
-
$raw_data = $response['response']['message'];
|
341 |
-
} else {
|
342 |
-
$success = true;
|
343 |
-
$raw_data = $response['body'];
|
344 |
-
}
|
345 |
-
}
|
346 |
-
|
347 |
-
return compact('raw_data', 'success');
|
348 |
-
}
|
349 |
/**
|
350 |
* Take the received data and parse it
|
351 |
*
|
@@ -367,5 +142,4 @@ function opinionstage_parse_client_data($raw_data) {
|
|
367 |
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
368 |
}
|
369 |
}
|
370 |
-
|
371 |
?>
|
3 |
// block direct access to plugin PHP files:
|
4 |
defined( 'ABSPATH' ) or die();
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
/**
|
7 |
* Utility function to create a link with the correct host and all the required information.
|
8 |
*/
|
9 |
function opinionstage_create_link($caption, $page, $params = "", $css_class = '') {
|
10 |
$params_prefix = empty($params) ? "" : "&";
|
11 |
+
$link = OPINIONSTAGE_SERVER_BASE."/".$page."?" . "o=".OPINIONSTAGE_WIDGET_API_KEY.$params_prefix.$params;
|
12 |
return "<a href=\"".$link."\" target='_blank' class=\"".$css_class."\">".$caption."</a>";
|
13 |
}
|
14 |
|
15 |
+
function opinionstage_register_javascript_asset( $name, $relative_path, $deps=array(), $in_footer=true ) {
|
16 |
+
wp_register_script(
|
17 |
+
'opinionstage-'.$name,
|
18 |
+
plugins_url('js/'.$relative_path, OPINIONSTAGE_WIDGET_UNIQUE_LOCATION),
|
19 |
+
$deps,
|
20 |
+
OPINIONSTAGE_WIDGET_VERSION,
|
21 |
+
$in_footer
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
function opinionstage_register_css_asset($name, $relative_path) {
|
26 |
wp_register_style(
|
27 |
'opinionstage-'.$name,
|
31 |
);
|
32 |
}
|
33 |
|
34 |
+
function opinionstage_enqueue_js_asset($name) {
|
35 |
+
wp_enqueue_script( 'opinionstage-'.$name );
|
36 |
+
}
|
37 |
+
|
38 |
function opinionstage_enqueue_css_asset($name) {
|
39 |
wp_enqueue_style( 'opinionstage-'.$name );
|
40 |
}
|
45 |
function opinionstage_flyout_edit_url($tab) {
|
46 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
47 |
if (empty($os_options["uid"])) {
|
48 |
+
return OPINIONSTAGE_SERVER_BASE.'/registrations/new';
|
49 |
}
|
50 |
+
return OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['fly_id'].'/edit?selected_tab='.$tab;
|
51 |
}
|
52 |
|
53 |
|
57 |
function opinionstage_article_placement_edit_url($tab) {
|
58 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
59 |
if (empty($os_options["uid"])) {
|
60 |
+
return OPINIONSTAGE_SERVER_BASE.'/registrations/new';
|
61 |
}
|
62 |
+
return OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['article_placement_id'].'/edit?selected_tab='.$tab;
|
63 |
}
|
64 |
/**
|
65 |
* Generates a link for editing the sidebar placement on Opinion Stage site
|
67 |
function opinionstage_sidebar_placement_edit_url($tab) {
|
68 |
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
69 |
if (empty($os_options["uid"])) {
|
70 |
+
return OPINIONSTAGE_SERVER_BASE.'/registrations/new';
|
71 |
}
|
72 |
+
return OPINIONSTAGE_SERVER_BASE.'/containers/'.$os_options['sidebar_placement_id'].'/edit?selected_tab='.$tab;
|
73 |
}
|
74 |
/**
|
75 |
* Generates a link for creating a poll
|
121 |
function opinionstage_logged_in_link($text, $link) {
|
122 |
return opinionstage_create_link($text, 'registrations/new', 'return_to='.$link);
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
/**
|
125 |
* Take the received data and parse it
|
126 |
*
|
142 |
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
143 |
}
|
144 |
}
|
|
|
145 |
?>
|
opinionstage_plugin.js
DELETED
@@ -1,23 +0,0 @@
|
|
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 |
-
$('input#os-email.watermark').focus(function(){
|
12 |
-
var input = $(this);
|
13 |
-
if (input.data('watermark') == input.val()) {
|
14 |
-
input.val("");
|
15 |
-
input.removeClass('os-watermark');
|
16 |
-
}
|
17 |
-
}).each(function(){
|
18 |
-
handleWatermark($(this));
|
19 |
-
}).blur(function(){
|
20 |
-
handleWatermark($(this));
|
21 |
-
});
|
22 |
-
});
|
23 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: poll plugin, quiz plugin, survey plugin, form builder, slideshow, slider,
|
|
6 |
|
7 |
Requires at least: 2.8
|
8 |
Tested up to: 4.7
|
9 |
-
Stable tag: 18.0
|
10 |
|
11 |
Add a poll, survey, quiz, slideshow & form builder plugin. Easily add a beautiful poll, survey, quiz, slideshow or form to your site.
|
12 |
|
@@ -283,6 +283,9 @@ You can create many different types of quizzes: Trivia quiz, personality quiz, i
|
|
283 |
N/A
|
284 |
|
285 |
== Changelog ==
|
|
|
|
|
|
|
286 |
= Poll, Survey, Quiz, Slideshow & Form Builder Version 18.0.5 =
|
287 |
* sidebar widget fix
|
288 |
= Poll, Survey, Quiz, Slideshow & Form Builder Version 18.0.4 =
|
6 |
|
7 |
Requires at least: 2.8
|
8 |
Tested up to: 4.7
|
9 |
+
Stable tag: 18.1.0
|
10 |
|
11 |
Add a poll, survey, quiz, slideshow & form builder plugin. Easily add a beautiful poll, survey, quiz, slideshow or form to your site.
|
12 |
|
283 |
N/A
|
284 |
|
285 |
== Changelog ==
|
286 |
+
= Poll, Survey, Quiz, Slideshow & Form Builder Version 18.1.0 =
|
287 |
+
* Minor styling fixes
|
288 |
+
* Widgets embedding refactor
|
289 |
= Poll, Survey, Quiz, Slideshow & Form Builder Version 18.0.5 =
|
290 |
* sidebar widget fix
|
291 |
= Poll, Survey, Quiz, Slideshow & Form Builder Version 18.0.4 =
|
site/init.php
CHANGED
@@ -2,10 +2,13 @@
|
|
2 |
// block direct access to plugin PHP files:
|
3 |
defined( 'ABSPATH' ) or die();
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
add_action('wp_head', 'opinionstage_add_flyout');
|
11 |
?>
|
2 |
// block direct access to plugin PHP files:
|
3 |
defined( 'ABSPATH' ) or die();
|
4 |
|
5 |
+
require( plugin_dir_path( __FILE__ ).'shortcodes.php' );
|
6 |
+
|
7 |
+
add_action( 'wp_enqueue_scripts', 'opinionstage_enqueue_shortcodes_assets' );
|
8 |
+
|
9 |
+
add_shortcode(OPINIONSTAGE_POLL_SHORTCODE, 'opinionstage_poll_or_set_shortcode');
|
10 |
+
add_shortcode(OPINIONSTAGE_WIDGET_SHORTCODE, 'opinionstage_widget_shortcode');
|
11 |
+
add_shortcode(OPINIONSTAGE_PLACEMENT_SHORTCODE, 'opinionstage_placement_shortcode');
|
12 |
|
13 |
add_action('wp_head', 'opinionstage_add_flyout');
|
14 |
?>
|
site/shortcodes.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// block direct access to plugin PHP files:
|
3 |
+
defined( 'ABSPATH' ) or die();
|
4 |
+
|
5 |
+
function opinionstage_enqueue_shortcodes_assets() {
|
6 |
+
opinionstage_register_javascript_asset('shortcodes', 'shortcodes.js', array('jquery'));
|
7 |
+
|
8 |
+
opinionstage_enqueue_js_asset('shortcodes');
|
9 |
+
}
|
10 |
+
|
11 |
+
function opinionstage_poll_or_set_shortcode($atts) {
|
12 |
+
if ( is_feed() ) {
|
13 |
+
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);
|
14 |
+
} else {
|
15 |
+
$shortcode_params = shortcode_atts(
|
16 |
+
array('id' => 0, 'type' => 'poll', 'width' => ''),
|
17 |
+
$atts,
|
18 |
+
OPINIONSTAGE_POLL_SHORTCODE
|
19 |
+
);
|
20 |
+
|
21 |
+
$id = intval($shortcode_params['id']);
|
22 |
+
$type = $shortcode_params['type'];
|
23 |
+
$width = $shortcode_params['width'];
|
24 |
+
|
25 |
+
return opinionstage_widget_placement( opinionstage_poll_or_set_embed_code_url($id, $type, $width) );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
function opinionstage_widget_shortcode($atts) {
|
30 |
+
if ( is_feed() ) {
|
31 |
+
return __("Note: There is a widget embedded within this post, please visit the site to participate in this post's widget.", OPINIONSTAGE_WIDGET_UNIQUE_ID);
|
32 |
+
} else {
|
33 |
+
$shortcode_params = shortcode_atts(
|
34 |
+
array('path' => 0, 'comments' => 'true', 'sharing' => 'true', 'recommendations' => 'false', 'width' => ''),
|
35 |
+
$atts,
|
36 |
+
OPINIONSTAGE_WIDGET_SHORTCODE
|
37 |
+
);
|
38 |
+
|
39 |
+
$path = $shortcode_params['path'];
|
40 |
+
$comments = $shortcode_params['comments'];
|
41 |
+
$sharing = $shortcode_params['sharing'];
|
42 |
+
$recommendations = $shortcode_params['recommendations'];
|
43 |
+
$width = $shortcode_params['width'];
|
44 |
+
|
45 |
+
return opinionstage_widget_placement( opinionstage_widget_embed_code_url($path, $comments, $sharing, $recommendations, $width) );
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
function opinionstage_placement_shortcode($atts) {
|
50 |
+
if ( !is_feed() ) {
|
51 |
+
$shortcode_params = shortcode_atts(
|
52 |
+
array('id' => 0),
|
53 |
+
$atts,
|
54 |
+
OPINIONSTAGE_PLACEMENT_SHORTCODE
|
55 |
+
);
|
56 |
+
|
57 |
+
$id = intval($shortcode_params['id']);
|
58 |
+
|
59 |
+
return opinionstage_widget_placement( opinionstage_placement_embed_code_url($id) );
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
function opinionstage_poll_or_set_embed_code_url($id, $type, $width) {
|
64 |
+
if ( isset($id) && !empty($id) ) {
|
65 |
+
if ($type == 'set') {
|
66 |
+
$embed_code_url = OPINIONSTAGE_API_PATH."/sets/" . $id . "/code.json";
|
67 |
+
} else {
|
68 |
+
$embed_code_url = OPINIONSTAGE_API_PATH."/polls/" . $id . "/code.json?width=".$width;
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( is_home() ) {
|
72 |
+
$embed_code_url .= "?h=1";
|
73 |
+
}
|
74 |
+
|
75 |
+
return $embed_code_url;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
function opinionstage_widget_embed_code_url($path, $comments, $sharing, $recommendations, $width) {
|
80 |
+
if ( isset($path) && !empty($path) ) {
|
81 |
+
$embed_code_url = OPINIONSTAGE_API_PATH."/widgets" . $path . "/code.json?comments=".$comments."&sharing=".$sharing."&recommendations=".$recommendations."&width=".$width;
|
82 |
+
return $embed_code_url;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
function opinionstage_placement_embed_code_url( $id ) {
|
87 |
+
if ( isset($id) && !empty($id) ) {
|
88 |
+
$embed_code_url = OPINIONSTAGE_API_PATH."/placements/" . $id . "/code.json";
|
89 |
+
return $embed_code_url;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
function opinionstage_widget_placement( $url ) {
|
94 |
+
ob_start();
|
95 |
+
?>
|
96 |
+
<div data-opinionstage-embed-url="<?php echo $url ?>" style="display: none; visibility: hidden;"></div>
|
97 |
+
<?php
|
98 |
+
return ob_get_clean();
|
99 |
+
}
|
100 |
+
?>
|