本文整理汇总了PHP中get_passage函数的典型用法代码示例。如果您正苦于以下问题:PHP get_passage函数的具体用法?PHP get_passage怎么用?PHP get_passage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_passage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: plugin_recent_convert
function plugin_recent_convert()
{
global $vars, $date_format, $_recent_plugin_frame, $show_passage;
static $exec_count = 1;
$recent_lines = PLUGIN_RECENT_DEFAULT_LINES;
if (func_num_args()) {
$args = func_get_args();
if (!is_numeric($args[0]) || isset($args[1])) {
return PLUGIN_RECENT_USAGE . '<br />';
} else {
$recent_lines = $args[0];
}
}
// Show only N times
if ($exec_count > PLUGIN_RECENT_EXEC_LIMIT) {
return '#recent(): You called me too much' . '<br />' . "\n";
} else {
++$exec_count;
}
if (!file_exists(PLUGIN_RECENT_CACHE)) {
return '#recent(): Cache file of RecentChanges not found' . '<br />';
}
// Get latest N changes
$lines = file_head(PLUGIN_RECENT_CACHE, $recent_lines);
if ($lines == FALSE) {
return '#recent(): File can not open' . '<br />' . "\n";
}
$script = get_script_uri();
$date = $items = '';
foreach ($lines as $line) {
list($time, $page) = explode("\t", rtrim($line));
$_date = get_date($date_format, $time);
if ($date != $_date) {
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
// New day
$date = $_date;
$items .= '<strong>' . $date . '</strong>' . "\n" . '<ul class="recent_list">' . "\n";
}
$s_page = htmlsc($page);
if ($page == $vars['page']) {
// No need to link to the page you just read, or notify where you just read
$items .= ' <li>' . $s_page . '</li>' . "\n";
} else {
$r_page = rawurlencode($page);
$passage = $show_passage ? ' ' . get_passage($time) : '';
$items .= ' <li><a href="' . $script . '?' . $r_page . '"' . ' title="' . $s_page . $passage . '">' . $s_page . '</a></li>' . "\n";
}
}
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
return sprintf($_recent_plugin_frame, count($lines), $items);
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:57,代码来源:recent.inc.php
示例2: plugin_loglist_convert
function plugin_loglist_convert()
{
global $script, $log;
global $vars;
global $_loglist_messages;
list($kind) = func_get_args();
$kind = empty($kind) ? 'update' : htmlsc($kind, ENT_QUOTES);
if (!$log[$kind]['use']) {
return $_loglist_messages['not_active'];
}
if (!empty($log[$kind]['file'])) {
$vars['kind'] = $kind;
$rc = do_plugin_action('logview');
return $rc['body'];
}
$dir = log::get_filename($kind, '', '');
$pages = Auth::get_existpages($dir);
if (count($pages) == 0) {
return $_loglist_messages['msg_not_found'];
}
$data = array();
foreach ($pages as $_real => $_page) {
$data[] = array(filemtime($dir . '/' . $_real), $_page, log_count($kind, $_page));
}
usort($data, function ($a, $b) {
return $b[0] - $a[0];
});
// D
// usort($data,create_function('$a,$b','return $a[0] - $b[0];')); // A
//$str_view = $script.'?plugin=logview&kind='.$kind.'&page=';
$str_view = get_cmd_uri('logview', $_page, null, array('kind' => $kind));
$rc = '';
$rc .= '|' . $_loglist_messages['fld_UTIME'] . '|' . $_loglist_messages['fld_PAGE'] . '|' . $_loglist_messages['fld_COUNT'] . "|h\n";
foreach ($data as $_line) {
$i = 0;
foreach ($_line as $_field) {
$rc .= '|';
switch ($i) {
case 0:
$rc .= get_date('Y-m-d H:i:s', $_field) . ' ' . get_passage($_field);
continue;
case 1:
$rc .= '[' . $str_view . rawurlencode($_field) . ' ' . $_field . ']';
continue;
default:
$rc .= $_field;
}
$i++;
}
$rc .= "|\n";
}
return RendererFactory::factory($rc);
}
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:53,代码来源:loglist.inc.php
示例3: plugin_passage_inline
function plugin_passage_inline()
{
$argv = func_get_args();
$argc = func_num_args();
$field = array('time', 'paren');
for ($i = 0; $i < $argc; $i++) {
${$field}[$i] = htmlspecialchars($argv[$i], ENT_QUOTES);
}
if (empty($time)) {
return '';
}
$paren = empty($paren) ? FALSE : TRUE;
return get_passage($time, $paren);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:14,代码来源:passage.inc.php
示例4: plugin_related_action
function plugin_related_action()
{
global $vars, $script, $defaultpage, $whatsnew;
$_page = isset($vars['page']) ? $vars['page'] : '';
if ($_page == '') {
$_page = $defaultpage;
}
// Get related from cache
$data = links_get_related_db($_page);
if (!empty($data)) {
// Hide by array keys (not values)
foreach (array_keys($data) as $page) {
if ($page == $whatsnew || check_non_list($page)) {
unset($data[$page]);
}
}
}
// Result
// kazuwaya
$r_word = rawurlencode($_page);
$s_word = htmlspecialchars($_page);
$msg = 'Backlinks for: ' . $s_word;
$retval = '<p><a href="' . $script . '?' . $r_word . '">' . 'Return to ' . $s_word . '</a></p>' . "\n";
if (empty($data)) {
$retval .= '<ul><li>No related pages found.</li></ul>' . "\n";
} else {
// Show count($data)?
ksort($data);
$retval .= '<ul>' . "\n";
foreach ($data as $page => $time) {
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$passage = get_passage($time);
$retval .= ' <li><a href="' . $script . '?' . $r_page . '">' . $s_page . '</a> ' . $passage . '</li>' . "\n";
}
$retval .= '</ul>' . "\n";
}
return array('msg' => $msg, 'body' => $retval);
}
开发者ID:lolo3-sight,项目名称:wiki,代码行数:39,代码来源:related.inc.php
示例5: plugin_related_action
function plugin_related_action()
{
global $vars, $script, $defaultpage, $whatsnew;
$qm = get_qm();
$_page = isset($vars['page']) ? $vars['page'] : '';
if ($_page == '') {
$_page = $defaultpage;
}
// Get related from cache
$data = links_get_related_db($_page);
if (!empty($data)) {
// Hide by array keys (not values)
foreach (array_keys($data) as $page) {
if ($page == $whatsnew || check_non_list($page)) {
unset($data[$page]);
}
}
}
// Result
$r_word = rawurlencode($_page);
$s_word = get_page_title($_page);
$msg = $qm->replace('plg_related.title', $s_word);
$retval = '<a href="' . $script . '?' . $r_word . '">' . $qm->replace('plg_related.link_back', $s_word) . '</a><br />' . "\n";
if (empty($data)) {
$retval .= '<ul><li>' . $qm->m['plg_related']['notfound'] . '</li></ul>' . "\n";
} else {
ksort($data);
$retval .= '<ul>' . "\n";
foreach ($data as $page => $time) {
$r_page = rawurlencode($page);
$s_page = get_page_title($page);
$passage = get_passage($time);
$retval .= ' <li><a href="' . $script . '?' . $r_page . '">' . $s_page . '</a> ' . $passage . '</li>' . "\n";
}
$retval .= '</ul>' . "\n";
}
return array('msg' => $msg, 'body' => $retval);
}
开发者ID:big2men,项目名称:qhm,代码行数:38,代码来源:related.inc.php
示例6: plugin_related_action
function plugin_related_action()
{
global $vars, $defaultpage;
$_page = isset($vars['page']) ? $vars['page'] : '';
if ($_page == '') {
$_page = $defaultpage;
}
// Get related from cache
$data = links_get_related_db($_page);
if (!empty($data)) {
// Hide by array keys (not values)
foreach (array_keys($data) as $page) {
if (is_cantedit($page) || check_non_list($page)) {
unset($data[$page]);
}
}
}
// Result
$s_word = htmlspecialchars($_page);
$msg = 'Backlinks for: ' . $s_word;
$retval = '<a href="' . get_page_uri($_page) . '">' . 'Return to ' . $s_word . '</a><br />' . "\n";
if (empty($data)) {
$retval .= '<ul><li>No related pages found.</li></ul>' . "\n";
} else {
// Show count($data)?
ksort($data, SORT_STRING);
$retval .= '<ul>' . "\n";
foreach ($data as $page => $time) {
$s_page = htmlspecialchars($page);
$passage = get_passage($time);
$retval .= ' <li><a href="' . get_page_uri($page) . '">' . $s_page . '</a> ' . $passage . '</li>' . "\n";
}
$retval .= '</ul>' . "\n";
}
return array('msg' => $msg, 'body' => $retval);
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:36,代码来源:related.inc.php
示例7: format_line
function format_line($line)
{
$desc = mb_strimwidth(preg_replace("/[\r\n]/", ' ', strip_tags($line['desc'])), 0, 255, '...');
if (IS_MOBILE) {
return '<li><a href="' . $line['link'] . '">' . $line['entry'] . '</a><span class="ui-count">' . get_passage($line['date']) . '</span></li>';
} else {
return '<li><a href="' . $line['link'] . '" title="' . $desc . ' ' . get_passage($line['date']) . '">' . $line['entry'] . '</a></li>';
}
}
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:9,代码来源:showrss.inc.php
示例8: do_search_fuzzy
function do_search_fuzzy($word, $type = 'AND', $non_format = FALSE, $non_fuzzy = FALSE)
{
global $whatsnew, $non_list, $search_non_list;
global $search_auth, $search_fuzzy;
static $fuzzypattern = array('ヴァ' => 'バ', 'ヴィ' => 'ビ', 'ヴェ' => 'ベ', 'ヴォ' => 'ボ', 'ヴ' => 'ブ', 'ヰ' => 'イ', 'ヱ' => 'エ', 'ヵ' => 'カ', 'ァ' => 'ア', 'ィ' => 'イ', 'ゥ' => 'ウ', 'ェ' => 'エ', 'ォ' => 'オ', 'ャ' => 'ヤ', 'ュ' => 'ユ', 'ョ' => 'ヨ');
$retval = array();
$b_type = $type == 'AND';
// AND:TRUE OR:FALSE
$keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
$_pages = get_existpages();
$pages = array();
$non_list_pattern = '/' . $non_list . '/';
foreach ($_pages as $page) {
if ($page == $whatsnew || !$search_non_list && preg_match($non_list_pattern, $page)) {
continue;
}
// 検索対象ページの制限をかけるかどうか (ページ名は制限外)
if ($search_auth && !check_readable($page, false, false)) {
$source = get_source();
// 検索対象ページ内容を空に。
} else {
$source = get_source($page);
}
if (!$non_format) {
array_unshift($source, $page);
}
// ページ名も検索対象に
$b_match = FALSE;
//miko modified
if (!$search_fuzzy || $non_fuzzy) {
foreach ($keys as $key) {
$tmp = preg_grep('/' . $key . '/', $source);
$b_match = !empty($tmp);
if ($b_match xor $b_type) {
break;
}
}
if ($b_match) {
$pages[$page] = get_filetime($page);
}
} else {
$fuzzy_from = array_keys($fuzzypattern);
$fuzzy_to = array_values($fuzzypattern);
$words = preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY);
$_source = mb_strtolower(mb_convert_kana(join("\n", $source), 'KVCas'));
for ($i = 0; $i < count($fuzzy_from); $i++) {
$_source = mb_ereg_replace($fuzzy_from[$i], $fuzzy_to[$i], $_source);
}
$_source = mb_ereg_replace('[ッー・゛゜、。]', '', $_source);
foreach ($keys as $key) {
$_keyword = mb_strtolower(mb_convert_kana($word, 'KVCas'));
for ($i = 0; $i < count($fuzzy_from); $i++) {
$_keyword = mb_ereg_replace($fuzzy_from[$i], $fuzzy_to[$i], $_keyword);
}
$_keyword = mb_ereg_replace('[ッー・゛゜、。]', '', $_keyword);
$b_match = mb_ereg(mb_ereg_quote($_keyword), $_source);
}
if ($b_match) {
$pages[$page] = get_filetime($page);
}
}
//miko modified
}
if ($non_format) {
return array_keys($pages);
}
$r_word = rawurlencode($word);
$s_word = htmlspecialchars($word);
if (empty($pages)) {
return str_replace('$1', $s_word, $_string['notfoundresult']);
}
ksort($pages);
$retval = '<ul>' . "\n";
foreach ($pages as $page => $time) {
$s_page = htmlspecialchars($page);
$passage = get_passage($time);
$retval .= ' <li><a href="' . get_page_uri($page, '', 'word=' . $r_word) . '">' . $s_page . '</a>' . $passage . '</li>' . "\n";
}
$retval .= '</ul>' . "\n";
$retval .= str_replace('$1', $s_word, str_replace('$2', count($pages), str_replace('$3', count($_pages), $b_type ? $_string['andresult'] : $_string['orresult'])));
return $retval;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:82,代码来源:fuzzy.php
示例9: make_related
function make_related($page, $tag = '')
{
global $vars, $rule_related_str, $related_str;
global $_ul_left_margin, $_ul_margin, $_list_pad_str;
$links = links_get_related($page);
if ($tag) {
ksort($links, SORT_STRING);
// Page name, alphabetical order
} else {
arsort($links, SORT_NUMERIC);
// Last modified date, newer
}
$_links = array();
foreach ($links as $page => $lastmod) {
if (check_non_list($page)) {
continue;
}
$s_page = htmlspecialchars($page);
$passage = get_passage($lastmod);
$_links[] = $tag ? '<a href="' . get_page_uri($page) . '" title="' . $s_page . ' ' . $passage . '">' . $s_page . '</a>' : '<a href="' . get_page_uri($page) . '">' . $s_page . '</a>' . $passage;
}
if (empty($_links)) {
return '';
}
// Nothing
if ($tag == 'p') {
// From the line-head
$margin = $_ul_left_margin + $_ul_margin;
$style = sprintf($_list_pad_str, 1, $margin, $margin);
$retval = "\n" . '<ul' . $style . '>' . "\n" . '<li>' . join($rule_related_str, $_links) . '</li>' . "\n" . '</ul>' . "\n";
} else {
if ($tag) {
$retval = join($rule_related_str, $_links);
} else {
$retval = join($related_str, $_links);
}
}
return $retval;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:39,代码来源:html.php
示例10: plugin_referer_body
function plugin_referer_body($page, $sort)
{
global $script;
$qm = get_qm();
$data = tb_get(tb_get_filename($page, '.ref'));
if (empty($data)) {
return '<p>no data.</p>';
}
$bg = plugin_referer_set_color();
$arrow_last = $arrow_1st = $arrow_ctr = '';
$color_last = $color_1st = $color_ctr = $color_ref = $bg['etc'];
$sort_last = '0d';
$sort_1st = '1d';
$sort_ctr = '2d';
switch ($sort) {
case '0d':
// 0d 最終更新日時(新着順)
usort($data, create_function('$a,$b', 'return $b[0] - $a[0];'));
$color_last = $bg['cur'];
$arrow_last = $qm->m['plg_referer']['down'];
$sort_last = '0a';
break;
case '0a':
// 0a 最終更新日時(日付順)
usort($data, create_function('$a,$b', 'return $a[0] - $b[0];'));
$color_last = $bg['cur'];
$arrow_last = $qm->m['plg_referer']['up'];
// $sort_last = '0d';
break;
case '1d':
// 1d 初回登録日時(新着順)
usort($data, create_function('$a,$b', 'return $b[1] - $a[1];'));
$color_1st = $bg['cur'];
$arrow_1st = $qm->m['plg_referer']['down'];
$sort_1st = '1a';
break;
case '1a':
// 1a 初回登録日時(日付順)
usort($data, create_function('$a,$b', 'return $a[1] - $b[1];'));
$color_1st = $bg['cur'];
$arrow_1st = $qm->m['plg_referer']['up'];
// $sort_1st = '1d';
break;
case '2d':
// 2d カウンタ(大きい順)
usort($data, create_function('$a,$b', 'return $b[2] - $a[2];'));
$color_ctr = $bg['cur'];
$arrow_ctr = $qm->m['plg_referer']['down'];
$sort_ctr = '2a';
break;
case '2a':
// 2a カウンタ(小さい順)
usort($data, create_function('$a,$b', 'return $a[2] - $b[2];'));
$color_ctr = $bg['cur'];
$arrow_ctr = $qm->m['plg_referer']['up'];
// $sort_ctr = '2d';
break;
case '3':
// 3 Referer
usort($data, create_function('$a,$b', 'return ($a[3] == $b[3]) ? 0 : (($a[3] > $b[3]) ? 1 : -1);'));
$color_ref = $bg['cur'];
break;
}
$body = '';
foreach ($data as $arr) {
// 0:最終更新日時, 1:初回登録日時, 2:参照カウンタ, 3:Referer ヘッダ, 4:利用可否フラグ(1は有効)
list($ltime, $stime, $count, $url, $enable) = $arr;
// 非ASCIIキャラクタ(だけ)をURLエンコードしておく BugTrack/440
$e_url = htmlspecialchars(preg_replace('/([" \\x80-\\xff]+)/e', 'rawurlencode("$1")', $url));
$s_url = htmlspecialchars(mb_convert_encoding(rawurldecode($url), SOURCE_ENCODING, 'auto'));
$lpass = get_passage($ltime, FALSE);
// 最終更新日時からの経過時間
$spass = get_passage($stime, FALSE);
// 初回登録日時からの経過時間
$ldate = get_date($qm->m['plg_referer']['date_format'], $ltime);
// 最終更新日時文字列
$sdate = get_date($qm->m['plg_referer']['date_format'], $stime);
// 初回登録日時文字列
$body .= ' <tr>' . "\n" . ' <td>' . $ldate . '</td>' . "\n" . ' <td>' . $lpass . '</td>' . "\n";
$body .= $count == 1 ? ' <td colspan="2">N/A</td>' . "\n" : ' <td>' . $sdate . '</td>' . "\n" . ' <td>' . $spass . '</td>' . "\n";
$body .= ' <td style="text-align:right;">' . $count . '</td>' . "\n";
// 適用不可データのときはアンカーをつけない
$body .= plugin_referer_ignore_check($url) ? ' <td>' . $s_url . '</td>' . "\n" : ' <td><a href="' . $e_url . '" rel="nofollow">' . $s_url . '</a></td>' . "\n";
$body .= ' </tr>' . "\n";
}
$href = $script . '?plugin=referer&page=' . rawurlencode($page);
return <<<EOD
<table border="1" cellspacing="1" summary="Referer">
<tr>
<td style="background-color:{$color_last}" colspan="2">
<a href="{$href}&sort={$sort_last}">{$qm->m['plg_referer']['lastupdate']}{$arrow_last}</a>
</td>
<td style="background-color:{$color_1st}" colspan="2">
<a href="{$href}&sort={$sort_1st}">{$qm->m['plg_referer']['firstdate']}{$arrow_1st}</a>
</td>
<td style="background-color:{$color_ctr};text-align:right">
<a href="{$href}&sort={$sort_ctr}">{$qm->m['plg_referer']['counter']}{$arrow_ctr}</a>
</td>
<td style="background-color:{$color_ref}">
<a href="{$href}&sort=3">{$qm->m['plg_referer']['referer']}</a>
//.........这里部分代码省略.........
开发者ID:big2men,项目名称:qhm,代码行数:101,代码来源:referer.inc.php
示例11: do_search
function do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
{
global $script, $whatsnew, $non_list, $search_non_list;
global $_msg_andresult, $_msg_orresult, $_msg_notfoundresult;
global $search_auth, $show_passage;
$retval = array();
$b_type = $type == 'AND';
// AND:TRUE OR:FALSE
$keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
foreach ($keys as $key => $value) {
$keys[$key] = '/' . $value . '/S';
}
$pages = get_existpages();
// Avoid
if ($base != '') {
$pages = preg_grep('/^' . preg_quote($base, '/') . '/S', $pages);
}
if (!$search_non_list) {
$pages = array_diff($pages, preg_grep('/' . $non_list . '/S', $pages));
}
$pages = array_flip($pages);
unset($pages[$whatsnew]);
$count = count($pages);
foreach (array_keys($pages) as $page) {
$b_match = FALSE;
// Search for page name
if (!$non_format) {
foreach ($keys as $key) {
$b_match = preg_match($key, $page);
if ($b_type xor $b_match) {
break;
}
// OR
}
if ($b_match) {
continue;
}
}
// Search auth for page contents
if ($search_auth && !check_readable($page, false, false)) {
unset($pages[$page]);
--$count;
}
// Search for page contents
foreach ($keys as $key) {
$b_match = preg_match($key, get_source($page, TRUE, TRUE));
if ($b_type xor $b_match) {
break;
}
// OR
}
if ($b_match) {
continue;
}
unset($pages[$page]);
// Miss
}
if ($non_format) {
return array_keys($pages);
}
$r_word = rawurlencode($word);
$s_word = htmlspecialchars($word);
if (empty($pages)) {
return str_replace('$1', $s_word, $_msg_notfoundresult);
}
ksort($pages);
$retval = '<ul>' . "\n";
foreach (array_keys($pages) as $page) {
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$passage = $show_passage ? ' ' . get_passage(get_filetime($page)) : '';
$retval .= ' <li><a href="' . $script . '?cmd=read&page=' . $r_page . '&word=' . $r_word . '">' . $s_page . '</a>' . $passage . '</li>' . "\n";
}
$retval .= '</ul>' . "\n";
$retval .= str_replace('$1', $s_word, str_replace('$2', count($pages), str_replace('$3', $count, $b_type ? $_msg_andresult : $_msg_orresult)));
return $retval;
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:77,代码来源:func.php
示例12: plugin_referer_body
function plugin_referer_body($page, $sort)
{
global $script, $_referer_msg;
global $referer;
$data = tb_get(tb_get_filename($page, '.ref'));
if (empty($data)) {
return '<p>no data.</p>';
}
$bg = plugin_referer_set_color();
$arrow_last = $arrow_1st = $arrow_ctr = '';
$color_last = $color_1st = $color_ctr = $color_ref = $bg['etc'];
$sort_last = '0d';
$sort_1st = '1d';
$sort_ctr = '2d';
switch ($sort) {
case '0d':
// 0d 最終更新日時(新着順)
usort($data, create_function('$a,$b', 'return $b[0] - $a[0];'));
$color_last = $bg['cur'];
$arrow_last = $_referer_msg['msg_Chr_darr'];
$sort_last = '0a';
break;
case '0a':
// 0a 最終更新日時(日付順)
usort($data, create_function('$a,$b', 'return $a[0] - $b[0];'));
$color_last = $bg['cur'];
$arrow_last = $_referer_msg['msg_Chr_uarr'];
// $sort_last = '0d';
break;
case '1d':
// 1d 初回登録日時(新着順)
usort($data, create_function('$a,$b', 'return $b[1] - $a[1];'));
$color_1st = $bg['cur'];
$arrow_1st = $_referer_msg['msg_Chr_darr'];
$sort_1st = '1a';
break;
case '1a':
// 1a 初回登録日時(日付順)
usort($data, create_function('$a,$b', 'return $a[1] - $b[1];'));
$color_1st = $bg['cur'];
$arrow_1st = $_referer_msg['msg_Chr_uarr'];
// $sort_1st = '1d';
break;
case '2d':
// 2d カウンタ(大きい順)
usort($data, create_function('$a,$b', 'return $b[2] - $a[2];'));
$color_ctr = $bg['cur'];
$arrow_ctr = $_referer_msg['msg_Chr_darr'];
$sort_ctr = '2a';
break;
case '2a':
// 2a カウンタ(小さい順)
usort($data, create_function('$a,$b', 'return $a[2] - $b[2];'));
$color_ctr = $bg['cur'];
$arrow_ctr = $_referer_msg['msg_Chr_uarr'];
// $sort_ctr = '2d';
break;
case '3':
// 3 Referer
usort($data, create_function('$a,$b', 'return ($a[3] == $b[3]) ? 0 : (($a[3] > $b[3]) ? 1 : -1);'));
$color_ref = $bg['cur'];
break;
}
$body = '';
$ctr = 0;
foreach ($data as $arr) {
// 0:最終更新日時, 1:初回登録日時, 2:参照カウンタ, 3:Referer ヘッダ, 4:利用可否フラグ(1は有効)
list($ltime, $stime, $count, $url, $enable) = $arr;
// 項目不正の場合の対応
// カウンタが数値ではない場合は、表示を抑止
if (!is_numeric($count)) {
continue;
}
$sw_ignore = plugin_referer_ignore_check($url);
if ($sw_ignore && $referer > 1) {
continue;
}
// 非ASCIIキャラクタ(だけ)をURLエンコードしておく BugTrack/440
$e_url = htmlspecialchars(preg_replace('/([" \\x80-\\xff]+)/e', 'rawurlencode("$1")', $url));
$s_url = htmlspecialchars(mb_convert_encoding(rawurldecode($url), SOURCE_ENCODING, 'auto'));
$s_url = mb_strimwidth($s_url, 0, REFERE_TITLE_LENGTH, '...');
$lpass = get_passage($ltime, FALSE);
// 最終更新日時からの経過時間
$spass = get_passage($stime, FALSE);
// 初回登録日時からの経過時間
$ldate = get_date($_referer_msg['msg_Fmt_Date'], $ltime);
// 最終更新日時文字列
$sdate = get_date($_referer_msg['msg_Fmt_Date'], $stime);
// 初回登録日時文字列
$body .= ' <tr>' . "\n" . ' <td>' . $ldate . '</td>' . "\n" . ' <td>' . $lpass . '</td>' . "\n";
$body .= $count == 1 ? ' <td colspan="2">N/A</td>' . "\n" : ' <td>' . $sdate . '</td>' . "\n" . ' <td>' . $spass . '</td>' . "\n";
$body .= ' <td style="text-align:right;">' . $count . '</td>' . "\n";
// 適用不可データのときはアンカーをつけない
$body .= $sw_ignore ? ' <td>' . $s_url . '</td>' . "\n" : ' <td><a href="' . $e_url . '" rel="nofollow">' . $s_url . '</a></td>' . "\n";
$body .= ' </tr>' . "\n";
$ctr++;
}
if ($ctr === 0) {
return '<p>no data.</p>';
}
//.........这里部分代码省略.........
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:101,代码来源:referer.inc.php
示例13: plugin_ls2_1_get_headings
function plugin_ls2_1_get_headings($page, &$params, $level = 1, $include = false, $prefix, $top_level = 1, &$pages)
{
global $script;
static $_ls2_anchor = 0;
// すでにこのページの見出しを表示したかどうかのフラグ
$is_done = isset($params["page_{$page}"]) && $params["page_{$page}"] > 0;
if (!$is_done) {
$params["page_{$page}"] = ++$_ls2_anchor;
}
$s_page = htmlspecialchars($page);
$title = $s_page . ' ' . get_pg_passage($page, false);
$r_page = rawurlencode($page);
$href = $script . '?' . $r_page;
// relative オプション。リンク名制御。
if ($params['relative']) {
// パターンの最後の / 以下を取り除く。例) sample/test/d -> sample/test
// $prefix_dir = preg_replace('/[^\/]+$/','',$prefix);
if (($pos = strrpos($prefix, '/')) !== false) {
$prefix_dir = substr($prefix, 0, $pos + 1);
}
// ページ名からそのパターンをとり除く。
// $s_page = ereg_replace("^$prefix_dir",'',$s_page);
$s_page = substr($s_page, strlen($prefix_dir));
// relative オプションと hierarchy オプションが同時に指定された場合は
// パターンを取り除くだけでなく、上位の存在しているページ名も取り除く。
if ($params['display'] == 'hierarchy') {
$tmp = $s_page;
// depth オプションが指定されていた場合 $top_level が変わります。
while (substr_count($tmp, "/") > $top_level - 1) {
// 一階層ずつとりのぞく
if (($pos = strrpos($tmp, '/')) !== false) {
$tmp = substr($tmp, 0, $pos);
}
// 上位のページが存在していれば、その文字列を取り除き、相対名にする。
if (in_array($prefix_dir . $tmp, $pages)) {
// $s_page = ereg_replace("^$tmp/",'',$s_page);
$s_page = substr($s_page, strlen("{$tmp}/"));
break;
}
}
}
}
// date オプション。更新日時の追加。
$date = '';
if ($params['date']) {
$date = format_date(get_filetime($page));
}
// new オプション。New! 表示の追加。
$new = '';
if ($params['new']) {
global $_plugin_new_elapses;
$timestamp = get_filetime($page) - LOCALZONE;
$erapse = UTIME - $timestamp;
foreach ($_plugin_new_elapses as $limit => $tag) {
if ($erapse <= $limit) {
$new .= sprintf($tag, get_passage($timestamp));
break;
}
}
}
plugin_ls2_1_list_push($params, $level);
// LI TAG. display オプションに依る。plugin_ls2_1_list_push にも。
if ($params['display'] == 'inline') {
$litag = '';
} else {
$litag = '<li>';
}
array_push($params['result'], $litag);
// include されたページの場合
if ($include) {
$ret = 'include ';
} else {
$ret = '';
}
// すでに表示済みなら必ずファイル内探索処理はせずに抜ける
if ($is_done) {
$ret .= '<a href="' . $href . '" title="' . $title . '">' . $s_page . '</a> ';
$ret .= '<a href="#list_' . $params["page_{$page}"] . '"><sup>↑</sup></a>';
array_push($params['result'], $ret);
return;
}
$ret .= '<a id="list_' . $params["page_{$page}"] . '" href="' . $href . '" title="' . $title . '">' . $s_page . '</a>';
if ($date != '') {
$ret .= " {$date}";
}
if ($new != '') {
$ret .= " {$new}";
}
array_push($params['result'], $ret);
// title オプション、include オプション時はファイル内探索もする
if ($params['title'] || $params['include']) {
$anchor = PLUGIN_LS2_1_ANCHOR_ORIGIN;
$matches = array();
// 全体で title_number 個ではなく各ファイル単位で title_number 個
$title_counter = 0;
foreach (get_source($page) as $line) {
if ($params['title'] && preg_match('/^(\\*{1,3})/', $line, $matches)) {
if ($params['title_number']) {
// ただの件数制限なので途中で抜けても $anchor には不整合はでないはず
if ($title_counter >= $params['title_number']) {
//.........这里部分代码省略.........
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:101,代码来源:ls2_1.inc.php
示例14: plugin_tb_recent
function plugin_tb_recent($page, $line)
{
$body = '';
$tb_id = tb_get_id($page);
$data = tb_get(tb_get_filename($page));
$ctr = count($data);
if ($ctr == 0) {
return '';
}
if ($ctr > 1) {
// Sort: The first is the latest
usort($data, create_function('$a,$b', 'return $b[0] - $a[0];'));
}
$body .= '<h5>' . _("RECENT TRACKBACK") . "</h5>\n";
$body .= "<div>\n<ul class=\"recent_list\">\n";
$i = 0;
foreach ($data as $x) {
if (count($x) != 5) {
continue;
}
// Ignore incorrect record
list($time, $url, $title, $excerpt, $blog_name) = $x;
if ($title == '') {
$title = 'no title';
}
$body .= '<li><a href="' . $url . '" title="' . $blog_name . ' ' . get_passage($time) . '" rel="nofollow">' . $title . '</a></li>' . "\n";
$i++;
if ($line == 0) {
continue;
}
if ($i >= $line) {
break;
}
}
if ($i == 0) {
return '';
}
$body .= "</ul>\n</div>\n";
return $body;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:40,代码来源:tb.inc.php
示例15: plugin_logview_action
//.........这里部分代码省略.........
$body[] = '<tr>';
$cols = 0;
// タイトルの処理
foreach ($view as $_view) {
if ($_view === 'local_id' && $is_role_adm) {
continue;
}
$body[] = '<th>' . $_logview_msg[$_view] . '</th>';
$cols++;
}
$body[] = '</tr>';
$body[] = '</thead>';
$body[] = '<tbody>';
$nodata = '<p class="alert alert-warning">' . $_logview_msg['msg_nodata'] . '</p>';
// USER-AGENT クラス
$obj_ua = new UserAgent(USE_UA_OPTION);
$guess = $log['guess_user']['use'] ? LogFactory::factory('guess_user')->get() : LogFactory::factory('update', $page)->getSigunature();
$ctr = 0;
// データの編集
$lines = $logfile->get();
if (!$lines) {
return array('msg' => $title, 'body' => $nodata);
}
foreach ($lines as $data) {
if (!VIEW_ROBOTS && $obj_ua->is_robots($data['ua'])) {
continue;
}
// ロボットは対象外
$body[] = '<tr>';
foreach ($view as $field) {
switch ($field) {
case 'ts':
// タイムスタンプ (UTIME)
$body[] = '<td>' . get_date('Y-m-d H:i:s', $data['ts']) . ' ' . get_passage($data['ts']) . '</td>';
break;
case '@guess_diff':
case '@diff':
// 差分内容
$update = $field == '@diff' ? true : false;
// FIXME: バックアップ/差分 なしの新規の場合
// バックアップデータの確定
$body[] = '<td class="style_td">';
$age = $logfile->get_backup_age($data['ts'], $update);
switch ($age) {
case -1:
// データなし
$body[] = '<a href="' . $wiki->uri() . '" rel="nofollow">none</a>';
break;
case 0:
// diff
$body[] = '<a href="' . ($logfile->diff_exist() ? $wiki->uri('diff') : $wiki->uri()) . '" rel="nofollow">now</a>';
break;
default:
// あり
$body[] = '<a class="ext" href="' . $wiki->uri('backup', null, array('age' => $age, 'action' => 'visualdiff')) . '" rel="nofollow">' . $age . '</a>';
break;
}
$body[] = '</td>';
break;
case 'host':
// ホスト名 (FQDN)
$body[] = ' <td>';
if ($data['ip'] != $data['host']) {
// 国名取得
list($flag_icon, $flag_name) = $obj_ua->get_icon_flag($data['host']);
if (!empty($flag_icon) && $flag_icon != 'jp') {
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:67,代码来源:logview.inc.php
示例16: make_related
function make_related($page,$tag='')
{
global $script,$vars,$related,$rule_related_str,$related_str,$non_list;
global $_ul_left_margin, $_ul_margin, $_list_pad_str;
$links = links_get_related($page);
if ($tag) {
ksort($links);
}
else {
arsort($links);
}
$_links = array();
foreach ($links as $page=>$lastmod)
{
if (preg_match("/$non_list/",$page))
{
continue;
}
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$passage = get_passage($lastmod);
$_links[] = $tag ?
"<a href=\"$script?$r_page\" title=\"$s_page $passage\">$s_page</a>" :
"<a href=\"$script?$r_page\">$s_page</a>$passage";
}
if (count($_links) == 0)
{
return '';
}
if ($tag == 'p') // 行頭から
{
$margin = $_ul_left_margin + $_ul_margin;
$style = sprintf($_list_pad_str,1,$margin,$margin);
$retval = "\n<ul$style>\n<li>".join($rule_related_str,$_links)."</li>\n</ul>\n";
}
else if ($tag)
{
$retval = join($rule_related_str,$_links);
}
else
{
$retval = join($related_str,$_links);
}
return $retval;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:49,代码来源:html.php
示例17: get_pg_passage
function get_pg_passage($page,$sw=TRUE)
{
global $show_passage;
static $pg_passage = array();
if (!$show_passage)
{
return '';
}
if (!array_key_exists($page,$pg_passage))
{
$pg_passage[$page] = (is_page($page) and $time = get_filetime($page)) ?
get_passage($time) : '';
}
return $sw ? "<small>{$pg_passage[$page]}</small>" : " {$pg_passage[$page]}";
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:18,代码来源:file.php
示例18: plugin_search_do_search
function plugin_search_do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
{
global $script, $whatsnew, $non_list, $search_non_list;
global $search_auth, $show_passage;
$qm = get_qm();
$retval = array();
$b_type = $type == 'AND';
// AND:TRUE OR:FALSE
mb_language('Japanese');
$word = mb_convert_encoding($word, SOURCE_ENCODING, "UTF-8,EUC-JP,SJIS,ASCII,JIS");
$word = mb_ereg_replace(" ", " ", $word);
$keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
foreach ($keys as $key => $value) {
$keys[$key] = '/' . $value . '/S';
}
$pages = get_existpages();
// Avoid
if ($base != '') {
$pages = preg_
|
请发表评论