/usr/share/php/kohana2/modules/gmaps/libraries/Gmap_Marker.php is in libkohana2-modules-php 2.3.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <?php defined('SYSPATH') OR die('No direct access allowed.');
class Gmap_Marker_Core {
// Marker HTML
public $html;
// Latitude and longitude
public $latitude;
public $longitude;
// Marker ID
protected static $id = 0;
// Marker Options
protected $options = array();
protected $valid_options = array
(
'icon',
'dragCrossMove',
'title',
'clickable',
'draggable',
'bouncy',
'bounceGravity',
'autoPan'
);
/**
* Create a new GMap marker.
*
* @param float $lat latitude
* @param float $lon longitude
* @param string $html HTML of info window
* @param array $options marker options
* @return void
*/
public function __construct($lat, $lon, $html, $options = array())
{
if ( ! is_numeric($lat) OR ! is_numeric($lon))
throw new Kohana_Exception('gmaps.invalid_marker', $lat, $lon);
// Set the latitude and longitude
$this->latitude = $lat;
$this->longitude = $lon;
// Set the info window HTML
$this->html = $html;
if (count($options) > 0)
{
foreach ($options as $option => $value)
{
// Set marker options
if (in_array($option, $this->valid_options, true))
$this->options[] = "$option:$value";
}
}
}
public function render($tabs = 0)
{
// Create the tabs
$tabs = empty($tabs) ? '' : str_repeat("\t", $tabs);
// Marker ID
$marker = 'm'.++self::$id;
$output[] = 'var '.$marker.' = new google.maps.Marker(new google.maps.LatLng('.$this->latitude.', '.$this->longitude.'), {'.implode(",", $this->options).'});';
if ($html = $this->html)
{
$output[] = 'google.maps.Event.addListener('.$marker.', "click", function()';
$output[] = '{';
$output[] = "\t".$marker.'.openInfoWindowHtml(';
$output[] = "\t\t'".implode("'+\n\t\t$tabs'", explode("\n", $html))."'";
$output[] = "\t);";
$output[] = '});';
}
$output[] = 'map.addOverlay('.$marker.');';
return implode("\n".$tabs, $output);
}
} // End Gmap Marker
|