本文整理匯總了PHP中pagelinkurl函數的典型用法代碼示例。如果您正苦於以下問題:PHP pagelinkurl函數的具體用法?PHP pagelinkurl怎麽用?PHP pagelinkurl使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了pagelinkurl函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: feed
function feed($type)
{
global $prefs;
set_error_handler('feedErrorHandler');
ob_clean();
extract($prefs);
extract(doSlash(gpsa(array('category', 'section', 'limit', 'area'))));
if ($area != 'link') {
$area = 'article';
}
$sitename .= $section ? ' - ' . fetch_section_title($section) : '';
$sitename .= $category ? ' - ' . fetch_category_title($category, $area) : '';
$self_ref = pagelinkurl(array('atom' => 1, 'area' => $area == 'article' ? '' : $area, 'section' => $section, 'category' => $category, 'limit' => $limit));
$id_ext = ($section ? '/' . $section : '') . ($category ? '/' . $category : '');
if ($area == 'article') {
$sfilter = $section ? "and Section = '" . $section . "'" : '';
$cfilter = $category ? "and (Category1='" . $category . "' or Category2='" . $category . "')" : '';
$limit = $limit ? $limit : $rss_how_many;
$limit = intval(min($limit, max(100, $rss_how_many)));
$frs = safe_column("name", "txp_section", "in_rss != '1'");
$query = array();
foreach ($frs as $f) {
$query[] = "and Section != '" . doSlash($f) . "'";
}
$query[] = $sfilter;
$query[] = $cfilter;
$expired = $publish_expired_articles ? '' : ' and (now() <= Expires or Expires = ' . NULLDATETIME . ') ';
$rs = safe_rows_start("*, ID as thisid, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod", "textpattern", "Status=4 and Posted <= now() {$expired}" . join(' ', $query) . "order by Posted desc limit {$limit}");
return render_feed($rs, $area, $type, $sitename, $self_ref, $id_ext);
} elseif ($area == 'link') {
$cfilter = $category ? "category='" . $category . "'" : '1';
$limit = $limit ? $limit : $rss_how_many;
$limit = intval(min($limit, max(100, $rss_how_many)));
$rs = safe_rows_start("*" . ($atom ? '' : ", unix_timestamp(date) as uDate"), "txp_link", "{$cfilter} order by date desc" . ($atom ? ", id desc" : '') . " limit {$limit}");
return render_feed($rs, $area, $type, $sitename, $self_ref, $id_ext);
}
}
示例2: zem_older
function zem_older($atts, $thing = false)
{
global $thispage, $pretext, $permlink_mode;
extract(lAtts(array('showalways' => 0), $atts));
$numPages = $thispage['numPages'];
$pg = $thispage['pg'];
if ($numPages > 1 and $pg != $numPages) {
$nextpg = $pg + 1;
// author urls should use RealName, rather than username
if (!empty($pretext['author'])) {
$author = safe_field('RealName', 'txp_users', "name = '" . doSlash($pretext['author']) . "'");
} else {
$author = '';
}
$parts = array('pg' => $nextpg, 's' => @$pretext['s'], 'c' => @$pretext['c'], 'q' => @$pretext['q'], 'author' => $author);
$parts = $parts + $_GET;
$url = pagelinkurl($parts);
if ($thing) {
return '<a href="' . $url . '"' . (empty($title) ? '' : ' title="' . $title . '"') . '>' . parse($thing) . '</a>';
}
return $url;
}
return $showalways ? parse($thing) : '';
}
示例3: rss
function rss()
{
global $prefs, $thisarticle;
set_error_handler('feedErrorHandler');
ob_clean();
extract($prefs);
extract(doSlash(gpsa(array('limit', 'area'))));
// build filter criteria from a comma-separated list of sections and categories
$feed_filter_limit = get_pref('feed_filter_limit', 10);
$section = gps('section');
$category = gps('category');
if (!is_scalar($section) || !is_scalar($category)) {
txp_die('Not Found', 404);
}
$section = $section ? array_slice(array_unique(do_list($section)), 0, $feed_filter_limit) : array();
$category = $category ? array_slice(array_unique(do_list($category)), 0, $feed_filter_limit) : array();
$st = array();
foreach ($section as $s) {
$st[] = fetch_section_title($s);
}
$ct = array();
foreach ($category as $c) {
$ct[] = fetch_category_title($c);
}
$sitename .= $section ? ' - ' . join(' - ', $st) : '';
$sitename .= $category ? ' - ' . join(' - ', $ct) : '';
$dn = explode('/', $siteurl);
$mail_or_domain = $use_mail_on_feeds_id ? eE($blog_mail_uid) : $dn[0];
// feed header
$out[] = tag('http://textpattern.com/?v=' . $version, 'generator');
$out[] = tag(doSpecial($sitename), 'title');
$out[] = tag(hu, 'link');
$out[] = '<atom:link href="' . pagelinkurl(array('rss' => 1, 'area' => $area, 'section' => $section, 'category' => $category, 'limit' => $limit)) . '" rel="self" type="application/rss+xml" />';
$out[] = tag(doSpecial($site_slogan), 'description');
$last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
$out[] = tag(safe_strftime('rfc822', $last), 'pubDate');
$out[] = callback_event('rss_head');
// feed items
$articles = array();
$section = doSlash($section);
$category = doSlash($category);
if (!$area or $area == 'article') {
$sfilter = !empty($section) ? "and Section in ('" . join("','", $section) . "')" : '';
$cfilter = !empty($category) ? "and (Category1 in ('" . join("','", $category) . "') or Category2 in ('" . join("','", $category) . "'))" : '';
$limit = $limit ? $limit : $rss_how_many;
$limit = intval(min($limit, max(100, $rss_how_many)));
$frs = safe_column("name", "txp_section", "in_rss != '1'");
if ($frs) {
foreach ($frs as $f) {
$query[] = "and Section != '" . doSlash($f) . "'";
}
}
$query[] = $sfilter;
$query[] = $cfilter;
$expired = $publish_expired_articles ? '' : ' and (now() <= Expires or Expires = ' . NULLDATETIME . ') ';
$rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, unix_timestamp(LastMod) as uLastMod, unix_timestamp(Expires) as uExpires, ID as thisid", "textpattern", "Status = 4 " . join(' ', $query) . "and Posted < now()" . $expired . "order by Posted desc limit {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
populateArticleData($a);
$cb = callback_event('rss_entry');
$a['posted'] = $uPosted;
$permlink = permlinkurl($a);
$summary = trim(replace_relative_urls(parse($thisarticle['excerpt']), $permlink));
$content = trim(replace_relative_urls(parse($thisarticle['body']), $permlink));
if ($syndicate_body_or_excerpt) {
# short feed: use body as summary if there's no excerpt
if (!trim($summary)) {
$summary = $content;
}
$content = '';
}
if ($show_comment_count_in_feed) {
$count = $comments_count > 0 ? ' [' . $comments_count . ']' : '';
} else {
$count = '';
}
$Title = escape_title(strip_tags($Title)) . $count;
$thisauthor = get_author_name($AuthorID);
$item = tag($Title, 'title') . n . (trim($summary) ? tag(n . escape_cdata($summary) . n, 'description') . n : '') . (trim($content) ? tag(n . escape_cdata($content) . n, 'content:encoded') . n : '') . tag($permlink, 'link') . n . tag(safe_strftime('rfc822', $a['posted']), 'pubDate') . n . tag(htmlspecialchars($thisauthor), 'dc:creator') . n . tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $blog_uid . '/' . $uid, 'guid', ' isPermaLink="false"') . n . $cb;
$articles[$ID] = tag($item, 'item');
$etags[$ID] = strtoupper(dechex(crc32($articles[$ID])));
$dates[$ID] = $uPosted;
}
}
} elseif ($area == 'link') {
$cfilter = $category ? "category in ('" . join("','", $category) . "')" : '1';
$limit = $limit ? $limit : $rss_how_many;
$limit = intval(min($limit, max(100, $rss_how_many)));
$rs = safe_rows_start("*, unix_timestamp(date) as uDate", "txp_link", "{$cfilter} order by date desc limit {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
$item = tag(doSpecial($linkname), 'title') . n . tag(doSpecial($description), 'description') . n . tag(doSpecial($url), 'link') . n . tag(safe_strftime('rfc822', $uDate), 'pubDate');
$articles[$id] = tag($item, 'item');
$etags[$id] = strtoupper(dechex(crc32($articles[$id])));
$dates[$id] = $date;
}
}
}
//.........這裏部分代碼省略.........
示例4: sitemapXML
public function sitemapXML()
{
static $mlp_installed;
if (!isset($mlp_installed)) {
$mlp_installed = is_callable('l10n_installed') ? call_user_func('l10n_installed', true) : false;
}
$out = '<?xml version="1.0" encoding="utf-8"?>';
$out .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
// Homepage
$out .= $this->urlXML(hu);
// Excluded sections
$excluded = $GLOBALS['prefs']['jmd_sitemap_exclude'];
$excluded = unserialize($excluded);
foreach ($excluded as $key => $value) {
$notIn[$key] = "'{$value}'";
}
$notIn = implode(',', $notIn);
$notIn .= ",'default'";
// List sections
$site_langs = array();
if ($mlp_installed) {
$site_langs = MLPLanguageHandler::get_site_langs();
}
$sections = safe_column("name", "txp_section", "name not in({$notIn})");
foreach ($sections as $section) {
if ($mlp_installed) {
foreach ($site_langs as $lang) {
$lang = substr($lang, 0, 2) . '/';
$loc = hu . $lang . urlencode($section) . '/';
$out .= $this->urlXML($loc);
}
} else {
$loc = pagelinkurl(array('s' => $section));
$out .= $this->urlXML($loc);
}
}
// Articles
$fields = 'ID as thisid, Section as section, Title as title,
url_title, unix_timestamp(Posted) as posted,
unix_timestamp(LastMod) as lastmod';
if ($mlp_installed) {
$fields .= ', l10n_lang';
}
$articles = getRows("select {$fields} from " . safe_pfx('textpattern') . " where Status = 4 and Posted<= now() and section not in({$notIn})");
if ($articles) {
include_once txpath . '/publish/taghandlers.php';
foreach ($articles as $article) {
$loc = permlinkurl($article);
if ($mlp_installed) {
$loc = str_replace(hu, hu . substr($article['l10n_lang'], 0, 2) . '/', $loc);
}
$lastmod = date('c', $article['lastmod']);
$out .= $this->urlXML($loc, $lastmod);
}
}
$out .= '</urlset>';
return $out;
}
示例5: atom
/**
* Generates and outputs an Atom feed.
*
* This function can only be called once on a page. It outputs an Atom feed
* based on the requested URL parameters. Accepts HTTP GET parameters 'limit',
* 'area', 'section' and 'category'.
*/
function atom()
{
global $thisarticle, $prefs;
set_error_handler('feedErrorHandler');
ob_clean();
extract($prefs);
$last = fetch("UNIX_TIMESTAMP(val)", 'txp_prefs', 'name', 'lastmod');
extract(doSlash(gpsa(array('limit', 'area'))));
// Build filter criteria from a comma-separated list of sections
// and categories.
$feed_filter_limit = get_pref('feed_filter_limit', 10);
$section = gps('section');
$category = gps('category');
if (!is_scalar($section) || !is_scalar($category)) {
txp_die('Not Found', 404);
}
$section = $section ? array_slice(do_list_unique($section), 0, $feed_filter_limit) : array();
$category = $category ? array_slice(do_list_unique($category), 0, $feed_filter_limit) : array();
$st = array();
foreach ($section as $s) {
$st[] = fetch_section_title($s);
}
$ct = array();
foreach ($category as $c) {
$ct[] = fetch_category_title($c);
}
$sitename .= $section ? ' - ' . join(' - ', $st) : '';
$sitename .= $category ? ' - ' . join(' - ', $ct) : '';
$pub = safe_row("RealName, email", 'txp_users', "privs = 1");
// Feed header.
$out[] = tag(htmlspecialchars($sitename), 'title', t_text);
$out[] = tag(htmlspecialchars($site_slogan), 'subtitle', t_text);
$out[] = '<link' . r_relself . ' href="' . pagelinkurl(array('atom' => 1, 'area' => $area, 'section' => $section, 'category' => $category, 'limit' => $limit)) . '" />';
$out[] = '<link' . r_relalt . t_texthtml . ' href="' . hu . '" />';
// Atom feeds with mail or domain name.
$dn = explode('/', $siteurl);
$mail_or_domain = $use_mail_on_feeds_id ? eE($blog_mail_uid) : $dn[0];
$out[] = tag('tag:' . $mail_or_domain . ',' . $blog_time_uid . ':' . $blog_uid . ($section ? '/' . join(',', $section) : '') . ($category ? '/' . join(',', $category) : ''), 'id');
$out[] = tag('Textpattern', 'generator', ' uri="http://textpattern.com/" version="' . $version . '"');
$out[] = tag(safe_strftime("w3cdtf", $last), 'updated');
$auth[] = tag($pub['RealName'], 'name');
$auth[] = $include_email_atom ? tag(eE($pub['email']), 'email') : '';
$auth[] = tag(hu, 'uri');
$out[] = tag(n . t . t . join(n . t . t, $auth) . n, 'author');
$out[] = callback_event('atom_head');
// Feed items.
$articles = array();
$section = doSlash($section);
$category = doSlash($category);
if (!$area or $area == 'article') {
$sfilter = !empty($section) ? "AND Section IN ('" . join("','", $section) . "')" : '';
$cfilter = !empty($category) ? "AND (Category1 IN ('" . join("','", $category) . "') OR Category2 IN ('" . join("','", $category) . "'))" : '';
$limit = $limit ? $limit : $rss_how_many;
$limit = intval(min($limit, max(100, $rss_how_many)));
$frs = safe_column("name", 'txp_section', "in_rss != '1'");
$query = array();
foreach ($frs as $f) {
$query[] = "AND Section != '" . doSlash($f) . "'";
}
$query[] = $sfilter;
$query[] = $cfilter;
$expired = $publish_expired_articles ? " " : " AND (" . now('expires') . " <= Expires OR Expires = " . NULLDATETIME . ") ";
$rs = safe_rows_start("*,\n ID AS thisid,\n UNIX_TIMESTAMP(Posted) AS uPosted,\n UNIX_TIMESTAMP(Expires) AS uExpires,\n UNIX_TIMESTAMP(LastMod) AS uLastMod", 'textpattern', "Status = 4 AND Posted <= " . now('posted') . $expired . join(' ', $query) . "ORDER BY Posted DESC LIMIT {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
populateArticleData($a);
$cb = callback_event('atom_entry');
$e = array();
$a['posted'] = $uPosted;
$a['expires'] = $uExpires;
if ($show_comment_count_in_feed) {
$count = $comments_count > 0 ? ' [' . $comments_count . ']' : '';
} else {
$count = '';
}
$thisauthor = get_author_name($AuthorID);
$e['thisauthor'] = tag(n . t . t . t . tag(htmlspecialchars($thisauthor), 'name') . n . t . t, 'author');
$e['issued'] = tag(safe_strftime('w3cdtf', $uPosted), 'published');
$e['modified'] = tag(safe_strftime('w3cdtf', $uLastMod), 'updated');
$escaped_title = htmlspecialchars($Title);
$e['title'] = tag($escaped_title . $count, 'title', t_html);
$permlink = permlinkurl($a);
$e['link'] = '<link' . r_relalt . t_texthtml . ' href="' . $permlink . '" />';
$e['id'] = tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $blog_uid . '/' . $uid, 'id');
$e['category1'] = trim($Category1) ? '<category term="' . htmlspecialchars($Category1) . '" />' : '';
$e['category2'] = trim($Category2) ? '<category term="' . htmlspecialchars($Category2) . '" />' : '';
$summary = trim(replace_relative_urls(parse($thisarticle['excerpt']), $permlink));
$content = trim(replace_relative_urls(parse($thisarticle['body']), $permlink));
if ($syndicate_body_or_excerpt) {
// Short feed: use body as summary if there's no excerpt.
if (!trim($summary)) {
$summary = $content;
//.........這裏部分代碼省略.........
示例6: sec_section_list
//.........這裏部分代碼省略.........
$dir = get_pref('section_sort_dir', 'desc');
}
$dir = $dir == 'asc' ? 'asc' : 'desc';
switch ($sort) {
case 'title':
$sort_sql = 'title ' . $dir;
break;
case 'page':
$sort_sql = 'page ' . $dir;
break;
case 'css':
$sort_sql = 'css ' . $dir;
break;
case 'in_rss':
$sort_sql = 'in_rss ' . $dir;
break;
case 'on_frontpage':
$sort_sql = 'on_frontpage ' . $dir;
break;
case 'searchable':
$sort_sql = 'searchable ' . $dir;
break;
case 'article_count':
$sort_sql = 'article_count ' . $dir;
break;
default:
$sort_sql = 'name ' . $dir;
break;
}
set_pref('section_sort_column', $sort, 'section', 2, '', 0, PREF_PRIVATE);
set_pref('section_sort_dir', $dir, 'section', 2, '', 0, PREF_PRIVATE);
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$criteria = 1;
if ($search_method and $crit != '') {
$verbatim = preg_match('/^"(.*)"$/', $crit, $m);
$crit_escaped = $verbatim ? doSlash($m[1]) : doLike($crit);
$critsql = $verbatim ? array('name' => "name = '{$crit_escaped}'", 'title' => "title = '{$crit_escaped}'", 'page' => "page = '{$crit_escaped}'", 'css' => "css = '{$crit_escaped}'", 'description' => "description = '{$crit_escaped}'") : array('name' => "name like '%{$crit_escaped}%'", 'title' => "title like '%{$crit_escaped}%'", 'page' => "page like '%{$crit_escaped}%'", 'css' => "css like '%{$crit_escaped}%'", 'description' => "description like '%{$crit_escaped}%'");
if ($verbatim) {
$critsql['in_rss'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and in_rss = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and in_rss = 0)";
$critsql['on_frontpage'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and on_frontpage = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and on_frontpage = 0)";
$critsql['searchable'] = "('{$crit_escaped}' in ('" . doSlash(gTxt('yes')) . "', 1) and searchable = 1) or\n ('{$crit_escaped}' in ('" . doSlash(gTxt('no')) . "', '0') and searchable = 0)";
} else {
$critsql['in_rss'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and in_rss = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and in_rss = 0)";
$critsql['on_frontpage'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and on_frontpage = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and on_frontpage = 0)";
$critsql['searchable'] = "(('" . doSlash(gTxt('yes')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = 1) and searchable = 1) or\n (('" . doSlash(gTxt('no')) . "' like '%{$crit_escaped}%' or '{$crit_escaped}' = '0') and searchable = 0)";
}
$search_sql = array();
foreach ((array) $search_method as $method) {
if (isset($critsql[$method])) {
$search_sql[] = $critsql[$method];
}
}
if ($search_sql) {
$criteria = join(' or ', $search_sql);
$limit = 500;
} else {
$search_method = '';
$crit = '';
}
} else {
$search_method = '';
$crit = '';
}
$criteria .= callback_event('admin_criteria', 'section_list', 0, $criteria);
$total = safe_count('txp_section', $criteria);
echo hed(gTxt('tab_sections') . popHelp('section_category'), 1, array('class' => 'txp-heading')) . n . tag_start('div', array('id' => $event . '_control', 'class' => 'txp-control-panel')) . graf(sLink('section', 'section_edit', gTxt('create_section')), array('class' => 'txp-buttons')) . n . tag_start('form', array('id' => 'default_section_form', 'name' => 'default_section_form', 'method' => 'post', 'action' => 'index.php', 'class' => 'async')) . graf(tag(gTxt('default_write_section'), 'label', array('for' => 'default_section')) . popHelp('section_default') . section_select_list()) . eInput('section') . sInput('section_set_default') . n . tag_end('form');
if ($total < 1) {
if ($criteria != 1) {
echo section_search_form($crit, $search_method) . graf(gTxt('no_results_found'), ' class="indicator"') . '</div>';
}
return;
}
$limit = max($section_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo section_search_form($crit, $search_method) . '</div>';
$rs = safe_rows_start('*, (select count(*) from ' . safe_pfx_j('textpattern') . ' where textpattern.Section = txp_section.name) as article_count', 'txp_section', "{$criteria} order by {$sort_sql} limit {$offset}, {$limit}");
if ($rs) {
echo n . tag_start('div', array('id' => $event . '_container', 'class' => 'txp-container')) . n . tag_start('form', array('action' => 'index.php', 'id' => 'section_form', 'class' => 'multi_edit_form', 'method' => 'post', 'name' => 'longform')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' scope="col" title="' . gTxt('toggle_all_selected') . '" class="txp-list-col-multi-edit"') . column_head('name', 'name', 'section', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('title', 'title', 'section', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'txp-list-col-title') . column_head('page', 'page', 'section', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'txp-list-col-page') . column_head('css', 'css', 'section', true, $switch_dir, $crit, $search_method, ('css' == $sort ? "{$dir} " : '') . 'txp-list-col-style') . column_head('on_front_page', 'on_frontpage', 'section', true, $switch_dir, $crit, $search_method, ('on_frontpage' == $sort ? "{$dir} " : '') . 'txp-list-col-frontpage section_detail') . column_head('syndicate', 'in_rss', 'section', true, $switch_dir, $crit, $search_method, ('in_rss' == $sort ? "{$dir} " : '') . 'txp-list-col-syndicate section_detail') . column_head('include_in_search', 'searchable', 'section', true, $switch_dir, $crit, $search_method, ('searchable' == $sort ? "{$dir} " : '') . 'txp-list-col-searchable section_detail') . column_head('articles', 'article_count', 'section', true, $switch_dir, $crit, $search_method, ('article_count' == $sort ? "{$dir} " : '') . 'txp-list-col-article_count section_detail')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'sec');
$edit_url = array('event' => 'section', 'step' => 'section_edit', 'name' => $sec_name, 'sort' => $sort, 'dir' => $dir, 'page' => $page, 'search_method' => $search_method, 'crit' => $crit);
if ($sec_name == 'default') {
$articles = $sec_searchable = $sec_in_rss = $sec_on_frontpage = '-';
} else {
$sec_on_frontpage = asyncHref(yes_no($sec_on_frontpage), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'on_frontpage'));
$sec_in_rss = asyncHref(yes_no($sec_in_rss), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'in_rss'));
$sec_searchable = asyncHref(yes_no($sec_searchable), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'searchable'));
if ($sec_article_count > 0) {
$articles = href($sec_article_count, array('event' => 'list', 'search_method' => 'section', 'crit' => '"' . $sec_name . '"'), array('title' => gTxt('article_count', array('{num}' => $sec_article_count))));
} else {
$articles = 0;
}
}
$sec_page = href(txpspecialchars($sec_page), array('event' => 'page', 'name' => $sec_page), array('title' => gTxt('edit')));
$sec_css = href(txpspecialchars($sec_css), array('event' => 'css', 'name' => $sec_css), array('title' => gTxt('edit')));
echo tr(td(fInput('checkbox', 'selected[]', $sec_name), '', 'txp-list-col-multi-edit') . hCell(href(txpspecialchars($sec_name), $edit_url, array('title' => gTxt('edit'))) . sp . span(span('[', array('aria-hidden' => 'true')) . href(gTxt('view'), pagelinkurl(array('s' => $sec_name))) . span(']', array('aria-hidden' => 'true')), array('class' => 'section_detail')), '', array('scope' => 'row', 'class' => 'txp-list-col-name')) . td(txpspecialchars($sec_title), '', 'txp-list-col-title') . td($sec_page, '', 'txp-list-col-page') . td($sec_css, '', 'txp-list-col-style') . td($sec_on_frontpage, '', 'txp-list-col-frontpage section_detail') . td($sec_in_rss, '', 'txp-list-col-syndicate section_detail') . td($sec_searchable, '', 'txp-list-col-searchable section_detail') . td($articles, '', 'txp-list-col-article_count section_detail'), array('id' => 'txp_section_' . $sec_name));
}
echo n . tag_end('tbody') . n . tag_end('table') . n . tag_end('div') . section_multiedit_form($page, $sort, $dir, $crit, $search_method) . tInput() . n . tag_end('form') . graf(toggle_box('section_detail'), array('class' => 'detail-toggle')) . n . tag_start('div', array('id' => $event . '_navigation', 'class' => 'txp-navigation')) . pageby_form('section', $section_list_pageby) . nav_form('section', $page, $numPages, $sort, $dir, $crit, $search_method, $total, $limit) . n . tag_end('div') . n . tag_end('div');
}
}
示例7: sec_section_list
/**
* The main panel listing all sections.
*
* So-named to avoid clashing with the <txp:section_list /> tag.
*
* @param string|array $message The activity message
*/
function sec_section_list($message = '')
{
global $event, $section_list_pageby;
pagetop(gTxt('tab_sections'), $message);
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if ($sort === '') {
$sort = get_pref('section_sort_column', 'name');
} else {
if (!in_array($sort, array('title', 'page', 'css', 'in_rss', 'on_frontpage', 'searchable', 'article_count'))) {
$sort = 'name';
}
set_pref('section_sort_column', $sort, 'section', 2, '', 0, PREF_PRIVATE);
}
if ($dir === '') {
$dir = get_pref('section_sort_dir', 'desc');
} else {
$dir = $dir == 'asc' ? "asc" : "desc";
set_pref('section_sort_dir', $dir, 'section', 2, '', 0, PREF_PRIVATE);
}
switch ($sort) {
case 'title':
$sort_sql = "title {$dir}";
break;
case 'page':
$sort_sql = "page {$dir}";
break;
case 'css':
$sort_sql = "css {$dir}";
break;
case 'in_rss':
$sort_sql = "in_rss {$dir}";
break;
case 'on_frontpage':
$sort_sql = "on_frontpage {$dir}";
break;
case 'searchable':
$sort_sql = "searchable {$dir}";
break;
case 'article_count':
$sort_sql = "article_count {$dir}";
break;
default:
$sort_sql = "name {$dir}";
break;
}
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$search = new Filter($event, array('name' => array('column' => 'txp_section.name', 'label' => gTxt('name')), 'title' => array('column' => 'txp_section.title', 'label' => gTxt('title')), 'page' => array('column' => 'txp_section.page', 'label' => gTxt('page')), 'css' => array('column' => 'txp_section.css', 'label' => gTxt('css')), 'on_frontpage' => array('column' => 'txp_section.on_frontpage', 'label' => gTxt('on_front_page'), 'type' => 'boolean'), 'in_rss' => array('column' => 'txp_section.in_rss', 'label' => gTxt('syndicate'), 'type' => 'boolean'), 'searchable' => array('column' => 'txp_section.searchable', 'label' => gTxt('include_in_search'), 'type' => 'boolean')));
$alias_yes = '1, Yes';
$alias_no = '0, No';
$search->setAliases('on_frontpage', array($alias_no, $alias_yes));
$search->setAliases('in_rss', array($alias_no, $alias_yes));
$search->setAliases('searchable', array($alias_no, $alias_yes));
list($criteria, $crit, $search_method) = $search->getFilter();
$search_render_options = array('placeholder' => 'search_sections');
$total = safe_count('txp_section', $criteria);
echo n . tag(hed(gTxt('tab_sections'), 1, array('class' => 'txp-heading')), 'div', array('class' => 'txp-layout-2col-cell-1'));
$searchBlock = n . tag($search->renderForm('sec_section', $search_render_options), 'div', array('class' => 'txp-layout-2col-cell-2', 'id' => $event . '_control'));
$createBlock = array();
if (has_privs('section.edit')) {
$createBlock[] = n . tag(sLink('section', 'section_edit', gTxt('create_section'), 'txp-button') . n . tag_start('form', array('class' => 'async', 'id' => 'default_section_form', 'name' => 'default_section_form', 'method' => 'post', 'action' => 'index.php')) . tag(gTxt('default_write_section'), 'label', array('for' => 'default_section')) . popHelp('section_default') . section_select_list() . eInput('section') . sInput('section_set_default') . n . tag_end('form'), 'div', array('class' => 'txp-control-panel'));
}
$contentBlockStart = n . tag_start('div', array('class' => 'txp-layout-1col', 'id' => $event . '_container'));
$createBlock = implode(n, $createBlock);
if ($total < 1) {
if ($criteria != 1) {
echo $searchBlock . $contentBlockStart . $createBlock . graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_results_found'), array('class' => 'alert-block information')) . n . tag_end('div');
}
return;
}
$limit = max($section_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
echo $searchBlock . $contentBlockStart . $createBlock;
$rs = safe_rows_start("*, (SELECT COUNT(*) FROM " . safe_pfx_j('textpattern') . " WHERE textpattern.Section = txp_section.name) AS article_count", 'txp_section', "{$criteria} ORDER BY {$sort_sql} LIMIT {$offset}, {$limit}");
if ($rs) {
echo n . tag(toggle_box('section_detail'), 'div', array('class' => 'txp-list-options')) . n . tag_start('form', array('class' => 'multi_edit_form', 'id' => 'section_form', 'name' => 'longform', 'method' => 'post', 'action' => 'index.php')) . n . tag_start('div', array('class' => 'txp-listtables')) . n . tag_start('table', array('class' => 'txp-list')) . n . tag_start('thead') . tr(hCell(fInput('checkbox', 'select_all', 0, '', '', '', '', '', 'select_all'), '', ' class="txp-list-col-multi-edit" scope="col" title="' . gTxt('toggle_all_selected') . '"') . column_head('name', 'name', 'section', true, $switch_dir, $crit, $search_method, ('name' == $sort ? "{$dir} " : '') . 'txp-list-col-name') . column_head('title', 'title', 'section', true, $switch_dir, $crit, $search_method, ('title' == $sort ? "{$dir} " : '') . 'txp-list-col-title') . column_head('page', 'page', 'section', true, $switch_dir, $crit, $search_method, ('page' == $sort ? "{$dir} " : '') . 'txp-list-col-page') . column_head('css', 'css', 'section', true, $switch_dir, $crit, $search_method, ('css' == $sort ? "{$dir} " : '') . 'txp-list-col-style') . column_head('on_front_page', 'on_frontpage', 'section', true, $switch_dir, $crit, $search_method, ('on_frontpage' == $sort ? "{$dir} " : '') . 'txp-list-col-frontpage section_detail') . column_head('syndicate', 'in_rss', 'section', true, $switch_dir, $crit, $search_method, ('in_rss' == $sort ? "{$dir} " : '') . 'txp-list-col-syndicate section_detail') . column_head('include_in_search', 'searchable', 'section', true, $switch_dir, $crit, $search_method, ('searchable' == $sort ? "{$dir} " : '') . 'txp-list-col-searchable section_detail') . column_head('articles', 'article_count', 'section', true, $switch_dir, $crit, $search_method, ('article_count' == $sort ? "{$dir} " : '') . 'txp-list-col-article_count section_detail')) . n . tag_end('thead') . n . tag_start('tbody');
while ($a = nextRow($rs)) {
extract($a, EXTR_PREFIX_ALL, 'sec');
$edit_url = array('event' => 'section', 'step' => 'section_edit', 'name' => $sec_name, 'sort' => $sort, 'dir' => $dir, 'page' => $page, 'search_method' => $search_method, 'crit' => $crit);
if ($sec_name == 'default') {
$articles = $sec_searchable = $sec_in_rss = $sec_on_frontpage = '-';
} else {
$sec_on_frontpage = asyncHref(yes_no($sec_on_frontpage), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'on_frontpage'));
$sec_in_rss = asyncHref(yes_no($sec_in_rss), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'in_rss'));
$sec_searchable = asyncHref(yes_no($sec_searchable), array('step' => 'section_toggle_option', 'thing' => $sec_name, 'property' => 'searchable'));
if ($sec_article_count > 0) {
$articles = href($sec_article_count, array('event' => 'list', 'search_method' => 'section', 'crit' => '"' . $sec_name . '"'), array('title' => gTxt('article_count', array('{num}' => $sec_article_count))));
} else {
$articles = 0;
}
}
$sec_page = href(txpspecialchars($sec_page), array('event' => 'page', 'name' => $sec_page), array('title' => gTxt('edit')));
$sec_css = href(txpspecialchars($sec_css), array('event' => 'css', 'name' => $sec_css), array('title' => gTxt('edit')));
echo tr(td(fInput('checkbox', 'selected[]', $sec_name), '', 'txp-list-col-multi-edit') . hCell(href(txpspecialchars($sec_name), $edit_url, array('title' => gTxt('edit'))) . span(sp . span('|', array('role' => 'separator')) . sp . href(gTxt('view'), pagelinkurl(array('s' => $sec_name))), array('class' => 'txp-option-link section_detail')), '', array('class' => 'txp-list-col-name', 'scope' => 'row')) . td(txpspecialchars($sec_title), '', 'txp-list-col-title') . td($sec_page, '', 'txp-list-col-page') . td($sec_css, '', 'txp-list-col-style') . td($sec_on_frontpage, '', 'txp-list-col-frontpage section_detail') . td($sec_in_rss, '', 'txp-list-col-syndicate section_detail') . td($sec_searchable, '', 'txp-list-col-searchable section_detail') . td($articles, '', 'txp-list-col-article_count section_detail'), array('id' => 'txp_section_' . $sec_name));
//.........這裏部分代碼省略.........
示例8: yab_build_promo_input
function yab_build_promo_input($cart)
{
$pcode = ps('yab-promo');
$out = '';
if (yab_shop_config('promocode') != '') {
if ($pcode != '') {
if ($pcode == yab_shop_config('promocode')) {
$out .= graf(yab_shop_lang('promocode_success'), ' class="yab-shop-notice yab-promo-success"');
} else {
$out .= graf(yab_shop_lang('promocode_error'), ' class="yab-shop-notice yab-promo-error"') . tag(graf(tag(yab_shop_lang('promocode_label'), 'label', ' for="yab-promo"') . fInput('text', 'yab-promo', '', '', '', '', '', '', 'yab-promo') . fInput('submit', '', yab_shop_lang('promocode_button'), 'yab-promo-submit'), ' class="yab-promocode"'), 'form', ' method="post" action="' . pagelinkurl(array('s' => yab_shop_config('checkout_section_name'))) . '"');
}
} else {
if ($cart->get_promocode() == 1) {
$out .= graf(yab_shop_lang('promocode_success'), ' class="yab-shop-notice yab-promo-success"');
} else {
$out .= tag(graf(tag(yab_shop_lang('promocode_label'), 'label', ' for="yab-promo"') . fInput('text', 'yab-promo', '', '', '', '', '', '', 'yab-promo') . fInput('submit', '', yab_shop_lang('promocode_button'), 'yab-promo-submit'), ' class="yab-promocode"'), 'form', ' method="post" action="' . pagelinkurl(array('s' => yab_shop_config('checkout_section_name'))) . '"');
}
}
}
return $out;
}
示例9: file_download_author
function file_download_author($atts)
{
global $thisfile, $s;
assert_file();
extract(lAtts(array('class' => '', 'link' => 0, 'title' => 1, 'section' => '', 'this_section' => '', 'wraptag' => ''), $atts));
if ($thisfile['author']) {
$author_name = get_author_name($thisfile['author']);
$display_name = txpspecialchars($title ? $author_name : $thisfile['author']);
$section = $this_section ? $s == 'default' ? '' : $s : $section;
$author = $link ? href($display_name, pagelinkurl(array('s' => $section, 'author' => $author_name, 'context' => 'file'))) : $display_name;
return $wraptag ? doTag($author, $wraptag, $class) : $author;
}
}
示例10: _pagelinkurl
function _pagelinkurl($parts)
{
extract(lAtts(array('path' => 'index.php', 'query' => '', 'fragment' => ''), parse_url(html_entity_decode(str_replace('&', '&', $parts[2])))));
// Tidy up links back to the site homepage
if ($path == 'index.php' && empty($query)) {
return 'href="' . hu . '"';
} else {
if ($path && empty($query) && $parts[1] == '?') {
$query = $path;
$path = 'index.php';
} else {
if (empty($query) || $path != 'index.php' || strpos($query, '/') === true) {
return $parts[0];
}
}
}
// '&' will break parse_str() if they are found in a query string
$query = str_replace('&', '&', $query);
if ($fragment) {
$fragment = '#' . $fragment;
}
global $pretext;
parse_str($query, $query_part);
if (!array_key_exists('pg', $query_part)) {
$query_part['pg'] = 0;
}
if (!array_key_exists('id', $query_part)) {
$query_part['id'] = 0;
}
if (!array_key_exists('rss', $query_part)) {
$query_part['rss'] = 0;
}
if (!array_key_exists('atom', $query_part)) {
$query_part['atom'] = 0;
}
if ($this->pref('join_pretext_to_pagelinks')) {
extract(array_merge($pretext, $query_part));
} else {
extract($query_part);
}
// We have a id, pass to permlinkurl()
if ($id) {
if (@$s == 'file_download') {
$title = version_compare($dbversion, '4.2', '>=') ? NULL : safe_field('filename', 'txp_file', "id = '{$id}'");
$url = $this->toggle_permlink_mode('filedownloadurl', array($id, $title), true);
} else {
$rs = safe_row('*, ID as thisid, unix_timestamp(Posted) as posted', 'textpattern', "ID = '{$id}'");
$url = $this->_permlinkurl($rs, PERMLINKURL) . $fragment;
}
return 'href="' . $url . '"';
}
if (@$s == 'default') {
unset($s);
}
// Some TxP tags, e.g. <txp:feed_link /> use 'section' or 'category' inconsistent
// with most other tags. Process these now so we only have to check $s and $c.
if (@$section) {
$s = $section;
}
if (@$category) {
$c = $category;
}
// Debugging for buffers
$this->buffer_debug[] = 'url: ' . str_replace('&', '&', $parts[1] . $parts[2]);
$this->buffer_debug[] = 'path: ' . $path;
$this->buffer_debug[] = 'query: ' . $query;
if ($fragment) {
$this->buffer_debug[] = 'fragment: ' . $fragment;
}
if (@$id) {
$this->buffer_debug[] = 'id: ' . $id;
}
if (@$s) {
$this->buffer_debug[] = 's: ' . $s;
}
if (@$c) {
$this->buffer_debug[] = 'c: ' . $c;
}
if (@$rss) {
$this->buffer_debug[] = 'rss: ' . $rss;
}
if (@$atom) {
$this->buffer_debug[] = 'atom: ' . $atom;
}
if (@$pg) {
$this->buffer_debug[] = 'pg: ' . $pg;
}
if (@$q) {
$this->buffer_debug[] = 'q: ' . $q;
}
if (@$pretext['permlink_override']) {
$override_ids = explode(',', $pretext['permlink_override']);
foreach ($override_ids as $override_id) {
$pl = $this->get_permlink($override_id);
if (count($pl) > 0) {
$permlinks[] = $pl;
}
}
}
if (empty($permlinks)) {
//.........這裏部分代碼省略.........
示例11: breadcrumb
function breadcrumb($atts)
{
global $pretext, $thisarticle, $sitename;
extract(lAtts(array('wraptag' => 'p', 'sep' => ' » ', 'link' => 'y', 'label' => $sitename, 'title' => '', 'class' => '', 'linkclass' => 'noline'), $atts));
$linked = $link == 'y' ? true : false;
if ($linked) {
$label = doTag($label, 'a', $linkclass, ' href="' . hu . '"');
}
$content = array();
extract($pretext);
if (!empty($s) && $s != 'default') {
$section_title = $title ? fetch_section_title($s) : $s;
$section_title_html = escape_title($section_title);
$content[] = $linked ? doTag($section_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('s' => $s)) . '"') : $section_title_html;
}
$category = empty($c) ? '' : $c;
foreach (getTreePath($category, 'article') as $cat) {
if ($cat['name'] != 'root') {
$category_title_html = $title ? escape_title($cat['title']) : $cat['name'];
$content[] = $linked ? doTag($category_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('c' => $cat['name'])) . '"') : $category_title_html;
}
}
//Add the label at the end, to prevent breadcrumb for home page
if (!empty($content)) {
$content = array_merge(array($label), $content);
}
//Add article title without link if we're on an individual archive page?
return doTag(join($sep, $content), $wraptag, $class);
}
示例12: breadcrumb
function breadcrumb($atts)
{
global $pretext, $sitename;
extract(lAtts(array('wraptag' => 'p', 'sep' => ' » ', 'link' => 1, 'label' => $sitename, 'title' => '', 'class' => '', 'linkclass' => 'noline'), $atts));
// bc, get rid of in crockery
if ($link == 'y') {
$linked = true;
} elseif ($link == 'n') {
$linked = false;
} else {
$linked = $link;
}
if ($linked) {
$label = doTag($label, 'a', $linkclass, ' href="' . hu . '"');
}
$content = array();
extract($pretext);
if (!empty($s) && $s != 'default' && $s != 'home') {
$section_title = $title ? fetch_section_title($s) : $s;
$section_title_html = escape_title($section_title);
$content[] = $linked ? doTag($section_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('s' => $s)) . '"') : $section_title_html;
}
$category = empty($c) ? '' : $c;
foreach (getTreePath($category, 'article') as $cat) {
if ($cat['name'] != 'root') {
$category_title_html = $title ? escape_title($cat['title']) : $cat['name'];
$content[] = $linked ? doTag($category_title_html, 'a', $linkclass, ' href="' . pagelinkurl(array('c' => $cat['name'])) . '"') : $category_title_html;
}
}
// add the label at the end, to prevent breadcrumb for home page
if ($content) {
$content = array_merge(array($label), $content);
return doTag(join($sep, $content), $wraptag, $class);
}
}
示例13: breadcrumb
function breadcrumb($atts)
{
global $pretext, $thisarticle, $sitename;
extract(lAtts(array('wraptag' => 'p', 'sep' => ' » ', 'link' => 'y', 'label' => $sitename), $atts));
$linked = $link == 'y' ? true : false;
if ($linked) {
$label = '<a href="' . hu . '" class="noline">' . $sitename . '</a>';
}
$content = array();
extract($pretext);
if (!empty($s) && $s != 'default') {
$content[] = $linked ? tag(htmlspecialchars($s), 'a', ' href="' . pagelinkurl(array('s' => $s)) . '/"') : $s;
}
$category = empty($c) ? '' : $c;
$cattree = array();
while ($category and $category != 'root' and $parent = safe_field('parent', 'txp_category', "name='{$category}'")) {
//Use new /category/category_name scheme here too?
$cattree[] = $linked ? tag(str_replace("& ", "& ", $category), 'a', ' href="' . pagelinkurl(array('c' => $category)) . '"') : $category;
$category = $parent;
unset($parent);
}
if (!empty($cattree)) {
$cattree = array_reverse($cattree);
$content = array_merge($content, $cattree);
}
//Add date month permlinks?
// $year = '';
// $month = '';
// $date = '';
//Add the label at the end, to prevent breadcrumb for home page
if (!empty($content)) {
$content = array_merge(array($label), $content);
}
//Add article title without link if we're on an individual archive page?
return doTag(join($sep, $content), $wraptag);
}
示例14: metaWeblog_getCategories
function metaWeblog_getCategories($params)
{
list($blogid, $username, $password) = $params;
global $permlink_mode;
$txp = new TXP_Wrapper($username, $password);
if (!$txp->loggedin) {
return new IXR_Error(100, gTxt('bad_login'));
}
$rs = $txp->getCategoryList();
if (!$rs) {
return new IXR_Error(210, gTxt('problem_retrieving_categories'));
}
$cats = array();
foreach ($rs as $c) {
$cats[] = array('categoryName' => $c['name'], 'description' => $c['title'], 'htmlUrl' => pagelinkurl(array('c' => $c['name'])), 'rssUrl' => hu . '?rss=1&category=' . $c['name']);
}
return $cats;
}
示例15: adi_menu_section_list
function adi_menu_section_list($ignore_exclude)
{
global $sections, $exclude, $sort, $default_first, $default_title, $include_default;
if ($sections) {
$sections = do_list($sections);
$sections = join("','", doSlash($sections));
$rs = safe_rows_start('name,title,adi_menu_parent,adi_menu_clone,adi_menu_title', 'txp_section', "name in ('{$sections}') order by " . ($sort ? $sort : "field(name, '{$sections}')"));
} else {
if ($exclude) {
$exclude = do_list($exclude);
$exclude = join("','", doSlash($exclude));
$exclude = "and name not in('{$exclude}')";
}
if (!$include_default) {
$exclude = "and name != 'default'";
}
$ignore_exclude ? $exclude_option = "adi_menu_exclude = 0 or adi_menu_exclude = 1" : ($exclude_option = "adi_menu_exclude = 0");
$rs = safe_rows_start('name,title,adi_menu_parent,adi_menu_clone,adi_menu_title', 'txp_section', "{$exclude_option} {$exclude} order by " . $sort);
}
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
extract($a);
// sets 'name','title','adi_menu_parent' etc in $a
$a['url'] = pagelinkurl(array('s' => $name));
// add url to $a
$out[$name] = $a;
}
if ($out && $default_title && $include_default) {
// set default section title
$out['default']['title'] = $default_title;
}
if ($out && $default_first && $include_default) {
// shift default section to beginning
$remember['default'] = $out['default'];
// remember 'default' element
unset($out['default']);
// remove 'default' element
$out = array_merge($remember, $out);
// join together, 'default' now at beginning
}
return $out;
}
}