Пример #1
0
function aktt_shortcode_tweet($args)
{
    if (!AKTT::$enabled) {
        return '';
    }
    if ($account = AKTT::default_account()) {
        $username = $account->social_acct->name();
    } else {
        // no accounts, get out
        return '';
    }
    $args = shortcode_atts(array('account' => $username, 'id' => null), $args);
    // if we have an ID, only search by that
    if (!empty($args['id'])) {
        unset($args['account']);
    }
    $args['count'] = 1;
    $tweets = AKTT::get_tweets($args);
    if (count($tweets) != 1) {
        return '';
    }
    $tweet = $tweets[0];
    ob_start();
    include AKTT_PATH . '/views/tweet.php';
    return ob_get_clean();
}
Пример #2
0
 function widget($args, $instance)
 {
     extract($args);
     $username = $instance['account'];
     $tweets = AKTT::get_tweets($instance);
     echo $before_widget . $before_title . $instance['title'] . $after_title;
     include AKTT_PATH . 'views/widget.php';
     echo $after_widget;
 }