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

Version Description

N/A

Download this release

Release Info

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

Code changes from version 13.3.0 to 13.4.0

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: 13.3.0
7
  Author: OpinionStage.com
8
  Author URI: http://www.opinionstage.com
9
  Text Domain: social-polls-by-opinionstage
@@ -12,11 +12,12 @@ Text Domain: social-polls-by-opinionstage
12
  /* --- Static initializer for Wordpress hooks --- */
13
 
14
  define('OPINIONSTAGE_SERVER_BASE', "www.opinionstage.com"); /* Don't include the protocol, added dynamically */
15
- define('OPINIONSTAGE_WIDGET_VERSION', '13.3.0');
16
  define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
17
  define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
18
  define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
19
- define('OPINIONSTAGE_WIDGET_SHORTCODE', 'socialpoll');
 
20
  define('OPINIONSTAGE_PLACEMENT_SHORTCODE', 'osplacement');
21
  define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
22
  define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
@@ -31,7 +32,8 @@ require_once(WP_PLUGIN_DIR."/".OPINIONSTAGE_WIDGET_UNIQUE_ID."/opinionstage-widg
31
 
32
  /* --- Static initializer for Wordpress hooks --- */
33
 
34
- add_shortcode(OPINIONSTAGE_WIDGET_SHORTCODE, 'opinionstage_add_poll');
 
35
  add_shortcode(OPINIONSTAGE_PLACEMENT_SHORTCODE, 'opinionstage_add_placement');
36
 
37
  // Post creation/edit hooks
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: 13.4.0
7
  Author: OpinionStage.com
8
  Author URI: http://www.opinionstage.com
9
  Text Domain: social-polls-by-opinionstage
12
  /* --- Static initializer for Wordpress hooks --- */
13
 
14
  define('OPINIONSTAGE_SERVER_BASE', "www.opinionstage.com"); /* Don't include the protocol, added dynamically */
15
+ define('OPINIONSTAGE_WIDGET_VERSION', '13.4.0');
16
  define('OPINIONSTAGE_WIDGET_PLUGIN_NAME', 'Polls by OpinionStage');
17
  define('OPINIONSTAGE_WIDGET_API_KEY', 'wp35e8');
18
  define('OPINIONSTAGE_OPTIONS_KEY', 'opinionstage_widget');
19
+ define('OPINIONSTAGE_POLL_SHORTCODE', 'socialpoll');
20
+ define('OPINIONSTAGE_WIDGET_SHORTCODE', 'os-widget');
21
  define('OPINIONSTAGE_PLACEMENT_SHORTCODE', 'osplacement');
22
  define('OPINIONSTAGE_WIDGET_UNIQUE_ID', 'social-polls-by-opinionstage');
23
  define('OPINIONSTAGE_WIDGET_UNIQUE_LOCATION', __FILE__);
32
 
33
  /* --- Static initializer for Wordpress hooks --- */
34
 
35
+ add_shortcode(OPINIONSTAGE_POLL_SHORTCODE, 'opinionstage_add_poll_or_set');
36
+ add_shortcode(OPINIONSTAGE_WIDGET_SHORTCODE, 'opinionstage_add_widget');
37
  add_shortcode(OPINIONSTAGE_PLACEMENT_SHORTCODE, 'opinionstage_add_placement');
38
 
39
  // Post creation/edit hooks
opinionstage-utility-functions.php CHANGED
@@ -1,25 +1,45 @@
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.
@@ -38,7 +58,6 @@ function opinionstage_add_placement($atts) {
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
@@ -46,7 +65,7 @@ function opinionstage_add_placement($atts) {
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)) {
@@ -76,6 +95,39 @@ function opinionstage_create_embed_code($id, $type) {
76
  }
77
  return $code;
78
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Returns the embed code of a placement by fetching it from Opinion Stage api
81
  */
1
  <?php
2
  /**
3
+ * Main function for creating the poll html representation.
4
  * Transforms the shortcode parameters to the desired iframe call.
5
  *
6
  * Syntax as follows:
7
+ * shortcode name - OPINIONSTAGE_POLL_SHORTCODE
8
  *
9
  * Arguments:
10
  * @param id - Id of the poll
11
  *
12
  */
13
+ function opinionstage_add_poll_or_set($atts) {
14
  extract(shortcode_atts(array('id' => 0, 'type' => 'poll'), $atts));
15
  if(!is_feed()) {
16
  $id = intval($id);
17
+ return opinionstage_create_legacy_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 widget html representation.
25
+ * Transforms the shortcode parameters to the desired iframe call.
26
+ *
27
+ * Syntax as follows:
28
+ * shortcode name - OPINIONSTAGE_WIDGET_SHORTCODE
29
+ *
30
+ * Arguments:
31
+ * @param path - Path of the widget
32
+ *
33
+ */
34
+ function opinionstage_add_widget($atts) {
35
+ extract(shortcode_atts(array('path' => 0), $atts));
36
+ if(!is_feed()) {
37
+ return opinionstage_create_widget_embed_code($path);
38
+ } else {
39
+ 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);
40
+ }
41
+ }
42
+
43
  /**
44
  * Main function for creating the placement html representation.
45
  * Transforms the shortcode parameters to the desired code.
58
  return opinionstage_create_placement_embed_code($id);
59
  }
60
  }
 
61
  /**
62
  * Create the The iframe HTML Tag according to the given parameters.
63
  * Either get the embed code or embeds it directly in case
65
  * Arguments:
66
  * @param id - Id of the poll
67
  */
68
+ function opinionstage_create_legacy_embed_code($id, $type) {
69
 
70
  // Only present if id is available
71
  if (isset($id) && !empty($id)) {
95
  }
96
  return $code;
97
  }
98
+ /**
99
+ * Create the The iframe HTML Tag according to the given parameters.
100
+ * Either get the embed code or embeds it directly in case
101
+ *
102
+ * Arguments:
103
+ * @param path - Path of the widget
104
+ */
105
+ function opinionstage_create_widget_embed_code($path) {
106
+
107
+ // Only present if path is available
108
+ if (isset($path) && !empty($path)) {
109
+ // Load embed code from the cache if possible
110
+ $is_homepage = is_home();
111
+ $transient_name = 'embed_code' . $path . '_' . ($is_homepage ? "1" : "0");
112
+ $code = get_transient($transient_name);
113
+ if ( false === $code || '' === $code ) {
114
+ $embed_code_url = "http://".OPINIONSTAGE_SERVER_BASE."/api/widgets" . $path . "/embed_code.json";
115
+
116
+ if ($is_homepage) {
117
+ $embed_code_url .= "?h=1";
118
+ }
119
+
120
+ extract(opinionstage_get_contents($embed_code_url));
121
+ $data = json_decode($raw_data);
122
+ if ($success) {
123
+ $code = $data->{'code'};
124
+ // Set the embed code to be cached for an hour
125
+ set_transient($transient_name, $code, 3600);
126
+ }
127
+ }
128
+ }
129
+ return $code;
130
+ }
131
  /**
132
  * Returns the embed code of a placement by fetching it from Opinion Stage api
133
  */
readme.txt CHANGED
@@ -123,8 +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 13.3.0 =
127
- * Verious Trivia Quiz enhancements & fixes
128
  * Support for iframe embeds
129
  = Version 13.2.0 =
130
  * Suport for Basque & Vienamese languages
123
  N/A
124
 
125
  == Changelog ==
126
+ = Version 13.4.0 =
127
+ * Added shortcodes for trivia and peronsality quizzes
128
  = Version 13.3.0 =
129
+ * Various Trivia Quiz enhancements & fixes
130
  * Support for iframe embeds
131
  = Version 13.2.0 =
132
  * Suport for Basque & Vienamese languages