@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | public function __construct( $idBase, $name, $values ) |
16 | 16 | { |
17 | 17 | $controlOptions = $widgetOptions = []; |
18 | - if( isset( $values['class'] )) { |
|
18 | + if( isset($values['class']) ) { |
|
19 | 19 | $widgetOptions['classname'] = $values['class']; |
20 | 20 | } |
21 | - if( isset( $values['description'] )) { |
|
21 | + if( isset($values['description']) ) { |
|
22 | 22 | $widgetOptions['description'] = $values['description']; |
23 | 23 | } |
24 | - if( isset( $values['width'] )) { |
|
24 | + if( isset($values['width']) ) { |
|
25 | 25 | $controlOptions['width'] = $values['width']; |
26 | 26 | } |
27 | 27 | parent::__construct( $idBase, $name, $widgetOptions, $controlOptions ); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | protected function renderField( $tag, array $args = [] ) |
35 | 35 | { |
36 | 36 | $args = $this->normalizeFieldAttributes( $tag, $args ); |
37 | - $field = glsr( Builder::class )->{$tag}( $args['name'], $args ); |
|
37 | + $field = glsr( Builder::class )->{$tag}($args['name'], $args); |
|
38 | 38 | echo glsr( Builder::class )->div( $field, [ |
39 | 39 | 'class' => 'glsr-field', |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function normalizeFieldAttributes( $tag, array $args ) |
48 | 48 | { |
49 | - if( empty( $args['value'] )) { |
|
49 | + if( empty($args['value']) ) { |
|
50 | 50 | $args['value'] = $this->widgetArgs[$args['name']]; |
51 | 51 | } |
52 | - if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) { |
|
52 | + if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) { |
|
53 | 53 | $args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] ); |
54 | 54 | } |
55 | 55 | $args['id'] = $this->get_field_id( $args['name'] ); |
@@ -15,8 +15,8 @@ |
||
15 | 15 | */ |
16 | 16 | protected function sanitize( array $args ) |
17 | 17 | { |
18 | - if( empty( $args['id'] )) { |
|
19 | - $args['id'] = substr( md5( serialize( $args )), 0, 8 ); |
|
18 | + if( empty($args['id']) ) { |
|
19 | + $args['id'] = substr( md5( serialize( $args ) ), 0, 8 ); |
|
20 | 20 | } |
21 | 21 | return $args; |
22 | 22 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | { |
15 | 15 | foreach( $command->shortcodes as $shortcode ) { |
16 | 16 | $shortcodeClass = glsr( Helper::class )->buildClassName( $shortcode.'-shortcode', 'Shortcodes' ); |
17 | - if( !class_exists( $shortcodeClass )) { |
|
18 | - glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass )); |
|
17 | + if( !class_exists( $shortcodeClass ) ) { |
|
18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) ); |
|
19 | 19 | continue; |
20 | 20 | } |
21 | 21 | add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] ); |
@@ -16,8 +16,8 @@ |
||
16 | 16 | global $wp_widget_factory; |
17 | 17 | foreach( $command->widgets as $key => $values ) { |
18 | 18 | $widgetClass = glsr( Helper::class )->buildClassName( $key.'-widget', 'Widgets' ); |
19 | - if( !class_exists( $widgetClass )) { |
|
20 | - glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass )); |
|
19 | + if( !class_exists( $widgetClass ) ) { |
|
20 | + glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass ) ); |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | // Here we bypass register_widget() in order to pass our custom values to the widget |
@@ -11,10 +11,10 @@ |
||
11 | 11 | */ |
12 | 12 | public function handle( Command $command ) |
13 | 13 | { |
14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) )return; |
|
15 | 15 | register_post_type( $command->postType, $command->args ); |
16 | 16 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
17 | 17 | $command->postType => $command->columns, |
18 | - ]); |
|
18 | + ] ); |
|
19 | 19 | } |
20 | 20 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - if( !get_post( $command->id )) { |
|
15 | + if( !get_post( $command->id ) ) { |
|
16 | 16 | return false; |
17 | 17 | } |
18 | - if( is_null( $command->pinned )) { |
|
18 | + if( is_null( $command->pinned ) ) { |
|
19 | 19 | $meta = get_post_meta( $command->id, 'pinned', true ); |
20 | 20 | $command->pinned = !wp_validate_boolean( $meta ); |
21 | 21 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function add( $type, $message, array $args = [] ) |
17 | 17 | { |
18 | - if( empty( array_filter( [$message, $type] )))return; |
|
18 | + if( empty(array_filter( [$message, $type] )) )return; |
|
19 | 19 | $args['message'] = $message; |
20 | 20 | $args['type'] = $type; |
21 | - add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); |
|
21 | + add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) ); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | public function get() |
55 | 55 | { |
56 | 56 | $notices = array_map( 'unserialize', |
57 | - array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) |
|
57 | + array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) ) |
|
58 | 58 | ); |
59 | - if( empty( $notices ))return; |
|
59 | + if( empty($notices) )return; |
|
60 | 60 | return array_reduce( $notices, function( $carry, $notice ) { |
61 | - return $carry.$this->buildNotice( json_decode( $notice['message'], true )); |
|
61 | + return $carry.$this->buildNotice( json_decode( $notice['message'], true ) ); |
|
62 | 62 | }); |
63 | 63 | } |
64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | return glsr( Builder::class )->div( $messages, [ |
81 | 81 | 'class' => $class, |
82 | - ]); |
|
82 | + ] ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | 'type' => '', |
95 | 95 | ]; |
96 | 96 | $args = shortcode_atts( $defaults, $args ); |
97 | - if( !in_array( $args['type'], ['error', 'warning', 'success'] )) { |
|
97 | + if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) { |
|
98 | 98 | $args['type'] = 'success'; |
99 | 99 | } |
100 | 100 | $args['messages'] = is_wp_error( $args['message'] ) |
101 | 101 | ? (array)$args['message']->get_error_message() |
102 | 102 | : (array)$args['message']; |
103 | - unset( $args['message'] ); |
|
103 | + unset($args['message']); |
|
104 | 104 | return $args; |
105 | 105 | } |
106 | 106 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function build( $partialPath, array $args = [] ) |
14 | 14 | { |
15 | 15 | $className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' ); |
16 | - if( !class_exists( $className )) { |
|
16 | + if( !class_exists( $className ) ) { |
|
17 | 17 | glsr_log()->error( 'Partial missing: '.$className ); |
18 | 18 | return; |
19 | 19 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // 'is_test' => 1, |
32 | 32 | ]; |
33 | 33 | foreach( $_SERVER as $key => $value ) { |
34 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; |
|
34 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue; |
|
35 | 35 | $submission[$key] = $value; |
36 | 36 | } |
37 | - return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); |
|
37 | + return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | { |
58 | 58 | $query = []; |
59 | 59 | foreach( $data as $key => $value ) { |
60 | - if( is_array( $value ) || is_object( $value ))continue; |
|
60 | + if( is_array( $value ) || is_object( $value ) )continue; |
|
61 | 61 | if( $value === false ) { |
62 | 62 | $value = '0'; |
63 | 63 | } |
64 | 64 | $value = trim( $value ); |
65 | - if( !strlen( $value ))continue; |
|
65 | + if( !strlen( $value ) )continue; |
|
66 | 66 | $query[] = urlencode( $key ).'='.urlencode( $value ); |
67 | 67 | } |
68 | 68 | return implode( '&', $query ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | || !is_callable( ['Akismet', 'get_api_key'] ) |
78 | 78 | || !is_callable( ['Akismet', 'http_post'] ) |
79 | 79 | ? false |
80 | - : (bool) AkismetPlugin::get_api_key(); |
|
80 | + : (bool)AkismetPlugin::get_api_key(); |
|
81 | 81 | return apply_filters( 'site-reviews/akismet/is-active', $check ); |
82 | 82 | } |
83 | 83 | } |