• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP time_since函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中time_since函数的典型用法代码示例。如果您正苦于以下问题:PHP time_since函数的具体用法?PHP time_since怎么用?PHP time_since使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了time_since函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: action_browse

    /**
     * Display the mail queue...
     *
     * @uses ManageMail template
     */
    public function action_browse()
    {
        global $scripturl, $context, $txt;
        require_once SUBSDIR . '/Mail.subs.php';
        loadTemplate('ManageMail');
        // First, are we deleting something from the queue?
        if (isset($_REQUEST['delete'])) {
            checkSession('post');
            deleteMailQueueItems($_REQUEST['delete']);
        }
        // Fetch the number of items in the current queue
        $status = list_MailQueueStatus();
        $context['oldest_mail'] = empty($status['mailOldest']) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $status['mailOldest']);
        $context['mail_queue_size'] = comma_format($status['mailQueueSize']);
        // Build our display list
        $listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', '
							return Util::shorten_text(Util::htmlspecialchars($rowData[\'subject\'], 50));
						')), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true))), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', '
							global $txt;

							// We probably have a text label with your priority.
							$txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']);

							// But if not, revert to priority 0.
							return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\'];
						'), 'class' => 'centertext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', '
							return time_since(time() - $rowData[\'time_sent\']);
						')), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', '
							return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\';
						')))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'bottom_of_list', 'class' => 'submitbutton', 'value' => '
						<input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="right_submit" />
						<a class="linkbutton" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> ')));
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
    }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:40,代码来源:ManageMail.controller.php


示例2: c_twhois

function c_twhois($input)
{
    if ($input == "") {
        $output = "Which user do you want to check?\r<strong>twhois username</strong>";
    } else {
        $url = "http://twitter.com/status/user_timeline/" . htmlentities($input) . ".json?count=10";
        $rawdata = _feeder($url, null, true);
        $data = json_decode($rawdata, true);
        if (isset($data[0]["user"]["id"])) {
            $output = "";
            if ($input == $data[0]["user"]["name"]) {
                $output .= "<strong>" . $input . "</strong> hasn't provided a real name.\r";
            } else {
                $output .= "<strong>" . $input . "</strong> is really <strong>" . $data[0]["user"]["name"] . "</strong>. \r";
            }
            //.$data[0]["user"]["description"].".\r";
            $output .= "They are Twitter user number <strong>" . $data[0]["user"]["id"] . "</strong>, and have been a Twitter user for <strong>" . time_since(strtotime($data[0]["user"]["created_at"])) . "</strong>.\r";
            $output .= "They have <strong>" . $data[0]["user"]["friends_count"] . "</strong> friends, and <strong>";
            $output .= $data[0]["user"]["followers_count"] . "</strong> followers.\r";
            $output .= "They have tweeted <strong>" . $data[0]["user"]["statuses_count"] . "</strong> times.\r";
            if ($data[0]["user"]["location"] != "") {
                $output .= "They are based in <strong>" . $data[0]["user"]["location"] . "</strong>.";
            } else {
                $output .= "Not sure where they are in the world.";
            }
        } else {
            $output = "Dunno, sorry.";
        }
    }
    return $output;
}
开发者ID:richardhodgson,项目名称:console,代码行数:31,代码来源:twhois.php


示例3: componentStatus

function componentStatus()
{
    $data = json_decode(file_get_contents('http://bigcommerce.statuspage.io/index.json'));
    $compontent_statuses = [];
    foreach ($data->components as $component) {
        $component_status = ['name' => $component->name, 'status' => ucwords($component->status), 'last_updated' => time_since($component->updated_at)];
        $component_statuses[] = $component_status;
    }
    return $component_statuses;
}
开发者ID:Zetaphor,项目名称:brokecommerce,代码行数:10,代码来源:get_component_status.php


示例4: fauna_trackback

function fauna_trackback($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
	<? if ($comment->comment_type == "trackback" || $comment->comment_type == "pingback") { ?>

<? if (!$runonce) { $runonce = true; ?>
<h2 id="trackbacks"><?php 
    _e('Trackbacks &amp; Pingbacks');
    ?>
</h2>
<? } ?>

	<li><a name="comment-<?php 
    comment_ID();
    ?>
" href="<? echo($comment->comment_author_url); ?>" title="Visit <? echo($comment->comment_author); ?>">
		<? if (function_exists('comment_favicon')) { comment_favicon($before='<img src="', $after='" alt="" class="trackback-avatar" />'); }; ?>
		<strong><u><? echo($comment->comment_author); ?></u></strong>
		<small>
		<?php 
    comment_type(__('commented'), __('trackbacked'), __('pingbacked'));
    ?>
 <?php 
    _e('on');
    ?>
 
		<?php 
    if (function_exists('time_since')) {
        echo time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time()) . " ago";
    } else {
        ?>
		<?php 
        comment_date();
        ?>
, <?php 
        comment_time();
    }
    ?>
		</small>
		<?php 
    /* Trackback body text is disabled by default. To enable it, remove lines 22 and 24 of this file.
    		comment_text()
    		*/
    ?>
		</a>
	</li>
	<?php 
    edit_comment_link(__("<li>Edit This</li>"));
    ?>
	<? } ?>
<?php 
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:53,代码来源:template-trackbacks.php


示例5: k2_entry_date

 function k2_entry_date()
 {
     global $post;
     $output = '<abbr class="published entry-date" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">';
     if (function_exists('time_since')) {
         $output .= sprintf(__('%s ago', 'k2_domain'), time_since(abs(strtotime($post->post_date_gmt . ' GMT')), time()));
     } else {
         $output .= get_the_time(get_option('date_format'));
     }
     $output .= '</abbr>';
     return $output;
 }
开发者ID:JeffLuckett,项目名称:quickref,代码行数:12,代码来源:pluggable.php


示例6: fauna_comment

function fauna_comment($comment, $args, $depth) {
	$GLOBALS['comment'] = $comment;
	
	if ($comment->comment_type != "trackback" && $comment->comment_type != "pingback") {
		if($odd == $bgcolor) { $bgcolor = $even; } else { $bgcolor = $odd; }

		/* Assign .comment-author CSS class to weblog administrator */
		$is_author = false;
		if($comment->comment_author_email == get_settings(admin_email)) {
			$is_author = true;
		}
		?>	
	
		<li id="comment-<?php comment_ID() ?>" <?php if ($is_author == true) { $class .= ' '.$author; } else { $class .= ' '.$bgcolor; }?> <?php post_class($class); ?>>
			<div class="comment-body">
				<div class="comment-header">
					<?php if (function_exists('comment_favicon')) { ?><a href="<? echo($comment->comment_author_url); ?>" title="Visit <? echo($comment->comment_author); ?>"><? comment_favicon($before='<img src="', $after='" alt="" class="comment-avatar" />'); ?></a><?php } ?>
						<?php echo get_avatar( $comment, 48 ); ?>
						<em><a href="#comment-<? echo($comment->comment_ID) ?>" title="<?php _e('Permanent link to this comment') ?>"><? echo($comment_number) ?></a></em>
						<strong><? comment_author_link(); ?></strong> 
						<?php if ( function_exists(comment_subscription_status) ) { if (comment_subscription_status()) { ?><?php _e('(subscribed to comments)') ?><? }} ?>
						<?php _e('says:') ?>
						<?php if ($comment->comment_approved == '0') : ?>
							<small><?php _e('Your comment is awaiting moderation. This is just a spam counter-measure, and will only happen the first time you post here. Your comment will be approved as soon as possible.') ?></small>
						<?php endif; ?>
				</div>
				<?php comment_text() ?>
				<?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ')) ?>
				<small>
					<?php _e('Posted') ?> 
					<?php 
					if (function_exists('time_since')) {
						echo time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time()) . " ago";
					} else { ?>
						<?php comment_date(); ?>, <?php comment_time(); } ?> 
					<? } ?>
					<?php edit_comment_link(__("Edit This"), ' | '); ?>
				</small>
		</div>
	</li> 
	<?php
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:42,代码来源:template-comments.php


示例7: local_time

/**
* Local Time
*
*
* @copyright Electric Function, Inc.
* @package Hero Framework
* @author Electric Function, Inc.
*/
function local_time($time, $format = FALSE)
{
    if ($time == '0000-00-00 00:00:00' or $time == '0000-00-00') {
        return 'n/a';
    }
    $time = strtotime($time);
    // see if we should return something like "X minutes ago"
    $time_since = time_since($time);
    if (!empty($time_since) and setting('use_time_since') == '1' and $format == FALSE) {
        return $time_since;
    } else {
        if ($format == FALSE) {
            // return in the default date format
            return date(setting('date_format'), $time);
        } else {
            // return in specified format
            return date($format, $time);
        }
    }
}
开发者ID:Rotron,项目名称:hero,代码行数:28,代码来源:local_time_helper.php


示例8: dashboard

function dashboard()
{
    $idtoken = _VERSION_ . "-" . md5($_SERVER["HTTP_HOST"]);
    $magpieCacheAge = 60 * 60 * 24;
    if (function_exists('apache_request_headers')) {
        $hdrs = apache_request_headers();
        if (isset($hdrs['Pragma']) && $hdrs['Pragma'] == 'no-cache' || isset($hdrs['Cache-Control']) && $hdrs['Cache-Control'] == 'no-cache') {
            $magpieCacheAge = 0;
        }
    }
    define('MAGPIE_FETCH_TIME_OUT', 2);
    define('MAGPIE_CACHE_AGE', $magpieCacheAge);
    $rs = rss_query("select id, title, position, url, obj, unix_timestamp(daterefreshed), itemcount " . " from " . getTable('dashboard') . " order by position asc");
    $rss = array();
    while (list($id, $title, $pos, $url, $obj, $ts, $cnt) = rss_fetch_row($rs)) {
        if ($obj && time() - $ts < $magpieCacheAge) {
            $rss[$title] = unserialize($obj);
        } else {
            $old_level = error_reporting(E_ERROR);
            $rss[$title] = fetch_rss($url . $idtoken);
            error_reporting($old_level);
            if ($rss[$title] && is_object($rss[$title])) {
                $rss[$title]->items = array_slice($rss[$title]->items, 0, $cnt);
                rss_query('update ' . getTable('dashboard') . " set obj='" . rss_real_escape_string(serialize($rss[$title])) . "', " . " daterefreshed=now()\twhere id={$id}");
            }
        }
        if ($rss[$title] && is_object($rss[$title])) {
            if ($pos == 0) {
                echo "\n\t\t\t\t\t\t\t<h2 style=\"margin-bottom: 0.5em\">{$title}</h2>\n\t\t\t\t\t\t\t<div id=\"db_main\">\n\t\t\t\t\t\t\t<ul>";
                foreach ($rss[$title]->items as $item) {
                    echo "<li class=\"item unread\">\n" . "<h4><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></h4>\n" . "<h5>Posted: " . time_since(strtotime($item['pubdate'])) . " ago </h5>\n" . "<div class=\"content\">" . $item['content']['encoded'] . "</div>\n</li>\n";
                }
                echo "</ul></div>\n";
            } else {
                echo "<div class=\"frame db_side\">\n";
                db_side($title, $rss[$title]);
                echo "</div>";
            }
        }
    }
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:41,代码来源:dashboard.php


示例9: BrowseMailQueue

/**
 * Display the mail queue...
 */
function BrowseMailQueue()
{
    global $scripturl, $context, $modSettings, $txt, $smcFunc;
    global $sourcedir;
    // First, are we deleting something from the queue?
    if (isset($_REQUEST['delete'])) {
        checkSession('post');
        $smcFunc['db_query']('', '
			DELETE FROM {db_prefix}mail_queue
			WHERE id_mail IN ({array_int:mail_ids})', array('mail_ids' => $_REQUEST['delete']));
    }
    // How many items do we have?
    $request = $smcFunc['db_query']('', '
		SELECT COUNT(*) AS queue_size, MIN(time_sent) AS oldest
		FROM {db_prefix}mail_queue', array());
    list($mailQueueSize, $mailOldest) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    $context['oldest_mail'] = empty($mailOldest) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $mailOldest);
    $context['mail_queue_size'] = comma_format($mailQueueSize);
    $listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', '
						global $smcFunc;
						return $smcFunc[\'strlen\']($rowData[\'subject\']) > 50 ? sprintf(\'%1$s...\', htmlspecialchars($smcFunc[\'substr\']($rowData[\'subject\'], 0, 47))) : htmlspecialchars($rowData[\'subject\']);
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true)), 'class' => 'smalltext'), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority']), 'data' => array('function' => create_function('$rowData', '
						global $txt;

						// We probably have a text label with your priority.
						$txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']);

						// But if not, revert to priority 0.
						return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\'];
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', '
						return time_since(time() - $rowData[\'time_sent\']);
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', '
						return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\';
					'), 'class' => 'smalltext'))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="button_submit" /><a class="button_link" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> ')));
    require_once $sourcedir . '/Subs-List.php';
    createList($listOptions);
    loadTemplate('ManageMail');
    $context['sub_template'] = 'browse';
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:43,代码来源:ManageMail.php


示例10: getTimeAgo

	public function getTimeAgo(){		//retorna a data em tanto tempo atras
		global $CONF;
		$this->_check_get();
		require_once('tool/utility.php');
		return time_since($this->unixdate);
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:6,代码来源:User.php


示例11: isset

$template->set_filenames(array('picture_modify' => 'picture_modify.tpl'));
$admin_url_start = $admin_photo_base_url . '-properties';
$admin_url_start .= isset($_GET['cat_id']) ? '&amp;cat_id=' . $_GET['cat_id'] : '';
$src_image = new SrcImage($row);
$template->assign(array('tag_selection' => $tag_selection, 'U_SYNC' => $admin_url_start . '&amp;sync_metadata=1', 'U_DELETE' => $admin_url_start . '&amp;delete=1&amp;pwg_token=' . get_pwg_token(), 'PATH' => $row['path'], 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image), 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 'NAME' => isset($_POST['name']) ? stripslashes($_POST['name']) : @$row['name'], 'TITLE' => render_element_name($row), 'DIMENSIONS' => @$row['width'] . ' * ' . @$row['height'], 'FILESIZE' => @$row['filesize'] . ' KB', 'REGISTRATION_DATE' => format_date($row['date_available']), 'AUTHOR' => htmlspecialchars(isset($_POST['author']) ? stripslashes($_POST['author']) : @$row['author']), 'DATE_CREATION' => $row['date_creation'], 'DESCRIPTION' => htmlspecialchars(isset($_POST['description']) ? stripslashes($_POST['description']) : @$row['comment']), 'F_ACTION' => get_root_url() . 'admin.php' . get_query_string_diff(array('sync_metadata'))));
$added_by = 'N/A';
$query = '
SELECT ' . $conf['user_fields']['username'] . ' AS username
  FROM ' . USERS_TABLE . '
  WHERE ' . $conf['user_fields']['id'] . ' = ' . $row['added_by'] . '
;';
$result = pwg_query($query);
while ($user_row = pwg_db_fetch_assoc($result)) {
    $row['added_by'] = $user_row['username'];
}
$intro_vars = array('file' => l10n('Original file : %s', $row['file']), 'add_date' => l10n('Posted %s on %s', time_since($row['date_available'], 'year'), format_date($row['date_available'], array('day', 'month', 'year'))), 'added_by' => l10n('Added by %s', $row['added_by']), 'size' => $row['width'] . '&times;' . $row['height'] . ' pixels, ' . sprintf('%.2f', $row['filesize'] / 1024) . 'MB', 'stats' => l10n('Visited %d times', $row['hit']), 'id' => l10n('Numeric identifier : %d', $row['id']));
if ($conf['rate'] and !empty($row['rating_score'])) {
    $query = '
SELECT
    COUNT(*)
  FROM ' . RATE_TABLE . '
  WHERE element_id = ' . $_GET['image_id'] . '
;';
    list($row['nb_rates']) = pwg_db_fetch_row(pwg_query($query));
    $intro_vars['stats'] .= ', ' . sprintf(l10n('Rated %d times, score : %.2f'), $row['nb_rates'], $row['rating_score']);
}
$query = '
SELECT *
  FROM ' . IMAGE_FORMAT_TABLE . '
  WHERE image_id = ' . $row['id'] . '
;';
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:picture_modify.php


示例12: list

                 list($tpl_var['w'], $tpl_var['h']) = $params->sizing->ideal_size;
                 if (($tpl_var['crop'] = round(100 * $params->sizing->max_crop)) > 0) {
                     list($tpl_var['minw'], $tpl_var['minh']) = $params->sizing->min_size;
                 } else {
                     $tpl_var['minw'] = $tpl_var['minh'] = "";
                 }
                 $tpl_var['sharpen'] = $params->sharpen;
             }
             $tpl_vars[$type] = $tpl_var;
         }
         $template->assign('derivatives', $tpl_vars);
         $template->assign('resize_quality', ImageStdParams::$quality);
         $tpl_vars = array();
         $now = time();
         foreach (ImageStdParams::$custom as $custom => $time) {
             $tpl_vars[$custom] = $now - $time <= 24 * 3600 ? l10n('today') : time_since($time, 'day');
         }
         $template->assign('custom_derivatives', $tpl_vars);
     }
     break;
 case 'watermark':
     $watermark_files = array();
     foreach (glob(PHPWG_ROOT_PATH . 'themes/default/watermarks/*.png') as $file) {
         $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH));
     }
     if (($glob = glob(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'watermarks/*.png')) !== false) {
         foreach ($glob as $file) {
             $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH));
         }
     }
     $watermark_filemap = array('' => '---');
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:configuration.php


示例13: returnPost

function returnPost($username, $postnum, $set)
{
    $query = "SELECT * FROM posts WHERE username = '{$username}' AND postnum ='{$postnum}'";
    $result = mysql_query($query);
    $num = mysql_numrows($result);
    if ($num > 0) {
        $username = mysql_result($result, 0, "username");
        $postnum = mysql_result($result, 0, "postnum");
        $description = mysql_result($result, 0, "description");
        $time = mysql_result($result, 0, "time");
    }
    $resultdiff = mysql_query("SELECT TIMESTAMPDIFF(SECOND,'{$time}',CURRENT_TIMESTAMP)");
    $row = mysql_fetch_array($resultdiff);
    $ago = $row["TIMESTAMPDIFF(SECOND,'{$time}',CURRENT_TIMESTAMP)"];
    $timesince = time_since($ago);
    $jsonpost['username'] = array();
    $jsonpost['postnum'] = array();
    $jsonpost['description'] = array();
    $jsonpost['ago'] = array();
    $jsonpost['set'] = array();
    array_push($jsonpost['username'], $username);
    array_push($jsonpost['postnum'], $postnum);
    array_push($jsonpost['description'], $description);
    array_push($jsonpost['ago'], $timesince);
    array_push($jsonpost['set'], $set);
    return $jsonpost;
}
开发者ID:antegra17,项目名称:Coding-Samples,代码行数:27,代码来源:functions.php


示例14: while

    //  $print .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
    //  }
    //  }
    return $print;
}
while ($row = mysql_fetch_array($result)) {
    // variables from table
    $postid = $row['public_postid'];
    $post_title = $row['post_title'];
    $post_date = $row['post_date'];
    $post_id = $row['postid'];
    $post_syntax = $row['post_syntax'];
    $ps = "[{$post_syntax}]";
    $syntax = $post_syntax;
    if ($post_syntax = "") {
        $post_syntax = null;
    }
    $post_hits = $row['post_hits'];
    if (empty($post_hits)) {
        $post_hits = "0";
        $count = substr_count($post_text, "\n");
    }
    $my_time = strtotime($post_date);
    $postdate = time_since($my_time);
    echo "<i class='icon-file'><img src='http://icons.iconarchive.com/icons/semlabs/web-blog/48/post-remove-icon.png' height='20' width='20'>&nbsp; &nbsp;<a href='{$post_id}'> </i>{$post_title}</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<small>{$postdate} ago</small>";
    echo "<br>";
    echo "<i><span id='status' class='unreviewed'>&nbsp; &nbsp;<small> viewed <b>{$post_hits}</b> times</small></span></class></span><br><br>";
}
if (empty($postid)) {
    echo "<i><span id='status' class='unreviewed'>&nbsp; &nbsp;&nbsp;&nbsp;<large><font color='black'><i>No recent paste</font></large></span></class></span><br><br>";
}
开发者ID:jeremystevens,项目名称:phpbin,代码行数:31,代码来源:recent.php


示例15: the_ID

                    ?>
		<div id="post-<?php 
                    the_ID();
                    ?>
" class="<?php 
                    redo_post_class($post_index++, $post_asides);
                    ?>
 <?php 
                    if (is_home() and $redo_asidescategory != 0) {
                        echo 'rightmargin';
                    }
                    ?>
 ">
			<div class="entry-head">
				<?php 
                    printf(__('%1$s', 'redo_domain'), '<div class="published_sm" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . (function_exists('time_since') ? sprintf(__('%s ago', 'redo_domain'), time_since(abs(strtotime($post->post_date_gmt . " GMT")), time())) : '<div class="day">' . get_the_time(__('d', 'redo_domain')) . '</div><div class="month">' . get_the_time(__('M', 'redo_domain')) . '</div>') . '</div>');
                    ?>
				
				
				<h3 class="entry-title"><a href="<?php 
                    the_permalink();
                    ?>
" rel="bookmark" title='<?php 
                    printf(__('Permanent Link to "%s"', 'redo_domain'), wp_specialchars(get_the_title(), 1));
                    ?>
'><?php 
                    the_title();
                    ?>
</a></h3>
				<?php 
                    /* Edit Link */
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:searchloop.php


示例16: ec3_get_events

/** Template function. Call this from your template to insert a list of
 *  forthcoming events. Available template variables are:
 *   - template_month: %MONTH%
 *   - template_day: %MONTH% %DATE% %SINCE% (only with Time Since plugin)
 *   - template_event: %DATE% %TIME% %LINK% %TITLE% %AUTHOR%
 */
function ec3_get_events($limit, $template_event = '<a href="%LINK%">%TITLE% (%TIME%)</a>', $template_day = '%DATE%:', $date_format = 'j F', $template_month = '', $month_format = 'F Y')
{
    global $ec3, $wpdb, $tableposts, $tablepost2cat, $tableusers, $wp_version;
    if (!$date_format) {
        $date_format = get_settings('date_format');
    }
    // Support older versions of Wordpress.
    if (ereg('^1[.]', $wp_version)) {
        $user_nicename = 'user_nickname';
    } else {
        $user_nicename = 'user_nicename';
    }
    // Start at midnight to show all of today's events
    $now = gmdate('Y-m-d 00:00:00');
    $calendar_entries = $wpdb->get_results("SELECT\r\n         p.id AS id,\r\n         post_title,\r\n         post_date,\r\n         u.{$user_nicename} AS author\r\n       FROM {$tableposts} p, {$tablepost2cat} p2c, {$tableusers} u\r\n       WHERE post_status = 'publish'\r\n         AND post_date_gmt > '{$now}'\r\n         AND p.id = post_id\r\n         AND p.post_author = u.id\r\n         AND category_id = {$ec3->event_category}\r\n       ORDER BY post_date\r\n       LIMIT {$limit}");
    echo "<ul class='event_list'>";
    echo "<!-- Generated by Event Calendar v{$ec3->version} -->\n";
    if (count($calendar_entries)) {
        $time_format = get_settings('time_format');
        $current_date = false;
        $current_month = false;
        $data = array();
        $time_now = time() + 60 * 60 * get_settings("gmt_offset");
        foreach ($calendar_entries as $entry) {
            $data['MONTH'] = mysql2date($month_format, $entry->post_date);
            if ((!$current_month || $current_month != $data['MONTH']) && $template_month) {
                if ($current_month) {
                    echo "</ul></li>\n";
                }
                echo "<li class='event_list_month'>" . ec3_format_str($template_month, $data) . "\n<ul>\n";
                $current_month = $data['MONTH'];
            }
            // To use %SINCE%, you need Dunstan's 'Time Since' plugin.
            if (function_exists('time_since')) {
                $data['SINCE'] = time_since($time_now, abs(strtotime($entry->post_date)));
            }
            $data['DATE'] = mysql2date($date_format, $entry->post_date);
            if ((!$current_date || $current_date != $data['DATE']) && $template_day) {
                if ($current_month || $current_date) {
                    echo "</ul></li>\n";
                }
                echo "<li class='event_list_day'>" . ec3_format_str($template_day, $data) . "\n<ul>\n";
                $current_date = $data['DATE'];
            }
            $data['TIME'] = mysql2date($time_format, $entry->post_date);
            $data['TITLE'] = $entry->post_title;
            $data['LINK'] = get_permalink($entry->id);
            $data['AUTHOR'] = $entry->author;
            echo " <li>" . ec3_format_str($template_event, $data) . "</li>\n";
        }
        if ($template_day || $template_month) {
            echo "</ul></li>\n";
        }
    } else {
        echo "<li>" . __('No events.', 'ec3') . "</li>\n";
    }
    echo "</ul>\n";
}
开发者ID:jbogota,项目名称:blog-king,代码行数:64,代码来源:eventcalendar3.php


示例17: getUpdateTimeAgo

	public function getUpdateTimeAgo(){		//retorna a data em tanto tempo atras
		if ($this->unixupdatetime==null) return null;
		global $CONF;
		$this->_check_get();
		require_once('tool/utility.php');
		return time_since($this->unixupdatetime);
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:7,代码来源:Topic.php


示例18: wpi_get_relative_date

function wpi_get_relative_date($timestamp)
{
    if (wpi_user_func_exists('time_since')) {
        $date = abs(strtotime($timestamp) - 60 * 120);
        return time_since($date) . ' ' . __('ago', WPI_META);
    } else {
        return $timestamp;
    }
}
开发者ID:Creativebq,项目名称:wp-istalker,代码行数:9,代码来源:formatting.php


示例19: time_since

</p>
                    <div class="social__slider--feed__meta">
                      <a href="https://twitter.com/intent/favorite?tweet_id=<?php 
                echo $item->id;
                ?>
"><i class="fa fa-star"></i></a>
                      <a href="https://twitter.com/intent/retweet?tweet_id=<?php 
                echo $item->id;
                ?>
"><i class="fa fa-retweet"></i></a>
                      <a href="https://twitter.com/intent/tweet?in-reply-to=<?php 
                echo $item->id;
                ?>
"><i class="fa fa-reply"></i></a>
                      <?php 
                echo time_since(strtotime($item->created_at));
                ?>
                    </div>
                  </div>
                </div>
              </li>
            <?php 
            }
            ?>
          <?php 
        }
        ?>
        <?php 
    }
    ?>
      <?php 
开发者ID:jhu-hsa,项目名称:jhu-hsa-theme,代码行数:31,代码来源:template-home.php


示例20: the_permalink

						<h3 class="entry-title"><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title='<?php 
        printf(__('Permanent Link to "%s"', 'k2_domain'), wp_specialchars(strip_tags(the_title('', '', false)), 1));
        ?>
'><?php 
        the_title();
        ?>
</a></h3>

						<div class="entry-meta">
							<span class="chronodata">
								<?php 
        /* Date & Author */
        printf(__('Published %1$s %2$s', 'k2_domain'), $multiple_users ? sprintf(__('by %s', 'k2_domain'), '<span class="vcard author"><a href="' . get_author_posts_url(get_the_author_ID()) . '" class="url fn" title="' . sprintf(__('View all posts by %s', 'k2_domain'), attribute_escape(get_the_author())) . '">' . get_the_author() . '</a></span>') : '', '<abbr class="published" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . (function_exists('time_since') ? sprintf(__('%s ago', 'k2_domain'), time_since(abs(strtotime($post->post_date_gmt . " GMT")), time())) : get_the_time($dateformat)) . '</abbr>');
        ?>
							</span>
						</div>
					</div> <!-- .entry-head -->

					<div class="entry-content">
						<p class="<?php 
        echo $classname;
        ?>
"><?php 
        echo $attachment_link;
        ?>
<br /><?php 
        echo basename($post->guid);
        ?>
开发者ID:64kbytes,项目名称:stayinba,代码行数:31,代码来源:attachment.php



注:本文中的time_since函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP time_sleep_until函数代码示例发布时间:2022-05-23
下一篇:
PHP time_nanosleep函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap