Plugin Directory

Changeset 577487


Ignore:
Timestamp:
07/26/2012 03:48:04 AM (14 years ago)
Author:
mobius5150
Message:

Committing v0.1.1 RC to trunk -- See changelog

Location:
globalfeed/trunk
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • globalfeed/trunk/admin/mb_globalfeed_admin.php

    r563348 r577487  
    1313    private $_current_page_type = 'default';
    1414    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    );
    1620    private $_globalfeed_settings = array();
    1721    private $_current_feed_slug = '';
     
    99103    function add_admin_pages( $pages ) {
    100104        $pages['main'] = __('Main', 'mb_globalfeed');
     105        $pages['admin_settings'] = __('Settings', 'mb_globalfeed');
    101106        $pages['admin_presentation'] = __('Presentation', 'mb_globalfeed');
    102107       
  • globalfeed/trunk/admin/pages/admin_presentation.php

    r563348 r577487  
    1414function show_mbgf_admin_page( &$settings ) {
    1515    global $mb_globalfeed;
    16     $mb_globalfeed->print_debug_info('Settings');
    1716   
    18     $mb_globalfeed->print_debug_info($settings);
    1917    $update = false;
    2018    if (isset($_POST['_update']) && $_POST['_update'] == 'true'){
     
    2422        // An update has been submitted. Save the settings.
    2523        $update = true;
    26         $mb_globalfeed->print_debug_info($_POST);
    2724       
    2825        $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';
     
    5956        </p>
    6057    </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>
    6259
    6360<?php
  • globalfeed/trunk/admin/pages/main.php

    r563348 r577487  
    1616?>
    1717<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>
    2119<h1><?php _e('Getting Started', 'mb_globalfeed') ?></h1>
    2220<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 />
     21menu on the left and activating it. Then follow the feeds' specific configuration <br />
    2422options.</p>
    2523<p>If you would like to change the way that GlobalFeed presents itself on your site,<br />
     
    3028in the top right-hand corner and fill out the form.</p>
    3129<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>
    3231<?php } ?>
  • globalfeed/trunk/admin/pages/style.css

    r563348 r577487  
    151151}
    152152
     153.optgrp select {
     154    min-width: 200px;
     155}
     156
    153157.optgrp input[type=submit]{
    154158    clear: both;
  • globalfeed/trunk/feeds/mb_facebook/mb_facebook.php

    r563348 r577487  
    104104   
    105105    /**
    106      * This array contains any settings that should be saved for this feed.
     106     * This array contains the default feed settings.
    107107     *
    108108     * Settings in this array are automatically saved when you use register_feed()
     
    110110     * @var array $feed_options
    111111     */
    112     private $feed_options = array(
     112    private $feed_defaults = array(
    113113        'auto_contain_feed_items' => true,
    114114        'user_info' => null,
     
    127127    );
    128128   
     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   
    129138    public function get_queryvar() {
    130139        return $this->feed_options['feed_queryvar'];
     
    146155        $feed_options = $globalfeed->get_feed_options( $this->feed_slug );
    147156        $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;
    149158       
    150159        // @todo implement the following pages:
     
    219228            add_action( 'wp_ajax_mbgf_facebook_connect_renew_access_codes', array( &$this, 'renew_access_codes' ));
    220229            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           
    221232            add_action( 'mbgf_feed_menu-' . $this->get_slug(), array(&$this, 'register_admin_menus'));
    222233            add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') );
     
    284295   
    285296    /**
    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)
    287300     */
    288301    public function redo_initial_setup(){
     
    297310    }
    298311   
     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
    299329    /**
    300330     * When the user attempts to authorize the facebook app, this function is called to
     
    337367        wp_verify_nonce( 'facebook-connect-settings_main' );
    338368       
    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'] );
    340371            die( json_encode(true) );
    341             unset( $_SERVER['mbgf_app_is_authed'] );
    342372        } 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') ) {
    347377                    unset( $_SERVER['mbgf_app_is_authed'] );
    348378                    die(json_encode(true));
     
    9771007           
    9781008            $_SERVER['mbgf_app_is_authed'] = true;
     1009            set_transient('mbgf_app_is_authed', true, 3600);
    9791010           
    9801011            if ($this->feed_type == 'callback')
  • globalfeed/trunk/feeds/mb_facebook/pages/js/mb_facebook.js

    r563348 r577487  
    22 * Gets a facebook object given a facebook object url.
    33 */
    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 //}
     4function 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...
    4612
    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}
    8643
    8744function format_fb_obj( fb_obj ) {
  • globalfeed/trunk/feeds/mb_facebook/pages/settings-main.php

    r563348 r577487  
    9595            jQuery('#reset_feed_defaults').click(function(){
    9696                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                });
    98109            }); // reset_feed_defaults.click()
    99110        });
  • globalfeed/trunk/feeds/mb_facebook/pages/setup.php

    r563348 r577487  
    3030            <tr>
    3131                <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>
    3333            </tr>   
    3434            <tr>
    3535                <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>
    3737            </tr>   
    3838            <tr>
     
    4949            <tr>
    5050                <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>
    5252            </tr>
    5353            <tr id="validate_button_container">
     
    134134                        jQuery(this).attr('disabled', '');
    135135                        toggleAjaxIndicator('#fb_obj_confirm');
    136                         jQuery.post(ajaxurl,
    137                         {
     136                        jQuery.post(ajaxurl, {
    138137                            action:'mbgf_facebook_connect_set_fb_obj_id',
    139138                            fb_object_id:fb_obj_id,
     
    177176                       
    178177                        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;
    184184                            }
    185                            
     185
    186186                            jQuery('#step-2>table').fadeOut('fast', function () {
    187187                                jQuery(this).hide();
     
    191191                            });
    192192                        });
    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 //                                    else
    204 //                                        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 it
    217 //                                    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 //                        });
    238193                    });
    239194                    jQuery('#step-2').addClass('setup');
  • globalfeed/trunk/feeds/mb_twitter/mb_twitter.php

    r563348 r577487  
    111111     * @var array $feed_options
    112112     */
    113     private $feed_options = array(
     113    private $feed_defaults = array(
    114114        'auto_contain_feed_items' => true,
    115115        'user_info' => null,
     
    122122        'show_welcome_message' => false,
    123123    );
     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;
    124133
    125134    /**
     
    139148        $feed_options = $globalfeed->get_feed_options( $this->feed_slug );
    140149        $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;
    142151       
    143152        // Setup feed filters
     
    183192            add_action( 'wp_ajax_mbgf_twitter_connect_set_tw_obj_id', array( &$this, 'set_tw_obj_id' ) );
    184193            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' ) );
    186195            add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') );
    187196        }
     
    234243        ));
    235244    }
    236    
     245           
     246    /**
     247     * Removes all saved feed items, then marks the initial setup to be done.
     248     *
     249     * (Called via ajax)
     250     */
    237251    public function redo_initial_setup() {
    238252        check_admin_referer( 'twitter-connect-admin' );
     
    243257       
    244258        $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);
    245276       
    246277        die(json_encode(true));
  • globalfeed/trunk/feeds/mb_twitter/pages/settings-main.php

    r563348 r577487  
    3535    <fieldset id="tw_reset_options" class="optgrp"><legend>Reset Feed</legend>
    3636        <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>
    3839        </table>
    3940    </fieldset>
     
    4748                jQuery(this).attr('disabled', '');
    4849                toggleAjaxIndicator('#redo_initial_setup_cont');
     50               
    4951                jQuery.ajax({
    5052                    url: ajaxurl,
     
    6163            }); // redo_initial_setup.click()
    6264           
     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           
    6383        });
    6484
  • globalfeed/trunk/feeds/mb_twitter/pages/setup.php

    r563348 r577487  
    2929            <tr>
    3030                <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>
    3232            </tr>
    3333            <tr id="validate_button_container">
     
    117117    }
    118118   
    119     function getLocaleString( locale ){
    120    
    121     }
    122    
    123119    function nextStep() {
    124120        loadStep( _currentStep + 1 );
  • globalfeed/trunk/feeds/mb_youtube/mb_youtube.php

    r563348 r577487  
    110110
    111111    /**
    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.
    113113     *
    114114     * Settings in this array are automatically saved when you use register_feed()
     
    116116     * @var array $feed_options
    117117     */
    118     private $feed_options = array(
     118    private $feed_defaults = array(
    119119        'auto_contain_feed_items' => true,
    120120        'user_info' => null,
     
    127127        'show_welcome_message' => false,
    128128    );
     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;
    129138
    130139    /**
     
    144153        $feed_options = $globalfeed->get_feed_options( $this->feed_slug );
    145154        $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;
    147156       
    148157        // Setup feed filters
     
    165174            add_action( 'wp_ajax_mbgf_youtube_connect_set_yt_usr_id', array( &$this, 'set_yt_usr_id' ) );
    166175            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' ) );
    168177            add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') );
    169178        }
     
    233242       
    234243        $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);
    235261       
    236262        die(json_encode(true));
     
    313339            'class_name' => 'mb_globalfeed_youtube_connect',
    314340            'update'     => $update,
    315             'request_frequency' => 'tenminutes',
     341            'request_frequency' => 'mbgf_default',
    316342        );
    317343       
  • globalfeed/trunk/feeds/mb_youtube/pages/settings-main.php

    r563348 r577487  
    3636    <fieldset id="yt_reset_options" class="optgrp"><legend>Reset Feed</legend>
    3737        <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>
    3940        </table>
    4041    </fieldset>
     
    6162                });
    6263            }); // 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()
    6381        });
    6482
  • globalfeed/trunk/feeds/mb_youtube/pages/setup.php

    r563348 r577487  
    2828            <tr>
    2929                <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>
    3131            </tr>
    3232            <tr id="validate_button_container">
  • globalfeed/trunk/feeds/mbgf_rss/mbgf_rss.php

    r563348 r577487  
    11<?php
     2error_reporting(E_ALL);
    23/*
    34  Feed Name: MB RSS
     
    107108
    108109    /**
    109      * This array contains any settings that should be saved for this feed.
     110     * This array contains the default feed settings.
    110111     *
    111112     * Settings in this array are automatically saved when you use register_feed()
     
    113114     * @var array $feed_options
    114115     */
    115     private $feed_options = array(
     116    private $feed_defaults = array(
    116117        'auto_contain_feed_items' => true,
    117118        'feed_queryvar' => 'mbgf_rss',
     
    123124    );
    124125
     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   
    125135    /**
    126136     * This function requires a reference to MB_GlobalFeed in order to start. This is because the feed is loaded before
     
    139149        $feed_options = $globalfeed->get_feed_options( $this->feed_slug );
    140150        $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;
    142152       
    143153        // Setup feed filters
     
    160170            add_action( 'wp_ajax_mbgf_rss_add_rss_feed', array( &$this, 'add_rss_feed' ) );
    161171            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' ) );
    163173            add_action( 'mbgf_unregister_feed-' . $this->get_slug(), array( &$this, 'unregister_feed') );
    164174        }
     
    169179     *
    170180     * (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.
    171182     */
    172183    public function add_rss_feed(){
     
    177188        $rawxml = wp_remote_get( $feed_url );
    178189        if ( is_wp_error($rawxml) )
    179             return false;
     190            die( json_encode('Error reading rss feed.'));
    180191       
    181192        try {
    182193            $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
    183231            $namespaces = $feed->getNamespaces(true);
    184232            $feed = $feed->channel;
     
    237285    }
    238286   
     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   
    239305    /**
    240306     * This function will switch the avatar displayed by posts to a user selected avatar.
     
    317383            'class_name' => 'mbgf_rss',
    318384            'update'     => $update,
    319             'request_frequency' => 'tenminutes',
     385            'request_frequency' => 'mbgf_default',
    320386        );
    321387       
  • globalfeed/trunk/feeds/mbgf_rss/pages/settings-main.php

    r563348 r577487  
    4343    <fieldset id="rss_reset_options" class="optgrp"><legend>Reset Feed</legend>
    4444        <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>
    4646        </table>
    4747    </fieldset>
     
    9696            jQuery('#reset_feed_defaults').click(function(){
    9797                toggleAjaxIndicator('#reset_feed_defaults_cont');
     98                jQuery(this).attr('disabled', true);
    9899               
     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                });
    99112            }); // reset_feed_defaults.click()
    100113        });
  • globalfeed/trunk/mb_globalfeed.php

    r563348 r577487  
    268268                'widget_skin' => 'fb',                                  // The GlobalFeed sking to use on widgets.
    269269                '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                ),
    270278                'theme_show_avatar' => true,
    271279                'preferred_scheduler' => array(
  • globalfeed/trunk/readme.txt

    r563354 r577487  
    44Tags: globalfeed,lifestream,feed,social,facebook,twitter,rss,youtube,sharing,integration
    55Requires at least: 3.3
    6 Tested up to: 3.3.2
     6Tested up to: 3.4.1
    77Stable tag: 0.1
    88License: GPLv2
     
    8686== Changelog ==
    8787
    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 =
    8995GlobalFeed was created to be an easy to use and extensible platform for adding external content to your blog.
    9096
    9197== Upgrade Notice ==
    9298
    93 = 0.1a
     99= 0.1
    94100This is the first plugin version.
    95101
Note: See TracChangeset for help on using the changeset viewer.