@@ -199,9 +199,9 @@ |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | - * Gets the CultureInfo that for this culture string |
|
203 | - * @return CultureInfo invariant culture info is "en". |
|
204 | - */ |
|
202 | + * Gets the CultureInfo that for this culture string |
|
203 | + * @return CultureInfo invariant culture info is "en". |
|
204 | + */ |
|
205 | 205 | public static function getInstance($culture) |
206 | 206 | { |
207 | 207 | static $instances = array(); |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TGettext_PO class file. |
|
4 | - * |
|
5 | - * This program is free software; you can redistribute it and/or modify |
|
6 | - * it under the terms of the BSD License. |
|
7 | - * |
|
8 | - * Copyright(c) 2004 by Qiang Xue. All rights reserved. |
|
9 | - * |
|
10 | - * To contact the author write to {@link mailto:[email protected] Qiang Xue} |
|
11 | - * The latest version of PRADO can be obtained from: |
|
12 | - * {@link http://prado.sourceforge.net/} |
|
13 | - * |
|
14 | - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
15 | - * @version $Revision: 1.2 $ $Date: 2005/01/05 03:15:14 $ |
|
16 | - * @package System.I18N.core |
|
17 | - */ |
|
3 | + * TGettext_PO class file. |
|
4 | + * |
|
5 | + * This program is free software; you can redistribute it and/or modify |
|
6 | + * it under the terms of the BSD License. |
|
7 | + * |
|
8 | + * Copyright(c) 2004 by Qiang Xue. All rights reserved. |
|
9 | + * |
|
10 | + * To contact the author write to {@link mailto:[email protected] Qiang Xue} |
|
11 | + * The latest version of PRADO can be obtained from: |
|
12 | + * {@link http://prado.sourceforge.net/} |
|
13 | + * |
|
14 | + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
15 | + * @version $Revision: 1.2 $ $Date: 2005/01/05 03:15:14 $ |
|
16 | + * @package System.I18N.core |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | // +----------------------------------------------------------------------+ |
20 | 20 | // | PEAR :: File :: Gettext :: PO | |
@@ -51,110 +51,110 @@ discard block |
||
51 | 51 | */ |
52 | 52 | class TGettext_PO extends TGettext |
53 | 53 | { |
54 | - /** |
|
55 | - * Constructor |
|
56 | - * |
|
57 | - * @access public |
|
58 | - * @return object File_Gettext_PO |
|
59 | - * @param string path to GNU PO file |
|
60 | - */ |
|
61 | - function TGettext_PO($file = '') |
|
62 | - { |
|
63 | - $this->file = $file; |
|
64 | - } |
|
54 | + /** |
|
55 | + * Constructor |
|
56 | + * |
|
57 | + * @access public |
|
58 | + * @return object File_Gettext_PO |
|
59 | + * @param string path to GNU PO file |
|
60 | + */ |
|
61 | + function TGettext_PO($file = '') |
|
62 | + { |
|
63 | + $this->file = $file; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Load PO file |
|
68 | - * |
|
69 | - * @access public |
|
70 | - * @return mixed Returns true on success or PEAR_Error on failure. |
|
71 | - * @param string $file |
|
72 | - */ |
|
73 | - function load($file = null) |
|
74 | - { |
|
75 | - if (!isset($file)) { |
|
76 | - $file = $this->file; |
|
77 | - } |
|
66 | + /** |
|
67 | + * Load PO file |
|
68 | + * |
|
69 | + * @access public |
|
70 | + * @return mixed Returns true on success or PEAR_Error on failure. |
|
71 | + * @param string $file |
|
72 | + */ |
|
73 | + function load($file = null) |
|
74 | + { |
|
75 | + if (!isset($file)) { |
|
76 | + $file = $this->file; |
|
77 | + } |
|
78 | 78 | |
79 | - // load file |
|
80 | - if (!$contents = @file($file)) { |
|
81 | - return false; |
|
82 | - } |
|
83 | - $contents = implode('', $contents); |
|
79 | + // load file |
|
80 | + if (!$contents = @file($file)) { |
|
81 | + return false; |
|
82 | + } |
|
83 | + $contents = implode('', $contents); |
|
84 | 84 | |
85 | - // match all msgid/msgstr entries |
|
86 | - $matched = preg_match_all( |
|
87 | - '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' . |
|
88 | - '(msgstr\s+("([^"]|\\\\")*?"\s*)+)/', |
|
89 | - $contents, $matches |
|
90 | - ); |
|
91 | - unset($contents); |
|
85 | + // match all msgid/msgstr entries |
|
86 | + $matched = preg_match_all( |
|
87 | + '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' . |
|
88 | + '(msgstr\s+("([^"]|\\\\")*?"\s*)+)/', |
|
89 | + $contents, $matches |
|
90 | + ); |
|
91 | + unset($contents); |
|
92 | 92 | |
93 | - if (!$matched) { |
|
94 | - return false; |
|
95 | - } |
|
93 | + if (!$matched) { |
|
94 | + return false; |
|
95 | + } |
|
96 | 96 | |
97 | - // get all msgids and msgtrs |
|
98 | - for ($i = 0; $i < $matched; $i++) { |
|
99 | - $msgid = preg_replace( |
|
100 | - '/\s*msgid\s*"(.*)"\s*/s', '\\1', $matches[1][$i]); |
|
101 | - $msgstr= preg_replace( |
|
102 | - '/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]); |
|
103 | - $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr); |
|
104 | - } |
|
97 | + // get all msgids and msgtrs |
|
98 | + for ($i = 0; $i < $matched; $i++) { |
|
99 | + $msgid = preg_replace( |
|
100 | + '/\s*msgid\s*"(.*)"\s*/s', '\\1', $matches[1][$i]); |
|
101 | + $msgstr= preg_replace( |
|
102 | + '/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]); |
|
103 | + $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr); |
|
104 | + } |
|
105 | 105 | |
106 | - // check for meta info |
|
107 | - if (isset($this->strings[''])) { |
|
108 | - $this->meta = parent::meta2array($this->strings['']); |
|
109 | - unset($this->strings['']); |
|
110 | - } |
|
106 | + // check for meta info |
|
107 | + if (isset($this->strings[''])) { |
|
108 | + $this->meta = parent::meta2array($this->strings['']); |
|
109 | + unset($this->strings['']); |
|
110 | + } |
|
111 | 111 | |
112 | - return true; |
|
113 | - } |
|
112 | + return true; |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Save PO file |
|
117 | - * |
|
118 | - * @access public |
|
119 | - * @return mixed Returns true on success or PEAR_Error on failure. |
|
120 | - * @param string $file |
|
121 | - */ |
|
122 | - function save($file = null) |
|
123 | - { |
|
124 | - if (!isset($file)) { |
|
125 | - $file = $this->file; |
|
126 | - } |
|
115 | + /** |
|
116 | + * Save PO file |
|
117 | + * |
|
118 | + * @access public |
|
119 | + * @return mixed Returns true on success or PEAR_Error on failure. |
|
120 | + * @param string $file |
|
121 | + */ |
|
122 | + function save($file = null) |
|
123 | + { |
|
124 | + if (!isset($file)) { |
|
125 | + $file = $this->file; |
|
126 | + } |
|
127 | 127 | |
128 | - // open PO file |
|
129 | - if (!is_resource($fh = @fopen($file, 'w'))) { |
|
130 | - return false; |
|
131 | - } |
|
128 | + // open PO file |
|
129 | + if (!is_resource($fh = @fopen($file, 'w'))) { |
|
130 | + return false; |
|
131 | + } |
|
132 | 132 | |
133 | - // lock PO file exclusively |
|
134 | - if (!flock($fh, LOCK_EX)) { |
|
135 | - fclose($fh); |
|
136 | - return false; |
|
137 | - } |
|
138 | - // write meta info |
|
139 | - if (count($this->meta)) { |
|
140 | - $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n"; |
|
141 | - foreach ($this->meta as $k => $v) { |
|
142 | - $meta .= '"' . $k . ': ' . $v . '\n"' . "\n"; |
|
143 | - } |
|
144 | - fwrite($fh, $meta . "\n"); |
|
145 | - } |
|
146 | - // write strings |
|
147 | - foreach ($this->strings as $o => $t) { |
|
148 | - fwrite($fh, |
|
149 | - 'msgid "' . parent::prepare($o, true) . '"' . "\n" . |
|
150 | - 'msgstr "' . parent::prepare($t, true) . '"' . "\n\n" |
|
151 | - ); |
|
152 | - } |
|
133 | + // lock PO file exclusively |
|
134 | + if (!flock($fh, LOCK_EX)) { |
|
135 | + fclose($fh); |
|
136 | + return false; |
|
137 | + } |
|
138 | + // write meta info |
|
139 | + if (count($this->meta)) { |
|
140 | + $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n"; |
|
141 | + foreach ($this->meta as $k => $v) { |
|
142 | + $meta .= '"' . $k . ': ' . $v . '\n"' . "\n"; |
|
143 | + } |
|
144 | + fwrite($fh, $meta . "\n"); |
|
145 | + } |
|
146 | + // write strings |
|
147 | + foreach ($this->strings as $o => $t) { |
|
148 | + fwrite($fh, |
|
149 | + 'msgid "' . parent::prepare($o, true) . '"' . "\n" . |
|
150 | + 'msgstr "' . parent::prepare($t, true) . '"' . "\n\n" |
|
151 | + ); |
|
152 | + } |
|
153 | 153 | |
154 | - //done |
|
155 | - @flock($fh, LOCK_UN); |
|
156 | - @fclose($fh); |
|
157 | - chmod($file,PRADO_CHMOD); |
|
158 | - return true; |
|
159 | - } |
|
154 | + //done |
|
155 | + @flock($fh, LOCK_UN); |
|
156 | + @fclose($fh); |
|
157 | + chmod($file,PRADO_CHMOD); |
|
158 | + return true; |
|
159 | + } |
|
160 | 160 | } |
@@ -92,43 +92,43 @@ |
||
92 | 92 | */ |
93 | 93 | $dsninfo = $this->dns; |
94 | 94 | |
95 | - if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') |
|
96 | - $dbhost = ':' . $dsninfo['socket']; |
|
97 | - else |
|
98 | - { |
|
95 | + if (isset($dsninfo['protocol']) && $dsninfo['protocol'] == 'unix') |
|
96 | + $dbhost = ':' . $dsninfo['socket']; |
|
97 | + else |
|
98 | + { |
|
99 | 99 | $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; |
100 | - if (!empty($dsninfo['port'])) |
|
101 | - $dbhost .= ':' . $dsninfo['port']; |
|
102 | - } |
|
103 | - $user = $dsninfo['username']; |
|
104 | - $pw = $dsninfo['password']; |
|
105 | - |
|
106 | - $connect_function = 'mysql_connect'; |
|
107 | - |
|
108 | - if ($dbhost && $user && $pw) |
|
109 | - $conn = @$connect_function($dbhost, $user, $pw); |
|
110 | - elseif ($dbhost && $user) |
|
111 | - $conn = @$connect_function($dbhost, $user); |
|
112 | - elseif ($dbhost) |
|
113 | - $conn = @$connect_function($dbhost); |
|
114 | - else |
|
115 | - $conn = false; |
|
116 | - |
|
117 | - if (empty($conn)) |
|
118 | - { |
|
119 | - throw new Exception('Error in connecting to '.$dsninfo); |
|
120 | - } |
|
121 | - |
|
122 | - if ($dsninfo['database']) |
|
123 | - { |
|
124 | - if (!@mysql_select_db($dsninfo['database'], $conn)) |
|
125 | - throw new Exception('Error in connecting database, dns:'. |
|
126 | - $dsninfo); |
|
127 | - } |
|
128 | - else |
|
129 | - throw new Exception('Please provide a database for message'. |
|
130 | - ' translation.'); |
|
131 | - return $conn; |
|
100 | + if (!empty($dsninfo['port'])) |
|
101 | + $dbhost .= ':' . $dsninfo['port']; |
|
102 | + } |
|
103 | + $user = $dsninfo['username']; |
|
104 | + $pw = $dsninfo['password']; |
|
105 | + |
|
106 | + $connect_function = 'mysql_connect'; |
|
107 | + |
|
108 | + if ($dbhost && $user && $pw) |
|
109 | + $conn = @$connect_function($dbhost, $user, $pw); |
|
110 | + elseif ($dbhost && $user) |
|
111 | + $conn = @$connect_function($dbhost, $user); |
|
112 | + elseif ($dbhost) |
|
113 | + $conn = @$connect_function($dbhost); |
|
114 | + else |
|
115 | + $conn = false; |
|
116 | + |
|
117 | + if (empty($conn)) |
|
118 | + { |
|
119 | + throw new Exception('Error in connecting to '.$dsninfo); |
|
120 | + } |
|
121 | + |
|
122 | + if ($dsninfo['database']) |
|
123 | + { |
|
124 | + if (!@mysql_select_db($dsninfo['database'], $conn)) |
|
125 | + throw new Exception('Error in connecting database, dns:'. |
|
126 | + $dsninfo); |
|
127 | + } |
|
128 | + else |
|
129 | + throw new Exception('Please provide a database for message'. |
|
130 | + ' translation.'); |
|
131 | + return $conn; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $tmp = $data; |
61 | 61 | foreach (explode(".", $field) as $f) |
62 | - $tmp = $tmp[$f]; |
|
62 | + $tmp = $tmp[$f]; |
|
63 | 63 | return $tmp; |
64 | 64 | } |
65 | 65 | else if(is_object($data)) |
@@ -104,30 +104,30 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @var boolean controls the use of a persistent connection. Default to true. |
106 | 106 | */ |
107 | - private $_persistence = true; |
|
108 | - /** |
|
109 | - * @var integer number of buckets to create for this server which in turn control its |
|
110 | - * probability of it being selected. The probability is relative to the total weight |
|
111 | - * of all servers. |
|
112 | - */ |
|
113 | - private $_weight = 1; |
|
107 | + private $_persistence = true; |
|
108 | + /** |
|
109 | + * @var integer number of buckets to create for this server which in turn control its |
|
110 | + * probability of it being selected. The probability is relative to the total weight |
|
111 | + * of all servers. |
|
112 | + */ |
|
113 | + private $_weight = 1; |
|
114 | 114 | |
115 | - private $_timeout = 360; |
|
115 | + private $_timeout = 360; |
|
116 | 116 | |
117 | - private $_retryInterval = 15; |
|
117 | + private $_retryInterval = 15; |
|
118 | 118 | /** |
119 | - * @var integer Controls the minimum value length before attempting to compress automatically. |
|
120 | - */ |
|
121 | - private $_threshold=0; |
|
119 | + * @var integer Controls the minimum value length before attempting to compress automatically. |
|
120 | + */ |
|
121 | + private $_threshold=0; |
|
122 | 122 | |
123 | 123 | /** |
124 | - * @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings. |
|
125 | - */ |
|
126 | - private $_minSavings=0.0; |
|
124 | + * @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings. |
|
125 | + */ |
|
126 | + private $_minSavings=0.0; |
|
127 | 127 | |
128 | - private $_status = true; |
|
128 | + private $_status = true; |
|
129 | 129 | |
130 | - private $_failureCallback = null; |
|
130 | + private $_failureCallback = null; |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * @var boolean whether to use memcached or memcache as the underlying caching extension. |
@@ -171,63 +171,63 @@ discard block |
||
171 | 171 | $this->_cache = $this->_useMemcached ? new Memcached : new Memcache; |
172 | 172 | $this->loadConfig($config); |
173 | 173 | if(count($this->_servers)) |
174 | - { |
|
175 | - foreach($this->_servers as $server) |
|
176 | - { |
|
177 | - Prado::trace('Adding server '.$server['Host'].' from serverlist', 'System.Caching.TMemCache'); |
|
178 | - if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
179 | - $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false) |
|
180 | - throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']); |
|
181 | - } |
|
182 | - } |
|
183 | - else |
|
184 | - { |
|
185 | - Prado::trace('Adding server '.$this->_host, 'System.Caching.TMemCache'); |
|
186 | - if($this->_cache->addServer($this->_host,$this->_port)===false) |
|
187 | - throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port); |
|
188 | - } |
|
174 | + { |
|
175 | + foreach($this->_servers as $server) |
|
176 | + { |
|
177 | + Prado::trace('Adding server '.$server['Host'].' from serverlist', 'System.Caching.TMemCache'); |
|
178 | + if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
179 | + $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false) |
|
180 | + throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']); |
|
181 | + } |
|
182 | + } |
|
183 | + else |
|
184 | + { |
|
185 | + Prado::trace('Adding server '.$this->_host, 'System.Caching.TMemCache'); |
|
186 | + if($this->_cache->addServer($this->_host,$this->_port)===false) |
|
187 | + throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port); |
|
188 | + } |
|
189 | 189 | if($this->_threshold!==0) |
190 | - $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings); |
|
190 | + $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings); |
|
191 | 191 | $this->_initialized=true; |
192 | 192 | parent::init($config); |
193 | 193 | } |
194 | 194 | |
195 | - /** |
|
195 | + /** |
|
196 | 196 | * Loads configuration from an XML element |
197 | 197 | * @param TXmlElement configuration node |
198 | 198 | * @throws TConfigurationException if log route class or type is not specified |
199 | 199 | */ |
200 | 200 | private function loadConfig($xml) |
201 | 201 | { |
202 | - if($xml instanceof TXmlElement) |
|
202 | + if($xml instanceof TXmlElement) |
|
203 | 203 | { |
204 | - foreach($xml->getElementsByTagName('server') as $serverConfig) |
|
205 | - { |
|
206 | - $properties=$serverConfig->getAttributes(); |
|
207 | - if(($host=$properties->remove('Host'))===null) |
|
208 | - throw new TConfigurationException('memcache_serverhost_required'); |
|
209 | - if(($port=$properties->remove('Port'))===null) |
|
210 | - throw new TConfigurationException('memcache_serverport_required'); |
|
211 | - if(!is_numeric($port)) |
|
212 | - throw new TConfigurationException('memcache_serverport_invalid'); |
|
213 | - $server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true); |
|
214 | - $checks = array( |
|
215 | - 'Weight'=>'memcache_serverweight_invalid', |
|
216 | - 'Timeout'=>'memcache_servertimeout_invalid', |
|
217 | - 'RetryInterval'=>'memcach_serverretryinterval_invalid' |
|
218 | - ); |
|
219 | - foreach($checks as $property=>$exception) |
|
220 | - { |
|
221 | - $value=$properties->remove($property); |
|
222 | - if($value!==null && is_numeric($value)) |
|
223 | - $server[$property]=$value; |
|
224 | - else if($value!==null) |
|
225 | - throw new TConfigurationException($exception); |
|
226 | - } |
|
227 | - $server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
228 | - $this->_servers[]=$server; |
|
229 | - } |
|
230 | - } |
|
204 | + foreach($xml->getElementsByTagName('server') as $serverConfig) |
|
205 | + { |
|
206 | + $properties=$serverConfig->getAttributes(); |
|
207 | + if(($host=$properties->remove('Host'))===null) |
|
208 | + throw new TConfigurationException('memcache_serverhost_required'); |
|
209 | + if(($port=$properties->remove('Port'))===null) |
|
210 | + throw new TConfigurationException('memcache_serverport_required'); |
|
211 | + if(!is_numeric($port)) |
|
212 | + throw new TConfigurationException('memcache_serverport_invalid'); |
|
213 | + $server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true); |
|
214 | + $checks = array( |
|
215 | + 'Weight'=>'memcache_serverweight_invalid', |
|
216 | + 'Timeout'=>'memcache_servertimeout_invalid', |
|
217 | + 'RetryInterval'=>'memcach_serverretryinterval_invalid' |
|
218 | + ); |
|
219 | + foreach($checks as $property=>$exception) |
|
220 | + { |
|
221 | + $value=$properties->remove($property); |
|
222 | + if($value!==null && is_numeric($value)) |
|
223 | + $server[$property]=$value; |
|
224 | + else if($value!==null) |
|
225 | + throw new TConfigurationException($exception); |
|
226 | + } |
|
227 | + $server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
228 | + $this->_servers[]=$server; |
|
229 | + } |
|
230 | + } |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -60,229 +60,229 @@ |
||
60 | 60 | // -- Public Static Methods -------------------------------------------------- |
61 | 61 | |
62 | 62 | public static function minify($js) { |
63 | - $jsmin = new JSMin($js); |
|
64 | - return $jsmin->min(); |
|
63 | + $jsmin = new JSMin($js); |
|
64 | + return $jsmin->min(); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // -- Public Instance Methods ------------------------------------------------ |
68 | 68 | |
69 | 69 | public function __construct($input) { |
70 | - $this->input = str_replace("\r\n", "\n", $input); |
|
71 | - $this->inputLength = strlen($this->input); |
|
70 | + $this->input = str_replace("\r\n", "\n", $input); |
|
71 | + $this->inputLength = strlen($this->input); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // -- Protected Instance Methods --------------------------------------------- |
75 | 75 | |
76 | 76 | protected function action($d) { |
77 | - switch($d) { |
|
78 | - case 1: |
|
79 | - $this->output .= $this->a; |
|
80 | - |
|
81 | - case 2: |
|
82 | - $this->a = $this->b; |
|
83 | - |
|
84 | - if ($this->a === "'" || $this->a === '"') { |
|
85 | - for (;;) { |
|
86 | - $this->output .= $this->a; |
|
87 | - $this->a = $this->get(); |
|
88 | - |
|
89 | - if ($this->a === $this->b) { |
|
90 | - break; |
|
91 | - } |
|
92 | - |
|
93 | - if (ord($this->a) <= self::ORD_LF) { |
|
94 | - throw new JSMinException('Unterminated string literal.'); |
|
95 | - } |
|
96 | - |
|
97 | - if ($this->a === '\\') { |
|
98 | - $this->output .= $this->a; |
|
99 | - $this->a = $this->get(); |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - case 3: |
|
105 | - $this->b = $this->next(); |
|
106 | - |
|
107 | - if ($this->b === '/' && ( |
|
108 | - $this->a === '(' || $this->a === ',' || $this->a === '=' || |
|
109 | - $this->a === ':' || $this->a === '[' || $this->a === '!' || |
|
110 | - $this->a === '&' || $this->a === '|' || $this->a === '?')) { |
|
111 | - |
|
112 | - $this->output .= $this->a . $this->b; |
|
113 | - |
|
114 | - for (;;) { |
|
115 | - $this->a = $this->get(); |
|
116 | - |
|
117 | - if ($this->a === '/') { |
|
118 | - break; |
|
119 | - } elseif ($this->a === '\\') { |
|
120 | - $this->output .= $this->a; |
|
121 | - $this->a = $this->get(); |
|
122 | - } elseif (ord($this->a) <= self::ORD_LF) { |
|
123 | - throw new JSMinException('Unterminated regular expression '. |
|
124 | - 'literal.'); |
|
125 | - } |
|
126 | - |
|
127 | - $this->output .= $this->a; |
|
128 | - } |
|
129 | - |
|
130 | - $this->b = $this->next(); |
|
131 | - } |
|
132 | - } |
|
77 | + switch($d) { |
|
78 | + case 1: |
|
79 | + $this->output .= $this->a; |
|
80 | + |
|
81 | + case 2: |
|
82 | + $this->a = $this->b; |
|
83 | + |
|
84 | + if ($this->a === "'" || $this->a === '"') { |
|
85 | + for (;;) { |
|
86 | + $this->output .= $this->a; |
|
87 | + $this->a = $this->get(); |
|
88 | + |
|
89 | + if ($this->a === $this->b) { |
|
90 | + break; |
|
91 | + } |
|
92 | + |
|
93 | + if (ord($this->a) <= self::ORD_LF) { |
|
94 | + throw new JSMinException('Unterminated string literal.'); |
|
95 | + } |
|
96 | + |
|
97 | + if ($this->a === '\\') { |
|
98 | + $this->output .= $this->a; |
|
99 | + $this->a = $this->get(); |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + case 3: |
|
105 | + $this->b = $this->next(); |
|
106 | + |
|
107 | + if ($this->b === '/' && ( |
|
108 | + $this->a === '(' || $this->a === ',' || $this->a === '=' || |
|
109 | + $this->a === ':' || $this->a === '[' || $this->a === '!' || |
|
110 | + $this->a === '&' || $this->a === '|' || $this->a === '?')) { |
|
111 | + |
|
112 | + $this->output .= $this->a . $this->b; |
|
113 | + |
|
114 | + for (;;) { |
|
115 | + $this->a = $this->get(); |
|
116 | + |
|
117 | + if ($this->a === '/') { |
|
118 | + break; |
|
119 | + } elseif ($this->a === '\\') { |
|
120 | + $this->output .= $this->a; |
|
121 | + $this->a = $this->get(); |
|
122 | + } elseif (ord($this->a) <= self::ORD_LF) { |
|
123 | + throw new JSMinException('Unterminated regular expression '. |
|
124 | + 'literal.'); |
|
125 | + } |
|
126 | + |
|
127 | + $this->output .= $this->a; |
|
128 | + } |
|
129 | + |
|
130 | + $this->b = $this->next(); |
|
131 | + } |
|
132 | + } |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | protected function get() { |
136 | - $c = $this->lookAhead; |
|
137 | - $this->lookAhead = null; |
|
138 | - |
|
139 | - if ($c === null) { |
|
140 | - if ($this->inputIndex < $this->inputLength) { |
|
141 | - $c = $this->input[$this->inputIndex]; |
|
142 | - $this->inputIndex += 1; |
|
143 | - } else { |
|
144 | - $c = null; |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ($c === "\r") { |
|
149 | - return "\n"; |
|
150 | - } |
|
151 | - |
|
152 | - if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { |
|
153 | - return $c; |
|
154 | - } |
|
155 | - |
|
156 | - return ' '; |
|
136 | + $c = $this->lookAhead; |
|
137 | + $this->lookAhead = null; |
|
138 | + |
|
139 | + if ($c === null) { |
|
140 | + if ($this->inputIndex < $this->inputLength) { |
|
141 | + $c = $this->input[$this->inputIndex]; |
|
142 | + $this->inputIndex += 1; |
|
143 | + } else { |
|
144 | + $c = null; |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ($c === "\r") { |
|
149 | + return "\n"; |
|
150 | + } |
|
151 | + |
|
152 | + if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { |
|
153 | + return $c; |
|
154 | + } |
|
155 | + |
|
156 | + return ' '; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | protected function isAlphaNum($c) { |
160 | - return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
|
160 | + return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | protected function min() { |
164 | - $this->a = "\n"; |
|
165 | - $this->action(3); |
|
166 | - |
|
167 | - while ($this->a !== null) { |
|
168 | - switch ($this->a) { |
|
169 | - case ' ': |
|
170 | - if ($this->isAlphaNum($this->b)) { |
|
171 | - $this->action(1); |
|
172 | - } else { |
|
173 | - $this->action(2); |
|
174 | - } |
|
175 | - break; |
|
176 | - |
|
177 | - case "\n": |
|
178 | - switch ($this->b) { |
|
179 | - case '{': |
|
180 | - case '[': |
|
181 | - case '(': |
|
182 | - case '+': |
|
183 | - case '-': |
|
184 | - $this->action(1); |
|
185 | - break; |
|
186 | - |
|
187 | - case ' ': |
|
188 | - $this->action(3); |
|
189 | - break; |
|
190 | - |
|
191 | - default: |
|
192 | - if ($this->isAlphaNum($this->b)) { |
|
193 | - $this->action(1); |
|
194 | - } |
|
195 | - else { |
|
196 | - $this->action(2); |
|
197 | - } |
|
198 | - } |
|
199 | - break; |
|
200 | - |
|
201 | - default: |
|
202 | - switch ($this->b) { |
|
203 | - case ' ': |
|
204 | - if ($this->isAlphaNum($this->a)) { |
|
205 | - $this->action(1); |
|
206 | - break; |
|
207 | - } |
|
208 | - |
|
209 | - $this->action(3); |
|
210 | - break; |
|
211 | - |
|
212 | - case "\n": |
|
213 | - switch ($this->a) { |
|
214 | - case '}': |
|
215 | - case ']': |
|
216 | - case ')': |
|
217 | - case '+': |
|
218 | - case '-': |
|
219 | - case '"': |
|
220 | - case "'": |
|
221 | - $this->action(1); |
|
222 | - break; |
|
223 | - |
|
224 | - default: |
|
225 | - if ($this->isAlphaNum($this->a)) { |
|
226 | - $this->action(1); |
|
227 | - } |
|
228 | - else { |
|
229 | - $this->action(3); |
|
230 | - } |
|
231 | - } |
|
232 | - break; |
|
233 | - |
|
234 | - default: |
|
235 | - $this->action(1); |
|
236 | - break; |
|
237 | - } |
|
238 | - } |
|
239 | - } |
|
240 | - |
|
241 | - return $this->output; |
|
164 | + $this->a = "\n"; |
|
165 | + $this->action(3); |
|
166 | + |
|
167 | + while ($this->a !== null) { |
|
168 | + switch ($this->a) { |
|
169 | + case ' ': |
|
170 | + if ($this->isAlphaNum($this->b)) { |
|
171 | + $this->action(1); |
|
172 | + } else { |
|
173 | + $this->action(2); |
|
174 | + } |
|
175 | + break; |
|
176 | + |
|
177 | + case "\n": |
|
178 | + switch ($this->b) { |
|
179 | + case '{': |
|
180 | + case '[': |
|
181 | + case '(': |
|
182 | + case '+': |
|
183 | + case '-': |
|
184 | + $this->action(1); |
|
185 | + break; |
|
186 | + |
|
187 | + case ' ': |
|
188 | + $this->action(3); |
|
189 | + break; |
|
190 | + |
|
191 | + default: |
|
192 | + if ($this->isAlphaNum($this->b)) { |
|
193 | + $this->action(1); |
|
194 | + } |
|
195 | + else { |
|
196 | + $this->action(2); |
|
197 | + } |
|
198 | + } |
|
199 | + break; |
|
200 | + |
|
201 | + default: |
|
202 | + switch ($this->b) { |
|
203 | + case ' ': |
|
204 | + if ($this->isAlphaNum($this->a)) { |
|
205 | + $this->action(1); |
|
206 | + break; |
|
207 | + } |
|
208 | + |
|
209 | + $this->action(3); |
|
210 | + break; |
|
211 | + |
|
212 | + case "\n": |
|
213 | + switch ($this->a) { |
|
214 | + case '}': |
|
215 | + case ']': |
|
216 | + case ')': |
|
217 | + case '+': |
|
218 | + case '-': |
|
219 | + case '"': |
|
220 | + case "'": |
|
221 | + $this->action(1); |
|
222 | + break; |
|
223 | + |
|
224 | + default: |
|
225 | + if ($this->isAlphaNum($this->a)) { |
|
226 | + $this->action(1); |
|
227 | + } |
|
228 | + else { |
|
229 | + $this->action(3); |
|
230 | + } |
|
231 | + } |
|
232 | + break; |
|
233 | + |
|
234 | + default: |
|
235 | + $this->action(1); |
|
236 | + break; |
|
237 | + } |
|
238 | + } |
|
239 | + } |
|
240 | + |
|
241 | + return $this->output; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | protected function next() { |
245 | - $c = $this->get(); |
|
246 | - |
|
247 | - if ($c === '/') { |
|
248 | - switch($this->peek()) { |
|
249 | - case '/': |
|
250 | - for (;;) { |
|
251 | - $c = $this->get(); |
|
252 | - |
|
253 | - if (ord($c) <= self::ORD_LF) { |
|
254 | - return $c; |
|
255 | - } |
|
256 | - } |
|
257 | - |
|
258 | - case '*': |
|
259 | - $this->get(); |
|
260 | - |
|
261 | - for (;;) { |
|
262 | - switch($this->get()) { |
|
263 | - case '*': |
|
264 | - if ($this->peek() === '/') { |
|
265 | - $this->get(); |
|
266 | - return ' '; |
|
267 | - } |
|
268 | - break; |
|
269 | - |
|
270 | - case null: |
|
271 | - throw new JSMinException('Unterminated comment.'); |
|
272 | - } |
|
273 | - } |
|
274 | - |
|
275 | - default: |
|
276 | - return $c; |
|
277 | - } |
|
278 | - } |
|
279 | - |
|
280 | - return $c; |
|
245 | + $c = $this->get(); |
|
246 | + |
|
247 | + if ($c === '/') { |
|
248 | + switch($this->peek()) { |
|
249 | + case '/': |
|
250 | + for (;;) { |
|
251 | + $c = $this->get(); |
|
252 | + |
|
253 | + if (ord($c) <= self::ORD_LF) { |
|
254 | + return $c; |
|
255 | + } |
|
256 | + } |
|
257 | + |
|
258 | + case '*': |
|
259 | + $this->get(); |
|
260 | + |
|
261 | + for (;;) { |
|
262 | + switch($this->get()) { |
|
263 | + case '*': |
|
264 | + if ($this->peek() === '/') { |
|
265 | + $this->get(); |
|
266 | + return ' '; |
|
267 | + } |
|
268 | + break; |
|
269 | + |
|
270 | + case null: |
|
271 | + throw new JSMinException('Unterminated comment.'); |
|
272 | + } |
|
273 | + } |
|
274 | + |
|
275 | + default: |
|
276 | + return $c; |
|
277 | + } |
|
278 | + } |
|
279 | + |
|
280 | + return $c; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | protected function peek() { |
284 | - $this->lookAhead = $this->get(); |
|
285 | - return $this->lookAhead; |
|
284 | + $this->lookAhead = $this->get(); |
|
285 | + return $this->lookAhead; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 |
@@ -139,9 +139,9 @@ |
||
139 | 139 | $feed->init($feedConfig); |
140 | 140 | |
141 | 141 | $content=$feed->getFeedContent(); |
142 | - //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | - $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | - $this->getResponse()->write($content); |
|
142 | + //$this->getResponse()->setContentType('application/rss+xml'); |
|
143 | + $this->getResponse()->setContentType($feed->getContentType()); |
|
144 | + $this->getResponse()->write($content); |
|
145 | 145 | } |
146 | 146 | else |
147 | 147 | throw new THttpException(404,'feedservice_feed_unknown',$id); |
@@ -144,15 +144,15 @@ |
||
144 | 144 | */ |
145 | 145 | public function getKeyPrefix() |
146 | 146 | { |
147 | - return $this->_prefix; |
|
147 | + return $this->_prefix; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | - */ |
|
151 | + * @param string prefix of cache variable name to avoid conflict with other cache data |
|
152 | + */ |
|
153 | 153 | public function setKeyPrefix($value) |
154 | 154 | { |
155 | - $this->_prefix=$value; |
|
155 | + $this->_prefix=$value; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | |
335 | 335 | /** |
336 | 336 | * @return boolean a value indicating whether an automatic postback to the server |
337 | - * will occur whenever the user makes change to the list control and then tabs out of it. |
|
338 | - * Defaults to false. |
|
337 | + * will occur whenever the user makes change to the list control and then tabs out of it. |
|
338 | + * Defaults to false. |
|
339 | 339 | */ |
340 | 340 | public function getAutoPostBack() |
341 | 341 | { |
@@ -591,23 +591,23 @@ discard block |
||
591 | 591 | * @param string the value of the item to be selected. |
592 | 592 | */ |
593 | 593 | public function setSelectedValue($value) |
594 | - { |
|
595 | - if($this->_items) |
|
596 | - { |
|
597 | - if($value===null) |
|
598 | - $this->clearSelection(); |
|
599 | - else if(($item=$this->_items->findItemByValue($value))!==null) |
|
600 | - { |
|
601 | - $this->clearSelection(); |
|
602 | - $item->setSelected(true); |
|
603 | - } |
|
604 | - else |
|
594 | + { |
|
595 | + if($this->_items) |
|
596 | + { |
|
597 | + if($value===null) |
|
598 | + $this->clearSelection(); |
|
599 | + else if(($item=$this->_items->findItemByValue($value))!==null) |
|
600 | + { |
|
601 | + $this->clearSelection(); |
|
602 | + $item->setSelected(true); |
|
603 | + } |
|
604 | + else |
|
605 | 605 | $this->clearSelection(); |
606 | - } |
|
607 | - $this->_cachedSelectedValue=$value; |
|
606 | + } |
|
607 | + $this->_cachedSelectedValue=$value; |
|
608 | 608 | if($this->getAdapter() instanceof IListControlAdapter) |
609 | 609 | $this->getAdapter()->setSelectedValue($value); |
610 | - } |
|
610 | + } |
|
611 | 611 | |
612 | 612 | |
613 | 613 | /** |
@@ -655,36 +655,36 @@ discard block |
||
655 | 655 | $this->getAdapter()->setSelectedValues($values); |
656 | 656 | } |
657 | 657 | |
658 | - /** |
|
659 | - * @return string selected value |
|
660 | - */ |
|
661 | - public function getText() |
|
662 | - { |
|
663 | - return $this->getSelectedValue(); |
|
664 | - } |
|
665 | - |
|
666 | - /** |
|
667 | - * @param string value to be selected |
|
668 | - */ |
|
669 | - public function setText($value) |
|
670 | - { |
|
671 | - $this->setSelectedValue($value); |
|
672 | - } |
|
673 | - |
|
674 | - /** |
|
675 | - * Clears all existing selections. |
|
676 | - */ |
|
677 | - public function clearSelection() |
|
678 | - { |
|
679 | - if($this->_items) |
|
680 | - { |
|
681 | - foreach($this->_items as $item) |
|
682 | - $item->setSelected(false); |
|
683 | - } |
|
658 | + /** |
|
659 | + * @return string selected value |
|
660 | + */ |
|
661 | + public function getText() |
|
662 | + { |
|
663 | + return $this->getSelectedValue(); |
|
664 | + } |
|
665 | + |
|
666 | + /** |
|
667 | + * @param string value to be selected |
|
668 | + */ |
|
669 | + public function setText($value) |
|
670 | + { |
|
671 | + $this->setSelectedValue($value); |
|
672 | + } |
|
673 | + |
|
674 | + /** |
|
675 | + * Clears all existing selections. |
|
676 | + */ |
|
677 | + public function clearSelection() |
|
678 | + { |
|
679 | + if($this->_items) |
|
680 | + { |
|
681 | + foreach($this->_items as $item) |
|
682 | + $item->setSelected(false); |
|
683 | + } |
|
684 | 684 | |
685 | 685 | if($this->getAdapter() instanceof IListControlAdapter) |
686 | 686 | $this->getAdapter()->clearSelection(); |
687 | - } |
|
687 | + } |
|
688 | 688 | |
689 | 689 | /** |
690 | 690 | * @return string the group of validators which the list control causes validation upon postback |
@@ -914,10 +914,10 @@ discard block |
||
914 | 914 | */ |
915 | 915 | public function setSelectedValues($values); |
916 | 916 | |
917 | - /** |
|
918 | - * Clears all existing selections on the client side. |
|
919 | - */ |
|
920 | - public function clearSelection(); |
|
917 | + /** |
|
918 | + * Clears all existing selections on the client side. |
|
919 | + */ |
|
920 | + public function clearSelection(); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 |