@@ -68,7 +68,9 @@ |
||
68 | 68 | |
69 | 69 | foreach ($schemas as $schema) { |
70 | 70 | $schema = $schema['Create Table']; |
71 | - if ($this->removeAI) $schema = preg_replace('/AUTO_INCREMENT=([0-9]+)(\s{0,1})/', '', $schema); |
|
71 | + if ($this->removeAI) { |
|
72 | + $schema = preg_replace('/AUTO_INCREMENT=([0-9]+)(\s{0,1})/', '', $schema); |
|
73 | + } |
|
72 | 74 | $this->ln($schema . ";\n\n"); |
73 | 75 | } |
74 | 76 | } |
@@ -437,7 +437,9 @@ discard block |
||
437 | 437 | |
438 | 438 | $primary = $this->getPrimary($table); |
439 | 439 | |
440 | - if (is_array($primary)) return null; |
|
440 | + if (is_array($primary)) { |
|
441 | + return null; |
|
442 | + } |
|
441 | 443 | |
442 | 444 | $table = $this->rewriteTable($table); |
443 | 445 | |
@@ -608,8 +610,12 @@ discard block |
||
608 | 610 | function insert($table, $rows, $method = null) |
609 | 611 | { |
610 | 612 | |
611 | - if (empty($rows)) return; |
|
612 | - if (!isset($rows[0])) $rows = array($rows); |
|
613 | + if (empty($rows)) { |
|
614 | + return; |
|
615 | + } |
|
616 | + if (!isset($rows[0])) { |
|
617 | + $rows = array($rows); |
|
618 | + } |
|
613 | 619 | |
614 | 620 | if ($method === 'prepared') { |
615 | 621 | |
@@ -638,7 +644,9 @@ discard block |
||
638 | 644 | { |
639 | 645 | |
640 | 646 | $columns = $this->getColumns($rows); |
641 | - if (empty($columns)) return; |
|
647 | + if (empty($columns)) { |
|
648 | + return; |
|
649 | + } |
|
642 | 650 | |
643 | 651 | $query = $this->insertHead($table, $columns); |
644 | 652 | $query .= "( ?" . str_repeat(", ?", count($columns) - 1) . " )"; |
@@ -677,7 +685,9 @@ discard block |
||
677 | 685 | { |
678 | 686 | |
679 | 687 | $columns = $this->getColumns($rows); |
680 | - if (empty($columns)) return; |
|
688 | + if (empty($columns)) { |
|
689 | + return; |
|
690 | + } |
|
681 | 691 | |
682 | 692 | $query = $this->insertHead($table, $columns); |
683 | 693 | $lists = $this->valueLists($rows, $columns); |
@@ -703,7 +713,9 @@ discard block |
||
703 | 713 | { |
704 | 714 | |
705 | 715 | $columns = $this->getColumns($rows); |
706 | - if (empty($columns)) return; |
|
716 | + if (empty($columns)) { |
|
717 | + return; |
|
718 | + } |
|
707 | 719 | |
708 | 720 | $query = $this->insertHead($table, $columns); |
709 | 721 | $lists = $this->valueLists($rows, $columns); |
@@ -811,7 +823,9 @@ discard block |
||
811 | 823 | function update($table, $data, $where = array(), $params = array()) |
812 | 824 | { |
813 | 825 | |
814 | - if (empty($data)) return; |
|
826 | + if (empty($data)) { |
|
827 | + return; |
|
828 | + } |
|
815 | 829 | |
816 | 830 | $set = array(); |
817 | 831 | |
@@ -821,8 +835,12 @@ discard block |
||
821 | 835 | |
822 | 836 | } |
823 | 837 | |
824 | - if (!is_array($where)) $where = array($where); |
|
825 | - if (!is_array($params)) $params = array_slice(func_get_args(), 3); |
|
838 | + if (!is_array($where)) { |
|
839 | + $where = array($where); |
|
840 | + } |
|
841 | + if (!is_array($params)) { |
|
842 | + $params = array_slice(func_get_args(), 3); |
|
843 | + } |
|
826 | 844 | |
827 | 845 | $table = $this->rewriteTable($table); |
828 | 846 | $query = "UPDATE " . $this->quoteIdentifier($table); |
@@ -851,8 +869,12 @@ discard block |
||
851 | 869 | function delete($table, $where = array(), $params = array()) |
852 | 870 | { |
853 | 871 | |
854 | - if (!is_array($where)) $where = array($where); |
|
855 | - if (!is_array($params)) $params = array_slice(func_get_args(), 2); |
|
872 | + if (!is_array($where)) { |
|
873 | + $where = array($where); |
|
874 | + } |
|
875 | + if (!is_array($params)) { |
|
876 | + $params = array_slice(func_get_args(), 2); |
|
877 | + } |
|
856 | 878 | |
857 | 879 | $table = $this->rewriteTable($table); |
858 | 880 | $query = "DELETE FROM " . $this->quoteIdentifier($table); |
@@ -1094,7 +1116,9 @@ discard block |
||
1094 | 1116 | |
1095 | 1117 | $delimiter = $this->identifierDelimiter; |
1096 | 1118 | |
1097 | - if (empty($delimiter)) return $identifier; |
|
1119 | + if (empty($delimiter)) { |
|
1120 | + return $identifier; |
|
1121 | + } |
|
1098 | 1122 | |
1099 | 1123 | $identifier = explode(".", $identifier); |
1100 | 1124 |
@@ -111,7 +111,9 @@ discard block |
||
111 | 111 | |
112 | 112 | if ($where !== null) { |
113 | 113 | |
114 | - if (!is_array($params)) $params = array_slice(func_get_args(), 2); |
|
114 | + if (!is_array($params)) { |
|
115 | + $params = array_slice(func_get_args(), 2); |
|
116 | + } |
|
115 | 117 | $result = $result->where($where, $params); |
116 | 118 | |
117 | 119 | } |
@@ -129,7 +131,9 @@ discard block |
||
129 | 131 | function via($key) |
130 | 132 | { |
131 | 133 | |
132 | - if (!$this->parent_) throw new \LogicException('Cannot set reference key on basic Result'); |
|
134 | + if (!$this->parent_) { |
|
135 | + throw new \LogicException('Cannot set reference key on basic Result'); |
|
136 | + } |
|
133 | 137 | |
134 | 138 | $clone = clone $this; |
135 | 139 | |
@@ -155,7 +159,9 @@ discard block |
||
155 | 159 | function execute() |
156 | 160 | { |
157 | 161 | |
158 | - if (isset($this->rows)) return $this; |
|
162 | + if (isset($this->rows)) { |
|
163 | + return $this; |
|
164 | + } |
|
159 | 165 | |
160 | 166 | if ($this->parent_) { |
161 | 167 |
@@ -97,7 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | if (stripos($rows[1], '(')) { |
99 | 99 | $type[$table][] = stristr($rows[1], '(', true); |
100 | - } else $type[$table][] = $rows[1]; |
|
100 | + } else { |
|
101 | + $type[$table][] = $rows[1]; |
|
102 | + } |
|
101 | 103 | |
102 | 104 | $return .= $rows[0]; |
103 | 105 | $count++; |
@@ -125,7 +127,11 @@ discard block |
||
125 | 127 | |
126 | 128 | if (isset($row[$j])) { |
127 | 129 | //if number, take away "". else leave as string |
128 | - if (in_array($type[$table][$j], $numtypes)) $return .= $row[$j]; else $return .= '"' . $row[$j] . '"'; |
|
130 | + if (in_array($type[$table][$j], $numtypes)) { |
|
131 | + $return .= $row[$j]; |
|
132 | + } else { |
|
133 | + $return .= '"' . $row[$j] . '"'; |
|
134 | + } |
|
129 | 135 | } else { |
130 | 136 | $return .= '""'; |
131 | 137 | } |
@@ -69,17 +69,22 @@ discard block |
||
69 | 69 | $characterDeficit = 0; //Gets incremented when an uppercase letter is encountered before $targetCharsPerWord characters have been collected since the last UC char. |
70 | 70 | $wordIndex = $targetWordLength; //HACK: keeps track of how many characters have been carried into the abbreviation since the last UC char |
71 | 71 | while ($stringIndex < strlen($strString)) { //Process the whole input string... |
72 | - if ($abbrevLength >= $targetLength) //...unless the abbreviation has hit the target length cap |
|
72 | + if ($abbrevLength >= $targetLength) { |
|
73 | + //...unless the abbreviation has hit the target length cap |
|
73 | 74 | break; |
75 | + } |
|
74 | 76 | $currentChar = $strString[$stringIndex++]; //Grab a character from the string, advance the string cursor |
75 | 77 | if (in_array($currentChar, $ucLetters)) { //If handling a UC char, consider it a new word |
76 | 78 | $characterDeficit += $targetWordLength - $wordIndex; //If UC chars are closer together than targetWordLength, keeps track of how many extra characters are required to fit the target length of the abbreviation |
77 | 79 | $wordIndex = 0; //Set the wordIndex to reflect a new word |
78 | 80 | } else if ($wordIndex >= $targetWordLength) { |
79 | - if ($characterDeficit == 0) //If the word is full and we're not short any characters, ignore the character |
|
81 | + if ($characterDeficit == 0) { |
|
82 | + //If the word is full and we're not short any characters, ignore the character |
|
80 | 83 | continue; |
81 | - else |
|
82 | - $characterDefecit--; //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation |
|
84 | + } else { |
|
85 | + $characterDefecit--; |
|
86 | + } |
|
87 | + //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation |
|
83 | 88 | } |
84 | 89 | $abbreviation .= $currentChar; //Add the character to the abbreviation |
85 | 90 | $abbrevLength++; //Increment abbreviation length |
@@ -114,7 +119,9 @@ discard block |
||
114 | 119 | $ascii['y'] = array(253, 255); |
115 | 120 | foreach ($ascii as $key => $item) { |
116 | 121 | $acentos = ''; |
117 | - foreach ($item AS $codigo) $acentos .= chr($codigo); |
|
122 | + foreach ($item AS $codigo) { |
|
123 | + $acentos .= chr($codigo); |
|
124 | + } |
|
118 | 125 | $troca[$key] = '/[' . $acentos . ']/i'; |
119 | 126 | } |
120 | 127 | $string = preg_replace(array_values($troca), array_keys($troca), $string); |
@@ -240,11 +240,18 @@ discard block |
||
240 | 240 | $QRange1 = $temp[0]; |
241 | 241 | $QRange2 = $temp[1]; |
242 | 242 | |
243 | - if ($QRange2 == "") return array($QRange1); //special case, they didn't put a second quad parameter |
|
243 | + if ($QRange2 == "") { |
|
244 | + return array($QRange1); |
|
245 | + } |
|
246 | + //special case, they didn't put a second quad parameter |
|
244 | 247 | |
245 | 248 | //basic error handling to see if it is generally a valid IP in the form N.N.N.N |
246 | - if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange1) != 1) return array(-1); |
|
247 | - if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange2) != 1) return array(-1); |
|
249 | + if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange1) != 1) { |
|
250 | + return array(-1); |
|
251 | + } |
|
252 | + if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $QRange2) != 1) { |
|
253 | + return array(-1); |
|
254 | + } |
|
248 | 255 | |
249 | 256 | $quad1 = explode(".", $QRange1); |
250 | 257 | $quad2 = explode(".", $QRange2); |
@@ -252,12 +259,16 @@ discard block |
||
252 | 259 | reset($quad1); |
253 | 260 | while (list ($key, $val) = each($quad1)) { |
254 | 261 | $quad1[$key] = intval($val); |
255 | - if ($quad1[$key] < 0 || $quad1[$key] > 255) return array(-2); |
|
262 | + if ($quad1[$key] < 0 || $quad1[$key] > 255) { |
|
263 | + return array(-2); |
|
264 | + } |
|
256 | 265 | } |
257 | 266 | reset($quad2); |
258 | 267 | while (list ($key, $val) = each($quad2)) { |
259 | 268 | $quad2[$key] = intval($val); |
260 | - if ($quad2[$key] < 0 || $quad2[$key] > 255) return array(-2); |
|
269 | + if ($quad2[$key] < 0 || $quad2[$key] > 255) { |
|
270 | + return array(-2); |
|
271 | + } |
|
261 | 272 | } |
262 | 273 | |
263 | 274 | $startIP_long = sprintf("%u", ip2long($QRange1)); |
@@ -272,8 +283,9 @@ discard block |
||
272 | 283 | |
273 | 284 | //this is a total hack. there must be a better way. |
274 | 285 | $thisQuad = explode(".", $temp); |
275 | - if ($thisQuad[3] > 0 && $thisQuad[3] < 255) |
|
276 | - $ip[$k++] = $temp; |
|
286 | + if ($thisQuad[3] > 0 && $thisQuad[3] < 255) { |
|
287 | + $ip[$k++] = $temp; |
|
288 | + } |
|
277 | 289 | } |
278 | 290 | |
279 | 291 | return $ip; |
@@ -134,7 +134,7 @@ |
||
134 | 134 | foreach ($name as $k => $v) { |
135 | 135 | $this->data['name'] = $k . '=' . rawurlencode($v); |
136 | 136 | } |
137 | - }else { |
|
137 | + } else { |
|
138 | 138 | $this->data['name'] = $name . '='. rawurlencode($name); |
139 | 139 | } |
140 | 140 |
@@ -38,16 +38,22 @@ discard block |
||
38 | 38 | // Verifica se o diretório informado é válido |
39 | 39 | if (is_dir($lib)) { |
40 | 40 | // Verifica se o arquivo já existe neste primeiro diretório |
41 | - if (file_exists($lib . $ds . $file)) return $lib . $ds . $file; |
|
41 | + if (file_exists($lib . $ds . $file)) { |
|
42 | + return $lib . $ds . $file; |
|
43 | + } |
|
42 | 44 | // Lista os subdiretórios e arquivos |
43 | 45 | $dirs = array_diff(scandir($lib, 1), array('.', '..')); |
44 | 46 | foreach ($dirs as $dir) { |
45 | 47 | // Verifica se é um arquivo se for, pula para o próximo |
46 | - if (!is_dir($lib . $ds . $dir)) continue; |
|
48 | + if (!is_dir($lib . $ds . $dir)) { |
|
49 | + continue; |
|
50 | + } |
|
47 | 51 | // Se for um diretório procura dentro dele |
48 | 52 | $f = search_lib($lib . $ds . $dir, $file, $ds); |
49 | 53 | // Caso não encontre retora false |
50 | - if ( false !== $f ) return $f; |
|
54 | + if ( false !== $f ) { |
|
55 | + return $f; |
|
56 | + } |
|
51 | 57 | } |
52 | 58 | } |
53 | 59 | // Se o diretório informado não for válido ou se não tiver encontrado retorna false |
@@ -60,7 +66,9 @@ discard block |
||
60 | 66 | $ext = '.php'; |
61 | 67 | $file = search_lib($libs, $class . $ext); |
62 | 68 | // Se encontrou inclui o arquivo |
63 | - if (false !== $file) require_once $file; |
|
69 | + if (false !== $file) { |
|
70 | + require_once $file; |
|
71 | + } |
|
64 | 72 | // Se não encontrar o arquivo lança um erro na tela. :) |
65 | 73 | else { |
66 | 74 | $msg = "Autoload fatal erro: Can't find the file {$class}{$ext}!"; |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | $this->compression = $compression; |
40 | 40 | $this->proxy = $proxy; |
41 | 41 | $this->cookies = $cookies; |
42 | - if ($this->cookies == true) $this->cookie($cookie); |
|
42 | + if ($this->cookies == true) { |
|
43 | + $this->cookie($cookie); |
|
44 | + } |
|
43 | 45 | |
44 | 46 | } |
45 | 47 | |
@@ -60,11 +62,17 @@ discard block |
||
60 | 62 | curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); |
61 | 63 | curl_setopt($process, CURLOPT_HEADER, 0); |
62 | 64 | curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); |
63 | - if ($this->cookies == true) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file); |
|
64 | - if ($this->cookies == true) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file); |
|
65 | + if ($this->cookies == true) { |
|
66 | + curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file); |
|
67 | + } |
|
68 | + if ($this->cookies == true) { |
|
69 | + curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file); |
|
70 | + } |
|
65 | 71 | curl_setopt($process, CURLOPT_ENCODING, $this->compression); |
66 | 72 | curl_setopt($process, CURLOPT_TIMEOUT, 30); |
67 | - if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); |
|
73 | + if ($this->proxy) { |
|
74 | + curl_setopt($process, CURLOPT_PROXY, $this->proxy); |
|
75 | + } |
|
68 | 76 | curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); |
69 | 77 | curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); |
70 | 78 | $return = curl_exec($process); |
@@ -95,11 +103,17 @@ discard block |
||
95 | 103 | // curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); |
96 | 104 | curl_setopt($process, CURLOPT_HEADER, 1); |
97 | 105 | curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); |
98 | - if ($this->cookies == true) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file); |
|
99 | - if ($this->cookies == true) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file); |
|
106 | + if ($this->cookies == true) { |
|
107 | + curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file); |
|
108 | + } |
|
109 | + if ($this->cookies == true) { |
|
110 | + curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file); |
|
111 | + } |
|
100 | 112 | curl_setopt($process, CURLOPT_ENCODING, $this->compression); |
101 | 113 | curl_setopt($process, CURLOPT_TIMEOUT, 30); |
102 | - if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); |
|
114 | + if ($this->proxy) { |
|
115 | + curl_setopt($process, CURLOPT_PROXY, $this->proxy); |
|
116 | + } |
|
103 | 117 | curl_setopt($process, CURLOPT_POST, 1); |
104 | 118 | curl_setopt($process, CURLOPT_POSTFIELDS, $data); |
105 | 119 | curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); |