Plugin Directory

Changeset 582059


Ignore:
Timestamp:
08/05/2012 06:48:24 PM (14 years ago)
Author:
mobius5150
Message:

Tagging version 0.1.2

Location:
globalfeed/tags/0.1.2
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • globalfeed/tags/0.1.2

    • Property svn:ignore set to
      log.txt
  • globalfeed/tags/0.1.2/admin/mb_globalfeed_admin.php

    r577487 r582059  
    123123        elseif ( isset( $_POST['mbgf_admin_page'] ) )
    124124            $current_page = $_POST['mbgf_admin_page'];
     125       
     126        if ( !isset($_REQUEST['mbgf_page_type']) )
     127            $_REQUEST['mbgf_page_type'] = '';
    125128       
    126129        switch ( $_REQUEST['mbgf_page_type'] ){
     
    219222                    else
    220223                        require_once dirname(__FILE__) . '/pages/main.php';
    221                     show_mbgf_admin_page( &$this->_globalfeed_settings );
     224                    show_mbgf_admin_page( $this->_globalfeed_settings );
    222225                    $mb_globalfeed->save_settings();
    223226                break;
  • globalfeed/tags/0.1.2/admin/mbgfa_theme.php

    r563348 r582059  
    116116         * and wizards that are consistant with the general look of GlobalFeed.
    117117         *
    118          * Automatically ensures that jQuery is loaded.
     118         * Automatically ensures that jQuery and Fancybox are loaded.
    119119         *
    120120         * @global type $mb_globalfeed
     
    123123            global $mb_globalfeed;
    124124            wp_enqueue_script('mb_globalfeed_client_tools', plugins_url( 'admin/pages/js/client_tools.js', $mb_globalfeed->plugin_location() ), array('jquery'));
     125            wp_enqueue_script('fancybox', plugins_url( 'admin/pages/js/jquery.fancybox/jquery.fancybox.js', $mb_globalfeed->plugin_location() ), array('jquery', 'mb_globalfeed_client_tools'));
     126           
     127            wp_enqueue_style('fancybox', plugins_url( 'admin/pages/js/jquery.fancybox/jquery.fancybox.css', $mb_globalfeed->plugin_location() ));
    125128        }
    126129       
  • globalfeed/tags/0.1.2/admin/pages/admin_presentation.php

    r577487 r582059  
    5151            <li>container_class: The class to apply to the containing div.</li>
    5252            <li>include_blog_posts: Whether posts from the WordPress blog should be displayed.</li>
    53             <li>use_globalfeed_theme: The GlobalFeed theme to use. Currently only option is 'wide' or 'default'.</li>
     53            <li>use_globalfeed_theme: The GlobalFeed theme to use. Currently only option is 'wide', 'fb' or 'default'.</li>
    5454        </ul>
    5555       
  • globalfeed/tags/0.1.2/admin/pages/js/client_tools.js

    r563348 r582059  
    88/* ----------------------------------------------------------- Ajax Indicator */
    99function toggleAjaxIndicator( obj ) {
    10     jQuery( obj ).find('.ajax-loading-icon').toggle();
     10    if ( typeof obj === 'object' )
     11        obj.find('.ajax-loading-icon').toggle();
     12    else
     13        jQuery( obj ).find('.ajax-loading-icon').toggle();
    1114}
    1215
    1316function hideAjaxIndicator( obj ) {
    14     jQuery( obj ).find('.ajax-loading-icon').hide();
     17    if ( typeof obj === 'object' )
     18        obj.find('.ajax-loading-icon').hide();
     19    else
     20        jQuery( obj ).find('.ajax-loading-icon').hide();
    1521}
    1622
  • globalfeed/tags/0.1.2/event_scheduler_interfaces/wp-schedule-interface.php

    r563348 r582059  
    9292        $mb_globalfeed->print_debug_info($action);
    9393       
     94        if ( !class_exists($caller) || method_exists($caller, $action))
     95            return;
     96       
    9497        $mb_globalfeed->print_debug_info(call_user_func( array( &$$caller, $action ), $args ));
    9598    }
  • globalfeed/tags/0.1.2/feeds/mb_facebook/mb_facebook.php

    r578780 r582059  
    240240       
    241241        $actions = get_post_meta(get_the_ID(), 'actions', true);
     242        if ( empty($actions) )
     243            return;
    242244       
    243245        $echo = array();
     
    367369        wp_verify_nonce( 'facebook-connect-settings_main' );
    368370       
    369         if (!empty($this->feed_options['oauth_user_token']) || $_SERVER['mbgf_app_is_authed'] || get_transient('mbgf_app_is_authed')) {
     371        if (!empty($this->feed_options['oauth_user_token']) || (isset($_SERVER['mbgf_app_is_authed']) && $_SERVER['mbgf_app_is_authed']) || get_transient('mbgf_app_is_authed')) {
    370372            unset( $_SERVER['mbgf_app_is_authed'] );
    371373            die( json_encode(true) );
     
    374376            while ( $c <= 2 ) {
    375377                sleep(2);
    376                 if ( $_SERVER['mbgf_app_is_authed'] || get_transient('mbgf_app_is_authed') ) {
     378                if ( (isset($_SERVER['mbgf_app_is_authed']) && $_SERVER['mbgf_app_is_authed']) || get_transient('mbgf_app_is_authed') ) {
    377379                    unset( $_SERVER['mbgf_app_is_authed'] );
    378380                    die(json_encode(true));
     
    440442     */
    441443    public function add_listener_vars($public_query_vars) {
    442         $public_query_vars[] = $this->facebook_secret;
     444        //$public_query_vars[] = $this->facebook_secret;
    443445        return $public_query_vars;
    444446    }
     
    683685        foreach ($updates->data as $update) {
    684686           
    685             $update->id = split('_', $update->id);
     687            $update->id = explode('_', $update->id);
    686688            $page_id = $update->id[0];
    687689            $update->id = $update->id[1];
     
    822824            $post_args['post_content'] = $globalfeed->post_content(isset($update->message) ? $update->message : $update->story, $content_args);
    823825           
    824             $post_args['meta']['author'] = array( 'value' => $update->from, 'unique' => false );
    825             $post_args['meta']['privacy'] = array( 'value' => $update->privacy, 'unique' => false );
    826             $post_args['meta']['actions'] = array( 'value' => $update->actions, 'unique' => false );
     826            if ( isset($update->from) )
     827                $post_args['meta']['author'] = array( 'value' => $update->from, 'unique' => false );
     828            if ( isset($update->privacy) )
     829                $post_args['meta']['privacy'] = array( 'value' => $update->privacy, 'unique' => false );
     830            if ( isset($update->actions) )
     831                $post_args['meta']['actions'] = array( 'value' => $update->actions, 'unique' => false );
    827832           
    828833            $feed_items[] = $post_args;
     
    983988           
    984989            $feed_options['oauth_user_token'] = $params['access_token'];
    985             $feed_options['ouath_user_expires'] = $params['expires'];
     990           
     991            if ( isset($params['expires']) )
     992                $feed_options['ouath_user_expires'] = $params['expires'];
    986993           
    987994            // Get app access credentials
     
    9951002           
    9961003            $feed_options['oauth_app_token'] = $params['access_token'];
    997             $feed_options['ouath_app_expires'] = $params['expires'];
     1004           
     1005            if ( isset($params['expires']) )
     1006                $feed_options['ouath_app_expires'] = $params['expires'];
    9981007           
    9991008//            $globalfeed->print_debug_info($feed_options['oauth_user_token'] . $feed_options['oauth_app_token'], 'mb_facebook');
     
    10981107            //$this->feed_options['initial_setup_done'] == true;
    10991108        } else {
    1100             if (array_key_exists($_REQUEST['mbgf_admin_page'], $this->admin_pages))
     1109            // The specified page must be in our array of pages -- this stops people from accessing other files on the FS
     1110            if ( isset($_REQUEST['mbgf_admin_page']) && array_key_exists($_REQUEST['mbgf_admin_page'], $this->admin_pages))
    11011111                require_once( "pages/{$_REQUEST['mbgf_admin_page']}.php" );
    11021112            else
     
    11051115       
    11061116        // This function is created when the page is loaded. It is passed the feed settings. It returns true if changes were made to the settings.
    1107         $changed = show_mb_facebook_page( &$this->feed_options );
     1117        $changed = show_mb_facebook_page( $this->feed_options );
    11081118       
    11091119        if ( $changed == true )
  • globalfeed/tags/0.1.2/feeds/mb_facebook/pages/setup.php

    r578780 r582059  
    1818?>
    1919<h2><?php _e('Facebook Connect Initial Setup',$mb_globalfeed_facebook_connect->get_slug()); ?></h2>
    20 <form>
     20<form id="setup-form">
    2121    <input type="hidden" id="activation_url" value="<?php echo $mb_globalfeed_facebook_connect->get_client_auth_redirect_url(); ?>" />
    2222    <input type="hidden" id="_wpnonce" value="<?php echo wp_create_nonce( 'facebook-connect-settings_main' ); ?>" />
     
    7878    });
    7979   
     80    function authorize(){
     81        // Begin authorization
     82        var app_id = jQuery('#app_id').val();
     83        var app_secret = jQuery('#app_secret').val();
     84        var app_id_match = new RegExp(/^[0-9]+$/);
     85        var app_secret_match = new RegExp(/^[a-zA-Z0-9]+$/);
     86        if (app_id_match.exec( app_id ) == null){
     87            showMessage('You must provide a valid app_id (must be only numbers)', 'app_id', true);
     88            setMsgRemove( 'app_id', 'app_id' );
     89            return false;
     90        } else if (app_secret_match.exec( app_secret ) == null){
     91            showMessage('You must provide a valid app_secret (only letters and numbers)', 'app_secret', true);
     92            setMsgRemove( 'app_secret', 'app_secret' );
     93            return false;
     94        } else {
     95            hideMessage( 'app_id' );
     96            hideMessage( 'app_secret' );
     97        }
     98
     99        // Disable the button and begin auth
     100        toggleAjaxIndicator( '#step-1' );
     101        hideAllMessages();
     102        jQuery('#authorize_button').attr("disabled", true);
     103
     104        // In order to get passed popup blockers, we open the AuthWindow now. In the future, this should pop up a temporary loading page, however we aren't that fancy yet.
     105        authWindow = window.open('',"fb_activation_window","location=0,status=0,scrollbars=0, width=750,height=500");
     106
     107        // Post the app_id and secret to the server for use in the auth process.
     108        jQuery.post(ajaxurl, {action:'mbgf_facebook_connect_set_app_info',app_id:app_id,app_secret:app_secret,_wpnonce:jQuery('#_wpnonce').val()}, function(response){
     109            //authWindow = window.open(jQuery('#activation_url').val() + '&client_id=' + jQuery('#app_id').val(), );
     110            authWindow.location.href = jQuery('#activation_url').val() + '&client_id=' + jQuery('#app_id').val();
     111            setAuthWindowChecker( '#step-1', function(){jQuery('#authorize_button').attr("disabled", false)}, jQuery('#activation_redirection_url').val() );
     112        });
     113    }
     114   
     115    function validate() {
     116        jQuery('#validate_button').attr("disabled", true);
     117        // Check input
     118        var fb_object_id_match = new RegExp(/^[a-zA-Z0-9]*$/);
     119        var fb_object_id = jQuery('#fb_object_id').val();
     120        if (fb_object_id_match.exec( fb_object_id ) == null){
     121            showMessage('You must provide a valid object id (must be only numbers)', 'fb_object_id', true);
     122            setMsgRemove( 'fb_object_id', 'fb_object_id' );
     123            jQuery('#validate_button').attr("disabled", false);
     124            return false;
     125        } else {
     126            hideMessage( 'fb_object_id' );
     127        }
     128
     129        jQuery('#fb_obj_confirm #confirm_fb_obj_id').children().fadeOut('fast', function () {jQuery(this).empty();});
     130        toggleAjaxIndicator( '#step-2' );
     131        hideAllMessages();
     132
     133        req = get_fb_object( fb_object_id, '#confirm_fb_obj_id' );
     134        req.complete(function(response){
     135            console.log(response);
     136            if ( response.status != 200 ) {
     137                    toggleAjaxIndicator( '#step-2' );
     138                    jQuery('#validate_button').attr("disabled", false);
     139                    return false;
     140            }
     141
     142            jQuery('#step-2>table').fadeOut('fast', function () {
     143                jQuery(this).hide();
     144                jQuery('#confirm_fb_obj_id').show()
     145                hideAjaxIndicator( '#step-2' );
     146                jQuery('#fb_obj_confirm').removeClass('hidden-step').show('fast');
     147            });
     148        });
     149    }
     150   
    80151    function setupStep( step ) {
    81152        switch( step ){
    82153            case 1:
    83154                // Setup the authorization button for step 1
    84                 jQuery('#authorize_button').attr("disabled", false).click(function(){
    85                     // Begin authorization
    86                     var app_id = jQuery('#app_id').val();
    87                     var app_secret = jQuery('#app_secret').val();
    88                     var app_id_match = new RegExp(/^[0-9]+$/);
    89                     var app_secret_match = new RegExp(/^[a-zA-Z0-9]+$/);
    90                     if (app_id_match.exec( app_id ) == null){
    91                         showMessage('You must provide a valid app_id (must be only numbers)', 'app_id', true);
    92                         setMsgRemove( 'app_id', 'app_id' );
    93                         return false;
    94                     } else if (app_secret_match.exec( app_secret ) == null){
    95                         showMessage('You must provide a valid app_secret (only letters and numbers)', 'app_secret', true);
    96                         setMsgRemove( 'app_secret', 'app_secret' );
    97                         return false;
    98                     } else {
    99                         hideMessage( 'app_id' );
    100                         hideMessage( 'app_secret' );
    101                     }
    102 
    103                     // Disable the button and begin auth
    104                     toggleAjaxIndicator( '#step-1' );
    105                     hideAllMessages();
    106                     jQuery('#authorize_button').attr("disabled", true);
    107                    
    108                     // In order to get passed popup blockers, we open the AuthWindow now. In the future, this should pop up a temporary loading page, however we aren't that fancy yet.
    109                     authWindow = window.open('',"fb_activation_window","location=0,status=0,scrollbars=0, width=750,height=500");
    110                    
    111                     // Post the app_id and secret to the server for use in the auth process.
    112                     jQuery.post(ajaxurl, {action:'mbgf_facebook_connect_set_app_info',app_id:app_id,app_secret:app_secret,_wpnonce:jQuery('#_wpnonce').val()}, function(response){
    113                         //authWindow = window.open(jQuery('#activation_url').val() + '&client_id=' + jQuery('#app_id').val(), );
    114                         authWindow.location.href = jQuery('#activation_url').val() + '&client_id=' + jQuery('#app_id').val();
    115                         setAuthWindowChecker( '#step-1', function(){jQuery('#authorize_button').attr("disabled", false)}, jQuery('#activation_redirection_url').val() );
    116                     });
    117                 });
    118                 jQuery('#authorize_button').attr("disabled", false);
     155                jQuery('#authorize_button').attr("disabled", false).click(authorize);
    119156                break; // End of step 1
    120157            case 2:
     
    156193                        });
    157194                    });
    158                     jQuery('#validate_button').click(function(){
    159                         jQuery('#validate_button').attr("disabled", true);
    160                         // Check input
    161                         var fb_object_id_match = new RegExp(/^[a-zA-Z0-9]*$/);
    162                         var fb_object_id = jQuery('#fb_object_id').val();
    163                         if (fb_object_id_match.exec( fb_object_id ) == null){
    164                             showMessage('You must provide a valid object id (must be only numbers)', 'fb_object_id', true);
    165                             setMsgRemove( 'fb_object_id', 'fb_object_id' );
    166                             jQuery('#validate_button').attr("disabled", false);
    167                             return false;
    168                         } else {
    169                             hideMessage( 'fb_object_id' );
    170                         }
    171                        
    172                         jQuery('#fb_obj_confirm #confirm_fb_obj_id').children().fadeOut('fast', function () {jQuery(this).empty();});
    173                         toggleAjaxIndicator( '#step-2' );
    174                         hideAllMessages();
    175                        
    176                         req = get_fb_object( fb_object_id, '#confirm_fb_obj_id' );
    177                         req.complete(function(response){
    178                             console.log(response);
    179                             if ( response.status != 200 ) {
    180                                     toggleAjaxIndicator( '#step-2' );
    181                                     jQuery('#validate_button').attr("disabled", false);
    182                                     return false;
    183                             }
    184 
    185                             jQuery('#step-2>table').fadeOut('fast', function () {
    186                                 jQuery(this).hide();
    187                                 jQuery('#confirm_fb_obj_id').show()
    188                                 hideAjaxIndicator( '#step-2' );
    189                                 jQuery('#fb_obj_confirm').removeClass('hidden-step').show('fast');
    190                             });
    191                         });
    192                     });
     195                    jQuery('#validate_button').click(validate);
    193196                    jQuery('#step-2').addClass('setup');
    194197                }
    195198                break; // End of step 2
    196199        }
    197 
    198     }
    199    
    200     function getLocaleString( locale ){
    201    
    202     }
    203    
     200    }
     201   
     202    jQuery('#setup-form').submit(function (e) {
     203        //e.preventDefault();
     204        console.log(_currentStep);
     205        switch (_currentStep){
     206            case 1:
     207                authorize();
     208                break;
     209            case 2:
     210                validate();
     211                break;
     212        }
     213    });
     214
    204215    function nextStep() {
    205216        loadStep( _currentStep + 1 );
  • globalfeed/tags/0.1.2/feeds/mb_twitter/mb_twitter.php

    r577487 r582059  
    121121        'initial_setup_done' => false,
    122122        'show_welcome_message' => false,
     123        'geotagging_enabled' => true
    123124    );
    124125   
     
    395396       
    396397        // Use the regex to replace numerical values to strings for older versions of php
    397         $updates = json_decode( preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $request['body']) );
     398        $updates = json_decode( preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $request['body']), true );
    398399       
    399400        if ( $updates == NULL )
     
    402403        $feed_items = array();
    403404        foreach ($updates as $update) {
     405            $globalfeed->print_debug_info($update);
     406            if ( $update['user']['id'] != $feed_options['object_to_subscribe'] )
     407                continue;
    404408           
    405             if ( $update->user->id != $feed_options['object_to_subscribe'] )
    406                 continue;
    407             $globalfeed->print_debug_info($update);
    408409            $post_args = array(
    409                 'post_content' => $globalfeed->post_content($update->text),
     410                'post_content' => $globalfeed->post_content($update['text']),
    410411                'post_excerpt' => '',
    411412                'comment_status' => 'closed',
    412413                'ping_status' => 'closed',
    413                 'post_author' => $update->user->id,
    414                 'post_title' => "@{$update->user->screen_name}",
    415                 'post_date' => date('Y-m-d H:i:s', strtotime( $update->created_at ) ),
     414                'post_author' => $update['user']['id'],
     415                'post_title' => "@{$update['user']['screen_name']}",
     416                'post_date' => date('Y-m-d H:i:s', strtotime( $update['created_at'] ) ),
    416417                'meta' => array(
    417                     'author_name' => $update->user->name,
    418                     'screen_name' => $update->user->screen_name,
    419                     'twitter_id' => $update->id,
    420                     'author_profile_image_url' => $update->user->profile_image_url,
    421                     'author_profile_image_url_https' => $update->user->profile_image_url_https,
    422                     'in_reply_to_status_id' => $update->user->in_reply_to_status_id,
    423                     'in_reply_to_user_id' => $update->user->in_reply_to_user_id,
    424                     'in_reply_to_screen_name' => $update->user->in_reply_to_screen_name,
     418                    'author_name' => $update['user']['name'],
     419                    'screen_name' => $update['user']['screen_name'],
     420                    'twitter_id' => $update['id'],
     421                    'author_profile_image_url' => $update['user']['profile_image_url'],
     422                    'author_profile_image_url_https' => $update['user']['profile_image_url_https'],
     423                    'in_reply_to_status_id' => $update['in_reply_to_status_id'],
     424                    'in_reply_to_user_id' => $update['in_reply_to_user_id'],
     425                    'in_reply_to_screen_name' => $update['in_reply_to_screen_name'],
    425426                ),
    426427            );
     
    438439                $post_args['ID'] = $posts[0]->ID;
    439440           
    440             if ( $this->feed_options['geotagging_enabled'] ){
    441                 $post_args['meta']['geo'] = $update->geo;
    442                 $post_args['meta']['coordinates'] = $update->coordinates;
    443                 $post_args['meta']['place'] = $update->place;
     441            if ( isset($this->feed_options['geotagging_enabled']) && $this->feed_options['geotagging_enabled'] && $update['user']['geo_enabled'] ){
     442                $post_args['meta']['geo'] = array('unique' => true, 'value' => $update['geo']);
     443                $post_args['meta']['coordinates'] = array('unique' => true, 'value' => $update['coordinates']);
     444                $post_args['meta']['place'] = array('unique' => true, 'value' => $update['place']);
    444445            }
    445446           
     
    456457       
    457458        // Save all of the feed items.
    458         $globalfeed->print_debug_info($feed_items);
     459        // $globalfeed->print_debug_info($feed_items);
    459460        //$globalfeed->print_debug_info(
    460461            $globalfeed->save_feed_items( $this->feed_slug, $feed_items );
  • globalfeed/tags/0.1.2/feeds/mb_twitter/pages/setup.php

    r577487 r582059  
    1818?>
    1919<h2><?php _e('Twitter Connect Initial Setup',$mb_globalfeed_twitter_connect->get_slug()); ?></h2>
    20 <form>
     20<form id="setup-form">
    2121    <input type="hidden" id="_wpnonce" value="<?php echo wp_create_nonce( 'twitter-connect-admin' ); ?>" />
    2222    <input type="hidden" id="tw_api_url" value="<?php echo $mb_globalfeed_twitter_connect->apiurl(); ?>" />
     
    9191                        });
    9292                    });
    93                     jQuery('#validate_button').click(function(){
     93                   
     94                    var validate = function (e) {
     95                        e.preventDefault();
    9496                        // The user has begun object validation
    9597                        jQuery('#validate_button').attr("disabled", true);
     
    109111                            jQuery('#validate_button').attr("disabled", false);
    110112                        })
    111                     });
     113                        return false;
     114                    }
     115                   
     116                    jQuery('#validate_button').click(validate);
     117                    jQuery('#setup-form').submit(validate);
    112118                    jQuery('#step-1').addClass('setup');
     119                   
     120                   
    113121                }
    114122                break; // End of step 2
  • globalfeed/tags/0.1.2/feeds/mb_youtube/mb_youtube.php

    r577487 r582059  
    126126        'initial_setup_done' => false,
    127127        'show_welcome_message' => false,
     128        'use_https' => true
    128129    );
    129130   
     
    197198        // Fetch the user data from YouTube
    198199        $userinfo = wp_remote_get("https://gdata.youtube.com/feeds/api/users/{$username}?alt=json");
     200        $this->globalfeed->print_debug_info($userinfo);
     201        if (is_wp_error($userinfo)) {
     202            // Try without https in case they have no https transports installed
     203            $userinfo = wp_remote_get("http://gdata.youtube.com/feeds/api/users/{$username}?alt=json");
     204            $this->globalfeed->print_debug_info($userinfo);
     205           
     206            if (is_wp_error($userinfo))
     207                die(json_encode ($userinfo->get_error_message()));
     208            else
     209                $this->feed_options['use_https'] = false;
     210        }
     211       
    199212        $userinfo = json_decode($userinfo['body'], true);
    200213        $userinfo = $userinfo['entry'];
     
    364377        $globalfeed->print_debug_info('Update YouTube Feed Called.', 'mb_youtube');
    365378       
    366         $api_url = "https://gdata.youtube.com/feeds/api/users/{$feed_options['object_to_subscribe']}/uploads?alt=json&orderby=published";
     379        $api_url = ($feed_options['use_https'] ? 'https://' : 'http://') ."gdata.youtube.com/feeds/api/users/{$feed_options['object_to_subscribe']}/uploads?alt=json&orderby=published";
    367380        if ( $feed_options['max_feed_items'] != 0 )
    368381            $api_url .="&max-results={$feed_options['max_feed_items']}";
  • globalfeed/tags/0.1.2/feeds/mb_youtube/pages/setup.php

    r577487 r582059  
    1818?>
    1919<h2><?php _e('YouTube Connect Initial Setup',$mb_globalfeed_youtube_connect->get_slug()); ?></h2>
    20 <form>
     20<form id="setup-form">
    2121    <input type="hidden" id="_wpnonce" value="<?php echo wp_create_nonce( 'youtube-connect-admin' ); ?>" />
    2222    <input type="hidden" id="yt_api_url" value="<?php echo $mb_globalfeed_youtube_connect->apiurl(); ?>" />
     
    9494                        });
    9595                    });
    96                     jQuery('#validate_button').click(function(){
     96                   
     97                    var validate = function (e) {
     98                        e.preventDefault();
    9799                        // The user has begun object validation
    98100                        jQuery('#validate_button').attr("disabled", true);
     
    112114                            jQuery('#validate_button').attr("disabled", false);
    113115                        })
    114                     });
     116                        return false;
     117                    }
     118                   
     119                    jQuery('#validate_button').click(validate);
     120                    jQuery('#setup-form').submit(validate);
    115121                    jQuery('#step-1').addClass('setup');
    116122                }
  • globalfeed/tags/0.1.2/feeds/mbgf_rss/mbgf_rss.php

    r577487 r582059  
    186186       
    187187        $feed_url = str_replace(' ','+',urldecode($_POST['rss_feed']));
    188         $rawxml = wp_remote_get( $feed_url );
    189         if ( is_wp_error($rawxml) )
    190             die( json_encode('Error reading rss feed.'));
    191        
    192         try {
    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                 }
     188
     189        $feed = $this->parse_rss_feed($feed_url);
     190       
     191        if ( !$feed || is_wp_error($feed) )
     192            die( json_encode(array('Error reading rss feed.', $feed)));
     193       
     194        if ( isset($feed['feed_list']) ) {
     195            // The function found an html page linking to a list of feeds. Ask the
     196            // client which feed is desired
     197            $feed_list = array();
     198            foreach ($feed['feed_list'] as $feed_url => $feed_info) {
     199                $feed_list[] = array(
     200                    'title' => $feed_info['title'],
     201                    'url' => $feed_url
     202                );
    225203            }
    226204           
    227             if ( $feed === false )
    228                 die( json_encode('Error reading rss feed.'));
    229            
    230             // Things seem to be okay
    231             $namespaces = $feed->getNamespaces(true);
    232             $feed = $feed->channel;
    233         } catch (Exception $exc) {
    234             die( json_encode('Error reading rss feed.'));
    235         }
    236        
    237         if ($feed == NULL)
    238             die( json_encode('Error reading rss feed.'));
     205            die(json_encode(array( 'feeds_found' => $feed_list )));
     206        }
     207       
     208        if ( isset($feed['url']) && !empty($feed['url']) )
     209            $feed_url = $feed['url'];
     210       
     211        $feed = $feed['feed'];
    239212       
    240213        // Save the feed data
     
    259232    }
    260233   
     234    /**
     235     * Attempts to grab a valid RSS feed from a url, or get the feeds pointed to
     236     * by the page at that url. (Ie: A wordpress blog that has links to several feeds)
     237     *
     238     * @param str $feed_url The url of the feed, or the page that links to the feed
     239     * @return boolean|array Array on success, false on fail
     240     *
     241     * @todo Get rid of the @ warning blockers by filtering the content.
     242     */
     243    private function parse_rss_feed( $feed_url ) {
     244        $rawxml = wp_remote_get( $feed_url );
     245        if ( is_wp_error($rawxml) )
     246            return $rawxml;
     247       
     248        try {
     249            @$feed = simplexml_load_string($rawxml['body']);
     250           
     251            // If this was not XML, check and see if it contains a link to an XML doc
     252            if ( $feed === false )  {
     253                // Things aren't okay. Check and see if we maybe got a webpage with a link to a feed
     254                if ( is_array($rawxml) ) {
     255                    $feed_list = array();
     256                    if ( isset( $rawxml['response'] ) && ((int) $rawxml['response']['code']) === 200) {
     257                        // We got served a page okay...
     258                        $dom = new DOMDocument;
     259                        if ( @!$dom->loadHTML($rawxml['body']) )
     260                            return false;
     261                       
     262                        foreach (  $dom->getElementsByTagName('link') as $link ) {
     263                            if ( $link->attributes->getNamedItem('rel')->nodeValue != 'alternate' || $link->attributes->getNamedItem('type')->nodeValue != 'application/rss+xml'
     264                                    || is_null($link->attributes->getNamedItem('href')->nodeValue))
     265                                continue;
     266                           
     267                            $feed_url = str_replace(' ','+',$link->attributes->getNamedItem('href')->nodeValue);
     268                            $rawxml = wp_remote_get( $feed_url );
     269                           
     270                            if ( is_wp_error($rawxml) )
     271                                return false;
     272                           
     273                            @$feed = simplexml_load_string($rawxml['body']);
     274
     275                            if ( $feed !== false )
     276                                // This seems to be a legit feed, add it to the list of those found
     277                                $feed_list[ $feed_url ] = array( 'title' => (string) trim( !empty($feed->channel->title) ? $feed->channel->title[0] : $link->attributes->getNamedItem('title')->nodeValue[0] ), 'url' => $feed_url, 'contents' => $feed );
     278                        }
     279                       
     280                        $feed_count = count($feed_list);
     281                        if ( $feed_count === 0 )
     282                            // No feeds found, send error
     283                            return false;
     284                        else if ( $feed_count > 1 )
     285                            // Several feeds found, send list
     286                            return array( 'feed_list' => $feed_list );
     287                        else {
     288                            // One feed found, return that feed
     289                            $feed = array_pop( $feed_list );
     290                            $feed_url = $feed['url'];
     291                            $feed = $feed['contents'];
     292                        }
     293                    }
     294                } else {
     295                    return false;
     296                }
     297            }
     298           
     299            if ( $feed === false )
     300                return false;
     301           
     302            // Things seem to be okay
     303            return array(
     304                'url' => $feed_url,
     305                'namespaces' => $feed->getNamespaces(true),
     306                'feed' => $feed->channel
     307                    );
     308        } catch (Exception $exc) {
     309            return false;
     310        }
     311    }
     312   
    261313    public function remove_rss_feed() {
    262314        check_admin_referer( 'mb-rss-admin' );
     
    269321            'post_type'   => $this->globalfeed->post_type_namespace() . $this->get_slug(),
    270322            'numberposts' => -1,
     323            'posts_per_page' => -1,
    271324            'meta_value'  => $feed_url,
    272325            'meta_key'    => 'source',
     
    433486            // Attempt to parse the xml feed
    434487            try {
    435                 $updates = simplexml_load_string($request['body']);
    436                 if ($updates == NULL)
     488                @$updates = simplexml_load_string($request['body']);
     489                if ($updates == NULL && empty($updates))
    437490                    throw new Exception('Could not parse XML. Invalid structure or not XML/RSS.');
    438491               
     
    483536                $posts = query_posts($posts_query);
    484537                if ( count($posts) >= 1 )
    485                     $post_args['import_id'] = $posts[0]['ID'];
     538                    $post_args['import_id'] = $posts[0]->ID;
    486539               
    487540                // Add the categories to the category variable.
     
    494547                    $content = $update->children($namespaces['content']);
    495548                    $post_args['post_content'] = (string) trim($content->encoded);
    496                 }
     549                } else if ( isset($update->description) ) {
     550                    $post_args['post_content'] = (string) $update->description[0];
     551                }
    497552               
    498553                // Get media information if its supported
     
    500555                    // Get the content from the media namespace
    501556                    $content = $update->children($namespaces['media']);
    502                    
    503                     // Set the post format based on the medium type
    504                     $post_args['post_format'] = $this->medium_post_format_conversions[$this->get_xml_attr($content->content[0], 'medium')];
    505                     $post_args['post_content'] = (string) trim($content->description);
    506                     $post_args['meta']['media'] = array(
    507                         'url' => $this->get_xml_attr($content->content[0], 'url'),
    508                         'medium' => $this->get_xml_attr($content->content[0], 'medium'),
    509                         'height' => (int) $this->get_xml_attr($content->content[0], 'height'),
    510                         'width' => (int) $this->get_xml_attr($content->content[0] ,'width'),
    511                     );
    512                    
    513                     $post_args['meta']['rating'] = (string) trim($content->rating);
    514                     $post_args['meta']['copyright'] = (string) trim($content->copyright);
    515                     $post_args['meta']['copyright_link'] = $this->get_xml_attr($content->copyright, 'url');
    516                     $post_args['meta']['thumbnail'] = $this->get_xml_attr($content->thumbnail[0], 'url');
    517                     $post_args['meta']['thumbnail_size'] = array(
    518                             'width' => (int) $this->get_xml_attr($content->thumbnail[0], 'width'),
    519                             'height' => (int) $this->get_xml_attr($content->thumbnail[0], 'height'),
    520                         );
    521                    
    522                     // Save the category as an array
    523                     if ( $this->get_xml_attr($content->category, 'label') != '')
    524                         $post_args['categories'][(string) trim($content->category)] =  $this->get_xml_attr($content->category, 'label');
    525                     else
    526                         $post_args['categories'][(string) trim($content->category)] = (string) trim($content->category);
     557                    if ( $content->content[0] ) {
     558                        // Set the post format based on the medium type
     559                        $post_args['post_format'] = (string) $this->medium_post_format_conversions[$this->get_xml_attr($content->content[0], 'medium')];$this->globalfeed->print_debug_info('ere');
     560                        $post_args['post_content'] = (string) trim($content->description);
     561                        $post_args['meta']['media'] = array( 'unique' => false, 'value' => array(
     562                            'url' => $this->get_xml_attr($content->content[0], 'url'),
     563                            'medium' => $this->get_xml_attr($content->content[0], 'medium'),
     564                            'height' => (int) $this->get_xml_attr($content->content[0], 'height'),
     565                            'width' => (int) $this->get_xml_attr($content->content[0] ,'width'),
     566                        ) );
     567                        $post_args['meta']['rating'] = (string) trim($content->rating);
     568                        $post_args['meta']['copyright'] = (string) trim($content->copyright);
     569                        $post_args['meta']['copyright_link'] = (string) $this->get_xml_attr($content->copyright, 'url');
     570                        $post_args['meta']['thumbnail'] = (string) $this->get_xml_attr($content->thumbnail[0], 'url');
     571                        $post_args['meta']['thumbnail_size'] = array( 'unique' => false, 'value' => array(
     572                                'width' => (int) $this->get_xml_attr($content->thumbnail[0], 'width'),
     573                                'height' => (int) $this->get_xml_attr($content->thumbnail[0], 'height'),
     574                            ) );
     575
     576                        // Save the category as an array
     577                        if ( $this->get_xml_attr($content->category, 'label') != '')
     578                            $post_args['categories'][(string) trim($content->category)] =  $this->get_xml_attr($content->category, 'label');
     579                        else
     580                            $post_args['categories'][(string) trim($content->category)] = (string) trim($content->category);
     581                    }
    527582                }
    528583
  • globalfeed/tags/0.1.2/feeds/mbgf_rss/pages/js/mbgf_rss.js

    r563348 r582059  
    4040                if (response == true) {
    4141                    // Setup is complete, go to main configuration.
    42                     showMessage('The feed was removed successfully.', 'removeSuccess', false, 10000);
     42                    showMessage('The feed was removed successfully.', 'removeSuccess_' + Math.round(Math.random()*1000), false, 10000);
    4343                    link_obj.parent().parent().remove();
    4444                    return true;
  • globalfeed/tags/0.1.2/feeds/mbgf_rss/pages/settings-main.php

    r578780 r582059  
    1212global $mb_globalfeed,$mbgf_rss,$mbgfa_theme;
    1313
    14 wp_enqueue_script('jquery');
     14$mbgfa_theme->queue_js_client_tools();
    1515?>
    1616<h2><?php _e('MB RSS') ?></h2>
    17 <form>
     17<form id="settings-form">
    1818    <input type="hidden" value="<?php echo wp_create_nonce( 'mb-rss-admin' ) ?>" id="_wpnonce" />
    1919    <div id="notices">
     
    4646        </table>
    4747    </fieldset>
     48   
     49    <div id="multiple_feeds_selector" style="display:none;">
     50        <h3>Multiple feeds were found at that url...</h3>
     51        <p>Which would you like to import?</p>
     52        <ul class="feed_list"></ul>
     53    </div>
    4854</form>
    4955    <script type="text/javascript">
    5056        jQuery(document).ready(function(){
    51             jQuery('.add_feed a').click(function(){
     57            var submit = function(e){
     58                e.preventDefault();
    5259                // Disable the element for checking...
    5360                jQuery(this).attr('disabled','');
     
    5562                toggleAjaxIndicator('.add_feed');
    5663               
     64                urlcheck = new RegExp(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i);
     65                checkUrl = function ( url ) {
     66                    return urlcheck.exec(url);
     67                }
     68               
    5769                // Apply the checking pattern...
    58                 urlcheck = new RegExp(/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i);
    59                 if ( !urlcheck.exec(jQuery('.add_feed input').val()) ){
     70               
     71                if ( !checkUrl(jQuery('.add_feed input').val()) ){
    6072                    showMessage('The url entered does not appear correct.', 'badUrl', false, 10000);
    6173                    jQuery('.add_feed input').removeAttr('disabled');
     
    6375                    return;
    6476                }
    65                
    66                 feed_info = add_feed( jQuery('.add_feed input').val() );
    67                 if ( feed_info != false ) {
    68                     feed_info.success(function (iresponse){
    69                         try {
    70                             if (iresponse.responseText != undefined)
    71                                 response = jQuery.parseJSON(iresponse.responseText);
    72                             else
    73                                 response = jQuery.parseJSON(iresponse);
    74                         } catch(err) {
    75                             showMessage('Error: An error was encountered saving the feed. ' + iresponse, 'saveError', true);
    76                             hideAjaxIndicator('.add_feed');
    77                             return;
    78                         }
    79                          
    80                         if ( typeof(response) == "undefined" || response == null || response.title == null ){
    81                             showMessage('Error: An error was encountered saving the feed. ' + response, 'saveError', true);
    82                             hideAjaxIndicator('.add_feed');
    83                             return;
    84                         }
    85                        
    86                         feed_item = jQuery("<tr><td class='feed_description'><strong>" + response.title + "</strong><br />" + response.description + "</td><td class='icons'><a href='" + response.feed_url + "' class='remove_feed'><?php $mbgfa_theme->minus('Remove Feed',16);?></a><?php $mbgfa_theme->ajaxIndicator('Working...');?></td></tr>");
    87                         jQuery('#feed_list').append(feed_item);
    88                        
    89                         setupRemoveHandler(jQuery('#feed_list').last().find('a'));
    90                         hideAjaxIndicator('.add_feed');
    91                         jQuery('.add_feed input').val('');
    92                     });
    93                 }
     77                var do_add_feed = function ( feed_url, cb ) {
     78                    if ( typeof feed_url === 'undefined' )
     79                        feed_url = jQuery('.add_feed input');
     80                   
     81                    feed_info = add_feed( feed_url );
     82                    if ( feed_info != false ) {
     83                        feed_info.success(function (iresponse){
     84                            try {
     85                                if (iresponse.responseText != undefined)
     86                                    response = jQuery.parseJSON(iresponse.responseText);
     87                                else
     88                                    response = jQuery.parseJSON(iresponse);
     89                            } catch(err) {
     90                                showMessage('Error: An error was encountered saving the feed. ' + iresponse, 'saveError', true);
     91                                hideAjaxIndicator('.add_feed');
     92                                return;
     93                            }
     94
     95                            if ( typeof(response) == "undefined" || response == null || (response.title == null && response.feeds_found == null) ){
     96                                showMessage('Error: An error was encountered saving the feed. ' + response, 'saveError', true);
     97                                hideAjaxIndicator('.add_feed');
     98                                return;
     99                            }
     100
     101                            if ( response.title != null ) {
     102                                // The feed was successfully parsed
     103                                feed_item = jQuery("<tr><td class='feed_description'><strong>" + response.title + "</strong><br />" + response.description + "</td><td class='icons'><a href='" + response.feed_url + "' class='remove_feed'><?php $mbgfa_theme->minus('Remove Feed',16);?></a><?php $mbgfa_theme->ajaxIndicator('Working...');?></td></tr>");
     104                                jQuery('#feed_list tbody').append(feed_item);
     105
     106                                setupRemoveHandler(jQuery('#feed_list tbody tr:last-child a'));
     107                                hideAjaxIndicator('.add_feed');
     108                                jQuery('.add_feed input').val('');
     109                                if ( typeof cb !== 'undefined' )
     110                                    cb();
     111                            } else {
     112                                // Multiple feeds were found -- ask the user which they want
     113                                jQuery('#multiple_feeds_selector .feed_list').empty();
     114                               
     115                                var c = 0;
     116                                for ( i in response.feeds_found ) {
     117                                    jQuery('#multiple_feeds_selector .feed_list').append(
     118                                        '<li><label for="found_feed_' + c + '"><input id="found_feed_' + c + '" name="found_feed_' + c + '" type="checkbox" value="' + response.feeds_found[i].url + '" /> ' + response.feeds_found[i].title + "</label><?php echo $mbgfa_theme->ajaxIndicator('Getting Feed...', true); ?></li>"
     119                                    );
     120                                   
     121                                    c++;
     122                                }
     123                               
     124                                jQuery('#multiple_feeds_selector .feed_list li input').change(function () {
     125                                    var parent = jQuery(this).parents('li');
     126                                    if ( checkUrl(jQuery(this).val()) ) {
     127                                        jQuery(this).attr('disabled', true);
     128                                        toggleAjaxIndicator(jQuery(this).parents('li'));
     129                                        do_add_feed( jQuery(this).val(), function () {
     130                                            parent.fadeOut(function () {
     131                                                jQuery(this).remove();
     132                                                if ( jQuery('#multiple_feeds_selector .feed_list').children('li').length === 0 )
     133                                                    jQuery.fancybox.close();
     134                                            });
     135                                        } );
     136                                    } else
     137                                        parent.remove();
     138                                });
     139                               
     140                                jQuery.fancybox.open({ content: jQuery('#multiple_feeds_selector'), beforeClose: function () {hideAjaxIndicator('.add_feed');} });
     141                            }
     142                        });
     143                    }
     144                };
     145               
     146                do_add_feed( jQuery('.add_feed input').val() );
    94147                jQuery('.add_feed input').removeAttr('disabled');
    95             });
     148                return false;
     149            }
    96150           
     151            jQuery('.add_feed a').click(submit);
     152            jQuery('#settings-form').submit(function (e) {
     153                if ( jQuery('.add_feed input').is(':focus') ) {
     154                    e.preventDefault();
     155                    submit(e);
     156                    return false;
     157                }
     158            })
    97159            setupRemoveHandler();
    98160
     
    117179
    118180        function setupRemoveHandler( item ) {
    119             if (typeof(item) == 'undefined') {
     181            if ( typeof(item) === 'undefined' ) {
    120182                jQuery('.remove_feed').click(function(){
    121183                    jQuery(this).hide();
  • globalfeed/tags/0.1.2/mb_globalfeed.php

    r579409 r582059  
    22/*
    33  Plugin Name: GlobalFeed
    4   Plugin URI: http://MichaelBlouin.ca
    5   Version: 0.1.1
     4  Plugin URI: http://GlobalFeed.MichaelBlouin.ca
     5  Version: 0.1.2
    66  Author: <a href="http://www.michaelblouin.ca/">Michael Blouin</a>
    77  Description: This plugin can integrate nearly any type of feed into the WordPress feed on your blog pages.
     
    4646        private $_loaded = false;
    4747        private $current_page = false;
    48         private $globalfeed_version = '0.10';
     48        private $globalfeed_version = '0.1.2';
    4949        private $_in_widget = false;
    5050        private $_in_shortcode = false;
     
    526526        function create_options(){
    527527            // Create plugin options
    528             $this->load_settings;
     528            $this->load_settings();
    529529            add_option( $this->saved_options_name['settings'], $this->settings );
    530530            add_option( $this->saved_options_name['feeds'], array() );
     
    683683            $current_page_info = array(
    684684                'page' => $current_page,
    685                 'category' => $fake_query->category__in,
    686                 'tag' => $fake_query->tag__in,
     685                'category' => (isset($fake_query->category__in) ? $fake_query->category__in : array()),
     686                'tag' => (isset($fake_query->tag__in) ? $fake_query->tag__in : array()),
    687687                'request' => $request,
    688688                'query' => &$fake_query
     
    736736           
    737737            // Add the post types to the query and return
    738             if ( count( $post_types ) > 0 )
    739                 $request[ 'post_type' ] = array_unique( array_merge( (array) $request[ 'post_type' ], $post_types ) );
     738            if ( count( $post_types ) > 0 ) {
     739                if ( isset($request[ 'post_type' ]) )
     740                    $request[ 'post_type' ] = array_unique( array_merge( (array) $request[ 'post_type' ], $post_types ) );
     741                else
     742                    $request[ 'post_type' ] = $post_types;
     743            }
    740744           
    741745            $this->print_debug_info("Request Modified.", 'notifications');
     
    913917           
    914918            // Define template file locations (for the feed and globalfeed default
    915             $templates_path = dirname($this->registered_feeds[$feed_slug]['file_path']) . '/templates/';
     919            if ( !empty($feed_slug) )
     920                $templates_path = dirname($this->registered_feeds[$feed_slug]['file_path']) . '/templates/';
     921            else
     922                $templates_path = '';
     923           
    916924            $feed_templates_path = dirname(__FILE__) . "/templates/";
    917925           
     
    933941                        $located = $feed_templates_path . $template_name;
    934942                        break;
    935                     } else if ( file_exists($templates_path . $template_name) ) {
     943                    } else if ( !empty($templates_path) && file_exists($templates_path . $template_name) ) {
    936944                        $this->load_theme_stylesheet($templates_path);
    937945                        $located = $templates_path . $template_name;
     
    9991007                if ( !empty($feeds) ) {
    10001008                    foreach ( $feeds as $slug => &$feed ) {
    1001                         if ( $feed['autoload'] !== false )
     1009                        $this->print_debug_info($feed);
     1010                        if ( !isset($feed['autoload']) || $feed['autoload'] !== false )
    10021011                            require_once($feed['file_path']);
    10031012
     
    10261035                $feed = &$feeds[ $feed_slug ];
    10271036               
    1028                 if ( $feed['loaded'] ) {
     1037                if ( isset($feed['loaded']) && $feed['loaded'] ) {
    10291038                    global $$feed['class_name'];
    10301039                    return $$feed['class_name'];
     
    10621071            $wp_required =  explode('.', $feed['WordPressVersion']);
    10631072            foreach ($wp_required as $i => $value) {
    1064                 if ( !isset($wpv[$i]) || ((int) $wpv[$i]) < ((int) $wordpress_required[$i]) )
     1073                if ( !isset($wpv[$i]) || ((int) $wpv[$i]) < ((int) $value) )
    10651074                    $requirements[ 'WordPress Version' ] = sprintf( __("{$feed['Name']} requires WordPress v%s+.", $feed['Slug']), $feed['WordPressVersion'] );
    10661075            }
    10671076
    10681077            // Check that Global Feed is v0.1 or greater
    1069             $gfv = explode('.', $mb_globalfeed->version);
     1078            $gfv = explode('.', $this->version());
    10701079            $globalfeed_required =  explode('.', $feed['GlobalFeedVersion']);
    10711080            foreach ($globalfeed_required as $i => $value) {
     
    11741183            );
    11751184           
    1176             $options = wp_parse_args( $options, $default );
     1185            $options = wp_parse_args( $options, $defaults );
    11771186           
    11781187            //The post type plus the Global Feed namespace cannot be more than 20 characters.
     
    11971206               
    11981207                //Do not allow feeds to force their own activation
    1199                 if ( !empty( $registered_feeds[ $feed_slug ] ) )
     1208                if ( !empty( $registered_feeds[ $feed_slug ] ) && isset($registered_feeds[ $feed_slug ][ 'activated' ]) )
    12001209                    $options[ 'activated' ] = $registered_feeds[ $feed_slug ][ 'activated' ];
     1210                else
     1211                    $options[ 'activated' ] = true;
    12011212               
    12021213                // We're good to save feed settings
     
    13151326                        // This is not implemented yet...
    13161327                    } else { // Save categories as meta instead
    1317                         $feed_item['meta']['categories'] = $feed_item['categories'];
     1328                        if ( !isset($feed_item['meta']) )
     1329                            $feed_item['meta'] = array();
     1330                       
     1331                        $feed_item['meta']['categories'] = array( 'unique' => true, 'value' => $feed_item['categories'] );
    13181332                        unset($feed_item['categories']);
    13191333                    };
     
    13231337                        // This is not implemented yet...
    13241338                    } else { // Save tags as meta instead
    1325                         $feed_item['meta']['tags'] = $feed_item['tags'];
     1339                        if ( !isset($feed_item['meta']) )
     1340                            $feed_item['meta'] = array();
     1341                       
     1342                        $feed_item['meta']['tags'] = array( 'unique' => true, 'value' => $feed_item['tags']);
    13261343                        unset($feed_item['tags']);
    13271344                    };
     
    13971414                // Calculate where pages should be shown.
    13981415                foreach ( $feed_options[ 'pages_to_show' ] as $key => $value ) {
    1399                     if ( in_array( $key, array( 'tag', 'category' ) ) ) {
     1416                    if ( in_array( $key, array( 'tag', 'category' ) ) && is_array($value) ) {
    14001417                        foreach ( $value as $tax ) {
    14011418                            if ( is_array( $pages[$key][$tax] ) )
     
    14261443                if ( !empty($feed_options[ 'pages_not_to_show' ])){
    14271444                    foreach ( $feed_options[ 'pages_not_to_show' ] as $key => $value) {
    1428                         if ( in_array( $key, array( 'tag', 'category' ) ) ) {
     1445                        if ( in_array( $key, array( 'tag', 'category' ) ) && is_array($value) ) {
    14291446                            foreach ( $value as $tax ) {
    14301447                                if ( is_array( $pages[ $key ][ $tax ] ) )
     
    15551572           
    15561573            if ( in_array('url', $types) ) {
    1557                 $pattern = '/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:\.\?+=&%@!\-\/]))?([^“�«»„])/u';
     1574                $pattern = '/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:\.\?+=&%@!\-\/]))?([^“�«»„])/u';
    15581575                $text = implode(' ',preg_replace_callback( $pattern, array( &$this, '_replace_link_callback'), explode(' ', $text)));
    15591576            }
     
    16031620         * @return The formatted excerpt
    16041621         */
    1605         function post_content( $content, $args ) {
     1622        function post_content( $content, $args = array() ) {
    16061623            $args = wp_parse_args($args, $this->settings['post_content']);
    16071624           
  • globalfeed/tags/0.1.2/readme.txt

    r578932 r582059  
    55Requires at least: 3.3
    66Tested up to: 3.4.1
    7 Stable tag: 0.1.1
     7Stable tag: 0.1.2
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535
    3636If you are interested in developing GlobalFeed, or have a fix you would like to submit, please go to our bug reports page through the plugin and get in touch.
     37
     38= Requirements =
     39PHP >= 5.2.2
    3740
    3841== Installation ==
     
    8689== Changelog ==
    8790
     91= 0.1.2 =
     92- MB RSS can be pointed to a webpage and will attempt to automatically discover its RSS feeds, and will then prompt the user if more than one feed is found.
     93- Added additional parsing capabilities to MB RSS to increase compatibility with feeds such as Tumblr and DeviantArt.
     94- Fixed a large number of notices that were appearing in older versions of PHP and that were breaking the plugin.
     95- Stopped the user from being redirected when pressing enter while a feed setup textbox was focused.
     96- Stopped MB RSS from displaying multiple feed removed messages when a feed as removed after adding one or more feeds.
     97
    8898= 0.1.1 =
    8999- Stability improvements for feed setup screens, including much better support for the Facebook feed.
     
    113123= 0.2 =
    114124*   More configuration options in both the plugin admin and all feed admin pages.
     125*       Tumblr and DeviantArt quickembeds in MB RSS.
    115126*       Ability to just attach media (pictures/videos) to posts instead of embedding it directly in the content.
    116 *       Customize feed update interval
    117127*   Better in-plugin support (explanation of options/features)
    118128*   Flickr feed
    119 *   DeviantArt feed
    120129*   Google+ feed
    121130
Note: See TracChangeset for help on using the changeset viewer.