Changeset 1673045
- Timestamp:
- 06/08/2017 06:56:30 AM (9 years ago)
- Location:
- nepirity-analytics/trunk
- Files:
-
- 4 deleted
- 9 edited
-
modules/admin.php (modified) (3 diffs)
-
modules/analytics.php (modified) (2 diffs)
-
modules/settings.php (modified) (12 diffs)
-
modules/setup.php (modified) (3 diffs)
-
modules/views.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
-
templates/admin/settings/general.php (modified) (1 diff)
-
templates/css/bootstrap-nepirity.css (modified) (2 diffs)
-
templates/css/jqcloud.css (modified) (1 diff)
-
templates/js/active-users.js (deleted)
-
templates/js/bootstrap.min.js (deleted)
-
templates/js/npm.js (deleted)
-
templates/js/sankey.js (deleted)
Legend:
- Unmodified
- Added
- Removed
-
nepirity-analytics/trunk/modules/admin.php
r1669999 r1673045 37 37 wp_register_style( 'bootstrap_css', plugins_url()."/".NP_BASENAME.'/templates/css/bootstrap-nepirity.css' ); 38 38 wp_enqueue_style( 'bootstrap_css' ); 39 wp_register_style( ' date_range_selector_css', plugins_url()."/".NP_BASENAME.'/templates/css/date_range_selector.css' );40 wp_enqueue_style( ' date_range_selector_css' );39 wp_register_style( 'jqcloud_css', plugins_url()."/".NP_BASENAME.'/templates/css/jqcloud.css' ); 40 wp_enqueue_style( 'jqcloud_css' ); 41 41 wp_register_script( 'match_height_js', plugins_url()."/".NP_BASENAME.'/templates/js/jquery.matchHeight.js' ); 42 42 wp_enqueue_script( 'match_height_js' ); 43 43 wp_register_script( 'google_analytics_js', plugins_url()."/".NP_BASENAME.'/templates/js/google_analytics.js' ); 44 44 wp_enqueue_script( 'google_analytics_js' ); 45 wp_register_script( 'jqcloud_js', plugins_url()."/".NP_BASENAME.'/templates/js/jqcloud.js' ); 46 wp_enqueue_script( 'jqcloud_js' ); 45 47 } 46 48 return; … … 56 58 57 59 if (NP()->settings()->is_configured()) { 58 add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Dashboard', np_translate('Dashboard'), 59 'manage_options', self::MENU_SLUG_INDEX, array(__CLASS__, 'index_page')); 60 $module_menus = NP()->settings()->get_nepirity_modules(); 61 62 foreach ($module_menus as $module) { 63 $slug = 'nepirity_admin_'. $module['name']; 64 65 if ($module['name'] == "dashboard") { 66 $slug = self::MENU_SLUG_INDEX; 67 } 68 69 add_submenu_page(self::MENU_SLUG_INDEX, $module['title'] , $module['menu'], 70 'manage_options', $slug, array(__CLASS__, 'module_page')); 71 } 60 72 61 73 add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Settings', np_translate('Settings'), 62 74 'manage_options', 'nepirity_admin_settings', array(__CLASS__, 'settings_page')); 63 75 } 64 65 76 } 66 77 … … 68 79 $tabs = array('summary' => np_translate('Summary')); 69 80 NP()->views()->print_tab_page("dashboard", $tabs); 81 } 82 83 static function module_page() { 84 $tabs = array(); 85 $group_name = ""; 86 $module_menus = NP()->settings()->get_nepirity_modules(); 87 88 if (isset($_GET['page'])) { 89 $e = explode("_", $_GET['page']); 90 91 if (count($e) == 3) { 92 $group_name = $e[2]; 93 } 94 } 95 96 foreach ($module_menus as $module) { 97 if ($group_name == $module['name']) { 98 foreach ($module['list'] as $tab_data) { 99 $tabs[$tab_data['name']] = $tab_data['menu']; 100 } 101 break; 102 } 103 } 104 105 NP()->views()->print_tab_page($group_name, $tabs); 70 106 } 71 107 -
nepirity-analytics/trunk/modules/analytics.php
r1669999 r1673045 70 70 $google = NP()->jsonrpc()->google(); 71 71 72 $encoded_token = base64_encode(json_encode( NP()->settings()->get_saved_google_token()));72 $encoded_token = base64_encode(json_encode($this->get_googleauth_oauth_access_token(null))); 73 73 return $google->get_profiles_using_token($encoded_token); 74 74 } … … 113 113 114 114 ga('create', '<?= $tracking_id ?>', 'auto'); 115 ga('require', 'displayfeatures'); 115 116 ga('send', 'pageview'); 116 117 </script> -
nepirity-analytics/trunk/modules/settings.php
r1669999 r1673045 14 14 const FIELD_NEPIRITY_VERSION = 'np_nepirity_version'; 15 15 const FIELD_NEPIRITY_SERVER = 'np_nepirity_server'; 16 const FIELD_NEPIRITY_MODULES = 'np_nepirity_modules'; 16 17 17 18 const FIELD_GOOGLE_ACCESS_TOKEN = 'np_google_access_token'; … … 33 34 foreach ($options as $option) { 34 35 if (!$this->get_option_value($option['name'])) return false; 36 } 37 38 if (!$this->get_option_value(self::FIELD_NEPIRITY_MODULES)) { 39 return false; 35 40 } 36 41 … … 82 87 } 83 88 } 89 90 $this->update_modules(); 84 91 } 85 92 … … 103 110 } 104 111 105 public function print_ setting_summary($profiles='') {112 public function print_nepirity_summary() { 106 113 echo '<h3 class="title">'.np_translate("Nepirity Settings").'</h3>'; 107 114 echo '<p>'.np_translate("In order to use Nepirity Analysis Service, please enter your account information.").'</p>'; … … 117 124 } 118 125 echo '</table>'; 126 ?> 127 <div align='center'> 128 <input type="hidden" name="update_setting_values" value="1" /> 129 <input type="submit" class="button button-primary" value="<?= np_translate("Update") ?>" /> 130 </div> 131 <?php 132 echo '</form>'; 119 133 echo '<hr />'; 120 134 } 135 136 public function print_google_summary($profiles='') { 137 echo '<form method="post" enctype="multipart/form-data">'; 121 138 echo '<h3 class="title">'.np_translate("Google Account Setting").'</h3>'; 122 139 $setup_link = $this->get_settings_setup_link(); … … 124 141 125 142 echo ' '; 126 echo np_translate("Click, if you want to bring up the Nepirity Setup Wizard."); 127 echo " <a href='".$setup_link."'>".np_translate("[Here]")."</a> </p>"; 143 echo np_translate("Click"); 144 echo " <a href='".$setup_link."'>".np_translate("[Here]")."</a>"; 145 echo np_translate(", if you want to bring up the Nepirity Setup Wizard.</p>"); 128 146 echo '<hr />'; 129 147 … … 215 233 array( 216 234 "name"=>self::FIELD_NEPIRITY_KEY, 217 "type"=>"text", "desc" => np_translate("Nepirity KEY")235 "type"=>"text", "desc" => np_translate("Nepirity Service Key") 218 236 ) 219 237 ); … … 270 288 $link = NP()->analytics()->get_google_auth_link(); 271 289 $memo = np_translate("You can check Google OAuth code"); 272 $memo .= " [<a href='".$link."' target ='_blank'>here</a>]";290 $memo .= " [<a href='".$link."' target = 'popup' onclick = window.open(this.href,'popup','width=500,height=600')>here</a>]"; 273 291 274 292 return array( … … 315 333 public function get_nepirity_server_option_name() { 316 334 return self::FIELD_NEPIRITY_SERVER; 335 } 336 337 public function get_nepirity_module_option_name() { 338 return self::FIELD_NEPIRITY_MODULES; 317 339 } 318 340 … … 464 486 } 465 487 488 public function get_nepirity_modules() { 489 $modules = $this->get_option_value(self::FIELD_NEPIRITY_MODULES); 490 491 if ($modules != "") { 492 return unserialize($modules); 493 } 494 495 return array(); 496 } 497 498 public function remove_cache_options() { 499 $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_MODULES); 500 501 for ($i=0; $i<sizeof($options); $i++) { 502 delete_option($options[$i]); 503 } 504 } 505 466 506 public function delete_all_options() { 467 507 $options = $this->get_all_option_fields(); … … 471 511 } 472 512 473 $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_SERVER, self::FIELD_NEPIRITY_VERSION); 513 $options = array( 514 self::FIELD_GOOGLE_ACCESS_TOKEN, 515 self::FIELD_NEPIRITY_SERVER, 516 self::FIELD_NEPIRITY_VERSION, 517 self::FIELD_NEPIRITY_MODULES 518 ); 474 519 for ($i=0; $i<sizeof($options); $i++) { 475 520 delete_option($options[$i]); … … 500 545 return ""; 501 546 } 547 548 public function update_modules() { 549 $npkey = $this->get_nepirity_key(); 550 $modules = NP()->jsonrpc()->account()->get_available_module_menus($npkey, get_locale()); 551 552 $this->update_option_value(self::FIELD_NEPIRITY_MODULES, base64_decode($modules)); 553 } 502 554 } 503 555 -
nepirity-analytics/trunk/modules/setup.php
r1669213 r1673045 134 134 135 135 private static function print_wizard_default_step() { 136 self::print_wizard_pannel(np_translate("Nepirity Plugin Setup Wizard"),137 np_translate(" Start Nepirity plugin setup wizard"), array(), 'welcome');136 self::print_wizard_pannel(np_translate("Nepirity Analytics (Setup Wizard)"), 137 np_translate("Click Start to Configure"), array(), 'welcome'); 138 138 } 139 139 … … 216 216 self::update_settings(NP()->settings()->get_google_account_option_fields()); 217 217 218 NP()->settings()->remove_cache_options(); 219 218 220 $auth_type = NP()->settings()->get_google_authtype(); 219 221 if ($auth_type == Setting::GOOGLE_AUTHTYPE_OAUTH) { … … 260 262 $values[$option_name] = NP()->get_plugin_version(); 261 263 264 NP()->settings()->update_modules(); 265 262 266 self::update_setting_values($options, $values); 263 267 } -
nepirity-analytics/trunk/modules/views.php
r1669213 r1673045 23 23 24 24 public function print_admin_header() { 25 echo '<div class="wrap">'; 25 26 if (($jsonrpc = NP()->jsonrpc())) { 26 27 $msg = $jsonrpc->support()->get_notice(); … … 33 34 34 35 public function print_admin_footer() { 36 echo '</div>'; 35 37 } 36 38 … … 57 59 } 58 60 59 echo '<br />';60 61 echo '<ul class="nav nav-tabs">'; 61 62 foreach( $tabs as $tab => $name ){ … … 133 134 return $html; 134 135 } 136 137 public function get_date_string($unixtime) { 138 return date_i18n(get_option('date_format'), $unixtime); 139 } 140 141 public function print_board_data() { 142 $npkey = NP()->settings()->get_nepirity_key(); 143 $data = NP()->jsonrpc()->support()->get_board_data($npkey, get_locale()); 144 145 if (count($data) > 0) { 146 $date_str = $this->get_date_string($data['reg_date']); 147 148 ?> 149 <div class="card"> 150 <div class="card-block"> 151 <h4 class="card-title"><?=$data['subject']?></h4> 152 <h6 class="card-subtitle mb-2 text-muted"><?= $date_str ?></h6> 153 <p class="card-text"><?=$data['message']?></p> 154 <!--<a href="#" class="card-link" target="_blank">link</a> --> 155 <?= $data['link'] ?> 156 </div> 157 </div> 158 <?php 159 } 160 } 135 161 } 136 162 -
nepirity-analytics/trunk/readme.txt
r1669999 r1673045 5 5 Requires at least: 4.6.5 6 6 Tested up to: 4.7.5 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 33 33 == Installation == 34 34 35 1. Start activating the plugin with a Nepirity Service key. 36 37 2. Enter your Google Account Information in the plugin settings. 38 39 3. Check [Read & Analyze] option in your Google Analytics settings. 35 1. Copy the plug-in files to the wp-content/plugins directory. 36 2. Activate Nepirity Analytics. 37 3. Follow the instructions given by the Nepirity Setup Wizard. 40 38 41 39 Please, visit the site below for more information. … … 62 60 63 61 == Changelog == 62 = 1.0.3 = 63 - Support Expansion modules. 64 - Fixed authentication bugs. 65 64 66 = 1.0.2 = 65 Fixed Google authentication method.67 - Fixed Google authentication method. 66 68 67 69 = 1.0.1 = 68 Added Google authentication method.70 - Added Google authentication method. 69 71 70 72 = 1.0.0 = 71 first version.73 - First version. 72 74 73 75 == Upgrade Notice == 74 = 1.0. 2=75 OAuth authentication has been modified so that tokens can be updated if the token expires.76 = 1.0.3 = 77 Authentication bugs have been fixed, and visitor and site analytics extensions have been added. -
nepirity-analytics/trunk/templates/admin/settings/general.php
r1666843 r1673045 1 <?php 2 3 $settings = NP()->settings(); 4 5 if ($settings->check_update_values()) { 6 $settings->update_setting_values(); 7 $settings->print_updated_message(); 8 } 9 10 ?> 11 1 12 <div class = "panel panel-default"> 2 13 <div class= "panel-body"> 3 14 <?php 4 15 5 $settings = NP()->settings(); 16 if (isset($_GET['action']) && $_GET['action'] == "setup") { 17 NP()->settings()->setup_wizard(); 18 } else { 19 $profiles = null; 6 20 7 if ($settings->is_configured()) { 8 $analytics = NP()->analytics(); 9 10 if ($settings->check_update_values()) { 11 $settings->update_setting_values(); 12 $settings->print_updated_message(); 21 try { 22 $profiles = NP()->analytics()->get_google_profiles(); 23 }catch (Exception $e) { 24 $profiles = $e->getMessage(); 13 25 } 14 26 15 if (isset($_GET['action']) && $_GET['action'] == "setup") { 16 NP()->settings()->setup_wizard(); 17 } else { 18 $profiles = null; 27 ?> 28 <div class="container-fluid"> 29 <div class="row"> 30 <div class="col-sm-8"> 31 <?php 32 NP()->settings()->print_nepirity_summary(); 33 if ($profiles && is_array($profiles) && count($profiles)) { 34 NP()->settings()->print_google_summary($profiles); 35 } else { 36 $html = "<div align='center'>"; 37 $html .= np_translate("Can't load google profile information. Please setup plugin again."); 38 $html .= " [<a href='". NP()->settings()->get_settings_setup_link() . "'>Here</a>]"; 39 $html .= "</div>"; 19 40 20 try { 21 $profiles = $analytics->get_google_profiles(); 22 }catch (Exception $e) { 23 $profiles = $e->getMessage(); 24 } 41 echo $html; 42 } 43 ?> 44 </div> 45 <div class="col-sm-4"><?php NP()->views()->print_board_data(); ?> </div> 46 </div> 47 </div> 48 <?php 25 49 26 if ($profiles && is_array($profiles) && count($profiles)) {27 $settings->print_setting_summary($profiles);28 } else {29 $html = np_translate("Can't load google profile information. Please setup plugin again.");30 $link = $settings->get_settings_setup_link();31 $html .= " [<a href='". $link. "'>Here</a>]";32 33 echo $html;34 }35 }36 50 } 37 51 -
nepirity-analytics/trunk/templates/css/bootstrap-nepirity.css
r1666843 r1673045 3257 3257 width: 100px; 3258 3258 height: 45px; 3259 } 3260 3261 .compare { 3262 padding: 0px 5px 5px 5px; 3259 3263 } 3260 3264 … … 6905 6909 .table-chart-title { 6906 6910 } 6911 6912 ol { 6913 counter-reset: li; /* Initiate a counter */ 6914 list-style: none; /* Remove default numbering */ 6915 *list-style: decimal; /* Keep using default numbering for IE6/7 */ 6916 font: 15px 'trebuchet MS', 'lucida sans'; 6917 padding: 0; 6918 margin-bottom: 4em; 6919 text-shadow: 0 1px 0 rgba(255,255,255,.5); 6920 } 6921 6922 ol ol { 6923 margin: 0 0 0 2em; /* Add some left margin for inner lists */ 6924 } 6925 6926 .rounded-list a { 6927 position: relative; 6928 display: block; 6929 padding: 0.4em 0.4em 0.4em 0.7em; 6930 *padding: .4em; 6931 margin: .5em 0; 6932 color: #444; 6933 text-decoration: none; 6934 border-radius: .3em; 6935 } 6936 6937 .rounded-list a:before{ 6938 content: counter(li); 6939 counter-increment: li; 6940 position: absolute; 6941 left: -1.3em; 6942 top: 50%; 6943 margin-top: -1.3em; 6944 background: #87ceeb; 6945 height: 2em; 6946 width: 2em; 6947 line-height: 2em; 6948 border: .3em solid #fff; 6949 text-align: center; 6950 font-weight: bold; 6951 border-radius: 2em; 6952 transition: all .3s ease-out; 6953 } 6954 6955 .match-height { 6956 width:inherit; 6957 height:300px; 6958 } -
nepirity-analytics/trunk/templates/css/jqcloud.css
r1669999 r1673045 45 45 overflow: hidden; 46 46 position: relative; 47 margin: 0 auto; 47 48 } 48 49
Note: See TracChangeset
for help on using the changeset viewer.