本文整理汇总了PHP中doSpecial函数的典型用法代码示例。如果您正苦于以下问题:PHP doSpecial函数的具体用法?PHP doSpecial怎么用?PHP doSpecial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doSpecial函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wet_article_partial_category_1
/**
* Fiddle with the article's category selects
*/
function wet_article_partial_category_1($rs)
{
static $cats = null;
if ($cats == null) {
$cats = getTree('root', 'article');
}
// Make radio buttons, not drop-downs
$out = array();
if ($cats) {
foreach ($cats as $c) {
$c = doSpecial($c);
$id = 'wet_cat-' . $c['name'];
$out[] = radio('Category1', $c['name'], $rs['Category1'] == $c['name'] ? '1' : '', 'cat-' . $c['name']) . "<label for='{$id}'>{$c['title']}</label>";
}
}
return '<ul class="plain-list"><li>' . join('</li><li>', $out) . '</li></ul>';
}
示例2: asyncHref
/**
* Render a link element to hook up txpAsyncHref() with request parameters
*
* @param string $item Link text
* @param array $parms Request parameters; array keys are 'event', 'step', 'thing', 'property'
* @param string $atts HTML attributes
* @return string HTML
* @since 4.5.0
* @see textpattern.js: txpAsyncHref
*/
function asyncHref($item, $parms, $atts = '')
{
extract(doSpecial(lAtts(array('event' => $GLOBALS['event'], 'step' => $GLOBALS['step'], 'thing' => '', 'property' => ''), $parms)));
$class = "{$step} async";
$href = "?event={$event}&step={$step}&thing={$thing}&property={$property}";
if (AJAXALLY_CHALLENGED) {
$href .= '&value=' . txpspecialchars($item) . '&_txp_token=' . form_token();
}
return href($item, $href, $atts . " class=\"{$class}\"");
}
示例3: linklist
function linklist($atts)
{
global $thislink;
extract(lAtts(array('form' => 'plainlinks', 'sort' => 'linksort', 'label' => '', 'break' => '', 'limit' => '', 'wraptag' => '', 'category' => '', 'class' => __FUNCTION__), $atts));
$Form = fetch_form($form);
$qparts = array($category ? "category='{$category}'" : '1', "order by", $sort, $limit ? "limit {$limit}" : '');
$rs = safe_rows_start("*", "txp_link", join(' ', $qparts));
if ($rs) {
if ($label) {
$outlist[] = $label;
}
while ($a = nextRow($rs)) {
extract($a);
$linkname = str_replace("& ", "& ", $linkname);
$link = '<a href="' . doSpecial($url) . '">' . $linkname . '</a>';
$linkdesctitle = '<a href="' . doSpecial($url) . '" title="' . $description . '">' . $linkname . '</a>';
$thislink = $a;
$out = str_replace("<txp:link />", $link, $Form);
$out = str_replace("<txp:linkdesctitle />", $linkdesctitle, $out);
$out = str_replace("<txp:link_description />", $description, $out);
$outlist[] = parse($out);
}
if (!empty($outlist)) {
return doWrap($outlist, $wraptag, $break, $class);
}
}
return false;
}
示例4: rss
function rss()
{
global $prefs, $txpac;
extract($prefs);
ob_start();
extract(doSlash(gpsa(array('category', 'section', 'limit', 'area'))));
// send a 304 if nothing has changed since the last visit
$last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
$last = gmdate("D, d M Y H:i:s \\G\\M\\T", $last);
header("Last-Modified: {$last}");
$hims = serverset('HTTP_IF_MODIFIED_SINCE');
if ($hims == $last) {
header("HTTP/1.1 304 Not Modified");
exit;
}
$area = gps('area');
$sitename .= $section ? ' - ' . $section : '';
$sitename .= $category ? ' - ' . $category : '';
$out[] = tag(doSpecial($sitename), 'title');
$out[] = tag('http://' . $siteurl . $path_from_root, 'link');
$out[] = tag(doSpecial($site_slogan), 'description');
if (!$area or $area == 'article') {
$sfilter = $section ? "and Section = '" . $section . "'" : '';
$cfilter = $category ? "and (Category1='" . $category . "' or Category2='" . $category . "')" : '';
$limit = $limit ? $limit : '5';
$frs = safe_column("name", "txp_section", "in_rss != '1'");
if ($frs) {
foreach ($frs as $f) {
$query[] = "and Section != '" . $f . "'";
}
}
$query[] = $sfilter;
$query[] = $cfilter;
$rs = safe_rows("*", "textpattern", "Status = 4 " . join(' ', $query) . "and Posted < now() order by Posted desc limit {$limit}");
if ($rs) {
foreach ($rs as $a) {
extract($a);
$Body = !$txpac['syndicate_body_or_excerpt'] ? $Body_html : $Excerpt;
$Body = !trim($Body) ? $Body_html : $Body;
$Body = str_replace('href="/', 'href="http://' . $siteurl . '/', $Body);
$Body = htmlspecialchars($Body, ENT_NOQUOTES);
$link = $url_mode == 0 ? 'http://' . $siteurl . $path_from_root . 'index.php?id=' . $ID : 'http://' . $siteurl . $path_from_root . $Section . '/' . $ID . '/';
if ($txpac['show_comment_count_in_feed']) {
$dc = getCount('txp_discuss', "parentid={$ID} and visible=1");
$count = $dc > 0 ? ' [' . $dc . ']' : '';
} else {
$count = '';
}
$Title = doSpecial($Title) . $count;
$item = tag(strip_tags($Title), 'title') . n . tag($Body, 'description') . n . tag($link, 'link');
$out[] = tag($item, 'item');
}
header("Content-Type: text/xml");
return '<rss version="0.92">' . tag(join(n, $out), 'channel') . '</rss>';
}
} elseif ($area == 'link') {
$cfilter = $category ? "category='{$category}'" : '1';
$limit = $limit ? $limit : 15;
$rs = safe_rows("*", "txp_link", "{$cfilter} order by date desc limit {$limit}");
if ($rs) {
foreach ($rs as $a) {
extract($a);
$item = tag(doSpecial($linkname), 'title') . n . tag(doSpecial($description), 'description') . n . tag($url, 'link');
$out[] = tag($item, 'item');
}
header("Content-Type: text/xml");
return '<rss version="0.92">' . tag(join(n, $out), 'channel') . '</rss>';
}
}
return 'no articles recorded yet';
}
示例5: render_feed
function render_feed($rs, $area, $type, $feedtitle, $atom_self_ref, $atom_id_ext)
{
global $prefs, $thisarticle;
extract($prefs);
set_error_handler('tagErrorHandler');
$atom = $type == 'atom';
if ($atom) {
define("t_texthtml", ' type="text/html"');
define("t_text", ' type="text"');
define("t_html", ' type="html"');
define("t_xhtml", ' type="xhtml"');
define('t_appxhtml', ' type="xhtml"');
define("r_relalt", ' rel="alternate"');
define("r_relself", ' rel="self"');
} else {
define("t_texthtml", '');
define("t_text", '');
define("t_html", '');
define("t_xhtml", '');
define('t_appxhtml', '');
define("r_relalt", '');
define("r_relself", '');
}
$dn = explode('/', $siteurl);
$mail_or_domain = $use_mail_on_feeds_id ? eE($blog_mail_uid) : $dn[0];
$last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
if ($atom) {
$out[] = tag('Textpattern', 'generator', ' uri="http://textpattern.com/" version="' . $version . '"');
$out[] = tag(htmlspecialchars($feedtitle), 'title', t_text);
$out[] = tag(htmlspecialchars($site_slogan), 'subtitle', t_text);
$out[] = tag(safe_strftime("w3cdtf", $last), 'updated');
$out[] = '<link' . r_relself . ' href="' . $atom_self_ref . '" />';
$out[] = '<link' . r_relalt . t_texthtml . ' href="' . hu . '" />';
//Atom feeds with mail or domain name
$out[] = tag('tag:' . $mail_or_domain . ',' . $blog_time_uid . ':' . $blog_uid . $atom_id_ext, 'id');
$pub = safe_row("RealName, email", "txp_users", "privs=1");
$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');
} else {
$out[] = tag('http://textpattern.com/?v=' . $version, 'generator');
$out[] = tag(doSpecial($feedtitle), 'title');
$out[] = tag(doSpecial($site_slogan), 'description');
$out[] = tag(safe_strftime('rfc822', $last), 'pubDate');
$out[] = tag(hu, 'link');
$out[] = '<atom:link href="' . $atom_self_ref . '" rel="self" type="application/rss+xml" />';
}
$out[] = callback_event($atom ? 'atom_head' : 'rss_head');
$articles = array();
if (!$area or $area == 'article') {
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
populateArticleData($a);
$cb = callback_event($atom ? 'atom_entry' : 'rss_entry');
$e = array();
$thisauthor = doSpecial(get_author_name($AuthorID));
$thisauthor = tag($thisauthor, $atom ? 'name' : 'dc:creator');
if ($atom) {
$thisauthor = tag(n . t . t . t . $thisauthor . n . t . t, 'author');
}
$e['thisauthor'] = $thisauthor;
if ($atom) {
$e['issued'] = tag(safe_strftime('w3cdtf', $uPosted), 'published');
} else {
$e['issued'] = tag(safe_strftime('rfc822', $uPosted), 'pubDate');
}
if ($atom) {
$e['modified'] = tag(safe_strftime('w3cdtf', $uLastMod), 'updated');
$e['category1'] = trim($Category1) ? '<category term="' . doSpecial($Category1) . '" />' : '';
$e['category2'] = trim($Category2) ? '<category term="' . doSpecial($Category2) . '" />' : '';
}
$count = '';
if ($show_comment_count_in_feed && $comments_count > 0) {
$count = ' [' . $comments_count . ']';
}
$escaped_title = $atom ? htmlspecialchars($Title) : htmlspecialchars(strip_tags($Title));
$e['title'] = tag($escaped_title . $count, 'title', t_html);
$a['posted'] = $uPosted;
$permlink = permlinkurl($a);
if ($atom) {
$e['link'] = '<link' . r_relalt . t_texthtml . ' href="' . $permlink . '" />';
} else {
$e['link'] = tag($permlink, 'link');
}
$e['id'] = tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $blog_uid . '/' . $uid, $atom ? 'id' : 'guid', $atom ? '' : ' isPermaLink="false"');
$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 (trim($summary)) {
$e['summary'] = tag(n . escape_cdata($summary) . n, $atom ? 'summary' : 'description', t_html);
}
if (trim($content)) {
//.........这里部分代码省略.........
示例6: author_list
function author_list()
{
global $txp_user;
echo n . n . hed(gTxt('authors'), 3, ' style="text-align: center;"') . n . n . startTable('list') . n . tr(n . hCell(gTxt('real_name')) . n . hCell(gTxt('login_name')) . n . hCell(gTxt('email')) . n . hCell(gTxt('privileges')) . n . hCell() . n . hCell());
$rs = safe_rows_start('*', 'txp_users', '1 = 1 order by name asc');
if ($rs) {
if (has_privs('admin.edit')) {
while ($a = nextRow($rs)) {
extract($a);
echo n . n . '<tr>' . n . '<form method="post" action="index.php">' . n . td(fInput('text', 'RealName', $RealName, 'edit')) . td(htmlspecialchars($name)) . td(fInput('text', 'email', $email, 'edit'));
if ($name != $txp_user) {
echo td(privs($privs) . sp . popHelp('about_privileges'));
} else {
echo td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs));
}
echo td(fInput('submit', 'save', gTxt('save'), 'smallerbox')) . n . hInput('user_id', $user_id) . n . eInput('admin') . n . sInput('author_save') . n . '</form>';
if ($name != $txp_user) {
echo td(dLink('admin', 'author_delete', 'user_id', $user_id));
} else {
echo td();
}
echo n . '</tr>';
}
} else {
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td($RealName) . td($name) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs) . sp . popHelp('about_privileges') . hInput('privs', $privs)) . td() . td());
}
}
echo n . endTable();
}
}
示例7: 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;
}
}
}
//.........这里部分代码省略.........
示例8: author_list
function author_list()
{
global $txp_user, $author_list_pageby;
extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
if (!in_array($sort, array('name', 'RealName', 'email', 'privs', 'last_login'))) {
$sort = 'name';
}
$dir = $dir == 'desc' ? 'desc' : 'asc';
$sort_sql = $sort . ' ' . $dir;
$switch_dir = $dir == 'desc' ? 'asc' : 'desc';
$total = getCount('txp_users', '1=1');
$limit = max($author_list_pageby, 15);
list($page, $offset, $numPages) = pager($total, $limit, $page);
$rs = safe_rows_start('*, unix_timestamp(last_access) as last_login', 'txp_users', '1 = 1 order by ' . $sort_sql . ' limit ' . $offset . ', ' . $limit);
if ($rs) {
echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">' . startTable('list') . tr(column_head('login_name', 'name', 'admin', true, $switch_dir, '', '', 'name' == $sort ? $dir : '') . column_head('real_name', 'RealName', 'admin', true, $switch_dir, '', '', 'RealName' == $sort ? $dir : '') . column_head('email', 'email', 'admin', true, $switch_dir, '', '', 'email' == $sort ? $dir : '') . column_head('privileges', 'privs', 'admin', true, $switch_dir, '', '', 'privs' == $sort ? $dir : '') . column_head('last_login', 'last_login', 'admin', true, $switch_dir, '', '', 'last_login' == $sort ? $dir : '') . hCell() . hCell());
while ($a = nextRow($rs)) {
extract(doSpecial($a));
echo tr(td($name) . td($RealName) . td('<a href="mailto:' . $email . '">' . $email . '</a>') . td(get_priv_level($privs)) . td($last_login ? safe_strftime('%b %Y', $last_login) : '') . td(has_privs('admin.edit') ? eLink('admin', 'author_edit', 'user_id', $user_id, gTxt('edit')) : '') . td((has_privs('admin.edit') and $txp_user != $a['name']) ? fInput('checkbox', 'selected[]', $a['name']) : ''));
}
echo n . n . tr(tda(select_buttons() . author_multiedit_form($page, $sort, $dir, $crit, $search_method), ' colspan="6" style="text-align: right; border: none;"')) . endTable() . '</form>' . nav_form('admin', $page, $numPages, $sort, $dir, $crit, $search_method) . pageby_form('admin', $author_list_pageby);
}
}
示例9: link_url
function link_url()
{
global $thislink;
assert_link();
return doSpecial($thislink['url']);
}
示例10: makeConfig
function makeConfig($ar)
{
define("nl", "';\n");
define("o", '$txpcfg[\'');
define("m", "'] = '");
$open = chr(60) . '?php';
$close = '?' . chr(62);
// Escape single quotes and backslashes in literal PHP strings
foreach ($ar as $k => $v) {
$ar[$k] = addcslashes($ar[$k], "'\\");
}
$ar = doSpecial($ar);
extract($ar);
return $open . "\n" . o . 'db' . m . $ddb . nl . o . 'user' . m . $duser . nl . o . 'pass' . m . $dpass . nl . o . 'host' . m . $dhost . nl . ($dclient_flags ? o . 'client_flags' . "'] = " . $dclient_flags . ";\n" : '') . o . 'table_prefix' . m . $dprefix . nl . o . 'txpath' . m . txpath . nl . o . 'dbcharset' . m . $dbcharset . nl . $close;
}
示例11: atom
function atom()
{
global $thisarticle;
extract($GLOBALS['prefs']);
define("textplain", ' type="text/plain"');
define("texthtml", ' type="text/html"');
define("relalt", ' rel="alternate"');
define('appxhtml', ' type="application/xhtml+xml"');
define("divxhtml", '<div xmlns="http://www.w3.org/1999/xhtml">');
$area = doSlash(gps('area'));
extract(doSlash(gpsa(array('category', 'section', 'limit'))));
$last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
$sitename .= $section ? ' - ' . $section : '';
$sitename .= $category ? ' - ' . $category : '';
$pub = safe_row("RealName, email", "txp_users", "privs=1");
$out[] = tag($sitename, 'title', textplain);
$out[] = tag($site_slogan, 'tagline', textplain);
$out[] = '<link' . relalt . texthtml . ' href="' . hu . '" />';
$articles = array();
//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 ? '/' . $section : '') . ($category ? '/' . $category : ''), 'id');
$out[] = tag('Textpattern', 'generator', ' url="http://textpattern.com" version="' . $version . '"');
$out[] = tag(date("Y-m-d\\TH:i:s\\Z", $last), 'modified');
$auth[] = tag($pub['RealName'], 'name');
$auth[] = $include_email_atom ? tag(eE($pub['email']), 'email') : '';
$auth[] = tag(hu, 'url');
$out[] = tag(n . t . t . join(n . t . t, $auth) . n, 'author');
if (!$area or $area == 'article') {
$sfilter = $section ? "and Section = '" . $section . "'" : '';
$cfilter = $category ? "and (Category1='" . $category . "' or Category2='" . $category . "')" : '';
$limit = $limit ? $limit : '5';
$frs = safe_column("name", "txp_section", "in_rss != '1'");
foreach ($frs as $f) {
$query[] = "and Section != '" . $f . "'";
}
$query[] = $sfilter;
$query[] = $cfilter;
$rs = safe_rows_start("*, \n\t\t\t\tID as thisid, \n\t\t\t\tunix_timestamp(Posted) as uPosted,\n\t\t\t\tunix_timestamp(LastMod) as uLastMod", "textpattern", "Status=4 and Posted <= now() " . join(' ', $query) . "order by Posted desc limit {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
populateArticleData($a);
$a['posted'] = $uPosted;
if ($show_comment_count_in_feed) {
$dc = getCount('txp_discuss', "parentid={$ID} and visible=1");
$count = $dc > 0 ? ' [' . $dc . ']' : '';
} else {
$count = '';
}
$thisauthor = safe_field("RealName", "txp_users", "name='{$AuthorID}'");
$e['thisauthor'] = tag(n . t . t . t . tag(htmlspecialchars($thisauthor), 'name') . n . t . t, 'author');
$e['issued'] = tag(gmdate("Y-m-d\\TH:i:s\\Z", $uPosted), 'issued');
$e['modified'] = tag(gmdate("Y-m-d\\TH:i:s\\Z", $uLastMod), 'modified');
$escaped_title = safe_hed($Title);
$escaped_title = preg_replace("/&(?![#a-z0-9]+;)/i", '&', $escaped_title);
$escaped_title = str_replace('<', '<', $escaped_title);
$escaped_title = str_replace('>', '>', $escaped_title);
$e['title'] = tag($escaped_title . $count, 'title');
$uTitle = $url_title ? $url_title : stripSpace($Title);
$uTitle = htmlspecialchars($uTitle, ENT_NOQUOTES);
$permlink = permlinkurl($a);
$e['link'] = '<link' . relalt . texthtml . ' href="' . $permlink . '" />';
$e['id'] = tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $blog_uid . '/' . $uid, 'id');
$e['subject'] = tag(htmlspecialchars($Category1), 'dc:subject');
// pull Body or Excerpt?
$Body = !$syndicate_body_or_excerpt ? $thisarticle['body'] : $thisarticle['excerpt'];
// if Excerpt is empty, switch back to Body_html
$Body = !trim($Body) ? $thisarticle['body'] : $Body;
// fix relative urls
$Body = str_replace('href="/', 'href="' . hu, $Body);
$Body = preg_replace("/href=\\\"#(.*)\"/", "href=\"" . permlinkurl($a) . "#\\1\"", $Body);
$Body = safe_hed($Body);
// encode and entify
$Body = preg_replace(array('/</', '/>/', "/'/", '/"/'), array('<', '>', ''', '"'), $Body);
// encode bare ampersands
$Body = preg_replace("/&(?![#0-9]+;|\\w+;)/i", '&', $Body);
$e['content'] = tag(n . $Body . n, 'content', ' type="text/html" mode="escaped"');
$articles[$ID] = tag(n . t . t . join(n . t . t, $e) . n, 'entry');
$etags[$ID] = strtoupper(dechex(crc32($articles[$ID])));
$dates[$ID] = $uLastMod;
}
}
} elseif ($area == 'link') {
$cfilter = $category ? "category='{$category}'" : '1';
$limit = $limit ? $limit : 15;
$rs = safe_rows_start("*", "txp_link", "{$cfilter} order by date desc limit {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
$e['title'] = tag(doSpecial($linkname), 'title');
$content = utf8_encode(htmlspecialchars($description));
$e['content'] = tag(n . $description . n, 'content', ' type="text/html" mode="escaped"');
$url = preg_replace("/^\\/(.*)/", "http://{$siteurl}/\$1", $url);
$url = preg_replace("/&((?U).*)=/", "&\\1=", $url);
$e['link'] = '<link' . relalt . texthtml . ' href="' . $url . '" />';
$e['issued'] = tag(gmdate("Y-m-d\\TH:i:s\\Z", $date), 'issued');
$e['modified'] = tag(gmdate("Y-m-d\\TH:i:s\\Z", $date), 'modified');
$e['id'] = tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $id, 'id');
//.........这里部分代码省略.........
示例12: linkdesctitle
function linkdesctitle($atts)
{
global $thislink;
extract(lAtts(array('rel' => ''), $atts));
$description = $thislink['description'] ? ' title="' . escape_output($thislink['description']) . '"' : '';
return tag(escape_output($thislink['linkname']), 'a', ($rel ? ' rel="' . $rel . '"' : '') . ' href="' . doSpecial($thislink['url']) . '"' . $description);
}
示例13: atom
function atom()
{
global $txpac;
extract($GLOBALS['prefs']);
define("textplain", ' type="text/plain"');
define("texthtml", ' type="text/html"');
define("relalt", ' rel="alternate"');
define('appxhtml', ' type="application/xhtml+xml"');
define("divxhtml", '<div xmlns="http://www.w3.org/1999/xhtml">');
$area = gps('area');
extract(doSlash(gpsa(array('category', 'section', 'limit'))));
$last = fetch('unix_timestamp(val)', 'txp_prefs', 'name', 'lastmod');
$sitename .= $section ? ' - ' . $section : '';
$sitename .= $category ? ' - ' . $category : '';
$out[] = tag($sitename, 'title', textplain);
$out[] = tag($site_slogan, 'tagline', textplain);
$out[] = '<link' . relalt . texthtml . ' href="http://' . $siteurl . $path_from_root . '" />';
$out[] = tag('tag:' . $siteurl . ',' . date("Y") . ':/', 'id');
$out[] = tag('Textpattern', 'generator', ' url="http://textpattern.com" version="g1.17"');
$out[] = tag(date("Y-m-d\\TH:i:s\\Z", $last), 'modified');
$pub = safe_row("RealName, email", "txp_users", "privs=1");
$auth[] = tag($pub['RealName'], 'name');
$auth[] = $txpac['include_email_atom'] ? tag(eE($pub['email']), 'email') : '';
$auth[] = tag('http://' . $siteurl . $path_from_root, 'url');
$out[] = tag(n . t . t . join(n . t . t, $auth) . n, 'author');
if (!$area or $area == 'article') {
$sfilter = $section ? "and Section = '" . $section . "'" : '';
$cfilter = $category ? "and (Category1='" . $category . "' or Category2='" . $category . "')" : '';
$limit = $limit ? $limit : '5';
$frs = safe_column("name", "txp_section", "in_rss != '1'");
foreach ($frs as $f) {
$query[] = "and Section != '" . $f . "'";
}
$query[] = $sfilter;
$query[] = $cfilter;
$rs = safe_rows("*, unix_timestamp(Posted) as uPosted,unix_timestamp(LastMod) as uLastMod", "textpattern", "Status=4 and Posted <= now() " . join(' ', $query) . "order by Posted desc limit {$limit}");
if ($rs) {
foreach ($rs as $a) {
extract($a);
if ($txpac['show_comment_count_in_feed']) {
$dc = getCount('txp_discuss', "parentid={$ID} and visible=1");
$count = $dc > 0 ? ' [' . $dc . ']' : '';
} else {
$count = '';
}
$e['issued'] = tag(date("Y-m-d\\TH:i:s\\Z", $uPosted), 'issued');
$e['modified'] = tag(date("Y-m-d\\TH:i:s\\Z", $uLastMod), 'modified');
$e['title'] = tag($Title . $count, 'title');
$elink = $url_mode == 0 ? 'http://' . $siteurl . $path_from_root . 'index.php?id=' . $ID : 'http://' . $siteurl . $path_from_root . $Section . '/' . $ID . '/';
$e['link'] = '<link' . relalt . texthtml . ' href="' . $elink . '" />';
$e['id'] = tag('tag:' . $siteurl . ',' . date("Y-m-d", $uPosted) . ':' . $ID, 'id');
$e['subject'] = tag(htmlspecialchars($Category1), 'dc:subject');
// pull Body or Excerpt?
$Body = !$txpac['syndicate_body_or_excerpt'] ? $Body_html : $Excerpt;
// if Excerpt is empty, switch back to Body_html
$Body = !trim($Body) ? $Body_html : $Body;
// fix relative urls
$Body = str_replace('href="/', 'href="http://' . $siteurl . '/', $Body);
// encode and entify
$Body = utf8_encode(htmlspecialchars($Body));
$e['content'] = tag(n . $Body . n, 'content', ' type="text/html" mode="escaped" xml:lang="en"');
$out[] = tag(n . t . t . join(n . t . t, $e) . n, 'entry');
}
}
} elseif ($area == 'link') {
$cfilter = $category ? "category='{$category}'" : '1';
$limit = $limit ? $limit : 15;
$rs = safe_rows("*", "txp_link", "{$cfilter} order by date desc limit {$limit}");
if ($rs) {
foreach ($rs as $a) {
extract($a);
$e['title'] = tag(doSpecial($linkname), 'title');
$content = utf8_encode(htmlspecialchars($description));
$e['content'] = tag(n . $description . n, 'content', ' type="text/html" mode="escaped" xml:lang="en"');
$url = preg_replace("/^\\/(.*)/", "http://{$siteurl}/\$1", $url);
$e['link'] = '<link' . relalt . texthtml . ' href="' . $url . '" />';
$out[] = tag(n . t . t . join(n . t . t, $e) . n, 'entry');
}
}
}
if (!empty($out)) {
ob_start();
header('Content-type: text/xml');
return chr(60) . '?xml version="1.0" encoding="UTF-8"?' . chr(62) . n . '<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">' . join(n, $out) . '</feed>';
}
}
示例14: linkdesctitle
function linkdesctitle($atts)
{
global $thislink;
assert_link();
extract(lAtts(array('rel' => ''), $atts));
$description = $thislink['description'] ? ' title="' . htmlspecialchars($thislink['description']) . '"' : '';
return tag(htmlspecialchars($thislink['linkname']), 'a', ($rel ? ' rel="' . $rel . '"' : '') . ' href="' . doSpecial($thislink['url']) . '"' . $description);
}
示例15: atom
//.........这里部分代码省略.........
$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) . '" />' : '';
$Excerpt = fixup_for_feed($thisarticle['excerpt'], permlinkurl($a));
if ($syndicate_body_or_excerpt == 0) {
$Body = fixup_for_feed($thisarticle['body'], permlinkurl($a));
} else {
$Body = '';
// If there's no excerpt, use body as content instead of body as summary
if (!trim($Excerpt)) {
$Body = fixup_for_feed($thisarticle['body'], permlinkurl($a));
}
}
if (trim($Body)) {
$e['content'] = tag(n . $Body . n, 'content', t_html);
}
if (trim($Excerpt)) {
$e['summary'] = tag(n . $Excerpt . n, 'summary', t_html);
}
$articles[$ID] = tag(n . t . t . join(n . t . t, $e) . n, 'entry');
$etags[$ID] = strtoupper(dechex(crc32($articles[$ID])));
$dates[$ID] = $uLastMod;
}
}
} elseif ($area == 'link') {
$cfilter = $category ? "category='" . $category . "'" : '1';
$limit = $limit ? $limit : $rss_how_many;
$limit = min($limit, max(100, $rss_how_many));
$rs = safe_rows_start("*", "txp_link", "{$cfilter} order by date desc limit {$limit}");
if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
$e['title'] = tag(doSpecial($linkname), 'title');
$content = utf8_encode(htmlspecialchars($description));
$e['content'] = tag(n . $description . n, 'content', t_texthtml);
$url = preg_replace("/^\\/(.*)/", "http://{$siteurl}/\$1", $url);
$url = preg_replace("/&((?U).*)=/", "&\\1=", $url);
$e['link'] = '<link' . r_relalt . t_texthtml . ' href="' . $url . '" />';
$e['issued'] = tag(gmdate('Y-m-d\\TH:i:s\\Z', strtotime($date)), 'published');
$e['modified'] = tag(gmdate('Y-m-d\\TH:i:s\\Z', strtotime($date)), 'updated');
$e['id'] = tag('tag:' . $mail_or_domain . ',' . $feed_time . ':' . $id, 'id');
$articles[$id] = tag(n . t . t . join(n . t . t, $e) . n, 'entry');
$etags[$id] = strtoupper(dechex(crc32($articles[$id])));
$dates[$id] = $date;
}
}
}
if (!empty($articles)) {
//turn on compression if we aren't using it already
if (extension_loaded('zlib') && ini_get("zlib.output_compression") == 0 && ini_get('output_handler') != 'ob_gzhandler' && !headers_sent()) {
@ob_start("ob_gzhandler");
}
$expires = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 3600 * 1);
header("Expires: {$expires}");
$hims = serverset('HTTP_IF_MODIFIED_SINCE');
$imsd = $hims ? strtotime($hims) : 0;
if ($imsd >= $last) {
txp_status_header("304 Not Modified");
exit;
}
header("Last-Modified: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last));
if (is_callable('apache_request_headers')) {
$headers = apache_request_headers();
if (isset($headers["A-IM"])) {
$canaim = strpos($headers["A-IM"], "feed");