Completed
Push — master ( fdf507...97a1e0 )
by Aimeos
19:59
created
admin/jqadm/tests/TestHelperJqadm.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -13,51 +13,51 @@  discard block
 block discarded – undo
13 13
 	public static function bootstrap()
14 14
 	{
15 15
 		self::getAimeos();
16
-		\Aimeos\MShop\Factory::setCache( false );
16
+		\Aimeos\MShop\Factory::setCache(false);
17 17
 	}
18 18
 
19 19
 
20
-	public static function getContext( $site = 'unittest' )
20
+	public static function getContext($site = 'unittest')
21 21
 	{
22
-		if( !isset( self::$context[$site] ) ) {
23
-			self::$context[$site] = self::createContext( $site );
22
+		if (!isset(self::$context[$site])) {
23
+			self::$context[$site] = self::createContext($site);
24 24
 		}
25 25
 
26 26
 		return clone self::$context[$site];
27 27
 	}
28 28
 
29 29
 
30
-	public static function getView( $site = 'unittest', \Aimeos\MW\Config\Iface $config = null )
30
+	public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null)
31 31
 	{
32
-		if( $config === null ) {
33
-			$config = self::getContext( $site )->getConfig();
32
+		if ($config === null) {
33
+			$config = self::getContext($site)->getConfig();
34 34
 		}
35 35
 
36
-		$view = new \Aimeos\MW\View\Standard( self::getTemplatePaths() );
36
+		$view = new \Aimeos\MW\View\Standard(self::getTemplatePaths());
37 37
 
38
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
39
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
40
-		$view->addHelper( 'translate', $helper );
38
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
39
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
40
+		$view->addHelper('translate', $helper);
41 41
 
42
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
43
-		$view->addHelper( 'url', $helper );
42
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
43
+		$view->addHelper('url', $helper);
44 44
 
45
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
46
-		$view->addHelper( 'number', $helper );
45
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
46
+		$view->addHelper('number', $helper);
47 47
 
48
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
49
-		$view->addHelper( 'date', $helper );
48
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
49
+		$view->addHelper('date', $helper);
50 50
 
51
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin', 'client/html', 'controller/jsonadm' ) );
52
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
53
-		$view->addHelper( 'config', $helper );
51
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm'));
52
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
53
+		$view->addHelper('config', $helper);
54 54
 
55
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_csrf_token', '_csrf_value' );
56
-		$view->addHelper( 'csrf', $helper );
55
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value');
56
+		$view->addHelper('csrf', $helper);
57 57
 
58
-		$fcn = function() { return array( 'admin' ); };
59
-		$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn );
60
-		$view->addHelper( 'access', $helper );
58
+		$fcn = function() { return array('admin'); };
59
+		$helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn);
60
+		$view->addHelper('access', $helper);
61 61
 
62 62
 		return $view;
63 63
 	}
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 
66 66
 	public static function getTemplatePaths()
67 67
 	{
68
-		return self::getAimeos()->getCustomPaths( 'admin/jqadm/templates' );
68
+		return self::getAimeos()->getCustomPaths('admin/jqadm/templates');
69 69
 	}
70 70
 
71 71
 
72 72
 	private static function getAimeos()
73 73
 	{
74
-		if( !isset( self::$aimeos ) )
74
+		if (!isset(self::$aimeos))
75 75
 		{
76 76
 			require_once 'Bootstrap.php';
77
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
77
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
78 78
 
79
-			$extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
80
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
79
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
80
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
81 81
 		}
82 82
 
83 83
 		return self::$aimeos;
@@ -87,53 +87,53 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * @param string $site
89 89
 	 */
90
-	private static function createContext( $site )
90
+	private static function createContext($site)
91 91
 	{
92 92
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
93 93
 		$aimeos = self::getAimeos();
94 94
 
95 95
 
96
-		$paths = $aimeos->getConfigPaths( 'mysql' );
96
+		$paths = $aimeos->getConfigPaths('mysql');
97 97
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
98 98
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
99
-		$local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) );
99
+		$local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp')));
100 100
 
101
-		$conf = new \Aimeos\MW\Config\PHPArray( $local, $paths );
102
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
103
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
104
-		$ctx->setConfig( $conf );
101
+		$conf = new \Aimeos\MW\Config\PHPArray($local, $paths);
102
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
103
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
104
+		$ctx->setConfig($conf);
105 105
 
106 106
 
107
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
108
-		$ctx->setDatabaseManager( $dbm );
107
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
108
+		$ctx->setDatabaseManager($dbm);
109 109
 
110 110
 
111
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf );
112
-		$ctx->setFilesystemManager( $fs );
111
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
112
+		$ctx->setFilesystemManager($fs);
113 113
 
114 114
 
115
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
116
-		$ctx->setLogger( $logger );
115
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
116
+		$ctx->setLogger($logger);
117 117
 
118 118
 
119 119
 		$cache = new \Aimeos\MW\Cache\None();
120
-		$ctx->setCache( $cache );
120
+		$ctx->setCache($cache);
121 121
 
122 122
 
123
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
124
-		$ctx->setI18n( array( 'de' => $i18n ) );
123
+		$i18n = new \Aimeos\MW\Translation\None('de');
124
+		$ctx->setI18n(array('de' => $i18n));
125 125
 
126 126
 
127 127
 		$session = new \Aimeos\MW\Session\None();
128
-		$ctx->setSession( $session );
128
+		$ctx->setSession($session);
129 129
 
130 130
 
131
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
132
-		$locale = $localeManager->bootstrap( $site, '', '', false );
133
-		$ctx->setLocale( $locale );
131
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
132
+		$locale = $localeManager->bootstrap($site, '', '', false);
133
+		$ctx->setLocale($locale);
134 134
 
135 135
 
136
-		$ctx->setEditor( 'core:admin/jqadm' );
136
+		$ctx->setEditor('core:admin/jqadm');
137 137
 
138 138
 		return $ctx;
139 139
 	}
Please login to merge, or discard this patch.
admin/jqadm/templates/common/page-default.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -8,30 +8,30 @@  discard block
 block discarded – undo
8 8
 $enc = $this->encoder();
9 9
 
10 10
 $target = $this->request()->getTarget();
11
-$cntl = $this->config( 'admin/jqadm/url/search/controller', 'Jqadm' );
12
-$action = $this->config( 'admin/jqadm/url/search/action', 'search' );
13
-$config = $this->config( 'admin/jqadm/url/search/config', array() );
11
+$cntl = $this->config('admin/jqadm/url/search/controller', 'Jqadm');
12
+$action = $this->config('admin/jqadm/url/search/action', 'search');
13
+$config = $this->config('admin/jqadm/url/search/config', array());
14 14
 
15
-$jsonTarget = $this->config( 'admin/jsonadm/url/options/target' );
16
-$jsonCntl = $this->config( 'admin/jsonadm/url/options/controller', 'Jsonadm' );
17
-$jsonAction = $this->config( 'admin/jsonadm/url/options/action', 'options' );
18
-$jsonConfig = $this->config( 'admin/jsonadm/url/options/config', array() );
15
+$jsonTarget = $this->config('admin/jsonadm/url/options/target');
16
+$jsonCntl = $this->config('admin/jsonadm/url/options/controller', 'Jsonadm');
17
+$jsonAction = $this->config('admin/jsonadm/url/options/action', 'options');
18
+$jsonConfig = $this->config('admin/jsonadm/url/options/config', array());
19 19
 
20
-$extTarget = $this->config( 'admin/extjs/url/target' );
21
-$extCntl = $this->config( 'admin/extjs/url/controller', 'Extadm' );
22
-$extAction = $this->config( 'admin/extjs/url/action', 'index' );
23
-$extConfig = $this->config( 'admin/extjs/url/config', array() );
20
+$extTarget = $this->config('admin/extjs/url/target');
21
+$extCntl = $this->config('admin/extjs/url/controller', 'Extadm');
22
+$extAction = $this->config('admin/extjs/url/action', 'index');
23
+$extConfig = $this->config('admin/extjs/url/config', array());
24 24
 
25
-$sites = $this->get( 'pageSites', array() );
26
-$site = $this->param( 'site' );
25
+$sites = $this->get('pageSites', array());
26
+$site = $this->param('site');
27 27
 
28
-$extParams = array( 'site' => $site, 'lang' => $this->param( 'lang' ) );
28
+$extParams = array('site' => $site, 'lang' => $this->param('lang'));
29 29
 
30
-$params = $this->get( 'pageParams', array() );
31
-$params['id'] = $this->param( 'id', '' );
30
+$params = $this->get('pageParams', array());
31
+$params['id'] = $this->param('id', '');
32 32
 
33 33
 ?>
34
-<div class="aimeos" data-url="<?php echo $enc->attr( $this->url( $jsonTarget, $jsonCntl, $jsonAction, array( 'site' => $site, 'resource' => '', 'id' => '' ), array(), $jsonConfig ) ); ?>">
34
+<div class="aimeos" data-url="<?php echo $enc->attr($this->url($jsonTarget, $jsonCntl, $jsonAction, array('site' => $site, 'resource' => '', 'id' => ''), array(), $jsonConfig)); ?>">
35 35
 
36 36
 	<nav class="navbar navbar-full">
37 37
 		<a class="navbar-brand" href="https://aimeos.org/update/?type={type}&version={version}">
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
 		<div class="collapse navbar-toggleable-xs" id="collapse-navbar">
44 44
 			<ul class="nav navbar-nav">
45
-<?php if( $this->access( 'admin' ) ) : ?>
45
+<?php if ($this->access('admin')) : ?>
46 46
 				<li class="nav-item mode active">
47
-					<a class="nav-link" href="<?php echo $enc->attr( $this->url( $extTarget, $extCntl, $extAction, $extParams, array(), $extConfig ) ); ?>">
48
-						<?php echo $enc->html( $this->translate( 'admin', 'Expert mode' ) ); ?>
47
+					<a class="nav-link" href="<?php echo $enc->attr($this->url($extTarget, $extCntl, $extAction, $extParams, array(), $extConfig)); ?>">
48
+						<?php echo $enc->html($this->translate('admin', 'Expert mode')); ?>
49 49
 					</a>
50 50
 				</li>
51 51
 <?php endif; ?>
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 
54 54
 					<div class="btn-group">
55 55
 						<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
56
-							<?php echo $enc->attr( $this->param( 'lang', $this->translate( 'admin', 'Language' ) ) ); ?>
56
+							<?php echo $enc->attr($this->param('lang', $this->translate('admin', 'Language'))); ?>
57 57
 						</button>
58 58
 						<div class="dropdown-menu">
59
-<?php foreach( $this->get( 'pageLanguages', array() ) as $langid ) : ?>
59
+<?php foreach ($this->get('pageLanguages', array()) as $langid) : ?>
60 60
 							<a class="dropdown-item"
61
-								href="<?php echo $enc->attr( $this->url( $target, $cntl, $action, array( 'lang' => $langid ) + $params, array(), $config ) ); ?>">
62
-								<?php echo $enc->html( $langid ); ?>
61
+								href="<?php echo $enc->attr($this->url($target, $cntl, $action, array('lang' => $langid) + $params, array(), $config)); ?>">
62
+								<?php echo $enc->html($langid); ?>
63 63
 							</a>
64 64
 <?php endforeach; ?>
65 65
 						</div>
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 
71 71
 					<div class="btn-group">
72 72
 						<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
73
-							<?php echo $enc->attr( $this->value( $sites, $site, $this->translate( 'admin', 'Site' ) ) ); ?>
73
+							<?php echo $enc->attr($this->value($sites, $site, $this->translate('admin', 'Site'))); ?>
74 74
 						</button>
75 75
 						<div class="dropdown-menu">
76
-<?php foreach( $sites as $code => $label ) : ?>
76
+<?php foreach ($sites as $code => $label) : ?>
77 77
 							<a class="dropdown-item"
78
-								href="<?php echo $enc->attr( $this->url( $target, $cntl, $action, array( 'site' => $code ) + $params, array(), $config ) ); ?>">
79
-								<?php echo $enc->html( $label ); ?>
78
+								href="<?php echo $enc->attr($this->url($target, $cntl, $action, array('site' => $code) + $params, array(), $config)); ?>">
79
+								<?php echo $enc->html($label); ?>
80 80
 							</a>
81 81
 <?php endforeach; ?>
82 82
 						</div>
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 
91 91
 	<div class="container">
92 92
 
93
-<?php echo $this->partial( $this->config( 'admin/jqadm/partial/error', 'common/partials/error-default.php' ), array( 'errors' => $this->get( 'errors', array() ) ) ); ?>
93
+<?php echo $this->partial($this->config('admin/jqadm/partial/error', 'common/partials/error-default.php'), array('errors' => $this->get('errors', array()))); ?>
94 94
 
95
-<?php echo $this->block()->get( 'jqadm_content' ); ?>
95
+<?php echo $this->block()->get('jqadm_content'); ?>
96 96
 
97 97
 	</div>
98 98
 
99
-<?php echo $this->partial( $this->config( 'admin/jqadm/partial/confirm', 'common/partials/confirm-default.php' ) ); ?>
99
+<?php echo $this->partial($this->config('admin/jqadm/partial/confirm', 'common/partials/confirm-default.php')); ?>
100 100
 
101 101
 </div>
102 102
\ No newline at end of file
Please login to merge, or discard this patch.