Changeset 591186
- Timestamp:
- 08/28/2012 03:11:09 AM (14 years ago)
- Location:
- globalfeed/trunk/feeds
- Files:
-
- 8 edited
-
mb_facebook/mb_facebook.php (modified) (3 diffs)
-
mb_facebook/pages/settings-main.php (modified) (3 diffs)
-
mb_twitter/mb_twitter.php (modified) (7 diffs)
-
mb_twitter/pages/settings-main.php (modified) (2 diffs)
-
mb_youtube/mb_youtube.php (modified) (3 diffs)
-
mb_youtube/pages/settings-main.php (modified) (2 diffs)
-
mbgf_rss/mbgf_rss.php (modified) (2 diffs)
-
mbgf_rss/pages/settings-main.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
globalfeed/trunk/feeds/mb_facebook/mb_facebook.php
r591175 r591186 229 229 add_action( 'wp_ajax_mbgf_facebook_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' )); 230 230 add_action( 'wp_ajax_mbgf_facebook_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' )); 231 add_action( 'wp_ajax_mbgf_facebook_connect_manual_feed_update', array( &$this, 'ajax_do_update' )); 232 231 233 232 234 add_action( 'mbgf_feed_menu-' . $this->get_slug(), array(&$this, 'register_admin_menus')); … … 644 646 } 645 647 exit; 648 } 649 650 /** 651 * This calls the update_feed function and is accessible from the WP Admin page 652 * 653 */ 654 public function ajax_do_update() { 655 check_admin_referer( 'facebook-connect-settings_main' ); 656 wp_verify_nonce( 'facebook-connect-settings_main' ); 657 658 $res = $this->update_feed(); 659 660 if ( is_int($res) ) 661 die(json_encode(array('status' => 'success', 'update_count' => $res))); 662 else 663 die(json_encode(array('status' => 'failure', 'error' => $res))); 646 664 } 647 665 … … 860 878 return count( $feed_items ); 861 879 } else { 862 return false;880 return 0; 863 881 } 864 882 } -
globalfeed/trunk/feeds/mb_facebook/pages/settings-main.php
r577487 r591186 42 42 <fieldset id="fb_reset_options" class="optgrp"><legend>Reset Feed</legend> 43 43 <table> 44 <tr id="reset_fb_auth_cont"><td><input type="button" value="Reset Facebook Authorization" id="reset_fb_auth" /></td><td><?php $mbgfa_theme->informative('This will re-request access codes from Facebook. Handy if you've had to reset any or if authentication is failing.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 45 <tr id="redo_initial_setup_cont"><td><input type="button" value="Redo Initial Setup" id="redo_initial_setup" /></td><td><?php $mbgfa_theme->informative('This will bring up the initial setup wizard, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 46 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This function completely resets the plugin to defaults.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 44 <tr id="manual_update_cont"><td><input type="button" value="Update Feed Manually" id="manual_update" /></td><td><?php $mbgfa_theme->informative('This will tell the feed to update, typically usefull if the feed is not updating automatically. <p>P.s. If things arent working right, make sure to let us know so we can fix it!</p>'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 45 <tr id="reset_fb_auth_cont"><td><input type="button" value="Reset Facebook Authorization" id="reset_fb_auth" /></td><td><?php $mbgfa_theme->informative('This will re-request access codes from Facebook. Handy if you've had to reset any or if authentication is failing.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 46 <tr id="redo_initial_setup_cont"><td><input type="button" value="Redo Initial Setup" id="redo_initial_setup" /></td><td><?php $mbgfa_theme->informative('This will bring up the initial setup wizard, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 47 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This function completely resets the plugin to defaults.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 47 48 </table> 48 49 </fieldset> … … 88 89 error: function(){ 89 90 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 90 toggleAjaxIndicator( element_id);91 hideAjaxIndicator('#redo_initial_setup_cont'); 91 92 } 92 93 }); … … 104 105 error: function(){ 105 106 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 106 toggleAjaxIndicator( element_id);107 hideAjaxIndicator('#reset_feed_defaults_cont'); 107 108 } 108 109 }); 109 110 }); // reset_feed_defaults.click() 111 112 jQuery('#manual_update').click(function(){ 113 toggleAjaxIndicator('#manual_update_cont'); 114 jQuery.ajax({ 115 url: ajaxurl, 116 data: {action:'mbgf_facebook_connect_manual_feed_update',_wpnonce:jQuery('#_wpnonce').val()}, 117 statusCode: { 118 200: function (response) { 119 json = jQuery.parseJSON(response); 120 121 hideAjaxIndicator('#manual_update_cont'); 122 if ( typeof json.status !== 'undefined' && json.status === 'success' ) 123 showMessage( 'The feed updated successfully.<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update', false, 10000 ); 124 else 125 showMessage( 'The feed did not update successfully. The update method returned ' + json.error + '<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update_error', true, 10000 ); 126 }}, 127 error: function(){ 128 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 129 hideAjaxIndicator('#manual_update_cont'); 130 } 131 }); 132 }); // manual_update.click() 110 133 }); 111 134 -
globalfeed/trunk/feeds/mb_twitter/mb_twitter.php
r582062 r591186 187 187 add_filter( 'the_author', array( &$this, 'the_author' )); 188 188 add_action( 'mbgf-fb-theme_show_user_actions', array( &$this, 'show_user_actions' ) ); 189 189 190 } 190 191 … … 194 195 add_action( 'wp_ajax_mbgf_twitter_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' ) ); 195 196 add_action( 'wp_ajax_mbgf_twitter_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); 197 add_action( 'wp_ajax_mbgf_twitter_connect_manual_feed_update', array( &$this, 'ajax_do_update' ) ); 196 198 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); 199 197 200 } 198 201 } … … 369 372 } 370 373 371 372 374 /** 375 * This calls the update_feed function and is accessible from the WP Admin page 376 * 377 */ 378 public function ajax_do_update() { 379 check_admin_referer( 'twitter-connect-admin' ); 380 wp_verify_nonce( 'twitter-connect-admin' ); 381 382 $res = $this->update_feed(); 383 384 if ( is_int($res) ) 385 die(json_encode(array('status' => 'success', 'update_count' => $res))); 386 else 387 die(json_encode(array('status' => 'failure', 'error' => $res))); 388 } 373 389 374 390 /** … … 380 396 * @param type $args 381 397 */ 382 function update_feed( $args) {398 function update_feed() { 383 399 $globalfeed = &$this->globalfeed; 384 400 $feed_options = &$this->feed_options; … … 389 405 if ( $feed_options['last_feed_update'] != 0 ) 390 406 $api_url .= "&since_id={$feed_options['last_feed_update']}"; 391 $globalfeed->print_debug_info($api_url);407 392 408 $request = wp_remote_get( $api_url ); 393 409 … … 399 415 400 416 if ( $updates == NULL ) 401 return false;417 return 0; 402 418 403 419 $feed_items = array(); … … 450 466 451 467 if ( count($feed_items) <= 0 ) 452 return false;468 return 0; 453 469 454 470 // Set the last status update received... -
globalfeed/trunk/feeds/mb_twitter/pages/settings-main.php
r577487 r591186 35 35 <fieldset id="tw_reset_options" class="optgrp"><legend>Reset Feed</legend> 36 36 <table> 37 <tr id="redo_initial_setup_cont"><td><input type="button" value="Redo Initial Setup" id="redo_initial_setup" /></td><td><?php $mbgfa_theme->informative('This will bring up the initial setup wizard and remove all stored feed items, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 38 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This will completely reset the feed to its initial settings, simultaneously removing all stored feed items.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 37 <tr id="manual_update_cont"><td><input type="button" value="Update Feed Manually" id="manual_update" /></td><td><?php $mbgfa_theme->informative('This will tell the feed to update, typically usefull if the feed is not updating automatically. <p>P.s. If things arent working right, make sure to let us know so we can fix it!</p>'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 38 <tr id="redo_initial_setup_cont"><td><input type="button" value="Redo Initial Setup" id="redo_initial_setup" /></td><td><?php $mbgfa_theme->informative('This will bring up the initial setup wizard and remove all stored feed items, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 39 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This will completely reset the feed to its initial settings, simultaneously removing all stored feed items.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 39 40 </table> 40 41 </fieldset> … … 81 82 }); // reset_feed_defaults.click() 82 83 84 jQuery('#manual_update').click(function(){ 85 toggleAjaxIndicator('#manual_update_cont'); 86 jQuery.ajax({ 87 url: ajaxurl, 88 data: {action:'mbgf_twitter_connect_manual_feed_update',_wpnonce:jQuery('#_wpnonce').val()}, 89 statusCode: { 90 200: function (response) { 91 json = jQuery.parseJSON(response); 92 93 hideAjaxIndicator('#manual_update_cont'); 94 if ( typeof json.status !== 'undefined' && json.status === 'success' ) 95 showMessage( 'The feed updated successfully.<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update', false, 10000 ); 96 else 97 showMessage( 'The feed did not update successfully. The update method returned ' + json.error + '<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update_error', true, 10000 ); 98 }}, 99 error: function(){ 100 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 101 hideAjaxIndicator('#manual_update_cont'); 102 } 103 }); 104 }); // manual_update.click() 83 105 }); 84 106 -
globalfeed/trunk/feeds/mb_youtube/mb_youtube.php
r582062 r591186 176 176 add_action( 'wp_ajax_mbgf_youtube_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' ) ); 177 177 add_action( 'wp_ajax_mbgf_youtube_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); 178 add_action( 'wp_ajax_mbgf_youtube_connect_manual_feed_update', array( &$this, 'ajax_do_update' ) ); 178 179 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); 179 180 } … … 360 361 361 362 return $this->globalfeed->register_feed($info, $feed_options); 363 } 364 365 /** 366 * This calls the update_feed function and is accessible from the WP Admin page 367 * 368 */ 369 public function ajax_do_update() { 370 check_admin_referer( 'youtube-connect-admin' ); 371 wp_verify_nonce( 'youtube-connect-admin' ); 372 373 $res = $this->update_feed(); 374 375 if ( is_int($res) ) 376 die(json_encode(array('status' => 'success', 'update_count' => $res))); 377 else 378 die(json_encode(array('status' => 'failure', 'error' => $res))); 362 379 } 363 380 … … 447 464 448 465 if ( count($feed_items) <= 0 ) 449 return false;466 return 0; 450 467 451 468 // Set the last status update received... -
globalfeed/trunk/feeds/mb_youtube/pages/settings-main.php
r577487 r591186 36 36 <fieldset id="yt_reset_options" class="optgrp"><legend>Reset Feed</legend> 37 37 <table> 38 <tr id="manual_update_cont"><td><input type="button" value="Update Feed Manually" id="manual_update" /></td><td><?php $mbgfa_theme->informative('This will tell the feed to update, typically usefull if the feed is not updating automatically. <p>P.s. If things arent working right, make sure to let us know so we can fix it!</p>'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 38 39 <tr id="redo_initial_setup_cont"><td><input type="button" value="Redo Initial Setup" id="redo_initial_setup" /></td><td><?php $mbgfa_theme->informative('This will bring up the initial setup wizard and remove all saved feed items, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 39 40 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This will completely reset the feed to its default settings, removing all stored feed items.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> … … 79 80 }); 80 81 }); // redo_initial_setup.click() 82 83 jQuery('#manual_update').click(function(){ 84 toggleAjaxIndicator('#manual_update_cont'); 85 jQuery.ajax({ 86 url: ajaxurl, 87 data: {action:'mbgf_youtube_connect_manual_feed_update',_wpnonce:jQuery('#_wpnonce').val()}, 88 statusCode: { 89 200: function (response) { 90 json = jQuery.parseJSON(response); 91 92 hideAjaxIndicator('#manual_update_cont'); 93 if ( typeof json.status !== 'undefined' && json.status === 'success' ) 94 showMessage( 'The feed updated successfully.<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update', false, 10000 ); 95 else 96 showMessage( 'The feed did not update successfully. The update method returned ' + json.error + '<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update_error', true, 10000 ); 97 }}, 98 error: function(){ 99 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 100 hideAjaxIndicator('#manual_update_cont'); 101 } 102 }); 103 }); // manual_update.click() 81 104 }); 82 105 -
globalfeed/trunk/feeds/mbgf_rss/mbgf_rss.php
r582062 r591186 169 169 if (is_admin()) { 170 170 add_action( 'wp_ajax_mbgf_rss_add_rss_feed', array( &$this, 'add_rss_feed' ) ); 171 add_action( 'wp_ajax_mbgf_rss_manual_feed_update', array( &$this, 'ajax_do_update' ) ); 171 172 add_action( 'wp_ajax_mbgf_rss_remove_rss_feed', array( &$this, 'remove_rss_feed' ) ); 172 173 add_action( 'wp_ajax_mbgf_rss_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); … … 446 447 } 447 448 449 /** 450 * This calls the update_feed function and is accessible from the WP Admin page 451 * 452 */ 453 public function ajax_do_update() { 454 check_admin_referer( 'mb-rss-admin' ); 455 wp_verify_nonce( 'mb-rss-admin' ); 456 457 $res = $this->update_feed(); 458 459 if ( is_int($res) ) 460 die(json_encode(array('status' => 'success', 'update_count' => $res))); 461 else 462 die(json_encode(array('status' => 'failure', 'error' => $res))); 463 } 464 448 465 /** 449 466 * This function manually updates the feed and is usually called by a scheduler -
globalfeed/trunk/feeds/mbgf_rss/pages/settings-main.php
r582062 r591186 43 43 <fieldset id="rss_reset_options" class="optgrp"><legend>Reset Feed</legend> 44 44 <table> 45 <tr id="manual_update_cont"><td><input type="button" value="Update Feed Manually" id="manual_update" /></td><td><?php $mbgfa_theme->informative('This will tell the feed to update, typically usefull if the feed is not updating automatically. <p>P.s. If things arent working right, make sure to let us know so we can fix it!</p>'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 45 46 <tr id="reset_feed_defaults_cont"><td><input type="button" value="Reset Feed Defaults" id="reset_feed_defaults" /></td><td><?php $mbgfa_theme->informative('This function completely resets the plugin to defaults.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 46 47 </table> … … 176 177 }); 177 178 }); // reset_feed_defaults.click() 179 180 jQuery('#manual_update').click(function(){ 181 toggleAjaxIndicator('#manual_update_cont'); 182 jQuery.ajax({ 183 url: ajaxurl, 184 data: {action:'mbgf_rss_manual_feed_update',_wpnonce:jQuery('#_wpnonce').val()}, 185 statusCode: { 186 200: function (response) { 187 json = jQuery.parseJSON(response); 188 189 hideAjaxIndicator('#manual_update_cont'); 190 if ( typeof json.status !== 'undefined' && json.status === 'success' ) 191 showMessage( 'The feed updated successfully.<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update', false, 10000 ); 192 else 193 showMessage( 'The feed did not update successfully. The update method returned ' + json.error + '<p>If you triggered a manual update because of an error or something does not appear to be working properly, please be sure to let us know so we can fix it!</p>', 'manual_update_error', true, 10000 ); 194 }}, 195 error: function(){ 196 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 197 hideAjaxIndicator('#manual_update_cont'); 198 } 199 }); 200 }); // manual_update.click() 178 201 }); 179 202
Note: See TracChangeset
for help on using the changeset viewer.