Changeset 994181
- Timestamp:
- 09/21/2014 12:44:17 PM (11 years ago)
- File:
-
- 1 edited
-
sticky-popup/trunk/class-sticky-popup.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sticky-popup/trunk/class-sticky-popup.php
r983626 r994181 48 48 49 49 /** 50 * Stores popup active status 51 * 52 * @since 1.1 53 * 54 * @var string 55 */ 56 protected $popup_active; 57 58 /** 50 59 * Stores popup title option 51 60 * … … 153 162 public function __construct() { 154 163 164 $this->popup_active = get_option( 'sp_popup_active' ); 155 165 $this->popup_title = get_option( 'sp_popup_title' ); 156 166 $this->popup_title_color = get_option( 'sp_popup_title_color' ); … … 183 193 184 194 $show_sticky_poup=false; 185 if($this-> show_on_homepage!=1 && $this->show_on_posts!=1 && $this->show_on_pages!=1)195 if($this->popup_active) 186 196 { 187 $show_sticky_poup=true; 188 189 } 190 else 191 { 192 if( $this->show_on_homepage==1 && is_front_page() ) 193 { 194 $show_sticky_poup=true; 195 } 196 if( $this->show_on_posts==1 && ( is_single() || is_home() || is_archive() ) ) 197 { 198 $show_sticky_poup=true; 199 } 200 if( $this->show_on_pages==1 && is_page() ) 197 if($this->show_on_homepage!=1 && $this->show_on_posts!=1 && $this->show_on_pages!=1 ) 201 198 { 202 199 $show_sticky_poup=true; 203 } 204 } 205 if($show_sticky_poup) 206 { 207 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 208 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 209 add_action( 'wp_head', array( $this, 'head_styles' ) ); 210 add_filter( 'wp_footer', array( $this, 'get_sticky_popup' ) ); 211 add_action( 'wp_footer', array( $this, 'footer_scripts' ) ); 200 201 } 202 else 203 { 204 if( $this->show_on_homepage==1 && is_front_page() ) 205 { 206 $show_sticky_poup=true; 207 } 208 if( $this->show_on_posts==1 && ( is_single() || is_home() || is_archive() ) ) 209 { 210 $show_sticky_poup=true; 211 } 212 if( $this->show_on_pages==1 && is_page() ) 213 { 214 $show_sticky_poup=true; 215 } 216 } 217 if($show_sticky_poup) 218 { 219 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 220 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 221 add_action( 'wp_head', array( $this, 'head_styles' ) ); 222 add_filter( 'wp_footer', array( $this, 'get_sticky_popup' ) ); 223 add_action( 'wp_footer', array( $this, 'footer_scripts' ) ); 224 } 212 225 } 213 226 } … … 301 314 if ( ! empty( $_POST ) && check_admin_referer( 'sticky_popup', 'save_sticky_popup' ) ) { 302 315 316 317 318 319 //add or update sticky popup active stats 320 if ( $this->popup_active !== false ) { 321 update_option( 'sp_popup_active', $_POST['popup_active'] ); 322 } else { 323 add_option( 'sp_popup_active', $_POST['popup_active'], null, 'no' ); 324 } 325 303 326 //add or update sticky popup title options 304 327 if ( $this->popup_title !== false ) { … … 382 405 <div class="sticky_popup_form"> 383 406 <table class="form-table" width="100%"> 407 <tr> 408 <th scope="row"></th> 409 <td> 410 <input type="checkbox" name="popup_active" id="popup_active" value="1" <?php if($this->popup_active) echo 'checked="checked"'; else '';?>> <label for="popup_active"><strong><?php _e( 'Enable', 'sticky-popup' );?></strong></label></td> 411 </tr> 384 412 <tr> 385 413 <th scope="row"><label for="popup_title"><?php _e( 'Popup Title', 'sticky-popup' );?></label></th> … … 510 538 */ 511 539 public function get_sticky_popup(){ 540 $this->popup_active = get_option( 'sp_popup_active' ); 512 541 $this->popup_place = get_option( 'sp_popup_place' ); 513 542 $this->popup_title = get_option( 'sp_popup_title' );
Note: See TracChangeset
for help on using the changeset viewer.