コード例 #1
0
ファイル: snippet.Gmap.php プロジェクト: hitodev/gmarker
// Props that influence the address fingerprint and the Lat/Lng cache
$props = array();
$props['address'] = $modx->getOption('address', $scriptProperties, $modx->getOption('gmarker.formatting_string'));
$props['latlng'] = $modx->getOption('latlng', $scriptProperties, '');
$props['bounds'] = $modx->getOption('bounds', $scriptProperties, $modx->getOption('gmarker.bounds'));
$props['components'] = $modx->getOption('components', $scriptProperties, $modx->getOption('gmarker.components'));
$props['region'] = $modx->getOption('region', $scriptProperties, $modx->getOption('gmarker.region'));
$props['language'] = $modx->getOption('language', $scriptProperties, $modx->getOption('gmarker.language'));
// Other props that are used in the output
$props2 = array();
$props2['h'] = (int) $modx->getOption('height', $scriptProperties, $modx->getOption('gmarker.default_height'));
$props2['w'] = (int) $modx->getOption('width', $scriptProperties, $modx->getOption('gmarker.default_width'));
$props2['id'] = $modx->getOption('id', $scriptProperties, 'map');
$props2['zoom'] = $modx->getOption('zoom', $scriptProperties, 15);
$props2['type'] = $modx->getOption('type', $scriptProperties, 'ROADMAP');
$props2['gmarker_url'] = $Gmarker->get_maps_url(array('key' => $modx->getOption('gmarker.apikey')), $secure);
// Verify inputs
if (empty($address) && empty($latlng) && empty($components)) {
    $modx->log(xPDO::LOG_LEVEL_ERROR, '[Gmap] ' . $modx->lexicon('missing_params'));
    return $Gmarker->alert($modx->lexicon('missing_params'));
}
if (!$props2['h']) {
    $props2['h'] = 300;
}
if (!$props2['w']) {
    $props2['w'] = 500;
}
// Handle lookups and caching
// Fingerprint the lookup
$json = $Gmarker->lookup($props);
// Pull the coordinates out