コード例 #1
0
ファイル: Admin.php プロジェクト: dreamteam111/dreamteam
 public static function init()
 {
     add_action('admin_print_styles', array(__CLASS__, 'styles'));
     add_action('admin_print_scripts', array(__CLASS__, 'scripts'));
     global $plugin_page;
     if ($plugin_page !== 'sputnik' && $plugin_page !== 'sputnik-account') {
         return;
     }
     // Run most OAuth stuff now, before output
     if (!empty($_GET['oauth'])) {
         if ($_GET['oauth'] == 'request') {
             $redirect_url = '';
             if (!empty($_REQUEST['oauth_buy'])) {
                 $redirect_url = self::build_url(array('oauth' => 'callback'));
                 $redirect_url = add_query_arg('oauth_buy', $_REQUEST['oauth_buy'], $redirect_url);
             }
             Sputnik_API::auth_request($redirect_url);
         }
         if ($_GET['oauth'] == 'callback') {
             Sputnik_API::auth_access();
         }
         if ($_GET['oauth'] == 'reset') {
             delete_option('sputnik_oauth_request');
             delete_option('sputnik_oauth_access');
             wp_redirect(self::build_url());
         }
     }
     switch (true) {
         case isset($_GET['info']):
             self::$page = 'info';
             break;
         case isset($_GET['buy']):
             self::$page = 'buy';
             break;
         case isset($_GET['paid']):
             self::$page = 'paid';
             break;
         case isset($_GET['install']):
             self::$page = 'install';
             break;
         case isset($_GET['upgrade']):
             self::$page = 'upgrade';
             break;
         case isset($_GET['cancel_payment']):
             self::$page = 'cancel_payment';
             break;
         case $plugin_page === 'wpsc-product_page_sputnik-account':
             self::$page = 'account';
             $GLOBALS['tab'] = 'account';
             break;
         default:
             self::$page = 'dash';
             break;
     }
     // Avoid having to specify this for every page
     if (self::$page !== 'dash' && self::$page !== 'account') {
         $_GET['noheader'] = true;
     }
 }
コード例 #2
0
    public static function show_login_form()
    {
        if (!isset($_GET['marketplace'])) {
            return;
        }
        $url = 'http://www.wpeconomy.org/products-page/add/?framed=true&marketplace=' . urlencode(esc_url_raw(Sputnik_API::domain()));
        $auth = Sputnik_API::auth_request($url, false);
        ?>
		<html>
		<head>
			<script type="text/javascript" src="<?php 
        echo home_url($GLOBALS['wp_scripts']->registered['jquery']->src);
        ?>
"></script>
			<script type="text/javascript">
				jQuery(window).load(function() {
					jQuery( '#add_form' ).load( '<?php 
        echo esc_url($auth);
        ?>
' );
				});
			</script>
		</head>
		<body>
		<div id="add_form"></div>
		</body>
		</html>
		<?php 
        die;
    }