Changeset 2296858
- Timestamp:
- 05/02/2020 11:14:22 PM (6 years ago)
- Location:
- wprequal/trunk
- Files:
-
- 5 edited
-
app/classes/class.Core.php (modified) (1 diff)
-
app/classes/class.SurveyForm.php (modified) (1 diff)
-
app/classes/class.SurveyFormAdmin.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
wprequal.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wprequal/trunk/app/classes/class.Core.php
r2277715 r2296858 480 480 return join( ';', array( 481 481 "{$this->cookie_name()}={$value}", 482 'expires=' . $ expires,482 'expires=' . $this->cookie_date( $expires ), 483 483 'path=/' 484 484 ) ); 485 485 486 } 487 488 /** 489 * Formatted cookie date. 490 * 491 * @param $expires 492 * 493 * @return false|string 494 */ 495 496 public function cookie_date( $expires ) { 497 return date( 'D, d M Y H:i:s e', $expires ); 486 498 } 487 499 -
wprequal/trunk/app/classes/class.SurveyForm.php
r2285924 r2296858 495 495 global $wprequal; 496 496 497 if ( ! isset( $_COOKIE[$wprequal->cookie_name()] ) ) { 498 499 if ( is_front_page() && 'checked' === get_option( 'wprequal_show_home' ) ) { 500 return TRUE; 501 } 502 503 elseif ( is_page() && 'checked' === get_option( 'wprequal_show_page' ) ) { 504 505 if ( $page_on_front = get_option( 'page_on_front' ) ) { 506 507 if ( is_page( $page_on_front ) ) { 497 if ( isset( $_COOKIE[$wprequal->cookie_name()] ) ) { 498 return FALSE; 499 } 500 501 if ( ( is_single() || is_page() ) && get_post_meta( get_the_ID(), 'wpq_survey_form', TRUE ) ) { 502 return TRUE; 503 } 504 505 if ( is_front_page() && 'checked' === get_option( 'wprequal_show_home' ) ) { 506 return TRUE; 507 } 508 509 if ( is_page() && 'checked' === get_option( 'wprequal_show_page' ) ) { 510 511 if ( $page_on_front = get_option( 'page_on_front' ) ) { 512 513 if ( is_page( $page_on_front ) ) { 508 514 return FALSE; 509 }510 511 515 } 512 516 513 return TRUE; 514 515 } 516 517 elseif ( is_single() && 'checked' === get_option( 'wprequal_show_post' ) ) { 518 return TRUE; 519 } 520 521 } 517 } 518 519 return TRUE; 520 521 } 522 523 if ( is_single() && 'checked' === get_option( 'wprequal_show_post' ) ) { 524 return TRUE; 525 } 526 522 527 523 528 return FALSE; -
wprequal/trunk/app/classes/class.SurveyFormAdmin.php
r2286071 r2296858 38 38 add_action( 'admin_menu', array( $this, 'replace_submit_meta_box' ) ); 39 39 add_action( "add_meta_boxes_{$this->post_type}", array( $this, 'add_meta_box' ) ); 40 add_action( 'add_meta_boxes', array( $this, 'add_popup_meta_box' ) ); 40 41 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); 41 42 add_action( "save_post_{$this->post_type}", array( $this, 'save_slides' ), 10, 1 ); 43 add_action( "save_post", array( $this, 'save_survey_popup' ), 10, 1 ); 42 44 43 45 add_filter( "bulk_actions-edit-{$this->post_type}", array( $this, 'custom_bulk_actions' ), 99 ); … … 335 337 336 338 } 339 340 /** 341 * Add popup meta box. 342 */ 343 344 public function add_popup_meta_box() { 345 346 add_meta_box( 347 'survey_form_popup', 348 __( 'WPrequal Survey Popup', 'wprequal' ), 349 array( $this, 'popup_meta_box'), 350 null, 351 'side' 352 ); 353 354 } 355 356 /** 357 * Popup meta box. 358 * 359 * @param $post 360 */ 361 362 public function popup_meta_box( $post ) { 363 364 $args = array( 365 'post_type' => 'wpq_survey_form', 366 'name' => 'wpq_survey_form', 367 'class' => 'wpq-survey-form', 368 'id' => 'post_id', 369 'show_option_none' => __( 'Select One', 'wprequal' ), 370 'option_none_value' => -1, 371 'selected' => get_post_meta( $post->ID, 'wpq_survey_form', TRUE ) 372 ); 373 374 wp_dropdown_pages( $args ); 375 376 wp_nonce_field( 'wpq_survey_form', 'wpq_survey_form_nonce' ); 377 378 } 379 380 /** 381 * Save survey popup. 382 * 383 * @param $post_id 384 */ 385 public function save_survey_popup( $post_id ) { 386 387 global $wprequal; 388 389 if ( ! current_user_can( WPREQUAL_CAP ) ) { 390 return; 391 } 392 393 if ( ! is_admin() ) { 394 return; 395 } 396 397 if ( ! check_admin_referer( 'wpq_survey_form', 'wpq_survey_form_nonce' ) ) { 398 return; 399 } 400 401 if ( isset( $_POST['wpq_survey_form'] ) ) { 402 403 $survey_id = absint( $_POST['wpq_survey_form'] ); 404 405 if ( 0 < $survey_id ) { 406 407 update_post_meta( $post_id, 'wpq_survey_form', $survey_id ); 408 409 } else { 410 411 delete_post_meta( $post_id, 'wpq_survey_form' ); 412 413 } 414 415 } 416 417 } 337 418 338 419 } -
wprequal/trunk/readme.txt
r2286071 r2296858 159 159 == Change Log == 160 160 161 = 7.6.4 = 162 * Bug Fix - Format cookie for JS 163 * Improvement - Add survey popup option for single posts or pages. 164 161 165 = 7.6.3 = 162 166 * Improvement - Add back link text settings -
wprequal/trunk/wprequal.php
r2286071 r2296858 4 4 Plugin URI: https://wprequal.com 5 5 Description: Mortgage and Real Estate Lead Capture System 6 Version: 7.6. 36 Version: 7.6.4 7 7 Author: WPrequal 8 8 Author URI: https://wprequal.com … … 30 30 // Defines 31 31 $defines = array( 32 'WPREQUAL_VERSION' => '7.6. 3',32 'WPREQUAL_VERSION' => '7.6.4', 33 33 'WPREQUAL_OPTIONS' => 'wprequal_options', 34 34 'WPREQUAL_ACCESS_TOKEN_KEY' => 'wprequal_access_token',
Note: See TracChangeset
for help on using the changeset viewer.