Version Description
- fixed issue with google reCaptcha v2 Invisible
- fixed issue with archive shortcode displaying polls not started when "show" is set to active
- fixed issue with displaying incorrect message when a poll is ended
- added support for hCaptcha
- added more sanitization
Download this release
Release Info
Developer | yourownprogrammer |
Plugin | YOP Poll |
Version | 6.3.4 |
Comparing to | |
See all releases |
Code changes from version 6.3.3 to 6.3.4
- admin/admin.php +260 -243
- admin/assets/css/{admin-6.3.3.css → admin-6.3.4.css} +0 -0
- admin/assets/js/{admin-6.3.3.min.js → admin-6.3.4.min.js} +1 -1
- admin/inc/ClassYOPPollWidget.php +25 -25
- admin/inc/ClassYopPollImporter4x.php +114 -97
- admin/inc/ClassYopPollImporter5x.php +134 -113
- admin/inc/Helper.php +8 -9
- admin/inc/dbschema.php +68 -64
- admin/inc/maintenance.php +9 -6
- admin/models/OtherAnswers.php +2 -2
- admin/models/bans.php +70 -39
- admin/models/elements.php +20 -18
- admin/models/logs.php +162 -101
- admin/models/polls.php +240 -202
- admin/models/settings.php +80 -55
- admin/models/skins.php +0 -0
admin/admin.php
CHANGED
@@ -12,7 +12,7 @@ class YOP_Poll_Admin {
|
|
12 |
add_filter( 'clean_url', array( &$this, 'clean_recaptcha_url' ) );
|
13 |
add_action( 'admin_menu', array( &$this, 'build_admin_menu' ) );
|
14 |
add_action( 'plugins_loaded', array( &$this, 'verify_update' ) );
|
15 |
-
add_action( 'plugins_loaded', array( $this, 'load_translations') );
|
16 |
add_action( 'admin_enqueue_scripts', array( &$this, 'load_dependencies' ), 1000 );
|
17 |
add_action( 'wp_ajax_create_yop_poll', array( &$this, 'create_poll' ) );
|
18 |
add_action( 'wp_ajax_update_yop_poll', array( &$this, 'update_poll' ) );
|
@@ -71,40 +71,40 @@ class YOP_Poll_Admin {
|
|
71 |
<form action="" method="post">
|
72 |
<!-- Modal header -->
|
73 |
<div id="yop-poll-deactivate-header">
|
74 |
-
<img src="<?php echo YOP_POLL_URL .
|
75 |
-
Quick Feedback
|
76 |
</div>
|
77 |
<!-- Modal inner -->
|
78 |
<div id="yop-poll-deactivate-inner">
|
79 |
-
<h3><?php echo
|
80 |
-
<p><strong><?php
|
81 |
|
82 |
<ul>
|
83 |
|
84 |
<li>
|
85 |
<label>
|
86 |
<input type="radio" name="yop-poll_disable_reason" value="technical-issue" />
|
87 |
-
<strong><?php
|
88 |
-
<p><?php
|
89 |
-
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php
|
90 |
</label>
|
91 |
</li>
|
92 |
|
93 |
<li>
|
94 |
<label>
|
95 |
<input type="radio" name="yop-poll_disable_reason" value="missing-feature" />
|
96 |
-
<strong><?php
|
97 |
-
<p><?php
|
98 |
-
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php
|
99 |
</label>
|
100 |
</li>
|
101 |
|
102 |
<li>
|
103 |
<label>
|
104 |
<input type="radio" name="yop-poll_disable_reason" value="other" />
|
105 |
-
<strong><?php
|
106 |
-
<p><?php
|
107 |
-
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php
|
108 |
</label>
|
109 |
</li>
|
110 |
|
@@ -114,8 +114,8 @@ class YOP_Poll_Admin {
|
|
114 |
|
115 |
<!-- Modal footer -->
|
116 |
<div id="yop-poll-deactivate-footer">
|
117 |
-
<input disabled id="yop-poll-feedback-submit" class="button button-primary" type="submit" name="yop-poll-feedback-submit" value="<?php
|
118 |
-
<a id="yop-poll-deactivate-without-feedback" href="#"><?php
|
119 |
</div>
|
120 |
|
121 |
<!-- Token -->
|
@@ -202,8 +202,8 @@ class YOP_Poll_Admin {
|
|
202 |
<?php
|
203 |
}
|
204 |
public function clean_recaptcha_url( $url ) {
|
205 |
-
if ( false !== strstr( $url,
|
206 |
-
$url = str_replace(
|
207 |
}
|
208 |
return $url;
|
209 |
}
|
@@ -330,10 +330,14 @@ class YOP_Poll_Admin {
|
|
330 |
$maintenance = new YOP_POLL_Maintenance();
|
331 |
$maintenance->update_to_version_6_3_3();
|
332 |
}
|
|
|
|
|
|
|
|
|
333 |
}
|
334 |
}
|
335 |
public function load_translations() {
|
336 |
-
load_plugin_textdomain( 'yop-poll',
|
337 |
}
|
338 |
public function is_user_logged_in() {
|
339 |
if ( true === is_user_logged_in() ) {
|
@@ -344,7 +348,7 @@ class YOP_Poll_Admin {
|
|
344 |
die();
|
345 |
}
|
346 |
public function build_admin_menu() {
|
347 |
-
if( function_exists( 'add_menu_page' ) ) {
|
348 |
$page = add_menu_page(
|
349 |
__( 'Yop Poll', 'yop-poll' ),
|
350 |
__( 'Yop Poll', 'yop-poll' ),
|
@@ -354,7 +358,7 @@ class YOP_Poll_Admin {
|
|
354 |
$this,
|
355 |
'manage_polls'
|
356 |
),
|
357 |
-
YOP_POLL_URL .
|
358 |
'26.6'
|
359 |
);
|
360 |
if ( function_exists( 'add_submenu_page' ) ) {
|
@@ -412,8 +416,8 @@ class YOP_Poll_Admin {
|
|
412 |
}
|
413 |
$subpage = add_submenu_page(
|
414 |
'yop-polls',
|
415 |
-
|
416 |
-
|
417 |
'yop_poll_results_own',
|
418 |
'yop-poll-settings',
|
419 |
array(
|
@@ -436,8 +440,8 @@ class YOP_Poll_Admin {
|
|
436 |
}
|
437 |
$subpage = add_submenu_page(
|
438 |
'yop-polls',
|
439 |
-
|
440 |
-
|
441 |
'yop_poll_results_own',
|
442 |
'yop-poll-upgrade-to-pro',
|
443 |
array(
|
@@ -466,54 +470,56 @@ class YOP_Poll_Admin {
|
|
466 |
}
|
467 |
public function load_scripts() {
|
468 |
$plugin_settings = YOP_Poll_Settings::get_all_settings();
|
469 |
-
if (false !== $plugin_settings) {
|
470 |
-
$plugin_settings_decoded = unserialize($plugin_settings);
|
471 |
}
|
472 |
//include jquery by default
|
473 |
-
wp_enqueue_script('jquery');
|
474 |
-
wp_enqueue_script('tiny_mce');
|
475 |
-
wp_enqueue_script('jquery-ui-core', array('jquery'));
|
476 |
-
wp_enqueue_script('jquery-ui-datepicker', array('jquery'));
|
477 |
-
wp_enqueue_script('jquery-ui-sortable', array('jquery-ui-core'));
|
478 |
-
wp_enqueue_script('jquery-ui-draggable', array('jquery-ui-core'));
|
479 |
-
wp_enqueue_script('jquery-ui-droppable', array('jquery-ui-core'));
|
480 |
-
if (
|
481 |
$plugin_admin_js_file = 'admin-' . YOP_POLL_VERSION . '.js';
|
482 |
|
483 |
} else {
|
484 |
$plugin_admin_js_file = 'admin-' . YOP_POLL_VERSION . '.min.js';
|
485 |
}
|
486 |
-
wp_enqueue_script( 'yop', YOP_POLL_URL . 'admin/assets/js/' . $plugin_admin_js_file
|
|
|
487 |
'jquery-ui-sortable',
|
488 |
'jquery-ui-dialog',
|
489 |
-
'jquery-ui-datepicker'
|
|
|
490 |
);
|
491 |
/* add reCaptcha if enabled */
|
492 |
if (
|
493 |
-
(true === isset($plugin_settings_decoded['integrations']['reCaptcha']['enabled'])) &&
|
494 |
-
('yes' === $plugin_settings_decoded['integrations']['reCaptcha']['enabled']) &&
|
495 |
-
(true === isset($plugin_settings_decoded['integrations']['reCaptcha']['site-key'])) &&
|
496 |
-
('' !== $plugin_settings_decoded['integrations']['reCaptcha']['site-key']) &&
|
497 |
-
(true === isset($plugin_settings_decoded['integrations']['reCaptcha']['secret-key'])) &&
|
498 |
-
('' !== $plugin_settings_decoded['integrations']['reCaptcha']['secret-key'])
|
499 |
) {
|
500 |
$args = array(
|
501 |
'render' => 'explicit',
|
502 |
'onload' => 'YOPPollOnLoadRecaptcha'
|
503 |
);
|
504 |
-
wp_register_script('yop-reCaptcha', add_query_arg($args, 'https://www.google.com/recaptcha/api.js'), '', null);
|
505 |
-
wp_enqueue_script('yop-reCaptcha');
|
506 |
}
|
507 |
/* done adding reCaptcha */
|
508 |
-
if (true === isset( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) ) {
|
509 |
-
$captcha_accessibility_description = str_replace('[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) );
|
510 |
-
$captcha_accessibility_description = str_replace('[/STRONG]', '</strong>', $captcha_accessibility_description );
|
511 |
} else {
|
512 |
$captcha_accessibility_description = '';
|
513 |
}
|
514 |
if ( true === isset( $plugin_settings_decoded['messages']['captcha']['explanation'] ) ) {
|
515 |
-
$captcha_explanation = str_replace('[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['explanation'] ) );
|
516 |
-
$captcha_explanation = str_replace('[/STRONG]', '</strong>', $captcha_explanation );
|
517 |
} else {
|
518 |
$captcha_explanation = '';
|
519 |
}
|
@@ -523,8 +529,8 @@ class YOP_Poll_Admin {
|
|
523 |
'dateFormat' => self::$date_format,
|
524 |
'timeFormat' => self::$time_format,
|
525 |
'timeNow' => time(),
|
526 |
-
'votingEnded' => isset( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) ?
|
527 |
-
'votingNotStarted' => isset( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) ?
|
528 |
'newCustomFieldText' => esc_html__( 'New Custom Field', 'yop-poll' ),
|
529 |
'deleteTitle' => esc_html__( 'Warning', 'yop-poll' ),
|
530 |
'deletePollMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
|
@@ -582,13 +588,13 @@ class YOP_Poll_Admin {
|
|
582 |
'votingText' => esc_html__( 'Voting', 'yop-poll' ),
|
583 |
'resultsText' => esc_html__( 'Results', 'yop-poll' ),
|
584 |
'numberOfVotesSingular' => isset( $plugin_settings_decoded['messages']['results']['single-vote'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] ) : '',
|
585 |
-
'numberOfVotesPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) ?
|
586 |
-
'numberOfAnswerSingular' => isset( $plugin_settings_decoded['messages']['results']['single-answer'] ) ?
|
587 |
-
'numberOfAnswersPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) ?
|
588 |
-
'annonymousVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) ?
|
589 |
-
'wordpressVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) ?
|
590 |
-
'facebookVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['facebook'] ) ?
|
591 |
-
'googleVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['google'] ) ?
|
592 |
),
|
593 |
'saveParams' => array(
|
594 |
'noTemplateSelected' => esc_html__( 'Template is missing', 'yop-poll' ),
|
@@ -621,7 +627,7 @@ class YOP_Poll_Admin {
|
|
621 |
'showLogDetailsLinkText' => esc_html__( 'View Details', 'yop-poll' ),
|
622 |
'hideLogDetailsLinkText' => esc_html__( 'Hide Details', 'yop-poll' ),
|
623 |
'numberOfVotesText' => esc_html__( 'Number of Votes', 'yop-poll' ),
|
624 |
-
'resultsParams'=> array(
|
625 |
'singleVote' => esc_html__( 'vote', 'yop-poll' ),
|
626 |
'multipleVotes' => esc_html__( 'votes', 'yop-poll' )
|
627 |
),
|
@@ -645,21 +651,21 @@ class YOP_Poll_Admin {
|
|
645 |
wp_enqueue_style( 'yop-public', YOP_POLL_URL . 'public/assets/css/yop-poll-public-' . YOP_POLL_VERSION . '.css' );
|
646 |
}
|
647 |
public function change_page_title( $title ) {
|
648 |
-
$_page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
649 |
-
$_action = isset( $_GET['action'] ) ? $_GET['action'] : '';
|
650 |
switch ( $_page ) {
|
651 |
case 'yop-polls':{
|
652 |
switch ( $_action ) {
|
653 |
case 'edit': {
|
654 |
-
$title =
|
655 |
break;
|
656 |
}
|
657 |
case 'view-results': {
|
658 |
-
$title =
|
659 |
break;
|
660 |
}
|
661 |
default: {
|
662 |
-
$title =
|
663 |
break;
|
664 |
}
|
665 |
}
|
@@ -668,7 +674,7 @@ class YOP_Poll_Admin {
|
|
668 |
case 'yop-poll-logs': {
|
669 |
switch ( $_action ) {
|
670 |
default: {
|
671 |
-
$title =
|
672 |
break;
|
673 |
}
|
674 |
}
|
@@ -677,15 +683,15 @@ class YOP_Poll_Admin {
|
|
677 |
case 'yop-poll-bans': {
|
678 |
switch ( $_action ) {
|
679 |
case 'add': {
|
680 |
-
$title =
|
681 |
break;
|
682 |
}
|
683 |
case 'edit': {
|
684 |
-
$title =
|
685 |
break;
|
686 |
}
|
687 |
default: {
|
688 |
-
$title =
|
689 |
break;
|
690 |
}
|
691 |
}
|
@@ -695,26 +701,27 @@ class YOP_Poll_Admin {
|
|
695 |
return $title;
|
696 |
}
|
697 |
public function manage_polls() {
|
698 |
-
$_action = isset( $_GET['action'] ) ? $_GET['action'] : '';
|
699 |
-
|
|
|
700 |
case 'edit': {
|
701 |
-
$this->show_edit_poll( $
|
702 |
break;
|
703 |
}
|
704 |
case 'delete': {
|
705 |
-
$this->delete_poll( $
|
706 |
break;
|
707 |
}
|
708 |
case 'view-results': {
|
709 |
-
$this->display_results( $
|
710 |
break;
|
711 |
}
|
712 |
case 'results': {
|
713 |
-
$this->build_results( $
|
714 |
break;
|
715 |
}
|
716 |
case 'view-votes': {
|
717 |
-
$this->display_votes( $
|
718 |
break;
|
719 |
}
|
720 |
default: {
|
@@ -725,11 +732,11 @@ class YOP_Poll_Admin {
|
|
725 |
}
|
726 |
public function show_polls() {
|
727 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
728 |
-
$params['q'] = isset( $_GET['q']) ? $_GET['q'] : '';
|
729 |
-
$params['order_by'] = isset( $_GET['order_by'] ) ? $_GET['order_by'] : '';
|
730 |
-
$params['sort_order'] = isset( $_GET['sort_order'] ) ? $_GET['sort_order'] : 'desc';
|
731 |
-
$params['page_no'] = isset( $_GET['page_no'] ) ? $_GET['page_no'] : '1';
|
732 |
-
$params['perpage'] = isset( $_GET['perpage'] ) && is_numeric( $_GET['perpage'] ) && $_GET['perpage'] > 0 ? $_GET['perpage'] : 10;
|
733 |
$polls = YOP_Poll_Polls::get_polls( $params );
|
734 |
$show_guide = YOP_Poll_Settings::get_show_guide();
|
735 |
$template = YOP_POLL_PATH . 'admin/views/polls/view.php';
|
@@ -784,32 +791,34 @@ class YOP_Poll_Admin {
|
|
784 |
'integrations' => YOP_Poll_Settings::get_integrations(),
|
785 |
'date_format' => self::$date_format ) );
|
786 |
} else {
|
787 |
-
|
788 |
}
|
789 |
}
|
790 |
}
|
791 |
}
|
792 |
public function create_poll() {
|
793 |
if ( current_user_can( 'yop_poll_add' ) && check_ajax_referer( 'yop-poll-add-poll', '_token', false ) ) {
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
|
|
|
|
805 |
}
|
806 |
} else {
|
807 |
-
wp_send_json_error(
|
808 |
}
|
809 |
}
|
810 |
public function update_poll() {
|
811 |
$current_user = wp_get_current_user();
|
812 |
-
$poll = json_decode( wp_unslash( $_POST['poll'] ) );
|
813 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll->id );
|
814 |
if ( check_ajax_referer( 'yop-poll-edit-poll', '_token', false ) ) {
|
815 |
if (
|
@@ -818,10 +827,10 @@ class YOP_Poll_Admin {
|
|
818 |
) {
|
819 |
$result = YOP_Poll_Polls::update( $poll );
|
820 |
if ( true === $result['success'] ) {
|
821 |
-
wp_send_json_success(
|
822 |
array(
|
823 |
'success' => true,
|
824 |
-
'message' =>
|
825 |
'newElements' => $result['new-elements'],
|
826 |
'newSubElements' => $result['new-subelements'],
|
827 |
)
|
@@ -830,16 +839,16 @@ class YOP_Poll_Admin {
|
|
830 |
wp_send_json_error( $result['error'] );
|
831 |
}
|
832 |
} else {
|
833 |
-
wp_send_json_error(
|
834 |
}
|
835 |
} else {
|
836 |
-
wp_send_json_error(
|
837 |
}
|
838 |
}
|
839 |
public function delete_single_poll() {
|
840 |
if ( check_ajax_referer( 'yop-poll-view-polls', '_token', false ) || check_ajax_referer( 'yop-poll-edit-poll', '_token', false ) ) {
|
841 |
if ( isset( $_POST['poll_id'] ) && ( 0 < intval( $_POST['poll_id'] ) ) ) {
|
842 |
-
$poll_id = sanitize_text_field( $_POST['poll_id'] );
|
843 |
$current_user = wp_get_current_user();
|
844 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll_id );
|
845 |
if (
|
@@ -848,24 +857,24 @@ class YOP_Poll_Admin {
|
|
848 |
) {
|
849 |
$result = YOP_Poll_Polls::delete( $poll_id );
|
850 |
if ( true === $result['success'] ) {
|
851 |
-
wp_send_json_success(
|
852 |
} else {
|
853 |
wp_send_json_error( $result['error'] );
|
854 |
}
|
855 |
} else {
|
856 |
-
wp_send_json_error(
|
857 |
}
|
858 |
} else {
|
859 |
-
wp_send_json_error(
|
860 |
}
|
861 |
} else {
|
862 |
-
wp_send_json_error(
|
863 |
}
|
864 |
}
|
865 |
public function delete_bulk_poll() {
|
866 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
867 |
$current_user = wp_get_current_user();
|
868 |
-
$polls = json_decode( wp_unslash( $_POST['polls'] ) );
|
869 |
$success = 0;
|
870 |
foreach ( $polls as $poll ) {
|
871 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll );
|
@@ -891,7 +900,7 @@ class YOP_Poll_Admin {
|
|
891 |
'yop-poll' )
|
892 |
);
|
893 |
} else {
|
894 |
-
wp_send_json_error(
|
895 |
'Error deleting poll',
|
896 |
'Error deleting polls',
|
897 |
count( $polls ),
|
@@ -899,32 +908,32 @@ class YOP_Poll_Admin {
|
|
899 |
);
|
900 |
}
|
901 |
} else {
|
902 |
-
wp_send_json_error(
|
903 |
}
|
904 |
}
|
905 |
public function clone_single_poll() {
|
906 |
if ( check_ajax_referer( 'yop-poll-view-polls', '_token', false ) ) {
|
907 |
if ( isset( $_POST['poll_id'] ) && ( 0 < intval( $_POST['poll_id'] ) ) ) {
|
908 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
909 |
-
$result = YOP_Poll_Polls::clone_poll( $_POST['poll_id'] );
|
910 |
if ( true === $result['success'] ) {
|
911 |
-
wp_send_json_success(
|
912 |
} else {
|
913 |
wp_send_json_error( $result['error'] );
|
914 |
}
|
915 |
} else {
|
916 |
-
wp_send_json_error(
|
917 |
}
|
918 |
} else {
|
919 |
-
wp_send_json_error(
|
920 |
}
|
921 |
} else {
|
922 |
-
wp_send_json_error(
|
923 |
}
|
924 |
}
|
925 |
public function clone_bulk_poll() {
|
926 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
927 |
-
$polls = json_decode( wp_unslash( $_POST['polls'] ) );
|
928 |
$success = 0;
|
929 |
foreach ( $polls as $poll ) {
|
930 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
@@ -946,7 +955,7 @@ class YOP_Poll_Admin {
|
|
946 |
'yop-poll' )
|
947 |
);
|
948 |
} else {
|
949 |
-
wp_send_json_error(
|
950 |
'Error cloning poll',
|
951 |
'Error cloning polls',
|
952 |
count( $polls ),
|
@@ -954,12 +963,12 @@ class YOP_Poll_Admin {
|
|
954 |
);
|
955 |
}
|
956 |
} else {
|
957 |
-
wp_send_json_error(
|
958 |
}
|
959 |
}
|
960 |
public function reset_bulk_poll() {
|
961 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
962 |
-
$polls = json_decode( wp_unslash( $_POST['polls'] ) );
|
963 |
$success = 0;
|
964 |
foreach ( $polls as $poll ) {
|
965 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
@@ -974,12 +983,12 @@ class YOP_Poll_Admin {
|
|
974 |
}
|
975 |
}
|
976 |
if ( $success === intval( count( $polls ) ) ) {
|
977 |
-
wp_send_json_success(
|
978 |
} else {
|
979 |
-
wp_send_json_error(
|
980 |
}
|
981 |
} else {
|
982 |
-
wp_send_json_error(
|
983 |
}
|
984 |
}
|
985 |
public function display_results( $poll_id ) {
|
@@ -996,10 +1005,10 @@ class YOP_Poll_Admin {
|
|
996 |
}
|
997 |
public function build_results( $poll_id ) {
|
998 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
999 |
-
$params['q'] = isset( $_GET['q']) ? $_GET['q'] : '';
|
1000 |
-
$params['order_by'] = isset( $_GET['order_by'] ) ? $_GET['order_by'] : '';
|
1001 |
-
$params['sort_order'] = isset( $_GET['sort_order'] ) ? $_GET['sort_order'] : 'asc';
|
1002 |
-
$params['page_no'] = isset( $_GET['page_no'] ) ? $_GET['page_no'] : '1';
|
1003 |
$template = YOP_POLL_PATH . 'admin/views/results/view.php';
|
1004 |
$poll = YOP_Poll_Polls::get_poll_for_admin( $poll_id );
|
1005 |
if ( $poll ) {
|
@@ -1014,7 +1023,7 @@ class YOP_Poll_Admin {
|
|
1014 |
$total_votes_per_question = [];
|
1015 |
$total_voters_per_question = [];
|
1016 |
$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 ) ) );
|
1017 |
-
$total_pages = ceil( $votes_count
|
1018 |
$query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active' limit $offset, $limit";
|
1019 |
$votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, array( $poll_id ) ) );
|
1020 |
|
@@ -1033,12 +1042,12 @@ class YOP_Poll_Admin {
|
|
1033 |
$question_aswers[] = $answers['data'];
|
1034 |
}
|
1035 |
}
|
1036 |
-
if( isset( $total_votes_per_question[$ave['id']] ) ) {
|
1037 |
$total_votes_per_question[$ave['id']]++;
|
1038 |
} else {
|
1039 |
$total_votes_per_question[$ave['id']] = 1;
|
1040 |
}
|
1041 |
-
if( isset( $total_voters_per_question[$ave['id']][$user_type] ) ) {
|
1042 |
$total_voters_per_question[$ave['id']][$user_type]++;
|
1043 |
} else {
|
1044 |
$total_voters_per_question[$ave['id']][$user_type] = 1;
|
@@ -1048,7 +1057,7 @@ class YOP_Poll_Admin {
|
|
1048 |
}
|
1049 |
}
|
1050 |
$other_answers = YOP_Poll_Helper::group_other_answers( $other_answers );
|
1051 |
-
if( count( $votes ) > 0 ) {
|
1052 |
$cf_hidden .= '<input type="hidden" name="cf_total_pages" id="cf-total-pages" value="' . $total_pages . '">';
|
1053 |
$cf_hidden .= '<input type="hidden" name="cf_page" id="cf-page" value="' . $page . '">';
|
1054 |
foreach ( $votes as $vote ) {
|
@@ -1061,7 +1070,7 @@ class YOP_Poll_Admin {
|
|
1061 |
}
|
1062 |
}
|
1063 |
if ( count( $custom_fields ) > 0 ) {
|
1064 |
-
$cf_total_pages = ceil( count( $custom_fields )
|
1065 |
$cf_string .= '<tr>';
|
1066 |
foreach ( $custom_fields as $cf ) {
|
1067 |
$cf_string .= '<td>' . $cf['data'] . '</td>';
|
@@ -1089,7 +1098,7 @@ class YOP_Poll_Admin {
|
|
1089 |
)
|
1090 |
);
|
1091 |
} else {
|
1092 |
-
$error =
|
1093 |
$template = YOP_POLL_PATH . 'admin/views/general/error.php';
|
1094 |
echo YOP_Poll_View::render(
|
1095 |
$template,
|
@@ -1102,13 +1111,13 @@ class YOP_Poll_Admin {
|
|
1102 |
}
|
1103 |
public function display_votes( $poll_id ) {
|
1104 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
1105 |
-
$params['q'] = isset( $_GET['q']) ? $_GET['q'] : '';
|
1106 |
-
$params['order_by'] = isset( $_GET['order_by'] ) ? $_GET['order_by'] : '';
|
1107 |
-
$params['sort_order'] = isset( $_GET['sort_order'] ) ? $_GET['sort_order'] : 'asc';
|
1108 |
-
$params['page_no'] = isset( $_GET['page_no'] ) ? $_GET['page_no'] : '1';
|
1109 |
-
$params['page'] = isset( $_GET['page'] ) ? $_GET['page'] : 'yop-poll';
|
1110 |
-
$params['poll_id'] = isset( $_GET['poll_id'] ) ? $_GET['poll_id'] : '';
|
1111 |
-
$params['action'] = isset( $_GET['action'] ) ? $_GET['action'] : '';
|
1112 |
$template = YOP_POLL_PATH . 'admin/views/results/votes.php';
|
1113 |
$poll = YOP_Poll_Polls::get_poll_for_admin( $poll_id );
|
1114 |
if ( $poll ) {
|
@@ -1128,7 +1137,7 @@ class YOP_Poll_Admin {
|
|
1128 |
)
|
1129 |
);
|
1130 |
} else {
|
1131 |
-
$error =
|
1132 |
$template = YOP_POLL_PATH . 'admin/views/general/error.php';
|
1133 |
echo YOP_Poll_View::render(
|
1134 |
$template,
|
@@ -1142,16 +1151,17 @@ class YOP_Poll_Admin {
|
|
1142 |
public function get_yop_poll_votes_customs() {
|
1143 |
if ( check_ajax_referer( 'yop-poll-get-vote-customs', '_token', false ) ) {
|
1144 |
$limit = 10;
|
1145 |
-
if(isset($_POST['page']) && $_POST['page']
|
1146 |
-
$page = $_POST['page'];
|
1147 |
-
$offset = $limit * ($page-1);
|
1148 |
} else {
|
1149 |
$page = 1;
|
1150 |
$offset = 0;
|
1151 |
}
|
1152 |
-
|
|
|
1153 |
$cf_string = '';
|
1154 |
-
if( count( $votes ) > 0 ) {
|
1155 |
foreach ( $votes as $vote ) {
|
1156 |
$vote_data = unserialize( $vote->vote_data );
|
1157 |
$custom_fields = [];
|
@@ -1162,7 +1172,7 @@ class YOP_Poll_Admin {
|
|
1162 |
}
|
1163 |
if ( count( $custom_fields ) > 0 ) {
|
1164 |
$cf_string .= '<tr>';
|
1165 |
-
foreach ($custom_fields as $cf ) {
|
1166 |
$cf_string .= '<td>' . $cf['data'] . '</td>';
|
1167 |
}
|
1168 |
$cf_string .= '</tr>';
|
@@ -1173,7 +1183,7 @@ class YOP_Poll_Admin {
|
|
1173 |
wp_send_json_success( $cf_string );
|
1174 |
}
|
1175 |
} else {
|
1176 |
-
wp_send_json_error(
|
1177 |
}
|
1178 |
}
|
1179 |
public function manage_support() {
|
@@ -1184,12 +1194,12 @@ class YOP_Poll_Admin {
|
|
1184 |
$template = YOP_POLL_PATH . 'admin/views/general/migrate-old-tables.php';
|
1185 |
echo YOP_Poll_View::render( $template );
|
1186 |
}
|
1187 |
-
public function manage_logs
|
1188 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1189 |
-
$params['q'] = isset( $_GET['q']) ? $_GET['q'] : '';
|
1190 |
-
$params['order_by'] = isset( $_GET['order_by'] ) ? $_GET['order_by'] : '';
|
1191 |
-
$params['sort_order'] = isset( $_GET['sort_order'] ) ? $_GET['sort_order'] : 'asc';
|
1192 |
-
$params['page_no'] = isset( $_GET['page_no'] ) ? $_GET['page_no'] : '1';
|
1193 |
$logs = YOP_Poll_Logs::get_logs( $params );
|
1194 |
$template = YOP_POLL_PATH . 'admin/views/logs/view.php';
|
1195 |
echo YOP_Poll_View::render( $template, array(
|
@@ -1206,44 +1216,46 @@ class YOP_Poll_Admin {
|
|
1206 |
public function get_log_details() {
|
1207 |
if ( check_ajax_referer( 'yop-poll-view-logs', '_token', false ) ) {
|
1208 |
if ( isset( $_POST['log_id'] ) && ( 0 < intval( $_POST['log_id'] ) ) ) {
|
1209 |
-
|
|
|
1210 |
$current_user = wp_get_current_user();
|
1211 |
if ( $log_owner == $current_user->ID ) {
|
1212 |
-
$results = YOP_Poll_Logs::get_log_details( $
|
1213 |
$details_string = '';
|
1214 |
foreach ( $results as $res ) {
|
1215 |
-
if ( 'custom-field' === $res['question']) {
|
1216 |
-
$details_string .=
|
1217 |
-
$details_string .= '<div style="padding-left: 10px;">' .
|
1218 |
$res['answers'][0]['answer_value'] . '</div>';
|
1219 |
} else {
|
1220 |
-
$details_string .=
|
1221 |
foreach ( $res['answers'] as $ra ) {
|
1222 |
-
$details_string .= '<div style="padding-left: 10px;">' .
|
1223 |
}
|
1224 |
}
|
1225 |
$details_string .= '</div>';
|
1226 |
}
|
1227 |
wp_send_json_success( [ 'details' => $details_string ] );
|
1228 |
} else {
|
1229 |
-
wp_send_json_error(
|
1230 |
}
|
1231 |
} else {
|
1232 |
-
wp_send_json_error(
|
1233 |
}
|
1234 |
} else {
|
1235 |
-
wp_send_json_error(
|
1236 |
}
|
1237 |
}
|
1238 |
public function manage_bans() {
|
1239 |
-
$_action = isset( $_GET['action'] ) ? $_GET['action'] : '';
|
1240 |
-
switch ( $_action) {
|
1241 |
case 'add': {
|
1242 |
$this->show_add_ban();
|
1243 |
break;
|
1244 |
}
|
1245 |
case 'edit': {
|
1246 |
-
$
|
|
|
1247 |
break;
|
1248 |
}
|
1249 |
default: {
|
@@ -1254,10 +1266,10 @@ class YOP_Poll_Admin {
|
|
1254 |
}
|
1255 |
public function show_bans() {
|
1256 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1257 |
-
$params['q'] = isset( $_GET['q']) ? $_GET['q'] : '';
|
1258 |
-
$params['order_by'] = isset( $_GET['order_by'] ) ? $_GET['order_by'] : '';
|
1259 |
-
$params['sort_order'] = isset( $_GET['sort_order'] ) ? $_GET['sort_order'] : 'asc';
|
1260 |
-
$params['page_no'] = isset( $_GET['page_no'] ) ? $_GET['page_no'] : '1';
|
1261 |
$template = YOP_POLL_PATH . 'admin/views/bans/view.php';
|
1262 |
$bans = YOP_Poll_Bans::get_bans( $params );
|
1263 |
echo YOP_Poll_View::render( $template, array(
|
@@ -1282,14 +1294,15 @@ class YOP_Poll_Admin {
|
|
1282 |
}
|
1283 |
public function create_ban() {
|
1284 |
if ( current_user_can( 'yop_poll_add' ) && check_ajax_referer( 'yop-poll-add-ban', '_token', false ) ) {
|
1285 |
-
$
|
|
|
1286 |
if ( true === $result['success'] ) {
|
1287 |
-
wp_send_json_success(
|
1288 |
} else {
|
1289 |
wp_send_json_error( $result['error'] );
|
1290 |
}
|
1291 |
} else {
|
1292 |
-
wp_send_json_error(
|
1293 |
}
|
1294 |
}
|
1295 |
public function show_edit_ban( $ban_id ) {
|
@@ -1309,7 +1322,7 @@ class YOP_Poll_Admin {
|
|
1309 |
'polls' => $polls
|
1310 |
));
|
1311 |
} else {
|
1312 |
-
|
1313 |
}
|
1314 |
}
|
1315 |
}
|
@@ -1317,7 +1330,7 @@ class YOP_Poll_Admin {
|
|
1317 |
public function delete_single_ban() {
|
1318 |
if ( check_ajax_referer( 'yop-poll-view-bans', '_token', false ) ) {
|
1319 |
if ( isset( $_POST['ban_id'] ) && ( 0 < intval( $_POST['ban_id'] ) ) ) {
|
1320 |
-
$ban_id = sanitize_text_field( $_POST['ban_id'] );
|
1321 |
$current_user = wp_get_current_user();
|
1322 |
$ban_owner = YOP_Poll_Bans::get_owner( $ban_id );
|
1323 |
if (
|
@@ -1326,22 +1339,22 @@ class YOP_Poll_Admin {
|
|
1326 |
) {
|
1327 |
$result = YOP_Poll_Bans::delete( $ban_id );
|
1328 |
if ( true === $result['success'] ) {
|
1329 |
-
wp_send_json_success(
|
1330 |
} else {
|
1331 |
wp_send_json_error( $result['error'] );
|
1332 |
}
|
1333 |
} else {
|
1334 |
-
wp_send_json_error(
|
1335 |
}
|
1336 |
} else {
|
1337 |
-
wp_send_json_error(
|
1338 |
}
|
1339 |
} else {
|
1340 |
-
wp_send_json_error(
|
1341 |
}
|
1342 |
}
|
1343 |
public function update_ban() {
|
1344 |
-
$ban = json_decode( wp_unslash( $_POST['ban'] ) );
|
1345 |
$ban_owner = YOP_Poll_Bans::get_owner( $ban->ban->id );
|
1346 |
$current_user = wp_get_current_user();
|
1347 |
if ( check_ajax_referer( 'yop-poll-edit-ban', '_token', false ) ) {
|
@@ -1351,20 +1364,20 @@ class YOP_Poll_Admin {
|
|
1351 |
) {
|
1352 |
$result = YOP_Poll_Bans::update( $ban );
|
1353 |
if ( true === $result['success'] ) {
|
1354 |
-
wp_send_json_success(
|
1355 |
} else {
|
1356 |
wp_send_json_error( $result['error'] );
|
1357 |
}
|
1358 |
} else {
|
1359 |
-
wp_send_json_error(
|
1360 |
}
|
1361 |
} else {
|
1362 |
-
wp_send_json_error(
|
1363 |
}
|
1364 |
}
|
1365 |
public function delete_bulk_ban() {
|
1366 |
if ( check_ajax_referer( 'yop-poll-bulk-bans', '_token', false ) ) {
|
1367 |
-
$bans = json_decode( wp_unslash( $_POST['bans'] ) );
|
1368 |
$success = 0;
|
1369 |
$current_user = wp_get_current_user();
|
1370 |
foreach ( $bans as $ban ) {
|
@@ -1391,7 +1404,7 @@ class YOP_Poll_Admin {
|
|
1391 |
'yop-poll' )
|
1392 |
);
|
1393 |
} else {
|
1394 |
-
wp_send_json_error(
|
1395 |
'Error deleting ban',
|
1396 |
'Error deleting bans',
|
1397 |
count( $bans ),
|
@@ -1399,67 +1412,68 @@ class YOP_Poll_Admin {
|
|
1399 |
);
|
1400 |
}
|
1401 |
} else {
|
1402 |
-
wp_send_json_error(
|
1403 |
}
|
1404 |
}
|
1405 |
public function record_vote() {
|
1406 |
-
$vote_data = json_decode( wp_unslash( $_POST['data'] ) );
|
1407 |
if ( isset( $vote_data->pollId ) && ( 0 < intval( $vote_data->pollId ) ) ) {
|
1408 |
if ( check_ajax_referer( 'yop-poll-vote-' . $vote_data->pollId, '_token', false ) ) {
|
1409 |
$result = YOP_Poll_Votes::add( $vote_data );
|
1410 |
if ( true === $result['success'] ) {
|
1411 |
-
wp_send_json_success(
|
1412 |
} else {
|
1413 |
wp_send_json_error( $result['error'] );
|
1414 |
}
|
1415 |
} else {
|
1416 |
-
wp_send_json_error(
|
1417 |
}
|
1418 |
} else {
|
1419 |
-
wp_send_json_error(
|
1420 |
}
|
1421 |
}
|
1422 |
public function record_wordpress_vote() {
|
1423 |
if ( isset( $_GET['poll_id'] ) && ( 0 < intval( $_GET['poll_id'] ) ) ) {
|
1424 |
$template = YOP_POLL_PATH . 'admin/views/general/addnewwordpressvote.php';
|
1425 |
echo YOP_Poll_View::render( $template, array(
|
1426 |
-
'poll_id' => $_GET['poll_id']
|
1427 |
) );
|
1428 |
} else {
|
1429 |
echo 'no go';
|
1430 |
}
|
1431 |
wp_die();
|
1432 |
}
|
1433 |
-
public function get_vote_details
|
1434 |
if ( check_ajax_referer( 'yop-poll-get-vote-details', '_token', false ) ) {
|
1435 |
if ( isset( $_POST['voteid'] ) && ( intval( $_POST['voteid'] ) > 0 ) ) {
|
1436 |
-
|
|
|
1437 |
$details_string = '';
|
1438 |
foreach ( $results as $res ) {
|
1439 |
-
if ( 'custom-field' === $res['question']) {
|
1440 |
-
$details_string .=
|
1441 |
-
$details_string .= '<div style="padding-left: 10px;">' .
|
1442 |
esc_html( $res['answers'][0]['answer_value'] ) . '</div>';
|
1443 |
} else {
|
1444 |
-
$details_string .=
|
1445 |
foreach ( $res['answers'] as $ra ) {
|
1446 |
-
$details_string .= '<div style="padding-left: 10px;">' .
|
1447 |
}
|
1448 |
}
|
1449 |
$details_string .= '</div>';
|
1450 |
}
|
1451 |
wp_send_json_success( [ 'details' => $details_string ] );
|
1452 |
} else {
|
1453 |
-
wp_send_json_error(
|
1454 |
}
|
1455 |
} else {
|
1456 |
-
wp_send_json_error(
|
1457 |
}
|
1458 |
}
|
1459 |
public function delete_single_vote() {
|
1460 |
if ( check_ajax_referer( 'yop-poll-get-vote-details', '_token', false ) ) {
|
1461 |
-
$poll_id = sanitize_text_field( $_POST['poll_id'] );
|
1462 |
-
$vote_id = sanitize_text_field( $_POST['vote_id'] );
|
1463 |
$success = 0;
|
1464 |
$current_user = wp_get_current_user();
|
1465 |
$vote_owner = YOP_Poll_Votes::get_owner( $vote_id );
|
@@ -1467,25 +1481,25 @@ class YOP_Poll_Admin {
|
|
1467 |
( ( $vote_owner === $current_user->ID ) && ( current_user_can( 'yop_poll_delete_own' ) ) ) ||
|
1468 |
( ( $vote_owner !== $current_user->ID ) && ( current_user_can( 'yop_poll_delete_others' ) ) )
|
1469 |
) {
|
1470 |
-
if ( $vote_id >0 ) {
|
1471 |
$result = YOP_Poll_Votes::delete_vote( $vote_id, $poll_id );
|
1472 |
if ( true === $result ) {
|
1473 |
-
wp_send_json_success(
|
1474 |
} else {
|
1475 |
-
wp_send_json_error(
|
1476 |
}
|
1477 |
}
|
1478 |
} else {
|
1479 |
-
wp_send_json_error(
|
1480 |
}
|
1481 |
} else {
|
1482 |
-
wp_send_json_error(
|
1483 |
}
|
1484 |
}
|
1485 |
public function delete_bulk_votes() {
|
1486 |
if ( check_ajax_referer( 'yop-poll-bulk-votes', '_token', false ) ) {
|
1487 |
-
$votes = json_decode( wp_unslash( $_POST['votes'] ) );
|
1488 |
-
$poll_id = $_POST['poll_id'];
|
1489 |
$success = 0;
|
1490 |
$current_user = wp_get_current_user();
|
1491 |
foreach ( $votes as $vote ) {
|
@@ -1495,7 +1509,7 @@ class YOP_Poll_Admin {
|
|
1495 |
( ( $vote_owner !== $current_user->ID ) && ( current_user_can( 'yop_poll_delete_others' ) ) )
|
1496 |
) {
|
1497 |
$votes_to_be_deleted[] = $vote;
|
1498 |
-
if ( count( $votes_to_be_deleted ) >0 ) {
|
1499 |
$result = YOP_Poll_Votes::delete_vote( $vote, $poll_id );
|
1500 |
if ( true === $result ) {
|
1501 |
$success++;
|
@@ -1515,7 +1529,7 @@ class YOP_Poll_Admin {
|
|
1515 |
'yop-poll' )
|
1516 |
);
|
1517 |
} else {
|
1518 |
-
wp_send_json_error(
|
1519 |
'Error deleting vote',
|
1520 |
'Error deleting votes',
|
1521 |
count( $votes ),
|
@@ -1523,13 +1537,13 @@ class YOP_Poll_Admin {
|
|
1523 |
);
|
1524 |
}
|
1525 |
} else {
|
1526 |
-
wp_send_json_error(
|
1527 |
}
|
1528 |
}
|
1529 |
public function delete_single_log() {
|
1530 |
if ( check_ajax_referer( 'yop-poll-view-logs', '_token', false ) ) {
|
1531 |
if ( isset( $_POST['log_id'] ) && ( 0 < intval( $_POST['log_id'] ) ) ) {
|
1532 |
-
$log_id = sanitize_text_field( $_POST['log_id'] );
|
1533 |
$log_owner = YOP_Poll_Logs::get_owner( $log_id );
|
1534 |
$current_user = wp_get_current_user();
|
1535 |
if (
|
@@ -1538,23 +1552,23 @@ class YOP_Poll_Admin {
|
|
1538 |
) {
|
1539 |
$result = YOP_Poll_Logs::delete( $log_id );
|
1540 |
if ( true === $result['success'] ) {
|
1541 |
-
wp_send_json_success(
|
1542 |
} else {
|
1543 |
wp_send_json_error( $result['error'] );
|
1544 |
}
|
1545 |
} else {
|
1546 |
-
wp_send_json_error(
|
1547 |
}
|
1548 |
} else {
|
1549 |
-
wp_send_json_error(
|
1550 |
}
|
1551 |
} else {
|
1552 |
-
wp_send_json_error(
|
1553 |
}
|
1554 |
}
|
1555 |
public function delete_bulk_log() {
|
1556 |
if ( check_ajax_referer( 'yop-poll-bulk-logs', '_token', false ) ) {
|
1557 |
-
$logs = json_decode( wp_unslash( $_POST['logs'] ) );
|
1558 |
$success = 0;
|
1559 |
$current_user = wp_get_current_user();
|
1560 |
foreach ( $logs as $log ) {
|
@@ -1581,7 +1595,7 @@ class YOP_Poll_Admin {
|
|
1581 |
'yop-poll' )
|
1582 |
);
|
1583 |
} else {
|
1584 |
-
wp_send_json_error(
|
1585 |
'Error deleting log',
|
1586 |
'Error deleting logs',
|
1587 |
count( $logs ),
|
@@ -1589,7 +1603,7 @@ class YOP_Poll_Admin {
|
|
1589 |
);
|
1590 |
}
|
1591 |
} else {
|
1592 |
-
wp_send_json_error(
|
1593 |
}
|
1594 |
}
|
1595 |
public function manage_settings() {
|
@@ -1603,77 +1617,78 @@ class YOP_Poll_Admin {
|
|
1603 |
echo YOP_Poll_View::render( $template, array( 'settings' => $unserialized_settings ) );
|
1604 |
}
|
1605 |
}
|
1606 |
-
public function save_settings
|
1607 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1608 |
if ( check_ajax_referer( 'yop-poll-update-settings', '_token', false ) ) {
|
1609 |
-
|
|
|
1610 |
if ( true === $result['success'] ) {
|
1611 |
-
wp_send_json_success(
|
1612 |
} else {
|
1613 |
wp_send_json_error( $result['error'] );
|
1614 |
}
|
1615 |
} else {
|
1616 |
-
wp_send_json_error(
|
1617 |
}
|
1618 |
} else {
|
1619 |
-
wp_send_json_error(
|
1620 |
}
|
1621 |
}
|
1622 |
public function add_votes_manually() {
|
1623 |
if ( isset( $_POST['id'] ) && ( 0 < intval( $_POST['id'] ) ) ) {
|
1624 |
if ( check_ajax_referer( 'yop-poll-add-votes-manually', '_token', false ) ) {
|
1625 |
$poll_id = intval( $_POST['id'] );
|
1626 |
-
$votes_data = json_decode( wp_unslash( $_POST['data'] ) );
|
1627 |
$result = YOP_Poll_Polls::add_votes_manually( $poll_id, $votes_data );
|
1628 |
if ( true === $result['success'] ) {
|
1629 |
-
wp_send_json_success(
|
1630 |
} else {
|
1631 |
wp_send_json_error( $result['error'] );
|
1632 |
}
|
1633 |
} else {
|
1634 |
-
wp_send_json_error(
|
1635 |
}
|
1636 |
} else {
|
1637 |
-
wp_send_json_error(
|
1638 |
}
|
1639 |
}
|
1640 |
public function create_poll_for_frontend() {
|
1641 |
-
if ( ( true === isset( $_POST['poll_id'] ) ) && ( '' !== $_POST['poll_id'] )
|
1642 |
$params = array();
|
1643 |
-
$poll_id = sanitize_text_field( $_POST['poll_id'] );
|
1644 |
-
$params['tracking_id'] = sanitize_text_field( $_POST['tracking_id'] );
|
1645 |
-
$params['show_results'] = sanitize_text_field( $_POST['show_results'] );
|
1646 |
$poll_for_output = YOP_Poll_Public::generate_poll_for_ajax( $poll_id, $params );
|
1647 |
if ( false !== $poll_for_output ) {
|
1648 |
wp_send_json_success( $poll_for_output );
|
1649 |
} else {
|
1650 |
-
wp_send_json_error(
|
1651 |
wp_die();
|
1652 |
}
|
1653 |
}
|
1654 |
}
|
1655 |
public function stop_showing_guide() {
|
1656 |
YOP_Poll_Settings::update_show_guide( 'no' );
|
1657 |
-
wp_send_json_success(
|
1658 |
}
|
1659 |
public function send_guide() {
|
1660 |
-
$user_input = sanitize_text_field( $_POST['input'] );
|
1661 |
$url = 'https://admin.yoppoll.com/';
|
1662 |
$request_string = array(
|
1663 |
'body' => array(
|
1664 |
'action' => 'send-guide',
|
1665 |
-
'input' =>
|
1666 |
),
|
1667 |
'user-agent' => 'WordPress/' . YOP_POLL_VERSION . ';'
|
1668 |
);
|
1669 |
$result = wp_remote_post( $url, $request_string );
|
1670 |
-
if( ! is_wp_error( $result ) && ( 200 === $result['response']['code'] ) ) {
|
1671 |
$response = unserialize( $result['body'] );
|
1672 |
} else {
|
1673 |
$response = null;
|
1674 |
}
|
1675 |
YOP_Poll_Settings::update_show_guide( 'no' );
|
1676 |
-
wp_send_json_success(
|
1677 |
}
|
1678 |
public function show_upgrade_to_pro() {
|
1679 |
$template = YOP_POLL_PATH . 'admin/views/general/upgrade-page.php';
|
@@ -1682,24 +1697,26 @@ class YOP_Poll_Admin {
|
|
1682 |
) );
|
1683 |
}
|
1684 |
public function send_deactivation_feedback() {
|
1685 |
-
|
|
|
1686 |
wp_die( 0 );
|
1687 |
}
|
1688 |
-
if( isset( $_POST['data'] ) ) {
|
1689 |
-
|
|
|
1690 |
}
|
1691 |
-
$subject =
|
1692 |
$message = '';
|
1693 |
if ( isset( $form_data['yop-poll_disable_reason'] ) ) {
|
1694 |
-
$message .=
|
1695 |
}
|
1696 |
-
if( isset( $form_data['yop-poll_deactivate_details'] ) ) {
|
1697 |
$message .= "\n\r";
|
1698 |
-
$message .= 'Message: ' . sanitize_text_field( implode('', $form_data['yop-poll_deactivate_details']) );
|
1699 |
} else {
|
1700 |
$message = 'No extra details given';
|
1701 |
}
|
1702 |
-
$email_headers = array
|
1703 |
'From: Wordpress Deactivation Notice <deactivate@yop-poll.com>',
|
1704 |
'Content-Type: text/plain'
|
1705 |
);
|
12 |
add_filter( 'clean_url', array( &$this, 'clean_recaptcha_url' ) );
|
13 |
add_action( 'admin_menu', array( &$this, 'build_admin_menu' ) );
|
14 |
add_action( 'plugins_loaded', array( &$this, 'verify_update' ) );
|
15 |
+
add_action( 'plugins_loaded', array( $this, 'load_translations' ) );
|
16 |
add_action( 'admin_enqueue_scripts', array( &$this, 'load_dependencies' ), 1000 );
|
17 |
add_action( 'wp_ajax_create_yop_poll', array( &$this, 'create_poll' ) );
|
18 |
add_action( 'wp_ajax_update_yop_poll', array( &$this, 'update_poll' ) );
|
71 |
<form action="" method="post">
|
72 |
<!-- Modal header -->
|
73 |
<div id="yop-poll-deactivate-header">
|
74 |
+
<img src="<?php echo esc_url( YOP_POLL_URL ) . '/admin/assets/images/yop-poll-admin-menu-icon16.png'; ?>">
|
75 |
+
<?php esc_html_e( 'Quick Feedback', 'yop-poll' ); ?>
|
76 |
</div>
|
77 |
<!-- Modal inner -->
|
78 |
<div id="yop-poll-deactivate-inner">
|
79 |
+
<h3><?php echo esc_html_e( "We're sorry to see you go.", 'yop-poll' ); ?></h3>
|
80 |
+
<p><strong><?php esc_html_e( 'If you have a moment, please share why you are deactivating YOP Poll:', 'yop-poll' ); ?></strong></p>
|
81 |
|
82 |
<ul>
|
83 |
|
84 |
<li>
|
85 |
<label>
|
86 |
<input type="radio" name="yop-poll_disable_reason" value="technical-issue" />
|
87 |
+
<strong><?php esc_html_e( "I couldn't get the plugin to work", 'yop-poll' ); ?></strong>
|
88 |
+
<p><?php esc_html_e( 'Please describe the issues below. This will help us test and solve these problems in a timely manner.', 'yop-poll' ); ?></p>
|
89 |
+
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php esc_html_e( 'Type the issues here...', 'yop-poll' ); ?>"></textarea>
|
90 |
</label>
|
91 |
</li>
|
92 |
|
93 |
<li>
|
94 |
<label>
|
95 |
<input type="radio" name="yop-poll_disable_reason" value="missing-feature" />
|
96 |
+
<strong><?php esc_html_e( 'Missing features I need', 'yop-poll' ); ?></strong>
|
97 |
+
<p><?php esc_html_e( 'Please describe the feature you need. This will help us prioritize our tasks and work on the most requested features.', 'yop-poll' ); ?></p>
|
98 |
+
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php esc_html_e( 'Type the missing features here...', 'yop-poll' ); ?>"></textarea>
|
99 |
</label>
|
100 |
</li>
|
101 |
|
102 |
<li>
|
103 |
<label>
|
104 |
<input type="radio" name="yop-poll_disable_reason" value="other" />
|
105 |
+
<strong><?php esc_html_e( 'Other reason', 'yop-poll' ); ?></strong>
|
106 |
+
<p><?php esc_html_e( 'We are continuously improving YOP Poll and your feedback is extremely important to us. Please let us know how we can improve the plugin.', 'yop-poll' ); ?></p>
|
107 |
+
<textarea name="yop-poll_deactivate_details[]" placeholder="<?php esc_html_e( 'Type your feedback here...', 'yop-poll' ); ?>"></textarea>
|
108 |
</label>
|
109 |
</li>
|
110 |
|
114 |
|
115 |
<!-- Modal footer -->
|
116 |
<div id="yop-poll-deactivate-footer">
|
117 |
+
<input disabled id="yop-poll-feedback-submit" class="button button-primary" type="submit" name="yop-poll-feedback-submit" value="<?php esc_html_e( 'Submit & Deactivate', 'yop-poll' ); ?>" />
|
118 |
+
<a id="yop-poll-deactivate-without-feedback" href="#"><?php esc_html_e( 'Skip and Deactivate', 'yop-poll' ); ?></a>
|
119 |
</div>
|
120 |
|
121 |
<!-- Token -->
|
202 |
<?php
|
203 |
}
|
204 |
public function clean_recaptcha_url( $url ) {
|
205 |
+
if ( false !== strstr( $url, 'recaptcha/api.js' ) ) {
|
206 |
+
$url = str_replace( '&', '&', $url );
|
207 |
}
|
208 |
return $url;
|
209 |
}
|
330 |
$maintenance = new YOP_POLL_Maintenance();
|
331 |
$maintenance->update_to_version_6_3_3();
|
332 |
}
|
333 |
+
if ( true === version_compare( $installed_version, '6.3.4', '<' ) ) {
|
334 |
+
$maintenance = new YOP_POLL_Maintenance();
|
335 |
+
$maintenance->update_to_version_6_3_4();
|
336 |
+
}
|
337 |
}
|
338 |
}
|
339 |
public function load_translations() {
|
340 |
+
load_plugin_textdomain( 'yop-poll', false, 'yop-poll/languages/' );
|
341 |
}
|
342 |
public function is_user_logged_in() {
|
343 |
if ( true === is_user_logged_in() ) {
|
348 |
die();
|
349 |
}
|
350 |
public function build_admin_menu() {
|
351 |
+
if ( function_exists( 'add_menu_page' ) ) {
|
352 |
$page = add_menu_page(
|
353 |
__( 'Yop Poll', 'yop-poll' ),
|
354 |
__( 'Yop Poll', 'yop-poll' ),
|
358 |
$this,
|
359 |
'manage_polls'
|
360 |
),
|
361 |
+
YOP_POLL_URL . 'admin/assets/images/yop-poll-admin-menu-icon16.png',
|
362 |
'26.6'
|
363 |
);
|
364 |
if ( function_exists( 'add_submenu_page' ) ) {
|
416 |
}
|
417 |
$subpage = add_submenu_page(
|
418 |
'yop-polls',
|
419 |
+
esc_html__( 'Settings', 'yop-poll' ),
|
420 |
+
esc_html__( 'Settings', 'yop-poll' ),
|
421 |
'yop_poll_results_own',
|
422 |
'yop-poll-settings',
|
423 |
array(
|
440 |
}
|
441 |
$subpage = add_submenu_page(
|
442 |
'yop-polls',
|
443 |
+
esc_html__( 'Upgrade to Pro', 'yop-poll' ),
|
444 |
+
esc_html__( 'Upgrade to Pro', 'yop-poll' ),
|
445 |
'yop_poll_results_own',
|
446 |
'yop-poll-upgrade-to-pro',
|
447 |
array(
|
470 |
}
|
471 |
public function load_scripts() {
|
472 |
$plugin_settings = YOP_Poll_Settings::get_all_settings();
|
473 |
+
if ( false !== $plugin_settings ) {
|
474 |
+
$plugin_settings_decoded = unserialize( $plugin_settings );
|
475 |
}
|
476 |
//include jquery by default
|
477 |
+
wp_enqueue_script( 'jquery' );
|
478 |
+
wp_enqueue_script( 'tiny_mce' );
|
479 |
+
wp_enqueue_script( 'jquery-ui-core', array( 'jquery' ) );
|
480 |
+
wp_enqueue_script( 'jquery-ui-datepicker', array( 'jquery' ) );
|
481 |
+
wp_enqueue_script( 'jquery-ui-sortable', array( 'jquery-ui-core' ) );
|
482 |
+
wp_enqueue_script( 'jquery-ui-draggable', array( 'jquery-ui-core' ) );
|
483 |
+
wp_enqueue_script( 'jquery-ui-droppable', array( 'jquery-ui-core' ) );
|
484 |
+
if ( true === YOP_POLL_TEST_MODE ) {
|
485 |
$plugin_admin_js_file = 'admin-' . YOP_POLL_VERSION . '.js';
|
486 |
|
487 |
} else {
|
488 |
$plugin_admin_js_file = 'admin-' . YOP_POLL_VERSION . '.min.js';
|
489 |
}
|
490 |
+
wp_enqueue_script( 'yop', YOP_POLL_URL . 'admin/assets/js/' . $plugin_admin_js_file, array(
|
491 |
+
'jquery',
|
492 |
'jquery-ui-sortable',
|
493 |
'jquery-ui-dialog',
|
494 |
+
'jquery-ui-datepicker',
|
495 |
+
)
|
496 |
);
|
497 |
/* add reCaptcha if enabled */
|
498 |
if (
|
499 |
+
( true === isset( $plugin_settings_decoded['integrations']['reCaptcha']['enabled'] ) ) &&
|
500 |
+
( 'yes' === $plugin_settings_decoded['integrations']['reCaptcha']['enabled'] ) &&
|
501 |
+
( true === isset( $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] ) ) &&
|
502 |
+
( '' !== $plugin_settings_decoded['integrations']['reCaptcha']['site-key'] ) &&
|
503 |
+
( true === isset( $plugin_settings_decoded['integrations']['reCaptcha']['secret-key'] ) ) &&
|
504 |
+
( '' !== $plugin_settings_decoded['integrations']['reCaptcha']['secret-key'] )
|
505 |
) {
|
506 |
$args = array(
|
507 |
'render' => 'explicit',
|
508 |
'onload' => 'YOPPollOnLoadRecaptcha'
|
509 |
);
|
510 |
+
wp_register_script( 'yop-reCaptcha', add_query_arg( $args, 'https://www.google.com/recaptcha/api.js' ), '', null );
|
511 |
+
wp_enqueue_script( 'yop-reCaptcha' );
|
512 |
}
|
513 |
/* done adding reCaptcha */
|
514 |
+
if ( true === isset( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) ) {
|
515 |
+
$captcha_accessibility_description = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['accessibility-description'] ) );
|
516 |
+
$captcha_accessibility_description = str_replace( '[/STRONG]', '</strong>', $captcha_accessibility_description );
|
517 |
} else {
|
518 |
$captcha_accessibility_description = '';
|
519 |
}
|
520 |
if ( true === isset( $plugin_settings_decoded['messages']['captcha']['explanation'] ) ) {
|
521 |
+
$captcha_explanation = str_replace( '[STRONG]', '<strong>', esc_html( $plugin_settings_decoded['messages']['captcha']['explanation'] ) );
|
522 |
+
$captcha_explanation = str_replace( '[/STRONG]', '</strong>', $captcha_explanation );
|
523 |
} else {
|
524 |
$captcha_explanation = '';
|
525 |
}
|
529 |
'dateFormat' => self::$date_format,
|
530 |
'timeFormat' => self::$time_format,
|
531 |
'timeNow' => time(),
|
532 |
+
'votingEnded' => isset( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-ended'] ) : '',
|
533 |
+
'votingNotStarted' => isset( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) ? esc_html( $plugin_settings_decoded['messages']['voting']['poll-not-started'] ) : '',
|
534 |
'newCustomFieldText' => esc_html__( 'New Custom Field', 'yop-poll' ),
|
535 |
'deleteTitle' => esc_html__( 'Warning', 'yop-poll' ),
|
536 |
'deletePollMessage' => esc_html__( 'Are you sure you want to delete this poll?', 'yop-poll' ),
|
588 |
'votingText' => esc_html__( 'Voting', 'yop-poll' ),
|
589 |
'resultsText' => esc_html__( 'Results', 'yop-poll' ),
|
590 |
'numberOfVotesSingular' => isset( $plugin_settings_decoded['messages']['results']['single-vote'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-vote'] ) : '',
|
591 |
+
'numberOfVotesPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-votes'] ) : '',
|
592 |
+
'numberOfAnswerSingular' => isset( $plugin_settings_decoded['messages']['results']['single-answer'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['single-answer'] ) : '',
|
593 |
+
'numberOfAnswersPlural' => isset( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) ? esc_html( $plugin_settings_decoded['messages']['results']['multiple-answers'] ) : '',
|
594 |
+
'annonymousVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['anonymous'] ) : '',
|
595 |
+
'wordpressVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['wordpress'] ) : '',
|
596 |
+
'facebookVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['facebook'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['facebook'] ) : '',
|
597 |
+
'googleVoteText' => isset( $plugin_settings_decoded['messages']['buttons']['google'] ) ? esc_html( $plugin_settings_decoded['messages']['buttons']['google'] ) : ''
|
598 |
),
|
599 |
'saveParams' => array(
|
600 |
'noTemplateSelected' => esc_html__( 'Template is missing', 'yop-poll' ),
|
627 |
'showLogDetailsLinkText' => esc_html__( 'View Details', 'yop-poll' ),
|
628 |
'hideLogDetailsLinkText' => esc_html__( 'Hide Details', 'yop-poll' ),
|
629 |
'numberOfVotesText' => esc_html__( 'Number of Votes', 'yop-poll' ),
|
630 |
+
'resultsParams' => array(
|
631 |
'singleVote' => esc_html__( 'vote', 'yop-poll' ),
|
632 |
'multipleVotes' => esc_html__( 'votes', 'yop-poll' )
|
633 |
),
|
651 |
wp_enqueue_style( 'yop-public', YOP_POLL_URL . 'public/assets/css/yop-poll-public-' . YOP_POLL_VERSION . '.css' );
|
652 |
}
|
653 |
public function change_page_title( $title ) {
|
654 |
+
$_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
655 |
+
$_action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
656 |
switch ( $_page ) {
|
657 |
case 'yop-polls':{
|
658 |
switch ( $_action ) {
|
659 |
case 'edit': {
|
660 |
+
$title = esc_html__( 'Edit Poll', 'yop-poll' );
|
661 |
break;
|
662 |
}
|
663 |
case 'view-results': {
|
664 |
+
$title = esc_html__( 'View Poll Results', 'yop-poll' );
|
665 |
break;
|
666 |
}
|
667 |
default: {
|
668 |
+
$title = esc_html__( 'All Polls', 'yop-poll' );
|
669 |
break;
|
670 |
}
|
671 |
}
|
674 |
case 'yop-poll-logs': {
|
675 |
switch ( $_action ) {
|
676 |
default: {
|
677 |
+
$title = esc_html__( 'View Logs', 'yop-poll' );
|
678 |
break;
|
679 |
}
|
680 |
}
|
683 |
case 'yop-poll-bans': {
|
684 |
switch ( $_action ) {
|
685 |
case 'add': {
|
686 |
+
$title = esc_html__( 'Add Ban', 'yop-poll' );
|
687 |
break;
|
688 |
}
|
689 |
case 'edit': {
|
690 |
+
$title = esc_html__( 'Edit Ban', 'yop-poll' );
|
691 |
break;
|
692 |
}
|
693 |
default: {
|
694 |
+
$title = esc_html__( 'All Bans', 'yop-poll' );
|
695 |
break;
|
696 |
}
|
697 |
}
|
701 |
return $title;
|
702 |
}
|
703 |
public function manage_polls() {
|
704 |
+
$_action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
705 |
+
$poll_id = isset( $_GET['poll_id'] ) ? sanitize_text_field( wp_unslash( $_GET['poll_id'] ) ) : '';
|
706 |
+
switch ( $_action ) {
|
707 |
case 'edit': {
|
708 |
+
$this->show_edit_poll( $poll_id );
|
709 |
break;
|
710 |
}
|
711 |
case 'delete': {
|
712 |
+
$this->delete_poll( $poll_id );
|
713 |
break;
|
714 |
}
|
715 |
case 'view-results': {
|
716 |
+
$this->display_results( $poll_id );
|
717 |
break;
|
718 |
}
|
719 |
case 'results': {
|
720 |
+
$this->build_results( $poll_id );
|
721 |
break;
|
722 |
}
|
723 |
case 'view-votes': {
|
724 |
+
$this->display_votes( $poll_id );
|
725 |
break;
|
726 |
}
|
727 |
default: {
|
732 |
}
|
733 |
public function show_polls() {
|
734 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
735 |
+
$params['q'] = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '';
|
736 |
+
$params['order_by'] = isset( $_GET['order_by'] ) ? sanitize_text_field( wp_unslash( $_GET['order_by'] ) ) : '';
|
737 |
+
$params['sort_order'] = isset( $_GET['sort_order'] ) ? sanitize_text_field( wp_unslash( $_GET['sort_order'] ) ) : 'desc';
|
738 |
+
$params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
|
739 |
+
$params['perpage'] = isset( $_GET['perpage'] ) && is_numeric( $_GET['perpage'] ) && $_GET['perpage'] > 0 ? sanitize_text_field( wp_unslash( $_GET['perpage'] ) ) : 10;
|
740 |
$polls = YOP_Poll_Polls::get_polls( $params );
|
741 |
$show_guide = YOP_Poll_Settings::get_show_guide();
|
742 |
$template = YOP_POLL_PATH . 'admin/views/polls/view.php';
|
791 |
'integrations' => YOP_Poll_Settings::get_integrations(),
|
792 |
'date_format' => self::$date_format ) );
|
793 |
} else {
|
794 |
+
esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
|
795 |
}
|
796 |
}
|
797 |
}
|
798 |
}
|
799 |
public function create_poll() {
|
800 |
if ( current_user_can( 'yop_poll_add' ) && check_ajax_referer( 'yop-poll-add-poll', '_token', false ) ) {
|
801 |
+
if ( true === isset( $_POST['poll'] ) ) {
|
802 |
+
$result = YOP_Poll_Polls::add( json_decode( sanitize_text_field( wp_unslash( $_POST['poll'] ) ) ) );
|
803 |
+
if ( true === $result['success'] ) {
|
804 |
+
wp_send_json_success(
|
805 |
+
array(
|
806 |
+
'success' => true,
|
807 |
+
'message' => esc_html__( 'Poll successfully added', 'yop-poll' ),
|
808 |
+
'pollId' => $result['poll_id']
|
809 |
+
)
|
810 |
+
);
|
811 |
+
} else {
|
812 |
+
wp_send_json_error( $result['error'] );
|
813 |
+
}
|
814 |
}
|
815 |
} else {
|
816 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
817 |
}
|
818 |
}
|
819 |
public function update_poll() {
|
820 |
$current_user = wp_get_current_user();
|
821 |
+
$poll = isset( $_POST['poll'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['poll'] ) ) ) : array();
|
822 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll->id );
|
823 |
if ( check_ajax_referer( 'yop-poll-edit-poll', '_token', false ) ) {
|
824 |
if (
|
827 |
) {
|
828 |
$result = YOP_Poll_Polls::update( $poll );
|
829 |
if ( true === $result['success'] ) {
|
830 |
+
wp_send_json_success(
|
831 |
array(
|
832 |
'success' => true,
|
833 |
+
'message' => esc_html__( 'Poll successfully updated', 'yop-poll' ),
|
834 |
'newElements' => $result['new-elements'],
|
835 |
'newSubElements' => $result['new-subelements'],
|
836 |
)
|
839 |
wp_send_json_error( $result['error'] );
|
840 |
}
|
841 |
} else {
|
842 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
843 |
}
|
844 |
} else {
|
845 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
846 |
}
|
847 |
}
|
848 |
public function delete_single_poll() {
|
849 |
if ( check_ajax_referer( 'yop-poll-view-polls', '_token', false ) || check_ajax_referer( 'yop-poll-edit-poll', '_token', false ) ) {
|
850 |
if ( isset( $_POST['poll_id'] ) && ( 0 < intval( $_POST['poll_id'] ) ) ) {
|
851 |
+
$poll_id = sanitize_text_field( wp_unslash( $_POST['poll_id'] ) );
|
852 |
$current_user = wp_get_current_user();
|
853 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll_id );
|
854 |
if (
|
857 |
) {
|
858 |
$result = YOP_Poll_Polls::delete( $poll_id );
|
859 |
if ( true === $result['success'] ) {
|
860 |
+
wp_send_json_success( esc_html__( 'Poll successfully deleted', 'yop-poll' ) );
|
861 |
} else {
|
862 |
wp_send_json_error( $result['error'] );
|
863 |
}
|
864 |
} else {
|
865 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
866 |
}
|
867 |
} else {
|
868 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
869 |
}
|
870 |
} else {
|
871 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
872 |
}
|
873 |
}
|
874 |
public function delete_bulk_poll() {
|
875 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
876 |
$current_user = wp_get_current_user();
|
877 |
+
$polls = isset( $_POST['polls'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['polls'] ) ) ) : array();
|
878 |
$success = 0;
|
879 |
foreach ( $polls as $poll ) {
|
880 |
$poll_owner = YOP_Poll_Polls::get_owner( $poll );
|
900 |
'yop-poll' )
|
901 |
);
|
902 |
} else {
|
903 |
+
wp_send_json_error( _n(
|
904 |
'Error deleting poll',
|
905 |
'Error deleting polls',
|
906 |
count( $polls ),
|
908 |
);
|
909 |
}
|
910 |
} else {
|
911 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
912 |
}
|
913 |
}
|
914 |
public function clone_single_poll() {
|
915 |
if ( check_ajax_referer( 'yop-poll-view-polls', '_token', false ) ) {
|
916 |
if ( isset( $_POST['poll_id'] ) && ( 0 < intval( $_POST['poll_id'] ) ) ) {
|
917 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
918 |
+
$result = YOP_Poll_Polls::clone_poll( sanitize_text_field( wp_unslash( $_POST['poll_id'] ) ) );
|
919 |
if ( true === $result['success'] ) {
|
920 |
+
wp_send_json_success( esc_html__( 'Poll successfully cloned', 'yop-poll' ) );
|
921 |
} else {
|
922 |
wp_send_json_error( $result['error'] );
|
923 |
}
|
924 |
} else {
|
925 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
926 |
}
|
927 |
} else {
|
928 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
929 |
}
|
930 |
} else {
|
931 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
932 |
}
|
933 |
}
|
934 |
public function clone_bulk_poll() {
|
935 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
936 |
+
$polls = isset( $_POST['polls'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['polls'] ) ) ) : array();
|
937 |
$success = 0;
|
938 |
foreach ( $polls as $poll ) {
|
939 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
955 |
'yop-poll' )
|
956 |
);
|
957 |
} else {
|
958 |
+
wp_send_json_error( _n(
|
959 |
'Error cloning poll',
|
960 |
'Error cloning polls',
|
961 |
count( $polls ),
|
963 |
);
|
964 |
}
|
965 |
} else {
|
966 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
967 |
}
|
968 |
}
|
969 |
public function reset_bulk_poll() {
|
970 |
if ( check_ajax_referer( 'yop-poll-bulk-polls', '_token', false ) ) {
|
971 |
+
$polls = isset( $_POST['polls'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['polls'] ) ) ) : array();
|
972 |
$success = 0;
|
973 |
foreach ( $polls as $poll ) {
|
974 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
983 |
}
|
984 |
}
|
985 |
if ( $success === intval( count( $polls ) ) ) {
|
986 |
+
wp_send_json_success( esc_html__( 'Votes successfully reset', 'yop-poll' ) );
|
987 |
} else {
|
988 |
+
wp_send_json_error( esc_html__( 'Error resetting votes', 'yop-poll' ) );
|
989 |
}
|
990 |
} else {
|
991 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
992 |
}
|
993 |
}
|
994 |
public function display_results( $poll_id ) {
|
1005 |
}
|
1006 |
public function build_results( $poll_id ) {
|
1007 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
1008 |
+
$params['q'] = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '';
|
1009 |
+
$params['order_by'] = isset( $_GET['order_by'] ) ? sanitize_text_field( wp_unslash( $_GET['order_by'] ) ) : '';
|
1010 |
+
$params['sort_order'] = isset( $_GET['sort_order'] ) ? sanitize_text_field( wp_unslash( $_GET['sort_order'] ) ) : 'asc';
|
1011 |
+
$params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
|
1012 |
$template = YOP_POLL_PATH . 'admin/views/results/view.php';
|
1013 |
$poll = YOP_Poll_Polls::get_poll_for_admin( $poll_id );
|
1014 |
if ( $poll ) {
|
1023 |
$total_votes_per_question = [];
|
1024 |
$total_voters_per_question = [];
|
1025 |
$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 ) ) );
|
1026 |
+
$total_pages = ceil( $votes_count / $limit );
|
1027 |
$query = "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_votes}` WHERE `poll_id` = %d AND `status` = 'active' limit $offset, $limit";
|
1028 |
$votes = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, array( $poll_id ) ) );
|
1029 |
|
1042 |
$question_aswers[] = $answers['data'];
|
1043 |
}
|
1044 |
}
|
1045 |
+
if ( isset( $total_votes_per_question[$ave['id']] ) ) {
|
1046 |
$total_votes_per_question[$ave['id']]++;
|
1047 |
} else {
|
1048 |
$total_votes_per_question[$ave['id']] = 1;
|
1049 |
}
|
1050 |
+
if ( isset( $total_voters_per_question[$ave['id']][$user_type] ) ) {
|
1051 |
$total_voters_per_question[$ave['id']][$user_type]++;
|
1052 |
} else {
|
1053 |
$total_voters_per_question[$ave['id']][$user_type] = 1;
|
1057 |
}
|
1058 |
}
|
1059 |
$other_answers = YOP_Poll_Helper::group_other_answers( $other_answers );
|
1060 |
+
if ( count( $votes ) > 0 ) {
|
1061 |
$cf_hidden .= '<input type="hidden" name="cf_total_pages" id="cf-total-pages" value="' . $total_pages . '">';
|
1062 |
$cf_hidden .= '<input type="hidden" name="cf_page" id="cf-page" value="' . $page . '">';
|
1063 |
foreach ( $votes as $vote ) {
|
1070 |
}
|
1071 |
}
|
1072 |
if ( count( $custom_fields ) > 0 ) {
|
1073 |
+
$cf_total_pages = ceil( count( $custom_fields ) / $limit );
|
1074 |
$cf_string .= '<tr>';
|
1075 |
foreach ( $custom_fields as $cf ) {
|
1076 |
$cf_string .= '<td>' . $cf['data'] . '</td>';
|
1098 |
)
|
1099 |
);
|
1100 |
} else {
|
1101 |
+
$error = esc_html__( 'Invalid poll', 'yop-poll' );
|
1102 |
$template = YOP_POLL_PATH . 'admin/views/general/error.php';
|
1103 |
echo YOP_Poll_View::render(
|
1104 |
$template,
|
1111 |
}
|
1112 |
public function display_votes( $poll_id ) {
|
1113 |
if ( current_user_can( 'yop_poll_results_own' ) ) {
|
1114 |
+
$params['q'] = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '';
|
1115 |
+
$params['order_by'] = isset( $_GET['order_by'] ) ? sanitize_text_field( wp_unslash( $_GET['order_by'] ) ) : '';
|
1116 |
+
$params['sort_order'] = isset( $_GET['sort_order'] ) ? sanitize_text_field( wp_unslash( $_GET['sort_order'] ) ) : 'asc';
|
1117 |
+
$params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
|
1118 |
+
$params['page'] = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'yop-poll';
|
1119 |
+
$params['poll_id'] = isset( $_GET['poll_id'] ) ? sanitize_text_field( wp_unslash( $_GET['poll_id'] ) ) : '';
|
1120 |
+
$params['action'] = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
1121 |
$template = YOP_POLL_PATH . 'admin/views/results/votes.php';
|
1122 |
$poll = YOP_Poll_Polls::get_poll_for_admin( $poll_id );
|
1123 |
if ( $poll ) {
|
1137 |
)
|
1138 |
);
|
1139 |
} else {
|
1140 |
+
$error = esc_html__( 'Invalid poll', 'yop-poll' );
|
1141 |
$template = YOP_POLL_PATH . 'admin/views/general/error.php';
|
1142 |
echo YOP_Poll_View::render(
|
1143 |
$template,
|
1151 |
public function get_yop_poll_votes_customs() {
|
1152 |
if ( check_ajax_referer( 'yop-poll-get-vote-customs', '_token', false ) ) {
|
1153 |
$limit = 10;
|
1154 |
+
if ( isset( $_POST['page'] ) && '' !== $_POST['page'] ) {
|
1155 |
+
$page = sanitize_text_field( wp_unslash( $_POST['page'] ) );
|
1156 |
+
$offset = $limit * ( $page - 1 );
|
1157 |
} else {
|
1158 |
$page = 1;
|
1159 |
$offset = 0;
|
1160 |
}
|
1161 |
+
$poll_id = isset( $_POST['poll_id'] ) ? sanitize_text_field( wp_unslash( $_POST['poll_id'] ) ) : '';
|
1162 |
+
$votes = YOP_Poll_Votes::get_vote_by_poll( $poll_id, $limit, $offset );
|
1163 |
$cf_string = '';
|
1164 |
+
if ( count( $votes ) > 0 ) {
|
1165 |
foreach ( $votes as $vote ) {
|
1166 |
$vote_data = unserialize( $vote->vote_data );
|
1167 |
$custom_fields = [];
|
1172 |
}
|
1173 |
if ( count( $custom_fields ) > 0 ) {
|
1174 |
$cf_string .= '<tr>';
|
1175 |
+
foreach ( $custom_fields as $cf ) {
|
1176 |
$cf_string .= '<td>' . $cf['data'] . '</td>';
|
1177 |
}
|
1178 |
$cf_string .= '</tr>';
|
1183 |
wp_send_json_success( $cf_string );
|
1184 |
}
|
1185 |
} else {
|
1186 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1187 |
}
|
1188 |
}
|
1189 |
public function manage_support() {
|
1194 |
$template = YOP_POLL_PATH . 'admin/views/general/migrate-old-tables.php';
|
1195 |
echo YOP_Poll_View::render( $template );
|
1196 |
}
|
1197 |
+
public function manage_logs() {
|
1198 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1199 |
+
$params['q'] = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '';
|
1200 |
+
$params['order_by'] = isset( $_GET['order_by'] ) ? sanitize_text_field( wp_unslash( $_GET['order_by'] ) ) : '';
|
1201 |
+
$params['sort_order'] = isset( $_GET['sort_order'] ) ? sanitize_text_field( wp_unslash( $_GET['sort_order'] ) ) : 'asc';
|
1202 |
+
$params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
|
1203 |
$logs = YOP_Poll_Logs::get_logs( $params );
|
1204 |
$template = YOP_POLL_PATH . 'admin/views/logs/view.php';
|
1205 |
echo YOP_Poll_View::render( $template, array(
|
1216 |
public function get_log_details() {
|
1217 |
if ( check_ajax_referer( 'yop-poll-view-logs', '_token', false ) ) {
|
1218 |
if ( isset( $_POST['log_id'] ) && ( 0 < intval( $_POST['log_id'] ) ) ) {
|
1219 |
+
$log_id = sanitize_text_field( wp_unslash( $_POST['log_id'] ) );
|
1220 |
+
$log_owner = YOP_Poll_Logs::get_owner( $log_id );
|
1221 |
$current_user = wp_get_current_user();
|
1222 |
if ( $log_owner == $current_user->ID ) {
|
1223 |
+
$results = YOP_Poll_Logs::get_log_details( $log_id );
|
1224 |
$details_string = '';
|
1225 |
foreach ( $results as $res ) {
|
1226 |
+
if ( 'custom-field' === $res['question'] ) {
|
1227 |
+
$details_string .= '<div>' . esc_html__( 'Custom Field', 'yop-poll' ) . ': ' . $res['caption'];
|
1228 |
+
$details_string .= '<div style="padding-left: 10px;">' . esc_html__( 'Answer', 'yop-poll' ) . ': ' .
|
1229 |
$res['answers'][0]['answer_value'] . '</div>';
|
1230 |
} else {
|
1231 |
+
$details_string .= '<div>' . esc_html__( 'Question', 'yop-poll' ) . ': ' . $res['question'];
|
1232 |
foreach ( $res['answers'] as $ra ) {
|
1233 |
+
$details_string .= '<div style="padding-left: 10px;">' . esc_html__( 'Answer', 'yop-poll' ) . ': ' . $ra['answer_value'] . '</div>';
|
1234 |
}
|
1235 |
}
|
1236 |
$details_string .= '</div>';
|
1237 |
}
|
1238 |
wp_send_json_success( [ 'details' => $details_string ] );
|
1239 |
} else {
|
1240 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1241 |
}
|
1242 |
} else {
|
1243 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1244 |
}
|
1245 |
} else {
|
1246 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1247 |
}
|
1248 |
}
|
1249 |
public function manage_bans() {
|
1250 |
+
$_action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
1251 |
+
switch ( $_action ) {
|
1252 |
case 'add': {
|
1253 |
$this->show_add_ban();
|
1254 |
break;
|
1255 |
}
|
1256 |
case 'edit': {
|
1257 |
+
$ban_id = isset( $_GET['ban_id'] ) ? sanitize_text_field( wp_unslash( $_GET['ban_id'] ) ) : '';
|
1258 |
+
$this->show_edit_ban( $ban_id );
|
1259 |
break;
|
1260 |
}
|
1261 |
default: {
|
1266 |
}
|
1267 |
public function show_bans() {
|
1268 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1269 |
+
$params['q'] = isset( $_GET['q'] ) ? sanitize_text_field( wp_unslash( $_GET['q'] ) ) : '';
|
1270 |
+
$params['order_by'] = isset( $_GET['order_by'] ) ? sanitize_text_field( wp_unslash( $_GET['order_by'] ) ) : '';
|
1271 |
+
$params['sort_order'] = isset( $_GET['sort_order'] ) ? sanitize_text_field( wp_unslash( $_GET['sort_order'] ) ) : 'asc';
|
1272 |
+
$params['page_no'] = isset( $_GET['page_no'] ) ? sanitize_text_field( wp_unslash( $_GET['page_no'] ) ) : '1';
|
1273 |
$template = YOP_POLL_PATH . 'admin/views/bans/view.php';
|
1274 |
$bans = YOP_Poll_Bans::get_bans( $params );
|
1275 |
echo YOP_Poll_View::render( $template, array(
|
1294 |
}
|
1295 |
public function create_ban() {
|
1296 |
if ( current_user_can( 'yop_poll_add' ) && check_ajax_referer( 'yop-poll-add-ban', '_token', false ) ) {
|
1297 |
+
$ban = isset( $_POST['ban'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['ban'] ) ) ) : array();
|
1298 |
+
$result = YOP_Poll_Bans::add( $ban );
|
1299 |
if ( true === $result['success'] ) {
|
1300 |
+
wp_send_json_success( esc_html__( 'Ban successfully added', 'yop-poll' ) );
|
1301 |
} else {
|
1302 |
wp_send_json_error( $result['error'] );
|
1303 |
}
|
1304 |
} else {
|
1305 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1306 |
}
|
1307 |
}
|
1308 |
public function show_edit_ban( $ban_id ) {
|
1322 |
'polls' => $polls
|
1323 |
));
|
1324 |
} else {
|
1325 |
+
esc_html_e( 'You don\'t have sufficient permissions to access this page', 'yop-poll' );
|
1326 |
}
|
1327 |
}
|
1328 |
}
|
1330 |
public function delete_single_ban() {
|
1331 |
if ( check_ajax_referer( 'yop-poll-view-bans', '_token', false ) ) {
|
1332 |
if ( isset( $_POST['ban_id'] ) && ( 0 < intval( $_POST['ban_id'] ) ) ) {
|
1333 |
+
$ban_id = sanitize_text_field( wp_unslash( $_POST['ban_id'] ) );
|
1334 |
$current_user = wp_get_current_user();
|
1335 |
$ban_owner = YOP_Poll_Bans::get_owner( $ban_id );
|
1336 |
if (
|
1339 |
) {
|
1340 |
$result = YOP_Poll_Bans::delete( $ban_id );
|
1341 |
if ( true === $result['success'] ) {
|
1342 |
+
wp_send_json_success( esc_html__( 'Ban successfully deleted', 'yop-poll' ) );
|
1343 |
} else {
|
1344 |
wp_send_json_error( $result['error'] );
|
1345 |
}
|
1346 |
} else {
|
1347 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1348 |
}
|
1349 |
} else {
|
1350 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1351 |
}
|
1352 |
} else {
|
1353 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1354 |
}
|
1355 |
}
|
1356 |
public function update_ban() {
|
1357 |
+
$ban = isset( $_POST['ban'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['ban'] ) ) ) : array();
|
1358 |
$ban_owner = YOP_Poll_Bans::get_owner( $ban->ban->id );
|
1359 |
$current_user = wp_get_current_user();
|
1360 |
if ( check_ajax_referer( 'yop-poll-edit-ban', '_token', false ) ) {
|
1364 |
) {
|
1365 |
$result = YOP_Poll_Bans::update( $ban );
|
1366 |
if ( true === $result['success'] ) {
|
1367 |
+
wp_send_json_success( esc_html__( 'Ban successfully updated', 'yop-poll' ) );
|
1368 |
} else {
|
1369 |
wp_send_json_error( $result['error'] );
|
1370 |
}
|
1371 |
} else {
|
1372 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1373 |
}
|
1374 |
} else {
|
1375 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1376 |
}
|
1377 |
}
|
1378 |
public function delete_bulk_ban() {
|
1379 |
if ( check_ajax_referer( 'yop-poll-bulk-bans', '_token', false ) ) {
|
1380 |
+
$bans = isset( $_POST['bans'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['bans'] ) ) ) : array();
|
1381 |
$success = 0;
|
1382 |
$current_user = wp_get_current_user();
|
1383 |
foreach ( $bans as $ban ) {
|
1404 |
'yop-poll' )
|
1405 |
);
|
1406 |
} else {
|
1407 |
+
wp_send_json_error( _n(
|
1408 |
'Error deleting ban',
|
1409 |
'Error deleting bans',
|
1410 |
count( $bans ),
|
1412 |
);
|
1413 |
}
|
1414 |
} else {
|
1415 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1416 |
}
|
1417 |
}
|
1418 |
public function record_vote() {
|
1419 |
+
$vote_data = isset( $_POST['data'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['data'] ) ) ) : array();
|
1420 |
if ( isset( $vote_data->pollId ) && ( 0 < intval( $vote_data->pollId ) ) ) {
|
1421 |
if ( check_ajax_referer( 'yop-poll-vote-' . $vote_data->pollId, '_token', false ) ) {
|
1422 |
$result = YOP_Poll_Votes::add( $vote_data );
|
1423 |
if ( true === $result['success'] ) {
|
1424 |
+
wp_send_json_success( esc_html__( 'Vote Recorded', 'yop-poll' ) );
|
1425 |
} else {
|
1426 |
wp_send_json_error( $result['error'] );
|
1427 |
}
|
1428 |
} else {
|
1429 |
+
wp_send_json_error( esc_html__( 'Invalid data 1', 'yop-poll' ) );
|
1430 |
}
|
1431 |
} else {
|
1432 |
+
wp_send_json_error( esc_html__( 'Invalid data 2', 'yop-poll' ) );
|
1433 |
}
|
1434 |
}
|
1435 |
public function record_wordpress_vote() {
|
1436 |
if ( isset( $_GET['poll_id'] ) && ( 0 < intval( $_GET['poll_id'] ) ) ) {
|
1437 |
$template = YOP_POLL_PATH . 'admin/views/general/addnewwordpressvote.php';
|
1438 |
echo YOP_Poll_View::render( $template, array(
|
1439 |
+
'poll_id' => sanitize_text_field( wp_unslash( $_GET['poll_id'] ) )
|
1440 |
) );
|
1441 |
} else {
|
1442 |
echo 'no go';
|
1443 |
}
|
1444 |
wp_die();
|
1445 |
}
|
1446 |
+
public function get_vote_details() {
|
1447 |
if ( check_ajax_referer( 'yop-poll-get-vote-details', '_token', false ) ) {
|
1448 |
if ( isset( $_POST['voteid'] ) && ( intval( $_POST['voteid'] ) > 0 ) ) {
|
1449 |
+
$vote_id = sanitize_text_field( wp_unslash( $_POST['voteid'] ) );
|
1450 |
+
$results = YOP_Poll_Votes::get_vote_details( $vote_id );
|
1451 |
$details_string = '';
|
1452 |
foreach ( $results as $res ) {
|
1453 |
+
if ( 'custom-field' === $res['question'] ) {
|
1454 |
+
$details_string .= '<div>' . esc_html__( 'Custom Field', 'yop-poll' ) . ': ' . $res['caption'];
|
1455 |
+
$details_string .= '<div style="padding-left: 10px;">' . esc_html__( 'Answer', 'yop-poll' ) . ': ' .
|
1456 |
esc_html( $res['answers'][0]['answer_value'] ) . '</div>';
|
1457 |
} else {
|
1458 |
+
$details_string .= '<div>' . esc_html__( 'Question', 'yop-poll' ) . ': ' . $res['question'];
|
1459 |
foreach ( $res['answers'] as $ra ) {
|
1460 |
+
$details_string .= '<div style="padding-left: 10px;">' . esc_html__( 'Answer', 'yop-poll' ) . ': ' . esc_html( $ra['answer_value'] ) . '</div>';
|
1461 |
}
|
1462 |
}
|
1463 |
$details_string .= '</div>';
|
1464 |
}
|
1465 |
wp_send_json_success( [ 'details' => $details_string ] );
|
1466 |
} else {
|
1467 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1468 |
}
|
1469 |
} else {
|
1470 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1471 |
}
|
1472 |
}
|
1473 |
public function delete_single_vote() {
|
1474 |
if ( check_ajax_referer( 'yop-poll-get-vote-details', '_token', false ) ) {
|
1475 |
+
$poll_id = isset( $_POST['poll_id'] ) ? sanitize_text_field( wp_unslash( $_POST['poll_id'] ) ) : '';
|
1476 |
+
$vote_id = isset( $_POST['vote_id'] ) ? sanitize_text_field( wp_unslash( $_POST['vote_id'] ) ) : '';
|
1477 |
$success = 0;
|
1478 |
$current_user = wp_get_current_user();
|
1479 |
$vote_owner = YOP_Poll_Votes::get_owner( $vote_id );
|
1481 |
( ( $vote_owner === $current_user->ID ) && ( current_user_can( 'yop_poll_delete_own' ) ) ) ||
|
1482 |
( ( $vote_owner !== $current_user->ID ) && ( current_user_can( 'yop_poll_delete_others' ) ) )
|
1483 |
) {
|
1484 |
+
if ( $vote_id > 0 ) {
|
1485 |
$result = YOP_Poll_Votes::delete_vote( $vote_id, $poll_id );
|
1486 |
if ( true === $result ) {
|
1487 |
+
wp_send_json_success( esc_html__( 'Vote successfully deleted', 'yop-poll' ) );
|
1488 |
} else {
|
1489 |
+
wp_send_json_error( esc_html__( 'Error deleting vote', 'yop-poll' ) );
|
1490 |
}
|
1491 |
}
|
1492 |
} else {
|
1493 |
+
wp_send_json_error( esc_html__( 'Error deleting vote', 'yop-poll' ) );
|
1494 |
}
|
1495 |
} else {
|
1496 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1497 |
}
|
1498 |
}
|
1499 |
public function delete_bulk_votes() {
|
1500 |
if ( check_ajax_referer( 'yop-poll-bulk-votes', '_token', false ) ) {
|
1501 |
+
$votes = isset( $_POST['votes'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['votes'] ) ) ) : array();
|
1502 |
+
$poll_id = isset( $_POST['poll_id'] ) ? sanitize_text_field( wp_unslash( $_POST['poll_id'] ) ) : '';
|
1503 |
$success = 0;
|
1504 |
$current_user = wp_get_current_user();
|
1505 |
foreach ( $votes as $vote ) {
|
1509 |
( ( $vote_owner !== $current_user->ID ) && ( current_user_can( 'yop_poll_delete_others' ) ) )
|
1510 |
) {
|
1511 |
$votes_to_be_deleted[] = $vote;
|
1512 |
+
if ( count( $votes_to_be_deleted ) > 0 ) {
|
1513 |
$result = YOP_Poll_Votes::delete_vote( $vote, $poll_id );
|
1514 |
if ( true === $result ) {
|
1515 |
$success++;
|
1529 |
'yop-poll' )
|
1530 |
);
|
1531 |
} else {
|
1532 |
+
wp_send_json_error( _n(
|
1533 |
'Error deleting vote',
|
1534 |
'Error deleting votes',
|
1535 |
count( $votes ),
|
1537 |
);
|
1538 |
}
|
1539 |
} else {
|
1540 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1541 |
}
|
1542 |
}
|
1543 |
public function delete_single_log() {
|
1544 |
if ( check_ajax_referer( 'yop-poll-view-logs', '_token', false ) ) {
|
1545 |
if ( isset( $_POST['log_id'] ) && ( 0 < intval( $_POST['log_id'] ) ) ) {
|
1546 |
+
$log_id = sanitize_text_field( wp_unslash( $_POST['log_id'] ) );
|
1547 |
$log_owner = YOP_Poll_Logs::get_owner( $log_id );
|
1548 |
$current_user = wp_get_current_user();
|
1549 |
if (
|
1552 |
) {
|
1553 |
$result = YOP_Poll_Logs::delete( $log_id );
|
1554 |
if ( true === $result['success'] ) {
|
1555 |
+
wp_send_json_success( esc_html__( 'Log successfully deleted', 'yop-poll' ) );
|
1556 |
} else {
|
1557 |
wp_send_json_error( $result['error'] );
|
1558 |
}
|
1559 |
} else {
|
1560 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1561 |
}
|
1562 |
} else {
|
1563 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1564 |
}
|
1565 |
} else {
|
1566 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1567 |
}
|
1568 |
}
|
1569 |
public function delete_bulk_log() {
|
1570 |
if ( check_ajax_referer( 'yop-poll-bulk-logs', '_token', false ) ) {
|
1571 |
+
$logs = isset( $_POST['logs'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['logs'] ) ) ) : array();
|
1572 |
$success = 0;
|
1573 |
$current_user = wp_get_current_user();
|
1574 |
foreach ( $logs as $log ) {
|
1595 |
'yop-poll' )
|
1596 |
);
|
1597 |
} else {
|
1598 |
+
wp_send_json_error( _n(
|
1599 |
'Error deleting log',
|
1600 |
'Error deleting logs',
|
1601 |
count( $logs ),
|
1603 |
);
|
1604 |
}
|
1605 |
} else {
|
1606 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1607 |
}
|
1608 |
}
|
1609 |
public function manage_settings() {
|
1617 |
echo YOP_Poll_View::render( $template, array( 'settings' => $unserialized_settings ) );
|
1618 |
}
|
1619 |
}
|
1620 |
+
public function save_settings() {
|
1621 |
if ( current_user_can( 'yop_poll_add' ) ) {
|
1622 |
if ( check_ajax_referer( 'yop-poll-update-settings', '_token', false ) ) {
|
1623 |
+
$settings = isset( $_POST['settings'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['settings'] ) ) ) : array();
|
1624 |
+
$result = YOP_Poll_Settings::save_settings( $settings );
|
1625 |
if ( true === $result['success'] ) {
|
1626 |
+
wp_send_json_success( esc_html__( 'Settings updated', 'yop-poll' ) );
|
1627 |
} else {
|
1628 |
wp_send_json_error( $result['error'] );
|
1629 |
}
|
1630 |
} else {
|
1631 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1632 |
}
|
1633 |
} else {
|
1634 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
1635 |
}
|
1636 |
}
|
1637 |
public function add_votes_manually() {
|
1638 |
if ( isset( $_POST['id'] ) && ( 0 < intval( $_POST['id'] ) ) ) {
|
1639 |
if ( check_ajax_referer( 'yop-poll-add-votes-manually', '_token', false ) ) {
|
1640 |
$poll_id = intval( $_POST['id'] );
|
1641 |
+
$votes_data = isset( $_POST['data'] ) ? json_decode( sanitize_text_field( wp_unslash( $_POST['data'] ) ) ) : array();
|
1642 |
$result = YOP_Poll_Polls::add_votes_manually( $poll_id, $votes_data );
|
1643 |
if ( true === $result['success'] ) {
|
1644 |
+
wp_send_json_success( esc_html__( 'Votes Succesfully Added', 'yop-poll' ) );
|
1645 |
} else {
|
1646 |
wp_send_json_error( $result['error'] );
|
1647 |
}
|
1648 |
} else {
|
1649 |
+
wp_send_json_error( esc_html__( 'Invalid data 1', 'yop-poll' ) );
|
1650 |
}
|
1651 |
} else {
|
1652 |
+
wp_send_json_error( esc_html__( 'Invalid data 2', 'yop-poll' ) );
|
1653 |
}
|
1654 |
}
|
1655 |
public function create_poll_for_frontend() {
|
1656 |
+
if ( ( true === isset( $_POST['poll_id'] ) ) && ( '' !== $_POST['poll_id'] ) ) {
|
1657 |
$params = array();
|
1658 |
+
$poll_id = sanitize_text_field( wp_unslash( $_POST['poll_id'] ) );
|
1659 |
+
$params['tracking_id'] = isset( $_POST['tracking_id'] ) ? sanitize_text_field( wp_unslash( $_POST['tracking_id'] ) ) : '';
|
1660 |
+
$params['show_results'] = isset( $_POST['show_results'] ) ? sanitize_text_field( wp_unslash( $_POST['show_results'] ) ) : '';
|
1661 |
$poll_for_output = YOP_Poll_Public::generate_poll_for_ajax( $poll_id, $params );
|
1662 |
if ( false !== $poll_for_output ) {
|
1663 |
wp_send_json_success( $poll_for_output );
|
1664 |
} else {
|
1665 |
+
wp_send_json_error( esc_html__( 'Error generating poll', 'yop-poll' ) );
|
1666 |
wp_die();
|
1667 |
}
|
1668 |
}
|
1669 |
}
|
1670 |
public function stop_showing_guide() {
|
1671 |
YOP_Poll_Settings::update_show_guide( 'no' );
|
1672 |
+
wp_send_json_success( esc_html__( 'Setting Updated', 'yop-poll' ) );
|
1673 |
}
|
1674 |
public function send_guide() {
|
1675 |
+
$user_input = isset( $_POST['input'] ) ? sanitize_text_field( wp_unslash( $_POST['input'] ) ) : '';
|
1676 |
$url = 'https://admin.yoppoll.com/';
|
1677 |
$request_string = array(
|
1678 |
'body' => array(
|
1679 |
'action' => 'send-guide',
|
1680 |
+
'input' => $user_input
|
1681 |
),
|
1682 |
'user-agent' => 'WordPress/' . YOP_POLL_VERSION . ';'
|
1683 |
);
|
1684 |
$result = wp_remote_post( $url, $request_string );
|
1685 |
+
if ( ! is_wp_error( $result ) && ( 200 === $result['response']['code'] ) ) {
|
1686 |
$response = unserialize( $result['body'] );
|
1687 |
} else {
|
1688 |
$response = null;
|
1689 |
}
|
1690 |
YOP_Poll_Settings::update_show_guide( 'no' );
|
1691 |
+
wp_send_json_success( esc_html__( 'Guide Sent', 'yop-poll' ) );
|
1692 |
}
|
1693 |
public function show_upgrade_to_pro() {
|
1694 |
$template = YOP_POLL_PATH . 'admin/views/general/upgrade-page.php';
|
1697 |
) );
|
1698 |
}
|
1699 |
public function send_deactivation_feedback() {
|
1700 |
+
$_token = isset( $_POST['_token'] ) ? sanitize_text_field( wp_unslash( $_POST['_token'] ) ) : '';
|
1701 |
+
if ( empty( $_token ) || ! wp_verify_nonce( $_token, 'yop-poll_deactivation' ) ) {
|
1702 |
wp_die( 0 );
|
1703 |
}
|
1704 |
+
if ( isset( $_POST['data'] ) ) {
|
1705 |
+
$data = sanitize_text_field( wp_unslash( $_POST['data'] ) );
|
1706 |
+
parse_str( $data, $form_data );
|
1707 |
}
|
1708 |
+
$subject = 'YOP Poll Deactivation Notification';
|
1709 |
$message = '';
|
1710 |
if ( isset( $form_data['yop-poll_disable_reason'] ) ) {
|
1711 |
+
$message .= 'Reason: ' . sanitize_text_field( $form_data['yop-poll_disable_reason'] );
|
1712 |
}
|
1713 |
+
if ( isset( $form_data['yop-poll_deactivate_details'] ) ) {
|
1714 |
$message .= "\n\r";
|
1715 |
+
$message .= 'Message: ' . sanitize_text_field( implode( '', $form_data['yop-poll_deactivate_details'] ) );
|
1716 |
} else {
|
1717 |
$message = 'No extra details given';
|
1718 |
}
|
1719 |
+
$email_headers = array(
|
1720 |
'From: Wordpress Deactivation Notice <deactivate@yop-poll.com>',
|
1721 |
'Content-Type: text/plain'
|
1722 |
);
|
admin/assets/css/{admin-6.3.3.css → admin-6.3.4.css}
RENAMED
File without changes
|
admin/assets/js/{admin-6.3.3.min.js → admin-6.3.4.min.js}
RENAMED
@@ -1 +1 @@
|
|
1 |
-
if(!function(t){"function"==typeof define&&define.amd?define(["jquery","jquery-ui"],t):t(jQuery)}(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.3"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(t){return extendRemove(this._defaults,t||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(t){inlineSettings[attrName]=attrValue}}for(i in overrides={beforeShow:function(t,e){if($.isFunction(tp_inst._defaults.evnts.beforeShow))return tp_inst._defaults.evnts.beforeShow.call($input[0],t,e,tp_inst)},onChangeMonthYear:function(t,e,s){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],t,e,s,tp_inst)},onClose:function(t,e){!0===tp_inst.timeDefined&&""!==$input.val()&&tp_inst._updateDateTime(e),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],t,e,tp_inst)}},overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(t){return t.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(t){return t.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&void 0===$.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(0<tzl&&"object"!=typeof timezoneList[0])for(;tzi<tzl;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),!0===tp_inst._defaults.altRedirectFocus&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),0!==tp_inst._defaults.minDate&&0!==tp_inst._defaults.minDateTime||(tp_inst._defaults.minDate=new Date),0!==tp_inst._defaults.maxDate&&0!==tp_inst._defaults.maxDateTime||(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(t){var e=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(e),this._limitMinMaxDateTime(t,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(e,t){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),t||!this._defaults.timeOnly){var s=$.datepicker._get(this.inst,"dateFormat");try{var a=parseDateTimeInternal(s,this._defaults.timeFormat,e,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!a.timeObj)return!1;$.extend(this,a.timeObj)}catch(t){return $.timepicker.log("Error parsing the date/time string: "+t+"\ndate/time string = "+e+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+s),!1}return!0}var i=$.datepicker.parseTime(this._defaults.timeFormat,e,this._defaults);return!!i&&($.extend(this,i),!0)},_afterInject:function(){var t=this.inst.settings;$.isFunction(t.afterInject)&&t.afterInject.call(this)},_injectTimePicker:function(){var t=this.inst.dpDiv,e=this.inst.settings,o=this,r="",s="",a=null,i={},n={},l=null,c=0,d=0;if(0===t.find("div.ui-timepicker-div").length&&e.showTimepicker){var u=" ui_tpicker_unit_hide",p='<div class="ui-timepicker-div'+(e.isRTL?" ui-timepicker-rtl":"")+(e.oneLine&&"select"===e.controlType?" ui-timepicker-oneLine":"")+'"><dl><dt class="ui_tpicker_time_label'+(e.showTime?"":u)+'">'+e.timeText+'</dt><dd class="ui_tpicker_time '+(e.showTime?"":u)+'"><input class="ui_tpicker_time_input" '+(e.timeInput?"":"disabled")+"/></dd>";for(c=0,d=this.units.length;c<d;c++){if(a=null!==e["show"+(s=(r=this.units[c]).substr(0,1).toUpperCase()+r.substr(1))]?e["show"+s]:this.support[r],i[r]=parseInt(e[r+"Max"]-(e[r+"Max"]-e[r+"Min"])%e["step"+s],10),n[r]=0,p+='<dt class="ui_tpicker_'+r+"_label"+(a?"":u)+'">'+e[r+"Text"]+'</dt><dd class="ui_tpicker_'+r+(a?"":u)+'"><div class="ui_tpicker_'+r+"_slider"+(a?"":u)+'"></div>',a&&0<e[r+"Grid"]){if(p+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===r)for(var h=e[r+"Min"];h<=i[r];h+=parseInt(e[r+"Grid"],10)){n[r]++;var m=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:h},e);p+='<td data-for="'+r+'">'+m+"</td>"}else for(var f=e[r+"Min"];f<=i[r];f+=parseInt(e[r+"Grid"],10))n[r]++,p+='<td data-for="'+r+'">'+(f<10?"0":"")+f+"</td>";p+="</tr></table></div>"}p+="</dd>"}var g=null!==e.showTimezone?e.showTimezone:this.support.timezone;p+='<dt class="ui_tpicker_timezone_label'+(g?"":u)+'">'+e.timezoneText+"</dt>",p+='<dd class="ui_tpicker_timezone'+(g?"":u)+'"></dd>';var v=$(p+="</dl></div>");for(!0===e.timeOnly&&(v.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+e.timeOnlyTitle+"</div></div>"),t.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),c=0,d=o.units.length;c<d;c++)a=null!==e["show"+(s=(r=o.units[c]).substr(0,1).toUpperCase()+r.substr(1))]?e["show"+s]:this.support[r],o[r+"_slider"]=o.control.create(o,v.find(".ui_tpicker_"+r+"_slider"),r,o[r],e[r+"Min"],i[r],e["step"+s]),a&&0<e[r+"Grid"]&&(l=100*n[r]*e[r+"Grid"]/(i[r]-e[r+"Min"]),v.find(".ui_tpicker_"+r+" table").css({width:l+"%",marginLeft:e.isRTL?"0":l/(-2*n[r])+"%",marginRight:e.isRTL?l/(-2*n[r])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(t){var e=$(this),s=e.html(),a=parseInt(s.replace(/[^0-9]/g),10),i=s.replace(/[^apm]/gi),n=e.data("for");"hour"===n&&(-1!==i.indexOf("p")&&a<12?a+=12:-1!==i.indexOf("a")&&12===a&&(a=0)),o.control.value(o,o[n+"_slider"],r,a),o._onTimeChange(),o._onSelectHandler()}).css({cursor:"pointer",width:100/n[r]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=v.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(e.timezoneList,function(t,e){return $("<option />").val("object"==typeof t?t.value:t).text("object"==typeof t?t.label:t)})),void 0!==this.timezone&&null!==this.timezone&&""!==this.timezone)-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset()===this.timezone?selectLocalTimezone(o):this.timezone_select.val(this.timezone);else void 0!==this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(e.timezone):selectLocalTimezone(o);this.timezone_select.change(function(){o._onTimeChange(),o._onSelectHandler(),o._afterInject()});var b=t.find(".ui-datepicker-buttonpane");if(b.length?b.before(v):t.append(v),this.$timeObj=v.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var t=o.inst.settings.timeFormat,e=$.datepicker.parseTime(t,this.value),s=new Date;e?(s.setHours(e.hour),s.setMinutes(e.minute),s.setSeconds(e.second),$.datepicker._setTime(o.inst,s)):(this.value=o.formattedTime,this.blur())}),null!==this.inst){var y=this.timeDefined;this._onTimeChange(),this.timeDefined=y}if(this._defaults.addSliderAccess){var w=this._defaults.sliderAccessArgs,k=this._defaults.isRTL;w.isRTL=k,setTimeout(function(){if(0===v.find(".ui-slider-access").length){v.find(".ui-slider:visible").sliderAccess(w);var o=v.find(".ui-slider-access:eq(0)").outerWidth(!0);o&&v.find("table:visible").each(function(){var t=$(this),e=t.outerWidth(),s=t.css(k?"marginRight":"marginLeft").toString().replace("%",""),a=e-o,i=s*a/e+"%",n={width:a,marginRight:0,marginLeft:0};n[k?"marginRight":"marginLeft"]=i,t.css(n)})}},10)}o._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(t,e){var s=this._defaults,a=new Date(t.selectedYear,t.selectedMonth,t.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(t,"minDateTime")&&void 0!==$.datepicker._get(t,"minDateTime")&&a){var i=$.datepicker._get(t,"minDateTime"),n=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0,0);null!==this.hourMinOriginal&&null!==this.minuteMinOriginal&&null!==this.secondMinOriginal&&null!==this.millisecMinOriginal&&null!==this.microsecMinOriginal||(this.hourMinOriginal=s.hourMin,this.minuteMinOriginal=s.minuteMin,this.secondMinOriginal=s.secondMin,this.millisecMinOriginal=s.millisecMin,this.microsecMinOriginal=s.microsecMin),t.settings.timeOnly||n.getTime()===a.getTime()?(this._defaults.hourMin=i.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=i.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=i.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=i.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=i.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(t,"maxDateTime")&&void 0!==$.datepicker._get(t,"maxDateTime")&&a){var o=$.datepicker._get(t,"maxDateTime"),r=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0);null!==this.hourMaxOriginal&&null!==this.minuteMaxOriginal&&null!==this.secondMaxOriginal&&null!==this.millisecMaxOriginal||(this.hourMaxOriginal=s.hourMax,this.minuteMaxOriginal=s.minuteMax,this.secondMaxOriginal=s.secondMax,this.millisecMaxOriginal=s.millisecMax,this.microsecMaxOriginal=s.microsecMax),t.settings.timeOnly||r.getTime()===a.getTime()?(this._defaults.hourMax=o.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=o.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=o.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=o.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=o.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==t.settings.minTime){var l=new Date("01/01/1970 "+t.settings.minTime);this.hour<l.getHours()?(this.hour=this._defaults.hourMin=l.getHours(),this.minute=this._defaults.minuteMin=l.getMinutes()):this.hour===l.getHours()&&this.minute<l.getMinutes()?this.minute=this._defaults.minuteMin=l.getMinutes():this._defaults.hourMin<l.getHours()?(this._defaults.hourMin=l.getHours(),this._defaults.minuteMin=l.getMinutes()):this._defaults.hourMin===l.getHours()===this.hour&&this._defaults.minuteMin<l.getMinutes()?this._defaults.minuteMin=l.getMinutes():this._defaults.minuteMin=0}if(null!==t.settings.maxTime){var c=new Date("01/01/1970 "+t.settings.maxTime);this.hour>c.getHours()?(this.hour=this._defaults.hourMax=c.getHours(),this.minute=this._defaults.minuteMax=c.getMinutes()):this.hour===c.getHours()&&this.minute>c.getMinutes()?this.minute=this._defaults.minuteMax=c.getMinutes():this._defaults.hourMax>c.getHours()?(this._defaults.hourMax=c.getHours(),this._defaults.minuteMax=c.getMinutes()):this._defaults.hourMax===c.getHours()===this.hour&&this._defaults.minuteMax>c.getMinutes()?this._defaults.minuteMax=c.getMinutes():this._defaults.minuteMax=59}if(void 0!==e&&!0===e){var d=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),u=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),p=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),h=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),m=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:d,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:u,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:p,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:h,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:m,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var t=!!this.hour_slider&&this.control.value(this,this.hour_slider,"hour"),e=!!this.minute_slider&&this.control.value(this,this.minute_slider,"minute"),s=!!this.second_slider&&this.control.value(this,this.second_slider,"second"),a=!!this.millisec_slider&&this.control.value(this,this.millisec_slider,"millisec"),i=!!this.microsec_slider&&this.control.value(this,this.microsec_slider,"microsec"),n=!!this.timezone_select&&this.timezone_select.val(),o=this._defaults,r=o.pickerTimeFormat||o.timeFormat,l=o.pickerTimeSuffix||o.timeSuffix;"object"==typeof t&&(t=!1),"object"==typeof e&&(e=!1),"object"==typeof s&&(s=!1),"object"==typeof a&&(a=!1),"object"==typeof i&&(i=!1),"object"==typeof n&&(n=!1),!1!==t&&(t=parseInt(t,10)),!1!==e&&(e=parseInt(e,10)),!1!==s&&(s=parseInt(s,10)),!1!==a&&(a=parseInt(a,10)),!1!==i&&(i=parseInt(i,10)),!1!==n&&(n=n.toString());var c=o[t<12?"amNames":"pmNames"][0],d=t!==parseInt(this.hour,10)||e!==parseInt(this.minute,10)||s!==parseInt(this.second,10)||a!==parseInt(this.millisec,10)||i!==parseInt(this.microsec,10)||0<this.ampm.length&&t<12!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&n!==this.timezone.toString();if(d&&(!1!==t&&(this.hour=t),!1!==e&&(this.minute=e),!1!==s&&(this.second=s),!1!==a&&(this.millisec=a),!1!==i&&(this.microsec=i),!1!==n&&(this.timezone=n),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=c),this.formattedTime=$.datepicker.formatTime(o.timeFormat,this,o),this.$timeObj&&(r===o.timeFormat?this.$timeObj.val(this.formattedTime+l):this.$timeObj.val($.datepicker.formatTime(r,this,o)+l),this.$timeObj[0].setSelectionRange)){var u=this.$timeObj[0].selectionStart,p=this.$timeObj[0].selectionEnd;this.$timeObj[0].setSelectionRange(u,p)}this.timeDefined=!0,d&&this._updateDateTime()}},_onSelectHandler:function(){var t=this._defaults.onSelect||this.inst.settings.onSelect,e=this.$input?this.$input[0]:null;t&&e&&t.apply(e,[this.formattedDateTime,this])},_updateDateTime:function(t){var e=0<(t=this.inst||t).currentYear?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(t.selectedYear,t.selectedMonth,t.selectedDay),s=$.datepicker._daylightSavingAdjust(e),a=$.datepicker._get(t,"dateFormat"),i=$.datepicker._getFormatConfig(t),n=null!==s&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(a,null===s?new Date:s,i);var o=this.formattedDate;if(""===t.lastVal&&(t.currentYear=t.selectedYear,t.currentMonth=t.selectedMonth,t.currentDay=t.selectedDay),!0===this._defaults.timeOnly&&!1===this._defaults.timeOnlyShowDate?o=this.formattedTime:(!0!==this._defaults.timeOnly&&(this._defaults.alwaysSetTime||n)||!0===this._defaults.timeOnly&&!0===this._defaults.timeOnlyShowDate)&&(o+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=o,this._defaults.showTimepicker)if(this.$altInput&&!1===this._defaults.timeOnly&&!0===this._defaults.altFieldTimeOnly)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(o);var r="",l=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,c=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(r=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===s?new Date:s,i):this.formattedDate)&&(r+=l),null!==this._defaults.altTimeFormat?r+=$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+c:r+=this.formattedTime+c,this.$altInput.val(r)}else this.$input.val(o);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var t=$.datepicker._getInst(this.$input.get(0)),e=$.datepicker._get(t,"timepicker");if(e&&e._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(t){$.timepicker.log(t)}}},_controls:{slider:{create:function(s,t,a,e,i,n,o){var r=s._defaults.isRTL;return t.prop("slide",null).slider({orientation:"horizontal",value:r?-1*e:e,min:r?-1*n:i,max:r?-1*i:n,step:o,slide:function(t,e){s.control.value(s,$(this),a,r?-1*e.value:e.value),s._onTimeChange()},stop:function(t,e){s._onSelectHandler()}})},options:function(t,e,s,a,i){if(t._defaults.isRTL){if("string"==typeof a)return"min"===a||"max"===a?void 0!==i?e.slider(a,-1*i):Math.abs(e.slider(a)):e.slider(a);var n=a.min,o=a.max;return a.min=a.max=null,void 0!==n&&(a.max=-1*n),void 0!==o&&(a.min=-1*o),e.slider(a)}return"string"==typeof a&&void 0!==i?e.slider(a,i):e.slider(a)},value:function(t,e,s,a){return t._defaults.isRTL?void 0!==a?e.slider("value",-1*a):Math.abs(e.slider("value")):void 0!==a?e.slider("value",a):e.slider("value")}},select:{create:function(e,t,s,a,i,n,o){for(var r='<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="'+s+'" data-min="'+i+'" data-max="'+n+'" data-step="'+o+'">',l=e._defaults.pickerTimeFormat||e._defaults.timeFormat,c=i;c<=n;c+=o)r+='<option value="'+c+'"'+(c===a?" selected":"")+">",r+="hour"===s?$.datepicker.formatTime($.trim(l.replace(/[^ht ]/gi,"")),{hour:c},e._defaults):"millisec"===s||"microsec"===s||10<=c?c:"0"+c.toString(),r+="</option>";return r+="</select>",t.children("select").remove(),$(r).appendTo(t).change(function(t){e._onTimeChange(),e._onSelectHandler(),e._afterInject()}),t},options:function(t,e,s,a,i){var n={},o=e.children("select");if("string"==typeof a){if(void 0===i)return o.data(a);n[a]=i}else n=a;return t.control.create(t,e,o.data("unit"),o.val(),0<=n.min?n.min:o.data("min"),n.max||o.data("max"),n.step||o.data("step"))},value:function(t,e,s,a){var i=e.children("select");return void 0!==a?i.val(a):i.val()}}}}),$.fn.extend({timepicker:function(t){t=t||{};var e=Array.prototype.slice.call(arguments);return"object"==typeof t&&(e[0]=$.extend(t,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),e)})},datetimepicker:function(e){var s=arguments;return"string"==typeof(e=e||{})?"getDate"===e||"option"===e&&2===s.length&&"string"==typeof s[1]?$.fn.datepicker.apply($(this[0]),s):this.each(function(){var t=$(this);t.datepicker.apply(t,s)}):this.each(function(){var t=$(this);t.datepicker($.timepicker._newInst(t,e)._defaults)})}}),$.datepicker.parseDateTime=function(t,e,s,a,i){var n=parseDateTimeInternal(t,e,s,a,i);if(n.timeObj){var o=n.timeObj;n.date.setHours(o.hour,o.minute,o.second,o.millisec),n.date.setMicroseconds(o.microsec)}return n.date},$.datepicker.parseTime=function(t,e,s){function i(t,e,s){var a,i="^"+t.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){var e=t.length;switch(t.charAt(0).toLowerCase()){case"h":case"m":case"s":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"l":case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return function(t,e){var s=[];return t&&$.merge(s,t),e&&$.merge(s,e),"("+(s=$.map(s,function(t){return t.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")})).join("|")+")?"}(s.amNames,s.pmNames);default:return"("+t.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(t){return"\\"+t})+")?"}}).replace(/\s/g,"\\s?")+s.timeSuffix+"$",n=function(t){var e=t.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),s={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(e)for(var a=0;a<e.length;a++)-1===s[e[a].toString().charAt(0)]&&(s[e[a].toString().charAt(0)]=a+1);return s}(t),o="",r={hour:0,minute:0,second:0,millisec:0,microsec:0};return!!(a=e.match(new RegExp(i,"i")))&&(-1!==n.t&&(void 0===a[n.t]||0===a[n.t].length?(o="",r.ampm=""):(o=-1!==$.inArray(a[n.t].toUpperCase(),$.map(s.amNames,function(t,e){return t.toUpperCase()}))?"AM":"PM",r.ampm=s["AM"===o?"amNames":"pmNames"][0])),-1!==n.h&&("AM"===o&&"12"===a[n.h]?r.hour=0:"PM"===o&&"12"!==a[n.h]?r.hour=parseInt(a[n.h],10)+12:r.hour=Number(a[n.h])),-1!==n.m&&(r.minute=Number(a[n.m])),-1!==n.s&&(r.second=Number(a[n.s])),-1!==n.l&&(r.millisec=Number(a[n.l])),-1!==n.c&&(r.microsec=Number(a[n.c])),-1!==n.z&&void 0!==a[n.z]&&(r.timezone=$.timepicker.timezoneOffsetNumber(a[n.z])),r)}var a=extendRemove(extendRemove({},$.timepicker._defaults),s||{});t.replace(/\'.*?\'/g,"").indexOf("Z");return"function"==typeof a.parse?a.parse(t,e,a):"loose"===a.parse?function(e,s,a){try{var t=new Date("2012-01-01 "+s);if(isNaN(t.getTime())&&(t=new Date("2012-01-01T"+s),isNaN(t.getTime())&&(t=new Date("01/01/2012 "+s),isNaN(t.getTime()))))throw"Unable to parse time with native Date: "+s;return{hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisec:t.getMilliseconds(),microsec:t.getMicroseconds(),timezone:-1*t.getTimezoneOffset()}}catch(t){try{return i(e,s,a)}catch(t){$.timepicker.log("Unable to parse \ntimeString: "+s+"\ntimeFormat: "+e)}}return!1}(t,e,a):i(t,e,a)},$.datepicker.formatTime=function(t,e,s){s=s||{},s=$.extend({},$.timepicker._defaults,s),e=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},e);var a=t,i=s.amNames[0],n=parseInt(e.hour,10);return 11<n&&(i=s.pmNames[0]),a=a.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){switch(t){case"HH":return("0"+n).slice(-2);case"H":return n;case"hh":return("0"+convert24to12(n)).slice(-2);case"h":return convert24to12(n);case"mm":return("0"+e.minute).slice(-2);case"m":return e.minute;case"ss":return("0"+e.second).slice(-2);case"s":return e.second;case"l":return("00"+e.millisec).slice(-3);case"c":return("00"+e.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===e.timezone?s.timezone:e.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===e.timezone?s.timezone:e.timezone,!0);case"T":return i.charAt(0).toUpperCase();case"TT":return i.toUpperCase();case"t":return i.charAt(0).toLowerCase();case"tt":return i.toLowerCase();default:return t.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(t,e){var s,a=this._getInst($(t)[0]),i=this._get(a,"timepicker");i&&a.settings.showTimepicker?(i._limitMinMaxDateTime(a,!0),s=a.inline,a.inline=a.stay_open=!0,this._base_selectDate(t,e),a.inline=s,a.stay_open=!1,this._notifyChange(a),this._updateDatepicker(a)):this._base_selectDate(t,e)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(t){var e=t.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==t&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==e||"boolean"==typeof t.stay_open&&!1!==t.stay_open)){this._base_updateDatepicker(t);var s=this._get(t,"timepicker");s&&s._addTimePicker(t)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(t){var e=$.datepicker._getInst(t.target),s=$.datepicker._get(e,"timepicker");if(s&&$.datepicker._get(e,"constrainInput")){var a=s.support.ampm,i=null!==s._defaults.showTimezone?s._defaults.showTimezone:s.support.timezone,n=$.datepicker._possibleChars($.datepicker._get(e,"dateFormat")),o=s._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,a?"APM":"").replace(/Tt/g,a?"AaPpMm":"").replace(/tT/g,a?"AaPpMm":"").replace(/T/g,a?"AP":"").replace(/tt/g,a?"apm":"").replace(/t/g,a?"ap":"")+" "+s._defaults.separator+s._defaults.timeSuffix+(i?s._defaults.timezoneList.join(""):"")+s._defaults.amNames.join("")+s._defaults.pmNames.join("")+n,r=String.fromCharCode(void 0===t.charCode?t.keyCode:t.charCode);return t.ctrlKey||r<" "||!n||-1<o.indexOf(r)}return $.datepicker._base_doKeyPress(t)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(t){var e=this._get(t,"timepicker");if(e){var s=e._defaults.altField;if(s){e._defaults.altFormat||e._defaults.dateFormat;var a=this._getDate(t),i=$.datepicker._getFormatConfig(t),n="",o=e._defaults.altSeparator?e._defaults.altSeparator:e._defaults.separator,r=e._defaults.altTimeSuffix?e._defaults.altTimeSuffix:e._defaults.timeSuffix,l=null!==e._defaults.altTimeFormat?e._defaults.altTimeFormat:e._defaults.timeFormat;n+=$.datepicker.formatTime(l,e,e._defaults)+r,e._defaults.timeOnly||e._defaults.altFieldTimeOnly||null===a||(n=e._defaults.altFormat?$.datepicker.formatDate(e._defaults.altFormat,a,i)+o+n:e.formattedDate+o+n),$(s).val(t.input.val()?n:"")}}else $.datepicker._base_updateAlternate(t)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(t){var e=$.datepicker._getInst(t.target),s=$.datepicker._get(e,"timepicker");if(s&&s._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(t){$.timepicker.log(t)}return $.datepicker._base_doKeyUp(t)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(t){var e=this._getInst($(t)[0]);this._base_gotoToday(t);var s=this._get(e,"timepicker");if(s){var a=$.timepicker.timezoneOffsetNumber(s.timezone),i=new Date;i.setMinutes(i.getMinutes()+i.getTimezoneOffset()+parseInt(a,10)),this._setTime(e,i),this._setDate(e,i),s._onSelectHandler()}},$.datepicker._disableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var s=this._get(e,"timepicker");$(t).datepicker("getDate"),s&&(e.settings.showTimepicker=!1,s._defaults.showTimepicker=!1,s._updateDateTime(e))}},$.datepicker._enableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var s=this._get(e,"timepicker");$(t).datepicker("getDate"),s&&(e.settings.showTimepicker=!0,s._defaults.showTimepicker=!0,s._addTimePicker(e),s._updateDateTime(e))}},$.datepicker._setTime=function(t,e){var s=this._get(t,"timepicker");if(s){var a=s._defaults;s.hour=e?e.getHours():a.hour,s.minute=e?e.getMinutes():a.minute,s.second=e?e.getSeconds():a.second,s.millisec=e?e.getMilliseconds():a.millisec,s.microsec=e?e.getMicroseconds():a.microsec,s._limitMinMaxDateTime(t,!0),s._onTimeChange(),s._updateDateTime(t)}},$.datepicker._setTimeDatepicker=function(t,e,s){var a=this._getInst(t);if(a){var i,n=this._get(a,"timepicker");if(n)this._setDateFromField(a),e&&("string"==typeof e?(n._parseTime(e,s),(i=new Date).setHours(n.hour,n.minute,n.second,n.millisec),i.setMicroseconds(n.microsec)):(i=new Date(e.getTime())).setMicroseconds(e.getMicroseconds()),"Invalid Date"===i.toString()&&(i=void 0),this._setTime(a,i))}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(t,e){var s=this._getInst(t),a=e;if(s){"string"==typeof e&&((a=new Date(e)).getTime()||(this._base_setDateDatepicker.apply(this,arguments),a=$(t).datepicker("getDate")));var i,n=this._get(s,"timepicker");a instanceof Date?(i=new Date(a.getTime())).setMicroseconds(a.getMicroseconds()):i=a,n&&i&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=-1*i.getTimezoneOffset()),a=$.timepicker.timezoneAdjust(a,$.timepicker.timezoneOffsetString(-a.getTimezoneOffset()),n.timezone),i=$.timepicker.timezoneAdjust(i,$.timepicker.timezoneOffsetString(-i.getTimezoneOffset()),n.timezone)),this._updateDatepicker(s),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(t,i,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(t,e){var s=this._getInst(t);if(s){var a=this._get(s,"timepicker");if(a){void 0===s.lastVal&&this._setDateFromField(s,e);var i=this._getDate(s),n=null;return n=a.$altInput&&a._defaults.altFieldTimeOnly?a.$input.val()+" "+a.$altInput.val():"INPUT"!==a.$input.get(0).tagName&&a.$altInput?a.$altInput.val():a.$input.val(),i&&a._parseTime(n,!s.settings.timeOnly)&&(i.setHours(a.hour,a.minute,a.second,a.millisec),i.setMicroseconds(a.microsec),null!=a.timezone&&(a.support.timezone||null!==a._defaults.timezone||(a.timezone=-1*i.getTimezoneOffset()),i=$.timepicker.timezoneAdjust(i,a.timezone,$.timepicker.timezoneOffsetString(-i.getTimezoneOffset())))),i}return this._base_getDateDatepicker(t,e)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(e,s,a){var i;try{i=this._base_parseDate(e,s,a)}catch(t){if(!(0<=t.indexOf(":")))throw t;i=this._base_parseDate(e,s.substring(0,s.length-(t.length-t.indexOf(":")-2)),a),$.timepicker.log("Error parsing the date string: "+t+"\ndate string = "+s+"\ndate format = "+e)}return i},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(t,e,s,a){var i=this._get(t,"timepicker");return i?(i._updateDateTime(t),i.$input.val()):this._base_formatDate(t)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(t,e,s){var a,i=this._getInst(t);if(!i)return null;var n=this._get(i,"timepicker");if(n){var o,r,l,c,d=null,u=null,p=null,h=n._defaults.evnts,m={};if("string"==typeof e){if("minDate"===e||"minDateTime"===e)d=s;else if("maxDate"===e||"maxDateTime"===e)u=s;else if("onSelect"===e)p=s;else if(h.hasOwnProperty(e)){if(void 0===s)return h[e];m[e]=s,a={}}}else if("object"==typeof e)for(o in e.minDate?d=e.minDate:e.minDateTime?d=e.minDateTime:e.maxDate?u=e.maxDate:e.maxDateTime&&(u=e.maxDateTime),h)h.hasOwnProperty(o)&&e[o]&&(m[o]=e[o]);for(o in m)m.hasOwnProperty(o)&&(h[o]=m[o],delete(a=a||$.extend({},e))[o]);if(a&&isEmptyObject(a))return;if(d?(d=0===d?new Date:new Date(d),n._defaults.minDate=d,n._defaults.minDateTime=d):u?(u=0===u?new Date:new Date(u),n._defaults.maxDate=u,n._defaults.maxDateTime=u):p&&(n._defaults.onSelect=p),d||u)return l=(c=$(t)).datetimepicker("getDate"),r=this._base_optionDatepicker.call($.datepicker,t,a||e,s),c.datetimepicker("setDate",l),r}return void 0===s?this._base_optionDatepicker.call($.datepicker,t,e):this._base_optionDatepicker.call($.datepicker,t,a||e,s)};var isEmptyObject=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0},extendRemove=function(t,e){for(var s in $.extend(t,e),e)null!==e[s]&&void 0!==e[s]||(t[s]=e[s]);return t},detectSupport=function(t){function e(t,e){return-1!==t.indexOf(e)}var s=t.replace(/'.*?'/g,"").toLowerCase();return{hour:e(s,"h"),minute:e(s,"m"),second:e(s,"s"),millisec:e(s,"l"),microsec:e(s,"c"),timezone:e(s,"z"),ampm:e(s,"t")&&e(t,"h"),iso8601:e(t,"Z")}},convert24to12=function(t){return 0===(t%=12)&&(t=12),String(t)},computeEffectiveSetting=function(t,e){return t&&t[e]?t[e]:$.timepicker._defaults[e]},splitDateTime=function(t,e){var s=computeEffectiveSetting(e,"separator"),a=computeEffectiveSetting(e,"timeFormat").split(s).length,i=t.split(s),n=i.length;return 1<n?{dateString:i.splice(0,n-a).join(s),timeString:i.splice(0,a).join(s)}:{dateString:t,timeString:""}},parseDateTimeInternal=function(t,e,s,a,i){var n,o,r;if(o=splitDateTime(s,i),n=$.datepicker._base_parseDate(t,o.dateString,a),""===o.timeString)return{date:n};if(!(r=$.datepicker.parseTime(e,o.timeString,i)))throw"Wrong time format";return{date:n,timeObj:r}},selectLocalTimezone=function(t,e){if(t&&t.timezone_select){var s=e||new Date;t.timezone_select.val(-s.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(t,e){if(isNaN(t)||840<t||t<-720)return t;var s=t%60,a=(t-s)/60,i=e?":":"",n=(0<=t?"+":"-")+("0"+Math.abs(a)).slice(-2)+i+("0"+Math.abs(s)).slice(-2);return"+00:00"==n?"Z":n},$.timepicker.timezoneOffsetNumber=function(t){var e=t.toString().replace(":","");return"Z"===e.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(e)?("-"===e.substr(0,1)?-1:1)*(60*parseInt(e.substr(1,2),10)+parseInt(e.substr(3,2),10)):parseInt(t,10)},$.timepicker.timezoneAdjust=function(t,e,s){var a=$.timepicker.timezoneOffsetNumber(e),i=$.timepicker.timezoneOffsetNumber(s);return isNaN(i)||t.setMinutes(t.getMinutes()+-a- -i),t},$.timepicker.timeRange=function(t,e,s){return $.timepicker.handleRange("timepicker",t,e,s)},$.timepicker.datetimeRange=function(t,e,s){$.timepicker.handleRange("datetimepicker",t,e,s)},$.timepicker.dateRange=function(t,e,s){$.timepicker.handleRange("datepicker",t,e,s)},$.timepicker.handleRange=function(r,l,c,d){d=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},d);var t=!1;function s(t,e){var s=l[r]("getDate"),a=c[r]("getDate"),i=t[r]("getDate");if(null!==s){var n=new Date(s.getTime()),o=new Date(s.getTime());n.setMilliseconds(n.getMilliseconds()+d.minInterval),o.setMilliseconds(o.getMilliseconds()+d.maxInterval),0<d.minInterval&&a<n?c[r]("setDate",n):0<d.maxInterval&&o<a?c[r]("setDate",o):a<s&&e[r]("setDate",i)}}function e(t,e,s){if(t.val()){var a=t[r].call(t,"getDate");null!==a&&0<d.minInterval&&("minDate"===s&&a.setMilliseconds(a.getMilliseconds()+d.minInterval),"maxDate"===s&&a.setMilliseconds(a.getMilliseconds()-d.minInterval)),a.getTime&&e[r].call(e,"option",s,a)}}return"timepicker"===r&&(t=!0,r="datetimepicker"),$.fn[r].call(l,$.extend({timeOnly:t,onClose:function(t,e){s($(this),c)},onSelect:function(t){e($(this),c,"minDate")}},d,d.start)),$.fn[r].call(c,$.extend({timeOnly:t,onClose:function(t,e){s($(this),l)},onSelect:function(t){e($(this),l,"maxDate")}},d,d.end)),s(l,c),e(l,c,"minDate"),e(c,l,"maxDate"),$([l.get(0),c.get(0)])},$.timepicker.log=function(){window.console&&window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(t){return this.setMilliseconds(this.getMilliseconds()+Math.floor(t/1e3)),this.microseconds=t%1e3,this}),$.timepicker.version="1.6.3"}}),"undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");function date(t,e){function s(t,e){return n[t]?n[t]():e}function a(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}var i,n,o=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"],r=/\\?(.?)/gi;n={d:function(){return a(n.j(),2)},D:function(){return n.l().slice(0,3)},j:function(){return i.getDate()},l:function(){return o[n.w()]+"day"},N:function(){return n.w()||7},S:function(){var t=n.j(),e=t%10;return e<=3&&1===parseInt(t%100/10,10)&&(e=0),["st","nd","rd"][e-1]||"th"},w:function(){return i.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/864e5)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),e=new Date(t.getFullYear(),0,4);return a(1+Math.round((t-e)/864e5/7),2)},F:function(){return o[6+n.n()]},m:function(){return a(n.n(),2)},M:function(){return n.F().slice(0,3)},n:function(){return i.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4==0&t%100!=0|t%400==0},o:function(){var t=n.n(),e=n.W();return n.Y()+(12===t&&e<9?1:1===t&&9<e?-1:0)},Y:function(){return i.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return 11<i.getHours()?"pm":"am"},A:function(){return n.a().toUpperCase()},B:function(){var t=3600*i.getUTCHours(),e=60*i.getUTCMinutes(),s=i.getUTCSeconds();return a(Math.floor((t+e+s+3600)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return i.getHours()},h:function(){return a(n.g(),2)},H:function(){return a(n.G(),2)},i:function(){return a(i.getMinutes(),2)},s:function(){return a(i.getSeconds(),2)},u:function(){return a(1e3*i.getMilliseconds(),6)},e:function(){throw new Error("Not supported (see source code of date() for timezone on how to add support)")},I:function(){return new Date(n.Y(),0)-Date.UTC(n.Y(),0)!=new Date(n.Y(),6)-Date.UTC(n.Y(),6)?1:0},O:function(){var t=i.getTimezoneOffset(),e=Math.abs(t);return(0<t?"-":"+")+a(100*Math.floor(e/60)+e%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-i.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(r,s)},r:function(){return"D, d M Y H:i:s O".replace(r,s)},U:function(){return i/1e3|0}};var l,c;return l=t,i=void 0===(c=e)?new Date:c instanceof Date?new Date(c):new Date(1e3*c),l.replace(r,s)}function strtotime(t,e){var s,a,i,n,o,r,l,c,d,u;if(!t)return!1;t=t.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var p=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((a=t.match(p))&&a[2]===a[4])if(1901<a[1])switch(a[2]){case"-":return!(12<a[3]||31<a[5])&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case".":return!1;case"/":return!(12<a[3]||31<a[5])&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else if(1901<a[5])switch(a[2]){case"-":case".":return!(12<a[3]||31<a[1])&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case"/":return!(12<a[1]||31<a[3])&&new Date(a[5],parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else switch(a[2]){case"-":return!(12<a[3]||31<a[5]||a[1]<70&&38<a[1])&&(n=0<=a[1]&&a[1]<=38?+a[1]+2e3:a[1],new Date(n,parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case".":return 70<=a[5]?!(12<a[3]||31<a[1])&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3:a[5]<60&&!a[6]&&(!(23<a[1]||59<a[3])&&(i=new Date,new Date(i.getFullYear(),i.getMonth(),i.getDate(),a[1]||0,a[3]||0,a[5]||0,a[9]||0)/1e3));case"/":return!(12<a[1]||31<a[3]||a[5]<70&&38<a[5])&&(n=0<=a[5]&&a[5]<=38?+a[5]+2e3:a[5],new Date(n,parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case":":return!(23<a[1]||59<a[3]||59<a[5])&&(i=new Date,new Date(i.getFullYear(),i.getMonth(),i.getDate(),a[1]||0,a[3]||0,a[5]||0)/1e3)}if("now"===t)return null===e||isNaN(e)?(new Date).getTime()/1e3|0:0|e;if(!isNaN(s=Date.parse(t)))return s/1e3|0;if(p=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(a=t.match(p))&&("z"===a[4]?a[4]="Z":a[4].match(/^([\+-][0-9]{2})$/)&&(a[4]=a[4]+":00"),!isNaN(s=Date.parse(a[1]+"T"+a[2]+a[4]))))return s/1e3|0;function h(t){var e=t.split(" "),s=e[0],a=e[1].substring(0,3),i=/\d+/.test(s),n=("last"===s?-1:1)*("ago"===e[2]?-1:1);if(i&&(n*=parseInt(s,10)),l.hasOwnProperty(a)&&!e[1].match(/^mon(day|\.)?$/i))return o["set"+l[a]](o["get"+l[a]]()+n);if("wee"===a)return o.setDate(o.getDate()+7*n);if("next"===s||"last"===s)!function(t,e,s){var a,i=r[e];void 0!==i&&(0===(a=i-o.getDay())?a=7*s:0<a&&"last"===t?a-=7:a<0&&"next"===t&&(a+=7),o.setDate(o.getDate()+a))}(s,a,n);else if(!i)return!1;return!0}if(o=e?new Date(1e3*e):new Date,r={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},l={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},"([+-]?\\d+\\s"+(d="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)")+"|(last|next)\\s"+d+")(\\sago)?",!(a=t.match(new RegExp("([+-]?\\d+\\s(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)|(last|next)\\s(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?))(\\sago)?","gi"))))return!1;for(u=0,c=a.length;u<c;u++)if(!h(a[u]))return!1;return o.getTime()/1e3}function fallbackMessage(t){var e="cut"===t?"X":"C";return/iPhone|iPad/i.test(navigator.userAgent)?objectL10n.yopPollParams.copyToClipboardError.noSupport:/Mac/i.test(navigator.userAgent)?objectL10n.yopPollParams.copyToClipboardError.press+" ⌘-"+e+objectL10n.yopPollParams.copyToClipboardError.copy:objectL10n.yopPollParams.copyToClipboardError.press+" Ctrl-"+e+objectL10n.yopPollParams.copyToClipboardError.copy}if(!function(a){"use strict";a.fn.emulateTransitionEnd=function(t){var e=!1,s=this;a(this).one(a.support.transition.end,function(){e=!0});return setTimeout(function(){e||a(s).trigger(a.support.transition.end)},t),this},a(function(){a.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var s in e)if(void 0!==t.style[s])return{end:e[s]}}()})}(jQuery),function(n){"use strict";function a(t){n(t).on("click",e,this.close)}var e='[data-dismiss="alert"]';a.prototype.close=function(t){var e=n(this),s=e.attr("data-target");s=s||(s=e.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,"");var a=n(s);function i(){a.trigger("closed.bs.alert").remove()}t&&t.preventDefault(),a.length||(a=e.hasClass("alert")?e:e.parent()),a.trigger(t=n.Event("close.bs.alert")),t.isDefaultPrevented()||(a.removeClass("in"),n.support.transition&&a.hasClass("fade")?a.one(n.support.transition.end,i).emulateTransitionEnd(150):i())};var t=n.fn.alert;n.fn.alert=function(s){return this.each(function(){var t=n(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof s&&e[s].call(t)})},n.fn.alert.Constructor=a,n.fn.alert.noConflict=function(){return n.fn.alert=t,this},n(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(i){"use strict";var n=function(t,e){this.$element=i(t),this.options=i.extend({},n.DEFAULTS,e)};n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",s=this.$element,a=s.is("input")?"val":"html",i=s.data();t+="Text",i.resetText||s.data("resetText",s[a]()),s[a](i[t]||this.options[t]),setTimeout(function(){"loadingText"==t?s.addClass(e).attr(e,e):s.removeClass(e).removeAttr(e)},0)},n.prototype.toggle=function(){var t=this.$element.closest('[data-toggle="buttons"]'),e=!0;if(t.length){var s=this.$element.find("input");"radio"===s.prop("type")&&(s.prop("checked")&&this.$element.hasClass("active")?e=!1:t.find(".active").removeClass("active")),e&&s.prop("checked",!this.$element.hasClass("active")).trigger("change")}e&&this.$element.toggleClass("active")};var t=i.fn.button;i.fn.button=function(a){return this.each(function(){var t=i(this),e=t.data("bs.button"),s="object"==typeof a&&a;e||t.data("bs.button",e=new n(this,s)),"toggle"==a?e.toggle():a&&e.setState(a)})},i.fn.button.Constructor=n,i.fn.button.noConflict=function(){return i.fn.button=t,this},i(document).on("click.bs.button.data-api","[data-toggle^=button]",function(t){var e=i(t.target);e.hasClass("btn")||(e=e.closest(".btn")),e.button("toggle"),t.preventDefault()})}(jQuery),function(c){"use strict";function n(t,e){this.$element=c(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",c.proxy(this.pause,this)).on("mouseleave",c.proxy(this.cycle,this))}n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},n.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(c.proxy(this.next,this),this.options.interval)),this},n.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},n.prototype.to=function(t){var e=this,s=this.getActiveIndex();if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):s==t?this.pause().cycle():this.slide(s<t?"next":"prev",c(this.$items[t]))},n.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&c.support.transition.end&&(this.$element.trigger(c.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){if(!this.sliding)return this.slide("next")},n.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},n.prototype.slide=function(t,e){var s=this.$element.find(".item.active"),a=e||s[t](),i=this.interval,n="next"==t?"left":"right",o="next"==t?"first":"last",r=this;if(!a.length){if(!this.options.wrap)return;a=this.$element.find(".item")[o]()}this.sliding=!0,i&&this.pause();var l=c.Event("slide.bs.carousel",{relatedTarget:a[0],direction:n});if(!a.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var t=c(r.$indicators.children()[r.getActiveIndex()]);t&&t.addClass("active")})),c.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(l),l.isDefaultPrevented())return;a.addClass(t),a[0].offsetWidth,s.addClass(n),a.addClass(n),s.one(c.support.transition.end,function(){a.removeClass([t,n].join(" ")).addClass("active"),s.removeClass(["active",n].join(" ")),r.sliding=!1,setTimeout(function(){r.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(l),l.isDefaultPrevented())return;s.removeClass("active"),a.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return i&&this.cycle(),this}};var t=c.fn.carousel;c.fn.carousel=function(i){return this.each(function(){var t=c(this),e=t.data("bs.carousel"),s=c.extend({},n.DEFAULTS,t.data(),"object"==typeof i&&i),a="string"==typeof i?i:s.slide;e||t.data("bs.carousel",e=new n(this,s)),"number"==typeof i?e.to(i):a?e[a]():s.interval&&e.pause().cycle()})},c.fn.carousel.Constructor=n,c.fn.carousel.noConflict=function(){return c.fn.carousel=t,this},c(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var e,s=c(this),a=c(s.attr("data-target")||(e=s.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")),i=c.extend({},a.data(),s.data()),n=s.attr("data-slide-to");n&&(i.interval=!1),a.carousel(i),(n=s.attr("data-slide-to"))&&a.data("bs.carousel").to(n),t.preventDefault()}),c(window).on("load",function(){c('[data-ride="carousel"]').each(function(){var t=c(this);t.carousel(t.data())})})}(jQuery),function(c){"use strict";var i=function(t,e){this.$element=c(t),this.options=c.extend({},i.DEFAULTS,e),this.transitioning=null,this.options.parent&&(this.$parent=c(this.options.parent)),this.options.toggle&&this.toggle()};i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t=c.Event("show.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.$parent&&this.$parent.find("> .panel > .in");if(e&&e.length){var s=e.data("bs.collapse");if(s&&s.transitioning)return;e.collapse("hide"),s||e.data("bs.collapse",null)}var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0),this.transitioning=1;var i=function(){this.$element.removeClass("collapsing").addClass("in")[a]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!c.support.transition)return i.call(this);var n=c.camelCase(["scroll",a].join("-"));this.$element.one(c.support.transition.end,c.proxy(i,this)).emulateTransitionEnd(350)[a](this.$element[0][n])}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=c.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var s=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!c.support.transition)return s.call(this);this.$element[e](0).one(c.support.transition.end,c.proxy(s,this)).emulateTransitionEnd(350)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var t=c.fn.collapse;c.fn.collapse=function(a){return this.each(function(){var t=c(this),e=t.data("bs.collapse"),s=c.extend({},i.DEFAULTS,t.data(),"object"==typeof a&&a);e||t.data("bs.collapse",e=new i(this,s)),"string"==typeof a&&e[a]()})},c.fn.collapse.Constructor=i,c.fn.collapse.noConflict=function(){return c.fn.collapse=t,this},c(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(t){var e,s=c(this),a=s.attr("data-target")||t.preventDefault()||(e=s.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,""),i=c(a),n=i.data("bs.collapse"),o=n?"toggle":s.data(),r=s.attr("data-parent"),l=r&&c(r);n&&n.transitioning||(l&&l.find('[data-toggle=collapse][data-parent="'+r+'"]').not(s).addClass("collapsed"),s[i.hasClass("in")?"addClass":"removeClass"]("collapsed")),i.collapse(o)})}(jQuery),function(o){"use strict";function a(t){o(t).on("click.bs.dropdown",this.toggle)}var r="[data-toggle=dropdown]";function i(){o(".dropdown-backdrop").remove(),o(r).each(function(t){var e=l(o(this));e.hasClass("open")&&(e.trigger(t=o.Event("hide.bs.dropdown")),t.isDefaultPrevented()||e.removeClass("open").trigger("hidden.bs.dropdown"))})}function l(t){var e=t.attr("data-target"),s=(e=e||(e=t.attr("href"))&&/#/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""))&&o(e);return s&&s.length?s:t.parent()}a.prototype.toggle=function(t){var e=o(this);if(!e.is(".disabled, :disabled")){var s=l(e),a=s.hasClass("open");if(i(),!a){if("ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&o('<div class="dropdown-backdrop"/>').insertAfter(o(this)).on("click",i),s.trigger(t=o.Event("show.bs.dropdown")),t.isDefaultPrevented())return;s.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},a.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var e=o(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var s=l(e),a=s.hasClass("open");if(!a||a&&27==t.keyCode)return 27==t.which&&s.find(r).focus(),e.click();var i=o("[role=menu] li:not(.divider):visible a",s);if(i.length){var n=i.index(i.filter(":focus"));38==t.keyCode&&0<n&&n--,40==t.keyCode&&n<i.length-1&&n++,~n||(n=0),i.eq(n).focus()}}}};var t=o.fn.dropdown;o.fn.dropdown=function(s){return this.each(function(){var t=o(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new a(this)),"string"==typeof s&&e[s].call(t)})},o.fn.dropdown.Constructor=a,o.fn.dropdown.noConflict=function(){return o.fn.dropdown=t,this},o(document).on("click.bs.dropdown.data-api",i).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,a.prototype.toggle).on("keydown.bs.dropdown.data-api",r+", [role=menu]",a.prototype.keydown)}(jQuery),function(n){"use strict";function o(t,e){this.options=e,this.$element=n(t),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)}o.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},o.prototype.toggle=function(t){return this[this.isShown?"hide":"show"](t)},o.prototype.show=function(s){var a=this,t=n.Event("show.bs.modal",{relatedTarget:s});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.backdrop(function(){var t=n.support.transition&&a.$element.hasClass("fade");a.$element.parent().length||a.$element.appendTo("#yop-main-area"),a.$element.show(),t&&a.$element[0].offsetWidth,a.$element.addClass("in").attr("aria-hidden",!1),a.enforceFocus();var e=n.Event("shown.bs.modal",{relatedTarget:s});t?a.$element.find(".modal-dialog").one(n.support.transition.end,function(){a.$element.focus().trigger(e)}).emulateTransitionEnd(300):a.$element.focus().trigger(e)}))},o.prototype.hide=function(t){t&&t.preventDefault(),t=n.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one(n.support.transition.end,n.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},o.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.focus()},this))},o.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",n.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},o.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden.bs.modal")})},o.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},o.prototype.backdrop=function(t){var e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=n.support.transition&&e;if(this.$backdrop=n('<div class="modal-backdrop '+e+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",n.proxy(function(t){t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one(n.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(n.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var t=n.fn.modal;n.fn.modal=function(a,i){return this.each(function(){var t=n(this),e=t.data("bs.modal"),s=n.extend({},o.DEFAULTS,t.data(),"object"==typeof a&&a);e||t.data("bs.modal",e=new o(this,s)),"string"==typeof a?e[a](i):s.show&&e.show(i)})},n.fn.modal.Constructor=o,n.fn.modal.noConflict=function(){return n.fn.modal=t,this},n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=n(this),s=e.attr("href"),a=n(e.attr("data-target")||s&&s.replace(/.*(?=#[^\s]+$)/,"")),i=a.data("modal")?"toggle":n.extend({remote:!/#/.test(s)&&s},a.data(),e.data());t.preventDefault(),a.modal(i,this).one("hide",function(){e.is(":visible")&&e.focus()})}),n(document).on("show.bs.modal",".modal",function(){n(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){n(document.body).removeClass("modal-open")})}(jQuery),function(f){"use strict";function i(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)}i.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},i.prototype.init=function(t,e,s){this.enabled=!0,this.type=t,this.$element=f(e),this.options=this.getOptions(s);for(var a=this.options.trigger.split(" "),i=a.length;i--;){var n=a[i];if("click"==n)this.$element.on("click."+this.type,this.options.selector,f.proxy(this.toggle,this));else if("manual"!=n){var o="hover"==n?"mouseenter":"focus",r="hover"==n?"mouseleave":"blur";this.$element.on(o+"."+this.type,this.options.selector,f.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,f.proxy(this.leave,this))}}this.options.selector?this._options=f.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(t){return(t=f.extend({},this.getDefaults(),this.$element.data(),t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},i.prototype.getDelegateOptions=function(){var s={},a=this.getDefaults();return this._options&&f.each(this._options,function(t,e){a[t]!=e&&(s[t]=e)}),s},i.prototype.enter=function(t){var e=t instanceof this.constructor?t:f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)},i.prototype.leave=function(t){var e=t instanceof this.constructor?t:f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)},i.prototype.show=function(){var t=f.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(t),t.isDefaultPrevented())return;var e=this.tip();this.setContent(),this.options.animation&&e.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,i=a.test(s);i&&(s=s.replace(a,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(s),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var n=this.getPosition(),o=e[0].offsetWidth,r=e[0].offsetHeight;if(i){var l=this.$element.parent(),c=s,d=document.documentElement.scrollTop||document.body.scrollTop,u="body"==this.options.container?window.innerWidth:l.outerWidth(),p="body"==this.options.container?window.innerHeight:l.outerHeight(),h="body"==this.options.container?0:l.offset().left;s="bottom"==s&&n.top+n.height+r-d>p?"top":"top"==s&&n.top-d-r<0?"bottom":"right"==s&&n.right+o>u?"left":"left"==s&&n.left-o<h?"right":s,e.removeClass(c).addClass(s)}var m=this.getCalculatedOffset(s,n,o,r);this.applyPlacement(m,s),this.$element.trigger("shown.bs."+this.type)}},i.prototype.applyPlacement=function(t,e){var s,a=this.tip(),i=a[0].offsetWidth,n=a[0].offsetHeight,o=parseInt(a.css("margin-top"),10),r=parseInt(a.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(r)&&(r=0),t.top=t.top+o,t.left=t.left+r,a.offset(t).addClass("in");var l=a[0].offsetWidth,c=a[0].offsetHeight;if("top"==e&&c!=n&&(s=!0,t.top=t.top+n-c),/bottom|top/.test(e)){var d=0;t.left<0&&(d=-2*t.left,t.left=0,a.offset(t),l=a[0].offsetWidth,c=a[0].offsetHeight),this.replaceArrow(d-i+l,l,"left")}else this.replaceArrow(c-n,c,"top");s&&a.offset(t)},i.prototype.replaceArrow=function(t,e,s){this.arrow().css(s,t?50*(1-t/e)+"%":"")},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},i.prototype.hide=function(){var t=this,e=this.tip(),s=f.Event("hide.bs."+this.type);function a(){"in"!=t.hoverState&&e.detach()}if(this.$element.trigger(s),!s.isDefaultPrevented())return e.removeClass("in"),f.support.transition&&this.$tip.hasClass("fade")?e.one(f.support.transition.end,a).emulateTransitionEnd(150):a(),this.$element.trigger("hidden.bs."+this.type),this},i.prototype.fixTitle=function(){var t=this.$element;!t.attr("title")&&"string"==typeof t.attr("data-original-title")||t.attr("data-original-title",t.attr("title")||"").attr("title","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(){var t=this.$element[0];return f.extend({},"function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},i.prototype.getCalculatedOffset=function(t,e,s,a){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-s/2}:"top"==t?{top:e.top-a,left:e.left+e.width/2-s/2}:"left"==t?{top:e.top+e.height/2-a/2,left:e.left-s}:{top:e.top+e.height/2-a/2,left:e.left+e.width}},i.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},i.prototype.tip=function(){return this.$tip=this.$tip||f(this.options.template)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(t){var e=t?f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;e.tip().hasClass("in")?e.leave(e):e.enter(e)},i.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var t=f.fn.tooltip;f.fn.tooltip=function(a){return this.each(function(){var t=f(this),e=t.data("bs.tooltip"),s="object"==typeof a&&a;e||t.data("bs.tooltip",e=new i(this,s)),"string"==typeof a&&e[a]()})},f.fn.tooltip.Constructor=i,f.fn.tooltip.noConflict=function(){return f.fn.tooltip=t,this}}(jQuery),function(i){"use strict";function n(t,e){this.init("popover",t,e)}if(!i.fn.tooltip)throw new Error("Popover requires tooltip.js");n.DEFAULTS=i.extend({},i.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((n.prototype=i.extend({},i.fn.tooltip.Constructor.prototype)).constructor=n).prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),s=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content")[this.options.html?"html":"text"](s),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},n.prototype.tip=function(){return this.$tip||(this.$tip=i(this.options.template)),this.$tip};var t=i.fn.popover;i.fn.popover=function(a){return this.each(function(){var t=i(this),e=t.data("bs.popover"),s="object"==typeof a&&a;e||t.data("bs.popover",e=new n(this,s)),"string"==typeof a&&e[a]()})},i.fn.popover.Constructor=n,i.fn.popover.noConflict=function(){return i.fn.popover=t,this}}(jQuery),function(n){"use strict";function i(t,e){var s,a=n.proxy(this.process,this);this.$element=n(t).is("body")?n(window):n(t),this.$body=n("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",a),this.options=n.extend({},i.DEFAULTS,e),this.selector=(this.options.target||(s=n(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=n([]),this.targets=n([]),this.activeTarget=null,this.refresh(),this.process()}i.DEFAULTS={offset:10},i.prototype.refresh=function(){var a=this.$element[0]==window?"offset":"position";this.offsets=n([]),this.targets=n([]);var i=this;this.$body.find(this.selector).map(function(){var t=n(this),e=t.data("target")||t.attr("href"),s=/^#\w/.test(e)&&n(e);return s&&s.length&&[[s[a]().top+(!n.isWindow(i.$scrollElement.get(0))&&i.$scrollElement.scrollTop()),e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){i.offsets.push(this[0]),i.targets.push(this[1])})},i.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,s=(this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight)-this.$scrollElement.height(),a=this.offsets,i=this.targets,n=this.activeTarget;if(s<=e)return n!=(t=i.last()[0])&&this.activate(t);for(t=a.length;t--;)n!=i[t]&&e>=a[t]&&(!a[t+1]||e<=a[t+1])&&this.activate(i[t])},i.prototype.activate=function(t){this.activeTarget=t,n(this.selector).parents(".active").removeClass("active");var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',s=n(e).parents("li").addClass("active");s.parent(".dropdown-menu").length&&(s=s.closest("li.dropdown").addClass("active")),s.trigger("activate.bs.scrollspy")};var t=n.fn.scrollspy;n.fn.scrollspy=function(a){return this.each(function(){var t=n(this),e=t.data("bs.scrollspy"),s="object"==typeof a&&a;e||t.data("bs.scrollspy",e=new i(this,s)),"string"==typeof a&&e[a]()})},n.fn.scrollspy.Constructor=i,n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=t,this},n(window).on("load",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);t.scrollspy(t.data())})})}(jQuery),function(o){"use strict";function a(t){this.element=o(t)}a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),s=t.data("target");if(s=s||(s=t.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,""),!t.parent("li").hasClass("active")){var a=e.find(".active:last a")[0],i=o.Event("show.bs.tab",{relatedTarget:a});if(t.trigger(i),!i.isDefaultPrevented()){var n=o(s);this.activate(t.parent("li"),e),this.activate(n,n.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:a})})}}},a.prototype.activate=function(t,e,s){var a=e.find("> .active"),i=s&&o.support.transition&&a.hasClass("fade");function n(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),i?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),s&&s()}i?a.one(o.support.transition.end,n).emulateTransitionEnd(150):n(),a.removeClass("in")};var t=o.fn.tab;o.fn.tab=function(s){return this.each(function(){var t=o(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof s&&e[s]()})},o.fn.tab.Constructor=a,o.fn.tab.noConflict=function(){return o.fn.tab=t,this},o(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),o(this).tab("show")})}(jQuery),function(r){"use strict";var l=function(t,e){this.options=r.extend({},l.DEFAULTS,e),this.$window=r(window).on("scroll.bs.affix.data-api",r.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",r.proxy(this.checkPositionWithEventLoop,this)),this.$element=r(t),this.affixed=this.unpin=null,this.checkPosition()};l.RESET="affix affix-top affix-bottom",l.DEFAULTS={offset:0},l.prototype.checkPositionWithEventLoop=function(){setTimeout(r.proxy(this.checkPosition,this),1)},l.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=r(document).height(),e=this.$window.scrollTop(),s=this.$element.offset(),a=this.options.offset,i=a.top,n=a.bottom;"object"!=typeof a&&(n=i=a),"function"==typeof i&&(i=a.top()),"function"==typeof n&&(n=a.bottom());var o=!(null!=this.unpin&&e+this.unpin<=s.top)&&(null!=n&&s.top+this.$element.height()>=t-n?"bottom":null!=i&&e<=i&&"top");this.affixed!==o&&(this.unpin&&this.$element.css("top",""),this.affixed=o,this.unpin="bottom"==o?s.top-e:null,this.$element.removeClass(l.RESET).addClass("affix"+(o?"-"+o:"")),"bottom"==o&&this.$element.offset({top:document.body.offsetHeight-n-this.$element.height()}))}};var t=r.fn.affix;r.fn.affix=function(a){return this.each(function(){var t=r(this),e=t.data("bs.affix"),s="object"==typeof a&&a;e||t.data("bs.affix",e=new l(this,s)),"string"==typeof a&&e[a]()})},r.fn.affix.Constructor=l,r.fn.affix.noConflict=function(){return r.fn.affix=t,this},r(window).on("load",function(){r('[data-spy="affix"]').each(function(){var t=r(this),e=t.data();e.offset=e.offset||{},e.offsetBottom&&(e.offset.bottom=e.offsetBottom),e.offsetTop&&(e.offset.top=e.offsetTop),t.affix(e)})})}(jQuery),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(k){"use strict";function s(t){var e=t.parent();t.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),e.before(t).remove()}function a(t){var e=t.parent(),s=e.find(".minicolors-panel"),a=t.data("minicolors-settings");!t.data("minicolors-initialized")||t.prop("disabled")||e.hasClass("minicolors-inline")||e.hasClass("minicolors-focus")||(i(),e.addClass("minicolors-focus"),s.stop(!0,!0).fadeIn(a.showSpeed,function(){a.show&&a.show.call(t.get(0))}))}function i(){k(".minicolors-focus").each(function(){var t=k(this),e=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=e.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(e.get(0)),t.removeClass("minicolors-focus")})})}function n(t,e,s){var a,i,n,o,r=t.parents(".minicolors").find(".minicolors-input"),l=r.data("minicolors-settings"),c=t.find("[class$=-picker]"),d=t.offset().left,u=t.offset().top,p=Math.round(e.pageX-d),h=Math.round(e.pageY-u),m=s?l.animationSpeed:0;e.originalEvent.changedTouches&&(p=e.originalEvent.changedTouches[0].pageX-d,h=e.originalEvent.changedTouches[0].pageY-u),p<0&&(p=0),h<0&&(h=0),p>t.width()&&(p=t.width()),h>t.height()&&(h=t.height()),t.parent().is(".minicolors-slider-wheel")&&c.parent().is(".minicolors-grid")&&(a=75-p,i=75-h,n=Math.sqrt(a*a+i*i),(o=Math.atan2(i,a))<0&&(o+=2*Math.PI),75<n&&(p=(n=75)-75*Math.cos(o),h=75-75*Math.sin(o)),p=Math.round(p),h=Math.round(h)),t.is(".minicolors-grid")?c.stop(!0).animate({top:h+"px",left:p+"px"},m,l.animationEasing,function(){f(r,t)}):c.stop(!0).animate({top:h+"px"},m,l.animationEasing,function(){f(r,t)})}function f(t,e){function s(t,e){var s,a;return t.length&&e?(s=t.offset().left,a=t.offset().top,{x:s-e.offset().left+t.outerWidth()/2,y:a-e.offset().top+t.outerHeight()/2}):null}var a,i,n,o,r,l,c,d=t.val(),u=t.attr("data-opacity"),p=t.parent(),h=t.data("minicolors-settings"),m=p.find(".minicolors-input-swatch"),f=p.find(".minicolors-grid"),g=p.find(".minicolors-slider"),v=p.find(".minicolors-opacity-slider"),b=f.find("[class$=-picker]"),y=g.find("[class$=-picker]"),w=v.find("[class$=-picker]"),k=s(b,f),x=s(y,g),C=s(w,v);if(e.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(h.control){case"wheel":o=f.width()/2-k.x,r=f.height()/2-k.y,l=Math.sqrt(o*o+r*r),(c=Math.atan2(r,o))<0&&(c+=2*Math.PI),75<l&&(l=75,k.x=69-75*Math.cos(c),k.y=69-75*Math.sin(c)),i=D(l/.75,0,100),d=O({h:a=D(180*c/Math.PI,0,360),s:i,b:n=D(100-Math.floor(x.y*(100/g.height())),0,100)}),g.css("backgroundColor",O({h:a,s:i,b:100}));break;case"saturation":d=O({h:a=D(parseInt(k.x*(360/f.width()),10),0,360),s:i=D(100-Math.floor(x.y*(100/g.height())),0,100),b:n=D(100-Math.floor(k.y*(100/f.height())),0,100)}),g.css("backgroundColor",O({h:a,s:100,b:n})),p.find(".minicolors-grid-inner").css("opacity",i/100);break;case"brightness":d=O({h:a=D(parseInt(k.x*(360/f.width()),10),0,360),s:i=D(100-Math.floor(k.y*(100/f.height())),0,100),b:n=D(100-Math.floor(x.y*(100/g.height())),0,100)}),g.css("backgroundColor",O({h:a,s:i,b:100})),p.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:d=O({h:a=D(360-parseInt(x.y*(360/g.height()),10),0,360),s:i=D(Math.floor(k.x*(100/f.width())),0,100),b:n=D(100-Math.floor(k.y*(100/f.height())),0,100)}),f.css("backgroundColor",O({h:a,s:100,b:100}))}_(t,d,u=h.opacity?parseFloat(1-C.y/v.height()).toFixed(2):1)}else m.find("span").css({backgroundColor:d,opacity:u}),P(t,d,u)}function _(t,e,s){var a,i=t.parent(),n=t.data("minicolors-settings"),o=i.find(".minicolors-input-swatch");n.opacity&&t.attr("data-opacity",s),e="rgb"===n.format?(a=T(e)?A(e,!0):L(C(e,!0)),s=""===t.attr("data-opacity")?1:D(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),!isNaN(s)&&n.opacity||(s=1),t.minicolors("rgbObject").a<=1&&a&&n.opacity?"rgba("+a.r+", "+a.g+", "+a.b+", "+parseFloat(s)+")":"rgb("+a.r+", "+a.g+", "+a.b+")"):(T(e)&&(e=E(e)),x(e,n.letterCase)),t.val(e),o.find("span").css({backgroundColor:e,opacity:s}),P(t,e,s)}function c(t,e){var s,a,i,n,o,r,l,c,d,u,p=t.parent(),h=t.data("minicolors-settings"),m=p.find(".minicolors-input-swatch"),f=p.find(".minicolors-grid"),g=p.find(".minicolors-slider"),v=p.find(".minicolors-opacity-slider"),b=f.find("[class$=-picker]"),y=g.find("[class$=-picker]"),w=v.find("[class$=-picker]");switch(T(t.val())?(s=E(t.val()),(o=D(parseFloat(S(t.val())).toFixed(2),0,1))&&t.attr("data-opacity",o)):s=x(C(t.val(),!0),h.letterCase),a=function(t){var e=function(t){var e={h:0,s:0,b:0},s=Math.min(t.r,t.g,t.b),a=Math.max(t.r,t.g,t.b),i=a-s;e.b=a,e.s=0!==a?255*i/a:0,0!==e.s?t.r===a?e.h=(t.g-t.b)/i:t.g===a?e.h=2+(t.b-t.r)/i:e.h=4+(t.r-t.g)/i:e.h=-1;e.h*=60,e.h<0&&(e.h+=360);return e.s*=100/255,e.b*=100/255,e}(L(t));0===e.s&&(e.h=360);return e}(s=s||x(M(h.defaultValue,!0),h.letterCase)),n=h.keywords?k.map(h.keywords.split(","),function(t){return k.trim(t.toLowerCase())}):[],r=""!==t.val()&&-1<k.inArray(t.val().toLowerCase(),n)?x(t.val()):T(t.val())?A(t.val()):s,e||t.val(r),h.opacity&&(i=""===t.attr("data-opacity")?1:D(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(i)&&(i=1),t.attr("data-opacity",i),m.find("span").css("opacity",i),c=D(v.height()-v.height()*i,0,v.height()),w.css("top",c+"px")),"transparent"===t.val().toLowerCase()&&m.find("span").css("opacity",0),m.find("span").css("backgroundColor",s),h.control){case"wheel":d=D(Math.ceil(.75*a.s),0,f.height()/2),u=a.h*Math.PI/180,l=D(75-Math.cos(u)*d,0,f.width()),c=D(75-Math.sin(u)*d,0,f.height()),b.css({top:c+"px",left:l+"px"}),c=150-a.b/(100/f.height()),""===s&&(c=0),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:a.s,b:100}));break;case"saturation":l=D(5*a.h/12,0,150),c=D(f.height()-Math.ceil(a.b/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.s*(g.height()/100),0,g.height()),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:100,b:a.b})),p.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":l=D(5*a.h/12,0,150),c=D(f.height()-Math.ceil(a.s/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.b*(g.height()/100),0,g.height()),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:a.s,b:100})),p.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:l=D(Math.ceil(a.s/(100/f.width())),0,f.width()),c=D(f.height()-Math.ceil(a.b/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.h/(360/g.height()),0,g.height()),y.css("top",c+"px"),f.css("backgroundColor",O({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&P(t,r,i)}function P(t,e,s){var a,i,n=t.data("minicolors-settings"),o=t.data("minicolors-lastChange");if(!o||o.value!==e||o.opacity!==s){if(t.data("minicolors-lastChange",{value:e,opacity:s}),n.swatches&&0!==n.swatches.length){for(a=T(e)?A(e,!0):L(e),-1,i=0;i<n.swatches.length;++i)if(a.r===n.swatches[i].r&&a.g===n.swatches[i].g&&a.b===n.swatches[i].b&&a.a===n.swatches[i].a){i;break}t.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),-1!==i&&t.parent().find(".minicolors-swatches .minicolors-swatch").eq(i).addClass("selected")}n.change&&(n.changeDelay?(clearTimeout(t.data("minicolors-changeTimeout")),t.data("minicolors-changeTimeout",setTimeout(function(){n.change.call(t.get(0),e,s)},n.changeDelay))):n.change.call(t.get(0),e,s)),t.trigger("change").trigger("input")}}function x(t,e){return"uppercase"===e?t.toUpperCase():t.toLowerCase()}function C(t,e){return(t=t.replace(/^#/g,"")).match(/^[A-F0-9]{3,6}/gi)?3!==t.length&&6!==t.length?"":(3===t.length&&e&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),"#"+t):""}function A(t,e){var s=t.replace(/[^\d,.]/g,"").split(",");return s[0]=D(parseInt(s[0],10),0,255),s[1]=D(parseInt(s[1],10),0,255),s[2]=D(parseInt(s[2],10),0,255),s[3]&&(s[3]=D(parseFloat(s[3],10),0,1)),e?{r:s[0],g:s[1],b:s[2],a:s[3]?s[3]:null}:void 0!==s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function M(t,e){return T(t)?A(t):C(t,e)}function D(t,e,s){return t<e&&(t=e),s<t&&(t=s),t}function T(t){var e=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!e||4!==e.length)}function S(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i))&&6===t.length?t[4]:"1"}function E(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""}function d(t){var s=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return k.each(s,function(t,e){1===e.length&&(s[t]="0"+e)}),"#"+s.join("")}function O(t){return d(function(t){var e={},s=Math.round(t.h),a=Math.round(255*t.s/100),i=Math.round(255*t.b/100);if(0===a)e.r=e.g=e.b=i;else{var n=i,o=(255-a)*i/255,r=s%60*(n-o)/60;360===s&&(s=0),s<60?(e.r=n,e.b=o,e.g=o+r):s<120?(e.g=n,e.b=o,e.r=n-r):s<180?(e.g=n,e.r=o,e.b=o+r):s<240?(e.b=n,e.r=o,e.g=n-r):s<300?(e.b=n,e.g=o,e.r=o+r):s<360?(e.r=n,e.g=o,e.b=n-r):(e.r=0,e.g=0,e.b=0)}return{r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)}}(t))}function L(t){return{r:(t=parseInt(-1<t.indexOf("#")?t.substring(1):t,16))>>16,g:(65280&t)>>8,b:255&t}}k.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",dataUris:!0,defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},k.extend(k.fn,{minicolors:function(t,e){switch(t){case"destroy":return k(this).each(function(){s(k(this))}),k(this);case"hide":return i(),k(this);case"opacity":return void 0===e?k(this).attr("data-opacity"):(k(this).each(function(){c(k(this).attr("data-opacity",e))}),k(this));case"rgbObject":return function(t){var e=L(C(k(t).val(),!0)),s=k(t).attr("data-opacity");if(!e)return null;void 0!==s&&k.extend(e,{a:parseFloat(s)});return e}(k(this));case"rgbString":case"rgbaString":return function(t,e){var s=L(C(k(t).val(),!0)),a=k(t).attr("data-opacity");if(!s)return null;void 0===a&&(a=1);return e?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"}(k(this),"rgbaString"===t);case"settings":return void 0===e?k(this).data("minicolors-settings"):(k(this).each(function(){var t=k(this).data("minicolors-settings")||{};s(k(this)),k(this).minicolors(k.extend(!0,t,e))}),k(this));case"show":return a(k(this).eq(0)),k(this);case"value":return void 0===e?k(this).val():(k(this).each(function(){"object"==typeof e&&null!==typeof e?(e.opacity&&k(this).attr("data-opacity",D(e.opacity,0,1)),e.color&&k(this).val(e.color)):k(this).val(e),c(k(this))}),k(this));default:return"create"!==t&&(e=t),k(this).each(function(){!function(e,t){var s,a,i,n,o,r=k('<div class="minicolors" />'),l=k.minicolors.defaults;if(e.data("minicolors-initialized"))return;t=k.extend(!0,{},l,t),r.addClass("minicolors-theme-"+t.theme).toggleClass("minicolors-with-opacity",t.opacity).toggleClass("minicolors-no-data-uris",!0!==t.dataUris),void 0!==t.position&&k.each(t.position.split(" "),function(){r.addClass("minicolors-position-"+this)});s="rgb"===t.format?t.opacity?"25":"20":t.keywords?"11":"7";e.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",t).prop("size",s).wrap(r).after('<div class="minicolors-panel minicolors-slider-'+t.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),t.inline||(e.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),e.next(".minicolors-input-swatch").on("click",function(t){t.preventDefault(),e.focus()}));if((n=e.parent().find(".minicolors-panel")).on("selectstart",function(){return!1}).end(),t.swatches&&0!==t.swatches.length)for(7<t.swatches.length&&(t.swatches.length=7),n.addClass("minicolors-with-swatches"),a=k('<ul class="minicolors-swatches"></ul>').appendTo(n),o=0;o<t.swatches.length;++o)i=T(i=t.swatches[o])?A(i,!0):L(C(i,!0)),k('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",t.swatches[o]).find(".minicolors-swatch-color").css({backgroundColor:d(i),opacity:i.a}),t.swatches[o]=i;t.inline&&e.parent().addClass("minicolors-inline");c(e,!1),e.data("minicolors-initialized",!0)}(k(this),e)}),k(this)}}}),k(document).on("mousedown.minicolors touchstart.minicolors",function(t){k(t.target).parents().add(t.target).hasClass("minicolors")||i()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var e=k(this);t.preventDefault(),k(document).data("minicolors-target",e),n(e,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var e=k(document).data("minicolors-target");e&&n(e,t)}).on("mouseup.minicolors touchend.minicolors",function(){k(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var e=k(this),s=e.parents(".minicolors").find(".minicolors-input"),a=e.data("swatch-color");_(s,a,S(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var e=k(this).parent().find(".minicolors-input");t.preventDefault(),a(e)}).on("focus.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&a(t)}).on("blur.minicolors",".minicolors-input",function(){var t,e,s,a,i,n=k(this),o=n.data("minicolors-settings");n.data("minicolors-initialized")&&(t=o.keywords?k.map(o.keywords.split(","),function(t){return k.trim(t.toLowerCase())}):[],i=""!==n.val()&&-1<k.inArray(n.val().toLowerCase(),t)?n.val():null===(s=T(n.val())?A(n.val(),!0):(e=C(n.val(),!0))?L(e):null)?o.defaultValue:"rgb"===o.format?o.opacity?A("rgba("+s.r+","+s.g+","+s.b+","+n.attr("data-opacity")+")"):A("rgb("+s.r+","+s.g+","+s.b+")"):d(s),a=o.opacity?n.attr("data-opacity"):1,"transparent"===i.toLowerCase()&&(a=0),n.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),n.val(i),""===n.val()&&n.val(M(o.defaultValue,!0)),n.val(x(n.val(),o.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var e=k(this);if(e.data("minicolors-initialized"))switch(t.keyCode){case 9:i();break;case 13:case 27:i(),e.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})}),function(t,e){"use strict";"undefined"!=typeof module&&module.exports?"undefined"!=typeof process&&"electron"in process.versions?t.BootstrapDialog=e(t.jQuery):module.exports=e(require("jquery"),require("bootstrap")):"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery","bootstrap"],function(t){return e(t)}):t.BootstrapDialog=e(t.jQuery)}(this,function(r){"use strict";function e(t,e){s.call(this,t,e)}var s=r.fn.modal.Constructor;e.getModalVersion=function(){return void 0===r.fn.modal.Constructor.VERSION?"v3.1":/3\.2\.\d+/.test(r.fn.modal.Constructor.VERSION)?"v3.2":/3\.3\.[1,2]/.test(r.fn.modal.Constructor.VERSION)?"v3.3":"v3.3.4"},e.ORIGINAL_BODY_PADDING=parseInt(r("body").css("padding-right")||0,10),(e.METHODS_TO_OVERRIDE={})["v3.1"]={},e.METHODS_TO_OVERRIDE["v3.2"]={hide:function(t){t&&t.preventDefault(),t=r.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,0===this.getGlobalOpenedDialogs().length&&this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),r(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),r.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",r.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())}},e.METHODS_TO_OVERRIDE["v3.3"]={setScrollbar:function(){var t=e.ORIGINAL_BODY_PADDING;this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},resetScrollbar:function(){0===this.getGlobalOpenedDialogs().length&&this.$body.css("padding-right",e.ORIGINAL_BODY_PADDING)},hideModal:function(){this.$element.hide(),this.backdrop(r.proxy(function(){0===this.getGlobalOpenedDialogs().length&&this.$body.removeClass("modal-open"),this.resetAdjustments(),this.resetScrollbar(),this.$element.trigger("hidden.bs.modal")},this))}},e.METHODS_TO_OVERRIDE["v3.3.4"]=r.extend({},e.METHODS_TO_OVERRIDE["v3.3"]),e.prototype={constructor:e,getGlobalOpenedDialogs:function(){var s=[];return r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&s.push(e)}),s}},e.prototype=r.extend(e.prototype,s.prototype,e.METHODS_TO_OVERRIDE[e.getModalVersion()]);var n=function(t){this.defaultOptions=r.extend(!0,{id:n.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},n.defaultOptions),this.indexedButtons={},this.registeredButtonHotkeys={},this.draggableData={isMouseDown:!1,mouseOffset:{}},this.realized=!1,this.opened=!1,this.initOptions(t),this.holdThisInstance()};return n.BootstrapDialogModal=e,n.NAMESPACE="bootstrap-dialog",n.TYPE_DEFAULT="type-default",n.TYPE_INFO="type-info",n.TYPE_PRIMARY="type-primary",n.TYPE_SUCCESS="type-success",n.TYPE_WARNING="type-warning",n.TYPE_DANGER="type-danger",n.DEFAULT_TEXTS={},n.DEFAULT_TEXTS[n.TYPE_DEFAULT]="Information",n.DEFAULT_TEXTS[n.TYPE_INFO]="Information",n.DEFAULT_TEXTS[n.TYPE_PRIMARY]="Information",n.DEFAULT_TEXTS[n.TYPE_SUCCESS]="Success",n.DEFAULT_TEXTS[n.TYPE_WARNING]="Warning",n.DEFAULT_TEXTS[n.TYPE_DANGER]="Danger",n.DEFAULT_TEXTS.OK="OK",n.DEFAULT_TEXTS.CANCEL="Cancel",n.DEFAULT_TEXTS.CONFIRM="Confirmation",n.SIZE_NORMAL="size-normal",n.SIZE_SMALL="size-small",n.SIZE_WIDE="size-wide",n.SIZE_LARGE="size-large",n.BUTTON_SIZES={},n.BUTTON_SIZES[n.SIZE_NORMAL]="",n.BUTTON_SIZES[n.SIZE_SMALL]="",n.BUTTON_SIZES[n.SIZE_WIDE]="",n.BUTTON_SIZES[n.SIZE_LARGE]="btn-lg",n.ICON_SPINNER="glyphicon glyphicon-asterisk",n.defaultOptions={type:n.TYPE_PRIMARY,size:n.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,closeIcon:"×",spinicon:n.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:"",tabindex:-1},n.configDefaultOptions=function(t){n.defaultOptions=r.extend(!0,n.defaultOptions,t)},n.dialogs={},n.openAll=function(){r.each(n.dialogs,function(t,e){e.open()})},n.closeAll=function(){r.each(n.dialogs,function(t,e){e.close()})},n.getDialog=function(t){var e=null;return void 0!==n.dialogs[t]&&(e=n.dialogs[t]),e},n.setDialog=function(t){return n.dialogs[t.getId()]=t},n.addDialog=function(t){return n.setDialog(t)},n.moveFocus=function(){var s=null;r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&(s=e)}),null!==s&&s.getModal().focus()},n.METHODS_TO_OVERRIDE={},n.METHODS_TO_OVERRIDE["v3.1"]={handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(t){t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this},updateZIndex:function(){if(this.isOpened()){var s=0;r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&s++});var t=this.getModal(),e=t.data("bs.modal").$backdrop;t.css("z-index",1050+20*(s-1)),e.css("z-index",1040+20*(s-1))}return this},open:function(){return this.isRealized()||this.realize(),this.getModal().modal("show"),this.updateZIndex(),this}},n.METHODS_TO_OVERRIDE["v3.2"]={handleModalBackdropEvent:n.METHODS_TO_OVERRIDE["v3.1"].handleModalBackdropEvent,updateZIndex:n.METHODS_TO_OVERRIDE["v3.1"].updateZIndex,open:n.METHODS_TO_OVERRIDE["v3.1"].open},n.METHODS_TO_OVERRIDE["v3.3"]={},n.METHODS_TO_OVERRIDE["v3.3.4"]=r.extend({},n.METHODS_TO_OVERRIDE["v3.1"]),n.prototype={constructor:n,initOptions:function(t){return this.options=r.extend(!0,this.defaultOptions,t),this},holdThisInstance:function(){return n.addDialog(this),this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var t=r('<div class="modal" role="dialog" aria-hidden="true"></div>');return t.prop("id",this.getId()),t.attr("aria-labelledby",this.getId()+"_title"),t},getModal:function(){return this.$modal},setModal:function(t){return this.$modal=t,this},createModalDialog:function(){return r('<div class="modal-dialog"></div>')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){return this.$modalDialog=t,this},createModalContent:function(){return r('<div class="modal-content"></div>')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){return this.$modalContent=t,this},createModalHeader:function(){return r('<div class="modal-header"></div>')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){return this.$modalHeader=t,this},createModalBody:function(){return r('<div class="modal-body"></div>')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){return this.$modalBody=t,this},createModalFooter:function(){return r('<div class="modal-footer"></div>')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){return this.$modalFooter=t,this},createDynamicContent:function(t){var e=null;return"string"==typeof(e="function"==typeof t?t.call(t,this):t)&&(e=this.formatStringContent(e)),e},formatStringContent:function(t){return this.options.nl2br?t.replace(/\r\n/g,"<br />").replace(/[\r\n]/g,"<br />"):t},setData:function(t,e){return this.options.data[t]=e,this},getData:function(t){return this.options.data[t]},setId:function(t){return this.options.id=t,this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(t){return this.options.type=t,this.updateType(),this},updateType:function(){if(this.isRealized()){var t=[n.TYPE_DEFAULT,n.TYPE_INFO,n.TYPE_PRIMARY,n.TYPE_SUCCESS,n.TYPE_WARNING,n.TYPE_DANGER];this.getModal().removeClass(t.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(t){return this.options.size=t,this.updateSize(),this},updateSize:function(){if(this.isRealized()){var o=this;this.getModal().removeClass(n.SIZE_NORMAL).removeClass(n.SIZE_SMALL).removeClass(n.SIZE_WIDE).removeClass(n.SIZE_LARGE),this.getModal().addClass(this.getSize()),this.getModalDialog().removeClass("modal-sm"),this.getSize()===n.SIZE_SMALL&&this.getModalDialog().addClass("modal-sm"),this.getModalDialog().removeClass("modal-lg"),this.getSize()===n.SIZE_WIDE&&this.getModalDialog().addClass("modal-lg"),r.each(this.options.buttons,function(t,e){var s=o.getButton(e.id),a=["btn-lg","btn-sm","btn-xs"],i=!1;if("string"==typeof e.cssClass){var n=e.cssClass.split(" ");r.each(n,function(t,e){-1!==r.inArray(e,a)&&(i=!0)})}i||(s.removeClass(a.join(" ")),s.addClass(o.getButtonSize()))})}return this},getCssClass:function(){return this.options.cssClass},setCssClass:function(t){return this.options.cssClass=t,this},getTitle:function(){return this.options.title},setTitle:function(t){return this.options.title=t,this.updateTitle(),this},updateTitle:function(){if(this.isRealized()){var t=null!==this.getTitle()?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(t).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(t){return this.options.message=t,this.updateMessage(),this},updateMessage:function(){if(this.isRealized()){var t=this.createDynamicContent(this.getMessage());this.getModalBody().find("."+this.getNamespace("message")).html("").append(t)}return this},isClosable:function(){return this.options.closable},setClosable:function(t){return this.options.closable=t,this.updateClosable(),this},setCloseByBackdrop:function(t){return this.options.closeByBackdrop=t,this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(t){return this.options.closeByKeyboard=t,this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(t){return this.options.animate=t,this},updateAnimate:function(){return this.isRealized()&&this.getModal().toggleClass("fade",this.isAnimate()),this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(t){return this.options.spinicon=t,this},addButton:function(t){return this.options.buttons.push(t),this},addButtons:function(t){var s=this;return r.each(t,function(t,e){s.addButton(e)}),this},getButtons:function(){return this.options.buttons},setButtons:function(t){return this.options.buttons=t,this.updateButtons(),this},getButton:function(t){return void 0!==this.indexedButtons[t]?this.indexedButtons[t]:null},getButtonSize:function(){return void 0!==n.BUTTON_SIZES[this.getSize()]?n.BUTTON_SIZES[this.getSize()]:""},updateButtons:function(){return this.isRealized()&&(0===this.getButtons().length?this.getModalFooter().hide():this.getModalFooter().show().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())),this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(t){this.options.autodestroy=t},getDescription:function(){return this.options.description},setDescription:function(t){return this.options.description=t,this},setTabindex:function(t){return this.options.tabindex=t,this},getTabindex:function(){return this.options.tabindex},updateTabindex:function(){return this.isRealized()&&this.getModal().attr("tabindex",this.getTabindex()),this},getDefaultText:function(){return n.DEFAULT_TEXTS[this.getType()]},getNamespace:function(t){return n.NAMESPACE+"-"+t},createHeaderContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("header")),t.append(this.createTitleContent()),t.prepend(this.createCloseButton()),t},createTitleContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("title")),t},createCloseButton:function(){var t=r("<div></div>");t.addClass(this.getNamespace("close-button"));var e=r('<button class="close"></button>');return e.append(this.options.closeIcon),t.append(e),t.on("click",{dialog:this},function(t){t.data.dialog.close()}),t},createBodyContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("body")),t.append(this.createMessageContent()),t},createMessageContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("message")),t},createFooterContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("footer")),t},createFooterButtons:function(){var a=this,i=r("<div></div>");return i.addClass(this.getNamespace("footer-buttons")),this.indexedButtons={},r.each(this.options.buttons,function(t,e){e.id||(e.id=n.newGuid());var s=a.createButton(e);a.indexedButtons[e.id]=s,i.append(s)}),i},createButton:function(t){var e=r('<button class="btn"></button>');return e.prop("id",t.id),e.data("button",t),void 0!==t.icon&&""!==r.trim(t.icon)&&e.append(this.createButtonIcon(t.icon)),void 0!==t.label&&e.append(t.label),void 0!==t.cssClass&&""!==r.trim(t.cssClass)?e.addClass(t.cssClass):e.addClass("btn-default"),void 0!==t.hotkey&&(this.registeredButtonHotkeys[t.hotkey]=e),e.on("click",{dialog:this,$button:e,button:t},function(t){var e=t.data.dialog,s=t.data.$button,a=s.data("button");if(a.autospin&&s.toggleSpin(!0),"function"==typeof a.action)return a.action.call(s,e,t)}),this.enhanceButton(e),void 0!==t.enabled&&e.toggleEnable(t.enabled),e},enhanceButton:function(a){return a.dialog=this,a.toggleEnable=function(t){return void 0!==t?this.prop("disabled",!t).toggleClass("disabled",!t):this.prop("disabled",!this.prop("disabled")),this},a.enable=function(){return this.toggleEnable(!0),this},a.disable=function(){return this.toggleEnable(!1),this},a.toggleSpin=function(t){var e=this.dialog,s=this.find("."+e.getNamespace("button-icon"));return void 0===t&&(t=!(0<a.find(".icon-spin").length)),t?(s.hide(),a.prepend(e.createButtonIcon(e.getSpinicon()).addClass("icon-spin"))):(s.show(),a.find(".icon-spin").remove()),this},a.spin=function(){return this.toggleSpin(!0),this},a.stopSpin=function(){return this.toggleSpin(!1),this},this},createButtonIcon:function(t){var e=r("<span></span>");return e.addClass(this.getNamespace("button-icon")).addClass(t),e},enableButtons:function(s){return r.each(this.indexedButtons,function(t,e){e.toggleEnable(s)}),this},updateClosable:function(){return this.isRealized()&&this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable()),this},onShow:function(t){return this.options.onshow=t,this},onShown:function(t){return this.options.onshown=t,this},onHide:function(t){return this.options.onhide=t,this},onHidden:function(t){return this.options.onhidden=t,this},isRealized:function(){return this.realized},setRealized:function(t){return this.realized=t,this},isOpened:function(){return this.opened},setOpened:function(t){return this.opened=t,this},handleModalEvents:function(){return this.getModal().on("show.bs.modal",{dialog:this},function(t){var e=t.data.dialog;if(e.setOpened(!0),e.isModalEvent(t)&&"function"==typeof e.options.onshow){var s=e.options.onshow(e);return!1===s&&e.setOpened(!1),s}}),this.getModal().on("shown.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.isModalEvent(t)&&"function"==typeof e.options.onshown&&e.options.onshown(e)}),this.getModal().on("hide.bs.modal",{dialog:this},function(t){var e=t.data.dialog;if(e.setOpened(!1),e.isModalEvent(t)&&"function"==typeof e.options.onhide){var s=e.options.onhide(e);return!1===s&&e.setOpened(!0),s}}),this.getModal().on("hidden.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.isModalEvent(t)&&"function"==typeof e.options.onhidden&&e.options.onhidden(e),e.isAutodestroy()&&(e.setRealized(!1),delete n.dialogs[e.getId()],r(this).remove()),n.moveFocus()}),this.handleModalBackdropEvent(),this.getModal().on("keyup",{dialog:this},function(t){27===t.which&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByKeyboard()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(t){var e=t.data.dialog;if(void 0!==e.registeredButtonHotkeys[t.which]){var s=r(e.registeredButtonHotkeys[t.which]);s.prop("disabled")||s.focus().trigger("click")}}),this},handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(t){r(t.target).hasClass("modal-backdrop")&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this},isModalEvent:function(t){return void 0!==t.namespace&&"bs.modal"===t.namespace},makeModalDraggable:function(){return this.options.draggable&&(this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown=!0;var s=e.getModalDialog().offset();e.draggableData.mouseOffset={top:t.clientY-s.top,left:t.clientX-s.left}}),this.getModal().on("mouseup mouseleave",{dialog:this},function(t){t.data.dialog.draggableData.isMouseDown=!1}),r("body").on("mousemove",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown&&e.getModalDialog().offset({top:t.clientY-e.draggableData.mouseOffset.top,left:t.clientX-e.draggableData.mouseOffset.left})})),this},realize:function(){return this.initModalStuff(),this.getModal().addClass(n.NAMESPACE).addClass(this.getCssClass()),this.updateSize(),this.getDescription()&&this.getModal().attr("aria-describedby",this.getDescription()),this.getModalFooter().append(this.createFooterContent()),this.getModalHeader().append(this.createHeaderContent()),this.getModalBody().append(this.createBodyContent()),this.getModal().data("bs.modal",new e(this.getModal(),{backdrop:"static",keyboard:!1,show:!1})),this.makeModalDraggable(),this.handleModalEvents(),this.setRealized(!0),this.updateButtons(),this.updateType(),this.updateTitle(),this.updateMessage(),this.updateClosable(),this.updateAnimate(),this.updateSize(),this.updateTabindex(),this},open:function(){return this.isRealized()||this.realize(),this.getModal().modal("show"),this},close:function(){return this.isRealized()||this.realize(),this.getModal().modal("hide"),this}},n.prototype=r.extend(n.prototype,n.METHODS_TO_OVERRIDE[e.getModalVersion()]),n.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})},n.show=function(t){return new n(t).open()},n.alert=function(){var t={},e={type:n.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,buttonLabel:n.DEFAULT_TEXTS.OK,callback:null};t="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?r.extend(!0,e,arguments[0]):r.extend(!0,e,{message:arguments[0],callback:void 0!==arguments[1]?arguments[1]:null});var s=new n(t);return s.setData("callback",t.callback),s.addButton({label:t.buttonLabel,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!0))&&(t.setData("btnClicked",!0),t.close())}}),"function"==typeof s.options.onhide?s.onHide(function(t){var e=!0;return!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&(e=t.getData("callback")(!1)),!1!==e&&(e=this.onhide(t))}.bind({onhide:s.options.onhide})):s.onHide(function(t){var e=!0;return!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&(e=t.getData("callback")(!1)),e}),s.open()},n.confirm=function(){var t={},e={type:n.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,btnCancelLabel:n.DEFAULT_TEXTS.CANCEL,btnCancelClass:null,btnOKLabel:n.DEFAULT_TEXTS.OK,btnOKClass:null,callback:null};null===(t="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?r.extend(!0,e,arguments[0]):r.extend(!0,e,{message:arguments[0],callback:void 0!==arguments[1]?arguments[1]:null})).btnOKClass&&(t.btnOKClass=["btn",t.type.split("-")[1]].join("-"));var s=new n(t);return s.setData("callback",t.callback),s.addButton({label:t.btnCancelLabel,cssClass:t.btnCancelClass,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!1))&&t.close()}}),s.addButton({label:t.btnOKLabel,cssClass:t.btnOKClass,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!0))&&t.close()}}),s.open()},n.warning=function(t,e){return new n({type:n.TYPE_WARNING,message:t}).open()},n.danger=function(t,e){return new n({type:n.TYPE_DANGER,message:t}).open()},n.success=function(t,e){return new n({type:n.TYPE_SUCCESS,message:t}).open()},n}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moment=e()}(this,function(){"use strict";var t,a;function p(){return t.apply(null,arguments)}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function n(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function o(t,e){var s,a=[];for(s=0;s<t.length;++s)a.push(e(t[s],s));return a}function h(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function r(t,e){for(var s in e)h(e,s)&&(t[s]=e[s]);return h(e,"toString")&&(t.toString=e.toString),h(e,"valueOf")&&(t.valueOf=e.valueOf),t}function d(t,e,s,a){return re(t,e,s,a,!0).utc()}function m(t){return null==t._pf&&(t._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}),t._pf}function l(t){if(null==t._isValid){var e=m(t),s=a.call(e.parsedDateParts,function(t){return null!=t});t._isValid=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&s),t._strict&&(t._isValid=t._isValid&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour)}return t._isValid}function c(t){var e=d(NaN);return null!=t?r(m(e),t):m(e).userInvalidated=!0,e}function u(t){return void 0===t}a=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),s=e.length>>>0,a=0;a<s;a++)if(a in e&&t.call(this,e[a],a,e))return!0;return!1};var f=p.momentProperties=[];function g(t,e){var s,a,i;if(u(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),u(e._i)||(t._i=e._i),u(e._f)||(t._f=e._f),u(e._l)||(t._l=e._l),u(e._strict)||(t._strict=e._strict),u(e._tzm)||(t._tzm=e._tzm),u(e._isUTC)||(t._isUTC=e._isUTC),u(e._offset)||(t._offset=e._offset),u(e._pf)||(t._pf=m(e)),u(e._locale)||(t._locale=e._locale),0<f.length)for(s in f)u(i=e[a=f[s]])||(t[a]=i);return t}var e=!1;function v(t){g(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),!1===e&&(e=!0,p.updateOffset(this),e=!1)}function b(t){return t instanceof v||null!=t&&null!=t._isAMomentObject}function y(t){return t<0?Math.ceil(t):Math.floor(t)}function w(t){var e=+t,s=0;return 0!=e&&isFinite(e)&&(s=y(e)),s}function k(t,e,s){var a,i=Math.min(t.length,e.length),n=Math.abs(t.length-e.length),o=0;for(a=0;a<i;a++)(s&&t[a]!==e[a]||!s&&w(t[a])!==w(e[a]))&&o++;return o+n}function x(t){!1===p.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function s(t,e){var s=!0;return r(function(){return null!=p.deprecationHandler&&p.deprecationHandler(null,t),s&&(x(t+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),s=!1),e.apply(this,arguments)},e)}var C,_={};function P(t,e){null!=p.deprecationHandler&&p.deprecationHandler(t,e),_[t]||(x(e),_[t]=!0)}function A(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function M(t){return"[object Object]"===Object.prototype.toString.call(t)}function D(t,e){var s,a=r({},t);for(s in e)h(e,s)&&(M(t[s])&&M(e[s])?(a[s]={},r(a[s],t[s]),r(a[s],e[s])):null!=e[s]?a[s]=e[s]:delete a[s]);return a}function T(t){null!=t&&this.set(t)}p.suppressDeprecationWarnings=!1,p.deprecationHandler=null,C=Object.keys?Object.keys:function(t){var e,s=[];for(e in t)h(t,e)&&s.push(e);return s};var S,E={};function O(t){return t?t.toLowerCase().replace("_","-"):t}function L(t){var e=null;if(!E[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=S._abbr,require("./locale/"+t),B(e)}catch(t){}return E[t]}function B(t,e){var s;return t&&(s=u(e)?j(t):I(t,e))&&(S=s),S._abbr}function I(t,e){return null!==e?(e.abbr=t,null!=E[t]?(P("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),e=D(E[t]._config,e)):null!=e.parentLocale&&(null!=E[e.parentLocale]?e=D(E[e.parentLocale]._config,e):P("parentLocaleUndefined","specified parentLocale is not defined yet")),E[t]=new T(e),B(t),E[t]):(delete E[t],null)}function j(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return S;if(!i(t)){if(e=L(t))return e;t=[t]}return function(t){for(var e,s,a,i,n=0;n<t.length;){for(e=(i=O(t[n]).split("-")).length,s=(s=O(t[n+1]))?s.split("-"):null;0<e;){if(a=L(i.slice(0,e).join("-")))return a;if(s&&s.length>=e&&k(i,s,!0)>=e-1)break;e--}n++}return null}(t)}var F={};function Y(t,e){var s=t.toLowerCase();F[s]=F[s+"s"]=F[e]=t}function R(t){return"string"==typeof t?F[t]||F[t.toLowerCase()]:void 0}function z(t){var e,s,a={};for(s in t)h(t,s)&&(e=R(s))&&(a[e]=t[s]);return a}function Q(e,s){return function(t){return null!=t?(N(this,e,t),p.updateOffset(this,s),this):H(this,e)}}function H(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function N(t,e,s){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](s)}function $(t,e){var s;if("object"==typeof t)for(s in t)this.set(s,t[s]);else if(A(this[t=R(t)]))return this[t](e);return this}function U(t,e,s){var a=""+Math.abs(t),i=e-a.length;return(0<=t?s?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+a}var G=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},K={};function W(t,e,s,a){var i=a;"string"==typeof a&&(i=function(){return this[a]()}),t&&(K[t]=i),e&&(K[e[0]]=function(){return U(i.apply(this,arguments),e[1],e[2])}),s&&(K[s]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function J(t,e){return t.isValid()?(e=Z(e,t.localeData()),V[e]=V[e]||function(a){var t,i,e,n=a.match(G);for(t=0,i=n.length;t<i;t++)K[n[t]]?n[t]=K[n[t]]:n[t]=(e=n[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(t){var e,s="";for(e=0;e<i;e++)s+=n[e]instanceof Function?n[e].call(t,a):n[e];return s}}(e),V[e](t)):t.localeData().invalidDate()}function Z(t,e){var s=5;function a(t){return e.longDateFormat(t)||t}for(q.lastIndex=0;0<=s&&q.test(t);)t=t.replace(q,a),q.lastIndex=0,s-=1;return t}var X=/\d/,tt=/\d\d/,et=/\d{3}/,st=/\d{4}/,at=/[+-]?\d{6}/,it=/\d\d?/,nt=/\d\d\d\d?/,ot=/\d\d\d\d\d\d?/,rt=/\d{1,3}/,lt=/\d{1,4}/,ct=/[+-]?\d{1,6}/,dt=/\d+/,ut=/[+-]?\d+/,pt=/Z|[+-]\d\d:?\d\d/gi,ht=/Z|[+-]\d\d(?::?\d\d)?/gi,mt=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ft={};function gt(t,s,a){ft[t]=A(s)?s:function(t,e){return t&&a?a:s}}function vt(t,e){return h(ft,t)?ft[t](e._strict,e._locale):new RegExp(function(t){return bt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,s,a,i){return e||s||a||i}))}(t))}function bt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var yt={};function wt(t,s){var e,a=s;for("string"==typeof t&&(t=[t]),"number"==typeof s&&(a=function(t,e){e[s]=w(t)}),e=0;e<t.length;e++)yt[t[e]]=a}function kt(t,i){wt(t,function(t,e,s,a){s._w=s._w||{},i(t,s._w,s,a)})}var xt,Ct=0,_t=1,Pt=2,At=3,Mt=4,Dt=5,Tt=6,St=7,Et=8;function Ot(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}xt=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1},W("M",["MM",2],"Mo",function(){return this.month()+1}),W("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),W("MMMM",0,0,function(t){return this.localeData().months(this,t)}),Y("month","M"),gt("M",it),gt("MM",it,tt),gt("MMM",function(t,e){return e.monthsShortRegex(t)}),gt("MMMM",function(t,e){return e.monthsRegex(t)}),wt(["M","MM"],function(t,e){e[_t]=w(t)-1}),wt(["MMM","MMMM"],function(t,e,s,a){var i=s._locale.monthsParse(t,a,s._strict);null!=i?e[_t]=i:m(s).invalidMonth=t});var Lt=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Bt="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var It="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function jt(t,e){var s;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=w(e);else if("number"!=typeof(e=t.localeData().monthsParse(e)))return t;return s=Math.min(t.date(),Ot(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,s),t}function Ft(t){return null!=t?(jt(this,t),p.updateOffset(this,!0),this):H(this,"Month")}var Yt=mt;var Rt=mt;function zt(){function t(t,e){return e.length-t.length}var e,s,a=[],i=[],n=[];for(e=0;e<12;e++)s=d([2e3,e]),a.push(this.monthsShort(s,"")),i.push(this.months(s,"")),n.push(this.months(s,"")),n.push(this.monthsShort(s,""));for(a.sort(t),i.sort(t),n.sort(t),e=0;e<12;e++)a[e]=bt(a[e]),i[e]=bt(i[e]),n[e]=bt(n[e]);this._monthsRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qt(t){var e,s=t._a;return s&&-2===m(t).overflow&&(e=s[_t]<0||11<s[_t]?_t:s[Pt]<1||s[Pt]>Ot(s[Ct],s[_t])?Pt:s[At]<0||24<s[At]||24===s[At]&&(0!==s[Mt]||0!==s[Dt]||0!==s[Tt])?At:s[Mt]<0||59<s[Mt]?Mt:s[Dt]<0||59<s[Dt]?Dt:s[Tt]<0||999<s[Tt]?Tt:-1,m(t)._overflowDayOfYear&&(e<Ct||Pt<e)&&(e=Pt),m(t)._overflowWeeks&&-1===e&&(e=St),m(t)._overflowWeekday&&-1===e&&(e=Et),m(t).overflow=e),t}var Ht=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Nt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,$t=/Z|[+-]\d\d(?::?\d\d)?/,Ut=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],qt=/^\/?Date\((\-?\d+)/i;function Vt(t){var e,s,a,i,n,o,r=t._i,l=Ht.exec(r)||Nt.exec(r);if(l){for(m(t).iso=!0,e=0,s=Ut.length;e<s;e++)if(Ut[e][1].exec(l[1])){i=Ut[e][0],a=!1!==Ut[e][2];break}if(null==i)return void(t._isValid=!1);if(l[3]){for(e=0,s=Gt.length;e<s;e++)if(Gt[e][1].exec(l[3])){n=(l[2]||" ")+Gt[e][0];break}if(null==n)return void(t._isValid=!1)}if(!a&&null!=n)return void(t._isValid=!1);if(l[4]){if(!$t.exec(l[4]))return void(t._isValid=!1);o="Z"}t._f=i+(n||"")+(o||""),ne(t)}else t._isValid=!1}function Kt(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&0<=t&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function Wt(t){return Jt(t)?366:365}function Jt(t){return t%4==0&&t%100!=0||t%400==0}p.createFromInputFallback=s("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),W("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),W(0,["YY",2],0,function(){return this.year()%100}),W(0,["YYYY",4],0,"year"),W(0,["YYYYY",5],0,"year"),W(0,["YYYYYY",6,!0],0,"year"),Y("year","y"),gt("Y",ut),gt("YY",it,tt),gt("YYYY",lt,st),gt("YYYYY",ct,at),gt("YYYYYY",ct,at),wt(["YYYYY","YYYYYY"],Ct),wt("YYYY",function(t,e){e[Ct]=2===t.length?p.parseTwoDigitYear(t):w(t)}),wt("YY",function(t,e){e[Ct]=p.parseTwoDigitYear(t)}),wt("Y",function(t,e){e[Ct]=parseInt(t,10)}),p.parseTwoDigitYear=function(t){return w(t)+(68<w(t)?1900:2e3)};var Zt=Q("FullYear",!0);function Xt(t,e,s){var a=7+e-s;return a-(7+Kt(t,0,a).getUTCDay()-e)%7-1}function te(t,e,s,a,i){var n,o,r=1+7*(e-1)+(7+s-a)%7+Xt(t,a,i);return o=r<=0?Wt(n=t-1)+r:r>Wt(t)?(n=t+1,r-Wt(t)):(n=t,r),{year:n,dayOfYear:o}}function ee(t,e,s){var a,i,n=Xt(t.year(),e,s),o=Math.floor((t.dayOfYear()-n-1)/7)+1;return o<1?a=o+se(i=t.year()-1,e,s):o>se(t.year(),e,s)?(a=o-se(t.year(),e,s),i=t.year()+1):(i=t.year(),a=o),{week:a,year:i}}function se(t,e,s){var a=Xt(t,e,s),i=Xt(t+1,e,s);return(Wt(t)-a+i)/7}function ae(t,e,s){return null!=t?t:null!=e?e:s}function ie(t){var e,s,a,i,n=[];if(!t._d){for(a=function(t){var e=new Date(p.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}(t),t._w&&null==t._a[Pt]&&null==t._a[_t]&&function(t){var e,s,a,i,n,o,r,l;null!=(e=t._w).GG||null!=e.W||null!=e.E?(n=1,o=4,s=ae(e.GG,t._a[Ct],ee(le(),1,4).year),a=ae(e.W,1),((i=ae(e.E,1))<1||7<i)&&(l=!0)):(n=t._locale._week.dow,o=t._locale._week.doy,s=ae(e.gg,t._a[Ct],ee(le(),n,o).year),a=ae(e.w,1),null!=e.d?((i=e.d)<0||6<i)&&(l=!0):null!=e.e?(i=e.e+n,(e.e<0||6<e.e)&&(l=!0)):i=n);a<1||a>se(s,n,o)?m(t)._overflowWeeks=!0:null!=l?m(t)._overflowWeekday=!0:(r=te(s,a,i,n,o),t._a[Ct]=r.year,t._dayOfYear=r.dayOfYear)}(t),t._dayOfYear&&(i=ae(t._a[Ct],a[Ct]),t._dayOfYear>Wt(i)&&(m(t)._overflowDayOfYear=!0),s=Kt(i,0,t._dayOfYear),t._a[_t]=s.getUTCMonth(),t._a[Pt]=s.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=n[e]=a[e];for(;e<7;e++)t._a[e]=n[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[At]&&0===t._a[Mt]&&0===t._a[Dt]&&0===t._a[Tt]&&(t._nextDay=!0,t._a[At]=0),t._d=(t._useUTC?Kt:function(t,e,s,a,i,n,o){var r=new Date(t,e,s,a,i,n,o);return t<100&&0<=t&&isFinite(r.getFullYear())&&r.setFullYear(t),r}).apply(null,n),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[At]=24)}}function ne(t){if(t._f!==p.ISO_8601){t._a=[],m(t).empty=!0;var e,s,a,i,n,o,r,l,c=""+t._i,d=c.length,u=0;for(a=Z(t._f,t._locale).match(G)||[],e=0;e<a.length;e++)i=a[e],(s=(c.match(vt(i,t))||[])[0])&&(0<(n=c.substr(0,c.indexOf(s))).length&&m(t).unusedInput.push(n),c=c.slice(c.indexOf(s)+s.length),u+=s.length),K[i]?(s?m(t).empty=!1:m(t).unusedTokens.push(i),o=i,l=t,null!=(r=s)&&h(yt,o)&&yt[o](r,l._a,l,o)):t._strict&&!s&&m(t).unusedTokens.push(i);m(t).charsLeftOver=d-u,0<c.length&&m(t).unusedInput.push(c),!0===m(t).bigHour&&t._a[At]<=12&&0<t._a[At]&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[At]=function(t,e,s){var a;if(null==s)return e;return null!=t.meridiemHour?t.meridiemHour(e,s):(null!=t.isPM&&((a=t.isPM(s))&&e<12&&(e+=12),a||12!==e||(e=0)),e)}(t._locale,t._a[At],t._meridiem),ie(t),Qt(t)}else Vt(t)}function oe(t){var e=t._i,s=t._f;return t._locale=t._locale||j(t._l),null===e||void 0===s&&""===e?c({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),b(e)?new v(Qt(e)):(i(s)?function(t){var e,s,a,i,n;if(0===t._f.length)return m(t).invalidFormat=!0,t._d=new Date(NaN);for(i=0;i<t._f.length;i++)n=0,e=g({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[i],ne(e),l(e)&&(n+=m(e).charsLeftOver,n+=10*m(e).unusedTokens.length,m(e).score=n,(null==a||n<a)&&(a=n,s=e));r(t,s||e)}(t):s?ne(t):n(e)?t._d=e:function(t){var e=t._i;void 0===e?t._d=new Date(p.now()):n(e)?t._d=new Date(e.valueOf()):"string"==typeof e?function(t){var e=qt.exec(t._i);null===e?(Vt(t),!1===t._isValid&&(delete t._isValid,p.createFromInputFallback(t))):t._d=new Date(+e[1])}(t):i(e)?(t._a=o(e.slice(0),function(t){return parseInt(t,10)}),ie(t)):"object"==typeof e?function(t){if(!t._d){var e=z(t._i);t._a=o([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),ie(t)}}(t):"number"==typeof e?t._d=new Date(e):p.createFromInputFallback(t)}(t),l(t)||(t._d=null),t))}function re(t,e,s,a,i){var n={};return"boolean"==typeof s&&(a=s,s=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=s,n._i=t,n._f=e,n._strict=a,function(t){var e=new v(Qt(oe(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}(n)}function le(t,e,s,a){return re(t,e,s,a,!1)}p.ISO_8601=function(){};var ce=s("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=le.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:c()}),de=s("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=le.apply(null,arguments);return this.isValid()&&t.isValid()?this<t?this:t:c()});function ue(t,e){var s,a;if(1===e.length&&i(e[0])&&(e=e[0]),!e.length)return le();for(s=e[0],a=1;a<e.length;++a)e[a].isValid()&&!e[a][t](s)||(s=e[a]);return s}function pe(t){var e=z(t),s=e.year||0,a=e.quarter||0,i=e.month||0,n=e.week||0,o=e.day||0,r=e.hour||0,l=e.minute||0,c=e.second||0,d=e.millisecond||0;this._milliseconds=+d+1e3*c+6e4*l+1e3*r*60*60,this._days=+o+7*n,this._months=+i+3*a+12*s,this._data={},this._locale=j(),this._bubble()}function he(t){return t instanceof pe}function me(t,s){W(t,0,0,function(){var t=this.utcOffset(),e="+";return t<0&&(t=-t,e="-"),e+U(~~(t/60),2)+s+U(~~t%60,2)})}me("Z",":"),me("ZZ",""),gt("Z",ht),gt("ZZ",ht),wt(["Z","ZZ"],function(t,e,s){s._useUTC=!0,s._tzm=ge(ht,t)});var fe=/([\+\-]|\d\d)/gi;function ge(t,e){var s=(e||"").match(t)||[],a=((s[s.length-1]||[])+"").match(fe)||["-",0,0],i=60*a[1]+w(a[2]);return"+"===a[0]?i:-i}function ve(t,e){var s,a;return e._isUTC?(s=e.clone(),a=(b(t)||n(t)?t.valueOf():le(t).valueOf())-s.valueOf(),s._d.setTime(s._d.valueOf()+a),p.updateOffset(s,!1),s):le(t).local()}function be(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function ye(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}p.updateOffset=function(){};var we=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function xe(t,e){var s,a,i,n=t,o=null;return he(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(n={},e?n[e]=t:n.milliseconds=t):(o=we.exec(t))?(s="-"===o[1]?-1:1,n={y:0,d:w(o[Pt])*s,h:w(o[At])*s,m:w(o[Mt])*s,s:w(o[Dt])*s,ms:w(o[Tt])*s}):(o=ke.exec(t))?(s="-"===o[1]?-1:1,n={y:Ce(o[2],s),M:Ce(o[3],s),w:Ce(o[4],s),d:Ce(o[5],s),h:Ce(o[6],s),m:Ce(o[7],s),s:Ce(o[8],s)}):null==n?n={}:"object"==typeof n&&("from"in n||"to"in n)&&(i=function(t,e){var s;if(!t.isValid()||!e.isValid())return{milliseconds:0,months:0};e=ve(e,t),t.isBefore(e)?s=_e(t,e):((s=_e(e,t)).milliseconds=-s.milliseconds,s.months=-s.months);return s}(le(n.from),le(n.to)),(n={}).ms=i.milliseconds,n.M=i.months),a=new pe(n),he(t)&&h(t,"_locale")&&(a._locale=t._locale),a}function Ce(t,e){var s=t&&parseFloat(t.replace(",","."));return(isNaN(s)?0:s)*e}function _e(t,e){var s={milliseconds:0,months:0};return s.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(s.months,"M").isAfter(e)&&--s.months,s.milliseconds=e-t.clone().add(s.months,"M"),s}function Pe(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function Ae(a,i){return function(t,e){var s;return null===e||isNaN(+e)||(P(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period)."),s=t,t=e,e=s),Me(this,xe(t="string"==typeof t?+t:t,e),a),this}}function Me(t,e,s,a){var i=e._milliseconds,n=Pe(e._days),o=Pe(e._months);t.isValid()&&(a=null==a||a,i&&t._d.setTime(t._d.valueOf()+i*s),n&&N(t,"Date",H(t,"Date")+n*s),o&&jt(t,H(t,"Month")+o*s),a&&p.updateOffset(t,n||o))}xe.fn=pe.prototype;var De=Ae(1,"add"),Te=Ae(-1,"subtract");function Se(t){var e;return void 0===t?this._locale._abbr:(null!=(e=j(t))&&(this._locale=e),this)}p.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",p.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Ee=s("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});function Oe(){return this._locale}function Le(t,e){W(0,[t,t.length],0,e)}function Be(t,e,s,a,i){var n;return null==t?ee(this,a,i).year:((n=se(t,a,i))<e&&(e=n),function(t,e,s,a,i){var n=te(t,e,s,a,i),o=Kt(n.year,0,n.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}.call(this,t,e,s,a,i))}W(0,["gg",2],0,function(){return this.weekYear()%100}),W(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Le("gggg","weekYear"),Le("ggggg","weekYear"),Le("GGGG","isoWeekYear"),Le("GGGGG","isoWeekYear"),Y("weekYear","gg"),Y("isoWeekYear","GG"),gt("G",ut),gt("g",ut),gt("GG",it,tt),gt("gg",it,tt),gt("GGGG",lt,st),gt("gggg",lt,st),gt("GGGGG",ct,at),gt("ggggg",ct,at),kt(["gggg","ggggg","GGGG","GGGGG"],function(t,e,s,a){e[a.substr(0,2)]=w(t)}),kt(["gg","GG"],function(t,e,s,a){e[a]=p.parseTwoDigitYear(t)}),W("Q",0,"Qo","quarter"),Y("quarter","Q"),gt("Q",X),wt("Q",function(t,e){e[_t]=3*(w(t)-1)}),W("w",["ww",2],"wo","week"),W("W",["WW",2],"Wo","isoWeek"),Y("week","w"),Y("isoWeek","W"),gt("w",it),gt("ww",it,tt),gt("W",it),gt("WW",it,tt),kt(["w","ww","W","WW"],function(t,e,s,a){e[a.substr(0,1)]=w(t)});W("D",["DD",2],"Do","date"),Y("date","D"),gt("D",it),gt("DD",it,tt),gt("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),wt(["D","DD"],Pt),wt("Do",function(t,e){e[Pt]=w(t.match(it)[0])});var Ie=Q("Date",!0);W("d",0,"do","day"),W("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),W("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),W("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),W("e",0,0,"weekday"),W("E",0,0,"isoWeekday"),Y("day","d"),Y("weekday","e"),Y("isoWeekday","E"),gt("d",it),gt("e",it),gt("E",it),gt("dd",function(t,e){return e.weekdaysMinRegex(t)}),gt("ddd",function(t,e){return e.weekdaysShortRegex(t)}),gt("dddd",function(t,e){return e.weekdaysRegex(t)}),kt(["dd","ddd","dddd"],function(t,e,s,a){var i=s._locale.weekdaysParse(t,a,s._strict);null!=i?e.d=i:m(s).invalidWeekday=t}),kt(["d","e","E"],function(t,e,s,a){e[a]=w(t)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Fe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ye="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Re=mt;var ze=mt;var Qe=mt;function He(){function t(t,e){return e.length-t.length}var e,s,a,i,n,o=[],r=[],l=[],c=[];for(e=0;e<7;e++)s=d([2e3,1]).day(e),a=this.weekdaysMin(s,""),i=this.weekdaysShort(s,""),n=this.weekdays(s,""),o.push(a),r.push(i),l.push(n),c.push(a),c.push(i),c.push(n);for(o.sort(t),r.sort(t),l.sort(t),c.sort(t),e=0;e<7;e++)r[e]=bt(r[e]),l[e]=bt(l[e]),c[e]=bt(c[e]);this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function Ne(){return this.hours()%12||12}function $e(t,e){W(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Ue(t,e){return e._meridiemParse}W("DDD",["DDDD",3],"DDDo","dayOfYear"),Y("dayOfYear","DDD"),gt("DDD",rt),gt("DDDD",et),wt(["DDD","DDDD"],function(t,e,s){s._dayOfYear=w(t)}),W("H",["HH",2],0,"hour"),W("h",["hh",2],0,Ne),W("k",["kk",2],0,function(){return this.hours()||24}),W("hmm",0,0,function(){return""+Ne.apply(this)+U(this.minutes(),2)}),W("hmmss",0,0,function(){return""+Ne.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),W("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),W("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),$e("a",!0),$e("A",!1),Y("hour","h"),gt("a",Ue),gt("A",Ue),gt("H",it),gt("h",it),gt("HH",it,tt),gt("hh",it,tt),gt("hmm",nt),gt("hmmss",ot),gt("Hmm",nt),gt("Hmmss",ot),wt(["H","HH"],At),wt(["a","A"],function(t,e,s){s._isPm=s._locale.isPM(t),s._meridiem=t}),wt(["h","hh"],function(t,e,s){e[At]=w(t),m(s).bigHour=!0}),wt("hmm",function(t,e,s){var a=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a)),m(s).bigHour=!0}),wt("hmmss",function(t,e,s){var a=t.length-4,i=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a,2)),e[Dt]=w(t.substr(i)),m(s).bigHour=!0}),wt("Hmm",function(t,e,s){var a=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a))}),wt("Hmmss",function(t,e,s){var a=t.length-4,i=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a,2)),e[Dt]=w(t.substr(i))});var Ge=Q("Hours",!0);W("m",["mm",2],0,"minute"),Y("minute","m"),gt("m",it),gt("mm",it,tt),wt(["m","mm"],Mt);var qe=Q("Minutes",!1);W("s",["ss",2],0,"second"),Y("second","s"),gt("s",it),gt("ss",it,tt),wt(["s","ss"],Dt);var Ve,Ke=Q("Seconds",!1);for(W("S",0,0,function(){return~~(this.millisecond()/100)}),W(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),W(0,["SSS",3],0,"millisecond"),W(0,["SSSS",4],0,function(){return 10*this.millisecond()}),W(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),W(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),W(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),W(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),W(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),Y("millisecond","ms"),gt("S",rt,X),gt("SS",rt,tt),gt("SSS",rt,et),Ve="SSSS";Ve.length<=9;Ve+="S")gt(Ve,dt);function We(t,e){e[Tt]=w(1e3*("0."+t))}for(Ve="S";Ve.length<=9;Ve+="S")wt(Ve,We);var Je=Q("Milliseconds",!1);W("z",0,0,"zoneAbbr"),W("zz",0,0,"zoneName");var Ze=v.prototype;Ze.add=De,Ze.calendar=function(t,e){var s=t||le(),a=ve(s,this).startOf("day"),i=this.diff(a,"days",!0),n=i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse",o=e&&(A(e[n])?e[n]():e[n]);return this.format(o||this.localeData().calendar(n,this,le(s)))},Ze.clone=function(){return new v(this)},Ze.diff=function(t,e,s){var a,i,n,o;return this.isValid()&&(a=ve(t,this)).isValid()?(i=6e4*(a.utcOffset()-this.utcOffset()),"year"===(e=R(e))||"month"===e||"quarter"===e?(o=function(t,e){var s,a,i=12*(e.year()-t.year())+(e.month()-t.month()),n=t.clone().add(i,"months");a=e-n<0?(s=t.clone().add(i-1,"months"),(e-n)/(n-s)):(s=t.clone().add(1+i,"months"),(e-n)/(s-n));return-(i+a)||0}(this,a),"quarter"===e?o/=3:"year"===e&&(o/=12)):(n=this-a,o="second"===e?n/1e3:"minute"===e?n/6e4:"hour"===e?n/36e5:"day"===e?(n-i)/864e5:"week"===e?(n-i)/6048e5:n),s?o:y(o)):NaN},Ze.endOf=function(t){return void 0===(t=R(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))},Ze.format=function(t){t=t||(this.isUtc()?p.defaultFormatUtc:p.defaultFormat);var e=J(this,t);return this.localeData().postformat(e)},Ze.from=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||le(t).isValid())?xe({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Ze.fromNow=function(t){return this.from(le(),t)},Ze.to=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||le(t).isValid())?xe({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Ze.toNow=function(t){return this.to(le(),t)},Ze.get=$,Ze.invalidAt=function(){return m(this).overflow},Ze.isAfter=function(t,e){var s=b(t)?t:le(t);return!(!this.isValid()||!s.isValid())&&("millisecond"===(e=R(u(e)?"millisecond":e))?this.valueOf()>s.valueOf():s.valueOf()<this.clone().startOf(e).valueOf())},Ze.isBefore=function(t,e){var s=b(t)?t:le(t);return!(!this.isValid()||!s.isValid())&&("millisecond"===(e=R(u(e)?"millisecond":e))?this.valueOf()<s.valueOf():this.clone().endOf(e).valueOf()<s.valueOf())},Ze.isBetween=function(t,e,s,a){return("("===(a=a||"()")[0]?this.isAfter(t,s):!this.isBefore(t,s))&&(")"===a[1]?this.isBefore(e,s):!this.isAfter(e,s))},Ze.isSame=function(t,e){var s,a=b(t)?t:le(t);return!(!this.isValid()||!a.isValid())&&("millisecond"===(e=R(e||"millisecond"))?this.valueOf()===a.valueOf():(s=a.valueOf(),this.clone().startOf(e).valueOf()<=s&&s<=this.clone().endOf(e).valueOf()))},Ze.isSameOrAfter=function(t,e){return this.isSame(t,e)||this.isAfter(t,e)},Ze.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)},Ze.isValid=function(){return l(this)},Ze.lang=Ee,Ze.locale=Se,Ze.localeData=Oe,Ze.max=de,Ze.min=ce,Ze.parsingFlags=function(){return r({},m(this))},Ze.set=$,Ze.startOf=function(t){switch(t=R(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this},Ze.subtract=Te,Ze.toArray=function(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]},Ze.toObject=function(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}},Ze.toDate=function(){return this._offset?new Date(this.valueOf()):this._d},Ze.toISOString=function(){var t=this.clone().utc();return 0<t.year()&&t.year()<=9999?A(Date.prototype.toISOString)?this.toDate().toISOString():J(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):J(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},Ze.toJSON=function(){return this.isValid()?this.toISOString():null},Ze.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Ze.unix=function(){return Math.floor(this.valueOf()/1e3)},Ze.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Ze.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Ze.year=Zt,Ze.isLeapYear=function(){return Jt(this.year())},Ze.weekYear=function(t){return Be.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Ze.isoWeekYear=function(t){return Be.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)},Ze.quarter=Ze.quarters=function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},Ze.month=Ft,Ze.daysInMonth=function(){return Ot(this.year(),this.month())},Ze.week=Ze.weeks=function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},Ze.isoWeek=Ze.isoWeeks=function(t){var e=ee(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},Ze.weeksInYear=function(){var t=this.localeData()._week;return se(this.year(),t.dow,t.doy)},Ze.isoWeeksInYear=function(){return se(this.year(),1,4)},Ze.date=Ie,Ze.day=Ze.days=function(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=function(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}(t,this.localeData()),this.add(t-e,"d")):e},Ze.weekday=function(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},Ze.isoWeekday=function(t){return this.isValid()?null==t?this.day()||7:this.day(this.day()%7?t:t-7):null!=t?this:NaN},Ze.dayOfYear=function(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},Ze.hour=Ze.hours=Ge,Ze.minute=Ze.minutes=qe,Ze.second=Ze.seconds=Ke,Ze.millisecond=Ze.milliseconds=Je,Ze.utcOffset=function(t,e){var s,a=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=ge(ht,t):Math.abs(t)<16&&(t*=60),!this._isUTC&&e&&(s=be(this)),this._offset=t,this._isUTC=!0,null!=s&&this.add(s,"m"),a!==t&&(!e||this._changeInProgress?Me(this,xe(t-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,p.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?a:be(this):null!=t?this:NaN},Ze.utc=function(t){return this.utcOffset(0,t)},Ze.local=function(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(be(this),"m")),this},Ze.parseZone=function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(ge(pt,this._i)),this},Ze.hasAlignedHourOffset=function(t){return!!this.isValid()&&(t=t?le(t).utcOffset():0,(this.utcOffset()-t)%60==0)},Ze.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Ze.isDSTShifted=function(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t={};if(g(t,this),(t=oe(t))._a){var e=t._isUTC?d(t._a):le(t._a);this._isDSTShifted=this.isValid()&&0<k(t._a,e.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted},Ze.isLocal=function(){return!!this.isValid()&&!this._isUTC},Ze.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Ze.isUtc=ye,Ze.isUTC=ye,Ze.zoneAbbr=function(){return this._isUTC?"UTC":""},Ze.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Ze.dates=s("dates accessor is deprecated. Use date instead.",Ie),Ze.months=s("months accessor is deprecated. Use month instead",Ft),Ze.years=s("years accessor is deprecated. Use year instead",Zt),Ze.zone=s("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()});var Xe=Ze;function ts(t){return t}var es=T.prototype;function ss(t,e,s,a){var i=j(),n=d().set(a,e);return i[s](n,t)}function as(t,e,s){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return ss(t,e,s,"month");var a,i=[];for(a=0;a<12;a++)i[a]=ss(t,a,s,"month");return i}function is(t,e,s,a){e=("boolean"==typeof t?"number"==typeof e&&(s=e,e=void 0):(e=t,t=!1,"number"==typeof(s=e)&&(s=e,e=void 0)),e||"");var i,n=j(),o=t?n._week.dow:0;if(null!=s)return ss(e,(s+o)%7,a,"day");var r=[];for(i=0;i<7;i++)r[i]=ss(e,(i+o)%7,a,"day");return r}es._calendar={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},es.calendar=function(t,e,s){var a=this._calendar[t];return A(a)?a.call(e,s):a},es._longDateFormat={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},es.longDateFormat=function(t){var e=this._longDateFormat[t],s=this._longDateFormat[t.toUpperCase()];return e||!s?e:(this._longDateFormat[t]=s.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])},es._invalidDate="Invalid date",es.invalidDate=function(){return this._invalidDate},es._ordinal="%d",es.ordinal=function(t){return this._ordinal.replace("%d",t)},es._ordinalParse=/\d{1,2}/,es.preparse=ts,es.postformat=ts,es._relativeTime={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},es.relativeTime=function(t,e,s,a){var i=this._relativeTime[s];return A(i)?i(t,e,s,a):i.replace(/%d/i,t)},es.pastFuture=function(t,e){var s=this._relativeTime[0<t?"future":"past"];return A(s)?s(e):s.replace(/%s/i,e)},es.set=function(t){var e,s;for(s in t)A(e=t[s])?this[s]=e:this["_"+s]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},es.months=function(t,e){return i(this._months)?this._months[t.month()]:this._months[Lt.test(e)?"format":"standalone"][t.month()]},es._months=Bt,es.monthsShort=function(t,e){return i(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Lt.test(e)?"format":"standalone"][t.month()]},es._monthsShort=It,es.monthsParse=function(t,e,s){var a,i,n;if(this._monthsParseExact)return function(t,e,s){var a,i,n,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],a=0;a<12;++a)n=d([2e3,a]),this._shortMonthsParse[a]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[a]=this.months(n,"").toLocaleLowerCase();return s?"MMM"===e?-1!==(i=xt.call(this._shortMonthsParse,o))?i:null:-1!==(i=xt.call(this._longMonthsParse,o))?i:null:"MMM"===e?-1!==(i=xt.call(this._shortMonthsParse,o))?i:-1!==(i=xt.call(this._longMonthsParse,o))?i:null:-1!==(i=xt.call(this._longMonthsParse,o))?i:-1!==(i=xt.call(this._shortMonthsParse,o))?i:null}.call(this,t,e,s);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),a=0;a<12;a++){if(i=d([2e3,a]),s&&!this._longMonthsParse[a]&&(this._longMonthsParse[a]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[a]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),s||this._monthsParse[a]||(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[a]=new RegExp(n.replace(".",""),"i")),s&&"MMMM"===e&&this._longMonthsParse[a].test(t))return a;if(s&&"MMM"===e&&this._shortMonthsParse[a].test(t))return a;if(!s&&this._monthsParse[a].test(t))return a}},es._monthsRegex=Rt,es.monthsRegex=function(t){return this._monthsParseExact?(h(this,"_monthsRegex")||zt.call(this),t?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex},es._monthsShortRegex=Yt,es.monthsShortRegex=function(t){return this._monthsParseExact?(h(this,"_monthsRegex")||zt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex},es.week=function(t){return ee(t,this._week.dow,this._week.doy).week},es._week={dow:0,doy:6},es.firstDayOfYear=function(){return this._week.doy},es.firstDayOfWeek=function(){return this._week.dow},es.weekdays=function(t,e){return i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]},es._weekdays=je,es.weekdaysMin=function(t){return this._weekdaysMin[t.day()]},es._weekdaysMin=Ye,es.weekdaysShort=function(t){return this._weekdaysShort[t.day()]},es._weekdaysShort=Fe,es.weekdaysParse=function(t,e,s){var a,i,n;if(this._weekdaysParseExact)return function(t,e,s){var a,i,n,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],a=0;a<7;++a)n=d([2e3,1]).day(a),this._minWeekdaysParse[a]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[a]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[a]=this.weekdays(n,"").toLocaleLowerCase();return s?"dddd"===e?-1!==(i=xt.call(this._weekdaysParse,o))?i:null:"ddd"===e?-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:null:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:"dddd"===e?-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:"ddd"===e?-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:null}.call(this,t,e,s);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),a=0;a<7;a++){if(i=d([2e3,1]).day(a),s&&!this._fullWeekdaysParse[a]&&(this._fullWeekdaysParse[a]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[a]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[a]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[a]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[a]=new RegExp(n.replace(".",""),"i")),s&&"dddd"===e&&this._fullWeekdaysParse[a].test(t))return a;if(s&&"ddd"===e&&this._shortWeekdaysParse[a].test(t))return a;if(s&&"dd"===e&&this._minWeekdaysParse[a].test(t))return a;if(!s&&this._weekdaysParse[a].test(t))return a}},es._weekdaysRegex=Re,es.weekdaysRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex},es._weekdaysShortRegex=ze,es.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex},es._weekdaysMinRegex=Qe,es.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex},es.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},es._meridiemParse=/[ap]\.?m?\.?/i,es.meridiem=function(t,e,s){return 11<t?s?"pm":"PM":s?"am":"AM"},B("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===w(t%100/10)?"th":1==e?"st":2==e?"nd":3==e?"rd":"th")}}),p.lang=s("moment.lang is deprecated. Use moment.locale instead.",B),p.langData=s("moment.langData is deprecated. Use moment.localeData instead.",j);var ns=Math.abs;function os(t,e,s,a){var i=xe(e,s);return t._milliseconds+=a*i._milliseconds,t._days+=a*i._days,t._months+=a*i._months,t._bubble()}function rs(t){return t<0?Math.floor(t):Math.ceil(t)}function ls(t){return 4800*t/146097}function cs(t){return 146097*t/4800}function ds(t){return function(){return this.as(t)}}var us=ds("ms"),ps=ds("s"),hs=ds("m"),ms=ds("h"),fs=ds("d"),gs=ds("w"),vs=ds("M"),bs=ds("y");function ys(t){return function(){return this._data[t]}}var ws=ys("milliseconds"),ks=ys("seconds"),xs=ys("minutes"),Cs=ys("hours"),_s=ys("days"),Ps=ys("months"),As=ys("years");var Ms=Math.round,Ds={s:45,m:45,h:22,d:26,M:11};function Ts(t,e,s){var a=xe(t).abs(),i=Ms(a.as("s")),n=Ms(a.as("m")),o=Ms(a.as("h")),r=Ms(a.as("d")),l=Ms(a.as("M")),c=Ms(a.as("y")),d=i<Ds.s&&["s",i]||n<=1&&["m"]||n<Ds.m&&["mm",n]||o<=1&&["h"]||o<Ds.h&&["hh",o]||r<=1&&["d"]||r<Ds.d&&["dd",r]||l<=1&&["M"]||l<Ds.M&&["MM",l]||c<=1&&["y"]||["yy",c];return d[2]=e,d[3]=0<+t,d[4]=s,function(t,e,s,a,i){return i.relativeTime(e||1,!!s,t,a)}.apply(null,d)}var Ss=Math.abs;function Es(){var t,e,s=Ss(this._milliseconds)/1e3,a=Ss(this._days),i=Ss(this._months);t=y(s/60),e=y(t/60),s%=60,t%=60;var n=y(i/12),o=i%=12,r=a,l=e,c=t,d=s,u=this.asSeconds();return u?(u<0?"-":"")+"P"+(n?n+"Y":"")+(o?o+"M":"")+(r?r+"D":"")+(l||c||d?"T":"")+(l?l+"H":"")+(c?c+"M":"")+(d?d+"S":""):"P0D"}var Os=pe.prototype;return Os.abs=function(){var t=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),t.milliseconds=ns(t.milliseconds),t.seconds=ns(t.seconds),t.minutes=ns(t.minutes),t.hours=ns(t.hours),t.months=ns(t.months),t.years=ns(t.years),this},Os.add=function(t,e){return os(this,t,e,1)},Os.subtract=function(t,e){return os(this,t,e,-1)},Os.as=function(t){var e,s,a=this._milliseconds;if("month"===(t=R(t))||"year"===t)return e=this._days+a/864e5,s=this._months+ls(e),"month"===t?s:s/12;switch(e=this._days+Math.round(cs(this._months)),t){case"week":return e/7+a/6048e5;case"day":return e+a/864e5;case"hour":return 24*e+a/36e5;case"minute":return 1440*e+a/6e4;case"second":return 86400*e+a/1e3;case"millisecond":return Math.floor(864e5*e)+a;default:throw new Error("Unknown unit "+t)}},Os.asMilliseconds=us,Os.asSeconds=ps,Os.asMinutes=hs,Os.asHours=ms,Os.asDays=fs,Os.asWeeks=gs,Os.asMonths=vs,Os.asYears=bs,Os.valueOf=function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12)},Os._bubble=function(){var t,e,s,a,i,n=this._milliseconds,o=this._days,r=this._months,l=this._data;return 0<=n&&0<=o&&0<=r||n<=0&&o<=0&&r<=0||(n+=864e5*rs(cs(r)+o),r=o=0),l.milliseconds=n%1e3,t=y(n/1e3),l.seconds=t%60,e=y(t/60),l.minutes=e%60,s=y(e/60),l.hours=s%24,o+=y(s/24),r+=i=y(ls(o)),o-=rs(cs(i)),a=y(r/12),r%=12,l.days=o,l.months=r,l.years=a,this},Os.get=function(t){return this[(t=R(t))+"s"]()},Os.milliseconds=ws,Os.seconds=ks,Os.minutes=xs,Os.hours=Cs,Os.days=_s,Os.weeks=function(){return y(this.days()/7)},Os.months=Ps,Os.years=As,Os.humanize=function(t){var e=this.localeData(),s=Ts(this,!t,e);return t&&(s=e.pastFuture(+this,s)),e.postformat(s)},Os.toISOString=Es,Os.toString=Es,Os.toJSON=Es,Os.locale=Se,Os.localeData=Oe,Os.toIsoString=s("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Es),Os.lang=Ee,W("X",0,0,"unix"),W("x",0,0,"valueOf"),gt("x",ut),gt("X",/[+-]?\d+(\.\d{1,3})?/),wt("X",function(t,e,s){s._d=new Date(1e3*parseFloat(t,10))}),wt("x",function(t,e,s){s._d=new Date(w(t))}),p.version="2.13.0",t=le,p.fn=Xe,p.min=function(){return ue("isBefore",[].slice.call(arguments,0))},p.max=function(){return ue("isAfter",[].slice.call(arguments,0))},p.now=function(){return Date.now?Date.now():+new Date},p.utc=d,p.unix=function(t){return le(1e3*t)},p.months=function(t,e){return as(t,e,"months")},p.isDate=n,p.locale=B,p.invalid=c,p.duration=xe,p.isMoment=b,p.weekdays=function(t,e,s){return is(t,e,s,"weekdays")},p.parseZone=function(){return le.apply(null,arguments).parseZone()},p.localeData=j,p.isDuration=he,p.monthsShort=function(t,e){return as(t,e,"monthsShort")},p.weekdaysMin=function(t,e,s){return is(t,e,s,"weekdaysMin")},p.defineLocale=I,p.updateLocale=function(t,e){var s;return null!=e?(null!=E[t]&&(e=D(E[t]._config,e)),(s=new T(e)).parentLocale=E[t],E[t]=s,B(t)):null!=E[t]&&(null!=E[t].parentLocale?E[t]=E[t].parentLocale:null!=E[t]&&delete E[t]),E[t]},p.locales=function(){return C(E)},p.weekdaysShort=function(t,e,s){return is(t,e,s,"weekdaysShort")},p.normalizeUnits=R,p.relativeTimeThreshold=function(t,e){return void 0!==Ds[t]&&(void 0===e?Ds[t]:(Ds[t]=e,!0))},p.prototype=Xe,p}),(typeof define==="function"&&define.amd?define:function(t,e){if(typeof module!=="undefined"&&module.exports){module.exports=e(require("jquery"))}else{window.toastr=e(window.jQuery)}})(["jquery"],function(g){return C=0,n="error",o="info",r="success",l="warning",t={clear:function(t,e){var s=y();k||v(s);a(t,s,e)||function(t){for(var e=k.children(),s=e.length-1;0<=s;s--)a(g(e[s]),t)}(s)},remove:function(t){var e=y();k||v(e);if(t&&0===g(":focus",t).length)return void w(t);k.children().length&&k.remove()},error:function(t,e,s){return i({type:n,iconClass:y().iconClasses.error,message:t,optionsOverride:s,title:e})},getContainer:v,info:function(t,e,s){return i({type:o,iconClass:y().iconClasses.info,message:t,optionsOverride:s,title:e})},options:{},subscribe:function(t){e=t},success:function(t,e,s){return i({type:r,iconClass:y().iconClasses.success,message:t,optionsOverride:s,title:e})},version:"2.1.3",warning:function(t,e,s){return i({type:l,iconClass:y().iconClasses.warning,message:t,optionsOverride:s,title:e})}};function v(t,e){return t=t||y(),(k=g("#"+t.containerId)).length||e&&(k=function(t){return(k=g("<div/>").attr("id",t.containerId).addClass(t.positionClass)).appendTo(g(t.target)),k}(t)),k}function a(t,e,s){var a=!(!s||!s.force)&&s.force;return!(!t||!a&&0!==g(":focus",t).length)&&(t[e.hideMethod]({duration:e.hideDuration,easing:e.hideEasing,complete:function(){w(t)}}),!0)}function b(t){e&&e(t)}function i(e){var i=y(),t=e.iconClass||i.iconClass;if(void 0!==e.optionsOverride&&(i=g.extend(i,e.optionsOverride),t=e.optionsOverride.iconClass||t),!function(t,e){if(t.preventDuplicates){if(e.message===x)return!0;x=e.message}return!1}(i,e)){C++,k=v(i,!0);var n=null,o=g("<div/>"),s=g("<div/>"),a=g("<div/>"),r=g("<div/>"),l=g(i.closeHtml),c={intervalId:null,hideEta:null,maxHideTime:null},d={toastId:C,state:"visible",startTime:new Date,options:i,map:e};return e.iconClass&&o.addClass(i.toastClass).addClass(t),function(){if(e.title){var t=e.title;i.escapeHtml&&(t=u(e.title)),s.append(t).addClass(i.titleClass),o.append(s)}}(),function(){if(e.message){var t=e.message;i.escapeHtml&&(t=u(e.message)),a.append(t).addClass(i.messageClass),o.append(a)}}(),i.closeButton&&(l.addClass(i.closeClass).attr("role","button"),o.prepend(l)),i.progressBar&&(r.addClass(i.progressClass),o.prepend(r)),i.rtl&&o.addClass("rtl"),i.newestOnTop?k.prepend(o):k.append(o),function(){var t="";switch(e.iconClass){case"toast-success":case"toast-info":t="polite";break;default:t="assertive"}o.attr("aria-live",t)}(),o.hide(),o[i.showMethod]({duration:i.showDuration,easing:i.showEasing,complete:i.onShown}),0<i.timeOut&&(n=setTimeout(p,i.timeOut),c.maxHideTime=parseFloat(i.timeOut),c.hideEta=(new Date).getTime()+c.maxHideTime,i.progressBar&&(c.intervalId=setInterval(f,10))),function(){i.closeOnHover&&o.hover(m,h);!i.onclick&&i.tapToDismiss&&o.click(p);i.closeButton&&l&&l.click(function(t){t.stopPropagation?t.stopPropagation():void 0!==t.cancelBubble&&!0!==t.cancelBubble&&(t.cancelBubble=!0),i.onCloseClick&&i.onCloseClick(t),p(!0)});i.onclick&&o.click(function(t){i.onclick(t),p()})}(),b(d),i.debug&&console&&console.log(d),o}function u(t){return null==t&&(t=""),t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function p(t){var e=t&&!1!==i.closeMethod?i.closeMethod:i.hideMethod,s=t&&!1!==i.closeDuration?i.closeDuration:i.hideDuration,a=t&&!1!==i.closeEasing?i.closeEasing:i.hideEasing;if(!g(":focus",o).length||t)return clearTimeout(c.intervalId),o[e]({duration:s,easing:a,complete:function(){w(o),clearTimeout(n),i.onHidden&&"hidden"!==d.state&&i.onHidden(),d.state="hidden",d.endTime=new Date,b(d)}})}function h(){(0<i.timeOut||0<i.extendedTimeOut)&&(n=setTimeout(p,i.extendedTimeOut),c.maxHideTime=parseFloat(i.extendedTimeOut),c.hideEta=(new Date).getTime()+c.maxHideTime)}function m(){clearTimeout(n),c.hideEta=0,o.stop(!0,!0)[i.showMethod]({duration:i.showDuration,easing:i.showEasing})}function f(){var t=(c.hideEta-(new Date).getTime())/c.maxHideTime*100;r.width(t+"%")}}function y(){return g.extend({},{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">×</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1},t.options)}function w(t){k=k||v(),t.is(":visible")||(t.remove(),t=null,0===k.children().length&&(k.remove(),x=void 0))}var k,e,x,C,n,o,r,l,t}),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(b){"use strict";var y=b.scrollTo=function(t,e,s){return b(window).scrollTo(t,e,s)};function w(t){return!t.nodeName||-1!==b.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function e(t){return b.isFunction(t)||b.isPlainObject(t)?t:{top:t,left:t}}return y.defaults={axis:"xy",duration:0,limit:!0},b.fn.scrollTo=function(t,s,g){"object"==typeof s&&(g=s,s=0),"function"==typeof g&&(g={onAfter:g}),"max"===t&&(t=9e9),g=b.extend({},y.defaults,g),s=s||g.duration;var v=g.queue&&1<g.axis.length;return v&&(s/=2),g.offset=e(g.offset),g.over=e(g.over),this.each(function(){if(null!==t){var l,c=w(this),d=c?this.contentWindow||window:this,u=b(d),p=t,h={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=e(p);break}p=c?b(p):b(p,d);case"object":if(0===p.length)return;(p.is||p.style)&&(l=(p=b(p)).offset())}var m=b.isFunction(g.offset)&&g.offset(d,p)||g.offset;b.each(g.axis.split(""),function(t,e){var s="x"===e?"Left":"Top",a=s.toLowerCase(),i="scroll"+s,n=u[i](),o=y.max(d,e);if(l)h[i]=l[a]+(c?0:n-u.offset()[a]),g.margin&&(h[i]-=parseInt(p.css("margin"+s),10)||0,h[i]-=parseInt(p.css("border"+s+"Width"),10)||0),h[i]+=m[a]||0,g.over[a]&&(h[i]+=p["x"===e?"width":"height"]()*g.over[a]);else{var r=p[a];h[i]=r.slice&&"%"===r.slice(-1)?parseFloat(r)/100*o:r}g.limit&&/^\d+$/.test(h[i])&&(h[i]=h[i]<=0?0:Math.min(h[i],o)),!t&&1<g.axis.length&&(n===h[i]?h={}:v&&(f(g.onAfterFirst),h={}))}),f(g.onAfter)}function f(t){var e=b.extend({},g,{queue:!0,duration:s,complete:t&&function(){t.call(d,p,g)}});u.animate(h,e)}})},y.max=function(t,e){var s="x"===e?"Width":"Height",a="scroll"+s;if(!w(t))return t[a]-b(t)[s.toLowerCase()]();var i="client"+s,n=t.ownerDocument||t.document,o=n.documentElement,r=n.body;return Math.max(o[a],r[a])-Math.min(o[i],r[i])},b.Tween.propHooks.scrollLeft=b.Tween.propHooks.scrollTop={get:function(t){return b(t.elem)[t.prop]()},set:function(t){var e=this.get(t);if(t.options.interrupt&&t._last&&t._last!==e)return b(t.elem).stop();var s=Math.round(t.now);e!==s&&(b(t.elem)[t.prop](s),t._last=this.get(t))}},y}),function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.striptags=e()}(this,function(){var p=/\s/,h=/<(\w*)>/g;return function(t,n){t=t||"";var e,s,a,i=0,o=0,r="",l="",c=!1;for("string"==typeof n?n=function(t){var e,s=[];for(;null!==(e=h.exec(t));)s.push(e[1]);return 0!==s.length?s:null}(n):Array.isArray(n)||(n=null),e=0,s=t.length;e<s;e++)switch(a=t[e]){case"<":if(c)break;if(" "==t[e+1]){d(a);break}if(0==i){i=1,d(a);break}if(1==i){o++;break}d(a);break;case">":if(o){o--;break}if(c)break;if(1==i){c=i=0,n&&(l+=">",u());break}if(2==i){c=i=0,l="";break}if(3==i&&"-"==t[e-1]&&"-"==t[e-2]){c=i=0,l="";break}d(a);break;case'"':case"'":1==i&&(c=c!=a&&(c||a)),d(a);break;case"!":if(1==i&&"<"==t[e-1]){i=2;break}d(a);break;case"-":if(2==i&&"-"==t[e-1]&&"!"==t[e-2]){i=3;break}d(a);break;case"E":case"e":if(2==i&&"doctype"==t.substr(e-6,7).toLowerCase()){i=1;break}d(a);break;default:d(a)}function d(t){0==i?r+=t:n&&1==i&&(l+=t)}function u(){var t,e,s,a="",i=!1;t:for(t=0,e=l.length;t<e;t++)switch(s=l[t].toLowerCase()){case"<":break;case">":break t;case"/":i=!0;break;default:if(s.match(p)){if(i)break t}else i=!0,a+=s}-1!==n.indexOf(a)&&(r+=l),l=""}return r}}),function(t){"use strict";function e(t){if("#"!=t.charAt(1))return i[t]||t;var e,s=t.charAt(2);return e="x"==s||"X"==s?(s=t.substring(3,t.length-1),parseInt(s,16)):(s=t.substring(2,t.length-1),parseInt(s)),isNaN(e)?t:String.fromCharCode(e)}function s(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function a(t){return t.replace(/&#?\w+;/g,e)}var i={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ",""":'"',"&":"&","<":"<",">":">","'":"'","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ˆ":"ˆ","˜":"˜"," ":" "," ":" "," ":" ","‌":"","‍":"","‎":"","‏":"","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","‰":"‰","‹":"‹","›":"›","€":"€","ƒ":"ƒ","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ","•":"•","…":"…","′":"′","″":"″","‾":"‾","⁄":"⁄","℘":"℘","ℑ":"ℑ","ℜ":"ℜ","™":"™","ℵ":"ℵ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"};"undefined"!=typeof module?((s.htmlEncode=s).htmlDecode=a,module.exports=s):t&&(t.htmlEncode=s,t.htmlDecode=a)}(this),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Clipboard=t()}}(function(){return function n(o,r,l){function c(s,t){if(!r[s]){if(!o[s]){var e="function"==typeof require&&require;if(!t&&e)return e(s,!0);if(d)return d(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var i=r[s]={exports:{}};o[s][0].call(i.exports,function(t){var e=o[s][1][t];return c(e||t)},i,i.exports,n,o,r,l)}return r[s].exports}for(var d="function"==typeof require&&require,t=0;t<l.length;t++)c(l[t]);return c}({1:[function(t,e,s){var i=t("matches-selector");e.exports=function(t,e,s){for(var a=s?t:t.parentNode;a&&a!==document;){if(i(a,e))return a;a=a.parentNode}}},{"matches-selector":5}],2:[function(t,e,s){var o=t("closest");e.exports=function(t,e,s,a,i){var n=function(e,s,t,a){return function(t){t.delegateTarget=o(t.target,s,!0),t.delegateTarget&&a.call(e,t)}}.apply(this,arguments);return t.addEventListener(s,n,i),{destroy:function(){t.removeEventListener(s,n,i)}}}},{closest:1}],3:[function(t,e,s){s.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},s.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||s.node(t[0]))},s.string=function(t){return"string"==typeof t||t instanceof String},s.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},{}],4:[function(t,e,s){var a=t("./is"),i=t("delegate");e.exports=function(t,e,s){if(!t&&!e&&!s)throw new Error("Missing required arguments");if(!a.string(e))throw new TypeError("Second argument must be a String");if(!a.fn(s))throw new TypeError("Third argument must be a Function");if(a.node(t))return function(t,e,s){return t.addEventListener(e,s),{destroy:function(){t.removeEventListener(e,s)}}}(t,e,s);if(a.nodeList(t))return function(t,e,s){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,s)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,s)})}}}(t,e,s);if(a.string(t))return function(t,e,s){return i(document.body,t,e,s)}(t,e,s);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},{"./is":3,delegate:2}],5:[function(t,e,s){var a=Element.prototype,i=a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector;e.exports=function(t,e){if(i)return i.call(t,e);for(var s=t.parentNode.querySelectorAll(e),a=0;a<s.length;++a)if(s[a]==t)return!0;return!1}},{}],6:[function(t,e,s){e.exports=function(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var s=window.getSelection(),a=document.createRange();a.selectNodeContents(t),s.removeAllRanges(),s.addRange(a),e=s.toString()}return e}},{}],7:[function(t,e,s){function a(){}a.prototype={on:function(t,e,s){var a=this.e||(this.e={});return(a[t]||(a[t]=[])).push({fn:e,ctx:s}),this},once:function(t,e,s){var a=this;function i(){a.off(t,i),e.apply(s,arguments)}return i._=e,this.on(t,i,s)},emit:function(t){for(var e=[].slice.call(arguments,1),s=((this.e||(this.e={}))[t]||[]).slice(),a=0,i=s.length;a<i;a++)s[a].fn.apply(s[a].ctx,e);return this},off:function(t,e){var s=this.e||(this.e={}),a=s[t],i=[];if(a&&e)for(var n=0,o=a.length;n<o;n++)a[n].fn!==e&&a[n].fn._!==e&&i.push(a[n]);return i.length?s[t]=i:delete s[t],this}},e.exports=a},{}],8:[function(a,i,n){!function(t,e){if(0,void 0!==n)e(i,a("select"));else{var s={exports:{}};e(s,t.select),t.clipboardAction=s.exports}}(this,function(t,e){"use strict";var s,a=(s=e)&&s.__esModule?s:{default:s};var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var n=function(t,e,s){return e&&o(t.prototype,e),s&&o(t,s),t};function o(t,e){for(var s=0;s<e.length;s++){var a=e[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var r=(l.prototype.resolveOptions=function(t){var e=arguments.length<=0||void 0===t?{}:t;this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},l.prototype.initSelection=function(){this.text?this.selectFake():this.target&&this.selectTarget()},l.prototype.selectFake=function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()},l.prototype.removeFake=function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},l.prototype.selectTarget=function(){this.selectedText=(0,a.default)(this.target),this.copyText()},l.prototype.copyText=function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)},l.prototype.handleResult=function(t){t?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},l.prototype.clearSelection=function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},l.prototype.destroy=function(){this.removeFake()},n(l,[{key:"action",set:function(t){var e=arguments.length<=0||void 0===t?"copy":t;if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":i(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),this.resolveOptions(t),this.initSelection()}t.exports=r})},{select:6}],9:[function(a,i,n){!function(t,e){if(0,void 0!==n)e(i,a("./clipboard-action"),a("tiny-emitter"),a("good-listener"));else{var s={exports:{}};e(s,t.clipboardAction,t.tinyEmitter,t.goodListener),t.clipboard=s.exports}}(this,function(t,e,s,a){"use strict";var i=r(e),n=r(s),o=r(a);function r(t){return t&&t.__esModule?t:{default:t}}var l,c=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,l=n.default),d.prototype.resolveOptions=function(t){var e=arguments.length<=0||void 0===t?{}:t;this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},d.prototype.listenClick=function(t){var e=this;this.listener=(0,o.default)(t,"click",function(t){return e.onClick(t)})},d.prototype.onClick=function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new i.default({action:this.action(e),target:this.target(e),text:this.text(e),trigger:e,emitter:this})},d.prototype.defaultAction=function(t){return u("action",t)},d.prototype.defaultTarget=function(t){var e=u("target",t);if(e)return document.querySelector(e)},d.prototype.defaultText=function(t){return u("text",t)},d.prototype.destroy=function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},d);function d(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,l.call(this));return s.resolveOptions(e),s.listenClick(t),s}function u(t,e){var s="data-clipboard-"+t;if(e.hasAttribute(s))return e.getAttribute(s)}t.exports=c})},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)}),function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):e(t.jQuery)}(this,function(t){var e,s,a,p,n,o,h,m,f,g,v,b,i,r,y;function w(t,e){return i.call(t,e)}function l(t,e){var s,a,i,n,o,r,l,c,d,u,p,h=e&&e.split("/"),m=v.map,f=m&&m["*"]||{};if(t&&"."===t.charAt(0))if(e){for(h=h.slice(0,h.length-1),o=(t=t.split("/")).length-1,v.nodeIdCompat&&y.test(t[o])&&(t[o]=t[o].replace(y,"")),t=h.concat(t),d=0;d<t.length;d+=1)if("."===(p=t[d]))t.splice(d,1),d-=1;else if(".."===p){if(1===d&&(".."===t[2]||".."===t[0]))break;0<d&&(t.splice(d-1,2),d-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((h||f)&&m){for(d=(s=t.split("/")).length;0<d;d-=1){if(a=s.slice(0,d).join("/"),h)for(u=h.length;0<u;u-=1)if(i=(i=m[h.slice(0,u).join("/")])&&i[a]){n=i,r=d;break}if(n)break;!l&&f&&f[a]&&(l=f[a],c=d)}!n&&l&&(n=l,r=c),n&&(s.splice(0,r,n),t=s.join("/"))}return t}function k(t,e){return function(){return o.apply(p,r.call(arguments,0).concat([t,e]))}}function x(e){return function(t){f[e]=t}}function C(t){if(w(g,t)){var e=g[t];delete g[t],b[t]=!0,n.apply(p,e)}if(!w(f,t)&&!w(b,t))throw new Error("No "+t);return f[t]}function c(t){var e,s=t?t.indexOf("!"):-1;return-1<s&&(e=t.substring(0,s),t=t.substring(s+1,t.length)),[e,t]}f={},g={},v={},b={},i=Object.prototype.hasOwnProperty,r=[].slice,y=/\.js$/,h=function(t,e){var s,a=c(t),i=a[0];return t=a[1],i&&(s=C(i=l(i,e))),i?t=s&&s.normalize?s.normalize(t,function(e){return function(t){return l(t,e)}}(e)):l(t,e):(i=(a=c(t=l(t,e)))[0],t=a[1],i&&(s=C(i))),{f:i?i+"!"+t:t,n:t,pr:i,p:s}},m={require:function(t){return k(t)},exports:function(t){var e=f[t];return void 0!==e?e:f[t]={}},module:function(t){return{id:t,uri:"",exports:f[t],config:function(t){return function(){return v&&v.config&&v.config[t]||{}}}(t)}}},n=function(t,e,s,a){var i,n,o,r,l,c,d=[],u=typeof s;if(a=a||t,"undefined"==u||"function"==u){for(e=!e.length&&s.length?["require","exports","module"]:e,l=0;l<e.length;l+=1)if("require"===(n=(r=h(e[l],a)).f))d[l]=m.require(t);else if("exports"===n)d[l]=m.exports(t),c=!0;else if("module"===n)i=d[l]=m.module(t);else if(w(f,n)||w(g,n)||w(b,n))d[l]=C(n);else{if(!r.p)throw new Error(t+" missing "+n);r.p.load(r.n,k(a,!0),x(n),{}),d[l]=f[n]}o=s?s.apply(f[t],d):void 0,t&&(i&&i.exports!==p&&i.exports!==f[t]?f[t]=i.exports:o===p&&c||(f[t]=o))}else t&&(f[t]=s)},e=s=o=function(t,e,s,a,i){if("string"==typeof t)return m[t]?m[t](e):C(h(t,e).f);if(!t.splice){if((v=t).deps&&o(v.deps,v.callback),!e)return;e.splice?(t=e,e=s,s=null):t=p}return e=e||function(){},"function"==typeof s&&(s=a,a=i),a?n(p,t,e,s):setTimeout(function(){n(p,t,e,s)},4),o},o.config=function(t){return o(t)},e._defined=f,(a=function(t,e,s){e.splice||(s=e,e=[]),w(f,t)||w(g,t)||(g[t]=[t,e,s])}).amd={jQuery:!0},a("almond",function(){}),a("visualcaptcha/core",[],function(){"use strict";var i,s,a,n,o,r,l,c;return i=function(t,e,s){return s=s||[],t.namespace&&0<t.namespace.length&&s.push(t.namespaceFieldName+"="+t.namespace),s.push(t.randomParam+"="+t.randomNonce),e+"&"+s.join("&")},s=function(e){var t,s=this;e.applyRandomNonce(),e.isLoading=!0,t=a(e),e._loading(s),e.callbacks.loading&&e.callbacks.loading(s),e.request(t,function(t){t.audioFieldName&&(e.audioFieldName=t.audioFieldName),t.imageFieldName&&(e.imageFieldName=t.imageFieldName),t.imageName&&(e.imageName=t.imageName),t.values&&(e.imageValues=t.values),e.isLoading=!1,e.hasLoaded=!0,e._loaded(s),e.callbacks.loaded&&e.callbacks.loaded(s)})},a=function(t){var e=t.url+t.routes.start+"&_img="+t.numberOfImages;return i(t,e)},n=function(t,e){var s="",a=[];return e<0||e>=t.numberOfImages?s:(this.isRetina()&&a.push("retina=1"),s=t.url+t.routes.image+"&_id="+e,i(t,s,a))},o=function(t,e){var s=t.url+t.routes.audio;return e&&(s+="/ogg"),i(t,s)},r=function(t,e){return 0<=e&&e<t.numberOfImages?t.imageValues[e]:""},l=function(){return void 0!==window.devicePixelRatio&&1<window.devicePixelRatio},c=function(){var t=!1;try{document.createElement("audio").canPlayType&&(t=!0)}catch(t){}return t},function(e){var t;return t={refresh:function(){return s.call(this,e)},isLoading:function(){return e.isLoading},hasLoaded:function(){return e.hasLoaded},numberOfImages:function(){return e.imageValues.length},imageName:function(){return e.imageName},imageValue:function(t){return r.call(this,e,t)},imageUrl:function(t){return n.call(this,e,t)},audioUrl:function(t){return o.call(this,e,t)},imageFieldName:function(){return e.imageFieldName},audioFieldName:function(){return e.audioFieldName},namespace:function(){return e.namespace},namespaceFieldName:function(){return e.namespaceFieldName},isRetina:l,supportsAudio:c},e.autoRefresh&&t.refresh(),t}}),a("visualcaptcha/xhr-request",[],function(){"use strict";var a=window.XMLHttpRequest;return function(t,e){var s=new a;s.open("GET",t,!0),s.onreadystatechange=function(){var t;4===s.readyState&&200===s.status&&(t=JSON.parse(s.responseText),e(t))},s.send()}}),a("visualcaptcha/config",["visualcaptcha/xhr-request"],function(a){"use strict";return function(t){var e=window.location.href.split("/");e[e.length-1]="";var s={request:a,url:e.join("/").slice(0,-1),namespace:"",namespaceFieldName:"namespace",routes:{start:"/start",image:"/image",audio:"/audio"},isLoading:!1,hasLoaded:!1,autoRefresh:!0,numberOfImages:6,randomNonce:"",randomParam:"r",audioFieldName:"",imageFieldName:"",imageName:"",imageValues:[],callbacks:{},_loading:function(){},_loaded:function(){},applyRandomNonce:function(){return s.randomNonce=Math.random().toString(36).substring(2)}};return t.request&&(s.request=t.request),t.url&&(s.url=t.url),t.namespace&&(s.namespace=t.namespace),t.namespaceFieldName&&(s.namespaceFieldName=t.namespaceFieldName),void 0!==t.autoRefresh&&(s.autoRefresh=t.autoRefresh),t.numberOfImages&&(s.numberOfImages=t.numberOfImages),t.routes&&(t.routes.start&&(s.routes.start=t.routes.start),t.routes.image&&(s.routes.image=t.routes.image),t.routes.audio&&(s.routes.audio=t.routes.audio)),t.randomParam&&(s.randomParam=t.randomParam),t.callbacks&&(t.callbacks.loading&&(s.callbacks.loading=t.callbacks.loading),t.callbacks.loaded&&(s.callbacks.loaded=t.callbacks.loaded)),t._loading&&(s._loading=t._loading),t._loaded&&(s._loaded=t._loaded),s}}),a("visualcaptcha",["require","visualcaptcha/core","visualcaptcha/config"],function(t){"use strict";var e=t("visualcaptcha/core"),s=t("visualcaptcha/config");return function(t){return e(s(t=t||{}))}}),a("visualcaptcha/templates",[],function(){"use strict";var r;return r=function(t,e){for(var s in e)t=t.replace(new RegExp("{"+s+"}","g"),e[s]);return t},{buttons:function(t,e,s){var a,i;return'<div class="visualCaptcha-accessibility-button"><a href="#"><img src="{path}accessibility{retinaExtra}.png" title="{accessibilityTitle}" alt="{accessibilityAlt}" /></a></div>','<div class="visualCaptcha-refresh-button"><a href="#"><img src="{path}refresh{retinaExtra}.png" title="{refreshTitle}" alt="{refreshAlt}" /></a></div>',a='<div class="visualCaptcha-button-group"><div class="visualCaptcha-refresh-button"><a href="#"><img src="{path}refresh{retinaExtra}.png" title="{refreshTitle}" alt="{refreshAlt}" /></a></div>'+(t.supportsAudio()?'<div class="visualCaptcha-accessibility-button"><a href="#"><img src="{path}accessibility{retinaExtra}.png" title="{accessibilityTitle}" alt="{accessibilityAlt}" /></a></div>':"")+"</div>",i={path:s||"",refreshTitle:e.refreshTitle,refreshAlt:e.refreshAlt,accessibilityTitle:e.accessibilityTitle,accessibilityAlt:e.accessibilityAlt,retinaExtra:t.isRetina()?"@2x":""},r(a,i)},accessibility:function(t,e){var s;return t.supportsAudio()?('<div class="visualCaptcha-accessibility-wrapper visualCaptcha-hide"><div class="accessibility-description">{accessibilityDescription}</div><audio preload="preload"><source src="{audioURL}" type="audio/ogg" /><source src="{audioURL}" type="audio/mpeg" /></audio></div>',s={accessibilityDescription:e.accessibilityDescription,audioURL:t.audioUrl(),audioFieldName:t.audioFieldName()},r('<div class="visualCaptcha-accessibility-wrapper visualCaptcha-hide"><div class="accessibility-description">{accessibilityDescription}</div><audio preload="preload"><source src="{audioURL}" type="audio/ogg" /><source src="{audioURL}" type="audio/mpeg" /></audio></div>',s)):""},images:function(t,e){for(var s,a,i="",n=0,o=t.numberOfImages();n<o;n++)s='<div class="img"><a href="#"><img src="{imageUrl}" id="visualCaptcha-img-{i}" data-index="{i}" alt="" title="" /></a></div>',a={imageUrl:t.imageUrl(n),i:n},i+=r(s,a);return s='<p class="visualCaptcha-explanation">{explanation}</p><div class="visualCaptcha-possibilities">{images}</div>',a={imageFieldName:t.imageFieldName(),explanation:e.explanation.replace(/ANSWER/,t.imageName()),images:i},r(s,a)},audioInput:function(t){var e;return'<input class="form-control audioField" type="text" name="{audioFieldName}" value="" autocomplete="off" />',e={audioFieldName:t.audioFieldName()},r('<input class="form-control audioField" type="text" name="{audioFieldName}" value="" autocomplete="off" />',e)},imageInput:function(t,e){var s;return'<input class="form-control imageField" type="hidden" name="{imageFieldName}" value="{value}" readonly="readonly" />',s={imageFieldName:t.imageFieldName(),value:t.imageValue(e)},r('<input class="form-control imageField" type="hidden" name="{imageFieldName}" value="{value}" readonly="readonly" />',s)},namespaceInput:function(t){var e,s=t.namespace();return s&&0!==s.length?('<input type="hidden" name="{fieldName}" value="{value}" />',e={fieldName:t.namespaceFieldName(),value:s},r('<input type="hidden" name="{fieldName}" value="{value}" />',e)):""}}}),a("visualcaptcha/language",[],function(){"use strict";return{accessibilityAlt:"Sound icon",accessibilityTitle:"Accessibility option: listen to a question and answer it!",accessibilityDescription:"Type below the <strong>answer</strong> to what you hear. Numbers or words:",explanation:"Click or touch the <strong>ANSWER</strong>",refreshAlt:"Refresh/reload icon",refreshTitle:"Refresh/reload: get new images and accessibility option!"}}),a("visualcaptcha.jquery",["jquery","visualcaptcha","visualcaptcha/templates","visualcaptcha/language"],function(l,i,c,e){"use strict";var s,n,o,r,d,u,p;s=function(t,e){l.get(t,e,"json")},n=function(){},o=function(t,e,s){var a;a=c.namespaceInput(s)+c.accessibility(s,t.language)+c.images(s,t.language)+c.buttons(s,t.language,t.imgPath),e.html(a)},r=function(t){var e,s=l(this).closest(".visualCaptcha"),a=s.find(".visualCaptcha-accessibility-wrapper"),i=s.find(".visualCaptcha-possibilities"),n=s.find(".visualCaptcha-explanation"),o=a.find("audio");a.hasClass("visualCaptcha-hide")?(i.toggleClass("visualCaptcha-hide"),n.toggleClass("visualCaptcha-hide"),i.find(".img").removeClass("visualCaptcha-selected"),n.find("input").val(""),e=c.audioInput(s.data("captcha")),l(e).insertBefore(o),a.toggleClass("visualCaptcha-hide"),o[0].load(),o[0].play()):(o[0].pause(),a.toggleClass("visualCaptcha-hide"),a.find("input").remove(),n.toggleClass("visualCaptcha-hide"),i.toggleClass("visualCaptcha-hide")),t.preventDefault()},d=function(t){var e,s,a,i=l(this),n=i.closest(".visualCaptcha"),o=n.find(".visualCaptcha-possibilities"),r=n.find(".visualCaptcha-explanation");(s=r.find("input"))&&(s.remove(),o.find("a").removeClass("visualCaptcha-selected")),i.addClass("visualCaptcha-selected"),e=i.find("img").data("index"),a=c.imageInput(n.data("captcha"),e),r.append(l(a)),t.preventDefault()},u=function(t){l(this).closest(".visualCaptcha").data("captcha").refresh(),t.preventDefault()},p=function(t){var e=t.find(".imageField"),s=t.find(".audioField"),a=!(!e.val()&&!s.val());return a?{valid:a,name:e.val()?e.attr("name"):s.attr("name"),value:e.val()?e.val():s.val()}:{valid:a}},l.fn.visualCaptcha=function(t){var a;return a=l.extend({imgPath:"/",language:e,captcha:{request:s}},t),this.addClass("visualCaptcha").on("click",".visualCaptcha-accessibility-button",r).on("click",".visualCaptcha-refresh-button",u).on("click",".visualCaptcha-possibilities a",d),this.each(function(){var t,e,s=l(this);e=l.extend(a.captcha,{_loading:n.bind(null,a,s),_loaded:o.bind(null,a,s)}),void 0!==s.data("namespace")&&(e.namespace=s.data("namespace")),(t=i(e)).getCaptchaData=p.bind(null,s),s.data("captcha",t)})}}),a("jquery",function(){return t}),s("visualcaptcha.jquery")}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(r,o){var a={color:"rgba(255, 255, 255, 0.8)",custom:"",fade:!0,fontawesome:"",image:"data:image/gif;base64,R0lGODlhZABkAKUAADQyNJyanGRmZMzOzExOTLS2tISChOzq7ERCRKyqrHR2dNze3FxaXMTCxIyOjPT29Dw6PKSipGxubNTW1FRWVLy+vIyKjPTy9ExKTLSytHx+fOTm5GRiZMzKzJSWlPz+/DQ2NJyenGxqbNTS1FRSVLy6vISGhOzu7ERGRKyurHx6fOTi5FxeXMTGxJSSlPz6/Dw+PKSmpHRydNza3P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IJO1SEEBAosJFSa1ar9jswQQBeAEgyyFLLpvNL893DXC9zvC4XDggsb+EwXzPtyZAd14gCX2FhkQRgIEAIYeOSAMWIgoxY1UpioEpj5xCFx6ZACQVH1QjFIt5nY8PIV1sKCtUaYsOpVcfb6tWM6iBJlUnJqEAJidYKxYaFbq7SSXEXxQPVQ8VEjBQFVNXDypeKCPOSR8ZiwAox50rLF8Z40kV0V7Tqw8WXgQT8EgzDIvAdm1I4WFAM35EPqSAcYeAul25ECZ5EYPAGgH7JGo08mFACAcOChy4tbHkkA8PDppcybKly5cwY8rc8+HEiBYDRs509qKF/goCCAhIaEBy56MBFtcQaGCU04ukbFgsaErlQAQFETZgGbAIRAmqEx0oskDNirlFMcAieWDHCwtZVkqce6fWyAMBXyQ8pHKCYcOMdROOEIBBQIssAQI5KBs44YEWcLGcELvGWONCHyZ40OBhQtHLoEOLHk26tOnTqFOrXs26tevXEj+0MCFDBTPYSi64QPAFhgFLrl8c2HCC5IsUvNeAiMB49YsCFBCwICrkgIRABICvboEBz1QaC7oHmuEa1JdBQhZAZfOdtXlBdE8oCERBa+tTX94KeZ58TYjPqfWkAAsaiDPEcX6B4UFzrV1wAoNCbBCCCSG0h9uFGGao4YYc/nbo4YcghijiiCW9sMEMG6i04QsjKKCICICJ9sACE6wAoRILcMAGBRZe9kIIDKDAQALcWBGCYgDWVcIrACBQQpJHtHOHAHs1dt0aGhRJhZRR2QeaCGwooKUSBgSiwY1qRcBGDCpCkqAgh4l2wpUAKOBlFS9UQIEiBFRQ2gsDFKAHGR8skEAIKSwAJYmMNuroo5BGSkSbHa6wmQEljNnJBzOMUGVJMxCgCAwWfOrIARpggAIFBSw6zgl4sZGAq3uc8M0ag5bUAApT0jrHAG8CoMFKBfQnDZp9tDDlSh3wyoYEvsoxgrNfOLDSA2Uq5ycuKzQAGaVHnOBCJrGwtEKsUwDAEAOyRbyQgQAoIMBBAeAasUEMArBgQq4rndCCB4myWwSwa8DAbzXDPRBtU/M9++E/O35I5xcCfNgAMdt2+EACe4JAAZsgvrBABRUsUK+knAQBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8gk7bNKaVSx2UtJrVqv2CytwgJ4AZTCVEsum7ED0veLaJzfcPhDsV4LTvG83jpR170oLXuDhEQdBH9eMBVXHwcHF4VnLwMJGQtXfYkAKB1VlBoMFAIekZJYLxMUXiAQBitVc5sseEovATB1LBMfp1Yjq3UyD1UtKH8gBVUNIIkSsL5KDxabjFQfBYhfMCljSQ8Cm8m90UgzXYkaVi8LMSoKIVJVExibACbE5Ucj2n8CvsbsScinr8gCBpvUnaJnTwPBgkMeGNhUwtcDdIlSkINI5NyfgdE6NPt4gOORCQJycbKwodyHEMfszDCJ5ESDFClGPLTYwgT+i1EhWtIcKu3AhhMbiSpdyrSp06dQoya5sOKEN6kcTyRQIEBGgFpYC14woRIACAklw+oLkMjATrVJUhWQ16jfGgoT4Fb50AIRCmtWLoysE0gvlRfUvGi4agtCok6GbYX44iApFTr+hEau6YKFAc1WOsT8Mm6zLataXlQIZrYEY9N6PjwYkKLFBcuwc+vezbu379/AgwsfTry48ePIk1950CFFA1PKr6GEQJ1ChdfIcS/gUAdDC9zFHzTI0ILgiwiDv6iAjjxFLgQJhpzQkIhAWuQXEHohkO8C/T8UgGbcA/qBkc956SnG3nHuAcANESuEs0Yg4BH3QgsFlEfEBzP+CNAMCAR8F91eM1QwwVsjpqjiiiy26OKLMMYo44w01gjXBy/kWCGLFxQgAgEsxADWbw9AosUDISCwhgUowvbBBBYoYMEA2CExgZJrwFCRb/l9wcJMV0SQiAm/ZVBHDDsWMdkfGqRpWAJ1hFClEQ0kEsJvE5S1CBYbSFAHAQLq9kIMx4AQQ5NIrKABCiDAIAAmwX1wVBkPTFBBBwvaqOmmnHbq6aegKiHpADrR+EIIBCCAggILuKnHCw1IwIADgQ71QQx1iABNNC806AUFmdJ0QoFfaFTOASLUkUJTE9jlRWXlLMDas01tQKwXIbgKxwEy1KFMUx78mRcWJ0wwwgFZ2grxQQn9CIBoVgqMRIAYjUxgAAkkKNDBnEY80JMGMdRK1AW0FbABv0WcgBEABOy63APpGlbAHx7IKGYdZMZY55kynuDnFwHOeIAHLLDgAKQzvnDCwaEqFQQAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKTwMqtUZheldEqtWq/ClQMDAMBMC6x4TMZeZKCuWnAou9/wGERN93zg+Dz1JaHTWSd6goNEJwJ+ahQrhIxJLxuBVQ8iiF0sG1QPJSYqHhONZh4YIBAsJQ9UEWmIJlQTHH4BkaBSJxZ+MCl3tYd+BItSGwyIICGotEoFMIgos0ozGnQCA1QhlQAUn8hIDwbXBVUnAyEhLSe7Si8s1wAF6NuFMtceoBcE7DEv8EYP0ZUpoD6s+7bPyIcEq+iAaAPKwzUUIwry8+ZHF60TFCqF0CexyAMHLFCgkFDhGK0BAhKC8BClo8EFA0Y4o/VhRQoLCjw04Oiy5/6RDw8u8PRJtKjRo0iTKh304cWDB++W7jtQwoUBFyU2RFXyYUIICwFabJX6TMGyLiAUaJvyogSFOQBQxCBb5YCChGpYmFQyAAGuDHSlvFA1j8otRApaBj5yQt41FoqTwELEIsziIxsGVvo1hRJlTJeNHNCMiABoJTHwdnEwNPQSE+wktD5yoA8dCpZdE/nQAsW1FlRqmlglIbduIg9CqAbA2grQE0+PI+FNAQYIGCwK7JWe58GEFiMicx9Pvrz58+jTq1/Pvr379/B9PtoeX8oFUTAQmFgxtj6RC7BJA4x/MPFHRAtcKJTAbO3NwAEGHMwwxAcxVKIBfe05oIYDRP5UiMiF/mm42oEJ0pECg+zNEJIAEg5xwWFrnFZfgVFdEAMB1zmglX/BncPjj0AGKeSQRBZp5JFIJqnkktx90B+RLyxQQAAVGHjkCw0M0wWL6b2wQgvGUZGZH7KdxxsLBHDQwBUNIALDWuRNEqMVKbgJnHkPZGRJmHyphsKA5L0QQBogOIAhEhf4syGKx52QggYxiDfFfQSgQIAHhwr5wQIj7Mjkp6CGKuqopJZqxQMrMKRkBwJggIEBgNLkaAAdZCrRAmd1IYGqtKiIlgtIueAHCHfS8oIHKvHqk2N0ZPBkHon6USxRDilEDTLJKTRTTyvco4YG23J1gY9XLHCXF08hJNWCCRRQ4IGMU5yQgAIyhKDsFDal0IKtEn1wwQYb8OtRAHCBYICkQq6QaxfXGjkDIhUguYFvaoDAp5AvxHDWSgL790IFJmignakk7xMEACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ik8HVaLU4vpXRKrVqvy4KKRFBkHtiweBxOoABoACxEbrvftMU5jYaN4Pj8NAKipy16gYJDJn5pEoOJeR6GaBpWJy0VM1GKVi8jFiwCMRsfVCMIhiANVCcBcyAsE5WWSh8Vc2giM1UOfXQarUkvFrhpJAOuUjMMhrpUFzEUaCghB1QTv7kXw0kxEKMnVS8bCxMbYFQBjQAEE9ZIjI3oihrlMB3pRzHTaduKDuUEd/NFEwQMsfikaEA5Afj8DfmQIVuac65evPODooXCIxUUsGDhYIG1Aw5kUahwEcmDDQd2uXowIEaMAh5LypxJs6bNmzhz6tzJM8/+hwUNSlRYoHLKiwElOlTrWeVBBhYw1LCIsZTKCg0EYKAQsYLplA8JRNGBwIbKAQl+KGzwqqRDwEbCpjQYFYEtkhchygFwQCXvMYJ2iVwoVA7RnkaPAhd5oK9wtKh0QJBUTORDCntp6k55EAIyGhPiKA9ZIaARCmjJCghAMTWhaCEfOshCA2FylQ8vHrwA/HrhBhMEUBDQsIB3bzgXNrg+zry58+fQo0ufTr269evYsy+ZUCJBgRnGtRtRxgAGBBgMElR90cGABBNEs58wYA+EhW0vEnjGUKGo9AKYAQBCATRMwAwdAqx1XWnliEBDBvbAYJF1L4jVCAw0pOBQGhL+XveCZ4ZgOAAJfrAQk3UMNiIADZz9AkIG/kWXgl4pCPFABQIQIMEAoVl3ggKNKLCceENsYIEsCDigIJFHsBSDByEMEB6TVFZp5ZVYZqnlllx26eWXrlwwQQcjDHnlBi6cAYMGSzrHxJRK4LUhACZAB5IA911xQIrNtNkbXn2A4AKcR6xwIIe1NNdLGirEeMQFKqTVY2+wqEmgFZWmAcKEzj0wQgEjTErFAhpQoICUYKaq6qqsturqq7CyekIMMijQgqOC4KYbTi/IkAYEMeCax1EahWDmRQbRwUJXwyzAILA3zUgHDO240gIGh9zUQYknWrIAC2mUVdMLaKEBQgpXwuLxQQkicHTsRRuEoIAGBVRFxQcTRBDCCOka0YSoND1wwgWEHhEbBRCAQEADBYt3QrloMPAukQccqgZqWV7gaxosTCzewSAoXEHDRC6QQAzFxaqyJUEAACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8jk8HW5vJTQqHRKrQ4/q5jBEFt8rOCwGDzjgAAAEGsybrvftJcETQdwHvC8PjqA1dEgLXuDhEMlZ38gKYWMeg0Qf2gFVl+NYActIQkzeFInFJEoJ1IvAyowICQhF5ZTKxKIKKtTJSh1IJNRHw0EfxajrUovGn8wJZVQLxUKKCgKFZ1QD6CJGcFKAxiREk9SHxcbGyfIUB2RaAqs10cFCJEE3Ywp5wACG+tHLbZ/LPGFDfQkAMNH5AKHSCHIETrhJ5IHfwSFzOhFx8RARh8yNKQj4GLEIQs8KNBQIJqlBxkEwIBBQMW9jzCPfNjQocIEkzFz6tzJs6f+z59AgwodKuXBggkrcE45sAAiUSgzTHCgwMHCBIVKTgSgQIJDCqxPjUxg8YfBjCkXVPyJADaskAMizlFwemQAIjoEDrhF0mBfpAFS5hUDvNeI4HMxpBSIBINN4SIZ6AHIBWUFRTrcHhcZcPnPAlIFLlNwrHnIAwvnNFB5MSGEgxReShfZoOCPgBWUPrQt/SCFAgoSSsoeTry48ePIkytfzry58+fQoxN8sWDECrrSxWpgQIKFhs8FWySoMC76iwLa6pCoUIk2xxHRZ6T/QwH3C9R1FHhcHkFyAhorHFQHAfA9Vxs9qi1A1oCEOSeDZKo9YIJtej3ngWQhSLQgACj+tLDbcX2c05gQM8VgggcbYJfcCyHcBUgKKkp3ngAowIACBxXEmB0NGwxQwQD77SjkkEQWaeSRSCap5JJMjvHCDAM0teQHHQhAAAoYSNCCjkV8cMAKG3zo1gMxQLKWmEtUIAMLEmTAJVEdzFcHBA2WcxkMHRB3AX6poXnaHxIQt8GGkVBQoRIXEFMHC4JScw4BLwkTwh8OEAeXZBQodcQCAuAVaWksSlbpFA8U8FqQj73yqKY7jjBHHQKQduQGKWgggQYphDnlAxc8gGaTwAYr7LDEXkNdASVc8KseH7yJTwJmroHPASkEMICzrVzgFwAOsDrICw6gQYKsOS3wh35d16ywoTU8XWAmGiZ4u8cDagEAQ4E8hdAQC3W2soIJCpQgL0EXVOBBCFeB8QK2XQ4Mk25goMQCC24y2YI7HAqi5AcJ1JHAstA10BAMGiv5QAIEUJCAw0I2W+zLOgUBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ikcslsOp/Q5WOQSAwe0ax2q724SAAQyYPlms9oWggEaIdj6bi8+cC43YTyfM+nLWB3bRAbfYVyB4CBMCeGjUMXAxUtBy9PKoEAGk4fBykqEh4TH45NByqJAh2VTQssdyyErDJsbSgNo6RJLw6BHCubCyEaGjELuEsvFrRuDAu5SQtggQXHTB8XJ9VLF4l3IHDPRx0omCHaewuYbQ7hRxvSdxWOJ8t3Ie1Gu4Gwjh8imDAG4DPywAQMEDAkiCI1gUKgGOcGflhRYYKefhNMUKAgIcXAj0pebFhwISLIkyhTqlzJsqXLlzBjSrlwUaajBxkMqDBQ4UL+lA0BNIQ4YJOOgW4IPPhs8qEFATcIJhQN6aBem3tNTly6I2HVVCMzXGEiYLLICjt3UBD9aqQFWkyMmKx4mjYuWyId6GKqieSBhUCa7hbZ8A8TiyczFNCS8EswkQ8prIKQt2lDixgtNpT9+iDGMhAp+FpznOTDhhgOUmQjzbq169ewY8ueTbu27du4c+vG9+KE193bEkgQoCDFbxovDmygtPvDBAnLIGhYS6OzHRQR7N4+IUOdgzIlusHwmLuD1TYEnL3Y6kbB0tsR1LXpgFxBIAnaaweQD4CyZ3vH0VaBfDBIRcMJVbVhQiy4bSBWIO4N8cAMFYlGW1N6tcHCDMD+KTGDRgRQ4ACDHSaxwgQHbFbiiiy26OKLMMYo44w01mgjEheEIAAFAiSQXxMvPBCgYx8M4NArBjoRjAUhzKCiTSsUFogAFhqxwixtCPCeYy8kcF4bLTAV2R0FtHaBAfyZAGR8d0TQmlb8KeBEBQjcIRBrD/AinwdOeEELGa19UEE3gYwAxQYVaPbaAy6cxyeMJ3hATi1KyThFAh6kYFGNHzx546egXvjAAQesZmkHDgyngY8xfhBBhiAY0FhKQb7gKRoNQKCOCVt+dEAIDCgwwK1cXPCgIregFAEtAsxayACTquPBkOF0Vwt9jRRQp3wmVJmLB26w4EwjLWzrHbVTz2xgAgsCVEDsFiccG4i7KT2wAHWOpCCfBCSyNoMLHoxLhwljLeRaK1n2q8QDFQhAAAoiesvWOOgZCsUDG8xQkmwIA9AsjR+MoIEJBodq8skDBQEAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n9Dla1IqLV7RrHarfUQoMASrhOWaz2haAQJoA2CTtHzuZLndGrp+X8Tc2wJ8gnoCfwB5g4lDHxcbB2VOFWxuMAtPDxMpEQMnik8NKhwiKReXKSwwMAIVkEsXAShtICoHnkwTfm0wEQ9PLwstLRutSh8ZMH8mxLZFGn8EM4oPhX8o0cxHL3Z/A4ovsX8wDdhHHzLhcYkvFIYoI+RHDX8KnYkfAYYCvfBFHykEMFBo2GDrgAYQbggQ5HfkxABL2E4U0KDAw0KGGDNq3Mixo8ePIEOKHEmypMkPExIESLEiy4cBBWYsM3mkAAEIICBwaPHhyf6Kc20UlKKZpASyOyjSMXkRAKGbFESRXFBgCIADJyck/JER9ciCbX8CNTlB9Q6irkRWUAvr5MUxNyBaoC3ywETVGE9OhABDIcbMriMI/GFxscmDBRNW7JtL5MMIsBJm9GQ85/CEYZQza97MubPnz6BDix5NurTp06gZTghgIUZhIYxODD19wgUCWRgKtBqggoWKAZNJvwgxyQ0GnkJWsGvD4hrpDSSqahgaozgIvKVHVAVAYWEIpwBAhDDdYTsFiCNyAXBnegG4PxLqvSjAAAYFVqYfuDAEokLwDydscEJwpa2gAHggBLBYakY8UIACAmggF4MUVmjhhRhmqOGGHP526OGHIG7xwgABmBDBCgReeIBdlHgwmxMrDHBAinNdYAF4skQARQMCECCBUpR1oB5SCyqhlhsy/EXTBzFsB0A3TczAgBssFNnVcE5WgJUBsoSg5EkZ4HgHkEtsEIICMdST2QzLPUMjgwW810ZSGn5QgQAogICCAgN8idoHBwzQwgRqhmjooYiW9sIDfqb2wQoFeOBBAu/U2YEAxZGQQaO2fPDCm3xsIFg1BYCKzQsteJBBoYJ8wGVVArSk0QC5BMCpGSdEVxUME2bUZBscsLrHDEP+UcJGLUyiTF4ZCIAAAjJU8CISom4X10YPZKCAA68pcUBZcFkwrREfqLAdC1QQYWtqgw6IGV4Efk5w1B9+BTmqIectYYycAHhgZVQROAlCAU2YKQALJkBJ2T0CJ3BhwNYSbGEL9z5DZmp1bRfAuqVtAK4bJoxL4QYpCBCQBNJqFAQAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n1Dma3P6RK/YrHZhEYhCB614TB4eOCAAAGS6lN9wZ0RNBwzi+HxRU1cn9IB4Ln0AFYGHRS8XD1EzKHUUJ09TJSUDjIhOKxEaLgMvkxUCKCgKE1ZNLwUUajAumJlKDyJpABQtqE0fGy0Dkk8TJH0xsUsZfQq/gR8hhJHFSSZ9LCuILxaEBAvQSDF9EsqAH97TbtxGJwx0MCm5gQssfSnnSCsmBBK4sR8zIjAwKEKAokcQyYMBAza4K8iwocOHECNKnEixosWLGDPSu9ChxISBUR6E0dhkgQAMMEiYGOnkQgQYAAhkAEnSyAJhdZI5+VABwf66DTWPfPBQiw6IO6k89CkQ1MgDFYQAEEsVoI+hpkReQCU0z8kAdWoomMM6JEXRVtt2ttAgwcQpskROGKgDIgQsJydO3IUr5EAICigEFNjLV8yHDw8OF17MuLHjx5AjS55MubLly5gza05ysMGChZuHvKhAAQYEGAqqEXnQosCnyx8aYPjGkkYEnxhKXD6xlW4GVBcI0OFAU/KG2YRMYApOh0XxyBseJR8bAgIAGEwtn1AQNUauCyVitHge+UUJmHVYACWiOLMq4WoEfA595ESBFANA09/Pv7///wAGKOCABBZo4GMfXDBAATO8oN9mDxTgkxocjBfFCyeQ19QLGf5MSAcBE0CxggYCBBAOWSsIEJUGk0izxm+FNSBdHzA8aMQF3KnhgYYkVYAeIYQh8UEGMBHQgY0aDYBTHwRA8cAIDAYZFI5RheBfin208d8GDgjAggQpnMjfBwcsIOaBaKap5hgYHrCBlKGtEIIMLIjgCY9xKFhABi2cec4IEpxFQAJIlrGBBSRAAAIGMqRV0AqBEgLDCIc8IMNZAHCgGj0vmBUVABLgOcYxUZkgKiAX8PEpCuvpIcOnAmzKzQUifAoACkjpwUpUFIS4kapRoSCrQRMEoIABMSxwKg0SfKoeQZ1iSocAhT4Qg4cAkFBCoTQU8KkDcCJi0qctMEEkIWsYULrECSoyOQNDHyhJSAiFbsDBpxpwu0COaoDILSInOEABAQSokB8TFczYBwWOKvHBBDHE0EG43Hxwwga1LVHAj0yqG5qMn2qzn72fKrCsZOf2gYKv+z2QAHxhXdXfCxN4IIECMazwbyBBAAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IpHLJbDqf0Kh0Sq1CLxmNpfWyer/fiwkGAKBSXbB63RyAymXCgU2vFzNw+MbOp7fyADBzfYRhCm8AICFpTg8HGxcfhU8XLSkle1ArHgIKKSdPHwsuHCwmI5NOLiiBGitRLyegUAcKeRSDqUkLEHAgMZKFDYhwEbpKFYAmD4UfEYAAGsdJM4CLk8nW00gfJnACC6kbAnkoudtFDxUeFSfBzSsKKCgS4ej3ShsbzPj9/v8AAwocSLCgwYMIEyr092LFiFcLC71wQQEDhQCznhyIoCJBxohHXnjLY+LCkxMm3oCIwAhkkQms8oCY8WQCg2/8XBYpQQZQ/oUnKzjAUdBSp5AWPfO0CFWCBQoBE4wauSACEItzTEQN2PBO6pABLOBQaNHVqxVRBTwUWFDW7JcPbd3KnUu3rt27ePPq3cu3r9+/gAMXeXGgqGAiHzaYQACDRIqcQkR1gOh3BjlfASAP4IBBAOW9D0IQizOAiAE4AfxesAUIRAYiGuB4UM1a5ushI5x69hsaGoHSQ7Rmqhw2jwPIh2l8WKEBBogzyJMPcWRYuvXr2LNr3869u/fvgU+MqDAhevIHGRigQNC5Q1ydLy4cePA+5Mg8EBKYj/hhgoReCLjAVRMFQEOaWSPc5IsKHyFBlYFleLBfQg+c1loBTMxAAIQA/gjQYEQzFAeIAkxMsCGEAmAVkU0GSsDEARRwqMGHC50ggYEOMCEShynUh9AHMYwWSFRMnBAjNDOa9UIAMQFAQAM+EjGAAKO5ItcHLXhgQghshbJBASZo4EAFJmn3wQsPvBAleGy22WYs9G2njgcGOJDBgJMkNsAAK1S3zQkuIAAHBBIQSQgWIpBAAAcB+KnLAy70YlWZfDiTVCIWTDjJABhAGAMhKwgZSAn4vBADhwIQkgCEJqxpxwsecEgAIS5AqICmfZiKahMfHNBBBAlMEEkTpxpogqOFDNAkIJ8y0YJQZUCggT1LrHBpGSD8hM8FDohKAI0vHZmHBJQm8UEAWEIu488JDgDCACpL7AgNCCk08UAKR8IQQrn9DOCABBqUgKsQCygIjQKuCqFPwghNQAKKyO61gsEjMmyXvNBgaN0KIg41MF8DHBKtCcNZ98EJA6RA3seEBAEAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n9CodEqtQj+TSGZl7Xq/rwIBAmGNvuj080QCuAGah3pOL67ebtapzp8fMHgKF32EYCkEICAUA1EfFycvhVEXK3tRLwMhMQsfUCcZKioRB5JOByYcEg2lNA8RMG4gGqxMDm8CXJIzbXgTtEoCbwSMkiMQeAAFv0kBIG4CpJILFMi+y0cbLhQKI52SD81vCt7XRi8PD+TfFQoSKZbl8fLz9PX29/j5+vv8/f7/AAMKpPJhgAEOFhZIeTCiwAw5A498SICHQAd1Sz5kgGURY0QaB3i9MQCPyQUFbzxE+khkAAJkLKI1eWHiTQqPEWegQCahJP6TFRoEeBjEksgLFXhAxFj55MUFpkWHLFDgDIUHn1GtnBjQYgLErGDDih1LtqzZs2jTql3Ltq1bGi86RNA0AupbIgc8IAKgKALWtweoIgNggmjaBx0EEBDRYmWEwW+UpX0RA5YbGAnkMIDsRoLaCZvxUJhBwxlnFGorHMMDowSN1ZAJpLb8pjUNFpwByFC7gAMyCgpT5K6gNgxtEAU6ndAA2cRXtC8mBNUwgNwJB3sBEAhh+K7RASliFJiA07v58+jTq1/Pvr379+wvbHie/sMMAxQIMHDw9+OHFwCWh0QBO4lGXlYHRMACARJU0J0SKwAymAQbRLUcHgjEQB8SHv5wBoFkLCUAmxsYKLTEC8FwphJLR0GWARMv+MaZAxsC9ABKg8XQBHOcxSBgPx90OBgxS7TAGQFnFLUAAcgo0J8RDpj2BggvZjUBCyiAgIIJFTpxQQgUmMZCAXaxdEEL4/14xAsLVFBACyuoCd+cdNZp551CzFBAAimMUGMfJ6xQZjkfFMDAaiRcJQkWLsjAgQYd0PNBCRJO6cKgagwQ2mUVyNnHBiJwZiIfD2wqzKjXdFDgYCEQsoCUtaUgj2ozEtIBZ63GM0ClyOjYxAMbzLDCAZgasQBkyMlzgAScdbnEBgGQkAgLCTyIxAfMwuTsNR+0sGpKcl6AFB4QBODEAFi41RbpPJgwGYtfTWQwohsooJrEBwt4wAIFDhxYzwMDvPmnER/gOFgE6D0QKmQeoPcBjzmm1wCs9G7r3QcO0AYADMSp90AGChBAgQaNsffCCRtscIKnhAQBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ikcslsOp/QqHRKrUofL6t2yxVeQiRKKtstm5efAgwAQHTO8PjwFWGzM/K8+VOCsFFveoJbDzEULAVkUC+Kg08vH1SQUi8jMREtD45NDwUqDhubNC0sbBgJoksdCGwmjXknBnYAMK+pRDF2HCeOKwKzAKG3RwMEbB62cReydijJwy8dHgW8jh8DFGwgBcNJH5OiHycFBQuR3ejp6uvs7e7v8PHy7y8PFw/n84MfKykmMhYyCNOnZ4AAP9oUzCAIKxswAAoOMFxyIoGHFs+MfLDw0E6MfBOLzMBgR8JAJQcYdGSjoFrIIhpmgYiRccgMYytZnHxJ4wP+CWAmLjBZ4bCjgJ08f83yoGnJCwUrAThoynNIHzsEBjhpAaIjCq1VibyIIYCCAoxOPnjoOCZskQ8HFpwAyeRFBQEwYCAQMICuWy0PFgxYUfOv4cOIEytezLix48eQI0sOe2JAgwEuJyt50UAEARQkZKDVjITOmlkIEhRG/GJFAAspJAoZgMLrwsgfKuAEIGCFkABRQ0hewQGYgywyoiqQ3KL2LAESoa7UILmDczsCeOVamULyBgnAPES66dU37gGl2Gio9qLA9T8VVh+GWyAG5iITFFAgQEDDbdJK8DPBCn4BaOCBCCao4IIMNujggxBG6MgFJajAggbxLfZNgUr+LCACMAZk5tYHMyTgQAwLyEfDUw+BwNRhIxTFQAUc4tfVQxRMYNgFStnBgmxL1NERCBUYtspDLTQhZIvc/FXBabM0uUQDKwFi2AokyaQjEw/sNosEIvKkFjAaULVEMcBQsABiHxiCAgUehOnNCCbsR4EJSP11glxTBDbBBipKKOighBZqqBEXjFBBBwfUKIejt6ygHwIYSJDhIONooEEEeUbaIxsIFADpFgdocBoIDHS6yQsO3DgLAWbC8QFwwEgQayrfrbSlHC8UZQcGuw6zQHEdFZnHA1DaAUMD6RyQXEfBBnjBBgdcMKoQL6T36n/DtOmqj/I9UCEJDJjQgXxkH6TwLQAmXJtHqcCgkGQTGbyXlRMneAClBECmk69zCowg3wZessGCig9MEEMILciZzq1LqNviCAxGsC4AIDC7YAkXg7Dmghf4yoYE7kKGzSw6OfjCBCEooEEMG5QsmTgXBJpHEAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IpHLJbDqf0Kh0Sq1ar9is9TMwmUYfrXjcXHAAAMGKzG5+LpPNK9pBoAmjth55cbBIFAoND08rLGgCG3uLQlwMaJAgLoROMx4ea4yLGyKQngAFmjQfKxMXokofGRCfkCyniy8FAgwWiqhHDxatkCh5iwOPaDG4RxcKvGgwLYwVKJAaxUa6yQAwE4wLhwAgKdJFHwUgyQKUey8dEhQhsN9DJyrJzJofLw9h7kULyJ4wKfj5Ah6IoYAFCwcD5gRcSOPFiQMnzDGcSLGixYsYxdQDmBHVgxEFQmRI2FHUCRcEIBEI0K6kHgvjPEEIoNClkhcLKhyA0iIZ/ooKNpU8MDAORAiJSnYl81AzaJEGnjDMYyKhmgakToU4+ESsSbxkDrBmjeEJRKgmKar9y2rkwDYAGm4xuUCBVyK2Rj5YMpFiAZQBdT2RwIb3yAexTA6EYEGABbvCkCNLnky5suXLmDNr3sy5s+d8HzZMyPS5yQoLLBiwsEC6tOERb9EwGMCR84URFWaYO8Dvk4ATn1doQAPCA6UBrHgN8PzCRUxrJYQUqNaV84FOnqLRmJ7MW+cDVT2ZEDLBDi/CnD9EeA6jg5ALBngpaLn5RAgYAAisFbJCwfM0C9S22QsbbHBCU6OkoIAACiQAnGtMHCYghBRWaOGFGGao4YYc/nbo4YeofHBACgGkcMCEkaEoVATmcZMCYlmF1kACLez0RAb49RPdZDOIMA4EGrR2U2CfSGAjZC/0xo1xTWzwn0roFbZASp6wIJcSKyRDwHKRLfCMJxRcmcQDX35ipWQPnJEdfUl4wIsHKgbVQo750ebECSb8Z0KcTi3ggAIhiDlXARpIoEEBMFr4wAWJgujoo5BGKukSH5ywwAoIZvhBAjKwIIADM+DywAAVYDrRCwEkhwYLfjHywQgiIIAACi5kKo0zrShg6xjafBICn4t84AIvEDR6hSqtUHDkNy+YkMyybHzg5icoRPmNB09aY+wQb1ywq2FpfRLmQiMQCYkDZ8COskACBpiQwArp0rCAuQB4wJAsdAKggKBIzKAmNyLwe8QLDbylwYMLceGAABKkcEK8SqIxnhOhVVDABAhLdkC+ymzL2QwcWwNthReU2Uu8nE3rSXUZ9vElCkxyOGoMMQzg8aRtBAEAOw==",imagePosition:"center center",maxSize:"100px",minSize:"20px",resizeInterval:50,size:"50%",zIndex:2147483647};function i(t,e){var s=(t=r(t)).is("body"),a=t.data("LoadingOverlayCount");if(a===o&&(a=0),0===a){var i=r("<div>",{class:"loadingoverlay",css:{"background-color":e.color,position:"relative",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center"}});if(e.zIndex!==o&&i.css("z-index",e.zIndex),e.image&&i.css({"background-image":"url("+e.image+")","background-position":e.imagePosition,"background-repeat":"no-repeat"}),e.fontawesome&&r("<div>",{class:"loadingoverlay_fontawesome "+e.fontawesome}).appendTo(i),e.custom&&r(e.custom).appendTo(i),s?i.css({position:"fixed",top:0,left:0,width:"100%",height:"100%"}):i.css("position","fixed"===t.css("position")?"fixed":"absolute"),l(t,i,e,s),0<e.resizeInterval){var n=setInterval(function(){l(t,i,e,s)},e.resizeInterval);t.data("LoadingOverlayResizeIntervalId",n)}e.fade?!0===e.fade?e.fade=[400,200]:"string"!=typeof e.fade&&"number"!=typeof e.fade||(e.fade=[e.fade,e.fade]):e.fade=[0,0],t.data({LoadingOverlay:i,LoadingOverlayFadeOutDuration:e.fade[1]}),i.hide().appendTo("body").fadeIn(e.fade[0])}a++,t.data("LoadingOverlayCount",a)}function n(t,e){var s=(t=r(t)).data("LoadingOverlayCount");if(s!==o)if(s--,e||s<=0){var a=t.data("LoadingOverlayResizeIntervalId");a&&clearInterval(a),t.data("LoadingOverlay").fadeOut(t.data("LoadingOverlayFadeOutDuration"),function(){r(this).remove()}),t.removeData(["LoadingOverlay","LoadingOverlayCount","LoadingOverlayFadeOutDuration","LoadingOverlayResizeIntervalId"])}else t.data("LoadingOverlayCount",s)}function l(t,e,s,a){if(!a){var i="fixed"===t.css("position")?t.position():t.offset();e.css({top:i.top+parseInt(t.css("border-top-width"),10),left:i.left+parseInt(t.css("border-left-width"),10),width:t.innerWidth(),height:t.innerHeight()})}var n=a?r(window):t,o="auto";s.size&&"auto"!=s.size&&(o=Math.min(n.innerWidth(),n.innerHeight())*parseFloat(s.size)/100,s.maxSize&&o>parseInt(s.maxSize,10)&&(o=parseInt(s.maxSize,10)+"px"),s.minSize&&o<parseInt(s.minSize,10)&&(o=parseInt(s.minSize,10)+"px")),e.css("background-size",o),e.children(".loadingoverlay_fontawesome").css("font-size",o)}r.LoadingOverlaySetup=function(t){r.extend(!0,a,t)},r.LoadingOverlay=function(t,e){switch(t.toLowerCase()){case"show":i("body",r.extend(!0,{},a,e));break;case"hide":n("body",e)}},r.fn.LoadingOverlay=function(t,e){switch(t.toLowerCase()){case"show":var s=r.extend(!0,{},a,e);return this.each(function(){i(this,s)});case"hide":return this.each(function(){n(this,e)})}}}),function(f){f.fn.bootpag=function(t){var p=this,h=f.extend({total:0,page:1,maxVisible:null,leaps:!0,href:"javascript:void(0);",hrefVariable:"{{number}}",next:"»",prev:"«",firstLastUse:!1,first:'<span aria-hidden="true">←</span>',last:'<span aria-hidden="true">→</span>',wrapClass:"pagination",activeClass:"active",disabledClass:"disabled",nextClass:"next",prevClass:"prev",lastClass:"last",firstClass:"first"},p.data("settings")||{},t||{});if(h.total<=0)return this;function n(t,e){e=parseInt(e,10);var s,a=0==h.maxVisible?1:h.maxVisible,i=h.maxVisible,n=Math.floor((e-1)/a)*a,o=t.find("li");h.page=e=e<0?0:e>h.total?h.total:e,o.removeClass(h.activeClass),s=e-1<1?1:h.leaps&&e-1>=h.maxVisible?Math.floor((e-1)/a)*a:e-1,h.firstLastUse&&o.first().toggleClass(h.disabledClass,1===e);var r=o.first();h.firstLastUse&&(r=r.next()),r.toggleClass(h.disabledClass,1===e).attr("data-lp",s).find("a").attr("href",m(s));i=1==h.maxVisible?0:1;s=e+1>h.total?h.total:h.leaps&&e+1<h.total-h.maxVisible?n+h.maxVisible+i:e+1;var l=o.last();h.firstLastUse&&(l=l.prev()),l.toggleClass(h.disabledClass,e===h.total).attr("data-lp",s).find("a").attr("href",m(s)),o.last().toggleClass(h.disabledClass,e===h.total);var c=o.filter("[data-lp="+e+"]"),d="."+[h.nextClass,h.prevClass,h.firstClass,h.lastClass].join(",.");if(!c.not(d).length){var u=e<=n?-h.maxVisible:0;o.not(d).each(function(t){s=t+1+n+u,f(this).attr("data-lp",s).toggle(s<=h.total).find("a").html(s).attr("href",m(s))}),c=o.filter("[data-lp="+e+"]")}c.not(d).addClass(h.activeClass),p.data("settings",h)}function m(t){return h.href.replace(h.hrefVariable,t)}return f.isNumeric(h.maxVisible)||h.maxVisible||(h.maxVisible=parseInt(h.total,10)),p.data("settings",h),this.each(function(){var t,e,s=f(this),a=['<ul class="',h.wrapClass,' bootpag">'];h.firstLastUse&&(a=a.concat(['<li data-lp="1" class="',h.firstClass,'"><a href="',m(1),'">',h.first,"</a></li>"])),h.prev&&(a=a.concat(['<li data-lp="1" class="',h.prevClass,'"><a href="',m(1),'">',h.prev,"</a></li>"]));for(var i=1;i<=Math.min(h.total,h.maxVisible);i++)a=a.concat(['<li data-lp="',i,'"><a href="',m(i),'">',i,"</a></li>"]);h.next&&(e=h.leaps&&h.total>h.maxVisible?Math.min(h.maxVisible+1,h.total):2,a=a.concat(['<li data-lp="',e,'" class="',h.nextClass,'"><a href="',m(e),'">',h.next,"</a></li>"])),h.firstLastUse&&(a=a.concat(['<li data-lp="',h.total,'" class="last"><a href="',m(h.total),'">',h.last,"</a></li>"])),a.push("</ul>"),s.find("ul.bootpag").remove(),s.append(a.join("")),t=s.find("ul.bootpag"),s.find("li").click(function(){var t=f(this);if(!t.hasClass(h.disabledClass)&&!t.hasClass(h.activeClass)){var e=parseInt(t.attr("data-lp"),10);p.find("ul.bootpag").each(function(){n(f(this),e)}),p.trigger("page",e)}}),n(t,h.page)})}}(jQuery,window),function(w){var k="iCheck",x=k+"-helper",C="checkbox",_="radio",P="checked",h="un"+P,A="disabled",m="determinate",M="in"+m,D="update",T="type",S="click",E="touchbegin.i touchend.i",O="addClass",L="removeClass",B="trigger",I="label",f="cursor",j=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);function F(t,e,s){var a=t[0],i=/er/.test(s)?M:/bl/.test(s)?A:P,n=s==D?{checked:a[P],disabled:a[A],indeterminate:"true"==t.attr(M)||"false"==t.attr(m)}:a[i];if(/^(ch|di|in)/.test(s)&&!n)Y(t,i);else if(/^(un|en|de)/.test(s)&&n)R(t,i);else if(s==D)for(var o in n)n[o]?Y(t,o,!0):R(t,o,!0);else e&&"toggle"!=s||(e||t[B]("ifClicked"),n?a[T]!==_&&R(t,i):Y(t,i))}function Y(t,e,s){var a=t[0],i=t.parent(),n=e==P,o=e==M,r=e==A,l=o?m:n?h:"enabled",c=g(t,l+v(a[T])),d=g(t,e+v(a[T]));if(!0!==a[e]){if(!s&&e==P&&a[T]==_&&a.name){var u=t.closest("form"),p='input[name="'+a.name+'"]';(p=u.length?u.find(p):w(p)).each(function(){this!==a&&w(this).data(k)&&R(w(this),e)})}o?(a[e]=!0,a[P]&&R(t,P,"force")):(s||(a[e]=!0),n&&a[M]&&R(t,M,!1)),b(t,n,e,s)}a[A]&&g(t,f,!0)&&i.find("."+x).css(f,"default"),i[O](d||g(t,e)||""),i.attr("role")&&!o&&i.attr("aria-"+(r?A:P),"true"),i[L](c||g(t,l)||"")}function R(t,e,s){var a=t[0],i=t.parent(),n=e==P,o=e==M,r=e==A,l=o?m:n?h:"enabled",c=g(t,l+v(a[T])),d=g(t,e+v(a[T]));!1!==a[e]&&(!o&&s&&"force"!=s||(a[e]=!1),b(t,n,l,s)),!a[A]&&g(t,f,!0)&&i.find("."+x).css(f,"pointer"),i[L](d||g(t,e)||""),i.attr("role")&&!o&&i.attr("aria-"+(r?A:P),"false"),i[O](c||g(t,l)||"")}function z(t,e){t.data(k)&&(t.parent().html(t.attr("style",t.data(k).s||"")),e&&t[B](e),t.off(".i").unwrap(),w(I+'[for="'+t[0].id+'"]').add(t.closest(I)).off(".i"))}function g(t,e,s){if(t.data(k))return t.data(k).o[e+(s?"":"Class")]}function v(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e,s,a){a||(e&&t[B]("ifToggled"),t[B]("ifChanged")[B]("if"+v(s)))}w.fn[k]=function(e,s){function t(t){t.each(function(){var t=w(this);i=t.is(a)?i.add(t):i.add(t.find(a))})}var a='input[type="'+C+'"], input[type="'+_+'"]',i=w();if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(e))return e=e.toLowerCase(),t(this),i.each(function(){var t=w(this);"destroy"==e?z(t,"ifDestroyed"):F(t,!0,e),w.isFunction(s)&&s()});if("object"!=typeof e&&e)return this;var h=w.extend({checkedClass:P,disabledClass:A,indeterminateClass:M,labelHover:!0},e),n=h.handle,m=h.hoverClass||"hover",f=h.focusClass||"focus",g=h.activeClass||"active",v=!!h.labelHover,b=h.labelHoverClass||"hover",y=0|(""+h.increaseArea).replace("%","");return n!=C&&n!=_||(a='input[type="'+n+'"]'),y<-50&&(y=-50),t(this),i.each(function(){var a=w(this);z(a);var t,i=this,e=i.id,s=-y+"%",n=100+2*y+"%",o={position:"absolute",top:s,left:s,display:"block",width:n,height:n,margin:0,padding:0,background:"#fff",border:0,opacity:0},r=j?{position:"absolute",visibility:"hidden"}:y?o:{position:"absolute",opacity:0},l=i[T]==C?h.checkboxClass||"i"+C:h.radioClass||"i"+_,c=w(I+'[for="'+e+'"]').add(a.closest(I)),d=!!h.aria,u=k+"-"+Math.random().toString(36).substr(2,6),p='<div class="'+l+'" '+(d?'role="'+i[T]+'" ':"");d&&c.each(function(){p+='aria-labelledby="',this.id?p+=this.id:(this.id=u,p+=u),p+='"'}),p=a.wrap(p+"/>")[B]("ifCreated").parent().append(h.insert),t=w('<ins class="'+x+'"/>').css(o).appendTo(p),a.data(k,{o:h,s:a.attr("style")}).css(r),h.inheritClass&&p[O](i.className||""),h.inheritID&&e&&p.attr("id",k+"-"+e),"static"==p.css("position")&&p.css("position","relative"),F(a,!0,D),c.length&&c.on(S+".i mouseover.i mouseout.i "+E,function(t){var e=t[T],s=w(this);if(!i[A]){if(e==S){if(w(t.target).is("a"))return;F(a,!1,!0)}else v&&(/ut|nd/.test(e)?(p[L](m),s[L](b)):(p[O](m),s[O](b)));if(!j)return!1;t.stopPropagation()}}),a.on(S+".i focus.i blur.i keyup.i keydown.i keypress.i",function(t){var e=t[T],s=t.keyCode;return e!=S&&("keydown"==e&&32==s?(i[T]==_&&i[P]||(i[P]?R(a,P):Y(a,P)),!1):void("keyup"==e&&i[T]==_?i[P]||Y(a,P):/us|ur/.test(e)&&p["blur"==e?L:O](f)))}),t.on(S+" mousedown mouseup mouseover mouseout "+E,function(t){var e=t[T],s=/wn|up/.test(e)?g:m;if(!i[A]){if(e==S?F(a,!1,!0):(/wn|er|in/.test(e)?p[O](s):p[L](s+" "+g),c.length&&v&&s==m&&c[/ut|nd/.test(e)?L:O](b)),!j)return!1;t.stopPropagation()}})})}}(window.jQuery||window.Zepto),void 0===helper)var helper={};helper.arr={multisort:function(t,s,a){if(void 0===s)for(s=[],x=0;x<t[0].length;x++)s.push(x);if(void 0===a)for(a=[],x=0;x<t[0].length;x++)a.push("ASC");return t.sort(function(t,e){return function t(e,s,a,i,n){var o="DESC"==i[n]?1:0,r=!isNaN(e[a[n]]-s[a[n]]),l=r?+e[a[n]]:e[a[n]].toLowerCase(),c=r?+s[a[n]]:s[a[n]].toLowerCase();return l<c?0==o?-1:1:l==c?a.length-1>n?t(e,s,a,i,n+1):0:0==o?1:-1}(t,e,s,a,0)})}},function(i){"use strict";var n=function(t,e){this.$element=i(t),this.options=i.extend({},n.defaults,e)};n.defaults={transition_delay:300,refresh_speed:50,display_text:"none",use_percentage:!0,percent_format:function(t){return t+"%"},amount_format:function(t,e,s){return t+" / "+e},update:i.noop,done:i.noop,fail:i.noop},n.prototype.transition=function(){var o=this.$element,r=o.parent(),l=this.$back_text,c=this.$front_text,d=this.options,u=parseInt(o.attr("data-transitiongoal")),p=parseInt(o.attr("aria-valuemin"))||0,h=parseInt(o.attr("aria-valuemax"))||100,m=r.hasClass("vertical"),f=d.update&&"function"==typeof d.update?d.update:Progressbar.defaults.update,g=d.done&&"function"==typeof d.done?d.done:Progressbar.defaults.done,t=d.fail&&"function"==typeof d.fail?d.fail:Progressbar.defaults.fail;if(isNaN(u))t("data-transitiongoal not set");else{var e,v=Math.round(100*(u-p)/(h-p));if("center"===d.display_text&&!l&&!c)this.$back_text=l=i("<span>").addClass("progressbar-back-text").prependTo(r),this.$front_text=c=i("<span>").addClass("progressbar-front-text").prependTo(o),m?(e=r.css("height"),l.css({height:e,"line-height":e}),c.css({height:e,"line-height":e}),i(window).resize(function(){e=r.css("height"),l.css({height:e,"line-height":e}),c.css({height:e,"line-height":e})})):(e=r.css("width"),c.css({width:e}),i(window).resize(function(){e=r.css("width"),c.css({width:e})}));setTimeout(function(){var t,e,s,a,i;m?o.css("height",v+"%"):o.css("width",v+"%");var n=setInterval(function(){a=m?(s=o.height(),r.height()):(s=o.width(),r.width()),t=Math.round(100*s/a),e=Math.round(p+s/a*(h-p)),v<=t&&(t=v,e=u,g(o),clearInterval(n)),"none"!==d.display_text&&(i=d.use_percentage?d.percent_format(t):d.amount_format(e,h,p),"fill"===d.display_text?o.text(i):"center"===d.display_text&&(l.text(i),c.text(i))),o.attr("aria-valuenow",e),f(t,o)},d.refresh_speed)},d.transition_delay)}};var t=i.fn.yopprogressbar;i.fn.yopprogressbar=function(a){return this.each(function(){var t=i(this),e=t.data("bs.progressbar"),s="object"==typeof a&&a;e&&s&&i.extend(e.options,s),e||t.data("bs.progressbar",e=new n(this,s)),e.transition()})},i.fn.yopprogressbar.Constructor=n,i.fn.yopprogressbar.noConflict=function(){return i.fn.yopprogressbar=t,this}}(window.jQuery),jQuery(document).ready(function(e){e(".submenu-item").hover(function(t){e(this).closest(".submenu").find(".submenu-item").removeClass("btn-underline"),e(this).addClass("btn-underline"),t.preventDefault()},function(t){e(this).removeClass("btn-underline"),e(this).closest(".submenu").find(".submenu-item-active").addClass("btn-underline"),t.preventDefault()}),e(".submenu-item").click(function(t){e(this).closest(".submenu").find(".submenu-item").removeClass("btn-underline").removeClass("submenu-item-active"),e(this).addClass("btn-underline").addClass("submenu-item-active"),e(this).closest(".tab-pane").find(".submenu-content").addClass("hide"),e(this).closest(".tab-pane").find("."+e(this).attr("data-content")).removeClass("hide"),t.preventDefault()})}),jQuery(document).ready(function(i){var t,e="";toastr.options={closeButton:!1,debug:!1,newestOnTop:!1,progressBar:!1,positionClass:"toast-bottom-right",preventDuplicates:!0,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut",escapeHtml:!1},i(".yop-poll-poll-templates").find('.basic-yop-poll-container[data-temp="basic-pretty"] input[type="radio"]').iCheck({checkboxClass:"icheckbox_square-red",radioClass:"iradio_square-red"}),i(".choose-template").click(function(){var t=i(this).attr("data-template-id");""!==(e=i(this).attr("data-template-base"))&&("basic"===e?(i('input[name="poll[template]"]').val(t),i('input[name="poll[template]"]').attr("data-template-base",e),i("#poll-design").find(".skins-no-template").addClass("hide"),i("#poll-design").find(".skins-no-skin").removeClass("hide"),i(document).find(".skins-basic").removeClass("hide"),i(document).find(".skins-basic-pretty").addClass("hide"),i(".yop-poll-poll-templates").find("figure").removeClass("selected"),i(this).closest("figure").addClass("selected"),i("#poll-design").find('a[data-content="content-design-templates"]').removeClass("btn-underline submenu-item-active"),i("#poll-design").find('a[data-content="content-design-predefined-styles"]').addClass("btn-underline submenu-item-active"),i("#poll-design").find(".content-design-templates").addClass("hide"),i("#poll-design").find(".content-design-predefined-styles").removeClass("hide")):showUpgradeToPro("basic-pretty-template"))}),i(".preview-poll").click(function(t){var a=!1;if(""===i('input[name="poll[template]"]').attr("data-template-base")&&(a=!0,toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noTemplateSelectedLabel)))),!1===a&&""===i('input[name="poll[skin]"]').attr("data-skin-base")&&(a=!0,toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noSkinSelectedLabel)))),!1===a&&i(".poll-elements").find(".poll-element").each(function(t){var e,s=i(this).attr("data-type");!1===a&&("text-question"!==s&&"media-question"!==s||"columns"===i(this).find(".answers-display").val()&&(""===(e=i(this).find(".answers-columns").val())?(a=!0,i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child( 2)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(2) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(i(this).find(".answers-display-section"),1e3,{onAfter:function(){i(this).find(".answers-columns").focus(),i(this).find(".answers-columns").parent().addClass("has-error")}}),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noNumberOfColumnsDefined)))):12<e&&(a=!0,i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(2) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(i(this).find(".answers-display-section"),1e3,{onAfter:function(){i(this).find(".answers-columns").focus(),i(this).find(".answers-columns").parent().addClass("has-error")}}),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.numberOfColumnsTooBig))))))}),!1===a)switch(i('input[name="poll[template]"]').attr("data-template-base")){case"basic":YOPPollBasicShowLivePreview();break;case"basic-pretty":YOPPollBasicPrettyShowLivePreview()}t.preventDefault()}),i('input[name="poll[name]"]').change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".edit-poll-status").click(function(t){i(this).addClass("hide"),i("#poll-status-select").removeClass("hide-if-js"),t.preventDefault()}),i(".save-poll-status").click(function(t){var e=i("#poll_status").val();i(".poll-status").text(e.charAt(0).toUpperCase()+e.slice(1)),i("#poll-status-select").addClass("hide-if-js"),i(".edit-poll-status").removeClass("hide"),t.preventDefault()}),i(".cancel-poll-status").click(function(t){i("#poll-status-select").addClass("hide-if-js"),i(".edit-poll-status").removeClass("hide"),t.preventDefault()}),i(".edit-timestamp").click(function(t){i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child(3)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(3)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(3) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(".start-date-option",1e3,{onAfter:function(){i(".poll-preferences").find(".start-date-option").focus()}}),t.preventDefault()}),i.fn.extend({tooltipExtended:function(t){var e=i(this).data("ui-validate.error-destroy");""!==e&&(e=function(){i(this).tooltip("destroy").removeData("bs.tooltip").next(".tooltip").remove()},i(this).data("ui-validate.error-destroy",e)),i(this).tooltip("destroy").removeData("bs.tooltip").next(".tooltip").remove(),i(this).tooltip({title:t}).on("mouseleave",e).tooltip("show")}}),(t=new Clipboard("#copy-yop-poll-code")).on("success",function(t){i("#copy-yop-poll-code").tooltipExtended(objectL10n.yopPollParams.copyToClipboardSuccess),t.clearSelection()}),t.on("error",function(t){i("#copy-yop-poll-code").tooltipExtended(fallbackMessage(t.action))})}),jQuery(document).ready(function(a){a(".skins-basic-pretty").find(".basic-yop-poll-container").each(function(t){var e=a(this).attr("data-skin"),s=a(this).attr("data-cscheme");s="black"===s?"":"-"+s,a(this).find('input[type="radio"]').iCheck({checkboxClass:"icheckbox_"+e+s,radioClass:"iradio_"+e+s}),a(this).find('input[type="checkbox"]').iCheck({checkboxClass:"icheckbox_"+e+s,radioClass:"iradio_"+e+s})}),a(".skins-select-template").click(function(t){a("#poll-design").find('a[data-content="content-design-templates"]').addClass("btn-underline"),a("#poll-design").find('a[data-content="content-design-predefined-styles"]').removeClass("btn-underline"),a("#poll-design").find(".content-design-templates").removeClass("hide"),a("#poll-design").find(".content-design-predefined-styles").addClass("hide"),t.preventDefault()}),a(".choose-skin").click(function(t){a(this).attr("data-temp");a('input[name="poll[skin]"]').attr("data-skin-base",a(this).attr("data-skin-base")),a("#poll-design").find('input[name="poll[background-color]"]').val(a(this).attr("data-poll-background-color")),a("#poll-design").find('input[name="poll[background-color]"]').minicolors("value",{color:a(this).attr("data-poll-background-color")}),a("#poll-design").find('input[name="poll[border-color]"]').val(a(this).attr("data-poll-border-color")),a("#poll-design").find('input[name="poll[border-color]"]').minicolors("value",{color:a(this).attr("data-poll-border-color")}),a("#poll-design").find('input[name="poll[border-size]"]').val(a(this).attr("data-poll-border-size").replace("px","")),a("#poll-design").find('input[name="poll[border-radius]"]').val(a(this).attr("data-poll-border-radius").replace("px","")),a("#poll-design").find('input[name="poll[padding-left-right]"]').val(a(this).attr("data-poll-padding-left-right").replace("px","")),a("#poll-design").find('input[name="poll[padding-top-bottom]"]').val(a(this).attr("data-poll-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="questions[text-color]"]').val(a(this).attr("data-questions-text-color")),a("#poll-design").find('input[name="questions[text-color]"]').minicolors("value",{color:a(this).attr("data-questions-text-color")}),a("#poll-design").find('input[name="questions[text-size]"]').val(a(this).attr("data-questions-text-size").replace("px","")),a('.questions-text-weight option[value="'+a(this).attr("data-questions-text-weight")+'"]').prop("selected",!0),a('.questions-text-align option[value="'+a(this).attr("data-questions-text-align")+'"]').prop("selected",!0),a("#poll-design").find('input[name="answers[padding-left-right]"]').val(a(this).attr("data-answers-padding-left-right").replace("px","")),a("#poll-design").find('input[name="answers[padding-top-bottom]"]').val(a(this).attr("data-answers-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="answers[text-color]"]').val(a(this).attr("data-answers-text-color")),a("#poll-design").find('input[name="answers[text-color]"]').minicolors("value",{color:a(this).attr("data-answers-text-color")}),a("#poll-design").find('input[name="answers[text-size]"]').val(a(this).attr("data-answers-text-size").replace("px","")),a('.answers-text-weight option[value="'+a(this).attr("data-answers-text-weight")+'"]').prop("select",!0),a("#poll-design").find('input[name="buttons[background-color]"]').val(a(this).attr("data-buttons-background-color")),a("#poll-design").find('input[name="buttons[background-color]"]').minicolors("value",{color:a(this).attr("data-buttons-background-color")}),a("#poll-design").find('input[name="buttons[border-size]"]').val(a(this).attr("data-buttons-border-size").replace("px","")),a("#poll-design").find('input[name="buttons[border-color]"]').val(a(this).attr("data-buttons-border-color")),a("#poll-design").find('input[name="buttons[border-color]"]').minicolors("value",{color:a(this).attr("data-buttons-border-color")}),a("#poll-design").find('input[name="buttons[border-radius]"]').val(a(this).attr("data-buttons-border-radius").replace("px","")),a("#poll-design").find('input[name="buttons[padding-left-right]"]').val(a(this).attr("data-buttons-padding-left-right").replace("px","")),a("#poll-design").find('input[name="buttons[padding-top-bottom]"]').val(a(this).attr("data-buttons-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="buttons[text-color]"]').val(a(this).attr("data-buttons-text-color")),a("#poll-design").find('input[name="buttons[text-color]"]').minicolors("value",{color:a(this).attr("data-buttons-text-color")}),a("#poll-design").find('input[name="buttons[text-size]"]').val(a(this).attr("data-buttons-text-size").replace("px","")),a('.buttons-text-weight option[value="'+a(this).attr("data-buttons-text-weight")+'"]').prop("selected",!0),a("#poll-design").find('textarea[name="custom[css]"]').val(a(this).attr("data-custom-css")),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a("#poll-design").removeClass("active"),a("#poll-questions").addClass("active"),a("#yop-main-area").find(".step-design").removeClass("active"),a("#yop-main-area").find(".step-elements").addClass("active"),a("#yop-main-area").find(".step-options").removeClass("active"),a("#yop-main-area").find(".content-qa-elementss").addClass("btn-underline"),a("#yop-main-area").find(".content-design-predefined-styles").removeClass("btn-underline"),a("#yop-main-area").find(".content-qa-elements").removeClass("hide"),a(".content-design-predefined-styles").find("figure").removeClass("selected"),a(this).closest("figure").addClass("selected"),t.preventDefault()}),a(".customize-skin").click(function(t){a(this).attr("data-temp");var e=a(this).closest("figcaption").find(".choose-skin");a('input[name="poll[skin]"]').attr("data-skin-base",a(this).attr("data-skin-base")),a("#poll-design").find('input[name="poll[background-color]"]').val(e.attr("data-poll-background-color")),a("#poll-design").find('input[name="poll[background-color]"]').minicolors("value",{color:e.attr("data-poll-background-color")}),a("#poll-design").find('input[name="poll[border-color]"]').val(e.attr("data-poll-border-color")),a("#poll-design").find('input[name="poll[border-color]"]').minicolors("value",{color:e.attr("data-poll-border-color")}),a("#poll-design").find('input[name="poll[border-size]"]').val(e.attr("data-poll-border-size").replace("px","")),a("#poll-design").find('input[name="poll[border-radius]"]').val(e.attr("data-poll-border-radius").replace("px","")),a("#poll-design").find('input[name="poll[padding-left-right]"]').val(e.attr("data-poll-padding-left-right").replace("px","")),a("#poll-design").find('input[name="poll[padding-top-bottom]"]').val(e.attr("data-poll-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="questions[text-color]"]').val(e.attr("data-questions-text-color")),a("#poll-design").find('input[name="questions[text-color]"]').minicolors("value",{color:e.attr("data-questions-text-color")}),a("#poll-design").find('input[name="questions[text-size]"]').val(e.attr("data-questions-text-size").replace("px","")),a('.questions-text-weight option[value="'+a(this).attr("data-questions-text-weight")+'"]').prop("selected",!0),a('.questions-text-align option[value="'+a(this).attr("data-questions-text-align")+'"]').prop("selected",!0),a("#poll-design").find('input[name="answers[padding-left-right]"]').val(e.attr("data-answers-padding-left-right").replace("px","")),a("#poll-design").find('input[name="answers[padding-top-bottom]"]').val(e.attr("data-answers-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="answers[text-color]"]').val(e.attr("data-answers-text-color")),a("#poll-design").find('input[name="answers[text-color]"]').minicolors("value",{color:e.attr("data-answers-text-color")}),a("#poll-design").find('input[name="answers[text-size]"]').val(e.attr("data-answers-text-size").replace("px","")),a('.answers-text-weight option[value="'+a(this).attr("data-answers-text-weight")+'"]').prop("select",!0),a("#poll-design").find('input[name="buttons[background-color]"]').val(e.attr("data-buttons-background-color")),a("#poll-design").find('input[name="buttons[background-color]"]').minicolors("value",{color:e.attr("data-buttons-background-color")}),a("#poll-design").find('input[name="buttons[border-size]"]').val(e.attr("data-buttons-border-size").replace("px","")),a("#poll-design").find('input[name="buttons[border-color]"]').val(e.attr("data-buttons-border-color")),a("#poll-design").find('input[name="buttons[border-color]"]').minicolors("value",{color:e.attr("data-buttons-border-color")}),a("#poll-design").find('input[name="buttons[border-radius]"]').val(e.attr("data-buttons-border-radius").replace("px","")),a("#poll-design").find('input[name="buttons[padding-left-right]"]').val(e.attr("data-buttons-padding-left-right").replace("px","")),a("#poll-design").find('input[name="buttons[padding-top-bottom]"]').val(e.attr("data-buttons-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="buttons[text-color]"]').val(e.attr("data-buttons-text-color")),a("#poll-design").find('input[name="buttons[text-color]"]').minicolors("value",{color:e.attr("data-buttons-text-color")}),a("#poll-design").find('input[name="buttons[text-size]"]').val(e.attr("data-buttons-text-size").replace("px","")),a('.buttons-text-weight option[value="'+a(this).attr("data-buttons-text-weight")+'"]').prop("selected",!0),a("#poll-design").find('textarea[name="custom[css]"]').val(e.attr("data-custom-css")),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a(".content-design-predefined-styles").find("figure").removeClass("selected"),a(this).closest("figure").addClass("selected"),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a("#poll-design").find('a[data-content="content-design-predefined-styles"]').removeClass("btn-underline submenu-item-active"),a("#poll-design").find('a[data-content="content-design-custom-style"]').addClass("btn-underline submenu-item-active"),a("#poll-design").find(".content-design-predefined-styles").addClass("hide"),a("#poll-design").find(".content-design-custom-style").removeClass("hide"),t.preventDefault()})}),jQuery(document).ready(function(s){s(".yop-element > .yop-head").first().addClass("collapse-up"),s(".yop-element > .yop-head").click(function(){var t=s(this).parent().children(".content"),e=s(this);s(t).slideToggle(function(){"block"===s(t).css("display")?(s(e).addClass("collapse-up"),s(e).removeClass("collapse-down")):(s(e).addClass("collapse-down"),s(e).removeClass("collapse-up"))})}),s(".poll-style-header").click(function(){var t=s(this).closest(".panel").find(".panel-collapse");s(t).hasClass("in")?s(this).find("a").first().removeClass("collapsed"):s(this).find("a").first().addClass("collapsed"),s(t).collapse("toggle")}),s(".custom-style-select-template").click(function(t){s("#poll-design").find('a[data-content="content-design-templates"]').addClass("btn-underline"),s("#poll-design").find('a[data-content="content-design-custom-style"]').removeClass("btn-underline"),s("#poll-design").find(".content-design-templates").removeClass("hide"),s("#poll-design").find(".content-design-custom-style").addClass("hide"),t.preventDefault()}),s(".custom-style-select-skin").click(function(t){s("#poll-design").find('a[data-content="content-design-custom-style"]').removeClass("btn-underline"),s("#poll-design").find('a[data-content="content-design-predefined-styles"]').addClass("btn-underline"),s("#poll-design").find(".content-design-predefined-styles").removeClass("hide"),s("#poll-design").find(".content-design-custom-style").addClass("hide"),t.preventDefault()}),s(".color-scheme li").click(function(){!1===s(this).hasClass("active")&&(s("li.active").removeClass("active"),s(this).addClass("active"))}),s(".colorpicker-component").each(function(){s(this).find("INPUT").minicolors({position:"bottom right",inline:!1,theme:"bootstrap"})}),s(".poll-background-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-radius").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".questions-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".questions-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-background-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-radius").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-color-for-success").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-color-for-error").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-padding-top-left").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")})}),jQuery(document).ready(function(e){e(".vote-permissions").on("click",function(t){!0===e(this).is(":checked")&&-1!==e.inArray(e(this).val(),["facebook","google"])?(showUpgradeToPro(e(this).val()),t.preventDefault()):1===e('.vote-permissions[value="wordpress"]:checked').length&&0===e('.vote-permissions[value="guest"]:checked').length?e(".limit-votes-per-user-section").removeClass("hide"):(e(".limit-votes-per-user-section").addClass("hide"),e(".votes-per-user-section").addClass("hide"),e('.limit-votes-per-user option[value="no"]').prop("selected",!0))}),e(".block-voters").on("click",function(t){!0===e(this).is(":checked")?"no-block"===e(this).val()?(e(".block-voters-section").find('.block-voters[value!="no-block"]').prop("checked",!1),e(".block-type-section").addClass("hide"),e(".block-length-section").addClass("hide")):"by-fingerprint"===e(this).val()?(showUpgradeToPro("block-fingerprint"),t.preventDefault()):(e(".block-voters-section").find('.block-voters[value="no-block"]').prop("checked",!1),e(".block-type-section").removeClass("hide")):0===e(".block-voters:checked").length&&(e(".block-type-section").addClass("hide"),e(".block-length-section").addClass("hide"))}),e(".block-length-type").on("change",function(t){"limited-time"===e(this).val()?e(".block-length-section").removeClass("hide"):e(".block-length-section").addClass("hide")}),e(".poll-options-access").on("change",".limit-votes-per-user",function(t){"yes"===e(this).val()?e(this).closest(".poll-options-access").find(".votes-per-user-section").removeClass("hide"):e(this).closest(".poll-options-access").find(".votes-per-user-section").addClass("hide")}),e(".block-for-value").change(function(){""!==e(this).val()&&e(this).parent().removeClass("has-error")})}),jQuery(document).ready(function(i){var s=1,a=1;i("#sortable").sortable({appendTo:document.body,items:"> .answer-block",axis:"y"}),i(".poll-elements-list").sortable({axis:"y",handle:".title-bar",start:function(t,e){i(".poll-elements").find(".poll-element").each(function(t){i(this).find(".content").first().hide()})},stop:function(t,e){}}),i(".poll-elements-list").find(".answers").sortable(),i(".poll-elements").on("click",".poll-element-collapse",function(t){var e=i(this).closest(".poll-element").find(".content-inside").first(),s=i(this);i(e).slideToggle({duration:1e3,complete:function(){var t=i(e).is(":visible");i(this).removeClass("toggle-in-action"),!0===t?(i(s).find("span").addClass("glyphicon-chevron-up"),i(s).find("span").removeClass("glyphicon-chevron-down"),i(s).closest(".title-bar").removeClass("collapsed")):(i(s).find("span").addClass("glyphicon-chevron-down"),i(s).find("span").removeClass("glyphicon-chevron-up"),i(s).closest(".title-bar").addClass("collapsed"),i(s).show())}}),t.preventDefault()}),i(".add-custom-field").draggable({helper:function(t){var e=i(".custom-field-definition").find(".poll-element").clone();return i(e)},connectToSortable:".poll-elements-list",start:function(t,e){e.helper.css("width",""),e.helper.find(".content-inside").hide(),e.helper.find(".custom-field-options").hide(),e.helper.find(".title-bar").addClass("collapsed")},drag:function(t,e){e.helper.css("width",i(".poll-elements").css("width"))},stop:function(t,e){e.helper.css({width:"",height:""}),e.helper.closest('.poll-element[data-type="custom-field"]').attr("data-uid","el-"+s),s++,e.helper.find(".poll-element-collapse").first().trigger("click")}}),i(".add-custom-field").click(function(t){var e=i(".custom-field-definition").find(".poll-element").clone();e.closest('.poll-element[data-type="custom-field"]').attr("data-uid","el-"+s),s++,i(".poll-elements-list").append(e),toastr.success(objectL10n.yopPollParams.elementAdded),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-more",function(t){i(this).closest(".poll-element").find(".custom-field-options").show(),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-clone",function(t){i(this).closest(".poll-element").after(i(this).closest(".poll-element").clone().attr({"data-id":"","data-uid":"el-"+s})),s++,t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-delete",function(t){var e,s,a=i(this);BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteCustomFieldMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&(""!==(e=i(a).closest('.poll-element[data-type="custom-field"]').attr("data-id"))&&(""===(s=i(".poll-elements-list").attr("data-remove"))?i(".poll-elements-list").attr("data-remove",e):i(".poll-elements-list").attr("data-remove",s+","+e)),i(a).closest(".poll-element").remove())}}),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-required",function(t){var e=i(this).is(":checked");i(this).closest(".poll-element").find(".custom-field-make-required").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-make-required",function(t){var e=i(this).is(":checked");i(this).closest(".poll-element").find(".custom-field-required").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-done",function(t){i(this).closest(".poll-element").find(".custom-field-options").hide(),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-type",function(t){"textfield"!==i(this).val()&&(showUpgradeToPro("text-block"),i('.custom-field-type option[value="textfield"]').prop("selected",!0))}),i(".add-text-question").click(function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").on("click",".text-question-edit-clone",function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").on("click",".text-question-edit-delete",function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").find("INPUT.answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(".add-media-question").click(function(t){showUpgradeToPro("media-question"),t.preventDefault()}),i(".add-space-separator").click(function(t){showUpgradeToPro("space-separator"),t.preventDefault()}),i(".add-text-block").click(function(t){showUpgradeToPro("text-block"),t.preventDefault()}),i(".poll-elements").on("click",".add-text-answer",function(t){var e=i(".text-answer-definition").find(".answer").clone().attr("data-uid","subEl-"+a);a++,i(e).find(".answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(this).closest('.poll-element[data-type="text-question"]').find(".answers").append(i(e)),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-more",function(t){i(this).closest(".answer").find(".answer-options").show(),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-clone",function(t){var e=i(this).closest(".answer"),s=i(e).clone().attr({"data-id":"","data-uid":"subEl-"+a});a++,i(s).find(".answer-results-color").minicolors("destroy"),i(s).find(".answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(e).after(i(s)),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-delete",function(t){var e,s,a=i(this);BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteAnswerMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&(""!==(e=i(a).closest(".answer").attr("data-id"))&&(""===(s=i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove"))?i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove",e):i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove",s+","+e)),i(a).closest(".answer").remove())}}),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-done",function(t){i(this).closest(".answer-options").hide(),t.preventDefault()}),i(".poll-elements").on("change",".answer-is-default",function(t){var e=i(this).is(":checked");i(this).closest(".answer").find(".answer-make-default").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".answer-make-default",function(t){var e=i(this).is(":checked");i(this).closest(".answer").find(".answer-is-default").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".answer-make-link",function(t){!0===i(this).is(":checked")?i(this).closest(".answer").find(".answer-link-section").removeClass("hide"):i(this).closest(".answer").find(".answer-link-section").addClass("hide"),t.preventDefault()}),i(".poll-elements").on("change",".allow-other-answers",function(t){"yes"===i(this).val()?i(this).closest(".question-options").find(".other-answers-section").removeClass("hide"):i(this).closest(".question-options").find(".other-answers-section").addClass("hide")}),i(".poll-elements").find("INPUT.other-answers-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(".poll-elements").on("change",".display-other-answers-in-results",function(t){"yes"===i(this).val()?i(this).closest(".other-answers-section").find(".other-answers-results-color-section").removeClass("hide"):i(this).closest(".other-answers-section").find(".other-answers-results-color-section").addClass("hide"),t.preventDefault()}),i(".poll-elements").on("change",".allow-multiple-answers",function(t){"yes"===i(this).val()?i(this).closest(".question-options").find(".multiple-answers-section").removeClass("hide"):i(this).closest(".question-options").find(".multiple-answers-section").addClass("hide")}),i(".poll-elements").on("change",".answers-display",function(t){"columns"===i(this).val()?(i(this).closest(".question-options").find(".answers-display-section").removeClass("hide"),i(this).closest(".question-options").find(".answers-columns").val("2")):i(this).closest(".question-options").find(".answers-display-section").addClass("hide")}),i(".poll-elements").on("change",".other-answers-type",function(t){"textfield"!==i(this).val()&&(showUpgradeToPro("other-answers-type"),i('.answers-sort option[value="as-defined"]').prop("selected",!0))}),i(".poll-elements").on("change",".answers-sort",function(t){"as-defined"!==i(this).val()&&(showUpgradeToPro("sort-answers"),i('.answers-sort option[value="as-defined"]').prop("selected",!0))}),i(".question-text-edit").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".answer-edit-text").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".answers-columns").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".poll-elements").on("input",".question-value",function(){var t="";t=""===i(this).val().trim()?i(this).attr("placeholder"):i(this).val().substring(0,50),i(this).closest(".poll-element").find(".element-title").text(t)}),i(".poll-elements").on("input",".custom-field-name",function(){var t="";t=""===i(this).val().trim()?i(this).attr("placeholder"):i(this).val().substring(0,50),i(this).closest(".poll-element").find(".element-title").text(t)})}),jQuery(document).ready(function(s){s(".start-date-custom-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".start-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change(),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+":"+date("M d, Y @ H:i",e))},onClose:function(){var t;null!==s(".start-date-custom-hidden").datetimepicker("getDate")&&(t=moment(s(".start-date-custom-hidden").datetimepicker("getDate")).unix(),s(".start-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change(),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+": "),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+": "+date("M d, Y @ H:i",t)))}}),s(".end-date-custom-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".end-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".end-date-custom-hidden").datetimepicker("getDate")&&(t=moment(s(".end-date-custom-hidden").datetimepicker("getDate")).unix(),s(".end-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".poll-vote-button").on("change",".show-results-link",function(t){"yes"===s(this).val()?s(".results-link-option").removeClass("hide"):s(".results-link-option").addClass("hide")}),s(".poll-preferences").on("change",".start-date-option",function(t){"custom"===s(this).val()?s(this).closest(".poll-preferences").find(".start-date-section").removeClass("hide"):(s(this).closest(".poll-preferences").find(".start-date-section").addClass("hide"),s("#timestamp").text(objectL10n.yopPollParams.publishDateImmediately))}),s(".poll-preferences").on("click",".show-start-date",function(t){s(".start-date-custom-hidden").datepicker("show"),t.preventDefault()}),s(".poll-preferences").on("click",".show-end-date",function(t){s(".end-date-custom-hidden").datepicker("show"),t.preventDefault()}),s(".poll-preferences").on("change","select.end-date-option",function(t){"custom"===s(this).val()?s(this).closest(".poll-preferences").find(".end-date-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".end-date-section").addClass("hide")}),s(".poll-preferences").on("change",".redirect-after-vote",function(t){"yes"===s(this).val()?s(this).closest(".poll-preferences").find(".redirect-url-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".redirect-url-section").addClass("hide")}),s(".poll-preferences").on("change",".reset-poll-stats-automatically",function(t){"yes"===s(this).val()?s(this).closest(".poll-preferences").find(".reset-poll-stats-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".reset-poll-stats-section").addClass("hide")}),s(".reset-poll-stats-on-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".reset-poll-stats-on").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".reset-poll-stats-on-hidden").datetimepicker("getDate")&&(t=moment(s(".reset-poll-stats-on-hidden").datetimepicker("getDate")).unix(),s(".reset-poll-stats-on").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".poll-preferences").on("click",".show-reset-poll-stats-on",function(t){s(".reset-poll-stats-on-hidden").datepicker("show"),t.preventDefault()}),s(".poll-notifications").on("change",".send-email-notifications",function(t){"yes"===s(this).val()?s(this).closest(".poll-notifications").find(".send-email-notifications-section").removeClass("hide"):s(this).closest(".poll-notifications").find(".send-email-notifications-section").addClass("hide")}),s(".vote-button-label").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".results-label-text").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".start-date-custom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".end-date-custom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".redirect-url").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-from-name").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-from-email").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-recipients").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-subject").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-message").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-compliance").on("change",".enable-gdpr",function(t){"yes"===s(this).val()?(s(this).closest(".poll-compliance").find(".gdpr-solution-section").removeClass("hide"),"consent"===s(".gdpr-solution").val()?s(this).closest(".poll-compliance").find(".gdpr-consent-section").removeClass("hide"):s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide")):(s(this).closest(".poll-compliance").find(".gdpr-solution-section").addClass("hide"),s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide"))}),s(".poll-compliance").on("change",".gdpr-solution",function(t){"consent"===s(this).val()?s(this).closest(".poll-compliance").find(".gdpr-consent-section").removeClass("hide"):s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide")})}),jQuery(document).ready(function(s){s(".show-results-moment").click(function(t){!0===s(this).is(":checked")?"never"===s(this).val()?(s('.show-results-moment[value!="never"]').prop("checked",!1),s(".show-results-to-section").addClass("hide"),s(".custom-date-results-section").addClass("hide"),s(".show-results-details-section").addClass("hide")):(s('.show-results-moment[value="never"]').prop("checked",!1),"custom-date"===s(this).val()&&s(".custom-date-results-section").removeClass("hide"),s(".show-results-to-section").removeClass("hide"),s(".show-results-details-section").removeClass("hide")):(0===s(".show-results-moment:checked").length&&(s(".show-results-to-section").addClass("hide"),s(".custom-date-results-section").addClass("hide"),s(".show-results-details-section").addClass("hide")),"custom-date"===s(this).val()&&s(".custom-date-results-section").addClass("hide"))}),s(".custom-date-results-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".custom-date-results").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".custom-date-results-hidden").datetimepicker("getDate")&&(t=moment(s(".custom-date-results-hidden").datetimepicker("getDate")).unix(),s(".custom-date-results").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".custom-date-results-section").on("click",".show-custom-date-results",function(t){s(".custom-date-results-hidden").datepicker("show"),t.preventDefault()}),s(".poll-results-options").on("change",".back-to-vote-option",function(t){"yes"===s(this).val()?s(this).closest(".poll-results-options").find(".back-to-vote-caption-section").removeClass("hide"):s(this).closest(".poll-results-options").find(".back-to-vote-caption-section").addClass("hide")}),s(".poll-results-options").on("change",".sort-results",function(t){"alphabetical"===s(this).val()||"number-of-votes"===s(this).val()?s(this).closest(".poll-results-options").find(".sort-results-rule-section").removeClass("hide"):s(this).closest(".poll-results-options").find(".sort-results-rule-section").addClass("hide")}),s(".custom-date-results").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".back-to-vote-caption").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-results-options").on("change",".display-results-as",function(t){"pie"===s(this).val()&&(showUpgradeToPro("pie-results"),t.preventDefault())})});var YOPPollBasicIsVotingEnded,YOPPollBasicIsVotingStarted,YOPPollBasicIsAllowMultipleAnswers,YOPPollBasicIsAnswerDefault,YOPPollBasicIsAnswerLink,YOPPollBasicGetAnswersCount,YOPPollBasicHasGdpr,YOPPollBasicHasCaptcha,YOPPollBasicFormatVotePermissions,YOPPollBasicGetResultsBeforeVoteSettings,YOPPollBasicDoAnonymousVote,YOPPollBasicGetPollElements,YOPPollBasicDoTextQuestion,YOPPollBasicDoVerticalText,YOPPollBasicDoHorizontalText,YOPPollBasicDoColumnsText,YOPPollBasicDoCustomField,YOPPollBasicCreateMediaAnswer,YOPPollBasicDoMediaQuestion,YOPPollBasicDoVerticalMedia,YOPPollBasicDoHorizontalMedia,YOPPollBasicDoColumnsMedia,YOPPollBasicDoSpaceSeparator,YOPPollBasicDoTextBlock,YOPPollBasicShowResultsLink,YOPPollBasicShowBackToVoteLink,YOPPollBasicDoShowTotalVotesAndAnswers,YOPPollBasicProcessElements,YOPPollBasicDoShowResultsBeforeVote,YOPPollBasicShowLivePreviewFor,YOPPollBasicShowLivePreviewForVoting,YOPPollBasicShowLivePreviewForResults,YOPPollDoPrettyBasic,YOPPollRemovePrettyBasic,YOPPollBasicIsResultsShowPercentages,YOPPollBasicIsResultsShowVotes,YOPPollBasicGetClassForColumns,randomMin=1,randomMax=100;jQuery(document).ready(function(m){var s=[[]];YOPPollBasicSanitizeField=function(t){return m("<div>").text(t).html()},YOPPollBasicIsVotingEnded=function(t,e){var s=strtotime(e);return"custom"===t&&parseInt(s,10)<parseInt(objectL10n.yopPollParams.timeNow,10)},YOPPollBasicIsVotingStarted=function(t,e){var s=strtotime(e);return"custom"!==t||!(parseInt(s,10)>parseInt(objectL10n.yopPollParams.timeNow,10))},YOPPollBasicIsAllowMultipleAnswers=function(t){return"yes"===t?"checkbox":"radio"},YOPPollBasicIsAnswerDefault=function(t){return!0===t.is(":checked")?"checked":""},YOPPollBasicIsAnswerLink=function(t,e,s){return(!0===t.is(":checked")&&""!==e?'<a href="'+htmlEncode(e)+'" target="_blank">'+htmlEncode(s)+"</a>":htmlEncode(s)).replace("[br]","</br>").replace("[p]","<p>").replace("[/p]","</p>").replace("[strong]","<strong>").replace("[/strong]","</strong>").replace("[u]","<u>").replace("[/u]","</u>").replace("[i]","<i>").replace("[/i]","</i>")},YOPPollBasicGetAnswersCount=function(t){var e=t.find(".answer").length;return"yes"===t.find(".allow-other-answers").val()&&e++,e.toString()},YOPPollBasicFormatVotePermissions=function(t){var e=0,s=[];for(e in t)s.push(t[e].id);return s},YOPPollBasicGetResultsBeforeVoteSettings=function(t){return resultsBeforeVoteData=' data-show-results-to="'+t["show-results-to"].join()+'" data-show-results-moment="'+t["show-results-moment"].join()+'" data-show-results-only="false" data-show-results-as="'+t["display-results-as"]+'" data-sort-results-by="'+t["sort-results-by"]+'" data-sort-results-rule="'+t["sort-results-rule"]+'" data-resdet="'+t["show-details-as"].join()+'"',resultsBeforeVoteData},YOPPollBasicGetClassForColumns=function(t){var e="";switch(t){case"2":e="col-xs-6 col-sm-6 col-md-6";break;case"3":e="col-xs-6 col-sm-6 col-md-4";break;case"4":e="col-xs-6 col-sm-6 col-md-3";break;case"5":e="col-xs-6 col-sm-6 cols-5";break;case"6":e="col-xs-6 col-sm-6 col-md-2";break;case"7":e="col-xs-6 col-sm-6 cols-7";break;case"8":e="col-xs-6 col-sm-6 cols-8";break;case"9":e="col-xs-6 col-sm-6 cols-9";break;case"10":e="col-xs-6 col-sm-6 cols-10";break;case"11":e="col-xs-6 col-sm-6 cols-11";break;case"12":e="col-xs-6 col-sm-6 col-md-1"}return e},YOPPollBasicDoAnonymousVote=function(t){var e="";return-1<m.inArray("guest",t)&&(e='<div class="basic-anonymous"><button type="button" class="btn btn-default"><span class="dashicons dashicons-businessperson"></span>'+htmlEncode(objectL10n.yopPollParams.previewParams.annonymousVoteText)+"</button></div>"),e},YOPPollBasicGetPollElements=function(){var s="",a=m(".poll-elements-list").find(".poll-element").length;return m(".poll-elements-list").find(".poll-element").each(function(t){var e=t+1;switch(m(this).attr("data-type")){case"text-question":s+=YOPPollBasicDoTextQuestion(m(this),e);break;case"custom-field":s+=YOPPollBasicDoCustomField(m(this),e)}t<a&&(s+='<div class="clearfix"></div>')}),s},YOPPollBasicDoTextQuestion=function(t,e){var s="",a="";switch(t.find(".answers-display").val()){case"vertical":a="basic-question-text-vertical",s=YOPPollBasicDoVerticalText(t,e);break;case"horizontal":a="basic-question-text-horizontal",s=YOPPollBasicDoHorizontalText(t,e);break;case"columns":a="basic-question-text-columns",s=YOPPollBasicDoColumnsText(t,e)}return'<div class="basic-element basic-question '+a+'" data-id="'+e+'" data-type="question" data-question-type="text" data-min="" data-max="" data-display="'+m(t).find(".answers-display").val()+'"><div class="basic-question-title"><h5 style="color:'+m(".questions-style-settings").find(".questions-text-color").val()+"; font-size:"+m(".questions-style-settings").find(".questions-text-size").val()+"px; font-weight:"+m(".questions-style-settings").find(".questions-text-weight").val()+"; text-align:"+m(".questions-style-settings").find(".questions-text-align").val()+';">'+htmlEncode(t.find(".question-value").val())+"</h5></div>"+s+"</div>"},YOPPollBasicDoVerticalText=function(t,s){var a,i,n,o='<ul class="basic-answers">';return a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;n=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),i=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),o+='<li class="basic-answer" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'"><div class="basic-answer-content basic-text-vertical"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+n+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+i+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(o+='<li class="basic-answer basic-other-answer" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-vertical"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+s+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-md-6 col-sm-6 col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),o+="</ul>"},YOPPollBasicDoHorizontalText=function(t,s){var a,i,n,o=YOPPollBasicGetClassForColumns(YOPPollBasicGetAnswersCount(t)),r='<ul class="basic-answers basic-h-answers">';return answersCount=YOPPollBasicGetAnswersCount(t),a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;n=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),i=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),r+='<li class="basic-answer '+o+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+n+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+i+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(r+='<li class="basic-answer basic-other-answer '+o+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+(answersCount+1)+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),r+="</ul>"},YOPPollBasicDoColumnsText=function(t,s){var a,i,n="",o="",e=YOPPollBasicGetAnswersCount(t),r=YOPPollBasicGetClassForColumns(t.find(".answers-columns").val());return a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),i='<ul class="basic-answers basic-h-answers basic-cols-display">',t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;o=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),n=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),i+='<li class="basic-answer '+r+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+o+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+n+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(i+='<li class="basic-answer basic-other-answer '+r+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+(e+1)+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),i+="</ul>"},YOPPollBasicDoCustomField=function(t,e){return'<div class="basic-element basic-custom-field" data-id="" data-type="custom-field" data-required=""><div class="basic-custom-field-title"><label>'+htmlEncode(t.find(".custom-field-name").val())+'</label></div><div class="col-md-6 col-sm-6 col-xs-12"><input type="text" name="cfield[]" class="basic-input-text form-control" data-type="cfield"></div></div>'},YOPPollBasicProcessElements=function(t){"yes"===m(".enable-gdpr").val()&&"consent"===m(".gdpr-solution").val()?m(t).find(".basic-gdpr").show():m(t).find(".basic-gdpr").hide(),"yes"===m(".show-total-votes").val()||"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats").show():m(t).find(".basic-stats").hide(),"yes"===m(".show-total-votes").val()?(m(t).find(".basic-stats-votes").show(),"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats-separator").show():m(t).find(".basic-stats-separator").hide()):(m(t).find(".basic-stats-votes").hide(),m(t).find(".basic-stats-separator").hide()),"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats-answers").show():m(t).find(".basic-stats-answers").hide(),"yes"===m(".show-results-link").val()?m(t).find(".basic-results-button").css("display","inline-block"):m(t).find(".basic-results-button").css("display","none"),m(t).find(".basic-back-to-vote-button").css("display","none")},YOPPollBasicBuildAnswerResultsDetails=function(t,e,s){var a="";return-1!==t.indexOf("percentages")&&(a=(a=0<s?100*e/s:0)===Math.round(a)?Math.round(a)+"%":Number(Math.round(a+"e2")+"e-2").toFixed(2)+"%"),-1!==t.indexOf("votes-number")&&(a+=" ("+e+" "+(1===parseInt(e,10)?objectL10n.yopPollParams.resultsParams.singleVote:objectL10n.yopPollParams.resultsParams.multipleVotes)+")"),a},YOPPollBasicIsResultsShowPercentages=function(t,e,s){var a=[];return-1!==m(t).attr("data-resdet").indexOf("percentages")?(a.show=!0,a.content=0<s?100*e/s:0,a.content===Math.round(a.content)?a.content=Math.round(a.content)+"%":a.content=Number(Math.round(a.content+"e2")+"e-2").toFixed(2)+"%"):(a.show=!1,a.content=""),a},YOPPollBasicIsResultsShowVotes=function(t,e){var s=[];return-1!==m(t).attr("data-resdet").indexOf("votes-number")?(s.show=!0,votesText=1===parseInt(e,10)?objectL10n.yopPollParams.resultsParams.singleVote:objectL10n.yopPollParams.resultsParams.multipleVotes,s.content=" ("+e+" "+votesText+")"):(s.show=!1,s.content=""),s},YOPPollBasicDoShowResultsBeforeVote=function(c){var d=m(c).attr("data-show-results-as"),u=m(c).attr("data-sort-results-by"),p=m(c).attr("data-sort-results-rule"),h=m(c).attr("data-resdet");s[1]=[],m(c).find(".basic-question").each(function(){m(this).attr("data-id");var s=m(this).attr("data-question-type"),a=[],t=[],e=[],n=[],o=[],r=[],l=0;switch(i=0,m(this).find('.basic-answer:not(".basic-other-answer")').each(function(t){var e={};e.id=m(this).attr("data-id"),e.label="text"===s?m(this).find(".basic-text").text():"pie"===d?m(this).find(".basic-media-text").text():m(this).find(".basic-media-content").html(),e.backgroundColor=m(this).attr("data-color"),e.votes=parseInt(m(this).attr("data-vn"),10),a.push(e),l+=e.votes}),p){case"asc":p="ASC";break;case"desc":p="DESC";break;default:p="ASC"}switch(u){case"alphabetical":r=helper.arr.multisort(a,["label"],[p]);break;case"number-of-votes":r=helper.arr.multisort(a,["votes"],[p]);break;default:r=a}for(i=0;i<r.length;i++)t.push(r[i].id),e.push(r[i].label+" "+YOPPollBasicBuildAnswerResultsDetails(h,r[i].votes,l)),o.push(r[i].votes),n.push(r[i].backgroundColor);switch({labels:e,datasets:[{data:o,backgroundColor:n}]},d){case"bar":for(i=0;i<e.length;i++)answerResultsPercentages=YOPPollBasicIsResultsShowPercentages(c,o[i],l),answerResultsVotes=YOPPollBasicIsResultsShowVotes(c,o[i]),!0===answerResultsPercentages.show&&m(this).find(".basic-answer[data-id="+t[i]+"]").find(".basic-answer-label").append('<span class="basic-answer-results-details">'+answerResultsPercentages.content+"</label>"),!0===answerResultsVotes.show&&m(this).find(".basic-answer[data-id="+t[i]+"]").find(".basic-answer-label").append('<span class="basic-answer-total-votes" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+answerResultsVotes.content+"</span>"),m(this).find(".basic-answer[data-id="+t[i]+"]").append('<div class="progress" style=""><div class="progress-bar six-sec-ease-in-out" role="progressbar" data-transitiongoal="'+o[i]+'" aria-valuemax="'+l+'" style="background-image:none; background-color: '+n[i]+';"></div></div>');m(this).find(".progress .progress-bar").yopprogressbar()}})},YOPPollBasicClearResults=function(t){var e=m(t).attr("data-id");if(void 0!==s[e])for(i=1;i<=s[e].length;i++)s[e][i-1].destroy(),s[e].splice(i-1,1);m(t).find(".basic-answer-results-details").remove(),m(t).find(".basic-answer-total-votes").remove(),m(t).find(".progress").remove(),m(t).find(".basic-answer-results").remove(),m(t).find(".basic-chart-container").remove()},YOPPollBasicShowLivePreviewFor=function(t,e){switch(t){case"voting":YOPPollBasicShowLivePreviewForVoting(e);break;case"results":YOPPollBasicShowLivePreviewForResults(e);break;default:YOPPollBasicShowLivePreviewForVoting(e)}},YOPPollBasicShowLivePreviewForVoting=function(t){m(t).attr("data-temp");var e=m(t).attr("data-show-results-moment");YOPPollBasicClearResults(t),m(t).find(".basic-answers").show(),m(t).find(".basic-results-button").hide(),m(t).find(".basic-vote-button").show(),m(t).find(".basic-element").show(),m(t).find('input[type="radio"]').show(),m(t).find('input[type="checkbox"]').show(),m(t).find(".basic-other-answer").show(),m(t).find(".basic-captcha").show(),YOPPollBasicProcessElements(t),void 0!==e&&-1!==m(t).attr("data-show-results-moment").indexOf("before-vote")&&YOPPollBasicDoShowResultsBeforeVote(t),event.preventDefault()},YOPPollBasicBuildDataForResults=function(t){var a=[];return m(t).find(".basic-question").each(function(){var e={},s=m(this);e.id=m(this).attr("data-id"),e.type=m(this).attr("data-question-type"),e.text=m(this).find(".basic-question-title").text(),e.answers=[],m(this).find(".basic-answers").find(".basic-answer").not(".basic-other-answer").each(function(){var t=[];t.id=m(this).attr("data-id"),"media"===m(s).attr("data-question-type")?t.text=m(this).find(".basic-media-text").text():t.text=m(this).find(".basic-text").text(),t.type=m(this).attr("data-type"),t.color=m(this).attr("data-color"),t.votes=m(this).attr("data-vn"),e.answers.push(t)}),a.push(e)}),a},YOPPollBasicShowLivePreviewForResults=function(t){YOPPollBasicClearResults(t),m(t).find(".basic-answer").find('input[type="radio"]').hide(),m(t).find(".basic-answer").find('input[type="checkbox"]').hide(),m(t).find(".basic-other-answer").hide(),m(t).find(".basic-custom-field").hide(),m(t).find(".basic-gdpr").hide(),m(t).find(".basic-captcha").hide(),m(t).find(".basic-vote-button").hide(),m(t).find(".basic-results-button").hide(),"yes"===m(".back-to-vote-option").val()&&m(t).find(".basic-back-to-vote-button").show(),YOPPollBasicDoShowResultsBeforeVote(t)}}),jQuery(document).ready(function(r){YOPPollBasicShowLivePreview=function(){var t,e,s,a,i,n=[],o={accessibilityAlt:objectL10n.yopPollParams.captchaParams.accessibilityAlt,accessibilityTitle:objectL10n.yopPollParams.captchaParams.accessibilityTitle,accessibilityDescription:objectL10n.yopPollParams.captchaParams.accessibilityDescription,explanation:objectL10n.yopPollParams.captchaParams.explanation,refreshAlt:objectL10n.yopPollParams.captchaParams.refreshAlt,refreshTitle:objectL10n.yopPollParams.captchaParams.refreshTitle};return n["show-results-moment"]=[],n["show-results-to"]=[],n["show-details-as"]=[],n["sort-results-by"]=r(".sort-results").val(),n["sort-results-rule"]=r(".sort-results-rule").val(),n["display-results-as"]=r(".display-results-as").val(),r(".show-results-moment:checked").each(function(t){n["show-results-moment"].push(r(this).val())}),r(".show-results-to:checked").each(function(t){n["show-results-to"].push(r(this).val())}),r(".results-details-option:checked").each(function(t){n["show-details-as"].push(r(this).val())}),e=YOPPollBasicGetResultsBeforeVoteSettings(n),!0===YOPPollBasicIsVotingEnded(r(".end-date-option").val(),r(".end-date-custom-hidden").val())?t='<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+";border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px;border-style:solid;border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+";border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px;padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px; "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p style="color:'+r(".errors-style-settings").find(".errors-text-color").val()+"; font-size:"+r(".errors-style-settings").find(".errors-text-size").val()+"px; font-weight:"+r(".errors-style-settings").find(".errors-text-weight").val()+';">'+objectL10n.yopPollParams.votingEnded+"</p></div></div></div></div></div>":(t=!1===YOPPollBasicIsVotingStarted(r(".start-date-option").val(),r(".start-date-custom-hidden").val())?'<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+";border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px;border-style:solid;border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+";border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px;padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px; "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p style="color:'+r(".errors-style-settings").find(".errors-text-color").val()+"; font-size:"+r(".errors-style-settings").find(".errors-text-size").val()+"px; font-weight:"+r(".errors-style-settings").find(".errors-text-weight").val()+';">'+objectL10n.yopPollParams.votingNotStarted+"</p></div></div></div></div></div>":(a=YOPPollBasicGetPollElements(),'<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+"; border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px; border-style:solid; border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+"; border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px; padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'px"'+e+' data-uid="" data-temp="'+r('li[data-template-id="'+r('input[name="poll[template]"]').val()+'"]').attr("data-template-base")+'" data-skin="'+r(".answers-style-settings").find(".answers-skin").val()+'" data-cscheme="'+r(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message hide" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p></p></div><div class="basic-overlay hide"><div class="basic-vote-options"><div class="basic-anonymous"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.annonymousVoteText+'</button></div><div class="basic-wordpress"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.wordpressVoteText+'</button></div><div class="basic-facebook"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.facebookVoteText+'</button></div><div class="basic-google"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.googleVoteText+'</button></div></div><div class="basic-preloader hide"><div class="basic-windows8"><div class="basic-wBall basic-wBall_1"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_2"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_3"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_4"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_5"><div class="basic-wInnerBall"></div></div></div></div></div><form class="basic-form"><div class="basic-elements">'+a+'</div><div class="clearfix"></div><div class="basic-gdpr"><label><input type="checkbox" name="gdpr-consent">'+htmlEncode(r(".gdpr-consent-text").val())+'</label></div><div id="yop-poll-captcha" class="basic-captcha"></div><div class="basic-stats text-center"><span class="basic-stats-votes"><span class="basic-stats-votes-number">10</span><span class="basic-stats-votes-text"> '+objectL10n.yopPollParams.previewParams.numberOfVotesPlural+'</span></span><span class="basic-stats-separator"> · </span><span class="basic-stats-answers"><span class="basic-stats-answers-number">14</span><span class="basic-stats-answers-text"> '+objectL10n.yopPollParams.previewParams.numberOfAnswersPlural+'</span></span></div><div class="basic-vote"><a href="#" class="button basic-vote-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".vote-button-label").val())+'</a><a href="#" class="button basic-results-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".results-label-text").val())+'</a><a href="#" class="button basic-back-to-vote-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".back-to-vote-caption").val())+"</a></div></form></div></div></div>"),""!==r(".custom-styles-custom-css").val()&&(r("#yop-poll-custom-css").remove(),r("head").append('<style type="text/css" id="yop-poll-custom-css">'+r(".custom-styles-custom-css").val()+"</style>"))),modalPreview=BootstrapDialog.show({title:objectL10n.yopPollParams.previewParams.pollPreviewTitle,cssClass:"preview-dialog",message:'<div class="row"><div class="col-md-3">'+objectL10n.yopPollParams.previewParams.choosePreviewText+'</div><div class="col-md-9"><select class="show-preview-for admin-select" style="width:100%"><option value="voting" selected>'+objectL10n.yopPollParams.previewParams.votingText+'</option><option value="results">'+objectL10n.yopPollParams.previewParams.resultsText+'</option></select></div></div><div class="row"><div class="col-md-12"><p> </p></div></div>'+t,onshow:function(t){switch(pollContainer=t.getModalBody().find(".basic-yop-poll-container"),void 0!==(s=t.getModalBody().find(".basic-yop-poll-container").attr("data-show-results-moment"))&&-1!==s.indexOf("before-vote")&&YOPPollBasicDoShowResultsBeforeVote(t.getModalBody().find(".basic-yop-poll-container")),r(".use-captcha").val()){case"yes":t.getModalBody().find("#yop-poll-captcha").visualCaptcha({imgPath:objectL10n.yopPollParams.captchaParams.imgPath,captcha:{url:objectL10n.yopPollParams.captchaParams.url,numberOfImages:5,namespace:"yop-poll-captcha",routes:{start:"?_a=start",image:"?_a=image",audio:"?_a=audio"},callbacks:{loading:function(t){},loaded:function(t){}}},language:o});break;case"yes-recaptcha":r(pollContainer).find("#yop-poll-captcha").length&&""!==r("#yop-main-area").attr("data-recaptcha-site-key")&&(reCaptcha=grecaptcha.render(r(pollContainer).find("#yop-poll-captcha")[0],{sitekey:r("#yop-main-area").attr("data-reCaptcha-site-key"),theme:"light"}));break;case"yes-recaptcha-invisible":r(pollContainer).find("#yop-poll-captcha").length&&""!==r("#yop-main-area").attr("data-recaptcha-site-key")&&(reCaptcha=grecaptcha.render(r(pollContainer).find("#yop-poll-captcha")[0],{sitekey:r("#yop-main-area").attr("data-reCaptcha-site-key"),theme:"light",size:"invisible"}),r(pollContainer).find(".grecaptcha-badge").hide())}YOPPollBasicProcessElements(t.getModalBody().find(".basic-yop-poll-container"))}}),i=modalPreview.getModalBody(),r(i).on("change",".show-preview-for",function(t){var e=r(this).val();YOPPollBasicShowLivePreviewFor(e,i.find(".basic-yop-poll-container"))}),i}}),jQuery(document).ready(function(s){YOPPollBasicPrettyShowLivePreview=function(){var t=s(".answers-style-settings").find(".answers-skin").val(),e=s(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id");e="black"===e?"":"-"+e,modalPreviewBody=YOPPollBasicShowLivePreview(),s(modalPreviewBody).find('input[type="radio"]').iCheck({checkboxClass:"icheckbox_"+t+e,radioClass:"iradio_"+t+e}),s(modalPreviewBody).find('input[type="checkbox"]').iCheck({checkboxClass:"icheckbox_"+t+e,radioClass:"iradio_"+t+e})}}),jQuery(document).ready(function(N){function $(t,e,s,a,i){N(".poll-steps li").removeClass("active"),N(".poll-steps li:nth-child("+t+")").addClass("active"),N(".poll-steps-content .tab-pane").removeClass("active"),N(".poll-steps-content .tab-pane:nth-child("+t+")").addClass("active"),N(".poll-steps-content .tab-pane:nth-child("+t+") .submenu-item").removeClass("btn-underline"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-item").eq(e-1).addClass("btn-underline"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-content").addClass("hide"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-content").eq(e-1).removeClass("hide"),""!==s&&(s.focus(),s.parent().addClass("has-error")),""===i?toastr.warning(htmlEncode(striptags(s.closest(".form-group").find(".field-caption").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage))):toastr.warning(htmlEncode(striptags(i)))}N("#publish-poll").click(function(t){var e,s=N('input[name="poll[template]"]').val(),a=N('input[name="poll[skin]"]').attr("data-skin-base"),i=!1,n=N('input[name="poll[name]"]').val(),o=N(".poll-style-settings").find(".poll-background-color").val(),r=N(".poll-style-settings").find(".poll-border-size").val(),l=N(".poll-style-settings").find(".poll-border-color").val(),c=N(".poll-style-settings").find(".poll-border-radius").val(),d=N(".poll-style-settings").find(".poll-padding-left-right").val(),u=N(".poll-style-settings").find(".poll-padding-top-bottom").val(),p=N(".questions-style-settings").find(".questions-text-color").val(),h=N(".questions-style-settings").find(".questions-text-size").val(),m=N(".questions-style-settings").find(".questions-text-weight").val(),f=N(".questions-style-settings").find(".questions-text-align").val(),g=N(".answers-style-settings").find(".answers-padding-left-right").val(),v=N(".answers-style-settings").find(".answers-padding-top-bottom").val(),b=N(".answers-style-settings").find(".answers-text-color").val(),y=N(".answers-style-settings").find(".answers-text-size").val(),w=N(".answers-style-settings").find(".answers-text-weight").val(),k=N(".buttons-style-settings").find(".buttons-background-color").val(),x=N(".buttons-style-settings").find(".buttons-border-size").val(),C=N(".buttons-style-settings").find(".buttons-border-color").val(),_=N(".buttons-style-settings").find(".buttons-border-radius").val(),P=N(".buttons-style-settings").find(".buttons-padding-left-right").val(),A=N(".buttons-style-settings").find(".buttons-padding-top-bottom").val(),M=N(".buttons-style-settings").find(".buttons-text-color").val(),D=N(".buttons-style-settings").find(".buttons-text-size").val(),T=N(".buttons-style-settings").find(".buttons-text-weight").val(),S=N(".errors-style-settings").find(".errors-border-left-color-for-success").val(),E=N(".errors-style-settings").find(".errors-border-left-color-for-error").val(),O=N(".errors-style-settings").find(".errors-border-left-size").val(),L=N(".errors-style-settings").find(".errors-padding-top-bottom").val(),B=N(".errors-style-settings").find(".errors-text-color").val(),I=N(".errors-style-settings").find(".errors-text-size").val(),j=N(".errors-style-settings").find(".errors-text-weight").val(),F=[],Y=[],R=[],z=[],Q=[],H=[];""===n&&(i=!0,N('input[name="poll[name]"]').focus(),N('input[name="poll[name]"]').parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveParams.noPollName)))),!1===i&&""===s&&(i=!0,$(1,1,"",0,objectL10n.yopPollParams.saveParams.noTemplateSelected)),!1===i&&""===a&&(i=!0,$(1,2,"",0,objectL10n.yopPollParams.saveParams.noSkinSelected)),!1===i&&""===o.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-background-color"),0,"")),!1===i&&""===r.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-size"),0,"")),!1===i&&""===l.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-color"),0,"")),!1===i&&""===c.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-radius"),0,"")),!1===i&&""===d.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-left-right"),0,"")),!1===i&&""===u.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-top-bottom"),0,"")),!1===i&&""===p.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-color"),0,"")),!1===i&&""===h.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-size"),0,"")),!1===i&&""===m.toString()&&(i=!0,$(1,3,N(".questions-style-settings").find(".questions-text-weight"),0,"")),!1===i&&""===f.toString()&&(i=!0,$(1,3,N(".questions-style-settings").find(".questions-text-align"),0,"")),!1===i&&""===g.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-left-right"),0,"")),!1===i&&""===v.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-top-bottom"),0,"")),!1===i&&""===b.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-color"),0,"")),!1===i&&""===y.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-size"),0,"")),!1===i&&""===w.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-weight"),0,"")),!1===i&&""===k.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-background-color"),0,"")),!1===i&&""===x.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-size"),0,"")),!1===i&&""===C.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-color"),0,"")),!1===i&&""===_.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-radius"),0,"")),!1===i&&""===P.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-left-right"),0,"")),!1===i&&""===A.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-top-bottom"),0,"")),!1===i&&""===M.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-color"),0,"")),!1===i&&""===D.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-size"),0,"")),!1===i&&""===T.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-weight"),0,"")),!1===i&&""===S.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-success"),0,"")),!1===i&&""===E.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-error"),0,"")),!1===i&&""===O.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-size"),0,"")),!1===i&&""===L.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-padding-top-bottom"),0,"")),!1===i&&""===B.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-color"),0,"")),!1===i&&""===I.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-size"),0,"")),!1===i&&""===j.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-weight"),0,"")),!1===i&&N(".poll-elements-list").find(".poll-element").each(function(){switch(N(this).attr("data-type")){case"text-question":!1===i&&""===N(this).find(".question-value").val()&&(i=!0,$(2,1,N(this).find(".question-value"),0,objectL10n.yopPollParams.saveParams.noQuestion)),N(this).find(".answer").each(function(t){return!1===i&&""===N(this).find(".answer-value").val().toString()?(i=!0,$(2,1,N(this).find(".answer-value"),0,objectL10n.yopPollParams.saveParams.noAnswerText),!1):!1===i&&N(this).find(".answer-make-link").is(":checked")&&""===N(this).find(".answer-link").val().toString()?(i=!0,$(2,1,N(this).find(".answer-link"),0,objectL10n.yopPollParams.saveParams.noAnswerLink),!1):void 0}),!1===i&&"yes"===N(this).find(".allow-other-answers").val()&&""===N(this).find(".other-answers-label").val().toString()&&(i=!0,$(2,1,N(this).find(".other-answers-label"),0,objectL10n.yopPollParams.saveParams.noOtherLabel)),!1===i&&"yes"===N(this).find(".allow-multiple-answers").val()&&(""===N(this).find(".multiple-answers-minim").val()||parseInt(N(this).find(".multiple-answers-minim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers)):""===N(this).find(".multiple-answers-maxim").val()||parseInt(N(this).find(".multiple-answers-maxim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-maxim"),0,objectL10n.yopPollParams.saveParams.noMaxAnswers)):parseInt(N(this).find(".multiple-answers-minim").val(),10)>parseInt(N(this).find(".multiple-answers-maxim").val(),10)&&(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers))),!1===i&&"columns"===N(this).find(".answers-display").val()&&(""===N(this).find(".answers-columns").val().toString()||parseInt(N(this).find(".answers-columns").val(),10)<1)&&(i=!0,$(2,1,N(this).find(".answers-columns"),0,objectL10n.yopPollParams.noNumberOfColumnsDefined));break;case"custom-field":if(!1===i&&""===N(this).find(".custom-field-name").val().toString())return i=!0,$(2,1,N(this).find(".custom-field-name"),0,objectL10n.yopPollParams.saveParams.noCustomFieldName),!1}}),!1===i&&""===N(".vote-button-label").val()&&(i=!0,$(3,1,N(".vote-button-label"),0,"")),!1===i&&"yes"===N(".show-results-link").val()&&""===N(".results-label-text").val()&&(i=!0,$(3,1,N(".results-label-text"),0,"")),!1===i&&"custom"===N(".start-date-option").val()&&""===N(".start-date-custom").val()&&(i=!0,$(3,1,N(".start-date-custom"),0,objectL10n.yopPollParams.saveParams.noStartDate)),!1===i&&"custom"===N(".end-date-option").val()&&""===N(".end-date-custom").val()&&(i=!0,$(3,1,N(".end-date-custom"),0,objectL10n.yopPollParams.saveParams.noEndDate)),!1===i&&"yes"===N(".redirect-after-vote").val()&&""===N(".redirect-url").val()&&(i=!0,$(3,1,N(".redirect-url"),0,"")),!1===i&&"yes"===N(".send-email-notifications").val()&&(!1===i&&""===N(".email-notifications-from-name").val()&&(i=!0,$(3,1,N(".email-notifications-from-name"),0,"")),!1===i&&""===N(".email-notifications-from-email").val()&&(i=!0,$(3,1,N(".email-notifications-from-email"),0,"")),!1===i&&""===N(".email-notifications-recipients").val()&&(i=!0,$(3,1,N(".email-notifications-recipients"),0,"")),!1===i&&""===N(".email-notifications-subject").val()&&(i=!0,$(3,1,N(".email-notifications-subject"),0,"")),!1===i&&""===N(".email-notifications-message").val()&&(i=!0,$(3,1,N(".email-notifications-message"),0,""))),!1===i&&"yes"===N(".enable-gdpr").val()&&"consent"===N(".gdpr-solution").val()&&""===N(".gdpr-consent-text").val()&&(i=!0,$(3,1,N(".gdpr-consent-text"),0,"")),N(".vote-permissions:checked").each(function(t){Y.push(N(this).val())}),!1===i&&0===Y.length&&(i=!0,$(3,2,N(".vote-permissions"),0,"")),N(".block-voters:checked").each(function(t){R.push(N(this).val())}),!1===i&&0<R.length&&-1===N.inArray("no-block",R)&&"limited-time"===N(".block-length-type").val()&&""===N(".block-length-1").val()&&(i=!0,$(3,2,N(".block-length-1"),0,"")),!1===i&&"yes"===N(".limit-votes-per-user").val()&&""===N(".votes-per-user-allowed").val()&&(i=!0,$(3,2,N(".votes-per-user-allowed"),0,"")),N(".show-results-moment:checked").each(function(t){z.push(N(this).val())}),!1===i&&0===z.length&&(i=!0,$(3,3,N(".show-results-moment"),0,objectL10n.yopPollParams.saveParams.noShowResultsMoment)),!1===i&&-1<N.inArray("custom-date",z)&&""===N(".custom-date-results").val()&&(i=!0,$(3,3,N(".custom-date-results"),0,objectL10n.yopPollParams.saveParams.noCustomDate)),N(".show-results-to:checked").each(function(t){Q.push(N(this).val())}),N(".results-details-option:checked").each(function(t){H.push(N(this).val())}),!1===i&&-1===N.inArray("never",z)&&(0===Q.length&&(i=!0,$(3,3,N(".show-results-to"),0,objectL10n.yopPollParams.saveParams.noShowResultsTo)),!1===i&&0===H.length&&(i=!0,$(3,3,N(".results-details-option"),0,objectL10n.yopPollParams.saveParams.noShowResultsDetails))),!1===i&&"yes"===N(".back-to-vote-option").val()&&""===N(".back-to-vote-caption").val()&&(i=!0,$(3,3,N(".back-to-vote-caption"),0,"")),!1===i&&!0===N('input.vote-permissions[value="registered"]').is(":checked")&&"no"===N(".allow-wordpress-votes").val()&&(i=!0,$(3,3,N(".allow-wordpress-votes"),0,objectL10n.yopPollParams.saveParams.noVoteAsWordpress)),!1===i&&(N(".poll-elements-list").find(".poll-element").each(function(t){var e=N(this).attr("data-type"),s=[];switch(e){case"text-question":N(this).find(".answer").each(function(t){s[t]={type:"text",text:N(this).find(".answer-value").val(),options:{makeDefault:N(this).find(".answer-make-default").is(":checked")?"yes":"no",makeLink:N(this).find(".answer-make-link").is(":checked")?"yes":"no",link:N(this).find(".answer-link").val(),resultsColor:N(this).find(".answer-results-color").val()}}}),F.push({type:"text-question",text:N(this).find(".question-value").val(),answers:s,options:{allowOtherAnswers:N(this).find(".allow-other-answers").val(),otherAnswersLabel:N(this).find(".other-answers-label").val(),addOtherAnswers:N(this).find(".add-other-answers").val(),displayOtherAnswersInResults:N(this).find(".display-other-answers-in-results").val(),resultsColorForOtherAnswers:N(this).find(".other-answers-results-color").val(),allowMultipleAnswers:N(this).find(".allow-multiple-answers").val(),multipleAnswersMinim:N(this).find(".multiple-answers-minim").val(),multipleAnswersMaxim:N(this).find(".multiple-answers-maxim").val(),answersDisplay:N(this).find(".answers-display").val(),answersColumns:N(this).find(".answers-columns").val(),answersSort:N(this).find(".answers-sort").val()}});break;case"custom-field":F.push({type:"custom-field",text:N(this).find(".custom-field-name").val(),options:{makeRequired:N(this).find(".custom-field-make-required").is(":checked")?"yes":"no",cType:N(this).find(".custom-field-type").val()}})}}),e={name:N('input[name="poll[name]"]').val(),status:N("#poll_status").val(),design:{template:N('input[name="poll[template]"]').val(),templateBase:N('input[name="poll[template]"]').attr("data-template-base"),skinBase:N('input[name="poll[skin]"]').attr("data-skin-base"),style:{poll:{backgroundColor:N(".poll-background-color").val(),borderSize:N(".poll-border-size").val(),borderColor:N(".poll-border-color").val(),borderRadius:N(".poll-border-radius").val(),paddingLeftRight:N(".poll-padding-left-right").val(),paddingTopBottom:N(".poll-padding-top-bottom").val()},questions:{textColor:N(".questions-text-color").val(),textSize:N(".questions-text-size").val(),textWeight:N(".questions-text-weight").val(),textAlign:N(".questions-text-align").val()},answers:{paddingLeftRight:N(".answers-padding-left-right").val(),paddingTopBottom:N(".answers-padding-top-bottom").val(),textColor:N(".answers-text-color").val(),textSize:N(".answers-text-size").val(),textWeight:N(".answers-text-weight").val(),skin:N(".answers-style-settings").find(".answers-skin").val(),colorScheme:N(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")},buttons:{backgroundColor:N(".buttons-background-color").val(),borderSize:N(".buttons-border-size").val(),borderColor:N(".buttons-border-color").val(),borderRadius:N(".buttons-border-radius").val(),paddingLeftRight:N(".buttons-padding-left-right").val(),paddingTopBottom:N(".buttons-padding-top-bottom").val(),textColor:N(".buttons-text-color").val(),textSize:N(".buttons-text-size").val(),textWeight:N(".buttons-text-weight").val()},captcha:{},errors:{borderLeftColorForSuccess:N(".errors-border-left-color-for-success").val(),borderLeftColorForError:N(".errors-border-left-color-for-error").val(),borderLeftSize:N(".errors-border-left-size").val(),paddingTopBottom:N(".errors-padding-top-bottom").val(),textColor:N(".errors-text-color").val(),textSize:N(".errors-text-size").val(),textWeight:N(".errors-text-weight").val()},custom:{css:N(".custom-styles-custom-css").val()}}},options:{poll:{voteButtonLabel:N(".vote-button-label").val(),showResultsLink:N(".show-results-link").val(),resultsLabelText:N(".results-label-text").val(),showTotalVotes:N(".show-total-votes").val(),showTotalAnswers:N(".show-total-answers").val(),startDateOption:N(".start-date-option").val(),startDateCustom:N(".start-date-custom-hidden").val(),endDateOption:N(".end-date-option").val(),endDateCustom:N(".end-date-custom-hidden").val(),redirectAfterVote:N(".redirect-after-vote").val(),redirectUrl:N(".redirect-url").val(),resetPollStatsAutomatically:N(".reset-poll-stats-automatically").val(),resetPollStatsOn:N(".reset-poll-stats-on-hidden").val(),resetPollStatsEvery:N(".reset-poll-stats-every").val(),resetPollStatsEveryPeriod:N(".reset-poll-stats-every-period").val(),autoGeneratePollPage:N(".auto-generate-poll-page").val(),pageId:"",pageLink:"",useCaptcha:N(".use-captcha").val(),sendEmailNotifications:N(".send-email-notifications").val(),emailNotificationsFromName:N(".email-notifications-from-name").val(),emailNotificationsFromEmail:N(".email-notifications-from-email").val(),emailNotificationsRecipients:N(".email-notifications-recipients").val(),emailNotificationsSubject:N(".email-notifications-subject").val(),emailNotificationsMessage:N(".email-notifications-message").val(),enableGdpr:N(".enable-gdpr").val(),gdprSolution:N(".gdpr-solution").val(),gdprConsentText:N(".gdpr-consent-text").val(),loadWithAjax:N(".load-with-ajax").val(),notificationMessageLocation:N(".poll-options-notification-message-location").val()},access:{votePermissions:Y,allowWordpressVotes:N(".allow-wordpress-votes").val(),blockVoters:R,blockLengthType:N(".block-length-type").val(),blockForValue:N(".block-length-1").val(),blockForPeriod:N(".block-length-2").val(),limitVotesPerUser:N(".limit-votes-per-user").val(),votesPerUserAllowed:N(".votes-per-user-allowed").val()},results:{showResultsMoment:z,customDateResults:N(".custom-date-results-hidden").val(),showResultsTo:Q,resultsDetails:H,backToVoteOption:N(".back-to-vote-option").val(),backToVoteCaption:N(".back-to-vote-caption").val(),sortResults:N(".sort-results").val(),sortResultsRule:N(".sort-results-rule").val(),displayResultsAs:N(".display-results-as").val(),barColor:N(".bar-color").val(),barHeight:N(".bar-height").val()}},elements:F},N(".spinner.publish").addClass("is-active"),N("#publish-poll").attr("disabled",!0),N.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"create_yop_poll",_token:N("#_token").val(),poll:JSON.stringify(e)}}).done(function(t){N(".spinner.publish").removeClass("is-active"),!0===t.success?toastr.success(htmlEncode(striptags(t.data.message)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&show-code=yes&poll-id="+t.data.pollId)}}):(N("#publish-poll").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),N("#update-poll").click(function(t){var e,s=N('input[name="poll[template]"]').val(),a=N('input[name="poll[skin]"]').attr("data-skin-base"),i=!1,n=N('input[name="poll[name]"]').val(),o=N(".poll-style-settings").find(".poll-background-color").val(),r=N(".poll-style-settings").find(".poll-border-size").val(),l=N(".poll-style-settings").find(".poll-border-color").val(),c=N(".poll-style-settings").find(".poll-border-radius").val(),d=N(".poll-style-settings").find(".poll-padding-left-right").val(),u=N(".poll-style-settings").find(".poll-padding-top-bottom").val(),p=N(".questions-style-settings").find(".questions-text-color").val(),h=N(".questions-style-settings").find(".questions-text-size").val(),m=N(".questions-style-settings").find(".questions-text-weight").val(),f=N(".questions-style-settings").find(".questions-text-align").val(),g=N(".answers-style-settings").find(".answers-padding-left-right").val(),v=N(".answers-style-settings").find(".answers-padding-top-bottom").val(),b=N(".answers-style-settings").find(".answers-text-color").val(),y=N(".answers-style-settings").find(".answers-text-size").val(),w=N(".answers-style-settings").find(".answers-text-weight").val(),k=N(".buttons-style-settings").find(".buttons-background-color").val(),x=N(".buttons-style-settings").find(".buttons-border-size").val(),C=N(".buttons-style-settings").find(".buttons-border-color").val(),_=N(".buttons-style-settings").find(".buttons-border-radius").val(),P=N(".buttons-style-settings").find(".buttons-padding-left-right").val(),A=N(".buttons-style-settings").find(".buttons-padding-top-bottom").val(),M=N(".buttons-style-settings").find(".buttons-text-color").val(),D=N(".buttons-style-settings").find(".buttons-text-size").val(),T=N(".buttons-style-settings").find(".buttons-text-weight").val(),S=N(".errors-style-settings").find(".errors-border-left-color-for-success").val(),E=N(".errors-style-settings").find(".errors-border-left-color-for-error").val(),O=N(".errors-style-settings").find(".errors-border-left-size").val(),L=N(".errors-style-settings").find(".errors-padding-top-bottom").val(),B=N(".errors-style-settings").find(".errors-text-color").val(),I=N(".errors-style-settings").find(".errors-text-size").val(),j=N(".errors-style-settings").find(".errors-text-weight").val(),F=[],Y=[],R=[],z=[],Q=[],H=[];""===n&&(i=!0,N('input[name="poll[name]"]').focus(),N('input[name="poll[name]"]').parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveParams.noPollName)))),!1===i&&""===s&&(i=!0,$(1,1,"",0,objectL10n.yopPollParams.saveParams.noTemplateSelected)),!1===i&&""===a&&(i=!0,$(1,2,"",0,objectL10n.yopPollParams.saveParams.noSkinSelected)),!1===i&&""===o.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-background-color"),0,"")),!1===i&&""===r.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-size"),0,"")),!1===i&&""===l.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-color"),0,"")),!1===i&&""===c.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-radius"),0,"")),!1===i&&""===d.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-left-right"),0,"")),!1===i&&""===u.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-top-bottom"),0,"")),!1===i&&""===p.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-color"),0,"")),!1===i&&""===h.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-size"),0,"")),!1===i&&""===m.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-weight"),0,"")),!1===i&&""===f.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-align"),0,"")),!1===i&&""===g.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-left-right"),0,"")),!1===i&&""===v.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-top-bottom"),0,"")),!1===i&&""===b.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-color"),0,"")),!1===i&&""===y.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-size"),0,"")),!1===i&&""===w.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-weight"),0,"")),!1===i&&""===k.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-background-color"),0,"")),!1===i&&""===x.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-size"),0,"")),!1===i&&""===C.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-color"),0,"")),!1===i&&""===_.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-radius"),0,"")),!1===i&&""===P.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-left-right"),0,"")),!1===i&&""===A.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-top-bottom"),0,"")),!1===i&&""===M.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-color"),0,"")),!1===i&&""===D.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-size"),0,"")),!1===i&&""===T.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-weight"),0,"")),!1===i&&""===S.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-success"),0,"")),!1===i&&""===E.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-error"),0,"")),!1===i&&""===O.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-size"),0,"")),!1===i&&""===L.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-padding-top-bottom"),0,"")),!1===i&&""===B.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-color"),0,"")),!1===i&&""===I.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-size"),0,"")),!1===i&&""===j.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-weight"),0,"")),!1===i&&N(".poll-elements-list").find(".poll-element").each(function(){switch(N(this).attr("data-type")){case"text-question":!1===i&&""===N(this).find(".question-value").val()&&(i=!0,$(2,1,N(this).find(".question-value"),0,objectL10n.yopPollParams.saveParams.noQuestion)),N(this).find(".answer").each(function(t){return!1===i&&""===N(this).find(".answer-value").val().toString()?(i=!0,$(2,1,N(this).find(".answer-value"),0,objectL10n.yopPollParams.saveParams.noAnswerText),!1):!1===i&&N(this).find(".answer-make-link").is(":checked")&&""===N(this).find(".answer-link").val().toString()?(i=!0,$(2,1,N(this).find(".answer-link"),0,objectL10n.yopPollParams.saveParams.noAnswerLink),!1):void 0}),!1===i&&"yes"===N(this).find(".allow-other-answers").val()&&""===N(this).find(".other-answers-label").val().toString()&&(i=!0,$(2,1,N(this).find(".other-answers-label"),0,objectL10n.yopPollParams.saveParams.noOtherLabel)),!1===i&&"yes"===N(this).find(".allow-multiple-answers").val()&&(""===N(this).find(".multiple-answers-minim").val()||parseInt(N(this).find(".multiple-answers-minim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers)):""===N(this).find(".multiple-answers-maxim").val()||parseInt(N(this).find(".multiple-answers-maxim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-maxim"),0,objectL10n.yopPollParams.saveParams.noMaxAnswers)):parseInt(N(this).find(".multiple-answers-minim").val(),10)>parseInt(N(this).find(".multiple-answers-maxim").val(),10)&&(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers))),!1===i&&"columns"===N(this).find(".answers-display").val()&&(""===N(this).find(".answers-columns").val().toString()||parseInt(N(this).find(".answers-columns").val(),10)<1)&&(i=!0,$(2,1,N(this).find(".answers-columns"),0,objectL10n.yopPollParams.noNumberOfColumnsDefined));break;case"custom-field":if(!1===i&&""===N(this).find(".custom-field-name").val().toString())return i=!0,$(2,1,N(this).find(".custom-field-name"),0,objectL10n.yopPollParams.saveParams.noCustomFieldName),!1}}),!1===i&&""===N(".vote-button-label").val()&&(i=!0,$(3,1,N(".vote-button-label"),0,"")),!1===i&&"yes"===N(".show-results-link").val()&&""===N(".results-label-text").val()&&(i=!0,$(3,1,N(".results-label-text"),0,"")),!1===i&&"custom"===N(".start-date-option").val()&&""===N(".start-date-custom").val()&&(i=!0,$(3,1,N(".start-date-custom"),0,objectL10n.yopPollParams.saveParams.noStartDate)),!1===i&&"custom"===N(".end-date-option").val()&&""===N(".end-date-custom").val()&&(i=!0,$(3,1,N(".end-date-custom"),0,objectL10n.yopPollParams.saveParams.noEndDate)),!1===i&&"yes"===N(".redirect-after-vote").val()&&""===N(".redirect-url").val()&&(i=!0,$(3,1,N(".redirect-url"),0,"")),!1===i&&"yes"===N(".send-email-notifications").val()&&(!1===i&&""===N(".email-notifications-from-name").val()&&(i=!0,$(3,1,N(".email-notifications-from-name"),0,"")),!1===i&&""===N(".email-notifications-from-email").val()&&(i=!0,$(3,1,N(".email-notifications-from-email"),0,"")),!1===i&&""===N(".email-notifications-recipients").val()&&(i=!0,$(3,1,N(".email-notifications-recipients"),0,"")),!1===i&&""===N(".email-notifications-subject").val()&&(i=!0,$(3,1,N(".email-notifications-subject"),0,"")),!1===i&&""===N(".email-notifications-message").val()&&(i=!0,$(3,1,N(".email-notifications-message"),0,""))),!1===i&&"yes"===N(".enable-gdpr").val()&&"consent"===N(".gdpr-solution").val()&&""===N(".gdpr-consent-text").val()&&(i=!0,$(3,1,N(".gdpr-consent-text"),0,"")),N(".vote-permissions:checked").each(function(t){Y.push(N(this).val())}),!1===i&&0===Y.length&&(i=!0,$(3,2,N(".vote-permissions"),0,"")),N(".block-voters:checked").each(function(t){R.push(N(this).val())}),!1===i&&0<R.length&&-1===N.inArray("no-block",R)&&"limited-time"===N(".block-length-type").val()&&""===N(".block-length-1").val()&&(i=!0,$(3,2,N(".block-length-1"),0,"")),!1===i&&"yes"===N(".limit-votes-per-user").val()&&""===N(".votes-per-user-allowed").val()&&(i=!0,$(3,2,N(".votes-per-user-allowed"),0,"")),N(".show-results-moment:checked").each(function(t){z.push(N(this).val())}),!1===i&&0===z.length&&(i=!0,$(3,3,N(".show-results-moment"),0,objectL10n.yopPollParams.saveParams.noShowResultsMoment)),!1===i&&-1<N.inArray("custom-date",z)&&""===N(".custom-date-results").val()&&(i=!0,$(3,3,N(".custom-date-results"),0,objectL10n.yopPollParams.saveParams.noCustomDate)),N(".show-results-to:checked").each(function(t){Q.push(N(this).val())}),N(".results-details-option:checked").each(function(t){H.push(N(this).val())}),!1===i&&-1===N.inArray("never",z)&&(0===Q.length&&(i=!0,$(3,3,N(".show-results-to"),0,objectL10n.yopPollParams.saveParams.noShowResultsTo)),!1===i&&0===H.length&&(i=!0,$(3,3,N(".results-details-option"),0,objectL10n.yopPollParams.saveParams.noShowResultsDetails))),!1===i&&"yes"===N(".back-to-vote-option").val()&&""===N(".back-to-vote-caption").val()&&(i=!0,$(3,3,N(".back-to-vote-caption"),0,"")),!1===i&&!0===N('input.vote-permissions[value="registered"]').is(":checked")&&"no"===N(".allow-wordpress-votes").val()&&(i=!0,$(3,3,N(".allow-wordpress-votes"),0,objectL10n.yopPollParams.saveParams.noVoteAsWordpress)),!1===i&&(N(".poll-elements-list").find(".poll-element").each(function(t){var e=N(this).attr("data-type"),s=[];switch(e){case"text-question":N(this).find(".answer").each(function(t){s[t]={id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"text",text:N(this).find(".answer-value").val(),options:{makeDefault:N(this).find(".answer-make-default").is(":checked")?"yes":"no",makeLink:N(this).find(".answer-make-link").is(":checked")?"yes":"no",link:N(this).find(".answer-link").val(),resultsColor:N(this).find(".answer-results-color").val()}}}),F.push({id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"text-question",text:N(this).find(".question-value").val(),answers:s,answersRemoved:N(this).attr("data-remove"),options:{allowOtherAnswers:N(this).find(".allow-other-answers").val(),otherAnswersLabel:N(this).find(".other-answers-label").val(),addOtherAnswers:N(this).find(".add-other-answers").val(),displayOtherAnswersInResults:N(this).find(".display-other-answers-in-results").val(),resultsColorForOtherAnswers:N(this).find(".other-answers-results-color").val(),allowMultipleAnswers:N(this).find(".allow-multiple-answers").val(),multipleAnswersMinim:N(this).find(".multiple-answers-minim").val(),multipleAnswersMaxim:N(this).find(".multiple-answers-maxim").val(),answersDisplay:N(this).find(".answers-display").val(),answersColumns:N(this).find(".answers-columns").val(),answersSort:N(this).find(".answers-sort").val()}});break;case"custom-field":F.push({id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"custom-field",text:N(this).find(".custom-field-name").val(),options:{makeRequired:N(this).find(".custom-field-make-required").is(":checked")?"yes":"no",cType:N(this).find(".custom-field-type").val()}})}}),e={id:N('input[name="poll[id]"]').val(),name:N('input[name="poll[name]"]').val(),status:N("#poll_status").val(),design:{template:N('input[name="poll[template]"]').val(),templateBase:N('input[name="poll[template]"]').attr("data-template-base"),skinBase:N('input[name="poll[skin]"]').attr("data-skin-base"),style:{poll:{backgroundColor:N(".poll-background-color").val(),borderSize:N(".poll-border-size").val(),borderColor:N(".poll-border-color").val(),borderRadius:N(".poll-border-radius").val(),paddingLeftRight:N(".poll-padding-left-right").val(),paddingTopBottom:N(".poll-padding-top-bottom").val()},questions:{textColor:N(".questions-text-color").val(),textSize:N(".questions-text-size").val(),textWeight:N(".questions-text-weight").val(),textAlign:N(".questions-text-align").val()},answers:{paddingLeftRight:N(".answers-padding-left-right").val(),paddingTopBottom:N(".answers-padding-top-bottom").val(),textColor:N(".answers-text-color").val(),textSize:N(".answers-text-size").val(),textWeight:N(".answers-text-weight").val(),skin:N(".answers-style-settings").find(".answers-skin").val(),colorScheme:N(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")},buttons:{backgroundColor:N(".buttons-background-color").val(),borderSize:N(".buttons-border-size").val(),borderColor:N(".buttons-border-color").val(),borderRadius:N(".buttons-border-radius").val(),paddingLeftRight:N(".buttons-padding-left-right").val(),paddingTopBottom:N(".buttons-padding-top-bottom").val(),textColor:N(".buttons-text-color").val(),textSize:N(".buttons-text-size").val(),textWeight:N(".buttons-text-weight").val()},captcha:{},errors:{borderLeftColorForSuccess:N(".errors-border-left-color-for-success").val(),borderLeftColorForError:N(".errors-border-left-color-for-error").val(),borderLeftSize:N(".errors-border-left-size").val(),paddingTopBottom:N(".errors-padding-top-bottom").val(),textColor:N(".errors-text-color").val(),textSize:N(".errors-text-size").val(),textWeight:N(".errors-text-weight").val()},custom:{css:N(".custom-styles-custom-css").val()}}},options:{poll:{voteButtonLabel:N(".vote-button-label").val(),showResultsLink:N(".show-results-link").val(),resultsLabelText:N(".results-label-text").val(),showTotalVotes:N(".show-total-votes").val(),showTotalAnswers:N(".show-total-answers").val(),startDateOption:N(".start-date-option").val(),startDateCustom:N(".start-date-custom-hidden").val(),endDateOption:N(".end-date-option").val(),endDateCustom:N(".end-date-custom-hidden").val(),redirectAfterVote:N(".redirect-after-vote").val(),redirectUrl:N(".redirect-url").val(),resetPollStatsAutomatically:N(".reset-poll-stats-automatically").val(),resetPollStatsOn:N(".reset-poll-stats-on-hidden").val(),resetPollStatsEvery:N(".reset-poll-stats-every").val(),resetPollStatsEveryPeriod:N(".reset-poll-stats-every-period").val(),autoGeneratePollPage:N(".auto-generate-poll-page").val(),pageId:"",pageLink:"",useCaptcha:N(".use-captcha").val(),sendEmailNotifications:N(".send-email-notifications").val(),emailNotificationsFromName:N(".email-notifications-from-name").val(),emailNotificationsFromEmail:N(".email-notifications-from-email").val(),emailNotificationsRecipients:N(".email-notifications-recipients").val(),emailNotificationsSubject:N(".email-notifications-subject").val(),emailNotificationsMessage:N(".email-notifications-message").val(),enableGdpr:N(".enable-gdpr").val(),gdprSolution:N(".gdpr-solution").val(),gdprConsentText:N(".gdpr-consent-text").val(),loadWithAjax:N(".load-with-ajax").val(),notificationMessageLocation:N(".poll-options-notification-message-location").val()},access:{votePermissions:Y,allowWordpressVotes:N(".allow-wordpress-votes").val(),blockVoters:R,blockLengthType:N(".block-length-type").val(),blockForValue:N(".block-length-1").val(),blockForPeriod:N(".block-length-2").val(),limitVotesPerUser:N(".limit-votes-per-user").val(),votesPerUserAllowed:N(".votes-per-user-allowed").val()},results:{showResultsMoment:z,customDateResults:N(".custom-date-results-hidden").val(),showResultsTo:Q,resultsDetails:H,backToVoteOption:N(".back-to-vote-option").val(),backToVoteCaption:N(".back-to-vote-caption").val(),sortResults:N(".sort-results").val(),sortResultsRule:N(".sort-results-rule").val(),displayResultsAs:N(".display-results-as").val(),barColor:N(".bar-color").val(),barHeight:N(".bar-height").val()}},elements:F,elementsRemoved:N(".poll-elements-list").attr("data-remove")},N(".spinner.publish").addClass("is-active"),N("#publish-poll").attr("disabled",!0),N.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"update_yop_poll",_token:N("#_token").val(),poll:JSON.stringify(e)}}).done(function(t){N(".spinner.publish").removeClass("is-active"),!0===t.success?(N(".poll-elements-list").attr("data-remove",""),N(".poll-element").attr("data-remove",""),N(t.data.newElements).each(function(t,e){N(".poll-elements").find('.poll-element[data-uid="'+e.uid+'"]').attr({"data-id":e.id,"data-uid":""})}),N(t.data.newSubElements).each(function(t,e){N(".poll-elements").find('.answer[data-uid="'+e.uid+'"]').attr({"data-id":e.id,"data-uid":""})}),toastr.success(htmlEncode(striptags(t.data.message)),"",{progressBar:!0,onHidden:function(){N("#publish-poll").attr("disabled",!1)}})):(N("#publish-poll").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()})}),jQuery(document).ready(function(o){function t(t){var e,s,a=window.location.search.substring(1).split("&");for(s=0;s<a.length;s++)if((e=a[s].split("="))[0]===t)return void 0===e[1]||decodeURIComponent(e[1])}var e,s=new Date;"yes"===t("show-code")?(pollId=t("poll-id"),o("#shortcode-popup").find(".generate-yop-poll-code").attr("data-id",pollId),o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+pollId+'"]'),o("#shortcode-popup").modal()):"yop-polls"===t("page")&&o("#yop-poll-guide-modal").length&&(e=s.getFullYear().toString()+s.getMonth().toString()+s.getDate().toString(),null!==localStorage.getItem("ypguide")&&e===localStorage.getItem("ypguide")||(o("#yop-poll-guide-modal").modal("show"),localStorage.setItem("ypguide",e))),o(".delete-poll").click(function(t){var e=o(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deletePollMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_single_yop_poll",_token:o('input[name="_token"]').val(),poll_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),o(".clone-poll").click(function(t){var e=o(this).attr("data-id");BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.clonePollMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"clone_single_yop_poll",_token:o('input[name="_token"]').val(),poll_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),o("#current-poll-page-selector").keypress(function(t){var e,s,a,i,n=document.URL.split("?");if(13===t.which){if(void 0!==n[1])for(q=n[1].split("&"),s=0;s<q.length;s++)a=0===s?"?":"&","page_no"===(e=q[s].split("="))[0]?(i=e[1],n[0]+=a+e[0]+"="+o(this).val()):(e[1]=void 0!==e[1]?e[1]:"",n[0]+=a+e[0]+"="+e[1]);i!==o(this).val()&&window.location.assign(n[0])}}),o(".bulk-action").click(function(t){var e,s=o(".bulk-action-"+o(this).attr("data-position")).val(),a=[];switch(o('input[name="polls[]"]:checked').each(function(t){a.push(o(this).val())}),s){case"trash":formAction="delete_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.deleteBulkPollsMultiMessage:objectL10n.yopPollParams.deleteBulkPollsSingleMessage;break;case"clone":formAction="clone_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.cloneBulkPollsMultiMessage:objectL10n.yopPollParams.cloneBulkPollsSingleMessage;break;case"reset-votes":formAction="reset_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.resetBulkPollsMultiMessage:objectL10n.yopPollParams.resetBulkPollsSingleMessage;break;default:formAction=""}""!==formAction?0<a.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:formAction,_token:o('input[name="_bulk_token"]').val(),polls:JSON.stringify(a)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noPollsSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]}),t.preventDefault()}),o(".get-poll-code").click(function(){var t=o(this).attr("data-id");o("#shortcode-popup").find(".generate-yop-poll-code").attr("data-id",t),o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+t+'"]'),o("#shortcode-popup").modal()}),o(".generate-yop-poll-code").click(function(t){var e=o(this).attr("data-id"),s=o("#shortcode-popup").find(".shortcode-tracking-id").val();"no"===o("#shortcode-popup").find(".shortcode-show-results").val()?""!==s?o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'" tracking_id="'+s+'"]'):o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'"]'):o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'" show_results="1"]'),t.preventDefault()}),o(".send-poll-guide").click(function(t){var e=o(".guide-email").val();""!==e.trim()?(o.LoadingOverlay("show"),o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_send_guide",input:e}}).done(function(t){o.LoadingOverlay("hide"),o("#yop-poll-guide-modal").modal("hide"),toastr.success("Guide sent. Please check your inbox.")})):o(".email-container").addClass("has-error"),t.preventDefault()}),o(".stop-showing-guide").click(function(t){o.LoadingOverlay("show"),o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_stop_showing_guide",stop:"no"}}).done(function(t){o.LoadingOverlay("hide"),o("#yop-poll-guide-modal").modal("hide")}),t.preventDefault()})}),jQuery(document).ready(function(i){i(".add-ban").click(function(t){var e,s=!1;e=i(".ban-value").val(),!1===s&&""===e&&(s=!0,i(".ban-value").focus(),i(".ban-value").parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveBanParams.noBanValue)))),!1===s&&(formData={ban:{poll_id:i(".ban-poll").val(),b_by:i(".ban-by").val(),b_value:i(".ban-value").val()}},i(".add-ban").attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"create_yop_poll_ban",_token:i("#_token").val(),ban:JSON.stringify(formData)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):(i(".add-ban").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".ban-for").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".ban-value").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".delete-ban").click(function(t){var e=i(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteBanMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_yop_poll_ban",_token:i('input[name="_token"]').val(),ban_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),i(".update-ban").click(function(t){var e,s,a=!1;banFor=i(".ban-for").val(),e=i(".ban-value").val(),!1===a&&""===e&&(a=!0,i(".ban-value").focus(),i(".ban-value").parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveBanParams.noBanValue)))),!1===a&&(s={ban:{id:i(this).attr("data-id"),poll_id:i(".ban-poll").val(),b_by:i(".ban-by").val(),b_value:i(".ban-value").val()}},i(".update-ban").attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"update_yop_poll_ban",_token:i("#_token").val(),ban:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):(i(".add-ban").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".bans-bulk-action").click(function(t){var e,s=[];i('input[name="bans[]"]:checked').each(function(t){s.push(i(this).val())}),"trash"===i(".bans-bulk-action-"+i(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkBansMultiMessage:objectL10n.yopPollParams.deleteBulkBansSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_bulk_yop_poll_ban",_token:i('input[name="_bulk_token"]').val(),bans:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBansSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})})}),jQuery(document).ready(function(a){a(".delete-log").click(function(t){var e=a(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteLogMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_yop_poll_log",_token:a('input[name="_token"]').val(),log_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-logs")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),a(".logs-bulk-action").click(function(t){var e,s=[];a('input[name="logs[]"]:checked').each(function(t){s.push(a(this).val())}),"trash"===a(".logs-bulk-action-"+a(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkLogsMultiMessage:objectL10n.yopPollParams.deleteBulkLogsSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_bulk_yop_poll_log",_token:a('input[name="_bulk_token"]').val(),logs:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-logs")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noLogsSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})}),a(".view-log-details").click(function(t){var e=a(this).data("id"),s=a(this).parent().parent().next(".log-details-div");a(s).is(":visible")?(a(s).fadeOut("slow"),a(this).text(objectL10n.yopPollParams.showLogDetailsLinkText)):(a(this).text(objectL10n.yopPollParams.hideLogDetailsLinkText),"yes"===a(s).data("ajax_sent")?a(s).fadeIn("slow"):(a.LoadingOverlay("show"),a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"get_yop_poll_log_details",_token:a('input[name="_token"]').val(),log_id:e}}).done(function(t){!0===t.success?(strDetails=t.data.details,a(s).html(strDetails).fadeIn("slow"),a(s).data("ajax_sent","yes")):toastr.warning(htmlEncode(striptags(t.data))),a.LoadingOverlay("hide")}))),t.preventDefault()}),a(".export-logs-button").click(function(t){a("#doExport").val("true"),a("#searchForm").submit()}),a("#search-submit").click(function(t){a("#doExport").val("false")})}),jQuery(document).ready(function(d){d(".progress-bar").each(function(){d(this).yopprogressbar({})}),d(".element-results-header").click(function(t){var e=d(this).closest(".panel").find(".panel-collapse");d(e).hasClass("in")?d(this).find("a").first().removeClass("collapsed"):d(this).find("a").first().addClass("collapsed"),d(e).collapse("toggle"),t.preventDefault()}),d(".answers-chart-type").on("change",function(t){var e,s,a,i,n,o,r,l,c;if(function(){return"rgb("+Math.floor(255*Math.random())+","+Math.floor(255*Math.random())+","+Math.floor(255*Math.random())+")"},e=d(this).val(),s=d(this).closest(".panel-body").find(".chart-canvas"),a=d(this).closest(".panel-body").find(".bar-chart-div"),"pie"===e){for(d(s).show(),d(a).hide(),i=d(s).data("jsondata"),n=d(s).data("jsonlabels"),o=d(s).data("resultscolor"),l=d(s).data("icons"),r=[],c=0;c<l.length;c++)"other"===l[c]?(r.push(""),n[c]+=" "):r.push("");new Chart(s,{type:"pie",responsive:!0,maintainAspectRatio:!0,data:{labels:n,icons:r,datasets:[{label:objectL10n.yopPollParams.numberOfVotesText,data:i,backgroundColor:o,icons:r,datalabels:{anchor:"end"}}]},pointLabelFontFamily:"'FontAwesome'",scaleFontFamily:"'FontAwesome'",options:{legend:{display:!0,labels:{fontFamily:"'FontAwesome'",fontSize:12}},tooltips:{enabled:!0,titleFontFamily:"'FontAwesome'",bodyFontFamily:"'FontAwesome'",footerFontFamily:"'FontAwesome'"},tooltipTitleFontFamily:"'FontAwesome'",plugins:{datalabels:{anchor:"end",borderColor:"red",borderRadius:5,borderWidth:0,color:"#387cb7",font:{family:"FontAwesome",size:20},display:!0,formatter:function(t,e){return e.chart.data.icons[e.dataIndex]}}}}})}else"bar"===e&&(d(s).hide(),d(a).show())}),d(".voters-chart-type").on("change",function(t){var e,s,a,i,n,o;e=d(this).val(),s=d(this).closest(".panel-body").find(".chart-voters-canvas"),a=d(this).closest(".panel-body").find(".bar-chart-voters-div"),"pie"===e?(d(s).show(),d(a).hide(),i=d(s).data("jsondata"),n=d(s).data("jsonlabels"),o=d(s).data("resultscolor"),new Chart(s,{type:"pie",responsive:!0,maintainAspectRatio:!0,data:{labels:n,datasets:[{label:"Number of Votes",data:i,backgroundColor:o}]}})):"bar"===e&&(d(s).hide(),d(a).show())}),d("#cf-pagination").bootpag({total:d("#cf-total-pages").val()}).on("page",function(t,e){d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"get_yop_poll_votes_customs",_token:d('input[name="_token"]').val(),page:e,poll_id:d("#poll_id").val()}}).done(function(t){!0===t.success?d("#cf-table tbody").html(t.data):toastr.warning(htmlEncode(striptags(t.data)))})}),d(".details-operation").click(function(t){var e,s,a,i;e=d(this).data("vote-id"),s=d(this).data("ajax-sent"),a=d("#vote-details-div-"+e),i=d(this),d(a).is(":visible")?d(a).fadeOut("slow"):"yes"===s?d("#vote-details-div-"+e).fadeIn("slow"):(d.LoadingOverlay("show"),d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop-poll-get-vote-details",_token:d('input[name="_token"]').val(),voteid:e}}).done(function(t){!0===t.success?(d(a).html(t.data.details),d(a).fadeIn("slow"),d(i).data("ajax-sent","yes")):toastr.warning(htmlEncode(striptags(t.data))),d.LoadingOverlay("hide")})),t.preventDefault()}),d(".delete-vote").click(function(t){var e=d(this).attr("data-id"),s=d('input[name="poll_id"]').val();""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteBulkVotesSingleMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_delete_vote",_token:d('input[name="_token"]').val(),poll_id:s,vote_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+s)}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),d(".votes-bulk-action").click(function(t){var e,s=[],a=d('input[name="poll_id"]').val(),i=d("#votes-search-input").val();d('input[name="votes[]"]:checked').each(function(t){s.push(d(this).val())}),"trash"===d(".logs-bulk-action-"+d(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkVotessMultiMessage:objectL10n.yopPollParams.deleteBulkVotesSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_delete_votes_bulk",_token:d('input[name="_bulk_token"]').val(),poll_id:a,votes:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+a+"&q="+i)}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noVotesSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})}),d(".btn-submit-add-votes-manually").click(function(){var e=d(this).attr("data-poll-id"),s=[];d(".section-main-add-votes-manually .question-section").each(function(t){var e=[];d(this).find(".answer-element").each(function(t){e[t]={id:d(this).attr("data-id"),votes:d(this).val()}}),s[t]={id:d(this).attr("data-id"),answers:e}}),d(".section-footer-add-votes-manually .btn-submit-add-votes-manually").attr("disabled",!0),d(".section-footer-add-votes-manually .spinner").removeClass("hide").addClass("is-active"),d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll-add-votes-manually",_token:d('input[name="_token-add-votes-manually"]').val(),id:e,data:JSON.stringify(s)}}).done(function(t){d(".section-footer-add-votes-manually .spinner").removeClass("is-active").addClass("hide"),!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+e)}}):(d(".section-footer-add-votes-manually .btn-submit-add-votes-manually").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})}),d(".btn-cancel-add-votes-manually").click(function(){d(".section-footer-add-votes-manually .spinner").removeClass("is-active").addClass("hide"),d("#modal-add-votes-manually").modal("hide")})}),jQuery(document).ready(function(i){function s(t,e,s,a){switch(t){case"tab-notifications":i("#tab-notifications").addClass("active"),i("#settings-notifications").addClass("active"),i("#tab-integrations").removeClass("active"),i("#settings-integrations").removeClass("active"),i("#tab-messages").removeClass("active"),i("#settings-messages").removeClass("active");break;case"tab-integrations":i("#tab-integrations").addClass("active"),i("#settings-integrations").addClass("active"),i("#tab-notifications").removeClass("active"),i("#settings-notifications").removeClass("active"),i("#tab-messages").removeClass("active"),i("#settings-messages").removeClass("active");break;case"tab-messages":switch(i("#tab-messages").addClass("active"),i("#settings-messages").addClass("active"),i("#tab-notifications").removeClass("active"),i("#settings-notifications").removeClass("active"),i("#tab-integrations").removeClass("active"),i("#settings-integrations").removeClass("active"),e){case 1:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").removeClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 2:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").removeClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 3:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").removeClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 4:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').addClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").removeClass("hide")}}i("#"+s).css("borderColor","#f00"),""!==a&&toastr.warning(htmlEncode(striptags(a)))}var a;i(".settings-required-field").focusout(function(t){""!==i.trim(i(this).val())&&i(this).css("borderColor","#ccc")}),i(".save-settings").click(function(t){var e=!1;"yes"===i(".integrations-reCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptcha-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptcha-site-key",i("#integrations-reCaptcha-site-key").closest(".integrations-reCaptcha-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptcha-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptcha-secret-key",i("#integrations-reCaptcha-secret-key").closest(".integrations-reCaptcha-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptchaV2Invisible-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV2Invisible-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV2Invisible-site-key",i("#integrations-reCaptchaV2Invisible-site-key").closest(".integrations-reCaptchaV2Invisible-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV2Invisible-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV2Invisible-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV2Invisible-secret-key",i("#integrations-reCaptchaV2Invisible-secret-key").closest(".integrations-reCaptchaV2Invisible-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-site-key",i("#integrations-reCaptchaV3-site-key").closest(".integrations-reCaptchaV3-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-secret-key",i("#integrations-reCaptchaV3-secret-key").closest(".integrations-reCaptchaV3-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-min-allowed-score").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-min-allowed-score",i("#integrations-reCaptchaV3-min-allowed-score").closest(".integrations-reCaptchaV3-section").find(".input-caption").eq(2).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-anonymous").val())&&(e=!0,s("tab-messages",1,"messages-buttons-anonymous",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-anonymous").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-wordpress").val())&&(e=!0,s("tab-messages",1,"messages-buttons-wordpress",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-wordpress").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-facebook").val())&&(e=!0,s("tab-messages",1,"messages-buttons-facebook",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-facebook").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-google").val())&&(e=!0,s("tab-messages",1,"messages-buttons-google",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-google").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-poll-ended").val())&&(e=!0,s("tab-messages",2,"messages-voting-poll-ended",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-poll-ended").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-poll-not-started").val())&&(e=!0,s("tab-messages",2,"messages-voting-poll-not-started",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-poll-not-started").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-already-voted-on-poll").val())&&(e=!0,s("tab-messages",2,"messages-voting-already-voted-on-poll",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-already-voted-on-poll").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-invalid-poll").val())&&(e=!0,s("tab-messages",2,"messages-voting-invalid-poll",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-invalid-poll").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-answer-selected").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-answer-selected",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-answer-selected").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-min-answers-required").val())&&(e=!0,s("tab-messages",2,"messages-voting-min-answers-required",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-min-answers-required").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-max-answers-required").val())&&(e=!0,s("tab-messages",2,"messages-voting-max-answers-required",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-max-answers-required").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-value-for-other").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-value-for-other",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-value-for-other").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-value-for-custom-field").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-value-for-custom-field",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-value-for-custom-field").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-consent-not-checked").val())&&(e=!0,s("tab-messages",2,"messages-voting-consent-not-checked",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-consent-not-checked").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-captcha-not-checked").val())&&(e=!0,s("tab-messages",2,"messages-voting-captcha-not-checked",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-captcha-not-checked").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-ban").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-ban",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-ban").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-block").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-block",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-block").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-limit").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-limit",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-limit").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-thank-you").val())&&(e=!0,s("tab-messages",2,"messages-voting-thank-you",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-thank-you").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-single-vote").val())&&(e=!0,s("tab-messages",3,"messages-results-single-vote",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-single-vote").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-multiple-votes").val())&&(e=!0,s("tab-messages",3,"messages-results-multiple-votes",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-multiple-votes").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-single-answer").val())&&(e=!0,s("tab-messages",3,"messages-results-single-answer",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-single-answer").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-multiple-answers").val())&&(e=!0,s("tab-messages",3,"messages-results-multiple-answers",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-multiple-answers").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-alt").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-alt",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-alt").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-title").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-title",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-title").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-description").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-description",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-description").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-explanation").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-explanation",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-explanation").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-refresh-alt").val())&&(e=!0,s("tab-messages",4,"messages-captcha-refresh-alt",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-refresh-alt").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-refresh-title").val())&&(e=!0,s("tab-messages",4,"messages-captcha-refresh-title",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-refresh-title").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&(a={general:{"remove-data":i("#general-remove-data").val()},notifications:{"new-vote":{"from-name":i("#email-from-name").val(),"from-email":i("#email-from-email").val(),subject:i("#email-subject").val(),recipients:i("#email-recipients").val(),message:i("#email-message").val()}},integrations:{reCaptcha:{enabled:i("#integrations-reCaptcha-enabled").val(),"site-key":i("#integrations-reCaptcha-site-key").val(),"secret-key":i("#integrations-reCaptcha-secret-key").val()},reCaptchaV2Invisible:{enabled:i("#integrations-reCaptchaV2Invisible-enabled").val(),"site-key":i("#integrations-reCaptchaV2Invisible-site-key").val(),"secret-key":i("#integrations-reCaptchaV2Invisible-secret-key").val()},reCaptchaV3:{enabled:i("#integrations-reCaptchaV3-enabled").val(),"site-key":i("#integrations-reCaptchaV3-site-key").val(),"secret-key":i("#integrations-reCaptchaV3-secret-key").val(),"min-allowed-score":i("#integrations-reCaptchaV3-min-allowed-score").val()},facebook:{enabled:i("#integrations-facebook-enabled").val(),"app-id":i("#integrations-facebook-app-id").val()},google:{enabled:i("#integrations-google-enabled").val(),"app-id":i("#integrations-google-app-id").val(),"app-secret":i("#integrations-google-app-secret").val()}},messages:{captcha:{"accessibility-alt":i("#messages-captcha-accessibility-alt").val(),"accessibility-title":i("#messages-captcha-accessibility-title").val(),"accessibility-description":i("#messages-captcha-accessibility-description").val(),explanation:i("#messages-captcha-accessibility-explanation").val(),"refresh-alt":i("#messages-captcha-refresh-alt").val(),"refresh-title":i("#messages-captcha-refresh-title").val()},buttons:{anonymous:i("#messages-buttons-anonymous").val(),wordpress:i("#messages-buttons-wordpress").val(),facebook:i("#messages-buttons-facebook").val(),google:i("#messages-buttons-google").val()},voting:{"poll-ended":i("#messages-voting-poll-ended").val(),"poll-not-started":i("#messages-voting-poll-not-started").val(),"already-voted-on-poll":i("#messages-voting-already-voted-on-poll").val(),"invalid-poll":i("#messages-voting-invalid-poll").val(),"no-answers-selected":i("#messages-voting-no-answer-selected").val(),"min-answers-required":i("#messages-voting-min-answers-required").val(),"max-answers-required":i("#messages-voting-max-answers-required").val(),"no-answer-for-other":i("#messages-voting-no-value-for-other").val(),"no-value-for-custom-field":i("#messages-voting-no-value-for-custom-field").val(),"consent-not-checked":i("#messages-voting-consent-not-checked").val(),"no-captcha-selected":i("#messages-voting-captcha-not-checked").val(),"not-allowed-by-ban":i("#messages-voting-vote-not-allowed-by-ban").val(),"not-allowed-by-block":i("#messages-voting-vote-not-allowed-by-block").val(),"not-allowed-by-limit":i("#messages-voting-vote-not-allowed-by-limit").val(),"thank-you":i("#messages-voting-thank-you").val()},results:{"single-vote":i("#messages-results-single-vote").val(),"multiple-votes":i("#messages-results-multiple-votes").val(),"single-answer":i("#messages-results-single-answer").val(),"multiple-answers":i("#messages-results-multiple-answers").val()}}},i(".spinner.publish").addClass("is-active"),i(this).attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_save_settings",_token:i("#_token").val(),settings:JSON.stringify(a)}}).done(function(t){i(".spinner.publish").removeClass("is-active"),!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){i(".save-settings").attr("disabled",!1)}}):(i(".save-settings").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".integrations-reCaptcha-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptcha-section").removeClass("hide"):i(".integrations-reCaptcha-section").addClass("hide")}),i(".integrations-reCaptchaV2Invisible-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptchaV2Invisible-section").removeClass("hide"):i(".integrations-reCaptchaV2Invisible-section").addClass("hide")}),i(".integrations-reCaptchaV3-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptchaV3-section").removeClass("hide"):i(".integrations-reCaptchaV3-section").addClass("hide")}),i(".integrations-facebook-enabled").on("change",function(t){"yes"===i(this).val()&&(i('.integrations-facebook-enabled option[value="no"]').prop("selected",!0),showUpgradeToPro("facebook"),t.preventDefault())}),i(".integrations-google-enabled").on("change",function(t){"yes"===i(this).val()&&(i('.integrations-google-enabled option[value="no"]').prop("selected",!0),showUpgradeToPro("google"),t.preventDefault())})});var getParameterFromUrl=getUrlParameter=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},showUpgradeToPro=function(t){jQuery("#yop-poll-upgrade-modal-short").modal("show"),jQuery("#yop-poll-upgrade-modal-long").modal("show")};jQuery(document).ready(function(a){var i;a(".migrate-section").on("change",function(t){"yes"===a(this).val()?a(".migrate-section").find(".migrate-gdpr-solution-section").removeClass("hide"):a(".migrate-section").find(".migrate-gdpr-solution-section").addClass("hide")}),i=function(t,e,s){a.ajax({type:"POST",url:ajaxurl,data:{table:t,action:"yop_ajax_migrate",_csrf_token:a("#_csrf_token").val(),enableGdpr:a(".migrate-section").find(".migrate-enable-gdpr").val(),gdprSolution:a(".migrate-section").find(".migrate-gdpr-solution").val(),response_code:e,skip_table_check:s},dataType:"json",success:function(t){"done"===t.data.response_code?(a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.response+" "+t.data.message+"</p>"),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.allDone+"</p>")):(a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.response+" "+t.data.message+"</p>"),i(t.data.table,t.data.response_code,t.data.skip_table_check))},error:function(t){}}).fail(function(t){})},a(".send-request").click(function(){var t,e=a(".migrate-section").find(".migrate-enable-gdpr").val(),s=a(".migrate-section").find(".migrate-gdpr-solution").val();if("yes"===e){switch(s){case"consent":t=objectL10n.yopPollParams.importOld.gdprEnabledMigrateAsIs;break;case"anonymize":t=objectL10n.yopPollParams.importOld.gdprEnabledAnonymizeIp;break;case"nostore":t=objectL10n.yopPollParams.importOld.gdprEnabledNoStore}t=objectL10n.yopPollParams.importOld.gdprEnabledGeneral+"<br><br>"+objectL10n.yopPollParams.importOld.gdprEnabledChoice+": <b>"+a(".migrate-section").find(".migrate-gdpr-solution").find("option:selected").text()+"</b><br><br>"+t,BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:t,btnCancelLabel:objectL10n.yopPollParams.importOld.gdprEnabledStop,btnOKLabel:objectL10n.yopPollParams.importOld.gdprEnabledContinue,callback:function(t){t&&(a(".migrate-output").html(""),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.importStarted+"</p>"),i("bans",1,!1))}})}else a(".migrate-output").html(""),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.importStarted+"</p>"),i("bans",1,!1)})});
|
1 |
+
if(!function(t){"function"==typeof define&&define.amd?define(["jquery","jquery-ui"],t):t(jQuery)}(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.6.3"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(t){return extendRemove(this._defaults,t||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(t){inlineSettings[attrName]=attrValue}}for(i in overrides={beforeShow:function(t,e){if($.isFunction(tp_inst._defaults.evnts.beforeShow))return tp_inst._defaults.evnts.beforeShow.call($input[0],t,e,tp_inst)},onChangeMonthYear:function(t,e,s){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],t,e,s,tp_inst)},onClose:function(t,e){!0===tp_inst.timeDefined&&""!==$input.val()&&tp_inst._updateDateTime(e),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],t,e,tp_inst)}},overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||this._defaults[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(t){return t.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(t){return t.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&void 0===$.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(0<tzl&&"object"!=typeof timezoneList[0])for(;tzi<tzl;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),!0===tp_inst._defaults.altRedirectFocus&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),0!==tp_inst._defaults.minDate&&0!==tp_inst._defaults.minDateTime||(tp_inst._defaults.minDate=new Date),0!==tp_inst._defaults.maxDate&&0!==tp_inst._defaults.maxDateTime||(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(t){var e=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(e),this._limitMinMaxDateTime(t,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(e,t){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),t||!this._defaults.timeOnly){var s=$.datepicker._get(this.inst,"dateFormat");try{var a=parseDateTimeInternal(s,this._defaults.timeFormat,e,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!a.timeObj)return!1;$.extend(this,a.timeObj)}catch(t){return $.timepicker.log("Error parsing the date/time string: "+t+"\ndate/time string = "+e+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+s),!1}return!0}var i=$.datepicker.parseTime(this._defaults.timeFormat,e,this._defaults);return!!i&&($.extend(this,i),!0)},_afterInject:function(){var t=this.inst.settings;$.isFunction(t.afterInject)&&t.afterInject.call(this)},_injectTimePicker:function(){var t=this.inst.dpDiv,e=this.inst.settings,o=this,r="",s="",a=null,i={},n={},l=null,c=0,d=0;if(0===t.find("div.ui-timepicker-div").length&&e.showTimepicker){var u=" ui_tpicker_unit_hide",p='<div class="ui-timepicker-div'+(e.isRTL?" ui-timepicker-rtl":"")+(e.oneLine&&"select"===e.controlType?" ui-timepicker-oneLine":"")+'"><dl><dt class="ui_tpicker_time_label'+(e.showTime?"":u)+'">'+e.timeText+'</dt><dd class="ui_tpicker_time '+(e.showTime?"":u)+'"><input class="ui_tpicker_time_input" '+(e.timeInput?"":"disabled")+"/></dd>";for(c=0,d=this.units.length;c<d;c++){if(a=null!==e["show"+(s=(r=this.units[c]).substr(0,1).toUpperCase()+r.substr(1))]?e["show"+s]:this.support[r],i[r]=parseInt(e[r+"Max"]-(e[r+"Max"]-e[r+"Min"])%e["step"+s],10),n[r]=0,p+='<dt class="ui_tpicker_'+r+"_label"+(a?"":u)+'">'+e[r+"Text"]+'</dt><dd class="ui_tpicker_'+r+(a?"":u)+'"><div class="ui_tpicker_'+r+"_slider"+(a?"":u)+'"></div>',a&&0<e[r+"Grid"]){if(p+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===r)for(var h=e[r+"Min"];h<=i[r];h+=parseInt(e[r+"Grid"],10)){n[r]++;var m=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:h},e);p+='<td data-for="'+r+'">'+m+"</td>"}else for(var f=e[r+"Min"];f<=i[r];f+=parseInt(e[r+"Grid"],10))n[r]++,p+='<td data-for="'+r+'">'+(f<10?"0":"")+f+"</td>";p+="</tr></table></div>"}p+="</dd>"}var g=null!==e.showTimezone?e.showTimezone:this.support.timezone;p+='<dt class="ui_tpicker_timezone_label'+(g?"":u)+'">'+e.timezoneText+"</dt>",p+='<dd class="ui_tpicker_timezone'+(g?"":u)+'"></dd>';var v=$(p+="</dl></div>");for(!0===e.timeOnly&&(v.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+e.timeOnlyTitle+"</div></div>"),t.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),c=0,d=o.units.length;c<d;c++)a=null!==e["show"+(s=(r=o.units[c]).substr(0,1).toUpperCase()+r.substr(1))]?e["show"+s]:this.support[r],o[r+"_slider"]=o.control.create(o,v.find(".ui_tpicker_"+r+"_slider"),r,o[r],e[r+"Min"],i[r],e["step"+s]),a&&0<e[r+"Grid"]&&(l=100*n[r]*e[r+"Grid"]/(i[r]-e[r+"Min"]),v.find(".ui_tpicker_"+r+" table").css({width:l+"%",marginLeft:e.isRTL?"0":l/(-2*n[r])+"%",marginRight:e.isRTL?l/(-2*n[r])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(t){var e=$(this),s=e.html(),a=parseInt(s.replace(/[^0-9]/g),10),i=s.replace(/[^apm]/gi),n=e.data("for");"hour"===n&&(-1!==i.indexOf("p")&&a<12?a+=12:-1!==i.indexOf("a")&&12===a&&(a=0)),o.control.value(o,o[n+"_slider"],r,a),o._onTimeChange(),o._onSelectHandler()}).css({cursor:"pointer",width:100/n[r]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=v.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(e.timezoneList,function(t,e){return $("<option />").val("object"==typeof t?t.value:t).text("object"==typeof t?t.label:t)})),void 0!==this.timezone&&null!==this.timezone&&""!==this.timezone)-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset()===this.timezone?selectLocalTimezone(o):this.timezone_select.val(this.timezone);else void 0!==this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(e.timezone):selectLocalTimezone(o);this.timezone_select.change(function(){o._onTimeChange(),o._onSelectHandler(),o._afterInject()});var b=t.find(".ui-datepicker-buttonpane");if(b.length?b.before(v):t.append(v),this.$timeObj=v.find(".ui_tpicker_time_input"),this.$timeObj.change(function(){var t=o.inst.settings.timeFormat,e=$.datepicker.parseTime(t,this.value),s=new Date;e?(s.setHours(e.hour),s.setMinutes(e.minute),s.setSeconds(e.second),$.datepicker._setTime(o.inst,s)):(this.value=o.formattedTime,this.blur())}),null!==this.inst){var y=this.timeDefined;this._onTimeChange(),this.timeDefined=y}if(this._defaults.addSliderAccess){var w=this._defaults.sliderAccessArgs,k=this._defaults.isRTL;w.isRTL=k,setTimeout(function(){if(0===v.find(".ui-slider-access").length){v.find(".ui-slider:visible").sliderAccess(w);var o=v.find(".ui-slider-access:eq(0)").outerWidth(!0);o&&v.find("table:visible").each(function(){var t=$(this),e=t.outerWidth(),s=t.css(k?"marginRight":"marginLeft").toString().replace("%",""),a=e-o,i=s*a/e+"%",n={width:a,marginRight:0,marginLeft:0};n[k?"marginRight":"marginLeft"]=i,t.css(n)})}},10)}o._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(t,e){var s=this._defaults,a=new Date(t.selectedYear,t.selectedMonth,t.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(t,"minDateTime")&&void 0!==$.datepicker._get(t,"minDateTime")&&a){var i=$.datepicker._get(t,"minDateTime"),n=new Date(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0,0);null!==this.hourMinOriginal&&null!==this.minuteMinOriginal&&null!==this.secondMinOriginal&&null!==this.millisecMinOriginal&&null!==this.microsecMinOriginal||(this.hourMinOriginal=s.hourMin,this.minuteMinOriginal=s.minuteMin,this.secondMinOriginal=s.secondMin,this.millisecMinOriginal=s.millisecMin,this.microsecMinOriginal=s.microsecMin),t.settings.timeOnly||n.getTime()===a.getTime()?(this._defaults.hourMin=i.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=i.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=i.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=i.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=i.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(t,"maxDateTime")&&void 0!==$.datepicker._get(t,"maxDateTime")&&a){var o=$.datepicker._get(t,"maxDateTime"),r=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0);null!==this.hourMaxOriginal&&null!==this.minuteMaxOriginal&&null!==this.secondMaxOriginal&&null!==this.millisecMaxOriginal||(this.hourMaxOriginal=s.hourMax,this.minuteMaxOriginal=s.minuteMax,this.secondMaxOriginal=s.secondMax,this.millisecMaxOriginal=s.millisecMax,this.microsecMaxOriginal=s.microsecMax),t.settings.timeOnly||r.getTime()===a.getTime()?(this._defaults.hourMax=o.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=o.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=o.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=o.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=o.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==t.settings.minTime){var l=new Date("01/01/1970 "+t.settings.minTime);this.hour<l.getHours()?(this.hour=this._defaults.hourMin=l.getHours(),this.minute=this._defaults.minuteMin=l.getMinutes()):this.hour===l.getHours()&&this.minute<l.getMinutes()?this.minute=this._defaults.minuteMin=l.getMinutes():this._defaults.hourMin<l.getHours()?(this._defaults.hourMin=l.getHours(),this._defaults.minuteMin=l.getMinutes()):this._defaults.hourMin===l.getHours()===this.hour&&this._defaults.minuteMin<l.getMinutes()?this._defaults.minuteMin=l.getMinutes():this._defaults.minuteMin=0}if(null!==t.settings.maxTime){var c=new Date("01/01/1970 "+t.settings.maxTime);this.hour>c.getHours()?(this.hour=this._defaults.hourMax=c.getHours(),this.minute=this._defaults.minuteMax=c.getMinutes()):this.hour===c.getHours()&&this.minute>c.getMinutes()?this.minute=this._defaults.minuteMax=c.getMinutes():this._defaults.hourMax>c.getHours()?(this._defaults.hourMax=c.getHours(),this._defaults.minuteMax=c.getMinutes()):this._defaults.hourMax===c.getHours()===this.hour&&this._defaults.minuteMax>c.getMinutes()?this._defaults.minuteMax=c.getMinutes():this._defaults.minuteMax=59}if(void 0!==e&&!0===e){var d=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),u=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),p=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),h=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),m=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:d,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:u,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:p,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:h,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:m,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var t=!!this.hour_slider&&this.control.value(this,this.hour_slider,"hour"),e=!!this.minute_slider&&this.control.value(this,this.minute_slider,"minute"),s=!!this.second_slider&&this.control.value(this,this.second_slider,"second"),a=!!this.millisec_slider&&this.control.value(this,this.millisec_slider,"millisec"),i=!!this.microsec_slider&&this.control.value(this,this.microsec_slider,"microsec"),n=!!this.timezone_select&&this.timezone_select.val(),o=this._defaults,r=o.pickerTimeFormat||o.timeFormat,l=o.pickerTimeSuffix||o.timeSuffix;"object"==typeof t&&(t=!1),"object"==typeof e&&(e=!1),"object"==typeof s&&(s=!1),"object"==typeof a&&(a=!1),"object"==typeof i&&(i=!1),"object"==typeof n&&(n=!1),!1!==t&&(t=parseInt(t,10)),!1!==e&&(e=parseInt(e,10)),!1!==s&&(s=parseInt(s,10)),!1!==a&&(a=parseInt(a,10)),!1!==i&&(i=parseInt(i,10)),!1!==n&&(n=n.toString());var c=o[t<12?"amNames":"pmNames"][0],d=t!==parseInt(this.hour,10)||e!==parseInt(this.minute,10)||s!==parseInt(this.second,10)||a!==parseInt(this.millisec,10)||i!==parseInt(this.microsec,10)||0<this.ampm.length&&t<12!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&n!==this.timezone.toString();if(d&&(!1!==t&&(this.hour=t),!1!==e&&(this.minute=e),!1!==s&&(this.second=s),!1!==a&&(this.millisec=a),!1!==i&&(this.microsec=i),!1!==n&&(this.timezone=n),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=c),this.formattedTime=$.datepicker.formatTime(o.timeFormat,this,o),this.$timeObj&&(r===o.timeFormat?this.$timeObj.val(this.formattedTime+l):this.$timeObj.val($.datepicker.formatTime(r,this,o)+l),this.$timeObj[0].setSelectionRange)){var u=this.$timeObj[0].selectionStart,p=this.$timeObj[0].selectionEnd;this.$timeObj[0].setSelectionRange(u,p)}this.timeDefined=!0,d&&this._updateDateTime()}},_onSelectHandler:function(){var t=this._defaults.onSelect||this.inst.settings.onSelect,e=this.$input?this.$input[0]:null;t&&e&&t.apply(e,[this.formattedDateTime,this])},_updateDateTime:function(t){var e=0<(t=this.inst||t).currentYear?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(t.selectedYear,t.selectedMonth,t.selectedDay),s=$.datepicker._daylightSavingAdjust(e),a=$.datepicker._get(t,"dateFormat"),i=$.datepicker._getFormatConfig(t),n=null!==s&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(a,null===s?new Date:s,i);var o=this.formattedDate;if(""===t.lastVal&&(t.currentYear=t.selectedYear,t.currentMonth=t.selectedMonth,t.currentDay=t.selectedDay),!0===this._defaults.timeOnly&&!1===this._defaults.timeOnlyShowDate?o=this.formattedTime:(!0!==this._defaults.timeOnly&&(this._defaults.alwaysSetTime||n)||!0===this._defaults.timeOnly&&!0===this._defaults.timeOnlyShowDate)&&(o+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=o,this._defaults.showTimepicker)if(this.$altInput&&!1===this._defaults.timeOnly&&!0===this._defaults.altFieldTimeOnly)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(o);var r="",l=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,c=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(r=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===s?new Date:s,i):this.formattedDate)&&(r+=l),null!==this._defaults.altTimeFormat?r+=$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+c:r+=this.formattedTime+c,this.$altInput.val(r)}else this.$input.val(o);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var t=$.datepicker._getInst(this.$input.get(0)),e=$.datepicker._get(t,"timepicker");if(e&&e._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(t){$.timepicker.log(t)}}},_controls:{slider:{create:function(s,t,a,e,i,n,o){var r=s._defaults.isRTL;return t.prop("slide",null).slider({orientation:"horizontal",value:r?-1*e:e,min:r?-1*n:i,max:r?-1*i:n,step:o,slide:function(t,e){s.control.value(s,$(this),a,r?-1*e.value:e.value),s._onTimeChange()},stop:function(t,e){s._onSelectHandler()}})},options:function(t,e,s,a,i){if(t._defaults.isRTL){if("string"==typeof a)return"min"===a||"max"===a?void 0!==i?e.slider(a,-1*i):Math.abs(e.slider(a)):e.slider(a);var n=a.min,o=a.max;return a.min=a.max=null,void 0!==n&&(a.max=-1*n),void 0!==o&&(a.min=-1*o),e.slider(a)}return"string"==typeof a&&void 0!==i?e.slider(a,i):e.slider(a)},value:function(t,e,s,a){return t._defaults.isRTL?void 0!==a?e.slider("value",-1*a):Math.abs(e.slider("value")):void 0!==a?e.slider("value",a):e.slider("value")}},select:{create:function(e,t,s,a,i,n,o){for(var r='<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="'+s+'" data-min="'+i+'" data-max="'+n+'" data-step="'+o+'">',l=e._defaults.pickerTimeFormat||e._defaults.timeFormat,c=i;c<=n;c+=o)r+='<option value="'+c+'"'+(c===a?" selected":"")+">",r+="hour"===s?$.datepicker.formatTime($.trim(l.replace(/[^ht ]/gi,"")),{hour:c},e._defaults):"millisec"===s||"microsec"===s||10<=c?c:"0"+c.toString(),r+="</option>";return r+="</select>",t.children("select").remove(),$(r).appendTo(t).change(function(t){e._onTimeChange(),e._onSelectHandler(),e._afterInject()}),t},options:function(t,e,s,a,i){var n={},o=e.children("select");if("string"==typeof a){if(void 0===i)return o.data(a);n[a]=i}else n=a;return t.control.create(t,e,o.data("unit"),o.val(),0<=n.min?n.min:o.data("min"),n.max||o.data("max"),n.step||o.data("step"))},value:function(t,e,s,a){var i=e.children("select");return void 0!==a?i.val(a):i.val()}}}}),$.fn.extend({timepicker:function(t){t=t||{};var e=Array.prototype.slice.call(arguments);return"object"==typeof t&&(e[0]=$.extend(t,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),e)})},datetimepicker:function(e){var s=arguments;return"string"==typeof(e=e||{})?"getDate"===e||"option"===e&&2===s.length&&"string"==typeof s[1]?$.fn.datepicker.apply($(this[0]),s):this.each(function(){var t=$(this);t.datepicker.apply(t,s)}):this.each(function(){var t=$(this);t.datepicker($.timepicker._newInst(t,e)._defaults)})}}),$.datepicker.parseDateTime=function(t,e,s,a,i){var n=parseDateTimeInternal(t,e,s,a,i);if(n.timeObj){var o=n.timeObj;n.date.setHours(o.hour,o.minute,o.second,o.millisec),n.date.setMicroseconds(o.microsec)}return n.date},$.datepicker.parseTime=function(t,e,s){function i(t,e,s){var a,i="^"+t.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){var e=t.length;switch(t.charAt(0).toLowerCase()){case"h":case"m":case"s":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"l":case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return function(t,e){var s=[];return t&&$.merge(s,t),e&&$.merge(s,e),"("+(s=$.map(s,function(t){return t.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")})).join("|")+")?"}(s.amNames,s.pmNames);default:return"("+t.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(t){return"\\"+t})+")?"}}).replace(/\s/g,"\\s?")+s.timeSuffix+"$",n=function(t){var e=t.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),s={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(e)for(var a=0;a<e.length;a++)-1===s[e[a].toString().charAt(0)]&&(s[e[a].toString().charAt(0)]=a+1);return s}(t),o="",r={hour:0,minute:0,second:0,millisec:0,microsec:0};return!!(a=e.match(new RegExp(i,"i")))&&(-1!==n.t&&(void 0===a[n.t]||0===a[n.t].length?(o="",r.ampm=""):(o=-1!==$.inArray(a[n.t].toUpperCase(),$.map(s.amNames,function(t,e){return t.toUpperCase()}))?"AM":"PM",r.ampm=s["AM"===o?"amNames":"pmNames"][0])),-1!==n.h&&("AM"===o&&"12"===a[n.h]?r.hour=0:"PM"===o&&"12"!==a[n.h]?r.hour=parseInt(a[n.h],10)+12:r.hour=Number(a[n.h])),-1!==n.m&&(r.minute=Number(a[n.m])),-1!==n.s&&(r.second=Number(a[n.s])),-1!==n.l&&(r.millisec=Number(a[n.l])),-1!==n.c&&(r.microsec=Number(a[n.c])),-1!==n.z&&void 0!==a[n.z]&&(r.timezone=$.timepicker.timezoneOffsetNumber(a[n.z])),r)}var a=extendRemove(extendRemove({},$.timepicker._defaults),s||{});t.replace(/\'.*?\'/g,"").indexOf("Z");return"function"==typeof a.parse?a.parse(t,e,a):"loose"===a.parse?function(e,s,a){try{var t=new Date("2012-01-01 "+s);if(isNaN(t.getTime())&&(t=new Date("2012-01-01T"+s),isNaN(t.getTime())&&(t=new Date("01/01/2012 "+s),isNaN(t.getTime()))))throw"Unable to parse time with native Date: "+s;return{hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisec:t.getMilliseconds(),microsec:t.getMicroseconds(),timezone:-1*t.getTimezoneOffset()}}catch(t){try{return i(e,s,a)}catch(t){$.timepicker.log("Unable to parse \ntimeString: "+s+"\ntimeFormat: "+e)}}return!1}(t,e,a):i(t,e,a)},$.datepicker.formatTime=function(t,e,s){s=s||{},s=$.extend({},$.timepicker._defaults,s),e=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},e);var a=t,i=s.amNames[0],n=parseInt(e.hour,10);return 11<n&&(i=s.pmNames[0]),a=a.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){switch(t){case"HH":return("0"+n).slice(-2);case"H":return n;case"hh":return("0"+convert24to12(n)).slice(-2);case"h":return convert24to12(n);case"mm":return("0"+e.minute).slice(-2);case"m":return e.minute;case"ss":return("0"+e.second).slice(-2);case"s":return e.second;case"l":return("00"+e.millisec).slice(-3);case"c":return("00"+e.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===e.timezone?s.timezone:e.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===e.timezone?s.timezone:e.timezone,!0);case"T":return i.charAt(0).toUpperCase();case"TT":return i.toUpperCase();case"t":return i.charAt(0).toLowerCase();case"tt":return i.toLowerCase();default:return t.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(t,e){var s,a=this._getInst($(t)[0]),i=this._get(a,"timepicker");i&&a.settings.showTimepicker?(i._limitMinMaxDateTime(a,!0),s=a.inline,a.inline=a.stay_open=!0,this._base_selectDate(t,e),a.inline=s,a.stay_open=!1,this._notifyChange(a),this._updateDatepicker(a)):this._base_selectDate(t,e)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(t){var e=t.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==t&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==e||"boolean"==typeof t.stay_open&&!1!==t.stay_open)){this._base_updateDatepicker(t);var s=this._get(t,"timepicker");s&&s._addTimePicker(t)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(t){var e=$.datepicker._getInst(t.target),s=$.datepicker._get(e,"timepicker");if(s&&$.datepicker._get(e,"constrainInput")){var a=s.support.ampm,i=null!==s._defaults.showTimezone?s._defaults.showTimezone:s.support.timezone,n=$.datepicker._possibleChars($.datepicker._get(e,"dateFormat")),o=s._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,a?"APM":"").replace(/Tt/g,a?"AaPpMm":"").replace(/tT/g,a?"AaPpMm":"").replace(/T/g,a?"AP":"").replace(/tt/g,a?"apm":"").replace(/t/g,a?"ap":"")+" "+s._defaults.separator+s._defaults.timeSuffix+(i?s._defaults.timezoneList.join(""):"")+s._defaults.amNames.join("")+s._defaults.pmNames.join("")+n,r=String.fromCharCode(void 0===t.charCode?t.keyCode:t.charCode);return t.ctrlKey||r<" "||!n||-1<o.indexOf(r)}return $.datepicker._base_doKeyPress(t)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(t){var e=this._get(t,"timepicker");if(e){var s=e._defaults.altField;if(s){e._defaults.altFormat||e._defaults.dateFormat;var a=this._getDate(t),i=$.datepicker._getFormatConfig(t),n="",o=e._defaults.altSeparator?e._defaults.altSeparator:e._defaults.separator,r=e._defaults.altTimeSuffix?e._defaults.altTimeSuffix:e._defaults.timeSuffix,l=null!==e._defaults.altTimeFormat?e._defaults.altTimeFormat:e._defaults.timeFormat;n+=$.datepicker.formatTime(l,e,e._defaults)+r,e._defaults.timeOnly||e._defaults.altFieldTimeOnly||null===a||(n=e._defaults.altFormat?$.datepicker.formatDate(e._defaults.altFormat,a,i)+o+n:e.formattedDate+o+n),$(s).val(t.input.val()?n:"")}}else $.datepicker._base_updateAlternate(t)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(t){var e=$.datepicker._getInst(t.target),s=$.datepicker._get(e,"timepicker");if(s&&s._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(t){$.timepicker.log(t)}return $.datepicker._base_doKeyUp(t)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(t){var e=this._getInst($(t)[0]);this._base_gotoToday(t);var s=this._get(e,"timepicker");if(s){var a=$.timepicker.timezoneOffsetNumber(s.timezone),i=new Date;i.setMinutes(i.getMinutes()+i.getTimezoneOffset()+parseInt(a,10)),this._setTime(e,i),this._setDate(e,i),s._onSelectHandler()}},$.datepicker._disableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var s=this._get(e,"timepicker");$(t).datepicker("getDate"),s&&(e.settings.showTimepicker=!1,s._defaults.showTimepicker=!1,s._updateDateTime(e))}},$.datepicker._enableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var s=this._get(e,"timepicker");$(t).datepicker("getDate"),s&&(e.settings.showTimepicker=!0,s._defaults.showTimepicker=!0,s._addTimePicker(e),s._updateDateTime(e))}},$.datepicker._setTime=function(t,e){var s=this._get(t,"timepicker");if(s){var a=s._defaults;s.hour=e?e.getHours():a.hour,s.minute=e?e.getMinutes():a.minute,s.second=e?e.getSeconds():a.second,s.millisec=e?e.getMilliseconds():a.millisec,s.microsec=e?e.getMicroseconds():a.microsec,s._limitMinMaxDateTime(t,!0),s._onTimeChange(),s._updateDateTime(t)}},$.datepicker._setTimeDatepicker=function(t,e,s){var a=this._getInst(t);if(a){var i,n=this._get(a,"timepicker");if(n)this._setDateFromField(a),e&&("string"==typeof e?(n._parseTime(e,s),(i=new Date).setHours(n.hour,n.minute,n.second,n.millisec),i.setMicroseconds(n.microsec)):(i=new Date(e.getTime())).setMicroseconds(e.getMicroseconds()),"Invalid Date"===i.toString()&&(i=void 0),this._setTime(a,i))}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(t,e){var s=this._getInst(t),a=e;if(s){"string"==typeof e&&((a=new Date(e)).getTime()||(this._base_setDateDatepicker.apply(this,arguments),a=$(t).datepicker("getDate")));var i,n=this._get(s,"timepicker");a instanceof Date?(i=new Date(a.getTime())).setMicroseconds(a.getMicroseconds()):i=a,n&&i&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=-1*i.getTimezoneOffset()),a=$.timepicker.timezoneAdjust(a,$.timepicker.timezoneOffsetString(-a.getTimezoneOffset()),n.timezone),i=$.timepicker.timezoneAdjust(i,$.timepicker.timezoneOffsetString(-i.getTimezoneOffset()),n.timezone)),this._updateDatepicker(s),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(t,i,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(t,e){var s=this._getInst(t);if(s){var a=this._get(s,"timepicker");if(a){void 0===s.lastVal&&this._setDateFromField(s,e);var i=this._getDate(s),n=null;return n=a.$altInput&&a._defaults.altFieldTimeOnly?a.$input.val()+" "+a.$altInput.val():"INPUT"!==a.$input.get(0).tagName&&a.$altInput?a.$altInput.val():a.$input.val(),i&&a._parseTime(n,!s.settings.timeOnly)&&(i.setHours(a.hour,a.minute,a.second,a.millisec),i.setMicroseconds(a.microsec),null!=a.timezone&&(a.support.timezone||null!==a._defaults.timezone||(a.timezone=-1*i.getTimezoneOffset()),i=$.timepicker.timezoneAdjust(i,a.timezone,$.timepicker.timezoneOffsetString(-i.getTimezoneOffset())))),i}return this._base_getDateDatepicker(t,e)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(e,s,a){var i;try{i=this._base_parseDate(e,s,a)}catch(t){if(!(0<=t.indexOf(":")))throw t;i=this._base_parseDate(e,s.substring(0,s.length-(t.length-t.indexOf(":")-2)),a),$.timepicker.log("Error parsing the date string: "+t+"\ndate string = "+s+"\ndate format = "+e)}return i},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(t,e,s,a){var i=this._get(t,"timepicker");return i?(i._updateDateTime(t),i.$input.val()):this._base_formatDate(t)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(t,e,s){var a,i=this._getInst(t);if(!i)return null;var n=this._get(i,"timepicker");if(n){var o,r,l,c,d=null,u=null,p=null,h=n._defaults.evnts,m={};if("string"==typeof e){if("minDate"===e||"minDateTime"===e)d=s;else if("maxDate"===e||"maxDateTime"===e)u=s;else if("onSelect"===e)p=s;else if(h.hasOwnProperty(e)){if(void 0===s)return h[e];m[e]=s,a={}}}else if("object"==typeof e)for(o in e.minDate?d=e.minDate:e.minDateTime?d=e.minDateTime:e.maxDate?u=e.maxDate:e.maxDateTime&&(u=e.maxDateTime),h)h.hasOwnProperty(o)&&e[o]&&(m[o]=e[o]);for(o in m)m.hasOwnProperty(o)&&(h[o]=m[o],delete(a=a||$.extend({},e))[o]);if(a&&isEmptyObject(a))return;if(d?(d=0===d?new Date:new Date(d),n._defaults.minDate=d,n._defaults.minDateTime=d):u?(u=0===u?new Date:new Date(u),n._defaults.maxDate=u,n._defaults.maxDateTime=u):p&&(n._defaults.onSelect=p),d||u)return l=(c=$(t)).datetimepicker("getDate"),r=this._base_optionDatepicker.call($.datepicker,t,a||e,s),c.datetimepicker("setDate",l),r}return void 0===s?this._base_optionDatepicker.call($.datepicker,t,e):this._base_optionDatepicker.call($.datepicker,t,a||e,s)};var isEmptyObject=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0},extendRemove=function(t,e){for(var s in $.extend(t,e),e)null!==e[s]&&void 0!==e[s]||(t[s]=e[s]);return t},detectSupport=function(t){function e(t,e){return-1!==t.indexOf(e)}var s=t.replace(/'.*?'/g,"").toLowerCase();return{hour:e(s,"h"),minute:e(s,"m"),second:e(s,"s"),millisec:e(s,"l"),microsec:e(s,"c"),timezone:e(s,"z"),ampm:e(s,"t")&&e(t,"h"),iso8601:e(t,"Z")}},convert24to12=function(t){return 0===(t%=12)&&(t=12),String(t)},computeEffectiveSetting=function(t,e){return t&&t[e]?t[e]:$.timepicker._defaults[e]},splitDateTime=function(t,e){var s=computeEffectiveSetting(e,"separator"),a=computeEffectiveSetting(e,"timeFormat").split(s).length,i=t.split(s),n=i.length;return 1<n?{dateString:i.splice(0,n-a).join(s),timeString:i.splice(0,a).join(s)}:{dateString:t,timeString:""}},parseDateTimeInternal=function(t,e,s,a,i){var n,o,r;if(o=splitDateTime(s,i),n=$.datepicker._base_parseDate(t,o.dateString,a),""===o.timeString)return{date:n};if(!(r=$.datepicker.parseTime(e,o.timeString,i)))throw"Wrong time format";return{date:n,timeObj:r}},selectLocalTimezone=function(t,e){if(t&&t.timezone_select){var s=e||new Date;t.timezone_select.val(-s.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(t,e){if(isNaN(t)||840<t||t<-720)return t;var s=t%60,a=(t-s)/60,i=e?":":"",n=(0<=t?"+":"-")+("0"+Math.abs(a)).slice(-2)+i+("0"+Math.abs(s)).slice(-2);return"+00:00"==n?"Z":n},$.timepicker.timezoneOffsetNumber=function(t){var e=t.toString().replace(":","");return"Z"===e.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(e)?("-"===e.substr(0,1)?-1:1)*(60*parseInt(e.substr(1,2),10)+parseInt(e.substr(3,2),10)):parseInt(t,10)},$.timepicker.timezoneAdjust=function(t,e,s){var a=$.timepicker.timezoneOffsetNumber(e),i=$.timepicker.timezoneOffsetNumber(s);return isNaN(i)||t.setMinutes(t.getMinutes()+-a- -i),t},$.timepicker.timeRange=function(t,e,s){return $.timepicker.handleRange("timepicker",t,e,s)},$.timepicker.datetimeRange=function(t,e,s){$.timepicker.handleRange("datetimepicker",t,e,s)},$.timepicker.dateRange=function(t,e,s){$.timepicker.handleRange("datepicker",t,e,s)},$.timepicker.handleRange=function(r,l,c,d){d=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},d);var t=!1;function s(t,e){var s=l[r]("getDate"),a=c[r]("getDate"),i=t[r]("getDate");if(null!==s){var n=new Date(s.getTime()),o=new Date(s.getTime());n.setMilliseconds(n.getMilliseconds()+d.minInterval),o.setMilliseconds(o.getMilliseconds()+d.maxInterval),0<d.minInterval&&a<n?c[r]("setDate",n):0<d.maxInterval&&o<a?c[r]("setDate",o):a<s&&e[r]("setDate",i)}}function e(t,e,s){if(t.val()){var a=t[r].call(t,"getDate");null!==a&&0<d.minInterval&&("minDate"===s&&a.setMilliseconds(a.getMilliseconds()+d.minInterval),"maxDate"===s&&a.setMilliseconds(a.getMilliseconds()-d.minInterval)),a.getTime&&e[r].call(e,"option",s,a)}}return"timepicker"===r&&(t=!0,r="datetimepicker"),$.fn[r].call(l,$.extend({timeOnly:t,onClose:function(t,e){s($(this),c)},onSelect:function(t){e($(this),c,"minDate")}},d,d.start)),$.fn[r].call(c,$.extend({timeOnly:t,onClose:function(t,e){s($(this),l)},onSelect:function(t){e($(this),l,"maxDate")}},d,d.end)),s(l,c),e(l,c,"minDate"),e(c,l,"maxDate"),$([l.get(0),c.get(0)])},$.timepicker.log=function(){window.console&&window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(t){return this.setMilliseconds(this.getMilliseconds()+Math.floor(t/1e3)),this.microseconds=t%1e3,this}),$.timepicker.version="1.6.3"}}),"undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");function date(t,e){function s(t,e){return n[t]?n[t]():e}function a(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}var i,n,o=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"],r=/\\?(.?)/gi;n={d:function(){return a(n.j(),2)},D:function(){return n.l().slice(0,3)},j:function(){return i.getDate()},l:function(){return o[n.w()]+"day"},N:function(){return n.w()||7},S:function(){var t=n.j(),e=t%10;return e<=3&&1===parseInt(t%100/10,10)&&(e=0),["st","nd","rd"][e-1]||"th"},w:function(){return i.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/864e5)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),e=new Date(t.getFullYear(),0,4);return a(1+Math.round((t-e)/864e5/7),2)},F:function(){return o[6+n.n()]},m:function(){return a(n.n(),2)},M:function(){return n.F().slice(0,3)},n:function(){return i.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4==0&t%100!=0|t%400==0},o:function(){var t=n.n(),e=n.W();return n.Y()+(12===t&&e<9?1:1===t&&9<e?-1:0)},Y:function(){return i.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return 11<i.getHours()?"pm":"am"},A:function(){return n.a().toUpperCase()},B:function(){var t=3600*i.getUTCHours(),e=60*i.getUTCMinutes(),s=i.getUTCSeconds();return a(Math.floor((t+e+s+3600)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return i.getHours()},h:function(){return a(n.g(),2)},H:function(){return a(n.G(),2)},i:function(){return a(i.getMinutes(),2)},s:function(){return a(i.getSeconds(),2)},u:function(){return a(1e3*i.getMilliseconds(),6)},e:function(){throw new Error("Not supported (see source code of date() for timezone on how to add support)")},I:function(){return new Date(n.Y(),0)-Date.UTC(n.Y(),0)!=new Date(n.Y(),6)-Date.UTC(n.Y(),6)?1:0},O:function(){var t=i.getTimezoneOffset(),e=Math.abs(t);return(0<t?"-":"+")+a(100*Math.floor(e/60)+e%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-i.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(r,s)},r:function(){return"D, d M Y H:i:s O".replace(r,s)},U:function(){return i/1e3|0}};var l,c;return l=t,i=void 0===(c=e)?new Date:c instanceof Date?new Date(c):new Date(1e3*c),l.replace(r,s)}function strtotime(t,e){var s,a,i,n,o,r,l,c,d,u;if(!t)return!1;t=t.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var p=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((a=t.match(p))&&a[2]===a[4])if(1901<a[1])switch(a[2]){case"-":return!(12<a[3]||31<a[5])&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case".":return!1;case"/":return!(12<a[3]||31<a[5])&&new Date(a[1],parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else if(1901<a[5])switch(a[2]){case"-":case".":return!(12<a[3]||31<a[1])&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3;case"/":return!(12<a[1]||31<a[3])&&new Date(a[5],parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3}else switch(a[2]){case"-":return!(12<a[3]||31<a[5]||a[1]<70&&38<a[1])&&(n=0<=a[1]&&a[1]<=38?+a[1]+2e3:a[1],new Date(n,parseInt(a[3],10)-1,a[5],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case".":return 70<=a[5]?!(12<a[3]||31<a[1])&&new Date(a[5],parseInt(a[3],10)-1,a[1],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3:a[5]<60&&!a[6]&&(!(23<a[1]||59<a[3])&&(i=new Date,new Date(i.getFullYear(),i.getMonth(),i.getDate(),a[1]||0,a[3]||0,a[5]||0,a[9]||0)/1e3));case"/":return!(12<a[1]||31<a[3]||a[5]<70&&38<a[5])&&(n=0<=a[5]&&a[5]<=38?+a[5]+2e3:a[5],new Date(n,parseInt(a[1],10)-1,a[3],a[6]||0,a[7]||0,a[8]||0,a[9]||0)/1e3);case":":return!(23<a[1]||59<a[3]||59<a[5])&&(i=new Date,new Date(i.getFullYear(),i.getMonth(),i.getDate(),a[1]||0,a[3]||0,a[5]||0)/1e3)}if("now"===t)return null===e||isNaN(e)?(new Date).getTime()/1e3|0:0|e;if(!isNaN(s=Date.parse(t)))return s/1e3|0;if(p=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(a=t.match(p))&&("z"===a[4]?a[4]="Z":a[4].match(/^([\+-][0-9]{2})$/)&&(a[4]=a[4]+":00"),!isNaN(s=Date.parse(a[1]+"T"+a[2]+a[4]))))return s/1e3|0;function h(t){var e=t.split(" "),s=e[0],a=e[1].substring(0,3),i=/\d+/.test(s),n=("last"===s?-1:1)*("ago"===e[2]?-1:1);if(i&&(n*=parseInt(s,10)),l.hasOwnProperty(a)&&!e[1].match(/^mon(day|\.)?$/i))return o["set"+l[a]](o["get"+l[a]]()+n);if("wee"===a)return o.setDate(o.getDate()+7*n);if("next"===s||"last"===s)!function(t,e,s){var a,i=r[e];void 0!==i&&(0===(a=i-o.getDay())?a=7*s:0<a&&"last"===t?a-=7:a<0&&"next"===t&&(a+=7),o.setDate(o.getDate()+a))}(s,a,n);else if(!i)return!1;return!0}if(o=e?new Date(1e3*e):new Date,r={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},l={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},"([+-]?\\d+\\s"+(d="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)")+"|(last|next)\\s"+d+")(\\sago)?",!(a=t.match(new RegExp("([+-]?\\d+\\s(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)|(last|next)\\s(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?))(\\sago)?","gi"))))return!1;for(u=0,c=a.length;u<c;u++)if(!h(a[u]))return!1;return o.getTime()/1e3}function fallbackMessage(t){var e="cut"===t?"X":"C";return/iPhone|iPad/i.test(navigator.userAgent)?objectL10n.yopPollParams.copyToClipboardError.noSupport:/Mac/i.test(navigator.userAgent)?objectL10n.yopPollParams.copyToClipboardError.press+" ⌘-"+e+objectL10n.yopPollParams.copyToClipboardError.copy:objectL10n.yopPollParams.copyToClipboardError.press+" Ctrl-"+e+objectL10n.yopPollParams.copyToClipboardError.copy}if(!function(a){"use strict";a.fn.emulateTransitionEnd=function(t){var e=!1,s=this;a(this).one(a.support.transition.end,function(){e=!0});return setTimeout(function(){e||a(s).trigger(a.support.transition.end)},t),this},a(function(){a.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var s in e)if(void 0!==t.style[s])return{end:e[s]}}()})}(jQuery),function(n){"use strict";function a(t){n(t).on("click",e,this.close)}var e='[data-dismiss="alert"]';a.prototype.close=function(t){var e=n(this),s=e.attr("data-target");s=s||(s=e.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,"");var a=n(s);function i(){a.trigger("closed.bs.alert").remove()}t&&t.preventDefault(),a.length||(a=e.hasClass("alert")?e:e.parent()),a.trigger(t=n.Event("close.bs.alert")),t.isDefaultPrevented()||(a.removeClass("in"),n.support.transition&&a.hasClass("fade")?a.one(n.support.transition.end,i).emulateTransitionEnd(150):i())};var t=n.fn.alert;n.fn.alert=function(s){return this.each(function(){var t=n(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof s&&e[s].call(t)})},n.fn.alert.Constructor=a,n.fn.alert.noConflict=function(){return n.fn.alert=t,this},n(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(i){"use strict";var n=function(t,e){this.$element=i(t),this.options=i.extend({},n.DEFAULTS,e)};n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",s=this.$element,a=s.is("input")?"val":"html",i=s.data();t+="Text",i.resetText||s.data("resetText",s[a]()),s[a](i[t]||this.options[t]),setTimeout(function(){"loadingText"==t?s.addClass(e).attr(e,e):s.removeClass(e).removeAttr(e)},0)},n.prototype.toggle=function(){var t=this.$element.closest('[data-toggle="buttons"]'),e=!0;if(t.length){var s=this.$element.find("input");"radio"===s.prop("type")&&(s.prop("checked")&&this.$element.hasClass("active")?e=!1:t.find(".active").removeClass("active")),e&&s.prop("checked",!this.$element.hasClass("active")).trigger("change")}e&&this.$element.toggleClass("active")};var t=i.fn.button;i.fn.button=function(a){return this.each(function(){var t=i(this),e=t.data("bs.button"),s="object"==typeof a&&a;e||t.data("bs.button",e=new n(this,s)),"toggle"==a?e.toggle():a&&e.setState(a)})},i.fn.button.Constructor=n,i.fn.button.noConflict=function(){return i.fn.button=t,this},i(document).on("click.bs.button.data-api","[data-toggle^=button]",function(t){var e=i(t.target);e.hasClass("btn")||(e=e.closest(".btn")),e.button("toggle"),t.preventDefault()})}(jQuery),function(c){"use strict";function n(t,e){this.$element=c(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",c.proxy(this.pause,this)).on("mouseleave",c.proxy(this.cycle,this))}n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},n.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(c.proxy(this.next,this),this.options.interval)),this},n.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},n.prototype.to=function(t){var e=this,s=this.getActiveIndex();if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):s==t?this.pause().cycle():this.slide(s<t?"next":"prev",c(this.$items[t]))},n.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&c.support.transition.end&&(this.$element.trigger(c.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){if(!this.sliding)return this.slide("next")},n.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},n.prototype.slide=function(t,e){var s=this.$element.find(".item.active"),a=e||s[t](),i=this.interval,n="next"==t?"left":"right",o="next"==t?"first":"last",r=this;if(!a.length){if(!this.options.wrap)return;a=this.$element.find(".item")[o]()}this.sliding=!0,i&&this.pause();var l=c.Event("slide.bs.carousel",{relatedTarget:a[0],direction:n});if(!a.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var t=c(r.$indicators.children()[r.getActiveIndex()]);t&&t.addClass("active")})),c.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(l),l.isDefaultPrevented())return;a.addClass(t),a[0].offsetWidth,s.addClass(n),a.addClass(n),s.one(c.support.transition.end,function(){a.removeClass([t,n].join(" ")).addClass("active"),s.removeClass(["active",n].join(" ")),r.sliding=!1,setTimeout(function(){r.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(l),l.isDefaultPrevented())return;s.removeClass("active"),a.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return i&&this.cycle(),this}};var t=c.fn.carousel;c.fn.carousel=function(i){return this.each(function(){var t=c(this),e=t.data("bs.carousel"),s=c.extend({},n.DEFAULTS,t.data(),"object"==typeof i&&i),a="string"==typeof i?i:s.slide;e||t.data("bs.carousel",e=new n(this,s)),"number"==typeof i?e.to(i):a?e[a]():s.interval&&e.pause().cycle()})},c.fn.carousel.Constructor=n,c.fn.carousel.noConflict=function(){return c.fn.carousel=t,this},c(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var e,s=c(this),a=c(s.attr("data-target")||(e=s.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")),i=c.extend({},a.data(),s.data()),n=s.attr("data-slide-to");n&&(i.interval=!1),a.carousel(i),(n=s.attr("data-slide-to"))&&a.data("bs.carousel").to(n),t.preventDefault()}),c(window).on("load",function(){c('[data-ride="carousel"]').each(function(){var t=c(this);t.carousel(t.data())})})}(jQuery),function(c){"use strict";var i=function(t,e){this.$element=c(t),this.options=c.extend({},i.DEFAULTS,e),this.transitioning=null,this.options.parent&&(this.$parent=c(this.options.parent)),this.options.toggle&&this.toggle()};i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t=c.Event("show.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.$parent&&this.$parent.find("> .panel > .in");if(e&&e.length){var s=e.data("bs.collapse");if(s&&s.transitioning)return;e.collapse("hide"),s||e.data("bs.collapse",null)}var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0),this.transitioning=1;var i=function(){this.$element.removeClass("collapsing").addClass("in")[a]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!c.support.transition)return i.call(this);var n=c.camelCase(["scroll",a].join("-"));this.$element.one(c.support.transition.end,c.proxy(i,this)).emulateTransitionEnd(350)[a](this.$element[0][n])}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=c.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var s=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!c.support.transition)return s.call(this);this.$element[e](0).one(c.support.transition.end,c.proxy(s,this)).emulateTransitionEnd(350)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var t=c.fn.collapse;c.fn.collapse=function(a){return this.each(function(){var t=c(this),e=t.data("bs.collapse"),s=c.extend({},i.DEFAULTS,t.data(),"object"==typeof a&&a);e||t.data("bs.collapse",e=new i(this,s)),"string"==typeof a&&e[a]()})},c.fn.collapse.Constructor=i,c.fn.collapse.noConflict=function(){return c.fn.collapse=t,this},c(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(t){var e,s=c(this),a=s.attr("data-target")||t.preventDefault()||(e=s.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,""),i=c(a),n=i.data("bs.collapse"),o=n?"toggle":s.data(),r=s.attr("data-parent"),l=r&&c(r);n&&n.transitioning||(l&&l.find('[data-toggle=collapse][data-parent="'+r+'"]').not(s).addClass("collapsed"),s[i.hasClass("in")?"addClass":"removeClass"]("collapsed")),i.collapse(o)})}(jQuery),function(o){"use strict";function a(t){o(t).on("click.bs.dropdown",this.toggle)}var r="[data-toggle=dropdown]";function i(){o(".dropdown-backdrop").remove(),o(r).each(function(t){var e=l(o(this));e.hasClass("open")&&(e.trigger(t=o.Event("hide.bs.dropdown")),t.isDefaultPrevented()||e.removeClass("open").trigger("hidden.bs.dropdown"))})}function l(t){var e=t.attr("data-target"),s=(e=e||(e=t.attr("href"))&&/#/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""))&&o(e);return s&&s.length?s:t.parent()}a.prototype.toggle=function(t){var e=o(this);if(!e.is(".disabled, :disabled")){var s=l(e),a=s.hasClass("open");if(i(),!a){if("ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&o('<div class="dropdown-backdrop"/>').insertAfter(o(this)).on("click",i),s.trigger(t=o.Event("show.bs.dropdown")),t.isDefaultPrevented())return;s.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},a.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var e=o(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var s=l(e),a=s.hasClass("open");if(!a||a&&27==t.keyCode)return 27==t.which&&s.find(r).focus(),e.click();var i=o("[role=menu] li:not(.divider):visible a",s);if(i.length){var n=i.index(i.filter(":focus"));38==t.keyCode&&0<n&&n--,40==t.keyCode&&n<i.length-1&&n++,~n||(n=0),i.eq(n).focus()}}}};var t=o.fn.dropdown;o.fn.dropdown=function(s){return this.each(function(){var t=o(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new a(this)),"string"==typeof s&&e[s].call(t)})},o.fn.dropdown.Constructor=a,o.fn.dropdown.noConflict=function(){return o.fn.dropdown=t,this},o(document).on("click.bs.dropdown.data-api",i).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,a.prototype.toggle).on("keydown.bs.dropdown.data-api",r+", [role=menu]",a.prototype.keydown)}(jQuery),function(n){"use strict";function o(t,e){this.options=e,this.$element=n(t),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)}o.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},o.prototype.toggle=function(t){return this[this.isShown?"hide":"show"](t)},o.prototype.show=function(s){var a=this,t=n.Event("show.bs.modal",{relatedTarget:s});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.backdrop(function(){var t=n.support.transition&&a.$element.hasClass("fade");a.$element.parent().length||a.$element.appendTo("#yop-main-area"),a.$element.show(),t&&a.$element[0].offsetWidth,a.$element.addClass("in").attr("aria-hidden",!1),a.enforceFocus();var e=n.Event("shown.bs.modal",{relatedTarget:s});t?a.$element.find(".modal-dialog").one(n.support.transition.end,function(){a.$element.focus().trigger(e)}).emulateTransitionEnd(300):a.$element.focus().trigger(e)}))},o.prototype.hide=function(t){t&&t.preventDefault(),t=n.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one(n.support.transition.end,n.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},o.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.focus()},this))},o.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",n.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},o.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden.bs.modal")})},o.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},o.prototype.backdrop=function(t){var e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=n.support.transition&&e;if(this.$backdrop=n('<div class="modal-backdrop '+e+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",n.proxy(function(t){t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one(n.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(n.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var t=n.fn.modal;n.fn.modal=function(a,i){return this.each(function(){var t=n(this),e=t.data("bs.modal"),s=n.extend({},o.DEFAULTS,t.data(),"object"==typeof a&&a);e||t.data("bs.modal",e=new o(this,s)),"string"==typeof a?e[a](i):s.show&&e.show(i)})},n.fn.modal.Constructor=o,n.fn.modal.noConflict=function(){return n.fn.modal=t,this},n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=n(this),s=e.attr("href"),a=n(e.attr("data-target")||s&&s.replace(/.*(?=#[^\s]+$)/,"")),i=a.data("modal")?"toggle":n.extend({remote:!/#/.test(s)&&s},a.data(),e.data());t.preventDefault(),a.modal(i,this).one("hide",function(){e.is(":visible")&&e.focus()})}),n(document).on("show.bs.modal",".modal",function(){n(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){n(document.body).removeClass("modal-open")})}(jQuery),function(f){"use strict";function i(t,e){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",t,e)}i.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},i.prototype.init=function(t,e,s){this.enabled=!0,this.type=t,this.$element=f(e),this.options=this.getOptions(s);for(var a=this.options.trigger.split(" "),i=a.length;i--;){var n=a[i];if("click"==n)this.$element.on("click."+this.type,this.options.selector,f.proxy(this.toggle,this));else if("manual"!=n){var o="hover"==n?"mouseenter":"focus",r="hover"==n?"mouseleave":"blur";this.$element.on(o+"."+this.type,this.options.selector,f.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,f.proxy(this.leave,this))}}this.options.selector?this._options=f.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(t){return(t=f.extend({},this.getDefaults(),this.$element.data(),t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},i.prototype.getDelegateOptions=function(){var s={},a=this.getDefaults();return this._options&&f.each(this._options,function(t,e){a[t]!=e&&(s[t]=e)}),s},i.prototype.enter=function(t){var e=t instanceof this.constructor?t:f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)},i.prototype.leave=function(t){var e=t instanceof this.constructor?t:f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)},i.prototype.show=function(){var t=f.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(t),t.isDefaultPrevented())return;var e=this.tip();this.setContent(),this.options.animation&&e.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,i=a.test(s);i&&(s=s.replace(a,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(s),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var n=this.getPosition(),o=e[0].offsetWidth,r=e[0].offsetHeight;if(i){var l=this.$element.parent(),c=s,d=document.documentElement.scrollTop||document.body.scrollTop,u="body"==this.options.container?window.innerWidth:l.outerWidth(),p="body"==this.options.container?window.innerHeight:l.outerHeight(),h="body"==this.options.container?0:l.offset().left;s="bottom"==s&&n.top+n.height+r-d>p?"top":"top"==s&&n.top-d-r<0?"bottom":"right"==s&&n.right+o>u?"left":"left"==s&&n.left-o<h?"right":s,e.removeClass(c).addClass(s)}var m=this.getCalculatedOffset(s,n,o,r);this.applyPlacement(m,s),this.$element.trigger("shown.bs."+this.type)}},i.prototype.applyPlacement=function(t,e){var s,a=this.tip(),i=a[0].offsetWidth,n=a[0].offsetHeight,o=parseInt(a.css("margin-top"),10),r=parseInt(a.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(r)&&(r=0),t.top=t.top+o,t.left=t.left+r,a.offset(t).addClass("in");var l=a[0].offsetWidth,c=a[0].offsetHeight;if("top"==e&&c!=n&&(s=!0,t.top=t.top+n-c),/bottom|top/.test(e)){var d=0;t.left<0&&(d=-2*t.left,t.left=0,a.offset(t),l=a[0].offsetWidth,c=a[0].offsetHeight),this.replaceArrow(d-i+l,l,"left")}else this.replaceArrow(c-n,c,"top");s&&a.offset(t)},i.prototype.replaceArrow=function(t,e,s){this.arrow().css(s,t?50*(1-t/e)+"%":"")},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},i.prototype.hide=function(){var t=this,e=this.tip(),s=f.Event("hide.bs."+this.type);function a(){"in"!=t.hoverState&&e.detach()}if(this.$element.trigger(s),!s.isDefaultPrevented())return e.removeClass("in"),f.support.transition&&this.$tip.hasClass("fade")?e.one(f.support.transition.end,a).emulateTransitionEnd(150):a(),this.$element.trigger("hidden.bs."+this.type),this},i.prototype.fixTitle=function(){var t=this.$element;!t.attr("title")&&"string"==typeof t.attr("data-original-title")||t.attr("data-original-title",t.attr("title")||"").attr("title","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(){var t=this.$element[0];return f.extend({},"function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},i.prototype.getCalculatedOffset=function(t,e,s,a){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-s/2}:"top"==t?{top:e.top-a,left:e.left+e.width/2-s/2}:"left"==t?{top:e.top+e.height/2-a/2,left:e.left-s}:{top:e.top+e.height/2-a/2,left:e.left+e.width}},i.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},i.prototype.tip=function(){return this.$tip=this.$tip||f(this.options.template)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(t){var e=t?f(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;e.tip().hasClass("in")?e.leave(e):e.enter(e)},i.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var t=f.fn.tooltip;f.fn.tooltip=function(a){return this.each(function(){var t=f(this),e=t.data("bs.tooltip"),s="object"==typeof a&&a;e||t.data("bs.tooltip",e=new i(this,s)),"string"==typeof a&&e[a]()})},f.fn.tooltip.Constructor=i,f.fn.tooltip.noConflict=function(){return f.fn.tooltip=t,this}}(jQuery),function(i){"use strict";function n(t,e){this.init("popover",t,e)}if(!i.fn.tooltip)throw new Error("Popover requires tooltip.js");n.DEFAULTS=i.extend({},i.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((n.prototype=i.extend({},i.fn.tooltip.Constructor.prototype)).constructor=n).prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),s=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content")[this.options.html?"html":"text"](s),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},n.prototype.tip=function(){return this.$tip||(this.$tip=i(this.options.template)),this.$tip};var t=i.fn.popover;i.fn.popover=function(a){return this.each(function(){var t=i(this),e=t.data("bs.popover"),s="object"==typeof a&&a;e||t.data("bs.popover",e=new n(this,s)),"string"==typeof a&&e[a]()})},i.fn.popover.Constructor=n,i.fn.popover.noConflict=function(){return i.fn.popover=t,this}}(jQuery),function(n){"use strict";function i(t,e){var s,a=n.proxy(this.process,this);this.$element=n(t).is("body")?n(window):n(t),this.$body=n("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",a),this.options=n.extend({},i.DEFAULTS,e),this.selector=(this.options.target||(s=n(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=n([]),this.targets=n([]),this.activeTarget=null,this.refresh(),this.process()}i.DEFAULTS={offset:10},i.prototype.refresh=function(){var a=this.$element[0]==window?"offset":"position";this.offsets=n([]),this.targets=n([]);var i=this;this.$body.find(this.selector).map(function(){var t=n(this),e=t.data("target")||t.attr("href"),s=/^#\w/.test(e)&&n(e);return s&&s.length&&[[s[a]().top+(!n.isWindow(i.$scrollElement.get(0))&&i.$scrollElement.scrollTop()),e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){i.offsets.push(this[0]),i.targets.push(this[1])})},i.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,s=(this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight)-this.$scrollElement.height(),a=this.offsets,i=this.targets,n=this.activeTarget;if(s<=e)return n!=(t=i.last()[0])&&this.activate(t);for(t=a.length;t--;)n!=i[t]&&e>=a[t]&&(!a[t+1]||e<=a[t+1])&&this.activate(i[t])},i.prototype.activate=function(t){this.activeTarget=t,n(this.selector).parents(".active").removeClass("active");var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',s=n(e).parents("li").addClass("active");s.parent(".dropdown-menu").length&&(s=s.closest("li.dropdown").addClass("active")),s.trigger("activate.bs.scrollspy")};var t=n.fn.scrollspy;n.fn.scrollspy=function(a){return this.each(function(){var t=n(this),e=t.data("bs.scrollspy"),s="object"==typeof a&&a;e||t.data("bs.scrollspy",e=new i(this,s)),"string"==typeof a&&e[a]()})},n.fn.scrollspy.Constructor=i,n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=t,this},n(window).on("load",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);t.scrollspy(t.data())})})}(jQuery),function(o){"use strict";function a(t){this.element=o(t)}a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),s=t.data("target");if(s=s||(s=t.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,""),!t.parent("li").hasClass("active")){var a=e.find(".active:last a")[0],i=o.Event("show.bs.tab",{relatedTarget:a});if(t.trigger(i),!i.isDefaultPrevented()){var n=o(s);this.activate(t.parent("li"),e),this.activate(n,n.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:a})})}}},a.prototype.activate=function(t,e,s){var a=e.find("> .active"),i=s&&o.support.transition&&a.hasClass("fade");function n(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),i?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),s&&s()}i?a.one(o.support.transition.end,n).emulateTransitionEnd(150):n(),a.removeClass("in")};var t=o.fn.tab;o.fn.tab=function(s){return this.each(function(){var t=o(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof s&&e[s]()})},o.fn.tab.Constructor=a,o.fn.tab.noConflict=function(){return o.fn.tab=t,this},o(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),o(this).tab("show")})}(jQuery),function(r){"use strict";var l=function(t,e){this.options=r.extend({},l.DEFAULTS,e),this.$window=r(window).on("scroll.bs.affix.data-api",r.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",r.proxy(this.checkPositionWithEventLoop,this)),this.$element=r(t),this.affixed=this.unpin=null,this.checkPosition()};l.RESET="affix affix-top affix-bottom",l.DEFAULTS={offset:0},l.prototype.checkPositionWithEventLoop=function(){setTimeout(r.proxy(this.checkPosition,this),1)},l.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=r(document).height(),e=this.$window.scrollTop(),s=this.$element.offset(),a=this.options.offset,i=a.top,n=a.bottom;"object"!=typeof a&&(n=i=a),"function"==typeof i&&(i=a.top()),"function"==typeof n&&(n=a.bottom());var o=!(null!=this.unpin&&e+this.unpin<=s.top)&&(null!=n&&s.top+this.$element.height()>=t-n?"bottom":null!=i&&e<=i&&"top");this.affixed!==o&&(this.unpin&&this.$element.css("top",""),this.affixed=o,this.unpin="bottom"==o?s.top-e:null,this.$element.removeClass(l.RESET).addClass("affix"+(o?"-"+o:"")),"bottom"==o&&this.$element.offset({top:document.body.offsetHeight-n-this.$element.height()}))}};var t=r.fn.affix;r.fn.affix=function(a){return this.each(function(){var t=r(this),e=t.data("bs.affix"),s="object"==typeof a&&a;e||t.data("bs.affix",e=new l(this,s)),"string"==typeof a&&e[a]()})},r.fn.affix.Constructor=l,r.fn.affix.noConflict=function(){return r.fn.affix=t,this},r(window).on("load",function(){r('[data-spy="affix"]').each(function(){var t=r(this),e=t.data();e.offset=e.offset||{},e.offsetBottom&&(e.offset.bottom=e.offsetBottom),e.offsetTop&&(e.offset.top=e.offsetTop),t.affix(e)})})}(jQuery),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(k){"use strict";function s(t){var e=t.parent();t.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),e.before(t).remove()}function a(t){var e=t.parent(),s=e.find(".minicolors-panel"),a=t.data("minicolors-settings");!t.data("minicolors-initialized")||t.prop("disabled")||e.hasClass("minicolors-inline")||e.hasClass("minicolors-focus")||(i(),e.addClass("minicolors-focus"),s.stop(!0,!0).fadeIn(a.showSpeed,function(){a.show&&a.show.call(t.get(0))}))}function i(){k(".minicolors-focus").each(function(){var t=k(this),e=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=e.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(e.get(0)),t.removeClass("minicolors-focus")})})}function n(t,e,s){var a,i,n,o,r=t.parents(".minicolors").find(".minicolors-input"),l=r.data("minicolors-settings"),c=t.find("[class$=-picker]"),d=t.offset().left,u=t.offset().top,p=Math.round(e.pageX-d),h=Math.round(e.pageY-u),m=s?l.animationSpeed:0;e.originalEvent.changedTouches&&(p=e.originalEvent.changedTouches[0].pageX-d,h=e.originalEvent.changedTouches[0].pageY-u),p<0&&(p=0),h<0&&(h=0),p>t.width()&&(p=t.width()),h>t.height()&&(h=t.height()),t.parent().is(".minicolors-slider-wheel")&&c.parent().is(".minicolors-grid")&&(a=75-p,i=75-h,n=Math.sqrt(a*a+i*i),(o=Math.atan2(i,a))<0&&(o+=2*Math.PI),75<n&&(p=(n=75)-75*Math.cos(o),h=75-75*Math.sin(o)),p=Math.round(p),h=Math.round(h)),t.is(".minicolors-grid")?c.stop(!0).animate({top:h+"px",left:p+"px"},m,l.animationEasing,function(){f(r,t)}):c.stop(!0).animate({top:h+"px"},m,l.animationEasing,function(){f(r,t)})}function f(t,e){function s(t,e){var s,a;return t.length&&e?(s=t.offset().left,a=t.offset().top,{x:s-e.offset().left+t.outerWidth()/2,y:a-e.offset().top+t.outerHeight()/2}):null}var a,i,n,o,r,l,c,d=t.val(),u=t.attr("data-opacity"),p=t.parent(),h=t.data("minicolors-settings"),m=p.find(".minicolors-input-swatch"),f=p.find(".minicolors-grid"),g=p.find(".minicolors-slider"),v=p.find(".minicolors-opacity-slider"),b=f.find("[class$=-picker]"),y=g.find("[class$=-picker]"),w=v.find("[class$=-picker]"),k=s(b,f),x=s(y,g),C=s(w,v);if(e.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(h.control){case"wheel":o=f.width()/2-k.x,r=f.height()/2-k.y,l=Math.sqrt(o*o+r*r),(c=Math.atan2(r,o))<0&&(c+=2*Math.PI),75<l&&(l=75,k.x=69-75*Math.cos(c),k.y=69-75*Math.sin(c)),i=D(l/.75,0,100),d=O({h:a=D(180*c/Math.PI,0,360),s:i,b:n=D(100-Math.floor(x.y*(100/g.height())),0,100)}),g.css("backgroundColor",O({h:a,s:i,b:100}));break;case"saturation":d=O({h:a=D(parseInt(k.x*(360/f.width()),10),0,360),s:i=D(100-Math.floor(x.y*(100/g.height())),0,100),b:n=D(100-Math.floor(k.y*(100/f.height())),0,100)}),g.css("backgroundColor",O({h:a,s:100,b:n})),p.find(".minicolors-grid-inner").css("opacity",i/100);break;case"brightness":d=O({h:a=D(parseInt(k.x*(360/f.width()),10),0,360),s:i=D(100-Math.floor(k.y*(100/f.height())),0,100),b:n=D(100-Math.floor(x.y*(100/g.height())),0,100)}),g.css("backgroundColor",O({h:a,s:i,b:100})),p.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:d=O({h:a=D(360-parseInt(x.y*(360/g.height()),10),0,360),s:i=D(Math.floor(k.x*(100/f.width())),0,100),b:n=D(100-Math.floor(k.y*(100/f.height())),0,100)}),f.css("backgroundColor",O({h:a,s:100,b:100}))}_(t,d,u=h.opacity?parseFloat(1-C.y/v.height()).toFixed(2):1)}else m.find("span").css({backgroundColor:d,opacity:u}),P(t,d,u)}function _(t,e,s){var a,i=t.parent(),n=t.data("minicolors-settings"),o=i.find(".minicolors-input-swatch");n.opacity&&t.attr("data-opacity",s),e="rgb"===n.format?(a=T(e)?A(e,!0):L(C(e,!0)),s=""===t.attr("data-opacity")?1:D(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),!isNaN(s)&&n.opacity||(s=1),t.minicolors("rgbObject").a<=1&&a&&n.opacity?"rgba("+a.r+", "+a.g+", "+a.b+", "+parseFloat(s)+")":"rgb("+a.r+", "+a.g+", "+a.b+")"):(T(e)&&(e=E(e)),x(e,n.letterCase)),t.val(e),o.find("span").css({backgroundColor:e,opacity:s}),P(t,e,s)}function c(t,e){var s,a,i,n,o,r,l,c,d,u,p=t.parent(),h=t.data("minicolors-settings"),m=p.find(".minicolors-input-swatch"),f=p.find(".minicolors-grid"),g=p.find(".minicolors-slider"),v=p.find(".minicolors-opacity-slider"),b=f.find("[class$=-picker]"),y=g.find("[class$=-picker]"),w=v.find("[class$=-picker]");switch(T(t.val())?(s=E(t.val()),(o=D(parseFloat(S(t.val())).toFixed(2),0,1))&&t.attr("data-opacity",o)):s=x(C(t.val(),!0),h.letterCase),a=function(t){var e=function(t){var e={h:0,s:0,b:0},s=Math.min(t.r,t.g,t.b),a=Math.max(t.r,t.g,t.b),i=a-s;e.b=a,e.s=0!==a?255*i/a:0,0!==e.s?t.r===a?e.h=(t.g-t.b)/i:t.g===a?e.h=2+(t.b-t.r)/i:e.h=4+(t.r-t.g)/i:e.h=-1;e.h*=60,e.h<0&&(e.h+=360);return e.s*=100/255,e.b*=100/255,e}(L(t));0===e.s&&(e.h=360);return e}(s=s||x(M(h.defaultValue,!0),h.letterCase)),n=h.keywords?k.map(h.keywords.split(","),function(t){return k.trim(t.toLowerCase())}):[],r=""!==t.val()&&-1<k.inArray(t.val().toLowerCase(),n)?x(t.val()):T(t.val())?A(t.val()):s,e||t.val(r),h.opacity&&(i=""===t.attr("data-opacity")?1:D(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(i)&&(i=1),t.attr("data-opacity",i),m.find("span").css("opacity",i),c=D(v.height()-v.height()*i,0,v.height()),w.css("top",c+"px")),"transparent"===t.val().toLowerCase()&&m.find("span").css("opacity",0),m.find("span").css("backgroundColor",s),h.control){case"wheel":d=D(Math.ceil(.75*a.s),0,f.height()/2),u=a.h*Math.PI/180,l=D(75-Math.cos(u)*d,0,f.width()),c=D(75-Math.sin(u)*d,0,f.height()),b.css({top:c+"px",left:l+"px"}),c=150-a.b/(100/f.height()),""===s&&(c=0),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:a.s,b:100}));break;case"saturation":l=D(5*a.h/12,0,150),c=D(f.height()-Math.ceil(a.b/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.s*(g.height()/100),0,g.height()),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:100,b:a.b})),p.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":l=D(5*a.h/12,0,150),c=D(f.height()-Math.ceil(a.s/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.b*(g.height()/100),0,g.height()),y.css("top",c+"px"),g.css("backgroundColor",O({h:a.h,s:a.s,b:100})),p.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:l=D(Math.ceil(a.s/(100/f.width())),0,f.width()),c=D(f.height()-Math.ceil(a.b/(100/f.height())),0,f.height()),b.css({top:c+"px",left:l+"px"}),c=D(g.height()-a.h/(360/g.height()),0,g.height()),y.css("top",c+"px"),f.css("backgroundColor",O({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&P(t,r,i)}function P(t,e,s){var a,i,n=t.data("minicolors-settings"),o=t.data("minicolors-lastChange");if(!o||o.value!==e||o.opacity!==s){if(t.data("minicolors-lastChange",{value:e,opacity:s}),n.swatches&&0!==n.swatches.length){for(a=T(e)?A(e,!0):L(e),-1,i=0;i<n.swatches.length;++i)if(a.r===n.swatches[i].r&&a.g===n.swatches[i].g&&a.b===n.swatches[i].b&&a.a===n.swatches[i].a){i;break}t.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),-1!==i&&t.parent().find(".minicolors-swatches .minicolors-swatch").eq(i).addClass("selected")}n.change&&(n.changeDelay?(clearTimeout(t.data("minicolors-changeTimeout")),t.data("minicolors-changeTimeout",setTimeout(function(){n.change.call(t.get(0),e,s)},n.changeDelay))):n.change.call(t.get(0),e,s)),t.trigger("change").trigger("input")}}function x(t,e){return"uppercase"===e?t.toUpperCase():t.toLowerCase()}function C(t,e){return(t=t.replace(/^#/g,"")).match(/^[A-F0-9]{3,6}/gi)?3!==t.length&&6!==t.length?"":(3===t.length&&e&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),"#"+t):""}function A(t,e){var s=t.replace(/[^\d,.]/g,"").split(",");return s[0]=D(parseInt(s[0],10),0,255),s[1]=D(parseInt(s[1],10),0,255),s[2]=D(parseInt(s[2],10),0,255),s[3]&&(s[3]=D(parseFloat(s[3],10),0,1)),e?{r:s[0],g:s[1],b:s[2],a:s[3]?s[3]:null}:void 0!==s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function M(t,e){return T(t)?A(t):C(t,e)}function D(t,e,s){return t<e&&(t=e),s<t&&(t=s),t}function T(t){var e=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!e||4!==e.length)}function S(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i))&&6===t.length?t[4]:"1"}function E(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""}function d(t){var s=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return k.each(s,function(t,e){1===e.length&&(s[t]="0"+e)}),"#"+s.join("")}function O(t){return d(function(t){var e={},s=Math.round(t.h),a=Math.round(255*t.s/100),i=Math.round(255*t.b/100);if(0===a)e.r=e.g=e.b=i;else{var n=i,o=(255-a)*i/255,r=s%60*(n-o)/60;360===s&&(s=0),s<60?(e.r=n,e.b=o,e.g=o+r):s<120?(e.g=n,e.b=o,e.r=n-r):s<180?(e.g=n,e.r=o,e.b=o+r):s<240?(e.b=n,e.r=o,e.g=n-r):s<300?(e.b=n,e.g=o,e.r=o+r):s<360?(e.r=n,e.g=o,e.b=n-r):(e.r=0,e.g=0,e.b=0)}return{r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)}}(t))}function L(t){return{r:(t=parseInt(-1<t.indexOf("#")?t.substring(1):t,16))>>16,g:(65280&t)>>8,b:255&t}}k.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",dataUris:!0,defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},k.extend(k.fn,{minicolors:function(t,e){switch(t){case"destroy":return k(this).each(function(){s(k(this))}),k(this);case"hide":return i(),k(this);case"opacity":return void 0===e?k(this).attr("data-opacity"):(k(this).each(function(){c(k(this).attr("data-opacity",e))}),k(this));case"rgbObject":return function(t){var e=L(C(k(t).val(),!0)),s=k(t).attr("data-opacity");if(!e)return null;void 0!==s&&k.extend(e,{a:parseFloat(s)});return e}(k(this));case"rgbString":case"rgbaString":return function(t,e){var s=L(C(k(t).val(),!0)),a=k(t).attr("data-opacity");if(!s)return null;void 0===a&&(a=1);return e?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"}(k(this),"rgbaString"===t);case"settings":return void 0===e?k(this).data("minicolors-settings"):(k(this).each(function(){var t=k(this).data("minicolors-settings")||{};s(k(this)),k(this).minicolors(k.extend(!0,t,e))}),k(this));case"show":return a(k(this).eq(0)),k(this);case"value":return void 0===e?k(this).val():(k(this).each(function(){"object"==typeof e&&null!==typeof e?(e.opacity&&k(this).attr("data-opacity",D(e.opacity,0,1)),e.color&&k(this).val(e.color)):k(this).val(e),c(k(this))}),k(this));default:return"create"!==t&&(e=t),k(this).each(function(){!function(e,t){var s,a,i,n,o,r=k('<div class="minicolors" />'),l=k.minicolors.defaults;if(e.data("minicolors-initialized"))return;t=k.extend(!0,{},l,t),r.addClass("minicolors-theme-"+t.theme).toggleClass("minicolors-with-opacity",t.opacity).toggleClass("minicolors-no-data-uris",!0!==t.dataUris),void 0!==t.position&&k.each(t.position.split(" "),function(){r.addClass("minicolors-position-"+this)});s="rgb"===t.format?t.opacity?"25":"20":t.keywords?"11":"7";e.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",t).prop("size",s).wrap(r).after('<div class="minicolors-panel minicolors-slider-'+t.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),t.inline||(e.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),e.next(".minicolors-input-swatch").on("click",function(t){t.preventDefault(),e.focus()}));if((n=e.parent().find(".minicolors-panel")).on("selectstart",function(){return!1}).end(),t.swatches&&0!==t.swatches.length)for(7<t.swatches.length&&(t.swatches.length=7),n.addClass("minicolors-with-swatches"),a=k('<ul class="minicolors-swatches"></ul>').appendTo(n),o=0;o<t.swatches.length;++o)i=T(i=t.swatches[o])?A(i,!0):L(C(i,!0)),k('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",t.swatches[o]).find(".minicolors-swatch-color").css({backgroundColor:d(i),opacity:i.a}),t.swatches[o]=i;t.inline&&e.parent().addClass("minicolors-inline");c(e,!1),e.data("minicolors-initialized",!0)}(k(this),e)}),k(this)}}}),k(document).on("mousedown.minicolors touchstart.minicolors",function(t){k(t.target).parents().add(t.target).hasClass("minicolors")||i()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var e=k(this);t.preventDefault(),k(document).data("minicolors-target",e),n(e,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var e=k(document).data("minicolors-target");e&&n(e,t)}).on("mouseup.minicolors touchend.minicolors",function(){k(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var e=k(this),s=e.parents(".minicolors").find(".minicolors-input"),a=e.data("swatch-color");_(s,a,S(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var e=k(this).parent().find(".minicolors-input");t.preventDefault(),a(e)}).on("focus.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&a(t)}).on("blur.minicolors",".minicolors-input",function(){var t,e,s,a,i,n=k(this),o=n.data("minicolors-settings");n.data("minicolors-initialized")&&(t=o.keywords?k.map(o.keywords.split(","),function(t){return k.trim(t.toLowerCase())}):[],i=""!==n.val()&&-1<k.inArray(n.val().toLowerCase(),t)?n.val():null===(s=T(n.val())?A(n.val(),!0):(e=C(n.val(),!0))?L(e):null)?o.defaultValue:"rgb"===o.format?o.opacity?A("rgba("+s.r+","+s.g+","+s.b+","+n.attr("data-opacity")+")"):A("rgb("+s.r+","+s.g+","+s.b+")"):d(s),a=o.opacity?n.attr("data-opacity"):1,"transparent"===i.toLowerCase()&&(a=0),n.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),n.val(i),""===n.val()&&n.val(M(o.defaultValue,!0)),n.val(x(n.val(),o.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var e=k(this);if(e.data("minicolors-initialized"))switch(t.keyCode){case 9:i();break;case 13:case 27:i(),e.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=k(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})}),function(t,e){"use strict";"undefined"!=typeof module&&module.exports?"undefined"!=typeof process&&"electron"in process.versions?t.BootstrapDialog=e(t.jQuery):module.exports=e(require("jquery"),require("bootstrap")):"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery","bootstrap"],function(t){return e(t)}):t.BootstrapDialog=e(t.jQuery)}(this,function(r){"use strict";function e(t,e){s.call(this,t,e)}var s=r.fn.modal.Constructor;e.getModalVersion=function(){return void 0===r.fn.modal.Constructor.VERSION?"v3.1":/3\.2\.\d+/.test(r.fn.modal.Constructor.VERSION)?"v3.2":/3\.3\.[1,2]/.test(r.fn.modal.Constructor.VERSION)?"v3.3":"v3.3.4"},e.ORIGINAL_BODY_PADDING=parseInt(r("body").css("padding-right")||0,10),(e.METHODS_TO_OVERRIDE={})["v3.1"]={},e.METHODS_TO_OVERRIDE["v3.2"]={hide:function(t){t&&t.preventDefault(),t=r.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,0===this.getGlobalOpenedDialogs().length&&this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),r(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),r.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",r.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())}},e.METHODS_TO_OVERRIDE["v3.3"]={setScrollbar:function(){var t=e.ORIGINAL_BODY_PADDING;this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},resetScrollbar:function(){0===this.getGlobalOpenedDialogs().length&&this.$body.css("padding-right",e.ORIGINAL_BODY_PADDING)},hideModal:function(){this.$element.hide(),this.backdrop(r.proxy(function(){0===this.getGlobalOpenedDialogs().length&&this.$body.removeClass("modal-open"),this.resetAdjustments(),this.resetScrollbar(),this.$element.trigger("hidden.bs.modal")},this))}},e.METHODS_TO_OVERRIDE["v3.3.4"]=r.extend({},e.METHODS_TO_OVERRIDE["v3.3"]),e.prototype={constructor:e,getGlobalOpenedDialogs:function(){var s=[];return r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&s.push(e)}),s}},e.prototype=r.extend(e.prototype,s.prototype,e.METHODS_TO_OVERRIDE[e.getModalVersion()]);var n=function(t){this.defaultOptions=r.extend(!0,{id:n.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},n.defaultOptions),this.indexedButtons={},this.registeredButtonHotkeys={},this.draggableData={isMouseDown:!1,mouseOffset:{}},this.realized=!1,this.opened=!1,this.initOptions(t),this.holdThisInstance()};return n.BootstrapDialogModal=e,n.NAMESPACE="bootstrap-dialog",n.TYPE_DEFAULT="type-default",n.TYPE_INFO="type-info",n.TYPE_PRIMARY="type-primary",n.TYPE_SUCCESS="type-success",n.TYPE_WARNING="type-warning",n.TYPE_DANGER="type-danger",n.DEFAULT_TEXTS={},n.DEFAULT_TEXTS[n.TYPE_DEFAULT]="Information",n.DEFAULT_TEXTS[n.TYPE_INFO]="Information",n.DEFAULT_TEXTS[n.TYPE_PRIMARY]="Information",n.DEFAULT_TEXTS[n.TYPE_SUCCESS]="Success",n.DEFAULT_TEXTS[n.TYPE_WARNING]="Warning",n.DEFAULT_TEXTS[n.TYPE_DANGER]="Danger",n.DEFAULT_TEXTS.OK="OK",n.DEFAULT_TEXTS.CANCEL="Cancel",n.DEFAULT_TEXTS.CONFIRM="Confirmation",n.SIZE_NORMAL="size-normal",n.SIZE_SMALL="size-small",n.SIZE_WIDE="size-wide",n.SIZE_LARGE="size-large",n.BUTTON_SIZES={},n.BUTTON_SIZES[n.SIZE_NORMAL]="",n.BUTTON_SIZES[n.SIZE_SMALL]="",n.BUTTON_SIZES[n.SIZE_WIDE]="",n.BUTTON_SIZES[n.SIZE_LARGE]="btn-lg",n.ICON_SPINNER="glyphicon glyphicon-asterisk",n.defaultOptions={type:n.TYPE_PRIMARY,size:n.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,closeIcon:"×",spinicon:n.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:"",tabindex:-1},n.configDefaultOptions=function(t){n.defaultOptions=r.extend(!0,n.defaultOptions,t)},n.dialogs={},n.openAll=function(){r.each(n.dialogs,function(t,e){e.open()})},n.closeAll=function(){r.each(n.dialogs,function(t,e){e.close()})},n.getDialog=function(t){var e=null;return void 0!==n.dialogs[t]&&(e=n.dialogs[t]),e},n.setDialog=function(t){return n.dialogs[t.getId()]=t},n.addDialog=function(t){return n.setDialog(t)},n.moveFocus=function(){var s=null;r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&(s=e)}),null!==s&&s.getModal().focus()},n.METHODS_TO_OVERRIDE={},n.METHODS_TO_OVERRIDE["v3.1"]={handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(t){t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this},updateZIndex:function(){if(this.isOpened()){var s=0;r.each(n.dialogs,function(t,e){e.isRealized()&&e.isOpened()&&s++});var t=this.getModal(),e=t.data("bs.modal").$backdrop;t.css("z-index",1050+20*(s-1)),e.css("z-index",1040+20*(s-1))}return this},open:function(){return this.isRealized()||this.realize(),this.getModal().modal("show"),this.updateZIndex(),this}},n.METHODS_TO_OVERRIDE["v3.2"]={handleModalBackdropEvent:n.METHODS_TO_OVERRIDE["v3.1"].handleModalBackdropEvent,updateZIndex:n.METHODS_TO_OVERRIDE["v3.1"].updateZIndex,open:n.METHODS_TO_OVERRIDE["v3.1"].open},n.METHODS_TO_OVERRIDE["v3.3"]={},n.METHODS_TO_OVERRIDE["v3.3.4"]=r.extend({},n.METHODS_TO_OVERRIDE["v3.1"]),n.prototype={constructor:n,initOptions:function(t){return this.options=r.extend(!0,this.defaultOptions,t),this},holdThisInstance:function(){return n.addDialog(this),this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var t=r('<div class="modal" role="dialog" aria-hidden="true"></div>');return t.prop("id",this.getId()),t.attr("aria-labelledby",this.getId()+"_title"),t},getModal:function(){return this.$modal},setModal:function(t){return this.$modal=t,this},createModalDialog:function(){return r('<div class="modal-dialog"></div>')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){return this.$modalDialog=t,this},createModalContent:function(){return r('<div class="modal-content"></div>')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){return this.$modalContent=t,this},createModalHeader:function(){return r('<div class="modal-header"></div>')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){return this.$modalHeader=t,this},createModalBody:function(){return r('<div class="modal-body"></div>')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){return this.$modalBody=t,this},createModalFooter:function(){return r('<div class="modal-footer"></div>')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){return this.$modalFooter=t,this},createDynamicContent:function(t){var e=null;return"string"==typeof(e="function"==typeof t?t.call(t,this):t)&&(e=this.formatStringContent(e)),e},formatStringContent:function(t){return this.options.nl2br?t.replace(/\r\n/g,"<br />").replace(/[\r\n]/g,"<br />"):t},setData:function(t,e){return this.options.data[t]=e,this},getData:function(t){return this.options.data[t]},setId:function(t){return this.options.id=t,this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(t){return this.options.type=t,this.updateType(),this},updateType:function(){if(this.isRealized()){var t=[n.TYPE_DEFAULT,n.TYPE_INFO,n.TYPE_PRIMARY,n.TYPE_SUCCESS,n.TYPE_WARNING,n.TYPE_DANGER];this.getModal().removeClass(t.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(t){return this.options.size=t,this.updateSize(),this},updateSize:function(){if(this.isRealized()){var o=this;this.getModal().removeClass(n.SIZE_NORMAL).removeClass(n.SIZE_SMALL).removeClass(n.SIZE_WIDE).removeClass(n.SIZE_LARGE),this.getModal().addClass(this.getSize()),this.getModalDialog().removeClass("modal-sm"),this.getSize()===n.SIZE_SMALL&&this.getModalDialog().addClass("modal-sm"),this.getModalDialog().removeClass("modal-lg"),this.getSize()===n.SIZE_WIDE&&this.getModalDialog().addClass("modal-lg"),r.each(this.options.buttons,function(t,e){var s=o.getButton(e.id),a=["btn-lg","btn-sm","btn-xs"],i=!1;if("string"==typeof e.cssClass){var n=e.cssClass.split(" ");r.each(n,function(t,e){-1!==r.inArray(e,a)&&(i=!0)})}i||(s.removeClass(a.join(" ")),s.addClass(o.getButtonSize()))})}return this},getCssClass:function(){return this.options.cssClass},setCssClass:function(t){return this.options.cssClass=t,this},getTitle:function(){return this.options.title},setTitle:function(t){return this.options.title=t,this.updateTitle(),this},updateTitle:function(){if(this.isRealized()){var t=null!==this.getTitle()?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(t).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(t){return this.options.message=t,this.updateMessage(),this},updateMessage:function(){if(this.isRealized()){var t=this.createDynamicContent(this.getMessage());this.getModalBody().find("."+this.getNamespace("message")).html("").append(t)}return this},isClosable:function(){return this.options.closable},setClosable:function(t){return this.options.closable=t,this.updateClosable(),this},setCloseByBackdrop:function(t){return this.options.closeByBackdrop=t,this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(t){return this.options.closeByKeyboard=t,this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(t){return this.options.animate=t,this},updateAnimate:function(){return this.isRealized()&&this.getModal().toggleClass("fade",this.isAnimate()),this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(t){return this.options.spinicon=t,this},addButton:function(t){return this.options.buttons.push(t),this},addButtons:function(t){var s=this;return r.each(t,function(t,e){s.addButton(e)}),this},getButtons:function(){return this.options.buttons},setButtons:function(t){return this.options.buttons=t,this.updateButtons(),this},getButton:function(t){return void 0!==this.indexedButtons[t]?this.indexedButtons[t]:null},getButtonSize:function(){return void 0!==n.BUTTON_SIZES[this.getSize()]?n.BUTTON_SIZES[this.getSize()]:""},updateButtons:function(){return this.isRealized()&&(0===this.getButtons().length?this.getModalFooter().hide():this.getModalFooter().show().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())),this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(t){this.options.autodestroy=t},getDescription:function(){return this.options.description},setDescription:function(t){return this.options.description=t,this},setTabindex:function(t){return this.options.tabindex=t,this},getTabindex:function(){return this.options.tabindex},updateTabindex:function(){return this.isRealized()&&this.getModal().attr("tabindex",this.getTabindex()),this},getDefaultText:function(){return n.DEFAULT_TEXTS[this.getType()]},getNamespace:function(t){return n.NAMESPACE+"-"+t},createHeaderContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("header")),t.append(this.createTitleContent()),t.prepend(this.createCloseButton()),t},createTitleContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("title")),t},createCloseButton:function(){var t=r("<div></div>");t.addClass(this.getNamespace("close-button"));var e=r('<button class="close"></button>');return e.append(this.options.closeIcon),t.append(e),t.on("click",{dialog:this},function(t){t.data.dialog.close()}),t},createBodyContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("body")),t.append(this.createMessageContent()),t},createMessageContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("message")),t},createFooterContent:function(){var t=r("<div></div>");return t.addClass(this.getNamespace("footer")),t},createFooterButtons:function(){var a=this,i=r("<div></div>");return i.addClass(this.getNamespace("footer-buttons")),this.indexedButtons={},r.each(this.options.buttons,function(t,e){e.id||(e.id=n.newGuid());var s=a.createButton(e);a.indexedButtons[e.id]=s,i.append(s)}),i},createButton:function(t){var e=r('<button class="btn"></button>');return e.prop("id",t.id),e.data("button",t),void 0!==t.icon&&""!==r.trim(t.icon)&&e.append(this.createButtonIcon(t.icon)),void 0!==t.label&&e.append(t.label),void 0!==t.cssClass&&""!==r.trim(t.cssClass)?e.addClass(t.cssClass):e.addClass("btn-default"),void 0!==t.hotkey&&(this.registeredButtonHotkeys[t.hotkey]=e),e.on("click",{dialog:this,$button:e,button:t},function(t){var e=t.data.dialog,s=t.data.$button,a=s.data("button");if(a.autospin&&s.toggleSpin(!0),"function"==typeof a.action)return a.action.call(s,e,t)}),this.enhanceButton(e),void 0!==t.enabled&&e.toggleEnable(t.enabled),e},enhanceButton:function(a){return a.dialog=this,a.toggleEnable=function(t){return void 0!==t?this.prop("disabled",!t).toggleClass("disabled",!t):this.prop("disabled",!this.prop("disabled")),this},a.enable=function(){return this.toggleEnable(!0),this},a.disable=function(){return this.toggleEnable(!1),this},a.toggleSpin=function(t){var e=this.dialog,s=this.find("."+e.getNamespace("button-icon"));return void 0===t&&(t=!(0<a.find(".icon-spin").length)),t?(s.hide(),a.prepend(e.createButtonIcon(e.getSpinicon()).addClass("icon-spin"))):(s.show(),a.find(".icon-spin").remove()),this},a.spin=function(){return this.toggleSpin(!0),this},a.stopSpin=function(){return this.toggleSpin(!1),this},this},createButtonIcon:function(t){var e=r("<span></span>");return e.addClass(this.getNamespace("button-icon")).addClass(t),e},enableButtons:function(s){return r.each(this.indexedButtons,function(t,e){e.toggleEnable(s)}),this},updateClosable:function(){return this.isRealized()&&this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable()),this},onShow:function(t){return this.options.onshow=t,this},onShown:function(t){return this.options.onshown=t,this},onHide:function(t){return this.options.onhide=t,this},onHidden:function(t){return this.options.onhidden=t,this},isRealized:function(){return this.realized},setRealized:function(t){return this.realized=t,this},isOpened:function(){return this.opened},setOpened:function(t){return this.opened=t,this},handleModalEvents:function(){return this.getModal().on("show.bs.modal",{dialog:this},function(t){var e=t.data.dialog;if(e.setOpened(!0),e.isModalEvent(t)&&"function"==typeof e.options.onshow){var s=e.options.onshow(e);return!1===s&&e.setOpened(!1),s}}),this.getModal().on("shown.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.isModalEvent(t)&&"function"==typeof e.options.onshown&&e.options.onshown(e)}),this.getModal().on("hide.bs.modal",{dialog:this},function(t){var e=t.data.dialog;if(e.setOpened(!1),e.isModalEvent(t)&&"function"==typeof e.options.onhide){var s=e.options.onhide(e);return!1===s&&e.setOpened(!0),s}}),this.getModal().on("hidden.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.isModalEvent(t)&&"function"==typeof e.options.onhidden&&e.options.onhidden(e),e.isAutodestroy()&&(e.setRealized(!1),delete n.dialogs[e.getId()],r(this).remove()),n.moveFocus()}),this.handleModalBackdropEvent(),this.getModal().on("keyup",{dialog:this},function(t){27===t.which&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByKeyboard()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(t){var e=t.data.dialog;if(void 0!==e.registeredButtonHotkeys[t.which]){var s=r(e.registeredButtonHotkeys[t.which]);s.prop("disabled")||s.focus().trigger("click")}}),this},handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(t){r(t.target).hasClass("modal-backdrop")&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this},isModalEvent:function(t){return void 0!==t.namespace&&"bs.modal"===t.namespace},makeModalDraggable:function(){return this.options.draggable&&(this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown=!0;var s=e.getModalDialog().offset();e.draggableData.mouseOffset={top:t.clientY-s.top,left:t.clientX-s.left}}),this.getModal().on("mouseup mouseleave",{dialog:this},function(t){t.data.dialog.draggableData.isMouseDown=!1}),r("body").on("mousemove",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown&&e.getModalDialog().offset({top:t.clientY-e.draggableData.mouseOffset.top,left:t.clientX-e.draggableData.mouseOffset.left})})),this},realize:function(){return this.initModalStuff(),this.getModal().addClass(n.NAMESPACE).addClass(this.getCssClass()),this.updateSize(),this.getDescription()&&this.getModal().attr("aria-describedby",this.getDescription()),this.getModalFooter().append(this.createFooterContent()),this.getModalHeader().append(this.createHeaderContent()),this.getModalBody().append(this.createBodyContent()),this.getModal().data("bs.modal",new e(this.getModal(),{backdrop:"static",keyboard:!1,show:!1})),this.makeModalDraggable(),this.handleModalEvents(),this.setRealized(!0),this.updateButtons(),this.updateType(),this.updateTitle(),this.updateMessage(),this.updateClosable(),this.updateAnimate(),this.updateSize(),this.updateTabindex(),this},open:function(){return this.isRealized()||this.realize(),this.getModal().modal("show"),this},close:function(){return this.isRealized()||this.realize(),this.getModal().modal("hide"),this}},n.prototype=r.extend(n.prototype,n.METHODS_TO_OVERRIDE[e.getModalVersion()]),n.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})},n.show=function(t){return new n(t).open()},n.alert=function(){var t={},e={type:n.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,buttonLabel:n.DEFAULT_TEXTS.OK,callback:null};t="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?r.extend(!0,e,arguments[0]):r.extend(!0,e,{message:arguments[0],callback:void 0!==arguments[1]?arguments[1]:null});var s=new n(t);return s.setData("callback",t.callback),s.addButton({label:t.buttonLabel,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!0))&&(t.setData("btnClicked",!0),t.close())}}),"function"==typeof s.options.onhide?s.onHide(function(t){var e=!0;return!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&(e=t.getData("callback")(!1)),!1!==e&&(e=this.onhide(t))}.bind({onhide:s.options.onhide})):s.onHide(function(t){var e=!0;return!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&(e=t.getData("callback")(!1)),e}),s.open()},n.confirm=function(){var t={},e={type:n.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,btnCancelLabel:n.DEFAULT_TEXTS.CANCEL,btnCancelClass:null,btnOKLabel:n.DEFAULT_TEXTS.OK,btnOKClass:null,callback:null};null===(t="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?r.extend(!0,e,arguments[0]):r.extend(!0,e,{message:arguments[0],callback:void 0!==arguments[1]?arguments[1]:null})).btnOKClass&&(t.btnOKClass=["btn",t.type.split("-")[1]].join("-"));var s=new n(t);return s.setData("callback",t.callback),s.addButton({label:t.btnCancelLabel,cssClass:t.btnCancelClass,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!1))&&t.close()}}),s.addButton({label:t.btnOKLabel,cssClass:t.btnOKClass,action:function(t){return("function"!=typeof t.getData("callback")||!1!==t.getData("callback").call(this,!0))&&t.close()}}),s.open()},n.warning=function(t,e){return new n({type:n.TYPE_WARNING,message:t}).open()},n.danger=function(t,e){return new n({type:n.TYPE_DANGER,message:t}).open()},n.success=function(t,e){return new n({type:n.TYPE_SUCCESS,message:t}).open()},n}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moment=e()}(this,function(){"use strict";var t,a;function p(){return t.apply(null,arguments)}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function n(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function o(t,e){var s,a=[];for(s=0;s<t.length;++s)a.push(e(t[s],s));return a}function h(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function r(t,e){for(var s in e)h(e,s)&&(t[s]=e[s]);return h(e,"toString")&&(t.toString=e.toString),h(e,"valueOf")&&(t.valueOf=e.valueOf),t}function d(t,e,s,a){return re(t,e,s,a,!0).utc()}function m(t){return null==t._pf&&(t._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}),t._pf}function l(t){if(null==t._isValid){var e=m(t),s=a.call(e.parsedDateParts,function(t){return null!=t});t._isValid=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&s),t._strict&&(t._isValid=t._isValid&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour)}return t._isValid}function c(t){var e=d(NaN);return null!=t?r(m(e),t):m(e).userInvalidated=!0,e}function u(t){return void 0===t}a=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),s=e.length>>>0,a=0;a<s;a++)if(a in e&&t.call(this,e[a],a,e))return!0;return!1};var f=p.momentProperties=[];function g(t,e){var s,a,i;if(u(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),u(e._i)||(t._i=e._i),u(e._f)||(t._f=e._f),u(e._l)||(t._l=e._l),u(e._strict)||(t._strict=e._strict),u(e._tzm)||(t._tzm=e._tzm),u(e._isUTC)||(t._isUTC=e._isUTC),u(e._offset)||(t._offset=e._offset),u(e._pf)||(t._pf=m(e)),u(e._locale)||(t._locale=e._locale),0<f.length)for(s in f)u(i=e[a=f[s]])||(t[a]=i);return t}var e=!1;function v(t){g(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),!1===e&&(e=!0,p.updateOffset(this),e=!1)}function b(t){return t instanceof v||null!=t&&null!=t._isAMomentObject}function y(t){return t<0?Math.ceil(t):Math.floor(t)}function w(t){var e=+t,s=0;return 0!=e&&isFinite(e)&&(s=y(e)),s}function k(t,e,s){var a,i=Math.min(t.length,e.length),n=Math.abs(t.length-e.length),o=0;for(a=0;a<i;a++)(s&&t[a]!==e[a]||!s&&w(t[a])!==w(e[a]))&&o++;return o+n}function x(t){!1===p.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function s(t,e){var s=!0;return r(function(){return null!=p.deprecationHandler&&p.deprecationHandler(null,t),s&&(x(t+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),s=!1),e.apply(this,arguments)},e)}var C,_={};function P(t,e){null!=p.deprecationHandler&&p.deprecationHandler(t,e),_[t]||(x(e),_[t]=!0)}function A(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function M(t){return"[object Object]"===Object.prototype.toString.call(t)}function D(t,e){var s,a=r({},t);for(s in e)h(e,s)&&(M(t[s])&&M(e[s])?(a[s]={},r(a[s],t[s]),r(a[s],e[s])):null!=e[s]?a[s]=e[s]:delete a[s]);return a}function T(t){null!=t&&this.set(t)}p.suppressDeprecationWarnings=!1,p.deprecationHandler=null,C=Object.keys?Object.keys:function(t){var e,s=[];for(e in t)h(t,e)&&s.push(e);return s};var S,E={};function O(t){return t?t.toLowerCase().replace("_","-"):t}function L(t){var e=null;if(!E[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=S._abbr,require("./locale/"+t),B(e)}catch(t){}return E[t]}function B(t,e){var s;return t&&(s=u(e)?j(t):I(t,e))&&(S=s),S._abbr}function I(t,e){return null!==e?(e.abbr=t,null!=E[t]?(P("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),e=D(E[t]._config,e)):null!=e.parentLocale&&(null!=E[e.parentLocale]?e=D(E[e.parentLocale]._config,e):P("parentLocaleUndefined","specified parentLocale is not defined yet")),E[t]=new T(e),B(t),E[t]):(delete E[t],null)}function j(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return S;if(!i(t)){if(e=L(t))return e;t=[t]}return function(t){for(var e,s,a,i,n=0;n<t.length;){for(e=(i=O(t[n]).split("-")).length,s=(s=O(t[n+1]))?s.split("-"):null;0<e;){if(a=L(i.slice(0,e).join("-")))return a;if(s&&s.length>=e&&k(i,s,!0)>=e-1)break;e--}n++}return null}(t)}var F={};function Y(t,e){var s=t.toLowerCase();F[s]=F[s+"s"]=F[e]=t}function R(t){return"string"==typeof t?F[t]||F[t.toLowerCase()]:void 0}function z(t){var e,s,a={};for(s in t)h(t,s)&&(e=R(s))&&(a[e]=t[s]);return a}function Q(e,s){return function(t){return null!=t?(N(this,e,t),p.updateOffset(this,s),this):H(this,e)}}function H(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function N(t,e,s){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](s)}function $(t,e){var s;if("object"==typeof t)for(s in t)this.set(s,t[s]);else if(A(this[t=R(t)]))return this[t](e);return this}function U(t,e,s){var a=""+Math.abs(t),i=e-a.length;return(0<=t?s?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+a}var G=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},K={};function W(t,e,s,a){var i=a;"string"==typeof a&&(i=function(){return this[a]()}),t&&(K[t]=i),e&&(K[e[0]]=function(){return U(i.apply(this,arguments),e[1],e[2])}),s&&(K[s]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function J(t,e){return t.isValid()?(e=Z(e,t.localeData()),V[e]=V[e]||function(a){var t,i,e,n=a.match(G);for(t=0,i=n.length;t<i;t++)K[n[t]]?n[t]=K[n[t]]:n[t]=(e=n[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(t){var e,s="";for(e=0;e<i;e++)s+=n[e]instanceof Function?n[e].call(t,a):n[e];return s}}(e),V[e](t)):t.localeData().invalidDate()}function Z(t,e){var s=5;function a(t){return e.longDateFormat(t)||t}for(q.lastIndex=0;0<=s&&q.test(t);)t=t.replace(q,a),q.lastIndex=0,s-=1;return t}var X=/\d/,tt=/\d\d/,et=/\d{3}/,st=/\d{4}/,at=/[+-]?\d{6}/,it=/\d\d?/,nt=/\d\d\d\d?/,ot=/\d\d\d\d\d\d?/,rt=/\d{1,3}/,lt=/\d{1,4}/,ct=/[+-]?\d{1,6}/,dt=/\d+/,ut=/[+-]?\d+/,pt=/Z|[+-]\d\d:?\d\d/gi,ht=/Z|[+-]\d\d(?::?\d\d)?/gi,mt=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ft={};function gt(t,s,a){ft[t]=A(s)?s:function(t,e){return t&&a?a:s}}function vt(t,e){return h(ft,t)?ft[t](e._strict,e._locale):new RegExp(function(t){return bt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,s,a,i){return e||s||a||i}))}(t))}function bt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var yt={};function wt(t,s){var e,a=s;for("string"==typeof t&&(t=[t]),"number"==typeof s&&(a=function(t,e){e[s]=w(t)}),e=0;e<t.length;e++)yt[t[e]]=a}function kt(t,i){wt(t,function(t,e,s,a){s._w=s._w||{},i(t,s._w,s,a)})}var xt,Ct=0,_t=1,Pt=2,At=3,Mt=4,Dt=5,Tt=6,St=7,Et=8;function Ot(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}xt=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1},W("M",["MM",2],"Mo",function(){return this.month()+1}),W("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),W("MMMM",0,0,function(t){return this.localeData().months(this,t)}),Y("month","M"),gt("M",it),gt("MM",it,tt),gt("MMM",function(t,e){return e.monthsShortRegex(t)}),gt("MMMM",function(t,e){return e.monthsRegex(t)}),wt(["M","MM"],function(t,e){e[_t]=w(t)-1}),wt(["MMM","MMMM"],function(t,e,s,a){var i=s._locale.monthsParse(t,a,s._strict);null!=i?e[_t]=i:m(s).invalidMonth=t});var Lt=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Bt="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var It="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function jt(t,e){var s;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=w(e);else if("number"!=typeof(e=t.localeData().monthsParse(e)))return t;return s=Math.min(t.date(),Ot(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,s),t}function Ft(t){return null!=t?(jt(this,t),p.updateOffset(this,!0),this):H(this,"Month")}var Yt=mt;var Rt=mt;function zt(){function t(t,e){return e.length-t.length}var e,s,a=[],i=[],n=[];for(e=0;e<12;e++)s=d([2e3,e]),a.push(this.monthsShort(s,"")),i.push(this.months(s,"")),n.push(this.months(s,"")),n.push(this.monthsShort(s,""));for(a.sort(t),i.sort(t),n.sort(t),e=0;e<12;e++)a[e]=bt(a[e]),i[e]=bt(i[e]),n[e]=bt(n[e]);this._monthsRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qt(t){var e,s=t._a;return s&&-2===m(t).overflow&&(e=s[_t]<0||11<s[_t]?_t:s[Pt]<1||s[Pt]>Ot(s[Ct],s[_t])?Pt:s[At]<0||24<s[At]||24===s[At]&&(0!==s[Mt]||0!==s[Dt]||0!==s[Tt])?At:s[Mt]<0||59<s[Mt]?Mt:s[Dt]<0||59<s[Dt]?Dt:s[Tt]<0||999<s[Tt]?Tt:-1,m(t)._overflowDayOfYear&&(e<Ct||Pt<e)&&(e=Pt),m(t)._overflowWeeks&&-1===e&&(e=St),m(t)._overflowWeekday&&-1===e&&(e=Et),m(t).overflow=e),t}var Ht=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Nt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,$t=/Z|[+-]\d\d(?::?\d\d)?/,Ut=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],qt=/^\/?Date\((\-?\d+)/i;function Vt(t){var e,s,a,i,n,o,r=t._i,l=Ht.exec(r)||Nt.exec(r);if(l){for(m(t).iso=!0,e=0,s=Ut.length;e<s;e++)if(Ut[e][1].exec(l[1])){i=Ut[e][0],a=!1!==Ut[e][2];break}if(null==i)return void(t._isValid=!1);if(l[3]){for(e=0,s=Gt.length;e<s;e++)if(Gt[e][1].exec(l[3])){n=(l[2]||" ")+Gt[e][0];break}if(null==n)return void(t._isValid=!1)}if(!a&&null!=n)return void(t._isValid=!1);if(l[4]){if(!$t.exec(l[4]))return void(t._isValid=!1);o="Z"}t._f=i+(n||"")+(o||""),ne(t)}else t._isValid=!1}function Kt(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&0<=t&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function Wt(t){return Jt(t)?366:365}function Jt(t){return t%4==0&&t%100!=0||t%400==0}p.createFromInputFallback=s("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),W("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),W(0,["YY",2],0,function(){return this.year()%100}),W(0,["YYYY",4],0,"year"),W(0,["YYYYY",5],0,"year"),W(0,["YYYYYY",6,!0],0,"year"),Y("year","y"),gt("Y",ut),gt("YY",it,tt),gt("YYYY",lt,st),gt("YYYYY",ct,at),gt("YYYYYY",ct,at),wt(["YYYYY","YYYYYY"],Ct),wt("YYYY",function(t,e){e[Ct]=2===t.length?p.parseTwoDigitYear(t):w(t)}),wt("YY",function(t,e){e[Ct]=p.parseTwoDigitYear(t)}),wt("Y",function(t,e){e[Ct]=parseInt(t,10)}),p.parseTwoDigitYear=function(t){return w(t)+(68<w(t)?1900:2e3)};var Zt=Q("FullYear",!0);function Xt(t,e,s){var a=7+e-s;return a-(7+Kt(t,0,a).getUTCDay()-e)%7-1}function te(t,e,s,a,i){var n,o,r=1+7*(e-1)+(7+s-a)%7+Xt(t,a,i);return o=r<=0?Wt(n=t-1)+r:r>Wt(t)?(n=t+1,r-Wt(t)):(n=t,r),{year:n,dayOfYear:o}}function ee(t,e,s){var a,i,n=Xt(t.year(),e,s),o=Math.floor((t.dayOfYear()-n-1)/7)+1;return o<1?a=o+se(i=t.year()-1,e,s):o>se(t.year(),e,s)?(a=o-se(t.year(),e,s),i=t.year()+1):(i=t.year(),a=o),{week:a,year:i}}function se(t,e,s){var a=Xt(t,e,s),i=Xt(t+1,e,s);return(Wt(t)-a+i)/7}function ae(t,e,s){return null!=t?t:null!=e?e:s}function ie(t){var e,s,a,i,n=[];if(!t._d){for(a=function(t){var e=new Date(p.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}(t),t._w&&null==t._a[Pt]&&null==t._a[_t]&&function(t){var e,s,a,i,n,o,r,l;null!=(e=t._w).GG||null!=e.W||null!=e.E?(n=1,o=4,s=ae(e.GG,t._a[Ct],ee(le(),1,4).year),a=ae(e.W,1),((i=ae(e.E,1))<1||7<i)&&(l=!0)):(n=t._locale._week.dow,o=t._locale._week.doy,s=ae(e.gg,t._a[Ct],ee(le(),n,o).year),a=ae(e.w,1),null!=e.d?((i=e.d)<0||6<i)&&(l=!0):null!=e.e?(i=e.e+n,(e.e<0||6<e.e)&&(l=!0)):i=n);a<1||a>se(s,n,o)?m(t)._overflowWeeks=!0:null!=l?m(t)._overflowWeekday=!0:(r=te(s,a,i,n,o),t._a[Ct]=r.year,t._dayOfYear=r.dayOfYear)}(t),t._dayOfYear&&(i=ae(t._a[Ct],a[Ct]),t._dayOfYear>Wt(i)&&(m(t)._overflowDayOfYear=!0),s=Kt(i,0,t._dayOfYear),t._a[_t]=s.getUTCMonth(),t._a[Pt]=s.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=n[e]=a[e];for(;e<7;e++)t._a[e]=n[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[At]&&0===t._a[Mt]&&0===t._a[Dt]&&0===t._a[Tt]&&(t._nextDay=!0,t._a[At]=0),t._d=(t._useUTC?Kt:function(t,e,s,a,i,n,o){var r=new Date(t,e,s,a,i,n,o);return t<100&&0<=t&&isFinite(r.getFullYear())&&r.setFullYear(t),r}).apply(null,n),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[At]=24)}}function ne(t){if(t._f!==p.ISO_8601){t._a=[],m(t).empty=!0;var e,s,a,i,n,o,r,l,c=""+t._i,d=c.length,u=0;for(a=Z(t._f,t._locale).match(G)||[],e=0;e<a.length;e++)i=a[e],(s=(c.match(vt(i,t))||[])[0])&&(0<(n=c.substr(0,c.indexOf(s))).length&&m(t).unusedInput.push(n),c=c.slice(c.indexOf(s)+s.length),u+=s.length),K[i]?(s?m(t).empty=!1:m(t).unusedTokens.push(i),o=i,l=t,null!=(r=s)&&h(yt,o)&&yt[o](r,l._a,l,o)):t._strict&&!s&&m(t).unusedTokens.push(i);m(t).charsLeftOver=d-u,0<c.length&&m(t).unusedInput.push(c),!0===m(t).bigHour&&t._a[At]<=12&&0<t._a[At]&&(m(t).bigHour=void 0),m(t).parsedDateParts=t._a.slice(0),m(t).meridiem=t._meridiem,t._a[At]=function(t,e,s){var a;if(null==s)return e;return null!=t.meridiemHour?t.meridiemHour(e,s):(null!=t.isPM&&((a=t.isPM(s))&&e<12&&(e+=12),a||12!==e||(e=0)),e)}(t._locale,t._a[At],t._meridiem),ie(t),Qt(t)}else Vt(t)}function oe(t){var e=t._i,s=t._f;return t._locale=t._locale||j(t._l),null===e||void 0===s&&""===e?c({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),b(e)?new v(Qt(e)):(i(s)?function(t){var e,s,a,i,n;if(0===t._f.length)return m(t).invalidFormat=!0,t._d=new Date(NaN);for(i=0;i<t._f.length;i++)n=0,e=g({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[i],ne(e),l(e)&&(n+=m(e).charsLeftOver,n+=10*m(e).unusedTokens.length,m(e).score=n,(null==a||n<a)&&(a=n,s=e));r(t,s||e)}(t):s?ne(t):n(e)?t._d=e:function(t){var e=t._i;void 0===e?t._d=new Date(p.now()):n(e)?t._d=new Date(e.valueOf()):"string"==typeof e?function(t){var e=qt.exec(t._i);null===e?(Vt(t),!1===t._isValid&&(delete t._isValid,p.createFromInputFallback(t))):t._d=new Date(+e[1])}(t):i(e)?(t._a=o(e.slice(0),function(t){return parseInt(t,10)}),ie(t)):"object"==typeof e?function(t){if(!t._d){var e=z(t._i);t._a=o([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),ie(t)}}(t):"number"==typeof e?t._d=new Date(e):p.createFromInputFallback(t)}(t),l(t)||(t._d=null),t))}function re(t,e,s,a,i){var n={};return"boolean"==typeof s&&(a=s,s=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=s,n._i=t,n._f=e,n._strict=a,function(t){var e=new v(Qt(oe(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}(n)}function le(t,e,s,a){return re(t,e,s,a,!1)}p.ISO_8601=function(){};var ce=s("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var t=le.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:c()}),de=s("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var t=le.apply(null,arguments);return this.isValid()&&t.isValid()?this<t?this:t:c()});function ue(t,e){var s,a;if(1===e.length&&i(e[0])&&(e=e[0]),!e.length)return le();for(s=e[0],a=1;a<e.length;++a)e[a].isValid()&&!e[a][t](s)||(s=e[a]);return s}function pe(t){var e=z(t),s=e.year||0,a=e.quarter||0,i=e.month||0,n=e.week||0,o=e.day||0,r=e.hour||0,l=e.minute||0,c=e.second||0,d=e.millisecond||0;this._milliseconds=+d+1e3*c+6e4*l+1e3*r*60*60,this._days=+o+7*n,this._months=+i+3*a+12*s,this._data={},this._locale=j(),this._bubble()}function he(t){return t instanceof pe}function me(t,s){W(t,0,0,function(){var t=this.utcOffset(),e="+";return t<0&&(t=-t,e="-"),e+U(~~(t/60),2)+s+U(~~t%60,2)})}me("Z",":"),me("ZZ",""),gt("Z",ht),gt("ZZ",ht),wt(["Z","ZZ"],function(t,e,s){s._useUTC=!0,s._tzm=ge(ht,t)});var fe=/([\+\-]|\d\d)/gi;function ge(t,e){var s=(e||"").match(t)||[],a=((s[s.length-1]||[])+"").match(fe)||["-",0,0],i=60*a[1]+w(a[2]);return"+"===a[0]?i:-i}function ve(t,e){var s,a;return e._isUTC?(s=e.clone(),a=(b(t)||n(t)?t.valueOf():le(t).valueOf())-s.valueOf(),s._d.setTime(s._d.valueOf()+a),p.updateOffset(s,!1),s):le(t).local()}function be(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function ye(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}p.updateOffset=function(){};var we=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function xe(t,e){var s,a,i,n=t,o=null;return he(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(n={},e?n[e]=t:n.milliseconds=t):(o=we.exec(t))?(s="-"===o[1]?-1:1,n={y:0,d:w(o[Pt])*s,h:w(o[At])*s,m:w(o[Mt])*s,s:w(o[Dt])*s,ms:w(o[Tt])*s}):(o=ke.exec(t))?(s="-"===o[1]?-1:1,n={y:Ce(o[2],s),M:Ce(o[3],s),w:Ce(o[4],s),d:Ce(o[5],s),h:Ce(o[6],s),m:Ce(o[7],s),s:Ce(o[8],s)}):null==n?n={}:"object"==typeof n&&("from"in n||"to"in n)&&(i=function(t,e){var s;if(!t.isValid()||!e.isValid())return{milliseconds:0,months:0};e=ve(e,t),t.isBefore(e)?s=_e(t,e):((s=_e(e,t)).milliseconds=-s.milliseconds,s.months=-s.months);return s}(le(n.from),le(n.to)),(n={}).ms=i.milliseconds,n.M=i.months),a=new pe(n),he(t)&&h(t,"_locale")&&(a._locale=t._locale),a}function Ce(t,e){var s=t&&parseFloat(t.replace(",","."));return(isNaN(s)?0:s)*e}function _e(t,e){var s={milliseconds:0,months:0};return s.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(s.months,"M").isAfter(e)&&--s.months,s.milliseconds=e-t.clone().add(s.months,"M"),s}function Pe(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function Ae(a,i){return function(t,e){var s;return null===e||isNaN(+e)||(P(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period)."),s=t,t=e,e=s),Me(this,xe(t="string"==typeof t?+t:t,e),a),this}}function Me(t,e,s,a){var i=e._milliseconds,n=Pe(e._days),o=Pe(e._months);t.isValid()&&(a=null==a||a,i&&t._d.setTime(t._d.valueOf()+i*s),n&&N(t,"Date",H(t,"Date")+n*s),o&&jt(t,H(t,"Month")+o*s),a&&p.updateOffset(t,n||o))}xe.fn=pe.prototype;var De=Ae(1,"add"),Te=Ae(-1,"subtract");function Se(t){var e;return void 0===t?this._locale._abbr:(null!=(e=j(t))&&(this._locale=e),this)}p.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",p.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Ee=s("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});function Oe(){return this._locale}function Le(t,e){W(0,[t,t.length],0,e)}function Be(t,e,s,a,i){var n;return null==t?ee(this,a,i).year:((n=se(t,a,i))<e&&(e=n),function(t,e,s,a,i){var n=te(t,e,s,a,i),o=Kt(n.year,0,n.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}.call(this,t,e,s,a,i))}W(0,["gg",2],0,function(){return this.weekYear()%100}),W(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Le("gggg","weekYear"),Le("ggggg","weekYear"),Le("GGGG","isoWeekYear"),Le("GGGGG","isoWeekYear"),Y("weekYear","gg"),Y("isoWeekYear","GG"),gt("G",ut),gt("g",ut),gt("GG",it,tt),gt("gg",it,tt),gt("GGGG",lt,st),gt("gggg",lt,st),gt("GGGGG",ct,at),gt("ggggg",ct,at),kt(["gggg","ggggg","GGGG","GGGGG"],function(t,e,s,a){e[a.substr(0,2)]=w(t)}),kt(["gg","GG"],function(t,e,s,a){e[a]=p.parseTwoDigitYear(t)}),W("Q",0,"Qo","quarter"),Y("quarter","Q"),gt("Q",X),wt("Q",function(t,e){e[_t]=3*(w(t)-1)}),W("w",["ww",2],"wo","week"),W("W",["WW",2],"Wo","isoWeek"),Y("week","w"),Y("isoWeek","W"),gt("w",it),gt("ww",it,tt),gt("W",it),gt("WW",it,tt),kt(["w","ww","W","WW"],function(t,e,s,a){e[a.substr(0,1)]=w(t)});W("D",["DD",2],"Do","date"),Y("date","D"),gt("D",it),gt("DD",it,tt),gt("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),wt(["D","DD"],Pt),wt("Do",function(t,e){e[Pt]=w(t.match(it)[0])});var Ie=Q("Date",!0);W("d",0,"do","day"),W("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),W("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),W("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),W("e",0,0,"weekday"),W("E",0,0,"isoWeekday"),Y("day","d"),Y("weekday","e"),Y("isoWeekday","E"),gt("d",it),gt("e",it),gt("E",it),gt("dd",function(t,e){return e.weekdaysMinRegex(t)}),gt("ddd",function(t,e){return e.weekdaysShortRegex(t)}),gt("dddd",function(t,e){return e.weekdaysRegex(t)}),kt(["dd","ddd","dddd"],function(t,e,s,a){var i=s._locale.weekdaysParse(t,a,s._strict);null!=i?e.d=i:m(s).invalidWeekday=t}),kt(["d","e","E"],function(t,e,s,a){e[a]=w(t)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Fe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ye="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Re=mt;var ze=mt;var Qe=mt;function He(){function t(t,e){return e.length-t.length}var e,s,a,i,n,o=[],r=[],l=[],c=[];for(e=0;e<7;e++)s=d([2e3,1]).day(e),a=this.weekdaysMin(s,""),i=this.weekdaysShort(s,""),n=this.weekdays(s,""),o.push(a),r.push(i),l.push(n),c.push(a),c.push(i),c.push(n);for(o.sort(t),r.sort(t),l.sort(t),c.sort(t),e=0;e<7;e++)r[e]=bt(r[e]),l[e]=bt(l[e]),c[e]=bt(c[e]);this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function Ne(){return this.hours()%12||12}function $e(t,e){W(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Ue(t,e){return e._meridiemParse}W("DDD",["DDDD",3],"DDDo","dayOfYear"),Y("dayOfYear","DDD"),gt("DDD",rt),gt("DDDD",et),wt(["DDD","DDDD"],function(t,e,s){s._dayOfYear=w(t)}),W("H",["HH",2],0,"hour"),W("h",["hh",2],0,Ne),W("k",["kk",2],0,function(){return this.hours()||24}),W("hmm",0,0,function(){return""+Ne.apply(this)+U(this.minutes(),2)}),W("hmmss",0,0,function(){return""+Ne.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),W("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),W("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),$e("a",!0),$e("A",!1),Y("hour","h"),gt("a",Ue),gt("A",Ue),gt("H",it),gt("h",it),gt("HH",it,tt),gt("hh",it,tt),gt("hmm",nt),gt("hmmss",ot),gt("Hmm",nt),gt("Hmmss",ot),wt(["H","HH"],At),wt(["a","A"],function(t,e,s){s._isPm=s._locale.isPM(t),s._meridiem=t}),wt(["h","hh"],function(t,e,s){e[At]=w(t),m(s).bigHour=!0}),wt("hmm",function(t,e,s){var a=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a)),m(s).bigHour=!0}),wt("hmmss",function(t,e,s){var a=t.length-4,i=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a,2)),e[Dt]=w(t.substr(i)),m(s).bigHour=!0}),wt("Hmm",function(t,e,s){var a=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a))}),wt("Hmmss",function(t,e,s){var a=t.length-4,i=t.length-2;e[At]=w(t.substr(0,a)),e[Mt]=w(t.substr(a,2)),e[Dt]=w(t.substr(i))});var Ge=Q("Hours",!0);W("m",["mm",2],0,"minute"),Y("minute","m"),gt("m",it),gt("mm",it,tt),wt(["m","mm"],Mt);var qe=Q("Minutes",!1);W("s",["ss",2],0,"second"),Y("second","s"),gt("s",it),gt("ss",it,tt),wt(["s","ss"],Dt);var Ve,Ke=Q("Seconds",!1);for(W("S",0,0,function(){return~~(this.millisecond()/100)}),W(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),W(0,["SSS",3],0,"millisecond"),W(0,["SSSS",4],0,function(){return 10*this.millisecond()}),W(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),W(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),W(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),W(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),W(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),Y("millisecond","ms"),gt("S",rt,X),gt("SS",rt,tt),gt("SSS",rt,et),Ve="SSSS";Ve.length<=9;Ve+="S")gt(Ve,dt);function We(t,e){e[Tt]=w(1e3*("0."+t))}for(Ve="S";Ve.length<=9;Ve+="S")wt(Ve,We);var Je=Q("Milliseconds",!1);W("z",0,0,"zoneAbbr"),W("zz",0,0,"zoneName");var Ze=v.prototype;Ze.add=De,Ze.calendar=function(t,e){var s=t||le(),a=ve(s,this).startOf("day"),i=this.diff(a,"days",!0),n=i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse",o=e&&(A(e[n])?e[n]():e[n]);return this.format(o||this.localeData().calendar(n,this,le(s)))},Ze.clone=function(){return new v(this)},Ze.diff=function(t,e,s){var a,i,n,o;return this.isValid()&&(a=ve(t,this)).isValid()?(i=6e4*(a.utcOffset()-this.utcOffset()),"year"===(e=R(e))||"month"===e||"quarter"===e?(o=function(t,e){var s,a,i=12*(e.year()-t.year())+(e.month()-t.month()),n=t.clone().add(i,"months");a=e-n<0?(s=t.clone().add(i-1,"months"),(e-n)/(n-s)):(s=t.clone().add(1+i,"months"),(e-n)/(s-n));return-(i+a)||0}(this,a),"quarter"===e?o/=3:"year"===e&&(o/=12)):(n=this-a,o="second"===e?n/1e3:"minute"===e?n/6e4:"hour"===e?n/36e5:"day"===e?(n-i)/864e5:"week"===e?(n-i)/6048e5:n),s?o:y(o)):NaN},Ze.endOf=function(t){return void 0===(t=R(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))},Ze.format=function(t){t=t||(this.isUtc()?p.defaultFormatUtc:p.defaultFormat);var e=J(this,t);return this.localeData().postformat(e)},Ze.from=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||le(t).isValid())?xe({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Ze.fromNow=function(t){return this.from(le(),t)},Ze.to=function(t,e){return this.isValid()&&(b(t)&&t.isValid()||le(t).isValid())?xe({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},Ze.toNow=function(t){return this.to(le(),t)},Ze.get=$,Ze.invalidAt=function(){return m(this).overflow},Ze.isAfter=function(t,e){var s=b(t)?t:le(t);return!(!this.isValid()||!s.isValid())&&("millisecond"===(e=R(u(e)?"millisecond":e))?this.valueOf()>s.valueOf():s.valueOf()<this.clone().startOf(e).valueOf())},Ze.isBefore=function(t,e){var s=b(t)?t:le(t);return!(!this.isValid()||!s.isValid())&&("millisecond"===(e=R(u(e)?"millisecond":e))?this.valueOf()<s.valueOf():this.clone().endOf(e).valueOf()<s.valueOf())},Ze.isBetween=function(t,e,s,a){return("("===(a=a||"()")[0]?this.isAfter(t,s):!this.isBefore(t,s))&&(")"===a[1]?this.isBefore(e,s):!this.isAfter(e,s))},Ze.isSame=function(t,e){var s,a=b(t)?t:le(t);return!(!this.isValid()||!a.isValid())&&("millisecond"===(e=R(e||"millisecond"))?this.valueOf()===a.valueOf():(s=a.valueOf(),this.clone().startOf(e).valueOf()<=s&&s<=this.clone().endOf(e).valueOf()))},Ze.isSameOrAfter=function(t,e){return this.isSame(t,e)||this.isAfter(t,e)},Ze.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)},Ze.isValid=function(){return l(this)},Ze.lang=Ee,Ze.locale=Se,Ze.localeData=Oe,Ze.max=de,Ze.min=ce,Ze.parsingFlags=function(){return r({},m(this))},Ze.set=$,Ze.startOf=function(t){switch(t=R(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this},Ze.subtract=Te,Ze.toArray=function(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]},Ze.toObject=function(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}},Ze.toDate=function(){return this._offset?new Date(this.valueOf()):this._d},Ze.toISOString=function(){var t=this.clone().utc();return 0<t.year()&&t.year()<=9999?A(Date.prototype.toISOString)?this.toDate().toISOString():J(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):J(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},Ze.toJSON=function(){return this.isValid()?this.toISOString():null},Ze.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Ze.unix=function(){return Math.floor(this.valueOf()/1e3)},Ze.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Ze.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Ze.year=Zt,Ze.isLeapYear=function(){return Jt(this.year())},Ze.weekYear=function(t){return Be.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},Ze.isoWeekYear=function(t){return Be.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)},Ze.quarter=Ze.quarters=function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},Ze.month=Ft,Ze.daysInMonth=function(){return Ot(this.year(),this.month())},Ze.week=Ze.weeks=function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},Ze.isoWeek=Ze.isoWeeks=function(t){var e=ee(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},Ze.weeksInYear=function(){var t=this.localeData()._week;return se(this.year(),t.dow,t.doy)},Ze.isoWeeksInYear=function(){return se(this.year(),1,4)},Ze.date=Ie,Ze.day=Ze.days=function(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=function(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}(t,this.localeData()),this.add(t-e,"d")):e},Ze.weekday=function(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},Ze.isoWeekday=function(t){return this.isValid()?null==t?this.day()||7:this.day(this.day()%7?t:t-7):null!=t?this:NaN},Ze.dayOfYear=function(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},Ze.hour=Ze.hours=Ge,Ze.minute=Ze.minutes=qe,Ze.second=Ze.seconds=Ke,Ze.millisecond=Ze.milliseconds=Je,Ze.utcOffset=function(t,e){var s,a=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=ge(ht,t):Math.abs(t)<16&&(t*=60),!this._isUTC&&e&&(s=be(this)),this._offset=t,this._isUTC=!0,null!=s&&this.add(s,"m"),a!==t&&(!e||this._changeInProgress?Me(this,xe(t-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,p.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?a:be(this):null!=t?this:NaN},Ze.utc=function(t){return this.utcOffset(0,t)},Ze.local=function(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(be(this),"m")),this},Ze.parseZone=function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(ge(pt,this._i)),this},Ze.hasAlignedHourOffset=function(t){return!!this.isValid()&&(t=t?le(t).utcOffset():0,(this.utcOffset()-t)%60==0)},Ze.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Ze.isDSTShifted=function(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t={};if(g(t,this),(t=oe(t))._a){var e=t._isUTC?d(t._a):le(t._a);this._isDSTShifted=this.isValid()&&0<k(t._a,e.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted},Ze.isLocal=function(){return!!this.isValid()&&!this._isUTC},Ze.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Ze.isUtc=ye,Ze.isUTC=ye,Ze.zoneAbbr=function(){return this._isUTC?"UTC":""},Ze.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Ze.dates=s("dates accessor is deprecated. Use date instead.",Ie),Ze.months=s("months accessor is deprecated. Use month instead",Ft),Ze.years=s("years accessor is deprecated. Use year instead",Zt),Ze.zone=s("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()});var Xe=Ze;function ts(t){return t}var es=T.prototype;function ss(t,e,s,a){var i=j(),n=d().set(a,e);return i[s](n,t)}function as(t,e,s){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return ss(t,e,s,"month");var a,i=[];for(a=0;a<12;a++)i[a]=ss(t,a,s,"month");return i}function is(t,e,s,a){e=("boolean"==typeof t?"number"==typeof e&&(s=e,e=void 0):(e=t,t=!1,"number"==typeof(s=e)&&(s=e,e=void 0)),e||"");var i,n=j(),o=t?n._week.dow:0;if(null!=s)return ss(e,(s+o)%7,a,"day");var r=[];for(i=0;i<7;i++)r[i]=ss(e,(i+o)%7,a,"day");return r}es._calendar={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},es.calendar=function(t,e,s){var a=this._calendar[t];return A(a)?a.call(e,s):a},es._longDateFormat={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},es.longDateFormat=function(t){var e=this._longDateFormat[t],s=this._longDateFormat[t.toUpperCase()];return e||!s?e:(this._longDateFormat[t]=s.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])},es._invalidDate="Invalid date",es.invalidDate=function(){return this._invalidDate},es._ordinal="%d",es.ordinal=function(t){return this._ordinal.replace("%d",t)},es._ordinalParse=/\d{1,2}/,es.preparse=ts,es.postformat=ts,es._relativeTime={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},es.relativeTime=function(t,e,s,a){var i=this._relativeTime[s];return A(i)?i(t,e,s,a):i.replace(/%d/i,t)},es.pastFuture=function(t,e){var s=this._relativeTime[0<t?"future":"past"];return A(s)?s(e):s.replace(/%s/i,e)},es.set=function(t){var e,s;for(s in t)A(e=t[s])?this[s]=e:this["_"+s]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},es.months=function(t,e){return i(this._months)?this._months[t.month()]:this._months[Lt.test(e)?"format":"standalone"][t.month()]},es._months=Bt,es.monthsShort=function(t,e){return i(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Lt.test(e)?"format":"standalone"][t.month()]},es._monthsShort=It,es.monthsParse=function(t,e,s){var a,i,n;if(this._monthsParseExact)return function(t,e,s){var a,i,n,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],a=0;a<12;++a)n=d([2e3,a]),this._shortMonthsParse[a]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[a]=this.months(n,"").toLocaleLowerCase();return s?"MMM"===e?-1!==(i=xt.call(this._shortMonthsParse,o))?i:null:-1!==(i=xt.call(this._longMonthsParse,o))?i:null:"MMM"===e?-1!==(i=xt.call(this._shortMonthsParse,o))?i:-1!==(i=xt.call(this._longMonthsParse,o))?i:null:-1!==(i=xt.call(this._longMonthsParse,o))?i:-1!==(i=xt.call(this._shortMonthsParse,o))?i:null}.call(this,t,e,s);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),a=0;a<12;a++){if(i=d([2e3,a]),s&&!this._longMonthsParse[a]&&(this._longMonthsParse[a]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[a]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),s||this._monthsParse[a]||(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[a]=new RegExp(n.replace(".",""),"i")),s&&"MMMM"===e&&this._longMonthsParse[a].test(t))return a;if(s&&"MMM"===e&&this._shortMonthsParse[a].test(t))return a;if(!s&&this._monthsParse[a].test(t))return a}},es._monthsRegex=Rt,es.monthsRegex=function(t){return this._monthsParseExact?(h(this,"_monthsRegex")||zt.call(this),t?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex},es._monthsShortRegex=Yt,es.monthsShortRegex=function(t){return this._monthsParseExact?(h(this,"_monthsRegex")||zt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex},es.week=function(t){return ee(t,this._week.dow,this._week.doy).week},es._week={dow:0,doy:6},es.firstDayOfYear=function(){return this._week.doy},es.firstDayOfWeek=function(){return this._week.dow},es.weekdays=function(t,e){return i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]},es._weekdays=je,es.weekdaysMin=function(t){return this._weekdaysMin[t.day()]},es._weekdaysMin=Ye,es.weekdaysShort=function(t){return this._weekdaysShort[t.day()]},es._weekdaysShort=Fe,es.weekdaysParse=function(t,e,s){var a,i,n;if(this._weekdaysParseExact)return function(t,e,s){var a,i,n,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],a=0;a<7;++a)n=d([2e3,1]).day(a),this._minWeekdaysParse[a]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[a]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[a]=this.weekdays(n,"").toLocaleLowerCase();return s?"dddd"===e?-1!==(i=xt.call(this._weekdaysParse,o))?i:null:"ddd"===e?-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:null:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:"dddd"===e?-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:"ddd"===e?-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:null:-1!==(i=xt.call(this._minWeekdaysParse,o))?i:-1!==(i=xt.call(this._weekdaysParse,o))?i:-1!==(i=xt.call(this._shortWeekdaysParse,o))?i:null}.call(this,t,e,s);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),a=0;a<7;a++){if(i=d([2e3,1]).day(a),s&&!this._fullWeekdaysParse[a]&&(this._fullWeekdaysParse[a]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[a]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[a]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[a]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[a]=new RegExp(n.replace(".",""),"i")),s&&"dddd"===e&&this._fullWeekdaysParse[a].test(t))return a;if(s&&"ddd"===e&&this._shortWeekdaysParse[a].test(t))return a;if(s&&"dd"===e&&this._minWeekdaysParse[a].test(t))return a;if(!s&&this._weekdaysParse[a].test(t))return a}},es._weekdaysRegex=Re,es.weekdaysRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex},es._weekdaysShortRegex=ze,es.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex},es._weekdaysMinRegex=Qe,es.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||He.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex},es.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},es._meridiemParse=/[ap]\.?m?\.?/i,es.meridiem=function(t,e,s){return 11<t?s?"pm":"PM":s?"am":"AM"},B("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===w(t%100/10)?"th":1==e?"st":2==e?"nd":3==e?"rd":"th")}}),p.lang=s("moment.lang is deprecated. Use moment.locale instead.",B),p.langData=s("moment.langData is deprecated. Use moment.localeData instead.",j);var ns=Math.abs;function os(t,e,s,a){var i=xe(e,s);return t._milliseconds+=a*i._milliseconds,t._days+=a*i._days,t._months+=a*i._months,t._bubble()}function rs(t){return t<0?Math.floor(t):Math.ceil(t)}function ls(t){return 4800*t/146097}function cs(t){return 146097*t/4800}function ds(t){return function(){return this.as(t)}}var us=ds("ms"),ps=ds("s"),hs=ds("m"),ms=ds("h"),fs=ds("d"),gs=ds("w"),vs=ds("M"),bs=ds("y");function ys(t){return function(){return this._data[t]}}var ws=ys("milliseconds"),ks=ys("seconds"),xs=ys("minutes"),Cs=ys("hours"),_s=ys("days"),Ps=ys("months"),As=ys("years");var Ms=Math.round,Ds={s:45,m:45,h:22,d:26,M:11};function Ts(t,e,s){var a=xe(t).abs(),i=Ms(a.as("s")),n=Ms(a.as("m")),o=Ms(a.as("h")),r=Ms(a.as("d")),l=Ms(a.as("M")),c=Ms(a.as("y")),d=i<Ds.s&&["s",i]||n<=1&&["m"]||n<Ds.m&&["mm",n]||o<=1&&["h"]||o<Ds.h&&["hh",o]||r<=1&&["d"]||r<Ds.d&&["dd",r]||l<=1&&["M"]||l<Ds.M&&["MM",l]||c<=1&&["y"]||["yy",c];return d[2]=e,d[3]=0<+t,d[4]=s,function(t,e,s,a,i){return i.relativeTime(e||1,!!s,t,a)}.apply(null,d)}var Ss=Math.abs;function Es(){var t,e,s=Ss(this._milliseconds)/1e3,a=Ss(this._days),i=Ss(this._months);t=y(s/60),e=y(t/60),s%=60,t%=60;var n=y(i/12),o=i%=12,r=a,l=e,c=t,d=s,u=this.asSeconds();return u?(u<0?"-":"")+"P"+(n?n+"Y":"")+(o?o+"M":"")+(r?r+"D":"")+(l||c||d?"T":"")+(l?l+"H":"")+(c?c+"M":"")+(d?d+"S":""):"P0D"}var Os=pe.prototype;return Os.abs=function(){var t=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),t.milliseconds=ns(t.milliseconds),t.seconds=ns(t.seconds),t.minutes=ns(t.minutes),t.hours=ns(t.hours),t.months=ns(t.months),t.years=ns(t.years),this},Os.add=function(t,e){return os(this,t,e,1)},Os.subtract=function(t,e){return os(this,t,e,-1)},Os.as=function(t){var e,s,a=this._milliseconds;if("month"===(t=R(t))||"year"===t)return e=this._days+a/864e5,s=this._months+ls(e),"month"===t?s:s/12;switch(e=this._days+Math.round(cs(this._months)),t){case"week":return e/7+a/6048e5;case"day":return e+a/864e5;case"hour":return 24*e+a/36e5;case"minute":return 1440*e+a/6e4;case"second":return 86400*e+a/1e3;case"millisecond":return Math.floor(864e5*e)+a;default:throw new Error("Unknown unit "+t)}},Os.asMilliseconds=us,Os.asSeconds=ps,Os.asMinutes=hs,Os.asHours=ms,Os.asDays=fs,Os.asWeeks=gs,Os.asMonths=vs,Os.asYears=bs,Os.valueOf=function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12)},Os._bubble=function(){var t,e,s,a,i,n=this._milliseconds,o=this._days,r=this._months,l=this._data;return 0<=n&&0<=o&&0<=r||n<=0&&o<=0&&r<=0||(n+=864e5*rs(cs(r)+o),r=o=0),l.milliseconds=n%1e3,t=y(n/1e3),l.seconds=t%60,e=y(t/60),l.minutes=e%60,s=y(e/60),l.hours=s%24,o+=y(s/24),r+=i=y(ls(o)),o-=rs(cs(i)),a=y(r/12),r%=12,l.days=o,l.months=r,l.years=a,this},Os.get=function(t){return this[(t=R(t))+"s"]()},Os.milliseconds=ws,Os.seconds=ks,Os.minutes=xs,Os.hours=Cs,Os.days=_s,Os.weeks=function(){return y(this.days()/7)},Os.months=Ps,Os.years=As,Os.humanize=function(t){var e=this.localeData(),s=Ts(this,!t,e);return t&&(s=e.pastFuture(+this,s)),e.postformat(s)},Os.toISOString=Es,Os.toString=Es,Os.toJSON=Es,Os.locale=Se,Os.localeData=Oe,Os.toIsoString=s("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Es),Os.lang=Ee,W("X",0,0,"unix"),W("x",0,0,"valueOf"),gt("x",ut),gt("X",/[+-]?\d+(\.\d{1,3})?/),wt("X",function(t,e,s){s._d=new Date(1e3*parseFloat(t,10))}),wt("x",function(t,e,s){s._d=new Date(w(t))}),p.version="2.13.0",t=le,p.fn=Xe,p.min=function(){return ue("isBefore",[].slice.call(arguments,0))},p.max=function(){return ue("isAfter",[].slice.call(arguments,0))},p.now=function(){return Date.now?Date.now():+new Date},p.utc=d,p.unix=function(t){return le(1e3*t)},p.months=function(t,e){return as(t,e,"months")},p.isDate=n,p.locale=B,p.invalid=c,p.duration=xe,p.isMoment=b,p.weekdays=function(t,e,s){return is(t,e,s,"weekdays")},p.parseZone=function(){return le.apply(null,arguments).parseZone()},p.localeData=j,p.isDuration=he,p.monthsShort=function(t,e){return as(t,e,"monthsShort")},p.weekdaysMin=function(t,e,s){return is(t,e,s,"weekdaysMin")},p.defineLocale=I,p.updateLocale=function(t,e){var s;return null!=e?(null!=E[t]&&(e=D(E[t]._config,e)),(s=new T(e)).parentLocale=E[t],E[t]=s,B(t)):null!=E[t]&&(null!=E[t].parentLocale?E[t]=E[t].parentLocale:null!=E[t]&&delete E[t]),E[t]},p.locales=function(){return C(E)},p.weekdaysShort=function(t,e,s){return is(t,e,s,"weekdaysShort")},p.normalizeUnits=R,p.relativeTimeThreshold=function(t,e){return void 0!==Ds[t]&&(void 0===e?Ds[t]:(Ds[t]=e,!0))},p.prototype=Xe,p}),(typeof define==="function"&&define.amd?define:function(t,e){if(typeof module!=="undefined"&&module.exports){module.exports=e(require("jquery"))}else{window.toastr=e(window.jQuery)}})(["jquery"],function(g){return C=0,n="error",o="info",r="success",l="warning",t={clear:function(t,e){var s=y();k||v(s);a(t,s,e)||function(t){for(var e=k.children(),s=e.length-1;0<=s;s--)a(g(e[s]),t)}(s)},remove:function(t){var e=y();k||v(e);if(t&&0===g(":focus",t).length)return void w(t);k.children().length&&k.remove()},error:function(t,e,s){return i({type:n,iconClass:y().iconClasses.error,message:t,optionsOverride:s,title:e})},getContainer:v,info:function(t,e,s){return i({type:o,iconClass:y().iconClasses.info,message:t,optionsOverride:s,title:e})},options:{},subscribe:function(t){e=t},success:function(t,e,s){return i({type:r,iconClass:y().iconClasses.success,message:t,optionsOverride:s,title:e})},version:"2.1.3",warning:function(t,e,s){return i({type:l,iconClass:y().iconClasses.warning,message:t,optionsOverride:s,title:e})}};function v(t,e){return t=t||y(),(k=g("#"+t.containerId)).length||e&&(k=function(t){return(k=g("<div/>").attr("id",t.containerId).addClass(t.positionClass)).appendTo(g(t.target)),k}(t)),k}function a(t,e,s){var a=!(!s||!s.force)&&s.force;return!(!t||!a&&0!==g(":focus",t).length)&&(t[e.hideMethod]({duration:e.hideDuration,easing:e.hideEasing,complete:function(){w(t)}}),!0)}function b(t){e&&e(t)}function i(e){var i=y(),t=e.iconClass||i.iconClass;if(void 0!==e.optionsOverride&&(i=g.extend(i,e.optionsOverride),t=e.optionsOverride.iconClass||t),!function(t,e){if(t.preventDuplicates){if(e.message===x)return!0;x=e.message}return!1}(i,e)){C++,k=v(i,!0);var n=null,o=g("<div/>"),s=g("<div/>"),a=g("<div/>"),r=g("<div/>"),l=g(i.closeHtml),c={intervalId:null,hideEta:null,maxHideTime:null},d={toastId:C,state:"visible",startTime:new Date,options:i,map:e};return e.iconClass&&o.addClass(i.toastClass).addClass(t),function(){if(e.title){var t=e.title;i.escapeHtml&&(t=u(e.title)),s.append(t).addClass(i.titleClass),o.append(s)}}(),function(){if(e.message){var t=e.message;i.escapeHtml&&(t=u(e.message)),a.append(t).addClass(i.messageClass),o.append(a)}}(),i.closeButton&&(l.addClass(i.closeClass).attr("role","button"),o.prepend(l)),i.progressBar&&(r.addClass(i.progressClass),o.prepend(r)),i.rtl&&o.addClass("rtl"),i.newestOnTop?k.prepend(o):k.append(o),function(){var t="";switch(e.iconClass){case"toast-success":case"toast-info":t="polite";break;default:t="assertive"}o.attr("aria-live",t)}(),o.hide(),o[i.showMethod]({duration:i.showDuration,easing:i.showEasing,complete:i.onShown}),0<i.timeOut&&(n=setTimeout(p,i.timeOut),c.maxHideTime=parseFloat(i.timeOut),c.hideEta=(new Date).getTime()+c.maxHideTime,i.progressBar&&(c.intervalId=setInterval(f,10))),function(){i.closeOnHover&&o.hover(m,h);!i.onclick&&i.tapToDismiss&&o.click(p);i.closeButton&&l&&l.click(function(t){t.stopPropagation?t.stopPropagation():void 0!==t.cancelBubble&&!0!==t.cancelBubble&&(t.cancelBubble=!0),i.onCloseClick&&i.onCloseClick(t),p(!0)});i.onclick&&o.click(function(t){i.onclick(t),p()})}(),b(d),i.debug&&console&&console.log(d),o}function u(t){return null==t&&(t=""),t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function p(t){var e=t&&!1!==i.closeMethod?i.closeMethod:i.hideMethod,s=t&&!1!==i.closeDuration?i.closeDuration:i.hideDuration,a=t&&!1!==i.closeEasing?i.closeEasing:i.hideEasing;if(!g(":focus",o).length||t)return clearTimeout(c.intervalId),o[e]({duration:s,easing:a,complete:function(){w(o),clearTimeout(n),i.onHidden&&"hidden"!==d.state&&i.onHidden(),d.state="hidden",d.endTime=new Date,b(d)}})}function h(){(0<i.timeOut||0<i.extendedTimeOut)&&(n=setTimeout(p,i.extendedTimeOut),c.maxHideTime=parseFloat(i.extendedTimeOut),c.hideEta=(new Date).getTime()+c.maxHideTime)}function m(){clearTimeout(n),c.hideEta=0,o.stop(!0,!0)[i.showMethod]({duration:i.showDuration,easing:i.showEasing})}function f(){var t=(c.hideEta-(new Date).getTime())/c.maxHideTime*100;r.width(t+"%")}}function y(){return g.extend({},{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">×</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1},t.options)}function w(t){k=k||v(),t.is(":visible")||(t.remove(),t=null,0===k.children().length&&(k.remove(),x=void 0))}var k,e,x,C,n,o,r,l,t}),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(b){"use strict";var y=b.scrollTo=function(t,e,s){return b(window).scrollTo(t,e,s)};function w(t){return!t.nodeName||-1!==b.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function e(t){return b.isFunction(t)||b.isPlainObject(t)?t:{top:t,left:t}}return y.defaults={axis:"xy",duration:0,limit:!0},b.fn.scrollTo=function(t,s,g){"object"==typeof s&&(g=s,s=0),"function"==typeof g&&(g={onAfter:g}),"max"===t&&(t=9e9),g=b.extend({},y.defaults,g),s=s||g.duration;var v=g.queue&&1<g.axis.length;return v&&(s/=2),g.offset=e(g.offset),g.over=e(g.over),this.each(function(){if(null!==t){var l,c=w(this),d=c?this.contentWindow||window:this,u=b(d),p=t,h={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=e(p);break}p=c?b(p):b(p,d);case"object":if(0===p.length)return;(p.is||p.style)&&(l=(p=b(p)).offset())}var m=b.isFunction(g.offset)&&g.offset(d,p)||g.offset;b.each(g.axis.split(""),function(t,e){var s="x"===e?"Left":"Top",a=s.toLowerCase(),i="scroll"+s,n=u[i](),o=y.max(d,e);if(l)h[i]=l[a]+(c?0:n-u.offset()[a]),g.margin&&(h[i]-=parseInt(p.css("margin"+s),10)||0,h[i]-=parseInt(p.css("border"+s+"Width"),10)||0),h[i]+=m[a]||0,g.over[a]&&(h[i]+=p["x"===e?"width":"height"]()*g.over[a]);else{var r=p[a];h[i]=r.slice&&"%"===r.slice(-1)?parseFloat(r)/100*o:r}g.limit&&/^\d+$/.test(h[i])&&(h[i]=h[i]<=0?0:Math.min(h[i],o)),!t&&1<g.axis.length&&(n===h[i]?h={}:v&&(f(g.onAfterFirst),h={}))}),f(g.onAfter)}function f(t){var e=b.extend({},g,{queue:!0,duration:s,complete:t&&function(){t.call(d,p,g)}});u.animate(h,e)}})},y.max=function(t,e){var s="x"===e?"Width":"Height",a="scroll"+s;if(!w(t))return t[a]-b(t)[s.toLowerCase()]();var i="client"+s,n=t.ownerDocument||t.document,o=n.documentElement,r=n.body;return Math.max(o[a],r[a])-Math.min(o[i],r[i])},b.Tween.propHooks.scrollLeft=b.Tween.propHooks.scrollTop={get:function(t){return b(t.elem)[t.prop]()},set:function(t){var e=this.get(t);if(t.options.interrupt&&t._last&&t._last!==e)return b(t.elem).stop();var s=Math.round(t.now);e!==s&&(b(t.elem)[t.prop](s),t._last=this.get(t))}},y}),function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.striptags=e()}(this,function(){var p=/\s/,h=/<(\w*)>/g;return function(t,n){t=t||"";var e,s,a,i=0,o=0,r="",l="",c=!1;for("string"==typeof n?n=function(t){var e,s=[];for(;null!==(e=h.exec(t));)s.push(e[1]);return 0!==s.length?s:null}(n):Array.isArray(n)||(n=null),e=0,s=t.length;e<s;e++)switch(a=t[e]){case"<":if(c)break;if(" "==t[e+1]){d(a);break}if(0==i){i=1,d(a);break}if(1==i){o++;break}d(a);break;case">":if(o){o--;break}if(c)break;if(1==i){c=i=0,n&&(l+=">",u());break}if(2==i){c=i=0,l="";break}if(3==i&&"-"==t[e-1]&&"-"==t[e-2]){c=i=0,l="";break}d(a);break;case'"':case"'":1==i&&(c=c!=a&&(c||a)),d(a);break;case"!":if(1==i&&"<"==t[e-1]){i=2;break}d(a);break;case"-":if(2==i&&"-"==t[e-1]&&"!"==t[e-2]){i=3;break}d(a);break;case"E":case"e":if(2==i&&"doctype"==t.substr(e-6,7).toLowerCase()){i=1;break}d(a);break;default:d(a)}function d(t){0==i?r+=t:n&&1==i&&(l+=t)}function u(){var t,e,s,a="",i=!1;t:for(t=0,e=l.length;t<e;t++)switch(s=l[t].toLowerCase()){case"<":break;case">":break t;case"/":i=!0;break;default:if(s.match(p)){if(i)break t}else i=!0,a+=s}-1!==n.indexOf(a)&&(r+=l),l=""}return r}}),function(t){"use strict";function e(t){if("#"!=t.charAt(1))return i[t]||t;var e,s=t.charAt(2);return e="x"==s||"X"==s?(s=t.substring(3,t.length-1),parseInt(s,16)):(s=t.substring(2,t.length-1),parseInt(s)),isNaN(e)?t:String.fromCharCode(e)}function s(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function a(t){return t.replace(/&#?\w+;/g,e)}var i={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ",""":'"',"&":"&","<":"<",">":">","'":"'","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ˆ":"ˆ","˜":"˜"," ":" "," ":" "," ":" ","‌":"","‍":"","‎":"","‏":"","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","‰":"‰","‹":"‹","›":"›","€":"€","ƒ":"ƒ","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ","•":"•","…":"…","′":"′","″":"″","‾":"‾","⁄":"⁄","℘":"℘","ℑ":"ℑ","ℜ":"ℜ","™":"™","ℵ":"ℵ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"};"undefined"!=typeof module?((s.htmlEncode=s).htmlDecode=a,module.exports=s):t&&(t.htmlEncode=s,t.htmlDecode=a)}(this),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Clipboard=t()}}(function(){return function n(o,r,l){function c(s,t){if(!r[s]){if(!o[s]){var e="function"==typeof require&&require;if(!t&&e)return e(s,!0);if(d)return d(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var i=r[s]={exports:{}};o[s][0].call(i.exports,function(t){var e=o[s][1][t];return c(e||t)},i,i.exports,n,o,r,l)}return r[s].exports}for(var d="function"==typeof require&&require,t=0;t<l.length;t++)c(l[t]);return c}({1:[function(t,e,s){var i=t("matches-selector");e.exports=function(t,e,s){for(var a=s?t:t.parentNode;a&&a!==document;){if(i(a,e))return a;a=a.parentNode}}},{"matches-selector":5}],2:[function(t,e,s){var o=t("closest");e.exports=function(t,e,s,a,i){var n=function(e,s,t,a){return function(t){t.delegateTarget=o(t.target,s,!0),t.delegateTarget&&a.call(e,t)}}.apply(this,arguments);return t.addEventListener(s,n,i),{destroy:function(){t.removeEventListener(s,n,i)}}}},{closest:1}],3:[function(t,e,s){s.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},s.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||s.node(t[0]))},s.string=function(t){return"string"==typeof t||t instanceof String},s.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},{}],4:[function(t,e,s){var a=t("./is"),i=t("delegate");e.exports=function(t,e,s){if(!t&&!e&&!s)throw new Error("Missing required arguments");if(!a.string(e))throw new TypeError("Second argument must be a String");if(!a.fn(s))throw new TypeError("Third argument must be a Function");if(a.node(t))return function(t,e,s){return t.addEventListener(e,s),{destroy:function(){t.removeEventListener(e,s)}}}(t,e,s);if(a.nodeList(t))return function(t,e,s){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,s)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,s)})}}}(t,e,s);if(a.string(t))return function(t,e,s){return i(document.body,t,e,s)}(t,e,s);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},{"./is":3,delegate:2}],5:[function(t,e,s){var a=Element.prototype,i=a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector;e.exports=function(t,e){if(i)return i.call(t,e);for(var s=t.parentNode.querySelectorAll(e),a=0;a<s.length;++a)if(s[a]==t)return!0;return!1}},{}],6:[function(t,e,s){e.exports=function(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var s=window.getSelection(),a=document.createRange();a.selectNodeContents(t),s.removeAllRanges(),s.addRange(a),e=s.toString()}return e}},{}],7:[function(t,e,s){function a(){}a.prototype={on:function(t,e,s){var a=this.e||(this.e={});return(a[t]||(a[t]=[])).push({fn:e,ctx:s}),this},once:function(t,e,s){var a=this;function i(){a.off(t,i),e.apply(s,arguments)}return i._=e,this.on(t,i,s)},emit:function(t){for(var e=[].slice.call(arguments,1),s=((this.e||(this.e={}))[t]||[]).slice(),a=0,i=s.length;a<i;a++)s[a].fn.apply(s[a].ctx,e);return this},off:function(t,e){var s=this.e||(this.e={}),a=s[t],i=[];if(a&&e)for(var n=0,o=a.length;n<o;n++)a[n].fn!==e&&a[n].fn._!==e&&i.push(a[n]);return i.length?s[t]=i:delete s[t],this}},e.exports=a},{}],8:[function(a,i,n){!function(t,e){if(0,void 0!==n)e(i,a("select"));else{var s={exports:{}};e(s,t.select),t.clipboardAction=s.exports}}(this,function(t,e){"use strict";var s,a=(s=e)&&s.__esModule?s:{default:s};var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var n=function(t,e,s){return e&&o(t.prototype,e),s&&o(t,s),t};function o(t,e){for(var s=0;s<e.length;s++){var a=e[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var r=(l.prototype.resolveOptions=function(t){var e=arguments.length<=0||void 0===t?{}:t;this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},l.prototype.initSelection=function(){this.text?this.selectFake():this.target&&this.selectTarget()},l.prototype.selectFake=function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()},l.prototype.removeFake=function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},l.prototype.selectTarget=function(){this.selectedText=(0,a.default)(this.target),this.copyText()},l.prototype.copyText=function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)},l.prototype.handleResult=function(t){t?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},l.prototype.clearSelection=function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},l.prototype.destroy=function(){this.removeFake()},n(l,[{key:"action",set:function(t){var e=arguments.length<=0||void 0===t?"copy":t;if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":i(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),this.resolveOptions(t),this.initSelection()}t.exports=r})},{select:6}],9:[function(a,i,n){!function(t,e){if(0,void 0!==n)e(i,a("./clipboard-action"),a("tiny-emitter"),a("good-listener"));else{var s={exports:{}};e(s,t.clipboardAction,t.tinyEmitter,t.goodListener),t.clipboard=s.exports}}(this,function(t,e,s,a){"use strict";var i=r(e),n=r(s),o=r(a);function r(t){return t&&t.__esModule?t:{default:t}}var l,c=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,l=n.default),d.prototype.resolveOptions=function(t){var e=arguments.length<=0||void 0===t?{}:t;this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},d.prototype.listenClick=function(t){var e=this;this.listener=(0,o.default)(t,"click",function(t){return e.onClick(t)})},d.prototype.onClick=function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new i.default({action:this.action(e),target:this.target(e),text:this.text(e),trigger:e,emitter:this})},d.prototype.defaultAction=function(t){return u("action",t)},d.prototype.defaultTarget=function(t){var e=u("target",t);if(e)return document.querySelector(e)},d.prototype.defaultText=function(t){return u("text",t)},d.prototype.destroy=function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},d);function d(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,l.call(this));return s.resolveOptions(e),s.listenClick(t),s}function u(t,e){var s="data-clipboard-"+t;if(e.hasAttribute(s))return e.getAttribute(s)}t.exports=c})},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)}),function(t,e){"function"==typeof define&&define.amd?define(["jquery"],e):e(t.jQuery)}(this,function(t){var e,s,a,p,n,o,h,m,f,g,v,b,i,r,y;function w(t,e){return i.call(t,e)}function l(t,e){var s,a,i,n,o,r,l,c,d,u,p,h=e&&e.split("/"),m=v.map,f=m&&m["*"]||{};if(t&&"."===t.charAt(0))if(e){for(h=h.slice(0,h.length-1),o=(t=t.split("/")).length-1,v.nodeIdCompat&&y.test(t[o])&&(t[o]=t[o].replace(y,"")),t=h.concat(t),d=0;d<t.length;d+=1)if("."===(p=t[d]))t.splice(d,1),d-=1;else if(".."===p){if(1===d&&(".."===t[2]||".."===t[0]))break;0<d&&(t.splice(d-1,2),d-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((h||f)&&m){for(d=(s=t.split("/")).length;0<d;d-=1){if(a=s.slice(0,d).join("/"),h)for(u=h.length;0<u;u-=1)if(i=(i=m[h.slice(0,u).join("/")])&&i[a]){n=i,r=d;break}if(n)break;!l&&f&&f[a]&&(l=f[a],c=d)}!n&&l&&(n=l,r=c),n&&(s.splice(0,r,n),t=s.join("/"))}return t}function k(t,e){return function(){return o.apply(p,r.call(arguments,0).concat([t,e]))}}function x(e){return function(t){f[e]=t}}function C(t){if(w(g,t)){var e=g[t];delete g[t],b[t]=!0,n.apply(p,e)}if(!w(f,t)&&!w(b,t))throw new Error("No "+t);return f[t]}function c(t){var e,s=t?t.indexOf("!"):-1;return-1<s&&(e=t.substring(0,s),t=t.substring(s+1,t.length)),[e,t]}f={},g={},v={},b={},i=Object.prototype.hasOwnProperty,r=[].slice,y=/\.js$/,h=function(t,e){var s,a=c(t),i=a[0];return t=a[1],i&&(s=C(i=l(i,e))),i?t=s&&s.normalize?s.normalize(t,function(e){return function(t){return l(t,e)}}(e)):l(t,e):(i=(a=c(t=l(t,e)))[0],t=a[1],i&&(s=C(i))),{f:i?i+"!"+t:t,n:t,pr:i,p:s}},m={require:function(t){return k(t)},exports:function(t){var e=f[t];return void 0!==e?e:f[t]={}},module:function(t){return{id:t,uri:"",exports:f[t],config:function(t){return function(){return v&&v.config&&v.config[t]||{}}}(t)}}},n=function(t,e,s,a){var i,n,o,r,l,c,d=[],u=typeof s;if(a=a||t,"undefined"==u||"function"==u){for(e=!e.length&&s.length?["require","exports","module"]:e,l=0;l<e.length;l+=1)if("require"===(n=(r=h(e[l],a)).f))d[l]=m.require(t);else if("exports"===n)d[l]=m.exports(t),c=!0;else if("module"===n)i=d[l]=m.module(t);else if(w(f,n)||w(g,n)||w(b,n))d[l]=C(n);else{if(!r.p)throw new Error(t+" missing "+n);r.p.load(r.n,k(a,!0),x(n),{}),d[l]=f[n]}o=s?s.apply(f[t],d):void 0,t&&(i&&i.exports!==p&&i.exports!==f[t]?f[t]=i.exports:o===p&&c||(f[t]=o))}else t&&(f[t]=s)},e=s=o=function(t,e,s,a,i){if("string"==typeof t)return m[t]?m[t](e):C(h(t,e).f);if(!t.splice){if((v=t).deps&&o(v.deps,v.callback),!e)return;e.splice?(t=e,e=s,s=null):t=p}return e=e||function(){},"function"==typeof s&&(s=a,a=i),a?n(p,t,e,s):setTimeout(function(){n(p,t,e,s)},4),o},o.config=function(t){return o(t)},e._defined=f,(a=function(t,e,s){e.splice||(s=e,e=[]),w(f,t)||w(g,t)||(g[t]=[t,e,s])}).amd={jQuery:!0},a("almond",function(){}),a("visualcaptcha/core",[],function(){"use strict";var i,s,a,n,o,r,l,c;return i=function(t,e,s){return s=s||[],t.namespace&&0<t.namespace.length&&s.push(t.namespaceFieldName+"="+t.namespace),s.push(t.randomParam+"="+t.randomNonce),e+"&"+s.join("&")},s=function(e){var t,s=this;e.applyRandomNonce(),e.isLoading=!0,t=a(e),e._loading(s),e.callbacks.loading&&e.callbacks.loading(s),e.request(t,function(t){t.audioFieldName&&(e.audioFieldName=t.audioFieldName),t.imageFieldName&&(e.imageFieldName=t.imageFieldName),t.imageName&&(e.imageName=t.imageName),t.values&&(e.imageValues=t.values),e.isLoading=!1,e.hasLoaded=!0,e._loaded(s),e.callbacks.loaded&&e.callbacks.loaded(s)})},a=function(t){var e=t.url+t.routes.start+"&_img="+t.numberOfImages;return i(t,e)},n=function(t,e){var s="",a=[];return e<0||e>=t.numberOfImages?s:(this.isRetina()&&a.push("retina=1"),s=t.url+t.routes.image+"&_id="+e,i(t,s,a))},o=function(t,e){var s=t.url+t.routes.audio;return e&&(s+="/ogg"),i(t,s)},r=function(t,e){return 0<=e&&e<t.numberOfImages?t.imageValues[e]:""},l=function(){return void 0!==window.devicePixelRatio&&1<window.devicePixelRatio},c=function(){var t=!1;try{document.createElement("audio").canPlayType&&(t=!0)}catch(t){}return t},function(e){var t;return t={refresh:function(){return s.call(this,e)},isLoading:function(){return e.isLoading},hasLoaded:function(){return e.hasLoaded},numberOfImages:function(){return e.imageValues.length},imageName:function(){return e.imageName},imageValue:function(t){return r.call(this,e,t)},imageUrl:function(t){return n.call(this,e,t)},audioUrl:function(t){return o.call(this,e,t)},imageFieldName:function(){return e.imageFieldName},audioFieldName:function(){return e.audioFieldName},namespace:function(){return e.namespace},namespaceFieldName:function(){return e.namespaceFieldName},isRetina:l,supportsAudio:c},e.autoRefresh&&t.refresh(),t}}),a("visualcaptcha/xhr-request",[],function(){"use strict";var a=window.XMLHttpRequest;return function(t,e){var s=new a;s.open("GET",t,!0),s.onreadystatechange=function(){var t;4===s.readyState&&200===s.status&&(t=JSON.parse(s.responseText),e(t))},s.send()}}),a("visualcaptcha/config",["visualcaptcha/xhr-request"],function(a){"use strict";return function(t){var e=window.location.href.split("/");e[e.length-1]="";var s={request:a,url:e.join("/").slice(0,-1),namespace:"",namespaceFieldName:"namespace",routes:{start:"/start",image:"/image",audio:"/audio"},isLoading:!1,hasLoaded:!1,autoRefresh:!0,numberOfImages:6,randomNonce:"",randomParam:"r",audioFieldName:"",imageFieldName:"",imageName:"",imageValues:[],callbacks:{},_loading:function(){},_loaded:function(){},applyRandomNonce:function(){return s.randomNonce=Math.random().toString(36).substring(2)}};return t.request&&(s.request=t.request),t.url&&(s.url=t.url),t.namespace&&(s.namespace=t.namespace),t.namespaceFieldName&&(s.namespaceFieldName=t.namespaceFieldName),void 0!==t.autoRefresh&&(s.autoRefresh=t.autoRefresh),t.numberOfImages&&(s.numberOfImages=t.numberOfImages),t.routes&&(t.routes.start&&(s.routes.start=t.routes.start),t.routes.image&&(s.routes.image=t.routes.image),t.routes.audio&&(s.routes.audio=t.routes.audio)),t.randomParam&&(s.randomParam=t.randomParam),t.callbacks&&(t.callbacks.loading&&(s.callbacks.loading=t.callbacks.loading),t.callbacks.loaded&&(s.callbacks.loaded=t.callbacks.loaded)),t._loading&&(s._loading=t._loading),t._loaded&&(s._loaded=t._loaded),s}}),a("visualcaptcha",["require","visualcaptcha/core","visualcaptcha/config"],function(t){"use strict";var e=t("visualcaptcha/core"),s=t("visualcaptcha/config");return function(t){return e(s(t=t||{}))}}),a("visualcaptcha/templates",[],function(){"use strict";var r;return r=function(t,e){for(var s in e)t=t.replace(new RegExp("{"+s+"}","g"),e[s]);return t},{buttons:function(t,e,s){var a,i;return'<div class="visualCaptcha-accessibility-button"><a href="#"><img src="{path}accessibility{retinaExtra}.png" title="{accessibilityTitle}" alt="{accessibilityAlt}" /></a></div>','<div class="visualCaptcha-refresh-button"><a href="#"><img src="{path}refresh{retinaExtra}.png" title="{refreshTitle}" alt="{refreshAlt}" /></a></div>',a='<div class="visualCaptcha-button-group"><div class="visualCaptcha-refresh-button"><a href="#"><img src="{path}refresh{retinaExtra}.png" title="{refreshTitle}" alt="{refreshAlt}" /></a></div>'+(t.supportsAudio()?'<div class="visualCaptcha-accessibility-button"><a href="#"><img src="{path}accessibility{retinaExtra}.png" title="{accessibilityTitle}" alt="{accessibilityAlt}" /></a></div>':"")+"</div>",i={path:s||"",refreshTitle:e.refreshTitle,refreshAlt:e.refreshAlt,accessibilityTitle:e.accessibilityTitle,accessibilityAlt:e.accessibilityAlt,retinaExtra:t.isRetina()?"@2x":""},r(a,i)},accessibility:function(t,e){var s;return t.supportsAudio()?('<div class="visualCaptcha-accessibility-wrapper visualCaptcha-hide"><div class="accessibility-description">{accessibilityDescription}</div><audio preload="preload"><source src="{audioURL}" type="audio/ogg" /><source src="{audioURL}" type="audio/mpeg" /></audio></div>',s={accessibilityDescription:e.accessibilityDescription,audioURL:t.audioUrl(),audioFieldName:t.audioFieldName()},r('<div class="visualCaptcha-accessibility-wrapper visualCaptcha-hide"><div class="accessibility-description">{accessibilityDescription}</div><audio preload="preload"><source src="{audioURL}" type="audio/ogg" /><source src="{audioURL}" type="audio/mpeg" /></audio></div>',s)):""},images:function(t,e){for(var s,a,i="",n=0,o=t.numberOfImages();n<o;n++)s='<div class="img"><a href="#"><img src="{imageUrl}" id="visualCaptcha-img-{i}" data-index="{i}" alt="" title="" /></a></div>',a={imageUrl:t.imageUrl(n),i:n},i+=r(s,a);return s='<p class="visualCaptcha-explanation">{explanation}</p><div class="visualCaptcha-possibilities">{images}</div>',a={imageFieldName:t.imageFieldName(),explanation:e.explanation.replace(/ANSWER/,t.imageName()),images:i},r(s,a)},audioInput:function(t){var e;return'<input class="form-control audioField" type="text" name="{audioFieldName}" value="" autocomplete="off" />',e={audioFieldName:t.audioFieldName()},r('<input class="form-control audioField" type="text" name="{audioFieldName}" value="" autocomplete="off" />',e)},imageInput:function(t,e){var s;return'<input class="form-control imageField" type="hidden" name="{imageFieldName}" value="{value}" readonly="readonly" />',s={imageFieldName:t.imageFieldName(),value:t.imageValue(e)},r('<input class="form-control imageField" type="hidden" name="{imageFieldName}" value="{value}" readonly="readonly" />',s)},namespaceInput:function(t){var e,s=t.namespace();return s&&0!==s.length?('<input type="hidden" name="{fieldName}" value="{value}" />',e={fieldName:t.namespaceFieldName(),value:s},r('<input type="hidden" name="{fieldName}" value="{value}" />',e)):""}}}),a("visualcaptcha/language",[],function(){"use strict";return{accessibilityAlt:"Sound icon",accessibilityTitle:"Accessibility option: listen to a question and answer it!",accessibilityDescription:"Type below the <strong>answer</strong> to what you hear. Numbers or words:",explanation:"Click or touch the <strong>ANSWER</strong>",refreshAlt:"Refresh/reload icon",refreshTitle:"Refresh/reload: get new images and accessibility option!"}}),a("visualcaptcha.jquery",["jquery","visualcaptcha","visualcaptcha/templates","visualcaptcha/language"],function(l,i,c,e){"use strict";var s,n,o,r,d,u,p;s=function(t,e){l.get(t,e,"json")},n=function(){},o=function(t,e,s){var a;a=c.namespaceInput(s)+c.accessibility(s,t.language)+c.images(s,t.language)+c.buttons(s,t.language,t.imgPath),e.html(a)},r=function(t){var e,s=l(this).closest(".visualCaptcha"),a=s.find(".visualCaptcha-accessibility-wrapper"),i=s.find(".visualCaptcha-possibilities"),n=s.find(".visualCaptcha-explanation"),o=a.find("audio");a.hasClass("visualCaptcha-hide")?(i.toggleClass("visualCaptcha-hide"),n.toggleClass("visualCaptcha-hide"),i.find(".img").removeClass("visualCaptcha-selected"),n.find("input").val(""),e=c.audioInput(s.data("captcha")),l(e).insertBefore(o),a.toggleClass("visualCaptcha-hide"),o[0].load(),o[0].play()):(o[0].pause(),a.toggleClass("visualCaptcha-hide"),a.find("input").remove(),n.toggleClass("visualCaptcha-hide"),i.toggleClass("visualCaptcha-hide")),t.preventDefault()},d=function(t){var e,s,a,i=l(this),n=i.closest(".visualCaptcha"),o=n.find(".visualCaptcha-possibilities"),r=n.find(".visualCaptcha-explanation");(s=r.find("input"))&&(s.remove(),o.find("a").removeClass("visualCaptcha-selected")),i.addClass("visualCaptcha-selected"),e=i.find("img").data("index"),a=c.imageInput(n.data("captcha"),e),r.append(l(a)),t.preventDefault()},u=function(t){l(this).closest(".visualCaptcha").data("captcha").refresh(),t.preventDefault()},p=function(t){var e=t.find(".imageField"),s=t.find(".audioField"),a=!(!e.val()&&!s.val());return a?{valid:a,name:e.val()?e.attr("name"):s.attr("name"),value:e.val()?e.val():s.val()}:{valid:a}},l.fn.visualCaptcha=function(t){var a;return a=l.extend({imgPath:"/",language:e,captcha:{request:s}},t),this.addClass("visualCaptcha").on("click",".visualCaptcha-accessibility-button",r).on("click",".visualCaptcha-refresh-button",u).on("click",".visualCaptcha-possibilities a",d),this.each(function(){var t,e,s=l(this);e=l.extend(a.captcha,{_loading:n.bind(null,a,s),_loaded:o.bind(null,a,s)}),void 0!==s.data("namespace")&&(e.namespace=s.data("namespace")),(t=i(e)).getCaptchaData=p.bind(null,s),s.data("captcha",t)})}}),a("jquery",function(){return t}),s("visualcaptcha.jquery")}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)}(function(r,o){var a={color:"rgba(255, 255, 255, 0.8)",custom:"",fade:!0,fontawesome:"",image:"data:image/gif;base64,R0lGODlhZABkAKUAADQyNJyanGRmZMzOzExOTLS2tISChOzq7ERCRKyqrHR2dNze3FxaXMTCxIyOjPT29Dw6PKSipGxubNTW1FRWVLy+vIyKjPTy9ExKTLSytHx+fOTm5GRiZMzKzJSWlPz+/DQ2NJyenGxqbNTS1FRSVLy6vISGhOzu7ERGRKyurHx6fOTi5FxeXMTGxJSSlPz6/Dw+PKSmpHRydNza3P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IJO1SEEBAosJFSa1ar9jswQQBeAEgyyFLLpvNL893DXC9zvC4XDggsb+EwXzPtyZAd14gCX2FhkQRgIEAIYeOSAMWIgoxY1UpioEpj5xCFx6ZACQVH1QjFIt5nY8PIV1sKCtUaYsOpVcfb6tWM6iBJlUnJqEAJidYKxYaFbq7SSXEXxQPVQ8VEjBQFVNXDypeKCPOSR8ZiwAox50rLF8Z40kV0V7Tqw8WXgQT8EgzDIvAdm1I4WFAM35EPqSAcYeAul25ECZ5EYPAGgH7JGo08mFACAcOChy4tbHkkA8PDppcybKly5cwY8rc8+HEiBYDRs509qKF/goCCAhIaEBy56MBFtcQaGCU04ukbFgsaErlQAQFETZgGbAIRAmqEx0oskDNirlFMcAieWDHCwtZVkqce6fWyAMBXyQ8pHKCYcOMdROOEIBBQIssAQI5KBs44YEWcLGcELvGWONCHyZ40OBhQtHLoEOLHk26tOnTqFOrXs26tevXEj+0MCFDBTPYSi64QPAFhgFLrl8c2HCC5IsUvNeAiMB49YsCFBCwICrkgIRABICvboEBz1QaC7oHmuEa1JdBQhZAZfOdtXlBdE8oCERBa+tTX94KeZ58TYjPqfWkAAsaiDPEcX6B4UFzrV1wAoNCbBCCCSG0h9uFGGao4YYc/nbo4YcghijiiCW9sMEMG6i04QsjKKCICICJ9sACE6wAoRILcMAGBRZe9kIIDKDAQALcWBGCYgDWVcIrACBQQpJHtHOHAHs1dt0aGhRJhZRR2QeaCGwooKUSBgSiwY1qRcBGDCpCkqAgh4l2wpUAKOBlFS9UQIEiBFRQ2gsDFKAHGR8skEAIKSwAJYmMNuroo5BGSkSbHa6wmQEljNnJBzOMUGVJMxCgCAwWfOrIARpggAIFBSw6zgl4sZGAq3uc8M0ag5bUAApT0jrHAG8CoMFKBfQnDZp9tDDlSh3wyoYEvsoxgrNfOLDSA2Uq5ycuKzQAGaVHnOBCJrGwtEKsUwDAEAOyRbyQgQAoIMBBAeAasUEMArBgQq4rndCCB4myWwSwa8DAbzXDPRBtU/M9++E/O35I5xcCfNgAMdt2+EACe4JAAZsgvrBABRUsUK+knAQBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8gk7bNKaVSx2UtJrVqv2CytwgJ4AZTCVEsum7ED0veLaJzfcPhDsV4LTvG83jpR170oLXuDhEQdBH9eMBVXHwcHF4VnLwMJGQtXfYkAKB1VlBoMFAIekZJYLxMUXiAQBitVc5sseEovATB1LBMfp1Yjq3UyD1UtKH8gBVUNIIkSsL5KDxabjFQfBYhfMCljSQ8Cm8m90UgzXYkaVi8LMSoKIVJVExibACbE5Ucj2n8CvsbsScinr8gCBpvUnaJnTwPBgkMeGNhUwtcDdIlSkINI5NyfgdE6NPt4gOORCQJycbKwodyHEMfszDCJ5ESDFClGPLTYwgT+i1EhWtIcKu3AhhMbiSpdyrSp06dQoya5sOKEN6kcTyRQIEBGgFpYC14woRIACAklw+oLkMjATrVJUhWQ16jfGgoT4Fb50AIRCmtWLoysE0gvlRfUvGi4agtCok6GbYX44iApFTr+hEau6YKFAc1WOsT8Mm6zLataXlQIZrYEY9N6PjwYkKLFBcuwc+vezbu379/AgwsfTry48ePIk1950CFFA1PKr6GEQJ1ChdfIcS/gUAdDC9zFHzTI0ILgiwiDv6iAjjxFLgQJhpzQkIhAWuQXEHohkO8C/T8UgGbcA/qBkc956SnG3nHuAcANESuEs0Yg4BH3QgsFlEfEBzP+CNAMCAR8F91eM1QwwVsjpqjiiiy26OKLMMYo44w01gjXBy/kWCGLFxQgAgEsxADWbw9AosUDISCwhgUowvbBBBYoYMEA2CExgZJrwFCRb/l9wcJMV0SQiAm/ZVBHDDsWMdkfGqRpWAJ1hFClEQ0kEsJvE5S1CBYbSFAHAQLq9kIMx4AQQ5NIrKABCiDAIAAmwX1wVBkPTFBBBwvaqOmmnHbq6aegKiHpADrR+EIIBCCAggILuKnHCw1IwIADgQ71QQx1iABNNC806AUFmdJ0QoFfaFTOASLUkUJTE9jlRWXlLMDas01tQKwXIbgKxwEy1KFMUx78mRcWJ0wwwgFZ2grxQQn9CIBoVgqMRIAYjUxgAAkkKNDBnEY80JMGMdRK1AW0FbABv0WcgBEABOy63APpGlbAHx7IKGYdZMZY55kynuDnFwHOeIAHLLDgAKQzvnDCwaEqFQQAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKTwMqtUZheldEqtWq/ClQMDAMBMC6x4TMZeZKCuWnAou9/wGERN93zg+Dz1JaHTWSd6goNEJwJ+ahQrhIxJLxuBVQ8iiF0sG1QPJSYqHhONZh4YIBAsJQ9UEWmIJlQTHH4BkaBSJxZ+MCl3tYd+BItSGwyIICGotEoFMIgos0ozGnQCA1QhlQAUn8hIDwbXBVUnAyEhLSe7Si8s1wAF6NuFMtceoBcE7DEv8EYP0ZUpoD6s+7bPyIcEq+iAaAPKwzUUIwry8+ZHF60TFCqF0CexyAMHLFCgkFDhGK0BAhKC8BClo8EFA0Y4o/VhRQoLCjw04Oiy5/6RDw8u8PRJtKjRo0iTKh304cWDB++W7jtQwoUBFyU2RFXyYUIICwFabJX6TMGyLiAUaJvyogSFOQBQxCBb5YCChGpYmFQyAAGuDHSlvFA1j8otRApaBj5yQt41FoqTwELEIsziIxsGVvo1hRJlTJeNHNCMiABoJTHwdnEwNPQSE+wktD5yoA8dCpZdE/nQAsW1FlRqmlglIbduIg9CqAbA2grQE0+PI+FNAQYIGCwK7JWe58GEFiMicx9Pvrz58+jTq1/Pvr379/B9PtoeX8oFUTAQmFgxtj6RC7BJA4x/MPFHRAtcKJTAbO3NwAEGHMwwxAcxVKIBfe05oIYDRP5UiMiF/mm42oEJ0pECg+zNEJIAEg5xwWFrnFZfgVFdEAMB1zmglX/BncPjj0AGKeSQRBZp5JFIJqnkktx90B+RLyxQQAAVGHjkCw0M0wWL6b2wQgvGUZGZH7KdxxsLBHDQwBUNIALDWuRNEqMVKbgJnHkPZGRJmHyphsKA5L0QQBogOIAhEhf4syGKx52QggYxiDfFfQSgQIAHhwr5wQIj7Mjkp6CGKuqopJZqxQMrMKRkBwJggIEBgNLkaAAdZCrRAmd1IYGqtKiIlgtIueAHCHfS8oIHKvHqk2N0ZPBkHon6USxRDilEDTLJKTRTTyvco4YG23J1gY9XLHCXF08hJNWCCRRQ4IGMU5yQgAIyhKDsFDal0IKtEn1wwQYb8OtRAHCBYICkQq6QaxfXGjkDIhUguYFvaoDAp5AvxHDWSgL790IFJmignakk7xMEACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ik8HVaLU4vpXRKrVqvy4KKRFBkHtiweBxOoABoACxEbrvftMU5jYaN4Pj8NAKipy16gYJDJn5pEoOJeR6GaBpWJy0VM1GKVi8jFiwCMRsfVCMIhiANVCcBcyAsE5WWSh8Vc2giM1UOfXQarUkvFrhpJAOuUjMMhrpUFzEUaCghB1QTv7kXw0kxEKMnVS8bCxMbYFQBjQAEE9ZIjI3oihrlMB3pRzHTaduKDuUEd/NFEwQMsfikaEA5Afj8DfmQIVuac65evPODooXCIxUUsGDhYIG1Aw5kUahwEcmDDQd2uXowIEaMAh5LypxJs6bNmzhz6tzJM8/+hwUNSlRYoHLKiwElOlTrWeVBBhYw1LCIsZTKCg0EYKAQsYLplA8JRNGBwIbKAQl+KGzwqqRDwEbCpjQYFYEtkhchygFwQCXvMYJ2iVwoVA7RnkaPAhd5oK9wtKh0QJBUTORDCntp6k55EAIyGhPiKA9ZIaARCmjJCghAMTWhaCEfOshCA2FylQ8vHrwA/HrhBhMEUBDQsIB3bzgXNrg+zry58+fQo0ufTr269evYsy+ZUCJBgRnGtRtRxgAGBBgMElR90cGABBNEs58wYA+EhW0vEnjGUKGo9AKYAQBCATRMwAwdAqx1XWnliEBDBvbAYJF1L4jVCAw0pOBQGhL+XveCZ4ZgOAAJfrAQk3UMNiIADZz9AkIG/kWXgl4pCPFABQIQIMEAoVl3ggKNKLCceENsYIEsCDigIJFHsBSDByEMEB6TVFZp5ZVYZqnlllx26eWXrlwwQQcjDHnlBi6cAYMGSzrHxJRK4LUhACZAB5IA911xQIrNtNkbXn2A4AKcR6xwIIe1NNdLGirEeMQFKqTVY2+wqEmgFZWmAcKEzj0wQgEjTErFAhpQoICUYKaq6qqsturqq7CyekIMMijQgqOC4KYbTi/IkAYEMeCax1EahWDmRQbRwUJXwyzAILA3zUgHDO240gIGh9zUQYknWrIAC2mUVdMLaKEBQgpXwuLxQQkicHTsRRuEoIAGBVRFxQcTRBDCCOka0YSoND1wwgWEHhEbBRCAQEADBYt3QrloMPAukQccqgZqWV7gaxosTCzewSAoXEHDRC6QQAzFxaqyJUEAACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8jk8HW5vJTQqHRKrQ4/q5jBEFt8rOCwGDzjgAAAEGsybrvftJcETQdwHvC8PjqA1dEgLXuDhEMlZ38gKYWMeg0Qf2gFVl+NYActIQkzeFInFJEoJ1IvAyowICQhF5ZTKxKIKKtTJSh1IJNRHw0EfxajrUovGn8wJZVQLxUKKCgKFZ1QD6CJGcFKAxiREk9SHxcbGyfIUB2RaAqs10cFCJEE3Ywp5wACG+tHLbZ/LPGFDfQkAMNH5AKHSCHIETrhJ5IHfwSFzOhFx8RARh8yNKQj4GLEIQs8KNBQIJqlBxkEwIBBQMW9jzCPfNjQocIEkzFz6tzJs6f+z59AgwodKuXBggkrcE45sAAiUSgzTHCgwMHCBIVKTgSgQIJDCqxPjUxg8YfBjCkXVPyJADaskAMizlFwemQAIjoEDrhF0mBfpAFS5hUDvNeI4HMxpBSIBINN4SIZ6AHIBWUFRTrcHhcZcPnPAlIFLlNwrHnIAwvnNFB5MSGEgxReShfZoOCPgBWUPrQt/SCFAgoSSsoeTry48ePIkytfzry58+fQoxN8sWDECrrSxWpgQIKFhs8FWySoMC76iwLa6pCoUIk2xxHRZ6T/QwH3C9R1FHhcHkFyAhorHFQHAfA9Vxs9qi1A1oCEOSeDZKo9YIJtej3ngWQhSLQgACj+tLDbcX2c05gQM8VgggcbYJfcCyHcBUgKKkp3ngAowIACBxXEmB0NGwxQwQD77SjkkEQWaeSRSCap5JJMjvHCDAM0teQHHQhAAAoYSNCCjkV8cMAKG3zo1gMxQLKWmEtUIAMLEmTAJVEdzFcHBA2WcxkMHRB3AX6poXnaHxIQt8GGkVBQoRIXEFMHC4JScw4BLwkTwh8OEAeXZBQodcQCAuAVaWksSlbpFA8U8FqQj73yqKY7jjBHHQKQduQGKWgggQYphDnlAxc8gGaTwAYr7LDEXkNdASVc8KseH7yJTwJmroHPASkEMICzrVzgFwAOsDrICw6gQYKsOS3wh35d16ywoTU8XWAmGiZ4u8cDagEAQ4E8hdAQC3W2soIJCpQgL0EXVOBBCFeB8QK2XQ4Mk25goMQCC24y2YI7HAqi5AcJ1JHAstA10BAMGiv5QAIEUJCAw0I2W+zLOgUBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ikcslsOp/Q5WOQSAwe0ax2q724SAAQyYPlms9oWggEaIdj6bi8+cC43YTyfM+nLWB3bRAbfYVyB4CBMCeGjUMXAxUtBy9PKoEAGk4fBykqEh4TH45NByqJAh2VTQssdyyErDJsbSgNo6RJLw6BHCubCyEaGjELuEsvFrRuDAu5SQtggQXHTB8XJ9VLF4l3IHDPRx0omCHaewuYbQ7hRxvSdxWOJ8t3Ie1Gu4Gwjh8imDAG4DPywAQMEDAkiCI1gUKgGOcGflhRYYKefhNMUKAgIcXAj0pebFhwISLIkyhTqlzJsqXLlzBjSrlwUaajBxkMqDBQ4UL+lA0BNIQ4YJOOgW4IPPhs8qEFATcIJhQN6aBem3tNTly6I2HVVCMzXGEiYLLICjt3UBD9aqQFWkyMmKx4mjYuWyId6GKqieSBhUCa7hbZ8A8TiyczFNCS8EswkQ8prIKQt2lDixgtNpT9+iDGMhAp+FpznOTDhhgOUmQjzbq169ewY8ueTbu27du4c+vG9+KE193bEkgQoCDFbxovDmygtPvDBAnLIGhYS6OzHRQR7N4+IUOdgzIlusHwmLuD1TYEnL3Y6kbB0tsR1LXpgFxBIAnaaweQD4CyZ3vH0VaBfDBIRcMJVbVhQiy4bSBWIO4N8cAMFYlGW1N6tcHCDMD+KTGDRgRQ4ACDHSaxwgQHbFbiiiy26OKLMMYo44w01mgjEheEIAAFAiSQXxMvPBCgYx8M4NArBjoRjAUhzKCiTSsUFogAFhqxwixtCPCeYy8kcF4bLTAV2R0FtHaBAfyZAGR8d0TQmlb8KeBEBQjcIRBrD/AinwdOeEELGa19UEE3gYwAxQYVaPbaAy6cxyeMJ3hATi1KyThFAh6kYFGNHzx546egXvjAAQesZmkHDgyngY8xfhBBhiAY0FhKQb7gKRoNQKCOCVt+dEAIDCgwwK1cXPCgIregFAEtAsxayACTquPBkOF0Vwt9jRRQp3wmVJmLB26w4EwjLWzrHbVTz2xgAgsCVEDsFiccG4i7KT2wAHWOpCCfBCSyNoMLHoxLhwljLeRaK1n2q8QDFQhAAAoiesvWOOgZCsUDG8xQkmwIA9AsjR+MoIEJBodq8skDBQEAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n9Dla1IqLV7RrHarfUQoMASrhOWaz2haAQJoA2CTtHzuZLndGrp+X8Tc2wJ8gnoCfwB5g4lDHxcbB2VOFWxuMAtPDxMpEQMnik8NKhwiKReXKSwwMAIVkEsXAShtICoHnkwTfm0wEQ9PLwstLRutSh8ZMH8mxLZFGn8EM4oPhX8o0cxHL3Z/A4ovsX8wDdhHHzLhcYkvFIYoI+RHDX8KnYkfAYYCvfBFHykEMFBo2GDrgAYQbggQ5HfkxABL2E4U0KDAw0KGGDNq3Mixo8ePIEOKHEmypMkPExIESLEiy4cBBWYsM3mkAAEIICBwaPHhyf6Kc20UlKKZpASyOyjSMXkRAKGbFESRXFBgCIADJyck/JER9ciCbX8CNTlB9Q6irkRWUAvr5MUxNyBaoC3ywETVGE9OhABDIcbMriMI/GFxscmDBRNW7JtL5MMIsBJm9GQ85/CEYZQza97MubPnz6BDix5NurTp06gZTghgIUZhIYxODD19wgUCWRgKtBqggoWKAZNJvwgxyQ0GnkJWsGvD4hrpDSSqahgaozgIvKVHVAVAYWEIpwBAhDDdYTsFiCNyAXBnegG4PxLqvSjAAAYFVqYfuDAEokLwDydscEJwpa2gAHggBLBYakY8UIACAmggF4MUVmjhhRhmqOGGHP526OGHIG7xwgABmBDBCgReeIBdlHgwmxMrDHBAinNdYAF4skQARQMCECCBUpR1oB5SCyqhlhsy/EXTBzFsB0A3TczAgBssFNnVcE5WgJUBsoSg5EkZ4HgHkEtsEIICMdST2QzLPUMjgwW810ZSGn5QgQAogICCAgN8idoHBwzQwgRqhmjooYiW9sIDfqb2wQoFeOBBAu/U2YEAxZGQQaO2fPDCm3xsIFg1BYCKzQsteJBBoYJ8wGVVArSk0QC5BMCpGSdEVxUME2bUZBscsLrHDEP+UcJGLUyiTF4ZCIAAAjJU8CISom4X10YPZKCAA68pcUBZcFkwrREfqLAdC1QQYWtqgw6IGV4Efk5w1B9+BTmqIectYYycAHhgZVQROAlCAU2YKQALJkBJ2T0CJ3BhwNYSbGEL9z5DZmp1bRfAuqVtAK4bJoxL4QYpCBCQBNJqFAQAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n1Dma3P6RK/YrHZhEYhCB614TB4eOCAAAGS6lN9wZ0RNBwzi+HxRU1cn9IB4Ln0AFYGHRS8XD1EzKHUUJ09TJSUDjIhOKxEaLgMvkxUCKCgKE1ZNLwUUajAumJlKDyJpABQtqE0fGy0Dkk8TJH0xsUsZfQq/gR8hhJHFSSZ9LCuILxaEBAvQSDF9EsqAH97TbtxGJwx0MCm5gQssfSnnSCsmBBK4sR8zIjAwKEKAokcQyYMBAza4K8iwocOHECNKnEixosWLGDPSu9ChxISBUR6E0dhkgQAMMEiYGOnkQgQYAAhkAEnSyAJhdZI5+VABwf66DTWPfPBQiw6IO6k89CkQ1MgDFYQAEEsVoI+hpkReQCU0z8kAdWoomMM6JEXRVtt2ttAgwcQpskROGKgDIgQsJydO3IUr5EAICigEFNjLV8yHDw8OF17MuLHjx5AjS55MubLly5gza05ysMGChZuHvKhAAQYEGAqqEXnQosCnyx8aYPjGkkYEnxhKXD6xlW4GVBcI0OFAU/KG2YRMYApOh0XxyBseJR8bAgIAGEwtn1AQNUauCyVitHge+UUJmHVYACWiOLMq4WoEfA595ESBFANA09/Pv7///wAGKOCABBZo4GMfXDBAATO8oN9mDxTgkxocjBfFCyeQ19QLGf5MSAcBE0CxggYCBBAOWSsIEJUGk0izxm+FNSBdHzA8aMQF3KnhgYYkVYAeIYQh8UEGMBHQgY0aDYBTHwRA8cAIDAYZFI5RheBfin208d8GDgjAggQpnMjfBwcsIOaBaKap5hgYHrCBlKGtEIIMLIjgCY9xKFhABi2cec4IEpxFQAJIlrGBBSRAAAIGMqRV0AqBEgLDCIc8IMNZAHCgGj0vmBUVABLgOcYxUZkgKiAX8PEpCuvpIcOnAmzKzQUifAoACkjpwUpUFIS4kapRoSCrQRMEoIABMSxwKg0SfKoeQZ1iSocAhT4Qg4cAkFBCoTQU8KkDcCJi0qctMEEkIWsYULrECSoyOQNDHyhJSAiFbsDBpxpwu0COaoDILSInOEABAQSokB8TFczYBwWOKvHBBDHE0EG43Hxwwga1LVHAj0yqG5qMn2qzn72fKrCsZOf2gYKv+z2QAHxhXdXfCxN4IIECMazwbyBBAAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IpHLJbDqf0Kh0Sq1CLxmNpfWyer/fiwkGAKBSXbB63RyAymXCgU2vFzNw+MbOp7fyADBzfYRhCm8AICFpTg8HGxcfhU8XLSkle1ArHgIKKSdPHwsuHCwmI5NOLiiBGitRLyegUAcKeRSDqUkLEHAgMZKFDYhwEbpKFYAmD4UfEYAAGsdJM4CLk8nW00gfJnACC6kbAnkoudtFDxUeFSfBzSsKKCgS4ej3ShsbzPj9/v8AAwocSLCgwYMIEyr092LFiFcLC71wQQEDhQCznhyIoCJBxohHXnjLY+LCkxMm3oCIwAhkkQms8oCY8WQCg2/8XBYpQQZQ/oUnKzjAUdBSp5AWPfO0CFWCBQoBE4wauSACEItzTEQN2PBO6pABLOBQaNHVqxVRBTwUWFDW7JcPbd3KnUu3rt27ePPq3cu3r9+/gAMXeXGgqGAiHzaYQACDRIqcQkR1gOh3BjlfASAP4IBBAOW9D0IQizOAiAE4AfxesAUIRAYiGuB4UM1a5ushI5x69hsaGoHSQ7Rmqhw2jwPIh2l8WKEBBogzyJMPcWRYuvXr2LNr3869u/fvgU+MqDAhevIHGRigQNC5Q1ydLy4cePA+5Mg8EBKYj/hhgoReCLjAVRMFQEOaWSPc5IsKHyFBlYFleLBfQg+c1loBTMxAAIQA/gjQYEQzFAeIAkxMsCGEAmAVkU0GSsDEARRwqMGHC50ggYEOMCEShynUh9AHMYwWSFRMnBAjNDOa9UIAMQFAQAM+EjGAAKO5ItcHLXhgQghshbJBASZo4EAFJmn3wQsPvBAleGy22WYs9G2njgcGOJDBgJMkNsAAK1S3zQkuIAAHBBIQSQgWIpBAAAcB+KnLAy70YlWZfDiTVCIWTDjJABhAGAMhKwgZSAn4vBADhwIQkgCEJqxpxwsecEgAIS5AqICmfZiKahMfHNBBBAlMEEkTpxpogqOFDNAkIJ8y0YJQZUCggT1LrHBpGSD8hM8FDohKAI0vHZmHBJQm8UEAWEIu488JDgDCACpL7AgNCCk08UAKR8IQQrn9DOCABBqUgKsQCygIjQKuCqFPwghNQAKKyO61gsEjMmyXvNBgaN0KIg41MF8DHBKtCcNZ98EJA6RA3seEBAEAIfkECQUANAAsAAAAAGQAZAAABv5AmnBILBqPyKRyyWw6n9CodEqtQj+TSGZl7Xq/rwIBAmGNvuj080QCuAGah3pOL67ebtapzp8fMHgKF32EYCkEICAUA1EfFycvhVEXK3tRLwMhMQsfUCcZKioRB5JOByYcEg2lNA8RMG4gGqxMDm8CXJIzbXgTtEoCbwSMkiMQeAAFv0kBIG4CpJILFMi+y0cbLhQKI52SD81vCt7XRi8PD+TfFQoSKZbl8fLz9PX29/j5+vv8/f7/AAMKpPJhgAEOFhZIeTCiwAw5A498SICHQAd1Sz5kgGURY0QaB3i9MQCPyQUFbzxE+khkAAJkLKI1eWHiTQqPEWegQCahJP6TFRoEeBjEksgLFXhAxFj55MUFpkWHLFDgDIUHn1GtnBjQYgLErGDDih1LtqzZs2jTql3Ltq1bGi86RNA0AupbIgc8IAKgKALWtweoIgNggmjaBx0EEBDRYmWEwW+UpX0RA5YbGAnkMIDsRoLaCZvxUJhBwxlnFGorHMMDowSN1ZAJpLb8pjUNFpwByFC7gAMyCgpT5K6gNgxtEAU6ndAA2cRXtC8mBNUwgNwJB3sBEAhh+K7RASliFJiA07v58+jTq1/Pvr379+wvbHie/sMMAxQIMHDw9+OHFwCWh0QBO4lGXlYHRMACARJU0J0SKwAymAQbRLUcHgjEQB8SHv5wBoFkLCUAmxsYKLTEC8FwphJLR0GWARMv+MaZAxsC9ABKg8XQBHOcxSBgPx90OBgxS7TAGQFnFLUAAcgo0J8RDpj2BggvZjUBCyiAgIIJFTpxQQgUmMZCAXaxdEEL4/14xAsLVFBACyuoCd+cdNZp551CzFBAAimMUGMfJ6xQZjkfFMDAaiRcJQkWLsjAgQYd0PNBCRJO6cKgagwQ2mUVyNnHBiJwZiIfD2wqzKjXdFDgYCEQsoCUtaUgj2ozEtIBZ63GM0ClyOjYxAMbzLDCAZgasQBkyMlzgAScdbnEBgGQkAgLCTyIxAfMwuTsNR+0sGpKcl6AFB4QBODEAFi41RbpPJgwGYtfTWQwohsooJrEBwt4wAIFDhxYzwMDvPmnER/gOFgE6D0QKmQeoPcBjzmm1wCs9G7r3QcO0AYADMSp90AGChBAgQaNsffCCRtscIKnhAQBACH5BAkFADQALAAAAABkAGQAAAb+QJpwSCwaj8ikcslsOp/QqHRKrUofL6t2yxVeQiRKKtstm5efAgwAQHTO8PjwFWGzM/K8+VOCsFFveoJbDzEULAVkUC+Kg08vH1SQUi8jMREtD45NDwUqDhubNC0sbBgJoksdCGwmjXknBnYAMK+pRDF2HCeOKwKzAKG3RwMEbB62cReydijJwy8dHgW8jh8DFGwgBcNJH5OiHycFBQuR3ejp6uvs7e7v8PHy7y8PFw/n84MfKykmMhYyCNOnZ4AAP9oUzCAIKxswAAoOMFxyIoGHFs+MfLDw0E6MfBOLzMBgR8JAJQcYdGSjoFrIIhpmgYiRccgMYytZnHxJ4wP+CWAmLjBZ4bCjgJ08f83yoGnJCwUrAThoynNIHzsEBjhpAaIjCq1VibyIIYCCAoxOPnjoOCZskQ8HFpwAyeRFBQEwYCAQMICuWy0PFgxYUfOv4cOIEytezLix48eQI0sOe2JAgwEuJyt50UAEARQkZKDVjITOmlkIEhRG/GJFAAspJAoZgMLrwsgfKuAEIGCFkABRQ0hewQGYgywyoiqQ3KL2LAESoa7UILmDczsCeOVamULyBgnAPES66dU37gGl2Gio9qLA9T8VVh+GWyAG5iITFFAgQEDDbdJK8DPBCn4BaOCBCCao4IIMNujggxBG6MgFJajAggbxLfZNgUr+LCACMAZk5tYHMyTgQAwLyEfDUw+BwNRhIxTFQAUc4tfVQxRMYNgFStnBgmxL1NERCBUYtspDLTQhZIvc/FXBabM0uUQDKwFi2AokyaQjEw/sNosEIvKkFjAaULVEMcBQsABiHxiCAgUehOnNCCbsR4EJSP11glxTBDbBBipKKOighBZqqBEXjFBBBwfUKIejt6ygHwIYSJDhIONooEEEeUbaIxsIFADpFgdocBoIDHS6yQsO3DgLAWbC8QFwwEgQayrfrbSlHC8UZQcGuw6zQHEdFZnHA1DaAUMD6RyQXEfBBnjBBgdcMKoQL6T36n/DtOmqj/I9UCEJDJjQgXxkH6TwLQAmXJtHqcCgkGQTGbyXlRMneAClBECmk69zCowg3wZessGCig9MEEMILciZzq1LqNviCAxGsC4AIDC7YAkXg7Dmghf4yoYE7kKGzSw6OfjCBCEooEEMG5QsmTgXBJpHEAAh+QQJBQA0ACwAAAAAZABkAAAG/kCacEgsGo/IpHLJbDqf0Kh0Sq1ar9is9TMwmUYfrXjcXHAAAMGKzG5+LpPNK9pBoAmjth55cbBIFAoND08rLGgCG3uLQlwMaJAgLoROMx4ea4yLGyKQngAFmjQfKxMXokofGRCfkCyniy8FAgwWiqhHDxatkCh5iwOPaDG4RxcKvGgwLYwVKJAaxUa6yQAwE4wLhwAgKdJFHwUgyQKUey8dEhQhsN9DJyrJzJofLw9h7kULyJ4wKfj5Ah6IoYAFCwcD5gRcSOPFiQMnzDGcSLGixYsYxdQDmBHVgxEFQmRI2FHUCRcEIBEI0K6kHgvjPEEIoNClkhcLKhyA0iIZ/ooKNpU8MDAORAiJSnYl81AzaJEGnjDMYyKhmgakToU4+ESsSbxkDrBmjeEJRKgmKar9y2rkwDYAGm4xuUCBVyK2Rj5YMpFiAZQBdT2RwIb3yAexTA6EYEGABbvCkCNLnky5suXLmDNr3sy5s+d8HzZMyPS5yQoLLBiwsEC6tOERb9EwGMCR84URFWaYO8Dvk4ATn1doQAPCA6UBrHgN8PzCRUxrJYQUqNaV84FOnqLRmJ7MW+cDVT2ZEDLBDi/CnD9EeA6jg5ALBngpaLn5RAgYAAisFbJCwfM0C9S22QsbbHBCU6OkoIAACiQAnGtMHCYghBRWaOGFGGao4YYc/nbo4YeofHBACgGkcMCEkaEoVATmcZMCYlmF1kACLez0RAb49RPdZDOIMA4EGrR2U2CfSGAjZC/0xo1xTWzwn0roFbZASp6wIJcSKyRDwHKRLfCMJxRcmcQDX35ipWQPnJEdfUl4wIsHKgbVQo750ebECSb8Z0KcTi3ggAIhiDlXARpIoEEBMFr4wAWJgujoo5BGKukSH5ywwAoIZvhBAjKwIIADM+DywAAVYDrRCwEkhwYLfjHywQgiIIAACi5kKo0zrShg6xjafBICn4t84AIvEDR6hSqtUHDkNy+YkMyybHzg5icoRPmNB09aY+wQb1ywq2FpfRLmQiMQCYkDZ8COskACBpiQwArp0rCAuQB4wJAsdAKggKBIzKAmNyLwe8QLDbylwYMLceGAABKkcEK8SqIxnhOhVVDABAhLdkC+ymzL2QwcWwNthReU2Uu8nE3rSXUZ9vElCkxyOGoMMQzg8aRtBAEAOw==",imagePosition:"center center",maxSize:"100px",minSize:"20px",resizeInterval:50,size:"50%",zIndex:2147483647};function i(t,e){var s=(t=r(t)).is("body"),a=t.data("LoadingOverlayCount");if(a===o&&(a=0),0===a){var i=r("<div>",{class:"loadingoverlay",css:{"background-color":e.color,position:"relative",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center"}});if(e.zIndex!==o&&i.css("z-index",e.zIndex),e.image&&i.css({"background-image":"url("+e.image+")","background-position":e.imagePosition,"background-repeat":"no-repeat"}),e.fontawesome&&r("<div>",{class:"loadingoverlay_fontawesome "+e.fontawesome}).appendTo(i),e.custom&&r(e.custom).appendTo(i),s?i.css({position:"fixed",top:0,left:0,width:"100%",height:"100%"}):i.css("position","fixed"===t.css("position")?"fixed":"absolute"),l(t,i,e,s),0<e.resizeInterval){var n=setInterval(function(){l(t,i,e,s)},e.resizeInterval);t.data("LoadingOverlayResizeIntervalId",n)}e.fade?!0===e.fade?e.fade=[400,200]:"string"!=typeof e.fade&&"number"!=typeof e.fade||(e.fade=[e.fade,e.fade]):e.fade=[0,0],t.data({LoadingOverlay:i,LoadingOverlayFadeOutDuration:e.fade[1]}),i.hide().appendTo("body").fadeIn(e.fade[0])}a++,t.data("LoadingOverlayCount",a)}function n(t,e){var s=(t=r(t)).data("LoadingOverlayCount");if(s!==o)if(s--,e||s<=0){var a=t.data("LoadingOverlayResizeIntervalId");a&&clearInterval(a),t.data("LoadingOverlay").fadeOut(t.data("LoadingOverlayFadeOutDuration"),function(){r(this).remove()}),t.removeData(["LoadingOverlay","LoadingOverlayCount","LoadingOverlayFadeOutDuration","LoadingOverlayResizeIntervalId"])}else t.data("LoadingOverlayCount",s)}function l(t,e,s,a){if(!a){var i="fixed"===t.css("position")?t.position():t.offset();e.css({top:i.top+parseInt(t.css("border-top-width"),10),left:i.left+parseInt(t.css("border-left-width"),10),width:t.innerWidth(),height:t.innerHeight()})}var n=a?r(window):t,o="auto";s.size&&"auto"!=s.size&&(o=Math.min(n.innerWidth(),n.innerHeight())*parseFloat(s.size)/100,s.maxSize&&o>parseInt(s.maxSize,10)&&(o=parseInt(s.maxSize,10)+"px"),s.minSize&&o<parseInt(s.minSize,10)&&(o=parseInt(s.minSize,10)+"px")),e.css("background-size",o),e.children(".loadingoverlay_fontawesome").css("font-size",o)}r.LoadingOverlaySetup=function(t){r.extend(!0,a,t)},r.LoadingOverlay=function(t,e){switch(t.toLowerCase()){case"show":i("body",r.extend(!0,{},a,e));break;case"hide":n("body",e)}},r.fn.LoadingOverlay=function(t,e){switch(t.toLowerCase()){case"show":var s=r.extend(!0,{},a,e);return this.each(function(){i(this,s)});case"hide":return this.each(function(){n(this,e)})}}}),function(f){f.fn.bootpag=function(t){var p=this,h=f.extend({total:0,page:1,maxVisible:null,leaps:!0,href:"javascript:void(0);",hrefVariable:"{{number}}",next:"»",prev:"«",firstLastUse:!1,first:'<span aria-hidden="true">←</span>',last:'<span aria-hidden="true">→</span>',wrapClass:"pagination",activeClass:"active",disabledClass:"disabled",nextClass:"next",prevClass:"prev",lastClass:"last",firstClass:"first"},p.data("settings")||{},t||{});if(h.total<=0)return this;function n(t,e){e=parseInt(e,10);var s,a=0==h.maxVisible?1:h.maxVisible,i=h.maxVisible,n=Math.floor((e-1)/a)*a,o=t.find("li");h.page=e=e<0?0:e>h.total?h.total:e,o.removeClass(h.activeClass),s=e-1<1?1:h.leaps&&e-1>=h.maxVisible?Math.floor((e-1)/a)*a:e-1,h.firstLastUse&&o.first().toggleClass(h.disabledClass,1===e);var r=o.first();h.firstLastUse&&(r=r.next()),r.toggleClass(h.disabledClass,1===e).attr("data-lp",s).find("a").attr("href",m(s));i=1==h.maxVisible?0:1;s=e+1>h.total?h.total:h.leaps&&e+1<h.total-h.maxVisible?n+h.maxVisible+i:e+1;var l=o.last();h.firstLastUse&&(l=l.prev()),l.toggleClass(h.disabledClass,e===h.total).attr("data-lp",s).find("a").attr("href",m(s)),o.last().toggleClass(h.disabledClass,e===h.total);var c=o.filter("[data-lp="+e+"]"),d="."+[h.nextClass,h.prevClass,h.firstClass,h.lastClass].join(",.");if(!c.not(d).length){var u=e<=n?-h.maxVisible:0;o.not(d).each(function(t){s=t+1+n+u,f(this).attr("data-lp",s).toggle(s<=h.total).find("a").html(s).attr("href",m(s))}),c=o.filter("[data-lp="+e+"]")}c.not(d).addClass(h.activeClass),p.data("settings",h)}function m(t){return h.href.replace(h.hrefVariable,t)}return f.isNumeric(h.maxVisible)||h.maxVisible||(h.maxVisible=parseInt(h.total,10)),p.data("settings",h),this.each(function(){var t,e,s=f(this),a=['<ul class="',h.wrapClass,' bootpag">'];h.firstLastUse&&(a=a.concat(['<li data-lp="1" class="',h.firstClass,'"><a href="',m(1),'">',h.first,"</a></li>"])),h.prev&&(a=a.concat(['<li data-lp="1" class="',h.prevClass,'"><a href="',m(1),'">',h.prev,"</a></li>"]));for(var i=1;i<=Math.min(h.total,h.maxVisible);i++)a=a.concat(['<li data-lp="',i,'"><a href="',m(i),'">',i,"</a></li>"]);h.next&&(e=h.leaps&&h.total>h.maxVisible?Math.min(h.maxVisible+1,h.total):2,a=a.concat(['<li data-lp="',e,'" class="',h.nextClass,'"><a href="',m(e),'">',h.next,"</a></li>"])),h.firstLastUse&&(a=a.concat(['<li data-lp="',h.total,'" class="last"><a href="',m(h.total),'">',h.last,"</a></li>"])),a.push("</ul>"),s.find("ul.bootpag").remove(),s.append(a.join("")),t=s.find("ul.bootpag"),s.find("li").click(function(){var t=f(this);if(!t.hasClass(h.disabledClass)&&!t.hasClass(h.activeClass)){var e=parseInt(t.attr("data-lp"),10);p.find("ul.bootpag").each(function(){n(f(this),e)}),p.trigger("page",e)}}),n(t,h.page)})}}(jQuery,window),function(w){var k="iCheck",x=k+"-helper",C="checkbox",_="radio",P="checked",h="un"+P,A="disabled",m="determinate",M="in"+m,D="update",T="type",S="click",E="touchbegin.i touchend.i",O="addClass",L="removeClass",B="trigger",I="label",f="cursor",j=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);function F(t,e,s){var a=t[0],i=/er/.test(s)?M:/bl/.test(s)?A:P,n=s==D?{checked:a[P],disabled:a[A],indeterminate:"true"==t.attr(M)||"false"==t.attr(m)}:a[i];if(/^(ch|di|in)/.test(s)&&!n)Y(t,i);else if(/^(un|en|de)/.test(s)&&n)R(t,i);else if(s==D)for(var o in n)n[o]?Y(t,o,!0):R(t,o,!0);else e&&"toggle"!=s||(e||t[B]("ifClicked"),n?a[T]!==_&&R(t,i):Y(t,i))}function Y(t,e,s){var a=t[0],i=t.parent(),n=e==P,o=e==M,r=e==A,l=o?m:n?h:"enabled",c=g(t,l+v(a[T])),d=g(t,e+v(a[T]));if(!0!==a[e]){if(!s&&e==P&&a[T]==_&&a.name){var u=t.closest("form"),p='input[name="'+a.name+'"]';(p=u.length?u.find(p):w(p)).each(function(){this!==a&&w(this).data(k)&&R(w(this),e)})}o?(a[e]=!0,a[P]&&R(t,P,"force")):(s||(a[e]=!0),n&&a[M]&&R(t,M,!1)),b(t,n,e,s)}a[A]&&g(t,f,!0)&&i.find("."+x).css(f,"default"),i[O](d||g(t,e)||""),i.attr("role")&&!o&&i.attr("aria-"+(r?A:P),"true"),i[L](c||g(t,l)||"")}function R(t,e,s){var a=t[0],i=t.parent(),n=e==P,o=e==M,r=e==A,l=o?m:n?h:"enabled",c=g(t,l+v(a[T])),d=g(t,e+v(a[T]));!1!==a[e]&&(!o&&s&&"force"!=s||(a[e]=!1),b(t,n,l,s)),!a[A]&&g(t,f,!0)&&i.find("."+x).css(f,"pointer"),i[L](d||g(t,e)||""),i.attr("role")&&!o&&i.attr("aria-"+(r?A:P),"false"),i[O](c||g(t,l)||"")}function z(t,e){t.data(k)&&(t.parent().html(t.attr("style",t.data(k).s||"")),e&&t[B](e),t.off(".i").unwrap(),w(I+'[for="'+t[0].id+'"]').add(t.closest(I)).off(".i"))}function g(t,e,s){if(t.data(k))return t.data(k).o[e+(s?"":"Class")]}function v(t){return t.charAt(0).toUpperCase()+t.slice(1)}function b(t,e,s,a){a||(e&&t[B]("ifToggled"),t[B]("ifChanged")[B]("if"+v(s)))}w.fn[k]=function(e,s){function t(t){t.each(function(){var t=w(this);i=t.is(a)?i.add(t):i.add(t.find(a))})}var a='input[type="'+C+'"], input[type="'+_+'"]',i=w();if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(e))return e=e.toLowerCase(),t(this),i.each(function(){var t=w(this);"destroy"==e?z(t,"ifDestroyed"):F(t,!0,e),w.isFunction(s)&&s()});if("object"!=typeof e&&e)return this;var h=w.extend({checkedClass:P,disabledClass:A,indeterminateClass:M,labelHover:!0},e),n=h.handle,m=h.hoverClass||"hover",f=h.focusClass||"focus",g=h.activeClass||"active",v=!!h.labelHover,b=h.labelHoverClass||"hover",y=0|(""+h.increaseArea).replace("%","");return n!=C&&n!=_||(a='input[type="'+n+'"]'),y<-50&&(y=-50),t(this),i.each(function(){var a=w(this);z(a);var t,i=this,e=i.id,s=-y+"%",n=100+2*y+"%",o={position:"absolute",top:s,left:s,display:"block",width:n,height:n,margin:0,padding:0,background:"#fff",border:0,opacity:0},r=j?{position:"absolute",visibility:"hidden"}:y?o:{position:"absolute",opacity:0},l=i[T]==C?h.checkboxClass||"i"+C:h.radioClass||"i"+_,c=w(I+'[for="'+e+'"]').add(a.closest(I)),d=!!h.aria,u=k+"-"+Math.random().toString(36).substr(2,6),p='<div class="'+l+'" '+(d?'role="'+i[T]+'" ':"");d&&c.each(function(){p+='aria-labelledby="',this.id?p+=this.id:(this.id=u,p+=u),p+='"'}),p=a.wrap(p+"/>")[B]("ifCreated").parent().append(h.insert),t=w('<ins class="'+x+'"/>').css(o).appendTo(p),a.data(k,{o:h,s:a.attr("style")}).css(r),h.inheritClass&&p[O](i.className||""),h.inheritID&&e&&p.attr("id",k+"-"+e),"static"==p.css("position")&&p.css("position","relative"),F(a,!0,D),c.length&&c.on(S+".i mouseover.i mouseout.i "+E,function(t){var e=t[T],s=w(this);if(!i[A]){if(e==S){if(w(t.target).is("a"))return;F(a,!1,!0)}else v&&(/ut|nd/.test(e)?(p[L](m),s[L](b)):(p[O](m),s[O](b)));if(!j)return!1;t.stopPropagation()}}),a.on(S+".i focus.i blur.i keyup.i keydown.i keypress.i",function(t){var e=t[T],s=t.keyCode;return e!=S&&("keydown"==e&&32==s?(i[T]==_&&i[P]||(i[P]?R(a,P):Y(a,P)),!1):void("keyup"==e&&i[T]==_?i[P]||Y(a,P):/us|ur/.test(e)&&p["blur"==e?L:O](f)))}),t.on(S+" mousedown mouseup mouseover mouseout "+E,function(t){var e=t[T],s=/wn|up/.test(e)?g:m;if(!i[A]){if(e==S?F(a,!1,!0):(/wn|er|in/.test(e)?p[O](s):p[L](s+" "+g),c.length&&v&&s==m&&c[/ut|nd/.test(e)?L:O](b)),!j)return!1;t.stopPropagation()}})})}}(window.jQuery||window.Zepto),void 0===helper)var helper={};helper.arr={multisort:function(t,s,a){if(void 0===s)for(s=[],x=0;x<t[0].length;x++)s.push(x);if(void 0===a)for(a=[],x=0;x<t[0].length;x++)a.push("ASC");return t.sort(function(t,e){return function t(e,s,a,i,n){var o="DESC"==i[n]?1:0,r=!isNaN(e[a[n]]-s[a[n]]),l=r?+e[a[n]]:e[a[n]].toLowerCase(),c=r?+s[a[n]]:s[a[n]].toLowerCase();return l<c?0==o?-1:1:l==c?a.length-1>n?t(e,s,a,i,n+1):0:0==o?1:-1}(t,e,s,a,0)})}},function(i){"use strict";var n=function(t,e){this.$element=i(t),this.options=i.extend({},n.defaults,e)};n.defaults={transition_delay:300,refresh_speed:50,display_text:"none",use_percentage:!0,percent_format:function(t){return t+"%"},amount_format:function(t,e,s){return t+" / "+e},update:i.noop,done:i.noop,fail:i.noop},n.prototype.transition=function(){var o=this.$element,r=o.parent(),l=this.$back_text,c=this.$front_text,d=this.options,u=parseInt(o.attr("data-transitiongoal")),p=parseInt(o.attr("aria-valuemin"))||0,h=parseInt(o.attr("aria-valuemax"))||100,m=r.hasClass("vertical"),f=d.update&&"function"==typeof d.update?d.update:Progressbar.defaults.update,g=d.done&&"function"==typeof d.done?d.done:Progressbar.defaults.done,t=d.fail&&"function"==typeof d.fail?d.fail:Progressbar.defaults.fail;if(isNaN(u))t("data-transitiongoal not set");else{var e,v=Math.round(100*(u-p)/(h-p));if("center"===d.display_text&&!l&&!c)this.$back_text=l=i("<span>").addClass("progressbar-back-text").prependTo(r),this.$front_text=c=i("<span>").addClass("progressbar-front-text").prependTo(o),m?(e=r.css("height"),l.css({height:e,"line-height":e}),c.css({height:e,"line-height":e}),i(window).resize(function(){e=r.css("height"),l.css({height:e,"line-height":e}),c.css({height:e,"line-height":e})})):(e=r.css("width"),c.css({width:e}),i(window).resize(function(){e=r.css("width"),c.css({width:e})}));setTimeout(function(){var t,e,s,a,i;m?o.css("height",v+"%"):o.css("width",v+"%");var n=setInterval(function(){a=m?(s=o.height(),r.height()):(s=o.width(),r.width()),t=Math.round(100*s/a),e=Math.round(p+s/a*(h-p)),v<=t&&(t=v,e=u,g(o),clearInterval(n)),"none"!==d.display_text&&(i=d.use_percentage?d.percent_format(t):d.amount_format(e,h,p),"fill"===d.display_text?o.text(i):"center"===d.display_text&&(l.text(i),c.text(i))),o.attr("aria-valuenow",e),f(t,o)},d.refresh_speed)},d.transition_delay)}};var t=i.fn.yopprogressbar;i.fn.yopprogressbar=function(a){return this.each(function(){var t=i(this),e=t.data("bs.progressbar"),s="object"==typeof a&&a;e&&s&&i.extend(e.options,s),e||t.data("bs.progressbar",e=new n(this,s)),e.transition()})},i.fn.yopprogressbar.Constructor=n,i.fn.yopprogressbar.noConflict=function(){return i.fn.yopprogressbar=t,this}}(window.jQuery),jQuery(document).ready(function(e){e(".submenu-item").hover(function(t){e(this).closest(".submenu").find(".submenu-item").removeClass("btn-underline"),e(this).addClass("btn-underline"),t.preventDefault()},function(t){e(this).removeClass("btn-underline"),e(this).closest(".submenu").find(".submenu-item-active").addClass("btn-underline"),t.preventDefault()}),e(".submenu-item").click(function(t){e(this).closest(".submenu").find(".submenu-item").removeClass("btn-underline").removeClass("submenu-item-active"),e(this).addClass("btn-underline").addClass("submenu-item-active"),e(this).closest(".tab-pane").find(".submenu-content").addClass("hide"),e(this).closest(".tab-pane").find("."+e(this).attr("data-content")).removeClass("hide"),t.preventDefault()})}),jQuery(document).ready(function(i){var t,e="";toastr.options={closeButton:!1,debug:!1,newestOnTop:!1,progressBar:!1,positionClass:"toast-bottom-right",preventDuplicates:!0,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut",escapeHtml:!1},i(".yop-poll-poll-templates").find('.basic-yop-poll-container[data-temp="basic-pretty"] input[type="radio"]').iCheck({checkboxClass:"icheckbox_square-red",radioClass:"iradio_square-red"}),i(".choose-template").click(function(){var t=i(this).attr("data-template-id");""!==(e=i(this).attr("data-template-base"))&&("basic"===e?(i('input[name="poll[template]"]').val(t),i('input[name="poll[template]"]').attr("data-template-base",e),i("#poll-design").find(".skins-no-template").addClass("hide"),i("#poll-design").find(".skins-no-skin").removeClass("hide"),i(document).find(".skins-basic").removeClass("hide"),i(document).find(".skins-basic-pretty").addClass("hide"),i(".yop-poll-poll-templates").find("figure").removeClass("selected"),i(this).closest("figure").addClass("selected"),i("#poll-design").find('a[data-content="content-design-templates"]').removeClass("btn-underline submenu-item-active"),i("#poll-design").find('a[data-content="content-design-predefined-styles"]').addClass("btn-underline submenu-item-active"),i("#poll-design").find(".content-design-templates").addClass("hide"),i("#poll-design").find(".content-design-predefined-styles").removeClass("hide")):showUpgradeToPro("basic-pretty-template"))}),i(".preview-poll").click(function(t){var a=!1;if(""===i('input[name="poll[template]"]').attr("data-template-base")&&(a=!0,toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noTemplateSelectedLabel)))),!1===a&&""===i('input[name="poll[skin]"]').attr("data-skin-base")&&(a=!0,toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noSkinSelectedLabel)))),!1===a&&i(".poll-elements").find(".poll-element").each(function(t){var e,s=i(this).attr("data-type");!1===a&&("text-question"!==s&&"media-question"!==s||"columns"===i(this).find(".answers-display").val()&&(""===(e=i(this).find(".answers-columns").val())?(a=!0,i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child( 2)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(2) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(i(this).find(".answers-display-section"),1e3,{onAfter:function(){i(this).find(".answers-columns").focus(),i(this).find(".answers-columns").parent().addClass("has-error")}}),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.noNumberOfColumnsDefined)))):12<e&&(a=!0,i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(2)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(2) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(2)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(i(this).find(".answers-display-section"),1e3,{onAfter:function(){i(this).find(".answers-columns").focus(),i(this).find(".answers-columns").parent().addClass("has-error")}}),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.numberOfColumnsTooBig))))))}),!1===a)switch(i('input[name="poll[template]"]').attr("data-template-base")){case"basic":YOPPollBasicShowLivePreview();break;case"basic-pretty":YOPPollBasicPrettyShowLivePreview()}t.preventDefault()}),i('input[name="poll[name]"]').change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".edit-poll-status").click(function(t){i(this).addClass("hide"),i("#poll-status-select").removeClass("hide-if-js"),t.preventDefault()}),i(".save-poll-status").click(function(t){var e=i("#poll_status").val();i(".poll-status").text(e.charAt(0).toUpperCase()+e.slice(1)),i("#poll-status-select").addClass("hide-if-js"),i(".edit-poll-status").removeClass("hide"),t.preventDefault()}),i(".cancel-poll-status").click(function(t){i("#poll-status-select").addClass("hide-if-js"),i(".edit-poll-status").removeClass("hide"),t.preventDefault()}),i(".edit-timestamp").click(function(t){i(".poll-steps li").removeClass("active"),i(".poll-steps li:nth-child(3)").addClass("active"),i(".poll-steps-content .tab-pane").removeClass("active"),i(".poll-steps-content .tab-pane:nth-child(3)").addClass("active"),i(".poll-steps-content .tab-pane:nth-child(3) .submenu-item").removeClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-item").eq(0).addClass("btn-underline"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-content").addClass("hide"),i(".poll-steps-content .tab-pane:nth-child(3)").find(".submenu-content").eq(0).removeClass("hide"),i.scrollTo(".start-date-option",1e3,{onAfter:function(){i(".poll-preferences").find(".start-date-option").focus()}}),t.preventDefault()}),i.fn.extend({tooltipExtended:function(t){var e=i(this).data("ui-validate.error-destroy");""!==e&&(e=function(){i(this).tooltip("destroy").removeData("bs.tooltip").next(".tooltip").remove()},i(this).data("ui-validate.error-destroy",e)),i(this).tooltip("destroy").removeData("bs.tooltip").next(".tooltip").remove(),i(this).tooltip({title:t}).on("mouseleave",e).tooltip("show")}}),(t=new Clipboard("#copy-yop-poll-code")).on("success",function(t){i("#copy-yop-poll-code").tooltipExtended(objectL10n.yopPollParams.copyToClipboardSuccess),t.clearSelection()}),t.on("error",function(t){i("#copy-yop-poll-code").tooltipExtended(fallbackMessage(t.action))})}),jQuery(document).ready(function(a){a(".skins-basic-pretty").find(".basic-yop-poll-container").each(function(t){var e=a(this).attr("data-skin"),s=a(this).attr("data-cscheme");s="black"===s?"":"-"+s,a(this).find('input[type="radio"]').iCheck({checkboxClass:"icheckbox_"+e+s,radioClass:"iradio_"+e+s}),a(this).find('input[type="checkbox"]').iCheck({checkboxClass:"icheckbox_"+e+s,radioClass:"iradio_"+e+s})}),a(".skins-select-template").click(function(t){a("#poll-design").find('a[data-content="content-design-templates"]').addClass("btn-underline"),a("#poll-design").find('a[data-content="content-design-predefined-styles"]').removeClass("btn-underline"),a("#poll-design").find(".content-design-templates").removeClass("hide"),a("#poll-design").find(".content-design-predefined-styles").addClass("hide"),t.preventDefault()}),a(".choose-skin").click(function(t){a(this).attr("data-temp");a('input[name="poll[skin]"]').attr("data-skin-base",a(this).attr("data-skin-base")),a("#poll-design").find('input[name="poll[background-color]"]').val(a(this).attr("data-poll-background-color")),a("#poll-design").find('input[name="poll[background-color]"]').minicolors("value",{color:a(this).attr("data-poll-background-color")}),a("#poll-design").find('input[name="poll[border-color]"]').val(a(this).attr("data-poll-border-color")),a("#poll-design").find('input[name="poll[border-color]"]').minicolors("value",{color:a(this).attr("data-poll-border-color")}),a("#poll-design").find('input[name="poll[border-size]"]').val(a(this).attr("data-poll-border-size").replace("px","")),a("#poll-design").find('input[name="poll[border-radius]"]').val(a(this).attr("data-poll-border-radius").replace("px","")),a("#poll-design").find('input[name="poll[padding-left-right]"]').val(a(this).attr("data-poll-padding-left-right").replace("px","")),a("#poll-design").find('input[name="poll[padding-top-bottom]"]').val(a(this).attr("data-poll-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="questions[text-color]"]').val(a(this).attr("data-questions-text-color")),a("#poll-design").find('input[name="questions[text-color]"]').minicolors("value",{color:a(this).attr("data-questions-text-color")}),a("#poll-design").find('input[name="questions[text-size]"]').val(a(this).attr("data-questions-text-size").replace("px","")),a('.questions-text-weight option[value="'+a(this).attr("data-questions-text-weight")+'"]').prop("selected",!0),a('.questions-text-align option[value="'+a(this).attr("data-questions-text-align")+'"]').prop("selected",!0),a("#poll-design").find('input[name="answers[padding-left-right]"]').val(a(this).attr("data-answers-padding-left-right").replace("px","")),a("#poll-design").find('input[name="answers[padding-top-bottom]"]').val(a(this).attr("data-answers-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="answers[text-color]"]').val(a(this).attr("data-answers-text-color")),a("#poll-design").find('input[name="answers[text-color]"]').minicolors("value",{color:a(this).attr("data-answers-text-color")}),a("#poll-design").find('input[name="answers[text-size]"]').val(a(this).attr("data-answers-text-size").replace("px","")),a('.answers-text-weight option[value="'+a(this).attr("data-answers-text-weight")+'"]').prop("select",!0),a("#poll-design").find('input[name="buttons[background-color]"]').val(a(this).attr("data-buttons-background-color")),a("#poll-design").find('input[name="buttons[background-color]"]').minicolors("value",{color:a(this).attr("data-buttons-background-color")}),a("#poll-design").find('input[name="buttons[border-size]"]').val(a(this).attr("data-buttons-border-size").replace("px","")),a("#poll-design").find('input[name="buttons[border-color]"]').val(a(this).attr("data-buttons-border-color")),a("#poll-design").find('input[name="buttons[border-color]"]').minicolors("value",{color:a(this).attr("data-buttons-border-color")}),a("#poll-design").find('input[name="buttons[border-radius]"]').val(a(this).attr("data-buttons-border-radius").replace("px","")),a("#poll-design").find('input[name="buttons[padding-left-right]"]').val(a(this).attr("data-buttons-padding-left-right").replace("px","")),a("#poll-design").find('input[name="buttons[padding-top-bottom]"]').val(a(this).attr("data-buttons-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="buttons[text-color]"]').val(a(this).attr("data-buttons-text-color")),a("#poll-design").find('input[name="buttons[text-color]"]').minicolors("value",{color:a(this).attr("data-buttons-text-color")}),a("#poll-design").find('input[name="buttons[text-size]"]').val(a(this).attr("data-buttons-text-size").replace("px","")),a('.buttons-text-weight option[value="'+a(this).attr("data-buttons-text-weight")+'"]').prop("selected",!0),a("#poll-design").find('textarea[name="custom[css]"]').val(a(this).attr("data-custom-css")),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a("#poll-design").removeClass("active"),a("#poll-questions").addClass("active"),a("#yop-main-area").find(".step-design").removeClass("active"),a("#yop-main-area").find(".step-elements").addClass("active"),a("#yop-main-area").find(".step-options").removeClass("active"),a("#yop-main-area").find(".content-qa-elementss").addClass("btn-underline"),a("#yop-main-area").find(".content-design-predefined-styles").removeClass("btn-underline"),a("#yop-main-area").find(".content-qa-elements").removeClass("hide"),a(".content-design-predefined-styles").find("figure").removeClass("selected"),a(this).closest("figure").addClass("selected"),t.preventDefault()}),a(".customize-skin").click(function(t){a(this).attr("data-temp");var e=a(this).closest("figcaption").find(".choose-skin");a('input[name="poll[skin]"]').attr("data-skin-base",a(this).attr("data-skin-base")),a("#poll-design").find('input[name="poll[background-color]"]').val(e.attr("data-poll-background-color")),a("#poll-design").find('input[name="poll[background-color]"]').minicolors("value",{color:e.attr("data-poll-background-color")}),a("#poll-design").find('input[name="poll[border-color]"]').val(e.attr("data-poll-border-color")),a("#poll-design").find('input[name="poll[border-color]"]').minicolors("value",{color:e.attr("data-poll-border-color")}),a("#poll-design").find('input[name="poll[border-size]"]').val(e.attr("data-poll-border-size").replace("px","")),a("#poll-design").find('input[name="poll[border-radius]"]').val(e.attr("data-poll-border-radius").replace("px","")),a("#poll-design").find('input[name="poll[padding-left-right]"]').val(e.attr("data-poll-padding-left-right").replace("px","")),a("#poll-design").find('input[name="poll[padding-top-bottom]"]').val(e.attr("data-poll-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="questions[text-color]"]').val(e.attr("data-questions-text-color")),a("#poll-design").find('input[name="questions[text-color]"]').minicolors("value",{color:e.attr("data-questions-text-color")}),a("#poll-design").find('input[name="questions[text-size]"]').val(e.attr("data-questions-text-size").replace("px","")),a('.questions-text-weight option[value="'+a(this).attr("data-questions-text-weight")+'"]').prop("selected",!0),a('.questions-text-align option[value="'+a(this).attr("data-questions-text-align")+'"]').prop("selected",!0),a("#poll-design").find('input[name="answers[padding-left-right]"]').val(e.attr("data-answers-padding-left-right").replace("px","")),a("#poll-design").find('input[name="answers[padding-top-bottom]"]').val(e.attr("data-answers-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="answers[text-color]"]').val(e.attr("data-answers-text-color")),a("#poll-design").find('input[name="answers[text-color]"]').minicolors("value",{color:e.attr("data-answers-text-color")}),a("#poll-design").find('input[name="answers[text-size]"]').val(e.attr("data-answers-text-size").replace("px","")),a('.answers-text-weight option[value="'+a(this).attr("data-answers-text-weight")+'"]').prop("select",!0),a("#poll-design").find('input[name="buttons[background-color]"]').val(e.attr("data-buttons-background-color")),a("#poll-design").find('input[name="buttons[background-color]"]').minicolors("value",{color:e.attr("data-buttons-background-color")}),a("#poll-design").find('input[name="buttons[border-size]"]').val(e.attr("data-buttons-border-size").replace("px","")),a("#poll-design").find('input[name="buttons[border-color]"]').val(e.attr("data-buttons-border-color")),a("#poll-design").find('input[name="buttons[border-color]"]').minicolors("value",{color:e.attr("data-buttons-border-color")}),a("#poll-design").find('input[name="buttons[border-radius]"]').val(e.attr("data-buttons-border-radius").replace("px","")),a("#poll-design").find('input[name="buttons[padding-left-right]"]').val(e.attr("data-buttons-padding-left-right").replace("px","")),a("#poll-design").find('input[name="buttons[padding-top-bottom]"]').val(e.attr("data-buttons-padding-top-bottom").replace("px","")),a("#poll-design").find('input[name="buttons[text-color]"]').val(e.attr("data-buttons-text-color")),a("#poll-design").find('input[name="buttons[text-color]"]').minicolors("value",{color:e.attr("data-buttons-text-color")}),a("#poll-design").find('input[name="buttons[text-size]"]').val(e.attr("data-buttons-text-size").replace("px","")),a('.buttons-text-weight option[value="'+a(this).attr("data-buttons-text-weight")+'"]').prop("selected",!0),a("#poll-design").find('textarea[name="custom[css]"]').val(e.attr("data-custom-css")),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a(".content-design-predefined-styles").find("figure").removeClass("selected"),a(this).closest("figure").addClass("selected"),a("#poll-design").find(".skins-no-template").addClass("hide"),a("#poll-design").find(".skins-no-skin").addClass("hide"),a("#poll-design").find(".skin-custom-style").removeClass("hide"),a("#poll-design").find('a[data-content="content-design-predefined-styles"]').removeClass("btn-underline submenu-item-active"),a("#poll-design").find('a[data-content="content-design-custom-style"]').addClass("btn-underline submenu-item-active"),a("#poll-design").find(".content-design-predefined-styles").addClass("hide"),a("#poll-design").find(".content-design-custom-style").removeClass("hide"),t.preventDefault()})}),jQuery(document).ready(function(s){s(".yop-element > .yop-head").first().addClass("collapse-up"),s(".yop-element > .yop-head").click(function(){var t=s(this).parent().children(".content"),e=s(this);s(t).slideToggle(function(){"block"===s(t).css("display")?(s(e).addClass("collapse-up"),s(e).removeClass("collapse-down")):(s(e).addClass("collapse-down"),s(e).removeClass("collapse-up"))})}),s(".poll-style-header").click(function(){var t=s(this).closest(".panel").find(".panel-collapse");s(t).hasClass("in")?s(this).find("a").first().removeClass("collapsed"):s(this).find("a").first().addClass("collapsed"),s(t).collapse("toggle")}),s(".custom-style-select-template").click(function(t){s("#poll-design").find('a[data-content="content-design-templates"]').addClass("btn-underline"),s("#poll-design").find('a[data-content="content-design-custom-style"]').removeClass("btn-underline"),s("#poll-design").find(".content-design-templates").removeClass("hide"),s("#poll-design").find(".content-design-custom-style").addClass("hide"),t.preventDefault()}),s(".custom-style-select-skin").click(function(t){s("#poll-design").find('a[data-content="content-design-custom-style"]').removeClass("btn-underline"),s("#poll-design").find('a[data-content="content-design-predefined-styles"]').addClass("btn-underline"),s("#poll-design").find(".content-design-predefined-styles").removeClass("hide"),s("#poll-design").find(".content-design-custom-style").addClass("hide"),t.preventDefault()}),s(".color-scheme li").click(function(){!1===s(this).hasClass("active")&&(s("li.active").removeClass("active"),s(this).addClass("active"))}),s(".colorpicker-component").each(function(){s(this).find("INPUT").minicolors({position:"bottom right",inline:!1,theme:"bootstrap"})}),s(".poll-background-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-border-radius").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".questions-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".questions-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".answers-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-background-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-border-radius").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-padding-left-right").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-padding-top-bottom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".buttons-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-color-for-success").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-color-for-error").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-border-left-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-padding-top-left").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-text-color").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".errors-text-size").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")})}),jQuery(document).ready(function(e){e(".vote-permissions").on("click",function(t){!0===e(this).is(":checked")&&-1!==e.inArray(e(this).val(),["facebook","google"])?(showUpgradeToPro(e(this).val()),t.preventDefault()):1===e('.vote-permissions[value="wordpress"]:checked').length&&0===e('.vote-permissions[value="guest"]:checked').length?e(".limit-votes-per-user-section").removeClass("hide"):(e(".limit-votes-per-user-section").addClass("hide"),e(".votes-per-user-section").addClass("hide"),e('.limit-votes-per-user option[value="no"]').prop("selected",!0))}),e(".block-voters").on("click",function(t){!0===e(this).is(":checked")?"no-block"===e(this).val()?(e(".block-voters-section").find('.block-voters[value!="no-block"]').prop("checked",!1),e(".block-type-section").addClass("hide"),e(".block-length-section").addClass("hide")):"by-fingerprint"===e(this).val()?(showUpgradeToPro("block-fingerprint"),t.preventDefault()):(e(".block-voters-section").find('.block-voters[value="no-block"]').prop("checked",!1),e(".block-type-section").removeClass("hide")):0===e(".block-voters:checked").length&&(e(".block-type-section").addClass("hide"),e(".block-length-section").addClass("hide"))}),e(".block-length-type").on("change",function(t){"limited-time"===e(this).val()?e(".block-length-section").removeClass("hide"):e(".block-length-section").addClass("hide")}),e(".poll-options-access").on("change",".limit-votes-per-user",function(t){"yes"===e(this).val()?e(this).closest(".poll-options-access").find(".votes-per-user-section").removeClass("hide"):e(this).closest(".poll-options-access").find(".votes-per-user-section").addClass("hide")}),e(".block-for-value").change(function(){""!==e(this).val()&&e(this).parent().removeClass("has-error")})}),jQuery(document).ready(function(i){var s=1,a=1;i("#sortable").sortable({appendTo:document.body,items:"> .answer-block",axis:"y"}),i(".poll-elements-list").sortable({axis:"y",handle:".title-bar",start:function(t,e){i(".poll-elements").find(".poll-element").each(function(t){i(this).find(".content").first().hide()})},stop:function(t,e){}}),i(".poll-elements-list").find(".answers").sortable(),i(".poll-elements").on("click",".poll-element-collapse",function(t){var e=i(this).closest(".poll-element").find(".content-inside").first(),s=i(this);i(e).slideToggle({duration:1e3,complete:function(){var t=i(e).is(":visible");i(this).removeClass("toggle-in-action"),!0===t?(i(s).find("span").addClass("glyphicon-chevron-up"),i(s).find("span").removeClass("glyphicon-chevron-down"),i(s).closest(".title-bar").removeClass("collapsed")):(i(s).find("span").addClass("glyphicon-chevron-down"),i(s).find("span").removeClass("glyphicon-chevron-up"),i(s).closest(".title-bar").addClass("collapsed"),i(s).show())}}),t.preventDefault()}),i(".add-custom-field").draggable({helper:function(t){var e=i(".custom-field-definition").find(".poll-element").clone();return i(e)},connectToSortable:".poll-elements-list",start:function(t,e){e.helper.css("width",""),e.helper.find(".content-inside").hide(),e.helper.find(".custom-field-options").hide(),e.helper.find(".title-bar").addClass("collapsed")},drag:function(t,e){e.helper.css("width",i(".poll-elements").css("width"))},stop:function(t,e){e.helper.css({width:"",height:""}),e.helper.closest('.poll-element[data-type="custom-field"]').attr("data-uid","el-"+s),s++,e.helper.find(".poll-element-collapse").first().trigger("click")}}),i(".add-custom-field").click(function(t){var e=i(".custom-field-definition").find(".poll-element").clone();e.closest('.poll-element[data-type="custom-field"]').attr("data-uid","el-"+s),s++,i(".poll-elements-list").append(e),toastr.success(objectL10n.yopPollParams.elementAdded),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-more",function(t){i(this).closest(".poll-element").find(".custom-field-options").show(),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-clone",function(t){i(this).closest(".poll-element").after(i(this).closest(".poll-element").clone().attr({"data-id":"","data-uid":"el-"+s})),s++,t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-delete",function(t){var e,s,a=i(this);BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteCustomFieldMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&(""!==(e=i(a).closest('.poll-element[data-type="custom-field"]').attr("data-id"))&&(""===(s=i(".poll-elements-list").attr("data-remove"))?i(".poll-elements-list").attr("data-remove",e):i(".poll-elements-list").attr("data-remove",s+","+e)),i(a).closest(".poll-element").remove())}}),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-required",function(t){var e=i(this).is(":checked");i(this).closest(".poll-element").find(".custom-field-make-required").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-make-required",function(t){var e=i(this).is(":checked");i(this).closest(".poll-element").find(".custom-field-required").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("click",".custom-field-edit-done",function(t){i(this).closest(".poll-element").find(".custom-field-options").hide(),t.preventDefault()}),i(".poll-elements").on("change",".custom-field-type",function(t){"textfield"!==i(this).val()&&(showUpgradeToPro("text-block"),i('.custom-field-type option[value="textfield"]').prop("selected",!0))}),i(".add-text-question").click(function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").on("click",".text-question-edit-clone",function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").on("click",".text-question-edit-delete",function(t){showUpgradeToPro("text-question"),t.preventDefault()}),i(".poll-elements").find("INPUT.answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(".add-media-question").click(function(t){showUpgradeToPro("media-question"),t.preventDefault()}),i(".add-space-separator").click(function(t){showUpgradeToPro("space-separator"),t.preventDefault()}),i(".add-text-block").click(function(t){showUpgradeToPro("text-block"),t.preventDefault()}),i(".poll-elements").on("click",".add-text-answer",function(t){var e=i(".text-answer-definition").find(".answer").clone().attr("data-uid","subEl-"+a);a++,i(e).find(".answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(this).closest('.poll-element[data-type="text-question"]').find(".answers").append(i(e)),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-more",function(t){i(this).closest(".answer").find(".answer-options").show(),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-clone",function(t){var e=i(this).closest(".answer"),s=i(e).clone().attr({"data-id":"","data-uid":"subEl-"+a});a++,i(s).find(".answer-results-color").minicolors("destroy"),i(s).find(".answer-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(e).after(i(s)),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-delete",function(t){var e,s,a=i(this);BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteAnswerMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&(""!==(e=i(a).closest(".answer").attr("data-id"))&&(""===(s=i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove"))?i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove",e):i(a).closest('.poll-element[data-type="text-question"]').attr("data-remove",s+","+e)),i(a).closest(".answer").remove())}}),t.preventDefault()}),i(".poll-elements").on("click",".text-answer-edit-done",function(t){i(this).closest(".answer-options").hide(),t.preventDefault()}),i(".poll-elements").on("change",".answer-is-default",function(t){var e=i(this).is(":checked");i(this).closest(".answer").find(".answer-make-default").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".answer-make-default",function(t){var e=i(this).is(":checked");i(this).closest(".answer").find(".answer-is-default").prop("checked",e),t.preventDefault()}),i(".poll-elements").on("change",".answer-make-link",function(t){!0===i(this).is(":checked")?i(this).closest(".answer").find(".answer-link-section").removeClass("hide"):i(this).closest(".answer").find(".answer-link-section").addClass("hide"),t.preventDefault()}),i(".poll-elements").on("change",".allow-other-answers",function(t){"yes"===i(this).val()?i(this).closest(".question-options").find(".other-answers-section").removeClass("hide"):i(this).closest(".question-options").find(".other-answers-section").addClass("hide")}),i(".poll-elements").find("INPUT.other-answers-results-color").minicolors({position:"top right",inline:!1,theme:"bootstrap"}),i(".poll-elements").on("change",".display-other-answers-in-results",function(t){"yes"===i(this).val()?i(this).closest(".other-answers-section").find(".other-answers-results-color-section").removeClass("hide"):i(this).closest(".other-answers-section").find(".other-answers-results-color-section").addClass("hide"),t.preventDefault()}),i(".poll-elements").on("change",".allow-multiple-answers",function(t){"yes"===i(this).val()?i(this).closest(".question-options").find(".multiple-answers-section").removeClass("hide"):i(this).closest(".question-options").find(".multiple-answers-section").addClass("hide")}),i(".poll-elements").on("change",".answers-display",function(t){"columns"===i(this).val()?(i(this).closest(".question-options").find(".answers-display-section").removeClass("hide"),i(this).closest(".question-options").find(".answers-columns").val("2")):i(this).closest(".question-options").find(".answers-display-section").addClass("hide")}),i(".poll-elements").on("change",".other-answers-type",function(t){"textfield"!==i(this).val()&&(showUpgradeToPro("other-answers-type"),i('.answers-sort option[value="as-defined"]').prop("selected",!0))}),i(".poll-elements").on("change",".answers-sort",function(t){"as-defined"!==i(this).val()&&(showUpgradeToPro("sort-answers"),i('.answers-sort option[value="as-defined"]').prop("selected",!0))}),i(".question-text-edit").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".answer-edit-text").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".answers-columns").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".poll-elements").on("input",".question-value",function(){var t="";t=""===i(this).val().trim()?i(this).attr("placeholder"):i(this).val().substring(0,50),i(this).closest(".poll-element").find(".element-title").text(t)}),i(".poll-elements").on("input",".custom-field-name",function(){var t="";t=""===i(this).val().trim()?i(this).attr("placeholder"):i(this).val().substring(0,50),i(this).closest(".poll-element").find(".element-title").text(t)})}),jQuery(document).ready(function(s){s(".start-date-custom-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".start-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change(),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+":"+date("M d, Y @ H:i",e))},onClose:function(){var t;null!==s(".start-date-custom-hidden").datetimepicker("getDate")&&(t=moment(s(".start-date-custom-hidden").datetimepicker("getDate")).unix(),s(".start-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change(),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+": "),s("#timestamp").text(objectL10n.yopPollParams.publishDateSchedule+": "+date("M d, Y @ H:i",t)))}}),s(".end-date-custom-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".end-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".end-date-custom-hidden").datetimepicker("getDate")&&(t=moment(s(".end-date-custom-hidden").datetimepicker("getDate")).unix(),s(".end-date-custom").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".poll-vote-button").on("change",".show-results-link",function(t){"yes"===s(this).val()?s(".results-link-option").removeClass("hide"):s(".results-link-option").addClass("hide")}),s(".poll-preferences").on("change",".start-date-option",function(t){"custom"===s(this).val()?s(this).closest(".poll-preferences").find(".start-date-section").removeClass("hide"):(s(this).closest(".poll-preferences").find(".start-date-section").addClass("hide"),s("#timestamp").text(objectL10n.yopPollParams.publishDateImmediately))}),s(".poll-preferences").on("click",".show-start-date",function(t){s(".start-date-custom-hidden").datepicker("show"),t.preventDefault()}),s(".poll-preferences").on("click",".show-end-date",function(t){s(".end-date-custom-hidden").datepicker("show"),t.preventDefault()}),s(".poll-preferences").on("change","select.end-date-option",function(t){"custom"===s(this).val()?s(this).closest(".poll-preferences").find(".end-date-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".end-date-section").addClass("hide")}),s(".poll-preferences").on("change",".redirect-after-vote",function(t){"yes"===s(this).val()?s(this).closest(".poll-preferences").find(".redirect-url-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".redirect-url-section").addClass("hide")}),s(".poll-preferences").on("change",".reset-poll-stats-automatically",function(t){"yes"===s(this).val()?s(this).closest(".poll-preferences").find(".reset-poll-stats-section").removeClass("hide"):s(this).closest(".poll-preferences").find(".reset-poll-stats-section").addClass("hide")}),s(".reset-poll-stats-on-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".reset-poll-stats-on").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".reset-poll-stats-on-hidden").datetimepicker("getDate")&&(t=moment(s(".reset-poll-stats-on-hidden").datetimepicker("getDate")).unix(),s(".reset-poll-stats-on").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".poll-preferences").on("click",".show-reset-poll-stats-on",function(t){s(".reset-poll-stats-on-hidden").datepicker("show"),t.preventDefault()}),s(".poll-notifications").on("change",".send-email-notifications",function(t){"yes"===s(this).val()?s(this).closest(".poll-notifications").find(".send-email-notifications-section").removeClass("hide"):s(this).closest(".poll-notifications").find(".send-email-notifications-section").addClass("hide")}),s(".vote-button-label").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".results-label-text").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".start-date-custom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".end-date-custom").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".redirect-url").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-from-name").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-from-email").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-recipients").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-subject").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".email-notifications-message").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-compliance").on("change",".enable-gdpr",function(t){"yes"===s(this).val()?(s(this).closest(".poll-compliance").find(".gdpr-solution-section").removeClass("hide"),"consent"===s(".gdpr-solution").val()?s(this).closest(".poll-compliance").find(".gdpr-consent-section").removeClass("hide"):s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide")):(s(this).closest(".poll-compliance").find(".gdpr-solution-section").addClass("hide"),s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide"))}),s(".poll-compliance").on("change",".gdpr-solution",function(t){"consent"===s(this).val()?s(this).closest(".poll-compliance").find(".gdpr-consent-section").removeClass("hide"):s(this).closest(".poll-compliance").find(".gdpr-consent-section").addClass("hide")})}),jQuery(document).ready(function(s){s(".show-results-moment").click(function(t){!0===s(this).is(":checked")?"never"===s(this).val()?(s('.show-results-moment[value!="never"]').prop("checked",!1),s(".show-results-to-section").addClass("hide"),s(".custom-date-results-section").addClass("hide"),s(".show-results-details-section").addClass("hide")):(s('.show-results-moment[value="never"]').prop("checked",!1),"custom-date"===s(this).val()&&s(".custom-date-results-section").removeClass("hide"),s(".show-results-to-section").removeClass("hide"),s(".show-results-details-section").removeClass("hide")):(0===s(".show-results-moment:checked").length&&(s(".show-results-to-section").addClass("hide"),s(".custom-date-results-section").addClass("hide"),s(".show-results-details-section").addClass("hide")),"custom-date"===s(this).val()&&s(".custom-date-results-section").addClass("hide"))}),s(".custom-date-results-hidden").datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"HH:mm",onSelect:function(t){var e;e=moment(t,"YYYY-MM-DD HH:mm").unix(),s(".custom-date-results").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,e)).change()},onClose:function(){var t;null!==s(".custom-date-results-hidden").datetimepicker("getDate")&&(t=moment(s(".custom-date-results-hidden").datetimepicker("getDate")).unix(),s(".custom-date-results").val(date(objectL10n.yopPollParams.timeFormat+" "+objectL10n.yopPollParams.dateFormat,t)).change())}}),s(".custom-date-results-section").on("click",".show-custom-date-results",function(t){s(".custom-date-results-hidden").datepicker("show"),t.preventDefault()}),s(".poll-results-options").on("change",".back-to-vote-option",function(t){"yes"===s(this).val()?s(this).closest(".poll-results-options").find(".back-to-vote-caption-section").removeClass("hide"):s(this).closest(".poll-results-options").find(".back-to-vote-caption-section").addClass("hide")}),s(".poll-results-options").on("change",".sort-results",function(t){"alphabetical"===s(this).val()||"number-of-votes"===s(this).val()?s(this).closest(".poll-results-options").find(".sort-results-rule-section").removeClass("hide"):s(this).closest(".poll-results-options").find(".sort-results-rule-section").addClass("hide")}),s(".custom-date-results").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".back-to-vote-caption").change(function(){""!==s(this).val()&&s(this).parent().removeClass("has-error")}),s(".poll-results-options").on("change",".display-results-as",function(t){"pie"===s(this).val()&&(showUpgradeToPro("pie-results"),t.preventDefault())})});var YOPPollBasicIsVotingEnded,YOPPollBasicIsVotingStarted,YOPPollBasicIsAllowMultipleAnswers,YOPPollBasicIsAnswerDefault,YOPPollBasicIsAnswerLink,YOPPollBasicGetAnswersCount,YOPPollBasicHasGdpr,YOPPollBasicHasCaptcha,YOPPollBasicFormatVotePermissions,YOPPollBasicGetResultsBeforeVoteSettings,YOPPollBasicDoAnonymousVote,YOPPollBasicGetPollElements,YOPPollBasicDoTextQuestion,YOPPollBasicDoVerticalText,YOPPollBasicDoHorizontalText,YOPPollBasicDoColumnsText,YOPPollBasicDoCustomField,YOPPollBasicCreateMediaAnswer,YOPPollBasicDoMediaQuestion,YOPPollBasicDoVerticalMedia,YOPPollBasicDoHorizontalMedia,YOPPollBasicDoColumnsMedia,YOPPollBasicDoSpaceSeparator,YOPPollBasicDoTextBlock,YOPPollBasicShowResultsLink,YOPPollBasicShowBackToVoteLink,YOPPollBasicDoShowTotalVotesAndAnswers,YOPPollBasicProcessElements,YOPPollBasicDoShowResultsBeforeVote,YOPPollBasicShowLivePreviewFor,YOPPollBasicShowLivePreviewForVoting,YOPPollBasicShowLivePreviewForResults,YOPPollDoPrettyBasic,YOPPollRemovePrettyBasic,YOPPollBasicIsResultsShowPercentages,YOPPollBasicIsResultsShowVotes,YOPPollBasicGetClassForColumns,randomMin=1,randomMax=100;jQuery(document).ready(function(m){var s=[[]];YOPPollBasicSanitizeField=function(t){return m("<div>").text(t).html()},YOPPollBasicIsVotingEnded=function(t,e){var s=strtotime(e);return"custom"===t&&parseInt(s,10)<parseInt(objectL10n.yopPollParams.timeNow,10)},YOPPollBasicIsVotingStarted=function(t,e){var s=strtotime(e);return"custom"!==t||!(parseInt(s,10)>parseInt(objectL10n.yopPollParams.timeNow,10))},YOPPollBasicIsAllowMultipleAnswers=function(t){return"yes"===t?"checkbox":"radio"},YOPPollBasicIsAnswerDefault=function(t){return!0===t.is(":checked")?"checked":""},YOPPollBasicIsAnswerLink=function(t,e,s){return(!0===t.is(":checked")&&""!==e?'<a href="'+htmlEncode(e)+'" target="_blank">'+htmlEncode(s)+"</a>":htmlEncode(s)).replace("[br]","</br>").replace("[p]","<p>").replace("[/p]","</p>").replace("[strong]","<strong>").replace("[/strong]","</strong>").replace("[u]","<u>").replace("[/u]","</u>").replace("[i]","<i>").replace("[/i]","</i>")},YOPPollBasicGetAnswersCount=function(t){var e=t.find(".answer").length;return"yes"===t.find(".allow-other-answers").val()&&e++,e.toString()},YOPPollBasicFormatVotePermissions=function(t){var e=0,s=[];for(e in t)s.push(t[e].id);return s},YOPPollBasicGetResultsBeforeVoteSettings=function(t){return resultsBeforeVoteData=' data-show-results-to="'+t["show-results-to"].join()+'" data-show-results-moment="'+t["show-results-moment"].join()+'" data-show-results-only="false" data-show-results-as="'+t["display-results-as"]+'" data-sort-results-by="'+t["sort-results-by"]+'" data-sort-results-rule="'+t["sort-results-rule"]+'" data-resdet="'+t["show-details-as"].join()+'"',resultsBeforeVoteData},YOPPollBasicGetClassForColumns=function(t){var e="";switch(t){case"2":e="col-xs-6 col-sm-6 col-md-6";break;case"3":e="col-xs-6 col-sm-6 col-md-4";break;case"4":e="col-xs-6 col-sm-6 col-md-3";break;case"5":e="col-xs-6 col-sm-6 cols-5";break;case"6":e="col-xs-6 col-sm-6 col-md-2";break;case"7":e="col-xs-6 col-sm-6 cols-7";break;case"8":e="col-xs-6 col-sm-6 cols-8";break;case"9":e="col-xs-6 col-sm-6 cols-9";break;case"10":e="col-xs-6 col-sm-6 cols-10";break;case"11":e="col-xs-6 col-sm-6 cols-11";break;case"12":e="col-xs-6 col-sm-6 col-md-1"}return e},YOPPollBasicDoAnonymousVote=function(t){var e="";return-1<m.inArray("guest",t)&&(e='<div class="basic-anonymous"><button type="button" class="btn btn-default"><span class="dashicons dashicons-businessperson"></span>'+htmlEncode(objectL10n.yopPollParams.previewParams.annonymousVoteText)+"</button></div>"),e},YOPPollBasicGetPollElements=function(){var s="",a=m(".poll-elements-list").find(".poll-element").length;return m(".poll-elements-list").find(".poll-element").each(function(t){var e=t+1;switch(m(this).attr("data-type")){case"text-question":s+=YOPPollBasicDoTextQuestion(m(this),e);break;case"custom-field":s+=YOPPollBasicDoCustomField(m(this),e)}t<a&&(s+='<div class="clearfix"></div>')}),s},YOPPollBasicDoTextQuestion=function(t,e){var s="",a="";switch(t.find(".answers-display").val()){case"vertical":a="basic-question-text-vertical",s=YOPPollBasicDoVerticalText(t,e);break;case"horizontal":a="basic-question-text-horizontal",s=YOPPollBasicDoHorizontalText(t,e);break;case"columns":a="basic-question-text-columns",s=YOPPollBasicDoColumnsText(t,e)}return'<div class="basic-element basic-question '+a+'" data-id="'+e+'" data-type="question" data-question-type="text" data-min="" data-max="" data-display="'+m(t).find(".answers-display").val()+'"><div class="basic-question-title"><h5 style="color:'+m(".questions-style-settings").find(".questions-text-color").val()+"; font-size:"+m(".questions-style-settings").find(".questions-text-size").val()+"px; font-weight:"+m(".questions-style-settings").find(".questions-text-weight").val()+"; text-align:"+m(".questions-style-settings").find(".questions-text-align").val()+';">'+htmlEncode(t.find(".question-value").val())+"</h5></div>"+s+"</div>"},YOPPollBasicDoVerticalText=function(t,s){var a,i,n,o='<ul class="basic-answers">';return a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;n=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),i=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),o+='<li class="basic-answer" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'"><div class="basic-answer-content basic-text-vertical"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+n+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+i+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(o+='<li class="basic-answer basic-other-answer" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-vertical"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+s+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-md-6 col-sm-6 col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),o+="</ul>"},YOPPollBasicDoHorizontalText=function(t,s){var a,i,n,o=YOPPollBasicGetClassForColumns(YOPPollBasicGetAnswersCount(t)),r='<ul class="basic-answers basic-h-answers">';return answersCount=YOPPollBasicGetAnswersCount(t),a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;n=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),i=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),r+='<li class="basic-answer '+o+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+n+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+i+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(r+='<li class="basic-answer basic-other-answer '+o+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+(answersCount+1)+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),r+="</ul>"},YOPPollBasicDoColumnsText=function(t,s){var a,i,n="",o="",e=YOPPollBasicGetAnswersCount(t),r=YOPPollBasicGetClassForColumns(t.find(".answers-columns").val());return a=YOPPollBasicIsAllowMultipleAnswers(t.find(".allow-multiple-answers").val()),i='<ul class="basic-answers basic-h-answers basic-cols-display">',t.find(".answer").each(function(t){var e=Math.floor(Math.random()*(randomMax-randomMin+1))+randomMin;o=YOPPollBasicIsAnswerDefault(m(this).find(".answer-is-default")),n=YOPPollBasicIsAnswerLink(m(this).find(".answer-make-link"),m(this).find(".answer-link").val(),m(this).find(".answer-value").val()),i+='<li class="basic-answer '+r+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;" data-id="'+t+'" data-type="text" data-vn="'+e+'" data-color="'+m(this).find(".answer-results-color").val()+'""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+"]["+(t+1)+']" class="basic-answer-label"><input type="'+a+'" id="answer['+s+"]["+(t+1)+']" name="answer['+s+']" value="'+t+'"'+o+'><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+n+"</span></label></div></li>"}),"yes"===t.find(".allow-other-answers").val()&&(i+='<li class="basic-answer basic-other-answer '+r+'" style="padding:'+m(".answers-style-settings").find(".answers-padding-top-bottom").val()+"px "+m(".answers-style-settings").find(".answers-padding-left-right").val()+'px;""><div class="basic-answer-content basic-text-horizontal"><label for="answer['+s+'][0]" class="basic-answer-label"><input type="'+a+'" id="answer['+s+'][0]" name="answer['+(e+1)+']" value="0"><span class="basic-text" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+htmlEncode(t.find(".other-answers-label").val())+'</span></label></div><div class="col-xs-12"><input class="basic-input-text form-control" type="text" name="answer['+s+']" data-type="other-answer"></div></li>'),i+="</ul>"},YOPPollBasicDoCustomField=function(t,e){return'<div class="basic-element basic-custom-field" data-id="" data-type="custom-field" data-required=""><div class="basic-custom-field-title"><label>'+htmlEncode(t.find(".custom-field-name").val())+'</label></div><div class="col-md-6 col-sm-6 col-xs-12"><input type="text" name="cfield[]" class="basic-input-text form-control" data-type="cfield"></div></div>'},YOPPollBasicProcessElements=function(t){"yes"===m(".enable-gdpr").val()&&"consent"===m(".gdpr-solution").val()?m(t).find(".basic-gdpr").show():m(t).find(".basic-gdpr").hide(),"yes"===m(".show-total-votes").val()||"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats").show():m(t).find(".basic-stats").hide(),"yes"===m(".show-total-votes").val()?(m(t).find(".basic-stats-votes").show(),"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats-separator").show():m(t).find(".basic-stats-separator").hide()):(m(t).find(".basic-stats-votes").hide(),m(t).find(".basic-stats-separator").hide()),"yes"===m(".show-total-answers").val()?m(t).find(".basic-stats-answers").show():m(t).find(".basic-stats-answers").hide(),"yes"===m(".show-results-link").val()?m(t).find(".basic-results-button").css("display","inline-block"):m(t).find(".basic-results-button").css("display","none"),m(t).find(".basic-back-to-vote-button").css("display","none")},YOPPollBasicBuildAnswerResultsDetails=function(t,e,s){var a="";return-1!==t.indexOf("percentages")&&(a=(a=0<s?100*e/s:0)===Math.round(a)?Math.round(a)+"%":Number(Math.round(a+"e2")+"e-2").toFixed(2)+"%"),-1!==t.indexOf("votes-number")&&(a+=" ("+e+" "+(1===parseInt(e,10)?objectL10n.yopPollParams.resultsParams.singleVote:objectL10n.yopPollParams.resultsParams.multipleVotes)+")"),a},YOPPollBasicIsResultsShowPercentages=function(t,e,s){var a=[];return-1!==m(t).attr("data-resdet").indexOf("percentages")?(a.show=!0,a.content=0<s?100*e/s:0,a.content===Math.round(a.content)?a.content=Math.round(a.content)+"%":a.content=Number(Math.round(a.content+"e2")+"e-2").toFixed(2)+"%"):(a.show=!1,a.content=""),a},YOPPollBasicIsResultsShowVotes=function(t,e){var s=[];return-1!==m(t).attr("data-resdet").indexOf("votes-number")?(s.show=!0,votesText=1===parseInt(e,10)?objectL10n.yopPollParams.resultsParams.singleVote:objectL10n.yopPollParams.resultsParams.multipleVotes,s.content=" ("+e+" "+votesText+")"):(s.show=!1,s.content=""),s},YOPPollBasicDoShowResultsBeforeVote=function(c){var d=m(c).attr("data-show-results-as"),u=m(c).attr("data-sort-results-by"),p=m(c).attr("data-sort-results-rule"),h=m(c).attr("data-resdet");s[1]=[],m(c).find(".basic-question").each(function(){m(this).attr("data-id");var s=m(this).attr("data-question-type"),a=[],t=[],e=[],n=[],o=[],r=[],l=0;switch(i=0,m(this).find('.basic-answer:not(".basic-other-answer")').each(function(t){var e={};e.id=m(this).attr("data-id"),e.label="text"===s?m(this).find(".basic-text").text():"pie"===d?m(this).find(".basic-media-text").text():m(this).find(".basic-media-content").html(),e.backgroundColor=m(this).attr("data-color"),e.votes=parseInt(m(this).attr("data-vn"),10),a.push(e),l+=e.votes}),p){case"asc":p="ASC";break;case"desc":p="DESC";break;default:p="ASC"}switch(u){case"alphabetical":r=helper.arr.multisort(a,["label"],[p]);break;case"number-of-votes":r=helper.arr.multisort(a,["votes"],[p]);break;default:r=a}for(i=0;i<r.length;i++)t.push(r[i].id),e.push(r[i].label+" "+YOPPollBasicBuildAnswerResultsDetails(h,r[i].votes,l)),o.push(r[i].votes),n.push(r[i].backgroundColor);switch({labels:e,datasets:[{data:o,backgroundColor:n}]},d){case"bar":for(i=0;i<e.length;i++)answerResultsPercentages=YOPPollBasicIsResultsShowPercentages(c,o[i],l),answerResultsVotes=YOPPollBasicIsResultsShowVotes(c,o[i]),!0===answerResultsPercentages.show&&m(this).find(".basic-answer[data-id="+t[i]+"]").find(".basic-answer-label").append('<span class="basic-answer-results-details">'+answerResultsPercentages.content+"</label>"),!0===answerResultsVotes.show&&m(this).find(".basic-answer[data-id="+t[i]+"]").find(".basic-answer-label").append('<span class="basic-answer-total-votes" style="color:'+m(".answers-style-settings").find(".answers-text-color").val()+"; font-size:"+m(".answers-style-settings").find(".answers-text-size").val()+"px; font-weight:"+m(".answers-style-settings").find(".answers-text-weight").val()+';">'+answerResultsVotes.content+"</span>"),m(this).find(".basic-answer[data-id="+t[i]+"]").append('<div class="progress" style=""><div class="progress-bar six-sec-ease-in-out" role="progressbar" data-transitiongoal="'+o[i]+'" aria-valuemax="'+l+'" style="background-image:none; background-color: '+n[i]+';"></div></div>');m(this).find(".progress .progress-bar").yopprogressbar()}})},YOPPollBasicClearResults=function(t){var e=m(t).attr("data-id");if(void 0!==s[e])for(i=1;i<=s[e].length;i++)s[e][i-1].destroy(),s[e].splice(i-1,1);m(t).find(".basic-answer-results-details").remove(),m(t).find(".basic-answer-total-votes").remove(),m(t).find(".progress").remove(),m(t).find(".basic-answer-results").remove(),m(t).find(".basic-chart-container").remove()},YOPPollBasicShowLivePreviewFor=function(t,e){switch(t){case"voting":YOPPollBasicShowLivePreviewForVoting(e);break;case"results":YOPPollBasicShowLivePreviewForResults(e);break;default:YOPPollBasicShowLivePreviewForVoting(e)}},YOPPollBasicShowLivePreviewForVoting=function(t){m(t).attr("data-temp");var e=m(t).attr("data-show-results-moment");YOPPollBasicClearResults(t),m(t).find(".basic-answers").show(),m(t).find(".basic-results-button").hide(),m(t).find(".basic-vote-button").show(),m(t).find(".basic-element").show(),m(t).find('input[type="radio"]').show(),m(t).find('input[type="checkbox"]').show(),m(t).find(".basic-other-answer").show(),m(t).find(".basic-captcha").show(),YOPPollBasicProcessElements(t),void 0!==e&&-1!==m(t).attr("data-show-results-moment").indexOf("before-vote")&&YOPPollBasicDoShowResultsBeforeVote(t),event.preventDefault()},YOPPollBasicBuildDataForResults=function(t){var a=[];return m(t).find(".basic-question").each(function(){var e={},s=m(this);e.id=m(this).attr("data-id"),e.type=m(this).attr("data-question-type"),e.text=m(this).find(".basic-question-title").text(),e.answers=[],m(this).find(".basic-answers").find(".basic-answer").not(".basic-other-answer").each(function(){var t=[];t.id=m(this).attr("data-id"),"media"===m(s).attr("data-question-type")?t.text=m(this).find(".basic-media-text").text():t.text=m(this).find(".basic-text").text(),t.type=m(this).attr("data-type"),t.color=m(this).attr("data-color"),t.votes=m(this).attr("data-vn"),e.answers.push(t)}),a.push(e)}),a},YOPPollBasicShowLivePreviewForResults=function(t){YOPPollBasicClearResults(t),m(t).find(".basic-answer").find('input[type="radio"]').hide(),m(t).find(".basic-answer").find('input[type="checkbox"]').hide(),m(t).find(".basic-other-answer").hide(),m(t).find(".basic-custom-field").hide(),m(t).find(".basic-gdpr").hide(),m(t).find(".basic-captcha").hide(),m(t).find(".basic-vote-button").hide(),m(t).find(".basic-results-button").hide(),"yes"===m(".back-to-vote-option").val()&&m(t).find(".basic-back-to-vote-button").show(),YOPPollBasicDoShowResultsBeforeVote(t)}}),jQuery(document).ready(function(r){YOPPollBasicShowLivePreview=function(){var t,e,s,a,i,n=[],o={accessibilityAlt:objectL10n.yopPollParams.captchaParams.accessibilityAlt,accessibilityTitle:objectL10n.yopPollParams.captchaParams.accessibilityTitle,accessibilityDescription:objectL10n.yopPollParams.captchaParams.accessibilityDescription,explanation:objectL10n.yopPollParams.captchaParams.explanation,refreshAlt:objectL10n.yopPollParams.captchaParams.refreshAlt,refreshTitle:objectL10n.yopPollParams.captchaParams.refreshTitle};return n["show-results-moment"]=[],n["show-results-to"]=[],n["show-details-as"]=[],n["sort-results-by"]=r(".sort-results").val(),n["sort-results-rule"]=r(".sort-results-rule").val(),n["display-results-as"]=r(".display-results-as").val(),r(".show-results-moment:checked").each(function(t){n["show-results-moment"].push(r(this).val())}),r(".show-results-to:checked").each(function(t){n["show-results-to"].push(r(this).val())}),r(".results-details-option:checked").each(function(t){n["show-details-as"].push(r(this).val())}),e=YOPPollBasicGetResultsBeforeVoteSettings(n),!0===YOPPollBasicIsVotingEnded(r(".end-date-option").val(),r(".end-date-custom-hidden").val())?t='<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+";border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px;border-style:solid;border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+";border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px;padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px; "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p style="color:'+r(".errors-style-settings").find(".errors-text-color").val()+"; font-size:"+r(".errors-style-settings").find(".errors-text-size").val()+"px; font-weight:"+r(".errors-style-settings").find(".errors-text-weight").val()+';">'+objectL10n.yopPollParams.votingEnded+"</p></div></div></div></div></div>":(t=!1===YOPPollBasicIsVotingStarted(r(".start-date-option").val(),r(".start-date-custom-hidden").val())?'<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+";border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px;border-style:solid;border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+";border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px;padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px; "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p style="color:'+r(".errors-style-settings").find(".errors-text-color").val()+"; font-size:"+r(".errors-style-settings").find(".errors-text-size").val()+"px; font-weight:"+r(".errors-style-settings").find(".errors-text-weight").val()+';">'+objectL10n.yopPollParams.votingNotStarted+"</p></div></div></div></div></div>":(a=YOPPollBasicGetPollElements(),'<div class="bootstrap-yop"><div class="basic-yop-poll-container" style="background-color:'+r(".poll-style-settings").find(".poll-background-color").val()+"; border:"+r(".poll-style-settings").find(".poll-border-size").val()+"px; border-style:solid; border-color:"+r(".poll-style-settings").find(".poll-border-color").val()+"; border-radius:"+r(".poll-style-settings").find(".poll-border-radius").val()+"px; padding:"+r(".poll-style-settings").find(".poll-padding-top-bottom").val()+"px "+r(".poll-style-settings").find(".poll-padding-left-right").val()+'px"'+e+' data-uid="" data-temp="'+r('li[data-template-id="'+r('input[name="poll[template]"]').val()+'"]').attr("data-template-base")+'" data-skin="'+r(".answers-style-settings").find(".answers-skin").val()+'" data-cscheme="'+r(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")+'"><div class="row"><div class="col-md-12"><div class="basic-inner"><div class="basic-message hide" style="border-left:'+r(".errors-style-settings").find(".errors-border-left-size").val()+"px solid "+r(".errors-style-settings").find(".errors-border-left-color-for-error").val()+"; padding:"+r(".errors-style-settings").find(".errors-padding-top-bottom").val()+'px 10px;"><p></p></div><div class="basic-overlay hide"><div class="basic-vote-options"><div class="basic-anonymous"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.annonymousVoteText+'</button></div><div class="basic-wordpress"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.wordpressVoteText+'</button></div><div class="basic-facebook"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.facebookVoteText+'</button></div><div class="basic-google"><button type="button" class="btn btn-default">'+objectL10n.yopPollParams.previewParams.googleVoteText+'</button></div></div><div class="basic-preloader hide"><div class="basic-windows8"><div class="basic-wBall basic-wBall_1"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_2"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_3"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_4"><div class="basic-wInnerBall"></div></div><div class="basic-wBall basic-wBall_5"><div class="basic-wInnerBall"></div></div></div></div></div><form class="basic-form"><div class="basic-elements">'+a+'</div><div class="clearfix"></div><div class="basic-gdpr"><label><input type="checkbox" name="gdpr-consent">'+htmlEncode(r(".gdpr-consent-text").val())+'</label></div><div id="yop-poll-captcha" class="basic-captcha"></div><div class="basic-stats text-center"><span class="basic-stats-votes"><span class="basic-stats-votes-number">10</span><span class="basic-stats-votes-text"> '+objectL10n.yopPollParams.previewParams.numberOfVotesPlural+'</span></span><span class="basic-stats-separator"> · </span><span class="basic-stats-answers"><span class="basic-stats-answers-number">14</span><span class="basic-stats-answers-text"> '+objectL10n.yopPollParams.previewParams.numberOfAnswersPlural+'</span></span></div><div class="basic-vote"><a href="#" class="button basic-vote-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".vote-button-label").val())+'</a><a href="#" class="button basic-results-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".results-label-text").val())+'</a><a href="#" class="button basic-back-to-vote-button" style="background:'+r(".buttons-style-settings").find(".buttons-background-color").val()+"; border:"+r(".buttons-style-settings").find(".buttons-border-size").val()+"px; border-style: solid; border-color:"+r(".buttons-style-settings").find(".buttons-border-color").val()+"; border-radius:"+r(".buttons-style-settings").find(".buttons-border-radius").val()+"px; padding:"+r(".buttons-style-settings").find(".buttons-padding-top-bottom").val()+"px "+r(".buttons-style-settings").find(".buttons-padding-left-right").val()+"px; color:"+r(".buttons-style-settings").find(".buttons-text-color").val()+"; font-size:"+r(".buttons-style-settings").find(".buttons-text-size").val()+"px; font-weight:"+r(".buttons-style-settings").find(".buttons-text-weight").val()+';">'+htmlEncode(r(".back-to-vote-caption").val())+"</a></div></form></div></div></div>"),""!==r(".custom-styles-custom-css").val()&&(r("#yop-poll-custom-css").remove(),r("head").append('<style type="text/css" id="yop-poll-custom-css">'+r(".custom-styles-custom-css").val()+"</style>"))),modalPreview=BootstrapDialog.show({title:objectL10n.yopPollParams.previewParams.pollPreviewTitle,cssClass:"preview-dialog",message:'<div class="row"><div class="col-md-3">'+objectL10n.yopPollParams.previewParams.choosePreviewText+'</div><div class="col-md-9"><select class="show-preview-for admin-select" style="width:100%"><option value="voting" selected>'+objectL10n.yopPollParams.previewParams.votingText+'</option><option value="results">'+objectL10n.yopPollParams.previewParams.resultsText+'</option></select></div></div><div class="row"><div class="col-md-12"><p> </p></div></div>'+t,onshow:function(t){switch(pollContainer=t.getModalBody().find(".basic-yop-poll-container"),void 0!==(s=t.getModalBody().find(".basic-yop-poll-container").attr("data-show-results-moment"))&&-1!==s.indexOf("before-vote")&&YOPPollBasicDoShowResultsBeforeVote(t.getModalBody().find(".basic-yop-poll-container")),r(".use-captcha").val()){case"yes":t.getModalBody().find("#yop-poll-captcha").visualCaptcha({imgPath:objectL10n.yopPollParams.captchaParams.imgPath,captcha:{url:objectL10n.yopPollParams.captchaParams.url,numberOfImages:5,namespace:"yop-poll-captcha",routes:{start:"?_a=start",image:"?_a=image",audio:"?_a=audio"},callbacks:{loading:function(t){},loaded:function(t){}}},language:o});break;case"yes-recaptcha":r(pollContainer).find("#yop-poll-captcha").length&&""!==r("#yop-main-area").attr("data-recaptcha-site-key")&&(reCaptcha=grecaptcha.render(r(pollContainer).find("#yop-poll-captcha")[0],{sitekey:r("#yop-main-area").attr("data-reCaptcha-site-key"),theme:"light"}));break;case"yes-recaptcha-invisible":r(pollContainer).find("#yop-poll-captcha").length&&""!==r("#yop-main-area").attr("data-recaptcha-site-key")&&(reCaptcha=grecaptcha.render(r(pollContainer).find("#yop-poll-captcha")[0],{sitekey:r("#yop-main-area").attr("data-reCaptcha-site-key"),theme:"light",size:"invisible"}),r(pollContainer).find(".grecaptcha-badge").hide())}YOPPollBasicProcessElements(t.getModalBody().find(".basic-yop-poll-container"))}}),i=modalPreview.getModalBody(),r(i).on("change",".show-preview-for",function(t){var e=r(this).val();YOPPollBasicShowLivePreviewFor(e,i.find(".basic-yop-poll-container"))}),i}}),jQuery(document).ready(function(s){YOPPollBasicPrettyShowLivePreview=function(){var t=s(".answers-style-settings").find(".answers-skin").val(),e=s(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id");e="black"===e?"":"-"+e,modalPreviewBody=YOPPollBasicShowLivePreview(),s(modalPreviewBody).find('input[type="radio"]').iCheck({checkboxClass:"icheckbox_"+t+e,radioClass:"iradio_"+t+e}),s(modalPreviewBody).find('input[type="checkbox"]').iCheck({checkboxClass:"icheckbox_"+t+e,radioClass:"iradio_"+t+e})}}),jQuery(document).ready(function(N){function $(t,e,s,a,i){N(".poll-steps li").removeClass("active"),N(".poll-steps li:nth-child("+t+")").addClass("active"),N(".poll-steps-content .tab-pane").removeClass("active"),N(".poll-steps-content .tab-pane:nth-child("+t+")").addClass("active"),N(".poll-steps-content .tab-pane:nth-child("+t+") .submenu-item").removeClass("btn-underline"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-item").eq(e-1).addClass("btn-underline"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-content").addClass("hide"),N(".poll-steps-content .tab-pane:nth-child("+t+")").find(".submenu-content").eq(e-1).removeClass("hide"),""!==s&&(s.focus(),s.parent().addClass("has-error")),""===i?toastr.warning(htmlEncode(striptags(s.closest(".form-group").find(".field-caption").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage))):toastr.warning(htmlEncode(striptags(i)))}N("#publish-poll").click(function(t){var e,s=N('input[name="poll[template]"]').val(),a=N('input[name="poll[skin]"]').attr("data-skin-base"),i=!1,n=N('input[name="poll[name]"]').val(),o=N(".poll-style-settings").find(".poll-background-color").val(),r=N(".poll-style-settings").find(".poll-border-size").val(),l=N(".poll-style-settings").find(".poll-border-color").val(),c=N(".poll-style-settings").find(".poll-border-radius").val(),d=N(".poll-style-settings").find(".poll-padding-left-right").val(),u=N(".poll-style-settings").find(".poll-padding-top-bottom").val(),p=N(".questions-style-settings").find(".questions-text-color").val(),h=N(".questions-style-settings").find(".questions-text-size").val(),m=N(".questions-style-settings").find(".questions-text-weight").val(),f=N(".questions-style-settings").find(".questions-text-align").val(),g=N(".answers-style-settings").find(".answers-padding-left-right").val(),v=N(".answers-style-settings").find(".answers-padding-top-bottom").val(),b=N(".answers-style-settings").find(".answers-text-color").val(),y=N(".answers-style-settings").find(".answers-text-size").val(),w=N(".answers-style-settings").find(".answers-text-weight").val(),k=N(".buttons-style-settings").find(".buttons-background-color").val(),x=N(".buttons-style-settings").find(".buttons-border-size").val(),C=N(".buttons-style-settings").find(".buttons-border-color").val(),_=N(".buttons-style-settings").find(".buttons-border-radius").val(),P=N(".buttons-style-settings").find(".buttons-padding-left-right").val(),A=N(".buttons-style-settings").find(".buttons-padding-top-bottom").val(),M=N(".buttons-style-settings").find(".buttons-text-color").val(),D=N(".buttons-style-settings").find(".buttons-text-size").val(),T=N(".buttons-style-settings").find(".buttons-text-weight").val(),S=N(".errors-style-settings").find(".errors-border-left-color-for-success").val(),E=N(".errors-style-settings").find(".errors-border-left-color-for-error").val(),O=N(".errors-style-settings").find(".errors-border-left-size").val(),L=N(".errors-style-settings").find(".errors-padding-top-bottom").val(),B=N(".errors-style-settings").find(".errors-text-color").val(),I=N(".errors-style-settings").find(".errors-text-size").val(),j=N(".errors-style-settings").find(".errors-text-weight").val(),F=[],Y=[],R=[],z=[],Q=[],H=[];""===n&&(i=!0,N('input[name="poll[name]"]').focus(),N('input[name="poll[name]"]').parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveParams.noPollName)))),!1===i&&""===s&&(i=!0,$(1,1,"",0,objectL10n.yopPollParams.saveParams.noTemplateSelected)),!1===i&&""===a&&(i=!0,$(1,2,"",0,objectL10n.yopPollParams.saveParams.noSkinSelected)),!1===i&&""===o.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-background-color"),0,"")),!1===i&&""===r.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-size"),0,"")),!1===i&&""===l.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-color"),0,"")),!1===i&&""===c.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-radius"),0,"")),!1===i&&""===d.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-left-right"),0,"")),!1===i&&""===u.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-top-bottom"),0,"")),!1===i&&""===p.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-color"),0,"")),!1===i&&""===h.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-size"),0,"")),!1===i&&""===m.toString()&&(i=!0,$(1,3,N(".questions-style-settings").find(".questions-text-weight"),0,"")),!1===i&&""===f.toString()&&(i=!0,$(1,3,N(".questions-style-settings").find(".questions-text-align"),0,"")),!1===i&&""===g.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-left-right"),0,"")),!1===i&&""===v.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-top-bottom"),0,"")),!1===i&&""===b.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-color"),0,"")),!1===i&&""===y.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-size"),0,"")),!1===i&&""===w.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-weight"),0,"")),!1===i&&""===k.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-background-color"),0,"")),!1===i&&""===x.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-size"),0,"")),!1===i&&""===C.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-color"),0,"")),!1===i&&""===_.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-radius"),0,"")),!1===i&&""===P.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-left-right"),0,"")),!1===i&&""===A.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-top-bottom"),0,"")),!1===i&&""===M.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-color"),0,"")),!1===i&&""===D.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-size"),0,"")),!1===i&&""===T.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-weight"),0,"")),!1===i&&""===S.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-success"),0,"")),!1===i&&""===E.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-error"),0,"")),!1===i&&""===O.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-size"),0,"")),!1===i&&""===L.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-padding-top-bottom"),0,"")),!1===i&&""===B.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-color"),0,"")),!1===i&&""===I.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-size"),0,"")),!1===i&&""===j.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-weight"),0,"")),!1===i&&N(".poll-elements-list").find(".poll-element").each(function(){switch(N(this).attr("data-type")){case"text-question":!1===i&&""===N(this).find(".question-value").val()&&(i=!0,$(2,1,N(this).find(".question-value"),0,objectL10n.yopPollParams.saveParams.noQuestion)),N(this).find(".answer").each(function(t){return!1===i&&""===N(this).find(".answer-value").val().toString()?(i=!0,$(2,1,N(this).find(".answer-value"),0,objectL10n.yopPollParams.saveParams.noAnswerText),!1):!1===i&&N(this).find(".answer-make-link").is(":checked")&&""===N(this).find(".answer-link").val().toString()?(i=!0,$(2,1,N(this).find(".answer-link"),0,objectL10n.yopPollParams.saveParams.noAnswerLink),!1):void 0}),!1===i&&"yes"===N(this).find(".allow-other-answers").val()&&""===N(this).find(".other-answers-label").val().toString()&&(i=!0,$(2,1,N(this).find(".other-answers-label"),0,objectL10n.yopPollParams.saveParams.noOtherLabel)),!1===i&&"yes"===N(this).find(".allow-multiple-answers").val()&&(""===N(this).find(".multiple-answers-minim").val()||parseInt(N(this).find(".multiple-answers-minim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers)):""===N(this).find(".multiple-answers-maxim").val()||parseInt(N(this).find(".multiple-answers-maxim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-maxim"),0,objectL10n.yopPollParams.saveParams.noMaxAnswers)):parseInt(N(this).find(".multiple-answers-minim").val(),10)>parseInt(N(this).find(".multiple-answers-maxim").val(),10)&&(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers))),!1===i&&"columns"===N(this).find(".answers-display").val()&&(""===N(this).find(".answers-columns").val().toString()||parseInt(N(this).find(".answers-columns").val(),10)<1)&&(i=!0,$(2,1,N(this).find(".answers-columns"),0,objectL10n.yopPollParams.noNumberOfColumnsDefined));break;case"custom-field":if(!1===i&&""===N(this).find(".custom-field-name").val().toString())return i=!0,$(2,1,N(this).find(".custom-field-name"),0,objectL10n.yopPollParams.saveParams.noCustomFieldName),!1}}),!1===i&&""===N(".vote-button-label").val()&&(i=!0,$(3,1,N(".vote-button-label"),0,"")),!1===i&&"yes"===N(".show-results-link").val()&&""===N(".results-label-text").val()&&(i=!0,$(3,1,N(".results-label-text"),0,"")),!1===i&&"custom"===N(".start-date-option").val()&&""===N(".start-date-custom").val()&&(i=!0,$(3,1,N(".start-date-custom"),0,objectL10n.yopPollParams.saveParams.noStartDate)),!1===i&&"custom"===N(".end-date-option").val()&&""===N(".end-date-custom").val()&&(i=!0,$(3,1,N(".end-date-custom"),0,objectL10n.yopPollParams.saveParams.noEndDate)),!1===i&&"yes"===N(".redirect-after-vote").val()&&""===N(".redirect-url").val()&&(i=!0,$(3,1,N(".redirect-url"),0,"")),!1===i&&"yes"===N(".send-email-notifications").val()&&(!1===i&&""===N(".email-notifications-from-name").val()&&(i=!0,$(3,1,N(".email-notifications-from-name"),0,"")),!1===i&&""===N(".email-notifications-from-email").val()&&(i=!0,$(3,1,N(".email-notifications-from-email"),0,"")),!1===i&&""===N(".email-notifications-recipients").val()&&(i=!0,$(3,1,N(".email-notifications-recipients"),0,"")),!1===i&&""===N(".email-notifications-subject").val()&&(i=!0,$(3,1,N(".email-notifications-subject"),0,"")),!1===i&&""===N(".email-notifications-message").val()&&(i=!0,$(3,1,N(".email-notifications-message"),0,""))),!1===i&&"yes"===N(".enable-gdpr").val()&&"consent"===N(".gdpr-solution").val()&&""===N(".gdpr-consent-text").val()&&(i=!0,$(3,1,N(".gdpr-consent-text"),0,"")),N(".vote-permissions:checked").each(function(t){Y.push(N(this).val())}),!1===i&&0===Y.length&&(i=!0,$(3,2,N(".vote-permissions"),0,"")),N(".block-voters:checked").each(function(t){R.push(N(this).val())}),!1===i&&0<R.length&&-1===N.inArray("no-block",R)&&"limited-time"===N(".block-length-type").val()&&""===N(".block-length-1").val()&&(i=!0,$(3,2,N(".block-length-1"),0,"")),!1===i&&"yes"===N(".limit-votes-per-user").val()&&""===N(".votes-per-user-allowed").val()&&(i=!0,$(3,2,N(".votes-per-user-allowed"),0,"")),N(".show-results-moment:checked").each(function(t){z.push(N(this).val())}),!1===i&&0===z.length&&(i=!0,$(3,3,N(".show-results-moment"),0,objectL10n.yopPollParams.saveParams.noShowResultsMoment)),!1===i&&-1<N.inArray("custom-date",z)&&""===N(".custom-date-results").val()&&(i=!0,$(3,3,N(".custom-date-results"),0,objectL10n.yopPollParams.saveParams.noCustomDate)),N(".show-results-to:checked").each(function(t){Q.push(N(this).val())}),N(".results-details-option:checked").each(function(t){H.push(N(this).val())}),!1===i&&-1===N.inArray("never",z)&&(0===Q.length&&(i=!0,$(3,3,N(".show-results-to"),0,objectL10n.yopPollParams.saveParams.noShowResultsTo)),!1===i&&0===H.length&&(i=!0,$(3,3,N(".results-details-option"),0,objectL10n.yopPollParams.saveParams.noShowResultsDetails))),!1===i&&"yes"===N(".back-to-vote-option").val()&&""===N(".back-to-vote-caption").val()&&(i=!0,$(3,3,N(".back-to-vote-caption"),0,"")),!1===i&&!0===N('input.vote-permissions[value="registered"]').is(":checked")&&"no"===N(".allow-wordpress-votes").val()&&(i=!0,$(3,3,N(".allow-wordpress-votes"),0,objectL10n.yopPollParams.saveParams.noVoteAsWordpress)),!1===i&&(N(".poll-elements-list").find(".poll-element").each(function(t){var e=N(this).attr("data-type"),s=[];switch(e){case"text-question":N(this).find(".answer").each(function(t){s[t]={type:"text",text:N(this).find(".answer-value").val(),options:{makeDefault:N(this).find(".answer-make-default").is(":checked")?"yes":"no",makeLink:N(this).find(".answer-make-link").is(":checked")?"yes":"no",link:N(this).find(".answer-link").val(),resultsColor:N(this).find(".answer-results-color").val()}}}),F.push({type:"text-question",text:N(this).find(".question-value").val(),answers:s,options:{allowOtherAnswers:N(this).find(".allow-other-answers").val(),otherAnswersLabel:N(this).find(".other-answers-label").val(),addOtherAnswers:N(this).find(".add-other-answers").val(),displayOtherAnswersInResults:N(this).find(".display-other-answers-in-results").val(),resultsColorForOtherAnswers:N(this).find(".other-answers-results-color").val(),allowMultipleAnswers:N(this).find(".allow-multiple-answers").val(),multipleAnswersMinim:N(this).find(".multiple-answers-minim").val(),multipleAnswersMaxim:N(this).find(".multiple-answers-maxim").val(),answersDisplay:N(this).find(".answers-display").val(),answersColumns:N(this).find(".answers-columns").val(),answersSort:N(this).find(".answers-sort").val()}});break;case"custom-field":F.push({type:"custom-field",text:N(this).find(".custom-field-name").val(),options:{makeRequired:N(this).find(".custom-field-make-required").is(":checked")?"yes":"no",cType:N(this).find(".custom-field-type").val()}})}}),e={name:N('input[name="poll[name]"]').val(),status:N("#poll_status").val(),design:{template:N('input[name="poll[template]"]').val(),templateBase:N('input[name="poll[template]"]').attr("data-template-base"),skinBase:N('input[name="poll[skin]"]').attr("data-skin-base"),style:{poll:{backgroundColor:N(".poll-background-color").val(),borderSize:N(".poll-border-size").val(),borderColor:N(".poll-border-color").val(),borderRadius:N(".poll-border-radius").val(),paddingLeftRight:N(".poll-padding-left-right").val(),paddingTopBottom:N(".poll-padding-top-bottom").val()},questions:{textColor:N(".questions-text-color").val(),textSize:N(".questions-text-size").val(),textWeight:N(".questions-text-weight").val(),textAlign:N(".questions-text-align").val()},answers:{paddingLeftRight:N(".answers-padding-left-right").val(),paddingTopBottom:N(".answers-padding-top-bottom").val(),textColor:N(".answers-text-color").val(),textSize:N(".answers-text-size").val(),textWeight:N(".answers-text-weight").val(),skin:N(".answers-style-settings").find(".answers-skin").val(),colorScheme:N(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")},buttons:{backgroundColor:N(".buttons-background-color").val(),borderSize:N(".buttons-border-size").val(),borderColor:N(".buttons-border-color").val(),borderRadius:N(".buttons-border-radius").val(),paddingLeftRight:N(".buttons-padding-left-right").val(),paddingTopBottom:N(".buttons-padding-top-bottom").val(),textColor:N(".buttons-text-color").val(),textSize:N(".buttons-text-size").val(),textWeight:N(".buttons-text-weight").val()},captcha:{},errors:{borderLeftColorForSuccess:N(".errors-border-left-color-for-success").val(),borderLeftColorForError:N(".errors-border-left-color-for-error").val(),borderLeftSize:N(".errors-border-left-size").val(),paddingTopBottom:N(".errors-padding-top-bottom").val(),textColor:N(".errors-text-color").val(),textSize:N(".errors-text-size").val(),textWeight:N(".errors-text-weight").val()},custom:{css:N(".custom-styles-custom-css").val()}}},options:{poll:{voteButtonLabel:N(".vote-button-label").val(),showResultsLink:N(".show-results-link").val(),resultsLabelText:N(".results-label-text").val(),showTotalVotes:N(".show-total-votes").val(),showTotalAnswers:N(".show-total-answers").val(),startDateOption:N(".start-date-option").val(),startDateCustom:N(".start-date-custom-hidden").val(),endDateOption:N(".end-date-option").val(),endDateCustom:N(".end-date-custom-hidden").val(),redirectAfterVote:N(".redirect-after-vote").val(),redirectUrl:N(".redirect-url").val(),resetPollStatsAutomatically:N(".reset-poll-stats-automatically").val(),resetPollStatsOn:N(".reset-poll-stats-on-hidden").val(),resetPollStatsEvery:N(".reset-poll-stats-every").val(),resetPollStatsEveryPeriod:N(".reset-poll-stats-every-period").val(),autoGeneratePollPage:N(".auto-generate-poll-page").val(),pageId:"",pageLink:"",useCaptcha:N(".use-captcha").val(),sendEmailNotifications:N(".send-email-notifications").val(),emailNotificationsFromName:N(".email-notifications-from-name").val(),emailNotificationsFromEmail:N(".email-notifications-from-email").val(),emailNotificationsRecipients:N(".email-notifications-recipients").val(),emailNotificationsSubject:N(".email-notifications-subject").val(),emailNotificationsMessage:N(".email-notifications-message").val(),enableGdpr:N(".enable-gdpr").val(),gdprSolution:N(".gdpr-solution").val(),gdprConsentText:N(".gdpr-consent-text").val(),loadWithAjax:N(".load-with-ajax").val(),notificationMessageLocation:N(".poll-options-notification-message-location").val()},access:{votePermissions:Y,allowWordpressVotes:N(".allow-wordpress-votes").val(),blockVoters:R,blockLengthType:N(".block-length-type").val(),blockForValue:N(".block-length-1").val(),blockForPeriod:N(".block-length-2").val(),limitVotesPerUser:N(".limit-votes-per-user").val(),votesPerUserAllowed:N(".votes-per-user-allowed").val()},results:{showResultsMoment:z,customDateResults:N(".custom-date-results-hidden").val(),showResultsTo:Q,resultsDetails:H,backToVoteOption:N(".back-to-vote-option").val(),backToVoteCaption:N(".back-to-vote-caption").val(),sortResults:N(".sort-results").val(),sortResultsRule:N(".sort-results-rule").val(),displayResultsAs:N(".display-results-as").val(),barColor:N(".bar-color").val(),barHeight:N(".bar-height").val()}},elements:F},N(".spinner.publish").addClass("is-active"),N("#publish-poll").attr("disabled",!0),N.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"create_yop_poll",_token:N("#_token").val(),poll:JSON.stringify(e)}}).done(function(t){N(".spinner.publish").removeClass("is-active"),!0===t.success?toastr.success(htmlEncode(striptags(t.data.message)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&show-code=yes&poll-id="+t.data.pollId)}}):(N("#publish-poll").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),N("#update-poll").click(function(t){var e,s=N('input[name="poll[template]"]').val(),a=N('input[name="poll[skin]"]').attr("data-skin-base"),i=!1,n=N('input[name="poll[name]"]').val(),o=N(".poll-style-settings").find(".poll-background-color").val(),r=N(".poll-style-settings").find(".poll-border-size").val(),l=N(".poll-style-settings").find(".poll-border-color").val(),c=N(".poll-style-settings").find(".poll-border-radius").val(),d=N(".poll-style-settings").find(".poll-padding-left-right").val(),u=N(".poll-style-settings").find(".poll-padding-top-bottom").val(),p=N(".questions-style-settings").find(".questions-text-color").val(),h=N(".questions-style-settings").find(".questions-text-size").val(),m=N(".questions-style-settings").find(".questions-text-weight").val(),f=N(".questions-style-settings").find(".questions-text-align").val(),g=N(".answers-style-settings").find(".answers-padding-left-right").val(),v=N(".answers-style-settings").find(".answers-padding-top-bottom").val(),b=N(".answers-style-settings").find(".answers-text-color").val(),y=N(".answers-style-settings").find(".answers-text-size").val(),w=N(".answers-style-settings").find(".answers-text-weight").val(),k=N(".buttons-style-settings").find(".buttons-background-color").val(),x=N(".buttons-style-settings").find(".buttons-border-size").val(),C=N(".buttons-style-settings").find(".buttons-border-color").val(),_=N(".buttons-style-settings").find(".buttons-border-radius").val(),P=N(".buttons-style-settings").find(".buttons-padding-left-right").val(),A=N(".buttons-style-settings").find(".buttons-padding-top-bottom").val(),M=N(".buttons-style-settings").find(".buttons-text-color").val(),D=N(".buttons-style-settings").find(".buttons-text-size").val(),T=N(".buttons-style-settings").find(".buttons-text-weight").val(),S=N(".errors-style-settings").find(".errors-border-left-color-for-success").val(),E=N(".errors-style-settings").find(".errors-border-left-color-for-error").val(),O=N(".errors-style-settings").find(".errors-border-left-size").val(),L=N(".errors-style-settings").find(".errors-padding-top-bottom").val(),B=N(".errors-style-settings").find(".errors-text-color").val(),I=N(".errors-style-settings").find(".errors-text-size").val(),j=N(".errors-style-settings").find(".errors-text-weight").val(),F=[],Y=[],R=[],z=[],Q=[],H=[];""===n&&(i=!0,N('input[name="poll[name]"]').focus(),N('input[name="poll[name]"]').parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveParams.noPollName)))),!1===i&&""===s&&(i=!0,$(1,1,"",0,objectL10n.yopPollParams.saveParams.noTemplateSelected)),!1===i&&""===a&&(i=!0,$(1,2,"",0,objectL10n.yopPollParams.saveParams.noSkinSelected)),!1===i&&""===o.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-background-color"),0,"")),!1===i&&""===r.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-size"),0,"")),!1===i&&""===l.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-color"),0,"")),!1===i&&""===c.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-border-radius"),0,"")),!1===i&&""===d.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-left-right"),0,"")),!1===i&&""===u.toString()&&(i=!0,$(1,2,N(".poll-style-settings").find(".poll-padding-top-bottom"),0,"")),!1===i&&""===p.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-color"),0,"")),!1===i&&""===h.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-size"),0,"")),!1===i&&""===m.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-weight"),0,"")),!1===i&&""===f.toString()&&(i=!0,$(1,2,N(".questions-style-settings").find(".questions-text-align"),0,"")),!1===i&&""===g.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-left-right"),0,"")),!1===i&&""===v.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-padding-top-bottom"),0,"")),!1===i&&""===b.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-color"),0,"")),!1===i&&""===y.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-size"),0,"")),!1===i&&""===w.toString()&&(i=!0,$(1,2,N(".answers-style-settings").find(".answers-text-weight"),0,"")),!1===i&&""===k.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-background-color"),0,"")),!1===i&&""===x.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-size"),0,"")),!1===i&&""===C.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-color"),0,"")),!1===i&&""===_.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-border-radius"),0,"")),!1===i&&""===P.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-left-right"),0,"")),!1===i&&""===A.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-padding-top-bottom"),0,"")),!1===i&&""===M.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-color"),0,"")),!1===i&&""===D.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-size"),0,"")),!1===i&&""===T.toString()&&(i=!0,$(1,2,N(".buttons-style-settings").find(".buttons-text-weight"),0,"")),!1===i&&""===S.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-success"),0,"")),!1===i&&""===E.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-color-for-error"),0,"")),!1===i&&""===O.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-border-left-size"),0,"")),!1===i&&""===L.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-padding-top-bottom"),0,"")),!1===i&&""===B.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-color"),0,"")),!1===i&&""===I.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-size"),0,"")),!1===i&&""===j.toString()&&(i=!0,$(1,2,N(".errors-style-settings").find(".errors-text-weight"),0,"")),!1===i&&N(".poll-elements-list").find(".poll-element").each(function(){switch(N(this).attr("data-type")){case"text-question":!1===i&&""===N(this).find(".question-value").val()&&(i=!0,$(2,1,N(this).find(".question-value"),0,objectL10n.yopPollParams.saveParams.noQuestion)),N(this).find(".answer").each(function(t){return!1===i&&""===N(this).find(".answer-value").val().toString()?(i=!0,$(2,1,N(this).find(".answer-value"),0,objectL10n.yopPollParams.saveParams.noAnswerText),!1):!1===i&&N(this).find(".answer-make-link").is(":checked")&&""===N(this).find(".answer-link").val().toString()?(i=!0,$(2,1,N(this).find(".answer-link"),0,objectL10n.yopPollParams.saveParams.noAnswerLink),!1):void 0}),!1===i&&"yes"===N(this).find(".allow-other-answers").val()&&""===N(this).find(".other-answers-label").val().toString()&&(i=!0,$(2,1,N(this).find(".other-answers-label"),0,objectL10n.yopPollParams.saveParams.noOtherLabel)),!1===i&&"yes"===N(this).find(".allow-multiple-answers").val()&&(""===N(this).find(".multiple-answers-minim").val()||parseInt(N(this).find(".multiple-answers-minim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers)):""===N(this).find(".multiple-answers-maxim").val()||parseInt(N(this).find(".multiple-answers-maxim").val(),10)<=0?(i=!0,$(2,1,N(this).find(".multiple-answers-maxim"),0,objectL10n.yopPollParams.saveParams.noMaxAnswers)):parseInt(N(this).find(".multiple-answers-minim").val(),10)>parseInt(N(this).find(".multiple-answers-maxim").val(),10)&&(i=!0,$(2,1,N(this).find(".multiple-answers-minim"),0,objectL10n.yopPollParams.saveParams.noMinAnswers))),!1===i&&"columns"===N(this).find(".answers-display").val()&&(""===N(this).find(".answers-columns").val().toString()||parseInt(N(this).find(".answers-columns").val(),10)<1)&&(i=!0,$(2,1,N(this).find(".answers-columns"),0,objectL10n.yopPollParams.noNumberOfColumnsDefined));break;case"custom-field":if(!1===i&&""===N(this).find(".custom-field-name").val().toString())return i=!0,$(2,1,N(this).find(".custom-field-name"),0,objectL10n.yopPollParams.saveParams.noCustomFieldName),!1}}),!1===i&&""===N(".vote-button-label").val()&&(i=!0,$(3,1,N(".vote-button-label"),0,"")),!1===i&&"yes"===N(".show-results-link").val()&&""===N(".results-label-text").val()&&(i=!0,$(3,1,N(".results-label-text"),0,"")),!1===i&&"custom"===N(".start-date-option").val()&&""===N(".start-date-custom").val()&&(i=!0,$(3,1,N(".start-date-custom"),0,objectL10n.yopPollParams.saveParams.noStartDate)),!1===i&&"custom"===N(".end-date-option").val()&&""===N(".end-date-custom").val()&&(i=!0,$(3,1,N(".end-date-custom"),0,objectL10n.yopPollParams.saveParams.noEndDate)),!1===i&&"yes"===N(".redirect-after-vote").val()&&""===N(".redirect-url").val()&&(i=!0,$(3,1,N(".redirect-url"),0,"")),!1===i&&"yes"===N(".send-email-notifications").val()&&(!1===i&&""===N(".email-notifications-from-name").val()&&(i=!0,$(3,1,N(".email-notifications-from-name"),0,"")),!1===i&&""===N(".email-notifications-from-email").val()&&(i=!0,$(3,1,N(".email-notifications-from-email"),0,"")),!1===i&&""===N(".email-notifications-recipients").val()&&(i=!0,$(3,1,N(".email-notifications-recipients"),0,"")),!1===i&&""===N(".email-notifications-subject").val()&&(i=!0,$(3,1,N(".email-notifications-subject"),0,"")),!1===i&&""===N(".email-notifications-message").val()&&(i=!0,$(3,1,N(".email-notifications-message"),0,""))),!1===i&&"yes"===N(".enable-gdpr").val()&&"consent"===N(".gdpr-solution").val()&&""===N(".gdpr-consent-text").val()&&(i=!0,$(3,1,N(".gdpr-consent-text"),0,"")),N(".vote-permissions:checked").each(function(t){Y.push(N(this).val())}),!1===i&&0===Y.length&&(i=!0,$(3,2,N(".vote-permissions"),0,"")),N(".block-voters:checked").each(function(t){R.push(N(this).val())}),!1===i&&0<R.length&&-1===N.inArray("no-block",R)&&"limited-time"===N(".block-length-type").val()&&""===N(".block-length-1").val()&&(i=!0,$(3,2,N(".block-length-1"),0,"")),!1===i&&"yes"===N(".limit-votes-per-user").val()&&""===N(".votes-per-user-allowed").val()&&(i=!0,$(3,2,N(".votes-per-user-allowed"),0,"")),N(".show-results-moment:checked").each(function(t){z.push(N(this).val())}),!1===i&&0===z.length&&(i=!0,$(3,3,N(".show-results-moment"),0,objectL10n.yopPollParams.saveParams.noShowResultsMoment)),!1===i&&-1<N.inArray("custom-date",z)&&""===N(".custom-date-results").val()&&(i=!0,$(3,3,N(".custom-date-results"),0,objectL10n.yopPollParams.saveParams.noCustomDate)),N(".show-results-to:checked").each(function(t){Q.push(N(this).val())}),N(".results-details-option:checked").each(function(t){H.push(N(this).val())}),!1===i&&-1===N.inArray("never",z)&&(0===Q.length&&(i=!0,$(3,3,N(".show-results-to"),0,objectL10n.yopPollParams.saveParams.noShowResultsTo)),!1===i&&0===H.length&&(i=!0,$(3,3,N(".results-details-option"),0,objectL10n.yopPollParams.saveParams.noShowResultsDetails))),!1===i&&"yes"===N(".back-to-vote-option").val()&&""===N(".back-to-vote-caption").val()&&(i=!0,$(3,3,N(".back-to-vote-caption"),0,"")),!1===i&&!0===N('input.vote-permissions[value="registered"]').is(":checked")&&"no"===N(".allow-wordpress-votes").val()&&(i=!0,$(3,3,N(".allow-wordpress-votes"),0,objectL10n.yopPollParams.saveParams.noVoteAsWordpress)),!1===i&&(N(".poll-elements-list").find(".poll-element").each(function(t){var e=N(this).attr("data-type"),s=[];switch(e){case"text-question":N(this).find(".answer").each(function(t){s[t]={id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"text",text:N(this).find(".answer-value").val(),options:{makeDefault:N(this).find(".answer-make-default").is(":checked")?"yes":"no",makeLink:N(this).find(".answer-make-link").is(":checked")?"yes":"no",link:N(this).find(".answer-link").val(),resultsColor:N(this).find(".answer-results-color").val()}}}),F.push({id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"text-question",text:N(this).find(".question-value").val(),answers:s,answersRemoved:N(this).attr("data-remove"),options:{allowOtherAnswers:N(this).find(".allow-other-answers").val(),otherAnswersLabel:N(this).find(".other-answers-label").val(),addOtherAnswers:N(this).find(".add-other-answers").val(),displayOtherAnswersInResults:N(this).find(".display-other-answers-in-results").val(),resultsColorForOtherAnswers:N(this).find(".other-answers-results-color").val(),allowMultipleAnswers:N(this).find(".allow-multiple-answers").val(),multipleAnswersMinim:N(this).find(".multiple-answers-minim").val(),multipleAnswersMaxim:N(this).find(".multiple-answers-maxim").val(),answersDisplay:N(this).find(".answers-display").val(),answersColumns:N(this).find(".answers-columns").val(),answersSort:N(this).find(".answers-sort").val()}});break;case"custom-field":F.push({id:N(this).attr("data-id"),uid:void 0!==N(this).attr("data-uid")?N(this).attr("data-uid"):"",type:"custom-field",text:N(this).find(".custom-field-name").val(),options:{makeRequired:N(this).find(".custom-field-make-required").is(":checked")?"yes":"no",cType:N(this).find(".custom-field-type").val()}})}}),e={id:N('input[name="poll[id]"]').val(),name:N('input[name="poll[name]"]').val(),status:N("#poll_status").val(),design:{template:N('input[name="poll[template]"]').val(),templateBase:N('input[name="poll[template]"]').attr("data-template-base"),skinBase:N('input[name="poll[skin]"]').attr("data-skin-base"),style:{poll:{backgroundColor:N(".poll-background-color").val(),borderSize:N(".poll-border-size").val(),borderColor:N(".poll-border-color").val(),borderRadius:N(".poll-border-radius").val(),paddingLeftRight:N(".poll-padding-left-right").val(),paddingTopBottom:N(".poll-padding-top-bottom").val()},questions:{textColor:N(".questions-text-color").val(),textSize:N(".questions-text-size").val(),textWeight:N(".questions-text-weight").val(),textAlign:N(".questions-text-align").val()},answers:{paddingLeftRight:N(".answers-padding-left-right").val(),paddingTopBottom:N(".answers-padding-top-bottom").val(),textColor:N(".answers-text-color").val(),textSize:N(".answers-text-size").val(),textWeight:N(".answers-text-weight").val(),skin:N(".answers-style-settings").find(".answers-skin").val(),colorScheme:N(".answers-style-settings").find(".color-scheme").find("li.active").attr("data-id")},buttons:{backgroundColor:N(".buttons-background-color").val(),borderSize:N(".buttons-border-size").val(),borderColor:N(".buttons-border-color").val(),borderRadius:N(".buttons-border-radius").val(),paddingLeftRight:N(".buttons-padding-left-right").val(),paddingTopBottom:N(".buttons-padding-top-bottom").val(),textColor:N(".buttons-text-color").val(),textSize:N(".buttons-text-size").val(),textWeight:N(".buttons-text-weight").val()},captcha:{},errors:{borderLeftColorForSuccess:N(".errors-border-left-color-for-success").val(),borderLeftColorForError:N(".errors-border-left-color-for-error").val(),borderLeftSize:N(".errors-border-left-size").val(),paddingTopBottom:N(".errors-padding-top-bottom").val(),textColor:N(".errors-text-color").val(),textSize:N(".errors-text-size").val(),textWeight:N(".errors-text-weight").val()},custom:{css:N(".custom-styles-custom-css").val()}}},options:{poll:{voteButtonLabel:N(".vote-button-label").val(),showResultsLink:N(".show-results-link").val(),resultsLabelText:N(".results-label-text").val(),showTotalVotes:N(".show-total-votes").val(),showTotalAnswers:N(".show-total-answers").val(),startDateOption:N(".start-date-option").val(),startDateCustom:N(".start-date-custom-hidden").val(),endDateOption:N(".end-date-option").val(),endDateCustom:N(".end-date-custom-hidden").val(),redirectAfterVote:N(".redirect-after-vote").val(),redirectUrl:N(".redirect-url").val(),resetPollStatsAutomatically:N(".reset-poll-stats-automatically").val(),resetPollStatsOn:N(".reset-poll-stats-on-hidden").val(),resetPollStatsEvery:N(".reset-poll-stats-every").val(),resetPollStatsEveryPeriod:N(".reset-poll-stats-every-period").val(),autoGeneratePollPage:N(".auto-generate-poll-page").val(),pageId:"",pageLink:"",useCaptcha:N(".use-captcha").val(),sendEmailNotifications:N(".send-email-notifications").val(),emailNotificationsFromName:N(".email-notifications-from-name").val(),emailNotificationsFromEmail:N(".email-notifications-from-email").val(),emailNotificationsRecipients:N(".email-notifications-recipients").val(),emailNotificationsSubject:N(".email-notifications-subject").val(),emailNotificationsMessage:N(".email-notifications-message").val(),enableGdpr:N(".enable-gdpr").val(),gdprSolution:N(".gdpr-solution").val(),gdprConsentText:N(".gdpr-consent-text").val(),loadWithAjax:N(".load-with-ajax").val(),notificationMessageLocation:N(".poll-options-notification-message-location").val()},access:{votePermissions:Y,allowWordpressVotes:N(".allow-wordpress-votes").val(),blockVoters:R,blockLengthType:N(".block-length-type").val(),blockForValue:N(".block-length-1").val(),blockForPeriod:N(".block-length-2").val(),limitVotesPerUser:N(".limit-votes-per-user").val(),votesPerUserAllowed:N(".votes-per-user-allowed").val()},results:{showResultsMoment:z,customDateResults:N(".custom-date-results-hidden").val(),showResultsTo:Q,resultsDetails:H,backToVoteOption:N(".back-to-vote-option").val(),backToVoteCaption:N(".back-to-vote-caption").val(),sortResults:N(".sort-results").val(),sortResultsRule:N(".sort-results-rule").val(),displayResultsAs:N(".display-results-as").val(),barColor:N(".bar-color").val(),barHeight:N(".bar-height").val()}},elements:F,elementsRemoved:N(".poll-elements-list").attr("data-remove")},N(".spinner.publish").addClass("is-active"),N("#publish-poll").attr("disabled",!0),N.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"update_yop_poll",_token:N("#_token").val(),poll:JSON.stringify(e)}}).done(function(t){N(".spinner.publish").removeClass("is-active"),!0===t.success?(N(".poll-elements-list").attr("data-remove",""),N(".poll-element").attr("data-remove",""),N(t.data.newElements).each(function(t,e){N(".poll-elements").find('.poll-element[data-uid="'+e.uid+'"]').attr({"data-id":e.id,"data-uid":""})}),N(t.data.newSubElements).each(function(t,e){N(".poll-elements").find('.answer[data-uid="'+e.uid+'"]').attr({"data-id":e.id,"data-uid":""})}),toastr.success(htmlEncode(striptags(t.data.message)),"",{progressBar:!0,onHidden:function(){N("#publish-poll").attr("disabled",!1)}})):(N("#publish-poll").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()})}),jQuery(document).ready(function(o){function t(t){var e,s,a=window.location.search.substring(1).split("&");for(s=0;s<a.length;s++)if((e=a[s].split("="))[0]===t)return void 0===e[1]||decodeURIComponent(e[1])}var e,s=new Date;"yes"===t("show-code")?(pollId=t("poll-id"),o("#shortcode-popup").find(".generate-yop-poll-code").attr("data-id",pollId),o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+pollId+'"]'),o("#shortcode-popup").modal()):"yop-polls"===t("page")&&o("#yop-poll-guide-modal").length&&(e=s.getFullYear().toString()+s.getMonth().toString()+s.getDate().toString(),null!==localStorage.getItem("ypguide")&&e===localStorage.getItem("ypguide")||(o("#yop-poll-guide-modal").modal("show"),localStorage.setItem("ypguide",e))),o(".delete-poll").click(function(t){var e=o(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deletePollMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_single_yop_poll",_token:o('input[name="_token"]').val(),poll_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),o(".clone-poll").click(function(t){var e=o(this).attr("data-id");BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.clonePollMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"clone_single_yop_poll",_token:o('input[name="_token"]').val(),poll_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),o("#current-poll-page-selector").keypress(function(t){var e,s,a,i,n=document.URL.split("?");if(13===t.which){if(void 0!==n[1])for(q=n[1].split("&"),s=0;s<q.length;s++)a=0===s?"?":"&","page_no"===(e=q[s].split("="))[0]?(i=e[1],n[0]+=a+e[0]+"="+o(this).val()):(e[1]=void 0!==e[1]?e[1]:"",n[0]+=a+e[0]+"="+e[1]);i!==o(this).val()&&window.location.assign(n[0])}}),o(".bulk-action").click(function(t){var e,s=o(".bulk-action-"+o(this).attr("data-position")).val(),a=[];switch(o('input[name="polls[]"]:checked').each(function(t){a.push(o(this).val())}),s){case"trash":formAction="delete_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.deleteBulkPollsMultiMessage:objectL10n.yopPollParams.deleteBulkPollsSingleMessage;break;case"clone":formAction="clone_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.cloneBulkPollsMultiMessage:objectL10n.yopPollParams.cloneBulkPollsSingleMessage;break;case"reset-votes":formAction="reset_bulk_yop_poll",e=1<a.length?objectL10n.yopPollParams.resetBulkPollsMultiMessage:objectL10n.yopPollParams.resetBulkPollsSingleMessage;break;default:formAction=""}""!==formAction?0<a.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:formAction,_token:o('input[name="_bulk_token"]').val(),polls:JSON.stringify(a)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noPollsSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]}),t.preventDefault()}),o(".get-poll-code").click(function(){var t=o(this).attr("data-id");o("#shortcode-popup").find(".generate-yop-poll-code").attr("data-id",t),o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+t+'"]'),o("#shortcode-popup").modal()}),o(".generate-yop-poll-code").click(function(t){var e=o(this).attr("data-id"),s=o("#shortcode-popup").find(".shortcode-tracking-id").val();"no"===o("#shortcode-popup").find(".shortcode-show-results").val()?""!==s?o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'" tracking_id="'+s+'"]'):o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'"]'):o("#shortcode-popup").find(".poll-code").val('[yop_poll id="'+e+'" show_results="1"]'),t.preventDefault()}),o(".send-poll-guide").click(function(t){var e=o(".guide-email").val();""!==e.trim()?(o.LoadingOverlay("show"),o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_send_guide",input:e}}).done(function(t){o.LoadingOverlay("hide"),o("#yop-poll-guide-modal").modal("hide"),toastr.success("Guide sent. Please check your inbox.")})):o(".email-container").addClass("has-error"),t.preventDefault()}),o(".stop-showing-guide").click(function(t){o.LoadingOverlay("show"),o.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_stop_showing_guide",stop:"no"}}).done(function(t){o.LoadingOverlay("hide"),o("#yop-poll-guide-modal").modal("hide")}),t.preventDefault()})}),jQuery(document).ready(function(i){i(".add-ban").click(function(t){var e,s=!1;e=i(".ban-value").val(),!1===s&&""===e&&(s=!0,i(".ban-value").focus(),i(".ban-value").parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveBanParams.noBanValue)))),!1===s&&(formData={ban:{poll_id:i(".ban-poll").val(),b_by:i(".ban-by").val(),b_value:i(".ban-value").val()}},i(".add-ban").attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"create_yop_poll_ban",_token:i("#_token").val(),ban:JSON.stringify(formData)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):(i(".add-ban").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".ban-for").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".ban-value").change(function(){""!==i(this).val()&&i(this).parent().removeClass("has-error")}),i(".delete-ban").click(function(t){var e=i(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteBanMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_yop_poll_ban",_token:i('input[name="_token"]').val(),ban_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),i(".update-ban").click(function(t){var e,s,a=!1;banFor=i(".ban-for").val(),e=i(".ban-value").val(),!1===a&&""===e&&(a=!0,i(".ban-value").focus(),i(".ban-value").parent().addClass("has-error"),toastr.warning(htmlEncode(striptags(objectL10n.yopPollParams.saveBanParams.noBanValue)))),!1===a&&(s={ban:{id:i(this).attr("data-id"),poll_id:i(".ban-poll").val(),b_by:i(".ban-by").val(),b_value:i(".ban-value").val()}},i(".update-ban").attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"update_yop_poll_ban",_token:i("#_token").val(),ban:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):(i(".add-ban").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".bans-bulk-action").click(function(t){var e,s=[];i('input[name="bans[]"]:checked').each(function(t){s.push(i(this).val())}),"trash"===i(".bans-bulk-action-"+i(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkBansMultiMessage:objectL10n.yopPollParams.deleteBulkBansSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_bulk_yop_poll_ban",_token:i('input[name="_bulk_token"]').val(),bans:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-bans")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBansSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})})}),jQuery(document).ready(function(a){a(".delete-log").click(function(t){var e=a(this).attr("data-id");""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteLogMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_yop_poll_log",_token:a('input[name="_token"]').val(),log_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-logs")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),a(".logs-bulk-action").click(function(t){var e,s=[];a('input[name="logs[]"]:checked').each(function(t){s.push(a(this).val())}),"trash"===a(".logs-bulk-action-"+a(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkLogsMultiMessage:objectL10n.yopPollParams.deleteBulkLogsSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"delete_bulk_yop_poll_log",_token:a('input[name="_bulk_token"]').val(),logs:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-poll-logs")}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noLogsSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})}),a(".view-log-details").click(function(t){var e=a(this).data("id"),s=a(this).parent().parent().next(".log-details-div");a(s).is(":visible")?(a(s).fadeOut("slow"),a(this).text(objectL10n.yopPollParams.showLogDetailsLinkText)):(a(this).text(objectL10n.yopPollParams.hideLogDetailsLinkText),"yes"===a(s).data("ajax_sent")?a(s).fadeIn("slow"):(a.LoadingOverlay("show"),a.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"get_yop_poll_log_details",_token:a('input[name="_token"]').val(),log_id:e}}).done(function(t){!0===t.success?(strDetails=t.data.details,a(s).html(strDetails).fadeIn("slow"),a(s).data("ajax_sent","yes")):toastr.warning(htmlEncode(striptags(t.data))),a.LoadingOverlay("hide")}))),t.preventDefault()}),a(".export-logs-button").click(function(t){a("#doExport").val("true"),a("#searchForm").submit()}),a("#search-submit").click(function(t){a("#doExport").val("false")})}),jQuery(document).ready(function(d){d(".progress-bar").each(function(){d(this).yopprogressbar({})}),d(".element-results-header").click(function(t){var e=d(this).closest(".panel").find(".panel-collapse");d(e).hasClass("in")?d(this).find("a").first().removeClass("collapsed"):d(this).find("a").first().addClass("collapsed"),d(e).collapse("toggle"),t.preventDefault()}),d(".answers-chart-type").on("change",function(t){var e,s,a,i,n,o,r,l,c;if(function(){return"rgb("+Math.floor(255*Math.random())+","+Math.floor(255*Math.random())+","+Math.floor(255*Math.random())+")"},e=d(this).val(),s=d(this).closest(".panel-body").find(".chart-canvas"),a=d(this).closest(".panel-body").find(".bar-chart-div"),"pie"===e){for(d(s).show(),d(a).hide(),i=d(s).data("jsondata"),n=d(s).data("jsonlabels"),o=d(s).data("resultscolor"),l=d(s).data("icons"),r=[],c=0;c<l.length;c++)"other"===l[c]?(r.push(""),n[c]+=" "):r.push("");new Chart(s,{type:"pie",responsive:!0,maintainAspectRatio:!0,data:{labels:n,icons:r,datasets:[{label:objectL10n.yopPollParams.numberOfVotesText,data:i,backgroundColor:o,icons:r,datalabels:{anchor:"end"}}]},pointLabelFontFamily:"'FontAwesome'",scaleFontFamily:"'FontAwesome'",options:{legend:{display:!0,labels:{fontFamily:"'FontAwesome'",fontSize:12}},tooltips:{enabled:!0,titleFontFamily:"'FontAwesome'",bodyFontFamily:"'FontAwesome'",footerFontFamily:"'FontAwesome'"},tooltipTitleFontFamily:"'FontAwesome'",plugins:{datalabels:{anchor:"end",borderColor:"red",borderRadius:5,borderWidth:0,color:"#387cb7",font:{family:"FontAwesome",size:20},display:!0,formatter:function(t,e){return e.chart.data.icons[e.dataIndex]}}}}})}else"bar"===e&&(d(s).hide(),d(a).show())}),d(".voters-chart-type").on("change",function(t){var e,s,a,i,n,o;e=d(this).val(),s=d(this).closest(".panel-body").find(".chart-voters-canvas"),a=d(this).closest(".panel-body").find(".bar-chart-voters-div"),"pie"===e?(d(s).show(),d(a).hide(),i=d(s).data("jsondata"),n=d(s).data("jsonlabels"),o=d(s).data("resultscolor"),new Chart(s,{type:"pie",responsive:!0,maintainAspectRatio:!0,data:{labels:n,datasets:[{label:"Number of Votes",data:i,backgroundColor:o}]}})):"bar"===e&&(d(s).hide(),d(a).show())}),d("#cf-pagination").bootpag({total:d("#cf-total-pages").val()}).on("page",function(t,e){d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"get_yop_poll_votes_customs",_token:d('input[name="_token"]').val(),page:e,poll_id:d("#poll_id").val()}}).done(function(t){!0===t.success?d("#cf-table tbody").html(t.data):toastr.warning(htmlEncode(striptags(t.data)))})}),d(".details-operation").click(function(t){var e,s,a,i;e=d(this).data("vote-id"),s=d(this).data("ajax-sent"),a=d("#vote-details-div-"+e),i=d(this),d(a).is(":visible")?d(a).fadeOut("slow"):"yes"===s?d("#vote-details-div-"+e).fadeIn("slow"):(d.LoadingOverlay("show"),d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop-poll-get-vote-details",_token:d('input[name="_token"]').val(),voteid:e}}).done(function(t){!0===t.success?(d(a).html(t.data.details),d(a).fadeIn("slow"),d(i).data("ajax-sent","yes")):toastr.warning(htmlEncode(striptags(t.data))),d.LoadingOverlay("hide")})),t.preventDefault()}),d(".delete-vote").click(function(t){var e=d(this).attr("data-id"),s=d('input[name="poll_id"]').val();""!==e&&BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.deleteBulkVotesSingleMessage,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_delete_vote",_token:d('input[name="_token"]').val(),poll_id:s,vote_id:e}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+s)}}):toastr.warning(htmlEncode(striptags(t.data)))})}}),t.preventDefault()}),d(".votes-bulk-action").click(function(t){var e,s=[],a=d('input[name="poll_id"]').val(),i=d("#votes-search-input").val();d('input[name="votes[]"]:checked').each(function(t){s.push(d(this).val())}),"trash"===d(".logs-bulk-action-"+d(this).attr("data-position")).val()?(e=1<s.length?objectL10n.yopPollParams.deleteBulkVotessMultiMessage:objectL10n.yopPollParams.deleteBulkVotesSingleMessage,0<s.length?BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:e,btnCancelLabel:objectL10n.yopPollParams.deleteCancelLabel,btnOKLabel:objectL10n.yopPollParams.deleteOkLabel,callback:function(t){t&&d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_delete_votes_bulk",_token:d('input[name="_bulk_token"]').val(),poll_id:a,votes:JSON.stringify(s)}}).done(function(t){!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+a+"&q="+i)}}):toastr.warning(htmlEncode(striptags(t.data)))})}}):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noVotesSelectedForBulk,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})):BootstrapDialog.show({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:objectL10n.yopPollParams.noBulkActionSelected,buttons:[{label:objectL10n.yopPollParams.deleteOkLabel,action:function(t){t.close()}}]})}),d(".btn-submit-add-votes-manually").click(function(){var e=d(this).attr("data-poll-id"),s=[];d(".section-main-add-votes-manually .question-section").each(function(t){var e=[];d(this).find(".answer-element").each(function(t){e[t]={id:d(this).attr("data-id"),votes:d(this).val()}}),s[t]={id:d(this).attr("data-id"),answers:e}}),d(".section-footer-add-votes-manually .btn-submit-add-votes-manually").attr("disabled",!0),d(".section-footer-add-votes-manually .spinner").removeClass("hide").addClass("is-active"),d.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll-add-votes-manually",_token:d('input[name="_token-add-votes-manually"]').val(),id:e,data:JSON.stringify(s)}}).done(function(t){d(".section-footer-add-votes-manually .spinner").removeClass("is-active").addClass("hide"),!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){window.location.assign("admin.php?page=yop-polls&action=view-votes&poll_id="+e)}}):(d(".section-footer-add-votes-manually .btn-submit-add-votes-manually").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})}),d(".btn-cancel-add-votes-manually").click(function(){d(".section-footer-add-votes-manually .spinner").removeClass("is-active").addClass("hide"),d("#modal-add-votes-manually").modal("hide")})}),jQuery(document).ready(function(i){function s(t,e,s,a){switch(t){case"tab-notifications":i("#tab-notifications").addClass("active"),i("#settings-notifications").addClass("active"),i("#tab-integrations").removeClass("active"),i("#settings-integrations").removeClass("active"),i("#tab-messages").removeClass("active"),i("#settings-messages").removeClass("active");break;case"tab-integrations":i("#tab-integrations").addClass("active"),i("#settings-integrations").addClass("active"),i("#tab-notifications").removeClass("active"),i("#settings-notifications").removeClass("active"),i("#tab-messages").removeClass("active"),i("#settings-messages").removeClass("active");break;case"tab-messages":switch(i("#tab-messages").addClass("active"),i("#settings-messages").addClass("active"),i("#tab-notifications").removeClass("active"),i("#settings-notifications").removeClass("active"),i("#tab-integrations").removeClass("active"),i("#settings-integrations").removeClass("active"),e){case 1:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").removeClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 2:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").removeClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 3:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').addClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').removeClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").removeClass("hide"),i("#settings-messages .settings-messages-captcha").addClass("hide");break;case 4:i("#settings-messages").find('a[data-content="settings-messages-buttons"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-voting"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-results"]').removeClass("btn-underline"),i("#settings-messages").find('a[data-content="settings-messages-captcha"]').addClass("btn-underline"),i("#settings-messages .settings-messages-buttons").addClass("hide"),i("#settings-messages .settings-messages-voting").addClass("hide"),i("#settings-messages .settings-messages-results").addClass("hide"),i("#settings-messages .settings-messages-captcha").removeClass("hide")}}i("#"+s).css("borderColor","#f00"),""!==a&&toastr.warning(htmlEncode(striptags(a)))}var a;i(".settings-required-field").focusout(function(t){""!==i.trim(i(this).val())&&i(this).css("borderColor","#ccc")}),i(".save-settings").click(function(t){var e=!1;"yes"===i(".integrations-reCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptcha-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptcha-site-key",i("#integrations-reCaptcha-site-key").closest(".integrations-reCaptcha-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptcha-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptcha-secret-key",i("#integrations-reCaptcha-secret-key").closest(".integrations-reCaptcha-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptchaV2Invisible-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV2Invisible-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV2Invisible-site-key",i("#integrations-reCaptchaV2Invisible-site-key").closest(".integrations-reCaptchaV2Invisible-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV2Invisible-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV2Invisible-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV2Invisible-secret-key",i("#integrations-reCaptchaV2Invisible-secret-key").closest(".integrations-reCaptchaV2Invisible-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-site-key",i("#integrations-reCaptchaV3-site-key").closest(".integrations-reCaptchaV3-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-secret-key",i("#integrations-reCaptchaV3-secret-key").closest(".integrations-reCaptchaV3-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-reCaptchaV3-enabled").val()&&!1===e&&""===i.trim(i("#integrations-reCaptchaV3-min-allowed-score").val())&&(e=!0,s("tab-integrations",0,"integrations-reCaptchaV3-min-allowed-score",i("#integrations-reCaptchaV3-min-allowed-score").closest(".integrations-reCaptchaV3-section").find(".input-caption").eq(2).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i(".integrations-hCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-hCaptcha-site-key").val())&&(e=!0,s("tab-integrations",0,"integrations-hCaptcha-site-key",i("#integrations-hCaptcha-site-key").closest(".integrations-hCaptcha-section").find(".input-caption:first").text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),"yes"===i("#integrations-hCaptcha-enabled").val()&&!1===e&&""===i.trim(i("#integrations-hCaptcha-secret-key").val())&&(e=!0,s("tab-integrations",0,"integrations-hCaptcha-secret-key",i("#integrations-hCaptcha-secret-key").closest(".integrations-hCaptcha-section").find(".input-caption").eq(1).text()+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-anonymous").val())&&(e=!0,s("tab-messages",1,"messages-buttons-anonymous",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-anonymous").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-wordpress").val())&&(e=!0,s("tab-messages",1,"messages-buttons-wordpress",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-wordpress").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-facebook").val())&&(e=!0,s("tab-messages",1,"messages-buttons-facebook",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-facebook").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-buttons-google").val())&&(e=!0,s("tab-messages",1,"messages-buttons-google",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-buttons-google").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-poll-ended").val())&&(e=!0,s("tab-messages",2,"messages-voting-poll-ended",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-poll-ended").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-poll-not-started").val())&&(e=!0,s("tab-messages",2,"messages-voting-poll-not-started",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-poll-not-started").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-already-voted-on-poll").val())&&(e=!0,s("tab-messages",2,"messages-voting-already-voted-on-poll",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-already-voted-on-poll").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-invalid-poll").val())&&(e=!0,s("tab-messages",2,"messages-voting-invalid-poll",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-invalid-poll").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-answer-selected").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-answer-selected",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-answer-selected").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-min-answers-required").val())&&(e=!0,s("tab-messages",2,"messages-voting-min-answers-required",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-min-answers-required").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-max-answers-required").val())&&(e=!0,s("tab-messages",2,"messages-voting-max-answers-required",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-max-answers-required").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-value-for-other").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-value-for-other",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-value-for-other").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-no-value-for-custom-field").val())&&(e=!0,s("tab-messages",2,"messages-voting-no-value-for-custom-field",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-no-value-for-custom-field").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-consent-not-checked").val())&&(e=!0,s("tab-messages",2,"messages-voting-consent-not-checked",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-consent-not-checked").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-captcha-not-checked").val())&&(e=!0,s("tab-messages",2,"messages-voting-captcha-not-checked",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-captcha-not-checked").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-ban").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-ban",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-ban").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-block").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-block",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-block").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-vote-not-allowed-by-limit").val())&&(e=!0,s("tab-messages",2,"messages-voting-vote-not-allowed-by-limit",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-vote-not-allowed-by-limit").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-voting-thank-you").val())&&(e=!0,s("tab-messages",2,"messages-voting-thank-you",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-voting-thank-you").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-single-vote").val())&&(e=!0,s("tab-messages",3,"messages-results-single-vote",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-single-vote").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-multiple-votes").val())&&(e=!0,s("tab-messages",3,"messages-results-multiple-votes",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-multiple-votes").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-single-answer").val())&&(e=!0,s("tab-messages",3,"messages-results-single-answer",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-single-answer").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-results-multiple-answers").val())&&(e=!0,s("tab-messages",3,"messages-results-multiple-answers",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-results-multiple-answers").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-alt").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-alt",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-alt").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-title").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-title",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-title").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-description").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-description",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-description").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-accessibility-explanation").val())&&(e=!0,s("tab-messages",4,"messages-captcha-accessibility-explanation",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-accessibility-explanation").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-refresh-alt").val())&&(e=!0,s("tab-messages",4,"messages-captcha-refresh-alt",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-refresh-alt").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&""===i.trim(i("#messages-captcha-refresh-title").val())&&(e=!0,s("tab-messages",4,"messages-captcha-refresh-title",objectL10n.yopPollParams.saveParams.generalTextForMessages+'"'+i("#messages-captcha-refresh-title").closest(".messages-fields").find(".input-caption").text()+'"'+objectL10n.yopPollParams.saveParams.generalErrorMessage)),!1===e&&(a={general:{"remove-data":i("#general-remove-data").val()},notifications:{"new-vote":{"from-name":i("#email-from-name").val(),"from-email":i("#email-from-email").val(),subject:i("#email-subject").val(),recipients:i("#email-recipients").val(),message:i("#email-message").val()}},integrations:{reCaptcha:{enabled:i("#integrations-reCaptcha-enabled").val(),"site-key":i("#integrations-reCaptcha-site-key").val(),"secret-key":i("#integrations-reCaptcha-secret-key").val()},reCaptchaV2Invisible:{enabled:i("#integrations-reCaptchaV2Invisible-enabled").val(),"site-key":i("#integrations-reCaptchaV2Invisible-site-key").val(),"secret-key":i("#integrations-reCaptchaV2Invisible-secret-key").val()},reCaptchaV3:{enabled:i("#integrations-reCaptchaV3-enabled").val(),"site-key":i("#integrations-reCaptchaV3-site-key").val(),"secret-key":i("#integrations-reCaptchaV3-secret-key").val(),"min-allowed-score":i("#integrations-reCaptchaV3-min-allowed-score").val()},hCaptcha:{enabled:i("#integrations-hCaptcha-enabled").val(),"site-key":i("#integrations-hCaptcha-site-key").val(),"secret-key":i("#integrations-hCaptcha-secret-key").val()},facebook:{enabled:i("#integrations-facebook-enabled").val(),"app-id":i("#integrations-facebook-app-id").val()},google:{enabled:i("#integrations-google-enabled").val(),"app-id":i("#integrations-google-app-id").val(),"app-secret":i("#integrations-google-app-secret").val()}},messages:{captcha:{"accessibility-alt":i("#messages-captcha-accessibility-alt").val(),"accessibility-title":i("#messages-captcha-accessibility-title").val(),"accessibility-description":i("#messages-captcha-accessibility-description").val(),explanation:i("#messages-captcha-accessibility-explanation").val(),"refresh-alt":i("#messages-captcha-refresh-alt").val(),"refresh-title":i("#messages-captcha-refresh-title").val()},buttons:{anonymous:i("#messages-buttons-anonymous").val(),wordpress:i("#messages-buttons-wordpress").val(),facebook:i("#messages-buttons-facebook").val(),google:i("#messages-buttons-google").val()},voting:{"poll-ended":i("#messages-voting-poll-ended").val(),"poll-not-started":i("#messages-voting-poll-not-started").val(),"already-voted-on-poll":i("#messages-voting-already-voted-on-poll").val(),"invalid-poll":i("#messages-voting-invalid-poll").val(),"no-answers-selected":i("#messages-voting-no-answer-selected").val(),"min-answers-required":i("#messages-voting-min-answers-required").val(),"max-answers-required":i("#messages-voting-max-answers-required").val(),"no-answer-for-other":i("#messages-voting-no-value-for-other").val(),"no-value-for-custom-field":i("#messages-voting-no-value-for-custom-field").val(),"consent-not-checked":i("#messages-voting-consent-not-checked").val(),"no-captcha-selected":i("#messages-voting-captcha-not-checked").val(),"not-allowed-by-ban":i("#messages-voting-vote-not-allowed-by-ban").val(),"not-allowed-by-block":i("#messages-voting-vote-not-allowed-by-block").val(),"not-allowed-by-limit":i("#messages-voting-vote-not-allowed-by-limit").val(),"thank-you":i("#messages-voting-thank-you").val()},results:{"single-vote":i("#messages-results-single-vote").val(),"multiple-votes":i("#messages-results-multiple-votes").val(),"single-answer":i("#messages-results-single-answer").val(),"multiple-answers":i("#messages-results-multiple-answers").val()}}},i(".spinner.publish").addClass("is-active"),i(this).attr("disabled",!0),i.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"yop_poll_save_settings",_token:i("#_token").val(),settings:JSON.stringify(a)}}).done(function(t){i(".spinner.publish").removeClass("is-active"),!0===t.success?toastr.success(htmlEncode(striptags(t.data)),"",{progressBar:!0,onHidden:function(){i(".save-settings").attr("disabled",!1)}}):(i(".save-settings").attr("disabled",!1),toastr.warning(htmlEncode(striptags(t.data))))})),t.preventDefault()}),i(".integrations-reCaptcha-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptcha-section").removeClass("hide"):i(".integrations-reCaptcha-section").addClass("hide")}),i(".integrations-reCaptchaV2Invisible-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptchaV2Invisible-section").removeClass("hide"):i(".integrations-reCaptchaV2Invisible-section").addClass("hide")}),i(".integrations-reCaptchaV3-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-reCaptchaV3-section").removeClass("hide"):i(".integrations-reCaptchaV3-section").addClass("hide")}),i(".integrations-hCaptcha-enabled").on("change",function(t){"yes"===i(this).val()?i(".integrations-hCaptcha-section").removeClass("hide"):i(".integrations-hCaptcha-section").addClass("hide")}),i(".integrations-facebook-enabled").on("change",function(t){"yes"===i(this).val()&&(i('.integrations-facebook-enabled option[value="no"]').prop("selected",!0),showUpgradeToPro("facebook"),t.preventDefault())}),i(".integrations-google-enabled").on("change",function(t){"yes"===i(this).val()&&(i('.integrations-google-enabled option[value="no"]').prop("selected",!0),showUpgradeToPro("google"),t.preventDefault())})});var getParameterFromUrl=getUrlParameter=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},showUpgradeToPro=function(t){jQuery("#yop-poll-upgrade-modal-short").modal("show"),jQuery("#yop-poll-upgrade-modal-long").modal("show")};jQuery(document).ready(function(a){var i;a(".migrate-section").on("change",function(t){"yes"===a(this).val()?a(".migrate-section").find(".migrate-gdpr-solution-section").removeClass("hide"):a(".migrate-section").find(".migrate-gdpr-solution-section").addClass("hide")}),i=function(t,e,s){a.ajax({type:"POST",url:ajaxurl,data:{table:t,action:"yop_ajax_migrate",_csrf_token:a("#_csrf_token").val(),enableGdpr:a(".migrate-section").find(".migrate-enable-gdpr").val(),gdprSolution:a(".migrate-section").find(".migrate-gdpr-solution").val(),response_code:e,skip_table_check:s},dataType:"json",success:function(t){"done"===t.data.response_code?(a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.response+" "+t.data.message+"</p>"),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.allDone+"</p>")):(a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.response+" "+t.data.message+"</p>"),i(t.data.table,t.data.response_code,t.data.skip_table_check))},error:function(t){}}).fail(function(t){})},a(".send-request").click(function(){var t,e=a(".migrate-section").find(".migrate-enable-gdpr").val(),s=a(".migrate-section").find(".migrate-gdpr-solution").val();if("yes"===e){switch(s){case"consent":t=objectL10n.yopPollParams.importOld.gdprEnabledMigrateAsIs;break;case"anonymize":t=objectL10n.yopPollParams.importOld.gdprEnabledAnonymizeIp;break;case"nostore":t=objectL10n.yopPollParams.importOld.gdprEnabledNoStore}t=objectL10n.yopPollParams.importOld.gdprEnabledGeneral+"<br><br>"+objectL10n.yopPollParams.importOld.gdprEnabledChoice+": <b>"+a(".migrate-section").find(".migrate-gdpr-solution").find("option:selected").text()+"</b><br><br>"+t,BootstrapDialog.confirm({type:BootstrapDialog.TYPE_WARNING,title:objectL10n.yopPollParams.deleteTitle,message:t,btnCancelLabel:objectL10n.yopPollParams.importOld.gdprEnabledStop,btnOKLabel:objectL10n.yopPollParams.importOld.gdprEnabledContinue,callback:function(t){t&&(a(".migrate-output").html(""),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.importStarted+"</p>"),i("bans",1,!1))}})}else a(".migrate-output").html(""),a(".migrate-output").append("<p>"+objectL10n.yopPollParams.importOld.importStarted+"</p>"),i("bans",1,!1)})});
|
admin/inc/ClassYOPPollWidget.php
CHANGED
@@ -5,7 +5,7 @@ class YOP_Poll_Widget extends WP_Widget {
|
|
5 |
'yop_poll_widget',
|
6 |
__( 'YOP Poll', 'yop-poll' ),
|
7 |
array(
|
8 |
-
'description' =>
|
9 |
)
|
10 |
);
|
11 |
}
|
@@ -21,36 +21,36 @@ class YOP_Poll_Widget extends WP_Widget {
|
|
21 |
$polls = YOP_Poll_Polls::get_names();
|
22 |
?>
|
23 |
<p>
|
24 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>">
|
25 |
-
<?php
|
26 |
</label>
|
27 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
28 |
</p>
|
29 |
<p>
|
30 |
-
<label for = "<?php echo $this->get_field_id( 'poll_id' ); ?>">
|
31 |
<?php
|
32 |
-
|
33 |
?>
|
34 |
</label>
|
35 |
-
<select id = "<?php echo $this->get_field_id( 'poll_id' ); ?>" name = "<?php echo $this->get_field_name( 'poll_id' ); ?>" class = "widefat">
|
36 |
<option value = "0" <?php selected( 0, $poll_id ); ?>>
|
37 |
-
<?php
|
38 |
</option>
|
39 |
<option value = "-1" <?php selected( -1, $poll_id ); ?>>
|
40 |
-
<?php
|
41 |
</option>
|
42 |
<option value = "-2" <?php selected( -2, $poll_id ); ?>>
|
43 |
-
<?php
|
44 |
</option>
|
45 |
<option value = "-3" <?php selected( -3, $poll_id ); ?>>
|
46 |
-
<?php
|
47 |
</option>
|
48 |
<?php
|
49 |
if ( 0 < count( $polls ) ) {
|
50 |
-
foreach( $polls as $poll ) {
|
51 |
?>
|
52 |
-
<option value="<?php echo $poll->id
|
53 |
-
<?php echo $poll->name
|
54 |
</option>
|
55 |
<?php
|
56 |
}
|
@@ -59,10 +59,10 @@ class YOP_Poll_Widget extends WP_Widget {
|
|
59 |
</select>
|
60 |
</p>
|
61 |
<p>
|
62 |
-
<label for="<?php echo $this->get_field_id( 'tracking_id' ); ?>">
|
63 |
-
<?php
|
64 |
</label>
|
65 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'tracking_id' ); ?>" name="<?php echo $this->get_field_name( 'tracking_id' ); ?>" type="text" value="<?php echo esc_attr( $tracking_id ); ?>" />
|
66 |
</p>
|
67 |
<?php
|
68 |
}
|
@@ -74,7 +74,7 @@ class YOP_Poll_Widget extends WP_Widget {
|
|
74 |
return $instance;
|
75 |
}
|
76 |
public function widget( $args, $instance ) {
|
77 |
-
$title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) :
|
78 |
$poll_id = ( isset( $instance['poll_id'] ) ) ? intval( $instance['poll_id'] ) : -1;
|
79 |
$tracking_id = ( isset( $instance['tracking_id'] ) ) ? $instance['tracking_id'] : '';
|
80 |
$public = new YOP_Poll_Public();
|
@@ -86,11 +86,11 @@ class YOP_Poll_Widget extends WP_Widget {
|
|
86 |
'show_results' => ''
|
87 |
)
|
88 |
);
|
89 |
-
echo $args['before_widget'];
|
90 |
-
echo $args['before_title'];
|
91 |
-
print( $title );
|
92 |
-
echo $args['after_title'];
|
93 |
-
print( $poll_output );
|
94 |
-
echo $args['after_widget'];
|
95 |
}
|
96 |
-
}
|
5 |
'yop_poll_widget',
|
6 |
__( 'YOP Poll', 'yop-poll' ),
|
7 |
array(
|
8 |
+
'description' => esc_html__( 'Add a poll to your site', 'yop-poll' )
|
9 |
)
|
10 |
);
|
11 |
}
|
21 |
$polls = YOP_Poll_Polls::get_names();
|
22 |
?>
|
23 |
<p>
|
24 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
25 |
+
<?php esc_attr_e( 'Title:', 'yop-poll' ); ?>
|
26 |
</label>
|
27 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
28 |
</p>
|
29 |
<p>
|
30 |
+
<label for = "<?php echo esc_attr( $this->get_field_id( 'poll_id' ) ); ?>">
|
31 |
<?php
|
32 |
+
esc_attr_e( 'Poll to display', 'yop-poll' );
|
33 |
?>
|
34 |
</label>
|
35 |
+
<select id = "<?php echo esc_attr( $this->get_field_id( 'poll_id' ) ); ?>" name = "<?php echo esc_attr( $this->get_field_name( 'poll_id' ) ); ?>" class = "widefat">
|
36 |
<option value = "0" <?php selected( 0, $poll_id ); ?>>
|
37 |
+
<?php esc_attr_e( 'Don\'t Display Poll (Disable)', 'yop-poll' ); ?>
|
38 |
</option>
|
39 |
<option value = "-1" <?php selected( -1, $poll_id ); ?>>
|
40 |
+
<?php esc_attr_e( 'Display Current Active Poll', 'yop-poll' ); ?>
|
41 |
</option>
|
42 |
<option value = "-2" <?php selected( -2, $poll_id ); ?>>
|
43 |
+
<?php esc_attr_e( 'Display Latest Poll', 'yop-poll' ); ?>
|
44 |
</option>
|
45 |
<option value = "-3" <?php selected( -3, $poll_id ); ?>>
|
46 |
+
<?php esc_attr_e( 'Display Random Poll', 'yop-poll' ); ?>
|
47 |
</option>
|
48 |
<?php
|
49 |
if ( 0 < count( $polls ) ) {
|
50 |
+
foreach ( $polls as $poll ) {
|
51 |
?>
|
52 |
+
<option value="<?php echo esc_attr( $poll->id ); ?>" <?php selected( $poll->id, $poll_id ); ?>>
|
53 |
+
<?php echo esc_html( $poll->name ); ?>
|
54 |
</option>
|
55 |
<?php
|
56 |
}
|
59 |
</select>
|
60 |
</p>
|
61 |
<p>
|
62 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'tracking_id' ) ); ?>">
|
63 |
+
<?php esc_attr_e( 'Tracking Id:', 'yop-poll' ); ?>
|
64 |
</label>
|
65 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'tracking_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tracking_id' ) ); ?>" type="text" value="<?php echo esc_attr( $tracking_id ); ?>" />
|
66 |
</p>
|
67 |
<?php
|
68 |
}
|
74 |
return $instance;
|
75 |
}
|
76 |
public function widget( $args, $instance ) {
|
77 |
+
$title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : esc_html__( '' );
|
78 |
$poll_id = ( isset( $instance['poll_id'] ) ) ? intval( $instance['poll_id'] ) : -1;
|
79 |
$tracking_id = ( isset( $instance['tracking_id'] ) ) ? $instance['tracking_id'] : '';
|
80 |
$public = new YOP_Poll_Public();
|
86 |
'show_results' => ''
|
87 |
)
|
88 |
);
|
89 |
+
echo wp_kses_post( $args['before_widget'] );
|
90 |
+
echo wp_kses_post( $args['before_title'] );
|
91 |
+
print( wp_kses_post( $title ) );
|
92 |
+
echo wp_kses_post( $args['after_title'] );
|
93 |
+
print( wp_kses_post( $poll_output ) );
|
94 |
+
echo wp_kses_post( $args['after_widget'] );
|
95 |
}
|
96 |
+
}
|
admin/inc/ClassYopPollImporter4x.php
CHANGED
@@ -43,7 +43,7 @@ class ClassYopPollImporter4x {
|
|
43 |
private static function make_ip_gdpr_compliant( $ipaddress ) {
|
44 |
$compliant_ipaddress = '';
|
45 |
if ( 'yes' === self::$enableGdpr ) {
|
46 |
-
switch( self::$gdprSolution ) {
|
47 |
case 'consent': {
|
48 |
$compliant_ipaddress = $ipaddress;
|
49 |
break;
|
@@ -70,7 +70,7 @@ class ClassYopPollImporter4x {
|
|
70 |
private static function make_cookie_gdpr_compliant( $cookie ) {
|
71 |
$compliant_cookie = '';
|
72 |
if ( 'yes' === self::$enableGdpr ) {
|
73 |
-
switch( self::$gdprSolution ) {
|
74 |
case 'consent': {
|
75 |
$compliant_cookie = $cookie;
|
76 |
break;
|
@@ -115,7 +115,7 @@ 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}" );
|
@@ -131,7 +131,7 @@ class ClassYopPollImporter4x {
|
|
131 |
$unserialized_meta = [];
|
132 |
}
|
133 |
|
134 |
-
$poll_style = self::create_css_from_template( (isset
|
135 |
$vote_perms = [];
|
136 |
if ( isset( $unserialized_meta['vote_permisions_wordpress'] ) ) {
|
137 |
$vote_perms[] = 'wordpress';
|
@@ -221,8 +221,8 @@ class ClassYopPollImporter4x {
|
|
221 |
$blockForValue = $unserialized_meta['blocking_voters_interval_value'];
|
222 |
}
|
223 |
|
224 |
-
if( isset( $unserialized_meta['view_results_type'] ) ) {
|
225 |
-
switch( $unserialized_meta['view_results_type'] ) {
|
226 |
case 'votes-number': {
|
227 |
$resultsDetails = ['votes-number'];
|
228 |
break;
|
@@ -284,11 +284,11 @@ class ClassYopPollImporter4x {
|
|
284 |
'endDateCustom' => $poll_end_date,
|
285 |
'redirectAfterVote' => isset( $unserialized_meta['redirect_after_vote'] ) ? $unserialized_meta['redirect_after_vote'] : 'no',
|
286 |
'redirectUrl' => isset( $unserialized_meta['redirect_after_vote_url'] ) ? $unserialized_meta['redirect_after_vote_url'] : '',
|
287 |
-
'resetPollStatsAutomatically' => isset( $unserialized_meta['schedule_reset_poll_stats'] )? $unserialized_meta['schedule_reset_poll_stats'] : 'no',
|
288 |
'resetPollStatsOn' => isset( $unserialized_meta['schedule_reset_poll_date'] ) ? date( 'Y-m-d H:i:s', $unserialized_meta['schedule_reset_poll_date'] ) : '9999-12-31 23:59:59',
|
289 |
'resetPollStatsEvery' => isset( $unserialized_meta['schedule_reset_poll_recurring_value'] ) ? $unserialized_meta['schedule_reset_poll_recurring_value'] : 9999,
|
290 |
-
'resetPollStatsEveryPeriod' => isset( $unserialized_meta['schedule_reset_poll_recurring_unit'] ) ? $unserialized_meta['schedule_reset_poll_recurring_unit']. 's' : 'days',
|
291 |
-
'autoGeneratePollPage' => isset
|
292 |
'pageId' => '',
|
293 |
'pageLink' => '',
|
294 |
'useCaptcha' => isset( $unserialized_meta['use_captcha'] ) ? $unserialized_meta['use_captcha'] : 'no',
|
@@ -330,9 +330,19 @@ class ClassYopPollImporter4x {
|
|
330 |
]
|
331 |
];
|
332 |
$pollElementsArray = [];
|
333 |
-
$pollAnswers = $wpdb->get_results(
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
$x = 1;
|
337 |
$pollAnswersArray = [];
|
338 |
foreach ( $pollAnswers as $pA ) {
|
@@ -352,7 +362,7 @@ class ClassYopPollImporter4x {
|
|
352 |
'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
|
353 |
'makeLink' => 'no',
|
354 |
'link' => '',
|
355 |
-
'resultsColor' => isset
|
356 |
]
|
357 |
];
|
358 |
$pollAnswersArray[] = $pQAA;
|
@@ -363,10 +373,9 @@ class ClassYopPollImporter4x {
|
|
363 |
if ( isset( $unserialized_meta['display_answers'] ) ) {
|
364 |
if ( 'tabulated' === $unserialized_meta['display_answers'] ) {
|
365 |
$answers_display = 'columns';
|
366 |
-
} elseif( 'orizontal' === $unserialized_meta['display_answers'] ) {
|
367 |
$answers_display = 'horizontal';
|
368 |
-
}
|
369 |
-
else {
|
370 |
$answers_display = $unserialized_meta['display_answers'];
|
371 |
}
|
372 |
}
|
@@ -440,11 +449,11 @@ class ClassYopPollImporter4x {
|
|
440 |
|
441 |
if ( self::$checked_existence_bans && self::$bans_table_exists ) {
|
442 |
self::$unprocessed_bans = $wpdb->get_var( "select count(ID) from `{$polls_bans_table}` where `processed` = false" );
|
443 |
-
$bans = $wpdb->get_results( "select * from `{$polls_bans_table}` LIMIT ". self::$ajax_limit );
|
444 |
$bansIds = [];
|
445 |
if ( count( $bans ) > 0 ) {
|
446 |
foreach ( $bans as $ban ) {
|
447 |
-
$values[] = $wpdb->prepare(
|
448 |
$bansIds[] = $ban->id;
|
449 |
}
|
450 |
$query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
|
@@ -453,22 +462,22 @@ class ClassYopPollImporter4x {
|
|
453 |
$result = $wpdb->query( $query );
|
454 |
if ( ! $result ) {
|
455 |
$last_error = $wpdb->last_error;
|
456 |
-
return [ 'response_code' => 1, 'message' =>
|
457 |
} else {
|
458 |
-
$res = $wpdb->query("update {$polls_bans_table} set `processed` = true where `ID` in (".implode(',', $bansIds).
|
459 |
self::$processed_bans += $res;
|
460 |
if ( self::$processed_bans == self::$unprocessed_bans ) {
|
461 |
-
return [ 'response_code' => - 1, 'message' =>
|
462 |
} else {
|
463 |
-
return [ 'response_code' => 1, 'message' =>
|
464 |
}
|
465 |
}
|
466 |
}
|
467 |
} else {
|
468 |
-
return [ 'response_code' => - 1, 'message' =>
|
469 |
}
|
470 |
} else {
|
471 |
-
return [ 'response_code' => - 1, 'message' =>
|
472 |
}
|
473 |
}
|
474 |
|
@@ -478,7 +487,7 @@ class ClassYopPollImporter4x {
|
|
478 |
$polls_results_customs_table_name = $GLOBALS['wpdb']->prefix . 'yop_poll_votes_custom_fields';
|
479 |
$polls_answers_table_name = $GLOBALS['wpdb']->prefix . 'yop_poll_answers';
|
480 |
$current_user = wp_get_current_user();
|
481 |
-
if( $skip_table_check ) {
|
482 |
self::$checked_existence_logs = true;
|
483 |
self::$logs_table_exists = true;
|
484 |
}
|
@@ -493,9 +502,9 @@ class ClassYopPollImporter4x {
|
|
493 |
}
|
494 |
|
495 |
if ( self::$checked_existence_logs && self::$logs_table_exists ) {
|
496 |
-
self::$unprocessed_logs = $wpdb->get_var("select count(distinct `vote_id`) from `{$polls_logs_table_name}` where `processed` = false");
|
497 |
-
$logs = $wpdb->get_results("select distinct `vote_id` from `{$polls_logs_table_name}` where `processed` = false limit " .self::$ajax_limit );
|
498 |
-
if ( count($logs) > 0 ) {
|
499 |
$votesArray = [];
|
500 |
$logsArray = [];
|
501 |
$resultsIds = [];
|
@@ -509,7 +518,12 @@ class ClassYopPollImporter4x {
|
|
509 |
$voteData = ['elements' => [], 'user' => [] ];
|
510 |
$logData = ['elements' => [], 'user' => [] ];
|
511 |
$resultsIds[] = $result->id;
|
512 |
-
$answerType = $wpdb->get_var(
|
|
|
|
|
|
|
|
|
|
|
513 |
$a_data = [];
|
514 |
if ( 'other' === $answerType ) {
|
515 |
$a_data[] = [
|
@@ -523,9 +537,14 @@ class ClassYopPollImporter4x {
|
|
523 |
];
|
524 |
}
|
525 |
|
526 |
-
$wpdb->query( $wpdb->prepare("update `{$GLOBALS['wpdb']->yop_poll_subelements}` set `total_submits` = `total_submits` + 1 where `id` = %d", array( $result->answer_id ) ) );
|
527 |
#get the question
|
528 |
-
$question_id = $wpdb->get_var(
|
|
|
|
|
|
|
|
|
|
|
529 |
$new_customs = $wpdb->get_results( "SELECT * FROM `{$GLOBALS['wpdb']->yop_poll_elements}` WHERE `meta_data` LIKE '%old_id%'" );
|
530 |
$voteData['elements'][] = [
|
531 |
'id' => $question_id,
|
@@ -538,11 +557,11 @@ class ClassYopPollImporter4x {
|
|
538 |
'data' => $a_data
|
539 |
];
|
540 |
if ( $countC > 0 ) {
|
541 |
-
foreach( $customs as $cust ) {
|
542 |
$cID = null;
|
543 |
-
foreach( $new_customs as $nc ) {
|
544 |
$udata = unserialize( $nc->meta_data );
|
545 |
-
if( (
|
546 |
$cID = $nc->id;
|
547 |
}
|
548 |
}
|
@@ -557,7 +576,6 @@ class ClassYopPollImporter4x {
|
|
557 |
'data' => stripslashes( [$cust->custom_field_value] )
|
558 |
];
|
559 |
}
|
560 |
-
|
561 |
}
|
562 |
//array_push( $voteData['elements'], $q_data );
|
563 |
//array_push( $logData['elements'], $q_data );
|
@@ -580,7 +598,7 @@ class ClassYopPollImporter4x {
|
|
580 |
'status' => 'active',
|
581 |
'added_date' => $result->vote_date
|
582 |
);
|
583 |
-
$votesArray[] = $wpdb->prepare(
|
584 |
$data['poll_id'],
|
585 |
$data['user_id'],
|
586 |
$data['user_email'],
|
@@ -613,7 +631,7 @@ class ClassYopPollImporter4x {
|
|
613 |
'vote_message' => serialize( $vote_message ),
|
614 |
'added_date' => $result->vote_date
|
615 |
);
|
616 |
-
$logsArray[] = $wpdb->prepare(
|
617 |
$ldata['poll_id'],
|
618 |
$ldata['poll_author'],
|
619 |
$ldata['user_id'],
|
@@ -638,35 +656,33 @@ class ClassYopPollImporter4x {
|
|
638 |
$response = $wpdb->query( $query );
|
639 |
$responseLog = $wpdb->query( $logs_query );
|
640 |
if ( $response && $responseLog ) {
|
641 |
-
$result = $wpdb->query( "update `{$polls_logs_table_name}` set `processed` = true where id in (" . implode( ',', $resultsIds ) .
|
642 |
self::$processed_votes += $result;
|
643 |
if ( self::$processed_votes == self::$unprocessed_logs ) {
|
644 |
-
return [ 'response_code' => -1, 'message' =>
|
645 |
} elseif ( self::$processed_votes > self::$unprocessed_logs ) {
|
646 |
-
return [ 'response_code' => -1, 'message' =>
|
647 |
} else {
|
648 |
-
return [ 'response_code' => 1, 'message' =>
|
649 |
}
|
650 |
} else {
|
651 |
-
return [ 'response_code' => 1, 'message' =>
|
652 |
}
|
653 |
} else {
|
654 |
-
return [ 'response_code' => - 1, 'message' =>
|
655 |
}
|
656 |
-
|
657 |
} else {
|
658 |
-
return [ 'response_code' => - 1, 'message' =>
|
659 |
}
|
660 |
-
|
661 |
} else {
|
662 |
-
return [ 'response_code' => - 1, 'message' =>
|
663 |
}
|
664 |
|
665 |
}
|
666 |
|
667 |
private static function check_if_table_exists( $table_name ) {
|
668 |
global $wpdb;
|
669 |
-
if ( 0 == $wpdb->get_var( $wpdb->prepare(
|
670 |
DB_NAME, $table_name ) ) ) {
|
671 |
return false;
|
672 |
}
|
@@ -676,7 +692,7 @@ class ClassYopPollImporter4x {
|
|
676 |
private static function check_if_column_exists( $table_name, $column_name ) {
|
677 |
global $wpdb;
|
678 |
if ( 0 == $wpdb->get_var( $wpdb->prepare(
|
679 |
-
|
680 |
DB_NAME, $table_name, $column_name
|
681 |
) ) ) {
|
682 |
return false;
|
@@ -738,62 +754,63 @@ class ClassYopPollImporter4x {
|
|
738 |
return $css_array;
|
739 |
}
|
740 |
|
741 |
-
public static function yop_ajax_import()
|
742 |
-
{
|
743 |
if ( false === is_user_logged_in() ) {
|
744 |
-
wp_send_json_error(
|
745 |
wp_die();
|
746 |
}
|
747 |
-
if( check_ajax_referer( 'yop-poll-ajax-importer', '_csrf_token' ) ) {
|
748 |
$skip_table_check = false;
|
749 |
if ( isset( $_REQUEST['enableGdpr'] ) && isset( $_REQUEST['gdprSolution'] ) ) {
|
750 |
-
self::set_gdpr( $_REQUEST['enableGdpr'], $_REQUEST['gdprSolution'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
}
|
752 |
-
switch ($_REQUEST['table']) {
|
753 |
-
case 'polls': {
|
754 |
-
$response = self::import_polls( self::$ajax_limit, $skip_table_check );
|
755 |
-
if ( -1 == $response['response_code'] ) {
|
756 |
-
$table = 'bans';
|
757 |
-
$response_code = 1;
|
758 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
|
759 |
-
} else {
|
760 |
-
$table = 'polls';
|
761 |
-
$response_code = $response['response_code'];
|
762 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
|
763 |
-
}
|
764 |
-
break;
|
765 |
-
}
|
766 |
-
case 'bans': {
|
767 |
-
$response = self::import_bans( $skip_table_check );
|
768 |
-
if ( -1 == $response['response_code'] ) {
|
769 |
-
$table = 'votes';
|
770 |
-
$response_code = 1;
|
771 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
|
772 |
-
} else {
|
773 |
-
$table = 'bans';
|
774 |
-
$response_code = $response['response_code'];
|
775 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
|
776 |
-
}
|
777 |
-
break;
|
778 |
-
}
|
779 |
-
case 'votes': {
|
780 |
-
$response = self::import_votes( $skip_table_check );
|
781 |
-
if ( -1 == $response['response_code'] ) {
|
782 |
-
$table = 'votes';
|
783 |
-
$response_code = 'done';
|
784 |
-
delete_option( 'yop_poll_old_version' );
|
785 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => false ) );
|
786 |
-
} else {
|
787 |
-
$table = 'votes';
|
788 |
-
$response_code = $response['response_code'];
|
789 |
-
wp_send_json_success( array( 'table' => $table, 'response_code' => $response_code, 'message' => $response['message'], 'skip_table_check' => true ) );
|
790 |
-
}
|
791 |
-
break;
|
792 |
-
}
|
793 |
-
}
|
794 |
wp_die();
|
795 |
} else {
|
796 |
-
wp_send_json_error(
|
797 |
wp_die();
|
798 |
}
|
799 |
}
|
43 |
private static function make_ip_gdpr_compliant( $ipaddress ) {
|
44 |
$compliant_ipaddress = '';
|
45 |
if ( 'yes' === self::$enableGdpr ) {
|
46 |
+
switch ( self::$gdprSolution ) {
|
47 |
case 'consent': {
|
48 |
$compliant_ipaddress = $ipaddress;
|
49 |
break;
|
70 |
private static function make_cookie_gdpr_compliant( $cookie ) {
|
71 |
$compliant_cookie = '';
|
72 |
if ( 'yes' === self::$enableGdpr ) {
|
73 |
+
switch ( self::$gdprSolution ) {
|
74 |
case 'consent': {
|
75 |
$compliant_cookie = $cookie;
|
76 |
break;
|
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}" );
|
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';
|
221 |
$blockForValue = $unserialized_meta['blocking_voters_interval_value'];
|
222 |
}
|
223 |
|
224 |
+
if ( isset( $unserialized_meta['view_results_type'] ) ) {
|
225 |
+
switch ( $unserialized_meta['view_results_type'] ) {
|
226 |
case 'votes-number': {
|
227 |
$resultsDetails = ['votes-number'];
|
228 |
break;
|
284 |
'endDateCustom' => $poll_end_date,
|
285 |
'redirectAfterVote' => isset( $unserialized_meta['redirect_after_vote'] ) ? $unserialized_meta['redirect_after_vote'] : 'no',
|
286 |
'redirectUrl' => isset( $unserialized_meta['redirect_after_vote_url'] ) ? $unserialized_meta['redirect_after_vote_url'] : '',
|
287 |
+
'resetPollStatsAutomatically' => isset( $unserialized_meta['schedule_reset_poll_stats'] ) ? $unserialized_meta['schedule_reset_poll_stats'] : 'no',
|
288 |
'resetPollStatsOn' => isset( $unserialized_meta['schedule_reset_poll_date'] ) ? date( 'Y-m-d H:i:s', $unserialized_meta['schedule_reset_poll_date'] ) : '9999-12-31 23:59:59',
|
289 |
'resetPollStatsEvery' => isset( $unserialized_meta['schedule_reset_poll_recurring_value'] ) ? $unserialized_meta['schedule_reset_poll_recurring_value'] : 9999,
|
290 |
+
'resetPollStatsEveryPeriod' => isset( $unserialized_meta['schedule_reset_poll_recurring_unit'] ) ? $unserialized_meta['schedule_reset_poll_recurring_unit'] . 's' : 'days',
|
291 |
+
'autoGeneratePollPage' => isset( $unserialized_meta['auto_generate_poll_page'] ) ? $unserialized_meta['auto_generate_poll_page'] : 'no',
|
292 |
'pageId' => '',
|
293 |
'pageLink' => '',
|
294 |
'useCaptcha' => isset( $unserialized_meta['use_captcha'] ) ? $unserialized_meta['use_captcha'] : 'no',
|
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 ) {
|
362 |
'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
|
363 |
'makeLink' => 'no',
|
364 |
'link' => '',
|
365 |
+
'resultsColor' => isset( $unserialized_a_meta['bar_background'] ) ? $unserialized_a_meta['bar_background'] : '#000'
|
366 |
]
|
367 |
];
|
368 |
$pollAnswersArray[] = $pQAA;
|
373 |
if ( isset( $unserialized_meta['display_answers'] ) ) {
|
374 |
if ( 'tabulated' === $unserialized_meta['display_answers'] ) {
|
375 |
$answers_display = 'columns';
|
376 |
+
} elseif ( 'orizontal' === $unserialized_meta['display_answers'] ) {
|
377 |
$answers_display = 'horizontal';
|
378 |
+
} else {
|
|
|
379 |
$answers_display = $unserialized_meta['display_answers'];
|
380 |
}
|
381 |
}
|
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 ";
|
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 |
|
487 |
$polls_results_customs_table_name = $GLOBALS['wpdb']->prefix . 'yop_poll_votes_custom_fields';
|
488 |
$polls_answers_table_name = $GLOBALS['wpdb']->prefix . 'yop_poll_answers';
|
489 |
$current_user = wp_get_current_user();
|
490 |
+
if ( $skip_table_check ) {
|
491 |
self::$checked_existence_logs = true;
|
492 |
self::$logs_table_exists = true;
|
493 |
}
|
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 = [];
|
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[] = [
|
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,
|
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 |
}
|
576 |
'data' => stripslashes( [$cust->custom_field_value] )
|
577 |
];
|
578 |
}
|
|
|
579 |
}
|
580 |
//array_push( $voteData['elements'], $q_data );
|
581 |
//array_push( $logData['elements'], $q_data );
|
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'],
|
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 |
$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 |
}
|
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;
|
754 |
return $css_array;
|
755 |
}
|
756 |
|
757 |
+
public static function yop_ajax_import() {
|
|
|
758 |
if ( false === is_user_logged_in() ) {
|
759 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
760 |
wp_die();
|
761 |
}
|
762 |
+
if ( check_ajax_referer( 'yop-poll-ajax-importer', '_csrf_token' ) ) {
|
763 |
$skip_table_check = false;
|
764 |
if ( isset( $_REQUEST['enableGdpr'] ) && isset( $_REQUEST['gdprSolution'] ) ) {
|
765 |
+
self::set_gdpr( sanitize_text_field( wp_unslash( $_REQUEST['enableGdpr'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['gdprSolution'] ) ) );
|
766 |
+
}
|
767 |
+
if ( true === isset( $_REQUEST['table'] ) ) {
|
768 |
+
switch ( $_REQUEST['table'] ) {
|
769 |
+
case 'polls': {
|
770 |
+
$response = self::import_polls( self::$ajax_limit, $skip_table_check );
|
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 |
+
}
|
782 |
+
case 'bans': {
|
783 |
+
$response = self::import_bans( $skip_table_check );
|
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 |
+
}
|
795 |
+
case 'votes': {
|
796 |
+
$response = self::import_votes( $skip_table_check );
|
797 |
+
if ( -1 == $response['response_code'] ) {
|
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 |
+
}
|
809 |
+
}
|
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 |
}
|
admin/inc/ClassYopPollImporter5x.php
CHANGED
@@ -56,7 +56,7 @@ class ClassYopPollImporter5x {
|
|
56 |
}
|
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 ) {
|
@@ -117,7 +117,7 @@ class ClassYopPollImporter5x {
|
|
117 |
if ( isset( $unserialized_meta['sorting_results'] ) && '' != $unserialized_meta['sorting_results'] ) {
|
118 |
if ( 'votes' === $unserialized_meta['sorting_results'] ) {
|
119 |
$sorting_results = 'number-of-votes';
|
120 |
-
} elseif ( 'as_defined' === $unserialized_meta['sorting_results'] || 'exact' ===
|
121 |
$sorting_results = 'as-defined';
|
122 |
} else {
|
123 |
$sorting_results = $unserialized_meta['sorting_results'];
|
@@ -148,8 +148,8 @@ class ClassYopPollImporter5x {
|
|
148 |
} else {
|
149 |
$newBlVoters[] = 'no-block';
|
150 |
}
|
151 |
-
if( isset( $unserialized_meta['view_results_type'] ) ) {
|
152 |
-
switch( $unserialized_meta['view_results_type'] ) {
|
153 |
case 'votes-number': {
|
154 |
$resultsDetails = ['votes-number'];
|
155 |
break;
|
@@ -171,8 +171,8 @@ class ClassYopPollImporter5x {
|
|
171 |
$resultsDetails = ['percentages'];
|
172 |
}
|
173 |
$pro_templates_ids = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28];
|
174 |
-
if( isset( $unserialized_meta['template'] ) ) {
|
175 |
-
if( in_array( $unserialized_meta['template'], $pro_templates_ids ) ) {
|
176 |
$template_base = 'basic-pretty';
|
177 |
} else {
|
178 |
$template_base = 'basic';
|
@@ -247,7 +247,7 @@ class ClassYopPollImporter5x {
|
|
247 |
isset( $unserialized_meta['email_notifications_from_name'] ) && '' !== $unserialized_meta['email_notifications_from_name'] ? $unserialized_meta['email_notifications_from_name'] : 'Voting Alerts',
|
248 |
'emailNotificationsFromEmail' =>
|
249 |
isset( $unserialized_meta['email_notifications_from_email'] ) && '' !== $unserialized_meta['email_notifications_from_email'] ? $unserialized_meta['email_notifications_from_email'] : $adminUser->user_email,
|
250 |
-
'emailNotificationsRecipients' => isset( $unserialized_meta['email_notifications_recipients'] ) &&
|
251 |
'emailNotificationsSubject' =>
|
252 |
isset( $unserialized_meta['email_notifications_subject'] ) && '' !== $unserialized_meta['email_notifications_subject'] ? $unserialized_meta['email_notifications_subject'] : 'New Vote',
|
253 |
'emailNotificationsMessage' =>
|
@@ -283,15 +283,30 @@ class ClassYopPollImporter5x {
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
288 |
foreach ( $pollQuestions as $pQ ) {
|
289 |
$qArr = [];
|
290 |
$unserialized_q_meta = unserialize( $pQ->meta_value );
|
291 |
-
$pollQuestionAnswers = $wpdb->get_results(
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
$x = 0;
|
296 |
$pollQuestionAnswersArray = [];
|
297 |
switch ( $pQ->type ) {
|
@@ -309,7 +324,7 @@ class ClassYopPollImporter5x {
|
|
309 |
'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
|
310 |
'makeLink' => 'no',
|
311 |
'link' => '',
|
312 |
-
'resultsColor' => isset
|
313 |
]
|
314 |
];
|
315 |
break;
|
@@ -325,7 +340,7 @@ class ClassYopPollImporter5x {
|
|
325 |
'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
|
326 |
'makeLink' => 'no',
|
327 |
'link' => '',
|
328 |
-
'resultsColor' => isset
|
329 |
]
|
330 |
];
|
331 |
break;
|
@@ -341,7 +356,7 @@ class ClassYopPollImporter5x {
|
|
341 |
'makeLink' => 'no',
|
342 |
'addText' => 'no',
|
343 |
'text' => '',
|
344 |
-
'resultsColor' => isset
|
345 |
]
|
346 |
];
|
347 |
break;
|
@@ -351,7 +366,7 @@ class ClassYopPollImporter5x {
|
|
351 |
$x ++;
|
352 |
}
|
353 |
if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
|
354 |
-
if( 'orizontal' === $unserialized_q_meta['display_answers'] ) {
|
355 |
$answersDisplay = 'horizontal';
|
356 |
} elseif ( 'tabulated' === $unserialized_q_meta['display_answers'] ) {
|
357 |
$answersDisplay = 'columns';
|
@@ -402,7 +417,7 @@ class ClassYopPollImporter5x {
|
|
402 |
'makeDefault' => isset( $unserialized_a_meta['is_default_answer'] ) ? $unserialized_a_meta['is_default_answer'] : 'no',
|
403 |
'makeLink' => 'no',
|
404 |
'link' => '',
|
405 |
-
'resultsColor' => isset
|
406 |
]
|
407 |
];
|
408 |
break;
|
@@ -418,7 +433,7 @@ class ClassYopPollImporter5x {
|
|
418 |
'makeLink' => 'no',
|
419 |
'addText' => 'no',
|
420 |
'text' => '',
|
421 |
-
'resultsColor' => isset
|
422 |
]
|
423 |
];
|
424 |
break;
|
@@ -428,7 +443,7 @@ class ClassYopPollImporter5x {
|
|
428 |
$x ++;
|
429 |
}
|
430 |
if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
|
431 |
-
if( 'orizontal' === $unserialized_q_meta['display_answers'] ) {
|
432 |
$answersDisplay = 'horizontal';
|
433 |
} elseif ( 'tabulated' === $unserialized_q_meta['display_answers'] ) {
|
434 |
$answersDisplay = 'columns';
|
@@ -448,7 +463,7 @@ class ClassYopPollImporter5x {
|
|
448 |
'allowOtherAnswers' => isset( $unserialized_q_meta['allow_other_answers'] ) && '' != $unserialized_q_meta['allow_other_answers'] ? $unserialized_q_meta['allow_other_answers'] : 'no',
|
449 |
'otherAnswersLabel' => isset( $unserialized_q_meta['other_answers_label'] ) && '' != trim( $unserialized_q_meta['other_answers_label'] ) ? $unserialized_q_meta['other_answers_label'] : 'Other',
|
450 |
'addOtherAnswers' =>
|
451 |
-
( isset( $unserialized_q_meta['add_other_answers_to_default_answers'] ) && ( '' !== strval( $unserialized_q_meta['add_other_answers_to_default_answers'] ) )
|
452 |
'displayOtherAnswersInResults' =>
|
453 |
isset( $unserialized_q_meta['display_other_answers_values'] ) ? $unserialized_q_meta['display_other_answers_values'] : 'no',
|
454 |
'resultsColorForOtherAnswers' => '#000000',
|
@@ -502,7 +517,7 @@ class ClassYopPollImporter5x {
|
|
502 |
private static function make_ip_gdpr_compliant( $ipaddress ) {
|
503 |
$compliant_ipaddress = '';
|
504 |
if ( 'yes' === self::$enableGdpr ) {
|
505 |
-
switch( self::$gdprSolution ) {
|
506 |
case 'consent': {
|
507 |
$compliant_ipaddress = $ipaddress;
|
508 |
break;
|
@@ -529,7 +544,7 @@ class ClassYopPollImporter5x {
|
|
529 |
private static function make_cookie_gdpr_compliant( $cookie ) {
|
530 |
$compliant_cookie = '';
|
531 |
if ( 'yes' === self::$enableGdpr ) {
|
532 |
-
switch( self::$gdprSolution ) {
|
533 |
case 'consent': {
|
534 |
$compliant_cookie = $cookie;
|
535 |
break;
|
@@ -573,12 +588,12 @@ class ClassYopPollImporter5x {
|
|
573 |
}
|
574 |
|
575 |
if ( self::$checked_existence_bans && self::$bans_table_exists ) {
|
576 |
-
self::$unprocessed_bans = $wpdb->get_var("select count(ID) from `{$polls_bans_table}` where `processed` = false");
|
577 |
-
$bans = $wpdb->get_results( "select * from `{$polls_bans_table}` LIMIT " .self::$ajax_limit );
|
578 |
$bansIds = [];
|
579 |
if ( count( $bans ) > 0 ) {
|
580 |
foreach ( $bans as $ban ) {
|
581 |
-
$values[] = $wpdb->prepare(
|
582 |
$bansIds[] = $ban->id;
|
583 |
}
|
584 |
$query = "INSERT INTO `{$GLOBALS['wpdb']->yop_poll_bans}` (`author`, `poll_id`, `b_by`, `b_value`, `added_date`) VALUES ";
|
@@ -587,22 +602,22 @@ class ClassYopPollImporter5x {
|
|
587 |
$result = $wpdb->query( $query );
|
588 |
if ( ! $result ) {
|
589 |
$last_error = $wpdb->last_error;
|
590 |
-
return [ 'response_code' => 1, 'message' =>
|
591 |
} else {
|
592 |
-
$res = $wpdb->query("update {$polls_bans_table} set `processed` = true where `ID` in (".implode(',', $bansIds).
|
593 |
self::$processed_bans += $res;
|
594 |
if ( self::$processed_bans == self::$unprocessed_bans ) {
|
595 |
-
return [ 'response_code' => - 1, 'message' =>
|
596 |
} else {
|
597 |
-
return [ 'response_code' => 1, 'message' =>
|
598 |
}
|
599 |
}
|
600 |
}
|
601 |
} else {
|
602 |
-
return [ 'response_code' => - 1, 'message' =>
|
603 |
}
|
604 |
} else {
|
605 |
-
return [ 'response_code' => - 1, 'message' =>
|
606 |
}
|
607 |
|
608 |
}
|
@@ -612,7 +627,7 @@ class ClassYopPollImporter5x {
|
|
612 |
$polls_results_table_name = $GLOBALS['wpdb']->prefix . 'yop2_poll_results';
|
613 |
$polls_results_customs_table_name = $GLOBALS['wpdb']->prefix . 'yop2_poll_votes_custom_fields';
|
614 |
$current_user = wp_get_current_user();
|
615 |
-
if( $skip_table_check ) {
|
616 |
self::$checked_existence_votes = true;
|
617 |
self::$votes_table_exists = true;
|
618 |
}
|
@@ -627,10 +642,10 @@ class ClassYopPollImporter5x {
|
|
627 |
}
|
628 |
|
629 |
if ( self::$checked_existence_votes && self::$votes_table_exists ) {
|
630 |
-
self::$unprocessed_votes = $wpdb->get_var("select count(ID) from `{$polls_results_table_name}` where processed = false");
|
631 |
$results = $wpdb->get_results( "select `{$polls_results_table_name}`.* from `{$polls_results_table_name}` where `processed` = false limit " . self::$ajax_limit );
|
632 |
if ( 0 == count( $results ) ) {
|
633 |
-
return [ 'response_code' => - 1, 'message' =>
|
634 |
} else {
|
635 |
$voteData = ['elements' => [], 'user' => [] ];
|
636 |
$votesArray = [];
|
@@ -646,7 +661,7 @@ class ClassYopPollImporter5x {
|
|
646 |
'id' => $answer_id,
|
647 |
'data' => true
|
648 |
];
|
649 |
-
$wpdb->query( $wpdb->prepare("UPDATE `{$GLOBALS['wpdb']->yop_poll_subelements}` SET `total_submits` = ( `total_submits` + 1 ) WHERE `id` = %d", array( $answer_id ) ) );
|
650 |
|
651 |
}
|
652 |
$voteData['elements'][] = [
|
@@ -655,16 +670,16 @@ class ClassYopPollImporter5x {
|
|
655 |
'data' => $a_data
|
656 |
];
|
657 |
if ( property_exists( $rd, 'cf' ) && count( $rd->cf ) > 0 ) {
|
658 |
-
$customs = $wpdb->get_results( "select `id`, `user_id`,`custom_field_value` from `{$polls_results_customs_table_name}` where ID in (" . implode( ',', $rd->cf ) .
|
659 |
if ( $customs ) {
|
660 |
foreach ( $customs as $cust ) {
|
661 |
$custom_text = $wpdb->get_var( "select `custom_field` from {$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields where ID = '{$cust->id}'" );
|
662 |
-
$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 ) ) );
|
663 |
if ( '' != $added_custom && $added_custom > 0 ) {
|
664 |
$custom_id = $added_custom;
|
665 |
} else {
|
666 |
$wpdb->insert( $GLOBALS['wpdb']->yop_poll_elements,
|
667 |
-
['poll_id'=> $result->poll_id,
|
668 |
'author' => $current_user->ID,
|
669 |
'etext' => 'Custom field',
|
670 |
'etype' => 'custom_field',
|
@@ -702,7 +717,7 @@ class ClassYopPollImporter5x {
|
|
702 |
'status' => 'active',
|
703 |
'added_date' => $result->vote_date
|
704 |
);
|
705 |
-
$votesArray[] = $wpdb->prepare(
|
706 |
$data['tracking_id'], $data['voter_id'], $data['voter_fingerprint'], $data['vote_data'], $data['status'], $data['added_date'] );
|
707 |
}
|
708 |
$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`,
|
@@ -711,22 +726,22 @@ class ClassYopPollImporter5x {
|
|
711 |
$query .= implode( ",\n", $votesArray );
|
712 |
$response = $wpdb->query( $query );
|
713 |
if ( $response ) {
|
714 |
-
$result = $wpdb->query( "update `{$polls_results_table_name}` set `processed` = true where ID in (" . implode( ',', $resultsIds ) .
|
715 |
self::$processed_votes += $result;
|
716 |
if ( self::$processed_votes == self::$unprocessed_votes ) {
|
717 |
-
return [ 'response_code' => -1, 'message' =>
|
718 |
} else {
|
719 |
-
return [ 'response_code' => 1, 'message' =>
|
720 |
}
|
721 |
} else {
|
722 |
-
return [ 'response_code' => 1, 'message' =>
|
723 |
}
|
724 |
} else {
|
725 |
-
return [ 'response_code' => - 1, 'message' =>
|
726 |
}
|
727 |
}
|
728 |
} else {
|
729 |
-
return [ 'response_code' => - 1, 'message' =>
|
730 |
}
|
731 |
|
732 |
}
|
@@ -750,10 +765,10 @@ class ClassYopPollImporter5x {
|
|
750 |
}
|
751 |
}
|
752 |
if ( self::$checked_existence_logs && self::$logs_table_exists ) {
|
753 |
-
self::$unprocessed_logs = $wpdb->get_var("select count(ID) from `{$polls_logs_table_name}` where processed = false");
|
754 |
$log_results = $wpdb->get_results( "select `{$polls_logs_table_name}`.* from `{$polls_logs_table_name}` where `processed` = false limit " . self::$ajax_limit );
|
755 |
if ( 0 == count( $log_results ) ) {
|
756 |
-
return [ 'response_code' => - 1, 'message' =>
|
757 |
} else {
|
758 |
$logData = [ 'elements' => [], 'user' => [] ];
|
759 |
$logsArray = [];
|
@@ -778,16 +793,21 @@ class ClassYopPollImporter5x {
|
|
778 |
'data' => $a_data
|
779 |
];
|
780 |
if ( count( $rd->cf ) > 0 ) {
|
781 |
-
$customs = $wpdb->get_results( "select `id`, `custom_field_value` from `{$polls_results_customs_table_name}` where ID in (" . implode( ',', $rd->cf ) .
|
782 |
if ( $customs ) {
|
783 |
foreach ( $customs as $cust ) {
|
784 |
-
$custom_text = $wpdb->get_var(
|
785 |
-
|
|
|
|
|
|
|
|
|
|
|
786 |
if ( '' != $added_custom && $added_custom > 0 ) {
|
787 |
$custom_id = $added_custom;
|
788 |
} else {
|
789 |
$wpdb->insert( $GLOBALS['wpdb']->yop_poll_elements,
|
790 |
-
['poll_id'=> $lresult->poll_id,
|
791 |
'author' => $current_user->ID,
|
792 |
'etext' => 'Custom field',
|
793 |
'etype' => 'custom_field',
|
@@ -829,7 +849,7 @@ class ClassYopPollImporter5x {
|
|
829 |
'vote_message' => serialize( $vote_message ),
|
830 |
'added_date' => $lresult->vote_date
|
831 |
);
|
832 |
-
$logsArray[] = $wpdb->prepare(
|
833 |
$data['tracking_id'], $data['voter_id'], $data['voter_fingerprint'], $data['vote_data'], $data['vote_message'], $data['added_date'] );
|
834 |
}
|
835 |
$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`,
|
@@ -837,25 +857,25 @@ class ClassYopPollImporter5x {
|
|
837 |
$query .= implode( ",\n", $logsArray );
|
838 |
$response = $wpdb->query( $query );
|
839 |
if ( $response ) {
|
840 |
-
$result = $wpdb->query( "update `{$polls_logs_table_name}` set `processed` = true where `ID` in (" . implode( ',', $logsIds ) .
|
841 |
self::$processed_logs += $result;
|
842 |
if ( self::$processed_logs == self::$unprocessed_logs ) {
|
843 |
-
return [ 'response_code' => -1, 'message' =>
|
844 |
} else {
|
845 |
-
return [ 'response_code' => 1, 'message' =>
|
846 |
}
|
847 |
} else {
|
848 |
-
return [ 'response_code' => 1, 'message' =>
|
849 |
}
|
850 |
}
|
851 |
} else {
|
852 |
-
return [ 'response_code' => - 1, 'message' =>
|
853 |
}
|
854 |
}
|
855 |
|
856 |
private static function check_if_table_exists( $table_name ) {
|
857 |
global $wpdb;
|
858 |
-
if ( 0 == $wpdb->get_var( $wpdb->prepare(
|
859 |
DB_NAME, $table_name ) ) ) {
|
860 |
return false;
|
861 |
}
|
@@ -865,7 +885,7 @@ class ClassYopPollImporter5x {
|
|
865 |
private static function check_if_column_exists( $table_name, $column_name ) {
|
866 |
global $wpdb;
|
867 |
if ( 0 == $wpdb->get_var( $wpdb->prepare(
|
868 |
-
|
869 |
DB_NAME, $table_name, $column_name
|
870 |
) ) ) {
|
871 |
return false;
|
@@ -2584,71 +2604,72 @@ class ClassYopPollImporter5x {
|
|
2584 |
|
2585 |
public static function yop_ajax_import() {
|
2586 |
if ( false === is_user_logged_in() ) {
|
2587 |
-
wp_send_json_error(
|
2588 |
wp_die();
|
2589 |
}
|
2590 |
-
if ( check_ajax_referer( 'yop-poll-ajax-importer', '_csrf_token', false ) ){
|
2591 |
$skip_table_check = false;
|
2592 |
if ( isset( $_REQUEST['enableGdpr'] ) && isset( $_REQUEST['gdprSolution'] ) ) {
|
2593 |
-
self::set_gdpr( $_REQUEST['enableGdpr'], $_REQUEST['gdprSolution'] );
|
2594 |
-
}
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
|
|
|
|
2607 |
}
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
}
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
}
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
}
|
2646 |
-
break;
|
2647 |
}
|
2648 |
}
|
2649 |
wp_die();
|
2650 |
} else {
|
2651 |
-
wp_send_json_error(
|
2652 |
wp_die();
|
2653 |
}
|
2654 |
}
|
56 |
}
|
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 ) {
|
117 |
if ( isset( $unserialized_meta['sorting_results'] ) && '' != $unserialized_meta['sorting_results'] ) {
|
118 |
if ( 'votes' === $unserialized_meta['sorting_results'] ) {
|
119 |
$sorting_results = 'number-of-votes';
|
120 |
+
} elseif ( 'as_defined' === $unserialized_meta['sorting_results'] || 'exact' === $unserialized_meta['sorting_results'] ) {
|
121 |
$sorting_results = 'as-defined';
|
122 |
} else {
|
123 |
$sorting_results = $unserialized_meta['sorting_results'];
|
148 |
} else {
|
149 |
$newBlVoters[] = 'no-block';
|
150 |
}
|
151 |
+
if ( isset( $unserialized_meta['view_results_type'] ) ) {
|
152 |
+
switch ( $unserialized_meta['view_results_type'] ) {
|
153 |
case 'votes-number': {
|
154 |
$resultsDetails = ['votes-number'];
|
155 |
break;
|
171 |
$resultsDetails = ['percentages'];
|
172 |
}
|
173 |
$pro_templates_ids = [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28];
|
174 |
+
if ( isset( $unserialized_meta['template'] ) ) {
|
175 |
+
if ( in_array( $unserialized_meta['template'], $pro_templates_ids ) ) {
|
176 |
$template_base = 'basic-pretty';
|
177 |
} else {
|
178 |
$template_base = 'basic';
|
247 |
isset( $unserialized_meta['email_notifications_from_name'] ) && '' !== $unserialized_meta['email_notifications_from_name'] ? $unserialized_meta['email_notifications_from_name'] : 'Voting Alerts',
|
248 |
'emailNotificationsFromEmail' =>
|
249 |
isset( $unserialized_meta['email_notifications_from_email'] ) && '' !== $unserialized_meta['email_notifications_from_email'] ? $unserialized_meta['email_notifications_from_email'] : $adminUser->user_email,
|
250 |
+
'emailNotificationsRecipients' => isset( $unserialized_meta['email_notifications_recipients'] ) && '' !== $unserialized_meta['email_notifications_recipients'] ? $unserialized_meta['email_notifications_recipients'] : $adminUser->user_email,
|
251 |
'emailNotificationsSubject' =>
|
252 |
isset( $unserialized_meta['email_notifications_subject'] ) && '' !== $unserialized_meta['email_notifications_subject'] ? $unserialized_meta['email_notifications_subject'] : 'New Vote',
|
253 |
'emailNotificationsMessage' =>
|
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 ) {
|
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;
|
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;
|
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;
|
366 |
$x ++;
|
367 |
}
|
368 |
if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
|
369 |
+
if ( 'orizontal' === $unserialized_q_meta['display_answers'] ) {
|
370 |
$answersDisplay = 'horizontal';
|
371 |
} elseif ( 'tabulated' === $unserialized_q_meta['display_answers'] ) {
|
372 |
$answersDisplay = 'columns';
|
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;
|
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;
|
443 |
$x ++;
|
444 |
}
|
445 |
if ( isset( $unserialized_q_meta['display_answers'] ) && '' != $unserialized_q_meta['display_answers'] ) {
|
446 |
+
if ( 'orizontal' === $unserialized_q_meta['display_answers'] ) {
|
447 |
$answersDisplay = 'horizontal';
|
448 |
} elseif ( 'tabulated' === $unserialized_q_meta['display_answers'] ) {
|
449 |
$answersDisplay = 'columns';
|
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' =>
|
466 |
+
( isset( $unserialized_q_meta['add_other_answers_to_default_answers'] ) && ( '' !== strval( $unserialized_q_meta['add_other_answers_to_default_answers'] ) ) ) ? $unserialized_q_meta['add_other_answers_to_default_answers'] : 'no',
|
467 |
'displayOtherAnswersInResults' =>
|
468 |
isset( $unserialized_q_meta['display_other_answers_values'] ) ? $unserialized_q_meta['display_other_answers_values'] : 'no',
|
469 |
'resultsColorForOtherAnswers' => '#000000',
|
517 |
private static function make_ip_gdpr_compliant( $ipaddress ) {
|
518 |
$compliant_ipaddress = '';
|
519 |
if ( 'yes' === self::$enableGdpr ) {
|
520 |
+
switch ( self::$gdprSolution ) {
|
521 |
case 'consent': {
|
522 |
$compliant_ipaddress = $ipaddress;
|
523 |
break;
|
544 |
private static function make_cookie_gdpr_compliant( $cookie ) {
|
545 |
$compliant_cookie = '';
|
546 |
if ( 'yes' === self::$enableGdpr ) {
|
547 |
+
switch ( self::$gdprSolution ) {
|
548 |
case 'consent': {
|
549 |
$compliant_cookie = $cookie;
|
550 |
break;
|
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 ";
|
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 |
}
|
627 |
$polls_results_table_name = $GLOBALS['wpdb']->prefix . 'yop2_poll_results';
|
628 |
$polls_results_customs_table_name = $GLOBALS['wpdb']->prefix . 'yop2_poll_votes_custom_fields';
|
629 |
$current_user = wp_get_current_user();
|
630 |
+
if ( $skip_table_check ) {
|
631 |
self::$checked_existence_votes = true;
|
632 |
self::$votes_table_exists = true;
|
633 |
}
|
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 = [];
|
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'][] = [
|
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',
|
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`,
|
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 |
}
|
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 = [];
|
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',
|
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`,
|
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 |
}
|
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;
|
2604 |
|
2605 |
public static function yop_ajax_import() {
|
2606 |
if ( false === is_user_logged_in() ) {
|
2607 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
2608 |
wp_die();
|
2609 |
}
|
2610 |
+
if ( check_ajax_referer( 'yop-poll-ajax-importer', '_csrf_token', false ) ) {
|
2611 |
$skip_table_check = false;
|
2612 |
if ( isset( $_REQUEST['enableGdpr'] ) && isset( $_REQUEST['gdprSolution'] ) ) {
|
2613 |
+
self::set_gdpr( sanitize_text_field( wp_unslash( $_REQUEST['enableGdpr'] ) ), sanitize_text_field( wp_unslash( $_REQUEST['gdprSolution'] ) ) );
|
2614 |
+
}
|
2615 |
+
if ( true === isset( $_REQUEST['table'] ) ) {
|
2616 |
+
switch ( $_REQUEST['table'] ) {
|
2617 |
+
case 'polls': {
|
2618 |
+
$response = self::import_polls( self::$ajax_limit, $skip_table_check );
|
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 |
}
|
2630 |
+
case 'bans': {
|
2631 |
+
$response = self::import_bans( $skip_table_check );
|
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 |
}
|
2643 |
+
case 'votes': {
|
2644 |
+
$response = self::import_votes( $skip_table_check );
|
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 |
}
|
2656 |
+
case 'logs': {
|
2657 |
+
$response = self::import_logs( $skip_table_check );
|
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 |
}
|
|
|
2668 |
}
|
2669 |
}
|
2670 |
wp_die();
|
2671 |
} else {
|
2672 |
+
wp_send_json_error( esc_html__( 'You are not allowed to perform this action', 'yop-poll' ) );
|
2673 |
wp_die();
|
2674 |
}
|
2675 |
}
|
admin/inc/Helper.php
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
<?php
|
2 |
class YOP_Poll_Helper {
|
3 |
-
public static $ipv4NetMask =
|
4 |
-
public static $ipv6NetMask =
|
5 |
public static function objectToArray( $d ) {
|
6 |
if ( is_object( $d ) ) {
|
7 |
$d = get_object_vars( $d );
|
8 |
}
|
9 |
if ( is_array( $d ) ) {
|
10 |
return array_map( [__CLASS__, __METHOD__], $d );
|
11 |
-
}
|
12 |
-
else {
|
13 |
return $d;
|
14 |
}
|
15 |
}
|
@@ -26,9 +25,9 @@ class YOP_Poll_Helper {
|
|
26 |
}
|
27 |
public static function yop_fputcsv( $handle, $fields, $delimiter = ',', $enclosure = '"', $escape = '\\' ) {
|
28 |
foreach ( $fields as $key => $field ) {
|
29 |
-
$field = addslashes
|
30 |
-
if ( !preg_match('/^(["\']).*\1$/m', $field ) ) {
|
31 |
-
$fields[$key] =
|
32 |
} else {
|
33 |
$fields[$key] = $field;
|
34 |
}
|
@@ -44,11 +43,11 @@ class YOP_Poll_Helper {
|
|
44 |
} elseif ( 16 == strlen( $packedAddress ) ) {
|
45 |
return self::anonymize_ipv6( $address );
|
46 |
} else {
|
47 |
-
return
|
48 |
}
|
49 |
}
|
50 |
public static function anonymize_ipv4( $address ) {
|
51 |
-
return inet_ntop(inet_pton( $address ) & inet_pton( self::$ipv4NetMask ) );
|
52 |
}
|
53 |
public static function anonymize_ipv6( $address ) {
|
54 |
return inet_ntop( inet_pton( $address ) & inet_pton( self::$ipv6NetMask ) );
|
1 |
<?php
|
2 |
class YOP_Poll_Helper {
|
3 |
+
public static $ipv4NetMask = '255.255.255.0';
|
4 |
+
public static $ipv6NetMask = 'ffff:ffff:ffff:ffff:ffff:ffff:0:0';
|
5 |
public static function objectToArray( $d ) {
|
6 |
if ( is_object( $d ) ) {
|
7 |
$d = get_object_vars( $d );
|
8 |
}
|
9 |
if ( is_array( $d ) ) {
|
10 |
return array_map( [__CLASS__, __METHOD__], $d );
|
11 |
+
} else {
|
|
|
12 |
return $d;
|
13 |
}
|
14 |
}
|
25 |
}
|
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 |
}
|
43 |
} elseif ( 16 == strlen( $packedAddress ) ) {
|
44 |
return self::anonymize_ipv6( $address );
|
45 |
} else {
|
46 |
+
return '';
|
47 |
}
|
48 |
}
|
49 |
public static function anonymize_ipv4( $address ) {
|
50 |
+
return inet_ntop( inet_pton( $address ) & inet_pton( self::$ipv4NetMask ) );
|
51 |
}
|
52 |
public static function anonymize_ipv6( $address ) {
|
53 |
return inet_ntop( inet_pton( $address ) & inet_pton( self::$ipv6NetMask ) );
|
admin/inc/dbschema.php
CHANGED
@@ -94,7 +94,7 @@ class Yop_Poll_DbSchema {
|
|
94 |
modified_date datetime NOT NULL,
|
95 |
PRIMARY KEY (id)
|
96 |
) {$this->charset};";
|
97 |
-
dbDelta( $create_table_sql);
|
98 |
}
|
99 |
public function create_table_votes() {
|
100 |
$create_table_sql = "CREATE TABLE `{$GLOBALS['wpdb']->yop_poll_votes}` (
|
@@ -310,13 +310,13 @@ class Yop_Poll_DbSchema {
|
|
310 |
public function install_skins() {
|
311 |
$table = $GLOBALS['wpdb']->yop_poll_skins;
|
312 |
$available_skins = YOP_Poll_Skins::get_skins();
|
313 |
-
$skins=array(
|
314 |
0 => array(
|
315 |
'template_base' => 'basic',
|
316 |
'name' => 'Orange Def',
|
317 |
'base' => 'orange-def',
|
318 |
'description' => '',
|
319 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-def" style="padding-top: 14px;padding-bottom: 14px;">
|
320 |
<div class="row">
|
321 |
<div class="col-md-12">
|
322 |
<div class="basic-inner">
|
@@ -429,7 +429,7 @@ class Yop_Poll_DbSchema {
|
|
429 |
'name' => 'Dark V1',
|
430 |
'base' => 'dark-v1',
|
431 |
'description' => '',
|
432 |
-
'html_preview'=> '<div class="basic-yop-poll-container dark-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
433 |
<div class="row">
|
434 |
<div class="col-md-12">
|
435 |
<div class="basic-inner">
|
@@ -484,7 +484,7 @@ class Yop_Poll_DbSchema {
|
|
484 |
</div><!-- end basic-yop-poll-container -->',
|
485 |
'skin_type' => 'predefined',
|
486 |
'author' => 0,
|
487 |
-
'meta_data' => serialize(
|
488 |
array(
|
489 |
'poll' => array(
|
490 |
'backgroundColor' => '#555555',
|
@@ -544,7 +544,7 @@ class Yop_Poll_DbSchema {
|
|
544 |
'name' => 'Gray V1',
|
545 |
'base' => 'gray-v1',
|
546 |
'description' => '',
|
547 |
-
'html_preview'=> '<div class="basic-yop-poll-container grey" style="padding-top: 15px;padding-bottom: 15px;">
|
548 |
<div class="row">
|
549 |
<div class="col-md-12">
|
550 |
<div class="basic-inner">
|
@@ -659,7 +659,7 @@ class Yop_Poll_DbSchema {
|
|
659 |
'name' => 'White V1',
|
660 |
'base' => 'white-v1',
|
661 |
'description' => '',
|
662 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
663 |
<div class="row">
|
664 |
<div class="col-md-12">
|
665 |
<div class="basic-inner">
|
@@ -774,7 +774,7 @@ class Yop_Poll_DbSchema {
|
|
774 |
'name' => 'Dark V2',
|
775 |
'base' => 'dark-v2',
|
776 |
'description' => '',
|
777 |
-
'html_preview'=> '<div class="basic-yop-poll-container dark-v2" style="padding-top: 15px;padding-bottom: 15px;">
|
778 |
<div class="row">
|
779 |
<div class="col-md-12">
|
780 |
<div class="basic-inner">
|
@@ -889,7 +889,7 @@ class Yop_Poll_DbSchema {
|
|
889 |
'name' => 'White V2',
|
890 |
'base' => 'white-v2',
|
891 |
'description' => '',
|
892 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px;padding-bottom: 14px;">
|
893 |
<div class="row">
|
894 |
<div class="col-md-12">
|
895 |
<div class="basic-inner">
|
@@ -1004,7 +1004,7 @@ class Yop_Poll_DbSchema {
|
|
1004 |
'name' => 'Orange V1',
|
1005 |
'base' => 'orange-v1',
|
1006 |
'description' => '',
|
1007 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
1008 |
<div class="row">
|
1009 |
<div class="col-md-12">
|
1010 |
<div class="basic-inner">
|
@@ -1119,7 +1119,7 @@ class Yop_Poll_DbSchema {
|
|
1119 |
'name' => 'Orange V2',
|
1120 |
'base' => 'orange-v2',
|
1121 |
'description' => '',
|
1122 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-v2">
|
1123 |
<div class="row">
|
1124 |
<div class="col-md-12">
|
1125 |
<div class="basic-inner">
|
@@ -1238,7 +1238,7 @@ class Yop_Poll_DbSchema {
|
|
1238 |
'name' => 'Orange V3',
|
1239 |
'base' => 'orange-v3',
|
1240 |
'description' => '',
|
1241 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
1242 |
<div class="row">
|
1243 |
<div class="col-md-12">
|
1244 |
<div class="basic-inner">
|
@@ -1353,7 +1353,7 @@ class Yop_Poll_DbSchema {
|
|
1353 |
'name' => 'Orange V4',
|
1354 |
'base' => 'orange-v4',
|
1355 |
'description' => '',
|
1356 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
1357 |
<div class="row">
|
1358 |
<div class="col-md-12">
|
1359 |
<div class="basic-inner">
|
@@ -1468,7 +1468,7 @@ class Yop_Poll_DbSchema {
|
|
1468 |
'name' => 'Orange V5',
|
1469 |
'base' => 'orange-v5',
|
1470 |
'description' => '',
|
1471 |
-
'html_preview'=> '<div class="basic-yop-poll-container orange-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
1472 |
<div class="row">
|
1473 |
<div class="col-md-12">
|
1474 |
<div class="basic-inner">
|
@@ -1583,7 +1583,7 @@ class Yop_Poll_DbSchema {
|
|
1583 |
'name' => 'Green V1',
|
1584 |
'base' => 'green-v1',
|
1585 |
'description' => '',
|
1586 |
-
'html_preview'=> '<div class="basic-yop-poll-container green-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
1587 |
<div class="row">
|
1588 |
<div class="col-md-12">
|
1589 |
<div class="basic-inner">
|
@@ -1698,7 +1698,7 @@ class Yop_Poll_DbSchema {
|
|
1698 |
'name' => 'Green V2',
|
1699 |
'base' => 'green-v2',
|
1700 |
'description' => '',
|
1701 |
-
'html_preview'=> '<div class="basic-yop-poll-container green-v2">
|
1702 |
<div class="row">
|
1703 |
<div class="col-md-12">
|
1704 |
<div class="basic-inner">
|
@@ -1813,7 +1813,7 @@ class Yop_Poll_DbSchema {
|
|
1813 |
'name' => 'Green V3',
|
1814 |
'base' => 'green-v3',
|
1815 |
'description' => '',
|
1816 |
-
'html_preview'=> '<div class="basic-yop-poll-container green-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
1817 |
<div class="row">
|
1818 |
<div class="col-md-12">
|
1819 |
<div class="basic-inner">
|
@@ -1928,7 +1928,7 @@ class Yop_Poll_DbSchema {
|
|
1928 |
'name' => 'Green V4',
|
1929 |
'base' => 'green-v4',
|
1930 |
'description' => '',
|
1931 |
-
'html_preview'=> '<div class="basic-yop-poll-container green-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
1932 |
<div class="row">
|
1933 |
<div class="col-md-12">
|
1934 |
<div class="basic-inner">
|
@@ -2043,7 +2043,7 @@ class Yop_Poll_DbSchema {
|
|
2043 |
'name' => 'Green V5',
|
2044 |
'base' => 'green-v5',
|
2045 |
'description' => '',
|
2046 |
-
'html_preview'=> '<div class="basic-yop-poll-container green-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
2047 |
<div class="row">
|
2048 |
<div class="col-md-12">
|
2049 |
<div class="basic-inner">
|
@@ -2158,7 +2158,7 @@ class Yop_Poll_DbSchema {
|
|
2158 |
'name' => 'Red V1',
|
2159 |
'base' => 'red-v1',
|
2160 |
'description' => '',
|
2161 |
-
'html_preview'=> '<div class="basic-yop-poll-container red-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
2162 |
<div class="row">
|
2163 |
<div class="col-md-12">
|
2164 |
<div class="basic-inner">
|
@@ -2273,7 +2273,7 @@ class Yop_Poll_DbSchema {
|
|
2273 |
'name' => 'Red V2',
|
2274 |
'base' => 'red-v2',
|
2275 |
'description' => '',
|
2276 |
-
'html_preview'=> '<div class="basic-yop-poll-container red-v2">
|
2277 |
<div class="row">
|
2278 |
<div class="col-md-12">
|
2279 |
<div class="basic-inner">
|
@@ -2392,7 +2392,7 @@ class Yop_Poll_DbSchema {
|
|
2392 |
'name' => 'Red V3',
|
2393 |
'base' => 'red-v3',
|
2394 |
'description' => '',
|
2395 |
-
'html_preview'=> '<div class="basic-yop-poll-container red-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
2396 |
<div class="row">
|
2397 |
<div class="col-md-12">
|
2398 |
<div class="basic-inner">
|
@@ -2507,7 +2507,7 @@ class Yop_Poll_DbSchema {
|
|
2507 |
'name' => 'Red V4',
|
2508 |
'base' => 'red-v4',
|
2509 |
'description' => '',
|
2510 |
-
'html_preview'=> '<div class="basic-yop-poll-container red-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
2511 |
<div class="row">
|
2512 |
<div class="col-md-12">
|
2513 |
<div class="basic-inner">
|
@@ -2622,7 +2622,7 @@ class Yop_Poll_DbSchema {
|
|
2622 |
'name' => 'Red V5',
|
2623 |
'base' => 'red-v5',
|
2624 |
'description' => '',
|
2625 |
-
'html_preview'=> '<div class="basic-yop-poll-container red-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
2626 |
<div class="row">
|
2627 |
<div class="col-md-12">
|
2628 |
<div class="basic-inner">
|
@@ -2737,7 +2737,7 @@ class Yop_Poll_DbSchema {
|
|
2737 |
'name' => 'Blue V1',
|
2738 |
'base' => 'blue-v1',
|
2739 |
'description' => '',
|
2740 |
-
'html_preview'=> '<div class="basic-yop-poll-container blue-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
2741 |
<div class="row">
|
2742 |
<div class="col-md-12">
|
2743 |
<div class="basic-inner">
|
@@ -2852,7 +2852,7 @@ class Yop_Poll_DbSchema {
|
|
2852 |
'name' => 'Blue V2',
|
2853 |
'base' => 'blue-v2',
|
2854 |
'description' => '',
|
2855 |
-
'html_preview'=> '<div class="basic-yop-poll-container blue-v2">
|
2856 |
<div class="row">
|
2857 |
<div class="col-md-12">
|
2858 |
<div class="basic-inner">
|
@@ -2971,7 +2971,7 @@ class Yop_Poll_DbSchema {
|
|
2971 |
'name' => 'Blue V3',
|
2972 |
'base' => 'blue-v3',
|
2973 |
'description' => '',
|
2974 |
-
'html_preview'=> '<div class="basic-yop-poll-container blue-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
2975 |
<div class="row">
|
2976 |
<div class="col-md-12">
|
2977 |
<div class="basic-inner">
|
@@ -3086,7 +3086,7 @@ class Yop_Poll_DbSchema {
|
|
3086 |
'name' => 'Blue V4',
|
3087 |
'base' => 'blue-v4',
|
3088 |
'description' => '',
|
3089 |
-
'html_preview'=> '<div class="basic-yop-poll-container blue-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
3090 |
<div class="row">
|
3091 |
<div class="col-md-12">
|
3092 |
<div class="basic-inner">
|
@@ -3201,7 +3201,7 @@ class Yop_Poll_DbSchema {
|
|
3201 |
'name' => 'Blue V5',
|
3202 |
'base' => 'blue-v5',
|
3203 |
'description' => '',
|
3204 |
-
'html_preview'=> '<div class="basic-yop-poll-container blue-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
3205 |
<div class="row">
|
3206 |
<div class="col-md-12">
|
3207 |
<div class="basic-inner">
|
@@ -3316,7 +3316,7 @@ class Yop_Poll_DbSchema {
|
|
3316 |
'name' => 'Square Black',
|
3317 |
'base' => 'square-black',
|
3318 |
'description' => '',
|
3319 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="black">
|
3320 |
<div class="row">
|
3321 |
<div class="col-md-12">
|
3322 |
<div class="basic-inner">
|
@@ -3431,7 +3431,7 @@ class Yop_Poll_DbSchema {
|
|
3431 |
'name' => 'Square Red',
|
3432 |
'base' => 'square-red',
|
3433 |
'description' => '',
|
3434 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="red">
|
3435 |
<div class="row">
|
3436 |
<div class="col-md-12">
|
3437 |
<div class="basic-inner">
|
@@ -3546,7 +3546,7 @@ class Yop_Poll_DbSchema {
|
|
3546 |
'name' => 'Square Green',
|
3547 |
'base' => 'square-green',
|
3548 |
'description' => '',
|
3549 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="green">
|
3550 |
<div class="row">
|
3551 |
<div class="col-md-12">
|
3552 |
<div class="basic-inner">
|
@@ -3661,7 +3661,7 @@ class Yop_Poll_DbSchema {
|
|
3661 |
'name' => 'Square Blue',
|
3662 |
'base' => 'square-blue',
|
3663 |
'description' => '',
|
3664 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="blue">
|
3665 |
<div class="row">
|
3666 |
<div class="col-md-12">
|
3667 |
<div class="basic-inner">
|
@@ -3776,7 +3776,7 @@ class Yop_Poll_DbSchema {
|
|
3776 |
'name' => 'Square Aero',
|
3777 |
'base' => 'square-aero',
|
3778 |
'description' => '',
|
3779 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="aero">
|
3780 |
<div class="row">
|
3781 |
<div class="col-md-12">
|
3782 |
<div class="basic-inner">
|
@@ -3891,7 +3891,7 @@ class Yop_Poll_DbSchema {
|
|
3891 |
'name' => 'Square Grey',
|
3892 |
'base' => 'square-grey',
|
3893 |
'description' => '',
|
3894 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="grey">
|
3895 |
<div class="row">
|
3896 |
<div class="col-md-12">
|
3897 |
<div class="basic-inner">
|
@@ -4006,7 +4006,7 @@ class Yop_Poll_DbSchema {
|
|
4006 |
'name' => 'Square Orange',
|
4007 |
'base' => 'square-orange',
|
4008 |
'description' => '',
|
4009 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="orange">
|
4010 |
<div class="row">
|
4011 |
<div class="col-md-12">
|
4012 |
<div class="basic-inner">
|
@@ -4121,7 +4121,7 @@ class Yop_Poll_DbSchema {
|
|
4121 |
'name' => 'Square Yellow',
|
4122 |
'base' => 'square-yellow',
|
4123 |
'description' => '',
|
4124 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="yellow">
|
4125 |
<div class="row">
|
4126 |
<div class="col-md-12">
|
4127 |
<div class="basic-inner">
|
@@ -4236,7 +4236,7 @@ class Yop_Poll_DbSchema {
|
|
4236 |
'name' => 'Square Pink',
|
4237 |
'base' => 'square-pink',
|
4238 |
'description' => '',
|
4239 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="pink">
|
4240 |
<div class="row">
|
4241 |
<div class="col-md-12">
|
4242 |
<div class="basic-inner">
|
@@ -4351,7 +4351,7 @@ class Yop_Poll_DbSchema {
|
|
4351 |
'name' => 'Square Purple',
|
4352 |
'base' => 'square-purple',
|
4353 |
'description' => '',
|
4354 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="purple">
|
4355 |
<div class="row">
|
4356 |
<div class="col-md-12">
|
4357 |
<div class="basic-inner">
|
@@ -4466,7 +4466,7 @@ class Yop_Poll_DbSchema {
|
|
4466 |
'name' => 'Flat Black',
|
4467 |
'base' => 'flat-black',
|
4468 |
'description' => '',
|
4469 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="black">
|
4470 |
<div class="row">
|
4471 |
<div class="col-md-12">
|
4472 |
<div class="basic-inner">
|
@@ -4581,7 +4581,7 @@ class Yop_Poll_DbSchema {
|
|
4581 |
'name' => 'Flat Red',
|
4582 |
'base' => 'flat-red',
|
4583 |
'description' => '',
|
4584 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="red">
|
4585 |
<div class="row">
|
4586 |
<div class="col-md-12">
|
4587 |
<div class="basic-inner">
|
@@ -4696,7 +4696,7 @@ class Yop_Poll_DbSchema {
|
|
4696 |
'name' => 'Flat Green',
|
4697 |
'base' => 'flat-green',
|
4698 |
'description' => '',
|
4699 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="green">
|
4700 |
<div class="row">
|
4701 |
<div class="col-md-12">
|
4702 |
<div class="basic-inner">
|
@@ -4811,7 +4811,7 @@ class Yop_Poll_DbSchema {
|
|
4811 |
'name' => 'Flat Blue',
|
4812 |
'base' => 'flat-blue',
|
4813 |
'description' => '',
|
4814 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="blue">
|
4815 |
<div class="row">
|
4816 |
<div class="col-md-12">
|
4817 |
<div class="basic-inner">
|
@@ -4926,7 +4926,7 @@ class Yop_Poll_DbSchema {
|
|
4926 |
'name' => 'Flat Aero',
|
4927 |
'base' => 'flat-aero',
|
4928 |
'description' => '',
|
4929 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="aero">
|
4930 |
<div class="row">
|
4931 |
<div class="col-md-12">
|
4932 |
<div class="basic-inner">
|
@@ -5041,7 +5041,7 @@ class Yop_Poll_DbSchema {
|
|
5041 |
'name' => 'Flat Grey',
|
5042 |
'base' => 'flat-grey',
|
5043 |
'description' => '',
|
5044 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="grey">
|
5045 |
<div class="row">
|
5046 |
<div class="col-md-12">
|
5047 |
<div class="basic-inner">
|
@@ -5156,7 +5156,7 @@ class Yop_Poll_DbSchema {
|
|
5156 |
'name' => 'Flat Orange',
|
5157 |
'base' => 'flat-orange',
|
5158 |
'description' => '',
|
5159 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="orange">
|
5160 |
<div class="row">
|
5161 |
<div class="col-md-12">
|
5162 |
<div class="basic-inner">
|
@@ -5271,7 +5271,7 @@ class Yop_Poll_DbSchema {
|
|
5271 |
'name' => 'Flat Yellow',
|
5272 |
'base' => 'flat-yellow',
|
5273 |
'description' => '',
|
5274 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="yellow">
|
5275 |
<div class="row">
|
5276 |
<div class="col-md-12">
|
5277 |
<div class="basic-inner">
|
@@ -5386,7 +5386,7 @@ class Yop_Poll_DbSchema {
|
|
5386 |
'name' => 'Flat Pink',
|
5387 |
'base' => 'flat-pink',
|
5388 |
'description' => '',
|
5389 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="pink">
|
5390 |
<div class="row">
|
5391 |
<div class="col-md-12">
|
5392 |
<div class="basic-inner">
|
@@ -5501,7 +5501,7 @@ class Yop_Poll_DbSchema {
|
|
5501 |
'name' => 'Flat Purple',
|
5502 |
'base' => 'flat-purple',
|
5503 |
'description' => '',
|
5504 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="purple">
|
5505 |
<div class="row">
|
5506 |
<div class="col-md-12">
|
5507 |
<div class="basic-inner">
|
@@ -5616,7 +5616,7 @@ class Yop_Poll_DbSchema {
|
|
5616 |
'name' => 'Minimal Black',
|
5617 |
'base' => 'minimal-black',
|
5618 |
'description' => '',
|
5619 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="black">
|
5620 |
<div class="row">
|
5621 |
<div class="col-md-12">
|
5622 |
<div class="basic-inner">
|
@@ -5731,7 +5731,7 @@ class Yop_Poll_DbSchema {
|
|
5731 |
'name' => 'Minimal Red',
|
5732 |
'base' => 'minimal-red',
|
5733 |
'description' => '',
|
5734 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="red">
|
5735 |
<div class="row">
|
5736 |
<div class="col-md-12">
|
5737 |
<div class="basic-inner">
|
@@ -5846,7 +5846,7 @@ class Yop_Poll_DbSchema {
|
|
5846 |
'name' => 'Minimal Green',
|
5847 |
'base' => 'minimal-green',
|
5848 |
'description' => '',
|
5849 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="green">
|
5850 |
<div class="row">
|
5851 |
<div class="col-md-12">
|
5852 |
<div class="basic-inner">
|
@@ -5961,7 +5961,7 @@ class Yop_Poll_DbSchema {
|
|
5961 |
'name' => 'Minimal Blue',
|
5962 |
'base' => 'minimal-blue',
|
5963 |
'description' => '',
|
5964 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="blue">
|
5965 |
<div class="row">
|
5966 |
<div class="col-md-12">
|
5967 |
<div class="basic-inner">
|
@@ -6076,7 +6076,7 @@ class Yop_Poll_DbSchema {
|
|
6076 |
'name' => 'Minimal Aero',
|
6077 |
'base' => 'minimal-aero',
|
6078 |
'description' => '',
|
6079 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="aero">
|
6080 |
<div class="row">
|
6081 |
<div class="col-md-12">
|
6082 |
<div class="basic-inner">
|
@@ -6191,7 +6191,7 @@ class Yop_Poll_DbSchema {
|
|
6191 |
'name' => 'Minimal Grey',
|
6192 |
'base' => 'minimal-grey',
|
6193 |
'description' => '',
|
6194 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="grey">
|
6195 |
<div class="row">
|
6196 |
<div class="col-md-12">
|
6197 |
<div class="basic-inner">
|
@@ -6306,7 +6306,7 @@ class Yop_Poll_DbSchema {
|
|
6306 |
'name' => 'Minimal Orange',
|
6307 |
'base' => 'minimal-orange',
|
6308 |
'description' => '',
|
6309 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="orange">
|
6310 |
<div class="row">
|
6311 |
<div class="col-md-12">
|
6312 |
<div class="basic-inner">
|
@@ -6421,7 +6421,7 @@ class Yop_Poll_DbSchema {
|
|
6421 |
'name' => 'Minimal Yellow',
|
6422 |
'base' => 'minimal-yellow',
|
6423 |
'description' => '',
|
6424 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="yellow">
|
6425 |
<div class="row">
|
6426 |
<div class="col-md-12">
|
6427 |
<div class="basic-inner">
|
@@ -6536,7 +6536,7 @@ class Yop_Poll_DbSchema {
|
|
6536 |
'name' => 'Minimal Pink',
|
6537 |
'base' => 'minimal-pink',
|
6538 |
'description' => '',
|
6539 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="pink">
|
6540 |
<div class="row">
|
6541 |
<div class="col-md-12">
|
6542 |
<div class="basic-inner">
|
@@ -6651,7 +6651,7 @@ class Yop_Poll_DbSchema {
|
|
6651 |
'name' => 'Minimal Purple',
|
6652 |
'base' => 'minimal-purple',
|
6653 |
'description' => '',
|
6654 |
-
'html_preview'=> '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="purple">
|
6655 |
<div class="row">
|
6656 |
<div class="col-md-12">
|
6657 |
<div class="basic-inner">
|
@@ -6877,7 +6877,7 @@ class Yop_Poll_DbSchema {
|
|
6877 |
</div><!-- end row -->
|
6878 |
</div><!-- end basic-yop-poll-container -->'
|
6879 |
);
|
6880 |
-
if (
|
6881 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_vertical' ) ) &&
|
6882 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_horizontal' ) ) &&
|
6883 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_columns' ) )
|
@@ -6899,10 +6899,14 @@ class Yop_Poll_DbSchema {
|
|
6899 |
$GLOBALS['wpdb']->query( $update_query );
|
6900 |
}
|
6901 |
private function check_if_column_exists( $table_name, $column_name ) {
|
6902 |
-
if ( 0 == $GLOBALS['wpdb']->get_var(
|
6903 |
-
|
6904 |
-
|
6905 |
-
|
|
|
|
|
|
|
|
|
6906 |
return false;
|
6907 |
}
|
6908 |
return true;
|
94 |
modified_date datetime NOT NULL,
|
95 |
PRIMARY KEY (id)
|
96 |
) {$this->charset};";
|
97 |
+
dbDelta( $create_table_sql );
|
98 |
}
|
99 |
public function create_table_votes() {
|
100 |
$create_table_sql = "CREATE TABLE `{$GLOBALS['wpdb']->yop_poll_votes}` (
|
310 |
public function install_skins() {
|
311 |
$table = $GLOBALS['wpdb']->yop_poll_skins;
|
312 |
$available_skins = YOP_Poll_Skins::get_skins();
|
313 |
+
$skins = array(
|
314 |
0 => array(
|
315 |
'template_base' => 'basic',
|
316 |
'name' => 'Orange Def',
|
317 |
'base' => 'orange-def',
|
318 |
'description' => '',
|
319 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-def" style="padding-top: 14px;padding-bottom: 14px;">
|
320 |
<div class="row">
|
321 |
<div class="col-md-12">
|
322 |
<div class="basic-inner">
|
429 |
'name' => 'Dark V1',
|
430 |
'base' => 'dark-v1',
|
431 |
'description' => '',
|
432 |
+
'html_preview' => '<div class="basic-yop-poll-container dark-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
433 |
<div class="row">
|
434 |
<div class="col-md-12">
|
435 |
<div class="basic-inner">
|
484 |
</div><!-- end basic-yop-poll-container -->',
|
485 |
'skin_type' => 'predefined',
|
486 |
'author' => 0,
|
487 |
+
'meta_data' => serialize(
|
488 |
array(
|
489 |
'poll' => array(
|
490 |
'backgroundColor' => '#555555',
|
544 |
'name' => 'Gray V1',
|
545 |
'base' => 'gray-v1',
|
546 |
'description' => '',
|
547 |
+
'html_preview' => '<div class="basic-yop-poll-container grey" style="padding-top: 15px;padding-bottom: 15px;">
|
548 |
<div class="row">
|
549 |
<div class="col-md-12">
|
550 |
<div class="basic-inner">
|
659 |
'name' => 'White V1',
|
660 |
'base' => 'white-v1',
|
661 |
'description' => '',
|
662 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
663 |
<div class="row">
|
664 |
<div class="col-md-12">
|
665 |
<div class="basic-inner">
|
774 |
'name' => 'Dark V2',
|
775 |
'base' => 'dark-v2',
|
776 |
'description' => '',
|
777 |
+
'html_preview' => '<div class="basic-yop-poll-container dark-v2" style="padding-top: 15px;padding-bottom: 15px;">
|
778 |
<div class="row">
|
779 |
<div class="col-md-12">
|
780 |
<div class="basic-inner">
|
889 |
'name' => 'White V2',
|
890 |
'base' => 'white-v2',
|
891 |
'description' => '',
|
892 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px;padding-bottom: 14px;">
|
893 |
<div class="row">
|
894 |
<div class="col-md-12">
|
895 |
<div class="basic-inner">
|
1004 |
'name' => 'Orange V1',
|
1005 |
'base' => 'orange-v1',
|
1006 |
'description' => '',
|
1007 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
1008 |
<div class="row">
|
1009 |
<div class="col-md-12">
|
1010 |
<div class="basic-inner">
|
1119 |
'name' => 'Orange V2',
|
1120 |
'base' => 'orange-v2',
|
1121 |
'description' => '',
|
1122 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-v2">
|
1123 |
<div class="row">
|
1124 |
<div class="col-md-12">
|
1125 |
<div class="basic-inner">
|
1238 |
'name' => 'Orange V3',
|
1239 |
'base' => 'orange-v3',
|
1240 |
'description' => '',
|
1241 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
1242 |
<div class="row">
|
1243 |
<div class="col-md-12">
|
1244 |
<div class="basic-inner">
|
1353 |
'name' => 'Orange V4',
|
1354 |
'base' => 'orange-v4',
|
1355 |
'description' => '',
|
1356 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
1357 |
<div class="row">
|
1358 |
<div class="col-md-12">
|
1359 |
<div class="basic-inner">
|
1468 |
'name' => 'Orange V5',
|
1469 |
'base' => 'orange-v5',
|
1470 |
'description' => '',
|
1471 |
+
'html_preview' => '<div class="basic-yop-poll-container orange-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
1472 |
<div class="row">
|
1473 |
<div class="col-md-12">
|
1474 |
<div class="basic-inner">
|
1583 |
'name' => 'Green V1',
|
1584 |
'base' => 'green-v1',
|
1585 |
'description' => '',
|
1586 |
+
'html_preview' => '<div class="basic-yop-poll-container green-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
1587 |
<div class="row">
|
1588 |
<div class="col-md-12">
|
1589 |
<div class="basic-inner">
|
1698 |
'name' => 'Green V2',
|
1699 |
'base' => 'green-v2',
|
1700 |
'description' => '',
|
1701 |
+
'html_preview' => '<div class="basic-yop-poll-container green-v2">
|
1702 |
<div class="row">
|
1703 |
<div class="col-md-12">
|
1704 |
<div class="basic-inner">
|
1813 |
'name' => 'Green V3',
|
1814 |
'base' => 'green-v3',
|
1815 |
'description' => '',
|
1816 |
+
'html_preview' => '<div class="basic-yop-poll-container green-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
1817 |
<div class="row">
|
1818 |
<div class="col-md-12">
|
1819 |
<div class="basic-inner">
|
1928 |
'name' => 'Green V4',
|
1929 |
'base' => 'green-v4',
|
1930 |
'description' => '',
|
1931 |
+
'html_preview' => '<div class="basic-yop-poll-container green-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
1932 |
<div class="row">
|
1933 |
<div class="col-md-12">
|
1934 |
<div class="basic-inner">
|
2043 |
'name' => 'Green V5',
|
2044 |
'base' => 'green-v5',
|
2045 |
'description' => '',
|
2046 |
+
'html_preview' => '<div class="basic-yop-poll-container green-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
2047 |
<div class="row">
|
2048 |
<div class="col-md-12">
|
2049 |
<div class="basic-inner">
|
2158 |
'name' => 'Red V1',
|
2159 |
'base' => 'red-v1',
|
2160 |
'description' => '',
|
2161 |
+
'html_preview' => '<div class="basic-yop-poll-container red-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
2162 |
<div class="row">
|
2163 |
<div class="col-md-12">
|
2164 |
<div class="basic-inner">
|
2273 |
'name' => 'Red V2',
|
2274 |
'base' => 'red-v2',
|
2275 |
'description' => '',
|
2276 |
+
'html_preview' => '<div class="basic-yop-poll-container red-v2">
|
2277 |
<div class="row">
|
2278 |
<div class="col-md-12">
|
2279 |
<div class="basic-inner">
|
2392 |
'name' => 'Red V3',
|
2393 |
'base' => 'red-v3',
|
2394 |
'description' => '',
|
2395 |
+
'html_preview' => '<div class="basic-yop-poll-container red-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
2396 |
<div class="row">
|
2397 |
<div class="col-md-12">
|
2398 |
<div class="basic-inner">
|
2507 |
'name' => 'Red V4',
|
2508 |
'base' => 'red-v4',
|
2509 |
'description' => '',
|
2510 |
+
'html_preview' => '<div class="basic-yop-poll-container red-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
2511 |
<div class="row">
|
2512 |
<div class="col-md-12">
|
2513 |
<div class="basic-inner">
|
2622 |
'name' => 'Red V5',
|
2623 |
'base' => 'red-v5',
|
2624 |
'description' => '',
|
2625 |
+
'html_preview' => '<div class="basic-yop-poll-container red-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
2626 |
<div class="row">
|
2627 |
<div class="col-md-12">
|
2628 |
<div class="basic-inner">
|
2737 |
'name' => 'Blue V1',
|
2738 |
'base' => 'blue-v1',
|
2739 |
'description' => '',
|
2740 |
+
'html_preview' => '<div class="basic-yop-poll-container blue-v1" style="padding-top: 15px;padding-bottom: 15px;">
|
2741 |
<div class="row">
|
2742 |
<div class="col-md-12">
|
2743 |
<div class="basic-inner">
|
2852 |
'name' => 'Blue V2',
|
2853 |
'base' => 'blue-v2',
|
2854 |
'description' => '',
|
2855 |
+
'html_preview' => '<div class="basic-yop-poll-container blue-v2">
|
2856 |
<div class="row">
|
2857 |
<div class="col-md-12">
|
2858 |
<div class="basic-inner">
|
2971 |
'name' => 'Blue V3',
|
2972 |
'base' => 'blue-v3',
|
2973 |
'description' => '',
|
2974 |
+
'html_preview' => '<div class="basic-yop-poll-container blue-v3" style="padding-top: 12px;padding-bottom: 12px;">
|
2975 |
<div class="row">
|
2976 |
<div class="col-md-12">
|
2977 |
<div class="basic-inner">
|
3086 |
'name' => 'Blue V4',
|
3087 |
'base' => 'blue-v4',
|
3088 |
'description' => '',
|
3089 |
+
'html_preview' => '<div class="basic-yop-poll-container blue-v4" style="padding-top: 12px;padding-bottom: 12px;">
|
3090 |
<div class="row">
|
3091 |
<div class="col-md-12">
|
3092 |
<div class="basic-inner">
|
3201 |
'name' => 'Blue V5',
|
3202 |
'base' => 'blue-v5',
|
3203 |
'description' => '',
|
3204 |
+
'html_preview' => '<div class="basic-yop-poll-container blue-v5" style="padding-top: 15px;padding-bottom: 15px;">
|
3205 |
<div class="row">
|
3206 |
<div class="col-md-12">
|
3207 |
<div class="basic-inner">
|
3316 |
'name' => 'Square Black',
|
3317 |
'base' => 'square-black',
|
3318 |
'description' => '',
|
3319 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="black">
|
3320 |
<div class="row">
|
3321 |
<div class="col-md-12">
|
3322 |
<div class="basic-inner">
|
3431 |
'name' => 'Square Red',
|
3432 |
'base' => 'square-red',
|
3433 |
'description' => '',
|
3434 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="red">
|
3435 |
<div class="row">
|
3436 |
<div class="col-md-12">
|
3437 |
<div class="basic-inner">
|
3546 |
'name' => 'Square Green',
|
3547 |
'base' => 'square-green',
|
3548 |
'description' => '',
|
3549 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="green">
|
3550 |
<div class="row">
|
3551 |
<div class="col-md-12">
|
3552 |
<div class="basic-inner">
|
3661 |
'name' => 'Square Blue',
|
3662 |
'base' => 'square-blue',
|
3663 |
'description' => '',
|
3664 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="blue">
|
3665 |
<div class="row">
|
3666 |
<div class="col-md-12">
|
3667 |
<div class="basic-inner">
|
3776 |
'name' => 'Square Aero',
|
3777 |
'base' => 'square-aero',
|
3778 |
'description' => '',
|
3779 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="aero">
|
3780 |
<div class="row">
|
3781 |
<div class="col-md-12">
|
3782 |
<div class="basic-inner">
|
3891 |
'name' => 'Square Grey',
|
3892 |
'base' => 'square-grey',
|
3893 |
'description' => '',
|
3894 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="grey">
|
3895 |
<div class="row">
|
3896 |
<div class="col-md-12">
|
3897 |
<div class="basic-inner">
|
4006 |
'name' => 'Square Orange',
|
4007 |
'base' => 'square-orange',
|
4008 |
'description' => '',
|
4009 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="orange">
|
4010 |
<div class="row">
|
4011 |
<div class="col-md-12">
|
4012 |
<div class="basic-inner">
|
4121 |
'name' => 'Square Yellow',
|
4122 |
'base' => 'square-yellow',
|
4123 |
'description' => '',
|
4124 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="yellow">
|
4125 |
<div class="row">
|
4126 |
<div class="col-md-12">
|
4127 |
<div class="basic-inner">
|
4236 |
'name' => 'Square Pink',
|
4237 |
'base' => 'square-pink',
|
4238 |
'description' => '',
|
4239 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="pink">
|
4240 |
<div class="row">
|
4241 |
<div class="col-md-12">
|
4242 |
<div class="basic-inner">
|
4351 |
'name' => 'Square Purple',
|
4352 |
'base' => 'square-purple',
|
4353 |
'description' => '',
|
4354 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="square" data-cscheme="purple">
|
4355 |
<div class="row">
|
4356 |
<div class="col-md-12">
|
4357 |
<div class="basic-inner">
|
4466 |
'name' => 'Flat Black',
|
4467 |
'base' => 'flat-black',
|
4468 |
'description' => '',
|
4469 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="black">
|
4470 |
<div class="row">
|
4471 |
<div class="col-md-12">
|
4472 |
<div class="basic-inner">
|
4581 |
'name' => 'Flat Red',
|
4582 |
'base' => 'flat-red',
|
4583 |
'description' => '',
|
4584 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="red">
|
4585 |
<div class="row">
|
4586 |
<div class="col-md-12">
|
4587 |
<div class="basic-inner">
|
4696 |
'name' => 'Flat Green',
|
4697 |
'base' => 'flat-green',
|
4698 |
'description' => '',
|
4699 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="green">
|
4700 |
<div class="row">
|
4701 |
<div class="col-md-12">
|
4702 |
<div class="basic-inner">
|
4811 |
'name' => 'Flat Blue',
|
4812 |
'base' => 'flat-blue',
|
4813 |
'description' => '',
|
4814 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="blue">
|
4815 |
<div class="row">
|
4816 |
<div class="col-md-12">
|
4817 |
<div class="basic-inner">
|
4926 |
'name' => 'Flat Aero',
|
4927 |
'base' => 'flat-aero',
|
4928 |
'description' => '',
|
4929 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="aero">
|
4930 |
<div class="row">
|
4931 |
<div class="col-md-12">
|
4932 |
<div class="basic-inner">
|
5041 |
'name' => 'Flat Grey',
|
5042 |
'base' => 'flat-grey',
|
5043 |
'description' => '',
|
5044 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="grey">
|
5045 |
<div class="row">
|
5046 |
<div class="col-md-12">
|
5047 |
<div class="basic-inner">
|
5156 |
'name' => 'Flat Orange',
|
5157 |
'base' => 'flat-orange',
|
5158 |
'description' => '',
|
5159 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="orange">
|
5160 |
<div class="row">
|
5161 |
<div class="col-md-12">
|
5162 |
<div class="basic-inner">
|
5271 |
'name' => 'Flat Yellow',
|
5272 |
'base' => 'flat-yellow',
|
5273 |
'description' => '',
|
5274 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="yellow">
|
5275 |
<div class="row">
|
5276 |
<div class="col-md-12">
|
5277 |
<div class="basic-inner">
|
5386 |
'name' => 'Flat Pink',
|
5387 |
'base' => 'flat-pink',
|
5388 |
'description' => '',
|
5389 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="pink">
|
5390 |
<div class="row">
|
5391 |
<div class="col-md-12">
|
5392 |
<div class="basic-inner">
|
5501 |
'name' => 'Flat Purple',
|
5502 |
'base' => 'flat-purple',
|
5503 |
'description' => '',
|
5504 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="flat" data-cscheme="purple">
|
5505 |
<div class="row">
|
5506 |
<div class="col-md-12">
|
5507 |
<div class="basic-inner">
|
5616 |
'name' => 'Minimal Black',
|
5617 |
'base' => 'minimal-black',
|
5618 |
'description' => '',
|
5619 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="black">
|
5620 |
<div class="row">
|
5621 |
<div class="col-md-12">
|
5622 |
<div class="basic-inner">
|
5731 |
'name' => 'Minimal Red',
|
5732 |
'base' => 'minimal-red',
|
5733 |
'description' => '',
|
5734 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="red">
|
5735 |
<div class="row">
|
5736 |
<div class="col-md-12">
|
5737 |
<div class="basic-inner">
|
5846 |
'name' => 'Minimal Green',
|
5847 |
'base' => 'minimal-green',
|
5848 |
'description' => '',
|
5849 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="green">
|
5850 |
<div class="row">
|
5851 |
<div class="col-md-12">
|
5852 |
<div class="basic-inner">
|
5961 |
'name' => 'Minimal Blue',
|
5962 |
'base' => 'minimal-blue',
|
5963 |
'description' => '',
|
5964 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="blue">
|
5965 |
<div class="row">
|
5966 |
<div class="col-md-12">
|
5967 |
<div class="basic-inner">
|
6076 |
'name' => 'Minimal Aero',
|
6077 |
'base' => 'minimal-aero',
|
6078 |
'description' => '',
|
6079 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="aero">
|
6080 |
<div class="row">
|
6081 |
<div class="col-md-12">
|
6082 |
<div class="basic-inner">
|
6191 |
'name' => 'Minimal Grey',
|
6192 |
'base' => 'minimal-grey',
|
6193 |
'description' => '',
|
6194 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="grey">
|
6195 |
<div class="row">
|
6196 |
<div class="col-md-12">
|
6197 |
<div class="basic-inner">
|
6306 |
'name' => 'Minimal Orange',
|
6307 |
'base' => 'minimal-orange',
|
6308 |
'description' => '',
|
6309 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="orange">
|
6310 |
<div class="row">
|
6311 |
<div class="col-md-12">
|
6312 |
<div class="basic-inner">
|
6421 |
'name' => 'Minimal Yellow',
|
6422 |
'base' => 'minimal-yellow',
|
6423 |
'description' => '',
|
6424 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="yellow">
|
6425 |
<div class="row">
|
6426 |
<div class="col-md-12">
|
6427 |
<div class="basic-inner">
|
6536 |
'name' => 'Minimal Pink',
|
6537 |
'base' => 'minimal-pink',
|
6538 |
'description' => '',
|
6539 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="pink">
|
6540 |
<div class="row">
|
6541 |
<div class="col-md-12">
|
6542 |
<div class="basic-inner">
|
6651 |
'name' => 'Minimal Purple',
|
6652 |
'base' => 'minimal-purple',
|
6653 |
'description' => '',
|
6654 |
+
'html_preview' => '<div class="basic-yop-poll-container white-v2" style="padding-top: 14px; padding-bottom: 14px;" data-temp="basic-pretty" data-skin="minimal" data-cscheme="purple">
|
6655 |
<div class="row">
|
6656 |
<div class="col-md-12">
|
6657 |
<div class="basic-inner">
|
6877 |
</div><!-- end row -->
|
6878 |
</div><!-- end basic-yop-poll-container -->'
|
6879 |
);
|
6880 |
+
if ( ( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'image_preview' ) ) &&
|
6881 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_vertical' ) ) &&
|
6882 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_horizontal' ) ) &&
|
6883 |
( true === $this->check_if_column_exists( $GLOBALS['wpdb']->yop_poll_templates, 'html_columns' ) )
|
6899 |
$GLOBALS['wpdb']->query( $update_query );
|
6900 |
}
|
6901 |
private function check_if_column_exists( $table_name, $column_name ) {
|
6902 |
+
if ( 0 == $GLOBALS['wpdb']->get_var(
|
6903 |
+
$GLOBALS['wpdb']->prepare(
|
6904 |
+
'SELECT count(1) FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = %s AND `TABLE_NAME` = %s AND `COLUMN_NAME` = %s',
|
6905 |
+
DB_NAME,
|
6906 |
+
$table_name,
|
6907 |
+
$column_name
|
6908 |
+
)
|
6909 |
+
) ) {
|
6910 |
return false;
|
6911 |
}
|
6912 |
return true;
|
admin/inc/maintenance.php
CHANGED
@@ -43,7 +43,7 @@ class YOP_POLL_Maintenance {
|
|
43 |
$this->importer->initialise();
|
44 |
}
|
45 |
$this->create_options();
|
46 |
-
if ( ! wp_next_scheduled
|
47 |
wp_schedule_event( time(), 'hourly', 'yop_poll_hourly_event', array() );
|
48 |
}
|
49 |
//$this->create_archive_page();
|
@@ -146,12 +146,15 @@ class YOP_POLL_Maintenance {
|
|
146 |
public function update_to_version_6_3_3() {
|
147 |
update_option( 'yop_poll_version', '6.3.3' );
|
148 |
}
|
|
|
|
|
|
|
149 |
public function create_archive_page() {
|
150 |
$poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
|
151 |
if ( ! $poll_archive_page ) {
|
152 |
$_p = array();
|
153 |
$_p['post_title'] = 'Poll Archive';
|
154 |
-
$_p['post_content'] =
|
155 |
$_p['post_status'] = 'publish';
|
156 |
$_p['post_type'] = 'page';
|
157 |
$_p['comment_status'] = 'open';
|
@@ -168,11 +171,11 @@ class YOP_POLL_Maintenance {
|
|
168 |
public function create_options() {
|
169 |
update_option( 'yop_poll_version', YOP_POLL_VERSION );
|
170 |
$plugin_old_settings = get_option( 'yop_poll_options' );
|
171 |
-
if( $plugin_old_settings ) {
|
172 |
update_option( 'yop_poll_settings', YOP_Poll_Settings::import_settings_from_5x( $plugin_old_settings ) );
|
173 |
} else {
|
174 |
$plugin_current_settings = get_option( 'yop_poll_settings' );
|
175 |
-
if ( false === $plugin_current_settings) {
|
176 |
update_option( 'yop_poll_settings', YOP_Poll_Settings::create_settings() );
|
177 |
}
|
178 |
}
|
@@ -218,9 +221,9 @@ class YOP_POLL_Maintenance {
|
|
218 |
$url = admin_url( 'admin.php?page=yop-poll-import' );
|
219 |
$html = '<div class="updated">';
|
220 |
$html .= '<p>';
|
221 |
-
$html .=
|
222 |
$html .= '</p>';
|
223 |
$html .= '</div><!-- /.updated -->';
|
224 |
-
echo $html;
|
225 |
}
|
226 |
}
|
43 |
$this->importer->initialise();
|
44 |
}
|
45 |
$this->create_options();
|
46 |
+
if ( ! wp_next_scheduled( 'yop_poll_hourly_event', array() ) ) {
|
47 |
wp_schedule_event( time(), 'hourly', 'yop_poll_hourly_event', array() );
|
48 |
}
|
49 |
//$this->create_archive_page();
|
146 |
public function update_to_version_6_3_3() {
|
147 |
update_option( 'yop_poll_version', '6.3.3' );
|
148 |
}
|
149 |
+
public function update_to_version_6_3_4() {
|
150 |
+
update_option( 'yop_poll_version', '6.3.4' );
|
151 |
+
}
|
152 |
public function create_archive_page() {
|
153 |
$poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
|
154 |
if ( ! $poll_archive_page ) {
|
155 |
$_p = array();
|
156 |
$_p['post_title'] = 'Poll Archive';
|
157 |
+
$_p['post_content'] = '[yop_poll_archive]';
|
158 |
$_p['post_status'] = 'publish';
|
159 |
$_p['post_type'] = 'page';
|
160 |
$_p['comment_status'] = 'open';
|
171 |
public function create_options() {
|
172 |
update_option( 'yop_poll_version', YOP_POLL_VERSION );
|
173 |
$plugin_old_settings = get_option( 'yop_poll_options' );
|
174 |
+
if ( $plugin_old_settings ) {
|
175 |
update_option( 'yop_poll_settings', YOP_Poll_Settings::import_settings_from_5x( $plugin_old_settings ) );
|
176 |
} else {
|
177 |
$plugin_current_settings = get_option( 'yop_poll_settings' );
|
178 |
+
if ( false === $plugin_current_settings ) {
|
179 |
update_option( 'yop_poll_settings', YOP_Poll_Settings::create_settings() );
|
180 |
}
|
181 |
}
|
221 |
$url = admin_url( 'admin.php?page=yop-poll-import' );
|
222 |
$html = '<div class="updated">';
|
223 |
$html .= '<p>';
|
224 |
+
$html .= esc_html__( 'Click <a href="' . $url . '" target="_blank">here</a> to start the import.', 'yop-poll' );
|
225 |
$html .= '</p>';
|
226 |
$html .= '</div><!-- /.updated -->';
|
227 |
+
echo wp_kses_post( $html );
|
228 |
}
|
229 |
}
|
admin/models/OtherAnswers.php
CHANGED
@@ -3,7 +3,7 @@ class YOP_Poll_Other_Answers {
|
|
3 |
private static $errors_present = false,
|
4 |
$case_sensitive = false;
|
5 |
public static function add( $poll_id, $element_id, $vote_id, $answer ) {
|
6 |
-
if ( true === isset
|
7 |
if ( true === isset( $vote_id ) && ( $vote_id > 0 ) ) {
|
8 |
$data = array(
|
9 |
'poll_id' => sanitize_text_field( $poll_id ),
|
@@ -31,4 +31,4 @@ class YOP_Poll_Other_Answers {
|
|
31 |
$other_answers = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, $element_id ) );
|
32 |
return $other_answers;
|
33 |
}
|
34 |
-
}
|
3 |
private static $errors_present = false,
|
4 |
$case_sensitive = false;
|
5 |
public static function add( $poll_id, $element_id, $vote_id, $answer ) {
|
6 |
+
if ( true === isset( $poll_id ) && ( $poll_id > 0 ) ) {
|
7 |
if ( true === isset( $vote_id ) && ( $vote_id > 0 ) ) {
|
8 |
$data = array(
|
9 |
'poll_id' => sanitize_text_field( $poll_id ),
|
31 |
$other_answers = $GLOBALS['wpdb']->get_results( $GLOBALS['wpdb']->prepare( $query, $element_id ) );
|
32 |
return $other_answers;
|
33 |
}
|
34 |
+
}
|
admin/models/bans.php
CHANGED
@@ -12,7 +12,7 @@ class YOP_Poll_Bans {
|
|
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 ){
|
16 |
return $ban->author;
|
17 |
} else {
|
18 |
return false;
|
@@ -24,16 +24,30 @@ class YOP_Poll_Bans {
|
|
24 |
$total_polls = 0;
|
25 |
$current_user = wp_get_current_user();
|
26 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
27 |
-
$query =
|
28 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
29 |
-
$params['q'] =
|
30 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
33 |
-
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `author` =
|
|
|
|
|
|
|
|
|
34 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
35 |
-
$params['q'] =
|
36 |
-
$query .=
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
}
|
39 |
if ( '' !== $query ) {
|
@@ -50,17 +64,17 @@ class YOP_Poll_Bans {
|
|
50 |
} else {
|
51 |
$data['pagination'] = '';
|
52 |
}
|
53 |
-
if ( 1 < $total_pages ){
|
54 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
55 |
«
|
56 |
</span>';
|
57 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
58 |
-
' .
|
59 |
</span>
|
60 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
61 |
‹
|
62 |
</span>';
|
63 |
-
$pagination['next_page'] = '<span class="screen-reader-text">' .
|
64 |
</span>
|
65 |
<span aria-hidden="true">›</span>';
|
66 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
@@ -77,7 +91,7 @@ class YOP_Poll_Bans {
|
|
77 |
'order_by' => $params['order_by'],
|
78 |
'sort_order' => $params['sort_order'],
|
79 |
'q' => htmlentities( $params['q'] ),
|
80 |
-
'page_no' => $params['page_no']+1
|
81 |
)
|
82 |
)
|
83 |
);
|
@@ -113,7 +127,7 @@ class YOP_Poll_Bans {
|
|
113 |
'order_by' => $params['order_by'],
|
114 |
'sort_order' => $params['sort_order'],
|
115 |
'q' => htmlentities( $params['q'] ),
|
116 |
-
'page_no' => $params['page_no']-1
|
117 |
)
|
118 |
)
|
119 |
);
|
@@ -149,7 +163,7 @@ class YOP_Poll_Bans {
|
|
149 |
'order_by' => $params['order_by'],
|
150 |
'sort_order' => $params['sort_order'],
|
151 |
'q' => htmlentities( $params['q'] ),
|
152 |
-
'page_no' => $params['page_no']-1
|
153 |
)
|
154 |
)
|
155 |
);
|
@@ -162,7 +176,7 @@ class YOP_Poll_Bans {
|
|
162 |
'order_by' => $params['order_by'],
|
163 |
'sort_order' => $params['sort_order'],
|
164 |
'q' => htmlentities( $params['q'] ),
|
165 |
-
'page_no' => $params['page_no']+1
|
166 |
)
|
167 |
)
|
168 |
);
|
@@ -233,37 +247,54 @@ class YOP_Poll_Bans {
|
|
233 |
$params['sort_order'] = SORT_ASC;
|
234 |
} elseif ( 'desc' === $params['sort_order'] ) {
|
235 |
$params['sort_order'] = SORT_DESC;
|
236 |
-
} else{
|
237 |
$params['sort_order'] = SORT_ASC;
|
238 |
}
|
239 |
if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
|
240 |
$params['order_by'] = 'id';
|
241 |
}
|
242 |
-
if ( $params['page_no'] > $pagination['total_pages']) {
|
243 |
$params['page_no'] = 1;
|
244 |
}
|
245 |
$limit = self::$bans_per_page * ( $params['page_no'] - 1 );
|
246 |
-
$limit_query = " LIMIT {$limit}, ". self::$bans_per_page;
|
247 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
248 |
-
$query =
|
249 |
-
.
|
250 |
. " FROM {$GLOBALS['wpdb']->yop_poll_bans} as bans LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
251 |
-
.
|
252 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
253 |
-
$params['q'] =
|
254 |
-
$query .=
|
|
|
|
|
|
|
|
|
255 |
}
|
256 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
257 |
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls}"
|
258 |
. " ON {$GLOBALS['wpdb']->yop_poll_bans}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
259 |
-
. " WHERE {$GLOBALS['wpdb']->yop_poll_bans}.`author
|
|
|
|
|
|
|
|
|
260 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
261 |
-
$params['q'] =
|
262 |
-
$query .=
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
}
|
265 |
if ( '' !== $query ) {
|
266 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
267 |
$bans = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
268 |
}
|
269 |
foreach ( $bans as &$ban ) {
|
@@ -293,7 +324,7 @@ class YOP_Poll_Bans {
|
|
293 |
$current_user = wp_get_current_user();
|
294 |
if ( false === self::$errors_present ) {
|
295 |
$data = array(
|
296 |
-
'author' => $current_user->ID,
|
297 |
'poll_id' => sanitize_text_field( $ban->ban->poll_id ),
|
298 |
'b_by' => sanitize_text_field( $ban->ban->b_by ),
|
299 |
'b_value' => sanitize_text_field( $ban->ban->b_value ),
|
@@ -304,7 +335,7 @@ class YOP_Poll_Bans {
|
|
304 |
self::$errors_present = false;
|
305 |
} else {
|
306 |
self::$errors_present = true;
|
307 |
-
self::$error_text =
|
308 |
}
|
309 |
}
|
310 |
return array(
|
@@ -320,7 +351,7 @@ class YOP_Poll_Bans {
|
|
320 |
self::validate_data( $ban->ban );
|
321 |
if ( false === self::$errors_present ) {
|
322 |
$data = array(
|
323 |
-
'author' => $current_user->ID,
|
324 |
'poll_id' => sanitize_text_field( $ban->ban->poll_id ),
|
325 |
'b_by' => sanitize_text_field( $ban->ban->b_by ),
|
326 |
'b_value' => sanitize_text_field( $ban->ban->b_value ),
|
@@ -330,12 +361,12 @@ class YOP_Poll_Bans {
|
|
330 |
self::$errors_present = false;
|
331 |
} else {
|
332 |
self::$errors_present = true;
|
333 |
-
self::$error_text =
|
334 |
}
|
335 |
}
|
336 |
} else {
|
337 |
self::$errors_present = true;
|
338 |
-
self::$error_text =
|
339 |
}
|
340 |
return array(
|
341 |
'success' => !self::$errors_present,
|
@@ -353,7 +384,7 @@ class YOP_Poll_Bans {
|
|
353 |
self::$errors_present = false;
|
354 |
} else {
|
355 |
self::$errors_present = true;
|
356 |
-
self::$error_text =
|
357 |
}
|
358 |
return array(
|
359 |
'success' => !self::$errors_present,
|
@@ -372,11 +403,11 @@ class YOP_Poll_Bans {
|
|
372 |
self::$errors_present = false;
|
373 |
} else {
|
374 |
self::$errors_present = true;
|
375 |
-
self::$error_text =
|
376 |
}
|
377 |
} else {
|
378 |
self::$errors_present = true;
|
379 |
-
self::$error_text =
|
380 |
}
|
381 |
return array(
|
382 |
'success' => !self::$errors_present,
|
@@ -388,7 +419,7 @@ class YOP_Poll_Bans {
|
|
388 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `id` = %s", $ban_id
|
389 |
);
|
390 |
$ban = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
391 |
-
if( null !== $ban ){
|
392 |
return array(
|
393 |
'ban' => $ban
|
394 |
);
|
@@ -399,7 +430,7 @@ class YOP_Poll_Bans {
|
|
399 |
public static function validate_data( $ban ) {
|
400 |
if ( false === is_object( $ban ) ) {
|
401 |
self::$errors_present = true;
|
402 |
-
self::$error_text =
|
403 |
} else {
|
404 |
if (
|
405 |
( false === self::$errors_present ) &&
|
@@ -407,7 +438,7 @@ class YOP_Poll_Bans {
|
|
407 |
( '' === sanitize_text_field( $ban->poll_id ) ) )
|
408 |
) {
|
409 |
self::$errors_present = true;
|
410 |
-
self::$error_text =
|
411 |
}
|
412 |
if (
|
413 |
( false === self::$errors_present ) &&
|
@@ -417,7 +448,7 @@ class YOP_Poll_Bans {
|
|
417 |
)
|
418 |
) {
|
419 |
self::$errors_present = true;
|
420 |
-
self::$error_text =
|
421 |
}
|
422 |
if (
|
423 |
( false === self::$errors_present ) &&
|
@@ -425,7 +456,7 @@ class YOP_Poll_Bans {
|
|
425 |
( '' === sanitize_text_field( $ban->b_value ) ) )
|
426 |
) {
|
427 |
self::$errors_present = true;
|
428 |
-
self::$error_text =
|
429 |
}
|
430 |
}
|
431 |
}
|
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 ) {
|
16 |
return $ban->author;
|
17 |
} else {
|
18 |
return false;
|
24 |
$total_polls = 0;
|
25 |
$current_user = wp_get_current_user();
|
26 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
27 |
+
$query = 'SELECT COUNT(*) FROM ' . $GLOBALS['wpdb']->yop_poll_bans;
|
28 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
29 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
30 |
+
$query .= ' WHERE `b_value` LIKE %s';
|
31 |
+
$query = $GLOBALS['wpdb']->prepare(
|
32 |
+
$query,
|
33 |
+
array(
|
34 |
+
$params['q'],
|
35 |
+
)
|
36 |
+
);
|
37 |
}
|
38 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
39 |
+
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_bans} WHERE `author` = %s";
|
40 |
+
$qquery = $GLOBALS['wpdb']->prepare(
|
41 |
+
$query,
|
42 |
+
$current_user->ID
|
43 |
+
);
|
44 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
45 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
46 |
+
$query .= ' AND `b_value` LIKE %s';
|
47 |
+
$query = $GLOBALS['wpdb']->prepare(
|
48 |
+
$query,
|
49 |
+
$params['q']
|
50 |
+
);
|
51 |
}
|
52 |
}
|
53 |
if ( '' !== $query ) {
|
64 |
} else {
|
65 |
$data['pagination'] = '';
|
66 |
}
|
67 |
+
if ( 1 < $total_pages ) {
|
68 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
69 |
«
|
70 |
</span>';
|
71 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
72 |
+
' . esc_html__( 'Previous page', 'yop-poll' ) . '
|
73 |
</span>
|
74 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
75 |
‹
|
76 |
</span>';
|
77 |
+
$pagination['next_page'] = '<span class="screen-reader-text">' . esc_html__( 'Next page', 'yop-poll' ) . '
|
78 |
</span>
|
79 |
<span aria-hidden="true">›</span>';
|
80 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
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 |
);
|
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 |
);
|
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 |
'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 |
);
|
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'] ) {
|
257 |
$params['page_no'] = 1;
|
258 |
}
|
259 |
$limit = self::$bans_per_page * ( $params['page_no'] - 1 );
|
260 |
+
$limit_query = " LIMIT {$limit}, " . self::$bans_per_page;
|
261 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
262 |
+
$query = 'SELECT bans.id, bans.poll_id, bans.author, bans.b_by, bans.b_value, bans.added_date,'
|
263 |
+
. ' polls.name'
|
264 |
. " FROM {$GLOBALS['wpdb']->yop_poll_bans} as bans LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
265 |
+
. ' ON bans.`poll_id` = polls.`id`';
|
266 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
267 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
268 |
+
$query .= ' WHERE `b_value` LIKE %s';
|
269 |
+
$query = $GLOBALS['wpdb']->prepare(
|
270 |
+
$query,
|
271 |
+
$params['q']
|
272 |
+
);
|
273 |
}
|
274 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
275 |
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_bans} LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls}"
|
276 |
. " ON {$GLOBALS['wpdb']->yop_poll_bans}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
277 |
+
. " WHERE {$GLOBALS['wpdb']->yop_poll_bans}.`author` = %s";
|
278 |
+
$query = $GLOBALS['wpdb']->prepare(
|
279 |
+
$query,
|
280 |
+
$current_user->ID
|
281 |
+
);
|
282 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
283 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
284 |
+
$query .= ' AND `b_value` LIKE %s';
|
285 |
+
$query = $GLOBALS['wpdb']->prepare(
|
286 |
+
$query,
|
287 |
+
$params['q']
|
288 |
+
);
|
289 |
}
|
290 |
}
|
291 |
if ( '' !== $query ) {
|
292 |
+
$query .= ' LIMIT %d, %d';
|
293 |
+
$query = $GLOBALS['wpdb']->prepare(
|
294 |
+
$query,
|
295 |
+
$limit,
|
296 |
+
self::$bans_per_page
|
297 |
+
);
|
298 |
$bans = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
299 |
}
|
300 |
foreach ( $bans as &$ban ) {
|
324 |
$current_user = wp_get_current_user();
|
325 |
if ( false === self::$errors_present ) {
|
326 |
$data = array(
|
327 |
+
'author' => sanitize_text_field( $current_user->ID ),
|
328 |
'poll_id' => sanitize_text_field( $ban->ban->poll_id ),
|
329 |
'b_by' => sanitize_text_field( $ban->ban->b_by ),
|
330 |
'b_value' => sanitize_text_field( $ban->ban->b_value ),
|
335 |
self::$errors_present = false;
|
336 |
} else {
|
337 |
self::$errors_present = true;
|
338 |
+
self::$error_text = esc_html__( 'Error adding ban', 'yop-poll' );
|
339 |
}
|
340 |
}
|
341 |
return array(
|
351 |
self::validate_data( $ban->ban );
|
352 |
if ( false === self::$errors_present ) {
|
353 |
$data = array(
|
354 |
+
'author' => sanitize_text_field( $current_user->ID ),
|
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 ),
|
361 |
self::$errors_present = false;
|
362 |
} else {
|
363 |
self::$errors_present = true;
|
364 |
+
self::$error_text = esc_html__( 'Error updating ban', 'yop-poll' );
|
365 |
}
|
366 |
}
|
367 |
} else {
|
368 |
self::$errors_present = true;
|
369 |
+
self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
|
370 |
}
|
371 |
return array(
|
372 |
'success' => !self::$errors_present,
|
384 |
self::$errors_present = false;
|
385 |
} else {
|
386 |
self::$errors_present = true;
|
387 |
+
self::$error_text = esc_html__( 'Error deleting ban', 'yop-poll' );
|
388 |
}
|
389 |
return array(
|
390 |
'success' => !self::$errors_present,
|
403 |
self::$errors_present = false;
|
404 |
} else {
|
405 |
self::$errors_present = true;
|
406 |
+
self::$error_text = esc_html__( 'Error deleting bans', 'yop-poll' );
|
407 |
}
|
408 |
} else {
|
409 |
self::$errors_present = true;
|
410 |
+
self::$error_text = esc_html__( 'Invalid poll', 'yop-poll' );
|
411 |
}
|
412 |
return array(
|
413 |
'success' => !self::$errors_present,
|
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 |
);
|
430 |
public static function validate_data( $ban ) {
|
431 |
if ( false === is_object( $ban ) ) {
|
432 |
self::$errors_present = true;
|
433 |
+
self::$error_text = esc_html__( 'Invalid data', 'yop-poll' );
|
434 |
} else {
|
435 |
if (
|
436 |
( false === self::$errors_present ) &&
|
438 |
( '' === sanitize_text_field( $ban->poll_id ) ) )
|
439 |
) {
|
440 |
self::$errors_present = true;
|
441 |
+
self::$error_text = esc_html__( 'Data for "Poll" is invalid', 'yop-poll' );
|
442 |
}
|
443 |
if (
|
444 |
( false === self::$errors_present ) &&
|
448 |
)
|
449 |
) {
|
450 |
self::$errors_present = true;
|
451 |
+
self::$error_text = esc_html__( 'Data for "Ban by" is invalid', 'yop-poll' );
|
452 |
}
|
453 |
if (
|
454 |
( false === self::$errors_present ) &&
|
456 |
( '' === sanitize_text_field( $ban->b_value ) ) )
|
457 |
) {
|
458 |
self::$errors_present = true;
|
459 |
+
self::$error_text = esc_html__( 'Data for "Ban Value" is invalid', 'yop-poll' );
|
460 |
}
|
461 |
}
|
462 |
}
|
admin/models/elements.php
CHANGED
@@ -8,7 +8,7 @@ class YOP_POLL_Elements {
|
|
8 |
$display_order = 1;
|
9 |
$element_id = 0;
|
10 |
$current_user = wp_get_current_user();
|
11 |
-
foreach( $elements as $element ) {
|
12 |
if ( false === self::$errors_present ) {
|
13 |
$data = array(
|
14 |
'poll_id' => $poll_id,
|
@@ -27,17 +27,18 @@ class YOP_POLL_Elements {
|
|
27 |
}
|
28 |
if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_elements, $data ) ) {
|
29 |
$element_id = $GLOBALS['wpdb']->insert_id;
|
30 |
-
if (
|
31 |
-
if( $is_imported )
|
32 |
$sub_elements_result = YOP_Poll_SubElements::add( $poll_id, $element_id, $element->answers, true );
|
33 |
-
else
|
34 |
$sub_elements_result = YOP_Poll_SubElements::add( $poll_id, $element_id, $element->answers );
|
|
|
35 |
self::$errors_present = $sub_elements_result['errors_present'];
|
36 |
self::$error_text = $sub_elements_result['error_text'];
|
37 |
}
|
38 |
} else {
|
39 |
self::$errors_present = true;
|
40 |
-
self::$error_text =
|
41 |
}
|
42 |
$display_order++;
|
43 |
}
|
@@ -54,7 +55,7 @@ class YOP_POLL_Elements {
|
|
54 |
$current_user = wp_get_current_user();
|
55 |
$new_elements = [];
|
56 |
$i = 0;
|
57 |
-
foreach( $elements as $element ) {
|
58 |
if ( false === self::$errors_present ) {
|
59 |
$data = array(
|
60 |
'poll_id' => $poll_id,
|
@@ -92,7 +93,7 @@ class YOP_POLL_Elements {
|
|
92 |
}
|
93 |
} else {
|
94 |
self::$errors_present = true;
|
95 |
-
self::$error_text =
|
96 |
}
|
97 |
if ( isset( $element->answersRemoved ) && ( '' !== $element->answersRemoved ) ) {
|
98 |
$sub_elements_removed = explode( ',', $element->answersRemoved );
|
@@ -106,12 +107,12 @@ class YOP_POLL_Elements {
|
|
106 |
return array(
|
107 |
'errors_present' => self::$errors_present,
|
108 |
'error_text' => self::$error_text,
|
109 |
-
'new_elements'=> $new_elements,
|
110 |
'new_subelements' => $sub_elements_result['new_subelements']
|
111 |
);
|
112 |
}
|
113 |
public static function delete( $poll_id, $element_id ) {
|
114 |
-
if ( 0 < intval( $element_id) ) {
|
115 |
$data = array(
|
116 |
'status' => 'deleted',
|
117 |
'sorder' => '0'
|
@@ -126,11 +127,11 @@ class YOP_POLL_Elements {
|
|
126 |
);
|
127 |
if ( false === $delete_result ) {
|
128 |
self::$errors_present = true;
|
129 |
-
self::$error_text =
|
130 |
}
|
131 |
} else {
|
132 |
self::$errors_present = true;
|
133 |
-
self::$error_text =
|
134 |
}
|
135 |
return array(
|
136 |
'errors_present' => self::$errors_present,
|
@@ -153,7 +154,7 @@ class YOP_POLL_Elements {
|
|
153 |
self::$errors_present = false;
|
154 |
} else {
|
155 |
self::$errors_present = true;
|
156 |
-
self::$error_text =
|
157 |
}
|
158 |
return array(
|
159 |
'errors_present' => self::$errors_present,
|
@@ -180,7 +181,7 @@ class YOP_POLL_Elements {
|
|
180 |
break;
|
181 |
}
|
182 |
case 'custom-field': {
|
183 |
-
if( property_exists( $element->options, 'old_id' ) ) {
|
184 |
$return_data = array(
|
185 |
'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
|
186 |
'old_id' => sanitize_text_field( $element->options->old_id ),
|
@@ -238,7 +239,8 @@ class YOP_POLL_Elements {
|
|
238 |
public static function clone_all( $old_poll_id, $new_poll_id ) {
|
239 |
$current_user = wp_get_current_user();
|
240 |
$query = $GLOBALS['wpdb']->prepare(
|
241 |
-
"SELECT * from {$GLOBALS['wpdb']->yop_poll_elements} WHERE `poll_id`=%s",
|
|
|
242 |
);
|
243 |
$elements = $GLOBALS['wpdb']->get_results( $query, OBJECT );
|
244 |
if ( null !== $elements ) {
|
@@ -263,7 +265,7 @@ class YOP_POLL_Elements {
|
|
263 |
}
|
264 |
} else {
|
265 |
self::$errors_present = true;
|
266 |
-
self::$error_text =
|
267 |
}
|
268 |
}
|
269 |
}
|
@@ -309,7 +311,7 @@ class YOP_POLL_Elements {
|
|
309 |
}
|
310 |
}
|
311 |
}
|
312 |
-
$sub_elements = json_decode( json_encode( $subelements), true );
|
313 |
$order_by = array();
|
314 |
foreach ( $sub_elements as $key => $row ) {
|
315 |
$order_by['sorder'][$key] = $row['sorder'];
|
@@ -317,11 +319,11 @@ class YOP_POLL_Elements {
|
|
317 |
$order_by['total_submits'][$key] = $row['total_submits'];
|
318 |
}
|
319 |
if ( count( $sub_elements ) > 0 ) {
|
320 |
-
array_multisort( $order_by[$sort_params['order_by']], $sort_params['sort_order'], SORT_NATURAL|SORT_FLAG_CASE, $sub_elements );
|
321 |
}
|
322 |
$subelements_sorted = array();
|
323 |
$i = 0;
|
324 |
-
foreach( $sub_elements as $sub_element ) {
|
325 |
$subelements_sorted[] = (object) [
|
326 |
'id' => $sub_element['id'],
|
327 |
'poll_id' => $sub_element['poll_id'],
|
8 |
$display_order = 1;
|
9 |
$element_id = 0;
|
10 |
$current_user = wp_get_current_user();
|
11 |
+
foreach ( $elements as $element ) {
|
12 |
if ( false === self::$errors_present ) {
|
13 |
$data = array(
|
14 |
'poll_id' => $poll_id,
|
27 |
}
|
28 |
if ( false !== $GLOBALS['wpdb']->insert( $GLOBALS['wpdb']->yop_poll_elements, $data ) ) {
|
29 |
$element_id = $GLOBALS['wpdb']->insert_id;
|
30 |
+
if ( ( 'text-question' == $element->type ) || ( 'media-question' === $element->type ) ) {
|
31 |
+
if ( $is_imported ) {
|
32 |
$sub_elements_result = YOP_Poll_SubElements::add( $poll_id, $element_id, $element->answers, true );
|
33 |
+
} else {
|
34 |
$sub_elements_result = YOP_Poll_SubElements::add( $poll_id, $element_id, $element->answers );
|
35 |
+
}
|
36 |
self::$errors_present = $sub_elements_result['errors_present'];
|
37 |
self::$error_text = $sub_elements_result['error_text'];
|
38 |
}
|
39 |
} else {
|
40 |
self::$errors_present = true;
|
41 |
+
self::$error_text = esc_html__( 'Error adding element', 'yop-poll' );
|
42 |
}
|
43 |
$display_order++;
|
44 |
}
|
55 |
$current_user = wp_get_current_user();
|
56 |
$new_elements = [];
|
57 |
$i = 0;
|
58 |
+
foreach ( $elements as $element ) {
|
59 |
if ( false === self::$errors_present ) {
|
60 |
$data = array(
|
61 |
'poll_id' => $poll_id,
|
93 |
}
|
94 |
} else {
|
95 |
self::$errors_present = true;
|
96 |
+
self::$error_text = esc_html__( 'Error updating element', 'yop-poll' );
|
97 |
}
|
98 |
if ( isset( $element->answersRemoved ) && ( '' !== $element->answersRemoved ) ) {
|
99 |
$sub_elements_removed = explode( ',', $element->answersRemoved );
|
107 |
return array(
|
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'
|
127 |
);
|
128 |
if ( false === $delete_result ) {
|
129 |
self::$errors_present = true;
|
130 |
+
self::$error_text = esc_html__( 'Error deleting element', 'yop-poll' );
|
131 |
}
|
132 |
} else {
|
133 |
self::$errors_present = true;
|
134 |
+
self::$error_text = esc_html__( 'Invalid element id', 'yop-poll' );
|
135 |
}
|
136 |
return array(
|
137 |
'errors_present' => self::$errors_present,
|
154 |
self::$errors_present = false;
|
155 |
} else {
|
156 |
self::$errors_present = true;
|
157 |
+
self::$error_text = esc_html__( 'Error deleting element', 'yop-poll' );
|
158 |
}
|
159 |
return array(
|
160 |
'errors_present' => self::$errors_present,
|
181 |
break;
|
182 |
}
|
183 |
case 'custom-field': {
|
184 |
+
if ( property_exists( $element->options, 'old_id' ) ) {
|
185 |
$return_data = array(
|
186 |
'makeRequired' => sanitize_text_field( $element->options->makeRequired ),
|
187 |
'old_id' => sanitize_text_field( $element->options->old_id ),
|
239 |
public static function clone_all( $old_poll_id, $new_poll_id ) {
|
240 |
$current_user = wp_get_current_user();
|
241 |
$query = $GLOBALS['wpdb']->prepare(
|
242 |
+
"SELECT * from {$GLOBALS['wpdb']->yop_poll_elements} WHERE `poll_id`=%s",
|
243 |
+
$old_poll_id
|
244 |
);
|
245 |
$elements = $GLOBALS['wpdb']->get_results( $query, OBJECT );
|
246 |
if ( null !== $elements ) {
|
265 |
}
|
266 |
} else {
|
267 |
self::$errors_present = true;
|
268 |
+
self::$error_text = esc_html__( 'Error adding element', 'yop-poll' );
|
269 |
}
|
270 |
}
|
271 |
}
|
311 |
}
|
312 |
}
|
313 |
}
|
314 |
+
$sub_elements = json_decode( json_encode( $subelements ), true );
|
315 |
$order_by = array();
|
316 |
foreach ( $sub_elements as $key => $row ) {
|
317 |
$order_by['sorder'][$key] = $row['sorder'];
|
319 |
$order_by['total_submits'][$key] = $row['total_submits'];
|
320 |
}
|
321 |
if ( count( $sub_elements ) > 0 ) {
|
322 |
+
array_multisort( $order_by[$sort_params['order_by']], $sort_params['sort_order'], SORT_NATURAL | SORT_FLAG_CASE, $sub_elements );
|
323 |
}
|
324 |
$subelements_sorted = array();
|
325 |
$i = 0;
|
326 |
+
foreach ( $sub_elements as $sub_element ) {
|
327 |
$subelements_sorted[] = (object) [
|
328 |
'id' => $sub_element['id'],
|
329 |
'poll_id' => $sub_element['poll_id'],
|
admin/models/logs.php
CHANGED
@@ -5,9 +5,9 @@ class YOP_Poll_Logs {
|
|
5 |
$sort_order_allowed = array( 'asc', 'desc' ),
|
6 |
$order_by_allowed = array( 'name', 'user_id', 'email', 'user_type', 'ipaddress', 'added_date', 'vote_message' ),
|
7 |
$logs_per_page = 20;
|
8 |
-
private static $_instance =
|
9 |
public static function get_instance() {
|
10 |
-
if ( self::$_instance
|
11 |
$class = __CLASS__;
|
12 |
self::$_instance = new $class;
|
13 |
}
|
@@ -42,20 +42,36 @@ class YOP_Poll_Logs {
|
|
42 |
$query = "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_logs}` INNER JOIN `{$GLOBALS['wpdb']->yop_poll_polls}` ON ";
|
43 |
$query .= "`{$GLOBALS['wpdb']->yop_poll_logs}`.`poll_id` = `{$GLOBALS['wpdb']->yop_poll_polls}`.`id`";
|
44 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
45 |
-
$search_string =
|
46 |
-
$query .=
|
47 |
-
$query .=
|
48 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
51 |
$query = "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_logs}` INNER JOIN `{$GLOBALS['wpdb']->yop_poll_polls}` ON ";
|
52 |
$query .= "`{$GLOBALS['wpdb']->yop_poll_logs}`.`poll_id` = `{$GLOBALS['wpdb']->yop_poll_polls}`.`id`";
|
53 |
-
$query .=
|
|
|
|
|
|
|
|
|
54 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
55 |
-
$search_string =
|
56 |
-
$query .=
|
57 |
-
$query .=
|
58 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
if ( '' !== $query ) {
|
@@ -72,17 +88,17 @@ class YOP_Poll_Logs {
|
|
72 |
} else {
|
73 |
$data['pagination'] = '';
|
74 |
}
|
75 |
-
if ( $total_pages > 1 ){
|
76 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
77 |
«
|
78 |
</span>';
|
79 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
80 |
-
' .
|
81 |
</span>
|
82 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
83 |
‹
|
84 |
</span>';
|
85 |
-
$pagination['next_page'] = '<span class="screen-reader-text">' .
|
86 |
</span>
|
87 |
<span aria-hidden="true">›</span>';
|
88 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
@@ -99,7 +115,7 @@ class YOP_Poll_Logs {
|
|
99 |
'order_by' => $params['order_by'],
|
100 |
'sort_order' => $params['sort_order'],
|
101 |
'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
|
102 |
-
'page_no' => $params['page_no']+1
|
103 |
)
|
104 |
)
|
105 |
);
|
@@ -135,7 +151,7 @@ class YOP_Poll_Logs {
|
|
135 |
'order_by' => $params['order_by'],
|
136 |
'sort_order' => $params['sort_order'],
|
137 |
'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
|
138 |
-
'page_no' => $params['page_no']-1
|
139 |
)
|
140 |
)
|
141 |
);
|
@@ -171,7 +187,7 @@ class YOP_Poll_Logs {
|
|
171 |
'order_by' => $params['order_by'],
|
172 |
'sort_order' => $params['sort_order'],
|
173 |
'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
|
174 |
-
'page_no' => $params['page_no']-1
|
175 |
)
|
176 |
)
|
177 |
);
|
@@ -184,7 +200,7 @@ class YOP_Poll_Logs {
|
|
184 |
'order_by' => $params['order_by'],
|
185 |
'sort_order' => $params['sort_order'],
|
186 |
'q' => ( isset( $params['q'] ) && ( '' != $params['q'] ) ) ? $params['q'] : false,
|
187 |
-
'page_no' => $params['page_no']+1
|
188 |
)
|
189 |
)
|
190 |
);
|
@@ -256,47 +272,68 @@ class YOP_Poll_Logs {
|
|
256 |
$params['sort_order'] = SORT_ASC;
|
257 |
} elseif ( 'desc' === $params['sort_order'] ) {
|
258 |
$params['sort_order'] = SORT_DESC;
|
259 |
-
} else{
|
260 |
$params['sort_order'] = SORT_ASC;
|
261 |
}
|
262 |
if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
|
263 |
$params['order_by'] = 'id';
|
264 |
}
|
265 |
-
if ( $params['page_no'] > $pagination['total_pages']) {
|
266 |
$params['page_no'] = 1;
|
267 |
}
|
268 |
$limit = self::$logs_per_page * ( $params['page_no'] - 1 );
|
269 |
-
$limit_query = " LIMIT {$limit}, ". self::$logs_per_page;
|
270 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
271 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs}"
|
272 |
-
|
273 |
-
|
274 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
275 |
-
$params['q'] =
|
276 |
-
$query .=
|
277 |
-
$query .=
|
278 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
}
|
280 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
281 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs} as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
282 |
. " ON {$GLOBALS['wpdb']->yop_poll_logs}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
283 |
-
. " WHERE {$GLOBALS['wpdb']->yop_poll_logs}.`poll_author
|
|
|
|
|
|
|
|
|
284 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
285 |
-
$params['q'] =
|
286 |
-
$query .=
|
287 |
-
$query .=
|
288 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
290 |
}
|
291 |
if ( '' !== $query ) {
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
293 |
$logs = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
294 |
foreach ( $logs as $key => $row ) {
|
295 |
$log_message = unserialize( $row['vote_message'] );
|
296 |
$order_by['id'][$key] = $row['id'];
|
297 |
$order_by['name'][$key] = $row['name'];
|
298 |
-
if( 'wordpress' === $row['user_type'] ) {
|
299 |
-
$log_user_obj = get_user_by('id', $row['user_id'] );
|
300 |
$order_by['user_id'][$key] = $log_user_obj->user_login;
|
301 |
$logs[$key]['user_id'] = $log_user_obj->user_login;
|
302 |
} else {
|
@@ -328,22 +365,38 @@ class YOP_Poll_Logs {
|
|
328 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
329 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs}"
|
330 |
. " as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
331 |
-
.
|
332 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
333 |
-
$params['q'] =
|
334 |
-
$query .=
|
335 |
-
$query .=
|
336 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
339 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs} as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
340 |
. " ON {$GLOBALS['wpdb']->yop_poll_logs}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
341 |
-
. " WHERE {$GLOBALS['wpdb']->yop_poll_logs}.`poll_author
|
|
|
|
|
|
|
|
|
342 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
343 |
-
$params['q'] =
|
344 |
-
$query .=
|
345 |
-
$query .=
|
346 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
}
|
348 |
}
|
349 |
if ( '' !== $query ) {
|
@@ -353,8 +406,8 @@ class YOP_Poll_Logs {
|
|
353 |
$log_message = unserialize( $row['vote_message'] );
|
354 |
$order_by['id'][$key] = $row['id'];
|
355 |
$order_by['name'][$key] = $row['name'];
|
356 |
-
if( 'wordpress' === $row['user_type'] ) {
|
357 |
-
$log_user_obj = get_user_by('id', $row['user_id'] );
|
358 |
$order_by['user_id'][$key] = $log_user_obj->user_login;
|
359 |
$logs[$key]['user_id'] = $log_user_obj->user_login;
|
360 |
} else {
|
@@ -368,78 +421,82 @@ class YOP_Poll_Logs {
|
|
368 |
$order_by['vote_message'][$key] = $log_message[0];
|
369 |
$logs[$key]['vote_message'] = $log_message[0];
|
370 |
}
|
371 |
-
return
|
372 |
}
|
373 |
-
public static function send_logs_to_download
|
374 |
$date_format = get_option( 'date_format' );
|
375 |
$time_format = get_option( 'time_format' );
|
376 |
if ( isset ( $_REQUEST ['doExport'] ) && 'true' === $_REQUEST['doExport'] ) {
|
377 |
-
$params['q'] = $_REQUEST['q'];
|
378 |
$logs = self::get_export_logs( $params );
|
379 |
$csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
|
380 |
$csv_header_array = [
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
];
|
390 |
-
header(
|
391 |
-
header(
|
392 |
header( "Content-Transfer-Encoding: binary\n" );
|
393 |
header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
|
394 |
header( 'Content-Transfer-Encoding: binary' );
|
395 |
header( 'Connection: Keep-Alive' );
|
396 |
header( 'Expires: 0' );
|
397 |
ob_start();
|
398 |
-
$f = fopen( 'php://output', 'w' ) or show_error(
|
399 |
-
if ( !YOP_Poll_Helper::yop_fputcsv( $f, $csv_header_array ) )
|
|
|
|
|
400 |
$logs_for_csv = [];
|
401 |
if ( count( $logs ) > 0 ){
|
402 |
foreach ( $logs as $log ) {
|
403 |
-
$log_details = self::get_log_details($log['id']);
|
404 |
$details_string = '';
|
405 |
foreach ( $log_details as $res ) {
|
406 |
-
if ( 'custom-field' === $res['question']) {
|
407 |
-
$details_string .=
|
408 |
-
$details_string .=
|
409 |
} else {
|
410 |
-
$details_string .=
|
411 |
foreach ( $res['answers'] as $ra ) {
|
412 |
-
$details_string .=
|
413 |
}
|
414 |
}
|
415 |
}
|
416 |
$logs_data = [
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
];
|
426 |
$logs_for_csv[] = $logs_data;
|
427 |
-
if ( !YOP_Poll_Helper::yop_fputcsv( $f, $logs_data, ',', '"' ) )
|
|
|
|
|
428 |
}
|
429 |
}
|
430 |
-
fclose( $f ) or show_error(
|
431 |
$csvStr = ob_get_contents();
|
432 |
ob_end_clean();
|
433 |
-
echo $csvStr;
|
434 |
-
exit
|
435 |
}
|
436 |
}
|
437 |
public static function get_owner( $log_id ) {
|
438 |
$query = $GLOBALS['wpdb']->prepare(
|
439 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %s", $log_id
|
440 |
);
|
441 |
-
$log= $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
442 |
-
if( null !== $log ){
|
443 |
return $log->poll_author;
|
444 |
} else {
|
445 |
return false;
|
@@ -456,21 +513,21 @@ class YOP_Poll_Logs {
|
|
456 |
self::$errors_present = false;
|
457 |
} else {
|
458 |
self::$errors_present = true;
|
459 |
-
self::$error_text =
|
460 |
}
|
461 |
return array(
|
462 |
'success' => !self::$errors_present,
|
463 |
'error' => self::$error_text
|
464 |
);
|
465 |
}
|
466 |
-
public static function get_log_details
|
467 |
$query = $GLOBALS['wpdb']->prepare(
|
468 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_logs} WHERE `id` = %d", $log_id
|
469 |
);
|
470 |
-
$log= $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
471 |
-
if( null !== $log ){
|
472 |
$vote_data = unserialize( $log->vote_data );
|
473 |
-
if ( count($vote_data) > 0 ) {
|
474 |
if ( isset( $vote_data['elements'] ) ) {
|
475 |
$vote_elements = $vote_data['elements'];
|
476 |
$questions = [];
|
@@ -481,44 +538,49 @@ class YOP_Poll_Logs {
|
|
481 |
if ( count( $vote_elements ) > 0 ) {
|
482 |
foreach ( $vote_elements as $ve ) {
|
483 |
$qanswers = [];
|
484 |
-
if ( isset
|
485 |
$questions_ids[] = $ve['id'];
|
486 |
}
|
487 |
-
if (
|
488 |
foreach ( $ve['data'] as $vdata ) {
|
489 |
if ( isset( $vdata['id'] ) ) {
|
490 |
-
if( 0 != $vdata['id'] ) {
|
491 |
$answers_ids[] = $vdata['id'];
|
492 |
}
|
493 |
}
|
494 |
}
|
495 |
}
|
496 |
-
|
497 |
}
|
498 |
if ( count( $questions_ids ) > 0 ) {
|
499 |
-
$
|
500 |
-
|
|
|
|
|
|
|
501 |
$questions_results = $GLOBALS['wpdb']->get_results( $questions_query, OBJECT );
|
502 |
}
|
503 |
if ( count( $answers_ids ) > 0 ) {
|
504 |
-
$
|
505 |
-
|
|
|
|
|
|
|
506 |
$answers_results = $GLOBALS['wpdb']->get_results( $answers_query, OBJECT );
|
507 |
}
|
508 |
foreach ( $vote_elements as $ve ) {
|
509 |
$pqa = [ 'question' => '', 'answers' => [] ];
|
510 |
switch ( $ve['type'] ) {
|
511 |
case 'question': {
|
512 |
-
if ( isset
|
513 |
foreach ( $questions_results as $qres ) {
|
514 |
if ( $ve['id'] == $qres->id ) {
|
515 |
$pqa['question'] = $qres->etext;
|
516 |
}
|
517 |
}
|
518 |
}
|
519 |
-
if ( isset($ve['data'] ) ) {
|
520 |
foreach ( $ve['data'] as $vdata ) {
|
521 |
-
if ( 0 == $vdata['id']) {
|
522 |
$pqa['answers'][] = [ 'answer_text' => 'other', 'answer_value' => $vdata['data'] ];
|
523 |
} else {
|
524 |
foreach ( $answers_results as $ares ) {
|
@@ -533,7 +595,7 @@ class YOP_Poll_Logs {
|
|
533 |
break;
|
534 |
}
|
535 |
case 'custom-field': {
|
536 |
-
if ( isset
|
537 |
foreach ( $questions_results as $qres ) {
|
538 |
if ( $ve['id'] == $qres->id ) {
|
539 |
$pqa['question'] = 'custom-field';
|
@@ -557,7 +619,6 @@ class YOP_Poll_Logs {
|
|
557 |
return [];
|
558 |
}
|
559 |
}
|
560 |
-
|
561 |
} else {
|
562 |
return [];
|
563 |
}
|
@@ -573,7 +634,7 @@ class YOP_Poll_Logs {
|
|
573 |
self::$errors_present = false;
|
574 |
} else {
|
575 |
self::$errors_present = true;
|
576 |
-
self::$error_text =
|
577 |
}
|
578 |
return array(
|
579 |
'success' => !self::$errors_present,
|
5 |
$sort_order_allowed = array( 'asc', 'desc' ),
|
6 |
$order_by_allowed = array( 'name', 'user_id', 'email', 'user_type', 'ipaddress', 'added_date', 'vote_message' ),
|
7 |
$logs_per_page = 20;
|
8 |
+
private static $_instance = null;
|
9 |
public static function get_instance() {
|
10 |
+
if ( null === self::$_instance ) {
|
11 |
$class = __CLASS__;
|
12 |
self::$_instance = new $class;
|
13 |
}
|
42 |
$query = "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_logs}` INNER JOIN `{$GLOBALS['wpdb']->yop_poll_polls}` ON ";
|
43 |
$query .= "`{$GLOBALS['wpdb']->yop_poll_logs}`.`poll_id` = `{$GLOBALS['wpdb']->yop_poll_polls}`.`id`";
|
44 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
45 |
+
$search_string = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
46 |
+
$query .= ' WHERE `user_email` LIKE %s';
|
47 |
+
$query .= ' OR `ipaddress` LIKE %s';
|
48 |
+
$query .= ' OR `name` LIKE %s';
|
49 |
+
$query = $GLOBALS['wpdb']->prepare(
|
50 |
+
$query,
|
51 |
+
$search_string,
|
52 |
+
$search_string,
|
53 |
+
$search_string
|
54 |
+
);
|
55 |
}
|
56 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
57 |
$query = "SELECT COUNT(*) FROM `{$GLOBALS['wpdb']->yop_poll_logs}` INNER JOIN `{$GLOBALS['wpdb']->yop_poll_polls}` ON ";
|
58 |
$query .= "`{$GLOBALS['wpdb']->yop_poll_logs}`.`poll_id` = `{$GLOBALS['wpdb']->yop_poll_polls}`.`id`";
|
59 |
+
$query .= ' WHERE `author` = %s';
|
60 |
+
$query = $GLOBALS['wpdb']->prepare(
|
61 |
+
$query,
|
62 |
+
$current_user->ID
|
63 |
+
);
|
64 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
65 |
+
$search_string = '%' . esc_sql( $GLOBALS['wpdb']->esc_like( $params['q'] ) ) . '%';
|
66 |
+
$query .= ' AND (`user_email` LIKE %s';
|
67 |
+
$query .= ' or `ipaddress` LIKE %s';
|
68 |
+
$query .= ' or `name` LIKE %s)';
|
69 |
+
$query = $GLOBALS['wpdb']->prepare(
|
70 |
+
$query,
|
71 |
+
$search_string,
|
72 |
+
$search_string,
|
73 |
+
$search_string
|
74 |
+
);
|
75 |
}
|
76 |
}
|
77 |
if ( '' !== $query ) {
|
88 |
} else {
|
89 |
$data['pagination'] = '';
|
90 |
}
|
91 |
+
if ( $total_pages > 1 ) {
|
92 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
93 |
«
|
94 |
</span>';
|
95 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
96 |
+
' . esc_html__( 'Previous page', 'yop-poll' ) . '
|
97 |
</span>
|
98 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
99 |
‹
|
100 |
</span>';
|
101 |
+
$pagination['next_page'] = '<span class="screen-reader-text">' . esc_html__( 'Next page', 'yop-poll' ) . '
|
102 |
</span>
|
103 |
<span aria-hidden="true">›</span>';
|
104 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
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 |
);
|
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 |
);
|
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 |
);
|
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'] ) {
|
282 |
$params['page_no'] = 1;
|
283 |
}
|
284 |
$limit = self::$logs_per_page * ( $params['page_no'] - 1 );
|
285 |
+
$limit_query = " LIMIT {$limit}, " . self::$logs_per_page;
|
286 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
287 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs}"
|
288 |
+
. " as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
289 |
+
. ' ON logs.`poll_id` = polls.`id`';
|
290 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
291 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
292 |
+
$query .= ' WHERE `ipaddress` LIKE %s';
|
293 |
+
$query .= ' OR `user_email` LIKE %s';
|
294 |
+
$query .= ' OR `name` LIKE %s';
|
295 |
+
$query = $GLOBALS['wpdb']->prepare(
|
296 |
+
$query,
|
297 |
+
$params['q'],
|
298 |
+
$params['q'],
|
299 |
+
$params['q']
|
300 |
+
);
|
301 |
}
|
302 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
303 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs} as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
304 |
. " ON {$GLOBALS['wpdb']->yop_poll_logs}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
305 |
+
. " WHERE {$GLOBALS['wpdb']->yop_poll_logs}.`poll_author` = %s";
|
306 |
+
$query = $GLOBALS['wpdb']->prepapre(
|
307 |
+
$query,
|
308 |
+
$current_user->ID
|
309 |
+
);
|
310 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
311 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
312 |
+
$query .= ' AND (`ipaddress` LIKE %s';
|
313 |
+
$query .= ' OR `user_email` LIKE %s';
|
314 |
+
$query .= ' OR `name` LIKE %s)';
|
315 |
+
$query = $GLOBALS['wpdb']->prepapre(
|
316 |
+
$query,
|
317 |
+
$params['q'],
|
318 |
+
$params['q'],
|
319 |
+
$params['q']
|
320 |
+
);
|
321 |
}
|
322 |
}
|
323 |
if ( '' !== $query ) {
|
324 |
+
$query .= ' LIMIT %d, %d';
|
325 |
+
$query = $GLOBALS['wpdb']->prepare(
|
326 |
+
$query,
|
327 |
+
$limit,
|
328 |
+
self::$logs_per_page
|
329 |
+
);
|
330 |
$logs = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
331 |
foreach ( $logs as $key => $row ) {
|
332 |
$log_message = unserialize( $row['vote_message'] );
|
333 |
$order_by['id'][$key] = $row['id'];
|
334 |
$order_by['name'][$key] = $row['name'];
|
335 |
+
if ( 'wordpress' === $row['user_type'] ) {
|
336 |
+
$log_user_obj = get_user_by( 'id', $row['user_id'] );
|
337 |
$order_by['user_id'][$key] = $log_user_obj->user_login;
|
338 |
$logs[$key]['user_id'] = $log_user_obj->user_login;
|
339 |
} else {
|
365 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
366 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs}"
|
367 |
. " as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
368 |
+
. ' ON logs.`poll_id` = polls.`id`';
|
369 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
370 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
371 |
+
$query .= ' WHERE `ipaddress` LIKE %s';
|
372 |
+
$query .= ' OR `user_email` LIKE %s';
|
373 |
+
$query .= ' OR `name` LIKE %s';
|
374 |
+
$query = $GLOBALS['wpdb']->prepare(
|
375 |
+
$query,
|
376 |
+
$params['q'],
|
377 |
+
$params['q'],
|
378 |
+
$params['q']
|
379 |
+
);
|
380 |
}
|
381 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
382 |
$query = "SELECT logs.*, polls.name FROM {$GLOBALS['wpdb']->yop_poll_logs} as logs LEFT JOIN {$GLOBALS['wpdb']->yop_poll_polls} as polls"
|
383 |
. " ON {$GLOBALS['wpdb']->yop_poll_logs}.`poll_id` = {$GLOBALS['wpdb']->yop_poll_polls}.`id`"
|
384 |
+
. " WHERE {$GLOBALS['wpdb']->yop_poll_logs}.`poll_author` = %s";
|
385 |
+
$query = $GLOBALS['wpdb']->prepare(
|
386 |
+
$query,
|
387 |
+
$current_user->ID
|
388 |
+
);
|
389 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
390 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
391 |
+
$query .= ' AND (`ipaddress` LIKE %s';
|
392 |
+
$query .= ' OR `user_email` LIKE %s';
|
393 |
+
$query .= ' OR `name` LIKE %s';
|
394 |
+
$query = $GLOBALS['wpdb']->prepare(
|
395 |
+
$query,
|
396 |
+
$params['q'],
|
397 |
+
$params['q'],
|
398 |
+
$params['q']
|
399 |
+
);
|
400 |
}
|
401 |
}
|
402 |
if ( '' !== $query ) {
|
406 |
$log_message = unserialize( $row['vote_message'] );
|
407 |
$order_by['id'][$key] = $row['id'];
|
408 |
$order_by['name'][$key] = $row['name'];
|
409 |
+
if ( 'wordpress' === $row['user_type'] ) {
|
410 |
+
$log_user_obj = get_user_by( 'id', $row['user_id'] );
|
411 |
$order_by['user_id'][$key] = $log_user_obj->user_login;
|
412 |
$logs[$key]['user_id'] = $log_user_obj->user_login;
|
413 |
} else {
|
421 |
$order_by['vote_message'][$key] = $log_message[0];
|
422 |
$logs[$key]['vote_message'] = $log_message[0];
|
423 |
}
|
424 |
+
return $logs;
|
425 |
}
|
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' ),
|
437 |
+
esc_html__( 'User Type', '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" );
|
446 |
header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
|
447 |
header( 'Content-Transfer-Encoding: binary' );
|
448 |
header( 'Connection: Keep-Alive' );
|
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 = '';
|
460 |
foreach ( $log_details as $res ) {
|
461 |
+
if ( 'custom-field' === $res['question'] ) {
|
462 |
+
$details_string .= esc_html__( 'Custom Field', 'yop-poll' ) . ': ' . $res['caption'] . ';';
|
463 |
+
$details_string .= esc_html__( 'Answer', 'yop-poll' ) . ': ' . $res['answers'][0]['answer_value'] . ';';
|
464 |
} else {
|
465 |
+
$details_string .= esc_html( 'Question', 'yop-poll' ) . ': ' . $res['question'] . ';';
|
466 |
foreach ( $res['answers'] as $ra ) {
|
467 |
+
$details_string .= esc_html__( 'Answer', 'yop-poll' ) . ': ' . $ra['answer_value'] . ';';
|
468 |
}
|
469 |
}
|
470 |
}
|
471 |
$logs_data = [
|
472 |
+
$log ['name'],
|
473 |
+
$log['user_id'],
|
474 |
+
$log ['user_email'],
|
475 |
+
$log ['user_type'],
|
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 |
}
|
486 |
}
|
487 |
+
fclose( $f ) or show_error( esc_html__( "Can't close php://output!", 'yop-poll' ) );
|
488 |
$csvStr = ob_get_contents();
|
489 |
ob_end_clean();
|
490 |
+
echo wp_kses( $csvStr, array() );
|
491 |
+
exit();
|
492 |
}
|
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 ) {
|
500 |
return $log->poll_author;
|
501 |
} else {
|
502 |
return false;
|
513 |
self::$errors_present = false;
|
514 |
} else {
|
515 |
self::$errors_present = true;
|
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 ) {
|
529 |
$vote_data = unserialize( $log->vote_data );
|
530 |
+
if ( count( $vote_data ) > 0 ) {
|
531 |
if ( isset( $vote_data['elements'] ) ) {
|
532 |
$vote_elements = $vote_data['elements'];
|
533 |
$questions = [];
|
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 |
}
|
544 |
+
if ( isset( $ve['data'] ) ) {
|
545 |
foreach ( $ve['data'] as $vdata ) {
|
546 |
if ( isset( $vdata['id'] ) ) {
|
547 |
+
if ( 0 != $vdata['id'] ) {
|
548 |
$answers_ids[] = $vdata['id'];
|
549 |
}
|
550 |
}
|
551 |
}
|
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'] ) ) {
|
575 |
foreach ( $questions_results as $qres ) {
|
576 |
if ( $ve['id'] == $qres->id ) {
|
577 |
$pqa['question'] = $qres->etext;
|
578 |
}
|
579 |
}
|
580 |
}
|
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 ) {
|
595 |
break;
|
596 |
}
|
597 |
case 'custom-field': {
|
598 |
+
if ( isset( $ve['id'] ) ) {
|
599 |
foreach ( $questions_results as $qres ) {
|
600 |
if ( $ve['id'] == $qres->id ) {
|
601 |
$pqa['question'] = 'custom-field';
|
619 |
return [];
|
620 |
}
|
621 |
}
|
|
|
622 |
} else {
|
623 |
return [];
|
624 |
}
|
634 |
self::$errors_present = false;
|
635 |
} else {
|
636 |
self::$errors_present = true;
|
637 |
+
self::$error_text = esc_html__( 'Error deleting logs', 'yop-poll' );
|
638 |
}
|
639 |
return array(
|
640 |
'success' => !self::$errors_present,
|
admin/models/polls.php
CHANGED
@@ -6,7 +6,7 @@ class YOP_Poll_Polls {
|
|
6 |
$text_weight_allowed = array( 'normal', 'bold' ),
|
7 |
$text_align_allowed = array( 'left', 'center', 'right' ),
|
8 |
$yes_no_allowed = array( 'yes', 'no' ),
|
9 |
-
$captcha_allowed = array( 'yes', 'yes-recaptcha', 'yes-recaptcha-invisible', 'yes-recaptcha-v3', 'no' ),
|
10 |
$answers_display_allowed = array( 'vertical', 'horizontal', 'columns' ),
|
11 |
$answers_sort_allowed = array( 'as-defined' ),
|
12 |
$date_values_allowed = array( 'now', 'custom', 'never', 'custom-date' ),
|
@@ -31,7 +31,7 @@ class YOP_Poll_Polls {
|
|
31 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s", $poll_id
|
32 |
);
|
33 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
34 |
-
if( null !== $poll ){
|
35 |
return $poll->author;
|
36 |
} else {
|
37 |
return false;
|
@@ -45,16 +45,28 @@ class YOP_Poll_Polls {
|
|
45 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
46 |
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `status` != 'deleted'";
|
47 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
48 |
-
$params['q'] =
|
49 |
-
$query .=
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
52 |
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE
|
53 |
-
`author` =
|
54 |
AND `status` !='deleted'";
|
|
|
|
|
|
|
|
|
55 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
56 |
-
$params['q'] =
|
57 |
-
$query .=
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
}
|
60 |
if ( '' !== $query ) {
|
@@ -72,17 +84,17 @@ class YOP_Poll_Polls {
|
|
72 |
} else {
|
73 |
$data['pagination'] = '';
|
74 |
}
|
75 |
-
if ( 1 < $total_pages ){
|
76 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
77 |
«
|
78 |
</span>';
|
79 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
80 |
-
' .
|
81 |
</span>
|
82 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
83 |
‹
|
84 |
</span>';
|
85 |
-
$pagination['next_page'] = '<span class="screen-reader-text">' .
|
86 |
</span>
|
87 |
<span aria-hidden="true">›</span>';
|
88 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
@@ -99,7 +111,7 @@ class YOP_Poll_Polls {
|
|
99 |
'order_by' => $params['order_by'],
|
100 |
'sort_order' => $params['sort_order'],
|
101 |
'q' => htmlentities( $params['q'] ),
|
102 |
-
'page_no' => $params['page_no']+1
|
103 |
)
|
104 |
)
|
105 |
);
|
@@ -135,7 +147,7 @@ class YOP_Poll_Polls {
|
|
135 |
'order_by' => $params['order_by'],
|
136 |
'sort_order' => $params['sort_order'],
|
137 |
'q' => htmlentities( $params['q'] ),
|
138 |
-
'page_no' => $params['page_no']-1
|
139 |
)
|
140 |
)
|
141 |
);
|
@@ -171,7 +183,7 @@ class YOP_Poll_Polls {
|
|
171 |
'order_by' => $params['order_by'],
|
172 |
'sort_order' => $params['sort_order'],
|
173 |
'q' => htmlentities( $params['q'] ),
|
174 |
-
'page_no' => $params['page_no']-1
|
175 |
)
|
176 |
)
|
177 |
);
|
@@ -184,7 +196,7 @@ class YOP_Poll_Polls {
|
|
184 |
'order_by' => $params['order_by'],
|
185 |
'sort_order' => $params['sort_order'],
|
186 |
'q' => htmlentities( $params['q'] ),
|
187 |
-
'page_no' => $params['page_no']+1
|
188 |
)
|
189 |
)
|
190 |
);
|
@@ -262,40 +274,56 @@ class YOP_Poll_Polls {
|
|
262 |
$params['sort_order'] = SORT_ASC;
|
263 |
} elseif ( 'desc' === $params['sort_order'] ) {
|
264 |
$params['sort_order'] = SORT_DESC;
|
265 |
-
} else{
|
266 |
$params['sort_order'] = SORT_ASC;
|
267 |
}
|
268 |
if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
|
269 |
$params['order_by'] = 'id';
|
270 |
}
|
271 |
-
if ( $params['page_no'] > $pagination['total_pages']) {
|
272 |
$params['page_no'] = 1;
|
273 |
}
|
274 |
$limit = self::$polls_per_page * ( $params['page_no'] - 1 );
|
275 |
-
$limit_query = " LIMIT {$limit}, ". self::$polls_per_page;
|
276 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
277 |
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `status` != 'deleted'";
|
278 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
279 |
-
$params['q'] =
|
280 |
-
$query .=
|
|
|
|
|
|
|
|
|
281 |
} else {
|
282 |
-
$query .=
|
283 |
}
|
284 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
285 |
-
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `author` =
|
286 |
AND `status` != 'deleted'";
|
|
|
|
|
|
|
|
|
287 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
288 |
-
$params['q'] =
|
289 |
-
$query .=
|
|
|
|
|
|
|
|
|
290 |
} else {
|
291 |
-
$query .=
|
292 |
}
|
293 |
}
|
294 |
if ( '' !== $query ) {
|
295 |
-
$query .=
|
|
|
|
|
|
|
|
|
|
|
296 |
$polls = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
297 |
}
|
298 |
-
foreach( $polls as &$poll ) {
|
299 |
$statistics[$poll['status']]++;
|
300 |
if ( true === self::is_ended( $poll, false ) ) {
|
301 |
$poll['status'] = 'ended';
|
@@ -348,7 +376,11 @@ class YOP_Poll_Polls {
|
|
348 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
349 |
$query = "SELECT `id`, `name` FROM {$GLOBALS['wpdb']->yop_poll_polls} ORDER BY `name`";
|
350 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
351 |
-
$query = "SELECT `id`, `name` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `author` =
|
|
|
|
|
|
|
|
|
352 |
}
|
353 |
if ( '' !== $query ) {
|
354 |
$polls = $GLOBALS['wpdb']->get_results( $query, OBJECT );
|
@@ -378,7 +410,7 @@ class YOP_Poll_Polls {
|
|
378 |
'added_date' => isset( $poll->added_date ) ? sanitize_text_field( $poll->added_date ) : current_time( 'mysql' ),
|
379 |
'modified_date' => isset( $poll->modified_date ) ? sanitize_text_field( $poll->modified_date ) : current_time( 'mysql' )
|
380 |
);
|
381 |
-
if ( isset( $poll->ID ) && is_numeric($poll->ID ) ) {
|
382 |
$data['id'] = $poll->ID;
|
383 |
}
|
384 |
if ( isset( $poll->poll_author ) && is_numeric( $poll->poll_author ) ) {
|
@@ -418,7 +450,7 @@ class YOP_Poll_Polls {
|
|
418 |
self::$errors_present = false;
|
419 |
} else {
|
420 |
self::$errors_present = true;
|
421 |
-
self::$error_text =
|
422 |
}
|
423 |
}
|
424 |
}
|
@@ -427,11 +459,11 @@ class YOP_Poll_Polls {
|
|
427 |
}
|
428 |
} else {
|
429 |
self::$errors_present = true;
|
430 |
-
self::$error_text =
|
431 |
}
|
432 |
} else {
|
433 |
self::$errors_present = true;
|
434 |
-
self::$error_text =
|
435 |
}
|
436 |
}
|
437 |
return array(
|
@@ -459,9 +491,9 @@ class YOP_Poll_Polls {
|
|
459 |
$db_poll_meta = unserialize( $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT `meta_data` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %d", $poll->id ) ) );
|
460 |
if ( 'yes' === $poll->options->poll->autoGeneratePollPage ) {
|
461 |
$has_page = true;
|
462 |
-
if ( isset( $db_poll_meta['options']['poll']['pageId'] ) && ( $db_poll_meta['options']['poll']['pageId'] > 0 ) ){
|
463 |
$poll_page_count = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->posts} WHERE `ID` = %d AND `post_status` = 'publish'", $db_poll_meta['options']['poll']['pageId'] ) );
|
464 |
-
if ( 0 === (int)$poll_page_count ) {
|
465 |
$has_page = false;
|
466 |
}
|
467 |
} else {
|
@@ -515,7 +547,7 @@ class YOP_Poll_Polls {
|
|
515 |
}
|
516 |
} else {
|
517 |
self::$errors_present = true;
|
518 |
-
self::$error_text =
|
519 |
}
|
520 |
if ( true === isset( $poll->elementsRemoved ) ) {
|
521 |
$elements_removed = explode( ',', $poll->elementsRemoved );
|
@@ -527,7 +559,7 @@ class YOP_Poll_Polls {
|
|
527 |
}
|
528 |
} else {
|
529 |
self::$errors_present = true;
|
530 |
-
self::$error_text =
|
531 |
}
|
532 |
return array(
|
533 |
'success' => !self::$errors_present,
|
@@ -568,7 +600,7 @@ class YOP_Poll_Polls {
|
|
568 |
YOP_Poll_Bans::delete_all_for_poll( $poll_id );
|
569 |
} else {
|
570 |
self::$errors_present = true;
|
571 |
-
self::$error_text =
|
572 |
}
|
573 |
return array(
|
574 |
'success' => !self::$errors_present,
|
@@ -582,7 +614,7 @@ class YOP_Poll_Polls {
|
|
582 |
);
|
583 |
$cloned_poll = $GLOBALS['wpdb']->get_row( $poll_query, OBJECT );
|
584 |
$data = array(
|
585 |
-
'name' => $cloned_poll->name . ' ' .
|
586 |
'template' => $cloned_poll->template,
|
587 |
'template_base' => $cloned_poll->template_base,
|
588 |
'skin_base' => $cloned_poll->skin_base,
|
@@ -604,7 +636,7 @@ class YOP_Poll_Polls {
|
|
604 |
$new_poll_meta_data = unserialize( $cloned_poll->meta_data );
|
605 |
if ( 'yes' === $new_poll_meta_data['options']['poll']['autoGeneratePollPage'] ) {
|
606 |
$page_id = wp_insert_post( array(
|
607 |
-
'post_title' => $cloned_poll->name . ' ' .
|
608 |
'post_content' => "[yop_poll id='{$new_poll_id}']",
|
609 |
'post_status' => 'publish',
|
610 |
'post_type' => 'page',
|
@@ -622,13 +654,13 @@ class YOP_Poll_Polls {
|
|
622 |
self::$errors_present = false;
|
623 |
} else {
|
624 |
self::$errors_present = true;
|
625 |
-
self::$error_text =
|
626 |
}
|
627 |
}
|
628 |
}
|
629 |
} else {
|
630 |
self::$errors_present = true;
|
631 |
-
self::$error_text =
|
632 |
}
|
633 |
return array(
|
634 |
'success' => !self::$errors_present,
|
@@ -647,7 +679,7 @@ class YOP_Poll_Polls {
|
|
647 |
YOP_Poll_Votes::delete_all_for_poll( $poll_id );
|
648 |
} else {
|
649 |
self::$errors_present = true;
|
650 |
-
self::$error_text =
|
651 |
}
|
652 |
return array(
|
653 |
'success' => !self::$errors_present,
|
@@ -673,7 +705,7 @@ class YOP_Poll_Polls {
|
|
673 |
),
|
674 |
'answers' => array(
|
675 |
'paddingLeftRight' => sanitize_text_field( $poll->design->style->answers->paddingLeftRight ),
|
676 |
-
'paddingTopBottom' => sanitize_text_field(
|
677 |
'textColor' => sanitize_text_field( $poll->design->style->answers->textColor ),
|
678 |
'textSize' => sanitize_text_field( $poll->design->style->answers->textSize ),
|
679 |
'textWeight' => sanitize_text_field( $poll->design->style->answers->textWeight ),
|
@@ -781,7 +813,7 @@ class YOP_Poll_Polls {
|
|
781 |
public static function validate_data( stdClass $poll ) {
|
782 |
if ( false === is_object( $poll ) ) {
|
783 |
self::$errors_present = true;
|
784 |
-
self::$error_text =
|
785 |
} else {
|
786 |
if (
|
787 |
( false === self::$errors_present ) &&
|
@@ -789,7 +821,7 @@ class YOP_Poll_Polls {
|
|
789 |
( '' === sanitize_text_field( $poll->name ) ) )
|
790 |
) {
|
791 |
self::$errors_present = true;
|
792 |
-
self::$error_text =
|
793 |
}
|
794 |
if (
|
795 |
( false === self::$errors_present ) &&
|
@@ -798,7 +830,7 @@ class YOP_Poll_Polls {
|
|
798 |
( 0 === intval( $poll->design->template ) ) )
|
799 |
) {
|
800 |
self::$errors_present = true;
|
801 |
-
self::$error_text =
|
802 |
}
|
803 |
if (
|
804 |
( false === self::$errors_present ) &&
|
@@ -807,7 +839,7 @@ class YOP_Poll_Polls {
|
|
807 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->backgroundColor ) ) ) )
|
808 |
) {
|
809 |
self::$errors_present = true;
|
810 |
-
self::$error_text =
|
811 |
}
|
812 |
if (
|
813 |
( false === self::$errors_present ) &&
|
@@ -816,7 +848,7 @@ class YOP_Poll_Polls {
|
|
816 |
( !ctype_digit( (string) $poll->design->style->poll->borderSize ) ) )
|
817 |
) {
|
818 |
self::$errors_present = true;
|
819 |
-
self::$error_text =
|
820 |
}
|
821 |
if (
|
822 |
( false === self::$errors_present ) &&
|
@@ -825,7 +857,7 @@ class YOP_Poll_Polls {
|
|
825 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->borderColor ) ) ) )
|
826 |
) {
|
827 |
self::$errors_present = true;
|
828 |
-
self::$error_text =
|
829 |
}
|
830 |
if (
|
831 |
( false === self::$errors_present ) &&
|
@@ -834,7 +866,7 @@ class YOP_Poll_Polls {
|
|
834 |
( !ctype_digit( (string) $poll->design->style->poll->borderRadius ) ) )
|
835 |
) {
|
836 |
self::$errors_present = true;
|
837 |
-
self::$error_text =
|
838 |
}
|
839 |
if (
|
840 |
( false === self::$errors_present ) &&
|
@@ -843,7 +875,7 @@ class YOP_Poll_Polls {
|
|
843 |
( !ctype_digit( (string) $poll->design->style->poll->paddingLeftRight ) ) )
|
844 |
) {
|
845 |
self::$errors_present = true;
|
846 |
-
self::$error_text =
|
847 |
}
|
848 |
if (
|
849 |
( false === self::$errors_present ) &&
|
@@ -852,7 +884,7 @@ class YOP_Poll_Polls {
|
|
852 |
( !ctype_digit( (string) $poll->design->style->poll->paddingTopBottom ) ) )
|
853 |
) {
|
854 |
self::$errors_present = true;
|
855 |
-
self::$error_text =
|
856 |
}
|
857 |
/* QUESTIONS STYLE CHECK */
|
858 |
if (
|
@@ -862,7 +894,7 @@ class YOP_Poll_Polls {
|
|
862 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->questions->textColor ) ) ) )
|
863 |
) {
|
864 |
self::$errors_present = true;
|
865 |
-
self::$error_text =
|
866 |
}
|
867 |
if (
|
868 |
( false === self::$errors_present ) &&
|
@@ -870,7 +902,7 @@ class YOP_Poll_Polls {
|
|
870 |
( '' === sanitize_text_field( $poll->design->style->questions->textSize ) ) )
|
871 |
) {
|
872 |
self::$errors_present = true;
|
873 |
-
self::$error_text =
|
874 |
}
|
875 |
if (
|
876 |
( false === self::$errors_present ) &&
|
@@ -879,7 +911,7 @@ class YOP_Poll_Polls {
|
|
879 |
( !in_array( $poll->design->style->questions->textWeight, self::$text_weight_allowed ) ) )
|
880 |
) {
|
881 |
self::$errors_present = true;
|
882 |
-
self::$error_text =
|
883 |
}
|
884 |
if (
|
885 |
( false === self::$errors_present ) &&
|
@@ -888,7 +920,7 @@ class YOP_Poll_Polls {
|
|
888 |
( !in_array( $poll->design->style->questions->textAlign, self::$text_align_allowed ) ) )
|
889 |
) {
|
890 |
self::$errors_present = true;
|
891 |
-
self::$error_text =
|
892 |
}
|
893 |
/* ANSWERS STYLE CHECK */
|
894 |
if (
|
@@ -898,7 +930,7 @@ class YOP_Poll_Polls {
|
|
898 |
( !ctype_digit( (string) $poll->design->style->answers->paddingLeftRight ) ) )
|
899 |
) {
|
900 |
self::$errors_present = true;
|
901 |
-
self::$error_text =
|
902 |
}
|
903 |
if (
|
904 |
( false === self::$errors_present ) &&
|
@@ -907,7 +939,7 @@ class YOP_Poll_Polls {
|
|
907 |
( !ctype_digit( (string) $poll->design->style->answers->paddingTopBottom ) ) )
|
908 |
) {
|
909 |
self::$errors_present = true;
|
910 |
-
self::$error_text =
|
911 |
}
|
912 |
if (
|
913 |
( false === self::$errors_present ) &&
|
@@ -916,7 +948,7 @@ class YOP_Poll_Polls {
|
|
916 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->answers->textColor ) ) ) )
|
917 |
) {
|
918 |
self::$errors_present = true;
|
919 |
-
self::$error_text =
|
920 |
}
|
921 |
if (
|
922 |
( false === self::$errors_present ) &&
|
@@ -924,7 +956,7 @@ class YOP_Poll_Polls {
|
|
924 |
( '' === sanitize_text_field( $poll->design->style->answers->textSize ) ) )
|
925 |
) {
|
926 |
self::$errors_present = true;
|
927 |
-
self::$error_text =
|
928 |
}
|
929 |
if (
|
930 |
( false === self::$errors_present ) &&
|
@@ -933,7 +965,7 @@ class YOP_Poll_Polls {
|
|
933 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
934 |
) {
|
935 |
self::$errors_present = true;
|
936 |
-
self::$error_text =
|
937 |
}
|
938 |
/* BUTTONS STYLE CHECK */
|
939 |
if (
|
@@ -943,7 +975,7 @@ class YOP_Poll_Polls {
|
|
943 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->backgroundColor ) ) ) )
|
944 |
) {
|
945 |
self::$errors_present = true;
|
946 |
-
self::$error_text =
|
947 |
}
|
948 |
if (
|
949 |
( false === self::$errors_present ) &&
|
@@ -952,7 +984,7 @@ class YOP_Poll_Polls {
|
|
952 |
( !ctype_digit( (string) $poll->design->style->buttons->borderSize ) ) )
|
953 |
) {
|
954 |
self::$errors_present = true;
|
955 |
-
self::$error_text =
|
956 |
}
|
957 |
if (
|
958 |
( false === self::$errors_present ) &&
|
@@ -961,7 +993,7 @@ class YOP_Poll_Polls {
|
|
961 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->borderColor ) ) ) )
|
962 |
) {
|
963 |
self::$errors_present = true;
|
964 |
-
self::$error_text =
|
965 |
}
|
966 |
if (
|
967 |
( false === self::$errors_present ) &&
|
@@ -970,7 +1002,7 @@ class YOP_Poll_Polls {
|
|
970 |
( !ctype_digit( (string) $poll->design->style->buttons->borderRadius ) ) )
|
971 |
) {
|
972 |
self::$errors_present = true;
|
973 |
-
self::$error_text =
|
974 |
}
|
975 |
if (
|
976 |
( false === self::$errors_present ) &&
|
@@ -979,7 +1011,7 @@ class YOP_Poll_Polls {
|
|
979 |
( !ctype_digit( (string) $poll->design->style->buttons->paddingLeftRight ) ) )
|
980 |
) {
|
981 |
self::$errors_present = true;
|
982 |
-
self::$error_text =
|
983 |
}
|
984 |
if (
|
985 |
( false === self::$errors_present ) &&
|
@@ -988,7 +1020,7 @@ class YOP_Poll_Polls {
|
|
988 |
( !ctype_digit( (string) $poll->design->style->buttons->paddingTopBottom ) ) )
|
989 |
) {
|
990 |
self::$errors_present = true;
|
991 |
-
self::$error_text =
|
992 |
}
|
993 |
if (
|
994 |
( false === self::$errors_present ) &&
|
@@ -997,7 +1029,7 @@ class YOP_Poll_Polls {
|
|
997 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->textColor ) ) ) )
|
998 |
) {
|
999 |
self::$errors_present = true;
|
1000 |
-
self::$error_text =
|
1001 |
}
|
1002 |
if (
|
1003 |
( false === self::$errors_present ) &&
|
@@ -1005,7 +1037,7 @@ class YOP_Poll_Polls {
|
|
1005 |
( '' === sanitize_text_field( $poll->design->style->buttons->textSize ) ) )
|
1006 |
) {
|
1007 |
self::$errors_present = true;
|
1008 |
-
self::$error_text =
|
1009 |
}
|
1010 |
if (
|
1011 |
( false === self::$errors_present ) &&
|
@@ -1014,7 +1046,7 @@ class YOP_Poll_Polls {
|
|
1014 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
1015 |
) {
|
1016 |
self::$errors_present = true;
|
1017 |
-
self::$error_text =
|
1018 |
}
|
1019 |
/* ERRORS STYLE CHECK */
|
1020 |
if (
|
@@ -1024,7 +1056,7 @@ class YOP_Poll_Polls {
|
|
1024 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForSuccess ) ) ) )
|
1025 |
) {
|
1026 |
self::$errors_present = true;
|
1027 |
-
self::$error_text =
|
1028 |
}
|
1029 |
if (
|
1030 |
( false === self::$errors_present ) &&
|
@@ -1033,7 +1065,7 @@ class YOP_Poll_Polls {
|
|
1033 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForError ) ) ) )
|
1034 |
) {
|
1035 |
self::$errors_present = true;
|
1036 |
-
self::$error_text =
|
1037 |
}
|
1038 |
if (
|
1039 |
( false === self::$errors_present ) &&
|
@@ -1042,7 +1074,7 @@ class YOP_Poll_Polls {
|
|
1042 |
( !ctype_digit( (string) $poll->design->style->errors->borderLeftSize ) ) )
|
1043 |
) {
|
1044 |
self::$errors_present = true;
|
1045 |
-
self::$error_text =
|
1046 |
}
|
1047 |
if (
|
1048 |
( false === self::$errors_present ) &&
|
@@ -1051,7 +1083,7 @@ class YOP_Poll_Polls {
|
|
1051 |
( !ctype_digit( (string) $poll->design->style->errors->paddingTopBottom ) ) )
|
1052 |
) {
|
1053 |
self::$errors_present = true;
|
1054 |
-
self::$error_text =
|
1055 |
}
|
1056 |
if (
|
1057 |
( false === self::$errors_present ) &&
|
@@ -1060,7 +1092,7 @@ class YOP_Poll_Polls {
|
|
1060 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->textColor ) ) ) )
|
1061 |
) {
|
1062 |
self::$errors_present = true;
|
1063 |
-
self::$error_text =
|
1064 |
}
|
1065 |
if (
|
1066 |
( false === self::$errors_present ) &&
|
@@ -1068,7 +1100,7 @@ class YOP_Poll_Polls {
|
|
1068 |
( '' === sanitize_text_field( $poll->design->style->errors->textSize ) ) )
|
1069 |
) {
|
1070 |
self::$errors_present = true;
|
1071 |
-
self::$error_text =
|
1072 |
}
|
1073 |
if (
|
1074 |
( false === self::$errors_present ) &&
|
@@ -1077,7 +1109,7 @@ class YOP_Poll_Polls {
|
|
1077 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
1078 |
) {
|
1079 |
self::$errors_present = true;
|
1080 |
-
self::$error_text =
|
1081 |
}
|
1082 |
/* POLL ELEMENTS CHECK */
|
1083 |
if (
|
@@ -1085,56 +1117,56 @@ class YOP_Poll_Polls {
|
|
1085 |
( 0 === count( $poll->elements ) )
|
1086 |
) {
|
1087 |
self::$errors_present = true;
|
1088 |
-
self::$error_text =
|
1089 |
}
|
1090 |
if ( false === self::$errors_present ) {
|
1091 |
-
foreach( $poll->elements as $element ) {
|
1092 |
switch ( $element->type ) {
|
1093 |
case 'text-question': {
|
1094 |
if (
|
1095 |
( false === self::$errors_present ) &&
|
1096 |
( !isset( $element->text ) ||
|
1097 |
( '' === trim( $element->text ) ) ||
|
1098 |
-
( '' === sanitize_text_field( $element->text ) )
|
1099 |
)
|
1100 |
) {
|
1101 |
self::$errors_present = true;
|
1102 |
-
self::$error_text =
|
1103 |
}
|
1104 |
if (
|
1105 |
( false === self::$errors_present ) &&
|
1106 |
( 0 == count( $element->answers ) )
|
1107 |
-
){
|
1108 |
self::$errors_present = true;
|
1109 |
-
self::$error_text =
|
1110 |
}
|
1111 |
if (
|
1112 |
( false === self::$errors_present )
|
1113 |
-
){
|
1114 |
-
foreach( $element->answers as $answer ) {
|
1115 |
if (
|
1116 |
( false === self::$errors_present ) &&
|
1117 |
( !isset( $answer->text ) ||
|
1118 |
( '' === trim( $answer->text ) ) ||
|
1119 |
( '' === sanitize_text_field( $answer->text ) )
|
1120 |
)
|
1121 |
-
){
|
1122 |
self::$errors_present = true;
|
1123 |
-
self::$error_text =
|
1124 |
}
|
1125 |
if (
|
1126 |
( false === self::$errors_present ) &&
|
1127 |
!in_array( $answer->options->makeDefault, self::$yes_no_allowed )
|
1128 |
) {
|
1129 |
self::$errors_present = true;
|
1130 |
-
self::$error_text =
|
1131 |
}
|
1132 |
if (
|
1133 |
( false === self::$errors_present ) &&
|
1134 |
!in_array( $answer->options->makeLink, self::$yes_no_allowed )
|
1135 |
) {
|
1136 |
self::$errors_present = true;
|
1137 |
-
self::$error_text =
|
1138 |
}
|
1139 |
if (
|
1140 |
( false === self::$errors_present ) &&
|
@@ -1144,16 +1176,16 @@ class YOP_Poll_Polls {
|
|
1144 |
!filter_var( $answer->options->link, FILTER_VALIDATE_URL ) )
|
1145 |
) {
|
1146 |
self::$errors_present = true;
|
1147 |
-
self::$error_text =
|
1148 |
}
|
1149 |
}
|
1150 |
}
|
1151 |
if (
|
1152 |
( false === self::$errors_present ) &&
|
1153 |
( !in_array( $element->options->allowOtherAnswers, self::$yes_no_allowed ) )
|
1154 |
-
){
|
1155 |
self::$errors_present = true;
|
1156 |
-
self::$error_text =
|
1157 |
}
|
1158 |
if (
|
1159 |
( false === self::$errors_present ) &&
|
@@ -1161,60 +1193,60 @@ class YOP_Poll_Polls {
|
|
1161 |
( '' === trim( $element->options->otherAnswersLabel ) ) ||
|
1162 |
( '' === sanitize_text_field( $element->options->otherAnswersLabel ) )
|
1163 |
)
|
1164 |
-
){
|
1165 |
self::$errors_present = true;
|
1166 |
-
self::$error_text =
|
1167 |
}
|
1168 |
if (
|
1169 |
( false === self::$errors_present ) &&
|
1170 |
( !in_array( $element->options->addOtherAnswers, self::$yes_no_allowed ) )
|
1171 |
-
){
|
1172 |
self::$errors_present = true;
|
1173 |
-
self::$error_text =
|
1174 |
}
|
1175 |
if (
|
1176 |
( false === self::$errors_present ) &&
|
1177 |
( !in_array( $element->options->displayOtherAnswersInResults, self::$yes_no_allowed ) )
|
1178 |
-
){
|
1179 |
self::$errors_present = true;
|
1180 |
-
self::$error_text =
|
1181 |
}
|
1182 |
if (
|
1183 |
( false === self::$errors_present ) &&
|
1184 |
( !in_array( $element->options->allowMultipleAnswers, self::$yes_no_allowed ) )
|
1185 |
-
){
|
1186 |
self::$errors_present = true;
|
1187 |
-
self::$error_text =
|
1188 |
}
|
1189 |
if (
|
1190 |
( false === self::$errors_present ) &&
|
1191 |
( !isset( $element->options->multipleAnswersMinim ) ||
|
1192 |
( '' === sanitize_text_field( $element->options->multipleAnswersMinim ) ) )
|
1193 |
-
){
|
1194 |
self::$errors_present = true;
|
1195 |
-
self::$error_text =
|
1196 |
}
|
1197 |
if (
|
1198 |
( false === self::$errors_present ) &&
|
1199 |
( !isset( $element->options->multipleAnswersMaxim ) ||
|
1200 |
( '' === trim( $element->options->multipleAnswersMaxim ) ) )
|
1201 |
-
){
|
1202 |
self::$errors_present = true;
|
1203 |
-
self::$error_text =
|
1204 |
}
|
1205 |
if (
|
1206 |
( false === self::$errors_present ) &&
|
1207 |
( intval( $element->options->multipleAnswersMinim ) > intval( $element->options->multipleAnswersMaxim ) )
|
1208 |
-
){
|
1209 |
self::$errors_present = true;
|
1210 |
-
self::$error_text =
|
1211 |
}
|
1212 |
if (
|
1213 |
( false === self::$errors_present ) &&
|
1214 |
( !in_array( $element->options->answersDisplay, self::$answers_display_allowed ) )
|
1215 |
-
){
|
1216 |
self::$errors_present = true;
|
1217 |
-
self::$error_text =
|
1218 |
}
|
1219 |
if (
|
1220 |
( false === self::$errors_present ) &&
|
@@ -1222,16 +1254,16 @@ class YOP_Poll_Polls {
|
|
1222 |
( !isset( $element->options->answersColumns ) ||
|
1223 |
( '' === sanitize_text_field( $element->options->answersColumns ) ) ||
|
1224 |
( 0 === intval( $element->options->answersColumns ) ) )
|
1225 |
-
){
|
1226 |
self::$errors_present = true;
|
1227 |
-
self::$error_text =
|
1228 |
}
|
1229 |
if (
|
1230 |
( false === self::$errors_present ) &&
|
1231 |
( !in_array( $element->options->answersSort, self::$answers_sort_allowed ) )
|
1232 |
-
){
|
1233 |
self::$errors_present = true;
|
1234 |
-
self::$error_text =
|
1235 |
}
|
1236 |
break;
|
1237 |
}
|
@@ -1244,14 +1276,14 @@ class YOP_Poll_Polls {
|
|
1244 |
)
|
1245 |
) {
|
1246 |
self::$errors_present = true;
|
1247 |
-
self::$error_text =
|
1248 |
}
|
1249 |
if (
|
1250 |
( false === self::$errors_present ) &&
|
1251 |
( !in_array( $element->options->makeRequired, self::$yes_no_allowed ) )
|
1252 |
-
){
|
1253 |
self::$errors_present = true;
|
1254 |
-
self::$error_text =
|
1255 |
}
|
1256 |
break;
|
1257 |
}
|
@@ -1270,14 +1302,14 @@ class YOP_Poll_Polls {
|
|
1270 |
)
|
1271 |
) {
|
1272 |
self::$errors_present = true;
|
1273 |
-
self::$error_text =
|
1274 |
}
|
1275 |
if (
|
1276 |
( false === self::$errors_present ) &&
|
1277 |
( !in_array( $poll->options->poll->showResultsLink, self::$yes_no_allowed ) )
|
1278 |
-
){
|
1279 |
self::$errors_present = true;
|
1280 |
-
self::$error_text =
|
1281 |
}
|
1282 |
if (
|
1283 |
( false === self::$errors_present ) &&
|
@@ -1288,28 +1320,28 @@ class YOP_Poll_Polls {
|
|
1288 |
)
|
1289 |
) {
|
1290 |
self::$errors_present = true;
|
1291 |
-
self::$error_text =
|
1292 |
}
|
1293 |
if (
|
1294 |
( false === self::$errors_present ) &&
|
1295 |
( !in_array( $poll->options->poll->showTotalVotes, self::$yes_no_allowed ) )
|
1296 |
-
){
|
1297 |
self::$errors_present = true;
|
1298 |
-
self::$error_text =
|
1299 |
}
|
1300 |
if (
|
1301 |
( false === self::$errors_present ) &&
|
1302 |
( !in_array( $poll->options->poll->showTotalAnswers, self::$yes_no_allowed ) )
|
1303 |
-
){
|
1304 |
self::$errors_present = true;
|
1305 |
-
self::$error_text =
|
1306 |
}
|
1307 |
if (
|
1308 |
( false === self::$errors_present ) &&
|
1309 |
( !in_array( $poll->options->poll->startDateOption, self::$date_values_allowed ) )
|
1310 |
-
){
|
1311 |
self::$errors_present = true;
|
1312 |
-
self::$error_text =
|
1313 |
}
|
1314 |
if (
|
1315 |
( false === self::$errors_present ) &&
|
@@ -1318,14 +1350,14 @@ class YOP_Poll_Polls {
|
|
1318 |
( '' === sanitize_text_field( $poll->options->poll->startDateCustom ) ) )
|
1319 |
) {
|
1320 |
self::$errors_present = true;
|
1321 |
-
self::$error_text =
|
1322 |
}
|
1323 |
if (
|
1324 |
( false === self::$errors_present ) &&
|
1325 |
( !in_array( $poll->options->poll->endDateOption, self::$date_values_allowed ) )
|
1326 |
-
){
|
1327 |
self::$errors_present = true;
|
1328 |
-
self::$error_text =
|
1329 |
}
|
1330 |
if (
|
1331 |
( false === self::$errors_present ) &&
|
@@ -1334,14 +1366,14 @@ class YOP_Poll_Polls {
|
|
1334 |
( '' === sanitize_text_field( $poll->options->poll->endDateCustom ) ) )
|
1335 |
) {
|
1336 |
self::$errors_present = true;
|
1337 |
-
self::$error_text =
|
1338 |
}
|
1339 |
if (
|
1340 |
( false === self::$errors_present ) &&
|
1341 |
( !in_array( $poll->options->poll->redirectAfterVote, self::$yes_no_allowed ) )
|
1342 |
-
){
|
1343 |
self::$errors_present = true;
|
1344 |
-
self::$error_text =
|
1345 |
}
|
1346 |
if (
|
1347 |
( false === self::$errors_present ) &&
|
@@ -1352,42 +1384,42 @@ class YOP_Poll_Polls {
|
|
1352 |
)
|
1353 |
) {
|
1354 |
self::$errors_present = true;
|
1355 |
-
self::$error_text =
|
1356 |
}
|
1357 |
if (
|
1358 |
( false === self::$errors_present ) &&
|
1359 |
( !in_array( $poll->options->poll->resetPollStatsAutomatically, self::$yes_no_allowed ) )
|
1360 |
-
){
|
1361 |
self::$errors_present = true;
|
1362 |
-
self::$error_text =
|
1363 |
}
|
1364 |
if (
|
1365 |
( false === self::$errors_present ) &&
|
1366 |
( !in_array( $poll->options->poll->resetPollStatsEveryPeriod, self::$reset_stats_allowed ) )
|
1367 |
-
){
|
1368 |
self::$errors_present = true;
|
1369 |
-
self::$error_text =
|
1370 |
}
|
1371 |
if (
|
1372 |
( false === self::$errors_present ) &&
|
1373 |
( !in_array( $poll->options->poll->autoGeneratePollPage, self::$yes_no_allowed ) )
|
1374 |
-
){
|
1375 |
self::$errors_present = true;
|
1376 |
-
self::$error_text =
|
1377 |
}
|
1378 |
if (
|
1379 |
( false === self::$errors_present ) &&
|
1380 |
( !in_array( $poll->options->poll->useCaptcha, self::$captcha_allowed ) )
|
1381 |
-
){
|
1382 |
self::$errors_present = true;
|
1383 |
-
self::$error_text =
|
1384 |
}
|
1385 |
if (
|
1386 |
( false === self::$errors_present ) &&
|
1387 |
( !in_array( $poll->options->poll->sendEmailNotifications, self::$yes_no_allowed ) )
|
1388 |
-
){
|
1389 |
self::$errors_present = true;
|
1390 |
-
self::$error_text =
|
1391 |
}
|
1392 |
if (
|
1393 |
( false === self::$errors_present ) &&
|
@@ -1396,7 +1428,7 @@ class YOP_Poll_Polls {
|
|
1396 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromName ) ) )
|
1397 |
) {
|
1398 |
self::$errors_present = true;
|
1399 |
-
self::$error_text =
|
1400 |
}
|
1401 |
if (
|
1402 |
( false === self::$errors_present ) &&
|
@@ -1405,7 +1437,7 @@ class YOP_Poll_Polls {
|
|
1405 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromEmail ) ) )
|
1406 |
) {
|
1407 |
self::$errors_present = true;
|
1408 |
-
self::$error_text =
|
1409 |
}
|
1410 |
if (
|
1411 |
( false === self::$errors_present ) &&
|
@@ -1414,7 +1446,7 @@ class YOP_Poll_Polls {
|
|
1414 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsRecipients ) ) )
|
1415 |
) {
|
1416 |
self::$errors_present = true;
|
1417 |
-
self::$error_text =
|
1418 |
}
|
1419 |
if (
|
1420 |
( false === self::$errors_present ) &&
|
@@ -1423,7 +1455,7 @@ class YOP_Poll_Polls {
|
|
1423 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsSubject ) ) )
|
1424 |
) {
|
1425 |
self::$errors_present = true;
|
1426 |
-
self::$error_text =
|
1427 |
}
|
1428 |
if (
|
1429 |
( false === self::$errors_present ) &&
|
@@ -1432,16 +1464,16 @@ class YOP_Poll_Polls {
|
|
1432 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsMessage ) ) )
|
1433 |
) {
|
1434 |
self::$errors_present = true;
|
1435 |
-
self::$error_text =
|
1436 |
}
|
1437 |
/* POLL OPTIONS->RESULTS CHECK */
|
1438 |
if (
|
1439 |
( false === self::$errors_present ) &&
|
1440 |
( 0 < count( $poll->options->results->showResultsMoment ) ) &&
|
1441 |
( 0 === count( array_intersect( $poll->options->results->showResultsMoment, self::$show_results_allowed ) ) )
|
1442 |
-
){
|
1443 |
self::$errors_present = true;
|
1444 |
-
self::$error_text =
|
1445 |
}
|
1446 |
if (
|
1447 |
( false === self::$errors_present ) &&
|
@@ -1450,23 +1482,23 @@ class YOP_Poll_Polls {
|
|
1450 |
( '' === sanitize_text_field( $poll->options->results->customDateResults ) ) )
|
1451 |
) {
|
1452 |
self::$errors_present = true;
|
1453 |
-
self::$error_text =
|
1454 |
}
|
1455 |
if (
|
1456 |
( false === self::$errors_present ) &&
|
1457 |
-
( 0 < count( $poll->options->results->showResultsMoment ) ) && !in_array('never', $poll->options->results->showResultsMoment ) &&
|
1458 |
-
( ( 0 === count( $poll->options->results->showResultsTo )) ||
|
1459 |
( 0 === count( array_intersect( $poll->options->results->showResultsTo, self::$show_results_to_allowed ) ) ) )
|
1460 |
-
){
|
1461 |
self::$errors_present = true;
|
1462 |
-
self::$error_text =
|
1463 |
}
|
1464 |
if (
|
1465 |
( false === self::$errors_present ) &&
|
1466 |
( !in_array( $poll->options->results->backToVoteOption, self::$yes_no_allowed ) )
|
1467 |
-
){
|
1468 |
self::$errors_present = true;
|
1469 |
-
self::$error_text =
|
1470 |
}
|
1471 |
if (
|
1472 |
( false === self::$errors_present ) &&
|
@@ -1475,16 +1507,16 @@ class YOP_Poll_Polls {
|
|
1475 |
( '' === trim( $poll->options->results->backToVoteCaption ) ) ||
|
1476 |
( '' === sanitize_text_field( $poll->options->results->backToVoteCaption ) )
|
1477 |
)
|
1478 |
-
){
|
1479 |
self::$errors_present = true;
|
1480 |
-
self::$error_text =
|
1481 |
}
|
1482 |
if (
|
1483 |
( false === self::$errors_present ) &&
|
1484 |
( !in_array( $poll->options->results->sortResults, self::$sort_results_allowed ) )
|
1485 |
-
){
|
1486 |
self::$errors_present = true;
|
1487 |
-
self::$error_text =
|
1488 |
}
|
1489 |
if (
|
1490 |
( false === self::$errors_present ) &&
|
@@ -1492,14 +1524,14 @@ class YOP_Poll_Polls {
|
|
1492 |
( !in_array( $poll->options->results->sortResultsRule, self::$sort_results_rule_allowed ) )
|
1493 |
) {
|
1494 |
self::$errors_present = true;
|
1495 |
-
self::$error_text =
|
1496 |
}
|
1497 |
if (
|
1498 |
( false === self::$errors_present ) &&
|
1499 |
( !in_array( $poll->options->results->displayResultsAs, self::$display_results_as_allowed ) )
|
1500 |
) {
|
1501 |
self::$errors_present = true;
|
1502 |
-
self::$error_text =
|
1503 |
}
|
1504 |
if (
|
1505 |
( false === self::$errors_present ) &&
|
@@ -1507,7 +1539,7 @@ class YOP_Poll_Polls {
|
|
1507 |
( 0 === count( array_intersect( $poll->options->access->votePermissions, self::$vote_permissions_allowed ) ) ) )
|
1508 |
) {
|
1509 |
self::$errors_present = true;
|
1510 |
-
self::$error_text =
|
1511 |
}
|
1512 |
/*
|
1513 |
if (
|
@@ -1515,16 +1547,16 @@ class YOP_Poll_Polls {
|
|
1515 |
( !in_array( $poll->options->access->allowWordpressVotes, self::$yes_no_allowed ) )
|
1516 |
) {
|
1517 |
self::$errors_present = true;
|
1518 |
-
self::$error_text =
|
1519 |
}
|
1520 |
*/
|
1521 |
if (
|
1522 |
( false === self::$errors_present ) &&
|
1523 |
( count( $poll->options->access->blockVoters ) > 0 ) &&
|
1524 |
-
( 0 === count( array_intersect($poll->options->access->blockVoters, self::$block_voters_allowed) ) )
|
1525 |
) {
|
1526 |
self::$errors_present = true;
|
1527 |
-
self::$error_text =
|
1528 |
}
|
1529 |
if (
|
1530 |
( false === self::$errors_present ) &&
|
@@ -1536,14 +1568,14 @@ class YOP_Poll_Polls {
|
|
1536 |
( !in_array( $poll->options->access->blockForPeriod, self::$block_voters_period_allowed ) ) )
|
1537 |
) {
|
1538 |
self::$errors_present = true;
|
1539 |
-
self::$error_text =
|
1540 |
}
|
1541 |
if (
|
1542 |
( false === self::$errors_present ) &&
|
1543 |
( !in_array( $poll->options->access->limitVotesPerUser, self::$yes_no_allowed ) )
|
1544 |
) {
|
1545 |
self::$errors_present = true;
|
1546 |
-
self::$error_text =
|
1547 |
}
|
1548 |
if (
|
1549 |
( false === self::$errors_present ) &&
|
@@ -1551,7 +1583,7 @@ class YOP_Poll_Polls {
|
|
1551 |
( 0 === intval( $poll->options->access->votesPerUserAllowed ) )
|
1552 |
) {
|
1553 |
self::$errors_present = true;
|
1554 |
-
self::$error_text =
|
1555 |
}
|
1556 |
}
|
1557 |
}
|
@@ -1578,7 +1610,7 @@ class YOP_Poll_Polls {
|
|
1578 |
}
|
1579 |
}
|
1580 |
public static function ends_soon( $poll ) {
|
1581 |
-
$ends_soon_date = date( 'Y-m-d H:i:s', strtotime( current_time( 'mysql' ) . ' + ' . self::$ends_soon_interval. ' days' ) );
|
1582 |
$poll_meta_data = unserialize( $poll['meta_data'] );
|
1583 |
if ( 'custom' === $poll_meta_data['options']['poll']['endDateOption'] ) {
|
1584 |
$end_date = date( 'Y-m-d H:i:s', strtotime( $poll_meta_data['options']['poll']['endDateCustom'] ) );
|
@@ -1606,7 +1638,7 @@ class YOP_Poll_Polls {
|
|
1606 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'", $poll_id
|
1607 |
);
|
1608 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1609 |
-
if( null !== $poll ){
|
1610 |
$poll_meta_data = unserialize( $poll->meta_data );
|
1611 |
$poll->meta_data = array(
|
1612 |
'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
|
@@ -1633,16 +1665,16 @@ class YOP_Poll_Polls {
|
|
1633 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
|
1634 |
);
|
1635 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1636 |
-
if ( null !== $poll ){
|
1637 |
$poll_meta_data = unserialize( $poll->meta_data );
|
1638 |
$poll->meta_data = array(
|
1639 |
'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
|
1640 |
'options' => $poll_meta_data['options']
|
1641 |
);
|
1642 |
$poll_elements = YOP_Poll_Elements::get_all_for_poll( $poll_id );
|
1643 |
-
foreach( $poll_elements as $poll_element ) {
|
1644 |
if ( true === isset( $poll_element->meta_data['answersSort'] ) ) {
|
1645 |
-
switch( $poll_element->meta_data['answersSort'] ) {
|
1646 |
case 'as-defined': {
|
1647 |
$sub_elements_order_by = 'sorder';
|
1648 |
$sub_elements_order_rule = 'ASC';
|
@@ -1686,7 +1718,7 @@ class YOP_Poll_Polls {
|
|
1686 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
|
1687 |
);
|
1688 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1689 |
-
if( null !== $poll ){
|
1690 |
$poll->meta_data = unserialize( $poll->meta_data );
|
1691 |
switch ( $poll->meta_data['options']['results']['sortResults'] ) {
|
1692 |
case 'as-defined': {
|
@@ -1732,16 +1764,16 @@ class YOP_Poll_Polls {
|
|
1732 |
$poll_element->answers[] = $poll_sub_element;
|
1733 |
}
|
1734 |
}
|
1735 |
-
if (
|
1736 |
-
( true === isset( $poll_element->meta_data['displayOtherAnswersInResults'] ) ) &&
|
1737 |
( 'yes' === $poll_element->meta_data['displayOtherAnswersInResults'] ) &&
|
1738 |
( 'no' === $poll_element->meta_data['addOtherAnswers'] )
|
1739 |
) {
|
1740 |
$element_other_answers = YOP_Poll_Other_Answers::get_for_element( $poll_element->id );
|
1741 |
if ( count( $element_other_answers ) > 0 ) {
|
1742 |
$i = 1;
|
1743 |
-
foreach( $element_other_answers as $other_answer ) {
|
1744 |
-
$poll_element->answers[] = (
|
1745 |
'id' => 0,
|
1746 |
'poll_id' => $poll_id,
|
1747 |
'element_id' => $poll_element->id,
|
@@ -1819,7 +1851,7 @@ class YOP_Poll_Polls {
|
|
1819 |
/*END POLL*/
|
1820 |
/*BEGIN QUESTIONS*/
|
1821 |
if ( true === in_array( $meta_data_for_style['questions']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1822 |
-
switch( $meta_data_for_style['questions']['textSize'] ) {
|
1823 |
case 'small': {
|
1824 |
$meta_data_for_style['questions']['textSize'] = '14';
|
1825 |
break;
|
@@ -1849,7 +1881,7 @@ class YOP_Poll_Polls {
|
|
1849 |
$meta_data_for_style['answers']['paddingTopBottom'] = $meta_data_for_style['answers']['padding'];
|
1850 |
}
|
1851 |
if ( true === in_array( $meta_data_for_style['answers']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1852 |
-
switch( $meta_data_for_style['answers']['textSize'] ) {
|
1853 |
case 'small': {
|
1854 |
$meta_data_for_style['answers']['textSize'] = '14';
|
1855 |
break;
|
@@ -1876,7 +1908,7 @@ class YOP_Poll_Polls {
|
|
1876 |
$meta_data_for_style['buttons']['paddingTopBottom'] = '5';
|
1877 |
}
|
1878 |
if ( true === in_array( $meta_data_for_style['buttons']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1879 |
-
switch( $meta_data_for_style['buttons']['textSize'] ) {
|
1880 |
case 'small': {
|
1881 |
$meta_data_for_style['buttons']['textSize'] = '14';
|
1882 |
break;
|
@@ -1909,7 +1941,7 @@ class YOP_Poll_Polls {
|
|
1909 |
$meta_data_for_style['errors']['paddingTopBottom'] = $meta_data_for_style['errors']['padding'];
|
1910 |
}
|
1911 |
if ( true === in_array( $meta_data_for_style['errors']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1912 |
-
switch( $meta_data_for_style['errors']['textSize'] ) {
|
1913 |
case 'small': {
|
1914 |
$meta_data_for_style['errors']['textSize'] = '14';
|
1915 |
break;
|
@@ -1955,9 +1987,9 @@ class YOP_Poll_Polls {
|
|
1955 |
public static function has_started_frontend( $poll ) {
|
1956 |
$today = date( 'Y-m-d H:i:s', strtotime( current_time( 'mysql' ) ) );
|
1957 |
if ( 'custom' === $poll->meta_data['options']['poll']['startDateOption'] ) {
|
1958 |
-
$
|
1959 |
-
if ( $
|
1960 |
-
if ( $today < $
|
1961 |
return false;
|
1962 |
} else {
|
1963 |
return true;
|
@@ -2019,7 +2051,7 @@ class YOP_Poll_Polls {
|
|
2019 |
$results[$i]['sorder'] = $answer->sorder;
|
2020 |
$results[$i]['votes'] = $answer->total_submits;
|
2021 |
if ( 0 < intval( $poll->total_submits ) ) {
|
2022 |
-
if ( 0 ===
|
2023 |
$results[$i]['percentage'] = number_format( $answer->total_submits / $poll->total_submits * 100, 0 );
|
2024 |
} else {
|
2025 |
$results[$i]['percentage'] = number_format( $answer->total_submits / $poll->total_submits * 100, 2 );
|
@@ -2046,7 +2078,7 @@ class YOP_Poll_Polls {
|
|
2046 |
$order_by['votes'][$key] = $row['votes'];
|
2047 |
$order_by['percentage'][$key] = $row['percentage'];
|
2048 |
}
|
2049 |
-
if ( 0 < count( $results) ) {
|
2050 |
array_multisort( $order_by[$sort_params['order_by']], $sort_params['sort_order'], $results );
|
2051 |
}
|
2052 |
return $results;
|
@@ -2054,7 +2086,9 @@ class YOP_Poll_Polls {
|
|
2054 |
public static function add_vote( $poll_id, $total_submited_answers ) {
|
2055 |
$query = $GLOBALS['wpdb']->prepare(
|
2056 |
"UPDATE {$GLOBALS['wpdb']->yop_poll_polls} SET `total_submits` = `total_submits` + 1, "
|
2057 |
-
.
|
|
|
|
|
2058 |
);
|
2059 |
$GLOBALS['wpdb']->query( $query );
|
2060 |
}
|
@@ -2173,9 +2207,9 @@ class YOP_Poll_Polls {
|
|
2173 |
$search_field = '';
|
2174 |
$total_votes_for_user = '';
|
2175 |
$accept_votes_from_user = true;
|
2176 |
-
switch( $user_type ) {
|
2177 |
case 'wordpress': {
|
2178 |
-
$search_field =
|
2179 |
break;
|
2180 |
}
|
2181 |
case 'facebook': {
|
@@ -2329,7 +2363,7 @@ class YOP_Poll_Polls {
|
|
2329 |
$elements_votes[$i] = 0;
|
2330 |
foreach ( $element_data->answers as $answer_data ) {
|
2331 |
if ( intval( $answer_data->id ) > 0 ) {
|
2332 |
-
$elements_votes[$i] += intval( $answer_data->votes);
|
2333 |
}
|
2334 |
}
|
2335 |
$i++;
|
@@ -2343,7 +2377,7 @@ class YOP_Poll_Polls {
|
|
2343 |
$votes[$i]->trackingId = '';
|
2344 |
$votes[$i]->data = array();
|
2345 |
$j = 0;
|
2346 |
-
foreach( $elements_data as $element_data ) {
|
2347 |
if ( intval( $element_data->id ) > 0 ) {
|
2348 |
$votes[$i]->data[$j] = new stdClass();
|
2349 |
$votes[$i]->data[$j]->type = 'question';
|
@@ -2370,18 +2404,18 @@ class YOP_Poll_Polls {
|
|
2370 |
$result['success'] = true;
|
2371 |
} else {
|
2372 |
$result['success'] = false;
|
2373 |
-
$result['error'] =
|
2374 |
}
|
2375 |
} else {
|
2376 |
$result['success'] = false;
|
2377 |
-
$result['error'] =
|
2378 |
}
|
2379 |
return $result;
|
2380 |
}
|
2381 |
public static function has_other_answers( $poll ) {
|
2382 |
if ( true === isset( $poll->elements ) ) {
|
2383 |
-
foreach( $poll->elements as $element ) {
|
2384 |
-
if (
|
2385 |
( true === in_array( $element->etype, array( 'text-question', 'media-question' ) ) ) &&
|
2386 |
( 'yes' === $element->meta_data['allowOtherAnswers'] )
|
2387 |
) {
|
@@ -2394,9 +2428,9 @@ class YOP_Poll_Polls {
|
|
2394 |
}
|
2395 |
public static function get_all_polls_for_archive( $params, $order_by ) {
|
2396 |
if ( 0 !== $params['max'] ) {
|
2397 |
-
$limit =
|
2398 |
$query = "SELECT `id` FROM `{$GLOBALS['wpdb']->yop_poll_polls}` WHERE `status` != 'deleted' {$order_by} LIMIT %d";
|
2399 |
-
$query_ready
|
2400 |
$query,
|
2401 |
$params['max']
|
2402 |
);
|
@@ -2410,14 +2444,18 @@ class YOP_Poll_Polls {
|
|
2410 |
$polls_for_display = array();
|
2411 |
$nr_added = 0;
|
2412 |
$query_ready = "SELECT `id`, `meta_data` FROM `{$GLOBALS['wpdb']->yop_poll_polls}` WHERE `status` != 'deleted' {$order_by}";
|
2413 |
-
$polls = $GLOBALS['wpdb']->get_results( $query_ready,
|
2414 |
foreach ( $polls as $poll ) {
|
2415 |
-
|
|
|
|
|
|
|
|
|
2416 |
if ( 0 === $params['max'] ) {
|
2417 |
-
$polls_for_display[]['id'] = $poll
|
2418 |
} else {
|
2419 |
if ( $nr_added < $params['max'] ) {
|
2420 |
-
$polls_for_display[]['id'] = $poll
|
2421 |
$nr_added++;
|
2422 |
}
|
2423 |
}
|
6 |
$text_weight_allowed = array( 'normal', 'bold' ),
|
7 |
$text_align_allowed = array( 'left', 'center', 'right' ),
|
8 |
$yes_no_allowed = array( 'yes', 'no' ),
|
9 |
+
$captcha_allowed = array( 'yes', 'yes-recaptcha', 'yes-recaptcha-invisible', 'yes-recaptcha-v3', 'yes-hcaptcha', 'no' ),
|
10 |
$answers_display_allowed = array( 'vertical', 'horizontal', 'columns' ),
|
11 |
$answers_sort_allowed = array( 'as-defined' ),
|
12 |
$date_values_allowed = array( 'now', 'custom', 'never', 'custom-date' ),
|
31 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s", $poll_id
|
32 |
);
|
33 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
34 |
+
if ( null !== $poll ) {
|
35 |
return $poll->author;
|
36 |
} else {
|
37 |
return false;
|
45 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
46 |
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `status` != 'deleted'";
|
47 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
48 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
49 |
+
$query .= ' AND `name` LIKE %s';
|
50 |
+
$query .= $GLOBALS['wpdb']->prepare(
|
51 |
+
$query,
|
52 |
+
$params['q']
|
53 |
+
);
|
54 |
}
|
55 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
56 |
$query = "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE
|
57 |
+
`author` = %s
|
58 |
AND `status` !='deleted'";
|
59 |
+
$query = $GLOBALS['wpdb']->prepare(
|
60 |
+
$query,
|
61 |
+
$current_user->ID
|
62 |
+
);
|
63 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
64 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
65 |
+
$query .= ' AND `name` LIKE %s';
|
66 |
+
$query = $GLOBALS['wpdb']->prepare(
|
67 |
+
$query,
|
68 |
+
$params['q']
|
69 |
+
);
|
70 |
}
|
71 |
}
|
72 |
if ( '' !== $query ) {
|
84 |
} else {
|
85 |
$data['pagination'] = '';
|
86 |
}
|
87 |
+
if ( 1 < $total_pages ) {
|
88 |
$pagination['first_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
89 |
«
|
90 |
</span>';
|
91 |
$pagination['previous_page'] = '<span class="screen-reader-text">
|
92 |
+
' . esc_html__( 'Previous page', 'yop-poll' ) . '
|
93 |
</span>
|
94 |
<span class="tablenav-pages-navspan" aria-hidden="true">
|
95 |
‹
|
96 |
</span>';
|
97 |
+
$pagination['next_page'] = '<span class="screen-reader-text">' . esc_html__( 'Next page', 'yop-poll' ) . '
|
98 |
</span>
|
99 |
<span aria-hidden="true">›</span>';
|
100 |
$pagination['last_page'] = '<span class="tablenav-pages-navspan" aria-hidden="true">
|
111 |
'order_by' => $params['order_by'],
|
112 |
'sort_order' => $params['sort_order'],
|
113 |
'q' => htmlentities( $params['q'] ),
|
114 |
+
'page_no' => $params['page_no'] + 1
|
115 |
)
|
116 |
)
|
117 |
);
|
147 |
'order_by' => $params['order_by'],
|
148 |
'sort_order' => $params['sort_order'],
|
149 |
'q' => htmlentities( $params['q'] ),
|
150 |
+
'page_no' => $params['page_no'] - 1
|
151 |
)
|
152 |
)
|
153 |
);
|
183 |
'order_by' => $params['order_by'],
|
184 |
'sort_order' => $params['sort_order'],
|
185 |
'q' => htmlentities( $params['q'] ),
|
186 |
+
'page_no' => $params['page_no'] - 1
|
187 |
)
|
188 |
)
|
189 |
);
|
196 |
'order_by' => $params['order_by'],
|
197 |
'sort_order' => $params['sort_order'],
|
198 |
'q' => htmlentities( $params['q'] ),
|
199 |
+
'page_no' => $params['page_no'] + 1
|
200 |
)
|
201 |
)
|
202 |
);
|
274 |
$params['sort_order'] = SORT_ASC;
|
275 |
} elseif ( 'desc' === $params['sort_order'] ) {
|
276 |
$params['sort_order'] = SORT_DESC;
|
277 |
+
} else {
|
278 |
$params['sort_order'] = SORT_ASC;
|
279 |
}
|
280 |
if ( !in_array( $params['order_by'], self::$order_by_allowed ) ) {
|
281 |
$params['order_by'] = 'id';
|
282 |
}
|
283 |
+
if ( $params['page_no'] > $pagination['total_pages'] ) {
|
284 |
$params['page_no'] = 1;
|
285 |
}
|
286 |
$limit = self::$polls_per_page * ( $params['page_no'] - 1 );
|
|
|
287 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
288 |
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `status` != 'deleted'";
|
289 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
290 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
291 |
+
$query .= ' AND `name` LIKE %s ORDER BY `id` DESC';
|
292 |
+
$query = $GLOBALS['wpdb']->prepare(
|
293 |
+
$query,
|
294 |
+
$params['q']
|
295 |
+
);
|
296 |
} else {
|
297 |
+
$query .= ' ORDER BY `id` DESC';
|
298 |
}
|
299 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
300 |
+
$query = "SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `author` = %s
|
301 |
AND `status` != 'deleted'";
|
302 |
+
$query = $GLOBALS['wpdb']->prepare(
|
303 |
+
$query,
|
304 |
+
$current_user->ID
|
305 |
+
);
|
306 |
if ( isset( $params['q'] ) && ( '' !== $params['q'] ) ) {
|
307 |
+
$params['q'] = '%' . $GLOBALS['wpdb']->esc_like( $params['q'] ) . '%';
|
308 |
+
$query .= ' AND `name` LIKE %s ORDER BY `id` DESC';
|
309 |
+
$query = $GLOBALS['wpdb']->prepare(
|
310 |
+
$query,
|
311 |
+
$params['q']
|
312 |
+
);
|
313 |
} else {
|
314 |
+
$query .= ' ORDER BY `id` DESC';
|
315 |
}
|
316 |
}
|
317 |
if ( '' !== $query ) {
|
318 |
+
$query .= ' LIMIT %d, %d';
|
319 |
+
$query = $GLOBALS['wpdb']->prepare(
|
320 |
+
$query,
|
321 |
+
$limit,
|
322 |
+
self::$polls_per_page
|
323 |
+
);
|
324 |
$polls = $GLOBALS['wpdb']->get_results( $query, ARRAY_A );
|
325 |
}
|
326 |
+
foreach ( $polls as &$poll ) {
|
327 |
$statistics[$poll['status']]++;
|
328 |
if ( true === self::is_ended( $poll, false ) ) {
|
329 |
$poll['status'] = 'ended';
|
376 |
if ( current_user_can( 'yop_poll_results_others' ) ) {
|
377 |
$query = "SELECT `id`, `name` FROM {$GLOBALS['wpdb']->yop_poll_polls} ORDER BY `name`";
|
378 |
} else if ( current_user_can( 'yop_poll_results_own' ) ) {
|
379 |
+
$query = "SELECT `id`, `name` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `author` = %s ORDER BY `name`";
|
380 |
+
$query = $GLOBALS['wpdb']->prepare(
|
381 |
+
$query,
|
382 |
+
$current_user->ID
|
383 |
+
);
|
384 |
}
|
385 |
if ( '' !== $query ) {
|
386 |
$polls = $GLOBALS['wpdb']->get_results( $query, OBJECT );
|
410 |
'added_date' => isset( $poll->added_date ) ? sanitize_text_field( $poll->added_date ) : current_time( 'mysql' ),
|
411 |
'modified_date' => isset( $poll->modified_date ) ? sanitize_text_field( $poll->modified_date ) : current_time( 'mysql' )
|
412 |
);
|
413 |
+
if ( isset( $poll->ID ) && is_numeric( $poll->ID ) ) {
|
414 |
$data['id'] = $poll->ID;
|
415 |
}
|
416 |
if ( isset( $poll->poll_author ) && is_numeric( $poll->poll_author ) ) {
|
450 |
self::$errors_present = false;
|
451 |
} else {
|
452 |
self::$errors_present = true;
|
453 |
+
self::$error_text = esc_html__( 'Error adding page', 'yop-poll' );
|
454 |
}
|
455 |
}
|
456 |
}
|
459 |
}
|
460 |
} else {
|
461 |
self::$errors_present = true;
|
462 |
+
self::$error_text = esc_html__( 'Error adding poll', 'yop-poll' );
|
463 |
}
|
464 |
} else {
|
465 |
self::$errors_present = true;
|
466 |
+
self::$error_text = esc_html__( 'A poll with this name already exists', 'yop-poll' );
|
467 |
}
|
468 |
}
|
469 |
return array(
|
491 |
$db_poll_meta = unserialize( $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT `meta_data` FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %d", $poll->id ) ) );
|
492 |
if ( 'yes' === $poll->options->poll->autoGeneratePollPage ) {
|
493 |
$has_page = true;
|
494 |
+
if ( isset( $db_poll_meta['options']['poll']['pageId'] ) && ( $db_poll_meta['options']['poll']['pageId'] > 0 ) ) {
|
495 |
$poll_page_count = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT COUNT(*) FROM {$GLOBALS['wpdb']->posts} WHERE `ID` = %d AND `post_status` = 'publish'", $db_poll_meta['options']['poll']['pageId'] ) );
|
496 |
+
if ( 0 === (int) $poll_page_count ) {
|
497 |
$has_page = false;
|
498 |
}
|
499 |
} else {
|
547 |
}
|
548 |
} else {
|
549 |
self::$errors_present = true;
|
550 |
+
self::$error_text = esc_html__( 'Error adding poll', 'yop-poll' );
|
551 |
}
|
552 |
if ( true === isset( $poll->elementsRemoved ) ) {
|
553 |
$elements_removed = explode( ',', $poll->elementsRemoved );
|
559 |
}
|
560 |
} else {
|
561 |
self::$errors_present = true;
|
562 |
+
self::$error_text = esc_html__( 'Error updating poll', 'yop-poll' );
|
563 |
}
|
564 |
return array(
|
565 |
'success' => !self::$errors_present,
|
600 |
YOP_Poll_Bans::delete_all_for_poll( $poll_id );
|
601 |
} else {
|
602 |
self::$errors_present = true;
|
603 |
+
self::$error_text = esc_html__( 'Error deleting poll', 'yop-poll' );
|
604 |
}
|
605 |
return array(
|
606 |
'success' => !self::$errors_present,
|
614 |
);
|
615 |
$cloned_poll = $GLOBALS['wpdb']->get_row( $poll_query, OBJECT );
|
616 |
$data = array(
|
617 |
+
'name' => $cloned_poll->name . ' ' . esc_html__( 'clone', 'yop-poll' ),
|
618 |
'template' => $cloned_poll->template,
|
619 |
'template_base' => $cloned_poll->template_base,
|
620 |
'skin_base' => $cloned_poll->skin_base,
|
636 |
$new_poll_meta_data = unserialize( $cloned_poll->meta_data );
|
637 |
if ( 'yes' === $new_poll_meta_data['options']['poll']['autoGeneratePollPage'] ) {
|
638 |
$page_id = wp_insert_post( array(
|
639 |
+
'post_title' => $cloned_poll->name . ' ' . esc_html__( 'clone', 'yop-poll' ),
|
640 |
'post_content' => "[yop_poll id='{$new_poll_id}']",
|
641 |
'post_status' => 'publish',
|
642 |
'post_type' => 'page',
|
654 |
self::$errors_present = false;
|
655 |
} else {
|
656 |
self::$errors_present = true;
|
657 |
+
self::$error_text = esc_html__( 'Error adding page', 'yop-poll' );
|
658 |
}
|
659 |
}
|
660 |
}
|
661 |
} else {
|
662 |
self::$errors_present = true;
|
663 |
+
self::$error_text = esc_html__( 'Error cloning poll', 'yop-poll' );
|
664 |
}
|
665 |
return array(
|
666 |
'success' => !self::$errors_present,
|
679 |
YOP_Poll_Votes::delete_all_for_poll( $poll_id );
|
680 |
} else {
|
681 |
self::$errors_present = true;
|
682 |
+
self::$error_text = esc_html__( 'Error resetting votes', 'yop-poll' );
|
683 |
}
|
684 |
return array(
|
685 |
'success' => !self::$errors_present,
|
705 |
),
|
706 |
'answers' => array(
|
707 |
'paddingLeftRight' => sanitize_text_field( $poll->design->style->answers->paddingLeftRight ),
|
708 |
+
'paddingTopBottom' => sanitize_text_field( $poll->design->style->answers->paddingTopBottom ),
|
709 |
'textColor' => sanitize_text_field( $poll->design->style->answers->textColor ),
|
710 |
'textSize' => sanitize_text_field( $poll->design->style->answers->textSize ),
|
711 |
'textWeight' => sanitize_text_field( $poll->design->style->answers->textWeight ),
|
813 |
public static function validate_data( stdClass $poll ) {
|
814 |
if ( false === is_object( $poll ) ) {
|
815 |
self::$errors_present = true;
|
816 |
+
self::$error_text = esc_html__( 'Invalid data', 'yop-poll' );
|
817 |
} else {
|
818 |
if (
|
819 |
( false === self::$errors_present ) &&
|
821 |
( '' === sanitize_text_field( $poll->name ) ) )
|
822 |
) {
|
823 |
self::$errors_present = true;
|
824 |
+
self::$error_text = esc_html__( 'Data for "Poll Name" is invalid', 'yop-poll' );
|
825 |
}
|
826 |
if (
|
827 |
( false === self::$errors_present ) &&
|
830 |
( 0 === intval( $poll->design->template ) ) )
|
831 |
) {
|
832 |
self::$errors_present = true;
|
833 |
+
self::$error_text = esc_html__( 'Data for "Template" is invalid', 'yop-poll' );
|
834 |
}
|
835 |
if (
|
836 |
( false === self::$errors_present ) &&
|
839 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->backgroundColor ) ) ) )
|
840 |
) {
|
841 |
self::$errors_present = true;
|
842 |
+
self::$error_text = esc_html__( 'Data for "Poll Background Color" is invalid', 'yop-poll' );
|
843 |
}
|
844 |
if (
|
845 |
( false === self::$errors_present ) &&
|
848 |
( !ctype_digit( (string) $poll->design->style->poll->borderSize ) ) )
|
849 |
) {
|
850 |
self::$errors_present = true;
|
851 |
+
self::$error_text = esc_html__( 'Data for "Poll Border Thickness" is invalid', 'yop-poll' );
|
852 |
}
|
853 |
if (
|
854 |
( false === self::$errors_present ) &&
|
857 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->poll->borderColor ) ) ) )
|
858 |
) {
|
859 |
self::$errors_present = true;
|
860 |
+
self::$error_text = esc_html__( 'Data for "Poll Border Color" is invalid', 'yop-poll' );
|
861 |
}
|
862 |
if (
|
863 |
( false === self::$errors_present ) &&
|
866 |
( !ctype_digit( (string) $poll->design->style->poll->borderRadius ) ) )
|
867 |
) {
|
868 |
self::$errors_present = true;
|
869 |
+
self::$error_text = esc_html__( 'Data for "Poll Border Radius" is invalid', 'yop-poll' );
|
870 |
}
|
871 |
if (
|
872 |
( false === self::$errors_present ) &&
|
875 |
( !ctype_digit( (string) $poll->design->style->poll->paddingLeftRight ) ) )
|
876 |
) {
|
877 |
self::$errors_present = true;
|
878 |
+
self::$error_text = esc_html__( 'Data for "Poll Padding Left/Right" is invalid', 'yop-poll' );
|
879 |
}
|
880 |
if (
|
881 |
( false === self::$errors_present ) &&
|
884 |
( !ctype_digit( (string) $poll->design->style->poll->paddingTopBottom ) ) )
|
885 |
) {
|
886 |
self::$errors_present = true;
|
887 |
+
self::$error_text = esc_html__( 'Data for "Poll Padding Top/Bottom" is invalid', 'yop-poll' );
|
888 |
}
|
889 |
/* QUESTIONS STYLE CHECK */
|
890 |
if (
|
894 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->questions->textColor ) ) ) )
|
895 |
) {
|
896 |
self::$errors_present = true;
|
897 |
+
self::$error_text = esc_html__( 'Data for "Question Text Color" is invalid', 'yop-poll' );
|
898 |
}
|
899 |
if (
|
900 |
( false === self::$errors_present ) &&
|
902 |
( '' === sanitize_text_field( $poll->design->style->questions->textSize ) ) )
|
903 |
) {
|
904 |
self::$errors_present = true;
|
905 |
+
self::$error_text = esc_html__( 'Data for "Question Text Size" is invalid', 'yop-poll' );
|
906 |
}
|
907 |
if (
|
908 |
( false === self::$errors_present ) &&
|
911 |
( !in_array( $poll->design->style->questions->textWeight, self::$text_weight_allowed ) ) )
|
912 |
) {
|
913 |
self::$errors_present = true;
|
914 |
+
self::$error_text = esc_html__( 'Data for "Question Text Weight" is invalid', 'yop-poll' );
|
915 |
}
|
916 |
if (
|
917 |
( false === self::$errors_present ) &&
|
920 |
( !in_array( $poll->design->style->questions->textAlign, self::$text_align_allowed ) ) )
|
921 |
) {
|
922 |
self::$errors_present = true;
|
923 |
+
self::$error_text = esc_html__( 'Data for "Question Text Align" is invalid', 'yop-poll' );
|
924 |
}
|
925 |
/* ANSWERS STYLE CHECK */
|
926 |
if (
|
930 |
( !ctype_digit( (string) $poll->design->style->answers->paddingLeftRight ) ) )
|
931 |
) {
|
932 |
self::$errors_present = true;
|
933 |
+
self::$error_text = esc_html__( 'Data for "Answers Padding Left/Right" is invalid', 'yop-poll' );
|
934 |
}
|
935 |
if (
|
936 |
( false === self::$errors_present ) &&
|
939 |
( !ctype_digit( (string) $poll->design->style->answers->paddingTopBottom ) ) )
|
940 |
) {
|
941 |
self::$errors_present = true;
|
942 |
+
self::$error_text = esc_html__( 'Data for "Answers Padding Top/Bottom" is invalid', 'yop-poll' );
|
943 |
}
|
944 |
if (
|
945 |
( false === self::$errors_present ) &&
|
948 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->answers->textColor ) ) ) )
|
949 |
) {
|
950 |
self::$errors_present = true;
|
951 |
+
self::$error_text = esc_html__( 'Data for "Answers Text Color" is invalid', 'yop-poll' );
|
952 |
}
|
953 |
if (
|
954 |
( false === self::$errors_present ) &&
|
956 |
( '' === sanitize_text_field( $poll->design->style->answers->textSize ) ) )
|
957 |
) {
|
958 |
self::$errors_present = true;
|
959 |
+
self::$error_text = esc_html__( 'Data for "Answers Text Size" is invalid', 'yop-poll' );
|
960 |
}
|
961 |
if (
|
962 |
( false === self::$errors_present ) &&
|
965 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
966 |
) {
|
967 |
self::$errors_present = true;
|
968 |
+
self::$error_text = esc_html__( 'Data for "Answers Text Weight" is invalid', 'yop-poll' );
|
969 |
}
|
970 |
/* BUTTONS STYLE CHECK */
|
971 |
if (
|
975 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->backgroundColor ) ) ) )
|
976 |
) {
|
977 |
self::$errors_present = true;
|
978 |
+
self::$error_text = esc_html__( 'Data for "Buttons Background Color" is invalid', 'yop-poll' );
|
979 |
}
|
980 |
if (
|
981 |
( false === self::$errors_present ) &&
|
984 |
( !ctype_digit( (string) $poll->design->style->buttons->borderSize ) ) )
|
985 |
) {
|
986 |
self::$errors_present = true;
|
987 |
+
self::$error_text = esc_html__( 'Data for "Buttons Border Thickness" is invalid', 'yop-poll' );
|
988 |
}
|
989 |
if (
|
990 |
( false === self::$errors_present ) &&
|
993 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->borderColor ) ) ) )
|
994 |
) {
|
995 |
self::$errors_present = true;
|
996 |
+
self::$error_text = esc_html__( 'Data for "Buttons Border Color" is invalid', 'yop-poll' );
|
997 |
}
|
998 |
if (
|
999 |
( false === self::$errors_present ) &&
|
1002 |
( !ctype_digit( (string) $poll->design->style->buttons->borderRadius ) ) )
|
1003 |
) {
|
1004 |
self::$errors_present = true;
|
1005 |
+
self::$error_text = esc_html__( 'Data for "Buttons Border Radius" is invalid', 'yop-poll' );
|
1006 |
}
|
1007 |
if (
|
1008 |
( false === self::$errors_present ) &&
|
1011 |
( !ctype_digit( (string) $poll->design->style->buttons->paddingLeftRight ) ) )
|
1012 |
) {
|
1013 |
self::$errors_present = true;
|
1014 |
+
self::$error_text = esc_html__( 'Data for "Buttons Padding Left/Right" is invalid', 'yop-poll' );
|
1015 |
}
|
1016 |
if (
|
1017 |
( false === self::$errors_present ) &&
|
1020 |
( !ctype_digit( (string) $poll->design->style->buttons->paddingTopBottom ) ) )
|
1021 |
) {
|
1022 |
self::$errors_present = true;
|
1023 |
+
self::$error_text = esc_html__( 'Data for "Buttons Padding Top/Bottom" is invalid', 'yop-poll' );
|
1024 |
}
|
1025 |
if (
|
1026 |
( false === self::$errors_present ) &&
|
1029 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->buttons->textColor ) ) ) )
|
1030 |
) {
|
1031 |
self::$errors_present = true;
|
1032 |
+
self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
|
1033 |
}
|
1034 |
if (
|
1035 |
( false === self::$errors_present ) &&
|
1037 |
( '' === sanitize_text_field( $poll->design->style->buttons->textSize ) ) )
|
1038 |
) {
|
1039 |
self::$errors_present = true;
|
1040 |
+
self::$error_text = esc_html__( 'Data for "Buttons Text Size" is invalid', 'yop-poll' );
|
1041 |
}
|
1042 |
if (
|
1043 |
( false === self::$errors_present ) &&
|
1046 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
1047 |
) {
|
1048 |
self::$errors_present = true;
|
1049 |
+
self::$error_text = esc_html__( 'Data for "Buttons Text Weight" is invalid', 'yop-poll' );
|
1050 |
}
|
1051 |
/* ERRORS STYLE CHECK */
|
1052 |
if (
|
1056 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForSuccess ) ) ) )
|
1057 |
) {
|
1058 |
self::$errors_present = true;
|
1059 |
+
self::$error_text = esc_html__( 'Data for "Messages Border Color For Success" is invalid', 'yop-poll' );
|
1060 |
}
|
1061 |
if (
|
1062 |
( false === self::$errors_present ) &&
|
1065 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->borderLeftColorForError ) ) ) )
|
1066 |
) {
|
1067 |
self::$errors_present = true;
|
1068 |
+
self::$error_text = esc_html__( 'Data for "Messages Border Color For Error" is invalid', 'yop-poll' );
|
1069 |
}
|
1070 |
if (
|
1071 |
( false === self::$errors_present ) &&
|
1074 |
( !ctype_digit( (string) $poll->design->style->errors->borderLeftSize ) ) )
|
1075 |
) {
|
1076 |
self::$errors_present = true;
|
1077 |
+
self::$error_text = esc_html__( 'Data for "Messages Border Left Thickness" is invalid', 'yop-poll' );
|
1078 |
}
|
1079 |
if (
|
1080 |
( false === self::$errors_present ) &&
|
1083 |
( !ctype_digit( (string) $poll->design->style->errors->paddingTopBottom ) ) )
|
1084 |
) {
|
1085 |
self::$errors_present = true;
|
1086 |
+
self::$error_text = esc_html__( 'Data for "Messages Padding Top/Bottom" is invalid', 'yop-poll' );
|
1087 |
}
|
1088 |
if (
|
1089 |
( false === self::$errors_present ) &&
|
1092 |
( !ctype_alnum( str_replace( '#', '', $poll->design->style->errors->textColor ) ) ) )
|
1093 |
) {
|
1094 |
self::$errors_present = true;
|
1095 |
+
self::$error_text = esc_html__( 'Data for "Buttons Text Color" is invalid', 'yop-poll' );
|
1096 |
}
|
1097 |
if (
|
1098 |
( false === self::$errors_present ) &&
|
1100 |
( '' === sanitize_text_field( $poll->design->style->errors->textSize ) ) )
|
1101 |
) {
|
1102 |
self::$errors_present = true;
|
1103 |
+
self::$error_text = esc_html__( 'Data for "Messages Text Size" is invalid', 'yop-poll' );
|
1104 |
}
|
1105 |
if (
|
1106 |
( false === self::$errors_present ) &&
|
1109 |
( !in_array( $poll->design->style->answers->textWeight, self::$text_weight_allowed ) ) )
|
1110 |
) {
|
1111 |
self::$errors_present = true;
|
1112 |
+
self::$error_text = esc_html__( 'Data for "Messages Text Weight" is invalid', 'yop-poll' );
|
1113 |
}
|
1114 |
/* POLL ELEMENTS CHECK */
|
1115 |
if (
|
1117 |
( 0 === count( $poll->elements ) )
|
1118 |
) {
|
1119 |
self::$errors_present = true;
|
1120 |
+
self::$error_text = esc_html__( 'No elements present', 'yop-poll' );
|
1121 |
}
|
1122 |
if ( false === self::$errors_present ) {
|
1123 |
+
foreach ( $poll->elements as $element ) {
|
1124 |
switch ( $element->type ) {
|
1125 |
case 'text-question': {
|
1126 |
if (
|
1127 |
( false === self::$errors_present ) &&
|
1128 |
( !isset( $element->text ) ||
|
1129 |
( '' === trim( $element->text ) ) ||
|
1130 |
+
( '' === sanitize_text_field( $element->text ) )
|
1131 |
)
|
1132 |
) {
|
1133 |
self::$errors_present = true;
|
1134 |
+
self::$error_text = esc_html__( 'Data for "Question" is invalid', 'yop-poll' );
|
1135 |
}
|
1136 |
if (
|
1137 |
( false === self::$errors_present ) &&
|
1138 |
( 0 == count( $element->answers ) )
|
1139 |
+
) {
|
1140 |
self::$errors_present = true;
|
1141 |
+
self::$error_text = esc_html__( 'At least one answer per question is required', 'yop-poll' );
|
1142 |
}
|
1143 |
if (
|
1144 |
( false === self::$errors_present )
|
1145 |
+
) {
|
1146 |
+
foreach ( $element->answers as $answer ) {
|
1147 |
if (
|
1148 |
( false === self::$errors_present ) &&
|
1149 |
( !isset( $answer->text ) ||
|
1150 |
( '' === trim( $answer->text ) ) ||
|
1151 |
( '' === sanitize_text_field( $answer->text ) )
|
1152 |
)
|
1153 |
+
) {
|
1154 |
self::$errors_present = true;
|
1155 |
+
self::$error_text = esc_html__( 'Answer text is invalid', 'yop-poll' );
|
1156 |
}
|
1157 |
if (
|
1158 |
( false === self::$errors_present ) &&
|
1159 |
!in_array( $answer->options->makeDefault, self::$yes_no_allowed )
|
1160 |
) {
|
1161 |
self::$errors_present = true;
|
1162 |
+
self::$error_text = esc_html__( 'Data for default answer is invalid', 'yop-poll' );
|
1163 |
}
|
1164 |
if (
|
1165 |
( false === self::$errors_present ) &&
|
1166 |
!in_array( $answer->options->makeLink, self::$yes_no_allowed )
|
1167 |
) {
|
1168 |
self::$errors_present = true;
|
1169 |
+
self::$error_text = esc_html__( ' Data for "Answer Link" is invalid', 'yop-poll' );
|
1170 |
}
|
1171 |
if (
|
1172 |
( false === self::$errors_present ) &&
|
1176 |
!filter_var( $answer->options->link, FILTER_VALIDATE_URL ) )
|
1177 |
) {
|
1178 |
self::$errors_present = true;
|
1179 |
+
self::$error_text = esc_html__( 'Data for "Answer link" is invalid', 'yop-poll' );
|
1180 |
}
|
1181 |
}
|
1182 |
}
|
1183 |
if (
|
1184 |
( false === self::$errors_present ) &&
|
1185 |
( !in_array( $element->options->allowOtherAnswers, self::$yes_no_allowed ) )
|
1186 |
+
) {
|
1187 |
self::$errors_present = true;
|
1188 |
+
self::$error_text = esc_html__( 'Data for "Allow other options" is invalid', 'yop-poll' );
|
1189 |
}
|
1190 |
if (
|
1191 |
( false === self::$errors_present ) &&
|
1193 |
( '' === trim( $element->options->otherAnswersLabel ) ) ||
|
1194 |
( '' === sanitize_text_field( $element->options->otherAnswersLabel ) )
|
1195 |
)
|
1196 |
+
) {
|
1197 |
self::$errors_present = true;
|
1198 |
+
self::$error_text = esc_html__( 'Data for "Label for Other Answers" is invalid', 'yop-poll' );
|
1199 |
}
|
1200 |
if (
|
1201 |
( false === self::$errors_present ) &&
|
1202 |
( !in_array( $element->options->addOtherAnswers, self::$yes_no_allowed ) )
|
1203 |
+
) {
|
1204 |
self::$errors_present = true;
|
1205 |
+
self::$error_text = esc_html__( 'Data for "Add other answers in answer list" is invalid', 'yop-poll' );
|
1206 |
}
|
1207 |
if (
|
1208 |
( false === self::$errors_present ) &&
|
1209 |
( !in_array( $element->options->displayOtherAnswersInResults, self::$yes_no_allowed ) )
|
1210 |
+
) {
|
1211 |
self::$errors_present = true;
|
1212 |
+
self::$error_text = esc_html__( 'Data for "Display other answers in results list" is invalid', 'yop-poll' );
|
1213 |
}
|
1214 |
if (
|
1215 |
( false === self::$errors_present ) &&
|
1216 |
( !in_array( $element->options->allowMultipleAnswers, self::$yes_no_allowed ) )
|
1217 |
+
) {
|
1218 |
self::$errors_present = true;
|
1219 |
+
self::$error_text = esc_html__( 'Data for "Allow multiple answers " is invalid', 'yop-poll' );
|
1220 |
}
|
1221 |
if (
|
1222 |
( false === self::$errors_present ) &&
|
1223 |
( !isset( $element->options->multipleAnswersMinim ) ||
|
1224 |
( '' === sanitize_text_field( $element->options->multipleAnswersMinim ) ) )
|
1225 |
+
) {
|
1226 |
self::$errors_present = true;
|
1227 |
+
self::$error_text = esc_html__( 'Data for "Minimum answers required" is invalid', 'yop-poll' );
|
1228 |
}
|
1229 |
if (
|
1230 |
( false === self::$errors_present ) &&
|
1231 |
( !isset( $element->options->multipleAnswersMaxim ) ||
|
1232 |
( '' === trim( $element->options->multipleAnswersMaxim ) ) )
|
1233 |
+
) {
|
1234 |
self::$errors_present = true;
|
1235 |
+
self::$error_text = esc_html__( 'Data for "Maximum answers required" is invalid', 'yop-poll' );
|
1236 |
}
|
1237 |
if (
|
1238 |
( false === self::$errors_present ) &&
|
1239 |
( intval( $element->options->multipleAnswersMinim ) > intval( $element->options->multipleAnswersMaxim ) )
|
1240 |
+
) {
|
1241 |
self::$errors_present = true;
|
1242 |
+
self::$error_text = esc_html__( 'Data for "Minimum answers required" is invalid', 'yop-poll' );
|
1243 |
}
|
1244 |
if (
|
1245 |
( false === self::$errors_present ) &&
|
1246 |
( !in_array( $element->options->answersDisplay, self::$answers_display_allowed ) )
|
1247 |
+
) {
|
1248 |
self::$errors_present = true;
|
1249 |
+
self::$error_text = esc_html__( 'Data for "Display answers" is invalid', 'yop-poll' );
|
1250 |
}
|
1251 |
if (
|
1252 |
( false === self::$errors_present ) &&
|
1254 |
( !isset( $element->options->answersColumns ) ||
|
1255 |
( '' === sanitize_text_field( $element->options->answersColumns ) ) ||
|
1256 |
( 0 === intval( $element->options->answersColumns ) ) )
|
1257 |
+
) {
|
1258 |
self::$errors_present = true;
|
1259 |
+
self::$error_text = esc_html__( 'Data for "Maximum answers required" is invalid', 'yop-poll' );
|
1260 |
}
|
1261 |
if (
|
1262 |
( false === self::$errors_present ) &&
|
1263 |
( !in_array( $element->options->answersSort, self::$answers_sort_allowed ) )
|
1264 |
+
) {
|
1265 |
self::$errors_present = true;
|
1266 |
+
self::$error_text = esc_html__( 'Data for "Sort Answers" is invalid', 'yop-poll' );
|
1267 |
}
|
1268 |
break;
|
1269 |
}
|
1276 |
)
|
1277 |
) {
|
1278 |
self::$errors_present = true;
|
1279 |
+
self::$error_text = esc_html__( 'Data for "Custom Field" is invalid', 'yop-poll' );
|
1280 |
}
|
1281 |
if (
|
1282 |
( false === self::$errors_present ) &&
|
1283 |
( !in_array( $element->options->makeRequired, self::$yes_no_allowed ) )
|
1284 |
+
) {
|
1285 |
self::$errors_present = true;
|
1286 |
+
self::$error_text = esc_html__( 'Data for "Make Required" is invalid', 'yop-poll' );
|
1287 |
}
|
1288 |
break;
|
1289 |
}
|
1302 |
)
|
1303 |
) {
|
1304 |
self::$errors_present = true;
|
1305 |
+
self::$error_text = esc_html__( 'Data for "Vote Button Label" is invalid', 'yop-poll' );
|
1306 |
}
|
1307 |
if (
|
1308 |
( false === self::$errors_present ) &&
|
1309 |
( !in_array( $poll->options->poll->showResultsLink, self::$yes_no_allowed ) )
|
1310 |
+
) {
|
1311 |
self::$errors_present = true;
|
1312 |
+
self::$error_text = esc_html__( 'Data for "Show [Results] link" is invalid', 'yop-poll' );
|
1313 |
}
|
1314 |
if (
|
1315 |
( false === self::$errors_present ) &&
|
1320 |
)
|
1321 |
) {
|
1322 |
self::$errors_present = true;
|
1323 |
+
self::$error_text = esc_html__( 'Data for "[Results] Link Label" is invalid', 'yop-poll' );
|
1324 |
}
|
1325 |
if (
|
1326 |
( false === self::$errors_present ) &&
|
1327 |
( !in_array( $poll->options->poll->showTotalVotes, self::$yes_no_allowed ) )
|
1328 |
+
) {
|
1329 |
self::$errors_present = true;
|
1330 |
+
self::$error_text = esc_html__( 'Data for "Show Total Votes" is invalid', 'yop-poll' );
|
1331 |
}
|
1332 |
if (
|
1333 |
( false === self::$errors_present ) &&
|
1334 |
( !in_array( $poll->options->poll->showTotalAnswers, self::$yes_no_allowed ) )
|
1335 |
+
) {
|
1336 |
self::$errors_present = true;
|
1337 |
+
self::$error_text = esc_html__( 'Data for "Show Total Answers" is invalid', 'yop-poll' );
|
1338 |
}
|
1339 |
if (
|
1340 |
( false === self::$errors_present ) &&
|
1341 |
( !in_array( $poll->options->poll->startDateOption, self::$date_values_allowed ) )
|
1342 |
+
) {
|
1343 |
self::$errors_present = true;
|
1344 |
+
self::$error_text = esc_html__( 'Data for "Start Date" is invalid', 'yop-poll' );
|
1345 |
}
|
1346 |
if (
|
1347 |
( false === self::$errors_present ) &&
|
1350 |
( '' === sanitize_text_field( $poll->options->poll->startDateCustom ) ) )
|
1351 |
) {
|
1352 |
self::$errors_present = true;
|
1353 |
+
self::$error_text = esc_html__( 'Data for "Start Date" is invalid', 'yop-poll' );
|
1354 |
}
|
1355 |
if (
|
1356 |
( false === self::$errors_present ) &&
|
1357 |
( !in_array( $poll->options->poll->endDateOption, self::$date_values_allowed ) )
|
1358 |
+
) {
|
1359 |
self::$errors_present = true;
|
1360 |
+
self::$error_text = esc_html__( 'Data for "End Date" is invalid', 'yop-poll' );
|
1361 |
}
|
1362 |
if (
|
1363 |
( false === self::$errors_present ) &&
|
1366 |
( '' === sanitize_text_field( $poll->options->poll->endDateCustom ) ) )
|
1367 |
) {
|
1368 |
self::$errors_present = true;
|
1369 |
+
self::$error_text = esc_html__( 'Data for "End Date" is invalid', 'yop-poll' );
|
1370 |
}
|
1371 |
if (
|
1372 |
( false === self::$errors_present ) &&
|
1373 |
( !in_array( $poll->options->poll->redirectAfterVote, self::$yes_no_allowed ) )
|
1374 |
+
) {
|
1375 |
self::$errors_present = true;
|
1376 |
+
self::$error_text = esc_html__( 'Data for "Redirect after vote" is invalid', 'yop-poll' );
|
1377 |
}
|
1378 |
if (
|
1379 |
( false === self::$errors_present ) &&
|
1384 |
)
|
1385 |
) {
|
1386 |
self::$errors_present = true;
|
1387 |
+
self::$error_text = esc_html__( 'Data for "Redirect Url" is invalid', 'yop-poll' );
|
1388 |
}
|
1389 |
if (
|
1390 |
( false === self::$errors_present ) &&
|
1391 |
( !in_array( $poll->options->poll->resetPollStatsAutomatically, self::$yes_no_allowed ) )
|
1392 |
+
) {
|
1393 |
self::$errors_present = true;
|
1394 |
+
self::$error_text = esc_html__( 'Data for "Reset Poll Stats automatically" is invalid', 'yop-poll' );
|
1395 |
}
|
1396 |
if (
|
1397 |
( false === self::$errors_present ) &&
|
1398 |
( !in_array( $poll->options->poll->resetPollStatsEveryPeriod, self::$reset_stats_allowed ) )
|
1399 |
+
) {
|
1400 |
self::$errors_present = true;
|
1401 |
+
self::$error_text = esc_html__( 'Data for "Reset Every" is invalid', 'yop-poll' );
|
1402 |
}
|
1403 |
if (
|
1404 |
( false === self::$errors_present ) &&
|
1405 |
( !in_array( $poll->options->poll->autoGeneratePollPage, self::$yes_no_allowed ) )
|
1406 |
+
) {
|
1407 |
self::$errors_present = true;
|
1408 |
+
self::$error_text = esc_html__( 'Data for "Auto Generate Poll Page" is invalid', 'yop-poll' );
|
1409 |
}
|
1410 |
if (
|
1411 |
( false === self::$errors_present ) &&
|
1412 |
( !in_array( $poll->options->poll->useCaptcha, self::$captcha_allowed ) )
|
1413 |
+
) {
|
1414 |
self::$errors_present = true;
|
1415 |
+
self::$error_text = esc_html__( 'Data for "Use Captcha" is invalid', 'yop-poll' );
|
1416 |
}
|
1417 |
if (
|
1418 |
( false === self::$errors_present ) &&
|
1419 |
( !in_array( $poll->options->poll->sendEmailNotifications, self::$yes_no_allowed ) )
|
1420 |
+
) {
|
1421 |
self::$errors_present = true;
|
1422 |
+
self::$error_text = esc_html__( 'Data for "Send Email notifications" is invalid', 'yop-poll' );
|
1423 |
}
|
1424 |
if (
|
1425 |
( false === self::$errors_present ) &&
|
1428 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromName ) ) )
|
1429 |
) {
|
1430 |
self::$errors_present = true;
|
1431 |
+
self::$error_text = esc_html__( 'Data for "From Name" is invalid', 'yop-poll' );
|
1432 |
}
|
1433 |
if (
|
1434 |
( false === self::$errors_present ) &&
|
1437 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsFromEmail ) ) )
|
1438 |
) {
|
1439 |
self::$errors_present = true;
|
1440 |
+
self::$error_text = esc_html__( 'Data for "From Email" is invalid', 'yop-poll' );
|
1441 |
}
|
1442 |
if (
|
1443 |
( false === self::$errors_present ) &&
|
1446 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsRecipients ) ) )
|
1447 |
) {
|
1448 |
self::$errors_present = true;
|
1449 |
+
self::$error_text = esc_html__( 'Data for "Recipients" is invalid', 'yop-poll' );
|
1450 |
}
|
1451 |
if (
|
1452 |
( false === self::$errors_present ) &&
|
1455 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsSubject ) ) )
|
1456 |
) {
|
1457 |
self::$errors_present = true;
|
1458 |
+
self::$error_text = esc_html__( 'Data for "Subject" is invalid', 'yop-poll' );
|
1459 |
}
|
1460 |
if (
|
1461 |
( false === self::$errors_present ) &&
|
1464 |
( '' === sanitize_text_field( $poll->options->poll->emailNotificationsMessage ) ) )
|
1465 |
) {
|
1466 |
self::$errors_present = true;
|
1467 |
+
self::$error_text = esc_html__( 'Data for "Message" is invalid', 'yop-poll' );
|
1468 |
}
|
1469 |
/* POLL OPTIONS->RESULTS CHECK */
|
1470 |
if (
|
1471 |
( false === self::$errors_present ) &&
|
1472 |
( 0 < count( $poll->options->results->showResultsMoment ) ) &&
|
1473 |
( 0 === count( array_intersect( $poll->options->results->showResultsMoment, self::$show_results_allowed ) ) )
|
1474 |
+
) {
|
1475 |
self::$errors_present = true;
|
1476 |
+
self::$error_text = esc_html__( 'Data for "Show results" is invalid', 'yop-poll' );
|
1477 |
}
|
1478 |
if (
|
1479 |
( false === self::$errors_present ) &&
|
1482 |
( '' === sanitize_text_field( $poll->options->results->customDateResults ) ) )
|
1483 |
) {
|
1484 |
self::$errors_present = true;
|
1485 |
+
self::$error_text = esc_html__( 'Data for "Show Results" is invalid', 'yop-poll' );
|
1486 |
}
|
1487 |
if (
|
1488 |
( false === self::$errors_present ) &&
|
1489 |
+
( 0 < count( $poll->options->results->showResultsMoment ) ) && !in_array( 'never', $poll->options->results->showResultsMoment ) &&
|
1490 |
+
( ( 0 === count( $poll->options->results->showResultsTo ) ) ||
|
1491 |
( 0 === count( array_intersect( $poll->options->results->showResultsTo, self::$show_results_to_allowed ) ) ) )
|
1492 |
+
) {
|
1493 |
self::$errors_present = true;
|
1494 |
+
self::$error_text = esc_html__( 'Data for "Show results to" is invalid', 'yop-poll' );
|
1495 |
}
|
1496 |
if (
|
1497 |
( false === self::$errors_present ) &&
|
1498 |
( !in_array( $poll->options->results->backToVoteOption, self::$yes_no_allowed ) )
|
1499 |
+
) {
|
1500 |
self::$errors_present = true;
|
1501 |
+
self::$error_text = esc_html__( 'Data for "Display [Back to vote] link" is invalid', 'yop-poll' );
|
1502 |
}
|
1503 |
if (
|
1504 |
( false === self::$errors_present ) &&
|
1507 |
( '' === trim( $poll->options->results->backToVoteCaption ) ) ||
|
1508 |
( '' === sanitize_text_field( $poll->options->results->backToVoteCaption ) )
|
1509 |
)
|
1510 |
+
) {
|
1511 |
self::$errors_present = true;
|
1512 |
+
self::$error_text = esc_html__( 'Data for "[Back to vote] caption" is invalid', 'yop-poll' );
|
1513 |
}
|
1514 |
if (
|
1515 |
( false === self::$errors_present ) &&
|
1516 |
( !in_array( $poll->options->results->sortResults, self::$sort_results_allowed ) )
|
1517 |
+
) {
|
1518 |
self::$errors_present = true;
|
1519 |
+
self::$error_text = esc_html__( 'Data for "Sort Results" is invalid', 'yop-poll' );
|
1520 |
}
|
1521 |
if (
|
1522 |
( false === self::$errors_present ) &&
|
1524 |
( !in_array( $poll->options->results->sortResultsRule, self::$sort_results_rule_allowed ) )
|
1525 |
) {
|
1526 |
self::$errors_present = true;
|
1527 |
+
self::$error_text = esc_html__( 'Data for "Sort rule" is invalid', 'yop-poll' );
|
1528 |
}
|
1529 |
if (
|
1530 |
( false === self::$errors_present ) &&
|
1531 |
( !in_array( $poll->options->results->displayResultsAs, self::$display_results_as_allowed ) )
|
1532 |
) {
|
1533 |
self::$errors_present = true;
|
1534 |
+
self::$error_text = esc_html__( 'Data for "Display Results As"', 'yop-poll' );
|
1535 |
}
|
1536 |
if (
|
1537 |
( false === self::$errors_present ) &&
|
1539 |
( 0 === count( array_intersect( $poll->options->access->votePermissions, self::$vote_permissions_allowed ) ) ) )
|
1540 |
) {
|
1541 |
self::$errors_present = true;
|
1542 |
+
self::$error_text = esc_html__( 'Data for "Vote Permissions" is invalid', 'yop-poll' );
|
1543 |
}
|
1544 |
/*
|
1545 |
if (
|
1547 |
( !in_array( $poll->options->access->allowWordpressVotes, self::$yes_no_allowed ) )
|
1548 |
) {
|
1549 |
self::$errors_present = true;
|
1550 |
+
self::$error_text = esc_html__( 'Data for "Wordpress" is invalid', 'yop-poll' );
|
1551 |
}
|
1552 |
*/
|
1553 |
if (
|
1554 |
( false === self::$errors_present ) &&
|
1555 |
( count( $poll->options->access->blockVoters ) > 0 ) &&
|
1556 |
+
( 0 === count( array_intersect( $poll->options->access->blockVoters, self::$block_voters_allowed ) ) )
|
1557 |
) {
|
1558 |
self::$errors_present = true;
|
1559 |
+
self::$error_text = esc_html__( 'Data for "Block Voters" is invalid', 'yop-poll' );
|
1560 |
}
|
1561 |
if (
|
1562 |
( false === self::$errors_present ) &&
|
1568 |
( !in_array( $poll->options->access->blockForPeriod, self::$block_voters_period_allowed ) ) )
|
1569 |
) {
|
1570 |
self::$errors_present = true;
|
1571 |
+
self::$error_text = esc_html__( 'Data for "Block Period" is invalid', 'yop-poll' );
|
1572 |
}
|
1573 |
if (
|
1574 |
( false === self::$errors_present ) &&
|
1575 |
( !in_array( $poll->options->access->limitVotesPerUser, self::$yes_no_allowed ) )
|
1576 |
) {
|
1577 |
self::$errors_present = true;
|
1578 |
+
self::$error_text = esc_html__( 'Data for "Limit Number Of Votes per User" is invalid', 'yop-poll' );
|
1579 |
}
|
1580 |
if (
|
1581 |
( false === self::$errors_present ) &&
|
1583 |
( 0 === intval( $poll->options->access->votesPerUserAllowed ) )
|
1584 |
) {
|
1585 |
self::$errors_present = true;
|
1586 |
+
self::$error_text = esc_html__( 'Data for "Votes per user" is invalid', 'yop-poll' );
|
1587 |
}
|
1588 |
}
|
1589 |
}
|
1610 |
}
|
1611 |
}
|
1612 |
public static function ends_soon( $poll ) {
|
1613 |
+
$ends_soon_date = date( 'Y-m-d H:i:s', strtotime( current_time( 'mysql' ) . ' + ' . self::$ends_soon_interval . ' days' ) );
|
1614 |
$poll_meta_data = unserialize( $poll['meta_data'] );
|
1615 |
if ( 'custom' === $poll_meta_data['options']['poll']['endDateOption'] ) {
|
1616 |
$end_date = date( 'Y-m-d H:i:s', strtotime( $poll_meta_data['options']['poll']['endDateCustom'] ) );
|
1638 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` != 'deleted'", $poll_id
|
1639 |
);
|
1640 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1641 |
+
if ( null !== $poll ) {
|
1642 |
$poll_meta_data = unserialize( $poll->meta_data );
|
1643 |
$poll->meta_data = array(
|
1644 |
'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
|
1665 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
|
1666 |
);
|
1667 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1668 |
+
if ( null !== $poll ) {
|
1669 |
$poll_meta_data = unserialize( $poll->meta_data );
|
1670 |
$poll->meta_data = array(
|
1671 |
'style' => self::convert_meta_data_for_style( $poll_meta_data['style'] ),
|
1672 |
'options' => $poll_meta_data['options']
|
1673 |
);
|
1674 |
$poll_elements = YOP_Poll_Elements::get_all_for_poll( $poll_id );
|
1675 |
+
foreach ( $poll_elements as $poll_element ) {
|
1676 |
if ( true === isset( $poll_element->meta_data['answersSort'] ) ) {
|
1677 |
+
switch ( $poll_element->meta_data['answersSort'] ) {
|
1678 |
case 'as-defined': {
|
1679 |
$sub_elements_order_by = 'sorder';
|
1680 |
$sub_elements_order_rule = 'ASC';
|
1718 |
"SELECT * FROM {$GLOBALS['wpdb']->yop_poll_polls} WHERE `id` = %s AND `status` !='deleted'", $poll_id
|
1719 |
);
|
1720 |
$poll = $GLOBALS['wpdb']->get_row( $query, OBJECT );
|
1721 |
+
if ( null !== $poll ) {
|
1722 |
$poll->meta_data = unserialize( $poll->meta_data );
|
1723 |
switch ( $poll->meta_data['options']['results']['sortResults'] ) {
|
1724 |
case 'as-defined': {
|
1764 |
$poll_element->answers[] = $poll_sub_element;
|
1765 |
}
|
1766 |
}
|
1767 |
+
if (
|
1768 |
+
( true === isset( $poll_element->meta_data['displayOtherAnswersInResults'] ) ) &&
|
1769 |
( 'yes' === $poll_element->meta_data['displayOtherAnswersInResults'] ) &&
|
1770 |
( 'no' === $poll_element->meta_data['addOtherAnswers'] )
|
1771 |
) {
|
1772 |
$element_other_answers = YOP_Poll_Other_Answers::get_for_element( $poll_element->id );
|
1773 |
if ( count( $element_other_answers ) > 0 ) {
|
1774 |
$i = 1;
|
1775 |
+
foreach ( $element_other_answers as $other_answer ) {
|
1776 |
+
$poll_element->answers[] = (object) array(
|
1777 |
'id' => 0,
|
1778 |
'poll_id' => $poll_id,
|
1779 |
'element_id' => $poll_element->id,
|
1851 |
/*END POLL*/
|
1852 |
/*BEGIN QUESTIONS*/
|
1853 |
if ( true === in_array( $meta_data_for_style['questions']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1854 |
+
switch ( $meta_data_for_style['questions']['textSize'] ) {
|
1855 |
case 'small': {
|
1856 |
$meta_data_for_style['questions']['textSize'] = '14';
|
1857 |
break;
|
1881 |
$meta_data_for_style['answers']['paddingTopBottom'] = $meta_data_for_style['answers']['padding'];
|
1882 |
}
|
1883 |
if ( true === in_array( $meta_data_for_style['answers']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1884 |
+
switch ( $meta_data_for_style['answers']['textSize'] ) {
|
1885 |
case 'small': {
|
1886 |
$meta_data_for_style['answers']['textSize'] = '14';
|
1887 |
break;
|
1908 |
$meta_data_for_style['buttons']['paddingTopBottom'] = '5';
|
1909 |
}
|
1910 |
if ( true === in_array( $meta_data_for_style['buttons']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1911 |
+
switch ( $meta_data_for_style['buttons']['textSize'] ) {
|
1912 |
case 'small': {
|
1913 |
$meta_data_for_style['buttons']['textSize'] = '14';
|
1914 |
break;
|
1941 |
$meta_data_for_style['errors']['paddingTopBottom'] = $meta_data_for_style['errors']['padding'];
|
1942 |
}
|
1943 |
if ( true === in_array( $meta_data_for_style['errors']['textSize'], array( 'small', 'medium', 'large' ) ) ) {
|
1944 |
+
switch ( $meta_data_for_style['errors']['textSize'] ) {
|
1945 |
case 'small': {
|
1946 |
$meta_data_for_style['errors']['textSize'] = '14';
|
1947 |
break;
|
1987 |
public static function has_started_frontend( $poll ) {
|
1988 |
$today = date( 'Y-m-d H:i:s', strtotime( current_time( 'mysql' ) ) );
|
1989 |
if ( 'custom' === $poll->meta_data['options']['poll']['startDateOption'] ) {
|
1990 |
+
$start_date = date( 'Y-m-d H:i:s', strtotime( $poll->meta_data['options']['poll']['startDateCustom'] ) );
|
1991 |
+
if ( $start_date ) {
|
1992 |
+
if ( $today < $start_date ) {
|
1993 |
return false;
|
1994 |
} else {
|
1995 |
return true;
|
2051 |
$results[$i]['sorder'] = $answer->sorder;
|
2052 |
$results[$i]['votes'] = $answer->total_submits;
|
2053 |
if ( 0 < intval( $poll->total_submits ) ) {
|
2054 |
+
if ( 0 === ( 100 * $answer->total_submits % $poll->total_submits ) ) {
|
2055 |
$results[$i]['percentage'] = number_format( $answer->total_submits / $poll->total_submits * 100, 0 );
|
2056 |
} else {
|
2057 |
$results[$i]['percentage'] = number_format( $answer->total_submits / $poll->total_submits * 100, 2 );
|
2078 |
$order_by['votes'][$key] = $row['votes'];
|
2079 |
$order_by['percentage'][$key] = $row['percentage'];
|
2080 |
}
|
2081 |
+
if ( 0 < count( $results ) ) {
|
2082 |
array_multisort( $order_by[$sort_params['order_by']], $sort_params['sort_order'], $results );
|
2083 |
}
|
2084 |
return $results;
|
2086 |
public static function add_vote( $poll_id, $total_submited_answers ) {
|
2087 |
$query = $GLOBALS['wpdb']->prepare(
|
2088 |
"UPDATE {$GLOBALS['wpdb']->yop_poll_polls} SET `total_submits` = `total_submits` + 1, "
|
2089 |
+
. '`total_submited_answers` = `total_submited_answers` + %d WHERE `id` = %s',
|
2090 |
+
$poll_id,
|
2091 |
+
$total_submited_answers
|
2092 |
);
|
2093 |
$GLOBALS['wpdb']->query( $query );
|
2094 |
}
|
2207 |
$search_field = '';
|
2208 |
$total_votes_for_user = '';
|
2209 |
$accept_votes_from_user = true;
|
2210 |
+
switch ( $user_type ) {
|
2211 |
case 'wordpress': {
|
2212 |
+
$search_field = 'user_id';
|
2213 |
break;
|
2214 |
}
|
2215 |
case 'facebook': {
|
2363 |
$elements_votes[$i] = 0;
|
2364 |
foreach ( $element_data->answers as $answer_data ) {
|
2365 |
if ( intval( $answer_data->id ) > 0 ) {
|
2366 |
+
$elements_votes[$i] += intval( $answer_data->votes );
|
2367 |
}
|
2368 |
}
|
2369 |
$i++;
|
2377 |
$votes[$i]->trackingId = '';
|
2378 |
$votes[$i]->data = array();
|
2379 |
$j = 0;
|
2380 |
+
foreach ( $elements_data as $element_data ) {
|
2381 |
if ( intval( $element_data->id ) > 0 ) {
|
2382 |
$votes[$i]->data[$j] = new stdClass();
|
2383 |
$votes[$i]->data[$j]->type = 'question';
|
2404 |
$result['success'] = true;
|
2405 |
} else {
|
2406 |
$result['success'] = false;
|
2407 |
+
$result['error'] = esc_html__( 'Number of votes for each question should be the same', 'yop-poll' );
|
2408 |
}
|
2409 |
} else {
|
2410 |
$result['success'] = false;
|
2411 |
+
$result['error'] = esc_html__( 'Invalid Poll', 'yop-poll' );
|
2412 |
}
|
2413 |
return $result;
|
2414 |
}
|
2415 |
public static function has_other_answers( $poll ) {
|
2416 |
if ( true === isset( $poll->elements ) ) {
|
2417 |
+
foreach ( $poll->elements as $element ) {
|
2418 |
+
if (
|
2419 |
( true === in_array( $element->etype, array( 'text-question', 'media-question' ) ) ) &&
|
2420 |
( 'yes' === $element->meta_data['allowOtherAnswers'] )
|
2421 |
) {
|
2428 |
}
|
2429 |
public static function get_all_polls_for_archive( $params, $order_by ) {
|
2430 |
if ( 0 !== $params['max'] ) {
|
2431 |
+
$limit = 'LIMIT %d';
|
2432 |
$query = "SELECT `id` FROM `{$GLOBALS['wpdb']->yop_poll_polls}` WHERE `status` != 'deleted' {$order_by} LIMIT %d";
|
2433 |
+
$query_ready = $GLOBALS['wpdb']->prepare(
|
2434 |
$query,
|
2435 |
$params['max']
|
2436 |
);
|
2444 |
$polls_for_display = array();
|
2445 |
$nr_added = 0;
|
2446 |
$query_ready = "SELECT `id`, `meta_data` FROM `{$GLOBALS['wpdb']->yop_poll_polls}` WHERE `status` != 'deleted' {$order_by}";
|
2447 |
+
$polls = $GLOBALS['wpdb']->get_results( $query_ready, OBJECT );
|
2448 |
foreach ( $polls as $poll ) {
|
2449 |
+
$poll->meta_data = unserialize( $poll->meta_data );
|
2450 |
+
if (
|
2451 |
+
( true === YOP_Poll_Polls::has_started_frontend( $poll ) ) &&
|
2452 |
+
( false === YOP_Poll_Polls::has_ended_frontend( $poll ) )
|
2453 |
+
) {
|
2454 |
if ( 0 === $params['max'] ) {
|
2455 |
+
$polls_for_display[]['id'] = $poll->id;
|
2456 |
} else {
|
2457 |
if ( $nr_added < $params['max'] ) {
|
2458 |
+
$polls_for_display[]['id'] = $poll->id;
|
2459 |
$nr_added++;
|
2460 |
}
|
2461 |
}
|
admin/models/settings.php
CHANGED
@@ -74,7 +74,12 @@ class YOP_Poll_Settings {
|
|
74 |
'enabled' => 'no',
|
75 |
'app-id' => '',
|
76 |
'app-secret' => ''
|
77 |
-
)
|
|
|
|
|
|
|
|
|
|
|
78 |
),
|
79 |
'messages' => array(
|
80 |
'captcha' => array(
|
@@ -277,12 +282,12 @@ class YOP_Poll_Settings {
|
|
277 |
)
|
278 |
)
|
279 |
);
|
280 |
-
update_option('yop_poll_settings', serialize( $new_settings ) );
|
281 |
}
|
282 |
public static function update_settings_to_version_6_1_7() {
|
283 |
$current_settings = unserialize( self::get_all_settings() );
|
284 |
$current_settings['general']['remove-data'] = 'no';
|
285 |
-
$current_settings['notifications'] =array(
|
286 |
'new-vote' => array(
|
287 |
'from-name' => isset( $current_settings['email']['from-name'] ) ? sanitize_text_field( $current_settings['email']['from-name'] ) : 'Your Name Here',
|
288 |
'from-email' => isset( $current_settings['email']['from-email'] ) ? sanitize_text_field( $current_settings['email']['from-email'] ) : 'Your Email Address Here',
|
@@ -364,13 +369,13 @@ class YOP_Poll_Settings {
|
|
364 |
}
|
365 |
return $show_guide;
|
366 |
}
|
367 |
-
public static function update_show_guide( $show_guide
|
368 |
$settings = self::get_all_settings();
|
369 |
if ( '' !== $settings ) {
|
370 |
$unserialized_settings = unserialize( $settings );
|
371 |
$unserialized_settings['general']['show-guide'] = $show_guide;
|
372 |
$serialized_settings = serialize( $unserialized_settings );
|
373 |
-
update_option('yop_poll_settings', $serialized_settings
|
374 |
self::$settings = $serialized_settings;
|
375 |
}
|
376 |
}
|
@@ -379,7 +384,7 @@ class YOP_Poll_Settings {
|
|
379 |
$settings = self::get_all_settings();
|
380 |
if ( '' !== $settings ) {
|
381 |
$unserialized_settings = unserialize( $settings );
|
382 |
-
$email_settings = $unserialized_settings['notifications'];
|
383 |
}
|
384 |
return $email_settings;
|
385 |
}
|
@@ -405,6 +410,11 @@ class YOP_Poll_Settings {
|
|
405 |
'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] : '',
|
406 |
'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'] : ''
|
407 |
),
|
|
|
|
|
|
|
|
|
|
|
408 |
'facebook' => array(
|
409 |
'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['enabled'] ) ) ? $unserialized_settings['integrations']['facebook']['enabled'] : '',
|
410 |
'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['app-id'] ) ) ? $unserialized_settings['integrations']['facebook']['app-id'] : ''
|
@@ -439,7 +449,7 @@ class YOP_Poll_Settings {
|
|
439 |
public static function validate_data( $settings ) {
|
440 |
if ( false === is_object( $settings ) ) {
|
441 |
self::$errors_present = true;
|
442 |
-
self::$error_text =
|
443 |
} else {
|
444 |
/*
|
445 |
if (
|
@@ -448,7 +458,7 @@ class YOP_Poll_Settings {
|
|
448 |
( '' === trim( $settings->email->{'from-name'} ) ) )
|
449 |
) {
|
450 |
self::$errors_present = true;
|
451 |
-
self::$error_text =
|
452 |
}
|
453 |
if (
|
454 |
( false === self::$errors_present ) &&
|
@@ -456,7 +466,7 @@ class YOP_Poll_Settings {
|
|
456 |
( '' === trim( $settings->email->{'from-email'} ) ) )
|
457 |
) {
|
458 |
self::$errors_present = true;
|
459 |
-
self::$error_text =
|
460 |
}
|
461 |
if (
|
462 |
( false === self::$errors_present ) &&
|
@@ -464,7 +474,7 @@ class YOP_Poll_Settings {
|
|
464 |
( '' === trim( $settings->email->{'recipients'} ) ) )
|
465 |
) {
|
466 |
self::$errors_present = true;
|
467 |
-
self::$error_text =
|
468 |
}
|
469 |
if (
|
470 |
( false === self::$errors_present ) &&
|
@@ -472,7 +482,7 @@ class YOP_Poll_Settings {
|
|
472 |
( '' === trim( $settings->email->{'subject'} ) ) )
|
473 |
) {
|
474 |
self::$errors_present = true;
|
475 |
-
self::$error_text =
|
476 |
}
|
477 |
if (
|
478 |
( false === self::$errors_present ) &&
|
@@ -480,7 +490,7 @@ class YOP_Poll_Settings {
|
|
480 |
( '' === trim( $settings->email->{'message'} ) ) )
|
481 |
) {
|
482 |
self::$errors_present = true;
|
483 |
-
self::$error_text =
|
484 |
}
|
485 |
*/
|
486 |
if (
|
@@ -489,54 +499,64 @@ class YOP_Poll_Settings {
|
|
489 |
( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ) ) )
|
490 |
) {
|
491 |
self::$errors_present = true;
|
492 |
-
self::$error_text =
|
493 |
}
|
494 |
if ( 'yes' === $settings->integrations->reCaptcha->{'enabled'} ) {
|
495 |
if ( ( false === isset( $settings->integrations->reCaptcha->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'site-key'} ) ) ) {
|
496 |
self::$errors_present = true;
|
497 |
-
self::$error_text =
|
498 |
}
|
499 |
if ( ( false === isset( $settings->integrations->reCaptcha->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'secret-key'} ) ) ) {
|
500 |
self::$errors_present = true;
|
501 |
-
self::$error_text =
|
502 |
}
|
503 |
}
|
504 |
if ( 'yes' === $settings->integrations->reCaptchaV2Invisible->{'enabled'} ) {
|
505 |
if ( ( false === isset( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ) ) ) {
|
506 |
self::$errors_present = true;
|
507 |
-
self::$error_text =
|
508 |
}
|
509 |
if ( ( false === isset( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} ) ) ) {
|
510 |
self::$errors_present = true;
|
511 |
-
self::$error_text =
|
512 |
}
|
513 |
}
|
514 |
if ( 'yes' === $settings->integrations->reCaptchaV3->{'enabled'} ) {
|
515 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'site-key'} ) ) ) {
|
516 |
self::$errors_present = true;
|
517 |
-
self::$error_text =
|
518 |
}
|
519 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ) ) ) {
|
520 |
self::$errors_present = true;
|
521 |
-
self::$error_text =
|
522 |
}
|
523 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'min-allowed-score'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} ) ) ) {
|
524 |
self::$errors_present = true;
|
525 |
-
self::$error_text =
|
526 |
}
|
527 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
if (
|
529 |
( false === self::$errors_present ) &&
|
530 |
( !isset( $settings->integrations->facebook->{'enabled'} ) ||
|
531 |
( '' === sanitize_text_field( $settings->integrations->facebook->{'enabled'} ) ) )
|
532 |
) {
|
533 |
self::$errors_present = true;
|
534 |
-
self::$error_text =
|
535 |
}
|
536 |
if ( 'yes' === $settings->integrations->facebook->{'enabled'} ) {
|
537 |
if ( ( false === isset( $settings->integrations->facebook->{'app-id'} ) ) || ( '' === sanitize_text_field( $settings->integrations->facebook->{'app-id'} ) ) ) {
|
538 |
self::$errors_present = true;
|
539 |
-
self::$error_text =
|
540 |
}
|
541 |
}
|
542 |
if (
|
@@ -545,16 +565,16 @@ class YOP_Poll_Settings {
|
|
545 |
( '' === trim( $settings->integrations->google->{'enabled'} ) ) )
|
546 |
) {
|
547 |
self::$errors_present = true;
|
548 |
-
self::$error_text =
|
549 |
}
|
550 |
if ( 'yes' === $settings->integrations->google->enabled ) {
|
551 |
if ( ( false === isset( $settings->integrations->google->{'app-id'} ) ) || ( '' === sanitize_text_field( $settings->integrations->google->{'app-id'} ) ) ) {
|
552 |
self::$errors_present = true;
|
553 |
-
self::$error_text =
|
554 |
}
|
555 |
if ( ( false === isset( $settings->integrations->google->{'app-secret'} ) ) || ( '' === sanitize_text_field( $settings->integrations->google->{'app-secret'} ) ) ) {
|
556 |
self::$errors_present = true;
|
557 |
-
self::$error_text =
|
558 |
}
|
559 |
}
|
560 |
if (
|
@@ -563,7 +583,7 @@ class YOP_Poll_Settings {
|
|
563 |
( '' === sanitize_text_field( $settings->messages->buttons->{'anonymous'} ) ) )
|
564 |
) {
|
565 |
self::$errors_present = true;
|
566 |
-
self::$error_text =
|
567 |
}
|
568 |
if (
|
569 |
( false === self::$errors_present ) &&
|
@@ -571,7 +591,7 @@ class YOP_Poll_Settings {
|
|
571 |
( '' === sanitize_text_field( $settings->messages->buttons->{'wordpress'} ) ) )
|
572 |
) {
|
573 |
self::$errors_present = true;
|
574 |
-
self::$error_text =
|
575 |
}
|
576 |
if (
|
577 |
( false === self::$errors_present ) &&
|
@@ -579,7 +599,7 @@ class YOP_Poll_Settings {
|
|
579 |
( '' === sanitize_text_field( $settings->messages->buttons->{'facebook'} ) ) )
|
580 |
) {
|
581 |
self::$errors_present = true;
|
582 |
-
self::$error_text =
|
583 |
}
|
584 |
if (
|
585 |
( false === self::$errors_present ) &&
|
@@ -587,7 +607,7 @@ class YOP_Poll_Settings {
|
|
587 |
( '' === sanitize_text_field( $settings->messages->buttons->{'google'} ) ) )
|
588 |
) {
|
589 |
self::$errors_present = true;
|
590 |
-
self::$error_text =
|
591 |
}
|
592 |
if (
|
593 |
( false === self::$errors_present ) &&
|
@@ -595,7 +615,7 @@ class YOP_Poll_Settings {
|
|
595 |
( '' === sanitize_text_field( $settings->messages->voting->{'poll-ended'} ) ) )
|
596 |
) {
|
597 |
self::$errors_present = true;
|
598 |
-
self::$error_text =
|
599 |
}
|
600 |
if (
|
601 |
( false === self::$errors_present ) &&
|
@@ -603,7 +623,7 @@ class YOP_Poll_Settings {
|
|
603 |
( '' === sanitize_text_field( $settings->messages->voting->{'poll-not-started'} ) ) )
|
604 |
) {
|
605 |
self::$errors_present = true;
|
606 |
-
self::$error_text =
|
607 |
}
|
608 |
if (
|
609 |
( false === self::$errors_present ) &&
|
@@ -611,7 +631,7 @@ class YOP_Poll_Settings {
|
|
611 |
( '' === sanitize_text_field( $settings->messages->voting->{'already-voted-on-poll'} ) ) )
|
612 |
) {
|
613 |
self::$errors_present = true;
|
614 |
-
self::$error_text =
|
615 |
}
|
616 |
if (
|
617 |
( false === self::$errors_present ) &&
|
@@ -619,7 +639,7 @@ class YOP_Poll_Settings {
|
|
619 |
( '' === sanitize_text_field( $settings->messages->voting->{'invalid-poll'} ) ) )
|
620 |
) {
|
621 |
self::$errors_present = true;
|
622 |
-
self::$error_text =
|
623 |
}
|
624 |
if (
|
625 |
( false === self::$errors_present ) &&
|
@@ -627,7 +647,7 @@ class YOP_Poll_Settings {
|
|
627 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-answers-selected'} ) ) )
|
628 |
) {
|
629 |
self::$errors_present = true;
|
630 |
-
self::$error_text =
|
631 |
}
|
632 |
if (
|
633 |
( false === self::$errors_present ) &&
|
@@ -635,7 +655,7 @@ class YOP_Poll_Settings {
|
|
635 |
( '' === sanitize_text_field( $settings->messages->voting->{'min-answers-required'} ) ) )
|
636 |
) {
|
637 |
self::$errors_present = true;
|
638 |
-
self::$error_text =
|
639 |
}
|
640 |
if (
|
641 |
( false === self::$errors_present ) &&
|
@@ -643,7 +663,7 @@ class YOP_Poll_Settings {
|
|
643 |
( '' === sanitize_text_field( $settings->messages->voting->{'max-answers-required'} ) ) )
|
644 |
) {
|
645 |
self::$errors_present = true;
|
646 |
-
self::$error_text =
|
647 |
}
|
648 |
if (
|
649 |
( false === self::$errors_present ) &&
|
@@ -651,7 +671,7 @@ class YOP_Poll_Settings {
|
|
651 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-answer-for-other'} ) ) )
|
652 |
) {
|
653 |
self::$errors_present = true;
|
654 |
-
self::$error_text =
|
655 |
}
|
656 |
if (
|
657 |
( false === self::$errors_present ) &&
|
@@ -659,7 +679,7 @@ class YOP_Poll_Settings {
|
|
659 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-value-for-custom-field'} ) ) )
|
660 |
) {
|
661 |
self::$errors_present = true;
|
662 |
-
self::$error_text =
|
663 |
}
|
664 |
if (
|
665 |
( false === self::$errors_present ) &&
|
@@ -667,7 +687,7 @@ class YOP_Poll_Settings {
|
|
667 |
( '' === sanitize_text_field( $settings->messages->voting->{'consent-not-checked'} ) ) )
|
668 |
) {
|
669 |
self::$errors_present = true;
|
670 |
-
self::$error_text =
|
671 |
}
|
672 |
if (
|
673 |
( false === self::$errors_present ) &&
|
@@ -675,7 +695,7 @@ class YOP_Poll_Settings {
|
|
675 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-captcha-selected'} ) ) )
|
676 |
) {
|
677 |
self::$errors_present = true;
|
678 |
-
self::$error_text =
|
679 |
}
|
680 |
if (
|
681 |
( false === self::$errors_present ) &&
|
@@ -683,7 +703,7 @@ class YOP_Poll_Settings {
|
|
683 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ) ) )
|
684 |
) {
|
685 |
self::$errors_present = true;
|
686 |
-
self::$error_text =
|
687 |
}
|
688 |
if (
|
689 |
( false === self::$errors_present ) &&
|
@@ -691,7 +711,7 @@ class YOP_Poll_Settings {
|
|
691 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ) ) )
|
692 |
) {
|
693 |
self::$errors_present = true;
|
694 |
-
self::$error_text =
|
695 |
}
|
696 |
if (
|
697 |
( false === self::$errors_present ) &&
|
@@ -699,7 +719,7 @@ class YOP_Poll_Settings {
|
|
699 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ) ) )
|
700 |
) {
|
701 |
self::$errors_present = true;
|
702 |
-
self::$error_text =
|
703 |
}
|
704 |
if (
|
705 |
( false === self::$errors_present ) &&
|
@@ -707,7 +727,7 @@ class YOP_Poll_Settings {
|
|
707 |
( '' === sanitize_text_field( $settings->messages->voting->{'thank-you'} ) ) )
|
708 |
) {
|
709 |
self::$errors_present = true;
|
710 |
-
self::$error_text =
|
711 |
}
|
712 |
if (
|
713 |
( false === self::$errors_present ) &&
|
@@ -715,7 +735,7 @@ class YOP_Poll_Settings {
|
|
715 |
( '' === sanitize_text_field( $settings->messages->results->{'single-vote'} ) ) )
|
716 |
) {
|
717 |
self::$errors_present = true;
|
718 |
-
self::$error_text =
|
719 |
}
|
720 |
if (
|
721 |
( false === self::$errors_present ) &&
|
@@ -723,7 +743,7 @@ class YOP_Poll_Settings {
|
|
723 |
( '' === sanitize_text_field( $settings->messages->results->{'multiple-votes'} ) ) )
|
724 |
) {
|
725 |
self::$errors_present = true;
|
726 |
-
self::$error_text =
|
727 |
}
|
728 |
if (
|
729 |
( false === self::$errors_present ) &&
|
@@ -731,7 +751,7 @@ class YOP_Poll_Settings {
|
|
731 |
( '' === sanitize_text_field( $settings->messages->results->{'single-answer'} ) ) )
|
732 |
) {
|
733 |
self::$errors_present = true;
|
734 |
-
self::$error_text =
|
735 |
}
|
736 |
if (
|
737 |
( false === self::$errors_present ) &&
|
@@ -739,7 +759,7 @@ class YOP_Poll_Settings {
|
|
739 |
( '' === sanitize_text_field( $settings->messages->results->{'multiple-answers'} ) ) )
|
740 |
) {
|
741 |
self::$errors_present = true;
|
742 |
-
self::$error_text =
|
743 |
}
|
744 |
if (
|
745 |
( false === self::$errors_present ) &&
|
@@ -747,7 +767,7 @@ class YOP_Poll_Settings {
|
|
747 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-alt'} ) ) )
|
748 |
) {
|
749 |
self::$errors_present = true;
|
750 |
-
self::$error_text =
|
751 |
}
|
752 |
if (
|
753 |
( false === self::$errors_present ) &&
|
@@ -755,7 +775,7 @@ class YOP_Poll_Settings {
|
|
755 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-title'} ) ) )
|
756 |
) {
|
757 |
self::$errors_present = true;
|
758 |
-
self::$error_text =
|
759 |
}
|
760 |
if (
|
761 |
( false === self::$errors_present ) &&
|
@@ -763,7 +783,7 @@ class YOP_Poll_Settings {
|
|
763 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-description'} ) ) )
|
764 |
) {
|
765 |
self::$errors_present = true;
|
766 |
-
self::$error_text =
|
767 |
}
|
768 |
if (
|
769 |
( false === self::$errors_present ) &&
|
@@ -771,7 +791,7 @@ class YOP_Poll_Settings {
|
|
771 |
( '' === sanitize_text_field( $settings->messages->captcha->{'explanation'} ) ) )
|
772 |
) {
|
773 |
self::$errors_present = true;
|
774 |
-
self::$error_text =
|
775 |
}
|
776 |
if (
|
777 |
( false === self::$errors_present ) &&
|
@@ -779,7 +799,7 @@ class YOP_Poll_Settings {
|
|
779 |
( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ) ) )
|
780 |
) {
|
781 |
self::$errors_present = true;
|
782 |
-
self::$error_text =
|
783 |
}
|
784 |
if (
|
785 |
( false === self::$errors_present ) &&
|
@@ -787,7 +807,7 @@ class YOP_Poll_Settings {
|
|
787 |
( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ) ) )
|
788 |
) {
|
789 |
self::$errors_present = true;
|
790 |
-
self::$error_text =
|
791 |
}
|
792 |
}
|
793 |
}
|
@@ -850,6 +870,11 @@ class YOP_Poll_Settings {
|
|
850 |
'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ),
|
851 |
'min-allowed-score' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} )
|
852 |
),
|
|
|
|
|
|
|
|
|
|
|
853 |
'facebook' => array(
|
854 |
'enabled' => sanitize_text_field( $settings->integrations->facebook->{'enabled'} ),
|
855 |
'app-id' => sanitize_text_field( $settings->integrations->facebook->{'app-id'} ),
|
@@ -869,7 +894,7 @@ class YOP_Poll_Settings {
|
|
869 |
'refresh-alt' => sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ),
|
870 |
'refresh-title' => sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ),
|
871 |
),
|
872 |
-
'buttons'=> array(
|
873 |
'anonymous' => sanitize_text_field( $settings->messages->buttons->{'anonymous'} ),
|
874 |
'wordpress' => sanitize_text_field( $settings->messages->buttons->{'wordpress'} ),
|
875 |
'facebook' => sanitize_text_field( $settings->messages->buttons->{'facebook'} ),
|
74 |
'enabled' => 'no',
|
75 |
'app-id' => '',
|
76 |
'app-secret' => ''
|
77 |
+
),
|
78 |
+
'hCaptcha' => array(
|
79 |
+
'enabled' => 'no',
|
80 |
+
'site-key' => '',
|
81 |
+
'secret-key' => ''
|
82 |
+
),
|
83 |
),
|
84 |
'messages' => array(
|
85 |
'captcha' => array(
|
282 |
)
|
283 |
)
|
284 |
);
|
285 |
+
update_option( 'yop_poll_settings', serialize( $new_settings ) );
|
286 |
}
|
287 |
public static function update_settings_to_version_6_1_7() {
|
288 |
$current_settings = unserialize( self::get_all_settings() );
|
289 |
$current_settings['general']['remove-data'] = 'no';
|
290 |
+
$current_settings['notifications'] = array(
|
291 |
'new-vote' => array(
|
292 |
'from-name' => isset( $current_settings['email']['from-name'] ) ? sanitize_text_field( $current_settings['email']['from-name'] ) : 'Your Name Here',
|
293 |
'from-email' => isset( $current_settings['email']['from-email'] ) ? sanitize_text_field( $current_settings['email']['from-email'] ) : 'Your Email Address Here',
|
369 |
}
|
370 |
return $show_guide;
|
371 |
}
|
372 |
+
public static function update_show_guide( $show_guide ) {
|
373 |
$settings = self::get_all_settings();
|
374 |
if ( '' !== $settings ) {
|
375 |
$unserialized_settings = unserialize( $settings );
|
376 |
$unserialized_settings['general']['show-guide'] = $show_guide;
|
377 |
$serialized_settings = serialize( $unserialized_settings );
|
378 |
+
update_option( 'yop_poll_settings', $serialized_settings );
|
379 |
self::$settings = $serialized_settings;
|
380 |
}
|
381 |
}
|
384 |
$settings = self::get_all_settings();
|
385 |
if ( '' !== $settings ) {
|
386 |
$unserialized_settings = unserialize( $settings );
|
387 |
+
$email_settings = isset( $unserialized_settings['notifications'] ) ? $unserialized_settings['notifications'] : array();
|
388 |
}
|
389 |
return $email_settings;
|
390 |
}
|
410 |
'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3'] ) && isset( $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] ) ) ? $unserialized_settings['integrations']['reCaptchaV3']['secret-key'] : '',
|
411 |
'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'] : ''
|
412 |
),
|
413 |
+
'hCaptcha' => array(
|
414 |
+
'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['enabled'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['enabled'] : '',
|
415 |
+
'site-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['site-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['site-key'] : '',
|
416 |
+
'secret-key' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['hCaptcha'] ) && isset( $unserialized_settings['integrations']['hCaptcha']['secret-key'] ) ) ? $unserialized_settings['integrations']['hCaptcha']['secret-key'] : ''
|
417 |
+
),
|
418 |
'facebook' => array(
|
419 |
'enabled' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['enabled'] ) ) ? $unserialized_settings['integrations']['facebook']['enabled'] : '',
|
420 |
'app-id' => ( isset( $unserialized_settings['integrations'] ) && isset( $unserialized_settings['integrations']['facebook'] ) && isset( $unserialized_settings['integrations']['facebook']['app-id'] ) ) ? $unserialized_settings['integrations']['facebook']['app-id'] : ''
|
449 |
public static function validate_data( $settings ) {
|
450 |
if ( false === is_object( $settings ) ) {
|
451 |
self::$errors_present = true;
|
452 |
+
self::$error_text = esc_html__( 'Invalid data', 'yop-poll' );
|
453 |
} else {
|
454 |
/*
|
455 |
if (
|
458 |
( '' === trim( $settings->email->{'from-name'} ) ) )
|
459 |
) {
|
460 |
self::$errors_present = true;
|
461 |
+
self::$error_text = esc_html__( 'Data for "From Name" is invalid', 'yop-poll' );
|
462 |
}
|
463 |
if (
|
464 |
( false === self::$errors_present ) &&
|
466 |
( '' === trim( $settings->email->{'from-email'} ) ) )
|
467 |
) {
|
468 |
self::$errors_present = true;
|
469 |
+
self::$error_text = esc_html__( 'Data for "From Email" is invalid', 'yop-poll' );
|
470 |
}
|
471 |
if (
|
472 |
( false === self::$errors_present ) &&
|
474 |
( '' === trim( $settings->email->{'recipients'} ) ) )
|
475 |
) {
|
476 |
self::$errors_present = true;
|
477 |
+
self::$error_text = esc_html__( 'Data for "Recipients" is invalid', 'yop-poll' );
|
478 |
}
|
479 |
if (
|
480 |
( false === self::$errors_present ) &&
|
482 |
( '' === trim( $settings->email->{'subject'} ) ) )
|
483 |
) {
|
484 |
self::$errors_present = true;
|
485 |
+
self::$error_text = esc_html__( 'Data for "Subject" is invalid', 'yop-poll' );
|
486 |
}
|
487 |
if (
|
488 |
( false === self::$errors_present ) &&
|
490 |
( '' === trim( $settings->email->{'message'} ) ) )
|
491 |
) {
|
492 |
self::$errors_present = true;
|
493 |
+
self::$error_text = esc_html__( 'Data for "Message" is invalid', 'yop-poll' );
|
494 |
}
|
495 |
*/
|
496 |
if (
|
499 |
( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'enabled'} ) ) )
|
500 |
) {
|
501 |
self::$errors_present = true;
|
502 |
+
self::$error_text = esc_html__( 'Data for "Use Google reCaptcha" is invalid', 'yop-poll' );
|
503 |
}
|
504 |
if ( 'yes' === $settings->integrations->reCaptcha->{'enabled'} ) {
|
505 |
if ( ( false === isset( $settings->integrations->reCaptcha->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'site-key'} ) ) ) {
|
506 |
self::$errors_present = true;
|
507 |
+
self::$error_text = esc_html__( 'Data for "Site Key" is invalid', 'yop-poll' );
|
508 |
}
|
509 |
if ( ( false === isset( $settings->integrations->reCaptcha->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptcha->{'secret-key'} ) ) ) {
|
510 |
self::$errors_present = true;
|
511 |
+
self::$error_text = esc_html__( 'Data for "Secret Key" is invalid', 'yop-poll' );
|
512 |
}
|
513 |
}
|
514 |
if ( 'yes' === $settings->integrations->reCaptchaV2Invisible->{'enabled'} ) {
|
515 |
if ( ( false === isset( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'site-key'} ) ) ) {
|
516 |
self::$errors_present = true;
|
517 |
+
self::$error_text = esc_html__( 'Data for "Site Key" is invalid', 'yop-poll' );
|
518 |
}
|
519 |
if ( ( false === isset( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV2Invisible->{'secret-key'} ) ) ) {
|
520 |
self::$errors_present = true;
|
521 |
+
self::$error_text = esc_html__( 'Data for "Secret Key" is invalid', 'yop-poll' );
|
522 |
}
|
523 |
}
|
524 |
if ( 'yes' === $settings->integrations->reCaptchaV3->{'enabled'} ) {
|
525 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'site-key'} ) ) ) {
|
526 |
self::$errors_present = true;
|
527 |
+
self::$error_text = esc_html__( 'Data for "Site Key" is invalid', 'yop-poll' );
|
528 |
}
|
529 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ) ) ) {
|
530 |
self::$errors_present = true;
|
531 |
+
self::$error_text = esc_html__( 'Data for "Secret Key" is invalid', 'yop-poll' );
|
532 |
}
|
533 |
if ( ( false === isset( $settings->integrations->reCaptchaV3->{'min-allowed-score'} ) ) || ( '' === sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} ) ) ) {
|
534 |
self::$errors_present = true;
|
535 |
+
self::$error_text = esc_html__( 'Data for "Min Allowed Score" is invalid', 'yop-poll' );
|
536 |
}
|
537 |
}
|
538 |
+
if ( 'yes' === $settings->integrations->hCaptcha->{'enabled'} ) {
|
539 |
+
if ( ( false === isset( $settings->integrations->hCaptcha->{'site-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->hCaptcha->{'site-key'} ) ) ) {
|
540 |
+
self::$errors_present = true;
|
541 |
+
self::$error_text = esc_html__( 'Data for "Site Key" is invalid', 'yop-poll' );
|
542 |
+
}
|
543 |
+
if ( ( false === isset( $settings->integrations->hCaptcha->{'secret-key'} ) ) || ( '' === sanitize_text_field( $settings->integrations->hCaptcha->{'secret-key'} ) ) ) {
|
544 |
+
self::$errors_present = true;
|
545 |
+
self::$error_text = esc_html__( 'Data for "Secret Key" is invalid', 'yop-poll' );
|
546 |
+
}
|
547 |
+
}
|
548 |
if (
|
549 |
( false === self::$errors_present ) &&
|
550 |
( !isset( $settings->integrations->facebook->{'enabled'} ) ||
|
551 |
( '' === sanitize_text_field( $settings->integrations->facebook->{'enabled'} ) ) )
|
552 |
) {
|
553 |
self::$errors_present = true;
|
554 |
+
self::$error_text = esc_html__( 'Data for "Use Facebook integration" is invalid', 'yop-poll' );
|
555 |
}
|
556 |
if ( 'yes' === $settings->integrations->facebook->{'enabled'} ) {
|
557 |
if ( ( false === isset( $settings->integrations->facebook->{'app-id'} ) ) || ( '' === sanitize_text_field( $settings->integrations->facebook->{'app-id'} ) ) ) {
|
558 |
self::$errors_present = true;
|
559 |
+
self::$error_text = esc_html__( 'Data for "App ID" is invalid', 'yop-poll' );
|
560 |
}
|
561 |
}
|
562 |
if (
|
565 |
( '' === trim( $settings->integrations->google->{'enabled'} ) ) )
|
566 |
) {
|
567 |
self::$errors_present = true;
|
568 |
+
self::$error_text = esc_html__( 'Data for "Use Google integration" is invalid', 'yop-poll' );
|
569 |
}
|
570 |
if ( 'yes' === $settings->integrations->google->enabled ) {
|
571 |
if ( ( false === isset( $settings->integrations->google->{'app-id'} ) ) || ( '' === sanitize_text_field( $settings->integrations->google->{'app-id'} ) ) ) {
|
572 |
self::$errors_present = true;
|
573 |
+
self::$error_text = esc_html__( 'Data for "App ID" is invalid', 'yop-poll' );
|
574 |
}
|
575 |
if ( ( false === isset( $settings->integrations->google->{'app-secret'} ) ) || ( '' === sanitize_text_field( $settings->integrations->google->{'app-secret'} ) ) ) {
|
576 |
self::$errors_present = true;
|
577 |
+
self::$error_text = esc_html__( 'Data for "App Secret" is invalid', 'yop-poll' );
|
578 |
}
|
579 |
}
|
580 |
if (
|
583 |
( '' === sanitize_text_field( $settings->messages->buttons->{'anonymous'} ) ) )
|
584 |
) {
|
585 |
self::$errors_present = true;
|
586 |
+
self::$error_text = esc_html__( 'Data for "Vote as anonymous" is invalid', 'yop-poll' );
|
587 |
}
|
588 |
if (
|
589 |
( false === self::$errors_present ) &&
|
591 |
( '' === sanitize_text_field( $settings->messages->buttons->{'wordpress'} ) ) )
|
592 |
) {
|
593 |
self::$errors_present = true;
|
594 |
+
self::$error_text = esc_html__( 'Data for "Vote with your WordPress account" is invalid', 'yop-poll' );
|
595 |
}
|
596 |
if (
|
597 |
( false === self::$errors_present ) &&
|
599 |
( '' === sanitize_text_field( $settings->messages->buttons->{'facebook'} ) ) )
|
600 |
) {
|
601 |
self::$errors_present = true;
|
602 |
+
self::$error_text = esc_html__( 'Data for "Vote with your Facebook account" is invalid', 'yop-poll' );
|
603 |
}
|
604 |
if (
|
605 |
( false === self::$errors_present ) &&
|
607 |
( '' === sanitize_text_field( $settings->messages->buttons->{'google'} ) ) )
|
608 |
) {
|
609 |
self::$errors_present = true;
|
610 |
+
self::$error_text = esc_html__( 'Data for "Vote with your Google account" is invalid', 'yop-poll' );
|
611 |
}
|
612 |
if (
|
613 |
( false === self::$errors_present ) &&
|
615 |
( '' === sanitize_text_field( $settings->messages->voting->{'poll-ended'} ) ) )
|
616 |
) {
|
617 |
self::$errors_present = true;
|
618 |
+
self::$error_text = esc_html__( 'Data for "Poll Ended" is invalid', 'yop-poll' );
|
619 |
}
|
620 |
if (
|
621 |
( false === self::$errors_present ) &&
|
623 |
( '' === sanitize_text_field( $settings->messages->voting->{'poll-not-started'} ) ) )
|
624 |
) {
|
625 |
self::$errors_present = true;
|
626 |
+
self::$error_text = esc_html__( 'Data for "Poll Not Started" is invalid', 'yop-poll' );
|
627 |
}
|
628 |
if (
|
629 |
( false === self::$errors_present ) &&
|
631 |
( '' === sanitize_text_field( $settings->messages->voting->{'already-voted-on-poll'} ) ) )
|
632 |
) {
|
633 |
self::$errors_present = true;
|
634 |
+
self::$error_text = esc_html__( 'Data for "Already voted on poll" is invalid', 'yop-poll' );
|
635 |
}
|
636 |
if (
|
637 |
( false === self::$errors_present ) &&
|
639 |
( '' === sanitize_text_field( $settings->messages->voting->{'invalid-poll'} ) ) )
|
640 |
) {
|
641 |
self::$errors_present = true;
|
642 |
+
self::$error_text = esc_html__( 'Data for "Invalid Poll" is invalid', 'yop-poll' );
|
643 |
}
|
644 |
if (
|
645 |
( false === self::$errors_present ) &&
|
647 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-answers-selected'} ) ) )
|
648 |
) {
|
649 |
self::$errors_present = true;
|
650 |
+
self::$error_text = esc_html__( 'Data for "No Answer(s) selected" is invalid', 'yop-poll' );
|
651 |
}
|
652 |
if (
|
653 |
( false === self::$errors_present ) &&
|
655 |
( '' === sanitize_text_field( $settings->messages->voting->{'min-answers-required'} ) ) )
|
656 |
) {
|
657 |
self::$errors_present = true;
|
658 |
+
self::$error_text = esc_html__( 'Data for "Minimum answers required" is invalid', 'yop-poll' );
|
659 |
}
|
660 |
if (
|
661 |
( false === self::$errors_present ) &&
|
663 |
( '' === sanitize_text_field( $settings->messages->voting->{'max-answers-required'} ) ) )
|
664 |
) {
|
665 |
self::$errors_present = true;
|
666 |
+
self::$error_text = esc_html__( 'Data for "Maximum answers required" is invalid', 'yop-poll' );
|
667 |
}
|
668 |
if (
|
669 |
( false === self::$errors_present ) &&
|
671 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-answer-for-other'} ) ) )
|
672 |
) {
|
673 |
self::$errors_present = true;
|
674 |
+
self::$error_text = esc_html__( 'Data for "No value for other" is invalid', 'yop-poll' );
|
675 |
}
|
676 |
if (
|
677 |
( false === self::$errors_present ) &&
|
679 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-value-for-custom-field'} ) ) )
|
680 |
) {
|
681 |
self::$errors_present = true;
|
682 |
+
self::$error_text = esc_html__( 'Data for "No value for custom field" is invalid', 'yop-poll' );
|
683 |
}
|
684 |
if (
|
685 |
( false === self::$errors_present ) &&
|
687 |
( '' === sanitize_text_field( $settings->messages->voting->{'consent-not-checked'} ) ) )
|
688 |
) {
|
689 |
self::$errors_present = true;
|
690 |
+
self::$error_text = esc_html__( 'Data for "Consent not checked" is invalid', 'yop-poll' );
|
691 |
}
|
692 |
if (
|
693 |
( false === self::$errors_present ) &&
|
695 |
( '' === sanitize_text_field( $settings->messages->voting->{'no-captcha-selected'} ) ) )
|
696 |
) {
|
697 |
self::$errors_present = true;
|
698 |
+
self::$error_text = esc_html__( 'Data for "Captcha missing" is invalid', 'yop-poll' );
|
699 |
}
|
700 |
if (
|
701 |
( false === self::$errors_present ) &&
|
703 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-ban'} ) ) )
|
704 |
) {
|
705 |
self::$errors_present = true;
|
706 |
+
self::$error_text = esc_html__( 'Data for "Vote not allowed by ban setting" is invalid', 'yop-poll' );
|
707 |
}
|
708 |
if (
|
709 |
( false === self::$errors_present ) &&
|
711 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-block'} ) ) )
|
712 |
) {
|
713 |
self::$errors_present = true;
|
714 |
+
self::$error_text = esc_html__( 'Data for "Vote not allowed by block setting" is invalid', 'yop-poll' );
|
715 |
}
|
716 |
if (
|
717 |
( false === self::$errors_present ) &&
|
719 |
( '' === sanitize_text_field( $settings->messages->voting->{'not-allowed-by-limit'} ) ) )
|
720 |
) {
|
721 |
self::$errors_present = true;
|
722 |
+
self::$error_text = esc_html__( 'Data for "Vote not allowed by limit setting" is invalid', 'yop-poll' );
|
723 |
}
|
724 |
if (
|
725 |
( false === self::$errors_present ) &&
|
727 |
( '' === sanitize_text_field( $settings->messages->voting->{'thank-you'} ) ) )
|
728 |
) {
|
729 |
self::$errors_present = true;
|
730 |
+
self::$error_text = esc_html__( 'Data for "Thank you for your vote" is invalid', 'yop-poll' );
|
731 |
}
|
732 |
if (
|
733 |
( false === self::$errors_present ) &&
|
735 |
( '' === sanitize_text_field( $settings->messages->results->{'single-vote'} ) ) )
|
736 |
) {
|
737 |
self::$errors_present = true;
|
738 |
+
self::$error_text = esc_html__( 'Data for "Single Vote" is invalid', 'yop-poll' );
|
739 |
}
|
740 |
if (
|
741 |
( false === self::$errors_present ) &&
|
743 |
( '' === sanitize_text_field( $settings->messages->results->{'multiple-votes'} ) ) )
|
744 |
) {
|
745 |
self::$errors_present = true;
|
746 |
+
self::$error_text = esc_html__( 'Data for "Multiple Votes" is invalid', 'yop-poll' );
|
747 |
}
|
748 |
if (
|
749 |
( false === self::$errors_present ) &&
|
751 |
( '' === sanitize_text_field( $settings->messages->results->{'single-answer'} ) ) )
|
752 |
) {
|
753 |
self::$errors_present = true;
|
754 |
+
self::$error_text = esc_html__( 'Data for "Single Answer" is invalid', 'yop-poll' );
|
755 |
}
|
756 |
if (
|
757 |
( false === self::$errors_present ) &&
|
759 |
( '' === sanitize_text_field( $settings->messages->results->{'multiple-answers'} ) ) )
|
760 |
) {
|
761 |
self::$errors_present = true;
|
762 |
+
self::$error_text = esc_html__( 'Data for "Multiple Answers" is invalid', 'yop-poll' );
|
763 |
}
|
764 |
if (
|
765 |
( false === self::$errors_present ) &&
|
767 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-alt'} ) ) )
|
768 |
) {
|
769 |
self::$errors_present = true;
|
770 |
+
self::$error_text = esc_html__( 'Data for "Accessibility Alt" is invalid', 'yop-poll' );
|
771 |
}
|
772 |
if (
|
773 |
( false === self::$errors_present ) &&
|
775 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-title'} ) ) )
|
776 |
) {
|
777 |
self::$errors_present = true;
|
778 |
+
self::$error_text = esc_html__( 'Data for "Accessibility Title" is invalid', 'yop-poll' );
|
779 |
}
|
780 |
if (
|
781 |
( false === self::$errors_present ) &&
|
783 |
( '' === sanitize_text_field( $settings->messages->captcha->{'accessibility-description'} ) ) )
|
784 |
) {
|
785 |
self::$errors_present = true;
|
786 |
+
self::$error_text = esc_html__( 'Data for "Accessibility Description" is invalid', 'yop-poll' );
|
787 |
}
|
788 |
if (
|
789 |
( false === self::$errors_present ) &&
|
791 |
( '' === sanitize_text_field( $settings->messages->captcha->{'explanation'} ) ) )
|
792 |
) {
|
793 |
self::$errors_present = true;
|
794 |
+
self::$error_text = esc_html__( 'Data for "Accessibility Explanation" is invalid', 'yop-poll' );
|
795 |
}
|
796 |
if (
|
797 |
( false === self::$errors_present ) &&
|
799 |
( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ) ) )
|
800 |
) {
|
801 |
self::$errors_present = true;
|
802 |
+
self::$error_text = esc_html__( 'Data for "Refresh Alt" is invalid', 'yop-poll' );
|
803 |
}
|
804 |
if (
|
805 |
( false === self::$errors_present ) &&
|
807 |
( '' === sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ) ) )
|
808 |
) {
|
809 |
self::$errors_present = true;
|
810 |
+
self::$error_text = esc_html__( 'Data for "Refresh Title" is invalid', 'yop-poll' );
|
811 |
}
|
812 |
}
|
813 |
}
|
870 |
'secret-key' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'secret-key'} ),
|
871 |
'min-allowed-score' => sanitize_text_field( $settings->integrations->reCaptchaV3->{'min-allowed-score'} )
|
872 |
),
|
873 |
+
'hCaptcha' => array(
|
874 |
+
'enabled' => sanitize_text_field( $settings->integrations->hCaptcha->{'enabled'} ),
|
875 |
+
'site-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'site-key'} ),
|
876 |
+
'secret-key' => sanitize_text_field( $settings->integrations->hCaptcha->{'secret-key'} )
|
877 |
+
),
|
878 |
'facebook' => array(
|
879 |
'enabled' => sanitize_text_field( $settings->integrations->facebook->{'enabled'} ),
|
880 |
'app-id' => sanitize_text_field( $settings->integrations->facebook->{'app-id'} ),
|
894 |
'refresh-alt' => sanitize_text_field( $settings->messages->captcha->{'refresh-alt'} ),
|
895 |
'refresh-title' => sanitize_text_field( $settings->messages->captcha->{'refresh-title'} ),
|
896 |
),
|
897 |
+
'buttons' => array(
|
898 |
'anonymous' => sanitize_text_field( $settings->messages->buttons->{'anonymous'} ),
|
899 |
'wordpress' => sanitize_text_field( $settings->messages->buttons->{'wordpress'} ),
|
900 |
'facebook' => sanitize_text_field( $settings->messages->buttons->{'facebook'} ),
|
admin/models/skins.php
CHANGED
@@ -5,13 +5,13
|