@@ -93,6 +93,14 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | + /** |
|
97 | + * @param string $analytics |
|
98 | + * @param string $hostbd |
|
99 | + * @param string $nombrebd |
|
100 | + * @param string $usuariobd |
|
101 | + * @param string $clavebd |
|
102 | + * @param string $config |
|
103 | + */ |
|
96 | 104 | public function paso1($proyecto,$analytics,$hostbd,$nombrebd,$usuariobd,$usuariobd,$clavebd,$config){ |
97 | 105 | |
98 | 106 |
@@ -86,7 +86,7 @@ |
||
86 | 86 | if($a){ |
87 | 87 | |
88 | 88 | $this->paso1($proyecto,$analytics,$hostbd,$nombrebd,$usuariobd,$usuariobd,$clavebd,$config); |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | $this->_ayuda->redireccionUrl('instalador?error="Los datos que estas ingresando no coniciden con los de la BD"'); |
91 | 91 | } |
92 | 92 |
@@ -72,6 +72,9 @@ |
||
72 | 72 | exit(); |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @param string $url |
|
77 | + */ |
|
75 | 78 | function redireccionUrl($url){ |
76 | 79 | $url=Cf_BASE_URL.$url; |
77 | 80 | header('Location: ' . $url); |
@@ -48,8 +48,7 @@ |
||
48 | 48 | function filtroEmail($email){ |
49 | 49 | if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){ |
50 | 50 | echo "E-Mail no es valido"; |
51 | - } |
|
52 | - else |
|
51 | + } else |
|
53 | 52 | { |
54 | 53 | echo "E-Mail es valido"; |
55 | 54 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @access public |
76 | 76 | * @param string $clave |
77 | - * @param mixed $content the the content you want to store |
|
77 | + * @param mixed $contenido the the content you want to store |
|
78 | 78 | * @param bool $raw whether if you want to store raw data or not. If it is true, $content *must* be a string |
79 | 79 | * It can be useful for static html caching. |
80 | 80 | * @return bool whether if the operation was successful or not |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Check if a file has expired or not. |
113 | 113 | * |
114 | 114 | * @access public |
115 | - * @param $archivo the rout to the file |
|
115 | + * @param string $archivo the rout to the file |
|
116 | 116 | * @param int $fecha the number of minutes it was set to expire |
117 | 117 | * @return bool if the file has expired or not |
118 | 118 | */ |
@@ -330,7 +330,6 @@ discard block |
||
330 | 330 | * @name validate |
331 | 331 | * @tutorial this function validate items sends trhough form. It DON'T FILTER |
332 | 332 | * Basically simulate HTML5 trhoguh PHP for full compatibility |
333 | - * @param boolean $error_list If is true, it generate in $this->error_list a list with data required |
|
334 | 333 | */ |
335 | 334 | public function validate() { |
336 | 335 | $this->error_list = ''; // Clean error list |
@@ -480,7 +479,7 @@ discard block |
||
480 | 479 | * @name validateArray |
481 | 480 | * This functions validate an Array, is a complement to validateRadio, select... |
482 | 481 | * @param array/string $values List of values to validate |
483 | - * @param array/string $value/s selecteds by user |
|
482 | + * @param array/string $value selecteds by user |
|
484 | 483 | */ |
485 | 484 | private function validateArray($values, $value, $data = array()) { |
486 | 485 | if (is_array($values)) { |
@@ -508,7 +507,6 @@ discard block |
||
508 | 507 | /** |
509 | 508 | * @name validateRadio |
510 | 509 | * @tutorial This function test if an radio is valid depending assigned values |
511 | - * @param array $data Contains all information about input |
|
512 | 510 | * @return boolean If return true, its okay |
513 | 511 | */ |
514 | 512 | private function validateRadio($params) { |
@@ -540,7 +538,6 @@ discard block |
||
540 | 538 | /** |
541 | 539 | * @name validateSelect |
542 | 540 | * @tutorial This function test if an select is valid depending assigned values |
543 | - * @param array $data Contains all information about input |
|
544 | 541 | * @return boolean If return true, its okay |
545 | 542 | */ |
546 | 543 | private function validateSelect($param) { |
@@ -775,7 +772,6 @@ discard block |
||
775 | 772 | * @param string $name Select name |
776 | 773 | * @param array $values Array('value'=>'text to show') |
777 | 774 | * @param boolean $required Specify if select is required |
778 | - * @param string $id ID Specify ID to manipulate via javascript or CSS |
|
779 | 775 | * @param array $attributes Optional atributes not listened (in array). |
780 | 776 | */ |
781 | 777 | public function addSelect($label = '', $name = '', $values = '', $selected = null, $required = false, $multiple = false, $attributes = array()) { |
@@ -849,7 +845,6 @@ discard block |
||
849 | 845 | * @name addButton |
850 | 846 | * @tutorial Use this function to add a button with "onclick" action (or id/class to call via jquery) |
851 | 847 | * @param string $value Name to show in button and ID |
852 | - * @param string $onClick Action to load when button is clicked |
|
853 | 848 | * @param array $attributes Optional atributes not listened (in array). |
854 | 849 | */ |
855 | 850 | public function addTextArea($label = '', $name = '', $value = '', $required = false, $attributes = array()) { |
@@ -878,7 +873,6 @@ discard block |
||
878 | 873 | /** |
879 | 874 | * @name log |
880 | 875 | * @tutorial Save a log if is enabled logging |
881 | - * @param boolean $save If is true, save the log |
|
882 | 876 | * @param string $message Message to log |
883 | 877 | */ |
884 | 878 | private function log($message, $data = array()) { |
@@ -130,14 +130,18 @@ discard block |
||
130 | 130 | // Itearate all inputs |
131 | 131 | foreach ($toShow as $input) { |
132 | 132 | // Reading data |
133 | - if (isset($input['data'])) $data = $input['data']; |
|
133 | + if (isset($input['data'])) { |
|
134 | + $data = $input['data']; |
|
135 | + } |
|
134 | 136 | |
135 | 137 | // New row |
136 | 138 | echo '<div>'; |
137 | 139 | // Showing labels |
138 | 140 | if ($this->show_labels) { |
139 | 141 | echo '<div>'; |
140 | - if (isset($input['label']) and $input['label'] != '') echo $input['label']; |
|
142 | + if (isset($input['label']) and $input['label'] != '') { |
|
143 | + echo $input['label']; |
|
144 | + } |
|
141 | 145 | echo '</div>'; |
142 | 146 | } |
143 | 147 | |
@@ -182,7 +186,9 @@ discard block |
||
182 | 186 | private function showInput($data) { |
183 | 187 | $r = ''; |
184 | 188 | // Number start if is range |
185 | - if ($data['type'] == 'range' and isset($data['min'])) $r .= $data['min'] . ' '; |
|
189 | + if ($data['type'] == 'range' and isset($data['min'])) { |
|
190 | + $r .= $data['min'] . ' '; |
|
191 | + } |
|
186 | 192 | |
187 | 193 | $r .= '<input '; |
188 | 194 | |
@@ -197,7 +203,9 @@ discard block |
||
197 | 203 | $r .= '/>'; |
198 | 204 | |
199 | 205 | // Number end if is range |
200 | - if ($data['type'] == 'range' and isset($data['max'])) $r .= $data['max'] . ' '; |
|
206 | + if ($data['type'] == 'range' and isset($data['max'])) { |
|
207 | + $r .= $data['max'] . ' '; |
|
208 | + } |
|
201 | 209 | |
202 | 210 | // Return |
203 | 211 | return $r; |
@@ -220,7 +228,9 @@ discard block |
||
220 | 228 | // Si no tiene m�ltiples valores (es un string), lo retornamos de golpe |
221 | 229 | if (!is_array($values)) { |
222 | 230 | // Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada |
223 | - if (!is_array($values) and $selected == $values) $base .= ' checked="checked" '; |
|
231 | + if (!is_array($values) and $selected == $values) { |
|
232 | + $base .= ' checked="checked" '; |
|
233 | + } |
|
224 | 234 | return $base . ' value="'.$values.'" />'; |
225 | 235 | } |
226 | 236 | |
@@ -229,7 +239,9 @@ discard block |
||
229 | 239 | $r = ''; |
230 | 240 | foreach ($values as $id=>$text) { |
231 | 241 | $r .= $base; |
232 | - if ($selected !== null and $id == $selected) $r .= ' checked="checked" '; |
|
242 | + if ($selected !== null and $id == $selected) { |
|
243 | + $r .= ' checked="checked" '; |
|
244 | + } |
|
233 | 245 | $r .= ' value="'. $id .'" />'.$text.'</label>'; |
234 | 246 | } |
235 | 247 | |
@@ -263,7 +275,9 @@ discard block |
||
263 | 275 | if ($selected != '') { |
264 | 276 | foreach ($values as $val=>$txt) { |
265 | 277 | $r .= '<option value="' . $val . '"'; |
266 | - if ($val == $selected) $r .= ' selected '; |
|
278 | + if ($val == $selected) { |
|
279 | + $r .= ' selected '; |
|
280 | + } |
|
267 | 281 | $r .= '>' . $txt . '</option>'; |
268 | 282 | } |
269 | 283 | } else { |
@@ -304,12 +318,24 @@ discard block |
||
304 | 318 | */ |
305 | 319 | private function showStartForm() { |
306 | 320 | $r = '<form '; |
307 | - if ($this->action!= '') $r .= 'action="'.$this->action.'" '; |
|
308 | - if ($this->method != '') $r .= 'method="'.$this->method .'" '; |
|
309 | - if ($this->name != '') $r .= 'name="'.$this->name .'" '; |
|
310 | - if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit .'" '; |
|
311 | - if ($this->id != '') $r .= 'id="'.$this->id .'" '; |
|
312 | - if ($this->class != '') $r .= 'class="'.$this->class .'" '; |
|
321 | + if ($this->action!= '') { |
|
322 | + $r .= 'action="'.$this->action.'" '; |
|
323 | + } |
|
324 | + if ($this->method != '') { |
|
325 | + $r .= 'method="'.$this->method .'" '; |
|
326 | + } |
|
327 | + if ($this->name != '') { |
|
328 | + $r .= 'name="'.$this->name .'" '; |
|
329 | + } |
|
330 | + if ($this->on_submit != '') { |
|
331 | + $r .= 'onSubmit="'.$this->on_submit .'" '; |
|
332 | + } |
|
333 | + if ($this->id != '') { |
|
334 | + $r .= 'id="'.$this->id .'" '; |
|
335 | + } |
|
336 | + if ($this->class != '') { |
|
337 | + $r .= 'class="'.$this->class .'" '; |
|
338 | + } |
|
313 | 339 | |
314 | 340 | return $r . '>'.PHP_EOL; |
315 | 341 | } |
@@ -370,7 +396,9 @@ discard block |
||
370 | 396 | } |
371 | 397 | } |
372 | 398 | |
373 | - if ($success >= $total) return true; |
|
399 | + if ($success >= $total) { |
|
400 | + return true; |
|
401 | + } |
|
374 | 402 | return false; |
375 | 403 | } |
376 | 404 | |
@@ -570,8 +598,11 @@ discard block |
||
570 | 598 | * @return string/null Return the value, if don't exist, return null |
571 | 599 | */ |
572 | 600 | private function getData($key, $default = null) { |
573 | - if ($this->method == "post") return isset($_POST[$key]) ? $_POST[$key] : $default; |
|
574 | - else return isset($_GET[$key]) ? $_GET[$key] : $default; |
|
601 | + if ($this->method == "post") { |
|
602 | + return isset($_POST[$key]) ? $_POST[$key] : $default; |
|
603 | + } else { |
|
604 | + return isset($_GET[$key]) ? $_GET[$key] : $default; |
|
605 | + } |
|
575 | 606 | } |
576 | 607 | |
577 | 608 | /* |
@@ -614,9 +645,15 @@ discard block |
||
614 | 645 | ); |
615 | 646 | |
616 | 647 | |
617 | - if ($required) $data['required'] = 'required'; |
|
618 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
619 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
648 | + if ($required) { |
|
649 | + $data['required'] = 'required'; |
|
650 | + } |
|
651 | + if ($placeholder != '') { |
|
652 | + $data['placeholder'] = $placeholder; |
|
653 | + } |
|
654 | + if (!empty($attributes)) { |
|
655 | + array_merge($data, $attributes); |
|
656 | + } |
|
620 | 657 | |
621 | 658 | |
622 | 659 | // Saving data to object |
@@ -624,7 +661,9 @@ discard block |
||
624 | 661 | 'type' => 'input', |
625 | 662 | 'data' => $data |
626 | 663 | ); |
627 | - if ($label != '') $content['label'] = $label; |
|
664 | + if ($label != '') { |
|
665 | + $content['label'] = $label; |
|
666 | + } |
|
628 | 667 | |
629 | 668 | $this->content[] = $content; |
630 | 669 | } |
@@ -651,19 +690,33 @@ discard block |
||
651 | 690 | ); |
652 | 691 | |
653 | 692 | |
654 | - if ($required) $data['required'] = 'required'; |
|
655 | - if ($min) $data['min'] = $min; |
|
656 | - if ($max) $data['max'] = $max; |
|
657 | - if ($step) $data['step'] = $step; |
|
658 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
659 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
693 | + if ($required) { |
|
694 | + $data['required'] = 'required'; |
|
695 | + } |
|
696 | + if ($min) { |
|
697 | + $data['min'] = $min; |
|
698 | + } |
|
699 | + if ($max) { |
|
700 | + $data['max'] = $max; |
|
701 | + } |
|
702 | + if ($step) { |
|
703 | + $data['step'] = $step; |
|
704 | + } |
|
705 | + if ($placeholder != '') { |
|
706 | + $data['placeholder'] = $placeholder; |
|
707 | + } |
|
708 | + if (!empty($attributes)) { |
|
709 | + array_merge($data, $attributes); |
|
710 | + } |
|
660 | 711 | |
661 | 712 | // Saving data to object |
662 | 713 | $content = array( |
663 | 714 | 'type' => 'input', |
664 | 715 | 'data' => $data |
665 | 716 | ); |
666 | - if ($label != '') $content['label'] = $label; |
|
717 | + if ($label != '') { |
|
718 | + $content['label'] = $label; |
|
719 | + } |
|
667 | 720 | |
668 | 721 | $this->content[] = $content; |
669 | 722 | } |
@@ -688,19 +741,33 @@ discard block |
||
688 | 741 | 'value' => $value, |
689 | 742 | ); |
690 | 743 | |
691 | - if ($required) $data['required'] = 'required'; |
|
692 | - if ($min) $data['min'] = $min; |
|
693 | - if ($max) $data['max'] = $max; |
|
694 | - if ($step) $data['step'] = $step; |
|
695 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
696 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
744 | + if ($required) { |
|
745 | + $data['required'] = 'required'; |
|
746 | + } |
|
747 | + if ($min) { |
|
748 | + $data['min'] = $min; |
|
749 | + } |
|
750 | + if ($max) { |
|
751 | + $data['max'] = $max; |
|
752 | + } |
|
753 | + if ($step) { |
|
754 | + $data['step'] = $step; |
|
755 | + } |
|
756 | + if ($placeholder != '') { |
|
757 | + $data['placeholder'] = $placeholder; |
|
758 | + } |
|
759 | + if (!empty($attributes)) { |
|
760 | + array_merge($data, $attributes); |
|
761 | + } |
|
697 | 762 | |
698 | 763 | // Saving data to object |
699 | 764 | $content = array( |
700 | 765 | 'type' => 'input', |
701 | 766 | 'data' => $data |
702 | 767 | ); |
703 | - if ($label != '') $content['label'] = $label; |
|
768 | + if ($label != '') { |
|
769 | + $content['label'] = $label; |
|
770 | + } |
|
704 | 771 | |
705 | 772 | $this->content[] = $content; |
706 | 773 | } |
@@ -721,14 +788,20 @@ discard block |
||
721 | 788 | 'name' => $name, |
722 | 789 | 'value' => $value |
723 | 790 | ); |
724 | - if ($required) $data['required'] = 'required'; |
|
725 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
791 | + if ($required) { |
|
792 | + $data['required'] = 'required'; |
|
793 | + } |
|
794 | + if (!empty($attributes)) { |
|
795 | + array_merge($data, $attributes); |
|
796 | + } |
|
726 | 797 | |
727 | 798 | $content = array( |
728 | 799 | 'type' => 'input', |
729 | 800 | 'data' => $data |
730 | 801 | ); |
731 | - if ($label != '') $content['label'] = $label; |
|
802 | + if ($label != '') { |
|
803 | + $content['label'] = $label; |
|
804 | + } |
|
732 | 805 | |
733 | 806 | $this->content[] = $content; |
734 | 807 | } |
@@ -746,13 +819,19 @@ discard block |
||
746 | 819 | * @param array $attributes Optional atributes not listened (in array). This will be applicated to all radioButton |
747 | 820 | */ |
748 | 821 | public function addRadio($label = '', $name = '', $values = array(), $selected = null, $required = false, $attributes = array()) { |
749 | - if (!is_array($values)) die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()'); |
|
822 | + if (!is_array($values)) { |
|
823 | + die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()'); |
|
824 | + } |
|
750 | 825 | $data = array( |
751 | 826 | 'name' => $name, |
752 | 827 | ); |
753 | 828 | |
754 | - if ($required) $data['required'] = 'required'; |
|
755 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
829 | + if ($required) { |
|
830 | + $data['required'] = 'required'; |
|
831 | + } |
|
832 | + if (!empty($attributes)) { |
|
833 | + array_merge($data, $attributes); |
|
834 | + } |
|
756 | 835 | |
757 | 836 | |
758 | 837 | |
@@ -762,7 +841,9 @@ discard block |
||
762 | 841 | 'values' => $values, |
763 | 842 | 'selected' => $selected |
764 | 843 | ); |
765 | - if ($label != '') $content['label'] = $label; |
|
844 | + if ($label != '') { |
|
845 | + $content['label'] = $label; |
|
846 | + } |
|
766 | 847 | |
767 | 848 | $this->content[] = $content; |
768 | 849 | } |
@@ -783,9 +864,15 @@ discard block |
||
783 | 864 | 'name' => $name, |
784 | 865 | 'required' => $required, |
785 | 866 | ); |
786 | - if ($required) $data['required'] = 'required'; |
|
787 | - if ($multiple) $data['multiple'] = 'multiple'; |
|
788 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
867 | + if ($required) { |
|
868 | + $data['required'] = 'required'; |
|
869 | + } |
|
870 | + if ($multiple) { |
|
871 | + $data['multiple'] = 'multiple'; |
|
872 | + } |
|
873 | + if (!empty($attributes)) { |
|
874 | + array_merge($data, $attributes); |
|
875 | + } |
|
789 | 876 | |
790 | 877 | |
791 | 878 | // In this case, the values are saved in the main of array to speed up select loader |
@@ -795,7 +882,9 @@ discard block |
||
795 | 882 | 'values' => $values, |
796 | 883 | 'selected' => $selected |
797 | 884 | ); |
798 | - if ($label != '') $content['label'] = $label; |
|
885 | + if ($label != '') { |
|
886 | + $content['label'] = $label; |
|
887 | + } |
|
799 | 888 | |
800 | 889 | $this->content[] = $content; |
801 | 890 | } |
@@ -813,7 +902,9 @@ discard block |
||
813 | 902 | 'name' => $name, |
814 | 903 | 'value' => $value |
815 | 904 | ); |
816 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
905 | + if (!empty($attributes)) { |
|
906 | + array_merge($data, $attributes); |
|
907 | + } |
|
817 | 908 | |
818 | 909 | $this->content[] = array( |
819 | 910 | 'type' => 'input', |
@@ -836,7 +927,9 @@ discard block |
||
836 | 927 | 'value' => $value, |
837 | 928 | 'onClick' => $onClick |
838 | 929 | ); |
839 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
930 | + if (!empty($attributes)) { |
|
931 | + array_merge($data, $attributes); |
|
932 | + } |
|
840 | 933 | |
841 | 934 | $this->content[] = array( |
842 | 935 | 'type' => 'input', |
@@ -858,8 +951,12 @@ discard block |
||
858 | 951 | 'name' => $name, |
859 | 952 | ); |
860 | 953 | |
861 | - if ($required) $data['required'] = 'required'; |
|
862 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
954 | + if ($required) { |
|
955 | + $data['required'] = 'required'; |
|
956 | + } |
|
957 | + if (!empty($attributes)) { |
|
958 | + array_merge($data, $attributes); |
|
959 | + } |
|
863 | 960 | |
864 | 961 | // Saving data to object |
865 | 962 | $content = array( |
@@ -867,7 +964,9 @@ discard block |
||
867 | 964 | 'text' => $value, |
868 | 965 | 'data' => $data |
869 | 966 | ); |
870 | - if ($label != '') $content['label'] = $label; |
|
967 | + if ($label != '') { |
|
968 | + $content['label'] = $label; |
|
969 | + } |
|
871 | 970 | |
872 | 971 | $this->content[] = $content; |
873 | 972 | } |
@@ -885,18 +984,26 @@ discard block |
||
885 | 984 | if ($this->logErrors) { |
886 | 985 | // Try to get a name (label or name) |
887 | 986 | if (class_exists('kw')) { |
888 | - if (isset($data['label'])) $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": '; |
|
889 | - elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
987 | + if (isset($data['label'])) { |
|
988 | + $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": '; |
|
989 | + } elseif (isset($data['name'])) { |
|
990 | + $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
991 | + } |
|
890 | 992 | } else { |
891 | - if (isset($data['label'])) $this->errors .= 'Found an error in field' . $data['label'] . '": '; |
|
892 | - elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
993 | + if (isset($data['label'])) { |
|
994 | + $this->errors .= 'Found an error in field' . $data['label'] . '": '; |
|
995 | + } elseif (isset($data['name'])) { |
|
996 | + $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
997 | + } |
|
893 | 998 | } |
894 | 999 | |
895 | 1000 | // preparing message |
896 | 1001 | $this->errors .= ' ' . $message . '.'; |
897 | 1002 | |
898 | 1003 | // Extra message (title attribute) |
899 | - if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title']; |
|
1004 | + if (isset($data['title']) and $data['title'] != '') { |
|
1005 | + $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title']; |
|
1006 | + } |
|
900 | 1007 | |
901 | 1008 | $this->errors .= '<br />'; |
902 | 1009 | } |
@@ -59,6 +59,10 @@ discard block |
||
59 | 59 | return $cadenaAleatoria; |
60 | 60 | } |
61 | 61 | // encriptacion |
62 | + |
|
63 | + /** |
|
64 | + * @param string $clave |
|
65 | + */ |
|
62 | 66 | function cifrado($clave){ |
63 | 67 | $cfi=sha1(md5($clave)); |
64 | 68 | return $clave=Cf_KEY_MD5.$cfi; |
@@ -130,9 +134,6 @@ discard block |
||
130 | 134 | * |
131 | 135 | * @strip injection chars from email headers |
132 | 136 | * |
133 | - * @param string $string |
|
134 | - * |
|
135 | - * return string |
|
136 | 137 | * |
137 | 138 | */ |
138 | 139 | function emailSeguro($cadena) { |
@@ -79,12 +79,13 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | function obtenerDireccionIP(){ |
82 | - if (!empty($_SERVER ['HTTP_CLIENT_IP'] )) |
|
83 | - $ip=$_SERVER ['HTTP_CLIENT_IP']; |
|
84 | - elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] )) |
|
85 | - $ip=$_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
86 | - else |
|
87 | - $ip=$_SERVER ['REMOTE_ADDR']; |
|
82 | + if (!empty($_SERVER ['HTTP_CLIENT_IP'] )) { |
|
83 | + $ip=$_SERVER ['HTTP_CLIENT_IP']; |
|
84 | + } elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] )) { |
|
85 | + $ip=$_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
86 | + } else { |
|
87 | + $ip=$_SERVER ['REMOTE_ADDR']; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | return $ip; |
90 | 91 | } |
@@ -94,8 +95,7 @@ discard block |
||
94 | 95 | |
95 | 96 | if($ipCliente == $ip){ |
96 | 97 | return true; |
97 | - } |
|
98 | - else{ |
|
98 | + } else{ |
|
99 | 99 | header('location: http://www.tusitioweb/redireccion'); |
100 | 100 | exit; |
101 | 101 | } |
@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if (in_array($ipCliente,$ips)){ |
108 | 108 | return true; |
109 | - } |
|
110 | - else{ |
|
109 | + } else{ |
|
111 | 110 | header('location: http://direccion_envio_salida'); |
112 | 111 | exit; |
113 | 112 | } |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | |
119 | 118 | if(substr($ipCliente, 0, 8 ) == "150.214."){ |
120 | 119 | return true; |
121 | - } |
|
122 | - else{ |
|
120 | + } else{ |
|
123 | 121 | header('location: http://direccion_envio_salida'); |
124 | 122 | exit; |
125 | 123 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * in. |
202 | 202 | * |
203 | 203 | * @param string $newSql the query |
204 | - * @param array $bindings the bindings to process (key-value pairs) |
|
204 | + * @param array $newBindings the bindings to process (key-value pairs) |
|
205 | 205 | * |
206 | 206 | * @return string |
207 | 207 | */ |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @param string $sql SQL to be executed |
379 | 379 | * @param array $bindings list of values to bind to SQL snippet |
380 | 380 | * |
381 | - * @return array |
|
381 | + * @return integer |
|
382 | 382 | */ |
383 | 383 | public function GetAll( $sql, $bindings = array() ); |
384 | 384 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @param string $sql SQL to execute |
410 | 410 | * @param array $bindings list of values to bind to SQL snippet |
411 | 411 | * |
412 | - * @return mixed |
|
412 | + * @return integer |
|
413 | 413 | */ |
414 | 414 | public function GetAssocRow( $sql, $bindings = array() ); |
415 | 415 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param string $sql SQL Code to execute |
438 | 438 | * @param array $bindings list of values to bind to SQL snippet |
439 | 439 | * |
440 | - * @return array Affected Rows |
|
440 | + * @return integer Affected Rows |
|
441 | 441 | */ |
442 | 442 | public function Execute( $sql, $bindings = array() ); |
443 | 443 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param string $sql SQL code to execute |
464 | 464 | * @param array $bindings Bindings |
465 | 465 | * |
466 | - * @return mixed |
|
466 | + * @return Cursor\PDOCursor |
|
467 | 467 | */ |
468 | 468 | public function GetCursor( $sql, $bindings = array() ); |
469 | 469 | |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | * passes on to the screen for inspection. |
475 | 475 | * This method has no return value. |
476 | 476 | * |
477 | - * @param boolean $trueFalse turn on/off |
|
478 | 477 | * |
478 | + * @param boolean $tf |
|
479 | 479 | * @return void |
480 | 480 | */ |
481 | 481 | public function setDebugMode( $tf ); |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param string $sql the SQL string to be send to database server |
648 | 648 | * @param array $bindings the values that need to get bound to the query slots |
649 | 649 | * |
650 | - * @return void |
|
650 | + * @return \PDOStatement |
|
651 | 651 | * |
652 | 652 | * @throws SQL |
653 | 653 | */ |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | * $driver = new RPDO($dsn, $user, $password); |
718 | 718 | * $driver = new RPDO($existingConnection); |
719 | 719 | * |
720 | - * @param string|object $dsn database connection string |
|
720 | + * @param string $dsn database connection string |
|
721 | 721 | * @param string $user optional, usename to sign in |
722 | 722 | * @param string $pass optional, password for connection login |
723 | 723 | * |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * this method if you are an expert on RedBeanPHP, PDO and UTF8 connections and |
814 | 814 | * you know your database server VERY WELL. |
815 | 815 | * |
816 | - * @param PDO $pdo PDO instance |
|
816 | + * @param \PDO $pdo PDO instance |
|
817 | 817 | * |
818 | 818 | * @return void |
819 | 819 | */ |
@@ -940,7 +940,6 @@ discard block |
||
940 | 940 | * SQL to the screen together with some information about the |
941 | 941 | * results. |
942 | 942 | * |
943 | - * @param boolean $trueFalse turn on/off |
|
944 | 943 | * @param Logger $logger logger instance |
945 | 944 | * |
946 | 945 | * @return void |
@@ -1408,7 +1407,6 @@ discard block |
||
1408 | 1407 | * Obtains the own list of a certain type. |
1409 | 1408 | * |
1410 | 1409 | * @param string $type name of the list you want to retrieve |
1411 | - * @param OODB $oodb The RB OODB object database instance |
|
1412 | 1410 | * |
1413 | 1411 | * @return array |
1414 | 1412 | */ |
@@ -2235,7 +2233,6 @@ discard block |
||
2235 | 2233 | * of combining a get/unset. |
2236 | 2234 | * |
2237 | 2235 | * @param string $path path |
2238 | - * @param mixed $default default value |
|
2239 | 2236 | * |
2240 | 2237 | * @return mixed |
2241 | 2238 | */ |
@@ -2450,7 +2447,6 @@ discard block |
||
2450 | 2447 | * For polymorphic bean relations. |
2451 | 2448 | * Same as fetchAs but uses a column instead of a direct value. |
2452 | 2449 | * |
2453 | - * @param string $column |
|
2454 | 2450 | * |
2455 | 2451 | * @return OODBBean |
2456 | 2452 | */ |
@@ -2688,7 +2684,6 @@ discard block |
||
2688 | 2684 | * example #1. After preparing the linking bean, the bean is returned thus |
2689 | 2685 | * allowing the chained setter: ->song = $song. |
2690 | 2686 | * |
2691 | - * @param string|OODBBean $type type of bean to dispense or the full bean |
|
2692 | 2687 | * @param string|array $qualification JSON string or array (optional) |
2693 | 2688 | * |
2694 | 2689 | * @return OODBBean |
@@ -2959,7 +2954,7 @@ discard block |
||
2959 | 2954 | * this event. Part of the observer pattern implementation in RedBeanPHP. |
2960 | 2955 | * |
2961 | 2956 | * @param string $eventname event you want signal |
2962 | - * @param mixed $info message object to send along |
|
2957 | + * @param Adapter\DBAdapter $info message object to send along |
|
2963 | 2958 | * |
2964 | 2959 | * @return void |
2965 | 2960 | */ |
@@ -3158,7 +3153,7 @@ discard block |
||
3158 | 3153 | * adapter. RedBean will only access the adapter and never to talk |
3159 | 3154 | * directly to the driver though. |
3160 | 3155 | * |
3161 | - * @return object |
|
3156 | + * @return Driver |
|
3162 | 3157 | */ |
3163 | 3158 | public function getDatabase(); |
3164 | 3159 | |
@@ -3352,6 +3347,7 @@ discard block |
||
3352 | 3347 | |
3353 | 3348 | /** |
3354 | 3349 | * @see Adapter::getCell |
3350 | + * @param integer $noSignal |
|
3355 | 3351 | */ |
3356 | 3352 | public function getCell( $sql, $bindings = array(), $noSignal = NULL ) |
3357 | 3353 | { |
@@ -3497,7 +3493,7 @@ discard block |
||
3497 | 3493 | /** |
3498 | 3494 | * Constructor, creates a new instance of a PDO Database Cursor. |
3499 | 3495 | * |
3500 | - * @param PDOStatement $res the PDO statement |
|
3496 | + * @param \PDOStatement $res the PDO statement |
|
3501 | 3497 | * @param string $fetchStyle fetch style constant to use |
3502 | 3498 | * |
3503 | 3499 | * @return void |
@@ -3728,7 +3724,7 @@ discard block |
||
3728 | 3724 | * |
3729 | 3725 | * @param string $type source type |
3730 | 3726 | * @param string $targetType target type (type to join) |
3731 | - * @param string $leftRight type of join (possible: 'LEFT', 'RIGHT' or 'INNER'). |
|
3727 | + * @param string $joinType |
|
3732 | 3728 | * |
3733 | 3729 | * @return string $joinSQLSnippet |
3734 | 3730 | */ |
@@ -3867,7 +3863,6 @@ discard block |
||
3867 | 3863 | * |
3868 | 3864 | * @param string $type name of the table you want to query |
3869 | 3865 | * @param array $conditions criteria ( $column => array( $values ) ) |
3870 | - * @param string $addSQL additional SQL snippet |
|
3871 | 3866 | * @param array $bindings bindings for SQL snippet |
3872 | 3867 | * |
3873 | 3868 | * @return array |
@@ -3880,8 +3875,6 @@ discard block |
||
3880 | 3875 | * type, conditions (optional) and additional SQL snippet (optional). |
3881 | 3876 | * |
3882 | 3877 | * @param string $type name of the table you want to query |
3883 | - * @param array $conditions criteria ( $column => array( $values ) ) |
|
3884 | - * @param string $addSQL additional SQL snippet |
|
3885 | 3878 | * @param array $bindings bindings for SQL snippet |
3886 | 3879 | * |
3887 | 3880 | * @return Cursor |
@@ -3910,7 +3903,7 @@ discard block |
||
3910 | 3903 | * @param string $sourceID ID for the source |
3911 | 3904 | * @param string $destID ID for the destination |
3912 | 3905 | * |
3913 | - * @return array|null |
|
3906 | + * @return string |
|
3914 | 3907 | */ |
3915 | 3908 | public function queryRecordLink( $sourceType, $destType, $sourceID, $destID ); |
3916 | 3909 | |
@@ -3920,7 +3913,6 @@ discard block |
||
3920 | 3913 | * |
3921 | 3914 | * @param string $type name of the table you want to query |
3922 | 3915 | * @param array $conditions criteria ( $column => array( $values ) ) |
3923 | - * @param string $addSQL additional SQL snippet |
|
3924 | 3916 | * @param array $bindings bindings for SQL snippet |
3925 | 3917 | * |
3926 | 3918 | * @return integer |
@@ -3979,7 +3971,6 @@ discard block |
||
3979 | 3971 | * |
3980 | 3972 | * @param string $type name of the table you want to query |
3981 | 3973 | * @param array $conditions criteria ( $column => array( $values ) ) |
3982 | - * @param string $sql additional SQL |
|
3983 | 3974 | * @param array $bindings bindings |
3984 | 3975 | * |
3985 | 3976 | * @return void |
@@ -4007,7 +3998,6 @@ discard block |
||
4007 | 3998 | * This methods accepts a type and infers the corresponding table name. |
4008 | 3999 | * |
4009 | 4000 | * @param string $type type |
4010 | - * @param array $columnsPartOfIndex columns to include in index |
|
4011 | 4001 | * |
4012 | 4002 | * @return void |
4013 | 4003 | */ |
@@ -4078,7 +4068,7 @@ discard block |
||
4078 | 4068 | * SQL policies and does therefore not require database specific escaping rules. |
4079 | 4069 | * |
4080 | 4070 | * @param string $databaseStructure name of the column/table to check |
4081 | - * @param boolean $noQuotes TRUE to NOT put backticks or quotes around the string |
|
4071 | + * @param boolean $dontQuote TRUE to NOT put backticks or quotes around the string |
|
4082 | 4072 | * |
4083 | 4073 | * @return string |
4084 | 4074 | */ |
@@ -4107,7 +4097,7 @@ discard block |
||
4107 | 4097 | * This method also accepts a single associative array as |
4108 | 4098 | * its first argument. |
4109 | 4099 | * |
4110 | - * @param string|array $fromType |
|
4100 | + * @param string $fromType |
|
4111 | 4101 | * @param string $toType (optional) |
4112 | 4102 | * |
4113 | 4103 | * @return void |
@@ -4138,7 +4128,7 @@ discard block |
||
4138 | 4128 | * it's optional. A default version is available in AQueryWriter. |
4139 | 4129 | * |
4140 | 4130 | * @param $type the source type to fetch a target type for |
4141 | - * @param $property the property to fetch the type of |
|
4131 | + * @param string $property the property to fetch the type of |
|
4142 | 4132 | * |
4143 | 4133 | * @return string|NULL |
4144 | 4134 | */ |
@@ -4743,7 +4733,6 @@ discard block |
||
4743 | 4733 | * Inserts a record into the database using a series of insert columns |
4744 | 4734 | * and corresponding insertvalues. Returns the insert id. |
4745 | 4735 | * |
4746 | - * @param string $table table to perform query on |
|
4747 | 4736 | * @param array $insertcolumns columns to be inserted |
4748 | 4737 | * @param array $insertvalues values to be inserted |
4749 | 4738 | * |
@@ -4791,7 +4780,6 @@ discard block |
||
4791 | 4780 | /** |
4792 | 4781 | * Checks table name or column name. |
4793 | 4782 | * |
4794 | - * @param string $table table string |
|
4795 | 4783 | * |
4796 | 4784 | * @return string |
4797 | 4785 | * |
@@ -5206,6 +5194,9 @@ discard block |
||
5206 | 5194 | |
5207 | 5195 | /** |
5208 | 5196 | * @see QueryWriter::widenColumn |
5197 | + * @param string $type |
|
5198 | + * @param string $property |
|
5199 | + * @param integer $dataType |
|
5209 | 5200 | */ |
5210 | 5201 | public function widenColumn( $type, $property, $dataType ) |
5211 | 5202 | { |
@@ -5241,6 +5232,7 @@ discard block |
||
5241 | 5232 | |
5242 | 5233 | /** |
5243 | 5234 | * @see QueryWriter::getAssocTable |
5235 | + * @param string[] $types |
|
5244 | 5236 | */ |
5245 | 5237 | public function getAssocTable( $types ) |
5246 | 5238 | { |
@@ -5857,9 +5849,8 @@ discard block |
||
5857 | 5849 | * |
5858 | 5850 | * @param string $type type you want to modify table of |
5859 | 5851 | * @param string $targetType target type |
5860 | - * @param string $field field of the type that needs to get the fk |
|
5861 | - * @param string $targetField field where the fk needs to point to |
|
5862 | - * @param integer $buildopt 0 = NO ACTION, 1 = ON DELETE CASCADE |
|
5852 | + * @param string $property |
|
5853 | + * @param string $targetProperty |
|
5863 | 5854 | * |
5864 | 5855 | * @return boolean $didIt |
5865 | 5856 | * |
@@ -5893,6 +5884,7 @@ discard block |
||
5893 | 5884 | |
5894 | 5885 | /** |
5895 | 5886 | * @see AQueryWriter::getKeyMapForType |
5887 | + * @param string $type |
|
5896 | 5888 | */ |
5897 | 5889 | protected function getKeyMapForType( $type ) |
5898 | 5890 | { |
@@ -6710,7 +6702,7 @@ discard block |
||
6710 | 6702 | /** |
6711 | 6703 | * Processes an embedded bean. |
6712 | 6704 | * |
6713 | - * @param OODBBean|SimpleModel $embeddedBean the bean or model |
|
6705 | + * @param OODBBean $embeddedBean the bean or model |
|
6714 | 6706 | * |
6715 | 6707 | * @return integer |
6716 | 6708 | */ |
@@ -6752,7 +6744,6 @@ discard block |
||
6752 | 6744 | * checks if there have been any modification to this bean, in that case |
6753 | 6745 | * the bean is stored once again, otherwise the bean will be left untouched. |
6754 | 6746 | * |
6755 | - * @param OODBBean $bean the bean |
|
6756 | 6747 | * @param array $ownresidue list |
6757 | 6748 | * |
6758 | 6749 | * @return void |
@@ -6943,7 +6934,6 @@ discard block |
||
6943 | 6934 | * |
6944 | 6935 | * @param string $type type of beans you are looking for |
6945 | 6936 | * @param array $conditions list of conditions |
6946 | - * @param string $addSQL SQL to be used in query |
|
6947 | 6937 | * @param array $bindings whether you prefer to use a WHERE clause or not (TRUE = not) |
6948 | 6938 | * |
6949 | 6939 | * @return array |
@@ -7448,7 +7438,7 @@ discard block |
||
7448 | 7438 | * configuration for you. |
7449 | 7439 | * |
7450 | 7440 | * @param string $type type of bean you want to dispense |
7451 | - * @param string $number number of beans you would like to get |
|
7441 | + * @param integer $number number of beans you would like to get |
|
7452 | 7442 | * @param boolean $alwaysReturnArray if TRUE always returns the result as an array |
7453 | 7443 | * |
7454 | 7444 | * @return OODBBean |
@@ -7651,7 +7641,7 @@ discard block |
||
7651 | 7641 | * configuration for you. |
7652 | 7642 | * |
7653 | 7643 | * @param string $type type of bean you want to dispense |
7654 | - * @param string $number number of beans you would like to get |
|
7644 | + * @param integer $number number of beans you would like to get |
|
7655 | 7645 | * @param boolean $alwaysReturnArray if TRUE always returns the result as an array |
7656 | 7646 | * |
7657 | 7647 | * @return OODBBean |
@@ -7846,7 +7836,7 @@ discard block |
||
7846 | 7836 | * Constructor, requires a query writer. |
7847 | 7837 | * |
7848 | 7838 | * @param QueryWriter $writer writer |
7849 | - * @param array|boolean $frozen mode of operation: TRUE (frozen), FALSE (default, fluid) or ARRAY (chilled) |
|
7839 | + * @param boolean $frozen mode of operation: TRUE (frozen), FALSE (default, fluid) or ARRAY (chilled) |
|
7850 | 7840 | */ |
7851 | 7841 | public function __construct( QueryWriter $writer, $frozen = FALSE ) |
7852 | 7842 | { |
@@ -7940,7 +7930,7 @@ discard block |
||
7940 | 7930 | * configuration for you. |
7941 | 7931 | * |
7942 | 7932 | * @param string $type type of bean you want to dispense |
7943 | - * @param string $number number of beans you would like to get |
|
7933 | + * @param integer $number number of beans you would like to get |
|
7944 | 7934 | * @param boolean $alwaysReturnArray if TRUE always returns the result as an array |
7945 | 7935 | * |
7946 | 7936 | * @return OODBBean |
@@ -8014,8 +8004,8 @@ discard block |
||
8014 | 8004 | * |
8015 | 8005 | * @param string $type type of beans you are looking for |
8016 | 8006 | * @param array $conditions list of conditions |
8017 | - * @param string $addSQL SQL to be used in query |
|
8018 | 8007 | * @param array $bindings whether you prefer to use a WHERE clause or not (TRUE = not) |
8008 | + * @param string $sql |
|
8019 | 8009 | * |
8020 | 8010 | * @return array |
8021 | 8011 | * |
@@ -8030,10 +8020,10 @@ discard block |
||
8030 | 8020 | * Same as find() but returns a BeanCollection. |
8031 | 8021 | * |
8032 | 8022 | * @param string $type type of beans you are looking for |
8033 | - * @param string $addSQL SQL to be used in query |
|
8034 | 8023 | * @param array $bindings whether you prefer to use a WHERE clause or not (TRUE = not) |
8024 | + * @param string $sql |
|
8035 | 8025 | * |
8036 | - * @return array |
|
8026 | + * @return BeanCollection |
|
8037 | 8027 | * |
8038 | 8028 | * @throws SQL |
8039 | 8029 | */ |
@@ -8222,7 +8212,6 @@ discard block |
||
8222 | 8212 | * A simple setter function to set the association manager to be used for storage and |
8223 | 8213 | * more. |
8224 | 8214 | * |
8225 | - * @param AssociationManager $assoc sets the association manager to be used |
|
8226 | 8215 | * |
8227 | 8216 | * @return void |
8228 | 8217 | */ |
@@ -8685,7 +8674,6 @@ discard block |
||
8685 | 8674 | * @note instead of an SQL query you can pass a result array as well. |
8686 | 8675 | * |
8687 | 8676 | * @param string|array $types a list of types (either array or comma separated string) |
8688 | - * @param string|array $sqlOrArr an SQL query or an array of prefetched records |
|
8689 | 8677 | * @param array $bindings optional, bindings for SQL query |
8690 | 8678 | * @param array $remappings optional, an array of remapping arrays |
8691 | 8679 | * @param string $queryTemplate optional, query template |
@@ -8936,7 +8924,7 @@ discard block |
||
8936 | 8924 | * two in a link table. Instead of two single beans this method also accepts |
8937 | 8925 | * two sets of beans. Returns the ID or the IDs of the linking beans. |
8938 | 8926 | * |
8939 | - * @param OODBBean|array $beans1 one or more beans to form the association |
|
8927 | + * @param OODBBean $beans1 one or more beans to form the association |
|
8940 | 8928 | * @param OODBBean|array $beans2 one or more beans to form the association |
8941 | 8929 | * |
8942 | 8930 | * @return array |
@@ -8969,7 +8957,7 @@ discard block |
||
8969 | 8957 | * with reference bean(s) $bean. The query can be tuned using an |
8970 | 8958 | * SQL snippet for additional filtering. |
8971 | 8959 | * |
8972 | - * @param OODBBean|array $bean a bean object or an array of beans |
|
8960 | + * @param OODBBean $bean a bean object or an array of beans |
|
8973 | 8961 | * @param string $type type of bean you're interested in |
8974 | 8962 | * @param string $sql SQL snippet (optional) |
8975 | 8963 | * @param array $bindings bindings for your SQL string |
@@ -9010,8 +8998,8 @@ discard block |
||
9010 | 8998 | * set to boolean TRUE this method will remove the beans without their consent, |
9011 | 8999 | * bypassing FUSE. This can be used to improve performance. |
9012 | 9000 | * |
9013 | - * @param OODBBean $bean1 first bean |
|
9014 | - * @param OODBBean $bean2 second bean |
|
9001 | + * @param OODBBean $beans1 first bean |
|
9002 | + * @param OODBBean $beans2 second bean |
|
9015 | 9003 | * @param boolean $fast If TRUE, removes the entries by query without FUSE |
9016 | 9004 | * |
9017 | 9005 | * @return void |
@@ -9093,7 +9081,6 @@ discard block |
||
9093 | 9081 | * @param string $type the type of beans you want |
9094 | 9082 | * @param string $sql SQL snippet for extra filtering |
9095 | 9083 | * @param array $bindings values to be inserted in SQL slots |
9096 | - * @param boolean $glue whether the SQL should be prefixed with WHERE |
|
9097 | 9084 | * |
9098 | 9085 | * @return array |
9099 | 9086 | */ |
@@ -10337,7 +10324,6 @@ discard block |
||
10337 | 10324 | * Let's call this chilly mode, it's just like fluid mode except that |
10338 | 10325 | * certain types (i.e. tables) aren't touched. |
10339 | 10326 | * |
10340 | - * @param boolean|array $trueFalse |
|
10341 | 10327 | */ |
10342 | 10328 | public static function freeze( $tf = TRUE ) |
10343 | 10329 | { |
@@ -10412,7 +10398,6 @@ discard block |
||
10412 | 10398 | * in the latter case this method will attempt to load the specified bean |
10413 | 10399 | * and THEN trash it. |
10414 | 10400 | * |
10415 | - * @param string|OODBBean|SimpleModel $bean bean you want to remove from database |
|
10416 | 10401 | * @param integer $id (optional) |
10417 | 10402 | * |
10418 | 10403 | * @return void |
@@ -10428,7 +10413,6 @@ discard block |
||
10428 | 10413 | * the rest of the methods. |
10429 | 10414 | * |
10430 | 10415 | * @param string|array $typeOrBeanArray type or bean array to import |
10431 | - * @param integer $number number of beans to dispense |
|
10432 | 10416 | * @param boolean $alwaysReturnArray if TRUE always returns the result as an array |
10433 | 10417 | * |
10434 | 10418 | * @return array|OODBBean |
@@ -10630,7 +10614,6 @@ discard block |
||
10630 | 10614 | * @see Finder::findMulti() |
10631 | 10615 | * |
10632 | 10616 | * @param array|string $types a list of bean types to find |
10633 | - * @param string|array $sqlOrArr SQL query string or result set array |
|
10634 | 10617 | * @param array $bindings SQL bindings |
10635 | 10618 | * @param array $remappings An array of remapping arrays containing closures |
10636 | 10619 | * |
@@ -10787,7 +10770,7 @@ discard block |
||
10787 | 10770 | * Returns the insert ID for databases that support/require this |
10788 | 10771 | * functionality. Alias for R::getAdapter()->getInsertID(). |
10789 | 10772 | * |
10790 | - * @return mixed |
|
10773 | + * @return integer |
|
10791 | 10774 | */ |
10792 | 10775 | public static function getInsertID() |
10793 | 10776 | { |
@@ -10816,9 +10799,8 @@ discard block |
||
10816 | 10799 | * @param OODBBean $bean bean to be copied |
10817 | 10800 | * @param array $trail for internal usage, pass array() |
10818 | 10801 | * @param boolean $pid for internal usage |
10819 | - * @param array $white white list filter with bean types to duplicate |
|
10820 | 10802 | * |
10821 | - * @return array |
|
10803 | + * @return OODBBean |
|
10822 | 10804 | */ |
10823 | 10805 | public static function dup( $bean, $trail = array(), $pid = FALSE, $filters = array() ) |
10824 | 10806 | { |
@@ -10846,9 +10828,8 @@ discard block |
||
10846 | 10828 | * This is a simplified version of the deprecated R::dup() function. |
10847 | 10829 | * |
10848 | 10830 | * @param OODBBean $bean bean to be copied |
10849 | - * @param array $white white list filter with bean types to duplicate |
|
10850 | 10831 | * |
10851 | - * @return array |
|
10832 | + * @return OODBBean |
|
10852 | 10833 | */ |
10853 | 10834 | public static function duplicate( $bean, $filters = array() ) |
10854 | 10835 | { |
@@ -11926,7 +11907,7 @@ discard block |
||
11926 | 11907 | * |
11927 | 11908 | * @param string $typeName bean type name |
11928 | 11909 | * |
11929 | - * @return array |
|
11910 | + * @return string[] |
|
11930 | 11911 | */ |
11931 | 11912 | private function getListNames( $typeName ) |
11932 | 11913 | { |
@@ -82,7 +82,9 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function log() |
84 | 84 | { |
85 | - if ( func_num_args() < 1 ) return; |
|
85 | + if ( func_num_args() < 1 ) { |
|
86 | + return; |
|
87 | + } |
|
86 | 88 | |
87 | 89 | foreach ( func_get_args() as $argument ) { |
88 | 90 | if ( is_array( $argument ) ) { |
@@ -100,7 +102,9 @@ discard block |
||
100 | 102 | } |
101 | 103 | } |
102 | 104 | |
103 | - if ( $this->mode === self::C_LOGGER_ECHO ) echo "<br>\n"; |
|
105 | + if ( $this->mode === self::C_LOGGER_ECHO ) { |
|
106 | + echo "<br>\n"; |
|
107 | + } |
|
104 | 108 | } |
105 | 109 | } |
106 | 110 | |
@@ -161,7 +165,9 @@ discard block |
||
161 | 165 | { |
162 | 166 | $found = array(); |
163 | 167 | foreach( $this->logs as $logEntry ) { |
164 | - if ( strpos( $logEntry, $needle ) !== FALSE ) $found[] = $logEntry; |
|
168 | + if ( strpos( $logEntry, $needle ) !== FALSE ) { |
|
169 | + $found[] = $logEntry; |
|
170 | + } |
|
165 | 171 | } |
166 | 172 | return $found; |
167 | 173 | } |
@@ -231,7 +237,9 @@ discard block |
||
231 | 237 | */ |
232 | 238 | protected function fillInValue( $value ) |
233 | 239 | { |
234 | - if ( is_null( $value ) ) $value = 'NULL'; |
|
240 | + if ( is_null( $value ) ) { |
|
241 | + $value = 'NULL'; |
|
242 | + } |
|
235 | 243 | |
236 | 244 | $value = strval( $value ); |
237 | 245 | if ( strlen( $value ) > ( $this->strLen ) ) { |
@@ -257,7 +265,9 @@ discard block |
||
257 | 265 | protected function output( $str ) |
258 | 266 | { |
259 | 267 | $this->logs[] = $str; |
260 | - if ( !$this->mode ) echo $str .'<br />'; |
|
268 | + if ( !$this->mode ) { |
|
269 | + echo $str .'<br />'; |
|
270 | + } |
|
261 | 271 | } |
262 | 272 | |
263 | 273 | /** |
@@ -317,7 +327,9 @@ discard block |
||
317 | 327 | */ |
318 | 328 | public function log() |
319 | 329 | { |
320 | - if ( func_num_args() < 1 ) return; |
|
330 | + if ( func_num_args() < 1 ) { |
|
331 | + return; |
|
332 | + } |
|
321 | 333 | |
322 | 334 | $sql = func_get_arg( 0 ); |
323 | 335 | |
@@ -684,7 +696,9 @@ discard block |
||
684 | 696 | //Unfortunately the code field is supposed to be int by default (php) |
685 | 697 | //So we need a property to convey the SQL State code. |
686 | 698 | $err = $e->getMessage(); |
687 | - if ( $this->loggingEnabled && $this->logger ) $this->logger->log( 'An error occurred: ' . $err ); |
|
699 | + if ( $this->loggingEnabled && $this->logger ) { |
|
700 | + $this->logger->log( 'An error occurred: ' . $err ); |
|
701 | + } |
|
688 | 702 | $exception = new SQL( $err, 0 ); |
689 | 703 | $exception->setSQLState( $e->getCode() ); |
690 | 704 | throw $exception; |
@@ -784,7 +798,9 @@ discard block |
||
784 | 798 | */ |
785 | 799 | public function connect() |
786 | 800 | { |
787 | - if ( $this->isConnected ) return; |
|
801 | + if ( $this->isConnected ) { |
|
802 | + return; |
|
803 | + } |
|
788 | 804 | try { |
789 | 805 | $user = $this->connectInfo['user']; |
790 | 806 | $pass = $this->connectInfo['pass']; |
@@ -865,11 +881,19 @@ discard block |
||
865 | 881 | { |
866 | 882 | $arr = $this->GetAll( $sql, $bindings ); |
867 | 883 | $res = NULL; |
868 | - if ( !is_array( $arr ) ) return NULL; |
|
869 | - if ( count( $arr ) === 0 ) return NULL; |
|
884 | + if ( !is_array( $arr ) ) { |
|
885 | + return NULL; |
|
886 | + } |
|
887 | + if ( count( $arr ) === 0 ) { |
|
888 | + return NULL; |
|
889 | + } |
|
870 | 890 | $row1 = array_shift( $arr ); |
871 | - if ( !is_array( $row1 ) ) return NULL; |
|
872 | - if ( count( $row1 ) === 0 ) return NULL; |
|
891 | + if ( !is_array( $row1 ) ) { |
|
892 | + return NULL; |
|
893 | + } |
|
894 | + if ( count( $row1 ) === 0 ) { |
|
895 | + return NULL; |
|
896 | + } |
|
873 | 897 | $col1 = array_shift( $row1 ); |
874 | 898 | return $col1; |
875 | 899 | } |
@@ -1205,7 +1229,9 @@ discard block |
||
1205 | 1229 | && $mode !== self::C_ERR_EXCEPTION |
1206 | 1230 | && $mode !== self::C_ERR_FUNC |
1207 | 1231 | && $mode !== self::C_ERR_FATAL |
1208 | - ) throw new \Exception( 'Invalid error mode selected' ); |
|
1232 | + ) { |
|
1233 | + throw new \Exception( 'Invalid error mode selected' ); |
|
1234 | + } |
|
1209 | 1235 | |
1210 | 1236 | if ( $mode === self::C_ERR_FUNC && !is_callable( $func ) ) { |
1211 | 1237 | throw new \Exception( 'Invalid error handler' ); |
@@ -1322,7 +1348,9 @@ discard block |
||
1322 | 1348 | public static function setMetaAll( $beans, $property, $value ) |
1323 | 1349 | { |
1324 | 1350 | foreach( $beans as $bean ) { |
1325 | - if ( $bean instanceof OODBBean ) $bean->__info[ $property ] = $value; |
|
1351 | + if ( $bean instanceof OODBBean ) { |
|
1352 | + $bean->__info[ $property ] = $value; |
|
1353 | + } |
|
1326 | 1354 | } |
1327 | 1355 | |
1328 | 1356 | return $beans; |
@@ -1645,7 +1673,9 @@ discard block |
||
1645 | 1673 | |
1646 | 1674 | if ( $parents ) { |
1647 | 1675 | foreach ( $this as $key => $value ) { |
1648 | - if ( substr( $key, -3 ) != '_id' ) continue; |
|
1676 | + if ( substr( $key, -3 ) != '_id' ) { |
|
1677 | + continue; |
|
1678 | + } |
|
1649 | 1679 | |
1650 | 1680 | $prop = substr( $key, 0, strlen( $key ) - 3 ); |
1651 | 1681 | $this->$prop; |
@@ -1659,13 +1689,17 @@ discard block |
||
1659 | 1689 | $vn = array(); |
1660 | 1690 | |
1661 | 1691 | foreach ( $value as $i => $b ) { |
1662 | - if ( !( $b instanceof OODBBean ) ) continue; |
|
1692 | + if ( !( $b instanceof OODBBean ) ) { |
|
1693 | + continue; |
|
1694 | + } |
|
1663 | 1695 | $vn[] = $b->export( $meta, FALSE, FALSE, $filters ); |
1664 | 1696 | $value = $vn; |
1665 | 1697 | } |
1666 | 1698 | } elseif ( $value instanceof OODBBean ) { |
1667 | 1699 | if ( $hasFilters ) { |
1668 | - if ( !in_array( strtolower( $value->getMeta( 'type' ) ), $filters ) ) continue; |
|
1700 | + if ( !in_array( strtolower( $value->getMeta( 'type' ) ), $filters ) ) { |
|
1701 | + continue; |
|
1702 | + } |
|
1669 | 1703 | } |
1670 | 1704 | |
1671 | 1705 | $value = $value->export( $meta, $parents, FALSE, $filters ); |
@@ -1728,7 +1762,9 @@ discard block |
||
1728 | 1762 | unset( $this->properties[$property] ); |
1729 | 1763 | |
1730 | 1764 | $shadowKey = 'sys.shadow.'.$property; |
1731 | - if ( isset( $this->__info[ $shadowKey ] ) ) unset( $this->__info[$shadowKey] ); |
|
1765 | + if ( isset( $this->__info[ $shadowKey ] ) ) { |
|
1766 | + unset( $this->__info[$shadowKey] ); |
|
1767 | + } |
|
1732 | 1768 | |
1733 | 1769 | //also clear modifiers |
1734 | 1770 | $this->withSql = ''; |
@@ -1895,7 +1931,9 @@ discard block |
||
1895 | 1931 | { |
1896 | 1932 | static $beautifulColumns = array(); |
1897 | 1933 | |
1898 | - if ( ctype_lower( $property ) ) return $property; |
|
1934 | + if ( ctype_lower( $property ) ) { |
|
1935 | + return $property; |
|
1936 | + } |
|
1899 | 1937 | |
1900 | 1938 | if ( |
1901 | 1939 | ( strpos( $property, 'own' ) === 0 && ctype_upper( substr( $property, 3, 1 ) ) ) |
@@ -2479,7 +2517,9 @@ discard block |
||
2479 | 2517 | } |
2480 | 2518 | |
2481 | 2519 | if ( !is_null( $maxDepth ) ) { |
2482 | - if ( !$maxDepth-- ) return $this; |
|
2520 | + if ( !$maxDepth-- ) { |
|
2521 | + return $this; |
|
2522 | + } |
|
2483 | 2523 | } |
2484 | 2524 | |
2485 | 2525 | $oldFetchType = $this->fetchType; |
@@ -2489,9 +2529,13 @@ discard block |
||
2489 | 2529 | |
2490 | 2530 | $beans = $this->$property; |
2491 | 2531 | |
2492 | - if ( $beans === NULL ) return $this; |
|
2532 | + if ( $beans === NULL ) { |
|
2533 | + return $this; |
|
2534 | + } |
|
2493 | 2535 | |
2494 | - if ( !is_array( $beans ) ) $beans = array( $beans ); |
|
2536 | + if ( !is_array( $beans ) ) { |
|
2537 | + $beans = array( $beans ); |
|
2538 | + } |
|
2495 | 2539 | |
2496 | 2540 | foreach( $beans as $bean ) { |
2497 | 2541 | |
@@ -2641,11 +2685,17 @@ discard block |
||
2641 | 2685 | */ |
2642 | 2686 | public function hasListChanged( $property ) |
2643 | 2687 | { |
2644 | - if ( !array_key_exists( $property, $this->properties ) ) return FALSE; |
|
2688 | + if ( !array_key_exists( $property, $this->properties ) ) { |
|
2689 | + return FALSE; |
|
2690 | + } |
|
2645 | 2691 | $diffAdded = array_diff_assoc( $this->properties[$property], $this->__info['sys.shadow.'.$property] ); |
2646 | - if ( count( $diffAdded ) ) return TRUE; |
|
2692 | + if ( count( $diffAdded ) ) { |
|
2693 | + return TRUE; |
|
2694 | + } |
|
2647 | 2695 | $diffMissing = array_diff_assoc( $this->__info['sys.shadow.'.$property], $this->properties[$property] ); |
2648 | - if ( count( $diffMissing ) ) return TRUE; |
|
2696 | + if ( count( $diffMissing ) ) { |
|
2697 | + return TRUE; |
|
2698 | + } |
|
2649 | 2699 | return FALSE; |
2650 | 2700 | } |
2651 | 2701 | |
@@ -2856,11 +2906,19 @@ discard block |
||
2856 | 2906 | $this->via = NULL; |
2857 | 2907 | $ids = $beanIndex = $references = array(); |
2858 | 2908 | |
2859 | - if ( strlen( $list ) < 4 ) throw new RedException('Invalid own-list.'); |
|
2860 | - if ( strpos( $list, 'own') !== 0 ) throw new RedException('Only own-lists can be aggregated.'); |
|
2861 | - if ( !ctype_upper( substr( $list, 3, 1 ) ) ) throw new RedException('Invalid own-list.'); |
|
2909 | + if ( strlen( $list ) < 4 ) { |
|
2910 | + throw new RedException('Invalid own-list.'); |
|
2911 | + } |
|
2912 | + if ( strpos( $list, 'own') !== 0 ) { |
|
2913 | + throw new RedException('Only own-lists can be aggregated.'); |
|
2914 | + } |
|
2915 | + if ( !ctype_upper( substr( $list, 3, 1 ) ) ) { |
|
2916 | + throw new RedException('Invalid own-list.'); |
|
2917 | + } |
|
2862 | 2918 | |
2863 | - if ( is_null( $type ) ) $type = $property; |
|
2919 | + if ( is_null( $type ) ) { |
|
2920 | + $type = $property; |
|
2921 | + } |
|
2864 | 2922 | |
2865 | 2923 | foreach( $this->$list as $bean ) { |
2866 | 2924 | $field = $property . '_id'; |
@@ -3320,7 +3378,9 @@ discard block |
||
3320 | 3378 | } |
3321 | 3379 | |
3322 | 3380 | foreach ( $rows as $row ) { |
3323 | - if ( empty( $row ) ) continue; |
|
3381 | + if ( empty( $row ) ) { |
|
3382 | + continue; |
|
3383 | + } |
|
3324 | 3384 | |
3325 | 3385 | if ( count( $row ) > 2 ) { |
3326 | 3386 | $key = array_shift( $row ); |
@@ -3357,7 +3417,9 @@ discard block |
||
3357 | 3417 | { |
3358 | 3418 | $this->sql = $sql; |
3359 | 3419 | |
3360 | - if ( !$noSignal ) $this->signal( 'sql_exec', $this ); |
|
3420 | + if ( !$noSignal ) { |
|
3421 | + $this->signal( 'sql_exec', $this ); |
|
3422 | + } |
|
3361 | 3423 | |
3362 | 3424 | return $this->db->GetOne( $sql, $bindings ); |
3363 | 3425 | } |
@@ -4257,7 +4319,9 @@ discard block |
||
4257 | 4319 | public static function renameAssociation( $from, $to = NULL ) |
4258 | 4320 | { |
4259 | 4321 | if ( is_array( $from ) ) { |
4260 | - foreach ( $from as $key => $value ) self::$renames[$key] = $value; |
|
4322 | + foreach ( $from as $key => $value ) { |
|
4323 | + self::$renames[$key] = $value; |
|
4324 | + } |
|
4261 | 4325 | |
4262 | 4326 | return; |
4263 | 4327 | } |
@@ -4438,7 +4502,9 @@ discard block |
||
4438 | 4502 | private function putResultInCache( $cacheTag, $key, $values ) |
4439 | 4503 | { |
4440 | 4504 | if ( isset( $this->cache[$cacheTag] ) ) { |
4441 | - if ( count( $this->cache[$cacheTag] ) > $this->maxCacheSizePerType ) array_shift( $this->cache[$cacheTag] ); |
|
4505 | + if ( count( $this->cache[$cacheTag] ) > $this->maxCacheSizePerType ) { |
|
4506 | + array_shift( $this->cache[$cacheTag] ); |
|
4507 | + } |
|
4442 | 4508 | } else { |
4443 | 4509 | $this->cache[$cacheTag] = array(); |
4444 | 4510 | } |
@@ -4470,12 +4536,16 @@ discard block |
||
4470 | 4536 | |
4471 | 4537 | $sqlConditions = array(); |
4472 | 4538 | foreach ( $conditions as $column => $values ) { |
4473 | - if ( !count( $values ) ) continue; |
|
4539 | + if ( !count( $values ) ) { |
|
4540 | + continue; |
|
4541 | + } |
|
4474 | 4542 | |
4475 | 4543 | $sql = $this->esc( $column ); |
4476 | 4544 | $sql .= ' IN ( '; |
4477 | 4545 | |
4478 | - if ( !is_array( $values ) ) $values = array( $values ); |
|
4546 | + if ( !is_array( $values ) ) { |
|
4547 | + $values = array( $values ); |
|
4548 | + } |
|
4479 | 4549 | |
4480 | 4550 | // If it's safe to skip bindings, do so... |
4481 | 4551 | if ( ctype_digit( implode( '', $values ) ) ) { |
@@ -4516,7 +4586,9 @@ discard block |
||
4516 | 4586 | $sql = implode( ' AND ', $sqlConditions ); |
4517 | 4587 | $sql = " WHERE ( $sql ) "; |
4518 | 4588 | |
4519 | - if ( $addSql ) $sql .= $addSql; |
|
4589 | + if ( $addSql ) { |
|
4590 | + $sql .= $addSql; |
|
4591 | + } |
|
4520 | 4592 | } elseif ( $addSql ) { |
4521 | 4593 | $sql = $addSql; |
4522 | 4594 | } |
@@ -4570,7 +4642,9 @@ discard block |
||
4570 | 4642 | } |
4571 | 4643 | |
4572 | 4644 | foreach( $map as $key ) { |
4573 | - if ( $key['from'] === $property ) return $key; |
|
4645 | + if ( $key['from'] === $property ) { |
|
4646 | + return $key; |
|
4647 | + } |
|
4574 | 4648 | } |
4575 | 4649 | return NULL; |
4576 | 4650 | } |
@@ -4781,7 +4855,9 @@ discard block |
||
4781 | 4855 | $result = $this->adapter->getCell( "INSERT INTO $table (id) VALUES($default) $suffix" ); |
4782 | 4856 | } |
4783 | 4857 | |
4784 | - if ( $suffix ) return $result; |
|
4858 | + if ( $suffix ) { |
|
4859 | + return $result; |
|
4860 | + } |
|
4785 | 4861 | |
4786 | 4862 | $last_id = $this->adapter->getInsertID(); |
4787 | 4863 | |
@@ -4939,8 +5015,9 @@ discard block |
||
4939 | 5015 | */ |
4940 | 5016 | public function writeJoin( $type, $targetType, $leftRight = 'LEFT' ) |
4941 | 5017 | { |
4942 | - if ( $leftRight !== 'LEFT' && $leftRight !== 'RIGHT' && $leftRight !== 'INNER' ) |
|
4943 | - throw new RedException( 'Invalid JOIN.' ); |
|
5018 | + if ( $leftRight !== 'LEFT' && $leftRight !== 'RIGHT' && $leftRight !== 'INNER' ) { |
|
5019 | + throw new RedException( 'Invalid JOIN.' ); |
|
5020 | + } |
|
4944 | 5021 | |
4945 | 5022 | $table = $this->esc( $type ); |
4946 | 5023 | $targetTable = $this->esc( $targetType ); |
@@ -5209,7 +5286,9 @@ discard block |
||
5209 | 5286 | */ |
5210 | 5287 | public function widenColumn( $type, $property, $dataType ) |
5211 | 5288 | { |
5212 | - if ( !isset($this->typeno_sqltype[$dataType]) ) return FALSE; |
|
5289 | + if ( !isset($this->typeno_sqltype[$dataType]) ) { |
|
5290 | + return FALSE; |
|
5291 | + } |
|
5213 | 5292 | |
5214 | 5293 | $table = $this->esc( $type ); |
5215 | 5294 | $column = $this->esc( $property ); |
@@ -5316,7 +5395,9 @@ discard block |
||
5316 | 5395 | foreach( $keys as $key ) { |
5317 | 5396 | if ( |
5318 | 5397 | $key['from'] === $field |
5319 | - ) return $key['table']; |
|
5398 | + ) { |
|
5399 | + return $key['table']; |
|
5400 | + } |
|
5320 | 5401 | } |
5321 | 5402 | return NULL; |
5322 | 5403 | } |
@@ -5512,8 +5593,12 @@ discard block |
||
5512 | 5593 | { |
5513 | 5594 | $this->svalue = $value; |
5514 | 5595 | |
5515 | - if ( is_null( $value ) ) return MySQL::C_DATATYPE_BOOL; |
|
5516 | - if ( $value === INF ) return MySQL::C_DATATYPE_TEXT7; |
|
5596 | + if ( is_null( $value ) ) { |
|
5597 | + return MySQL::C_DATATYPE_BOOL; |
|
5598 | + } |
|
5599 | + if ( $value === INF ) { |
|
5600 | + return MySQL::C_DATATYPE_TEXT7; |
|
5601 | + } |
|
5517 | 5602 | |
5518 | 5603 | if ( $flagSpecial ) { |
5519 | 5604 | if ( preg_match( '/^\d{4}\-\d\d-\d\d$/', $value ) ) { |
@@ -5538,7 +5623,9 @@ discard block |
||
5538 | 5623 | return MySQL::C_DATATYPE_BOOL; |
5539 | 5624 | } |
5540 | 5625 | |
5541 | - if ( is_float( $value ) ) return self::C_DATATYPE_DOUBLE; |
|
5626 | + if ( is_float( $value ) ) { |
|
5627 | + return self::C_DATATYPE_DOUBLE; |
|
5628 | + } |
|
5542 | 5629 | |
5543 | 5630 | if ( !$this->startsWithZeros( $value ) ) { |
5544 | 5631 | |
@@ -5595,7 +5682,9 @@ discard block |
||
5595 | 5682 | { |
5596 | 5683 | $tableNoQ = $this->esc( $type, TRUE ); |
5597 | 5684 | $columns = array(); |
5598 | - foreach( $properties as $key => $column ) $columns[$key] = $this->esc( $column ); |
|
5685 | + foreach( $properties as $key => $column ) { |
|
5686 | + $columns[$key] = $this->esc( $column ); |
|
5687 | + } |
|
5599 | 5688 | $table = $this->esc( $type ); |
5600 | 5689 | sort( $columns ); // Else we get multiple indexes due to order-effects |
5601 | 5690 | $name = 'UQ_' . sha1( implode( ',', $columns ) ); |
@@ -5640,7 +5729,9 @@ discard block |
||
5640 | 5729 | $targetFieldNoQ = $this->esc( $targetProperty, TRUE ); |
5641 | 5730 | $tableNoQ = $this->esc( $type, TRUE ); |
5642 | 5731 | $fieldNoQ = $this->esc( $property, TRUE ); |
5643 | - if ( !is_null( $this->getForeignKeyForTypeProperty( $tableNoQ, $fieldNoQ ) ) ) return FALSE; |
|
5732 | + if ( !is_null( $this->getForeignKeyForTypeProperty( $tableNoQ, $fieldNoQ ) ) ) { |
|
5733 | + return FALSE; |
|
5734 | + } |
|
5644 | 5735 | |
5645 | 5736 | //Widen the column if it's incapable of representing a foreign key (at least INT). |
5646 | 5737 | $columns = $this->getColumns( $tableNoQ ); |
@@ -5792,7 +5883,9 @@ discard block |
||
5792 | 5883 | |
5793 | 5884 | $oldColumnNames = array_keys( $this->getColumns( $table ) ); |
5794 | 5885 | |
5795 | - foreach ( $oldColumnNames as $k => $v ) $oldColumnNames[$k] = "`$v`"; |
|
5886 | + foreach ( $oldColumnNames as $k => $v ) { |
|
5887 | + $oldColumnNames[$k] = "`$v`"; |
|
5888 | + } |
|
5796 | 5889 | |
5797 | 5890 | $q[] = "CREATE TEMPORARY TABLE tmp_backup(" . implode( ",", $oldColumnNames ) . ");"; |
5798 | 5891 | $q[] = "INSERT INTO tmp_backup SELECT * FROM `$table`;"; |
@@ -5818,16 +5911,22 @@ discard block |
||
5818 | 5911 | foreach ( $tableMap['indexes'] as $name => $index ) { |
5819 | 5912 | if ( strpos( $name, 'UQ_' ) === 0 ) { |
5820 | 5913 | $cols = explode( '__', substr( $name, strlen( 'UQ_' . $table ) ) ); |
5821 | - foreach ( $cols as $k => $v ) $cols[$k] = "`$v`"; |
|
5914 | + foreach ( $cols as $k => $v ) { |
|
5915 | + $cols[$k] = "`$v`"; |
|
5916 | + } |
|
5822 | 5917 | $q[] = "CREATE UNIQUE INDEX $name ON `$table` (" . implode( ',', $cols ) . ")"; |
5823 | - } else $q[] = "CREATE INDEX $name ON `$table` ({$index['name']}) "; |
|
5918 | + } else { |
|
5919 | + $q[] = "CREATE INDEX $name ON `$table` ({$index['name']}) "; |
|
5920 | + } |
|
5824 | 5921 | } |
5825 | 5922 | |
5826 | 5923 | $q[] = "INSERT INTO `$table` SELECT * FROM tmp_backup;"; |
5827 | 5924 | $q[] = "DROP TABLE tmp_backup;"; |
5828 | 5925 | $q[] = "PRAGMA foreign_keys = 1 "; |
5829 | 5926 | |
5830 | - foreach ( $q as $sq ) $this->adapter->exec( $sq ); |
|
5927 | + foreach ( $q as $sq ) { |
|
5928 | + $this->adapter->exec( $sq ); |
|
5929 | + } |
|
5831 | 5930 | } |
5832 | 5931 | |
5833 | 5932 | /** |
@@ -5874,9 +5973,13 @@ discard block |
||
5874 | 5973 | $targetColumn = $this->esc( $targetProperty, TRUE ); |
5875 | 5974 | |
5876 | 5975 | $tables = $this->getTables(); |
5877 | - if ( !in_array( $targetTable, $tables ) ) return FALSE; |
|
5976 | + if ( !in_array( $targetTable, $tables ) ) { |
|
5977 | + return FALSE; |
|
5978 | + } |
|
5878 | 5979 | |
5879 | - if ( !is_null( $this->getForeignKeyForTypeProperty( $table, $column ) ) ) return FALSE; |
|
5980 | + if ( !is_null( $this->getForeignKeyForTypeProperty( $table, $column ) ) ) { |
|
5981 | + return FALSE; |
|
5982 | + } |
|
5880 | 5983 | $t = $this->getTable( $table ); |
5881 | 5984 | $consSQL = ( $constraint ? 'CASCADE' : 'SET NULL' ); |
5882 | 5985 | $label = 'from_' . $column . '_to_table_' . $targetTable . '_col_' . $targetColumn; |
@@ -5953,14 +6056,24 @@ discard block |
||
5953 | 6056 | { |
5954 | 6057 | $this->svalue = $value; |
5955 | 6058 | |
5956 | - if ( $value === NULL ) return self::C_DATATYPE_INTEGER; |
|
5957 | - if ( $value === INF ) return self::C_DATATYPE_TEXT; |
|
6059 | + if ( $value === NULL ) { |
|
6060 | + return self::C_DATATYPE_INTEGER; |
|
6061 | + } |
|
6062 | + if ( $value === INF ) { |
|
6063 | + return self::C_DATATYPE_TEXT; |
|
6064 | + } |
|
5958 | 6065 | |
5959 | - if ( $this->startsWithZeros( $value ) ) return self::C_DATATYPE_TEXT; |
|
6066 | + if ( $this->startsWithZeros( $value ) ) { |
|
6067 | + return self::C_DATATYPE_TEXT; |
|
6068 | + } |
|
5960 | 6069 | |
5961 | - if ( $value === TRUE || $value === FALSE ) return self::C_DATATYPE_INTEGER; |
|
6070 | + if ( $value === TRUE || $value === FALSE ) { |
|
6071 | + return self::C_DATATYPE_INTEGER; |
|
6072 | + } |
|
5962 | 6073 | |
5963 | - if ( is_numeric( $value ) && ( intval( $value ) == $value ) && $value < 2147483648 && $value > -2147483648 ) return self::C_DATATYPE_INTEGER; |
|
6074 | + if ( is_numeric( $value ) && ( intval( $value ) == $value ) && $value < 2147483648 && $value > -2147483648 ) { |
|
6075 | + return self::C_DATATYPE_INTEGER; |
|
6076 | + } |
|
5964 | 6077 | |
5965 | 6078 | if ( ( is_numeric( $value ) && $value < 2147483648 && $value > -2147483648) |
5966 | 6079 | || preg_match( '/\d{4}\-\d\d\-\d\d/', $value ) |
@@ -6037,7 +6150,9 @@ discard block |
||
6037 | 6150 | $columnsRaw = $this->adapter->get( "PRAGMA table_info('$table')" ); |
6038 | 6151 | |
6039 | 6152 | $columns = array(); |
6040 | - foreach ( $columnsRaw as $r ) $columns[$r['name']] = $r['type']; |
|
6153 | + foreach ( $columnsRaw as $r ) { |
|
6154 | + $columns[$r['name']] = $r['type']; |
|
6155 | + } |
|
6041 | 6156 | |
6042 | 6157 | return $columns; |
6043 | 6158 | } |
@@ -6078,7 +6193,9 @@ discard block |
||
6078 | 6193 | public function addIndex( $type, $name, $column ) |
6079 | 6194 | { |
6080 | 6195 | $columns = $this->getColumns( $type ); |
6081 | - if ( !isset( $columns[$column] ) ) return FALSE; |
|
6196 | + if ( !isset( $columns[$column] ) ) { |
|
6197 | + return FALSE; |
|
6198 | + } |
|
6082 | 6199 | |
6083 | 6200 | $table = $this->esc( $type ); |
6084 | 6201 | $name = preg_replace( '/\W/', '', $name ); |
@@ -6337,7 +6454,9 @@ discard block |
||
6337 | 6454 | { |
6338 | 6455 | $this->svalue = $value; |
6339 | 6456 | |
6340 | - if ( $value === INF ) return self::C_DATATYPE_TEXT; |
|
6457 | + if ( $value === INF ) { |
|
6458 | + return self::C_DATATYPE_TEXT; |
|
6459 | + } |
|
6341 | 6460 | |
6342 | 6461 | if ( $flagSpecial && $value ) { |
6343 | 6462 | if ( preg_match( '/^\d{4}\-\d\d-\d\d$/', $value ) ) { |
@@ -6369,9 +6488,13 @@ discard block |
||
6369 | 6488 | } |
6370 | 6489 | } |
6371 | 6490 | |
6372 | - if ( is_float( $value ) ) return self::C_DATATYPE_DOUBLE; |
|
6491 | + if ( is_float( $value ) ) { |
|
6492 | + return self::C_DATATYPE_DOUBLE; |
|
6493 | + } |
|
6373 | 6494 | |
6374 | - if ( $this->startsWithZeros( $value ) ) return self::C_DATATYPE_TEXT; |
|
6495 | + if ( $this->startsWithZeros( $value ) ) { |
|
6496 | + return self::C_DATATYPE_TEXT; |
|
6497 | + } |
|
6375 | 6498 | |
6376 | 6499 | if ( $value === FALSE || $value === TRUE || $value === NULL || ( is_numeric( $value ) |
6377 | 6500 | && AQueryWriter::canBeTreatedAsInt( $value ) |
@@ -6393,7 +6516,9 @@ discard block |
||
6393 | 6516 | { |
6394 | 6517 | $r = ( isset( $this->sqltype_typeno[$typedescription] ) ) ? $this->sqltype_typeno[$typedescription] : 99; |
6395 | 6518 | |
6396 | - if ( $includeSpecials ) return $r; |
|
6519 | + if ( $includeSpecials ) { |
|
6520 | + return $r; |
|
6521 | + } |
|
6397 | 6522 | |
6398 | 6523 | if ( $r >= QueryWriter::C_DATATYPE_RANGE_SPECIAL ) { |
6399 | 6524 | return self::C_DATATYPE_SPECIFIED; |
@@ -6425,7 +6550,9 @@ discard block |
||
6425 | 6550 | { |
6426 | 6551 | $tableNoQ = $this->esc( $type, TRUE ); |
6427 | 6552 | $columns = array(); |
6428 | - foreach( $properties as $key => $column ) $columns[$key] = $this->esc( $column ); |
|
6553 | + foreach( $properties as $key => $column ) { |
|
6554 | + $columns[$key] = $this->esc( $column ); |
|
6555 | + } |
|
6429 | 6556 | $table = $this->esc( $type ); |
6430 | 6557 | sort( $columns ); //else we get multiple indexes due to order-effects |
6431 | 6558 | $name = "UQ_" . sha1( $table . implode( ',', $columns ) ); |
@@ -6481,7 +6608,9 @@ discard block |
||
6481 | 6608 | $targetField = $this->esc( $targetProperty ); |
6482 | 6609 | $tableNoQ = $this->esc( $type, TRUE ); |
6483 | 6610 | $fieldNoQ = $this->esc( $property, TRUE ); |
6484 | - if ( !is_null( $this->getForeignKeyForTypeProperty( $tableNoQ, $fieldNoQ ) ) ) return FALSE; |
|
6611 | + if ( !is_null( $this->getForeignKeyForTypeProperty( $tableNoQ, $fieldNoQ ) ) ) { |
|
6612 | + return FALSE; |
|
6613 | + } |
|
6485 | 6614 | try{ |
6486 | 6615 | $delRule = ( $isDep ? 'CASCADE' : 'SET NULL' ); |
6487 | 6616 | $this->adapter->exec( "ALTER TABLE {$table} |
@@ -6787,7 +6916,9 @@ discard block |
||
6787 | 6916 | |
6788 | 6917 | $myFieldLink = $bean->getMeta( 'type' ) . '_id'; |
6789 | 6918 | $alias = $bean->getMeta( 'sys.alias.' . $trash->getMeta( 'type' ) ); |
6790 | - if ( $alias ) $myFieldLink = $alias . '_id'; |
|
6919 | + if ( $alias ) { |
|
6920 | + $myFieldLink = $alias . '_id'; |
|
6921 | + } |
|
6791 | 6922 | |
6792 | 6923 | if ( $trash->getMeta( 'sys.garbage' ) === true ) { |
6793 | 6924 | $this->trash( $trash ); |
@@ -6864,7 +6995,9 @@ discard block |
||
6864 | 6995 | { |
6865 | 6996 | $linkField = $property . '_id'; |
6866 | 6997 | $id = $this->prepareEmbeddedBean( $value ); |
6867 | - if ($bean->$linkField != $id) $bean->$linkField = $id; |
|
6998 | + if ($bean->$linkField != $id) { |
|
6999 | + $bean->$linkField = $id; |
|
7000 | + } |
|
6868 | 7001 | $bean->setMeta( 'cast.' . $linkField, 'id' ); |
6869 | 7002 | $embeddedBeans[$linkField] = $value; |
6870 | 7003 | unset( $bean->$property ); |
@@ -7367,7 +7500,9 @@ discard block |
||
7367 | 7500 | |
7368 | 7501 | $myFieldLink = $beanType . '_id'; |
7369 | 7502 | $alias = $bean->getMeta( 'sys.alias.' . $addition->getMeta( 'type' ) ); |
7370 | - if ( $alias ) $myFieldLink = $alias . '_id'; |
|
7503 | + if ( $alias ) { |
|
7504 | + $myFieldLink = $alias . '_id'; |
|
7505 | + } |
|
7371 | 7506 | |
7372 | 7507 | $addition->$myFieldLink = $bean->id; |
7373 | 7508 | $addition->setMeta( 'cast.' . $myFieldLink, 'id' ); |
@@ -7629,7 +7764,9 @@ discard block |
||
7629 | 7764 | |
7630 | 7765 | $myFieldLink = $beanType . '_id'; |
7631 | 7766 | $alias = $bean->getMeta( 'sys.alias.' . $addition->getMeta( 'type' ) ); |
7632 | - if ( $alias ) $myFieldLink = $alias . '_id'; |
|
7767 | + if ( $alias ) { |
|
7768 | + $myFieldLink = $alias . '_id'; |
|
7769 | + } |
|
7633 | 7770 | |
7634 | 7771 | $addition->$myFieldLink = $bean->id; |
7635 | 7772 | $addition->setMeta( 'cast.' . $myFieldLink, 'id' ); |
@@ -7948,7 +8085,9 @@ discard block |
||
7948 | 8085 | public function dispense( $type, $number = 1, $alwaysReturnArray = FALSE ) |
7949 | 8086 | { |
7950 | 8087 | if ( $number < 1 ) { |
7951 | - if ( $alwaysReturnArray ) return array(); |
|
8088 | + if ( $alwaysReturnArray ) { |
|
8089 | + return array(); |
|
8090 | + } |
|
7952 | 8091 | return NULL; |
7953 | 8092 | } |
7954 | 8093 | |
@@ -8258,8 +8397,12 @@ discard block |
||
8258 | 8397 | list( $type, $property ) = explode( '.', $field ); |
8259 | 8398 | $mode = ($mode === 'write') ? QueryWriter::C_SQLFILTER_WRITE : QueryWriter::C_SQLFILTER_READ; |
8260 | 8399 | |
8261 | - if ( !isset( self::$sqlFilters[$mode] ) ) self::$sqlFilters[$mode] = array(); |
|
8262 | - if ( !isset( self::$sqlFilters[$mode][$type] ) ) self::$sqlFilters[$mode][$type] = array(); |
|
8400 | + if ( !isset( self::$sqlFilters[$mode] ) ) { |
|
8401 | + self::$sqlFilters[$mode] = array(); |
|
8402 | + } |
|
8403 | + if ( !isset( self::$sqlFilters[$mode][$type] ) ) { |
|
8404 | + self::$sqlFilters[$mode][$type] = array(); |
|
8405 | + } |
|
8263 | 8406 | |
8264 | 8407 | if ( is_null( $function ) ) { |
8265 | 8408 | unset( self::$sqlFilters[$mode][$type][$property] ); |
@@ -8619,7 +8762,9 @@ discard block |
||
8619 | 8762 | { |
8620 | 8763 | if ( count( $conditions ) > 0 ) { |
8621 | 8764 | foreach( $conditions as $key => $condition ) { |
8622 | - if ( !count( $condition ) ) unset( $conditions[$key] ); |
|
8765 | + if ( !count( $condition ) ) { |
|
8766 | + unset( $conditions[$key] ); |
|
8767 | + } |
|
8623 | 8768 | } |
8624 | 8769 | } |
8625 | 8770 | |
@@ -8694,7 +8839,9 @@ discard block |
||
8694 | 8839 | */ |
8695 | 8840 | public function findMulti( $types, $sql, $bindings = array(), $remappings = array(), $queryTemplate = ' %s.%s AS %s__%s' ) |
8696 | 8841 | { |
8697 | - if ( !is_array( $types ) ) $types = explode( ',', $types ); |
|
8842 | + if ( !is_array( $types ) ) { |
|
8843 | + $types = explode( ',', $types ); |
|
8844 | + } |
|
8698 | 8845 | if ( !is_array( $sql ) ) { |
8699 | 8846 | $writer = $this->toolbox->getWriter(); |
8700 | 8847 | $adapter = $this->toolbox->getDatabaseAdapter(); |
@@ -8732,8 +8879,12 @@ discard block |
||
8732 | 8879 | $wannaBean[$property] = $value; |
8733 | 8880 | } |
8734 | 8881 | } |
8735 | - if ( !isset( $wannaBean['id'] ) ) continue; |
|
8736 | - if ( is_null( $wannaBean['id'] ) ) continue; |
|
8882 | + if ( !isset( $wannaBean['id'] ) ) { |
|
8883 | + continue; |
|
8884 | + } |
|
8885 | + if ( is_null( $wannaBean['id'] ) ) { |
|
8886 | + continue; |
|
8887 | + } |
|
8737 | 8888 | $wannaBeans[$type][$wannaBean['id']] = $wannaBean; |
8738 | 8889 | } |
8739 | 8890 | } |
@@ -8752,7 +8903,9 @@ discard block |
||
8752 | 8903 | $do = $remapping['do']; |
8753 | 8904 | foreach( $beans[$a] as $bean ) { |
8754 | 8905 | foreach( $beans[$b] as $putBean ) { |
8755 | - if ( $matcher( $bean, $putBean, $beans ) ) $do( $bean, $putBean, $beans, $remapping ); |
|
8906 | + if ( $matcher( $bean, $putBean, $beans ) ) { |
|
8907 | + $do( $bean, $putBean, $beans, $remapping ); |
|
8908 | + } |
|
8756 | 8909 | } |
8757 | 8910 | } |
8758 | 8911 | } |
@@ -9865,7 +10018,9 @@ discard block |
||
9865 | 10018 | } |
9866 | 10019 | |
9867 | 10020 | foreach( $values as $enumItem ) { |
9868 | - if ( $enumItem->name === $value ) return $enumItem; |
|
10021 | + if ( $enumItem->name === $value ) { |
|
10022 | + return $enumItem; |
|
10023 | + } |
|
9869 | 10024 | } |
9870 | 10025 | |
9871 | 10026 | $newEnumItems = $this->dispenseLabels( $type, array( $value ) ); |
@@ -10062,7 +10217,9 @@ discard block |
||
10062 | 10217 | */ |
10063 | 10218 | public static function testConnection() |
10064 | 10219 | { |
10065 | - if ( !isset( self::$adapter ) ) return FALSE; |
|
10220 | + if ( !isset( self::$adapter ) ) { |
|
10221 | + return FALSE; |
|
10222 | + } |
|
10066 | 10223 | |
10067 | 10224 | $database = self::$adapter->getDatabase(); |
10068 | 10225 | try { |
@@ -10212,7 +10369,9 @@ discard block |
||
10212 | 10369 | ); |
10213 | 10370 | |
10214 | 10371 | $wkey = trim( strtolower( $dbType ) ); |
10215 | - if ( !isset( $writers[$wkey] ) ) trigger_error( 'Unsupported DSN: '.$wkey ); |
|
10372 | + if ( !isset( $writers[$wkey] ) ) { |
|
10373 | + trigger_error( 'Unsupported DSN: '.$wkey ); |
|
10374 | + } |
|
10216 | 10375 | $writerClass = '\\RedBeanPHP\\QueryWriter\\'.$writers[$wkey]; |
10217 | 10376 | $writer = new $writerClass( $adapter ); |
10218 | 10377 | $redbean = new OODB( $writer, $frozen ); |
@@ -10419,7 +10578,9 @@ discard block |
||
10419 | 10578 | */ |
10420 | 10579 | public static function trash( $beanOrType, $id = NULL ) |
10421 | 10580 | { |
10422 | - if ( is_string( $beanOrType ) ) return self::trash( self::load( $beanOrType, $id ) ); |
|
10581 | + if ( is_string( $beanOrType ) ) { |
|
10582 | + return self::trash( self::load( $beanOrType, $id ) ); |
|
10583 | + } |
|
10423 | 10584 | return self::$redbean->trash( $beanOrType ); |
10424 | 10585 | } |
10425 | 10586 | |
@@ -10441,8 +10602,12 @@ discard block |
||
10441 | 10602 | |
10442 | 10603 | if ( !isset( $typeOrBeanArray['_type'] ) ) { |
10443 | 10604 | $list = array(); |
10444 | - foreach( $typeOrBeanArray as $beanArray ) if ( !( is_array( $beanArray ) && isset( $beanArray['_type'] ) ) ) throw new RedException( 'Invalid Array Bean' ); |
|
10445 | - foreach( $typeOrBeanArray as $beanArray ) $list[] = self::dispense( $beanArray ); |
|
10605 | + foreach( $typeOrBeanArray as $beanArray ) { |
|
10606 | + if ( !( is_array( $beanArray ) && isset( $beanArray['_type'] ) ) ) throw new RedException( 'Invalid Array Bean' ); |
|
10607 | + } |
|
10608 | + foreach( $typeOrBeanArray as $beanArray ) { |
|
10609 | + $list[] = self::dispense( $beanArray ); |
|
10610 | + } |
|
10446 | 10611 | return $list; |
10447 | 10612 | } |
10448 | 10613 | |
@@ -10894,7 +11059,9 @@ discard block |
||
10894 | 11059 | */ |
10895 | 11060 | public static function useExportCase( $caseStyle = 'default' ) |
10896 | 11061 | { |
10897 | - if ( !in_array( $caseStyle, array( 'default', 'camel', 'dolphin' ) ) ) throw new RedException( 'Invalid case selected.' ); |
|
11062 | + if ( !in_array( $caseStyle, array( 'default', 'camel', 'dolphin' ) ) ) { |
|
11063 | + throw new RedException( 'Invalid case selected.' ); |
|
11064 | + } |
|
10898 | 11065 | self::$exportCaseStyle = $caseStyle; |
10899 | 11066 | } |
10900 | 11067 | |
@@ -11095,7 +11262,9 @@ discard block |
||
11095 | 11262 | */ |
11096 | 11263 | public static function begin() |
11097 | 11264 | { |
11098 | - if ( !self::$redbean->isFrozen() ) return FALSE; |
|
11265 | + if ( !self::$redbean->isFrozen() ) { |
|
11266 | + return FALSE; |
|
11267 | + } |
|
11099 | 11268 | |
11100 | 11269 | self::$adapter->startTransaction(); |
11101 | 11270 | |
@@ -11110,7 +11279,9 @@ discard block |
||
11110 | 11279 | */ |
11111 | 11280 | public static function commit() |
11112 | 11281 | { |
11113 | - if ( !self::$redbean->isFrozen() ) return FALSE; |
|
11282 | + if ( !self::$redbean->isFrozen() ) { |
|
11283 | + return FALSE; |
|
11284 | + } |
|
11114 | 11285 | |
11115 | 11286 | self::$adapter->commit(); |
11116 | 11287 | |
@@ -11125,7 +11296,9 @@ discard block |
||
11125 | 11296 | */ |
11126 | 11297 | public static function rollback() |
11127 | 11298 | { |
11128 | - if ( !self::$redbean->isFrozen() ) return FALSE; |
|
11299 | + if ( !self::$redbean->isFrozen() ) { |
|
11300 | + return FALSE; |
|
11301 | + } |
|
11129 | 11302 | |
11130 | 11303 | self::$adapter->rollback(); |
11131 | 11304 | |
@@ -11170,8 +11343,11 @@ discard block |
||
11170 | 11343 | public static function flat( $array, $result = array() ) |
11171 | 11344 | { |
11172 | 11345 | foreach( $array as $value ) { |
11173 | - if ( is_array( $value ) ) $result = self::flat( $value, $result ); |
|
11174 | - else $result[] = $value; |
|
11346 | + if ( is_array( $value ) ) { |
|
11347 | + $result = self::flat( $value, $result ); |
|
11348 | + } else { |
|
11349 | + $result[] = $value; |
|
11350 | + } |
|
11175 | 11351 | } |
11176 | 11352 | return $result; |
11177 | 11353 | } |
@@ -11350,7 +11526,9 @@ discard block |
||
11350 | 11526 | */ |
11351 | 11527 | public static function isoDateTime( $time = NULL ) |
11352 | 11528 | { |
11353 | - if ( !$time ) $time = time(); |
|
11529 | + if ( !$time ) { |
|
11530 | + $time = time(); |
|
11531 | + } |
|
11354 | 11532 | |
11355 | 11533 | return @date( 'Y-m-d H:i:s', $time ); |
11356 | 11534 | } |
@@ -11975,7 +12153,9 @@ discard block |
||
11975 | 12153 | */ |
11976 | 12154 | protected function duplicate( OODBBean $bean, $trail = array(), $preserveIDs = FALSE ) |
11977 | 12155 | { |
11978 | - if ( $this->inTrailOrAdd( $trail, $bean ) ) return $bean; |
|
12156 | + if ( $this->inTrailOrAdd( $trail, $bean ) ) { |
|
12157 | + return $bean; |
|
12158 | + } |
|
11979 | 12159 | |
11980 | 12160 | $type = $bean->getMeta( 'type' ); |
11981 | 12161 | |
@@ -11983,7 +12163,9 @@ discard block |
||
11983 | 12163 | foreach ( $this->tables as $table ) { |
11984 | 12164 | |
11985 | 12165 | if ( !empty( $this->filters ) ) { |
11986 | - if ( !in_array( $table, $this->filters ) ) continue; |
|
12166 | + if ( !in_array( $table, $this->filters ) ) { |
|
12167 | + continue; |
|
12168 | + } |
|
11987 | 12169 | } |
11988 | 12170 | |
11989 | 12171 | list( $owned, $shared ) = $this->getListNames( $table ); |
@@ -12216,8 +12398,12 @@ discard block |
||
12216 | 12398 | $array[] = $duplicate->export( FALSE, $parents, FALSE, $filters ); |
12217 | 12399 | } |
12218 | 12400 | |
12219 | - if ( $caseStyle === 'camel' ) $array = $this->camelfy( $array ); |
|
12220 | - if ( $caseStyle === 'dolphin' ) $array = $this->camelfy( $array, true ); |
|
12401 | + if ( $caseStyle === 'camel' ) { |
|
12402 | + $array = $this->camelfy( $array ); |
|
12403 | + } |
|
12404 | + if ( $caseStyle === 'dolphin' ) { |
|
12405 | + $array = $this->camelfy( $array, true ); |
|
12406 | + } |
|
12221 | 12407 | |
12222 | 12408 | return $array; |
12223 | 12409 | } |
@@ -62,10 +62,16 @@ |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $query |
|
67 | + */ |
|
65 | 68 | public function consulta($query) { |
66 | 69 | $this->stmt = $this->dbh->prepare($query); |
67 | 70 | } |
68 | 71 | |
72 | + /** |
|
73 | + * @param string $param |
|
74 | + */ |
|
69 | 75 | public function enlace($param, $value, $type = null) {//bind |
70 | 76 | if (is_null($type)) { |
71 | 77 | switch (true) { |
@@ -341,6 +341,10 @@ |
||
341 | 341 | return $file; |
342 | 342 | } |
343 | 343 | |
344 | + /** |
|
345 | + * @param string $class |
|
346 | + * @param string $ext |
|
347 | + */ |
|
344 | 348 | private function findFileWithExtension($class, $ext) |
345 | 349 | { |
346 | 350 | // PSR-4 lookup |
@@ -1098,6 +1098,9 @@ discard block |
||
1098 | 1098 | $this->defaultCommand = $commandName; |
1099 | 1099 | } |
1100 | 1100 | |
1101 | + /** |
|
1102 | + * @param string $string |
|
1103 | + */ |
|
1101 | 1104 | private function stringWidth($string) |
1102 | 1105 | { |
1103 | 1106 | if (!function_exists('mb_strwidth')) { |
@@ -1111,6 +1114,9 @@ discard block |
||
1111 | 1114 | return mb_strwidth($string, $encoding); |
1112 | 1115 | } |
1113 | 1116 | |
1117 | + /** |
|
1118 | + * @param integer $width |
|
1119 | + */ |
|
1114 | 1120 | private function splitStringByWidth($string, $width) |
1115 | 1121 | { |
1116 | 1122 | // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. |