function mapfile_getmeta($fname) { if (extension_loaded('mapscript')) { $map = new mapObj($_SESSION['mapfile-generator']['mapfile']); $meta = array(); $meta['name'] = $map->name; $meta['extent'] = array($map->extent->minx, $map->extent->miny, $map->extent->maxx, $map->extent->maxy); if (preg_match('/(epsg:[0-9]+)/i', $map->getProjection(), $_p)) { $meta['projection'] = $_p[1]; } else { $map_projection = 'epsg:3857'; } $meta['wms'] = strlen($map->getMetaData('wms_enable_request')) > 0; if ($meta['wms']) { $meta['wmstitle'] = strlen($map->getMetaData('wms_title')) > 0 ? $map->getMetaData('wms_title') : NULL; $meta['wmsabstract'] = strlen($map->getMetaData('wms_abstract')) > 0 ? $map->getMetaData('wms_abstract') : NULL; $meta['wmsattributiontitle'] = strlen($map->getMetaData('wms_attribution_title')) > 0 ? $map->getMetaData('wms_attribution_title') : NULL; $meta['wmsattributiononlineresource'] = strlen($map->getMetaData('wms_attribution_onlineresource')) > 0 ? $map->getMetaData('wms_attribution_onlineresource') : NULL; } $map->free(); unset($map); } else { $map = new MapFile\Map($_SESSION['mapfile-generator']['mapfile']); $meta = array(); $meta['name'] = $map->name; $meta['extent'] = $map->extent; $meta['projection'] = !is_null($map->projection) ? $map->projection : 'epsg:3857'; $meta['wms'] = $map->getMetadata('wms_enable_request') !== FALSE; if ($meta['wms']) { $meta['wmstitle'] = $map->getMetadata('wms_title') !== FALSE ? $map->getMetadata('wms_title') : NULL; $meta['wmsabstract'] = $map->getMetadata('wms_abstract') !== FALSE ? $map->getMetadata('wms_abstract') : NULL; $meta['wmsattributiontitle'] = strlen($map->getMetaData('wms_attribution_title')) > 0 ? $map->getMetaData('wms_attribution_title') : NULL; $meta['wmsattributiononlineresource'] = strlen($map->getMetaData('wms_attribution_onlineresource')) > 0 ? $map->getMetaData('wms_attribution_onlineresource') : NULL; } } if (isset($meta)) { return $meta; } else { return FALSE; } }