Changeset 1676057
- Timestamp:
- 06/11/2017 05:38:57 PM (9 years ago)
- Location:
- choyal-subscription-popup/tags/2.0
- Files:
-
- 2 edited
-
csp-settings.php (modified) (3 diffs)
-
plugin.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
choyal-subscription-popup/tags/2.0/csp-settings.php
r1675416 r1676057 20 20 21 21 <tr> 22 <th scope="row"><label for="csp_popup_disable">Disable Popup</label></th> 23 <td><input name="csp_popup_disable" type="checkbox" id="csp_popup_disable" value="yes" <?php if( sanitize_text_field( get_option('disable-popup') ) == 'yes' ){ echo 'checked'; } ?> ></td> 24 </tr> 25 26 <tr> 27 <th scope="row"><label for="csp_hide_popup_login_users">Hide Popup for loggedin users</label></th> 28 <td><input name="csp_hide_popup_login_users" type="checkbox" id="csp_hide_popup_login_users" value="yes" <?php if( sanitize_text_field( get_option('csp-hide-popup-login-users') ) == 'yes' ){ echo 'checked'; } ?> ></td> 29 </tr> 30 31 <tr> 32 <th scope="row"><label for="csp_popup_fname_lname">Disable First/Last Name field</label></th> 33 <td> 34 <input name="csp_popup_fname_lname" type="checkbox" id="csp_popup_fname_lname" value="yes" <?php if( sanitize_text_field( get_option('disable-fname-lname') ) == 'yes' ){ echo 'checked'; } ?> > 35 </td> 36 </tr> 37 38 <tr> 22 39 <th scope="row"><label for="csp_popup_title">Popup Title</label></th> 23 40 <td><input name="csp_popup_title" type="text" id="csp_popup_title" value="<?php echo esc_html( stripslashes( get_option('csp-popup-title') ) ); ?>" placeholder="Join our subscribers" class="regular-text code"> … … 29 46 <td> 30 47 <textarea name="csp_popup_text" id="csp_popup_text" placeholder="Sign up here and we'll keep you in the loop on all things product" class="regular-text code" ><?php echo esc_textarea( stripslashes( get_option('csp-popup-text') ) ); ?></textarea> 31 </td>32 </tr>33 34 <tr>35 <th scope="row"><label for="csp_popup_disable">Disable Popup</label></th>36 <td><input name="csp_popup_disable" type="checkbox" id="csp_popup_disable" value="yes" <?php if( sanitize_text_field( get_option('disable-popup') ) == 'yes' ){ echo 'checked'; } ?> ></td>37 </tr>38 39 <tr>40 <th scope="row"><label for="csp_popup_fname_lname">Disable First/Last Name field's in Subscription form</label></th>41 <td>42 <input name="csp_popup_fname_lname" type="checkbox" id="csp_popup_fname_lname" value="yes" <?php if( sanitize_text_field( get_option('disable-fname-lname') ) == 'yes' ){ echo 'checked'; } ?> >43 48 </td> 44 49 </tr> … … 55 60 56 61 </tbody></table> 57 58 <hr>59 62 60 63 <div class="csp-mailchimp-setting"> -
choyal-subscription-popup/tags/2.0/plugin.php
r1675421 r1676057 17 17 function csp_enqueue_style() { 18 18 19 $disablePopup = get_option('disable-popup'); 20 21 if( !$disablePopup || $disablePopup == 'no' ){ 22 23 wp_enqueue_style( 'csp-style', CSP_ASSETS_PATH. 'css/style.css', false ); 19 if( csp_popup_trigger_display_setting() ){ 20 21 wp_enqueue_style( 'csp-style', CSP_ASSETS_PATH. 'css/style.css', false ); 24 22 25 23 } … … 29 27 function csp_enqueue_script() { 30 28 31 $disablePopup = get_option('disable-popup'); 32 33 if( !$disablePopup || $disablePopup == 'no' ){ 29 if( csp_popup_trigger_display_setting() ){ 34 30 35 31 wp_enqueue_script( 'csp-js-validate', CSP_ASSETS_PATH. 'js/jquery.validate.min.js', array('jquery', 'csp-js'), '1.0.0', true ); … … 53 49 $textPopup = esc_textarea( stripslashes( get_option('csp-popup-text') ) ); 54 50 55 $disablePopup = get_option('disable-popup');56 51 $disableFnameLname = get_option('disable-fname-lname'); 57 52 58 if( !$disablePopup || $disablePopup == 'no'){53 if( csp_popup_trigger_display_setting() ){ 59 54 60 55 ?> … … 142 137 function csp_design_setting(){ 143 138 144 if( esc_html( get_option('csp-popup-overlay') ) == 'yes' ){ 145 146 $overlay = true; 147 148 }else{ 149 150 $overlay = false; 151 152 } 153 154 if( floatval( get_option('csp-background-overlay-transparency') ) > 0 ){ 155 156 $opacity = floatval( get_option('csp-background-overlay-transparency') ); 157 158 }else{ 159 160 $opacity = '0.4'; 161 162 } 163 164 $style = '<style>'; 165 166 if( $overlay ){ 167 168 $style .= '.csp_overlay{ 169 width: 100%; 170 height:1200px; 171 position: fixed; 172 background: rgba(0,0,0,'. $opacity .'); 173 z-index: 99999999; 174 top: 0; 175 left: 0; 176 }'; 177 178 } 179 180 $style .= '</style>'; 181 182 echo $style; 139 if( csp_popup_trigger_display_setting() ){ 140 141 if( esc_html( get_option('csp-popup-overlay') ) == 'yes' ){ 142 143 $overlay = true; 144 145 }else{ 146 147 $overlay = false; 148 149 } 150 151 if( floatval( get_option('csp-background-overlay-transparency') ) > 0 ){ 152 153 $opacity = floatval( get_option('csp-background-overlay-transparency') ); 154 155 }else{ 156 157 $opacity = '0.4'; 158 159 } 160 161 $style = '<style>'; 162 163 if( $overlay ){ 164 165 $style .= '.csp_overlay{ 166 width: 100%; 167 height:1200px; 168 position: fixed; 169 background: rgba(0,0,0,'. $opacity .'); 170 z-index: 99999999; 171 top: 0; 172 left: 0; 173 }'; 174 175 } 176 177 $style .= '</style>'; 178 179 echo $style; 180 181 } 183 182 184 183 } … … 526 525 } 527 526 527 //Hide popup for loggedin user setting option 528 if( sanitize_text_field( $_POST['csp_hide_popup_login_users'] )!='' ){ 529 530 $arySettings['csp-hide-popup-login-users'] = sanitize_text_field( $_POST['csp_hide_popup_login_users'] ); 531 532 }else{ 533 534 $arySettings['csp-hide-popup-login-users'] = 'no'; 535 536 } 537 528 538 if( sanitize_text_field( $_POST['csp_popup_mailchimp_integration'] )!='' ){ 529 539 … … 915 925 916 926 add_action( 'wp_ajax_csp_search_subscribers', 'csp_search_subscribers' ); 927 928 //check popup show or hide setting 929 function csp_popup_trigger_display_setting(){ //Return true/false to show popup 930 931 $showPopup = false; 932 933 $disablePopup = get_option('disable-popup'); 934 935 if( !$disablePopup || $disablePopup == 'no' ){ 936 937 $hidePopupLoggedin = get_option('csp-hide-popup-login-users'); 938 939 if( $hidePopupLoggedin == 'yes' ){ 940 941 if( !is_user_logged_in() ){ 942 943 $showPopup = true; 944 945 } 946 947 }else{ 948 949 $showPopup = true; 950 951 } 952 953 } 954 955 return $showPopup; 956 957 }
Note: See TracChangeset
for help on using the changeset viewer.