Procedural File: func.php
Source Location: /func.php
Page Details
General functions
PukiWiki Plus! - Yet another WikiWikiWeb clone.
| Version: | $Id: func.php,v 1.86.20 2007/06/02 14:38:00 upk Exp $ |
| Copyright: | Copyright (C) - 2005-2007 PukiWiki Plus! Team
- 2002-2007 PukiWiki Developers Team
- 2001-2002 Originally written by yu-ji
|
| License: | GPL v2 or (at your option) any later version |
Functions
arg_check [line 410]
boolean arg_check(
string $str
)
|
|
Argument (cmd) check for program
global $vars; $vars['cmd'] == $str would be enough
Parameters:
array_fill [line 1240]
array array_fill(
int $start_index, int $num, mixed $value
)
|
|
array_fill -- Fill an array with values
(PHP 4 >= 4.2.0)
Parameters:
|
int |
$start_index: |
The first index of the returned array |
|
int |
$num: |
Number of elements to insert |
|
mixed |
$value: |
Values to use filling |
API Tags:
| Return: | Returns the filled array |
Information Tags:
auto_template [line 176]
string auto_template(
string $page
)
|
|
Get template contents for a new page
Parameters:
|
string |
$page: |
the new page |
API Tags:
| Return: | template contents |
| Global: | boolean $auto_template_func: use this auto_template function or not |
| Global: | array $auto_template_rules: the pagename rules to be used as templates. @see pukiwiki.ini.php |
catrule [line 592]
Show text formatting rules
API Tags:
| Return: | TextFormattingRules html |
| Global: | string $rule_page: TextFormattingRules page |
check_non_list [line 158]
boolean check_non_list(
[string $page = '']
)
|
|
Check if the page is in the non_list
Parameters:
API Tags:
| Global: | string $non_list: the preg definition of non_list (ignore pages). @see pukiwiki.ini.php |
csv_explode [line 1158]
array csv_explode(
string $separator, string $string
)
|
|
Explode Comma-Separated Values to an array
Example)
Parameters:
|
string |
$separator: |
separator, usually ',' |
|
string |
$string: |
csv strings |
API Tags:
csv_implode [line 1189]
string csv_implode(
string $glue, array $pieces
)
|
|
Implode an array with CSV data format (escape double quotes)
Example)
Parameters:
|
string |
$glue: |
seperator, usually ',' |
|
array |
$pieces: |
|
API Tags:
decode [line 442]
string decode(
string $key
)
|
|
Decode page name
hex2bin($key)
Parameters:
|
string |
$key: |
encoded string |
API Tags:
die_message [line 610]
void die_message(
string $msg
)
|
|
Show (critical) error message (then exit)
Parameters:
|
string |
$msg: |
error message |
do_search [line 299]
string|array do_search(
string $word, [enum $type = 'AND'], [boolean $non_format = FALSE], [string $base = '']
)
|
|
'Search' main function
Parameters:
|
string |
$word: |
search word |
|
enum |
$type: |
'AND' or 'OR' |
|
boolean |
$non_format: |
get the matched pages in array, not html |
|
string |
$base: |
search only pages whose prefixes are $base . '/' |
API Tags:
| Return: | the search result in html or the matched pages |
| Global: | string $script: script. PukiWiki Script URI. @see get_script_uri() |
| Global: | string $whatsnew: whatsnew. RecentChanges |
| Global: | string $non_list: non_list. ignore pages |
| Global: | string $search_non_list: search_non_list. non_list for searching |
| Global: | boolean $search_auth: search_auth. search authorized pages, too |
| Global: | boolean $show_passage: show_passage. show time passage in the html result |
| Global: | boolean $search_word_color: search_word_color. link pages which highlight search words |
| Global: | boolean $ajax: ajax. use ajax to show search results in pages on mouse |
| Global: | array $_string: _string. messages |
| See: | search.inc.php |
| Uses: | get_search_words() |
| Uses: | get_existpages() |
| Uses: | auth::check_role |
drop_submit [line 770]
string drop_submit(
string $str
)
|
|
Hide <input type="(submit|button|image)"...> to <input type="hidden"...>
Parameters:
|
string |
$str: |
target string |
API Tags:
encode [line 425]
string encode(
string $key
)
|
|
Encode page-name
strtoupper(bin2hex($key))
Parameters:
|
string |
$key: |
a string such as a pagename |
API Tags:
format_date [line 715]
string format_date(
int $val, [boolean $paren = FALSE]
)
|
|
Format date string
Parameters:
|
int |
$val: |
time in UTIME. ZONTIME will be added. |
|
boolean |
$paren: |
put () on the both side of the generated string |
API Tags:
| Return: | the formatted date string as 2007-07-08 (Sun) 19:47:07 |
| Global: | string $date_format: date_format. @see pukiwiki.ini.php |
| Global: | string $time_format: time_format. @see pukiwiki.ini.php |
| Global: | string $weeklabels: weeklabels. @see lib/resource.php |
generate_trie_regex [line 868]
void generate_trie_regex(
array &$array, [int $offset = 0], [int $sentry = NULL], [int $pos = 0]
)
|
|
Generate one compact regex for quick reTRIEval, that just matches with all $array values.
USAGE: sort($array, SORT_STRING); // Keys are replaced, as we had expected
Parameters:
|
array |
&$array: |
(_sorted_ _string_ array) array_keys($array) MUST BE _continuous integers started with 0_. All $array values MUST BE strings. Passing the reference, of the $array here, will save the memories, from flood of recursive call. |
|
int |
$offset: |
$array[$offset] is the first value to check |
|
int |
$sentry: |
$array[$sentry - 1] is the last value to check |
|
int |
$pos: |
Position of the letter to start checking. (0 = the first letter) |
Information Tags:
getmicrotime [line 651]
Get the current time in micro sec
API Tags:
| Return: | time in micro sec |
get_autoaliases [line 930]
array get_autoaliases(
[string $word = '']
)
|
|
Load/get autoalias pairs
Parameters:
API Tags:
get_autoaliases_from_aliaspage [line 971]
array get_autoaliases_from_aliaspage(
)
|
|
Load/get AutoAlias pairs from AutoAliasName
API Tags:
| Return: | array whose keys are alias names and values are array of real names |
| Global: | string $aliaspage: AutoAliasName page |
| Global: | int $autoalias_max_words: maximum number of aliases |
| Usedby: | get_autoaliases() |
get_autoaliases_from_autobasealias [line 954]
array get_autoaliases_from_autobasealias(
)
|
|
Load/get pairs of AutoBaseAlias
API Tags:
| Return: | array whose keys are alias names and values are array of real names |
| Usedby: | get_autoaliases() |
Information Tags:
| Since: | PukiWiki Plus! 1.4.7plus-u3-i18n or 1.4.8plus-i18n |
get_autoglossaries [line 1017]
array|string get_autoglossaries(
[string $word = '']
)
|
|
Load/get setting pairs from Glossary
Parameters:
|
string |
$word: |
glossary word |
API Tags:
| Return: | if $word == '': array of whose keys are words and values are their explanations respectively if $word != '': explanation of the word |
| Global: | string $glossarypage: Glossary page |
| Global: | int $autoglossary_max_words: maximum number of glossary words |
| Usedby: | page_write() |
get_autolink_pattern [line 812]
void get_autolink_pattern(
&$pages, [ $min_len = -1]
)
|
|
Parameters:
API Tags:
get_autolink_pattern_sub [line 915]
void get_autolink_pattern_sub(
&$pages, $start, $end, $pos
)
|
|
Parameters:
|
|
&$pages: |
|
|
|
$start: |
|
|
|
$end: |
|
|
|
$pos: |
|
get_date [line 669]
void get_date(
string $format, [int $timestamp = NULL]
)
|
|
Get the date
Example)
Parameters:
|
string |
$format: |
date format |
|
int |
$timestamp: |
timestamp or current UTIME if not specified |
API Tags:
get_glossary_pattern [line 776]
void get_glossary_pattern(
&$pages, [ $min_len = -1]
)
|
|
Parameters:
API Tags:
get_passage [line 749]
string get_passage(
int $time, [boolean $paren = TRUE]
)
|
|
Get the time passage from the given timestamp to the current time.
The passage format is as 'N seconds/minutes/hours/days/years ago'
Parameters:
|
int |
$time: |
timestamp |
|
boolean |
$paren: |
put () on the both side of the output string |
API Tags:
get_script_uri [line 1054]
string get_script_uri(
[string $init_uri = '']
)
|
|
Get the PukiWiki script URI
Parameters:
|
string |
$init_uri: |
Initialize script URI manually if want |
API Tags:
get_search_words [line 210]
void get_search_words(
$words, [ $do_escape = FALSE]
)
|
|
Parameters:
API Tags:
get_short_pagename [line 734]
string get_short_pagename(
string $fullpagename
)
|
|
Get short pagename(last token without '/') or basename
Parameters:
API Tags:
get_zonetime_offset [line 696]
string get_zonetime_offset(
$zonetime, int $zontime
)
|
|
Get zontime as a string as +0900
Parameters:
hex2bin [line 453]
string hex2bin(
string $hex_string
)
|
|
Inversion of bin2hex()
Parameters:
API Tags:
input_filter [line 1122]
mixed input_filter(
mixed $param
)
|
|
Remove null(\0) bytes from variables
NOTE: PHP had vulnerabilities that opens "hoge.php" via fopen("hoge.php\0.txt") etc. [PHP-users 12736] null byte attack http://ns1.php.gr.jp/pipermail/php-users/2003-January/012742.html
- 2003-05-16: magic quotes gpcの復元処理を統合
- 2003-05-21: 連想配列のキーはbinary safe
Parameters:
API Tags:
is_a [line 1215]
boolean is_a(
object|string $class, string $match
)
|
|
is_a -- Checks if the object is of this class or has this class as one of its parents
(PHP 4 >= 4.2.0)
Parameters:
|
object|string |
$class: |
The tested object or class name |
|
string |
$match: |
The class name |
API Tags:
| Return: | Returns TRUE if the object is of this class or has this class as one of its parents, FALSE otherwise. |
Information Tags:
is_editable [line 100]
boolean is_editable(
string $page
)
|
|
Check if the page is editable or not
Parameters:
API Tags:
is_freeze [line 124]
boolean is_freeze(
string $page, [boolean $clearcache = FALSE]
)
|
|
Check if the page is frozen or not
Parameters:
|
string |
$page: |
|
|
boolean |
$clearcache: |
clear memory cache |
API Tags:
is_interwiki [line 25]
boolean is_interwiki(
string $str
)
|
|
Check if the str is interwiki or not
Parameters:
API Tags:
| Global: | string $InterWikiName: Syntax definition of InterWikiName, @see init.php |
| Uses: | is_url() |
is_page [line 84]
boolean is_page(
string $page, [boolean $clearcache = FALSE]
)
|
|
Check if the page exists
Parameters:
|
string |
$page: |
|
|
boolean |
$clearcache: |
clearcache or not |
API Tags:
is_pagename [line 38]
boolean is_pagename(
string $str
)
|
|
Check if the str is pagename or not
Parameters:
API Tags:
| Global: | string $BracketName: Syntax definition of BracketName (or PageName), @see init.php |
| Usedby: | is_editable() |
is_url [line 69]
boolean is_url(
string $str, [boolean $only_http = FALSE]
)
|
|
Check if the str is url or not
Parameters:
|
string |
$str: |
|
|
boolean |
$only_http: |
check only http, and https. Otherwise, check http, https, ftp, and news |
API Tags:
md5_file [line 1259]
string md5_file(
string $filename
)
|
|
md5_file -- Calculates the md5 hash of a given filename
(PHP 4 >= 4.2.0)
Parameters:
Information Tags:
page_list [line 489]
string page_list(
array $pages, [string $cmd = 'read'], [boolean $withfilename = FALSE]
)
|
|
Create list of pages (html)
Parameters:
|
array |
$pages: |
|
|
string |
$cmd: |
cmd used for href |
|
boolean |
$withfilename: |
print physical filename, too |
API Tags:
sanitize [line 1141]
Parameters:
API Tags:
| See: | input_filter() |
| Deprecated: | Compat for 3rd party plugins. Use input_filter |
sha1 [line 1282]
sha1 -- Compute SHA-1 hash
(PHP 4 >= 4.3.0, PHP5)
Parameters:
Information Tags:
strip_bracket [line 468]
string strip_bracket(
string $str
)
|
|
Remove [[ ]] (brackets)
Parameters:
|
string |
$str: |
[[pagename]] |
API Tags:
| Deprecated: | use this function to support PukiWiki 1.3 |
|
|