本文整理匯總了PHP中CASHSystem::formatAgo方法的典型用法代碼示例。如果您正苦於以下問題:PHP CASHSystem::formatAgo方法的具體用法?PHP CASHSystem::formatAgo怎麽用?PHP CASHSystem::formatAgo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CASHSystem
的用法示例。
在下文中一共展示了CASHSystem::formatAgo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepMarkup
public function prepMarkup($tweet) {
$tmp_profile_img = $tweet->user->profile_image_url;
if ($tmp_profile_img == 'http://static.twitter.com/images/default_profile_normal.png') {
$tmp_profile_img = 'http://a2.twimg.com/sticky/default_profile_images/default_profile_' . rand(0, 6) . '_normal.png';
}
$innermarkup = "<div class=\"cashmusic_social cashmusic_twitter\"><img src=\"$tmp_profile_img\" class=\"cashmusic_twitter_avatar\" alt=\"avatar\" />"
. "<div class=\"cashmusic_twitter_namespc\"><a href=\"http://twitter.com/" . $tweet->user->screen_name . "\">@" . $tweet->user->screen_name . "</a><br />" . $tweet->user->name . "</div><div class=\"cashmusic_clearall\">.</div>"
. "<div class=\"tweet\">" . $tweet->text . '<div class="cashmusic_social_date"><a href="http://twitter.com/#!/' . $tweet->user->screen_name . '/status/' . $tweet->id_str . '" target="_blank">' . CASHSystem::formatAgo($tweet->created_at) . ' / twitter</a> </div></div>';
/*
The CSS to go along with the twitter markup:
From our stuff up on http://marketairglovamusic.com/
.cashmusic_social {margin:10px 0 20px 0;padding:15px;background-color:#fff;border-top-left-radius:5px 5px;border-top-right-radius:5px 5px;border-bottom-right-radius:5px 5px;border-bottom-left-radius:5px 5px;}
.cashmusic_social a {color:#cdcdcd;}
.cashmusic_twitter {font:14.5px/1.75em georgia,'times new roman',times,serif;}
.cashmusic_twitter_avatar {float:left;margin:1px 8px 8px 0;}
.cashmusic_twitter_namespc {color:#cdcdcd;font:11px/1.5em helvetica,"helvetica neue",arial,sans-serif;}
.cashmusic_twitter_namespc a {color:#007e3d;font:bold 15px/1.85em helvetica,"helvetica neue",arial,sans-serif;}
.cashmusic_twitter a {color:#007e3d;}
.cashmusic_tumblr h2, .cashmusic_tumblr h2 a, #topmenu * a, h2 {color:#111;font:28px/1em 'IM Fell English',georgia,'times new roman',times,serif;}
.cashmusic_social_date {margin-top:10px;color:#cdcdcd;font:11px/1.75em helvetica,"helvetica neue",arial,sans-serif;}
.cashmusic_clearall {clear:both;height:1px;overflow:hidden;visibility:hidden;}
*/
}
示例2: prepMarkup
public function prepMarkup($post) {
if ($post->type == 'regular') {
$textbody = '';
$textbodyarray = explode('.',strip_tags($post->{'regular-body'}));
if (count($textbodyarray) > 3) {
$textbodyarray = array_slice($textbodyarray,0,3);
}
$textbody = implode('.',$textbodyarray) . '...';
$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
. '<h2><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . $post->{$post->type . '-title'} . '</a></h2><div>' . $textbody . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
} else if ($post->type == 'photo') {
$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
. '<div><img src="' . $post->{'photo-url-500'} . '" width="100%" alt="" /><br />' . $post->{'photo-caption'} . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
} else if ($post->type == 'video') {
$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
. '<div><div class="cashmusic_social_video_container">' . $post->{'video-player'} . '</div><br />' . $post->{'video-caption'} . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
}
/*
The CSS to go along with the video container:
Thanks to http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
echo '<style type="text/css">';
echo '.cashmusic_video_container {position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}';
echo '.cashmusic_video_container iframe, .cashmusic_video_container object, .cashmusic_video_container embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
echo '</style>';
*/
}