Пример #1
0
    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();
    }