Plugin Directory

Changeset 1934413


Ignore:
Timestamp:
09/01/2018 07:12:02 PM (7 years ago)
Author:
naminbd
Message:

Add new feature: add support for do_shortcode

Location:
smart-popup/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • smart-popup/trunk/readme.txt

    r1911798 r1934413  
    55Requires PHP: 5.2.4
    66Requires at least: 4.0
    7 Tested up to: 4.9.7
     7Tested up to: 4.9.1
    88Stable tag: trunk
    99License: GPLv2 or later
     
    1919For short code use: [wps-popup id="ID"] (you can see this in popup list, just copy & past)
    2020
     21For PHP hard code in your theme or template page, use:  do_shortcode("[wps-popup id='ID' inline='1']")
     22
    2123
    2224
     
    2527  * Use Custom post as popup.
    2628  * Use anywhere in your site.
     29  * Use as do_short code
    2730  * Use popup as Link
    2831  * Use Popup as button
     
    7073
    7174== Changelog ==
     75= 1.0.2 =
     76* [new] Short code support on theme and template page as php code.
     77* [new] Add "How to use" submenu for help. 
     78
    7279= 1.0.1 =
    73 * Fixed JavaScript error for auto load popup
    74  
     80* [fix] Fix some bug on popup load.
     81
    7582= 1.0.0 =
    7683* Initial release. 
     
    8895= How to hide popup shortcode from Post Excerpt?
    8996You can change settings from settings page for it.
     97
     98
     99
     100
  • smart-popup/trunk/smart-popup.php

    r1911795 r1934413  
    22/*
    33 * Plugin Name: Smart Popup
    4  * Version: 1.0.1
     4 * Version: 1.0.2
    55 * Plugin URI: 
    66 * Description: A Complete solution for the popup. You can add a stylish and easily add a popup for page auto load or link on page and post.   
     
    1212 * Text Domain: wpsp
    1313 * Domain Path: /lang/
    14  *
     14 * 
    1515 */
    1616
     
    4141        add_action('wp_enqueue_scripts', array($this, 'enqueue'));
    4242        add_action('wp_head', array($this, 'render_global_style'));
    43 
    44 
    4543        register_activation_hook(__FILE__, array($this, 'activate'));
    4644        register_deactivation_hook(__FILE__, array($this, 'deactivate'));
     
    8280
    8381        add_action('the_content', array($this, 'add_data_in_post_content'));
    84        
    8582    }
    8683
     
    166163        wp_enqueue_script('wps_popup_front', plugins_url('assets/js/script.js', __FILE__), '', false, true);
    167164        wp_enqueue_style('wps_popup_front', plugins_url('/assets/css/style.css', __FILE__));
    168         wp_enqueue_script('jquery-p-js', "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js",  array('jquery'),false, false);
    169         wp_enqueue_script('bootstrap-js', "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js",  array('jquery'),false, false);
    170        
     165        wp_enqueue_script('jquery-p-js', "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js", array('jquery'), false, false);
     166        wp_enqueue_script('bootstrap-js', "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js", array('jquery'), false, false);
     167
    171168        $act_theme = get_option('wpsp_active_theme');
    172169        wp_enqueue_style('wps_popup_front_theme', plugins_url('/assets/css/theme/' . $act_theme . '.css', __FILE__));
     
    198195
    199196        add_submenu_page('edit.php?post_type=' . $this->custom_post_name, __('Theme', $this->text_domain), __('Theme', $this->text_domain), $capability, __('theme', $this->text_domain), array($this, 'manage_menu_pages'));
    200         //add_submenu_page('edit.php?post_type=' . $this->custom_post_name, __('How To USE', $this->text_domain), __('How to Use', $this->text_domain), $capability, __('how_to_use', $this->text_domain), array($this, 'manage_menu_pages'));
     197        add_submenu_page('edit.php?post_type=' . $this->custom_post_name, __('How To USE', $this->text_domain), __('How to Use', $this->text_domain), $capability, __('how_to_use', $this->text_domain), array($this, 'manage_menu_pages'));
    201198        add_submenu_page('edit.php?post_type=' . $this->custom_post_name, __('WPSP Settings', $this->text_domain), __('Setting', $this->text_domain), $capability, __('global_settings', $this->text_domain), array($this, 'manage_menu_pages'));
    202199    }
     
    292289    function render_short_code($atts, $content = null) {
    293290
    294         if ( ! is_single() AND $this->global_setting['hide_in_excerpt'] == 'yes' ){
     291        if (!array_key_exists('inline', $atts))
     292            $atts['inline'] = false;
     293        if (!is_single() AND $this->global_setting['hide_in_excerpt'] == 'yes' AND ! $atts['inline']) {
    295294            return;
    296295        }
     
    300299            'id' => '',
    301300            'title' => '',
     301            'inline' => false
    302302                ), $atts);
    303303
    304304        extract($a);
    305 
     305        // var_dump($a);
    306306
    307307        if ($id) {
     
    312312        $metadata = get_post_meta($post->ID, $this->text_domain . '_popup_settings', TRUE);
    313313        $metadata = unserialize($metadata);
    314 
    315         ob_start();
    316314        $popup_type = $metadata['popup_type'];
     315        $html_output = '';
    317316
    318317        if ($metadata['load_on'] == 'onclick') {
     
    320319            $style = "style=' background-color:{$metadata['button_color']};  border-radius:{$metadata['button_border_radious']}px; border-color:{$metadata['button_color']}'";
    321320            $style = $metadata['show_as'] == 'button' ? $style : '';
    322             echo $data = "<a href='' {$style}  class=' {$class}' data-toggle='modal' data-target='#wpsp-{$id}'>{$title}</a>";
    323         }
    324 
    325         //include WPSP_PATH . '/view/frontend/popup.php';
    326 
    327         $output = ob_get_clean();
    328 
    329         return $output;
     321            $html_output = "<a href='' {$style}  class=' {$class}' data-toggle='modal' data-target='#wpsp-{$id}'>{$title}</a>";
     322        }
     323
     324
     325        if ($inline) {
     326            echo $html_output;
     327            include WPSP_PATH . '/view/frontend/popup.php';
     328        } else {
     329
     330            ob_start();
     331            echo $html_output;
     332            $output = ob_get_clean();
     333            return $output;
     334        }
    330335    }
    331336
    332337    function add_data_in_post_content($content) {
    333         if ( ! is_single() AND $this->global_setting['hide_in_excerpt'] == 'yes' ){
     338        if (!is_single() AND $this->global_setting['hide_in_excerpt'] == 'yes') {
    334339            return $content;
    335         } 
     340        }
    336341        $pattern = get_shortcode_regex(array('wps-popup'));
    337342        preg_match_all('/' . $pattern . '/s', $content, $matches);
     
    432437        return $content;
    433438    }
    434 
    435            
    436439
    437440    function show_custom_popup_input() {
  • smart-popup/trunk/view/admin/template/forms/popup-settings.php

    r1911343 r1934413  
    1010            <input type="radio" name="load_on" value="onclick"  <?php if($metadata['load_on'] == 'onclick') echo 'checked'; ?> onclick="return switch_mode()" /> On Link click
    1111        </label>
    12          <label style="">
     12<!--         <label style="">
    1313            <input type="radio" name="load_on" value="scrool"  <?php if($metadata['load_on'] == 'scrool') echo 'checked'; ?> disabled/> On Scrool (Coming soon) 
    14         </label>
     14        </label>-->
    1515    </div>
    1616
     
    2525            <input type="radio" name="show_as" value="link" <?php if($metadata['show_as'] == 'link') echo 'checked'; ?>  /> Link
    2626        </label>
    27         <label style="">
     27<!--        <label style="">
    2828            <input type="radio" name="show_as" value="image"  <?php if($metadata['show_as'] == 'image') echo 'checked'; ?> disabled/> Image(Coming soon)
    29         </label>
     29        </label>-->
    3030
    3131
  • smart-popup/trunk/view/how_to_use.php

    r1911343 r1934413  
    33
    44    <div class="how-to-group">
    5         <div class="title"> With Custom posts</div>
     5        <div class="title"> Use a popup in a post or page </div>
    66        <div>
    7             If you   want to use custom post, you can easily use as copy short code from our custom list. or you can use it following : <br/>
     7            <ul>
     8                <li> * Make popup from smart popup menu </li>
     9                <li> * Select your appropriate popup type and settings. </li>
     10                <li> * Add short code in any post or page.  </li>
     11            </ul>
     12
    813            <pre>
    9                 [wpob-popover   id='YourCustomPostID']
     14                [wps-popup   id='YourPopupID']
    1015
    1116                for example : 
    12                 [wpob-popover id='99']
     17                [wps-popup id='99']
    1318            </pre>
    1419        </div>
    1520    </div>
    16  
     21
     22
     23
     24    <div class="how-to-group">
     25        <div class="title"> Use a popup in your theme or template page as PHP code  </div>
     26        <div>
     27            You can add popup in any where in your site with PHP do_short code command.
     28            If use in any page template you must use "inline=1" attribute.
     29            <pre>
     30                 do_shortcode("[wps-popup id='YourPopUpID' inline='1']");   
     31
     32                for example : 
     33                do_shortcode("[wps-popup id='99' inline='1']");
     34            </pre>
     35        </div>
     36    </div>
     37
    1738   
    1839    <div class="how-to-group">
    19         <div class="title"> Set custom style</div>
     40        <div class="title"> Add Video From YouTube  </div>
    2041        <div>
    21              If you want to change style of popover, you can set custom background color, text color, popover position, width and more for plugin settings page.
     42            Select popup type as 'YouTube' than add Video ID in YouTube Settings.
    2243        </div>
    2344    </div>
    24    
    25      
     45
    2646    <div class="how-to-group">
    27         <div class="title"> Set height-width for popover</div>
     47        <div class="title"> Add Facebook Page Likebox  </div>
    2848        <div>
    29              Set 'auto' for popover height and width in settings.
     49           Select popup type as 'Facebook' than add your Page URL in Facebook Settings.
    3050        </div>
    3151    </div>
    32    
    33      
    34    
    35    
     52
     53
     54
     55
    3656</div>
Note: See TracChangeset for help on using the changeset viewer.