Changeset 991985
- Timestamp:
- 09/17/2014 03:12:44 PM (11 years ago)
- Location:
- sm2wp-google-minimal
- Files:
-
- 10 added
- 5 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/classes (added)
-
tags/1.2.0/classes/common.php (added)
-
tags/1.2.0/classes/google_plus.php (added)
-
tags/1.2.0/classes/sm2wp_googleplus.php (added)
-
tags/1.2.0/classes/sm2wp_googleplus_admin.php (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/sm2wp.php (added)
-
tags/1.2.0/views (added)
-
tags/1.2.0/views/admin.php (added)
-
trunk/classes/google_plus.php (modified) (5 diffs)
-
trunk/classes/sm2wp_googleplus_admin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sm2wp.php (modified) (1 diff)
-
trunk/views/admin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sm2wp-google-minimal/trunk/classes/google_plus.php
r991640 r991985 337 337 } 338 338 339 $authString = $this->_parent->apiKey ? 'key='.$this->_parent->apiKey : 'access_token='.$this->_parent->accessToken; 339 340 do 340 341 { 341 list($s, $r) = SM2WP_GooglePlus_Library::get(SM2WP_GooglePlus_Library::API_URL."activities/$this->id/comments?maxResults=100&pageToken=$pageToken& access_token=".$this->_parent->accessToken);342 list($s, $r) = SM2WP_GooglePlus_Library::get(SM2WP_GooglePlus_Library::API_URL."activities/$this->id/comments?maxResults=100&pageToken=$pageToken&".$authString); 342 343 343 344 if (!$r) { … … 379 380 public $author = null; 380 381 382 public $apiKey = null; 383 public $authString = null; 384 381 385 public function __construct($id, $accessToken, $profileId, $name=null, $avatar=null, $author=null) { 382 386 $this->id = $id; … … 386 390 $this->avatar = $avatar; 387 391 $this->author = $author; 392 $this->apiKey = get_option('gfw_api_key'); 393 394 $this->authString = $this->apiKey ? 'key='.$this->apiKey : 'access_token='.$this->accessToken; 388 395 } 389 396 … … 431 438 432 439 public function update_profile() { 433 $url = SM2WP_GooglePlus_Library::API_URL.'people/'.$this->profileId. '?access_token='.$this->accessToken;440 $url = SM2WP_GooglePlus_Library::API_URL.'people/'.$this->profileId."?$this->authString"; 434 441 list($s, $r) = SM2WP_GooglePlus_Library::get($url); 435 442 // if (in_array($s, array(401,403))) { 436 if (!$ r || json_decode($r)->error) {443 if (!$this->apiKey && (!$r || json_decode($r)->error)) { 437 444 $this->refresh(); 438 445 $url = SM2WP_GooglePlus_Library::API_URL.'people/'.$this->profileId.'?access_token='.$this->accessToken; … … 455 462 $maxResolution = get_option('gfw_max_resolution', 1024); 456 463 do { 457 $url = SM2WP_GooglePlus_Library::API_URL."people/$this->profileId/activities/public?access_token=$this->accessToken&maxResults=$maxResults&pageToken=$pageToken"; 464 465 $url = SM2WP_GooglePlus_Library::API_URL."people/$this->profileId/activities/public?maxResults=$maxResults&pageToken=$pageToken&$this->authString"; 458 466 list($s, $r) = SM2WP_GooglePlus_Library::get($url); 459 467 460 468 #if (in_array($s, array(401,403))) { 461 if (!$ r || json_decode($r)->error) {469 if (!$this->apiKey && (!$r || json_decode($r)->error)) { 462 470 $this->refresh(); 463 471 $url = SM2WP_GooglePlus_Library::API_URL."people/$this->profileId/activities/public?access_token=$this->accessToken&maxResults=$maxResults&pageToken=$pageToken"; -
sm2wp-google-minimal/trunk/classes/sm2wp_googleplus_admin.php
r989546 r991985 115 115 116 116 register_setting('gfw_profiles', 'gfw_profiles'); 117 register_setting('gfw_api', 'gfw_api_key', array($this, 'api_key_resolution_changed')); 117 118 register_setting('gfw_import_settings', 'gfw_history'); 118 119 register_setting('gfw_import_settings', 'gfw_comments'); … … 133 134 } 134 135 136 public function api_key_resolution_changed($api_key) { 137 if (!trim($api_key)) { 138 if (get_option('gfw_history') > 100) update_option('gfw_history', 100); 139 if (get_option('gfw_comments')) update_option('gfw_comments', false); 140 } 141 return trim($api_key); 142 } 143 135 144 public function max_resolution_changed($max_resolution) { 136 if (! $max_resolution) $max_resolution = '1024';145 if (!trim($max_resolution)) $max_resolution = '1024'; 137 146 return $max_resolution; 138 147 } -
sm2wp-google-minimal/trunk/readme.txt
r991783 r991985 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.0 7 Stable tag: 1. 1.97 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 47 47 48 48 == Changelog == 49 50 = 1.2.0 = 51 * Added API Key setting to ensure a way around exceeded quotas 49 52 50 53 = 1.1.9 = -
sm2wp-google-minimal/trunk/sm2wp.php
r991783 r991985 4 4 * Plugin URI: http://sm2wp.com 5 5 * Description: Import your Google+ Posts to your WordPress Blog 6 * Version: 1. 1.96 * Version: 1.2.0 7 7 * Author: Daniel Treadwell 8 8 * Author URI: http://minimali.se -
sm2wp-google-minimal/trunk/views/admin.php
r991783 r991985 138 138 </div> 139 139 </div> 140 141 142 143 140 <div id='dashboard-widgets-wrap'> 144 141 <div id='dashboard-widgets' class='metabox-holder'> … … 252 249 <div id='side-sortables' class="meta-box-sortables ui-sortable"> 253 250 251 <div class='postbox'> 252 253 <h3 class='hndle' style='cursor:default;'>Connectivity</h3> 254 <div class="inside"> 255 <div class="main"> 256 <form action='options.php' method='POST'> 257 <?php settings_fields( 'gfw_api' ); ?> 258 259 <ul> 260 261 262 <li style='clear:both;'> 263 <b>API Key</b> 264 <input style='float:right;margin-top:6px;' size='35' type='text' name='gfw_api_key' value='<?php echo get_option('gfw_api_key') ?>' /> 265 <a style='display:block;' href='#'>What is this?</a> 266 </li> 267 268 </ul> 269 <input type='submit' class='button button-primary' value='Update Key'> 270 </form> 271 </div> 272 </div> 273 </div> 274 254 275 255 276 <div class='postbox'>
Note: See TracChangeset
for help on using the changeset viewer.