コード例 #1
0
ファイル: functions.php プロジェクト: bunmun/git-basics
function parseJSON($feedURL)
{
    global $twitterJSON;
    $json_a = json_decode($twitterJSON, true);
    for ($i = 0; $i <= 2; $i++) {
        echo "<br />" . $json_a[$i][user]['name'];
        echo "<br />" . $json_a[$i]['text'];
        $tweettime = $json_a[$i]['created_at'];
        $tweetURL = $json_a[$i]['id_str'];
        $tweetLink = $json_a[$i][entities]['urls']['url'];
        $datetime = new DateTime($tweettime);
        $Tweet_timestamp = $datetime->format('U');
        echo "<br />Posted: " . howLongAgo($Tweet_timestamp);
        echo "<br />Link: <a href='http://twitter.com/bunmun/status/" . $tweetURL . "'>Link To Tweet</a>";
        echo "<br />";
    }
    //var_dump($json_a);
}
コード例 #2
0
ファイル: index.php プロジェクト: smajda/jon.smajda.com
		<title>Jon's Recent Activity</title>
</head>
<body>

<ul id="elsewhere">
<?php 
if ($success) {
    foreach ($feed->get_items() as $item) {
        if ($itemlimit == 15) {
            break;
        }
        $feedlink = $item->get_feed()->get_link();
        $link = $item->get_permalink();
        $source = get_source($item);
        $favicon = $item->get_feed()->get_favicon();
        $time = howLongAgo($item->get_date('U'));
        if ($source['name'] == 'Twitter') {
            $content = $item->get_content();
        } elseif ($source['name'] == 'Github') {
            $content = preg_replace('/^smajda /', '', $item->get_title());
        } else {
            $content = $item->get_title();
        }
        echo '<li class="' . $source['class'] . '">';
        echo '<span class="title">' . $content . '</span><br />';
        echo '<span class="meta">&rarr; <a href="' . $link . '">' . $time . ' on ' . $source["name"] . '</a></span>';
        echo "</li>\n";
        $itemlimit++;
    }
}
?>
コード例 #3
0
ファイル: functions.php プロジェクト: bunmun/git-basics
function parseJSON($feedURL)
{
    global $twitterJSON;
    global $feedItems;
    global $itemsByDate;
    $json_a = json_decode($twitterJSON, true);
    for ($i = 0; $i <= 2; $i++) {
        $tweettime = $json_a[$i]['created_at'];
        $tweetURL = $json_a[$i]['id_str'];
        $tweetLink = $json_a[$i][entities]['urls']['url'];
        $datetime = new DateTime($tweettime);
        $Tweet_timestamp = $datetime->format('U');
        $Tweet_text = $json_a[$i]['text'];
        /*$Tweet_linkified = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $Tweet_text);*/
        $itemFormat = "<div class='rssItem twitter'><div class='tweetContent'><p>" . $Tweet_text . "</p><div class='itemInfo'><span class='created_by'>" . $json_a[$i][user]['name'] . " </span><span class='posted'>posted " . howLongAgo($Tweet_timestamp) . "</span></div><span class='socialIcon'><a href='http://www.twitter.com/bunmun/status/{$tweetURL}'>t</a>​</span></div></div>";
        array_push($feedItems, $itemFormat);
        $itemsByDate[$Tweet_timestamp] = $itemFormat;
    }
    //var_dump($json_a);
}