本文整理汇总了PHP中Url::record方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::record方法的具体用法?PHP Url::record怎么用?PHP Url::record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::record方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($params)
{
$Log_Model = new Log_Model();
$options_cache = Option::getAll();
extract($options_cache);
$page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
$record = isset($params[1]) && $params[1] == 'record' ? intval($params[2]) : '';
$GLOBALS['record'] = $record;
//for sidebar calendar
$pageurl = '';
//page meta
$site_title = $record . ' - ' . $site_title;
if (preg_match("/^([\\d]{4})([\\d]{2})\$/", $record, $match)) {
$days = getMonthDayNum($match[2], $match[1]);
$record_stime = emStrtotime($record . '01');
$record_etime = $record_stime + 3600 * 24 * $days;
} else {
$record_stime = emStrtotime($record);
$record_etime = $record_stime + 3600 * 24;
}
$sqlSegment = "and date>={$record_stime} and date<{$record_etime} order by date desc";
$lognum = $Log_Model->getLogNum('n', $sqlSegment);
$total_pages = ceil($lognum / $index_lognum);
if ($page > $total_pages) {
$page = $total_pages;
}
$start_limit = ($page - 1) * $index_lognum;
$pageurl .= Url::record($record, 'page');
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl);
include View::getView('header');
include View::getView('log_list');
}
示例2: load
public function load($cid)
{
static $instances = array();
if (empty($cid)) {
return NULL;
}
if (!isset($instances[$cid])) {
// Check if this record exist or not
$sql = Komento::getSql();
$sql->select('#__js_res_record')->column('id', 'id', 'count')->where('id', $cid);
$result = $sql->loadResult();
if ($result < 1) {
return $this->onLoadArticleError($cid);
}
$item = ItemsStore::getRecord($cid);
$item->url = $this->prepareLink(Url::record($item));
$instances[$cid] = $item;
}
$this->_item = $instances[$cid];
return $this;
}
示例3: setData
private function setData()
{
$CACHE = Cache::getInstance();
$data = array();
$lastCommentTime = $this->getLastCommentTime();
$data[] = array('url' => BLOG_URL, 'lastmod' => time(), 'changefreq' => 'always', 'priority' => '1.0');
//日志
$query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='blog' AND hide='n' ORDER BY date DESC");
while ($row = $this->db->fetch_array($query)) {
$lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
$data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
}
//页面
$query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='page' AND hide='n' ORDER BY date DESC");
while ($row = $this->db->fetch_array($query)) {
$lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
$data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
}
//分类
foreach ($CACHE->readCache('sort') as $value) {
$data[] = array('url' => Url::sort($value['sid']), 'lastmod' => time(), 'changefreq' => $this->changefreq[2], 'priority' => $this->priority[2]);
}
//标签
foreach ($CACHE->readCache('tags') as $value) {
$data[] = array('url' => Url::tag($value['tagurl']), 'lastmod' => time(), 'changefreq' => $this->changefreq[3], 'priority' => $this->priority[3]);
}
//碎语
if (Option::get('istwitter') == 'y') {
$newtws_cache = $CACHE->readCache('newtw');
$data[] = array('url' => BLOG_URL . 't/', 'lastmod' => $newtws_cache[0]['date'], 'changefreq' => $this->changefreq[4], 'priority' => $this->priority[4]);
}
//归档
foreach ($CACHE->readCache('record') as $value) {
preg_match("/^([\\d]{4})([\\d]{2})\$/", $value['date'], $match);
$days = getMonthDayNum($match[2], $match[1]);
$lastmod = emStrtotime($value['date'] . '01') + 3600 * 24 * $days;
$data[] = array('url' => Url::record($value['date']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[5], 'priority' => $this->priority[5]);
}
$this->data = $data;
}
示例4: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$helper = JPATH_ROOT . '/components/com_cobalt/library/php/helper.php';
if (is_file($helper)) {
require_once $helper;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__js_res_record');
$query->where('id = ' . (int) $id);
$db->setQuery($query);
$record = $db->loadObject();
if (!empty($record)) {
$info->title = $record->title;
$info->access = $record->access;
$info->userid = $record->user_id;
$info->link = JRoute::_(Url::record($record));
}
}
return $info;
}
示例5: widget_archive
function widget_archive($title)
{
global $CACHE;
$record_cache = $CACHE->readCache('record');
?>
<li>
<h3><span><?php
echo $title;
?>
</span></h3>
<ul id="record">
<?php
foreach ($record_cache as $value) {
?>
<li><a href="<?php
echo Url::record($value['date']);
?>
"><?php
echo $value['record'];
?>
(<?php
echo $value['lognum'];
?>
)</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
示例6: widget_archive
function widget_archive($title)
{
global $CACHE;
$record_cache = $CACHE->readCache('record');
?>
<aside id="text-2" class="widget widget_text">
<h3 class="panel-heading widget-title"><?php
echo $title;
?>
</h3>
<?php
foreach ($record_cache as $value) {
?>
<div class="content">
<h4 class="entry-title"><a rel="bookmark" href="<?php
echo Url::record($value['date']);
?>
"><?php
echo $value['record'];
?>
(<?php
echo $value['lognum'];
?>
)</a></h4>
</div>
<?php
}
?>
</aside>
<?php
}
示例7: widget_archive
function widget_archive($title)
{
global $CACHE;
$record_cache = $CACHE->readCache('record');
?>
<div class="widget widget_archive">
<h3><?php
echo $title;
?>
</h3>
<div class="J_archive">
<?php
foreach ($record_cache as $value) {
?>
<a href="<?php
echo Url::record($value['date']);
?>
" data-title="共计<?php
echo $value['lognum'];
?>
篇" title="共计<?php
echo $value['lognum'];
?>
篇" class="tooltips"><i class="fa fa-archive"></i> <?php
echo $value['record'];
?>
(<?php
echo $value['lognum'];
?>
)</a>
<?php
}
?>
</div>
</div>
<?php
}
示例8: generate
/**
* 生成日历
*/
static function generate()
{
$DB = Database::getInstance();
//建立文章时间写入数组
$query = $DB->query("SELECT date FROM " . DB_PREFIX . "blog WHERE hide='n' and checked='y' and type='blog'");
while ($date = $DB->fetch_array($query)) {
$logdate[] = date("Ymd", $date['date']);
}
//获取当前日期
$n_year = date("Y");
$n_year2 = date("Y");
$n_month = date("m");
$n_day = date("d");
$time = date("Ymd");
$year_month = date("Ym");
if (isset($_GET['record'])) {
$n_year = substr(intval($_GET['record']), 0, 4);
$n_year2 = substr(intval($_GET['record']), 0, 4);
$n_month = substr(intval($_GET['record']), 4, 2);
$year_month = substr(intval($_GET['record']), 0, 6);
}
//年月跳转连接
$m = $n_month - 1;
$mj = $n_month + 1;
$m = $m < 10 ? '0' . $m : $m;
$mj = $mj < 10 ? '0' . $mj : $mj;
$year_up = $n_year;
$year_down = $n_year;
if ($mj > 12) {
$mj = '01';
$year_up = $n_year + 1;
}
if ($m < 1) {
$m = '12';
$year_down = $n_year - 1;
}
$url = DYNAMIC_BLOGURL . '?action=cal&record=' . ($n_year - 1) . $n_month;
//上一年份
$url2 = DYNAMIC_BLOGURL . '?action=cal&record=' . ($n_year + 1) . $n_month;
//下一年份
$url3 = DYNAMIC_BLOGURL . '?action=cal&record=' . $year_down . $m;
//上一月份
$url4 = DYNAMIC_BLOGURL . '?action=cal&record=' . $year_up . $mj;
//下一月份
$calendar = "<table class=\"calendartop\" cellspacing=\"0\"><tr>\n\t\t<td><a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url}','calendar');\"> « </a>{$n_year2}<a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url2}','calendar');\"> » </a></td>\n\t\t<td><a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url3}','calendar');\"> « </a>{$n_month}<a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url4}','calendar');\"> » </a></td>\n\t\t</tr></table>\n\t\t<table class=\"calendar\" cellspacing=\"0\">\n\t\t<tr><td class=\"week\">一</td><td class=\"week\">二</td><td class=\"week\">三</td><td class=\"week\">四</td><td class=\"week\">五</td><td class=\"week\">六</td><td class=\"sun\">日</td></tr>";
//获取给定年月的第一天是星期几
$week = @gmdate("w", gmmktime(0, 0, 0, $n_month, 1, $n_year));
//获取给定年月的天数
$lastday = @gmdate("t", gmmktime(0, 0, 0, $n_month, 1, $n_year));
//获取给定年月的最后一天是星期几
$lastweek = @gmdate("w", gmmktime(0, 0, 0, $n_month, $lastday, $n_year));
if ($week == 0) {
$week = 7;
}
$j = 1;
$w = 7;
$isend = false;
//外循环生成行
for ($i = 1; $i <= 6; $i++) {
if ($isend || $i == 6 && $lastweek == 0) {
break;
}
$calendar .= '<tr>';
//内循环生成列
for ($j; $j <= $w; $j++) {
if ($j < $week) {
$calendar .= '<td> </td>';
} elseif ($j <= 7) {
$r = $j - $week + 1;
//如果该日有文章就显示url样式
$n_time = $n_year . $n_month . '0' . $r;
//有文章且为当天
if (@in_array($n_time, $logdate) && $n_time == $time) {
$calendar .= '<td class="day"><a href="' . Url::record($n_time) . '">' . $r . '</a></td>';
} elseif (@in_array($n_time, $logdate)) {
$calendar .= '<td class="day2"><a href="' . Url::record($n_time) . '">' . $r . '</a></td>';
} elseif ($n_time == $time) {
$calendar .= '<td class="day">' . $r . '</td>';
} else {
$calendar .= '<td>' . $r . '</td>';
}
} else {
$t = $j - ($week - 1);
if ($t > $lastday) {
$isend = true;
$calendar .= '<td> </td>';
} else {
//如果该日有文章就显示url样式
$t < 10 ? $n_time = $n_year . $n_month . '0' . $t : ($n_time = $n_year . $n_month . $t);
if (@in_array($n_time, $logdate) && $n_time == $time) {
$calendar .= '<td class="day"><a href="' . Url::record($n_time) . '">' . $t . '</a></td>';
} elseif (@in_array($n_time, $logdate)) {
$calendar .= '<td class="day2"><a href="' . Url::record($n_time) . '">' . $t . '</a></td>';
} elseif ($n_time == $time) {
$calendar .= '<td class="day">' . $t . '</td>';
} else {
$calendar .= '<td>' . $t . '</td>';
//.........这里部分代码省略.........
示例9: foreach
}
?>
<h5 class="light teal-text text-darken-2 center padding-horizontal">
<?php
echo $widgets_exist['archive']['title'];
?>
</h5>
<ul id="record" class="padding-horizontal">
<?php
foreach ($record_cache as $value) {
?>
<li>
<a class="light red-text text-lighten-2" href="<?php
echo Url::record($value['date']);
?>
">
<?php
echo $value['record'];
?>
(<?php
echo $value['lognum'];
?>
)
</a>
</li>
<?php
}
?>
</ul>
示例10: getSectionRecords
public static function getSectionRecords($params)
{
$db = JFactory::getDbo();
$items = null;
$sql = $db->getQuery(true);
$sql->select('id');
$sql->from('#__js_res_record');
$sql->where('published = 1');
$sql->where('hidden = 0');
$sql->where('section_id = ' . $params->get('section_id'));
$sql->where("ctime < " . $db->quote(JFactory::getDate()->toSql()));
$sql->where("(extime = '0000-00-00 00:00:00' OR extime > '" . JFactory::getDate()->toSql() . "')");
$sql->where("id NOT IN (SELECT record_id FROM #__js_res_record_category WHERE section_id = '" . $params->get('section_id') . "')");
$db->setQuery($sql, 0, $params->get('records_limit') ? $params->get('records_limit') + 1 : 0);
if ($recs = $db->loadColumn()) {
$items = array();
foreach ($recs as $rid) {
$record = ItemsStore::getRecord($rid);
$record->url = Url::record($record);
$items[] = $record;
}
}
return $items;
}
示例11: onContentSearch
function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$out = array();
$text = trim($text);
if ($text == '') {
return $out;
}
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$tag = JFactory::getLanguage()->getTag();
require_once JPATH_SITE . '/components/com_cobalt/library/php/helpers/helper.php';
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
require_once JPATH_SITE . '/administrator/components/com_search/helpers/search.php';
$searchText = $text;
$intersect = array_keys($this->onContentSearchAreas());
if (is_array($areas)) {
$intersect = array_intersect($areas, array_keys($this->onContentSearchAreas()));
}
if (!$intersect) {
return $out;
}
JArrayHelper::toInteger($intersect);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$query = $db->getQuery(TRUE);
$query->select('*');
$query->from('#__js_res_record');
$query->where('published = 1');
$query->where('section_id IN (' . implode(',', $intersect) . ')');
$search_mode = NULL;
$scount = explode(" ", $text);
ArrayHelper::clean_r($scount);
$search = $db->quote($db->escape($text));
if (count($scount) > 2) {
$search_mode = ' IN NATURAL LANGUAGE MODE';
foreach ($scount as $word) {
if (in_array(substr($word, 0, 1), array('+', '-'))) {
$search_mode = ' IN BOOLEAN MODE';
break;
}
}
$query->where("MATCH (fieldsdata) AGAINST ({$search}{$search_mode})");
} elseif (count($scount) == 1) {
$query->where("fieldsdata LIKE '%{$text}%'");
}
//$query->select("MATCH (fieldsdata) AGAINST ({$search}{$search_mode}) AS searchresult");
if ($app->isSite() && $app->getLanguageFilter()) {
$query->where('langs IN (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
}
switch ($ordering) {
case 'oldest':
$order = 'ctime ASC';
break;
case 'popular':
$order = 'hits DESC';
break;
case 'alpha':
$order = 'title ASC';
break;
case 'category':
$order = 'title ASC';
break;
case 'newest':
default:
$order = 'ctime DESC';
}
$query->order($order);
//echo $query;
$db->setQuery($query, 0, $limit);
$result = $db->loadObjectList();
settype($result, 'array');
$out = array();
foreach ($result as $key => $record) {
$out[$key] = new stdClass();
$out[$key]->title = $record->title;
$out[$key]->text = $record->fieldsdata;
$out[$key]->created = $record->ctime;
$out[$key]->href = Url::record($record);
$areas = $this->onContentSearchAreas();
$out[$key]->section = $areas[$record->section_id . '_section'];
$out[$key]->browsernav = 0;
}
return $out;
}
示例12: while
}
#独立页面
$Sql = "SELECT `gid`,`date`,`comnum`,`views` FROM `" . DB_PREFIX . "blog` WHERE `type` = 'page' AND `hide` = 'n'";
$res = $DbModel->query($Sql);
while ($row = $DbModel->fetch_array($res)) {
$cache = array();
$cache['loc'] = Url::log($row['gid']);
$cache['lastmod'] = date('Y-m-d', $row['date']);
$cache['changefreq'] = 'daily';
$cache['priority'] = $row['views'] <= 500 || $row['comnum'] < 1 ? '0.9' : '1.0';
$XMLData[] = $cache;
}
#归档
foreach ($RecordArr as $key => $value) {
$cache = array();
$cache['loc'] = Url::record($value['date']);
$cache['changefreq'] = 'Weekly';
$cache['priority'] = '0.3';
$XMLData[] = $cache;
}
#关键词
foreach ($TagsArr as $key => $value) {
$cache = array();
$cache['loc'] = Url::tag($value['tagurl']);
$cache['changefreq'] = 'Weekly';
$cache['priority'] = '0.3';
$XMLData[] = $cache;
}
#分类
foreach ($SortArr as $key => $value) {
$cache = array();
示例13: widget_archive
function widget_archive($title)
{
global $CACHE;
$record_cache = $CACHE->readCache('record');
?>
<aside class="widget clearfix widget_archive" id="archives">
<h3 class="widget-title"><?php
echo $title;
?>
</h3>
<ul><?php
foreach ($record_cache as $value) {
?>
<li><a title="<?php
echo $value['record'];
?>
href="<?php
echo Url::record($value['date']);
?>
"><?php
echo $value['record'];
?>
</a></li><?php
}
?>
</ul>
</aside>
<?php
}