@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function confirmAction() |
| 30 | 30 | { |
| 31 | - $params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-confirm' ); |
|
| 31 | + $params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-confirm'); |
|
| 32 | 32 | return \View::make('shop::checkout.confirm', $params); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function indexAction() |
| 42 | 42 | { |
| 43 | - $params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-index' ); |
|
| 43 | + $params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-index'); |
|
| 44 | 44 | return \View::make('shop::checkout.index', $params); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function updateAction() |
| 54 | 54 | { |
| 55 | - $params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'checkout-update' ); |
|
| 55 | + $params = app('\Aimeos\Shop\Base\Page')->getSections('checkout-update'); |
|
| 56 | 56 | return \View::make('shop::checkout.update', $params); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -28,31 +28,31 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function boot() |
| 30 | 30 | { |
| 31 | - $basedir = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR; |
|
| 31 | + $basedir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR; |
|
| 32 | 32 | |
| 33 | - $this->mergeConfigFrom(dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'config/shop.php', 'shop'); |
|
| 33 | + $this->mergeConfigFrom(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config/shop.php', 'shop'); |
|
| 34 | 34 | |
| 35 | - $this->loadViewsFrom($basedir.'views', 'shop'); |
|
| 35 | + $this->loadViewsFrom($basedir . 'views', 'shop'); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | $this->publishes(array( |
| 39 | - $basedir.'config/shop.php' => config_path('shop.php'), |
|
| 39 | + $basedir . 'config/shop.php' => config_path('shop.php'), |
|
| 40 | 40 | ), 'config'); |
| 41 | 41 | |
| 42 | 42 | $this->publishes(array( |
| 43 | - $basedir.'database/migrations' => base_path('database/migrations'), |
|
| 43 | + $basedir . 'database/migrations' => base_path('database/migrations'), |
|
| 44 | 44 | ), 'migrations'); |
| 45 | 45 | |
| 46 | 46 | $this->publishes(array( |
| 47 | - $basedir.'views' => base_path('resources/views/vendor/shop'), |
|
| 47 | + $basedir . 'views' => base_path('resources/views/vendor/shop'), |
|
| 48 | 48 | ), 'views'); |
| 49 | 49 | |
| 50 | 50 | $this->publishes(array( |
| 51 | - dirname($basedir).DIRECTORY_SEPARATOR.'public' => public_path('packages/aimeos/shop'), |
|
| 51 | + dirname($basedir) . DIRECTORY_SEPARATOR . 'public' => public_path('packages/aimeos/shop'), |
|
| 52 | 52 | ), 'public'); |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - require $basedir.'routes.php'; |
|
| 55 | + require $basedir . 'routes.php'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -177,8 +177,7 @@ |
||
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | 179 | $item = $manager->getItem( $code ); |
| 180 | - } |
|
| 181 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 180 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 182 | 181 | { |
| 183 | 182 | $item = $manager->createItem(); |
| 184 | 183 | $item->setLabel( $code ); |
@@ -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 | } |
@@ -163,8 +163,7 @@ |
||
| 163 | 163 | $site = \Route::input( 'site', 'default' ); |
| 164 | 164 | $lang = \Route::input( 'locale', '' ); |
| 165 | 165 | $currency = \Route::input( 'currency', '' ); |
| 166 | - } |
|
| 167 | - else |
|
| 166 | + } else |
|
| 168 | 167 | { |
| 169 | 168 | $site = 'default'; |
| 170 | 169 | $lang = $currency = ''; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
| 50 | 50 | * @param \Illuminate\Session\Store $session Laravel session object |
| 51 | 51 | */ |
| 52 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session ) |
|
| 52 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session) |
|
| 53 | 53 | { |
| 54 | 54 | $this->config = $config; |
| 55 | 55 | $this->session = $session; |
@@ -62,48 +62,48 @@ discard block |
||
| 62 | 62 | * @param boolean $locale True to add locale object to context, false if not |
| 63 | 63 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 64 | 64 | */ |
| 65 | - public function get( $locale = true ) |
|
| 65 | + public function get($locale = true) |
|
| 66 | 66 | { |
| 67 | - if( self::$context === null ) |
|
| 67 | + if (self::$context === null) |
|
| 68 | 68 | { |
| 69 | 69 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
| 70 | 70 | |
| 71 | 71 | $config = $this->getConfig(); |
| 72 | - $context->setConfig( $config ); |
|
| 72 | + $context->setConfig($config); |
|
| 73 | 73 | |
| 74 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
| 75 | - $context->setDatabaseManager( $dbm ); |
|
| 74 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
| 75 | + $context->setDatabaseManager($dbm); |
|
| 76 | 76 | |
| 77 | - $fs = new \Aimeos\MW\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) ); |
|
| 78 | - $context->setFilesystemManager( $fs ); |
|
| 77 | + $fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos')); |
|
| 78 | + $context->setFilesystemManager($fs); |
|
| 79 | 79 | |
| 80 | - $mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } ); |
|
| 81 | - $context->setMail( $mail ); |
|
| 80 | + $mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } ); |
|
| 81 | + $context->setMail($mail); |
|
| 82 | 82 | |
| 83 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
| 84 | - $context->setLogger( $logger ); |
|
| 83 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
| 84 | + $context->setLogger($logger); |
|
| 85 | 85 | |
| 86 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
| 87 | - $context->setCache( $cache ); |
|
| 86 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
| 87 | + $context->setCache($cache); |
|
| 88 | 88 | |
| 89 | 89 | self::$context = $context; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $context = self::$context; |
| 93 | 93 | |
| 94 | - if( $locale === true ) |
|
| 94 | + if ($locale === true) |
|
| 95 | 95 | { |
| 96 | - $localeItem = $this->getLocale( $context ); |
|
| 96 | + $localeItem = $this->getLocale($context); |
|
| 97 | 97 | $langid = $localeItem->getLanguageId(); |
| 98 | 98 | |
| 99 | - $context->setLocale( $localeItem ); |
|
| 100 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) ); |
|
| 99 | + $context->setLocale($localeItem); |
|
| 100 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid))); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $session = new \Aimeos\MW\Session\Laravel5( $this->session ); |
|
| 104 | - $context->setSession( $session ); |
|
| 103 | + $session = new \Aimeos\MW\Session\Laravel5($this->session); |
|
| 104 | + $context->setSession($session); |
|
| 105 | 105 | |
| 106 | - $this->addUser( $context ); |
|
| 106 | + $this->addUser($context); |
|
| 107 | 107 | |
| 108 | 108 | return $context; |
| 109 | 109 | } |
@@ -114,20 +114,20 @@ discard block |
||
| 114 | 114 | * |
| 115 | 115 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 116 | 116 | */ |
| 117 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 117 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 118 | 118 | { |
| 119 | - if( ( $userid = Auth::id() ) !== null ) |
|
| 119 | + if (($userid = Auth::id()) !== null) |
|
| 120 | 120 | { |
| 121 | - $context->setUserId( $userid ); |
|
| 122 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
| 121 | + $context->setUserId($userid); |
|
| 122 | + $context->setGroupIds(function() use ($context, $userid) |
|
| 123 | 123 | { |
| 124 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 125 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
| 124 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 125 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
| 126 | 126 | } ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if( ( $user = Auth::user() ) !== null ) { |
|
| 130 | - $context->setEditor( $user->name ); |
|
| 129 | + if (($user = Auth::user()) !== null) { |
|
| 130 | + $context->setEditor($user->name); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | protected function getConfig() |
| 141 | 141 | { |
| 142 | - $conf = $this->config->get( 'shop' ); |
|
| 142 | + $conf = $this->config->get('shop'); |
|
| 143 | 143 | |
| 144 | - $configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths( 'mysql' ); |
|
| 145 | - $config = new \Aimeos\MW\Config\PHPArray( $conf, $configPaths ); |
|
| 144 | + $configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths('mysql'); |
|
| 145 | + $config = new \Aimeos\MW\Config\PHPArray($conf, $configPaths); |
|
| 146 | 146 | |
| 147 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
| 148 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
| 147 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
| 148 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | return $config; |
@@ -158,15 +158,15 @@ discard block |
||
| 158 | 158 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 159 | 159 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 160 | 160 | */ |
| 161 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 161 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 162 | 162 | { |
| 163 | - if( $this->locale === null ) |
|
| 163 | + if ($this->locale === null) |
|
| 164 | 164 | { |
| 165 | - if( Route::current() !== null ) |
|
| 165 | + if (Route::current() !== null) |
|
| 166 | 166 | { |
| 167 | - $site = Route::input( 'site', 'default' ); |
|
| 168 | - $lang = Route::input( 'locale', '' ); |
|
| 169 | - $currency = Route::input( 'currency', '' ); |
|
| 167 | + $site = Route::input('site', 'default'); |
|
| 168 | + $lang = Route::input('locale', ''); |
|
| 169 | + $currency = Route::input('currency', ''); |
|
| 170 | 170 | } |
| 171 | 171 | else |
| 172 | 172 | { |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | $lang = $currency = ''; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $disableSites = $this->config->has( 'shop.disableSites' ); |
|
| 177 | + $disableSites = $this->config->has('shop.disableSites'); |
|
| 178 | 178 | |
| 179 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 180 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
| 179 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 180 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $this->locale; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | return array( |
| 4 | 4 | 'apc_enabled' => false, |
| 5 | 5 | 'apc_prefix' => 'laravel:', |
| 6 | - 'extdir' => ( is_dir(base_path('ext')) ? base_path('ext') : dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'ext' ), |
|
| 6 | + 'extdir' => (is_dir(base_path('ext')) ? base_path('ext') : dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'ext'), |
|
| 7 | 7 | 'uploaddir' => '/', |
| 8 | 8 | |
| 9 | 9 | 'routes' => array( |
@@ -14,16 +14,16 @@ discard block |
||
| 14 | 14 | ), |
| 15 | 15 | |
| 16 | 16 | 'page' => array( |
| 17 | - 'account-index' => array( 'account/history','account/favorite','account/watch','basket/mini','catalog/session' ), |
|
| 18 | - 'basket-index' => array( 'basket/standard','basket/related' ), |
|
| 19 | - 'catalog-count' => array( 'catalog/count' ), |
|
| 20 | - 'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ), |
|
| 21 | - 'catalog-list' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ), |
|
| 22 | - 'catalog-stock' => array( 'catalog/stock' ), |
|
| 23 | - 'catalog-suggest' => array( 'catalog/suggest' ), |
|
| 24 | - 'checkout-confirm' => array( 'checkout/confirm' ), |
|
| 25 | - 'checkout-index' => array( 'checkout/standard' ), |
|
| 26 | - 'checkout-update' => array( 'checkout/update'), |
|
| 17 | + 'account-index' => array('account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'), |
|
| 18 | + 'basket-index' => array('basket/standard', 'basket/related'), |
|
| 19 | + 'catalog-count' => array('catalog/count'), |
|
| 20 | + 'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'), |
|
| 21 | + 'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'), |
|
| 22 | + 'catalog-stock' => array('catalog/stock'), |
|
| 23 | + 'catalog-suggest' => array('catalog/suggest'), |
|
| 24 | + 'checkout-confirm' => array('checkout/confirm'), |
|
| 25 | + 'checkout-index' => array('checkout/standard'), |
|
| 26 | + 'checkout-update' => array('checkout/update'), |
|
| 27 | 27 | ), |
| 28 | 28 | |
| 29 | 29 | 'resource' => array( |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | 'database' => env('DB_DATABASE', 'laravel'), |
| 35 | 35 | 'username' => env('DB_USERNAME', 'root'), |
| 36 | 36 | 'password' => env('DB_PASSWORD', ''), |
| 37 | - 'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ), |
|
| 37 | + 'stmt' => array("SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"), |
|
| 38 | 38 | 'opt-persistent' => 0, |
| 39 | 39 | 'limit' => 2, |
| 40 | 40 | ), |
| 41 | 41 | 'fs' => array( |
| 42 | 42 | 'adapter' => 'Standard', |
| 43 | 43 | 'basedir' => public_path(), |
| 44 | - 'tempdir' => storage_path( 'aimeos' ), |
|
| 44 | + 'tempdir' => storage_path('aimeos'), |
|
| 45 | 45 | ), |
| 46 | 46 | 'fs-admin' => array( |
| 47 | 47 | 'adapter' => 'Standard', |
| 48 | - 'basedir' => public_path( 'uploads' ), |
|
| 49 | - 'tempdir' => storage_path( 'aimeos' ), |
|
| 48 | + 'basedir' => public_path('uploads'), |
|
| 49 | + 'tempdir' => storage_path('aimeos'), |
|
| 50 | 50 | ), |
| 51 | 51 | /* 'fs-media' => array( |
| 52 | 52 | 'adapter' => 'Standard', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | 'default' => array( |
| 192 | 192 | 'mimeicon' => array( |
| 193 | 193 | # Directory where icons for the mime types stored |
| 194 | - 'directory' => public_path( '/packages/aimeos/shop/mimeicons' ), |
|
| 194 | + 'directory' => public_path('/packages/aimeos/shop/mimeicons'), |
|
| 195 | 195 | # File extension of mime type icons |
| 196 | 196 | 'extension' => '.png' |
| 197 | 197 | ), |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | # in the "maxwidth" parameter |
| 235 | 235 | # maxheight: 280 |
| 236 | 236 | ), |
| 237 | - 'tempdir' => storage_path( 'aimeos' ), |
|
| 237 | + 'tempdir' => storage_path('aimeos'), |
|
| 238 | 238 | ), |
| 239 | 239 | ), |
| 240 | 240 | 'product' => array( |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * @param \Aimeos\Shop\Base\Context $context Context object |
| 48 | 48 | * @param \Aimeos\Shop\Base\View $view View object |
| 49 | 49 | */ |
| 50 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, |
|
| 51 | - \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view ) |
|
| 50 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, |
|
| 51 | + \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view) |
|
| 52 | 52 | { |
| 53 | 53 | $this->config = $config; |
| 54 | 54 | $this->aimeos = $aimeos; |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | * @param string $pageName Name of the configured page |
| 64 | 64 | * @return array Associative list with body and header output separated by client name |
| 65 | 65 | */ |
| 66 | - public function getSections( $pageName ) |
|
| 66 | + public function getSections($pageName) |
|
| 67 | 67 | { |
| 68 | 68 | $context = $this->context->get(); |
| 69 | 69 | $langid = $context->getLocale()->getLanguageId(); |
| 70 | - $tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html/templates' ); |
|
| 71 | - $view = $this->view->create( $context->getConfig(), $tmplPaths, $langid ); |
|
| 72 | - $context->setView( $view ); |
|
| 70 | + $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html/templates'); |
|
| 71 | + $view = $this->view->create($context->getConfig(), $tmplPaths, $langid); |
|
| 72 | + $context->setView($view); |
|
| 73 | 73 | |
| 74 | - $pagesConfig = $this->config->get( 'shop.page', array() ); |
|
| 75 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
| 74 | + $pagesConfig = $this->config->get('shop.page', array()); |
|
| 75 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
| 76 | 76 | |
| 77 | - if( isset( $pagesConfig[$pageName] ) ) |
|
| 77 | + if (isset($pagesConfig[$pageName])) |
|
| 78 | 78 | { |
| 79 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
| 79 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
| 80 | 80 | { |
| 81 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
| 82 | - $client->setView( clone $view ); |
|
| 81 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
| 82 | + $client->setView(clone $view); |
|
| 83 | 83 | $client->process(); |
| 84 | 84 | |
| 85 | 85 | $result['aibody'][$clientName] = $client->getBody(); |
@@ -29,7 +29,6 @@ discard block |
||
| 29 | 29 | * Returns the HTML code for a copy of a resource object |
| 30 | 30 | * |
| 31 | 31 | * @param string Resource location, e.g. "product" |
| 32 | - * @param string $sitecode Unique site code |
|
| 33 | 32 | * @param integer $id Unique resource ID |
| 34 | 33 | * @return string Generated output |
| 35 | 34 | */ |
@@ -51,7 +50,6 @@ discard block |
||
| 51 | 50 | * Returns the HTML code for a new resource object |
| 52 | 51 | * |
| 53 | 52 | * @param string Resource location, e.g. "product" |
| 54 | - * @param string $sitecode Unique site code |
|
| 55 | 53 | * @return string Generated output |
| 56 | 54 | */ |
| 57 | 55 | public function createAction( $site = 'default', $resource ) |
@@ -72,7 +70,6 @@ discard block |
||
| 72 | 70 | * Deletes the resource object or a list of resource objects |
| 73 | 71 | * |
| 74 | 72 | * @param string Resource location, e.g. "product" |
| 75 | - * @param string $sitecode Unique site code |
|
| 76 | 73 | * @param integer $id Unique resource ID |
| 77 | 74 | * @return string Generated output |
| 78 | 75 | */ |
@@ -94,7 +91,6 @@ discard block |
||
| 94 | 91 | * Returns the HTML code for the requested resource object |
| 95 | 92 | * |
| 96 | 93 | * @param string Resource location, e.g. "product" |
| 97 | - * @param string $sitecode Unique site code |
|
| 98 | 94 | * @param integer $id Unique resource ID |
| 99 | 95 | * @return string Generated output |
| 100 | 96 | */ |
@@ -116,7 +112,6 @@ discard block |
||
| 116 | 112 | * Saves a new resource object |
| 117 | 113 | * |
| 118 | 114 | * @param string Resource location, e.g. "product" |
| 119 | - * @param string $sitecode Unique site code |
|
| 120 | 115 | * @return string Generated output |
| 121 | 116 | */ |
| 122 | 117 | public function saveAction( $site = 'default', $resource ) |
@@ -137,7 +132,6 @@ discard block |
||
| 137 | 132 | * Returns the HTML code for a list of resource objects |
| 138 | 133 | * |
| 139 | 134 | * @param string Resource location, e.g. "product" |
| 140 | - * @param string $sitecode Unique site code |
|
| 141 | 135 | * @return string Generated output |
| 142 | 136 | */ |
| 143 | 137 | public function searchAction( $site = 'default', $resource ) |
@@ -158,7 +152,7 @@ discard block |
||
| 158 | 152 | * Returns the resource controller |
| 159 | 153 | * |
| 160 | 154 | * @param string $sitecode Unique site code |
| 161 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
| 155 | + * @return \Aimeos\Admin\JQAdm\Iface Context item |
|
| 162 | 156 | */ |
| 163 | 157 | protected function createClient( $sitecode, $resource ) |
| 164 | 158 | { |
@@ -34,14 +34,14 @@ 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 | - return $this->getHtml( $site, $cntl->copy( $id ) ); |
|
| 43 | + $cntl = $this->createClient($site, $resource); |
|
| 44 | + return $this->getHtml($site, $cntl->copy($id)); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | * @param string $sitecode Unique site code |
| 53 | 53 | * @return string Generated output |
| 54 | 54 | */ |
| 55 | - public function createAction( $site = 'default', $resource ) |
|
| 55 | + public function createAction($site = 'default', $resource) |
|
| 56 | 56 | { |
| 57 | - if( config( 'shop.authorize', true ) ) { |
|
| 58 | - $this->authorize( 'admin' ); |
|
| 57 | + if (config('shop.authorize', true)) { |
|
| 58 | + $this->authorize('admin'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $cntl = $this->createClient( $site, $resource ); |
|
| 62 | - return $this->getHtml( $site, $cntl->create() ); |
|
| 61 | + $cntl = $this->createClient($site, $resource); |
|
| 62 | + return $this->getHtml($site, $cntl->create()); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | * @param integer $id Unique resource ID |
| 72 | 72 | * @return string Generated output |
| 73 | 73 | */ |
| 74 | - public function deleteAction( $site = 'default', $resource, $id ) |
|
| 74 | + public function deleteAction($site = 'default', $resource, $id) |
|
| 75 | 75 | { |
| 76 | - if( config( 'shop.authorize', true ) ) { |
|
| 77 | - $this->authorize( 'admin' ); |
|
| 76 | + if (config('shop.authorize', true)) { |
|
| 77 | + $this->authorize('admin'); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $cntl = $this->createClient( $site, $resource ); |
|
| 81 | - return $this->getHtml( $site, $cntl->delete( $id ) . $cntl->search() ); |
|
| 80 | + $cntl = $this->createClient($site, $resource); |
|
| 81 | + return $this->getHtml($site, $cntl->delete($id) . $cntl->search()); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | * @param integer $id Unique resource ID |
| 91 | 91 | * @return string Generated output |
| 92 | 92 | */ |
| 93 | - public function getAction( $site = 'default', $resource, $id ) |
|
| 93 | + public function getAction($site = 'default', $resource, $id) |
|
| 94 | 94 | { |
| 95 | - if( config( 'shop.authorize', true ) ) { |
|
| 96 | - $this->authorize( 'admin' ); |
|
| 95 | + if (config('shop.authorize', true)) { |
|
| 96 | + $this->authorize('admin'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $cntl = $this->createClient( $site, $resource ); |
|
| 100 | - return $this->getHtml( $site, $cntl->get( $id ) ); |
|
| 99 | + $cntl = $this->createClient($site, $resource); |
|
| 100 | + return $this->getHtml($site, $cntl->get($id)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $sitecode Unique site code |
| 109 | 109 | * @return string Generated output |
| 110 | 110 | */ |
| 111 | - public function saveAction( $site = 'default', $resource ) |
|
| 111 | + public function saveAction($site = 'default', $resource) |
|
| 112 | 112 | { |
| 113 | - if( config( 'shop.authorize', true ) ) { |
|
| 114 | - $this->authorize( 'admin' ); |
|
| 113 | + if (config('shop.authorize', true)) { |
|
| 114 | + $this->authorize('admin'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $cntl = $this->createClient( $site, $resource ); |
|
| 118 | - return $this->getHtml( $site, ( $cntl->save() ? : $cntl->search() ) ); |
|
| 117 | + $cntl = $this->createClient($site, $resource); |
|
| 118 | + return $this->getHtml($site, ($cntl->save() ?: $cntl->search())); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | * @param string $sitecode Unique site code |
| 127 | 127 | * @return string Generated output |
| 128 | 128 | */ |
| 129 | - public function searchAction( $site = 'default', $resource ) |
|
| 129 | + public function searchAction($site = 'default', $resource) |
|
| 130 | 130 | { |
| 131 | - if( config( 'shop.authorize', true ) ) { |
|
| 132 | - $this->authorize( 'admin' ); |
|
| 131 | + if (config('shop.authorize', true)) { |
|
| 132 | + $this->authorize('admin'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $cntl = $this->createClient( $site, $resource ); |
|
| 136 | - return $this->getHtml( $site, $cntl->search() ); |
|
| 135 | + $cntl = $this->createClient($site, $resource); |
|
| 136 | + return $this->getHtml($site, $cntl->search()); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
@@ -143,20 +143,20 @@ discard block |
||
| 143 | 143 | * @param string $sitecode Unique site code |
| 144 | 144 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
| 145 | 145 | */ |
| 146 | - protected function createClient( $sitecode, $resource ) |
|
| 146 | + protected function createClient($sitecode, $resource) |
|
| 147 | 147 | { |
| 148 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
| 148 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
| 149 | 149 | |
| 150 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 151 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 150 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 151 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 152 | 152 | |
| 153 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 154 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
| 153 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 154 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
| 155 | 155 | |
| 156 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
| 157 | - $context->setView( $view ); |
|
| 156 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
| 157 | + $context->setView($view); |
|
| 158 | 158 | |
| 159 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 159 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -166,11 +166,11 @@ discard block |
||
| 166 | 166 | * @param string $site |
| 167 | 167 | * @param string $content |
| 168 | 168 | */ |
| 169 | - protected function getHtml( $site, $content ) |
|
| 169 | + protected function getHtml($site, $content) |
|
| 170 | 170 | { |
| 171 | - $content = str_replace( ['{type}', '{version}'], ['Laravel', $this->getVersion()], $content ); |
|
| 172 | - $params = array( 'site' => $site, 'content' => $content ); |
|
| 171 | + $content = str_replace(['{type}', '{version}'], ['Laravel', $this->getVersion()], $content); |
|
| 172 | + $params = array('site' => $site, 'content' => $content); |
|
| 173 | 173 | |
| 174 | - return View::make('shop::admin.jqadm', $params ); |
|
| 174 | + return View::make('shop::admin.jqadm', $params); |
|
| 175 | 175 | } |
| 176 | 176 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param \Aimeos\Shop\Base\Context $context Context object |
| 31 | 31 | */ |
| 32 | - public function __construct( \Aimeos\Shop\Base\Context $context ) |
|
| 32 | + public function __construct(\Aimeos\Shop\Base\Context $context) |
|
| 33 | 33 | { |
| 34 | 34 | $this->context = $context; |
| 35 | 35 | } |
@@ -42,21 +42,21 @@ discard block |
||
| 42 | 42 | * @param string $groupcode Unique user/customer group code |
| 43 | 43 | * @return boolean True if user is part of the group, false if not |
| 44 | 44 | */ |
| 45 | - public function checkGroup( $userid, $groupcode ) |
|
| 45 | + public function checkGroup($userid, $groupcode) |
|
| 46 | 46 | { |
| 47 | 47 | $context = $this->context->get(); |
| 48 | - $group = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' )->findItem( $groupcode ); |
|
| 49 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
| 48 | + $group = \Aimeos\MShop\Factory::createManager($context, 'customer/group')->findItem($groupcode); |
|
| 49 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
| 50 | 50 | |
| 51 | 51 | $search = $manager->createSearch(); |
| 52 | 52 | $expr = array( |
| 53 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
| 54 | - $search->compare( '==', 'customer.lists.refid', $group->getId() ), |
|
| 55 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
| 53 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
| 54 | + $search->compare('==', 'customer.lists.refid', $group->getId()), |
|
| 55 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
| 56 | 56 | ); |
| 57 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 58 | - $search->setSlice( 0, 1 ); |
|
| 57 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 58 | + $search->setSlice(0, 1); |
|
| 59 | 59 | |
| 60 | - return (bool) count( $manager->searchItems( $search ) ); |
|
| 60 | + return (bool) count($manager->searchItems($search)); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | \ No newline at end of file |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * Creates a list of all available translations. |
| 136 | 136 | * |
| 137 | 137 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 138 | - * @return array List of language IDs with labels |
|
| 138 | + * @return string List of language IDs with labels |
|
| 139 | 139 | */ |
| 140 | 140 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
| 141 | 141 | { |
@@ -34,54 +34,54 @@ 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 | - $jqadmUrl = route( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
| 69 | - $jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) ); |
|
| 70 | - $adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
| 68 | + $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
| 69 | + $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); |
|
| 70 | + $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); |
|
| 71 | 71 | |
| 72 | 72 | $vars = array( |
| 73 | 73 | 'lang' => $lang, |
| 74 | 74 | 'cssFiles' => $cssFiles, |
| 75 | - 'languages' => $this->getJsonLanguages( $context), |
|
| 76 | - 'config' => $this->getJsonClientConfig( $context ), |
|
| 77 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
| 78 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
| 75 | + 'languages' => $this->getJsonLanguages($context), |
|
| 76 | + 'config' => $this->getJsonClientConfig($context), |
|
| 77 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
| 78 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
| 79 | 79 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 80 | 80 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 81 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 82 | - 'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ), |
|
| 83 | - 'uploaddir' => config( 'shop::uploaddir' ), |
|
| 84 | - 'activeTab' => Input::get( 'tab', 0 ), |
|
| 81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 82 | + 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), |
|
| 83 | + 'uploaddir' => config('shop::uploaddir'), |
|
| 84 | + 'activeTab' => Input::get('tab', 0), |
|
| 85 | 85 | 'version' => $this->getVersion(), |
| 86 | 86 | 'jqadmurl' => $jqadmUrl, |
| 87 | 87 | ); |
@@ -97,20 +97,20 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function doAction() |
| 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 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 105 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 104 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 105 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 106 | 106 | |
| 107 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 108 | - $context = $this->setLocale( $context ); |
|
| 107 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 108 | + $context = $this->setLocale($context); |
|
| 109 | 109 | |
| 110 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 110 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 111 | 111 | |
| 112 | - $response = $controller->process( Input::instance()->request->all(), 'php://input' ); |
|
| 113 | - return View::make('shop::admin.extadm-do', array( 'output' => $response )); |
|
| 112 | + $response = $controller->process(Input::instance()->request->all(), 'php://input'); |
|
| 113 | + return View::make('shop::admin.extadm-do', array('output' => $response)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -121,32 +121,32 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function fileAction() |
| 123 | 123 | { |
| 124 | - if( config( 'shop.authorize', true ) ) { |
|
| 125 | - $this->authorize( 'admin' ); |
|
| 124 | + if (config('shop.authorize', true)) { |
|
| 125 | + $this->authorize('admin'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $contents = ''; |
| 129 | 129 | $jsFiles = array(); |
| 130 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 130 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 131 | 131 | |
| 132 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 132 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 133 | 133 | { |
| 134 | - foreach( $paths as $path ) |
|
| 134 | + foreach ($paths as $path) |
|
| 135 | 135 | { |
| 136 | 136 | $jsbAbsPath = $base . '/' . $path; |
| 137 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 138 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
| 137 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 138 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - foreach( $jsFiles as $file ) |
|
| 142 | + foreach ($jsFiles as $file) |
|
| 143 | 143 | { |
| 144 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 144 | + if (($content = file_get_contents($file)) !== false) { |
|
| 145 | 145 | $contents .= $content; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
| 149 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -156,30 +156,30 @@ discard block |
||
| 156 | 156 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 157 | 157 | * @return array List of language IDs with labels |
| 158 | 158 | */ |
| 159 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 159 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 160 | 160 | { |
| 161 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
| 161 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
| 162 | 162 | $langs = array(); |
| 163 | 163 | |
| 164 | - if( !isset( $paths['admin'] ) ) { |
|
| 165 | - return json_encode( array() ); |
|
| 164 | + if (!isset($paths['admin'])) { |
|
| 165 | + return json_encode(array()); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - foreach( $paths['admin'] as $path ) |
|
| 168 | + foreach ($paths['admin'] as $path) |
|
| 169 | 169 | { |
| 170 | - $iter = new \DirectoryIterator( $path ); |
|
| 170 | + $iter = new \DirectoryIterator($path); |
|
| 171 | 171 | |
| 172 | - foreach( $iter as $file ) |
|
| 172 | + foreach ($iter as $file) |
|
| 173 | 173 | { |
| 174 | 174 | $name = $file->getFilename(); |
| 175 | 175 | |
| 176 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
| 176 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
| 177 | 177 | $langs[$name] = null; |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
| 182 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 190 | 190 | * @return string JSON encoded configuration object |
| 191 | 191 | */ |
| 192 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 192 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 193 | 193 | { |
| 194 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 195 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 194 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 195 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -203,16 +203,16 @@ discard block |
||
| 203 | 203 | * @param string $lang ISO language code like "en" or "en_GB" |
| 204 | 204 | * @return string JSON encoded translation object |
| 205 | 205 | */ |
| 206 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 206 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 207 | 207 | { |
| 208 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
| 208 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
| 209 | 209 | |
| 210 | 210 | $content = array( |
| 211 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 212 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 211 | + 'admin' => $i18n->getAll('admin'), |
|
| 212 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 215 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
@@ -224,19 +224,19 @@ discard block |
||
| 224 | 224 | * @return string JSON encoded site item object |
| 225 | 225 | * @throws Exception If no site item was found for the code |
| 226 | 226 | */ |
| 227 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 227 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 228 | 228 | { |
| 229 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 229 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 230 | 230 | |
| 231 | 231 | $criteria = $manager->createSearch(); |
| 232 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 233 | - $items = $manager->searchItems( $criteria ); |
|
| 232 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 233 | + $items = $manager->searchItems($criteria); |
|
| 234 | 234 | |
| 235 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 236 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 235 | + if (($item = reset($items)) === false) { |
|
| 236 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - return json_encode( $item->toArray() ); |
|
| 239 | + return json_encode($item->toArray()); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,18 +247,18 @@ discard block |
||
| 247 | 247 | * @param array $langIds List of language IDs |
| 248 | 248 | * @return array List of associative lists with "id" and "label" as keys |
| 249 | 249 | */ |
| 250 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
| 250 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
| 251 | 251 | { |
| 252 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 252 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 253 | 253 | $result = array(); |
| 254 | 254 | |
| 255 | 255 | $search = $languageManager->createSearch(); |
| 256 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
| 257 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
| 258 | - $langItems = $languageManager->searchItems( $search ); |
|
| 256 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
| 257 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
| 258 | + $langItems = $languageManager->searchItems($search); |
|
| 259 | 259 | |
| 260 | - foreach( $langItems as $id => $item ) { |
|
| 261 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
| 260 | + foreach ($langItems as $id => $item) { |
|
| 261 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $result; |
@@ -273,17 +273,17 @@ discard block |
||
| 273 | 273 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 274 | 274 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 275 | 275 | */ |
| 276 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 276 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 277 | 277 | { |
| 278 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 278 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 279 | 279 | |
| 280 | 280 | try { |
| 281 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 282 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 281 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 282 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 283 | 283 | $localeItem = $localeManager->createItem(); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $context->setLocale( $localeItem ); |
|
| 286 | + $context->setLocale($localeItem); |
|
| 287 | 287 | |
| 288 | 288 | return $context; |
| 289 | 289 | } |