YOP Poll - Version 5.7.9

Version Description

  • start date and end date easier to read on the front end
  • Fixed issue with showing results before vote
Download this release

Release Info

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

Code changes from version 5.7.8 to 5.7.9

inc/config.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  class Yop_Poll_Config {
3
  protected $config;
4
  public function __construct( array $config ) {
5
  $this->config = $config;
6
  }
7
  public function __get( $name ) {
8
  $value = false;
9
  if ( array_key_exists( $name, $this->config ) ) {
10
  $value = $this->config[ $name ];
11
  }
12
  return $value;
13
  }
14
  public function __set( $name, $value ) {
15
  $this->config[ $name ] = $value;
16
  }
17
  }
1
+ <?php
2
  class Yop_Poll_Config {
3
  protected $config;
4
  public function __construct( array $config ) {
5
  $this->config = $config;
6
  }
7
  public function __get( $name ) {
8
  $value = false;
9
  if ( array_key_exists( $name, $this->config ) ) {
10
  $value = $this->config[ $name ];
11
  }
12
  return $value;
13
  }
14
  public function __set( $name, $value ) {
15
  $this->config[ $name ] = $value;
16
  }
17
  }
inc/maintenance.php CHANGED
@@ -765,6 +765,10 @@ NOWDOC;
765
  global $wpdb;
766
  update_option("yop_poll_version", '5.7.8');
767
  }
 
 
 
 
768
  }
769
 
770
  private static function update_poll_template_in_database2($template)
765
  global $wpdb;
766
  update_option("yop_poll_version", '5.7.8');
767
  }
768
+ if (version_compare($installed_version, '5.7.8', '<=')) {
769
+ global $wpdb;
770
+ update_option("yop_poll_version", '5.7.9');
771
+ }
772
  }
773
 
774
  private static function update_poll_template_in_database2($template)
inc/public-admin.php CHANGED
@@ -232,7 +232,7 @@
232
  if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)|| 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'registered', $yop_poll_model->vote_permisions)) {
233
  $vote_permisions_types += 2;
234
  }
235
- }
236
  else
237
  if( in_array( 'guest', $yop_poll_model->vote_permisions ) ) {
238
  if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)) {
@@ -279,7 +279,7 @@
279
  'loading_image_alt' => __yop_poll( 'Loading' ),
280
  );
281
 
282
- $tabulate['results']=false;
283
  $tabulate['answers']=false;
284
  $tabulate['orizontal_answers']=0;
285
  $tabulate['orizontal_results']=0;
@@ -379,4 +379,4 @@
379
  */
380
 
381
 
382
- }
232
  if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)|| 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'registered', $yop_poll_model->vote_permisions)) {
233
  $vote_permisions_types += 2;
234
  }
235
+ }
236
  else
237
  if( in_array( 'guest', $yop_poll_model->vote_permisions ) ) {
238
  if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)) {
279
  'loading_image_alt' => __yop_poll( 'Loading' ),
280
  );
281
 
282
+ $tabulate['results']=false;
283
  $tabulate['answers']=false;
284
  $tabulate['orizontal_answers']=0;
285
  $tabulate['orizontal_results']=0;
379
  */
380
 
381
 
382
+ }
models/abstract_model.php CHANGED
@@ -196,15 +196,13 @@ abstract class YOP_POLL_Abstract_Model
196
 
197
  function init($data, $is_view_results, $question_sort, $question_sort_rule, $answer_sort, $answer_sort_rule)
198
  {
199
-
200
  $this->data = $data;
 
201
 
202
  $this->ID = (int)$data->ID;
203
 
204
  $this->init_options();
205
-
206
- if ('yes' == $is_view_results) {
207
-
208
  switch ($this->sorting_results) {
209
 
210
  case "database":
@@ -2023,11 +2021,11 @@ abstract class YOP_POLL_Abstract_Model
2023
  ", $poll_id));
2024
  if ( $sql && $sqls ) {
2025
  $response['success'] = __yop_poll('Result deleted');
2026
- }
2027
  else {
2028
  $response['error'] = __yop_poll('Could not delete result from database! Please try again!');
2029
  }
2030
  return $response;
2031
  }
2032
 
2033
- }
196
 
197
  function init($data, $is_view_results, $question_sort, $question_sort_rule, $answer_sort, $answer_sort_rule)
198
  {
 
199
  $this->data = $data;
200
+ //$this->options =
201
 
202
  $this->ID = (int)$data->ID;
203
 
204
  $this->init_options();
205
+ if ( ( 'yes' == $is_view_results ) || ( 'before' == $this->options['view_results'][0] )) {
 
 
206
  switch ($this->sorting_results) {
207
 
208
  case "database":
2021
  ", $poll_id));
2022
  if ( $sql && $sqls ) {
2023
  $response['success'] = __yop_poll('Result deleted');
2024
+ }
2025
  else {
2026
  $response['error'] = __yop_poll('Could not delete result from database! Please try again!');
2027
  }
2028
  return $response;
2029
  }
2030
 
2031
+ }
models/poll_model.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
 
3
  Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
4
  {
@@ -17,11 +17,11 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
17
 
18
  if ('' == $template_id) {
19
  return "";
20
- }
21
  else {
22
  $uID = uniqid('t');
23
  $poll = new YOP_POLL_Poll_Model();
24
- $template_details = self::get_poll_template_from_database(intval($template_id));
25
  $template = $template_details['before_vote_template'];
26
  $template = stripslashes_deep($template);
27
 
@@ -280,11 +280,13 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
280
  if ($ans_no > 0) {
281
  $results_tabulated_cols = $ans_no;
282
  }
283
- }
284
  else if ('tabulated' == $question->display_results) {
285
  $results_tabulated_cols = $question->display_results_tabulated_cols;
286
  }
287
-
 
 
288
  array_push($tabulate, array($answers_tabulated_cols, $results_tabulated_cols, $ans_per_question, $question->ID));
289
  }
290
 
@@ -639,7 +641,6 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
639
  $return_string = '';
640
  $is_voted = $this->is_voted();
641
  $id = $this->ID;
642
-
643
  if ($this->is_view_poll_results()) {
644
  $display_other_answers = false;
645
  if ('yes' == $question->allow_other_answers) {
@@ -652,8 +653,8 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
652
  if (isset($this->percentages_decimals)) {
653
  $percentages_decimals = $this->percentages_decimals;
654
  }
655
-
656
  if (isset($this->sorting_results)) {
 
657
  if ('as_defined' == $this->sorting_results) {
658
  $question->sortAnswers('question_order', 'asc');
659
  } elseif ('database' == $this->sorting_results) {
@@ -1396,8 +1397,8 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
1396
  if (in_array('after-poll-end-date', $this->view_results) || in_array('before', $this->view_results) || in_array('after', $this->view_results)) {
1397
  if ($this->is_view_poll_results()) {
1398
  $template = str_ireplace('%POLL-ANSWER-RESULT-LABEL%', $this->answer_result_label, $template);
1399
- $template = str_ireplace('%POLL-END-DATE%', $this->poll_end_date, $template);
1400
- $template = str_ireplace('%POLL-START-DATE%', $this->poll_start_date, $template);
1401
  }
1402
  }
1403
 
@@ -1405,8 +1406,8 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
1405
  } else {
1406
  //poll hasn't started
1407
  $template = $template_details['before_start_date_template'];
1408
- $template = str_ireplace('%POLL-END-DATE%', $this->poll_end_date, $template);
1409
- $template = str_ireplace('%POLL-START-DATE%', $this->poll_start_date, $template);
1410
  if (in_array('before', $this->view_results)) {
1411
  if ($this->is_view_poll_results()) {
1412
  $template = str_ireplace('%POLL-ANSWER-RESULT-LABEL%', $this->answer_result_label, $template);
@@ -1426,8 +1427,8 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
1426
  }
1427
  }
1428
  }
1429
- $template = str_ireplace('%POLL-END-DATE%', $this->poll_end_date, $template);
1430
- $template = str_ireplace('%POLL-START-DATE%', $this->poll_start_date, $template);
1431
  $template = stripslashes_deep($template);
1432
 
1433
  $template = str_ireplace('%POLL-ID%', $this->ID . $unique_id, $template);
@@ -1538,4 +1539,4 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
1538
  }
1539
  }
1540
 
1541
- ?>
1
+ <?php
2
 
3
  Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
4
  {
17
 
18
  if ('' == $template_id) {
19
  return "";
20
+ }
21
  else {
22
  $uID = uniqid('t');
23
  $poll = new YOP_POLL_Poll_Model();
24
+ $template_details = self::get_poll_template_from_database(intval($template_id));
25
  $template = $template_details['before_vote_template'];
26
  $template = stripslashes_deep($template);
27
 
280
  if ($ans_no > 0) {
281
  $results_tabulated_cols = $ans_no;
282
  }
283
+ }
284
  else if ('tabulated' == $question->display_results) {
285
  $results_tabulated_cols = $question->display_results_tabulated_cols;
286
  }
287
+ if( !isset($ans_per_question) ){
288
+ $ans_per_question = '';
289
+ }
290
  array_push($tabulate, array($answers_tabulated_cols, $results_tabulated_cols, $ans_per_question, $question->ID));
291
  }
292
 
641
  $return_string = '';
642
  $is_voted = $this->is_voted();
643
  $id = $this->ID;
 
644
  if ($this->is_view_poll_results()) {
645
  $display_other_answers = false;
646
  if ('yes' == $question->allow_other_answers) {
653
  if (isset($this->percentages_decimals)) {
654
  $percentages_decimals = $this->percentages_decimals;
655
  }
 
656
  if (isset($this->sorting_results)) {
657
+ error_log('maybe here');
658
  if ('as_defined' == $this->sorting_results) {
659
  $question->sortAnswers('question_order', 'asc');
660
  } elseif ('database' == $this->sorting_results) {
1397
  if (in_array('after-poll-end-date', $this->view_results) || in_array('before', $this->view_results) || in_array('after', $this->view_results)) {
1398
  if ($this->is_view_poll_results()) {
1399
  $template = str_ireplace('%POLL-ANSWER-RESULT-LABEL%', $this->answer_result_label, $template);
1400
+ $template = str_ireplace('%POLL-END-DATE%', convert_date($this->poll_end_date, $date_format, 1), $template);
1401
+ $template = str_ireplace('%POLL-START-DATE%', convert_date($this->poll_start_date, $date_format, 1), $template);
1402
  }
1403
  }
1404
 
1406
  } else {
1407
  //poll hasn't started
1408
  $template = $template_details['before_start_date_template'];
1409
+ $template = str_ireplace('%POLL-END-DATE%', convert_date($this->poll_end_date, $date_format, 1), $template);
1410
+ $template = str_ireplace('%POLL-START-DATE%', convert_date($this->poll_start_date, $date_format, 1), $template);
1411
  if (in_array('before', $this->view_results)) {
1412
  if ($this->is_view_poll_results()) {
1413
  $template = str_ireplace('%POLL-ANSWER-RESULT-LABEL%', $this->answer_result_label, $template);
1427
  }
1428
  }
1429
  }
1430
+ $template = str_ireplace('%POLL-END-DATE%', convert_date($this->poll_end_date, $date_format, 1), $template);
1431
+ $template = str_ireplace('%POLL-START-DATE%', convert_date($this->poll_start_date, $date_format, 1), $template);
1432
  $template = stripslashes_deep($template);
1433
 
1434
  $template = str_ireplace('%POLL-ID%', $this->ID . $unique_id, $template);
1539
  }
1540
  }
1541
 
1542
+ ?>
models/question_model.php CHANGED
@@ -53,7 +53,6 @@
53
  }
54
 
55
  function init( $data, $answer_sort, $answer_sort_rule ) {
56
-
57
  $this->data = $data;
58
 
59
  $this->ID = (int)$data->ID;
@@ -687,4 +686,4 @@
687
  }
688
  });
689
  }
690
- }
53
  }
54
 
55
  function init( $data, $answer_sort, $answer_sort_rule ) {
 
56
  $this->data = $data;
57
 
58
  $this->ID = (int)$data->ID;
686
  }
687
  });
688
  }
689
+ }
models/yop_poll_model.php CHANGED
@@ -435,7 +435,7 @@
435
  );
436
 
437
  if( !in_array( $orderby, $allowed_order ) ) {
438
- $orderby = "id";
439
  }
440
 
441
  if( $order != "desc" && $order != "asc") {
435
  );
436
 
437
  if( !in_array( $orderby, $allowed_order ) ) {
438
+ $order_bye = "id";
439
  }
440
 
441
  if( $order != "desc" && $order != "asc") {
readme.txt CHANGED
@@ -3,12 +3,12 @@ Contributors: yourownprogrammer
3
  Donate Link: http://www.yop-poll.com
4
  Tags: booth, create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop
5
  Requires at least: 3.3
6
- Tested up to: 4.4
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.htm
10
 
11
- Use a full option polling solution to get the answers you need.
12
 
13
  YOP Poll is the perfect, easy to use poll plugin for your wordpress site.
14
 
@@ -25,11 +25,11 @@ Designed to intuitive and easy to use, this plugin allows shortcodes and include
25
  Current poll features:
26
 
27
  * Create/ Edit / Clone/Delete poll - allows you to create or intervene in your poll at any time, if you consider it necessary.
28
-
29
  * Poll scheduling: programs each poll to start/end on a certain date. You can simultaneously run multiple polls. This option can be used to schedule your polls one after another.
30
-
31
  * Display polls: you can choose to display one or more polls on your website by simply adding the corresponding poll ID. You can also decide for a random display of your active polls.
32
-
33
  * View all polls: lists all your polls that you can sort by number of votes or voters, by question or by date. It also includes a search option.
34
 
35
  * Poll answers - allows other answers, multiple answers and includes a sorting module by various criteria: in exact order, in alphabetical order, by number of votes, ascending, descending etc.
@@ -85,7 +85,7 @@ Yes, you can run multiple polls at the same time or you can schedule them to beg
85
 
86
  = Can I ask for additional information from my voters? =
87
 
88
- Yes, you can customize your poll to request additional information. Eg. name, email, age, profession.
89
  To include this, when you create your poll using the "Add New" form, expand "Custom Fields" section and include as many requests as you need.
90
 
91
  = How can I create/modify a template? =
@@ -142,6 +142,10 @@ You can have only one question per poll. If you want to ask more than one questi
142
 
143
  == Changelog ==
144
 
 
 
 
 
145
  = 5.7.8 =
146
  * Fixed issue with reset stats
147
  * Fixed security issue
@@ -347,4 +351,4 @@ You can have only one question per poll. If you want to ask more than one questi
347
  * Fixed do_shortcode() with missing argument bug
348
 
349
  = 1.1 =
350
- * Fixed call_user_func_array() bug
3
  Donate Link: http://www.yop-poll.com
4
  Tags: booth, create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop
5
  Requires at least: 3.3
6
+ Tested up to: 4.5
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.htm
10
 
11
+ Use a full option polling solution to get the answers you need.
12
 
13
  YOP Poll is the perfect, easy to use poll plugin for your wordpress site.
14
 
25
  Current poll features:
26
 
27
  * Create/ Edit / Clone/Delete poll - allows you to create or intervene in your poll at any time, if you consider it necessary.
28
+
29
  * Poll scheduling: programs each poll to start/end on a certain date. You can simultaneously run multiple polls. This option can be used to schedule your polls one after another.
30
+
31
  * Display polls: you can choose to display one or more polls on your website by simply adding the corresponding poll ID. You can also decide for a random display of your active polls.
32
+
33
  * View all polls: lists all your polls that you can sort by number of votes or voters, by question or by date. It also includes a search option.
34
 
35
  * Poll answers - allows other answers, multiple answers and includes a sorting module by various criteria: in exact order, in alphabetical order, by number of votes, ascending, descending etc.
85
 
86
  = Can I ask for additional information from my voters? =
87
 
88
+ Yes, you can customize your poll to request additional information. Eg. name, email, age, profession.
89
  To include this, when you create your poll using the "Add New" form, expand "Custom Fields" section and include as many requests as you need.
90
 
91
  = How can I create/modify a template? =
142
 
143
  == Changelog ==
144
 
145
+ = 5.7.9 =
146
+ * start date and end date easier to read on the front end
147
+ * Fixed issue with showing results before vote
148
+
149
  = 5.7.8 =
150
  * Fixed issue with reset stats
151
  * Fixed security issue
351
  * Fixed do_shortcode() with missing argument bug
352
 
353
  = 1.1 =
354
+ * Fixed call_user_func_array() bug
yop_poll.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: YOP Poll
5
  * Plugin URI: http://yop-poll.com
6
  * Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use poll plugin for your WordPress website.
7
- * Version: 5.7.8
8
  * Author: yourownprogrammer
9
  * Author URI: http://yop-poll.com
10
  * License: GPLv2 or later
@@ -15,7 +15,7 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
15
 
16
  define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
17
  define ( 'YOP_POLL_WP_VERSION', '3.3' );
18
- define ( 'YOP_POLL_VERSION', '5.7.8' );
19
  define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
20
  define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
21
  define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
@@ -83,11 +83,10 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
83
 
84
  if( is_admin() ) {
85
  if( YOP_POLL_DEBUG ) {
86
- error_reporting( E_ALL ^ E_NOTICE );
87
  }
88
  else {
89
- error_reporting( E_ALL );
90
- //error_reporting( 0 );
91
  }
92
  //load admin manager
93
  require_once( YOP_POLL_INC . 'admin.php' );
@@ -146,13 +145,13 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
146
  wp_delete_post( $poll_archive_page_id, true );
147
  }
148
  }
149
- }
150
  else {
151
  function my_admin_notice() {
152
  ?>
153
  <div class="error">
154
  <p><?php _e( 'YOP POLL!', 'my-text-domain' ); ?></p>
155
- <p>
156
  <?php _e("Your server is running php lower than 5.3. Please update your Php version and try again!")?>
157
  </p>
158
  </div>
@@ -193,4 +192,4 @@ else {
193
 
194
  }
195
  add_action( 'admin_notices', 'my_admin_notice' );
196
- }
4
  * Plugin Name: YOP Poll
5
  * Plugin URI: http://yop-poll.com
6
  * Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use poll plugin for your WordPress website.
7
+ * Version: 5.7.9
8
  * Author: yourownprogrammer
9
  * Author URI: http://yop-poll.com
10
  * License: GPLv2 or later
15
 
16
  define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
17
  define ( 'YOP_POLL_WP_VERSION', '3.3' );
18
+ define ( 'YOP_POLL_VERSION', '5.7.9' );
19
  define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
20
  define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
21
  define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
83
 
84
  if( is_admin() ) {
85
  if( YOP_POLL_DEBUG ) {
86
+ error_reporting( E_ALL ^ E_NOTICE );
87
  }
88
  else {
89
+ error_reporting( 0 );
 
90
  }
91
  //load admin manager
92
  require_once( YOP_POLL_INC . 'admin.php' );
145
  wp_delete_post( $poll_archive_page_id, true );
146
  }
147
  }
148
+ }
149
  else {
150
  function my_admin_notice() {
151
  ?>
152
  <div class="error">
153
  <p><?php _e( 'YOP POLL!', 'my-text-domain' ); ?></p>
154
+ <p>
155
  <?php _e("Your server is running php lower than 5.3. Please update your Php version and try again!")?>
156
  </p>
157
  </div>
192
 
193
  }
194
  add_action( 'admin_notices', 'my_admin_notice' );
195
+ }