function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Twitter', 'tfuse') : $instance['title'], $instance, $this->id_base);
     $username = apply_filters('widget_items', $instance['username'], $instance, $this->id_base);
     $items = apply_filters('widget_items', $instance['items'], $instance, $this->id_base);
     $return_html = '';
     if (!empty($username)) {
         $tweets = tfuse_get_tweets($username, $items);
         $before_widget = '<div class="widget widget_twitter">';
         $after_widget = '</div>';
         $return_html .= $before_widget;
         if (!empty($title)) {
             $return_html .= '<h3 class="widget-title">' . tfuse_qtranslate($title) . '</h3>';
         }
         $return_html .= '<div class="tweet_list">';
         foreach ($tweets as $tweet) {
             $return_html .= '<div class="tweet_item clearfix">';
             $return_html .= '<div class="tweet_image"><img src="' . $tweet->user->profile_image_url . '" width="58" height="58" alt="" /></div>';
             if (isset($tweet->text)) {
                 $return_html .= '<div class="tweet_text">' . $tweet->text;
             }
             if (!empty($tweet->created_at)) {
                 $return_html .= '<br><span class="tweet_time">' . ucfirst($tweet->created_at) . '</span>';
             }
             if (isset($tweet->text)) {
                 $return_html .= '</div>';
             }
             $return_html .= '</div>';
         }
         $return_html .= '</div>' . $after_widget;
     }
     echo $return_html;
 }
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('', 'tfuse') : $instance['title'], $instance, $this->id_base);
     $username = apply_filters('widget_items', $instance['username'], $instance, $this->id_base);
     $items = apply_filters('widget_items', $instance['items'], $instance, $this->id_base);
     $instance['position'] = empty($instance['position']) ? '' : $instance['position'];
     $b = $instance['b'] = empty($instance['b']) ? '' : $instance['b'];
     $class = $b ? 'widget-boxed' : '';
     $return_html = '';
     if (!empty($username)) {
         $tweets = tfuse_get_tweets($username, $items);
         $return_html .= '<div class="widget widget_twitter ' . $class . '">';
         $return_html .= '<h3 class="widget-title">' . $title . '</h3>
                         <div class="tweet_list">';
         foreach ($tweets as $tweet) {
             $return_html .= '<div class="tweet_item clearfix">';
             $return_html . '<div class="tweet_image">
                                         <img src="' . $tweet->user->profile_image_url . '" width="30" height="30" alt="" />
                                 </div>';
             if (isset($tweet->text)) {
                 $return_html .= '<div class="tweet_image"><img src="' . get_template_directory_uri() . '/images/twitter_avatar.png" width="30" height="30" alt="" /></div>
                             <div class="tweet_text">
                                             <div class="inner">
                                                 ' . $tweet->text . '
                                         </div></div>';
             }
             $return_html .= '</div>';
         }
         $return_html .= '</div></div>';
     }
     echo $return_html;
 }
Ejemplo n.º 3
0
/**
 * MG_Twitter
 * 
 * To override this shortcode in a child theme, copy this file to your child theme's
 * theme_config/extensions/shortcodes/shortcodes/ folder.
 * 
 * Optional arguments:
 * items: 5
 * username:
 * title:
 * post_date:
 */
function tfuse_mgtwitter($atts, $content = null)
{
    extract(shortcode_atts(array('items' => 5, 'username' => '', 'title' => '', 'post_date' => '', 'follow' => ''), $atts));
    $return_html = '';
    if (!empty($username)) {
        $tweets = tfuse_get_tweets($username, $items);
        $return_html .= '<div class="widget-container widget_twitter">';
        if (!empty($title)) {
            $return_html .= '<h3 class="widget-title">' . tfuse_qtranslate($title) . '</h3>';
        }
        $return_html .= '<div class="tweet_list">';
        foreach ($tweets as $tweet) {
            if (isset($tweet->text)) {
                $return_html .= '<div class="tweet_item clearfix even">
                <div class="tweet_image"><img src="' . $tweet->user->profile_image_url . '" width="36" height="38" alt=""></div>
                    <div class="tweet_text"><div class="inner">' . $tweet->text . '</div></div>
                </div>';
            }
        }
        if (!empty($follow)) {
            $return_html .= '<p><a href="https://twitter.com/' . $username . '" class="link-more">' . $follow . '</a></p>';
        }
        $return_html .= '</div>';
        $return_html .= '</div>';
    }
    return $return_html;
}
Ejemplo n.º 4
0
    function widget($args, $instance)
    {
        extract($args);
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $limit = !empty($instance['limit']) ? $instance['limit'] : 5;
        $username = !empty($instance['username']) ? $instance['username'] : '******';
        $unique_id = $args['widget_id'] . rand(0, 100);
        $before_widget = '<div class="clear"></div><div class="clear"></div><div class="widget-container widget_twitter">';
        $after_widget = '</div>';
        $before_title = '<h3>';
        $after_title = '</h3>';
        ?>

    <?php 
        echo $before_widget;
        ?>

    <?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

    <div class="back" id="twitter_update_list_<?php 
        echo $unique_id;
        ?>
"></div>
    <?php 
        if (!empty($username)) {
            $return_html = '';
            $tweets = tfuse_get_tweets($username, $limit);
            if (!sizeof($tweets)) {
                return;
            }
            foreach ($tweets as $tweet) {
                $return_html .= '<div class="tweet_item">';
                $return_html .= '<div class="tweet_image"><img src="' . $tweet->user->profile_image_url . '" width="58" height="58" alt="" /></div>';
                if (isset($tweet->text)) {
                    $return_html .= '<div class="tweet_text"><div class="inner">' . $tweet->text . '</div></div>';
                }
                $return_html .= '<div class="clear"></div></div>';
            }
            echo $return_html;
        }
        ?>

    <?php 
        echo $after_widget;
        ?>



    <?php 
    }
Ejemplo n.º 5
0
/**
 * Twitter
 * 
 * To override this shortcode in a child theme, copy this file to your child theme's
 * theme_config/extensions/shortcodes/shortcodes/ folder.
 * 
 * Optional arguments:
 * items: 5
 * username:
 * title:
 * post_date:
 */
function tfuse_twitter($atts, $content = null)
{
    extract(shortcode_atts(array('items' => 5, 'username' => '', 'title' => '', 'position' => '', 'post_date' => '', 'style' => ''), $atts));
    $return_html = '';
    if (!empty($username)) {
        $tweets = tfuse_get_tweets($username, $items);
        if (!sizeof($tweets)) {
            return;
        }
        if ($style == 'style1') {
            $return_html .= '<div class="widget twitter">';
            if (!empty($title)) {
                $return_html . '<h2>' . $title . '</h2> ';
            }
            $return_html .= '<ul>';
            foreach ($tweets as $tweet) {
                if (isset($tweet->text)) {
                    $return_html .= '<li>' . $tweet->text . '</li>';
                }
            }
            $return_html .= '</ul></div>';
        } else {
            $return_html .= '<div class="widget widget_twitter">
                                <h3 class="widget-title">' . $title . '</h3>

                                <div class="tweet_list">';
            foreach ($tweets as $tweet) {
                $return_html .= '<div class="tweet_item">';
                $return_html .= '<div class="tweet_image"><img src="' . $tweet->user->profile_image_url . '" width="30" height="30" alt="" /></div>';
                if (isset($tweet->text)) {
                    $return_html .= '<div class="tweet_text">
                                            <div class="inner">
                                                ' . $tweet->text . '
                                                </div>
                                            </div>';
                }
                $return_html .= '</div>';
            }
            $return_html .= '</div>
                            </div>';
        }
    }
    return $return_html;
}
Ejemplo n.º 6
0
/**
 * Twitter
 *
 * To override this shortcode in a child theme, copy this file to your child theme's
 * theme_config/extensions/shortcodes/shortcodes/ folder.
 *
 * Optional arguments:
 * items: 5
 * username:
 * title:
 * post_date:
 */
function tfuse_twitter($atts, $content = null)
{
    extract(shortcode_atts(array('items' => 5, 'username' => '', 'title' => '', 'post_date' => ''), $atts));
    $return_html = '';
    if (!empty($username)) {
        $tweets = tfuse_get_tweets($username, $items);
        $return_html .= '<div class="twitter">';
        if (!empty($title)) {
            $return_html .= '<h2>' . tfuse_qtranslate($title) . '</h2><ul>';
        }
        foreach ($tweets as $tweet) {
            if (isset($tweet->text)) {
                $return_html .= '<li>' . $tweet->text . '</li>';
            }
        }
        $return_html .= '</ul></div>';
    }
    return $return_html;
}
Ejemplo n.º 7
0
/**
 * Twitter
 * 
 * To override this shortcode in a child theme, copy this file to your child theme's
 * theme_config/extensions/shortcodes/shortcodes/ folder.
 * 
 * Optional arguments:
 * items: 5
 * username:
 * title:
 * post_date:
 */
function tfuse_footer_tweet($atts, $content = null)
{
    extract(shortcode_atts(array('username' => '', 'title' => '', 'post_date' => ''), $atts));
    $return_html = '';
    if (!empty($username)) {
        $tweets = tfuse_get_tweets($username, 1);
        if (!sizeof($tweets)) {
            return;
        }
        $return_html .= '<div class="col-lg-4  col-md-4 col-sm-6 col-xs-6">' . '<div class="widget widget_twitter">';
        if (!empty($title)) {
            $return_html .= '<h3 class="widget-title">' . $title . '</h3> ';
        }
        $return_html .= '<div class="tweet_list">';
        foreach ($tweets as $tweet) {
            if (isset($tweet->text)) {
                $return_html .= '<div class="tweet_item">
                                    <div class="tweet_image">
                                    </div>
                                    <div class="tweet_text">
                                          <div class="inner">
                                              ' . $tweet->text . '
                                              <div class="meta-tweet">
                                                    <i class="icon-twitter-sign"></i>
                                                    <span class="tweet-time">' . $tweet->created_at . '</span>
                                                    <span class="tweet-author">' . __('By', 'tfuse') . ': <a href="' . $tweet->user->url . '">@' . $tweet->user->name . '</a></span>
                                              </div>
                                          </div>
                                    </div>
                              </div>';
            }
        }
        $return_html .= '</div></div></div>';
    }
    return $return_html;
}