当前位置: 首页>>代码示例>>PHP>>正文


PHP UserHelper::getBrowserDefaultLanguage方法代码示例

本文整理汇总了PHP中UserHelper::getBrowserDefaultLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::getBrowserDefaultLanguage方法的具体用法?PHP UserHelper::getBrowserDefaultLanguage怎么用?PHP UserHelper::getBrowserDefaultLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


在下文中一共展示了UserHelper::getBrowserDefaultLanguage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render($params = array())
 {
     // init vars
     $location = $this->_data->get('location');
     $locale = $this->_config->get('locale');
     // init display params
     $params = new YArray($params);
     $layout_path = $params->get('layout_path');
     $layout = $params->get('layout');
     $width = $params->get('width');
     $width_unit = $params->get('width_unit');
     $height = $params->get('height');
     $marker_popup = $params->get('marker_popup');
     $zoom_level = $params->get('zoom_level');
     $map_controls = $params->get('map_controls');
     $scroll_wheel_zoom = $params->get('scroll_wheel_zoom');
     $map_type = $params->get('map_type');
     $map_controls = $params->get('map_controls');
     $type_controls = $params->get('type_controls');
     $directions = $params->get('directions');
     $main_icon = $params->get('main_icon');
     $information = $params->get('information');
     // determine locale
     if (empty($locale) || $locale == 'auto') {
         $locale = UserHelper::getBrowserDefaultLanguage();
     }
     // get marker text
     $marker_text = '';
     $renderer = new ItemRenderer();
     $renderer->addPath($layout_path);
     if ($item = $this->getItem()) {
         $path = 'item';
         $prefix = 'item.';
         $type = $item->getType()->id;
         if ($renderer->pathExists($path . DIRECTORY_SEPARATOR . $type)) {
             $path .= DIRECTORY_SEPARATOR . $type;
             $prefix .= $type . '.';
         }
         if (in_array($layout, $renderer->getLayouts($path))) {
             $marker_text = $renderer->render($prefix . $layout, array('item' => $item));
         } else {
             $marker_text = $item->name;
         }
     }
     // get geocode cache
     $cache = new YCache(ZOO_CACHE_PATH . DS . 'geocode_cache.txt');
     if (!$cache->check()) {
         return "<div class=\"alert\"><strong>Cache not writeable please update the file permissions! (geocode_cache.txt)</strong></div>\n";
     }
     // get map center coordinates
     $center = GooglemapsHelper::locate($location, $cache);
     if (!$center) {
         return "<div class=\"alert\"><strong>Unable to get map center coordinates, please verify your location! (" . $location . ")</strong></div>\n";
     }
     // save location to geocode cache
     if ($cache) {
         $cache->save();
     }
     // css parameters
     $maps_id = 'googlemaps-' . $this->_item->id;
     $css_module_width = 'width: ' . $width . $width_unit . ';';
     $css_module_height = 'height: ' . $height . 'px;';
     $from_address = JText::_('From address:');
     $get_directions = JText::_('Get directions');
     $empty = JText::_('Please fill in your address.');
     $not_found = JText::_('Sorry, address not found!');
     $address_not_found = ', ' . JText::_('not found!');
     // js parameters
     $javascript = "\$('#{$maps_id}').Googlemaps({ lat:" . $center['lat'] . ", lng:" . $center['lng'] . ", popup: " . $marker_popup . ", text: '" . GooglemapsHelper::stripText($marker_text) . "', zoom: " . $zoom_level . ", mapCtrl: " . $map_controls . ", zoomWhl: " . $scroll_wheel_zoom . ", mapType: " . $map_type . ", typeCtrl: " . $type_controls . ", directions: " . $directions . ", locale: '" . $locale . "', mainIcon:'" . $main_icon . "', msgFromAddress: '" . $from_address . "', msgGetDirections: '" . $get_directions . "', msgEmpty: '" . $empty . "', msgNotFound: '" . $not_found . "', msgAddressNotFound: '" . $address_not_found . "' });";
     $javascript = "jQuery(function(\$) { {$javascript} });";
     // render layout
     if ($layout = $this->getLayout()) {
         return self::renderLayout($layout, array('maps_id' => $maps_id, 'javascript' => $javascript, 'css_module_width' => $css_module_width, 'css_module_height' => $css_module_height, 'information' => $information, 'locale' => $locale));
     }
     return null;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:76,代码来源:googlemaps.php


注:本文中的UserHelper::getBrowserDefaultLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。