function DoMap($bbcode, $action, $name, $default, $params, $content) { static $id = false; static $sensor = true; if ($action == BBCODE_CHECK) return true; $document = JFactory::getDocument(); if ($id === false) { $document->addScript('http://maps.google.com/maps/api/js?sensor='.($sensor == true ? 'true' : 'false')); $id = 0; } $id ++; $mapid = 'kgooglemap'.$id; $map_type = isset($params ["type"]) ? strtoupper($params ["type"]): 'ROADMAP'; $map_typeId = array('HYBRID','ROADMAP','SATELLITE','TERRAIN'); if ( !in_array($map_type, $map_typeId) ) $map_type = 'ROADMAP'; $map_zoom = isset($params ["zoom"]) ? $params ["zoom"]: '10'; $map_control = $params ["control"] ? $params ["control"] : 0; $document->addScriptDeclaration(" // <![CDATA[ var geocoder; var $mapid; window.addEvent('domready', function() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(37.333586,-121.894684); var myOptions = { zoom: 10, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; $mapid = new google.maps.Map(document.id('".$mapid."'), myOptions); var address = '$content'; if (geocoder) { geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { $mapid.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ zoom: $map_zoom, disableDefaultUI: $map_control, center: latlng, mapTypeId: google.maps.MapTypeId.$map_type }); } else { var contentString = '<p><strong>".KunenaHtmlParser::JSText('COM_KUNENA_GOOGLE_MAP_NO_GEOCODE')." <i>$content</i></strong></p>'; var infowindow$mapid = new google.maps.InfoWindow({ content: contentString }); infowindow$mapid.open($mapid); } }); } }); // ]]>" ); return '<div id="'.$mapid.'" class="kgooglemap">'.KunenaHtmlParser::JSText('COM_KUNENA_GOOGLE_MAP_NOT_VISIBLE').'</div>'; }
echo KunenaHtmlParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOAPPLY1'); ?>')" /><br /> <?php echo JText::_('COM_KUNENA_EDITOR_VIDEO_URL'); ?><input id="kvideourl" name="videourl" type="text" size="30" maxlength="250" value="http://" onmouseover="javascript:document.id('helpbox').set('value', '<?php echo KunenaHtmlParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOURL'); ?>')" /> <input id="kbutton_addvideo2" type="button" name="Video" accesskey="p" onclick="kInsertVideo2()" value="<?php echo JText::_('COM_KUNENA_EDITOR_VIDEO_INSERT'); ?>" onmouseover="javascript:document.id('helpbox').set('value', '<?php echo KunenaHtmlParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOAPPLY2'); ?>')" /> </div> </td> </tr> <?php } if (!$this->config->disemoticons) : ?> <tr> <td class="kpostbuttons"> <div id="smilie"><?php $emoticons = KunenaHtmlParser::getEmoticons(0, 1); foreach ( $emoticons as $emo_code=>$emo_url ) { echo '<img class="btnImage" src="' . $emo_url . '" border="0" alt="' . $emo_code . ' " title="' . $emo_code . ' " onclick="kbbcode.insert(\' '. $emo_code .' \', \'after\', true);" style="cursor:pointer"/> '; } ?>
function DoMap($bbcode, $action, $name, $default, $params, $content) { static $id = false; static $sensor = true; if ($action == BBCODE_CHECK) { return true; } $content = htmlspecialchars($content); $document = JFactory::getDocument(); if (!$document instanceof JDocumentHTML) { return '[MAP]'; } if ($id === false) { $document->addScript('http://maps.google.com/maps/api/js?sensor=' . ($sensor == true ? 'true' : 'false')); $id = 0; } $id++; $mapid = 'kgooglemap' . $id; $map_type = isset($params["type"]) ? strtoupper($params["type"]) : 'ROADMAP'; $map_typeId = array('HYBRID', 'ROADMAP', 'SATELLITE', 'TERRAIN'); if (!in_array($map_type, $map_typeId)) { $map_type = 'ROADMAP'; } $map_zoom = isset($params["zoom"]) ? $params["zoom"] : '10'; $map_control = $params["control"] ? $params["control"] : 0; $document->addScriptDeclaration("\n\t\t// <![CDATA[\n\t\t\tvar geocoder;\n\t\t\tvar {$mapid};\n\n\t\t\twindow.addEvent('domready', function() {\n\t\t\t\tgeocoder = new google.maps.Geocoder();\n\t\t\tvar latlng = new google.maps.LatLng(37.333586,-121.894684);\n\t\t\tvar myOptions = {\n\t\t\t\tzoom: 10,\n\t\t\t\tcenter: latlng,\n\t\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP\n\t\t\t};\n\t\t\t{$mapid} = new google.maps.Map(document.id('" . $mapid . "'), myOptions);\n\n\t\t\tvar address = '{$content}';\n\t\t\tif (geocoder) {\n\t\t\t\tgeocoder.geocode( { 'address': address}, function(results, status) {\n\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\t{$mapid}.setCenter(results[0].geometry.location);\n\t\t\t\t\tvar marker = new google.maps.Marker({\n\t\t\t\t\t\tzoom: {$map_zoom},\n\t\t\t\t\t\tdisableDefaultUI: {$map_control},\n\t\t\t\t\t\tcenter: latlng,\n\t\t\t\t\t\tmapTypeId: google.maps.MapTypeId.{$map_type}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tvar contentString = '<p><strong>" . KunenaHtmlParser::JSText('COM_KUNENA_GOOGLE_MAP_NO_GEOCODE') . " <i>{$content}</i></strong></p>';\n\t\t\t\t\tvar infowindow{$mapid} = new google.maps.InfoWindow({ content: contentString });\n\t\t\t\t\t\tinfowindow{$mapid}.open({$mapid});\n\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\t});\n\n\t\t// ]]>"); return '<div id="' . $mapid . '" class="kgooglemap">' . KunenaHtmlParser::JSText('COM_KUNENA_GOOGLE_MAP_NOT_VISIBLE') . '</div>'; }