예제 #1
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>';
 }
예제 #2
0
파일: edit.php 프로젝트: venturepact/blog
 /**
  * Returns the singleton instance of the class.
  *
  * @since 2.0.0
  *
  * @return object The Optin_Monster_Views_Edit object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Optin_Monster_Views_Edit) {
         self::$instance = new Optin_Monster_Views_Edit();
     }
     return self::$instance;
 }
예제 #3
0
파일: ajax.php 프로젝트: venturepact/blog
/**
 * Retrieves the email provider API data.
 *
 * @since 2.0.0
 */
function optin_monster_ajax_get_provider()
{
    // Prepare variables.
    $provider = stripslashes($_POST['provider']);
    $account = stripslashes($_POST['account']);
    $optin_id = absint($_POST['id']);
    $base = Optin_Monster::get_instance();
    $providers = Optin_Monster_Common::get_instance()->get_email_providers(true);
    // If the user is adding a new account, send back the new account UI.
    if ('new' == $account) {
        die(json_encode(optin_monster_ajax_get_new_account($provider, $optin_id)));
    }
    // Load the view class to handle optin editing functions and utility methods.
    if (!class_exists('Optin_Monster_Views_Edit')) {
        require plugin_dir_path($base->file) . 'includes/admin/views/edit.php';
    }
    $view = Optin_Monster_Views_Edit::get_instance();
    $list_id = $view->get_email_setting('list_id');
    // Add the client if using Campaign Monitor.
    if ('campaign-monitor' == $provider) {
        $providers[$provider][$account]['client'] = stripslashes($_POST['client']);
    }
    // Now retrieve the API object and lists output.
    $api = optin_monster_ajax_get_email_provider($provider);
    $lists = $api->get_lists($providers[$provider][$account], $list_id);
    // If there is an error retrieving the lists, let the user know.
    if (is_wp_error($lists)) {
        die(json_encode(array('error' => '<p class="om-error">' . $lists->get_error_message() . '</p>')));
    }
    // Send back the HTML response.
    die(json_encode($lists));
}