public function __construct() { parent::__construct(__('Plugin Information', 'sputnik')); $this->plugin = $_GET['info']; try { $account = Sputnik::get_account(); $this->api = Sputnik::get_plugin($this->plugin, $account->ID); } catch (Exception $e) { status_header(500); iframe_header(__('', 'sputnik')); echo $e->getMessage(); iframe_footer(); die; } }
protected function header() { parent::header(); $account = Sputnik::get_account(); ?> <div class="account-card"> <div class="block"> <?php echo get_avatar($account->email); ?> <p class="lead-in"><?php _e('Logged in as', 'wp-e-commerce'); ?> </p> <h3><?php echo esc_html($account->name); ?> </h3> <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wp-e-commerce'), Sputnik_Admin::build_url(array('oauth' => 'reset'))); ?> </p> </div> <div class="block"> <p><?php printf(__('Email: %s', 'wp-e-commerce'), '<code>' . $account->email . '</code>'); ?> </p> <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wp-e-commerce'), count($account->purchased)); ?> </p> <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wp-e-commerce'), $this->count); ?> </p> </div> </div> <?php }
public function display_tablenav($which) { global $tab; if ($tab === 'account') { return; } if (!Sputnik::account_is_linked()) { return; } $account = Sputnik::get_account(); if ('top' == $which) { ?> <div class="tablenav top"> <div class="alignright actions"> <?php if (in_array($tab, array('dashboard', 'search'))) { ?> <?php Sputnik_Admin::search_form(); } switch ($this->view) { case 'list': $view = 'grid'; $name = __('Grid', 'wp-e-commerce'); break; case 'grid': $view = 'list'; $name = __('List', 'wp-e-commerce'); break; } ?> <!--<a href="<?php echo add_query_arg('view', $view); ?> " class="view-as-<?php echo $view; ?> button"><?php echo $name; ?> </a>--> </div> <?php $this->pagination($which); ?> <img src="<?php echo esc_url(wpsc_get_ajax_spinner()); ?> " class="ajax-loading list-ajax-loading" alt="" /> <br class="clear" /> </div> <?php } else { ?> <div class="tablenav bottom"> <?php $this->pagination($which); ?> <img src="<?php echo esc_url(wpsc_get_ajax_spinner()); ?> " class="ajax-loading list-ajax-loading" alt="" /> <br class="clear" /> </div> <?php } }
protected function header($title = false, $account = false) { if (func_num_args() !== 0) { debug_print_backtrace(); die; } $title = $this->title; $account = false; try { $account = Sputnik::get_account(); } catch (Exception $e) { // } if ($account !== false) { $tabs = array('dash' => __('Store', 'sputnik'), 'account' => __('Your Account', 'sputnik')); $hrefs = array('dash' => Sputnik_Admin::build_url(), 'account' => menu_page_url('sputnik-account', false)); $current = Sputnik_Admin::$page; } ?> <div class="wrap" id="sputnik-page"> <?php if ($account !== false) { ?> <?php screen_icon('sputnik'); ?> <h2 class="nav-tab-wrapper"> <?php foreach ($tabs as $page => $title) { ?> <a href="<?php echo $hrefs[$page]; ?> " class="nav-tab<?php if ($current === $page) { echo ' nav-tab-active'; } ?> "><?php echo $title; ?> </a> <?php } ?> </h2> <?php } elseif ($title !== false) { ?> <?php screen_icon('sputnik'); ?> <h2><?php echo $title; ?> </h2> <?php } ?> <?php do_action('sputnik_messages'); }
public static function account() { self::$page = 'account'; $account = false; try { $account = Sputnik::get_account(); } catch (Exception $e) { if ($e->getCode() === 1) { $GLOBALS['tab'] = 'auth'; return self::other_pages(); } elseif ($e->getCode() === 401) { delete_option('sputnik_oauth_access'); delete_option('sputnik_oauth_request'); $GLOBALS['tab'] = 'auth'; return self::other_pages(); } else { self::header('Account', $account); echo '<p>' . sprintf(__('Problem: %s', 'wpsc'), $e->getMessage()) . '</p>'; return; } } self::header('Account', $account); ?> <div class="account-card"> <div class="block"> <?php echo get_avatar($account->email); ?> <p class="lead-in">Logged in as</p> <h3><?php echo esc_html($account->name); ?> </h3> <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wpsc'), self::build_url(array('oauth' => 'reset'))); ?> </p> </div> <div class="block"> <p>Email: <code><?php echo $account->email; ?> </code></p> <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wpsc'), count($account->purchased)); ?> </p> <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wpsc'), count(self::$list_table->items)); ?> </p> </div> </div> <?php self::$list_table->views(); self::$list_table->display(); }
public function display_tablenav($which) { global $tab; if ($tab === 'account') { return; } $account = Sputnik::get_account(); if ('top' == $which) { ?> <div class="tablenav top"> <div class="alignright account"> <?php printf(__('Logged in as %s', 'wp-e-commerce'), '<a href="' . menu_page_url('sputnik-account', false) . '" class="account-link">' . $account->name . '</a>'); if ($tab === 'search') { ?> <?php Sputnik_Admin::search_form(); } ?> </div> <?php $this->pagination($which); ?> <img src="<?php echo esc_url(wpsc_get_ajax_spinner()); ?> " class="ajax-loading list-ajax-loading" alt="" /> <br class="clear" /> </div> <?php } else { ?> <div class="tablenav bottom"> <?php $this->pagination($which); ?> <img src="<?php echo esc_url(wpsc_get_ajax_spinner()); ?> " class="ajax-loading list-ajax-loading" alt="" /> <br class="clear" /> </div> <?php } }