@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | // add callback functionality to retain maximal original image size |
| 85 | 85 | $options = ['top-left', 'top', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom', 'bottom-right']; |
| 86 | 86 | $option = in_array($params['fit'], $options) ? $params['fit'] : 'center'; |
| 87 | - $image->fit($width, $height, function ($constraint) { |
|
| 87 | + $image->fit($width, $height, function($constraint) { |
|
| 88 | 88 | $constraint->aspectRatio(); |
| 89 | 89 | $constraint->upsize(); |
| 90 | 90 | }, $option); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } elseif ($width || $height) { |
| 94 | 94 | $width = $width * $pd; |
| 95 | 95 | $height = $height * $pd; |
| 96 | - $image->resize($width, $height, function ($constraint) { |
|
| 96 | + $image->resize($width, $height, function($constraint) { |
|
| 97 | 97 | $constraint->aspectRatio(); |
| 98 | 98 | $constraint->upsize(); |
| 99 | 99 | }); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $filter = Arr::get($params, 'filter', false); |
| 155 | 155 | if ($filter) { |
| 156 | - $filters = explode(',',$filter); |
|
| 156 | + $filters = explode(',', $filter); |
|
| 157 | 157 | if (in_array('greyscale', $filters, true)) { |
| 158 | 158 | $image->greyscale(); |
| 159 | 159 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $x = Arr::get($crop, 'x', null); |
| 189 | 189 | $y = Arr::get($crop, 'y', null); |
| 190 | 190 | } |
| 191 | - if ($w == 0 && $h == 0 && $x == 0 && $y ==0) { |
|
| 191 | + if ($w == 0 && $h == 0 && $x == 0 && $y == 0) { |
|
| 192 | 192 | return $image; |
| 193 | 193 | } |
| 194 | 194 | $image->crop($w, $h, $x, $y); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public static function render($vdom) |
| 42 | 42 | { |
| 43 | - foreach($vdom as $element) { |
|
| 43 | + foreach ($vdom as $element) { |
|
| 44 | 44 | $element[1]($element[2], $element['children']); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | // dd($domArray); |
| 68 | 68 | // Editor::vdom($domArray); |
| 69 | 69 | |
| 70 | - $ele=dom_import_simplexml($x); |
|
| 70 | + $ele = dom_import_simplexml($x); |
|
| 71 | 71 | $dom = new DOMDocument('1.0', 'utf-8'); |
| 72 | - $element=$dom->importNode($ele,true); |
|
| 72 | + $element = $dom->importNode($ele, true); |
|
| 73 | 73 | $element->normalize(); |
| 74 | 74 | |
| 75 | 75 | $dom = simplexml_import_dom($x); |
| 76 | - foreach($dom as $d) dp($d); |
|
| 76 | + foreach ($dom as $d) dp($d); |
|
| 77 | 77 | exit; |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | $vdom = []; |
| 81 | - foreach($x as $n) { |
|
| 81 | + foreach ($x as $n) { |
|
| 82 | 82 | Editor::node($vdom, $n); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $props = '{"components":null, "contentKey": "'.$id.'"}'; |
| 101 | 101 | if ($content !== null) { |
| 102 | 102 | // read the json data serialised inside the <!-- ni:editor {json data} --> tag |
| 103 | - $pattern = '/<!--\s+(?P<closer>\/)?ni:editor\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s'; |
|
| 103 | + $pattern = '/<!--\s+(?P<closer>\/)?ni:editor\s+(?P<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s'; |
|
| 104 | 104 | preg_match($pattern, $content, $matches); |
| 105 | 105 | if ($matches) { |
| 106 | 106 | $props = $matches['attrs']; |
@@ -147,18 +147,18 @@ discard block |
||
| 147 | 147 | * [children] => Array |
| 148 | 148 | * [props] => Array |
| 149 | 149 | */ |
| 150 | - public static function renderAsSmarty($node, &$depth=0) |
|
| 150 | + public static function renderAsSmarty($node, &$depth = 0) |
|
| 151 | 151 | { |
| 152 | 152 | $depth++; |
| 153 | 153 | $cmp = $node['cmp']; |
| 154 | 154 | $uuid = $node['uuid']; |
| 155 | 155 | $children = $node['children']; |
| 156 | 156 | $props = $node['props']; |
| 157 | - $out = '{'."$cmp " . static::formatProps($props) . " uuid=\"$uuid\" }\n"; |
|
| 158 | - foreach($children as $child) { |
|
| 159 | - $out .= str_repeat(' ', $depth) . static::renderAsSmarty($child, $depth); |
|
| 157 | + $out = '{'."$cmp ".static::formatProps($props)." uuid=\"$uuid\" }\n"; |
|
| 158 | + foreach ($children as $child) { |
|
| 159 | + $out .= str_repeat(' ', $depth).static::renderAsSmarty($child, $depth); |
|
| 160 | 160 | } |
| 161 | - $out .= str_repeat(' ', $depth-1) . '{/'.$cmp."}\n"; |
|
| 161 | + $out .= str_repeat(' ', $depth - 1).'{/'.$cmp."}\n"; |
|
| 162 | 162 | $depth--; |
| 163 | 163 | return $out; |
| 164 | 164 | } |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | unset($props['children']); |
| 169 | 169 | $formatParams = ''; |
| 170 | - foreach($props as $key => $value) { |
|
| 170 | + foreach ($props as $key => $value) { |
|
| 171 | 171 | if (is_array($value)) $value = var_export($value, true); |
| 172 | - $formatParams .= $key.'="'. $value .'" '; |
|
| 172 | + $formatParams .= $key.'="'.$value.'" '; |
|
| 173 | 173 | } |
| 174 | 174 | return $formatParams; |
| 175 | 175 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public static function createFromTree($cmpIndex, $root) { |
| 185 | 185 | $out = $root; |
| 186 | - foreach($root['children'] as $key => $childId) { |
|
| 186 | + foreach ($root['children'] as $key => $childId) { |
|
| 187 | 187 | if (!empty($out['children'])) { |
| 188 | 188 | $out['children'][$key] = static::createFromTree($cmpIndex, $cmpIndex[$childId]); |
| 189 | 189 | } |
@@ -561,8 +561,8 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $html = []; |
| 563 | 563 | $params['loading'] = Arr::get($params, 'loading', 'lazy'); |
| 564 | - $params[Arr::get($params, 'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(array_merge(['src' => $id], $params))); |
|
| 565 | - $params[Arr::get($params, 'src-name', 'src')] = $this->firefly_image(array_merge(['id' => $id, 'w' => (int)$srcWidth], $params)); |
|
| 564 | + $params[Arr::get($params, 'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(array_merge(['src' => $id], $params))); |
|
| 565 | + $params[Arr::get($params, 'src-name', 'src')] = $this->firefly_image(array_merge(['id' => $id, 'w' => (int)$srcWidth], $params)); |
|
| 566 | 566 | |
| 567 | 567 | // alt |
| 568 | 568 | $params['alt'] = Arr::get($params, 'alt', $this->image_alt(['src' => $id])); |
@@ -917,7 +917,4 @@ discard block |
||
| 917 | 917 | if (!empty($params['assign'])) { |
| 918 | 918 | $smarty->assign($params['assign'], $output); |
| 919 | 919 | } else { |
| 920 | - return $output; |
|
| 921 | - } |
|
| 922 | - } |
|
| 923 | -} |
|
| 920 | + return $output |
|
| 924 | 921 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public static function displayAsTags($tagsArray, $class = 'label label-info') |
| 20 | 20 | { |
| 21 | 21 | $out = ''; |
| 22 | - foreach($tagsArray as $tag) { |
|
| 22 | + foreach ($tagsArray as $tag) { |
|
| 23 | 23 | $out .= "<span class=\"$class\">$tag</span>"; |
| 24 | 24 | } |
| 25 | 25 | return $out; |
@@ -333,7 +333,4 @@ discard block |
||
| 333 | 333 | return $html; |
| 334 | 334 | } |
| 335 | 335 | profile_end('Html::Highlight'); |
| 336 | - return $html; |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | -} |
|
| 336 | + return $html |
|
| 340 | 337 | \ No newline at end of file |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function defaults($array, $defaults) |
| 58 | 58 | { |
| 59 | - foreach($defaults as $key => $default) |
|
| 59 | + foreach ($defaults as $key => $default) |
|
| 60 | 60 | Arr::set($array, $key, Arr::get($array, $key, $default)); |
| 61 | 61 | return $array; |
| 62 | 62 | } |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | foreach ($array as $key => $value) { |
| 76 | 76 | if (is_array($value) && !empty($value)) { |
| 77 | - $results = array_merge($results, static::dot($value, $prepend . $key . '.')); |
|
| 77 | + $results = array_merge($results, static::dot($value, $prepend.$key.'.')); |
|
| 78 | 78 | } else { |
| 79 | - $results[$prepend . $key] = $value; |
|
| 79 | + $results[$prepend.$key] = $value; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public static function flatten($array, $depth = INF) |
| 179 | 179 | { |
| 180 | - return array_reduce($array, function ($result, $item) use ($depth) { |
|
| 180 | + return array_reduce($array, function($result, $item) use ($depth) { |
|
| 181 | 181 | $item = $item instanceof Collection ? $item->all() : $item; |
| 182 | 182 | |
| 183 | 183 | if (!is_array($item)) { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $original = &$array; |
| 203 | 203 | |
| 204 | - $keys = (array)$keys; |
|
| 204 | + $keys = (array) $keys; |
|
| 205 | 205 | |
| 206 | 206 | if (count($keys) === 0) { |
| 207 | 207 | return; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @throws \InvalidArgumentException if the property $key does not exist in the array |
| 293 | 293 | * @return mixed |
| 294 | 294 | */ |
| 295 | - public static function getRequired($array, $key, $message=null) |
|
| 295 | + public static function getRequired($array, $key, $message = null) |
|
| 296 | 296 | { |
| 297 | 297 | if (!array_key_exists($key, $array)) { |
| 298 | 298 | throw new \InvalidArgumentException($message ?: "You must define a '$key' property."); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | public static function only($array, $keys) |
| 439 | 439 | { |
| 440 | - return array_intersect_key($array, array_flip((array)$keys)); |
|
| 440 | + return array_intersect_key($array, array_flip((array) $keys)); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // process the parameters |
| 150 | 150 | if (!isset($params['classType'])) |
| 151 | - throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true)); |
|
| 151 | + throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params, true)); |
|
| 152 | 152 | $classType = $params['classType']; |
| 153 | 153 | $cssClass = isset($params['cssClass']) ? $params['cssClass'] : null; |
| 154 | 154 | $label = isset($params['label']) ? $params['label'] : null; |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | $assignSaved = !empty($params['assignSaved']) ? $params['assignSaved'] : 'saved'; |
| 161 | 161 | $assignErrors = !empty($params['assignErrors']) ? $params['assignErrors'] : 'errors'; |
| 162 | 162 | $assignSubmitted = !empty($params['assignSubmitted']) ? $params['assignSubmitted'] : 'submitted'; |
| 163 | - $readOnly = isset($params['readOnly']) ? (bool)$params['readOnly'] : false; |
|
| 164 | - $printOnly = isset($params['printOnly']) ? (bool)$params['printOnly'] : false; |
|
| 163 | + $readOnly = isset($params['readOnly']) ? (bool) $params['readOnly'] : false; |
|
| 164 | + $printOnly = isset($params['printOnly']) ? (bool) $params['printOnly'] : false; |
|
| 165 | 165 | $uuid = !empty($params['uuid']) ? $params['uuid'] : null; |
| 166 | 166 | $dataSources = !empty($params['dataSources']) ? $params['dataSources'] : null; |
| 167 | - $enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool)$params['enableAjaxValidation'] : true; |
|
| 168 | - $enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool)$params['enableAjaxSubmission'] : false; |
|
| 167 | + $enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool) $params['enableAjaxValidation'] : true; |
|
| 168 | + $enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool) $params['enableAjaxSubmission'] : false; |
|
| 169 | 169 | $ajaxValidationUrl = !empty($params['ajaxValidationUrl']) ? $params['ajaxValidationUrl'] : '/phoebe/database/index/validate-form'; |
| 170 | 170 | $returnUrl = !empty($params['returnUrl']) ? $params['returnUrl'] : null; |
| 171 | 171 | $formName = !empty($params['name']) ? $params['name'] : null; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $id = ($id ? $id : ($uuid ? $uuid : null)); |
| 179 | 179 | if ($id) { |
| 180 | 180 | if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') |
| 181 | - $id = 'z' . $id; |
|
| 181 | + $id = 'z'.$id; |
|
| 182 | 182 | } |
| 183 | 183 | $changeLogUuids = []; |
| 184 | 184 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | // assign all of the save results to the template |
| 251 | 251 | foreach ($saveFormResults as $k=>$v) |
| 252 | - $template->assign($k,$v); |
|
| 252 | + $template->assign($k, $v); |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | // assign the resulting form |