From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/api/ApiResult.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'includes/api/ApiResult.php') diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 9e798d35..900953e0 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -100,7 +100,7 @@ class ApiResult extends ApiBase { } elseif (is_array($arr[$name]) && is_array($value)) { $merged = array_intersect_key($arr[$name], $value); - if (empty ($merged)) + if (!count($merged)) $arr[$name] += $value; else ApiBase :: dieDebug(__METHOD__, "Attempting to merge element $name"); @@ -180,18 +180,27 @@ class ApiResult extends ApiBase { } } - if (empty($name)) + if (!$name) $data[] = $value; // Add list element else ApiResult :: setElement($data, $name, $value); // Add named element } + /** + * Ensure all values in this result are valid UTF-8. + */ + public function cleanUpUTF8() + { + $data = & $this->getData(); + array_walk_recursive($data, array('UtfNormal', 'cleanUp')); + } + public function execute() { ApiBase :: dieDebug(__METHOD__, 'execute() is not supported on Result object'); } public function getVersion() { - return __CLASS__ . ': $Id: ApiResult.php 35098 2008-05-20 17:13:28Z ialex $'; + return __CLASS__ . ': $Id: ApiResult.php 45752 2009-01-14 21:36:57Z catrope $'; } } @@ -201,7 +210,7 @@ if (!function_exists('array_intersect_key')) { $argc = func_num_args(); if ($argc > 2) { - for ($i = 1; !empty($isec) && $i < $argc; $i++) { + for ($i = 1; $isec && $i < $argc; $i++) { $arr = func_get_arg($i); foreach (array_keys($isec) as $key) { -- cgit v1.2.2