Changeset 1669213
- Timestamp:
- 06/02/2017 04:36:50 AM (9 years ago)
- Location:
- nepirity-analytics/trunk
- Files:
-
- 10 edited
-
languages/nepirity-services-ko_KR.mo (modified) (previous)
-
languages/nepirity-services-ko_KR.po (modified) (6 diffs)
-
languages/nepirity-services.pot (modified) (5 diffs)
-
modules/analytics.php (modified) (3 diffs)
-
modules/settings.php (modified) (8 diffs)
-
modules/setup.php (modified) (7 diffs)
-
modules/views.php (modified) (1 diff)
-
nepirity-analytics.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
sdk/classes/google.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
nepirity-analytics/trunk/languages/nepirity-services-ko_KR.po
r1666843 r1669213 9 9 "Project-Id-Version: nepirity-services\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2017-0 5-28 11:47+0000\n"12 "PO-Revision-Date: 2017-0 5-28 11:47+0000\n"11 "POT-Creation-Date: 2017-06-02 04:11+0000\n" 12 "PO-Revision-Date: 2017-06-02 04:11+0000\n" 13 13 "Last-Translator: Automatically generated\n" 14 14 "Language-Team: none\n" … … 23 23 msgstr "구글 프로파일 정보를 가져올 수 없습니다. 플러그인을 다시 설정해 주시기 바랍니다." 24 24 25 #: modules/settings.php:1 1925 #: modules/settings.php:126 26 26 msgid "Click, if you want to bring up the Nepirity Setup Wizard." 27 27 msgstr "네피리티 설정 마법사를 다시 실행하실 수 있습니다." … … 31 31 msgstr "대시보드" 32 32 33 #: modules/settings.php: 4733 #: modules/settings.php:54 34 34 msgid "Dismiss this notice." 35 35 msgstr "숨기기" 36 36 37 #: modules/setup.php:3 537 #: modules/setup.php:37 38 38 msgid "Done" 39 39 msgstr "완료" 40 40 41 #: modules/settings.php: 24941 #: modules/settings.php:308 42 42 msgid "Enable Standard Tracking" 43 43 msgstr "Tracking 활성화" 44 44 45 #: modules/admin.php:7 245 #: modules/admin.php:73 46 46 msgid "General" 47 47 msgstr "일반" 48 48 49 #: modules/setup.php: 7649 #: modules/setup.php:83 50 50 msgid "Go Back" 51 msgstr "뒤로 가기"52 53 #: modules/settings.php:2 1951 msgstr "뒤로" 52 53 #: modules/settings.php:264 54 54 msgid "Google Account Service Key" 55 msgstr "구글 계정 저비스 키"56 57 #: modules/settings.php:1 1455 msgstr "구글 계정 서비스 키" 56 57 #: modules/settings.php:121 58 58 msgid "Google Account Setting" 59 59 msgstr "구글 계정 설정" 60 60 61 #: modules/settings.php:356 61 #: modules/settings.php:239 modules/setup.php:168 62 msgid "Google Authentication Type" 63 msgstr "구글 인증 방법" 64 65 #. The same with google account 66 #: modules/settings.php:277 67 msgid "Google OAuth Code" 68 msgstr "구글 OAuth 코드" 69 70 #: modules/setup.php:188 71 msgid "Google OAuth Setting" 72 msgstr "구글 OAuth 설정" 73 74 #: modules/settings.php:420 62 75 msgid "Google Profile Error!" 63 msgstr "구글 프로 파일에러"64 65 #: modules/setup.php: 16876 msgstr "구글 프로필 에러" 77 78 #: modules/setup.php:232 66 79 msgid "Google Profile Setting" 67 msgstr "구글 프로 파일설정"68 69 #: modules/setup.php:1 5780 msgstr "구글 프로필 설정" 81 82 #: modules/setup.php:196 70 83 msgid "Google Service Account Setting" 71 msgstr "구글 서비스 계정 정보설정"72 73 #: modules/setup.php: 28774 msgid "Google Se rvice Account keyinformation is not appropriate."75 msgstr "구글 서비스 계정 키정보가 올바르지 않습니다."76 77 #: modules/settings.php:1 3684 msgstr "구글 서비스 계정 설정" 85 86 #: modules/setup.php:351 87 msgid "Google Setting information is not appropriate." 88 msgstr "구글 설정 정보가 올바르지 않습니다." 89 90 #: modules/settings.php:143 78 91 msgid "Goolge Tracking Options" 79 92 msgstr "구글 Tracking 옵션" 80 93 81 #: modules/settings.php:1 2494 #: modules/settings.php:131 82 95 msgid "Goolge View Setting" 83 96 msgstr "구글 뷰 설정" 84 97 85 #: modules/settings.php:10 098 #: modules/settings.php:107 86 99 msgid "" 87 100 "In order to use Nepirity Analysis Service, please enter your account " … … 89 102 msgstr "네피리티 분석 서비스를 이용하기 위해서는 아래 계정 정보를 입력하시기 바랍니다." 90 103 91 #: modules/settings.php:1 25104 #: modules/settings.php:132 92 105 msgid "" 93 106 "In order to use Nepirity Analysis Service, please select your Goolge view " … … 99 112 msgstr "네피리티" 100 113 101 #. Description of the plugin 102 msgid "" 103 "Nepirity Analytics is a plugin that provides web traffic data analysis " 104 "feature with data gathered from Google Analytics." 105 msgstr "" 106 "Nepirity Analytics 플러그인은 Google Analytics 으로부터 수집된 데이터를 분석" 107 "하여 정보를 제공합니다." 108 109 110 #: modules/settings.php:210 114 #: modules/settings.php:217 111 115 msgid "Nepirity KEY" 112 116 msgstr "네피리티 키" 113 117 114 #: modules/setup.php:1 36118 #: modules/setup.php:143 115 119 msgid "Nepirity Plugin Setting" 116 120 msgstr "네피리티 플러그인 설정" 117 121 118 #: modules/setup.php:1 29122 #: modules/setup.php:136 119 123 msgid "Nepirity Plugin Setup Wizard" 120 124 msgstr "네피리티 플러그인 설치 마법사" 121 125 122 #: modules/settings.php: 99126 #: modules/settings.php:106 123 127 msgid "Nepirity Settings" 124 128 msgstr "네피리티 설정" 125 129 126 #: modules/setup.php: 257130 #: modules/setup.php:148 127 131 msgid "Nepirity key information is not appropriate." 128 132 msgstr "네피리티 키 정보가 올바르지 않습니다." 129 133 130 #: modules/setup.php: 28134 #: modules/setup.php:30 131 135 msgid "Next" 132 136 msgstr "다음" 133 137 134 #: modules/setup.php: 152138 #: modules/setup.php:204 135 139 msgid "Please save it again." 136 140 msgstr "다시 저장해 주시기 바랍니다." 137 141 138 #: modules/setup.php:146 142 #: modules/setup.php:166 143 msgid "Please select a Google authentication method." 144 msgstr "구글 인증 방법을 선택해 주시기 바랍니다." 145 146 #: modules/setup.php:353 147 msgid "Please set up your account information correctly." 148 msgstr "계정 정보를 올바르게 설정해 주시기 바랍니다." 149 150 #: modules/setup.php:189 151 msgid "Please, enter Google OAuth code." 152 msgstr "구글 OAuth 코드를 입력해 주시기 바랍니다." 153 154 #: modules/setup.php:198 139 155 msgid "Please, enter your Google Service account information." 140 156 msgstr "구글 서비스 계정 정보를 입력해 주시기 바랍니다." 141 157 142 #: modules/setup.php:1 37158 #: modules/setup.php:144 143 159 msgid "Please, enter your Nepirity plugin key." 144 160 msgstr "네피리티 플러그인 키 정보를 입력해 주시기 바랍니다." 145 161 146 #: modules/setup.php:289 147 msgid "Please, input appropriate Google Service Account key information." 148 msgstr "올바른 구글 서비스 키 정보를 입력해 주시기 바랍니다." 149 150 #: modules/setup.php:258 162 #: modules/setup.php:149 151 163 msgid "" 152 164 "Please, input appropriate Nepirity key information and check that the key " … … 154 166 msgstr "올바른 네피리티 키 정보를 입력해 주시기 바랍니다." 155 167 156 #: modules/setup.php: 169168 #: modules/setup.php:233 157 169 msgid "Please, select your Google View information." 158 msgstr "구글 뷰 를 선택해 주시기 바랍니다."159 160 #: nepirity .php:127modules/views.php:113 modules/admin.php:61170 msgstr "구글 뷰 정보를 선택해 주시기 바랍니다." 171 172 #: nepirity-analytics.php:125 modules/views.php:113 modules/admin.php:61 161 173 msgid "Settings" 162 174 msgstr "설정" 163 175 164 #: modules/settings.php: 45176 #: modules/settings.php:52 165 177 msgid "Settings saved." 166 msgstr " 변경된 내용이 저장되었습니다."167 168 #: modules/setup.php:3 1178 msgstr "설정이 저장되었습니다." 179 180 #: modules/setup.php:33 169 181 msgid "Start" 170 182 msgstr "시작" 171 183 172 #: modules/setup.php:13 0184 #: modules/setup.php:137 173 185 msgid "Start Nepirity plugin setup wizard" 174 msgstr "네피리티 설정마법사를 시작합니다."175 176 #: modules/admin.php:6 7186 msgstr "네피리티 플러그인 설치 마법사를 시작합니다." 187 188 #: modules/admin.php:68 177 189 msgid "Summary" 178 190 msgstr "개요" 179 191 180 #: modules/settings.php: 249192 #: modules/settings.php:308 181 193 msgid "Tracking Option" 182 194 msgstr "Tracking 옵션" 183 195 184 #: modules/settings.php:1 48196 #: modules/settings.php:155 185 197 msgid "Update" 186 198 msgstr "수정" 187 199 188 #: modules/setup.php: 154200 #: modules/setup.php:206 189 201 msgid "When you leave this page, the previously saved values are retained." 190 202 msgstr "이 페이지를 나가면, 이전에 저장된 값은 유지됩니다." 191 203 192 #: modules/setup.php:149 204 #: modules/settings.php:271 205 msgid "You can check Google OAuth code" 206 msgstr "구글 OAuth 코드를 확인 하실 수 있습니다." 207 208 #: modules/setup.php:201 193 209 msgid "You can not modify the encrypted key." 194 msgstr "암호화 되어 저장된 내용은 수정 할수 없습니다."195 196 #: modules/settings.php:1 16210 msgstr "암호화된 키는 수정 하실 수 없습니다." 211 212 #: modules/settings.php:123 197 213 msgid "You cannot edit saved Google account information." 198 msgstr " 암호화 되어저장된 구글 계정 정보는 수정 하실 수 없습니다."199 200 #: modules/settings.php: 250214 msgstr "저장된 구글 계정 정보는 수정 하실 수 없습니다." 215 216 #: modules/settings.php:309 201 217 msgid "You don't need to enable this if already inserted Google tracking code." 202 218 msgstr "이미 Tracking 코드가 삽입되었으면, 이 옵션을 활성화 할 필요가 없습니다." 203 219 204 #: modules/setup.php: 263220 #: modules/setup.php:154 205 221 msgid "Your current site address is:" 206 msgstr "여러분의 현재사이트 주소는 다음과 같습니다."207 208 #: modules/settings.php:12 0222 msgstr "여러분의 사이트 주소는 다음과 같습니다." 223 224 #: modules/settings.php:127 209 225 msgid "[Here]" 210 226 msgstr "[이곳]" 211 227 212 #: modules/settings.php:2 29228 #: modules/settings.php:288 213 229 msgid "account" 214 230 msgstr "계정" 215 231 216 #: modules/settings.php:2 34232 #: modules/settings.php:293 217 233 msgid "property" 218 234 msgstr "속성" 219 235 220 #: modules/settings.php:2 39236 #: modules/settings.php:298 221 237 msgid "view" 222 238 msgstr "뷰" 239 240 #. Description of the plugin 241 msgid "" 242 "Nepirity Analytics is a plugin that provides web traffic data analysis " 243 "feature with data gathered from Google Analytics." 244 msgstr "Nepirity Analytics 플러그인은 Google Analytics 으로부터 수집된 데이터를 분석하여 정보를 제공합니다." -
nepirity-analytics/trunk/languages/nepirity-services.pot
r1666843 r1669213 9 9 "Project-Id-Version: nepirity-services\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2017-0 5-28 11:47+0000\n"11 "POT-Creation-Date: 2017-06-02 04:11+0000\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 22 22 msgstr "" 23 23 24 #: modules/settings.php:1 1924 #: modules/settings.php:126 25 25 msgid "Click, if you want to bring up the Nepirity Setup Wizard." 26 26 msgstr "" 27 27 28 #: modules/admin.php:58 modules/admin.php:5828 #: modules/admin.php:58 29 29 msgid "Dashboard" 30 30 msgstr "" 31 31 32 #: modules/settings.php: 4732 #: modules/settings.php:54 33 33 msgid "Dismiss this notice." 34 34 msgstr "" 35 35 36 #: modules/setup.php:3 5 modules/setup.php:3536 #: modules/setup.php:37 37 37 msgid "Done" 38 38 msgstr "" 39 39 40 #: modules/settings.php: 24940 #: modules/settings.php:308 41 41 msgid "Enable Standard Tracking" 42 42 msgstr "" 43 43 44 #: modules/admin.php:7 2 modules/admin.php:7244 #: modules/admin.php:73 45 45 msgid "General" 46 46 msgstr "" 47 47 48 #: modules/setup.php: 76 modules/setup.php:7648 #: modules/setup.php:83 49 49 msgid "Go Back" 50 50 msgstr "" 51 51 52 #: modules/settings.php:2 1952 #: modules/settings.php:264 53 53 msgid "Google Account Service Key" 54 54 msgstr "" 55 55 56 #: modules/settings.php:1 1456 #: modules/settings.php:121 57 57 msgid "Google Account Setting" 58 58 msgstr "" 59 59 60 #: modules/settings.php:356 60 #: modules/settings.php:239 modules/setup.php:168 61 msgid "Google Authentication Type" 62 msgstr "" 63 64 #. The same with google account 65 #: modules/settings.php:277 66 msgid "Google OAuth Code" 67 msgstr "" 68 69 #: modules/setup.php:188 70 msgid "Google OAuth Setting" 71 msgstr "" 72 73 #: modules/settings.php:420 61 74 msgid "Google Profile Error!" 62 75 msgstr "" 63 76 64 #: modules/setup.php: 168 modules/setup.php:16877 #: modules/setup.php:232 65 78 msgid "Google Profile Setting" 66 79 msgstr "" 67 80 68 #: modules/setup.php:1 57 modules/setup.php:15781 #: modules/setup.php:196 69 82 msgid "Google Service Account Setting" 70 83 msgstr "" 71 84 72 #: modules/setup.php: 287 modules/setup.php:28773 msgid "Google Se rvice Account keyinformation is not appropriate."74 msgstr "" 75 76 #: modules/settings.php:1 3685 #: modules/setup.php:351 86 msgid "Google Setting information is not appropriate." 87 msgstr "" 88 89 #: modules/settings.php:143 77 90 msgid "Goolge Tracking Options" 78 91 msgstr "" 79 92 80 #: modules/settings.php:1 2493 #: modules/settings.php:131 81 94 msgid "Goolge View Setting" 82 95 msgstr "" 83 96 84 #: modules/settings.php:10 097 #: modules/settings.php:107 85 98 msgid "" 86 99 "In order to use Nepirity Analysis Service, please enter your account " … … 88 101 msgstr "" 89 102 90 #: modules/settings.php:1 25103 #: modules/settings.php:132 91 104 msgid "" 92 105 "In order to use Nepirity Analysis Service, please select your Goolge view " … … 94 107 msgstr "" 95 108 96 #: modules/admin.php:54 modules/admin.php:54109 #: modules/admin.php:54 97 110 msgid "Nepirity" 98 111 msgstr "" 99 112 100 #. Description of the plugin 101 msgid "" 102 "Nepirity Analytics is a plugin that provides web traffic data analysis " 103 "feature with data gathered from Google Analytics." 104 msgstr "" 105 106 #: modules/settings.php:210 113 #: modules/settings.php:217 107 114 msgid "Nepirity KEY" 108 115 msgstr "" 109 116 110 #: modules/setup.php:1 36 modules/setup.php:136117 #: modules/setup.php:143 111 118 msgid "Nepirity Plugin Setting" 112 119 msgstr "" 113 120 114 #: modules/setup.php:1 29 modules/setup.php:129121 #: modules/setup.php:136 115 122 msgid "Nepirity Plugin Setup Wizard" 116 123 msgstr "" 117 124 118 #: modules/settings.php: 99125 #: modules/settings.php:106 119 126 msgid "Nepirity Settings" 120 127 msgstr "" 121 128 122 #: modules/setup.php: 257 modules/setup.php:257129 #: modules/setup.php:148 123 130 msgid "Nepirity key information is not appropriate." 124 131 msgstr "" 125 132 126 #: modules/setup.php: 28 modules/setup.php:28133 #: modules/setup.php:30 127 134 msgid "Next" 128 135 msgstr "" 129 136 130 #: modules/setup.php: 152 modules/setup.php:152137 #: modules/setup.php:204 131 138 msgid "Please save it again." 132 139 msgstr "" 133 140 134 #: modules/setup.php:146 modules/setup.php:146 141 #: modules/setup.php:166 142 msgid "Please select a Google authentication method." 143 msgstr "" 144 145 #: modules/setup.php:353 146 msgid "Please set up your account information correctly." 147 msgstr "" 148 149 #: modules/setup.php:189 150 msgid "Please, enter Google OAuth code." 151 msgstr "" 152 153 #: modules/setup.php:198 135 154 msgid "Please, enter your Google Service account information." 136 155 msgstr "" 137 156 138 #: modules/setup.php:1 37 modules/setup.php:137157 #: modules/setup.php:144 139 158 msgid "Please, enter your Nepirity plugin key." 140 159 msgstr "" 141 160 142 #: modules/setup.php:289 modules/setup.php:289 143 msgid "Please, input appropriate Google Service Account key information." 144 msgstr "" 145 146 #: modules/setup.php:258 modules/setup.php:258 161 #: modules/setup.php:149 147 162 msgid "" 148 163 "Please, input appropriate Nepirity key information and check that the key " … … 150 165 msgstr "" 151 166 152 #: modules/setup.php: 169 modules/setup.php:169167 #: modules/setup.php:233 153 168 msgid "Please, select your Google View information." 154 169 msgstr "" 155 170 156 #: nepirity.php:127 modules/views.php:113 modules/admin.php:61 157 #: modules/views.php:113 modules/admin.php:61 171 #: nepirity-analytics.php:125 modules/views.php:113 modules/admin.php:61 158 172 msgid "Settings" 159 173 msgstr "" 160 174 161 #: modules/settings.php: 45175 #: modules/settings.php:52 162 176 msgid "Settings saved." 163 177 msgstr "" 164 178 165 #: modules/setup.php:3 1 modules/setup.php:31179 #: modules/setup.php:33 166 180 msgid "Start" 167 181 msgstr "" 168 182 169 #: modules/setup.php:13 0 modules/setup.php:130183 #: modules/setup.php:137 170 184 msgid "Start Nepirity plugin setup wizard" 171 185 msgstr "" 172 186 173 #: modules/admin.php:6 7 modules/admin.php:67187 #: modules/admin.php:68 174 188 msgid "Summary" 175 189 msgstr "" 176 190 177 #: modules/settings.php: 249191 #: modules/settings.php:308 178 192 msgid "Tracking Option" 179 193 msgstr "" 180 194 181 #: modules/settings.php:1 48195 #: modules/settings.php:155 182 196 msgid "Update" 183 197 msgstr "" 184 198 185 #: modules/setup.php: 154 modules/setup.php:154199 #: modules/setup.php:206 186 200 msgid "When you leave this page, the previously saved values are retained." 187 201 msgstr "" 188 202 189 #: modules/setup.php:149 modules/setup.php:149 203 #: modules/settings.php:271 204 msgid "You can check Google OAuth code" 205 msgstr "" 206 207 #: modules/setup.php:201 190 208 msgid "You can not modify the encrypted key." 191 209 msgstr "" 192 210 193 #: modules/settings.php:1 16211 #: modules/settings.php:123 194 212 msgid "You cannot edit saved Google account information." 195 213 msgstr "" 196 214 197 #: modules/settings.php: 250215 #: modules/settings.php:309 198 216 msgid "You don't need to enable this if already inserted Google tracking code." 199 217 msgstr "" 200 218 201 #: modules/setup.php: 263 modules/setup.php:263219 #: modules/setup.php:154 202 220 msgid "Your current site address is:" 203 221 msgstr "" 204 222 205 #: modules/settings.php:12 0223 #: modules/settings.php:127 206 224 msgid "[Here]" 207 225 msgstr "" 208 226 209 #: modules/settings.php:2 29227 #: modules/settings.php:288 210 228 msgid "account" 211 229 msgstr "" 212 230 213 #: modules/settings.php:2 34231 #: modules/settings.php:293 214 232 msgid "property" 215 233 msgstr "" 216 234 217 #: modules/settings.php:2 39235 #: modules/settings.php:298 218 236 msgid "view" 219 237 msgstr "" 238 239 #. Description of the plugin 240 msgid "Nepirity Analytics is a plugin that provides web traffic data analysis feature with data gathered from Google Analytics." 241 msgstr "" -
nepirity-analytics/trunk/modules/analytics.php
r1666843 r1669213 7 7 } 8 8 9 public function get_google_access_token() { 9 public function get_google_auth_link() { 10 return NP()->jsonrpc()->google()->get_auth_link(); 11 } 12 13 protected function get_googleauth_server_access_token() { 10 14 $google = NP()->jsonrpc()->google(); 11 15 $token = NP()->settings()->get_saved_google_token(); … … 21 25 } 22 26 23 public function get_google_profiles() { 27 protected function get_googleauth_oauth_access_token($key) { 28 $npkey = NP()->settings()->get_nepirity_key(); 29 $google = NP()->jsonrpc()->google(); 30 $token = $google->get_access_token_using_authkey($npkey, $key); 31 32 return $token; 33 } 34 35 public function get_google_access_token($key=null) { 36 $auth_type = NP()->settings()->get_google_authtype(); 37 38 switch ($auth_type) { 39 case Setting::GOOGLE_AUTHTYPE_OAUTH: { 40 if ($key == null) { 41 return NP()->settings()->get_saved_google_token(); 42 } 43 44 return $this->get_googleauth_oauth_access_token($key); 45 } 46 case Setting::GOOGLE_AUTHTYPE_SERVER: { 47 return $this->get_googleauth_server_access_token(); 48 } 49 } 50 51 return ""; 52 } 53 54 protected function get_googleauth_server_profiles() { 24 55 $google = NP()->jsonrpc()->google(); 25 56 $encrypted_google_key = NP()->settings()->get_google_account_auth_config(); … … 27 58 28 59 return $google->get_profiles($npkey, $encrypted_google_key); 60 } 61 62 protected function get_googleauth_oauth_profiles() { 63 $google = NP()->jsonrpc()->google(); 64 65 $encoded_token = base64_encode(json_encode(NP()->settings()->get_saved_google_token())); 66 return $google->get_profiles_using_token($encoded_token); 67 } 68 69 public function get_google_profiles() { 70 $auth_type = NP()->settings()->get_google_authtype(); 71 72 switch ($auth_type) { 73 case Setting::GOOGLE_AUTHTYPE_OAUTH: { 74 return $this->get_googleauth_oauth_profiles(); 75 } 76 case Setting::GOOGLE_AUTHTYPE_SERVER: { 77 return $this->get_googleauth_server_profiles(); 78 } 79 } 80 81 return array(); 29 82 } 30 83 -
nepirity-analytics/trunk/modules/settings.php
r1666843 r1669213 5 5 class Setting { 6 6 const FIELD_NEPIRITY_KEY = 'np_nepirity_key'; 7 const FIELD_GOOGLE_AUTHTYPE = 'np_google_auth_type'; 7 8 const FIELD_GOOGLE_ACCOUNT_AUTH_CONFIG = 'np_google_auth_config'; 8 9 const FIELD_GOOGLE_PROFILE_ACCOUNT_ID = 'np_google_profile_account_id'; … … 10 11 const FIELD_GOOGLE_PROFILE_VIEW_ID = 'np_google_profile_view_id'; 11 12 const FIELD_GOOGLE_TRACKING_ENABLED = 'np_google_tracking_enabled'; 13 14 const FIELD_NEPIRITY_VERSION = 'np_nepirity_version'; 12 15 const FIELD_NEPIRITY_SERVER = 'np_nepirity_server'; 13 16 14 17 const FIELD_GOOGLE_ACCESS_TOKEN = 'np_google_access_token'; 18 19 const GOOGLE_AUTHTYPE_OAUTH = 1; 20 const GOOGLE_AUTHTYPE_SERVER = 2; 15 21 16 22 function __construct() { … … 21 27 22 28 $options = array_merge($options, $this->get_nepirity_option_fields()); 29 $options = array_merge($options, $this->get_google_authtype_option_fields()); 23 30 $options = array_merge($options, $this->get_google_account_option_fields()); 24 31 $options = array_merge($options, $this->get_google_profile_option_fields()); … … 213 220 } 214 221 222 public function get_google_authtype() { 223 return $this->get_option_value(self::FIELD_GOOGLE_AUTHTYPE); 224 } 225 226 public function is_google_oauth_type() { 227 if (intval($this->get_option_value(self::FIELD_GOOGLE_AUTHTYPE)) 228 == self::GOOGLE_AUTHTYPE_OAUTH) { 229 return true; 230 } 231 232 return false; 233 } 234 235 public function get_google_authtype_option_fields() { 236 $option = array( 237 array( 238 "name"=>self::FIELD_GOOGLE_AUTHTYPE, 239 "type"=>"radio", "desc" => np_translate("Google Authentication Type"), 240 "options" => array( 241 array("desc"=>"OAuth Authentication (Recommeded)", "value"=>self::GOOGLE_AUTHTYPE_OAUTH, "checked"=>true), 242 array("desc"=>"Server to Server Authentication", "value"=>self::GOOGLE_AUTHTYPE_SERVER, "checked"=>false) 243 ) 244 ) 245 ); 246 247 $checked_value = intval($this->get_google_authtype()); 248 249 if ($checked_value > 0 && count($option[0]['options']) <= $checked_value) { 250 for ($i=0; $i<count($option[0]['options']); $i++) { 251 $option[0]['options'][$i]['checked'] = false; 252 } 253 254 $option[0]['options'][$checked_value -1]['checked'] = true; 255 } 256 257 return $option; 258 } 259 215 260 public function get_google_account_option_fields() { 216 261 return array( … … 218 263 "name"=>self::FIELD_GOOGLE_ACCOUNT_AUTH_CONFIG, 219 264 "type"=>"textarea", "desc" => np_translate("Google Account Service Key") 265 ) 266 ); 267 } 268 269 public function get_google_oauth_option_fields() { 270 $link = NP()->analytics()->get_google_auth_link(); 271 $memo = np_translate("You can check Google OAuth code"); 272 $memo .= " [<a href='".$link."' target='_blank'>here</a>]"; 273 274 return array( 275 array( 276 "name"=>self::FIELD_GOOGLE_ACCOUNT_AUTH_CONFIG, /* The same with google account*/ 277 "type"=>"text", "desc" => np_translate("Google OAuth Code"), 278 "memo"=>$memo 220 279 ) 221 280 ); … … 258 317 } 259 318 319 public function get_nepirity_version_option_name() { 320 return self::FIELD_NEPIRITY_VERSION; 321 } 322 260 323 public function get_all_option_fields() { 261 324 $options = array(); 262 325 263 326 $options = array_merge($options, $this->get_nepirity_option_fields()); 327 $options = array_merge($options, $this->get_google_authtype_option_fields()); 264 328 $options = array_merge($options, $this->get_google_account_option_fields()); 265 329 $options = array_merge($options, $this->get_google_profile_option_fields()); … … 407 471 } 408 472 409 $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_SERVER );473 $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_SERVER, self::FIELD_NEPIRITY_VERSION); 410 474 for ($i=0; $i<sizeof($options); $i++) { 411 delete_option($options[$i] ['name']);475 delete_option($options[$i]); 412 476 } 413 477 } … … 415 479 public function get_saved_google_token() { 416 480 $token = json_decode($this->get_option_value(self::FIELD_GOOGLE_ACCESS_TOKEN), true); 481 482 if ($this->is_google_oauth_type()) { 483 return $token; 484 } 417 485 418 486 if (sizeof($token) && isset($token['created']) && isset($token['expires_in'])) { -
nepirity-analytics/trunk/modules/setup.php
r1666843 r1669213 6 6 const STEP_DEFAULT = 'default'; 7 7 const STEP_NEPIRITY = 'nepirity'; 8 const STEP_GOOGLE_AUTHTYPE = 'google_authtype'; 8 9 const STEP_GOOGLE_ACCOUNT = 'google_account'; 9 10 const STEP_GOOGLE_PROFILE = 'google_profile'; … … 11 12 private static $STEP = array( 12 13 self::STEP_DEFAULT, self::STEP_NEPIRITY, 14 self::STEP_GOOGLE_AUTHTYPE, 13 15 self::STEP_GOOGLE_ACCOUNT, self::STEP_GOOGLE_PROFILE); 14 16 … … 65 67 echo '<td>'. NP()->settings()->get_google_view_selector_tag($data) .'</td>'; 66 68 } 69 70 if ($data['type'] == "radio") { 71 echo '<th scope="row">'.NP()->settings()->get_option_label_tag($data).'</th>'; 72 echo '<td>'. NP()->views()->get_html_from_option($data) .'</td>'; 73 } 67 74 echo " </tr>"; 68 75 } … … 138 145 } 139 146 147 private static function print_wizard_nepirity_error() { 148 $title = np_translate("Nepirity key information is not appropriate."); 149 $msg = np_translate("Please, input appropriate Nepirity key information and check that the key settings are correct."); 150 151 $msg .= "<br />"; 152 $msg .= "<br />"; 153 154 $msg .= np_translate("Your current site address is:"); 155 $msg .= "<br />".get_site_url(); 156 157 self::print_wizard_pannel($title, $msg, array(), 'nepirity_error'); 158 } 159 140 160 private static function update_nepirity_setting() { 141 161 self::update_settings(NP()->settings()->get_nepirity_option_fields()); 142 162 } 143 163 164 private static function print_wizard_google_authtype_step() { 165 $fields = NP()->settings()->get_google_authtype_option_fields(); 166 $msg = np_translate("Please select a Google authentication method."); 167 168 self::print_wizard_pannel(self::get_wizard_title(np_translate("Google Authentication Type")), 169 $msg, $fields); 170 } 171 172 private static function update_google_authtype_setting() { 173 self::update_settings(NP()->settings()->get_google_authtype_option_fields()); 174 } 175 144 176 private static function print_wizard_google_account_step() { 145 $fields = NP()->settings()->get_google_account_option_fields(); 146 $msg = np_translate("Please, enter your Google Service account information."); 147 148 if (strlen(NP()->settings()->get_google_account_auth_config())) { 149 $msg = np_translate("You can not modify the encrypted key."); 150 $msg .= " "; 151 152 $msg .= np_translate("Please save it again."); 153 $msg .= "<br />"; 154 $msg .= np_translate("When you leave this page, the previously saved values are retained."); 155 } 156 157 self::print_wizard_pannel(self::get_wizard_title(np_translate("Google Service Account Setting")), 158 $msg, $fields, 'google_setup'); 177 $msg = ""; 178 $title = ""; 179 $module = ""; 180 $fields = array(); 181 182 $auth_type = NP()->settings()->get_google_authtype(); 183 184 switch ($auth_type) { 185 case Setting::GOOGLE_AUTHTYPE_OAUTH: { 186 $module = "google_auth_oauth"; 187 $fields = NP()->settings()->get_google_oauth_option_fields(); 188 $title = self::get_wizard_title(np_translate("Google OAuth Setting")); 189 $msg = np_translate("Please, enter Google OAuth code."); 190 break; 191 } 192 193 case Setting::GOOGLE_AUTHTYPE_SERVER: { 194 $module = "google_setup"; 195 $fields = NP()->settings()->get_google_account_option_fields(); 196 $title = self::get_wizard_title(np_translate("Google Service Account Setting")); 197 198 $msg = np_translate("Please, enter your Google Service account information."); 199 200 if (strlen(NP()->settings()->get_google_account_auth_config())) { 201 $msg = np_translate("You can not modify the encrypted key."); 202 $msg .= " "; 203 204 $msg .= np_translate("Please save it again."); 205 $msg .= "<br />"; 206 $msg .= np_translate("When you leave this page, the previously saved values are retained."); 207 } 208 209 break; 210 } 211 } 212 213 self::print_wizard_pannel($title, $msg, $fields, $module); 159 214 } 160 215 private static function update_google_account_setting() { 161 216 self::update_settings(NP()->settings()->get_google_account_option_fields()); 217 218 $auth_type = NP()->settings()->get_google_authtype(); 219 if ($auth_type == Setting::GOOGLE_AUTHTYPE_OAUTH) { 220 $oauth_code = NP()->settings()->get_google_account_auth_config(); 221 222 $analytics = NP()->analytics(); 223 $token = $analytics->get_google_access_token($oauth_code); 224 NP()->settings()->save_google_token($token); 225 } 162 226 } 163 227 … … 192 256 $values[$option_name] = NP()->jsonrpc()->support()->get_fast_server(); 193 257 258 $option_name = NP()->settings()->get_nepirity_version_option_name(); 259 $options[] = array("name" => $option_name); 260 $values[$option_name] = NP()->get_plugin_version(); 261 194 262 self::update_setting_values($options, $values); 195 263 } … … 248 316 break; 249 317 } 318 case self::STEP_GOOGLE_AUTHTYPE: { 319 self::update_nepirity_setting(); // update and check it 320 $key = NP()->settings()->get_nepirity_key(); 321 322 if (NP()->settings()->is_validated_nepirity_key($key)) { 323 self::print_wizard_google_authtype_step(); 324 } else { 325 self::print_wizard_nepirity_error(); 326 } 327 break; 328 } 250 329 case self::STEP_GOOGLE_ACCOUNT: { 251 self::update_nepirity_setting(); 252 $key = NP()->settings()->get_nepirity_key(); 253 254 if (NP()->settings()->is_validated_nepirity_key($key)) { 255 self::print_wizard_google_account_step(); 256 } else { 257 $title = np_translate("Nepirity key information is not appropriate."); 258 $msg = np_translate("Please, input appropriate Nepirity key information and check that the key settings are correct."); 259 260 $msg .= "<br />"; 261 $msg .= "<br />"; 262 263 $msg .= np_translate("Your current site address is:"); 264 $msg .= "<br />".get_site_url(); 265 266 self::print_wizard_pannel($title, $msg, array(), 'nepirity_error'); 267 } 330 self::update_google_authtype_setting(); 331 self::print_wizard_google_account_step(); 268 332 break; 269 333 } … … 285 349 } else { 286 350 $msg = ""; 287 $title = np_translate("Google Se rvice Account keyinformation is not appropriate.");288 289 $msg .= np_translate("Please , input appropriate Google Service Account key information.")."<br />";351 $title = np_translate("Google Setting information is not appropriate."); 352 353 $msg .= np_translate("Please set up your account information correctly.")."<br />"; 290 354 $msg .= "<br />". self::get_google_error($error_msg); 291 355 -
nepirity-analytics/trunk/modules/views.php
r1666843 r1669213 115 115 echo $html; 116 116 } 117 118 public function get_html_from_option($option) { 119 $html = ""; 120 121 if ($option['type'] == 'radio') { 122 $name = $option['name']; 123 124 foreach ($option['options'] as $data) { 125 $checked = ""; 126 if ($data['checked']) $checked = ' checked="checked"'; 127 128 $html .= '<input type="radio" name="'.$name.'" value="'.$data['value'].'" '.$checked.'>'; 129 $html .= $data['desc']. '<br />'; 130 } 131 } 132 133 return $html; 134 } 117 135 } 118 136 -
nepirity-analytics/trunk/nepirity-analytics.php
r1666843 r1669213 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. 05 Version: 1.0.1 6 6 Author: Nepirity Corp. 7 7 Author URI: https://www.nepirity.com/ -
nepirity-analytics/trunk/readme.txt
r1666843 r1669213 5 5 Requires at least: 4.6.5 6 6 Tested up to: 4.7.5 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 62 62 63 63 == Changelog == 64 = 1.0.1 = 65 Added Google authentication method. 66 64 67 = 1.0.0 = 65 68 first version. 66 69 67 70 == Upgrade Notice == 68 = 1.0. 0=69 Ne pirity Analytics Official Version.71 = 1.0.1 = 72 New Google authentication method has been added. You can install the plugin a little easier and more convenient. -
nepirity-analytics/trunk/sdk/classes/google.php
r1666843 r1669213 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 11 48 } 12 49
Note: See TracChangeset
for help on using the changeset viewer.