@@ -12,42 +12,42 @@ |
||
| 12 | 12 | return $minutes; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function secondsInStringTime($seconds) |
|
| 16 | - { |
|
| 17 | - if ($days = intval((floor($seconds / 86400)))) { |
|
| 15 | + public function secondsInStringTime($seconds) |
|
| 16 | + { |
|
| 17 | + if ($days = intval((floor($seconds / 86400)))) { |
|
| 18 | 18 | $seconds = $seconds - $days*86400; |
| 19 | - $return .= ($return ? ' ' : '') . str_pad($days, 2, 0,STR_PAD_LEFT).'d'; |
|
| 20 | - } |
|
| 21 | - if ($hours = intval((floor($seconds / 3600))) OR $return) { |
|
| 19 | + $return .= ($return ? ' ' : '') . str_pad($days, 2, 0,STR_PAD_LEFT).'d'; |
|
| 20 | + } |
|
| 21 | + if ($hours = intval((floor($seconds / 3600))) OR $return) { |
|
| 22 | 22 | $seconds = $seconds - $hours*3600; |
| 23 | - $return .= ($return ? ' ' : '') . str_pad($hours, 2, 0,STR_PAD_LEFT).'h'; |
|
| 24 | - } |
|
| 25 | - if ($minutes = intval((floor($seconds / 60))) OR $return) { |
|
| 26 | - $seconds = $seconds - $minutes*60; |
|
| 27 | - $return .= ($return ? ' ' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT).'m'; |
|
| 28 | - } |
|
| 23 | + $return .= ($return ? ' ' : '') . str_pad($hours, 2, 0,STR_PAD_LEFT).'h'; |
|
| 24 | + } |
|
| 25 | + if ($minutes = intval((floor($seconds / 60))) OR $return) { |
|
| 26 | + $seconds = $seconds - $minutes*60; |
|
| 27 | + $return .= ($return ? ' ' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT).'m'; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - $seconds = round($seconds, 2); |
|
| 30 | + $seconds = round($seconds, 2); |
|
| 31 | 31 | if ($seconds) { |
| 32 | 32 | $return .= ($return ? ' ' : '') . str_pad($seconds, 2, 0, STR_PAD_LEFT).'s'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - return $return; |
|
| 36 | - } |
|
| 35 | + return $return; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Singleton |
|
| 41 | - * |
|
| 42 | - * @return Nip_Helper_Date |
|
| 43 | - */ |
|
| 44 | - static public function instance() |
|
| 45 | - { |
|
| 46 | - static $instance; |
|
| 47 | - if (!($instance instanceof self)) { |
|
| 48 | - $instance = new self(); |
|
| 49 | - } |
|
| 50 | - return $instance; |
|
| 51 | - } |
|
| 39 | + /** |
|
| 40 | + * Singleton |
|
| 41 | + * |
|
| 42 | + * @return Nip_Helper_Date |
|
| 43 | + */ |
|
| 44 | + static public function instance() |
|
| 45 | + { |
|
| 46 | + static $instance; |
|
| 47 | + if (!($instance instanceof self)) { |
|
| 48 | + $instance = new self(); |
|
| 49 | + } |
|
| 50 | + return $instance; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | } |
@@ -11,64 +11,64 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Nip_Helper_Fulltext extends Nip\Helpers\AbstractHelper { |
| 13 | 13 | |
| 14 | - public function buildString($keywords, $mode = 'any') { |
|
| 15 | - $return = ""; |
|
| 14 | + public function buildString($keywords, $mode = 'any') { |
|
| 15 | + $return = ""; |
|
| 16 | 16 | |
| 17 | - $keywords = explode(" ", $keywords); |
|
| 17 | + $keywords = explode(" ", $keywords); |
|
| 18 | 18 | |
| 19 | - switch ($mode) { |
|
| 20 | - case "any": |
|
| 21 | - foreach ($keywords as $item) { |
|
| 22 | - $return .= $this->matchNumbers($item).'* '; |
|
| 23 | - } |
|
| 24 | - break; |
|
| 19 | + switch ($mode) { |
|
| 20 | + case "any": |
|
| 21 | + foreach ($keywords as $item) { |
|
| 22 | + $return .= $this->matchNumbers($item).'* '; |
|
| 23 | + } |
|
| 24 | + break; |
|
| 25 | 25 | |
| 26 | - case "all": |
|
| 27 | - if (count($keywords) == 1) { |
|
| 28 | - $return .= $this->matchNumbers(reset($keywords)).'* '; |
|
| 29 | - } else { |
|
| 30 | - foreach ($keywords as $item) { |
|
| 31 | - $return .= '+'. $this->matchNumbers($item).'* '; |
|
| 32 | - } |
|
| 33 | - } |
|
| 26 | + case "all": |
|
| 27 | + if (count($keywords) == 1) { |
|
| 28 | + $return .= $this->matchNumbers(reset($keywords)).'* '; |
|
| 29 | + } else { |
|
| 30 | + foreach ($keywords as $item) { |
|
| 31 | + $return .= '+'. $this->matchNumbers($item).'* '; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - break; |
|
| 36 | - case "exact": |
|
| 37 | - foreach ($keywords as $item) { |
|
| 38 | - $return .= $this->matchNumbers($item).' '; |
|
| 39 | - } |
|
| 40 | - $return = '+"'.$return.'"'; |
|
| 41 | - break; |
|
| 42 | - } |
|
| 35 | + break; |
|
| 36 | + case "exact": |
|
| 37 | + foreach ($keywords as $item) { |
|
| 38 | + $return .= $this->matchNumbers($item).' '; |
|
| 39 | + } |
|
| 40 | + $return = '+"'.$return.'"'; |
|
| 41 | + break; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - $return = strtolower(trim($return)); |
|
| 44 | + $return = strtolower(trim($return)); |
|
| 45 | 45 | |
| 46 | - return $return; |
|
| 47 | - } |
|
| 46 | + return $return; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - private function matchNumbers($input) { |
|
| 51 | - $stripped = array("%", ",", "."); |
|
| 52 | - $replaced = array("__", "_", "_"); |
|
| 50 | + private function matchNumbers($input) { |
|
| 51 | + $stripped = array("%", ",", "."); |
|
| 52 | + $replaced = array("__", "_", "_"); |
|
| 53 | 53 | |
| 54 | - if (is_numeric(str_replace($stripped, "", $input))) { |
|
| 55 | - return str_replace($stripped, $replaced, $input); |
|
| 56 | - } else { |
|
| 57 | - return $input; |
|
| 58 | - } |
|
| 59 | - } |
|
| 54 | + if (is_numeric(str_replace($stripped, "", $input))) { |
|
| 55 | + return str_replace($stripped, $replaced, $input); |
|
| 56 | + } else { |
|
| 57 | + return $input; |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Returns singleton instance |
|
| 64 | - * |
|
| 65 | - * @return Nip_Helper_Fulltext |
|
| 66 | - */ |
|
| 67 | - static public function instance() { |
|
| 68 | - static $instance; |
|
| 69 | - if (!($instance instanceof self)) { |
|
| 70 | - $instance = new self(); |
|
| 71 | - } |
|
| 72 | - return $instance; |
|
| 73 | - } |
|
| 62 | + /** |
|
| 63 | + * Returns singleton instance |
|
| 64 | + * |
|
| 65 | + * @return Nip_Helper_Fulltext |
|
| 66 | + */ |
|
| 67 | + static public function instance() { |
|
| 68 | + static $instance; |
|
| 69 | + if (!($instance instanceof self)) { |
|
| 70 | + $instance = new self(); |
|
| 71 | + } |
|
| 72 | + return $instance; |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | \ No newline at end of file |
@@ -2,33 +2,33 @@ |
||
| 2 | 2 | class Nip_Helper_Async extends Nip\Helpers\AbstractHelper |
| 3 | 3 | { |
| 4 | 4 | |
| 5 | - public function sendMessage($message, $type = 'success', $format ='json') |
|
| 6 | - { |
|
| 5 | + public function sendMessage($message, $type = 'success', $format ='json') |
|
| 6 | + { |
|
| 7 | 7 | $data = array( |
| 8 | 8 | 'type' => $type, |
| 9 | 9 | 'message' => $message, |
| 10 | 10 | ); |
| 11 | 11 | return $this->$format($data); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function json($data) |
|
| 15 | - { |
|
| 16 | - header("Content-type: text/x-json"); |
|
| 17 | - echo(is_string($data) ? $data : json_encode($data)); |
|
| 18 | - exit(); |
|
| 19 | - } |
|
| 14 | + public function json($data) |
|
| 15 | + { |
|
| 16 | + header("Content-type: text/x-json"); |
|
| 17 | + echo(is_string($data) ? $data : json_encode($data)); |
|
| 18 | + exit(); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function txt($data) |
|
| 22 | - { |
|
| 23 | - header("Content-type: text/plain"); |
|
| 24 | - echo($data); |
|
| 25 | - exit(); |
|
| 26 | - } |
|
| 21 | + public function txt($data) |
|
| 22 | + { |
|
| 23 | + header("Content-type: text/plain"); |
|
| 24 | + echo($data); |
|
| 25 | + exit(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function html($data) |
|
| 29 | - { |
|
| 30 | - header("Content-type: text/html"); |
|
| 31 | - echo($data); |
|
| 32 | - exit(); |
|
| 33 | - } |
|
| 28 | + public function html($data) |
|
| 29 | + { |
|
| 30 | + header("Content-type: text/html"); |
|
| 31 | + echo($data); |
|
| 32 | + exit(); |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -22,19 +22,19 @@ |
||
| 22 | 22 | return str_pad($hash, $len, "0", STR_PAD_LEFT); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Singleton |
|
| 27 | - * |
|
| 28 | - * @return Nip_Helper_Hash |
|
| 29 | - */ |
|
| 30 | - static public function instance() |
|
| 31 | - { |
|
| 32 | - static $instance; |
|
| 33 | - if (!($instance instanceof self)) { |
|
| 34 | - $instance = new self(); |
|
| 35 | - } |
|
| 36 | - return $instance; |
|
| 37 | - } |
|
| 25 | + /** |
|
| 26 | + * Singleton |
|
| 27 | + * |
|
| 28 | + * @return Nip_Helper_Hash |
|
| 29 | + */ |
|
| 30 | + static public function instance() |
|
| 31 | + { |
|
| 32 | + static $instance; |
|
| 33 | + if (!($instance instanceof self)) { |
|
| 34 | + $instance = new self(); |
|
| 35 | + } |
|
| 36 | + return $instance; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -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 | } |
@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @return Nip_Form_Renderer_Abstract |
| 14 | - */ |
|
| 14 | + */ |
|
| 15 | 15 | public function getRenderer() { |
| 16 | 16 | return $this->_renderer; |
| 17 | 17 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @return Nip_Form_Button_Abstract |
| 26 | - */ |
|
| 26 | + */ |
|
| 27 | 27 | public function getItem() { |
| 28 | 28 | return $this->_item; |
| 29 | 29 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | if (!$element->isRendered()) { |
| 36 | 36 | $return .= '<li class="row">'; |
| 37 | 37 | |
| 38 | - $return = $this->renderLabel($element); |
|
| 38 | + $return = $this->renderLabel($element); |
|
| 39 | 39 | |
| 40 | 40 | $class = "value " . ($element->getType() == 'input' ? 'input' : ''); |
| 41 | 41 | $return .= '<span class="'.$class.'">'; |