Changeset 995586
- Timestamp:
- 09/23/2014 06:06:08 PM (12 years ago)
- Location:
- g-crossposting/trunk
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
admin.php (modified) (2 diffs)
-
g-crossposting.php (modified) (9 diffs)
-
lang/g-crossposting-de_DE.mo (modified) (previous)
-
lang/g-crossposting-de_DE.po (modified) (3 diffs)
-
lang/g-crossposting.pot (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
g-crossposting/trunk
-
Property
svn:mergeinfo
set to
/g-crossposting/branches/import-all-branch merged eligible
-
Property
svn:mergeinfo
set to
-
g-crossposting/trunk/admin.php
r912911 r995586 18 18 // remove any old messages from cookie 19 19 $g_crossposting_msg = null; 20 21 // provide admins a hook to trigger manual import of ALL activities 22 if (array_key_exists('g_crossposting_manual_import_all', $_GET)) { 23 $total_activities = g_crossposting_update_all(); 24 g_crossposting_add_error('g_crossposting_err_import_all', __('Manual import of all '.$total_activities.' Google+ activities done.', 'g-crossposting')); 25 } 20 26 21 27 // provide admins a hook to trigger manual import of activities … … 252 258 _e('manually check for new activities and import them', 'g-crossposting'); 253 259 echo '</a></div>'; 254 /* 255 $options = g_crossposting_get_settings(); 256 257 // get latest Google+ activities 258 $ch = curl_init("https://www.googleapis.com/plus/v1/people/{$options['gplusid']}/activities/public?alt=json&maxResults={$options['maxactivities']}&key={$options['apikey']}"); 259 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 260 $activities = curl_exec($ch); 261 curl_close($ch); 262 263 $activities = json_decode($activities); 264 265 $no_posts = 0; 266 $no_shares = 0; 267 $no_unknown = 0; 268 269 foreach($activities->items as $item) { 270 switch ($item->verb) { 271 case 'post': 272 $no_posts++; 273 break; 274 case 'share': 275 $no_shares++; 276 break; 277 default: 278 $no_unknown++; 279 break; 280 } 281 282 } 283 print 'Found '.count($activities->items).' public activities on your Google+ account.<br />'; 284 print 'You got '.$no_posts.' posts.<br />'; 285 print 'You got '.$no_shares.' shares.<br />'; 286 print 'You got '.$no_unknown.' unknown activities.<br />'; 287 288 print '<pre>'; 289 foreach($activities->items as $item) { 290 print '----------------new item---------------\n'; 291 var_dump($item); 292 } 293 print '</pre>'; 294 */ 295 260 261 echo '<div id="g-crossposting-manual-import-all"><strong>'; 262 _e('Manual mass import ALL:', 'g-crossposting'); 263 echo '</strong> <a href="?page=g-crossposting-key-config&g_crossposting_manual_import_all=true">'; 264 _e('manually check for ALL activities and import them', 'g-crossposting'); 265 echo '</a></div>'; 296 266 echo '</div>'; 297 267 } -
g-crossposting/trunk/g-crossposting.php
r912911 r995586 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. 5.06 Version: 1.6.0 7 7 Author: Sebastian Stein 8 8 Author URI: http://sebstein.hpfsc.de/ … … 144 144 145 145 /** 146 * checks Google+ for new activities and post sthem146 * checks Google+ for new activities and post them 147 147 */ 148 148 function g_crossposting_update() { … … 174 174 // basic validation showed that we might have valid connection settings 175 175 // now do an actual connect to see if we are able to connect 176 if (g_crossposting_api_activities_list($options['gplusid'], $options['apikey'], 1 ) == null) {176 if (g_crossposting_api_activities_list($options['gplusid'], $options['apikey'], 1, "") == null) { 177 177 // either settings are wrong or gplus is offline 178 178 … … 215 215 * @return array with activities or null 216 216 */ 217 function g_crossposting_api_activities_list($p_gplusid, $p_apikey, $p_maxactivities ) {217 function g_crossposting_api_activities_list($p_gplusid, $p_apikey, $p_maxactivities, $p_pagetoken) { 218 218 // get list of latest p_maxactivities activities 219 $ch = curl_init("https://www.googleapis.com/plus/v1/people/{$p_gplusid}/activities/public?alt=json&maxResults={$p_maxactivities}&key={$p_apikey} ");219 $ch = curl_init("https://www.googleapis.com/plus/v1/people/{$p_gplusid}/activities/public?alt=json&maxResults={$p_maxactivities}&key={$p_apikey}&pageToken={$p_pagetoken}"); 220 220 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 221 221 $activities = curl_exec($ch); … … 245 245 // get activities from Google+ 246 246 $activities = g_crossposting_api_activities_list($options['gplusid'], 247 $options['apikey'], $options['maxactivities'] );247 $options['apikey'], $options['maxactivities'], ""); 248 248 if ($activities == null) { 249 249 return null; … … 277 277 // go through all given activities and post them 278 278 $latest_activity_id = null; 279 $posts_updated = 0; 279 280 foreach ($activities as $activity) { 280 281 // store ID of latest activity so that we know what was posted already … … 299 300 continue; 300 301 } 302 303 // we found a new post, so let's increment our counter 304 $posts_updated++; 301 305 302 306 // get options to configure way how activities get imported … … 415 419 } 416 420 } 421 return $posts_updated; 417 422 } 418 423 … … 506 511 return FALSE; 507 512 } 513 514 /** 515 * checks Google+ for all activities and posts them 516 */ 517 function g_crossposting_update_all() { 518 // first check if all settings are in place 519 if (! g_crossposting_is_enabled()) { 520 return; 521 } 522 523 // get all activities 524 $all_activities = array(); 525 $all_activities = g_crossposting_get_all_activities(); 526 if ($all_activities == null) { 527 return; 528 } 529 530 // post new activities on blog 531 $new_activities_count = g_crossposting_post_new($all_activities); 532 return $new_activities_count.' out of '.count($all_activities); 533 } 534 535 /** 536 * returns all activities 537 * 538 * @return array of all activities found on Google+ 539 */ 540 function g_crossposting_get_all_activities() { 541 // load options 542 $options = g_crossposting_get_settings(); 543 544 // go through all activities 545 $all_activities = array(); 546 $nextPageToken = null; 547 do 548 { 549 $activities = g_crossposting_api_activities_list($options['gplusid'], 550 $options['apikey'], $options['maxactivities'], $nextPageToken); 551 if ($activities == null) { 552 return null; 553 } 554 555 $nextPageToken = $activities->nextPageToken; 556 foreach ($activities->items as $activity) 557 { 558 $all_activities[] = $activity; 559 } 560 } 561 while($nextPageToken != null); 562 563 if (count($all_activities) > 0) { 564 return $all_activities; 565 } else { 566 return null; 567 } 568 } -
g-crossposting/trunk/lang/g-crossposting-de_DE.po
r807770 r995586 95 95 msgstr "Änderungen speichern" 96 96 97 #: admin.php:25 797 #: admin.php:256 98 98 #@ g-crossposting 99 99 msgid "Manual mass import:" … … 101 101 102 102 #: admin.php:54 103 #@ g-crossposting 103 104 msgid "Authentication Settings" 104 105 msgstr "Anmeldeinformationen für Google+" 105 106 106 107 #: admin.php:55 108 #@ g-crossposting 107 109 msgid "Setup Options" 108 110 msgstr "Verhalten des Plugins" 109 111 110 #: admin.php:25 9112 #: admin.php:258 111 113 #@ g-crossposting 112 114 msgid "manually check for new activities and import them" 113 115 msgstr "auf neue Aktivitäten prüfen und diese sofort importieren" 116 117 #: admin.php:262 118 #@ g-crossposting 119 msgid "Manual mass import ALL:" 120 msgstr "Manueller Massenimport aller Aktivitäten:" 121 122 #: admin.php:264 123 #@ g-crossposting 124 msgid "manually check for ALL activities and import them" 125 msgstr "manuellen Import aller Aktivitäten anstoßen" 114 126 115 127 #: g-crossposting.php:89 … … 141 153 142 154 #. Author URI of the plugin/theme 155 #@ g-crossposting 143 156 msgid "http://sebstein.hpfsc.de/" 144 157 msgstr "http://sebstein.hpfsc.de/" -
g-crossposting/trunk/lang/g-crossposting.pot
r807770 r995586 87 87 msgstr "" 88 88 89 #: admin.php:25 789 #: admin.php:256 90 90 msgid "Manual mass import:" 91 91 msgstr "" 92 92 93 #: admin.php:25 993 #: admin.php:258 94 94 msgid "manually check for new activities and import them" 95 msgstr "" 96 97 #: admin.php:262 98 msgid "Manual mass import ALL:" 99 msgstr "" 100 101 #: admin.php:264 102 msgid "manually check for ALL activities and import them" 95 103 msgstr "" 96 104 -
g-crossposting/trunk/readme.txt
r989584 r995586 5 5 Requires at least: 3.0.0 6 6 Tested up to: 4.0 7 Stable tag: 1. 5.07 Stable tag: 1.6.0 8 8 9 9 Imports your public Google+ activities in your Wordpress blog. … … 127 127 == Changelog == 128 128 129 = 1.6.0 = 130 131 * Plugin settings now provide a link to manually import ALL Google+ activities. 132 Many thanks to krischel for providing this patch! 133 129 134 = 1.5.0 = 130 135
Note: See TracChangeset
for help on using the changeset viewer.