Changeset 1669999
- Timestamp:
- 06/03/2017 05:59:36 AM (9 years ago)
- Location:
- nepirity-analytics/trunk
- Files:
-
- 2 added
- 6 edited
-
modules/admin.php (modified) (1 diff)
-
modules/analytics.php (modified) (3 diffs)
-
modules/settings.php (modified) (2 diffs)
-
nepirity-analytics.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
sdk/classes/google.php (modified) (1 diff)
-
templates/css/jqcloud.css (added)
-
templates/js/jqcloud.js (added)
Legend:
- Unmodified
- Added
- Removed
-
nepirity-analytics/trunk/modules/admin.php
r1666843 r1669999 56 56 57 57 if (NP()->settings()->is_configured()) { 58 add_submenu_page(self::MENU_SLUG_INDEX, ' nepirity_admin_index title', np_translate('Dashboard'),58 add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Dashboard', np_translate('Dashboard'), 59 59 'manage_options', self::MENU_SLUG_INDEX, array(__CLASS__, 'index_page')); 60 60 61 add_submenu_page(self::MENU_SLUG_INDEX, ' nepirity_admin_settings title', np_translate('Settings'),61 add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Settings', np_translate('Settings'), 62 62 'manage_options', 'nepirity_admin_settings', array(__CLASS__, 'settings_page')); 63 63 } -
nepirity-analytics/trunk/modules/analytics.php
r1669213 r1669999 16 16 $npkey = NP()->settings()->get_nepirity_key(); 17 17 18 if (! sizeof($token)) {18 if (!count($token)) { 19 19 $auth = NP()->settings()->get_google_account_auth_config(); 20 20 $token = $google->get_access_token($npkey, $auth); … … 26 26 27 27 protected function get_googleauth_oauth_access_token($key) { 28 $npkey = NP()->settings()->get_nepirity_key();29 28 $google = NP()->jsonrpc()->google(); 30 $token = $google->get_access_token_using_authkey($npkey, $key); 29 30 if ($key) { 31 $npkey = NP()->settings()->get_nepirity_key(); 32 return $google->get_access_token_using_authkey($npkey, $key); 33 } 34 35 $token = NP()->settings()->get_saved_google_token(); 36 37 if (!count($token)) { 38 $refresh = NP()->settings()->get_saved_refresh_token(); 39 $token = $google->get_refresh_token($refresh); 40 NP()->settings()->save_google_token($token); 41 } 31 42 32 43 return $token; … … 38 49 switch ($auth_type) { 39 50 case Setting::GOOGLE_AUTHTYPE_OAUTH: { 40 if ($key == null) {41 return NP()->settings()->get_saved_google_token();42 }43 44 51 return $this->get_googleauth_oauth_access_token($key); 45 52 } -
nepirity-analytics/trunk/modules/settings.php
r1669213 r1669999 480 480 $token = json_decode($this->get_option_value(self::FIELD_GOOGLE_ACCESS_TOKEN), true); 481 481 482 if ($this->is_google_oauth_type()) {483 return $token;484 }485 486 482 if (sizeof($token) && isset($token['created']) && isset($token['expires_in'])) { 487 483 if ($diff = time() + 30 < $token['created'] + $token['expires_in']) { … … 496 492 $this->update_option_value(self::FIELD_GOOGLE_ACCESS_TOKEN, json_encode($token)); 497 493 } 494 495 public function get_saved_refresh_token() { 496 $token = json_decode($this->get_option_value(self::FIELD_GOOGLE_ACCESS_TOKEN), true); 497 498 if (isset($token['refresh_token'])) return $token['refresh_token']; 499 500 return ""; 501 } 498 502 } 499 503 -
nepirity-analytics/trunk/nepirity-analytics.php
r1669213 r1669999 3 3 Plugin Name: Nepirity Analytics 4 4 Description: Nepirity Analytics is a plugin that provides web traffic data analysis feature with data gathered from Google Analytics. 5 Version: 1.0. 15 Version: 1.0.2 6 6 Author: Nepirity Corp. 7 7 Author URI: https://www.nepirity.com/ -
nepirity-analytics/trunk/readme.txt
r1669213 r1669999 5 5 Requires at least: 4.6.5 6 6 Tested up to: 4.7.5 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 35 35 1. Start activating the plugin with a Nepirity Service key. 36 36 37 2. Enter in your Google Service Account Keyin the plugin settings.37 2. Enter your Google Account Information in the plugin settings. 38 38 39 39 3. Check [Read & Analyze] option in your Google Analytics settings. … … 62 62 63 63 == Changelog == 64 = 1.0.2 = 65 Fixed Google authentication method. 66 64 67 = 1.0.1 = 65 68 Added Google authentication method. … … 69 72 70 73 == Upgrade Notice == 71 = 1.0. 1=72 New Google authentication method has been added. You can install the plugin a little easier and more convenient.74 = 1.0.2 = 75 OAuth authentication has been modified so that tokens can be updated if the token expires. -
nepirity-analytics/trunk/sdk/classes/google.php
r1669213 r1669999 9 9 } 10 10 11 abstract class GoogleAuth {12 protected $jsonrpc;13 14 function __construct($server) {15 $this->jsonrpc = new Google($server);16 }17 18 abstract public function get_access_token($npkey, $googlekey);19 abstract public function get_profiles($npkey, $googlekey);20 }21 22 class GoogleAuthAccount extends GoogleAuth {23 function __construct($server) {24 parent::__construct($server);25 }26 27 public function get_access_token($npkey, $googlekey) {28 return $this->jsonrpc->get_access_token($npkey, $googlekey);29 }30 31 public function get_profiles($npkey, $googlekey) {32 return $this->jsonrpc->get_profiles($npkey, $googlekey);33 }34 }35 36 class GoogleAuthOauth extends GoogleAuth {37 function __construct($server) {38 parent::__construct($server);39 }40 41 public function get_access_token($npkey, $googlekey) {42 }43 44 public function get_profiles($npkey, $googlekey) {45 }46 }47 48 11 } 49 12
Note: See TracChangeset
for help on using the changeset viewer.