Completed
Push — master ( 758f3f...99b1ff )
by Aimeos
02:48
created
src/Aimeos/Shop/Controller/JqadmController.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 * @param integer $id Unique resource ID
34 34
 	 * @return string Generated output
35 35
 	 */
36
-	public function copyAction( $site = 'default', $resource, $id )
36
+	public function copyAction($site = 'default', $resource, $id)
37 37
 	{
38
-		if( config( 'shop.authorize', true ) ) {
39
-			$this->authorize( 'admin' );
38
+		if (config('shop.authorize', true)) {
39
+			$this->authorize('admin');
40 40
 		}
41 41
 
42
-		$cntl = $this->createClient( $site, $resource );
43
-		$content = $cntl->copy( $id );
42
+		$cntl = $this->createClient($site, $resource);
43
+		$content = $cntl->copy($id);
44 44
 
45
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
45
+		return \View::make('shop::admin.jqadm', array('content' => $content));
46 46
 	}
47 47
 
48 48
 
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 	 * @param string $sitecode Unique site code
54 54
 	 * @return string Generated output
55 55
 	 */
56
-	public function createAction( $site = 'default', $resource )
56
+	public function createAction($site = 'default', $resource)
57 57
 	{
58
-		if( config( 'shop.authorize', true ) ) {
59
-			$this->authorize( 'admin' );
58
+		if (config('shop.authorize', true)) {
59
+			$this->authorize('admin');
60 60
 		}
61 61
 
62
-		$cntl = $this->createClient( $site, $resource );
63
-		$content = $cntl->create( $id );
62
+		$cntl = $this->createClient($site, $resource);
63
+		$content = $cntl->create($id);
64 64
 
65
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
65
+		return \View::make('shop::admin.jqadm', array('content' => $content));
66 66
 	}
67 67
 
68 68
 
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	 * @param integer $id Unique resource ID
75 75
 	 * @return string Generated output
76 76
 	 */
77
-	public function deleteAction( $site = 'default', $resource, $id )
77
+	public function deleteAction($site = 'default', $resource, $id)
78 78
 	{
79
-		if( config( 'shop.authorize', true ) ) {
80
-			$this->authorize( 'admin' );
79
+		if (config('shop.authorize', true)) {
80
+			$this->authorize('admin');
81 81
 		}
82 82
 
83
-		$cntl = $this->createClient( $site, $resource );
84
-		$content = ( $cntl->delete( $id ) ? : $cntl->search() );
83
+		$cntl = $this->createClient($site, $resource);
84
+		$content = ($cntl->delete($id) ?: $cntl->search());
85 85
 
86
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
86
+		return \View::make('shop::admin.jqadm', array('content' => $content));
87 87
 	}
88 88
 
89 89
 
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 * @param integer $id Unique resource ID
96 96
 	 * @return string Generated output
97 97
 	 */
98
-	public function getAction( $site = 'default', $resource, $id )
98
+	public function getAction($site = 'default', $resource, $id)
99 99
 	{
100
-		if( config( 'shop.authorize', true ) ) {
101
-			$this->authorize( 'admin' );
100
+		if (config('shop.authorize', true)) {
101
+			$this->authorize('admin');
102 102
 		}
103 103
 
104
-		$cntl = $this->createClient( $site, $resource );
105
-		$content = $cntl->get( $id );
104
+		$cntl = $this->createClient($site, $resource);
105
+		$content = $cntl->get($id);
106 106
 
107
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
107
+		return \View::make('shop::admin.jqadm', array('content' => $content));
108 108
 	}
109 109
 
110 110
 
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
 	 * @param string $sitecode Unique site code
116 116
 	 * @return string Generated output
117 117
 	 */
118
-	public function saveAction( $site = 'default', $resource )
118
+	public function saveAction($site = 'default', $resource)
119 119
 	{
120
-		if( config( 'shop.authorize', true ) ) {
121
-			$this->authorize( 'admin' );
120
+		if (config('shop.authorize', true)) {
121
+			$this->authorize('admin');
122 122
 		}
123 123
 
124
-		$cntl = $this->createClient( $site, $resource );
125
-		$content = ( $cntl->save() ? : $cntl->search() );
124
+		$cntl = $this->createClient($site, $resource);
125
+		$content = ($cntl->save() ?: $cntl->search());
126 126
 
127
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
127
+		return \View::make('shop::admin.jqadm', array('content' => $content));
128 128
 	}
129 129
 
130 130
 
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
 	 * @param string $sitecode Unique site code
136 136
 	 * @return string Generated output
137 137
 	 */
138
-	public function searchAction( $site = 'default', $resource )
138
+	public function searchAction($site = 'default', $resource)
139 139
 	{
140
-		if( config( 'shop.authorize', true ) ) {
141
-			$this->authorize( 'admin' );
140
+		if (config('shop.authorize', true)) {
141
+			$this->authorize('admin');
142 142
 		}
143 143
 
144
-		$cntl = $this->createClient( $site, $resource );
144
+		$cntl = $this->createClient($site, $resource);
145 145
 		$content = $cntl->search();
146 146
 
147
-		return \View::make('shop::admin.jqadm', array( 'content' => $content ) );
147
+		return \View::make('shop::admin.jqadm', array('content' => $content));
148 148
 	}
149 149
 
150 150
 
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
 	 * @param string $sitecode Unique site code
155 155
 	 * @return \Aimeos\MShop\Context\Item\Iface Context item
156 156
 	 */
157
-	protected function createClient( $sitecode, $resource )
157
+	protected function createClient($sitecode, $resource)
158 158
 	{
159
-		$lang = \Input::get( 'lang', config( 'app.locale', 'en' ) );
159
+		$lang = \Input::get('lang', config('app.locale', 'en'));
160 160
 
161
-		$aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get();
162
-		$templatePaths = $aimeos->getCustomPaths( 'client/jqadm/templates' );
161
+		$aimeos = app('\Aimeos\Shop\Base\Aimeos')->get();
162
+		$templatePaths = $aimeos->getCustomPaths('client/jqadm/templates');
163 163
 
164
-		$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
165
-		$context = $this->setLocale( $context, $sitecode, $lang );
164
+		$context = app('\Aimeos\Shop\Base\Context')->get(false);
165
+		$context = $this->setLocale($context, $sitecode, $lang);
166 166
 
167
-		$view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang );
168
-		$context->setView( $view );
167
+		$view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang);
168
+		$context->setView($view);
169 169
 
170
-		return \Aimeos\Client\JQAdm\Factory::createClient( $context, $templatePaths, $resource );
170
+		return \Aimeos\Client\JQAdm\Factory::createClient($context, $templatePaths, $resource);
171 171
 	}
172 172
 
173 173
 
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
 	 * @param string $lang ISO language code, e.g. "en" or "en_GB"
180 180
 	 * @return \Aimeos\MShop\Context\Item\Iface Modified context object
181 181
 	 */
182
-	protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang )
182
+	protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang)
183 183
 	{
184
-		$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
184
+		$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
185 185
 
186 186
 		try
187 187
 		{
188
-			$localeItem = $localeManager->bootstrap( $sitecode, '', '', false );
189
-			$localeItem->setLanguageId( null );
190
-			$localeItem->setCurrencyId( null );
188
+			$localeItem = $localeManager->bootstrap($sitecode, '', '', false);
189
+			$localeItem->setLanguageId(null);
190
+			$localeItem->setCurrencyId(null);
191 191
 		}
192
-		catch( \Aimeos\MShop\Locale\Exception $e )
192
+		catch (\Aimeos\MShop\Locale\Exception $e)
193 193
 		{
194 194
 			$localeItem = $localeManager->createItem();
195 195
 		}
196 196
 
197
-		$context->setLocale( $localeItem );
198
-		$context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) );
197
+		$context->setLocale($localeItem);
198
+		$context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang)));
199 199
 
200 200
 		return $context;
201 201
 	}
Please login to merge, or discard this patch.
src/routes.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 
3 3
 Route::group(config('shop.routes.admin', ['middleware' => 'auth']), function() {
4 4
 
5
-	Route::match( array( 'GET' ), 'admin/file', array(
5
+	Route::match(array('GET'), 'admin/file', array(
6 6
 		'as' => 'aimeos_shop_admin_file',
7 7
 		'uses' => 'Aimeos\Shop\Controller\AdminController@fileAction'
8 8
 	));
9
-	Route::match( array( 'POST' ), 'admin/do', array(
9
+	Route::match(array('POST'), 'admin/do', array(
10 10
 		'as' => 'aimeos_shop_admin_json',
11 11
 		'uses' => 'Aimeos\Shop\Controller\AdminController@doAction'
12 12
 	));
13
-	Route::match( array( 'GET' ), 'admin', array(
13
+	Route::match(array('GET'), 'admin', array(
14 14
 		'as' => 'aimeos_shop_admin',
15 15
 		'uses' => 'Aimeos\Shop\Controller\AdminController@indexAction'
16 16
 	));
@@ -20,85 +20,85 @@  discard block
 block discarded – undo
20 20
 
21 21
 Route::group(config('shop.routes.jqadm', ['middleware' => 'auth']), function() {
22 22
 
23
-	Route::match( array( 'GET', 'POST' ), 'jqadm/copy/{resource}/{id}', array(
23
+	Route::match(array('GET', 'POST'), 'jqadm/copy/{resource}/{id}', array(
24 24
 		'as' => 'aimeos_shop_jqadm_copy',
25 25
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@copyAction'
26
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
26
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
27 27
 
28
-	Route::match( array( 'GET', 'POST' ), 'jqadm/create/{resource}', array(
28
+	Route::match(array('GET', 'POST'), 'jqadm/create/{resource}', array(
29 29
 		'as' => 'aimeos_shop_jqadm_create',
30 30
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@createAction'
31
-	))->where( array( 'resource' => '[^0-9]+' ) );
31
+	))->where(array('resource' => '[^0-9]+'));
32 32
 
33
-	Route::match( array( 'GET', 'POST' ), 'jqadm/delete/{resource}/{id}', array(
33
+	Route::match(array('GET', 'POST'), 'jqadm/delete/{resource}/{id}', array(
34 34
 		'as' => 'aimeos_shop_jqadm_delete',
35 35
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@deleteAction'
36
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
36
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
37 37
 
38
-	Route::match( array( 'GET' ), 'jqadm/get/{resource}/{id}', array(
38
+	Route::match(array('GET'), 'jqadm/get/{resource}/{id}', array(
39 39
 		'as' => 'aimeos_shop_jqadm_get',
40 40
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@getAction'
41
-	))->where( array( 'resource' => '[^0-9]*', 'id' => '[0-9]*' ) );
41
+	))->where(array('resource' => '[^0-9]*', 'id' => '[0-9]*'));
42 42
 
43
-	Route::match( array( 'POST' ), 'jqadm/save/{resource}', array(
43
+	Route::match(array('POST'), 'jqadm/save/{resource}', array(
44 44
 		'as' => 'aimeos_shop_jqadm_save',
45 45
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@saveAction'
46
-	))->where( array( 'resource' => '[^0-9]+' ) );
46
+	))->where(array('resource' => '[^0-9]+'));
47 47
 
48
-	Route::match( array( 'GET', 'POST' ), 'jqadm/search/{resource}', array(
48
+	Route::match(array('GET', 'POST'), 'jqadm/search/{resource}', array(
49 49
 		'as' => 'aimeos_shop_jqadm_search',
50 50
 		'uses' => 'Aimeos\Shop\Controller\JqadmController@searchAction'
51
-	))->where( array( 'resource' => '[^0-9]+' ) );
51
+	))->where(array('resource' => '[^0-9]+'));
52 52
 
53 53
 });
54 54
 
55 55
 
56 56
 Route::group(config('shop.routes.jsonadm', ['middleware' => 'auth']), function() {
57 57
 
58
-	Route::match( array( 'DELETE' ), 'jsonadm/{resource}/{id?}', array(
58
+	Route::match(array('DELETE'), 'jsonadm/{resource}/{id?}', array(
59 59
 		'as' => 'aimeos_shop_jsonadm_delete',
60 60
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@deleteAction'
61
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
61
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
62 62
 
63
-	Route::match( array( 'GET' ), 'jsonadm/{resource}/{id?}', array(
63
+	Route::match(array('GET'), 'jsonadm/{resource}/{id?}', array(
64 64
 		'as' => 'aimeos_shop_jsonadm_get',
65 65
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@getAction'
66
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
66
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
67 67
 
68
-	Route::match( array( 'PATCH' ), 'jsonadm/{resource}/{id?}', array(
68
+	Route::match(array('PATCH'), 'jsonadm/{resource}/{id?}', array(
69 69
 		'as' => 'aimeos_shop_jsonadm_patch',
70 70
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@patchAction'
71
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
71
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
72 72
 
73
-	Route::match( array( 'POST' ), 'jsonadm/{resource}/{id?}', array(
73
+	Route::match(array('POST'), 'jsonadm/{resource}/{id?}', array(
74 74
 		'as' => 'aimeos_shop_jsonadm_post',
75 75
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@postAction'
76
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
76
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
77 77
 
78
-	Route::match( array( 'PUT' ), 'jsonadm/{resource}/{id?}', array(
78
+	Route::match(array('PUT'), 'jsonadm/{resource}/{id?}', array(
79 79
 		'as' => 'aimeos_shop_jsonadm_put',
80 80
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@putAction'
81
-	))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) );
81
+	))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*'));
82 82
 
83
-	Route::match( array( 'OPTIONS' ), 'jsonadm/{resource?}', array(
83
+	Route::match(array('OPTIONS'), 'jsonadm/{resource?}', array(
84 84
 		'as' => 'aimeos_shop_jsonadm_options',
85 85
 		'uses' => 'Aimeos\Shop\Controller\JsonadmController@optionsAction'
86
-	))->where( array( 'resource' => '[^0-9]*' ) );
86
+	))->where(array('resource' => '[^0-9]*'));
87 87
 
88 88
 });
89 89
 
90 90
 
91 91
 Route::group(config('shop.routes.account', ['middleware' => 'auth']), function() {
92 92
 
93
-	Route::match( array( 'GET', 'POST' ), 'myaccount', array(
93
+	Route::match(array('GET', 'POST'), 'myaccount', array(
94 94
 		'as' => 'aimeos_shop_account',
95 95
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
96 96
 	));
97
-	Route::match( array( 'GET', 'POST' ), 'myaccount/favorite/{fav_action?}/{fav_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
97
+	Route::match(array('GET', 'POST'), 'myaccount/favorite/{fav_action?}/{fav_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
98 98
 		'as' => 'aimeos_shop_account_favorite',
99 99
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
100 100
 	));
101
-	Route::match( array( 'GET', 'POST' ), 'myaccount/watch/{wat_action?}/{wat_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
101
+	Route::match(array('GET', 'POST'), 'myaccount/watch/{wat_action?}/{wat_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
102 102
 		'as' => 'aimeos_shop_account_watch',
103 103
 		'uses' => 'Aimeos\Shop\Controller\AccountController@indexAction'
104 104
 	));
@@ -108,45 +108,45 @@  discard block
 block discarded – undo
108 108
 
109 109
 Route::group(config('shop.routes.default', []), function() {
110 110
 
111
-	Route::match( array( 'GET', 'POST' ), 'basket', array(
111
+	Route::match(array('GET', 'POST'), 'basket', array(
112 112
 		'as' => 'aimeos_shop_basket',
113 113
 		'uses' => 'Aimeos\Shop\Controller\BasketController@indexAction'
114 114
 	));
115 115
 
116
-	Route::match( array( 'GET', 'POST' ), 'count', array(
116
+	Route::match(array('GET', 'POST'), 'count', array(
117 117
 		'as' => 'aimeos_shop_count',
118 118
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@countAction'
119 119
 	));
120
-	Route::match( array( 'GET', 'POST' ), 'detail/{d_prodid}/{d_name?}/{l_pos?}', array(
120
+	Route::match(array('GET', 'POST'), 'detail/{d_prodid}/{d_name?}/{l_pos?}', array(
121 121
 		'as' => 'aimeos_shop_detail',
122 122
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@detailAction'
123 123
 	));
124
-	Route::match( array( 'GET', 'POST' ), 'detail/pin/{pin_action?}/{pin_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
124
+	Route::match(array('GET', 'POST'), 'detail/pin/{pin_action?}/{pin_id?}/{d_prodid?}/{d_name?}/{l_pos?}', array(
125 125
 		'as' => 'aimeos_shop_session_pinned',
126 126
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@detailAction'
127 127
 	));
128
-	Route::match( array( 'GET', 'POST' ), 'list', array(
128
+	Route::match(array('GET', 'POST'), 'list', array(
129 129
 		'as' => 'aimeos_shop_list',
130 130
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@listAction'
131 131
 	));
132
-	Route::match( array( 'GET', 'POST' ), 'suggest', array(
132
+	Route::match(array('GET', 'POST'), 'suggest', array(
133 133
 		'as' => 'aimeos_shop_suggest',
134 134
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@suggestAction'
135 135
 	));
136
-	Route::match( array( 'GET', 'POST' ), 'stock', array(
136
+	Route::match(array('GET', 'POST'), 'stock', array(
137 137
 		'as' => 'aimeos_shop_stock',
138 138
 		'uses' => 'Aimeos\Shop\Controller\CatalogController@stockAction'
139 139
 	));
140 140
 
141
-	Route::match( array( 'GET', 'POST' ), 'checkout/{c_step?}', array(
141
+	Route::match(array('GET', 'POST'), 'checkout/{c_step?}', array(
142 142
 		'as' => 'aimeos_shop_checkout',
143 143
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@indexAction'
144 144
 	));
145
-	Route::match( array( 'GET', 'POST' ), 'confirm', array(
145
+	Route::match(array('GET', 'POST'), 'confirm', array(
146 146
 		'as' => 'aimeos_shop_confirm',
147 147
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@confirmAction'
148 148
 	));
149
-	Route::match( array( 'GET', 'POST' ), 'update', array(
149
+	Route::match(array('GET', 'POST'), 'update', array(
150 150
 		'as' => 'aimeos_shop_update',
151 151
 		'uses' => 'Aimeos\Shop\Controller\CheckoutController@updateAction'
152 152
 	));
Please login to merge, or discard this patch.