<?php
/**
* plugin_googlemap2.php,v 2.12 2008/07/29 13:34:11
* @copyright (C) Reumer.net
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
/* ----------------------------------------------------------------
* 2008-07-29 version 2.12: Improved by Mike Reumer
* - use no javascript message of the language defined in Joomla.
* - Changed proxy so local file are read local and also use file gets too
* - Added domready instead of timeout, so in IE less problems with other modules
* - Added multiple kml files
* - Changed when to place marker and text
* - Better solution for placing marker or no marker
* - Simple directions on map
* - Sorting of items inside top items of kml-file
* - Directions in lightbox and possibility to use print version of directions
* - Streetview with button!
* - On map directions
* - 3D and automatic control
* - lightbox out of infowindow
* - navigation label
* - Wiki/panoramio layer
* - Changed adsmanager
/* ----------------------------------------------------------------
/** ensure this file is being included by a parent file */
if (defined( '_JEXEC' )) {
$mainframe->registerEvent( 'onPrepareContent', 'Pre15x_PluginGoogleMap2' );
$mainframe->registerEvent( 'onMap', 'Pre15x_PluginGoogleMap2' );
} elseif (defined( '_VALID_MOS' )) {
global $mainframe;
$_MAMBOTS->registerFunction( 'onPrepareContent', 'Pre10x_PluginGoogleMap2' );
$_MAMBOTS->registerFunction( 'onMap', 'Pre10xonMap_PluginGoogleMap2' );
} else {
die( 'Restricted access' );
}
if (!defined('_CMN_JAVASCRIPT')) define('_CMN_JAVASCRIPT', "<b>JavaScript must be enabled in order for you to use Google Maps.</b> <br/>However, it seems JavaScript is either disabled or not supported by your browser. <br/>To view Google Maps, enable JavaScript by changing your browser options, and then try again.");
/* Switch call to function of 1.5 to the real module
*/
function Pre15x_PluginGoogleMap2( &$row, &$params, $page=0 ) {
$database = &JFactory::getDBO();
// Get Plugin info
$plugin =& JPluginHelper::getPlugin('content', 'plugin_googlemap2');
$plugin_params = new JParameter( $plugin->params );
$joomla_version = 1.5;
//$published = $plugin->published;
// Solve bug in Joomal 1.5 that when plugin is unpublished that the tag is not removed
// So use a parameter of plugin to set published for Joomla 1.5
$published = $plugin_params->get( 'publ', '0' );
// If format=feed then remove plugin so not published
$format = JRequest::getVar('format', '');
if ($format=="feed"||$format=="pdf") // PDF is not working and {mosmap} shows in pfd
$published=0;
$option = JRequest::getVar('option', '');
$view = JRequest::getVar('view', '');
$task = JRequest::getVar('task', '');
if (!($option=='com_content'&&$view=='article'&&$task=="edit")) {
$id = intval( JRequest::getVar('id', null) );
$id = explode(":", $id);
$id = $id[0];
$pluginmap = new PluginGoogleMap2();
if( !$pluginmap->core($published, $row, $params, $page, $plugin_params, $id, $joomla_version) ){
echo "problem";
}
unset ($id, $pluginmap);
}
unset($database, $plugin, $plugin_params, $joomla_version, $published, $format, $option, $view, $task);
return true;
}
/* Switch call to function of 1.0.x to the real module
*/
function Pre10x_PluginGoogleMap2( $published, &$row, $mask=0, $page=0 ) {
global $database;
// load plugin parameters
$query = "SELECT id"
. "\n FROM #__mambots"
. "\n WHERE element = 'plugin_googlemap2'"
. "\n AND folder = 'content'"
;
$database->setQuery( $query );
$id = $database->loadResult();
$plugin = new mosMambot( $database );
$plugin->load( $id );
$plugin_params = new mosParameters( $plugin->params );
$joomla_version = 1.0;
$id = intval( mosGetParam( $_REQUEST, 'id', null ) );
$pluginmap = new PluginGoogleMap2();
if( !$pluginmap->core($published, $row, $mask, $page, $plugin_params, $id, $joomla_version) ){
echo "problem";
}
unset($query, $id, $plugin, $plugin_params, $joomla_version, $pluginmap);
return true;
}
function Pre10xonMap_PluginGoogleMap2( $published, &$row, $mask=0, $page=0 ) {
global $database;
// load plugin parameters
$query = "SELECT id"
. "\n FROM #__mambots"
. "\n WHERE element = 'plugin_googlemap2'"
. "\n AND folder = 'content'"
;
$database->setQuery( $query );
$id = $database->loadResult();
$plugin = new mosMambot( $database );
$plugin->load( $id );
$plugin_params = new mosParameters( $plugin->params );
$joomla_version = 1.0;
$id = intval( mosGetParam( $_REQUEST, 'id', null ) );
$pluginmap = new PluginGoogleMap2();
$pluginmap->event = '10xonMap';
if( !$pluginmap->core($published, $row, $mask, $page, $plugin_params, $id, $joomla_version) ){
echo "problem";
}
unset($query, $id, $plugin, $plugin_params, $joomla_version, $pluginmap);
return true;
}
class PluginGoogleMap2 {
var $debug_plugin = '0';
var $debug_text = '';
var $event = '';
/* If PHP < 5 then htmlspecialchars_decode doesn't exists
*/
function _htsdecode($string, $options=0) {
if (function_exists('htmlspecialchars_decode')) {
return htmlspecialchars_decode($string, $options);
} else {
return strtr($string,array_flip(get_html_translation_table(HTML_SPECIALCHARS, $options)));
}
}
function debug_log($text)
{
if ($this->debug_plugin =='1')
$this->debug_text .= "\n// ".$text." (".round($this->memory_get_usage()/1024)." KB)";
return;
}
function get_index($string, $brackets)
{
if ($brackets=='[') {
$string = preg_replace("/^.*\[/", '', $string);
$string = preg_replace("/\].*$/", '', $string);
} else {
$string = preg_replace("/^.*\(/", '', $string);
$string = preg_replace("/\).*$/", '', $string);
}
return $string;
}
// Only define function if it doesn't exist
function memory_get_usage()
{
if ( function_exists( 'memory_get_usage' ) )
return memory_get_usage();
else
return 0;
}
function injectCustomHeadTags($html, $check, &$row) {
global $mainframe;
// Get buffer
// Is there a difference between J15/J10
$buf = &$row;
if (!function_exists('jimport')) {
// version 1.0.x
$screen = ob_get_contents();
$header = $mainframe->getHead();
} else {
$screen = '';
$header = '';
$header = $mainframe->getHead();
}
// Check if code already is inserted?
$check = str_replace("/", "\/",$check);
$check = str_replace(".", "\.",$check);
$check = str_replace("?", "\?",$check);
$check = "/".$check."/is";
$chk = preg_match($check, $buf) + preg_match($check, $screen) + preg_match($check, $header);
if ($chk==0) {
// Check for head
$head = preg_match("/<head>/is", $buf);
$hd = preg_match("/<head>/is", $screen);
// if no head do mainframe replace
if ($head==0) {
// With Joomla 10x onMap add header doesn't work
if ($hd==0) {
$this->debug_log("Mainframe header replace");
$mainframe->addCustomHeadTag($html);
}
else {
$this->debug_log("With Joomla 10x onMap add header doesn't work and header not available so place it in body");
echo $html;
}
} else {
// if head then place in head the scripts
$buf = preg_replace("/<head(| .*?)>(.*?)<\/head>/is", "<head$1>$2".$html."</head>", $buf);
}
} else
$this->debug_log("No replace script already available");
unset($buf, $screen, $header, $check, $chk, $head, $hd);
}
/* If PHP < 5 then SimpleXMLElement doesn't exists
*/
function get_geo($protocol, $googlewebsite, $address, $key)
{
$this->debug_log("get_geo(".$address.")");
$coords = '';
$getpage='';
$replace = array("\n", "\r", "<br/>", "<br />", "<br>", "<br>", "<br />", "<br/>");
$address = str_replace($replace, '', $address);
// Convert address to utf-8
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
plugin_googlemap_J15.2.12m_zh-CN.zip (63个子文件)
plugin_googlemap_J15.2.12
StreetViewControl
.svn
props
entries 516B
text-base
index.html.svn-base 56B
StreetViewControl.js.svn-base 5KB
tmp
props
text-base
prop-base
prop-base
StreetViewControl.js 5KB
index.html 56B
moodalbox121
css
.svn
props
entries 481B
text-base
index.html.svn-base 56B
moodalbox.css.svn-base 1KB
tmp
props
text-base
prop-base
prop-base
moodalbox.css 1KB
index.html 56B
.svn
props
entries 375B
text-base
index.html.svn-base 56B
tmp
props
text-base
prop-base
prop-base
img
.svn
props
entries 631B
text-base
index.html.svn-base 56B
loading.gif.svn-base 1KB
closelabel.gif.svn-base 777B
tmp
props
text-base
prop-base
prop-base
loading.gif.svn-base 53B
closelabel.gif.svn-base 53B
loading.gif 1KB
index.html 56B
closelabel.gif 777B
js
modalbox1.2hack.js 8KB
.svn
props
entries 512B
text-base
index.html.svn-base 56B
modalbox1.2hack.js.svn-base 8KB
tmp
props
text-base
prop-base
prop-base
index.html 56B
index.html 56B
panoramiolayer
.svn
props
entries 510B
text-base
index.html.svn-base 56B
panoramiolayer.js.svn-base 4KB
tmp
props
text-base
prop-base
prop-base
index.html 56B
panoramiolayer.js 4KB
plugin_googlemap2_proxy.php 2KB
.svn
props
entries 1KB
text-base
index.html.svn-base 56B
plugin_googlemap2_proxy.php.svn-base 2KB
plugin_googlemap2.xml.svn-base 31KB
plugin_googlemap2.php.svn-base 98KB
tmp
props
text-base
prop-base
prop-base
plugin_googlemap2.php 98KB
mootools
mootools-release-1.11.js 24KB
.svn
props
entries 484B
text-base
index.html.svn-base 56B
mootools-release-1.11.js.svn-base 24KB
tmp
props
text-base
prop-base
prop-base
index.html 56B
directions
directions.js 10KB
.svn
props
entries 662B
text-base
index.html.svn-base 56B
directions.js.svn-base 10KB
directions.css.svn-base 2KB
tmp
props
text-base
prop-base
prop-base
index.html 56B
directions.css 2KB
language
.svn
props
entries 385B
text-base
en-GB.plg_content_plugin_googlemap2.ini.svn-base 5KB
tmp
props
text-base
prop-base
prop-base
en-GB.plg_content_plugin_googlemap2.ini 5KB
zh-CN.plg_content_plugin_googlemap2.ini 5KB
geoxml
.svn
props
entries 495B
text-base
index.html.svn-base 56B
geoxml.js.svn-base 57KB
tmp
geoxml.js.tmp 57KB
props
text-base
prop-base
prop-base
geoxml.js 57KB
index.html 56B
index.html 56B
plugin_googlemap2.xml 30KB
共 63 条
- 1
资源评论
- zheren77882013-03-13很好用,适用于joomla1.5~~
- ylong522013-04-12很好用,可以下载
baotongliu
- 粉丝: 6
- 资源: 84
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功