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

Procedural File: file.php

Source Location: /file.php

Page Details

File related functions

PukiWiki - Yet another WikiWikiWeb clone.

Plus!NOTE:(policy)not merge official cvs(1.77->1.78) See Question/181

Version:  $Id: file.php,v 1.78.31 2007/06/17 16:56:00 upk Exp $
Copyright:  Copyright (C)
  • 2005-2007 PukiWiki Plus! Team
  • 2002-2007 PukiWiki Developers Team
  • 2001-2002 Originally written by yu-ji
License:  License: GPL v2 or (at your option) any later version
Constants
PKWK_AUTOALIAS_REGEX_CACHE  [line 40]

PKWK_AUTOALIAS_REGEX_CACHE = 'autoalias.dat'

AutoAlias cache file


[ Top ]

PKWK_AUTOBASEALIAS_CACHE  [line 48]

PKWK_AUTOBASEALIAS_CACHE = 'autobasealias.dat'

AutoBaseAlias cache file


[ Top ]

PKWK_AUTOLINK_REGEX_CACHE  [line 36]

PKWK_AUTOLINK_REGEX_CACHE = 'autolink.dat'

AutoLink cache file


[ Top ]

PKWK_ENTITIES_REGEX_CACHE  [line 31]

PKWK_ENTITIES_REGEX_CACHE = 'entities.dat'

XHTML entities


[ Top ]

PKWK_GLOSSARY_REGEX_CACHE  [line 44]

PKWK_GLOSSARY_REGEX_CACHE = 'glossary.dat'

Glossary cache file


[ Top ]

PKWK_MAXSHOW_ALLOWANCE  [line 22]

PKWK_MAXSHOW_ALLOWANCE = 10

Maximum number in RecentChanges


[ Top ]

PKWK_MAXSHOW_CACHE  [line 26]

PKWK_MAXSHOW_CACHE = 'recent.dat'

RecentChanges cache file


[ Top ]


Functions
add_recent  [line 586]

void add_recent( string $page, string $recentpage, [string $subject = ''], [int $limit = 0]  )

Add a page to a recent page such as RecentChanges, RecentDeleted

Parameters:
string   $page:  page to be added to log
string   $recentpage:  log page
string   $subject:  additional comment
int   $limit:  number of limits to be logged

API Tags:
Usedby:  file_write()


[ Top ]
autobasealias_write  [line 819]

void autobasealias_write( string $filename, array &$pages  )

Update AutoBaseAlias data

Parameters:
string   $filename:  log file, usually CACHE_DIR.PKWK_AUTOBASEALIAS_CACHE(autobasealias.dat)
array   &$pages:  existpages

API Tags:
Global:  string $autobasealias_nonlist: use $autobasealias_nonlist
See:  get_existpages()
Uses:  get_short_pagename()


[ Top ]
autolink_pattern_write  [line 852]

void autolink_pattern_write( string $filename, array $autolink_pattern  )

Update autolink data

Parameters:
string   $filename:  log file, usually CACHE_DIR.PKWK_AUTOLINK_REGEX_CACHE(autolink.dat)
array   $autolink_pattern:  autolink patten to be saved

API Tags:
See:  get_autolink_pattern()
See:  get_autoglossary_pattern
Usedby:  page_write()


[ Top ]
file_head  [line 435]

array file_head( string $file, [int $count = 1], [boolean $lock = TRUE], [int $buffer = 8192]  )

Read top N lines as an array

Parameters:
string   $file:  filename
int   $count:  number of executed fgets, generally number of lines
boolean   $lock:  use lock or not
int   $buffer:  number of bytes to be read in one fgets

API Tags:
Return:  lines of contents
See:  file() Use PHP file() function if you want to get ALL lines
Usedby:  lastmodified_add()


[ Top ]
file_write  [line 474]

void file_write( string $dir, string $page, string $str, [boolean $notimestamp = FALSE]  )

Output to a file

Parameters:
string   $dir:  directory such as DATA_DIR, DIFF_DIR
string   $page:  pagename
string   $str:  contents to be written
boolean   $notimestamp:  do not update timestamp

API Tags:
Uses:  pkwk_mail_notify()
Uses:  pkwk_touch_file()
Uses:  string_bracket
Usedby:  page_write()
Uses:  lastmodified_add()
Uses:  is_page()
Uses:  auth::check_role
Uses:  encode()
Uses:  file_exists
Uses:  add_recent()


[ Top ]
generate_fixed_heading_anchor_id  [line 417]

string generate_fixed_heading_anchor_id( string $seed  )

Generate fixed heading anchor id randomly

Parameters:
string   $seed:  usually heading strings

API Tags:
Return:  A random alphabetic letter + 7 letters of random strings


[ Top ]
get_diff_lines  [line 280]

array get_diff_lines( string $diffdata  )

Get diff lines from diff format text such as

 - minus
 + plus

Parameters:
string   $diffdata:  diff format text

API Tags:
Return:  array($plus, $minus)
  • string $plus +lines
  • string $minus -lines
Usedby:  get_link_list()


[ Top ]
get_existfiles  [line 1108]

array get_existfiles( string $dir, string $ext  )

Get a list of encoded files (must specify a directory and a suffix)

Parameters:
string   $dir:  directory name
string   $ext:  common file extension

API Tags:
Return:  file paths which each path is as "$dir . filename"


[ Top ]
get_existpages  [line 914]

array get_existpages( [string $dir = DATA_DIR], [string $ext = '.txt']  )

Get a page list of this wiki

Parameters:
string   $dir:  directory name
string   $ext:  common file extension

API Tags:
Return:  pagenames
Usedby:  do_search()
Usedby:  put_lastmodified()


[ Top ]
get_filename  [line 108]

string get_filename( string $page  )

Get physical file name of the page

Parameters:
string   $page:  pagename

API Tags:
Return:  encoded local path file name
Usedby:  is_page()


[ Top ]
get_filetime  [line 97]

int get_filetime( string $page  )

Get last-modified filetime of the page

Parameters:
string   $page:  pagename

API Tags:
Return:  filemtime or 0 if page does not exist
Usedby:  get_pg_passage()


[ Top ]
get_link_list  [line 234]

array get_link_list( string $diffdata  )

Get newly added links from diff format text such as

 - minus
 + plus
(simply plus is not enough because plus and minus could have same links yet)

Parameters:
string   $diffdata: 

API Tags:
Return:  array $links or null
Usedby:  get_this_time_links()
Uses:  get_diff_lines()


[ Top ]
get_pg_passage  [line 878]

string get_pg_passage( string $page, [boolean $sw = TRUE]  )

Get elapsed date of the page

Parameters:
string   $page:  pagename
boolean   $sw:  add <small> tag or not

API Tags:
Global:  boolean $show_passage: get passage or not
Usedby:  page_list()
Uses:  get_passage()
Uses:  get_filetime()


[ Top ]
get_readings  [line 939]

array get_readings( array &$pages  )

Get PageReading(pronounce-annotated) data in an array()

Parameters:
array   &$pages:  pages

API Tags:
Return:  associative array whose keys are pagenames and values are readings
Usedby:  page_list() - if $pagereading_enable is TRUE


[ Top ]
get_source  [line 58]

array|string get_source( [string $page = NULL], [boolean $lock = TRUE], [boolean $join = FALSE]  )

Get source(wiki text) data of the page

Parameters:
string   $page:  pagename
boolean   $lock:  lock file on reading
boolean   $join:  join lines (array) of source into a string

API Tags:
Return:  lines of source or joined source. Each line have "\n" at the end.


[ Top ]
get_this_time_links  [line 326]

array get_this_time_links( string $post, string $diff  )

Get newly added link this time

Parameters:
string   $post:  a posted wiki source text
string   $diff:  a diff format text (diff between new and old source)

API Tags:
Return:  array $links
See:  do_diff()
Usedby:  page_write()
Uses:  replace_plugin_link2null()
Uses:  get_link_list()


[ Top ]
header_lastmod  [line 896]

void header_lastmod( [string $page = NULL]  )

Send Last-Modified HTTP header

Parameters:
string   $page: 

API Tags:
Global:  boolean $lastmod: send Last-Modified HTTP header or not


[ Top ]
lastmodified_add  [line 641]

void lastmodified_add( [string $update = ''], [string $remove = '']  )

Update PKWK_MAXSHOW_CACHE(recent.dat) and $whatsnew(RecentChanges) (Light) Use without $autolink

Parameters:
string   $update:  updated page, added to log file
string   $remove:  deleted page, removed from log file

API Tags:
Global:  int $maxshow: number of logs in $whatsnew
Global:  string $whatsnew: whatsnew pagename (RecentChanges)
Global:  boolean $autolink: autolink is effective or not
Global:  boolean $autobasealias: autobasealias is effective or not
Usedby:  file_write()
Uses:  put_lastmodified()
Uses:  pkwk_touch_file()
Uses:  file_head()

Information Tags:
Since:  PukiWiki 1.4.7

[ Top ]
links_get_related  [line 1129]

array links_get_related( string $page  )

Get a list of related pages of the page

Parameters:
string   $page: 

API Tags:
Global:  array $vars:
Global:  array $related: If possible, merge related pages generated by make_link()
Uses:  links_get_related_db()


[ Top ]
make_str_rules  [line 353]

string make_str_rules( string $source  )

Modify original text with user-defined / system-defined rules

Parameters:
string   $source:  wiki source text

API Tags:
Return:  replaced text
Global:  string $str_rules: replace rules.
Global:  boolean $fixed_heading_anchor:
See:  rules.ini.php for $str_rules
Usedby:  page_write()


[ Top ]
page_write  [line 135]

void page_write( string $page, string $postdata, [boolean $notimestamp = FALSE]  )

Put a data(wiki text) into a physical file(diff, backup, text)

Parameters:
string   $page: 
string   $postdata:  contents to be written
boolean   $notimestamp:  do not update timestamp

API Tags:
Uses:  log_write()
Uses:  links_update()
Uses:  make_backup()
Uses:  make_str_rules()
Uses:  tb_send()
Uses:  postdata_write()
Uses:  is_page()
Uses:  get_this_time_links()
Uses:  file_write()
Uses:  do_diff()
Uses:  get_autoglossaries()
Uses:  get_autolink_pattern()
Uses:  get_glossary_pattern()
Uses:  autolink_pattern_write()


[ Top ]
pkwk_chown  [line 1154]

void pkwk_chown( string $filename, [boolean $preserve_time = TRUE]  )

_If needed_, re-create the file to change/correct ownership into PHP's NOTE: Not works for Windows

Parameters:
string   $filename: 
boolean   $preserve_time:  do not update timestamp

API Tags:
Usedby:  pkwk_touch_file()

Information Tags:
Since:  PukiWiki 1.4.6

[ Top ]
pkwk_touch_file  [line 1225]

void pkwk_touch_file( string $filename, [int $time = FALSE], [int $atime = FALSE]  )

touch() with trying pkwk_chown()

Parameters:
string   $filename: 
int   $time:  mtime
int   $atime:  atime

API Tags:
Usedby:  lastmodified_add()
Usedby:  file_write()
Uses:  pkwk_chown()

Information Tags:
Since:  PukiWiki 1.4.6

[ Top ]
put_lastmodified  [line 730]

void put_lastmodified( )

Update RecentChanges

Update PKWK_AUTOLINK_REGEX_CACHE(autolink.dat) and PKWK_AUTOBASEALIS_CACHE(autobasealias.dat), too


API Tags:
Global:  int $maxshow: number of logs in $whatsnew
Global:  string $whatsnew: whatsnew pagename (RecentChanges)
Global:  boolean $autolink: autolink is effective or not
Global:  boolean $autobasealias: atuobasealias is effective or not
Usedby:  lastmodified_add()
Uses:  get_existpages()
Uses:  auth::check_role


[ Top ]
replace_plugin_link2null  [line 298]

array replace_plugin_link2null( string $data  )

Get links in a wiki source text after replacing some plugins into null plugin

Used when TrackBack Ping and SPAM Check are processed

Parameters:
string   $data:  a wiki source text

API Tags:
Return:  array $links
Global:  array $exclude_link_plugin: plugins to be replaced into null plugin
Usedby:  get_this_time_links()


[ Top ]


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