@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::match( array( 'GET' ), 'admin', array( |
|
| 3 | +Route::match(array('GET'), 'admin', array( |
|
| 4 | 4 | 'as' => 'aimeos_shop_admin', |
| 5 | 5 | 'uses' => 'Aimeos\Shop\Controller\AdminController@indexAction' |
| 6 | 6 | )); |
@@ -8,97 +8,97 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | Route::group(config('shop.routes.admin', ['middleware' => 'auth']), function() { |
| 10 | 10 | |
| 11 | - Route::match( array( 'GET' ), 'extadm', array( |
|
| 11 | + Route::match(array('GET'), 'extadm', array( |
|
| 12 | 12 | 'as' => 'aimeos_shop_extadm', |
| 13 | 13 | 'uses' => 'Aimeos\Shop\Controller\ExtadmController@indexAction' |
| 14 | 14 | )); |
| 15 | 15 | |
| 16 | - Route::match( array( 'GET' ), 'extadm/file', array( |
|
| 16 | + Route::match(array('GET'), 'extadm/file', array( |
|
| 17 | 17 | 'as' => 'aimeos_shop_extadm_file', |
| 18 | 18 | 'uses' => 'Aimeos\Shop\Controller\ExtadmController@fileAction' |
| 19 | 19 | )); |
| 20 | 20 | |
| 21 | - Route::match( array( 'POST' ), 'extadm/do', array( |
|
| 21 | + Route::match(array('POST'), 'extadm/do', array( |
|
| 22 | 22 | 'as' => 'aimeos_shop_extadm_json', |
| 23 | 23 | 'uses' => 'Aimeos\Shop\Controller\ExtadmController@doAction' |
| 24 | 24 | )); |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - Route::match( array( 'GET', 'POST' ), 'jqadm/copy/{resource}/{id}', array( |
|
| 27 | + Route::match(array('GET', 'POST'), 'jqadm/copy/{resource}/{id}', array( |
|
| 28 | 28 | 'as' => 'aimeos_shop_jqadm_copy', |
| 29 | 29 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@copyAction' |
| 30 | - ))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) ); |
|
| 30 | + ))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*')); |
|
| 31 | 31 | |
| 32 | - Route::match( array( 'GET', 'POST' ), 'jqadm/create/{resource}', array( |
|
| 32 | + Route::match(array('GET', 'POST'), 'jqadm/create/{resource}', array( |
|
| 33 | 33 | 'as' => 'aimeos_shop_jqadm_create', |
| 34 | 34 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@createAction' |
| 35 | - ))->where( array( 'resource' => '[^0-9]+' ) ); |
|
| 35 | + ))->where(array('resource' => '[^0-9]+')); |
|
| 36 | 36 | |
| 37 | - Route::match( array( 'GET', 'POST' ), 'jqadm/delete/{resource}/{id}', array( |
|
| 37 | + Route::match(array('GET', 'POST'), 'jqadm/delete/{resource}/{id}', array( |
|
| 38 | 38 | 'as' => 'aimeos_shop_jqadm_delete', |
| 39 | 39 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@deleteAction' |
| 40 | - ))->where( array( 'resource' => '[^0-9]+', 'id' => '[0-9]*' ) ); |
|
| 40 | + ))->where(array('resource' => '[^0-9]+', 'id' => '[0-9]*')); |
|
| 41 | 41 | |
| 42 | - Route::match( array( 'GET' ), 'jqadm/get/{resource}/{id}', array( |
|
| 42 | + Route::match(array('GET'), 'jqadm/get/{resource}/{id}', array( |
|
| 43 | 43 | 'as' => 'aimeos_shop_jqadm_get', |
| 44 | 44 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@getAction' |
| 45 | - ))->where( array( 'resource' => '[^0-9]*', 'id' => '[0-9]*' ) ); |
|
| 45 | + ))->where(array('resource' => '[^0-9]*', 'id' => '[0-9]*')); |
|
| 46 | 46 | |
| 47 | - Route::match( array( 'POST' ), 'jqadm/save/{resource}', array( |
|
| 47 | + Route::match(array('POST'), 'jqadm/save/{resource}', array( |
|
| 48 | 48 | 'as' => 'aimeos_shop_jqadm_save', |
| 49 | 49 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@saveAction' |
| 50 | - ))->where( array( 'resource' => '[^0-9]+' ) ); |
|
| 50 | + ))->where(array('resource' => '[^0-9]+')); |
|
| 51 | 51 | |
| 52 | - Route::match( array( 'GET', 'POST' ), 'jqadm/search/{resource}', array( |
|
| 52 | + Route::match(array('GET', 'POST'), 'jqadm/search/{resource}', array( |
|
| 53 | 53 | 'as' => 'aimeos_shop_jqadm_search', |
| 54 | 54 | 'uses' => 'Aimeos\Shop\Controller\JqadmController@searchAction' |
| 55 | - ))->where( array( 'resource' => '[^0-9]+' ) ); |
|
| 55 | + ))->where(array('resource' => '[^0-9]+')); |
|
| 56 | 56 | |
| 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 |
||
| 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 | )); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | } |
| 42 | 42 | </script> |
| 43 | 43 | |
| 44 | - <script type="text/javascript" src="<?= route( 'aimeos_shop_extadm_file', array( 'site' => 'default' ) ); ?>"></script> |
|
| 44 | + <script type="text/javascript" src="<?= route('aimeos_shop_extadm_file', array('site' => 'default')); ?>"></script> |
|
| 45 | 45 | |
| 46 | 46 | </head> |
| 47 | 47 | <body> |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | * @param integer $id Unique resource ID |
| 35 | 35 | * @return string Generated output |
| 36 | 36 | */ |
| 37 | - public function copyAction( $site = 'default', $resource, $id ) |
|
| 37 | + public function copyAction($site = 'default', $resource, $id) |
|
| 38 | 38 | { |
| 39 | - if( config( 'shop.authorize', true ) ) { |
|
| 40 | - $this->authorize( 'admin' ); |
|
| 39 | + if (config('shop.authorize', true)) { |
|
| 40 | + $this->authorize('admin'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $cntl = $this->createClient( $site, $resource ); |
|
| 44 | - $content = $cntl->copy( $id ); |
|
| 43 | + $cntl = $this->createClient($site, $resource); |
|
| 44 | + $content = $cntl->copy($id); |
|
| 45 | 45 | |
| 46 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 46 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | * @param string $sitecode Unique site code |
| 55 | 55 | * @return string Generated output |
| 56 | 56 | */ |
| 57 | - public function createAction( $site = 'default', $resource ) |
|
| 57 | + public function createAction($site = 'default', $resource) |
|
| 58 | 58 | { |
| 59 | - if( config( 'shop.authorize', true ) ) { |
|
| 60 | - $this->authorize( 'admin' ); |
|
| 59 | + if (config('shop.authorize', true)) { |
|
| 60 | + $this->authorize('admin'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $cntl = $this->createClient( $site, $resource ); |
|
| 63 | + $cntl = $this->createClient($site, $resource); |
|
| 64 | 64 | $content = $cntl->create(); |
| 65 | 65 | |
| 66 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 66 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | * @param integer $id Unique resource ID |
| 76 | 76 | * @return string Generated output |
| 77 | 77 | */ |
| 78 | - public function deleteAction( $site = 'default', $resource, $id ) |
|
| 78 | + public function deleteAction($site = 'default', $resource, $id) |
|
| 79 | 79 | { |
| 80 | - if( config( 'shop.authorize', true ) ) { |
|
| 81 | - $this->authorize( 'admin' ); |
|
| 80 | + if (config('shop.authorize', true)) { |
|
| 81 | + $this->authorize('admin'); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $cntl = $this->createClient( $site, $resource ); |
|
| 85 | - $content = $cntl->delete( $id ) . $cntl->search(); |
|
| 84 | + $cntl = $this->createClient($site, $resource); |
|
| 85 | + $content = $cntl->delete($id) . $cntl->search(); |
|
| 86 | 86 | |
| 87 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 87 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | * @param integer $id Unique resource ID |
| 97 | 97 | * @return string Generated output |
| 98 | 98 | */ |
| 99 | - public function getAction( $site = 'default', $resource, $id ) |
|
| 99 | + public function getAction($site = 'default', $resource, $id) |
|
| 100 | 100 | { |
| 101 | - if( config( 'shop.authorize', true ) ) { |
|
| 102 | - $this->authorize( 'admin' ); |
|
| 101 | + if (config('shop.authorize', true)) { |
|
| 102 | + $this->authorize('admin'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $cntl = $this->createClient( $site, $resource ); |
|
| 106 | - $content = $cntl->get( $id ); |
|
| 105 | + $cntl = $this->createClient($site, $resource); |
|
| 106 | + $content = $cntl->get($id); |
|
| 107 | 107 | |
| 108 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 108 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -116,16 +116,16 @@ discard block |
||
| 116 | 116 | * @param string $sitecode Unique site code |
| 117 | 117 | * @return string Generated output |
| 118 | 118 | */ |
| 119 | - public function saveAction( $site = 'default', $resource ) |
|
| 119 | + public function saveAction($site = 'default', $resource) |
|
| 120 | 120 | { |
| 121 | - if( config( 'shop.authorize', true ) ) { |
|
| 122 | - $this->authorize( 'admin' ); |
|
| 121 | + if (config('shop.authorize', true)) { |
|
| 122 | + $this->authorize('admin'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $cntl = $this->createClient( $site, $resource ); |
|
| 126 | - $content = ( $cntl->save() ? : $cntl->search() ); |
|
| 125 | + $cntl = $this->createClient($site, $resource); |
|
| 126 | + $content = ($cntl->save() ?: $cntl->search()); |
|
| 127 | 127 | |
| 128 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 128 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -136,16 +136,16 @@ discard block |
||
| 136 | 136 | * @param string $sitecode Unique site code |
| 137 | 137 | * @return string Generated output |
| 138 | 138 | */ |
| 139 | - public function searchAction( $site = 'default', $resource ) |
|
| 139 | + public function searchAction($site = 'default', $resource) |
|
| 140 | 140 | { |
| 141 | - if( config( 'shop.authorize', true ) ) { |
|
| 142 | - $this->authorize( 'admin' ); |
|
| 141 | + if (config('shop.authorize', true)) { |
|
| 142 | + $this->authorize('admin'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $cntl = $this->createClient( $site, $resource ); |
|
| 145 | + $cntl = $this->createClient($site, $resource); |
|
| 146 | 146 | $content = $cntl->search(); |
| 147 | 147 | |
| 148 | - return View::make('shop::admin.jqadm', array( 'content' => $content, 'site' => $site ) ); |
|
| 148 | + return View::make('shop::admin.jqadm', array('content' => $content, 'site' => $site)); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | * @param string $sitecode Unique site code |
| 156 | 156 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
| 157 | 157 | */ |
| 158 | - protected function createClient( $sitecode, $resource ) |
|
| 158 | + protected function createClient($sitecode, $resource) |
|
| 159 | 159 | { |
| 160 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
| 160 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
| 161 | 161 | |
| 162 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 163 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 162 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 163 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 164 | 164 | |
| 165 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 166 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
| 165 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 166 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
| 167 | 167 | |
| 168 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
| 169 | - $context->setView( $view ); |
|
| 168 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
| 169 | + $context->setView($view); |
|
| 170 | 170 | |
| 171 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 171 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 172 | 172 | } |
| 173 | 173 | } |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function indexAction() |
| 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 | 42 | $param = array( |
| 43 | 43 | 'resource' => 'product', |
| 44 | - 'site' => Route::input( 'site', 'default' ), |
|
| 45 | - 'lang' => Input::get( 'lang', config( 'app.locale', 'en' ) ), |
|
| 44 | + 'site' => Route::input('site', 'default'), |
|
| 45 | + 'lang' => Input::get('lang', config('app.locale', 'en')), |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - return redirect()->action( 'Aimeos\Shop\Controller\JqadmController@searchAction', $param ); |
|
| 48 | + return redirect()->action('Aimeos\Shop\Controller\JqadmController@searchAction', $param); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function getVersion() |
| 58 | 58 | { |
| 59 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
| 60 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
| 59 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
| 60 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
| 61 | 61 | ) { |
| 62 | - foreach( (array) $content['packages'] as $item ) |
|
| 62 | + foreach ((array) $content['packages'] as $item) |
|
| 63 | 63 | { |
| 64 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
| 64 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
| 65 | 65 | return $item['version']; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -79,23 +79,23 @@ discard block |
||
| 79 | 79 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 80 | 80 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 81 | 81 | */ |
| 82 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null ) |
|
| 82 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null) |
|
| 83 | 83 | { |
| 84 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 84 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 85 | 85 | |
| 86 | 86 | try |
| 87 | 87 | { |
| 88 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
| 89 | - $localeItem->setLanguageId( null ); |
|
| 90 | - $localeItem->setCurrencyId( null ); |
|
| 88 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
| 89 | + $localeItem->setLanguageId(null); |
|
| 90 | + $localeItem->setCurrencyId(null); |
|
| 91 | 91 | } |
| 92 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 92 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 93 | 93 | { |
| 94 | 94 | $localeItem = $localeManager->createItem(); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $context->setLocale( $localeItem ); |
|
| 98 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
| 97 | + $context->setLocale($localeItem); |
|
| 98 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
| 99 | 99 | |
| 100 | 100 | return $context; |
| 101 | 101 | } |
@@ -34,53 +34,53 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function indexAction() |
| 36 | 36 | { |
| 37 | - if( config( 'shop.authorize', true ) ) { |
|
| 38 | - $this->authorize( 'admin' ); |
|
| 37 | + if (config('shop.authorize', true)) { |
|
| 38 | + $this->authorize('admin'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $site = Route::input( 'site', 'default' ); |
|
| 42 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
| 41 | + $site = Route::input('site', 'default'); |
|
| 42 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
| 43 | 43 | |
| 44 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 45 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 44 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 45 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 46 | 46 | |
| 47 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 48 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 47 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 48 | + $context = $this->setLocale($context, $site, $lang); |
|
| 49 | 49 | |
| 50 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 50 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 51 | 51 | $cssFiles = array(); |
| 52 | 52 | |
| 53 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 53 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 54 | 54 | { |
| 55 | - foreach( $paths as $path ) |
|
| 55 | + foreach ($paths as $path) |
|
| 56 | 56 | { |
| 57 | 57 | $jsbAbsPath = $base . '/' . $path; |
| 58 | 58 | |
| 59 | - if( !is_file( $jsbAbsPath ) ) { |
|
| 60 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
| 59 | + if (!is_file($jsbAbsPath)) { |
|
| 60 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
| 64 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
| 63 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
| 64 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '%site%', 'lang' => '%lang%', 'tab' => '%tab%' ) ); |
|
| 69 | - $jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) ); |
|
| 68 | + $adminUrl = route('aimeos_shop_extadm', array('site' => '%site%', 'lang' => '%lang%', 'tab' => '%tab%')); |
|
| 69 | + $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); |
|
| 70 | 70 | |
| 71 | 71 | $vars = array( |
| 72 | 72 | 'lang' => $lang, |
| 73 | 73 | 'cssFiles' => $cssFiles, |
| 74 | - 'languages' => $this->getJsonLanguages( $context), |
|
| 75 | - 'config' => $this->getJsonClientConfig( $context ), |
|
| 76 | - 'site' => $this->getJsonSiteItem( $context, Input::get( 'site', 'default' ) ), |
|
| 77 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
| 74 | + 'languages' => $this->getJsonLanguages($context), |
|
| 75 | + 'config' => $this->getJsonClientConfig($context), |
|
| 76 | + 'site' => $this->getJsonSiteItem($context, Input::get('site', 'default')), |
|
| 77 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
| 78 | 78 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 79 | 79 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 80 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 81 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
| 82 | - 'uploaddir' => config( 'shop::uploaddir' ), |
|
| 83 | - 'activeTab' => Input::get( 'tab', 0 ), |
|
| 80 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 81 | + 'urlTemplate' => urldecode($adminUrl), |
|
| 82 | + 'uploaddir' => config('shop::uploaddir'), |
|
| 83 | + 'activeTab' => Input::get('tab', 0), |
|
| 84 | 84 | 'version' => $this->getVersion(), |
| 85 | 85 | ); |
| 86 | 86 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function doAction() |
| 97 | 97 | { |
| 98 | - if( config( 'shop.authorize', true ) ) { |
|
| 99 | - $this->authorize( 'admin' ); |
|
| 98 | + if (config('shop.authorize', true)) { |
|
| 99 | + $this->authorize('admin'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 103 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 102 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 103 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 104 | 104 | |
| 105 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 106 | - $context = $this->setLocale( $context ); |
|
| 105 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 106 | + $context = $this->setLocale($context); |
|
| 107 | 107 | |
| 108 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 108 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 109 | 109 | |
| 110 | - $response = $controller->process( Input::instance()->request->all(), 'php://input' ); |
|
| 111 | - return View::make('shop::admin.extadm-do', array( 'output' => $response )); |
|
| 110 | + $response = $controller->process(Input::instance()->request->all(), 'php://input'); |
|
| 111 | + return View::make('shop::admin.extadm-do', array('output' => $response)); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -119,32 +119,32 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function fileAction() |
| 121 | 121 | { |
| 122 | - if( config( 'shop.authorize', true ) ) { |
|
| 123 | - $this->authorize( 'admin' ); |
|
| 122 | + if (config('shop.authorize', true)) { |
|
| 123 | + $this->authorize('admin'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $contents = ''; |
| 127 | 127 | $jsFiles = array(); |
| 128 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 128 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 129 | 129 | |
| 130 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 130 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 131 | 131 | { |
| 132 | - foreach( $paths as $path ) |
|
| 132 | + foreach ($paths as $path) |
|
| 133 | 133 | { |
| 134 | 134 | $jsbAbsPath = $base . '/' . $path; |
| 135 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 136 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
| 135 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 136 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - foreach( $jsFiles as $file ) |
|
| 140 | + foreach ($jsFiles as $file) |
|
| 141 | 141 | { |
| 142 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 142 | + if (($content = file_get_contents($file)) !== false) { |
|
| 143 | 143 | $contents .= $content; |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
| 147 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -154,30 +154,30 @@ discard block |
||
| 154 | 154 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 155 | 155 | * @return array List of language IDs with labels |
| 156 | 156 | */ |
| 157 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 157 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 158 | 158 | { |
| 159 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
| 159 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
| 160 | 160 | $langs = array(); |
| 161 | 161 | |
| 162 | - if( !isset( $paths['admin'] ) ) { |
|
| 163 | - return json_encode( array() ); |
|
| 162 | + if (!isset($paths['admin'])) { |
|
| 163 | + return json_encode(array()); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - foreach( $paths['admin'] as $path ) |
|
| 166 | + foreach ($paths['admin'] as $path) |
|
| 167 | 167 | { |
| 168 | - $iter = new \DirectoryIterator( $path ); |
|
| 168 | + $iter = new \DirectoryIterator($path); |
|
| 169 | 169 | |
| 170 | - foreach( $iter as $file ) |
|
| 170 | + foreach ($iter as $file) |
|
| 171 | 171 | { |
| 172 | 172 | $name = $file->getFilename(); |
| 173 | 173 | |
| 174 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
| 174 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
| 175 | 175 | $langs[$name] = null; |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
| 180 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 188 | 188 | * @return string JSON encoded configuration object |
| 189 | 189 | */ |
| 190 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 190 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 191 | 191 | { |
| 192 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 193 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 192 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 193 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -201,16 +201,16 @@ discard block |
||
| 201 | 201 | * @param string $lang ISO language code like "en" or "en_GB" |
| 202 | 202 | * @return string JSON encoded translation object |
| 203 | 203 | */ |
| 204 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 204 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 205 | 205 | { |
| 206 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
| 206 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
| 207 | 207 | |
| 208 | 208 | $content = array( |
| 209 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 210 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 209 | + 'admin' => $i18n->getAll('admin'), |
|
| 210 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 211 | 211 | ); |
| 212 | 212 | |
| 213 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 213 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
@@ -222,19 +222,19 @@ discard block |
||
| 222 | 222 | * @return string JSON encoded site item object |
| 223 | 223 | * @throws Exception If no site item was found for the code |
| 224 | 224 | */ |
| 225 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 225 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 226 | 226 | { |
| 227 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 227 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 228 | 228 | |
| 229 | 229 | $criteria = $manager->createSearch(); |
| 230 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 231 | - $items = $manager->searchItems( $criteria ); |
|
| 230 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 231 | + $items = $manager->searchItems($criteria); |
|
| 232 | 232 | |
| 233 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 234 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 233 | + if (($item = reset($items)) === false) { |
|
| 234 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - return json_encode( $item->toArray() ); |
|
| 237 | + return json_encode($item->toArray()); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,18 +245,18 @@ discard block |
||
| 245 | 245 | * @param array $langIds List of language IDs |
| 246 | 246 | * @return array List of associative lists with "id" and "label" as keys |
| 247 | 247 | */ |
| 248 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
| 248 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
| 249 | 249 | { |
| 250 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 250 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 251 | 251 | $result = array(); |
| 252 | 252 | |
| 253 | 253 | $search = $languageManager->createSearch(); |
| 254 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
| 255 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
| 256 | - $langItems = $languageManager->searchItems( $search ); |
|
| 254 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
| 255 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
| 256 | + $langItems = $languageManager->searchItems($search); |
|
| 257 | 257 | |
| 258 | - foreach( $langItems as $id => $item ) { |
|
| 259 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
| 258 | + foreach ($langItems as $id => $item) { |
|
| 259 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $result; |
@@ -271,17 +271,17 @@ discard block |
||
| 271 | 271 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 272 | 272 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 273 | 273 | */ |
| 274 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 274 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 275 | 275 | { |
| 276 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 276 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 277 | 277 | |
| 278 | 278 | try { |
| 279 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 280 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 279 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 280 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 281 | 281 | $localeItem = $localeManager->createItem(); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $context->setLocale( $localeItem ); |
|
| 284 | + $context->setLocale($localeItem); |
|
| 285 | 285 | |
| 286 | 286 | return $context; |
| 287 | 287 | } |
@@ -36,31 +36,31 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function fire() |
| 38 | 38 | { |
| 39 | - $ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 40 | - $ctx->setEditor( 'aimeos:setup' ); |
|
| 39 | + $ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false); |
|
| 40 | + $ctx->setEditor('aimeos:setup'); |
|
| 41 | 41 | |
| 42 | 42 | $config = $ctx->getConfig(); |
| 43 | - $site = $this->argument( 'site' ); |
|
| 44 | - $template = $this->argument( 'tplsite' ); |
|
| 43 | + $site = $this->argument('site'); |
|
| 44 | + $template = $this->argument('tplsite'); |
|
| 45 | 45 | |
| 46 | - $config->set( 'setup/site', $site ); |
|
| 47 | - $dbconfig = $this->getDbConfig( $config ); |
|
| 48 | - $this->setOptions( $config ); |
|
| 46 | + $config->set('setup/site', $site); |
|
| 47 | + $dbconfig = $this->getDbConfig($config); |
|
| 48 | + $this->setOptions($config); |
|
| 49 | 49 | |
| 50 | - $taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template ); |
|
| 50 | + $taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template); |
|
| 51 | 51 | |
| 52 | 52 | $includePaths = $taskPaths; |
| 53 | 53 | $includePaths[] = get_include_path(); |
| 54 | 54 | |
| 55 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
| 56 | - throw new Exception( 'Unable to extend include path' ); |
|
| 55 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
| 56 | + throw new Exception('Unable to extend include path'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
| 59 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
| 60 | 60 | |
| 61 | - $this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) ); |
|
| 61 | + $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site)); |
|
| 62 | 62 | |
| 63 | - $manager->run( 'mysql' ); |
|
| 63 | + $manager->run('mysql'); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | protected function getArguments() |
| 73 | 73 | { |
| 74 | 74 | return array( |
| 75 | - array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ), |
|
| 76 | - array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ), |
|
| 75 | + array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'), |
|
| 76 | + array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'), |
|
| 77 | 77 | ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | protected function getOptions() |
| 87 | 87 | { |
| 88 | 88 | return array( |
| 89 | - array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ), |
|
| 89 | + array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()), |
|
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | * @param \Aimeos\MW\Config\Iface $conf Config object |
| 98 | 98 | * @return array Multi-dimensional associative list of database configuration parameters |
| 99 | 99 | */ |
| 100 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
| 100 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
| 101 | 101 | { |
| 102 | - $dbconfig = $conf->get( 'resource', array() ); |
|
| 102 | + $dbconfig = $conf->get('resource', array()); |
|
| 103 | 103 | |
| 104 | - foreach( $dbconfig as $rname => $dbconf ) |
|
| 104 | + foreach ($dbconfig as $rname => $dbconf) |
|
| 105 | 105 | { |
| 106 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
| 107 | - unset( $dbconfig[$rname] ); |
|
| 106 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
| 107 | + unset($dbconfig[$rname]); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | * @param array Associative list of database configurations |
| 120 | 120 | * @throws \RuntimeException If the format of the options is invalid |
| 121 | 121 | */ |
| 122 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf ) |
|
| 122 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf) |
|
| 123 | 123 | { |
| 124 | - foreach( (array) $this->option( 'option' ) as $option ) |
|
| 124 | + foreach ((array) $this->option('option') as $option) |
|
| 125 | 125 | { |
| 126 | - list( $name, $value ) = explode( ':', $option ); |
|
| 127 | - $conf->set( $name, $value ); |
|
| 126 | + list($name, $value) = explode(':', $option); |
|
| 127 | + $conf->set($name, $value); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -39,21 +39,21 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function fire() |
| 41 | 41 | { |
| 42 | - $code = $this->argument( 'email' ); |
|
| 43 | - if( ( $password = $this->option( 'password' ) ) === null ) { |
|
| 44 | - $password = $this->secret( 'Password' ); |
|
| 42 | + $code = $this->argument('email'); |
|
| 43 | + if (($password = $this->option('password')) === null) { |
|
| 44 | + $password = $this->secret('Password'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false ); |
|
| 48 | - $context->setEditor( 'aimeos:account' ); |
|
| 47 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false); |
|
| 48 | + $context->setEditor('aimeos:account'); |
|
| 49 | 49 | |
| 50 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 51 | - $context->setLocale( $localeManager->createItem() ); |
|
| 50 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 51 | + $context->setLocale($localeManager->createItem()); |
|
| 52 | 52 | |
| 53 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
| 53 | + $user = $this->createCustomerItem($context, $code, $password); |
|
| 54 | 54 | |
| 55 | - if( $this->option( 'admin' ) ) { |
|
| 56 | - $this->addPrivilege( $context, $user, 'admin' ); |
|
| 55 | + if ($this->option('admin')) { |
|
| 56 | + $this->addPrivilege($context, $user, 'admin'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -65,31 +65,31 @@ discard block |
||
| 65 | 65 | * @param string $userid Unique user ID |
| 66 | 66 | * @param string $groupid Unique group ID |
| 67 | 67 | */ |
| 68 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
| 68 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
| 69 | 69 | { |
| 70 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
| 71 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
| 70 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
| 71 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
| 72 | 72 | |
| 73 | 73 | $search = $manager->createSearch(); |
| 74 | 74 | $expr = array( |
| 75 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
| 76 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
| 77 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
| 78 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
| 75 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
| 76 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
| 77 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
| 78 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
| 79 | 79 | ); |
| 80 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 81 | - $search->setSlice( 0, 1 ); |
|
| 80 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 81 | + $search->setSlice(0, 1); |
|
| 82 | 82 | |
| 83 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
| 83 | + if (count($manager->searchItems($search)) === 0) |
|
| 84 | 84 | { |
| 85 | 85 | $item = $manager->createItem(); |
| 86 | - $item->setDomain( 'customer/group' ); |
|
| 87 | - $item->setParentId( $userid ); |
|
| 88 | - $item->setTypeId( $typeid ); |
|
| 89 | - $item->setRefId( $groupid ); |
|
| 90 | - $item->setStatus( 1 ); |
|
| 86 | + $item->setDomain('customer/group'); |
|
| 87 | + $item->setParentId($userid); |
|
| 88 | + $item->setTypeId($typeid); |
|
| 89 | + $item->setRefId($groupid); |
|
| 90 | + $item->setStatus(1); |
|
| 91 | 91 | |
| 92 | - $manager->saveItem( $item, false ); |
|
| 92 | + $manager->saveItem($item, false); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -101,23 +101,23 @@ discard block |
||
| 101 | 101 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
| 102 | 102 | * @param string $privilege Unique customer group code |
| 103 | 103 | */ |
| 104 | - protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege ) |
|
| 104 | + protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege) |
|
| 105 | 105 | { |
| 106 | - $this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) ); |
|
| 106 | + $this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode())); |
|
| 107 | 107 | |
| 108 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 108 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 109 | 109 | |
| 110 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
| 110 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
| 111 | 111 | { |
| 112 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 112 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 113 | 113 | |
| 114 | 114 | $lcontext = clone $context; |
| 115 | - $lcontext->setLocale( $localeItem ); |
|
| 115 | + $lcontext->setLocale($localeItem); |
|
| 116 | 116 | |
| 117 | - $this->info( '- ' . $siteItem->getCode() ); |
|
| 117 | + $this->info('- ' . $siteItem->getCode()); |
|
| 118 | 118 | |
| 119 | - $groupItem = $this->getGroupItem( $lcontext, $privilege ); |
|
| 120 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
| 119 | + $groupItem = $this->getGroupItem($lcontext, $privilege); |
|
| 120 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -132,21 +132,21 @@ discard block |
||
| 132 | 132 | * @param string $password New user password |
| 133 | 133 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
| 134 | 134 | */ |
| 135 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
| 135 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
| 136 | 136 | { |
| 137 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 137 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 138 | 138 | |
| 139 | 139 | try { |
| 140 | - $item = $manager->findItem( $email ); |
|
| 141 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
| 140 | + $item = $manager->findItem($email); |
|
| 141 | + } catch (\Aimeos\MShop\Exception $e) { |
|
| 142 | 142 | $item = $manager->createItem(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $item->setCode( $email ); |
|
| 146 | - $item->getPaymentAddress()->setEmail( $email ); |
|
| 147 | - $item->setPassword( $password ); |
|
| 145 | + $item->setCode($email); |
|
| 146 | + $item->getPaymentAddress()->setEmail($email); |
|
| 147 | + $item->setPassword($password); |
|
| 148 | 148 | |
| 149 | - $manager->saveItem( $item ); |
|
| 149 | + $manager->saveItem($item); |
|
| 150 | 150 | |
| 151 | 151 | return $item; |
| 152 | 152 | } |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | protected function getArguments() |
| 161 | 161 | { |
| 162 | 162 | return array( |
| 163 | - array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ), |
|
| 164 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ), |
|
| 163 | + array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'), |
|
| 164 | + array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'), |
|
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | * @param string $code Unique customer group code |
| 174 | 174 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
| 175 | 175 | */ |
| 176 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
| 176 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
| 177 | 177 | { |
| 178 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
| 178 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
| 179 | 179 | |
| 180 | 180 | try |
| 181 | 181 | { |
| 182 | - $item = $manager->findItem( $code ); |
|
| 182 | + $item = $manager->findItem($code); |
|
| 183 | 183 | } |
| 184 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 184 | + catch (\Aimeos\MShop\Exception $e) |
|
| 185 | 185 | { |
| 186 | 186 | $item = $manager->createItem(); |
| 187 | - $item->setLabel( $code ); |
|
| 188 | - $item->setCode( $code ); |
|
| 187 | + $item->setLabel($code); |
|
| 188 | + $item->setCode($code); |
|
| 189 | 189 | |
| 190 | - $manager->saveItem( $item ); |
|
| 190 | + $manager->saveItem($item); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | return $item; |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | protected function getOptions() |
| 203 | 203 | { |
| 204 | 204 | return array( |
| 205 | - array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ), |
|
| 206 | - array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ), |
|
| 205 | + array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'), |
|
| 206 | + array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'), |
|
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | } |