/usr/share/php/kohana2/modules/gmaps/libraries/Gmap_Icon.php is in libkohana2-modules-php 2.3.4-1.
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | <?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* GMaps Icon library.
*
* $Id$
*
* @package Gmaps
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @license http://kohanaphp.com/license.html
*/
class Gmap_Icon_Core {
// Valid options
protected $valid_options = array
(
'image',
'shadow',
'iconSize',
'shadowSize',
'iconAnchor',
'infoWindowAnchor',
'printImage',
'mozPrintImage',
'printShadow',
'transparent',
'imageMap',
'maxHeight',
'dragCrossImage',
'dragCrossSize',
'dragCrossAnchor'
);
// Settable options
protected $options = array();
// Icon name
protected $name;
/**
* Create a new GMap icon
*
* @param string $name icon name
* @param array $options GMap2 icon options
* @return void
*/
public function __construct($name, array $options)
{
// set icon name
$this->name = $name;
foreach ($options as $key => $value)
{
if (in_array($key, $this->valid_options, true))
{
// Set all valid methods
switch($key)
{
case 'image':
case 'shadow':
case 'printImage':
case 'mozPrintImage':
case 'printShadow':
case 'transparent':
case 'dragCrossImage':
$this->set_url($key, $value);
break;
case 'iconAnchor':
case 'infoWindowAnchor':
case 'infoShadowAnchor':
case 'dragCrossAnchor':
$this->set_point($key, $value);
break;
case 'iconSize':
case 'shadowSize':
case 'dragCrossSize':
$this->set_size($key, $value);
break;
default:
$this->options[$key] = json_encode($value);
break;
}
}
}
}
public function set_url($key, $url)
{
$this->options[$key] = (valid::url($url)) ? '"'.$url.'";' : '"'.url::site($url).'";';
}
public function set_size($key, $val)
{
$this->options[$key] = 'new google.maps.Size('.implode(',', $val).');';
}
public function set_point($key, $val)
{
$this->options[$key] = 'new google.maps.Point('.implode(',', $val).');';
}
public function render($tabs = 0)
{
// Create the tabs
$tabs = empty($tabs) ? '' : str_repeat("\t", $tabs);
$output = array();
// Render each option
$output[] = "var $this->name = ".((count($this->options) > 1) ? 'new google.maps.Icon();' : 'new google.maps.Icon(G_DEFAULT_ICON);');
foreach($this->options as $option => $value)
{
$output[] = "$this->name.$option = $value";
}
return implode("\n".$tabs, $output);
}
} // End Gmap Icon
|