Plugin Directory

Changeset 805313


Ignore:
Timestamp:
11/16/2013 10:31:49 AM (12 years ago)
Author:
sebstein
Message:
  • adapted to latest Google+ API changes
  • updated documentation how to get Google+ API key
Location:
g-crossposting/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • g-crossposting/trunk/admin.php

    r744548 r805313  
    172172 */
    173173function g_crossposting_options_validate($input) {
    174     // validate Google+ ID
     174    // trim Google+ ID
    175175    $new_input['gplusid'] = trim($input['gplusid']);
    176     if (! g_crossposting_check_gplusid($new_input['gplusid'])) {
    177         $new_input['gplusid'] = '';
    178         g_crossposting_add_error('g_crossposting_err_gplusid', __("You provided an invalid Google+ ID."));
    179     }
    180 
    181     // validate Google API key
     176
     177    // trim Google API key
    182178    $new_input['apikey'] = trim($input['apikey']);
    183     if (! g_crossposting_check_apikey($new_input['apikey'])) {
    184         $new_input['apikey'] = '';
    185         g_crossposting_add_error('g_crossposting_err_apikey', __("You provided an invalid Google API key."));
    186     }
    187179
    188180    // if API key and Google+ are given, check if they are valid
  • g-crossposting/trunk/gplus-crosspost.php

    r745114 r805313  
    44    Plugin URI: http://wordpress.org/extend/plugins/g-crossposting/
    55    Description: Imports your public Google+ activities in your Wordpress blog.
    6     Version: 1.1.3
     6    Version: 1.1.4
    77    Author: Sebastian Stein
    88    Author URI: http://sebstein.hpfsc.de/
     
    161161function g_crossposting_is_enabled() {
    162162    $options = g_crossposting_get_settings();
    163 
    164     if (! g_crossposting_check_gplusid($options['gplusid'])) {
    165         $options['gplusid'] = '';
    166         update_option('g_crossposting_options', $options);
    167         return FALSE;
    168     }
    169 
    170     if (! g_crossposting_check_apikey($options['apikey'])) {
    171         $options['apikey'] = '';
    172         update_option('g_crossposting_options', $options);
    173         return FALSE;
    174     }
    175163
    176164    // basic validation showed that we might have valid connection settings
     
    384372
    385373/**
    386  *  checks if the given string is a valid Google+ ID
    387  *
    388  *  @return true if string seems to be a valid Google+ ID, otherwise false
    389  */
    390 function g_crossposting_check_gplusid($given_gplusid) {
    391     // gplusid should only contain digits
    392     if (!preg_match('/^[0-9]{21}$/i', $given_gplusid)) {
    393         return FALSE;
    394     }
    395 
    396     return TRUE;
    397 }
    398 
    399 /**
    400  *  checks if the given string is a valid Google API key
    401  *
    402  *  @return true if string seems to be a valid Google API key, otherwise false
    403  */
    404 function g_crossposting_check_apikey($given_apikey) {
    405     // api key should be a mixture of digits and letters
    406     if (!preg_match('/^[0-9a-z_-]{39}$/i', $given_apikey)) {
    407         return FALSE;
    408     }
    409 
    410     return TRUE;
    411 }
    412 
    413 /**
    414374 *  the maximum number of activities to import must be 1..100
    415375 *
  • g-crossposting/trunk/readme.txt

    r771108 r805313  
    44Tags: google, googleplus, posts
    55Requires at least: 3.0.0
    6 Tested up to: 3.6.1
    7 Stable tag: 1.1.3
     6Tested up to: 3.7.1
     7Stable tag: 1.1.4
    88
    99Imports your public Google+ activities in your Wordpress blog.
     
    4545https://plus.google.com/VERY-LONG-NUMBER/posts
    4646
    47 This VERY-LONG-NUMBER is your Google+ ID. Copy just this VERY-LONG-NUMBER to
    48 your clipboard and paste it into the corresponding setting field.
     47This VERY-LONG-NUMBER is your Google+ ID. Copy just this VERY-LONG-NUMBER to your clipboard and paste it into the corresponding setting field.
    4948
    5049Please note, you are just interested in this VERY-LONG-NUMBER without any slashes. It might also be that your URL looks a bit different like containing /u/0/, but this is not important. Did I already mention that you should only copy this VERY-LONG-NUMBER? :-)
    5150
     51If you have set a custom Google+ ID in your profile, the URL might look as follows:
     52
     53https://plus.google.com/+SebastianStein/posts
     54
     55In that case, your Google+ ID is +SebastianStein (so including the plus sign, but not any slashes).
     56
     57
    5258= Where do I get a Google API key? =
    5359
    54 1. Go to (https://code.google.com/apis/console/) and log in.
    55 1. Click on Services.
    56 1. Scroll down a lot to find the Google+ API entry.  Enable it.
    57 1. Click on API Access.
    58 1. If not done yet, generate a new "Simple API Access" key.
    59 1. There you are, it is written next to the API key label under the "Simple API Access" section.
     601. Go to (https://cloud.google.com/console) and log in.
     611. Click on "Projects" and go into the project "API Project".
     621. Click on "APIs & auth" in the left sidebar.
     631. Find in the list "Google+ API" and enable it.
     641. After it was enabled, go into it (you might need to first refresh the page).
     651. Click on "Registered apps" in the left sidebar.
     661. Register a new app and call it e.g. "GooglePlus Wordpress".
     671. After you registered the app, go into it (you might need to first refresh the page).
     681. Open the section "Server Key".
     691. The string shown as API Key is your Google+ API key to use.
    6070
    61 It might be that there is no key yet, but a button to generate one. In that
    62 case, click the button first. There should also be a *Generate new key* link on
    63 this page.
    6471
    6572= I can't set my Google+ ID or Google API key in the setting form. Why do they disappear? =
     
    8895Google+ shortens your title, there is nothing this plugin can do.
    8996
     97
    9098== Screenshots ==
    9199
    921001. Configuration and settings dialog
    93101
     102
    94103== Changelog ==
     104
     105= 1.1.4 =
     106
     107* adapted to latest Google+ API changes
     108* updated documentation how to get Google+ API key
     109
    95110
    96111= 1.1.3 =
Note: See TracChangeset for help on using the changeset viewer.