本文整理汇总了PHP中ApiBase::largeParam方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiBase::largeParam方法的具体用法?PHP ApiBase::largeParam怎么用?PHP ApiBase::largeParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiBase
的用法示例。
在下文中一共展示了ApiBase::largeParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readConstraints
function readConstraints()
{
#define list of allowed generic constraints
#Should material be added (if so it's soft)? Left out for now due to municipal concerns
$getConstraints = array('id', 'title', 'artist', 'year', 'type', 'address', 'county', 'muni', 'county_name', 'muni_name', 'district', 'bbox', 'BBOX', 'source', 'changed', 'created', 'wiki', 'list', 'commons_cat', 'official_url', 'free', 'owner', 'has_cmt', 'is_inside', 'has_ugc', 'has_image', 'has_coords', 'has_wiki', 'has_list', 'has_same', 'is_removed');
$artistConstraints = array('id', 'wiki', 'first_name', 'last_name', 'name', 'birth_year', 'death_year', 'is_dead', 'lifespan');
$allowed = array_merge($getConstraints, $artistConstraints);
$maxValues = 50;
try {
ApiBase::largeParam();
} catch (Exception $e) {
throw $e;
}
if (empty($_GET)) {
return null;
} else {
try {
foreach ($_GET as $key => $value) {
if (empty($value)) {
continue;
} elseif (!in_array($key, $allowed)) {
continue;
} elseif (substr_count($value, '|') > $maxValues) {
throw new ValueLimitException('You can enter a maximum of ' . $maxValues . ' values per parameter (you entered ' . substr_count($value, '|') . ' values for the parameter "' . $key . '").');
continue;
}
switch ($key) {
case 'BBOX':
#dynamicKml gives comma separated bbox
$value = implode('|', explode(',', $value));
case 'bbox':
$params[$key] = self::bboxParam($key, $value);
break;
case 'lifespan':
$params[$key] = self::multiRangedParam('birth_year', 'death_year', $value);
break;
case 'year':
case 'created':
case 'changed':
case 'birth_year':
case 'death_year':
$params[$key] = self::rangedParam($key, $value);
break;
case 'muni_name':
case 'county_name':
$keyparts = explode('_', $key);
$params[$keyparts[0]] = self::namedParam($keyparts[0], $value);
break;
case 'is_inside':
case 'is_removed':
case 'has_ugc':
case 'has_coords':
case 'has_cmt':
case 'has_image':
case 'has_wiki':
case 'has_list':
case 'has_same':
case 'is_dead':
$val = self::boolParam($key, $value);
if (!empty($val)) {
$keyparts = explode('_', $key);
if ($keyparts[1] == 'wiki') {
$params['has_wiki'] = $val;
# since 'wiki' is already claimed
} elseif ($keyparts[1] == 'list') {
$params['has_list'] = $val;
# since 'list' is already claimed
} else {
$params[$keyparts[1]] = $val;
}
}
break;
case 'artist':
case 'title':
case 'address':
case 'first_name':
$params[$key] = self::softParam($key, $value);
break;
case 'name':
$params[$key] = self::softParam(array('first_name', 'last_name'), $value);
break;
default:
$params[$key] = $value;
break;
}
}
} catch (Exception $e) {
throw $e;
}
return $params;
}
}