示例#1
0
 /**
  * Initialization function for Maps query printer functionality.
  */
 public static function initialize()
 {
     global $wgAutoloadClasses, $egMapsDefaultServices;
     $wgAutoloadClasses['SMQueryHandler'] = __DIR__ . '/SM_QueryHandler.php';
     $wgAutoloadClasses['SMMapPrinter'] = __DIR__ . '/SM_MapPrinter.php';
     $wgAutoloadClasses['SMKMLPrinter'] = __DIR__ . '/SM_KMLPrinter.php';
     self::initFormat('kml', 'SMKMLPrinter');
     foreach (MapsMappingServices::getServiceIdentifiers() as $serviceIdentifier) {
         $service = MapsMappingServices::getServiceInstance($serviceIdentifier);
         // Check if the service has a query printer.
         $QPClass = $service->getFeature('qp');
         // If the service has no QP, skipt it and continue with the next one.
         if ($QPClass === false) {
             continue;
         }
         // Initiate the format.
         $aliases = $service->getAliases();
         // Add the 'map' result format if there are mapping services that have QP's loaded.
         if ($egMapsDefaultServices['qp'] == $serviceIdentifier) {
             $aliases[] = 'map';
         }
         self::initFormat($service->getName(), 'SMMapPrinter', $aliases);
     }
     return true;
 }
示例#2
0
 public static function initialize()
 {
     global $wgAutoloadClasses;
     // This code should not get called when SF is not loaded, but let's have this
     // check to not run into problems when people mess up the settings.
     if (!defined('SF_VERSION')) {
         return true;
     }
     $wgAutoloadClasses['SMFormInput'] = __DIR__ . '/SM_FormInput.php';
     $hasFormInputs = false;
     foreach (MapsMappingServices::getServiceIdentifiers() as $serviceIdentifier) {
         $service = MapsMappingServices::getServiceInstance($serviceIdentifier);
         // Check if the service has a form input.
         $FIClass = $service->getFeature('fi');
         // If the service has no FI, skipt it and continue with the next one.
         if ($FIClass === false) {
             continue;
         }
         // At least one form input will be enabled when this point is reached.
         $hasFormInputs = true;
         // Add the result form input type for the service name.
         self::initFormHook($service->getName(), $service->getName());
         // Loop through the service alliases, and add them as form input types.
         foreach ($service->getAliases() as $alias) {
             self::initFormHook($alias, $service->getName());
         }
     }
     // Add the 'map' form input type if there are mapping services that have FI's loaded.
     if ($hasFormInputs) {
         self::initFormHook('map');
     }
     self::initFormHook('googlemapsEditor');
     return true;
 }
示例#3
0
 /**
  * Initialization function for Maps query printer functionality.
  */
 public static function initialize()
 {
     global $wgAutoloadClasses;
     $wgAutoloadClasses['SMQueryHandler'] = dirname(__FILE__) . '/SM_QueryHandler.php';
     $wgAutoloadClasses['SMMapper'] = dirname(__FILE__) . '/SM_Mapper.php';
     $wgAutoloadClasses['SMMapPrinter'] = dirname(__FILE__) . '/SM_MapPrinter.php';
     $wgAutoloadClasses['SMKMLPrinter'] = dirname(__FILE__) . '/SM_KMLPrinter.php';
     self::initFormat('kml', 'SMKMLPrinter');
     $hasQueryPrinters = false;
     foreach (MapsMappingServices::getServiceIdentifiers() as $serviceIdentifier) {
         $service = MapsMappingServices::getServiceInstance($serviceIdentifier);
         // Check if the service has a query printer.
         $QPClass = $service->getFeature('qp');
         // If the service has no QP, skipt it and continue with the next one.
         if ($QPClass === false) {
             continue;
         }
         // At least one query printer will be enabled when this point is reached.
         $hasQueryPrinters = true;
         // Initiate the format.
         $aliases = $service->getAliases();
         self::initFormat($service->getName(), 'SMMapper', $aliases);
     }
     // Add the 'map' result format if there are mapping services that have QP's loaded.
     if ($hasQueryPrinters) {
         self::initFormat('map', 'SMMapper');
     }
     return true;
 }