YOP Poll - Version 6.4.4

Version Description

  • added sanitization for custom headers
  • updated 5.x and 4.x importers
Download this release

Release Info

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

Code changes from version 6.4.3 to 6.4.4

admin/admin.php CHANGED
@@ -370,6 +370,10 @@ class YOP_Poll_Admin {
370
  $maintenance = new YOP_POLL_Maintenance();
371
  $maintenance->update_to_version_6_4_3();
372
  }
 
 
 
 
373
  }
374
  }
375
  public function load_translations() {
@@ -392,7 +396,7 @@ class YOP_Poll_Admin {
392
  'yop-polls',
393
  array(
394
  $this,
395
- 'manage_polls'
396
  ),
397
  YOP_POLL_URL . 'admin/assets/images/yop-poll-admin-menu-icon16.png',
398
  '26.6'
@@ -406,7 +410,7 @@ class YOP_Poll_Admin {
406
  'yop-polls',
407
  array(
408
  $this,
409
- 'manage_polls'
410
  )
411
  );
412
  if ( $subpage ) {
@@ -421,7 +425,7 @@ class YOP_Poll_Admin {
421
  'yop-poll-add-poll',
422
  array(
423
  $this,
424
- 'add_new_poll'
425
  )
426
  );
427
  $subpage = add_submenu_page(
@@ -432,7 +436,7 @@ class YOP_Poll_Admin {
432
  'yop-poll-bans',
433
  array(
434
  $this,
435
- 'manage_bans'
436
  )
437
  );
438
  $subpage_logs = add_submenu_page(
@@ -443,7 +447,7 @@ class YOP_Poll_Admin {
443
  'yop-poll-logs',
444
  array(
445
  $this,
446
- 'manage_logs'
447
  )
448
  );
449
  if ( $subpage_logs ) {
@@ -458,7 +462,7 @@ class YOP_Poll_Admin {
458
  'yop-poll-settings',
459
  array(
460
  $this,
461
- 'manage_settings'
462
  )
463
  );
464
  if ( self::$old_version ) {
@@ -470,7 +474,7 @@ class YOP_Poll_Admin {
470
  'yop-poll-migrate',
471
  array(
472
  $this,
473
- 'migrate_old_tables'
474
  )
475
  );
476
  }
@@ -482,22 +486,22 @@ class YOP_Poll_Admin {
482
  'yop-poll-upgrade-to-pro',
483
  array(
484
  $this,
485
- 'show_upgrade_to_pro'
486
  )
487
  );
488
  }
489
  }
490
  }
491
  public function load_dependencies() {
492
- $yop_poll_pages = [
493
  'yop-polls',
494
  'yop-poll-add-poll',
495
  'yop-poll-bans',
496
  'yop-poll-logs',
497
  'yop-poll-settings',
498
  'yop-poll-migrate',
499
- 'yop-poll-upgrade-to-pro'
500
- ];
501
  if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $yop_poll_pages ) ) {
502
  $this->load_styles();
503
  $this->load_scripts();
@@ -544,7 +548,7 @@ class YOP_Poll_Admin {
544
  ) {
545
  $args = array(
546
  'render' => 'explicit',
547
- 'onload' => 'YOPPollOnLoadRecaptcha'
548
  );
549
  wp_register_script( 'yop-reCaptcha', add_query_arg( $args, 'https://www.google.com/recaptcha/api.js' ), '', null );
550
  wp_enqueue_script( 'yop-reCaptcha' );
@@ -562,128 +566,132 @@ class YOP_Poll_Admin {
562
  } else {
563
  $captcha_explanation = '';
564
  }
565
- wp_localize_script( 'yop', 'objectL10n', array(
566
- 'yopPollParams' => array(
567
- 'appUrl' => YOP_POLL_URL,
568
- 'dateFormat' => self::$date_format,
569
- 'timeFormat' => self::$time_format,
570
- 'timeNow' => time(),
571
- 'votingEnded' => isset( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) : '',
572
- 'votingNotStarted' => isset( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) : '',
573
- 'newCustomFieldText' => esc_html__( 'New Custom Field', 'yop-poll' ),
574
- 'deleteTitle' => esc_html__( 'Warning', 'yop-poll' ),
575
- 'deletePollMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
576
- 'deleteBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
577
- 'deleteBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to delete these polls?', 'yop-poll' ),
578
- 'clonePollMessage' => esc_html__( 'Are you sure you want to clone this poll?', 'yop-poll' ),
579
- 'cloneBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to clone this poll?', 'yop-poll' ),
580
- 'cloneBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to clone these polls?', 'yop-poll' ),
581
- 'resetPollMessage' => esc_html__( 'Are you sure you want to reset votes for this poll?', 'yop-poll' ),
582
- 'resetBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to reset votes for this poll?', 'yop-poll' ),
583
- 'resetBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to reset votes for these polls?', 'yop-poll' ),
584
- 'noBulkActionSelected' => esc_html__( 'No bulk action selected', 'yop-poll' ),
585
- 'noPollsSelectedForBulk' => esc_html__( 'No polls selected', 'yop-poll' ),
586
- 'noBansSelectedForBulk' => esc_html__( 'No bans selected', 'yop-poll' ),
587
- 'noLogsSelectedForBulk' => esc_html__( 'No logs selected', 'yop-poll' ),
588
- 'noVotesSelectedForBulk' => esc_html__( 'No votes selected', 'yop-poll' ),
589
- 'deleteBulkBansSingleMessage' => esc_html__( 'Are you sure you want to delete this ban?', 'yop-poll' ),
590
- 'deleteBulkBansMultiMessage' => esc_html__( 'Are you sure you want to delete these bans?', 'yop-poll' ),
591
- 'deleteBulkLogsSingleMessage' => esc_html__( 'Are you sure you want to delete this log?', 'yop-poll' ),
592
- 'deleteBulkLogsMultiMessage' => esc_html__( 'Are you sure you want to delete these logs?', 'yop-poll' ),
593
- 'deleteBulkVotesSingleMessage' => esc_html__( 'Are you sure you want to delete this vote?', 'yop-poll' ),
594
- 'deleteBulkVotessMultiMessage' => esc_html__( 'Are you sure you want to delete these votes?', 'yop-poll' ),
595
- 'deleteAnswerMessage' => esc_html__( 'Are you sure you want to delete this answer?', 'yop-poll' ),
596
- 'deleteAnswerNotAllowedMessage' => esc_html__( 'Answer can\'t be deleted. At least one answer is required!', 'yop-poll' ),
597
- 'deleteCustomFieldMessage' => esc_html__( 'Are you sure you want to delete this custom field?', 'yop-poll' ),
598
- 'deleteCancelLabel' => esc_html__( 'Cancel', 'yop-poll' ),
599
- 'deleteOkLabel' => esc_html__( 'Ok', 'yop-poll' ),
600
- 'noTemplateSelectedLabel' => esc_html__( 'Before generating the preview a template is required', 'yop-poll' ),
601
- 'noSkinSelectedLabel' => esc_html__( 'Before generating the preview a skin is required', 'yop-poll' ),
602
- 'noNumberOfColumnsDefined' => esc_html__( 'Number of columns is missing', 'yop-poll' ),
603
- 'numberOfColumnsTooBig' => esc_html__( 'Too many columns. Max 12 allowed', 'yop-poll' ),
604
- 'selectHelperText' => esc_html__( 'Click to select', 'yop-poll' ),
605
- 'publishDateImmediately' => esc_html__( 'Publish immediately', 'yop-poll' ),
606
- 'publishDateSchedule' => esc_html__( 'Schedule for', 'yop-poll' ),
607
- 'copyToClipboardSuccess' => esc_html__( 'Code Copied To Clipboard', 'yop-poll' ),
608
- 'copyToClipboardError' => array(
609
- 'press' => esc_html__( 'Press', 'yop-poll' ),
610
- 'copy' => esc_html__( ' to copy', 'yop-poll' ),
611
- 'noSupport' => esc_html__( 'No Support', 'yop-poll' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  ),
613
- 'elementAdded' => esc_html__( 'Element added', 'yop-poll' ),
614
- 'captchaParams' => array(
615
- 'imgPath' => YOP_POLL_URL . 'public/assets/img/',
616
- 'url' => YOP_POLL_URL . 'app.php',
617
- 'accessibilityAlt' => isset( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) : '',
618
- 'accessibilityTitle' => isset( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-title'] ) : '',
619
- 'accessibilityDescription' => $captcha_accessibility_description,
620
- 'explanation' => $captcha_explanation,
621
- 'refreshAlt' => isset( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ) : '',
622
- 'refreshTitle' => isset( $plugin_settings_decoded['messages']['captcha']['refresh-title'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-title'] ) : ''
623
- ),
624
- 'previewParams' => array(
625
- 'pollPreviewTitle' => esc_html__( 'Poll Preview', 'yop-poll' ),
626
- 'choosePreviewText' => esc_html__( 'Show preview for', 'yop-poll' ),
627
- 'votingText' => esc_html__( 'Voting', 'yop-poll' ),
628
- 'resultsText' => esc_html__( 'Results', 'yop-poll' ),
629
- 'numberOfVotesSingular' => isset( $plugin_settings_decoded['messages']['results']['single-vote'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] ) : '',
630
- 'numberOfVotesPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) : '',
631
- 'numberOfAnswerSingular' => isset( $plugin_settings_decoded['messages']['results']['single-answer'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-answer'] ) : '',
632
- 'numberOfAnswersPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) : '',
633
- 'annonymousVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) : '',
634
- 'wordpressVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) : '',
635
- 'facebookVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['facebook'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['facebook'] ) : '',
636
- 'googleVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['google'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['google'] ) : ''
637
- ),
638
- 'saveParams' => array(
639
- 'noTemplateSelected' => esc_html__( 'Template is missing', 'yop-poll' ),
640
- 'noSkinSelected' => esc_html__( 'Skin is missing', 'yop-poll' ),
641
- 'generalErrorMessage' => esc_html__( ' is missing', 'yop-poll' ),
642
- 'noPollName' => esc_html__( 'Poll name is missing', 'yop-poll' ),
643
- 'noQuestion' => esc_html__( 'Question Text is missing', 'yop-poll' ),
644
- 'noAnswerText' => esc_html__( 'Answer Text is missing', 'yop-poll' ),
645
- 'noAnswerLink' => esc_html__( 'Answer Link is missing', 'yop-poll' ),
646
- 'noAnswerEmbed' => esc_html__( 'Answer Embed is missing', 'yop-poll' ),
647
- 'noOtherLabel' => esc_html__( 'Label for Other is missing', 'yop-poll' ),
648
- 'noMinAnswers' => esc_html__( 'Minimum answers is missing', 'yop-poll' ),
649
- 'noMaxAnswers' => esc_html__( 'Maximum answers is missing', 'yop-poll' ),
650
- 'noCustomFieldName' => esc_html__( 'Custom Field Name is missing', 'yop-poll' ),
651
- 'noStartDate' => esc_html__( 'Poll Start Date is missing', 'yop-poll' ),
652
- 'noEndDate' => esc_html__( 'Poll End Date is missing', 'yop-poll' ),
653
- 'noCustomDate' => esc_html__( 'Custom Date for displaying results is missing', 'yop-poll' ),
654
- 'noShowResultsMoment' => esc_html__( 'Show Results Time is missing', 'yop-poll' ),
655
- 'noShowResultsTo' => esc_html__( 'Show Results To is missing', 'yop-poll' ),
656
- 'noVoteAsWordpress' => esc_html__( 'Vote As WordPress User is missing', 'yop-poll' )
657
- ),
658
- 'saveBanParams' => array(
659
- 'noBanFor' => esc_html__( 'Ban For is missing', 'yop-poll' ),
660
- 'noBanValue' => esc_html__( 'Ban Value is missing', 'yop-poll' )
661
- ),
662
- 'deleteBanMessage' => esc_html__( 'Are you sure you want to delete this ban?', 'yop-poll' ),
663
- 'deleteLogMessage' => esc_html__( 'Are you sure you want to delete this log?', 'yop-poll' ),
664
- 'viewLogDetailsQuestionText' => esc_html__( 'Question', 'yop-poll' ),
665
- 'viewLogDetailsAnswerText' => esc_html__( 'Answer', 'yop-poll' ),
666
- 'showLogDetailsLinkText' => esc_html__( 'View Details', 'yop-poll' ),
667
- 'hideLogDetailsLinkText' => esc_html__( 'Hide Details', 'yop-poll' ),
668
- 'numberOfVotesText' => esc_html__( 'Number of Votes', 'yop-poll' ),
669
- 'resultsParams' => array(
670
- 'singleVote' => esc_html__( 'vote', 'yop-poll' ),
671
- 'multipleVotes' => esc_html__( 'votes', 'yop-poll' )
672
- ),
673
- 'importOld' => array(
674
- 'gdprEnabledContinue' => esc_html__( 'Got It. Continue with the migration', 'yop-poll' ),
675
- 'gdprEnabledStop' => esc_html__( 'Hold On. I want to change settings', 'yop-poll' ),
676
- 'gdprEnabledGeneral' => esc_html__( 'Please review your settings before continue', 'yop-poll' ),
677
- 'gdprEnabledChoice' => esc_html__( 'Your selection', 'yop-poll' ),
678
- 'gdprEnabledMigrateAsIs' => esc_html__( 'This setting will migrate all data from previous version without any anonymization', 'yop-poll' ),
679
- 'gdprEnabledAnonymizeIp' => esc_html__( 'This setting will migrate all data from previous version but ips will be anonymized', 'yop-poll' ),
680
- 'gdprEnabledNoStore' => esc_html__( 'This setting will migrate everything except ip addresses. ', 'yop-poll' ),
681
- 'response' => esc_html__( 'Response:', 'yop-poll' ),
682
- 'allDone' => esc_html__( 'All done.', 'yop-poll' ),
683
- 'importStarted' => esc_html__( 'Migration started', 'yop-poll' ),
684
- )
685
  )
686
- ) );
687
  }
688
  public function load_styles() {
689
  wp_enqueue_style( 'yop-admin', YOP_POLL_URL . 'admin/assets/css/admin-' . YOP_POLL_VERSION . '.css' );
@@ -790,7 +798,7 @@ class YOP_Poll_Admin {
790
  'pagination' => $polls['pagination'],
791
  'date_format' => self::$date_format,
792
  'time_format' => self::$time_format,
793
- 'show_guide' => $show_guide
794
  )
795
  );
796
  }
@@ -802,14 +810,17 @@ class YOP_Poll_Admin {
802
  $templates = YOP_Poll_Templates::get_templates();
803
  $skins = YOP_Poll_Skins::get_skins();
804
  $allowed_tags_for_templates_and_skins = YOP_Poll_Polls::get_allowed_tags_for_templates_and_skins();
805
- echo YOP_Poll_View::render( $template, array(
806
- 'allowed_tags' => $allowed_tags_for_templates_and_skins,
807
- 'templates' => $templates,
808
- 'skins' => $skins,
809
- 'notifications' => YOP_Poll_Settings::get_notifications(),
810
- 'integrations' => YOP_Poll_Settings::get_integrations(),
811
- 'date_format' => self::$date_format
812
- ) );
 
 
 
813
  }
814
  }
815
  public function show_edit_poll( $poll_id ) {
@@ -826,13 +837,16 @@ class YOP_Poll_Admin {
826
  $templates = YOP_Poll_Templates::get_templates();
827
  $skins = YOP_Poll_Skins::get_skins();
828
  $allowed_tags_for_templates_and_skins = YOP_Poll_Polls::get_allowed_tags_for_templates_and_skins();
829
- echo YOP_Poll_View::render( $template, array(
830
- 'allowed_tags' => $allowed_tags_for_templates_and_skins,
831
- 'poll' => $poll,
832
- 'templates' => $templates,
833
- 'skins' => $skins,
834
- 'integrations' => YOP_Poll_Settings::get_integrations(),
835
- 'date_format' => self::$date_format )
 
 
 
836
  );
837
  } else {
838
  esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
@@ -856,7 +870,7 @@ class YOP_Poll_Admin {
856
  array(
857
  'success' => true,
858
  'message' => esc_html__( 'Poll successfully added', 'yop-poll' ),
859
- 'pollId' => $result['poll_id']
860
  )
861
  );
862
  } else {
@@ -948,18 +962,22 @@ class YOP_Poll_Admin {
948
  }
949
  }
950
  if ( $success === intval( count( $polls_sanitized ) ) ) {
951
- wp_send_json_success( _n(
952
- 'Poll successfully deleted',
953
- 'Polls successfully deleted',
954
- count( $polls_sanitized ),
955
- 'yop-poll' )
 
 
956
  );
957
  } else {
958
- wp_send_json_error( _n(
959
- 'Error deleting poll',
960
- 'Error deleting polls',
961
- count( $polls_sanitized ),
962
- 'yop-poll' )
 
 
963
  );
964
  }
965
  } else {
@@ -1006,18 +1024,22 @@ class YOP_Poll_Admin {
1006
  }
1007
  }
1008
  if ( $success === intval( count( $polls_sanitized ) ) ) {
1009
- wp_send_json_success( _n(
1010
- 'Poll successfully cloned',
1011
- 'Polls successfully cloned',
1012
- count( $polls_sanitized ),
1013
- 'yop-poll' )
 
 
1014
  );
1015
  } else {
1016
- wp_send_json_error( _n(
1017
- 'Error cloning poll',
1018
- 'Error cloning polls',
1019
- count( $polls_sanitized ),
1020
- 'yop-poll' )
 
 
1021
  );
1022
  }
1023
  } else {
@@ -1059,7 +1081,7 @@ class YOP_Poll_Admin {
1059
  echo YOP_Poll_View::render(
1060
  $template,
1061
  array(
1062
- 'poll' => $poll
1063
  )
1064
  );
1065
  }
@@ -1081,22 +1103,37 @@ class YOP_Poll_Admin {
1081
  $cf_hidden = '';
1082
  $cf_total_pages = 0;
1083
  $customs_count = 0;
1084
- $total_votes_per_question = [];
1085
- $total_voters_per_question = [];
1086
- $votes_count = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active'", array( $poll_id ) ) );
 
 
 
 
 
1087
  $total_pages = ceil( $votes_count / $limit );
1088
  $query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active' limit $offset, $limit";
1089
- $votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, array( $poll_id ) ) );
 
 
 
 
 
1090
 
1091
  $all_votes_query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active'";
1092
- $all_votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $all_votes_query, array( $poll_id ) ) );
 
 
 
 
 
1093
 
1094
- $other_answers = [];
1095
  foreach ( $all_votes as $av ) {
1096
  $vote_data = unserialize( $av->vote_data );
1097
  $user_type = $av->user_type;
1098
  foreach ( $vote_data['elements'] as $ave ) {
1099
- $question_aswers = [];
1100
  if ( 'question' === $ave['type'] ) {
1101
  foreach ( $ave['data'] as $answers ) {
1102
  if ( 0 == $answers['id'] ) {
@@ -1113,7 +1150,10 @@ class YOP_Poll_Admin {
1113
  } else {
1114
  $total_voters_per_question[$ave['id']][$user_type] = 1;
1115
  }
1116
- $other_answers[] = [ 'question_id' => $ave['id'], 'other_answers' => $question_aswers ];
 
 
 
1117
  }
1118
  }
1119
  }
@@ -1123,10 +1163,13 @@ class YOP_Poll_Admin {
1123
  $cf_hidden .= '<input type="hidden" name="cf_page" id="cf-page" value="' . $page . '">';
1124
  foreach ( $votes as $vote ) {
1125
  $vote_data = unserialize( $vote->vote_data );
1126
- $custom_fields = [];
1127
  foreach ( $vote_data['elements'] as $vde ) {
1128
  if ( 'custom-field' === $vde['type'] ) {
1129
- $custom_fields[] = [ 'id' => $vde['id'], 'data' => isset( $vde['data'][0] ) ? $vde['data'][0] : '' ];
 
 
 
1130
  $customs_count++;
1131
  }
1132
  }
@@ -1155,7 +1198,7 @@ class YOP_Poll_Admin {
1155
  'cf_total_pages' => $cf_total_pages,
1156
  'other_answers' => $other_answers,
1157
  'total_votes_per_question' => $total_votes_per_question,
1158
- 'total_voters_per_question' => $total_voters_per_question
1159
  )
1160
  );
1161
  } else {
@@ -1164,7 +1207,7 @@ class YOP_Poll_Admin {
1164
  echo YOP_Poll_View::render(
1165
  $template,
1166
  array(
1167
- 'error' => $error
1168
  )
1169
  );
1170
  }
@@ -1194,7 +1237,7 @@ class YOP_Poll_Admin {
1194
  'votes' => $votes['votes'],
1195
  'pagination' => $votes['pagination'],
1196
  'date_format' => self::$date_format,
1197
- 'time_format' => self::$time_format
1198
  )
1199
  );
1200
  } else {
@@ -1203,7 +1246,7 @@ class YOP_Poll_Admin {
1203
  echo YOP_Poll_View::render(
1204
  $template,
1205
  array(
1206
- 'error' => $error
1207
  )
1208
  );
1209
  }
@@ -1225,10 +1268,13 @@ class YOP_Poll_Admin {
1225
  if ( count( $votes ) > 0 ) {
1226
  foreach ( $votes as $vote ) {
1227
  $vote_data = unserialize( $vote->vote_data );
1228
- $custom_fields = [];
1229
  foreach ( $vote_data['elements'] as $vde ) {
1230
  if ( 'custom-field' === $vde['type'] ) {
1231
- $custom_fields[] = [ 'id' => $vde['id'], 'data' => isset( $vde['data'][0] ) ? $vde['data'][0] : '' ];
 
 
 
1232
  }
1233
  }
1234
  if ( count( $custom_fields ) > 0 ) {
@@ -1263,15 +1309,18 @@ class YOP_Poll_Admin {
1263
  $params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
1264
  $logs = YOP_Poll_Logs::get_logs( $params );
1265
  $template = YOP_POLL_PATH . 'admin/views/logs/view.php';
1266
- echo YOP_Poll_View::render( $template, array(
1267
- 'logs' => $logs['logs'],
1268
- 'params' => $params,
1269
- 'total_logs' => $logs['total_logs'],
1270
- 'total_pages' => $logs['total_pages'],
1271
- 'pagination' => $logs['pagination'],
1272
- 'date_format' => self::$date_format,
1273
- 'time_format' => self::$time_format
1274
- ) );
 
 
 
1275
  }
1276
  }
1277
  public function get_log_details() {
@@ -1296,7 +1345,11 @@ class YOP_Poll_Admin {
1296
  }
1297
  $details_string .= '</div>';
1298
  }
1299
- wp_send_json_success( [ 'details' => $details_string ] );
 
 
 
 
1300
  } else {
1301
  wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
1302
  }
@@ -1333,24 +1386,30 @@ class YOP_Poll_Admin {
1333
  $params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
1334
  $template = YOP_POLL_PATH . 'admin/views/bans/view.php';
1335
  $bans = YOP_Poll_Bans::get_bans( $params );
1336
- echo YOP_Poll_View::render( $template, array(
1337
- 'bans' => $bans['bans'],
1338
- 'params' => $params,
1339
- 'total_bans' => $bans['total_bans'],
1340
- 'total_pages' => $bans['total_pages'],
1341
- 'pagination' => $bans['pagination'],
1342
- 'date_format' => self::$date_format,
1343
- 'time_format' => self::$time_format
1344
- ) );
 
 
 
1345
  }
1346
  }
1347
  public function show_add_ban() {
1348
  if ( current_user_can( 'yop_poll_add' ) ) {
1349
  $polls = YOP_Poll_Polls::get_names();
1350
  $template = YOP_POLL_PATH . 'admin/views/bans/add.php';
1351
- echo YOP_Poll_View::render( $template, array(
1352
- 'polls' => $polls
1353
- ) );
 
 
 
1354
  }
1355
  }
1356
  public function create_ban() {
@@ -1381,10 +1440,13 @@ class YOP_Poll_Admin {
1381
  if ( false !== $ban ) {
1382
  $polls = YOP_Poll_Polls::get_names();
1383
  $template = YOP_POLL_PATH . 'admin/views/bans/edit.php';
1384
- echo YOP_Poll_View::render( $template, array(
1385
- 'ban' => $ban['ban'],
1386
- 'polls' => $polls
1387
- ));
 
 
 
1388
  } else {
1389
  esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
1390
  }
@@ -1508,9 +1570,12 @@ class YOP_Poll_Admin {
1508
  public function record_wordpress_vote() {
1509
  if ( isset( $_GET['poll_id'] ) && ( 0 < intval( $_GET['poll_id'] ) ) ) {
1510
  $template = YOP_POLL_PATH . 'admin/views/general/addnewwordpressvote.php';
1511
- echo YOP_Poll_View::render( $template, array(
1512
- 'poll_id' => sanitize_text_field( wp_unslash( $_GET['poll_id'] ) )
1513
- ) );
 
 
 
1514
  } else {
1515
  echo 'no go';
1516
  }
@@ -1535,7 +1600,11 @@ class YOP_Poll_Admin {
1535
  }
1536
  $details_string .= '</div>';
1537
  }
1538
- wp_send_json_success( [ 'details' => $details_string ] );
 
 
 
 
1539
  } else {
1540
  wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
1541
  }
@@ -1598,18 +1667,22 @@ class YOP_Poll_Admin {
1598
  }
1599
  }
1600
  if ( $success === intval( count( $votes_sanitized ) ) ) {
1601
- wp_send_json_success( _n(
 
1602
  'Vote successfully deleted',
1603
  'Votes successfully deleted',
1604
  count( $votes_sanitized ),
1605
- 'yop-poll' )
 
1606
  );
1607
  } else {
1608
- wp_send_json_error( _n(
 
1609
  'Error deleting vote',
1610
  'Error deleting votes',
1611
  count( $votes_sanitized ),
1612
- 'yop-poll' )
 
1613
  );
1614
  }
1615
  } else {
@@ -1667,18 +1740,22 @@ class YOP_Poll_Admin {
1667
  }
1668
  }
1669
  if ( $success === intval( count( $logs_sanitized ) ) ) {
1670
- wp_send_json_success( _n(
 
1671
  'Log successfully deleted',
1672
  'Logs successfully deleted',
1673
  count( $logs_sanitized ),
1674
- 'yop-poll' )
 
1675
  );
1676
  } else {
1677
- wp_send_json_error( _n(
 
1678
  'Error deleting log',
1679
  'Error deleting logs',
1680
  count( $logs_sanitized ),
1681
- 'yop-poll' )
 
1682
  );
1683
  }
1684
  } else {
@@ -1693,7 +1770,10 @@ class YOP_Poll_Admin {
1693
  if ( $yop_poll_settings ) {
1694
  $unserialized_settings = unserialize( $yop_poll_settings );
1695
  }
1696
- echo YOP_Poll_View::render( $template, array( 'settings' => $unserialized_settings ) );
 
 
 
1697
  }
1698
  }
1699
  public function save_settings() {
@@ -1763,9 +1843,9 @@ class YOP_Poll_Admin {
1763
  $request_string = array(
1764
  'body' => array(
1765
  'action' => 'send-guide',
1766
- 'input' => $user_input
1767
  ),
1768
- 'user-agent' => 'WordPress/' . YOP_POLL_VERSION . ';'
1769
  );
1770
  $result = wp_remote_post( $url, $request_string );
1771
  if ( ! is_wp_error( $result ) && ( 200 === $result['response']['code'] ) ) {
@@ -1778,9 +1858,12 @@ class YOP_Poll_Admin {
1778
  }
1779
  public function show_upgrade_to_pro() {
1780
  $template = YOP_POLL_PATH . 'admin/views/general/upgrade-page.php';
1781
- echo YOP_Poll_View::render( $template, array(
1782
- 'link' => menu_page_url( 'yop-polls', false )
1783
- ) );
 
 
 
1784
  }
1785
  public function send_deactivation_feedback() {
1786
  $_token = isset( $_POST['_token'] ) ? sanitize_text_field( wp_unslash( $_POST['_token'] ) ) : '';
@@ -1804,7 +1887,7 @@ class YOP_Poll_Admin {
1804
  }
1805
  $email_headers = array(
1806
  'From: Wordpress Deactivation Notice <deactivate@yop-poll.com>',
1807
- 'Content-Type: text/plain'
1808
  );
1809
  $success = wp_mail( array( 'noreply@yop-poll.com' ), $subject, $message, $email_headers );
1810
  wp_die();
370
  $maintenance = new YOP_POLL_Maintenance();
371
  $maintenance->update_to_version_6_4_3();
372
  }
373
+ if ( true === version_compare( $installed_version, '6.4.4', '<' ) ) {
374
+ $maintenance = new YOP_POLL_Maintenance();
375
+ $maintenance->update_to_version_6_4_4();
376
+ }
377
  }
378
  }
379
  public function load_translations() {
396
  'yop-polls',
397
  array(
398
  $this,
399
+ 'manage_polls',
400
  ),
401
  YOP_POLL_URL . 'admin/assets/images/yop-poll-admin-menu-icon16.png',
402
  '26.6'
410
  'yop-polls',
411
  array(
412
  $this,
413
+ 'manage_polls',
414
  )
415
  );
416
  if ( $subpage ) {
425
  'yop-poll-add-poll',
426
  array(
427
  $this,
428
+ 'add_new_poll',
429
  )
430
  );
431
  $subpage = add_submenu_page(
436
  'yop-poll-bans',
437
  array(
438
  $this,
439
+ 'manage_bans',
440
  )
441
  );
442
  $subpage_logs = add_submenu_page(
447
  'yop-poll-logs',
448
  array(
449
  $this,
450
+ 'manage_logs',
451
  )
452
  );
453
  if ( $subpage_logs ) {
462
  'yop-poll-settings',
463
  array(
464
  $this,
465
+ 'manage_settings',
466
  )
467
  );
468
  if ( self::$old_version ) {
474
  'yop-poll-migrate',
475
  array(
476
  $this,
477
+ 'migrate_old_tables',
478
  )
479
  );
480
  }
486
  'yop-poll-upgrade-to-pro',
487
  array(
488
  $this,
489
+ 'show_upgrade_to_pro',
490
  )
491
  );
492
  }
493
  }
494
  }
495
  public function load_dependencies() {
496
+ $yop_poll_pages = array(
497
  'yop-polls',
498
  'yop-poll-add-poll',
499
  'yop-poll-bans',
500
  'yop-poll-logs',
501
  'yop-poll-settings',
502
  'yop-poll-migrate',
503
+ 'yop-poll-upgrade-to-pro',
504
+ );
505
  if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $yop_poll_pages ) ) {
506
  $this->load_styles();
507
  $this->load_scripts();
548
  ) {
549
  $args = array(
550
  'render' => 'explicit',
551
+ 'onload' => 'YOPPollOnLoadRecaptcha',
552
  );
553
  wp_register_script( 'yop-reCaptcha', add_query_arg( $args, 'https://www.google.com/recaptcha/api.js' ), '', null );
554
  wp_enqueue_script( 'yop-reCaptcha' );
566
  } else {
567
  $captcha_explanation = '';
568
  }
569
+ wp_localize_script(
570
+ 'yop',
571
+ 'objectL10n',
572
+ array(
573
+ 'yopPollParams' => array(
574
+ 'appUrl' => YOP_POLL_URL,
575
+ 'dateFormat' => self::$date_format,
576
+ 'timeFormat' => self::$time_format,
577
+ 'timeNow' => time(),
578
+ 'votingEnded' => isset( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) : '',
579
+ 'votingNotStarted' => isset( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) : '',
580
+ 'newCustomFieldText' => esc_html__( 'New Custom Field', 'yop-poll' ),
581
+ 'deleteTitle' => esc_html__( 'Warning', 'yop-poll' ),
582
+ 'deletePollMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
583
+ 'deleteBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
584
+ 'deleteBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to delete these polls?', 'yop-poll' ),
585
+ 'clonePollMessage' => esc_html__( 'Are you sure you want to clone this poll?', 'yop-poll' ),
586
+ 'cloneBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to clone this poll?', 'yop-poll' ),
587
+ 'cloneBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to clone these polls?', 'yop-poll' ),
588
+ 'resetPollMessage' => esc_html__( 'Are you sure you want to reset votes for this poll?', 'yop-poll' ),
589
+ 'resetBulkPollsSingleMessage' => esc_html__( 'Are you sure you want to reset votes for this poll?', 'yop-poll' ),
590
+ 'resetBulkPollsMultiMessage' => esc_html__( 'Are you sure you want to reset votes for these polls?', 'yop-poll' ),
591
+ 'noBulkActionSelected' => esc_html__( 'No bulk action selected', 'yop-poll' ),
592
+ 'noPollsSelectedForBulk' => esc_html__( 'No polls selected', 'yop-poll' ),
593
+ 'noBansSelectedForBulk' => esc_html__( 'No bans selected', 'yop-poll' ),
594
+ 'noLogsSelectedForBulk' => esc_html__( 'No logs selected', 'yop-poll' ),
595
+ 'noVotesSelectedForBulk' => esc_html__( 'No votes selected', 'yop-poll' ),
596
+ 'deleteBulkBansSingleMessage' => esc_html__( 'Are you sure you want to delete this ban?', 'yop-poll' ),
597
+ 'deleteBulkBansMultiMessage' => esc_html__( 'Are you sure you want to delete these bans?', 'yop-poll' ),
598
+ 'deleteBulkLogsSingleMessage' => esc_html__( 'Are you sure you want to delete this log?', 'yop-poll' ),
599
+ 'deleteBulkLogsMultiMessage' => esc_html__( 'Are you sure you want to delete these logs?', 'yop-poll' ),
600
+ 'deleteBulkVotesSingleMessage' => esc_html__( 'Are you sure you want to delete this vote?', 'yop-poll' ),
601
+ 'deleteBulkVotessMultiMessage' => esc_html__( 'Are you sure you want to delete these votes?', 'yop-poll' ),
602
+ 'deleteAnswerMessage' => esc_html__( 'Are you sure you want to delete this answer?', 'yop-poll' ),
603
+ 'deleteAnswerNotAllowedMessage' => esc_html__( 'Answer can\'t be deleted. At least one answer is required!', 'yop-poll' ),
604
+ 'deleteCustomFieldMessage' => esc_html__( 'Are you sure you want to delete this custom field?', 'yop-poll' ),
605
+ 'deleteCancelLabel' => esc_html__( 'Cancel', 'yop-poll' ),
606
+ 'deleteOkLabel' => esc_html__( 'Ok', 'yop-poll' ),
607
+ 'noTemplateSelectedLabel' => esc_html__( 'Before generating the preview a template is required', 'yop-poll' ),
608
+ 'noSkinSelectedLabel' => esc_html__( 'Before generating the preview a skin is required', 'yop-poll' ),
609
+ 'noNumberOfColumnsDefined' => esc_html__( 'Number of columns is missing', 'yop-poll' ),
610
+ 'numberOfColumnsTooBig' => esc_html__( 'Too many columns. Max 12 allowed', 'yop-poll' ),
611
+ 'selectHelperText' => esc_html__( 'Click to select', 'yop-poll' ),
612
+ 'publishDateImmediately' => esc_html__( 'Publish immediately', 'yop-poll' ),
613
+ 'publishDateSchedule' => esc_html__( 'Schedule for', 'yop-poll' ),
614
+ 'copyToClipboardSuccess' => esc_html__( 'Code Copied To Clipboard', 'yop-poll' ),
615
+ 'copyToClipboardError' => array(
616
+ 'press' => esc_html__( 'Press', 'yop-poll' ),
617
+ 'copy' => esc_html__( ' to copy', 'yop-poll' ),
618
+ 'noSupport' => esc_html__( 'No Support', 'yop-poll' ),
619
+ ),
620
+ 'elementAdded' => esc_html__( 'Element added', 'yop-poll' ),
621
+ 'captchaParams' => array(
622
+ 'imgPath' => YOP_POLL_URL . 'public/assets/img/',
623
+ 'url' => YOP_POLL_URL . 'app.php',
624
+ 'accessibilityAlt' => isset( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) : '',
625
+ 'accessibilityTitle' => isset( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-title'] ) : '',
626
+ 'accessibilityDescription' => $captcha_accessibility_description,
627
+ 'explanation' => $captcha_explanation,
628
+ 'refreshAlt' => isset( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ) : '',
629
+ 'refreshTitle' => isset( $plugin_settings_decoded['messages']['captcha']['refresh-title'] ) ? esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-title'] ) : '',
630
+ ),
631
+ 'previewParams' => array(
632
+ 'pollPreviewTitle' => esc_html__( 'Poll Preview', 'yop-poll' ),
633
+ 'choosePreviewText' => esc_html__( 'Show preview for', 'yop-poll' ),
634
+ 'votingText' => esc_html__( 'Voting', 'yop-poll' ),
635
+ 'resultsText' => esc_html__( 'Results', 'yop-poll' ),
636
+ 'numberOfVotesSingular' => isset( $plugin_settings_decoded['messages']['results']['single-vote'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] ) : '',
637
+ 'numberOfVotesPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) : '',
638
+ 'numberOfAnswerSingular' => isset( $plugin_settings_decoded['messages']['results']['single-answer'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-answer'] ) : '',
639
+ 'numberOfAnswersPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) : '',
640
+ 'annonymousVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) : '',
641
+ 'wordpressVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) : '',
642
+ 'facebookVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['facebook'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['facebook'] ) : '',
643
+ 'googleVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['google'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['google'] ) : '',
644
+ ),
645
+ 'saveParams' => array(
646
+ 'noTemplateSelected' => esc_html__( 'Template is missing', 'yop-poll' ),
647
+ 'noSkinSelected' => esc_html__( 'Skin is missing', 'yop-poll' ),
648
+ 'generalErrorMessage' => esc_html__( ' is missing', 'yop-poll' ),
649
+ 'noPollName' => esc_html__( 'Poll name is missing', 'yop-poll' ),
650
+ 'noQuestion' => esc_html__( 'Question Text is missing', 'yop-poll' ),
651
+ 'noAnswerText' => esc_html__( 'Answer Text is missing', 'yop-poll' ),
652
+ 'noAnswerLink' => esc_html__( 'Answer Link is missing', 'yop-poll' ),
653
+ 'noAnswerEmbed' => esc_html__( 'Answer Embed is missing', 'yop-poll' ),
654
+ 'noOtherLabel' => esc_html__( 'Label for Other is missing', 'yop-poll' ),
655
+ 'noMinAnswers' => esc_html__( 'Minimum answers is missing', 'yop-poll' ),
656
+ 'noMaxAnswers' => esc_html__( 'Maximum answers is missing', 'yop-poll' ),
657
+ 'noCustomFieldName' => esc_html__( 'Custom Field Name is missing', 'yop-poll' ),
658
+ 'noStartDate' => esc_html__( 'Poll Start Date is missing', 'yop-poll' ),
659
+ 'noEndDate' => esc_html__( 'Poll End Date is missing', 'yop-poll' ),
660
+ 'noCustomDate' => esc_html__( 'Custom Date for displaying results is missing', 'yop-poll' ),
661
+ 'noShowResultsMoment' => esc_html__( 'Show Results Time is missing', 'yop-poll' ),
662
+ 'noShowResultsTo' => esc_html__( 'Show Results To is missing', 'yop-poll' ),
663
+ 'noVoteAsWordpress' => esc_html__( 'Vote As WordPress User is missing', 'yop-poll' ),
664
+ ),
665
+ 'saveBanParams' => array(
666
+ 'noBanFor' => esc_html__( 'Ban For is missing', 'yop-poll' ),
667
+ 'noBanValue' => esc_html__( 'Ban Value is missing', 'yop-poll' ),
668
+ ),
669
+ 'deleteBanMessage' => esc_html__( 'Are you sure you want to delete this ban?', 'yop-poll' ),
670
+ 'deleteLogMessage' => esc_html__( 'Are you sure you want to delete this log?', 'yop-poll' ),
671
+ 'viewLogDetailsQuestionText' => esc_html__( 'Question', 'yop-poll' ),
672
+ 'viewLogDetailsAnswerText' => esc_html__( 'Answer', 'yop-poll' ),
673
+ 'showLogDetailsLinkText' => esc_html__( 'View Details', 'yop-poll' ),
674
+ 'hideLogDetailsLinkText' => esc_html__( 'Hide Details', 'yop-poll' ),
675
+ 'numberOfVotesText' => esc_html__( 'Number of Votes', 'yop-poll' ),
676
+ 'resultsParams' => array(
677
+ 'singleVote' => esc_html__( 'vote', 'yop-poll' ),
678
+ 'multipleVotes' => esc_html__( 'votes', 'yop-poll' ),
679
+ ),
680
+ 'importOld' => array(
681
+ 'gdprEnabledContinue' => esc_html__( 'Got It. Continue with the migration', 'yop-poll' ),
682
+ 'gdprEnabledStop' => esc_html__( 'Hold On. I want to change settings', 'yop-poll' ),
683
+ 'gdprEnabledGeneral' => esc_html__( 'Please review your settings before continue', 'yop-poll' ),
684
+ 'gdprEnabledChoice' => esc_html__( 'Your selection', 'yop-poll' ),
685
+ 'gdprEnabledMigrateAsIs' => esc_html__( 'This setting will migrate all data from previous version without any anonymization', 'yop-poll' ),
686
+ 'gdprEnabledAnonymizeIp' => esc_html__( 'This setting will migrate all data from previous version but ips will be anonymized', 'yop-poll' ),
687
+ 'gdprEnabledNoStore' => esc_html__( 'This setting will migrate everything except ip addresses. ', 'yop-poll' ),
688
+ 'response' => esc_html__( 'Response:', 'yop-poll' ),
689
+ 'allDone' => esc_html__( 'All done.', 'yop-poll' ),
690
+ 'importStarted' => esc_html__( 'Migration started', 'yop-poll' ),
691
+ ),
692
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
  )
694
+ );
695
  }
696
  public function load_styles() {
697
  wp_enqueue_style( 'yop-admin', YOP_POLL_URL . 'admin/assets/css/admin-' . YOP_POLL_VERSION . '.css' );
798
  'pagination' => $polls['pagination'],
799
  'date_format' => self::$date_format,
800
  'time_format' => self::$time_format,
801
+ 'show_guide' => $show_guide,
802
  )
803
  );
804
  }
810
  $templates = YOP_Poll_Templates::get_templates();
811
  $skins = YOP_Poll_Skins::get_skins();
812
  $allowed_tags_for_templates_and_skins = YOP_Poll_Polls::get_allowed_tags_for_templates_and_skins();
813
+ echo YOP_Poll_View::render(
814
+ $template,
815
+ array(
816
+ 'allowed_tags' => $allowed_tags_for_templates_and_skins,
817
+ 'templates' => $templates,
818
+ 'skins' => $skins,
819
+ 'notifications' => YOP_Poll_Settings::get_notifications(),
820
+ 'integrations' => YOP_Poll_Settings::get_integrations(),
821
+ 'date_format' => self::$date_format,
822
+ )
823
+ );
824
  }
825
  }
826
  public function show_edit_poll( $poll_id ) {
837
  $templates = YOP_Poll_Templates::get_templates();
838
  $skins = YOP_Poll_Skins::get_skins();
839
  $allowed_tags_for_templates_and_skins = YOP_Poll_Polls::get_allowed_tags_for_templates_and_skins();
840
+ echo YOP_Poll_View::render(
841
+ $template,
842
+ array(
843
+ 'allowed_tags' => $allowed_tags_for_templates_and_skins,
844
+ 'poll' => $poll,
845
+ 'templates' => $templates,
846
+ 'skins' => $skins,
847
+ 'integrations' => YOP_Poll_Settings::get_integrations(),
848
+ 'date_format' => self::$date_format,
849
+ )
850
  );
851
  } else {
852
  esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
870
  array(
871
  'success' => true,
872
  'message' => esc_html__( 'Poll successfully added', 'yop-poll' ),
873
+ 'pollId' => $result['poll_id'],
874
  )
875
  );
876
  } else {
962
  }
963
  }
964
  if ( $success === intval( count( $polls_sanitized ) ) ) {
965
+ wp_send_json_success(
966
+ _n(
967
+ 'Poll successfully deleted',
968
+ 'Polls successfully deleted',
969
+ count( $polls_sanitized ),
970
+ 'yop-poll'
971
+ )
972
  );
973
  } else {
974
+ wp_send_json_error(
975
+ _n(
976
+ 'Error deleting poll',
977
+ 'Error deleting polls',
978
+ count( $polls_sanitized ),
979
+ 'yop-poll'
980
+ )
981
  );
982
  }
983
  } else {
1024
  }
1025
  }
1026
  if ( $success === intval( count( $polls_sanitized ) ) ) {
1027
+ wp_send_json_success(
1028
+ _n(
1029
+ 'Poll successfully cloned',
1030
+ 'Polls successfully cloned',
1031
+ count( $polls_sanitized ),
1032
+ 'yop-poll'
1033
+ )
1034
  );
1035
  } else {
1036
+ wp_send_json_error(
1037
+ _n(
1038
+ 'Error cloning poll',
1039
+ 'Error cloning polls',
1040
+ count( $polls_sanitized ),
1041
+ 'yop-poll'
1042
+ )
1043
  );
1044
  }
1045
  } else {
1081
  echo YOP_Poll_View::render(
1082
  $template,
1083
  array(
1084
+ 'poll' => $poll,
1085
  )
1086
  );
1087
  }
1103
  $cf_hidden = '';
1104
  $cf_total_pages = 0;
1105
  $customs_count = 0;
1106
+ $total_votes_per_question = array();
1107
+ $total_voters_per_question = array();
1108
+ $votes_count = $GLOBALS['wpdb']->get_var(
1109
+ $GLOBALS['wpdb']->prepare(
1110
+ "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active'",
1111
+ array( $poll_id )
1112
+ )
1113
+ );
1114
  $total_pages = ceil( $votes_count / $limit );
1115
  $query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active' limit $offset, $limit";
1116
+ $votes = $GLOBALS['wpdb']->get_results(
1117
+ $GLOBALS['wpdb']->prepare(
1118
+ $query,
1119
+ array( $poll_id )
1120
+ )
1121
+ );
1122
 
1123
  $all_votes_query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active'";
1124
+ $all_votes = $GLOBALS['wpdb']->get_results(
1125
+ $GLOBALS['wpdb']->prepare(
1126
+ $all_votes_query,
1127
+ array( $poll_id )
1128
+ )
1129
+ );
1130
 
1131
+ $other_answers = array();
1132
  foreach ( $all_votes as $av ) {
1133
  $vote_data = unserialize( $av->vote_data );
1134
  $user_type = $av->user_type;
1135
  foreach ( $vote_data['elements'] as $ave ) {
1136
+ $question_aswers = array();
1137
  if ( 'question' === $ave['type'] ) {
1138
  foreach ( $ave['data'] as $answers ) {
1139
  if ( 0 == $answers['id'] ) {
1150
  } else {
1151
  $total_voters_per_question[$ave['id']][$user_type] = 1;
1152
  }
1153
+ $other_answers[] = array(
1154
+ 'question_id' => $ave['id'],
1155
+ 'other_answers' => $question_aswers,
1156
+ );
1157
  }
1158
  }
1159
  }
1163
  $cf_hidden .= '<input type="hidden" name="cf_page" id="cf-page" value="' . $page . '">';
1164
  foreach ( $votes as $vote ) {
1165
  $vote_data = unserialize( $vote->vote_data );
1166
+ $custom_fields = array();
1167
  foreach ( $vote_data['elements'] as $vde ) {
1168
  if ( 'custom-field' === $vde['type'] ) {
1169
+ $custom_fields[] = array(
1170
+ 'id' => $vde['id'],
1171
+ 'data' => isset( $vde['data'][0] ) ? $vde['data'][0] : '',
1172
+ );
1173
  $customs_count++;
1174
  }
1175
  }
1198
  'cf_total_pages' => $cf_total_pages,
1199
  'other_answers' => $other_answers,
1200
  'total_votes_per_question' => $total_votes_per_question,
1201
+ 'total_voters_per_question' => $total_voters_per_question,
1202
  )
1203
  );
1204
  } else {
1207
  echo YOP_Poll_View::render(
1208
  $template,
1209
  array(
1210
+ 'error' => $error,
1211
  )
1212
  );
1213
  }
1237
  'votes' => $votes['votes'],
1238
  'pagination' => $votes['pagination'],
1239
  'date_format' => self::$date_format,
1240
+ 'time_format' => self::$time_format,
1241
  )
1242
  );
1243
  } else {
1246
  echo YOP_Poll_View::render(
1247
  $template,
1248
  array(
1249
+ 'error' => $error,
1250
  )
1251
  );
1252
  }
1268
  if ( count( $votes ) > 0 ) {
1269
  foreach ( $votes as $vote ) {
1270
  $vote_data = unserialize( $vote->vote_data );
1271
+ $custom_fields = array();
1272
  foreach ( $vote_data['elements'] as $vde ) {
1273
  if ( 'custom-field' === $vde['type'] ) {
1274
+ $custom_fields[] = array(
1275
+ 'id' => $vde['id'],
1276
+ 'data' => isset( $vde['data'][0] ) ? $vde['data'][0] : '',
1277
+ );
1278
  }
1279
  }
1280
  if ( count( $custom_fields ) > 0 ) {
1309
  $params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
1310
  $logs = YOP_Poll_Logs::get_logs( $params );
1311
  $template = YOP_POLL_PATH . 'admin/views/logs/view.php';
1312
+ echo YOP_Poll_View::render(
1313
+ $template,
1314
+ array(
1315
+ 'logs' => $logs['logs'],
1316
+ 'params' => $params,
1317
+ 'total_logs' => $logs['total_logs'],
1318
+ 'total_pages' => $logs['total_pages'],
1319
+ 'pagination' => $logs['pagination'],
1320
+ 'date_format' => self::$date_format,
1321
+ 'time_format' => self::$time_format,
1322
+ )
1323
+ );
1324
  }
1325
  }
1326
  public function get_log_details() {
1345
  }
1346
  $details_string .= '</div>';
1347
  }
1348
+ wp_send_json_success(
1349
+ array(
1350
+ 'details' => $details_string,
1351
+ )
1352
+ );
1353
  } else {
1354
  wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
1355
  }
1386
  $params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
1387
  $template = YOP_POLL_PATH . 'admin/views/bans/view.php';
1388
  $bans = YOP_Poll_Bans::get_bans( $params );
1389
+ echo YOP_Poll_View::render(
1390
+ $template,
1391
+ array(
1392
+ 'bans' => $bans['bans'],
1393
+ 'params' => $params,
1394
+ 'total_bans' => $bans['total_bans'],
1395
+ 'total_pages' => $bans['total_pages'],
1396
+ 'pagination' => $bans['pagination'],
1397
+ 'date_format' => self::$date_format,
1398
+ 'time_format' => self::$time_format,
1399
+ )
1400
+ );
1401
  }
1402
  }
1403
  public function show_add_ban() {
1404
  if ( current_user_can( 'yop_poll_add' ) ) {
1405
  $polls = YOP_Poll_Polls::get_names();
1406
  $template = YOP_POLL_PATH . 'admin/views/bans/add.php';
1407
+ echo YOP_Poll_View::render(
1408
+ $template,
1409
+ array(
1410
+ 'polls' => $polls,
1411
+ )
1412
+ );
1413
  }
1414
  }
1415
  public function create_ban() {
1440
  if ( false !== $ban ) {
1441
  $polls = YOP_Poll_Polls::get_names();
1442
  $template = YOP_POLL_PATH . 'admin/views/bans/edit.php';
1443
+ echo YOP_Poll_View::render(
1444
+ $template,
1445
+ array(
1446
+ 'ban' => $ban['ban'],
1447
+ 'polls' => $polls,
1448
+ )
1449
+ );
1450
  } else {
1451
  esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
1452
  }
1570
  public function record_wordpress_vote() {
1571
  if ( isset( $_GET['poll_id'] ) && ( 0 < intval( $_GET['poll_id'] ) ) ) {
1572
  $template = YOP_POLL_PATH . 'admin/views/general/addnewwordpressvote.php';
1573
+ echo YOP_Poll_View::render(
1574
+ $template,
1575
+ array(
1576
+ 'poll_id' => sanitize_text_field( wp_unslash( $_GET['poll_id'] ) ),
1577
+ )
1578
+ );
1579
  } else {
1580
  echo 'no go';
1581
  }
1600
  }
1601
  $details_string .= '</div>';
1602
  }
1603
+ wp_send_json_success(
1604
+ array(
1605
+ 'details' => $details_string,
1606
+ )
1607
+ );
1608
  } else {
1609
  wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
1610
  }
1667
  }
1668
  }
1669
  if ( $success === intval( count( $votes_sanitized ) ) ) {
1670
+ wp_send_json_success(
1671
+ _n(
1672
  'Vote successfully deleted',
1673
  'Votes successfully deleted',
1674
  count( $votes_sanitized ),
1675
+ 'yop-poll'
1676
+ )
1677
  );
1678
  } else {
1679
+ wp_send_json_error(
1680
+ _n(
1681
  'Error deleting vote',
1682
  'Error deleting votes',
1683
  count( $votes_sanitized ),
1684
+ 'yop-poll'
1685
+ )
1686
  );
1687
  }
1688
  } else {
1740
  }
1741
  }
1742
  if ( $success === intval( count( $logs_sanitized ) ) ) {
1743
+ wp_send_json_success(
1744
+ _n(
1745
  'Log successfully deleted',
1746
  'Logs successfully deleted',
1747
  count( $logs_sanitized ),
1748
+ 'yop-poll'
1749
+ )
1750
  );
1751
  } else {
1752
+ wp_send_json_error(
1753
+ _n(
1754
  'Error deleting log',
1755
  'Error deleting logs',
1756
  count( $logs_sanitized ),
1757
+ 'yop-poll'
1758
+ )
1759
  );
1760
  }
1761
  } else {
1770
  if ( $yop_poll_settings ) {
1771
  $unserialized_settings = unserialize( $yop_poll_settings );
1772
  }
1773
+ echo YOP_Poll_View::render(
1774
+ $template,
1775
+ array( 'settings' => $unserialized_settings )
1776
+ );
1777
  }
1778
  }
1779
  public function save_settings() {
1843
  $request_string = array(
1844
  'body' => array(
1845
  'action' => 'send-guide',
1846
+ 'input' => $user_input,
1847
  ),
1848
+ 'user-agent' => 'WordPress/' . YOP_POLL_VERSION . ';',
1849
  );
1850
  $result = wp_remote_post( $url, $request_string );
1851
  if ( ! is_wp_error( $result ) && ( 200 === $result['response']['code'] ) ) {
1858
  }
1859
  public function show_upgrade_to_pro() {
1860
  $template = YOP_POLL_PATH . 'admin/views/general/upgrade-page.php';
1861
+ echo YOP_Poll_View::render(
1862
+ $template,
1863
+ array(
1864
+ 'link' => menu_page_url( 'yop-polls', false ),
1865
+ )
1866
+ );
1867
  }
1868
  public function send_deactivation_feedback() {
1869
  $_token = isset( $_POST['_token'] ) ? sanitize_text_field( wp_unslash( $_POST['_token'] ) ) : '';
1887
  }
1888
  $email_headers = array(
1889
  'From: Wordpress Deactivation Notice <deactivate@yop-poll.com>',
1890
+ 'Content-Type: text/plain',
1891
  );
1892
  $success = wp_mail( array( 'noreply@yop-poll.com' ), $subject, $message, $email_headers );
1893
  wp_die();
admin/assets/css/{admin-6.4.3.css → admin-6.4.4.css} RENAMED
File without changes
admin/assets/js/{admin-6.4.3.min.js → admin-6.4.4.min.js} RENAMED
File without changes
admin/inc/ClassYopPollImporter4x.php CHANGED
@@ -105,7 +105,7 @@ class ClassYopPollImporter4x {
105
  self::$checked_existence_polls = true;
106
  self::$polls_table_exists = true;
107
  }
108
- if ( !self::$checked_existence_polls ) {
109
  if ( self::check_if_table_exists( $polls_table_name ) && self::check_if_table_exists( $polls_meta_table_name ) ) {
110
  if ( ! self::check_if_column_exists( $polls_table_name, 'processed' ) ) {
111
  $wpdb->query( "ALTER TABLE `{$polls_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -115,24 +115,27 @@ class ClassYopPollImporter4x {
115
  }
116
  }
117
  if ( self::$checked_existence_polls && self::$polls_table_exists ) {
118
- self::$unprocessed_polls = $wpdb->get_var( "select count(id) from `{$polls_table_name}` where processed = false" );
119
- $polls = $wpdb->get_results( "select `id`, `name`, `question`, `poll_author`, `start_date`, `end_date`, `status`, `last_modified`,
120
- `total_votes`, `total_answers`, `date_added`, `meta_key`, `meta_value` from `{$polls_table_name}` left join
121
- `{$polls_meta_table_name}` on `{$polls_table_name}`.`id` = `{$polls_meta_table_name}`.`yop_poll_id` where `processed` = false limit {$query_limit}" );
 
 
 
122
 
123
  if ( count( $polls ) > 0 ) {
124
  $questionId = 1;
125
- $maxID = $wpdb->get_var( "select max(`id`) from `{$polls_table_name}`" );
126
  self::$maxElementID = $maxID + 1;
127
  foreach ( $polls as $poll ) {
128
  if ( '' !== $poll->meta_value && null !== $poll->meta_value ) {
129
  $unserialized_meta = unserialize( $poll->meta_value );
130
  } else {
131
- $unserialized_meta = [];
132
  }
133
 
134
  $poll_style = self::create_css_from_template( ( isset( $unserialized_meta['template'] ) && '' !== $unserialized_meta['template'] ) ? $unserialized_meta['template'] : 1 );
135
- $vote_perms = [];
136
  if ( isset( $unserialized_meta['vote_permisions_wordpress'] ) ) {
137
  $vote_perms[] = 'wordpress';
138
  }
@@ -325,28 +328,28 @@ class ClassYopPollImporter4x {
325
  'sortResults' => $sorting_results,
326
  'sortResultsRule' => isset( $unserialized_meta['sorting_results_direction'] ) ? $unserialized_meta['sorting_results_direction'] : 'asc',
327
  'displayResultsAs' => isset( $unserialized_meta['show_results_in'] ) ? $unserialized_meta['show_results_in'] : 'bar',
328
- 'resultsDetails' => $resultsDetails
329
  ]
330
  ]
331
  ];
332
  $pollElementsArray = [];
333
  $pollAnswers = $wpdb->get_results(
334
  $wpdb->prepare(
335
- "select * from `{$polls_answers_table_name}` left join `{$polls_answers_meta_table_name}` on
336
- `{$polls_answers_table_name}`.`id` = `{$polls_answers_meta_table_name}`.`yop_poll_answer_id` where `poll_id` = %s",
337
  $poll->id
338
- )
339
  );
340
  $pollCustoms = $wpdb->get_results(
341
  $wpdb->prepare(
342
- "select * from `{$polls_customs_table}` where `{$polls_customs_table}`.`poll_id` = %s",
343
  $poll->id
344
  )
345
  );
346
  $x = 1;
347
- $pollAnswersArray = [];
348
  foreach ( $pollAnswers as $pA ) {
349
- if ( '' !== $pA->meta_value && !is_null( $pA->meta_value ) ) {
350
  $unserialized_a_meta = unserialize( $pA->meta_value );
351
  } else {
352
  $unserialized_a_meta = [];
@@ -431,13 +434,13 @@ class ClassYopPollImporter4x {
431
  private static function import_bans( $skip_table_check = false ) {
432
  global $wpdb;
433
  $polls_bans_table = $GLOBALS['wpdb']->prefix . 'yop_poll_bans';
434
- $values = [];
435
  $current_user = wp_get_current_user();
436
  if ( $skip_table_check ) {
437
  self::$checked_existence_bans = true;
438
  self::$bans_table_exists = true;
439
  }
440
- if ( !self::$checked_existence_bans ) {
441
  if ( self::check_if_table_exists( $polls_bans_table ) ) {
442
  if ( ! self::check_if_column_exists( $polls_bans_table, 'processed' ) ) {
443
  $wpdb->query( "ALTER TABLE `{$polls_bans_table}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -448,13 +451,25 @@ class ClassYopPollImporter4x {
448
  }
449
 
450
  if ( self::$checked_existence_bans && self::$bans_table_exists ) {
451
- self::$unprocessed_bans = $wpdb->get_var( "select count(ID) from `{$polls_bans_table}` where `processed` = false" );
452
- $bans = $wpdb->get_results( "select * from `{$polls_bans_table}` LIMIT " . self::$ajax_limit );
453
- $bansIds = [];
 
 
 
 
 
454
  if ( count( $bans ) > 0 ) {
455
  foreach ( $bans as $ban ) {
456
- $values[] = $wpdb->prepare( '(%d, %d, %s, %s, %s)', $current_user->ID, $ban->poll_id, $ban->type, $ban->value, current_time( 'mysql' ) );
457
- $bansIds[] = $ban->id;
 
 
 
 
 
 
 
458
  }
459
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
460
  if ( count( $values ) > 0 ) {
@@ -462,22 +477,37 @@ class ClassYopPollImporter4x {
462
  $result = $wpdb->query( $query );
463
  if ( ! $result ) {
464
  $last_error = $wpdb->last_error;
465
- return [ 'response_code' => 1, 'message' => esc_html__( $last_error, 'yop-poll' ) ];
 
 
 
466
  } else {
467
- $res = $wpdb->query( "update {$polls_bans_table} set `processed` = true where `ID` in (" . implode( ',', $bansIds ) . ')' );
468
  self::$processed_bans += $res;
469
  if ( self::$processed_bans == self::$unprocessed_bans ) {
470
- return [ 'response_code' => - 1, 'message' => esc_html__( 'Processed ' . self::$processed_bans . ' out of ' . self::$unprocessed_bans . ' records on table bans.', 'yop-poll' ) ];
 
 
 
471
  } else {
472
- return [ 'response_code' => 1, 'message' => esc_html__( 'Processed ' . self::$processed_bans . ' out of ' . self::$unprocessed_bans . ' remaining records on table bans.', 'yop-poll' ) ];
 
 
 
473
  }
474
  }
475
  }
476
  } else {
477
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No bans to process.', 'yop-poll' ) ];
 
 
 
478
  }
479
  } else {
480
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No bans table, skipping.', 'yop-poll' ) ];
 
 
 
481
  }
482
  }
483
 
@@ -491,7 +521,7 @@ class ClassYopPollImporter4x {
491
  self::$checked_existence_logs = true;
492
  self::$logs_table_exists = true;
493
  }
494
- if ( !self::$checked_existence_logs ) {
495
  if ( self::check_if_table_exists( $polls_logs_table_name ) ) {
496
  if ( ! self::check_if_column_exists( $polls_logs_table_name, 'processed' ) ) {
497
  $wpdb->query( "ALTER TABLE `{$polls_logs_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -502,88 +532,118 @@ class ClassYopPollImporter4x {
502
  }
503
 
504
  if ( self::$checked_existence_logs && self::$logs_table_exists ) {
505
- self::$unprocessed_logs = $wpdb->get_var( "select count(distinct `vote_id`) from `{$polls_logs_table_name}` where `processed` = false" );
506
- $logs = $wpdb->get_results( "select distinct `vote_id` from `{$polls_logs_table_name}` where `processed` = false limit " . self::$ajax_limit );
 
 
 
 
 
507
  if ( count( $logs ) > 0 ) {
508
- $votesArray = [];
509
- $logsArray = [];
510
- $resultsIds = [];
511
  foreach ( $logs as $log ) {
512
  $rquery = "SELECT `{$polls_logs_table_name}`.`id`, `{$polls_logs_table_name}`.`poll_id`, `{$polls_logs_table_name}`.`vote_id`, `{$polls_logs_table_name}`.`answer_id`, `{$polls_logs_table_name}`.`ip`, `{$polls_logs_table_name}`.`user_id`, `{$polls_logs_table_name}`.`user_type`,`other_answer_value`, `{$polls_logs_table_name}`.`vote_date` FROM `{$polls_logs_table_name}` WHERE `{$polls_logs_table_name}`.`vote_id` = %s ";
513
- $results = $wpdb->get_results( $wpdb->prepare( $rquery, $log->vote_id ) );
 
 
 
 
 
514
  foreach ( $results as $result ) {
515
- $customs_query = "select * from `{$polls_results_customs_table_name}` where `vote_id` = %s";
516
- $customs = $wpdb->get_results( $wpdb->prepare( $customs_query, array( $result->vote_id ) ) );
 
 
 
 
 
 
 
517
  $countC = count( $customs );
518
- $voteData = ['elements' => [], 'user' => [] ];
519
- $logData = ['elements' => [], 'user' => [] ];
520
- $resultsIds[] = $result->id;
 
 
 
 
 
 
521
  $answerType = $wpdb->get_var(
522
  $wpdb->prepare(
523
- "SELECT `type` FROM `{$polls_answers_table_name}` where `id` = %s",
524
  $result->answer_id
525
  )
526
  );
527
- $a_data = [];
528
  if ( 'other' === $answerType ) {
529
- $a_data[] = [
530
  'id' => 0,
531
- 'data' => $result->other_answer_value
532
- ];
533
  } else {
534
- $a_data[] = [
535
  'id' => $result->answer_id,
536
- 'data' => true
537
- ];
538
  }
539
 
540
- $wpdb->query( $wpdb->prepare( "update `{$GLOBALS['wpdb']->yop_poll_subelements}` set `total_submits` = `total_submits` + 1 where `id` = %d", array( $result->answer_id ) ) );
 
 
 
 
 
 
 
541
  #get the question
542
  $question_id = $wpdb->get_var(
543
  $wpdb->prepare(
544
- "select `id` from `{$GLOBALS['wpdb']->yop_poll_elements}` where `poll_id` = %s and `etype` = 'text-question' limit 1",
545
  $result->poll_id
546
  )
547
  );
548
  $new_customs = $wpdb->get_results( "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `meta_data` LIKE '%old_id%'" );
549
- $voteData['elements'][] = [
550
  'id' => $question_id,
551
  'type' => 'question',
552
- 'data' => $a_data
553
- ];
554
- $logData['elements'][] = [
555
  'id' => $question_id,
556
  'type' => 'question',
557
- 'data' => $a_data
558
- ];
559
  if ( $countC > 0 ) {
560
  foreach ( $customs as $cust ) {
561
  $cID = null;
562
  foreach ( $new_customs as $nc ) {
563
  $udata = unserialize( $nc->meta_data );
564
- if ( (int) $udata['old_id'] == (int) $cust->custom_field_id ) {
565
  $cID = $nc->id;
566
  }
567
  }
568
- $voteData['elements'][] = [
569
  'id' => $cID,
570
  'type' => 'custom-field',
571
- 'data' => stripslashes( [$cust->custom_field_value] )
572
- ];
573
- $logData['elements'][] = [
574
  'id' => $cID,
575
  'type' => 'custom-field',
576
- 'data' => stripslashes( [$cust->custom_field_value] )
577
- ];
578
  }
579
  }
580
  //array_push( $voteData['elements'], $q_data );
581
  //array_push( $logData['elements'], $q_data );
582
 
583
- $voteData['user'] = [
584
  'first_name' => '',
585
- 'last_name' => ''
586
- ];
587
  $data = array(
588
  'poll_id' => $result->poll_id,
589
  'poll_author' => $current_user->ID,
@@ -596,9 +656,10 @@ class ClassYopPollImporter4x {
596
  'voter_fingerprint' => '',
597
  'vote_data' => serialize( $voteData ),
598
  'status' => 'active',
599
- 'added_date' => $result->vote_date
600
  );
601
- $votesArray[] = $wpdb->prepare( '(%d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
 
602
  $data['poll_id'],
603
  $data['user_id'],
604
  $data['user_email'],
@@ -612,11 +673,11 @@ class ClassYopPollImporter4x {
612
  $data['added_date']
613
  );
614
 
615
- $logData['user'] = [
616
  'first_name' => '',
617
- 'last_name' => ''
618
- ];
619
- $vote_message = ['Success'];
620
  $ldata = array(
621
  'poll_id' => $result->poll_id,
622
  'poll_author' => $current_user->ID,
@@ -629,9 +690,10 @@ class ClassYopPollImporter4x {
629
  'voter_fingerprint' => '',
630
  'vote_data' => serialize( $logData ),
631
  'vote_message' => serialize( $vote_message ),
632
- 'added_date' => $result->vote_date
633
  );
634
- $logsArray[] = $wpdb->prepare( '(%d, %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
 
635
  $ldata['poll_id'],
636
  $ldata['poll_author'],
637
  $ldata['user_id'],
@@ -656,34 +718,60 @@ class ClassYopPollImporter4x {
656
  $response = $wpdb->query( $query );
657
  $responseLog = $wpdb->query( $logs_query );
658
  if ( $response && $responseLog ) {
659
- $result = $wpdb->query( "update `{$polls_logs_table_name}` set `processed` = true where id in (" . implode( ',', $resultsIds ) . ')' );
660
  self::$processed_votes += $result;
661
  if ( self::$processed_votes == self::$unprocessed_logs ) {
662
- return [ 'response_code' => -1, 'message' => esc_html__( 'Processed ' . self::$processed_votes . ' out of ' . self::$unprocessed_logs . ' records on table votes.', 'yop-poll' ) ];
 
 
 
663
  } elseif ( self::$processed_votes > self::$unprocessed_logs ) {
664
- return [ 'response_code' => -1, 'message' => esc_html__( 'Processed ' . self::$unprocessed_logs . ' out of ' . self::$unprocessed_logs . ' records on table votes.', 'yop-poll' ) ];
 
 
 
665
  } else {
666
- return [ 'response_code' => 1, 'message' => esc_html__( 'Processed ' . self::$processed_votes . ' out of ' . self::$unprocessed_logs . ' remaining records on table votes.', 'yop-poll' ) ];
 
 
 
667
  }
668
  } else {
669
- return [ 'response_code' => 1, 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ) ];
 
 
 
670
  }
671
  } else {
672
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes to process.', 'yop-poll' ) ];
 
 
 
673
  }
674
  } else {
675
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes to process.', 'yop-poll' ) ];
 
 
 
676
  }
677
  } else {
678
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes table, skipping.', 'yop-poll' ) ];
 
 
 
679
  }
680
 
681
  }
682
 
683
  private static function check_if_table_exists( $table_name ) {
684
  global $wpdb;
685
- if ( 0 == $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(1) FROM `information_schema`.`tables` WHERE `table_schema` = %s AND `table_name` = %s',
686
- DB_NAME, $table_name ) ) ) {
 
 
 
 
 
687
  return false;
688
  }
689
  return true;
@@ -691,18 +779,22 @@ class ClassYopPollImporter4x {
691
 
692
  private static function check_if_column_exists( $table_name, $column_name ) {
693
  global $wpdb;
694
- if ( 0 == $wpdb->get_var( $wpdb->prepare(
695
- 'SELECT count(1) FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = %s AND `TABLE_NAME` = %s AND `COLUMN_NAME` = %s ',
696
- DB_NAME, $table_name, $column_name
697
- ) ) ) {
 
 
 
 
698
  return false;
699
  }
700
  return true;
701
  }
702
 
703
  private static function create_css_from_template( $template_id ) {
704
- $css_array = [
705
- 'poll' => [
706
  'backgroundColor' => '#fff',
707
  'borderSize' => 0,
708
  'borderColor' => '#fff',
@@ -710,17 +802,17 @@ class ClassYopPollImporter4x {
710
  'padding' => 10,
711
  'textColor' => '#555',
712
  'inputElementsBorderColor' => '#000',
713
- ],
714
- 'questions' => [
715
  'backgroundColor' => '#fff',
716
  'borderSize' => 0,
717
  'borderColor' => '#fff',
718
  'borderRadius' => 0,
719
  'padding' => 4,
720
  'textColor' => '#000',
721
- 'textSize' => 'small'
722
- ],
723
- 'answers' => [
724
  'backgroundColor' => '#fff',
725
  'borderSize' => 0,
726
  'borderColor' => '#fff',
@@ -729,9 +821,9 @@ class ClassYopPollImporter4x {
729
  'textColor' => '#000',
730
  'textSize' => 'small',
731
  'skin' => 'minimal',
732
- 'colorScheme' => 'black'
733
- ],
734
- 'buttons' => [
735
  'backgroundColor' => '#222',
736
  'borderSize' => 0,
737
  'borderColor' => '#222',
@@ -739,18 +831,18 @@ class ClassYopPollImporter4x {
739
  'padding' => 0,
740
  'textColor' => '#fff',
741
  'textSize' => 'small'
742
- ],
743
- 'captcha' => [],
744
- 'errors' => [
745
  'backgroundColor' => '#fff',
746
  'borderSize' => 0,
747
  'borderColor' => '#fff',
748
  'borderRadius' => 0,
749
  'padding' => 0,
750
  'textColor' => '#FF0000',
751
- 'textSize' => 'small'
752
- ]
753
- ];
754
  return $css_array;
755
  }
756
 
@@ -771,11 +863,25 @@ class ClassYopPollImporter4x {
771
  if ( -1 == $response['response_code'] ) {
772
  $table = 'bans';
773
  $response_code = 1;
774
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
775
  } else {
776
  $table = 'polls';
777
  $response_code = $response['response_code'];
778
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
779
  }
780
  break;
781
  }
@@ -784,11 +890,25 @@ class ClassYopPollImporter4x {
784
  if ( -1 == $response['response_code'] ) {
785
  $table = 'votes';
786
  $response_code = 1;
787
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
788
  } else {
789
  $table = 'bans';
790
  $response_code = $response['response_code'];
791
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
792
  }
793
  break;
794
  }
@@ -798,11 +918,25 @@ class ClassYopPollImporter4x {
798
  $table = 'votes';
799
  $response_code = 'done';
800
  delete_option( 'yop_poll_old_version' );
801
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
802
  } else {
803
  $table = 'votes';
804
  $response_code = $response['response_code'];
805
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
806
  }
807
  break;
808
  }
@@ -810,7 +944,9 @@ class ClassYopPollImporter4x {
810
  }
811
  wp_die();
812
  } else {
813
- wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
 
 
814
  wp_die();
815
  }
816
  }
105
  self::$checked_existence_polls = true;
106
  self::$polls_table_exists = true;
107
  }
108
+ if ( ! self::$checked_existence_polls ) {
109
  if ( self::check_if_table_exists( $polls_table_name ) && self::check_if_table_exists( $polls_meta_table_name ) ) {
110
  if ( ! self::check_if_column_exists( $polls_table_name, 'processed' ) ) {
111
  $wpdb->query( "ALTER TABLE `{$polls_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
115
  }
116
  }
117
  if ( self::$checked_existence_polls && self::$polls_table_exists ) {
118
+ self::$unprocessed_polls = $wpdb->get_var( "SELECT COUNT(id) FROM `{$polls_table_name}` WHERE processed = false" );
119
+ $polls_query = "SELECT `id`, `name`, `question`, `poll_author`, `start_date`, `end_date`, `status`, `last_modified`, `total_votes`, `total_answers`, `date_added`, `meta_key`, `meta_value` FROM `{$polls_table_name}` LEFT JOIN `{$polls_meta_table_name}` ON `{$polls_table_name}`.`id` = `{$polls_meta_table_name}`.`yop_poll_id` WHERE `processed` = false LIMIT %d";
120
+ $polls_query_ready = $GLOBALS['wpdb']->prepare(
121
+ $polls_query,
122
+ $query_limit
123
+ );
124
+ $polls = $wpdb->get_results( $polls_query_ready );
125
 
126
  if ( count( $polls ) > 0 ) {
127
  $questionId = 1;
128
+ $maxID = $wpdb->get_var( "SELECT MAX(`id`) FROM `{$polls_table_name}`" );
129
  self::$maxElementID = $maxID + 1;
130
  foreach ( $polls as $poll ) {
131
  if ( '' !== $poll->meta_value && null !== $poll->meta_value ) {
132
  $unserialized_meta = unserialize( $poll->meta_value );
133
  } else {
134
+ $unserialized_meta = array();
135
  }
136
 
137
  $poll_style = self::create_css_from_template( ( isset( $unserialized_meta['template'] ) && '' !== $unserialized_meta['template'] ) ? $unserialized_meta['template'] : 1 );
138
+ $vote_perms = array();
139
  if ( isset( $unserialized_meta['vote_permisions_wordpress'] ) ) {
140
  $vote_perms[] = 'wordpress';
141
  }
328
  'sortResults' => $sorting_results,
329
  'sortResultsRule' => isset( $unserialized_meta['sorting_results_direction'] ) ? $unserialized_meta['sorting_results_direction'] : 'asc',
330
  'displayResultsAs' => isset( $unserialized_meta['show_results_in'] ) ? $unserialized_meta['show_results_in'] : 'bar',
331
+ 'resultsDetails' => $resultsDetails,
332
  ]
333
  ]
334
  ];
335
  $pollElementsArray = [];
336
  $pollAnswers = $wpdb->get_results(
337
  $wpdb->prepare(
338
+ "SELECT * FROM `{$polls_answers_table_name}` LEFT JOIN `{$polls_answers_meta_table_name}` ON
339
+ `{$polls_answers_table_name}`.`id` = `{$polls_answers_meta_table_name}`.`yop_poll_answer_id` WHERE `poll_id` = %s",
340
  $poll->id
341
+ )
342
  );
343
  $pollCustoms = $wpdb->get_results(
344
  $wpdb->prepare(
345
+ "SELECT * FROM `{$polls_customs_table}` WHERE `{$polls_customs_table}`.`poll_id` = %s",
346
  $poll->id
347
  )
348
  );
349
  $x = 1;
350
+ $pollAnswersArray = array();
351
  foreach ( $pollAnswers as $pA ) {
352
+ if ( '' !== $pA->meta_value && ! is_null( $pA->meta_value ) ) {
353
  $unserialized_a_meta = unserialize( $pA->meta_value );
354
  } else {
355
  $unserialized_a_meta = [];
434
  private static function import_bans( $skip_table_check = false ) {
435
  global $wpdb;
436
  $polls_bans_table = $GLOBALS['wpdb']->prefix . 'yop_poll_bans';
437
+ $values = array();
438
  $current_user = wp_get_current_user();
439
  if ( $skip_table_check ) {
440
  self::$checked_existence_bans = true;
441
  self::$bans_table_exists = true;
442
  }
443
+ if ( ! self::$checked_existence_bans ) {
444
  if ( self::check_if_table_exists( $polls_bans_table ) ) {
445
  if ( ! self::check_if_column_exists( $polls_bans_table, 'processed' ) ) {
446
  $wpdb->query( "ALTER TABLE `{$polls_bans_table}` ADD processed BOOLEAN DEFAULT FALSE " );
451
  }
452
 
453
  if ( self::$checked_existence_bans && self::$bans_table_exists ) {
454
+ self::$unprocessed_bans = $wpdb->get_var( "SELECT COUNT(ID) FROM `{$polls_bans_table}` WHERE `processed` = false" );
455
+ $bans = $wpdb->get_results(
456
+ $wpdb->prepare(
457
+ 'SELECT * FROM `{$polls_bans_table}` LIMIT %d',
458
+ self::$ajax_limit
459
+ )
460
+ );
461
+ $bansIds = array();
462
  if ( count( $bans ) > 0 ) {
463
  foreach ( $bans as $ban ) {
464
+ $values[] = $wpdb->prepare(
465
+ '(%d, %d, %s, %s, %s)',
466
+ $current_user->ID,
467
+ $ban->poll_id,
468
+ $ban->type,
469
+ $ban->value,
470
+ current_time( 'mysql' )
471
+ );
472
+ $bansIds[] = $wpdb->prepare( '%s', $ban->id );
473
  }
474
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
475
  if ( count( $values ) > 0 ) {
477
  $result = $wpdb->query( $query );
478
  if ( ! $result ) {
479
  $last_error = $wpdb->last_error;
480
+ return array(
481
+ 'response_code' => 1,
482
+ 'message' => esc_html__( $last_error, 'yop-poll' ),
483
+ );
484
  } else {
485
+ $res = $wpdb->query( "UPDATE {$polls_bans_table} SET `processed` = true WHERE `ID` IN (" . implode( ',', $bansIds ) . ')' );
486
  self::$processed_bans += $res;
487
  if ( self::$processed_bans == self::$unprocessed_bans ) {
488
+ return array(
489
+ 'response_code' => - 1,
490
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_bans . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_bans . esc_html__( ' records on table bans.', 'yop-poll' ),
491
+ );
492
  } else {
493
+ return array(
494
+ 'response_code' => 1,
495
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_bans . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_bans . esc_html__( ' remaining records on table bans.', 'yop-poll' ),
496
+ );
497
  }
498
  }
499
  }
500
  } else {
501
+ return array(
502
+ 'response_code' => - 1,
503
+ 'message' => esc_html__( 'No bans to process.', 'yop-poll' ),
504
+ );
505
  }
506
  } else {
507
+ return array(
508
+ 'response_code' => - 1,
509
+ 'message' => esc_html__( 'No bans table, skipping.', 'yop-poll' ),
510
+ );
511
  }
512
  }
513
 
521
  self::$checked_existence_logs = true;
522
  self::$logs_table_exists = true;
523
  }
524
+ if ( ! self::$checked_existence_logs ) {
525
  if ( self::check_if_table_exists( $polls_logs_table_name ) ) {
526
  if ( ! self::check_if_column_exists( $polls_logs_table_name, 'processed' ) ) {
527
  $wpdb->query( "ALTER TABLE `{$polls_logs_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
532
  }
533
 
534
  if ( self::$checked_existence_logs && self::$logs_table_exists ) {
535
+ self::$unprocessed_logs = $wpdb->get_var( "SELECT COUNT(distinct `vote_id`) FROM `{$polls_logs_table_name}` WHERE `processed` = false" );
536
+ $logs = $wpdb->get_results(
537
+ $wpdb->prepare(
538
+ "SELECT DISTINCT `vote_id` FROM `{$polls_logs_table_name}` WHERE `processed` = false LIMIT %d",
539
+ self::$ajax_limit
540
+ )
541
+ );
542
  if ( count( $logs ) > 0 ) {
543
+ $votesArray = array();
544
+ $logsArray = array();
545
+ $resultsIds = array();
546
  foreach ( $logs as $log ) {
547
  $rquery = "SELECT `{$polls_logs_table_name}`.`id`, `{$polls_logs_table_name}`.`poll_id`, `{$polls_logs_table_name}`.`vote_id`, `{$polls_logs_table_name}`.`answer_id`, `{$polls_logs_table_name}`.`ip`, `{$polls_logs_table_name}`.`user_id`, `{$polls_logs_table_name}`.`user_type`,`other_answer_value`, `{$polls_logs_table_name}`.`vote_date` FROM `{$polls_logs_table_name}` WHERE `{$polls_logs_table_name}`.`vote_id` = %s ";
548
+ $results = $wpdb->get_results(
549
+ $wpdb->prepare(
550
+ $rquery,
551
+ $log->vote_id
552
+ )
553
+ );
554
  foreach ( $results as $result ) {
555
+ $customs_query = "SELECT * FROM `{$polls_results_customs_table_name}` WHERE `vote_id` = %s";
556
+ $customs = $wpdb->get_results(
557
+ $wpdb->prepare(
558
+ $customs_query,
559
+ array(
560
+ $result->vote_id,
561
+ )
562
+ )
563
+ );
564
  $countC = count( $customs );
565
+ $voteData = array(
566
+ 'elements' => array(),
567
+ 'user' => array(),
568
+ );
569
+ $logData = array(
570
+ 'elements' => array(),
571
+ 'user' => array(),
572
+ );
573
+ $resultsIds[] = $wpdb->prepare( '%s', $result->id );
574
  $answerType = $wpdb->get_var(
575
  $wpdb->prepare(
576
+ "SELECT `type` FROM `{$polls_answers_table_name}` WHERE `id` = %s",
577
  $result->answer_id
578
  )
579
  );
580
+ $a_data = array();
581
  if ( 'other' === $answerType ) {
582
+ $a_data[] = array(
583
  'id' => 0,
584
+ 'data' => $result->other_answer_value,
585
+ );
586
  } else {
587
+ $a_data[] = array(
588
  'id' => $result->answer_id,
589
+ 'data' => true,
590
+ );
591
  }
592
 
593
+ $wpdb->query(
594
+ $wpdb->prepare(
595
+ "UPDATE `{$GLOBALS['wpdb']->yop_poll_subelements}` SET `total_submits` = `total_submits` + 1 WHERE `id` = %d",
596
+ array(
597
+ $result->answer_id,
598
+ )
599
+ )
600
+ );
601
  #get the question
602
  $question_id = $wpdb->get_var(
603
  $wpdb->prepare(
604
+ "SELECT `id` FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `poll_id` = %s AND `etype` = 'text-question' LIMIT 1",
605
  $result->poll_id
606
  )
607
  );
608
  $new_customs = $wpdb->get_results( "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `meta_data` LIKE '%old_id%'" );
609
+ $voteData['elements'][] = array(
610
  'id' => $question_id,
611
  'type' => 'question',
612
+ 'data' => $a_data,
613
+ );
614
+ $logData['elements'][] = array(
615
  'id' => $question_id,
616
  'type' => 'question',
617
+ 'data' => $a_data,
618
+ );
619
  if ( $countC > 0 ) {
620
  foreach ( $customs as $cust ) {
621
  $cID = null;
622
  foreach ( $new_customs as $nc ) {
623
  $udata = unserialize( $nc->meta_data );
624
+ if ( (int) $udata['old_id'] === (int) $cust->custom_field_id ) {
625
  $cID = $nc->id;
626
  }
627
  }
628
+ $voteData['elements'][] = array(
629
  'id' => $cID,
630
  'type' => 'custom-field',
631
+ 'data' => stripslashes( [ $cust->custom_field_value ] ),
632
+ );
633
+ $logData['elements'][] = array(
634
  'id' => $cID,
635
  'type' => 'custom-field',
636
+ 'data' => stripslashes( [ $cust->custom_field_value ] ),
637
+ );
638
  }
639
  }
640
  //array_push( $voteData['elements'], $q_data );
641
  //array_push( $logData['elements'], $q_data );
642
 
643
+ $voteData['user'] = array(
644
  'first_name' => '',
645
+ 'last_name' => '',
646
+ );
647
  $data = array(
648
  'poll_id' => $result->poll_id,
649
  'poll_author' => $current_user->ID,
656
  'voter_fingerprint' => '',
657
  'vote_data' => serialize( $voteData ),
658
  'status' => 'active',
659
+ 'added_date' => $result->vote_date,
660
  );
661
+ $votesArray[] = $wpdb->prepare(
662
+ '(%d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
663
  $data['poll_id'],
664
  $data['user_id'],
665
  $data['user_email'],
673
  $data['added_date']
674
  );
675
 
676
+ $logData['user'] = array(
677
  'first_name' => '',
678
+ 'last_name' => '',
679
+ );
680
+ $vote_message = [ 'Success' ];
681
  $ldata = array(
682
  'poll_id' => $result->poll_id,
683
  'poll_author' => $current_user->ID,
690
  'voter_fingerprint' => '',
691
  'vote_data' => serialize( $logData ),
692
  'vote_message' => serialize( $vote_message ),
693
+ 'added_date' => $result->vote_date,
694
  );
695
+ $logsArray[] = $wpdb->prepare(
696
+ '(%d, %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
697
  $ldata['poll_id'],
698
  $ldata['poll_author'],
699
  $ldata['user_id'],
718
  $response = $wpdb->query( $query );
719
  $responseLog = $wpdb->query( $logs_query );
720
  if ( $response && $responseLog ) {
721
+ $result = $wpdb->query( "UPDATE `{$polls_logs_table_name}` SET `processed` = true WHERE id IN (" . implode( ',', $resultsIds ) . ')' );
722
  self::$processed_votes += $result;
723
  if ( self::$processed_votes == self::$unprocessed_logs ) {
724
+ return array(
725
+ 'response_code' => -1,
726
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_votes . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' records on table votes.', 'yop-poll' ),
727
+ );
728
  } elseif ( self::$processed_votes > self::$unprocessed_logs ) {
729
+ return array(
730
+ 'response_code' => -1,
731
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' records on table votes.', 'yop-poll' ),
732
+ );
733
  } else {
734
+ return array(
735
+ 'response_code' => 1,
736
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_votes . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' remaining records on table votes.', 'yop-poll' ),
737
+ );
738
  }
739
  } else {
740
+ return array(
741
+ 'response_code' => 1,
742
+ 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ),
743
+ );
744
  }
745
  } else {
746
+ return array(
747
+ 'response_code' => - 1,
748
+ 'message' => esc_html__( 'No votes to process.', 'yop-poll' ),
749
+ );
750
  }
751
  } else {
752
+ return array(
753
+ 'response_code' => - 1,
754
+ 'message' => esc_html__( 'No votes to process.', 'yop-poll' ),
755
+ );
756
  }
757
  } else {
758
+ return array(
759
+ 'response_code' => - 1,
760
+ 'message' => esc_html__( 'No votes table, skipping.', 'yop-poll' ),
761
+ );
762
  }
763
 
764
  }
765
 
766
  private static function check_if_table_exists( $table_name ) {
767
  global $wpdb;
768
+ if ( 0 == $wpdb->get_var(
769
+ $wpdb->prepare(
770
+ 'SELECT COUNT(1) FROM `information_schema`.`tables` WHERE `table_schema` = %s AND `table_name` = %s',
771
+ DB_NAME,
772
+ $table_name
773
+ )
774
+ ) ) {
775
  return false;
776
  }
777
  return true;
779
 
780
  private static function check_if_column_exists( $table_name, $column_name ) {
781
  global $wpdb;
782
+ if ( 0 == $wpdb->get_var(
783
+ $wpdb->prepare(
784
+ 'SELECT COUNT(1) FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = %s AND `TABLE_NAME` = %s AND `COLUMN_NAME` = %s ',
785
+ DB_NAME,
786
+ $table_name,
787
+ $column_name
788
+ )
789
+ ) ) {
790
  return false;
791
  }
792
  return true;
793
  }
794
 
795
  private static function create_css_from_template( $template_id ) {
796
+ $css_array = array(
797
+ 'poll' => array(
798
  'backgroundColor' => '#fff',
799
  'borderSize' => 0,
800
  'borderColor' => '#fff',
802
  'padding' => 10,
803
  'textColor' => '#555',
804
  'inputElementsBorderColor' => '#000',
805
+ ),
806
+ 'questions' => array(
807
  'backgroundColor' => '#fff',
808
  'borderSize' => 0,
809
  'borderColor' => '#fff',
810
  'borderRadius' => 0,
811
  'padding' => 4,
812
  'textColor' => '#000',
813
+ 'textSize' => 'small',
814
+ ),
815
+ 'answers' => array(
816
  'backgroundColor' => '#fff',
817
  'borderSize' => 0,
818
  'borderColor' => '#fff',
821
  'textColor' => '#000',
822
  'textSize' => 'small',
823
  'skin' => 'minimal',
824
+ 'colorScheme' => 'black',
825
+ ),
826
+ 'buttons' => array(
827
  'backgroundColor' => '#222',
828
  'borderSize' => 0,
829
  'borderColor' => '#222',
831
  'padding' => 0,
832
  'textColor' => '#fff',
833
  'textSize' => 'small'
834
+ ),
835
+ 'captcha' => array(),
836
+ 'errors' => array(
837
  'backgroundColor' => '#fff',
838
  'borderSize' => 0,
839
  'borderColor' => '#fff',
840
  'borderRadius' => 0,
841
  'padding' => 0,
842
  'textColor' => '#FF0000',
843
+ 'textSize' => 'small',
844
+ ),
845
+ );
846
  return $css_array;
847
  }
848
 
863
  if ( -1 == $response['response_code'] ) {
864
  $table = 'bans';
865
  $response_code = 1;
866
+ wp_send_json_success(
867
+ array(
868
+ 'table' => $table,
869
+ 'response_code' => $response_code,
870
+ 'message' => $response['message'],
871
+ 'skip_table_check' => false,
872
+ )
873
+ );
874
  } else {
875
  $table = 'polls';
876
  $response_code = $response['response_code'];
877
+ wp_send_json_success(
878
+ array(
879
+ 'table' => $table,
880
+ 'response_code' => $response_code,
881
+ 'message' => $response['message'],
882
+ 'skip_table_check' => true,
883
+ )
884
+ );
885
  }
886
  break;
887
  }
890
  if ( -1 == $response['response_code'] ) {
891
  $table = 'votes';
892
  $response_code = 1;
893
+ wp_send_json_success(
894
+ array(
895
+ 'table' => $table,
896
+ 'response_code' => $response_code,
897
+ 'message' => $response['message'],
898
+ 'skip_table_check' => false,
899
+ )
900
+ );
901
  } else {
902
  $table = 'bans';
903
  $response_code = $response['response_code'];
904
+ wp_send_json_success(
905
+ array(
906
+ 'table' => $table,
907
+ 'response_code' => $response_code,
908
+ 'message' => $response['message'],
909
+ 'skip_table_check' => true,
910
+ )
911
+ );
912
  }
913
  break;
914
  }
918
  $table = 'votes';
919
  $response_code = 'done';
920
  delete_option( 'yop_poll_old_version' );
921
+ wp_send_json_success(
922
+ array(
923
+ 'table' => $table,
924
+ 'response_code' => $response_code,
925
+ 'message' => $response['message'],
926
+ 'skip_table_check' => false,
927
+ )
928
+ );
929
  } else {
930
  $table = 'votes';
931
  $response_code = $response['response_code'];
932
+ wp_send_json_success(
933
+ array(
934
+ 'table' => $table,
935
+ 'response_code' => $response_code,
936
+ 'message' => $response['message'],
937
+ 'skip_table_check' => true,
938
+ )
939
+ );
940
  }
941
  break;
942
  }
944
  }
945
  wp_die();
946
  } else {
947
+ wp_send_json_error(
948
+ esc_html__( 'You are not allowed to perform this action', 'yop-poll' )
949
+ );
950
  wp_die();
951
  }
952
  }
admin/inc/ClassYopPollImporter5x.php CHANGED
@@ -46,7 +46,7 @@ class ClassYopPollImporter5x {
46
  self::$checked_existence_polls = true;
47
  self::$polls_table_exists = true;
48
  }
49
- if ( !self::$checked_existence_polls ) {
50
  if ( self::check_if_table_exists( $polls_table_name ) && self::check_if_table_exists( $polls_meta_table_name ) ) {
51
  if ( ! self::check_if_column_exists( $polls_table_name, 'processed' ) ) {
52
  $wpdb->query( "ALTER TABLE `{$polls_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -57,19 +57,23 @@ class ClassYopPollImporter5x {
57
  }
58
  if ( self::$checked_existence_polls && self::$polls_table_exists ) {
59
  self::$unprocessed_polls = $wpdb->get_var( "SELECT count(ID) FROM `{$polls_table_name}` WHERE `poll_title` != '' AND processed = false" );
60
- $polls = $wpdb->get_results( "SELECT `ID`, `poll_title`, `poll_name`, `poll_author`, `poll_date`, `poll_status`, `poll_modified`, `poll_type`, `poll_start_date`, `poll_end_date`, `poll_total_votes`, `meta_key`, `meta_value` FROM `{$polls_table_name}` INNER JOIN
61
- `{$polls_meta_table_name}` ON `{$polls_table_name}`.`ID` = `{$polls_meta_table_name}`.`yop_poll_id` WHERE `poll_title` != '' AND `processed` = false limit {$query_limit}" );
 
 
 
 
62
  if ( count( $polls ) > 0 ) {
63
  if ( self::check_if_table_exists( $polls_questions_table_name ) &&
64
- self::check_if_table_exists( $polls_questions_meta_table_name ) ) {
65
- $maxID = $wpdb->get_var( "select max(`ID`) from `{$polls_questions_table_name}`" );
66
  self::$maxElementID = $maxID + 1;
67
  }
68
  foreach ( $polls as $poll ) {
69
  $unserialized_meta = unserialize( $poll->meta_value );
70
  $poll_style = self::create_css_from_template( '' !== $unserialized_meta['template'] ? $unserialized_meta['template'] : 1 );
71
  $skin_base = self::create_skin_base_from_template( '' !== $unserialized_meta['template'] ? $unserialized_meta['template'] : 1 );
72
- $vote_perms = [];
73
  if ( isset( $unserialized_meta['vote_permisions'] ) ) {
74
  foreach ( $unserialized_meta['vote_permisions'] as $vp ) {
75
  if ( 'registered' === $vp ) {
@@ -82,7 +86,7 @@ class ClassYopPollImporter5x {
82
  if ( 0 == count( $vote_perms ) ) {
83
  $vote_perms[] = 'wordpress';
84
  }
85
- $results_moment = [];
86
  if ( isset( $unserialized_meta['view_results'] ) && is_array( $unserialized_meta['view_results'] ) ) {
87
  foreach ( $unserialized_meta['view_results'] as $vr ) {
88
  if ( 'after' === $vr ) {
@@ -99,7 +103,7 @@ class ClassYopPollImporter5x {
99
  if ( 0 == count( $results_moment ) ) {
100
  $results_moment[] = 'after-vote';
101
  }
102
- $show_results_to = [];
103
  if ( isset( $unserialized_meta['view_results_permissions'] ) && is_array( $unserialized_meta['view_results_permissions'] ) ) {
104
  foreach ( $unserialized_meta['view_results_permissions'] as $vrp ) {
105
  if ( 'registered' === $vrp ) {
@@ -123,7 +127,7 @@ class ClassYopPollImporter5x {
123
  $sorting_results = $unserialized_meta['sorting_results'];
124
  }
125
  }
126
- $newBlVoters = [];
127
  if ( isset( $unserialized_meta['blocking_voters'] ) && is_array( $unserialized_meta['blocking_voters'] ) ) {
128
  foreach ( $unserialized_meta['blocking_voters'] as $bv ) {
129
  $blocking_voters = 'no-block';
@@ -202,7 +206,7 @@ class ClassYopPollImporter5x {
202
  $poll_end_date = '';
203
  }
204
  $adminUser = wp_get_current_user();
205
- $pollArray = [
206
  'ID' => $poll->ID,
207
  'name' => $poll->poll_title,
208
  'poll_author' => $poll->poll_author,
@@ -212,14 +216,14 @@ class ClassYopPollImporter5x {
212
  'total_submited_answers' => $poll->poll_total_votes,
213
  'added_date' => $poll->poll_date,
214
  'modified_date' => $poll->poll_modified,
215
- 'design' => [
216
  'template' => 1,
217
  'templateBase' => $template_base,
218
  'skinBase' => $skin_base,
219
- 'style' => $poll_style
220
- ],
221
- 'options' => [
222
- 'poll' => [
223
  'voteButtonLabel' => isset( $unserialized_meta['vote_button_label'] ) && '' != $unserialized_meta['vote_button_label'] ? $unserialized_meta['vote_button_label'] : 'Vote',
224
  'showResultsLink' => 'no',
225
  'resultsLabelText' => 'Results',
@@ -229,7 +233,7 @@ class ClassYopPollImporter5x {
229
  'startDateCustom' => $poll->poll_start_date,
230
  'endDateOption' => $poll_end_date_option,
231
  'endDateCustom' => $poll_end_date,
232
- 'showEndDateOnFrontend' => 'no',
233
  'showEndDateOnFrontendLocation' => 'top',
234
  'showEndDateOnFrontendText' => '',
235
  'redirectAfterVote' => isset( $unserialized_meta['redirect_after_vote'] ) && '' != $unserialized_meta['redirect_after_vote'] ? $unserialized_meta['redirect_after_vote'] : 'no',
@@ -256,19 +260,19 @@ class ClassYopPollImporter5x {
256
  'gdprSolution' => 'consent',
257
  'gdprConsentText' => '',
258
  'loadWithAjax' => 'no',
259
- 'notificationMessageLocation' => 'top'
260
- ],
261
- 'access' => [
262
  'votePermissions' => $vote_perms,
263
  'blockVoters' => $newBlVoters,
264
- 'blockLengthType' => 'limited-time',
265
  'blockForValue' => isset( $unserialized_meta['blocking_voters_interval_value'] ) ? $unserialized_meta['blocking_voters_interval_value'] : '',
266
  'blockForPeriod' => isset( $unserialized_meta['blocking_voters_interval_unit'] ) ? $unserialized_meta['blocking_voters_interval_unit'] : 'minutes',
267
  'limitVotesPerUser' =>
268
  isset( $unserialized_meta['limit_number_of_votes_per_user'] ) && '' != $unserialized_meta['limit_number_of_votes_per_user'] ? $unserialized_meta['limit_number_of_votes_per_user'] : 'no',
269
- 'votesPerUserAllowed' => isset( $unserialized_meta['number_of_votes_per_user'] ) && '' != $unserialized_meta['number_of_votes_per_user'] ? $unserialized_meta['number_of_votes_per_user'] : 3
270
- ],
271
- 'results' => [
272
  'showResultsMoment' => $results_moment,
273
  'customDateResults' => isset( $unserialized_meta['view_results_start_date'] ) ? $unserialized_meta['view_results_start_date'] : '',
274
  'showResultsTo' => $show_results_to,
@@ -277,92 +281,92 @@ class ClassYopPollImporter5x {
277
  'sortResults' => $sorting_results,
278
  'sortResultsRule' => isset( $unserialized_meta['sorting_results_direction'] ) && '' != $unserialized_meta['sorting_results_direction'] ? $unserialized_meta['sorting_results_direction'] : 'asc',
279
  'displayResultsAs' => $displayResultsAs,
280
- 'resultsDetails' => $resultsDetails
281
- ]
282
- ]
283
- ];
284
- $pollElementsArray = [];
285
  if ( self::check_if_table_exists( $polls_questions_table_name ) && self::check_if_table_exists( $polls_questions_meta_table_name ) ) {
286
- $pollQuestions = $wpdb->get_results(
287
  $wpdb->prepare(
288
- "select * from `{$polls_questions_table_name}` inner join `{$polls_questions_meta_table_name}` on
289
- `{$polls_questions_table_name}`.`ID` = `$polls_questions_meta_table_name`.`yop_poll_question_id` where `poll_id` = %s",
290
  $poll->ID
291
  )
292
  );
293
  foreach ( $pollQuestions as $pQ ) {
294
- $qArr = [];
295
  $unserialized_q_meta = unserialize( $pQ->meta_value );
296
  $pollQuestionAnswers = $wpdb->get_results(
297
  $wpdb->prepare(
298
- "select * from `{$polls_answers_table_name}` inner join `{$polls_answers_meta_table_name}` on `{$polls_answers_table_name}`.`ID` = `{$polls_answers_meta_table_name}`.`yop_poll_answer_id` where `poll_id` = %s and `question_id` = %s",
299
  $poll->ID,
300
  $pQ->ID
301
  )
302
  );
303
  $pollQuestionCustoms = $wpdb->get_results(
304
  $wpdb->prepare(
305
- "select `custom_field`, `required` from `{$polls_questions_table_name}` inner join `{$polls_questions_customs_table}` on `{$polls_questions_table_name}`.`ID` = `{$polls_questions_customs_table}`.`question_id` where `{$polls_questions_table_name}`.`poll_id` = %s and `question_id` = %s",
306
  $poll->ID,
307
  $pQ->ID
308
  )
309
  );
310
  $x = 0;
311
- $pollQuestionAnswersArray = [];
312
  switch ( $pQ->type ) {
313
  case 'text': {
314
  foreach ( $pollQuestionAnswers as $pQA ) {
315
  $unserialized_a_meta = unserialize( $pQA->meta_value );
316
  switch ( $pQA->type ) {
317
  case 'text': {
318
- $pQAA = [
319
  'ID' => $pQA->ID,
320
  'question_order' => $pQA->question_order,
321
  'type' => 'text',
322
  'text' => stripslashes( $pQA->answer ),
323
- 'options' => [
324
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
325
  'makeLink' => 'no',
326
  'link' => '',
327
- 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : ''
328
- ]
329
- ];
330
  break;
331
  }
332
  case 'other': {
333
- $pQAA = [
334
  'ID' => $pQA->ID,
335
  'question_order' => $pQA->question_order,
336
  'type' => 'text',
337
  'text' => stripslashes( $pQA->answer ),
338
  'is_other' => true,
339
- 'options' => [
340
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
341
  'makeLink' => 'no',
342
  'link' => '',
343
- 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : ''
344
- ]
345
- ];
346
  break;
347
  }
348
  case 'image': {
349
- $pQAA = [
350
  'ID' => $pQA->ID,
351
  'question_order' => $pQA->question_order,
352
  'type' => 'image',
353
  'text' => stripslashes( $pQA->answer ),
354
- 'options' => [
355
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
356
  'makeLink' => 'no',
357
  'addText' => 'no',
358
  'text' => '',
359
- 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '#000'
360
- ]
361
- ];
362
  break;
363
  }
364
  }
365
- $pollQuestionAnswersArray[$x] = $pQAA;
366
  $x ++;
367
  }
368
  if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
@@ -376,13 +380,13 @@ class ClassYopPollImporter5x {
376
  } else {
377
  $answersDisplay = 'vertical';
378
  }
379
- $pollElementsArray[] = [
380
  'ID' => $pQ->ID,
381
  'type' => 'text-question',
382
  'text' => stripslashes( $pQ->question ),
383
  'poll_order' => $pQ->poll_order,
384
  'answers' => $pollQuestionAnswersArray,
385
- 'options' => [
386
  'allowOtherAnswers' => isset( $unserialized_q_meta['allow_other_answers'] ) && '' != $unserialized_q_meta['allow_other_answers'] ? $unserialized_q_meta['allow_other_answers'] : 'no',
387
  'otherAnswersLabel' => isset( $unserialized_q_meta['other_answers_label'] ) && '' != trim( $unserialized_q_meta['other_answers_label'] ) ? $unserialized_q_meta['other_answers_label'] : 'Other',
388
  'addOtherAnswers' =>
@@ -398,9 +402,9 @@ class ClassYopPollImporter5x {
398
  'answersDisplay' => $answersDisplay,
399
  'answersColumns' =>
400
  isset( $unserialized_q_meta['display_answers_tabulated_cols'] ) && '' !== $unserialized_q_meta['display_answers_tabulated_cols'] ? $unserialized_q_meta['display_answers_tabulated_cols'] : 2,
401
- 'answersSort' => 'as-defined'
402
- ]
403
- ];
404
  break;
405
  }
406
  case 'media': {
@@ -408,38 +412,38 @@ class ClassYopPollImporter5x {
408
  $unserialized_a_meta = unserialize( $pQA->meta_value );
409
  switch ( $pQA->type ) {
410
  case 'text': {
411
- $pQAA = [
412
  'ID' => $pQA->ID,
413
  'question_order' => $pQA->question_order,
414
  'type' => 'text',
415
  'text' => stripslashes( $pQA->answer ),
416
- 'options' => [
417
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
418
  'makeLink' => 'no',
419
  'link' => '',
420
- 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : ''
421
- ]
422
- ];
423
  break;
424
  }
425
  case 'image': {
426
- $pQAA = [
427
  'ID' => $pQA->ID,
428
  'question_order' => $pQA->question_order,
429
  'type' => 'image',
430
  'text' => stripslashes( $pQA->answer ),
431
- 'options' => [
432
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
433
  'makeLink' => 'no',
434
  'addText' => 'no',
435
  'text' => '',
436
- 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '#000'
437
- ]
438
- ];
439
  break;
440
  }
441
  }
442
- $pollQuestionAnswersArray[$x] = $pQAA;
443
  $x ++;
444
  }
445
  if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
@@ -453,13 +457,13 @@ class ClassYopPollImporter5x {
453
  } else {
454
  $answersDisplay = 'vertical';
455
  }
456
- $pollElementsArray[] = [
457
  'ID' => $pQ->ID,
458
  'type' => 'media-question',
459
  'text' => stripslashes( $pQ->question ),
460
  'poll_order' => $pQ->poll_order,
461
  'answers' => $pollQuestionAnswersArray,
462
- 'options' => [
463
  'allowOtherAnswers' => isset( $unserialized_q_meta['allow_other_answers'] ) && '' != $unserialized_q_meta['allow_other_answers'] ? $unserialized_q_meta['allow_other_answers'] : 'no',
464
  'otherAnswersLabel' => isset( $unserialized_q_meta['other_answers_label'] ) && '' != trim( $unserialized_q_meta['other_answers_label'] ) ? $unserialized_q_meta['other_answers_label'] : 'Other',
465
  'addOtherAnswers' =>
@@ -475,23 +479,23 @@ class ClassYopPollImporter5x {
475
  'answersDisplay' => $answersDisplay,
476
  'answersColumns' =>
477
  isset( $unserialized_q_meta['display_answers_tabulated_cols'] ) && '' !== $unserialized_q_meta['display_answers_tabulated_cols'] ? $unserialized_q_meta['display_answers_tabulated_cols'] : 2,
478
- 'answersSort' => 'as-defined'
479
- ]
480
- ];
481
  break;
482
  }
483
  }
484
  foreach ( $pollQuestionCustoms as $pQC ) {
485
- $pollElementsArray[] = [
486
  'ID' => self::$maxElementID,
487
  'poll_order' => 1,
488
  'type' => 'custom-field',
489
  'text' => stripslashes( $pQC->custom_field ),
490
- 'options' => [
491
  'makeRequired' => 'yes' === $pQC->required ? 'yes' : 'no',
492
- 'cType' => 'textfield'
493
- ]
494
- ];
495
  self::$maxElementID++;
496
  }
497
  }
@@ -571,13 +575,13 @@ class ClassYopPollImporter5x {
571
  private static function import_bans( $skip_table_check = false ) {
572
  global $wpdb;
573
  $polls_bans_table = $GLOBALS['wpdb']->prefix . 'yop2_poll_bans';
574
- $values = [];
575
  $current_user = wp_get_current_user();
576
  if ( $skip_table_check ) {
577
  self::$checked_existence_bans = true;
578
  self::$bans_table_exists = true;
579
  }
580
- if ( !self::$checked_existence_bans ) {
581
  if ( self::check_if_table_exists( $polls_bans_table ) ) {
582
  if ( ! self::check_if_column_exists( $polls_bans_table, 'processed' ) ) {
583
  $wpdb->query( "ALTER TABLE `{$polls_bans_table}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -588,13 +592,25 @@ class ClassYopPollImporter5x {
588
  }
589
 
590
  if ( self::$checked_existence_bans && self::$bans_table_exists ) {
591
- self::$unprocessed_bans = $wpdb->get_var( "select count(ID) from `{$polls_bans_table}` where `processed` = false" );
592
- $bans = $wpdb->get_results( "select * from `{$polls_bans_table}` LIMIT " . self::$ajax_limit );
593
- $bansIds = [];
 
 
 
 
 
594
  if ( count( $bans ) > 0 ) {
595
  foreach ( $bans as $ban ) {
596
- $values[] = $wpdb->prepare( '(%d, %d, %s, %s, %s)', $current_user->ID, $ban->poll_id, $ban->type, $ban->value, current_time( 'mysql' ) );
597
- $bansIds[] = $ban->id;
 
 
 
 
 
 
 
598
  }
599
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
600
  if ( count( $values ) > 0 ) {
@@ -602,22 +618,37 @@ class ClassYopPollImporter5x {
602
  $result = $wpdb->query( $query );
603
  if ( ! $result ) {
604
  $last_error = $wpdb->last_error;
605
- return [ 'response_code' => 1, 'message' => esc_html__( $last_error, 'yop-poll' ) ];
 
 
 
606
  } else {
607
- $res = $wpdb->query( "update {$polls_bans_table} set `processed` = true where `ID` in (" . implode( ',', $bansIds ) . ')' );
608
  self::$processed_bans += $res;
609
  if ( self::$processed_bans == self::$unprocessed_bans ) {
610
- return [ 'response_code' => - 1, 'message' => esc_html__( 'Processed ' . self::$processed_bans . ' out of ' . self::$unprocessed_bans . ' records on table bans.', 'yop-poll' ) ];
 
 
 
611
  } else {
612
- return [ 'response_code' => 1, 'message' => esc_html__( 'Processed ' . self::$processed_bans . ' out of ' . self::$unprocessed_bans . ' remaining records on table bans.', 'yop-poll' ) ];
 
 
 
613
  }
614
  }
615
  }
616
  } else {
617
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No bans to process.', 'yop-poll' ) ];
 
 
 
618
  }
619
  } else {
620
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No bans table, skipping.', 'yop-poll' ) ];
 
 
 
621
  }
622
 
623
  }
@@ -631,7 +662,7 @@ class ClassYopPollImporter5x {
631
  self::$checked_existence_votes = true;
632
  self::$votes_table_exists = true;
633
  }
634
- if ( !self::$checked_existence_votes ) {
635
  if ( self::check_if_table_exists( $polls_results_table_name ) ) {
636
  if ( ! self::check_if_column_exists( $polls_results_table_name, 'processed' ) ) {
637
  $wpdb->query( "ALTER TABLE `{$polls_results_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
@@ -642,68 +673,116 @@ class ClassYopPollImporter5x {
642
  }
643
 
644
  if ( self::$checked_existence_votes && self::$votes_table_exists ) {
645
- self::$unprocessed_votes = $wpdb->get_var( "select count(ID) from `{$polls_results_table_name}` where processed = false" );
646
- $results = $wpdb->get_results( "select `{$polls_results_table_name}`.* from `{$polls_results_table_name}` where `processed` = false limit " . self::$ajax_limit );
647
- if ( 0 == count( $results ) ) {
648
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes to process.', 'yop-poll' ) ];
 
 
 
 
 
 
 
 
649
  } else {
650
- $voteData = ['elements' => [], 'user' => [] ];
651
- $votesArray = [];
652
- $resultsIds = [];
 
 
 
653
  foreach ( $results as $result ) {
654
- $voteData = ['elements' => [], 'user' => [] ];
655
- $resultsIds[] = $result->ID;
 
 
 
656
  $result_details = get_object_vars( json_decode( $result->result_details ) );
657
  foreach ( $result_details as $rd ) {
658
- $a_data = [];
659
  foreach ( $rd->a as $answer_id ) {
660
- $a_data[] = [
661
  'id' => $answer_id,
662
- 'data' => true
663
- ];
664
- $wpdb->query( $wpdb->prepare( "UPDATE `{$GLOBALS['wpdb']->yop_poll_subelements}` SET `total_submits` = ( `total_submits` + 1 ) WHERE `id` = %d", array( $answer_id ) ) );
 
 
 
 
 
665
 
666
  }
667
- $voteData['elements'][] = [
668
  'id' => $rd->id,
669
  'type' => 'question',
670
- 'data' => $a_data
671
- ];
672
  if ( property_exists( $rd, 'cf' ) && count( $rd->cf ) > 0 ) {
673
- $customs = $wpdb->get_results( "select `id`, `user_id`,`custom_field_value` from `{$polls_results_customs_table_name}` where ID in (" . implode( ',', $rd->cf ) . ')' );
 
 
 
 
674
  if ( $customs ) {
675
  foreach ( $customs as $cust ) {
676
- $custom_text = $wpdb->get_var( "select `custom_field` from {$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields where ID = '{$cust->id}'" );
677
- $added_custom = $wpdb->get_var( $wpdb->prepare( "select `id` from `{$GLOBALS['wpdb']->yop_poll_elements}` where `poll_id` = %d and `etext` = %s limit 1", array( $result->poll_id, $custom_text ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  if ( '' != $added_custom && $added_custom > 0 ) {
679
  $custom_id = $added_custom;
680
  } else {
681
- $wpdb->insert( $GLOBALS['wpdb']->yop_poll_elements,
682
- ['poll_id' => $result->poll_id,
683
- 'author' => $current_user->ID,
684
- 'etext' => 'Custom field',
685
- 'etype' => 'custom_field',
686
- 'status' => 'active',
687
- 'meta_data' => serialize( ['makeRequired' => 'no'] ),
688
- 'added_date' => date( 'Y-m-d H:i:s' ),
689
- 'modified_date' => date( 'Y-m-d H:i:s' )
690
- ],
691
- ['%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s'] );
 
 
 
 
 
 
 
 
 
 
 
 
692
  $custom_id = $wpdb->insert_id;
693
  }
694
- $voteData['elements'][] = [
695
  'id' => $custom_id,
696
  'type' => 'custom-field',
697
- 'data' => [$cust->custom_field_value]
698
- ];
699
  }
700
  }
701
  }
702
  }
703
- $voteData['user'] = [
704
  'first_name' => '',
705
- 'last_name' => ''
706
- ];
707
  $data = array(
708
  'poll_id' => $result->poll_id,
709
  'user_id' => $result->user_id,
@@ -715,10 +794,22 @@ class ClassYopPollImporter5x {
715
  'voter_fingerprint' => '',
716
  'vote_data' => serialize( $voteData ),
717
  'status' => 'active',
718
- 'added_date' => $result->vote_date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  );
720
- $votesArray[] = $wpdb->prepare( '(%d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)', $data['poll_id'], $data['user_id'], $data['user_email'], $data['user_type'], $data['ipaddress'],
721
- $data['tracking_id'], $data['voter_id'], $data['voter_fingerprint'], $data['vote_data'], $data['status'], $data['added_date'] );
722
  }
723
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_votes}` (`poll_id`, `user_id`, `user_email`, `user_type`, `ipaddress`, `tracking_id`, `voter_id`, `voter_fingerprint`, `vote_data`,
724
  `status`, `added_date`) VALUES ";
@@ -726,22 +817,37 @@ class ClassYopPollImporter5x {
726
  $query .= implode( ",\n", $votesArray );
727
  $response = $wpdb->query( $query );
728
  if ( $response ) {
729
- $result = $wpdb->query( "update `{$polls_results_table_name}` set `processed` = true where ID in (" . implode( ',', $resultsIds ) . ')' );
730
  self::$processed_votes += $result;
731
  if ( self::$processed_votes == self::$unprocessed_votes ) {
732
- return [ 'response_code' => -1, 'message' => esc_html__( 'Processed ' . self::$processed_votes . ' out of ' . self::$unprocessed_votes . ' records on table votes.', 'yop-poll' ) ];
 
 
 
733
  } else {
734
- return [ 'response_code' => 1, 'message' => esc_html__( 'Processed ' . self::$processed_votes . ' out of ' . self::$unprocessed_votes . ' remaining records on table votes.', 'yop-poll' ) ];
 
 
 
735
  }
736
  } else {
737
- return [ 'response_code' => 1, 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ) ];
 
 
 
738
  }
739
  } else {
740
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes to process.', 'yop-poll' ) ];
 
 
 
741
  }
742
  }
743
  } else {
744
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No votes table, skipping.', 'yop-poll' ) ];
 
 
 
745
  }
746
 
747
  }
@@ -765,75 +871,115 @@ class ClassYopPollImporter5x {
765
  }
766
  }
767
  if ( self::$checked_existence_logs && self::$logs_table_exists ) {
768
- self::$unprocessed_logs = $wpdb->get_var( "select count(ID) from `{$polls_logs_table_name}` where processed = false" );
769
- $log_results = $wpdb->get_results( "select `{$polls_logs_table_name}`.* from `{$polls_logs_table_name}` where `processed` = false limit " . self::$ajax_limit );
 
 
 
 
 
770
  if ( 0 == count( $log_results ) ) {
771
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No logs to process.', 'yop-poll' ) ];
 
 
 
772
  } else {
773
- $logData = [ 'elements' => [], 'user' => [] ];
774
- $logsArray = [];
775
- $logsIds = [];
 
 
 
776
  foreach ( $log_results as $lresult ) {
777
- $logData = [ 'elements' => [], 'user' => [] ];
778
- $logsIds[] = $lresult->ID;
 
 
 
779
  if ( 'Success' === $lresult->message ) {
780
  $lresult_details = get_object_vars( json_decode( $lresult->vote_details ) );
781
- $q_data = [];
782
  foreach ( $lresult_details as $rd ) {
783
- $a_data = [];
784
  foreach ( $rd->a as $answer_id ) {
785
- $a_data[] = [
786
  'id' => $answer_id,
787
- 'data' => true
788
- ];
789
  }
790
- $logData['elements'][] = [
791
  'id' => $rd->id,
792
  'type' => 'question',
793
- 'data' => $a_data
794
- ];
795
  if ( count( $rd->cf ) > 0 ) {
796
- $customs = $wpdb->get_results( "select `id`, `custom_field_value` from `{$polls_results_customs_table_name}` where ID in (" . implode( ',', $rd->cf ) . ')' );
 
 
 
 
797
  if ( $customs ) {
798
  foreach ( $customs as $cust ) {
799
  $custom_text = $wpdb->get_var(
800
  $wpdb->prepare(
801
- "select `custom_field` from {$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields where ID = %s",
802
  $cust->id
803
  )
804
  );
805
- $added_custom = $wpdb->get_var( $wpdb->prepare( "select `id` from `{$GLOBALS['wpdb']->yop_poll_elements}` where `poll_id` = %d and `etext` = %s limit 1", array( $lresult->poll_id, $custom_text ) ) );
 
 
 
 
 
 
 
 
806
  if ( '' != $added_custom && $added_custom > 0 ) {
807
  $custom_id = $added_custom;
808
  } else {
809
- $wpdb->insert( $GLOBALS['wpdb']->yop_poll_elements,
810
- ['poll_id' => $lresult->poll_id,
811
- 'author' => $current_user->ID,
812
- 'etext' => 'Custom field',
813
- 'etype' => 'custom_field',
814
- 'status' => 'active',
815
- 'meta_data' => serialize( ['makeRequired' => 'no'] ),
816
- 'added_date' => date( 'Y-m-d H:i:s' ),
817
- 'modified_date' => date( 'Y-m-d H:i:s' )
818
- ],
819
- ['%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s']);
 
 
 
 
 
 
 
 
 
 
 
 
820
  $custom_id = $wpdb->insert_id;
821
  }
822
- $logData['elements'][] = [
823
  'id' => $custom_id,
824
  'type' => 'custom-field',
825
- 'data' => [$cust->custom_field_value]
826
- ];
 
 
827
  }
828
  }
829
  }
830
  }
831
  }
832
 
833
- $logData['user'] = [
834
  'first_name' => '',
835
- 'last_name' => ''
836
- ];
837
  $vote_message = [ $lresult->message ];
838
  $data = array(
839
  'poll_id' => $lresult->poll_id,
@@ -847,36 +993,66 @@ class ClassYopPollImporter5x {
847
  'voter_fingerprint' => '',
848
  'vote_data' => serialize( $logData ),
849
  'vote_message' => serialize( $vote_message ),
850
- 'added_date' => $lresult->vote_date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  );
852
- $logsArray[] = $wpdb->prepare( '(%d, %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)', $data['poll_id'], $data['poll_author'], $data['user_id'], $data['user_email'], $data['user_type'], $data['ipaddress'],
853
- $data['tracking_id'], $data['voter_id'], $data['voter_fingerprint'], $data['vote_data'], $data['vote_message'], $data['added_date'] );
854
  }
855
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_logs}` (`poll_id`, `poll_author`, `user_id`, `user_email`, `user_type`, `ipaddress`, `tracking_id`, `voter_id`, `voter_fingerprint`, `vote_data`,
856
  `vote_message`, `added_date`) VALUES ";
857
  $query .= implode( ",\n", $logsArray );
858
  $response = $wpdb->query( $query );
859
  if ( $response ) {
860
- $result = $wpdb->query( "update `{$polls_logs_table_name}` set `processed` = true where `ID` in (" . implode( ',', $logsIds ) . ')' );
861
  self::$processed_logs += $result;
862
  if ( self::$processed_logs == self::$unprocessed_logs ) {
863
- return [ 'response_code' => -1, 'message' => esc_html__( 'Processed ' . self::$processed_logs . ' out of ' . self::$unprocessed_logs . ' records on table logs.', 'yop-poll' ) ];
 
 
 
864
  } else {
865
- return [ 'response_code' => 1, 'message' => esc_html__( 'Processed ' . self::$processed_logs . ' out of remaining ' . self::$unprocessed_logs . ' records on table logs.', 'yop-poll' ) ];
 
 
 
866
  }
867
  } else {
868
- return [ 'response_code' => 1, 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ) ];
 
 
 
869
  }
870
  }
871
  } else {
872
- return [ 'response_code' => - 1, 'message' => esc_html__( 'No logs table, skipping.', 'yop-poll' ) ];
 
 
 
873
  }
874
  }
875
 
876
  private static function check_if_table_exists( $table_name ) {
877
  global $wpdb;
878
- if ( 0 == $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(1) FROM `information_schema`.`tables` WHERE `table_schema` = %s AND `table_name` = %s',
879
- DB_NAME, $table_name ) ) ) {
 
 
 
 
 
880
  return false;
881
  }
882
  return true;
@@ -884,10 +1060,14 @@ class ClassYopPollImporter5x {
884
 
885
  private static function check_if_column_exists( $table_name, $column_name ) {
886
  global $wpdb;
887
- if ( 0 == $wpdb->get_var( $wpdb->prepare(
 
888
  'SELECT count(1) FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = %s AND `TABLE_NAME` = %s AND `COLUMN_NAME` = %s ',
889
- DB_NAME, $table_name, $column_name
890
- ) ) ) {
 
 
 
891
  return false;
892
  }
893
  return true;
@@ -1017,7 +1197,7 @@ class ClassYopPollImporter5x {
1017
  }
1018
 
1019
  private static function create_css_from_template( $template_id ) {
1020
- $css_array = [];
1021
  switch ( $template_id ) {
1022
  case 1: {
1023
  $css_array = array(
@@ -1027,13 +1207,13 @@ class ClassYopPollImporter5x {
1027
  'borderColor' => '#ffffff',
1028
  'borderRadius' => '0',
1029
  'paddingLeftRight' => '10',
1030
- 'paddingTopBottom' => '10'
1031
  ),
1032
  'questions' => array(
1033
  'textColor' => '#000',
1034
  'textSize' => '16',
1035
  'textWeight' => 'normal',
1036
- 'textAlign' => 'center'
1037
  ),
1038
  'answers' => array(
1039
  'paddingLeftRight' => '0',
@@ -1042,7 +1222,7 @@ class ClassYopPollImporter5x {
1042
  'textSize' => '14',
1043
  'textWeight' => 'normal',
1044
  'skin' => '',
1045
- 'colorScheme' => ''
1046
  ),
1047
  'buttons' => array(
1048
  'backgroundColor' => '#ffffff',
@@ -1053,7 +1233,7 @@ class ClassYopPollImporter5x {
1053
  'paddingTopBottom' => '5',
1054
  'textColor' => '#000',
1055
  'textSize' => '14',
1056
- 'textWeight' => 'normal'
1057
  ),
1058
  'captcha' => array(),
1059
  'errors' => array(
@@ -1063,13 +1243,13 @@ class ClassYopPollImporter5x {
1063
  'paddingTopBottom' => '0',
1064
  'textColor' => '#000000',
1065
  'textSize' => '14',
1066
- 'textWeight' => 'normal'
1067
  ),
1068
  'custom' => array(
1069
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1070
  text-align: center;
1071
- }'
1072
- )
1073
  );
1074
  break;
1075
  }
@@ -1081,13 +1261,13 @@ class ClassYopPollImporter5x {
1081
  'borderColor' => '#EEEEEE',
1082
  'borderRadius' => '0',
1083
  'paddingLeftRight' => '10',
1084
- 'paddingTopBottom' => '10'
1085
  ),
1086
  'questions' => array(
1087
  'textColor' => '#000',
1088
  'textSize' => '16',
1089
  'textWeight' => 'normal',
1090
- 'textAlign' => 'center'
1091
  ),
1092
  'answers' => array(
1093
  'paddingLeftRight' => '0',
@@ -1096,7 +1276,7 @@ class ClassYopPollImporter5x {
1096
  'textSize' => '14',
1097
  'textWeight' => 'normal',
1098
  'skin' => '',
1099
- 'colorScheme' => ''
1100
  ),
1101
  'buttons' => array(
1102
  'backgroundColor' => '#ffffff',
@@ -1107,7 +1287,7 @@ class ClassYopPollImporter5x {
1107
  'paddingTopBottom' => '5',
1108
  'textColor' => '#000',
1109
  'textSize' => '14',
1110
- 'textWeight' => 'normal'
1111
  ),
1112
  'captcha' => array(),
1113
  'errors' => array(
@@ -1117,13 +1297,13 @@ class ClassYopPollImporter5x {
1117
  'paddingTopBottom' => '0',
1118
  'textColor' => '#000000',
1119
  'textSize' => '14',
1120
- 'textWeight' => 'normal'
1121
  ),
1122
  'custom' => array(
1123
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1124
  text-align: center;
1125
- }'
1126
- )
1127
  );
1128
  break;
1129
  }
@@ -1135,13 +1315,13 @@ class ClassYopPollImporter5x {
1135
  'borderColor' => '#555555',
1136
  'borderRadius' => '0',
1137
  'paddingLeftRight' => '10',
1138
- 'paddingTopBottom' => '10'
1139
  ),
1140
  'questions' => array(
1141
  'textColor' => '#ffffff',
1142
  'textSize' => '16',
1143
  'textWeight' => 'normal',
1144
- 'textAlign' => 'center'
1145
  ),
1146
  'answers' => array(
1147
  'paddingLeftRight' => '0',
@@ -1150,7 +1330,7 @@ class ClassYopPollImporter5x {
1150
  'textSize' => '14',
1151
  'textWeight' => 'normal',
1152
  'skin' => '',
1153
- 'colorScheme' => ''
1154
  ),
1155
  'buttons' => array(
1156
  'backgroundColor' => '#ffffff',
@@ -1161,7 +1341,7 @@ class ClassYopPollImporter5x {
1161
  'paddingTopBottom' => '5',
1162
  'textColor' => '#000',
1163
  'textSize' => '14',
1164
- 'textWeight' => 'normal'
1165
  ),
1166
  'captcha' => array(),
1167
  'errors' => array(
@@ -1171,13 +1351,13 @@ class ClassYopPollImporter5x {
1171
  'paddingTopBottom' => '0',
1172
  'textColor' => '#000000',
1173
  'textSize' => '14',
1174
- 'textWeight' => 'normal'
1175
  ),
1176
  'custom' => array(
1177
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1178
  text-align: center;
1179
- }'
1180
- )
1181
  );
1182
  break;
1183
  }
@@ -1189,13 +1369,13 @@ class ClassYopPollImporter5x {
1189
  'borderColor' => '#327BD6',
1190
  'borderRadius' => '0',
1191
  'paddingLeftRight' => '10',
1192
- 'paddingTopBottom' => '10'
1193
  ),
1194
  'questions' => array(
1195
  'textColor' => '#ffffff',
1196
  'textSize' => '14',
1197
  'textWeight' => 'normal',
1198
- 'textAlign' => 'center'
1199
  ),
1200
  'answers' => array(
1201
  'paddingLeftRight' => '0',
@@ -1204,7 +1384,7 @@ class ClassYopPollImporter5x {
1204
  'textSize' => '14',
1205
  'textWeight' => 'normal',
1206
  'skin' => '',
1207
- 'colorScheme' => ''
1208
  ),
1209
  'buttons' => array(
1210
  'backgroundColor' => '#ffffff',
@@ -1215,7 +1395,7 @@ class ClassYopPollImporter5x {
1215
  'paddingTopBottom' => '5',
1216
  'textColor' => '#000',
1217
  'textSize' => '14',
1218
- 'textWeight' => 'normal'
1219
  ),
1220
  'captcha' => array(),
1221
  'errors' => array(
@@ -1225,13 +1405,13 @@ class ClassYopPollImporter5x {
1225
  'paddingTopBottom' => '0',
1226
  'textColor' => '#000000',
1227
  'textSize' => '14',
1228
- 'textWeight' => 'normal'
1229
  ),
1230
  'custom' => array(
1231
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1232
  text-align: center;
1233
- }'
1234
- )
1235
  );
1236
  break;
1237
  }
@@ -1243,13 +1423,13 @@ class ClassYopPollImporter5x {
1243
  'borderColor' => '#ffffff',
1244
  'borderRadius' => '0',
1245
  'paddingLeftRight' => '10',
1246
- 'paddingTopBottom' => '10'
1247
  ),
1248
  'questions' => array(
1249
  'textColor' => '#ffffff',
1250
  'textSize' => '14',
1251
  'textWeight' => 'normal',
1252
- 'textAlign' => 'center'
1253
  ),
1254
  'answers' => array(
1255
  'paddingLeftRight' => '0',
@@ -1258,7 +1438,7 @@ class ClassYopPollImporter5x {
1258
  'textSize' => '14',
1259
  'textWeight' => 'normal',
1260
  'skin' => '',
1261
- 'colorScheme' => ''
1262
  ),
1263
  'buttons' => array(
1264
  'backgroundColor' => '#ffffff',
@@ -1269,7 +1449,7 @@ class ClassYopPollImporter5x {
1269
  'paddingTopBottom' => '5',
1270
  'textColor' => '#000',
1271
  'textSize' => '14',
1272
- 'textWeight' => 'normal'
1273
  ),
1274
  'captcha' => array(),
1275
  'errors' => array(
@@ -1279,7 +1459,7 @@ class ClassYopPollImporter5x {
1279
  'paddingTopBottom' => '0',
1280
  'textColor' => '#000000',
1281
  'textSize' => '14',
1282
- 'textWeight' => 'normal'
1283
  ),
1284
  'custom' => array(
1285
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
@@ -1288,8 +1468,8 @@ class ClassYopPollImporter5x {
1288
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1289
  background-color: #327BD6;
1290
  padding: 5px 0;
1291
- }'
1292
- )
1293
  );
1294
  break;
1295
  }
@@ -1301,13 +1481,13 @@ class ClassYopPollImporter5x {
1301
  'borderColor' => '#327BD6',
1302
  'borderRadius' => '0',
1303
  'paddingLeftRight' => '10',
1304
- 'paddingTopBottom' => '10'
1305
  ),
1306
  'questions' => array(
1307
  'textColor' => '#000',
1308
  'textSize' => '14',
1309
  'textWeight' => 'normal',
1310
- 'textAlign' => 'center'
1311
  ),
1312
  'answers' => array(
1313
  'paddingLeftRight' => '0',
@@ -1316,7 +1496,7 @@ class ClassYopPollImporter5x {
1316
  'textSize' => '14',
1317
  'textWeight' => 'normal',
1318
  'skin' => '',
1319
- 'colorScheme' => ''
1320
  ),
1321
  'buttons' => array(
1322
  'backgroundColor' => '#ffffff',
@@ -1327,7 +1507,7 @@ class ClassYopPollImporter5x {
1327
  'paddingTopBottom' => '5',
1328
  'textColor' => '#000',
1329
  'textSize' => '14',
1330
- 'textWeight' => 'normal'
1331
  ),
1332
  'captcha' => array(),
1333
  'errors' => array(
@@ -1337,13 +1517,13 @@ class ClassYopPollImporter5x {
1337
  'paddingTopBottom' => '0',
1338
  'textColor' => '#000000',
1339
  'textSize' => '14',
1340
- 'textWeight' => 'normal'
1341
  ),
1342
  'custom' => array(
1343
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1344
  text-align: center;
1345
- }'
1346
- )
1347
  );
1348
  break;
1349
  }
@@ -1355,13 +1535,13 @@ class ClassYopPollImporter5x {
1355
  'borderColor' => '#B70004',
1356
  'borderRadius' => '0',
1357
  'paddingLeftRight' => '10',
1358
- 'paddingTopBottom' => '10'
1359
  ),
1360
  'questions' => array(
1361
  'textColor' => '#ffffff',
1362
  'textSize' => '14',
1363
  'textWeight' => 'normal',
1364
- 'textAlign' => 'center'
1365
  ),
1366
  'answers' => array(
1367
  'paddingLeftRight' => '0',
@@ -1370,7 +1550,7 @@ class ClassYopPollImporter5x {
1370
  'textSize' => '14',
1371
  'textWeight' => 'normal',
1372
  'skin' => '',
1373
- 'colorScheme' => ''
1374
  ),
1375
  'buttons' => array(
1376
  'backgroundColor' => '#ffffff',
@@ -1381,7 +1561,7 @@ class ClassYopPollImporter5x {
1381
  'paddingTopBottom' => '5',
1382
  'textColor' => '#000',
1383
  'textSize' => '14',
1384
- 'textWeight' => 'normal'
1385
  ),
1386
  'captcha' => array(),
1387
  'errors' => array(
@@ -1391,13 +1571,13 @@ class ClassYopPollImporter5x {
1391
  'paddingTopBottom' => '0',
1392
  'textColor' => '#000000',
1393
  'textSize' => '14',
1394
- 'textWeight' => 'normal'
1395
  ),
1396
  'custom' => array(
1397
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1398
  text-align: center;
1399
- }'
1400
- )
1401
  );
1402
  break;
1403
  }
@@ -1409,13 +1589,13 @@ class ClassYopPollImporter5x {
1409
  'borderColor' => '#ffffff',
1410
  'borderRadius' => '0',
1411
  'paddingLeftRight' => '10',
1412
- 'paddingTopBottom' => '10'
1413
  ),
1414
  'questions' => array(
1415
  'textColor' => '#ffffff',
1416
  'textSize' => '14',
1417
  'textWeight' => 'normal',
1418
- 'textAlign' => 'center'
1419
  ),
1420
  'answers' => array(
1421
  'paddingLeftRight' => '0',
@@ -1424,7 +1604,7 @@ class ClassYopPollImporter5x {
1424
  'textSize' => '14',
1425
  'textWeight' => 'normal',
1426
  'skin' => '',
1427
- 'colorScheme' => ''
1428
  ),
1429
  'buttons' => array(
1430
  'backgroundColor' => '#ffffff',
@@ -1435,7 +1615,7 @@ class ClassYopPollImporter5x {
1435
  'paddingTopBottom' => '5',
1436
  'textColor' => '#000',
1437
  'textSize' => '14',
1438
- 'textWeight' => 'normal'
1439
  ),
1440
  'captcha' => array(),
1441
  'errors' => array(
@@ -1445,7 +1625,7 @@ class ClassYopPollImporter5x {
1445
  'paddingTopBottom' => '0',
1446
  'textColor' => '#000000',
1447
  'textSize' => '14',
1448
- 'textWeight' => 'normal'
1449
  ),
1450
  'custom' => array(
1451
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
@@ -1454,8 +1634,8 @@ class ClassYopPollImporter5x {
1454
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1455
  background-color: #B70004;
1456
  padding: 5px 0;
1457
- }'
1458
- )
1459
  );
1460
  break;
1461
  }
@@ -1467,13 +1647,13 @@ class ClassYopPollImporter5x {
1467
  'borderColor' => '#B70004',
1468
  'borderRadius' => '0',
1469
  'paddingLeftRight' => '10',
1470
- 'paddingTopBottom' => '10'
1471
  ),
1472
  'questions' => array(
1473
  'textColor' => '#000',
1474
  'textSize' => '14',
1475
  'textWeight' => 'normal',
1476
- 'textAlign' => 'center'
1477
  ),
1478
  'answers' => array(
1479
  'paddingLeftRight' => '0',
@@ -1482,7 +1662,7 @@ class ClassYopPollImporter5x {
1482
  'textSize' => '14',
1483
  'textWeight' => 'normal',
1484
  'skin' => '',
1485
- 'colorScheme' => ''
1486
  ),
1487
  'buttons' => array(
1488
  'backgroundColor' => '#ffffff',
@@ -1493,7 +1673,7 @@ class ClassYopPollImporter5x {
1493
  'paddingTopBottom' => '5',
1494
  'textColor' => '#000',
1495
  'textSize' => '14',
1496
- 'textWeight' => 'normal'
1497
  ),
1498
  'captcha' => array(),
1499
  'errors' => array(
@@ -1503,13 +1683,13 @@ class ClassYopPollImporter5x {
1503
  'paddingTopBottom' => '0',
1504
  'textColor' => '#000000',
1505
  'textSize' => '14',
1506
- 'textWeight' => 'normal'
1507
  ),
1508
  'custom' => array(
1509
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1510
  text-align: center;
1511
- }'
1512
- )
1513
  );
1514
  break;
1515
  }
@@ -1521,13 +1701,13 @@ class ClassYopPollImporter5x {
1521
  'borderColor' => '#3F8B43',
1522
  'borderRadius' => '0',
1523
  'paddingLeftRight' => '10',
1524
- 'paddingTopBottom' => '10'
1525
  ),
1526
  'questions' => array(
1527
  'textColor' => '#ffffff',
1528
  'textSize' => '16',
1529
  'textWeight' => 'normal',
1530
- 'textAlign' => 'center'
1531
  ),
1532
  'answers' => array(
1533
  'paddingLeftRight' => '0',
@@ -1536,7 +1716,7 @@ class ClassYopPollImporter5x {
1536
  'textSize' => '14',
1537
  'textWeight' => 'normal',
1538
  'skin' => '',
1539
- 'colorScheme' => ''
1540
  ),
1541
  'buttons' => array(
1542
  'backgroundColor' => '#ffffff',
@@ -1547,7 +1727,7 @@ class ClassYopPollImporter5x {
1547
  'paddingTopBottom' => '5',
1548
  'textColor' => '#000',
1549
  'textSize' => '14',
1550
- 'textWeight' => 'normal'
1551
  ),
1552
  'captcha' => array(),
1553
  'errors' => array(
@@ -1557,13 +1737,13 @@ class ClassYopPollImporter5x {
1557
  'paddingTopBottom' => '0',
1558
  'textColor' => '#000000',
1559
  'textSize' => '14',
1560
- 'textWeight' => 'normal'
1561
  ),
1562
  'custom' => array(
1563
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1564
  text-align: center;
1565
- }'
1566
- )
1567
  );
1568
  break;
1569
  }
@@ -1575,13 +1755,13 @@ class ClassYopPollImporter5x {
1575
  'borderColor' => '#ffffff',
1576
  'borderRadius' => '0',
1577
  'paddingLeftRight' => '10',
1578
- 'paddingTopBottom' => '10'
1579
  ),
1580
  'questions' => array(
1581
  'textColor' => '#ffffff',
1582
  'textSize' => '14',
1583
  'textWeight' => 'normal',
1584
- 'textAlign' => 'center'
1585
  ),
1586
  'answers' => array(
1587
  'paddingLeftRight' => '0',
@@ -1590,7 +1770,7 @@ class ClassYopPollImporter5x {
1590
  'textSize' => '14',
1591
  'textWeight' => 'normal',
1592
  'skin' => '',
1593
- 'colorScheme' => ''
1594
  ),
1595
  'buttons' => array(
1596
  'backgroundColor' => '#ffffff',
@@ -1601,7 +1781,7 @@ class ClassYopPollImporter5x {
1601
  'paddingTopBottom' => '5',
1602
  'textColor' => '#000',
1603
  'textSize' => '14',
1604
- 'textWeight' => 'normal'
1605
  ),
1606
  'captcha' => array(),
1607
  'errors' => array(
@@ -1611,13 +1791,13 @@ class ClassYopPollImporter5x {
1611
  'paddingTopBottom' => '0',
1612
  'textColor' => '#000000',
1613
  'textSize' => '14',
1614
- 'textWeight' => 'normal'
1615
  ),
1616
  'custom' => array(
1617
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1618
  text-align: center;
1619
- }'
1620
- )
1621
  );
1622
  break;
1623
  }
@@ -1629,13 +1809,13 @@ class ClassYopPollImporter5x {
1629
  'borderColor' => '#3F8B43',
1630
  'borderRadius' => '0',
1631
  'paddingLeftRight' => '10',
1632
- 'paddingTopBottom' => '10'
1633
  ),
1634
  'questions' => array(
1635
  'textColor' => '#000',
1636
  'textSize' => '14',
1637
  'textWeight' => 'normal',
1638
- 'textAlign' => 'center'
1639
  ),
1640
  'answers' => array(
1641
  'paddingLeftRight' => '0',
@@ -1644,7 +1824,7 @@ class ClassYopPollImporter5x {
1644
  'textSize' => '14',
1645
  'textWeight' => 'normal',
1646
  'skin' => '',
1647
- 'colorScheme' => ''
1648
  ),
1649
  'buttons' => array(
1650
  'backgroundColor' => '#ffffff',
@@ -1655,7 +1835,7 @@ class ClassYopPollImporter5x {
1655
  'paddingTopBottom' => '5',
1656
  'textColor' => '#000',
1657
  'textSize' => '14',
1658
- 'textWeight' => 'normal'
1659
  ),
1660
  'captcha' => array(),
1661
  'errors' => array(
@@ -1665,13 +1845,13 @@ class ClassYopPollImporter5x {
1665
  'paddingTopBottom' => '0',
1666
  'textColor' => '#000000',
1667
  'textSize' => '14',
1668
- 'textWeight' => 'normal'
1669
  ),
1670
  'custom' => array(
1671
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1672
  text-align: center;
1673
- }'
1674
- )
1675
  );
1676
  break;
1677
  }
@@ -1683,13 +1863,13 @@ class ClassYopPollImporter5x {
1683
  'borderColor' => '#FB6911',
1684
  'borderRadius' => '0',
1685
  'paddingLeftRight' => '10',
1686
- 'paddingTopBottom' => '10'
1687
  ),
1688
  'questions' => array(
1689
  'textColor' => '#ffffff',
1690
  'textSize' => '16',
1691
  'textWeight' => 'normal',
1692
- 'textAlign' => 'center'
1693
  ),
1694
  'answers' => array(
1695
  'paddingLeftRight' => '0',
@@ -1698,7 +1878,7 @@ class ClassYopPollImporter5x {
1698
  'textSize' => '14',
1699
  'textWeight' => 'normal',
1700
  'skin' => '',
1701
- 'colorScheme' => ''
1702
  ),
1703
  'buttons' => array(
1704
  'backgroundColor' => '#ffffff',
@@ -1709,7 +1889,7 @@ class ClassYopPollImporter5x {
1709
  'paddingTopBottom' => '5',
1710
  'textColor' => '#000',
1711
  'textSize' => '14',
1712
- 'textWeight' => 'normal'
1713
  ),
1714
  'captcha' => array(),
1715
  'errors' => array(
@@ -1719,13 +1899,13 @@ class ClassYopPollImporter5x {
1719
  'paddingTopBottom' => '0',
1720
  'textColor' => '#000000',
1721
  'textSize' => '14',
1722
- 'textWeight' => 'normal'
1723
  ),
1724
  'custom' => array(
1725
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1726
  text-align: center;
1727
- }'
1728
- )
1729
  );
1730
  break;
1731
  }
@@ -1737,13 +1917,13 @@ class ClassYopPollImporter5x {
1737
  'borderColor' => '#ffffff',
1738
  'borderRadius' => '0',
1739
  'paddingLeftRight' => '10',
1740
- 'paddingTopBottom' => '10'
1741
  ),
1742
  'questions' => array(
1743
  'textColor' => '#ffffff',
1744
  'textSize' => '16',
1745
  'textWeight' => 'normal',
1746
- 'textAlign' => 'center'
1747
  ),
1748
  'answers' => array(
1749
  'paddingLeftRight' => '0',
@@ -1752,7 +1932,7 @@ class ClassYopPollImporter5x {
1752
  'textSize' => '14',
1753
  'textWeight' => 'normal',
1754
  'skin' => '',
1755
- 'colorScheme' => ''
1756
  ),
1757
  'buttons' => array(
1758
  'backgroundColor' => '#ffffff',
@@ -1763,7 +1943,7 @@ class ClassYopPollImporter5x {
1763
  'paddingTopBottom' => '5',
1764
  'textColor' => '#000',
1765
  'textSize' => '14',
1766
- 'textWeight' => 'normal'
1767
  ),
1768
  'captcha' => array(),
1769
  'errors' => array(
@@ -1773,7 +1953,7 @@ class ClassYopPollImporter5x {
1773
  'paddingTopBottom' => '0',
1774
  'textColor' => '#000000',
1775
  'textSize' => '14',
1776
- 'textWeight' => 'normal'
1777
  ),
1778
  'custom' => array(
1779
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
@@ -1782,8 +1962,8 @@ class ClassYopPollImporter5x {
1782
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1783
  background-color: #FB6911;
1784
  padding: 5px 0;
1785
- }'
1786
- )
1787
  );
1788
  break;
1789
  }
@@ -1795,13 +1975,13 @@ class ClassYopPollImporter5x {
1795
  'borderColor' => '#FB6911',
1796
  'borderRadius' => '0',
1797
  'paddingLeftRight' => '10',
1798
- 'paddingTopBottom' => '10'
1799
  ),
1800
  'questions' => array(
1801
  'textColor' => '#000',
1802
  'textSize' => '16',
1803
  'textWeight' => 'normal',
1804
- 'textAlign' => 'center'
1805
  ),
1806
  'answers' => array(
1807
  'paddingLeftRight' => '0',
@@ -1810,7 +1990,7 @@ class ClassYopPollImporter5x {
1810
  'textSize' => '14',
1811
  'textWeight' => 'normal',
1812
  'skin' => '',
1813
- 'colorScheme' => ''
1814
  ),
1815
  'buttons' => array(
1816
  'backgroundColor' => '#ffffff',
@@ -1821,7 +2001,7 @@ class ClassYopPollImporter5x {
1821
  'paddingTopBottom' => '5',
1822
  'textColor' => '#55555',
1823
  'textSize' => '14',
1824
- 'textWeight' => 'normal'
1825
  ),
1826
  'captcha' => array(),
1827
  'errors' => array(
@@ -1831,13 +2011,13 @@ class ClassYopPollImporter5x {
1831
  'paddingTopBottom' => '0',
1832
  'textColor' => '#000000',
1833
  'textSize' => '14',
1834
- 'textWeight' => 'normal'
1835
  ),
1836
  'custom' => array(
1837
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1838
  text-align: center;
1839
- }'
1840
- )
1841
  );
1842
  break;
1843
  }
@@ -1849,13 +2029,13 @@ class ClassYopPollImporter5x {
1849
  'borderColor' => '#000000',
1850
  'borderRadius' => '0',
1851
  'paddingLeftRight' => '10',
1852
- 'paddingTopBottom' => '10'
1853
  ),
1854
  'questions' => array(
1855
  'textColor' => '#858585',
1856
  'textSize' => '16',
1857
  'textWeight' => 'normal',
1858
- 'textAlign' => 'center'
1859
  ),
1860
  'answers' => array(
1861
  'paddingLeftRight' => '0',
@@ -1864,7 +2044,7 @@ class ClassYopPollImporter5x {
1864
  'textSize' => '14',
1865
  'textWeight' => 'normal',
1866
  'skin' => '',
1867
- 'colorScheme' => ''
1868
  ),
1869
  'buttons' => array(
1870
  'backgroundColor' => '#ffffff',
@@ -1875,7 +2055,7 @@ class ClassYopPollImporter5x {
1875
  'paddingTopBottom' => '5',
1876
  'textColor' => '#333',
1877
  'textSize' => '14',
1878
- 'textWeight' => 'normal'
1879
  ),
1880
  'captcha' => array(),
1881
  'errors' => array(
@@ -1885,13 +2065,13 @@ class ClassYopPollImporter5x {
1885
  'paddingTopBottom' => '0',
1886
  'textColor' => '#000000',
1887
  'textSize' => '14',
1888
- 'textWeight' => 'normal'
1889
  ),
1890
  'custom' => array(
1891
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1892
  text-align: center;
1893
- }'
1894
- )
1895
  );
1896
  break;
1897
  }
@@ -1903,13 +2083,13 @@ class ClassYopPollImporter5x {
1903
  'borderColor' => '#bfe5f8',
1904
  'borderRadius' => '0',
1905
  'paddingLeftRight' => '10',
1906
- 'paddingTopBottom' => '10'
1907
  ),
1908
  'questions' => array(
1909
  'textColor' => '#90c1cf',
1910
  'textSize' => '16',
1911
  'textWeight' => 'normal',
1912
- 'textAlign' => 'center'
1913
  ),
1914
  'answers' => array(
1915
  'paddingLeftRight' => '0',
@@ -1918,7 +2098,7 @@ class ClassYopPollImporter5x {
1918
  'textSize' => '14',
1919
  'textWeight' => 'normal',
1920
  'skin' => '',
1921
- 'colorScheme' => ''
1922
  ),
1923
  'buttons' => array(
1924
  'backgroundColor' => '#ffffff',
@@ -1929,7 +2109,7 @@ class ClassYopPollImporter5x {
1929
  'paddingTopBottom' => '5',
1930
  'textColor' => '#333',
1931
  'textSize' => '14',
1932
- 'textWeight' => 'normal'
1933
  ),
1934
  'captcha' => array(),
1935
  'errors' => array(
@@ -1939,13 +2119,13 @@ class ClassYopPollImporter5x {
1939
  'paddingTopBottom' => '0',
1940
  'textColor' => '#000000',
1941
  'textSize' => '14',
1942
- 'textWeight' => 'normal'
1943
  ),
1944
  'custom' => array(
1945
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1946
  text-align: center;
1947
- }'
1948
- )
1949
  );
1950
  break;
1951
  }
@@ -1957,13 +2137,13 @@ class ClassYopPollImporter5x {
1957
  'borderColor' => '#bfe5f8',
1958
  'borderRadius' => '0',
1959
  'paddingLeftRight' => '10',
1960
- 'paddingTopBottom' => '10'
1961
  ),
1962
  'questions' => array(
1963
  'textColor' => '#90c1cf',
1964
  'textSize' => '16',
1965
  'textWeight' => 'normal',
1966
- 'textAlign' => 'center'
1967
  ),
1968
  'answers' => array(
1969
  'paddingLeftRight' => '0',
@@ -1972,7 +2152,7 @@ class ClassYopPollImporter5x {
1972
  'textSize' => '14',
1973
  'textWeight' => 'normal',
1974
  'skin' => '',
1975
- 'colorScheme' => ''
1976
  ),
1977
  'buttons' => array(
1978
  'backgroundColor' => '#ffffff',
@@ -1983,7 +2163,7 @@ class ClassYopPollImporter5x {
1983
  'paddingTopBottom' => '5',
1984
  'textColor' => '#333',
1985
  'textSize' => '14',
1986
- 'textWeight' => 'normal'
1987
  ),
1988
  'captcha' => array(),
1989
  'errors' => array(
@@ -1993,13 +2173,13 @@ class ClassYopPollImporter5x {
1993
  'paddingTopBottom' => '0',
1994
  'textColor' => '#000000',
1995
  'textSize' => '14',
1996
- 'textWeight' => 'normal'
1997
  ),
1998
  'custom' => array(
1999
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2000
  text-align: center;
2001
- }'
2002
- )
2003
  );
2004
  break;
2005
  }
@@ -2011,13 +2191,13 @@ class ClassYopPollImporter5x {
2011
  'borderColor' => '#ACCBE0',
2012
  'borderRadius' => '0',
2013
  'paddingLeftRight' => '10',
2014
- 'paddingTopBottom' => '10'
2015
  ),
2016
  'questions' => array(
2017
  'textColor' => '#666666',
2018
  'textSize' => '16',
2019
  'textWeight' => 'normal',
2020
- 'textAlign' => 'center'
2021
  ),
2022
  'answers' => array(
2023
  'paddingLeftRight' => '0',
@@ -2026,7 +2206,7 @@ class ClassYopPollImporter5x {
2026
  'textSize' => '14',
2027
  'textWeight' => 'normal',
2028
  'skin' => '',
2029
- 'colorScheme' => ''
2030
  ),
2031
  'buttons' => array(
2032
  'backgroundColor' => '#ffffff',
@@ -2037,7 +2217,7 @@ class ClassYopPollImporter5x {
2037
  'paddingTopBottom' => '5',
2038
  'textColor' => '#333',
2039
  'textSize' => '14',
2040
- 'textWeight' => 'normal'
2041
  ),
2042
  'captcha' => array(),
2043
  'errors' => array(
@@ -2047,13 +2227,13 @@ class ClassYopPollImporter5x {
2047
  'paddingTopBottom' => '0',
2048
  'textColor' => '#000000',
2049
  'textSize' => '14',
2050
- 'textWeight' => 'normal'
2051
  ),
2052
  'custom' => array(
2053
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2054
  text-align: center;
2055
- }'
2056
- )
2057
  );
2058
  break;
2059
  }
@@ -2065,13 +2245,13 @@ class ClassYopPollImporter5x {
2065
  'borderColor' => '#FFF',
2066
  'borderRadius' => '0',
2067
  'paddingLeftRight' => '10',
2068
- 'paddingTopBottom' => '10'
2069
  ),
2070
  'questions' => array(
2071
  'textColor' => '#ffffff',
2072
  'textSize' => '16',
2073
  'textWeight' => 'normal',
2074
- 'textAlign' => 'center'
2075
  ),
2076
  'answers' => array(
2077
  'paddingLeftRight' => '0',
@@ -2080,7 +2260,7 @@ class ClassYopPollImporter5x {
2080
  'textSize' => '14',
2081
  'textWeight' => 'normal',
2082
  'skin' => '',
2083
- 'colorScheme' => ''
2084
  ),
2085
  'buttons' => array(
2086
  'backgroundColor' => '#ffffff',
@@ -2091,7 +2271,7 @@ class ClassYopPollImporter5x {
2091
  'paddingTopBottom' => '5',
2092
  'textColor' => '#000000',
2093
  'textSize' => '14',
2094
- 'textWeight' => 'normal'
2095
  ),
2096
  'captcha' => array(),
2097
  'errors' => array(
@@ -2101,13 +2281,13 @@ class ClassYopPollImporter5x {
2101
  'paddingTopBottom' => '0',
2102
  'textColor' => '#000000',
2103
  'textSize' => '14',
2104
- 'textWeight' => 'normal'
2105
  ),
2106
  'custom' => array(
2107
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2108
  text-align: center;
2109
- }'
2110
- )
2111
  );
2112
  break;
2113
  }
@@ -2119,13 +2299,13 @@ class ClassYopPollImporter5x {
2119
  'borderColor' => '#333333',
2120
  'borderRadius' => '0',
2121
  'paddingLeftRight' => '10',
2122
- 'paddingTopBottom' => '10'
2123
  ),
2124
  'questions' => array(
2125
  'textColor' => '#ffffff',
2126
  'textSize' => '16',
2127
  'textWeight' => 'normal',
2128
- 'textAlign' => 'center'
2129
  ),
2130
  'answers' => array(
2131
  'paddingLeftRight' => '0',
@@ -2134,7 +2314,7 @@ class ClassYopPollImporter5x {
2134
  'textSize' => '14',
2135
  'textWeight' => 'normal',
2136
  'skin' => '',
2137
- 'colorScheme' => ''
2138
  ),
2139
  'buttons' => array(
2140
  'backgroundColor' => '#ffffff',
@@ -2145,7 +2325,7 @@ class ClassYopPollImporter5x {
2145
  'paddingTopBottom' => '5',
2146
  'textColor' => '#000000',
2147
  'textSize' => '14',
2148
- 'textWeight' => 'normal'
2149
  ),
2150
  'captcha' => array(),
2151
  'errors' => array(
@@ -2155,13 +2335,13 @@ class ClassYopPollImporter5x {
2155
  'paddingTopBottom' => '0',
2156
  'textColor' => '#000000',
2157
  'textSize' => '14',
2158
- 'textWeight' => 'normal'
2159
  ),
2160
  'custom' => array(
2161
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2162
  text-align: center;
2163
- }'
2164
- )
2165
  );
2166
  break;
2167
  }
@@ -2173,13 +2353,13 @@ class ClassYopPollImporter5x {
2173
  'borderColor' => '#333333',
2174
  'borderRadius' => '0',
2175
  'paddingLeftRight' => '10',
2176
- 'paddingTopBottom' => '10'
2177
  ),
2178
  'questions' => array(
2179
  'textColor' => '#ffffff',
2180
  'textSize' => '16',
2181
  'textWeight' => 'normal',
2182
- 'textAlign' => 'center'
2183
  ),
2184
  'answers' => array(
2185
  'paddingLeftRight' => '0',
@@ -2188,7 +2368,7 @@ class ClassYopPollImporter5x {
2188
  'textSize' => '14',
2189
  'textWeight' => 'normal',
2190
  'skin' => '',
2191
- 'colorScheme' => ''
2192
  ),
2193
  'buttons' => array(
2194
  'backgroundColor' => '#ffffff',
@@ -2199,7 +2379,7 @@ class ClassYopPollImporter5x {
2199
  'paddingTopBottom' => '5',
2200
  'textColor' => '#000000',
2201
  'textSize' => '14',
2202
- 'textWeight' => 'normal'
2203
  ),
2204
  'captcha' => array(),
2205
  'errors' => array(
@@ -2209,13 +2389,13 @@ class ClassYopPollImporter5x {
2209
  'paddingTopBottom' => '0',
2210
  'textColor' => '#000000',
2211
  'textSize' => '14',
2212
- 'textWeight' => 'normal'
2213
  ),
2214
  'custom' => array(
2215
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2216
  text-align: center;
2217
- }'
2218
- )
2219
  );
2220
  break;
2221
  }
@@ -2227,13 +2407,13 @@ class ClassYopPollImporter5x {
2227
  'borderColor' => '#333333',
2228
  'borderRadius' => '0',
2229
  'paddingLeftRight' => '10',
2230
- 'paddingTopBottom' => '10'
2231
  ),
2232
  'questions' => array(
2233
  'textColor' => '#ffffff',
2234
  'textSize' => '16',
2235
  'textWeight' => 'normal',
2236
- 'textAlign' => 'center'
2237
  ),
2238
  'answers' => array(
2239
  'paddingLeftRight' => '0',
@@ -2242,7 +2422,7 @@ class ClassYopPollImporter5x {
2242
  'textSize' => '14',
2243
  'textWeight' => 'normal',
2244
  'skin' => '',
2245
- 'colorScheme' => ''
2246
  ),
2247
  'buttons' => array(
2248
  'backgroundColor' => '#ffffff',
@@ -2253,7 +2433,7 @@ class ClassYopPollImporter5x {
2253
  'paddingTopBottom' => '5',
2254
  'textColor' => '#000000',
2255
  'textSize' => '14',
2256
- 'textWeight' => 'normal'
2257
  ),
2258
  'captcha' => array(),
2259
  'errors' => array(
@@ -2263,13 +2443,13 @@ class ClassYopPollImporter5x {
2263
  'paddingTopBottom' => '0',
2264
  'textColor' => '#000000',
2265
  'textSize' => '14',
2266
- 'textWeight' => 'normal'
2267
  ),
2268
  'custom' => array(
2269
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2270
  text-align: center;
2271
- }'
2272
- )
2273
  );
2274
  break;
2275
  }
@@ -2281,13 +2461,13 @@ class ClassYopPollImporter5x {
2281
  'borderColor' => '#ffffff',
2282
  'borderRadius' => '0',
2283
  'paddingLeftRight' => '10',
2284
- 'paddingTopBottom' => '10'
2285
  ),
2286
  'questions' => array(
2287
  'textColor' => '#E9E9E9',
2288
  'textSize' => '16',
2289
  'textWeight' => 'normal',
2290
- 'textAlign' => 'center'
2291
  ),
2292
  'answers' => array(
2293
  'paddingLeftRight' => '0',
@@ -2296,7 +2476,7 @@ class ClassYopPollImporter5x {
2296
  'textSize' => '14',
2297
  'textWeight' => 'normal',
2298
  'skin' => '',
2299
- 'colorScheme' => ''
2300
  ),
2301
  'buttons' => array(
2302
  'backgroundColor' => '#69C9D4',
@@ -2307,7 +2487,7 @@ class ClassYopPollImporter5x {
2307
  'paddingTopBottom' => '5',
2308
  'textColor' => '#ffffff',
2309
  'textSize' => '14',
2310
- 'textWeight' => 'normal'
2311
  ),
2312
  'captcha' => array(),
2313
  'errors' => array(
@@ -2317,13 +2497,13 @@ class ClassYopPollImporter5x {
2317
  'paddingTopBottom' => '0',
2318
  'textColor' => '#000000',
2319
  'textSize' => '14',
2320
- 'textWeight' => 'normal'
2321
  ),
2322
  'custom' => array(
2323
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2324
  text-align: center;
2325
- }'
2326
- )
2327
  );
2328
  break;
2329
  }
@@ -2335,13 +2515,13 @@ class ClassYopPollImporter5x {
2335
  'borderColor' => '#FB6911',
2336
  'borderRadius' => '0',
2337
  'paddingLeftRight' => '10',
2338
- 'paddingTopBottom' => '10'
2339
  ),
2340
  'questions' => array(
2341
  'textColor' => '#ffffff',
2342
  'textSize' => '16',
2343
  'textWeight' => 'normal',
2344
- 'textAlign' => 'center'
2345
  ),
2346
  'answers' => array(
2347
  'paddingLeftRight' => '0',
@@ -2350,7 +2530,7 @@ class ClassYopPollImporter5x {
2350
  'textSize' => '14',
2351
  'textWeight' => 'normal',
2352
  'skin' => '',
2353
- 'colorScheme' => ''
2354
  ),
2355
  'buttons' => array(
2356
  'backgroundColor' => '#ffffff',
@@ -2361,7 +2541,7 @@ class ClassYopPollImporter5x {
2361
  'paddingTopBottom' => '5',
2362
  'textColor' => '#ffffff',
2363
  'textSize' => '14',
2364
- 'textWeight' => 'normal'
2365
  ),
2366
  'captcha' => array(),
2367
  'errors' => array(
@@ -2371,13 +2551,13 @@ class ClassYopPollImporter5x {
2371
  'paddingTopBottom' => '0',
2372
  'textColor' => '#000000',
2373
  'textSize' => '14',
2374
- 'textWeight' => 'normal'
2375
  ),
2376
  'custom' => array(
2377
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2378
  text-align: center;
2379
- }'
2380
- )
2381
  );
2382
  break;
2383
  }
@@ -2389,13 +2569,13 @@ class ClassYopPollImporter5x {
2389
  'borderColor' => '#6b7552',
2390
  'borderRadius' => '0',
2391
  'paddingLeftRight' => '10',
2392
- 'paddingTopBottom' => '10'
2393
  ),
2394
  'questions' => array(
2395
  'textColor' => '#333333',
2396
  'textSize' => '16',
2397
  'textWeight' => 'normal',
2398
- 'textAlign' => 'center'
2399
  ),
2400
  'answers' => array(
2401
  'paddingLeftRight' => '0',
@@ -2404,7 +2584,7 @@ class ClassYopPollImporter5x {
2404
  'textSize' => '14',
2405
  'textWeight' => 'normal',
2406
  'skin' => '',
2407
- 'colorScheme' => ''
2408
  ),
2409
  'buttons' => array(
2410
  'backgroundColor' => '#ffffff',
@@ -2415,7 +2595,7 @@ class ClassYopPollImporter5x {
2415
  'paddingTopBottom' => '5',
2416
  'textColor' => '#ffffff',
2417
  'textSize' => '14',
2418
- 'textWeight' => 'normal'
2419
  ),
2420
  'captcha' => array(),
2421
  'errors' => array(
@@ -2425,13 +2605,13 @@ class ClassYopPollImporter5x {
2425
  'paddingTopBottom' => '0',
2426
  'textColor' => '#000000',
2427
  'textSize' => '14',
2428
- 'textWeight' => 'normal'
2429
  ),
2430
  'custom' => array(
2431
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2432
  text-align: center;
2433
- }'
2434
- )
2435
  );
2436
  break;
2437
  }
@@ -2443,13 +2623,13 @@ class ClassYopPollImporter5x {
2443
  'borderColor' => '#d23c3d',
2444
  'borderRadius' => '0',
2445
  'paddingLeftRight' => '10',
2446
- 'paddingTopBottom' => '10'
2447
  ),
2448
  'questions' => array(
2449
  'textColor' => '#ffffff',
2450
  'textSize' => '16',
2451
  'textWeight' => 'normal',
2452
- 'textAlign' => 'center'
2453
  ),
2454
  'answers' => array(
2455
  'paddingLeftRight' => '0',
@@ -2458,7 +2638,7 @@ class ClassYopPollImporter5x {
2458
  'textSize' => '14',
2459
  'textWeight' => 'normal',
2460
  'skin' => '',
2461
- 'colorScheme' => ''
2462
  ),
2463
  'buttons' => array(
2464
  'backgroundColor' => '#595959',
@@ -2469,7 +2649,7 @@ class ClassYopPollImporter5x {
2469
  'paddingTopBottom' => '5',
2470
  'textColor' => '#ffffff',
2471
  'textSize' => '14',
2472
- 'textWeight' => 'normal'
2473
  ),
2474
  'captcha' => array(),
2475
  'errors' => array(
@@ -2479,13 +2659,13 @@ class ClassYopPollImporter5x {
2479
  'paddingTopBottom' => '0',
2480
  'textColor' => '#000000',
2481
  'textSize' => '14',
2482
- 'textWeight' => 'normal'
2483
  ),
2484
  'custom' => array(
2485
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2486
  text-align: center;
2487
- }'
2488
- )
2489
  );
2490
  break;
2491
  }
@@ -2497,13 +2677,13 @@ class ClassYopPollImporter5x {
2497
  'borderColor' => '#6b7552',
2498
  'borderRadius' => '0',
2499
  'paddingLeftRight' => '10',
2500
- 'paddingTopBottom' => '10'
2501
  ),
2502
  'questions' => array(
2503
  'textColor' => '#333333',
2504
  'textSize' => '16',
2505
  'textWeight' => 'normal',
2506
- 'textAlign' => 'center'
2507
  ),
2508
  'answers' => array(
2509
  'paddingLeftRight' => '0',
@@ -2512,7 +2692,7 @@ class ClassYopPollImporter5x {
2512
  'textSize' => '14',
2513
  'textWeight' => 'normal',
2514
  'skin' => '',
2515
- 'colorScheme' => ''
2516
  ),
2517
  'buttons' => array(
2518
  'backgroundColor' => '#ffffff',
@@ -2523,7 +2703,7 @@ class ClassYopPollImporter5x {
2523
  'paddingTopBottom' => '5',
2524
  'textColor' => '#ffffff',
2525
  'textSize' => '14',
2526
- 'textWeight' => 'normal'
2527
  ),
2528
  'captcha' => array(),
2529
  'errors' => array(
@@ -2533,13 +2713,13 @@ class ClassYopPollImporter5x {
2533
  'paddingTopBottom' => '0',
2534
  'textColor' => '#000000',
2535
  'textSize' => '14',
2536
- 'textWeight' => 'normal'
2537
  ),
2538
  'custom' => array(
2539
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2540
  text-align: center;
2541
- }'
2542
- )
2543
  );
2544
  break;
2545
  }
@@ -2551,13 +2731,13 @@ class ClassYopPollImporter5x {
2551
  'borderColor' => '#000000',
2552
  'borderRadius' => '5',
2553
  'paddingLeftRight' => '10',
2554
- 'paddingTopBottom' => '10'
2555
  ),
2556
  'questions' => array(
2557
  'textColor' => '#000',
2558
  'textSize' => '16',
2559
  'textWeight' => 'normal',
2560
- 'textAlign' => 'center'
2561
  ),
2562
  'answers' => array(
2563
  'paddingLeftRight' => '0',
@@ -2566,7 +2746,7 @@ class ClassYopPollImporter5x {
2566
  'textSize' => '14',
2567
  'textWeight' => 'normal',
2568
  'skin' => '',
2569
- 'colorScheme' => ''
2570
  ),
2571
  'buttons' => array(
2572
  'backgroundColor' => '#ffffff',
@@ -2577,7 +2757,7 @@ class ClassYopPollImporter5x {
2577
  'paddingTopBottom' => '5',
2578
  'textColor' => '#000',
2579
  'textSize' => '14',
2580
- 'textWeight' => 'normal'
2581
  ),
2582
  'captcha' => array(),
2583
  'errors' => array(
@@ -2587,13 +2767,13 @@ class ClassYopPollImporter5x {
2587
  'paddingTopBottom' => '0',
2588
  'textColor' => '#000000',
2589
  'textSize' => '14',
2590
- 'textWeight' => 'normal'
2591
  ),
2592
  'custom' => array(
2593
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2594
  text-align: center;
2595
- }'
2596
- )
2597
  );
2598
  break;
2599
  }
@@ -2619,11 +2799,25 @@ class ClassYopPollImporter5x {
2619
  if ( -1 == $response['response_code'] ) {
2620
  $table = 'bans';
2621
  $response_code = 1;
2622
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
2623
  } else {
2624
  $table = 'polls';
2625
  $response_code = $response['response_code'];
2626
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
2627
  }
2628
  break;
2629
  }
@@ -2632,11 +2826,25 @@ class ClassYopPollImporter5x {
2632
  if ( -1 == $response['response_code'] ) {
2633
  $table = 'votes';
2634
  $response_code = 1;
2635
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
2636
  } else {
2637
  $table = 'bans';
2638
  $response_code = $response['response_code'];
2639
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
2640
  }
2641
  break;
2642
  }
@@ -2645,11 +2853,25 @@ class ClassYopPollImporter5x {
2645
  if ( -1 == $response['response_code'] ) {
2646
  $table = 'logs';
2647
  $response_code = 1;
2648
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
 
 
 
 
 
 
 
2649
  } else {
2650
  $table = 'votes';
2651
  $response_code = $response['response_code'];
2652
- wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
 
 
 
 
 
 
 
2653
  }
2654
  break;
2655
  }
@@ -2658,10 +2880,23 @@ class ClassYopPollImporter5x {
2658
  if ( -1 == $response['response_code'] ) {
2659
  $response_code = 'done';
2660
  delete_option( 'yop_poll_old_version' );
2661
- wp_send_json_success( array( 'table' => 'logs', 'response_code' => $response_code, 'message' => $response['message'] ) );
 
 
 
 
 
 
2662
  } else {
2663
  $response_code = $response['response_code'];
2664
- wp_send_json_success( array( 'table' => 'logs', 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => $skip_table_check ) );
 
 
 
 
 
 
 
2665
  }
2666
  break;
2667
  }
46
  self::$checked_existence_polls = true;
47
  self::$polls_table_exists = true;
48
  }
49
+ if ( ! self::$checked_existence_polls ) {
50
  if ( self::check_if_table_exists( $polls_table_name ) && self::check_if_table_exists( $polls_meta_table_name ) ) {
51
  if ( ! self::check_if_column_exists( $polls_table_name, 'processed' ) ) {
52
  $wpdb->query( "ALTER TABLE `{$polls_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
57
  }
58
  if ( self::$checked_existence_polls && self::$polls_table_exists ) {
59
  self::$unprocessed_polls = $wpdb->get_var( "SELECT count(ID) FROM `{$polls_table_name}` WHERE `poll_title` != '' AND processed = false" );
60
+ $polls = $wpdb->get_results(
61
+ $wpdb->prepare(
62
+ "SELECT `ID`, `poll_title`, `poll_name`, `poll_author`, `poll_date`, `poll_status`, `poll_modified`, `poll_type`, `poll_start_date`, `poll_end_date`, `poll_total_votes`, `meta_key`, `meta_value` FROM `{$polls_table_name}` INNER JOIN `{$polls_meta_table_name}` ON `{$polls_table_name}`.`ID` = `{$polls_meta_table_name}`.`yop_poll_id` WHERE `poll_title` != '' AND `processed` = false LIMIT %d",
63
+ $query_limit
64
+ )
65
+ );
66
  if ( count( $polls ) > 0 ) {
67
  if ( self::check_if_table_exists( $polls_questions_table_name ) &&
68
+ self::check_if_table_exists( $polls_questions_meta_table_name ) ) {
69
+ $maxID = $wpdb->get_var( "SELECT MAX(`ID`) FROM `{$polls_questions_table_name}`" );
70
  self::$maxElementID = $maxID + 1;
71
  }
72
  foreach ( $polls as $poll ) {
73
  $unserialized_meta = unserialize( $poll->meta_value );
74
  $poll_style = self::create_css_from_template( '' !== $unserialized_meta['template'] ? $unserialized_meta['template'] : 1 );
75
  $skin_base = self::create_skin_base_from_template( '' !== $unserialized_meta['template'] ? $unserialized_meta['template'] : 1 );
76
+ $vote_perms = array();
77
  if ( isset( $unserialized_meta['vote_permisions'] ) ) {
78
  foreach ( $unserialized_meta['vote_permisions'] as $vp ) {
79
  if ( 'registered' === $vp ) {
86
  if ( 0 == count( $vote_perms ) ) {
87
  $vote_perms[] = 'wordpress';
88
  }
89
+ $results_moment = array();
90
  if ( isset( $unserialized_meta['view_results'] ) && is_array( $unserialized_meta['view_results'] ) ) {
91
  foreach ( $unserialized_meta['view_results'] as $vr ) {
92
  if ( 'after' === $vr ) {
103
  if ( 0 == count( $results_moment ) ) {
104
  $results_moment[] = 'after-vote';
105
  }
106
+ $show_results_to = array();
107
  if ( isset( $unserialized_meta['view_results_permissions'] ) && is_array( $unserialized_meta['view_results_permissions'] ) ) {
108
  foreach ( $unserialized_meta['view_results_permissions'] as $vrp ) {
109
  if ( 'registered' === $vrp ) {
127
  $sorting_results = $unserialized_meta['sorting_results'];
128
  }
129
  }
130
+ $newBlVoters = array();
131
  if ( isset( $unserialized_meta['blocking_voters'] ) && is_array( $unserialized_meta['blocking_voters'] ) ) {
132
  foreach ( $unserialized_meta['blocking_voters'] as $bv ) {
133
  $blocking_voters = 'no-block';
206
  $poll_end_date = '';
207
  }
208
  $adminUser = wp_get_current_user();
209
+ $pollArray = array(
210
  'ID' => $poll->ID,
211
  'name' => $poll->poll_title,
212
  'poll_author' => $poll->poll_author,
216
  'total_submited_answers' => $poll->poll_total_votes,
217
  'added_date' => $poll->poll_date,
218
  'modified_date' => $poll->poll_modified,
219
+ 'design' => array(
220
  'template' => 1,
221
  'templateBase' => $template_base,
222
  'skinBase' => $skin_base,
223
+ 'style' => $poll_style,
224
+ ),
225
+ 'options' => array(
226
+ 'poll' => array(
227
  'voteButtonLabel' => isset( $unserialized_meta['vote_button_label'] ) && '' != $unserialized_meta['vote_button_label'] ? $unserialized_meta['vote_button_label'] : 'Vote',
228
  'showResultsLink' => 'no',
229
  'resultsLabelText' => 'Results',
233
  'startDateCustom' => $poll->poll_start_date,
234
  'endDateOption' => $poll_end_date_option,
235
  'endDateCustom' => $poll_end_date,
236
+ 'showEndDateOnFrontend' => 'no',
237
  'showEndDateOnFrontendLocation' => 'top',
238
  'showEndDateOnFrontendText' => '',
239
  'redirectAfterVote' => isset( $unserialized_meta['redirect_after_vote'] ) && '' != $unserialized_meta['redirect_after_vote'] ? $unserialized_meta['redirect_after_vote'] : 'no',
260
  'gdprSolution' => 'consent',
261
  'gdprConsentText' => '',
262
  'loadWithAjax' => 'no',
263
+ 'notificationMessageLocation' => 'top',
264
+ ),
265
+ 'access' => array(
266
  'votePermissions' => $vote_perms,
267
  'blockVoters' => $newBlVoters,
268
+ 'blockLengthType' => 'limited-time',
269
  'blockForValue' => isset( $unserialized_meta['blocking_voters_interval_value'] ) ? $unserialized_meta['blocking_voters_interval_value'] : '',
270
  'blockForPeriod' => isset( $unserialized_meta['blocking_voters_interval_unit'] ) ? $unserialized_meta['blocking_voters_interval_unit'] : 'minutes',
271
  'limitVotesPerUser' =>
272
  isset( $unserialized_meta['limit_number_of_votes_per_user'] ) && '' != $unserialized_meta['limit_number_of_votes_per_user'] ? $unserialized_meta['limit_number_of_votes_per_user'] : 'no',
273
+ 'votesPerUserAllowed' => isset( $unserialized_meta['number_of_votes_per_user'] ) && '' != $unserialized_meta['number_of_votes_per_user'] ? $unserialized_meta['number_of_votes_per_user'] : 3,
274
+ ),
275
+ 'results' => array(
276
  'showResultsMoment' => $results_moment,
277
  'customDateResults' => isset( $unserialized_meta['view_results_start_date'] ) ? $unserialized_meta['view_results_start_date'] : '',
278
  'showResultsTo' => $show_results_to,
281
  'sortResults' => $sorting_results,
282
  'sortResultsRule' => isset( $unserialized_meta['sorting_results_direction'] ) && '' != $unserialized_meta['sorting_results_direction'] ? $unserialized_meta['sorting_results_direction'] : 'asc',
283
  'displayResultsAs' => $displayResultsAs,
284
+ 'resultsDetails' => $resultsDetails,
285
+ ),
286
+ ),
287
+ );
288
+ $pollElementsArray = array();
289
  if ( self::check_if_table_exists( $polls_questions_table_name ) && self::check_if_table_exists( $polls_questions_meta_table_name ) ) {
290
+ $pollQuestions = $wpdb->get_results(
291
  $wpdb->prepare(
292
+ "SELECT * FROM `{$polls_questions_table_name}` INNER JOIN `{$polls_questions_meta_table_name}` ON
293
+ `{$polls_questions_table_name}`.`ID` = `$polls_questions_meta_table_name`.`yop_poll_question_id` WHERE `poll_id` = %s",
294
  $poll->ID
295
  )
296
  );
297
  foreach ( $pollQuestions as $pQ ) {
298
+ $qArr = array();
299
  $unserialized_q_meta = unserialize( $pQ->meta_value );
300
  $pollQuestionAnswers = $wpdb->get_results(
301
  $wpdb->prepare(
302
+ "SELECT * FROM `{$polls_answers_table_name}` INNER JOIN `{$polls_answers_meta_table_name}` ON `{$polls_answers_table_name}`.`ID` = `{$polls_answers_meta_table_name}`.`yop_poll_answer_id` WHERE `poll_id` = %s AND `question_id` = %s",
303
  $poll->ID,
304
  $pQ->ID
305
  )
306
  );
307
  $pollQuestionCustoms = $wpdb->get_results(
308
  $wpdb->prepare(
309
+ "SELECT `custom_field`, `required` FROM `{$polls_questions_table_name}` INNER JOIN `{$polls_questions_customs_table}` on `{$polls_questions_table_name}`.`ID` = `{$polls_questions_customs_table}`.`question_id` WHERE `{$polls_questions_table_name}`.`poll_id` = %s AND `question_id` = %s",
310
  $poll->ID,
311
  $pQ->ID
312
  )
313
  );
314
  $x = 0;
315
+ $pollQuestionAnswersArray = array();
316
  switch ( $pQ->type ) {
317
  case 'text': {
318
  foreach ( $pollQuestionAnswers as $pQA ) {
319
  $unserialized_a_meta = unserialize( $pQA->meta_value );
320
  switch ( $pQA->type ) {
321
  case 'text': {
322
+ $pQAA = array(
323
  'ID' => $pQA->ID,
324
  'question_order' => $pQA->question_order,
325
  'type' => 'text',
326
  'text' => stripslashes( $pQA->answer ),
327
+ 'options' => array(
328
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
329
  'makeLink' => 'no',
330
  'link' => '',
331
+ 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '',
332
+ ),
333
+ );
334
  break;
335
  }
336
  case 'other': {
337
+ $pQAA = array(
338
  'ID' => $pQA->ID,
339
  'question_order' => $pQA->question_order,
340
  'type' => 'text',
341
  'text' => stripslashes( $pQA->answer ),
342
  'is_other' => true,
343
+ 'options' => array(
344
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
345
  'makeLink' => 'no',
346
  'link' => '',
347
+ 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '',
348
+ ),
349
+ );
350
  break;
351
  }
352
  case 'image': {
353
+ $pQAA = array(
354
  'ID' => $pQA->ID,
355
  'question_order' => $pQA->question_order,
356
  'type' => 'image',
357
  'text' => stripslashes( $pQA->answer ),
358
+ 'options' => array(
359
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
360
  'makeLink' => 'no',
361
  'addText' => 'no',
362
  'text' => '',
363
+ 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '#000',
364
+ ),
365
+ );
366
  break;
367
  }
368
  }
369
+ $pollQuestionAnswersArray[ $x ] = $pQAA;
370
  $x ++;
371
  }
372
  if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
380
  } else {
381
  $answersDisplay = 'vertical';
382
  }
383
+ $pollElementsArray[] = array(
384
  'ID' => $pQ->ID,
385
  'type' => 'text-question',
386
  'text' => stripslashes( $pQ->question ),
387
  'poll_order' => $pQ->poll_order,
388
  'answers' => $pollQuestionAnswersArray,
389
+ 'options' => array(
390
  'allowOtherAnswers' => isset( $unserialized_q_meta['allow_other_answers'] ) && '' != $unserialized_q_meta['allow_other_answers'] ? $unserialized_q_meta['allow_other_answers'] : 'no',
391
  'otherAnswersLabel' => isset( $unserialized_q_meta['other_answers_label'] ) && '' != trim( $unserialized_q_meta['other_answers_label'] ) ? $unserialized_q_meta['other_answers_label'] : 'Other',
392
  'addOtherAnswers' =>
402
  'answersDisplay' => $answersDisplay,
403
  'answersColumns' =>
404
  isset( $unserialized_q_meta['display_answers_tabulated_cols'] ) && '' !== $unserialized_q_meta['display_answers_tabulated_cols'] ? $unserialized_q_meta['display_answers_tabulated_cols'] : 2,
405
+ 'answersSort' => 'as-defined',
406
+ ),
407
+ );
408
  break;
409
  }
410
  case 'media': {
412
  $unserialized_a_meta = unserialize( $pQA->meta_value );
413
  switch ( $pQA->type ) {
414
  case 'text': {
415
+ $pQAA = array(
416
  'ID' => $pQA->ID,
417
  'question_order' => $pQA->question_order,
418
  'type' => 'text',
419
  'text' => stripslashes( $pQA->answer ),
420
+ 'options' => array(
421
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
422
  'makeLink' => 'no',
423
  'link' => '',
424
+ 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '',
425
+ ),
426
+ );
427
  break;
428
  }
429
  case 'image': {
430
+ $pQAA = array(
431
  'ID' => $pQA->ID,
432
  'question_order' => $pQA->question_order,
433
  'type' => 'image',
434
  'text' => stripslashes( $pQA->answer ),
435
+ 'options' => array(
436
  'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
437
  'makeLink' => 'no',
438
  'addText' => 'no',
439
  'text' => '',
440
+ 'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '#000',
441
+ ),
442
+ );
443
  break;
444
  }
445
  }
446
+ $pollQuestionAnswersArray[ $x ] = $pQAA;
447
  $x ++;
448
  }
449
  if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
457
  } else {
458
  $answersDisplay = 'vertical';
459
  }
460
+ $pollElementsArray[] = array(
461
  'ID' => $pQ->ID,
462
  'type' => 'media-question',
463
  'text' => stripslashes( $pQ->question ),
464
  'poll_order' => $pQ->poll_order,
465
  'answers' => $pollQuestionAnswersArray,
466
+ 'options' => array(
467
  'allowOtherAnswers' => isset( $unserialized_q_meta['allow_other_answers'] ) && '' != $unserialized_q_meta['allow_other_answers'] ? $unserialized_q_meta['allow_other_answers'] : 'no',
468
  'otherAnswersLabel' => isset( $unserialized_q_meta['other_answers_label'] ) && '' != trim( $unserialized_q_meta['other_answers_label'] ) ? $unserialized_q_meta['other_answers_label'] : 'Other',
469
  'addOtherAnswers' =>
479
  'answersDisplay' => $answersDisplay,
480
  'answersColumns' =>
481
  isset( $unserialized_q_meta['display_answers_tabulated_cols'] ) && '' !== $unserialized_q_meta['display_answers_tabulated_cols'] ? $unserialized_q_meta['display_answers_tabulated_cols'] : 2,
482
+ 'answersSort' => 'as-defined',
483
+ ),
484
+ );
485
  break;
486
  }
487
  }
488
  foreach ( $pollQuestionCustoms as $pQC ) {
489
+ $pollElementsArray[] = array(
490
  'ID' => self::$maxElementID,
491
  'poll_order' => 1,
492
  'type' => 'custom-field',
493
  'text' => stripslashes( $pQC->custom_field ),
494
+ 'options' => array(
495
  'makeRequired' => 'yes' === $pQC->required ? 'yes' : 'no',
496
+ 'cType' => 'textfield',
497
+ ),
498
+ );
499
  self::$maxElementID++;
500
  }
501
  }
575
  private static function import_bans( $skip_table_check = false ) {
576
  global $wpdb;
577
  $polls_bans_table = $GLOBALS['wpdb']->prefix . 'yop2_poll_bans';
578
+ $values = array();
579
  $current_user = wp_get_current_user();
580
  if ( $skip_table_check ) {
581
  self::$checked_existence_bans = true;
582
  self::$bans_table_exists = true;
583
  }
584
+ if ( ! self::$checked_existence_bans ) {
585
  if ( self::check_if_table_exists( $polls_bans_table ) ) {
586
  if ( ! self::check_if_column_exists( $polls_bans_table, 'processed' ) ) {
587
  $wpdb->query( "ALTER TABLE `{$polls_bans_table}` ADD processed BOOLEAN DEFAULT FALSE " );
592
  }
593
 
594
  if ( self::$checked_existence_bans && self::$bans_table_exists ) {
595
+ self::$unprocessed_bans = $wpdb->get_var( "SELECT COUNT(ID) FROM `{$polls_bans_table}` WHERE `processed` = false" );
596
+ $bans = $wpdb->get_results(
597
+ $wpdb->prepare(
598
+ "SELECT * FROM `{$polls_bans_table}` LIMIT %d",
599
+ self::$ajax_limit
600
+ )
601
+ );
602
+ $bansIds = array();
603
  if ( count( $bans ) > 0 ) {
604
  foreach ( $bans as $ban ) {
605
+ $values[] = $wpdb->prepare(
606
+ '(%d, %d, %s, %s, %s)',
607
+ $current_user->ID,
608
+ $ban->poll_id,
609
+ $ban->type,
610
+ $ban->value,
611
+ current_time( 'mysql' )
612
+ );
613
+ $bansIds[] = $wpdb->prepare( '%s', $ban->id );
614
  }
615
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
616
  if ( count( $values ) > 0 ) {
618
  $result = $wpdb->query( $query );
619
  if ( ! $result ) {
620
  $last_error = $wpdb->last_error;
621
+ return array(
622
+ 'response_code' => 1,
623
+ 'message' => esc_html__( $last_error, 'yop-poll' ),
624
+ );
625
  } else {
626
+ $res = $wpdb->query( "UPDATE {$polls_bans_table} SET `processed` = true WHERE `ID` IN (" . implode( ',', $bansIds ) . ')' );
627
  self::$processed_bans += $res;
628
  if ( self::$processed_bans == self::$unprocessed_bans ) {
629
+ return array(
630
+ 'response_code' => - 1,
631
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_bans . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_bans . esc_html__( ' records on table bans.', 'yop-poll' ),
632
+ );
633
  } else {
634
+ return array(
635
+ 'response_code' => 1,
636
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_bans . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_bans . esc_html__( ' remaining records on table bans.', 'yop-poll' ),
637
+ );
638
  }
639
  }
640
  }
641
  } else {
642
+ return array(
643
+ 'response_code' => - 1,
644
+ 'message' => esc_html__( 'No bans to process.', 'yop-poll' ),
645
+ );
646
  }
647
  } else {
648
+ return array(
649
+ 'response_code' => - 1,
650
+ 'message' => esc_html__( 'No bans table, skipping.', 'yop-poll' ),
651
+ );
652
  }
653
 
654
  }
662
  self::$checked_existence_votes = true;
663
  self::$votes_table_exists = true;
664
  }
665
+ if ( ! self::$checked_existence_votes ) {
666
  if ( self::check_if_table_exists( $polls_results_table_name ) ) {
667
  if ( ! self::check_if_column_exists( $polls_results_table_name, 'processed' ) ) {
668
  $wpdb->query( "ALTER TABLE `{$polls_results_table_name}` ADD processed BOOLEAN DEFAULT FALSE " );
673
  }
674
 
675
  if ( self::$checked_existence_votes && self::$votes_table_exists ) {
676
+ self::$unprocessed_votes = $wpdb->get_var( "SELECT COUNT(ID) FROM `{$polls_results_table_name}` WHERE processed = false" );
677
+ $results = $wpdb->get_results(
678
+ $wpdb->prepare(
679
+ "SELECT `{$polls_results_table_name}`.* FROM `{$polls_results_table_name}` WHERE `processed` = false LIMIT %d",
680
+ self::$ajax_limit
681
+ )
682
+ );
683
+ if ( 0 === count( $results ) ) {
684
+ return array(
685
+ 'response_code' => - 1,
686
+ 'message' => esc_html__( 'No votes to process.', 'yop-poll' ),
687
+ );
688
  } else {
689
+ $voteData = array(
690
+ 'elements' => array(),
691
+ 'user' => array(),
692
+ );
693
+ $votesArray = array();
694
+ $resultsIds = array();
695
  foreach ( $results as $result ) {
696
+ $voteData = array(
697
+ 'elements' => array(),
698
+ 'user' => array(),
699
+ );
700
+ $resultsIds[] = $wpdb->prepare( '%s', $result->ID );
701
  $result_details = get_object_vars( json_decode( $result->result_details ) );
702
  foreach ( $result_details as $rd ) {
703
+ $a_data = array();
704
  foreach ( $rd->a as $answer_id ) {
705
+ $a_data[] = array(
706
  'id' => $answer_id,
707
+ 'data' => true,
708
+ );
709
+ $wpdb->query(
710
+ $wpdb->prepare(
711
+ "UPDATE `{$GLOBALS['wpdb']->yop_poll_subelements}` SET `total_submits` = ( `total_submits` + 1 ) WHERE `id` = %d",
712
+ array( $answer_id )
713
+ )
714
+ );
715
 
716
  }
717
+ $voteData['elements'][] = array(
718
  'id' => $rd->id,
719
  'type' => 'question',
720
+ 'data' => $a_data,
721
+ );
722
  if ( property_exists( $rd, 'cf' ) && count( $rd->cf ) > 0 ) {
723
+ $customs_array = array();
724
+ foreach ( $rd->cf as $custom_item ) {
725
+ $customs_array[] = $wpdb->prepare( '%s', $custom_item );
726
+ }
727
+ $customs = $wpdb->get_results( "SELECT `id`, `user_id`,`custom_field_value` FROM `{$polls_results_customs_table_name}` WHERE ID IN (" . implode( ',', $customs_array ) . ')' );
728
  if ( $customs ) {
729
  foreach ( $customs as $cust ) {
730
+ $custom_text = $wpdb->get_var(
731
+ $wpdb->prepare(
732
+ "SELECT `custom_field` FROM {$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields WHERE ID = %s",
733
+ $cust->id
734
+ )
735
+ );
736
+ $added_custom = $wpdb->get_var(
737
+ $wpdb->prepare(
738
+ "SELECT `id` FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `poll_id` = %d AND `etext` = %s LIMIT 1",
739
+ array(
740
+ $result->poll_id,
741
+ $custom_text,
742
+ )
743
+ )
744
+ );
745
  if ( '' != $added_custom && $added_custom > 0 ) {
746
  $custom_id = $added_custom;
747
  } else {
748
+ $wpdb->insert(
749
+ $GLOBALS['wpdb']->yop_poll_elements,
750
+ array(
751
+ 'poll_id' => $result->poll_id,
752
+ 'author' => $current_user->ID,
753
+ 'etext' => 'Custom field',
754
+ 'etype' => 'custom_field',
755
+ 'status' => 'active',
756
+ 'meta_data' => serialize( ['makeRequired' => 'no'] ),
757
+ 'added_date' => date( 'Y-m-d H:i:s' ),
758
+ 'modified_date' => date( 'Y-m-d H:i:s' ),
759
+ ),
760
+ array(
761
+ '%d',
762
+ '%d',
763
+ '%s',
764
+ '%s',
765
+ '%s',
766
+ '%s',
767
+ '%s',
768
+ '%s',
769
+ )
770
+ );
771
  $custom_id = $wpdb->insert_id;
772
  }
773
+ $voteData['elements'][] = array(
774
  'id' => $custom_id,
775
  'type' => 'custom-field',
776
+ 'data' => [$cust->custom_field_value],
777
+ );
778
  }
779
  }
780
  }
781
  }
782
+ $voteData['user'] = array(
783
  'first_name' => '',
784
+ 'last_name' => '',
785
+ );
786
  $data = array(
787
  'poll_id' => $result->poll_id,
788
  'user_id' => $result->user_id,
794
  'voter_fingerprint' => '',
795
  'vote_data' => serialize( $voteData ),
796
  'status' => 'active',
797
+ 'added_date' => $result->vote_date,
798
+ );
799
+ $votesArray[] = $wpdb->prepare(
800
+ '(%d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
801
+ $data['poll_id'],
802
+ $data['user_id'],
803
+ $data['user_email'],
804
+ $data['user_type'],
805
+ $data['ipaddress'],
806
+ $data['tracking_id'],
807
+ $data['voter_id'],
808
+ $data['voter_fingerprint'],
809
+ $data['vote_data'],
810
+ $data['status'],
811
+ $data['added_date']
812
  );
 
 
813
  }
814
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_votes}` (`poll_id`, `user_id`, `user_email`, `user_type`, `ipaddress`, `tracking_id`, `voter_id`, `voter_fingerprint`, `vote_data`,
815
  `status`, `added_date`) VALUES ";
817
  $query .= implode( ",\n", $votesArray );
818
  $response = $wpdb->query( $query );
819
  if ( $response ) {
820
+ $result = $wpdb->query( "UPDATE `{$polls_results_table_name}` SET `processed` = true WHERE ID IN (" . implode( ',', $resultsIds ) . ')' );
821
  self::$processed_votes += $result;
822
  if ( self::$processed_votes == self::$unprocessed_votes ) {
823
+ return array(
824
+ 'response_code' => -1,
825
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_votes . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_votes . esc_html__( ' records on table votes.', 'yop-poll' ),
826
+ );
827
  } else {
828
+ return array(
829
+ 'response_code' => 1,
830
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_votes . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_votes . esc_html__( ' remaining records on table votes.', 'yop-poll' ),
831
+ );
832
  }
833
  } else {
834
+ return array(
835
+ 'response_code' => 1,
836
+ 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ),
837
+ );
838
  }
839
  } else {
840
+ return array(
841
+ 'response_code' => - 1,
842
+ 'message' => esc_html__( 'No votes to process.', 'yop-poll' ),
843
+ );
844
  }
845
  }
846
  } else {
847
+ return array(
848
+ 'response_code' => - 1,
849
+ 'message' => esc_html__( 'No votes table, skipping.', 'yop-poll' ),
850
+ );
851
  }
852
 
853
  }
871
  }
872
  }
873
  if ( self::$checked_existence_logs && self::$logs_table_exists ) {
874
+ self::$unprocessed_logs = $wpdb->get_var( "SELECT COUNT(ID) FROM `{$polls_logs_table_name}` WHERE processed = false" );
875
+ $log_results = $wpdb->get_results(
876
+ $wpdb->prepare(
877
+ "SELECT `{$polls_logs_table_name}`.* FROM `{$polls_logs_table_name}` WHERE `processed` = false LIMIT %d",
878
+ self::$ajax_limit
879
+ )
880
+ );
881
  if ( 0 == count( $log_results ) ) {
882
+ return array(
883
+ 'response_code' => - 1,
884
+ 'message' => esc_html__( 'No logs to process.', 'yop-poll' ),
885
+ );
886
  } else {
887
+ $logData = array(
888
+ 'elements' => array(),
889
+ 'user' => array(),
890
+ );
891
+ $logsArray = array();
892
+ $logsIds = array();
893
  foreach ( $log_results as $lresult ) {
894
+ $logData = array(
895
+ 'elements' => array(),
896
+ 'user' => array(),
897
+ );
898
+ $logsIds[] = $wpdb->prepare( '%s', $lresult->ID );
899
  if ( 'Success' === $lresult->message ) {
900
  $lresult_details = get_object_vars( json_decode( $lresult->vote_details ) );
901
+ $q_data = array();
902
  foreach ( $lresult_details as $rd ) {
903
+ $a_data = array();
904
  foreach ( $rd->a as $answer_id ) {
905
+ $a_data[] = array(
906
  'id' => $answer_id,
907
+ 'data' => true,
908
+ );
909
  }
910
+ $logData['elements'][] = array(
911
  'id' => $rd->id,
912
  'type' => 'question',
913
+ 'data' => $a_data,
914
+ );
915
  if ( count( $rd->cf ) > 0 ) {
916
+ $customs_array = array();
917
+ foreach ( $rd->cf as $custom_item ) {
918
+ $customs_array[] = $wpdb->prepare( '%s', $custom_item );
919
+ }
920
+ $customs = $wpdb->get_results( "SELECT `id`, `custom_field_value` FROM `{$polls_results_customs_table_name}` WHERE ID IN (" . implode( ',', $customs_array ) . ')' );
921
  if ( $customs ) {
922
  foreach ( $customs as $cust ) {
923
  $custom_text = $wpdb->get_var(
924
  $wpdb->prepare(
925
+ "SELECT `custom_field` FROM {$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields WHERE ID = %s",
926
  $cust->id
927
  )
928
  );
929
+ $added_custom = $wpdb->get_var(
930
+ $wpdb->prepare(
931
+ "SELECT `id` FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `poll_id` = %d AND `etext` = %s LIMIT 1",
932
+ array(
933
+ $lresult->poll_id,
934
+ $custom_text,
935
+ )
936
+ )
937
+ );
938
  if ( '' != $added_custom && $added_custom > 0 ) {
939
  $custom_id = $added_custom;
940
  } else {
941
+ $wpdb->insert(
942
+ $GLOBALS['wpdb']->yop_poll_elements,
943
+ array(
944
+ 'poll_id' => $lresult->poll_id,
945
+ 'author' => $current_user->ID,
946
+ 'etext' => 'Custom field',
947
+ 'etype' => 'custom_field',
948
+ 'status' => 'active',
949
+ 'meta_data' => serialize( ['makeRequired' => 'no'] ),
950
+ 'added_date' => date( 'Y-m-d H:i:s' ),
951
+ 'modified_date' => date( 'Y-m-d H:i:s' ),
952
+ ),
953
+ array(
954
+ '%d',
955
+ '%d',
956
+ '%s',
957
+ '%s',
958
+ '%s',
959
+ '%s',
960
+ '%s',
961
+ '%s',
962
+ )
963
+ );
964
  $custom_id = $wpdb->insert_id;
965
  }
966
+ $logData['elements'][] = array(
967
  'id' => $custom_id,
968
  'type' => 'custom-field',
969
+ 'data' => array(
970
+ $cust->custom_field_value,
971
+ ),
972
+ );
973
  }
974
  }
975
  }
976
  }
977
  }
978
 
979
+ $logData['user'] = array(
980
  'first_name' => '',
981
+ 'last_name' => '',
982
+ );
983
  $vote_message = [ $lresult->message ];
984
  $data = array(
985
  'poll_id' => $lresult->poll_id,
993
  'voter_fingerprint' => '',
994
  'vote_data' => serialize( $logData ),
995
  'vote_message' => serialize( $vote_message ),
996
+ 'added_date' => $lresult->vote_date,
997
+ );
998
+ $logsArray[] = $wpdb->prepare(
999
+ '(%d, %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
1000
+ $data['poll_id'],
1001
+ $data['poll_author'],
1002
+ $data['user_id'],
1003
+ $data['user_email'],
1004
+ $data['user_type'],
1005
+ $data['ipaddress'],
1006
+ $data['tracking_id'],
1007
+ $data['voter_id'],
1008
+ $data['voter_fingerprint'],
1009
+ $data['vote_data'],
1010
+ $data['vote_message'],
1011
+ $data['added_date']
1012
  );
 
 
1013
  }
1014
  $query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_logs}` (`poll_id`, `poll_author`, `user_id`, `user_email`, `user_type`, `ipaddress`, `tracking_id`, `voter_id`, `voter_fingerprint`, `vote_data`,
1015
  `vote_message`, `added_date`) VALUES ";
1016
  $query .= implode( ",\n", $logsArray );
1017
  $response = $wpdb->query( $query );
1018
  if ( $response ) {
1019
+ $result = $wpdb->query( "UPDATE `{$polls_logs_table_name}` SET `processed` = true WHERE `ID` IN (" . implode( ',', $logsIds ) . ')' );
1020
  self::$processed_logs += $result;
1021
  if ( self::$processed_logs == self::$unprocessed_logs ) {
1022
+ return array(
1023
+ 'response_code' => -1,
1024
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_logs . esc_html__( ' out of ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' records on table logs.', 'yop-poll' ),
1025
+ );
1026
  } else {
1027
+ return array(
1028
+ 'response_code' => 1,
1029
+ 'message' => esc_html__( 'Processed ', 'yop-poll' ) . self::$processed_logs . esc_html__( ' out of remaining ', 'yop-poll' ) . self::$unprocessed_logs . esc_html__( ' records on table logs.', 'yop-poll' ),
1030
+ );
1031
  }
1032
  } else {
1033
+ return array(
1034
+ 'response_code' => 1,
1035
+ 'message' => esc_html__( $wpdb->last_error, 'yop-poll' ),
1036
+ );
1037
  }
1038
  }
1039
  } else {
1040
+ return array(
1041
+ 'response_code' => - 1,
1042
+ 'message' => esc_html__( 'No logs table, skipping.', 'yop-poll' ),
1043
+ );
1044
  }
1045
  }
1046
 
1047
  private static function check_if_table_exists( $table_name ) {
1048
  global $wpdb;
1049
+ if ( 0 == $wpdb->get_var(
1050
+ $wpdb->prepare(
1051
+ 'SELECT COUNT(1) FROM `information_schema`.`tables` WHERE `table_schema` = %s AND `table_name` = %s',
1052
+ DB_NAME,
1053
+ $table_name
1054
+ )
1055
+ ) ) {
1056
  return false;
1057
  }
1058
  return true;
1060
 
1061
  private static function check_if_column_exists( $table_name, $column_name ) {
1062
  global $wpdb;
1063
+ if ( 0 == $wpdb->get_var(
1064
+ $wpdb->prepare(
1065
  'SELECT count(1) FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = %s AND `TABLE_NAME` = %s AND `COLUMN_NAME` = %s ',
1066
+ DB_NAME,
1067
+ $table_name,
1068
+ $column_name
1069
+ )
1070
+ ) ) {
1071
  return false;
1072
  }
1073
  return true;
1197
  }
1198
 
1199
  private static function create_css_from_template( $template_id ) {
1200
+ $css_array = array();
1201
  switch ( $template_id ) {
1202
  case 1: {
1203
  $css_array = array(
1207
  'borderColor' => '#ffffff',
1208
  'borderRadius' => '0',
1209
  'paddingLeftRight' => '10',
1210
+ 'paddingTopBottom' => '10',
1211
  ),
1212
  'questions' => array(
1213
  'textColor' => '#000',
1214
  'textSize' => '16',
1215
  'textWeight' => 'normal',
1216
+ 'textAlign' => 'center',
1217
  ),
1218
  'answers' => array(
1219
  'paddingLeftRight' => '0',
1222
  'textSize' => '14',
1223
  'textWeight' => 'normal',
1224
  'skin' => '',
1225
+ 'colorScheme' => '',
1226
  ),
1227
  'buttons' => array(
1228
  'backgroundColor' => '#ffffff',
1233
  'paddingTopBottom' => '5',
1234
  'textColor' => '#000',
1235
  'textSize' => '14',
1236
+ 'textWeight' => 'normal',
1237
  ),
1238
  'captcha' => array(),
1239
  'errors' => array(
1243
  'paddingTopBottom' => '0',
1244
  'textColor' => '#000000',
1245
  'textSize' => '14',
1246
+ 'textWeight' => 'normal',
1247
  ),
1248
  'custom' => array(
1249
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1250
  text-align: center;
1251
+ }',
1252
+ ),
1253
  );
1254
  break;
1255
  }
1261
  'borderColor' => '#EEEEEE',
1262
  'borderRadius' => '0',
1263
  'paddingLeftRight' => '10',
1264
+ 'paddingTopBottom' => '10',
1265
  ),
1266
  'questions' => array(
1267
  'textColor' => '#000',
1268
  'textSize' => '16',
1269
  'textWeight' => 'normal',
1270
+ 'textAlign' => 'center',
1271
  ),
1272
  'answers' => array(
1273
  'paddingLeftRight' => '0',
1276
  'textSize' => '14',
1277
  'textWeight' => 'normal',
1278
  'skin' => '',
1279
+ 'colorScheme' => '',
1280
  ),
1281
  'buttons' => array(
1282
  'backgroundColor' => '#ffffff',
1287
  'paddingTopBottom' => '5',
1288
  'textColor' => '#000',
1289
  'textSize' => '14',
1290
+ 'textWeight' => 'normal',
1291
  ),
1292
  'captcha' => array(),
1293
  'errors' => array(
1297
  'paddingTopBottom' => '0',
1298
  'textColor' => '#000000',
1299
  'textSize' => '14',
1300
+ 'textWeight' => 'normal',
1301
  ),
1302
  'custom' => array(
1303
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1304
  text-align: center;
1305
+ }',
1306
+ ),
1307
  );
1308
  break;
1309
  }
1315
  'borderColor' => '#555555',
1316
  'borderRadius' => '0',
1317
  'paddingLeftRight' => '10',
1318
+ 'paddingTopBottom' => '10',
1319
  ),
1320
  'questions' => array(
1321
  'textColor' => '#ffffff',
1322
  'textSize' => '16',
1323
  'textWeight' => 'normal',
1324
+ 'textAlign' => 'center',
1325
  ),
1326
  'answers' => array(
1327
  'paddingLeftRight' => '0',
1330
  'textSize' => '14',
1331
  'textWeight' => 'normal',
1332
  'skin' => '',
1333
+ 'colorScheme' => '',
1334
  ),
1335
  'buttons' => array(
1336
  'backgroundColor' => '#ffffff',
1341
  'paddingTopBottom' => '5',
1342
  'textColor' => '#000',
1343
  'textSize' => '14',
1344
+ 'textWeight' => 'normal',
1345
  ),
1346
  'captcha' => array(),
1347
  'errors' => array(
1351
  'paddingTopBottom' => '0',
1352
  'textColor' => '#000000',
1353
  'textSize' => '14',
1354
+ 'textWeight' => 'normal',
1355
  ),
1356
  'custom' => array(
1357
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1358
  text-align: center;
1359
+ }',
1360
+ ),
1361
  );
1362
  break;
1363
  }
1369
  'borderColor' => '#327BD6',
1370
  'borderRadius' => '0',
1371
  'paddingLeftRight' => '10',
1372
+ 'paddingTopBottom' => '10',
1373
  ),
1374
  'questions' => array(
1375
  'textColor' => '#ffffff',
1376
  'textSize' => '14',
1377
  'textWeight' => 'normal',
1378
+ 'textAlign' => 'center',
1379
  ),
1380
  'answers' => array(
1381
  'paddingLeftRight' => '0',
1384
  'textSize' => '14',
1385
  'textWeight' => 'normal',
1386
  'skin' => '',
1387
+ 'colorScheme' => '',
1388
  ),
1389
  'buttons' => array(
1390
  'backgroundColor' => '#ffffff',
1395
  'paddingTopBottom' => '5',
1396
  'textColor' => '#000',
1397
  'textSize' => '14',
1398
+ 'textWeight' => 'normal',
1399
  ),
1400
  'captcha' => array(),
1401
  'errors' => array(
1405
  'paddingTopBottom' => '0',
1406
  'textColor' => '#000000',
1407
  'textSize' => '14',
1408
+ 'textWeight' => 'normal',
1409
  ),
1410
  'custom' => array(
1411
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1412
  text-align: center;
1413
+ }',
1414
+ ),
1415
  );
1416
  break;
1417
  }
1423
  'borderColor' => '#ffffff',
1424
  'borderRadius' => '0',
1425
  'paddingLeftRight' => '10',
1426
+ 'paddingTopBottom' => '10',
1427
  ),
1428
  'questions' => array(
1429
  'textColor' => '#ffffff',
1430
  'textSize' => '14',
1431
  'textWeight' => 'normal',
1432
+ 'textAlign' => 'center',
1433
  ),
1434
  'answers' => array(
1435
  'paddingLeftRight' => '0',
1438
  'textSize' => '14',
1439
  'textWeight' => 'normal',
1440
  'skin' => '',
1441
+ 'colorScheme' => '',
1442
  ),
1443
  'buttons' => array(
1444
  'backgroundColor' => '#ffffff',
1449
  'paddingTopBottom' => '5',
1450
  'textColor' => '#000',
1451
  'textSize' => '14',
1452
+ 'textWeight' => 'normal',
1453
  ),
1454
  'captcha' => array(),
1455
  'errors' => array(
1459
  'paddingTopBottom' => '0',
1460
  'textColor' => '#000000',
1461
  'textSize' => '14',
1462
+ 'textWeight' => 'normal',
1463
  ),
1464
  'custom' => array(
1465
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1468
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1469
  background-color: #327BD6;
1470
  padding: 5px 0;
1471
+ }',
1472
+ ),
1473
  );
1474
  break;
1475
  }
1481
  'borderColor' => '#327BD6',
1482
  'borderRadius' => '0',
1483
  'paddingLeftRight' => '10',
1484
+ 'paddingTopBottom' => '10',
1485
  ),
1486
  'questions' => array(
1487
  'textColor' => '#000',
1488
  'textSize' => '14',
1489
  'textWeight' => 'normal',
1490
+ 'textAlign' => 'center',
1491
  ),
1492
  'answers' => array(
1493
  'paddingLeftRight' => '0',
1496
  'textSize' => '14',
1497
  'textWeight' => 'normal',
1498
  'skin' => '',
1499
+ 'colorScheme' => '',
1500
  ),
1501
  'buttons' => array(
1502
  'backgroundColor' => '#ffffff',
1507
  'paddingTopBottom' => '5',
1508
  'textColor' => '#000',
1509
  'textSize' => '14',
1510
+ 'textWeight' => 'normal',
1511
  ),
1512
  'captcha' => array(),
1513
  'errors' => array(
1517
  'paddingTopBottom' => '0',
1518
  'textColor' => '#000000',
1519
  'textSize' => '14',
1520
+ 'textWeight' => 'normal',
1521
  ),
1522
  'custom' => array(
1523
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1524
  text-align: center;
1525
+ }',
1526
+ ),
1527
  );
1528
  break;
1529
  }
1535
  'borderColor' => '#B70004',
1536
  'borderRadius' => '0',
1537
  'paddingLeftRight' => '10',
1538
+ 'paddingTopBottom' => '10',
1539
  ),
1540
  'questions' => array(
1541
  'textColor' => '#ffffff',
1542
  'textSize' => '14',
1543
  'textWeight' => 'normal',
1544
+ 'textAlign' => 'center',
1545
  ),
1546
  'answers' => array(
1547
  'paddingLeftRight' => '0',
1550
  'textSize' => '14',
1551
  'textWeight' => 'normal',
1552
  'skin' => '',
1553
+ 'colorScheme' => '',
1554
  ),
1555
  'buttons' => array(
1556
  'backgroundColor' => '#ffffff',
1561
  'paddingTopBottom' => '5',
1562
  'textColor' => '#000',
1563
  'textSize' => '14',
1564
+ 'textWeight' => 'normal',
1565
  ),
1566
  'captcha' => array(),
1567
  'errors' => array(
1571
  'paddingTopBottom' => '0',
1572
  'textColor' => '#000000',
1573
  'textSize' => '14',
1574
+ 'textWeight' => 'normal',
1575
  ),
1576
  'custom' => array(
1577
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1578
  text-align: center;
1579
+ }',
1580
+ ),
1581
  );
1582
  break;
1583
  }
1589
  'borderColor' => '#ffffff',
1590
  'borderRadius' => '0',
1591
  'paddingLeftRight' => '10',
1592
+ 'paddingTopBottom' => '10',
1593
  ),
1594
  'questions' => array(
1595
  'textColor' => '#ffffff',
1596
  'textSize' => '14',
1597
  'textWeight' => 'normal',
1598
+ 'textAlign' => 'center',
1599
  ),
1600
  'answers' => array(
1601
  'paddingLeftRight' => '0',
1604
  'textSize' => '14',
1605
  'textWeight' => 'normal',
1606
  'skin' => '',
1607
+ 'colorScheme' => '',
1608
  ),
1609
  'buttons' => array(
1610
  'backgroundColor' => '#ffffff',
1615
  'paddingTopBottom' => '5',
1616
  'textColor' => '#000',
1617
  'textSize' => '14',
1618
+ 'textWeight' => 'normal',
1619
  ),
1620
  'captcha' => array(),
1621
  'errors' => array(
1625
  'paddingTopBottom' => '0',
1626
  'textColor' => '#000000',
1627
  'textSize' => '14',
1628
+ 'textWeight' => 'normal',
1629
  ),
1630
  'custom' => array(
1631
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1634
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1635
  background-color: #B70004;
1636
  padding: 5px 0;
1637
+ }',
1638
+ ),
1639
  );
1640
  break;
1641
  }
1647
  'borderColor' => '#B70004',
1648
  'borderRadius' => '0',
1649
  'paddingLeftRight' => '10',
1650
+ 'paddingTopBottom' => '10',
1651
  ),
1652
  'questions' => array(
1653
  'textColor' => '#000',
1654
  'textSize' => '14',
1655
  'textWeight' => 'normal',
1656
+ 'textAlign' => 'center',
1657
  ),
1658
  'answers' => array(
1659
  'paddingLeftRight' => '0',
1662
  'textSize' => '14',
1663
  'textWeight' => 'normal',
1664
  'skin' => '',
1665
+ 'colorScheme' => '',
1666
  ),
1667
  'buttons' => array(
1668
  'backgroundColor' => '#ffffff',
1673
  'paddingTopBottom' => '5',
1674
  'textColor' => '#000',
1675
  'textSize' => '14',
1676
+ 'textWeight' => 'normal',
1677
  ),
1678
  'captcha' => array(),
1679
  'errors' => array(
1683
  'paddingTopBottom' => '0',
1684
  'textColor' => '#000000',
1685
  'textSize' => '14',
1686
+ 'textWeight' => 'normal',
1687
  ),
1688
  'custom' => array(
1689
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1690
  text-align: center;
1691
+ }',
1692
+ ),
1693
  );
1694
  break;
1695
  }
1701
  'borderColor' => '#3F8B43',
1702
  'borderRadius' => '0',
1703
  'paddingLeftRight' => '10',
1704
+ 'paddingTopBottom' => '10',
1705
  ),
1706
  'questions' => array(
1707
  'textColor' => '#ffffff',
1708
  'textSize' => '16',
1709
  'textWeight' => 'normal',
1710
+ 'textAlign' => 'center',
1711
  ),
1712
  'answers' => array(
1713
  'paddingLeftRight' => '0',
1716
  'textSize' => '14',
1717
  'textWeight' => 'normal',
1718
  'skin' => '',
1719
+ 'colorScheme' => '',
1720
  ),
1721
  'buttons' => array(
1722
  'backgroundColor' => '#ffffff',
1727
  'paddingTopBottom' => '5',
1728
  'textColor' => '#000',
1729
  'textSize' => '14',
1730
+ 'textWeight' => 'normal',
1731
  ),
1732
  'captcha' => array(),
1733
  'errors' => array(
1737
  'paddingTopBottom' => '0',
1738
  'textColor' => '#000000',
1739
  'textSize' => '14',
1740
+ 'textWeight' => 'normal',
1741
  ),
1742
  'custom' => array(
1743
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1744
  text-align: center;
1745
+ }',
1746
+ ),
1747
  );
1748
  break;
1749
  }
1755
  'borderColor' => '#ffffff',
1756
  'borderRadius' => '0',
1757
  'paddingLeftRight' => '10',
1758
+ 'paddingTopBottom' => '10',
1759
  ),
1760
  'questions' => array(
1761
  'textColor' => '#ffffff',
1762
  'textSize' => '14',
1763
  'textWeight' => 'normal',
1764
+ 'textAlign' => 'center',
1765
  ),
1766
  'answers' => array(
1767
  'paddingLeftRight' => '0',
1770
  'textSize' => '14',
1771
  'textWeight' => 'normal',
1772
  'skin' => '',
1773
+ 'colorScheme' => '',
1774
  ),
1775
  'buttons' => array(
1776
  'backgroundColor' => '#ffffff',
1781
  'paddingTopBottom' => '5',
1782
  'textColor' => '#000',
1783
  'textSize' => '14',
1784
+ 'textWeight' => 'normal',
1785
  ),
1786
  'captcha' => array(),
1787
  'errors' => array(
1791
  'paddingTopBottom' => '0',
1792
  'textColor' => '#000000',
1793
  'textSize' => '14',
1794
+ 'textWeight' => 'normal',
1795
  ),
1796
  'custom' => array(
1797
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1798
  text-align: center;
1799
+ }',
1800
+ ),
1801
  );
1802
  break;
1803
  }
1809
  'borderColor' => '#3F8B43',
1810
  'borderRadius' => '0',
1811
  'paddingLeftRight' => '10',
1812
+ 'paddingTopBottom' => '10',
1813
  ),
1814
  'questions' => array(
1815
  'textColor' => '#000',
1816
  'textSize' => '14',
1817
  'textWeight' => 'normal',
1818
+ 'textAlign' => 'center',
1819
  ),
1820
  'answers' => array(
1821
  'paddingLeftRight' => '0',
1824
  'textSize' => '14',
1825
  'textWeight' => 'normal',
1826
  'skin' => '',
1827
+ 'colorScheme' => '',
1828
  ),
1829
  'buttons' => array(
1830
  'backgroundColor' => '#ffffff',
1835
  'paddingTopBottom' => '5',
1836
  'textColor' => '#000',
1837
  'textSize' => '14',
1838
+ 'textWeight' => 'normal',
1839
  ),
1840
  'captcha' => array(),
1841
  'errors' => array(
1845
  'paddingTopBottom' => '0',
1846
  'textColor' => '#000000',
1847
  'textSize' => '14',
1848
+ 'textWeight' => 'normal',
1849
  ),
1850
  'custom' => array(
1851
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1852
  text-align: center;
1853
+ }',
1854
+ ),
1855
  );
1856
  break;
1857
  }
1863
  'borderColor' => '#FB6911',
1864
  'borderRadius' => '0',
1865
  'paddingLeftRight' => '10',
1866
+ 'paddingTopBottom' => '10',
1867
  ),
1868
  'questions' => array(
1869
  'textColor' => '#ffffff',
1870
  'textSize' => '16',
1871
  'textWeight' => 'normal',
1872
+ 'textAlign' => 'center',
1873
  ),
1874
  'answers' => array(
1875
  'paddingLeftRight' => '0',
1878
  'textSize' => '14',
1879
  'textWeight' => 'normal',
1880
  'skin' => '',
1881
+ 'colorScheme' => '',
1882
  ),
1883
  'buttons' => array(
1884
  'backgroundColor' => '#ffffff',
1889
  'paddingTopBottom' => '5',
1890
  'textColor' => '#000',
1891
  'textSize' => '14',
1892
+ 'textWeight' => 'normal',
1893
  ),
1894
  'captcha' => array(),
1895
  'errors' => array(
1899
  'paddingTopBottom' => '0',
1900
  'textColor' => '#000000',
1901
  'textSize' => '14',
1902
+ 'textWeight' => 'normal',
1903
  ),
1904
  'custom' => array(
1905
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1906
  text-align: center;
1907
+ }',
1908
+ ),
1909
  );
1910
  break;
1911
  }
1917
  'borderColor' => '#ffffff',
1918
  'borderRadius' => '0',
1919
  'paddingLeftRight' => '10',
1920
+ 'paddingTopBottom' => '10',
1921
  ),
1922
  'questions' => array(
1923
  'textColor' => '#ffffff',
1924
  'textSize' => '16',
1925
  'textWeight' => 'normal',
1926
+ 'textAlign' => 'center',
1927
  ),
1928
  'answers' => array(
1929
  'paddingLeftRight' => '0',
1932
  'textSize' => '14',
1933
  'textWeight' => 'normal',
1934
  'skin' => '',
1935
+ 'colorScheme' => '',
1936
  ),
1937
  'buttons' => array(
1938
  'backgroundColor' => '#ffffff',
1943
  'paddingTopBottom' => '5',
1944
  'textColor' => '#000',
1945
  'textSize' => '14',
1946
+ 'textWeight' => 'normal',
1947
  ),
1948
  'captcha' => array(),
1949
  'errors' => array(
1953
  'paddingTopBottom' => '0',
1954
  'textColor' => '#000000',
1955
  'textSize' => '14',
1956
+ 'textWeight' => 'normal',
1957
  ),
1958
  'custom' => array(
1959
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
1962
  .basic-yop-poll-container[data-uid] .basic-question-title h5 {
1963
  background-color: #FB6911;
1964
  padding: 5px 0;
1965
+ }',
1966
+ ),
1967
  );
1968
  break;
1969
  }
1975
  'borderColor' => '#FB6911',
1976
  'borderRadius' => '0',
1977
  'paddingLeftRight' => '10',
1978
+ 'paddingTopBottom' => '10',
1979
  ),
1980
  'questions' => array(
1981
  'textColor' => '#000',
1982
  'textSize' => '16',
1983
  'textWeight' => 'normal',
1984
+ 'textAlign' => 'center',
1985
  ),
1986
  'answers' => array(
1987
  'paddingLeftRight' => '0',
1990
  'textSize' => '14',
1991
  'textWeight' => 'normal',
1992
  'skin' => '',
1993
+ 'colorScheme' => '',
1994
  ),
1995
  'buttons' => array(
1996
  'backgroundColor' => '#ffffff',
2001
  'paddingTopBottom' => '5',
2002
  'textColor' => '#55555',
2003
  'textSize' => '14',
2004
+ 'textWeight' => 'normal',
2005
  ),
2006
  'captcha' => array(),
2007
  'errors' => array(
2011
  'paddingTopBottom' => '0',
2012
  'textColor' => '#000000',
2013
  'textSize' => '14',
2014
+ 'textWeight' => 'normal',
2015
  ),
2016
  'custom' => array(
2017
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2018
  text-align: center;
2019
+ }',
2020
+ ),
2021
  );
2022
  break;
2023
  }
2029
  'borderColor' => '#000000',
2030
  'borderRadius' => '0',
2031
  'paddingLeftRight' => '10',
2032
+ 'paddingTopBottom' => '10',
2033
  ),
2034
  'questions' => array(
2035
  'textColor' => '#858585',
2036
  'textSize' => '16',
2037
  'textWeight' => 'normal',
2038
+ 'textAlign' => 'center',
2039
  ),
2040
  'answers' => array(
2041
  'paddingLeftRight' => '0',
2044
  'textSize' => '14',
2045
  'textWeight' => 'normal',
2046
  'skin' => '',
2047
+ 'colorScheme' => '',
2048
  ),
2049
  'buttons' => array(
2050
  'backgroundColor' => '#ffffff',
2055
  'paddingTopBottom' => '5',
2056
  'textColor' => '#333',
2057
  'textSize' => '14',
2058
+ 'textWeight' => 'normal',
2059
  ),
2060
  'captcha' => array(),
2061
  'errors' => array(
2065
  'paddingTopBottom' => '0',
2066
  'textColor' => '#000000',
2067
  'textSize' => '14',
2068
+ 'textWeight' => 'normal',
2069
  ),
2070
  'custom' => array(
2071
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2072
  text-align: center;
2073
+ }',
2074
+ ),
2075
  );
2076
  break;
2077
  }
2083
  'borderColor' => '#bfe5f8',
2084
  'borderRadius' => '0',
2085
  'paddingLeftRight' => '10',
2086
+ 'paddingTopBottom' => '10',
2087
  ),
2088
  'questions' => array(
2089
  'textColor' => '#90c1cf',
2090
  'textSize' => '16',
2091
  'textWeight' => 'normal',
2092
+ 'textAlign' => 'center',
2093
  ),
2094
  'answers' => array(
2095
  'paddingLeftRight' => '0',
2098
  'textSize' => '14',
2099
  'textWeight' => 'normal',
2100
  'skin' => '',
2101
+ 'colorScheme' => '',
2102
  ),
2103
  'buttons' => array(
2104
  'backgroundColor' => '#ffffff',
2109
  'paddingTopBottom' => '5',
2110
  'textColor' => '#333',
2111
  'textSize' => '14',
2112
+ 'textWeight' => 'normal',
2113
  ),
2114
  'captcha' => array(),
2115
  'errors' => array(
2119
  'paddingTopBottom' => '0',
2120
  'textColor' => '#000000',
2121
  'textSize' => '14',
2122
+ 'textWeight' => 'normal',
2123
  ),
2124
  'custom' => array(
2125
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2126
  text-align: center;
2127
+ }',
2128
+ ),
2129
  );
2130
  break;
2131
  }
2137
  'borderColor' => '#bfe5f8',
2138
  'borderRadius' => '0',
2139
  'paddingLeftRight' => '10',
2140
+ 'paddingTopBottom' => '10',
2141
  ),
2142
  'questions' => array(
2143
  'textColor' => '#90c1cf',
2144
  'textSize' => '16',
2145
  'textWeight' => 'normal',
2146
+ 'textAlign' => 'center',
2147
  ),
2148
  'answers' => array(
2149
  'paddingLeftRight' => '0',
2152
  'textSize' => '14',
2153
  'textWeight' => 'normal',
2154
  'skin' => '',
2155
+ 'colorScheme' => '',
2156
  ),
2157
  'buttons' => array(
2158
  'backgroundColor' => '#ffffff',
2163
  'paddingTopBottom' => '5',
2164
  'textColor' => '#333',
2165
  'textSize' => '14',
2166
+ 'textWeight' => 'normal',
2167
  ),
2168
  'captcha' => array(),
2169
  'errors' => array(
2173
  'paddingTopBottom' => '0',
2174
  'textColor' => '#000000',
2175
  'textSize' => '14',
2176
+ 'textWeight' => 'normal',
2177
  ),
2178
  'custom' => array(
2179
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2180
  text-align: center;
2181
+ }',
2182
+ ),
2183
  );
2184
  break;
2185
  }
2191
  'borderColor' => '#ACCBE0',
2192
  'borderRadius' => '0',
2193
  'paddingLeftRight' => '10',
2194
+ 'paddingTopBottom' => '10',
2195
  ),
2196
  'questions' => array(
2197
  'textColor' => '#666666',
2198
  'textSize' => '16',
2199
  'textWeight' => 'normal',
2200
+ 'textAlign' => 'center',
2201
  ),
2202
  'answers' => array(
2203
  'paddingLeftRight' => '0',
2206
  'textSize' => '14',
2207
  'textWeight' => 'normal',
2208
  'skin' => '',
2209
+ 'colorScheme' => '',
2210
  ),
2211
  'buttons' => array(
2212
  'backgroundColor' => '#ffffff',
2217
  'paddingTopBottom' => '5',
2218
  'textColor' => '#333',
2219
  'textSize' => '14',
2220
+ 'textWeight' => 'normal',
2221
  ),
2222
  'captcha' => array(),
2223
  'errors' => array(
2227
  'paddingTopBottom' => '0',
2228
  'textColor' => '#000000',
2229
  'textSize' => '14',
2230
+ 'textWeight' => 'normal',
2231
  ),
2232
  'custom' => array(
2233
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2234
  text-align: center;
2235
+ }',
2236
+ ),
2237
  );
2238
  break;
2239
  }
2245
  'borderColor' => '#FFF',
2246
  'borderRadius' => '0',
2247
  'paddingLeftRight' => '10',
2248
+ 'paddingTopBottom' => '10',
2249
  ),
2250
  'questions' => array(
2251
  'textColor' => '#ffffff',
2252
  'textSize' => '16',
2253
  'textWeight' => 'normal',
2254
+ 'textAlign' => 'center',
2255
  ),
2256
  'answers' => array(
2257
  'paddingLeftRight' => '0',
2260
  'textSize' => '14',
2261
  'textWeight' => 'normal',
2262
  'skin' => '',
2263
+ 'colorScheme' => '',
2264
  ),
2265
  'buttons' => array(
2266
  'backgroundColor' => '#ffffff',
2271
  'paddingTopBottom' => '5',
2272
  'textColor' => '#000000',
2273
  'textSize' => '14',
2274
+ 'textWeight' => 'normal',
2275
  ),
2276
  'captcha' => array(),
2277
  'errors' => array(
2281
  'paddingTopBottom' => '0',
2282
  'textColor' => '#000000',
2283
  'textSize' => '14',
2284
+ 'textWeight' => 'normal',
2285
  ),
2286
  'custom' => array(
2287
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2288
  text-align: center;
2289
+ }',
2290
+ ),
2291
  );
2292
  break;
2293
  }
2299
  'borderColor' => '#333333',
2300
  'borderRadius' => '0',
2301
  'paddingLeftRight' => '10',
2302
+ 'paddingTopBottom' => '10',
2303
  ),
2304
  'questions' => array(
2305
  'textColor' => '#ffffff',
2306
  'textSize' => '16',
2307
  'textWeight' => 'normal',
2308
+ 'textAlign' => 'center',
2309
  ),
2310
  'answers' => array(
2311
  'paddingLeftRight' => '0',
2314
  'textSize' => '14',
2315
  'textWeight' => 'normal',
2316
  'skin' => '',
2317
+ 'colorScheme' => '',
2318
  ),
2319
  'buttons' => array(
2320
  'backgroundColor' => '#ffffff',
2325
  'paddingTopBottom' => '5',
2326
  'textColor' => '#000000',
2327
  'textSize' => '14',
2328
+ 'textWeight' => 'normal',
2329
  ),
2330
  'captcha' => array(),
2331
  'errors' => array(
2335
  'paddingTopBottom' => '0',
2336
  'textColor' => '#000000',
2337
  'textSize' => '14',
2338
+ 'textWeight' => 'normal',
2339
  ),
2340
  'custom' => array(
2341
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2342
  text-align: center;
2343
+ }',
2344
+ ),
2345
  );
2346
  break;
2347
  }
2353
  'borderColor' => '#333333',
2354
  'borderRadius' => '0',
2355
  'paddingLeftRight' => '10',
2356
+ 'paddingTopBottom' => '10',
2357
  ),
2358
  'questions' => array(
2359
  'textColor' => '#ffffff',
2360
  'textSize' => '16',
2361
  'textWeight' => 'normal',
2362
+ 'textAlign' => 'center',
2363
  ),
2364
  'answers' => array(
2365
  'paddingLeftRight' => '0',
2368
  'textSize' => '14',
2369
  'textWeight' => 'normal',
2370
  'skin' => '',
2371
+ 'colorScheme' => '',
2372
  ),
2373
  'buttons' => array(
2374
  'backgroundColor' => '#ffffff',
2379
  'paddingTopBottom' => '5',
2380
  'textColor' => '#000000',
2381
  'textSize' => '14',
2382
+ 'textWeight' => 'normal',
2383
  ),
2384
  'captcha' => array(),
2385
  'errors' => array(
2389
  'paddingTopBottom' => '0',
2390
  'textColor' => '#000000',
2391
  'textSize' => '14',
2392
+ 'textWeight' => 'normal',
2393
  ),
2394
  'custom' => array(
2395
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2396
  text-align: center;
2397
+ }',
2398
+ ),
2399
  );
2400
  break;
2401
  }
2407
  'borderColor' => '#333333',
2408
  'borderRadius' => '0',
2409
  'paddingLeftRight' => '10',
2410
+ 'paddingTopBottom' => '10',
2411
  ),
2412
  'questions' => array(
2413
  'textColor' => '#ffffff',
2414
  'textSize' => '16',
2415
  'textWeight' => 'normal',
2416
+ 'textAlign' => 'center',
2417
  ),
2418
  'answers' => array(
2419
  'paddingLeftRight' => '0',
2422
  'textSize' => '14',
2423
  'textWeight' => 'normal',
2424
  'skin' => '',
2425
+ 'colorScheme' => '',
2426
  ),
2427
  'buttons' => array(
2428
  'backgroundColor' => '#ffffff',
2433
  'paddingTopBottom' => '5',
2434
  'textColor' => '#000000',
2435
  'textSize' => '14',
2436
+ 'textWeight' => 'normal',
2437
  ),
2438
  'captcha' => array(),
2439
  'errors' => array(
2443
  'paddingTopBottom' => '0',
2444
  'textColor' => '#000000',
2445
  'textSize' => '14',
2446
+ 'textWeight' => 'normal',
2447
  ),
2448
  'custom' => array(
2449
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2450
  text-align: center;
2451
+ }',
2452
+ ),
2453
  );
2454
  break;
2455
  }
2461
  'borderColor' => '#ffffff',
2462
  'borderRadius' => '0',
2463
  'paddingLeftRight' => '10',
2464
+ 'paddingTopBottom' => '10',
2465
  ),
2466
  'questions' => array(
2467
  'textColor' => '#E9E9E9',
2468
  'textSize' => '16',
2469
  'textWeight' => 'normal',
2470
+ 'textAlign' => 'center',
2471
  ),
2472
  'answers' => array(
2473
  'paddingLeftRight' => '0',
2476
  'textSize' => '14',
2477
  'textWeight' => 'normal',
2478
  'skin' => '',
2479
+ 'colorScheme' => '',
2480
  ),
2481
  'buttons' => array(
2482
  'backgroundColor' => '#69C9D4',
2487
  'paddingTopBottom' => '5',
2488
  'textColor' => '#ffffff',
2489
  'textSize' => '14',
2490
+ 'textWeight' => 'normal',
2491
  ),
2492
  'captcha' => array(),
2493
  'errors' => array(
2497
  'paddingTopBottom' => '0',
2498
  'textColor' => '#000000',
2499
  'textSize' => '14',
2500
+ 'textWeight' => 'normal',
2501
  ),
2502
  'custom' => array(
2503
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2504
  text-align: center;
2505
+ }',
2506
+ ),
2507
  );
2508
  break;
2509
  }
2515
  'borderColor' => '#FB6911',
2516
  'borderRadius' => '0',
2517
  'paddingLeftRight' => '10',
2518
+ 'paddingTopBottom' => '10',
2519
  ),
2520
  'questions' => array(
2521
  'textColor' => '#ffffff',
2522
  'textSize' => '16',
2523
  'textWeight' => 'normal',
2524
+ 'textAlign' => 'center',
2525
  ),
2526
  'answers' => array(
2527
  'paddingLeftRight' => '0',
2530
  'textSize' => '14',
2531
  'textWeight' => 'normal',
2532
  'skin' => '',
2533
+ 'colorScheme' => '',
2534
  ),
2535
  'buttons' => array(
2536
  'backgroundColor' => '#ffffff',
2541
  'paddingTopBottom' => '5',
2542
  'textColor' => '#ffffff',
2543
  'textSize' => '14',
2544
+ 'textWeight' => 'normal',
2545
  ),
2546
  'captcha' => array(),
2547
  'errors' => array(
2551
  'paddingTopBottom' => '0',
2552
  'textColor' => '#000000',
2553
  'textSize' => '14',
2554
+ 'textWeight' => 'normal',
2555
  ),
2556
  'custom' => array(
2557
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2558
  text-align: center;
2559
+ }',
2560
+ ),
2561
  );
2562
  break;
2563
  }
2569
  'borderColor' => '#6b7552',
2570
  'borderRadius' => '0',
2571
  'paddingLeftRight' => '10',
2572
+ 'paddingTopBottom' => '10',
2573
  ),
2574
  'questions' => array(
2575
  'textColor' => '#333333',
2576
  'textSize' => '16',
2577
  'textWeight' => 'normal',
2578
+ 'textAlign' => 'center',
2579
  ),
2580
  'answers' => array(
2581
  'paddingLeftRight' => '0',
2584
  'textSize' => '14',
2585
  'textWeight' => 'normal',
2586
  'skin' => '',
2587
+ 'colorScheme' => '',
2588
  ),
2589
  'buttons' => array(
2590
  'backgroundColor' => '#ffffff',
2595
  'paddingTopBottom' => '5',
2596
  'textColor' => '#ffffff',
2597
  'textSize' => '14',
2598
+ 'textWeight' => 'normal',
2599
  ),
2600
  'captcha' => array(),
2601
  'errors' => array(
2605
  'paddingTopBottom' => '0',
2606
  'textColor' => '#000000',
2607
  'textSize' => '14',
2608
+ 'textWeight' => 'normal',
2609
  ),
2610
  'custom' => array(
2611
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2612
  text-align: center;
2613
+ }',
2614
+ ),
2615
  );
2616
  break;
2617
  }
2623
  'borderColor' => '#d23c3d',
2624
  'borderRadius' => '0',
2625
  'paddingLeftRight' => '10',
2626
+ 'paddingTopBottom' => '10',
2627
  ),
2628
  'questions' => array(
2629
  'textColor' => '#ffffff',
2630
  'textSize' => '16',
2631
  'textWeight' => 'normal',
2632
+ 'textAlign' => 'center',
2633
  ),
2634
  'answers' => array(
2635
  'paddingLeftRight' => '0',
2638
  'textSize' => '14',
2639
  'textWeight' => 'normal',
2640
  'skin' => '',
2641
+ 'colorScheme' => '',
2642
  ),
2643
  'buttons' => array(
2644
  'backgroundColor' => '#595959',
2649
  'paddingTopBottom' => '5',
2650
  'textColor' => '#ffffff',
2651
  'textSize' => '14',
2652
+ 'textWeight' => 'normal',
2653
  ),
2654
  'captcha' => array(),
2655
  'errors' => array(
2659
  'paddingTopBottom' => '0',
2660
  'textColor' => '#000000',
2661
  'textSize' => '14',
2662
+ 'textWeight' => 'normal',
2663
  ),
2664
  'custom' => array(
2665
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2666
  text-align: center;
2667
+ }',
2668
+ ),
2669
  );
2670
  break;
2671
  }
2677
  'borderColor' => '#6b7552',
2678
  'borderRadius' => '0',
2679
  'paddingLeftRight' => '10',
2680
+ 'paddingTopBottom' => '10',
2681
  ),
2682
  'questions' => array(
2683
  'textColor' => '#333333',
2684
  'textSize' => '16',
2685
  'textWeight' => 'normal',
2686
+ 'textAlign' => 'center',
2687
  ),
2688
  'answers' => array(
2689
  'paddingLeftRight' => '0',
2692
  'textSize' => '14',
2693
  'textWeight' => 'normal',
2694
  'skin' => '',
2695
+ 'colorScheme' => '',
2696
  ),
2697
  'buttons' => array(
2698
  'backgroundColor' => '#ffffff',
2703
  'paddingTopBottom' => '5',
2704
  'textColor' => '#ffffff',
2705
  'textSize' => '14',
2706
+ 'textWeight' => 'normal',
2707
  ),
2708
  'captcha' => array(),
2709
  'errors' => array(
2713
  'paddingTopBottom' => '0',
2714
  'textColor' => '#000000',
2715
  'textSize' => '14',
2716
+ 'textWeight' => 'normal',
2717
  ),
2718
  'custom' => array(
2719
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2720
  text-align: center;
2721
+ }',
2722
+ ),
2723
  );
2724
  break;
2725
  }
2731
  'borderColor' => '#000000',
2732
  'borderRadius' => '5',
2733
  'paddingLeftRight' => '10',
2734
+ 'paddingTopBottom' => '10',
2735
  ),
2736
  'questions' => array(
2737
  'textColor' => '#000',
2738
  'textSize' => '16',
2739
  'textWeight' => 'normal',
2740
+ 'textAlign' => 'center',
2741
  ),
2742
  'answers' => array(
2743
  'paddingLeftRight' => '0',
2746
  'textSize' => '14',
2747
  'textWeight' => 'normal',
2748
  'skin' => '',
2749
+ 'colorScheme' => '',
2750
  ),
2751
  'buttons' => array(
2752
  'backgroundColor' => '#ffffff',
2757
  'paddingTopBottom' => '5',
2758
  'textColor' => '#000',
2759
  'textSize' => '14',
2760
+ 'textWeight' => 'normal',
2761
  ),
2762
  'captcha' => array(),
2763
  'errors' => array(
2767
  'paddingTopBottom' => '0',
2768
  'textColor' => '#000000',
2769
  'textSize' => '14',
2770
+ 'textWeight' => 'normal',
2771
  ),
2772
  'custom' => array(
2773
  'css' => '.basic-yop-poll-container[data-uid] .basic-vote {
2774
  text-align: center;
2775
+ }',
2776
+ ),
2777
  );
2778
  break;
2779
  }
2799
  if ( -1 == $response['response_code'] ) {
2800
  $table = 'bans';
2801
  $response_code = 1;
2802
+ wp_send_json_success(
2803
+ array(
2804
+ 'table' => $table,
2805
+ 'response_code' => $response_code,
2806
+ 'message' => $response['message'],
2807
+ 'skip_table_check' => false,
2808
+ )
2809
+ );
2810
  } else {
2811
  $table = 'polls';
2812
  $response_code = $response['response_code'];
2813
+ wp_send_json_success(
2814
+ array(
2815
+ 'table' => $table,
2816
+ 'response_code' => $response_code,
2817
+ 'message' => $response['message'],
2818
+ 'skip_table_check' => true,
2819
+ )
2820
+ );
2821
  }
2822
  break;
2823
  }
2826
  if ( -1 == $response['response_code'] ) {
2827
  $table = 'votes';
2828
  $response_code = 1;
2829
+ wp_send_json_success(
2830
+ array(
2831
+ 'table' => $table,
2832
+ 'response_code' => $response_code,
2833
+ 'message' => $response['message'],
2834
+ 'skip_table_check' => false,
2835
+ )
2836
+ );
2837
  } else {
2838
  $table = 'bans';
2839
  $response_code = $response['response_code'];
2840
+ wp_send_json_success(
2841
+ array(
2842
+ 'table' => $table,
2843
+ 'response_code' => $response_code,
2844
+ 'message' => $response['message'],
2845
+ 'skip_table_check' => true,
2846
+ )
2847
+ );
2848
  }
2849
  break;
2850
  }
2853
  if ( -1 == $response['response_code'] ) {
2854
  $table = 'logs';
2855
  $response_code = 1;
2856
+ wp_send_json_success(
2857
+ array(
2858
+ 'table' => $table,
2859
+ 'response_code' => $response_code,
2860
+ 'message' => $response['message'],
2861
+ 'skip_table_check' => false,
2862
+ )
2863
+ );
2864
  } else {
2865
  $table = 'votes';
2866
  $response_code = $response['response_code'];
2867
+ wp_send_json_success(
2868
+ array(
2869
+ 'table' => $table,
2870
+ 'response_code' => $response_code,
2871
+ 'message' => $response['message'],
2872
+ 'skip_table_check' => true,
2873
+ )
2874
+ );
2875
  }
2876
  break;
2877
  }
2880
  if ( -1 == $response['response_code'] ) {
2881
  $response_code = 'done';
2882
  delete_option( 'yop_poll_old_version' );
2883
+ wp_send_json_success(
2884
+ array(
2885
+ 'table' => 'logs',
2886
+ 'response_code' => $response_code,
2887
+ 'message' => $response['message'],
2888
+ )
2889
+ );
2890
  } else {
2891
  $response_code = $response['response_code'];
2892
+ wp_send_json_success(
2893
+ array(
2894
+ 'table' => 'logs',
2895
+ 'response_code' => $response_code,
2896
+ 'message' => $response['message'],
2897
+ 'skip_table_check' => $skip_table_check,
2898
+ )
2899
+ );
2900
  }
2901
  break;
2902
  }
admin/inc/Helper.php CHANGED
@@ -26,10 +26,10 @@ class YOP_Poll_Helper {
26
  public static function yop_fputcsv( $handle, $fields, $delimiter = ',', $enclosure = '"', $escape = '\\' ) {
27
  foreach ( $fields as $key => $field ) {
28
  $field = addslashes( $field );
29
- if ( !preg_match( '/^(["\']).*\1$/m', $field ) ) {
30
- $fields[$key] = $enclosure . $field . $enclosure;
31
  } else {
32
- $fields[$key] = $field;
33
  }
34
  }
35
  $line = implode( $delimiter, $fields );
@@ -88,8 +88,7 @@ class YOP_Poll_Helper {
88
  ( true === is_object( $value ) )
89
  ) {
90
  $value = self::sanitize_text_or_array_or_object( $value );
91
- }
92
- else {
93
  $value = wp_kses_post(
94
  wp_unslash( $value )
95
  );
26
  public static function yop_fputcsv( $handle, $fields, $delimiter = ',', $enclosure = '"', $escape = '\\' ) {
27
  foreach ( $fields as $key => $field ) {
28
  $field = addslashes( $field );
29
+ if ( ! preg_match( '/^(["\']).*\1$/m', $field ) ) {
30
+ $fields[ $key ] = $enclosure . $field . $enclosure;
31
  } else {
32
+ $fields[ $key ] = $field;
33
  }
34
  }
35
  $line = implode( $delimiter, $fields );
88
  ( true === is_object( $value ) )
89
  ) {
90
  $value = self::sanitize_text_or_array_or_object( $value );
91
+ } else {
 
92
  $value = wp_kses_post(
93
  wp_unslash( $value )
94
  );
admin/inc/capabilities.php CHANGED
@@ -8,7 +8,7 @@ class YOP_POLL_Capabilities {
8
  'yop_poll_delete_own' => true,
9
  'yop_poll_delete_others' => true,
10
  'yop_poll_results_own' => true,
11
- 'yop_poll_results_others' => true
12
  ),
13
  'editor' => array(
14
  'yop_poll_add' => true,
@@ -17,7 +17,7 @@ class YOP_POLL_Capabilities {
17
  'yop_poll_delete_own' => true,
18
  'yop_poll_delete_others' => true,
19
  'yop_poll_results_own' => true,
20
- 'yop_poll_results_others' => true
21
  ),
22
  'author' => array(
23
  'yop_poll_add' => true,
@@ -26,7 +26,7 @@ class YOP_POLL_Capabilities {
26
  'yop_poll_delete_own' => true,
27
  'yop_poll_delete_others' => true,
28
  'yop_poll_results_own' => true,
29
- 'yop_poll_results_others' => true
30
  ),
31
  'contributor' => array(
32
  'yop_poll_add' => false,
@@ -35,7 +35,7 @@ class YOP_POLL_Capabilities {
35
  'yop_poll_delete_own' => false,
36
  'yop_poll_delete_others' => false,
37
  'yop_poll_results_own' => false,
38
- 'yop_poll_results_others' => false
39
  ),
40
  'subscriber' => array(
41
  'yop_poll_add' => false,
@@ -44,7 +44,7 @@ class YOP_POLL_Capabilities {
44
  'yop_poll_delete_own' => false,
45
  'yop_poll_delete_others' => false,
46
  'yop_poll_results_own' => false,
47
- 'yop_poll_results_others' => false
48
  ),
49
  'guest' => array(
50
  'yop_poll_add' => false,
@@ -53,9 +53,9 @@ class YOP_POLL_Capabilities {
53
  'yop_poll_delete_own' => false,
54
  'yop_poll_delete_others' => false,
55
  'yop_poll_results_own' => false,
56
- 'yop_poll_results_others' => false
57
- )
58
- );
59
  public function role_exists( $role ) {
60
  if ( ! empty( $role ) ) {
61
  return wp_roles()->is_role( $role );
8
  'yop_poll_delete_own' => true,
9
  'yop_poll_delete_others' => true,
10
  'yop_poll_results_own' => true,
11
+ 'yop_poll_results_others' => true,
12
  ),
13
  'editor' => array(
14
  'yop_poll_add' => true,
17
  'yop_poll_delete_own' => true,
18
  'yop_poll_delete_others' => true,
19
  'yop_poll_results_own' => true,
20
+ 'yop_poll_results_others' => true,
21
  ),
22
  'author' => array(
23
  'yop_poll_add' => true,
26
  'yop_poll_delete_own' => true,
27
  'yop_poll_delete_others' => true,
28
  'yop_poll_results_own' => true,
29
+ 'yop_poll_results_others' => true,
30
  ),
31
  'contributor' => array(
32
  'yop_poll_add' => false,
35
  'yop_poll_delete_own' => false,
36
  'yop_poll_delete_others' => false,
37
  'yop_poll_results_own' => false,
38
+ 'yop_poll_results_others' => false,
39
  ),
40
  'subscriber' => array(
41
  'yop_poll_add' => false,
44
  'yop_poll_delete_own' => false,
45
  'yop_poll_delete_others' => false,
46
  'yop_poll_results_own' => false,
47
+ 'yop_poll_results_others' => false,
48
  ),
49
  'guest' => array(
50
  'yop_poll_add' => false,
53
  'yop_poll_delete_own' => false,
54
  'yop_poll_delete_others' => false,
55
  'yop_poll_results_own' => false,
56
+ 'yop_poll_results_others' => false,
57
+ ),
58
+ );
59
  public function role_exists( $role ) {
60
  if ( ! empty( $role ) ) {
61
  return wp_roles()->is_role( $role );
admin/inc/maintenance.php CHANGED
@@ -9,7 +9,12 @@ class YOP_POLL_Maintenance {
9
  public function activate( $network_wide ) {
10
  if ( true === $network_wide ) {
11
  if ( function_exists( 'get_sites' ) && function_exists( 'get_current_network_id' ) ) {
12
- $site_ids = get_sites( array( 'fields' => 'ids', 'network_id' => get_current_network_id() ) );
 
 
 
 
 
13
  } else {
14
  $site_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = $wpdb->siteid;" );
15
  }
@@ -177,6 +182,9 @@ class YOP_POLL_Maintenance {
177
  YOP_Poll_Settings::update_settings_to_version_6_4_3();
178
  update_option( 'yop_poll_version', '6.4.3' );
179
  }
 
 
 
180
  public function create_archive_page() {
181
  $poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
182
  if ( ! $poll_archive_page ) {
@@ -221,7 +229,12 @@ class YOP_POLL_Maintenance {
221
  public function uninstall() {
222
  if ( true === is_multisite() ) {
223
  if ( function_exists( 'get_sites' ) && function_exists( 'get_current_network_id' ) ) {
224
- $site_ids = get_sites( array( 'fields' => 'ids', 'network_id' => get_current_network_id() ) );
 
 
 
 
 
225
  } else {
226
  $site_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = $wpdb->siteid;" );
227
  }
@@ -249,7 +262,7 @@ class YOP_POLL_Maintenance {
249
  $url = admin_url( 'admin.php?page=yop-poll-import' );
250
  $html = '<div class="updated">';
251
  $html .= '<p>';
252
- $html .= esc_html__( 'Click <a href="' . $url . '" target="_blank">here</a> to start the import.', 'yop-poll' );
253
  $html .= '</p>';
254
  $html .= '</div><!-- /.updated -->';
255
  echo wp_kses_post( $html );
9
  public function activate( $network_wide ) {
10
  if ( true === $network_wide ) {
11
  if ( function_exists( 'get_sites' ) && function_exists( 'get_current_network_id' ) ) {
12
+ $site_ids = get_sites(
13
+ array(
14
+ 'fields' => 'ids',
15
+ 'network_id' => get_current_network_id(),
16
+ )
17
+ );
18
  } else {
19
  $site_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = $wpdb->siteid;" );
20
  }
182
  YOP_Poll_Settings::update_settings_to_version_6_4_3();
183
  update_option( 'yop_poll_version', '6.4.3' );
184
  }
185
+ public function update_to_version_6_4_4() {
186
+ update_option( 'yop_poll_version', '6.4.4' );
187
+ }
188
  public function create_archive_page() {
189
  $poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
190
  if ( ! $poll_archive_page ) {
229
  public function uninstall() {
230
  if ( true === is_multisite() ) {
231
  if ( function_exists( 'get_sites' ) && function_exists( 'get_current_network_id' ) ) {
232
+ $site_ids = get_sites(
233
+ array(
234
+ 'fields' => 'ids',
235
+ 'network_id' => get_current_network_id(),
236
+ )
237
+ );
238
  } else {
239
  $site_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = $wpdb->siteid;" );
240
  }
262
  $url = admin_url( 'admin.php?page=yop-poll-import' );
263
  $html = '<div class="updated">';
264
  $html .= '<p>';
265
+ $html .= esc_html__( 'Click <a href="', 'yop-poll' ) . $url . '" target="_blank">' . esc_html__( 'here', 'yop-poll' ) . '</a> ' . esc_html__( 'to start the import.', 'yop-poll' );
266
  $html .= '</p>';
267
  $html .= '</div><!-- /.updated -->';
268
  echo wp_kses_post( $html );
admin/models/bans.php CHANGED
@@ -9,7 +9,8 @@ class YOP_Poll_Bans {
9
  $bans_per_page = 10;
10
  public static function get_owner( $ban_id ) {
11
  $query = $GLOBALS['wpdb']->prepare(
12
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `id` = %s", $ban_id
 
13
  );
14
  $ban = $GLOBALS['wpdb']->get_row( $query, OBJECT );
15
  if ( null !== $ban ) {
@@ -91,7 +92,7 @@ class YOP_Poll_Bans {
91
  'order_by' => $params['order_by'],
92
  'sort_order' => $params['sort_order'],
93
  'q' => htmlentities( $params['q'] ),
94
- 'page_no' => $params['page_no'] + 1
95
  )
96
  )
97
  );
@@ -108,7 +109,7 @@ class YOP_Poll_Bans {
108
  'order_by' => $params['order_by'],
109
  'sort_order' => $params['sort_order'],
110
  'q' => htmlentities( $params['q'] ),
111
- 'page_no' => intval( $total_pages )
112
  )
113
  )
114
  );
@@ -127,7 +128,7 @@ class YOP_Poll_Bans {
127
  'order_by' => $params['order_by'],
128
  'sort_order' => $params['sort_order'],
129
  'q' => htmlentities( $params['q'] ),
130
- 'page_no' => $params['page_no'] - 1
131
  )
132
  )
133
  );
@@ -144,7 +145,7 @@ class YOP_Poll_Bans {
144
  'order_by' => $params['order_by'],
145
  'sort_order' => $params['sort_order'],
146
  'q' => htmlentities( $params['q'] ),
147
- 'page_no' => 1
148
  )
149
  )
150
  );
@@ -163,7 +164,7 @@ class YOP_Poll_Bans {
163
  'order_by' => $params['order_by'],
164
  'sort_order' => $params['sort_order'],
165
  'q' => htmlentities( $params['q'] ),
166
- 'page_no' => $params['page_no'] - 1
167
  )
168
  )
169
  );
@@ -176,7 +177,7 @@ class YOP_Poll_Bans {
176
  'order_by' => $params['order_by'],
177
  'sort_order' => $params['sort_order'],
178
  'q' => htmlentities( $params['q'] ),
179
- 'page_no' => $params['page_no'] + 1
180
  )
181
  )
182
  );
@@ -196,7 +197,7 @@ class YOP_Poll_Bans {
196
  'order_by' => $params['order_by'],
197
  'sort_order' => $params['sort_order'],
198
  'q' => htmlentities( $params['q'] ),
199
- 'page_no' => 1
200
  )
201
  )
202
  );
@@ -214,7 +215,7 @@ class YOP_Poll_Bans {
214
  'order_by' => $params['order_by'],
215
  'sort_order' => $params['sort_order'],
216
  'q' => htmlentities( $params['q'] ),
217
- 'page_no' => intval( $total_pages )
218
  )
219
  )
220
  );
@@ -232,7 +233,7 @@ class YOP_Poll_Bans {
232
  return array(
233
  'total_bans' => $total_bans,
234
  'total_pages' => $total_pages,
235
- 'pagination' => $pagination
236
  );
237
  }
238
  public static function get_bans( $params ) {
@@ -243,14 +244,14 @@ class YOP_Poll_Bans {
243
  $params['page_no'] = 1;
244
  }
245
  $pagination = self::paginate( $params );
246
- if ( !in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
247
  $params['sort_order'] = SORT_ASC;
248
  } elseif ( 'desc' === $params['sort_order'] ) {
249
  $params['sort_order'] = SORT_DESC;
250
  } else {
251
  $params['sort_order'] = SORT_ASC;
252
  }
253
- if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
254
  $params['order_by'] = 'id';
255
  }
256
  if ( $params['page_no'] > $pagination['total_pages'] ) {
@@ -316,7 +317,7 @@ class YOP_Poll_Bans {
316
  'bans' => $bans,
317
  'total_bans' => $pagination['total_bans'],
318
  'total_pages' => $pagination['total_pages'],
319
- 'pagination' => $pagination['pagination']
320
  );
321
  }
322
  public static function add( $ban ) {
@@ -329,7 +330,7 @@ class YOP_Poll_Bans {
329
  'b_by' => sanitize_text_field( $ban->ban->b_by ),
330
  'b_value' => sanitize_text_field( $ban->ban->b_value ),
331
  'added_date' => current_time( 'mysql' ),
332
- 'modified_date' => current_time( 'mysql' )
333
  );
334
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_bans, $data ) ) {
335
  self::$errors_present = false;
@@ -339,8 +340,8 @@ class YOP_Poll_Bans {
339
  }
340
  }
341
  return array(
342
- 'success' => !self::$errors_present,
343
- 'error' => self::$error_text
344
  );
345
  }
346
  public static function update( stdClass $ban ) {
@@ -355,7 +356,7 @@ class YOP_Poll_Bans {
355
  'poll_id' => sanitize_text_field( $ban->ban->poll_id ),
356
  'b_by' => sanitize_text_field( $ban->ban->b_by ),
357
  'b_value' => sanitize_text_field( $ban->ban->b_value ),
358
- 'modified_date' => current_time( 'mysql' )
359
  );
360
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_bans, $data, array( 'id' => $ban_id ) ) ) {
361
  self::$errors_present = false;
@@ -369,15 +370,15 @@ class YOP_Poll_Bans {
369
  self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
370
  }
371
  return array(
372
- 'success' => !self::$errors_present,
373
- 'error' => self::$error_text
374
  );
375
  }
376
  public static function delete( $ban_id ) {
377
  $delete_ban_result = $GLOBALS['wpdb']->delete(
378
  $GLOBALS['wpdb']->yop_poll_bans,
379
  array(
380
- 'id' => sanitize_text_field( $ban_id )
381
  )
382
  );
383
  if ( false !== $delete_ban_result ) {
@@ -387,8 +388,8 @@ class YOP_Poll_Bans {
387
  self::$error_text = esc_html__( 'Error deleting ban', 'yop-poll' );
388
  }
389
  return array(
390
- 'success' => !self::$errors_present,
391
- 'error' => self::$error_text
392
  );
393
  }
394
  public static function delete_all_for_poll( $poll_id ) {
@@ -396,7 +397,7 @@ class YOP_Poll_Bans {
396
  $delete_bans_result = $GLOBALS['wpdb']->delete(
397
  $GLOBALS['wpdb']->yop_poll_bans,
398
  array(
399
- 'poll_id' => sanitize_text_field( $poll_id )
400
  )
401
  );
402
  if ( false !== $delete_bans_result ) {
@@ -410,18 +411,19 @@ class YOP_Poll_Bans {
410
  self::$error_text = esc_html__( 'Invalid poll', 'yop-poll' );
411
  }
412
  return array(
413
- 'success' => !self::$errors_present,
414
- 'error' => self::$error_text
415
  );
416
  }
417
  public static function get_ban( $ban_id ) {
418
  $query = $GLOBALS['wpdb']->prepare(
419
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `id` = %s", $ban_id
 
420
  );
421
  $ban = $GLOBALS['wpdb']->get_row( $query, OBJECT );
422
  if ( null !== $ban ) {
423
  return array(
424
- 'ban' => $ban
425
  );
426
  } else {
427
  return false;
@@ -434,7 +436,7 @@ class YOP_Poll_Bans {
434
  } else {
435
  if (
436
  ( false === self::$errors_present ) &&
437
- ( !isset( $ban->poll_id ) ||
438
  ( '' === sanitize_text_field( $ban->poll_id ) ) )
439
  ) {
440
  self::$errors_present = true;
@@ -442,7 +444,7 @@ class YOP_Poll_Bans {
442
  }
443
  if (
444
  ( false === self::$errors_present ) &&
445
- ( !isset( $ban->b_by ) ||
446
  ( '' === sanitize_text_field( $ban->b_by ) ) ||
447
  ( false === in_array( $ban->b_by, self::$by_allowed ) )
448
  )
@@ -452,7 +454,7 @@ class YOP_Poll_Bans {
452
  }
453
  if (
454
  ( false === self::$errors_present ) &&
455
- ( !isset( $ban->b_value ) ||
456
  ( '' === sanitize_text_field( $ban->b_value ) ) )
457
  ) {
458
  self::$errors_present = true;
9
  $bans_per_page = 10;
10
  public static function get_owner( $ban_id ) {
11
  $query = $GLOBALS['wpdb']->prepare(
12
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `id` = %s",
13
+ $ban_id
14
  );
15
  $ban = $GLOBALS['wpdb']->get_row( $query, OBJECT );
16
  if ( null !== $ban ) {
92
  'order_by' => $params['order_by'],
93
  'sort_order' => $params['sort_order'],
94
  'q' => htmlentities( $params['q'] ),
95
+ 'page_no' => $params['page_no'] + 1,
96
  )
97
  )
98
  );
109
  'order_by' => $params['order_by'],
110
  'sort_order' => $params['sort_order'],
111
  'q' => htmlentities( $params['q'] ),
112
+ 'page_no' => intval( $total_pages ),
113
  )
114
  )
115
  );
128
  'order_by' => $params['order_by'],
129
  'sort_order' => $params['sort_order'],
130
  'q' => htmlentities( $params['q'] ),
131
+ 'page_no' => $params['page_no'] - 1,
132
  )
133
  )
134
  );
145
  'order_by' => $params['order_by'],
146
  'sort_order' => $params['sort_order'],
147
  'q' => htmlentities( $params['q'] ),
148
+ 'page_no' => 1,
149
  )
150
  )
151
  );
164
  'order_by' => $params['order_by'],
165
  'sort_order' => $params['sort_order'],
166
  'q' => htmlentities( $params['q'] ),
167
+ 'page_no' => $params['page_no'] - 1,
168
  )
169
  )
170
  );
177
  'order_by' => $params['order_by'],
178
  'sort_order' => $params['sort_order'],
179
  'q' => htmlentities( $params['q'] ),
180
+ 'page_no' => $params['page_no'] + 1,
181
  )
182
  )
183
  );
197
  'order_by' => $params['order_by'],
198
  'sort_order' => $params['sort_order'],
199
  'q' => htmlentities( $params['q'] ),
200
+ 'page_no' => 1,
201
  )
202
  )
203
  );
215
  'order_by' => $params['order_by'],
216
  'sort_order' => $params['sort_order'],
217
  'q' => htmlentities( $params['q'] ),
218
+ 'page_no' => intval( $total_pages ),
219
  )
220
  )
221
  );
233
  return array(
234
  'total_bans' => $total_bans,
235
  'total_pages' => $total_pages,
236
+ 'pagination' => $pagination,
237
  );
238
  }
239
  public static function get_bans( $params ) {
244
  $params['page_no'] = 1;
245
  }
246
  $pagination = self::paginate( $params );
247
+ if ( ! in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
248
  $params['sort_order'] = SORT_ASC;
249
  } elseif ( 'desc' === $params['sort_order'] ) {
250
  $params['sort_order'] = SORT_DESC;
251
  } else {
252
  $params['sort_order'] = SORT_ASC;
253
  }
254
+ if ( ! in_array( $params['order_by'], self::$order_by_allowed ) ) {
255
  $params['order_by'] = 'id';
256
  }
257
  if ( $params['page_no'] > $pagination['total_pages'] ) {
317
  'bans' => $bans,
318
  'total_bans' => $pagination['total_bans'],
319
  'total_pages' => $pagination['total_pages'],
320
+ 'pagination' => $pagination['pagination'],
321
  );
322
  }
323
  public static function add( $ban ) {
330
  'b_by' => sanitize_text_field( $ban->ban->b_by ),
331
  'b_value' => sanitize_text_field( $ban->ban->b_value ),
332
  'added_date' => current_time( 'mysql' ),
333
+ 'modified_date' => current_time( 'mysql' ),
334
  );
335
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_bans, $data ) ) {
336
  self::$errors_present = false;
340
  }
341
  }
342
  return array(
343
+ 'success' => ! self::$errors_present,
344
+ 'error' => self::$error_text,
345
  );
346
  }
347
  public static function update( stdClass $ban ) {
356
  'poll_id' => sanitize_text_field( $ban->ban->poll_id ),
357
  'b_by' => sanitize_text_field( $ban->ban->b_by ),
358
  'b_value' => sanitize_text_field( $ban->ban->b_value ),
359
+ 'modified_date' => current_time( 'mysql' ),
360
  );
361
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_bans, $data, array( 'id' => $ban_id ) ) ) {
362
  self::$errors_present = false;
370
  self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
371
  }
372
  return array(
373
+ 'success' => ! self::$errors_present,
374
+ 'error' => self::$error_text,
375
  );
376
  }
377
  public static function delete( $ban_id ) {
378
  $delete_ban_result = $GLOBALS['wpdb']->delete(
379
  $GLOBALS['wpdb']->yop_poll_bans,
380
  array(
381
+ 'id' => sanitize_text_field( $ban_id ),
382
  )
383
  );
384
  if ( false !== $delete_ban_result ) {
388
  self::$error_text = esc_html__( 'Error deleting ban', 'yop-poll' );
389
  }
390
  return array(
391
+ 'success' => ! self::$errors_present,
392
+ 'error' => self::$error_text,
393
  );
394
  }
395
  public static function delete_all_for_poll( $poll_id ) {
397
  $delete_bans_result = $GLOBALS['wpdb']->delete(
398
  $GLOBALS['wpdb']->yop_poll_bans,
399
  array(
400
+ 'poll_id' => sanitize_text_field( $poll_id ),
401
  )
402
  );
403
  if ( false !== $delete_bans_result ) {
411
  self::$error_text = esc_html__( 'Invalid poll', 'yop-poll' );
412
  }
413
  return array(
414
+ 'success' => ! self::$errors_present,
415
+ 'error' => self::$error_text,
416
  );
417
  }
418
  public static function get_ban( $ban_id ) {
419
  $query = $GLOBALS['wpdb']->prepare(
420
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `id` = %s",
421
+ $ban_id
422
  );
423
  $ban = $GLOBALS['wpdb']->get_row( $query, OBJECT );
424
  if ( null !== $ban ) {
425
  return array(
426
+ 'ban' => $ban,
427
  );
428
  } else {
429
  return false;
436
  } else {
437
  if (
438
  ( false === self::$errors_present ) &&
439
+ ( ! isset( $ban->poll_id ) ||
440
  ( '' === sanitize_text_field( $ban->poll_id ) ) )
441
  ) {
442
  self::$errors_present = true;
444
  }
445
  if (
446
  ( false === self::$errors_present ) &&
447
+ ( ! isset( $ban->b_by ) ||
448
  ( '' === sanitize_text_field( $ban->b_by ) ) ||
449
  ( false === in_array( $ban->b_by, self::$by_allowed ) )
450
  )
454
  }
455
  if (
456
  ( false === self::$errors_present ) &&
457
+ ( ! isset( $ban->b_value ) ||
458
  ( '' === sanitize_text_field( $ban->b_value ) ) )
459
  ) {
460
  self::$errors_present = true;
admin/models/elements.php CHANGED
@@ -19,7 +19,7 @@ class YOP_POLL_Elements {
19
  'sorder' => $display_order,
20
  'meta_data' => serialize( self::create_meta_data( $element ) ),
21
  'added_date' => current_time( 'mysql' ),
22
- 'modified_date' => current_time( 'mysql' )
23
  );
24
  if ( $is_imported ) {
25
  $data['id'] = $element->ID;
@@ -45,7 +45,7 @@ class YOP_POLL_Elements {
45
  }
46
  return array(
47
  'errors_present' => self::$errors_present,
48
- 'error_text' => self::$error_text
49
  );
50
  }
51
  public static function update( $poll_id, $elements ) {
@@ -53,7 +53,7 @@ class YOP_POLL_Elements {
53
  $element_id = 0;
54
  $query_result_error = false;
55
  $current_user = wp_get_current_user();
56
- $new_elements = [];
57
  $i = 0;
58
  foreach ( $elements as $element ) {
59
  if ( false === self::$errors_present ) {
@@ -65,13 +65,15 @@ class YOP_POLL_Elements {
65
  'status' => 'active',
66
  'sorder' => $display_order,
67
  'meta_data' => serialize( self::create_meta_data( $element ) ),
68
- 'modified_date' => current_time( 'mysql' )
69
  );
70
  if ( isset( $element->id ) && ( '' !== $element->id ) ) {
71
  //existing element. doing an update
72
  $query_result_error = $GLOBALS['wpdb']->update(
73
  $GLOBALS['wpdb']->yop_poll_elements,
74
- $data, array( 'id' => $element->id
 
 
75
  )
76
  );
77
  $element_id = $element->id;
@@ -108,21 +110,21 @@ class YOP_POLL_Elements {
108
  'errors_present' => self::$errors_present,
109
  'error_text' => self::$error_text,
110
  'new_elements' => $new_elements,
111
- 'new_subelements' => $sub_elements_result['new_subelements']
112
  );
113
  }
114
  public static function delete( $poll_id, $element_id ) {
115
  if ( 0 < intval( $element_id ) ) {
116
  $data = array(
117
  'status' => 'deleted',
118
- 'sorder' => '0'
119
  );
120
  $delete_result = $GLOBALS['wpdb']->update(
121
  $GLOBALS['wpdb']->yop_poll_elements,
122
  $data,
123
  array(
124
  'id' => sanitize_text_field( $element_id ),
125
- 'poll_id' => sanitize_text_field( $poll_id )
126
  )
127
  );
128
  if ( false === $delete_result ) {
@@ -135,19 +137,19 @@ class YOP_POLL_Elements {
135
  }
136
  return array(
137
  'errors_present' => self::$errors_present,
138
- 'error_text' => self::$error_text
139
  );
140
  }
141
  public static function delete_all_for_poll( $poll_id ) {
142
  $data = array(
143
  'status' => 'deleted',
144
- 'sorder' => '0'
145
  );
146
  $delete_result = $GLOBALS['wpdb']->update(
147
  $GLOBALS['wpdb']->yop_poll_elements,
148
  $data,
149
  array(
150
- 'poll_id' => sanitize_text_field( $poll_id )
151
  )
152
  );
153
  if ( false !== $delete_result ) {
@@ -158,7 +160,7 @@ class YOP_POLL_Elements {
158
  }
159
  return array(
160
  'errors_present' => self::$errors_present,
161
- 'error_text' => self::$error_text
162
  );
163
  }
164
  public static function create_meta_data( $element ) {
@@ -176,7 +178,7 @@ class YOP_POLL_Elements {
176
  'multipleAnswersMaxim' => sanitize_text_field( $element->options->multipleAnswersMaxim ),
177
  'answersDisplay' => sanitize_text_field( $element->options->answersDisplay ),
178
  'answersColumns' => sanitize_text_field( $element->options->answersColumns ),
179
- 'answersSort' => sanitize_text_field( $element->options->answersSort )
180
  );
181
  break;
182
  }
@@ -185,12 +187,12 @@ class YOP_POLL_Elements {
185
  $return_data = array(
186
  'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
187
  'old_id' => sanitize_text_field( $element->options->old_id ),
188
- 'cType' => sanitize_text_field( $element->options->cType )
189
  );
190
  } else {
191
  $return_data = array(
192
  'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
193
- 'cType' => sanitize_text_field( $element->options->cType )
194
  );
195
  }
196
  break;
@@ -254,7 +256,7 @@ class YOP_POLL_Elements {
254
  'sorder' => $element->sorder,
255
  'meta_data' => $element->meta_data,
256
  'added_date' => current_time( 'mysql' ),
257
- 'modified_date' => current_time( 'mysql' )
258
  );
259
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_elements, $data ) ) {
260
  $new_element_id = $GLOBALS['wpdb']->insert_id;
@@ -271,7 +273,7 @@ class YOP_POLL_Elements {
271
  }
272
  return array(
273
  'errors_present' => self::$errors_present,
274
- 'error_text' => self::$error_text
275
  );
276
  }
277
  public static function order_subelements( $subelements, $order_by, $order_rule ) {
19
  'sorder' => $display_order,
20
  'meta_data' => serialize( self::create_meta_data( $element ) ),
21
  'added_date' => current_time( 'mysql' ),
22
+ 'modified_date' => current_time( 'mysql' ),
23
  );
24
  if ( $is_imported ) {
25
  $data['id'] = $element->ID;
45
  }
46
  return array(
47
  'errors_present' => self::$errors_present,
48
+ 'error_text' => self::$error_text,
49
  );
50
  }
51
  public static function update( $poll_id, $elements ) {
53
  $element_id = 0;
54
  $query_result_error = false;
55
  $current_user = wp_get_current_user();
56
+ $new_elements = array();
57
  $i = 0;
58
  foreach ( $elements as $element ) {
59
  if ( false === self::$errors_present ) {
65
  'status' => 'active',
66
  'sorder' => $display_order,
67
  'meta_data' => serialize( self::create_meta_data( $element ) ),
68
+ 'modified_date' => current_time( 'mysql' ),
69
  );
70
  if ( isset( $element->id ) && ( '' !== $element->id ) ) {
71
  //existing element. doing an update
72
  $query_result_error = $GLOBALS['wpdb']->update(
73
  $GLOBALS['wpdb']->yop_poll_elements,
74
+ $data,
75
+ array(
76
+ 'id' => $element->id,
77
  )
78
  );
79
  $element_id = $element->id;
110
  'errors_present' => self::$errors_present,
111
  'error_text' => self::$error_text,
112
  'new_elements' => $new_elements,
113
+ 'new_subelements' => $sub_elements_result['new_subelements'],
114
  );
115
  }
116
  public static function delete( $poll_id, $element_id ) {
117
  if ( 0 < intval( $element_id ) ) {
118
  $data = array(
119
  'status' => 'deleted',
120
+ 'sorder' => '0',
121
  );
122
  $delete_result = $GLOBALS['wpdb']->update(
123
  $GLOBALS['wpdb']->yop_poll_elements,
124
  $data,
125
  array(
126
  'id' => sanitize_text_field( $element_id ),
127
+ 'poll_id' => sanitize_text_field( $poll_id ),
128
  )
129
  );
130
  if ( false === $delete_result ) {
137
  }
138
  return array(
139
  'errors_present' => self::$errors_present,
140
+ 'error_text' => self::$error_text,
141
  );
142
  }
143
  public static function delete_all_for_poll( $poll_id ) {
144
  $data = array(
145
  'status' => 'deleted',
146
+ 'sorder' => '0',
147
  );
148
  $delete_result = $GLOBALS['wpdb']->update(
149
  $GLOBALS['wpdb']->yop_poll_elements,
150
  $data,
151
  array(
152
+ 'poll_id' => sanitize_text_field( $poll_id ),
153
  )
154
  );
155
  if ( false !== $delete_result ) {
160
  }
161
  return array(
162
  'errors_present' => self::$errors_present,
163
+ 'error_text' => self::$error_text,
164
  );
165
  }
166
  public static function create_meta_data( $element ) {
178
  'multipleAnswersMaxim' => sanitize_text_field( $element->options->multipleAnswersMaxim ),
179
  'answersDisplay' => sanitize_text_field( $element->options->answersDisplay ),
180
  'answersColumns' => sanitize_text_field( $element->options->answersColumns ),
181
+ 'answersSort' => sanitize_text_field( $element->options->answersSort ),
182
  );
183
  break;
184
  }
187
  $return_data = array(
188
  'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
189
  'old_id' => sanitize_text_field( $element->options->old_id ),
190
+ 'cType' => sanitize_text_field( $element->options->cType ),
191
  );
192
  } else {
193
  $return_data = array(
194
  'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
195
+ 'cType' => sanitize_text_field( $element->options->cType ),
196
  );
197
  }
198
  break;
256
  'sorder' => $element->sorder,
257
  'meta_data' => $element->meta_data,
258
  'added_date' => current_time( 'mysql' ),
259
+ 'modified_date' => current_time( 'mysql' ),
260
  );
261
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_elements, $data ) ) {
262
  $new_element_id = $GLOBALS['wpdb']->insert_id;
273
  }
274
  return array(
275
  'errors_present' => self::$errors_present,
276
+ 'error_text' => self::$error_text,
277
  );
278
  }
279
  public static function order_subelements( $subelements, $order_by, $order_rule ) {
admin/models/logs.php CHANGED
@@ -29,7 +29,7 @@ class YOP_Poll_Logs {
29
  'voter_fingerprint' => sanitize_text_field( $vote->user->f_data ),
30
  'vote_data' => serialize( YOP_Poll_Votes::create_meta_data( $vote ) ),
31
  'vote_message' => serialize( $message ),
32
- 'added_date' => sanitize_text_field( $vote->added_date )
33
  );
34
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_logs, $data );
35
  }
@@ -115,7 +115,7 @@ class YOP_Poll_Logs {
115
  'order_by' => $params['order_by'],
116
  'sort_order' => $params['sort_order'],
117
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
118
- 'page_no' => $params['page_no'] + 1
119
  )
120
  )
121
  );
@@ -132,7 +132,7 @@ class YOP_Poll_Logs {
132
  'order_by' => $params['order_by'],
133
  'sort_order' => $params['sort_order'],
134
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
135
- 'page_no' => intval( $total_pages )
136
  )
137
  )
138
  );
@@ -151,7 +151,7 @@ class YOP_Poll_Logs {
151
  'order_by' => $params['order_by'],
152
  'sort_order' => $params['sort_order'],
153
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
154
- 'page_no' => $params['page_no'] - 1
155
  )
156
  )
157
  );
@@ -168,7 +168,7 @@ class YOP_Poll_Logs {
168
  'order_by' => $params['order_by'],
169
  'sort_order' => $params['sort_order'],
170
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
171
- 'page_no' => 1
172
  )
173
  )
174
  );
@@ -187,7 +187,7 @@ class YOP_Poll_Logs {
187
  'order_by' => $params['order_by'],
188
  'sort_order' => $params['sort_order'],
189
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
190
- 'page_no' => $params['page_no'] - 1
191
  )
192
  )
193
  );
@@ -200,7 +200,7 @@ class YOP_Poll_Logs {
200
  'order_by' => $params['order_by'],
201
  'sort_order' => $params['sort_order'],
202
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
203
- 'page_no' => $params['page_no'] + 1
204
  )
205
  )
206
  );
@@ -220,7 +220,7 @@ class YOP_Poll_Logs {
220
  'order_by' => $params['order_by'],
221
  'sort_order' => $params['sort_order'],
222
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
223
- 'page_no' => 1
224
  )
225
  )
226
  );
@@ -238,7 +238,7 @@ class YOP_Poll_Logs {
238
  'order_by' => $params['order_by'],
239
  'sort_order' => $params['sort_order'],
240
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
241
- 'page_no' => intval( $total_pages )
242
  )
243
  )
244
  );
@@ -256,26 +256,26 @@ class YOP_Poll_Logs {
256
  return array(
257
  'total_logs' => $total_logs,
258
  'total_pages' => $total_pages,
259
- 'pagination' => $pagination
260
  );
261
  }
262
  public static function get_logs( $params ) {
263
  $query = '';
264
  $logs = array();
265
- $order_by = [];
266
  $current_user = wp_get_current_user();
267
  if ( 0 >= intval( $params['page_no'] ) ) {
268
  $params['page_no'] = 1;
269
  }
270
  $pagination = self::paginate( $params );
271
- if ( !in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
272
  $params['sort_order'] = SORT_ASC;
273
  } elseif ( 'desc' === $params['sort_order'] ) {
274
  $params['sort_order'] = SORT_DESC;
275
  } else {
276
  $params['sort_order'] = SORT_ASC;
277
  }
278
- if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
279
  $params['order_by'] = 'id';
280
  }
281
  if ( $params['page_no'] > $pagination['total_pages'] ) {
@@ -355,7 +355,7 @@ class YOP_Poll_Logs {
355
  'logs' => $logs,
356
  'total_logs' => $pagination['total_logs'],
357
  'total_pages' => $pagination['total_pages'],
358
- 'pagination' => $pagination['pagination']
359
  );
360
  }
361
  public static function get_export_logs( $params ) {
@@ -426,11 +426,11 @@ class YOP_Poll_Logs {
426
  public static function send_logs_to_download() {
427
  $date_format = get_option( 'date_format' );
428
  $time_format = get_option( 'time_format' );
429
- if ( isset ( $_REQUEST ['doExport'] ) && 'true' === $_REQUEST['doExport'] ) {
430
  $params['q'] = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '';
431
  $logs = self::get_export_logs( $params );
432
  $csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
433
- $csv_header_array = [
434
  esc_html__( 'Poll Name', 'yop-poll' ),
435
  esc_html__( 'Username', 'yop-poll' ),
436
  esc_html__( 'Email', 'yop-poll' ),
@@ -438,8 +438,8 @@ class YOP_Poll_Logs {
438
  esc_html__( 'IP', 'yop-poll' ),
439
  esc_html__( 'Date', 'yop-poll' ),
440
  esc_html__( 'Message', 'yop-poll' ),
441
- esc_html__( 'Vote data', 'yop-poll' )
442
- ];
443
  header( 'Content-Type: text/csv' );
444
  header( 'Cache-Control: must-revalidate, post-check=0,pre-check=0' );
445
  header( "Content-Transfer-Encoding: binary\n" );
@@ -449,11 +449,11 @@ class YOP_Poll_Logs {
449
  header( 'Expires: 0' );
450
  ob_start();
451
  $f = fopen( 'php://output', 'w' ) or show_error( esc_html__( "Can't open php://output!", 'yop-poll' ) );
452
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $csv_header_array ) ) {
453
  esc_html_e( "Can't write header!", 'yop-poll' );
454
  }
455
  $logs_for_csv = [];
456
- if ( count( $logs ) > 0 ){
457
  foreach ( $logs as $log ) {
458
  $log_details = self::get_log_details( $log['id'] );
459
  $details_string = '';
@@ -468,7 +468,7 @@ class YOP_Poll_Logs {
468
  }
469
  }
470
  }
471
- $logs_data = [
472
  $log ['name'],
473
  $log['user_id'],
474
  $log ['user_email'],
@@ -476,10 +476,10 @@ class YOP_Poll_Logs {
476
  $log ['ipaddress'],
477
  date( $date_format . ' @ ' . $time_format, strtotime( $log['added_date'] ) ),
478
  $log['vote_message'],
479
- $details_string
480
- ];
481
  $logs_for_csv[] = $logs_data;
482
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $logs_data, ',', '"' ) ) {
483
  esc_html_e( "Can't write logs!", 'yop-poll' );
484
  }
485
  }
@@ -493,7 +493,8 @@ class YOP_Poll_Logs {
493
  }
494
  public static function get_owner( $log_id ) {
495
  $query = $GLOBALS['wpdb']->prepare(
496
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %s", $log_id
 
497
  );
498
  $log = $GLOBALS['wpdb']->get_row( $query, OBJECT );
499
  if ( null !== $log ) {
@@ -506,7 +507,7 @@ class YOP_Poll_Logs {
506
  $delete_log_result = $GLOBALS['wpdb']->delete(
507
  $GLOBALS['wpdb']->yop_poll_logs,
508
  array(
509
- 'id' => $log_id
510
  )
511
  );
512
  if ( false !== $delete_log_result ) {
@@ -516,13 +517,14 @@ class YOP_Poll_Logs {
516
  self::$error_text = esc_html__( 'Error deleting log', 'yop-poll' );
517
  }
518
  return array(
519
- 'success' => !self::$errors_present,
520
- 'error' => self::$error_text
521
  );
522
  }
523
  public static function get_log_details( $log_id ) {
524
  $query = $GLOBALS['wpdb']->prepare(
525
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %d", $log_id
 
526
  );
527
  $log = $GLOBALS['wpdb']->get_row( $query, OBJECT );
528
  if ( null !== $log ) {
@@ -530,14 +532,14 @@ class YOP_Poll_Logs {
530
  if ( count( $vote_data ) > 0 ) {
531
  if ( isset( $vote_data['elements'] ) ) {
532
  $vote_elements = $vote_data['elements'];
533
- $questions = [];
534
- $questions_ids = [];
535
- $answers_ids = [];
536
- $questions_results = [];
537
- $answers_results = [];
538
  if ( count( $vote_elements ) > 0 ) {
539
  foreach ( $vote_elements as $ve ) {
540
- $qanswers = [];
541
  if ( isset( $ve['id'] ) ) {
542
  $questions_ids[] = $ve['id'];
543
  }
@@ -552,23 +554,32 @@ class YOP_Poll_Logs {
552
  }
553
  }
554
  if ( count( $questions_ids ) > 0 ) {
555
- $question_ids_escaped = array_map( function( $question_id ) {
556
- return "'" . esc_sql( $question_id ) . "'";
557
- }, $questions_ids );
 
 
 
558
  $questions_ids_string = '(' . implode( ',', $question_ids_escaped ) . ')';
559
  $questions_query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_elements} where `id` IN $questions_ids_string";
560
  $questions_results = $GLOBALS['wpdb']->get_results( $questions_query, OBJECT );
561
  }
562
  if ( count( $answers_ids ) > 0 ) {
563
- $answers_ids_escaped = array_map( function( $answer_id ) {
564
- return "'" . esc_sql( $answer_id ) . "'";
565
- }, $answers_ids );
 
 
 
566
  $answers_ids_string = '(' . implode( ',', $answers_ids_escaped ) . ')';
567
  $answers_query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_subelements} where `id` IN $answers_ids_string";
568
  $answers_results = $GLOBALS['wpdb']->get_results( $answers_query, OBJECT );
569
  }
570
  foreach ( $vote_elements as $ve ) {
571
- $pqa = [ 'question' => '', 'answers' => [] ];
 
 
 
572
  switch ( $ve['type'] ) {
573
  case 'question': {
574
  if ( isset( $ve['id'] ) ) {
@@ -581,11 +592,17 @@ class YOP_Poll_Logs {
581
  if ( isset( $ve['data'] ) ) {
582
  foreach ( $ve['data'] as $vdata ) {
583
  if ( 0 == $vdata['id'] ) {
584
- $pqa['answers'][] = [ 'answer_text' => 'other', 'answer_value' => $vdata['data'] ];
 
 
 
585
  } else {
586
  foreach ( $answers_results as $ares ) {
587
  if ( $vdata['id'] == $ares->id ) {
588
- $pqa['answers'][] = [ 'answer_text' => '', 'answer_value' => $ares->stext ];
 
 
 
589
  }
590
  }
591
  }
@@ -604,7 +621,10 @@ class YOP_Poll_Logs {
604
  }
605
  }
606
  if ( isset( $ve['data'] ) ) {
607
- $pqa['answers'][] = [ 'answer_text' => 'custom-field', 'answer_value' => $ve['data'][0] ];
 
 
 
608
  }
609
  $questions[] = $pqa;
610
  break;
@@ -613,21 +633,21 @@ class YOP_Poll_Logs {
613
  }
614
  return $questions;
615
  } else {
616
- return [];
617
  }
618
  } else {
619
- return [];
620
  }
621
  }
622
  } else {
623
- return [];
624
  }
625
  }
626
  public static function delete_all_for_poll( $poll_id ) {
627
  $delete_log_result = $GLOBALS['wpdb']->delete(
628
  $GLOBALS['wpdb']->yop_poll_logs,
629
  array(
630
- 'poll_id' => $poll_id
631
  )
632
  );
633
  if ( false !== $delete_log_result ) {
@@ -637,8 +657,8 @@ class YOP_Poll_Logs {
637
  self::$error_text = esc_html__( 'Error deleting logs', 'yop-poll' );
638
  }
639
  return array(
640
- 'success' => !self::$errors_present,
641
- 'error' => self::$error_text
642
  );
643
  }
644
  }
29
  'voter_fingerprint' => sanitize_text_field( $vote->user->f_data ),
30
  'vote_data' => serialize( YOP_Poll_Votes::create_meta_data( $vote ) ),
31
  'vote_message' => serialize( $message ),
32
+ 'added_date' => sanitize_text_field( $vote->added_date ),
33
  );
34
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_logs, $data );
35
  }
115
  'order_by' => $params['order_by'],
116
  'sort_order' => $params['sort_order'],
117
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
118
+ 'page_no' => $params['page_no'] + 1,
119
  )
120
  )
121
  );
132
  'order_by' => $params['order_by'],
133
  'sort_order' => $params['sort_order'],
134
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
135
+ 'page_no' => intval( $total_pages ),
136
  )
137
  )
138
  );
151
  'order_by' => $params['order_by'],
152
  'sort_order' => $params['sort_order'],
153
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
154
+ 'page_no' => $params['page_no'] - 1,
155
  )
156
  )
157
  );
168
  'order_by' => $params['order_by'],
169
  'sort_order' => $params['sort_order'],
170
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
171
+ 'page_no' => 1,
172
  )
173
  )
174
  );
187
  'order_by' => $params['order_by'],
188
  'sort_order' => $params['sort_order'],
189
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
190
+ 'page_no' => $params['page_no'] - 1,
191
  )
192
  )
193
  );
200
  'order_by' => $params['order_by'],
201
  'sort_order' => $params['sort_order'],
202
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
203
+ 'page_no' => $params['page_no'] + 1,
204
  )
205
  )
206
  );
220
  'order_by' => $params['order_by'],
221
  'sort_order' => $params['sort_order'],
222
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
223
+ 'page_no' => 1,
224
  )
225
  )
226
  );
238
  'order_by' => $params['order_by'],
239
  'sort_order' => $params['sort_order'],
240
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
241
+ 'page_no' => intval( $total_pages ),
242
  )
243
  )
244
  );
256
  return array(
257
  'total_logs' => $total_logs,
258
  'total_pages' => $total_pages,
259
+ 'pagination' => $pagination,
260
  );
261
  }
262
  public static function get_logs( $params ) {
263
  $query = '';
264
  $logs = array();
265
+ $order_by = array();
266
  $current_user = wp_get_current_user();
267
  if ( 0 >= intval( $params['page_no'] ) ) {
268
  $params['page_no'] = 1;
269
  }
270
  $pagination = self::paginate( $params );
271
+ if ( ! in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
272
  $params['sort_order'] = SORT_ASC;
273
  } elseif ( 'desc' === $params['sort_order'] ) {
274
  $params['sort_order'] = SORT_DESC;
275
  } else {
276
  $params['sort_order'] = SORT_ASC;
277
  }
278
+ if ( ! in_array( $params['order_by'], self::$order_by_allowed ) ) {
279
  $params['order_by'] = 'id';
280
  }
281
  if ( $params['page_no'] > $pagination['total_pages'] ) {
355
  'logs' => $logs,
356
  'total_logs' => $pagination['total_logs'],
357
  'total_pages' => $pagination['total_pages'],
358
+ 'pagination' => $pagination['pagination'],
359
  );
360
  }
361
  public static function get_export_logs( $params ) {
426
  public static function send_logs_to_download() {
427
  $date_format = get_option( 'date_format' );
428
  $time_format = get_option( 'time_format' );
429
+ if ( isset( $_REQUEST ['doExport'] ) && 'true' === $_REQUEST['doExport'] ) {
430
  $params['q'] = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : '';
431
  $logs = self::get_export_logs( $params );
432
  $csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
433
+ $csv_header_array = array(
434
  esc_html__( 'Poll Name', 'yop-poll' ),
435
  esc_html__( 'Username', 'yop-poll' ),
436
  esc_html__( 'Email', 'yop-poll' ),
438
  esc_html__( 'IP', 'yop-poll' ),
439
  esc_html__( 'Date', 'yop-poll' ),
440
  esc_html__( 'Message', 'yop-poll' ),
441
+ esc_html__( 'Vote data', 'yop-poll' ),
442
+ );
443
  header( 'Content-Type: text/csv' );
444
  header( 'Cache-Control: must-revalidate, post-check=0,pre-check=0' );
445
  header( "Content-Transfer-Encoding: binary\n" );
449
  header( 'Expires: 0' );
450
  ob_start();
451
  $f = fopen( 'php://output', 'w' ) or show_error( esc_html__( "Can't open php://output!", 'yop-poll' ) );
452
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $csv_header_array ) ) {
453
  esc_html_e( "Can't write header!", 'yop-poll' );
454
  }
455
  $logs_for_csv = [];
456
+ if ( count( $logs ) > 0 ) {
457
  foreach ( $logs as $log ) {
458
  $log_details = self::get_log_details( $log['id'] );
459
  $details_string = '';
468
  }
469
  }
470
  }
471
+ $logs_data = array(
472
  $log ['name'],
473
  $log['user_id'],
474
  $log ['user_email'],
476
  $log ['ipaddress'],
477
  date( $date_format . ' @ ' . $time_format, strtotime( $log['added_date'] ) ),
478
  $log['vote_message'],
479
+ $details_string,
480
+ );
481
  $logs_for_csv[] = $logs_data;
482
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $logs_data, ',', '"' ) ) {
483
  esc_html_e( "Can't write logs!", 'yop-poll' );
484
  }
485
  }
493
  }
494
  public static function get_owner( $log_id ) {
495
  $query = $GLOBALS['wpdb']->prepare(
496
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %s",
497
+ $log_id
498
  );
499
  $log = $GLOBALS['wpdb']->get_row( $query, OBJECT );
500
  if ( null !== $log ) {
507
  $delete_log_result = $GLOBALS['wpdb']->delete(
508
  $GLOBALS['wpdb']->yop_poll_logs,
509
  array(
510
+ 'id' => $log_id,
511
  )
512
  );
513
  if ( false !== $delete_log_result ) {
517
  self::$error_text = esc_html__( 'Error deleting log', 'yop-poll' );
518
  }
519
  return array(
520
+ 'success' => ! self::$errors_present,
521
+ 'error' => self::$error_text,
522
  );
523
  }
524
  public static function get_log_details( $log_id ) {
525
  $query = $GLOBALS['wpdb']->prepare(
526
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %d",
527
+ $log_id
528
  );
529
  $log = $GLOBALS['wpdb']->get_row( $query, OBJECT );
530
  if ( null !== $log ) {
532
  if ( count( $vote_data ) > 0 ) {
533
  if ( isset( $vote_data['elements'] ) ) {
534
  $vote_elements = $vote_data['elements'];
535
+ $questions = array();
536
+ $questions_ids = array();
537
+ $answers_ids = array();
538
+ $questions_results = array();
539
+ $answers_results = array();
540
  if ( count( $vote_elements ) > 0 ) {
541
  foreach ( $vote_elements as $ve ) {
542
+ $qanswers = array();
543
  if ( isset( $ve['id'] ) ) {
544
  $questions_ids[] = $ve['id'];
545
  }
554
  }
555
  }
556
  if ( count( $questions_ids ) > 0 ) {
557
+ $question_ids_escaped = array_map(
558
+ function( $question_id ) {
559
+ return "'" . esc_sql( $question_id ) . "'";
560
+ },
561
+ $questions_ids
562
+ );
563
  $questions_ids_string = '(' . implode( ',', $question_ids_escaped ) . ')';
564
  $questions_query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_elements} where `id` IN $questions_ids_string";
565
  $questions_results = $GLOBALS['wpdb']->get_results( $questions_query, OBJECT );
566
  }
567
  if ( count( $answers_ids ) > 0 ) {
568
+ $answers_ids_escaped = array_map(
569
+ function( $answer_id ) {
570
+ return "'" . esc_sql( $answer_id ) . "'";
571
+ },
572
+ $answers_ids
573
+ );
574
  $answers_ids_string = '(' . implode( ',', $answers_ids_escaped ) . ')';
575
  $answers_query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_subelements} where `id` IN $answers_ids_string";
576
  $answers_results = $GLOBALS['wpdb']->get_results( $answers_query, OBJECT );
577
  }
578
  foreach ( $vote_elements as $ve ) {
579
+ $pqa = array(
580
+ 'question' => '',
581
+ 'answers' => array(),
582
+ );
583
  switch ( $ve['type'] ) {
584
  case 'question': {
585
  if ( isset( $ve['id'] ) ) {
592
  if ( isset( $ve['data'] ) ) {
593
  foreach ( $ve['data'] as $vdata ) {
594
  if ( 0 == $vdata['id'] ) {
595
+ $pqa['answers'][] = array(
596
+ 'answer_text' => 'other',
597
+ 'answer_value' => $vdata['data'],
598
+ );
599
  } else {
600
  foreach ( $answers_results as $ares ) {
601
  if ( $vdata['id'] == $ares->id ) {
602
+ $pqa['answers'][] = array(
603
+ 'answer_text' => '',
604
+ 'answer_value' => $ares->stext,
605
+ );
606
  }
607
  }
608
  }
621
  }
622
  }
623
  if ( isset( $ve['data'] ) ) {
624
+ $pqa['answers'][] = array(
625
+ 'answer_text' => 'custom-field',
626
+ 'answer_value' => $ve['data'][0],
627
+ );
628
  }
629
  $questions[] = $pqa;
630
  break;
633
  }
634
  return $questions;
635
  } else {
636
+ return array();
637
  }
638
  } else {
639
+ return array();
640
  }
641
  }
642
  } else {
643
+ return array();
644
  }
645
  }
646
  public static function delete_all_for_poll( $poll_id ) {
647
  $delete_log_result = $GLOBALS['wpdb']->delete(
648
  $GLOBALS['wpdb']->yop_poll_logs,
649
  array(
650
+ 'poll_id' => $poll_id,
651
  )
652
  );
653
  if ( false !== $delete_log_result ) {
657
  self::$error_text = esc_html__( 'Error deleting logs', 'yop-poll' );
658
  }
659
  return array(
660
+ 'success' => ! self::$errors_present,
661
+ 'error' => self::$error_text,
662
  );
663
  }
664
  }
admin/models/polls.php CHANGED
@@ -61,7 +61,8 @@ class YOP_Poll_Polls {
61
  }
62
  public static function get_owner( $poll_id ) {
63
  $query = $GLOBALS['wpdb']->prepare(
64
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s", $poll_id
 
65
  );
66
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
67
  if ( null !== $poll ) {
@@ -144,7 +145,7 @@ class YOP_Poll_Polls {
144
  'order_by' => $params['order_by'],
145
  'sort_order' => $params['sort_order'],
146
  'q' => htmlentities( $params['q'] ),
147
- 'page_no' => $params['page_no'] + 1
148
  )
149
  )
150
  );
@@ -161,7 +162,7 @@ class YOP_Poll_Polls {
161
  'order_by' => $params['order_by'],
162
  'sort_order' => $params['sort_order'],
163
  'q' => htmlentities( $params['q'] ),
164
- 'page_no' => intval( $total_pages )
165
  )
166
  )
167
  );
@@ -180,7 +181,7 @@ class YOP_Poll_Polls {
180
  'order_by' => $params['order_by'],
181
  'sort_order' => $params['sort_order'],
182
  'q' => htmlentities( $params['q'] ),
183
- 'page_no' => $params['page_no'] - 1
184
  )
185
  )
186
  );
@@ -197,7 +198,7 @@ class YOP_Poll_Polls {
197
  'order_by' => $params['order_by'],
198
  'sort_order' => $params['sort_order'],
199
  'q' => htmlentities( $params['q'] ),
200
- 'page_no' => 1
201
  )
202
  )
203
  );
@@ -216,7 +217,7 @@ class YOP_Poll_Polls {
216
  'order_by' => $params['order_by'],
217
  'sort_order' => $params['sort_order'],
218
  'q' => htmlentities( $params['q'] ),
219
- 'page_no' => $params['page_no'] - 1
220
  )
221
  )
222
  );
@@ -229,7 +230,7 @@ class YOP_Poll_Polls {
229
  'order_by' => $params['order_by'],
230
  'sort_order' => $params['sort_order'],
231
  'q' => htmlentities( $params['q'] ),
232
- 'page_no' => $params['page_no'] + 1
233
  )
234
  )
235
  );
@@ -249,7 +250,7 @@ class YOP_Poll_Polls {
249
  'order_by' => $params['order_by'],
250
  'sort_order' => $params['sort_order'],
251
  'q' => htmlentities( $params['q'] ),
252
- 'page_no' => 1
253
  )
254
  )
255
  );
@@ -267,7 +268,7 @@ class YOP_Poll_Polls {
267
  'order_by' => $params['order_by'],
268
  'sort_order' => $params['sort_order'],
269
  'q' => htmlentities( $params['q'] ),
270
- 'page_no' => intval( $total_pages )
271
  )
272
  )
273
  );
@@ -285,7 +286,7 @@ class YOP_Poll_Polls {
285
  return array(
286
  'total_polls' => $total_polls,
287
  'total_pages' => $total_pages,
288
- 'pagination' => $pagination
289
  );
290
  }
291
  public static function get_polls( $params ) {
@@ -296,21 +297,21 @@ class YOP_Poll_Polls {
296
  'draft' => 0,
297
  'archived' => 0,
298
  'ending-soon' => 0,
299
- 'ended' => 0
300
  );
301
  $current_user = wp_get_current_user();
302
  if ( 0 >= intval( $params['page_no'] ) ) {
303
  $params['page_no'] = 1;
304
  }
305
  $pagination = self::paginate( $params );
306
- if ( !in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
307
  $params['sort_order'] = SORT_ASC;
308
  } elseif ( 'desc' === $params['sort_order'] ) {
309
  $params['sort_order'] = SORT_DESC;
310
  } else {
311
  $params['sort_order'] = SORT_ASC;
312
  }
313
- if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
314
  $params['order_by'] = 'id';
315
  }
316
  if ( $params['page_no'] > $pagination['total_pages'] ) {
@@ -400,7 +401,7 @@ class YOP_Poll_Polls {
400
  'statistics' => $statistics,
401
  'total_polls' => $pagination['total_polls'],
402
  'total_pages' => $pagination['total_pages'],
403
- 'pagination' => $pagination['pagination']
404
  );
405
  }
406
  public static function get_names() {
@@ -441,7 +442,7 @@ class YOP_Poll_Polls {
441
  'total_submits' => 0,
442
  'total_submited_answers' => 0,
443
  'added_date' => isset( $poll->added_date ) ? sanitize_text_field( $poll->added_date ) : current_time( 'mysql' ),
444
- 'modified_date' => isset( $poll->modified_date ) ? sanitize_text_field( $poll->modified_date ) : current_time( 'mysql' )
445
  );
446
  if ( isset( $poll->ID ) && is_numeric( $poll->ID ) ) {
447
  $data['id'] = $poll->ID;
@@ -464,20 +465,22 @@ class YOP_Poll_Polls {
464
  }
465
  if ( false === $elements_result['errors_present'] ) {
466
  if ( 'yes' === $poll->options->poll->autoGeneratePollPage ) {
467
- $page_id = wp_insert_post( array(
468
- 'post_title' => sanitize_text_field( $poll->name ),
469
- 'post_content' => "[yop_poll id='{$poll_id}']",
470
- 'post_status' => 'publish',
471
- 'post_type' => 'page',
472
- 'comment_status' => 'open',
473
- 'ping_status' => 'open',
474
- 'post_category' => array( 1 )
475
- ) );
 
 
476
  if ( 0 !== $page_id ) {
477
  $poll_meta_data['options']['poll']['pageId'] = $page_id;
478
  $poll_meta_data['options']['poll']['pageLink'] = get_permalink( $page_id );
479
  $data = array(
480
- 'meta_data' => serialize( $poll_meta_data )
481
  );
482
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
483
  self::$errors_present = false;
@@ -500,9 +503,9 @@ class YOP_Poll_Polls {
500
  }
501
  }
502
  return array(
503
- 'success' => !self::$errors_present,
504
  'error' => self::$error_text,
505
- 'poll_id' => $poll_id
506
  );
507
  }
508
  public static function check_for_name( $poll_name ) {
@@ -533,20 +536,24 @@ class YOP_Poll_Polls {
533
  $has_page = false;
534
  }
535
  if ( false === $has_page ) {
536
- $page_id = wp_insert_post( array(
537
- 'post_title' => sanitize_text_field( $poll->name ),
538
- 'post_content' => "[yop_poll id='{$poll_id}']",
539
- 'post_status' => 'publish',
540
- 'post_type' => 'page',
541
- 'comment_status' => 'open',
542
- 'ping_status' => 'open',
543
- 'post_category' => array( 1 )
544
- ) );
 
 
545
  } else {
546
- wp_update_post( array(
547
- 'ID' => $db_poll_meta['options']['poll']['pageId'],
548
- 'post_title' => $poll->name
549
- ) );
 
 
550
  $page_id = $db_poll_meta['options']['poll']['pageId'];
551
  }
552
 
@@ -570,7 +577,7 @@ class YOP_Poll_Polls {
570
  'stype' => 'poll',
571
  'status' => sanitize_text_field( $poll->status ),
572
  'meta_data' => serialize( $poll_meta_data ),
573
- 'modified_date' => current_time( 'mysql' )
574
  );
575
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
576
  $elements_result = YOP_Poll_Elements::update( $poll_id, $poll->elements );
@@ -595,10 +602,10 @@ class YOP_Poll_Polls {
595
  self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
596
  }
597
  return array(
598
- 'success' => !self::$errors_present,
599
  'error' => self::$error_text,
600
- 'new-elements' => isset( $elements_result['new_elements'] ) ? $elements_result['new_elements'] : [],
601
- 'new-subelements' => isset( $elements_result['new_subelements'] ) ? $elements_result['new_subelements'] : [],
602
  );
603
  }
604
  public static function delete( $poll_id ) {
@@ -611,7 +618,7 @@ class YOP_Poll_Polls {
611
  $GLOBALS['wpdb']->yop_poll_polls,
612
  $data,
613
  array(
614
- 'id' => $poll_id
615
  )
616
  );
617
  if ( false !== $delete_poll_result ) {
@@ -636,14 +643,15 @@ class YOP_Poll_Polls {
636
  self::$error_text = esc_html__( 'Error deleting poll', 'yop-poll' );
637
  }
638
  return array(
639
- 'success' => !self::$errors_present,
640
- 'error' => self::$error_text
641
  );
642
  }
643
  public static function clone_poll( $poll_id ) {
644
  $current_user = wp_get_current_user();
645
  $poll_query = $GLOBALS['wpdb']->prepare(
646
- "SELECT * from {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id`=%s", $poll_id
 
647
  );
648
  $cloned_poll = $GLOBALS['wpdb']->get_row( $poll_query, OBJECT );
649
  $data = array(
@@ -657,7 +665,7 @@ class YOP_Poll_Polls {
657
  'meta_data' => $cloned_poll->meta_data,
658
  'total_submits' => 0,
659
  'added_date' => current_time( 'mysql' ),
660
- 'modified_date' => current_time( 'mysql' )
661
  );
662
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_polls, $data ) ) {
663
  $new_poll_id = $GLOBALS['wpdb']->insert_id;
@@ -668,20 +676,22 @@ class YOP_Poll_Polls {
668
  }
669
  $new_poll_meta_data = unserialize( $cloned_poll->meta_data );
670
  if ( 'yes' === $new_poll_meta_data['options']['poll']['autoGeneratePollPage'] ) {
671
- $page_id = wp_insert_post( array(
672
- 'post_title' => $cloned_poll->name . ' ' . esc_html__( 'clone', 'yop-poll' ),
673
- 'post_content' => "[yop_poll id='{$new_poll_id}']",
674
- 'post_status' => 'publish',
675
- 'post_type' => 'page',
676
- 'comment_status' => 'open',
677
- 'ping_status' => 'open',
678
- 'post_category' => array( 1 )
679
- ) );
 
 
680
  if ( 0 !== $page_id ) {
681
  $new_poll_meta_data['options']['poll']['pageId'] = $page_id;
682
  $ne_poll_meta_data['options']['poll']['pageLink'] = get_permalink( $page_id );
683
  $data = array(
684
- 'meta_data' => serialize( $new_poll_meta_data )
685
  );
686
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $new_poll_id ) ) ) {
687
  self::$errors_present = false;
@@ -696,15 +706,15 @@ class YOP_Poll_Polls {
696
  self::$error_text = esc_html__( 'Error cloning poll', 'yop-poll' );
697
  }
698
  return array(
699
- 'success' => !self::$errors_present,
700
- 'error' => self::$error_text
701
  );
702
  }
703
  public static function reset_poll( $poll_id ) {
704
  $data = array(
705
  'total_submits' => '0',
706
  'total_submited_answers' => '0',
707
- 'modified_date' => current_time( 'mysql' )
708
  );
709
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
710
  YOP_Poll_SubElements::delete_others_for_poll( $poll_id );
@@ -715,8 +725,8 @@ class YOP_Poll_Polls {
715
  self::$error_text = esc_html__( 'Error resetting votes', 'yop-poll' );
716
  }
717
  return array(
718
- 'success' => !self::$errors_present,
719
- 'error' => self::$error_text
720
  );
721
  }
722
  public static function create_meta_data( stdClass $poll ) {
@@ -728,13 +738,13 @@ class YOP_Poll_Polls {
728
  'borderColor' => sanitize_text_field( $poll->design->style->poll->borderColor ),
729
  'borderRadius' => sanitize_text_field( $poll->design->style->poll->borderRadius ),
730
  'paddingLeftRight' => sanitize_text_field( $poll->design->style->poll->paddingLeftRight ),
731
- 'paddingTopBottom' => sanitize_text_field( $poll->design->style->poll->paddingTopBottom )
732
  ),
733
  'questions' => array(
734
  'textColor' => sanitize_text_field( $poll->design->style->questions->textColor ),
735
  'textSize' => sanitize_text_field( $poll->design->style->questions->textSize ),
736
  'textWeight' => sanitize_text_field( $poll->design->style->questions->textWeight ),
737
- 'textAlign' => sanitize_text_field( $poll->design->style->questions->textAlign )
738
  ),
739
  'answers' => array(
740
  'paddingLeftRight' => sanitize_text_field( $poll->design->style->answers->paddingLeftRight ),
@@ -743,7 +753,7 @@ class YOP_Poll_Polls {
743
  'textSize' => sanitize_text_field( $poll->design->style->answers->textSize ),
744
  'textWeight' => sanitize_text_field( $poll->design->style->answers->textWeight ),
745
  'skin' => sanitize_text_field( $poll->design->style->answers->skin ),
746
- 'colorScheme' => sanitize_text_field( $poll->design->style->answers->colorScheme )
747
  ),
748
  'buttons' => array(
749
  'backgroundColor' => sanitize_text_field( $poll->design->style->buttons->backgroundColor ),
@@ -754,7 +764,7 @@ class YOP_Poll_Polls {
754
  'paddingTopBottom' => sanitize_text_field( $poll->design->style->buttons->paddingTopBottom ),
755
  'textColor' => sanitize_text_field( $poll->design->style->buttons->textColor ),
756
  'textSize' => sanitize_text_field( $poll->design->style->buttons->textSize ),
757
- 'textWeight' => sanitize_text_field( $poll->design->style->buttons->textWeight )
758
  ),
759
  'captcha' => array(),
760
  'errors' => array(
@@ -764,11 +774,11 @@ class YOP_Poll_Polls {
764
  'paddingTopBottom' => sanitize_text_field( $poll->design->style->errors->paddingTopBottom ),
765
  'textColor' => sanitize_text_field( $poll->design->style->errors->textColor ),
766
  'textSize' => sanitize_text_field( $poll->design->style->errors->textSize ),
767
- 'textWeight' => sanitize_text_field( $poll->design->style->errors->textWeight )
768
  ),
769
  'custom' => array(
770
- 'css' => sanitize_text_field( $poll->design->style->custom->css )
771
- )
772
  ),
773
  'options' => array(
774
  'poll' => array(
@@ -799,7 +809,7 @@ class YOP_Poll_Polls {
799
  'emailNotificationsMessage' => wp_kses(
800
  $poll->options->poll->emailNotificationsMessage,
801
  array(
802
- 'br' => array()
803
  )
804
  ),
805
  'enableGdpr' => sanitize_text_field( $poll->options->poll->enableGdpr ),
@@ -811,12 +821,12 @@ class YOP_Poll_Polls {
811
  'href' => array(),
812
  'target' => array(),
813
  'title' => array(),
814
- 'rel' => array()
815
- )
816
  )
817
  ),
818
  'loadWithAjax' => sanitize_text_field( $poll->options->poll->loadWithAjax ),
819
- 'notificationMessageLocation' => sanitize_text_field( $poll->options->poll->notificationMessageLocation )
820
  ),
821
  'results' => array(
822
  'showResultsMoment' => $poll->options->results->showResultsMoment,
@@ -827,7 +837,7 @@ class YOP_Poll_Polls {
827
  'backToVoteCaption' => sanitize_text_field( $poll->options->results->backToVoteCaption ),
828
  'sortResults' => sanitize_text_field( $poll->options->results->sortResults ),
829
  'sortResultsRule' => sanitize_text_field( $poll->options->results->sortResultsRule ),
830
- 'displayResultsAs' => sanitize_text_field( $poll->options->results->displayResultsAs )
831
  ),
832
  'access' => array(
833
  'votePermissions' => $poll->options->access->votePermissions,
@@ -837,9 +847,9 @@ class YOP_Poll_Polls {
837
  'blockForValue' => sanitize_text_field( $poll->options->access->blockForValue ),
838
  'blockForPeriod' => sanitize_text_field( $poll->options->access->blockForPeriod ),
839
  'limitVotesPerUser' => sanitize_text_field( $poll->options->access->limitVotesPerUser ),
840
- 'votesPerUserAllowed' => sanitize_text_field( $poll->options->access->votesPerUserAllowed )
841
- )
842
- )
843
  );
844
  return $meta_data;
845
  }
@@ -850,7 +860,7 @@ class YOP_Poll_Polls {
850
  } else {
851
  if (
852
  ( false === self::$errors_present ) &&
853
- ( !isset( $poll->name ) ||
854
  ( '' === sanitize_text_field( $poll->name ) ) )
855
  ) {
856
  self::$errors_present = true;
@@ -858,7 +868,7 @@ class YOP_Poll_Polls {
858
  }
859
  if (
860
  ( false === self::$errors_present ) &&
861
- ( !isset( $poll->design->template ) ||
862
  ( '' === sanitize_text_field( $poll->design->template ) ) ||
863
  ( 0 === intval( $poll->design->template ) ) )
864
  ) {
@@ -867,54 +877,54 @@ class YOP_Poll_Polls {
867
  }
868
  if (
869
  ( false === self::$errors_present ) &&
870
- ( !isset( $poll->design->style->poll->backgroundColor ) ||
871
  ( '' === sanitize_text_field( $poll->design->style->poll->backgroundColor ) ) ||
872
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->backgroundColor ) ) ) )
873
  ) {
874
  self::$errors_present = true;
875
  self::$error_text = esc_html__( 'Data for "Poll Background Color" is invalid', 'yop-poll' );
876
  }
877
  if (
878
  ( false === self::$errors_present ) &&
879
- ( !isset( $poll->design->style->poll->borderSize ) ||
880
  ( '' === sanitize_text_field( $poll->design->style->poll->borderSize ) ) ||
881
- ( !ctype_digit( (string) $poll->design->style->poll->borderSize ) ) )
882
  ) {
883
  self::$errors_present = true;
884
  self::$error_text = esc_html__( 'Data for "Poll Border Thickness" is invalid', 'yop-poll' );
885
  }
886
  if (
887
  ( false === self::$errors_present ) &&
888
- ( !isset( $poll->design->style->poll->borderColor ) ||
889
  ( '' === sanitize_text_field( $poll->design->style->poll->borderColor ) ) ||
890
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->borderColor ) ) ) )
891
  ) {
892
  self::$errors_present = true;
893
  self::$error_text = esc_html__( 'Data for "Poll Border Color" is invalid', 'yop-poll' );
894
  }
895
  if (
896
  ( false === self::$errors_present ) &&
897
- ( !isset( $poll->design->style->poll->borderRadius ) ||
898
  ( '' === sanitize_text_field( $poll->design->style->poll->borderRadius ) ) ||
899
- ( !ctype_digit( (string) $poll->design->style->poll->borderRadius ) ) )
900
  ) {
901
  self::$errors_present = true;
902
  self::$error_text = esc_html__( 'Data for "Poll Border Radius" is invalid', 'yop-poll' );
903
  }
904
  if (
905
  ( false === self::$errors_present ) &&
906
- ( !isset( $poll->design->style->poll->paddingLeftRight ) ||
907
  ( '' === sanitize_text_field( $poll->design->style->poll->paddingLeftRight ) ) ||
908
- ( !ctype_digit( (string) $poll->design->style->poll->paddingLeftRight ) ) )
909
  ) {
910
  self::$errors_present = true;
911
  self::$error_text = esc_html__( 'Data for "Poll Padding Left/Right" is invalid', 'yop-poll' );
912
  }
913
  if (
914
  ( false === self::$errors_present ) &&
915
- ( !isset( $poll->design->style->poll->paddingTopBottom ) ||
916
  ( '' === sanitize_text_field( $poll->design->style->poll->paddingTopBottom ) ) ||
917
- ( !ctype_digit( (string) $poll->design->style->poll->paddingTopBottom ) ) )
918
  ) {
919
  self::$errors_present = true;
920
  self::$error_text = esc_html__( 'Data for "Poll Padding Top/Bottom" is invalid', 'yop-poll' );
@@ -922,16 +932,16 @@ class YOP_Poll_Polls {
922
  /* QUESTIONS STYLE CHECK */
923
  if (
924
  ( false === self::$errors_present ) &&
925
- ( !isset( $poll->design->style->questions->textColor ) ||
926
  ( '' === sanitize_text_field( $poll->design->style->questions->textColor ) ) ||
927
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->questions->textColor ) ) ) )
928
  ) {
929
  self::$errors_present = true;
930
  self::$error_text = esc_html__( 'Data for "Question Text Color" is invalid', 'yop-poll' );
931
  }
932
  if (
933
  ( false === self::$errors_present ) &&
934
- ( !isset( $poll->design->style->questions->textSize ) ||
935
  ( '' === sanitize_text_field( $poll->design->style->questions->textSize ) ) )
936
  ) {
937
  self::$errors_present = true;
@@ -939,18 +949,18 @@ class YOP_Poll_Polls {
939
  }
940
  if (
941
  ( false === self::$errors_present ) &&
942
- ( !isset( $poll->design->style->questions->textWeight ) ||
943
  ( '' === sanitize_text_field( $poll->design->style->questions->textWeight ) ) ||
944
- ( !in_array( $poll->design->style->questions->textWeight, self::$text_weight_allowed ) ) )
945
  ) {
946
  self::$errors_present = true;
947
  self::$error_text = esc_html__( 'Data for "Question Text Weight" is invalid', 'yop-poll' );
948
  }
949
  if (
950
  ( false === self::$errors_present ) &&
951
- ( !isset( $poll->design->style->questions->textAlign ) ||
952
  ( '' === sanitize_text_field( $poll->design->style->questions->textAlign ) ) ||
953
- ( !in_array( $poll->design->style->questions->textAlign, self::$text_align_allowed ) ) )
954
  ) {
955
  self::$errors_present = true;
956
  self::$error_text = esc_html__( 'Data for "Question Text Align" is invalid', 'yop-poll' );
@@ -958,34 +968,34 @@ class YOP_Poll_Polls {
958
  /* ANSWERS STYLE CHECK */
959
  if (
960
  ( false === self::$errors_present ) &&
961
- ( !isset( $poll->design->style->answers->paddingLeftRight ) ||
962
  ( '' === sanitize_text_field( $poll->design->style->answers->paddingLeftRight ) ) ||
963
- ( !ctype_digit( (string) $poll->design->style->answers->paddingLeftRight ) ) )
964
  ) {
965
  self::$errors_present = true;
966
  self::$error_text = esc_html__( 'Data for "Answers Padding Left/Right" is invalid', 'yop-poll' );
967
  }
968
  if (
969
  ( false === self::$errors_present ) &&
970
- ( !isset( $poll->design->style->answers->paddingTopBottom ) ||
971
  ( '' === sanitize_text_field( $poll->design->style->answers->paddingTopBottom ) ) ||
972
- ( !ctype_digit( (string) $poll->design->style->answers->paddingTopBottom ) ) )
973
  ) {
974
  self::$errors_present = true;
975
  self::$error_text = esc_html__( 'Data for "Answers Padding Top/Bottom" is invalid', 'yop-poll' );
976
  }
977
  if (
978
  ( false === self::$errors_present ) &&
979
- ( !isset( $poll->design->style->answers->textColor ) ||
980
  ( '' === sanitize_text_field( $poll->design->style->answers->textColor ) ) ||
981
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->answers->textColor ) ) ) )
982
  ) {
983
  self::$errors_present = true;
984
  self::$error_text = esc_html__( 'Data for "Answers Text Color" is invalid', 'yop-poll' );
985
  }
986
  if (
987
  ( false === self::$errors_present ) &&
988
- ( !isset( $poll->design->style->answers->textSize ) ||
989
  ( '' === sanitize_text_field( $poll->design->style->answers->textSize ) ) )
990
  ) {
991
  self::$errors_present = true;
@@ -993,9 +1003,9 @@ class YOP_Poll_Polls {
993
  }
994
  if (
995
  ( false === self::$errors_present ) &&
996
- ( !isset( $poll->design->style->answers->textWeight ) ||
997
  ( '' === sanitize_text_field( $poll->design->style->answers->textWeight ) ) ||
998
- ( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
999
  ) {
1000
  self::$errors_present = true;
1001
  self::$error_text = esc_html__( 'Data for "Answers Text Weight" is invalid', 'yop-poll' );
@@ -1003,70 +1013,70 @@ class YOP_Poll_Polls {
1003
  /* BUTTONS STYLE CHECK */
1004
  if (
1005
  ( false === self::$errors_present ) &&
1006
- ( !isset( $poll->design->style->buttons->backgroundColor ) ||
1007
  ( '' === sanitize_text_field( $poll->design->style->buttons->backgroundColor ) ) ||
1008
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->backgroundColor ) ) ) )
1009
  ) {
1010
  self::$errors_present = true;
1011
  self::$error_text = esc_html__( 'Data for "Buttons Background Color" is invalid', 'yop-poll' );
1012
  }
1013
  if (
1014
  ( false === self::$errors_present ) &&
1015
- ( !isset( $poll->design->style->buttons->borderSize ) ||
1016
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderSize ) ) ||
1017
- ( !ctype_digit( (string) $poll->design->style->buttons->borderSize ) ) )
1018
  ) {
1019
  self::$errors_present = true;
1020
  self::$error_text = esc_html__( 'Data for "Buttons Border Thickness" is invalid', 'yop-poll' );
1021
  }
1022
  if (
1023
  ( false === self::$errors_present ) &&
1024
- ( !isset( $poll->design->style->buttons->borderColor ) ||
1025
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderColor ) ) ||
1026
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->borderColor ) ) ) )
1027
  ) {
1028
  self::$errors_present = true;
1029
  self::$error_text = esc_html__( 'Data for "Buttons Border Color" is invalid', 'yop-poll' );
1030
  }
1031
  if (
1032
  ( false === self::$errors_present ) &&
1033
- ( !isset( $poll->design->style->buttons->borderRadius ) ||
1034
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderRadius ) ) ||
1035
- ( !ctype_digit( (string) $poll->design->style->buttons->borderRadius ) ) )
1036
  ) {
1037
  self::$errors_present = true;
1038
  self::$error_text = esc_html__( 'Data for "Buttons Border Radius" is invalid', 'yop-poll' );
1039
  }
1040
  if (
1041
  ( false === self::$errors_present ) &&
1042
- ( !isset( $poll->design->style->buttons->paddingLeftRight ) ||
1043
  ( '' === sanitize_text_field( $poll->design->style->buttons->paddingLeftRight ) ) ||
1044
- ( !ctype_digit( (string) $poll->design->style->buttons->paddingLeftRight ) ) )
1045
  ) {
1046
  self::$errors_present = true;
1047
  self::$error_text = esc_html__( 'Data for "Buttons Padding Left/Right" is invalid', 'yop-poll' );
1048
  }
1049
  if (
1050
  ( false === self::$errors_present ) &&
1051
- ( !isset( $poll->design->style->buttons->paddingTopBottom ) ||
1052
  ( '' === sanitize_text_field( $poll->design->style->buttons->paddingTopBottom ) ) ||
1053
- ( !ctype_digit( (string) $poll->design->style->buttons->paddingTopBottom ) ) )
1054
  ) {
1055
  self::$errors_present = true;
1056
  self::$error_text = esc_html__( 'Data for "Buttons Padding Top/Bottom" is invalid', 'yop-poll' );
1057
  }
1058
  if (
1059
  ( false === self::$errors_present ) &&
1060
- ( !isset( $poll->design->style->buttons->textColor ) ||
1061
  ( '' === sanitize_text_field( $poll->design->style->buttons->textColor ) ) ||
1062
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->textColor ) ) ) )
1063
  ) {
1064
  self::$errors_present = true;
1065
  self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
1066
  }
1067
  if (
1068
  ( false === self::$errors_present ) &&
1069
- ( !isset( $poll->design->style->buttons->textSize ) ||
1070
  ( '' === sanitize_text_field( $poll->design->style->buttons->textSize ) ) )
1071
  ) {
1072
  self::$errors_present = true;
@@ -1074,9 +1084,9 @@ class YOP_Poll_Polls {
1074
  }
1075
  if (
1076
  ( false === self::$errors_present ) &&
1077
- ( !isset( $poll->design->style->buttons->textWeight ) ||
1078
  ( '' === sanitize_text_field( $poll->design->style->buttons->textWeight ) ) ||
1079
- ( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
1080
  ) {
1081
  self::$errors_present = true;
1082
  self::$error_text = esc_html__( 'Data for "Buttons Text Weight" is invalid', 'yop-poll' );
@@ -1084,52 +1094,52 @@ class YOP_Poll_Polls {
1084
  /* ERRORS STYLE CHECK */
1085
  if (
1086
  ( false === self::$errors_present ) &&
1087
- ( !isset( $poll->design->style->errors->borderLeftColorForSuccess ) ||
1088
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftColorForSuccess ) ) ||
1089
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForSuccess ) ) ) )
1090
  ) {
1091
  self::$errors_present = true;
1092
  self::$error_text = esc_html__( 'Data for "Messages Border Color For Success" is invalid', 'yop-poll' );
1093
  }
1094
  if (
1095
  ( false === self::$errors_present ) &&
1096
- ( !isset( $poll->design->style->errors->borderLeftColorForError ) ||
1097
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftColorForError ) ) ||
1098
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForError ) ) ) )
1099
  ) {
1100
  self::$errors_present = true;
1101
  self::$error_text = esc_html__( 'Data for "Messages Border Color For Error" is invalid', 'yop-poll' );
1102
  }
1103
  if (
1104
  ( false === self::$errors_present ) &&
1105
- ( !isset( $poll->design->style->errors->borderLeftSize ) ||
1106
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftSize ) ) ||
1107
- ( !ctype_digit( (string) $poll->design->style->errors->borderLeftSize ) ) )
1108
  ) {
1109
  self::$errors_present = true;
1110
  self::$error_text = esc_html__( 'Data for "Messages Border Left Thickness" is invalid', 'yop-poll' );
1111
  }
1112
  if (
1113
  ( false === self::$errors_present ) &&
1114
- ( !isset( $poll->design->style->errors->paddingTopBottom ) ||
1115
  ( '' === sanitize_text_field( $poll->design->style->errors->paddingTopBottom ) ) ||
1116
- ( !ctype_digit( (string) $poll->design->style->errors->paddingTopBottom ) ) )
1117
  ) {
1118
  self::$errors_present = true;
1119
  self::$error_text = esc_html__( 'Data for "Messages Padding Top/Bottom" is invalid', 'yop-poll' );
1120
  }
1121
  if (
1122
  ( false === self::$errors_present ) &&
1123
- ( !isset( $poll->design->style->errors->textColor ) ||
1124
  ( '' === sanitize_text_field( $poll->design->style->errors->textColor ) ) ||
1125
- ( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->textColor ) ) ) )
1126
  ) {
1127
  self::$errors_present = true;
1128
  self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
1129
  }
1130
  if (
1131
  ( false === self::$errors_present ) &&
1132
- ( !isset( $poll->design->style->errors->textSize ) ||
1133
  ( '' === sanitize_text_field( $poll->design->style->errors->textSize ) ) )
1134
  ) {
1135
  self::$errors_present = true;
@@ -1137,9 +1147,9 @@ class YOP_Poll_Polls {
1137
  }
1138
  if (
1139
  ( false === self::$errors_present ) &&
1140
- ( !isset( $poll->design->style->errors->textWeight ) ||
1141
  ( '' === sanitize_text_field( $poll->design->style->errors->textWeight ) ) ||
1142
- ( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
1143
  ) {
1144
  self::$errors_present = true;
1145
  self::$error_text = esc_html__( 'Data for "Messages Text Weight" is invalid', 'yop-poll' );
@@ -1158,7 +1168,7 @@ class YOP_Poll_Polls {
1158
  case 'text-question': {
1159
  if (
1160
  ( false === self::$errors_present ) &&
1161
- ( !isset( $element->text ) ||
1162
  ( '' === trim( $element->text ) ) ||
1163
  ( '' === sanitize_text_field( $element->text ) )
1164
  )
@@ -1179,7 +1189,7 @@ class YOP_Poll_Polls {
1179
  foreach ( $element->answers as $answer ) {
1180
  if (
1181
  ( false === self::$errors_present ) &&
1182
- ( !isset( $answer->text ) ||
1183
  ( '' === trim( $answer->text ) ) ||
1184
  ( '' === sanitize_text_field( $answer->text ) )
1185
  )
@@ -1189,14 +1199,14 @@ class YOP_Poll_Polls {
1189
  }
1190
  if (
1191
  ( false === self::$errors_present ) &&
1192
- !in_array( $answer->options->makeDefault, self::$yes_no_allowed )
1193
  ) {
1194
  self::$errors_present = true;
1195
  self::$error_text = esc_html__( 'Data for default answer is invalid', 'yop-poll' );
1196
  }
1197
  if (
1198
  ( false === self::$errors_present ) &&
1199
- !in_array( $answer->options->makeLink, self::$yes_no_allowed )
1200
  ) {
1201
  self::$errors_present = true;
1202
  self::$error_text = esc_html__( ' Data for "Answer Link" is invalid', 'yop-poll' );
@@ -1204,9 +1214,9 @@ class YOP_Poll_Polls {
1204
  if (
1205
  ( false === self::$errors_present ) &&
1206
  ( 'yes' === $answer->options->makeLink ) &&
1207
- ( ( !isset( $answer->options->link ) ) ||
1208
  ( '' === sanitize_text_field( $answer->options->link ) ) ||
1209
- !filter_var( $answer->options->link, FILTER_VALIDATE_URL ) )
1210
  ) {
1211
  self::$errors_present = true;
1212
  self::$error_text = esc_html__( 'Data for "Answer link" is invalid', 'yop-poll' );
@@ -1215,14 +1225,14 @@ class YOP_Poll_Polls {
1215
  }
1216
  if (
1217
  ( false === self::$errors_present ) &&
1218
- ( !in_array( $element->options->allowOtherAnswers, self::$yes_no_allowed ) )
1219
  ) {
1220
  self::$errors_present = true;
1221
  self::$error_text = esc_html__( 'Data for "Allow other options" is invalid', 'yop-poll' );
1222
  }
1223
  if (
1224
  ( false === self::$errors_present ) &&
1225
- ( !isset( $element->options->otherAnswersLabel ) ||
1226
  ( '' === trim( $element->options->otherAnswersLabel ) ) ||
1227
  ( '' === sanitize_text_field( $element->options->otherAnswersLabel ) )
1228
  )
@@ -1232,28 +1242,28 @@ class YOP_Poll_Polls {
1232
  }
1233
  if (
1234
  ( false === self::$errors_present ) &&
1235
- ( !in_array( $element->options->addOtherAnswers, self::$yes_no_allowed ) )
1236
  ) {
1237
  self::$errors_present = true;
1238
  self::$error_text = esc_html__( 'Data for "Add other answers in answer list" is invalid', 'yop-poll' );
1239
  }
1240
  if (
1241
  ( false === self::$errors_present ) &&
1242
- ( !in_array( $element->options->displayOtherAnswersInResults, self::$yes_no_allowed ) )
1243
  ) {
1244
  self::$errors_present = true;
1245
  self::$error_text = esc_html__( 'Data for "Display other answers in results list" is invalid', 'yop-poll' );
1246
  }
1247
  if (
1248
  ( false === self::$errors_present ) &&
1249
- ( !in_array( $element->options->allowMultipleAnswers, self::$yes_no_allowed ) )
1250
  ) {
1251
  self::$errors_present = true;
1252
  self::$error_text = esc_html__( 'Data for "Allow multiple answers " is invalid', 'yop-poll' );
1253
  }
1254
  if (
1255
  ( false === self::$errors_present ) &&
1256
- ( !isset( $element->options->multipleAnswersMinim ) ||
1257
  ( '' === sanitize_text_field( $element->options->multipleAnswersMinim ) ) )
1258
  ) {
1259
  self::$errors_present = true;
@@ -1261,7 +1271,7 @@ class YOP_Poll_Polls {
1261
  }
1262
  if (
1263
  ( false === self::$errors_present ) &&
1264
- ( !isset( $element->options->multipleAnswersMaxim ) ||
1265
  ( '' === trim( $element->options->multipleAnswersMaxim ) ) )
1266
  ) {
1267
  self::$errors_present = true;
@@ -1276,7 +1286,7 @@ class YOP_Poll_Polls {
1276
  }
1277
  if (
1278
  ( false === self::$errors_present ) &&
1279
- ( !in_array( $element->options->answersDisplay, self::$answers_display_allowed ) )
1280
  ) {
1281
  self::$errors_present = true;
1282
  self::$error_text = esc_html__( 'Data for "Display answers" is invalid', 'yop-poll' );
@@ -1284,7 +1294,7 @@ class YOP_Poll_Polls {
1284
  if (
1285
  ( false === self::$errors_present ) &&
1286
  ( 'columns' === $element->options->answersDisplay ) &&
1287
- ( !isset( $element->options->answersColumns ) ||
1288
  ( '' === sanitize_text_field( $element->options->answersColumns ) ) ||
1289
  ( 0 === intval( $element->options->answersColumns ) ) )
1290
  ) {
@@ -1293,7 +1303,7 @@ class YOP_Poll_Polls {
1293
  }
1294
  if (
1295
  ( false === self::$errors_present ) &&
1296
- ( !in_array( $element->options->answersSort, self::$answers_sort_allowed ) )
1297
  ) {
1298
  self::$errors_present = true;
1299
  self::$error_text = esc_html__( 'Data for "Sort Answers" is invalid', 'yop-poll' );
@@ -1303,7 +1313,7 @@ class YOP_Poll_Polls {
1303
  case 'custom-field': {
1304
  if (
1305
  ( false === self::$errors_present ) &&
1306
- ( !isset( $element->text ) ||
1307
  ( '' === trim( $element->text ) ) ||
1308
  ( '' === sanitize_text_field( $element->text ) )
1309
  )
@@ -1313,7 +1323,7 @@ class YOP_Poll_Polls {
1313
  }
1314
  if (
1315
  ( false === self::$errors_present ) &&
1316
- ( !in_array( $element->options->makeRequired, self::$yes_no_allowed ) )
1317
  ) {
1318
  self::$errors_present = true;
1319
  self::$error_text = esc_html__( 'Data for "Make Required" is invalid', 'yop-poll' );
@@ -1329,7 +1339,7 @@ class YOP_Poll_Polls {
1329
  /* POLL OPTIONS->POLL CHECK */
1330
  if (
1331
  ( false === self::$errors_present ) &&
1332
- ( !isset( $poll->options->poll->voteButtonLabel ) ||
1333
  ( '' === trim( $poll->options->poll->voteButtonLabel ) ) ||
1334
  ( '' === sanitize_text_field( $poll->options->poll->voteButtonLabel ) )
1335
  )
@@ -1339,7 +1349,7 @@ class YOP_Poll_Polls {
1339
  }
1340
  if (
1341
  ( false === self::$errors_present ) &&
1342
- ( !in_array( $poll->options->poll->showResultsLink, self::$yes_no_allowed ) )
1343
  ) {
1344
  self::$errors_present = true;
1345
  self::$error_text = esc_html__( 'Data for "Show [Results] link" is invalid', 'yop-poll' );
@@ -1347,7 +1357,7 @@ class YOP_Poll_Polls {
1347
  if (
1348
  ( false === self::$errors_present ) &&
1349
  ( 'yes' === $poll->options->poll->showResultsLink ) &&
1350
- ( !isset( $poll->options->poll->resultsLabelText ) ||
1351
  ( '' === trim( $poll->options->poll->resultsLabelText ) ) ||
1352
  ( '' === sanitize_text_field( $poll->options->poll->resultsLabelText ) )
1353
  )
@@ -1357,21 +1367,21 @@ class YOP_Poll_Polls {
1357
  }
1358
  if (
1359
  ( false === self::$errors_present ) &&
1360
- ( !in_array( $poll->options->poll->showTotalVotes, self::$yes_no_allowed ) )
1361
  ) {
1362
  self::$errors_present = true;
1363
  self::$error_text = esc_html__( 'Data for "Show Total Votes" is invalid', 'yop-poll' );
1364
  }
1365
  if (
1366
  ( false === self::$errors_present ) &&
1367
- ( !in_array( $poll->options->poll->showTotalAnswers, self::$yes_no_allowed ) )
1368
  ) {
1369
  self::$errors_present = true;
1370
  self::$error_text = esc_html__( 'Data for "Show Total Answers" is invalid', 'yop-poll' );
1371
  }
1372
  if (
1373
  ( false === self::$errors_present ) &&
1374
- ( !in_array( $poll->options->poll->startDateOption, self::$date_values_allowed ) )
1375
  ) {
1376
  self::$errors_present = true;
1377
  self::$error_text = esc_html__( 'Data for "Start Date" is invalid', 'yop-poll' );
@@ -1379,7 +1389,7 @@ class YOP_Poll_Polls {
1379
  if (
1380
  ( false === self::$errors_present ) &&
1381
  ( 'custom' === $poll->options->poll->startDateOption ) &&
1382
- ( !isset( $poll->options->poll->startDateCustom ) ||
1383
  ( '' === sanitize_text_field( $poll->options->poll->startDateCustom ) ) )
1384
  ) {
1385
  self::$errors_present = true;
@@ -1387,7 +1397,7 @@ class YOP_Poll_Polls {
1387
  }
1388
  if (
1389
  ( false === self::$errors_present ) &&
1390
- ( !in_array( $poll->options->poll->endDateOption, self::$date_values_allowed ) )
1391
  ) {
1392
  self::$errors_present = true;
1393
  self::$error_text = esc_html__( 'Data for "End Date" is invalid', 'yop-poll' );
@@ -1395,7 +1405,7 @@ class YOP_Poll_Polls {
1395
  if (
1396
  ( false === self::$errors_present ) &&
1397
  ( 'custom' === $poll->options->poll->endDateOption ) &&
1398
- ( !isset( $poll->options->poll->endDateCustom ) ||
1399
  ( '' === sanitize_text_field( $poll->options->poll->endDateCustom ) ) )
1400
  ) {
1401
  self::$errors_present = true;
@@ -1403,7 +1413,7 @@ class YOP_Poll_Polls {
1403
  }
1404
  if (
1405
  ( false === self::$errors_present ) &&
1406
- ( !in_array( $poll->options->poll->redirectAfterVote, self::$yes_no_allowed ) )
1407
  ) {
1408
  self::$errors_present = true;
1409
  self::$error_text = esc_html__( 'Data for "Redirect after vote" is invalid', 'yop-poll' );
@@ -1411,7 +1421,7 @@ class YOP_Poll_Polls {
1411
  if (
1412
  ( false === self::$errors_present ) &&
1413
  ( 'yes' === $poll->options->poll->redirectAfterVote ) &&
1414
- ( !isset( $poll->options->poll->redirectUrl ) ||
1415
  ( '' === trim( $poll->options->poll->redirectUrl ) ) ||
1416
  ( '' === sanitize_text_field( $poll->options->poll->redirectUrl ) )
1417
  )
@@ -1421,35 +1431,35 @@ class YOP_Poll_Polls {
1421
  }
1422
  if (
1423
  ( false === self::$errors_present ) &&
1424
- ( !in_array( $poll->options->poll->resetPollStatsAutomatically, self::$yes_no_allowed ) )
1425
  ) {
1426
  self::$errors_present = true;
1427
  self::$error_text = esc_html__( 'Data for "Reset Poll Stats automatically" is invalid', 'yop-poll' );
1428
  }
1429
  if (
1430
  ( false === self::$errors_present ) &&
1431
- ( !in_array( $poll->options->poll->resetPollStatsEveryPeriod, self::$reset_stats_allowed ) )
1432
  ) {
1433
  self::$errors_present = true;
1434
  self::$error_text = esc_html__( 'Data for "Reset Every" is invalid', 'yop-poll' );
1435
  }
1436
  if (
1437
  ( false === self::$errors_present ) &&
1438
- ( !in_array( $poll->options->poll->autoGeneratePollPage, self::$yes_no_allowed ) )
1439
  ) {
1440
  self::$errors_present = true;
1441
  self::$error_text = esc_html__( 'Data for "Auto Generate Poll Page" is invalid', 'yop-poll' );
1442
  }
1443
  if (
1444
  ( false === self::$errors_present ) &&
1445
- ( !in_array( $poll->options->poll->useCaptcha, self::$captcha_allowed ) )
1446
  ) {
1447
  self::$errors_present = true;
1448
  self::$error_text = esc_html__( 'Data for "Use Captcha" is invalid', 'yop-poll' );
1449
  }
1450
  if (
1451
  ( false === self::$errors_present ) &&
1452
- ( !in_array( $poll->options->poll->sendEmailNotifications, self::$yes_no_allowed ) )
1453
  ) {
1454
  self::$errors_present = true;
1455
  self::$error_text = esc_html__( 'Data for "Send Email notifications" is invalid', 'yop-poll' );
@@ -1457,7 +1467,7 @@ class YOP_Poll_Polls {
1457
  if (
1458
  ( false === self::$errors_present ) &&
1459
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1460
- ( !isset( $poll->options->poll->emailNotificationsFromName ) ||
1461
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromName ) ) )
1462
  ) {
1463
  self::$errors_present = true;
@@ -1466,7 +1476,7 @@ class YOP_Poll_Polls {
1466
  if (
1467
  ( false === self::$errors_present ) &&
1468
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1469
- ( !isset( $poll->options->poll->emailNotificationsFromEmail ) ||
1470
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromEmail ) ) )
1471
  ) {
1472
  self::$errors_present = true;
@@ -1475,7 +1485,7 @@ class YOP_Poll_Polls {
1475
  if (
1476
  ( false === self::$errors_present ) &&
1477
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1478
- ( !isset( $poll->options->poll->emailNotificationsRecipients ) ||
1479
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsRecipients ) ) )
1480
  ) {
1481
  self::$errors_present = true;
@@ -1484,7 +1494,7 @@ class YOP_Poll_Polls {
1484
  if (
1485
  ( false === self::$errors_present ) &&
1486
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1487
- ( !isset( $poll->options->poll->emailNotificationsSubject ) ||
1488
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsSubject ) ) )
1489
  ) {
1490
  self::$errors_present = true;
@@ -1493,7 +1503,7 @@ class YOP_Poll_Polls {
1493
  if (
1494
  ( false === self::$errors_present ) &&
1495
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1496
- ( !isset( $poll->options->poll->emailNotificationsMessage ) ||
1497
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsMessage ) ) )
1498
  ) {
1499
  self::$errors_present = true;
@@ -1511,7 +1521,7 @@ class YOP_Poll_Polls {
1511
  if (
1512
  ( false === self::$errors_present ) &&
1513
  ( in_array( 'custom-date', $poll->options->results->showResultsMoment ) ) &&
1514
- ( !isset( $poll->options->results->customDateResults ) ||
1515
  ( '' === sanitize_text_field( $poll->options->results->customDateResults ) ) )
1516
  ) {
1517
  self::$errors_present = true;
@@ -1519,7 +1529,7 @@ class YOP_Poll_Polls {
1519
  }
1520
  if (
1521
  ( false === self::$errors_present ) &&
1522
- ( 0 < count( $poll->options->results->showResultsMoment ) ) && !in_array( 'never', $poll->options->results->showResultsMoment ) &&
1523
  ( ( 0 === count( $poll->options->results->showResultsTo ) ) ||
1524
  ( 0 === count( array_intersect( $poll->options->results->showResultsTo, self::$show_results_to_allowed ) ) ) )
1525
  ) {
@@ -1528,7 +1538,7 @@ class YOP_Poll_Polls {
1528
  }
1529
  if (
1530
  ( false === self::$errors_present ) &&
1531
- ( !in_array( $poll->options->results->backToVoteOption, self::$yes_no_allowed ) )
1532
  ) {
1533
  self::$errors_present = true;
1534
  self::$error_text = esc_html__( 'Data for "Display [Back to vote] link" is invalid', 'yop-poll' );
@@ -1536,7 +1546,7 @@ class YOP_Poll_Polls {
1536
  if (
1537
  ( false === self::$errors_present ) &&
1538
  ( 'yes' === $poll->options->results->backToVoteOption ) &&
1539
- ( !isset( $poll->options->results->backToVoteCaption ) ||
1540
  ( '' === trim( $poll->options->results->backToVoteCaption ) ) ||
1541
  ( '' === sanitize_text_field( $poll->options->results->backToVoteCaption ) )
1542
  )
@@ -1546,7 +1556,7 @@ class YOP_Poll_Polls {
1546
  }
1547
  if (
1548
  ( false === self::$errors_present ) &&
1549
- ( !in_array( $poll->options->results->sortResults, self::$sort_results_allowed ) )
1550
  ) {
1551
  self::$errors_present = true;
1552
  self::$error_text = esc_html__( 'Data for "Sort Results" is invalid', 'yop-poll' );
@@ -1554,14 +1564,14 @@ class YOP_Poll_Polls {
1554
  if (
1555
  ( false === self::$errors_present ) &&
1556
  ( 'number-of-votes' === $poll->options->results->sortResults ) &&
1557
- ( !in_array( $poll->options->results->sortResultsRule, self::$sort_results_rule_allowed ) )
1558
  ) {
1559
  self::$errors_present = true;
1560
  self::$error_text = esc_html__( 'Data for "Sort rule" is invalid', 'yop-poll' );
1561
  }
1562
  if (
1563
  ( false === self::$errors_present ) &&
1564
- ( !in_array( $poll->options->results->displayResultsAs, self::$display_results_as_allowed ) )
1565
  ) {
1566
  self::$errors_present = true;
1567
  self::$error_text = esc_html__( 'Data for "Display Results As"', 'yop-poll' );
@@ -1594,18 +1604,18 @@ class YOP_Poll_Polls {
1594
  if (
1595
  ( false === self::$errors_present ) &&
1596
  ( count( $poll->options->access->blockVoters ) > 0 ) &&
1597
- ( !in_array( 'no-block', $poll->options->access->blockVoters ) ) &&
1598
  ( 'limited-time' === $poll->options->access->blockLengthType ) &&
1599
- ( ( !isset( $poll->options->access->blockForValue ) ||
1600
  ( 0 === intval( $poll->options->access->blockForValue ) ) ) ||
1601
- ( !in_array( $poll->options->access->blockForPeriod, self::$block_voters_period_allowed ) ) )
1602
  ) {
1603
  self::$errors_present = true;
1604
  self::$error_text = esc_html__( 'Data for "Block Period" is invalid', 'yop-poll' );
1605
  }
1606
  if (
1607
  ( false === self::$errors_present ) &&
1608
- ( !in_array( $poll->options->access->limitVotesPerUser, self::$yes_no_allowed ) )
1609
  ) {
1610
  self::$errors_present = true;
1611
  self::$error_text = esc_html__( 'Data for "Limit Number Of Votes per User" is invalid', 'yop-poll' );
@@ -1668,14 +1678,15 @@ class YOP_Poll_Polls {
1668
  $sub_elements_sort_rule = 'ASC'
1669
  ) {
1670
  $query = $GLOBALS['wpdb']->prepare(
1671
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'", $poll_id
 
1672
  );
1673
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1674
  if ( null !== $poll ) {
1675
  $poll_meta_data = unserialize( $poll->meta_data );
1676
  $poll->meta_data = array(
1677
  'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
1678
- 'options' => $poll_meta_data['options']
1679
  );
1680
  $poll_elements = YOP_Poll_Elements::get( $poll_id, $elements_order_by, $elements_sort_rule );
1681
  $poll_sub_elements = YOP_Poll_SubElements::get( $poll_id, $sub_elements_order_by, $sub_elements_sort_rule );
@@ -1695,14 +1706,15 @@ class YOP_Poll_Polls {
1695
  public static function get_poll_for_voting( $poll_id ) {
1696
  if ( true === isset( $poll_id ) ) {
1697
  $query = $GLOBALS['wpdb']->prepare(
1698
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
 
1699
  );
1700
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1701
  if ( null !== $poll ) {
1702
  $poll_meta_data = unserialize( $poll->meta_data );
1703
  $poll->meta_data = array(
1704
  'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
1705
- 'options' => $poll_meta_data['options']
1706
  );
1707
  $poll_elements = YOP_Poll_Elements::get_all_for_poll( $poll_id );
1708
  foreach ( $poll_elements as $poll_element ) {
@@ -1748,7 +1760,8 @@ class YOP_Poll_Polls {
1748
  $sub_elements_order_by = 'sorder';
1749
  $sub_elements_sort_rule = 'ASC';
1750
  $query = $GLOBALS['wpdb']->prepare(
1751
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
 
1752
  );
1753
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1754
  if ( null !== $poll ) {
@@ -1820,9 +1833,9 @@ class YOP_Poll_Polls {
1820
  'makeDefault' => '',
1821
  'makeLink' => '',
1822
  'link' => '',
1823
- 'resultsColor' => isset( $poll_element->meta_data['resultsColorForOtherAnswers'] ) ? $poll_element->meta_data['resultsColorForOtherAnswers'] : '#000000'
1824
  ),
1825
- 'total_submits' => $other_answer->total_submits
1826
  );
1827
  $i++;
1828
  }
@@ -1853,7 +1866,8 @@ class YOP_Poll_Polls {
1853
  }
1854
  public static function get_meta_data( $poll_id ) {
1855
  $query = $GLOBALS['wpdb']->prepare(
1856
- "SELECT `meta_data` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s", $poll_id
 
1857
  );
1858
  $poll = $GLOBALS['wpdb']->get_col( $query );
1859
  if ( 1 === count( $poll ) ) {
@@ -1864,7 +1878,8 @@ class YOP_Poll_Polls {
1864
  }
1865
  public static function get_info( $poll_id ) {
1866
  $query = $GLOBALS['wpdb']->prepare(
1867
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'", $poll_id
 
1868
  );
1869
  $poll = $GLOBALS['wpdb']->get_row( $query );
1870
  if ( ( true === isset( $poll->id ) ) && ( $poll->id > 0 ) ) {
@@ -2037,7 +2052,11 @@ class YOP_Poll_Polls {
2037
  public static function get_results_for_frontend(
2038
  $poll,
2039
  $before_or_after_vote,
2040
- $sort_params = array( 'order_by' => 'sorder', 'sort_order' => 'asc' ) ) {
 
 
 
 
2041
  switch ( $sort_params['order_by'] ) {
2042
  case 'as-defined' :{
2043
  $sort_params['order_by'] = 'sorder';
@@ -2194,7 +2213,7 @@ class YOP_Poll_Polls {
2194
  'makeLink' => isset( $subelement->meta_data['makeLink'] ) ? $subelement->meta_data['makeLink'] : '',
2195
  'link' => isset( $subelement->meta_data['link'] ) ? $subelement->meta_data['link'] : '',
2196
  'color' => $subelement->meta_data['resultsColor'],
2197
- 'votes' => $subelement->total_submits
2198
  );
2199
  }
2200
  $poll_results[] = $element_results;
@@ -2208,13 +2227,16 @@ class YOP_Poll_Polls {
2208
  $polls = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
2209
  foreach ( $polls as $poll ) {
2210
  $poll_meta_data = unserialize( $poll['meta_data'] );
2211
- array_push( $returned_polls, array(
2212
- 'id' => $poll['id'],
2213
- 'resetPollStatsAutomatically' => $poll_meta_data['options']['poll']['resetPollStatsAutomatically'],
2214
- 'resetPollStatsOn' => $poll_meta_data['options']['poll']['resetPollStatsOn'],
2215
- 'resetPollStatsEvery' => $poll_meta_data['options']['poll']['resetPollStatsEvery'],
2216
- 'resetPollStatsEveryPeriod' => $poll_meta_data['options']['poll']['resetPollStatsEveryPeriod']
2217
- ));
 
 
 
2218
  }
2219
  return $returned_polls;
2220
  }
@@ -2260,7 +2282,9 @@ class YOP_Poll_Polls {
2260
  }
2261
  if ( ( 'yes' === $poll->meta_data['options']['access']['limitVotesPerUser'] ) && ( $poll->meta_data['options']['access']['votesPerUserAllowed'] > 0 ) ) {
2262
  $query = $GLOBALS['wpdb']->prepare(
2263
- "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `" . $search_field . "` = %s AND `poll_id` = %d AND `status` = 'active'", $user, $poll->id
 
 
2264
  );
2265
  $total_votes_for_user = $GLOBALS['wpdb']->get_var( $query );
2266
  if ( $total_votes_for_user >= $poll->meta_data['options']['access']['votesPerUserAllowed'] ) {
@@ -2386,9 +2410,9 @@ class YOP_Poll_Polls {
2386
  }
2387
  public static function add_votes_manually( $poll_id, $elements_data ) {
2388
  $total_votes__to_be_added = 0;
2389
- $elements_votes = [];
2390
  $i = 0;
2391
- $votes = [];
2392
  $result = array();
2393
  if ( $poll_id > 0 ) {
2394
  foreach ( $elements_data as $element_data ) {
@@ -2417,7 +2441,7 @@ class YOP_Poll_Polls {
2417
  $votes[$i]->data[$j]->id = $element_data->id;
2418
  foreach ( $element_data->answers as $answer_data ) {
2419
  if ( ( intval( $answer_data->id ) > 0 ) && ( intval( $answer_data->votes ) > 0 ) ) {
2420
- $votes[$i]->data[$j]->data = [];
2421
  $votes[$i]->data[$j]->data[0] = new stdClass();
2422
  $votes[$i]->data[$j]->data[0]->id = $answer_data->id;
2423
  $votes[$i]->data[$j]->data[0]->data = 1;
61
  }
62
  public static function get_owner( $poll_id ) {
63
  $query = $GLOBALS['wpdb']->prepare(
64
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s",
65
+ $poll_id
66
  );
67
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
68
  if ( null !== $poll ) {
145
  'order_by' => $params['order_by'],
146
  'sort_order' => $params['sort_order'],
147
  'q' => htmlentities( $params['q'] ),
148
+ 'page_no' => $params['page_no'] + 1,
149
  )
150
  )
151
  );
162
  'order_by' => $params['order_by'],
163
  'sort_order' => $params['sort_order'],
164
  'q' => htmlentities( $params['q'] ),
165
+ 'page_no' => intval( $total_pages ),
166
  )
167
  )
168
  );
181
  'order_by' => $params['order_by'],
182
  'sort_order' => $params['sort_order'],
183
  'q' => htmlentities( $params['q'] ),
184
+ 'page_no' => $params['page_no'] - 1,
185
  )
186
  )
187
  );
198
  'order_by' => $params['order_by'],
199
  'sort_order' => $params['sort_order'],
200
  'q' => htmlentities( $params['q'] ),
201
+ 'page_no' => 1,
202
  )
203
  )
204
  );
217
  'order_by' => $params['order_by'],
218
  'sort_order' => $params['sort_order'],
219
  'q' => htmlentities( $params['q'] ),
220
+ 'page_no' => $params['page_no'] - 1,
221
  )
222
  )
223
  );
230
  'order_by' => $params['order_by'],
231
  'sort_order' => $params['sort_order'],
232
  'q' => htmlentities( $params['q'] ),
233
+ 'page_no' => $params['page_no'] + 1,
234
  )
235
  )
236
  );
250
  'order_by' => $params['order_by'],
251
  'sort_order' => $params['sort_order'],
252
  'q' => htmlentities( $params['q'] ),
253
+ 'page_no' => 1,
254
  )
255
  )
256
  );
268
  'order_by' => $params['order_by'],
269
  'sort_order' => $params['sort_order'],
270
  'q' => htmlentities( $params['q'] ),
271
+ 'page_no' => intval( $total_pages ),
272
  )
273
  )
274
  );
286
  return array(
287
  'total_polls' => $total_polls,
288
  'total_pages' => $total_pages,
289
+ 'pagination' => $pagination,
290
  );
291
  }
292
  public static function get_polls( $params ) {
297
  'draft' => 0,
298
  'archived' => 0,
299
  'ending-soon' => 0,
300
+ 'ended' => 0,
301
  );
302
  $current_user = wp_get_current_user();
303
  if ( 0 >= intval( $params['page_no'] ) ) {
304
  $params['page_no'] = 1;
305
  }
306
  $pagination = self::paginate( $params );
307
+ if ( ! in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
308
  $params['sort_order'] = SORT_ASC;
309
  } elseif ( 'desc' === $params['sort_order'] ) {
310
  $params['sort_order'] = SORT_DESC;
311
  } else {
312
  $params['sort_order'] = SORT_ASC;
313
  }
314
+ if ( ! in_array( $params['order_by'], self::$order_by_allowed ) ) {
315
  $params['order_by'] = 'id';
316
  }
317
  if ( $params['page_no'] > $pagination['total_pages'] ) {
401
  'statistics' => $statistics,
402
  'total_polls' => $pagination['total_polls'],
403
  'total_pages' => $pagination['total_pages'],
404
+ 'pagination' => $pagination['pagination'],
405
  );
406
  }
407
  public static function get_names() {
442
  'total_submits' => 0,
443
  'total_submited_answers' => 0,
444
  'added_date' => isset( $poll->added_date ) ? sanitize_text_field( $poll->added_date ) : current_time( 'mysql' ),
445
+ 'modified_date' => isset( $poll->modified_date ) ? sanitize_text_field( $poll->modified_date ) : current_time( 'mysql' ),
446
  );
447
  if ( isset( $poll->ID ) && is_numeric( $poll->ID ) ) {
448
  $data['id'] = $poll->ID;
465
  }
466
  if ( false === $elements_result['errors_present'] ) {
467
  if ( 'yes' === $poll->options->poll->autoGeneratePollPage ) {
468
+ $page_id = wp_insert_post(
469
+ array(
470
+ 'post_title' => sanitize_text_field( $poll->name ),
471
+ 'post_content' => "[yop_poll id='{$poll_id}']",
472
+ 'post_status' => 'publish',
473
+ 'post_type' => 'page',
474
+ 'comment_status' => 'open',
475
+ 'ping_status' => 'open',
476
+ 'post_category' => array( 1 ),
477
+ )
478
+ );
479
  if ( 0 !== $page_id ) {
480
  $poll_meta_data['options']['poll']['pageId'] = $page_id;
481
  $poll_meta_data['options']['poll']['pageLink'] = get_permalink( $page_id );
482
  $data = array(
483
+ 'meta_data' => serialize( $poll_meta_data ),
484
  );
485
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
486
  self::$errors_present = false;
503
  }
504
  }
505
  return array(
506
+ 'success' => ! self::$errors_present,
507
  'error' => self::$error_text,
508
+ 'poll_id' => $poll_id,
509
  );
510
  }
511
  public static function check_for_name( $poll_name ) {
536
  $has_page = false;
537
  }
538
  if ( false === $has_page ) {
539
+ $page_id = wp_insert_post(
540
+ array(
541
+ 'post_title' => sanitize_text_field( $poll->name ),
542
+ 'post_content' => "[yop_poll id='{$poll_id}']",
543
+ 'post_status' => 'publish',
544
+ 'post_type' => 'page',
545
+ 'comment_status' => 'open',
546
+ 'ping_status' => 'open',
547
+ 'post_category' => array( 1 ),
548
+ )
549
+ );
550
  } else {
551
+ wp_update_post(
552
+ array(
553
+ 'ID' => $db_poll_meta['options']['poll']['pageId'],
554
+ 'post_title' => sanitize_text_field( $poll->name ),
555
+ )
556
+ );
557
  $page_id = $db_poll_meta['options']['poll']['pageId'];
558
  }
559
 
577
  'stype' => 'poll',
578
  'status' => sanitize_text_field( $poll->status ),
579
  'meta_data' => serialize( $poll_meta_data ),
580
+ 'modified_date' => current_time( 'mysql' ),
581
  );
582
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
583
  $elements_result = YOP_Poll_Elements::update( $poll_id, $poll->elements );
602
  self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
603
  }
604
  return array(
605
+ 'success' => ! self::$errors_present,
606
  'error' => self::$error_text,
607
+ 'new-elements' => isset( $elements_result['new_elements'] ) ? $elements_result['new_elements'] : array(),
608
+ 'new-subelements' => isset( $elements_result['new_subelements'] ) ? $elements_result['new_subelements'] : array(),
609
  );
610
  }
611
  public static function delete( $poll_id ) {
618
  $GLOBALS['wpdb']->yop_poll_polls,
619
  $data,
620
  array(
621
+ 'id' => $poll_id,
622
  )
623
  );
624
  if ( false !== $delete_poll_result ) {
643
  self::$error_text = esc_html__( 'Error deleting poll', 'yop-poll' );
644
  }
645
  return array(
646
+ 'success' => ! self::$errors_present,
647
+ 'error' => self::$error_text,
648
  );
649
  }
650
  public static function clone_poll( $poll_id ) {
651
  $current_user = wp_get_current_user();
652
  $poll_query = $GLOBALS['wpdb']->prepare(
653
+ "SELECT * from {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id`=%s",
654
+ $poll_id
655
  );
656
  $cloned_poll = $GLOBALS['wpdb']->get_row( $poll_query, OBJECT );
657
  $data = array(
665
  'meta_data' => $cloned_poll->meta_data,
666
  'total_submits' => 0,
667
  'added_date' => current_time( 'mysql' ),
668
+ 'modified_date' => current_time( 'mysql' ),
669
  );
670
  if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_polls, $data ) ) {
671
  $new_poll_id = $GLOBALS['wpdb']->insert_id;
676
  }
677
  $new_poll_meta_data = unserialize( $cloned_poll->meta_data );
678
  if ( 'yes' === $new_poll_meta_data['options']['poll']['autoGeneratePollPage'] ) {
679
+ $page_id = wp_insert_post(
680
+ array(
681
+ 'post_title' => $cloned_poll->name . ' ' . esc_html__( 'clone', 'yop-poll' ),
682
+ 'post_content' => "[yop_poll id='{$new_poll_id}']",
683
+ 'post_status' => 'publish',
684
+ 'post_type' => 'page',
685
+ 'comment_status' => 'open',
686
+ 'ping_status' => 'open',
687
+ 'post_category' => array( 1 ),
688
+ )
689
+ );
690
  if ( 0 !== $page_id ) {
691
  $new_poll_meta_data['options']['poll']['pageId'] = $page_id;
692
  $ne_poll_meta_data['options']['poll']['pageLink'] = get_permalink( $page_id );
693
  $data = array(
694
+ 'meta_data' => serialize( $new_poll_meta_data ),
695
  );
696
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $new_poll_id ) ) ) {
697
  self::$errors_present = false;
706
  self::$error_text = esc_html__( 'Error cloning poll', 'yop-poll' );
707
  }
708
  return array(
709
+ 'success' => ! self::$errors_present,
710
+ 'error' => self::$error_text,
711
  );
712
  }
713
  public static function reset_poll( $poll_id ) {
714
  $data = array(
715
  'total_submits' => '0',
716
  'total_submited_answers' => '0',
717
+ 'modified_date' => current_time( 'mysql' ),
718
  );
719
  if ( false !== $GLOBALS['wpdb']->update( $GLOBALS['wpdb']->yop_poll_polls, $data, array( 'id' => $poll_id ) ) ) {
720
  YOP_Poll_SubElements::delete_others_for_poll( $poll_id );
725
  self::$error_text = esc_html__( 'Error resetting votes', 'yop-poll' );
726
  }
727
  return array(
728
+ 'success' => ! self::$errors_present,
729
+ 'error' => self::$error_text,
730
  );
731
  }
732
  public static function create_meta_data( stdClass $poll ) {
738
  'borderColor' => sanitize_text_field( $poll->design->style->poll->borderColor ),
739
  'borderRadius' => sanitize_text_field( $poll->design->style->poll->borderRadius ),
740
  'paddingLeftRight' => sanitize_text_field( $poll->design->style->poll->paddingLeftRight ),
741
+ 'paddingTopBottom' => sanitize_text_field( $poll->design->style->poll->paddingTopBottom ),
742
  ),
743
  'questions' => array(
744
  'textColor' => sanitize_text_field( $poll->design->style->questions->textColor ),
745
  'textSize' => sanitize_text_field( $poll->design->style->questions->textSize ),
746
  'textWeight' => sanitize_text_field( $poll->design->style->questions->textWeight ),
747
+ 'textAlign' => sanitize_text_field( $poll->design->style->questions->textAlign ),
748
  ),
749
  'answers' => array(
750
  'paddingLeftRight' => sanitize_text_field( $poll->design->style->answers->paddingLeftRight ),
753
  'textSize' => sanitize_text_field( $poll->design->style->answers->textSize ),
754
  'textWeight' => sanitize_text_field( $poll->design->style->answers->textWeight ),
755
  'skin' => sanitize_text_field( $poll->design->style->answers->skin ),
756
+ 'colorScheme' => sanitize_text_field( $poll->design->style->answers->colorScheme ),
757
  ),
758
  'buttons' => array(
759
  'backgroundColor' => sanitize_text_field( $poll->design->style->buttons->backgroundColor ),
764
  'paddingTopBottom' => sanitize_text_field( $poll->design->style->buttons->paddingTopBottom ),
765
  'textColor' => sanitize_text_field( $poll->design->style->buttons->textColor ),
766
  'textSize' => sanitize_text_field( $poll->design->style->buttons->textSize ),
767
+ 'textWeight' => sanitize_text_field( $poll->design->style->buttons->textWeight ),
768
  ),
769
  'captcha' => array(),
770
  'errors' => array(
774
  'paddingTopBottom' => sanitize_text_field( $poll->design->style->errors->paddingTopBottom ),
775
  'textColor' => sanitize_text_field( $poll->design->style->errors->textColor ),
776
  'textSize' => sanitize_text_field( $poll->design->style->errors->textSize ),
777
+ 'textWeight' => sanitize_text_field( $poll->design->style->errors->textWeight ),
778
  ),
779
  'custom' => array(
780
+ 'css' => sanitize_text_field( $poll->design->style->custom->css ),
781
+ ),
782
  ),
783
  'options' => array(
784
  'poll' => array(
809
  'emailNotificationsMessage' => wp_kses(
810
  $poll->options->poll->emailNotificationsMessage,
811
  array(
812
+ 'br' => array(),
813
  )
814
  ),
815
  'enableGdpr' => sanitize_text_field( $poll->options->poll->enableGdpr ),
821
  'href' => array(),
822
  'target' => array(),
823
  'title' => array(),
824
+ 'rel' => array(),
825
+ ),
826
  )
827
  ),
828
  'loadWithAjax' => sanitize_text_field( $poll->options->poll->loadWithAjax ),
829
+ 'notificationMessageLocation' => sanitize_text_field( $poll->options->poll->notificationMessageLocation ),
830
  ),
831
  'results' => array(
832
  'showResultsMoment' => $poll->options->results->showResultsMoment,
837
  'backToVoteCaption' => sanitize_text_field( $poll->options->results->backToVoteCaption ),
838
  'sortResults' => sanitize_text_field( $poll->options->results->sortResults ),
839
  'sortResultsRule' => sanitize_text_field( $poll->options->results->sortResultsRule ),
840
+ 'displayResultsAs' => sanitize_text_field( $poll->options->results->displayResultsAs ),
841
  ),
842
  'access' => array(
843
  'votePermissions' => $poll->options->access->votePermissions,
847
  'blockForValue' => sanitize_text_field( $poll->options->access->blockForValue ),
848
  'blockForPeriod' => sanitize_text_field( $poll->options->access->blockForPeriod ),
849
  'limitVotesPerUser' => sanitize_text_field( $poll->options->access->limitVotesPerUser ),
850
+ 'votesPerUserAllowed' => sanitize_text_field( $poll->options->access->votesPerUserAllowed ),
851
+ ),
852
+ ),
853
  );
854
  return $meta_data;
855
  }
860
  } else {
861
  if (
862
  ( false === self::$errors_present ) &&
863
+ ( ! isset( $poll->name ) ||
864
  ( '' === sanitize_text_field( $poll->name ) ) )
865
  ) {
866
  self::$errors_present = true;
868
  }
869
  if (
870
  ( false === self::$errors_present ) &&
871
+ ( ! isset( $poll->design->template ) ||
872
  ( '' === sanitize_text_field( $poll->design->template ) ) ||
873
  ( 0 === intval( $poll->design->template ) ) )
874
  ) {
877
  }
878
  if (
879
  ( false === self::$errors_present ) &&
880
+ ( ! isset( $poll->design->style->poll->backgroundColor ) ||
881
  ( '' === sanitize_text_field( $poll->design->style->poll->backgroundColor ) ) ||
882
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->poll->backgroundColor ) ) ) )
883
  ) {
884
  self::$errors_present = true;
885
  self::$error_text = esc_html__( 'Data for "Poll Background Color" is invalid', 'yop-poll' );
886
  }
887
  if (
888
  ( false === self::$errors_present ) &&
889
+ ( ! isset( $poll->design->style->poll->borderSize ) ||
890
  ( '' === sanitize_text_field( $poll->design->style->poll->borderSize ) ) ||
891
+ ( ! ctype_digit( (string) $poll->design->style->poll->borderSize ) ) )
892
  ) {
893
  self::$errors_present = true;
894
  self::$error_text = esc_html__( 'Data for "Poll Border Thickness" is invalid', 'yop-poll' );
895
  }
896
  if (
897
  ( false === self::$errors_present ) &&
898
+ ( ! isset( $poll->design->style->poll->borderColor ) ||
899
  ( '' === sanitize_text_field( $poll->design->style->poll->borderColor ) ) ||
900
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->poll->borderColor ) ) ) )
901
  ) {
902
  self::$errors_present = true;
903
  self::$error_text = esc_html__( 'Data for "Poll Border Color" is invalid', 'yop-poll' );
904
  }
905
  if (
906
  ( false === self::$errors_present ) &&
907
+ ( ! isset( $poll->design->style->poll->borderRadius ) ||
908
  ( '' === sanitize_text_field( $poll->design->style->poll->borderRadius ) ) ||
909
+ ( ! ctype_digit( (string) $poll->design->style->poll->borderRadius ) ) )
910
  ) {
911
  self::$errors_present = true;
912
  self::$error_text = esc_html__( 'Data for "Poll Border Radius" is invalid', 'yop-poll' );
913
  }
914
  if (
915
  ( false === self::$errors_present ) &&
916
+ ( ! isset( $poll->design->style->poll->paddingLeftRight ) ||
917
  ( '' === sanitize_text_field( $poll->design->style->poll->paddingLeftRight ) ) ||
918
+ ( ! ctype_digit( (string) $poll->design->style->poll->paddingLeftRight ) ) )
919
  ) {
920
  self::$errors_present = true;
921
  self::$error_text = esc_html__( 'Data for "Poll Padding Left/Right" is invalid', 'yop-poll' );
922
  }
923
  if (
924
  ( false === self::$errors_present ) &&
925
+ ( ! isset( $poll->design->style->poll->paddingTopBottom ) ||
926
  ( '' === sanitize_text_field( $poll->design->style->poll->paddingTopBottom ) ) ||
927
+ ( ! ctype_digit( (string) $poll->design->style->poll->paddingTopBottom ) ) )
928
  ) {
929
  self::$errors_present = true;
930
  self::$error_text = esc_html__( 'Data for "Poll Padding Top/Bottom" is invalid', 'yop-poll' );
932
  /* QUESTIONS STYLE CHECK */
933
  if (
934
  ( false === self::$errors_present ) &&
935
+ ( ! isset( $poll->design->style->questions->textColor ) ||
936
  ( '' === sanitize_text_field( $poll->design->style->questions->textColor ) ) ||
937
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->questions->textColor ) ) ) )
938
  ) {
939
  self::$errors_present = true;
940
  self::$error_text = esc_html__( 'Data for "Question Text Color" is invalid', 'yop-poll' );
941
  }
942
  if (
943
  ( false === self::$errors_present ) &&
944
+ ( ! isset( $poll->design->style->questions->textSize ) ||
945
  ( '' === sanitize_text_field( $poll->design->style->questions->textSize ) ) )
946
  ) {
947
  self::$errors_present = true;
949
  }
950
  if (
951
  ( false === self::$errors_present ) &&
952
+ ( ! isset( $poll->design->style->questions->textWeight ) ||
953
  ( '' === sanitize_text_field( $poll->design->style->questions->textWeight ) ) ||
954
+ ( ! in_array( $poll->design->style->questions->textWeight, self::$text_weight_allowed ) ) )
955
  ) {
956
  self::$errors_present = true;
957
  self::$error_text = esc_html__( 'Data for "Question Text Weight" is invalid', 'yop-poll' );
958
  }
959
  if (
960
  ( false === self::$errors_present ) &&
961
+ ( ! isset( $poll->design->style->questions->textAlign ) ||
962
  ( '' === sanitize_text_field( $poll->design->style->questions->textAlign ) ) ||
963
+ ( ! in_array( $poll->design->style->questions->textAlign, self::$text_align_allowed ) ) )
964
  ) {
965
  self::$errors_present = true;
966
  self::$error_text = esc_html__( 'Data for "Question Text Align" is invalid', 'yop-poll' );
968
  /* ANSWERS STYLE CHECK */
969
  if (
970
  ( false === self::$errors_present ) &&
971
+ ( ! isset( $poll->design->style->answers->paddingLeftRight ) ||
972
  ( '' === sanitize_text_field( $poll->design->style->answers->paddingLeftRight ) ) ||
973
+ ( ! ctype_digit( (string) $poll->design->style->answers->paddingLeftRight ) ) )
974
  ) {
975
  self::$errors_present = true;
976
  self::$error_text = esc_html__( 'Data for "Answers Padding Left/Right" is invalid', 'yop-poll' );
977
  }
978
  if (
979
  ( false === self::$errors_present ) &&
980
+ ( ! isset( $poll->design->style->answers->paddingTopBottom ) ||
981
  ( '' === sanitize_text_field( $poll->design->style->answers->paddingTopBottom ) ) ||
982
+ ( ! ctype_digit( (string) $poll->design->style->answers->paddingTopBottom ) ) )
983
  ) {
984
  self::$errors_present = true;
985
  self::$error_text = esc_html__( 'Data for "Answers Padding Top/Bottom" is invalid', 'yop-poll' );
986
  }
987
  if (
988
  ( false === self::$errors_present ) &&
989
+ ( ! isset( $poll->design->style->answers->textColor ) ||
990
  ( '' === sanitize_text_field( $poll->design->style->answers->textColor ) ) ||
991
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->answers->textColor ) ) ) )
992
  ) {
993
  self::$errors_present = true;
994
  self::$error_text = esc_html__( 'Data for "Answers Text Color" is invalid', 'yop-poll' );
995
  }
996
  if (
997
  ( false === self::$errors_present ) &&
998
+ ( ! isset( $poll->design->style->answers->textSize ) ||
999
  ( '' === sanitize_text_field( $poll->design->style->answers->textSize ) ) )
1000
  ) {
1001
  self::$errors_present = true;
1003
  }
1004
  if (
1005
  ( false === self::$errors_present ) &&
1006
+ ( ! isset( $poll->design->style->answers->textWeight ) ||
1007
  ( '' === sanitize_text_field( $poll->design->style->answers->textWeight ) ) ||
1008
+ ( ! in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
1009
  ) {
1010
  self::$errors_present = true;
1011
  self::$error_text = esc_html__( 'Data for "Answers Text Weight" is invalid', 'yop-poll' );
1013
  /* BUTTONS STYLE CHECK */
1014
  if (
1015
  ( false === self::$errors_present ) &&
1016
+ ( ! isset( $poll->design->style->buttons->backgroundColor ) ||
1017
  ( '' === sanitize_text_field( $poll->design->style->buttons->backgroundColor ) ) ||
1018
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->backgroundColor ) ) ) )
1019
  ) {
1020
  self::$errors_present = true;
1021
  self::$error_text = esc_html__( 'Data for "Buttons Background Color" is invalid', 'yop-poll' );
1022
  }
1023
  if (
1024
  ( false === self::$errors_present ) &&
1025
+ ( ! isset( $poll->design->style->buttons->borderSize ) ||
1026
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderSize ) ) ||
1027
+ ( ! ctype_digit( (string) $poll->design->style->buttons->borderSize ) ) )
1028
  ) {
1029
  self::$errors_present = true;
1030
  self::$error_text = esc_html__( 'Data for "Buttons Border Thickness" is invalid', 'yop-poll' );
1031
  }
1032
  if (
1033
  ( false === self::$errors_present ) &&
1034
+ ( ! isset( $poll->design->style->buttons->borderColor ) ||
1035
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderColor ) ) ||
1036
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->borderColor ) ) ) )
1037
  ) {
1038
  self::$errors_present = true;
1039
  self::$error_text = esc_html__( 'Data for "Buttons Border Color" is invalid', 'yop-poll' );
1040
  }
1041
  if (
1042
  ( false === self::$errors_present ) &&
1043
+ ( ! isset( $poll->design->style->buttons->borderRadius ) ||
1044
  ( '' === sanitize_text_field( $poll->design->style->buttons->borderRadius ) ) ||
1045
+ ( ! ctype_digit( (string) $poll->design->style->buttons->borderRadius ) ) )
1046
  ) {
1047
  self::$errors_present = true;
1048
  self::$error_text = esc_html__( 'Data for "Buttons Border Radius" is invalid', 'yop-poll' );
1049
  }
1050
  if (
1051
  ( false === self::$errors_present ) &&
1052
+ ( ! isset( $poll->design->style->buttons->paddingLeftRight ) ||
1053
  ( '' === sanitize_text_field( $poll->design->style->buttons->paddingLeftRight ) ) ||
1054
+ ( ! ctype_digit( (string) $poll->design->style->buttons->paddingLeftRight ) ) )
1055
  ) {
1056
  self::$errors_present = true;
1057
  self::$error_text = esc_html__( 'Data for "Buttons Padding Left/Right" is invalid', 'yop-poll' );
1058
  }
1059
  if (
1060
  ( false === self::$errors_present ) &&
1061
+ ( ! isset( $poll->design->style->buttons->paddingTopBottom ) ||
1062
  ( '' === sanitize_text_field( $poll->design->style->buttons->paddingTopBottom ) ) ||
1063
+ ( ! ctype_digit( (string) $poll->design->style->buttons->paddingTopBottom ) ) )
1064
  ) {
1065
  self::$errors_present = true;
1066
  self::$error_text = esc_html__( 'Data for "Buttons Padding Top/Bottom" is invalid', 'yop-poll' );
1067
  }
1068
  if (
1069
  ( false === self::$errors_present ) &&
1070
+ ( ! isset( $poll->design->style->buttons->textColor ) ||
1071
  ( '' === sanitize_text_field( $poll->design->style->buttons->textColor ) ) ||
1072
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->textColor ) ) ) )
1073
  ) {
1074
  self::$errors_present = true;
1075
  self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
1076
  }
1077
  if (
1078
  ( false === self::$errors_present ) &&
1079
+ ( ! isset( $poll->design->style->buttons->textSize ) ||
1080
  ( '' === sanitize_text_field( $poll->design->style->buttons->textSize ) ) )
1081
  ) {
1082
  self::$errors_present = true;
1084
  }
1085
  if (
1086
  ( false === self::$errors_present ) &&
1087
+ ( ! isset( $poll->design->style->buttons->textWeight ) ||
1088
  ( '' === sanitize_text_field( $poll->design->style->buttons->textWeight ) ) ||
1089
+ ( ! in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
1090
  ) {
1091
  self::$errors_present = true;
1092
  self::$error_text = esc_html__( 'Data for "Buttons Text Weight" is invalid', 'yop-poll' );
1094
  /* ERRORS STYLE CHECK */
1095
  if (
1096
  ( false === self::$errors_present ) &&
1097
+ ( ! isset( $poll->design->style->errors->borderLeftColorForSuccess ) ||
1098
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftColorForSuccess ) ) ||
1099
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForSuccess ) ) ) )
1100
  ) {
1101
  self::$errors_present = true;
1102
  self::$error_text = esc_html__( 'Data for "Messages Border Color For Success" is invalid', 'yop-poll' );
1103
  }
1104
  if (
1105
  ( false === self::$errors_present ) &&
1106
+ ( ! isset( $poll->design->style->errors->borderLeftColorForError ) ||
1107
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftColorForError ) ) ||
1108
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForError ) ) ) )
1109
  ) {
1110
  self::$errors_present = true;
1111
  self::$error_text = esc_html__( 'Data for "Messages Border Color For Error" is invalid', 'yop-poll' );
1112
  }
1113
  if (
1114
  ( false === self::$errors_present ) &&
1115
+ ( ! isset( $poll->design->style->errors->borderLeftSize ) ||
1116
  ( '' === sanitize_text_field( $poll->design->style->errors->borderLeftSize ) ) ||
1117
+ ( ! ctype_digit( (string) $poll->design->style->errors->borderLeftSize ) ) )
1118
  ) {
1119
  self::$errors_present = true;
1120
  self::$error_text = esc_html__( 'Data for "Messages Border Left Thickness" is invalid', 'yop-poll' );
1121
  }
1122
  if (
1123
  ( false === self::$errors_present ) &&
1124
+ ( ! isset( $poll->design->style->errors->paddingTopBottom ) ||
1125
  ( '' === sanitize_text_field( $poll->design->style->errors->paddingTopBottom ) ) ||
1126
+ ( ! ctype_digit( (string) $poll->design->style->errors->paddingTopBottom ) ) )
1127
  ) {
1128
  self::$errors_present = true;
1129
  self::$error_text = esc_html__( 'Data for "Messages Padding Top/Bottom" is invalid', 'yop-poll' );
1130
  }
1131
  if (
1132
  ( false === self::$errors_present ) &&
1133
+ ( ! isset( $poll->design->style->errors->textColor ) ||
1134
  ( '' === sanitize_text_field( $poll->design->style->errors->textColor ) ) ||
1135
+ ( ! ctype_alnum( str_replace( '#', '', $poll->design->style->errors->textColor ) ) ) )
1136
  ) {
1137
  self::$errors_present = true;
1138
  self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
1139
  }
1140
  if (
1141
  ( false === self::$errors_present ) &&
1142
+ ( ! isset( $poll->design->style->errors->textSize ) ||
1143
  ( '' === sanitize_text_field( $poll->design->style->errors->textSize ) ) )
1144
  ) {
1145
  self::$errors_present = true;
1147
  }
1148
  if (
1149
  ( false === self::$errors_present ) &&
1150
+ ( ! isset( $poll->design->style->errors->textWeight ) ||
1151
  ( '' === sanitize_text_field( $poll->design->style->errors->textWeight ) ) ||
1152
+ ( ! in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
1153
  ) {
1154
  self::$errors_present = true;
1155
  self::$error_text = esc_html__( 'Data for "Messages Text Weight" is invalid', 'yop-poll' );
1168
  case 'text-question': {
1169
  if (
1170
  ( false === self::$errors_present ) &&
1171
+ ( ! isset( $element->text ) ||
1172
  ( '' === trim( $element->text ) ) ||
1173
  ( '' === sanitize_text_field( $element->text ) )
1174
  )
1189
  foreach ( $element->answers as $answer ) {
1190
  if (
1191
  ( false === self::$errors_present ) &&
1192
+ ( ! isset( $answer->text ) ||
1193
  ( '' === trim( $answer->text ) ) ||
1194
  ( '' === sanitize_text_field( $answer->text ) )
1195
  )
1199
  }
1200
  if (
1201
  ( false === self::$errors_present ) &&
1202
+ ! in_array( $answer->options->makeDefault, self::$yes_no_allowed )
1203
  ) {
1204
  self::$errors_present = true;
1205
  self::$error_text = esc_html__( 'Data for default answer is invalid', 'yop-poll' );
1206
  }
1207
  if (
1208
  ( false === self::$errors_present ) &&
1209
+ ! in_array( $answer->options->makeLink, self::$yes_no_allowed )
1210
  ) {
1211
  self::$errors_present = true;
1212
  self::$error_text = esc_html__( ' Data for "Answer Link" is invalid', 'yop-poll' );
1214
  if (
1215
  ( false === self::$errors_present ) &&
1216
  ( 'yes' === $answer->options->makeLink ) &&
1217
+ ( ( ! isset( $answer->options->link ) ) ||
1218
  ( '' === sanitize_text_field( $answer->options->link ) ) ||
1219
+ ! filter_var( $answer->options->link, FILTER_VALIDATE_URL ) )
1220
  ) {
1221
  self::$errors_present = true;
1222
  self::$error_text = esc_html__( 'Data for "Answer link" is invalid', 'yop-poll' );
1225
  }
1226
  if (
1227
  ( false === self::$errors_present ) &&
1228
+ ( ! in_array( $element->options->allowOtherAnswers, self::$yes_no_allowed ) )
1229
  ) {
1230
  self::$errors_present = true;
1231
  self::$error_text = esc_html__( 'Data for "Allow other options" is invalid', 'yop-poll' );
1232
  }
1233
  if (
1234
  ( false === self::$errors_present ) &&
1235
+ ( ! isset( $element->options->otherAnswersLabel ) ||
1236
  ( '' === trim( $element->options->otherAnswersLabel ) ) ||
1237
  ( '' === sanitize_text_field( $element->options->otherAnswersLabel ) )
1238
  )
1242
  }
1243
  if (
1244
  ( false === self::$errors_present ) &&
1245
+ ( ! in_array( $element->options->addOtherAnswers, self::$yes_no_allowed ) )
1246
  ) {
1247
  self::$errors_present = true;
1248
  self::$error_text = esc_html__( 'Data for "Add other answers in answer list" is invalid', 'yop-poll' );
1249
  }
1250
  if (
1251
  ( false === self::$errors_present ) &&
1252
+ ( ! in_array( $element->options->displayOtherAnswersInResults, self::$yes_no_allowed ) )
1253
  ) {
1254
  self::$errors_present = true;
1255
  self::$error_text = esc_html__( 'Data for "Display other answers in results list" is invalid', 'yop-poll' );
1256
  }
1257
  if (
1258
  ( false === self::$errors_present ) &&
1259
+ ( ! in_array( $element->options->allowMultipleAnswers, self::$yes_no_allowed ) )
1260
  ) {
1261
  self::$errors_present = true;
1262
  self::$error_text = esc_html__( 'Data for "Allow multiple answers " is invalid', 'yop-poll' );
1263
  }
1264
  if (
1265
  ( false === self::$errors_present ) &&
1266
+ ( ! isset( $element->options->multipleAnswersMinim ) ||
1267
  ( '' === sanitize_text_field( $element->options->multipleAnswersMinim ) ) )
1268
  ) {
1269
  self::$errors_present = true;
1271
  }
1272
  if (
1273
  ( false === self::$errors_present ) &&
1274
+ ( ! isset( $element->options->multipleAnswersMaxim ) ||
1275
  ( '' === trim( $element->options->multipleAnswersMaxim ) ) )
1276
  ) {
1277
  self::$errors_present = true;
1286
  }
1287
  if (
1288
  ( false === self::$errors_present ) &&
1289
+ ( ! in_array( $element->options->answersDisplay, self::$answers_display_allowed ) )
1290
  ) {
1291
  self::$errors_present = true;
1292
  self::$error_text = esc_html__( 'Data for "Display answers" is invalid', 'yop-poll' );
1294
  if (
1295
  ( false === self::$errors_present ) &&
1296
  ( 'columns' === $element->options->answersDisplay ) &&
1297
+ ( ! isset( $element->options->answersColumns ) ||
1298
  ( '' === sanitize_text_field( $element->options->answersColumns ) ) ||
1299
  ( 0 === intval( $element->options->answersColumns ) ) )
1300
  ) {
1303
  }
1304
  if (
1305
  ( false === self::$errors_present ) &&
1306
+ ( ! in_array( $element->options->answersSort, self::$answers_sort_allowed ) )
1307
  ) {
1308
  self::$errors_present = true;
1309
  self::$error_text = esc_html__( 'Data for "Sort Answers" is invalid', 'yop-poll' );
1313
  case 'custom-field': {
1314
  if (
1315
  ( false === self::$errors_present ) &&
1316
+ ( ! isset( $element->text ) ||
1317
  ( '' === trim( $element->text ) ) ||
1318
  ( '' === sanitize_text_field( $element->text ) )
1319
  )
1323
  }
1324
  if (
1325
  ( false === self::$errors_present ) &&
1326
+ ( ! in_array( $element->options->makeRequired, self::$yes_no_allowed ) )
1327
  ) {
1328
  self::$errors_present = true;
1329
  self::$error_text = esc_html__( 'Data for "Make Required" is invalid', 'yop-poll' );
1339
  /* POLL OPTIONS->POLL CHECK */
1340
  if (
1341
  ( false === self::$errors_present ) &&
1342
+ ( ! isset( $poll->options->poll->voteButtonLabel ) ||
1343
  ( '' === trim( $poll->options->poll->voteButtonLabel ) ) ||
1344
  ( '' === sanitize_text_field( $poll->options->poll->voteButtonLabel ) )
1345
  )
1349
  }
1350
  if (
1351
  ( false === self::$errors_present ) &&
1352
+ ( ! in_array( $poll->options->poll->showResultsLink, self::$yes_no_allowed ) )
1353
  ) {
1354
  self::$errors_present = true;
1355
  self::$error_text = esc_html__( 'Data for "Show [Results] link" is invalid', 'yop-poll' );
1357
  if (
1358
  ( false === self::$errors_present ) &&
1359
  ( 'yes' === $poll->options->poll->showResultsLink ) &&
1360
+ ( ! isset( $poll->options->poll->resultsLabelText ) ||
1361
  ( '' === trim( $poll->options->poll->resultsLabelText ) ) ||
1362
  ( '' === sanitize_text_field( $poll->options->poll->resultsLabelText ) )
1363
  )
1367
  }
1368
  if (
1369
  ( false === self::$errors_present ) &&
1370
+ ( ! in_array( $poll->options->poll->showTotalVotes, self::$yes_no_allowed ) )
1371
  ) {
1372
  self::$errors_present = true;
1373
  self::$error_text = esc_html__( 'Data for "Show Total Votes" is invalid', 'yop-poll' );
1374
  }
1375
  if (
1376
  ( false === self::$errors_present ) &&
1377
+ ( ! in_array( $poll->options->poll->showTotalAnswers, self::$yes_no_allowed ) )
1378
  ) {
1379
  self::$errors_present = true;
1380
  self::$error_text = esc_html__( 'Data for "Show Total Answers" is invalid', 'yop-poll' );
1381
  }
1382
  if (
1383
  ( false === self::$errors_present ) &&
1384
+ ( ! in_array( $poll->options->poll->startDateOption, self::$date_values_allowed ) )
1385
  ) {
1386
  self::$errors_present = true;
1387
  self::$error_text = esc_html__( 'Data for "Start Date" is invalid', 'yop-poll' );
1389
  if (
1390
  ( false === self::$errors_present ) &&
1391
  ( 'custom' === $poll->options->poll->startDateOption ) &&
1392
+ ( ! isset( $poll->options->poll->startDateCustom ) ||
1393
  ( '' === sanitize_text_field( $poll->options->poll->startDateCustom ) ) )
1394
  ) {
1395
  self::$errors_present = true;
1397
  }
1398
  if (
1399
  ( false === self::$errors_present ) &&
1400
+ ( ! in_array( $poll->options->poll->endDateOption, self::$date_values_allowed ) )
1401
  ) {
1402
  self::$errors_present = true;
1403
  self::$error_text = esc_html__( 'Data for "End Date" is invalid', 'yop-poll' );
1405
  if (
1406
  ( false === self::$errors_present ) &&
1407
  ( 'custom' === $poll->options->poll->endDateOption ) &&
1408
+ ( ! isset( $poll->options->poll->endDateCustom ) ||
1409
  ( '' === sanitize_text_field( $poll->options->poll->endDateCustom ) ) )
1410
  ) {
1411
  self::$errors_present = true;
1413
  }
1414
  if (
1415
  ( false === self::$errors_present ) &&
1416
+ ( ! in_array( $poll->options->poll->redirectAfterVote, self::$yes_no_allowed ) )
1417
  ) {
1418
  self::$errors_present = true;
1419
  self::$error_text = esc_html__( 'Data for "Redirect after vote" is invalid', 'yop-poll' );
1421
  if (
1422
  ( false === self::$errors_present ) &&
1423
  ( 'yes' === $poll->options->poll->redirectAfterVote ) &&
1424
+ ( ! isset( $poll->options->poll->redirectUrl ) ||
1425
  ( '' === trim( $poll->options->poll->redirectUrl ) ) ||
1426
  ( '' === sanitize_text_field( $poll->options->poll->redirectUrl ) )
1427
  )
1431
  }
1432
  if (
1433
  ( false === self::$errors_present ) &&
1434
+ ( ! in_array( $poll->options->poll->resetPollStatsAutomatically, self::$yes_no_allowed ) )
1435
  ) {
1436
  self::$errors_present = true;
1437
  self::$error_text = esc_html__( 'Data for "Reset Poll Stats automatically" is invalid', 'yop-poll' );
1438
  }
1439
  if (
1440
  ( false === self::$errors_present ) &&
1441
+ ( ! in_array( $poll->options->poll->resetPollStatsEveryPeriod, self::$reset_stats_allowed ) )
1442
  ) {
1443
  self::$errors_present = true;
1444
  self::$error_text = esc_html__( 'Data for "Reset Every" is invalid', 'yop-poll' );
1445
  }
1446
  if (
1447
  ( false === self::$errors_present ) &&
1448
+ ( ! in_array( $poll->options->poll->autoGeneratePollPage, self::$yes_no_allowed ) )
1449
  ) {
1450
  self::$errors_present = true;
1451
  self::$error_text = esc_html__( 'Data for "Auto Generate Poll Page" is invalid', 'yop-poll' );
1452
  }
1453
  if (
1454
  ( false === self::$errors_present ) &&
1455
+ ( ! in_array( $poll->options->poll->useCaptcha, self::$captcha_allowed ) )
1456
  ) {
1457
  self::$errors_present = true;
1458
  self::$error_text = esc_html__( 'Data for "Use Captcha" is invalid', 'yop-poll' );
1459
  }
1460
  if (
1461
  ( false === self::$errors_present ) &&
1462
+ ( ! in_array( $poll->options->poll->sendEmailNotifications, self::$yes_no_allowed ) )
1463
  ) {
1464
  self::$errors_present = true;
1465
  self::$error_text = esc_html__( 'Data for "Send Email notifications" is invalid', 'yop-poll' );
1467
  if (
1468
  ( false === self::$errors_present ) &&
1469
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1470
+ ( ! isset( $poll->options->poll->emailNotificationsFromName ) ||
1471
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromName ) ) )
1472
  ) {
1473
  self::$errors_present = true;
1476
  if (
1477
  ( false === self::$errors_present ) &&
1478
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1479
+ ( ! isset( $poll->options->poll->emailNotificationsFromEmail ) ||
1480
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromEmail ) ) )
1481
  ) {
1482
  self::$errors_present = true;
1485
  if (
1486
  ( false === self::$errors_present ) &&
1487
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1488
+ ( ! isset( $poll->options->poll->emailNotificationsRecipients ) ||
1489
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsRecipients ) ) )
1490
  ) {
1491
  self::$errors_present = true;
1494
  if (
1495
  ( false === self::$errors_present ) &&
1496
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1497
+ ( ! isset( $poll->options->poll->emailNotificationsSubject ) ||
1498
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsSubject ) ) )
1499
  ) {
1500
  self::$errors_present = true;
1503
  if (
1504
  ( false === self::$errors_present ) &&
1505
  ( 'yes' === $poll->options->poll->sendEmailNotifications ) &&
1506
+ ( ! isset( $poll->options->poll->emailNotificationsMessage ) ||
1507
  ( '' === sanitize_text_field( $poll->options->poll->emailNotificationsMessage ) ) )
1508
  ) {
1509
  self::$errors_present = true;
1521
  if (
1522
  ( false === self::$errors_present ) &&
1523
  ( in_array( 'custom-date', $poll->options->results->showResultsMoment ) ) &&
1524
+ ( ! isset( $poll->options->results->customDateResults ) ||
1525
  ( '' === sanitize_text_field( $poll->options->results->customDateResults ) ) )
1526
  ) {
1527
  self::$errors_present = true;
1529
  }
1530
  if (
1531
  ( false === self::$errors_present ) &&
1532
+ ( 0 < count( $poll->options->results->showResultsMoment ) ) && ! in_array( 'never', $poll->options->results->showResultsMoment ) &&
1533
  ( ( 0 === count( $poll->options->results->showResultsTo ) ) ||
1534
  ( 0 === count( array_intersect( $poll->options->results->showResultsTo, self::$show_results_to_allowed ) ) ) )
1535
  ) {
1538
  }
1539
  if (
1540
  ( false === self::$errors_present ) &&
1541
+ ( ! in_array( $poll->options->results->backToVoteOption, self::$yes_no_allowed ) )
1542
  ) {
1543
  self::$errors_present = true;
1544
  self::$error_text = esc_html__( 'Data for "Display [Back to vote] link" is invalid', 'yop-poll' );
1546
  if (
1547
  ( false === self::$errors_present ) &&
1548
  ( 'yes' === $poll->options->results->backToVoteOption ) &&
1549
+ ( ! isset( $poll->options->results->backToVoteCaption ) ||
1550
  ( '' === trim( $poll->options->results->backToVoteCaption ) ) ||
1551
  ( '' === sanitize_text_field( $poll->options->results->backToVoteCaption ) )
1552
  )
1556
  }
1557
  if (
1558
  ( false === self::$errors_present ) &&
1559
+ ( ! in_array( $poll->options->results->sortResults, self::$sort_results_allowed ) )
1560
  ) {
1561
  self::$errors_present = true;
1562
  self::$error_text = esc_html__( 'Data for "Sort Results" is invalid', 'yop-poll' );
1564
  if (
1565
  ( false === self::$errors_present ) &&
1566
  ( 'number-of-votes' === $poll->options->results->sortResults ) &&
1567
+ ( ! in_array( $poll->options->results->sortResultsRule, self::$sort_results_rule_allowed ) )
1568
  ) {
1569
  self::$errors_present = true;
1570
  self::$error_text = esc_html__( 'Data for "Sort rule" is invalid', 'yop-poll' );
1571
  }
1572
  if (
1573
  ( false === self::$errors_present ) &&
1574
+ ( ! in_array( $poll->options->results->displayResultsAs, self::$display_results_as_allowed ) )
1575
  ) {
1576
  self::$errors_present = true;
1577
  self::$error_text = esc_html__( 'Data for "Display Results As"', 'yop-poll' );
1604
  if (
1605
  ( false === self::$errors_present ) &&
1606
  ( count( $poll->options->access->blockVoters ) > 0 ) &&
1607
+ ( ! in_array( 'no-block', $poll->options->access->blockVoters ) ) &&
1608
  ( 'limited-time' === $poll->options->access->blockLengthType ) &&
1609
+ ( ( ! isset( $poll->options->access->blockForValue ) ||
1610
  ( 0 === intval( $poll->options->access->blockForValue ) ) ) ||
1611
+ ( ! in_array( $poll->options->access->blockForPeriod, self::$block_voters_period_allowed ) ) )
1612
  ) {
1613
  self::$errors_present = true;
1614
  self::$error_text = esc_html__( 'Data for "Block Period" is invalid', 'yop-poll' );
1615
  }
1616
  if (
1617
  ( false === self::$errors_present ) &&
1618
+ ( ! in_array( $poll->options->access->limitVotesPerUser, self::$yes_no_allowed ) )
1619
  ) {
1620
  self::$errors_present = true;
1621
  self::$error_text = esc_html__( 'Data for "Limit Number Of Votes per User" is invalid', 'yop-poll' );
1678
  $sub_elements_sort_rule = 'ASC'
1679
  ) {
1680
  $query = $GLOBALS['wpdb']->prepare(
1681
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'",
1682
+ $poll_id
1683
  );
1684
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1685
  if ( null !== $poll ) {
1686
  $poll_meta_data = unserialize( $poll->meta_data );
1687
  $poll->meta_data = array(
1688
  'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
1689
+ 'options' => $poll_meta_data['options'],
1690
  );
1691
  $poll_elements = YOP_Poll_Elements::get( $poll_id, $elements_order_by, $elements_sort_rule );
1692
  $poll_sub_elements = YOP_Poll_SubElements::get( $poll_id, $sub_elements_order_by, $sub_elements_sort_rule );
1706
  public static function get_poll_for_voting( $poll_id ) {
1707
  if ( true === isset( $poll_id ) ) {
1708
  $query = $GLOBALS['wpdb']->prepare(
1709
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'",
1710
+ $poll_id
1711
  );
1712
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1713
  if ( null !== $poll ) {
1714
  $poll_meta_data = unserialize( $poll->meta_data );
1715
  $poll->meta_data = array(
1716
  'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
1717
+ 'options' => $poll_meta_data['options'],
1718
  );
1719
  $poll_elements = YOP_Poll_Elements::get_all_for_poll( $poll_id );
1720
  foreach ( $poll_elements as $poll_element ) {
1760
  $sub_elements_order_by = 'sorder';
1761
  $sub_elements_sort_rule = 'ASC';
1762
  $query = $GLOBALS['wpdb']->prepare(
1763
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'",
1764
+ $poll_id
1765
  );
1766
  $poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1767
  if ( null !== $poll ) {
1833
  'makeDefault' => '',
1834
  'makeLink' => '',
1835
  'link' => '',
1836
+ 'resultsColor' => isset( $poll_element->meta_data['resultsColorForOtherAnswers'] ) ? $poll_element->meta_data['resultsColorForOtherAnswers'] : '#000000',
1837
  ),
1838
+ 'total_submits' => $other_answer->total_submits,
1839
  );
1840
  $i++;
1841
  }
1866
  }
1867
  public static function get_meta_data( $poll_id ) {
1868
  $query = $GLOBALS['wpdb']->prepare(
1869
+ "SELECT `meta_data` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s",
1870
+ $poll_id
1871
  );
1872
  $poll = $GLOBALS['wpdb']->get_col( $query );
1873
  if ( 1 === count( $poll ) ) {
1878
  }
1879
  public static function get_info( $poll_id ) {
1880
  $query = $GLOBALS['wpdb']->prepare(
1881
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'",
1882
+ $poll_id
1883
  );
1884
  $poll = $GLOBALS['wpdb']->get_row( $query );
1885
  if ( ( true === isset( $poll->id ) ) && ( $poll->id > 0 ) ) {
2052
  public static function get_results_for_frontend(
2053
  $poll,
2054
  $before_or_after_vote,
2055
+ $sort_params = array(
2056
+ 'order_by' => 'sorder',
2057
+ 'sort_order' => 'asc',
2058
+ )
2059
+ ) {
2060
  switch ( $sort_params['order_by'] ) {
2061
  case 'as-defined' :{
2062
  $sort_params['order_by'] = 'sorder';
2213
  'makeLink' => isset( $subelement->meta_data['makeLink'] ) ? $subelement->meta_data['makeLink'] : '',
2214
  'link' => isset( $subelement->meta_data['link'] ) ? $subelement->meta_data['link'] : '',
2215
  'color' => $subelement->meta_data['resultsColor'],
2216
+ 'votes' => $subelement->total_submits,
2217
  );
2218
  }
2219
  $poll_results[] = $element_results;
2227
  $polls = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
2228
  foreach ( $polls as $poll ) {
2229
  $poll_meta_data = unserialize( $poll['meta_data'] );
2230
+ array_push(
2231
+ $returned_polls,
2232
+ array(
2233
+ 'id' => $poll['id'],
2234
+ 'resetPollStatsAutomatically' => $poll_meta_data['options']['poll']['resetPollStatsAutomatically'],
2235
+ 'resetPollStatsOn' => $poll_meta_data['options']['poll']['resetPollStatsOn'],
2236
+ 'resetPollStatsEvery' => $poll_meta_data['options']['poll']['resetPollStatsEvery'],
2237
+ 'resetPollStatsEveryPeriod' => $poll_meta_data['options']['poll']['resetPollStatsEveryPeriod'],
2238
+ )
2239
+ );
2240
  }
2241
  return $returned_polls;
2242
  }
2282
  }
2283
  if ( ( 'yes' === $poll->meta_data['options']['access']['limitVotesPerUser'] ) && ( $poll->meta_data['options']['access']['votesPerUserAllowed'] > 0 ) ) {
2284
  $query = $GLOBALS['wpdb']->prepare(
2285
+ "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `" . $search_field . "` = %s AND `poll_id` = %d AND `status` = 'active'",
2286
+ $user,
2287
+ $poll->id
2288
  );
2289
  $total_votes_for_user = $GLOBALS['wpdb']->get_var( $query );
2290
  if ( $total_votes_for_user >= $poll->meta_data['options']['access']['votesPerUserAllowed'] ) {
2410
  }
2411
  public static function add_votes_manually( $poll_id, $elements_data ) {
2412
  $total_votes__to_be_added = 0;
2413
+ $elements_votes = array();
2414
  $i = 0;
2415
+ $votes = array();
2416
  $result = array();
2417
  if ( $poll_id > 0 ) {
2418
  foreach ( $elements_data as $element_data ) {
2441
  $votes[$i]->data[$j]->id = $element_data->id;
2442
  foreach ( $element_data->answers as $answer_data ) {
2443
  if ( ( intval( $answer_data->id ) > 0 ) && ( intval( $answer_data->votes ) > 0 ) ) {
2444
+ $votes[$i]->data[$j]->data = array();
2445
  $votes[$i]->data[$j]->data[0] = new stdClass();
2446
  $votes[$i]->data[$j]->data[0]->id = $answer_data->id;
2447
  $votes[$i]->data[$j]->data[0]->data = 1;
admin/models/settings.php CHANGED
@@ -124,7 +124,7 @@ class YOP_Poll_Settings {
124
  );
125
  return serialize( $settings );
126
  }
127
- public static function import_settings_from_5x ( $old_settings ) {
128
  $new_settings = array(
129
  'general' => array(
130
  'i-date' => current_time( 'mysql' ),
@@ -137,24 +137,24 @@ class YOP_Poll_Settings {
137
  'from-email' => isset( $old_settings['email_notifications_from_email'] ) ? sanitize_text_field( $old_settings['email_notifications_from_email'] ) : 'Your Email Address Here',
138
  'recipients' => isset( $old_settings['email_notifications_recipients'] ) ? sanitize_text_field( $old_settings['email_notifications_recipients'] ) : '',
139
  'subject' => isset( $old_settings['email_notifications_subject'] ) ? sanitize_text_field( $old_settings['email_notifications_subject'] ) : 'Your Subject Here',
140
- 'message' => isset( $old_settings['email_notifications_body'] ) ? sanitize_text_field( $old_settings['email_notifications_body'] ) : 'Your Message Here'
141
  ),
142
  'integrations' => array(
143
  'reCaptcha' => array(
144
  'enabled' => 'no',
145
  'site-key' => '',
146
- 'secret-key' => ''
147
  ),
148
  'reCaptchaV2Invisible' => array(
149
  'enabled' => 'no',
150
  'site-key' => '',
151
- 'secret-key' => ''
152
  ),
153
  'reCaptchaV3' => array(
154
  'enabled' => 'no',
155
  'site-key' => '',
156
  'secret-key' => '',
157
- 'min-allowed-score' => ''
158
  ),
159
  'facebook' => array(
160
  'enabled' => isset( $old_settings['facebook_integration'] ) ? sanitize_text_field( $old_settings['facebook_integration'] ) : 'no',
@@ -163,8 +163,8 @@ class YOP_Poll_Settings {
163
  'google' => array(
164
  'enabled' => isset( $old_settings['google_integration'] ) ? sanitize_text_field( $old_settings['google_integration'] ) : 'no',
165
  'app-id' => isset( $old_settings['google_appID'] ) ? sanitize_text_field( $old_settings['google_appID'] ) : '',
166
- 'app-secret' => isset( $old_settings['google_appSecret'] ) ? sanitize_text_field( $old_settings['google_appSecret'] ) : ''
167
- )
168
  ),
169
  'messages' => array(
170
  'captcha' => array(
@@ -173,13 +173,13 @@ class YOP_Poll_Settings {
173
  'accessibility-description' => 'Type below the [STRONG]answer[/STRONG] to what you hear. Numbers or words:',
174
  'explanation' => 'Click or touch the [STRONG]ANSWER[/STRONG]',
175
  'refresh-alt' => 'Refresh/reload icon',
176
- 'refresh-title' => 'Refresh/reload: get new images and accessibility option!'
177
  ),
178
  'buttons' => array(
179
  'anonymous' => 'Anonymous Vote',
180
  'wordpress' => 'Sign in with WordPress',
181
  'facebook' => 'Sign in with Facebook',
182
- 'google' => 'Sign in with Google'
183
  ),
184
  'voting' => array(
185
  'poll-ended' => 'This poll is no longer accepting votes',
@@ -196,15 +196,15 @@ class YOP_Poll_Settings {
196
  'not-allowed-by-ban' => 'Vote not allowed',
197
  'not-allowed-by-block' => 'Vote not allowed',
198
  'not-allowed-by-limit' => 'Vote not allowed',
199
- 'thank-you' => 'Thank you for your vote'
200
  ),
201
  'results' => array(
202
  'single-vote' => 'vote',
203
  'multiple-votes' => 'votes',
204
  'single-answer' => 'answer',
205
- 'multiple-answers' => 'answers'
206
- )
207
- )
208
  );
209
  return serialize( $new_settings );
210
  }
@@ -221,14 +221,14 @@ class YOP_Poll_Settings {
221
  }
222
  $new_settings = array(
223
  'general' => array(
224
- 'i-date' => isset( $current_settings_decoded['general']['idate'] ) ? sanitize_text_field( $current_settings_decoded['general']['idate'] ) : current_time( 'mysql' )
225
  ),
226
  'email' => array(
227
  'from-name' => isset( $current_settings_decoded['email']['from_name'] ) ? sanitize_text_field( $current_settings_decoded['email']['from_name'] ) : '',
228
  'from-email' => isset( $current_settings_decoded['email']['from_email'] ) ? sanitize_text_field( $current_settings_decoded['email']['from_email'] ) : '',
229
  'recipients' => isset( $current_settings_decoded['email']['recipients'] ) ? sanitize_text_field( $current_settings_decoded['email']['recipients'] ) : '',
230
  'subject' => isset( $current_settings_decoded['email']['subject'] ) ? sanitize_text_field( $current_settings_decoded['email']['subject'] ) : '',
231
- 'message' => isset( $current_settings_decoded['email']['message'] ) ? sanitize_text_field( $current_settings_decoded['email']['message'] ) : ''
232
  ),
233
  'integrations' => array(
234
  'reCaptcha' => array(
@@ -244,7 +244,7 @@ class YOP_Poll_Settings {
244
  'enabled' => isset( $current_settings_decoded['integrations']['google']['integration'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['integration'] ) : 'no',
245
  'app-id' => isset( $current_settings_decoded['integrations']['google']['app_id'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['app_id'] ) : '',
246
  'app-secret' => isset( $current_settings_decoded['integrations']['google']['app_secret'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['app_secret'] ) : '',
247
- )
248
  ),
249
  'messages' => array(
250
  'captcha' => array(
@@ -253,13 +253,13 @@ class YOP_Poll_Settings {
253
  'accessibility-description' => 'Type below the [STRONG]answer[/STRONG] to what you hear. Numbers or words:',
254
  'explanation' => 'Click or touch the [STRONG]ANSWER[/STRONG]',
255
  'refresh-alt' => 'Refresh/reload icon',
256
- 'refresh-title' => 'Refresh/reload: get new images and accessibility option!'
257
  ),
258
  'buttons' => array(
259
  'anonymous' => 'Anonymous Vote',
260
  'wordpress' => 'Sign in with WordPress',
261
  'facebook' => 'Sign in with Facebook',
262
- 'google' => 'Sign in with Google'
263
  ),
264
  'voting' => array(
265
  'poll-ended' => 'This poll is no longer accepting votes',
@@ -276,15 +276,15 @@ class YOP_Poll_Settings {
276
  'not-allowed-by-ban' => 'Vote not allowed',
277
  'not-allowed-by-block' => 'Vote not allowed',
278
  'not-allowed-by-limit' => 'Vote not allowed',
279
- 'thank-you' => 'Thank you for your vote'
280
  ),
281
  'results' => array(
282
  'single-vote' => 'vote',
283
  'multiple-votes' => 'votes',
284
  'single-answer' => 'answer',
285
- 'multiple-answers' => 'answers'
286
- )
287
- )
288
  );
289
  update_option( 'yop_poll_settings', serialize( $new_settings ) );
290
  }
@@ -300,7 +300,7 @@ class YOP_Poll_Settings {
300
  'message' => isset( $current_settings['email']['message'] ) ? wp_kses(
301
  $current_settings['email']['message'],
302
  array(
303
- 'br' => array()
304
  )
305
  ) : 'There is a new vote for %POLL-NAME%
306
  Here are the details
@@ -312,7 +312,7 @@ class YOP_Poll_Settings {
312
 
313
  [CUSTOM_FIELDS]
314
  %CUSTOM_FIELD_NAME% - %CUSTOM_FIELD_VALUE%
315
- [/CUSTOM_FIELDS]'
316
  ),
317
  'automatically-reset-votes' => array(
318
  'from-name' => 'Your Name Here',
@@ -331,8 +331,8 @@ class YOP_Poll_Settings {
331
  [OTHER-ANSWERS]
332
  %ANSWER-TEXT% - %ANSWER-VOTES% votes
333
  [/OTHER-ANSWERS]
334
- [/RESULTS]'
335
- )
336
  );
337
  unset( $current_settings['email'] );
338
  update_option( 'yop_poll_settings', serialize( $current_settings ) );
@@ -406,33 +406,33 @@ class YOP_Poll_Settings {
406
  'reCaptcha' => array(
407
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['enabled'] : '',
408
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['site-key'] : '',
409
- 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['secret-key'] : ''
410
  ),
411
  'reCaptchaV2Invisible' => array(
412
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['enabled'] : '',
413
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['site-key'] : '',
414
- 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['secret-key'] : ''
415
  ),
416
  'reCaptchaV3' => array(
417
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['enabled'] : '',
418
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['site-key'] : '',
419
  'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] : '',
420
- 'min-allowed-score' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['min-allowed-score'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['min-allowed-score'] : ''
421
  ),
422
  'hCaptcha' => array(
423
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['enabled'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['enabled'] : '',
424
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['site-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['site-key'] : '',
425
- 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['secret-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['secret-key'] : ''
426
  ),
427
  'facebook' => array(
428
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['enabled'] ) ) ? $unserialized_settings['integrations']['facebook']['enabled'] : '',
429
- 'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['app-id'] ) ) ? $unserialized_settings['integrations']['facebook']['app-id'] : ''
430
  ),
431
  'google' => array(
432
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['enabled'] ) ) ? $unserialized_settings['integrations']['google']['enabled'] : '',
433
  'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['app-id'] ) ) ? $unserialized_settings['integrations']['google']['app-id'] : '',
434
- 'app-secret' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['app-secret'] ) ) ? $unserialized_settings['integrations']['google']['app-secret'] : ''
435
- )
436
  );
437
  }
438
  return $integrations_settings;
@@ -504,7 +504,7 @@ class YOP_Poll_Settings {
504
  */
505
  if (
506
  ( false === self::$errors_present ) &&
507
- ( !isset( $settings->integrations->reCaptcha->{'enabled'} ) ||
508
  ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ) ) )
509
  ) {
510
  self::$errors_present = true;
@@ -556,7 +556,7 @@ class YOP_Poll_Settings {
556
  }
557
  if (
558
  ( false === self::$errors_present ) &&
559
- ( !isset( $settings->integrations->facebook->{'enabled'} ) ||
560
  ( '' === sanitize_text_field( $settings->integrations->facebook->{'enabled'} ) ) )
561
  ) {
562
  self::$errors_present = true;
@@ -570,7 +570,7 @@ class YOP_Poll_Settings {
570
  }
571
  if (
572
  ( false === self::$errors_present ) &&
573
- ( !isset( $settings->integrations->google->{'enabled'} ) ||
574
  ( '' === trim( $settings->integrations->google->{'enabled'} ) ) )
575
  ) {
576
  self::$errors_present = true;
@@ -588,7 +588,7 @@ class YOP_Poll_Settings {
588
  }
589
  if (
590
  ( false === self::$errors_present ) &&
591
- ( !isset( $settings->messages->buttons->{'anonymous'} ) ||
592
  ( '' === sanitize_text_field( $settings->messages->buttons->{'anonymous'} ) ) )
593
  ) {
594
  self::$errors_present = true;
@@ -596,7 +596,7 @@ class YOP_Poll_Settings {
596
  }
597
  if (
598
  ( false === self::$errors_present ) &&
599
- ( !isset( $settings->messages->buttons->{'wordpress'} ) ||
600
  ( '' === sanitize_text_field( $settings->messages->buttons->{'wordpress'} ) ) )
601
  ) {
602
  self::$errors_present = true;
@@ -604,7 +604,7 @@ class YOP_Poll_Settings {
604
  }
605
  if (
606
  ( false === self::$errors_present ) &&
607
- ( !isset( $settings->messages->buttons->{'facebook'} ) ||
608
  ( '' === sanitize_text_field( $settings->messages->buttons->{'facebook'} ) ) )
609
  ) {
610
  self::$errors_present = true;
@@ -612,7 +612,7 @@ class YOP_Poll_Settings {
612
  }
613
  if (
614
  ( false === self::$errors_present ) &&
615
- ( !isset( $settings->messages->buttons->{'google'} ) ||
616
  ( '' === sanitize_text_field( $settings->messages->buttons->{'google'} ) ) )
617
  ) {
618
  self::$errors_present = true;
@@ -620,7 +620,7 @@ class YOP_Poll_Settings {
620
  }
621
  if (
622
  ( false === self::$errors_present ) &&
623
- ( !isset( $settings->messages->voting->{'poll-ended'} ) ||
624
  ( '' === sanitize_text_field( $settings->messages->voting->{'poll-ended'} ) ) )
625
  ) {
626
  self::$errors_present = true;
@@ -628,7 +628,7 @@ class YOP_Poll_Settings {
628
  }
629
  if (
630
  ( false === self::$errors_present ) &&
631
- ( !isset( $settings->messages->voting->{'poll-not-started'} ) ||
632
  ( '' === sanitize_text_field( $settings->messages->voting->{'poll-not-started'} ) ) )
633
  ) {
634
  self::$errors_present = true;
@@ -636,7 +636,7 @@ class YOP_Poll_Settings {
636
  }
637
  if (
638
  ( false === self::$errors_present ) &&
639
- ( !isset( $settings->messages->voting->{'already-voted-on-poll'} ) ||
640
  ( '' === sanitize_text_field( $settings->messages->voting->{'already-voted-on-poll'} ) ) )
641
  ) {
642
  self::$errors_present = true;
@@ -644,7 +644,7 @@ class YOP_Poll_Settings {
644
  }
645
  if (
646
  ( false === self::$errors_present ) &&
647
- ( !isset( $settings->messages->voting->{'invalid-poll'} ) ||
648
  ( '' === sanitize_text_field( $settings->messages->voting->{'invalid-poll'} ) ) )
649
  ) {
650
  self::$errors_present = true;
@@ -652,7 +652,7 @@ class YOP_Poll_Settings {
652
  }
653
  if (
654
  ( false === self::$errors_present ) &&
655
- ( !isset( $settings->messages->voting->{'no-answers-selected'} ) ||
656
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-answers-selected'} ) ) )
657
  ) {
658
  self::$errors_present = true;
@@ -660,7 +660,7 @@ class YOP_Poll_Settings {
660
  }
661
  if (
662
  ( false === self::$errors_present ) &&
663
- ( !isset( $settings->messages->voting->{'min-answers-required'} ) ||
664
  ( '' === sanitize_text_field( $settings->messages->voting->{'min-answers-required'} ) ) )
665
  ) {
666
  self::$errors_present = true;
@@ -668,7 +668,7 @@ class YOP_Poll_Settings {
668
  }
669
  if (
670
  ( false === self::$errors_present ) &&
671
- ( !isset( $settings->messages->voting->{'max-answers-required'} ) ||
672
  ( '' === sanitize_text_field( $settings->messages->voting->{'max-answers-required'} ) ) )
673
  ) {
674
  self::$errors_present = true;
@@ -676,7 +676,7 @@ class YOP_Poll_Settings {
676
  }
677
  if (
678
  ( false === self::$errors_present ) &&
679
- ( !isset( $settings->messages->voting->{'no-answer-for-other'} ) ||
680
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-answer-for-other'} ) ) )
681
  ) {
682
  self::$errors_present = true;
@@ -684,7 +684,7 @@ class YOP_Poll_Settings {
684
  }
685
  if (
686
  ( false === self::$errors_present ) &&
687
- ( !isset( $settings->messages->voting->{'no-value-for-custom-field'} ) ||
688
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-value-for-custom-field'} ) ) )
689
  ) {
690
  self::$errors_present = true;
@@ -692,7 +692,7 @@ class YOP_Poll_Settings {
692
  }
693
  if (
694
  ( false === self::$errors_present ) &&
695
- ( !isset( $settings->messages->voting->{'consent-not-checked'} ) ||
696
  ( '' === sanitize_text_field( $settings->messages->voting->{'consent-not-checked'} ) ) )
697
  ) {
698
  self::$errors_present = true;
@@ -700,7 +700,7 @@ class YOP_Poll_Settings {
700
  }
701
  if (
702
  ( false === self::$errors_present ) &&
703
- ( !isset( $settings->messages->voting->{'no-captcha-selected'} ) ||
704
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-captcha-selected'} ) ) )
705
  ) {
706
  self::$errors_present = true;
@@ -708,7 +708,7 @@ class YOP_Poll_Settings {
708
  }
709
  if (
710
  ( false === self::$errors_present ) &&
711
- ( !isset( $settings->messages->voting->{'not-allowed-by-ban'} ) ||
712
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ) ) )
713
  ) {
714
  self::$errors_present = true;
@@ -716,7 +716,7 @@ class YOP_Poll_Settings {
716
  }
717
  if (
718
  ( false === self::$errors_present ) &&
719
- ( !isset( $settings->messages->voting->{'not-allowed-by-block'} ) ||
720
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ) ) )
721
  ) {
722
  self::$errors_present = true;
@@ -724,7 +724,7 @@ class YOP_Poll_Settings {
724
  }
725
  if (
726
  ( false === self::$errors_present ) &&
727
- ( !isset( $settings->messages->voting->{'not-allowed-by-limit'} ) ||
728
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ) ) )
729
  ) {
730
  self::$errors_present = true;
@@ -732,7 +732,7 @@ class YOP_Poll_Settings {
732
  }
733
  if (
734
  ( false === self::$errors_present ) &&
735
- ( !isset( $settings->messages->voting->{'thank-you'} ) ||
736
  ( '' === sanitize_text_field( $settings->messages->voting->{'thank-you'} ) ) )
737
  ) {
738
  self::$errors_present = true;
@@ -740,7 +740,7 @@ class YOP_Poll_Settings {
740
  }
741
  if (
742
  ( false === self::$errors_present ) &&
743
- ( !isset( $settings->messages->results->{'single-vote'} ) ||
744
  ( '' === sanitize_text_field( $settings->messages->results->{'single-vote'} ) ) )
745
  ) {
746
  self::$errors_present = true;
@@ -748,7 +748,7 @@ class YOP_Poll_Settings {
748
  }
749
  if (
750
  ( false === self::$errors_present ) &&
751
- ( !isset( $settings->messages->results->{'multiple-votes'} ) ||
752
  ( '' === sanitize_text_field( $settings->messages->results->{'multiple-votes'} ) ) )
753
  ) {
754
  self::$errors_present = true;
@@ -756,7 +756,7 @@ class YOP_Poll_Settings {
756
  }
757
  if (
758
  ( false === self::$errors_present ) &&
759
- ( !isset( $settings->messages->results->{'single-answer'} ) ||
760
  ( '' === sanitize_text_field( $settings->messages->results->{'single-answer'} ) ) )
761
  ) {
762
  self::$errors_present = true;
@@ -764,7 +764,7 @@ class YOP_Poll_Settings {
764
  }
765
  if (
766
  ( false === self::$errors_present ) &&
767
- ( !isset( $settings->messages->results->{'multiple-answers'} ) ||
768
  ( '' === sanitize_text_field( $settings->messages->results->{'multiple-answers'} ) ) )
769
  ) {
770
  self::$errors_present = true;
@@ -772,15 +772,15 @@ class YOP_Poll_Settings {
772
  }
773
  if (
774
  ( false === self::$errors_present ) &&
775
- ( !isset( $settings->messages->captcha->{'accessibility-alt'} ) ||
776
- ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-alt'} ) ) )
777
  ) {
778
  self::$errors_present = true;
779
  self::$error_text = esc_html__( 'Data for "Accessibility Alt" is invalid', 'yop-poll' );
780
  }
781
  if (
782
  ( false === self::$errors_present ) &&
783
- ( !isset( $settings->messages->captcha->{'accessibility-title'} ) ||
784
  ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-title'} ) ) )
785
  ) {
786
  self::$errors_present = true;
@@ -788,7 +788,7 @@ class YOP_Poll_Settings {
788
  }
789
  if (
790
  ( false === self::$errors_present ) &&
791
- ( !isset( $settings->messages->captcha->{'accessibility-description'} ) ||
792
  ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-description'} ) ) )
793
  ) {
794
  self::$errors_present = true;
@@ -796,7 +796,7 @@ class YOP_Poll_Settings {
796
  }
797
  if (
798
  ( false === self::$errors_present ) &&
799
- ( !isset( $settings->messages->captcha->{'explanation'} ) ||
800
  ( '' === sanitize_text_field( $settings->messages->captcha->{'explanation'} ) ) )
801
  ) {
802
  self::$errors_present = true;
@@ -804,7 +804,7 @@ class YOP_Poll_Settings {
804
  }
805
  if (
806
  ( false === self::$errors_present ) &&
807
- ( !isset( $settings->messages->captcha->{'refresh-alt'} ) ||
808
  ( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ) ) )
809
  ) {
810
  self::$errors_present = true;
@@ -812,7 +812,7 @@ class YOP_Poll_Settings {
812
  }
813
  if (
814
  ( false === self::$errors_present ) &&
815
- ( !isset( $settings->messages->captcha->{'refresh-title'} ) ||
816
  ( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ) ) )
817
  ) {
818
  self::$errors_present = true;
@@ -840,9 +840,9 @@ class YOP_Poll_Settings {
840
  'message' => wp_kses(
841
  $settings->notifications->{'new-vote'}->{'message'},
842
  array(
843
- 'br' => array()
844
  )
845
- )
846
  ),
847
  'automatically-reset-votes' => array(
848
  'from-name' => 'Your Name Here',
@@ -861,30 +861,30 @@ class YOP_Poll_Settings {
861
  [OTHER-ANSWERS]
862
  %ANSWER-TEXT% - %ANSWER-VOTES% votes
863
  [/OTHER-ANSWERS]
864
- [/RESULTS]'
865
- )
866
  ),
867
  'integrations' => array(
868
  'reCaptcha' => array(
869
  'enabled' => sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ),
870
  'site-key' => sanitize_text_field( $settings->integrations->reCaptcha->{'site-key'} ),
871
- 'secret-key' => sanitize_text_field( $settings->integrations->reCaptcha->{'secret-key'} )
872
  ),
873
  'reCaptchaV2Invisible' => array(
874
  'enabled' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'enabled'} ),
875
  'site-key' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ),
876
- 'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} )
877
  ),
878
  'reCaptchaV3' => array(
879
  'enabled' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'enabled'} ),
880
  'site-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'site-key'} ),
881
  'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ),
882
- 'min-allowed-score' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} )
883
  ),
884
  'hCaptcha' => array(
885
  'enabled' => sanitize_text_field( $settings->integrations->hCaptcha->{'enabled'} ),
886
  'site-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'site-key'} ),
887
- 'secret-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'secret-key'} )
888
  ),
889
  'facebook' => array(
890
  'enabled' => sanitize_text_field( $settings->integrations->facebook->{'enabled'} ),
@@ -893,8 +893,8 @@ class YOP_Poll_Settings {
893
  'google' => array(
894
  'enabled' => sanitize_text_field( $settings->integrations->google->{'enabled'} ),
895
  'app-id' => sanitize_text_field( $settings->integrations->google->{'app-id'} ),
896
- 'app-secret' => sanitize_text_field( $settings->integrations->google->{'app-secret'} )
897
- )
898
  ),
899
  'messages' => array(
900
  'captcha' => array(
@@ -909,7 +909,7 @@ class YOP_Poll_Settings {
909
  'anonymous' => sanitize_text_field( $settings->messages->buttons->{'anonymous'} ),
910
  'wordpress' => sanitize_text_field( $settings->messages->buttons->{'wordpress'} ),
911
  'facebook' => sanitize_text_field( $settings->messages->buttons->{'facebook'} ),
912
- 'google' => sanitize_text_field( $settings->messages->buttons->{'google'} )
913
  ),
914
  'voting' => array(
915
  'poll-ended' => sanitize_text_field( $settings->messages->voting->{'poll-ended'} ),
@@ -926,22 +926,22 @@ class YOP_Poll_Settings {
926
  'not-allowed-by-ban' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ),
927
  'not-allowed-by-block' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ),
928
  'not-allowed-by-limit' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ),
929
- 'thank-you' => sanitize_text_field( $settings->messages->voting->{'thank-you'} )
930
  ),
931
  'results' => array(
932
  'single-vote' => sanitize_text_field( $settings->messages->results->{'single-vote'} ),
933
  'multiple-votes' => sanitize_text_field( $settings->messages->results->{'multiple-votes'} ),
934
  'single-answer' => sanitize_text_field( $settings->messages->results->{'single-answer'} ),
935
- 'multiple-answers' => sanitize_text_field( $settings->messages->results->{'multiple-answers'} )
936
- )
937
- )
938
  );
939
- update_option('yop_poll_settings', serialize( $yop_poll_settings ) );
940
  self::$settings = serialize( $yop_poll_settings );
941
  }
942
  return array(
943
- 'success' => !self::$errors_present,
944
- 'error' => self::$error_text
945
  );
946
  }
947
  }
124
  );
125
  return serialize( $settings );
126
  }
127
+ public static function import_settings_from_5x( $old_settings ) {
128
  $new_settings = array(
129
  'general' => array(
130
  'i-date' => current_time( 'mysql' ),
137
  'from-email' => isset( $old_settings['email_notifications_from_email'] ) ? sanitize_text_field( $old_settings['email_notifications_from_email'] ) : 'Your Email Address Here',
138
  'recipients' => isset( $old_settings['email_notifications_recipients'] ) ? sanitize_text_field( $old_settings['email_notifications_recipients'] ) : '',
139
  'subject' => isset( $old_settings['email_notifications_subject'] ) ? sanitize_text_field( $old_settings['email_notifications_subject'] ) : 'Your Subject Here',
140
+ 'message' => isset( $old_settings['email_notifications_body'] ) ? sanitize_text_field( $old_settings['email_notifications_body'] ) : 'Your Message Here',
141
  ),
142
  'integrations' => array(
143
  'reCaptcha' => array(
144
  'enabled' => 'no',
145
  'site-key' => '',
146
+ 'secret-key' => '',
147
  ),
148
  'reCaptchaV2Invisible' => array(
149
  'enabled' => 'no',
150
  'site-key' => '',
151
+ 'secret-key' => '',
152
  ),
153
  'reCaptchaV3' => array(
154
  'enabled' => 'no',
155
  'site-key' => '',
156
  'secret-key' => '',
157
+ 'min-allowed-score' => '',
158
  ),
159
  'facebook' => array(
160
  'enabled' => isset( $old_settings['facebook_integration'] ) ? sanitize_text_field( $old_settings['facebook_integration'] ) : 'no',
163
  'google' => array(
164
  'enabled' => isset( $old_settings['google_integration'] ) ? sanitize_text_field( $old_settings['google_integration'] ) : 'no',
165
  'app-id' => isset( $old_settings['google_appID'] ) ? sanitize_text_field( $old_settings['google_appID'] ) : '',
166
+ 'app-secret' => isset( $old_settings['google_appSecret'] ) ? sanitize_text_field( $old_settings['google_appSecret'] ) : '',
167
+ ),
168
  ),
169
  'messages' => array(
170
  'captcha' => array(
173
  'accessibility-description' => 'Type below the [STRONG]answer[/STRONG] to what you hear. Numbers or words:',
174
  'explanation' => 'Click or touch the [STRONG]ANSWER[/STRONG]',
175
  'refresh-alt' => 'Refresh/reload icon',
176
+ 'refresh-title' => 'Refresh/reload: get new images and accessibility option!',
177
  ),
178
  'buttons' => array(
179
  'anonymous' => 'Anonymous Vote',
180
  'wordpress' => 'Sign in with WordPress',
181
  'facebook' => 'Sign in with Facebook',
182
+ 'google' => 'Sign in with Google',
183
  ),
184
  'voting' => array(
185
  'poll-ended' => 'This poll is no longer accepting votes',
196
  'not-allowed-by-ban' => 'Vote not allowed',
197
  'not-allowed-by-block' => 'Vote not allowed',
198
  'not-allowed-by-limit' => 'Vote not allowed',
199
+ 'thank-you' => 'Thank you for your vote',
200
  ),
201
  'results' => array(
202
  'single-vote' => 'vote',
203
  'multiple-votes' => 'votes',
204
  'single-answer' => 'answer',
205
+ 'multiple-answers' => 'answers',
206
+ ),
207
+ ),
208
  );
209
  return serialize( $new_settings );
210
  }
221
  }
222
  $new_settings = array(
223
  'general' => array(
224
+ 'i-date' => isset( $current_settings_decoded['general']['idate'] ) ? sanitize_text_field( $current_settings_decoded['general']['idate'] ) : current_time( 'mysql' ),
225
  ),
226
  'email' => array(
227
  'from-name' => isset( $current_settings_decoded['email']['from_name'] ) ? sanitize_text_field( $current_settings_decoded['email']['from_name'] ) : '',
228
  'from-email' => isset( $current_settings_decoded['email']['from_email'] ) ? sanitize_text_field( $current_settings_decoded['email']['from_email'] ) : '',
229
  'recipients' => isset( $current_settings_decoded['email']['recipients'] ) ? sanitize_text_field( $current_settings_decoded['email']['recipients'] ) : '',
230
  'subject' => isset( $current_settings_decoded['email']['subject'] ) ? sanitize_text_field( $current_settings_decoded['email']['subject'] ) : '',
231
+ 'message' => isset( $current_settings_decoded['email']['message'] ) ? sanitize_text_field( $current_settings_decoded['email']['message'] ) : '',
232
  ),
233
  'integrations' => array(
234
  'reCaptcha' => array(
244
  'enabled' => isset( $current_settings_decoded['integrations']['google']['integration'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['integration'] ) : 'no',
245
  'app-id' => isset( $current_settings_decoded['integrations']['google']['app_id'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['app_id'] ) : '',
246
  'app-secret' => isset( $current_settings_decoded['integrations']['google']['app_secret'] ) ? sanitize_text_field( $current_settings_decoded['integrations']['google']['app_secret'] ) : '',
247
+ ),
248
  ),
249
  'messages' => array(
250
  'captcha' => array(
253
  'accessibility-description' => 'Type below the [STRONG]answer[/STRONG] to what you hear. Numbers or words:',
254
  'explanation' => 'Click or touch the [STRONG]ANSWER[/STRONG]',
255
  'refresh-alt' => 'Refresh/reload icon',
256
+ 'refresh-title' => 'Refresh/reload: get new images and accessibility option!',
257
  ),
258
  'buttons' => array(
259
  'anonymous' => 'Anonymous Vote',
260
  'wordpress' => 'Sign in with WordPress',
261
  'facebook' => 'Sign in with Facebook',
262
+ 'google' => 'Sign in with Google',
263
  ),
264
  'voting' => array(
265
  'poll-ended' => 'This poll is no longer accepting votes',
276
  'not-allowed-by-ban' => 'Vote not allowed',
277
  'not-allowed-by-block' => 'Vote not allowed',
278
  'not-allowed-by-limit' => 'Vote not allowed',
279
+ 'thank-you' => 'Thank you for your vote',
280
  ),
281
  'results' => array(
282
  'single-vote' => 'vote',
283
  'multiple-votes' => 'votes',
284
  'single-answer' => 'answer',
285
+ 'multiple-answers' => 'answers',
286
+ ),
287
+ ),
288
  );
289
  update_option( 'yop_poll_settings', serialize( $new_settings ) );
290
  }
300
  'message' => isset( $current_settings['email']['message'] ) ? wp_kses(
301
  $current_settings['email']['message'],
302
  array(
303
+ 'br' => array(),
304
  )
305
  ) : 'There is a new vote for %POLL-NAME%
306
  Here are the details
312
 
313
  [CUSTOM_FIELDS]
314
  %CUSTOM_FIELD_NAME% - %CUSTOM_FIELD_VALUE%
315
+ [/CUSTOM_FIELDS]',
316
  ),
317
  'automatically-reset-votes' => array(
318
  'from-name' => 'Your Name Here',
331
  [OTHER-ANSWERS]
332
  %ANSWER-TEXT% - %ANSWER-VOTES% votes
333
  [/OTHER-ANSWERS]
334
+ [/RESULTS]',
335
+ ),
336
  );
337
  unset( $current_settings['email'] );
338
  update_option( 'yop_poll_settings', serialize( $current_settings ) );
406
  'reCaptcha' => array(
407
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['enabled'] : '',
408
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['site-key'] : '',
409
+ 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptcha'] ) && isset( $unserialized_settings['integrations']['reCaptcha']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptcha']['secret-key'] : '',
410
  ),
411
  'reCaptchaV2Invisible' => array(
412
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['enabled'] : '',
413
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['site-key'] : '',
414
+ 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible'] ) && isset( $unserialized_settings['integrations']['reCaptchaV2Invisible']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV2Invisible']['secret-key'] : '',
415
  ),
416
  'reCaptchaV3' => array(
417
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['enabled'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['enabled'] : '',
418
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['site-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['site-key'] : '',
419
  'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] : '',
420
+ 'min-allowed-score' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['min-allowed-score'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['min-allowed-score'] : '',
421
  ),
422
  'hCaptcha' => array(
423
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['enabled'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['enabled'] : '',
424
  'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['site-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['site-key'] : '',
425
+ 'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['secret-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['secret-key'] : '',
426
  ),
427
  'facebook' => array(
428
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['enabled'] ) ) ? $unserialized_settings['integrations']['facebook']['enabled'] : '',
429
+ 'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['app-id'] ) ) ? $unserialized_settings['integrations']['facebook']['app-id'] : '',
430
  ),
431
  'google' => array(
432
  'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['enabled'] ) ) ? $unserialized_settings['integrations']['google']['enabled'] : '',
433
  'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['app-id'] ) ) ? $unserialized_settings['integrations']['google']['app-id'] : '',
434
+ 'app-secret' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['google'] ) && isset( $unserialized_settings['integrations']['google']['app-secret'] ) ) ? $unserialized_settings['integrations']['google']['app-secret'] : '',
435
+ ),
436
  );
437
  }
438
  return $integrations_settings;
504
  */
505
  if (
506
  ( false === self::$errors_present ) &&
507
+ ( ! isset( $settings->integrations->reCaptcha->{'enabled'} ) ||
508
  ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ) ) )
509
  ) {
510
  self::$errors_present = true;
556
  }
557
  if (
558
  ( false === self::$errors_present ) &&
559
+ ( ! isset( $settings->integrations->facebook->{'enabled'} ) ||
560
  ( '' === sanitize_text_field( $settings->integrations->facebook->{'enabled'} ) ) )
561
  ) {
562
  self::$errors_present = true;
570
  }
571
  if (
572
  ( false === self::$errors_present ) &&
573
+ ( ! isset( $settings->integrations->google->{'enabled'} ) ||
574
  ( '' === trim( $settings->integrations->google->{'enabled'} ) ) )
575
  ) {
576
  self::$errors_present = true;
588
  }
589
  if (
590
  ( false === self::$errors_present ) &&
591
+ ( ! isset( $settings->messages->buttons->{'anonymous'} ) ||
592
  ( '' === sanitize_text_field( $settings->messages->buttons->{'anonymous'} ) ) )
593
  ) {
594
  self::$errors_present = true;
596
  }
597
  if (
598
  ( false === self::$errors_present ) &&
599
+ ( ! isset( $settings->messages->buttons->{'wordpress'} ) ||
600
  ( '' === sanitize_text_field( $settings->messages->buttons->{'wordpress'} ) ) )
601
  ) {
602
  self::$errors_present = true;
604
  }
605
  if (
606
  ( false === self::$errors_present ) &&
607
+ ( ! isset( $settings->messages->buttons->{'facebook'} ) ||
608
  ( '' === sanitize_text_field( $settings->messages->buttons->{'facebook'} ) ) )
609
  ) {
610
  self::$errors_present = true;
612
  }
613
  if (
614
  ( false === self::$errors_present ) &&
615
+ ( ! isset( $settings->messages->buttons->{'google'} ) ||
616
  ( '' === sanitize_text_field( $settings->messages->buttons->{'google'} ) ) )
617
  ) {
618
  self::$errors_present = true;
620
  }
621
  if (
622
  ( false === self::$errors_present ) &&
623
+ ( ! isset( $settings->messages->voting->{'poll-ended'} ) ||
624
  ( '' === sanitize_text_field( $settings->messages->voting->{'poll-ended'} ) ) )
625
  ) {
626
  self::$errors_present = true;
628
  }
629
  if (
630
  ( false === self::$errors_present ) &&
631
+ ( ! isset( $settings->messages->voting->{'poll-not-started'} ) ||
632
  ( '' === sanitize_text_field( $settings->messages->voting->{'poll-not-started'} ) ) )
633
  ) {
634
  self::$errors_present = true;
636
  }
637
  if (
638
  ( false === self::$errors_present ) &&
639
+ ( ! isset( $settings->messages->voting->{'already-voted-on-poll'} ) ||
640
  ( '' === sanitize_text_field( $settings->messages->voting->{'already-voted-on-poll'} ) ) )
641
  ) {
642
  self::$errors_present = true;
644
  }
645
  if (
646
  ( false === self::$errors_present ) &&
647
+ ( ! isset( $settings->messages->voting->{'invalid-poll'} ) ||
648
  ( '' === sanitize_text_field( $settings->messages->voting->{'invalid-poll'} ) ) )
649
  ) {
650
  self::$errors_present = true;
652
  }
653
  if (
654
  ( false === self::$errors_present ) &&
655
+ ( ! isset( $settings->messages->voting->{'no-answers-selected'} ) ||
656
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-answers-selected'} ) ) )
657
  ) {
658
  self::$errors_present = true;
660
  }
661
  if (
662
  ( false === self::$errors_present ) &&
663
+ ( ! isset( $settings->messages->voting->{'min-answers-required'} ) ||
664
  ( '' === sanitize_text_field( $settings->messages->voting->{'min-answers-required'} ) ) )
665
  ) {
666
  self::$errors_present = true;
668
  }
669
  if (
670
  ( false === self::$errors_present ) &&
671
+ ( ! isset( $settings->messages->voting->{'max-answers-required'} ) ||
672
  ( '' === sanitize_text_field( $settings->messages->voting->{'max-answers-required'} ) ) )
673
  ) {
674
  self::$errors_present = true;
676
  }
677
  if (
678
  ( false === self::$errors_present ) &&
679
+ ( ! isset( $settings->messages->voting->{'no-answer-for-other'} ) ||
680
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-answer-for-other'} ) ) )
681
  ) {
682
  self::$errors_present = true;
684
  }
685
  if (
686
  ( false === self::$errors_present ) &&
687
+ ( ! isset( $settings->messages->voting->{'no-value-for-custom-field'} ) ||
688
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-value-for-custom-field'} ) ) )
689
  ) {
690
  self::$errors_present = true;
692
  }
693
  if (
694
  ( false === self::$errors_present ) &&
695
+ ( ! isset( $settings->messages->voting->{'consent-not-checked'} ) ||
696
  ( '' === sanitize_text_field( $settings->messages->voting->{'consent-not-checked'} ) ) )
697
  ) {
698
  self::$errors_present = true;
700
  }
701
  if (
702
  ( false === self::$errors_present ) &&
703
+ ( ! isset( $settings->messages->voting->{'no-captcha-selected'} ) ||
704
  ( '' === sanitize_text_field( $settings->messages->voting->{'no-captcha-selected'} ) ) )
705
  ) {
706
  self::$errors_present = true;
708
  }
709
  if (
710
  ( false === self::$errors_present ) &&
711
+ ( ! isset( $settings->messages->voting->{'not-allowed-by-ban'} ) ||
712
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ) ) )
713
  ) {
714
  self::$errors_present = true;
716
  }
717
  if (
718
  ( false === self::$errors_present ) &&
719
+ ( ! isset( $settings->messages->voting->{'not-allowed-by-block'} ) ||
720
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ) ) )
721
  ) {
722
  self::$errors_present = true;
724
  }
725
  if (
726
  ( false === self::$errors_present ) &&
727
+ ( ! isset( $settings->messages->voting->{'not-allowed-by-limit'} ) ||
728
  ( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ) ) )
729
  ) {
730
  self::$errors_present = true;
732
  }
733
  if (
734
  ( false === self::$errors_present ) &&
735
+ ( ! isset( $settings->messages->voting->{'thank-you'} ) ||
736
  ( '' === sanitize_text_field( $settings->messages->voting->{'thank-you'} ) ) )
737
  ) {
738
  self::$errors_present = true;
740
  }
741
  if (
742
  ( false === self::$errors_present ) &&
743
+ ( ! isset( $settings->messages->results->{'single-vote'} ) ||
744
  ( '' === sanitize_text_field( $settings->messages->results->{'single-vote'} ) ) )
745
  ) {
746
  self::$errors_present = true;
748
  }
749
  if (
750
  ( false === self::$errors_present ) &&
751
+ ( ! isset( $settings->messages->results->{'multiple-votes'} ) ||
752
  ( '' === sanitize_text_field( $settings->messages->results->{'multiple-votes'} ) ) )
753
  ) {
754
  self::$errors_present = true;
756
  }
757
  if (
758
  ( false === self::$errors_present ) &&
759
+ ( ! isset( $settings->messages->results->{'single-answer'} ) ||
760
  ( '' === sanitize_text_field( $settings->messages->results->{'single-answer'} ) ) )
761
  ) {
762
  self::$errors_present = true;
764
  }
765
  if (
766
  ( false === self::$errors_present ) &&
767
+ ( ! isset( $settings->messages->results->{'multiple-answers'} ) ||
768
  ( '' === sanitize_text_field( $settings->messages->results->{'multiple-answers'} ) ) )
769
  ) {
770
  self::$errors_present = true;
772
  }
773
  if (
774
  ( false === self::$errors_present ) &&
775
+ ( ! isset( $settings->messages->captcha->{'accessibility-alt'} ) ||
776
+ ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-alt'} ) ) )
777
  ) {
778
  self::$errors_present = true;
779
  self::$error_text = esc_html__( 'Data for "Accessibility Alt" is invalid', 'yop-poll' );
780
  }
781
  if (
782
  ( false === self::$errors_present ) &&
783
+ ( ! isset( $settings->messages->captcha->{'accessibility-title'} ) ||
784
  ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-title'} ) ) )
785
  ) {
786
  self::$errors_present = true;
788
  }
789
  if (
790
  ( false === self::$errors_present ) &&
791
+ ( ! isset( $settings->messages->captcha->{'accessibility-description'} ) ||
792
  ( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-description'} ) ) )
793
  ) {
794
  self::$errors_present = true;
796
  }
797
  if (
798
  ( false === self::$errors_present ) &&
799
+ ( ! isset( $settings->messages->captcha->{'explanation'} ) ||
800
  ( '' === sanitize_text_field( $settings->messages->captcha->{'explanation'} ) ) )
801
  ) {
802
  self::$errors_present = true;
804
  }
805
  if (
806
  ( false === self::$errors_present ) &&
807
+ ( ! isset( $settings->messages->captcha->{'refresh-alt'} ) ||
808
  ( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ) ) )
809
  ) {
810
  self::$errors_present = true;
812
  }
813
  if (
814
  ( false === self::$errors_present ) &&
815
+ ( ! isset( $settings->messages->captcha->{'refresh-title'} ) ||
816
  ( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ) ) )
817
  ) {
818
  self::$errors_present = true;
840
  'message' => wp_kses(
841
  $settings->notifications->{'new-vote'}->{'message'},
842
  array(
843
+ 'br' => array(),
844
  )
845
+ ),
846
  ),
847
  'automatically-reset-votes' => array(
848
  'from-name' => 'Your Name Here',
861
  [OTHER-ANSWERS]
862
  %ANSWER-TEXT% - %ANSWER-VOTES% votes
863
  [/OTHER-ANSWERS]
864
+ [/RESULTS]',
865
+ ),
866
  ),
867
  'integrations' => array(
868
  'reCaptcha' => array(
869
  'enabled' => sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ),
870
  'site-key' => sanitize_text_field( $settings->integrations->reCaptcha->{'site-key'} ),
871
+ 'secret-key' => sanitize_text_field( $settings->integrations->reCaptcha->{'secret-key'} ),
872
  ),
873
  'reCaptchaV2Invisible' => array(
874
  'enabled' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'enabled'} ),
875
  'site-key' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ),
876
+ 'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} ),
877
  ),
878
  'reCaptchaV3' => array(
879
  'enabled' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'enabled'} ),
880
  'site-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'site-key'} ),
881
  'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ),
882
+ 'min-allowed-score' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} ),
883
  ),
884
  'hCaptcha' => array(
885
  'enabled' => sanitize_text_field( $settings->integrations->hCaptcha->{'enabled'} ),
886
  'site-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'site-key'} ),
887
+ 'secret-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'secret-key'} ),
888
  ),
889
  'facebook' => array(
890
  'enabled' => sanitize_text_field( $settings->integrations->facebook->{'enabled'} ),
893
  'google' => array(
894
  'enabled' => sanitize_text_field( $settings->integrations->google->{'enabled'} ),
895
  'app-id' => sanitize_text_field( $settings->integrations->google->{'app-id'} ),
896
+ 'app-secret' => sanitize_text_field( $settings->integrations->google->{'app-secret'} ),
897
+ ),
898
  ),
899
  'messages' => array(
900
  'captcha' => array(
909
  'anonymous' => sanitize_text_field( $settings->messages->buttons->{'anonymous'} ),
910
  'wordpress' => sanitize_text_field( $settings->messages->buttons->{'wordpress'} ),
911
  'facebook' => sanitize_text_field( $settings->messages->buttons->{'facebook'} ),
912
+ 'google' => sanitize_text_field( $settings->messages->buttons->{'google'} ),
913
  ),
914
  'voting' => array(
915
  'poll-ended' => sanitize_text_field( $settings->messages->voting->{'poll-ended'} ),
926
  'not-allowed-by-ban' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ),
927
  'not-allowed-by-block' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ),
928
  'not-allowed-by-limit' => sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ),
929
+ 'thank-you' => sanitize_text_field( $settings->messages->voting->{'thank-you'} ),
930
  ),
931
  'results' => array(
932
  'single-vote' => sanitize_text_field( $settings->messages->results->{'single-vote'} ),
933
  'multiple-votes' => sanitize_text_field( $settings->messages->results->{'multiple-votes'} ),
934
  'single-answer' => sanitize_text_field( $settings->messages->results->{'single-answer'} ),
935
+ 'multiple-answers' => sanitize_text_field( $settings->messages->results->{'multiple-answers'} ),
936
+ ),
937
+ ),
938
  );
939
+ update_option( 'yop_poll_settings', serialize( $yop_poll_settings ) );
940
  self::$settings = serialize( $yop_poll_settings );
941
  }
942
  return array(
943
+ 'success' => ! self::$errors_present,
944
+ 'error' => self::$error_text,
945
  );
946
  }
947
  }
admin/models/subelements.php CHANGED
@@ -22,7 +22,7 @@ class YOP_POLL_SubElements {
22
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
23
  'total_submits' => $sub_element->total_submits,
24
  'added_date' => current_time( 'mysql' ),
25
- 'modified_date' => current_time( 'mysql' )
26
  );
27
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_subelements, $data );
28
  }
@@ -43,7 +43,7 @@ class YOP_POLL_SubElements {
43
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
44
  'total_submits' => '0',
45
  'added_date' => current_time( 'mysql' ),
46
- 'modified_date' => current_time( 'mysql' )
47
  );
48
  if ( $is_imported ) {
49
  $data['id'] = $sub_element->ID;
@@ -60,14 +60,14 @@ class YOP_POLL_SubElements {
60
  }
61
  return array(
62
  'errors_present' => self::$errors_present,
63
- 'error_text' => self::$error_text
64
  );
65
  }
66
  public static function update( $poll_id, $element_id, $sub_elements ) {
67
  $display_order = 1;
68
  $query_result_error = false;
69
  $current_user = wp_get_current_user();
70
- $new_subElements = [];
71
  $i = 0;
72
  foreach ( $sub_elements as $sub_element ) {
73
  if ( false === self::$errors_present ) {
@@ -80,11 +80,12 @@ class YOP_POLL_SubElements {
80
  'status' => 'active',
81
  'sorder' => $display_order,
82
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
83
- 'modified_date' => current_time( 'mysql' )
84
  );
85
  if ( isset( $sub_element->id ) && ( '' !== $sub_element->id ) ) {
86
  $query_result_error = $GLOBALS['wpdb']->update(
87
- $GLOBALS['wpdb']->yop_poll_subelements, $data,
 
88
  array( 'id' => $sub_element->id )
89
  );
90
  } else {
@@ -105,14 +106,14 @@ class YOP_POLL_SubElements {
105
  return array(
106
  'errors_present' => self::$errors_present,
107
  'error_text' => self::$error_text,
108
- 'new_subelements' => $new_subElements
109
  );
110
  }
111
  public static function delete( $poll_id, $element_id, $sub_element_id ) {
112
  if ( 0 < intval( $sub_element_id ) ) {
113
  $data = array(
114
  'status' => 'deleted',
115
- 'sorder' => '0'
116
  );
117
  $delete_result = $GLOBALS['wpdb']->update(
118
  $GLOBALS['wpdb']->yop_poll_subelements,
@@ -120,7 +121,7 @@ class YOP_POLL_SubElements {
120
  array(
121
  'id' => $sub_element_id,
122
  'poll_id' => $poll_id,
123
- 'element_id' => $element_id
124
  )
125
  );
126
  if ( false === $delete_result ) {
@@ -133,19 +134,19 @@ class YOP_POLL_SubElements {
133
  }
134
  return array(
135
  'errors_present' => self::$errors_present,
136
- 'error_text' => self::$error_text
137
  );
138
  }
139
  public static function delete_all_for_poll( $poll_id ) {
140
  $data = array(
141
  'status' => 'deleted',
142
- 'sorder' => '0'
143
  );
144
  $delete_result = $GLOBALS['wpdb']->update(
145
  $GLOBALS['wpdb']->yop_poll_subelements,
146
  $data,
147
  array(
148
- 'poll_id' => $poll_id
149
  )
150
  );
151
  if ( false !== $delete_result ) {
@@ -156,20 +157,20 @@ class YOP_POLL_SubElements {
156
  }
157
  return array(
158
  'errors_present' => self::$errors_present,
159
- 'error_text' => self::$error_text
160
  );
161
  }
162
  public static function delete_all_for_element( $poll_id, $element_id ) {
163
  $data = array(
164
  'status' => 'deleted',
165
- 'sorder' => '0'
166
  );
167
  $delete_result = $GLOBALS['wpdb']->update(
168
  $GLOBALS['wpdb']->yop_poll_subelements,
169
  $data,
170
  array(
171
  'poll_id' => $poll_id,
172
- 'element_id' => $element_id
173
  )
174
  );
175
  if ( false !== $delete_result ) {
@@ -180,7 +181,7 @@ class YOP_POLL_SubElements {
180
  }
181
  return array(
182
  'errors_present' => self::$errors_present,
183
- 'error_text' => self::$error_text
184
  );
185
  }
186
  public static function create_meta_data( $sub_element ) {
@@ -191,7 +192,7 @@ class YOP_POLL_SubElements {
191
  'makeDefault' => sanitize_text_field( $sub_element->options->makeDefault ),
192
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
193
  'link' => sanitize_text_field( $sub_element->options->link ),
194
- 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor )
195
  );
196
  break;
197
  }
@@ -201,7 +202,7 @@ class YOP_POLL_SubElements {
201
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
202
  'addText' => sanitize_text_field( $sub_element->options->addText ),
203
  'text' => sanitize_text_field( $sub_element->options->text ),
204
- 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor )
205
  );
206
  break;
207
  }
@@ -211,7 +212,7 @@ class YOP_POLL_SubElements {
211
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
212
  'addText' => sanitize_text_field( $sub_element->options->addText ),
213
  'text' => sanitize_text_field( $sub_element->options->text ),
214
- 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor )
215
  );
216
  break;
217
  }
@@ -273,7 +274,9 @@ class YOP_POLL_SubElements {
273
  public static function clone_all( $old_poll_id, $new_poll_id, $old_element_id, $new_element_id ) {
274
  $current_user = wp_get_current_user();
275
  $query = $GLOBALS['wpdb']->prepare(
276
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_subelements} WHERE `poll_id` = %s and `element_id`=%s", $old_poll_id, $old_element_id
 
 
277
  );
278
  $sub_elements = $GLOBALS['wpdb']->get_results( $query, OBJECT );
279
  if ( null !== $sub_elements ) {
@@ -289,7 +292,7 @@ class YOP_POLL_SubElements {
289
  'meta_data' => $sub_element->meta_data,
290
  'total_submits' => '0',
291
  'added_date' => current_time( 'mysql' ),
292
- 'modified_date' => current_time( 'mysql' )
293
  );
294
  if ( false === $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_subelements, $data ) ) {
295
  self::$errors_present = true;
@@ -299,7 +302,7 @@ class YOP_POLL_SubElements {
299
  }
300
  return array(
301
  'errors_present' => self::$errors_present,
302
- 'error_text' => self::$error_text
303
  );
304
  }
305
  public static function validate_order_by( $order_by ) {
@@ -345,7 +348,9 @@ class YOP_POLL_SubElements {
345
  public static function get_max_display( $poll_id, $element_id ) {
346
  $query = $GLOBALS['wpdb']->prepare(
347
  "SELECT MAX(`sorder`) FROM {$GLOBALS['wpdb']->yop_poll_subelements} "
348
- . ' WHERE `poll_id` = %s AND `element_id` = %s', $poll_id, $element_id
 
 
349
  );
350
  $max_display = $GLOBALS['wpdb']->get_var( $query );
351
  return ( null === $max_display ) ? 0 : intval( $max_display );
@@ -355,7 +360,10 @@ class YOP_POLL_SubElements {
355
  $query = $GLOBALS['wpdb']->prepare(
356
  "SELECT * from {$GLOBALS['wpdb']->yop_poll_subelements} "
357
  . 'WHERE `poll_id` = %s AND `element_id` = %s '
358
- . "AND LOWER( `stext` ) = %s AND `status` = 'active'", $poll_id, $element_id, strtolower( $stext )
 
 
 
359
  );
360
  $sub_element = $GLOBALS['wpdb']->get_row( $query );
361
  if ( null === $sub_element ) {
@@ -369,7 +377,8 @@ class YOP_POLL_SubElements {
369
  public static function add_vote( $sub_element_id ) {
370
  $query = $GLOBALS['wpdb']->prepare(
371
  "UPDATE {$GLOBALS['wpdb']->yop_poll_subelements} SET `total_submits` = `total_submits` + 1 "
372
- . 'WHERE `id` = %s', $sub_element_id
 
373
  );
374
  $GLOBALS['wpdb']->query( $query );
375
  }
@@ -399,21 +408,22 @@ class YOP_POLL_SubElements {
399
  }
400
  public static function reset_submits_for_poll( $poll_id ) {
401
  $query = $GLOBALS['wpdb']->prepare(
402
- "UPDATE {$GLOBALS['wpdb']->yop_poll_subelements} SET `total_submits` = '0' WHERE `poll_id` = %s", $poll_id
 
403
  );
404
  $GLOBALS['wpdb']->query( $query );
405
  }
406
  public static function delete_others_for_poll( $poll_id ) {
407
  $data = array(
408
  'status' => 'deleted',
409
- 'sorder' => '0'
410
  );
411
  $delete_result = $GLOBALS['wpdb']->update(
412
  $GLOBALS['wpdb']->yop_poll_subelements,
413
  $data,
414
  array(
415
  'poll_id' => $poll_id,
416
- 'author' => 0
417
  )
418
  );
419
  if ( false !== $delete_result ) {
@@ -424,7 +434,7 @@ class YOP_POLL_SubElements {
424
  }
425
  return array(
426
  'errors_present' => self::$errors_present,
427
- 'error_text' => self::$error_text
428
  );
429
  }
430
  }
22
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
23
  'total_submits' => $sub_element->total_submits,
24
  'added_date' => current_time( 'mysql' ),
25
+ 'modified_date' => current_time( 'mysql' ),
26
  );
27
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_subelements, $data );
28
  }
43
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
44
  'total_submits' => '0',
45
  'added_date' => current_time( 'mysql' ),
46
+ 'modified_date' => current_time( 'mysql' ),
47
  );
48
  if ( $is_imported ) {
49
  $data['id'] = $sub_element->ID;
60
  }
61
  return array(
62
  'errors_present' => self::$errors_present,
63
+ 'error_text' => self::$error_text,
64
  );
65
  }
66
  public static function update( $poll_id, $element_id, $sub_elements ) {
67
  $display_order = 1;
68
  $query_result_error = false;
69
  $current_user = wp_get_current_user();
70
+ $new_subElements = array();
71
  $i = 0;
72
  foreach ( $sub_elements as $sub_element ) {
73
  if ( false === self::$errors_present ) {
80
  'status' => 'active',
81
  'sorder' => $display_order,
82
  'meta_data' => serialize( self::create_meta_data( $sub_element ) ),
83
+ 'modified_date' => current_time( 'mysql' ),
84
  );
85
  if ( isset( $sub_element->id ) && ( '' !== $sub_element->id ) ) {
86
  $query_result_error = $GLOBALS['wpdb']->update(
87
+ $GLOBALS['wpdb']->yop_poll_subelements,
88
+ $data,
89
  array( 'id' => $sub_element->id )
90
  );
91
  } else {
106
  return array(
107
  'errors_present' => self::$errors_present,
108
  'error_text' => self::$error_text,
109
+ 'new_subelements' => $new_subElements,
110
  );
111
  }
112
  public static function delete( $poll_id, $element_id, $sub_element_id ) {
113
  if ( 0 < intval( $sub_element_id ) ) {
114
  $data = array(
115
  'status' => 'deleted',
116
+ 'sorder' => '0',
117
  );
118
  $delete_result = $GLOBALS['wpdb']->update(
119
  $GLOBALS['wpdb']->yop_poll_subelements,
121
  array(
122
  'id' => $sub_element_id,
123
  'poll_id' => $poll_id,
124
+ 'element_id' => $element_id,
125
  )
126
  );
127
  if ( false === $delete_result ) {
134
  }
135
  return array(
136
  'errors_present' => self::$errors_present,
137
+ 'error_text' => self::$error_text,
138
  );
139
  }
140
  public static function delete_all_for_poll( $poll_id ) {
141
  $data = array(
142
  'status' => 'deleted',
143
+ 'sorder' => '0',
144
  );
145
  $delete_result = $GLOBALS['wpdb']->update(
146
  $GLOBALS['wpdb']->yop_poll_subelements,
147
  $data,
148
  array(
149
+ 'poll_id' => $poll_id,
150
  )
151
  );
152
  if ( false !== $delete_result ) {
157
  }
158
  return array(
159
  'errors_present' => self::$errors_present,
160
+ 'error_text' => self::$error_text,
161
  );
162
  }
163
  public static function delete_all_for_element( $poll_id, $element_id ) {
164
  $data = array(
165
  'status' => 'deleted',
166
+ 'sorder' => '0',
167
  );
168
  $delete_result = $GLOBALS['wpdb']->update(
169
  $GLOBALS['wpdb']->yop_poll_subelements,
170
  $data,
171
  array(
172
  'poll_id' => $poll_id,
173
+ 'element_id' => $element_id,
174
  )
175
  );
176
  if ( false !== $delete_result ) {
181
  }
182
  return array(
183
  'errors_present' => self::$errors_present,
184
+ 'error_text' => self::$error_text,
185
  );
186
  }
187
  public static function create_meta_data( $sub_element ) {
192
  'makeDefault' => sanitize_text_field( $sub_element->options->makeDefault ),
193
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
194
  'link' => sanitize_text_field( $sub_element->options->link ),
195
+ 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor ),
196
  );
197
  break;
198
  }
202
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
203
  'addText' => sanitize_text_field( $sub_element->options->addText ),
204
  'text' => sanitize_text_field( $sub_element->options->text ),
205
+ 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor ),
206
  );
207
  break;
208
  }
212
  'makeLink' => sanitize_text_field( $sub_element->options->makeLink ),
213
  'addText' => sanitize_text_field( $sub_element->options->addText ),
214
  'text' => sanitize_text_field( $sub_element->options->text ),
215
+ 'resultsColor' => sanitize_text_field( $sub_element->options->resultsColor ),
216
  );
217
  break;
218
  }
274
  public static function clone_all( $old_poll_id, $new_poll_id, $old_element_id, $new_element_id ) {
275
  $current_user = wp_get_current_user();
276
  $query = $GLOBALS['wpdb']->prepare(
277
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_subelements} WHERE `poll_id` = %s and `element_id`=%s",
278
+ $old_poll_id,
279
+ $old_element_id
280
  );
281
  $sub_elements = $GLOBALS['wpdb']->get_results( $query, OBJECT );
282
  if ( null !== $sub_elements ) {
292
  'meta_data' => $sub_element->meta_data,
293
  'total_submits' => '0',
294
  'added_date' => current_time( 'mysql' ),
295
+ 'modified_date' => current_time( 'mysql' ),
296
  );
297
  if ( false === $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_subelements, $data ) ) {
298
  self::$errors_present = true;
302
  }
303
  return array(
304
  'errors_present' => self::$errors_present,
305
+ 'error_text' => self::$error_text,
306
  );
307
  }
308
  public static function validate_order_by( $order_by ) {
348
  public static function get_max_display( $poll_id, $element_id ) {
349
  $query = $GLOBALS['wpdb']->prepare(
350
  "SELECT MAX(`sorder`) FROM {$GLOBALS['wpdb']->yop_poll_subelements} "
351
+ . ' WHERE `poll_id` = %s AND `element_id` = %s',
352
+ $poll_id,
353
+ $element_id
354
  );
355
  $max_display = $GLOBALS['wpdb']->get_var( $query );
356
  return ( null === $max_display ) ? 0 : intval( $max_display );
360
  $query = $GLOBALS['wpdb']->prepare(
361
  "SELECT * from {$GLOBALS['wpdb']->yop_poll_subelements} "
362
  . 'WHERE `poll_id` = %s AND `element_id` = %s '
363
+ . "AND LOWER( `stext` ) = %s AND `status` = 'active'",
364
+ $poll_id,
365
+ $element_id,
366
+ strtolower( $stext )
367
  );
368
  $sub_element = $GLOBALS['wpdb']->get_row( $query );
369
  if ( null === $sub_element ) {
377
  public static function add_vote( $sub_element_id ) {
378
  $query = $GLOBALS['wpdb']->prepare(
379
  "UPDATE {$GLOBALS['wpdb']->yop_poll_subelements} SET `total_submits` = `total_submits` + 1 "
380
+ . 'WHERE `id` = %s',
381
+ $sub_element_id
382
  );
383
  $GLOBALS['wpdb']->query( $query );
384
  }
408
  }
409
  public static function reset_submits_for_poll( $poll_id ) {
410
  $query = $GLOBALS['wpdb']->prepare(
411
+ "UPDATE {$GLOBALS['wpdb']->yop_poll_subelements} SET `total_submits` = '0' WHERE `poll_id` = %s",
412
+ $poll_id
413
  );
414
  $GLOBALS['wpdb']->query( $query );
415
  }
416
  public static function delete_others_for_poll( $poll_id ) {
417
  $data = array(
418
  'status' => 'deleted',
419
+ 'sorder' => '0',
420
  );
421
  $delete_result = $GLOBALS['wpdb']->update(
422
  $GLOBALS['wpdb']->yop_poll_subelements,
423
  $data,
424
  array(
425
  'poll_id' => $poll_id,
426
+ 'author' => 0,
427
  )
428
  );
429
  if ( false !== $delete_result ) {
434
  }
435
  return array(
436
  'errors_present' => self::$errors_present,
437
+ 'error_text' => self::$error_text,
438
  );
439
  }
440
  }
admin/models/votes.php CHANGED
@@ -58,7 +58,7 @@ class YOP_Poll_Votes {
58
  self::validate_hcaptcha( $vote, $poll );
59
  }
60
  if ( false === self::$errors_present ) {
61
- if ( 'yes' === $poll->meta_data['options']['poll']['enableGdpr'] ) {
62
  switch ( $poll->meta_data['options']['poll']['gdprSolution'] ) {
63
  case 'consent': {
64
  $vote->user->c_data = self::get_voter_cookie( $vote->pollId );
@@ -659,7 +659,7 @@ class YOP_Poll_Votes {
659
  $element_data,
660
  array(
661
  'id' => $data->id,
662
- 'data' => sanitize_text_field( $data->data )
663
  )
664
  );
665
  } else {
@@ -667,7 +667,7 @@ class YOP_Poll_Votes {
667
  $element_data,
668
  array(
669
  'id' => $data->id,
670
- 'data' => sanitize_text_field( $data->data )
671
  )
672
  );
673
  }
@@ -690,7 +690,7 @@ class YOP_Poll_Votes {
690
  array(
691
  'id' => $element->id,
692
  'type' => $element->type,
693
- 'data' => $element_data
694
  )
695
  );
696
  }
@@ -698,7 +698,7 @@ class YOP_Poll_Votes {
698
  'elements' => $vote_elements,
699
  'user' => array(
700
  'first_name' => $vote->user->first_name,
701
- 'last_name' => $vote->user->last_name
702
  ),
703
  'meta_data' => array(
704
  'page_id' => isset( $vote->pageId ) ? $vote->pageId : '',
@@ -738,21 +738,21 @@ class YOP_Poll_Votes {
738
  ( true === array_key_exists( 'X-Forwarded-For', $headers ) ) &&
739
  filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP )
740
  ) {
741
- $voter_ip = $headers['X-Forwarded-For'];
742
  } elseif (
743
  ( true === array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) ) &&
744
  filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP )
745
  ) {
746
- $voter_ip = $headers['HTTP_X_FORWARDED_FOR'];
747
  } else {
748
  $voter_ip = filter_var(
749
- isset( $_SERVER['REMOTE_ADDR'] ) ? wp_unslash( $_SERVER['REMOTE_ADDR'] ) : '',
750
  FILTER_VALIDATE_IP
751
  );
752
  }
753
  } else {
754
  $voter_ip = filter_var(
755
- isset( $_SERVER['REMOTE_ADDR'] ) ? wp_unslash( $_SERVER['REMOTE_ADDR'] ) : '',
756
  FILTER_VALIDATE_IP
757
  );
758
  }
@@ -789,7 +789,7 @@ class YOP_Poll_Votes {
789
  'voter_fingerprint' => $vote->user->f_data,
790
  'vote_data' => serialize( self::create_meta_data( $vote ) ),
791
  'status' => 'active',
792
- 'added_date' => $vote->added_date
793
  );
794
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_votes, $data );
795
  $vote_id = $GLOBALS['wpdb']->insert_id;
@@ -894,7 +894,7 @@ class YOP_Poll_Votes {
894
  }
895
  $elements_code[] = array(
896
  'id' => $element->id,
897
- 'code' => $element_html
898
  );
899
  }
900
  if ( ( 'yes' === $element->meta_data['allowOtherAnswers'] ) && ( 'yes' === $element->meta_data['displayOtherAnswersInResults'] ) ) {
@@ -904,13 +904,13 @@ class YOP_Poll_Votes {
904
  foreach ( $element_others as $other_answer ) {
905
  $element_others_processed[] = array(
906
  'an' => esc_html( $other_answer->answer ),
907
- 'vn' => $other_answer->total_submits
908
  );
909
  }
910
  }
911
  $elements_other_answers[] = array(
912
  'id' => $element->id,
913
- 'others' => json_encode( $element_others_processed )
914
  );
915
  }
916
  }
@@ -926,7 +926,7 @@ class YOP_Poll_Votes {
926
  'rebuild' => $rebuild_elements,
927
  'elements' => json_encode( $elements_code ),
928
  'others' => json_encode( $elements_other_answers ),
929
- 'results' => json_encode( $poll_results )
930
  );
931
  return $response;
932
  }
@@ -968,7 +968,7 @@ class YOP_Poll_Votes {
968
  }
969
  $result_data['questions'][] = array(
970
  'text' => $poll_element->etext,
971
- 'answers' => $answers
972
  );
973
  break;
974
  }
@@ -979,7 +979,7 @@ class YOP_Poll_Votes {
979
  return $result_data;
980
  }
981
  public static function send_email_notification( $vote, $poll ) {
982
- $email_to = [];
983
  $email_to_string = isset( $poll->meta_data['options']['poll']['emailNotificationsRecipients'] ) ?
984
  $poll->meta_data['options']['poll']['emailNotificationsRecipients'] : '';
985
  $recipients_array = explode( ',', $email_to_string );
@@ -1006,7 +1006,7 @@ class YOP_Poll_Votes {
1006
  $poll->meta_data['options']['poll']['emailNotificationsFromEmail'] : '';
1007
  $email_headers = array(
1008
  'From: ' . $email_from_name . ' <' . $email_from_email . '>',
1009
- 'Content-Type: text/plain'
1010
  );
1011
  /* BEGIN Email-Subject*/
1012
  $email_subject = str_replace( '%VOTE-DATE%', date_i18n( get_option( 'date_format' ), strtotime( $vote->added_date ) ), $email_subject );
@@ -1052,7 +1052,7 @@ class YOP_Poll_Votes {
1052
  '[QUESTION]',
1053
  '[/QUESTION]',
1054
  '[ANSWERS]',
1055
- '[/ANSWERS]'
1056
  ),
1057
  array(
1058
  '',
@@ -1071,7 +1071,7 @@ class YOP_Poll_Votes {
1071
  '[ANSWERS]',
1072
  '[/ANSWERS]',
1073
  '[CUSTOM_FIELDS]',
1074
- '[/CUSTOM_FIELDS]'
1075
  ),
1076
  array(
1077
  '',
@@ -1092,7 +1092,7 @@ class YOP_Poll_Votes {
1092
  return $votes;
1093
  }
1094
  public static function get_total_votes_by_poll( $poll_id ) {
1095
- $query = $query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `poll_id` = %d AND `status` = 'active'";
1096
  $votes_no = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( $query, $poll_id ) );
1097
  return $votes_no;
1098
  }
@@ -1109,7 +1109,7 @@ class YOP_Poll_Votes {
1109
  if ( $params['page_no'] > $pagination['total_pages'] ) {
1110
  $params['page_no'] = 1;
1111
  }
1112
- if ( !in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
1113
  $params['sort_order'] = SORT_ASC;
1114
  } elseif ( 'desc' === $params['sort_order'] ) {
1115
  $params['sort_order'] = SORT_DESC;
@@ -1117,7 +1117,7 @@ class YOP_Poll_Votes {
1117
  $params['sort_order'] = SORT_ASC;
1118
  }
1119
  if ( ( true === isset( $params['order_by'] ) ) && ( '' != $params['order_by'] ) ) {
1120
- if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
1121
  $params['order_by'] = 'id';
1122
  }
1123
  } else {
@@ -1126,7 +1126,7 @@ class YOP_Poll_Votes {
1126
  $limit = self::$votes_per_page * ( $params['page_no'] - 1 );
1127
  $limit_query = " LIMIT {$limit}, " . self::$votes_per_page;
1128
  $query = '';
1129
- $votes = [];
1130
  if ( current_user_can( 'yop_poll_results_others' ) ) {
1131
  $query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `poll_id` = %d AND `status` = 'active'";
1132
  $query = $GLOBALS['wpdb']->prepare(
@@ -1194,7 +1194,7 @@ class YOP_Poll_Votes {
1194
  'votes' => $votes,
1195
  'total_votes' => $pagination['total_votes'],
1196
  'total_pages' => $pagination['total_pages'],
1197
- 'pagination' => $pagination['pagination']
1198
  );
1199
  }
1200
  public static function paginate( $params ) {
@@ -1278,7 +1278,7 @@ class YOP_Poll_Votes {
1278
  'order_by' => $params['order_by'],
1279
  'sort_order' => $params['sort_order'],
1280
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1281
- 'page_no' => $params['page_no'] + 1
1282
  )
1283
  )
1284
  );
@@ -1295,7 +1295,7 @@ class YOP_Poll_Votes {
1295
  'order_by' => $params['order_by'],
1296
  'sort_order' => $params['sort_order'],
1297
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1298
- 'page_no' => intval( $total_pages )
1299
  )
1300
  )
1301
  );
@@ -1314,7 +1314,7 @@ class YOP_Poll_Votes {
1314
  'order_by' => $params['order_by'],
1315
  'sort_order' => $params['sort_order'],
1316
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1317
- 'page_no' => $params['page_no'] - 1
1318
  )
1319
  )
1320
  );
@@ -1331,7 +1331,7 @@ class YOP_Poll_Votes {
1331
  'order_by' => $params['order_by'],
1332
  'sort_order' => $params['sort_order'],
1333
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1334
- 'page_no' => 1
1335
  )
1336
  )
1337
  );
@@ -1350,7 +1350,7 @@ class YOP_Poll_Votes {
1350
  'order_by' => $params['order_by'],
1351
  'sort_order' => $params['sort_order'],
1352
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1353
- 'page_no' => $params['page_no'] - 1
1354
  )
1355
  )
1356
  );
@@ -1363,7 +1363,7 @@ class YOP_Poll_Votes {
1363
  'order_by' => $params['order_by'],
1364
  'sort_order' => $params['sort_order'],
1365
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1366
- 'page_no' => $params['page_no'] + 1
1367
  )
1368
  )
1369
  );
@@ -1383,7 +1383,7 @@ class YOP_Poll_Votes {
1383
  'order_by' => false,
1384
  'sort_order' => false,
1385
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1386
- 'page_no' => 1
1387
  )
1388
  )
1389
  );
@@ -1401,7 +1401,7 @@ class YOP_Poll_Votes {
1401
  'order_by' => false,
1402
  'sort_order' => false,
1403
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1404
- 'page_no' => intval( $total_pages )
1405
  )
1406
  )
1407
  );
@@ -1419,12 +1419,13 @@ class YOP_Poll_Votes {
1419
  return array(
1420
  'total_votes' => $total_votes,
1421
  'total_pages' => $total_pages,
1422
- 'pagination' => $pagination
1423
  );
1424
  }
1425
  public static function get_vote_details( $vote_id ) {
1426
  $query = $GLOBALS['wpdb']->prepare(
1427
- "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `id` = %d", $vote_id
 
1428
  );
1429
  $vote = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1430
  if ( null !== $vote ) {
@@ -1432,14 +1433,14 @@ class YOP_Poll_Votes {
1432
  if ( count( $vote_data ) > 0 ) {
1433
  if ( isset( $vote_data['elements'] ) ) {
1434
  $vote_elements = $vote_data['elements'];
1435
- $questions = [];
1436
- $questions_ids = [];
1437
- $answers_ids = [];
1438
- $questions_results = [];
1439
- $answers_results = [];
1440
  if ( count( $vote_elements ) > 0 ) {
1441
  foreach ( $vote_elements as $ve ) {
1442
- $qanswers = [];
1443
  if ( isset( $ve['id'] ) ) {
1444
  $questions_ids[] = $ve['id'];
1445
  }
@@ -1454,9 +1455,12 @@ class YOP_Poll_Votes {
1454
  }
1455
  }
1456
  if ( count( $questions_ids ) > 0 ) {
1457
- $question_ids_escaped = array_map( function( $question_id ) {
1458
- return "'" . esc_sql( $question_id ) . "'";
1459
- }, $questions_ids );
 
 
 
1460
  $questions_ids_string = '(' . implode( ',', $question_ids_escaped ) . ')';
1461
  $questions_query = "SELECT * from {$GLOBALS['wpdb']->yop_poll_elements} where `id` IN $questions_ids_string";
1462
  $questions_results = $GLOBALS['wpdb']->get_results( $questions_query, OBJECT );
@@ -1473,7 +1477,10 @@ class YOP_Poll_Votes {
1473
  $answers_results = $GLOBALS['wpdb']->get_results( $answers_query, OBJECT );
1474
  }
1475
  foreach ( $vote_elements as $ve ) {
1476
- $pqa = [ 'question' => '', 'answers' => [] ];
 
 
 
1477
  switch ( $ve['type'] ) {
1478
  case 'question': {
1479
  if ( isset( $ve['id'] ) ) {
@@ -1486,11 +1493,17 @@ class YOP_Poll_Votes {
1486
  if ( isset( $ve['data'] ) ) {
1487
  foreach ( $ve['data'] as $vdata ) {
1488
  if ( '0' === $vdata['id'] ) {
1489
- $pqa['answers'][] = [ 'answer_text' => 'other', 'answer_value' => $vdata['data'] ];
 
 
 
1490
  } else {
1491
  foreach ( $answers_results as $ares ) {
1492
  if ( $vdata['id'] == $ares->id ) {
1493
- $pqa['answers'][] = [ 'answer_text' => '', 'answer_value' => $ares->stext ];
 
 
 
1494
  }
1495
  }
1496
  }
@@ -1510,7 +1523,10 @@ class YOP_Poll_Votes {
1510
  }
1511
  }
1512
  if ( isset( $ve['data'] ) ) {
1513
- $pqa['answers'][] = [ 'answer_text' => 'custom-field', 'answer_value' => $ve['data'][0] ];
 
 
 
1514
  }
1515
  $questions[] = $pqa;
1516
  break;
@@ -1534,11 +1550,11 @@ class YOP_Poll_Votes {
1534
  $time_format = get_option( 'time_format' );
1535
  if ( isset( $_REQUEST['poll_id'] ) && ( isset( $_REQUEST['doExport'] ) || isset( $_REQUEST['exportCustoms'] ) ) ) {
1536
  $votes = self::get_export_votes( sanitize_text_field( wp_unslash( $_REQUEST['poll_id'] ) ) );
1537
- $votes_for_csv = [];
1538
- $customs_data = [];
1539
  if ( count( $votes ) > 0 ) {
1540
  $x = 0;
1541
- $customs = [];
1542
  foreach ( $votes as $vote ) {
1543
  $vote_details = self::get_vote_details( $vote['id'] );
1544
  foreach ( $vote_details as $res ) {
@@ -1550,22 +1566,22 @@ class YOP_Poll_Votes {
1550
  }
1551
  $x++;
1552
  }
1553
- $csv_header_array = [
1554
  esc_html__( 'Poll Name', 'yop-poll' ),
1555
  esc_html__( 'Username', 'yop-poll' ),
1556
  esc_html__( 'Email', 'yop-poll' ),
1557
  esc_html__( 'User Type', 'yop-poll' ),
1558
  esc_html__( 'IP', 'yop-poll' ),
1559
  esc_html__( 'Date', 'yop-poll' ),
1560
- esc_html__( 'Vote data', 'yop-poll' )
1561
- ];
1562
  foreach ( $customs as $key => $val ) {
1563
  $csv_header_array[] = esc_html__( 'Custom field - ', 'yop-poll' ) . $val;
1564
  }
1565
  foreach ( $votes as $vote ) {
1566
  $vote_details = self::get_vote_details( $vote['id'] );
1567
  $details_string = '';
1568
- $custom_data = [];
1569
  foreach ( $vote_details as $res ) {
1570
  if ( 'custom-field' === $res['question'] ) {
1571
  $custom_data[$res['id']] = addslashes( $res['answers'][0]['answer_value'] );
@@ -1576,15 +1592,15 @@ class YOP_Poll_Votes {
1576
  }
1577
  }
1578
  }
1579
- $vote_data = [
1580
  stripslashes( $vote ['name'] ),
1581
  esc_html( stripslashes( $vote['user_id'] ) ),
1582
  stripslashes( $vote ['user_email'] ),
1583
  stripslashes( $vote ['user_type'] ),
1584
  stripslashes( $vote ['ipaddress'] ),
1585
  esc_html( date( $date_format . ' @ ' . $time_format, strtotime( $vote['added_date'] ) ) ),
1586
- stripslashes( $details_string )
1587
- ];
1588
  foreach ( $customs as $key => $val ) {
1589
  if ( isset( $custom_data[$key] ) ) {
1590
  array_push( $vote_data, $custom_data[$key] );
@@ -1607,12 +1623,12 @@ class YOP_Poll_Votes {
1607
  $f = fopen( 'php://output', 'w' ) or show_error( esc_html__( "Can't open php://output!", 'yop-poll' ) );
1608
  $csv_file_name = 'votes_export.' . date( 'YmdHis' ) . '.csv';
1609
  header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1610
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $csv_header_array ) ) {
1611
  esc_html_e( "Can't write header!", 'yop-poll' );
1612
  }
1613
  if ( count( $votes_for_csv ) > 0 ) {
1614
  foreach ( $votes_for_csv as $vote_data ) {
1615
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $vote_data, ',', '"' ) ) {
1616
  esc_html_e( "Can't write votes!", 'yop-poll' );
1617
  }
1618
  }
@@ -1631,7 +1647,7 @@ class YOP_Poll_Votes {
1631
  header( 'Connection: Keep-Alive' );
1632
  header( 'Expires: 0' );
1633
  ob_start();
1634
- $customs_sorted_array = [];
1635
  foreach ( $customs_data as $cd ) {
1636
  foreach ( $cd as $key => $value ) {
1637
  $customs_sorted_array[$key][] = $value;
@@ -1643,11 +1659,11 @@ class YOP_Poll_Votes {
1643
  $csv_file_name = 'customs_export.' . date( 'YmdHis' ) . '.csv';
1644
  header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1645
  $customs_data_keys = array_keys( $customs_data );
1646
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $customs_data[$customs_data_keys[0]]['headers'] ) ) {
1647
  esc_html_e( "Can't write header!", 'yop-poll' );
1648
  }
1649
  foreach ( $customs_data as $ch ) {
1650
- if ( !YOP_Poll_Helper::yop_fputcsv( $f, $ch['data'], ',', '"' ) ) {
1651
  esc_html_e( "Can't write votes!", 'yop-poll' );
1652
  }
1653
  }
@@ -1672,7 +1688,7 @@ class YOP_Poll_Votes {
1672
  $votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, array( $poll_id ) ), ARRAY_A );
1673
  foreach ( $votes as $key => $row ) {
1674
  if ( 'wordpress' === $row['user_type'] ) {
1675
- $vote_user_obj = get_user_by('id', $row['user_id'] );
1676
  if ( $vote_user_obj ) {
1677
  $votes[$key]['user_id'] = $vote_user_obj->user_login;
1678
  } else {
@@ -1688,11 +1704,13 @@ class YOP_Poll_Votes {
1688
  }
1689
  public static function delete_all_for_poll( $poll_id ) {
1690
  $query = $GLOBALS['wpdb']->prepare(
1691
- "UPDATE {$GLOBALS['wpdb']->yop_poll_votes} SET `status` = 'deleted' WHERE `poll_id` = %s", $poll_id
 
1692
  );
1693
  $GLOBALS['wpdb']->query( $query );
1694
  $query = $GLOBALS['wpdb']->prepare(
1695
- "UPDATE {$GLOBALS['wpdb']->yop_poll_other_answers} SET `status` = 'deleted' WHERE `poll_id` = %s", $poll_id
 
1696
  );
1697
  $GLOBALS['wpdb']->query( $query );
1698
  }
@@ -1734,7 +1752,8 @@ class YOP_Poll_Votes {
1734
  public static function get_owner( $vote_id ) {
1735
  $query = $GLOBALS['wpdb']->prepare(
1736
  "SELECT `author` FROM {$GLOBALS['wpdb']->yop_poll_votes} INNER JOIN {$GLOBALS['wpdb']->yop_poll_polls} ON
1737
- {$GLOBALS['wpdb']->yop_poll_votes}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id` WHERE {$GLOBALS['wpdb']->yop_poll_votes}.`id` = %s", $vote_id
 
1738
  );
1739
  $vote = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1740
  if ( null !== $vote ) {
58
  self::validate_hcaptcha( $vote, $poll );
59
  }
60
  if ( false === self::$errors_present ) {
61
+ if ( 'yes' === $poll->meta_data['options']['poll']['enableGdpr'] ) {
62
  switch ( $poll->meta_data['options']['poll']['gdprSolution'] ) {
63
  case 'consent': {
64
  $vote->user->c_data = self::get_voter_cookie( $vote->pollId );
659
  $element_data,
660
  array(
661
  'id' => $data->id,
662
+ 'data' => sanitize_text_field( $data->data ),
663
  )
664
  );
665
  } else {
667
  $element_data,
668
  array(
669
  'id' => $data->id,
670
+ 'data' => sanitize_text_field( $data->data ),
671
  )
672
  );
673
  }
690
  array(
691
  'id' => $element->id,
692
  'type' => $element->type,
693
+ 'data' => $element_data,
694
  )
695
  );
696
  }
698
  'elements' => $vote_elements,
699
  'user' => array(
700
  'first_name' => $vote->user->first_name,
701
+ 'last_name' => $vote->user->last_name,
702
  ),
703
  'meta_data' => array(
704
  'page_id' => isset( $vote->pageId ) ? $vote->pageId : '',
738
  ( true === array_key_exists( 'X-Forwarded-For', $headers ) ) &&
739
  filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP )
740
  ) {
741
+ $voter_ip = sanitize_text_field( wp_unslash( $headers['X-Forwarded-For'] ) );
742
  } elseif (
743
  ( true === array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) ) &&
744
  filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP )
745
  ) {
746
+ $voter_ip = sanitize_text_field( wp_unslash( $headers['HTTP_X_FORWARDED_FOR'] ) );
747
  } else {
748
  $voter_ip = filter_var(
749
+ isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '',
750
  FILTER_VALIDATE_IP
751
  );
752
  }
753
  } else {
754
  $voter_ip = filter_var(
755
+ isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '',
756
  FILTER_VALIDATE_IP
757
  );
758
  }
789
  'voter_fingerprint' => $vote->user->f_data,
790
  'vote_data' => serialize( self::create_meta_data( $vote ) ),
791
  'status' => 'active',
792
+ 'added_date' => $vote->added_date,
793
  );
794
  $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_votes, $data );
795
  $vote_id = $GLOBALS['wpdb']->insert_id;
894
  }
895
  $elements_code[] = array(
896
  'id' => $element->id,
897
+ 'code' => $element_html,
898
  );
899
  }
900
  if ( ( 'yes' === $element->meta_data['allowOtherAnswers'] ) && ( 'yes' === $element->meta_data['displayOtherAnswersInResults'] ) ) {
904
  foreach ( $element_others as $other_answer ) {
905
  $element_others_processed[] = array(
906
  'an' => esc_html( $other_answer->answer ),
907
+ 'vn' => $other_answer->total_submits,
908
  );
909
  }
910
  }
911
  $elements_other_answers[] = array(
912
  'id' => $element->id,
913
+ 'others' => json_encode( $element_others_processed ),
914
  );
915
  }
916
  }
926
  'rebuild' => $rebuild_elements,
927
  'elements' => json_encode( $elements_code ),
928
  'others' => json_encode( $elements_other_answers ),
929
+ 'results' => json_encode( $poll_results ),
930
  );
931
  return $response;
932
  }
968
  }
969
  $result_data['questions'][] = array(
970
  'text' => $poll_element->etext,
971
+ 'answers' => $answers,
972
  );
973
  break;
974
  }
979
  return $result_data;
980
  }
981
  public static function send_email_notification( $vote, $poll ) {
982
+ $email_to = array();
983
  $email_to_string = isset( $poll->meta_data['options']['poll']['emailNotificationsRecipients'] ) ?
984
  $poll->meta_data['options']['poll']['emailNotificationsRecipients'] : '';
985
  $recipients_array = explode( ',', $email_to_string );
1006
  $poll->meta_data['options']['poll']['emailNotificationsFromEmail'] : '';
1007
  $email_headers = array(
1008
  'From: ' . $email_from_name . ' <' . $email_from_email . '>',
1009
+ 'Content-Type: text/plain',
1010
  );
1011
  /* BEGIN Email-Subject*/
1012
  $email_subject = str_replace( '%VOTE-DATE%', date_i18n( get_option( 'date_format' ), strtotime( $vote->added_date ) ), $email_subject );
1052
  '[QUESTION]',
1053
  '[/QUESTION]',
1054
  '[ANSWERS]',
1055
+ '[/ANSWERS]',
1056
  ),
1057
  array(
1058
  '',
1071
  '[ANSWERS]',
1072
  '[/ANSWERS]',
1073
  '[CUSTOM_FIELDS]',
1074
+ '[/CUSTOM_FIELDS]',
1075
  ),
1076
  array(
1077
  '',
1092
  return $votes;
1093
  }
1094
  public static function get_total_votes_by_poll( $poll_id ) {
1095
+ $query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `poll_id` = %d AND `status` = 'active'";
1096
  $votes_no = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( $query, $poll_id ) );
1097
  return $votes_no;
1098
  }
1109
  if ( $params['page_no'] > $pagination['total_pages'] ) {
1110
  $params['page_no'] = 1;
1111
  }
1112
+ if ( ! in_array( $params['sort_order'], self::$sort_order_allowed ) ) {
1113
  $params['sort_order'] = SORT_ASC;
1114
  } elseif ( 'desc' === $params['sort_order'] ) {
1115
  $params['sort_order'] = SORT_DESC;
1117
  $params['sort_order'] = SORT_ASC;
1118
  }
1119
  if ( ( true === isset( $params['order_by'] ) ) && ( '' != $params['order_by'] ) ) {
1120
+ if ( ! in_array( $params['order_by'], self::$order_by_allowed ) ) {
1121
  $params['order_by'] = 'id';
1122
  }
1123
  } else {
1126
  $limit = self::$votes_per_page * ( $params['page_no'] - 1 );
1127
  $limit_query = " LIMIT {$limit}, " . self::$votes_per_page;
1128
  $query = '';
1129
+ $votes = array();
1130
  if ( current_user_can( 'yop_poll_results_others' ) ) {
1131
  $query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `poll_id` = %d AND `status` = 'active'";
1132
  $query = $GLOBALS['wpdb']->prepare(
1194
  'votes' => $votes,
1195
  'total_votes' => $pagination['total_votes'],
1196
  'total_pages' => $pagination['total_pages'],
1197
+ 'pagination' => $pagination['pagination'],
1198
  );
1199
  }
1200
  public static function paginate( $params ) {
1278
  'order_by' => $params['order_by'],
1279
  'sort_order' => $params['sort_order'],
1280
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1281
+ 'page_no' => $params['page_no'] + 1,
1282
  )
1283
  )
1284
  );
1295
  'order_by' => $params['order_by'],
1296
  'sort_order' => $params['sort_order'],
1297
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1298
+ 'page_no' => intval( $total_pages ),
1299
  )
1300
  )
1301
  );
1314
  'order_by' => $params['order_by'],
1315
  'sort_order' => $params['sort_order'],
1316
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1317
+ 'page_no' => $params['page_no'] - 1,
1318
  )
1319
  )
1320
  );
1331
  'order_by' => $params['order_by'],
1332
  'sort_order' => $params['sort_order'],
1333
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1334
+ 'page_no' => 1,
1335
  )
1336
  )
1337
  );
1350
  'order_by' => $params['order_by'],
1351
  'sort_order' => $params['sort_order'],
1352
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1353
+ 'page_no' => $params['page_no'] - 1,
1354
  )
1355
  )
1356
  );
1363
  'order_by' => $params['order_by'],
1364
  'sort_order' => $params['sort_order'],
1365
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1366
+ 'page_no' => $params['page_no'] + 1,
1367
  )
1368
  )
1369
  );
1383
  'order_by' => false,
1384
  'sort_order' => false,
1385
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1386
+ 'page_no' => 1,
1387
  )
1388
  )
1389
  );
1401
  'order_by' => false,
1402
  'sort_order' => false,
1403
  'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
1404
+ 'page_no' => intval( $total_pages ),
1405
  )
1406
  )
1407
  );
1419
  return array(
1420
  'total_votes' => $total_votes,
1421
  'total_pages' => $total_pages,
1422
+ 'pagination' => $pagination,
1423
  );
1424
  }
1425
  public static function get_vote_details( $vote_id ) {
1426
  $query = $GLOBALS['wpdb']->prepare(
1427
+ "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_votes} WHERE `id` = %d",
1428
+ $vote_id
1429
  );
1430
  $vote = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1431
  if ( null !== $vote ) {
1433
  if ( count( $vote_data ) > 0 ) {
1434
  if ( isset( $vote_data['elements'] ) ) {
1435
  $vote_elements = $vote_data['elements'];
1436
+ $questions = array();
1437
+ $questions_ids = array();
1438
+ $answers_ids = array();
1439
+ $questions_results = array();
1440
+ $answers_results = array();
1441
  if ( count( $vote_elements ) > 0 ) {
1442
  foreach ( $vote_elements as $ve ) {
1443
+ $qanswers = array();
1444
  if ( isset( $ve['id'] ) ) {
1445
  $questions_ids[] = $ve['id'];
1446
  }
1455
  }
1456
  }
1457
  if ( count( $questions_ids ) > 0 ) {
1458
+ $question_ids_escaped = array_map(
1459
+ function( $question_id ) {
1460
+ return "'" . esc_sql( $question_id ) . "'";
1461
+ },
1462
+ $questions_ids
1463
+ );
1464
  $questions_ids_string = '(' . implode( ',', $question_ids_escaped ) . ')';
1465
  $questions_query = "SELECT * from {$GLOBALS['wpdb']->yop_poll_elements} where `id` IN $questions_ids_string";
1466
  $questions_results = $GLOBALS['wpdb']->get_results( $questions_query, OBJECT );
1477
  $answers_results = $GLOBALS['wpdb']->get_results( $answers_query, OBJECT );
1478
  }
1479
  foreach ( $vote_elements as $ve ) {
1480
+ $pqa = array(
1481
+ 'question' => '',
1482
+ 'answers' => array(),
1483
+ );
1484
  switch ( $ve['type'] ) {
1485
  case 'question': {
1486
  if ( isset( $ve['id'] ) ) {
1493
  if ( isset( $ve['data'] ) ) {
1494
  foreach ( $ve['data'] as $vdata ) {
1495
  if ( '0' === $vdata['id'] ) {
1496
+ $pqa['answers'][] = array(
1497
+ 'answer_text' => 'other',
1498
+ 'answer_value' => $vdata['data'],
1499
+ );
1500
  } else {
1501
  foreach ( $answers_results as $ares ) {
1502
  if ( $vdata['id'] == $ares->id ) {
1503
+ $pqa['answers'][] = array(
1504
+ 'answer_text' => '',
1505
+ 'answer_value' => $ares->stext,
1506
+ );
1507
  }
1508
  }
1509
  }
1523
  }
1524
  }
1525
  if ( isset( $ve['data'] ) ) {
1526
+ $pqa['answers'][] = array(
1527
+ 'answer_text' => 'custom-field',
1528
+ 'answer_value' => $ve['data'][0],
1529
+ );
1530
  }
1531
  $questions[] = $pqa;
1532
  break;
1550
  $time_format = get_option( 'time_format' );
1551
  if ( isset( $_REQUEST['poll_id'] ) && ( isset( $_REQUEST['doExport'] ) || isset( $_REQUEST['exportCustoms'] ) ) ) {
1552
  $votes = self::get_export_votes( sanitize_text_field( wp_unslash( $_REQUEST['poll_id'] ) ) );
1553
+ $votes_for_csv = array();
1554
+ $customs_data = array();
1555
  if ( count( $votes ) > 0 ) {
1556
  $x = 0;
1557
+ $customs = array();
1558
  foreach ( $votes as $vote ) {
1559
  $vote_details = self::get_vote_details( $vote['id'] );
1560
  foreach ( $vote_details as $res ) {
1566
  }
1567
  $x++;
1568
  }
1569
+ $csv_header_array = array(
1570
  esc_html__( 'Poll Name', 'yop-poll' ),
1571
  esc_html__( 'Username', 'yop-poll' ),
1572
  esc_html__( 'Email', 'yop-poll' ),
1573
  esc_html__( 'User Type', 'yop-poll' ),
1574
  esc_html__( 'IP', 'yop-poll' ),
1575
  esc_html__( 'Date', 'yop-poll' ),
1576
+ esc_html__( 'Vote data', 'yop-poll' ),
1577
+ );
1578
  foreach ( $customs as $key => $val ) {
1579
  $csv_header_array[] = esc_html__( 'Custom field - ', 'yop-poll' ) . $val;
1580
  }
1581
  foreach ( $votes as $vote ) {
1582
  $vote_details = self::get_vote_details( $vote['id'] );
1583
  $details_string = '';
1584
+ $custom_data = array();
1585
  foreach ( $vote_details as $res ) {
1586
  if ( 'custom-field' === $res['question'] ) {
1587
  $custom_data[$res['id']] = addslashes( $res['answers'][0]['answer_value'] );
1592
  }
1593
  }
1594
  }
1595
+ $vote_data = array(
1596
  stripslashes( $vote ['name'] ),
1597
  esc_html( stripslashes( $vote['user_id'] ) ),
1598
  stripslashes( $vote ['user_email'] ),
1599
  stripslashes( $vote ['user_type'] ),
1600
  stripslashes( $vote ['ipaddress'] ),
1601
  esc_html( date( $date_format . ' @ ' . $time_format, strtotime( $vote['added_date'] ) ) ),
1602
+ stripslashes( $details_string ),
1603
+ );
1604
  foreach ( $customs as $key => $val ) {
1605
  if ( isset( $custom_data[$key] ) ) {
1606
  array_push( $vote_data, $custom_data[$key] );
1623
  $f = fopen( 'php://output', 'w' ) or show_error( esc_html__( "Can't open php://output!", 'yop-poll' ) );
1624
  $csv_file_name = 'votes_export.' . date( 'YmdHis' ) . '.csv';
1625
  header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1626
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $csv_header_array ) ) {
1627
  esc_html_e( "Can't write header!", 'yop-poll' );
1628
  }
1629
  if ( count( $votes_for_csv ) > 0 ) {
1630
  foreach ( $votes_for_csv as $vote_data ) {
1631
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $vote_data, ',', '"' ) ) {
1632
  esc_html_e( "Can't write votes!", 'yop-poll' );
1633
  }
1634
  }
1647
  header( 'Connection: Keep-Alive' );
1648
  header( 'Expires: 0' );
1649
  ob_start();
1650
+ $customs_sorted_array = array();
1651
  foreach ( $customs_data as $cd ) {
1652
  foreach ( $cd as $key => $value ) {
1653
  $customs_sorted_array[$key][] = $value;
1659
  $csv_file_name = 'customs_export.' . date( 'YmdHis' ) . '.csv';
1660
  header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1661
  $customs_data_keys = array_keys( $customs_data );
1662
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $customs_data[$customs_data_keys[0]]['headers'] ) ) {
1663
  esc_html_e( "Can't write header!", 'yop-poll' );
1664
  }
1665
  foreach ( $customs_data as $ch ) {
1666
+ if ( ! YOP_Poll_Helper::yop_fputcsv( $f, $ch['data'], ',', '"' ) ) {
1667
  esc_html_e( "Can't write votes!", 'yop-poll' );
1668
  }
1669
  }
1688
  $votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, array( $poll_id ) ), ARRAY_A );
1689
  foreach ( $votes as $key => $row ) {
1690
  if ( 'wordpress' === $row['user_type'] ) {
1691
+ $vote_user_obj = get_user_by( 'id', $row['user_id'] );
1692
  if ( $vote_user_obj ) {
1693
  $votes[$key]['user_id'] = $vote_user_obj->user_login;
1694
  } else {
1704
  }
1705
  public static function delete_all_for_poll( $poll_id ) {
1706
  $query = $GLOBALS['wpdb']->prepare(
1707
+ "UPDATE {$GLOBALS['wpdb']->yop_poll_votes} SET `status` = 'deleted' WHERE `poll_id` = %s",
1708
+ $poll_id
1709
  );
1710
  $GLOBALS['wpdb']->query( $query );
1711
  $query = $GLOBALS['wpdb']->prepare(
1712
+ "UPDATE {$GLOBALS['wpdb']->yop_poll_other_answers} SET `status` = 'deleted' WHERE `poll_id` = %s",
1713
+ $poll_id
1714
  );
1715
  $GLOBALS['wpdb']->query( $query );
1716
  }
1752
  public static function get_owner( $vote_id ) {
1753
  $query = $GLOBALS['wpdb']->prepare(
1754
  "SELECT `author` FROM {$GLOBALS['wpdb']->yop_poll_votes} INNER JOIN {$GLOBALS['wpdb']->yop_poll_polls} ON
1755
+ {$GLOBALS['wpdb']->yop_poll_votes}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id` WHERE {$GLOBALS['wpdb']->yop_poll_votes}.`id` = %s",
1756
+ $vote_id
1757
  );
1758
  $vote = $GLOBALS['wpdb']->get_row( $query, OBJECT );
1759
  if ( null !== $vote ) {
admin/views/bans/edit.php CHANGED
@@ -134,7 +134,7 @@
134
  <input
135
  name="updateban"
136
  class="button button-primary button-large center update-ban"
137
- value="<?php esc_html_e( 'Update', 'yop-poll' );?>"
138
  data-id="<?php echo esc_attr( $ban->id ); ?>"
139
  type="submit">
140
  </div>
134
  <input
135
  name="updateban"
136
  class="button button-primary button-large center update-ban"
137
+ value="<?php esc_html_e( 'Update', 'yop-poll' ); ?>"
138
  data-id="<?php echo esc_attr( $ban->id ); ?>"
139
  type="submit">
140
  </div>
admin/views/bans/view.php CHANGED
@@ -138,17 +138,23 @@ switch ( $params['order_by'] ) {
138
  <div id="icon-options-general" class="icon32"></div>
139
  <h1>
140
  <?php esc_html_e( 'Bans', 'yop-poll' ); ?>
141
- <a href="<?php echo esc_url(
 
 
142
  add_query_arg(
143
- array(
144
- 'page' => 'yop-poll-bans',
145
- 'action' => 'add',
146
- 'ban_id' => false,
147
- '_token' => false,
148
- 'order_by' => false,
149
- 'sort_order' => false,
150
- 'q' => false
151
- ) ) ); ?>" class="page-title-action">
 
 
 
 
152
  <?php esc_html_e( 'Add New', 'yop-poll' ); ?>
153
  </a>
154
  </h1>
@@ -184,7 +190,16 @@ switch ( $params['order_by'] ) {
184
  </h2>
185
  <div class="tablenav-pages">
186
  <span class="displaying-num">
187
- <?php echo sprintf( _n( '%s item', '%s items', count( $bans ), 'yop-poll' ), count( $bans ) ); ?>
 
 
 
 
 
 
 
 
 
188
  </span>
189
  <?php
190
  if ( 1 < $total_pages ) {
@@ -229,7 +244,8 @@ switch ( $params['order_by'] ) {
229
  </td>
230
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
231
  <a href="
232
- <?php echo esc_url(
 
233
  add_query_arg(
234
  array(
235
  'action' => false,
@@ -238,7 +254,7 @@ switch ( $params['order_by'] ) {
238
  'order_by' => 'name',
239
  'sort_order' => $poll_name_sort_order,
240
  'q' => htmlentities( $params['q'] ),
241
- 'page_no' => $params['page_no']
242
  )
243
  )
244
  );
@@ -252,7 +268,8 @@ switch ( $params['order_by'] ) {
252
  </th>
253
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
254
  <a href="
255
- <?php echo esc_url(
 
256
  add_query_arg(
257
  array(
258
  'action' => false,
@@ -261,7 +278,7 @@ switch ( $params['order_by'] ) {
261
  'order_by' => 'author',
262
  'sort_order' => $author_sort_order,
263
  'q' => htmlentities( $params['q'] ),
264
- 'page_no' => $params['page_no']
265
  )
266
  )
267
  );
@@ -275,7 +292,8 @@ switch ( $params['order_by'] ) {
275
  </th>
276
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_by_column_class ) . ' ' . esc_attr( $ban_by_sort_order_display ); ?>">
277
  <a href="
278
- <?php echo esc_url(
 
279
  add_query_arg(
280
  array(
281
  'action' => false,
@@ -284,7 +302,7 @@ switch ( $params['order_by'] ) {
284
  'order_by' => 'ban_by',
285
  'sort_order' => $ban_by_sort_order,
286
  'q' => htmlentities( $params['q'] ),
287
- 'page_no' => $params['page_no']
288
  )
289
  )
290
  );
@@ -298,7 +316,8 @@ switch ( $params['order_by'] ) {
298
  </th>
299
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_value_column_class ) . ' ' . esc_attr( $ban_value_sort_order_display ); ?>">
300
  <a href="
301
- <?php echo esc_url(
 
302
  add_query_arg(
303
  array(
304
  'action' => false,
@@ -307,7 +326,7 @@ switch ( $params['order_by'] ) {
307
  'order_by' => 'ban_value',
308
  'sort_order' => $ban_value_sort_order,
309
  'q' => htmlentities( $params['q'] ),
310
- 'page_no' => $params['page_no']
311
  )
312
  )
313
  );
@@ -321,7 +340,8 @@ switch ( $params['order_by'] ) {
321
  </th>
322
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_date_column_class ) . ' ' . esc_attr( $ban_date_sort_order_display ); ?>">
323
  <a href="
324
- <?php echo esc_url(
 
325
  add_query_arg(
326
  array(
327
  'action' => false,
@@ -330,7 +350,7 @@ switch ( $params['order_by'] ) {
330
  'order_by' => 'ban_date',
331
  'sort_order' => $ban_date_sort_order,
332
  'q' => htmlentities( $params['q'] ),
333
- 'page_no' => $params['page_no']
334
  )
335
  )
336
  );
@@ -357,32 +377,45 @@ switch ( $params['order_by'] ) {
357
  </th>
358
  <td class="title column-title has-row-actions column-primary page-title" data-colname="Title">
359
  <strong>
360
- <a class="row-title" href="<?php echo esc_url( add_query_arg(
361
- array(
362
- 'page' => 'yop-poll-bans',
363
- 'action' => 'edit',
364
- 'ban_id' => $ban['id'],
365
- '_token' => false,
366
- 'order_by' => false,
367
- 'sort_order' => false,
368
- 'q' => false
369
- ) ) );?>"
370
- title="<?php esc_html_e( 'Poll name', 'yop-poll' ); ?>">
 
 
 
 
 
 
371
  <?php echo esc_html( ( 0 !== intval( $ban['poll_id'] ) ) ? $ban['name'] : 'All Polls' ); ?>
372
  </a>
373
  </strong>
374
  <div class="row-actions">
375
  <span class="edit">
376
- <a href="<?php echo esc_url( add_query_arg(
377
- array(
378
- 'page' => 'yop-poll-bans',
379
- 'action' => 'edit',
380
- 'ban_id' => $ban['id'],
381
- '_token' => false,
382
- 'order_by' => false,
383
- 'sort_order' => false,
384
- 'q' => false
385
- ) ) );?>" title="<?php esc_html_e( 'Edit this ban', 'yop-poll' ); ?>">
 
 
 
 
 
 
 
386
  <?php esc_html_e( 'Edit', 'yop-poll' ); ?>
387
  </a> |
388
  </span>
@@ -421,7 +454,8 @@ switch ( $params['order_by'] ) {
421
  </td>
422
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
423
  <a href="
424
- <?php echo esc_url(
 
425
  add_query_arg(
426
  array(
427
  'action' => false,
@@ -430,7 +464,7 @@ switch ( $params['order_by'] ) {
430
  'order_by' => 'name',
431
  'sort_order' => $poll_name_sort_order,
432
  'q' => htmlentities( $params['q'] ),
433
- 'page_no' => $params['page_no']
434
  )
435
  )
436
  );
@@ -444,7 +478,8 @@ switch ( $params['order_by'] ) {
444
  </th>
445
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
446
  <a href="
447
- <?php echo esc_url(
 
448
  add_query_arg(
449
  array(
450
  'action' => false,
@@ -453,7 +488,7 @@ switch ( $params['order_by'] ) {
453
  'order_by' => 'author',
454
  'sort_order' => $author_sort_order,
455
  'q' => htmlentities( $params['q'] ),
456
- 'page_no' => $params['page_no']
457
  )
458
  )
459
  );
@@ -467,7 +502,8 @@ switch ( $params['order_by'] ) {
467
  </th>
468
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_by_column_class ) . ' ' . esc_attr( $ban_by_sort_order_display ); ?>">
469
  <a href="
470
- <?php echo esc_url(
 
471
  add_query_arg(
472
  array(
473
  'action' => false,
@@ -476,7 +512,7 @@ switch ( $params['order_by'] ) {
476
  'order_by' => 'ban_by',
477
  'sort_order' => $ban_by_sort_order,
478
  'q' => htmlentities( $params['q'] ),
479
- 'page_no' => $params['page_no']
480
  )
481
  )
482
  );
@@ -490,7 +526,8 @@ switch ( $params['order_by'] ) {
490
  </th>
491
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_value_column_class ) . ' ' . esc_attr( $ban_value_sort_order_display ); ?>">
492
  <a href="
493
- <?php echo esc_url(
 
494
  add_query_arg(
495
  array(
496
  'action' => false,
@@ -499,7 +536,7 @@ switch ( $params['order_by'] ) {
499
  'order_by' => 'ban_value',
500
  'sort_order' => $ban_value_sort_order,
501
  'q' => htmlentities( $params['q'] ),
502
- 'page_no' => $params['page_no']
503
  )
504
  )
505
  );
@@ -513,7 +550,8 @@ switch ( $params['order_by'] ) {
513
  </th>
514
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_date_column_class ) . ' ' . esc_attr( $ban_date_sort_order_display ); ?>">
515
  <a href="
516
- <?php echo esc_url(
 
517
  add_query_arg(
518
  array(
519
  'action' => false,
@@ -522,7 +560,7 @@ switch ( $params['order_by'] ) {
522
  'order_by' => 'ban_date',
523
  'sort_order' => $ban_date_sort_order,
524
  'q' => htmlentities( $params['q'] ),
525
- 'page_no' => $params['page_no']
526
  )
527
  )
528
  );
@@ -570,7 +608,16 @@ switch ( $params['order_by'] ) {
570
  </h2>
571
  <div class="tablenav-pages">
572
  <span class="displaying-num">
573
- <?php echo sprintf( _n( '%s item', '%s items', $total_bans, 'yop-poll' ), $total_bans ); ?>
 
 
 
 
 
 
 
 
 
574
  </span>
575
  <?php
576
  if ( 1 < $total_pages ) {
138
  <div id="icon-options-general" class="icon32"></div>
139
  <h1>
140
  <?php esc_html_e( 'Bans', 'yop-poll' ); ?>
141
+ <a href="
142
+ <?php
143
+ echo esc_url(
144
  add_query_arg(
145
+ array(
146
+ 'page' => 'yop-poll-bans',
147
+ 'action' => 'add',
148
+ 'ban_id' => false,
149
+ '_token' => false,
150
+ 'order_by' => false,
151
+ 'sort_order' => false,
152
+ 'q' => false,
153
+ )
154
+ )
155
+ );
156
+ ?>
157
+ " class="page-title-action">
158
  <?php esc_html_e( 'Add New', 'yop-poll' ); ?>
159
  </a>
160
  </h1>
190
  </h2>
191
  <div class="tablenav-pages">
192
  <span class="displaying-num">
193
+ <?php
194
+ if (
195
+ ( 0 === intval( $total_bans ) ) ||
196
+ ( intval( $total_bans ) > 1 )
197
+ ) {
198
+ echo esc_html( $total_bans ) . ' ' . esc_html__( 'items' );
199
+ } else {
200
+ echo esc_html( $total_bans ) . ' ' . esc_html__( 'item' );
201
+ }
202
+ ?>
203
  </span>
204
  <?php
205
  if ( 1 < $total_pages ) {
244
  </td>
245
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
246
  <a href="
247
+ <?php
248
+ echo esc_url(
249
  add_query_arg(
250
  array(
251
  'action' => false,
254
  'order_by' => 'name',
255
  'sort_order' => $poll_name_sort_order,
256
  'q' => htmlentities( $params['q'] ),
257
+ 'page_no' => $params['page_no'],
258
  )
259
  )
260
  );
268
  </th>
269
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
270
  <a href="
271
+ <?php
272
+ echo esc_url(
273
  add_query_arg(
274
  array(
275
  'action' => false,
278
  'order_by' => 'author',
279
  'sort_order' => $author_sort_order,
280
  'q' => htmlentities( $params['q'] ),
281
+ 'page_no' => $params['page_no'],
282
  )
283
  )
284
  );
292
  </th>
293
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_by_column_class ) . ' ' . esc_attr( $ban_by_sort_order_display ); ?>">
294
  <a href="
295
+ <?php
296
+ echo esc_url(
297
  add_query_arg(
298
  array(
299
  'action' => false,
302
  'order_by' => 'ban_by',
303
  'sort_order' => $ban_by_sort_order,
304
  'q' => htmlentities( $params['q'] ),
305
+ 'page_no' => $params['page_no'],
306
  )
307
  )
308
  );
316
  </th>
317
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_value_column_class ) . ' ' . esc_attr( $ban_value_sort_order_display ); ?>">
318
  <a href="
319
+ <?php
320
+ echo esc_url(
321
  add_query_arg(
322
  array(
323
  'action' => false,
326
  'order_by' => 'ban_value',
327
  'sort_order' => $ban_value_sort_order,
328
  'q' => htmlentities( $params['q'] ),
329
+ 'page_no' => $params['page_no'],
330
  )
331
  )
332
  );
340
  </th>
341
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_date_column_class ) . ' ' . esc_attr( $ban_date_sort_order_display ); ?>">
342
  <a href="
343
+ <?php
344
+ echo esc_url(
345
  add_query_arg(
346
  array(
347
  'action' => false,
350
  'order_by' => 'ban_date',
351
  'sort_order' => $ban_date_sort_order,
352
  'q' => htmlentities( $params['q'] ),
353
+ 'page_no' => $params['page_no'],
354
  )
355
  )
356
  );
377
  </th>
378
  <td class="title column-title has-row-actions column-primary page-title" data-colname="Title">
379
  <strong>
380
+ <a class="row-title" href="
381
+ <?php
382
+ echo esc_url(
383
+ add_query_arg(
384
+ array(
385
+ 'page' => 'yop-poll-bans',
386
+ 'action' => 'edit',
387
+ 'ban_id' => $ban['id'],
388
+ '_token' => false,
389
+ 'order_by' => false,
390
+ 'sort_order' => false,
391
+ 'q' => false,
392
+ )
393
+ )
394
+ );
395
+ ?>
396
+ " title="<?php esc_html_e( 'Poll name', 'yop-poll' ); ?>">
397
  <?php echo esc_html( ( 0 !== intval( $ban['poll_id'] ) ) ? $ban['name'] : 'All Polls' ); ?>
398
  </a>
399
  </strong>
400
  <div class="row-actions">
401
  <span class="edit">
402
+ <a href="
403
+ <?php
404
+ echo esc_url(
405
+ add_query_arg(
406
+ array(
407
+ 'page' => 'yop-poll-bans',
408
+ 'action' => 'edit',
409
+ 'ban_id' => $ban['id'],
410
+ '_token' => false,
411
+ 'order_by' => false,
412
+ 'sort_order' => false,
413
+ 'q' => false,
414
+ )
415
+ )
416
+ );
417
+ ?>
418
+ " title="<?php esc_html_e( 'Edit this ban', 'yop-poll' ); ?>">
419
  <?php esc_html_e( 'Edit', 'yop-poll' ); ?>
420
  </a> |
421
  </span>
454
  </td>
455
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
456
  <a href="
457
+ <?php
458
+ echo esc_url(
459
  add_query_arg(
460
  array(
461
  'action' => false,
464
  'order_by' => 'name',
465
  'sort_order' => $poll_name_sort_order,
466
  'q' => htmlentities( $params['q'] ),
467
+ 'page_no' => $params['page_no'],
468
  )
469
  )
470
  );
478
  </th>
479
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
480
  <a href="
481
+ <?php
482
+ echo esc_url(
483
  add_query_arg(
484
  array(
485
  'action' => false,
488
  'order_by' => 'author',
489
  'sort_order' => $author_sort_order,
490
  'q' => htmlentities( $params['q'] ),
491
+ 'page_no' => $params['page_no'],
492
  )
493
  )
494
  );
502
  </th>
503
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_by_column_class ) . ' ' . esc_attr( $ban_by_sort_order_display ); ?>">
504
  <a href="
505
+ <?php
506
+ echo esc_url(
507
  add_query_arg(
508
  array(
509
  'action' => false,
512
  'order_by' => 'ban_by',
513
  'sort_order' => $ban_by_sort_order,
514
  'q' => htmlentities( $params['q'] ),
515
+ 'page_no' => $params['page_no'],
516
  )
517
  )
518
  );
526
  </th>
527
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_value_column_class ) . ' ' . esc_attr( $ban_value_sort_order_display ); ?>">
528
  <a href="
529
+ <?php
530
+ echo esc_url(
531
  add_query_arg(
532
  array(
533
  'action' => false,
536
  'order_by' => 'ban_value',
537
  'sort_order' => $ban_value_sort_order,
538
  'q' => htmlentities( $params['q'] ),
539
+ 'page_no' => $params['page_no'],
540
  )
541
  )
542
  );
550
  </th>
551
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ban_date_column_class ) . ' ' . esc_attr( $ban_date_sort_order_display ); ?>">
552
  <a href="
553
+ <?php
554
+ echo esc_url(
555
  add_query_arg(
556
  array(
557
  'action' => false,
560
  'order_by' => 'ban_date',
561
  'sort_order' => $ban_date_sort_order,
562
  'q' => htmlentities( $params['q'] ),
563
+ 'page_no' => $params['page_no'],
564
  )
565
  )
566
  );
608
  </h2>
609
  <div class="tablenav-pages">
610
  <span class="displaying-num">
611
+ <?php
612
+ if (
613
+ ( 0 === intval( $total_bans ) ) ||
614
+ ( intval( $total_bans ) > 1 )
615
+ ) {
616
+ echo esc_html( $total_bans ) . ' ' . esc_html__( 'items' );
617
+ } else {
618
+ echo esc_html( $total_bans ) . ' ' . esc_html__( 'item' );
619
+ }
620
+ ?>
621
  </span>
622
  <?php
623
  if ( 1 < $total_pages ) {
admin/views/logs/view.php CHANGED
@@ -141,7 +141,16 @@ switch ( $params['order_by'] ) {
141
  </h2>
142
  <div class="tablenav-pages">
143
  <span class="displaying-num">
144
- <?php echo sprintf( _n( '%s item', '%s items', count( $logs ), 'yop-poll' ), count( $logs ) ); ?>
 
 
 
 
 
 
 
 
 
145
  </span>
146
  <?php
147
  if ( 1 < $total_pages ) {
@@ -186,7 +195,8 @@ switch ( $params['order_by'] ) {
186
  </td>
187
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
188
  <a href="
189
- <?php echo esc_url(
 
190
  add_query_arg(
191
  array(
192
  'action' => false,
@@ -195,7 +205,7 @@ switch ( $params['order_by'] ) {
195
  'order_by' => 'name',
196
  'sort_order' => $poll_name_sort_order,
197
  'q' => htmlentities( $params['q'] ),
198
- 'page_no' => $params['page_no']
199
  )
200
  )
201
  );
@@ -209,7 +219,8 @@ switch ( $params['order_by'] ) {
209
  </th>
210
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_id_column_class ) . ' ' . esc_attr( $user_id_sort_order_display ); ?>">
211
  <a href="
212
- <?php echo esc_url(
 
213
  add_query_arg(
214
  array(
215
  'action' => false,
@@ -218,7 +229,7 @@ switch ( $params['order_by'] ) {
218
  'order_by' => 'user_id',
219
  'sort_order' => $user_id_sort_order,
220
  'q' => htmlentities( $params['q'] ),
221
- 'page_no' => $params['page_no']
222
  )
223
  )
224
  );
@@ -232,7 +243,8 @@ switch ( $params['order_by'] ) {
232
  </th>
233
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $email_column_class ) . ' ' . esc_attr( $email_sort_order_display ); ?>">
234
  <a href="
235
- <?php echo esc_url(
 
236
  add_query_arg(
237
  array(
238
  'action' => false,
@@ -241,7 +253,7 @@ switch ( $params['order_by'] ) {
241
  'order_by' => 'email',
242
  'sort_order' => $email_sort_order,
243
  'q' => htmlentities( $params['q'] ),
244
- 'page_no' => $params['page_no']
245
  )
246
  )
247
  );
@@ -255,7 +267,8 @@ switch ( $params['order_by'] ) {
255
  </th>
256
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
257
  <a href="
258
- <?php echo esc_url(
 
259
  add_query_arg(
260
  array(
261
  'action' => false,
@@ -264,7 +277,7 @@ switch ( $params['order_by'] ) {
264
  'order_by' => 'user_type',
265
  'sort_order' => $user_type_sort_order,
266
  'q' => htmlentities( $params['q'] ),
267
- 'page_no' => $params['page_no']
268
  )
269
  )
270
  );
@@ -278,7 +291,8 @@ switch ( $params['order_by'] ) {
278
  </th>
279
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
280
  <a href="
281
- <?php echo esc_url(
 
282
  add_query_arg(
283
  array(
284
  'action' => false,
@@ -287,7 +301,7 @@ switch ( $params['order_by'] ) {
287
  'order_by' => 'ipaddress',
288
  'sort_order' => $ipaddress_sort_order,
289
  'q' => htmlentities( $params['q'] ),
290
- 'page_no' => $params['page_no']
291
  )
292
  )
293
  );
@@ -301,7 +315,8 @@ switch ( $params['order_by'] ) {
301
  </th>
302
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
303
  <a href="
304
- <?php echo esc_url(
 
305
  add_query_arg(
306
  array(
307
  'action' => false,
@@ -310,7 +325,7 @@ switch ( $params['order_by'] ) {
310
  'order_by' => 'added_date',
311
  'sort_order' => $added_date_sort_order,
312
  'q' => htmlentities( $params['q'] ),
313
- 'page_no' => $params['page_no']
314
  )
315
  )
316
  );
@@ -324,7 +339,8 @@ switch ( $params['order_by'] ) {
324
  </th>
325
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $vote_message_column_class ) . ' ' . esc_attr( $vote_message_sort_order_display ); ?>">
326
  <a href="
327
- <?php echo esc_url(
 
328
  add_query_arg(
329
  array(
330
  'action' => false,
@@ -333,7 +349,7 @@ switch ( $params['order_by'] ) {
333
  'order_by' => 'vote_message',
334
  'sort_order' => $vote_message_sort_order,
335
  'q' => htmlentities( $params['q'] ),
336
- 'page_no' => $params['page_no']
337
  )
338
  )
339
  );
@@ -410,7 +426,8 @@ switch ( $params['order_by'] ) {
410
  </td>
411
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
412
  <a href="
413
- <?php echo esc_url(
 
414
  add_query_arg(
415
  array(
416
  'action' => false,
@@ -419,7 +436,7 @@ switch ( $params['order_by'] ) {
419
  'order_by' => 'name',
420
  'sort_order' => $poll_name_sort_order,
421
  'q' => htmlentities( $params['q'] ),
422
- 'page_no' => $params['page_no']
423
  )
424
  )
425
  );
@@ -433,7 +450,8 @@ switch ( $params['order_by'] ) {
433
  </th>
434
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_id_column_class ) . ' ' . esc_attr( $user_id_sort_order_display ); ?>">
435
  <a href="
436
- <?php echo esc_url(
 
437
  add_query_arg(
438
  array(
439
  'action' => false,
@@ -442,7 +460,7 @@ switch ( $params['order_by'] ) {
442
  'order_by' => 'user_id',
443
  'sort_order' => $user_id_sort_order,
444
  'q' => htmlentities( $params['q'] ),
445
- 'page_no' => $params['page_no']
446
  )
447
  )
448
  );
@@ -456,7 +474,8 @@ switch ( $params['order_by'] ) {
456
  </th>
457
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $email_column_class ) . ' ' . esc_attr( $email_sort_order_display ); ?>">
458
  <a href="
459
- <?php echo esc_url(
 
460
  add_query_arg(
461
  array(
462
  'action' => false,
@@ -465,7 +484,7 @@ switch ( $params['order_by'] ) {
465
  'order_by' => 'email',
466
  'sort_order' => $email_sort_order,
467
  'q' => htmlentities( $params['q'] ),
468
- 'page_no' => $params['page_no']
469
  )
470
  )
471
  );
@@ -479,7 +498,8 @@ switch ( $params['order_by'] ) {
479
  </th>
480
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
481
  <a href="
482
- <?php echo esc_url(
 
483
  add_query_arg(
484
  array(
485
  'action' => false,
@@ -488,21 +508,22 @@ switch ( $params['order_by'] ) {
488
  'order_by' => 'user_type',
489
  'sort_order' => $user_type_sort_order,
490
  'q' => htmlentities( $params['q'] ),
491
- 'page_no' => $params['page_no']
492
  )
493
  )
494
  );
495
  ?>
496
  ">
497
  <span>
498
- <?php esc_html_e( 'User Type', 'yop-poll' );?>
499
  </span>
500
  <span class="sorting-indicator"></span>
501
  </a>
502
  </th>
503
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
504
  <a href="
505
- <?php echo esc_url(
 
506
  add_query_arg(
507
  array(
508
  'action' => false,
@@ -511,7 +532,7 @@ switch ( $params['order_by'] ) {
511
  'order_by' => 'ipaddress',
512
  'sort_order' => $ipaddress_sort_order,
513
  'q' => htmlentities( $params['q'] ),
514
- 'page_no' => $params['page_no']
515
  )
516
  )
517
  );
@@ -525,7 +546,8 @@ switch ( $params['order_by'] ) {
525
  </th>
526
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
527
  <a href="
528
- <?php echo esc_url(
 
529
  add_query_arg(
530
  array(
531
  'action' => false,
@@ -534,7 +556,7 @@ switch ( $params['order_by'] ) {
534
  'order_by' => 'added_date',
535
  'sort_order' => $added_date_sort_order,
536
  'q' => htmlentities( $params['q'] ),
537
- 'page_no' => $params['page_no']
538
  )
539
  )
540
  );
@@ -548,7 +570,8 @@ switch ( $params['order_by'] ) {
548
  </th>
549
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $vote_message_column_class ) . ' ' . esc_attr( $vote_message_sort_order_display ); ?>">
550
  <a href="
551
- <?php echo esc_url(
 
552
  add_query_arg(
553
  array(
554
  'action' => false,
@@ -557,7 +580,7 @@ switch ( $params['order_by'] ) {
557
  'order_by' => 'vote_message',
558
  'sort_order' => $vote_message_sort_order,
559
  'q' => htmlentities( $params['q'] ),
560
- 'page_no' => $params['page_no']
561
  )
562
  )
563
  );
@@ -592,7 +615,16 @@ switch ( $params['order_by'] ) {
592
  </h2>
593
  <div class="tablenav-pages">
594
  <span class="displaying-num">
595
- <?php echo sprintf( _n( '%s item', '%s items', $total_logs, 'yop-poll' ), $total_logs ); ?>
 
 
 
 
 
 
 
 
 
596
  </span>
597
  <?php
598
  if ( 1 < $total_pages ) {
141
  </h2>
142
  <div class="tablenav-pages">
143
  <span class="displaying-num">
144
+ <?php
145
+ if (
146
+ ( 0 === intval( $total_logs ) ) ||
147
+ ( intval( $total_logs ) > 1 )
148
+ ) {
149
+ echo esc_html( $total_logs ) . ' ' . esc_html__( 'items' );
150
+ } else {
151
+ echo esc_html( $total_logs ) . ' ' . esc_html__( 'item' );
152
+ }
153
+ ?>
154
  </span>
155
  <?php
156
  if ( 1 < $total_pages ) {
195
  </td>
196
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
197
  <a href="
198
+ <?php
199
+ echo esc_url(
200
  add_query_arg(
201
  array(
202
  'action' => false,
205
  'order_by' => 'name',
206
  'sort_order' => $poll_name_sort_order,
207
  'q' => htmlentities( $params['q'] ),
208
+ 'page_no' => $params['page_no'],
209
  )
210
  )
211
  );
219
  </th>
220
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_id_column_class ) . ' ' . esc_attr( $user_id_sort_order_display ); ?>">
221
  <a href="
222
+ <?php
223
+ echo esc_url(
224
  add_query_arg(
225
  array(
226
  'action' => false,
229
  'order_by' => 'user_id',
230
  'sort_order' => $user_id_sort_order,
231
  'q' => htmlentities( $params['q'] ),
232
+ 'page_no' => $params['page_no'],
233
  )
234
  )
235
  );
243
  </th>
244
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $email_column_class ) . ' ' . esc_attr( $email_sort_order_display ); ?>">
245
  <a href="
246
+ <?php
247
+ echo esc_url(
248
  add_query_arg(
249
  array(
250
  'action' => false,
253
  'order_by' => 'email',
254
  'sort_order' => $email_sort_order,
255
  'q' => htmlentities( $params['q'] ),
256
+ 'page_no' => $params['page_no'],
257
  )
258
  )
259
  );
267
  </th>
268
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
269
  <a href="
270
+ <?php
271
+ echo esc_url(
272
  add_query_arg(
273
  array(
274
  'action' => false,
277
  'order_by' => 'user_type',
278
  'sort_order' => $user_type_sort_order,
279
  'q' => htmlentities( $params['q'] ),
280
+ 'page_no' => $params['page_no'],
281
  )
282
  )
283
  );
291
  </th>
292
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
293
  <a href="
294
+ <?php
295
+ echo esc_url(
296
  add_query_arg(
297
  array(
298
  'action' => false,
301
  'order_by' => 'ipaddress',
302
  'sort_order' => $ipaddress_sort_order,
303
  'q' => htmlentities( $params['q'] ),
304
+ 'page_no' => $params['page_no'],
305
  )
306
  )
307
  );
315
  </th>
316
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
317
  <a href="
318
+ <?php
319
+ echo esc_url(
320
  add_query_arg(
321
  array(
322
  'action' => false,
325
  'order_by' => 'added_date',
326
  'sort_order' => $added_date_sort_order,
327
  'q' => htmlentities( $params['q'] ),
328
+ 'page_no' => $params['page_no'],
329
  )
330
  )
331
  );
339
  </th>
340
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $vote_message_column_class ) . ' ' . esc_attr( $vote_message_sort_order_display ); ?>">
341
  <a href="
342
+ <?php
343
+ echo esc_url(
344
  add_query_arg(
345
  array(
346
  'action' => false,
349
  'order_by' => 'vote_message',
350
  'sort_order' => $vote_message_sort_order,
351
  'q' => htmlentities( $params['q'] ),
352
+ 'page_no' => $params['page_no'],
353
  )
354
  )
355
  );
426
  </td>
427
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $poll_name_column_class ) . ' ' . esc_attr( $poll_name_sort_order_display ); ?>">
428
  <a href="
429
+ <?php
430
+ echo esc_url(
431
  add_query_arg(
432
  array(
433
  'action' => false,
436
  'order_by' => 'name',
437
  'sort_order' => $poll_name_sort_order,
438
  'q' => htmlentities( $params['q'] ),
439
+ 'page_no' => $params['page_no'],
440
  )
441
  )
442
  );
450
  </th>
451
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_id_column_class ) . ' ' . esc_attr( $user_id_sort_order_display ); ?>">
452
  <a href="
453
+ <?php
454
+ echo esc_url(
455
  add_query_arg(
456
  array(
457
  'action' => false,
460
  'order_by' => 'user_id',
461
  'sort_order' => $user_id_sort_order,
462
  'q' => htmlentities( $params['q'] ),
463
+ 'page_no' => $params['page_no'],
464
  )
465
  )
466
  );
474
  </th>
475
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $email_column_class ) . ' ' . esc_attr( $email_sort_order_display ); ?>">
476
  <a href="
477
+ <?php
478
+ echo esc_url(
479
  add_query_arg(
480
  array(
481
  'action' => false,
484
  'order_by' => 'email',
485
  'sort_order' => $email_sort_order,
486
  'q' => htmlentities( $params['q'] ),
487
+ 'page_no' => $params['page_no'],
488
  )
489
  )
490
  );
498
  </th>
499
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
500
  <a href="
501
+ <?php
502
+ echo esc_url(
503
  add_query_arg(
504
  array(
505
  'action' => false,
508
  'order_by' => 'user_type',
509
  'sort_order' => $user_type_sort_order,
510
  'q' => htmlentities( $params['q'] ),
511
+ 'page_no' => $params['page_no'],
512
  )
513
  )
514
  );
515
  ?>
516
  ">
517
  <span>
518
+ <?php esc_html_e( 'User Type', 'yop-poll' ); ?>
519
  </span>
520
  <span class="sorting-indicator"></span>
521
  </a>
522
  </th>
523
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
524
  <a href="
525
+ <?php
526
+ echo esc_url(
527
  add_query_arg(
528
  array(
529
  'action' => false,
532
  'order_by' => 'ipaddress',
533
  'sort_order' => $ipaddress_sort_order,
534
  'q' => htmlentities( $params['q'] ),
535
+ 'page_no' => $params['page_no'],
536
  )
537
  )
538
  );
546
  </th>
547
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
548
  <a href="
549
+ <?php
550
+ echo esc_url(
551
  add_query_arg(
552
  array(
553
  'action' => false,
556
  'order_by' => 'added_date',
557
  'sort_order' => $added_date_sort_order,
558
  'q' => htmlentities( $params['q'] ),
559
+ 'page_no' => $params['page_no'],
560
  )
561
  )
562
  );
570
  </th>
571
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $vote_message_column_class ) . ' ' . esc_attr( $vote_message_sort_order_display ); ?>">
572
  <a href="
573
+ <?php
574
+ echo esc_url(
575
  add_query_arg(
576
  array(
577
  'action' => false,
580
  'order_by' => 'vote_message',
581
  'sort_order' => $vote_message_sort_order,
582
  'q' => htmlentities( $params['q'] ),
583
+ 'page_no' => $params['page_no'],
584
  )
585
  )
586
  );
615
  </h2>
616
  <div class="tablenav-pages">
617
  <span class="displaying-num">
618
+ <?php
619
+ if (
620
+ ( 0 === intval( $total_logs ) ) ||
621
+ ( intval( $total_logs ) > 1 )
622
+ ) {
623
+ echo esc_html( $total_logs ) . ' ' . esc_html__( 'items' );
624
+ } else {
625
+ echo esc_html( $total_logs ) . ' ' . esc_html__( 'item' );
626
+ }
627
+ ?>
628
  </span>
629
  <?php
630
  if ( 1 < $total_pages ) {
admin/views/polls/add/design-custom-styles.php CHANGED
@@ -481,7 +481,7 @@
481
  <div class="form-group">
482
  <label for="">
483
  <?php
484
- esc_html_e ( 'Custom CSS', 'yop-poll' );
485
  ?>
486
  </label>
487
  <textarea id="custom-css" class="form-control custom-styles-custom-css" rows="15" name="custom[css]"></textarea>
481
  <div class="form-group">
482
  <label for="">
483
  <?php
484
+ esc_html_e( 'Custom CSS', 'yop-poll' );
485
  ?>
486
  </label>
487
  <textarea id="custom-css" class="form-control custom-styles-custom-css" rows="15" name="custom[css]"></textarea>
admin/views/polls/add/main.php CHANGED
@@ -227,8 +227,8 @@
227
  </div>
228
  <?php
229
  //$page = rand( 1, 2 );
230
- $page = 1;
231
- if ( 1 === $page ) {
232
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
233
  } else {
234
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
227
  </div>
228
  <?php
229
  //$page = rand( 1, 2 );
230
+ $upgrade_page = 1;
231
+ if ( 1 === $upgrade_page ) {
232
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
233
  } else {
234
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
admin/views/polls/edit/design-predefined-styles.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- switch( $poll->template_base ) {
3
  case 'basic': {
4
  $basic_skins_class = '';
5
  $basic_pretty_skins_class = ' hide';
1
  <?php
2
+ switch ( $poll->template_base ) {
3
  case 'basic': {
4
  $basic_skins_class = '';
5
  $basic_pretty_skins_class = ' hide';
admin/views/polls/edit/main.php CHANGED
@@ -252,8 +252,8 @@ if ( 'custom' === $poll->meta_data['options']['poll']['startDateOption'] ) {
252
  </div>
253
  <?php
254
  //$page = rand( 1, 2 );
255
- $page = 1;
256
- if ( 1 === $page ) {
257
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
258
  } else {
259
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
252
  </div>
253
  <?php
254
  //$page = rand( 1, 2 );
255
+ $upgrade_page = 1;
256
+ if ( 1 === $upgrade_page ) {
257
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
258
  } else {
259
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
admin/views/polls/view.php CHANGED
@@ -153,16 +153,23 @@ switch ( $params['order_by'] ) {
153
  <div id="icon-options-general" class="icon32"></div>
154
  <h1>
155
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
156
- <a href="<?php echo esc_url( add_query_arg(
157
- array(
158
- 'page' => 'yop-poll-add-poll',
159
- 'action' => false,
160
- 'poll_id' => false,
161
- '_token' => false,
162
- 'order_by' => false,
163
- 'sort_order' => false,
164
- 'q' => false
165
- ) ) );?>" class="page-title-action">
 
 
 
 
 
 
 
166
  <?php esc_html_e( 'Add New', 'yop-poll' ); ?>
167
  </a>
168
  </h1>
@@ -171,7 +178,7 @@ switch ( $params['order_by'] ) {
171
  <a href="#" class="current">
172
  <?php esc_html_e( 'All', 'yop-poll' ); ?>
173
  <span class="count">
174
- (<?php echo wp_kses_post( count( $polls) ); ?>)
175
  </span>
176
  </a> |
177
  </li>
@@ -252,7 +259,16 @@ switch ( $params['order_by'] ) {
252
  <button class="button"><?php esc_html_e( 'Set', 'yop-poll' ); ?></button>
253
  </form>
254
  <span class="displaying-num">
255
- <?php echo sprintf( _n( '%s item', '%s items', $total_polls, 'yop-poll' ), $total_polls ); ?>
 
 
 
 
 
 
 
 
 
256
  </span>
257
  <?php
258
  if ( 1 < $total_pages ) {
@@ -297,7 +313,8 @@ switch ( $params['order_by'] ) {
297
  </td>
298
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $name_column_class ) . ' ' . esc_attr( $name_sort_order_display ); ?>">
299
  <a href="
300
- <?php echo esc_url(
 
301
  add_query_arg(
302
  array(
303
  'action' => false,
@@ -306,7 +323,7 @@ switch ( $params['order_by'] ) {
306
  'order_by' => 'name',
307
  'sort_order' => $name_sort_order,
308
  'q' => htmlentities( $params['q'] ),
309
- 'page_no' => $params['page_no']
310
  )
311
  )
312
  );
@@ -325,14 +342,15 @@ switch ( $params['order_by'] ) {
325
  </th>
326
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $status_column_class ) . ' ' . esc_attr( $status_sort_order_display ); ?>">
327
  <a href="
328
- <?php echo esc_url(
 
329
  add_query_arg(
330
  array(
331
  'action' => false,
332
  'poll_id' => false,
333
  '_token' => false,
334
  'order_by' => 'status',
335
- 'sort_order' => $status_sort_order
336
  )
337
  )
338
  );
@@ -351,14 +369,15 @@ switch ( $params['order_by'] ) {
351
  </th>
352
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $total_submits_column_class ) . ' ' . esc_attr( $total_submits_sort_order_display ); ?>">
353
  <a href="
354
- <?php echo esc_url(
 
355
  add_query_arg(
356
  array(
357
  'action' => false,
358
  'poll_id' => false,
359
  '_token' => false,
360
  'order_by' => 'votes',
361
- 'sort_order' => $total_submits_sort_order
362
  )
363
  )
364
  );
@@ -372,35 +391,37 @@ switch ( $params['order_by'] ) {
372
  </th>
373
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
374
  <a href="
375
- <?php echo esc_url(
 
376
  add_query_arg(
377
  array(
378
  'action' => false,
379
  'poll_id' => false,
380
  '_token' => false,
381
  'order_by' => 'votes',
382
- 'sort_order' => $author_sort_order
383
  )
384
  )
385
  );
386
  ?>
387
  ">
388
  <span>
389
- <?php esc_html_e( 'Author', 'yop-poll' );?>
390
  </span>
391
  <span class="sorting-indicator"></span>
392
  </a>
393
  </th>
394
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $start_date_column_class ) . ' ' . esc_attr( $start_date_sort_order_display ); ?>">
395
  <a href="
396
- <?php echo esc_url(
 
397
  add_query_arg(
398
  array(
399
  'action' => false,
400
  'poll_id' => false,
401
  '_token' => false,
402
  'order_by' => 'sdate',
403
- 'sort_order' => $start_date_sort_order
404
  )
405
  )
406
  );
@@ -414,14 +435,15 @@ switch ( $params['order_by'] ) {
414
  </th>
415
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $end_date_column_class ) . ' ' . esc_attr( $end_date_sort_order_display ); ?>">
416
  <a href="
417
- <?php echo esc_url(
 
418
  add_query_arg(
419
  array(
420
  'action' => false,
421
  'poll_id' => false,
422
  '_token' => false,
423
  'order_by' => 'edate',
424
- 'sort_order' => $end_date_sort_order
425
  )
426
  )
427
  );
@@ -471,33 +493,46 @@ switch ( $params['order_by'] ) {
471
  </th>
472
  <td class="title column-title has-row-actions column-primary page-title" data-colname="Title">
473
  <strong>
474
- <a class="row-title" href="<?php echo esc_url( add_query_arg(
475
- array(
476
- 'page' => 'yop-polls',
477
- 'action' => 'edit',
478
- 'poll_id' => $poll['id'],
479
- '_token' => false,
480
- 'order_by' => false,
481
- 'sort_order' => false,
482
- 'q' => false
483
- )
484
- ))?>"
 
 
 
 
 
 
485
  title="<?php esc_html_e( 'Poll name', 'yop-poll' ); ?>">
486
  <?php echo esc_html( $poll['name'] ); ?>
487
  </a>
488
  </strong>
489
  <div class="row-actions">
490
  <span class="edit">
491
- <a href="<?php echo esc_url( add_query_arg(
492
- array(
493
- 'page' => 'yop-polls',
494
- 'action' => 'edit',
495
- 'poll_id' => $poll['id'],
496
- '_token' => false,
497
- 'order_by' => false,
498
- 'sort_order' => false,
499
- 'q' => false
500
- ) ) );?>" title="<?php esc_html_e( 'Edit this poll', 'yop-poll' ); ?>">
 
 
 
 
 
 
 
501
  <?php esc_html_e( 'Edit', 'yop-poll' ); ?>
502
  </a> |
503
  </span>
@@ -518,16 +553,23 @@ switch ( $params['order_by'] ) {
518
  </div>
519
  </td>
520
  <td class="author">
521
- <a href="<?php echo esc_url( add_query_arg(
522
- array(
523
- 'page' => 'yop-polls',
524
- 'action' => 'results',
525
- 'poll_id' => $poll['id'],
526
- '_token' => false,
527
- 'order_by' => false,
528
- 'sort_order' => false,
529
- 'q' => false
530
- ) ) );?>" title="<?php esc_html_e( 'View Results', 'yop-poll' ); ?>">
 
 
 
 
 
 
 
531
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
532
  <path d="M1 11a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-3zm5-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2z"/>
533
  </svg>
@@ -584,40 +626,42 @@ switch ( $params['order_by'] ) {
584
  </td>
585
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $name_column_class ) . ' ' . esc_attr( $name_sort_order_display ); ?>">
586
  <a href="
587
- <?php echo esc_url(
 
588
  add_query_arg(
589
  array(
590
  'action' => false,
591
  'poll_id' => false,
592
  '_token' => false,
593
  'order_by' => 'name',
594
- 'sort_order' => $name_sort_order
595
  )
596
  )
597
  );
598
  ?>
599
  ">
600
  <span>
601
- <?php esc_html_e( 'Title', 'yop-poll' );?>
602
  </span>
603
  <span class="sorting-indicator"></span>
604
  </a>
605
  </th>
606
  <th scope="col" class="manage-column column-title column-primary sorted">
607
  <span>
608
- <?php esc_html_e( 'Results', 'yop-poll' );?>
609
  </span>
610
  </th>
611
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $status_column_class ) . ' ' . esc_attr( $status_sort_order_display ); ?>">
612
  <a href="
613
- <?php echo esc_url(
 
614
  add_query_arg(
615
  array(
616
  'action' => false,
617
  'poll_id' => false,
618
  '_token' => false,
619
  'order_by' => 'status',
620
- 'sort_order' => $status_sort_order
621
  )
622
  )
623
  );
@@ -636,14 +680,15 @@ switch ( $params['order_by'] ) {
636
  </th>
637
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $total_submits_column_class ) . ' ' . esc_attr( $total_submits_sort_order_display ); ?>">
638
  <a href="
639
- <?php echo esc_url(
 
640
  add_query_arg(
641
  array(
642
  'action' => false,
643
  'poll_id' => false,
644
  '_token' => false,
645
  'order_by' => 'votes',
646
- 'sort_order' => $total_submits_sort_order
647
  )
648
  )
649
  );
@@ -657,14 +702,15 @@ switch ( $params['order_by'] ) {
657
  </th>
658
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
659
  <a href="
660
- <?php echo esc_url(
 
661
  add_query_arg(
662
  array(
663
  'action' => false,
664
  'poll_id' => false,
665
  '_token' => false,
666
  'order_by' => 'votes',
667
- 'sort_order' => $author_sort_order
668
  )
669
  )
670
  );
@@ -678,14 +724,15 @@ switch ( $params['order_by'] ) {
678
  </th>
679
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $start_date_column_class ) . ' ' . esc_attr( $start_date_sort_order_display ); ?>">
680
  <a href="
681
- <?php echo esc_url(
 
682
  add_query_arg(
683
  array(
684
  'action' => false,
685
  'poll_id' => false,
686
  '_token' => false,
687
  'order_by' => 'sdate',
688
- 'sort_order' => $start_date_sort_order
689
  )
690
  )
691
  );
@@ -699,14 +746,15 @@ switch ( $params['order_by'] ) {
699
  </th>
700
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $end_date_column_class ) . ' ' . esc_attr( $end_date_sort_order_display ); ?>">
701
  <a href="
702
- <?php echo esc_url(
 
703
  add_query_arg(
704
  array(
705
  'action' => false,
706
  'poll_id' => false,
707
  '_token' => false,
708
  'order_by' => 'edate',
709
- 'sort_order' => $end_date_sort_order
710
  )
711
  )
712
  );
@@ -747,7 +795,16 @@ switch ( $params['order_by'] ) {
747
  </h2>
748
  <div class="tablenav-pages">
749
  <span class="displaying-num">
750
- <?php echo sprintf( _n( '%s item', '%s items', $total_polls, 'yop-poll' ), $total_polls ); ?>
 
 
 
 
 
 
 
 
 
751
  </span>
752
  <?php
753
  if ( 1 < $total_pages ) {
153
  <div id="icon-options-general" class="icon32"></div>
154
  <h1>
155
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
156
+ <a href="
157
+ <?php
158
+ echo esc_url(
159
+ add_query_arg(
160
+ array(
161
+ 'page' => 'yop-poll-add-poll',
162
+ 'action' => false,
163
+ 'poll_id' => false,
164
+ '_token' => false,
165
+ 'order_by' => false,
166
+ 'sort_order' => false,
167
+ 'q' => false,
168
+ )
169
+ )
170
+ );
171
+ ?>
172
+ " class="page-title-action">
173
  <?php esc_html_e( 'Add New', 'yop-poll' ); ?>
174
  </a>
175
  </h1>
178
  <a href="#" class="current">
179
  <?php esc_html_e( 'All', 'yop-poll' ); ?>
180
  <span class="count">
181
+ (<?php echo wp_kses_post( count( $polls ) ); ?>)
182
  </span>
183
  </a> |
184
  </li>
259
  <button class="button"><?php esc_html_e( 'Set', 'yop-poll' ); ?></button>
260
  </form>
261
  <span class="displaying-num">
262
+ <?php
263
+ if (
264
+ ( 0 === intval( $total_polls ) ) ||
265
+ ( intval( $total_polls ) > 1 )
266
+ ) {
267
+ echo esc_html( $total_polls ) . ' ' . esc_html__( 'items' );
268
+ } else {
269
+ echo esc_html( $total_polls ) . ' ' . esc_html__( 'item' );
270
+ }
271
+ ?>
272
  </span>
273
  <?php
274
  if ( 1 < $total_pages ) {
313
  </td>
314
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $name_column_class ) . ' ' . esc_attr( $name_sort_order_display ); ?>">
315
  <a href="
316
+ <?php
317
+ echo esc_url(
318
  add_query_arg(
319
  array(
320
  'action' => false,
323
  'order_by' => 'name',
324
  'sort_order' => $name_sort_order,
325
  'q' => htmlentities( $params['q'] ),
326
+ 'page_no' => $params['page_no'],
327
  )
328
  )
329
  );
342
  </th>
343
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $status_column_class ) . ' ' . esc_attr( $status_sort_order_display ); ?>">
344
  <a href="
345
+ <?php
346
+ echo esc_url(
347
  add_query_arg(
348
  array(
349
  'action' => false,
350
  'poll_id' => false,
351
  '_token' => false,
352
  'order_by' => 'status',
353
+ 'sort_order' => $status_sort_order,
354
  )
355
  )
356
  );
369
  </th>
370
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $total_submits_column_class ) . ' ' . esc_attr( $total_submits_sort_order_display ); ?>">
371
  <a href="
372
+ <?php
373
+ echo esc_url(
374
  add_query_arg(
375
  array(
376
  'action' => false,
377
  'poll_id' => false,
378
  '_token' => false,
379
  'order_by' => 'votes',
380
+ 'sort_order' => $total_submits_sort_order,
381
  )
382
  )
383
  );
391
  </th>
392
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
393
  <a href="
394
+ <?php
395
+ echo esc_url(
396
  add_query_arg(
397
  array(
398
  'action' => false,
399
  'poll_id' => false,
400
  '_token' => false,
401
  'order_by' => 'votes',
402
+ 'sort_order' => $author_sort_order,
403
  )
404
  )
405
  );
406
  ?>
407
  ">
408
  <span>
409
+ <?php esc_html_e( 'Author', 'yop-poll' ); ?>
410
  </span>
411
  <span class="sorting-indicator"></span>
412
  </a>
413
  </th>
414
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $start_date_column_class ) . ' ' . esc_attr( $start_date_sort_order_display ); ?>">
415
  <a href="
416
+ <?php
417
+ echo esc_url(
418
  add_query_arg(
419
  array(
420
  'action' => false,
421
  'poll_id' => false,
422
  '_token' => false,
423
  'order_by' => 'sdate',
424
+ 'sort_order' => $start_date_sort_order,
425
  )
426
  )
427
  );
435
  </th>
436
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $end_date_column_class ) . ' ' . esc_attr( $end_date_sort_order_display ); ?>">
437
  <a href="
438
+ <?php
439
+ echo esc_url(
440
  add_query_arg(
441
  array(
442
  'action' => false,
443
  'poll_id' => false,
444
  '_token' => false,
445
  'order_by' => 'edate',
446
+ 'sort_order' => $end_date_sort_order,
447
  )
448
  )
449
  );
493
  </th>
494
  <td class="title column-title has-row-actions column-primary page-title" data-colname="Title">
495
  <strong>
496
+ <a class="row-title" href="
497
+ <?php
498
+ echo esc_url(
499
+ add_query_arg(
500
+ array(
501
+ 'page' => 'yop-polls',
502
+ 'action' => 'edit',
503
+ 'poll_id' => $poll['id'],
504
+ '_token' => false,
505
+ 'order_by' => false,
506
+ 'sort_order' => false,
507
+ 'q' => false,
508
+ )
509
+ )
510
+ )
511
+ ?>
512
+ "
513
  title="<?php esc_html_e( 'Poll name', 'yop-poll' ); ?>">
514
  <?php echo esc_html( $poll['name'] ); ?>
515
  </a>
516
  </strong>
517
  <div class="row-actions">
518
  <span class="edit">
519
+ <a href="
520
+ <?php
521
+ echo esc_url(
522
+ add_query_arg(
523
+ array(
524
+ 'page' => 'yop-polls',
525
+ 'action' => 'edit',
526
+ 'poll_id' => $poll['id'],
527
+ '_token' => false,
528
+ 'order_by' => false,
529
+ 'sort_order' => false,
530
+ 'q' => false,
531
+ )
532
+ )
533
+ );
534
+ ?>
535
+ " title="<?php esc_html_e( 'Edit this poll', 'yop-poll' ); ?>">
536
  <?php esc_html_e( 'Edit', 'yop-poll' ); ?>
537
  </a> |
538
  </span>
553
  </div>
554
  </td>
555
  <td class="author">
556
+ <a href="
557
+ <?php
558
+ echo esc_url(
559
+ add_query_arg(
560
+ array(
561
+ 'page' => 'yop-polls',
562
+ 'action' => 'results',
563
+ 'poll_id' => $poll['id'],
564
+ '_token' => false,
565
+ 'order_by' => false,
566
+ 'sort_order' => false,
567
+ 'q' => false,
568
+ )
569
+ )
570
+ );
571
+ ?>
572
+ " title="<?php esc_html_e( 'View Results', 'yop-poll' ); ?>">
573
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
574
  <path d="M1 11a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-3zm5-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2z"/>
575
  </svg>
626
  </td>
627
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $name_column_class ) . ' ' . esc_attr( $name_sort_order_display ); ?>">
628
  <a href="
629
+ <?php
630
+ echo esc_url(
631
  add_query_arg(
632
  array(
633
  'action' => false,
634
  'poll_id' => false,
635
  '_token' => false,
636
  'order_by' => 'name',
637
+ 'sort_order' => $name_sort_order,
638
  )
639
  )
640
  );
641
  ?>
642
  ">
643
  <span>
644
+ <?php esc_html_e( 'Title', 'yop-poll' ); ?>
645
  </span>
646
  <span class="sorting-indicator"></span>
647
  </a>
648
  </th>
649
  <th scope="col" class="manage-column column-title column-primary sorted">
650
  <span>
651
+ <?php esc_html_e( 'Results', 'yop-poll' ); ?>
652
  </span>
653
  </th>
654
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $status_column_class ) . ' ' . esc_attr( $status_sort_order_display ); ?>">
655
  <a href="
656
+ <?php
657
+ echo esc_url(
658
  add_query_arg(
659
  array(
660
  'action' => false,
661
  'poll_id' => false,
662
  '_token' => false,
663
  'order_by' => 'status',
664
+ 'sort_order' => $status_sort_order,
665
  )
666
  )
667
  );
680
  </th>
681
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $total_submits_column_class ) . ' ' . esc_attr( $total_submits_sort_order_display ); ?>">
682
  <a href="
683
+ <?php
684
+ echo esc_url(
685
  add_query_arg(
686
  array(
687
  'action' => false,
688
  'poll_id' => false,
689
  '_token' => false,
690
  'order_by' => 'votes',
691
+ 'sort_order' => $total_submits_sort_order,
692
  )
693
  )
694
  );
702
  </th>
703
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $author_column_class ) . ' ' . esc_attr( $author_sort_order_display ); ?>">
704
  <a href="
705
+ <?php
706
+ echo esc_url(
707
  add_query_arg(
708
  array(
709
  'action' => false,
710
  'poll_id' => false,
711
  '_token' => false,
712
  'order_by' => 'votes',
713
+ 'sort_order' => $author_sort_order,
714
  )
715
  )
716
  );
724
  </th>
725
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $start_date_column_class ) . ' ' . esc_attr( $start_date_sort_order_display ); ?>">
726
  <a href="
727
+ <?php
728
+ echo esc_url(
729
  add_query_arg(
730
  array(
731
  'action' => false,
732
  'poll_id' => false,
733
  '_token' => false,
734
  'order_by' => 'sdate',
735
+ 'sort_order' => $start_date_sort_order,
736
  )
737
  )
738
  );
746
  </th>
747
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $end_date_column_class ) . ' ' . esc_attr( $end_date_sort_order_display ); ?>">
748
  <a href="
749
+ <?php
750
+ echo esc_url(
751
  add_query_arg(
752
  array(
753
  'action' => false,
754
  'poll_id' => false,
755
  '_token' => false,
756
  'order_by' => 'edate',
757
+ 'sort_order' => $end_date_sort_order,
758
  )
759
  )
760
  );
795
  </h2>
796
  <div class="tablenav-pages">
797
  <span class="displaying-num">
798
+ <?php
799
+ if (
800
+ ( 0 === intval( $total_polls ) ) ||
801
+ ( intval( $total_polls ) > 1 )
802
+ ) {
803
+ echo esc_html( $total_polls ) . ' ' . esc_html__( 'items' );
804
+ } else {
805
+ echo esc_html( $total_polls ) . ' ' . esc_html__( 'item' );
806
+ }
807
+ ?>
808
  </span>
809
  <?php
810
  if ( 1 < $total_pages ) {
admin/views/results/view.php CHANGED
@@ -3,17 +3,24 @@
3
  <div id="icon-options-general" class="icon32"></div>
4
  <h1>
5
  <span class="glyphicon glyphicon-signal" style="margin-right:10px;"></span><?php esc_html_e( 'Poll results for', 'yop-poll' ); ?> <?php echo esc_html( $poll->name ); ?>
6
- <a href="<?php echo esc_url( add_query_arg(
7
- array(
8
- 'page' => 'yop-polls',
9
- 'action' => false,
10
- 'poll_id' => false,
11
- '_token' => false,
12
- 'order_by' => false,
13
- 'sort_order' => false,
14
- 'q' => false,
15
- 'exportCustoms' => false,
16
- ) ) );?>" class="page-title-action">
 
 
 
 
 
 
 
17
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
18
  </a>
19
  </h1>
@@ -25,17 +32,24 @@
25
  </a>
26
  </div>
27
  <div class="col-md-4">
28
- <a href="<?php echo esc_url( add_query_arg(
29
- array(
30
- 'page' => 'yop-polls',
31
- 'action' => 'view-votes',
32
- 'poll_id' => $poll->id,
33
- '_token' => false,
34
- 'order_by' => false,
35
- 'sort_order' => false,
36
- 'q' => false,
37
- 'exportCustoms' => false,
38
- ))); ?>" class="btn btn-link btn-block">
 
 
 
 
 
 
 
39
  <?php esc_html_e( 'View votes', 'yop-poll' ); ?>
40
  </a>
41
  </div>
@@ -45,18 +59,21 @@
45
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
46
  <div class="panel-group" id="accordion">
47
  <?php
48
- $custom_fields = [];
49
  $x = 0;
50
  foreach ( $poll->elements as $element ) {
51
- if ( ('text-question' === $element->etype ) || ( 'media-question' === $element->etype ) ) {
52
  $answersArray = YOP_Poll_Helper::objectToArray( $element->answers );
53
- usort( $answersArray, function( $a, $b ) {
54
- return $b['total_submits'] - $a['total_submits'];
55
- });
56
- $data = [];
57
- $labels = [];
58
- $resultsColors = [];
59
- $icons = [];
 
 
 
60
  foreach ( $answersArray as $a ) {
61
  $data[] = $a['total_submits'];
62
  if ( 0 == $a['author'] ) {
@@ -148,7 +165,9 @@
148
  foreach ( $answersArray as $answer ) {
149
  ?>
150
  <?php
151
- if ( 0 == $z && $answer['total_submits'] > 0 ) echo '<span class="dashicons dashicons-awards"></span>&nbsp;';
 
 
152
  ?>
153
  <?php
154
  switch ( $answer['stype'] ) {
@@ -190,7 +209,7 @@
190
  $percentage = $answer['total_submits'] / $total_votes_per_question[$element->id] * 100;
191
  echo '&nbsp;';
192
  echo esc_html( number_format( $percentage, 2, '.', '' ) . '%' . " ({$answer['total_submits']}" );
193
- if ( $answer['total_submits'] > 1 || 0 == $answer['total_submits'] ) {
194
  esc_html_e( ' votes', 'yop-poll' );
195
  } else {
196
  esc_html_e( ' vote', 'yop-poll' );
@@ -210,7 +229,7 @@
210
  }
211
  $total_others = 0;
212
  foreach ( $other_answers as $key => $value ) {
213
- if ( $key == $element->id ) {
214
  $total_others += count( $value );
215
  }
216
  }
@@ -255,12 +274,15 @@
255
  foreach ( $total_votes_for_question_array as $key => $value ) {
256
  $total_votes_for_question += $value;
257
  }
258
- uasort($total_votes_for_question_array, function( $a, $b ) {
259
- return $b - $a;
260
- });
261
- $voters_data = [];
262
- $voters_labels = [];
263
- $voters_colors = [];
 
 
 
264
  foreach ( $total_votes_for_question_array as $key => $value ) {
265
  $voters_labels[] = $key;
266
  $voters_data[] = $value;
@@ -272,7 +294,11 @@
272
  <?php
273
  foreach ( $total_votes_for_question_array as $key => $value ) {
274
  ?>
275
- <?php if ( 0 == $z ) echo '<span class="dashicons dashicons-awards"></span>&nbsp;'; ?>
 
 
 
 
276
  <label>
277
  <?php
278
  echo esc_attr( $key );
@@ -284,7 +310,7 @@
284
  $percentage = $value / $total_votes_for_question * 100;
285
  echo '&nbsp;';
286
  echo esc_html( number_format( $percentage, 2, '.', '' ) . '%' . " ({$value}" );
287
- if ( $total_votes_for_question > 1 || 0 == $total_votes_for_question ) {
288
  esc_html_e( ' votes', 'yop-poll' );
289
  } else {
290
  esc_html_e( ' vote', 'yop-poll' );
@@ -313,7 +339,10 @@
313
  <?php
314
  $x++;
315
  } elseif ( 'custom-field' === $element->etype ) {
316
- $custom_fields[] = [ 'id' => $element->id, 'cftext' => $element->etext ];
 
 
 
317
  }
318
  }
319
  if ( count( $custom_fields ) > 0 ) {
3
  <div id="icon-options-general" class="icon32"></div>
4
  <h1>
5
  <span class="glyphicon glyphicon-signal" style="margin-right:10px;"></span><?php esc_html_e( 'Poll results for', 'yop-poll' ); ?> <?php echo esc_html( $poll->name ); ?>
6
+ <a href="
7
+ <?php
8
+ echo esc_url(
9
+ add_query_arg(
10
+ array(
11
+ 'page' => 'yop-polls',
12
+ 'action' => false,
13
+ 'poll_id' => false,
14
+ '_token' => false,
15
+ 'order_by' => false,
16
+ 'sort_order' => false,
17
+ 'q' => false,
18
+ 'exportCustoms' => false,
19
+ )
20
+ )
21
+ );
22
+ ?>
23
+ " class="page-title-action">
24
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
25
  </a>
26
  </h1>
32
  </a>
33
  </div>
34
  <div class="col-md-4">
35
+ <a href="
36
+ <?php
37
+ echo esc_url(
38
+ add_query_arg(
39
+ array(
40
+ 'page' => 'yop-polls',
41
+ 'action' => 'view-votes',
42
+ 'poll_id' => $poll->id,
43
+ '_token' => false,
44
+ 'order_by' => false,
45
+ 'sort_order' => false,
46
+ 'q' => false,
47
+ 'exportCustoms' => false,
48
+ )
49
+ )
50
+ );
51
+ ?>
52
+ " class="btn btn-link btn-block">
53
  <?php esc_html_e( 'View votes', 'yop-poll' ); ?>
54
  </a>
55
  </div>
59
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
60
  <div class="panel-group" id="accordion">
61
  <?php
62
+ $custom_fields = array();
63
  $x = 0;
64
  foreach ( $poll->elements as $element ) {
65
+ if ( ( 'text-question' === $element->etype ) || ( 'media-question' === $element->etype ) ) {
66
  $answersArray = YOP_Poll_Helper::objectToArray( $element->answers );
67
+ usort(
68
+ $answersArray,
69
+ function( $a, $b ) {
70
+ return $b['total_submits'] - $a['total_submits'];
71
+ }
72
+ );
73
+ $data = array();
74
+ $labels = array();
75
+ $resultsColors = array();
76
+ $icons = array();
77
  foreach ( $answersArray as $a ) {
78
  $data[] = $a['total_submits'];
79
  if ( 0 == $a['author'] ) {
165
  foreach ( $answersArray as $answer ) {
166
  ?>
167
  <?php
168
+ if ( 0 == $z && $answer['total_submits'] > 0 ) {
169
+ echo '<span class="dashicons dashicons-awards"></span>&nbsp;';
170
+ }
171
  ?>
172
  <?php
173
  switch ( $answer['stype'] ) {
209
  $percentage = $answer['total_submits'] / $total_votes_per_question[$element->id] * 100;
210
  echo '&nbsp;';
211
  echo esc_html( number_format( $percentage, 2, '.', '' ) . '%' . " ({$answer['total_submits']}" );
212
+ if ( $answer['total_submits'] > 1 || 0 == $answer['total_submits'] ) {
213
  esc_html_e( ' votes', 'yop-poll' );
214
  } else {
215
  esc_html_e( ' vote', 'yop-poll' );
229
  }
230
  $total_others = 0;
231
  foreach ( $other_answers as $key => $value ) {
232
+ if ( $key == $element->id ) {
233
  $total_others += count( $value );
234
  }
235
  }
274
  foreach ( $total_votes_for_question_array as $key => $value ) {
275
  $total_votes_for_question += $value;
276
  }
277
+ uasort(
278
+ $total_votes_for_question_array,
279
+ function( $a, $b ) {
280
+ return $b - $a;
281
+ }
282
+ );
283
+ $voters_data = array();
284
+ $voters_labels = array();
285
+ $voters_colors = array();
286
  foreach ( $total_votes_for_question_array as $key => $value ) {
287
  $voters_labels[] = $key;
288
  $voters_data[] = $value;
294
  <?php
295
  foreach ( $total_votes_for_question_array as $key => $value ) {
296
  ?>
297
+ <?php
298
+ if ( 0 == $z ) {
299
+ echo '<span class="dashicons dashicons-awards"></span>&nbsp;';
300
+ }
301
+ ?>
302
  <label>
303
  <?php
304
  echo esc_attr( $key );
310
  $percentage = $value / $total_votes_for_question * 100;
311
  echo '&nbsp;';
312
  echo esc_html( number_format( $percentage, 2, '.', '' ) . '%' . " ({$value}" );
313
+ if ( $total_votes_for_question > 1 || 0 == $total_votes_for_question ) {
314
  esc_html_e( ' votes', 'yop-poll' );
315
  } else {
316
  esc_html_e( ' vote', 'yop-poll' );
339
  <?php
340
  $x++;
341
  } elseif ( 'custom-field' === $element->etype ) {
342
+ $custom_fields[] = array(
343
+ 'id' => $element->id,
344
+ 'cftext' => $element->etext,
345
+ );
346
  }
347
  }
348
  if ( count( $custom_fields ) > 0 ) {
admin/views/results/votes.php CHANGED
@@ -81,34 +81,48 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
81
  <div id="icon-options-general" class="icon32"></div>
82
  <h1>
83
  <span class="glyphicon glyphicon-signal" style="margin-right:10px;"></span><?php esc_html_e( 'Poll results for', 'yop-poll' ); ?> <?php echo esc_html( $poll->name ); ?>
84
- <a href="<?php echo esc_url( add_query_arg(
85
- array(
86
- 'page' => 'yop-polls',
87
- 'action' => false,
88
- 'poll_id' => false,
89
- '_token' => false,
90
- 'order_by' => false,
91
- 'sort_order' => false,
92
- 'q' => false,
93
- 'exportCustoms' => false,
94
- ) ) );?>" class="page-title-action">
 
 
 
 
 
 
 
95
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
96
  </a>
97
  </h1>
98
  <div class="container-fluid">
99
  <div class="row submenu" style="margin-top:30px; margin-bottom: 50px;">
100
  <div class="col-md-4">
101
- <a href="<?php echo esc_url( add_query_arg(
102
- array(
103
- 'page' => 'yop-polls',
104
- 'action' => 'results',
105
- 'poll_id' => $poll->id,
106
- '_token' => false,
107
- 'order_by' => false,
108
- 'sort_order' => false,
109
- 'q' => false,
110
- 'exportCustoms' => false
111
- ) ) ); ?>" class="btn btn-link btn-block">
 
 
 
 
 
 
 
112
  <?php esc_html_e( 'Results', 'yop-poll' ); ?>
113
  </a>
114
  </div>
@@ -225,7 +239,16 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
225
  </h2>
226
  <div class="tablenav-pages">
227
  <span class="displaying-num">
228
- <?php echo sprintf( _n( '%s item', '%s items', count( $votes ), 'yop-poll' ), count( $votes ) ); ?>
 
 
 
 
 
 
 
 
 
229
  </span>
230
  <?php
231
  if ( 1 < $total_pages ) {
@@ -270,20 +293,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
270
  </td>
271
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
272
  <a href="
273
- <?php echo esc_url(
274
- add_query_arg(
275
- array(
276
- 'action' => 'view-votes',
277
- 'poll_id' => $poll->id,
278
- '_token' => false,
279
- 'order_by' => 'user_type',
280
- 'sort_order' => $user_type_sort_order,
281
- 'q' => sanitize_text_field( $params['q'] ),
282
- 'page_no' => sanitize_text_field( $params['page_no'] )
283
- )
284
- )
285
- );
286
- ?>
 
287
  ">
288
  <span>
289
  <?php esc_html_e( 'User Type', 'yop-poll' ); ?>
@@ -293,20 +317,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
293
  </th>
294
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $username_column_class ) . ' ' . esc_attr( $username_sort_order_display ); ?>">
295
  <a href="
296
- <?php echo esc_url(
297
- add_query_arg(
298
- array(
299
- 'action' => 'view-votes',
300
- 'poll_id' => $poll->id,
301
- '_token' => false,
302
- 'order_by' => 'username',
303
- 'sort_order' => $username_sort_order,
304
- 'q' => sanitize_text_field( $params['q'] ),
305
- 'page_no' => sanitize_text_field( $params['page_no'] )
306
- )
307
- )
308
- );
309
- ?>
 
310
  ">
311
  <span>
312
  <?php esc_html_e( 'Username', 'yop-poll' ); ?>
@@ -316,20 +341,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
316
  </th>
317
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_email_column_class ) . ' ' . esc_attr( $user_email_sort_order_display ); ?>">
318
  <a href="
319
- <?php echo esc_url(
320
- add_query_arg(
321
- array(
322
- 'action' => 'view-votes',
323
- 'poll_id' => $poll->id,
324
- '_token' => false,
325
- 'order_by' => 'user_email',
326
- 'sort_order' => $user_email_sort_order,
327
- 'q' => sanitize_text_field( $params['q'] ),
328
- 'page_no' => sanitize_text_field( $params['page_no'] )
329
- )
330
- )
331
- );
332
- ?>
 
333
  ">
334
  <span>
335
  <?php esc_html_e( 'Email', 'yop-poll' ); ?>
@@ -339,20 +365,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
339
  </th>
340
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
341
  <a href="
342
- <?php echo esc_url(
343
- add_query_arg(
344
- array(
345
- 'action' => 'view-votes',
346
- 'poll_id' => $poll->id,
347
- '_token' => false,
348
- 'order_by' => 'ipaddress',
349
- 'sort_order' => $ipaddress_sort_order,
350
- 'q' => sanitize_text_field( $params['q'] ),
351
- 'page_no' => sanitize_text_field( $params['page_no'] )
352
- )
353
- )
354
- );
355
- ?>
 
356
  ">
357
  <span>
358
  <?php esc_html_e( 'Ipaddress', 'yop-poll' ); ?>
@@ -362,20 +389,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
362
  </th>
363
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
364
  <a href="
365
- <?php echo esc_url(
366
- add_query_arg(
367
- array(
368
- 'action' => 'view-votes',
369
- 'poll_id' => $poll->id,
370
- '_token' => false,
371
- 'order_by' => 'added_date',
372
- 'sort_order' => $added_date_sort_order,
373
- 'q' => sanitize_text_field( $params['q'] ),
374
- 'page_no' => sanitize_text_field( $params['page_no'] )
375
- )
376
- )
377
- );
378
- ?>
 
379
  ">
380
  <span>
381
  <?php esc_html_e( 'Date', 'yop-poll' ); ?>
@@ -440,20 +468,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
440
  </td>
441
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
442
  <a href="
443
- <?php echo esc_url(
444
- add_query_arg(
445
- array(
446
- 'action' => 'view-votes',
447
- 'poll_id' => $poll->id,
448
- '_token' => false,
449
- 'order_by' => 'user_type',
450
- 'sort_order' => $user_type_sort_order,
451
- 'q' => sanitize_text_field( $params['q'] ),
452
- 'page_no' => sanitize_text_field( $params['page_no'] )
453
- )
454
- )
455
- );
456
- ?>
 
457
  ">
458
  <span>
459
  <?php esc_html_e( 'User Type', 'yop-poll' ); ?>
@@ -463,20 +492,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
463
  </th>
464
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $username_column_class ) . ' ' . esc_attr( $username_sort_order_display ); ?>">
465
  <a href="
466
- <?php echo esc_url(
467
- add_query_arg(
468
- array(
469
- 'action' => 'view-votes',
470
- 'poll_id' => $poll->id,
471
- '_token' => false,
472
- 'order_by' => 'username',
473
- 'sort_order' => $username_sort_order,
474
- 'q' => sanitize_text_field( $params['q'] ),
475
- 'page_no' => sanitize_text_field( $params['page_no'] )
476
- )
477
- )
478
- );
479
- ?>
 
480
  ">
481
  <span>
482
  <?php esc_html_e( 'Username', 'yop-poll' ); ?>
@@ -486,20 +516,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
486
  </th>
487
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_email_column_class ) . ' ' . esc_attr( $user_email_sort_order_display ); ?>">
488
  <a href="
489
- <?php echo esc_url(
490
- add_query_arg(
491
- array(
492
- 'action' => 'view-votes',
493
- 'poll_id' => $poll->id,
494
- '_token' => false,
495
- 'order_by' => 'user_email',
496
- 'sort_order' => $user_email_sort_order,
497
- 'q' => sanitize_text_field( $params['q'] ),
498
- 'page_no' => sanitize_text_field( $params['page_no'] )
499
- )
500
- )
501
- );
502
- ?>
 
503
  ">
504
  <span>
505
  <?php esc_html_e( 'Email', 'yop-poll' ); ?>
@@ -509,20 +540,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
509
  </th>
510
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
511
  <a href="
512
- <?php echo esc_url(
513
- add_query_arg(
514
- array(
515
- 'action' => 'view-votes',
516
- 'poll_id' => $poll->id,
517
- '_token' => false,
518
- 'order_by' => 'ipaddress',
519
- 'sort_order' => $ipaddress_sort_order,
520
- 'q' => sanitize_text_field( $params['q'] ),
521
- 'page_no' => sanitize_text_field( $params['page_no'] )
522
- )
523
- )
524
- );
525
- ?>
 
526
  ">
527
  <span>
528
  <?php esc_html_e( 'Ipaddress', 'yop-poll' ); ?>
@@ -532,20 +564,21 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
532
  </th>
533
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
534
  <a href="
535
- <?php echo esc_url(
536
- add_query_arg(
537
- array(
538
- 'action' => 'view-votes',
539
- 'poll_id' => $poll->id,
540
- '_token' => false,
541
- 'order_by' => 'added_date',
542
- 'sort_order' => $added_date_sort_order,
543
- 'q' => sanitize_text_field( $params['q'] ),
544
- 'page_no' => sanitize_text_field( $params['page_no'] )
545
- )
546
- )
547
- );
548
- ?>
 
549
  ">
550
  <span>
551
  <?php esc_html_e( 'Date', 'yop-poll' ); ?>
@@ -576,7 +609,16 @@ $search_value = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'
576
  </h2>
577
  <div class="tablenav-pages">
578
  <span class="displaying-num">
579
- <?php echo sprintf( _n( '%s item', '%s items', count( $votes ), 'yop-poll' ), count( $votes ) ); ?>
 
 
 
 
 
 
 
 
 
580
  </span>
581
  <?php
582
  if ( 1 < $total_pages ) {
81
  <div id="icon-options-general" class="icon32"></div>
82
  <h1>
83
  <span class="glyphicon glyphicon-signal" style="margin-right:10px;"></span><?php esc_html_e( 'Poll results for', 'yop-poll' ); ?> <?php echo esc_html( $poll->name ); ?>
84
+ <a href="
85
+ <?php
86
+ echo esc_url(
87
+ add_query_arg(
88
+ array(
89
+ 'page' => 'yop-polls',
90
+ 'action' => false,
91
+ 'poll_id' => false,
92
+ '_token' => false,
93
+ 'order_by' => false,
94
+ 'sort_order' => false,
95
+ 'q' => false,
96
+ 'exportCustoms' => false,
97
+ )
98
+ )
99
+ );
100
+ ?>
101
+ " class="page-title-action">
102
  <?php esc_html_e( 'All Polls', 'yop-poll' ); ?>
103
  </a>
104
  </h1>
105
  <div class="container-fluid">
106
  <div class="row submenu" style="margin-top:30px; margin-bottom: 50px;">
107
  <div class="col-md-4">
108
+ <a href="
109
+ <?php
110
+ echo esc_url(
111
+ add_query_arg(
112
+ array(
113
+ 'page' => 'yop-polls',
114
+ 'action' => 'results',
115
+ 'poll_id' => $poll->id,
116
+ '_token' => false,
117
+ 'order_by' => false,
118
+ 'sort_order' => false,
119
+ 'q' => false,
120
+ 'exportCustoms' => false,
121
+ )
122
+ )
123
+ );
124
+ ?>
125
+ " class="btn btn-link btn-block">
126
  <?php esc_html_e( 'Results', 'yop-poll' ); ?>
127
  </a>
128
  </div>
239
  </h2>
240
  <div class="tablenav-pages">
241
  <span class="displaying-num">
242
+ <?php
243
+ if (
244
+ ( 0 === intval( $total_votes ) ) ||
245
+ ( intval( $total_votes ) > 1 )
246
+ ) {
247
+ echo esc_html( $total_votes ) . ' ' . esc_html__( 'items' );
248
+ } else {
249
+ echo esc_html( $total_votes ) . ' ' . esc_html__( 'item' );
250
+ }
251
+ ?>
252
  </span>
253
  <?php
254
  if ( 1 < $total_pages ) {
293
  </td>
294
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
295
  <a href="
296
+ <?php
297
+ echo esc_url(
298
+ add_query_arg(
299
+ array(
300
+ 'action' => 'view-votes',
301
+ 'poll_id' => $poll->id,
302
+ '_token' => false,
303
+ 'order_by' => 'user_type',
304
+ 'sort_order' => $user_type_sort_order,
305
+ 'q' => sanitize_text_field( $params['q'] ),
306
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
307
+ )
308
+ )
309
+ );
310
+ ?>
311
  ">
312
  <span>
313
  <?php esc_html_e( 'User Type', 'yop-poll' ); ?>
317
  </th>
318
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $username_column_class ) . ' ' . esc_attr( $username_sort_order_display ); ?>">
319
  <a href="
320
+ <?php
321
+ echo esc_url(
322
+ add_query_arg(
323
+ array(
324
+ 'action' => 'view-votes',
325
+ 'poll_id' => $poll->id,
326
+ '_token' => false,
327
+ 'order_by' => 'username',
328
+ 'sort_order' => $username_sort_order,
329
+ 'q' => sanitize_text_field( $params['q'] ),
330
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
331
+ )
332
+ )
333
+ );
334
+ ?>
335
  ">
336
  <span>
337
  <?php esc_html_e( 'Username', 'yop-poll' ); ?>
341
  </th>
342
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_email_column_class ) . ' ' . esc_attr( $user_email_sort_order_display ); ?>">
343
  <a href="
344
+ <?php
345
+ echo esc_url(
346
+ add_query_arg(
347
+ array(
348
+ 'action' => 'view-votes',
349
+ 'poll_id' => $poll->id,
350
+ '_token' => false,
351
+ 'order_by' => 'user_email',
352
+ 'sort_order' => $user_email_sort_order,
353
+ 'q' => sanitize_text_field( $params['q'] ),
354
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
355
+ )
356
+ )
357
+ );
358
+ ?>
359
  ">
360
  <span>
361
  <?php esc_html_e( 'Email', 'yop-poll' ); ?>
365
  </th>
366
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
367
  <a href="
368
+ <?php
369
+ echo esc_url(
370
+ add_query_arg(
371
+ array(
372
+ 'action' => 'view-votes',
373
+ 'poll_id' => $poll->id,
374
+ '_token' => false,
375
+ 'order_by' => 'ipaddress',
376
+ 'sort_order' => $ipaddress_sort_order,
377
+ 'q' => sanitize_text_field( $params['q'] ),
378
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
379
+ )
380
+ )
381
+ );
382
+ ?>
383
  ">
384
  <span>
385
  <?php esc_html_e( 'Ipaddress', 'yop-poll' ); ?>
389
  </th>
390
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
391
  <a href="
392
+ <?php
393
+ echo esc_url(
394
+ add_query_arg(
395
+ array(
396
+ 'action' => 'view-votes',
397
+ 'poll_id' => $poll->id,
398
+ '_token' => false,
399
+ 'order_by' => 'added_date',
400
+ 'sort_order' => $added_date_sort_order,
401
+ 'q' => sanitize_text_field( $params['q'] ),
402
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
403
+ )
404
+ )
405
+ );
406
+ ?>
407
  ">
408
  <span>
409
  <?php esc_html_e( 'Date', 'yop-poll' ); ?>
468
  </td>
469
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_type_column_class ) . ' ' . esc_attr( $user_type_sort_order_display ); ?>">
470
  <a href="
471
+ <?php
472
+ echo esc_url(
473
+ add_query_arg(
474
+ array(
475
+ 'action' => 'view-votes',
476
+ 'poll_id' => $poll->id,
477
+ '_token' => false,
478
+ 'order_by' => 'user_type',
479
+ 'sort_order' => $user_type_sort_order,
480
+ 'q' => sanitize_text_field( $params['q'] ),
481
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
482
+ )
483
+ )
484
+ );
485
+ ?>
486
  ">
487
  <span>
488
  <?php esc_html_e( 'User Type', 'yop-poll' ); ?>
492
  </th>
493
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $username_column_class ) . ' ' . esc_attr( $username_sort_order_display ); ?>">
494
  <a href="
495
+ <?php
496
+ echo esc_url(
497
+ add_query_arg(
498
+ array(
499
+ 'action' => 'view-votes',
500
+ 'poll_id' => $poll->id,
501
+ '_token' => false,
502
+ 'order_by' => 'username',
503
+ 'sort_order' => $username_sort_order,
504
+ 'q' => sanitize_text_field( $params['q'] ),
505
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
506
+ )
507
+ )
508
+ );
509
+ ?>
510
  ">
511
  <span>
512
  <?php esc_html_e( 'Username', 'yop-poll' ); ?>
516
  </th>
517
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $user_email_column_class ) . ' ' . esc_attr( $user_email_sort_order_display ); ?>">
518
  <a href="
519
+ <?php
520
+ echo esc_url(
521
+ add_query_arg(
522
+ array(
523
+ 'action' => 'view-votes',
524
+ 'poll_id' => $poll->id,
525
+ '_token' => false,
526
+ 'order_by' => 'user_email',
527
+ 'sort_order' => $user_email_sort_order,
528
+ 'q' => sanitize_text_field( $params['q'] ),
529
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
530
+ )
531
+ )
532
+ );
533
+ ?>
534
  ">
535
  <span>
536
  <?php esc_html_e( 'Email', 'yop-poll' ); ?>
540
  </th>
541
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $ipaddress_column_class ) . ' ' . esc_attr( $ipaddress_sort_order_display ); ?>">
542
  <a href="
543
+ <?php
544
+ echo esc_url(
545
+ add_query_arg(
546
+ array(
547
+ 'action' => 'view-votes',
548
+ 'poll_id' => $poll->id,
549
+ '_token' => false,
550
+ 'order_by' => 'ipaddress',
551
+ 'sort_order' => $ipaddress_sort_order,
552
+ 'q' => sanitize_text_field( $params['q'] ),
553
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
554
+ )
555
+ )
556
+ );
557
+ ?>
558
  ">
559
  <span>
560
  <?php esc_html_e( 'Ipaddress', 'yop-poll' ); ?>
564
  </th>
565
  <th scope="col" class="manage-column column-title column-primary <?php echo esc_attr( $added_date_column_class ) . ' ' . esc_attr( $added_date_sort_order_display ); ?>">
566
  <a href="
567
+ <?php
568
+ echo esc_url(
569
+ add_query_arg(
570
+ array(
571
+ 'action' => 'view-votes',
572
+ 'poll_id' => $poll->id,
573
+ '_token' => false,
574
+ 'order_by' => 'added_date',
575
+ 'sort_order' => $added_date_sort_order,
576
+ 'q' => sanitize_text_field( $params['q'] ),
577
+ 'page_no' => sanitize_text_field( $params['page_no'] ),
578
+ )
579
+ )
580
+ );
581
+ ?>
582
  ">
583
  <span>
584
  <?php esc_html_e( 'Date', 'yop-poll' ); ?>
609
  </h2>
610
  <div class="tablenav-pages">
611
  <span class="displaying-num">
612
+ <?php
613
+ if (
614
+ ( 0 === intval( $total_votes ) ) ||
615
+ ( intval( $total_votes ) > 1 )
616
+ ) {
617
+ echo esc_html( $total_votes ) . ' ' . esc_html__( 'items' );
618
+ } else {
619
+ echo esc_html( $total_votes ) . ' ' . esc_html__( 'item' );
620
+ }
621
+ ?>
622
  </span>
623
  <?php
624
  if ( 1 < $total_pages ) {
admin/views/settings/view.php CHANGED
@@ -98,7 +98,7 @@
98
  <label for="email-recipients">
99
  <?php esc_html_e( 'Recipients', 'yop-poll' ); ?>
100
  </label>
101
- <div><?php esc_html_e( 'Use comma separated email addresses: email@xmail.com,email2@ymail.com', 'yop-poll' ) ?></div>
102
  <input class="form-control settings-required-field" name="email-recipients" id="email-recipients" value="<?php echo isset( $settings['notifications']['new-vote']['recipients'] ) ? esc_attr( $settings['notifications']['new-vote']['recipients'] ) : ''; ?>">
103
  </div>
104
  <div class="form-group">
@@ -320,7 +320,7 @@
320
  </select>
321
  </div>
322
  </div>
323
- <div class="row submenu integrations-facebook-section <?php echo esc_attr( $facebook_data_section ) ?>" style="padding-top: 20px; margin-left: 20px;">
324
  <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 input-caption">
325
  <?php esc_html_e( '- App ID:', 'yop-poll' ); ?>
326
  </div>
@@ -663,8 +663,8 @@
663
  </div>
664
  <?php
665
  //$page = rand( 1, 2 );
666
- $page = 1;
667
- if ( 1 === $page ) {
668
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
669
  } else {
670
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
98
  <label for="email-recipients">
99
  <?php esc_html_e( 'Recipients', 'yop-poll' ); ?>
100
  </label>
101
+ <div><?php esc_html_e( 'Use comma separated email addresses: email@xmail.com,email2@ymail.com', 'yop-poll' ); ?></div>
102
  <input class="form-control settings-required-field" name="email-recipients" id="email-recipients" value="<?php echo isset( $settings['notifications']['new-vote']['recipients'] ) ? esc_attr( $settings['notifications']['new-vote']['recipients'] ) : ''; ?>">
103
  </div>
104
  <div class="form-group">
320
  </select>
321
  </div>
322
  </div>
323
+ <div class="row submenu integrations-facebook-section <?php echo esc_attr( $facebook_data_section ); ?>" style="padding-top: 20px; margin-left: 20px;">
324
  <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 input-caption">
325
  <?php esc_html_e( '- App ID:', 'yop-poll' ); ?>
326
  </div>
663
  </div>
664
  <?php
665
  //$page = rand( 1, 2 );
666
+ $upgrade_page = 1;
667
+ if ( 1 === $upgrade_page ) {
668
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-1.php';
669
  } else {
670
  include YOP_POLL_PATH . 'admin/views/general/upgrade-short-2.php';
app.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  include( 'public/inc/Captcha.php' );
3
  include( 'public/inc/Session.php' );
4
- if ( !function_exists( 'getallheaders' ) ) {
5
  function getallheaders() {
6
  $headers = [];
7
  foreach ( $_SERVER as $name => $value ) {
@@ -41,11 +41,11 @@ switch ( $_action ) {
41
  case 'image': {
42
  $captcha = new \visualCaptcha\Captcha( $session, __DIR__ . '/public/assets/captcha' );
43
  $_id = isset( $_GET['_id'] ) ? filter_input( INPUT_GET, '_id', FILTER_SANITIZE_NUMBER_INT ) : '';
44
- if ( !$captcha->streamImage(
45
  getallheaders(),
46
  $_id,
47
  0
48
- )) {
49
  if ( 0 !== ob_get_level() ) {
50
  ob_clean();
51
  }
@@ -54,7 +54,7 @@ switch ( $_action ) {
54
  }
55
  case 'audio': {
56
  $captcha = new \visualCaptcha\Captcha( $session, __DIR__ . '/public/assets/captcha' );
57
- if ( !$captcha->streamAudio( getallheaders(), 'mp3' ) ) {
58
  if ( 0 !== ob_get_level() ) {
59
  ob_clean();
60
  }
1
  <?php
2
  include( 'public/inc/Captcha.php' );
3
  include( 'public/inc/Session.php' );
4
+ if ( ! function_exists( 'getallheaders' ) ) {
5
  function getallheaders() {
6
  $headers = [];
7
  foreach ( $_SERVER as $name => $value ) {
41
  case 'image': {
42
  $captcha = new \visualCaptcha\Captcha( $session, __DIR__ . '/public/assets/captcha' );
43
  $_id = isset( $_GET['_id'] ) ? filter_input( INPUT_GET, '_id', FILTER_SANITIZE_NUMBER_INT ) : '';
44
+ if ( ! $captcha->streamImage(
45
  getallheaders(),
46
  $_id,
47
  0
48
+ ) ) {
49
  if ( 0 !== ob_get_level() ) {
50
  ob_clean();
51
  }
54
  }
55
  case 'audio': {
56
  $captcha = new \visualCaptcha\Captcha( $session, __DIR__ . '/public/assets/captcha' );
57
+ if ( ! $captcha->streamAudio( getallheaders(), 'mp3' ) ) {
58
  if ( 0 !== ob_get_level() ) {
59
  ob_clean();
60
  }
languages/yop-poll.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL2.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: YOP Poll 6.4.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/yop-poll-free\n"
7
- "POT-Creation-Date: 2022-07-06 08:46:46+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -75,295 +75,295 @@ msgstr ""
75
  msgid "Skip and Deactivate"
76
  msgstr ""
77
 
78
- #: admin/admin.php:389 admin/admin.php:390
79
  msgid "Yop Poll"
80
  msgstr ""
81
 
82
- #: admin/admin.php:403 admin/admin.php:404 admin/admin.php:707
83
  #: admin/views/bans/add.php:23 admin/views/bans/edit.php:27
84
  #: admin/views/bans/edit.php:35 admin/views/polls/view.php:155
85
- #: admin/views/results/view.php:17 admin/views/results/votes.php:95
86
  msgid "All Polls"
87
  msgstr ""
88
 
89
- #: admin/admin.php:418 admin/admin.php:419 admin/views/bans/view.php:152
90
- #: admin/views/polls/view.php:166
91
  msgid "Add New"
92
  msgstr ""
93
 
94
- #: admin/admin.php:429 admin/admin.php:430 admin/views/bans/view.php:140
95
  msgid "Bans"
96
  msgstr ""
97
 
98
- #: admin/admin.php:440 admin/admin.php:441 admin/views/logs/view.php:108
99
  msgid "Logs"
100
  msgstr ""
101
 
102
- #: admin/admin.php:455 admin/admin.php:456
103
  msgid "Settings"
104
  msgstr ""
105
 
106
- #: admin/admin.php:467 admin/admin.php:468
107
  msgid "Migrate old records"
108
  msgstr ""
109
 
110
- #: admin/admin.php:479 admin/admin.php:480
111
  msgid "Upgrade to Pro"
112
  msgstr ""
113
 
114
- #: admin/admin.php:573
115
  msgid "New Custom Field"
116
  msgstr ""
117
 
118
- #: admin/admin.php:574
119
  msgid "Warning"
120
  msgstr ""
121
 
122
- #: admin/admin.php:575 admin/admin.php:576
123
  msgid "Are you sure you want to delete this poll?"
124
  msgstr ""
125
 
126
- #: admin/admin.php:577
127
  msgid "Are you sure you want to delete these polls?"
128
  msgstr ""
129
 
130
- #: admin/admin.php:578 admin/admin.php:579
131
  msgid "Are you sure you want to clone this poll?"
132
  msgstr ""
133
 
134
- #: admin/admin.php:580
135
  msgid "Are you sure you want to clone these polls?"
136
  msgstr ""
137
 
138
- #: admin/admin.php:581 admin/admin.php:582
139
  msgid "Are you sure you want to reset votes for this poll?"
140
  msgstr ""
141
 
142
- #: admin/admin.php:583
143
  msgid "Are you sure you want to reset votes for these polls?"
144
  msgstr ""
145
 
146
- #: admin/admin.php:584
147
  msgid "No bulk action selected"
148
  msgstr ""
149
 
150
- #: admin/admin.php:585
151
  msgid "No polls selected"
152
  msgstr ""
153
 
154
- #: admin/admin.php:586
155
  msgid "No bans selected"
156
  msgstr ""
157
 
158
- #: admin/admin.php:587
159
  msgid "No logs selected"
160
  msgstr ""
161
 
162
- #: admin/admin.php:588
163
  msgid "No votes selected"
164
  msgstr ""
165
 
166
- #: admin/admin.php:589 admin/admin.php:662
167
  msgid "Are you sure you want to delete this ban?"
168
  msgstr ""
169
 
170
- #: admin/admin.php:590
171
  msgid "Are you sure you want to delete these bans?"
172
  msgstr ""
173
 
174
- #: admin/admin.php:591 admin/admin.php:663
175
  msgid "Are you sure you want to delete this log?"
176
  msgstr ""
177
 
178
- #: admin/admin.php:592
179
  msgid "Are you sure you want to delete these logs?"
180
  msgstr ""
181
 
182
- #: admin/admin.php:593
183
  msgid "Are you sure you want to delete this vote?"
184
  msgstr ""
185
 
186
- #: admin/admin.php:594
187
  msgid "Are you sure you want to delete these votes?"
188
  msgstr ""
189
 
190
- #: admin/admin.php:595
191
  msgid "Are you sure you want to delete this answer?"
192
  msgstr ""
193
 
194
- #: admin/admin.php:596
195
  msgid "Answer can't be deleted. At least one answer is required!"
196
  msgstr ""
197
 
198
- #: admin/admin.php:597
199
  msgid "Are you sure you want to delete this custom field?"
200
  msgstr ""
201
 
202
- #: admin/admin.php:598 admin/views/polls/add/main.php:188
203
- #: admin/views/polls/edit/main.php:213 admin/views/results/votes.php:196
204
  msgid "Cancel"
205
  msgstr ""
206
 
207
- #: admin/admin.php:599
208
  msgid "Ok"
209
  msgstr ""
210
 
211
- #: admin/admin.php:600
212
  msgid "Before generating the preview a template is required"
213
  msgstr ""
214
 
215
- #: admin/admin.php:601
216
  msgid "Before generating the preview a skin is required"
217
  msgstr ""
218
 
219
- #: admin/admin.php:602
220
  msgid "Number of columns is missing"
221
  msgstr ""
222
 
223
- #: admin/admin.php:603
224
  msgid "Too many columns. Max 12 allowed"
225
  msgstr ""
226
 
227
- #: admin/admin.php:604
228
  msgid "Click to select"
229
  msgstr ""
230
 
231
- #: admin/admin.php:605 admin/views/polls/add/main.php:194
232
  msgid "Publish immediately"
233
  msgstr ""
234
 
235
- #: admin/admin.php:606
236
  msgid "Schedule for"
237
  msgstr ""
238
 
239
- #: admin/admin.php:607
240
  msgid "Code Copied To Clipboard"
241
  msgstr ""
242
 
243
- #: admin/admin.php:609
244
  msgid "Press"
245
  msgstr ""
246
 
247
- #: admin/admin.php:610
248
  msgid " to copy"
249
  msgstr ""
250
 
251
- #: admin/admin.php:611
252
  msgid "No Support"
253
  msgstr ""
254
 
255
- #: admin/admin.php:613
256
  msgid "Element added"
257
  msgstr ""
258
 
259
- #: admin/admin.php:625
260
  msgid "Poll Preview"
261
  msgstr ""
262
 
263
- #: admin/admin.php:626
264
  msgid "Show preview for"
265
  msgstr ""
266
 
267
- #: admin/admin.php:627 admin/views/settings/view.php:386
268
  msgid "Voting"
269
  msgstr ""
270
 
271
- #: admin/admin.php:628 admin/views/polls/add/main.php:108
272
  #: admin/views/polls/add/options-poll.php:40
273
- #: admin/views/polls/edit/main.php:124 admin/views/polls/view.php:323
274
- #: admin/views/polls/view.php:608 admin/views/results/view.php:24
275
- #: admin/views/results/votes.php:112 admin/views/settings/view.php:391
276
  msgid "Results"
277
  msgstr ""
278
 
279
- #: admin/admin.php:639
280
  msgid "Template is missing"
281
  msgstr ""
282
 
283
- #: admin/admin.php:640
284
  msgid "Skin is missing"
285
  msgstr ""
286
 
287
- #: admin/admin.php:641
288
  msgid " is missing"
289
  msgstr ""
290
 
291
- #: admin/admin.php:642
292
  msgid "Poll name is missing"
293
  msgstr ""
294
 
295
- #: admin/admin.php:643
296
  msgid "Question Text is missing"
297
  msgstr ""
298
 
299
- #: admin/admin.php:644
300
  msgid "Answer Text is missing"
301
  msgstr ""
302
 
303
- #: admin/admin.php:645
304
  msgid "Answer Link is missing"
305
  msgstr ""
306
 
307
- #: admin/admin.php:646
308
  msgid "Answer Embed is missing"
309
  msgstr ""
310
 
311
- #: admin/admin.php:647
312
  msgid "Label for Other is missing"
313
  msgstr ""
314
 
315
- #: admin/admin.php:648
316
  msgid "Minimum answers is missing"
317
  msgstr ""
318
 
319
- #: admin/admin.php:649
320
  msgid "Maximum answers is missing"
321
  msgstr ""
322
 
323
- #: admin/admin.php:650
324
  msgid "Custom Field Name is missing"
325
  msgstr ""
326
 
327
- #: admin/admin.php:651
328
  msgid "Poll Start Date is missing"
329
  msgstr ""
330
 
331
- #: admin/admin.php:652
332
  msgid "Poll End Date is missing"
333
  msgstr ""
334
 
335
- #: admin/admin.php:653
336
  msgid "Custom Date for displaying results is missing"
337
  msgstr ""
338
 
339
- #: admin/admin.php:654
340
  msgid "Show Results Time is missing"
341
  msgstr ""
342
 
343
- #: admin/admin.php:655
344
  msgid "Show Results To is missing"
345
  msgstr ""
346
 
347
- #: admin/admin.php:656
348
  msgid "Vote As WordPress User is missing"
349
  msgstr ""
350
 
351
- #: admin/admin.php:659
352
  msgid "Ban For is missing"
353
  msgstr ""
354
 
355
- #: admin/admin.php:660
356
  msgid "Ban Value is missing"
357
  msgstr ""
358
 
359
- #: admin/admin.php:664 admin/admin.php:1292 admin/admin.php:1531
360
- #: admin/models/votes.php:1573
361
  msgid "Question"
362
  msgstr ""
363
 
364
- #: admin/admin.php:665 admin/admin.php:1289 admin/admin.php:1294
365
- #: admin/admin.php:1528 admin/admin.php:1533 admin/models/logs.php:463
366
- #: admin/models/logs.php:467 admin/models/votes.php:1575
367
  #: admin/views/polls/add/elements.php:107
368
  #: admin/views/polls/add/elements.php:181
369
  #: admin/views/polls/edit/elements.php:115
@@ -371,158 +371,158 @@ msgstr ""
371
  msgid "Answer"
372
  msgstr ""
373
 
374
- #: admin/admin.php:666 admin/views/logs/view.php:368
375
- #: admin/views/results/votes.php:404
376
  msgid "View Details"
377
  msgstr ""
378
 
379
- #: admin/admin.php:667
380
  msgid "Hide Details"
381
  msgstr ""
382
 
383
- #: admin/admin.php:668
384
  msgid "Number of Votes"
385
  msgstr ""
386
 
387
- #: admin/admin.php:670
388
  msgid "vote"
389
  msgstr ""
390
 
391
- #: admin/admin.php:671
392
  msgid "votes"
393
  msgstr ""
394
 
395
- #: admin/admin.php:674
396
  msgid "Got It. Continue with the migration"
397
  msgstr ""
398
 
399
- #: admin/admin.php:675
400
  msgid "Hold On. I want to change settings"
401
  msgstr ""
402
 
403
- #: admin/admin.php:676
404
  msgid "Please review your settings before continue"
405
  msgstr ""
406
 
407
- #: admin/admin.php:677
408
  msgid "Your selection"
409
  msgstr ""
410
 
411
- #: admin/admin.php:678
412
  msgid ""
413
  "This setting will migrate all data from previous version without any "
414
  "anonymization"
415
  msgstr ""
416
 
417
- #: admin/admin.php:679
418
  msgid ""
419
  "This setting will migrate all data from previous version but ips will be "
420
  "anonymized"
421
  msgstr ""
422
 
423
- #: admin/admin.php:680
424
  msgid "This setting will migrate everything except ip addresses. "
425
  msgstr ""
426
 
427
- #: admin/admin.php:681
428
  msgid "Response:"
429
  msgstr ""
430
 
431
- #: admin/admin.php:682
432
  msgid "All done."
433
  msgstr ""
434
 
435
- #: admin/admin.php:683
436
  msgid "Migration started"
437
  msgstr ""
438
 
439
- #: admin/admin.php:699 admin/views/polls/edit/main.php:14
440
  msgid "Edit Poll"
441
  msgstr ""
442
 
443
- #: admin/admin.php:703
444
  msgid "View Poll Results"
445
  msgstr ""
446
 
447
- #: admin/admin.php:716
448
  msgid "View Logs"
449
  msgstr ""
450
 
451
- #: admin/admin.php:725 admin/views/bans/add.php:4
452
  msgid "Add Ban"
453
  msgstr ""
454
 
455
- #: admin/admin.php:729 admin/views/bans/edit.php:4
456
  msgid "Edit Ban"
457
  msgstr ""
458
 
459
- #: admin/admin.php:733
460
  msgid "All Bans"
461
  msgstr ""
462
 
463
- #: admin/admin.php:838 admin/admin.php:1389
464
  msgid "You don't have sufficient permissions to access this page"
465
  msgstr ""
466
 
467
- #: admin/admin.php:858
468
  msgid "Poll successfully added"
469
  msgstr ""
470
 
471
- #: admin/admin.php:867 admin/admin.php:894 admin/admin.php:897
472
- #: admin/admin.php:917 admin/admin.php:920 admin/admin.php:923
473
- #: admin/admin.php:966 admin/admin.php:980 admin/admin.php:983
474
- #: admin/admin.php:986 admin/admin.php:1024 admin/admin.php:1052
475
- #: admin/admin.php:1247 admin/admin.php:1301 admin/admin.php:1304
476
- #: admin/admin.php:1307 admin/admin.php:1369 admin/admin.php:1411
477
- #: admin/admin.php:1414 admin/admin.php:1417 admin/admin.php:1439
478
- #: admin/admin.php:1442 admin/admin.php:1485 admin/admin.php:1540
479
- #: admin/admin.php:1543 admin/admin.php:1569 admin/admin.php:1616
480
- #: admin/admin.php:1636 admin/admin.php:1639 admin/admin.php:1642
481
- #: admin/admin.php:1685 admin/admin.php:1713 admin/admin.php:1716
482
- #: admin/inc/ClassYopPollImporter4x.php:759
483
- #: admin/inc/ClassYopPollImporter4x.php:813
484
- #: admin/inc/ClassYopPollImporter5x.php:2607
485
- #: admin/inc/ClassYopPollImporter5x.php:2672
486
  msgid "You are not allowed to perform this action"
487
  msgstr ""
488
 
489
- #: admin/admin.php:885
490
  msgid "Poll successfully updated"
491
  msgstr ""
492
 
493
- #: admin/admin.php:912 admin/admin.php:951
494
  msgid "Poll successfully deleted"
495
  msgstr ""
496
 
497
- #: admin/admin.php:958 admin/models/polls.php:636
498
  msgid "Error deleting poll"
499
  msgid_plural "Error deleting polls"
500
  msgstr[0] ""
501
  msgstr[1] ""
502
 
503
- #: admin/admin.php:975 admin/admin.php:1009
504
  msgid "Poll successfully cloned"
505
  msgstr ""
506
 
507
- #: admin/admin.php:1016 admin/models/polls.php:696
508
  msgid "Error cloning poll"
509
  msgid_plural "Error cloning polls"
510
  msgstr[0] ""
511
  msgstr[1] ""
512
 
513
- #: admin/admin.php:1047
514
  msgid "Votes successfully reset"
515
  msgstr ""
516
 
517
- #: admin/admin.php:1049 admin/models/polls.php:715
518
  msgid "Error resetting votes"
519
  msgstr ""
520
 
521
- #: admin/admin.php:1162 admin/admin.php:1201 admin/models/bans.php:410
522
  msgid "Invalid poll"
523
  msgstr ""
524
 
525
- #: admin/admin.php:1288 admin/admin.php:1527 admin/models/logs.php:462
526
  #: admin/views/custom-field.php:31 admin/views/polls/add/elements.php:15
527
  #: admin/views/polls/edit/elements.php:15
528
  #: admin/views/polls/edit/elements.php:496
@@ -531,71 +531,71 @@ msgstr ""
531
  msgid "Custom Field"
532
  msgstr ""
533
 
534
- #: admin/admin.php:1364
535
  msgid "Ban successfully added"
536
  msgstr ""
537
 
538
- #: admin/admin.php:1406 admin/admin.php:1470
539
  msgid "Ban successfully deleted"
540
  msgstr ""
541
 
542
- #: admin/admin.php:1434
543
  msgid "Ban successfully updated"
544
  msgstr ""
545
 
546
- #: admin/admin.php:1477 admin/models/bans.php:387
547
  msgid "Error deleting ban"
548
  msgid_plural "Error deleting bans"
549
  msgstr[0] ""
550
  msgstr[1] ""
551
 
552
- #: admin/admin.php:1497
553
  msgid "Vote Recorded"
554
  msgstr ""
555
 
556
- #: admin/admin.php:1502 admin/admin.php:1734
557
  msgid "Invalid data 1"
558
  msgstr ""
559
 
560
- #: admin/admin.php:1505 admin/admin.php:1737
561
  msgid "Invalid data 2"
562
  msgstr ""
563
 
564
- #: admin/admin.php:1560 admin/admin.php:1601
565
  msgid "Vote successfully deleted"
566
  msgstr ""
567
 
568
- #: admin/admin.php:1562 admin/admin.php:1566 admin/admin.php:1608
569
  msgid "Error deleting vote"
570
  msgstr ""
571
 
572
- #: admin/admin.php:1631 admin/admin.php:1670
573
  msgid "Log successfully deleted"
574
  msgstr ""
575
 
576
- #: admin/admin.php:1677 admin/models/logs.php:516
577
  msgid "Error deleting log"
578
  msgid_plural "Error deleting logs"
579
  msgstr[0] ""
580
  msgstr[1] ""
581
 
582
- #: admin/admin.php:1708
583
  msgid "Settings updated"
584
  msgstr ""
585
 
586
- #: admin/admin.php:1729
587
  msgid "Votes Succesfully Added"
588
  msgstr ""
589
 
590
- #: admin/admin.php:1751
591
  msgid "Error generating poll"
592
  msgstr ""
593
 
594
- #: admin/admin.php:1758
595
  msgid "Setting Updated"
596
  msgstr ""
597
 
598
- #: admin/admin.php:1777
599
  msgid "Guide Sent"
600
  msgstr ""
601
 
@@ -635,147 +635,216 @@ msgstr ""
635
  msgid "Tracking Id:"
636
  msgstr ""
637
 
638
- #: admin/inc/ClassYopPollImporter4x.php:477
639
- #: admin/inc/ClassYopPollImporter5x.php:617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
640
  msgid "No bans to process."
641
  msgstr ""
642
 
643
- #: admin/inc/ClassYopPollImporter4x.php:480
644
- #: admin/inc/ClassYopPollImporter5x.php:620
645
  msgid "No bans table, skipping."
646
  msgstr ""
647
 
648
- #: admin/inc/ClassYopPollImporter4x.php:672
649
- #: admin/inc/ClassYopPollImporter4x.php:675
650
- #: admin/inc/ClassYopPollImporter5x.php:648
651
- #: admin/inc/ClassYopPollImporter5x.php:740
 
 
 
 
 
 
 
 
 
 
 
652
  msgid "No votes to process."
653
  msgstr ""
654
 
655
- #: admin/inc/ClassYopPollImporter4x.php:678
656
- #: admin/inc/ClassYopPollImporter5x.php:744
657
  msgid "No votes table, skipping."
658
  msgstr ""
659
 
660
- #: admin/inc/ClassYopPollImporter5x.php:771
661
  msgid "No logs to process."
662
  msgstr ""
663
 
664
- #: admin/inc/ClassYopPollImporter5x.php:872
 
 
 
 
 
 
 
 
 
665
  msgid "No logs table, skipping."
666
  msgstr ""
667
 
668
- #: admin/models/bans.php:72 admin/models/logs.php:96 admin/models/polls.php:125
 
 
 
 
 
 
 
 
 
 
 
 
669
  #: admin/models/votes.php:1259
670
  msgid "Previous page"
671
  msgstr ""
672
 
673
- #: admin/models/bans.php:77 admin/models/logs.php:101
674
- #: admin/models/polls.php:130 admin/models/votes.php:1264
675
  msgid "Next page"
676
  msgstr ""
677
 
678
- #: admin/models/bans.php:338
679
  msgid "Error adding ban"
680
  msgstr ""
681
 
682
- #: admin/models/bans.php:364
683
  msgid "Error updating ban"
684
  msgstr ""
685
 
686
- #: admin/models/bans.php:369 admin/models/polls.php:595
687
  msgid "Error updating poll"
688
  msgstr ""
689
 
690
- #: admin/models/bans.php:406
691
  msgid "Error deleting bans"
692
  msgstr ""
693
 
694
- #: admin/models/bans.php:433 admin/models/polls.php:849
695
  #: admin/models/settings.php:461
696
  msgid "Invalid data"
697
  msgstr ""
698
 
699
- #: admin/models/bans.php:441
700
  msgid "Data for \"Poll\" is invalid"
701
  msgstr ""
702
 
703
- #: admin/models/bans.php:451
704
  msgid "Data for \"Ban by\" is invalid"
705
  msgstr ""
706
 
707
- #: admin/models/bans.php:459
708
  msgid "Data for \"Ban Value\" is invalid"
709
  msgstr ""
710
 
711
- #: admin/models/elements.php:41 admin/models/elements.php:268
712
  msgid "Error adding element"
713
  msgstr ""
714
 
715
- #: admin/models/elements.php:96
716
  msgid "Error updating element"
717
  msgstr ""
718
 
719
- #: admin/models/elements.php:130 admin/models/elements.php:157
720
  msgid "Error deleting element"
721
  msgstr ""
722
 
723
- #: admin/models/elements.php:134
724
  msgid "Invalid element id"
725
  msgstr ""
726
 
727
- #: admin/models/logs.php:434 admin/models/votes.php:1554
728
  msgid "Poll Name"
729
  msgstr ""
730
 
731
- #: admin/models/logs.php:435 admin/models/votes.php:1555
732
  #: admin/views/bans/add.php:54 admin/views/bans/edit.php:106
733
- #: admin/views/logs/view.php:228 admin/views/logs/view.php:452
734
- #: admin/views/results/votes.php:312 admin/views/results/votes.php:482
735
  msgid "Username"
736
  msgstr ""
737
 
738
- #: admin/models/logs.php:436 admin/models/votes.php:1556
739
  #: admin/views/bans/add.php:51 admin/views/bans/edit.php:103
740
- #: admin/views/logs/view.php:251 admin/views/logs/view.php:475
741
- #: admin/views/results/votes.php:335 admin/views/results/votes.php:505
742
  msgid "Email"
743
  msgstr ""
744
 
745
- #: admin/models/logs.php:437 admin/models/votes.php:1557
746
- #: admin/views/logs/view.php:274 admin/views/logs/view.php:498
747
- #: admin/views/results/votes.php:289 admin/views/results/votes.php:459
748
  msgid "User Type"
749
  msgstr ""
750
 
751
- #: admin/models/logs.php:438 admin/models/votes.php:1558
752
  #: admin/views/bans/add.php:48 admin/views/bans/edit.php:100
753
  msgid "IP"
754
  msgstr ""
755
 
756
- #: admin/models/logs.php:439 admin/models/votes.php:1559
757
- #: admin/views/logs/view.php:320 admin/views/logs/view.php:544
758
- #: admin/views/results/votes.php:381 admin/views/results/votes.php:551
759
  msgid "Date"
760
  msgstr ""
761
 
762
- #: admin/models/logs.php:440 admin/views/logs/view.php:343
763
- #: admin/views/logs/view.php:567 admin/views/polls/add/options-poll.php:287
764
  #: admin/views/polls/edit/options-poll.php:462
765
  msgid "Message"
766
  msgstr ""
767
 
768
- #: admin/models/logs.php:441 admin/models/votes.php:1560
769
  msgid "Vote data"
770
  msgstr ""
771
 
772
- #: admin/models/logs.php:451 admin/models/votes.php:1607
773
- #: admin/models/votes.php:1640
774
  msgid "Can't open php://output!"
775
  msgstr ""
776
 
777
- #: admin/models/logs.php:453 admin/models/votes.php:1611
778
- #: admin/models/votes.php:1647
779
  msgid "Can't write header!"
780
  msgstr ""
781
 
@@ -783,366 +852,366 @@ msgstr ""
783
  msgid "Can't write logs!"
784
  msgstr ""
785
 
786
- #: admin/models/logs.php:487 admin/models/votes.php:1620
787
- #: admin/models/votes.php:1654
788
  msgid "Can't close php://output!"
789
  msgstr ""
790
 
791
- #: admin/models/logs.php:637
792
  msgid "Error deleting logs"
793
  msgstr ""
794
 
795
- #: admin/models/polls.php:486 admin/models/polls.php:690
796
  msgid "Error adding page"
797
  msgstr ""
798
 
799
- #: admin/models/polls.php:495 admin/models/polls.php:583
800
  msgid "Error adding poll"
801
  msgstr ""
802
 
803
- #: admin/models/polls.php:499
804
  msgid "A poll with this name already exists"
805
  msgstr ""
806
 
807
- #: admin/models/polls.php:650 admin/models/polls.php:672
808
  msgid "clone"
809
  msgstr ""
810
 
811
- #: admin/models/polls.php:857
812
  msgid "Data for \"Poll Name\" is invalid"
813
  msgstr ""
814
 
815
- #: admin/models/polls.php:866
816
  msgid "Data for \"Template\" is invalid"
817
  msgstr ""
818
 
819
- #: admin/models/polls.php:875
820
  msgid "Data for \"Poll Background Color\" is invalid"
821
  msgstr ""
822
 
823
- #: admin/models/polls.php:884
824
  msgid "Data for \"Poll Border Thickness\" is invalid"
825
  msgstr ""
826
 
827
- #: admin/models/polls.php:893
828
  msgid "Data for \"Poll Border Color\" is invalid"
829
  msgstr ""
830
 
831
- #: admin/models/polls.php:902
832
  msgid "Data for \"Poll Border Radius\" is invalid"
833
  msgstr ""
834
 
835
- #: admin/models/polls.php:911
836
  msgid "Data for \"Poll Padding Left/Right\" is invalid"
837
  msgstr ""
838
 
839
- #: admin/models/polls.php:920
840
  msgid "Data for \"Poll Padding Top/Bottom\" is invalid"
841
  msgstr ""
842
 
843
- #: admin/models/polls.php:930
844
  msgid "Data for \"Question Text Color\" is invalid"
845
  msgstr ""
846
 
847
- #: admin/models/polls.php:938
848
  msgid "Data for \"Question Text Size\" is invalid"
849
  msgstr ""
850
 
851
- #: admin/models/polls.php:947
852
  msgid "Data for \"Question Text Weight\" is invalid"
853
  msgstr ""
854
 
855
- #: admin/models/polls.php:956
856
  msgid "Data for \"Question Text Align\" is invalid"
857
  msgstr ""
858
 
859
- #: admin/models/polls.php:966
860
  msgid "Data for \"Answers Padding Left/Right\" is invalid"
861
  msgstr ""
862
 
863
- #: admin/models/polls.php:975
864
  msgid "Data for \"Answers Padding Top/Bottom\" is invalid"
865
  msgstr ""
866
 
867
- #: admin/models/polls.php:984
868
  msgid "Data for \"Answers Text Color\" is invalid"
869
  msgstr ""
870
 
871
- #: admin/models/polls.php:992
872
  msgid "Data for \"Answers Text Size\" is invalid"
873
  msgstr ""
874
 
875
- #: admin/models/polls.php:1001
876
  msgid "Data for \"Answers Text Weight\" is invalid"
877
  msgstr ""
878
 
879
- #: admin/models/polls.php:1011
880
  msgid "Data for \"Buttons Background Color\" is invalid"
881
  msgstr ""
882
 
883
- #: admin/models/polls.php:1020
884
  msgid "Data for \"Buttons Border Thickness\" is invalid"
885
  msgstr ""
886
 
887
- #: admin/models/polls.php:1029
888
  msgid "Data for \"Buttons Border Color\" is invalid"
889
  msgstr ""
890
 
891
- #: admin/models/polls.php:1038
892
  msgid "Data for \"Buttons Border Radius\" is invalid"
893
  msgstr ""
894
 
895
- #: admin/models/polls.php:1047
896
  msgid "Data for \"Buttons Padding Left/Right\" is invalid"
897
  msgstr ""
898
 
899
- #: admin/models/polls.php:1056
900
  msgid "Data for \"Buttons Padding Top/Bottom\" is invalid"
901
  msgstr ""
902
 
903
- #: admin/models/polls.php:1065 admin/models/polls.php:1128
904
  msgid "Data for \"Buttons Text Color\" is invalid"
905
  msgstr ""
906
 
907
- #: admin/models/polls.php:1073
908
  msgid "Data for \"Buttons Text Size\" is invalid"
909
  msgstr ""
910
 
911
- #: admin/models/polls.php:1082
912
  msgid "Data for \"Buttons Text Weight\" is invalid"
913
  msgstr ""
914
 
915
- #: admin/models/polls.php:1092
916
  msgid "Data for \"Messages Border Color For Success\" is invalid"
917
  msgstr ""
918
 
919
- #: admin/models/polls.php:1101
920
  msgid "Data for \"Messages Border Color For Error\" is invalid"
921
  msgstr ""
922
 
923
- #: admin/models/polls.php:1110
924
  msgid "Data for \"Messages Border Left Thickness\" is invalid"
925
  msgstr ""
926
 
927
- #: admin/models/polls.php:1119
928
  msgid "Data for \"Messages Padding Top/Bottom\" is invalid"
929
  msgstr ""
930
 
931
- #: admin/models/polls.php:1136
932
  msgid "Data for \"Messages Text Size\" is invalid"
933
  msgstr ""
934
 
935
- #: admin/models/polls.php:1145
936
  msgid "Data for \"Messages Text Weight\" is invalid"
937
  msgstr ""
938
 
939
- #: admin/models/polls.php:1153
940
  msgid "No elements present"
941
  msgstr ""
942
 
943
- #: admin/models/polls.php:1167
944
  msgid "Data for \"Question\" is invalid"
945
  msgstr ""
946
 
947
- #: admin/models/polls.php:1174
948
  msgid "At least one answer per question is required"
949
  msgstr ""
950
 
951
- #: admin/models/polls.php:1188
952
  msgid "Answer text is invalid"
953
  msgstr ""
954
 
955
- #: admin/models/polls.php:1195
956
  msgid "Data for default answer is invalid"
957
  msgstr ""
958
 
959
- #: admin/models/polls.php:1202
960
  msgid " Data for \"Answer Link\" is invalid"
961
  msgstr ""
962
 
963
- #: admin/models/polls.php:1212
964
  msgid "Data for \"Answer link\" is invalid"
965
  msgstr ""
966
 
967
- #: admin/models/polls.php:1221
968
  msgid "Data for \"Allow other options\" is invalid"
969
  msgstr ""
970
 
971
- #: admin/models/polls.php:1231
972
  msgid "Data for \"Label for Other Answers\" is invalid"
973
  msgstr ""
974
 
975
- #: admin/models/polls.php:1238
976
  msgid "Data for \"Add other answers in answer list\" is invalid"
977
  msgstr ""
978
 
979
- #: admin/models/polls.php:1245
980
  msgid "Data for \"Display other answers in results list\" is invalid"
981
  msgstr ""
982
 
983
- #: admin/models/polls.php:1252
984
  msgid "Data for \"Allow multiple answers \" is invalid"
985
  msgstr ""
986
 
987
- #: admin/models/polls.php:1260 admin/models/polls.php:1275
988
  #: admin/models/settings.php:667
989
  msgid "Data for \"Minimum answers required\" is invalid"
990
  msgstr ""
991
 
992
- #: admin/models/polls.php:1268 admin/models/polls.php:1292
993
  #: admin/models/settings.php:675
994
  msgid "Data for \"Maximum answers required\" is invalid"
995
  msgstr ""
996
 
997
- #: admin/models/polls.php:1282
998
  msgid "Data for \"Display answers\" is invalid"
999
  msgstr ""
1000
 
1001
- #: admin/models/polls.php:1299
1002
  msgid "Data for \"Sort Answers\" is invalid"
1003
  msgstr ""
1004
 
1005
- #: admin/models/polls.php:1312
1006
  msgid "Data for \"Custom Field\" is invalid"
1007
  msgstr ""
1008
 
1009
- #: admin/models/polls.php:1319
1010
  msgid "Data for \"Make Required\" is invalid"
1011
  msgstr ""
1012
 
1013
- #: admin/models/polls.php:1338
1014
  msgid "Data for \"Vote Button Label\" is invalid"
1015
  msgstr ""
1016
 
1017
- #: admin/models/polls.php:1345
1018
  msgid "Data for \"Show [Results] link\" is invalid"
1019
  msgstr ""
1020
 
1021
- #: admin/models/polls.php:1356
1022
  msgid "Data for \"[Results] Link Label\" is invalid"
1023
  msgstr ""
1024
 
1025
- #: admin/models/polls.php:1363
1026
  msgid "Data for \"Show Total Votes\" is invalid"
1027
  msgstr ""
1028
 
1029
- #: admin/models/polls.php:1370
1030
  msgid "Data for \"Show Total Answers\" is invalid"
1031
  msgstr ""
1032
 
1033
- #: admin/models/polls.php:1377 admin/models/polls.php:1386
1034
  msgid "Data for \"Start Date\" is invalid"
1035
  msgstr ""
1036
 
1037
- #: admin/models/polls.php:1393 admin/models/polls.php:1402
1038
  msgid "Data for \"End Date\" is invalid"
1039
  msgstr ""
1040
 
1041
- #: admin/models/polls.php:1409
1042
  msgid "Data for \"Redirect after vote\" is invalid"
1043
  msgstr ""
1044
 
1045
- #: admin/models/polls.php:1420
1046
  msgid "Data for \"Redirect Url\" is invalid"
1047
  msgstr ""
1048
 
1049
- #: admin/models/polls.php:1427
1050
  msgid "Data for \"Reset Poll Stats automatically\" is invalid"
1051
  msgstr ""
1052
 
1053
- #: admin/models/polls.php:1434
1054
  msgid "Data for \"Reset Every\" is invalid"
1055
  msgstr ""
1056
 
1057
- #: admin/models/polls.php:1441
1058
  msgid "Data for \"Auto Generate Poll Page\" is invalid"
1059
  msgstr ""
1060
 
1061
- #: admin/models/polls.php:1448
1062
  msgid "Data for \"Use Captcha\" is invalid"
1063
  msgstr ""
1064
 
1065
- #: admin/models/polls.php:1455
1066
  msgid "Data for \"Send Email notifications\" is invalid"
1067
  msgstr ""
1068
 
1069
- #: admin/models/polls.php:1464
1070
  msgid "Data for \"From Name\" is invalid"
1071
  msgstr ""
1072
 
1073
- #: admin/models/polls.php:1473
1074
  msgid "Data for \"From Email\" is invalid"
1075
  msgstr ""
1076
 
1077
- #: admin/models/polls.php:1482
1078
  msgid "Data for \"Recipients\" is invalid"
1079
  msgstr ""
1080
 
1081
- #: admin/models/polls.php:1491
1082
  msgid "Data for \"Subject\" is invalid"
1083
  msgstr ""
1084
 
1085
- #: admin/models/polls.php:1500
1086
  msgid "Data for \"Message\" is invalid"
1087
  msgstr ""
1088
 
1089
- #: admin/models/polls.php:1509
1090
  msgid "Data for \"Show results\" is invalid"
1091
  msgstr ""
1092
 
1093
- #: admin/models/polls.php:1518
1094
  msgid "Data for \"Show Results\" is invalid"
1095
  msgstr ""
1096
 
1097
- #: admin/models/polls.php:1527
1098
  msgid "Data for \"Show results to\" is invalid"
1099
  msgstr ""
1100
 
1101
- #: admin/models/polls.php:1534
1102
  msgid "Data for \"Display [Back to vote] link\" is invalid"
1103
  msgstr ""
1104
 
1105
- #: admin/models/polls.php:1545
1106
  msgid "Data for \"[Back to vote] caption\" is invalid"
1107
  msgstr ""
1108
 
1109
- #: admin/models/polls.php:1552
1110
  msgid "Data for \"Sort Results\" is invalid"
1111
  msgstr ""
1112
 
1113
- #: admin/models/polls.php:1560
1114
  msgid "Data for \"Sort rule\" is invalid"
1115
  msgstr ""
1116
 
1117
- #: admin/models/polls.php:1567
1118
  msgid "Data for \"Display Results As\""
1119
  msgstr ""
1120
 
1121
- #: admin/models/polls.php:1575
1122
  msgid "Data for \"Vote Permissions\" is invalid"
1123
  msgstr ""
1124
 
1125
- #: admin/models/polls.php:1592
1126
  msgid "Data for \"Block Voters\" is invalid"
1127
  msgstr ""
1128
 
1129
- #: admin/models/polls.php:1604
1130
  msgid "Data for \"Block Period\" is invalid"
1131
  msgstr ""
1132
 
1133
- #: admin/models/polls.php:1611
1134
  msgid "Data for \"Limit Number Of Votes per User\" is invalid"
1135
  msgstr ""
1136
 
1137
- #: admin/models/polls.php:1619
1138
  msgid "Data for \"Votes per user\" is invalid"
1139
  msgstr ""
1140
 
1141
- #: admin/models/polls.php:2440
1142
  msgid "Number of votes for each question should be the same"
1143
  msgstr ""
1144
 
1145
- #: admin/models/polls.php:2444 admin/views/settings/view.php:459
1146
  msgid "Invalid Poll"
1147
  msgstr ""
1148
 
@@ -1288,42 +1357,42 @@ msgstr ""
1288
  msgid "Data for \"Refresh Title\" is invalid"
1289
  msgstr ""
1290
 
1291
- #: admin/models/subelements.php:56 admin/models/subelements.php:100
1292
- #: admin/models/subelements.php:296
1293
  msgid "Error adding answers"
1294
  msgstr ""
1295
 
1296
- #: admin/models/subelements.php:128 admin/models/subelements.php:155
1297
- #: admin/models/subelements.php:179 admin/models/subelements.php:423
1298
  msgid "Error deleting answer"
1299
  msgstr ""
1300
 
1301
- #: admin/models/subelements.php:132
1302
  msgid "Invalid answer id"
1303
  msgstr ""
1304
 
1305
- #: admin/models/votes.php:1563
1306
  msgid "Custom field - "
1307
  msgstr ""
1308
 
1309
- #: admin/models/votes.php:1616 admin/models/votes.php:1651
1310
  msgid "Can't write votes!"
1311
  msgstr ""
1312
 
1313
  #: admin/views/bans/add.php:18 admin/views/bans/edit.php:18
1314
- #: admin/views/bans/view.php:248 admin/views/bans/view.php:440
1315
- #: admin/views/logs/view.php:205 admin/views/logs/view.php:429
1316
  #: admin/views/polls/add/main.php:98 admin/views/polls/edit/main.php:114
1317
  msgid "Poll"
1318
  msgstr ""
1319
 
1320
  #: admin/views/bans/add.php:43 admin/views/bans/edit.php:67
1321
- #: admin/views/bans/view.php:294 admin/views/bans/view.php:486
1322
  msgid "Ban By"
1323
  msgstr ""
1324
 
1325
  #: admin/views/bans/add.php:67 admin/views/bans/edit.php:119
1326
- #: admin/views/bans/view.php:317 admin/views/bans/view.php:509
1327
  msgid "Value"
1328
  msgstr ""
1329
 
@@ -1336,115 +1405,121 @@ msgstr ""
1336
  msgid "Update"
1337
  msgstr ""
1338
 
1339
- #: admin/views/bans/view.php:159 admin/views/bans/view.php:163
1340
  msgid "Search Bans"
1341
  msgstr ""
1342
 
1343
- #: admin/views/bans/view.php:170 admin/views/bans/view.php:543
1344
- #: admin/views/logs/view.php:127 admin/views/logs/view.php:578
1345
- #: admin/views/polls/view.php:226 admin/views/polls/view.php:727
1346
- #: admin/views/results/votes.php:211 admin/views/results/votes.php:562
1347
  msgid "Select bulk action"
1348
  msgstr ""
1349
 
1350
- #: admin/views/bans/view.php:174 admin/views/bans/view.php:547
1351
- #: admin/views/logs/view.php:131 admin/views/logs/view.php:582
1352
- #: admin/views/polls/view.php:230 admin/views/polls/view.php:731
1353
- #: admin/views/results/votes.php:215 admin/views/results/votes.php:566
1354
  msgid "Bulk Actions"
1355
  msgstr ""
1356
 
1357
- #: admin/views/bans/view.php:177 admin/views/bans/view.php:550
1358
- #: admin/views/logs/view.php:134 admin/views/logs/view.php:585
1359
- #: admin/views/polls/view.php:233 admin/views/polls/view.php:734
1360
- #: admin/views/results/votes.php:218 admin/views/results/votes.php:569
1361
  msgid "Move to Trash"
1362
  msgstr ""
1363
 
1364
- #: admin/views/bans/view.php:180 admin/views/bans/view.php:553
1365
- #: admin/views/logs/view.php:137 admin/views/logs/view.php:588
1366
- #: admin/views/polls/view.php:242 admin/views/polls/view.php:743
1367
- #: admin/views/results/votes.php:221 admin/views/results/votes.php:572
1368
  msgid "Apply"
1369
  msgstr ""
1370
 
1371
- #: admin/views/bans/view.php:183
1372
  msgid "Bans list navigation"
1373
  msgstr ""
1374
 
1375
- #: admin/views/bans/view.php:187 admin/views/bans/view.php:573
1376
- #: admin/views/logs/view.php:144 admin/views/logs/view.php:595
1377
- #: admin/views/polls/view.php:255 admin/views/polls/view.php:750
1378
- #: admin/views/results/votes.php:228 admin/views/results/votes.php:579
1379
- msgid "%s item"
1380
- msgid_plural "%s items"
1381
- msgstr[0] ""
1382
- msgstr[1] ""
 
 
 
 
 
 
1383
 
1384
- #: admin/views/bans/view.php:226 admin/views/bans/view.php:418
1385
- #: admin/views/logs/view.php:183 admin/views/logs/view.php:407
1386
- #: admin/views/polls/view.php:294 admin/views/polls/view.php:581
1387
- #: admin/views/results/votes.php:267 admin/views/results/votes.php:437
1388
  msgid "Select All"
1389
  msgstr ""
1390
 
1391
- #: admin/views/bans/view.php:271 admin/views/bans/view.php:463
1392
- #: admin/views/polls/view.php:389 admin/views/polls/view.php:674
1393
  msgid "Author"
1394
  msgstr ""
1395
 
1396
- #: admin/views/bans/view.php:340 admin/views/bans/view.php:532
1397
  msgid "Added On"
1398
  msgstr ""
1399
 
1400
- #: admin/views/bans/view.php:353 admin/views/logs/view.php:356
1401
- #: admin/views/polls/view.php:467 admin/views/results/votes.php:394
1402
  msgid "Select"
1403
  msgstr ""
1404
 
1405
- #: admin/views/bans/view.php:370 admin/views/polls/view.php:485
1406
  msgid "Poll name"
1407
  msgstr ""
1408
 
1409
- #: admin/views/bans/view.php:385
1410
  msgid "Edit this ban"
1411
  msgstr ""
1412
 
1413
- #: admin/views/bans/view.php:386 admin/views/polls/add/elements.php:110
1414
  #: admin/views/polls/add/elements.php:184 admin/views/polls/add/main.php:169
1415
  #: admin/views/polls/add/main.php:198 admin/views/polls/edit/elements.php:118
1416
  #: admin/views/polls/edit/elements.php:480 admin/views/polls/edit/main.php:185
1417
  #: admin/views/polls/edit/main.php:223
1418
  #: admin/views/polls/elements-definitions.php:12
1419
  #: admin/views/polls/elements-definitions.php:233
1420
- #: admin/views/polls/view.php:501
1421
  msgid "Edit"
1422
  msgstr ""
1423
 
1424
- #: admin/views/bans/view.php:390
1425
  msgid "Move this ban to the Trash"
1426
  msgstr ""
1427
 
1428
- #: admin/views/bans/view.php:393 admin/views/logs/view.php:372
1429
- #: admin/views/polls/view.php:508 admin/views/results/votes.php:409
1430
  msgid "Trash"
1431
  msgstr ""
1432
 
1433
- #: admin/views/bans/view.php:558
1434
  msgid "Filter by date"
1435
  msgstr ""
1436
 
1437
- #: admin/views/bans/view.php:562
1438
  msgid "View All Polls"
1439
  msgstr ""
1440
 
1441
- #: admin/views/bans/view.php:565
1442
  msgid "Filter"
1443
  msgstr ""
1444
 
1445
- #: admin/views/bans/view.php:569 admin/views/logs/view.php:591
1446
- #: admin/views/polls/view.php:245 admin/views/polls/view.php:746
1447
- #: admin/views/results/votes.php:575
1448
  msgid "Pages list navigation"
1449
  msgstr ""
1450
 
@@ -1516,7 +1591,7 @@ msgstr ""
1516
  #: admin/views/polls/elements-definitions.php:139
1517
  #: admin/views/polls/elements-definitions.php:150
1518
  #: admin/views/polls/elements-definitions.php:172
1519
- #: admin/views/polls/view.php:827 admin/views/settings/view.php:56
1520
  #: admin/views/settings/view.php:76 admin/views/settings/view.php:139
1521
  #: admin/views/settings/view.php:181 admin/views/settings/view.php:223
1522
  #: admin/views/settings/view.php:273 admin/views/settings/view.php:318
@@ -1561,7 +1636,7 @@ msgstr ""
1561
  #: admin/views/polls/elements-definitions.php:140
1562
  #: admin/views/polls/elements-definitions.php:151
1563
  #: admin/views/polls/elements-definitions.php:173
1564
- #: admin/views/polls/view.php:828 admin/views/settings/view.php:57
1565
  #: admin/views/settings/view.php:77 admin/views/settings/view.php:140
1566
  #: admin/views/settings/view.php:182 admin/views/settings/view.php:224
1567
  #: admin/views/settings/view.php:274 admin/views/settings/view.php:319
@@ -1595,8 +1670,8 @@ msgstr ""
1595
  msgid "Search Logs"
1596
  msgstr ""
1597
 
1598
- #: admin/views/logs/view.php:120 admin/views/results/view.php:337
1599
- #: admin/views/results/votes.php:135
1600
  msgid "Export"
1601
  msgstr ""
1602
 
@@ -1604,16 +1679,16 @@ msgstr ""
1604
  msgid "Logs list navigation"
1605
  msgstr ""
1606
 
1607
- #: admin/views/logs/view.php:297 admin/views/logs/view.php:521
1608
- #: admin/views/results/votes.php:358 admin/views/results/votes.php:528
1609
  msgid "Ipaddress"
1610
  msgstr ""
1611
 
1612
- #: admin/views/logs/view.php:367 admin/views/results/votes.php:403
1613
  msgid "View details for this record"
1614
  msgstr ""
1615
 
1616
- #: admin/views/logs/view.php:371 admin/views/results/votes.php:408
1617
  msgid "Move this log record to the Trash"
1618
  msgstr ""
1619
 
@@ -1772,7 +1847,7 @@ msgstr ""
1772
 
1773
  #: admin/views/polls/add/design-custom-styles.php:186
1774
  #: admin/views/polls/edit/design-custom-styles.php:221
1775
- #: admin/views/results/view.php:115
1776
  msgid "Answers"
1777
  msgstr ""
1778
 
@@ -1980,7 +2055,7 @@ msgstr ""
1980
 
1981
  #: admin/views/polls/add/elements.php:275
1982
  #: admin/views/polls/elements-definitions.php:130
1983
- #: admin/views/results/view.php:94 admin/views/results/view.php:219
1984
  msgid "Other"
1985
  msgstr ""
1986
 
@@ -2168,12 +2243,12 @@ msgid "Edit status"
2168
  msgstr ""
2169
 
2170
  #: admin/views/polls/add/main.php:178 admin/views/polls/edit/main.php:203
2171
- #: admin/views/polls/view.php:180
2172
  msgid "Published"
2173
  msgstr ""
2174
 
2175
  #: admin/views/polls/add/main.php:181 admin/views/polls/edit/main.php:206
2176
- #: admin/views/polls/view.php:188
2177
  msgid "Draft"
2178
  msgstr ""
2179
 
@@ -2337,8 +2412,8 @@ msgid "Load using AJAX"
2337
  msgstr ""
2338
 
2339
  #: admin/views/polls/add/options-poll.php:87
2340
- #: admin/views/polls/edit/options-poll.php:130 admin/views/polls/view.php:410
2341
- #: admin/views/polls/view.php:695
2342
  msgid "Start Date"
2343
  msgstr ""
2344
 
@@ -2357,15 +2432,15 @@ msgid "Custom Date"
2357
  msgstr ""
2358
 
2359
  #: admin/views/polls/add/options-poll.php:111
2360
- #: admin/views/polls/edit/options-poll.php:165 admin/views/polls/view.php:431
2361
- #: admin/views/polls/view.php:716
2362
  msgid "End Date"
2363
  msgstr ""
2364
 
2365
  #: admin/views/polls/add/options-poll.php:115
2366
  #: admin/views/polls/add/options-results.php:48
2367
  #: admin/views/polls/edit/options-poll.php:180
2368
- #: admin/views/polls/edit/options-results.php:78 admin/views/polls/view.php:567
2369
  msgid "Never"
2370
  msgstr ""
2371
 
@@ -2612,7 +2687,7 @@ msgstr ""
2612
 
2613
  #: admin/views/polls/add/options-results.php:156
2614
  #: admin/views/polls/edit/options-results.php:275
2615
- #: admin/views/results/view.php:121 admin/views/results/view.php:136
2616
  msgid "Pie"
2617
  msgstr ""
2618
 
@@ -2648,100 +2723,96 @@ msgstr ""
2648
  msgid "New Answer"
2649
  msgstr ""
2650
 
2651
- #: admin/views/polls/view.php:172
2652
  msgid "All"
2653
  msgstr ""
2654
 
2655
- #: admin/views/polls/view.php:196
2656
  msgid "Ending Soon"
2657
  msgstr ""
2658
 
2659
- #: admin/views/polls/view.php:204
2660
  msgid "Ended"
2661
  msgstr ""
2662
 
2663
- #: admin/views/polls/view.php:215 admin/views/polls/view.php:219
2664
  msgid "Search Polls"
2665
  msgstr ""
2666
 
2667
- #: admin/views/polls/view.php:236 admin/views/polls/view.php:512
2668
- #: admin/views/polls/view.php:515 admin/views/polls/view.php:737
2669
  msgid "Clone"
2670
  msgstr ""
2671
 
2672
- #: admin/views/polls/view.php:239 admin/views/polls/view.php:740
2673
  msgid "Reset Votes"
2674
  msgstr ""
2675
 
2676
- #: admin/views/polls/view.php:251
2677
- msgid "items"
2678
- msgstr ""
2679
-
2680
- #: admin/views/polls/view.php:251
2681
  msgid "page"
2682
  msgstr ""
2683
 
2684
- #: admin/views/polls/view.php:252
2685
  msgid "Set"
2686
  msgstr ""
2687
 
2688
- #: admin/views/polls/view.php:316 admin/views/polls/view.php:601
2689
  msgid "Title"
2690
  msgstr ""
2691
 
2692
- #: admin/views/polls/view.php:342 admin/views/polls/view.php:627
2693
  msgid "Status"
2694
  msgstr ""
2695
 
2696
- #: admin/views/polls/view.php:349 admin/views/polls/view.php:634
2697
  msgid "Code"
2698
  msgstr ""
2699
 
2700
- #: admin/views/polls/view.php:368 admin/views/polls/view.php:653
2701
  msgid "Votes"
2702
  msgstr ""
2703
 
2704
- #: admin/views/polls/view.php:500
2705
  msgid "Edit this poll"
2706
  msgstr ""
2707
 
2708
- #: admin/views/polls/view.php:505
2709
  msgid "Move this poll to the Trash"
2710
  msgstr ""
2711
 
2712
- #: admin/views/polls/view.php:530
2713
  msgid "View Results"
2714
  msgstr ""
2715
 
2716
- #: admin/views/polls/view.php:787
2717
  msgid "Generate Poll Shortcode"
2718
  msgstr ""
2719
 
2720
- #: admin/views/polls/view.php:792
2721
  msgid "Place the shortcode on your pages or posts to display the poll:"
2722
  msgstr ""
2723
 
2724
- #: admin/views/polls/view.php:803
2725
  msgid "Copy to Clipboard"
2726
  msgstr ""
2727
 
2728
- #: admin/views/polls/view.php:810
2729
  msgid "To customize it, you can use the options below"
2730
  msgstr ""
2731
 
2732
- #: admin/views/polls/view.php:815
2733
  msgid "Tracking Id"
2734
  msgstr ""
2735
 
2736
- #: admin/views/polls/view.php:818
2737
  msgid "Leave empty if none"
2738
  msgstr ""
2739
 
2740
- #: admin/views/polls/view.php:823
2741
  msgid "Display Results Only"
2742
  msgstr ""
2743
 
2744
- #: admin/views/polls/view.php:835
2745
  msgid "Generate Code"
2746
  msgstr ""
2747
 
@@ -2749,49 +2820,49 @@ msgstr ""
2749
  msgid "Poll results for"
2750
  msgstr ""
2751
 
2752
- #: admin/views/results/view.php:39 admin/views/results/votes.php:117
2753
  msgid "View votes"
2754
  msgstr ""
2755
 
2756
- #: admin/views/results/view.php:120 admin/views/results/view.php:135
2757
  msgid "Bar"
2758
  msgstr ""
2759
 
2760
- #: admin/views/results/view.php:130
2761
  msgid "Voters"
2762
  msgstr ""
2763
 
2764
- #: admin/views/results/view.php:194 admin/views/results/view.php:225
2765
- #: admin/views/results/view.php:288
2766
  msgid " votes"
2767
  msgstr ""
2768
 
2769
- #: admin/views/results/view.php:196 admin/views/results/view.php:227
2770
- #: admin/views/results/view.php:290
2771
  msgid " vote"
2772
  msgstr ""
2773
 
2774
- #: admin/views/results/view.php:326
2775
  msgid "Custom fields"
2776
  msgstr ""
2777
 
2778
- #: admin/views/results/votes.php:127 admin/views/results/votes.php:133
2779
  msgid "Search Votes"
2780
  msgstr ""
2781
 
2782
- #: admin/views/results/votes.php:138 admin/views/results/votes.php:199
2783
  msgid "Add Votes"
2784
  msgstr ""
2785
 
2786
- #: admin/views/results/votes.php:146
2787
  msgid "Add Votes Manually"
2788
  msgstr ""
2789
 
2790
- #: admin/views/results/votes.php:176
2791
  msgid "Number of votes for this answer"
2792
  msgstr ""
2793
 
2794
- #: admin/views/results/votes.php:224
2795
  msgid "Votes list navigation"
2796
  msgstr ""
2797
 
2
  # This file is distributed under the GPL2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: YOP Poll 6.4.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/yop-poll-free\n"
7
+ "POT-Creation-Date: 2022-07-13 06:55:03+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
75
  msgid "Skip and Deactivate"
76
  msgstr ""
77
 
78
+ #: admin/admin.php:393 admin/admin.php:394
79
  msgid "Yop Poll"
80
  msgstr ""
81
 
82
+ #: admin/admin.php:407 admin/admin.php:408 admin/admin.php:715
83
  #: admin/views/bans/add.php:23 admin/views/bans/edit.php:27
84
  #: admin/views/bans/edit.php:35 admin/views/polls/view.php:155
85
+ #: admin/views/results/view.php:24 admin/views/results/votes.php:102
86
  msgid "All Polls"
87
  msgstr ""
88
 
89
+ #: admin/admin.php:422 admin/admin.php:423 admin/views/bans/view.php:158
90
+ #: admin/views/polls/view.php:173
91
  msgid "Add New"
92
  msgstr ""
93
 
94
+ #: admin/admin.php:433 admin/admin.php:434 admin/views/bans/view.php:140
95
  msgid "Bans"
96
  msgstr ""
97
 
98
+ #: admin/admin.php:444 admin/admin.php:445 admin/views/logs/view.php:108
99
  msgid "Logs"
100
  msgstr ""
101
 
102
+ #: admin/admin.php:459 admin/admin.php:460
103
  msgid "Settings"
104
  msgstr ""
105
 
106
+ #: admin/admin.php:471 admin/admin.php:472
107
  msgid "Migrate old records"
108
  msgstr ""
109
 
110
+ #: admin/admin.php:483 admin/admin.php:484
111
  msgid "Upgrade to Pro"
112
  msgstr ""
113
 
114
+ #: admin/admin.php:580
115
  msgid "New Custom Field"
116
  msgstr ""
117
 
118
+ #: admin/admin.php:581
119
  msgid "Warning"
120
  msgstr ""
121
 
122
+ #: admin/admin.php:582 admin/admin.php:583
123
  msgid "Are you sure you want to delete this poll?"
124
  msgstr ""
125
 
126
+ #: admin/admin.php:584
127
  msgid "Are you sure you want to delete these polls?"
128
  msgstr ""
129
 
130
+ #: admin/admin.php:585 admin/admin.php:586
131
  msgid "Are you sure you want to clone this poll?"
132
  msgstr ""
133
 
134
+ #: admin/admin.php:587
135
  msgid "Are you sure you want to clone these polls?"
136
  msgstr ""
137
 
138
+ #: admin/admin.php:588 admin/admin.php:589
139
  msgid "Are you sure you want to reset votes for this poll?"
140
  msgstr ""
141
 
142
+ #: admin/admin.php:590
143
  msgid "Are you sure you want to reset votes for these polls?"
144
  msgstr ""
145
 
146
+ #: admin/admin.php:591
147
  msgid "No bulk action selected"
148
  msgstr ""
149
 
150
+ #: admin/admin.php:592
151
  msgid "No polls selected"
152
  msgstr ""
153
 
154
+ #: admin/admin.php:593
155
  msgid "No bans selected"
156
  msgstr ""
157
 
158
+ #: admin/admin.php:594
159
  msgid "No logs selected"
160
  msgstr ""
161
 
162
+ #: admin/admin.php:595
163
  msgid "No votes selected"
164
  msgstr ""
165
 
166
+ #: admin/admin.php:596 admin/admin.php:669
167
  msgid "Are you sure you want to delete this ban?"
168
  msgstr ""
169
 
170
+ #: admin/admin.php:597
171
  msgid "Are you sure you want to delete these bans?"
172
  msgstr ""
173
 
174
+ #: admin/admin.php:598 admin/admin.php:670
175
  msgid "Are you sure you want to delete this log?"
176
  msgstr ""
177
 
178
+ #: admin/admin.php:599
179
  msgid "Are you sure you want to delete these logs?"
180
  msgstr ""
181
 
182
+ #: admin/admin.php:600
183
  msgid "Are you sure you want to delete this vote?"
184
  msgstr ""
185
 
186
+ #: admin/admin.php:601
187
  msgid "Are you sure you want to delete these votes?"
188
  msgstr ""
189
 
190
+ #: admin/admin.php:602
191
  msgid "Are you sure you want to delete this answer?"
192
  msgstr ""
193
 
194
+ #: admin/admin.php:603
195
  msgid "Answer can't be deleted. At least one answer is required!"
196
  msgstr ""
197
 
198
+ #: admin/admin.php:604
199
  msgid "Are you sure you want to delete this custom field?"
200
  msgstr ""
201
 
202
+ #: admin/admin.php:605 admin/views/polls/add/main.php:188
203
+ #: admin/views/polls/edit/main.php:213 admin/views/results/votes.php:210
204
  msgid "Cancel"
205
  msgstr ""
206
 
207
+ #: admin/admin.php:606
208
  msgid "Ok"
209
  msgstr ""
210
 
211
+ #: admin/admin.php:607
212
  msgid "Before generating the preview a template is required"
213
  msgstr ""
214
 
215
+ #: admin/admin.php:608
216
  msgid "Before generating the preview a skin is required"
217
  msgstr ""
218
 
219
+ #: admin/admin.php:609
220
  msgid "Number of columns is missing"
221
  msgstr ""
222
 
223
+ #: admin/admin.php:610
224
  msgid "Too many columns. Max 12 allowed"
225
  msgstr ""
226
 
227
+ #: admin/admin.php:611
228
  msgid "Click to select"
229
  msgstr ""
230
 
231
+ #: admin/admin.php:612 admin/views/polls/add/main.php:194
232
  msgid "Publish immediately"
233
  msgstr ""
234
 
235
+ #: admin/admin.php:613
236
  msgid "Schedule for"
237
  msgstr ""
238
 
239
+ #: admin/admin.php:614
240
  msgid "Code Copied To Clipboard"
241
  msgstr ""
242
 
243
+ #: admin/admin.php:616
244
  msgid "Press"
245
  msgstr ""
246
 
247
+ #: admin/admin.php:617
248
  msgid " to copy"
249
  msgstr ""
250
 
251
+ #: admin/admin.php:618
252
  msgid "No Support"
253
  msgstr ""
254
 
255
+ #: admin/admin.php:620
256
  msgid "Element added"
257
  msgstr ""
258
 
259
+ #: admin/admin.php:632
260
  msgid "Poll Preview"
261
  msgstr ""
262
 
263
+ #: admin/admin.php:633
264
  msgid "Show preview for"
265
  msgstr ""
266
 
267
+ #: admin/admin.php:634 admin/views/settings/view.php:386
268
  msgid "Voting"
269
  msgstr ""
270
 
271
+ #: admin/admin.php:635 admin/views/polls/add/main.php:108
272
  #: admin/views/polls/add/options-poll.php:40
273
+ #: admin/views/polls/edit/main.php:124 admin/views/polls/view.php:340
274
+ #: admin/views/polls/view.php:651 admin/views/results/view.php:31
275
+ #: admin/views/results/votes.php:126 admin/views/settings/view.php:391
276
  msgid "Results"
277
  msgstr ""
278
 
279
+ #: admin/admin.php:646
280
  msgid "Template is missing"
281
  msgstr ""
282
 
283
+ #: admin/admin.php:647
284
  msgid "Skin is missing"
285
  msgstr ""
286
 
287
+ #: admin/admin.php:648
288
  msgid " is missing"
289
  msgstr ""
290
 
291
+ #: admin/admin.php:649
292
  msgid "Poll name is missing"
293
  msgstr ""
294
 
295
+ #: admin/admin.php:650
296
  msgid "Question Text is missing"
297
  msgstr ""
298
 
299
+ #: admin/admin.php:651
300
  msgid "Answer Text is missing"
301
  msgstr ""
302
 
303
+ #: admin/admin.php:652
304
  msgid "Answer Link is missing"
305
  msgstr ""
306
 
307
+ #: admin/admin.php:653
308
  msgid "Answer Embed is missing"
309
  msgstr ""
310
 
311
+ #: admin/admin.php:654
312
  msgid "Label for Other is missing"
313
  msgstr ""
314
 
315
+ #: admin/admin.php:655
316
  msgid "Minimum answers is missing"
317
  msgstr ""
318
 
319
+ #: admin/admin.php:656
320
  msgid "Maximum answers is missing"
321
  msgstr ""
322
 
323
+ #: admin/admin.php:657
324
  msgid "Custom Field Name is missing"
325
  msgstr ""
326
 
327
+ #: admin/admin.php:658
328
  msgid "Poll Start Date is missing"
329
  msgstr ""
330
 
331
+ #: admin/admin.php:659
332
  msgid "Poll End Date is missing"
333
  msgstr ""
334
 
335
+ #: admin/admin.php:660
336
  msgid "Custom Date for displaying results is missing"
337
  msgstr ""
338
 
339
+ #: admin/admin.php:661
340
  msgid "Show Results Time is missing"
341
  msgstr ""
342
 
343
+ #: admin/admin.php:662
344
  msgid "Show Results To is missing"
345
  msgstr ""
346
 
347
+ #: admin/admin.php:663
348
  msgid "Vote As WordPress User is missing"
349
  msgstr ""
350
 
351
+ #: admin/admin.php:666
352
  msgid "Ban For is missing"
353
  msgstr ""
354
 
355
+ #: admin/admin.php:667
356
  msgid "Ban Value is missing"
357
  msgstr ""
358
 
359
+ #: admin/admin.php:671 admin/admin.php:1341 admin/admin.php:1596
360
+ #: admin/models/votes.php:1589
361
  msgid "Question"
362
  msgstr ""
363
 
364
+ #: admin/admin.php:672 admin/admin.php:1338 admin/admin.php:1343
365
+ #: admin/admin.php:1593 admin/admin.php:1598 admin/models/logs.php:463
366
+ #: admin/models/logs.php:467 admin/models/votes.php:1591
367
  #: admin/views/polls/add/elements.php:107
368
  #: admin/views/polls/add/elements.php:181
369
  #: admin/views/polls/edit/elements.php:115
371
  msgid "Answer"
372
  msgstr ""
373
 
374
+ #: admin/admin.php:673 admin/views/logs/view.php:384
375
+ #: admin/views/results/votes.php:432
376
  msgid "View Details"
377
  msgstr ""
378
 
379
+ #: admin/admin.php:674
380
  msgid "Hide Details"
381
  msgstr ""
382
 
383
+ #: admin/admin.php:675
384
  msgid "Number of Votes"
385
  msgstr ""
386
 
387
+ #: admin/admin.php:677
388
  msgid "vote"
389
  msgstr ""
390
 
391
+ #: admin/admin.php:678
392
  msgid "votes"
393
  msgstr ""
394
 
395
+ #: admin/admin.php:681
396
  msgid "Got It. Continue with the migration"
397
  msgstr ""
398
 
399
+ #: admin/admin.php:682
400
  msgid "Hold On. I want to change settings"
401
  msgstr ""
402
 
403
+ #: admin/admin.php:683
404
  msgid "Please review your settings before continue"
405
  msgstr ""
406
 
407
+ #: admin/admin.php:684
408
  msgid "Your selection"
409
  msgstr ""
410
 
411
+ #: admin/admin.php:685
412
  msgid ""
413
  "This setting will migrate all data from previous version without any "
414
  "anonymization"
415
  msgstr ""
416
 
417
+ #: admin/admin.php:686
418
  msgid ""
419
  "This setting will migrate all data from previous version but ips will be "
420
  "anonymized"
421
  msgstr ""
422
 
423
+ #: admin/admin.php:687
424
  msgid "This setting will migrate everything except ip addresses. "
425
  msgstr ""
426
 
427
+ #: admin/admin.php:688
428
  msgid "Response:"
429
  msgstr ""
430
 
431
+ #: admin/admin.php:689
432
  msgid "All done."
433
  msgstr ""
434
 
435
+ #: admin/admin.php:690
436
  msgid "Migration started"
437
  msgstr ""
438
 
439
+ #: admin/admin.php:707 admin/views/polls/edit/main.php:14
440
  msgid "Edit Poll"
441
  msgstr ""
442
 
443
+ #: admin/admin.php:711
444
  msgid "View Poll Results"
445
  msgstr ""
446
 
447
+ #: admin/admin.php:724
448
  msgid "View Logs"
449
  msgstr ""
450
 
451
+ #: admin/admin.php:733 admin/views/bans/add.php:4
452
  msgid "Add Ban"
453
  msgstr ""
454
 
455
+ #: admin/admin.php:737 admin/views/bans/edit.php:4
456
  msgid "Edit Ban"
457
  msgstr ""
458
 
459
+ #: admin/admin.php:741
460
  msgid "All Bans"
461
  msgstr ""
462
 
463
+ #: admin/admin.php:852 admin/admin.php:1451
464
  msgid "You don't have sufficient permissions to access this page"
465
  msgstr ""
466
 
467
+ #: admin/admin.php:872
468
  msgid "Poll successfully added"
469
  msgstr ""
470
 
471
+ #: admin/admin.php:881 admin/admin.php:908 admin/admin.php:911
472
+ #: admin/admin.php:931 admin/admin.php:934 admin/admin.php:937
473
+ #: admin/admin.php:984 admin/admin.php:998 admin/admin.php:1001
474
+ #: admin/admin.php:1004 admin/admin.php:1046 admin/admin.php:1074
475
+ #: admin/admin.php:1293 admin/admin.php:1354 admin/admin.php:1357
476
+ #: admin/admin.php:1360 admin/admin.php:1428 admin/admin.php:1473
477
+ #: admin/admin.php:1476 admin/admin.php:1479 admin/admin.php:1501
478
+ #: admin/admin.php:1504 admin/admin.php:1547 admin/admin.php:1609
479
+ #: admin/admin.php:1612 admin/admin.php:1638 admin/admin.php:1689
480
+ #: admin/admin.php:1709 admin/admin.php:1712 admin/admin.php:1715
481
+ #: admin/admin.php:1762 admin/admin.php:1793 admin/admin.php:1796
482
+ #: admin/inc/ClassYopPollImporter4x.php:851
483
+ #: admin/inc/ClassYopPollImporter4x.php:948
484
+ #: admin/inc/ClassYopPollImporter5x.php:2787
485
+ #: admin/inc/ClassYopPollImporter5x.php:2907
486
  msgid "You are not allowed to perform this action"
487
  msgstr ""
488
 
489
+ #: admin/admin.php:899
490
  msgid "Poll successfully updated"
491
  msgstr ""
492
 
493
+ #: admin/admin.php:926 admin/admin.php:966
494
  msgid "Poll successfully deleted"
495
  msgstr ""
496
 
497
+ #: admin/admin.php:975 admin/models/polls.php:643
498
  msgid "Error deleting poll"
499
  msgid_plural "Error deleting polls"
500
  msgstr[0] ""
501
  msgstr[1] ""
502
 
503
+ #: admin/admin.php:993 admin/admin.php:1028
504
  msgid "Poll successfully cloned"
505
  msgstr ""
506
 
507
+ #: admin/admin.php:1037 admin/models/polls.php:706
508
  msgid "Error cloning poll"
509
  msgid_plural "Error cloning polls"
510
  msgstr[0] ""
511
  msgstr[1] ""
512
 
513
+ #: admin/admin.php:1069
514
  msgid "Votes successfully reset"
515
  msgstr ""
516
 
517
+ #: admin/admin.php:1071 admin/models/polls.php:725
518
  msgid "Error resetting votes"
519
  msgstr ""
520
 
521
+ #: admin/admin.php:1205 admin/admin.php:1244 admin/models/bans.php:411
522
  msgid "Invalid poll"
523
  msgstr ""
524
 
525
+ #: admin/admin.php:1337 admin/admin.php:1592 admin/models/logs.php:462
526
  #: admin/views/custom-field.php:31 admin/views/polls/add/elements.php:15
527
  #: admin/views/polls/edit/elements.php:15
528
  #: admin/views/polls/edit/elements.php:496
531
  msgid "Custom Field"
532
  msgstr ""
533
 
534
+ #: admin/admin.php:1423
535
  msgid "Ban successfully added"
536
  msgstr ""
537
 
538
+ #: admin/admin.php:1468 admin/admin.php:1532
539
  msgid "Ban successfully deleted"
540
  msgstr ""
541
 
542
+ #: admin/admin.php:1496
543
  msgid "Ban successfully updated"
544
  msgstr ""
545
 
546
+ #: admin/admin.php:1539 admin/models/bans.php:388
547
  msgid "Error deleting ban"
548
  msgid_plural "Error deleting bans"
549
  msgstr[0] ""
550
  msgstr[1] ""
551
 
552
+ #: admin/admin.php:1559
553
  msgid "Vote Recorded"
554
  msgstr ""
555
 
556
+ #: admin/admin.php:1564 admin/admin.php:1814
557
  msgid "Invalid data 1"
558
  msgstr ""
559
 
560
+ #: admin/admin.php:1567 admin/admin.php:1817
561
  msgid "Invalid data 2"
562
  msgstr ""
563
 
564
+ #: admin/admin.php:1629 admin/admin.php:1671
565
  msgid "Vote successfully deleted"
566
  msgstr ""
567
 
568
+ #: admin/admin.php:1631 admin/admin.php:1635 admin/admin.php:1680
569
  msgid "Error deleting vote"
570
  msgstr ""
571
 
572
+ #: admin/admin.php:1704 admin/admin.php:1744
573
  msgid "Log successfully deleted"
574
  msgstr ""
575
 
576
+ #: admin/admin.php:1753 admin/models/logs.php:517
577
  msgid "Error deleting log"
578
  msgid_plural "Error deleting logs"
579
  msgstr[0] ""
580
  msgstr[1] ""
581
 
582
+ #: admin/admin.php:1788
583
  msgid "Settings updated"
584
  msgstr ""
585
 
586
+ #: admin/admin.php:1809
587
  msgid "Votes Succesfully Added"
588
  msgstr ""
589
 
590
+ #: admin/admin.php:1831
591
  msgid "Error generating poll"
592
  msgstr ""
593
 
594
+ #: admin/admin.php:1838
595
  msgid "Setting Updated"
596
  msgstr ""
597
 
598
+ #: admin/admin.php:1857
599
  msgid "Guide Sent"
600
  msgstr ""
601
 
635
  msgid "Tracking Id:"
636
  msgstr ""
637
 
638
+ #: admin/inc/ClassYopPollImporter4x.php:490
639
+ #: admin/inc/ClassYopPollImporter4x.php:495
640
+ #: admin/inc/ClassYopPollImporter4x.php:726
641
+ #: admin/inc/ClassYopPollImporter4x.php:731
642
+ #: admin/inc/ClassYopPollImporter4x.php:736
643
+ #: admin/inc/ClassYopPollImporter5x.php:631
644
+ #: admin/inc/ClassYopPollImporter5x.php:636
645
+ #: admin/inc/ClassYopPollImporter5x.php:825
646
+ #: admin/inc/ClassYopPollImporter5x.php:830
647
+ #: admin/inc/ClassYopPollImporter5x.php:1024
648
+ #: admin/inc/ClassYopPollImporter5x.php:1029
649
+ msgid "Processed "
650
+ msgstr ""
651
+
652
+ #: admin/inc/ClassYopPollImporter4x.php:490
653
+ #: admin/inc/ClassYopPollImporter4x.php:495
654
+ #: admin/inc/ClassYopPollImporter4x.php:726
655
+ #: admin/inc/ClassYopPollImporter4x.php:731
656
+ #: admin/inc/ClassYopPollImporter4x.php:736
657
+ #: admin/inc/ClassYopPollImporter5x.php:631
658
+ #: admin/inc/ClassYopPollImporter5x.php:636
659
+ #: admin/inc/ClassYopPollImporter5x.php:825
660
+ #: admin/inc/ClassYopPollImporter5x.php:830
661
+ #: admin/inc/ClassYopPollImporter5x.php:1024
662
+ msgid " out of "
663
+ msgstr ""
664
+
665
+ #: admin/inc/ClassYopPollImporter4x.php:490
666
+ #: admin/inc/ClassYopPollImporter5x.php:631
667
+ msgid " records on table bans."
668
+ msgstr ""
669
+
670
+ #: admin/inc/ClassYopPollImporter4x.php:495
671
+ #: admin/inc/ClassYopPollImporter5x.php:636
672
+ msgid " remaining records on table bans."
673
+ msgstr ""
674
+
675
+ #: admin/inc/ClassYopPollImporter4x.php:503
676
+ #: admin/inc/ClassYopPollImporter5x.php:644
677
  msgid "No bans to process."
678
  msgstr ""
679
 
680
+ #: admin/inc/ClassYopPollImporter4x.php:509
681
+ #: admin/inc/ClassYopPollImporter5x.php:650
682
  msgid "No bans table, skipping."
683
  msgstr ""
684
 
685
+ #: admin/inc/ClassYopPollImporter4x.php:726
686
+ #: admin/inc/ClassYopPollImporter4x.php:731
687
+ #: admin/inc/ClassYopPollImporter5x.php:825
688
+ msgid " records on table votes."
689
+ msgstr ""
690
+
691
+ #: admin/inc/ClassYopPollImporter4x.php:736
692
+ #: admin/inc/ClassYopPollImporter5x.php:830
693
+ msgid " remaining records on table votes."
694
+ msgstr ""
695
+
696
+ #: admin/inc/ClassYopPollImporter4x.php:748
697
+ #: admin/inc/ClassYopPollImporter4x.php:754
698
+ #: admin/inc/ClassYopPollImporter5x.php:686
699
+ #: admin/inc/ClassYopPollImporter5x.php:842
700
  msgid "No votes to process."
701
  msgstr ""
702
 
703
+ #: admin/inc/ClassYopPollImporter4x.php:760
704
+ #: admin/inc/ClassYopPollImporter5x.php:849
705
  msgid "No votes table, skipping."
706
  msgstr ""
707
 
708
+ #: admin/inc/ClassYopPollImporter5x.php:884
709
  msgid "No logs to process."
710
  msgstr ""
711
 
712
+ #: admin/inc/ClassYopPollImporter5x.php:1024
713
+ #: admin/inc/ClassYopPollImporter5x.php:1029
714
+ msgid " records on table logs."
715
+ msgstr ""
716
+
717
+ #: admin/inc/ClassYopPollImporter5x.php:1029
718
+ msgid " out of remaining "
719
+ msgstr ""
720
+
721
+ #: admin/inc/ClassYopPollImporter5x.php:1042
722
  msgid "No logs table, skipping."
723
  msgstr ""
724
 
725
+ #: admin/inc/maintenance.php:265
726
+ msgid "Click <a href=\""
727
+ msgstr ""
728
+
729
+ #: admin/inc/maintenance.php:265
730
+ msgid "here"
731
+ msgstr ""
732
+
733
+ #: admin/inc/maintenance.php:265
734
+ msgid "to start the import."
735
+ msgstr ""
736
+
737
+ #: admin/models/bans.php:73 admin/models/logs.php:96 admin/models/polls.php:126
738
  #: admin/models/votes.php:1259
739
  msgid "Previous page"
740
  msgstr ""
741
 
742
+ #: admin/models/bans.php:78 admin/models/logs.php:101
743
+ #: admin/models/polls.php:131 admin/models/votes.php:1264
744
  msgid "Next page"
745
  msgstr ""
746
 
747
+ #: admin/models/bans.php:339
748
  msgid "Error adding ban"
749
  msgstr ""
750
 
751
+ #: admin/models/bans.php:365
752
  msgid "Error updating ban"
753
  msgstr ""
754
 
755
+ #: admin/models/bans.php:370 admin/models/polls.php:602
756
  msgid "Error updating poll"
757
  msgstr ""
758
 
759
+ #: admin/models/bans.php:407
760
  msgid "Error deleting bans"
761
  msgstr ""
762
 
763
+ #: admin/models/bans.php:435 admin/models/polls.php:859
764
  #: admin/models/settings.php:461
765
  msgid "Invalid data"
766
  msgstr ""
767
 
768
+ #: admin/models/bans.php:443
769
  msgid "Data for \"Poll\" is invalid"
770
  msgstr ""
771
 
772
+ #: admin/models/bans.php:453
773
  msgid "Data for \"Ban by\" is invalid"
774
  msgstr ""
775
 
776
+ #: admin/models/bans.php:461
777
  msgid "Data for \"Ban Value\" is invalid"
778
  msgstr ""
779
 
780
+ #: admin/models/elements.php:41 admin/models/elements.php:270
781
  msgid "Error adding element"
782
  msgstr ""
783
 
784
+ #: admin/models/elements.php:98
785
  msgid "Error updating element"
786
  msgstr ""
787
 
788
+ #: admin/models/elements.php:132 admin/models/elements.php:159
789
  msgid "Error deleting element"
790
  msgstr ""
791
 
792
+ #: admin/models/elements.php:136
793
  msgid "Invalid element id"
794
  msgstr ""
795
 
796
+ #: admin/models/logs.php:434 admin/models/votes.php:1570
797
  msgid "Poll Name"
798
  msgstr ""
799
 
800
+ #: admin/models/logs.php:435 admin/models/votes.php:1571
801
  #: admin/views/bans/add.php:54 admin/views/bans/edit.php:106
802
+ #: admin/views/logs/view.php:239 admin/views/logs/view.php:470
803
+ #: admin/views/results/votes.php:337 admin/views/results/votes.php:512
804
  msgid "Username"
805
  msgstr ""
806
 
807
+ #: admin/models/logs.php:436 admin/models/votes.php:1572
808
  #: admin/views/bans/add.php:51 admin/views/bans/edit.php:103
809
+ #: admin/views/logs/view.php:263 admin/views/logs/view.php:494
810
+ #: admin/views/results/votes.php:361 admin/views/results/votes.php:536
811
  msgid "Email"
812
  msgstr ""
813
 
814
+ #: admin/models/logs.php:437 admin/models/votes.php:1573
815
+ #: admin/views/logs/view.php:287 admin/views/logs/view.php:518
816
+ #: admin/views/results/votes.php:313 admin/views/results/votes.php:488
817
  msgid "User Type"
818
  msgstr ""
819
 
820
+ #: admin/models/logs.php:438 admin/models/votes.php:1574
821
  #: admin/views/bans/add.php:48 admin/views/bans/edit.php:100
822
  msgid "IP"
823
  msgstr ""
824
 
825
+ #: admin/models/logs.php:439 admin/models/votes.php:1575
826
+ #: admin/views/logs/view.php:335 admin/views/logs/view.php:566
827
+ #: admin/views/results/votes.php:409 admin/views/results/votes.php:584
828
  msgid "Date"
829
  msgstr ""
830
 
831
+ #: admin/models/logs.php:440 admin/views/logs/view.php:359
832
+ #: admin/views/logs/view.php:590 admin/views/polls/add/options-poll.php:287
833
  #: admin/views/polls/edit/options-poll.php:462
834
  msgid "Message"
835
  msgstr ""
836
 
837
+ #: admin/models/logs.php:441 admin/models/votes.php:1576
838
  msgid "Vote data"
839
  msgstr ""
840
 
841
+ #: admin/models/logs.php:451 admin/models/votes.php:1623
842
+ #: admin/models/votes.php:1656
843
  msgid "Can't open php://output!"
844
  msgstr ""
845
 
846
+ #: admin/models/logs.php:453 admin/models/votes.php:1627
847
+ #: admin/models/votes.php:1663
848
  msgid "Can't write header!"
849
  msgstr ""
850
 
852
  msgid "Can't write logs!"
853
  msgstr ""
854
 
855
+ #: admin/models/logs.php:487 admin/models/votes.php:1636
856
+ #: admin/models/votes.php:1670
857
  msgid "Can't close php://output!"
858
  msgstr ""
859
 
860
+ #: admin/models/logs.php:657
861
  msgid "Error deleting logs"
862
  msgstr ""
863
 
864
+ #: admin/models/polls.php:489 admin/models/polls.php:700
865
  msgid "Error adding page"
866
  msgstr ""
867
 
868
+ #: admin/models/polls.php:498 admin/models/polls.php:590
869
  msgid "Error adding poll"
870
  msgstr ""
871
 
872
+ #: admin/models/polls.php:502
873
  msgid "A poll with this name already exists"
874
  msgstr ""
875
 
876
+ #: admin/models/polls.php:658 admin/models/polls.php:681
877
  msgid "clone"
878
  msgstr ""
879
 
880
+ #: admin/models/polls.php:867
881
  msgid "Data for \"Poll Name\" is invalid"
882
  msgstr ""
883
 
884
+ #: admin/models/polls.php:876
885
  msgid "Data for \"Template\" is invalid"
886
  msgstr ""
887
 
888
+ #: admin/models/polls.php:885
889
  msgid "Data for \"Poll Background Color\" is invalid"
890
  msgstr ""
891
 
892
+ #: admin/models/polls.php:894
893
  msgid "Data for \"Poll Border Thickness\" is invalid"
894
  msgstr ""
895
 
896
+ #: admin/models/polls.php:903
897
  msgid "Data for \"Poll Border Color\" is invalid"
898
  msgstr ""
899
 
900
+ #: admin/models/polls.php:912
901
  msgid "Data for \"Poll Border Radius\" is invalid"
902
  msgstr ""
903
 
904
+ #: admin/models/polls.php:921
905
  msgid "Data for \"Poll Padding Left/Right\" is invalid"
906
  msgstr ""
907
 
908
+ #: admin/models/polls.php:930
909
  msgid "Data for \"Poll Padding Top/Bottom\" is invalid"
910
  msgstr ""
911
 
912
+ #: admin/models/polls.php:940
913
  msgid "Data for \"Question Text Color\" is invalid"
914
  msgstr ""
915
 
916
+ #: admin/models/polls.php:948
917
  msgid "Data for \"Question Text Size\" is invalid"
918
  msgstr ""
919
 
920
+ #: admin/models/polls.php:957
921
  msgid "Data for \"Question Text Weight\" is invalid"
922
  msgstr ""
923
 
924
+ #: admin/models/polls.php:966
925
  msgid "Data for \"Question Text Align\" is invalid"
926
  msgstr ""
927
 
928
+ #: admin/models/polls.php:976
929
  msgid "Data for \"Answers Padding Left/Right\" is invalid"
930
  msgstr ""
931
 
932
+ #: admin/models/polls.php:985
933
  msgid "Data for \"Answers Padding Top/Bottom\" is invalid"
934
  msgstr ""
935
 
936
+ #: admin/models/polls.php:994
937
  msgid "Data for \"Answers Text Color\" is invalid"
938
  msgstr ""
939
 
940
+ #: admin/models/polls.php:1002
941
  msgid "Data for \"Answers Text Size\" is invalid"
942
  msgstr ""
943
 
944
+ #: admin/models/polls.php:1011
945
  msgid "Data for \"Answers Text Weight\" is invalid"
946
  msgstr ""
947
 
948
+ #: admin/models/polls.php:1021
949
  msgid "Data for \"Buttons Background Color\" is invalid"
950
  msgstr ""
951
 
952
+ #: admin/models/polls.php:1030
953
  msgid "Data for \"Buttons Border Thickness\" is invalid"
954
  msgstr ""
955
 
956
+ #: admin/models/polls.php:1039
957
  msgid "Data for \"Buttons Border Color\" is invalid"
958
  msgstr ""
959
 
960
+ #: admin/models/polls.php:1048
961
  msgid "Data for \"Buttons Border Radius\" is invalid"
962
  msgstr ""
963
 
964
+ #: admin/models/polls.php:1057
965
  msgid "Data for \"Buttons Padding Left/Right\" is invalid"
966
  msgstr ""
967
 
968
+ #: admin/models/polls.php:1066
969
  msgid "Data for \"Buttons Padding Top/Bottom\" is invalid"
970
  msgstr ""
971
 
972
+ #: admin/models/polls.php:1075 admin/models/polls.php:1138
973
  msgid "Data for \"Buttons Text Color\" is invalid"
974
  msgstr ""
975
 
976
+ #: admin/models/polls.php:1083
977
  msgid "Data for \"Buttons Text Size\" is invalid"
978
  msgstr ""
979
 
980
+ #: admin/models/polls.php:1092
981
  msgid "Data for \"Buttons Text Weight\" is invalid"
982
  msgstr ""
983
 
984
+ #: admin/models/polls.php:1102
985
  msgid "Data for \"Messages Border Color For Success\" is invalid"
986
  msgstr ""
987
 
988
+ #: admin/models/polls.php:1111
989
  msgid "Data for \"Messages Border Color For Error\" is invalid"
990
  msgstr ""
991
 
992
+ #: admin/models/polls.php:1120
993
  msgid "Data for \"Messages Border Left Thickness\" is invalid"
994
  msgstr ""
995
 
996
+ #: admin/models/polls.php:1129
997
  msgid "Data for \"Messages Padding Top/Bottom\" is invalid"
998
  msgstr ""
999
 
1000
+ #: admin/models/polls.php:1146
1001
  msgid "Data for \"Messages Text Size\" is invalid"
1002
  msgstr ""
1003
 
1004
+ #: admin/models/polls.php:1155
1005
  msgid "Data for \"Messages Text Weight\" is invalid"
1006
  msgstr ""
1007
 
1008
+ #: admin/models/polls.php:1163
1009
  msgid "No elements present"
1010
  msgstr ""
1011
 
1012
+ #: admin/models/polls.php:1177
1013
  msgid "Data for \"Question\" is invalid"
1014
  msgstr ""
1015
 
1016
+ #: admin/models/polls.php:1184
1017
  msgid "At least one answer per question is required"
1018
  msgstr ""
1019
 
1020
+ #: admin/models/polls.php:1198
1021
  msgid "Answer text is invalid"
1022
  msgstr ""
1023
 
1024
+ #: admin/models/polls.php:1205
1025
  msgid "Data for default answer is invalid"
1026
  msgstr ""
1027
 
1028
+ #: admin/models/polls.php:1212
1029
  msgid " Data for \"Answer Link\" is invalid"
1030
  msgstr ""
1031
 
1032
+ #: admin/models/polls.php:1222
1033
  msgid "Data for \"Answer link\" is invalid"
1034
  msgstr ""
1035
 
1036
+ #: admin/models/polls.php:1231
1037
  msgid "Data for \"Allow other options\" is invalid"
1038
  msgstr ""
1039
 
1040
+ #: admin/models/polls.php:1241
1041
  msgid "Data for \"Label for Other Answers\" is invalid"
1042
  msgstr ""
1043
 
1044
+ #: admin/models/polls.php:1248
1045
  msgid "Data for \"Add other answers in answer list\" is invalid"
1046
  msgstr ""
1047
 
1048
+ #: admin/models/polls.php:1255
1049
  msgid "Data for \"Display other answers in results list\" is invalid"
1050
  msgstr ""
1051
 
1052
+ #: admin/models/polls.php:1262
1053
  msgid "Data for \"Allow multiple answers \" is invalid"
1054
  msgstr ""
1055
 
1056
+ #: admin/models/polls.php:1270 admin/models/polls.php:1285
1057
  #: admin/models/settings.php:667
1058
  msgid "Data for \"Minimum answers required\" is invalid"
1059
  msgstr ""
1060
 
1061
+ #: admin/models/polls.php:1278 admin/models/polls.php:1302
1062
  #: admin/models/settings.php:675
1063
  msgid "Data for \"Maximum answers required\" is invalid"
1064
  msgstr ""
1065
 
1066
+ #: admin/models/polls.php:1292
1067
  msgid "Data for \"Display answers\" is invalid"
1068
  msgstr ""
1069
 
1070
+ #: admin/models/polls.php:1309
1071
  msgid "Data for \"Sort Answers\" is invalid"
1072
  msgstr ""
1073
 
1074
+ #: admin/models/polls.php:1322
1075
  msgid "Data for \"Custom Field\" is invalid"
1076
  msgstr ""
1077
 
1078
+ #: admin/models/polls.php:1329
1079
  msgid "Data for \"Make Required\" is invalid"
1080
  msgstr ""
1081
 
1082
+ #: admin/models/polls.php:1348
1083
  msgid "Data for \"Vote Button Label\" is invalid"
1084
  msgstr ""
1085
 
1086
+ #: admin/models/polls.php:1355
1087
  msgid "Data for \"Show [Results] link\" is invalid"
1088
  msgstr ""
1089
 
1090
+ #: admin/models/polls.php:1366
1091
  msgid "Data for \"[Results] Link Label\" is invalid"
1092
  msgstr ""
1093
 
1094
+ #: admin/models/polls.php:1373
1095
  msgid "Data for \"Show Total Votes\" is invalid"
1096
  msgstr ""
1097
 
1098
+ #: admin/models/polls.php:1380
1099
  msgid "Data for \"Show Total Answers\" is invalid"
1100
  msgstr ""
1101
 
1102
+ #: admin/models/polls.php:1387 admin/models/polls.php:1396
1103
  msgid "Data for \"Start Date\" is invalid"
1104
  msgstr ""
1105
 
1106
+ #: admin/models/polls.php:1403 admin/models/polls.php:1412
1107
  msgid "Data for \"End Date\" is invalid"
1108
  msgstr ""
1109
 
1110
+ #: admin/models/polls.php:1419
1111
  msgid "Data for \"Redirect after vote\" is invalid"
1112
  msgstr ""
1113
 
1114
+ #: admin/models/polls.php:1430
1115
  msgid "Data for \"Redirect Url\" is invalid"
1116
  msgstr ""
1117
 
1118
+ #: admin/models/polls.php:1437
1119
  msgid "Data for \"Reset Poll Stats automatically\" is invalid"
1120
  msgstr ""
1121
 
1122
+ #: admin/models/polls.php:1444
1123
  msgid "Data for \"Reset Every\" is invalid"
1124
  msgstr ""
1125
 
1126
+ #: admin/models/polls.php:1451
1127
  msgid "Data for \"Auto Generate Poll Page\" is invalid"
1128
  msgstr ""
1129
 
1130
+ #: admin/models/polls.php:1458
1131
  msgid "Data for \"Use Captcha\" is invalid"
1132
  msgstr ""
1133
 
1134
+ #: admin/models/polls.php:1465
1135
  msgid "Data for \"Send Email notifications\" is invalid"
1136
  msgstr ""
1137
 
1138
+ #: admin/models/polls.php:1474
1139
  msgid "Data for \"From Name\" is invalid"
1140
  msgstr ""
1141
 
1142
+ #: admin/models/polls.php:1483
1143
  msgid "Data for \"From Email\" is invalid"
1144
  msgstr ""
1145
 
1146
+ #: admin/models/polls.php:1492
1147
  msgid "Data for \"Recipients\" is invalid"
1148
  msgstr ""
1149
 
1150
+ #: admin/models/polls.php:1501
1151
  msgid "Data for \"Subject\" is invalid"
1152
  msgstr ""
1153
 
1154
+ #: admin/models/polls.php:1510
1155
  msgid "Data for \"Message\" is invalid"
1156
  msgstr ""
1157
 
1158
+ #: admin/models/polls.php:1519
1159
  msgid "Data for \"Show results\" is invalid"
1160
  msgstr ""
1161
 
1162
+ #: admin/models/polls.php:1528
1163
  msgid "Data for \"Show Results\" is invalid"
1164
  msgstr ""
1165
 
1166
+ #: admin/models/polls.php:1537
1167
  msgid "Data for \"Show results to\" is invalid"
1168
  msgstr ""
1169
 
1170
+ #: admin/models/polls.php:1544
1171
  msgid "Data for \"Display [Back to vote] link\" is invalid"
1172
  msgstr ""
1173
 
1174
+ #: admin/models/polls.php:1555
1175
  msgid "Data for \"[Back to vote] caption\" is invalid"
1176
  msgstr ""
1177
 
1178
+ #: admin/models/polls.php:1562
1179
  msgid "Data for \"Sort Results\" is invalid"
1180
  msgstr ""
1181
 
1182
+ #: admin/models/polls.php:1570
1183
  msgid "Data for \"Sort rule\" is invalid"
1184
  msgstr ""
1185
 
1186
+ #: admin/models/polls.php:1577
1187
  msgid "Data for \"Display Results As\""
1188
  msgstr ""
1189
 
1190
+ #: admin/models/polls.php:1585
1191
  msgid "Data for \"Vote Permissions\" is invalid"
1192
  msgstr ""
1193
 
1194
+ #: admin/models/polls.php:1602
1195
  msgid "Data for \"Block Voters\" is invalid"
1196
  msgstr ""
1197
 
1198
+ #: admin/models/polls.php:1614
1199
  msgid "Data for \"Block Period\" is invalid"
1200
  msgstr ""
1201
 
1202
+ #: admin/models/polls.php:1621
1203
  msgid "Data for \"Limit Number Of Votes per User\" is invalid"
1204
  msgstr ""
1205
 
1206
+ #: admin/models/polls.php:1629
1207
  msgid "Data for \"Votes per user\" is invalid"
1208
  msgstr ""
1209
 
1210
+ #: admin/models/polls.php:2464
1211
  msgid "Number of votes for each question should be the same"
1212
  msgstr ""
1213
 
1214
+ #: admin/models/polls.php:2468 admin/views/settings/view.php:459
1215
  msgid "Invalid Poll"
1216
  msgstr ""
1217
 
1357
  msgid "Data for \"Refresh Title\" is invalid"
1358
  msgstr ""
1359
 
1360
+ #: admin/models/subelements.php:56 admin/models/subelements.php:101
1361
+ #: admin/models/subelements.php:299
1362
  msgid "Error adding answers"
1363
  msgstr ""
1364
 
1365
+ #: admin/models/subelements.php:129 admin/models/subelements.php:156
1366
+ #: admin/models/subelements.php:180 admin/models/subelements.php:433
1367
  msgid "Error deleting answer"
1368
  msgstr ""
1369
 
1370
+ #: admin/models/subelements.php:133
1371
  msgid "Invalid answer id"
1372
  msgstr ""
1373
 
1374
+ #: admin/models/votes.php:1579
1375
  msgid "Custom field - "
1376
  msgstr ""
1377
 
1378
+ #: admin/models/votes.php:1632 admin/models/votes.php:1667
1379
  msgid "Can't write votes!"
1380
  msgstr ""
1381
 
1382
  #: admin/views/bans/add.php:18 admin/views/bans/edit.php:18
1383
+ #: admin/views/bans/view.php:264 admin/views/bans/view.php:474
1384
+ #: admin/views/logs/view.php:215 admin/views/logs/view.php:446
1385
  #: admin/views/polls/add/main.php:98 admin/views/polls/edit/main.php:114
1386
  msgid "Poll"
1387
  msgstr ""
1388
 
1389
  #: admin/views/bans/add.php:43 admin/views/bans/edit.php:67
1390
+ #: admin/views/bans/view.php:312 admin/views/bans/view.php:522
1391
  msgid "Ban By"
1392
  msgstr ""
1393
 
1394
  #: admin/views/bans/add.php:67 admin/views/bans/edit.php:119
1395
+ #: admin/views/bans/view.php:336 admin/views/bans/view.php:546
1396
  msgid "Value"
1397
  msgstr ""
1398
 
1405
  msgid "Update"
1406
  msgstr ""
1407
 
1408
+ #: admin/views/bans/view.php:165 admin/views/bans/view.php:169
1409
  msgid "Search Bans"
1410
  msgstr ""
1411
 
1412
+ #: admin/views/bans/view.php:176 admin/views/bans/view.php:581
1413
+ #: admin/views/logs/view.php:127 admin/views/logs/view.php:601
1414
+ #: admin/views/polls/view.php:233 admin/views/polls/view.php:775
1415
+ #: admin/views/results/votes.php:225 admin/views/results/votes.php:595
1416
  msgid "Select bulk action"
1417
  msgstr ""
1418
 
1419
+ #: admin/views/bans/view.php:180 admin/views/bans/view.php:585
1420
+ #: admin/views/logs/view.php:131 admin/views/logs/view.php:605
1421
+ #: admin/views/polls/view.php:237 admin/views/polls/view.php:779
1422
+ #: admin/views/results/votes.php:229 admin/views/results/votes.php:599
1423
  msgid "Bulk Actions"
1424
  msgstr ""
1425
 
1426
+ #: admin/views/bans/view.php:183 admin/views/bans/view.php:588
1427
+ #: admin/views/logs/view.php:134 admin/views/logs/view.php:608
1428
+ #: admin/views/polls/view.php:240 admin/views/polls/view.php:782
1429
+ #: admin/views/results/votes.php:232 admin/views/results/votes.php:602
1430
  msgid "Move to Trash"
1431
  msgstr ""
1432
 
1433
+ #: admin/views/bans/view.php:186 admin/views/bans/view.php:591
1434
+ #: admin/views/logs/view.php:137 admin/views/logs/view.php:611
1435
+ #: admin/views/polls/view.php:249 admin/views/polls/view.php:791
1436
+ #: admin/views/results/votes.php:235 admin/views/results/votes.php:605
1437
  msgid "Apply"
1438
  msgstr ""
1439
 
1440
+ #: admin/views/bans/view.php:189
1441
  msgid "Bans list navigation"
1442
  msgstr ""
1443
 
1444
+ #: admin/views/bans/view.php:198 admin/views/bans/view.php:616
1445
+ #: admin/views/logs/view.php:149 admin/views/logs/view.php:623
1446
+ #: admin/views/polls/view.php:258 admin/views/polls/view.php:267
1447
+ #: admin/views/polls/view.php:803 admin/views/results/votes.php:247
1448
+ #: admin/views/results/votes.php:617
1449
+ msgid "items"
1450
+ msgstr ""
1451
+
1452
+ #: admin/views/bans/view.php:200 admin/views/bans/view.php:618
1453
+ #: admin/views/logs/view.php:151 admin/views/logs/view.php:625
1454
+ #: admin/views/polls/view.php:269 admin/views/polls/view.php:805
1455
+ #: admin/views/results/votes.php:249 admin/views/results/votes.php:619
1456
+ msgid "item"
1457
+ msgstr ""
1458
 
1459
+ #: admin/views/bans/view.php:241 admin/views/bans/view.php:451
1460
+ #: admin/views/logs/view.php:192 admin/views/logs/view.php:423
1461
+ #: admin/views/polls/view.php:310 admin/views/polls/view.php:623
1462
+ #: admin/views/results/votes.php:290 admin/views/results/votes.php:465
1463
  msgid "Select All"
1464
  msgstr ""
1465
 
1466
+ #: admin/views/bans/view.php:288 admin/views/bans/view.php:498
1467
+ #: admin/views/polls/view.php:409 admin/views/polls/view.php:720
1468
  msgid "Author"
1469
  msgstr ""
1470
 
1471
+ #: admin/views/bans/view.php:360 admin/views/bans/view.php:570
1472
  msgid "Added On"
1473
  msgstr ""
1474
 
1475
+ #: admin/views/bans/view.php:373 admin/views/logs/view.php:372
1476
+ #: admin/views/polls/view.php:489 admin/views/results/votes.php:422
1477
  msgid "Select"
1478
  msgstr ""
1479
 
1480
+ #: admin/views/bans/view.php:396 admin/views/polls/view.php:513
1481
  msgid "Poll name"
1482
  msgstr ""
1483
 
1484
+ #: admin/views/bans/view.php:418
1485
  msgid "Edit this ban"
1486
  msgstr ""
1487
 
1488
+ #: admin/views/bans/view.php:419 admin/views/polls/add/elements.php:110
1489
  #: admin/views/polls/add/elements.php:184 admin/views/polls/add/main.php:169
1490
  #: admin/views/polls/add/main.php:198 admin/views/polls/edit/elements.php:118
1491
  #: admin/views/polls/edit/elements.php:480 admin/views/polls/edit/main.php:185
1492
  #: admin/views/polls/edit/main.php:223
1493
  #: admin/views/polls/elements-definitions.php:12
1494
  #: admin/views/polls/elements-definitions.php:233
1495
+ #: admin/views/polls/view.php:536
1496
  msgid "Edit"
1497
  msgstr ""
1498
 
1499
+ #: admin/views/bans/view.php:423
1500
  msgid "Move this ban to the Trash"
1501
  msgstr ""
1502
 
1503
+ #: admin/views/bans/view.php:426 admin/views/logs/view.php:388
1504
+ #: admin/views/polls/view.php:543 admin/views/results/votes.php:437
1505
  msgid "Trash"
1506
  msgstr ""
1507
 
1508
+ #: admin/views/bans/view.php:596
1509
  msgid "Filter by date"
1510
  msgstr ""
1511
 
1512
+ #: admin/views/bans/view.php:600
1513
  msgid "View All Polls"
1514
  msgstr ""
1515
 
1516
+ #: admin/views/bans/view.php:603
1517
  msgid "Filter"
1518
  msgstr ""
1519
 
1520
+ #: admin/views/bans/view.php:607 admin/views/logs/view.php:614
1521
+ #: admin/views/polls/view.php:252 admin/views/polls/view.php:794
1522
+ #: admin/views/results/votes.php:608
1523
  msgid "Pages list navigation"
1524
  msgstr ""
1525
 
1591
  #: admin/views/polls/elements-definitions.php:139
1592
  #: admin/views/polls/elements-definitions.php:150
1593
  #: admin/views/polls/elements-definitions.php:172
1594
+ #: admin/views/polls/view.php:884 admin/views/settings/view.php:56
1595
  #: admin/views/settings/view.php:76 admin/views/settings/view.php:139
1596
  #: admin/views/settings/view.php:181 admin/views/settings/view.php:223
1597
  #: admin/views/settings/view.php:273 admin/views/settings/view.php:318
1636
  #: admin/views/polls/elements-definitions.php:140
1637
  #: admin/views/polls/elements-definitions.php:151
1638
  #: admin/views/polls/elements-definitions.php:173
1639
+ #: admin/views/polls/view.php:885 admin/views/settings/view.php:57
1640
  #: admin/views/settings/view.php:77 admin/views/settings/view.php:140
1641
  #: admin/views/settings/view.php:182 admin/views/settings/view.php:224
1642
  #: admin/views/settings/view.php:274 admin/views/settings/view.php:319
1670
  msgid "Search Logs"
1671
  msgstr ""
1672
 
1673
+ #: admin/views/logs/view.php:120 admin/views/results/view.php:366
1674
+ #: admin/views/results/votes.php:149
1675
  msgid "Export"
1676
  msgstr ""
1677
 
1679
  msgid "Logs list navigation"
1680
  msgstr ""
1681
 
1682
+ #: admin/views/logs/view.php:311 admin/views/logs/view.php:542
1683
+ #: admin/views/results/votes.php:385 admin/views/results/votes.php:560
1684
  msgid "Ipaddress"
1685
  msgstr ""
1686
 
1687
+ #: admin/views/logs/view.php:383 admin/views/results/votes.php:431
1688
  msgid "View details for this record"
1689
  msgstr ""
1690
 
1691
+ #: admin/views/logs/view.php:387 admin/views/results/votes.php:436
1692
  msgid "Move this log record to the Trash"
1693
  msgstr ""
1694
 
1847
 
1848
  #: admin/views/polls/add/design-custom-styles.php:186
1849
  #: admin/views/polls/edit/design-custom-styles.php:221
1850
+ #: admin/views/results/view.php:132
1851
  msgid "Answers"
1852
  msgstr ""
1853
 
2055
 
2056
  #: admin/views/polls/add/elements.php:275
2057
  #: admin/views/polls/elements-definitions.php:130
2058
+ #: admin/views/results/view.php:111 admin/views/results/view.php:238
2059
  msgid "Other"
2060
  msgstr ""
2061
 
2243
  msgstr ""
2244
 
2245
  #: admin/views/polls/add/main.php:178 admin/views/polls/edit/main.php:203
2246
+ #: admin/views/polls/view.php:187
2247
  msgid "Published"
2248
  msgstr ""
2249
 
2250
  #: admin/views/polls/add/main.php:181 admin/views/polls/edit/main.php:206
2251
+ #: admin/views/polls/view.php:195
2252
  msgid "Draft"
2253
  msgstr ""
2254
 
2412
  msgstr ""
2413
 
2414
  #: admin/views/polls/add/options-poll.php:87
2415
+ #: admin/views/polls/edit/options-poll.php:130 admin/views/polls/view.php:431
2416
+ #: admin/views/polls/view.php:742
2417
  msgid "Start Date"
2418
  msgstr ""
2419
 
2432
  msgstr ""
2433
 
2434
  #: admin/views/polls/add/options-poll.php:111
2435
+ #: admin/views/polls/edit/options-poll.php:165 admin/views/polls/view.php:453
2436
+ #: admin/views/polls/view.php:764
2437
  msgid "End Date"
2438
  msgstr ""
2439
 
2440
  #: admin/views/polls/add/options-poll.php:115
2441
  #: admin/views/polls/add/options-results.php:48
2442
  #: admin/views/polls/edit/options-poll.php:180
2443
+ #: admin/views/polls/edit/options-results.php:78 admin/views/polls/view.php:609
2444
  msgid "Never"
2445
  msgstr ""
2446
 
2687
 
2688
  #: admin/views/polls/add/options-results.php:156
2689
  #: admin/views/polls/edit/options-results.php:275
2690
+ #: admin/views/results/view.php:138 admin/views/results/view.php:153
2691
  msgid "Pie"
2692
  msgstr ""
2693
 
2723
  msgid "New Answer"
2724
  msgstr ""
2725
 
2726
+ #: admin/views/polls/view.php:179
2727
  msgid "All"
2728
  msgstr ""
2729
 
2730
+ #: admin/views/polls/view.php:203
2731
  msgid "Ending Soon"
2732
  msgstr ""
2733
 
2734
+ #: admin/views/polls/view.php:211
2735
  msgid "Ended"
2736
  msgstr ""
2737
 
2738
+ #: admin/views/polls/view.php:222 admin/views/polls/view.php:226
2739
  msgid "Search Polls"
2740
  msgstr ""
2741
 
2742
+ #: admin/views/polls/view.php:243 admin/views/polls/view.php:547
2743
+ #: admin/views/polls/view.php:550 admin/views/polls/view.php:785
2744
  msgid "Clone"
2745
  msgstr ""
2746
 
2747
+ #: admin/views/polls/view.php:246 admin/views/polls/view.php:788
2748
  msgid "Reset Votes"
2749
  msgstr ""
2750
 
2751
+ #: admin/views/polls/view.php:258
 
 
 
 
2752
  msgid "page"
2753
  msgstr ""
2754
 
2755
+ #: admin/views/polls/view.php:259
2756
  msgid "Set"
2757
  msgstr ""
2758
 
2759
+ #: admin/views/polls/view.php:333 admin/views/polls/view.php:644
2760
  msgid "Title"
2761
  msgstr ""
2762
 
2763
+ #: admin/views/polls/view.php:360 admin/views/polls/view.php:671
2764
  msgid "Status"
2765
  msgstr ""
2766
 
2767
+ #: admin/views/polls/view.php:367 admin/views/polls/view.php:678
2768
  msgid "Code"
2769
  msgstr ""
2770
 
2771
+ #: admin/views/polls/view.php:387 admin/views/polls/view.php:698
2772
  msgid "Votes"
2773
  msgstr ""
2774
 
2775
+ #: admin/views/polls/view.php:535
2776
  msgid "Edit this poll"
2777
  msgstr ""
2778
 
2779
+ #: admin/views/polls/view.php:540
2780
  msgid "Move this poll to the Trash"
2781
  msgstr ""
2782
 
2783
+ #: admin/views/polls/view.php:572
2784
  msgid "View Results"
2785
  msgstr ""
2786
 
2787
+ #: admin/views/polls/view.php:844
2788
  msgid "Generate Poll Shortcode"
2789
  msgstr ""
2790
 
2791
+ #: admin/views/polls/view.php:849
2792
  msgid "Place the shortcode on your pages or posts to display the poll:"
2793
  msgstr ""
2794
 
2795
+ #: admin/views/polls/view.php:860
2796
  msgid "Copy to Clipboard"
2797
  msgstr ""
2798
 
2799
+ #: admin/views/polls/view.php:867
2800
  msgid "To customize it, you can use the options below"
2801
  msgstr ""
2802
 
2803
+ #: admin/views/polls/view.php:872
2804
  msgid "Tracking Id"
2805
  msgstr ""
2806
 
2807
+ #: admin/views/polls/view.php:875
2808
  msgid "Leave empty if none"
2809
  msgstr ""
2810
 
2811
+ #: admin/views/polls/view.php:880
2812
  msgid "Display Results Only"
2813
  msgstr ""
2814
 
2815
+ #: admin/views/polls/view.php:892
2816
  msgid "Generate Code"
2817
  msgstr ""
2818
 
2820
  msgid "Poll results for"
2821
  msgstr ""
2822
 
2823
+ #: admin/views/results/view.php:53 admin/views/results/votes.php:131
2824
  msgid "View votes"
2825
  msgstr ""
2826
 
2827
+ #: admin/views/results/view.php:137 admin/views/results/view.php:152
2828
  msgid "Bar"
2829
  msgstr ""
2830
 
2831
+ #: admin/views/results/view.php:147
2832
  msgid "Voters"
2833
  msgstr ""
2834
 
2835
+ #: admin/views/results/view.php:213 admin/views/results/view.php:244
2836
+ #: admin/views/results/view.php:314
2837
  msgid " votes"
2838
  msgstr ""
2839
 
2840
+ #: admin/views/results/view.php:215 admin/views/results/view.php:246
2841
+ #: admin/views/results/view.php:316
2842
  msgid " vote"
2843
  msgstr ""
2844
 
2845
+ #: admin/views/results/view.php:355
2846
  msgid "Custom fields"
2847
  msgstr ""
2848
 
2849
+ #: admin/views/results/votes.php:141 admin/views/results/votes.php:147
2850
  msgid "Search Votes"
2851
  msgstr ""
2852
 
2853
+ #: admin/views/results/votes.php:152 admin/views/results/votes.php:213
2854
  msgid "Add Votes"
2855
  msgstr ""
2856
 
2857
+ #: admin/views/results/votes.php:160
2858
  msgid "Add Votes Manually"
2859
  msgstr ""
2860
 
2861
+ #: admin/views/results/votes.php:190
2862
  msgid "Number of votes for this answer"
2863
  msgstr ""
2864
 
2865
+ #: admin/views/results/votes.php:238
2866
  msgid "Votes list navigation"
2867
  msgstr ""
2868
 
public/assets/css/{yop-poll-public-6.4.3.css → yop-poll-public-6.4.4.css} RENAMED
File without changes
public/assets/js/{yop-poll-public-6.4.3.min.js → yop-poll-public-6.4.4.min.js} RENAMED
File without changes
public/inc/basic.php CHANGED
@@ -34,7 +34,7 @@ class YOP_Poll_Basic {
34
  $answer_url = '';
35
  if ( 'yes' === $answer->meta_data['makeLink'] ) {
36
  $answer_url = filter_var( $answer->meta_data['link'], FILTER_SANITIZE_URL );
37
- if ( ( '' !== $answer->meta_data['link'] ) && ( false === !filter_var( $answer_url, FILTER_VALIDATE_URL ) ) ) {
38
  $answer_text = '<a href=' . esc_url( $answer_url ) . ' target="_blank">' . esc_html( $answer->stext ) . '</a>';
39
  } else {
40
  $answer_text = esc_html( $answer->stext );
@@ -774,7 +774,7 @@ class YOP_Poll_Basic {
774
  $params['loaded_with'] = '1';
775
  }
776
  if ( false === is_array( $poll->meta_data['options']['results']['showResultsTo'] ) ) {
777
- $poll->meta_data['options']['results']['showResultsTo'] = [];
778
  }
779
  $results_before_vote_data = ' data-show-results-to="' . esc_attr( implode( ',', $poll->meta_data['options']['results']['showResultsTo'] ) ) . '"'
780
  . ' data-show-results-moment="' . esc_attr( implode( ',', $poll->meta_data['options']['results']['showResultsMoment'] ) ) . '"'
34
  $answer_url = '';
35
  if ( 'yes' === $answer->meta_data['makeLink'] ) {
36
  $answer_url = filter_var( $answer->meta_data['link'], FILTER_SANITIZE_URL );
37
+ if ( ( '' !== $answer->meta_data['link'] ) && ( false === ! filter_var( $answer_url, FILTER_VALIDATE_URL ) ) ) {
38
  $answer_text = '<a href=' . esc_url( $answer_url ) . ' target="_blank">' . esc_html( $answer->stext ) . '</a>';
39
  } else {
40
  $answer_text = esc_html( $answer->stext );
774
  $params['loaded_with'] = '1';
775
  }
776
  if ( false === is_array( $poll->meta_data['options']['results']['showResultsTo'] ) ) {
777
+ $poll->meta_data['options']['results']['showResultsTo'] = array();
778
  }
779
  $results_before_vote_data = ' data-show-results-to="' . esc_attr( implode( ',', $poll->meta_data['options']['results']['showResultsTo'] ) ) . '"'
780
  . ' data-show-results-moment="' . esc_attr( implode( ',', $poll->meta_data['options']['results']['showResultsMoment'] ) ) . '"'
public/public.php CHANGED
@@ -91,113 +91,117 @@ class YOP_Poll_Public {
91
  null
92
  )
93
  );
94
- wp_enqueue_script( 'yop-hCaptcha');
95
  }
96
  $captcha_accessibility_description = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) );
97
  $captcha_accessibility_description = str_replace( '[/STRONG]', '</strong>', $captcha_accessibility_description );
98
  $captcha_explanation = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['explanation'] ) );
99
  $captcha_explanation = str_replace( '[/STRONG]', '</strong>', $captcha_explanation );
100
- wp_localize_script( 'yop-public', 'objectL10n', array(
101
- 'yopPollParams' => array(
102
- 'urlParams' => array(
103
- 'ajax' => admin_url( 'admin-ajax.php' ),
104
- 'wpLogin' => wp_login_url( admin_url( 'admin-ajax.php?action=yop_poll_record_wordpress_vote' ) )
105
- ),
106
- 'apiParams' => array(
107
- 'reCaptcha' => array(
108
- 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] : ''
109
- ),
110
- 'reCaptchaV2Invisible' => array(
111
- 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptchaV2Invisible']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptchaV2Invisible']['site-key'] : ''
112
- ),
113
- 'reCaptchaV3' => array(
114
- 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptchaV3']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptchaV3']['site-key'] : ''
115
- ),
116
- 'hCaptcha' => array(
117
- 'siteKey' => isset( $plugin_settings_decoded['integrations']['hCaptcha']['site-key'] ) ? $plugin_settings_decoded['integrations']['hCaptcha']['site-key'] : ''
118
- ),
119
- ),
120
- 'captchaParams' => array(
121
- 'imgPath' => YOP_POLL_URL . 'public/assets/img/',
122
- 'url' => YOP_POLL_URL . 'app.php',
123
- 'accessibilityAlt' => esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ),
124
- 'accessibilityTitle' => esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-title'] ),
125
- 'accessibilityDescription' => $captcha_accessibility_description,
126
- 'explanation' => $captcha_explanation,
127
- 'refreshAlt' => esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ),
128
- 'refreshTitle' => esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-title'] )
129
- ),
130
- 'voteParams' => array(
131
- 'invalidPoll' => str_replace(
132
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
133
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
134
- esc_html( $plugin_settings_decoded['messages']['voting']['invalid-poll'] )
135
- ),
136
- 'noAnswersSelected' => str_replace(
137
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
138
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
139
- esc_html( $plugin_settings_decoded['messages']['voting']['no-answers-selected'] )
140
- ),
141
- 'minAnswersRequired' => str_replace(
142
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
143
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
144
- esc_html( $plugin_settings_decoded['messages']['voting']['min-answers-required'] )
145
- ),
146
- 'maxAnswersRequired' => str_replace(
147
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
148
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
149
- esc_html( $plugin_settings_decoded['messages']['voting']['max-answers-required'] )
150
  ),
151
- 'noAnswerForOther' => str_replace(
152
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
153
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
154
- esc_html( $plugin_settings_decoded['messages']['voting']['no-answer-for-other'] )
 
 
 
 
 
 
 
 
 
155
  ),
156
- 'noValueForCustomField' => str_replace(
157
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
158
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
159
- esc_html( $plugin_settings_decoded['messages']['voting']['no-value-for-custom-field'] )
 
 
 
 
 
160
  ),
161
- 'consentNotChecked' => str_replace(
162
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
163
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
164
- esc_html( $plugin_settings_decoded['messages']['voting']['consent-not-checked'] )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  ),
166
- 'noCaptchaSelected' => str_replace(
167
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
168
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
169
- esc_html( $plugin_settings_decoded['messages']['voting']['no-captcha-selected'] )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  ),
171
- 'thankYou' => str_replace(
172
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
173
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
174
- esc_html( $plugin_settings_decoded['messages']['voting']['thank-you'] )
175
- )
176
  ),
177
- 'resultsParams' => array(
178
- 'singleVote' => str_replace(
179
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
180
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
181
- esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] )
182
- ),
183
- 'multipleVotes' => str_replace(
184
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
185
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
186
- esc_html( $plugin_settings_decoded['messages']['results']['multiple-votes'] )
187
- ),
188
- 'singleAnswer' => str_replace(
189
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
190
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
191
- esc_html( $plugin_settings_decoded['messages']['results']['single-answer'] )
192
- ),
193
- 'multipleAnswers' => str_replace(
194
- array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
195
- array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
196
- esc_html( $plugin_settings_decoded['messages']['results']['multiple-answers'] )
197
- )
198
- )
199
  )
200
- ));
201
  }
202
  public function load_translation() {
203
  load_plugin_textdomain( 'yop-poll', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
91
  null
92
  )
93
  );
94
+ wp_enqueue_script( 'yop-hCaptcha' );
95
  }
96
  $captcha_accessibility_description = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) );
97
  $captcha_accessibility_description = str_replace( '[/STRONG]', '</strong>', $captcha_accessibility_description );
98
  $captcha_explanation = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['explanation'] ) );
99
  $captcha_explanation = str_replace( '[/STRONG]', '</strong>', $captcha_explanation );
100
+ wp_localize_script(
101
+ 'yop-public',
102
+ 'objectL10n',
103
+ array(
104
+ 'yopPollParams' => array(
105
+ 'urlParams' => array(
106
+ 'ajax' => admin_url( 'admin-ajax.php' ),
107
+ 'wpLogin' => wp_login_url( admin_url( 'admin-ajax.php?action=yop_poll_record_wordpress_vote' ) ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ),
109
+ 'apiParams' => array(
110
+ 'reCaptcha' => array(
111
+ 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] : '',
112
+ ),
113
+ 'reCaptchaV2Invisible' => array(
114
+ 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptchaV2Invisible']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptchaV2Invisible']['site-key'] : '',
115
+ ),
116
+ 'reCaptchaV3' => array(
117
+ 'siteKey' => isset( $plugin_settings_decoded['integrations']['reCaptchaV3']['site-key'] ) ? $plugin_settings_decoded['integrations']['reCaptchaV3']['site-key'] : '',
118
+ ),
119
+ 'hCaptcha' => array(
120
+ 'siteKey' => isset( $plugin_settings_decoded['integrations']['hCaptcha']['site-key'] ) ? $plugin_settings_decoded['integrations']['hCaptcha']['site-key'] : '',
121
+ ),
122
  ),
123
+ 'captchaParams' => array(
124
+ 'imgPath' => YOP_POLL_URL . 'public/assets/img/',
125
+ 'url' => YOP_POLL_URL . 'app.php',
126
+ 'accessibilityAlt' => esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-alt'] ),
127
+ 'accessibilityTitle' => esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-title'] ),
128
+ 'accessibilityDescription' => $captcha_accessibility_description,
129
+ 'explanation' => $captcha_explanation,
130
+ 'refreshAlt' => esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-alt'] ),
131
+ 'refreshTitle' => esc_html( $plugin_settings_decoded['messages']['captcha']['refresh-title'] ),
132
  ),
133
+ 'voteParams' => array(
134
+ 'invalidPoll' => str_replace(
135
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
136
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
137
+ esc_html( $plugin_settings_decoded['messages']['voting']['invalid-poll'] )
138
+ ),
139
+ 'noAnswersSelected' => str_replace(
140
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
141
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
142
+ esc_html( $plugin_settings_decoded['messages']['voting']['no-answers-selected'] )
143
+ ),
144
+ 'minAnswersRequired' => str_replace(
145
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
146
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
147
+ esc_html( $plugin_settings_decoded['messages']['voting']['min-answers-required'] )
148
+ ),
149
+ 'maxAnswersRequired' => str_replace(
150
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
151
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
152
+ esc_html( $plugin_settings_decoded['messages']['voting']['max-answers-required'] )
153
+ ),
154
+ 'noAnswerForOther' => str_replace(
155
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
156
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
157
+ esc_html( $plugin_settings_decoded['messages']['voting']['no-answer-for-other'] )
158
+ ),
159
+ 'noValueForCustomField' => str_replace(
160
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
161
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
162
+ esc_html( $plugin_settings_decoded['messages']['voting']['no-value-for-custom-field'] )
163
+ ),
164
+ 'consentNotChecked' => str_replace(
165
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
166
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
167
+ esc_html( $plugin_settings_decoded['messages']['voting']['consent-not-checked'] )
168
+ ),
169
+ 'noCaptchaSelected' => str_replace(
170
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
171
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
172
+ esc_html( $plugin_settings_decoded['messages']['voting']['no-captcha-selected'] )
173
+ ),
174
+ 'thankYou' => str_replace(
175
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
176
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
177
+ esc_html( $plugin_settings_decoded['messages']['voting']['thank-you'] )
178
+ ),
179
  ),
180
+ 'resultsParams' => array(
181
+ 'singleVote' => str_replace(
182
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
183
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
184
+ esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] )
185
+ ),
186
+ 'multipleVotes' => str_replace(
187
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
188
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
189
+ esc_html( $plugin_settings_decoded['messages']['results']['multiple-votes'] )
190
+ ),
191
+ 'singleAnswer' => str_replace(
192
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
193
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
194
+ esc_html( $plugin_settings_decoded['messages']['results']['single-answer'] )
195
+ ),
196
+ 'multipleAnswers' => str_replace(
197
+ array( '[strong]', '[/strong]', '[i]', '[/i]', '[u]', '[/u]', '[br]' ),
198
+ array( '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '</br>' ),
199
+ esc_html( $plugin_settings_decoded['messages']['results']['multiple-answers'] )
200
+ ),
201
  ),
 
 
 
 
 
202
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  )
204
+ );
205
  }
206
  public function load_translation() {
207
  load_plugin_textdomain( 'yop-poll', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: https://www.yop-poll.com
4
  Tags: create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop, booth
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
- Stable tag: 6.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.htm
10
 
@@ -119,6 +119,10 @@ You can have only one question per poll.
119
 
120
  == Changelog ==
121
 
 
 
 
 
122
  = 6.4.3 =
123
  * fixed security issue
124
  * fixed issue with vote button not working inside elementor popups
4
  Tags: create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop, booth
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
+ Stable tag: 6.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.htm
10
 
119
 
120
  == Changelog ==
121
 
122
+ = 6.4.4 =
123
+ * added sanitization for custom headers
124
+ * updated 5.x and 4.x importers
125
+
126
  = 6.4.3 =
127
  * fixed security issue
128
  * fixed issue with vote button not working inside elementor popups
uninstall.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
  die;
4
  }
5
  require_once( 'admin/inc/dbschema.php' );
1
  <?php
2
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
  die;
4
  }
5
  require_once( 'admin/inc/dbschema.php' );
yop_poll.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: YOP Poll
4
  Plugin URI: https://yop-poll.com
5
  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.
6
- Version: 6.4.3
7
  Author: yourownprogrammer
8
  Author URI: https://yop-poll.com
9
  License: GPL2
@@ -11,7 +11,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
  Domain Path: /languages
12
  Text Domain: yop-poll
13
  */
14
- define( 'YOP_POLL_VERSION', '6.4.3' );
15
  define( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) );
17
  define( 'YOP_POLL_DIR', dirname( plugin_basename( __FILE__ ) ) );
@@ -25,14 +25,20 @@ require_once( 'admin/inc/ClassYOPPollWidget.php' );
25
  require_once( 'admin/inc/ClassYopPollImporter5x.php' );
26
  require_once( 'admin/inc/ClassYopPollImporter4x.php' );
27
  $maintenance_obj = new YOP_POLL_Maintenance();
28
- register_activation_hook( __FILE__, array(
29
- $maintenance_obj,
30
- 'activate'
31
- ));
32
- register_deactivation_hook( __FILE__, array(
33
- $maintenance_obj,
34
- 'deactivate'
35
- ) );
 
 
 
 
 
 
36
  function yop_poll_widget() {
37
  register_widget( 'YOP_Poll_Widget' );
38
  }
3
  Plugin Name: YOP Poll
4
  Plugin URI: https://yop-poll.com
5
  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.
6
+ Version: 6.4.4
7
  Author: yourownprogrammer
8
  Author URI: https://yop-poll.com
9
  License: GPL2
11
  Domain Path: /languages
12
  Text Domain: yop-poll
13
  */
14
+ define( 'YOP_POLL_VERSION', '6.4.4' );
15
  define( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) );
17
  define( 'YOP_POLL_DIR', dirname( plugin_basename( __FILE__ ) ) );
25
  require_once( 'admin/inc/ClassYopPollImporter5x.php' );
26
  require_once( 'admin/inc/ClassYopPollImporter4x.php' );
27
  $maintenance_obj = new YOP_POLL_Maintenance();
28
+ register_activation_hook(
29
+ __FILE__,
30
+ array(
31
+ $maintenance_obj,
32
+ 'activate',
33
+ )
34
+ );
35
+ register_deactivation_hook(
36
+ __FILE__,
37
+ array(
38
+ $maintenance_obj,
39
+ 'deactivate',
40
+ )
41
+ );
42
  function yop_poll_widget() {
43
  register_widget( 'YOP_Poll_Widget' );
44
  }