phpDocumentor pukiwiki
[ class tree: pukiwiki ] [ index: pukiwiki ] [ all elements ]

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:
string   $str:  cmd name


[ Top ]
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:
Link:  http://php.net/array_fill

[ Top ]
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


[ Top ]
catrule  [line 592]

string catrule( )

Show text formatting rules


API Tags:
Return:  TextFormattingRules html
Global:  string $rule_page: TextFormattingRules page


[ Top ]
check_non_list  [line 158]

boolean check_non_list( [string $page = '']  )

Check if the page is in the non_list

Parameters:
string   $page: 

API Tags:
Global:  string $non_list: the preg definition of non_list (ignore pages). @see pukiwiki.ini.php


[ Top ]
csv_explode  [line 1158]

array csv_explode( string $separator, string $string  )

Explode Comma-Separated Values to an array

Example)

  1.  csv_explode(',''A,"B,B",C'=> array('A','B,B','C')

Parameters:
string   $separator:  separator, usually ','
string   $string:  csv strings

API Tags:
Return:  array of exploded strings
See:  csv_implode()


[ Top ]
csv_implode  [line 1189]

string csv_implode( string $glue, array $pieces  )

Implode an array with CSV data format (escape double quotes)

Example)

  1.  csv_implode(','array('A','B,B','C')) => 'A,"B,B",C'

Parameters:
string   $glue:  seperator, usually ','
array   $pieces: 

API Tags:
See:  csv_explode()


[ Top ]
decode  [line 442]

string decode( string $key  )

Decode page name

hex2bin($key)

Parameters:
string   $key:  encoded string

API Tags:
Return:  decoded string
See:  encode()
Uses:  hex2bin()


[ Top ]
die_message  [line 610]

void die_message( string $msg  )

Show (critical) error message (then exit)

Parameters:
string   $msg:  error message


[ Top ]
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


[ Top ]
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:
Return:  replaced string


[ Top ]
encode  [line 425]

string encode( string $key  )

Encode page-name

strtoupper(bin2hex($key))

Parameters:
string   $key:  a string such as a pagename

API Tags:
See:  decode()
Usedby:  file_write()


[ Top ]
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


[ Top ]
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:

  1.    sort($arraySORT_STRING)// Keys are replaced, as we had expected
  2.    $regex generate_trie_regex($array);

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:
Link:  http://en.wikipedia.org/wiki/Trie

[ Top ]
getmicrotime  [line 651]

float getmicrotime( )

Get the current time in micro sec


API Tags:
Return:  time in micro sec


[ Top ]
get_autoaliases  [line 930]

array get_autoaliases( [string $word = '']  )

Load/get autoalias pairs

Parameters:
string   $word:  alias name

API Tags:
Return:  if $word == '': array whose keys are alias names and values are array of real names
if $word != '': array of real names
Uses:  get_autoaliases_from_autobasealias()
Uses:  get_autoaliases_from_aliaspage()


[ Top ]
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()


[ Top ]
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

[ Top ]
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()


[ Top ]
get_autolink_pattern  [line 812]

void get_autolink_pattern( &$pages, [ $min_len = -1]  )
Parameters:
   &$pages: 
   $min_len: 

API Tags:
Usedby:  page_write()


[ Top ]
get_autolink_pattern_sub  [line 915]

void get_autolink_pattern_sub( &$pages, $start, $end, $pos  )
Parameters:
   &$pages: 
   $start: 
   $end: 
   $pos: 


[ Top ]
get_date  [line 669]

void get_date( string $format, [int $timestamp = NULL]  )

Get the date

Example)

  1.  get_date('D, d M Y H:i:s T'get_filetime($_page))

Parameters:
string   $format:  date format
int   $timestamp:  timestamp or current UTIME if not specified

API Tags:
Uses:  get_zontime_offset


[ Top ]
get_glossary_pattern  [line 776]

void get_glossary_pattern( &$pages, [ $min_len = -1]  )
Parameters:
   &$pages: 
   $min_len: 

API Tags:
Usedby:  page_write()


[ Top ]
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:
Return:  passage
Usedby:  get_pg_passage()


[ Top ]
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:
Return:  script uri


[ Top ]
get_search_words  [line 210]

void get_search_words( $words, [ $do_escape = FALSE]  )
Parameters:
   $words: 
   $do_escape: 

API Tags:
Usedby:  do_search()


[ Top ]
get_short_pagename  [line 734]

string get_short_pagename( string $fullpagename  )

Get short pagename(last token without '/') or basename

Parameters:
string   $fullpagename: 

API Tags:
Return:  short pagename (or basename)
Usedby:  autobasealias_write()


[ Top ]
get_zonetime_offset  [line 696]

string get_zonetime_offset( $zonetime, int $zontime  )

Get zontime as a string as +0900

Parameters:
int   $zontime: 
   $zonetime: 


[ Top ]
hex2bin  [line 453]

string hex2bin( string $hex_string  )

Inversion of bin2hex()

Parameters:
string   $hex_string: 

API Tags:
Usedby:  decode()


[ Top ]
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:
mixed   $param: 

API Tags:
Return:  filtered param


[ Top ]
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:
Link:  http://php.net/is_a

[ Top ]
is_editable  [line 100]

boolean is_editable( string $page  )

Check if the page is editable or not

Parameters:
string   $page: 

API Tags:
Global:  array $cantedit: special pages which can not be edited
Uses:  is_pagename()
Uses:  is_freeze()


[ Top ]
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:
Usedby:  is_editable()


[ Top ]
is_interwiki  [line 25]

boolean is_interwiki( string $str  )

Check if the str is interwiki or not

Parameters:
string   $str: 

API Tags:
Global:  string $InterWikiName: Syntax definition of InterWikiName, @see init.php
Uses:  is_url()


[ Top ]
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:
Usedby:  file_write()
Usedby:  page_write()
Uses:  get_filename()
Uses:  clearstatcache


[ Top ]
is_pagename  [line 38]

boolean is_pagename( string $str  )

Check if the str is pagename or not

Parameters:
string   $str: 

API Tags:
Global:  string $BracketName: Syntax definition of BracketName (or PageName), @see init.php
Usedby:  is_editable()


[ Top ]
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:
Usedby:  is_interwiki()


[ Top ]
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:
string   $filename: 

Information Tags:
Link:  http://php.net/md5_file

[ Top ]
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:
Return:  page_list html
See:  list.inc.php, filelist.inc.php
Uses:  get_readings() - if $pagereading_enable is TRUE
Uses:  get_pg_passage()


[ Top ]
sanitize  [line 1141]

void sanitize( $param  )
Parameters:
   $param: 

API Tags:
See:  input_filter()
Deprecated:  Compat for 3rd party plugins. Use input_filter


[ Top ]
sha1  [line 1282]

$str sha1( string $str  )

sha1 -- Compute SHA-1 hash

(PHP 4 >= 4.3.0, PHP5)

Parameters:
string   $str: 

Information Tags:
Link:  http://php.net/sha1

[ Top ]
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


[ Top ]


Documentation generated on Mon, 09 Jul 2007 21:56:11 +0900 by phpDocumentor 1.3.2