Changeset 805313
- Timestamp:
- 11/16/2013 10:31:49 AM (12 years ago)
- Location:
- g-crossposting/trunk
- Files:
-
- 3 edited
-
admin.php (modified) (1 diff)
-
gplus-crosspost.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
g-crossposting/trunk/admin.php
r744548 r805313 172 172 */ 173 173 function g_crossposting_options_validate($input) { 174 // validateGoogle+ ID174 // trim Google+ ID 175 175 $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 182 178 $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 }187 179 188 180 // if API key and Google+ are given, check if they are valid -
g-crossposting/trunk/gplus-crosspost.php
r745114 r805313 4 4 Plugin URI: http://wordpress.org/extend/plugins/g-crossposting/ 5 5 Description: Imports your public Google+ activities in your Wordpress blog. 6 Version: 1.1. 36 Version: 1.1.4 7 7 Author: Sebastian Stein 8 8 Author URI: http://sebstein.hpfsc.de/ … … 161 161 function g_crossposting_is_enabled() { 162 162 $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 }175 163 176 164 // basic validation showed that we might have valid connection settings … … 384 372 385 373 /** 386 * checks if the given string is a valid Google+ ID387 *388 * @return true if string seems to be a valid Google+ ID, otherwise false389 */390 function g_crossposting_check_gplusid($given_gplusid) {391 // gplusid should only contain digits392 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 key401 *402 * @return true if string seems to be a valid Google API key, otherwise false403 */404 function g_crossposting_check_apikey($given_apikey) {405 // api key should be a mixture of digits and letters406 if (!preg_match('/^[0-9a-z_-]{39}$/i', $given_apikey)) {407 return FALSE;408 }409 410 return TRUE;411 }412 413 /**414 374 * the maximum number of activities to import must be 1..100 415 375 * -
g-crossposting/trunk/readme.txt
r771108 r805313 4 4 Tags: google, googleplus, posts 5 5 Requires at least: 3.0.0 6 Tested up to: 3. 6.17 Stable tag: 1.1. 36 Tested up to: 3.7.1 7 Stable tag: 1.1.4 8 8 9 9 Imports your public Google+ activities in your Wordpress blog. … … 45 45 https://plus.google.com/VERY-LONG-NUMBER/posts 46 46 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. 47 This VERY-LONG-NUMBER is your Google+ ID. Copy just this VERY-LONG-NUMBER to your clipboard and paste it into the corresponding setting field. 49 48 50 49 Please 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? :-) 51 50 51 If you have set a custom Google+ ID in your profile, the URL might look as follows: 52 53 https://plus.google.com/+SebastianStein/posts 54 55 In that case, your Google+ ID is +SebastianStein (so including the plus sign, but not any slashes). 56 57 52 58 = Where do I get a Google API key? = 53 59 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. 60 1. Go to (https://cloud.google.com/console) and log in. 61 1. Click on "Projects" and go into the project "API Project". 62 1. Click on "APIs & auth" in the left sidebar. 63 1. Find in the list "Google+ API" and enable it. 64 1. After it was enabled, go into it (you might need to first refresh the page). 65 1. Click on "Registered apps" in the left sidebar. 66 1. Register a new app and call it e.g. "GooglePlus Wordpress". 67 1. After you registered the app, go into it (you might need to first refresh the page). 68 1. Open the section "Server Key". 69 1. The string shown as API Key is your Google+ API key to use. 60 70 61 It might be that there is no key yet, but a button to generate one. In that62 case, click the button first. There should also be a *Generate new key* link on63 this page.64 71 65 72 = I can't set my Google+ ID or Google API key in the setting form. Why do they disappear? = … … 88 95 Google+ shortens your title, there is nothing this plugin can do. 89 96 97 90 98 == Screenshots == 91 99 92 100 1. Configuration and settings dialog 93 101 102 94 103 == Changelog == 104 105 = 1.1.4 = 106 107 * adapted to latest Google+ API changes 108 * updated documentation how to get Google+ API key 109 95 110 96 111 = 1.1.3 =
Note: See TracChangeset
for help on using the changeset viewer.