示例#1
0
 public function instapagePostRegister()
 {
     instapage::getInstance()->includes['service']->silentUpdateCheck();
     $labels = array('name' => _x('Instapage', 'Post type general name', 'instapage'), 'singular_name' => _x('Instapage', 'Post type singular name', 'instapage'), 'add_new' => _x('Add New', 'instapage', 'instapage'), 'add_new_item' => __('Add New Instapage', 'instapage'), 'edit_item' => __('Edit Instapage', 'instapage'), 'new_item' => __('New Instapage', 'instapage'), 'view_item' => __('View Instapage', 'instapage'), 'search_items' => __('Search Instapage', 'instapage'), 'not_found' => __('Nothing found', 'instapage'), 'not_found_in_trash' => __('Nothing found in Trash', 'instapage'), 'parent_item_colon' => '');
     $args = array('labels' => $labels, 'description' => __('Allows you to have Instapage on your WordPress site.', 'instapage'), 'public' => false, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'menu_icon' => INSTAPAGE_PLUGIN_URI . 'assets/img/instapage-logo-16x16.png', 'capability_type' => 'page', 'menu_position' => null, 'rewrite' => false, 'can_export' => false, 'hierarchical' => false, 'has_archive' => false, 'supports' => array('instapage_my_selected_page', 'instapage_slug', 'instapage_name', 'instapage_url'), 'register_meta_box_cb' => array(&instapage::getInstance()->includes['edit'], 'removeMetaBoxes'));
     register_post_type('instapage_post', $args);
 }
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#3
0
 public function showSettingsPage()
 {
     $user_id = get_option('instapage.user_id');
     $form = instapage::getInstance()->includes['view'];
     $form->init(INSTAPAGE_PLUGIN_DIR . '/includes/templates/instapage/settings.php');
     $form->plugin_file = plugin_basename(INSTAPAGE_PLUGIN_FILE);
     $form->user_id = $user_id;
     $form->error = false;
     if ($_POST && !$user_id) {
         try {
             $response = instapage::getInstance()->includes['api']->instapageApiCall('user-login', array('email' => base64_encode(trim($_POST['email'])), 'password' => base64_encode(trim($_POST['password']))));
         } catch (InstapageApiCallException $e) {
             $form->error = $e->getMessage();
         }
         if ($response->error) {
             $form->error = $response->error_message;
         }
         if ($response->success) {
             add_option('instapage.user_id', false);
             add_option('instapage.plugin_hash', false);
             update_option('instapage.user_id', $response->data['user_id']);
             update_option('instapage.plugin_hash', $response->data['plugin_hash']);
             $user_id = $form->user_id = $response->data['user_id'];
         }
     }
     if (isset($_POST['action']) && $_POST['action'] == 'disconnect') {
         update_option('instapage.user_id', false);
         update_option('instapage.plugin_hash', false);
         $form->user_id = null;
     }
     if (isset($_POST['action']) && $_POST['action'] == 'cross_origin_proxy_services') {
         update_option('instapage.cross_origin_proxy_services', $_POST['cross_origin_proxy_services']);
     }
     $form->cross_origin_proxy_services = get_option('instapage.cross_origin_proxy_services');
     if ($user_id) {
         try {
             $response = instapage::getInstance()->includes['api']->instapageApiCall("get_user/?id=" . $user_id . "&plugin_hash=" . get_option('instapage.plugin_hash'), array('user_id' => $user_id, 'plugin_hash' => get_option('instapage.plugin_hash')));
             $form->user = $response->user;
         } catch (InstapageApiCallException $e) {
             $form->error = $e->getMessage();
         }
     }
     echo $form->fetch();
 }