Example #1
0
 function initialise_ajax()
 {
     $settings = get_popover_option('popover-settings', array('loadingmethod' => 'external'));
     switch ($settings['loadingmethod']) {
         case 'external':
             add_action('wp_ajax_popover_selective_ajax', array(&$this, 'ajax_selective_message_display'));
             add_action('wp_ajax_nopriv_popover_selective_ajax', array(&$this, 'ajax_selective_message_display'));
             break;
     }
 }
Example #2
0
 function initialise_plugin()
 {
     $settings = get_popover_option('popover-settings', array('loadingmethod' => 'external'));
     switch ($settings['loadingmethod']) {
         case 'external':
             $this->add_selective_javascript();
             break;
         case 'footer':
             $this->add_popover_files();
             break;
     }
 }
Example #3
0
 function initialise_ajax()
 {
     $settings = get_popover_option('popover-settings', array('loadingmethod' => 'external'));
     switch ($settings['loadingmethod']) {
         case 'external':
             add_action('wp_ajax_popover_selective_ajax', array(&$this, 'ajax_selective_message_display'));
             add_action('wp_ajax_nopriv_popover_selective_ajax', array(&$this, 'ajax_selective_message_display'));
             break;
         case 'frontloading':
             if (isset($_GET['popoverajaxaction']) && $_GET['popoverajaxaction'] == 'popover_selective_ajax') {
                 $this->ajax_selective_message_display();
             }
             break;
     }
 }
Example #4
0
        function handle_settings_page()
        {
            global $action, $page;
            $messages = array();
            $messages[1] = __('Your settings have been updated.', 'popover');
            ?>
            <div class='wrap nosubsub'>

                <div class="icon32" id="icon-options-general"><br></div>
                <h2><?php 
            _e('Pop Over Settings', 'popover');
            ?>
</h2>

            <?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>
                <div id="poststuff" class="metabox-holder m-settings">
                    <form action='?page=<?php 
            echo $page;
            ?>
' method='post'>

                        <input type='hidden' name='page' value='<?php 
            echo $page;
            ?>
' />
                        <input type='hidden' name='action' value='updatesettings' />

            <?php 
            wp_nonce_field('update-popover-settings');
            ?>

                        <div class="postbox">
                            <h3 class="hndle" style='cursor:auto;'><span><?php 
            _e('Pop Over loading method', 'popover');
            ?>
</span></h3>
                            <div class="inside">
                                <p><?php 
            _e('Select the loading method you want to use for your Pop Overs.', 'popover');
            ?>
</p>
                                <ul>
                                    <li><em><?php 
            _e('- Page Footer : The pop over is included as part of the page html.', 'popover');
            ?>
</em></li>
                                    <li><em><?php 
            _e('- External Load : The pop over is loaded separately from the page, this is the best option if you are running a caching system.', 'popover');
            ?>
</em></li>
                                    <li><em><?php 
            _e('- Custom Load : The pop over is loaded separately from the page via a custom front end ajax call.', 'popover');
            ?>
</em></li>
                                </ul>

                                <table class="form-table">
                                    <tbody>
                                        <tr valign="top">
                                            <th scope="row"><?php 
            _e('Pop Over loaded using', 'popover');
            ?>
</th>
                                            <td>
            <?php 
            $settings = get_popover_option('popover-settings', array('loadingmethod' => 'frontloading'));
            ?>
                                                <select name='loadingmethod' id='loadingmethod'>
                                                    <option value="footer" <?php 
            if ($settings['loadingmethod'] == 'footer') {
                echo "selected='selected'";
            }
            ?>
><?php 
            _e('Page Footer', 'popover');
            ?>
</option>
                                                    <option value="external" <?php 
            if ($settings['loadingmethod'] == 'external') {
                echo "selected='selected'";
            }
            ?>
><?php 
            _e('External Load', 'popover');
            ?>
</option>
                                                    <option value="frontloading" <?php 
            if ($settings['loadingmethod'] == 'frontloading') {
                echo "selected='selected'";
            }
            ?>
><?php 
            _e('Custom Load', 'popover');
            ?>
</option>
                                                </select>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <p class="submit">
                            <input type="submit" name="Submit" class="button-primary" value="<?php 
            esc_attr_e('Save Changes', 'popover');
            ?>
" />
                        </p>

                    </form>
                </div>
            </div> <!-- wrap -->
            <?php 
        }