Passed
Push — master ( 054ae2...bf35ce )
by Paul
04:22
created
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@
 block discarded – undo
11 11
      * @param int $postId
12 12
      * @return void
13 13
      */
14
-    public function saveAssignedToMetabox($postId)
14
+    public function saveAssignedToMetabox( $postId )
15 15
     {
16
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-assigned-to'), 'assigned_to')) {
16
+        if( !wp_verify_nonce( Helper::filterInput( '_nonce-assigned-to' ), 'assigned_to' ) ) {
17 17
             return;
18 18
         }
19
-        $assignedTo = strval(Helper::filterInput('assigned_to'));
20
-        glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
19
+        $assignedTo = strval( Helper::filterInput( 'assigned_to' ) );
20
+        glsr( Database::class )->update( $postId, 'assigned_to', $assignedTo );
21 21
     }
22 22
 
23 23
     /**
24 24
      * @param int $postId
25 25
      * @return mixed
26 26
      */
27
-    public function saveResponseMetabox($postId)
27
+    public function saveResponseMetabox( $postId )
28 28
     {
29
-        if (!wp_verify_nonce(Helper::filterInput('_nonce-response'), 'response')) {
29
+        if( !wp_verify_nonce( Helper::filterInput( '_nonce-response' ), 'response' ) ) {
30 30
             return;
31 31
         }
32
-        $response = strval(Helper::filterInput('response'));
33
-        glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
32
+        $response = strval( Helper::filterInput( 'response' ) );
33
+        glsr( Database::class )->update( $postId, 'response', trim( wp_kses( $response, [
34 34
             'a' => ['href' => [], 'title' => []],
35 35
             'em' => [],
36 36
             'strong' => [],
37
-        ])));
37
+        ] ) ) );
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
plugin/Controllers/BlocksController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
      * @return array
14 14
      * @filter block_categories
15 15
      */
16
-    public function filterBlockCategories($categories)
16
+    public function filterBlockCategories( $categories )
17 17
     {
18
-        $categories = Arr::consolidateArray($categories);
18
+        $categories = Arr::consolidateArray( $categories );
19 19
         $categories[] = [
20 20
             'icon' => null,
21 21
             'slug' => Application::ID,
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @filter classic_editor_enabled_editors_for_post_type
32 32
      * @plugin classic-editor/classic-editor.php
33 33
      */
34
-    public function filterEnabledEditors($editors, $postType)
34
+    public function filterEnabledEditors( $editors, $postType )
35 35
     {
36 36
         return Application::POST_TYPE == $postType
37 37
             ? ['block_editor' => false, 'classic_editor' => false]
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @return bool
45 45
      * @filter use_block_editor_for_post_type
46 46
      */
47
-    public function filterUseBlockEditor($bool, $postType)
47
+    public function filterUseBlockEditor( $bool, $postType )
48 48
     {
49 49
         return Application::POST_TYPE == $postType
50 50
             ? false
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
     {
59 59
         wp_register_style(
60 60
             Application::ID.'/blocks',
61
-            glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
61
+            glsr()->url( 'assets/styles/'.Application::ID.'-blocks.css' ),
62 62
             ['wp-edit-blocks'],
63 63
             glsr()->version
64 64
         );
65 65
         wp_register_script(
66 66
             Application::ID.'/blocks',
67
-            glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
67
+            glsr()->url( 'assets/scripts/'.Application::ID.'-blocks.js' ),
68 68
             ['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
69 69
             glsr()->version
70 70
         );
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         $blocks = [
80 80
             'form', 'reviews', 'summary',
81 81
         ];
82
-        foreach ($blocks as $block) {
83
-            $id = str_replace('_reviews', '', Application::ID.'_'.$block);
84
-            $blockClass = Helper::buildClassName($id.'-block', 'Blocks');
85
-            if (!class_exists($blockClass)) {
86
-                glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
82
+        foreach( $blocks as $block ) {
83
+            $id = str_replace( '_reviews', '', Application::ID.'_'.$block );
84
+            $blockClass = Helper::buildClassName( $id.'-block', 'Blocks' );
85
+            if( !class_exists( $blockClass ) ) {
86
+                glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ) );
87 87
                 continue;
88 88
             }
89
-            glsr($blockClass)->register($block);
89
+            glsr( $blockClass )->register( $block );
90 90
         }
91 91
     }
92 92
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterShortcodes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = Helper::buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
15
+        foreach( $command->shortcodes as $shortcode ) {
16
+            $shortcodeClass = Helper::buildClassName( $shortcode.'-shortcode', 'Shortcodes' );
17
+            if( !class_exists( $shortcodeClass ) ) {
18
+                glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) );
19 19
                 continue;
20 20
             }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
21
+            add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] );
22 22
         }
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterTinymcePopups.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        foreach ($command->popups as $slug => $label) {
16
-            $buttonClass = Helper::buildClassName($slug.'-popup', 'Shortcodes');
17
-            if (!class_exists($buttonClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $buttonClass));
15
+        foreach( $command->popups as $slug => $label ) {
16
+            $buttonClass = Helper::buildClassName( $slug.'-popup', 'Shortcodes' );
17
+            if( !class_exists( $buttonClass ) ) {
18
+                glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) );
19 19
                 continue;
20 20
             }
21
-            $shortcode = glsr($buttonClass)->register($slug, [
21
+            $shortcode = glsr( $buttonClass )->register( $slug, [
22 22
                 'label' => $label,
23 23
                 'title' => $label,
24
-            ]);
24
+            ] );
25 25
             glsr()->mceShortcodes[$slug] = $shortcode->properties;
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterWidgets.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
     /**
12 12
      * @return void
13 13
      */
14
-    public function handle(Command $command)
14
+    public function handle( Command $command )
15 15
     {
16 16
         global $wp_widget_factory;
17
-        foreach ($command->widgets as $key => $values) {
18
-            $widgetClass = Helper::buildClassName($key.'-widget', 'Widgets');
19
-            if (!class_exists($widgetClass)) {
20
-                glsr_log()->error(sprintf('Class missing (%s)', $widgetClass));
17
+        foreach( $command->widgets as $key => $values ) {
18
+            $widgetClass = Helper::buildClassName( $key.'-widget', 'Widgets' );
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
24
-            $widget = new $widgetClass(Application::ID.'_'.$key, $values['title'], $values);
24
+            $widget = new $widgetClass( Application::ID.'_'.$key, $values['title'], $values );
25 25
             $wp_widget_factory->widgets[$widgetClass] = $widget;
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
     public function defaults()
13 13
     {
14 14
         $settings = $this->settings();
15
-        $defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
-        return wp_parse_args($defaults, [
15
+        $defaults = (array)array_combine( array_keys( $settings ), glsr_array_column( $settings, 'default' ) );
16
+        return wp_parse_args( $defaults, [
17 17
             'version' => '',
18 18
             'version_upgraded_from' => '',
19
-        ]);
19
+        ] );
20 20
     }
21 21
 
22 22
     /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function get()
26 26
     {
27
-        return Arr::convertDotNotationArray($this->defaults());
27
+        return Arr::convertDotNotationArray( $this->defaults() );
28 28
     }
29 29
 
30 30
     /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function set()
34 34
     {
35
-        $settings = glsr(OptionManager::class)->all();
36
-        $currentSettings = Arr::removeEmptyArrayValues($settings);
37
-        $defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
-        $updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
-        update_option(OptionManager::databaseKey(), $updatedSettings);
35
+        $settings = glsr( OptionManager::class )->all();
36
+        $currentSettings = Arr::removeEmptyArrayValues( $settings );
37
+        $defaultSettings = array_replace_recursive( $this->get(), $currentSettings );
38
+        $updatedSettings = array_replace_recursive( $settings, $defaultSettings );
39
+        update_option( OptionManager::databaseKey(), $updatedSettings );
40 40
         return $defaultSettings;
41 41
     }
42 42
 
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function settings()
47 47
     {
48
-        $settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
-        return $this->normalize($settings);
48
+        $settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) );
49
+        return $this->normalize( $settings );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @return array
54 54
      */
55
-    protected function normalize(array $settings)
55
+    protected function normalize( array $settings )
56 56
     {
57
-        array_walk($settings, function (&$setting) {
58
-            if (isset($setting['default'])) {
57
+        array_walk( $settings, function( &$setting ) {
58
+            if( isset($setting['default']) ) {
59 59
                 return;
60 60
             }
61 61
             $setting['default'] = '';
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @return string
19 19
      */
20
-    public static function databaseKey($version = null)
20
+    public static function databaseKey( $version = null )
21 21
     {
22
-        if (null === $version) {
23
-            $version = explode('.', glsr()->version);
24
-            $version = array_shift($version);
22
+        if( null === $version ) {
23
+            $version = explode( '.', glsr()->version );
24
+            $version = array_shift( $version );
25 25
         }
26 26
         return Str::snakeCase(
27
-            Application::ID.'-v'.intval($version)
27
+            Application::ID.'-v'.intval( $version )
28 28
         );
29 29
     }
30 30
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function all()
35 35
     {
36
-        if (empty($this->options)) {
36
+        if( empty($this->options) ) {
37 37
             $this->reset();
38 38
         }
39 39
         return $this->options;
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
      * @param string $path
44 44
      * @return bool
45 45
      */
46
-    public function delete($path)
46
+    public function delete( $path )
47 47
     {
48
-        $keys = explode('.', $path);
49
-        $last = array_pop($keys);
48
+        $keys = explode( '.', $path );
49
+        $last = array_pop( $keys );
50 50
         $options = $this->all();
51 51
         $pointer = &$options;
52
-        foreach ($keys as $key) {
53
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
+        foreach( $keys as $key ) {
53
+            if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) ) {
54 54
                 continue;
55 55
             }
56 56
             $pointer = &$pointer[$key];
57 57
         }
58 58
         unset($pointer[$last]);
59
-        return $this->set($options);
59
+        return $this->set( $options );
60 60
     }
61 61
 
62 62
     /**
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
      * @param string $cast
66 66
      * @return mixed
67 67
      */
68
-    public function get($path = '', $fallback = '', $cast = '')
68
+    public function get( $path = '', $fallback = '', $cast = '' )
69 69
     {
70
-        $result = Arr::get($this->all(), $path, $fallback);
71
-        return Helper::castTo($cast, $result);
70
+        $result = Arr::get( $this->all(), $path, $fallback );
71
+        return Helper::castTo( $cast, $result );
72 72
     }
73 73
 
74 74
     /**
75 75
      * @param string $path
76 76
      * @return bool
77 77
      */
78
-    public function getBool($path)
78
+    public function getBool( $path )
79 79
     {
80
-        return Helper::castTo('bool', $this->get($path));
80
+        return Helper::castTo( 'bool', $this->get( $path ) );
81 81
     }
82 82
 
83 83
     /**
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
      * @param string $cast
87 87
      * @return mixed
88 88
      */
89
-    public function getWP($path, $fallback = '', $cast = '')
89
+    public function getWP( $path, $fallback = '', $cast = '' )
90 90
     {
91
-        $option = get_option($path, $fallback);
92
-        if (empty($option)) {
91
+        $option = get_option( $path, $fallback );
92
+        if( empty($option) ) {
93 93
             $option = $fallback;
94 94
         }
95
-        return Helper::castTo($cast, $option);
95
+        return Helper::castTo( $cast, $option );
96 96
     }
97 97
 
98 98
     /**
@@ -100,25 +100,25 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function json()
102 102
     {
103
-        return json_encode($this->all());
103
+        return json_encode( $this->all() );
104 104
     }
105 105
 
106 106
     /**
107 107
      * @return array
108 108
      */
109
-    public function normalize(array $options = [])
109
+    public function normalize( array $options = [] )
110 110
     {
111 111
         $options = wp_parse_args(
112
-            Arr::flattenArray($options),
113
-            glsr(DefaultsManager::class)->defaults()
112
+            Arr::flattenArray( $options ),
113
+            glsr( DefaultsManager::class )->defaults()
114 114
         );
115
-        array_walk($options, function (&$value) {
116
-            if (!is_string($value)) {
115
+        array_walk( $options, function( &$value ) {
116
+            if( !is_string( $value ) ) {
117 117
                 return;
118 118
             }
119
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
119
+            $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
120 120
         });
121
-        return Arr::convertDotNotationArray($options);
121
+        return Arr::convertDotNotationArray( $options );
122 122
     }
123 123
 
124 124
     /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function isRecaptchaEnabled()
128 128
     {
129
-        $integration = $this->get('settings.submissions.recaptcha.integration');
129
+        $integration = $this->get( 'settings.submissions.recaptcha.integration' );
130 130
         return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131 131
     }
132 132
 
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function reset()
137 137
     {
138
-        $options = $this->getWP(static::databaseKey(), []);
139
-        if (!is_array($options) || empty($options)) {
140
-            delete_option(static::databaseKey());
138
+        $options = $this->getWP( static::databaseKey(), [] );
139
+        if( !is_array( $options ) || empty($options) ) {
140
+            delete_option( static::databaseKey() );
141 141
             $options = glsr()->defaults ?: [];
142 142
         }
143 143
         $this->options = $options;
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
      * @param mixed $value
149 149
      * @return bool
150 150
      */
151
-    public function set($pathOrOptions, $value = '')
151
+    public function set( $pathOrOptions, $value = '' )
152 152
     {
153
-        if (is_string($pathOrOptions)) {
154
-            $pathOrOptions = Arr::set($this->all(), $pathOrOptions, $value);
153
+        if( is_string( $pathOrOptions ) ) {
154
+            $pathOrOptions = Arr::set( $this->all(), $pathOrOptions, $value );
155 155
         }
156
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
156
+        if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) {
157 157
             $this->reset();
158 158
         }
159 159
         return $result;
Please login to merge, or discard this patch.
plugin/Commands/RegisterPostType.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
     public $postType;
16 16
     public $single;
17 17
 
18
-    public function __construct($input)
18
+    public function __construct( $input )
19 19
     {
20
-        $args = glsr(PostTypeDefaults::class)->merge($input);
21
-        $this->normalize($args);
20
+        $args = glsr( PostTypeDefaults::class )->merge( $input );
21
+        $this->normalize( $args );
22 22
         $this->normalizeColumns();
23 23
         $this->normalizeLabels();
24 24
     }
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
     /**
27 27
      * @return void
28 28
      */
29
-    protected function normalize(array $args)
29
+    protected function normalize( array $args )
30 30
     {
31
-        foreach ($args as $key => $value) {
32
-            $property = Helper::buildPropertyName($key);
33
-            if (!property_exists($this, $property)) {
31
+        foreach( $args as $key => $value ) {
32
+            $property = Helper::buildPropertyName( $key );
33
+            if( !property_exists( $this, $property ) ) {
34 34
                 continue;
35 35
             }
36 36
             $this->$property = $value;
37 37
             unset($args[$key]);
38 38
         }
39
-        $this->args = wp_parse_args($args, [
39
+        $this->args = wp_parse_args( $args, [
40 40
             'menu_name' => $this->plural,
41
-        ]);
41
+        ] );
42 42
     }
43 43
 
44 44
     /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function normalizeLabels()
48 48
     {
49
-        $this->args['labels'] = wp_parse_args($this->args['labels'], [
50
-            'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural),
51
-            'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural),
52
-            'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single),
53
-            'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single),
54
-            'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single),
49
+        $this->args['labels'] = wp_parse_args( $this->args['labels'], [
50
+            'add_new_item' => sprintf( _x( 'Add New %s', 'Add New Post', 'site-reviews' ), $this->plural ),
51
+            'all_items' => sprintf( _x( 'All %s', 'All Posts', 'site-reviews' ), $this->plural ),
52
+            'archives' => sprintf( _x( '%s Archives', 'Post Archives', 'site-reviews' ), $this->single ),
53
+            'edit_item' => sprintf( _x( 'Edit %s', 'Edit Post', 'site-reviews' ), $this->single ),
54
+            'insert_into_item' => sprintf( _x( 'Insert into %s', 'Insert into Post', 'site-reviews' ), $this->single ),
55 55
             'menu_name' => $this->args['menu_name'],
56 56
             'name' => $this->plural,
57
-            'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single),
58
-            'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural),
59
-            'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural),
60
-            'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural),
57
+            'new_item' => sprintf( _x( 'New %s', 'New Post', 'site-reviews' ), $this->single ),
58
+            'not_found' => sprintf( _x( 'No %s found', 'No Posts found', 'site-reviews' ), $this->plural ),
59
+            'not_found_in_trash' => sprintf( _x( 'No %s found in Trash', 'No Posts found in Trash', 'site-reviews' ), $this->plural ),
60
+            'search_items' => sprintf( _x( 'Search %s', 'Search Posts', 'site-reviews' ), $this->plural ),
61 61
             'singular_name' => $this->single,
62
-            'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single),
63
-            'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single),
64
-        ]);
62
+            'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ),
63
+            'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ),
64
+        ] );
65 65
         unset($this->args['menu_name']);
66 66
     }
67 67
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     protected function normalizeColumns()
72 72
     {
73 73
         $this->columns = ['cb' => ''] + $this->columns;
74
-        if (array_key_exists('category', $this->columns)) {
75
-            $keys = array_keys($this->columns);
76
-            $keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY;
77
-            $this->columns = array_combine($keys, $this->columns);
74
+        if( array_key_exists( 'category', $this->columns ) ) {
75
+            $keys = array_keys( $this->columns );
76
+            $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY;
77
+            $this->columns = array_combine( $keys, $this->columns );
78 78
         }
79
-        if (array_key_exists('pinned', $this->columns)) {
80
-            $this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
79
+        if( array_key_exists( 'pinned', $this->columns ) ) {
80
+            $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>',
81 81
                 ['class' => 'pinned-icon']
82 82
             );
83 83
         }
Please login to merge, or discard this patch.
plugin/Commands/CreateReview.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@  discard block
 block discarded – undo
27 27
     public $title;
28 28
     public $url;
29 29
 
30
-    public function __construct($input)
30
+    public function __construct( $input )
31 31
     {
32 32
         $this->request = $input;
33 33
         $this->ajax_request = isset($input['_ajax_request']);
34
-        $this->assigned_to = $this->getNumeric('assign_to');
35
-        $this->author = sanitize_text_field($this->getUser('name'));
34
+        $this->assigned_to = $this->getNumeric( 'assign_to' );
35
+        $this->author = sanitize_text_field( $this->getUser( 'name' ) );
36 36
         $this->avatar = $this->getAvatar();
37 37
         $this->blacklisted = isset($input['blacklisted']);
38 38
         $this->category = $this->getCategory();
39
-        $this->content = sanitize_textarea_field($this->get('content'));
39
+        $this->content = sanitize_textarea_field( $this->get( 'content' ) );
40 40
         $this->custom = $this->getCustom();
41
-        $this->date = $this->getDate('date');
42
-        $this->email = sanitize_email($this->getUser('email'));
43
-        $this->form_id = sanitize_key($this->get('form_id'));
44
-        $this->ip_address = $this->get('ip_address');
45
-        $this->post_id = intval($this->get('_post_id'));
46
-        $this->rating = intval($this->get('rating'));
47
-        $this->referer = $this->get('_referer');
48
-        $this->response = sanitize_textarea_field($this->get('response'));
41
+        $this->date = $this->getDate( 'date' );
42
+        $this->email = sanitize_email( $this->getUser( 'email' ) );
43
+        $this->form_id = sanitize_key( $this->get( 'form_id' ) );
44
+        $this->ip_address = $this->get( 'ip_address' );
45
+        $this->post_id = intval( $this->get( '_post_id' ) );
46
+        $this->rating = intval( $this->get( 'rating' ) );
47
+        $this->referer = $this->get( '_referer' );
48
+        $this->response = sanitize_textarea_field( $this->get( 'response' ) );
49 49
         $this->terms = !empty($input['terms']);
50
-        $this->title = sanitize_text_field($this->get('title'));
51
-        $this->url = esc_url_raw($this->get('url'));
50
+        $this->title = sanitize_text_field( $this->get( 'title' ) );
51
+        $this->url = esc_url_raw( $this->get( 'url' ) );
52 52
     }
53 53
 
54 54
     /**
55 55
      * @param string $key
56 56
      * @return string
57 57
      */
58
-    protected function get($key)
58
+    protected function get( $key )
59 59
     {
60
-        return (string) Arr::get($this->request, $key);
60
+        return (string)Arr::get( $this->request, $key );
61 61
     }
62 62
 
63 63
     /**
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function getAvatar()
67 67
     {
68
-        $avatar = $this->get('avatar');
69
-        return !filter_var($avatar, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)
70
-            ? (string) get_avatar_url($this->get('email'))
68
+        $avatar = $this->get( 'avatar' );
69
+        return !filter_var( $avatar, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED )
70
+            ? (string)get_avatar_url( $this->get( 'email' ) )
71 71
             : $avatar;
72 72
     }
73 73
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
      */
77 77
     protected function getCategory()
78 78
     {
79
-        $categories = Arr::convertStringToArray($this->get('category'));
80
-        return sanitize_key(Arr::get($categories, 0));
79
+        $categories = Arr::convertStringToArray( $this->get( 'category' ) );
80
+        return sanitize_key( Arr::get( $categories, 0 ) );
81 81
     }
82 82
 
83 83
     /**
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
             '_referer', 'assign_to', 'category', 'content', 'date', 'email', 'excluded', 'form_id',
91 91
             'gotcha', 'ip_address', 'name', 'rating', 'response', 'terms', 'title', 'url',
92 92
         ];
93
-        $unset = apply_filters('site-reviews/create/unset-keys-from-custom', $unset);
93
+        $unset = apply_filters( 'site-reviews/create/unset-keys-from-custom', $unset );
94 94
         $custom = $this->request;
95
-        foreach ($unset as $value) {
95
+        foreach( $unset as $value ) {
96 96
             unset($custom[$value]);
97 97
         }
98 98
         return $custom;
@@ -102,29 +102,29 @@  discard block
 block discarded – undo
102 102
      * @param string $key
103 103
      * @return string
104 104
      */
105
-    protected function getDate($key)
105
+    protected function getDate( $key )
106 106
     {
107
-        $date = strtotime($this->get($key));
108
-        if (false === $date) {
107
+        $date = strtotime( $this->get( $key ) );
108
+        if( false === $date ) {
109 109
             $date = time();
110 110
         }
111
-        return get_date_from_gmt(gmdate('Y-m-d H:i:s', $date));
111
+        return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date ) );
112 112
     }
113 113
 
114 114
     /**
115 115
      * @param string $key
116 116
      * @return string
117 117
      */
118
-    protected function getUser($key)
118
+    protected function getUser( $key )
119 119
     {
120
-        $value = $this->get($key);
121
-        if (empty($value)) {
120
+        $value = $this->get( $key );
121
+        if( empty($value) ) {
122 122
             $user = wp_get_current_user();
123 123
             $userValues = [
124 124
                 'email' => 'user_email',
125 125
                 'name' => 'display_name',
126 126
             ];
127
-            if ($user->exists() && array_key_exists($key, $userValues)) {
127
+            if( $user->exists() && array_key_exists( $key, $userValues ) ) {
128 128
                 return $user->{$userValues[$key]};
129 129
             }
130 130
         }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
      * @param string $key
136 136
      * @return string
137 137
      */
138
-    protected function getNumeric($key)
138
+    protected function getNumeric( $key )
139 139
     {
140
-        $value = $this->get($key);
141
-        return is_numeric($value)
140
+        $value = $this->get( $key );
141
+        return is_numeric( $value )
142 142
             ? $value
143 143
             : '';
144 144
     }
Please login to merge, or discard this patch.