Completed
Push — master ( 30e75e...337e63 )
by Aimeos
07:00
created
admin/jsonadm/templates/aggregate-default.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$data = $this->get( 'data', [] );
3
+$data = $this->get('data', []);
4 4
 $entries = [];
5 5
 
6
-foreach( $data as $key => $value ) {
7
-	$entries[] = array( 'id' => $key, 'type' => 'aggregate', 'attributes' => $value );
6
+foreach ($data as $key => $value) {
7
+	$entries[] = array('id' => $key, 'type' => 'aggregate', 'attributes' => $value);
8 8
 }
9 9
 
10 10
 ?>
11 11
 {
12 12
 	"meta": {
13
-		"total": <?php echo count( $data ); ?>
13
+		"total": <?php echo count($data); ?>
14 14
 
15 15
 	},
16
-<?php	if( isset( $this->errors ) ) : ?>
17
-	"errors": <?php echo $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
18
-<?php	elseif( isset( $this->data ) ) : ?>
19
-	"data": <?php echo json_encode( $entries ); ?>
16
+<?php	if (isset($this->errors)) : ?>
17
+	"errors": <?php echo $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
18
+<?php	elseif (isset($this->data)) : ?>
19
+	"data": <?php echo json_encode($entries); ?>
20 20
 <?php	endif; ?>
21 21
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/get-default.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @see admin/jsonadm/url/action
15 15
  * @see admin/jsonadm/url/config
16 16
  */
17
-$target = $this->config( 'admin/jsonadm/url/target' );
17
+$target = $this->config('admin/jsonadm/url/target');
18 18
 
19 19
 /** admin/jsonadm/url/controller
20 20
  * Name of the client whose action should be called
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @see admin/jsonadm/url/action
31 31
  * @see admin/jsonadm/url/config
32 32
  */
33
-$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
33
+$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
34 34
 
35 35
 /** admin/jsonadm/url/action
36 36
  * Name of the action that should create the output
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @see admin/jsonadm/url/controller
47 47
  * @see admin/jsonadm/url/config
48 48
  */
49
-$action = $this->config( 'admin/jsonadm/url/action', 'get' );
49
+$action = $this->config('admin/jsonadm/url/action', 'get');
50 50
 
51 51
 /** admin/jsonadm/url/config
52 52
  * Associative list of configuration options used for generating the URL
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @see admin/jsonadm/url/controller
69 69
  * @see admin/jsonadm/url/action
70 70
  */
71
-$config = $this->config( 'admin/jsonadm/url/config', [] );
71
+$config = $this->config('admin/jsonadm/url/config', []);
72 72
 
73 73
 
74 74
 /** admin/jsonadm/partials/template-errors
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
  */
121 121
 
122 122
 
123
-$ref = array( 'id', 'resource', 'filter', 'page', 'sort', 'include', 'fields' );
124
-$params = array_intersect_key( $this->param(), array_flip( $ref ) );
123
+$ref = array('id', 'resource', 'filter', 'page', 'sort', 'include', 'fields');
124
+$params = array_intersect_key($this->param(), array_flip($ref));
125 125
 
126
-if( !isset( $params['id'] ) ) {
126
+if (!isset($params['id'])) {
127 127
 	$params['id'] = '';
128 128
 }
129 129
 
130 130
 
131
-$total = $this->get( 'total', 0 );
132
-$offset = max( $this->param( 'page/offset', 0 ), 0 );
133
-$limit = max( $this->param( 'page/limit', 25 ), 1 );
131
+$total = $this->get('total', 0);
132
+$offset = max($this->param('page/offset', 0), 0);
133
+$limit = max($this->param('page/limit', 25), 1);
134 134
 
135
-$first = ( $offset > 0 ? 0 : null );
136
-$prev = ( $offset - $limit >= 0 ? $offset - $limit : null );
137
-$next = ( $offset + $limit < $total ? $offset + $limit : null );
138
-$last = ( ((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null );
135
+$first = ($offset > 0 ? 0 : null);
136
+$prev = ($offset - $limit >= 0 ? $offset - $limit : null);
137
+$next = ($offset + $limit < $total ? $offset + $limit : null);
138
+$last = (((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null);
139 139
 
140 140
 ?>
141 141
 {
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 
145 145
 	},
146 146
 	"links": {
147
-<?php if( is_array( $this->get( 'data' ) ) ) : ?>
148
-<?php	if( $first !== null ) : ?>
149
-		"first": "<?php $params['page']['offset'] = $first; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
147
+<?php if (is_array($this->get('data'))) : ?>
148
+<?php	if ($first !== null) : ?>
149
+		"first": "<?php $params['page']['offset'] = $first; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
150 150
 <?php	endif; ?>
151
-<?php	if( $prev !== null ) : ?>
152
-		"prev": "<?php $params['page']['offset'] = $prev; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
151
+<?php	if ($prev !== null) : ?>
152
+		"prev": "<?php $params['page']['offset'] = $prev; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
153 153
 <?php	endif; ?>
154
-<?php	if( $next !== null ) : ?>
155
-		"next": "<?php $params['page']['offset'] = $next; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
154
+<?php	if ($next !== null) : ?>
155
+		"next": "<?php $params['page']['offset'] = $next; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
156 156
 <?php	endif; ?>
157
-<?php	if( $last !== null ) : ?>
158
-		"last": "<?php $params['page']['offset'] = $last; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
157
+<?php	if ($last !== null) : ?>
158
+		"last": "<?php $params['page']['offset'] = $last; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
159 159
 <?php	endif; ?>
160 160
 <?php endif; ?>
161
-		"self": "<?php $params['page']['offset'] = $offset; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>"
161
+		"self": "<?php $params['page']['offset'] = $offset; echo $this->url($target, $cntl, $action, $params, [], $config); ?>"
162 162
 	},
163
-<?php if( isset( $this->errors ) ) : ?>
164
-	"errors": <?php echo $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
165
-<?php elseif( isset( $this->data ) ) : ?>
166
-	"data": <?php echo $this->partial( $this->config( $this->get( 'partial-data', 'admin/jsonadm/partials/template-data' ), 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ), 'childItems' => $this->get( 'childItems', [] ), 'listItems' => $this->get( 'listItems', [] ) ) ); ?>,
167
-	"included": <?php echo $this->partial( $this->config( $this->get( 'partial-included', 'admin/jsonadm/partials/template-included' ), 'partials/included-standard.php' ), array( 'childItems' => $this->get( 'childItems', [] ), 'refItems' => $this->get( 'refItems', [] ) ) ); ?>
163
+<?php if (isset($this->errors)) : ?>
164
+	"errors": <?php echo $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
165
+<?php elseif (isset($this->data)) : ?>
166
+	"data": <?php echo $this->partial($this->config($this->get('partial-data', 'admin/jsonadm/partials/template-data'), 'partials/data-standard.php'), array('data' => $this->get('data'), 'childItems' => $this->get('childItems', []), 'listItems' => $this->get('listItems', []))); ?>,
167
+	"included": <?php echo $this->partial($this->config($this->get('partial-included', 'admin/jsonadm/partials/template-included'), 'partials/included-standard.php'), array('childItems' => $this->get('childItems', []), 'refItems' => $this->get('refItems', []))); ?>
168 168
 <?php endif; ?>
169 169
 
170 170
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/partials/included-standard.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $options = 0;
4
-if( defined( 'JSON_PRETTY_PRINT' ) ) {
4
+if (defined('JSON_PRETTY_PRINT')) {
5 5
 	$options = JSON_PRETTY_PRINT;
6 6
 }
7 7
 
8 8
 
9
-$build = function( \Aimeos\MW\View\Iface $view, array $items, array $fields )
9
+$build = function(\Aimeos\MW\View\Iface $view, array $items, array $fields)
10 10
 {
11 11
 	$list = [];
12 12
 
13
-	$target = $view->config( 'admin/jsonadm/url/target' );
14
-	$cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' );
15
-	$action = $view->config( 'admin/jsonadm/url/action', 'get' );
16
-	$config = $view->config( 'admin/jsonadm/url/config', [] );
13
+	$target = $view->config('admin/jsonadm/url/target');
14
+	$cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm');
15
+	$action = $view->config('admin/jsonadm/url/action', 'get');
16
+	$config = $view->config('admin/jsonadm/url/config', []);
17 17
 
18
-	foreach( (array) $items as $item )
18
+	foreach ((array) $items as $item)
19 19
 	{
20 20
 		$id = $item->getId();
21 21
 		$attributes = $item->toArray();
22 22
 		$type = $item->getResourceType();
23 23
 
24
-		if( isset( $fields[$type] ) ) {
25
-			$attributes = array_intersect_key( $attributes, $fields[$type] );
24
+		if (isset($fields[$type])) {
25
+			$attributes = array_intersect_key($attributes, $fields[$type]);
26 26
 		}
27 27
 
28 28
 		$list[] = array(
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 			'type' => $type,
31 31
 			'attributes' => $attributes,
32 32
 			'links' => array(
33
-				'self' => $view->url( $target, $cntl, $action, array( 'resource' => $type, 'id' => $id ), [], $config ),
33
+				'self' => $view->url($target, $cntl, $action, array('resource' => $type, 'id' => $id), [], $config),
34 34
 				'related' => array(
35
-					'href' => $view->url( $target, $cntl, $action, array( 'resource' => $type, 'id' => null ), [], $config )
35
+					'href' => $view->url($target, $cntl, $action, array('resource' => $type, 'id' => null), [], $config)
36 36
 				)
37 37
 			)
38 38
 		);
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
 $response = [];
46
-$fields = $this->param( 'fields', [] );
46
+$fields = $this->param('fields', []);
47 47
 
48
-foreach( (array) $fields as $resource => $list ) {
49
-	$fields[$resource] = array_flip( explode( ',', $list ) );
48
+foreach ((array) $fields as $resource => $list) {
49
+	$fields[$resource] = array_flip(explode(',', $list));
50 50
 }
51 51
 
52
-$response = $build( $this, $this->get( 'childItems', [] ), $fields );
53
-$response = array_merge( $response, $build( $this, $this->get( 'refItems', [] ), $fields ) );
52
+$response = $build($this, $this->get('childItems', []), $fields);
53
+$response = array_merge($response, $build($this, $this->get('refItems', []), $fields));
54 54
 
55 55
 
56
-echo json_encode( $response, $options );
57 56
\ No newline at end of file
57
+echo json_encode($response, $options);
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/templates/partials/errors-standard.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $options = 0;
4
-if( defined( 'JSON_PRETTY_PRINT' ) ) {
4
+if (defined('JSON_PRETTY_PRINT')) {
5 5
 	$options = JSON_PRETTY_PRINT;
6 6
 }
7 7
 
8 8
 
9
-echo json_encode( $this->get( 'errors', [] ), $options );
10 9
\ No newline at end of file
10
+echo json_encode($this->get('errors', []), $options);
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/templates/options-default.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$target = $this->config( 'admin/jsonadm/url/target' );
4
-$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
5
-$action = $this->config( 'admin/jsonadm/url/action', 'get' );
6
-$config = $this->config( 'admin/jsonadm/url/config', [] );
3
+$target = $this->config('admin/jsonadm/url/target');
4
+$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
5
+$action = $this->config('admin/jsonadm/url/action', 'get');
6
+$config = $this->config('admin/jsonadm/url/config', []);
7 7
 
8 8
 $resources = $attributes = [];
9
-$site = $this->param( 'site', 'default' );
9
+$site = $this->param('site', 'default');
10 10
 
11
-foreach( $this->get( 'resources', [] ) as $resource ) {
12
-	$resources[$resource] = $this->url( $target, $cntl, $action, array( 'site' => $site, 'resource' => $resource, 'id' => '' ), [], $config );
11
+foreach ($this->get('resources', []) as $resource) {
12
+	$resources[$resource] = $this->url($target, $cntl, $action, array('site' => $site, 'resource' => $resource, 'id' => ''), [], $config);
13 13
 }
14 14
 
15
-foreach( $this->get( 'attributes', [] ) as $attr ) {
15
+foreach ($this->get('attributes', []) as $attr) {
16 16
 	$attributes[$attr->getCode()] = $attr->toArray();
17 17
 }
18 18
 
19 19
 ?>
20 20
 {
21 21
 	"meta": {
22
-		"prefix": <?php echo json_encode( $this->get( 'prefix' ) ); ?>,
23
-		"resources": <?php echo json_encode( $resources ); ?>,
24
-		"attributes": <?php echo json_encode( $attributes ); ?>
22
+		"prefix": <?php echo json_encode($this->get('prefix')); ?>,
23
+		"resources": <?php echo json_encode($resources); ?>,
24
+		"attributes": <?php echo json_encode($attributes); ?>
25 25
 	}
26
-<?php if( isset( $this->errors ) ) : ?>
27
-	,"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
26
+<?php if (isset($this->errors)) : ?>
27
+	,"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
28 28
 <?php endif; ?>
29 29
 
30 30
 }
Please login to merge, or discard this patch.