当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiBase::largeParam方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:Abbe98,项目名称:ODOK,代码行数:92,代码来源:ApiBase.php


注:本文中的ApiBase::largeParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。