Class: sonots
Source Location: /sonots/sonots.class.php
Class sonots
Class Overview
|
Namespace sonots (sonots' additional functions)
Located in /sonots/sonots.class.php [line 22]
Author(s):
API Tags:
| Uses: | PHP_Compat - rev 1.22 |
Information Tags:
|
Methods
|
Method Summary
| static
void
|
array_asort_key() |
sort array in the given key sequence maintaining key association |
| static
array
|
array_slice() |
Extract a slice of the array |
| static
object cloned
|
create_clone() |
Create a clone of object |
| static
array
|
&ereg_grep() |
Grep an array by ereg expression |
| static
boolean
|
exec_page() |
Execute (convert_html) this page |
| static
array
|
file_head() |
Reads heads of file into an array |
| static
array
|
get_existpages() |
get existing pages with prefix restriction |
| static
array
|
&get_members() |
Get specific members from array of class objects |
| static
array
|
get_tree() |
Get tree states of pages |
| static
string
|
glue_str() |
reverse parse_str |
| static
string
|
glue_url() |
reverse parse_url |
| static
void
|
grep_by() |
Grep out array of objects by speific members |
| static
void
|
init_members() |
Initialize members of array of class objects |
| static
void
|
init_myerror() |
Error Handling in PHP4. init error states |
| static
boolean
|
is_admin() |
PukiWiki admin login with session |
| static
boolean
|
is_edit_auth() |
Check if a page is configured to require authentication |
| static
boolean
|
is_human() |
Human recognition using PukiWiki Auth methods |
| static
boolean
|
is_interwiki() |
Check if string is InterWiki syntax or not |
| static
boolean
|
is_newpage() |
Check if page is newpage |
| static
boolean
|
is_page_newer() |
Check if the page timestamp is newer than the file timestamp |
| static
boolean
|
is_read_auth() |
Check if a page is configured to require the read-authentication |
| static
array
|
make_heading() |
Get heading strings from a wiki source line |
| static
void
|
make_inline() |
Convert only inline plugins unlike make_link() |
| static
string
|
make_toplink() |
make a link to pukiwiki top url |
| static
void
|
map_members() |
Applies the callback to the members of the given array objects |
| static
boolean
|
move() |
Move a file (rename does not overwrite if $newname exists on Win, but move does) |
| static
string
|
mycatch() |
Error Handling in PHP4. catch an error message |
| static
void
|
mythrow() |
Error Handling in PHP4. throw an error message |
| static
string
|
realurl() |
Get absolute URL |
| static
boolean
|
r_mkdir() |
mkdir recursively (mkdir of PHP5 has recursive flag) |
| static
array
|
r_strpos() |
Find positions of occurrence of a string |
| static
void
|
set_members() |
Set array into members of array of class objects |
| static
void
|
sort_filenames() |
Special sort function for filenames (/ has a special meaning) |
| static
string
|
urldecode() |
Urldecode only given specific chars |
| static
string
|
urlencode() |
Urlencode only given specific chars |
Methods
static void array_asort_key(
array
&$array, array
&$sorted
)
|
|
sort array in the given key sequence maintaining key association
PHP API Extension Example) $japanese = array('orange'=>'mikan', 'apple'=>'ringo');
$price = array('orange'=> 100, 'apple'= 50);
asort($price, SORT_NUMERIC); // array('apple'=> 50, 'orange'= 100);
array_asort_key($favor, $price); // array('orange'=>'ringo', 'apple'=>'apple');
Parameters:
|
array |
&$array: |
array to be sorted |
|
array |
&$sorted: |
array having keys in sorting sequence. keys of $array and $sorted must be all common, i.e., count($array) == count(array_intersect_key($array, $sorted)) |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array array_slice(
array
$array, int
$offset, [mixed
$length = null], [boolean
$preserve_keys = false]
)
|
|
Extract a slice of the array
PHP Compat $length == null means up to end of array. Now, sonots::array_slice($array, $offset, null, true) is possible. array_slice($array, $offset, null (or 0 or - 0)) returns array(),
thus, there was no way to slice up to end of array with preserving keys.
Parameters:
|
array |
$array: |
The input array. |
|
int |
$offset: |
If offset is non-negative, the sequence will start at that offset in the array. If offset is negative, the sequence will start that far from the end of the array. |
|
mixed |
$length: |
If length is given and is positive, then the sequence will have that many elements in it. If length is given and is negative then the sequence will stop that many elements from the end of the array. If it is omitted or NULL (add), then the sequence will have everything from offset up until the end of the array . |
|
boolean |
$preserve_keys: |
Note that array_slice() will reorder and reset the array indices by default. You can change this behaviour by setting preserve_keys to true. |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-07 11:14:46 sonots $ |
| Since: | v 1.7 |
static void array_sort_key(
array
&$array, array
&$sorted
)
|
|
sort array in the given key sequence
PHP API Extension Example) $fruits = array(0 => 'orange', 1 => 'apple');
$price = array(0 => 100, 1 => 50);
asort($price, SORT_NUMERIC); // array(1 => 50, 0 => 100)
array_sort_key($fruits, $price); // array(0 => 'apple', 1 => 'orange')
Parameters:
|
array |
&$array: |
array to be sorted |
|
array |
&$sorted: |
array having keys in sorting sequence. keys of $array and $sorted must be all common, i.e., count($array) == count(array_intersect_key($array, $sorted)) |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string array_to_string(
array
$array, [string
$hashsep = ':'], [string
$elemsep = ','], [string
$openarray = '('], [string
$closearray = ')'], [boolean
$encode = true]
)
|
|
Convert an array to a string.
PHP API Extension Example $arr = array('A', 'B', 'indC' => 'C', array('D', 'E'), 'indF'=>'F');
Output: A,B,indC:C,(D,E),indF:F
Parameters:
|
array |
$array: |
|
|
string |
$hashsep: |
A character to be used as a hash key and val seperator |
|
string |
$elemsep: |
A character to be used as a elememt separator |
|
string |
$openarray: |
A character to be used as an open bracket of an array |
|
string |
$closearray: |
A character to be used as a close bracket of an array |
|
boolean |
$encode: |
Performe encode for key/val or not Note: encoding is usually necessary especially when you want to use delimiter characters in keys and values |
API Tags:
Information Tags:
| Version: | $Id: v 1.3 2008-07-15 11:14:46 sonots $ |
static array compact_list(
array
$levels
)
|
|
Compact List Levels
PukiWiki API Extension Example) $levels = array(1,3,1,1,3,2,3);
// array(1,2,1,1,2,2,3)
$levels = array(1,3,1,1,3,3,3);
print_r(sonot::compact_list($levels));
// array(1,2,1,1,2,2,2) // not array(1,2,1,1,2,3,3)
Parameters:
|
array |
$levels: |
array of levels (positive numbers) |
API Tags:
| Return: | compacted levels (keys, sequences are preserved) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static object cloned create_clone(
object
$object
)
|
|
Create a clone of object
PHP Compat
Parameters:
API Tags:
| Return: | object |
| See: | php_compat_clone |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string display_list(
array
$items, array
$levels, [string
$cssclass = '']
)
|
|
Display ul list
PHP API Extension PukiWiki outputs ul lists as <ul><li style="padding-left:16*2px;margin-left:16*2px">.
I do not like it. This codes output as <ul><li style="list-type:none"><ul><li>.
This is also XHTML 1.1 valid. Furthermore, this codes print no return because some browsers create spaces by returns in ul list.
Parameters:
|
array |
$items: |
strings of items to be displayed |
|
array |
$levels: |
list levels of items |
|
string |
$cssclass: |
css class name |
API Tags:
| Return: | list html |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string display_password_form(
string
$action, [string
$message = ""], [boolean
$use_session = true], [boolean
$use_authlog = true]
)
|
|
PukiWiki typical password form
PukiWiki API Extension
Parameters:
|
string |
$action: |
action url (htmlspecialchars will be performed) |
|
string |
$message: |
additional message (htmlspecialchars will be performed) |
|
boolean |
$use_session: |
use session log to know he is admin |
|
boolean |
$use_authlog: |
use Basic Auth log to know he is admin if he is admin, form does not show password textbox. |
API Tags:
| Return: | form html |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array &ereg_grep(
string
$pattern, array
$input, [int
$flags = 0]
)
|
|
Grep an array by ereg expression
PHP API Extension
Parameters:
|
string |
$pattern: |
|
|
array |
$input: |
|
|
int |
$flags: |
|
API Tags:
static array exec_existpages(
[string
$prefix = ''], [string
$regexp = null]
)
|
|
Execute (convert_html) all pages
PukiWiki API Extension
Parameters:
|
string |
$prefix: |
restrict pages by prefix condition |
|
string |
$regexp: |
execute only matched lines (preg_grep) |
API Tags:
| Return: | executed pages |
| Access: | public |
| Uses: | sonots::get_existpages |
| Uses: | convert_html - (PukiWiki lib/convert_html.php) |
| Uses: | get_source - (PukiWiki lib/file.php) |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean exec_page(
string
$page, [string
$regexp = null]
)
|
|
Execute (convert_html) this page
PukiWiki API Extension
Parameters:
|
string |
$page: |
|
|
string |
$regexp: |
execute only matched lines (preg_grep) |
API Tags:
| Return: | executed or not |
| Access: | public |
| Uses: | convert_html - (PukiWiki lib/convert_html.php) |
| Uses: | get_source - (PukiWiki lib/file.php) |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array file_head(
string
$file, [int
$count = 1], [boolean
$lock = true], [int
$buffer = 8192]
)
|
|
Reads heads of file into an array
PHP API Extension
Parameters:
|
string |
$file: |
filename |
|
int |
$count: |
number of executed fgets, usually equivalent to number of lines |
|
boolean |
$lock: |
use lock or not |
|
int |
$buffer: |
number of bytes to be read in one fgets |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static int file_put_contents(
string
$filename, string
$data, [int
$flags = 0]
)
|
|
Write a string to a file (PHP5 has this function)
PHP Compat
Parameters:
|
string |
$filename: |
|
|
string |
$data: |
|
|
int |
$flags: |
|
API Tags:
| Return: | the amount of bytes that were written to the file, or FALSE if failure |
| See: | php_compat_file_put_contents (better) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_basename(
string
$path, [string
$suffix = '']
)
|
|
Get the basename of a path
PHP API Extension PHP's basename works as 'Page/' => 'Page', 'Page/a' => 'a', 'Page' => 'Page'
This function works as 'Page/' => '', 'Page/a' => 'a', 'Page' => 'Page'
Parameters:
|
string |
$path: |
|
|
string |
$suffix: |
cut suffix of the basename |
API Tags:
| Return: | basename |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_convert_html(
string
$page, array
$lines
)
|
|
Get result html of convert_html
PukiWiki API Extension
Parameters:
|
string |
$page: |
pagename |
|
array |
$lines: |
contents to be converted |
API Tags:
| Return: | html |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_dirname(
string
$path
)
|
|
Get the dirname of a path
PHP API Extension PHP's dirname works as 'Page/' => '.', 'Page/a' => 'Page', 'Page' => '.'
This function works as 'Page/' => 'Page', 'Page/a' => 'Page', 'Page' => ''
Parameters:
API Tags:
| Return: | dirname |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array &get_existfiles(
string
$dir, [string
$ext = ''], [bool
$recursive = false]
)
|
|
Get list of files in a directory
PHP Extension
Parameters:
|
string |
$dir: |
Directory Name |
|
string |
$ext: |
File Extension |
|
bool |
$recursive: |
Traverse Recursively |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array get_existpages(
[string
$prefix = '']
)
|
|
get existing pages with prefix restriction
PukiWiki API Extension
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static int get_filecreatetime(
string
$page
)
|
|
Get page created time
PukiWiki API Extension
Parameters:
API Tags:
| Return: | timestamp |
| See: | get_filetime($page) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_fullname(
string
$name, string
$refer
)
|
|
Get absolute path
PukiWiki API Extension This preserves last slash unlike lib/make_link.php@get_fullname Example)
Parameters:
|
string |
$name: |
path syntax |
|
string |
$refer: |
current place |
API Tags:
| Return: | absolute path |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_interwiki_url(
string
$interwiki
)
|
|
Resolve InterWiki name
PukiWiki API Extension
Parameters:
|
string |
$interwiki: |
InterWiki string such as pukiwiki:PageName |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array &get_members(
array
&$objects, string
$name
)
|
|
Get specific members from array of class objects
PHP API Extension
Parameters:
|
array |
&$objects: |
array of objects |
|
string |
$name: |
member name |
API Tags:
| Return: | array of members, keys are preserved. |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string get_page_uri(
string
$page, [string
$query = '']
)
|
|
get uri of a page
PukiWiki API Extension
Parameters:
|
string |
$page: |
|
|
string |
$query: |
query word if needs |
API Tags:
| Return: | uri |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array get_readings(
[mixed
$pages = array()]
)
|
|
get readings of pages
PukiWiki API Extension arguments $pages version of lib/file.php get_reading
Parameters:
|
mixed |
$pages: |
array of pages or a pagename if not given, get readings of all existing pages |
API Tags:
| Return: | readings |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array get_tree(
array
$pages
)
|
|
Get tree states of pages
PukiWiki API Extension
Parameters:
API Tags:
| Return: | array whose keys are pagenames and values are boolean true if the page is a leaf in tree, false if not. |
| Access: | public |
| Uses: | sonots::sort_filenames |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string glue_str(
array
$queries
)
|
|
reverse parse_str
PHP API Extension Note: parse_str does rawurldecode and convert . into _ for keys
Parameters:
|
array |
$queries: |
outputs by parse_str |
API Tags:
| Return: | reversed parse_str |
| See: | parse_str() |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string glue_url(
array
$parsed
)
|
|
reverse parse_url
PHP Extension
Parameters:
|
array |
$parsed: |
outputs by parse_url |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array grep_array(
string
$pattern, array
$array, string
$func, [boolean
$preserve_keys = true], [boolean
$inverse = false]
)
|
|
Grep array
PHP API Extension
Parameters:
|
string |
$pattern: |
|
|
array |
$array: |
|
|
string |
$func: |
func name - preg : grep by preg
- ereg : grep by ereg
- mb_ereg : grep by mb_ereg
- strpos : grep by string
- mb_strpos: grep by multibyte string
- prefix : grep by prefix match
- mb_prefix: grep by multibyte prefix match
- eq : grep by equality (identity, ===)
- ge : grep by greater or equal to
- le : grep by less or equal to
|
|
boolean |
$preserve_keys: |
|
|
boolean |
$inverse: |
grep -v |
API Tags:
| See: | array_diff use array_diff to get inverse |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
| Todo: | refine more |
static void grep_by(
&$objs, string
$meta, string
$func, mixed
$pattern, [boolean
$inverse = FALSE], array
$objs
)
|
|
Grep out array of objects by speific members
Parameters:
|
array |
$objs: |
|
|
string |
$meta: |
name of meta information to be greped |
|
string |
$func: |
func name - preg : grep by preg
- ereg : grep by ereg
- mb_ereg : grep by mb_ereg
- prefix : remains if prefix matches (strpos)
- mb_prefix: (mb_strpos)
- eq : remains if equality holds
- ge : remains if greater or equal to
- le : remains if less or equal to
|
|
mixed |
$pattern: |
|
|
boolean |
$inverse: |
grep -v |
|
|
&$objs: |
|
API Tags:
static void init_members(
array
&$objects, string
$name, mixed
$value
)
|
|
Initialize members of array of class objects
PHP API Extension
Parameters:
|
array |
&$objects: |
array of objects |
|
string |
$name: |
member name |
|
mixed |
$value: |
initialization value |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-10 11:14:46 sonots $ |
| Since: | 1.10 |
static void init_myerror(
)
|
|
Error Handling in PHP4. init error states
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
| Since: | v 1.4 |
static boolean is_admin(
[string
$pass = null], [boolean
$use_session = false], [boolean
$use_authlog = false]
)
|
|
PukiWiki admin login with session
PukiWiki API Extension
Parameters:
|
string |
$pass: |
Password. Use null when to get current session state. |
|
boolean |
$use_session: |
Use Session log |
|
boolean |
$use_authlog: |
Use Auth log. Username 'admin' is deemed to be Admin in PukiWiki Official. PukiWiki Plus! has role management, roles ROLE_ADM and ROLE_ADM_CONTENTS are deemed to be Admin. |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_edit_auth(
string
$page, [string
$user = '']
)
|
|
Check if a page is configured to require authentication
PukiWiki API Extension
Parameters:
|
string |
$page: |
|
|
string |
$user: |
if want to check whether this user possibly can get permission |
API Tags:
| Global: | boolean $edit_auth: edit_auth |
| Global: | array $edit_auth_pages: edit_auth_pages |
| Global: | string $auth_method_type: auth_method_type |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_edit_restrict(
string
$page
)
|
|
Check if a page is restricted to edit or not
PukiWiki API Extension
Parameters:
API Tags:
| Access: | public |
| Uses: | is_freeze - (PukiWiki lib/func.php) |
| Uses: | sonots::is_edit_auth |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_human(
[boolean
$is_human = false], [boolean
$use_session = false], [int
$use_rolelevel = 0]
)
|
|
Human recognition using PukiWiki Auth methods
PukiWiki API Extension
Parameters:
|
boolean |
$is_human: |
Tell this is a human (Use true to store into session) |
|
boolean |
$use_session: |
Use Session log |
|
int |
$use_rolelevel: |
accepts users whose role levels are stronger than this |
API Tags:
| Access: | public |
| Uses: | auth::check_role - (PukiWiki Plus! lib/auth.php) if available |
| Uses: | sonots::is_admin |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_interwiki(
string
$str
)
|
|
Check if string is InterWiki syntax or not
PukiWiki API Extension
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_newpage(
string
$page
)
|
|
Check if page is newpage
PukiWiki API Extension
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean is_page_newer(
string
$page, string
$file, [bool
$ignore_notimestamp = false]
)
|
|
Check if the page timestamp is newer than the file timestamp
PukiWiki API Extension
Parameters:
|
string |
$page: |
pagename |
|
string |
$file: |
filename |
|
bool |
$ignore_notimestamp: |
see true editted time |
API Tags:
Information Tags:
| Version: | $Id: v 1.1 2008-07-16 11:14:46 sonots $ |
static boolean is_read_auth(
$page
$page, [$user
$user = '']
)
|
|
Check if a page is configured to require the read-authentication
PukiWiki API Extension
Parameters:
|
$page |
$page: |
pagename |
|
$user |
$user: |
if want to check whether this user possibly can get permission |
API Tags:
| Global: | boolean $read_auth: read_auth |
| Global: | array $read_auth_pages: read_auth_pages |
| Global: | string $auth_method_type: auth_method_type |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array make_heading(
string
$line, [bool
$strip = true]
)
|
|
Get heading strings from a wiki source line
PukiWiki API Extension *** Heading Strings ((footnotes)) [id]
-> array("Heading Strings", "id")
Parameters:
|
string |
$line: |
a wiki source line |
|
bool |
$strip: |
cut footnotes |
API Tags:
| Return: | [0] heading string [1] a fixed-heading anchor |
| Access: | public |
| Uses: | make_heading |
Information Tags:
| Version: | $Id: v 1.1 2008-06-05 11:14:46 sonots $ |
static void make_inline(
$string
$string, [$page
$page = '']
)
|
|
Convert only inline plugins unlike make_link()
PukiWiki API Extension This (Precisely, InlineConverter) does htmlspecialchars, too.
Parameters:
|
$string |
$string: |
string |
|
$page |
$page: |
pagename, default is $vars['page'] |
API Tags:
| See: | make_link (PukiWiki lib/make_link.php) |
| Access: | public |
| Uses: | InlineConverter - (PukiWiki lib/make_link.php) |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string make_pageanamelink_icon(
string
$page
)
|
|
make page aname link showing anchor icon (symbol)
PukiWiki API Extension
Parameters:
API Tags:
| Return: | html |
| See: | aname.inc.php (aname allows only fiexed_anchors such as x83dvkd8) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.1 2008-06-07 11:14:46 sonots $ |
| Todo: | refine more |
static string make_pageanchor(
string
$page
)
|
|
make page anchor
PukiWiki API Extension
Parameters:
API Tags:
| Return: | anchor (no starting #) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string make_pageeditlink_icon(
string
$page
)
|
|
make page edit link showing edit icon
PukiWiki API Extension
Parameters:
API Tags:
| Return: | html |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
| Todo: | refine more |
static string make_pagelink_nopg(
string
$page, [string
$alias = ''], [string
$anchor = ''], [string
$refer = ''], [boolean
$isautolink = false]
)
|
|
make_pagelink without passage
PukiWiki API Extension
Parameters:
|
string |
$page: |
pagename to be used to create link |
|
string |
$alias: |
<a href="">alias</a> |
|
string |
$anchor: |
anchor starting from # |
|
string |
$refer: |
|
|
boolean |
$isautolink: |
true changes looks of link |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string make_toplink(
[string
$alias = ''], [string
$anchor = '']
)
|
|
make a link to pukiwiki top url
PukiWiki API Extension
Parameters:
|
string |
$alias: |
<a href="">alias</a> |
|
string |
$anchor: |
anchor starting from # |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-08-15 11:14:46 sonots $ |
static void map_members(
array
&$objects, string
$name, callback
$callback
)
|
|
Applies the callback to the members of the given array objects
PHP API Extension
Parameters:
|
array |
&$objects: |
array of objects |
|
string |
$name: |
member name |
|
callback |
$callback: |
|
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-10 11:14:46 sonots $ |
| Since: | 1.10 |
static boolean move(
string
$oldname, string
$newname
)
|
|
Move a file (rename does not overwrite if $newname exists on Win, but move does)
PHP API Extension
Parameters:
|
string |
$oldname: |
|
|
string |
$newname: |
|
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
Error Handling in PHP4. catch an error message
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static void mythrow(
string
$errmsg
)
|
|
Error Handling in PHP4. throw an error message
PHP5) function a_function_throw_inside()
{
throw(new Exception('Throw Error'));
}
try {
a_function_throw_inside();
echo 'Never Executed';
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
This) function a_function_throw_inside()
{
}
sonots::init_error(); do { // try
a_function_throw_inside();
echo 'Never Executed';
} while (false);
}
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array parse_options(
array
$args, [array
$conf_options = array()], [boolean
$trim = false], [string
$sep = '=']
)
|
|
PukiWiki simple option parser
PukiWiki API Extension Example) $args = array('str=hoge','bool');
// array('str'=>'hoge','bool'=>true);
$conf_options = array('str'=>'foobar','bool'=>false); // default
$args = array('bool','unknown=hoge');
// array('str'=>'foobar','bool'=>true); // unknown is not set
Parameters:
|
array |
$args: |
|
|
array |
$conf_options: |
|
|
boolean |
$trim: |
trim option key/val |
|
string |
$sep: |
key/val separator |
API Tags:
| Return: | options |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.1 2008-06-05 11:14:46 sonots $ |
static void pkwk_output_noskin(
string
$body, [string
$content_type = 'text/html']
)
|
|
Output contents without skin
PukiWiki API Extension
Parameters:
|
string |
$body: |
html |
|
string |
$content_type: |
e.g., 'text/html', 'text/css', 'text/javascript' |
API Tags:
| Return: | exit |
| Access: | public |
| Uses: | pkwk_common_headers - (PukiWiki lib/html.php) |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string realurl(
string
$base, string
$url
)
|
|
Get absolute URL
PHP Extension
Parameters:
|
string |
$base: |
base url |
|
string |
$url: |
relative url |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static void remove_multilineplugin_lines(
&$lines, array
$lines
)
|
|
Remove inside of multiline plugin arguments.
Keys are preserved. PukiWiki API Extension
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static boolean r_mkdir(
string
$dir, [int
$mode = 0755]
)
|
|
mkdir recursively (mkdir of PHP5 has recursive flag)
PHP Compat
Parameters:
API Tags:
| Return: | success or failure |
| See: | php_compat_mkdir($dir, $mode, $recurstive, $context) |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array r_strpos(
string
$str, string
$substr
)
|
|
Find positions of occurrence of a string
PHP API Extension
Parameters:
|
string |
$str: |
|
|
string |
$substr: |
|
API Tags:
| Return: | positions |
| Access: | public |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static void set_members(
array
&$objects, string
$name,
&$members, array
$members
)
|
|
Set array into members of array of class objects
PHP API Extension
Parameters:
|
array |
&$objects: |
array of objects |
|
string |
$name: |
member name |
|
array |
$members: |
array of member variables, size and keys must be same with $objects. |
|
|
&$members: |
|
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static void sort_filenames(
array
&$filenames
)
|
|
Special sort function for filenames (/ has a special meaning)
PHP API Extension This function makes sure that files under a directory are followed by the directory as Foo
Foo/Bar
FooBar
not Foo
FooBar
Foo/Bar
This function is especially useful when filenames include multi-byte words
Parameters:
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static array string_to_array(
string
$string, [string
$hashsep = ':'], [string
$elemsep = ','], [string
$openarray = '('], [string
$closearray = ')'], [boolean
$decode = true]
)
|
|
Restore a string to an array.
PHP API Extension Example $string = 'A,B,indC:C,(0:D,1:E),indF:F'
<code>
Output:
<code>
array('A', 'B', 'indC' => 'C', array('D', 'E'), 'indF'=>'F');
Parameters:
|
string |
$string: |
|
|
string |
$hashsep: |
A character to be used as a hash key and val seperator |
|
string |
$elemsep: |
A character to be used as a elememt separator |
|
string |
$openarray: |
A character to be used as an open bracket of an array |
|
string |
$closearray: |
A character to be used as a close bracket of an array |
|
boolean |
$decode: |
Performe decode key/val |
API Tags:
Information Tags:
| Version: | $Id: v 1.3 2008-07-15 11:14:46 sonots $ |
static array trim_array(
array
$array, [boolean
$recursive = false], [boolean
$trimkey = false]
)
|
|
trim elements of array
PHP API Extension
Parameters:
|
array |
$array: |
|
|
boolean |
$recursive: |
recursively |
|
boolean |
$trimkey: |
trim key too |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string &unhtmlspecialchars(
string
$string
)
|
|
Undo htmlspecialchars
PHP API Extension
Parameters:
API Tags:
| Return: | Undone htmlspecialchars |
| See: | htmlspecialchars() |
| Access: | public |
| Example: | example not found |
Information Tags:
| Version: | $Id: v 1.0 2008-06-05 11:14:46 sonots $ |
static string urldecode(
string
$string, [string
$chars = null]
)
|
|
Urldecode only given specific chars
PHP API Extension
Parameters:
|
string |
$string: |
|
|
string |
$chars: |
this string is splitted into chars. If null, urldecode is performed. |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-07-15 11:14:46 sonots $ |
static string urlencode(
string
$string, [string
$chars = null]
)
|
|
Urlencode only given specific chars
PHP API Extension
Parameters:
|
string |
$string: |
|
|
string |
$chars: |
this string is splitted into chars. If null, urlencode is performed. |
API Tags:
Information Tags:
| Version: | $Id: v 1.0 2008-07-15 11:14:46 sonots $ |
|
|