YOP Poll - Version 1.4

Version Description

  • Fixed compatibility issues with other plugins
Download this release

Release Info

Developer yourownprogrammer
Plugin Icon 128x128 YOP Poll
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

Files changed (4) hide show
  1. inc/admin.php +8 -6
  2. js/yop-poll-public.js +17 -8
  3. readme.txt +2 -0
  4. yop_poll.php +3 -3
inc/admin.php CHANGED
@@ -7,10 +7,10 @@
7
  register_activation_hook( $this->_config->plugin_file, array( $this, 'activate' ) );
8
  register_deactivation_hook( $this->_config->plugin_file, array( $this, 'deactivate' ) );
9
  register_uninstall_hook( $this->_config->plugin_file, 'yop_poll_uninstall' );
10
- $this->add_action('admin_enqueue_scripts', 'load_editor_functions');
11
  }
12
 
13
- public function admin_loader() {
14
  $this->add_action( 'plugins_loaded', 'load_translation_file', 1 );
15
  $this->add_action( 'admin_menu', 'admin_menu', 1 );
16
  $this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
@@ -4162,8 +4162,8 @@
4162
  else {
4163
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4164
  }
4165
- }
4166
- print json_encode( array( 'error' => $error, 'message' => $message ) );
4167
  die();
4168
  }
4169
 
@@ -4189,7 +4189,8 @@
4189
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4190
  }
4191
  }
4192
- print json_encode( array( 'error' => $error, 'message' => $message ) );
 
4193
  die();
4194
  }
4195
 
@@ -4214,7 +4215,8 @@
4214
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4215
  }
4216
  }
4217
- print json_encode( array( 'error' => $error, 'message' => $message ) );
 
4218
  die();
4219
  }
4220
 
7
  register_activation_hook( $this->_config->plugin_file, array( $this, 'activate' ) );
8
  register_deactivation_hook( $this->_config->plugin_file, array( $this, 'deactivate' ) );
9
  register_uninstall_hook( $this->_config->plugin_file, 'yop_poll_uninstall' );
10
+ $this->add_action('admin_enqueue_scripts', 'load_editor_functions');
11
  }
12
 
13
+ public function admin_loader() {
14
  $this->add_action( 'plugins_loaded', 'load_translation_file', 1 );
15
  $this->add_action( 'admin_menu', 'admin_menu', 1 );
16
  $this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
4162
  else {
4163
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4164
  }
4165
+ }
4166
+ print '[ajax-response]'.json_encode( array( 'error' => $error, 'message' => $message ) ).'[/ajax-response]';
4167
  die();
4168
  }
4169
 
4189
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4190
  }
4191
  }
4192
+ //print json_encode( array( 'error' => $error, 'message' => $message ) );
4193
+ print '[ajax-response]'.json_encode( array( 'error' => $error, 'message' => $message ) ).'[/ajax-response]';
4194
  die();
4195
  }
4196
 
4215
  $error = __( 'Invalid Request! Try later!', 'yop_poll' );
4216
  }
4217
  }
4218
+ //print json_encode( array( 'error' => $error, 'message' => $message ) );
4219
+ print '[ajax-response]'.json_encode( array( 'error' => $error, 'message' => $message ) ).'[/ajax-response]';
4220
  die();
4221
  }
4222
 
js/yop-poll-public.js CHANGED
@@ -9,12 +9,13 @@ function yop_poll_do_vote( poll_id ) {
9
  },
10
  success:
11
  function( data ){
12
- response = JSON.parse(data);
 
13
  if ( '' != response.error )
14
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
15
  else {
16
  if ( '' != response.message ) {
17
- jQuery('#yop-poll-container-'+ poll_id).html(response.message);
18
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
19
  eval(
20
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
@@ -40,12 +41,13 @@ function yop_poll_view_results( poll_id ) {
40
  },
41
  success:
42
  function( data ){
43
- response = JSON.parse(data);
 
44
  if ( '' != response.error )
45
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
46
  else {
47
  if ( '' != response.message ) {
48
- jQuery('#yop-poll-container-'+ poll_id).html(response.message);
49
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
50
  eval(
51
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
@@ -54,7 +56,7 @@ function yop_poll_view_results( poll_id ) {
54
  );
55
  }
56
  else
57
- jQuery('#yop-poll-container-error-'+ poll_id).html('An Error Has Occured!');
58
  }
59
  }
60
  });
@@ -71,12 +73,13 @@ function yop_poll_back_to_vote( poll_id ) {
71
  },
72
  success:
73
  function( data ){
74
- response = JSON.parse(data);
 
75
  if ( '' != response.error )
76
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
77
  else {
78
  if ( '' != response.message ) {
79
- jQuery('#yop-poll-container-'+ poll_id).html(response.message);
80
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
81
  eval(
82
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
@@ -89,4 +92,10 @@ function yop_poll_back_to_vote( poll_id ) {
89
  }
90
  }
91
  });
92
- }
 
 
 
 
 
 
9
  },
10
  success:
11
  function( data ){
12
+ data = yop_poll_extractResponse( data );
13
+ response = JSON.parse(data);
14
  if ( '' != response.error )
15
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
16
  else {
17
  if ( '' != response.message ) {
18
+ jQuery('#yop-poll-container-'+ poll_id).replaceWith(response.message);
19
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
20
  eval(
21
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
41
  },
42
  success:
43
  function( data ){
44
+ data = yop_poll_extractResponse( data );
45
+ response = JSON.parse(data);
46
  if ( '' != response.error )
47
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
48
  else {
49
  if ( '' != response.message ) {
50
+ jQuery('#yop-poll-container-'+ poll_id).replaceWith(response.message);
51
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
52
  eval(
53
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
56
  );
57
  }
58
  else
59
+ jQuery('#yop-poll-container-error-'+ poll_id).replaceWith('An Error Has Occured!');
60
  }
61
  }
62
  });
73
  },
74
  success:
75
  function( data ){
76
+ data = yop_poll_extractResponse( data );
77
+ response = JSON.parse(data);
78
  if ( '' != response.error )
79
  jQuery('#yop-poll-container-error-'+ poll_id).html(response.error);
80
  else {
81
  if ( '' != response.message ) {
82
+ jQuery('#yop-poll-container-'+ poll_id).replaceWith(response.message);
83
  jQuery('#yop-poll-container-error-'+ poll_id).html('');
84
  eval(
85
  "if(typeof window.strip_results_"+poll_id+" == 'function') strip_results_"+poll_id+"();" +
92
  }
93
  }
94
  });
95
+ }
96
+
97
+ function yop_poll_extractResponse( str ) {
98
+ var patt = /\[ajax-response\](.*)\[\/ajax-response\]/m;
99
+ resp = str.match( patt )
100
+ return resp[1];
101
+ }
readme.txt CHANGED
@@ -137,6 +137,8 @@ This plugin was especially designed for flexibility and it is very easy to use.
137
  == Changelog ==
138
 
139
 
 
 
140
 
141
  = 1.3 =
142
  * Fixed bug that was causing widgets text not to display
137
  == Changelog ==
138
 
139
 
140
+ = 1.4 =
141
+ * Fixed compatibility issues with other plugins
142
 
143
  = 1.3 =
144
  * Fixed bug that was causing widgets text not to display
yop_poll.php CHANGED
@@ -5,10 +5,10 @@
5
  Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use plugin for your WordPress website.
6
  Author: yourownprogrammer
7
  Author URL: http://www.yourownprogrammer.com
8
- Version: 1.3
9
  */
10
  define( 'YOP_POLL_WP_VERSION', '3.4.2' );
11
- define( 'YOP_POLL_VERSION', '1.3' );
12
  define( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) );
13
  define( 'YOP_POLL_URL', plugins_url( '', __FILE__ ) );
14
  define( 'YOP_POLL_PLUGIN_FILE', plugin_basename( __FILE__ ) );
@@ -27,7 +27,7 @@
27
 
28
  #Yop Poll Tables Name
29
  global $wpdb;
30
- $wpdb->yop_poll_version = "1.3";
31
  $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
32
  $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
33
  $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';
5
  Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use plugin for your WordPress website.
6
  Author: yourownprogrammer
7
  Author URL: http://www.yourownprogrammer.com
8
+ Version: 1.4
9
  */
10
  define( 'YOP_POLL_WP_VERSION', '3.4.2' );
11
+ define( 'YOP_POLL_VERSION', '1.4' );
12
  define( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) );
13
  define( 'YOP_POLL_URL', plugins_url( '', __FILE__ ) );
14
  define( 'YOP_POLL_PLUGIN_FILE', plugin_basename( __FILE__ ) );
27
 
28
  #Yop Poll Tables Name
29
  global $wpdb;
30
+ $wpdb->yop_poll_version = "1.4";
31
  $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
32
  $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
33
  $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';