@@ -19,12 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setDraggable($draggable = true) { |
22 | - $this->setParam('draggable',(bool) $draggable); |
|
22 | + $this->setParam('draggable', (bool) $draggable); |
|
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function moveOnClick($move = true) { |
27 | - $this->setParam('moveOnClick',(bool) $move); |
|
27 | + $this->setParam('moveOnClick', (bool) $move); |
|
28 | 28 | return $this; |
29 | 29 | } |
30 | 30 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | 'height' => $service->getParam('container_height') ? $service->getParam('container_height') : '500', |
55 | 55 | ); |
56 | 56 | |
57 | - $html = '<div id="'.$this->_container['id'].'" style="width: '.$this->_container['width'].'px; height: '.$this->_container['height'].'px;"> </div> '; |
|
57 | + $html = '<div id="' . $this->_container['id'] . '" style="width: ' . $this->_container['width'] . 'px; height: ' . $this->_container['height'] . 'px;"> </div> '; |
|
58 | 58 | return $html; |
59 | 59 | } |
60 | 60 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | ); |
81 | 81 | }); |
82 | 82 | '; |
83 | - $this->_scripts[] = $script; |
|
83 | + $this->_scripts[] = $script; |
|
84 | 84 | |
85 | 85 | return $return; |
86 | 86 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | var script = document.createElement("script"); |
19 | 19 | script.type = "text/javascript"; |
20 | 20 | script.async = false; |
21 | - script.src = "'.$this->getScriptURL().'"; |
|
21 | + script.src = "'.$this->getScriptURL() . '"; |
|
22 | 22 | document.documentElement.firstChild.appendChild(script); |
23 | 23 | </script> |
24 | 24 | '; |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | $html = ' |
41 | 41 | function loadMap() { |
42 | 42 | if (GBrowserIsCompatible()) { |
43 | - var map = new GMap2(document.getElementById("'.$this->_container['id'].'"));'; |
|
43 | + var map = new GMap2(document.getElementById("'.$this->_container['id'] . '"));'; |
|
44 | 44 | $center = $this->getService()->getParam('center'); |
45 | 45 | if (is_array($center) && count($center) == 3) { |
46 | - list($cLat,$cLng, $cZoom) = $center; |
|
46 | + list($cLat, $cLng, $cZoom) = $center; |
|
47 | 47 | } else { |
48 | 48 | $cLat = '37.4419'; |
49 | 49 | $cLng = '-122.1419'; |
50 | 50 | $cZoom = '1'; |
51 | 51 | } |
52 | - $html .= 'map.setCenter(new GLatLng('.$cLat.','.$cLng.' ), '.$cZoom.');'; |
|
52 | + $html .= 'map.setCenter(new GLatLng(' . $cLat . ',' . $cLng . ' ), ' . $cZoom . ');'; |
|
53 | 53 | $html .= 'map.setUIToDefault();'; |
54 | 54 | return $html; |
55 | 55 | } |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | public function renderMarker($marker) { |
89 | 89 | $html = ''; |
90 | 90 | if ($marker->latitude && $marker->longitude) { |
91 | - $html .= 'var latlng = new GLatLng('.$marker->latitude.', '.$marker->longitude.');'; |
|
91 | + $html .= 'var latlng = new GLatLng(' . $marker->latitude . ', ' . $marker->longitude . ');'; |
|
92 | 92 | } else { |
93 | 93 | $html .= 'var latlng = map.getCenter();'; |
94 | 94 | } |
95 | 95 | $options = array( |
96 | 96 | 'draggable' => $marker->getParam('draggable'), |
97 | 97 | ); |
98 | - $html .= 'var marker = new GMarker(latlng, ' . json_encode($options) . ');'; |
|
98 | + $html .= 'var marker = new GMarker(latlng, ' . json_encode($options) . ');'; |
|
99 | 99 | if ($marker->getParam('info')) { |
100 | - $html .= 'GEvent.addListener(marker, "click", function() { |
|
101 | - marker.openInfoWindowHtml("'.$marker->getParam('info').'"); |
|
100 | + $html .= 'GEvent.addListener(marker, "click", function() { |
|
101 | + marker.openInfoWindowHtml("'.$marker->getParam('info') . '"); |
|
102 | 102 | }); |
103 | 103 | GEvent.addListener(marker, "dragstart", function() { |
104 | 104 | map.closeInfoWindow(); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | $listeners = $marker->getListeners(); |
119 | 119 | foreach ($listeners as $type=>$functions) { |
120 | 120 | foreach ($functions as $function) { |
121 | - $html .= 'GEvent.addListener(marker, "'.$type.'", function() { |
|
122 | - '.$function.' |
|
121 | + $html .= 'GEvent.addListener(marker, "' . $type . '", function() { |
|
122 | + '.$function . ' |
|
123 | 123 | }); |
124 | 124 | '; |
125 | 125 | } |
126 | 126 | } |
127 | - $html .= 'map.addOverlay(marker);'; |
|
127 | + $html .= 'map.addOverlay(marker);'; |
|
128 | 128 | return $html; |
129 | 129 | } |
130 | 130 | } |
@@ -3,40 +3,40 @@ |
||
3 | 3 | class Nip_Service_Google_Charts |
4 | 4 | { |
5 | 5 | |
6 | - protected $_url = "http://chart.apis.google.com/chart"; |
|
6 | + protected $_url = "http://chart.apis.google.com/chart"; |
|
7 | 7 | |
8 | - /** |
|
9 | - * Chart factory |
|
10 | - * |
|
11 | - * @param string $type |
|
12 | - * @return Nip_Service_Google_Charts_Chart |
|
13 | - */ |
|
14 | - public function getChart($type = "Line") |
|
15 | - { |
|
16 | - $class = "Nip_Service_Google_Charts_Chart_" . $type; |
|
8 | + /** |
|
9 | + * Chart factory |
|
10 | + * |
|
11 | + * @param string $type |
|
12 | + * @return Nip_Service_Google_Charts_Chart |
|
13 | + */ |
|
14 | + public function getChart($type = "Line") |
|
15 | + { |
|
16 | + $class = "Nip_Service_Google_Charts_Chart_" . $type; |
|
17 | 17 | |
18 | - $chart = new $class(); |
|
19 | - $chart->setService($this); |
|
18 | + $chart = new $class(); |
|
19 | + $chart->setService($this); |
|
20 | 20 | |
21 | - return $chart; |
|
22 | - } |
|
21 | + return $chart; |
|
22 | + } |
|
23 | 23 | |
24 | - public function getURL() |
|
25 | - { |
|
26 | - return $this->_url; |
|
27 | - } |
|
24 | + public function getURL() |
|
25 | + { |
|
26 | + return $this->_url; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Singleton |
|
31 | - * |
|
32 | - * @return Nip_Service_Google_Charts |
|
33 | - */ |
|
34 | - static public function instance() |
|
35 | - { |
|
36 | - static $instance; |
|
37 | - if (!($instance instanceof self)) { |
|
38 | - $instance = new self(); |
|
39 | - } |
|
40 | - return $instance; |
|
41 | - } |
|
29 | + /** |
|
30 | + * Singleton |
|
31 | + * |
|
32 | + * @return Nip_Service_Google_Charts |
|
33 | + */ |
|
34 | + static public function instance() |
|
35 | + { |
|
36 | + static $instance; |
|
37 | + if (!($instance instanceof self)) { |
|
38 | + $instance = new self(); |
|
39 | + } |
|
40 | + return $instance; |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -3,29 +3,29 @@ |
||
3 | 3 | class Nip_Object |
4 | 4 | { |
5 | 5 | |
6 | - protected $_data; |
|
6 | + protected $_data; |
|
7 | 7 | |
8 | - public function &__get($name) |
|
9 | - { |
|
10 | - if (!$this->__isset($name)) { |
|
11 | - $this->_data[$name] = null; |
|
12 | - } |
|
13 | - return $this->_data[$name]; |
|
14 | - } |
|
8 | + public function &__get($name) |
|
9 | + { |
|
10 | + if (!$this->__isset($name)) { |
|
11 | + $this->_data[$name] = null; |
|
12 | + } |
|
13 | + return $this->_data[$name]; |
|
14 | + } |
|
15 | 15 | |
16 | - public function __set($name, $value) |
|
17 | - { |
|
18 | - $this->_data[$name] = $value; |
|
19 | - } |
|
16 | + public function __set($name, $value) |
|
17 | + { |
|
18 | + $this->_data[$name] = $value; |
|
19 | + } |
|
20 | 20 | |
21 | - public function __isset($name) |
|
22 | - { |
|
23 | - return isset($this->_data[$name]); |
|
24 | - } |
|
21 | + public function __isset($name) |
|
22 | + { |
|
23 | + return isset($this->_data[$name]); |
|
24 | + } |
|
25 | 25 | |
26 | - public function __unset($name) |
|
27 | - { |
|
28 | - unset($this->_data[$name]); |
|
29 | - } |
|
26 | + public function __unset($name) |
|
27 | + { |
|
28 | + unset($this->_data[$name]); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -5,44 +5,44 @@ |
||
5 | 5 | class Process |
6 | 6 | { |
7 | 7 | |
8 | - protected $_pid; |
|
9 | - protected $_command; |
|
10 | - |
|
11 | - public function __construct($command = false) |
|
12 | - { |
|
13 | - if ($command) { |
|
14 | - $this->_command = $command; |
|
15 | - } |
|
16 | - } |
|
17 | - |
|
18 | - public function run() |
|
19 | - { |
|
20 | - $command = "nohup $this->_command > /dev/null 2>&1 & echo $!"; |
|
21 | - $this->_pid = shell_exec($command); |
|
22 | - |
|
23 | - return $this; |
|
24 | - } |
|
25 | - |
|
26 | - public function running() |
|
27 | - { |
|
28 | - exec("ps -p $this->_pid", $output); |
|
29 | - return isset($output[1]); |
|
30 | - } |
|
31 | - |
|
32 | - public function stop() |
|
33 | - { |
|
34 | - exec("kill $this->_pid"); |
|
35 | - return !$this->running(); |
|
36 | - } |
|
37 | - |
|
38 | - public function setPID($pid) |
|
39 | - { |
|
40 | - $this->_pid = $pid; |
|
41 | - } |
|
42 | - |
|
43 | - public function getPID() |
|
44 | - { |
|
45 | - return $this->_pid; |
|
46 | - } |
|
8 | + protected $_pid; |
|
9 | + protected $_command; |
|
10 | + |
|
11 | + public function __construct($command = false) |
|
12 | + { |
|
13 | + if ($command) { |
|
14 | + $this->_command = $command; |
|
15 | + } |
|
16 | + } |
|
17 | + |
|
18 | + public function run() |
|
19 | + { |
|
20 | + $command = "nohup $this->_command > /dev/null 2>&1 & echo $!"; |
|
21 | + $this->_pid = shell_exec($command); |
|
22 | + |
|
23 | + return $this; |
|
24 | + } |
|
25 | + |
|
26 | + public function running() |
|
27 | + { |
|
28 | + exec("ps -p $this->_pid", $output); |
|
29 | + return isset($output[1]); |
|
30 | + } |
|
31 | + |
|
32 | + public function stop() |
|
33 | + { |
|
34 | + exec("kill $this->_pid"); |
|
35 | + return !$this->running(); |
|
36 | + } |
|
37 | + |
|
38 | + public function setPID($pid) |
|
39 | + { |
|
40 | + $this->_pid = $pid; |
|
41 | + } |
|
42 | + |
|
43 | + public function getPID() |
|
44 | + { |
|
45 | + return $this->_pid; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -3,24 +3,24 @@ |
||
3 | 3 | class Nip_Hash |
4 | 4 | { |
5 | 5 | |
6 | - protected static $golden_primes = array( |
|
7 | - 36 => array(1, 23, 809, 28837, 1038073, 37370257, 1345328833) |
|
8 | - ); |
|
6 | + protected static $golden_primes = array( |
|
7 | + 36 => array(1, 23, 809, 28837, 1038073, 37370257, 1345328833) |
|
8 | + ); |
|
9 | 9 | |
10 | - public static function uhash($num, $len = 5, $base = 36) |
|
11 | - { |
|
12 | - $gp = self::$golden_primes[$base]; |
|
13 | - $maxlen = count($gp); |
|
14 | - $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
|
15 | - while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | - $len++; |
|
17 | - if ($len >= $maxlen) |
|
18 | - throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
19 | - $ceil = pow($base, $len); |
|
20 | - $prime = $gp[$len]; |
|
21 | - $dechash = ($num * $prime) % $ceil; |
|
22 | - $hash = base_convert($dechash, 10, $base); |
|
23 | - return str_pad($hash, $len, "0", STR_PAD_LEFT); |
|
24 | - } |
|
10 | + public static function uhash($num, $len = 5, $base = 36) |
|
11 | + { |
|
12 | + $gp = self::$golden_primes[$base]; |
|
13 | + $maxlen = count($gp); |
|
14 | + $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
|
15 | + while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | + $len++; |
|
17 | + if ($len >= $maxlen) |
|
18 | + throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
19 | + $ceil = pow($base, $len); |
|
20 | + $prime = $gp[$len]; |
|
21 | + $dechash = ($num * $prime) % $ceil; |
|
22 | + $hash = base_convert($dechash, 10, $base); |
|
23 | + return str_pad($hash, $len, "0", STR_PAD_LEFT); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | } |
@@ -12,10 +12,12 @@ |
||
12 | 12 | $gp = self::$golden_primes[$base]; |
13 | 13 | $maxlen = count($gp); |
14 | 14 | $len = $len > ($maxlen - 1) ? ($maxlen - 1) : $len; |
15 | - while ($len < $maxlen && pow($base, $len) < $num) |
|
16 | - $len++; |
|
17 | - if ($len >= $maxlen) |
|
18 | - throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
15 | + while ($len < $maxlen && pow($base, $len) < $num) { |
|
16 | + $len++; |
|
17 | + } |
|
18 | + if ($len >= $maxlen) { |
|
19 | + throw new Exception($num . " out of range (max " . pow($base, $maxlen - 1) . ")"); |
|
20 | + } |
|
19 | 21 | $ceil = pow($base, $len); |
20 | 22 | $prime = $gp[$len]; |
21 | 23 | $dechash = ($num * $prime) % $ceil; |
@@ -37,9 +37,9 @@ |
||
37 | 37 | $this->userAgent = $_SERVER['HTTP_USER_AGENT']; |
38 | 38 | $this->accept = $_SERVER['HTTP_ACCEPT']; |
39 | 39 | |
40 | - if (isset($_SERVER['HTTP_X_WAP_PROFILE'])|| isset($_SERVER['HTTP_PROFILE'])) { |
|
40 | + if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { |
|
41 | 41 | $this->isMobile = true; |
42 | - } elseif (strpos($this->accept,'text/vnd.wap.wml') > 0 || strpos($accept,'application/vnd.wap.xhtml+xml') > 0) { |
|
42 | + } elseif (strpos($this->accept, 'text/vnd.wap.wml') > 0 || strpos($accept, 'application/vnd.wap.xhtml+xml') > 0) { |
|
43 | 43 | $this->isMobile = true; |
44 | 44 | } else { |
45 | 45 | foreach ($this->devices as $device => $regexp) { |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | - * @param bool|AutoLoader $autoLoader |
|
29 | + * @param AutoLoader $autoLoader |
|
30 | 30 | * @return $this |
31 | 31 | */ |
32 | 32 | public function setAutoLoader($autoLoader = false) |