@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @inheritdoc |
| 35 | 35 | */ |
| 36 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 36 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 37 | 37 | { |
| 38 | 38 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 39 | 39 | if (!empty($searchData)) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function getComponentDetails() |
| 60 | 60 | { |
| 61 | 61 | return [ |
| 62 | - 'label' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
| 62 | + 'label' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
| 63 | 63 | ]; |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -99,9 +99,9 @@ |
||
| 99 | 99 | * or if you force it to return a total (this should be |
| 100 | 100 | * avoided if possible as counts are very expensive operations) |
| 101 | 101 | */ |
| 102 | - public function returnTotal(bool $force=false) |
|
| 102 | + public function returnTotal(bool $force = false) |
|
| 103 | 103 | { |
| 104 | - $this->_returnTotal=($force? true : ($this->_start == 0)); |
|
| 104 | + $this->_returnTotal = ($force ? true : ($this->_start == 0)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function getThemeAlias() |
| 234 | 234 | { |
| 235 | - return '@root/themes/' . $this->getThemeName(); |
|
| 235 | + return '@root/themes/'.$this->getThemeName(); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @inheritdoc |
| 276 | 276 | * @unsupported - $filters is not currently supported |
| 277 | 277 | */ |
| 278 | - public function getDataMap($key, $query='', $filters=[], $fields=[], $start = 0, $limit = 100) |
|
| 278 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $limit = 100) |
|
| 279 | 279 | { |
| 280 | 280 | if ($key === 'pages') { |
| 281 | 281 | return $this->getPagesMap($query, $filters, $fields, $start, $limit); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function formatPageMapResults($pages, $fields) |
| 330 | 330 | { |
| 331 | - return collect($pages)->mapWithKeys(function ($item) use($fields) { |
|
| 331 | + return collect($pages)->mapWithKeys(function($item) use($fields) { |
|
| 332 | 332 | if (empty($fields)) |
| 333 | 333 | return [$item['id'] => "$item[title] (nice=$item[nice_id])"]; |
| 334 | 334 | return [$item['id'] => $item]; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @param array $fields |
| 359 | 359 | * @return array - @see $this->formatPageMapResults(); |
| 360 | 360 | */ |
| 361 | - public function getPagesMap($query=null, $filters=[], $fields=[], $start=0, $limit=100) |
|
| 361 | + public function getPagesMap($query = null, $filters = [], $fields = [], $start = 0, $limit = 100) |
|
| 362 | 362 | { |
| 363 | 363 | $pages = CmsPage::find() |
| 364 | 364 | ->select(array_merge(['id', 'nice_id', 'title'], $fields)) |
@@ -392,10 +392,10 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | private function checkThemeName($name) |
| 394 | 394 | { |
| 395 | - if ( preg_match('/[^A-Za-z0-9_-]/', $name, $matches) ) { |
|
| 395 | + if (preg_match('/[^A-Za-z0-9_-]/', $name, $matches)) { |
|
| 396 | 396 | throw new \InvalidArgumentException("Error trying to set the theme name to '$name'" |
| 397 | 397 | ."\n"."The theme name must consist of only 'a-z', '0-9', '_' and '-' characters." |
| 398 | - ."\n".'The following character is not allowed in theme names: ' . \yii\helpers\VarDumper::dumpAsString($matches[0]) ); |
|
| 398 | + ."\n".'The following character is not allowed in theme names: '.\yii\helpers\VarDumper::dumpAsString($matches[0])); |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->addColumn('og_image')->setTitle('Social')->setWidth('100px')->setMember(new \neon\core\form\fields\Image('og_image')); |
| 55 | 55 | |
| 56 | 56 | $this->addButtonColumn('edit') |
| 57 | - ->addButton('edit', ['/cms/editor/index' , 'id' => '{{nice_id}}'], '', '', '', ['data-toggle' => 'tooltip', 'title'=>'Edit']); |
|
| 57 | + ->addButton('edit', ['/cms/editor/index', 'id' => '{{nice_id}}'], '', '', '', ['data-toggle' => 'tooltip', 'title'=>'Edit']); |
|
| 58 | 58 | |
| 59 | 59 | $this->addScope('published', 'Published'); |
| 60 | 60 | $this->addScope('draft', 'Draft'); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function renderTitle($model) |
| 80 | 80 | { |
| 81 | - return '<div style="font-weight:600;">' . $model['title'] . '</div><div stlye="margin-top:4px;">' . $model['description'] . '</div>'; |
|
| 81 | + return '<div style="font-weight:600;">'.$model['title'].'</div><div stlye="margin-top:4px;">'.$model['description'].'</div>'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public function renderUrl($model, $key, $index, $column) |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | use \Carbon\Carbon; |
| 18 | 18 | use neon\core\helpers\Url; |
| 19 | 19 | |
| 20 | -if (! function_exists('dp')) { |
|
| 20 | +if (!function_exists('dp')) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Debug function. Prints all passed in arguments to the screen. |
| 23 | 23 | * arguments containing objects or arrays are output using print_r |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if (! function_exists('backtrace_line_by_function')) { |
|
| 42 | +if (!function_exists('backtrace_line_by_function')) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Tries to get the line and file that called the specified functions |
| 45 | 45 | * - will return the earliest match in execution order that it found. |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $bt = debug_backtrace(); |
| 53 | 53 | $lineInfo = ''; |
| 54 | - foreach($bt as $trace) { |
|
| 54 | + foreach ($bt as $trace) { |
|
| 55 | 55 | if (isset($trace['function']) && $trace['function'] === $functionToShow) { |
| 56 | - $lineInfo = '==> [' . (isset($trace['file']) ? $trace['file'] : ' unknown file '). ':' . (isset($trace['line']) ? $trace['line'] : ' unknown line ' ) . ']'; |
|
| 56 | + $lineInfo = '==> ['.(isset($trace['file']) ? $trace['file'] : ' unknown file ').':'.(isset($trace['line']) ? $trace['line'] : ' unknown line ').']'; |
|
| 57 | 57 | break; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -if (! function_exists('dp_string')) { |
|
| 64 | +if (!function_exists('dp_string')) { |
|
| 65 | 65 | /** |
| 66 | 66 | * This generates a nice debug string and returns it. It will only |
| 67 | 67 | * print to the screen if you are in debug mode. Otherwise it prints |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if (! function_exists('dd')) { |
|
| 96 | +if (!function_exists('dd')) { |
|
| 97 | 97 | /** |
| 98 | 98 | * This is the same as the dp (debug print) function but exits after |
| 99 | 99 | * **Note:** If not in debug will print to log error and not exit |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | -if (! function_exists('debug_message')) { |
|
| 116 | +if (!function_exists('debug_message')) { |
|
| 117 | 117 | /** |
| 118 | 118 | * This is the same as the dp_string (debug print) function however it returns the string |
| 119 | 119 | * The main difference is that it will only output a message if neon is in debug mode |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | -if (! function_exists('neon')) { |
|
| 135 | +if (!function_exists('neon')) { |
|
| 136 | 136 | /** |
| 137 | 137 | * Shortcut method to ```\Neon::$app``` |
| 138 | 138 | * @param string $name |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if (! function_exists('setting')) { |
|
| 147 | +if (!function_exists('setting')) { |
|
| 148 | 148 | /** |
| 149 | 149 | * Get a setting value |
| 150 | 150 | * |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * the setting has been set in the current session |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | - function setting($app, $name, $default=null, $refresh=false) |
|
| 158 | + function setting($app, $name, $default = null, $refresh = false) |
|
| 159 | 159 | { |
| 160 | 160 | return neon()->getSettingsManager()->get($app, $name, $default, $refresh); |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -if (! function_exists('set_setting')) { |
|
| 164 | +if (!function_exists('set_setting')) { |
|
| 165 | 165 | /** |
| 166 | 166 | * @param string $app the app responsible for this setting |
| 167 | 167 | * @param string $name the setting name |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | -if (! function_exists('url')) { |
|
| 177 | +if (!function_exists('url')) { |
|
| 178 | 178 | /** |
| 179 | 179 | * Alias of \neon\core\helpers\Url::to |
| 180 | 180 | * @see \neon\core\helpers\Url::to() |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -if (! function_exists('url_base')) { |
|
| 200 | +if (!function_exists('url_base')) { |
|
| 201 | 201 | /** |
| 202 | 202 | * Returns the base URL of the current request. |
| 203 | 203 | * @param boolean|string $scheme the URI scheme to use in the returned base URL: |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | -if (! function_exists('to_bytes')) { |
|
| 216 | +if (!function_exists('to_bytes')) { |
|
| 217 | 217 | /** |
| 218 | 218 | * Returns the number of bytes as integer from a strings like `128K` | `128M` | `2G` | `1T` | `1P` |
| 219 | 219 | * |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | -if (! function_exists('format_bytes')) { |
|
| 228 | +if (!function_exists('format_bytes')) { |
|
| 229 | 229 | /** |
| 230 | 230 | * Output a formatted size like '128M' from bytes. |
| 231 | 231 | * |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | -if (! function_exists('truthy')) { |
|
| 241 | +if (!function_exists('truthy')) { |
|
| 242 | 242 | /** |
| 243 | 243 | * Php if statement handles truthy and falsey string conversions by default e.g. evaluating a '0' string to false |
| 244 | 244 | * however a string of 'false' is evaluated as true. This function resolves that difference. This should be used |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | -if (! function_exists('env')) { |
|
| 257 | +if (!function_exists('env')) { |
|
| 258 | 258 | /** |
| 259 | 259 | * Gets the value of an environment variable. |
| 260 | 260 | * Interprets 'true', 'false', 'empty' and 'null' strings appropriately |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | -if (! function_exists('neon_secret')) { |
|
| 292 | +if (!function_exists('neon_secret')) { |
|
| 293 | 293 | /** |
| 294 | 294 | * Gets the value of NEON_SECRET creating it if missing |
| 295 | 295 | * @return string |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | -if (! function_exists('neon_encryption_key')) { |
|
| 302 | +if (!function_exists('neon_encryption_key')) { |
|
| 303 | 303 | /** |
| 304 | 304 | * Gets the value of NEON_SECRET creating it if missing |
| 305 | 305 | * @return string |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | -if (! function_exists('value')) { |
|
| 312 | +if (!function_exists('value')) { |
|
| 313 | 313 | /** |
| 314 | 314 | * Return the value of the given value. |
| 315 | 315 | * If the $value is a Closure, it will first be executed then its result returned |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | -if (! function_exists('collect')) { |
|
| 326 | +if (!function_exists('collect')) { |
|
| 327 | 327 | /** |
| 328 | 328 | * Create a collection from the given value. |
| 329 | 329 | * |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | -if (! function_exists('now')) { |
|
| 339 | +if (!function_exists('now')) { |
|
| 340 | 340 | /** |
| 341 | 341 | * Create a new Carbon instance for the current time. |
| 342 | 342 | * |
@@ -349,27 +349,27 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | -if (! function_exists('profile_begin')) { |
|
| 352 | +if (!function_exists('profile_begin')) { |
|
| 353 | 353 | /** |
| 354 | 354 | * @param string $name |
| 355 | 355 | */ |
| 356 | - function profile_begin($name, $category='neon') |
|
| 356 | + function profile_begin($name, $category = 'neon') |
|
| 357 | 357 | { |
| 358 | 358 | \Neon::beginProfile($name, $category); |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | -if (! function_exists('profile_end')) { |
|
| 362 | +if (!function_exists('profile_end')) { |
|
| 363 | 363 | /** |
| 364 | 364 | * @param string $name |
| 365 | 365 | */ |
| 366 | - function profile_end($name=null, $category='neon') |
|
| 366 | + function profile_end($name = null, $category = 'neon') |
|
| 367 | 367 | { |
| 368 | 368 | \Neon::endProfile($name, $category); |
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | -if (! function_exists('encrypt')) { |
|
| 372 | +if (!function_exists('encrypt')) { |
|
| 373 | 373 | /** |
| 374 | 374 | * @param string $data |
| 375 | 375 | * @return string - encrypted data |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | -if (! function_exists('decrypt')) { |
|
| 383 | +if (!function_exists('decrypt')) { |
|
| 384 | 384 | /** |
| 385 | 385 | * @param string $data |
| 386 | 386 | * @return string - encrypted data |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -if (! function_exists('get_alias')) { |
|
| 394 | +if (!function_exists('get_alias')) { |
|
| 395 | 395 | /** |
| 396 | 396 | * @param string $path |
| 397 | 397 | * @return string - resolved path |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | -if (! function_exists('on_url')) { |
|
| 405 | +if (!function_exists('on_url')) { |
|
| 406 | 406 | /** |
| 407 | 407 | * This function is useful for checking if links should be active, |
| 408 | 408 | * |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | return \neon\core\helpers\Url::isUrl(...$urls); |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | -if (! function_exists('_t')) { |
|
| 425 | +if (!function_exists('_t')) { |
|
| 426 | 426 | /** |
| 427 | 427 | * Translates a message to the target language |
| 428 | 428 | * This function is a wrapper to the \Neon::t method |
@@ -442,12 +442,12 @@ discard block |
||
| 442 | 442 | * @param string $category if provided will save the text to that category. Defaults to 'neon' |
| 443 | 443 | * @return string the translated message. |
| 444 | 444 | */ |
| 445 | - function _t($text, $params=[], $category='neon') |
|
| 445 | + function _t($text, $params = [], $category = 'neon') |
|
| 446 | 446 | { |
| 447 | 447 | return \Neon::t($category, $text, $params); |
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | -if (! function_exists('faker')) { |
|
| 450 | +if (!function_exists('faker')) { |
|
| 451 | 451 | /** |
| 452 | 452 | * Generate a faker object |
| 453 | 453 | * @return \Faker\Generator; |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | return $faker; |
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | -if (! function_exists('user_is')) { |
|
| 463 | +if (!function_exists('user_is')) { |
|
| 464 | 464 | /** |
| 465 | 465 | * @return boolean whether the user is/has a particular role |
| 466 | 466 | */ |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | -if (! function_exists('user_can')) { |
|
| 473 | +if (!function_exists('user_can')) { |
|
| 474 | 474 | /** |
| 475 | 475 | * Whether the user can perform a permission |
| 476 | 476 | * @param $permission |
@@ -481,18 +481,18 @@ discard block |
||
| 481 | 481 | return neon()->user->can($permission); |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | -if (! function_exists('uuid')) { |
|
| 484 | +if (!function_exists('uuid')) { |
|
| 485 | 485 | /** |
| 486 | 486 | * Generate a universally unique id |
| 487 | 487 | * @param string $separator - default '-' |
| 488 | 488 | * @return bool |
| 489 | 489 | */ |
| 490 | - function uuid($separator='-') |
|
| 490 | + function uuid($separator = '-') |
|
| 491 | 491 | { |
| 492 | 492 | return \neon\core\helpers\Hash::uuid($separator); |
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | -if (! function_exists('uuid64')) { |
|
| 495 | +if (!function_exists('uuid64')) { |
|
| 496 | 496 | /** |
| 497 | 497 | * Generate a universally unique id in base64 |
| 498 | 498 | * @return bool |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | return \neon\core\helpers\Hash::uuid64(); |
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | -if (! function_exists('id')) { |
|
| 505 | +if (!function_exists('id')) { |
|
| 506 | 506 | /** |
| 507 | 507 | * Generate a html friendly UUID64 |
| 508 | 508 | * @return string |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | return \neon\core\helpers\Hash::id(); |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | -if (! function_exists('is_route')) { |
|
| 515 | +if (!function_exists('is_route')) { |
|
| 516 | 516 | /** |
| 517 | 517 | * Test whether the current application is on a particular route |
| 518 | 518 | * This is url rewrite safe! However you must reference the module/controller/action and not the url directly |
@@ -523,12 +523,12 @@ discard block |
||
| 523 | 523 | * @param array $params |
| 524 | 524 | * @return boolean - whether on the route |
| 525 | 525 | */ |
| 526 | - function is_route($pattern, $params=[]) |
|
| 526 | + function is_route($pattern, $params = []) |
|
| 527 | 527 | { |
| 528 | 528 | return neon()->request->isRoute($pattern, $params); |
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | -if (! function_exists('abort')) { |
|
| 531 | +if (!function_exists('abort')) { |
|
| 532 | 532 | /** |
| 533 | 533 | * Throw a HttpException with the given data. |
| 534 | 534 | * |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | -if (! function_exists('abort_if')) { |
|
| 547 | +if (!function_exists('abort_if')) { |
|
| 548 | 548 | /** |
| 549 | 549 | * Throw a HttpException with the given data if the given condition is true. |
| 550 | 550 | * |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | -if (! function_exists('request')) { |
|
| 565 | +if (!function_exists('request')) { |
|
| 566 | 566 | /** |
| 567 | 567 | * Get an instance of the current request or an input item from the request. |
| 568 | 568 | * |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | return is_null($value) ? value($default) : $value; |
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | -if (! function_exists('object_get')) { |
|
| 584 | +if (!function_exists('object_get')) { |
|
| 585 | 585 | /** |
| 586 | 586 | * Get an item from an object using "dot" notation. |
| 587 | 587 | * |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | foreach (explode('.', $key) as $segment) { |
| 600 | - if (! is_object($object) || ! isset($object->{$segment})) { |
|
| 600 | + if (!is_object($object) || !isset($object->{$segment})) { |
|
| 601 | 601 | return value($default); |
| 602 | 602 | } |
| 603 | 603 | |