diff options
Diffstat (limited to 'inc')
65 files changed, 2274 insertions, 565 deletions
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 3c955cf88..210d1c0eb 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -14,6 +14,9 @@ class _DiffOp { var $orig; var $closing; + /** + * @return _DiffOp + */ function reverse() { trigger_error("pure virtual", E_USER_ERROR); } @@ -104,6 +107,21 @@ class _DiffOp_Change extends _DiffOp { */ class _DiffEngine { + var $xchanged = array(); + var $ychanged = array(); + var $xv = array(); + var $yv = array(); + var $xind = array(); + var $yind = array(); + var $seq; + var $in_seq; + var $lcs; + + /** + * @param array $from_lines + * @param array $to_lines + * @return _DiffOp[] + */ function diff($from_lines, $to_lines) { $n_from = count($from_lines); $n_to = count($to_lines); @@ -495,9 +513,9 @@ class Diff { * Constructor. * Computes diff between sequences of strings. * - * @param $from_lines array An array of strings. - * (Typically these are lines from a file.) - * @param $to_lines array An array of strings. + * @param array $from_lines An array of strings. + * (Typically these are lines from a file.) + * @param array $to_lines An array of strings. */ function __construct($from_lines, $to_lines) { $eng = new _DiffEngine; @@ -512,8 +530,9 @@ class Diff { * * $diff = new Diff($lines1, $lines2); * $rev = $diff->reverse(); - * @return object A Diff object representing the inverse of the - * original diff. + * + * @return Diff A Diff object representing the inverse of the + * original diff. */ function reverse() { $rev = $this; @@ -631,19 +650,19 @@ class MappedDiff extends Diff { * case-insensitve diffs, or diffs which ignore * changes in white-space. * - * @param $from_lines array An array of strings. - * (Typically these are lines from a file.) + * @param string[] $from_lines An array of strings. + * (Typically these are lines from a file.) * - * @param $to_lines array An array of strings. + * @param string[] $to_lines An array of strings. * - * @param $mapped_from_lines array This array should - * have the same size number of elements as $from_lines. - * The elements in $mapped_from_lines and - * $mapped_to_lines are what is actually compared - * when computing the diff. + * @param string[] $mapped_from_lines This array should + * have the same size number of elements as $from_lines. + * The elements in $mapped_from_lines and + * $mapped_to_lines are what is actually compared + * when computing the diff. * - * @param $mapped_to_lines array This array should - * have the same number of elements as $to_lines. + * @param string[] $mapped_to_lines This array should + * have the same number of elements as $to_lines. */ function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { @@ -697,12 +716,13 @@ class DiffFormatter { /** * Format a diff. * - * @param $diff object A Diff object. + * @param Diff $diff A Diff object. * @return string The formatted output. */ function format($diff) { $xi = $yi = 1; + $x0 = $y0 = 0; $block = false; $context = array(); @@ -752,6 +772,13 @@ class DiffFormatter { return $this->_end_diff(); } + /** + * @param int $xbeg + * @param int $xlen + * @param int $ybeg + * @param int $ylen + * @param array $edits + */ function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) { $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen)); foreach ($edits as $edit) { @@ -779,6 +806,13 @@ class DiffFormatter { return $val; } + /** + * @param int $xbeg + * @param int $xlen + * @param int $ybeg + * @param int $ylen + * @return string + */ function _block_header($xbeg, $xlen, $ybeg, $ylen) { if ($xlen > 1) $xbeg .= "," . ($xbeg + $xlen - 1); @@ -788,6 +822,9 @@ class DiffFormatter { return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; } + /** + * @param string $header + */ function _start_block($header) { echo $header; } @@ -896,6 +933,9 @@ class _HWLDF_WordAccumulator { $this->_tag = $new_tag; } + /** + * @param string $new_tag + */ function _flushLine($new_tag) { $this->_flushGroup($new_tag); if ($this->_line != '') @@ -1055,6 +1095,10 @@ class TableDiffFormatter extends DiffFormatter { $this->trailing_context_lines = 2; } + /** + * @param Diff $diff + * @return string + */ function format($diff) { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. @@ -1165,6 +1209,10 @@ class InlineDiffFormatter extends DiffFormatter { $this->trailing_context_lines = 2; } + /** + * @param Diff $diff + * @return string + */ function format($diff) { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index cd4c7c4c5..76d973c38 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -57,6 +57,12 @@ class DokuHTTPClient extends HTTPClient { * @triggers HTTPCLIENT_REQUEST_SEND * @author Andreas Gohr <andi@splitbrain.org> */ + /** + * @param string $url + * @param string|array $data the post data either as array or raw data + * @param string $method + * @return bool + */ function sendRequest($url,$data='',$method='GET'){ $httpdata = array('url' => $url, 'data' => $data, @@ -104,7 +110,7 @@ class HTTPClient { var $header_regexp; // if set this RE must match against the headers, else abort var $headers; var $debug; - var $start = 0; // for timings + var $start = 0.0; // for timings var $keep_alive = true; // keep alive rocks // don't set these, read on error @@ -166,7 +172,8 @@ class HTTPClient { * * @param string $url The URL to fetch * @param bool $sloppy304 Return body on 304 not modified - * @return bool|string response body, false on error + * @return false|string response body, false on error + * * @author Andreas Gohr <andi@splitbrain.org> */ function get($url,$sloppy304=false){ @@ -187,7 +194,8 @@ class HTTPClient { * @param string $url The URL to fetch * @param array $data Associative array of parameters * @param bool $sloppy304 Return body on 304 not modified - * @return bool|string response body, false on error + * @return false|string response body, false on error + * * @author Andreas Gohr <andi@splitbrain.org> */ function dget($url,$data,$sloppy304=false){ @@ -207,7 +215,7 @@ class HTTPClient { * * @param string $url The URL to fetch * @param array $data Associative array of parameters - * @return bool|string response body, false on error + * @return false|string response body, false on error * @author Andreas Gohr <andi@splitbrain.org> */ function post($url,$data){ @@ -229,6 +237,7 @@ class HTTPClient { * @param mixed $data - the post data either as array or raw data * @param string $method - HTTP Method usually GET or POST. * @return bool - true on success + * * @author Andreas Goetz <cpuidle@gmx.de> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -580,7 +589,18 @@ class HTTPClient { $this->_debug('SSL Tunnel Response',$r_headers); if(preg_match('/^HTTP\/1\.[01] 200/i',$r_headers)){ - if (stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT)) { + // set correct peer name for verification (enabled since PHP 5.6) + stream_context_set_option($socket, 'ssl', 'peer_name', $requestinfo['host']); + + // Because of older PHP versions having trouble with TLS (enable_crypto returns true, but + // the conection still borks) we try SSLv3 first + if (@stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT)) { + $requesturl = $requestinfo['path']; + return true; + } + + // If the proxy does not support SSLv3 we try TLS + if (@stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { $requesturl = $requestinfo['path']; return true; } @@ -596,6 +616,7 @@ class HTTPClient { * @param string $data The data to write * @param string $message Description of what is being read * @throws HTTPClientException + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _sendData($socket, $data, $message) { @@ -640,6 +661,7 @@ class HTTPClient { * @param bool $ignore_eof End-of-file is not an error if this is set * @throws HTTPClientException * @return string + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readData($socket, $nbytes, $message, $ignore_eof = false) { @@ -689,6 +711,7 @@ class HTTPClient { * @param string $message Description of what is being read * @throws HTTPClientException * @return string + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function _readLine($socket, $message) { @@ -723,6 +746,9 @@ class HTTPClient { * Uses _debug_text or _debug_html depending on the SAPI name * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $info + * @param mixed $var */ function _debug($info,$var=null){ if(!$this->debug) return; @@ -736,8 +762,8 @@ class HTTPClient { /** * print debug info as HTML * - * @param $info - * @param null $var + * @param string $info + * @param mixed $var */ function _debug_html($info, $var=null){ print '<b>'.$info.'</b> '.($this->_time() - $this->start).'s<br />'; @@ -753,8 +779,8 @@ class HTTPClient { /** * prints debug info as plain text * - * @param $info - * @param null $var + * @param string $info + * @param mixed $var */ function _debug_text($info, $var=null){ print '*'.$info.'* '.($this->_time() - $this->start)."s\n"; @@ -764,6 +790,8 @@ class HTTPClient { /** * Return current timestamp in microsecond resolution + * + * @return float */ static function _time(){ list($usec, $sec) = explode(" ", microtime()); @@ -776,6 +804,9 @@ class HTTPClient { * All Keys are lowercased. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @return array */ function _parseHeaders($string){ $headers = array(); @@ -804,6 +835,9 @@ class HTTPClient { * convert given header array to header string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $headers + * @return string */ function _buildHeaders($headers){ $string = ''; @@ -818,6 +852,8 @@ class HTTPClient { * get cookies as http header string * * @author Andreas Goetz <cpuidle@gmx.de> + * + * @return string */ function _getCookies(){ $headers = ''; @@ -833,6 +869,9 @@ class HTTPClient { * Encode data for posting * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data + * @return string */ function _postEncode($data){ return http_build_query($data,'','&'); @@ -843,6 +882,9 @@ class HTTPClient { * * @fixme use of urlencode might be wrong here * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data + * @return string */ function _postMultipartEncode($data){ $boundary = '--'.$this->boundary; diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 979dc4d16..839298680 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -1,101 +1,146 @@ <?php + /** - * IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002 + * IXR - The Incutio XML-RPC Library + * + * Copyright (c) 2010, Incutio Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the name of Incutio Ltd. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * @version 1.61 - * @author Simon Willison - * @date 11th July 2003 - * @link http://scripts.incutio.com/xmlrpc/ - * @link http://scripts.incutio.com/xmlrpc/manual.php - * @license Artistic License http://www.opensource.org/licenses/artistic-license.php + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package IXR + * @since 1.5 + * + * @copyright Incutio Ltd 2010 (http://www.incutio.com) + * @version 1.7.4 7th September 2010 + * @author Simon Willison + * @link http://scripts.incutio.com/xmlrpc/ Site/manual * * Modified for DokuWiki * @author Andreas Gohr <andi@splitbrain.org> */ - - class IXR_Value { + + /** @var IXR_Value[]|IXR_Date|IXR_Base64|int|bool|double|string */ var $data; + /** @var string */ var $type; - function IXR_Value ($data, $type = false) { + + /** + * @param mixed $data + * @param bool $type + */ + function IXR_Value($data, $type = false) { $this->data = $data; - if (!$type) { + if(!$type) { $type = $this->calculateType(); } $this->type = $type; - if ($type == 'struct') { - /* Turn all the values in the array in to new IXR_Value objects */ - foreach ($this->data as $key => $value) { + if($type == 'struct') { + // Turn all the values in the array in to new IXR_Value objects + foreach($this->data as $key => $value) { $this->data[$key] = new IXR_Value($value); } } - if ($type == 'array') { - for ($i = 0, $j = count($this->data); $i < $j; $i++) { + if($type == 'array') { + for($i = 0, $j = count($this->data); $i < $j; $i++) { $this->data[$i] = new IXR_Value($this->data[$i]); } } } + + /** + * @return string + */ function calculateType() { - if ($this->data === true || $this->data === false) { + if($this->data === true || $this->data === false) { return 'boolean'; } - if (is_integer($this->data)) { + if(is_integer($this->data)) { return 'int'; } - if (is_double($this->data)) { + if(is_double($this->data)) { return 'double'; } + // Deal with IXR object types base64 and date - if (is_object($this->data) && is_a($this->data, 'IXR_Date')) { + if(is_object($this->data) && is_a($this->data, 'IXR_Date')) { return 'date'; } - if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) { + if(is_object($this->data) && is_a($this->data, 'IXR_Base64')) { return 'base64'; } - // If it is a normal PHP object convert it in to a struct - if (is_object($this->data)) { + // If it is a normal PHP object convert it in to a struct + if(is_object($this->data)) { $this->data = get_object_vars($this->data); return 'struct'; } - if (!is_array($this->data)) { + if(!is_array($this->data)) { return 'string'; } - /* We have an array - is it an array or a struct ? */ - if ($this->isStruct($this->data)) { + + // We have an array - is it an array or a struct? + if($this->isStruct($this->data)) { return 'struct'; } else { return 'array'; } } + + /** + * @return bool|string + */ function getXml() { - /* Return XML for this value */ - switch ($this->type) { + // Return XML for this value + switch($this->type) { case 'boolean': - return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>'; + return '<boolean>' . (($this->data) ? '1' : '0') . '</boolean>'; break; case 'int': - return '<int>'.$this->data.'</int>'; + return '<int>' . $this->data . '</int>'; break; case 'double': - return '<double>'.$this->data.'</double>'; + return '<double>' . $this->data . '</double>'; break; case 'string': - return '<string>'.htmlspecialchars($this->data).'</string>'; + return '<string>' . htmlspecialchars($this->data) . '</string>'; break; case 'array': - $return = '<array><data>'."\n"; - foreach ($this->data as $item) { - $return .= ' <value>'.$item->getXml()."</value>\n"; + $return = '<array><data>' . "\n"; + foreach($this->data as $item) { + $return .= ' <value>' . $item->getXml() . "</value>\n"; } $return .= '</data></array>'; return $return; break; case 'struct': - $return = '<struct>'."\n"; - foreach ($this->data as $name => $value) { + $return = '<struct>' . "\n"; + foreach($this->data as $name => $value) { $return .= " <member><name>$name</name><value>"; - $return .= $value->getXml()."</value></member>\n"; + $return .= $value->getXml() . "</value></member>\n"; } $return .= '</struct>'; return $return; @@ -107,11 +152,17 @@ class IXR_Value { } return false; } + + /** + * Checks whether or not the supplied array is a struct or not + * + * @param array $array + * @return boolean + */ function isStruct($array) { - /* Nasty function to check if an array is a struct or not */ $expected = 0; - foreach ($array as $key => $value) { - if ((string)$key != (string)$expected) { + foreach($array as $key => $value) { + if((string) $key != (string) $expected) { return true; } $expected++; @@ -120,18 +171,25 @@ class IXR_Value { } } - +/** + * IXR_MESSAGE + * + * @package IXR + * @since 1.5 + * + */ class IXR_Message { var $message; - var $messageType; // methodCall / methodResponse / fault + var $messageType; // methodCall / methodResponse / fault var $faultCode; var $faultString; var $methodName; var $params; + // Current variable stacks - var $_arraystructs = array(); // The stack used to keep track of the current array/struct + var $_arraystructs = array(); // The stack used to keep track of the current array/struct var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array - var $_currentStructName = array(); // A stack as well + var $_currentStructName = array(); // A stack as well var $_param; var $_value; var $_currentTag; @@ -139,12 +197,23 @@ class IXR_Message { var $_lastseen; // The XML parser var $_parser; - function IXR_Message ($message) { - $this->message = $message; + + /** + * @param string $message + */ + function IXR_Message($message) { + $this->message =& $message; } + + /** + * @return bool + */ function parse() { // first remove the XML declaration - $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); + // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages + $header = preg_replace('/<\?xml.*?\?' . '>/', '', substr($this->message, 0, 100), 1); + $this->message = substr_replace($this->message, $header, 0, 100); + // workaround for a bug in PHP/libxml2, see http://bugs.php.net/bug.php?id=45996 $this->message = str_replace('<', '<', $this->message); $this->message = str_replace('>', '>', $this->message); @@ -152,7 +221,7 @@ class IXR_Message { $this->message = str_replace(''', ''', $this->message); $this->message = str_replace('"', '"', $this->message); $this->message = str_replace("\x0b", ' ', $this->message); //vertical tab - if (trim($this->message) == '') { + if(trim($this->message) == '') { return false; } $this->_parser = xml_parser_create(); @@ -162,23 +231,40 @@ class IXR_Message { xml_set_object($this->_parser, $this); xml_set_element_handler($this->_parser, 'tag_open', 'tag_close'); xml_set_character_data_handler($this->_parser, 'cdata'); - if (!xml_parse($this->_parser, $this->message)) { - /* die(sprintf('XML error: %s at line %d', - xml_error_string(xml_get_error_code($this->_parser)), - xml_get_current_line_number($this->_parser))); */ - return false; - } + $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages + $final = false; + do { + if(strlen($this->message) <= $chunk_size) { + $final = true; + } + $part = substr($this->message, 0, $chunk_size); + $this->message = substr($this->message, $chunk_size); + if(!xml_parse($this->_parser, $part, $final)) { + return false; + } + if($final) { + break; + } + } while(true); xml_parser_free($this->_parser); + // Grab the error messages, if any - if ($this->messageType == 'fault') { + if($this->messageType == 'fault') { $this->faultCode = $this->params[0]['faultCode']; $this->faultString = $this->params[0]['faultString']; } return true; } + + /** + * @param $parser + * @param string $tag + * @param $attr + */ function tag_open($parser, $tag, $attr) { - $this->currentTag = $tag; $this->_currentTagContents = ''; + $this->_currentTag = $tag; + switch($tag) { case 'methodCall': case 'methodResponse': @@ -186,7 +272,7 @@ class IXR_Message { $this->messageType = $tag; break; /* Deal with stacks of arrays and structs */ - case 'data': // data is to all intents and puposes more interesting than array + case 'data': // data is to all intents and purposes more interesting than array $this->_arraystructstypes[] = 'array'; $this->_arraystructs[] = array(); break; @@ -197,50 +283,52 @@ class IXR_Message { } $this->_lastseen = $tag; } + + /** + * @param $parser + * @param string $cdata + */ function cdata($parser, $cdata) { $this->_currentTagContents .= $cdata; } + + /** + * @param $parser + * @param $tag + */ function tag_close($parser, $tag) { $valueFlag = false; switch($tag) { case 'int': case 'i4': - $value = (int)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (int) trim($this->_currentTagContents); $valueFlag = true; break; case 'double': - $value = (double)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (double) trim($this->_currentTagContents); $valueFlag = true; break; case 'string': - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; + $value = (string) $this->_currentTagContents; $valueFlag = true; break; case 'dateTime.iso8601': $value = new IXR_Date(trim($this->_currentTagContents)); - // $value = $iso->getTimestamp(); - $this->_currentTagContents = ''; $valueFlag = true; break; case 'value': // "If no type is indicated, the type is string." - if($this->_lastseen == 'value'){ - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; + if($this->_lastseen == 'value') { + $value = (string) $this->_currentTagContents; $valueFlag = true; } break; case 'boolean': - $value = (boolean)trim($this->_currentTagContents); - $this->_currentTagContents = ''; + $value = (boolean) trim($this->_currentTagContents); $valueFlag = true; break; case 'base64': $value = base64_decode($this->_currentTagContents); - $this->_currentTagContents = ''; $valueFlag = true; break; /* Deal with stacks of arrays and structs */ @@ -255,75 +343,94 @@ class IXR_Message { break; case 'name': $this->_currentStructName[] = trim($this->_currentTagContents); - $this->_currentTagContents = ''; break; case 'methodName': $this->methodName = trim($this->_currentTagContents); - $this->_currentTagContents = ''; break; } - if ($valueFlag) { - /* - if (!is_array($value) && !is_object($value)) { - $value = trim($value); - } - */ - if (count($this->_arraystructs) > 0) { + + if($valueFlag) { + if(count($this->_arraystructs) > 0) { // Add value to struct or array - if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { + if($this->_arraystructstypes[count($this->_arraystructstypes) - 1] == 'struct') { // Add to struct - $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; + $this->_arraystructs[count($this->_arraystructs) - 1][$this->_currentStructName[count($this->_currentStructName) - 1]] = $value; } else { // Add to array - $this->_arraystructs[count($this->_arraystructs)-1][] = $value; + $this->_arraystructs[count($this->_arraystructs) - 1][] = $value; } } else { - // Just add as a paramater + // Just add as a parameter $this->params[] = $value; } } + $this->_currentTagContents = ''; $this->_lastseen = $tag; } } - +/** + * IXR_Server + * + * @package IXR + * @since 1.5 + */ class IXR_Server { var $data; + /** @var array */ var $callbacks = array(); var $message; + /** @var array */ var $capabilities; - function IXR_Server($callbacks = false, $data = false) { + + /** + * @param array|bool $callbacks + * @param bool $data + * @param bool $wait + */ + function IXR_Server($callbacks = false, $data = false, $wait = false) { $this->setCapabilities(); - if ($callbacks) { + if($callbacks) { $this->callbacks = $callbacks; } $this->setCallbacks(); - $this->serve($data); + + if(!$wait) { + $this->serve($data); + } } + + /** + * @param bool|string $data + */ function serve($data = false) { - if (!$data) { + if(!$data) { $postData = trim(http_get_raw_post_data()); - if (!$postData) { + if(!$postData) { + header('Content-Type: text/plain'); // merged from WP #9093 die('XML-RPC server accepts POST requests only.'); } $data = $postData; } $this->message = new IXR_Message($data); - if (!$this->message->parse()) { + if(!$this->message->parse()) { $this->error(-32700, 'parse error. not well formed'); } - if ($this->message->messageType != 'methodCall') { + if($this->message->messageType != 'methodCall') { $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall'); } $result = $this->call($this->message->methodName, $this->message->params); + // Is the result an error? - if (is_a($result, 'IXR_Error')) { + if(is_a($result, 'IXR_Error')) { $this->error($result); } + // Encode the result $r = new IXR_Value($result); $resultxml = $r->getXml(); + // Create the XML $xml = <<<EOD <methodResponse> @@ -340,16 +447,23 @@ EOD; // Send it $this->output($xml); } + + /** + * @param string $methodname + * @param array $args + * @return IXR_Error|mixed + */ function call($methodname, $args) { - if (!$this->hasMethod($methodname)) { - return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); + if(!$this->hasMethod($methodname)) { + return new IXR_Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.'); } $method = $this->callbacks[$methodname]; + // Perform the callback and send the response # Removed for DokuWiki to have a more consistent interface # if (count($args) == 1) { - # // If only one paramater just send that instead of the whole array + # // If only one parameter just send that instead of the whole array # $args = $args[0]; # } @@ -359,16 +473,16 @@ EOD; $args = (array) $args; // Are we dealing with a function or a method? - if (substr($method, 0, 5) == 'this:') { + if(is_string($method) && substr($method, 0, 5) == 'this:') { // It's a class method - check it exists $method = substr($method, 5); - if (!method_exists($this, $method)) { - return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); + if(!method_exists($this, $method)) { + return new IXR_Error(-32601, 'server error. requested class method "' . $method . '" does not exist.'); } // Call the method #$result = $this->$method($args); - $result = call_user_func_array(array(&$this,$method),$args); - } elseif (substr($method, 0, 7) == 'plugin:') { + $result = call_user_func_array(array(&$this, $method), $args); + } elseif(substr($method, 0, 7) == 'plugin:') { list($pluginname, $callback) = explode(':', substr($method, 7), 2); if(!plugin_isdisabled($pluginname)) { $plugin = plugin_load('action', $pluginname); @@ -378,31 +492,49 @@ EOD; } } else { // It's a function - does it exist? - if (!function_exists($method)) { - return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); + if(is_array($method)) { + if(!is_callable(array($method[0], $method[1]))) { + return new IXR_Error(-32601, 'server error. requested object method "' . $method[1] . '" does not exist.'); + } + } else if(!function_exists($method)) { + return new IXR_Error(-32601, 'server error. requested function "' . $method . '" does not exist.'); } + // Call the function - #$result = $method($args); - $result = call_user_func_array($method,$args); + $result = call_user_func($method, $args); } return $result; } + /** + * @param int $error + * @param string|bool $message + */ function error($error, $message = false) { // Accepts either an error object or an error code and message - if ($message && !is_object($error)) { + if($message && !is_object($error)) { $error = new IXR_Error($error, $message); } $this->output($error->getXml()); } + + /** + * @param string $xml + */ function output($xml) { header('Content-Type: text/xml; charset=utf-8'); echo '<?xml version="1.0"?>', "\n", $xml; exit; } + + /** + * @param string $method + * @return bool + */ function hasMethod($method) { return in_array($method, array_keys($this->callbacks)); } + function setCapabilities() { // Initialises capabilities array $this->capabilities = array( @@ -420,31 +552,45 @@ EOD; ), ); } + + /** + * @return mixed + */ function getCapabilities() { return $this->capabilities; } + function setCallbacks() { $this->callbacks['system.getCapabilities'] = 'this:getCapabilities'; $this->callbacks['system.listMethods'] = 'this:listMethods'; $this->callbacks['system.multicall'] = 'this:multiCall'; } + + /** + * @return array + */ function listMethods() { // Returns a list of methods - uses array_reverse to ensure user defined // methods are listed before server defined methods return array_reverse(array_keys($this->callbacks)); } + + /** + * @param array $methodcalls + * @return array + */ function multiCall($methodcalls) { // See http://www.xmlrpc.com/discuss/msgReader$1208 $return = array(); - foreach ($methodcalls as $call) { + foreach($methodcalls as $call) { $method = $call['methodName']; $params = $call['params']; - if ($method == 'system.multicall') { + if($method == 'system.multicall') { $result = new IXR_Error(-32800, 'Recursive calls to system.multicall are forbidden'); } else { $result = $this->call($method, $params); } - if (is_a($result, 'IXR_Error')) { + if(is_a($result, 'IXR_Error')) { $return[] = array( 'faultCode' => $result->code, 'faultString' => $result->message @@ -457,10 +603,24 @@ EOD; } } +/** + * IXR_Request + * + * @package IXR + * @since 1.5 + */ class IXR_Request { + /** @var string */ var $method; + /** @var array */ var $args; + /** @var string */ var $xml; + + /** + * @param string $method + * @param array $args + */ function IXR_Request($method, $args) { $this->method = $method; $this->args = $args; @@ -471,7 +631,7 @@ class IXR_Request { <params> EOD; - foreach ($this->args as $arg) { + foreach($this->args as $arg) { $this->xml .= '<param><value>'; $v = new IXR_Value($arg); $this->xml .= $v->getXml(); @@ -479,15 +639,28 @@ EOD; } $this->xml .= '</params></methodCall>'; } + + /** + * @return int + */ function getLength() { return strlen($this->xml); } + + /** + * @return string + */ function getXml() { return $this->xml; } } /** + * IXR_Client + * + * @package IXR + * @since 1.5 + * * Changed for DokuWiki to use DokuHTTPClient * * This should be compatible to the original class, but uses DokuWiki's @@ -498,19 +671,34 @@ EOD; */ class IXR_Client extends DokuHTTPClient { var $posturl = ''; + /** @var IXR_Message|bool */ var $message = false; + + // Storage place for an error message + /** @var IXR_Error|bool */ var $xmlerror = false; - function IXR_Client($server, $path = false, $port = 80) { + /** + * @param string $server + * @param string|bool $path + * @param int $port + * @param int $timeout + */ + function IXR_Client($server, $path = false, $port = 80, $timeout = 15) { parent::__construct(); - if (!$path) { + if(!$path) { // Assume we have been given a URL instead $this->posturl = $server; - }else{ - $this->posturl = 'http://'.$server.':'.$port.$path; + } else { + $this->posturl = 'http://' . $server . ':' . $port . $path; } + $this->timeout = $timeout; } + /** + * parameters: method and arguments + * @return bool success or error + */ function query() { $args = func_get_args(); $method = array_shift($args); @@ -518,55 +706,87 @@ class IXR_Client extends DokuHTTPClient { $xml = $request->getXml(); $this->headers['Content-Type'] = 'text/xml'; - if(!$this->sendRequest($this->posturl,$xml,'POST')){ - $this->xmlerror = new IXR_Error(-32300, 'transport error - '.$this->error); + if(!$this->sendRequest($this->posturl, $xml, 'POST')) { + $this->xmlerror = new IXR_Error(-32300, 'transport error - ' . $this->error); return false; } // Check HTTP Response code - if($this->status < 200 || $this->status > 206){ - $this->xmlerror = new IXR_Error(-32300, 'transport error - HTTP status '.$this->status); + if($this->status < 200 || $this->status > 206) { + $this->xmlerror = new IXR_Error(-32300, 'transport error - HTTP status ' . $this->status); return false; } // Now parse what we've got back $this->message = new IXR_Message($this->resp_body); - if (!$this->message->parse()) { + if(!$this->message->parse()) { // XML error $this->xmlerror = new IXR_Error(-32700, 'parse error. not well formed'); return false; } + // Is the message a fault? - if ($this->message->messageType == 'fault') { + if($this->message->messageType == 'fault') { $this->xmlerror = new IXR_Error($this->message->faultCode, $this->message->faultString); return false; } + // Message must be OK return true; } + + /** + * @return mixed + */ function getResponse() { // methodResponses can only have one param - return that return $this->message->params[0]; } + + /** + * @return bool + */ function isError() { return (is_object($this->xmlerror)); } + + /** + * @return int + */ function getErrorCode() { return $this->xmlerror->code; } + + /** + * @return string + */ function getErrorMessage() { return $this->xmlerror->message; } } - +/** + * IXR_Error + * + * @package IXR + * @since 1.5 + */ class IXR_Error { var $code; var $message; + + /** + * @param int $code + * @param string $message + */ function IXR_Error($code, $message) { $this->code = $code; - $this->message = $message; + $this->message = htmlspecialchars($message); } + + /** + * @return string + */ function getXml() { $xml = <<<EOD <methodResponse> @@ -591,7 +811,12 @@ EOD; } } - +/** + * IXR_Date + * + * @package IXR + * @since 1.5 + */ class IXR_Date { var $year; var $month; @@ -599,14 +824,23 @@ class IXR_Date { var $hour; var $minute; var $second; + var $timezone; + + /** + * @param int|string $time + */ function IXR_Date($time) { // $time can be a PHP timestamp or an ISO one - if (is_numeric($time)) { + if(is_numeric($time)) { $this->parseTimestamp($time); } else { $this->parseIso($time); } } + + /** + * @param int $timestamp + */ function parseTimestamp($timestamp) { $this->year = gmdate('Y', $timestamp); $this->month = gmdate('m', $timestamp); @@ -614,43 +848,81 @@ class IXR_Date { $this->hour = gmdate('H', $timestamp); $this->minute = gmdate('i', $timestamp); $this->second = gmdate('s', $timestamp); + $this->timezone = ''; } + + /** + * @param string $iso + */ function parseIso($iso) { - if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/',$iso,$match)){ - $this->year = (int) $match[1]; - $this->month = (int) $match[2]; - $this->day = (int) $match[3]; - $this->hour = (int) $match[5]; + if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/', $iso, $match)) { + $this->year = (int) $match[1]; + $this->month = (int) $match[2]; + $this->day = (int) $match[3]; + $this->hour = (int) $match[5]; $this->minute = (int) $match[6]; $this->second = (int) $match[8]; } } + + /** + * @return string + */ function getIso() { - return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; + return $this->year . $this->month . $this->day . 'T' . $this->hour . ':' . $this->minute . ':' . $this->second . $this->timezone; } + + /** + * @return string + */ function getXml() { - return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; + return '<dateTime.iso8601>' . $this->getIso() . '</dateTime.iso8601>'; } + + /** + * @return int + */ function getTimestamp() { return gmmktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); } } - +/** + * IXR_Base64 + * + * @package IXR + * @since 1.5 + */ class IXR_Base64 { var $data; + + /** + * @param string $data + */ function IXR_Base64($data) { $this->data = $data; } + + /** + * @return string + */ function getXml() { - return '<base64>'.base64_encode($this->data).'</base64>'; + return '<base64>' . base64_encode($this->data) . '</base64>'; } } - +/** + * IXR_IntrospectionServer + * + * @package IXR + * @since 1.5 + */ class IXR_IntrospectionServer extends IXR_Server { + /** @var array[] */ var $signatures; + /** @var string[] */ var $help; + function IXR_IntrospectionServer() { $this->setCallbacks(); $this->setCapabilities(); @@ -683,82 +955,102 @@ class IXR_IntrospectionServer extends IXR_Server { 'Returns a documentation string for the specified method' ); } + + /** + * @param string $method + * @param string $callback + * @param string[] $args + * @param string $help + */ function addCallback($method, $callback, $args, $help) { $this->callbacks[$method] = $callback; $this->signatures[$method] = $args; $this->help[$method] = $help; } + + /** + * @param string $methodname + * @param array $args + * @return IXR_Error|mixed + */ function call($methodname, $args) { // Make sure it's in an array - if ($args && !is_array($args)) { + if($args && !is_array($args)) { $args = array($args); } + // Over-rides default call method, adds signature check - if (!$this->hasMethod($methodname)) { - return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.'); + if(!$this->hasMethod($methodname)) { + return new IXR_Error(-32601, 'server error. requested method "' . $this->message->methodName . '" not specified.'); } $method = $this->callbacks[$methodname]; $signature = $this->signatures[$methodname]; $returnType = array_shift($signature); // Check the number of arguments. Check only, if the minimum count of parameters is specified. More parameters are possible. // This is a hack to allow optional parameters... - if (count($args) < count($signature)) { + if(count($args) < count($signature)) { // print 'Num of args: '.count($args).' Num in signature: '.count($signature); return new IXR_Error(-32602, 'server error. wrong number of method parameters'); } + // Check the argument types $ok = true; $argsbackup = $args; - for ($i = 0, $j = count($args); $i < $j; $i++) { + for($i = 0, $j = count($args); $i < $j; $i++) { $arg = array_shift($args); $type = array_shift($signature); - switch ($type) { + switch($type) { case 'int': case 'i4': - if (is_array($arg) || !is_int($arg)) { + if(is_array($arg) || !is_int($arg)) { $ok = false; } break; case 'base64': case 'string': - if (!is_string($arg)) { + if(!is_string($arg)) { $ok = false; } break; case 'boolean': - if ($arg !== false && $arg !== true) { + if($arg !== false && $arg !== true) { $ok = false; } break; case 'float': case 'double': - if (!is_float($arg)) { + if(!is_float($arg)) { $ok = false; } break; case 'date': case 'dateTime.iso8601': - if (!is_a($arg, 'IXR_Date')) { + if(!is_a($arg, 'IXR_Date')) { $ok = false; } break; } - if (!$ok) { + if(!$ok) { return new IXR_Error(-32602, 'server error. invalid method parameters'); } } // It passed the test - run the "real" method call return parent::call($methodname, $argsbackup); } + + /** + * @param string $method + * @return array|IXR_Error + */ function methodSignature($method) { - if (!$this->hasMethod($method)) { - return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); + if(!$this->hasMethod($method)) { + return new IXR_Error(-32601, 'server error. requested method "' . $method . '" not specified.'); } // We should be returning an array of types $types = $this->signatures[$method]; $return = array(); - foreach ($types as $type) { - switch ($type) { + foreach($types as $type) { + switch($type) { case 'string': $return[] = 'string'; break; @@ -788,18 +1080,40 @@ class IXR_IntrospectionServer extends IXR_Server { } return $return; } + + /** + * @param string $method + * @return mixed + */ function methodHelp($method) { return $this->help[$method]; } } - +/** + * IXR_ClientMulticall + * + * @package IXR + * @since 1.5 + */ class IXR_ClientMulticall extends IXR_Client { + + /** @var array[] */ var $calls = array(); + + /** + * @param string $server + * @param string|bool $path + * @param int $port + */ function IXR_ClientMulticall($server, $path = false, $port = 80) { parent::IXR_Client($server, $path, $port); //$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)'; } + + /** + * Add a call + */ function addCall() { $args = func_get_args(); $methodName = array_shift($args); @@ -809,6 +1123,10 @@ class IXR_ClientMulticall extends IXR_Client { ); $this->calls[] = $struct; } + + /** + * @return bool + */ function query() { // Prepare multicall, then call the parent::query() method return parent::query('system.multicall', $this->calls); diff --git a/inc/Input.class.php b/inc/Input.class.php index 94da2a10e..199994d8d 100644 --- a/inc/Input.class.php +++ b/inc/Input.class.php @@ -83,7 +83,6 @@ class Input { * * @see isset * @param string $name Parameter name - * @return bool */ public function remove($name) { if(isset($this->access[$name])) { @@ -132,7 +131,7 @@ class Input { * @param string $name Parameter name * @param mixed $default If parameter is not set, initialize with this value * @param bool $nonempty Init with $default if parameter is set but empty() - * @return &mixed + * @return mixed (reference) */ public function &ref($name, $default = '', $nonempty = false) { if(!isset($this->access[$name]) || ($nonempty && empty($this->access[$name]))) { @@ -146,7 +145,7 @@ class Input { * Access a request parameter as int * * @param string $name Parameter name - * @param mixed $default Default to return if parameter isn't set or is an array + * @param int $default Default to return if parameter isn't set or is an array * @param bool $nonempty Return $default if parameter is set but empty() * @return int */ @@ -164,7 +163,7 @@ class Input { * Access a request parameter as string * * @param string $name Parameter name - * @param mixed $default Default to return if parameter isn't set or is an array + * @param string $default Default to return if parameter isn't set or is an array * @param bool $nonempty Return $default if parameter is set but empty() * @return string */ @@ -246,7 +245,7 @@ class Input { * * This function returns the $INPUT object itself for easy chaining * - * @param $name + * @param string $name * @return Input */ public function extract($name){ diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index a35ec3ed0..d50bad9b7 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -42,6 +42,7 @@ class JpegMeta { var $_fileName; var $_fp = null; + var $_fpout = null; var $_type = 'unknown'; var $_markers; @@ -132,6 +133,9 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $fields field name or array with field names + * @return bool|string */ function getField($fields) { if(!is_array($fields)) $fields = array($fields); @@ -177,6 +181,10 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @param string $value + * @return bool success or fail */ function setField($field, $value) { if(strtolower(substr($field,0,5)) == 'iptc.'){ @@ -193,6 +201,9 @@ class JpegMeta { * through one function * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @return bool */ function deleteField($field) { if(strtolower(substr($field,0,5)) == 'iptc.'){ @@ -208,6 +219,9 @@ class JpegMeta { * Return a date field * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field + * @return false|string */ function getDateField($field) { if (!isset($this->_info['dates'])) { @@ -225,6 +239,9 @@ class JpegMeta { * Return a file info field * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $field field name + * @return false|string */ function getFileField($field) { if (!isset($this->_info['file'])) { @@ -243,6 +260,8 @@ class JpegMeta { * * @author Andreas Gohr <andi@splitbrain.org> * @todo handle makernotes + * + * @return false|string */ function getCamera(){ $make = $this->getField(array('Exif.Make','Exif.TIFFMake')); @@ -256,6 +275,8 @@ class JpegMeta { * Return shutter speed as a ratio * * @author Joe Lapp <joe.lapp@pobox.com> + * + * @return string */ function getShutterSpeed() { if (!isset($this->_info['exif'])) { @@ -274,6 +295,9 @@ class JpegMeta { * Return an EXIF field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getExifField($field) { if (!isset($this->_info['exif'])) { @@ -295,6 +319,9 @@ class JpegMeta { * Return an XMP field * * @author Hakan Sandell <hakan.sandell@mydata.se> + * + * @param string $field field name + * @return false|string */ function getXmpField($field) { if (!isset($this->_info['xmp'])) { @@ -316,6 +343,9 @@ class JpegMeta { * Return an Adobe Field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getAdobeField($field) { if (!isset($this->_info['adobe'])) { @@ -337,6 +367,9 @@ class JpegMeta { * Return an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return false|string */ function getIPTCField($field) { if (!isset($this->_info['iptc'])) { @@ -359,6 +392,10 @@ class JpegMeta { * * @author Sebastian Delmont <sdelmont@zonageek.com> * @author Joe Lapp <joe.lapp@pobox.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setExifField($field, $value) { if (!isset($this->_info['exif'])) { @@ -389,6 +426,10 @@ class JpegMeta { * Set an Adobe Field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setAdobeField($field, $value) { if (!isset($this->_info['adobe'])) { @@ -413,6 +454,10 @@ class JpegMeta { * dimensions * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param int $maxwidth + * @param int $maxheight + * @return float|int */ function getResizeRatio($maxwidth,$maxheight=0){ if(!$maxheight) $maxheight = $maxwidth; @@ -442,6 +487,10 @@ class JpegMeta { * Set an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @param string $value + * @return bool */ function setIPTCField($field, $value) { if (!isset($this->_info['iptc'])) { @@ -465,6 +514,9 @@ class JpegMeta { * Delete an EXIF field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteExifField($field) { if (!isset($this->_info['exif'])) { @@ -486,6 +538,9 @@ class JpegMeta { * Delete an Adobe field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteAdobeField($field) { if (!isset($this->_info['adobe'])) { @@ -507,6 +562,9 @@ class JpegMeta { * Delete an IPTC field * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $field field name + * @return bool */ function deleteIPTCField($field) { if (!isset($this->_info['iptc'])) { @@ -527,12 +585,12 @@ class JpegMeta { /** * Get the image's title, tries various fields * - * @param int $max maximum number chars (keeps words) + * @param int $max maximum number chars (keeps words) + * @return false|string + * * @author Andreas Gohr <andi@splitbrain.org> */ function getTitle($max=80){ - $cap = ''; - // try various fields $cap = $this->getField(array('Iptc.Headline', 'Iptc.Caption', @@ -555,11 +613,14 @@ class JpegMeta { * Gather various date fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return array|bool */ function getDates() { $this->_parseAll(); if ($this->_markers == null) { if (@isset($this->_info['file']['UnixTime'])) { + $dates = array(); $dates['FileModified'] = $this->_info['file']['UnixTime']; $dates['Time'] = $this->_info['file']['UnixTime']; $dates['TimeSource'] = 'FileModified'; @@ -690,6 +751,8 @@ class JpegMeta { * Get the image width, tries various fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getWidth() { if (!isset($this->_info['sof'])) { @@ -719,6 +782,8 @@ class JpegMeta { * Get the image height, tries various fields * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getHeight() { if (!isset($this->_info['sof'])) { @@ -748,6 +813,8 @@ class JpegMeta { * Get an dimension string for use in img tag * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @return false|string */ function getDimStr() { if ($this->_markers == null) { @@ -764,6 +831,9 @@ class JpegMeta { * Checks for an embedded thumbnail * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $which possible values: 'any', 'exif' or 'adobe' + * @return false|string */ function hasThumbnail($which = 'any') { if (($which == 'any') || ($which == 'exif')) { @@ -805,6 +875,9 @@ class JpegMeta { * Send embedded thumbnail to browser * * @author Sebastian Delmont <sdelmont@zonageek.com> + * + * @param string $which possible values: 'any', 'exif' or 'adobe' + * @return bool */ function sendThumbnail($which = 'any') { $data = null; @@ -855,6 +928,9 @@ class JpegMeta { * * @author Sebastian Delmont <sdelmont@zonageek.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $fileName file name or empty string for a random name + * @return bool */ function save($fileName = "") { if ($fileName == "") { @@ -1334,7 +1410,6 @@ class JpegMeta { return false; } - $pos = 0; $this->_info['jfif'] = array(); $vmaj = $this->_getByte($data, 5); @@ -1420,7 +1495,6 @@ class JpegMeta { break; default: return false; - break; } $this->_info['sof']['Format'] = $format; diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index e90b45f99..087d82c99 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -108,6 +108,9 @@ class Mailer { /** * Callback function to automatically embed images referenced in HTML templates + * + * @param array $matches + * @return string placeholder */ protected function autoembed_cb($matches) { static $embeds = 0; @@ -130,7 +133,7 @@ class Mailer { * If an empy value is passed, the header is removed * * @param string $header the header name (no trailing colon!) - * @param string $value the value of the header + * @param string|string[] $value the value of the header * @param bool $clean remove all non-ASCII chars and line feeds? */ public function setHeader($header, $value, $clean = true) { @@ -160,6 +163,8 @@ class Mailer { * * Whatever is set here is directly passed to PHP's mail() command as last * parameter. Depending on the PHP setup this might break mailing alltogether + * + * @param string $param */ public function setParameters($param) { $this->sendparam = $param; @@ -177,7 +182,7 @@ class Mailer { * @param string $text plain text body * @param array $textrep replacements to apply on the text part * @param array $htmlrep replacements to apply on the HTML part, leave null to use $textrep - * @param array $html the HTML body, leave null to create it from $text + * @param string $html the HTML body, leave null to create it from $text * @param bool $wrap wrap the HTML in the default header/Footer */ public function setBody($text, $textrep = null, $htmlrep = null, $html = null, $wrap = true) { @@ -265,6 +270,8 @@ class Mailer { * Placeholders can be used to reference embedded attachments * * You probably want to use setBody() instead + * + * @param string $html */ public function setHTML($html) { $this->html = $html; @@ -274,6 +281,8 @@ class Mailer { * Set the plain text part of the mail * * You probably want to use setBody() instead + * + * @param string $text */ public function setText($text) { $this->text = $text; @@ -283,7 +292,7 @@ class Mailer { * Add the To: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function to($address) { $this->setHeader('To', $address, false); @@ -293,7 +302,7 @@ class Mailer { * Add the Cc: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function cc($address) { $this->setHeader('Cc', $address, false); @@ -303,7 +312,7 @@ class Mailer { * Add the Bcc: recipients * * @see cleanAddress - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|string[] $address Multiple adresses separated by commas or as array */ public function bcc($address) { $this->setHeader('Bcc', $address, false); @@ -340,8 +349,8 @@ class Mailer { * Example: * cc("föö <foo@bar.com>, me@somewhere.com","TBcc"); * - * @param string|array $addresses Multiple adresses separated by commas or as array - * @return bool|string the prepared header (can contain multiple lines) + * @param string|string[] $addresses Multiple adresses separated by commas or as array + * @return false|string the prepared header (can contain multiple lines) */ public function cleanAddress($addresses) { // No named recipients for To: in Windows (see FS#652) @@ -418,6 +427,8 @@ class Mailer { * Prepare the mime multiparts for all attachments * * Replaces placeholders in the HTML with the correct CIDs + * + * @return string mime multiparts */ protected function prepareAttachments() { $mime = ''; @@ -565,9 +576,9 @@ class Mailer { /** * Returns a complete, EOL terminated header line, wraps it if necessary * - * @param $key - * @param $val - * @return string + * @param string $key + * @param string $val + * @return string line */ protected function wrappedHeaderLine($key, $val){ return wordwrap("$key: $val", 78, MAILHEADER_EOL.' ').MAILHEADER_EOL; diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index db6a3a77c..15f896dcf 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -16,8 +16,9 @@ class PassHash { * match true is is returned else false * * @author Andreas Gohr <andi@splitbrain.org> - * @param $clear string Clear-Text password - * @param $hash string Hash to compare against + * + * @param string $clear Clear-Text password + * @param string $hash Hash to compare against * @return bool */ function verify_hash($clear, $hash) { @@ -109,9 +110,9 @@ class PassHash { * If $salt is not null, the value is kept, but the lenght restriction is * applied (unless, $cut is false). * - * @param string &$salt The salt, pass null if you want one generated - * @param int $len The length of the salt - * @param bool $cut Apply length restriction to existing salt? + * @param string|null &$salt The salt, pass null if you want one generated + * @param int $len The length of the salt + * @param bool $cut Apply length restriction to existing salt? */ public function init_salt(&$salt, $len = 32, $cut = true) { if(is_null($salt)) { @@ -135,6 +136,7 @@ class PassHash { * @author Andreas Gohr <andi@splitbrain.org> * @author <mikey_nich at hotmail dot com> * @link http://de.php.net/manual/en/function.crypt.php#73619 + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -175,6 +177,7 @@ class PassHash { * * @author <mikey_nich at hotmail dot com> * @link http://de.php.net/manual/en/function.crypt.php#73619 + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @param string $magic The hash identifier (apr1 or 1) @@ -337,6 +340,7 @@ class PassHash { * an exception. * * @link http://www.openwall.com/phpass/ + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @param string $magic The hash identifier (P or H) @@ -404,6 +408,7 @@ class PassHash { * This is used by the Django Python framework * * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -420,6 +425,7 @@ class PassHash { * This is used by the Django Python framework * * @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -486,6 +492,7 @@ class PassHash { * method 'A' is not supported. * * @link http://www.mediawiki.org/wiki/Manual_talk:User_table#user_password_column + * * @param string $clear The clear text to hash * @param string $salt The salt to use, null for random * @return string Hashed password @@ -511,7 +518,6 @@ class PassHash { * @param string $data Message to be hashed. * @param string $key Shared secret key used for generating the HMAC variant of the message digest. * @param bool $raw_output When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. - * * @return string */ public static function hmac($algo, $data, $key, $raw_output = false) { @@ -545,9 +551,8 @@ class PassHash { /** * Use DokuWiki's secure random generator if available * - * @param $min - * @param $max - * + * @param int $min + * @param int $max * @return int */ protected function random($min, $max){ diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index ffa03ee93..c0e6869f1 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -13,6 +13,11 @@ class RemoteAPICore { $this->api = $api; } + /** + * Returns details about the core methods + * + * @return array + */ function __getRemoteInfo() { return array( 'dokuwiki.getVersion' => array( @@ -158,19 +163,27 @@ class RemoteAPICore { ); } + /** + * @return string + */ function getVersion() { return getVersion(); } + /** + * @return int unix timestamp + */ function getTime() { return time(); } /** * Return a raw wiki page + * * @param string $id wiki page id - * @param string $rev revision number of the page - * @return page text. + * @param int|string $rev revision timestamp of the page or empty string + * @return string page text. + * @throws RemoteAccessDeniedException if no permission for page */ function rawPage($id,$rev=''){ $id = $this->resolvePageId($id); @@ -189,8 +202,11 @@ class RemoteAPICore { * Return a media file * * @author Gina Haeussge <osd@foosel.net> + * * @param string $id file id - * @return media file + * @return mixed media file + * @throws RemoteAccessDeniedException no permission for media + * @throws RemoteException not exist */ function getAttachment($id){ $id = cleanID($id); @@ -211,6 +227,9 @@ class RemoteAPICore { * Return info about a media file * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $id page id + * @return array */ function getAttachmentInfo($id){ $id = cleanID($id); @@ -230,6 +249,11 @@ class RemoteAPICore { /** * Return a wiki page rendered to html + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @return null|string html + * @throws RemoteAccessDeniedException no access to page */ function htmlPage($id,$rev=''){ $id = $this->resolvePageId($id); @@ -241,6 +265,8 @@ class RemoteAPICore { /** * List all pages - we use the indexer list here + * + * @return array */ function listPages(){ $list = array(); @@ -265,6 +291,12 @@ class RemoteAPICore { /** * List all pages in the given namespace (and below) + * + * @param string $ns + * @param array $opts + * $opts['depth'] recursion level, 0 for all + * $opts['hash'] do md5 sum of content? + * @return array */ function readNamespace($ns,$opts){ global $conf; @@ -281,9 +313,12 @@ class RemoteAPICore { /** * List all pages in the given namespace (and below) + * + * @param string $query + * @return array */ function search($query){ - $regex = ''; + $regex = array(); $data = ft_pageSearch($query,$regex); $pages = array(); @@ -314,6 +349,8 @@ class RemoteAPICore { /** * Returns the wiki title. + * + * @return string */ function getTitle(){ global $conf; @@ -328,6 +365,15 @@ class RemoteAPICore { * a regular expression matching their name. * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $ns + * @param array $options + * $options['depth'] recursion level, 0 for all + * $options['showmsg'] shows message if invalid media id is used + * $options['pattern'] check given pattern + * $options['hash'] add hashes to result list + * @return array + * @throws RemoteAccessDeniedException no access to the media files */ function listAttachments($ns, $options = array()) { global $conf; @@ -359,6 +405,9 @@ class RemoteAPICore { /** * Return a list of backlinks + * + * @param string $id page id + * @return array */ function listBackLinks($id){ return ft_backlinks($this->resolvePageId($id)); @@ -366,6 +415,12 @@ class RemoteAPICore { /** * Return some basic data about a page + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @return array + * @throws RemoteAccessDeniedException no access for page + * @throws RemoteException page not exist */ function pageInfo($id,$rev=''){ $id = $this->resolvePageId($id); @@ -395,6 +450,13 @@ class RemoteAPICore { * Save a wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param string $text wiki text + * @param array $params parameters: summary, minor edit + * @return bool + * @throws RemoteAccessDeniedException no write access for page + * @throws RemoteException no id, empty new page or locked */ function putPage($id, $text, $params) { global $TEXT; @@ -451,6 +513,11 @@ class RemoteAPICore { /** * Appends text to a wiki page. + * + * @param string $id page id + * @param string $text wiki text + * @param array $params such as summary,minor + * @return bool|string */ function appendPage($id, $text, $params) { $currentpage = $this->rawPage($id); @@ -464,6 +531,12 @@ class RemoteAPICore { * Uploads a file to the wiki. * * Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param string $file + * @param array $params such as overwrite + * @return false|string + * @throws RemoteException */ function putAttachment($id, $file, $params) { $id = cleanID($id); @@ -493,6 +566,11 @@ class RemoteAPICore { * Deletes a file from the wiki. * * @author Gina Haeussge <osd@foosel.net> + * + * @param string $id page id + * @return int + * @throws RemoteAccessDeniedException no permissions + * @throws RemoteException file in use or not deleted */ function deleteAttachment($id){ $id = cleanID($id); @@ -511,6 +589,9 @@ class RemoteAPICore { /** * Returns the permissions of a given wiki page + * + * @param string $id page id + * @return int permission level */ function aclCheck($id) { $id = $this->resolvePageId($id); @@ -521,6 +602,10 @@ class RemoteAPICore { * Lists all links contained in a wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @return array + * @throws RemoteAccessDeniedException no read access for page */ function listLinks($id) { $id = $this->resolvePageId($id); @@ -571,6 +656,10 @@ class RemoteAPICore { * * @author Michael Hamann <michael@content-space.de> * @author Michael Klier <chi@chimeric.de> + * + * @param int $timestamp unix timestamp + * @return array + * @throws RemoteException no valid timestamp */ function getRecentChanges($timestamp) { if(strlen($timestamp) != 10) { @@ -596,7 +685,7 @@ class RemoteAPICore { return $changes; } else { // in case we still have nothing at this point - return new RemoteException('There are no changes in the specified timeframe', 321); + throw new RemoteException('There are no changes in the specified timeframe', 321); } } @@ -605,6 +694,10 @@ class RemoteAPICore { * * @author Michael Hamann <michael@content-space.de> * @author Michael Klier <chi@chimeric.de> + * + * @param int $timestamp unix timestamp + * @return array + * @throws RemoteException no valid timestamp */ function getRecentMediaChanges($timestamp) { if(strlen($timestamp) != 10) @@ -637,6 +730,12 @@ class RemoteAPICore { * Returns a list of available revisions of a given wiki page * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @param int $first skip the first n changelog lines + * @return array + * @throws RemoteAccessDeniedException no read access for page + * @throws RemoteException empty id */ function pageVersions($id, $first) { $id = $this->resolvePageId($id); @@ -681,6 +780,7 @@ class RemoteAPICore { $pagelog->setChunkSize(1024); $info = $pagelog->getRevisionInfo($time); if(!empty($info)) { + $data = array(); $data['user'] = $info['user']; $data['ip'] = $info['ip']; $data['type'] = $info['type']; @@ -713,6 +813,9 @@ class RemoteAPICore { * * Returns an associative array with the keys locked, lockfail, unlocked and * unlockfail, each containing lists of pages. + * + * @param array[] $set list pages with array('lock' => array, 'unlock' => array) + * @return array */ function setLocks($set){ $locked = array(); @@ -747,13 +850,27 @@ class RemoteAPICore { ); } + /** + * Return API version + * + * @return int + */ function getAPIVersion(){ return DOKU_API_VERSION; } + /** + * Login + * + * @param string $user + * @param string $pass + * @return int + */ function login($user,$pass){ global $conf; + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; + if(!$conf['useacl']) return 0; if(!$auth) return 0; @@ -774,6 +891,11 @@ class RemoteAPICore { return $ok; } + /** + * Log off + * + * @return int + */ function logoff(){ global $conf; global $auth; @@ -785,6 +907,12 @@ class RemoteAPICore { return 1; } + /** + * Resolve page id + * + * @param string $id page id + * @return string + */ private function resolvePageId($id) { $id = cleanID($id); if(empty($id)) { diff --git a/inc/Sitemapper.php b/inc/Sitemapper.php index 6332746a6..0325f6d44 100644 --- a/inc/Sitemapper.php +++ b/inc/Sitemapper.php @@ -24,6 +24,8 @@ class Sitemapper { * @author Andreas Gohr * @link https://www.google.com/webmasters/sitemaps/docs/en/about.html * @link http://www.sitemaps.org/ + * + * @return bool */ public static function generate(){ global $conf; @@ -53,7 +55,7 @@ class Sitemapper { foreach($pages as $id){ //skip hidden, non existing and restricted files if(isHiddenPage($id)) continue; - if(auth_aclcheck($id,'','') < AUTH_READ) continue; + if(auth_aclcheck($id,'',array()) < AUTH_READ) continue; $item = SitemapItem::createFromID($id); if ($item !== null) $items[] = $item; @@ -75,6 +77,7 @@ class Sitemapper { * * @param $items array The SitemapItems that shall be included in the sitemap. * @return string The sitemap XML. + * * @author Michael Hamann */ private static function getXML($items) { @@ -95,6 +98,7 @@ class Sitemapper { * Helper function for getting the path to the sitemap file. * * @return string The path to the sitemap file. + * * @author Michael Hamann */ public static function getFilePath() { @@ -123,6 +127,8 @@ class Sitemapper { * urls to ping using the SITEMAP_PING event. * * @author Michael Hamann + * + * @return bool */ public static function pingSearchEngines() { //ping search engines... @@ -168,9 +174,9 @@ class SitemapItem { /** * Create a new item. * - * @param $url string The url of the item - * @param $lastmod int Timestamp of the last modification - * @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. + * @param string $url The url of the item + * @param int $lastmod Timestamp of the last modification + * @param string $changefreq How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. * @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. */ public function __construct($url, $lastmod, $changefreq = null, $priority = null) { @@ -183,9 +189,9 @@ class SitemapItem { /** * Helper function for creating an item for a wikipage id. * - * @param $id string A wikipage id. - * @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. - * @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. + * @param string $id A wikipage id. + * @param string $changefreq How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never. + * @param float|string $priority The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0. * @return SitemapItem The sitemap item. */ public static function createFromID($id, $changefreq = null, $priority = null) { diff --git a/inc/Tar.class.php b/inc/Tar.class.php index 903f7f35c..0dc7dace2 100644 --- a/inc/Tar.class.php +++ b/inc/Tar.class.php @@ -53,6 +53,7 @@ class Tar { protected $file = ''; protected $comptype = Tar::COMPRESS_AUTO; + /** @var resource|int */ protected $fh; protected $memory = ''; protected $closed = true; @@ -105,6 +106,9 @@ class Tar { * * The archive is closed afer reading the contents, because rewinding is not possible in bzip2 streams. * Reopen the file with open() again if you want to do additional operations + * + * @return array + * @throws TarIOException */ public function contents() { if($this->closed || !$this->file) throw new TarIOException('Can not read from a closed archive'); @@ -270,6 +274,7 @@ class Tar { * Add a file to the current TAR archive using an existing file in the filesystem * * @todo handle directory adding + * * @param string $file the original file * @param string $name the name to use for the file in the archive * @throws TarIOException @@ -377,6 +382,10 @@ class Tar { * Returns the created in-memory archive data * * This implicitly calls close() on the Archive + * + * @param int $comptype + * @param int $complevel + * @return mixed|string */ public function getArchive($comptype = Tar::COMPRESS_AUTO, $complevel = 9) { $this->close(); @@ -395,7 +404,7 @@ class Tar { * Note: It more memory effective to specify the filename in the create() function and * let the library work on the new file directly. * - * @param $file + * @param string $file * @param int $comptype * @param int $complevel * @throws TarIOException @@ -522,7 +531,7 @@ class Tar { * Decode the given tar file header * * @param string $block a 512 byte block containign the header data - * @return array|bool + * @return false|array */ protected function parseHeader($block) { if(!$block || strlen($block) != 512) return false; @@ -536,6 +545,7 @@ class Tar { $header = @unpack("a100filename/a8perm/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix", $block); if(!$header) return false; + $return = array(); $return['checksum'] = OctDec(trim($header['checksum'])); if($return['checksum'] != $chks) return false; @@ -570,7 +580,7 @@ class Tar { /** * Cleans up a path and removes relative parts, also strips leading slashes * - * @param string $p_dir + * @param string $path * @return string */ public function cleanPath($path) { @@ -590,7 +600,7 @@ class Tar { /** * Checks if the given compression type is available and throws an exception if not * - * @param $comptype + * @param int $comptype * @throws TarIllegalCompressionException */ protected function compressioncheck($comptype) { @@ -624,8 +634,14 @@ class Tar { } } +/** + * Class TarIOException + */ class TarIOException extends Exception { } +/** + * Class TarIllegalCompressionException + */ class TarIllegalCompressionException extends Exception { } diff --git a/inc/ZipLib.class.php b/inc/ZipLib.class.php index 918d38579..5b524c4ab 100644 --- a/inc/ZipLib.class.php +++ b/inc/ZipLib.class.php @@ -16,6 +16,10 @@ class ZipLib { var $old_offset = 0; var $dirs = Array("."); + /** + * @param string $zip_name filename path to file + * @return array|int + */ function get_List($zip_name) { $zip = @fopen($zip_name, 'rb'); if(!$zip) return(0); @@ -24,10 +28,12 @@ class ZipLib { @rewind($zip); @fseek($zip, $centd['offset']); + $ret = array(); for ($i=0; $i<$centd['entries']; $i++) { $header = $this->ReadCentralFileHeaders($zip); $header['index'] = $i; + $info = array(); $info['filename'] = $header['filename']; $info['stored_filename'] = $header['stored_filename']; $info['size'] = $header['size']; @@ -45,9 +51,15 @@ class ZipLib { return $ret; } + /** + * @param array $files array filled with array(string filename, string data) + * @param bool $compact + * @return array + */ function Add($files,$compact) { if(!is_array($files[0])) $files=Array($files); + $ret = array(); for($i=0;$files[$i];$i++){ $fn = $files[$i]; if(!in_Array(dirname($fn[0]),$this->dirs)) @@ -60,6 +72,10 @@ class ZipLib { /** * Zips recursively the $folder directory, from the $basedir directory + * + * @param string $folder filename path to file + * @param string|null $basedir + * @param string|null $parent */ function Compress($folder, $basedir=null, $parent=null) { $full_path = $basedir."/".$parent.$folder; @@ -70,6 +86,7 @@ class ZipLib { } $dir = new DirectoryIterator($full_path); foreach($dir as $file) { + /** @var DirectoryIterator $file */ if(!$file->isDot()) { $filename = $file->getFilename(); if($file->isDir()) { @@ -84,6 +101,8 @@ class ZipLib { /** * Returns the Zip file + * + * @return string */ function get_file() { $data = implode('', $this -> datasec); @@ -94,6 +113,9 @@ class ZipLib { pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00"; } + /** + * @param string $name the name of the directory + */ function add_dir($name) { $name = str_replace("\\", "/", $name); $fr = "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00"; @@ -117,8 +139,13 @@ class ZipLib { /** * Add a file named $name from a string $data + * + * @param string $data + * @param string $name filename + * @param bool $compact + * @return bool */ - function add_File($data, $name, $compact = 1) { + function add_File($data, $name, $compact = true) { $name = str_replace('\\', '/', $name); $dtime = dechex($this->DosTime()); @@ -166,6 +193,9 @@ class ZipLib { return true; } + /** + * @return int + */ function DosTime() { $timearray = getdate(); if ($timearray['year'] < 1980) { @@ -186,10 +216,14 @@ class ZipLib { /** * Extract a zip file $zn to the $to directory + * + * @param string $zn filename + * @param string $to filename path to file + * @param array $index + * @return array|int */ function Extract ( $zn, $to, $index = Array(-1) ) { if(!@is_dir($to)) $this->_mkdir($to); - $ok = 0; $zip = @fopen($zn,'rb'); if(!$zip) return(-1); $cdir = $this->ReadCentralDir($zip,$zn); @@ -203,6 +237,7 @@ class ZipLib { return(-1); } + $stat = array(); for ($i=0; $i<$cdir['entries']; $i++) { @fseek($zip, $pos_entry); $header = $this->ReadCentralFileHeaders($zip); @@ -218,6 +253,11 @@ class ZipLib { return $stat; } + /** + * @param resource $zip + * @param array $header + * @return array + */ function ReadFileHeader($zip, $header) { $binary_data = fread($zip, 30); $data = unpack('vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $binary_data); @@ -254,6 +294,10 @@ class ZipLib { return $header; } + /** + * @param resource $zip + * @return array + */ function ReadCentralFileHeaders($zip){ $binary_data = fread($zip, 46); $header = unpack('vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $binary_data); @@ -295,6 +339,11 @@ class ZipLib { return $header; } + /** + * @param resource $zip + * @param string $zip_name filename path to file + * @return array + */ function ReadCentralDir($zip,$zip_name) { $size = filesize($zip_name); if ($size < 277){ @@ -320,6 +369,7 @@ class ZipLib { $data=unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', fread($zip, 18)); + $centd = array(); if ($data['comment_size'] != 0){ $centd['comment'] = fread($zip, $data['comment_size']); } else { @@ -334,6 +384,12 @@ class ZipLib { return $centd; } + /** + * @param array $header + * @param string $to filename path to file + * @param resource $zip + * @return bool|int + */ function ExtractFile($header,$to,$zip) { $header = $this->readfileheader($zip, $header); @@ -414,14 +470,20 @@ class ZipLib { * centralize mkdir calls and use dokuwiki io functions * * @author Christopher Smith <chris@jalakai.co.uk> + * + * @param string $d filename path to file + * @return bool|int|string */ function _mkdir($d) { return io_mkdir_p($d); } - + /** + * @param string $zn + * @param string $name + * @return null|string + */ function ExtractStr($zn, $name) { - $ok = 0; $zip = @fopen($zn,'rb'); if(!$zip) return(null); $cdir = $this->ReadCentralDir($zip,$zn); @@ -445,8 +507,13 @@ class ZipLib { return null; } + /** + * @param array $header + * @param resource $zip + * @return null|string + */ function ExtractStrFile($header,$zip) { - $hdr = $this->readfileheader($zip); + $hdr = $this->readfileheader($zip, $header); $binary_data = ''; if (!($header['external']==0x41FF0010) && !($header['external']==16)) { if ($header['compression']==0) { @@ -484,6 +551,10 @@ class ZipLib { return null; } + /** + * @param string $val + * @return int|string + */ function _ret_bytes($val) { $val = trim($val); $last = $val{strlen($val)-1}; diff --git a/inc/actions.php b/inc/actions.php index ef09a0dc7..709c19ddd 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -200,6 +200,7 @@ function act_dispatch(){ global $license; //call template FIXME: all needed vars available? + $headers = array(); $headers[] = 'Content-Type: text/html; charset=utf-8'; trigger_event('ACTION_HEADERS_SEND',$headers,'act_sendheaders'); @@ -221,6 +222,9 @@ function act_sendheaders($headers) { * Sanitize the action command * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $act + * @return string */ function act_clean($act){ // check if the action was given as array key @@ -245,6 +249,9 @@ function act_clean($act){ * Add all allowed commands here. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array|string $act + * @return string */ function act_validate($act) { global $conf; @@ -284,10 +291,12 @@ function act_validate($act) { * Run permissionchecks * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_permcheck($act){ global $INFO; - global $conf; if(in_array($act,array('save','preview','edit','recover'))){ if($INFO['exists']){ @@ -330,6 +339,9 @@ function act_permcheck($act){ * Handle 'draftdel' * * Deletes the draft for the current page and user + * + * @param string $act action command + * @return string action command */ function act_draftdel($act){ global $INFO; @@ -342,6 +354,9 @@ function act_draftdel($act){ * Saves a draft on preview * * @todo this currently duplicates code from ajax.php :-/ + * + * @param string $act action command + * @return string action command */ function act_draftsave($act){ global $INFO; @@ -372,6 +387,9 @@ function act_draftsave($act){ * returns a new action. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_save($act){ global $ID; @@ -394,7 +412,7 @@ function act_save($act){ return 'conflict'; //save it - saveWikiText($ID,con($PRE,$TEXT,$SUF,1),$SUM,$INPUT->bool('minor')); //use pretty mode for con + saveWikiText($ID,con($PRE,$TEXT,$SUF,true),$SUM,$INPUT->bool('minor')); //use pretty mode for con //unlock it unlock($ID); @@ -410,6 +428,9 @@ function act_save($act){ * Revert to a certain revision * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_revert($act){ global $ID; @@ -457,6 +478,9 @@ function act_revert($act){ * Do a redirect after receiving post data * * Tries to add the section id as hash mark after section editing + * + * @param string $id page id + * @param string $preact action command before redirect */ function act_redirect($id,$preact){ global $PRE; @@ -478,7 +502,7 @@ function act_redirect($id,$preact){ /** * Execute the redirect * - * @param array $opts id and fragment for the redirect + * @param array $opts id and fragment for the redirect and the preact */ function act_redirect_execute($opts){ $go = wl($opts['id'],'',true); @@ -492,6 +516,9 @@ function act_redirect_execute($opts){ * Handle 'login', 'logout' * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_auth($act){ global $ID; @@ -527,6 +554,9 @@ function act_auth($act){ * Handle 'edit', 'preview', 'recover' * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $act action command + * @return string action command */ function act_edit($act){ global $ID; @@ -591,6 +621,9 @@ function act_edit($act){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> + * + * @param string $act action command + * @return string action command */ function act_export($act){ global $ID; @@ -600,7 +633,6 @@ function act_export($act){ $pre = ''; $post = ''; - $output = ''; $headers = array(); // search engines: never cache exported docs! (Google only currently) @@ -644,7 +676,7 @@ function act_export($act){ $output = p_wiki_xhtml($ID,$REV,false); break; default: - $output = p_cached_output(wikiFN($ID,$REV), $mode); + $output = p_cached_output(wikiFN($ID,$REV), $mode, $ID); $headers = p_get_metadata($ID,"format $mode"); break; } @@ -672,6 +704,8 @@ function act_export($act){ * Handle sitemap delivery * * @author Michael Hamann <michael@content-space.de> + * + * @param string $act action command */ function act_sitemap($act) { global $conf; @@ -720,6 +754,10 @@ function act_sitemap($act) { * Throws exception on error. * * @author Adrian Lang <lang@cosmocode.de> + * + * @param string $act action command + * @return string action command + * @throws Exception if (un)subscribing fails */ function act_subscription($act){ global $lang; @@ -779,6 +817,9 @@ function act_subscription($act){ * default action for the event ACTION_HANDLE_SUBSCRIBE. * * @author Adrian Lang <lang@cosmocode.de> + * + * @param array &$params the parameters: target, style and action + * @throws Exception */ function subscription_handle_post(&$params) { global $INFO; diff --git a/inc/auth.php b/inc/auth.php index 4b1e6ce31..d51534e67 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -127,6 +127,7 @@ function auth_setup() { * Loads the ACL setup and handle user wildcards * * @author Andreas Gohr <andi@splitbrain.org> + * * @return array */ function auth_loadACL() { @@ -173,7 +174,7 @@ function auth_loadACL() { /** * Event hook callback for AUTH_LOGIN_CHECK * - * @param $evdata + * @param array $evdata * @return bool */ function auth_login_wrapper($evdata) { @@ -280,8 +281,9 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { * token is correct. Will exit with a 401 Status if not. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $token The authentication token - * @return boolean true (or will exit on failure) + * @return boolean|null true (or will exit on failure) */ function auth_validateToken($token) { if(!$token || $token != $_SESSION[DOKU_COOKIE]['auth']['token']) { @@ -307,6 +309,7 @@ function auth_validateToken($token) { * NOTE: this is completely unrelated to the getSecurityToken() function * * @author Andreas Gohr <andi@splitbrain.org> + * * @return string The auth token */ function auth_createToken() { @@ -350,6 +353,7 @@ function auth_browseruid() { * and stored in this file. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $addsession if true, the sessionid is added to the salt * @param bool $secure if security is more important than keeping the old value * @return string @@ -377,6 +381,7 @@ function auth_cookiesalt($addsession = false, $secure = false) { * @author Mark Seecof * @author Michael Hamann <michael@content-space.de> * @link http://www.php.net/manual/de/function.mt-rand.php#83655 + * * @param int $length number of bytes to get * @return string binary random strings */ @@ -443,6 +448,7 @@ function auth_randombytes($length) { * * @author Michael Samuel * @author Michael Hamann <michael@content-space.de> + * * @param int $min * @param int $max * @return int @@ -514,6 +520,7 @@ function auth_decrypt($ciphertext, $secret) { * off. It also clears session data. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $keepbc - when true, the breadcrumb data is not cleared */ function auth_logoff($keepbc = false) { @@ -554,6 +561,7 @@ function auth_logoff($keepbc = false) { * * @author Andreas Gohr <andi@splitbrain.org> * @see auth_isadmin + * * @param string $user Username * @param array $groups List of groups the user is in * @param bool $adminonly when true checks if user is admin @@ -598,6 +606,7 @@ function auth_ismanager($user = null, $groups = null, $adminonly = false) { * * @author Andreas Gohr <andi@splitbrain.org> * @see auth_ismanager() + * * @param string $user Username * @param array $groups List of groups the user is in * @return bool @@ -612,9 +621,9 @@ function auth_isadmin($user = null, $groups = null) { * * Note: all input should NOT be nameencoded. * - * @param $memberlist string commaseparated list of allowed users and groups - * @param $user string user to match against - * @param $groups array groups the user is member of + * @param string $memberlist commaseparated list of allowed users and groups + * @param string $user user to match against + * @param array $groups groups the user is member of * @return bool true for membership acknowledged */ function auth_isMember($memberlist, $user, array $groups) { @@ -677,6 +686,7 @@ function auth_quickaclcheck($id) { * Returns the maximum rights a user has for the given ID or its namespace * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers AUTH_ACL_CHECK * @param string $id page ID (needs to be resolved and cleaned) * @param string $user Username @@ -699,6 +709,7 @@ function auth_aclcheck($id, $user, $groups) { * DO NOT CALL DIRECTLY, use auth_aclcheck() instead * * @author Andreas Gohr <andi@splitbrain.org> + * * @param array $data event data * @return int permission level */ @@ -831,6 +842,10 @@ function auth_aclcheck_cb($data) { * * @author Andreas Gohr <gohr@cosmocode.de> * @see rawurldecode() + * + * @param string $name + * @param bool $skip_group + * @return string */ function auth_nameencode($name, $skip_group = false) { global $cache_authname; @@ -912,6 +927,7 @@ function auth_pwgen($foruser = '') { * Sends a password to the given user * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $user Login name of the user * @param string $password The new password in clear text * @return bool true on success @@ -947,6 +963,7 @@ function auth_sendPassword($user, $password) { * This registers a new user - Data is read directly from $_POST * * @author Andreas Gohr <andi@splitbrain.org> + * * @return bool true on success, false on any error */ function register() { @@ -1128,6 +1145,7 @@ function auth_deleteprofile(){ } } + $deleted = array(); $deleted[] = $INPUT->server->str('REMOTE_USER'); if($auth->triggerUserMod('delete', array($deleted))) { // force and immediate logout including removing the sticky cookie @@ -1278,6 +1296,7 @@ function act_resendpwd() { * is chosen. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $clear The clear text password * @param string $method The hashing method * @param string $salt A salt, null for random @@ -1302,6 +1321,7 @@ function auth_cryptPassword($clear, $method = '', $salt = null) { * Verifies a cleartext password against a crypted hash * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $clear The clear text password * @param string $crypt The hash to compare with * @return bool true if both match diff --git a/inc/blowfish.php b/inc/blowfish.php index bcf5804a2..7499515bc 100644 --- a/inc/blowfish.php +++ b/inc/blowfish.php @@ -356,7 +356,7 @@ class Horde_Cipher_blowfish * Encrypt a block on data. * * @param String $block The data to encrypt - * @param optional String $key The key to use + * @param String $key optional The key to use * * @return String the encrypted output */ @@ -404,8 +404,8 @@ class Horde_Cipher_blowfish /** * Decrypt a block on data. * - * @param String $block The data to decrypt - * @param optional String $key The key to use + * @param String $block The data to decrypt + * @param String $key optional The key to use * * @return String the decrypted output */ @@ -452,6 +452,7 @@ class Horde_Cipher_blowfish /** * Converts a text key into an array. * + * @param string $key * @return array The key. */ function _formatKey($key) { @@ -464,8 +465,8 @@ class Horde_Cipher_blowfish /** * Encryption using blowfish algorithm * - * @param string original data - * @param string the secret + * @param string $data original data + * @param string $secret the secret * * @return string the encrypted result * @@ -493,8 +494,8 @@ function PMA_blowfish_encrypt($data, $secret) { /** * Decryption using blowfish algorithm * - * @param string encrypted data - * @param string the secret + * @param string $encdata encrypted data + * @param string $secret the secret * * @return string original data * diff --git a/inc/cache.php b/inc/cache.php index 6817e771b..edf394134 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -50,7 +50,7 @@ class cache { $this->_addDependencies(); if ($this->_event) { - return $this->_stats(trigger_event($this->_event,$this,array($this,'_useCache'))); + return $this->_stats(trigger_event($this->_event, $this, array($this,'_useCache'))); } else { return $this->_stats($this->_useCache()); } @@ -316,7 +316,7 @@ class cache_instructions extends cache_parser { * retrieve the cached data * * @param bool $clean true to clean line endings, false to leave line endings alone - * @return string cache contents + * @return array cache contents */ public function retrieveCache($clean=true) { $contents = io_readFile($this->cache, false); @@ -326,7 +326,7 @@ class cache_instructions extends cache_parser { /** * cache $instructions * - * @param string $instructions the instruction to be cached + * @param array $instructions the instruction to be cached * @return bool true on success, false otherwise */ public function storeCache($instructions) { diff --git a/inc/changelog.php b/inc/changelog.php index 6af336fc2..c2d3cb489 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -83,17 +83,19 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr 'extra' => str_replace($strip, '', $extra) ); + $wasCreated = ($type===DOKU_CHANGE_TYPE_CREATE); + $wasReverted = ($type===DOKU_CHANGE_TYPE_REVERT); // update metadata if (!$wasRemoved) { $oldmeta = p_read_metadata($id); $meta = array(); - if (!$INFO['exists'] && empty($oldmeta['persistent']['date']['created'])){ // newly created + if ($wasCreated && empty($oldmeta['persistent']['date']['created'])){ // newly created $meta['date']['created'] = $created; if ($user){ $meta['creator'] = $INFO['userinfo']['name']; $meta['user'] = $user; } - } elseif (!$INFO['exists'] && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored + } elseif (($wasCreated || $wasReverted) && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored $meta['date']['created'] = $oldmeta['persistent']['date']['created']; $meta['date']['modified'] = $created; // use the files ctime here $meta['creator'] = $oldmeta['persistent']['creator']; @@ -725,8 +727,10 @@ abstract class ChangeLog { * If file larger than $chuncksize, only chunck is read that could contain $rev. * * @param int $rev revision timestamp - * @return array(fp, array(changeloglines), $head, $tail, $eof)|bool - * returns false when not succeed. fp only defined for chuck reading, needs closing. + * @return array|false + * if success returns array(fp, array(changeloglines), $head, $tail, $eof) + * where fp only defined for chuck reading, needs closing. + * otherwise false */ protected function readloglines($rev) { $file = $this->getChangelogFilename(); diff --git a/inc/cli.php b/inc/cli.php index 25bfddf7d..14e2c0c8d 100644 --- a/inc/cli.php +++ b/inc/cli.php @@ -108,7 +108,7 @@ abstract class DokuCLI { /** * Print an error message * - * @param $string + * @param string $string */ public function error($string) { $this->colors->ptln("E: $string", 'red', STDERR); @@ -117,7 +117,7 @@ abstract class DokuCLI { /** * Print a success message * - * @param $string + * @param string $string */ public function success($string) { $this->colors->ptln("S: $string", 'green', STDERR); @@ -126,7 +126,7 @@ abstract class DokuCLI { /** * Print an info message * - * @param $string + * @param string $string */ public function info($string) { $this->colors->ptln("I: $string", 'cyan', STDERR); @@ -199,8 +199,8 @@ class DokuCLI_Colors { /** * Convenience function to print a line in a given color * - * @param $line - * @param $color + * @param string $line + * @param string $color * @param resource $channel */ public function ptln($line, $color, $channel = STDOUT) { @@ -470,8 +470,8 @@ class DokuCLI_Options { * Can only be used after parseOptions() has been run * * @param string $option - * @param mixed $default what to return if the option was not set - * @return mixed + * @param bool|string $default what to return if the option was not set + * @return bool|string */ public function getOpt($option, $default = false) { if(isset($this->options[$option])) return $this->options[$option]; @@ -593,8 +593,8 @@ class DokuCLI_Options { /** * Displays text in multiple word wrapped columns * - * @param array $widths list of column widths (in characters) - * @param array $texts list of texts for each column + * @param int[] $widths list of column widths (in characters) + * @param string[] $texts list of texts for each column * @return string */ private function tableFormat($widths, $texts) { @@ -640,6 +640,11 @@ class DokuCLI_Exception extends Exception { const E_OPT_ABIGUOUS = 4; //Option abiguous const E_ARG_READ = 5; //Could not read argv + /** + * @param string $message The Exception message to throw. + * @param int $code The Exception code + * @param Exception $previous The previous exception used for the exception chaining. + */ public function __construct($message = "", $code = 0, Exception $previous = null) { if(!$code) $code = DokuCLI_Exception::E_ANY; parent::__construct($message, $code, $previous); diff --git a/inc/cliopts.php b/inc/cliopts.php index c75a5a93b..7d71c7dc9 100644 --- a/inc/cliopts.php +++ b/inc/cliopts.php @@ -36,9 +36,9 @@ if (version_compare(phpversion(), '4.3.0', '<') || php_sapi_name() == 'cgi') { // PHP ini settings set_time_limit(0); - ini_set('track_errors', true); - ini_set('html_errors', false); - ini_set('magic_quotes_runtime', false); + ini_set('track_errors', "1"); + ini_set('html_errors', "0"); + ini_set('magic_quotes_runtime', "0"); // Define stream constants define('STDIN', fopen('php://stdin', 'r')); @@ -78,7 +78,7 @@ class Doku_Cli_Opts { * @param string $bin_file executing file name - this MUST be passed the __FILE__ constant * @param string $short_options short options * @param array $long_options (optional) long options - * @return Doku_Cli_Opts_Container or Doku_Cli_Opts_Error + * @return Doku_Cli_Opts_Container|Doku_Cli_Opts_Error */ function & getOptions($bin_file, $short_options, $long_options = null) { $args = Doku_Cli_Opts::readPHPArgv(); diff --git a/inc/common.php b/inc/common.php index 11b8a7e26..2c9359a0c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -49,7 +49,7 @@ function ptln($string, $indent = 0) { * * @author Andreas Gohr <andi@splitbrain.org> * - * @param $string string being stripped + * @param string $string being stripped * @return string */ function stripctl($string) { @@ -62,6 +62,7 @@ function stripctl($string) { * @author Andreas Gohr <andi@splitbrain.org> * @link http://en.wikipedia.org/wiki/Cross-site_request_forgery * @link http://christ1an.blogspot.com/2007/04/preventing-csrf-efficiently.html + * * @return string */ function getSecurityToken() { @@ -95,7 +96,7 @@ function checkSecurityToken($token = null) { * @author Andreas Gohr <andi@splitbrain.org> * * @param bool $print if true print the field, otherwise html of the field is returned - * @return void|string html of hidden form field + * @return string html of hidden form field */ function formSecurityToken($print = true) { $ret = '<div class="no"><input type="hidden" name="sectok" value="'.getSecurityToken().'" /></div>'."\n"; @@ -120,6 +121,7 @@ function basicinfo($id, $htmlClient=true){ global $INPUT; // set info about manager/admin status. + $info = array(); $info['isadmin'] = false; $info['ismanager'] = false; if($INPUT->server->has('REMOTE_USER')) { @@ -335,7 +337,7 @@ function buildAttributes($params, $skipempty = false) { * * @author Andreas Gohr <andi@splitbrain.org> * - * @return array(pageid=>name, ... ) + * @return string[] with the data: array(pageid=>name, ... ) */ function breadcrumbs() { // we prepare the breadcrumbs early for quick session closing @@ -688,6 +690,7 @@ function checkwordblock($text = '') { } if(count($re) && preg_match('#('.join('|', $re).')#si', $text, $matches)) { // prepare event data + $data = array(); $data['matches'] = $matches; $data['userinfo']['ip'] = $INPUT->server->str('REMOTE_ADDR'); if($INPUT->server->str('REMOTE_USER')) { @@ -971,7 +974,7 @@ function rawLocale($id, $ext = 'txt') { * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id page id - * @param string $rev timestamp when a revision of wikitext is desired + * @param string|int $rev timestamp when a revision of wikitext is desired * @return string */ function rawWiki($id, $rev = '') { @@ -1111,7 +1114,7 @@ function parsePageTemplate(&$data) { * @param string $range in form "from-to" * @param string $id page id * @param string $rev optional, the revision timestamp - * @return array with three slices + * @return string[] with three slices */ function rawWikiSlices($range, $id, $rev = '') { $text = io_readWikiPage(wikiFN($id, $rev), $id, $rev); @@ -1122,6 +1125,7 @@ function rawWikiSlices($range, $id, $rev = '') { $from = !$from ? 0 : ($from - 1); $to = !$to ? strlen($text) : ($to - 1); + $slices = array(); $slices[0] = substr($text, 0, $from); $slices[1] = substr($text, $from, $to - $from); $slices[2] = substr($text, $to); @@ -1296,7 +1300,7 @@ function saveOldRevision($id) { * @param int|string $rev Old page revision * @param string $summary What changed * @param boolean $minor Is this a minor edit? - * @param array $replace Additional string substitutions, @KEY@ to be replaced by value + * @param string[] $replace Additional string substitutions, @KEY@ to be replaced by value * @return bool * * @author Andreas Gohr <andi@splitbrain.org> @@ -1376,8 +1380,8 @@ function getGoogleQuery() { /** * Return the human readable size of a file * - * @param int $size A file size - * @param int $dec A number of decimal places + * @param int $size A file size + * @param int $dec A number of decimal places * @return string human readable size * * @author Martin Benjamin <b.martin@cybernet.ch> @@ -1460,7 +1464,7 @@ function dformat($dt = null, $format = '') { * @author <ungu at terong dot com> * @link http://www.php.net/manual/en/function.date.php#54072 * - * @param int $int_date: current date in UNIX timestamp + * @param int $int_date current date in UNIX timestamp * @return string */ function date_iso8601($int_date) { @@ -1824,6 +1828,8 @@ function send_redirect($url) { } else { header('Location: '.$url); } + + if(defined('DOKU_UNITTEST')) return; // no exits during unit tests exit; } @@ -1914,7 +1920,7 @@ function set_doku_pref($pref, $val) { /** * Strips source mapping declarations from given text #601 * - * @param &string $text reference to the CSS or JavaScript code to clean + * @param string &$text reference to the CSS or JavaScript code to clean */ function stripsourcemaps(&$text){ $text = preg_replace('/^(\/\/|\/\*)[@#]\s+sourceMappingURL=.*?(\*\/)?$/im', '\\1\\2', $text); diff --git a/inc/config_cascade.php b/inc/config_cascade.php index 1d9f67edb..a6dfadc80 100644 --- a/inc/config_cascade.php +++ b/inc/config_cascade.php @@ -49,13 +49,13 @@ $config_cascade = array_merge( 'local' => array(DOKU_CONF . 'wordblock.local.conf'), ), 'userstyle' => array( - 'screen' => DOKU_CONF . 'userstyle.css', - 'print' => DOKU_CONF . 'userprint.css', - 'feed' => DOKU_CONF . 'userfeed.css', - 'all' => DOKU_CONF . 'userall.css', + 'screen' => array(DOKU_CONF . 'userstyle.css', DOKU_CONF . 'userstyle.less'), + 'print' => array(DOKU_CONF . 'userprint.css', DOKU_CONF . 'userprint.less'), + 'feed' => array(DOKU_CONF . 'userfeed.css', DOKU_CONF . 'userfeed.less'), + 'all' => array(DOKU_CONF . 'userall.css', DOKU_CONF . 'userall.less') ), 'userscript' => array( - 'default' => DOKU_CONF . 'userscript.js' + 'default' => array(DOKU_CONF . 'userscript.js') ), 'acl' => array( 'default' => DOKU_CONF . 'acl.auth.php', diff --git a/inc/confutils.php b/inc/confutils.php index 31371d41f..85bf5128c 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -14,6 +14,10 @@ * are returned. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file file name + * @param bool $knownonly + * @return array with extension, mimetype and if it should be downloaded */ function mimetype($file, $knownonly=true){ $mtypes = getMimeTypes(); // known mimetypes diff --git a/inc/events.php b/inc/events.php index 318a7617e..256fb561e 100644 --- a/inc/events.php +++ b/inc/events.php @@ -27,6 +27,9 @@ class Doku_Event { /** * event constructor + * + * @param string $name + * @param mixed $data */ function Doku_Event($name, &$data) { @@ -120,14 +123,18 @@ class Doku_Event { * stop any further processing of the event by event handlers * this function does not prevent the default action taking place */ - function stopPropagation() { $this->_continue = false; } + function stopPropagation() { + $this->_continue = false; + } /** * preventDefault * * prevent the default action taking place */ - function preventDefault() { $this->_default = false; } + function preventDefault() { + $this->_default = false; + } } /** @@ -165,13 +172,13 @@ class Doku_Event_Handler { * * register a hook for an event * - * @param $event string name used by the event, (incl '_before' or '_after' for triggers) - * @param $advise string - * @param $obj object object in whose scope method is to be executed, + * @param string $event string name used by the event, (incl '_before' or '_after' for triggers) + * @param string $advise + * @param object $obj object in whose scope method is to be executed, * if NULL, method is assumed to be a globally available function - * @param $method string event handler function - * @param $param mixed data passed to the event handler - * @param $seq int sequence number for ordering hook execution (ascending) + * @param string $method event handler function + * @param mixed $param data passed to the event handler + * @param int $seq sequence number for ordering hook execution (ascending) */ function register_hook($event, $advise, $obj, $method, $param=null, $seq=0) { $seq = (int)$seq; @@ -216,14 +223,14 @@ class Doku_Event_Handler { * * function wrapper to process (create, trigger and destroy) an event * - * @param $name string name for the event - * @param $data mixed event data - * @param $action callback (optional, default=NULL) default action, a php callback function - * @param $canPreventDefault bool (optional, default=true) can hooks prevent the default action + * @param string $name name for the event + * @param mixed $data event data + * @param callback $action (optional, default=NULL) default action, a php callback function + * @param bool $canPreventDefault (optional, default=true) can hooks prevent the default action * * @return mixed the event results value after all event processing is complete - * by default this is the return value of the default action however - * it can be set or modified by event handler hooks + * by default this is the return value of the default action however + * it can be set or modified by event handler hooks */ function trigger_event($name, &$data, $action=null, $canPreventDefault=true) { diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index c61c54503..70becc01e 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -16,6 +16,7 @@ * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> * @author Gerry Weissbach <dokuwiki@gammaproduction.de> + * * @param string $file local file to send * @param string $mime mime type of the file * @param bool $dl set to true to force a browser download @@ -96,12 +97,13 @@ function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) { * WRITE: MEDIA, FILE, array( STATUS, STATUSMESSAGE ) * * @author Gerry Weissbach <gerry.w@gammaproduction.de> + * * @param string $media reference to the media id * @param string $file reference to the file variable * @param string $rev * @param int $width * @param int $height - * @return array(STATUS, STATUSMESSAGE) + * @return array as array(STATUS, STATUSMESSAGE) */ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { global $MIME, $EXT, $CACHE, $INPUT; @@ -149,6 +151,9 @@ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { * Resolves named constants * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $cache + * @return int cachetime in seconds */ function calc_cache($cache) { global $conf; diff --git a/inc/form.php b/inc/form.php index fadc71d3e..00eea9b3a 100644 --- a/inc/form.php +++ b/inc/form.php @@ -52,6 +52,7 @@ class Doku_Form { * @param bool|string $action (optional, deprecated) submit URL, defaults to current page * @param bool|string $method (optional, deprecated) 'POST' or 'GET', default is POST * @param bool|string $enctype (optional, deprecated) Encoding type of the data + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function Doku_Form($params, $action=false, $method=false, $enctype=false) { @@ -84,6 +85,7 @@ class Doku_Form { * Usually results in a border drawn around the form. * * @param string $legend Label that will be printed with the border. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function startFieldset($legend) { @@ -115,6 +117,7 @@ class Doku_Form { * * @param string $name Field name. * @param string $value Field value. If null, remove a previously added field. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function addHidden($name, $value) { @@ -132,6 +135,7 @@ class Doku_Form { * If string, it is printed without escaping special chars. * * * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function addElement($elem) { @@ -145,6 +149,7 @@ class Doku_Form { * * @param string $pos 0-based index where the element will be inserted. * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function insertElement($pos, $elem) { @@ -158,6 +163,7 @@ class Doku_Form { * * @param int $pos 0-based index the element will be placed at. * @param string|array $elem Pseudo-tag or string to add to the form. + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function replaceElement($pos, $elem) { @@ -172,7 +178,8 @@ class Doku_Form { * Gets the position of the first of a type of element. * * @param string $type Element type to look for. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementByType($type) { @@ -189,7 +196,8 @@ class Doku_Form { * Gets the position of the element with an ID attribute. * * @param string $id ID of the element to find. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementById($id) { @@ -207,7 +215,8 @@ class Doku_Form { * * @param string $name Attribute name. * @param string $value Attribute value. - * @return int position of element if found, otherwise false + * @return int|false position of element if found, otherwise false + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function findElementByAttribute($name, $value) { @@ -227,6 +236,7 @@ class Doku_Form { * * @param int $pos 0-based index * @return array reference pseudo-element + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function &getElementAt($pos) { @@ -243,6 +253,8 @@ class Doku_Form { * 'form_$type'. The function should return the HTML to be printed. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return string html of the form */ function getForm() { global $lang; @@ -310,6 +322,7 @@ class Doku_Form { * @param string $tag Tag name. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeTag($tag, $attrs=array()) { @@ -326,6 +339,7 @@ function form_makeTag($tag, $attrs=array()) { * @param string $tag Tag name. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeOpenTag($tag, $attrs=array()) { @@ -341,6 +355,7 @@ function form_makeOpenTag($tag, $attrs=array()) { * * @param string $tag Tag name. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeCloseTag($tag) { @@ -358,6 +373,7 @@ function form_makeCloseTag($tag) { * @param string $text Text to fill the field with. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeWikiText($text, $attrs=array()) { @@ -378,6 +394,7 @@ function form_makeWikiText($text, $attrs=array()) { * @param string $value (optional) Displayed label. Uses $act if not provided. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeButton($type, $act, $value='', $attrs=array()) { @@ -406,6 +423,7 @@ function form_makeButton($type, $act, $value='', $attrs=array()) { * reference it with a 'for' attribute. * @param array $attrs Optional attributes. * @return array pseudo-tag + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function form_makeField($type, $name, $value='', $label=null, $id='', $class='', $attrs=array()) { @@ -522,6 +540,18 @@ function form_makeRadioField($name, $value='1', $label=null, $id='', $class='', * a string. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name Name attribute of the input. + * @param string[]|array[] $values The list of values can be strings, arrays of (value,text), + * or an associative array with the values as keys and labels as values. + * @param string|int $selected default selected value, string or index number + * @param string $class Class attribute of the label. If this is 'block', + * then a line break will be added after the field. + * @param string $label Label that will be printed before the input. + * @param string $id ID attribute of the input. If set, the label will + * reference it with a 'for' attribute. + * @param array $attrs Optional attributes. + * @return array pseudo-tag */ function form_makeMenuField($name, $values, $selected='', $label=null, $id='', $class='', $attrs=array()) { if (is_null($label)) $label = $name; @@ -556,6 +586,18 @@ function form_makeMenuField($name, $values, $selected='', $label=null, $id='', $ * Items are selected by supplying its value or an array of values. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name Name attribute of the input. + * @param string[]|array[] $values The list of values can be strings, arrays of (value,text), + * or an associative array with the values as keys and labels as values. + * @param array|string $selected value or array of values of the items that need to be selected + * @param string $class Class attribute of the label. If this is 'block', + * then a line break will be added after the field. + * @param string $label Label that will be printed before the input. + * @param string $id ID attribute of the input. If set, the label will + * reference it with a 'for' attribute. + * @param array $attrs Optional attributes. + * @return array pseudo-tag */ function form_makeListboxField($name, $values, $selected='', $label=null, $id='', $class='', $attrs=array()) { if (is_null($label)) $label = $name; @@ -595,6 +637,9 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id='' * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_tag($attrs) { return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'/>'; @@ -608,6 +653,9 @@ function form_tag($attrs) { * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_opentag($attrs) { return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'>'; @@ -621,6 +669,9 @@ function form_opentag($attrs) { * There are no attributes. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html of tag */ function form_closetag($attrs) { return '</'.$attrs['_tag'].'>'; @@ -634,6 +685,9 @@ function form_closetag($attrs) { * Attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_openfieldset($attrs) { $s = '<fieldset '.buildAttributes($attrs,true).'>'; @@ -648,6 +702,8 @@ function form_openfieldset($attrs) { * There are no attributes. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return string html */ function form_closefieldset() { return '</fieldset>'; @@ -661,6 +717,9 @@ function form_closefieldset() { * Value is passed to formText() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_hidden($attrs) { return '<input type="hidden" name="'.$attrs['name'].'" value="'.formText($attrs['value']).'" />'; @@ -674,6 +733,9 @@ function form_hidden($attrs) { * Text will be passed to formText(), attributes to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_wikitext($attrs) { // mandatory attributes @@ -693,6 +755,9 @@ function form_wikitext($attrs) { * Other attributes are passed to buildAttributes() * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_button($attrs) { $p = (!empty($attrs['_action'])) ? 'name="do['.$attrs['_action'].']" ' : ''; @@ -708,6 +773,9 @@ function form_button($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_field($attrs) { $s = '<label'; @@ -729,6 +797,9 @@ function form_field($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_fieldright($attrs) { $s = '<label'; @@ -750,6 +821,9 @@ function form_fieldright($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_textfield($attrs) { // mandatory attributes @@ -773,6 +847,9 @@ function form_textfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_passwordfield($attrs) { // mandatory attributes @@ -798,6 +875,9 @@ function form_passwordfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag * * @author Michael Klier <chi@chimeric.de> + * + * @param array $attrs attributes + * @return string html */ function form_filefield($attrs) { $s = '<label'; @@ -824,6 +904,9 @@ function form_filefield($attrs) { * $attrs['value'][1] is constructed as well. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_checkboxfield($attrs) { // mandatory attributes @@ -853,6 +936,9 @@ function form_checkboxfield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_radiofield($attrs) { // mandatory attributes @@ -879,6 +965,9 @@ function form_radiofield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_menufield($attrs) { $attrs['size'] = '1'; @@ -924,6 +1013,9 @@ function form_menufield($attrs) { * Other attributes are passed to buildAttributes() for the input tag. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param array $attrs attributes + * @return string html */ function form_listboxfield($attrs) { $s = '<label'; diff --git a/inc/fulltext.php b/inc/fulltext.php index aaef090e1..d6cddc566 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -20,9 +20,13 @@ if(!defined('FT_SNIPPET_NUMBER')) define('FT_SNIPPET_NUMBER',15); * * refactored into ft_pageSearch(), _ft_pageSearch() and trigger_event() * + * @param string $query + * @param array $highlight + * @return array */ function ft_pageSearch($query,&$highlight){ + $data = array(); $data['query'] = $query; $data['highlight'] =& $highlight; @@ -34,6 +38,9 @@ function ft_pageSearch($query,&$highlight){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param array $data event data + * @return array matching documents */ function _ft_pageSearch(&$data) { $Indexer = idx_get_indexer(); @@ -205,6 +212,11 @@ function ft_mediause($id, $ignore_perms = false){ * @triggers SEARCH_QUERY_PAGELOOKUP * @author Andreas Gohr <andi@splitbrain.org> * @author Adrian Lang <lang@cosmocode.de> + * + * @param string $id page id + * @param bool $in_ns match against namespace as well? + * @param bool $in_title search in title? + * @return string[] */ function ft_pageLookup($id, $in_ns=false, $in_title=false){ $data = compact('id', 'in_ns', 'in_title'); @@ -212,6 +224,12 @@ function ft_pageLookup($id, $in_ns=false, $in_title=false){ return trigger_event('SEARCH_QUERY_PAGELOOKUP', $data, '_ft_pageLookup'); } +/** + * Returns list of pages as array(pageid => First Heading) + * + * @param array &$data event data + * @return string[] + */ function _ft_pageLookup(&$data){ // split out original parameters $id = $data['id']; @@ -269,6 +287,10 @@ function _ft_pageLookup(&$data){ * Tiny helper function for comparing the searched title with the title * from the search index. This function is a wrapper around stripos with * adapted argument order and return value. + * + * @param string $search searched title + * @param string $title title from index + * @return bool */ function _ft_pageLookupTitleCompare($search, $title) { return stripos($title, $search) !== false; @@ -278,6 +300,10 @@ function _ft_pageLookupTitleCompare($search, $title) { * Sort pages based on their namespace level first, then on their string * values. This makes higher hierarchy pages rank higher than lower hierarchy * pages. + * + * @param string $a + * @param string $b + * @return int Returns < 0 if $a is less than $b; > 0 if $a is greater than $b, and 0 if they are equal. */ function ft_pagesorter($a, $b){ $ac = count(explode(':',$a)); @@ -295,6 +321,10 @@ function ft_pagesorter($a, $b){ * * @author Andreas Gohr <andi@splitbrain.org> * @triggers FULLTEXT_SNIPPET_CREATE + * + * @param string $id page id + * @param array $highlight + * @return mixed */ function ft_snippet($id,$highlight){ $text = rawWiki($id); @@ -389,6 +419,9 @@ function ft_snippet($id,$highlight){ /** * Wraps a search term in regex boundary checks. + * + * @param string $term + * @return string */ function ft_snippet_re_preprocess($term) { // do not process asian terms where word boundaries are not explicit @@ -432,6 +465,7 @@ function ft_snippet_re_preprocess($term) { * based upon PEAR's PHP_Compat function for array_intersect_key() * * @param array $args An array of page arrays + * @return array */ function ft_resultCombine($args){ $array_count = count($args); @@ -461,6 +495,8 @@ function ft_resultCombine($args){ * based upon ft_resultCombine() function * * @param array $args An array of page arrays + * @return array + * * @author Kazutaka Miyasaka <kazmiya@gmail.com> */ function ft_resultUnite($args) { @@ -484,6 +520,8 @@ function ft_resultUnite($args) { * nearly identical to PHP5's array_diff_key() * * @param array $args An array of page arrays + * @return array + * * @author Kazutaka Miyasaka <kazmiya@gmail.com> */ function ft_resultComplement($args) { @@ -506,6 +544,10 @@ function ft_resultComplement($args) { * * @author Andreas Gohr <andi@splitbrain.org> * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param Doku_Indexer $Indexer + * @param string $query search query + * @return array of search formulas */ function ft_queryParser($Indexer, $query){ /** @@ -736,6 +778,12 @@ function ft_queryParser($Indexer, $query){ * This function is used in ft_queryParser() and not for general purpose use. * * @author Kazutaka Miyasaka <kazmiya@gmail.com> + * + * @param Doku_Indexer $Indexer + * @param string $term + * @param bool $consider_asian + * @param bool $phrase_mode + * @return string */ function ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = false) { $parsed = ''; diff --git a/inc/html.php b/inc/html.php index 495bdf919..87affd47b 100644 --- a/inc/html.php +++ b/inc/html.php @@ -83,6 +83,10 @@ function html_denied() { * inserts section edit buttons if wanted or removes the markers * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $text + * @param bool $show show section edit buttons? + * @return string */ function html_secedit($text,$show=true){ global $INFO; @@ -101,8 +105,11 @@ function html_secedit($text,$show=true){ * prepares section edit button data for event triggering * used as a callback in html_secedit * - * @triggers HTML_SECEDIT_BUTTON * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $matches matches with regexp + * @return string + * @triggers HTML_SECEDIT_BUTTON */ function html_secedit_button($matches){ $data = array('secid' => $matches[1], @@ -121,6 +128,9 @@ function html_secedit_button($matches){ * used as default action form HTML_SECEDIT_BUTTON * * @author Adrian Lang <lang@cosmocode.de> + * + * @param array $data name, section id and target + * @return string html */ function html_secedit_get_button($data) { global $ID; @@ -147,6 +157,8 @@ function html_secedit_get_button($data) { * Just the back to top button (in its own form) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return string html */ function html_topbtn(){ global $lang; @@ -161,6 +173,15 @@ function html_topbtn(){ * If tooltip exists, the access key tooltip is replaced. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $name + * @param string $id + * @param string $akey access key + * @param string[] $params key-value pairs added as hidden inputs + * @param string $method + * @param string $tooltip + * @param bool|string $label label text, false: lookup btn_$name in localization + * @return string */ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ global $conf; @@ -213,9 +234,11 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false } /** - * show a wiki page + * Show a wiki page * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param null|string $txt wiki text or null for showing $ID */ function html_show($txt=null){ global $ID; @@ -282,6 +305,10 @@ function html_draft(){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Harry Fuecks <hfuecks@gmail.com> + * + * @param string $html + * @param array|string $phrases + * @return string html */ function html_hilight($html,$phrases){ $phrases = (array) $phrases; @@ -300,6 +327,9 @@ function html_hilight($html,$phrases){ * Callback used by html_hilight() * * @author Harry Fuecks <hfuecks@gmail.com> + * + * @param array $m matches + * @return string html */ function html_hilight_callback($m) { $hlight = unslash($m[0]); @@ -425,6 +455,9 @@ function html_locked(){ * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param int $first skip the first n changelog lines + * @param bool|string $media_id id of media, or false for current page */ function html_revisions($first=0, $media_id = false){ global $ID; @@ -646,6 +679,9 @@ function html_revisions($first=0, $media_id = false){ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * @author Ben Coburn <btcoburn@silicodon.net> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param int $first + * @param string $show_changes */ function html_recent($first=0, $show_changes='both'){ global $conf; @@ -833,6 +869,8 @@ function html_recent($first=0, $show_changes='both'){ * Display page index * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ns */ function html_index($ns){ global $conf; @@ -861,6 +899,9 @@ function html_index($ns){ * User function for html_buildlist() * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string */ function html_list_index($item){ global $ID, $conf; @@ -891,10 +932,23 @@ function html_list_index($item){ * it gives different classes to opened or closed "folders" * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function html_li_index($item){ + global $INFO; + + $class = ''; + $id = ''; + if($item['type'] == "f"){ - return '<li class="level'.$item['level'].'">'; + // scroll to the current item + if($item['id'] == $INFO['id']) { + $id = ' id="scroll__here"'; + $class = ' bounce'; + } + return '<li class="level'.$item['level'].$class.'" '.$id.'>'; }elseif($item['open']){ return '<li class="open">'; }else{ @@ -906,6 +960,9 @@ function html_li_index($item){ * Default List item * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function html_li_default($item){ return '<li class="level'.$item['level'].'">'; @@ -929,7 +986,7 @@ function html_li_default($item){ * @param array $data array with item arrays * @param string $class class of ul wrapper * @param callable $func callback to print an list item - * @param string $lifunc callback to the opening li tag + * @param callable $lifunc callback to the opening li tag * @param bool $forcewrapper Trigger building a wrapper ul if the first level is 0 (we have a root object) or 1 (just the root content) * @return string html of an unordered list @@ -1021,12 +1078,13 @@ function html_backlinks(){ /** * Get header of diff HTML + * * @param string $l_rev Left revisions * @param string $r_rev Right revision * @param string $id Page id, if null $ID is used * @param bool $media If it is for media files * @param bool $inline Return the header on a single line - * @return array HTML snippets for diff header + * @return string[] HTML snippets for diff header */ function html_diff_head($l_rev, $r_rev, $id = null, $media = false, $inline = false) { global $lang; @@ -1482,7 +1540,7 @@ function html_diff_navigationlink($difftype, $linktype, $lrev, $rrev = null) { /** * Insert soft breaks in diff html * - * @param $diffhtml + * @param string $diffhtml * @return string */ function html_insert_softbreaks($diffhtml) { @@ -1521,6 +1579,9 @@ REGEX; * show warning on conflict detection * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $text + * @param string $summary */ function html_conflict($text,$summary){ global $ID; @@ -1681,7 +1742,6 @@ function html_edit(){ global $lang; global $conf; global $TEXT; - global $RANGE; if ($INPUT->has('changecheck')) { $check = $INPUT->str('changecheck'); @@ -1783,6 +1843,7 @@ function html_edit(){ * Display the default edit form * * Is the default action for HTML_EDIT_FORMSELECTION. + * * @param mixed[] $param */ function html_edit_form($param) { @@ -1802,6 +1863,8 @@ function html_edit_form($param) { * Adds a checkbox for minor edits for logged in users * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return array|bool */ function html_minoredit(){ global $conf; @@ -1902,6 +1965,7 @@ function html_debug(){ print '</pre>'; if (function_exists('apache_get_version')) { + $apache = array(); $apache['version'] = apache_get_version(); if (function_exists('apache_get_modules')) { @@ -2080,6 +2144,9 @@ function html_resendpwd() { * Return the TOC rendered to XHTML * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $toc + * @return string html */ function html_TOC($toc){ if(!count($toc)) return ''; @@ -2098,6 +2165,9 @@ function html_TOC($toc){ /** * Callback for html_buildlist + * + * @param array $item + * @return string html */ function html_list_toc($item){ if(isset($item['hid'])){ @@ -2132,6 +2202,7 @@ function html_mktocitem($link, $text, $level, $hash='#'){ * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT * * @author Tom N Harris <tnharris@whoopdedo.org> + * * @param string $name The name of the form * @param Doku_Form $form The form */ @@ -2144,6 +2215,7 @@ function html_form($name, &$form) { /** * Form print function. * Just calls printForm() on the data object. + * * @param Doku_Form $data The form */ function html_form_output($data) { diff --git a/inc/httputils.php b/inc/httputils.php index efeb2a56c..ac79aa176 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -15,6 +15,7 @@ define('HTTP_CHUNK_SIZE',16*1024); * * @author Simon Willison <swillison@gmail.com> * @link http://simonwillison.net/2003/Apr/23/conditionalGet/ + * * @param int $timestamp lastmodified time of the cache file * @returns void or exits with previously header() commands executed */ @@ -64,6 +65,7 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith <chris@jalakai.co.uk> + * * @param string $file absolute path of file to send * @returns void or exits with previous header() commands executed */ @@ -190,6 +192,9 @@ function http_rangeRequest($fh,$size,$mime){ * (samepath/samefilename.sameext.gz) created after the uncompressed file * * @author Chris Smith <chris.eureka@jalakai.co.uk> + * + * @param string $uncompressed_file + * @return bool */ function http_gzip_valid($uncompressed_file) { $gzip = $uncompressed_file.'.gz'; @@ -206,6 +211,9 @@ function http_gzip_valid($uncompressed_file) { * This function handles output of cacheable resource files. It ses the needed * HTTP headers. If a useable cache is present, it is passed to the web server * and the script is terminated. + * + * @param string $cache cache file name + * @param bool $cache_ok if cache can be used */ function http_cached($cache, $cache_ok) { global $conf; @@ -235,6 +243,9 @@ function http_cached($cache, $cache_ok) { /** * Cache content and print it + * + * @param string $file file name + * @param string $content */ function http_cached_finish($file, $content) { global $conf; diff --git a/inc/indexer.php b/inc/indexer.php index 5ca2f0bb1..014c5c5eb 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -61,6 +61,8 @@ define('IDX_ASIAN', '(?:'.IDX_ASIAN1.'|'.IDX_ASIAN2.'|'.IDX_ASIAN3.')'); * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> + * + * @return int|string */ function idx_get_version(){ static $indexer_version = null; @@ -84,6 +86,9 @@ function idx_get_version(){ * Differs from strlen in handling of asian characters. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $w + * @return int */ function wordlen($w){ $l = strlen($w); @@ -115,7 +120,8 @@ class Doku_Indexer { * * @param string $page a page name * @param string $text the body of the page - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -190,6 +196,7 @@ class Doku_Indexer { * * @param string $text content of the page * @return array list of word IDs and number of times used + * * @author Andreas Gohr <andi@splitbrain.org> * @author Christopher Smith <chris@jalakai.co.uk> * @author Tom N Harris <tnharris@whoopdedo.org> @@ -245,7 +252,8 @@ class Doku_Indexer { * @param string $page a page name * @param mixed $key a key string or array of key=>value pairs * @param mixed $value the value or list of values - * @return boolean the function completed successfully + * @return boolean|string the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> */ @@ -453,7 +461,8 @@ class Doku_Indexer { * Erases entries in all known indexes. * * @param string $page a page name - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function deletePage($page) { @@ -474,6 +483,7 @@ class Doku_Indexer { * * @param string $page a page name * @return boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function deletePageNoLock($page) { @@ -568,6 +578,7 @@ class Doku_Indexer { * @param string $text plain text * @param boolean $wc are wildcards allowed? * @return array list of words in the text + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -676,6 +687,7 @@ class Doku_Indexer { * * @param array $tokens list of words to search for * @return array list of page names with usage counts + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> */ @@ -730,6 +742,7 @@ class Doku_Indexer { * @param string $value search term to look for, must be a string or array of strings * @param callback $func comparison function * @return array lists with page names, keys are query values if $value is array + * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Michael Hamann <michael@content-space.de> */ @@ -829,6 +842,7 @@ class Doku_Indexer { * @param array $words The query terms. * @param array $result Set to word => array("length*id" ...) * @return array Set to length => array(id ...) + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndexWords(&$words, &$result) { @@ -909,6 +923,7 @@ class Doku_Indexer { * * @param string $key list only pages containing the metadata key (optional) * @return array list of page names + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function getPages($key=null) { @@ -942,6 +957,7 @@ class Doku_Indexer { * @param int $minlen minimum length of words to count * @param string $key metadata key to list. Uses the fulltext index if not given * @return array list of words as the keys and frequency as values + * * @author Tom N Harris <tnharris@whoopdedo.org> */ public function histogram($min=1, $max=0, $minlen=3, $key=null) { @@ -1002,6 +1018,8 @@ class Doku_Indexer { * Lock the indexer. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return bool|string */ protected function lock() { global $conf; @@ -1033,6 +1051,8 @@ class Doku_Indexer { * Release the indexer lock. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @return bool */ protected function unlock() { global $conf; @@ -1050,6 +1070,7 @@ class Doku_Indexer { * @param string $idx name of the index * @param string $suffix subpart identifier * @return array list of lines without CR or LF + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndex($idx, $suffix) { @@ -1066,6 +1087,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param array $lines list of lines without LF * @return bool If saving succeeded + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function saveIndex($idx, $suffix, &$lines) { @@ -1090,6 +1112,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param int $id the line number * @return string a line with trailing whitespace removed + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function getIndexKey($idx, $suffix, $id) { @@ -1114,6 +1137,7 @@ class Doku_Indexer { * @param int $id the line number * @param string $line line to write * @return bool If saving succeeded + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function saveIndexKey($idx, $suffix, $id, $line) { @@ -1155,6 +1179,7 @@ class Doku_Indexer { * @param string $suffix subpart identifier * @param string $value line to find in the index * @return int|bool line number of the value in the index or false if writing the index failed + * * @author Tom N Harris <tnharris@whoopdedo.org> */ protected function addIndexKey($idx, $suffix, $value) { @@ -1178,6 +1203,8 @@ class Doku_Indexer { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @return array */ protected function listIndexLengths() { return idx_listIndexLengths(); @@ -1190,6 +1217,9 @@ class Doku_Indexer { * that there are indices for. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @param array|int $filter + * @return array */ protected function indexLengths($filter) { global $conf; @@ -1216,6 +1246,11 @@ class Doku_Indexer { * Insert or replace a tuple in a line. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $line + * @param string|int $id + * @param int $count + * @return string */ protected function updateTuple($line, $id, $count) { if ($line != ''){ @@ -1237,6 +1272,10 @@ class Doku_Indexer { * * @author Tom N Harris <tnharris@whoopdedo.org> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $keys + * @param string $line + * @return array */ protected function parseTuples(&$keys, $line) { $result = array(); @@ -1257,13 +1296,16 @@ class Doku_Indexer { * Sum the counts in a list of tuples. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $line + * @return int */ protected function countTuples($line) { $freq = 0; $parts = explode(':', $line); foreach ($parts as $tuple) { if ($tuple === '') continue; - list($pid, $cnt) = explode('*', $tuple); + list(/* $pid */, $cnt) = explode('*', $tuple); $freq += (int)$cnt; } return $freq; @@ -1273,7 +1315,8 @@ class Doku_Indexer { /** * Create an instance of the indexer. * - * @return Doku_Indexer a Doku_Indexer + * @return Doku_Indexer a Doku_Indexer + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function idx_get_indexer() { @@ -1288,6 +1331,7 @@ function idx_get_indexer() { * Returns words that will be ignored. * * @return array list of stop words + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function & idx_get_stopwords() { @@ -1312,7 +1356,8 @@ function & idx_get_stopwords() { * @param string $page name of the page to index * @param boolean $verbose print status messages * @param boolean $force force reindexing even when the index is up to date - * @return boolean the function completed successfully + * @return string|boolean the function completed successfully + * * @author Tom N Harris <tnharris@whoopdedo.org> */ function idx_addPage($page, $verbose=false, $force=false) { @@ -1441,6 +1486,10 @@ function idx_tokenizer($string, $wc=false) { * Read the list of words in an index (if it exists). * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $idx + * @param string $suffix + * @return array */ function idx_getIndex($idx, $suffix) { global $conf; @@ -1456,6 +1505,8 @@ function idx_getIndex($idx, $suffix) { * a sorted array of lengths of the words used in the wiki. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @return array */ function idx_listIndexLengths() { global $conf; @@ -1510,6 +1561,9 @@ function idx_listIndexLengths() { * that there are indices for. * * @author YoBoY <yoboy.leguesh@gmail.com> + * + * @param array|int $filter + * @return array */ function idx_indexLengths($filter) { global $conf; @@ -1539,6 +1593,9 @@ function idx_indexLengths($filter) { * not a letter, number, or underscore. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $name + * @return string */ function idx_cleanName($name) { $name = utf8_romanize(trim((string)$name)); diff --git a/inc/infoutils.php b/inc/infoutils.php index 06e03e90f..399963176 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -297,6 +297,7 @@ define('MSG_ADMINS_ONLY',4); */ function msg($message,$lvl=0,$line='',$file='',$allow=MSG_PUBLIC){ global $MSG, $MSG_shown; + $errors = array(); $errors[-1] = 'error'; $errors[0] = 'info'; $errors[1] = 'success'; @@ -453,7 +454,7 @@ function dbg_backtrace(){ }elseif(is_array($arg)){ $params[] = '[Array]'; }elseif(is_null($arg)){ - $param[] = '[NULL]'; + $params[] = '[NULL]'; }else{ $params[] = (string) '"'.$arg.'"'; } diff --git a/inc/io.php b/inc/io.php index 27a34b045..bfa394a17 100644 --- a/inc/io.php +++ b/inc/io.php @@ -20,6 +20,7 @@ if(!defined('DOKU_INC')) die('meh.'); * @param string $id - a pageid, the namespace of that id will be tried to deleted * @param string $basedir - the config name of the type to delete (datadir or mediadir usally) * @return bool - true if at least one namespace was deleted + * * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> */ @@ -60,6 +61,11 @@ function io_sweepNS($id,$basedir='datadir'){ * $data[3] rev: The page revision, false for current wiki pages. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $file filename + * @param string $id page id + * @param bool|int $rev revision timestamp + * @return string */ function io_readWikiPage($file, $id, $rev=false) { if (empty($rev)) { $rev = false; } @@ -69,7 +75,11 @@ function io_readWikiPage($file, $id, $rev=false) { /** * Callback adapter for io_readFile(). + * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param array $data event data + * @return string */ function _io_readWikiPage_action($data) { if (is_array($data) && is_array($data[0]) && count($data[0])===2) { @@ -88,6 +98,10 @@ function _io_readWikiPage_action($data) { * be sure to set $clean to false! * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename + * @param bool $clean + * @return string */ function io_readFile($file,$clean=true){ $ret = ''; @@ -108,9 +122,12 @@ function io_readFile($file,$clean=true){ } /** * Returns the content of a .bz2 compressed file as string + * * @author marcel senf <marcel@rucksackreinigung.de> + * + * @param string $file filename + * @return string content */ - function bzfile($file){ $bz = bzopen($file,"r"); $str = ''; @@ -138,6 +155,12 @@ function bzfile($file){ * $data[3] rev: The page revision, false for current wiki pages. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $file filename + * @param string $content + * @param string $id page id + * @param int|bool $rev timestamp of revision + * @return bool */ function io_writeWikiPage($file, $content, $id, $rev=false) { if (empty($rev)) { $rev = false; } @@ -149,6 +172,9 @@ function io_writeWikiPage($file, $content, $id, $rev=false) { /** * Callback adapter for io_saveFile(). * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param array $data event data + * @return bool */ function _io_writeWikiPage_action($data) { if (is_array($data) && is_array($data[0]) && count($data[0])===3) { @@ -168,7 +194,11 @@ function _io_writeWikiPage_action($data) { * and bz2 if extension is .bz2 * * @author Andreas Gohr <andi@splitbrain.org> - * @return bool true on success + * + * @param string $file filename path to file + * @param string $content + * @param bool $append + * @return bool true on success, otherwise false */ function io_saveFile($file,$content,$append=false){ global $conf; @@ -221,6 +251,10 @@ function io_saveFile($file,$content,$append=false){ * 2005-10-14 : added regex option -- Christopher Smith <chris@jalakai.co.uk> * * @author Steven Danz <steven-danz@kc.rr.com> + * + * @param string $file filename + * @param string $badline exact linematch to remove + * @param bool $regex use regexp? * @return bool true on success */ function io_deleteFromFile($file,$badline,$regex=false){ @@ -285,6 +319,8 @@ function io_deleteFromFile($file,$badline,$regex=false){ * the lock is assumed to be stale and the function goes on * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename */ function io_lock($file){ global $conf; @@ -311,6 +347,8 @@ function io_lock($file){ * Unlocks a file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename */ function io_unlock($file){ global $conf; @@ -331,6 +369,9 @@ function io_unlock($file){ * $data[1] ns_type: 'pages' or 'media' namespace tree. * * @author Ben Coburn <btcoburn@silicodon.net> + * + * @param string $id page id + * @param string $ns_type 'pages' or 'media' */ function io_createNamespace($id, $ns_type='pages') { // verify ns_type @@ -365,6 +406,8 @@ function io_createNamespace($id, $ns_type='pages') { * Create the directory needed for the given file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file file name */ function io_makeFileDir($file){ $dir = dirname($file); @@ -379,6 +422,9 @@ function io_makeFileDir($file){ * @link http://www.php.net/manual/en/function.mkdir.php * @author <saint@corenova.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $target filename + * @return bool|int|string */ function io_mkdir_p($target){ global $conf; @@ -454,6 +500,9 @@ function io_rmdir($path, $removefiles = false) { * This is used when the safemode workaround is enabled * * @author <andi@splitbrain.org> + * + * @param string $dir name of the new directory + * @return false|string */ function io_mkdir_ftp($dir){ global $conf; @@ -488,6 +537,8 @@ function io_mkdir_ftp($dir){ * its path. * * @author Michael Klier <chi@chimeric.de> + * + * @return false|string path to new directory or false */ function io_mktmpdir() { global $conf; @@ -516,6 +567,13 @@ function io_mktmpdir() { * * @author Andreas Gohr <andi@splitbrain.org> * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $url url to download + * @param string $file path to file or directory where to save + * @param bool $useAttachment if true: try to use name of download, uses otherwise $defaultName, false: uses $file as path to file + * @param string $defaultName fallback for if using $useAttachment + * @param int $maxSize maximum file size + * @return bool|string if failed false, otherwise true or the name of the file in the given dir */ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=2097152){ global $conf; @@ -563,6 +621,10 @@ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=20 * * rename() can not overwrite existing files on Windows * this function will use copy/unlink instead + * + * @param string $from + * @param string $to + * @return bool succes or fail */ function io_rename($from,$to){ global $conf; @@ -582,6 +644,11 @@ function io_rename($from,$to){ * Returns the exit code from the process. * * @author Tom N Harris <tnharris@whoopdedo.org> + * + * @param string $cmd + * @param string $input input pipe + * @param string $output output pipe + * @return int exit code from process */ function io_exec($cmd, $input, &$output){ $descspec = array( diff --git a/inc/lang/cs/lang.php b/inc/lang/cs/lang.php index 168c1e403..1dd4def5a 100644 --- a/inc/lang/cs/lang.php +++ b/inc/lang/cs/lang.php @@ -51,7 +51,7 @@ $lang['btn_delete'] = 'Vymazat'; $lang['btn_back'] = 'Zpět'; $lang['btn_backlink'] = 'Zpětné odkazy'; $lang['btn_backtomedia'] = 'Zpět do Výběru dokumentu'; -$lang['btn_subscribe'] = 'Odebírat emailem změny stránky'; +$lang['btn_subscribe'] = 'Odebírat e-mailem změny stránky'; $lang['btn_profile'] = 'Upravit profil'; $lang['btn_reset'] = 'Reset'; $lang['btn_resendpwd'] = 'Nastavit nové heslo'; @@ -70,7 +70,7 @@ $lang['user'] = 'Uživatelské jméno'; $lang['pass'] = 'Heslo'; $lang['newpass'] = 'Nové heslo'; $lang['oldpass'] = 'Současné heslo'; -$lang['passchk'] = 'ještě jednou'; +$lang['passchk'] = 'Zopakovat'; $lang['remember'] = 'Přihlásit se nastálo'; $lang['fullname'] = 'Celé jméno'; $lang['email'] = 'E-mail'; @@ -83,16 +83,16 @@ $lang['nosecedit'] = 'Stránka byla v mezičase změněna. Informace $lang['searchcreatepage'] = 'Pokud jste nenašli, co hledáte, zkuste požadovanou stránku sami vytvořit stisknutím tlačítka \'\'Vytvořit stránku\'\'.'; $lang['regmissing'] = 'Musíte vyplnit všechny údaje.'; $lang['reguexists'] = 'Uživatel se stejným jménem už je zaregistrován.'; -$lang['regsuccess'] = 'Uživatelský účet byl vytvořen a heslo zasláno mailem.'; +$lang['regsuccess'] = 'Uživatelský účet byl vytvořen a heslo zasláno e-mailem.'; $lang['regsuccess2'] = 'Uživatelský účet byl vytvořen.'; $lang['regmailfail'] = 'Zdá se, že nastala chyba při posílání mailu s heslem. Zkuste kontaktovat správce.'; -$lang['regbadmail'] = 'Zadaná mailová adresa není platná. Pokud si myslíte, že to je špatně, zkuste kontaktovat správce.'; +$lang['regbadmail'] = 'Zadaná e-mailová adresa není platná. Pokud si myslíte, že to je špatně, zkuste kontaktovat správce.'; $lang['regbadpass'] = 'Heslo nebylo zadáno dvakrát stejně, zkuste to prosím znovu.'; $lang['regpwmail'] = 'Vaše heslo do systému DokuWiki'; $lang['reghere'] = 'Nemáte uživatelský účet? Zřiďte si ho'; $lang['profna'] = 'Tato wiki neumožňuje změnu profilu'; $lang['profnochange'] = 'Žádné změny nebyly provedeny.'; -$lang['profnoempty'] = 'Nelze zadat prázdné jméno nebo mailová adresa.'; +$lang['profnoempty'] = 'Nelze vynechat jméno nebo e-mailovou adresu.'; $lang['profchanged'] = 'Uživatelský profil změněn.'; $lang['profnodelete'] = 'Tato wiki nepodporuje mazání uživatelů'; $lang['profdeleteuser'] = 'Smazat účet'; @@ -105,8 +105,8 @@ $lang['resendpwd'] = 'Nastavit nové heslo pro'; $lang['resendpwdmissing'] = 'Musíte vyplnit všechny položky.'; $lang['resendpwdnouser'] = 'Bohužel takový uživatel v systému není.'; $lang['resendpwdbadauth'] = 'Autorizační kód není platný. Zadali jste opravdu celý odkaz na potvrzovací stránku?'; -$lang['resendpwdconfirm'] = 'Odkaz na potvrzovací stránku byl odeslán mailem.'; -$lang['resendpwdsuccess'] = 'Vaše nové heslo bylo odesláno emailem.'; +$lang['resendpwdconfirm'] = 'Odkaz na potvrzovací stránku byl odeslán e-mailem.'; +$lang['resendpwdsuccess'] = 'Vaše nové heslo bylo odesláno e-mailem.'; $lang['license'] = 'Kromě míst, kde je explicitně uvedeno jinak, je obsah této wiki licencován pod následující licencí:'; $lang['licenseok'] = 'Poznámka: Tím, že editujete tuto stránku, souhlasíte, aby váš obsah byl licencován pod následující licencí:'; $lang['searchmedia'] = 'Hledat jméno souboru:'; @@ -200,6 +200,8 @@ $lang['diff_side'] = 'Přidané'; $lang['diffprevrev'] = 'Předchozí verze'; $lang['diffnextrev'] = 'Následující verze'; $lang['difflastrev'] = 'Poslední revize'; +$lang['diffbothprevrev'] = 'Obě strany předchozí revize'; +$lang['diffbothnextrev'] = 'Obě strany příští revize'; $lang['line'] = 'Řádek'; $lang['breadcrumb'] = 'Historie:'; $lang['youarehere'] = 'Umístění:'; @@ -276,14 +278,14 @@ $lang['subscr_unsubscribe_error'] = 'Došlo k chybě při odhlašování %s ze s $lang['subscr_already_subscribed'] = '%s již je přihlášen do seznamu odběratelů %s'; $lang['subscr_not_subscribed'] = '%s není přihlášen do seznamu odběratelů %s'; $lang['subscr_m_not_subscribed'] = 'V současné době neodebíráte změny na aktuální stránce nebo ve jmenném prostoru.'; -$lang['subscr_m_new_header'] = 'Přihlásit k odebírání změn emailem'; +$lang['subscr_m_new_header'] = 'Přihlásit k odebírání změn e-mailem'; $lang['subscr_m_current_header'] = 'Aktuální odběratelé změn'; -$lang['subscr_m_unsubscribe'] = 'Odhlásit z odběru změn emailem'; -$lang['subscr_m_subscribe'] = 'Přihlásit se k odběru změn emailem'; +$lang['subscr_m_unsubscribe'] = 'Odhlásit z odběru změn e-mailem'; +$lang['subscr_m_subscribe'] = 'Přihlásit se k odběru změn e-mailem'; $lang['subscr_m_receive'] = 'Přejete si dostávat'; -$lang['subscr_style_every'] = 'email pro každou změnu'; -$lang['subscr_style_digest'] = 'souhrnný email změn pro každou stránku (každé %.2f dny/dní)'; -$lang['subscr_style_list'] = 'seznam změněných stránek od posledního emailu (každé %.2f dny/dní)'; +$lang['subscr_style_every'] = 'e-mail pro každou změnu'; +$lang['subscr_style_digest'] = 'souhrnný e-mail změn pro každou stránku (každé %.2f dny/dní)'; +$lang['subscr_style_list'] = 'seznam změněných stránek od posledního e-mailu (každé %.2f dny/dní)'; $lang['authtempfail'] = 'Autentizace uživatelů je dočasně nedostupná. Pokud tento problém přetrvává, informujte prosím správce této wiki.'; $lang['authpwdexpire'] = 'Platnost vašeho hesla vyprší za %d dní, měli byste ho změnit co nejdříve.'; $lang['i_chooselang'] = 'Vyberte si jazyk'; @@ -295,6 +297,7 @@ $lang['i_problems'] = 'Instalátor narazil na níže popsané problé $lang['i_modified'] = 'Instalátor bude z bezpečnostních důvodů pracovat pouze s čistou a ještě neupravenou instalací DokuWiki. Buď znovu rozbalte soubory z instalačního balíčku, nebo zkuste prostudovat <a href="http://dokuwiki.org/install">instrukce pro instalaci DokuWiki</a>.'; $lang['i_funcna'] = 'PHP funkce <code>%s</code> není dostupná. Váš webhosting ji možná z nějakého důvodu vypnul.'; $lang['i_phpver'] = 'Verze vaší instalace PHP <code>%s</code> je nižší než požadovaná <code>%s</code>. Budete muset aktualizovat svou instalaci PHP.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload musí být vypnut v php.ini pro běh DokuWiki.'; $lang['i_permfail'] = 'DokuWiki nemůže zapisovat do <code>%s</code>. Budete muset opravit práva k tomuto adresáři.'; $lang['i_confexists'] = '<code>%s</code> již existuje'; $lang['i_writeerr'] = 'Nelze vytvořit <code>%s</code>. Budete muset zkontrolovat práva k souborům či adresářům a vytvořit tento soubor ručně.'; @@ -348,3 +351,5 @@ $lang['currentns'] = 'Aktuální jmenný prostor'; $lang['searchresult'] = 'Výsledek hledání'; $lang['plainhtml'] = 'Čisté HTML'; $lang['wikimarkup'] = 'Wiki jazyk'; +$lang['page_nonexist_rev'] = 'Stránka neexistovala na %s. Byla vytvořena dodatečne na <a href="%s">%s</a>.'; +$lang['unable_to_parse_date'] = 'Nelze rozebrat parametr "%s".'; diff --git a/inc/lang/cs/mailtext.txt b/inc/lang/cs/mailtext.txt index f235a299b..443fc3e98 100644 --- a/inc/lang/cs/mailtext.txt +++ b/inc/lang/cs/mailtext.txt @@ -13,5 +13,5 @@ Uživatel : @USER@ -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@ diff --git a/inc/lang/cs/password.txt b/inc/lang/cs/password.txt index 18f21f1b1..1b9f77778 100644 --- a/inc/lang/cs/password.txt +++ b/inc/lang/cs/password.txt @@ -1,4 +1,4 @@ -Dobrý den, +Dobrý den! Zde jsou přihlašovací informace pro wiki @TITLE@ (@DOKUWIKIURL@) @@ -7,5 +7,5 @@ Uživatelské jméno : @LOGIN@ Heslo : @PASSWORD@ -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@ diff --git a/inc/lang/cs/pwconfirm.txt b/inc/lang/cs/pwconfirm.txt index aa37b3b84..4fcc0ab26 100644 --- a/inc/lang/cs/pwconfirm.txt +++ b/inc/lang/cs/pwconfirm.txt @@ -1,13 +1,13 @@ -Dobrý den, +Dobrý den! Někdo požádal o nové heslo k vašemu uživatelskému účtu na wiki @TITLE@ (@DOKUWIKIURL@) -Pokud jste o nové heslo nežádali, ignorujte prosím tento email. +Pokud jste o nové heslo nežádali, ignorujte prosím tento e-mail. Pro potvrzení, že jste tento požadavek poslali opravdu vy, prosím otevřete následující odkaz. @CONFIRM@ -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/cs/registermail.txt b/inc/lang/cs/registermail.txt index 201e7b779..f44189941 100644 --- a/inc/lang/cs/registermail.txt +++ b/inc/lang/cs/registermail.txt @@ -10,5 +10,5 @@ IP adresa : @IPADDRESS@ Hostitel : @HOSTNAME@ -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/cs/resendpwd.txt b/inc/lang/cs/resendpwd.txt index 1d2aa0d97..0820f287b 100644 --- a/inc/lang/cs/resendpwd.txt +++ b/inc/lang/cs/resendpwd.txt @@ -1,3 +1,3 @@ ====== Zaslat nové heslo ====== -Abyste získali nové heslo k vašemu učtu v této wiki, vyplňte všechny níže uvedené informace . Vaše nové heslo bude zasláno na emailovou adresu, kterou jste zadali při registraci. Uživatelské jméno by mělo být stejné jako vaše uživatelské jméno, s nímž se přihlašujete do této wiki. +Abyste získali nové heslo ke svému účtu v této wiki, vyplňte všechny níže uvedené informace. Nové heslo bude zasláno na e-mailovou adresu, kterou jste zadali při registraci. Uživatelské jméno by mělo být stejné jako vaše uživatelské jméno, s nímž se přihlašujete do této wiki. diff --git a/inc/lang/cs/subscr_digest.txt b/inc/lang/cs/subscr_digest.txt index 1b1770965..128d91931 100644 --- a/inc/lang/cs/subscr_digest.txt +++ b/inc/lang/cs/subscr_digest.txt @@ -11,12 +11,12 @@ Stará revize: @OLDPAGE@ Nová revize: @NEWPAGE@ Pro odhlášení z odebírání změn na této webové stránce -se prosím příhlašte do wiki na adrese +se prosím přihlašte do wiki na adrese @DOKUWIKIURL@, pak navštivte @SUBSCRIBE@ -a odhlaště se z odebírání změn na stránce či +a odhlaste se z odebírání změn na stránce či ve jmenném prostoru. -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/cs/subscr_list.txt b/inc/lang/cs/subscr_list.txt index f85be8a9f..81b344dc8 100644 --- a/inc/lang/cs/subscr_list.txt +++ b/inc/lang/cs/subscr_list.txt @@ -11,9 +11,9 @@ Pro odhlášení z odebírání změn se prosím příhlašte do wiki na adrese @DOKUWIKIURL@, pak navštivte @SUBSCRIBE@ -a odhlaště se z odebírání změn na stránce či +a odhlaste se z odebírání změn na stránce či ve jmenném prostoru. -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/cs/subscr_single.txt b/inc/lang/cs/subscr_single.txt index 1ee33da09..6f3774cd9 100644 --- a/inc/lang/cs/subscr_single.txt +++ b/inc/lang/cs/subscr_single.txt @@ -14,12 +14,12 @@ Stará revize: @OLDPAGE@ Nová revize: @NEWPAGE@ Pro odhlášení z odebírání změn na této webové stránce -se prosím příhlašte do wiki na adrese +se prosím přihlašte do wiki na adrese @DOKUWIKIURL@, pak navštivte @SUBSCRIBE@ -a odhlaště se z odebírání změn na stránce či +a odhlaste se z odebírání změn na stránce či ve jmenném prostoru. -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/cs/uploadmail.txt b/inc/lang/cs/uploadmail.txt index b19b0bf7e..28f4e2895 100644 --- a/inc/lang/cs/uploadmail.txt +++ b/inc/lang/cs/uploadmail.txt @@ -1,4 +1,4 @@ -Do vaší DokuWiki byl nahrán nový dokument. Tady jsou detaily: +Do DokuWiki byl nahrán nový dokument. Tady jsou detaily: Soubor : @MEDIA@ Datum : @DATE@ @@ -10,5 +10,5 @@ MIME typ : @MIME@ Uživatel : @USER@ -- -Tento email byl automaticky vygenerován systémem DokuWiki +Tento e-mail byl automaticky vygenerován systémem DokuWiki @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/da/lang.php b/inc/lang/da/lang.php index d27f0aa39..3b353d50c 100644 --- a/inc/lang/da/lang.php +++ b/inc/lang/da/lang.php @@ -17,6 +17,8 @@ * @author Soren Birk <soer9648@hotmail.com> * @author Jens Hyllegaard <jens.hyllegaard@gmail.com> * @author soer9648 <soer9648@eucl.dk> + * @author Søren Birk <sbi@eucl.dk> + * @author Søren Birk <soer9648@eucl.dk> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -61,6 +63,8 @@ $lang['btn_register'] = 'Registrér'; $lang['btn_apply'] = 'Anvend'; $lang['btn_media'] = 'Media Manager'; $lang['btn_deleteuser'] = 'Fjern Min Konto'; +$lang['btn_img_backto'] = 'Tilbage til %s'; +$lang['btn_mediaManager'] = 'Vis i Media Manager'; $lang['loggedinas'] = 'Logget ind som:'; $lang['user'] = 'Brugernavn'; $lang['pass'] = 'Adgangskode'; @@ -76,7 +80,7 @@ $lang['badpassconfirm'] = 'Kodeordet var desværre forkert'; $lang['minoredit'] = 'Mindre ændringer'; $lang['draftdate'] = 'Kladde automatisk gemt d.'; $lang['nosecedit'] = 'Siden blev ændret i mellemtiden, sektions information var for gammel, hentede hele siden i stedet.'; -$lang['searchcreatepage'] = "Hvis resultaterne ikke indeholder det du søgte efter kan du oprette et nyt dokument med samme navn som søgningen ved at trykke på knappen **''[Opret dette dokument]''**."; +$lang['searchcreatepage'] = 'Hvis resultaterne ikke indeholder det du søgte efter kan du oprette et nyt dokument med samme navn som søgningen ved at trykke på knappen **\'\'[Opret dette dokument]\'\'**.'; $lang['regmissing'] = 'Du skal udfylde alle felter.'; $lang['reguexists'] = 'Dette brugernavn er allerede i brug.'; $lang['regsuccess'] = 'Du er nu oprettet som bruger. Dit adgangskode bliver sendt til dig i en e-mail.'; @@ -148,6 +152,7 @@ $lang['js']['restore_confirm'] = 'Vil du virkeligt genskabe denne version?'; $lang['js']['media_diff'] = 'Vis forskelle:'; $lang['js']['media_diff_both'] = 'Side ved Side'; $lang['js']['media_diff_opacity'] = 'Skin-igennem'; +$lang['js']['media_diff_portions'] = 'Skub'; $lang['js']['media_select'] = 'Vælg filer...'; $lang['js']['media_upload_btn'] = 'Upload'; $lang['js']['media_done_btn'] = 'Færdig'; @@ -191,6 +196,11 @@ $lang['difflink'] = 'Link til denne sammenlinings vising'; $lang['diff_type'] = 'Vis forskelle:'; $lang['diff_inline'] = 'Indeni'; $lang['diff_side'] = 'Side ved Side'; +$lang['diffprevrev'] = 'Forrige revision'; +$lang['diffnextrev'] = 'Næste revision'; +$lang['difflastrev'] = 'Sidste revision'; +$lang['diffbothprevrev'] = 'Begge sider forrige revision'; +$lang['diffbothnextrev'] = 'Begge sider næste revision'; $lang['line'] = 'Linje'; $lang['breadcrumb'] = 'Sti:'; $lang['youarehere'] = 'Du er her:'; @@ -247,7 +257,6 @@ $lang['admin_register'] = 'Tilføj ny bruger'; $lang['metaedit'] = 'Rediger metadata'; $lang['metasaveerr'] = 'Skrivning af metadata fejlede'; $lang['metasaveok'] = 'Metadata gemt'; -$lang['btn_img_backto'] = 'Tilbage til %s'; $lang['img_title'] = 'Titel:'; $lang['img_caption'] = 'Billedtekst:'; $lang['img_date'] = 'Dato:'; @@ -260,7 +269,6 @@ $lang['img_camera'] = 'Kamera:'; $lang['img_keywords'] = 'Emneord:'; $lang['img_width'] = 'Bredde:'; $lang['img_height'] = 'Højde:'; -$lang['btn_mediaManager'] = 'Vis i Media Manager'; $lang['subscr_subscribe_success'] = 'Tilføjede %s til abonnement listen for %s'; $lang['subscr_subscribe_error'] = 'Fejl ved tilføjelse af %s til abonnement listen for %s'; $lang['subscr_subscribe_noaddress'] = 'Der er ikke nogen addresse forbundet til din bruger, så du kan ikke blive tilføjet til abonnement listen'; @@ -290,6 +298,7 @@ Du burde enten gen-udpakke filerne fra den hentede pakke eller tjekke den fuldst <a href="http://dokuwiki.org/install">DokuWiki installations instruktioner</a>'; $lang['i_funcna'] = 'PHP funtionen <code>%s</code> er ikke tilgængelig. Måske har din udbyder slået det fra af en eller anden grund?'; $lang['i_phpver'] = 'Din PHP version <code>%s</code> er mindre en den nødvendige <code>%s</code>. Du er nød til at opgradere din PHP installation.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload skal være deaktiveret i php.ini for at køre DokuWiki.'; $lang['i_permfail'] = 'DokuWiki kan ikke skrive til <code>%s</code>. Du er nød til at rette tilladelses indstillingerne for denne mappe!'; $lang['i_confexists'] = '<code>%s</code> eksisterer allerede'; $lang['i_writeerr'] = 'Kunne ikke oprette <code>%s</code>. Du bliver nød til at tjekke mappe/fil- tilladelserne og oprette filen manuelt.'; @@ -301,10 +310,12 @@ $lang['i_policy'] = 'Begyndende ACL politik'; $lang['i_pol0'] = 'Åben Wiki (alle kan læse, skrive og uploade)'; $lang['i_pol1'] = 'Offentlig Wiki (alle kan læse, kun registrerede brugere kan skrive og overføre)'; $lang['i_pol2'] = 'Lukket Wiki (kun for registerede brugere kan læse, skrive og overføre)'; +$lang['i_allowreg'] = 'Tillad at brugere kan registrere sig selv'; $lang['i_retry'] = 'Forsøg igen'; $lang['i_license'] = 'Vælg venligst licensen du vil tilføje dit indhold under:'; $lang['i_license_none'] = 'Vis ikke licensinformationer'; $lang['i_pop_field'] = 'Hjælp os venligst med at forbedre oplevelsen af DokuWiki:'; +$lang['i_pop_label'] = 'Send anonymt brugsdata til DokuWikis udviklere, én gang om måneden'; $lang['recent_global'] = 'Du ser lige nu ændringerne i <b>%s</b> navnerummet. Du kan også <a href="%s">se de sidste ændringer for hele wiki siden </a>'; $lang['years'] = '%d år siden'; $lang['months'] = '%d måned siden'; @@ -337,3 +348,8 @@ $lang['media_perm_read'] = 'Du har ikke nok rettigheder til at læse filer $lang['media_perm_upload'] = 'Du har ikke nok rettigheder til at uploade filer.'; $lang['media_update'] = 'Upload ny version'; $lang['media_restore'] = 'Genskab denne version'; +$lang['currentns'] = 'Nuværende navnerum'; +$lang['searchresult'] = 'Søgsresultat'; +$lang['plainhtml'] = 'Ren HTML'; +$lang['wikimarkup'] = 'Wiki Opmærkning'; +$lang['page_nonexist_rev'] = 'Siden blev ikke fundet ved %s. Den blev efterfølgende oprettet ved <a href="%s">%s</a>.'; diff --git a/inc/lang/fa/lang.php b/inc/lang/fa/lang.php index fea8fa210..25de5c92e 100644 --- a/inc/lang/fa/lang.php +++ b/inc/lang/fa/lang.php @@ -13,6 +13,8 @@ * @author reza_khn <reza_khn@yahoo.com> * @author Hamid <zarrabi@sharif.edu> * @author Mohamad Mehdi Habibi <habibi.esf@gmail.com> + * @author Mohammad Sadegh <msdn2013@gmail.com> + * @author Omid Hezaveh <hezpublic@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'rtl'; diff --git a/inc/lang/fi/lang.php b/inc/lang/fi/lang.php index 4856efe33..9bf4aad19 100644 --- a/inc/lang/fi/lang.php +++ b/inc/lang/fi/lang.php @@ -9,6 +9,7 @@ * @author Teemu Mattila <ghcsystems@gmail.com> * @author Sami Olmari <sami@olmari.fi> * @author Rami Lehti <rammer@ipi.fi> + * @author Jussi Takala <jussi.takala@live.fi> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -53,6 +54,8 @@ $lang['btn_register'] = 'Rekisteröidy'; $lang['btn_apply'] = 'Toteuta'; $lang['btn_media'] = 'Media manager'; $lang['btn_deleteuser'] = 'Poista tilini'; +$lang['btn_img_backto'] = 'Takaisin %s'; +$lang['btn_mediaManager'] = 'Näytä mediamanagerissa'; $lang['loggedinas'] = 'Kirjautunut nimellä:'; $lang['user'] = 'Käyttäjänimi'; $lang['pass'] = 'Salasana'; @@ -68,7 +71,7 @@ $lang['badpassconfirm'] = 'Valitan. Salasana oli väärin'; $lang['minoredit'] = 'Pieni muutos'; $lang['draftdate'] = 'Luonnos tallennettu automaattisesti'; $lang['nosecedit'] = 'Sivu on muuttunut välillä ja kappaleen tiedot olivat vanhentuneet. Koko sivu ladattu.'; -$lang['searchcreatepage'] = "Jos et löytänyt etsimääsi voit luoda uuden sivun tiedustelusi pohjalta käyttämällä ''Muokkaa tätä sivua'' -napilla."; +$lang['searchcreatepage'] = 'Jos et löytänyt etsimääsi voit luoda uuden sivun tiedustelusi pohjalta käyttämällä \'\'Muokkaa tätä sivua\'\' -napilla.'; $lang['regmissing'] = 'Kaikki kentät tulee täyttää.'; $lang['reguexists'] = 'Käyttäjä tällä käyttäjänimellä on jo olemassa.'; $lang['regsuccess'] = 'Käyttäjä luotiin ja salasana lähetettiin sähköpostilla.'; @@ -185,6 +188,9 @@ $lang['difflink'] = 'Linkki vertailunäkymään'; $lang['diff_type'] = 'Näytä eroavaisuudet:'; $lang['diff_inline'] = 'Sisäkkäin'; $lang['diff_side'] = 'Vierekkäin'; +$lang['diffprevrev'] = 'Edellinen revisio'; +$lang['diffnextrev'] = 'Seuraava revisio'; +$lang['difflastrev'] = 'Viimeisin revisio'; $lang['line'] = 'Rivi'; $lang['breadcrumb'] = 'Jäljet:'; $lang['youarehere'] = 'Olet täällä:'; @@ -241,7 +247,6 @@ $lang['admin_register'] = 'Lisää uusi käyttäjä'; $lang['metaedit'] = 'Muokkaa metadataa'; $lang['metasaveerr'] = 'Metadatan kirjoittaminen epäonnistui'; $lang['metasaveok'] = 'Metadata tallennettu'; -$lang['btn_img_backto'] = 'Takaisin %s'; $lang['img_title'] = 'Otsikko:'; $lang['img_caption'] = 'Kuvateksti:'; $lang['img_date'] = 'Päivämäärä:'; @@ -254,7 +259,6 @@ $lang['img_camera'] = 'Kamera:'; $lang['img_keywords'] = 'Avainsanat:'; $lang['img_width'] = 'Leveys:'; $lang['img_height'] = 'Korkeus:'; -$lang['btn_mediaManager'] = 'Näytä mediamanagerissa'; $lang['subscr_subscribe_success'] = '%s lisätty %s tilauslistalle'; $lang['subscr_subscribe_error'] = 'Virhe lisättäessä %s tilauslistalle %s'; $lang['subscr_subscribe_noaddress'] = 'Login tiedoissasi ei ole sähköpostiosoitetta. Sinua ei voi lisätä tilaukseen'; @@ -282,6 +286,7 @@ $lang['i_problems'] = 'Asennusohjelma löysi alla listattuja ongelmia $lang['i_modified'] = 'Turvallisuussyistä tämä ohjelma toimii vain uusien ja muokkaamattomien Dokuwiki-asennusten kanssa. Pura tiedostot uudestaan asennuspaketista, tai lue <a href="http://dokuwiki.org/install">Dokuwikin asennusohje (englanniksi)</a>'; $lang['i_funcna'] = 'PHP:n funktio <code>%s</code> ei ole käytettävissä. Palveluntarjoajasi on saattanut poistaa sen jostain syystä.'; $lang['i_phpver'] = 'Käyttämäsi PHP-ohjelmiston versio <code>%s</code> on pienempi, kuin tarvitaan <code>%s</code>. PHP-asennuksesi pitää päivittää.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload pitää ottaa pois käytöstä php.ini -tiedostosta käyttääksesi DokuWikiä'; $lang['i_permfail'] = '<code>%s</code> ei ole DokuWikin kirjoitettavissa. Muokkaa hakemiston oikeuksia!'; $lang['i_confexists'] = '<code>%s</code> on jo olemassa'; $lang['i_writeerr'] = '<code>%s</code>n luonti epäonnistui. Tarkista hakemiston/tiedoston oikeudet ja luo tiedosto käsin.'; @@ -335,3 +340,4 @@ $lang['currentns'] = 'Nykyinen nimiavaruus'; $lang['searchresult'] = 'Haun tulokset'; $lang['plainhtml'] = 'pelkkä HTML'; $lang['wikimarkup'] = 'Wiki markup'; +$lang['unable_to_parse_date'] = 'Parametrin "%s" jäsennys ei onnistu.'; diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index dfaa8df2e..7a9b82158 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -35,6 +35,7 @@ * @author Caillot <remicaillot5@gmail.com> * @author Schplurtz le Déboulonné <schplurtz@laposte.net> * @author YoBoY <yoboy@ubuntu-fr.org> + * @author james <j.mccann@celcat.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -77,7 +78,7 @@ $lang['btn_draftdel'] = 'Effacer le brouillon'; $lang['btn_revert'] = 'Restaurer'; $lang['btn_register'] = 'Créer un compte'; $lang['btn_apply'] = 'Appliquer'; -$lang['btn_media'] = 'Gestionnaire de médias'; +$lang['btn_media'] = 'Gestionnaire Multimédia'; $lang['btn_deleteuser'] = 'Supprimer mon compte'; $lang['btn_img_backto'] = 'Retour vers %s'; $lang['btn_mediaManager'] = 'Voir dans le gestionnaire de médias'; diff --git a/inc/lang/it/lang.php b/inc/lang/it/lang.php index 9cde9d28e..c6b99d5b5 100644 --- a/inc/lang/it/lang.php +++ b/inc/lang/it/lang.php @@ -20,6 +20,7 @@ * @author Mirko <malisan.mirko@gmail.com> * @author Francesco <francesco.cavalli@hotmail.com> * @author Fabio <fabioslurp@yahoo.it> + * @author Torpedo <dgtorpedo@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -81,7 +82,7 @@ $lang['badpassconfirm'] = 'La password è errata'; $lang['minoredit'] = 'Modifiche minori'; $lang['draftdate'] = 'Bozza salvata in automatico il'; $lang['nosecedit'] = 'La pagina è stata modificata nel frattempo; è impossibile modificare solo la sezione scelta, quindi è stata caricata la pagina intera.'; -$lang['searchcreatepage'] = "Se non hai trovato quello che cercavi, puoi creare una nuova pagina con questo titolo usando il pulsante ''Crea questa pagina''."; +$lang['searchcreatepage'] = 'Se non hai trovato quello che cercavi, puoi creare una nuova pagina con questo titolo usando il pulsante \'\'Crea questa pagina\'\'.'; $lang['regmissing'] = 'Devi riempire tutti i campi.'; $lang['reguexists'] = 'Il nome utente inserito esiste già.'; $lang['regsuccess'] = 'L\'utente è stato creato. La password è stata spedita via email.'; @@ -152,6 +153,7 @@ $lang['js']['del_confirm'] = 'Eliminare veramente questa voce?'; $lang['js']['restore_confirm'] = 'Vuoi davvero ripristinare questa versione?'; $lang['js']['media_diff'] = 'Guarda le differenze:'; $lang['js']['media_diff_both'] = 'Fianco a Fianco'; +$lang['js']['media_diff_opacity'] = 'Trasparire'; $lang['js']['media_diff_portions'] = 'rubare'; $lang['js']['media_select'] = 'Seleziona files..'; $lang['js']['media_upload_btn'] = 'Upload'; @@ -199,6 +201,8 @@ $lang['diff_side'] = 'Fianco a Fianco'; $lang['diffprevrev'] = 'Revisione precedente'; $lang['diffnextrev'] = 'Prossima revisione'; $lang['difflastrev'] = 'Ultima revisione'; +$lang['diffbothprevrev'] = 'Entrambe le parti precedenti la revisione'; +$lang['diffbothnextrev'] = 'Entrambe le parti successive la revisione'; $lang['line'] = 'Linea'; $lang['breadcrumb'] = 'Traccia:'; $lang['youarehere'] = 'Ti trovi qui:'; @@ -296,6 +300,7 @@ Prova a estrarre di nuovo i file dal pacchetto scaricato oppure consulta le <a href="http://dokuwiki.org/install">istruzioni per l\'installazione di Dokuwiki</a>'; $lang['i_funcna'] = 'La funzione PHP <code>%s</code> non è disponibile. Forse è stata disabilitata dal tuo provider per qualche motivo?'; $lang['i_phpver'] = 'La versione di PHP <code>%s</code> è inferiore a quella richiesta <code>%s</code>. Devi aggiornare l\'installazione di PHP.'; +$lang['i_mbfuncoverload'] = 'mbstring.func_overload deve essere disabilitato in php.ini per eseguire DokuWiki.'; $lang['i_permfail'] = 'DokuWiki non può scrivere <code>%s</code>. E\' necessario correggere i permessi per questa directory!'; $lang['i_confexists'] = '<code>%s</code> esiste già'; $lang['i_writeerr'] = 'Impossibile creare <code>%s</code>. E\' necessario verificare i permessi della directory o del file oppure creare il file manualmente.'; @@ -348,3 +353,4 @@ $lang['media_restore'] = 'Ripristina questa versione'; $lang['currentns'] = 'Namespace corrente'; $lang['searchresult'] = 'Risultati della ricerca'; $lang['plainhtml'] = 'HTML'; +$lang['page_nonexist_rev'] = 'Pagina non esistente a %s. E\' stata creata successivamente a <a href="%s">%s</a>.'; diff --git a/inc/lang/ja/lang.php b/inc/lang/ja/lang.php index 30068d782..3a5f169e7 100644 --- a/inc/lang/ja/lang.php +++ b/inc/lang/ja/lang.php @@ -344,3 +344,5 @@ $lang['currentns'] = '現在の名前空間'; $lang['searchresult'] = '検索結果'; $lang['plainhtml'] = 'プレーンHTML'; $lang['wikimarkup'] = 'Wikiマークアップ'; +$lang['page_nonexist_rev'] = '指定ページ %s はありません。このリンク <a href="%s">%s</a> から作成できます。'; +$lang['unable_to_parse_date'] = 'パラメータ "%s" を処理できません。'; diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php index 61bb58350..877c43de3 100644 --- a/inc/lang/ko/lang.php +++ b/inc/lang/ko/lang.php @@ -137,7 +137,7 @@ $lang['js']['medialeft'] = '왼쪽으로 그림 배치'; $lang['js']['mediaright'] = '오른쪽으로 그림 배치'; $lang['js']['mediacenter'] = '가운데으로 그림 배치'; $lang['js']['medianoalign'] = '배치하지 않음'; -$lang['js']['nosmblinks'] = '윈도우 공유 파일과의 연결은 마이크로소프트 인터넷 익스플로러에서만 동작합니다.\n그러나 링크를 복사하거나 붙여넣기를 할 수 있습니다.'; +$lang['js']['nosmblinks'] = 'Windows 공유 파일과의 연결은 Microsoft Internet Explorer에서만 동작합니다.\n그러나 링크를 복사하거나 붙여넣기를 할 수 있습니다.'; $lang['js']['linkwiz'] = '링크 마법사'; $lang['js']['linkto'] = '다음으로 연결:'; $lang['js']['del_confirm'] = '정말 선택된 항목을 삭제하겠습니까?'; @@ -281,11 +281,11 @@ $lang['subscr_style_list'] = '마지막 이메일 이후 바뀐 문서의 $lang['authtempfail'] = '사용자 인증을 일시적으로 사용할 수 없습니다. 만약 계속해서 문제가 발생한다면 위키 관리자에게 문의하시기 바랍니다.'; $lang['authpwdexpire'] = '비밀번호를 바꾼지 %d일이 지났으며, 비밀번호를 곧 바꿔야 합니다.'; $lang['i_chooselang'] = '사용할 언어를 선택하세요'; -$lang['i_installer'] = '도쿠위키 설치'; +$lang['i_installer'] = '도쿠위키 설치 관리자'; $lang['i_wikiname'] = '위키 이름'; $lang['i_enableacl'] = 'ACL 활성화 (권장)'; $lang['i_superuser'] = '슈퍼 사용자'; -$lang['i_problems'] = '설치하는 동안 아래와 같은 문제가 발생했습니다. 문제를 해결한 후 설치를 계속할 수 있습니다.'; +$lang['i_problems'] = '설치 관리자가 아래에 나와 있는 몇 가지 문제를 찾았습니다. 문제를 해결하지 전까지 설치를 계속할 수 없습니다.'; $lang['i_modified'] = '보안 상의 이유로 이 스크립트는 수정되지 않은 새 도쿠위키 설치에서만 동작됩니다. 다운로드한 압축 패키지를 다시 설치하거나 <a href="http://dokuwiki.org/ko:install">도쿠위키 설치 과정</a>을 참고해서 설치하세요.'; $lang['i_funcna'] = '<code>%s</code> PHP 함수를 사용할 수 없습니다. 호스트 제공자가 어떤 이유에서인지 막아 놓았을지 모릅니다.'; @@ -296,8 +296,10 @@ $lang['i_confexists'] = '<code>%s</code>(은)는 이미 존재합니다 $lang['i_writeerr'] = '<code>%s</code>(을)를 만들 수 없습니다. 먼저 디렉터리/파일 권한을 확인하고 파일을 수동으로 만드세요.'; $lang['i_badhash'] = 'dokuwiki.php를 인식할 수 없거나 원본 파일이 아닙니다 (해시=<code>%s</code>)'; $lang['i_badval'] = '<code>%s</code> - 잘못되었거나 빈 값입니다'; -$lang['i_success'] = '환경 설정이 성공적으로 끝났습니다. 지금 install.php를 지워도 상관없습니다. <a href="doku.php?id=wiki:welcome">새 도쿠위키</a>로 들어가세요.'; -$lang['i_failure'] = '환경 설정 파일에 쓰는 도중에 오류가 발생했습니다. <a href="doku.php?id=wiki:welcome">새 도쿠위키</a>를 사용하기 전에 수동으로 문제를 해결해야 합니다.'; +$lang['i_success'] = '환경 설정이 성공적으로 끝났습니다. 지금 install.php를 지워도 상관없습니다. +<a href="doku.php?id=wiki:welcome">새 도쿠위키</a>로 들어가세요.'; +$lang['i_failure'] = '환경 설정 파일에 쓰는 도중에 오류가 발생했습니다. +<a href="doku.php?id=wiki:welcome">새 도쿠위키</a>를 사용하기 전에 수동으로 문제를 해결해야 합니다.'; $lang['i_policy'] = '초기 ACL 정책'; $lang['i_pol0'] = '열린 위키 (누구나 읽기, 쓰기, 올리기가 가능합니다)'; $lang['i_pol1'] = '공개 위키 (누구나 읽을 수 있지만, 등록된 사용자만 쓰기와 올리기가 가능합니다)'; diff --git a/inc/lang/no/lang.php b/inc/lang/no/lang.php index aeea982f2..ecf10ff5b 100644 --- a/inc/lang/no/lang.php +++ b/inc/lang/no/lang.php @@ -21,6 +21,7 @@ * @author Thomas Juberg <Thomas.Juberg@Gmail.com> * @author Boris <boris@newton-media.no> * @author Christopher Schive <chschive@frisurf.no> + * @author Patrick <spill.p@hotmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -82,7 +83,7 @@ $lang['badpassconfirm'] = 'Beklager, passordet var feil'; $lang['minoredit'] = 'Mindre endringer'; $lang['draftdate'] = 'Kladd autolagret'; $lang['nosecedit'] = 'Siden ble endret i mellomtiden, seksjonsinfo har blitt foreldet - lastet full side istedet.'; -$lang['searchcreatepage'] = "Hvis du ikke finner det du leter etter, så kan du skape en ny side med samme navn som ditt søk ved å klikke på ''**Lag denne siden**''-knappen."; +$lang['searchcreatepage'] = 'Hvis du ikke finner det du leter etter, så kan du skape en ny side med samme navn som ditt søk ved å klikke på \'\'**Lag denne siden**\'\'-knappen.'; $lang['regmissing'] = 'Vennligst fyll ut alle felt.'; $lang['reguexists'] = 'Det finnes allerede en konto med dette brukernavnet.'; $lang['regsuccess'] = 'Brukerkonto har blitt laget og passord har blitt sendt via e-post.'; @@ -356,3 +357,4 @@ $lang['currentns'] = 'gjeldende navnemellomrom'; $lang['searchresult'] = 'Søk i resultat'; $lang['plainhtml'] = 'Enkel HTML'; $lang['wikimarkup'] = 'wiki-format'; +$lang['page_nonexist_rev'] = 'Finnes ingen side på %s. Den er derfor laget på <a href="%s">%s</a>'; diff --git a/inc/lang/ru/lang.php b/inc/lang/ru/lang.php index f491fcaa9..ffe513386 100644 --- a/inc/lang/ru/lang.php +++ b/inc/lang/ru/lang.php @@ -27,6 +27,8 @@ * @author Aleksandr Selivanov <alexgearbox@yandex.ru> * @author Владимир <id37736@yandex.ru> * @author Igor Degraf <igordegraf@gmail.com> + * @author Type-kun <workwork-1@yandex.ru> + * @author Vitaly Filatenko <kot@hacktest.net> */ $lang['encoding'] = ' utf-8'; $lang['direction'] = 'ltr'; @@ -197,7 +199,7 @@ $lang['quickhits'] = 'Соответствия в названиях $lang['toc'] = 'Содержание'; $lang['current'] = 'текущий'; $lang['yours'] = 'Ваша версия'; -$lang['diff'] = 'показать отличия от текущей версии'; +$lang['diff'] = 'Показать отличия от текущей версии'; $lang['diff2'] = 'Показать различия между ревизиями '; $lang['difflink'] = 'Ссылка на это сравнение'; $lang['diff_type'] = 'Посмотреть отличия'; @@ -206,6 +208,8 @@ $lang['diff_side'] = 'бок о бок'; $lang['diffprevrev'] = 'Предыдущая версия'; $lang['diffnextrev'] = 'Следующая версия'; $lang['difflastrev'] = 'Последняя версия'; +$lang['diffbothprevrev'] = 'Предыдущая версия справа и слева'; +$lang['diffbothnextrev'] = 'Следующая версия справа и слева'; $lang['line'] = 'Строка'; $lang['breadcrumb'] = 'Вы посетили:'; $lang['youarehere'] = 'Вы находитесь здесь:'; @@ -213,7 +217,7 @@ $lang['lastmod'] = 'Последние изменения:'; $lang['by'] = ' —'; $lang['deleted'] = 'удалено'; $lang['created'] = 'создано'; -$lang['restored'] = 'старая ревизия восстановлена (%s)'; +$lang['restored'] = 'старая версия восстановлена (%s)'; $lang['external_edit'] = 'внешнее изменение'; $lang['summary'] = 'Сводка изменений'; $lang['noflash'] = 'Для просмотра этого содержимого требуется <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a>.'; @@ -303,6 +307,7 @@ $lang['i_modified'] = 'Из соображений безопасно <a href="http://www.dokuwiki.org/install">инструкции по установке «Докувики»</a>'; $lang['i_funcna'] = 'Функция PHP <code>%s</code> недоступна. Может быть, она по какой-то причине заблокирована вашим хостером?'; $lang['i_phpver'] = 'Ваша версия PHP (<code>%s</code>) ниже требуемой (<code>%s</code>). Вам необходимо обновить установленную версию PHP.'; +$lang['i_mbfuncoverload'] = 'Для запуска "Докувики" необходимо отключить параметр mbstring.func_overload в php.ini'; $lang['i_permfail'] = '<code>%s</code> недоступна для записи «Докувики». Вам необходимо исправить системные права доступа для этой директории!'; $lang['i_confexists'] = '<code>%s</code> уже существует'; $lang['i_writeerr'] = 'Не удалось создать <code>%s</code>. Вам необходимо проверить системные права доступа к файлу и директориям, и создать файл вручную. '; @@ -358,3 +363,5 @@ $lang['currentns'] = 'Текущее пространство имё $lang['searchresult'] = 'Результаты поиска'; $lang['plainhtml'] = 'Простой HTML'; $lang['wikimarkup'] = 'вики-разметка'; +$lang['page_nonexist_rev'] = 'Эта страница ещё не существовала %s. Она была создана <a href="%s">%s</a>.'; +$lang['unable_to_parse_date'] = 'Невозможно обработать параметр "%s".'; diff --git a/inc/media.php b/inc/media.php index 5190862d7..09bfc99ac 100644 --- a/inc/media.php +++ b/inc/media.php @@ -16,6 +16,9 @@ if(!defined('NL')) define('NL',"\n"); * their CSS tags except pagenames won't be links. * * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> + * + * @param array $data + * @param string $id */ function media_filesinuse($data,$id){ global $lang; @@ -41,6 +44,11 @@ function media_filesinuse($data,$id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $id media id + * @param int $auth permission level + * @param array $data + * @return false|string */ function media_metasave($id,$auth,$data){ if($auth < AUTH_UPLOAD) return false; @@ -86,6 +94,7 @@ function media_metasave($id,$auth,$data){ * check if a media is external source * * @author Gerrit Uitslag <klapinklapin@gmail.com> + * * @param string $id the media ID or URL * @return bool */ @@ -98,6 +107,7 @@ function media_isexternal($id){ * Check if a media item is public (eg, external URL or readable by @ALL) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id the media ID or URL * @return bool */ @@ -113,6 +123,10 @@ function media_ispublic($id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $id media id + * @param int $auth permission level + * @return bool */ function media_metaform($id,$auth){ global $lang; @@ -175,6 +189,9 @@ function media_metaform($id,$auth){ * Convenience function to check if a media file is still in use * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id media id + * @return array|bool */ function media_inuse($id) { global $conf; @@ -202,6 +219,7 @@ define('DOKU_MEDIA_EMPTY_NS', 8); * If configured, checks for media references before deletion * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id media id * @param int $auth no longer used * @return int One of: 0, @@ -219,6 +237,7 @@ function media_delete($id,$auth){ $file = mediaFN($id); // trigger an event - MEDIA_DELETE_FILE + $data = array(); $data['id'] = $id; $data['name'] = utf8_basename($file); $data['path'] = $file; @@ -253,9 +272,9 @@ function media_delete($id,$auth){ /** * Handle file uploads via XMLHttpRequest * - * @param string $ns target namespace - * @param int $auth current auth check result - * @return mixed false on error, id of the new file on success + * @param string $ns target namespace + * @param int $auth current auth check result + * @return false|string false on error, id of the new file on success */ function media_upload_xhr($ns,$auth){ if(!checkSecurityToken()) return false; @@ -298,10 +317,11 @@ function media_upload_xhr($ns,$auth){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> - * @param string $ns target namespace - * @param int $auth current auth check result - * @param bool|array $file $_FILES member, $_FILES['upload'] if false - * @return mixed false on error, id of the new file on success + * + * @param string $ns target namespace + * @param int $auth current auth check result + * @param bool|array $file $_FILES member, $_FILES['upload'] if false + * @return false|string false on error, id of the new file on success */ function media_upload($ns,$auth,$file=false){ if(!checkSecurityToken()) return false; @@ -345,6 +365,7 @@ function media_upload($ns,$auth,$file=false){ * Using copy, makes sure any setgid bits on the media directory are honored * * @see move_uploaded_file() + * * @param string $from * @param string $to * @return bool @@ -362,13 +383,21 @@ function copy_uploaded_file($from, $to){ * (The triggered event is preventable.) * * Event data: - * $data[0] fn_tmp: the temporary file name (read from $_FILES) - * $data[1] fn: the file name of the uploaded file - * $data[2] id: the future directory id of the uploaded file - * $data[3] imime: the mimetype of the uploaded file + * $data[0] fn_tmp: the temporary file name (read from $_FILES) + * $data[1] fn: the file name of the uploaded file + * $data[2] id: the future directory id of the uploaded file + * $data[3] imime: the mimetype of the uploaded file * $data[4] overwrite: if an existing file is going to be overwritten + * $data[5] move: name of function that performs move/copy/.. * * @triggers MEDIA_UPLOAD_FINISH + * + * @param array $file + * @param string $id media id + * @param bool $ow overwrite? + * @param int $auth permission level + * @param string $move name of functions that performs move/copy/.. + * @return false|array|string */ function media_save($file, $id, $ow, $auth, $move) { if($auth < AUTH_UPLOAD) { @@ -418,6 +447,7 @@ function media_save($file, $id, $ow, $auth, $move) { } // prepare event data + $data = array(); $data[0] = $file['name']; $data[1] = $fn; $data[2] = $id; @@ -430,8 +460,12 @@ function media_save($file, $id, $ow, $auth, $move) { } /** - * Callback adapter for media_upload_finish() + * Callback adapter for media_upload_finish() triggered by MEDIA_UPLOAD_FINISH + * * @author Michael Klier <chi@chimeric.de> + * + * @param array $data event data + * @return false|array|string */ function _media_upload_action($data) { // fixme do further sanity tests of given data? @@ -448,6 +482,14 @@ function _media_upload_action($data) { * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Klier <chi@chimeric.de> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $fn_tmp + * @param string $fn + * @param string $id media id + * @param string $imime mime type + * @param bool $overwrite overwrite existing? + * @param string $move function name + * @return array|string */ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'move_uploaded_file') { global $conf; @@ -491,6 +533,7 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov * directory * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param string $id * @return int - revision date */ @@ -534,6 +577,10 @@ function media_saveOldRevision($id){ * @author Andreas Gohr <andi@splitbrain.org> * @link http://www.splitbrain.org/blog/2007-02/12-internet_explorer_facilitates_cross_site_scripting * @fixme check all 26 magic IE filetypes here? + * + * @param string $file path to file + * @param string $mime mimetype + * @return int */ function media_contentcheck($file,$mime){ global $conf; @@ -543,14 +590,14 @@ function media_contentcheck($file,$mime){ $bytes = fread($fh, 256); fclose($fh); if(preg_match('/<(script|a|img|html|body|iframe)[\s>]/i',$bytes)){ - return -3; + return -3; //XSS: possibly malicious content } } } if(substr($mime,0,6) == 'image/'){ $info = @getimagesize($file); if($mime == 'image/gif' && $info[2] != 1){ - return -1; + return -1; // uploaded content did not match the file extension }elseif($mime == 'image/jpeg' && $info[2] != 2){ return -1; }elseif($mime == 'image/png' && $info[2] != 3){ @@ -561,7 +608,7 @@ function media_contentcheck($file,$mime){ global $TEXT; $TEXT = io_readFile($file); if(checkwordblock()){ - return -2; + return -2; //blocked by the spam blacklist } } return 0; @@ -571,6 +618,12 @@ function media_contentcheck($file,$mime){ * Send a notify mail on uploads * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id media id + * @param string $file path to file + * @param string $mime mime type + * @param bool|int $old_rev revision timestamp or false + * @return bool */ function media_notify($id,$file,$mime,$old_rev=false){ global $conf; @@ -583,11 +636,11 @@ function media_notify($id,$file,$mime,$old_rev=false){ /** * List all files in a given Media namespace * - * @param string $ns namespace - * @param null|int $auth permission level - * @param string $jump - * @param bool $fullscreenview - * @param bool|string $sort sorting, false skips sorting + * @param string $ns namespace + * @param null|int $auth permission level + * @param string $jump id + * @param bool $fullscreenview + * @param bool|string $sort sorting order, false skips sorting */ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=false){ global $conf; @@ -730,6 +783,7 @@ function media_tab_files_options(){ * Returns type of sorting for the list of files in media manager * * @author Kate Arzamastseva <pshns@ukr.net> + * * @return string - sort type */ function _media_get_sort_type() { @@ -740,6 +794,7 @@ function _media_get_sort_type() { * Returns type of listing for the list of files in media manager * * @author Kate Arzamastseva <pshns@ukr.net> + * * @return string - list type */ function _media_get_list_type() { @@ -771,6 +826,10 @@ function _media_get_display_param($param, $values) { * Prints tab that displays a list of all files * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level + * @param string $jump item id */ function media_tab_files($ns,$auth=null,$jump='') { global $lang; @@ -787,6 +846,10 @@ function media_tab_files($ns,$auth=null,$jump='') { * Prints tab that displays uploading form * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level + * @param string $jump item id */ function media_tab_upload($ns,$auth=null,$jump='') { global $lang; @@ -804,6 +867,9 @@ function media_tab_upload($ns,$auth=null,$jump='') { * Prints tab that displays search form * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param null|int $auth permission level */ function media_tab_search($ns,$auth=null) { global $INPUT; @@ -823,8 +889,13 @@ function media_tab_search($ns,$auth=null) { * Prints tab that displays mediafile details * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level + * @param string|int $rev revision timestamp or empty string */ -function media_tab_view($image, $ns, $auth=null, $rev=false) { +function media_tab_view($image, $ns, $auth=null, $rev='') { global $lang; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); @@ -843,6 +914,10 @@ function media_tab_view($image, $ns, $auth=null, $rev=false) { * Prints tab that displays form for editing mediafile metadata * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level */ function media_tab_edit($image, $ns, $auth=null) { if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); @@ -857,6 +932,10 @@ function media_tab_edit($image, $ns, $auth=null) { * Prints tab that displays mediafile revisions * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param string $ns + * @param null|int $auth permission level */ function media_tab_history($image, $ns, $auth=null) { global $lang; @@ -880,13 +959,14 @@ function media_tab_history($image, $ns, $auth=null) { /** * Prints mediafile details * - * @param string $image media id - * @param $auth - * @param int|bool $rev - * @param JpegMeta|bool $meta + * @param string $image media id + * @param int $auth permission level + * @param int|string $rev revision timestamp or empty string + * @param JpegMeta|bool $meta + * * @author Kate Arzamastseva <pshns@ukr.net> */ -function media_preview($image, $auth, $rev=false, $meta=false) { +function media_preview($image, $auth, $rev='', $meta=false) { $size = media_image_preview_size($image, $rev, $meta); @@ -918,8 +998,12 @@ function media_preview($image, $auth, $rev=false, $meta=false) { * Prints mediafile action buttons * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image media id + * @param int $auth permission level + * @param string|int $rev revision timestamp, or empty string */ -function media_preview_buttons($image, $auth, $rev=false) { +function media_preview_buttons($image, $auth, $rev='') { global $lang, $conf; echo '<ul class="actions">'.NL; @@ -967,11 +1051,11 @@ function media_preview_buttons($image, $auth, $rev=false) { * Returns image width and height for mediamanager preview panel * * @author Kate Arzamastseva <pshns@ukr.net> - * @param string $image - * @param int $rev - * @param JpegMeta $meta - * @param int $size - * @return array + * @param string $image + * @param int|string $rev + * @param JpegMeta|bool $meta + * @param int $size + * @return array|false */ function media_image_preview_size($image, $rev, $meta, $size = 500) { if (!preg_match("/\.(jpe?g|gif|png)$/", $image) || !file_exists(mediaFN($image, $rev))) return false; @@ -992,9 +1076,10 @@ function media_image_preview_size($image, $rev, $meta, $size = 500) { * Returns the requested EXIF/IPTC tag from the image meta * * @author Kate Arzamastseva <pshns@ukr.net> - * @param array $tags + * + * @param array $tags array with tags, first existing is returned * @param JpegMeta $meta - * @param string $alt + * @param string $alt alternative value * @return string */ function media_getTag($tags,$meta,$alt=''){ @@ -1008,8 +1093,9 @@ function media_getTag($tags,$meta,$alt=''){ * Returns mediafile tags * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param JpegMeta $meta - * @return array + * @return array list of tags of the mediafile */ function media_file_tags($meta) { // load the field descriptions @@ -1038,8 +1124,13 @@ function media_file_tags($meta) { * Prints mediafile tags * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image image id + * @param int $auth permission level + * @param string|int $rev revision timestamp, or empty string + * @param bool|JpegMeta $meta image object, or create one if false */ -function media_details($image, $auth, $rev=false, $meta=false) { +function media_details($image, $auth, $rev='', $meta=false) { global $lang; if (!$meta) $meta = new JpegMeta(mediaFN($image, $rev)); @@ -1062,6 +1153,12 @@ function media_details($image, $auth, $rev=false, $meta=false) { * Shows difference between two revisions of file * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image image id + * @param string $ns + * @param int $auth permission level + * @param bool $fromajax + * @return false|null|string */ function media_diff($image, $ns, $auth, $fromajax = false) { global $conf; @@ -1111,6 +1208,7 @@ function media_diff($image, $ns, $auth, $fromajax = false) { } // prepare event data + $data = array(); $data[0] = $image; $data[1] = $l_rev; $data[2] = $r_rev; @@ -1120,14 +1218,13 @@ function media_diff($image, $ns, $auth, $fromajax = false) { // trigger event return trigger_event('MEDIA_DIFF', $data, '_media_file_diff', true); - } /** * Callback for media file diff * - * @param $data - * @return bool|void + * @param array $data event data + * @return false|null */ function _media_file_diff($data) { if(is_array($data) && count($data)===6) { @@ -1141,6 +1238,13 @@ function _media_file_diff($data) { * Shows difference between two revisions of image * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $image + * @param string|int $l_rev revision timestamp, or empty string + * @param string|int $r_rev revision timestamp, or empty string + * @param string $ns + * @param int $auth permission level + * @param bool $fromajax */ function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax){ global $lang; @@ -1261,11 +1365,12 @@ function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax){ * and slider * * @author Kate Arzamastseva <pshns@ukr.net> - * @param string $image - * @param int $l_rev - * @param int $r_rev - * @param array $l_size - * @param array $r_size + * + * @param string $image image id + * @param int $l_rev revision timestamp, or empty string + * @param int $r_rev revision timestamp, or empty string + * @param array $l_size array with width and height + * @param array $r_size array with width and height * @param string $type */ function media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $type) { @@ -1298,10 +1403,11 @@ function media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $type) { /** * Restores an old revision of a media file * - * @param string $image - * @param int $rev - * @param int $auth + * @param string $image media id + * @param int $rev revision timestamp or empty string + * @param int $auth * @return string - file's id + * * @author Kate Arzamastseva <pshns@ukr.net> */ function media_restore($image, $rev, $auth){ @@ -1331,19 +1437,24 @@ function media_restore($image, $rev, $auth){ * @author Andreas Gohr <gohr@cosmocode.de> * @author Kate Arzamastseva <pshns@ukr.net> * @triggers MEDIA_SEARCH + * + * @param string $query + * @param string $ns + * @param null|int $auth + * @param bool $fullscreen + * @param string $sort */ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural'){ global $conf; global $lang; $ns = cleanID($ns); - + $evdata = array( + 'ns' => $ns, + 'data' => array(), + 'query' => $query + ); if ($query) { - $evdata = array( - 'ns' => $ns, - 'data' => array(), - 'query' => $query - ); $evt = new Doku_Event('MEDIA_SEARCH', $evdata); if ($evt->advise_before()) { $dir = utf8_encodeFN(str_replace(':','/',$evdata['ns'])); @@ -1381,10 +1492,14 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural /** * Formats and prints one file in the list + * + * @param array $item + * @param int $auth permission level + * @param string $jump item id + * @param bool $display_namespace */ function media_printfile($item,$auth,$jump,$display_namespace=false){ global $lang; - global $conf; // Prepare zebra coloring // I always wanted to use this variable name :-D @@ -1458,9 +1573,9 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){ /** * Display a media icon * - * @param $filename - * @param string $size the size subfolder, if not specified 16x16 is used - * @return string + * @param string $filename media id + * @param string $size the size subfolder, if not specified 16x16 is used + * @return string html */ function media_printicon($filename, $size=''){ list($ext) = mimetype(mediaFN($filename),false); @@ -1478,6 +1593,11 @@ function media_printicon($filename, $size=''){ * Formats and prints one file in the list in the thumbnails view * * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param array $item + * @param int $auth permission level + * @param bool|string $jump item id + * @param bool $display_namespace */ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false){ @@ -1525,6 +1645,9 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false /** * Prints a thumbnail and metainfo + * + * @param array $item + * @param bool $fullscreen */ function media_printimgdetail($item, $fullscreen=false){ // prepare thumbnail @@ -1588,15 +1711,15 @@ function media_printimgdetail($item, $fullscreen=false){ } /** - * Build link based on the current, adding/rewriting - * parameters + * Build link based on the current, adding/rewriting parameters * * @author Kate Arzamastseva <pshns@ukr.net> + * * @param array|bool $params - * @param string $amp - separator - * @param bool $abs - * @param bool $params_array - * @return string|array - link + * @param string $amp separator + * @param bool $abs absolute url? + * @param bool $params_array return the parmeters array? + * @return string|array - link or link parameters */ function media_managerURL($params=false, $amp='&', $abs=false, $params_array=false) { global $ID; @@ -1627,6 +1750,10 @@ function media_managerURL($params=false, $amp='&', $abs=false, $params_array * * @author Andreas Gohr <andi@splitbrain.org> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param int $auth permission level + * @param bool $fullscreen */ function media_uploadform($ns, $auth, $fullscreen = false){ global $lang; @@ -1714,6 +1841,10 @@ function media_getuploadsize(){ * * @author Tobias Sarnowski <sarnowski@cosmocode.de> * @author Kate Arzamastseva <pshns@ukr.net> + * + * @param string $ns + * @param string $query + * @param bool $fullscreen */ function media_searchform($ns,$query='',$fullscreen=false){ global $lang; @@ -1741,6 +1872,8 @@ function media_searchform($ns,$query='',$fullscreen=false){ * Build a tree outline of available media namespaces * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ns */ function media_nstree($ns){ global $conf; @@ -1789,6 +1922,9 @@ function media_nstree($ns){ * Prints a media namespace tree item * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function media_nstree_item($item){ global $INPUT; @@ -1812,6 +1948,9 @@ function media_nstree_item($item){ * Prints a media namespace tree item opener * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $item + * @return string html */ function media_nstree_li($item){ $class='media level'.$item['level']; @@ -1833,6 +1972,12 @@ function media_nstree_li($item){ * Resizes the given image to the given size * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param string $ext extension + * @param int $w desired width + * @param int $h desired height + * @return string path to resized or original size if failed */ function media_resize_image($file, $ext, $w, $h=0){ global $conf; @@ -1853,9 +1998,10 @@ function media_resize_image($file, $ext, $w, $h=0){ $local = getCacheName($file,'.media.'.$w.'x'.$h.'.'.$ext); $mtime = @filemtime($local); // 0 if not exists - if( $mtime > filemtime($file) || - media_resize_imageIM($ext,$file,$info[0],$info[1],$local,$w,$h) || - media_resize_imageGD($ext,$file,$info[0],$info[1],$local,$w,$h) ){ + if($mtime > filemtime($file) || + media_resize_imageIM($ext, $file, $info[0], $info[1], $local, $w, $h) || + media_resize_imageGD($ext, $file, $info[0], $info[1], $local, $w, $h) + ) { if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return $local; } @@ -1871,6 +2017,12 @@ function media_resize_image($file, $ext, $w, $h=0){ * image because most pics are more interesting in that area (rule of thirds) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param string $ext extension + * @param int $w desired width + * @param int $h desired height + * @return string path to resized or original size if failed */ function media_crop_image($file, $ext, $w, $h=0){ global $conf; @@ -1935,7 +2087,7 @@ function media_crop_image($file, $ext, $w, $h=0){ * @param string $id id of the image * @param int $w resize/crop width * @param int $h resize/crop height - * @return string + * @return string token or empty string if no token required */ function media_get_token($id,$w,$h){ // token is only required for modified images @@ -1958,6 +2110,11 @@ function media_get_token($id,$w,$h){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Pavel Vitis <Pavel.Vitis@seznam.cz> + * + * @param string $url + * @param string $ext extension + * @param int $cache cachetime in seconds + * @return false|string path to cached file */ function media_get_from_URL($url,$ext,$cache){ global $conf; @@ -1970,12 +2127,12 @@ function media_get_from_URL($url,$ext,$cache){ $mtime = @filemtime($local); // 0 if not exists //decide if download needed: - if( ($mtime == 0) || // cache does not exist - ($cache != -1 && $mtime < time()-$cache) // 'recache' and cache has expired - ){ - if(media_image_download($url,$local)){ + if(($mtime == 0) || // cache does not exist + ($cache != -1 && $mtime < time() - $cache) // 'recache' and cache has expired + ) { + if(media_image_download($url, $local)) { return $local; - }else{ + } else { return false; } } @@ -1991,6 +2148,10 @@ function media_get_from_URL($url,$ext,$cache){ * Download image files * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $url + * @param string $file path to file in which to put the downloaded content + * @return bool */ function media_image_download($url,$file){ global $conf; @@ -2026,6 +2187,15 @@ function media_image_download($url,$file){ * * @author Pavel Vitis <Pavel.Vitis@seznam.cz> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @return bool */ function media_resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ global $conf; @@ -2050,6 +2220,17 @@ function media_resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ * crop images using external ImageMagick convert program * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @param int $ofs_x offset of crop centre + * @param int $ofs_y offset of crop centre + * @return bool */ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$ofs_y){ global $conf; @@ -2075,6 +2256,17 @@ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$o * * @author Andreas Gohr <andi@splitbrain.org> * @author Sebastian Wienecke <s_wienecke@web.de> + * + * @param string $ext extension + * @param string $from filename path to file + * @param int $from_w original width + * @param int $from_h original height + * @param string $to path to resized file + * @param int $to_w desired width + * @param int $to_h desired height + * @param int $ofs_x offset of crop centre + * @param int $ofs_y offset of crop centre + * @return bool */ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x=0,$ofs_y=0){ global $conf; @@ -2087,6 +2279,7 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= } // create an image of the given filetype + $image = false; if ($ext == 'jpg' || $ext == 'jpeg'){ if(!function_exists("imagecreatefromjpeg")) return false; $image = @imagecreatefromjpeg($from); @@ -2100,6 +2293,7 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= } if(!$image) return false; + $newimg = false; if(($conf['gdlib']>1) && function_exists("imagecreatetruecolor") && $ext != 'gif'){ $newimg = @imagecreatetruecolor ($to_w, $to_h); } @@ -2175,23 +2369,23 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= * Return other media files with the same base name * but different extensions. * - * @param string $src - ID of media file - * @param array $exts - alternative extensions to find other files for - * @return array - mime type => file ID + * @param string $src - ID of media file + * @param string[] $exts - alternative extensions to find other files for + * @return array - array(mime type => file ID) * * @author Anika Henke <anika@selfthinker.org> */ function media_alternativefiles($src, $exts){ $files = array(); - list($srcExt, $srcMime) = mimetype($src); + list($srcExt, /* $srcMime */) = mimetype($src); $filebase = substr($src, 0, -1 * (strlen($srcExt)+1)); foreach($exts as $ext) { $fileid = $filebase.'.'.$ext; $file = mediaFN($fileid); if(file_exists($file)) { - list($fileExt, $fileMime) = mimetype($file); + list(/* $fileExt */, $fileMime) = mimetype($file); $files[$fileMime] = $fileid; } } @@ -2202,7 +2396,7 @@ function media_alternativefiles($src, $exts){ * Check if video/audio is supported to be embedded. * * @param string $mime - mimetype of media file - * @param string $type - type of media files to check ('video', 'audio', or none) + * @param string $type - type of media files to check ('video', 'audio', or null for all) * @return boolean * * @author Anika Henke <anika@selfthinker.org> diff --git a/inc/pageutils.php b/inc/pageutils.php index 49c00d36f..2fbcbfd1f 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -20,7 +20,7 @@ * * @param string $param the $_REQUEST variable name, default 'id' * @param bool $clean if true, ID is cleaned - * @return mixed|string + * @return string */ function getID($param='id',$clean=true){ /** @var Input $INPUT */ @@ -97,6 +97,7 @@ function getID($param='id',$clean=true){ * converted to unaccented ones * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII * @return string cleaned id @@ -152,7 +153,7 @@ function cleanID($raw_id,$ascii=false){ * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id - * @return string|bool the namespace part or false if the given ID has no namespace (root) + * @return string|false the namespace part or false if the given ID has no namespace (root) */ function getNS($id){ $pos = strrpos((string)$id,':'); @@ -271,7 +272,7 @@ function page_exists($id,$rev='',$clean=true, $date_at=false) { * The filename is URL encoded to protect Unicode chars * * @param $raw_id string id of wikipage - * @param $rev string page revision, empty string for current + * @param $rev int|string page revision, empty string for current * @param $clean bool flag indicating that $raw_id should be cleaned. Only set to false * when $id is guaranteed to have been cleaned already. * @return string full path @@ -441,7 +442,7 @@ function localeFN($id,$ext='txt'){ * @param string $ns namespace which is context of id * @param string $id relative id * @param bool $clean flag indicating that id should be cleaned - * @return mixed|string + * @return string */ function resolve_id($ns,$id,$clean=true){ global $conf; @@ -738,6 +739,7 @@ function utf8_decodeFN($file){ * Used for sidebars, but can be used other stuff as well * * @todo add event hook + * * @param string $page the pagename you're looking for * @return string|false the full page id of the found page, false if any */ diff --git a/inc/parser/handler.php b/inc/parser/handler.php index a1040d12e..d96a01a60 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -71,6 +71,7 @@ class Doku_Handler { */ function plugin($match, $state, $pos, $pluginname){ $data = array($match); + /** @var DokuWiki_Syntax_Plugin $plugin */ $plugin = plugin_load('syntax',$pluginname); if($plugin != null){ $data = $plugin->handle($match, $state, $pos, $this); @@ -711,6 +712,9 @@ class Doku_Handler_CallWriter { var $Handler; + /** + * @param Doku_Handler $Handler + */ function Doku_Handler_CallWriter(& $Handler) { $this->Handler = & $Handler; } @@ -747,7 +751,7 @@ class Doku_Handler_Nest { /** * constructor * - * @param object $CallWriter the renderers current call writer + * @param Doku_Handler_CallWriter $CallWriter the renderers current call writer * @param string $close closing instruction name, this is required to properly terminate the * syntax mode if the document ends without a closing pattern */ @@ -805,6 +809,8 @@ class Doku_Handler_List { var $listCalls = array(); var $listStack = array(); + const NODE = 1; + function Doku_Handler_List(& $CallWriter) { $this->CallWriter = & $CallWriter; } @@ -856,7 +862,8 @@ class Doku_Handler_List { $depth = $this->interpretSyntax($call[1][0], $listType); $this->initialDepth = $depth; - $this->listStack[] = array($listType, $depth); + // array(list type, current depth, index of current listitem_open) + $this->listStack[] = array($listType, $depth, 1); $this->listCalls[] = array('list'.$listType.'_open',array(),$call[2]); $this->listCalls[] = array('listitem_open',array(1),$call[2]); @@ -881,6 +888,7 @@ class Doku_Handler_List { function listOpen($call) { $depth = $this->interpretSyntax($call[1][0], $listType); $end = end($this->listStack); + $key = key($this->listStack); // Not allowed to be shallower than initialDepth if ( $depth < $this->initialDepth ) { @@ -897,6 +905,9 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); + // new list item, update list stack's index into current listitem_open + $this->listStack[$key][2] = count($this->listCalls) - 2; + // Switched list type... } else { @@ -908,7 +919,7 @@ class Doku_Handler_List { $this->listCalls[] = array('listcontent_open',array(),$call[2]); array_pop($this->listStack); - $this->listStack[] = array($listType, $depth); + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); } //------------------------------------------------------------------------ @@ -920,7 +931,10 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open', array($depth-1), $call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); - $this->listStack[] = array($listType, $depth); + // set the node/leaf state of this item's parent listitem_open to NODE + $this->listCalls[$this->listStack[$key][2]][1][1] = self::NODE; + + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); //------------------------------------------------------------------------ // Getting shallower ( $depth < $end[1] ) @@ -934,6 +948,7 @@ class Doku_Handler_List { while (1) { $end = end($this->listStack); + $key = key($this->listStack); if ( $end[1] <= $depth ) { @@ -946,6 +961,9 @@ class Doku_Handler_List { $this->listCalls[] = array('listitem_open',array($depth-1),$call[2]); $this->listCalls[] = array('listcontent_open',array(),$call[2]); + // new list item, update list stack's index into current listitem_open + $this->listStack[$key][2] = count($this->listCalls) - 2; + } else { // Switching list type... $this->listCalls[] = array('list'.$end[0].'_close', array(), $call[2]); @@ -954,7 +972,7 @@ class Doku_Handler_List { $this->listCalls[] = array('listcontent_open',array(),$call[2]); array_pop($this->listStack); - $this->listStack[] = array($listType, $depth); + $this->listStack[] = array($listType, $depth, count($this->listCalls) - 2); } break; diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index 2e84eca7c..b46a5f505 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -56,12 +56,12 @@ class Doku_LexerParallelRegex { /** * Adds a pattern with an optional label. * - * @param mixed $pattern Perl style regex. Must be UTF-8 + * @param mixed $pattern Perl style regex. Must be UTF-8 * encoded. If its a string, the (, ) * lose their meaning unless they * form part of a lookahead or * lookbehind assertation. - * @param string $label Label of regex to be returned + * @param bool|string $label Label of regex to be returned * on a match. Label must be ASCII * @access public */ @@ -151,7 +151,8 @@ class Doku_LexerParallelRegex { * "or" operator. Caches the regex. * Will automatically escape (, ) and / tokens. * - * @param array $patterns List of patterns in order. + * @internal array $_patterns List of patterns in order. + * @return null|string * @access private */ function _getCompoundedRegex() { @@ -297,6 +298,7 @@ class Doku_Lexer { */ function Doku_Lexer(&$parser, $start = "accept", $case = false) { $this->_case = $case; + /** @var Doku_LexerParallelRegex[] _regexes */ $this->_regexes = array(); $this->_parser = &$parser; $this->_mode = new Doku_LexerStateStack($start); @@ -425,11 +427,13 @@ class Doku_Lexer { * Sends the matched token and any leading unmatched * text to the parser changing the lexer to a new * mode if one is listed. - * @param string $unmatched Unmatched leading portion. - * @param string $matched Actual token match. - * @param string $mode Mode after match. A boolean + * @param string $unmatched Unmatched leading portion. + * @param string $matched Actual token match. + * @param bool|string $mode Mode after match. A boolean * false mode causes no change. - * @param int $pos Current byte index location in raw doc + * @param int $initialPos + * @param int $matchPos + * Current byte index location in raw doc * thats being parsed * @return boolean False if there was any error * from the parser. @@ -498,11 +502,12 @@ class Doku_Lexer { * Calls the parser method named after the current * mode. Empty content will be ignored. The lexer * has a parser handler for each mode in the lexer. - * @param string $content Text parsed. - * @param boolean $is_match Token is recognised rather + * @param string $content Text parsed. + * @param boolean $is_match Token is recognised rather * than unparsed data. - * @param int $pos Current byte index location in raw doc + * @param int $pos Current byte index location in raw doc * thats being parsed + * @return bool * @access private */ function _invokeParser($content, $is_match, $pos) { diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 25bf3fe3d..ac8fd2130 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -165,7 +165,7 @@ class Doku_Renderer_metadata extends Doku_Renderer { if(!isset($this->meta['title'])) $this->meta['title'] = $text; // add the header to the TOC - $hid = $this->_headerToLink($text, 'true'); + $hid = $this->_headerToLink($text, true); $this->toc_additem($hid, $text, $level); // add to summary @@ -251,8 +251,9 @@ class Doku_Renderer_metadata extends Doku_Renderer { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { + function listitem_open($level,$node=false) { $this->cdata(str_repeat(DOKU_TAB, $level).'* '); } @@ -421,8 +422,8 @@ class Doku_Renderer_metadata extends Doku_Renderer { /** * keep track of internal links in $this->meta['relation']['references'] * - * @param string $id page ID to link to. eg. 'wiki:syntax' - * @param string|array $name name for the link, array for media file + * @param string $id page ID to link to. eg. 'wiki:syntax' + * @param string|array|null $name name for the link, array for media file */ function internallink($id, $name = null) { global $ID; @@ -458,8 +459,8 @@ class Doku_Renderer_metadata extends Doku_Renderer { /** * Render an external link * - * @param string $url full URL with scheme - * @param string|array $name name for the link, array for media file + * @param string $url full URL with scheme + * @param string|array|null $name name for the link, array for media file */ function externallink($url, $name = null) { if(is_array($name)) { @@ -628,9 +629,9 @@ class Doku_Renderer_metadata extends Doku_Renderer { * Construct a title and handle images in titles * * @author Harry Fuecks <hfuecks@gmail.com> - * @param string|array $title either string title or media array - * @param string $default default title if nothing else is found - * @param null|string $id linked page id (used to extract title from first heading) + * @param string|array|null $title either string title or media array + * @param string $default default title if nothing else is found + * @param null|string $id linked page id (used to extract title from first heading) * @return string title text */ function _getLinkTitle($title, $default, $id = null) { diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 09294539e..e1d28267a 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -190,7 +190,7 @@ class Doku_Renderer extends DokuWiki_Plugin { /** * Render plain text data * - * @param $text + * @param string $text */ function cdata($text) { } @@ -343,8 +343,9 @@ class Doku_Renderer extends DokuWiki_Plugin { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { + function listitem_open($level,$node=false) { } /** @@ -759,6 +760,9 @@ class Doku_Renderer extends DokuWiki_Plugin { * casing and special chars * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $name + * @return string */ function _simpleTitle($name) { global $conf; @@ -778,6 +782,11 @@ class Doku_Renderer extends DokuWiki_Plugin { /** * Resolve an interwikilink + * + * @param string $shortcut identifier for the interwiki link + * @param string $reference fragment that refers the content + * @param null|bool $exists reference which returns if an internal page exists + * @return string interwikilink */ function _resolveInterWiki(&$shortcut, $reference, &$exists = null) { //get interwiki URL diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 3a2e49155..f1703111e 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -59,10 +59,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Register a new edit section range * - * @param $type string The section type identifier - * @param $title string The section title - * @param $start int The byte position for the edit start - * @return string A marker class for the starting HTML element + * @param string $type The section type identifier + * @param string $title The section title + * @param int $start The byte position for the edit start + * @return string A marker class for the starting HTML element + * * @author Adrian Lang <lang@cosmocode.de> */ public function startSectionEdit($start, $type, $title = null) { @@ -73,8 +74,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Finish an edit section range * - * @param $end int The byte position for the edit end; null for the rest of - * the page + * @param int $end The byte position for the edit end; null for the rest of the page + * * @author Adrian Lang <lang@cosmocode.de> */ public function finishSectionEdit($end = null) { @@ -456,9 +457,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * Open a list item * * @param int $level the nesting level + * @param bool $node true when a node; false when a leaf */ - function listitem_open($level) { - $this->doc .= '<li class="level'.$level.'">'; + function listitem_open($level, $node=false) { + $branching = $node ? ' node' : ''; + $this->doc .= '<li class="level'.$level.$branching.'">'; } /** @@ -821,6 +824,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // now first resolve and clean up the $id resolve_pageid(getNS($ID), $id, $exists, $this->date_at, true); + $link = array(); $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); if(!$isImage) { if($exists) { @@ -908,6 +912,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //prepare for formating + $link = array(); $link['target'] = $conf['target']['extern']; $link['style'] = ''; $link['pre'] = ''; @@ -985,6 +990,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $conf; //simple setup + $link = array(); $link['target'] = $conf['target']['windows']; $link['pre'] = ''; $link['suf'] = ''; @@ -1576,7 +1582,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * Returns HTML code for images used in link titles * * @author Andreas Gohr <andi@splitbrain.org> - * @param string $img + * @param array $img * @return string HTML img tag or similar */ function _imageTitle($img) { @@ -1661,7 +1667,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // prepare alternative formats $extensions = array('webm', 'ogv', 'mp4'); $files = media_alternativefiles($src, $extensions); - $poster = media_alternativefiles($src, array('jpg', 'png'), true); + $poster = media_alternativefiles($src, array('jpg', 'png')); if(!empty($poster)) { $posterUrl = ml(reset($poster), '', true, '&'); } @@ -1705,7 +1711,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @param array $atts - additional attributes for the <audio> tag * @return string */ - function _audio($src, $atts = null) { + function _audio($src, $atts = array()) { $files = array(); $isExternal = media_isexternal($src); diff --git a/inc/parserutils.php b/inc/parserutils.php index ba073f15d..3ef8138a7 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -55,6 +55,11 @@ define('METADATA_RENDER_UNLIMITED', 4); * wasn't found * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @param string|int $rev revision timestamp or empty string + * @param bool $excuse + * @return null|string */ function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){ $file = wikiFN($id,$rev); @@ -89,6 +94,9 @@ function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){ * Returns the specified local text in parsed format * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @return null|string */ function p_locale_xhtml($id){ //fetch parsed locale @@ -101,6 +109,11 @@ function p_locale_xhtml($id){ * * @author Andreas Gohr <andi@splitbrain.org> * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $file filename, path to file + * @param string $format + * @param string $id page id + * @return null|string */ function p_cached_output($file, $format='xhtml', $id='') { global $conf; @@ -129,6 +142,11 @@ function p_cached_output($file, $format='xhtml', $id='') { * Uses and creates a serialized cache file * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file filename, path to file + * @param bool $cacheonly + * @param string $id page id + * @return array|null */ function p_cached_instructions($file,$cacheonly=false,$id='') { static $run = null; @@ -157,7 +175,8 @@ function p_cached_instructions($file,$cacheonly=false,$id='') { * * @author Harry Fuecks <hfuecks@gmail.com> * @author Andreas Gohr <andi@splitbrain.org> - * @param string $text raw wiki syntax text + * + * @param string $text raw wiki syntax text * @return array a list of instruction arrays */ function p_get_instructions($text){ @@ -185,9 +204,9 @@ function p_get_instructions($text){ /** * returns the metadata of a page * - * @param string $id The id of the page the metadata should be returned from - * @param string $key The key of the metdata value that shall be read (by default everything) - separate hierarchies by " " like "date created" - * @param int $render If the page should be rendererd - possible values: + * @param string $id The id of the page the metadata should be returned from + * @param string $key The key of the metdata value that shall be read (by default everything) - separate hierarchies by " " like "date created" + * @param int $render If the page should be rendererd - possible values: * METADATA_DONT_RENDER, METADATA_RENDER_USING_SIMPLE_CACHE, METADATA_RENDER_USING_CACHE * METADATA_RENDER_UNLIMITED (also combined with the previous two options), * default: METADATA_RENDER_USING_CACHE @@ -360,6 +379,9 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){ * used on page deletion * * @author Michael Klier <chi@chimeric.de> + * + * @param string $id page id + * @return bool success / fail */ function p_purge_metadata($id) { $meta = p_read_metadata($id); @@ -423,6 +445,10 @@ function p_save_metadata($id, $meta) { * renders the metadata of a page * * @author Esther Brunner <esther@kaffeehaus.ch> + * + * @param string $id page id + * @param array $orig the original metadata + * @return array|null array('current'=> array,'persistent'=> array); */ function p_render_metadata($id, $orig){ // make sure the correct ID is in global ID @@ -477,6 +503,8 @@ function p_render_metadata($id, $orig){ * returns all available parser syntax modes in correct order * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return array[] with for each plugin the array('sort' => sortnumber, 'mode' => mode string, 'obj' => plugin object) */ function p_get_parsermodes(){ global $conf; @@ -569,6 +597,10 @@ function p_get_parsermodes(){ * Callback function for usort * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $a + * @param array $b + * @return int $a is lower/equal/higher than $b */ function p_sort_modes($a, $b){ if($a['sort'] == $b['sort']) return 0; @@ -582,9 +614,15 @@ function p_sort_modes($a, $b){ * * @author Harry Fuecks <hfuecks@gmail.com> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $mode + * @param array|null|false $instructions + * @param array $info returns render info like enabled toc and cache + * @return null|string rendered output */ function p_render($mode,$instructions,&$info,$date_at=''){ if(is_null($instructions)) return ''; + if($instructions === false) return ''; $Renderer = p_get_renderer($mode); if (is_null($Renderer)) return null; @@ -621,7 +659,7 @@ function p_render($mode,$instructions,&$info,$date_at=''){ * Figure out the correct renderer class to use for $mode, * instantiate and return it * - * @param $mode string Mode of the renderer to get + * @param string $mode Mode of the renderer to get * @return null|Doku_Renderer The renderer * * @author Christopher Smith <chris@jalakai.co.uk> @@ -678,8 +716,8 @@ function p_get_renderer($mode) { * METADATA_RENDER_USING_SIMPLE_CACHE, * METADATA_RENDER_USING_CACHE, * METADATA_RENDER_UNLIMITED - * * @return string|null The first heading + * * @author Andreas Gohr <andi@splitbrain.org> * @author Michael Hamann <michael@content-space.de> */ @@ -693,8 +731,8 @@ function p_get_first_heading($id, $render=METADATA_RENDER_USING_SIMPLE_CACHE){ * @param string $code source code to be highlighted * @param string $language language to provide highlighting * @param string $wrapper html element to wrap the returned highlighted text - * * @return string xhtml code + * * @author Christopher Smith <chris@jalakai.co.uk> * @author Andreas Gohr <andi@splitbrain.org> */ diff --git a/inc/plugin.php b/inc/plugin.php index 80689e389..9d9b2044c 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -48,14 +48,25 @@ class DokuWiki_Plugin { // plugin introspection methods // extract from class name, format = <plugin type>_plugin_<name>[_<component name>] + /** + * @return string plugin type + */ public function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; } + + /** + * @return string plugin name + */ public function getPluginName() { list(/* $t */, /* $p */, $n) = explode('_', get_class($this), 4); return $n; } + + /** + * @return string component name + */ public function getPluginComponent() { list(/* $t */, /* $p */, /* $n */, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); @@ -91,9 +102,11 @@ class DokuWiki_Plugin { } /** - * localFN($id) - * prepends appropriate path for a language dependent filename + * Prepends appropriate path for a language dependent filename * plugin equivalent of localFN() + * + * @param string $id id of localization file + * @return string wiki text */ public function localFN($id) { global $conf; @@ -110,9 +123,8 @@ class DokuWiki_Plugin { } /** - * setupLocale() - * reads all the plugins language dependent strings into $this->lang - * this function is automatically called by getLang() + * Reads all the plugins language dependent strings into $this->lang + * this function is automatically called by getLang() */ function setupLocale() { if($this->localised) return; @@ -209,8 +221,7 @@ class DokuWiki_Plugin { * * @param string $name name of plugin to load * @param bool $msg if a message should be displayed in case the plugin is not available - * - * @return object helper plugin object + * @return DokuWiki_Plugin|null helper plugin object */ public function loadHelper($name, $msg = true){ $obj = plugin_load('helper',$name); @@ -224,6 +235,12 @@ class DokuWiki_Plugin { /** * email * standardised function to generate an email link according to obfuscation settings + * + * @param string $email + * @param string $name + * @param string $class + * @param string $more + * @return string html */ public function email($email, $name='', $class='', $more='') { if (!$email) return $name; @@ -236,6 +253,13 @@ class DokuWiki_Plugin { /** * external_link * standardised function to generate an external link according to conf settings + * + * @param string $link + * @param string $title + * @param string $class + * @param string $target + * @param string $more + * @return string */ public function external_link($link, $title='', $class='', $target='', $more='') { global $conf; @@ -260,8 +284,9 @@ class DokuWiki_Plugin { * Instead use render_text() * * @deprecated 2014-01-22 - * @param $name - * @param $arguments + * + * @param string $name + * @param array $arguments * @return null|string */ public function __call($name, $arguments) { @@ -278,7 +303,7 @@ class DokuWiki_Plugin { * output text string through the parser, allows dokuwiki markup to be used * very ineffecient for small pieces of data - try not to use * - * @param string $text wiki markup to parse + * @param string $text wiki markup to parse * @param string $format output format * @return null|string */ diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 4f0cd58e6..dfd4d0a29 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -66,14 +66,14 @@ class Doku_Plugin_Controller { * @param $name string name of the plugin to load * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance * @param $disabled bool true to load even disabled plugins - * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null the plugin object or null on failure + * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|DokuWiki_Auth_Plugin|DokuWiki_Admin_Plugin|DokuWiki_Action_Plugin|DokuWiki_Remote_Plugin|null the plugin object or null on failure */ public function load($type,$name,$new=false,$disabled=false){ //we keep all loaded plugins available in global scope for reuse global $DOKU_PLUGINS; - list($plugin,$component) = $this->_splitName($name); + list($plugin, /* $component */) = $this->_splitName($name); // check if disabled if(!$disabled && $this->isdisabled($plugin)){ @@ -114,7 +114,7 @@ class Doku_Plugin_Controller { * Whether plugin is disabled * * @param string $plugin name of plugin - * @return bool; true disabled, false enabled + * @return bool true disabled, false enabled */ public function isdisabled($plugin) { return empty($this->tmp_plugins[$plugin]); @@ -124,7 +124,7 @@ class Doku_Plugin_Controller { * Disable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ public function disable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; @@ -136,7 +136,7 @@ class Doku_Plugin_Controller { * Enable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ public function enable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; @@ -229,7 +229,7 @@ class Doku_Plugin_Controller { * @param bool $forceSave; * false to save only when config changed * true to always save - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ protected function saveList($forceSave = false) { global $conf; @@ -302,12 +302,9 @@ class Doku_Plugin_Controller { /** * Returns a list of available plugin components of given type * - * @param string $type, plugin_type name; - * the type of plugin to return, - * @param bool $enabled; - * true to return enabled plugins, - * false to return disabled plugins - * + * @param string $type plugin_type name; the type of plugin to return, + * @param bool $enabled true to return enabled plugins, + * false to return disabled plugins * @return array of plugin components of requested type */ protected function _getListByType($type, $enabled) { diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 911c4e5c0..4d591869d 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -49,7 +49,7 @@ function plugin_load($type,$name,$new=false,$disabled=false) { * Whether plugin is disabled * * @param string $plugin name of plugin - * @return bool; true disabled, false enabled + * @return bool true disabled, false enabled */ function plugin_isdisabled($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ @@ -61,7 +61,7 @@ function plugin_isdisabled($plugin) { * Enable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ function plugin_enable($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ @@ -73,7 +73,7 @@ function plugin_enable($plugin) { * Disable the plugin * * @param string $plugin name of plugin - * @return bool; true saving succeed, false saving failed + * @return bool true saving succeed, false saving failed */ function plugin_disable($plugin) { /** @var $plugin_controller Doku_Plugin_Controller */ diff --git a/inc/remote.php b/inc/remote.php index e27aa74f8..861353a19 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -60,6 +60,9 @@ class RemoteAPI { private $dateTransformation; private $fileTransformation; + /** + * constructor + */ public function __construct() { $this->dateTransformation = array($this, 'dummyTransformation'); $this->fileTransformation = array($this, 'dummyTransformation'); @@ -75,7 +78,7 @@ class RemoteAPI { } /** - * call a method via remote api. + * Call a method via remote api. * * @param string $method name of the method to call. * @param array $args arguments to pass to the given method @@ -85,7 +88,7 @@ class RemoteAPI { if ($args === null) { $args = array(); } - list($type, $pluginName, $call) = explode('.', $method, 3); + list($type, $pluginName, /* $call */) = explode('.', $method, 3); if ($type === 'plugin') { return $this->callPlugin($pluginName, $method, $args); } @@ -95,11 +98,25 @@ class RemoteAPI { return $this->callCustomCallPlugin($method, $args); } + /** + * Check existance of core methods + * + * @param string $name name of the method + * @return bool if method exists + */ private function coreMethodExist($name) { $coreMethods = $this->getCoreMethods(); return array_key_exists($name, $coreMethods); } + /** + * Try to call custom methods provided by plugins + * + * @param string $method name of method + * @param array $args + * @return mixed + * @throws RemoteException if method not exists + */ private function callCustomCallPlugin($method, $args) { $customCalls = $this->getCustomCallPlugins(); if (!array_key_exists($method, $customCalls)) { @@ -109,6 +126,12 @@ class RemoteAPI { return $this->callPlugin($customCall[0], $customCall[1], $args); } + /** + * Returns plugin calls that are registered via RPC_CALL_ADD action + * + * @return array with pairs of custom plugin calls + * @triggers RPC_CALL_ADD + */ private function getCustomCallPlugins() { if ($this->pluginCustomCalls === null) { $data = array(); @@ -118,6 +141,15 @@ class RemoteAPI { return $this->pluginCustomCalls; } + /** + * Call a plugin method + * + * @param string $pluginName + * @param string $method method name + * @param array $args + * @return mixed return of custom method + * @throws RemoteException + */ private function callPlugin($pluginName, $method, $args) { $plugin = plugin_load('remote', $pluginName); $methods = $this->getPluginMethods(); @@ -129,6 +161,14 @@ class RemoteAPI { return call_user_func_array(array($plugin, $name), $args); } + /** + * Call a core method + * + * @param string $method name of method + * @param array $args + * @return mixed + * @throws RemoteException if method not exist + */ private function callCoreMethod($method, $args) { $coreMethods = $this->getCoreMethods(); $this->checkAccess($coreMethods[$method]); @@ -139,6 +179,11 @@ class RemoteAPI { return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); } + /** + * Check if access should be checked + * + * @param array $methodMeta data about the method + */ private function checkAccess($methodMeta) { if (!isset($methodMeta['public'])) { $this->forceAccess(); @@ -149,12 +194,26 @@ class RemoteAPI { } } - private function checkArgumentLength($method, $args) { - if (count($method['args']) < count($args)) { + /** + * Check the number of parameters + * + * @param array $methodMeta data about the method + * @param array $args + * @throws RemoteException if wrong parameter count + */ + private function checkArgumentLength($methodMeta, $args) { + if (count($methodMeta['args']) < count($args)) { throw new RemoteException('Method does not exist - wrong parameter count.', -32603); } } + /** + * Determine the name of the real method + * + * @param array $methodMeta list of data of the methods + * @param string $method name of method + * @return string + */ private function getMethodName($methodMeta, $method) { if (isset($methodMeta[$method]['name'])) { return $methodMeta[$method]['name']; @@ -164,6 +223,8 @@ class RemoteAPI { } /** + * Perform access check for current user + * * @return bool true if the current user has access to remote api. */ public function hasAccess() { @@ -186,8 +247,10 @@ class RemoteAPI { } /** - * @throws RemoteException On denied access. + * Requests access + * * @return void + * @throws RemoteException On denied access. */ public function forceAccess() { if (!$this->hasAccess()) { @@ -196,7 +259,10 @@ class RemoteAPI { } /** + * Collects all the methods of the enabled Remote Plugins + * * @return array all plugin methods. + * @throws RemoteException if not implemented */ public function getPluginMethods() { if ($this->pluginMethods === null) { @@ -204,6 +270,7 @@ class RemoteAPI { $plugins = plugin_list('remote'); foreach ($plugins as $pluginName) { + /** @var DokuWiki_Remote_Plugin $plugin */ $plugin = plugin_load('remote', $pluginName); if (!is_subclass_of($plugin, 'DokuWiki_Remote_Plugin')) { throw new RemoteException("Plugin $pluginName does not implement DokuWiki_Remote_Plugin"); @@ -219,6 +286,8 @@ class RemoteAPI { } /** + * Collects all the core methods + * * @param RemoteAPICore $apiCore this parameter is used for testing. Here you can pass a non-default RemoteAPICore * instance. (for mocking) * @return array all core methods. @@ -234,22 +303,50 @@ class RemoteAPI { return $this->coreMethods->__getRemoteInfo(); } + /** + * Transform file to xml + * + * @param mixed $data + * @return mixed + */ public function toFile($data) { return call_user_func($this->fileTransformation, $data); } + /** + * Transform date to xml + * + * @param mixed $data + * @return mixed + */ public function toDate($data) { return call_user_func($this->dateTransformation, $data); } + /** + * A simple transformation + * + * @param mixed $data + * @return mixed + */ public function dummyTransformation($data) { return $data; } + /** + * Set the transformer function + * + * @param callback $dateTransformation + */ public function setDateTransformation($dateTransformation) { $this->dateTransformation = $dateTransformation; } + /** + * Set the transformer function + * + * @param callback $fileTransformation + */ public function setFileTransformation($fileTransformation) { $this->fileTransformation = $fileTransformation; } diff --git a/inc/search.php b/inc/search.php index 5489dc2c0..935969d3f 100644 --- a/inc/search.php +++ b/inc/search.php @@ -134,6 +134,11 @@ function search_namespaces(&$data,$base,$file,$type,$lvl,$opts){ /** * List all mediafiles in a namespace + * $opts['depth'] recursion level, 0 for all + * $opts['showmsg'] shows message if invalid media id is used + * $opts['skipacl'] skip acl checking + * $opts['pattern'] check given pattern + * $opts['hash'] add hashes to result list * * @author Andreas Gohr <andi@splitbrain.org> */ @@ -258,6 +263,7 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){ //only search txt files if(substr($file,-4) != '.txt') return true; + $item = array(); $item['id'] = pathID($file); if(!$opts['skipacl'] && auth_quickaclcheck($item['id']) < AUTH_READ){ return false; diff --git a/inc/subscription.php b/inc/subscription.php index aab6de926..58376f2ec 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -444,17 +444,17 @@ class Subscription { * Send the diff for some media change * * @fixme this should embed thumbnails of images in HTML version + * * @param string $subscriber_mail The target mail address * @param string $template Mail template ('uploadmail', ...) * @param string $id Media file for which the notification is * @param int|bool $rev Old revision if any - * @return bool true if successfully sent */ public function send_media_diff($subscriber_mail, $template, $id, $rev = false) { global $conf; $file = mediaFN($id); - list($mime, $ext) = mimetype($id); + list($mime, /* $ext */) = mimetype($id); $trep = array( 'MIME' => $mime, @@ -515,7 +515,7 @@ class Subscription { * @author Adrian Lang <lang@cosmocode.de> * * @param string $subscriber_mail The target mail address - * @param array $id The ID + * @param string $id The ID * @param int $lastupdate Time of the last notification * @return bool */ @@ -619,6 +619,7 @@ class Subscription { /** * Get a valid message id for a certain $id and revision (or the current revision) + * * @param string $id The id of the page (or media file) the message id should be for * @param string $rev The revision of the page, set to the current revision of the page $id if not set * @return string diff --git a/inc/template.php b/inc/template.php index 31a65ce61..3bccb0bd8 100644 --- a/inc/template.php +++ b/inc/template.php @@ -68,6 +68,7 @@ function tpl_basedir($tpl='') { * handled by this function. ACL stuff is not done here either. * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers TPL_ACT_RENDER * @triggers TPL_CONTENT_DISPLAY * @param bool $prependTOC should the TOC be displayed here? @@ -170,8 +171,9 @@ function tpl_content_core() { break; default: $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT); - if($evt->advise_before()) + if($evt->advise_before()) { msg("Failed to handle command: ".hsc($ACT), -1); + } $evt->advise_after(); unset($evt); return false; @@ -186,6 +188,7 @@ function tpl_content_core() { * a false argument * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $return Should the TOC be returned instead to be printed? * @return string */ @@ -204,7 +207,7 @@ function tpl_toc($return = false) { $toc = $TOC; } elseif(($ACT == 'show' || substr($ACT, 0, 6) == 'export') && !$REV && $INFO['exists']) { // get TOC from metadata, render if neccessary - $meta = p_get_metadata($ID, false, METADATA_RENDER_USING_CACHE); + $meta = p_get_metadata($ID, '', METADATA_RENDER_USING_CACHE); if(isset($meta['internal']['toc'])) { $tocok = $meta['internal']['toc']; } else { @@ -243,6 +246,8 @@ function tpl_toc($return = false) { * Handle the admin page contents * * @author Andreas Gohr <andi@splitbrain.org> + * + * @return bool */ function tpl_admin() { global $INFO; @@ -277,6 +282,7 @@ function tpl_admin() { * This has to go into the head section of your template. * * @author Andreas Gohr <andi@splitbrain.org> + * * @triggers TPL_METAHEADER_OUTPUT * @param bool $alt Should feeds and alternative format links be added? * @return bool @@ -426,10 +432,12 @@ function tpl_metaheaders($alt = true) { * instances. Attributes are given as key value pairs. Values will be HTML * encoded automatically so they should be provided as is in the $data array. * - * For tags having a body attribute specify the the body data in the special + * For tags having a body attribute specify the body data in the special * attribute '_data'. This field will NOT BE ESCAPED automatically. * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param array $data */ function _tpl_metaheaders_action($data) { foreach($data as $tag => $inst) { @@ -460,7 +468,7 @@ function _tpl_metaheaders_action($data) { * @param string $url * @param string $name * @param string $more - * @param bool $return if true return the link html, otherwise print + * @param bool $return if true return the link html, otherwise print * @return bool|string html of the link, or true if printed */ function tpl_link($url, $name, $more = '', $return = false) { @@ -480,7 +488,7 @@ function tpl_link($url, $name, $more = '', $return = false) { * @author Andreas Gohr <andi@splitbrain.org> * * @param string $id page id - * @param string|null $name link name + * @param string|null $name the name of the link * @return bool true */ function tpl_pagelink($id, $name = null) { @@ -495,6 +503,9 @@ function tpl_pagelink($id, $name = null) { * returns false if none is available * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $id page id + * @return false|string */ function tpl_getparent($id) { $parent = getNS($id).':'; @@ -513,6 +524,10 @@ function tpl_getparent($id) { * * @author Adrian Lang <mail@adrianlang.de> * @see tpl_get_action + * + * @param string $type + * @param bool $return + * @return bool|string html, or false if no data, true if printed */ function tpl_button($type, $return = false) { $data = tpl_get_action($type); @@ -545,12 +560,12 @@ function tpl_button($type, $return = false) { * @author Adrian Lang <mail@adrianlang.de> * @see tpl_get_action * - * @param string $type action name - * @param string $pre prefix of link - * @param string $suf suffix of link - * @param string $inner inner HTML for link - * @param bool $return if true it returns html, otherwise prints - * @return bool|string html of action link or false if nothing, or true if printed + * @param string $type action command + * @param string $pre prefix of link + * @param string $suf suffix of link + * @param string $inner innerHML of link + * @param bool $return if true it returns html, otherwise prints + * @return bool|string html or false if no data, true if printed */ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = false) { global $lang; @@ -616,6 +631,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals * @author Andreas Gohr <andi@splitbrain.org> * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> * @author Adrian Lang <mail@adrianlang.de> + * * @param string $type * @return array|bool|string */ @@ -772,13 +788,14 @@ function tpl_get_action($type) { * Wrapper around tpl_button() and tpl_actionlink() * * @author Anika Henke <anika@selfthinker.org> - * @param - * @param bool $link link or form button? - * @param bool $wrapper HTML element wrapper - * @param bool $return return or print - * @param string $pre prefix for links - * @param string $suf suffix for links - * @param string $inner inner HTML for links + * + * @param string $type action command + * @param bool $link link or form button? + * @param string|bool $wrapper HTML element wrapper + * @param bool $return return or print + * @param string $pre prefix for links + * @param string $suf suffix for links + * @param string $inner inner HTML for links * @return bool|string */ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pre = '', $suf = '', $inner = '') { @@ -806,6 +823,7 @@ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pr * autocompletion feature (MSIE and Firefox) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $ajax * @param bool $autocomplete * @return bool @@ -834,6 +852,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) { * Print the breadcrumbs trace * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $sep Separator between entries * @return bool */ @@ -875,6 +894,7 @@ function tpl_breadcrumbs($sep = '•') { * @author Sean Coates <sean@caedmon.net> * @author <fredrik@averpil.com> * @todo May behave strangely in RTL languages + * * @param string $sep Separator between entries * @return bool */ @@ -925,6 +945,7 @@ function tpl_youarehere($sep = ' » ') { * Could be enhanced with a profile link in future? * * @author Andreas Gohr <andi@splitbrain.org> + * * @return bool */ function tpl_userinfo() { @@ -943,6 +964,7 @@ function tpl_userinfo() { * Print some info about the current page * * @author Andreas Gohr <andi@splitbrain.org> + * * @param bool $ret return content instead of printing it * @return bool|string */ @@ -1006,6 +1028,7 @@ function tpl_pageinfo($ret = false) { * the given ID is used. * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $id page id * @param bool $ret return content instead of printing * @return bool|string @@ -1043,9 +1066,10 @@ function tpl_pagetitle($id = null, $ret = false) { * Only allowed in: detail.php * * @author Andreas Gohr <andi@splitbrain.org> - * @param array|string $tags tag or array of tags to try - * @param string $alt alternative output if no data was found - * @param null $src the image src, uses global $SRC if not given + * + * @param array|string $tags tag or array of tags to try + * @param string $alt alternative output if no data was found + * @param null|string $src the image src, uses global $SRC if not given * @return string */ function tpl_img_getTag($tags, $alt = '', $src = null) { @@ -1133,7 +1157,7 @@ function tpl_get_img_meta() { * @param $maxheight int - maximal height of the image * @param $link bool - link to the orginal size? * @param $params array - additional image attributes - * @return mixed Result of TPL_IMG_DISPLAY + * @return bool Result of TPL_IMG_DISPLAY */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; @@ -1286,6 +1310,9 @@ function tpl_loadConfig() { * tpl_getLang($id) * * use this function to access template language variables + * + * @param string $id key of language string + * @return string */ function tpl_getLang($id) { static $lang = array(); @@ -1330,6 +1357,9 @@ function tpl_locale_xhtml($id) { /** * Prepends appropriate path for a language dependent filename + * + * @param string $id id of localized text + * @return string wiki text */ function tpl_localeFN($id) { $path = tpl_incdir().'lang/'; @@ -1357,6 +1387,7 @@ function tpl_localeFN($id) { * @triggers MEDIAMANAGER_CONTENT_OUTPUT * @param bool $fromajax - set true when calling this function via ajax * @param string $sort + * * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_mediaContent($fromajax = false, $sort='natural') { @@ -1531,6 +1562,9 @@ function tpl_mediaTree() { * Note: this will not use any pretty URLs * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $empty empty option label + * @param string $button submit button label */ function tpl_actiondropdown($empty = '', $button = '>') { global $ID; @@ -1644,6 +1678,11 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap = * * This function is useful to populate sidebars or similar features in a * template + * + * @param string $pageid + * @param bool $print + * @param bool $propagate + * @return bool|null|string */ function tpl_include_page($pageid, $print = true, $propagate = false) { if (!$pageid) return false; @@ -1752,10 +1791,11 @@ function tpl_flush() { * If a given location starts with a colon it is assumed to be a media * file, otherwise it is assumed to be relative to the current template * - * @param array $search locations to look at - * @param bool $abs if to use absolute URL - * @param array &$imginfo filled with getimagesize() + * @param string[] $search locations to look at + * @param bool $abs if to use absolute URL + * @param array &$imginfo filled with getimagesize() * @return string + * * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { @@ -1806,6 +1846,8 @@ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { * * @author Anika Henke <anika@selfthinker.org> * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $file */ function tpl_includeFile($file) { global $config_cascade; @@ -1831,6 +1873,7 @@ function tpl_includeFile($file) { * Returns <link> tag for various icon types (favicon|mobile|generic) * * @author Anika Henke <anika@selfthinker.org> + * * @param array $types - list of icon types to display (favicon|mobile|generic) * @return string */ @@ -1906,6 +1949,8 @@ function tpl_media() { * Return useful layout classes * * @author Anika Henke <anika@selfthinker.org> + * + * @return string */ function tpl_classes() { global $ACT, $conf, $ID, $INFO; diff --git a/inc/utf8.php b/inc/utf8.php index c944667f7..f86217686 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -43,6 +43,9 @@ if(!function_exists('utf8_isASCII')){ * Checks if a string contains 7bit ASCII only * * @author Andreas Haerter <andreas.haerter@dev.mail-node.com> + * + * @param string $str + * @return bool */ function utf8_isASCII($str){ return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1); @@ -56,6 +59,9 @@ if(!function_exists('utf8_strip')){ * Returns a pure ASCII7 string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $str + * @return string */ function utf8_strip($str){ $ascii = ''; @@ -75,6 +81,9 @@ if(!function_exists('utf8_check')){ * * @author <bmorel@ssi.fr> * @link http://www.php.net/manual/en/function.utf8-encode.php + * + * @param string $Str + * @return bool */ function utf8_check($Str) { $len = strlen($Str); @@ -105,6 +114,7 @@ if(!function_exists('utf8_basename')){ * * @see basename() * @link https://bugs.php.net/bug.php?id=37738 + * * @param string $path A path * @param string $suffix If the name component ends in suffix this will also be cut off * @return string @@ -134,6 +144,9 @@ if(!function_exists('utf8_strlen')){ * @author <chernyshevsky at hotmail dot com> * @see strlen() * @see utf8_decode() + * + * @param string $string + * @return int */ function utf8_strlen($string){ return strlen(utf8_decode($string)); @@ -148,10 +161,11 @@ if(!function_exists('utf8_substr')){ * * @author Harry Fuecks <hfuecks@gmail.com> * @author Chris Smith <chris@jalakai.co.uk> + * * @param string $str * @param int $offset number of UTF-8 characters offset (from left) * @param int $length (optional) length in UTF-8 characters from offset - * @return mixed string or false if failure + * @return string */ function utf8_substr($str, $offset, $length = null) { if(UTF8_MBSTRING){ @@ -250,6 +264,14 @@ if(!function_exists('utf8_substr_replace')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see substr_replace() + * + * @param string $string input string + * @param string $replacement the replacement + * @param int $start the replacing will begin at the start'th offset into string. + * @param int $length If given and is positive, it represents the length of the portion of string which is + * to be replaced. If length is zero then this function will have the effect of inserting + * replacement into string at the given start offset. + * @return string */ function utf8_substr_replace($string, $replacement, $start , $length=0 ){ $ret = ''; @@ -266,6 +288,7 @@ if(!function_exists('utf8_ltrim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see ltrim() + * * @param string $str * @param string $charlist * @return string @@ -286,6 +309,7 @@ if(!function_exists('utf8_rtrim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see rtrim() + * * @param string $str * @param string $charlist * @return string @@ -306,6 +330,7 @@ if(!function_exists('utf8_trim')){ * * @author Andreas Gohr <andi@splitbrain.org> * @see trim() + * * @param string $str * @param string $charlist * @return string @@ -326,6 +351,9 @@ if(!function_exists('utf8_strtolower')){ * @author Leo Feyer <leo@typolight.org> * @see strtolower() * @see utf8_strtoupper() + * + * @param string $string + * @return string */ function utf8_strtolower($string){ if(UTF8_MBSTRING) return mb_strtolower($string,'utf-8'); @@ -344,6 +372,9 @@ if(!function_exists('utf8_strtoupper')){ * @author Leo Feyer <leo@typolight.org> * @see strtoupper() * @see utf8_strtoupper() + * + * @param string $string + * @return string */ function utf8_strtoupper($string){ if(UTF8_MBSTRING) return mb_strtoupper($string,'utf-8'); @@ -359,7 +390,8 @@ if(!function_exists('utf8_ucfirst')){ * Make a string's first character uppercase * * @author Harry Fuecks - * @param string + * + * @param string $str * @return string with first character as upper case (if applicable) */ function utf8_ucfirst($str){ @@ -381,9 +413,10 @@ if(!function_exists('utf8_ucwords')){ * Uppercase the first character of each word in a string * * @author Harry Fuecks - * @param string - * @return string with first char of each word uppercase * @see http://www.php.net/ucwords + * + * @param string $str + * @return string with first char of each word uppercase */ function utf8_ucwords($str) { // Note: [\x0c\x09\x0b\x0a\x0d\x20] matches; @@ -399,10 +432,11 @@ if(!function_exists('utf8_ucwords')){ * You don't need to call this yourself * * @author Harry Fuecks - * @param array $matches matches corresponding to a single word - * @return string with first char of the word in uppercase * @see utf8_ucwords * @see utf8_strtoupper + * + * @param array $matches matches corresponding to a single word + * @return string with first char of the word in uppercase */ function utf8_ucwords_callback($matches) { $leadingws = $matches[2]; @@ -420,6 +454,10 @@ if(!function_exists('utf8_deaccent')){ * letters. Default is to deaccent both cases ($case = 0) * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @param int $case + * @return string */ function utf8_deaccent($string,$case=0){ if($case <= 0){ @@ -439,6 +477,9 @@ if(!function_exists('utf8_romanize')){ * Romanize a non-latin string * * @author Andreas Gohr <andi@splitbrain.org> + * + * @param string $string + * @return string */ function utf8_romanize($string){ if(utf8_isASCII($string)) return $string; //nothing to do @@ -456,6 +497,7 @@ if(!function_exists('utf8_stripspecials')){ * stripped chars (they are not included in $UTF8_SPECIAL_CHARS) * * @author Andreas Gohr <andi@splitbrain.org> + * * @param string $string The UTF8 string to strip of special chars * @param string $repl Replace special with this string * @param string $additional Additional chars to strip (used in regexp char class) @@ -480,9 +522,10 @@ if(!function_exists('utf8_strpos')){ * * @author Leo Feyer <leo@typolight.org> * @see strpos() - * @param string - * @param string - * @param integer + * + * @param string $haystack + * @param string $needle + * @param integer $offset * @return integer */ function utf8_strpos($haystack, $needle, $offset=0){ @@ -512,6 +555,9 @@ if(!function_exists('utf8_tohtml')){ * @author Tom N Harris <tnharris@whoopdedo.org> * @author <vpribish at shopping dot com> * @link http://www.php.net/manual/en/function.utf8-decode.php + * + * @param string $str + * @return string */ function utf8_tohtml ($str) { $ret = ''; @@ -542,6 +588,7 @@ if(!function_exists('utf8_unhtml')){ * what it should be -> "&&#38;" * * @author Tom N Harris <tnharris@whoopdedo.org> + * * @param string $str UTF-8 encoded string * @param boolean $entities Flag controlling decoding of named entities. * @return string UTF-8 encoded string with numeric (and named) entities replaced. @@ -564,7 +611,7 @@ if(!function_exists('utf8_decode_numeric')){ * Decodes numeric HTML entities to their correct UTF-8 characters * * @param $ent string A numeric entity - * @return string + * @return string|false */ function utf8_decode_numeric($ent) { switch ($ent[2]) { @@ -597,10 +644,10 @@ if(!class_exists('utf8_entity_decoder')){ } /** - * Wrapper aorund unicode_to_utf8() + * Wrapper around unicode_to_utf8() * - * @param $c string - * @return mixed + * @param string $c + * @return string|false */ function makeutf8($c) { return unicode_to_utf8(array(ord($c))); @@ -609,8 +656,8 @@ if(!class_exists('utf8_entity_decoder')){ /** * Decodes any HTML entity to it's correct UTF-8 char equivalent * - * @param $ent string An entity - * @return string + * @param string $ent An entity + * @return string|false */ function decode($ent) { if ($ent[1] == '#') { @@ -640,12 +687,13 @@ if(!function_exists('utf8_to_unicode')){ * * @author <hsivonen@iki.fi> * @author Harry Fuecks <hfuecks@gmail.com> - * @param string $str UTF-8 encoded string - * @param boolean $strict Check for invalid sequences? - * @return mixed array of unicode code points or false if UTF-8 invalid * @see unicode_to_utf8 * @link http://hsivonen.iki.fi/php-utf8/ * @link http://sourceforge.net/projects/phputf8/ + * + * @param string $str UTF-8 encoded string + * @param boolean $strict Check for invalid sequences? + * @return mixed array of unicode code points or false if UTF-8 invalid */ function utf8_to_unicode($str,$strict=false) { $mState = 0; // cached expected number of octets after the current octet @@ -815,7 +863,8 @@ if(!function_exists('unicode_to_utf8')){ * * @param array $arr of unicode code points representing a string * @param boolean $strict Check for invalid sequences? - * @return mixed UTF-8 string or false if array contains invalid code points + * @return string|false UTF-8 string or false if array contains invalid code points + * * @author <hsivonen@iki.fi> * @author Harry Fuecks <hfuecks@gmail.com> * @see utf8_to_unicode @@ -896,6 +945,10 @@ if(!function_exists('utf8_to_utf16be')){ * UTF-8 to UTF-16BE conversion. * * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + * + * @param string $str + * @param bool $bom + * @return string */ function utf8_to_utf16be(&$str, $bom = false) { $out = $bom ? "\xFE\xFF" : ''; @@ -914,6 +967,9 @@ if(!function_exists('utf16be_to_utf8')){ * UTF-8 to UTF-16BE conversion. * * Maybe really UCS-2 without mb_string due to utf8_to_unicode limits + * + * @param string $str + * @return false|string */ function utf16be_to_utf8(&$str) { $uni = unpack('n*',$str); @@ -933,6 +989,7 @@ if(!function_exists('utf8_bad_replace')){ * * @author Harry Fuecks <hfuecks@gmail.com> * @see http://www.w3.org/International/questions/qa-forms-utf-8 + * * @param string $str to search * @param string $replace to replace bad bytes with (defaults to '?') - use ASCII * @return string @@ -967,8 +1024,8 @@ if(!function_exists('utf8_correctIdx')){ /** * adjust a byte index into a utf8 string to a utf8 character boundary * - * @param $str string utf8 character string - * @param $i int byte index into $str + * @param string $str utf8 character string + * @param int $i byte index into $str * @param $next bool direction to search for boundary, * false = up (current character) * true = down (next character) |