| @@ -9,57 +9,57 @@ | ||
| 9 | 9 | |
| 10 | 10 | if( !function_exists( 'aiconfig' ) ) | 
| 11 | 11 |  { | 
| 12 | - /** | |
| 13 | - * Returns the configuration setting for the given key | |
| 14 | - * | |
| 15 | - * @param string $key Configuration key | |
| 16 | - * @param mixed $default Default value if the configuration key isn't found | |
| 17 | - * @return mixed Configuration value | |
| 18 | - */ | |
| 19 | - function aiconfig( $key, $default = null ) | |
| 20 | -    { | |
| 21 | - return app( '\Aimeos\Shop\Base\Config' )->get()->get( $key, $default ); | |
| 22 | - } | |
| 12 | + /** | |
| 13 | + * Returns the configuration setting for the given key | |
| 14 | + * | |
| 15 | + * @param string $key Configuration key | |
| 16 | + * @param mixed $default Default value if the configuration key isn't found | |
| 17 | + * @return mixed Configuration value | |
| 18 | + */ | |
| 19 | + function aiconfig( $key, $default = null ) | |
| 20 | +	{ | |
| 21 | + return app( '\Aimeos\Shop\Base\Config' )->get()->get( $key, $default ); | |
| 22 | + } | |
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | if( !function_exists( 'aitrans' ) ) | 
| 27 | 27 |  { | 
| 28 | - /** | |
| 29 | - * Translates the given message | |
| 30 | - * | |
| 31 | - * @param string $singular Message to translate | |
| 32 | - * @param array $params List of paramters for replacing the placeholders in that order | |
| 33 | - * @param string $domain Translation domain | |
| 34 | - * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" | |
| 35 | - * @return string Translated string | |
| 36 | - */ | |
| 37 | - function aitrans( $singular, array $params = array(), $domain = 'client', $locale = null ) | |
| 38 | -    { | |
| 39 | - $i18n = app( '\Aimeos\Shop\Base\Context' )->get()->getI18n( $locale ); | |
| 28 | + /** | |
| 29 | + * Translates the given message | |
| 30 | + * | |
| 31 | + * @param string $singular Message to translate | |
| 32 | + * @param array $params List of paramters for replacing the placeholders in that order | |
| 33 | + * @param string $domain Translation domain | |
| 34 | + * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" | |
| 35 | + * @return string Translated string | |
| 36 | + */ | |
| 37 | + function aitrans( $singular, array $params = array(), $domain = 'client', $locale = null ) | |
| 38 | +	{ | |
| 39 | + $i18n = app( '\Aimeos\Shop\Base\Context' )->get()->getI18n( $locale ); | |
| 40 | 40 | |
| 41 | - return vsprintf( $i18n->dt( $domain, $singular ), $params ); | |
| 42 | - } | |
| 41 | + return vsprintf( $i18n->dt( $domain, $singular ), $params ); | |
| 42 | + } | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | if( !function_exists( 'aitransplural' ) ) | 
| 47 | 47 |  { | 
| 48 | - /** | |
| 49 | - * Translates the given messages based on the number | |
| 50 | - * | |
| 51 | - * @param string $singular Message to translate | |
| 52 | - * @param string $plural Message for plural translations | |
| 53 | - * @param integer $number Count of items to chose the correct plural translation | |
| 54 | - * @param array $params List of paramters for replacing the placeholders in that order | |
| 55 | - * @param string $domain Translation domain | |
| 56 | - * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" | |
| 57 | - * @return string Translated string | |
| 58 | - */ | |
| 59 | - function aitransplural( $singular, $plural, $number, array $params = array(), $domain = 'client', $locale = null ) | |
| 60 | -    { | |
| 61 | - $i18n = app( '\Aimeos\Shop\Base\Context' )->get()->getI18n( $locale ); | |
| 48 | + /** | |
| 49 | + * Translates the given messages based on the number | |
| 50 | + * | |
| 51 | + * @param string $singular Message to translate | |
| 52 | + * @param string $plural Message for plural translations | |
| 53 | + * @param integer $number Count of items to chose the correct plural translation | |
| 54 | + * @param array $params List of paramters for replacing the placeholders in that order | |
| 55 | + * @param string $domain Translation domain | |
| 56 | + * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" | |
| 57 | + * @return string Translated string | |
| 58 | + */ | |
| 59 | + function aitransplural( $singular, $plural, $number, array $params = array(), $domain = 'client', $locale = null ) | |
| 60 | +	{ | |
| 61 | + $i18n = app( '\Aimeos\Shop\Base\Context' )->get()->getI18n( $locale ); | |
| 62 | 62 | |
| 63 | - return vsprintf( $i18n->dn( $domain, $singular, $plural, $number ), $params ); | |
| 64 | - } | |
| 63 | + return vsprintf( $i18n->dn( $domain, $singular, $plural, $number ), $params ); | |
| 64 | + } | |
| 65 | 65 | } | 
| @@ -100,8 +100,7 @@ discard block | ||
| 100 | 100 | || ( ( $user = \Illuminate\Support\Facades\Auth::user() ) !== null && $user->superuser ) | 
| 101 | 101 |  		) { | 
| 102 | 102 | $helper = new \Aimeos\MW\View\Helper\Access\All( $view ); | 
| 103 | - } | |
| 104 | - else | |
| 103 | + } else | |
| 105 | 104 |  		{ | 
| 106 | 105 | $support = $this->support; | 
| 107 | 106 | |
| @@ -245,8 +244,7 @@ discard block | ||
| 245 | 244 |  		{ | 
| 246 | 245 | $i18n = $this->i18n->get( array( $locale ) ); | 
| 247 | 246 | $translation = $i18n[$locale]; | 
| 248 | - } | |
| 249 | - else | |
| 247 | + } else | |
| 250 | 248 |  		{ | 
| 251 | 249 | $translation = new \Aimeos\MW\Translation\None( 'en' ); | 
| 252 | 250 | } | 
| @@ -18,13 +18,13 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | class Shop extends \Illuminate\Support\Facades\Facade | 
| 20 | 20 |  { | 
| 21 | - /** | |
| 22 | - * Get the registered name of the component. | |
| 23 | - * | |
| 24 | - * @return string | |
| 25 | - */ | |
| 26 | - protected static function getFacadeAccessor() | |
| 27 | -    { | |
| 28 | - return 'aimeos.shop'; | |
| 29 | - } | |
| 21 | + /** | |
| 22 | + * Get the registered name of the component. | |
| 23 | + * | |
| 24 | + * @return string | |
| 25 | + */ | |
| 26 | + protected static function getFacadeAccessor() | |
| 27 | +	{ | |
| 28 | + return 'aimeos.shop'; | |
| 29 | + } | |
| 30 | 30 | } | 
| @@ -13,11 +13,11 @@ | ||
| 13 | 13 |  		$app['config']->set('database.connections.mysql', [ | 
| 14 | 14 | 'driver' => 'mysql', | 
| 15 | 15 |  			'host' => env('DB_HOST', '127.0.0.1'), | 
| 16 | -            'port' => env('DB_PORT', '3306'), | |
| 16 | +			'port' => env('DB_PORT', '3306'), | |
| 17 | 17 |  			'database' => env('DB_DATABASE', 'laravel'), | 
| 18 | 18 |  			'username' => env('DB_USERNAME', 'root'), | 
| 19 | 19 |  			'password' => env('DB_PASSWORD', ''), | 
| 20 | -            'unix_socket' => env('DB_SOCKET', ''), | |
| 20 | +			'unix_socket' => env('DB_SOCKET', ''), | |
| 21 | 21 | 'collation' => 'utf8_unicode_ci', | 
| 22 | 22 | ]); | 
| 23 | 23 | |
| @@ -69,9 +69,12 @@ | ||
| 69 | 69 | $this->cache[$user->id][$groups] = false; | 
| 70 | 70 | $context = $this->context->get( false ); | 
| 71 | 71 | |
| 72 | -		try { | |
| 72 | + try | |
| 73 | +		{ | |
| 73 | 74 | $site = \Aimeos\MShop::create( $context, 'locale/site' )->getItem( $user->siteid )->getCode(); | 
| 74 | -		} catch( \Exception $e ) { | |
| 75 | + } | |
| 76 | + catch( \Exception $e ) | |
| 77 | +		{ | |
| 75 | 78 | $site = ( Route::current() ? Route::input( 'site', Input::get( 'site', 'default' ) ) : 'default' ); | 
| 76 | 79 | } | 
| 77 | 80 | |
| @@ -86,9 +86,12 @@ | ||
| 86 | 86 |  	{ | 
| 87 | 87 | $localeManager = \Aimeos\MShop::create( $context, 'locale' ); | 
| 88 | 88 | |
| 89 | -		try { | |
| 89 | + try | |
| 90 | +		{ | |
| 90 | 91 | $localeItem = $localeManager->bootstrap( $site, '', '', false, null, true ); | 
| 91 | -		} catch( \Aimeos\MShop\Exception $e ) { | |
| 92 | + } | |
| 93 | + catch( \Aimeos\MShop\Exception $e ) | |
| 94 | +		{ | |
| 92 | 95 | $localeItem = $localeManager->createItem(); | 
| 93 | 96 | } | 
| 94 | 97 | |
| @@ -162,9 +162,12 @@ | ||
| 162 | 162 |  	{ | 
| 163 | 163 | $manager = \Aimeos\MShop::create( $context, 'customer' ); | 
| 164 | 164 | |
| 165 | -		try { | |
| 165 | + try | |
| 166 | +		{ | |
| 166 | 167 | $item = $manager->findItem( $email ); | 
| 167 | -		} catch( \Aimeos\MShop\Exception $e ) { | |
| 168 | + } | |
| 169 | + catch( \Aimeos\MShop\Exception $e ) | |
| 170 | +		{ | |
| 168 | 171 | $item = $manager->createItem(); | 
| 169 | 172 | } | 
| 170 | 173 | |
| @@ -19,7 +19,8 @@ | ||
| 19 | 19 | * Aimeos shop service provider for Laravel | 
| 20 | 20 | * @package laravel | 
| 21 | 21 | */ | 
| 22 | -class ShopServiceProvider extends ServiceProvider { | |
| 22 | +class ShopServiceProvider extends ServiceProvider | |
| 23 | +{ | |
| 23 | 24 | |
| 24 | 25 | /** | 
| 25 | 26 | * Indicates if loading of the provider is deferred. | 
| @@ -260,8 +260,7 @@ | ||
| 260 | 260 |  	{ | 
| 261 | 261 | if( ( $userid = Auth::id() ) !== null ) | 
| 262 | 262 |  		{ | 
| 263 | - $context->setGroupIds( function() use ( $context, $userid ) | |
| 264 | -			{ | |
| 263 | +			$context->setGroupIds( function() use ( $context, $userid ) { | |
| 265 | 264 | $manager = \Aimeos\MShop::create( $context, 'customer' ); | 
| 266 | 265 | return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); | 
| 267 | 266 | } ); |