Plugin Directory

Changeset 1676910


Ignore:
Timestamp:
06/12/2017 06:16:56 PM (9 years ago)
Author:
gchoyal1
Message:

Plugin setting update

Location:
choyal-subscription-popup/tags/2.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • choyal-subscription-popup/tags/2.0/csp-settings.php

    r1676057 r1676910  
    2727            <th scope="row"><label for="csp_hide_popup_login_users">Hide Popup for loggedin users</label></th>
    2828            <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_show_popup_pages">Show popup on selected page's/Archive's</label></th>
     33            <td>
     34                <select name="csp_show_popup_pages[]" id="csp_show_popup_pages" multiple >
     35                   
     36                    <option value=""<?php if( is_array( unserialize( get_option('csp-show-popup-pages') ) ) && in_array( '', unserialize( get_option('csp-show-popup-pages') ) ) ){ echo 'selected'; } ?> >Show EveryWhere</option>
     37                   
     38                    <option value="home-homepage" <?php if( is_array( unserialize( get_option('csp-show-popup-pages') ) ) && in_array( 'home-homepage', unserialize( get_option('csp-show-popup-pages') ) ) ){ echo 'selected'; } ?> >Homepage</option>
     39                   
     40                    <?php $args = array( 'public'   => true );
     41                   
     42                    $cspLoopPostTypes = get_post_types( $args, 'name' );
     43                   
     44                    foreach( $cspLoopPostTypes as $cspPostType ){ ?>
     45                   
     46                        <option value="archive-<?php echo $cspPostType->name; ?>" <?php if( is_array( unserialize( get_option('csp-show-popup-pages') ) ) && in_array( 'archive-'.$cspPostType->name, unserialize( get_option('csp-show-popup-pages') ) ) ){ echo 'selected'; } ?>>Archive: <?php echo $cspPostType->name; ?></option>
     47                       
     48                    <?php } ?>
     49                   
     50                    <?php foreach( get_pages() as $singlePage ){ ?>
     51                       
     52                        <option value="page-<?php echo $singlePage->ID; ?>" <?php if( is_array( unserialize( get_option('csp-show-popup-pages') ) ) && in_array( 'page-'.$singlePage->ID, unserialize( get_option('csp-show-popup-pages') ) ) ){ echo 'selected'; } ?>>Page: <?php echo $singlePage->post_title; ?></option>
     53                       
     54                    <?php } ?>
     55                   
     56                </select>
     57           
     58            </td>
    2959        </tr>
    3060       
  • choyal-subscription-popup/tags/2.0/plugin.php

    r1676057 r1676910  
    536536        }
    537537       
     538        //Show popup on slected pages
     539        if( is_array( $_POST['csp_show_popup_pages'] ) ){
     540               
     541            $aryShowPopupSet = array();
     542           
     543            foreach( $_POST['csp_show_popup_pages'] as $shoePopupPages ){
     544               
     545                $aryShowPopupSet[] = sanitize_text_field( $shoePopupPages ); // Sanitizing array values
     546               
     547            }
     548           
     549            $arySettings['csp-show-popup-pages'] = serialize($aryShowPopupSet);
     550       
     551        }
     552       
    538553        if( sanitize_text_field( $_POST['csp_popup_mailchimp_integration'] )!='' ){
    539554       
     
    935950    if( !$disablePopup || $disablePopup == 'no' ){
    936951       
    937         $hidePopupLoggedin = get_option('csp-hide-popup-login-users');
    938        
    939         if( $hidePopupLoggedin == 'yes' ){
    940            
    941             if( !is_user_logged_in() ){
    942                
     952        //Show on selected pages
     953        $aryCspShowOnPages = unserialize( get_option('csp-show-popup-pages') );
     954       
     955        $isShowPages = false;
     956       
     957        if( is_array( $aryCspShowOnPages ) ){
     958       
     959            foreach( $aryCspShowOnPages as $aryCspShowOn ){
     960               
     961                $aryTempPageTypeOnShow = explode( '-', $aryCspShowOn );
     962               
     963                switch( $aryTempPageTypeOnShow[0] ){
     964                   
     965                    case 'home':
     966                       
     967                        if( is_front_page() || is_home() ){
     968                           
     969                            $isShowPages = true;
     970                           
     971                        }
     972                       
     973                        break;
     974                       
     975                    case 'page':
     976                       
     977                        if( is_page() ){
     978                           
     979                            global $post;
     980                           
     981                            if( $aryCspShowOn == 'page-'.$post->ID ){
     982                           
     983                                $isShowPages = true;
     984                           
     985                            }
     986                           
     987                        }
     988                       
     989                        break; 
     990                   
     991                    case 'archive':
     992                       
     993                        global $wp_query;
     994                       
     995                        if( isset( $wp_query->query['post_type'] ) && $aryCspShowOn == 'archive-'.$wp_query->query['post_type'] ){
     996                           
     997                            $isShowPages = true;
     998                           
     999                        }
     1000                       
     1001                        break;
     1002                       
     1003                    case '':
     1004                   
     1005                        $isShowPages = true;
     1006                       
     1007                        break;
     1008                   
     1009                }
     1010               
     1011                if( $isShowPages ){ break; }
     1012               
     1013            }
     1014       
     1015        }else{
     1016           
     1017            $isShowPages = true;
     1018           
     1019        }
     1020       
     1021        if( $isShowPages ){
     1022       
     1023            //Check User Loggedin
     1024            $hidePopupLoggedin = get_option('csp-hide-popup-login-users');
     1025           
     1026            if( $hidePopupLoggedin == 'yes' ){
     1027               
     1028                if( !is_user_logged_in() ){
     1029                   
     1030                    $showPopup = true;
     1031                   
     1032                }
     1033               
     1034            }else{
     1035           
    9431036                $showPopup = true;
    944                
    945             }
    946            
    947         }else{
    948        
    949             $showPopup = true;
     1037           
     1038            }
    9501039       
    9511040        }
  • choyal-subscription-popup/tags/2.0/readme.txt

    r1676060 r1676910  
    20207. Add/remove First name and Last name field from popup
    21218. Show/Hide popup for loggein users
     229. Show Popup on selected pages, Post Type Archive and Homepage.
    2223
    2324== Description ==
     
    33347. Add/remove First name and Last name field from popup
    34358. Show/Hide popup for loggein users
     369. Show Popup on selected pages, Post Type Archive and Homepage.
    3537
    3638--------------------------------
     
    72744. Add/remove First name and Last name field from popup
    73755. Show/Hide popup setting for loggein users.
    74 
     766. Show Popup on selected pages, Post Type Archive and Homepage.
    7577
    7678== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.