コード例 #1
0
ファイル: preview.php プロジェクト: venturepact/blog
     * @since 2.0.2.1
     */
    public function do_preview()
    {
        // Filter the data for preview mode.
        add_filter('optin_monster_data', array(Optin_Monster_Output::get_instance(), 'preview_data'), 9999);
        $optin = Optin_Monster_Output::get_instance()->get_optin_monster(Optin_Monster_Output::get_instance()->optin_id);
        remove_filter('optin_monster_data', array(Optin_Monster_Output::get_instance(), 'preview_data'), 9999);
        // Output the optin.
        if ($optin) {
            echo $optin;
        }
    }
    /**
     * Returns the singleton instance of the class.
     *
     * @since 2.0.2.1
     *
     * @return object The Optin_Monster_Views_Preview object.
     */
    public static function get_instance()
    {
        if (!isset(self::$instance) && !self::$instance instanceof Optin_Monster_Views_Preview) {
            self::$instance = new Optin_Monster_Views_Preview();
        }
        return self::$instance;
    }
}
// Load the views preview class.
$optin_monster_views_preview = Optin_Monster_Views_Preview::get_instance();
コード例 #2
0
ファイル: menu.php プロジェクト: venturepact/blog
 /**
  * Outputs the main UI for handling and managing optins.
  *
  * @since 2.0.0
  */
 public function menu_ui()
 {
     // Build out the necessary HTML structure.
     echo '<div id="optin-monster-ui" class="wrap">';
     // Serve the UI based on the page being visited.
     if ($this->load_view()) {
         switch ($this->view) {
             case 'overview':
                 require plugin_dir_path($this->base->file) . 'includes/admin/views/overview.php';
                 Optin_Monster_Views_Overview::get_instance()->view();
                 break;
             case 'new':
                 require plugin_dir_path($this->base->file) . 'includes/admin/views/new.php';
                 Optin_Monster_Views_New::get_instance()->view();
                 break;
             case 'edit':
                 require plugin_dir_path($this->base->file) . 'includes/admin/views/edit.php';
                 Optin_Monster_Views_Edit::get_instance()->view();
                 break;
             case 'split':
                 require plugin_dir_path($this->base->file) . 'includes/admin/views/split.php';
                 Optin_Monster_Views_Split::get_instance()->view();
                 break;
             case 'preview':
                 if ($this->is_admin_preview()) {
                     require plugin_dir_path($this->base->file) . 'includes/admin/views/preview.php';
                     Optin_Monster_Views_Preview::get_instance()->view();
                 } else {
                     require plugin_dir_path($this->base->file) . 'includes/admin/views/overview.php';
                     Optin_Monster_Views_Overview::get_instance()->view();
                 }
                 break;
             default:
                 do_action('optin_monster_admin_view', $this->view);
                 break;
         }
     }
     // Wrap up the main UI.
     echo '</div>';
 }