@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | if(!extension_loaded('apc')) |
57 | 57 | throw new TConfigurationException('apccache_extension_required'); |
58 | 58 | |
59 | - if(ini_get('apc.enabled') == false) |
|
59 | + if(ini_get('apc.enabled')==false) |
|
60 | 60 | throw new TConfigurationException('apccache_extension_not_enabled'); |
61 | 61 | |
62 | - if(substr(php_sapi_name(), 0, 3) === 'cli' and ini_get('apc.enable_cli') == false) |
|
62 | + if(substr(php_sapi_name(), 0, 3)==='cli' and ini_get('apc.enable_cli')==false) |
|
63 | 63 | throw new TConfigurationException('apccache_extension_not_enabled_cli'); |
64 | 64 | |
65 | 65 | parent::init($config); |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
86 | 86 | * @return boolean true if the value is successfully stored into cache, false otherwise |
87 | 87 | */ |
88 | - protected function setValue($key,$value,$expire) |
|
88 | + protected function setValue($key, $value, $expire) |
|
89 | 89 | { |
90 | - return apc_store($key,$value,$expire); |
|
90 | + return apc_store($key, $value, $expire); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
100 | 100 | * @return boolean true if the value is successfully stored into cache, false otherwise |
101 | 101 | */ |
102 | - protected function addValue($key,$value,$expire) |
|
102 | + protected function addValue($key, $value, $expire) |
|
103 | 103 | { |
104 | - return apc_add($key,$value,$expire); |
|
104 | + return apc_add($key, $value, $expire); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | if(!function_exists('xcache_isset')) |
53 | 53 | throw new TConfigurationException('xcache_extension_required'); |
54 | 54 | |
55 | - $enabled = (int)ini_get('xcache.cacher') !== 0; |
|
56 | - $var_size = (int)ini_get('xcache.var_size'); |
|
55 | + $enabled=(int) ini_get('xcache.cacher')!==0; |
|
56 | + $var_size=(int) ini_get('xcache.var_size'); |
|
57 | 57 | |
58 | 58 | if(!($enabled && $var_size > 0)) |
59 | 59 | throw new TConfigurationException('xcache_extension_not_enabled'); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
82 | 82 | * @return boolean true if the value is successfully stored into cache, false otherwise |
83 | 83 | */ |
84 | - protected function setValue($key,$value,$expire) |
|
84 | + protected function setValue($key, $value, $expire) |
|
85 | 85 | { |
86 | - return xcache_set($key,$value,$expire); |
|
86 | + return xcache_set($key, $value, $expire); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
96 | 96 | * @return boolean true if the value is successfully stored into cache, false otherwise |
97 | 97 | */ |
98 | - protected function addValue($key,$value,$expire) |
|
98 | + protected function addValue($key, $value, $expire) |
|
99 | 99 | { |
100 | - return !xcache_isset($key) ? $this->setValue($key,$value,$expire) : false; |
|
100 | + return !xcache_isset($key) ? $this->setValue($key, $value, $expire) : false; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function flush() |
119 | 119 | { |
120 | - for($i=0, $max=xcache_count(XC_TYPE_VAR); $i<$max; $i++) |
|
120 | + for($i=0, $max=xcache_count(XC_TYPE_VAR); $i < $max; $i++) |
|
121 | 121 | { |
122 | 122 | if(xcache_clear_cache(XC_TYPE_VAR, $i)===false) |
123 | 123 | return false; |
@@ -137,7 +137,7 @@ |
||
137 | 137 | */ |
138 | 138 | public function valid() |
139 | 139 | { |
140 | - return $this->_index<$this->_count; |
|
140 | + return $this->_index < $this->_count; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @package System.Collections |
30 | 30 | * @since 3.0 |
31 | 31 | */ |
32 | -class TStack extends TComponent implements IteratorAggregate,Countable |
|
32 | +class TStack extends TComponent implements IteratorAggregate, Countable |
|
33 | 33 | { |
34 | 34 | /** |
35 | 35 | * internal data storage |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function contains($item) |
100 | 100 | { |
101 | - return array_search($item,$this->_d,true)!==false; |
|
101 | + return array_search($item, $this->_d, true)!==false; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if($this->_c===0) |
113 | 113 | throw new TInvalidOperationException('stack_empty'); |
114 | 114 | else |
115 | - return $this->_d[$this->_c-1]; |
|
115 | + return $this->_d[$this->_c - 1]; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | public function push($item) |
139 | 139 | { |
140 | 140 | ++$this->_c; |
141 | - $this->_d[] = $item; |
|
141 | + $this->_d[]=$item; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getIterator() |
150 | 150 | { |
151 | - return new ArrayIterator( $this->_d ); |
|
151 | + return new ArrayIterator($this->_d); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function valid() |
256 | 256 | { |
257 | - return $this->_i<$this->_c; |
|
257 | + return $this->_i < $this->_c; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 |
@@ -81,8 +81,7 @@ |
||
81 | 81 | $this->_d[]=$item; |
82 | 82 | ++$this->_c; |
83 | 83 | } |
84 | - } |
|
85 | - else if($data!==null) |
|
84 | + } else if($data!==null) |
|
86 | 85 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
87 | 86 | } |
88 | 87 |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | public function createListItem($index=-1) |
39 | 39 | { |
40 | 40 | $item=$this->createNewListItem(); |
41 | - if($index<0) |
|
41 | + if($index < 0) |
|
42 | 42 | $this->add($item); |
43 | 43 | else |
44 | - $this->insertAt($index,$item); |
|
44 | + $this->insertAt($index, $item); |
|
45 | 45 | return $item; |
46 | 46 | } |
47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function createNewListItem($text=null) |
52 | 52 | { |
53 | - $item = new TListItem; |
|
53 | + $item=new TListItem; |
|
54 | 54 | if($text!==null) |
55 | 55 | $item->setText($text); |
56 | 56 | return $item; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | * @param TListItem the item to be inserted. |
64 | 64 | * @throws TInvalidDataTypeException if the item being inserted is neither a string nor TListItem |
65 | 65 | */ |
66 | - public function insertAt($index,$item) |
|
66 | + public function insertAt($index, $item) |
|
67 | 67 | { |
68 | 68 | if(is_string($item)) |
69 | - $item = $this->createNewListItem($item); |
|
69 | + $item=$this->createNewListItem($item); |
|
70 | 70 | if(!($item instanceof TListItem)) |
71 | - throw new TInvalidDataTypeException('listitemcollection_item_invalid',get_class($this)); |
|
72 | - parent::insertAt($index,$item); |
|
71 | + throw new TInvalidDataTypeException('listitemcollection_item_invalid', get_class($this)); |
|
72 | + parent::insertAt($index, $item); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param boolean whether to look for disabled items also |
79 | 79 | * @return integer the index of the item found, -1 if not found. |
80 | 80 | */ |
81 | - public function findIndexByValue($value,$includeDisabled=true) |
|
81 | + public function findIndexByValue($value, $includeDisabled=true) |
|
82 | 82 | { |
83 | 83 | $value=TPropertyValue::ensureString($value); |
84 | 84 | $index=0; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param boolean whether to look for disabled items also |
98 | 98 | * @return integer the index of the item found, -1 if not found. |
99 | 99 | */ |
100 | - public function findIndexByText($text,$includeDisabled=true) |
|
100 | + public function findIndexByText($text, $includeDisabled=true) |
|
101 | 101 | { |
102 | 102 | $text=TPropertyValue::ensureString($text); |
103 | 103 | $index=0; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @param boolean whether to look for disabled items also |
117 | 117 | * @return TListItem the item found, null if not found. |
118 | 118 | */ |
119 | - public function findItemByValue($value,$includeDisabled=true) |
|
119 | + public function findItemByValue($value, $includeDisabled=true) |
|
120 | 120 | { |
121 | - if(($index=$this->findIndexByValue($value,$includeDisabled))>=0) |
|
121 | + if(($index=$this->findIndexByValue($value, $includeDisabled)) >= 0) |
|
122 | 122 | return $this->itemAt($index); |
123 | 123 | else |
124 | 124 | return null; |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param boolean whether to look for disabled items also |
131 | 131 | * @return TListItem the item found, null if not found. |
132 | 132 | */ |
133 | - public function findItemByText($text,$includeDisabled=true) |
|
133 | + public function findItemByText($text, $includeDisabled=true) |
|
134 | 134 | { |
135 | - if(($index=$this->findIndexByText($text,$includeDisabled))>=0) |
|
135 | + if(($index=$this->findIndexByText($text, $includeDisabled)) >= 0) |
|
136 | 136 | return $this->itemAt($index); |
137 | 137 | else |
138 | 138 | return null; |
@@ -157,6 +157,6 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function saveState() |
159 | 159 | { |
160 | - return ($this->getCount()>0) ? $this->toArray() : null; |
|
160 | + return ($this->getCount() > 0) ? $this->toArray() : null; |
|
161 | 161 | } |
162 | 162 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * To trim or not to trim the contents. |
51 | 51 | * @var boolean |
52 | 52 | */ |
53 | - protected $trim = true; |
|
53 | + protected $trim=true; |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function setKey($value) |
72 | 72 | { |
73 | - $this->key = $value; |
|
73 | + $this->key=$value; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setTrim($value) |
81 | 81 | { |
82 | - $this->trim = TPropertyValue::ensureBoolean($value); |
|
82 | + $this->trim=TPropertyValue::ensureBoolean($value); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getParameter() |
108 | 108 | { |
109 | - $value = $this->getValue(); |
|
109 | + $value=$this->getValue(); |
|
110 | 110 | if(strlen($value) > 0) |
111 | 111 | return $value; |
112 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
112 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
113 | 113 | $this->renderControl($htmlWriter); |
114 | 114 | return $this->getTrim() ? |
115 | 115 | trim($htmlWriter->flush()) : $htmlWriter->flush(); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TTranslateParameter component. |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.I18N |
|
10 | - */ |
|
3 | + * TTranslateParameter component. |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.I18N |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * TTranslateParameter component should be used inside the TTranslate component to |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | //initialized the default class wide formatter |
44 | 44 | if(!isset(self::$formatters[$catalogue])) |
45 | 45 | { |
46 | - $app = Prado::getApplication()->getGlobalization(); |
|
47 | - $config = $app->getTranslationConfiguration(); |
|
48 | - $source = MessageSource::factory($config['type'], |
|
46 | + $app=Prado::getApplication()->getGlobalization(); |
|
47 | + $config=$app->getTranslationConfiguration(); |
|
48 | + $source=MessageSource::factory($config['type'], |
|
49 | 49 | $config['source'], |
50 | 50 | $config['filename']); |
51 | 51 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | if(TPropertyValue::ensureBoolean($config['cache'])) |
55 | 55 | $source->setCache(new MessageCache($config['cache'])); |
56 | 56 | |
57 | - self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset()); |
|
57 | + self::$formatters[$catalogue]=new MessageFormat($source, $app->getCharset()); |
|
58 | 58 | |
59 | 59 | //mark untranslated text |
60 | 60 | if($ps=$config['marker']) |
61 | - self::$formatters[$catalogue]->setUntranslatedPS(array($ps,$ps)); |
|
61 | + self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps)); |
|
62 | 62 | |
63 | 63 | //save the message on end request |
64 | 64 | // Do it only once ! |
@@ -86,21 +86,21 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function saveMessages() |
88 | 88 | { |
89 | - static $onceonly = true; |
|
89 | + static $onceonly=true; |
|
90 | 90 | |
91 | 91 | if($onceonly) |
92 | 92 | { |
93 | - foreach (self::$formatters as $catalogue=>$formatter) |
|
93 | + foreach(self::$formatters as $catalogue=>$formatter) |
|
94 | 94 | { |
95 | - $app = Prado::getApplication()->getGlobalization(); |
|
96 | - $config = $app->getTranslationConfiguration(); |
|
95 | + $app=Prado::getApplication()->getGlobalization(); |
|
96 | + $config=$app->getTranslationConfiguration(); |
|
97 | 97 | if(isset($config['autosave'])) |
98 | 98 | { |
99 | 99 | $formatter->getSource()->setCulture($app->getCulture()); |
100 | 100 | $formatter->getSource()->save($catalogue); |
101 | 101 | } |
102 | 102 | } |
103 | - $onceonly = false; |
|
103 | + $onceonly=false; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | parent::init($xml); |
33 | 33 | |
34 | 34 | //set the culture according to browser language settings |
35 | - $http = new HTTPNegotiator(); |
|
36 | - $languages = $http->getLanguages(); |
|
35 | + $http=new HTTPNegotiator(); |
|
36 | + $languages=$http->getLanguages(); |
|
37 | 37 | if(count($languages) > 0) |
38 | 38 | { |
39 | 39 | $this->_detectedLanguage=$languages[0]; |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getCharset() |
43 | 43 | { |
44 | - $app = $this->getApplication()->getGlobalization(false); |
|
44 | + $app=$this->getApplication()->getGlobalization(false); |
|
45 | 45 | |
46 | 46 | //instance charset |
47 | - $charset = $this->getViewState('Charset',''); |
|
47 | + $charset=$this->getViewState('Charset', ''); |
|
48 | 48 | |
49 | 49 | //fall back to globalization charset |
50 | 50 | if(empty($charset)) |
51 | - $charset = ($app===null) ? '' : $app->getCharset(); |
|
51 | + $charset=($app===null) ? '' : $app->getCharset(); |
|
52 | 52 | |
53 | 53 | //fall back to default charset |
54 | 54 | if(empty($charset)) |
55 | - $charset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
55 | + $charset=($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
56 | 56 | |
57 | 57 | return $charset; |
58 | 58 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setCharset($value) |
65 | 65 | { |
66 | - $this->setViewState('Charset',$value,''); |
|
66 | + $this->setViewState('Charset', $value, ''); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getCulture() |
76 | 76 | { |
77 | - return $this->getViewState('Culture',''); |
|
77 | + return $this->getViewState('Culture', ''); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setCulture($culture) |
85 | 85 | { |
86 | - $this->setViewState('Culture',$culture,''); |
|
86 | + $this->setViewState('Culture', $culture, ''); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 |