| @@ -143,8 +143,43 @@ | ||
| 143 | 143 | // } |
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | + /** | |
| 148 | + * Register the styles for the admin menu area. | |
| 149 | + * | |
| 150 | + * @since 1.0.0 | |
| 151 | + */ | |
| 152 | + public function admin_menu_styles(){ | |
| 153 | + $survey_menu_badge_background = self::get_menu_badge_background( $this->plugin_name ); | |
| 154 | + | |
| 155 | + $custom_additional_css = ""; | |
| 156 | + if( $survey_menu_badge_background == '#3858e9' ){ | |
| 157 | + $custom_additional_css = " | |
| 158 | + #adminmenu li.toplevel_page_survey-maker a.toplevel_page_survey-maker.wp-has-current-submenu.wp-menu-open .wp-menu-name .ays-survey-menu-badge, | |
| 159 | + #adminmenu li.toplevel_page_survey-maker a.toplevel_page_survey-maker:hover .wp-menu-name .ays-survey-menu-badge { | |
| 160 | + color: #fff; | |
| 161 | + background: rgb(12.15, 12.15, 12.15); | |
| 162 | + }"; | |
| 163 | + } | |
| 164 | + | |
| 165 | + echo "<style> | |
| 166 | + #adminmenu .ays-survey-menu-badge { | |
| 167 | + background: ". esc_attr( $survey_menu_badge_background ) ."; | |
| 168 | + } | |
| 169 | + | |
| 170 | + ". $custom_additional_css ." | |
| 171 | + </style>"; | |
| 172 | + } | |
| 173 | + | |
| 174 | + public static function get_menu_badge_background( $plugin_name = 'survey-maker' ){ | |
| 175 | + $setting_actions = new Survey_Maker_Settings_Actions( $plugin_name ); | |
| 176 | + $options = ($setting_actions->ays_get_setting('options') === false) ? array() : json_decode( stripcslashes( $setting_actions->ays_get_setting('options') ), true); | |
| 177 | + $survey_menu_badge_style = ( isset( $options['survey_menu_badge_style'] ) && sanitize_key( $options['survey_menu_badge_style'] ) === 'wp_default' ) ? 'wp_default' : 'classic'; | |
| 178 | + | |
| 179 | + return ( $survey_menu_badge_style === 'wp_default' ) ? '#3858e9' : '#ca4a1f'; | |
| 180 | + } | |
| 181 | + | |
| 147 | 182 | /** |
| 148 | 183 | * Register the stylesheets for the admin area. |
| 149 | 184 | * |
| 150 | 185 | * @since 1.0.0 |
| @@ -283,8 +318,9 @@ | ||
| 283 | 318 | wp_enqueue_script( $this->plugin_name . "-survey-styles", plugin_dir_url(__FILE__) . 'js/partials/survey-maker-admin-survey-styles.js', array('jquery', 'wp-color-picker'), $this->version, true); |
| 284 | 319 | wp_enqueue_script( $this->plugin_name . "-functions", plugin_dir_url(__FILE__) . 'js/functions.js', array( 'jquery', 'wp-color-picker' ), $this->version, true ); |
| 285 | 320 | wp_enqueue_script( $this->plugin_name . '-ajax', plugin_dir_url(__FILE__) . 'js/survey-maker-admin-ajax.js', array('jquery'), $this->version, true); |
| 286 | 321 | wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/survey-maker-admin.js', array( 'jquery' ), $this->version, true ); |
| 322 | + wp_enqueue_script( $this->plugin_name."-terms-and-conditions", plugin_dir_url( __FILE__ ) . 'js/survey-maker-admin-terms-and-conditions.js', array( 'jquery' ), $this->version, true ); | |
| 287 | 323 | wp_localize_script( $this->plugin_name, 'SurveyMakerAdmin', array( |
| 288 | 324 | 'surveyBannerDate' => $survey_banner_date, |
| 289 | 325 | 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
| 290 | 326 | 'nonce' => wp_create_nonce( 'ajax-nonce' ), |
| @@ -334,8 +370,9 @@ | ||
| 334 | 370 | 'okSurvey' => __( 'OK', "survey-maker"), |
| 335 | 371 | 'icons' => array( |
| 336 | 372 | 'radioButtonUnchecked' => SURVEY_MAKER_ADMIN_URL . '/images/icons/radio-button-unchecked.svg', |
| 337 | 373 | 'checkboxUnchecked' => SURVEY_MAKER_ADMIN_URL . '/images/icons/checkbox-unchecked.svg', |
| 374 | + 'deleteTermsAndConds' => SURVEY_MAKER_ADMIN_URL. '/images/icons/trash.svg', | |
| 338 | 375 | ), |
| 339 | 376 | 'nextSurveyPage' => __( 'Are you sure you want to go to the next survey page?', "survey-maker"), |
| 340 | 377 | 'prevSurveyPage' => __( 'Are you sure you want to go to the previous question page?', "survey-maker"), |
| 341 | 378 | 'addQuestionImageCaption' => __( 'Add a caption', "survey-maker"), |
| @@ -348,8 +385,18 @@ | ||
| 348 | 385 | 'activate' => __( 'Activate', "survey-maker" ), |
| 349 | 386 | 'activated' => __( 'Activated', "survey-maker" ), |
| 350 | 387 | 'successCopyCoupon' => __( "Coupon code copied!", 'survey-maker' ), |
| 351 | 388 | 'failedCopyCoupon' => __( "Failed to copy coupon code", 'survey-maker' ), |
| 389 | + | |
| 390 | + 'generalTabDoc' => esc_html__( "How to configure questions", 'survey-maker' ), | |
| 391 | + 'stylesTabDoc' => esc_html__( "How to customize styles", 'survey-maker' ), | |
| 392 | + 'settingsTabDoc' => esc_html__( "How to configure survey settings", 'survey-maker' ), | |
| 393 | + 'resultsSettingsTabDoc' => esc_html__( "How to customize survey results", 'survey-maker' ), | |
| 394 | + 'limitationUsersTabDoc' => esc_html__( "How to set up user limitations", 'survey-maker' ), | |
| 395 | + 'userDataTabDoc' => esc_html__( "How to set up the start page", 'survey-maker' ), | |
| 396 | + 'emailTabDoc' => esc_html__( "How to configure survey emails", 'survey-maker' ), | |
| 397 | + 'integrationTabDoc' => esc_html__( "How to set up integrations", 'survey-maker' ), | |
| 398 | + 'conditionsTabDoc' => esc_html__( "How to use conditional results", 'survey-maker' ), | |
| 352 | 399 | ) ); |
| 353 | 400 | wp_localize_script($this->plugin_name . '-ajax', 'survey_maker_ajax', array( |
| 354 | 401 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 355 | 402 | "emptyEmailError" => __( 'Email field is empty', "survey-maker"), |
| @@ -525,9 +572,9 @@ | ||
| 525 | 572 | $this->capability, |
| 526 | 573 | $this->plugin_name, |
| 527 | 574 | array($this, 'display_plugin_surveys_page'), |
| 528 | 575 | SURVEY_MAKER_ADMIN_URL . '/images/icons/survey-make-menu-logo.svg', |
| 529 | - '6.21' | |
| 576 | + '25.20' | |
| 530 | 577 | ); |
| 531 | 578 | add_action( "load-$hook_survey_maker", array( $this, 'add_tabs' )); |
| 532 | 579 | } |
| 533 | 580 | |
| @@ -1713,14 +1760,16 @@ | ||
| 1713 | 1760 | |
| 1714 | 1761 | $ays_survey_maker_flag = intval(get_option('ays_survey_sale_btn')); |
| 1715 | 1762 | if( $ays_survey_maker_flag == 0 ){ |
| 1716 | 1763 | if (isset($_GET['page']) && strpos($_GET['page'], SURVEY_MAKER_NAME) !== false) { |
| 1717 | - if(Survey_Maker_Admin::get_max_id('surveys') > 1){ | |
| 1764 | + // if(Survey_Maker_Admin::get_max_id('surveys') > 1){ | |
| 1718 | 1765 | // $this->ays_survey_new_halloween_bundle_message_2025($ays_survey_maker_flag); |
| 1719 | 1766 | // $this->ays_survey_black_friday_message($ays_survey_maker_flag); |
| 1720 | 1767 | // $this->ays_survey_christmas_banner_message_2025($ays_survey_maker_flag); |
| 1721 | - $this->ays_survey_new_mega_bundle_message_2026($ays_survey_maker_flag); | |
| 1722 | - } | |
| 1768 | + $this->ays_survey_back_to_school_banner_2026($ays_survey_maker_flag); | |
| 1769 | + // $this->ays_survey_footer_sale_banner_2026($ays_survey_maker_flag); | |
| 1770 | + | |
| 1771 | + // } | |
| 1723 | 1772 | } |
| 1724 | 1773 | } |
| 1725 | 1774 | |
| 1726 | 1775 | } |
| @@ -3704,8 +3753,416 @@ | ||
| 3704 | 3753 | |
| 3705 | 3754 | $content = implode( '', $content ); |
| 3706 | 3755 | echo html_entity_decode(esc_html( $content )); |
| 3707 | 3756 | } |
| 3757 | + } | |
| 3758 | + | |
| 3759 | + // Back to School top banner | |
| 3760 | + public function ays_survey_back_to_school_banner_2026($ishmar){ | |
| 3761 | + if($ishmar == 0 ){ | |
| 3762 | + $content = array(); | |
| 3763 | + $quiz_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=back-to-school-sale-banner-' . SURVEY_MAKER_VERSION); | |
| 3764 | + $content[] = '<div id="ays-survey-back-to-school-banner-2026" class="ays-survey-back-to-school-banner-2026 ays-survey-admin-notice notice notice-success is-dismissible ays_survey_dicount_info">'; | |
| 3765 | + $content[] = '<svg class="ays-survey-bts-decoration ays-survey-bts-plane" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 2 11 13"></path><path d="M22 2 15 22l-4-9-9-4Z"></path></svg>'; | |
| 3766 | + $content[] = '<svg class="ays-survey-bts-decoration ays-survey-bts-ruler" viewBox="0 0 36 20" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><rect x="1" y="6" width="34" height="9" rx="2"></rect><path d="M8 6v3M14 6v4M20 6v3M26 6v4"></path></svg>'; | |
| 3767 | + $content[] = '<svg class="ays-survey-bts-decoration ays-survey-bts-star" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="m12 2 2.6 6.6L21.5 9l-5 4.6 1.4 7-5.9-3.5L6.1 20.6l1.4-7L2.5 9l6.9-.4Z"></path></svg>'; | |
| 3768 | + $content[] = '<svg class="ays-survey-bts-decoration ays-survey-bts-pencil" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>'; | |
| 3769 | + $content[] = '<svg class="ays-survey-bts-decoration ays-survey-bts-wave" viewBox="0 0 96 12" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="M2 8c8-8 16 8 24 0s16 8 24 0 16 8 24 0 16 8 20 2"></path></svg>'; | |
| 3770 | + $content[] = '<div class="ays-survey-bts-content">'; | |
| 3771 | + $content[] = '<div class="ays-survey-bts-offer">'; | |
| 3772 | + $content[] = '<img class="ays-survey-bts-handwritten" src="'. esc_url(SURVEY_MAKER_ADMIN_URL . '/images/ays-survey-back-to-school-handwritten.svg') .'" alt="Back to School Sale">'; | |
| 3773 | + $content[] = '<span class="ays-survey-bts-dot" aria-hidden="true"></span>'; | |
| 3774 | + $content[] = '<span class="ays-survey-bts-discount">'. esc_html__('20% OFF', 'survey-maker') .'</span>'; | |
| 3775 | + $content[] = '</div>'; | |
| 3776 | + $content[] = '<div class="ays-survey-bts-actions">'; | |
| 3777 | + $content[] = '<span class="ays-survey-bts-use-code">'. esc_html__('Use code', 'survey-maker') .'</span>'; | |
| 3778 | + $content[] = '<button type="button" class="ays-survey-bts-coupon" data-coupon="SCHOOL20" aria-label="'. esc_attr__('Copy coupon code SCHOOL20', 'survey-maker') .'"><span>SCHOOL20</span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg></button>'; | |
| 3779 | + $content[] = '<a href="'. esc_url($quiz_cta_button_link) .'" class="ays-survey-bts-cta" target="_blank" rel="noopener noreferrer">'. esc_html__('Upgrade Now', 'survey-maker') .'</a>'; | |
| 3780 | + $content[] = '</div>'; | |
| 3781 | + $content[] = '</div>'; | |
| 3782 | + $content[] = '<div class="ays-survey-bts-dismiss"><form action="" method="POST"><div id="ays-survey-dismiss-buttons-content">'; | |
| 3783 | + if( current_user_can( 'manage_options' ) ){ | |
| 3784 | + $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn">'. esc_html__('Dismiss ad', 'survey-maker') .'</button>'; | |
| 3785 | + $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner', SURVEY_MAKER_NAME . '-sale-banner', true, false ); | |
| 3786 | + } | |
| 3787 | + $content[] = '</div></form></div>'; | |
| 3788 | + $content[] = '</div>'; | |
| 3789 | + $content[] = '<style id="ays-survey-back-to-school-banner-2026-inline-css">'; | |
| 3790 | + $content[] = '#ays-survey-back-to-school-banner-2026{box-sizing:border-box;position:relative;isolation:isolate;width:calc(100% - 20px);max-width:none;min-height:112px;margin:20px 20px 16px 0;padding:0 38px;overflow:hidden;border:1px solid #e8dcc9;border-left-width:1px;border-radius:12px;background-color:#fffdf8;background-image:radial-gradient(circle at 1px 1px,rgba(91,72,45,.09) 1px,transparent 1px),radial-gradient(120% 140% at 0 0,rgba(20,75,220,.07),transparent 55%),radial-gradient(120% 140% at 100% 100%,rgba(126,34,206,.09),transparent 55%);background-size:6px 6px,100% 100%,100% 100%;box-shadow:0 10px 30px -18px rgba(76,45,140,.55);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.ays-survey-bts-content{position:relative;z-index:2;display:flex;min-height:110px;align-items:center;justify-content:space-between;gap:28px}.ays-survey-bts-offer,.ays-survey-bts-actions{display:flex;align-items:center}.ays-survey-bts-offer{min-width:0;gap:9px}.ays-survey-bts-handwritten{width:280px;max-width:23vw;height:auto;color:#0755df;overflow:visible;flex:0 1 auto}.ays-survey-bts-dot{width:7px;height:7px;flex:0 0 auto;border-radius:50%;background:#ffc51b;align-self:flex-start;margin-top:27px}.ays-survey-bts-discount{color:#8127df;font-size:38px;font-weight:800;line-height:1;letter-spacing:-1.2px;white-space:nowrap}.ays-survey-bts-actions{flex:0 0 auto;gap:12px}.ays-survey-bts-use-code{color:#5f5b69;font-size:11px;font-weight:600;line-height:1;text-transform:uppercase;letter-spacing:.14em;white-space:nowrap}.ays-survey-bts-coupon{box-sizing:border-box;display:flex;min-height:50px;align-items:center;gap:12px;padding:8px 14px;border:2px dashed rgba(129,39,223,.5);border-radius:10px;background:#fff;color:#1147c8;cursor:pointer;box-shadow:none}.ays-survey-bts-coupon:hover,.ays-survey-bts-coupon:focus{border-color:#8127df;background:rgba(129,39,223,.05);color:#1147c8}.ays-survey-bts-coupon span{font-size:19px;font-weight:700;letter-spacing:.04em}.ays-survey-bts-coupon svg{width:16px;height:16px;color:#8127df}.ays-survey-bts-cta{display:inline-flex;min-height:48px;align-items:center;justify-content:center;padding:0 27px;border-radius:9px;background:linear-gradient(90deg,#1249e7,#8127df);color:#fff!important;font-size:16px;font-weight:700;text-decoration:none!important;white-space:nowrap;box-shadow:0 8px 18px -8px rgba(91,37,194,.9);transition:transform .15s,box-shadow .15s}.ays-survey-bts-cta:hover,.ays-survey-bts-cta:focus{color:#fff;transform:translateY(-1px);box-shadow:0 10px 20px -8px rgba(91,37,194,.95)}.ays-survey-bts-decoration{position:absolute;z-index:1;pointer-events:none}.ays-survey-bts-plane{top:8px;left:12px;width:24px;color:rgba(129,39,223,.55)}.ays-survey-bts-ruler{bottom:7px;left:24px;width:36px;color:rgba(20,73,230,.35)}.ays-survey-bts-star{top:8px;right:14px;width:19px;color:#ffc51b}.ays-survey-bts-pencil{right:31px;bottom:7px;width:21px;color:rgba(129,39,223,.5);transform:rotate(-12deg)}.ays-survey-bts-wave{bottom:3px;left:50%;width:96px;color:rgba(20,73,230,.22);transform:translateX(-50%)}#ays-survey-back-to-school-banner-2026 .notice-dismiss{top:1px;right:1px;color:#756b82}#ays-survey-back-to-school-banner-2026 .notice-dismiss:before{font-size:18px}.ays-survey-bts-dismiss{position:absolute;right:39px;bottom:0;z-index:3}.ays-survey-bts-dismiss form{margin:0}.ays-survey-bts-dismiss #ays-survey-dismiss-buttons-content .ays-button{height:22px!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;color:#777!important;font-size:10px!important;line-height:22px!important;text-decoration:underline;box-shadow:none!important}.ays-survey-bts-copy-notification{position:fixed;top:50%;left:50%;z-index:10000;transform:translate(-50%,-50%);padding:12px 24px;border-radius:8px;background:rgba(0,0,0,.82);color:#fff;font-size:14px;opacity:0;transition:opacity .25s}.ays-survey-bts-copy-notification.ays-survey-bts-show{opacity:1}@media screen and (max-width:1200px){.ays-survey-bts-content{gap:18px}.ays-survey-bts-handwritten{width:225px}.ays-survey-bts-discount{font-size:31px}.ays-survey-bts-actions{gap:8px}.ays-survey-bts-coupon{min-height:44px;padding:7px 10px}.ays-survey-bts-cta{min-height:44px;padding:0 18px;font-size:14px}}@media screen and (max-width:960px){#ays-survey-back-to-school-banner-2026{padding:15px 38px 20px}.ays-survey-bts-content{min-height:90px;flex-wrap:wrap;justify-content:center;gap:12px 24px}.ays-survey-bts-handwritten{max-width:none}.ays-survey-bts-actions{justify-content:center}.ays-survey-bts-dismiss{right:38px}}@media screen and (max-width:600px){#ays-survey-back-to-school-banner-2026{width:calc(100% - 20px);margin-right:10px;padding:18px 30px 23px 18px}.ays-survey-bts-content{flex-direction:column}.ays-survey-bts-offer{flex-wrap:wrap;justify-content:center}.ays-survey-bts-handwritten{width:210px}.ays-survey-bts-discount{font-size:28px}.ays-survey-bts-actions{flex-wrap:wrap}.ays-survey-bts-use-code{width:100%;text-align:center}.ays-survey-bts-coupon{min-height:40px}.ays-survey-bts-coupon span{font-size:16px}.ays-survey-bts-cta{min-height:40px}.ays-survey-bts-plane,.ays-survey-bts-ruler,.ays-survey-bts-pencil,.ays-survey-bts-wave{display:none}.ays-survey-bts-dismiss{right:30px}}'; | |
| 3791 | + $content[] = '</style>'; | |
| 3792 | + $content[] = '<script> | |
| 3793 | + (function() { | |
| 3794 | + "use strict"; | |
| 3795 | + function initBackToSchoolBanner() { | |
| 3796 | + var banner = document.getElementById("ays-survey-back-to-school-banner-2026"); | |
| 3797 | + if (!banner) { | |
| 3798 | + return; | |
| 3799 | + } | |
| 3800 | + var couponButton = banner.querySelector(".ays-survey-bts-coupon"); | |
| 3801 | + if (!couponButton) { | |
| 3802 | + return; | |
| 3803 | + } | |
| 3804 | + couponButton.addEventListener("click", function() { | |
| 3805 | + var couponCode = couponButton.getAttribute("data-coupon"); | |
| 3806 | + var textarea = document.createElement("textarea"); | |
| 3807 | + textarea.value = couponCode; | |
| 3808 | + textarea.style.position = "fixed"; | |
| 3809 | + textarea.style.opacity = "0"; | |
| 3810 | + document.body.appendChild(textarea); | |
| 3811 | + textarea.focus(); | |
| 3812 | + textarea.select(); | |
| 3813 | + try { | |
| 3814 | + document.execCommand("copy"); | |
| 3815 | + showCopyNotification(); | |
| 3816 | + } catch (error) { | |
| 3817 | + // Keep the banner usable when clipboard access is unavailable. | |
| 3818 | + } | |
| 3819 | + document.body.removeChild(textarea); | |
| 3820 | + }); | |
| 3821 | + } | |
| 3822 | + function showCopyNotification() { | |
| 3823 | + var notification = document.createElement("div"); | |
| 3824 | + notification.className = "ays-survey-bts-copy-notification"; | |
| 3825 | + notification.textContent = "'. esc_js(__('Coupon code copied', 'survey-maker')) .'"; | |
| 3826 | + document.body.appendChild(notification); | |
| 3827 | + setTimeout(function() { | |
| 3828 | + notification.classList.add("ays-survey-bts-show"); | |
| 3829 | + }, 10); | |
| 3830 | + setTimeout(function() { | |
| 3831 | + notification.classList.remove("ays-survey-bts-show"); | |
| 3832 | + setTimeout(function() { | |
| 3833 | + if (notification.parentNode) { | |
| 3834 | + notification.parentNode.removeChild(notification); | |
| 3835 | + } | |
| 3836 | + }, 250); | |
| 3837 | + }, 2000); | |
| 3838 | + } | |
| 3839 | + if (document.readyState === "loading") { | |
| 3840 | + document.addEventListener("DOMContentLoaded", initBackToSchoolBanner); | |
| 3841 | + } else { | |
| 3842 | + initBackToSchoolBanner(); | |
| 3843 | + } | |
| 3844 | + })(); | |
| 3845 | + </script>'; | |
| 3846 | + echo implode('', $content); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static banner markup; dynamic values are escaped above. | |
| 3847 | + } | |
| 3848 | + } | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + // Survey Footer Blue Banner Sale 20% | |
| 3852 | + public function ays_survey_footer_sale_banner_2026($ishmar){ | |
| 3853 | + if($ishmar == 0 ){ | |
| 3854 | + $content = array(); | |
| 3855 | + | |
| 3856 | + $survey_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=private-offer-20-off-' . SURVEY_MAKER_VERSION); | |
| 3857 | + | |
| 3858 | + $content[] = ' | |
| 3859 | + <div class="ays-survey-footer-banner-bottom-banner-wrapper" style="display: none;"> | |
| 3860 | + <div class="ays-survey-footer-banner-bottom-banner-container"> | |
| 3861 | + <div class="ays-survey-footer-banner-bottom-banner-content"> | |
| 3862 | + <div class="ays-survey-footer-banner-bottom-banner-inner"> | |
| 3863 | + <div class="ays-survey-footer-banner-bottom-banner-left"> | |
| 3864 | + <div class="ays-survey-footer-banner-bottom-banner-icon"> | |
| 3865 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> | |
| 3866 | + <path d="M12 7v14"></path> | |
| 3867 | + <path d="M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8"></path> | |
| 3868 | + <path d="M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5"></path> | |
| 3869 | + <rect x="3" y="7" width="18" height="4" rx="1"></rect> | |
| 3870 | + </svg> | |
| 3871 | + </div> | |
| 3872 | + <span class="ays-survey-footer-banner-bottom-banner-title">'. esc_html__('Survey Maker by AYS', 'survey-maker') .'</span> | |
| 3873 | + </div> | |
| 3874 | + <span class="ays-survey-footer-banner-bottom-banner-separator"></span> | |
| 3875 | + <span class="ays-survey-footer-banner-bottom-banner-discount">'. esc_html__('20% Off', 'survey-maker') .'</span> | |
| 3876 | + <div class="ays-survey-footer-banner-bottom-banner-code" onclick="aysSurveyFooterBannerCopyToClipboard()" title="'. esc_html__('Copy Coupon Code', 'survey-maker') .'"> | |
| 3877 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> | |
| 3878 | + <path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"></path> | |
| 3879 | + <path d="M13 5v2"></path> | |
| 3880 | + <path d="M13 17v2"></path> | |
| 3881 | + <path d="M13 11v2"></path> | |
| 3882 | + </svg> | |
| 3883 | + <span>SURVEYPRO20</span> | |
| 3884 | + <button type="button" class="ays-survey-footer-banner-bottom-banner-copy" aria-label="'. esc_html__('Copy Coupon Code', 'survey-maker') .'"> | |
| 3885 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> | |
| 3886 | + <rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect> | |
| 3887 | + <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path> | |
| 3888 | + </svg> | |
| 3889 | + </button> | |
| 3890 | + </div> | |
| 3891 | + <button type="button" class="ays-survey-footer-banner-bottom-banner-cta"> | |
| 3892 | + '. esc_html__('Get Deal', 'survey-maker') .' | |
| 3893 | + </button> | |
| 3894 | + <button type="button" class="ays-survey-footer-banner-bottom-banner-close" aria-label="'. esc_html__('Close popup', 'survey-maker') .'"> | |
| 3895 | + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> | |
| 3896 | + <path d="M18 6 6 18"></path> | |
| 3897 | + <path d="m6 6 12 12"></path> | |
| 3898 | + </svg> | |
| 3899 | + </button> | |
| 3900 | + </div> | |
| 3901 | + </div> | |
| 3902 | + </div> | |
| 3903 | + </div>'; | |
| 3904 | + | |
| 3905 | + $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">'; | |
| 3906 | + | |
| 3907 | + $content[] = '@keyframes ays-pro-slide-up{0%{opacity:0;transform:translateY(24px)}100%{opacity:1;transform:translateY(0)}}@keyframes ays-pro-slide-down{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(24px)}}.ays-survey-footer-banner-bottom-banner-wrapper{position:fixed;bottom:0;left:0;right:0;z-index:9999;padding:0 16px 28px;text-align:center;animation:.45s cubic-bezier(.16,1,.3,1) forwards ays-pro-slide-up}.ays-survey-footer-banner-bottom-banner-wrapper.ays-pro-banner-closing{animation:.32s cubic-bezier(.16,1,.3,1) forwards ays-pro-slide-down}.ays-survey-footer-banner-bottom-banner-container{display:inline-block;max-width:100%;border-radius:16px;background:linear-gradient(90deg,#2f6bff 0,#3e7bff 100%);box-shadow:0 20px 40px -15px rgba(47,107,255,.55),0 8px 20px -10px rgba(47,107,255,.35);overflow:hidden}.ays-survey-footer-banner-bottom-banner-code,.ays-survey-footer-banner-bottom-banner-content,.ays-survey-footer-banner-bottom-banner-inner,.ays-survey-footer-banner-bottom-banner-left{display:flex;align-items:center}.ays-survey-footer-banner-bottom-banner-inner{gap:16px;padding:8px 14px 8px 10px;color:#fff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}.ays-survey-footer-banner-bottom-banner-left{gap:14px}.ays-survey-footer-banner-bottom-banner-icon{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:48px;height:48px;border-radius:50%;background:rgba(255,255,255,.15);color:#fff}.ays-survey-footer-banner-bottom-banner-icon svg{width:24px;height:24px}.ays-survey-footer-banner-bottom-banner-discount,.ays-survey-footer-banner-bottom-banner-title{font-size:17px;font-weight:600;line-height:1.25;letter-spacing:0;white-space:nowrap;color:#fff}.ays-survey-footer-banner-bottom-banner-separator{display:block;width:1px;height:24px;background:rgba(255,255,255,.4)}.ays-survey-footer-banner-bottom-banner-code{gap:6px;border:1px dashed rgba(255,255,255,.7);border-radius:999px;padding:6px 9px;color:#fff;cursor:pointer;transition:background-color .15s,border-color .15s}.ays-survey-footer-banner-bottom-banner-code:hover{background:rgba(255,255,255,.1);border-color:#fff}.ays-survey-footer-banner-bottom-banner-code button svg,.ays-survey-footer-banner-bottom-banner-code>svg{width:16px;height:16px}.ays-survey-footer-banner-bottom-banner-code span{font-size:14px;font-weight:600;line-height:1;letter-spacing:.05em;color:#fff}.ays-survey-footer-banner-bottom-banner-close,.ays-survey-footer-banner-bottom-banner-copy{display:flex;align-items:center;justify-content:center;margin:0;padding:0;background:0 0;border:0;color:rgba(255,255,255,.9);cursor:pointer;box-shadow:none;transition:color .15s,background-color .15s}.ays-survey-footer-banner-bottom-banner-close:hover,.ays-survey-footer-banner-bottom-banner-copy:hover{color:#fff;background:0 0}.ays-survey-footer-banner-bottom-banner-wrapper .ays-survey-footer-banner-bottom-banner-cta{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 20px;border:0;border-radius:999px;background:#fff;color:#2f6bff;font-size:15px;font-weight:600;line-height:1;white-space:nowrap;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.08);transition:background-color .15s,transform .15s}.ays-survey-footer-banner-bottom-banner-wrapper .ays-survey-footer-banner-bottom-banner-cta:hover{background:rgba(255,255,255,.95);color:#2f6bff;transform:translateY(-1px)}.ays-survey-footer-banner-bottom-banner-close{width:22px;height:22px;margin-left:2px}.ays-survey-footer-banner-bottom-banner-close svg{width:20px;height:20px}.ays-survey-footer-banner-copy-notification{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,.8);color:#fff;padding:12px 24px;border-radius:8px;font-size:14px;z-index:10000;opacity:0;transition:opacity .3s}.ays-survey-footer-banner-copy-notification.show{opacity:1}@media (max-width:768px){.ays-survey-footer-banner-bottom-banner-wrapper{display:none}}'; | |
| 3908 | + $content[] = '</style>'; | |
| 3909 | + | |
| 3910 | + $content[] = '<script>'; | |
| 3911 | + | |
| 3912 | + $content[] = " | |
| 3913 | + /** | |
| 3914 | + * Footer Banner JavaScript - ES5 Compatible | |
| 3915 | + * With delayed popup and visit tracking | |
| 3916 | + */ | |
| 3917 | + | |
| 3918 | + (function() { | |
| 3919 | + 'use strict'; | |
| 3920 | + | |
| 3921 | + // Configuration | |
| 3922 | + var STORAGE_KEY = 'ays_survey_footer_banner_data'; | |
| 3923 | + var POPUP_RULES = [ | |
| 3924 | + { visit: 1, delay: 10000 }, // 1st visit: 10 seconds | |
| 3925 | + { visit: 2, delay: 10000 }, // 2nd visit: 10 seconds | |
| 3926 | + { visit: 3, delay: 15000 }, // 3th visit: 15 seconds | |
| 3927 | + { visit: 4, delay: 15000 }, // 4th visit: 15 seconds | |
| 3928 | + { visit: 5, delay: 20000 }, // 5th visit: 20 seconds | |
| 3929 | + { visit: 7, delay: 20000 }, // 7th visit: 20 seconds | |
| 3930 | + { visit: 10, delay: 30000 } // 10th visit: 30 seconds | |
| 3931 | + ]; | |
| 3932 | + var MAX_SHOWS_PER_DAY = 7; | |
| 3933 | + | |
| 3934 | + // Wait for DOM to be ready | |
| 3935 | + if (document.readyState === 'loading') { | |
| 3936 | + document.addEventListener('DOMContentLoaded', initBanner); | |
| 3937 | + } else { | |
| 3938 | + initBanner(); | |
| 3939 | + } | |
| 3940 | + | |
| 3941 | + function initBanner() { | |
| 3942 | + var banner = document.querySelector('.ays-survey-footer-banner-bottom-banner-wrapper'); | |
| 3943 | + var closeButton = document.querySelector('.ays-survey-footer-banner-bottom-banner-close'); | |
| 3944 | + var ctaButton = document.querySelector('.ays-survey-footer-banner-bottom-banner-cta'); | |
| 3945 | + | |
| 3946 | + if (!banner) { | |
| 3947 | + return; | |
| 3948 | + } | |
| 3949 | + | |
| 3950 | + // Hide banner initially | |
| 3951 | + banner.style.display = 'none'; | |
| 3952 | + | |
| 3953 | + // Get or initialize banner data | |
| 3954 | + var bannerData = getBannerData(); | |
| 3955 | + | |
| 3956 | + // Check if we need to reset daily data | |
| 3957 | + if (shouldResetData(bannerData.lastResetDate)) { | |
| 3958 | + bannerData = resetDailyData(); | |
| 3959 | + } | |
| 3960 | + | |
| 3961 | + // Increment visit count | |
| 3962 | + bannerData.visitCount++; | |
| 3963 | + saveBannerData(bannerData); | |
| 3964 | + | |
| 3965 | + // Check if banner should be shown | |
| 3966 | + var shouldShow = shouldShowBanner(bannerData); | |
| 3967 | + | |
| 3968 | + if (shouldShow.show) { | |
| 3969 | + // Show banner after delay | |
| 3970 | + setTimeout(function() { | |
| 3971 | + banner.style.display = 'block'; | |
| 3972 | + | |
| 3973 | + // Increment show count | |
| 3974 | + bannerData.showCount++; | |
| 3975 | + saveBannerData(bannerData); | |
| 3976 | + }, shouldShow.delay); | |
| 3977 | + } | |
| 3978 | + | |
| 3979 | + // Close button handler | |
| 3980 | + if (closeButton) { | |
| 3981 | + closeButton.addEventListener('click', function() { | |
| 3982 | + closeBanner(banner); | |
| 3983 | + }); | |
| 3984 | + } | |
| 3985 | + | |
| 3986 | + // CTA button handler | |
| 3987 | + if (ctaButton) { | |
| 3988 | + ctaButton.addEventListener('click', function() { | |
| 3989 | + window.open('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=private-offer-20-off-". SURVEY_MAKER_VERSION ."#ays-pro-sm-plans-box-sg', '_blank'); | |
| 3990 | + // Optionally close banner after click | |
| 3991 | + closeBanner(banner); | |
| 3992 | + }); | |
| 3993 | + } | |
| 3994 | + } | |
| 3995 | + | |
| 3996 | + /** | |
| 3997 | + * Get banner data from localStorage | |
| 3998 | + */ | |
| 3999 | + function getBannerData() { | |
| 4000 | + try { | |
| 4001 | + var data = localStorage.getItem(STORAGE_KEY); | |
| 4002 | + if (data) { | |
| 4003 | + return JSON.parse(data); | |
| 4004 | + } | |
| 4005 | + } catch (e) { | |
| 4006 | + // localStorage not available or parsing error | |
| 4007 | + } | |
| 4008 | + | |
| 4009 | + // Return default data | |
| 4010 | + return { | |
| 4011 | + visitCount: 0, | |
| 4012 | + showCount: 0, | |
| 4013 | + lastResetDate: getTodayDate() | |
| 4014 | + }; | |
| 4015 | + } | |
| 4016 | + | |
| 4017 | + /** | |
| 4018 | + * Save banner data to localStorage | |
| 4019 | + */ | |
| 4020 | + function saveBannerData(data) { | |
| 4021 | + try { | |
| 4022 | + localStorage.setItem(STORAGE_KEY, JSON.stringify(data)); | |
| 4023 | + } catch (e) { | |
| 4024 | + // localStorage not available | |
| 4025 | + } | |
| 4026 | + } | |
| 4027 | + | |
| 4028 | + /** | |
| 4029 | + * Check if data should be reset (new day) | |
| 4030 | + */ | |
| 4031 | + function shouldResetData(lastResetDate) { | |
| 4032 | + var today = getTodayDate(); | |
| 4033 | + return lastResetDate !== today; | |
| 4034 | + } | |
| 4035 | + | |
| 4036 | + /** | |
| 4037 | + * Reset daily data | |
| 4038 | + */ | |
| 4039 | + function resetDailyData() { | |
| 4040 | + var newData = { | |
| 4041 | + visitCount: 0, | |
| 4042 | + showCount: 0, | |
| 4043 | + lastResetDate: getTodayDate() | |
| 4044 | + }; | |
| 4045 | + saveBannerData(newData); | |
| 4046 | + return newData; | |
| 4047 | + } | |
| 4048 | + | |
| 4049 | + /** | |
| 4050 | + * Get today's date as string (YYYY-MM-DD) | |
| 4051 | + */ | |
| 4052 | + function getTodayDate() { | |
| 4053 | + var date = new Date(); | |
| 4054 | + var year = date.getFullYear(); | |
| 4055 | + var month = String(date.getMonth() + 1).padStart(2, '0'); | |
| 4056 | + var day = String(date.getDate()).padStart(2, '0'); | |
| 4057 | + return year + '-' + month + '-' + day; | |
| 4058 | + } | |
| 4059 | + | |
| 4060 | + /** | |
| 4061 | + * Check if banner should be shown based on rules | |
| 4062 | + */ | |
| 4063 | + function shouldShowBanner(bannerData) { | |
| 4064 | + // Check if already shown max times today | |
| 4065 | + if (bannerData.showCount >= MAX_SHOWS_PER_DAY) { | |
| 4066 | + return { show: false, delay: 0 }; | |
| 4067 | + } | |
| 4068 | + | |
| 4069 | + // Check visit count against rules | |
| 4070 | + for (var i = 0; i < POPUP_RULES.length; i++) { | |
| 4071 | + var rule = POPUP_RULES[i]; | |
| 4072 | + if (bannerData.visitCount === rule.visit) { | |
| 4073 | + return { show: true, delay: rule.delay }; | |
| 4074 | + } | |
| 4075 | + } | |
| 4076 | + | |
| 4077 | + return { show: false, delay: 0 }; | |
| 4078 | + } | |
| 4079 | + | |
| 4080 | + /** | |
| 4081 | + * Close banner with animation | |
| 4082 | + */ | |
| 4083 | + function closeBanner(banner) { | |
| 4084 | + if (!banner) { | |
| 4085 | + return; | |
| 4086 | + } | |
| 4087 | + | |
| 4088 | + // Add closing animation class | |
| 4089 | + banner.classList.add('ays-pro-banner-closing'); | |
| 4090 | + | |
| 4091 | + // Wait for animation to complete | |
| 4092 | + setTimeout(function() { | |
| 4093 | + banner.style.display = 'none'; | |
| 4094 | + }, 400); | |
| 4095 | + } | |
| 4096 | + | |
| 4097 | + // Polyfill for String.padStart (for older browsers) | |
| 4098 | + if (!String.prototype.padStart) { | |
| 4099 | + String.prototype.padStart = function(targetLength, padString) { | |
| 4100 | + targetLength = targetLength >> 0; | |
| 4101 | + padString = String(typeof padString !== 'undefined' ? padString : ' '); | |
| 4102 | + if (this.length >= targetLength) { | |
| 4103 | + return String(this); | |
| 4104 | + } else { | |
| 4105 | + targetLength = targetLength - this.length; | |
| 4106 | + if (targetLength > padString.length) { | |
| 4107 | + padString += padString.repeat(targetLength / padString.length); | |
| 4108 | + } | |
| 4109 | + return padString.slice(0, targetLength) + String(this); | |
| 4110 | + } | |
| 4111 | + }; | |
| 4112 | + } | |
| 4113 | + })(); | |
| 4114 | + | |
| 4115 | + function aysSurveyFooterBannerCopyToClipboard() { | |
| 4116 | + var textarea = document.createElement('textarea'); | |
| 4117 | + textarea.value = 'SURVEYPRO20'; | |
| 4118 | + textarea.style.position = 'fixed'; | |
| 4119 | + textarea.style.opacity = '0'; | |
| 4120 | + document.body.appendChild(textarea); | |
| 4121 | + | |
| 4122 | + textarea.select(); | |
| 4123 | + textarea.setSelectionRange(0, 99999); | |
| 4124 | + | |
| 4125 | + try { | |
| 4126 | + document.execCommand('copy'); | |
| 4127 | + aysSurveyFooterBannerShowCopyNotification('". esc_html__('Coupon code copied', 'survey-maker') ."'); | |
| 4128 | + } catch (err) { | |
| 4129 | + console.error('Failed to copy text: ', err); | |
| 4130 | + } | |
| 4131 | + | |
| 4132 | + document.body.removeChild(textarea); | |
| 4133 | + } | |
| 4134 | + | |
| 4135 | + function aysSurveyFooterBannerShowCopyNotification(message) { | |
| 4136 | + var existingNotification = document.querySelector('.ays-survey-footer-banner-copy-notification'); | |
| 4137 | + if (existingNotification) { | |
| 4138 | + document.body.removeChild(existingNotification); | |
| 4139 | + } | |
| 4140 | + | |
| 4141 | + var notification = document.createElement('div'); | |
| 4142 | + notification.className = 'ays-survey-footer-banner-copy-notification'; | |
| 4143 | + notification.textContent = message; | |
| 4144 | + document.body.appendChild(notification); | |
| 4145 | + | |
| 4146 | + setTimeout(function() { | |
| 4147 | + notification.classList.add('show'); | |
| 4148 | + }, 10); | |
| 4149 | + | |
| 4150 | + setTimeout(function() { | |
| 4151 | + notification.classList.remove('show'); | |
| 4152 | + setTimeout(function() { | |
| 4153 | + if (notification.parentNode) { | |
| 4154 | + document.body.removeChild(notification); | |
| 4155 | + } | |
| 4156 | + }, 300); | |
| 4157 | + }, 2000); | |
| 4158 | + }"; | |
| 4159 | + | |
| 4160 | + $content[] = '</script>'; | |
| 4161 | + | |
| 4162 | + $content = implode( '', $content ); | |
| 4163 | + echo ($content); | |
| 4164 | + } | |
| 3708 | 4165 | } |
| 3709 | 4166 | |
| 3710 | 4167 | |
| 3711 | 4168 | // public function ays_survey_new_mega_bundle_message_2024($ishmar){ |