Browse Source

more refactoring

euromark 11 years ago
parent
commit
18fe225c5d

+ 21 - 8
Test/Case/View/Helper/GoogleMapV3HelperTest.php

@@ -9,6 +9,8 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 	public function setUp() {
 	public function setUp() {
 		parent::setUp();
 		parent::setUp();
 
 
+		Configure::delete('Google');
+
 		$this->GoogleMapV3 = new GoogleMapV3Helper(new View(null));
 		$this->GoogleMapV3 = new GoogleMapV3Helper(new View(null));
 	}
 	}
 
 
@@ -16,9 +18,26 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 		$this->assertInstanceOf('GoogleMapV3Helper', $this->GoogleMapV3);
 		$this->assertInstanceOf('GoogleMapV3Helper', $this->GoogleMapV3);
 	}
 	}
 
 
-	public function testMapUrl() {
-		//echo $this->_header(__FUNCTION__);
+	/**
+	 * GoogleMapV3HelperTest::testConfigMerge()
+	 *
+	 * @return void
+	 */
+	public function testConfigMerge() {
+		$config = array(
+			'map' => array(
+				'type' => 'foo',
+			)
+		);
+		Configure::write('Google.zoom', 8);
+		$this->GoogleMapV3 = new GoogleMapV3Helper(new View(null), $config);
 
 
+		$result = $this->GoogleMapV3->settings;
+		$this->assertEquals('foo', $result['map']['type']);
+		$this->assertEquals(8, $result['map']['zoom']);
+	}
+
+	public function testMapUrl() {
 		$url = $this->GoogleMapV3->mapUrl(array('to' => 'Munich, Germany'));
 		$url = $this->GoogleMapV3->mapUrl(array('to' => 'Munich, Germany'));
 		$this->assertEquals('http://maps.google.com/maps?daddr=Munich%2C+Germany', $url);
 		$this->assertEquals('http://maps.google.com/maps?daddr=Munich%2C+Germany', $url);
 
 
@@ -27,8 +46,6 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 	}
 	}
 
 
 	public function testMapLink() {
 	public function testMapLink() {
-		//echo $this->_header(__FUNCTION__);
-
 		$result = $this->GoogleMapV3->mapLink('<To Munich>!', array('to' => '<Munich>, Germany'));
 		$result = $this->GoogleMapV3->mapLink('<To Munich>!', array('to' => '<Munich>, Germany'));
 		$expected = '<a href="http://maps.google.com/maps?daddr=%3CMunich%3E%2C+Germany">&lt;To Munich&gt;!</a>';
 		$expected = '<a href="http://maps.google.com/maps?daddr=%3CMunich%3E%2C+Germany">&lt;To Munich&gt;!</a>';
 		//echo $result;
 		//echo $result;
@@ -36,8 +53,6 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 	}
 	}
 
 
 	public function testLinkWithMapUrl() {
 	public function testLinkWithMapUrl() {
-		//echo $this->_header(__FUNCTION__);
-
 		$url = $this->GoogleMapV3->mapUrl(array('to' => '<München>, Germany'));
 		$url = $this->GoogleMapV3->mapUrl(array('to' => '<München>, Germany'));
 		$result = $this->GoogleMapV3->Html->link('Some title', $url);
 		$result = $this->GoogleMapV3->Html->link('Some title', $url);
 		$expected = '<a href="http://maps.google.com/maps?daddr=%3CM%C3%BCnchen%3E%2C+Germany">Some title</a>';
 		$expected = '<a href="http://maps.google.com/maps?daddr=%3CM%C3%BCnchen%3E%2C+Germany">Some title</a>';
@@ -46,7 +61,6 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 	}
 	}
 
 
 	public function testStaticPaths() {
 	public function testStaticPaths() {
-		//echo '<h2>Paths</h2>';
 		$m = $this->pathElements = array(
 		$m = $this->pathElements = array(
 			array(
 			array(
 				'path' => array('Berlin', 'Stuttgart'),
 				'path' => array('Berlin', 'Stuttgart'),
@@ -76,7 +90,6 @@ class GoogleMapV3HelperTest extends MyCakeTestCase {
 	}
 	}
 
 
 	public function testStaticMarkers() {
 	public function testStaticMarkers() {
-		//echo '<h2>Markers</h2>';
 		$m = $this->markerElements = array(
 		$m = $this->markerElements = array(
 			array(
 			array(
 				'address' => '44.3,11.2',
 				'address' => '44.3,11.2',

+ 5 - 8
View/Helper/CaptchaHelper.php

@@ -30,20 +30,17 @@ class CaptchaHelper extends AppHelper {
 
 
 	protected $operatorConvert = null;
 	protected $operatorConvert = null;
 
 
-	public function __construct($View = null, $settings = array()) {
-		parent::__construct($View, $settings);
+	public function __construct($View = null, $config = array()) {
+		$defaults = CaptchaLib::$defaults + $this->_defaultConfig;
+		$defaults = (array)Configure::read('Captcha') + $defaults;
+		$config += $defaults;
+		parent::__construct($View, $config);
 
 
 		// First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
 		// First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
 		$this->numberConvert = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten');
 		$this->numberConvert = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten');
 
 
 		// Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
 		// Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
 		$this->operatorConvert = array(0 => array('+', __('calcPlus')), 1 => array('-', __('calcMinus')), 2 => '*', __('calcTimes'));
 		$this->operatorConvert = array(0 => array('+', __('calcPlus')), 1 => array('-', __('calcMinus')), 2 => '*', __('calcTimes'));
-
-		$this->settings = $this->_defaultConfig + CaptchaLib::$defaults;
-		$settings = (array)Configure::read('Captcha');
-		if (!empty($settings)) {
-			$this->settings = $settings + $this->settings;
-		}
 	}
 	}
 
 
 	/**
 	/**

+ 4 - 3
View/Helper/DatetimeHelper.php

@@ -9,9 +9,10 @@ class DatetimeHelper extends TimeHelper {
 
 
 	public $helpers = array('Html');
 	public $helpers = array('Html');
 
 
-	public function __construct($View = null, $settings = array()) {
-		$settings = Set::merge(array('engine' => 'Tools.TimeLib'), $settings);
-		parent::__construct($View, $settings);
+	public function __construct($View = null, $config = array()) {
+		$defaults = array('engine' => 'Tools.TimeLib');
+		$config += $defaults;
+		parent::__construct($View, $config);
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 2
View/Helper/DiffHelper.php

@@ -25,8 +25,8 @@ class DiffHelper extends AppHelper {
 	 * Loads the vendor classes and sets the include path for autoloader to work
 	 * Loads the vendor classes and sets the include path for autoloader to work
 	 *
 	 *
 	 */
 	 */
-	public function __construct($View = null, $settings = array()) {
-		parent::__construct($View, $settings);
+	public function __construct($View = null, $config = array()) {
+		parent::__construct($View, $config);
 
 
 		$this->Diff = new DiffLib();
 		$this->Diff = new DiffLib();
 	}
 	}

+ 2 - 2
View/Helper/FormExtHelper.php

@@ -36,7 +36,7 @@ class FormExtHelper extends FormHelper {
 		'autoComplete' => false
 		'autoComplete' => false
 	);
 	);
 
 
-	public function __construct($View = null, $settings = array()) {
+	public function __construct($View = null, $config = array()) {
 		if (($webroot = Configure::read('Asset.webroot')) !== null) {
 		if (($webroot = Configure::read('Asset.webroot')) !== null) {
 			$this->settings['webroot'] = $webroot;
 			$this->settings['webroot'] = $webroot;
 		}
 		}
@@ -44,7 +44,7 @@ class FormExtHelper extends FormHelper {
 			$this->settings['js'] = $js;
 			$this->settings['js'] = $js;
 		}
 		}
 
 
-		parent::__construct($View, $settings);
+		parent::__construct($View, $config);
 	}
 	}
 
 
 	/**
 	/**

+ 81 - 82
View/Helper/GoogleMapV3Helper.php

@@ -204,57 +204,56 @@ class GoogleMapV3Helper extends AppHelper {
 		'https' => null // auto detect
 		'https' => null // auto detect
 	);
 	);
 
 
-	protected $_currentOptions = array();
-
 	protected $_apiIncluded = false;
 	protected $_apiIncluded = false;
 
 
 	protected $_gearsIncluded = false;
 	protected $_gearsIncluded = false;
 
 
 	protected $_located = false;
 	protected $_located = false;
 
 
-	public function __construct($View = null, $settings = array()) {
-		parent::__construct($View, $settings);
-
+	public function __construct($View = null, $config = array()) {
 		$google = (array)Configure::read('Google');
 		$google = (array)Configure::read('Google');
+		$defaults = $this->_defaultOptions;
 		if (!empty($google['api'])) {
 		if (!empty($google['api'])) {
-			$this->_defaultOptions['map']['api'] = $google['api'];
+			$defaults['map']['api'] = $google['api'];
 		}
 		}
 		if (!empty($google['zoom'])) {
 		if (!empty($google['zoom'])) {
-			$this->_defaultOptions['map']['zoom'] = $google['zoom'];
+			$defaults['map']['zoom'] = $google['zoom'];
 		}
 		}
 		if (!empty($google['lat'])) {
 		if (!empty($google['lat'])) {
-			$this->_defaultOptions['map']['lat'] = $google['lat'];
+			$defaults['map']['lat'] = $google['lat'];
 		}
 		}
 		if (!empty($google['lng'])) {
 		if (!empty($google['lng'])) {
-			$this->_defaultOptions['map']['lng'] = $google['lng'];
+			$defaults['map']['lng'] = $google['lng'];
 		}
 		}
 		if (!empty($google['type'])) {
 		if (!empty($google['type'])) {
-			$this->_defaultOptions['map']['type'] = $google['type'];
+			$defaults['map']['type'] = $google['type'];
 		}
 		}
 		if (!empty($google['size'])) {
 		if (!empty($google['size'])) {
-			$this->_defaultOptions['div']['width'] = $google['size']['width'];
-			$this->_defaultOptions['div']['height'] = $google['size']['height'];
+			$defaults['div']['width'] = $google['size']['width'];
+			$defaults['div']['height'] = $google['size']['height'];
 		}
 		}
 		if (!empty($google['staticSize'])) {
 		if (!empty($google['staticSize'])) {
-			$this->_defaultOptions['staticMap']['size'] = $google['staticSize'];
+			$defaults['staticMap']['size'] = $google['staticSize'];
 		}
 		}
-		// the following are convience defaults - if not available the map lat/lng/zoom defaults will be used
+		// the following are convenience defaults - if not available the map lat/lng/zoom defaults will be used
 		if (!empty($google['staticZoom'])) {
 		if (!empty($google['staticZoom'])) {
-			$this->_defaultOptions['staticMap']['zoom'] = $google['staticZoom'];
+			$defaults['staticMap']['zoom'] = $google['staticZoom'];
 		}
 		}
 		if (!empty($google['staticLat'])) {
 		if (!empty($google['staticLat'])) {
-			$this->_defaultOptions['staticMap']['lat'] = $google['staticLat'];
+			$defaults['staticMap']['lat'] = $google['staticLat'];
 		}
 		}
 		if (!empty($google['staticLng'])) {
 		if (!empty($google['staticLng'])) {
-			$this->_defaultOptions['staticMap']['lng'] = $google['staticLng'];
+			$defaults['staticMap']['lng'] = $google['staticLng'];
 		}
 		}
 		if (isset($google['localImages'])) {
 		if (isset($google['localImages'])) {
 			if ($google['localImages'] === true) {
 			if ($google['localImages'] === true) {
 				$google['localImages'] = Router::url('/img/google_map/', true);
 				$google['localImages'] = Router::url('/img/google_map/', true);
 			}
 			}
-			$this->_defaultOptions['localImages'] = $google['localImages'];
+			$defaults['localImages'] = $google['localImages'];
 		}
 		}
-		$this->_currentOptions = $this->_defaultOptions;
+
+		$this->settings = $defaults;
+		parent::__construct($View, $config);
 	}
 	}
 
 
 /** Google Maps JS **/
 /** Google Maps JS **/
@@ -279,10 +278,10 @@ class GoogleMapV3Helper extends AppHelper {
 			$url .= '&language=' . $language;
 			$url .= '&language=' . $language;
 		}
 		}
 		if (!empty($api)) {
 		if (!empty($api)) {
-			$this->_currentOptions['map']['api'] = $api;
+			$this->settings['map']['api'] = $api;
 		}
 		}
-		if (!empty($this->_currentOptions['map']['api'])) {
-			$url .= '&v=' . $this->_currentOptions['map']['api'];
+		if (!empty($this->settings['map']['api'])) {
+			$url .= '&v=' . $this->settings['map']['api'];
 		}
 		}
 		if (!empty($append)) {
 		if (!empty($append)) {
 			$url .= $append;
 			$url .= $append;
@@ -311,7 +310,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return string currentContainerId
 	 * @return string currentContainerId
 	 */
 	 */
 	public function id() {
 	public function id() {
-		return $this->_currentOptions['div']['id'];
+		return $this->settings['div']['id'];
 	}
 	}
 
 
 	/**
 	/**
@@ -324,7 +323,7 @@ class GoogleMapV3Helper extends AppHelper {
 		self::$markerCount = self::$infoWindowCount = 0;
 		self::$markerCount = self::$infoWindowCount = 0;
 		$this->markers = $this->infoWindows = array();
 		$this->markers = $this->infoWindows = array();
 		if ($full) {
 		if ($full) {
-			$this->_currentOptions = $this->_defaultOptions;
+			$this->settings = $this->_defaultOptions;
 		}
 		}
 	}
 	}
 
 
@@ -343,19 +342,19 @@ class GoogleMapV3Helper extends AppHelper {
 	 */
 	 */
 	public function setControls($options = array()) {
 	public function setControls($options = array()) {
 		if (isset($options['streetView'])) {
 		if (isset($options['streetView'])) {
-			$this->_currentOptions['map']['streetViewControl'] = $options['streetView'];
+			$this->settings['map']['streetViewControl'] = $options['streetView'];
 		}
 		}
 		if (isset($options['zoom'])) {
 		if (isset($options['zoom'])) {
-			$this->_currentOptions['map']['scaleControl'] = $options['zoom'];
+			$this->settings['map']['scaleControl'] = $options['zoom'];
 		}
 		}
 		if (isset($options['scrollwheel'])) {
 		if (isset($options['scrollwheel'])) {
-			$this->_currentOptions['map']['scrollwheel'] = $options['scrollwheel'];
+			$this->settings['map']['scrollwheel'] = $options['scrollwheel'];
 		}
 		}
 		if (isset($options['keyboardShortcuts'])) {
 		if (isset($options['keyboardShortcuts'])) {
-			$this->_currentOptions['map']['keyboardShortcuts'] = $options['keyboardShortcuts'];
+			$this->settings['map']['keyboardShortcuts'] = $options['keyboardShortcuts'];
 		}
 		}
 		if (isset($options['type'])) {
 		if (isset($options['type'])) {
-			$this->_currentOptions['map']['type'] = $options['type'];
+			$this->settings['map']['type'] = $options['type'];
 		}
 		}
 	}
 	}
 
 
@@ -368,32 +367,32 @@ class GoogleMapV3Helper extends AppHelper {
 	 */
 	 */
 	public function map($options = array()) {
 	public function map($options = array()) {
 		$this->reset();
 		$this->reset();
-		$this->_currentOptions = Set::merge($this->_currentOptions, $options);
-		$this->_currentOptions['map'] = array_merge($this->_currentOptions['map'], array('zoom' => $this->_currentOptions['zoom'], 'lat' => $this->_currentOptions['lat'], 'lng' => $this->_currentOptions['lng'], 'type' => $this->_currentOptions['type']), $options);
-		if (!$this->_currentOptions['map']['lat'] || !$this->_currentOptions['map']['lng']) {
-			$this->_currentOptions['map']['lat'] = $this->_currentOptions['map']['defaultLat'];
-			$this->_currentOptions['map']['lng'] = $this->_currentOptions['map']['defaultLng'];
-			$this->_currentOptions['map']['zoom'] = $this->_currentOptions['map']['defaultZoom'];
-		} elseif (!$this->_currentOptions['map']['zoom']) {
-			$this->_currentOptions['map']['zoom'] = $this->_currentOptions['map']['defaultZoom'];
+		$this->settings = Set::merge($this->settings, $options);
+		$this->settings['map'] = array_merge($this->settings['map'], array('zoom' => $this->settings['zoom'], 'lat' => $this->settings['lat'], 'lng' => $this->settings['lng'], 'type' => $this->settings['type']), $options);
+		if (!$this->settings['map']['lat'] || !$this->settings['map']['lng']) {
+			$this->settings['map']['lat'] = $this->settings['map']['defaultLat'];
+			$this->settings['map']['lng'] = $this->settings['map']['defaultLng'];
+			$this->settings['map']['zoom'] = $this->settings['map']['defaultZoom'];
+		} elseif (!$this->settings['map']['zoom']) {
+			$this->settings['map']['zoom'] = $this->settings['map']['defaultZoom'];
 		}
 		}
 
 
 		$result = '';
 		$result = '';
 
 
 		// autoinclude js?
 		// autoinclude js?
-		if (!empty($this->_currentOptions['autoScript']) && !$this->_apiIncluded) {
-			$res = $this->Html->script($this->apiUrl(), array('inline' => $this->_currentOptions['inline']));
+		if (!empty($this->settings['autoScript']) && !$this->_apiIncluded) {
+			$res = $this->Html->script($this->apiUrl(), array('inline' => $this->settings['inline']));
 
 
-			if ($this->_currentOptions['inline']) {
+			if ($this->settings['inline']) {
 				$result .= $res . PHP_EOL;
 				$result .= $res . PHP_EOL;
 			}
 			}
 			// usually already included
 			// usually already included
 			//http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
 			//http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
 		}
 		}
 		// still not very common: http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/basics.html
 		// still not very common: http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/basics.html
-		if (false && !empty($this->_currentOptions['autoScript']) && !$this->_gearsIncluded) {
-			$res = $this->Html->script($this->gearsUrl(), array('inline' => $this->_currentOptions['inline']));
-			if ($this->_currentOptions['inline']) {
+		if (false && !empty($this->settings['autoScript']) && !$this->_gearsIncluded) {
+			$res = $this->Html->script($this->gearsUrl(), array('inline' => $this->settings['inline']));
+			if ($this->settings['inline']) {
 				$result .= $res . PHP_EOL;
 				$result .= $res . PHP_EOL;
 			}
 			}
 		}
 		}
@@ -410,30 +409,30 @@ class GoogleMapV3Helper extends AppHelper {
 		";
 		";
 
 
 		#rename "map_canvas" to "map_canvas1", ... if multiple maps on one page
 		#rename "map_canvas" to "map_canvas1", ... if multiple maps on one page
-		while (in_array($this->_currentOptions['div']['id'], $this->_mapIds)) {
-			$this->_currentOptions['div']['id'] .= '-1'; //TODO: improve
+		while (in_array($this->settings['div']['id'], $this->_mapIds)) {
+			$this->settings['div']['id'] .= '-1'; //TODO: improve
 		}
 		}
-		$this->_mapIds[] = $this->_currentOptions['div']['id'];
+		$this->_mapIds[] = $this->settings['div']['id'];
 
 
 		$map .= "
 		$map .= "
-			var " . $this->name() . " = new google.maps.Map(document.getElementById(\"" . $this->_currentOptions['div']['id'] . "\"), myOptions);
+			var " . $this->name() . " = new google.maps.Map(document.getElementById(\"" . $this->settings['div']['id'] . "\"), myOptions);
 			";
 			";
 		$this->map = $map;
 		$this->map = $map;
 
 
-		$this->_currentOptions['div']['style'] = '';
-		if (is_numeric($this->_currentOptions['div']['width'])) {
-			$this->_currentOptions['div']['width'] .= 'px';
+		$this->settings['div']['style'] = '';
+		if (is_numeric($this->settings['div']['width'])) {
+			$this->settings['div']['width'] .= 'px';
 		}
 		}
-		if (is_numeric($this->_currentOptions['div']['height'])) {
-			$this->_currentOptions['div']['height'] .= 'px';
+		if (is_numeric($this->settings['div']['height'])) {
+			$this->settings['div']['height'] .= 'px';
 		}
 		}
 
 
-		$this->_currentOptions['div']['style'] .= 'width: ' . $this->_currentOptions['div']['width'] . ';';
-		$this->_currentOptions['div']['style'] .= 'height: ' . $this->_currentOptions['div']['height'] . ';';
-		unset($this->_currentOptions['div']['width']); unset($this->_currentOptions['div']['height']);
+		$this->settings['div']['style'] .= 'width: ' . $this->settings['div']['width'] . ';';
+		$this->settings['div']['style'] .= 'height: ' . $this->settings['div']['height'] . ';';
+		unset($this->settings['div']['width']); unset($this->settings['div']['height']);
 
 
-		$defaultText = isset($this->_currentOptions['content']) ? $this->_currentOptions['content'] : __('Map cannot be displayed!');
-		$result .= $this->Html->tag('div', $defaultText, $this->_currentOptions['div']);
+		$defaultText = isset($this->settings['content']) ? $this->settings['content'] : __('Map cannot be displayed!');
+		$result .= $this->Html->tag('div', $defaultText, $this->settings['div']);
 
 
 		return $result;
 		return $result;
 	}
 	}
@@ -444,10 +443,10 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @return string
 	 * @return string
 	 */
 	 */
 	protected function _initialLocation() {
 	protected function _initialLocation() {
-		if ($this->_currentOptions['map']['lat'] && $this->_currentOptions['map']['lng']) {
-			return "new google.maps.LatLng(" . $this->_currentOptions['map']['lat'] . ", " . $this->_currentOptions['map']['lng'] . ")";
+		if ($this->settings['map']['lat'] && $this->settings['map']['lng']) {
+			return "new google.maps.LatLng(" . $this->settings['map']['lat'] . ", " . $this->settings['map']['lng'] . ")";
 		}
 		}
-		$this->_currentOptions['autoCenter'] = true;
+		$this->settings['autoCenter'] = true;
 		return 'false';
 		return 'false';
 	}
 	}
 
 
@@ -466,7 +465,7 @@ class GoogleMapV3Helper extends AppHelper {
 	 * @throws CakeException
 	 * @throws CakeException
 	 */
 	 */
 	public function addMarker($options) {
 	public function addMarker($options) {
-		$defaults = $this->_currentOptions['marker'];
+		$defaults = $this->settings['marker'];
 		if (isset($options['icon']) && is_array($options['icon'])) {
 		if (isset($options['icon']) && is_array($options['icon'])) {
 			$defaults = array_merge($defaults, $options['icon']);
 			$defaults = array_merge($defaults, $options['icon']);
 			unset($options['icon']);
 			unset($options['icon']);
@@ -552,19 +551,19 @@ function geocodeAddress(address) {
 		}
 		}
 
 
 		// Fill popup windows
 		// Fill popup windows
-		if (!empty($options['content']) && $this->_currentOptions['infoWindow']['useMultiple']) {
+		if (!empty($options['content']) && $this->settings['infoWindow']['useMultiple']) {
 			$x = $this->addInfoWindow(array('content' => $options['content']));
 			$x = $this->addInfoWindow(array('content' => $options['content']));
 			$this->addEvent(self::$markerCount, $x, $options['open']);
 			$this->addEvent(self::$markerCount, $x, $options['open']);
 
 
 		} elseif (!empty($options['content'])) {
 		} elseif (!empty($options['content'])) {
-			if (!isset($this->_currentOptions['marker']['infoWindow'])) {
-				$this->_currentOptions['marker']['infoWindow'] = $this->addInfoWindow();
+			if (!isset($this->settings['marker']['infoWindow'])) {
+				$this->settings['marker']['infoWindow'] = $this->addInfoWindow();
 			}
 			}
 
 
 			$x = $this->addInfoContent($options['content']);
 			$x = $this->addInfoContent($options['content']);
 			$event = "
 			$event = "
-			gInfoWindows" . self::$mapCount . "[" . $this->_currentOptions['marker']['infoWindow'] . "]. setContent(gWindowContents" . self::$mapCount . "[" . $x . "]);
-			gInfoWindows" . self::$mapCount . "[" . $this->_currentOptions['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . self::$mapCount . "[" . $x . "]);
+			gInfoWindows" . self::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "]. setContent(gWindowContents" . self::$mapCount . "[" . $x . "]);
+			gInfoWindows" . self::$mapCount . "[" . $this->settings['marker']['infoWindow'] . "].open(" . $this->name() . ", gMarkers" . self::$mapCount . "[" . $x . "]);
 			";
 			";
 			$this->addCustomEvent(self::$markerCount, $event);
 			$this->addCustomEvent(self::$markerCount, $event);
 
 
@@ -665,11 +664,11 @@ function geocodeAddress(address) {
 			$color = 'red';
 			$color = 'red';
 		}
 		}
 
 
-		if (!empty($this->_currentOptions['localImages'])) {
-			$this->setIcons['color'] = $this->_currentOptions['localImages'] . 'marker%s.png';
-			$this->setIcons['alpha'] = $this->_currentOptions['localImages'] . 'marker%s%s.png';
-			$this->setIcons['numeric'] = $this->_currentOptions['localImages'] . '%s%s.png';
-			$this->setIcons['special'] = $this->_currentOptions['localImages'] . '%s.png';
+		if (!empty($this->settings['localImages'])) {
+			$this->setIcons['color'] = $this->settings['localImages'] . 'marker%s.png';
+			$this->setIcons['alpha'] = $this->settings['localImages'] . 'marker%s%s.png';
+			$this->setIcons['numeric'] = $this->settings['localImages'] . '%s%s.png';
+			$this->setIcons['special'] = $this->settings['localImages'] . '%s.png';
 		}
 		}
 
 
 		if (!empty($char)) {
 		if (!empty($char)) {
@@ -796,7 +795,7 @@ var iconShape = {
 	 * @return int windowCount
 	 * @return int windowCount
 	 */
 	 */
 	public function addInfoWindow($options = array()) {
 	public function addInfoWindow($options = array()) {
-		$defaults = $this->_currentOptions['infoWindow'];
+		$defaults = $this->settings['infoWindow'];
 		$options += $defaults;
 		$options += $defaults;
 
 
 		if (!empty($options['lat']) && !empty($options['lng'])) {
 		if (!empty($options['lat']) && !empty($options['lng'])) {
@@ -885,7 +884,7 @@ var iconShape = {
 	 */
 	 */
 	public function addDirections($from, $to, $options = array()) {
 	public function addDirections($from, $to, $options = array()) {
 		$id = 'd' . self::$markerCount++;
 		$id = 'd' . self::$markerCount++;
-		$defaults = $this->_currentOptions['directions'];
+		$defaults = $this->settings['directions'];
 		$options += $defaults;
 		$options += $defaults;
 		$travelMode = $this->travelModes[$options['travelMode']];
 		$travelMode = $this->travelModes[$options['travelMode']];
 
 
@@ -955,7 +954,7 @@ var iconShape = {
 			$to = '\'' . h($to) . '\'';
 			$to = '\'' . h($to) . '\'';
 		}
 		}
 
 
-		$defaults = $this->_currentOptions['polyline'];
+		$defaults = $this->settings['polyline'];
 		$options += $defaults;
 		$options += $defaults;
 
 
 		$id = 'p' . self::$markerCount++;
 		$id = 'p' . self::$markerCount++;
@@ -1027,15 +1026,15 @@ var iconShape = {
 		';
 		';
 
 
 		$script .= $this->map;
 		$script .= $this->map;
-		if ($this->_currentOptions['geolocate']) {
+		if ($this->settings['geolocate']) {
 			$script .= $this->_geolocate();
 			$script .= $this->_geolocate();
 		}
 		}
 
 
-		if ($this->_currentOptions['showMarker'] && !empty($this->markers) && is_array($this->markers)) {
+		if ($this->settings['showMarker'] && !empty($this->markers) && is_array($this->markers)) {
 			$script .= implode($this->markers, " ");
 			$script .= implode($this->markers, " ");
 		}
 		}
 
 
-		if ($this->_currentOptions['autoCenter']) {
+		if ($this->settings['autoCenter']) {
 			$script .= $this->_autoCenter();
 			$script .= $this->_autoCenter();
 		}
 		}
 		$script .= '
 		$script .= '
@@ -1057,10 +1056,10 @@ var iconShape = {
 	 */
 	 */
 	public function geolocateCallback($js) {
 	public function geolocateCallback($js) {
 		if ($js === false) {
 		if ($js === false) {
-			$this->_currentOptions['callbacks']['geolocate'] = false;
+			$this->settings['callbacks']['geolocate'] = false;
 			return;
 			return;
 		}
 		}
-		$this->_currentOptions['callbacks']['geolocate'] = $js;
+		$this->settings['callbacks']['geolocate'] = $js;
 	}
 	}
 
 
 	/**
 	/**
@@ -1107,7 +1106,7 @@ var iconShape = {
 	}
 	}
 
 
 	protected function _geolocationCallback() {
 	protected function _geolocationCallback() {
-		if (($js = $this->_currentOptions['callbacks']['geolocate']) === false) {
+		if (($js = $this->settings['callbacks']['geolocate']) === false) {
 			return '';
 			return '';
 		}
 		}
 		if ($js === null) {
 		if ($js === null) {
@@ -1135,7 +1134,7 @@ var iconShape = {
 	 * @return json like js string
 	 * @return json like js string
 	 */
 	 */
 	protected function _mapOptions() {
 	protected function _mapOptions() {
-		$options = array_merge($this->_currentOptions, $this->_currentOptions['map']);
+		$options = array_merge($this->settings, $this->settings['map']);
 
 
 		$mapOptions = array_intersect_key($options, array(
 		$mapOptions = array_intersect_key($options, array(
 			'streetViewControl' => null,
 			'streetViewControl' => null,
@@ -1542,7 +1541,7 @@ var iconShape = {
 	 * @return string protocol base (including ://)
 	 * @return string protocol base (including ://)
 	 */
 	 */
 	protected function _protocol() {
 	protected function _protocol() {
-		if (($https = $this->_currentOptions['https']) === null) {
+		if (($https = $this->settings['https']) === null) {
 			$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on';
 			$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on';
 		}
 		}
 		return ($https ? 'https' : 'http') . '://';
 		return ($https ? 'https' : 'http') . '://';

+ 2 - 2
View/Helper/IcalHelper.php

@@ -16,8 +16,8 @@ class IcalHelper extends AppHelper {
 
 
 	protected $_data = array();
 	protected $_data = array();
 
 
-	public function __construct($View = null, $settings = array()) {
-		parent::__construct($View, $settings);
+	public function __construct($View = null, $config = array()) {
+		parent::__construct($View, $config);
 
 
 		$this->Ical = new IcalLib();
 		$this->Ical = new IcalLib();
 	}
 	}