@@ -51,110 +51,110 @@ |
||
| 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 __construct($file = '') |
|
| 62 | - { |
|
| 63 | - $this->file = $file; |
|
| 64 | - } |
|
| 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 | - } |
|
| 78 | - |
|
| 79 | - // load file |
|
| 80 | - if (!$contents = @file($file)) { |
|
| 81 | - return false; |
|
| 82 | - } |
|
| 83 | - $contents = implode('', $contents); |
|
| 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); |
|
| 92 | - |
|
| 93 | - if (!$matched) { |
|
| 94 | - return false; |
|
| 95 | - } |
|
| 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 | - } |
|
| 105 | - |
|
| 106 | - // check for meta info |
|
| 107 | - if (isset($this->strings[''])) { |
|
| 108 | - $this->meta = parent::meta2array($this->strings['']); |
|
| 109 | - unset($this->strings['']); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - return true; |
|
| 113 | - } |
|
| 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 | - } |
|
| 127 | - |
|
| 128 | - // open PO file |
|
| 129 | - if (!is_resource($fh = @fopen($file, 'w'))) { |
|
| 130 | - return false; |
|
| 131 | - } |
|
| 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 | - } |
|
| 153 | - |
|
| 154 | - //done |
|
| 155 | - @flock($fh, LOCK_UN); |
|
| 156 | - @fclose($fh); |
|
| 157 | - chmod($file,PRADO_CHMOD); |
|
| 158 | - return true; |
|
| 159 | - } |
|
| 54 | + /** |
|
| 55 | + * Constructor |
|
| 56 | + * |
|
| 57 | + * @access public |
|
| 58 | + * @return object File_Gettext_PO |
|
| 59 | + * @param string path to GNU PO file |
|
| 60 | + */ |
|
| 61 | + function __construct($file = '') |
|
| 62 | + { |
|
| 63 | + $this->file = $file; |
|
| 64 | + } |
|
| 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 | + } |
|
| 78 | + |
|
| 79 | + // load file |
|
| 80 | + if (!$contents = @file($file)) { |
|
| 81 | + return false; |
|
| 82 | + } |
|
| 83 | + $contents = implode('', $contents); |
|
| 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); |
|
| 92 | + |
|
| 93 | + if (!$matched) { |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 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 | + } |
|
| 105 | + |
|
| 106 | + // check for meta info |
|
| 107 | + if (isset($this->strings[''])) { |
|
| 108 | + $this->meta = parent::meta2array($this->strings['']); |
|
| 109 | + unset($this->strings['']); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 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 | + } |
|
| 127 | + |
|
| 128 | + // open PO file |
|
| 129 | + if (!is_resource($fh = @fopen($file, 'w'))) { |
|
| 130 | + return false; |
|
| 131 | + } |
|
| 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 | + } |
|
| 153 | + |
|
| 154 | + //done |
|
| 155 | + @flock($fh, LOCK_UN); |
|
| 156 | + @fclose($fh); |
|
| 157 | + chmod($file,PRADO_CHMOD); |
|
| 158 | + return true; |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * For a given DSN (database connection string), return some information |
| 24 | 24 | * about the DSN. This function comes from PEAR's DB package. |
| 25 | - * |
|
| 25 | + * |
|
| 26 | 26 | * LICENSE: This source file is subject to version 3.0 of the PHP license |
| 27 | 27 | * that is available through the world-wide-web at the following URI: |
| 28 | 28 | * http://www.php.net/license/3_0.txt. If you did not receive a copy of |
@@ -38,120 +38,120 @@ discard block |
||
| 38 | 38 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
| 39 | 39 | * @link http://pear.php.net/package/DB |
| 40 | 40 | */ |
| 41 | - function parseDSN($dsn) |
|
| 42 | - { |
|
| 43 | - if (is_array($dsn)) { |
|
| 44 | - return $dsn; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $parsed = array( |
|
| 48 | - 'phptype' => false, |
|
| 49 | - 'dbsyntax' => false, |
|
| 50 | - 'username' => false, |
|
| 51 | - 'password' => false, |
|
| 52 | - 'protocol' => false, |
|
| 53 | - 'hostspec' => false, |
|
| 54 | - 'port' => false, |
|
| 55 | - 'socket' => false, |
|
| 56 | - 'database' => false |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - // Find phptype and dbsyntax |
|
| 60 | - if (($pos = strpos($dsn, '://')) !== false) { |
|
| 61 | - $str = substr($dsn, 0, $pos); |
|
| 62 | - $dsn = substr($dsn, $pos + 3); |
|
| 63 | - } else { |
|
| 64 | - $str = $dsn; |
|
| 65 | - $dsn = null; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - // Get phptype and dbsyntax |
|
| 69 | - // $str => phptype(dbsyntax) |
|
| 70 | - if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
| 71 | - $parsed['phptype'] = $arr[1]; |
|
| 72 | - $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2]; |
|
| 73 | - } else { |
|
| 74 | - $parsed['phptype'] = $str; |
|
| 75 | - $parsed['dbsyntax'] = $str; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if (empty($dsn)) { |
|
| 79 | - return $parsed; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - // Get (if found): username and password |
|
| 83 | - // $dsn => username:password@protocol+hostspec/database |
|
| 84 | - if (($at = strrpos($dsn,'@')) !== false) { |
|
| 85 | - $str = substr($dsn, 0, $at); |
|
| 86 | - $dsn = substr($dsn, $at + 1); |
|
| 87 | - if (($pos = strpos($str, ':')) !== false) { |
|
| 88 | - $parsed['username'] = rawurldecode(substr($str, 0, $pos)); |
|
| 89 | - $parsed['password'] = rawurldecode(substr($str, $pos + 1)); |
|
| 90 | - } else { |
|
| 91 | - $parsed['username'] = rawurldecode($str); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - // Find protocol and hostspec |
|
| 96 | - |
|
| 97 | - // $dsn => proto(proto_opts)/database |
|
| 98 | - if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
| 99 | - $proto = $match[1]; |
|
| 100 | - $proto_opts = (!empty($match[2])) ? $match[2] : false; |
|
| 101 | - $dsn = $match[3]; |
|
| 102 | - |
|
| 103 | - // $dsn => protocol+hostspec/database (old format) |
|
| 104 | - } else { |
|
| 105 | - if (strpos($dsn, '+') !== false) { |
|
| 106 | - list($proto, $dsn) = explode('+', $dsn, 2); |
|
| 107 | - } |
|
| 108 | - if (strpos($dsn, '/') !== false) { |
|
| 109 | - list($proto_opts, $dsn) = explode('/', $dsn, 2); |
|
| 110 | - } else { |
|
| 111 | - $proto_opts = $dsn; |
|
| 112 | - $dsn = null; |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // process the different protocol options |
|
| 117 | - $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp'; |
|
| 118 | - $proto_opts = rawurldecode($proto_opts); |
|
| 119 | - if ($parsed['protocol'] == 'tcp') { |
|
| 120 | - if (strpos($proto_opts, ':') !== false) { |
|
| 121 | - list($parsed['hostspec'], $parsed['port']) = explode(':', $proto_opts); |
|
| 122 | - } else { |
|
| 123 | - $parsed['hostspec'] = $proto_opts; |
|
| 124 | - } |
|
| 125 | - } elseif ($parsed['protocol'] == 'unix') { |
|
| 126 | - $parsed['socket'] = $proto_opts; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - // Get dabase if any |
|
| 130 | - // $dsn => database |
|
| 131 | - if (!empty($dsn)) { |
|
| 132 | - // /database |
|
| 133 | - if (($pos = strpos($dsn, '?')) === false) { |
|
| 134 | - $parsed['database'] = $dsn; |
|
| 135 | - // /database?param1=value1¶m2=value2 |
|
| 136 | - } else { |
|
| 137 | - $parsed['database'] = substr($dsn, 0, $pos); |
|
| 138 | - $dsn = substr($dsn, $pos + 1); |
|
| 139 | - if (strpos($dsn, '&') !== false) { |
|
| 140 | - $opts = explode('&', $dsn); |
|
| 141 | - } else { // database?param1=value1 |
|
| 142 | - $opts = array($dsn); |
|
| 143 | - } |
|
| 144 | - foreach ($opts as $opt) { |
|
| 145 | - list($key, $value) = explode('=', $opt); |
|
| 146 | - if (!isset($parsed[$key])) { // don't allow params overwrite |
|
| 147 | - $parsed[$key] = rawurldecode($value); |
|
| 148 | - } |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - return $parsed; |
|
| 154 | - } |
|
| 41 | + function parseDSN($dsn) |
|
| 42 | + { |
|
| 43 | + if (is_array($dsn)) { |
|
| 44 | + return $dsn; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $parsed = array( |
|
| 48 | + 'phptype' => false, |
|
| 49 | + 'dbsyntax' => false, |
|
| 50 | + 'username' => false, |
|
| 51 | + 'password' => false, |
|
| 52 | + 'protocol' => false, |
|
| 53 | + 'hostspec' => false, |
|
| 54 | + 'port' => false, |
|
| 55 | + 'socket' => false, |
|
| 56 | + 'database' => false |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + // Find phptype and dbsyntax |
|
| 60 | + if (($pos = strpos($dsn, '://')) !== false) { |
|
| 61 | + $str = substr($dsn, 0, $pos); |
|
| 62 | + $dsn = substr($dsn, $pos + 3); |
|
| 63 | + } else { |
|
| 64 | + $str = $dsn; |
|
| 65 | + $dsn = null; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + // Get phptype and dbsyntax |
|
| 69 | + // $str => phptype(dbsyntax) |
|
| 70 | + if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { |
|
| 71 | + $parsed['phptype'] = $arr[1]; |
|
| 72 | + $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2]; |
|
| 73 | + } else { |
|
| 74 | + $parsed['phptype'] = $str; |
|
| 75 | + $parsed['dbsyntax'] = $str; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if (empty($dsn)) { |
|
| 79 | + return $parsed; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + // Get (if found): username and password |
|
| 83 | + // $dsn => username:password@protocol+hostspec/database |
|
| 84 | + if (($at = strrpos($dsn,'@')) !== false) { |
|
| 85 | + $str = substr($dsn, 0, $at); |
|
| 86 | + $dsn = substr($dsn, $at + 1); |
|
| 87 | + if (($pos = strpos($str, ':')) !== false) { |
|
| 88 | + $parsed['username'] = rawurldecode(substr($str, 0, $pos)); |
|
| 89 | + $parsed['password'] = rawurldecode(substr($str, $pos + 1)); |
|
| 90 | + } else { |
|
| 91 | + $parsed['username'] = rawurldecode($str); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + // Find protocol and hostspec |
|
| 96 | + |
|
| 97 | + // $dsn => proto(proto_opts)/database |
|
| 98 | + if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) { |
|
| 99 | + $proto = $match[1]; |
|
| 100 | + $proto_opts = (!empty($match[2])) ? $match[2] : false; |
|
| 101 | + $dsn = $match[3]; |
|
| 102 | + |
|
| 103 | + // $dsn => protocol+hostspec/database (old format) |
|
| 104 | + } else { |
|
| 105 | + if (strpos($dsn, '+') !== false) { |
|
| 106 | + list($proto, $dsn) = explode('+', $dsn, 2); |
|
| 107 | + } |
|
| 108 | + if (strpos($dsn, '/') !== false) { |
|
| 109 | + list($proto_opts, $dsn) = explode('/', $dsn, 2); |
|
| 110 | + } else { |
|
| 111 | + $proto_opts = $dsn; |
|
| 112 | + $dsn = null; |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // process the different protocol options |
|
| 117 | + $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp'; |
|
| 118 | + $proto_opts = rawurldecode($proto_opts); |
|
| 119 | + if ($parsed['protocol'] == 'tcp') { |
|
| 120 | + if (strpos($proto_opts, ':') !== false) { |
|
| 121 | + list($parsed['hostspec'], $parsed['port']) = explode(':', $proto_opts); |
|
| 122 | + } else { |
|
| 123 | + $parsed['hostspec'] = $proto_opts; |
|
| 124 | + } |
|
| 125 | + } elseif ($parsed['protocol'] == 'unix') { |
|
| 126 | + $parsed['socket'] = $proto_opts; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + // Get dabase if any |
|
| 130 | + // $dsn => database |
|
| 131 | + if (!empty($dsn)) { |
|
| 132 | + // /database |
|
| 133 | + if (($pos = strpos($dsn, '?')) === false) { |
|
| 134 | + $parsed['database'] = $dsn; |
|
| 135 | + // /database?param1=value1¶m2=value2 |
|
| 136 | + } else { |
|
| 137 | + $parsed['database'] = substr($dsn, 0, $pos); |
|
| 138 | + $dsn = substr($dsn, $pos + 1); |
|
| 139 | + if (strpos($dsn, '&') !== false) { |
|
| 140 | + $opts = explode('&', $dsn); |
|
| 141 | + } else { // database?param1=value1 |
|
| 142 | + $opts = array($dsn); |
|
| 143 | + } |
|
| 144 | + foreach ($opts as $opt) { |
|
| 145 | + list($key, $value) = explode('=', $opt); |
|
| 146 | + if (!isset($parsed[$key])) { // don't allow params overwrite |
|
| 147 | + $parsed[$key] = rawurldecode($value); |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + return $parsed; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -21,44 +21,44 @@ |
||
| 21 | 21 | class TWsatGenerateAR extends TPage |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - public function generate($sender) |
|
| 25 | - { |
|
| 26 | - if ($this->IsValid) |
|
| 27 | - { |
|
| 28 | - $tableName = $this->table_name->Text; |
|
| 29 | - $outputFolderNs = $this->output_folder->Text; |
|
| 30 | - $classPrefix = $this->class_prefix->Text; |
|
| 31 | - $classSuffix = $this->class_suffix->Text; |
|
| 24 | + public function generate($sender) |
|
| 25 | + { |
|
| 26 | + if ($this->IsValid) |
|
| 27 | + { |
|
| 28 | + $tableName = $this->table_name->Text; |
|
| 29 | + $outputFolderNs = $this->output_folder->Text; |
|
| 30 | + $classPrefix = $this->class_prefix->Text; |
|
| 31 | + $classSuffix = $this->class_suffix->Text; |
|
| 32 | 32 | |
| 33 | - try |
|
| 34 | - { |
|
| 35 | - $ar_generator = new TWsatARGenerator(); |
|
| 36 | - $ar_generator->setOpFile($outputFolderNs); |
|
| 37 | - $ar_generator->setClasPrefix($classPrefix); |
|
| 38 | - $ar_generator->setClassSufix($classSuffix); |
|
| 33 | + try |
|
| 34 | + { |
|
| 35 | + $ar_generator = new TWsatARGenerator(); |
|
| 36 | + $ar_generator->setOpFile($outputFolderNs); |
|
| 37 | + $ar_generator->setClasPrefix($classPrefix); |
|
| 38 | + $ar_generator->setClassSufix($classSuffix); |
|
| 39 | 39 | |
| 40 | - if ($this->build_rel->Checked) |
|
| 41 | - $ar_generator->buildRelations(); |
|
| 40 | + if ($this->build_rel->Checked) |
|
| 41 | + $ar_generator->buildRelations(); |
|
| 42 | 42 | |
| 43 | - if ($tableName != "*") |
|
| 44 | - $ar_generator->generate($tableName); |
|
| 45 | - else |
|
| 46 | - $ar_generator->generateAll(); |
|
| 43 | + if ($tableName != "*") |
|
| 44 | + $ar_generator->generate($tableName); |
|
| 45 | + else |
|
| 46 | + $ar_generator->generateAll(); |
|
| 47 | 47 | |
| 48 | - $this->feedback_panel->CssClass = "green_panel"; |
|
| 49 | - $this->generation_msg->Text = "The code has been generated successfully."; |
|
| 50 | - } catch (Exception $ex) |
|
| 51 | - { |
|
| 52 | - $this->feedback_panel->CssClass = "red_panel"; |
|
| 53 | - $this->generation_msg->Text = $ex->getMessage(); |
|
| 54 | - } |
|
| 55 | - $this->feedback_panel->Visible = true; |
|
| 56 | - } |
|
| 57 | - } |
|
| 48 | + $this->feedback_panel->CssClass = "green_panel"; |
|
| 49 | + $this->generation_msg->Text = "The code has been generated successfully."; |
|
| 50 | + } catch (Exception $ex) |
|
| 51 | + { |
|
| 52 | + $this->feedback_panel->CssClass = "red_panel"; |
|
| 53 | + $this->generation_msg->Text = $ex->getMessage(); |
|
| 54 | + } |
|
| 55 | + $this->feedback_panel->Visible = true; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function preview($sender) |
|
| 60 | - { |
|
| 61 | - throw new THttpException(500, "Not implemented yet."); |
|
| 62 | - } |
|
| 59 | + public function preview($sender) |
|
| 60 | + { |
|
| 61 | + throw new THttpException(500, "Not implemented yet."); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -190,7 +190,7 @@ |
||
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * @return integer|float a timestamp given a local time |
| 193 | - */ |
|
| 193 | + */ |
|
| 194 | 194 | function getTimeStamp($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_gmt=false) |
| 195 | 195 | { |
| 196 | 196 | $dt = new DateTime(); |
@@ -496,8 +496,8 @@ |
||
| 496 | 496 | $className=basename($path); |
| 497 | 497 | $namespacedClassName = static::PAGE_NAMESPACE_PREFIX .str_replace('.', '\\', $pagePath); |
| 498 | 498 | |
| 499 | - if(!class_exists($className,false) && !class_exists($namespacedClassName, false)) |
|
| 500 | - include_once($path.Prado::CLASS_FILE_EXT); |
|
| 499 | + if(!class_exists($className,false) && !class_exists($namespacedClassName, false)) |
|
| 500 | + include_once($path.Prado::CLASS_FILE_EXT); |
|
| 501 | 501 | |
| 502 | 502 | if(!class_exists($className,false)) |
| 503 | 503 | $className = $namespacedClassName; |
@@ -59,228 +59,228 @@ |
||
| 59 | 59 | // -- Public Static Methods -------------------------------------------------- |
| 60 | 60 | |
| 61 | 61 | public static function minify($js) { |
| 62 | - $jsmin = new JSMin($js); |
|
| 63 | - return $jsmin->min(); |
|
| 62 | + $jsmin = new JSMin($js); |
|
| 63 | + return $jsmin->min(); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // -- Public Instance Methods ------------------------------------------------ |
| 67 | 67 | |
| 68 | 68 | public function __construct($input) { |
| 69 | - $this->input = str_replace("\r\n", "\n", $input); |
|
| 70 | - $this->inputLength = strlen($this->input); |
|
| 69 | + $this->input = str_replace("\r\n", "\n", $input); |
|
| 70 | + $this->inputLength = strlen($this->input); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // -- Protected Instance Methods --------------------------------------------- |
| 74 | 74 | |
| 75 | 75 | protected function action($d) { |
| 76 | - switch($d) { |
|
| 77 | - case 1: |
|
| 78 | - $this->output .= $this->a; |
|
| 79 | - |
|
| 80 | - case 2: |
|
| 81 | - $this->a = $this->b; |
|
| 82 | - |
|
| 83 | - if ($this->a === "'" || $this->a === '"') { |
|
| 84 | - for (;;) { |
|
| 85 | - $this->output .= $this->a; |
|
| 86 | - $this->a = $this->get(); |
|
| 87 | - |
|
| 88 | - if ($this->a === $this->b) { |
|
| 89 | - break; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if (ord($this->a) <= self::ORD_LF) { |
|
| 93 | - throw new JSMinException('Unterminated string literal.'); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if ($this->a === '\\') { |
|
| 97 | - $this->output .= $this->a; |
|
| 98 | - $this->a = $this->get(); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - case 3: |
|
| 104 | - $this->b = $this->next(); |
|
| 105 | - |
|
| 106 | - if ($this->b === '/' && ( |
|
| 107 | - $this->a === '(' || $this->a === ',' || $this->a === '=' || |
|
| 108 | - $this->a === ':' || $this->a === '[' || $this->a === '!' || |
|
| 109 | - $this->a === '&' || $this->a === '|' || $this->a === '?')) { |
|
| 110 | - |
|
| 111 | - $this->output .= $this->a . $this->b; |
|
| 112 | - |
|
| 113 | - for (;;) { |
|
| 114 | - $this->a = $this->get(); |
|
| 115 | - |
|
| 116 | - if ($this->a === '/') { |
|
| 117 | - break; |
|
| 118 | - } elseif ($this->a === '\\') { |
|
| 119 | - $this->output .= $this->a; |
|
| 120 | - $this->a = $this->get(); |
|
| 121 | - } elseif (ord($this->a) <= self::ORD_LF) { |
|
| 122 | - throw new JSMinException('Unterminated regular expression '. |
|
| 123 | - 'literal.'); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - $this->output .= $this->a; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - $this->b = $this->next(); |
|
| 130 | - } |
|
| 131 | - } |
|
| 76 | + switch($d) { |
|
| 77 | + case 1: |
|
| 78 | + $this->output .= $this->a; |
|
| 79 | + |
|
| 80 | + case 2: |
|
| 81 | + $this->a = $this->b; |
|
| 82 | + |
|
| 83 | + if ($this->a === "'" || $this->a === '"') { |
|
| 84 | + for (;;) { |
|
| 85 | + $this->output .= $this->a; |
|
| 86 | + $this->a = $this->get(); |
|
| 87 | + |
|
| 88 | + if ($this->a === $this->b) { |
|
| 89 | + break; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if (ord($this->a) <= self::ORD_LF) { |
|
| 93 | + throw new JSMinException('Unterminated string literal.'); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if ($this->a === '\\') { |
|
| 97 | + $this->output .= $this->a; |
|
| 98 | + $this->a = $this->get(); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + case 3: |
|
| 104 | + $this->b = $this->next(); |
|
| 105 | + |
|
| 106 | + if ($this->b === '/' && ( |
|
| 107 | + $this->a === '(' || $this->a === ',' || $this->a === '=' || |
|
| 108 | + $this->a === ':' || $this->a === '[' || $this->a === '!' || |
|
| 109 | + $this->a === '&' || $this->a === '|' || $this->a === '?')) { |
|
| 110 | + |
|
| 111 | + $this->output .= $this->a . $this->b; |
|
| 112 | + |
|
| 113 | + for (;;) { |
|
| 114 | + $this->a = $this->get(); |
|
| 115 | + |
|
| 116 | + if ($this->a === '/') { |
|
| 117 | + break; |
|
| 118 | + } elseif ($this->a === '\\') { |
|
| 119 | + $this->output .= $this->a; |
|
| 120 | + $this->a = $this->get(); |
|
| 121 | + } elseif (ord($this->a) <= self::ORD_LF) { |
|
| 122 | + throw new JSMinException('Unterminated regular expression '. |
|
| 123 | + 'literal.'); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + $this->output .= $this->a; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + $this->b = $this->next(); |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | protected function get() { |
| 135 | - $c = $this->lookAhead; |
|
| 136 | - $this->lookAhead = null; |
|
| 137 | - |
|
| 138 | - if ($c === null) { |
|
| 139 | - if ($this->inputIndex < $this->inputLength) { |
|
| 140 | - $c = $this->input[$this->inputIndex]; |
|
| 141 | - $this->inputIndex += 1; |
|
| 142 | - } else { |
|
| 143 | - $c = null; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if ($c === "\r") { |
|
| 148 | - return "\n"; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { |
|
| 152 | - return $c; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - return ' '; |
|
| 135 | + $c = $this->lookAhead; |
|
| 136 | + $this->lookAhead = null; |
|
| 137 | + |
|
| 138 | + if ($c === null) { |
|
| 139 | + if ($this->inputIndex < $this->inputLength) { |
|
| 140 | + $c = $this->input[$this->inputIndex]; |
|
| 141 | + $this->inputIndex += 1; |
|
| 142 | + } else { |
|
| 143 | + $c = null; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if ($c === "\r") { |
|
| 148 | + return "\n"; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { |
|
| 152 | + return $c; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + return ' '; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function isAlphaNum($c) { |
| 159 | - return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
|
| 159 | + return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | protected function min() { |
| 163 | - $this->a = "\n"; |
|
| 164 | - $this->action(3); |
|
| 165 | - |
|
| 166 | - while ($this->a !== null) { |
|
| 167 | - switch ($this->a) { |
|
| 168 | - case ' ': |
|
| 169 | - if ($this->isAlphaNum($this->b)) { |
|
| 170 | - $this->action(1); |
|
| 171 | - } else { |
|
| 172 | - $this->action(2); |
|
| 173 | - } |
|
| 174 | - break; |
|
| 175 | - |
|
| 176 | - case "\n": |
|
| 177 | - switch ($this->b) { |
|
| 178 | - case '{': |
|
| 179 | - case '[': |
|
| 180 | - case '(': |
|
| 181 | - case '+': |
|
| 182 | - case '-': |
|
| 183 | - $this->action(1); |
|
| 184 | - break; |
|
| 185 | - |
|
| 186 | - case ' ': |
|
| 187 | - $this->action(3); |
|
| 188 | - break; |
|
| 189 | - |
|
| 190 | - default: |
|
| 191 | - if ($this->isAlphaNum($this->b)) { |
|
| 192 | - $this->action(1); |
|
| 193 | - } |
|
| 194 | - else { |
|
| 195 | - $this->action(2); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - break; |
|
| 199 | - |
|
| 200 | - default: |
|
| 201 | - switch ($this->b) { |
|
| 202 | - case ' ': |
|
| 203 | - if ($this->isAlphaNum($this->a)) { |
|
| 204 | - $this->action(1); |
|
| 205 | - break; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $this->action(3); |
|
| 209 | - break; |
|
| 210 | - |
|
| 211 | - case "\n": |
|
| 212 | - switch ($this->a) { |
|
| 213 | - case '}': |
|
| 214 | - case ']': |
|
| 215 | - case ')': |
|
| 216 | - case '+': |
|
| 217 | - case '-': |
|
| 218 | - case '"': |
|
| 219 | - case "'": |
|
| 220 | - $this->action(1); |
|
| 221 | - break; |
|
| 222 | - |
|
| 223 | - default: |
|
| 224 | - if ($this->isAlphaNum($this->a)) { |
|
| 225 | - $this->action(1); |
|
| 226 | - } |
|
| 227 | - else { |
|
| 228 | - $this->action(3); |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - break; |
|
| 232 | - |
|
| 233 | - default: |
|
| 234 | - $this->action(1); |
|
| 235 | - break; |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - return $this->output; |
|
| 163 | + $this->a = "\n"; |
|
| 164 | + $this->action(3); |
|
| 165 | + |
|
| 166 | + while ($this->a !== null) { |
|
| 167 | + switch ($this->a) { |
|
| 168 | + case ' ': |
|
| 169 | + if ($this->isAlphaNum($this->b)) { |
|
| 170 | + $this->action(1); |
|
| 171 | + } else { |
|
| 172 | + $this->action(2); |
|
| 173 | + } |
|
| 174 | + break; |
|
| 175 | + |
|
| 176 | + case "\n": |
|
| 177 | + switch ($this->b) { |
|
| 178 | + case '{': |
|
| 179 | + case '[': |
|
| 180 | + case '(': |
|
| 181 | + case '+': |
|
| 182 | + case '-': |
|
| 183 | + $this->action(1); |
|
| 184 | + break; |
|
| 185 | + |
|
| 186 | + case ' ': |
|
| 187 | + $this->action(3); |
|
| 188 | + break; |
|
| 189 | + |
|
| 190 | + default: |
|
| 191 | + if ($this->isAlphaNum($this->b)) { |
|
| 192 | + $this->action(1); |
|
| 193 | + } |
|
| 194 | + else { |
|
| 195 | + $this->action(2); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + break; |
|
| 199 | + |
|
| 200 | + default: |
|
| 201 | + switch ($this->b) { |
|
| 202 | + case ' ': |
|
| 203 | + if ($this->isAlphaNum($this->a)) { |
|
| 204 | + $this->action(1); |
|
| 205 | + break; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $this->action(3); |
|
| 209 | + break; |
|
| 210 | + |
|
| 211 | + case "\n": |
|
| 212 | + switch ($this->a) { |
|
| 213 | + case '}': |
|
| 214 | + case ']': |
|
| 215 | + case ')': |
|
| 216 | + case '+': |
|
| 217 | + case '-': |
|
| 218 | + case '"': |
|
| 219 | + case "'": |
|
| 220 | + $this->action(1); |
|
| 221 | + break; |
|
| 222 | + |
|
| 223 | + default: |
|
| 224 | + if ($this->isAlphaNum($this->a)) { |
|
| 225 | + $this->action(1); |
|
| 226 | + } |
|
| 227 | + else { |
|
| 228 | + $this->action(3); |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + break; |
|
| 232 | + |
|
| 233 | + default: |
|
| 234 | + $this->action(1); |
|
| 235 | + break; |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + return $this->output; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | protected function next() { |
| 244 | - $c = $this->get(); |
|
| 245 | - |
|
| 246 | - if ($c === '/') { |
|
| 247 | - switch($this->peek()) { |
|
| 248 | - case '/': |
|
| 249 | - for (;;) { |
|
| 250 | - $c = $this->get(); |
|
| 251 | - |
|
| 252 | - if (ord($c) <= self::ORD_LF) { |
|
| 253 | - return $c; |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - case '*': |
|
| 258 | - $this->get(); |
|
| 259 | - |
|
| 260 | - for (;;) { |
|
| 261 | - switch($this->get()) { |
|
| 262 | - case '*': |
|
| 263 | - if ($this->peek() === '/') { |
|
| 264 | - $this->get(); |
|
| 265 | - return ' '; |
|
| 266 | - } |
|
| 267 | - break; |
|
| 268 | - |
|
| 269 | - case null: |
|
| 270 | - throw new JSMinException('Unterminated comment.'); |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - default: |
|
| 275 | - return $c; |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - return $c; |
|
| 244 | + $c = $this->get(); |
|
| 245 | + |
|
| 246 | + if ($c === '/') { |
|
| 247 | + switch($this->peek()) { |
|
| 248 | + case '/': |
|
| 249 | + for (;;) { |
|
| 250 | + $c = $this->get(); |
|
| 251 | + |
|
| 252 | + if (ord($c) <= self::ORD_LF) { |
|
| 253 | + return $c; |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + case '*': |
|
| 258 | + $this->get(); |
|
| 259 | + |
|
| 260 | + for (;;) { |
|
| 261 | + switch($this->get()) { |
|
| 262 | + case '*': |
|
| 263 | + if ($this->peek() === '/') { |
|
| 264 | + $this->get(); |
|
| 265 | + return ' '; |
|
| 266 | + } |
|
| 267 | + break; |
|
| 268 | + |
|
| 269 | + case null: |
|
| 270 | + throw new JSMinException('Unterminated comment.'); |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + default: |
|
| 275 | + return $c; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + return $c; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | protected function peek() { |
| 283 | - $this->lookAhead = $this->get(); |
|
| 284 | - return $this->lookAhead; |
|
| 283 | + $this->lookAhead = $this->get(); |
|
| 284 | + return $this->lookAhead; |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | \ No newline at end of file |
@@ -55,8 +55,8 @@ |
||
| 55 | 55 | { |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * @var TTable parent row control containing the cell |
|
| 59 | - */ |
|
| 58 | + * @var TTable parent row control containing the cell |
|
| 59 | + */ |
|
| 60 | 60 | private $_row; |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -32,8 +32,8 @@ |
||
| 32 | 32 | { |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @var integer the zero-based index of the cell. |
|
| 36 | - */ |
|
| 35 | + * @var integer the zero-based index of the cell. |
|
| 36 | + */ |
|
| 37 | 37 | private $_selectedCellIndex = -1; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -244,8 +244,8 @@ |
||
| 244 | 244 | class TActiveTableRowEventParameter extends TCallbackEventParameter |
| 245 | 245 | { |
| 246 | 246 | /** |
| 247 | - * @var integer the zero-based index of the row. |
|
| 248 | - */ |
|
| 247 | + * @var integer the zero-based index of the row. |
|
| 248 | + */ |
|
| 249 | 249 | private $_selectedRowIndex = -1; |
| 250 | 250 | |
| 251 | 251 | /** |