summaryrefslogtreecommitdiff
path: root/includes/api/ApiResult.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/api/ApiResult.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/api/ApiResult.php')
-rw-r--r--includes/api/ApiResult.php17
1 files changed, 13 insertions, 4 deletions
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) {