Changeset 577487
- Timestamp:
- 07/26/2012 03:48:04 AM (14 years ago)
- Location:
- globalfeed/trunk
- Files:
-
- 1 added
- 18 edited
-
admin/mb_globalfeed_admin.php (modified) (2 diffs)
-
admin/pages/admin_presentation.php (modified) (3 diffs)
-
admin/pages/admin_settings.php (added)
-
admin/pages/main.php (modified) (2 diffs)
-
admin/pages/style.css (modified) (1 diff)
-
feeds/mb_facebook/mb_facebook.php (modified) (9 diffs)
-
feeds/mb_facebook/pages/js/mb_facebook.js (modified) (1 diff)
-
feeds/mb_facebook/pages/settings-main.php (modified) (1 diff)
-
feeds/mb_facebook/pages/setup.php (modified) (5 diffs)
-
feeds/mb_twitter/mb_twitter.php (modified) (6 diffs)
-
feeds/mb_twitter/pages/settings-main.php (modified) (3 diffs)
-
feeds/mb_twitter/pages/setup.php (modified) (2 diffs)
-
feeds/mb_youtube/mb_youtube.php (modified) (7 diffs)
-
feeds/mb_youtube/pages/settings-main.php (modified) (2 diffs)
-
feeds/mb_youtube/pages/setup.php (modified) (1 diff)
-
feeds/mbgf_rss/mbgf_rss.php (modified) (10 diffs)
-
feeds/mbgf_rss/pages/settings-main.php (modified) (2 diffs)
-
mb_globalfeed.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
globalfeed/trunk/admin/mb_globalfeed_admin.php
r563348 r577487 13 13 private $_current_page_type = 'default'; 14 14 private $_current_feed_file = ''; 15 private $_mbgf_admin_pages = array('admin_presentation', 'main'); 15 private $_mbgf_admin_pages = array( 16 'admin_presentation', 17 'admin_settings', 18 'main' 19 ); 16 20 private $_globalfeed_settings = array(); 17 21 private $_current_feed_slug = ''; … … 99 103 function add_admin_pages( $pages ) { 100 104 $pages['main'] = __('Main', 'mb_globalfeed'); 105 $pages['admin_settings'] = __('Settings', 'mb_globalfeed'); 101 106 $pages['admin_presentation'] = __('Presentation', 'mb_globalfeed'); 102 107 -
globalfeed/trunk/admin/pages/admin_presentation.php
r563348 r577487 14 14 function show_mbgf_admin_page( &$settings ) { 15 15 global $mb_globalfeed; 16 $mb_globalfeed->print_debug_info('Settings');17 16 18 $mb_globalfeed->print_debug_info($settings);19 17 $update = false; 20 18 if (isset($_POST['_update']) && $_POST['_update'] == 'true'){ … … 24 22 // An update has been submitted. Save the settings. 25 23 $update = true; 26 $mb_globalfeed->print_debug_info($_POST);27 24 28 25 $settings['auto_print_feed_items_in_loop'] = isset($_POST['presentation-auto_print_feed_items_in_loop']) && $_POST['presentation-auto_print_feed_items_in_loop'] == 'on'; … … 59 56 </p> 60 57 </fieldset> 61 </form><small>Please note: There are currently very few settings for GlobalFeed and packaged feeds. More will be added in the next scheduled release in approx. 1-2 weeks time.</small>58 </form><small>Please note: If there are any settings you would like to see added to the GlobalFeed UI, please let us know!</small> 62 59 63 60 <?php -
globalfeed/trunk/admin/pages/main.php
r563348 r577487 16 16 ?> 17 17 <h1><?php _e('Welcome to GlobalFeed', 'mb_globalfeed') ?></h1> 18 <p>You are currently running an <strong>ALPHA</strong> version of GlobalFeed (v<?php echo $mb_globalfeed->version() ?>). Because of this,<br /> 19 we do not recommend using GlobalFeed in a production environment. <br />The beta should arrive in 1-2 weeks.</p> 20 <p>Thank you for helping in testing this software. Please report any bugs you may find.</p> 18 <p>Thank you for using this software. Please report any bugs you may find.</p> 21 19 <h1><?php _e('Getting Started', 'mb_globalfeed') ?></h1> 22 20 <p>In order to get started with GlobalFeed, begin by clicking on a feed in the <br /> 23 menu on the right and activating it. Then follow the feeds' specific configuration <br />21 menu on the left and activating it. Then follow the feeds' specific configuration <br /> 24 22 options.</p> 25 23 <p>If you would like to change the way that GlobalFeed presents itself on your site,<br /> … … 30 28 in the top right-hand corner and fill out the form.</p> 31 29 <p>You may also submit a report on the WordPress plugin page. </p> 30 <small>Please note: If there are any settings you would like to see added to the GlobalFeed UI, please let us know!</small> 32 31 <?php } ?> -
globalfeed/trunk/admin/pages/style.css
r563348 r577487 151 151 } 152 152 153 .optgrp select { 154 min-width: 200px; 155 } 156 153 157 .optgrp input[type=submit]{ 154 158 clear: both; -
globalfeed/trunk/feeds/mb_facebook/mb_facebook.php
r563348 r577487 104 104 105 105 /** 106 * This array contains any settings that should be saved for this feed.106 * This array contains the default feed settings. 107 107 * 108 108 * Settings in this array are automatically saved when you use register_feed() … … 110 110 * @var array $feed_options 111 111 */ 112 private $feed_ options = array(112 private $feed_defaults = array( 113 113 'auto_contain_feed_items' => true, 114 114 'user_info' => null, … … 127 127 ); 128 128 129 /** 130 * This array contains any settings that should be saved for this feed. 131 * 132 * Settings in this array are automatically saved when you use register_feed() 133 * 134 * @var array $feed_options 135 */ 136 private $feed_options = null; 137 129 138 public function get_queryvar() { 130 139 return $this->feed_options['feed_queryvar']; … … 146 155 $feed_options = $globalfeed->get_feed_options( $this->feed_slug ); 147 156 $this->feed_slug = !empty($feed_options['feed_slug']) ? $feed_options['feed_slug'] : $this->feed_slug; 148 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_ options;157 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_defaults; 149 158 150 159 // @todo implement the following pages: … … 219 228 add_action( 'wp_ajax_mbgf_facebook_connect_renew_access_codes', array( &$this, 'renew_access_codes' )); 220 229 add_action( 'wp_ajax_mbgf_facebook_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' )); 230 add_action( 'wp_ajax_mbgf_facebook_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' )); 231 221 232 add_action( 'mbgf_feed_menu-' . $this->get_slug(), array(&$this, 'register_admin_menus')); 222 233 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); … … 284 295 285 296 /** 286 * Renews the feeds access codes with Facebook. 297 * Removes all saved feed items, then marks the initial setup to be done. 298 * 299 * (Called via ajax) 287 300 */ 288 301 public function redo_initial_setup(){ … … 297 310 } 298 311 312 /** 313 * This function is called VIA Ajax to reset the feed to its defaults. 314 */ 315 public function reset_feed_defaults() { 316 check_admin_referer( 'facebook-connect-settings_main' ); 317 wp_verify_nonce( 'facebook-connect-settings_main' ); 318 319 $this->feed_options = $this->feed_defaults; 320 $this->pages_to_show = array('all'); 321 $this->pages_not_to_show = array(); 322 $this->remove_feed_items(); 323 324 $this->register_feed(true); 325 326 die(json_encode(true)); 327 } 328 299 329 /** 300 330 * When the user attempts to authorize the facebook app, this function is called to … … 337 367 wp_verify_nonce( 'facebook-connect-settings_main' ); 338 368 339 if (!empty($this->feed_options['oauth_user_token']) || $_SERVER['mbgf_app_is_authed']) { 369 if (!empty($this->feed_options['oauth_user_token']) || $_SERVER['mbgf_app_is_authed'] || get_transient('mbgf_app_is_authed')) { 370 unset( $_SERVER['mbgf_app_is_authed'] ); 340 371 die( json_encode(true) ); 341 unset( $_SERVER['mbgf_app_is_authed'] );342 372 } else { 343 $c = 0;344 while ( $c <= 5) {345 echo sleep (1);346 if ( $_SERVER['mbgf_app_is_authed'] ) {373 $c = 1; 374 while ( $c <= 2 ) { 375 sleep(2); 376 if ( $_SERVER['mbgf_app_is_authed'] || get_transient('mbgf_app_is_authed') ) { 347 377 unset( $_SERVER['mbgf_app_is_authed'] ); 348 378 die(json_encode(true)); … … 977 1007 978 1008 $_SERVER['mbgf_app_is_authed'] = true; 1009 set_transient('mbgf_app_is_authed', true, 3600); 979 1010 980 1011 if ($this->feed_type == 'callback') -
globalfeed/trunk/feeds/mb_facebook/pages/js/mb_facebook.js
r563348 r577487 2 2 * Gets a facebook object given a facebook object url. 3 3 */ 4 //function get_fb_obj ( obj_url ) { 5 // jQuery.ajax({ 6 // url: obj_url + "?metadata=1", 7 // data: {}, 8 // statusCode: { 9 // 200: function (response) { 10 // // In some browsers response is on object, and in some its text... 11 // if (response.responseText != undefined) 12 // response = jQuery.parseJSON(response.responseText); 13 // else 14 // response = jQuery.parseJSON(response); 15 // 16 // toggleAjaxIndicator( '#step-2' ); 17 // if (response == false){ 18 // showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found' , true); 19 // setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 20 // jQuery('#validate_button').attr("disabled", false); 21 // return false; 22 // } 23 // fb_obj_id = response.id; 24 // fb_obj_type = response.type; 25 // 26 // jQuery('#step-2>table').hide('fast', function () {jQuery(this).hide()}); 27 // jQuery('#confirm_fb_obj_id').show().append(confirm_div); 28 // jQuery('#fb_obj_confirm').fadeIn('fast', function () { 29 // jQuery('#fb_obj_confirm').removeClass('hidden-step'); 30 // }); 31 // }, 32 // 404: function(){ 33 // showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found', true); 34 // setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 35 // toggleAjaxIndicator( '#step-2' ); 36 // jQuery('#validate_button').attr("disabled", false); 37 // }, 38 // 400: function(){ 39 // showMessage( 'Error: An error occured. Most likely you attempted to access a resource you don\'t have permission for.', 'fb_obj_permission_error', true ); 40 // setMsgRemove( 'fb_object_id','fb_obj_permission_error' ); 41 // toggleAjaxIndicator( '#step-2' ); 42 // jQuery('#validate_button').attr("disabled", false); 43 // }} 44 // }) 45 //} 4 function get_fb_object( object_id, element_id ) { 5 return jQuery.ajax({ 6 url: 'https://graph.facebook.com/' + object_id + "?metadata=1", 7 dataType: 'jsonp', 8 data: {}, 9 statusCode: { 10 200: function (response) { 11 // In some browsers response is on object, and in some its text... 46 12 47 function get_fb_object( object_id, element_id ) { 48 return jQuery.ajax({ 49 url: 'https://graph.facebook.com/' + object_id + "?metadata=1", 50 dataType: 'jsonp', 51 data: {}, 52 statusCode: { 53 200: function (response) { 54 // In some browsers response is on object, and in some its text... 55 56 toggleAjaxIndicator( element_id ); 57 if (response == false || typeof(response.error) != 'undefined'){ 58 fb_obj_is_error = true; 59 showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found' , true); 60 setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 61 return false; 62 } else 63 fb_obj_is_error = false; 64 65 fb_obj_id = response.id; 66 fb_obj_type = (response.type ? response.type : response.metadata.type); 67 68 // Get the output and display it 69 jQuery( element_id ).css({display:'none'}).empty().append( format_fb_obj( response ) ); 70 jQuery( element_id ).fadeIn('fast', function () { 71 jQuery( this ).removeClass('hidden-step'); 72 }); 73 }, 74 404: function(){ 75 showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found', true); 76 setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 77 toggleAjaxIndicator( element_id ); 78 }, 79 400: function(){ 80 showMessage( 'Error: An error occured. Most likely you attempted to access a resource you don\'t have permission for.', 'fb_obj_permission_error', true ); 81 setMsgRemove( 'fb_object_id','fb_obj_permission_error' ); 82 toggleAjaxIndicator( element_id ); 83 }} 84 }); 85 } 13 toggleAjaxIndicator( element_id ); 14 if (response == false || typeof(response.error) != 'undefined'){ 15 fb_obj_is_error = true; 16 showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found' , true); 17 setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 18 return false; 19 } else 20 fb_obj_is_error = false; 21 22 fb_obj_id = response.id; 23 fb_obj_type = (response.type ? response.type : response.metadata.type); 24 25 // Get the output and display it 26 jQuery( element_id ).css({display:'none'}).empty().append( format_fb_obj( response ) ); 27 jQuery( element_id ).fadeIn('fast', function () { 28 jQuery( this ).removeClass('hidden-step'); 29 }); 30 }, 31 404: function(){ 32 showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found', true); 33 setMsgRemove( 'fb_object_id','fb_obj_not_found' ); 34 toggleAjaxIndicator( element_id ); 35 }, 36 400: function(){ 37 showMessage( 'Error: An error occured. Most likely you attempted to access a resource you don\'t have permission for.', 'fb_obj_permission_error', true ); 38 setMsgRemove( 'fb_object_id','fb_obj_permission_error' ); 39 toggleAjaxIndicator( element_id ); 40 }} 41 }); 42 } 86 43 87 44 function format_fb_obj( fb_obj ) { -
globalfeed/trunk/feeds/mb_facebook/pages/settings-main.php
r563348 r577487 95 95 jQuery('#reset_feed_defaults').click(function(){ 96 96 toggleAjaxIndicator('#reset_feed_defaults_cont'); 97 97 jQuery.ajax({ 98 url: ajaxurl, 99 data: {action:'mbgf_facebook_connect_reset_feed_defaults',_wpnonce:jQuery('#_wpnonce').val()}, 100 statusCode: { 101 200: function (response) { 102 window.location.reload(); 103 }}, 104 error: function(){ 105 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 106 toggleAjaxIndicator( element_id ); 107 } 108 }); 98 109 }); // reset_feed_defaults.click() 99 110 }); -
globalfeed/trunk/feeds/mb_facebook/pages/setup.php
r563348 r577487 30 30 <tr> 31 31 <th><?php _e('Facebook App ID:',$mb_globalfeed_facebook_connect->get_slug()) ?></th> 32 <td><input type="text" name="app_id" class="auth-form-input" id="app_id" value=" "/></td>32 <td><input type="text" name="app_id" class="auth-form-input" id="app_id" value="<?php echo $feed_options['app_id']; ?>"/></td> 33 33 </tr> 34 34 <tr> 35 35 <th><?php _e('Facebook App Secret:',$mb_globalfeed_facebook_connect->get_slug()) ?></th> 36 <td><input type="text" name="app_secret" class="auth-form-input" id="app_secret" value=" " /></td>36 <td><input type="text" name="app_secret" class="auth-form-input" id="app_secret" value="<?php echo $feed_options['app_secret']; ?>" /></td> 37 37 </tr> 38 38 <tr> … … 49 49 <tr> 50 50 <th><?php _e('Facebook Object ID:',$mb_globalfeed_facebook_connect->get_slug()) ?></th> 51 <td><input type="text" name="fb_object_id" class="auth-form-input" id="fb_object_id" /></td>51 <td><input type="text" name="fb_object_id" class="auth-form-input" id="fb_object_id" value="<?php echo $feed_options['object_to_subscribe']; ?>" /></td> 52 52 </tr> 53 53 <tr id="validate_button_container"> … … 134 134 jQuery(this).attr('disabled', ''); 135 135 toggleAjaxIndicator('#fb_obj_confirm'); 136 jQuery.post(ajaxurl, 137 { 136 jQuery.post(ajaxurl, { 138 137 action:'mbgf_facebook_connect_set_fb_obj_id', 139 138 fb_object_id:fb_obj_id, … … 177 176 178 177 req = get_fb_object( fb_object_id, '#confirm_fb_obj_id' ); 179 req.success(function(response){ 180 if ( typeof(response.error) != 'undefined' ) { 181 toggleAjaxIndicator( '#step-2' ); 182 jQuery('#validate_button').attr("disabled", false); 183 return false; 178 req.complete(function(response){ 179 console.log(response); 180 if ( response.status != 200 ) { 181 toggleAjaxIndicator( '#step-2' ); 182 jQuery('#validate_button').attr("disabled", false); 183 return false; 184 184 } 185 185 186 186 jQuery('#step-2>table').fadeOut('fast', function () { 187 187 jQuery(this).hide(); … … 191 191 }); 192 192 }); 193 // Check that the object ID is valid, and that we have access to that object.194 // obj_url = jQuery('#fb_graph_url').val() + fb_object_id;195 // jQuery.ajax({196 // url: obj_url + "?metadata=1",197 // data: {},198 // statusCode: {199 // 200: function (response) {200 // // In some browsers response is on object, and in some its text...201 // if (response.responseText != undefined)202 // response = jQuery.parseJSON(response.responseText);203 // else204 // response = jQuery.parseJSON(response);205 //206 // toggleAjaxIndicator( '#step-2' );207 // if (response == false){208 // showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found' , true);209 // setMsgRemove( 'fb_object_id','fb_obj_not_found' );210 // jQuery('#validate_button').attr("disabled", false);211 // return false;212 // }213 // fb_obj_id = response.id;214 // fb_obj_type = response.type;215 //216 // // Get the output and display it217 // confirm_div = format_fb_obj( response );218 //219 // jQuery('#step-2>table').hide('fast', function () {jQuery(this).hide()});220 // jQuery('#confirm_fb_obj_id').show().append(confirm_div);221 // jQuery('#fb_obj_confirm').fadeIn('fast', function () {222 // jQuery('#fb_obj_confirm').removeClass('hidden-step');223 // });224 // },225 // 404: function(){226 // showMessage( 'Error: The given Facebook ID was not found. Please try again.', 'fb_obj_not_found', true);227 // setMsgRemove( 'fb_object_id','fb_obj_not_found' );228 // toggleAjaxIndicator( '#step-2' );229 // jQuery('#validate_button').attr("disabled", false);230 // },231 // 400: function(){232 // showMessage( 'Error: An error occured. Most likely you attempted to access a resource you don\'t have permission for.', 'fb_obj_permission_error', true );233 // setMsgRemove( 'fb_object_id','fb_obj_permission_error' );234 // toggleAjaxIndicator( '#step-2' );235 // jQuery('#validate_button').attr("disabled", false);236 // }}237 // });238 193 }); 239 194 jQuery('#step-2').addClass('setup'); -
globalfeed/trunk/feeds/mb_twitter/mb_twitter.php
r563348 r577487 111 111 * @var array $feed_options 112 112 */ 113 private $feed_ options = array(113 private $feed_defaults = array( 114 114 'auto_contain_feed_items' => true, 115 115 'user_info' => null, … … 122 122 'show_welcome_message' => false, 123 123 ); 124 125 /** 126 * This array contains any settings that should be saved for this feed. 127 * 128 * Settings in this array are automatically saved when you use register_feed() 129 * 130 * @var array $feed_options 131 */ 132 private $feed_options = null; 124 133 125 134 /** … … 139 148 $feed_options = $globalfeed->get_feed_options( $this->feed_slug ); 140 149 $this->feed_slug = !empty($feed_options['feed_slug']) ? $feed_options['feed_slug'] : $this->feed_slug; 141 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_ options;150 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_defaults; 142 151 143 152 // Setup feed filters … … 183 192 add_action( 'wp_ajax_mbgf_twitter_connect_set_tw_obj_id', array( &$this, 'set_tw_obj_id' ) ); 184 193 add_action( 'wp_ajax_mbgf_twitter_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' ) ); 185 add_action( 'wp_ajax_mbgf_twitter_connect_ set_feed_defaults', array( &$this, 'set_feed_defaults' ) );194 add_action( 'wp_ajax_mbgf_twitter_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); 186 195 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); 187 196 } … … 234 243 )); 235 244 } 236 245 246 /** 247 * Removes all saved feed items, then marks the initial setup to be done. 248 * 249 * (Called via ajax) 250 */ 237 251 public function redo_initial_setup() { 238 252 check_admin_referer( 'twitter-connect-admin' ); … … 243 257 244 258 $this->remove_feed_items(); 259 260 die(json_encode(true)); 261 } 262 263 /** 264 * This function is called VIA Ajax to reset the feed to its defaults. 265 */ 266 public function reset_feed_defaults() { 267 check_admin_referer( 'twitter-connect-admin' ); 268 wp_verify_nonce( 'twitter-connect-admin' ); 269 270 $this->feed_options = $this->feed_defaults; 271 $this->pages_to_show = array( 'all' ); 272 $this->pages_not_to_show = array(); 273 274 $this->remove_feed_items(); 275 $this->register_feed(true); 245 276 246 277 die(json_encode(true)); -
globalfeed/trunk/feeds/mb_twitter/pages/settings-main.php
r563348 r577487 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, however it will not reset any settings.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 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> 38 39 </table> 39 40 </fieldset> … … 47 48 jQuery(this).attr('disabled', ''); 48 49 toggleAjaxIndicator('#redo_initial_setup_cont'); 50 49 51 jQuery.ajax({ 50 52 url: ajaxurl, … … 61 63 }); // redo_initial_setup.click() 62 64 65 jQuery('#reset_feed_defaults').click(function(){ 66 jQuery(this).attr('disabled', ''); 67 toggleAjaxIndicator('#reset_feed_defaults_cont'); 68 69 jQuery.ajax({ 70 url: ajaxurl, 71 data: {action:'mbgf_twitter_connect_reset_feed_defaults',_wpnonce:jQuery('#_wpnonce').val()}, 72 statusCode: { 73 200: function (response) { 74 window.location.reload(); 75 }}, 76 error: function(){ 77 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 78 toggleAjaxIndicator( element_id ); 79 } 80 }); 81 }); // reset_feed_defaults.click() 82 63 83 }); 64 84 -
globalfeed/trunk/feeds/mb_twitter/pages/setup.php
r563348 r577487 29 29 <tr> 30 30 <th><?php _e('Twitter Object ID:',$mb_globalfeed_twitter_connect->get_slug()) ?></th> 31 <td><input type="text" name="tw_object_id" class="auth-form-input" id="tw_object_id" /></td>31 <td><input type="text" name="tw_object_id" class="auth-form-input" id="tw_object_id" value="<?php echo $feed_options['object_to_subscribe']; ?>"/></td> 32 32 </tr> 33 33 <tr id="validate_button_container"> … … 117 117 } 118 118 119 function getLocaleString( locale ){120 121 }122 123 119 function nextStep() { 124 120 loadStep( _currentStep + 1 ); -
globalfeed/trunk/feeds/mb_youtube/mb_youtube.php
r563348 r577487 110 110 111 111 /** 112 * This array contains any settings that should be saved for this feed.112 * This array contains the default settings for the feed and should not be changed. 113 113 * 114 114 * Settings in this array are automatically saved when you use register_feed() … … 116 116 * @var array $feed_options 117 117 */ 118 private $feed_ options = array(118 private $feed_defaults = array( 119 119 'auto_contain_feed_items' => true, 120 120 'user_info' => null, … … 127 127 'show_welcome_message' => false, 128 128 ); 129 130 /** 131 * This array contains any settings that should be saved for this feed. 132 * 133 * Settings in this array are automatically saved when you use register_feed() 134 * 135 * @var array $feed_options 136 */ 137 private $feed_options = null; 129 138 130 139 /** … … 144 153 $feed_options = $globalfeed->get_feed_options( $this->feed_slug ); 145 154 $this->feed_slug = !empty($feed_options['feed_slug']) ? $feed_options['feed_slug'] : $this->feed_slug; 146 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_ options;155 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_defaults; 147 156 148 157 // Setup feed filters … … 165 174 add_action( 'wp_ajax_mbgf_youtube_connect_set_yt_usr_id', array( &$this, 'set_yt_usr_id' ) ); 166 175 add_action( 'wp_ajax_mbgf_youtube_connect_redo_initial_setup', array( &$this, 'redo_initial_setup' ) ); 167 add_action( 'wp_ajax_mbgf_youtube_connect_ set_feed_defaults', array( &$this, 'set_feed_defaults' ) );176 add_action( 'wp_ajax_mbgf_youtube_connect_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); 168 177 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); 169 178 } … … 233 242 234 243 $this->remove_feed_items(); 244 245 die(json_encode(true)); 246 } 247 248 /** 249 * This function is called VIA Ajax to reset the feed to its defaults. 250 */ 251 public function reset_feed_defaults() { 252 check_admin_referer( 'youtube-connect-admin' ); 253 wp_verify_nonce( 'youtube-connect-admin' ); 254 255 $this->feed_options = $this->feed_defaults; 256 $this->pages_to_show = array( 'all' ); 257 $this->pages_not_to_show = array(); 258 259 $this->remove_feed_items(); 260 $this->register_feed(true); 235 261 236 262 die(json_encode(true)); … … 313 339 'class_name' => 'mb_globalfeed_youtube_connect', 314 340 'update' => $update, 315 'request_frequency' => ' tenminutes',341 'request_frequency' => 'mbgf_default', 316 342 ); 317 343 -
globalfeed/trunk/feeds/mb_youtube/pages/settings-main.php
r563348 r577487 36 36 <fieldset id="yt_reset_options" class="optgrp"><legend>Reset Feed</legend> 37 37 <table> 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, however it will not reset any settings.'); ?><?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 saved 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 default settings, removing all stored feed items.'); ?><?php $mbgfa_theme->ajaxIndicator(true); ?></td></tr> 39 40 </table> 40 41 </fieldset> … … 61 62 }); 62 63 }); // redo_initial_setup.click() 64 65 jQuery('#reset_feed_defaults').click(function(){ 66 jQuery(this).attr('disabled', ''); 67 toggleAjaxIndicator('#reset_feed_defaults_cont'); 68 jQuery.ajax({ 69 url: ajaxurl, 70 data: {action:'mbgf_youtube_connect_reset_feed_defaults',_wpnonce:jQuery('#_wpnonce').val()}, 71 statusCode: { 72 200: function (response) { 73 window.location.reload(); 74 }}, 75 error: function(){ 76 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 77 toggleAjaxIndicator( element_id ); 78 } 79 }); 80 }); // redo_initial_setup.click() 63 81 }); 64 82 -
globalfeed/trunk/feeds/mb_youtube/pages/setup.php
r563348 r577487 28 28 <tr> 29 29 <th><?php _e('YouTube Username:',$mb_globalfeed_youtube_connect->get_slug()) ?></th> 30 <td><input type="text" name="yt_username_id" class="auth-form-input" id="yt_username_id" /></td>30 <td><input type="text" name="yt_username_id" class="auth-form-input" id="yt_username_id" value="<?php echo $feed_options['object_to_subscribe']; ?>"/></td> 31 31 </tr> 32 32 <tr id="validate_button_container"> -
globalfeed/trunk/feeds/mbgf_rss/mbgf_rss.php
r563348 r577487 1 1 <?php 2 error_reporting(E_ALL); 2 3 /* 3 4 Feed Name: MB RSS … … 107 108 108 109 /** 109 * This array contains any settings that should be saved for this feed.110 * This array contains the default feed settings. 110 111 * 111 112 * Settings in this array are automatically saved when you use register_feed() … … 113 114 * @var array $feed_options 114 115 */ 115 private $feed_ options = array(116 private $feed_defaults = array( 116 117 'auto_contain_feed_items' => true, 117 118 'feed_queryvar' => 'mbgf_rss', … … 123 124 ); 124 125 126 /** 127 * This array contains any settings that should be saved for this feed. 128 * 129 * Settings in this array are automatically saved when you use register_feed() 130 * 131 * @var array $feed_options 132 */ 133 private $feed_options = null; 134 125 135 /** 126 136 * This function requires a reference to MB_GlobalFeed in order to start. This is because the feed is loaded before … … 139 149 $feed_options = $globalfeed->get_feed_options( $this->feed_slug ); 140 150 $this->feed_slug = !empty($feed_options['feed_slug']) ? $feed_options['feed_slug'] : $this->feed_slug; 141 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_ options;151 $feed_options = $this->feed_options = $feed_options ? $feed_options['feed_options'] : $this->feed_defaults; 142 152 143 153 // Setup feed filters … … 160 170 add_action( 'wp_ajax_mbgf_rss_add_rss_feed', array( &$this, 'add_rss_feed' ) ); 161 171 add_action( 'wp_ajax_mbgf_rss_remove_rss_feed', array( &$this, 'remove_rss_feed' ) ); 162 add_action( 'wp_ajax_mbgf_rss_ set_feed_defaults', array( &$this, 'set_feed_defaults' ) );172 add_action( 'wp_ajax_mbgf_rss_reset_feed_defaults', array( &$this, 'reset_feed_defaults' ) ); 163 173 add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') ); 164 174 } … … 169 179 * 170 180 * (Called via ajax) 181 * @todo This should present the user with a choice of which RSS feed should be presented if the supplied URL is an HTML doc that contains links to RSS Feeds. 171 182 */ 172 183 public function add_rss_feed(){ … … 177 188 $rawxml = wp_remote_get( $feed_url ); 178 189 if ( is_wp_error($rawxml) ) 179 return false;190 die( json_encode('Error reading rss feed.')); 180 191 181 192 try { 182 193 $feed = simplexml_load_string($rawxml['body']); 194 195 // If this was not XML, check and see if it contains a link to an XML doc 196 if ( $feed === false ) { 197 // Things aren't okay. Check and see if we maybe got a webpage with a link to a feed 198 if ( is_array($rawxml) ) { 199 if ( isset( $rawxml['response'] ) && is_array($rawxml['response']) && $rawxml['response']['code'] === 200) { 200 // We got served a page okay... 201 $dom = new DOMDocument; 202 if ( !$dom->loadHTML($rawxml['body']) ) 203 die( json_encode('Error reading rss feed.')); 204 205 $this->globalfeed->print_debug_info('dom'); 206 foreach ( $dom->getElementsByTagName('link') as $link ) { 207 if ( $link->attributes->getNamedItem('rel')->nodeValue != 'alternate' || $link->attributes->getNamedItem('type')->nodeValue != 'application/rss+xml' 208 || is_null($link->attributes->getNamedItem('href')->nodeValue)) 209 continue; 210 211 $feed_url = str_replace(' ','+',$link->attributes->getNamedItem('href')->nodeValue); 212 $rawxml = wp_remote_get( $feed_url ); 213 if ( is_wp_error($rawxml) ) 214 die( json_encode('Error reading rss feed.')); 215 216 $feed = simplexml_load_string($rawxml['body']); 217 218 if ( $feed !== false ) 219 break; 220 } 221 } 222 } else { 223 die( json_encode('Error reading rss feed.')); 224 } 225 } 226 227 if ( $feed === false ) 228 die( json_encode('Error reading rss feed.')); 229 230 // Things seem to be okay 183 231 $namespaces = $feed->getNamespaces(true); 184 232 $feed = $feed->channel; … … 237 285 } 238 286 287 /** 288 * This function is called VIA Ajax to reset the feed to its defaults. 289 */ 290 public function reset_feed_defaults() { 291 check_admin_referer( 'mb-rss-admin' ); 292 wp_verify_nonce( 'mb-rss-admin' ); 293 294 $this->feed_options = $this->feed_defaults; 295 296 $this->pages_to_show = array('all'); 297 $this->pages_not_to_show = array(); 298 $this->remove_feed_items(); 299 300 $this->register_feed(true); 301 302 die(json_encode(true)); 303 } 304 239 305 /** 240 306 * This function will switch the avatar displayed by posts to a user selected avatar. … … 317 383 'class_name' => 'mbgf_rss', 318 384 'update' => $update, 319 'request_frequency' => ' tenminutes',385 'request_frequency' => 'mbgf_default', 320 386 ); 321 387 -
globalfeed/trunk/feeds/mbgf_rss/pages/settings-main.php
r563348 r577487 43 43 <fieldset id="rss_reset_options" class="optgrp"><legend>Reset Feed</legend> 44 44 <table> 45 <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>45 <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 46 </table> 47 47 </fieldset> … … 96 96 jQuery('#reset_feed_defaults').click(function(){ 97 97 toggleAjaxIndicator('#reset_feed_defaults_cont'); 98 jQuery(this).attr('disabled', true); 98 99 100 jQuery.ajax({ 101 url: ajaxurl, 102 data: {action:'mbgf_rss_reset_feed_defaults',_wpnonce:jQuery('#_wpnonce').val()}, 103 statusCode: { 104 200: function (response) { 105 window.location.reload(); 106 }}, 107 error: function(){ 108 showMessage( 'Error: A network error occured.', 'network_error', true, 10000 ); 109 toggleAjaxIndicator( element_id ); 110 } 111 }); 99 112 }); // reset_feed_defaults.click() 100 113 }); -
globalfeed/trunk/mb_globalfeed.php
r563348 r577487 268 268 'widget_skin' => 'fb', // The GlobalFeed sking to use on widgets. 269 269 'plugin_update_interval' => 600, // The default for how often feeds update 270 'plugin_update_intervals' => array( 271 'Ten Minutes' => '600', 272 'Thirty Minutes' => '1800', 273 'Hourly' => '3600', 274 'Twice a Day' => '43200', 275 'Once a Day' => '86400', 276 'Once a Week' => '604800' 277 ), 270 278 'theme_show_avatar' => true, 271 279 'preferred_scheduler' => array( -
globalfeed/trunk/readme.txt
r563354 r577487 4 4 Tags: globalfeed,lifestream,feed,social,facebook,twitter,rss,youtube,sharing,integration 5 5 Requires at least: 3.3 6 Tested up to: 3. 3.26 Tested up to: 3.4.1 7 7 Stable tag: 0.1 8 8 License: GPLv2 … … 86 86 == Changelog == 87 87 88 = 0.1a = 88 = 0.1.1 = 89 - Stability improvements for feed setup screens, including much better support for the Facebook feed. 90 - Added reset to feed defaults for all feeds, and changed redo initial setup to show any existing settings when doing the setup. 91 - Added a feature that detects linked RSS feeds when a webpage url is given to MB RSS instead of an RSS feed. Works great for WordPress installations. 92 - Added the main 'Settings' tab with the ability to configure the feed update interval. 93 94 = 0.1 = 89 95 GlobalFeed was created to be an easy to use and extensible platform for adding external content to your blog. 90 96 91 97 == Upgrade Notice == 92 98 93 = 0.1 a99 = 0.1 94 100 This is the first plugin version. 95 101
Note: See TracChangeset
for help on using the changeset viewer.