本文整理汇总了PHP中map::base方法的典型用法代码示例。如果您正苦于以下问题:PHP map::base方法的具体用法?PHP map::base怎么用?PHP map::base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map
的用法示例。
在下文中一共展示了map::base方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layers_array
/**
* Generate the Map Array.
* These are the maps that show up in the Layer Switcher
* if $all is set to TRUE all maps are rendered
* **caveat is that each mapping api js must be loaded **
*
* @param bool $all
* @return string $js
*/
public static function layers_array($all = FALSE)
{
// Javascript
$js = "[";
// Get All Layers
$layers = map::base();
// Next get the default base layer
$default_map = Kohana::config('settings.default_map');
if (!isset($layers[$default_map])) {
// Map Layer Doesn't Exist - default to google
$default_map = "google_normal";
}
// Get openlayers type
$openlayers_type = $layers[$default_map]->openlayers;
$js .= $default_map;
foreach ($layers as $layer) {
if ($layer->name != $default_map and $layer->active) {
if ($all == TRUE) {
$js .= "," . $layer->name;
} else {
if ($layer->openlayers == $openlayers_type) {
$js .= "," . $layer->name;
}
}
}
}
$js .= "]";
return $js;
}
示例2: _generate_settings_map_js
private function _generate_settings_map_js()
{
$map_layers = array();
$layers = map::base();
foreach ($layers as $layer) {
$map_layers[$layer->name] = array();
$map_layers[$layer->name]['title'] = $layer->title;
$map_layers[$layer->name]['openlayers'] = $layer->openlayers;
if (isset($layer->api_signup)) {
$map_layers[$layer->name]['api_signup'] = $layer->api_signup;
} else {
$map_layers[$layer->name]['api_signup'] = "";
}
}
return json_encode($map_layers);
}
示例3: date_default_timezone_set
Kohana::config_set('settings.email_host', $settings->email_host);
Kohana::config_set('settings.email_servertype', $settings->email_servertype);
Kohana::config_set('settings.email_ssl', $settings->email_ssl);
Kohana::config_set('settings.alerts_email', $settings->alerts_email);
Kohana::config_set('settings.db_version', $settings->db_version);
Kohana::config_set('settings.ushahidi_version', $settings->ushahidi_version);
Kohana::config_set('settings.private_deployment', $settings->private_deployment);
// Set Site Timezone
if (function_exists('date_default_timezone_set')) {
$timezone = $settings->site_timezone;
// Set default timezone, due to increased validation of date settings
// which cause massive amounts of E_NOTICEs to be generated in PHP 5.2+
date_default_timezone_set(empty($timezone) ? date_default_timezone_get() : $timezone);
Kohana::config_set('settings.site_timezone', $timezone);
}
// Cache Settings
$cache_pages = $settings->cache_pages ? TRUE : FALSE;
Kohana::config_set('cache.cache_pages', $cache_pages);
Kohana::config_set('cache.default.lifetime', $settings->cache_pages_lifetime);
$default_map = $settings->default_map;
$map_layer = map::base($default_map);
if ($map_layer) {
Kohana::config_set('settings.api_url', "<script type=\"text/javascript\" src=\"" . $map_layer->api_url . "\"></script>");
}
// And in case you want to display all maps on one page...
$api_google = $settings->api_google;
$api_yahoo = $settings->api_yahoo;
Kohana::config_set('settings.api_url_all', '<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script><script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=' . $api_yahoo . '"></script><script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false" type="text/javascript"></script>' . html::script('http://www.openstreetmap.org/openlayers/OpenStreetMap.js'));
// Additional Mime Types (KMZ/KML)
Kohana::config_set('mimes.kml', array('text/xml'));
Kohana::config_set('mimes.kmz', array('text/xml'));
示例4: date_default_timezone_set
// which cause massive amounts of E_NOTICEs to be generated in PHP 5.2+
date_default_timezone_set(empty($timezone) ? date_default_timezone_get() : $timezone);
Kohana::config_set('settings.site_timezone', $timezone);
}
// Cache Settings
$cache_pages = (isset($settings['cache_pages']) and $settings['cache_pages']) ? TRUE : FALSE;
Kohana::config_set('cache.cache_pages', $cache_pages);
Kohana::config_set('cache.default.lifetime', isset($settings['cache_pages_lifetime']) ? $settings['cache_pages_lifetime'] : 1800);
$default_map = isset($settings['default_map']) ? $settings['default_map'] : 'osm_mapnik';
$map_layer = map::base($default_map);
if (!empty($map_layer->api_url)) {
Kohana::config_set('settings.api_url', $map_layer->api_url);
}
// And in case you want to display all maps on one page...
$api_url_all = array();
foreach (map::base() as $layer) {
if (empty($layer->api_url)) {
continue;
}
// Add to array, use url as key to avoid dupes
$api_url_all[$layer->api_url] = $layer->api_url;
}
Kohana::config_set('settings.api_url_all', $api_url_all);
// Additional Mime Types (KMZ/KML)
Kohana::config_set('mimes.kml', array('text/xml'));
Kohana::config_set('mimes.kmz', array('text/xml'));
// Set 'settings.forgot_password_key' if not set already
if (!Kohana::config('settings.forgot_password_secret')) {
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+[]{};:,.?`~';
$key = text::random($pool, 64);
Settings_Model::save_setting('forgot_password_secret', $key);