Plugin Directory

Changeset 2296858


Ignore:
Timestamp:
05/02/2020 11:14:22 PM (6 years ago)
Author:
wprequal
Message:

Commit v7.6.4

Location:
wprequal/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wprequal/trunk/app/classes/class.Core.php

    r2277715 r2296858  
    480480        return join( ';', array(
    481481            "{$this->cookie_name()}={$value}",
    482             'expires=' . $expires,
     482            'expires=' . $this->cookie_date( $expires ),
    483483            'path=/'
    484484        ) );
    485485
     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 );
    486498    }
    487499
  • wprequal/trunk/app/classes/class.SurveyForm.php

    r2285924 r2296858  
    495495        global $wprequal;
    496496
    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 ) ) {
    508514                        return FALSE;
    509                     }
    510 
    511515                }
    512516
    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
    522527
    523528        return FALSE;
  • wprequal/trunk/app/classes/class.SurveyFormAdmin.php

    r2286071 r2296858  
    3838        add_action( 'admin_menu', array( $this, 'replace_submit_meta_box' ) );
    3939        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' ) );
    4041        add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
    4142        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 );
    4244
    4345        add_filter( "bulk_actions-edit-{$this->post_type}", array( $this, 'custom_bulk_actions' ), 99 );
     
    335337
    336338    }
     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    }
    337418   
    338419}
  • wprequal/trunk/readme.txt

    r2286071 r2296858  
    159159== Change Log ==
    160160
     161= 7.6.4 =
     162* Bug Fix - Format cookie for JS
     163* Improvement - Add survey popup option for single posts or pages.
     164
    161165= 7.6.3 =
    162166* Improvement - Add back link text settings
  • wprequal/trunk/wprequal.php

    r2286071 r2296858  
    44Plugin URI:  https://wprequal.com
    55Description: Mortgage and Real Estate Lead Capture System
    6 Version:     7.6.3
     6Version:     7.6.4
    77Author:      WPrequal
    88Author URI:  https://wprequal.com
     
    3030// Defines
    3131$defines = array(
    32     'WPREQUAL_VERSION'            => '7.6.3',
     32    'WPREQUAL_VERSION'            => '7.6.4',
    3333    'WPREQUAL_OPTIONS'            => 'wprequal_options',
    3434    'WPREQUAL_ACCESS_TOKEN_KEY'   => 'wprequal_access_token',
Note: See TracChangeset for help on using the changeset viewer.