@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | protected function setUp() : void |
16 | 16 | { |
17 | - \Aimeos\MShop::cache( true ); |
|
17 | + \Aimeos\MShop::cache(true); |
|
18 | 18 | |
19 | 19 | // $this->object = new \Aimeos\Admin\Jsonadm\Demo\Standard( \TestHelperJsonadm::getContext() ); |
20 | 20 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected function tearDown() : void |
28 | 28 | { |
29 | - \Aimeos\MShop::cache( false ); |
|
29 | + \Aimeos\MShop::cache(false); |
|
30 | 30 | |
31 | - unset( $this->object ); |
|
31 | + unset($this->object); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | public function testDemo() |
36 | 36 | { |
37 | - $this->markTestIncomplete( 'Just a demo' ); |
|
37 | + $this->markTestIncomplete('Just a demo'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | $includepaths = $aimeos->getIncludePaths(); |
19 | 19 | $includepaths[] = get_include_path(); |
20 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
20 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | private static function getAimeos() |
25 | 25 | { |
26 | - if( !isset( self::$aimeos ) ) |
|
26 | + if (!isset(self::$aimeos)) |
|
27 | 27 | { |
28 | 28 | require_once 'Bootstrap.php'; |
29 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
29 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
30 | 30 | |
31 | 31 | self::$aimeos = new \Aimeos\Bootstrap(); |
32 | 32 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | - public static function getContext( $site = 'unittest' ) |
|
38 | + public static function getContext($site = 'unittest') |
|
39 | 39 | { |
40 | - if( !isset( self::$context[$site] ) ) { |
|
41 | - self::$context[$site] = self::createContext( $site ); |
|
40 | + if (!isset(self::$context[$site])) { |
|
41 | + self::$context[$site] = self::createContext($site); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return clone self::$context[$site]; |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | |
48 | 48 | public static function getControllerPaths() |
49 | 49 | { |
50 | - return self::getAimeos()->getCustomPaths( 'admin/jsonadm' ); |
|
50 | + return self::getAimeos()->getCustomPaths('admin/jsonadm'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | public static function getTemplatePaths() |
55 | 55 | { |
56 | - return self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' ); |
|
56 | + return self::getAimeos()->getCustomPaths('admin/jsonadm/templates'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | - private static function createContext( $site ) |
|
60 | + private static function createContext($site) |
|
61 | 61 | { |
62 | 62 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
63 | 63 | $aimeos = self::getAimeos(); |
@@ -66,78 +66,78 @@ discard block |
||
66 | 66 | $paths = $aimeos->getConfigPaths(); |
67 | 67 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
68 | 68 | |
69 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
70 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
71 | - $ctx->setConfig( $conf ); |
|
69 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
70 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
71 | + $ctx->setConfig($conf); |
|
72 | 72 | |
73 | 73 | |
74 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
75 | - $ctx->setDatabaseManager( $dbm ); |
|
74 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf); |
|
75 | + $ctx->setDatabaseManager($dbm); |
|
76 | 76 | |
77 | 77 | |
78 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
79 | - $ctx->setLogger( $logger ); |
|
78 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
79 | + $ctx->setLogger($logger); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | $cache = new \Aimeos\MW\Cache\None(); |
83 | - $ctx->setCache( $cache ); |
|
83 | + $ctx->setCache($cache); |
|
84 | 84 | |
85 | 85 | |
86 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
87 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
86 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
87 | + $ctx->setI18n(array('de' => $i18n)); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | $session = new \Aimeos\MW\Session\None(); |
91 | - $ctx->setSession( $session ); |
|
91 | + $ctx->setSession($session); |
|
92 | 92 | |
93 | 93 | |
94 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
95 | - $locale = $localeManager->bootstrap( $site, 'de', '', false ); |
|
96 | - $ctx->setLocale( $locale ); |
|
94 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
95 | + $locale = $localeManager->bootstrap($site, 'de', '', false); |
|
96 | + $ctx->setLocale($locale); |
|
97 | 97 | |
98 | 98 | |
99 | - $view = self::createView( $conf ); |
|
100 | - $ctx->setView( $view ); |
|
99 | + $view = self::createView($conf); |
|
100 | + $ctx->setView($view); |
|
101 | 101 | |
102 | 102 | |
103 | - $ctx->setEditor( 'ai-cms-grapesjs:admin/jsonadm' ); |
|
103 | + $ctx->setEditor('ai-cms-grapesjs:admin/jsonadm'); |
|
104 | 104 | |
105 | 105 | return $ctx; |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - protected static function createView( \Aimeos\MW\Config\Iface $config ) |
|
109 | + protected static function createView(\Aimeos\MW\Config\Iface $config) |
|
110 | 110 | { |
111 | - $tmplpaths = self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' ); |
|
111 | + $tmplpaths = self::getAimeos()->getCustomPaths('admin/jsonadm/templates'); |
|
112 | 112 | |
113 | - $view = new \Aimeos\MW\View\Standard( $tmplpaths ); |
|
113 | + $view = new \Aimeos\MW\View\Standard($tmplpaths); |
|
114 | 114 | |
115 | - $helper = new \Aimeos\MW\View\Helper\Access\All( $view ); |
|
116 | - $view->addHelper( 'access', $helper ); |
|
115 | + $helper = new \Aimeos\MW\View\Helper\Access\All($view); |
|
116 | + $view->addHelper('access', $helper); |
|
117 | 117 | |
118 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
119 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
120 | - $view->addHelper( 'translate', $helper ); |
|
118 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
119 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
120 | + $view->addHelper('translate', $helper); |
|
121 | 121 | |
122 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
123 | - $view->addHelper( 'url', $helper ); |
|
122 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
123 | + $view->addHelper('url', $helper); |
|
124 | 124 | |
125 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
126 | - $view->addHelper( 'number', $helper ); |
|
125 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
126 | + $view->addHelper('number', $helper); |
|
127 | 127 | |
128 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
129 | - $view->addHelper( 'date', $helper ); |
|
128 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
129 | + $view->addHelper('date', $helper); |
|
130 | 130 | |
131 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin/jsonadm' ) ); |
|
132 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
133 | - $view->addHelper( 'config', $helper ); |
|
131 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin/jsonadm')); |
|
132 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
133 | + $view->addHelper('config', $helper); |
|
134 | 134 | |
135 | 135 | $psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory(); |
136 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $view, $psr17Factory->createServerRequest( 'GET', 'https://aimeos.org' ) ); |
|
137 | - $view->addHelper( 'request', $helper ); |
|
136 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($view, $psr17Factory->createServerRequest('GET', 'https://aimeos.org')); |
|
137 | + $view->addHelper('request', $helper); |
|
138 | 138 | |
139 | - $helper = new \Aimeos\MW\View\Helper\Response\Standard( $view, $psr17Factory->createResponse() ); |
|
140 | - $view->addHelper( 'response', $helper ); |
|
139 | + $helper = new \Aimeos\MW\View\Helper\Response\Standard($view, $psr17Factory->createResponse()); |
|
140 | + $view->addHelper('response', $helper); |
|
141 | 141 | |
142 | 142 | return $view; |
143 | 143 | } |
@@ -10,15 +10,15 @@ |
||
10 | 10 | * Set error reporting to maximum |
11 | 11 | */ |
12 | 12 | error_reporting( -1 ); |
13 | -date_default_timezone_set( 'UTC' ); |
|
13 | +date_default_timezone_set('UTC'); |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Set locale settings to reasonable defaults |
17 | 17 | */ |
18 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
19 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
20 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
21 | -setlocale( LC_TIME, 'POSIX' ); |
|
18 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
19 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
20 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
21 | +setlocale(LC_TIME, 'POSIX'); |
|
22 | 22 | |
23 | 23 | require_once 'TestHelperJsonadm.php'; |
24 | 24 | TestHelperJsonadm::bootstrap(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
30 | 30 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
31 | 31 | */ |
32 | - public static function create( \Aimeos\MShop\Context\Item\Iface $context, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/type/cms/lists/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2020.10 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/type/cms/lists/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/type/cms/lists/name', 'Standard'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $iface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
72 | 72 | $classname = '\\Aimeos\\Admin\\JQAdm\\Type\\Cms\\Lists\\' . $name; |
73 | 73 | |
74 | - if( ctype_alnum( $name ) === false ) { |
|
75 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + if (ctype_alnum($name) === false) { |
|
75 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | - $client = self::createAdmin( $context, $classname, $iface ); |
|
78 | + $client = self::createAdmin($context, $classname, $iface); |
|
79 | 79 | |
80 | - return self::addClientDecorators( $context, $client, 'type/cms/lists' ); |
|
80 | + return self::addClientDecorators($context, $client, 'type/cms/lists'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Type\Cms\Lists; |
12 | 12 | |
13 | -sprintf( 'type/cms/lists' ); // for translation |
|
13 | +sprintf('type/cms/lists'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function copy() : ?string |
32 | 32 | { |
33 | - return $this->copyBase( 'cms/lists' ); |
|
33 | + return $this->copyBase('cms/lists'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function create() : ?string |
43 | 43 | { |
44 | - return $this->createBase( 'cms/lists' ); |
|
44 | + return $this->createBase('cms/lists'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function delete() : ?string |
54 | 54 | { |
55 | - return $this->deleteBase( 'cms/lists' ); |
|
55 | + return $this->deleteBase('cms/lists'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function get() : ?string |
65 | 65 | { |
66 | - return $this->getBase( 'cms/lists' ); |
|
66 | + return $this->getBase('cms/lists'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function save() : ?string |
76 | 76 | { |
77 | - return $this->saveBase( 'cms/lists' ); |
|
77 | + return $this->saveBase('cms/lists'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function search() : ?string |
87 | 87 | { |
88 | - $view = $this->searchBase( 'cms/lists' ); |
|
88 | + $view = $this->searchBase('cms/lists'); |
|
89 | 89 | |
90 | 90 | /** admin/jqadm/type/cms/lists/template-list |
91 | 91 | * Relative path to the HTML body template for the list type list. |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $tplconf = 'admin/jqadm/type/cms/lists/template-list'; |
110 | 110 | $default = 'type/cms/lists/list-standard'; |
111 | 111 | |
112 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
112 | + return $view->render($view->config($tplconf, $default)); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param string|null $name Name of the sub-client (Default if null) |
121 | 121 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
122 | 122 | */ |
123 | - public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
123 | + public function getSubClient(string $type, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
124 | 124 | { |
125 | 125 | /** admin/jqadm/type/cms/lists/decorators/excludes |
126 | 126 | * Excludes decorators added by the "common" option from the list type JQAdm client |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @see admin/jqadm/type/cms/lists/decorators/excludes |
196 | 196 | * @see admin/jqadm/type/cms/lists/decorators/global |
197 | 197 | */ |
198 | - return $this->createSubClient( 'type/cms/lists' . $type, $name ); |
|
198 | + return $this->createSubClient('type/cms/lists' . $type, $name); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @since 2020.10 |
240 | 240 | * @category Developer |
241 | 241 | */ |
242 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/type/cms/lists/subparts', [] ); |
|
242 | + return $this->getContext()->getConfig()->get('admin/jqadm/type/cms/lists/subparts', []); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
250 | 250 | * @return string HTML output |
251 | 251 | */ |
252 | - protected function render( \Aimeos\MW\View\Iface $view ) : string |
|
252 | + protected function render(\Aimeos\MW\View\Iface $view) : string |
|
253 | 253 | { |
254 | 254 | /** admin/jqadm/type/cms/lists/template-item |
255 | 255 | * Relative path to the HTML body template for the list type item. |
@@ -273,6 +273,6 @@ discard block |
||
273 | 273 | $tplconf = 'admin/jqadm/type/cms/lists/template-item'; |
274 | 274 | $default = 'type/cms/lists/item-standard'; |
275 | 275 | |
276 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
276 | + return $view->render($view->config($tplconf, $default)); |
|
277 | 277 | } |
278 | 278 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
30 | 30 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
31 | 31 | */ |
32 | - public static function create( \Aimeos\MShop\Context\Item\Iface $context, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/cms/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * @since 2020.10 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/cms/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/cms/name', 'Standard'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $iface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
72 | 72 | $classname = '\\Aimeos\\Admin\\JQAdm\\Cms\\' . $name; |
73 | 73 | |
74 | - if( ctype_alnum( $name ) === false ) { |
|
75 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + if (ctype_alnum($name) === false) { |
|
75 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | - $client = self::createAdmin( $context, $classname, $iface ); |
|
78 | + $client = self::createAdmin($context, $classname, $iface); |
|
79 | 79 | |
80 | - return self::addClientDecorators( $context, $client, 'cms' ); |
|
80 | + return self::addClientDecorators($context, $client, 'cms'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Cms\Seo; |
12 | 12 | |
13 | -sprintf( 'seo' ); // for translation |
|
13 | +sprintf('seo'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() : ?string |
44 | 44 | { |
45 | - $view = $this->getObject()->addData( $this->getView() ); |
|
46 | - $view->seoData = $this->toArray( $view->item, true ); |
|
45 | + $view = $this->getObject()->addData($this->getView()); |
|
46 | + $view->seoData = $this->toArray($view->item, true); |
|
47 | 47 | $view->seoBody = parent::copy(); |
48 | 48 | |
49 | - return $this->render( $view ); |
|
49 | + return $this->render($view); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function create() : ?string |
59 | 59 | { |
60 | - $view = $this->getObject()->addData( $this->getView() ); |
|
60 | + $view = $this->getObject()->addData($this->getView()); |
|
61 | 61 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
62 | - $data = $view->param( 'seo', [] ); |
|
62 | + $data = $view->param('seo', []); |
|
63 | 63 | |
64 | - foreach( $data as $idx => $entry ) |
|
64 | + foreach ($data as $idx => $entry) |
|
65 | 65 | { |
66 | 66 | $data[$idx]['cms.lists.siteid'] = $siteid; |
67 | 67 | $data[$idx]['text.siteid'] = $siteid; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $view->seoData = $data; |
71 | 71 | $view->seoBody = parent::create(); |
72 | 72 | |
73 | - return $this->render( $view ); |
|
73 | + return $this->render($view); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | $item = $this->getView()->item; |
87 | 87 | |
88 | - $listItems = $item->getListItems( 'text', null, null, false )->filter( function( $item ) { |
|
88 | + $listItems = $item->getListItems('text', null, null, false)->filter(function($item) { |
|
89 | 89 | return $item->getRefItem() === null || $item->getRefItem()->getType() !== 'content'; |
90 | 90 | } ); |
91 | 91 | |
92 | - $item->deleteListItems( $listItems, true ); |
|
92 | + $item->deleteListItems($listItems, true); |
|
93 | 93 | |
94 | 94 | return null; |
95 | 95 | } |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() : ?string |
104 | 104 | { |
105 | - $view = $this->getObject()->addData( $this->getView() ); |
|
106 | - $view->seoData = $this->toArray( $view->item ); |
|
105 | + $view = $this->getObject()->addData($this->getView()); |
|
106 | + $view->seoData = $this->toArray($view->item); |
|
107 | 107 | $view->seoBody = parent::get(); |
108 | 108 | |
109 | - return $this->render( $view ); |
|
109 | + return $this->render($view); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $view = $this->getView(); |
121 | 121 | |
122 | - $view->item = $this->fromArray( $view->item, $view->param( 'seo', [] ) ); |
|
122 | + $view->item = $this->fromArray($view->item, $view->param('seo', [])); |
|
123 | 123 | $view->seoBody = parent::save(); |
124 | 124 | |
125 | 125 | return null; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string|null $name Name of the sub-client (Default if null) |
134 | 134 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
135 | 135 | */ |
136 | - public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
136 | + public function getSubClient(string $type, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
137 | 137 | { |
138 | 138 | /** admin/jqadm/cms/seo/decorators/excludes |
139 | 139 | * Excludes decorators added by the "common" option from the cms JQAdm client |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @see admin/jqadm/cms/seo/decorators/excludes |
209 | 209 | * @see admin/jqadm/cms/seo/decorators/global |
210 | 210 | */ |
211 | - return $this->createSubClient( 'cms/seo/' . $type, $name ); |
|
211 | + return $this->createSubClient('cms/seo/' . $type, $name); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @since 2020.10 |
253 | 253 | * @category Developer |
254 | 254 | */ |
255 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/cms/seo/subparts', [] ); |
|
255 | + return $this->getContext()->getConfig()->get('admin/jqadm/cms/seo/subparts', []); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,26 +262,26 @@ discard block |
||
262 | 262 | * @param \Aimeos\MW\View\Iface $view View object |
263 | 263 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
264 | 264 | */ |
265 | - public function addData( \Aimeos\MW\View\Iface $view ) : \Aimeos\MW\View\Iface |
|
265 | + public function addData(\Aimeos\MW\View\Iface $view) : \Aimeos\MW\View\Iface |
|
266 | 266 | { |
267 | 267 | $context = $this->getContext(); |
268 | 268 | |
269 | - $textTypeManager = \Aimeos\MShop::create( $context, 'text/type' ); |
|
270 | - $listTypeManager = \Aimeos\MShop::create( $context, 'cms/lists/type' ); |
|
269 | + $textTypeManager = \Aimeos\MShop::create($context, 'text/type'); |
|
270 | + $listTypeManager = \Aimeos\MShop::create($context, 'cms/lists/type'); |
|
271 | 271 | |
272 | - $search = $textTypeManager->filter( true )->slice( 0, 10000 ); |
|
273 | - $search->add( $search->and( [ |
|
274 | - $search->is( 'text.type.domain', '==', 'cms' ), |
|
275 | - $search->is( 'text.type.code', '!=', 'content' ) |
|
276 | - ] ) ); |
|
277 | - $search->setSortations( [$search->sort( '+', 'text.type.position' )] ); |
|
272 | + $search = $textTypeManager->filter(true)->slice(0, 10000); |
|
273 | + $search->add($search->and([ |
|
274 | + $search->is('text.type.domain', '==', 'cms'), |
|
275 | + $search->is('text.type.code', '!=', 'content') |
|
276 | + ])); |
|
277 | + $search->setSortations([$search->sort('+', 'text.type.position')]); |
|
278 | 278 | |
279 | - $listSearch = $listTypeManager->filter( true )->slice( 0, 10000 ); |
|
280 | - $listSearch->setConditions( $listSearch->compare( '==', 'cms.lists.type.domain', 'text' ) ); |
|
281 | - $listSearch->setSortations( [$listSearch->sort( '+', 'cms.lists.type.position' )] ); |
|
279 | + $listSearch = $listTypeManager->filter(true)->slice(0, 10000); |
|
280 | + $listSearch->setConditions($listSearch->compare('==', 'cms.lists.type.domain', 'text')); |
|
281 | + $listSearch->setSortations([$listSearch->sort('+', 'cms.lists.type.position')]); |
|
282 | 282 | |
283 | - $view->seoTypes = $textTypeManager->search( $search ); |
|
284 | - $view->seoListTypes = $listTypeManager->search( $listSearch ); |
|
283 | + $view->seoTypes = $textTypeManager->search($search); |
|
284 | + $view->seoListTypes = $listTypeManager->search($listSearch); |
|
285 | 285 | |
286 | 286 | return $view; |
287 | 287 | } |
@@ -294,54 +294,54 @@ discard block |
||
294 | 294 | * @param array $data Data array |
295 | 295 | * @return \Aimeos\MShop\Cms\Item\Iface Modified cms item |
296 | 296 | */ |
297 | - protected function fromArray( \Aimeos\MShop\Cms\Item\Iface $item, array $data ) : \Aimeos\MShop\Cms\Item\Iface |
|
297 | + protected function fromArray(\Aimeos\MShop\Cms\Item\Iface $item, array $data) : \Aimeos\MShop\Cms\Item\Iface |
|
298 | 298 | { |
299 | 299 | $context = $this->getContext(); |
300 | 300 | |
301 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
302 | - $listManager = \Aimeos\MShop::create( $context, 'cms/lists' ); |
|
301 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
302 | + $listManager = \Aimeos\MShop::create($context, 'cms/lists'); |
|
303 | 303 | |
304 | - $listItems = $item->getListItems( 'text', null, null, false )->filter( function( $item ) { |
|
304 | + $listItems = $item->getListItems('text', null, null, false)->filter(function($item) { |
|
305 | 305 | return $item->getRefItem() === null || $item->getRefItem()->getType() !== 'content'; |
306 | 306 | } ); |
307 | 307 | |
308 | 308 | |
309 | - foreach( $data as $idx => $entry ) |
|
309 | + foreach ($data as $idx => $entry) |
|
310 | 310 | { |
311 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
311 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
312 | 312 | continue; |
313 | 313 | } |
314 | 314 | |
315 | 315 | $listType = $entry['cms.lists.type'] ?? 'default'; |
316 | 316 | |
317 | - if( ( $listItem = $item->getListItem( 'text', $listType, $entry['text.id'], false ) ) === null ) { |
|
317 | + if (($listItem = $item->getListItem('text', $listType, $entry['text.id'], false)) === null) { |
|
318 | 318 | $listItem = $listManager->create(); |
319 | 319 | } |
320 | 320 | |
321 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
321 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
322 | 322 | $refItem = $textManager->create(); |
323 | 323 | } |
324 | 324 | |
325 | - $refItem->fromArray( $entry, true ); |
|
325 | + $refItem->fromArray($entry, true); |
|
326 | 326 | $conf = []; |
327 | 327 | |
328 | - foreach( (array) $this->getValue( $entry, 'config', [] ) as $cfg ) |
|
328 | + foreach ((array) $this->getValue($entry, 'config', []) as $cfg) |
|
329 | 329 | { |
330 | - if( ( $key = trim( $cfg['key'] ?? '' ) ) !== '' ) { |
|
331 | - $conf[$key] = trim( $cfg['val'] ?? '' ); |
|
330 | + if (($key = trim($cfg['key'] ?? '')) !== '') { |
|
331 | + $conf[$key] = trim($cfg['val'] ?? ''); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | - $listItem->fromArray( $entry, true ); |
|
336 | - $listItem->setPosition( $idx ); |
|
337 | - $listItem->setConfig( $conf ); |
|
335 | + $listItem->fromArray($entry, true); |
|
336 | + $listItem->setPosition($idx); |
|
337 | + $listItem->setConfig($conf); |
|
338 | 338 | |
339 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
339 | + $item->addListItem('text', $listItem, $refItem); |
|
340 | 340 | |
341 | - unset( $listItems[$listItem->getId()] ); |
|
341 | + unset($listItems[$listItem->getId()]); |
|
342 | 342 | } |
343 | 343 | |
344 | - return $item->deleteListItems( $listItems->toArray(), true ); |
|
344 | + return $item->deleteListItems($listItems->toArray(), true); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -352,24 +352,24 @@ discard block |
||
352 | 352 | * @param bool $copy True if items should be copied, false if not |
353 | 353 | * @return string[] Multi-dimensional associative list of item data |
354 | 354 | */ |
355 | - protected function toArray( \Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false ) : array |
|
355 | + protected function toArray(\Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false) : array |
|
356 | 356 | { |
357 | 357 | $data = []; |
358 | 358 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
359 | 359 | |
360 | - $listItems = $item->getListItems( 'text', null, null, false )->filter( function( $item ) { |
|
360 | + $listItems = $item->getListItems('text', null, null, false)->filter(function($item) { |
|
361 | 361 | return $item->getRefItem() === null || $item->getRefItem()->getType() !== 'content'; |
362 | 362 | } ); |
363 | 363 | |
364 | - foreach( $listItems as $listItem ) |
|
364 | + foreach ($listItems as $listItem) |
|
365 | 365 | { |
366 | - if( ( $refItem = $listItem->getRefItem() ) === null || $refItem->getType() === 'content' ) { |
|
366 | + if (($refItem = $listItem->getRefItem()) === null || $refItem->getType() === 'content') { |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
370 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
370 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
371 | 371 | |
372 | - if( $copy === true ) |
|
372 | + if ($copy === true) |
|
373 | 373 | { |
374 | 374 | $list['cms.lists.siteid'] = $siteId; |
375 | 375 | $list['cms.lists.id'] = ''; |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | $list['text.id'] = null; |
378 | 378 | } |
379 | 379 | |
380 | - $list['cms.lists.datestart'] = str_replace( ' ', 'T', $list['cms.lists.datestart'] ); |
|
381 | - $list['cms.lists.dateend'] = str_replace( ' ', 'T', $list['cms.lists.dateend'] ); |
|
380 | + $list['cms.lists.datestart'] = str_replace(' ', 'T', $list['cms.lists.datestart']); |
|
381 | + $list['cms.lists.dateend'] = str_replace(' ', 'T', $list['cms.lists.dateend']); |
|
382 | 382 | $list['config'] = []; |
383 | 383 | |
384 | - foreach( $listItem->getConfig() as $key => $value ) { |
|
384 | + foreach ($listItem->getConfig() as $key => $value) { |
|
385 | 385 | $list['config'][] = ['key' => $key, 'val' => $value]; |
386 | 386 | } |
387 | 387 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
399 | 399 | * @return string HTML output |
400 | 400 | */ |
401 | - protected function render( \Aimeos\MW\View\Iface $view ) : string |
|
401 | + protected function render(\Aimeos\MW\View\Iface $view) : string |
|
402 | 402 | { |
403 | 403 | /** admin/jqadm/cms/seo/template-item |
404 | 404 | * Relative path to the HTML body template of the seo subpart for cmss. |
@@ -422,6 +422,6 @@ discard block |
||
422 | 422 | $tplconf = 'admin/jqadm/cms/seo/template-item'; |
423 | 423 | $default = 'cms/item-seo-standard'; |
424 | 424 | |
425 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
425 | + return $view->render($view->config($tplconf, $default)); |
|
426 | 426 | } |
427 | 427 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Cms; |
12 | 12 | |
13 | -sprintf( 'cms' ); // for translation |
|
13 | +sprintf('cms'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param \Aimeos\MW\View\Iface $view View object |
30 | 30 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
31 | 31 | */ |
32 | - public function addData( \Aimeos\MW\View\Iface $view ) : \Aimeos\MW\View\Iface |
|
32 | + public function addData(\Aimeos\MW\View\Iface $view) : \Aimeos\MW\View\Iface |
|
33 | 33 | { |
34 | 34 | $view->itemSubparts = $this->getSubClientNames(); |
35 | 35 | return $view; |
@@ -43,26 +43,26 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function copy() : ?string |
45 | 45 | { |
46 | - $view = $this->getObject()->addData( $this->getView() ); |
|
46 | + $view = $this->getObject()->addData($this->getView()); |
|
47 | 47 | |
48 | 48 | try |
49 | 49 | { |
50 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
51 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
50 | + if (($id = $view->param('id')) === null) { |
|
51 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
52 | 52 | } |
53 | 53 | |
54 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
55 | - $view->item = $manager->get( $id, $this->getDomains() ); |
|
54 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
55 | + $view->item = $manager->get($id, $this->getDomains()); |
|
56 | 56 | |
57 | - $view->itemData = $this->toArray( $view->item, true ); |
|
57 | + $view->itemData = $this->toArray($view->item, true); |
|
58 | 58 | $view->itemBody = parent::copy(); |
59 | 59 | } |
60 | - catch( \Exception $e ) |
|
60 | + catch (\Exception $e) |
|
61 | 61 | { |
62 | - $this->report( $e, 'copy' ); |
|
62 | + $this->report($e, 'copy'); |
|
63 | 63 | } |
64 | 64 | |
65 | - return $this->render( $view ); |
|
65 | + return $this->render($view); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,27 +73,27 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function create() : ?string |
75 | 75 | { |
76 | - $view = $this->getObject()->addData( $this->getView() ); |
|
76 | + $view = $this->getObject()->addData($this->getView()); |
|
77 | 77 | |
78 | 78 | try |
79 | 79 | { |
80 | - $data = $view->param( 'item', [] ); |
|
80 | + $data = $view->param('item', []); |
|
81 | 81 | |
82 | - if( !isset( $view->item ) ) { |
|
83 | - $view->item = \Aimeos\MShop::create( $this->getContext(), 'cms' )->create(); |
|
82 | + if (!isset($view->item)) { |
|
83 | + $view->item = \Aimeos\MShop::create($this->getContext(), 'cms')->create(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $data['cms.siteid'] = $view->item->getSiteId(); |
87 | 87 | |
88 | - $view->itemData = array_replace_recursive( $this->toArray( $view->item ), $data ); |
|
88 | + $view->itemData = array_replace_recursive($this->toArray($view->item), $data); |
|
89 | 89 | $view->itemBody = parent::create(); |
90 | 90 | } |
91 | - catch( \Exception $e ) |
|
91 | + catch (\Exception $e) |
|
92 | 92 | { |
93 | - $this->report( $e, 'create' ); |
|
93 | + $this->report($e, 'create'); |
|
94 | 94 | } |
95 | 95 | |
96 | - return $this->render( $view ); |
|
96 | + return $this->render($view); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -106,34 +106,34 @@ discard block |
||
106 | 106 | { |
107 | 107 | $view = $this->getView(); |
108 | 108 | |
109 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
109 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
110 | 110 | $manager->begin(); |
111 | 111 | |
112 | 112 | try |
113 | 113 | { |
114 | - if( ( $ids = $view->param( 'id' ) ) === null ) { |
|
115 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
114 | + if (($ids = $view->param('id')) === null) { |
|
115 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
116 | 116 | } |
117 | 117 | |
118 | - $search = $manager->filter()->slice( 0, count( (array) $ids ) ); |
|
119 | - $search->setConditions( $search->compare( '==', 'cms.id', $ids ) ); |
|
120 | - $items = $manager->search( $search, $this->getDomains() ); |
|
118 | + $search = $manager->filter()->slice(0, count((array) $ids)); |
|
119 | + $search->setConditions($search->compare('==', 'cms.id', $ids)); |
|
120 | + $items = $manager->search($search, $this->getDomains()); |
|
121 | 121 | |
122 | - foreach( $items as $item ) |
|
122 | + foreach ($items as $item) |
|
123 | 123 | { |
124 | 124 | $view->item = $item; |
125 | 125 | parent::delete(); |
126 | 126 | } |
127 | 127 | |
128 | - $manager->delete( $items->toArray() ); |
|
128 | + $manager->delete($items->toArray()); |
|
129 | 129 | $manager->commit(); |
130 | 130 | |
131 | - return $this->redirect( 'cms', 'search', null, 'delete' ); |
|
131 | + return $this->redirect('cms', 'search', null, 'delete'); |
|
132 | 132 | } |
133 | - catch( \Exception $e ) |
|
133 | + catch (\Exception $e) |
|
134 | 134 | { |
135 | 135 | $manager->rollback(); |
136 | - $this->report( $e, 'delete' ); |
|
136 | + $this->report($e, 'delete'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $this->search(); |
@@ -147,26 +147,26 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function get() : ?string |
149 | 149 | { |
150 | - $view = $this->getObject()->addData( $this->getView() ); |
|
150 | + $view = $this->getObject()->addData($this->getView()); |
|
151 | 151 | |
152 | 152 | try |
153 | 153 | { |
154 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
155 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
154 | + if (($id = $view->param('id')) === null) { |
|
155 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
156 | 156 | } |
157 | 157 | |
158 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
158 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
159 | 159 | |
160 | - $view->item = $manager->get( $id, $this->getDomains() ); |
|
161 | - $view->itemData = $this->toArray( $view->item ); |
|
160 | + $view->item = $manager->get($id, $this->getDomains()); |
|
161 | + $view->itemData = $this->toArray($view->item); |
|
162 | 162 | $view->itemBody = parent::get(); |
163 | 163 | } |
164 | - catch( \Exception $e ) |
|
164 | + catch (\Exception $e) |
|
165 | 165 | { |
166 | - $this->report( $e, 'get' ); |
|
166 | + $this->report($e, 'get'); |
|
167 | 167 | } |
168 | 168 | |
169 | - return $this->render( $view ); |
|
169 | + return $this->render($view); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -179,24 +179,24 @@ discard block |
||
179 | 179 | { |
180 | 180 | $view = $this->getView(); |
181 | 181 | |
182 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
182 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
183 | 183 | $manager->begin(); |
184 | 184 | |
185 | 185 | try |
186 | 186 | { |
187 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
188 | - $view->item = $item->getId() ? $item : $manager->save( $item ); |
|
187 | + $item = $this->fromArray($view->param('item', [])); |
|
188 | + $view->item = $item->getId() ? $item : $manager->save($item); |
|
189 | 189 | $view->itemBody = parent::save(); |
190 | 190 | |
191 | - $manager->save( clone $view->item ); |
|
191 | + $manager->save(clone $view->item); |
|
192 | 192 | $manager->commit(); |
193 | 193 | |
194 | - return $this->redirect( 'cms', $view->param( 'next' ), $view->item->getId(), 'save' ); |
|
194 | + return $this->redirect('cms', $view->param('next'), $view->item->getId(), 'save'); |
|
195 | 195 | } |
196 | - catch( \Exception $e ) |
|
196 | + catch (\Exception $e) |
|
197 | 197 | { |
198 | 198 | $manager->rollback(); |
199 | - $this->report( $e, 'save' ); |
|
199 | + $this->report($e, 'save'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $this->create(); |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | try |
216 | 216 | { |
217 | 217 | $total = 0; |
218 | - $params = $this->storeSearchParams( $view->param(), 'cms' ); |
|
219 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
220 | - $search = $this->initCriteria( $manager->filter()->order( 'cms.url' ), $params ); |
|
218 | + $params = $this->storeSearchParams($view->param(), 'cms'); |
|
219 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
220 | + $search = $this->initCriteria($manager->filter()->order('cms.url'), $params); |
|
221 | 221 | |
222 | - $view->items = $manager->search( $search, $this->getDomains(), $total ); |
|
223 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
222 | + $view->items = $manager->search($search, $this->getDomains(), $total); |
|
223 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
224 | 224 | $view->filterOperators = $search->getOperators(); |
225 | 225 | $view->itemBody = parent::search(); |
226 | 226 | $view->total = $total; |
227 | 227 | } |
228 | - catch( \Exception $e ) |
|
228 | + catch (\Exception $e) |
|
229 | 229 | { |
230 | - $this->report( $e, 'search' ); |
|
230 | + $this->report($e, 'search'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** admin/jqadm/cms/template-list |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $tplconf = 'admin/jqadm/cms/template-list'; |
253 | 253 | $default = 'cms/list-standard'; |
254 | 254 | |
255 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
255 | + return $view->render($view->config($tplconf, $default)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param string|null $name Name of the sub-client (Default if null) |
264 | 264 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
265 | 265 | */ |
266 | - public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
266 | + public function getSubClient(string $type, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
267 | 267 | { |
268 | 268 | /** admin/jqadm/cms/decorators/excludes |
269 | 269 | * Excludes decorators added by the "common" option from the cms JQAdm client |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @see admin/jqadm/cms/decorators/excludes |
339 | 339 | * @see admin/jqadm/cms/decorators/global |
340 | 340 | */ |
341 | - return $this->createSubClient( 'cms/' . $type, $name ); |
|
341 | + return $this->createSubClient('cms/' . $type, $name); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @since 2020.10 |
361 | 361 | * @category Developer |
362 | 362 | */ |
363 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/cms/domains', [] ); |
|
363 | + return $this->getContext()->getConfig()->get('admin/jqadm/cms/domains', []); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @since 2020.10 |
405 | 405 | * @category Developer |
406 | 406 | */ |
407 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/cms/subparts', [] ); |
|
407 | + return $this->getContext()->getConfig()->get('admin/jqadm/cms/subparts', []); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -414,17 +414,17 @@ discard block |
||
414 | 414 | * @param array $data Data array |
415 | 415 | * @return \Aimeos\MShop\Cms\Item\Iface New cms item object |
416 | 416 | */ |
417 | - protected function fromArray( array $data ) : \Aimeos\MShop\Cms\Item\Iface |
|
417 | + protected function fromArray(array $data) : \Aimeos\MShop\Cms\Item\Iface |
|
418 | 418 | { |
419 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'cms' ); |
|
419 | + $manager = \Aimeos\MShop::create($this->getContext(), 'cms'); |
|
420 | 420 | |
421 | - if( isset( $data['cms.id'] ) && $data['cms.id'] != '' ) { |
|
422 | - $item = $manager->get( $data['cms.id'], $this->getDomains() ); |
|
421 | + if (isset($data['cms.id']) && $data['cms.id'] != '') { |
|
422 | + $item = $manager->get($data['cms.id'], $this->getDomains()); |
|
423 | 423 | } else { |
424 | 424 | $item = $manager->create(); |
425 | 425 | } |
426 | 426 | |
427 | - $item->fromArray( $data, true ); |
|
427 | + $item->fromArray($data, true); |
|
428 | 428 | |
429 | 429 | return $item; |
430 | 430 | } |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | * @param \Aimeos\MShop\Cms\Item\Iface $item Cms item object |
437 | 437 | * @return string[] Multi-dimensional associative list of item data |
438 | 438 | */ |
439 | - protected function toArray( \Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false ) : array |
|
439 | + protected function toArray(\Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false) : array |
|
440 | 440 | { |
441 | - $data = $item->toArray( true ); |
|
441 | + $data = $item->toArray(true); |
|
442 | 442 | |
443 | - if( $copy === true ) |
|
443 | + if ($copy === true) |
|
444 | 444 | { |
445 | 445 | $data['cms.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
446 | 446 | $data['cms.url'] = $data['cms.url'] . '_copy'; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
458 | 458 | * @return string HTML output |
459 | 459 | */ |
460 | - protected function render( \Aimeos\MW\View\Iface $view ) : string |
|
460 | + protected function render(\Aimeos\MW\View\Iface $view) : string |
|
461 | 461 | { |
462 | 462 | /** admin/jqadm/cms/template-item |
463 | 463 | * Relative path to the HTML body template for the cms item. |
@@ -481,6 +481,6 @@ discard block |
||
481 | 481 | $tplconf = 'admin/jqadm/cms/template-item'; |
482 | 482 | $default = 'cms/item-standard'; |
483 | 483 | |
484 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
484 | + return $view->render($view->config($tplconf, $default)); |
|
485 | 485 | } |
486 | 486 | } |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $view->itemData = $this->toArray( $view->item, true ); |
58 | 58 | $view->itemBody = parent::copy(); |
59 | - } |
|
60 | - catch( \Exception $e ) |
|
59 | + } catch( \Exception $e ) |
|
61 | 60 | { |
62 | 61 | $this->report( $e, 'copy' ); |
63 | 62 | } |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | |
88 | 87 | $view->itemData = array_replace_recursive( $this->toArray( $view->item ), $data ); |
89 | 88 | $view->itemBody = parent::create(); |
90 | - } |
|
91 | - catch( \Exception $e ) |
|
89 | + } catch( \Exception $e ) |
|
92 | 90 | { |
93 | 91 | $this->report( $e, 'create' ); |
94 | 92 | } |
@@ -129,8 +127,7 @@ discard block |
||
129 | 127 | $manager->commit(); |
130 | 128 | |
131 | 129 | return $this->redirect( 'cms', 'search', null, 'delete' ); |
132 | - } |
|
133 | - catch( \Exception $e ) |
|
130 | + } catch( \Exception $e ) |
|
134 | 131 | { |
135 | 132 | $manager->rollback(); |
136 | 133 | $this->report( $e, 'delete' ); |
@@ -160,8 +157,7 @@ discard block |
||
160 | 157 | $view->item = $manager->get( $id, $this->getDomains() ); |
161 | 158 | $view->itemData = $this->toArray( $view->item ); |
162 | 159 | $view->itemBody = parent::get(); |
163 | - } |
|
164 | - catch( \Exception $e ) |
|
160 | + } catch( \Exception $e ) |
|
165 | 161 | { |
166 | 162 | $this->report( $e, 'get' ); |
167 | 163 | } |
@@ -192,8 +188,7 @@ discard block |
||
192 | 188 | $manager->commit(); |
193 | 189 | |
194 | 190 | return $this->redirect( 'cms', $view->param( 'next' ), $view->item->getId(), 'save' ); |
195 | - } |
|
196 | - catch( \Exception $e ) |
|
191 | + } catch( \Exception $e ) |
|
197 | 192 | { |
198 | 193 | $manager->rollback(); |
199 | 194 | $this->report( $e, 'save' ); |
@@ -224,8 +219,7 @@ discard block |
||
224 | 219 | $view->filterOperators = $search->getOperators(); |
225 | 220 | $view->itemBody = parent::search(); |
226 | 221 | $view->total = $total; |
227 | - } |
|
228 | - catch( \Exception $e ) |
|
222 | + } catch( \Exception $e ) |
|
229 | 223 | { |
230 | 224 | $this->report( $e, 'search' ); |
231 | 225 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Cms\Content; |
12 | 12 | |
13 | -sprintf( 'content' ); // for translation |
|
13 | +sprintf('content'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() : ?string |
44 | 44 | { |
45 | - $view = $this->getObject()->addData( $this->getView() ); |
|
46 | - $view->contentData = $this->toArray( $view->item, true ); |
|
45 | + $view = $this->getObject()->addData($this->getView()); |
|
46 | + $view->contentData = $this->toArray($view->item, true); |
|
47 | 47 | $view->contentBody = parent::copy(); |
48 | 48 | |
49 | - return $this->render( $view ); |
|
49 | + return $this->render($view); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function create() : ?string |
59 | 59 | { |
60 | - $view = $this->getObject()->addData( $this->getView() ); |
|
60 | + $view = $this->getObject()->addData($this->getView()); |
|
61 | 61 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
62 | - $data = $view->param( 'content', [] ); |
|
62 | + $data = $view->param('content', []); |
|
63 | 63 | |
64 | - foreach( $data as $idx => $entry ) |
|
64 | + foreach ($data as $idx => $entry) |
|
65 | 65 | { |
66 | 66 | $data[$idx]['cms.lists.siteid'] = $siteid; |
67 | 67 | $data[$idx]['text.siteid'] = $siteid; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $view->contentData = $data; |
71 | 71 | $view->contentBody = parent::create(); |
72 | 72 | |
73 | - return $this->render( $view ); |
|
73 | + return $this->render($view); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | parent::delete(); |
85 | 85 | |
86 | 86 | $item = $this->getView()->item; |
87 | - $item->deleteListItems( $item->getListItems( 'text', null, 'content', false )->toArray(), true ); |
|
87 | + $item->deleteListItems($item->getListItems('text', null, 'content', false)->toArray(), true); |
|
88 | 88 | |
89 | 89 | return null; |
90 | 90 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function get() : ?string |
99 | 99 | { |
100 | - $view = $this->getObject()->addData( $this->getView() ); |
|
101 | - $view->contentData = $this->toArray( $view->item ); |
|
100 | + $view = $this->getObject()->addData($this->getView()); |
|
101 | + $view->contentData = $this->toArray($view->item); |
|
102 | 102 | $view->contentBody = parent::get(); |
103 | 103 | |
104 | - return $this->render( $view ); |
|
104 | + return $this->render($view); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $view = $this->getView(); |
116 | 116 | |
117 | - $view->item = $this->fromArray( $view->item, $view->param( 'content', [] ) ); |
|
117 | + $view->item = $this->fromArray($view->item, $view->param('content', [])); |
|
118 | 118 | $view->contentBody = parent::save(); |
119 | 119 | |
120 | 120 | return null; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string|null $name Name of the sub-client (Default if null) |
129 | 129 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
130 | 130 | */ |
131 | - public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
131 | + public function getSubClient(string $type, string $name = null) : \Aimeos\Admin\JQAdm\Iface |
|
132 | 132 | { |
133 | 133 | /** admin/jqadm/cms/content/decorators/excludes |
134 | 134 | * Excludes decorators added by the "common" option from the cms JQAdm client |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @see admin/jqadm/cms/content/decorators/excludes |
204 | 204 | * @see admin/jqadm/cms/content/decorators/global |
205 | 205 | */ |
206 | - return $this->createSubClient( 'cms/content/' . $type, $name ); |
|
206 | + return $this->createSubClient('cms/content/' . $type, $name); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @since 2020.10 |
248 | 248 | * @category Developer |
249 | 249 | */ |
250 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/cms/content/subparts', [] ); |
|
250 | + return $this->getContext()->getConfig()->get('admin/jqadm/cms/content/subparts', []); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,16 +257,16 @@ discard block |
||
257 | 257 | * @param \Aimeos\MW\View\Iface $view View object |
258 | 258 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
259 | 259 | */ |
260 | - public function addData( \Aimeos\MW\View\Iface $view ) : \Aimeos\MW\View\Iface |
|
260 | + public function addData(\Aimeos\MW\View\Iface $view) : \Aimeos\MW\View\Iface |
|
261 | 261 | { |
262 | 262 | $context = $this->getContext(); |
263 | - $listTypeManager = \Aimeos\MShop::create( $context, 'cms/lists/type' ); |
|
263 | + $listTypeManager = \Aimeos\MShop::create($context, 'cms/lists/type'); |
|
264 | 264 | |
265 | - $listSearch = $listTypeManager->filter( true )->slice( 0, 10000 ); |
|
266 | - $listSearch->setConditions( $listSearch->compare( '==', 'cms.lists.type.domain', 'text' ) ); |
|
267 | - $listSearch->setSortations( [$listSearch->sort( '+', 'cms.lists.type.position' )] ); |
|
265 | + $listSearch = $listTypeManager->filter(true)->slice(0, 10000); |
|
266 | + $listSearch->setConditions($listSearch->compare('==', 'cms.lists.type.domain', 'text')); |
|
267 | + $listSearch->setSortations([$listSearch->sort('+', 'cms.lists.type.position')]); |
|
268 | 268 | |
269 | - $view->contentListTypes = $listTypeManager->search( $listSearch ); |
|
269 | + $view->contentListTypes = $listTypeManager->search($listSearch); |
|
270 | 270 | |
271 | 271 | return $view; |
272 | 272 | } |
@@ -279,51 +279,51 @@ discard block |
||
279 | 279 | * @param array $data Data array |
280 | 280 | * @return \Aimeos\MShop\Cms\Item\Iface Modified cms item |
281 | 281 | */ |
282 | - protected function fromArray( \Aimeos\MShop\Cms\Item\Iface $item, array $data ) : \Aimeos\MShop\Cms\Item\Iface |
|
282 | + protected function fromArray(\Aimeos\MShop\Cms\Item\Iface $item, array $data) : \Aimeos\MShop\Cms\Item\Iface |
|
283 | 283 | { |
284 | 284 | $context = $this->getContext(); |
285 | 285 | |
286 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
287 | - $listManager = \Aimeos\MShop::create( $context, 'cms/lists' ); |
|
286 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
287 | + $listManager = \Aimeos\MShop::create($context, 'cms/lists'); |
|
288 | 288 | |
289 | - $listItems = $item->getListItems( 'text', null, 'content', false ); |
|
289 | + $listItems = $item->getListItems('text', null, 'content', false); |
|
290 | 290 | |
291 | - foreach( $data as $idx => $entry ) |
|
291 | + foreach ($data as $idx => $entry) |
|
292 | 292 | { |
293 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
293 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $listType = $entry['cms.lists.type'] ?? 'default'; |
298 | 298 | |
299 | - if( ( $listItem = $item->getListItem( 'text', $listType, $entry['text.id'], false ) ) === null ) { |
|
299 | + if (($listItem = $item->getListItem('text', $listType, $entry['text.id'], false)) === null) { |
|
300 | 300 | $listItem = $listManager->create(); |
301 | 301 | } |
302 | 302 | |
303 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
303 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
304 | 304 | $refItem = $textManager->create(); |
305 | 305 | } |
306 | 306 | |
307 | - $refItem->fromArray( $entry, true )->setType( 'content' ); |
|
307 | + $refItem->fromArray($entry, true)->setType('content'); |
|
308 | 308 | $conf = []; |
309 | 309 | |
310 | - foreach( (array) $this->getValue( $entry, 'config', [] ) as $cfg ) |
|
310 | + foreach ((array) $this->getValue($entry, 'config', []) as $cfg) |
|
311 | 311 | { |
312 | - if( ( $key = trim( $cfg['key'] ?? '' ) ) !== '' ) { |
|
313 | - $conf[$key] = trim( $cfg['val'] ?? '' ); |
|
312 | + if (($key = trim($cfg['key'] ?? '')) !== '') { |
|
313 | + $conf[$key] = trim($cfg['val'] ?? ''); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | - $listItem->fromArray( $entry, true ); |
|
318 | - $listItem->setPosition( $idx ); |
|
319 | - $listItem->setConfig( $conf ); |
|
317 | + $listItem->fromArray($entry, true); |
|
318 | + $listItem->setPosition($idx); |
|
319 | + $listItem->setConfig($conf); |
|
320 | 320 | |
321 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
321 | + $item->addListItem('text', $listItem, $refItem); |
|
322 | 322 | |
323 | - unset( $listItems[$listItem->getId()] ); |
|
323 | + unset($listItems[$listItem->getId()]); |
|
324 | 324 | } |
325 | 325 | |
326 | - return $item->deleteListItems( $listItems->toArray(), true ); |
|
326 | + return $item->deleteListItems($listItems->toArray(), true); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -334,20 +334,20 @@ discard block |
||
334 | 334 | * @param bool $copy True if items should be copied, false if not |
335 | 335 | * @return string[] Multi-dimensional associative list of item data |
336 | 336 | */ |
337 | - protected function toArray( \Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false ) : array |
|
337 | + protected function toArray(\Aimeos\MShop\Cms\Item\Iface $item, bool $copy = false) : array |
|
338 | 338 | { |
339 | 339 | $data = []; |
340 | 340 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
341 | 341 | |
342 | - foreach( $item->getListItems( 'text', null, 'content', false ) as $listItem ) |
|
342 | + foreach ($item->getListItems('text', null, 'content', false) as $listItem) |
|
343 | 343 | { |
344 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
344 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
345 | 345 | continue; |
346 | 346 | } |
347 | 347 | |
348 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
348 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
349 | 349 | |
350 | - if( $copy === true ) |
|
350 | + if ($copy === true) |
|
351 | 351 | { |
352 | 352 | $list['cms.lists.siteid'] = $siteId; |
353 | 353 | $list['cms.lists.id'] = ''; |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | $list['text.id'] = null; |
356 | 356 | } |
357 | 357 | |
358 | - $list['cms.lists.datestart'] = str_replace( ' ', 'T', $list['cms.lists.datestart'] ); |
|
359 | - $list['cms.lists.dateend'] = str_replace( ' ', 'T', $list['cms.lists.dateend'] ); |
|
358 | + $list['cms.lists.datestart'] = str_replace(' ', 'T', $list['cms.lists.datestart']); |
|
359 | + $list['cms.lists.dateend'] = str_replace(' ', 'T', $list['cms.lists.dateend']); |
|
360 | 360 | $list['config'] = []; |
361 | 361 | |
362 | - foreach( $listItem->getConfig() as $key => $value ) { |
|
362 | + foreach ($listItem->getConfig() as $key => $value) { |
|
363 | 363 | $list['config'][] = ['key' => $key, 'val' => $value]; |
364 | 364 | } |
365 | 365 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
377 | 377 | * @return string HTML output |
378 | 378 | */ |
379 | - protected function render( \Aimeos\MW\View\Iface $view ) : string |
|
379 | + protected function render(\Aimeos\MW\View\Iface $view) : string |
|
380 | 380 | { |
381 | 381 | /** admin/jqadm/cms/content/template-item |
382 | 382 | * Relative path to the HTML body template of the content subpart for cmss. |
@@ -400,6 +400,6 @@ discard block |
||
400 | 400 | $tplconf = 'admin/jqadm/cms/content/template-item'; |
401 | 401 | $default = 'cms/item-content-standard'; |
402 | 402 | |
403 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
403 | + return $view->render($view->config($tplconf, $default)); |
|
404 | 404 | } |
405 | 405 | } |