@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | protected function addStatesToTrack() |
| 32 | 32 | { |
| 33 | 33 | parent::addStatesToTrack(); |
| 34 | - $states = $this->getStatesToTrack(); |
|
| 35 | - $states['JuiOptions'] = ['TMapCollectionDiff', [$this, 'updateJuiOptions']]; |
|
| 34 | + $states=$this->getStatesToTrack(); |
|
| 35 | + $states['JuiOptions']=['TMapCollectionDiff', [$this, 'updateJuiOptions']]; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function updateJuiOptions($options) |
| 43 | 43 | { |
| 44 | - foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
| 45 | - $code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });"; |
|
| 44 | + foreach($options as $key => $value) $options[$key]=$key.': '.(is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
| 45 | + $code="jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { ".implode(', ', $options)." });"; |
|
| 46 | 46 | $this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function processText($text) |
| 51 | 51 | { |
| 52 | - $result = Parsedown::instance()->parse($text); |
|
| 52 | + $result=Parsedown::instance()->parse($text); |
|
| 53 | 53 | return preg_replace_callback( |
| 54 | 54 | '/<pre><code class="language-(\w+)">((.|\n)*?)<\\/code><\\/pre>/im', |
| 55 | 55 | [$this, 'highlightCode'], $result); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function highlightCode($matches) |
| 64 | 64 | { |
| 65 | - $text = html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8'); |
|
| 65 | + $text=html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8'); |
|
| 66 | 66 | $this->setLanguage($matches[1]); |
| 67 | 67 | return parent::processText($text); |
| 68 | 68 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public function __construct(array $writers) |
| 32 | 32 | { |
| 33 | 33 | //parent::__construct(); |
| 34 | - $this->_writers = $writers; |
|
| 34 | + $this->_writers=$writers; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function write($s) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function flush() |
| 44 | 44 | { |
| 45 | 45 | foreach($this->_writers as $writer) |
| 46 | - $s = $writer->flush(); |
|
| 46 | + $s=$writer->flush(); |
|
| 47 | 47 | return $s; |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function getCoordinates() |
| 40 | 40 | { |
| 41 | - return $this->getLeft() . ',' . $this->getTop() . ',' . $this->getRight() . ',' . $this->getBottom(); |
|
| 41 | + return $this->getLeft().','.$this->getTop().','.$this->getRight().','.$this->getBottom(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function getCoordinates() |
| 40 | 40 | { |
| 41 | - return $this->getX() . ',' . $this->getY() . ',' . $this->getRadius(); |
|
| 41 | + return $this->getX().','.$this->getY().','.$this->getRadius(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @license PHP License |
| 39 | 39 | */ |
| 40 | 40 | |
| 41 | -require_once dirname(__FILE__) . '/TGettext.php'; |
|
| 41 | +require_once dirname(__FILE__).'/TGettext.php'; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * File_Gettext_MO |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @access public |
| 68 | 68 | * @var bool |
| 69 | 69 | */ |
| 70 | - protected $writeBigEndian = false; |
|
| 70 | + protected $writeBigEndian=false; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * Constructor |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | * @return object File_Gettext_MO |
| 77 | 77 | * @param string $file path to GNU MO file |
| 78 | 78 | */ |
| 79 | - public function __construct($file = '') |
|
| 79 | + public function __construct($file='') |
|
| 80 | 80 | { |
| 81 | - $this->file = $file; |
|
| 81 | + $this->file=$file; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | * @return mixed |
| 89 | 89 | * @param int $bytes |
| 90 | 90 | */ |
| 91 | - public function _read($bytes = 1) |
|
| 91 | + public function _read($bytes=1) |
|
| 92 | 92 | { |
| 93 | - if (0 < $bytes = abs($bytes)) { |
|
| 93 | + if(0 < $bytes=abs($bytes)) { |
|
| 94 | 94 | return fread($this->_handle, $bytes); |
| 95 | 95 | } |
| 96 | 96 | return null; |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | * @return int |
| 104 | 104 | * @param bool $bigendian |
| 105 | 105 | */ |
| 106 | - public function _readInt($bigendian = false) |
|
| 106 | + public function _readInt($bigendian=false) |
|
| 107 | 107 | { |
| 108 | 108 | //unpack returns a reference???? |
| 109 | - $unpacked = unpack($bigendian ? 'N' : 'V', $this->_read(4)); |
|
| 109 | + $unpacked=unpack($bigendian ? 'N' : 'V', $this->_read(4)); |
|
| 110 | 110 | return array_shift($unpacked); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function _writeStr($string) |
| 145 | 145 | { |
| 146 | - return $this->_write($string . "\0"); |
|
| 146 | + return $this->_write($string."\0"); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @return mixed Returns true on success or PEAR_Error on failure. |
| 168 | 168 | * @param string $file |
| 169 | 169 | */ |
| 170 | - public function load($file = null) |
|
| 170 | + public function load($file=null) |
|
| 171 | 171 | { |
| 172 | - if (!isset($file)) { |
|
| 173 | - $file = $this->file; |
|
| 172 | + if(!isset($file)) { |
|
| 173 | + $file=$this->file; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | // open MO file |
| 177 | - if (!is_resource($this->_handle = @fopen($file, 'rb'))) { |
|
| 177 | + if(!is_resource($this->_handle=@fopen($file, 'rb'))) { |
|
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | // lock MO file shared |
| 181 | - if (!@flock($this->_handle, LOCK_SH)) { |
|
| 181 | + if(!@flock($this->_handle, LOCK_SH)) { |
|
| 182 | 182 | @fclose($this->_handle); |
| 183 | 183 | return false; |
| 184 | 184 | } |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | // read (part of) magic number from MO file header and define endianess |
| 187 | 187 | |
| 188 | 188 | //unpack returns a reference???? |
| 189 | - $unpacked = unpack('c', $this->_read(4)); |
|
| 190 | - switch ($magic = array_shift($unpacked)) |
|
| 189 | + $unpacked=unpack('c', $this->_read(4)); |
|
| 190 | + switch($magic=array_shift($unpacked)) |
|
| 191 | 191 | { |
| 192 | 192 | case -34: |
| 193 | - $be = false; |
|
| 193 | + $be=false; |
|
| 194 | 194 | break; |
| 195 | 195 | |
| 196 | 196 | case -107: |
| 197 | - $be = true; |
|
| 197 | + $be=true; |
|
| 198 | 198 | break; |
| 199 | 199 | |
| 200 | 200 | default: |
@@ -202,24 +202,24 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // check file format revision - we currently only support 0 |
| 205 | - if (0 !== ($_rev = $this->_readInt($be))) { |
|
| 205 | + if(0!==($_rev=$this->_readInt($be))) { |
|
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // count of strings in this file |
| 210 | - $count = $this->_readInt($be); |
|
| 210 | + $count=$this->_readInt($be); |
|
| 211 | 211 | |
| 212 | 212 | // offset of hashing table of the msgids |
| 213 | - $offset_original = $this->_readInt($be); |
|
| 213 | + $offset_original=$this->_readInt($be); |
|
| 214 | 214 | // offset of hashing table of the msgstrs |
| 215 | - $offset_translat = $this->_readInt($be); |
|
| 215 | + $offset_translat=$this->_readInt($be); |
|
| 216 | 216 | |
| 217 | 217 | // move to msgid hash table |
| 218 | 218 | fseek($this->_handle, $offset_original); |
| 219 | 219 | // read lengths and offsets of msgids |
| 220 | - $original = []; |
|
| 221 | - for ($i = 0; $i < $count; $i++) { |
|
| 222 | - $original[$i] = [ |
|
| 220 | + $original=[]; |
|
| 221 | + for($i=0; $i < $count; $i++) { |
|
| 222 | + $original[$i]=[ |
|
| 223 | 223 | 'length' => $this->_readInt($be), |
| 224 | 224 | 'offset' => $this->_readInt($be) |
| 225 | 225 | ]; |
@@ -228,28 +228,28 @@ discard block |
||
| 228 | 228 | // move to msgstr hash table |
| 229 | 229 | fseek($this->_handle, $offset_translat); |
| 230 | 230 | // read lengths and offsets of msgstrs |
| 231 | - $translat = []; |
|
| 232 | - for ($i = 0; $i < $count; $i++) { |
|
| 233 | - $translat[$i] = [ |
|
| 231 | + $translat=[]; |
|
| 232 | + for($i=0; $i < $count; $i++) { |
|
| 233 | + $translat[$i]=[ |
|
| 234 | 234 | 'length' => $this->_readInt($be), |
| 235 | 235 | 'offset' => $this->_readInt($be) |
| 236 | 236 | ]; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // read all |
| 240 | - for ($i = 0; $i < $count; $i++) { |
|
| 241 | - $this->strings[$this->_readStr($original[$i])] = |
|
| 240 | + for($i=0; $i < $count; $i++) { |
|
| 241 | + $this->strings[$this->_readStr($original[$i])]= |
|
| 242 | 242 | $this->_readStr($translat[$i]); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // done |
| 246 | 246 | @flock($this->_handle, LOCK_UN); |
| 247 | 247 | @fclose($this->_handle); |
| 248 | - $this->_handle = null; |
|
| 248 | + $this->_handle=null; |
|
| 249 | 249 | |
| 250 | 250 | // check for meta info |
| 251 | - if (isset($this->strings[''])) { |
|
| 252 | - $this->meta = parent::meta2array($this->strings['']); |
|
| 251 | + if(isset($this->strings[''])) { |
|
| 252 | + $this->meta=parent::meta2array($this->strings['']); |
|
| 253 | 253 | unset($this->strings['']); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -263,24 +263,24 @@ discard block |
||
| 263 | 263 | * @return mixed Returns true on success or PEAR_Error on failure. |
| 264 | 264 | * @param string $file |
| 265 | 265 | */ |
| 266 | - public function save($file = null) |
|
| 266 | + public function save($file=null) |
|
| 267 | 267 | { |
| 268 | - if (!isset($file)) { |
|
| 269 | - $file = $this->file; |
|
| 268 | + if(!isset($file)) { |
|
| 269 | + $file=$this->file; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // open MO file |
| 273 | - if (!is_resource($this->_handle = @fopen($file, 'wb'))) { |
|
| 273 | + if(!is_resource($this->_handle=@fopen($file, 'wb'))) { |
|
| 274 | 274 | return false; |
| 275 | 275 | } |
| 276 | 276 | // lock MO file exclusively |
| 277 | - if (!@flock($this->_handle, LOCK_EX)) { |
|
| 277 | + if(!@flock($this->_handle, LOCK_EX)) { |
|
| 278 | 278 | @fclose($this->_handle); |
| 279 | 279 | return false; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // write magic number |
| 283 | - if ($this->writeBigEndian) { |
|
| 283 | + if($this->writeBigEndian) { |
|
| 284 | 284 | $this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde)); |
| 285 | 285 | } else { |
| 286 | 286 | $this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95)); |
@@ -289,59 +289,59 @@ discard block |
||
| 289 | 289 | // write file format revision |
| 290 | 290 | $this->_writeInt(0); |
| 291 | 291 | |
| 292 | - $count = count($this->strings) + ($meta = (count($this->meta) ? 1 : 0)); |
|
| 292 | + $count=count($this->strings) + ($meta=(count($this->meta) ? 1 : 0)); |
|
| 293 | 293 | // write count of strings |
| 294 | 294 | $this->_writeInt($count); |
| 295 | 295 | |
| 296 | - $offset = 28; |
|
| 296 | + $offset=28; |
|
| 297 | 297 | // write offset of orig. strings hash table |
| 298 | 298 | $this->_writeInt($offset); |
| 299 | 299 | |
| 300 | - $offset += ($count * 8); |
|
| 300 | + $offset+=($count * 8); |
|
| 301 | 301 | // write offset transl. strings hash table |
| 302 | 302 | $this->_writeInt($offset); |
| 303 | 303 | |
| 304 | 304 | // write size of hash table (we currently ommit the hash table) |
| 305 | 305 | $this->_writeInt(0); |
| 306 | 306 | |
| 307 | - $offset += ($count * 8); |
|
| 307 | + $offset+=($count * 8); |
|
| 308 | 308 | // write offset of hash table |
| 309 | 309 | $this->_writeInt($offset); |
| 310 | 310 | |
| 311 | 311 | // unshift meta info |
| 312 | - if ($this->meta) { |
|
| 313 | - $meta = ''; |
|
| 314 | - foreach ($this->meta as $key => $val) { |
|
| 315 | - $meta .= $key . ': ' . $val . "\n"; |
|
| 312 | + if($this->meta) { |
|
| 313 | + $meta=''; |
|
| 314 | + foreach($this->meta as $key => $val) { |
|
| 315 | + $meta.=$key.': '.$val."\n"; |
|
| 316 | 316 | } |
| 317 | - $strings = ['' => $meta] + $this->strings; |
|
| 317 | + $strings=['' => $meta] + $this->strings; |
|
| 318 | 318 | } else { |
| 319 | - $strings = $this->strings; |
|
| 319 | + $strings=$this->strings; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // write offsets for original strings |
| 323 | - foreach (array_keys($strings) as $o) { |
|
| 324 | - $len = strlen($o); |
|
| 323 | + foreach(array_keys($strings) as $o) { |
|
| 324 | + $len=strlen($o); |
|
| 325 | 325 | $this->_writeInt($len); |
| 326 | 326 | $this->_writeInt($offset); |
| 327 | - $offset += $len + 1; |
|
| 327 | + $offset+=$len + 1; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | // write offsets for translated strings |
| 331 | - foreach ($strings as $t) { |
|
| 332 | - $len = strlen($t); |
|
| 331 | + foreach($strings as $t) { |
|
| 332 | + $len=strlen($t); |
|
| 333 | 333 | $this->_writeInt($len); |
| 334 | 334 | $this->_writeInt($offset); |
| 335 | - $offset += $len + 1; |
|
| 335 | + $offset+=$len + 1; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // write original strings |
| 339 | - foreach (array_keys($strings) as $o) { |
|
| 339 | + foreach(array_keys($strings) as $o) { |
|
| 340 | 340 | $this->_writeStr($o); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | // write translated strings |
| 344 | - foreach ($strings as $t) { |
|
| 344 | + foreach($strings as $t) { |
|
| 345 | 345 | $this->_writeStr($t); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @access protected |
| 68 | 68 | * @var array |
| 69 | 69 | */ |
| 70 | - protected $strings = []; |
|
| 70 | + protected $strings=[]; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * meta |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @access protected |
| 79 | 79 | * @var array |
| 80 | 80 | */ |
| 81 | - protected $meta = []; |
|
| 81 | + protected $meta=[]; |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * file path |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @access protected |
| 87 | 87 | * @var string |
| 88 | 88 | */ |
| 89 | - protected $file = ''; |
|
| 89 | + protected $file=''; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Factory |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | * @param string $format MO or PO |
| 99 | 99 | * @param string $file path to GNU gettext file |
| 100 | 100 | */ |
| 101 | - public static function factory($format, $file = '') |
|
| 101 | + public static function factory($format, $file='') |
|
| 102 | 102 | { |
| 103 | - $format = strToUpper($format); |
|
| 104 | - $filename = dirname(__FILE__) . '/' . $format . '.php'; |
|
| 105 | - if(is_file($filename) == false) |
|
| 103 | + $format=strToUpper($format); |
|
| 104 | + $filename=dirname(__FILE__).'/'.$format.'.php'; |
|
| 105 | + if(is_file($filename)==false) |
|
| 106 | 106 | throw new Exception("Class file $file not found"); |
| 107 | 107 | |
| 108 | 108 | include_once $filename; |
| 109 | - $class = 'TGettext_' . $format; |
|
| 109 | + $class='TGettext_'.$format; |
|
| 110 | 110 | |
| 111 | 111 | return new $class($file); |
| 112 | 112 | } |
@@ -125,19 +125,19 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public static function poFile2moFile($pofile, $mofile) |
| 127 | 127 | { |
| 128 | - if (!is_file($pofile)) { |
|
| 128 | + if(!is_file($pofile)) { |
|
| 129 | 129 | throw new Exception("File $pofile doesn't exist."); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - include_once dirname(__FILE__) . '/PO.php'; |
|
| 132 | + include_once dirname(__FILE__).'/PO.php'; |
|
| 133 | 133 | |
| 134 | - $PO = new TGettext_PO($pofile); |
|
| 135 | - if (true !== ($e = $PO->load())) { |
|
| 134 | + $PO=new TGettext_PO($pofile); |
|
| 135 | + if(true!==($e=$PO->load())) { |
|
| 136 | 136 | return $e; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $MO = $PO->toMO(); |
|
| 140 | - if (true !== ($e = $MO->save($mofile))) { |
|
| 139 | + $MO=$PO->toMO(); |
|
| 140 | + if(true!==($e=$MO->save($mofile))) { |
|
| 141 | 141 | return $e; |
| 142 | 142 | } |
| 143 | 143 | unset($PO, $MO); |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | * @param string $string |
| 155 | 155 | * @param bool $reverse |
| 156 | 156 | */ |
| 157 | - public static function prepare($string, $reverse = false) |
|
| 157 | + public static function prepare($string, $reverse=false) |
|
| 158 | 158 | { |
| 159 | - if ($reverse) { |
|
| 160 | - $smap = ['"', "\n", "\t", "\r"]; |
|
| 161 | - $rmap = ['\"', '\\n"' . "\n" . '"', '\\t', '\\r']; |
|
| 159 | + if($reverse) { |
|
| 160 | + $smap=['"', "\n", "\t", "\r"]; |
|
| 161 | + $rmap=['\"', '\\n"'."\n".'"', '\\t', '\\r']; |
|
| 162 | 162 | return (string) str_replace($smap, $rmap, $string); |
| 163 | 163 | } else { |
| 164 | - $string = preg_replace('/"\s+"/', '', $string); |
|
| 165 | - $smap = ['\\n', '\\r', '\\t', '\"']; |
|
| 166 | - $rmap = ["\n", "\r", "\t", '"']; |
|
| 164 | + $string=preg_replace('/"\s+"/', '', $string); |
|
| 165 | + $smap=['\\n', '\\r', '\\t', '\"']; |
|
| 166 | + $rmap=["\n", "\r", "\t", '"']; |
|
| 167 | 167 | return (string) str_replace($smap, $rmap, $string); |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public static function meta2array($meta) |
| 180 | 180 | { |
| 181 | - $array = []; |
|
| 182 | - foreach (explode("\n", $meta) as $info) { |
|
| 183 | - if ($info = trim($info)) { |
|
| 184 | - list($key, $value) = explode(':', $info, 2); |
|
| 185 | - $array[trim($key)] = trim($value); |
|
| 181 | + $array=[]; |
|
| 182 | + foreach(explode("\n", $meta) as $info) { |
|
| 183 | + if($info=trim($info)) { |
|
| 184 | + list($key, $value)=explode(':', $info, 2); |
|
| 185 | + $array[trim($key)]=trim($value); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | return $array; |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function fromArray($array) |
| 246 | 246 | { |
| 247 | - if (!array_key_exists('strings', $array)) { |
|
| 248 | - if (count($array) != 2) { |
|
| 247 | + if(!array_key_exists('strings', $array)) { |
|
| 248 | + if(count($array)!=2) { |
|
| 249 | 249 | return false; |
| 250 | 250 | } else { |
| 251 | - list($this->meta, $this->strings) = $array; |
|
| 251 | + list($this->meta, $this->strings)=$array; |
|
| 252 | 252 | } |
| 253 | 253 | } else { |
| 254 | - $this->meta = @$array['meta']; |
|
| 255 | - $this->strings = @$array['strings']; |
|
| 254 | + $this->meta=@$array['meta']; |
|
| 255 | + $this->strings=@$array['strings']; |
|
| 256 | 256 | } |
| 257 | 257 | return true; |
| 258 | 258 | } |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function toMO() |
| 267 | 267 | { |
| 268 | - include_once dirname(__FILE__) . '/MO.php'; |
|
| 269 | - $MO = new TGettext_MO; |
|
| 268 | + include_once dirname(__FILE__).'/MO.php'; |
|
| 269 | + $MO=new TGettext_MO; |
|
| 270 | 270 | $MO->fromArray($this->toArray()); |
| 271 | 271 | return $MO; |
| 272 | 272 | } |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function toPO() |
| 281 | 281 | { |
| 282 | - include_once dirname(__FILE__) . '/PO.php'; |
|
| 283 | - $PO = new TGettext_PO; |
|
| 282 | + include_once dirname(__FILE__).'/PO.php'; |
|
| 283 | + $PO=new TGettext_PO; |
|
| 284 | 284 | $PO->fromArray($this->toArray()); |
| 285 | 285 | return $PO; |
| 286 | 286 | } |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Const View Types for generation |
| 22 | 22 | */ |
| 23 | - const LIST_TYPE = 0; |
|
| 24 | - const ADD_TYPE = 1; |
|
| 25 | - const SHOW_TYPE = 2; |
|
| 23 | + const LIST_TYPE=0; |
|
| 24 | + const ADD_TYPE=1; |
|
| 25 | + const SHOW_TYPE=2; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Bootstrap option |
@@ -49,34 +49,34 @@ discard block |
||
| 49 | 49 | // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
| 50 | 50 | public function generate($tableName, $viewType) |
| 51 | 51 | { |
| 52 | - switch ($viewType) |
|
| 52 | + switch($viewType) |
|
| 53 | 53 | { |
| 54 | 54 | default: |
| 55 | 55 | case self::LIST_TYPE: |
| 56 | - $unitName = "list" . ucfirst($tableName); |
|
| 56 | + $unitName="list".ucfirst($tableName); |
|
| 57 | 57 | break; |
| 58 | 58 | |
| 59 | 59 | case self::ADD_TYPE: |
| 60 | - $unitName = "add" . ucfirst($tableName); |
|
| 60 | + $unitName="add".ucfirst($tableName); |
|
| 61 | 61 | break; |
| 62 | 62 | |
| 63 | 63 | case self::SHOW_TYPE: |
| 64 | - $unitName = "show" . ucfirst($tableName); |
|
| 64 | + $unitName="show".ucfirst($tableName); |
|
| 65 | 65 | break; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $class = $this->generateClass($unitName); |
|
| 69 | - $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php"; |
|
| 68 | + $class=$this->generateClass($unitName); |
|
| 69 | + $outputClass=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".php"; |
|
| 70 | 70 | file_put_contents($outputClass, $class); |
| 71 | 71 | |
| 72 | - $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page"; |
|
| 73 | - $page = $this->generatePage($tableName, $viewType); |
|
| 72 | + $outputPage=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".page"; |
|
| 73 | + $page=$this->generatePage($tableName, $viewType); |
|
| 74 | 74 | file_put_contents($outputPage, $page); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - private function generatePage($tableName, $type, $tContentId = "Content") |
|
| 77 | + private function generatePage($tableName, $type, $tContentId="Content") |
|
| 78 | 78 | { |
| 79 | - $pageContent = $this->getPageContent($tableName, $type); |
|
| 79 | + $pageContent=$this->getPageContent($tableName, $type); |
|
| 80 | 80 | return <<<EOD |
| 81 | 81 | <com:TContent ID="$tContentId"> |
| 82 | 82 | |
@@ -88,30 +88,30 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | private function getPageContent($tableName, $type) |
| 90 | 90 | { |
| 91 | - $code = ""; |
|
| 92 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
| 93 | - switch ($type) |
|
| 91 | + $code=""; |
|
| 92 | + $tableInfo=$this->_dbMetaData->getTableInfo($tableName); |
|
| 93 | + switch($type) |
|
| 94 | 94 | { |
| 95 | 95 | case self::LIST_TYPE: |
| 96 | 96 | break; |
| 97 | 97 | case self::ADD_TYPE: |
| 98 | - foreach ($tableInfo->getColumns() as $colField => $colMetadata) |
|
| 98 | + foreach($tableInfo->getColumns() as $colField => $colMetadata) |
|
| 99 | 99 | { |
| 100 | - if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
| 100 | + if(!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
| 101 | 101 | { |
| 102 | - $code .= $this->generateControl($colMetadata); |
|
| 103 | - $code .= $this->generateValidators($colMetadata); |
|
| 104 | - $code .= "\n"; |
|
| 102 | + $code.=$this->generateControl($colMetadata); |
|
| 103 | + $code.=$this->generateValidators($colMetadata); |
|
| 104 | + $code.="\n"; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
| 107 | + foreach($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
| 108 | 108 | { |
| 109 | - $colField = $this->eq($colMetadata["table"]); |
|
| 110 | - $code .= "\t<com:TTextBox ID=$colField />\n"; |
|
| 111 | - $code .= "\n"; |
|
| 109 | + $colField=$this->eq($colMetadata["table"]); |
|
| 110 | + $code.="\t<com:TTextBox ID=$colField />\n"; |
|
| 111 | + $code.="\n"; |
|
| 112 | 112 | // TWsatBaseGenerator::pr($tableInfo); |
| 113 | 113 | } |
| 114 | - $code .= "\t<com:TButton Text=\"Accept\" />\n"; |
|
| 114 | + $code.="\t<com:TButton Text=\"Accept\" />\n"; |
|
| 115 | 115 | break; |
| 116 | 116 | case self::SHOW_TYPE: |
| 117 | 117 | break; |
@@ -121,22 +121,22 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | private function generateControl($colMetadata) |
| 123 | 123 | { |
| 124 | - $controlType = "TTextBox"; |
|
| 125 | - switch ($colMetadata->DbType) |
|
| 124 | + $controlType="TTextBox"; |
|
| 125 | + switch($colMetadata->DbType) |
|
| 126 | 126 | { |
| 127 | 127 | |
| 128 | 128 | } |
| 129 | - $controlId = $colMetadata->ColumnId; |
|
| 129 | + $controlId=$colMetadata->ColumnId; |
|
| 130 | 130 | return "\t<com:$controlType ID=\"$controlId\" />\n"; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | private function generateValidators($colMetadata) |
| 134 | 134 | { |
| 135 | - $controlId = $colMetadata->ColumnId; |
|
| 136 | - $code = ""; |
|
| 137 | - if (!$colMetadata->AllowNull) |
|
| 135 | + $controlId=$colMetadata->ColumnId; |
|
| 136 | + $code=""; |
|
| 137 | + if(!$colMetadata->AllowNull) |
|
| 138 | 138 | { |
| 139 | - $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
| 139 | + $code.="\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
| 140 | 140 | } |
| 141 | 141 | return $code; |
| 142 | 142 | } |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | // <editor-fold defaultstate="collapsed" desc="Code Behind Generation"> |
| 147 | 147 | private function generateClass($classname) |
| 148 | 148 | { |
| 149 | - $date = date('Y-m-d h:i:s'); |
|
| 150 | - $env_user = getenv("username"); |
|
| 149 | + $date=date('Y-m-d h:i:s'); |
|
| 150 | + $env_user=getenv("username"); |
|
| 151 | 151 | return <<<EOD |
| 152 | 152 | <?php |
| 153 | 153 | /** |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | private function validateSecurity() |
| 23 | 23 | { |
| 24 | - if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
| 24 | + if($this->Session["wsat_password"]!==$this->getService()->getPassword()) |
|
| 25 | 25 | { |
| 26 | - if (!$this->getPage() instanceof TWsatLogin) |
|
| 26 | + if(!$this->getPage() instanceof TWsatLogin) |
|
| 27 | 27 | { |
| 28 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
| 28 | + $url=$this->Service->constructUrl('TWsatLogin'); |
|
| 29 | 29 | $this->Response->redirect($url); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function logout() |
| 35 | 35 | { |
| 36 | - $this->Session["wsat_password"] = ""; |
|
| 37 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
| 36 | + $this->Session["wsat_password"]=""; |
|
| 37 | + $url=$this->Service->constructUrl('TWsatLogin'); |
|
| 38 | 38 | $this->Response->redirect($url); |
| 39 | 39 | } |
| 40 | 40 | |