Exemplo n.º 1
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsAvailableGeoServices, $egMapsAvailableCoordNotations;
     global $egMapsDefaultGeoService, $egMapsCoordinateNotation;
     global $egMapsAllowCoordsGeocoding, $egMapsCoordinateDirectional;
     $params = array();
     $params['location'] = new Parameter('location');
     $params['location']->addDependencies('mappingservice', 'geoservice');
     $params['location']->addCriteria(new CriterionIsLocation());
     $params['location']->setMessage('maps-geocode-par-location');
     $params['mappingservice'] = new Parameter('mappingservice', Parameter::TYPE_STRING, '', array(), array(new CriterionInArray(MapsMappingServices::getAllServiceValues())));
     $params['mappingservice']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['mappingservice']->setMessage('maps-geocode-par-mappingservice');
     $params['geoservice'] = new Parameter('geoservice', Parameter::TYPE_STRING, $egMapsDefaultGeoService, array('service'), array(new CriterionInArray($egMapsAvailableGeoServices)));
     $params['geoservice']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['geoservice']->setMessage('maps-geocode-par-geoservice');
     $params['allowcoordinates'] = new Parameter('allowcoordinates', Parameter::TYPE_BOOLEAN, $egMapsAllowCoordsGeocoding);
     $params['allowcoordinates']->setMessage('maps-geocode-par-allowcoordinates');
     $params['format'] = new Parameter('format', Parameter::TYPE_STRING, $egMapsCoordinateNotation, array('notation'), array(new CriterionInArray($egMapsAvailableCoordNotations)));
     $params['format']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['format']->setMessage('maps-geocode-par-format');
     $params['directional'] = new Parameter('directional', Parameter::TYPE_BOOLEAN, $egMapsCoordinateDirectional);
     $params['directional']->setMessage('maps-geocode-par-directional');
     return $params;
 }
Exemplo n.º 2
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsDistanceUnit, $egMapsDistanceDecimals, $egMapsAvailableGeoServices, $egMapsDefaultGeoService;
     $params = array();
     $params['mappingservice'] = array('default' => '', 'values' => MapsMappingServices::getAllServiceValues(), 'tolower' => true);
     $params['geoservice'] = array('default' => $egMapsDefaultGeoService, 'aliases' => 'service', 'values' => $egMapsAvailableGeoServices, 'tolower' => true);
     $params['unit'] = array('default' => $egMapsDistanceUnit, 'values' => MapsDistanceParser::getUnits());
     $params['decimals'] = array('type' => 'integer', 'default' => $egMapsDistanceDecimals);
     $params['location1'] = array('type' => 'mapslocation', 'aliases' => 'from', 'dependencies' => array('mappingservice', 'geoservice'));
     $params['location2'] = array('type' => 'mapslocation', 'aliases' => 'to', 'dependencies' => array('mappingservice', 'geoservice'));
     // Give grep a chance to find the usages:
     // maps-geodistance-par-mappingservice, maps-geodistance-par-geoservice,
     // maps-geodistance-par-unit, maps-geodistance-par-decimals,
     // maps-geodistance-par-location1, maps-geodistance-par-location2
     foreach ($params as $name => &$param) {
         $param['message'] = 'maps-geodistance-par-' . $name;
     }
     return $params;
 }
Exemplo n.º 3
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsAvailableGeoServices, $egMapsAvailableCoordNotations;
     global $egMapsDefaultGeoService, $egMapsCoordinateNotation;
     global $egMapsAllowCoordsGeocoding, $egMapsCoordinateDirectional;
     $params = array();
     $params['location'] = array('type' => 'mapslocation', 'dependencies' => array('mappingservice', 'geoservice'));
     $params['mappingservice'] = array('default' => '', 'values' => MapsMappingServices::getAllServiceValues(), 'tolower' => true);
     $params['geoservice'] = array('default' => $egMapsDefaultGeoService, 'aliases' => 'service', 'values' => $egMapsAvailableGeoServices, 'tolower' => true);
     $params['allowcoordinates'] = array('type' => 'boolean', 'default' => $egMapsAllowCoordsGeocoding);
     $params['format'] = array('default' => $egMapsCoordinateNotation, 'values' => $egMapsAvailableCoordNotations, 'aliases' => 'notation', 'tolower' => true);
     $params['directional'] = array('type' => 'boolean', 'default' => $egMapsCoordinateDirectional);
     // Give grep a chance to find the usages:
     // maps-geocode-par-location, maps-geocode-par-mappingservice, maps-geocode-par-geoservice,
     // maps-geocode-par-allowcoordinates, maps-geocode-par-format, maps-geocode-par-directional
     foreach ($params as $name => &$param) {
         $param['message'] = 'maps-geocode-par-' . $name;
     }
     return $params;
 }
Exemplo n.º 4
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.7
  * 
  * @return array
  */
 protected function getParameterInfo($type)
 {
     global $egMapsDistanceUnit, $egMapsDistanceDecimals, $egMapsAvailableGeoServices, $egMapsDefaultGeoService;
     $params = array();
     $params['location1'] = new Parameter('location1', Parameter::TYPE_STRING, null, array('from'), array(new CriterionIsLocation()));
     $params['location1']->addDependencies('mappingservice', 'geoservice');
     $params['location1']->setMessage('maps-geodistance-par-location1');
     $params['location2'] = new Parameter('location2', Parameter::TYPE_STRING, null, array('to'), array(new CriterionIsLocation()));
     $params['location2']->addDependencies('mappingservice', 'geoservice');
     $params['location2']->setMessage('maps-geodistance-par-location2');
     $params['unit'] = new Parameter('unit', Parameter::TYPE_STRING, $egMapsDistanceUnit, array(), array(new CriterionInArray(MapsDistanceParser::getUnits())));
     $params['unit']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['unit']->setMessage('maps-geodistance-par-unit');
     $params['decimals'] = new Parameter('decimals', Parameter::TYPE_INTEGER, $egMapsDistanceDecimals);
     $params['decimals']->setMessage('maps-geodistance-par-decimals');
     $params['mappingservice'] = new Parameter('mappingservice', Parameter::TYPE_STRING, '', array(), array(new CriterionInArray(MapsMappingServices::getAllServiceValues())));
     $params['mappingservice']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['mappingservice']->setMessage('maps-geodistance-par-mappingservice');
     $params['geoservice'] = new Parameter('geoservice', Parameter::TYPE_STRING, $egMapsDefaultGeoService, array('service'), array(new CriterionInArray($egMapsAvailableGeoServices)));
     $params['geoservice']->addManipulations(new ParamManipulationFunctions('strtolower'));
     $params['geoservice']->setMessage('maps-geodistance-par-geoservice');
     return $params;
 }
Exemplo n.º 5
0
 /**
  * This function returns the definitions for the parameters used by every map feature.
  *
  * @return array
  */
 public static function getCommonParameters()
 {
     global $egMapsAvailableServices, $egMapsAvailableGeoServices, $egMapsDefaultGeoService, $egMapsMapWidth, $egMapsMapHeight, $egMapsDefaultService;
     $params = array();
     $params['mappingservice'] = new Parameter('mappingservice');
     $params['mappingservice']->addAliases('service');
     $params['mappingservice']->setDefault($egMapsDefaultService);
     $params['mappingservice']->addCriteria(new CriterionInArray(MapsMappingServices::getAllServiceValues()));
     $params['geoservice'] = new Parameter('geoservice');
     $params['geoservice']->setDefault($egMapsDefaultGeoService);
     $params['geoservice']->addCriteria(new CriterionInArray($egMapsAvailableGeoServices));
     $params['geoservice']->addDependencies('mappingservice');
     $params['geoservice']->addManipulations(new MapsParamGeoService('mappingservice'));
     $params['geoservice']->setDescription(wfMsg('maps-par-geoservice'));
     $params['zoom'] = new Parameter('zoom', Parameter::TYPE_INTEGER);
     $params['zoom']->setDescription(wfMsg('maps-par-zoom'));
     $params['width'] = new Parameter('width', Parameter::TYPE_STRING, $egMapsMapWidth, array(), array(new CriterionMapDimension('width')));
     $params['width']->addManipulations(new MapsParamDimension('width'));
     $params['width']->setDescription(wfMsg('maps-par-width'));
     $params['height'] = new Parameter('height', Parameter::TYPE_STRING, $egMapsMapHeight, array(), array(new CriterionMapDimension('height')));
     $params['height']->addManipulations(new MapsParamDimension('height'));
     $params['height']->setDescription(wfMsg('maps-par-height'));
     return $params;
 }
Exemplo n.º 6
0
 /**
  * @see ParamDefinition::postConstruct()
  *
  * @since 2.0
  */
 protected function postConstruct()
 {
     global $egMapsDefaultService, $egMapsDefaultServices;
     $this->setDefault(array_key_exists($this->feature, $egMapsDefaultServices) ? $egMapsDefaultServices[$this->feature] : $egMapsDefaultService);
     $this->allowedValues = MapsMappingServices::getAllServiceValues();
 }