@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Charcoal\Admin\Widget\Cms; |
| 4 | 4 | |
| 5 | -use Exception; |
|
| 6 | 5 | use RuntimeException; |
| 7 | 6 | |
| 8 | 7 | // From 'charcoal-core' |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | switch ($sectionType) { |
| 98 | 98 | case AbstractSection::TYPE_EXTERNAL: |
| 99 | - $externalUrl = (string)$object->externalUrl(); |
|
| 99 | + $externalUrl = (string) $object->externalUrl(); |
|
| 100 | 100 | $linkExcerpt = ''; |
| 101 | 101 | $tagTemplate = '<span class="glyphicon glyphicon-link" data-toggle="tooltip" '. |
| 102 | 102 | 'data-placement="auto" title="%1$s"></span>'; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ($propertyIdent === 'title') { |
| 126 | - if (is_callable([ $object, 'navMenu' ]) && $object->navMenu()) { |
|
| 126 | + if (is_callable([$object, 'navMenu']) && $object->navMenu()) { |
|
| 127 | 127 | $propertyValue .= sprintf( |
| 128 | 128 | ' '. |
| 129 | 129 | '<span class="glyphicon glyphicon-list" data-toggle="tooltip" '. |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if (is_callable([ $object, 'locked' ]) && $object->locked()) { |
|
| 138 | + if (is_callable([$object, 'locked']) && $object->locked()) { |
|
| 139 | 139 | $propertyValue .= sprintf( |
| 140 | 140 | ' '. |
| 141 | 141 | '<span class="glyphicon glyphicon-lock" data-toggle="tooltip" '. |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use InvalidArgumentException; |
| 6 | 6 | |
| 7 | 7 | // From 'charcoal-core' |
| 8 | -use Charcoal\Model\Collection; |
|
| 9 | 8 | use Charcoal\Loader\CollectionLoader; |
| 10 | 9 | |
| 11 | 10 | // From 'charcoal-object' |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | parent::__construct($data); |
| 130 | 130 | |
| 131 | - if (is_callable([ $this, 'defaultData' ])) { |
|
| 131 | + if (is_callable([$this, 'defaultData'])) { |
|
| 132 | 132 | $this->setData($this->defaultData()); |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | * an empty string, or an object. |
| 491 | 491 | */ |
| 492 | 492 | if (!is_array($value)) { |
| 493 | - return [ $value ]; |
|
| 493 | + return [$value]; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | return $value; |
@@ -10,10 +10,8 @@ |
||
| 10 | 10 | use Charcoal\Cms\Mixin\Traits\BlocksSectionTrait; |
| 11 | 11 | |
| 12 | 12 | // dependencies from `charcoal-core` |
| 13 | -use Charcoal\Loader\CollectionLoader; |
|
| 14 | 13 | |
| 15 | 14 | // dependencies from `pimple` |
| 16 | -use Pimple\Container; |
|
| 17 | 15 | |
| 18 | 16 | // dependencies from Psr-7 |
| 19 | 17 | use \RuntimeException; |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Charcoal\Loader\CollectionLoader; |
| 6 | 6 | use Charcoal\Object\ObjectRoute; |
| 7 | -use Exception; |
|
| 8 | 7 | |
| 9 | 8 | use \Charcoal\Translator\TranslatorAwareTrait; |
| 10 | 9 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $loader = $this->all(); |
| 73 | 73 | $operator = []; |
| 74 | 74 | if (!$this->baseSection()) { |
| 75 | - $operator = [ 'operator' => 'IS NULL' ]; |
|
| 75 | + $operator = ['operator' => 'IS NULL']; |
|
| 76 | 76 | } |
| 77 | 77 | $loader->addFilter('master', $this->baseSection(), $operator); |
| 78 | 78 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | $q = 'SELECT * FROM `'.$proto->source()->table().'` |
| 141 | 141 | WHERE active=1 AND ( ' |
| 142 | - . implode(' OR ', $filters) . ' ) |
|
| 142 | + . implode(' OR ', $filters).' ) |
|
| 143 | 143 | ORDER BY creation_date ASC'; |
| 144 | 144 | |
| 145 | 145 | $objectRoutes = $loader->loadFromQuery($q); |
@@ -12,13 +12,11 @@ |
||
| 12 | 12 | use Pimple\ServiceProviderInterface; |
| 13 | 13 | |
| 14 | 14 | // Local dependencies |
| 15 | -use Charcoal\Cms\Config; |
|
| 16 | 15 | |
| 17 | 16 | // Cms Loaders |
| 18 | 17 | use Charcoal\Cms\Service\Loader\SectionLoader; |
| 19 | 18 | |
| 20 | 19 | // dependencies from `charcoal-core` |
| 21 | -use Charcoal\Model\AbstractModel; |
|
| 22 | 20 | |
| 23 | 21 | // dependencies from `charcoal-cms` |
| 24 | 22 | use Charcoal\Cms\SectionInterface; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param Container $container |
| 52 | 52 | * @return CmsConfig Website configurations (from cms.json). |
| 53 | 53 | */ |
| 54 | - $container['cms/config'] = function (Container $container) { |
|
| 54 | + $container['cms/config'] = function(Container $container) { |
|
| 55 | 55 | $appConfig = $container['config']; |
| 56 | 56 | $cms = $appConfig->get('cms'); |
| 57 | 57 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param Container $container Pimple DI Container. |
| 84 | 84 | * @return DateHelper |
| 85 | 85 | */ |
| 86 | - $container['date/helper'] = function (Container $container) { |
|
| 86 | + $container['date/helper'] = function(Container $container) { |
|
| 87 | 87 | |
| 88 | 88 | return new DateHelper([ |
| 89 | 89 | 'date_formats' => $container['cms/config']->get('date_formats'), |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param Container $container Pimple DI Container. |
| 108 | 108 | * @return GenericFactory |
| 109 | 109 | */ |
| 110 | - $container['cms/section/factory'] = function (Container $container) { |
|
| 110 | + $container['cms/section/factory'] = function(Container $container) { |
|
| 111 | 111 | return new GenericFactory([ |
| 112 | 112 | 'base_class' => SectionInterface::class, |
| 113 | 113 | 'arguments' => $container['model/factory']->arguments(), |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param Container $container Pimple DI Container. |
| 122 | 122 | * @return SectionLoader |
| 123 | 123 | */ |
| 124 | - $container['cms/section/loader'] = function (Container $container) { |
|
| 124 | + $container['cms/section/loader'] = function(Container $container) { |
|
| 125 | 125 | $sectionLoader = new SectionLoader([ |
| 126 | 126 | 'loader' => $container['model/collection/loader'], |
| 127 | 127 | 'factory' => $container['model/factory'], |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param Container $container Pimple DI Container. |
| 151 | 151 | * @return NewsLoader |
| 152 | 152 | */ |
| 153 | - $container['cms/news/loader'] = function (Container $container) { |
|
| 153 | + $container['cms/news/loader'] = function(Container $container) { |
|
| 154 | 154 | $newsLoader = new NewsLoader([ |
| 155 | 155 | 'loader' => $container['model/collection/loader'], |
| 156 | 156 | 'factory' => $container['model/factory'], |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param Container $container |
| 172 | 172 | * @return NewsManager |
| 173 | 173 | */ |
| 174 | - $container['cms/news/manager'] = function (Container $container) { |
|
| 174 | + $container['cms/news/manager'] = function(Container $container) { |
|
| 175 | 175 | |
| 176 | 176 | $newsManager = new NewsManager([ |
| 177 | 177 | 'loader' => $container['model/collection/loader'], |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param Container $container Pimple DI Container. |
| 197 | 197 | * @return EventLoader |
| 198 | 198 | */ |
| 199 | - $container['cms/event/loader'] = function (Container $container) { |
|
| 199 | + $container['cms/event/loader'] = function(Container $container) { |
|
| 200 | 200 | $eventLoader = new EventLoader([ |
| 201 | 201 | 'loader' => $container['model/collection/loader'], |
| 202 | 202 | 'factory' => $container['model/factory'], |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @param Container $container |
| 218 | 218 | * @return EventManager |
| 219 | 219 | */ |
| 220 | - $container['cms/event/manager'] = function (Container $container) { |
|
| 220 | + $container['cms/event/manager'] = function(Container $container) { |
|
| 221 | 221 | |
| 222 | 222 | $eventManager = new EventManager([ |
| 223 | 223 | 'loader' => $container['model/collection/loader'], |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | { |
| 32 | 32 | parent::__construct($data); |
| 33 | 33 | |
| 34 | - if (is_callable([ $this, 'defaultData' ])) { |
|
| 34 | + if (is_callable([$this, 'defaultData'])) { |
|
| 35 | 35 | $this->setData($this->defaultData()); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $now = new DateTime(); |
| 56 | 56 | $loader = $this->all(); |
| 57 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 57 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
| 58 | 58 | ->addOrder('start_date', 'asc'); |
| 59 | 59 | |
| 60 | 60 | return $loader; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $date = $this->parseAsDate($date); |
| 97 | 97 | $loader = $this->published(); |
| 98 | - $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
| 98 | + $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), ['operator' => '>=']); |
|
| 99 | 99 | |
| 100 | 100 | return $loader; |
| 101 | 101 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $date = $this->parseAsDate($date); |
| 113 | 113 | $loader = $this->published(); |
| 114 | - $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), [ 'operator' => '<' ]); |
|
| 114 | + $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), ['operator' => '<']); |
|
| 115 | 115 | |
| 116 | 116 | return $loader; |
| 117 | 117 | } |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $now = new DateTime(); |
| 49 | 49 | $loader = $this->all(); |
| 50 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 51 | - ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
| 50 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
| 51 | + ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), ['operator' => '>=']); |
|
| 52 | 52 | |
| 53 | 53 | return $loader; |
| 54 | 54 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $now = new DateTime(); |
| 62 | 62 | $loader = $this->all(); |
| 63 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
| 64 | - ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]); |
|
| 63 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
| 64 | + ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']); |
|
| 65 | 65 | |
| 66 | 66 | return $loader; |
| 67 | 67 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if ($this->category()) { |
| 219 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
| 219 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if ($this->numPerPage()) { |
@@ -321,8 +321,8 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $ids = explode(',', $ids); |
| 323 | 323 | |
| 324 | - $loader->addFilter('id', $ids, [ 'operator' => 'in' ]) |
|
| 325 | - ->addOrder('id', 'values', [ 'values' => $ids ]); |
|
| 324 | + $loader->addFilter('id', $ids, ['operator' => 'in']) |
|
| 325 | + ->addOrder('id', 'values', ['values' => $ids]); |
|
| 326 | 326 | |
| 327 | 327 | if (count($options) > 0) { |
| 328 | 328 | foreach ($options as $key => $option) { |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $loader = $this->loader()->archive(); |
| 370 | 370 | |
| 371 | 371 | if ($this->category()) { |
| 372 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
| 372 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
| 373 | 373 | } |
| 374 | 374 | if ($this->numPerPage()) { |
| 375 | 375 | $loader->setPage($this->page()); |