<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: func.php,v 1.48 2005/11/23 07:41:06 henoheno Exp $
+// $Id: func.php,v 1.52 2005/12/18 15:11:08 henoheno Exp $
// Copyright (C)
// 2002-2005 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
}
}
+// Handling $non_list
+// $non_list will be preg_quote($str, '/') later.
+function check_non_list($page = '')
+{
+ global $non_list;
+ static $regex;
+
+ if (! isset($regex)) $regex = '/' . $non_list . '/';
+
+ return preg_match($regex, $page);
+}
+
// Auto template
function auto_template($page)
{
{
static $init, $mb_convert_kana, $pre, $post, $quote = '/';
- if (! is_array($words)) $words = array($words);
-
if (! isset($init)) {
// function: mb_convert_kana() is for Japanese code only
if (LANG == 'ja' && function_exists('mb_convert_kana')) {
$init = TRUE;
}
+ if (! is_array($words)) $words = array($words);
+
// Generate regex for the words
$regex = array();
foreach ($words as $word) {
$or[] = preg_quote($mb_convert_kana($_char, 'A'), $quote); // As Zenkaku?
}
} else {
- // NEVER COME HERE except with mb_substr(string, 'EUC-JP') etc
+ // NEVER COME HERE with mb_substr(string, start, length, 'ASCII')
// A multi-byte character
$or[] = preg_quote($mb_convert_kana($char, 'c'), $quote); // As Hiragana?
$or[] = preg_quote($mb_convert_kana($char, 'k'), $quote); // As Hankaku-Katakana?
}
// 'Search' main function
-function do_search($word, $type = 'AND', $non_format = FALSE)
+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;
$keys = get_search_words(preg_split('/\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
$_pages = get_existpages();
+ if ($base != '') {
+ $_pages = preg_grep('/^' . $base . '/', $_pages);
+ }
$pages = array();
$non_list_pattern = '/' . $non_list . '/';