/** * Getting the instance object * * This method will return the instance of itself, if instance not exists, becauses of it's called for the first * time, the instance will be created. * * @return null|Yoast_Google_Analytics */ public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Checks if there is a callback or reauth to get token from Google Analytics api */ private function connect_with_google_analytics() { if (isset($_REQUEST['ga_oauth_callback'])) { Yoast_Google_Analytics::instance()->authenticate($_REQUEST['oauth_token'], $_REQUEST['oauth_verifier']); wp_redirect(menu_page_url('yst_ga_settings', false)); exit; } if (!empty($_GET['reauth'])) { $authorize_url = Yoast_Google_Analytics::instance()->authenticate(); wp_redirect($authorize_url); exit; } }