Plugin Directory

Changeset 991985


Ignore:
Timestamp:
09/17/2014 03:12:44 PM (11 years ago)
Author:
djtidau
Message:

1.2.0

Location:
sm2wp-google-minimal
Files:
10 added
5 edited

Legend:

Unmodified
Added
Removed
  • sm2wp-google-minimal/trunk/classes/google_plus.php

    r991640 r991985  
    337337        }
    338338
     339        $authString = $this->_parent->apiKey ? 'key='.$this->_parent->apiKey : 'access_token='.$this->_parent->accessToken;
    339340        do
    340341        {
    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);
    342343
    343344            if (!$r) {
     
    379380    public $author = null;
    380381
     382    public $apiKey = null;
     383    public $authString = null;
     384
    381385    public function __construct($id, $accessToken, $profileId, $name=null, $avatar=null, $author=null) {
    382386        $this->id = $id;
     
    386390        $this->avatar = $avatar;
    387391        $this->author = $author;
     392        $this->apiKey = get_option('gfw_api_key');
     393
     394        $this->authString = $this->apiKey ? 'key='.$this->apiKey : 'access_token='.$this->accessToken;
    388395    }
    389396
     
    431438
    432439    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";
    434441        list($s, $r) = SM2WP_GooglePlus_Library::get($url);
    435442//         if (in_array($s, array(401,403))) {
    436         if (!$r || json_decode($r)->error) {
     443        if (!$this->apiKey && (!$r || json_decode($r)->error)) {
    437444            $this->refresh();
    438445            $url = SM2WP_GooglePlus_Library::API_URL.'people/'.$this->profileId.'?access_token='.$this->accessToken;
     
    455462        $maxResolution = get_option('gfw_max_resolution', 1024);
    456463        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";
    458466            list($s, $r) = SM2WP_GooglePlus_Library::get($url);
    459467
    460468            #if (in_array($s, array(401,403))) {
    461             if (!$r || json_decode($r)->error) {
     469            if (!$this->apiKey && (!$r || json_decode($r)->error)) {
    462470                $this->refresh();
    463471                $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  
    115115
    116116        register_setting('gfw_profiles', 'gfw_profiles');
     117    register_setting('gfw_api', 'gfw_api_key', array($this, 'api_key_resolution_changed'));
    117118        register_setting('gfw_import_settings', 'gfw_history');
    118119        register_setting('gfw_import_settings', 'gfw_comments');
     
    133134    }
    134135
     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
    135144    public function max_resolution_changed($max_resolution) {
    136         if (!$max_resolution) $max_resolution = '1024';
     145        if (!trim($max_resolution)) $max_resolution = '1024';
    137146        return $max_resolution;
    138147    }
  • sm2wp-google-minimal/trunk/readme.txt

    r991783 r991985  
    55Requires at least: 3.0.1
    66Tested up to: 4.0
    7 Stable tag: 1.1.9
     7Stable tag: 1.2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4747
    4848== Changelog ==
     49
     50= 1.2.0 =
     51* Added API Key setting to ensure a way around exceeded quotas
    4952
    5053= 1.1.9 =
  • sm2wp-google-minimal/trunk/sm2wp.php

    r991783 r991985  
    44 * Plugin URI:      http://sm2wp.com
    55 * Description:     Import your Google+ Posts to your WordPress Blog
    6  * Version:         1.1.9
     6 * Version:         1.2.0
    77 * Author:            Daniel Treadwell
    88 * Author URI:      http://minimali.se
  • sm2wp-google-minimal/trunk/views/admin.php

    r991783 r991985  
    138138        </div>
    139139    </div>
    140 
    141 
    142 
    143140    <div id='dashboard-widgets-wrap'>
    144141        <div id='dashboard-widgets' class='metabox-holder'>
     
    252249    <div id='side-sortables' class="meta-box-sortables ui-sortable">
    253250
     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
    254275
    255276<div class='postbox'>
Note: See TracChangeset for help on using the changeset viewer.