Plugin Directory

Changeset 591175


Ignore:
Timestamp:
08/28/2012 02:21:28 AM (13 years ago)
Author:
mobius5150
Message:

Committing the first of the changes for 0.1.3 to trunk.. Not updating stable tag yet. See readme.txt for changes under 0.1.3

Location:
globalfeed/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • globalfeed/trunk/admin/pages/admin_presentation.php

    r582062 r591175  
    2727        $settings['media_display_mode'] = (isset($_POST['presentation-media_display_mode']) && $_POST['presentation-media_display_mode'] == 'on') ? 'embed' : 'smart';
    2828        $settings['theme_show_avatar'] = isset($_POST['presentation-theme_show_avatar']) && $_POST['presentation-theme_show_avatar'] == 'on';
     29        $settings['autodetect_link_open_new_window'] = (isset($_POST['presentation-autodetect_link_open_new_window']) && $_POST['presentation-autodetect_link_open_new_window']  == 'on');
    2930    }
    3031?>
     
    4041        <p><label for="presentation-theme_show_avatar"><input type="checkbox" <?php echo $settings['theme_show_avatar'] ? 'checked="checked"' : ''; ?> id="presentation-theme_show_avatar" name="presentation-theme_show_avatar" /> Show avatar in GlobalFeed themes</label></p>
    4142        <p><label for="presentation-media_display_mode"><input type="checkbox" <?php echo $settings['media_display_mode'] == 'embed' ? 'checked="checked"' : ''; ?> id="presentation-media_display_mode" name="presentation-media_display_mode" /> Embed media in post content (images, videos etc..)</label></p>
     43        <p><label for="presentation-autodetect_link_open_new_window"><input type="checkbox" <?php echo $settings['autodetect_link_open_new_window'] ? 'checked="checked"' : ''; ?> id="presentation-autodetect_link_open_new_window" name="presentation-autodetect_link_open_new_window" /> Open GlobalFeed-generated links in a new window</label></p>
    4244       
    4345        <input type="submit" value="Save Settings" />
  • globalfeed/trunk/admin/pages/style.css

    r577487 r591175  
    137137    margin: 0px 20px 20px 0px;
    138138    padding: 5px 10px 10px;
    139     width: 500px;
    140     display:inline;
    141     display:inline-block;
     139}
     140
     141@media screen and (min-width: 960px) {
     142    .optgrp {
     143        max-width: 500px;
     144        width: 100%;
     145        display:inline;
     146        display:inline-block;
     147    }
     148}
     149
     150@media screen and (min-width: 960px) {
     151    .optgrp {
     152        display:block;
     153    }
    142154}
    143155
  • globalfeed/trunk/event_scheduler_interfaces/wp-schedule-interface.php

    r582062 r591175  
    1818       
    1919        add_filter($this->hook_name, array( &$this, 'do_scheduled_action'), 1, 3);
     20       
     21        //$globalfeed->print_debug_info($this->get_scheduled_events());
    2022    }
    2123   
     
    9294        $mb_globalfeed->print_debug_info($action);
    9395       
    94         if ( !class_exists($caller) || method_exists($caller, $action))
     96        if ( !class_exists($caller) || !method_exists($caller, $action))
    9597            return;
    9698       
    97         $mb_globalfeed->print_debug_info(call_user_func( array( &$$caller, $action ), $args ));
     99        $mb_globalfeed->print_debug_info(call_user_func( array( &$$caller, $action ), $args ) );
    98100    }
    99101   
  • globalfeed/trunk/feeds/mb_facebook/mb_facebook.php

    r582062 r591175  
    776776                    else
    777777                        $globalfeed->print_debug_info ($img);
    778                    
     778                    $globalfeed->print_debug_info($update);
    779779                    $post_args['meta']['link'] = $update->link;
    780780                    $content_args['media_format'] = 'image';
     
    783783                case 'status' :
    784784                    $post_args['post_format'] = 'status';
    785                     if (isset($update->story) && isset($update->story_tags) && !isset($update->actions)) {
    786                         $update->actions = array();
    787                         // This is a story... Perform a bit of introspection to figure out how to link to it.
    788                         foreach ($update->story_tags as $key => $value) {
    789                             $graph_url = "https://graph.facebook.com/{$value[0]->id}?access_token={$access_token}&metadata=1";
    790                             $introspect = wp_remote_get($graph_url);
    791                            
    792                             if (is_wp_error($introspect))
    793                                 return false;
    794 
    795                             $introspect = json_decode($introspect['body']);
    796                             $globalfeed->print_debug_info($introspect, 'mb_facebook');
    797                             if ( isset($introspect->type) ) {
    798                                 $action_name = 'View ' . ucwords($introspect->type);
    799                                
    800                                 $obj = new stdClass();
    801                                 switch ($type) {
    802                                     case 'user':
    803                                         $obj->name = $action_name;
    804                                         $obj->link = "https://facebook.com/{$value[0]->id}";
    805                                         break;
    806                                     default:
    807                                         $obj->name = $action_name;
    808                                         $obj->link = "https://facebook.com/{$type}/{$value[0]->id}";
    809                                         break;
    810                                 }
    811                                
    812                                 $update->actions[] = $obj;
    813                             }
    814                         }
    815                        
    816                     }
    817785                    break;
    818786                default :
    819787                    $post_args['post_format'] = 'status';
    820788                    break;
     789            }
     790           
     791            // If this object has story attributes, parse them
     792            if (isset($update->story) && isset($update->story_tags) ) {
     793                if ( !isset($update->actions) )
     794                    $update->actions = array();
     795               
     796                // This is a story... Perform a bit of introspection to figure out how to link to it.
     797                foreach ($update->story_tags as $key => $value) {
     798                    $value = $value[0];
     799                    // Detect the object type
     800                    $type = '';
     801                    if ( isset($value->type) ) {
     802                        $type = $value->type;
     803                    } else {
     804                        $graph_url = "https://graph.facebook.com/{$value[0]->id}?access_token={$access_token}&metadata=1";
     805                        $introspect = wp_remote_get($graph_url);
     806
     807                        if (is_wp_error($introspect))
     808                            return false;
     809                        $introspect = json_decode($introspect['body']);
     810                        $type = $introspect->type;
     811                        //$globalfeed->print_debug_info($introspect, 'mb_facebook');
     812                    }
     813
     814                    if ( !empty($type) ) {
     815                        $action_name = 'View ' . ucwords($type);
     816
     817                        $obj = new stdClass();
     818                        switch ($type) {
     819                            case 'user':
     820                                $obj->name = $action_name;
     821                                $obj->link = "https://facebook.com/{$value->id}";
     822                                break;
     823                            default:
     824                                $obj->name = $action_name;
     825                                $obj->link = "https://facebook.com/{$type}/{$value->id}";
     826                                break;
     827                        }
     828
     829                        // Now that we know the type, check and see if we should add a link to this object in the content
     830                        if ( !isset($content_args['links']) )
     831                            $content_args['links'] = array();
     832
     833                        $content_args['links'][$obj->link] = $value;
     834
     835                        $update->actions[] = $obj;
     836                    }
     837                }
    821838            }
    822839           
  • globalfeed/trunk/mb_globalfeed.php

    r582062 r591175  
    268268                'widget_skin' => 'fb',                                  // The GlobalFeed sking to use on widgets.
    269269                'plugin_update_interval' => 600,                        // The default for how often feeds update
     270                'autodetect_link_open_new_window' => true,
    270271                'plugin_update_intervals' => array(
    271272                    'Ten Minutes' => '600',
     
    10071008                if ( !empty($feeds) ) {
    10081009                    foreach ( $feeds as $slug => &$feed ) {
    1009                         $this->print_debug_info($feed);
    10101010                        if ( !isset($feed['autoload']) || $feed['autoload'] !== false )
    10111011                            require_once($feed['file_path']);
     
    15001500                'link'                  => '',          // If set for images, the image will be wrapped in a link tag.
    15011501                'link_text'             => '',          // The text that appears for the link. Will appear as the title attribute for images.
    1502                 'link_target'           => '_blank',    // The links' target attribute.
     1502                'link_target'           => ($this->settings['autodetect_link_open_new_window'] ? '_blank' : ''),    // The links' target attribute.
    15031503                'css'                 => '',          // CSS Classes to add to the element
    15041504                'height'                => '',          // The height of the produced element
     
    15721572           
    15731573            if ( in_array('url', $types) ) {
    1574                 $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';
    15751575                $text = implode(' ',preg_replace_callback( $pattern, array( &$this, '_replace_link_callback'), explode(' ', $text)));
    15761576            }
     
    15901590        }
    15911591       
     1592        /**
     1593         * Embeds custom links given either the offset and length of the text to
     1594         * be linked to or the text to be replaced to create the link.
     1595         *
     1596         * @param str $content The content to have links added
     1597         * @param array $links An array of links to be added, with the link url as the key
     1598         */
     1599        function embed_links( $content, $links ) {
     1600            $c_offset = 0;
     1601            foreach ($links as $url => $args) {
     1602                $args = (array) $args;
     1603                if ( isset($args['offset']) && isset($args['length']) ) {
     1604                    $this->print_debug_info($args);
     1605                    $args['offset'] = (int) $args['offset']; $args['length'] = (int) $args['length'];
     1606                    $link = "<a href='{$url}'" . ($this->settings['autodetect_link_open_new_window'] ? " target='_blank'" : "") . ">" . substr($content, $c_offset + $args['offset'], $args['length']) . "</a>";
     1607                   
     1608                    $content = substr($content, 0, $c_offset + $args['offset']) . $link . substr($content, $c_offset + $args['offset'] + $args['length']);
     1609                    $c_offset += strlen($link) - $args['length'];
     1610                } else if ( isset($args['name']) ) {
     1611                   
     1612                }
     1613            }
     1614           
     1615            return $content;
     1616        }
     1617       
    15921618        /**
    15931619         * Used by detect_content_links as the callback for link creation to avoid
     
    15971623         */
    15981624        private function _replace_link_callback ( $matches ) {
    1599             return '<a href="' .$matches[0]. '" target="_blank">' . $matches[0] . '</a>';
     1625            return '<a href="' .$matches[0]. '"' . ($this->settings['autodetect_link_open_new_window'] ? ' target="_blank">' : '>') . $matches[0] . '</a>';
    16001626        }
    16011627       
    16021628        private function _replace_twitter_user_callback( $matches ) {
    16031629            $ins = substr($matches[0],1);
    1604             return "<a href='http://twitter.com/$ins' class='twitter_user' target='_blank'>@<span>$ins</span></a>";
     1630            return "<a href='http://twitter.com/$ins' class='twitter_user'" . ($this->settings['autodetect_link_open_new_window'] ? " target='_blank'" : "") . ">@<span>$ins</span></a>";
    16051631        }
    16061632       
    16071633        private function _replace_twitter_hashtag_callback( $matches ) {
    1608             return "<a href='http://twitter.com/#!/search/" . urlencode($matches[0]) . "' class='twitter_hashtag' target='_blank'>#<span>" . substr($matches[0],1) . "</span></a>";
     1634            return "<a href='http://twitter.com/#!/search/" . urlencode($matches[0]) . "' class='twitter_hashtag'" . ($this->settings['autodetect_link_open_new_window'] ? " target='_blank'" : "") . ">#<span>" . substr($matches[0],1) . "</span></a>";
    16091635        }
    16101636       
     
    16241650           
    16251651            // First check if there is a set word limit
    1626             if ( $args['word_count'] !== false ) {
     1652            if ( isset($args['character_count']) && $args['word_count'] !== false ) {
    16271653                $words = explode(' ', $content);
    16281654                $content = implode(' ', array_slice($words, 0, $args['word_count']));
     
    16301656           
    16311657            // Now check if there is a set character limit
    1632             if ( $args['character_count'] !== false && count($content) > $args['character_count'] )
     1658            if ( isset($args['character_count']) && $args['character_count'] !== false && count($content) > $args['character_count'] )
    16331659                // Get the position of the last space within the character limit and cut the string
    16341660                $content = substr($content, 0, strrpos(substr($content, 0, $args['character_count']), ' '));
    16351661           
     1662            // Check if we need to embed custom links
     1663            if ( isset($args['links']) && is_array($args['links']) )
     1664                $content = $this->embed_links($content, $args['links']);
     1665           
    16361666            // Check if we have to detect content links
    1637             if ( $args['detect_content_links'] )
     1667            if ( isset($args['detect_content_links']) && $args['detect_content_links'] )
    16381668                $content = $this->detect_content_links ($content);
    16391669           
    16401670            // Now check if we're to embed content
    1641             if ( $args['include_media'] && $this->media_display_mode() == 'embed' && isset($args['media_format']) && isset($args['media_info']))
     1671            if ( isset($args['include_media']) && $args['include_media'] && $this->media_display_mode() == 'embed' && isset($args['media_format']) && isset($args['media_info']))
    16421672                $content = $this->embed_media_item($content, $args['media_format'], $args['media_info']);
    16431673           
  • globalfeed/trunk/readme.txt

    r582062 r591175  
    8989== Changelog ==
    9090
     91= 0.1.3 =
     92- Added GlobalFeed option to open GlobalFeed-generated links in a new window.
     93- Fixed an issue that stopped GlobalFeed from updating automatically in certain hosting environments.
     94
    9195= 0.1.2 =
    9296- 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.
Note: See TracChangeset for help on using the changeset viewer.