Completed
Push — master ( 49228f...024767 )
by Henry Stivens
02:39
created
core/kumbia/kumbia_facade.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
      * @param  Array  $p key/value array with providers
35 35
      * @return void
36 36
      */
37
-    public static function providers(Array $p){
37
+    public static function providers(Array $p) {
38 38
         self::$providers = $p;
39 39
     }
40 40
 
41 41
     /**
42 42
      * Getter for the alias of the component
43 43
      */
44
-    protected static function getAlias(){
44
+    protected static function getAlias() {
45 45
         throw new RuntimeException('Not implement');
46 46
     }
47 47
 
48 48
 
49 49
     protected static function getInstance($name)
50 50
     {
51
-        return  isset(self::$providers[$name])?self::$providers[$name]:null;
51
+        return  isset(self::$providers[$name]) ? self::$providers[$name] : null;
52 52
     }
53 53
 
54 54
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public static function __callStatic($method, $args)
64 64
     {
65 65
         $instance = self::getInstance(static::getAlias());
66
-        if (! $instance) {
66
+        if (!$instance) {
67 67
             throw new RuntimeException('A facade root has not been set.');
68 68
         }
69 69
 
Please login to merge, or discard this patch.
core/kumbia/config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public static function get($var)
53 53
     {
54 54
         $namespaces = explode('.', $var);
55
-        if (! isset(self::$vars[$namespaces[0]])) {
55
+        if (!isset(self::$vars[$namespaces[0]])) {
56 56
             self::load($namespaces[0]);
57 57
         }
58 58
         switch (count($namespaces)) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 return isset(self::$vars[$namespaces[0]]) ? self::$vars[$namespaces[0]] : null;
67 67
             
68 68
             default:
69
-                trigger_error('Máximo 3 niveles en Config::get(fichero.sección.variable), pedido: '. $var);
69
+                trigger_error('Máximo 3 niveles en Config::get(fichero.sección.variable), pedido: ' . $var);
70 70
         }
71 71
     }
72 72
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 self::$vars[$namespaces[0]] = $value;
104 104
                 break;
105 105
             default:
106
-                trigger_error('Máximo 3 niveles en Config::set(fichero.sección.variable), pedido: '. $var);
106
+                trigger_error('Máximo 3 niveles en Config::set(fichero.sección.variable), pedido: ' . $var);
107 107
         }
108 108
     }
109 109
 
Please login to merge, or discard this patch.
core/extensions/helpers/js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
      * @param string $file nombre del archivo a añadir
118 118
      * @param array $dependencies archivos que son requisito del archivo a añadir
119 119
      */
120
-    public static function add( $file, $dependencies=array() )
120
+    public static function add($file, $dependencies = array())
121 121
     {
122 122
         self::$_js[$file] = $file;
123 123
         foreach ($dependencies as $file) self::$_dependencies[$file] = $file;
Please login to merge, or discard this patch.
core/extensions/helpers/form.php 1 patch
Spacing   +17 added lines, -20 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     protected static function fieldName(Array $field) {
99 99
         return isset($field[1]) ?
100
-        array("{$field[0]}_{$field[1]}", "{$field[0]}[{$field[1]}]") :
101
-        array($field[0], $field[0]);
100
+        array("{$field[0]}_{$field[1]}", "{$field[0]}[{$field[1]}]") : array($field[0], $field[0]);
102 101
     }
103 102
 
104 103
     /**
@@ -139,7 +138,7 @@  discard block
 block discarded – undo
139 138
      */
140 139
     protected static function tag($tag, $field, $attrs = '', $value = NULL, $extra = '', $close = TRUE) {
141 140
         $attrs = Tag::getAttrs($attrs);
142
-        $end   = $close?">{{value}}</$tag>":'/>';
141
+        $end   = $close ? ">{{value}}</$tag>" : '/>';
143 142
         // Obtiene name, id y value (solo para autoload) para el campo y los carga en el scope
144 143
         list($id, $name, $value) = self::getFieldData($field, $value);
145 144
         return str_replace('{{value}}', $value, "<$tag id=\"$id\" name=\"$name\" $extra $attrs $end");
@@ -169,9 +168,9 @@  discard block
 block discarded – undo
169 168
     public static function open($action = '', $method = 'post', $attrs = '') {
170 169
         $attrs = Tag::getAttrs($attrs);
171 170
         if ($action) {
172
-            $action = PUBLIC_PATH.$action;
171
+            $action = PUBLIC_PATH . $action;
173 172
         } else {
174
-            $action = PUBLIC_PATH.ltrim(Router::get('route'), '/');
173
+            $action = PUBLIC_PATH . ltrim(Router::get('route'), '/');
175 174
         }
176 175
         return "<form action=\"$action\" method=\"$method\" $attrs>";
177 176
     }
@@ -238,7 +237,7 @@  discard block
 block discarded – undo
238 237
      */
239 238
     public static function button($text, $attrs = '', $type = 'button', $value = NULL) {
240 239
         $attrs = Tag::getAttrs($attrs);
241
-        $value = is_null($value)?'':"value=\"$value\"";
240
+        $value = is_null($value) ? '' : "value=\"$value\"";
242 241
         return "<button type=\"$type\" $value $attrs>$text</button>";
243 242
     }
244 243
 
@@ -284,8 +283,7 @@  discard block
 block discarded – undo
284 283
         // Obtiene name, id y value (solo para autoload) para el campo y los carga en el scope
285 284
         list($id, $name, $value) = self::getFieldData($field, $value);
286 285
         //Si se quiere agregar blank
287
-        $options = empty($blank)?'':
288
-        '<option value="">'.htmlspecialchars($blank, ENT_COMPAT, APP_CHARSET).'</option>';
286
+        $options = empty($blank) ? '' : '<option value="">' . htmlspecialchars($blank, ENT_COMPAT, APP_CHARSET) . '</option>';
289 287
         foreach ($data as $k => $v) {
290 288
             $val      = self::selectValue($v, $k, $itemId);
291 289
             $text     = self::selectShow($v, $show);
@@ -303,8 +301,8 @@  discard block
 block discarded – undo
303 301
      * @return string
304 302
      */
305 303
     public static function selectValue($item, $key, $id) {
306
-        return htmlspecialchars(is_object($item)?
307
-            $item->$id:$key, ENT_COMPAT, APP_CHARSET);
304
+        return htmlspecialchars(is_object($item) ?
305
+            $item->$id : $key, ENT_COMPAT, APP_CHARSET);
308 306
     }
309 307
 
310 308
     /**
@@ -315,8 +313,8 @@  discard block
 block discarded – undo
315 313
      * @return string
316 314
      */
317 315
     public static function selectedValue($value, $key) {
318
-        return ((is_array($value) && in_array($key, $value)) || ($key == $value))?
319
-        'selected="selected"':'';
316
+        return ((is_array($value) && in_array($key, $value)) || ($key == $value)) ?
317
+        'selected="selected"' : '';
320 318
     }
321 319
 
322 320
     /**
@@ -389,7 +387,7 @@  discard block
 block discarded – undo
389 387
      */
390 388
     public static function submitImage($img, $attrs = '') {
391 389
         $attrs = Tag::getAttrs($attrs);
392
-        return "<input type=\"image\" src=\"".PUBLIC_PATH."img/$img\" $attrs/>";
390
+        return "<input type=\"image\" src=\"" . PUBLIC_PATH . "img/$img\" $attrs/>";
393 391
     }
394 392
 
395 393
     /**
@@ -439,18 +437,17 @@  discard block
 block discarded – undo
439 437
 
440 438
     public static function dbSelect($field, $show = NULL, $data = NULL, $blank = 'Seleccione', $attrs = '', $value = NULL) {
441 439
 
442
-        $model = ($data === NULL) ? substr($field, strpos($field, '.')+1, -3) : $data[0];
440
+        $model = ($data === NULL) ? substr($field, strpos($field, '.') + 1, -3) : $data[0];
443 441
         $model = Util::camelcase($model);
444 442
         $model_asoc = new $model;
445 443
         //por defecto el primer campo no pk
446
-        $show = $show ? : $model_asoc->non_primary[0];
444
+        $show = $show ?: $model_asoc->non_primary[0];
447 445
         $pk   = $model_asoc->primary_key[0];
448 446
         if ($data === NULL) {
449
-            $data = $model_asoc->find("columns: $pk,$show", "order: $show asc");//mejor usar array
447
+            $data = $model_asoc->find("columns: $pk,$show", "order: $show asc"); //mejor usar array
450 448
         } else {
451
-            $data = (isset($data[2]))?
452
-            $model_asoc->{$data[1]}($data[2]):
453
-            $model_asoc->{$data[1]}();
449
+            $data = (isset($data[2])) ?
450
+            $model_asoc->{$data[1]}($data[2]) : $model_asoc->{$data[1]}();
454 451
         }
455 452
         return self::select($field, $data, $attrs, $value, $blank, $pk, $show);
456 453
     }
@@ -471,7 +468,7 @@  discard block
 block discarded – undo
471 468
         $attrs = Tag::getAttrs($attrs);
472 469
 
473 470
         // Obtiene name y id, y los carga en el scope
474
-        list($id, $name, ) = self::getFieldData($field, FALSE);
471
+        list($id, $name,) = self::getFieldData($field, FALSE);
475 472
         return "<input id=\"$id\" name=\"$name\" type=\"file\" $attrs/>";
476 473
     }
477 474
 
Please login to merge, or discard this patch.
core/extensions/helpers/html.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
      * @param string|array $attrs Atributos adicionales
86 86
      * @return string
87 87
      */
88
-    public static function img($src, $alt='', $attrs = '')
88
+    public static function img($src, $alt = '', $attrs = '')
89 89
     {
90
-        return '<img src="' . PUBLIC_PATH . "img/$src\" alt=\"$alt\" ".Tag::getAttrs($attrs).' />';
90
+        return '<img src="' . PUBLIC_PATH . "img/$src\" alt=\"$alt\" " . Tag::getAttrs($attrs) . ' />';
91 91
     }
92 92
 
93 93
     /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * @param string $default URL gravatar por defecto si no existe, o un default de gravatar. Por defecto: mm
218 218
      * @return string
219 219
      */
220
-    public static function gravatar($email, $alt='gravatar', $size=40, $default='mm')
220
+    public static function gravatar($email, $alt = 'gravatar', $size = 40, $default = 'mm')
221 221
     {
222 222
         $grav_url = "//www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . '?d=' . urlencode($default) . '&amp;s=' . $size;
223 223
         return '<img src="' . $grav_url . '" alt="' . $alt . '" class="avatar" width="' . $size . '" height="' . $size . '" />';
Please login to merge, or discard this patch.
core/extensions/helpers/model_form.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
         if (!$action)
38 38
             $action = ltrim(Router::get('route'), '/');
39 39
 
40
-        echo '<form action="', PUBLIC_PATH . $action, '" method="post" id="', $model_name, '" class="scaffold">' , PHP_EOL;
40
+        echo '<form action="', PUBLIC_PATH . $action, '" method="post" id="', $model_name, '" class="scaffold">', PHP_EOL;
41 41
         $pk = $model->primary_key[0];
42
-        echo '<input id="', $model_name, '_', $pk, '" name="', $model_name, '[', $pk, ']" class="id" value="', $model->$pk , '" type="hidden">' , PHP_EOL;
42
+        echo '<input id="', $model_name, '_', $pk, '" name="', $model_name, '[', $pk, ']" class="id" value="', $model->$pk, '" type="hidden">', PHP_EOL;
43 43
 
44 44
         $fields = array_diff($model->fields, $model->_at, $model->_in, $model->primary_key);
45 45
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
             $formName = $model_name . '[' . $field . ']';
52 52
 
53 53
             if (in_array($field, $model->not_null)) {
54
-                echo "<label for=\"$formId\" class=\"required\">$alias *</label>" , PHP_EOL;
54
+                echo "<label for=\"$formId\" class=\"required\">$alias *</label>", PHP_EOL;
55 55
             } else
56
-                echo "<label for=\"$formId\">$alias</label>" , PHP_EOL;
56
+                echo "<label for=\"$formId\">$alias</label>", PHP_EOL;
57 57
 
58 58
             switch ($tipo) {
59 59
                 case 'tinyint': case 'smallint': case 'mediumint':
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
                         echo Form::dbSelect($model_name . '.' . $field, NULL, NULL, 'Seleccione', NULL, $model->$field);
67 67
                         break;
68 68
                     } else {
69
-                        echo "<input id=\"$formId\" type=\"number\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
69
+                        echo "<input id=\"$formId\" type=\"number\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
70 70
                         break;
71 71
                     }
72 72
 
73 73
                 case 'date': // Usar el js de datetime
74
-                    echo "<input id=\"$formId\" type=\"date\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
74
+                    echo "<input id=\"$formId\" type=\"date\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
75 75
                     break;
76 76
                 case 'datetime': case 'timestamp':
77
-                    echo "<input id=\"$formId\" type=\"datetime\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
77
+                    echo "<input id=\"$formId\" type=\"datetime\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
78 78
 
79 79
                     //echo '<script type="text/javascript" src="/javascript/kumbia/jscalendar/calendar.js"></script>
80 80
                     //<script type="text/javascript" src="/javascript/kumbia/jscalendar/calendar-setup.js"></script>
@@ -83,26 +83,26 @@  discard block
 block discarded – undo
83 83
                     break;
84 84
 
85 85
                 case 'enum': case 'set': case 'bool':
86
-                    $enumList = explode(",", str_replace("'", "", substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field])-6))));
86
+                    $enumList = explode(",", str_replace("'", "", substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field]) - 6))));
87 87
                     echo "<select id=\"$formId\" class=\"select\" name=\"$formName\" >", PHP_EOL;
88
-                    foreach($enumList as $value)
88
+                    foreach ($enumList as $value)
89 89
                         echo "<option value=\"{$value}\">$value</option>", PHP_EOL;
90 90
                     echo '</select>', PHP_EOL;
91 91
                     break;
92 92
 
93 93
                 case 'text': case 'mediumtext': case 'longtext':
94 94
                 case 'blob': case 'mediumblob': case 'longblob': // Usar textarea
95
-                    echo "<textarea id=\"$formId\" name=\"$formName\">{$model->$field}</textarea>" , PHP_EOL;
95
+                    echo "<textarea id=\"$formId\" name=\"$formName\">{$model->$field}</textarea>", PHP_EOL;
96 96
                     break;
97 97
 
98 98
                 default: //text,tinytext,varchar, char,etc se comprobara su tamaño
99
-                    echo "<input id=\"$formId\" type=\"text\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL;
99
+                    echo "<input id=\"$formId\" type=\"text\" name=\"$formName\" value=\"{$model->$field}\">", PHP_EOL;
100 100
                 //break;
101 101
             }
102 102
         }
103 103
         //echo radio_field_tag("actuacion", array("U" => "una", "D" => "dos", "N" => "Nada"), "value: N");
104
-        echo '<input type="submit" value="Enviar" />' , PHP_EOL;
105
-        echo '</form>' , PHP_EOL;
104
+        echo '<input type="submit" value="Enviar" />', PHP_EOL;
105
+        echo '</form>', PHP_EOL;
106 106
     }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
core/extensions/helpers/tag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public static function getAttrs($params)
44 44
     {
45
-        if(!is_array($params))return (string)$params;
45
+        if (!is_array($params))return (string) $params;
46 46
         $data = '';
47 47
         foreach ($params as $k => $v) {
48 48
             $data .= " $k=\"$v\"";
Please login to merge, or discard this patch.
core/extensions/helpers/css.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @var array
33 33
      * */
34
-    protected static $_dependencies  = array();
34
+    protected static $_dependencies = array();
35 35
     
36 36
     /**
37 37
      * Css
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param string $file nombre del archivo a añadir
54 54
      * @param array $dependencies  archivos que son requisito del archivo a añadir
55 55
      */
56
-    public static function add( $file, array $dependencies = [] )
56
+    public static function add($file, array $dependencies = [])
57 57
     {
58 58
         self::$_css[$file] = $file;
59 59
         foreach ($dependencies  as $file) self::$_dependencies [$file] = $file;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public static function inc()
68 68
     {
69
-        $css = self::$_dependencies  + self::$_css;
69
+        $css = self::$_dependencies + self::$_css;
70 70
         $html = '';
71 71
         foreach ($css as $file)
72 72
         {
Please login to merge, or discard this patch.
core/extensions/helpers/ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string $class
127 127
      * @param string|array $attrs
128 128
      */
129
-    public static function dbSelect($field, $show, $data, $update, $action, $blank=null, $class = '', $attrs = '')
129
+    public static function dbSelect($field, $show, $data, $update, $action, $blank = null, $class = '', $attrs = '')
130 130
     {
131 131
         $attrs = Tag::getAttrs($attrs);
132 132
         // ruta a la accion
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public static function form($update, $action = '', $class = '', $method = 'post', $attrs = '')
150 150
     {
151
-        $attrs = "class=\"js-remote $class\" data-to=\"$update\" ".Tag::getAttrs($attrs);
151
+        $attrs = "class=\"js-remote $class\" data-to=\"$update\" " . Tag::getAttrs($attrs);
152 152
         return Form::open($action, $method, $attrs);
153 153
     }
154 154
 
Please login to merge, or discard this patch.