Add missing `@param`s to `src/wp-includes/pomo` files.
See #30224. Built from https://develop.svn.wordpress.org/trunk@30663 git-svn-id: http://core.svn.wordpress.org/trunk@30653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
616c5515ce
commit
b35cbbfac7
|
@ -139,6 +139,9 @@ class MO extends Gettext_Translations {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param POMO_FileReader $reader
|
||||
*/
|
||||
function import_from_reader($reader) {
|
||||
$endian_string = MO::get_byteorder($reader->readint32());
|
||||
if (false === $endian_string) {
|
||||
|
|
|
@ -189,8 +189,8 @@ class PO extends Gettext_Translations {
|
|||
* Builds a string from the entry for inclusion in PO file
|
||||
*
|
||||
* @static
|
||||
* @param object &$entry the entry to convert to po string
|
||||
* @return string|bool PO-style formatted string for the entry or
|
||||
* @param Translation_Entry &$entry the entry to convert to po string
|
||||
* @return false|string PO-style formatted string for the entry or
|
||||
* false if the entry is empty
|
||||
*/
|
||||
function export_entry(&$entry) {
|
||||
|
@ -215,6 +215,10 @@ class PO extends Gettext_Translations {
|
|||
return implode("\n", $po);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return boolean
|
||||
*/
|
||||
function import_from_file($filename) {
|
||||
$f = fopen($filename, 'r');
|
||||
if (!$f) return false;
|
||||
|
@ -238,6 +242,11 @@ class PO extends Gettext_Translations {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $f
|
||||
* @param int $lineno
|
||||
* @return null|false|array
|
||||
*/
|
||||
function read_entry($f, $lineno = 0) {
|
||||
$entry = new Translation_Entry();
|
||||
// where were we in the last step
|
||||
|
@ -343,6 +352,13 @@ class PO extends Gettext_Translations {
|
|||
return array('entry' => $entry, 'lineno' => $lineno);
|
||||
}
|
||||
|
||||
/**
|
||||
* @staticvar string $last_line
|
||||
* @staticvar boolean $use_last_line
|
||||
* @param resource $f
|
||||
* @param string $action
|
||||
* @return boolean
|
||||
*/
|
||||
function read_line($f, $action = 'read') {
|
||||
static $last_line = '';
|
||||
static $use_last_line = false;
|
||||
|
@ -361,6 +377,10 @@ class PO extends Gettext_Translations {
|
|||
return $line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Translation_Entry $entry
|
||||
* @param string $po_comment_line
|
||||
*/
|
||||
function add_comment_to_entry(&$entry, $po_comment_line) {
|
||||
$first_two = substr($po_comment_line, 0, 2);
|
||||
$comment = trim(substr($po_comment_line, 2));
|
||||
|
@ -375,6 +395,10 @@ class PO extends Gettext_Translations {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $s
|
||||
* @return sring
|
||||
*/
|
||||
function trim_quotes($s) {
|
||||
if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
|
||||
if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
|
||||
|
|
|
@ -58,7 +58,12 @@ class POMO_Reader {
|
|||
return unpack($endian_letter.$count, $bytes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
function substr($string, $start, $length) {
|
||||
if ($this->is_overloaded) {
|
||||
return mb_substr($string, $start, $length, 'ascii');
|
||||
|
@ -67,6 +72,10 @@ class POMO_Reader {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @return int
|
||||
*/
|
||||
function strlen($string) {
|
||||
if ($this->is_overloaded) {
|
||||
return mb_strlen($string, 'ascii');
|
||||
|
@ -75,6 +84,11 @@ class POMO_Reader {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
* @param int $chunk_size
|
||||
* @return array
|
||||
*/
|
||||
function str_split($string, $chunk_size) {
|
||||
if (!function_exists('str_split')) {
|
||||
$length = $this->strlen($string);
|
||||
|
@ -104,15 +118,26 @@ endif;
|
|||
|
||||
if ( !class_exists( 'POMO_FileReader' ) ):
|
||||
class POMO_FileReader extends POMO_Reader {
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
*/
|
||||
function POMO_FileReader($filename) {
|
||||
parent::POMO_Reader();
|
||||
$this->_f = fopen($filename, 'rb');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $bytes
|
||||
*/
|
||||
function read($bytes) {
|
||||
return fread($this->_f, $bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pos
|
||||
* @return boolean
|
||||
*/
|
||||
function seekto($pos) {
|
||||
if ( -1 == fseek($this->_f, $pos, SEEK_SET)) {
|
||||
return false;
|
||||
|
@ -157,7 +182,10 @@ class POMO_StringReader extends POMO_Reader {
|
|||
$this->_pos = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $bytes
|
||||
* @return string
|
||||
*/
|
||||
function read($bytes) {
|
||||
$data = $this->substr($this->_str, $this->_pos, $bytes);
|
||||
$this->_pos += $bytes;
|
||||
|
@ -165,6 +193,10 @@ class POMO_StringReader extends POMO_Reader {
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pos
|
||||
* @return int
|
||||
*/
|
||||
function seekto($pos) {
|
||||
$this->_pos = $pos;
|
||||
if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str);
|
||||
|
|
|
@ -17,7 +17,7 @@ class Translations {
|
|||
/**
|
||||
* Add entry to the PO structure
|
||||
*
|
||||
* @param object &$entry
|
||||
* @param array|Translation_Entry &$entry
|
||||
* @return bool true on success, false if the entry doesn't have a key
|
||||
*/
|
||||
function add_entry($entry) {
|
||||
|
@ -30,6 +30,10 @@ class Translations {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Translation_Entry $entry
|
||||
* @return bool
|
||||
*/
|
||||
function add_entry_or_merge($entry) {
|
||||
if (is_array($entry)) {
|
||||
$entry = new Translation_Entry($entry);
|
||||
|
@ -57,21 +61,35 @@ class Translations {
|
|||
$this->headers[$header] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
*/
|
||||
function set_headers($headers) {
|
||||
foreach($headers as $header => $value) {
|
||||
$this->set_header($header, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $header
|
||||
*/
|
||||
function get_header($header) {
|
||||
return isset($this->headers[$header])? $this->headers[$header] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Translation_Entry $entry
|
||||
*/
|
||||
function translate_entry(&$entry) {
|
||||
$key = $entry->key();
|
||||
return isset($this->entries[$key])? $this->entries[$key] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $singular
|
||||
* @param string $context
|
||||
* @return string
|
||||
*/
|
||||
function translate($singular, $context=null) {
|
||||
$entry = new Translation_Entry(array('singular' => $singular, 'context' => $context));
|
||||
$translated = $this->translate_entry($entry);
|
||||
|
@ -97,6 +115,12 @@ class Translations {
|
|||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $singular
|
||||
* @param string $plural
|
||||
* @param int $count
|
||||
* @param string $context
|
||||
*/
|
||||
function translate_plural($singular, $plural, $count, $context = null) {
|
||||
$entry = new Translation_Entry(array('singular' => $singular, 'plural' => $plural, 'context' => $context));
|
||||
$translated = $this->translate_entry($entry);
|
||||
|
@ -139,6 +163,7 @@ class Gettext_Translations extends Translations {
|
|||
* It lives in this class, because there are more than one descendand, which will use it and
|
||||
* they can't share it effectively.
|
||||
*
|
||||
* @param int $count
|
||||
*/
|
||||
function gettext_select_plural_form($count) {
|
||||
if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) {
|
||||
|
@ -149,6 +174,10 @@ class Gettext_Translations extends Translations {
|
|||
return call_user_func($this->_gettext_select_plural_form, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $header
|
||||
* @return array
|
||||
*/
|
||||
function nplurals_and_expression_from_header($header) {
|
||||
if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) {
|
||||
$nplurals = (int)$matches[1];
|
||||
|
@ -162,6 +191,8 @@ class Gettext_Translations extends Translations {
|
|||
/**
|
||||
* Makes a function, which will return the right translation index, according to the
|
||||
* plural forms header
|
||||
* @param int $nplurals
|
||||
* @param string $expression
|
||||
*/
|
||||
function make_plural_form_function($nplurals, $expression) {
|
||||
$expression = str_replace('n', '$n', $expression);
|
||||
|
@ -203,6 +234,10 @@ class Gettext_Translations extends Translations {
|
|||
return rtrim($res, ';');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $translation
|
||||
* @return array
|
||||
*/
|
||||
function make_headers($translation) {
|
||||
$headers = array();
|
||||
// sometimes \ns are used instead of real new lines
|
||||
|
@ -216,6 +251,10 @@ class Gettext_Translations extends Translations {
|
|||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $header
|
||||
* @param string $value
|
||||
*/
|
||||
function set_header($header, $value) {
|
||||
parent::set_header($header, $value);
|
||||
if ('Plural-Forms' == $header) {
|
||||
|
@ -253,6 +292,10 @@ class NOOP_Translations {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $singular
|
||||
* @param string $context
|
||||
*/
|
||||
function translate($singular, $context=null) {
|
||||
return $singular;
|
||||
}
|
||||
|
@ -265,6 +308,12 @@ class NOOP_Translations {
|
|||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $singular
|
||||
* @param string $plural
|
||||
* @param int $count
|
||||
* @param string $context
|
||||
*/
|
||||
function translate_plural($singular, $plural, $count, $context = null) {
|
||||
return 1 == $count? $singular : $plural;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.1-beta2-30662';
|
||||
$wp_version = '4.1-beta2-30663';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue