Passed
Push — feature/rebusify ( 495106...67b08f )
by Paul
06:10 queued 02:03
created
plugin/Commands/RegisterPostType.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,77 +9,77 @@
 block discarded – undo
9 9
 
10 10
 class RegisterPostType
11 11
 {
12
-    public $args;
13
-    public $columns;
14
-    public $plural;
15
-    public $postType;
16
-    public $single;
12
+	public $args;
13
+	public $columns;
14
+	public $plural;
15
+	public $postType;
16
+	public $single;
17 17
 
18
-    public function __construct($input)
19
-    {
20
-        $args = glsr(PostTypeDefaults::class)->merge($input);
21
-        $this->normalize($args);
22
-        $this->normalizeColumns();
23
-        $this->normalizeLabels();
24
-    }
18
+	public function __construct($input)
19
+	{
20
+		$args = glsr(PostTypeDefaults::class)->merge($input);
21
+		$this->normalize($args);
22
+		$this->normalizeColumns();
23
+		$this->normalizeLabels();
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     */
29
-    protected function normalize(array $args)
30
-    {
31
-        foreach ($args as $key => $value) {
32
-            $property = glsr(Helper::class)->buildPropertyName($key);
33
-            if (!property_exists($this, $property)) {
34
-                continue;
35
-            }
36
-            $this->$property = $value;
37
-            unset($args[$key]);
38
-        }
39
-        $this->args = wp_parse_args($args, [
40
-            'menu_name' => $this->plural,
41
-        ]);
42
-    }
26
+	/**
27
+	 * @return void
28
+	 */
29
+	protected function normalize(array $args)
30
+	{
31
+		foreach ($args as $key => $value) {
32
+			$property = glsr(Helper::class)->buildPropertyName($key);
33
+			if (!property_exists($this, $property)) {
34
+				continue;
35
+			}
36
+			$this->$property = $value;
37
+			unset($args[$key]);
38
+		}
39
+		$this->args = wp_parse_args($args, [
40
+			'menu_name' => $this->plural,
41
+		]);
42
+	}
43 43
 
44
-    /**
45
-     * @return void
46
-     */
47
-    protected function normalizeLabels()
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),
55
-            'menu_name' => $this->args['menu_name'],
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),
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
-        ]);
65
-        unset($this->args['menu_name']);
66
-    }
44
+	/**
45
+	 * @return void
46
+	 */
47
+	protected function normalizeLabels()
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),
55
+			'menu_name' => $this->args['menu_name'],
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),
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
+		]);
65
+		unset($this->args['menu_name']);
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     */
71
-    protected function normalizeColumns()
72
-    {
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);
78
-        }
79
-        if (array_key_exists('pinned', $this->columns)) {
80
-            $this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
81
-                ['class' => 'pinned-icon']
82
-            );
83
-        }
84
-    }
68
+	/**
69
+	 * @return void
70
+	 */
71
+	protected function normalizeColumns()
72
+	{
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);
78
+		}
79
+		if (array_key_exists('pinned', $this->columns)) {
80
+			$this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>',
81
+				['class' => 'pinned-icon']
82
+			);
83
+		}
84
+	}
85 85
 }
Please login to merge, or discard this 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 = glsr(Helper::class)->buildPropertyName($key);
33
-            if (!property_exists($this, $property)) {
31
+        foreach( $args as $key => $value ) {
32
+            $property = glsr( Helper::class )->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/RegisterShortcodes.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class RegisterShortcodes
6 6
 {
7
-    public $shortcodes;
7
+	public $shortcodes;
8 8
 
9
-    public function __construct($input)
10
-    {
11
-        $this->shortcodes = $input;
12
-    }
9
+	public function __construct($input)
10
+	{
11
+		$this->shortcodes = $input;
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $shortcodes;
8 8
 
9
-    public function __construct($input)
9
+    public function __construct( $input )
10 10
     {
11 11
         $this->shortcodes = $input;
12 12
     }
Please login to merge, or discard this patch.
plugin/Database.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,8 @@
 block discarded – undo
116 116
         ];
117 117
         if (is_numeric($searchTerm)) {
118 118
             $args['post__in'] = [$searchTerm];
119
-        } else {
119
+        }
120
+        else {
120 121
             $args['orderby'] = 'relevance';
121 122
             $args['posts_per_page'] = 10;
122 123
             $args['s'] = $searchTerm;
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -11,160 +11,160 @@
 block discarded – undo
11 11
 
12 12
 class Database
13 13
 {
14
-    /**
15
-     * @param int $postId
16
-     * @param string $key
17
-     * @param bool $single
18
-     * @return mixed
19
-     */
20
-    public function get($postId, $key, $single = true)
21
-    {
22
-        $key = glsr(Helper::class)->prefix('_', $key);
23
-        return get_post_meta(intval($postId), $key, $single);
24
-    }
14
+	/**
15
+	 * @param int $postId
16
+	 * @param string $key
17
+	 * @param bool $single
18
+	 * @return mixed
19
+	 */
20
+	public function get($postId, $key, $single = true)
21
+	{
22
+		$key = glsr(Helper::class)->prefix('_', $key);
23
+		return get_post_meta(intval($postId), $key, $single);
24
+	}
25 25
 
26
-    /**
27
-     * @param int $postId
28
-     * @param string $assignedTo
29
-     * @return void|WP_Post
30
-     */
31
-    public function getAssignedToPost($postId, $assignedTo = '')
32
-    {
33
-        if (empty($assignedTo)) {
34
-            $assignedTo = $this->get($postId, 'assigned_to');
35
-        }
36
-        if (empty($assignedTo)) {
37
-            return;
38
-        }
39
-        $assignedPost = get_post($assignedTo);
40
-        if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
41
-            return $assignedPost;
42
-        }
43
-    }
26
+	/**
27
+	 * @param int $postId
28
+	 * @param string $assignedTo
29
+	 * @return void|WP_Post
30
+	 */
31
+	public function getAssignedToPost($postId, $assignedTo = '')
32
+	{
33
+		if (empty($assignedTo)) {
34
+			$assignedTo = $this->get($postId, 'assigned_to');
35
+		}
36
+		if (empty($assignedTo)) {
37
+			return;
38
+		}
39
+		$assignedPost = get_post($assignedTo);
40
+		if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
41
+			return $assignedPost;
42
+		}
43
+	}
44 44
 
45
-    /**
46
-     * @param string $metaKey
47
-     * @param string $metaValue
48
-     * @return array|int
49
-     */
50
-    public function getReviewCount($metaKey = '', $metaValue = '')
51
-    {
52
-        if (!$metaKey) {
53
-            return (array) wp_count_posts(Application::POST_TYPE);
54
-        }
55
-        $counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
56
-        if (!$metaValue) {
57
-            return $counts;
58
-        }
59
-        return glsr_get($counts, $metaValue, 0);
60
-    }
45
+	/**
46
+	 * @param string $metaKey
47
+	 * @param string $metaValue
48
+	 * @return array|int
49
+	 */
50
+	public function getReviewCount($metaKey = '', $metaValue = '')
51
+	{
52
+		if (!$metaKey) {
53
+			return (array) wp_count_posts(Application::POST_TYPE);
54
+		}
55
+		$counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
56
+		if (!$metaValue) {
57
+			return $counts;
58
+		}
59
+		return glsr_get($counts, $metaValue, 0);
60
+	}
61 61
 
62
-    /**
63
-     * @param string $metaReviewType
64
-     * @return array
65
-     */
66
-    public function getReviewIdsByType($metaReviewType)
67
-    {
68
-        return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
69
-    }
62
+	/**
63
+	 * @param string $metaReviewType
64
+	 * @return array
65
+	 */
66
+	public function getReviewIdsByType($metaReviewType)
67
+	{
68
+		return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
69
+	}
70 70
 
71
-    /**
72
-     * @param string $key
73
-     * @param string $status
74
-     * @return array
75
-     */
76
-    public function getReviewsMeta($key, $status = 'publish')
77
-    {
78
-        if ('all' == $status || empty($status)) {
79
-            $status = get_post_stati(['exclude_from_search' => false]);
80
-        }
81
-        return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
82
-    }
71
+	/**
72
+	 * @param string $key
73
+	 * @param string $status
74
+	 * @return array
75
+	 */
76
+	public function getReviewsMeta($key, $status = 'publish')
77
+	{
78
+		if ('all' == $status || empty($status)) {
79
+			$status = get_post_stati(['exclude_from_search' => false]);
80
+		}
81
+		return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
82
+	}
83 83
 
84
-    /**
85
-     * @param string $field
86
-     * @return array
87
-     */
88
-    public function getTermIds(array $values, $field)
89
-    {
90
-        $termIds = [];
91
-        foreach ($values as $value) {
92
-            $term = get_term_by($field, $value, Application::TAXONOMY);
93
-            if (!isset($term->term_id)) {
94
-                continue;
95
-            }
96
-            $termIds[] = $term->term_id;
97
-        }
98
-        return $termIds;
99
-    }
84
+	/**
85
+	 * @param string $field
86
+	 * @return array
87
+	 */
88
+	public function getTermIds(array $values, $field)
89
+	{
90
+		$termIds = [];
91
+		foreach ($values as $value) {
92
+			$term = get_term_by($field, $value, Application::TAXONOMY);
93
+			if (!isset($term->term_id)) {
94
+				continue;
95
+			}
96
+			$termIds[] = $term->term_id;
97
+		}
98
+		return $termIds;
99
+	}
100 100
 
101
-    /**
102
-     * @return array
103
-     */
104
-    public function getTerms(array $args = [])
105
-    {
106
-        $args = wp_parse_args($args, [
107
-            'count' => false,
108
-            'fields' => 'id=>name',
109
-            'hide_empty' => false,
110
-            'taxonomy' => Application::TAXONOMY,
111
-        ]);
112
-        $terms = get_terms($args);
113
-        if (is_wp_error($terms)) {
114
-            glsr_log()->error($terms->get_error_message());
115
-            return [];
116
-        }
117
-        return $terms;
118
-    }
101
+	/**
102
+	 * @return array
103
+	 */
104
+	public function getTerms(array $args = [])
105
+	{
106
+		$args = wp_parse_args($args, [
107
+			'count' => false,
108
+			'fields' => 'id=>name',
109
+			'hide_empty' => false,
110
+			'taxonomy' => Application::TAXONOMY,
111
+		]);
112
+		$terms = get_terms($args);
113
+		if (is_wp_error($terms)) {
114
+			glsr_log()->error($terms->get_error_message());
115
+			return [];
116
+		}
117
+		return $terms;
118
+	}
119 119
 
120
-    /**
121
-     * @param string $searchTerm
122
-     * @return void|string
123
-     */
124
-    public function searchPosts($searchTerm)
125
-    {
126
-        $args = [
127
-            'post_status' => 'publish',
128
-            'post_type' => 'any',
129
-        ];
130
-        if (is_numeric($searchTerm)) {
131
-            $args['post__in'] = [$searchTerm];
132
-        } else {
133
-            $args['orderby'] = 'relevance';
134
-            $args['posts_per_page'] = 10;
135
-            $args['s'] = $searchTerm;
136
-        }
137
-        $queryBuilder = glsr(QueryBuilder::class);
138
-        add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
139
-        $search = new WP_Query($args);
140
-        remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
141
-        if (!$search->have_posts()) {
142
-            return;
143
-        }
144
-        $results = '';
145
-        while ($search->have_posts()) {
146
-            $search->the_post();
147
-            ob_start();
148
-            glsr()->render('partials/editor/search-result', [
149
-                'ID' => get_the_ID(),
150
-                'permalink' => esc_url((string) get_permalink()),
151
-                'title' => esc_attr(get_the_title()),
152
-            ]);
153
-            $results.= ob_get_clean();
154
-        }
155
-        wp_reset_postdata();
156
-        return $results;
157
-    }
120
+	/**
121
+	 * @param string $searchTerm
122
+	 * @return void|string
123
+	 */
124
+	public function searchPosts($searchTerm)
125
+	{
126
+		$args = [
127
+			'post_status' => 'publish',
128
+			'post_type' => 'any',
129
+		];
130
+		if (is_numeric($searchTerm)) {
131
+			$args['post__in'] = [$searchTerm];
132
+		} else {
133
+			$args['orderby'] = 'relevance';
134
+			$args['posts_per_page'] = 10;
135
+			$args['s'] = $searchTerm;
136
+		}
137
+		$queryBuilder = glsr(QueryBuilder::class);
138
+		add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
139
+		$search = new WP_Query($args);
140
+		remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
141
+		if (!$search->have_posts()) {
142
+			return;
143
+		}
144
+		$results = '';
145
+		while ($search->have_posts()) {
146
+			$search->the_post();
147
+			ob_start();
148
+			glsr()->render('partials/editor/search-result', [
149
+				'ID' => get_the_ID(),
150
+				'permalink' => esc_url((string) get_permalink()),
151
+				'title' => esc_attr(get_the_title()),
152
+			]);
153
+			$results.= ob_get_clean();
154
+		}
155
+		wp_reset_postdata();
156
+		return $results;
157
+	}
158 158
 
159
-    /**
160
-     * @param int $postId
161
-     * @param string $key
162
-     * @param mixed $value
163
-     * @return int|bool
164
-     */
165
-    public function update($postId, $key, $value)
166
-    {
167
-        $key = glsr(Helper::class)->prefix('_', $key);
168
-        return update_post_meta($postId, $key, $value);
169
-    }
159
+	/**
160
+	 * @param int $postId
161
+	 * @param string $key
162
+	 * @param mixed $value
163
+	 * @return int|bool
164
+	 */
165
+	public function update($postId, $key, $value)
166
+	{
167
+		$key = glsr(Helper::class)->prefix('_', $key);
168
+		return update_post_meta($postId, $key, $value);
169
+	}
170 170
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
      * @param bool $single
18 18
      * @return mixed
19 19
      */
20
-    public function get($postId, $key, $single = true)
20
+    public function get( $postId, $key, $single = true )
21 21
     {
22
-        $key = glsr(Helper::class)->prefix('_', $key);
23
-        return get_post_meta(intval($postId), $key, $single);
22
+        $key = glsr( Helper::class )->prefix( '_', $key );
23
+        return get_post_meta( intval( $postId ), $key, $single );
24 24
     }
25 25
 
26 26
     /**
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
      * @param string $assignedTo
29 29
      * @return void|WP_Post
30 30
      */
31
-    public function getAssignedToPost($postId, $assignedTo = '')
31
+    public function getAssignedToPost( $postId, $assignedTo = '' )
32 32
     {
33
-        if (empty($assignedTo)) {
34
-            $assignedTo = $this->get($postId, 'assigned_to');
33
+        if( empty($assignedTo) ) {
34
+            $assignedTo = $this->get( $postId, 'assigned_to' );
35 35
         }
36
-        if (empty($assignedTo)) {
36
+        if( empty($assignedTo) ) {
37 37
             return;
38 38
         }
39
-        $assignedPost = get_post($assignedTo);
40
-        if ($assignedPost instanceof WP_Post && $assignedPost->ID != $postId) {
39
+        $assignedPost = get_post( $assignedTo );
40
+        if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) {
41 41
             return $assignedPost;
42 42
         }
43 43
     }
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
      * @param string $metaValue
48 48
      * @return array|int
49 49
      */
50
-    public function getReviewCount($metaKey = '', $metaValue = '')
50
+    public function getReviewCount( $metaKey = '', $metaValue = '' )
51 51
     {
52
-        if (!$metaKey) {
53
-            return (array) wp_count_posts(Application::POST_TYPE);
52
+        if( !$metaKey ) {
53
+            return (array)wp_count_posts( Application::POST_TYPE );
54 54
         }
55
-        $counts = glsr(Cache::class)->getReviewCountsFor($metaKey);
56
-        if (!$metaValue) {
55
+        $counts = glsr( Cache::class )->getReviewCountsFor( $metaKey );
56
+        if( !$metaValue ) {
57 57
             return $counts;
58 58
         }
59
-        return glsr_get($counts, $metaValue, 0);
59
+        return glsr_get( $counts, $metaValue, 0 );
60 60
     }
61 61
 
62 62
     /**
63 63
      * @param string $metaReviewType
64 64
      * @return array
65 65
      */
66
-    public function getReviewIdsByType($metaReviewType)
66
+    public function getReviewIdsByType( $metaReviewType )
67 67
     {
68
-        return glsr(SqlQueries::class)->getReviewIdsByType($metaReviewType);
68
+        return glsr( SqlQueries::class )->getReviewIdsByType( $metaReviewType );
69 69
     }
70 70
 
71 71
     /**
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
73 73
      * @param string $status
74 74
      * @return array
75 75
      */
76
-    public function getReviewsMeta($key, $status = 'publish')
76
+    public function getReviewsMeta( $key, $status = 'publish' )
77 77
     {
78
-        if ('all' == $status || empty($status)) {
79
-            $status = get_post_stati(['exclude_from_search' => false]);
78
+        if( 'all' == $status || empty($status) ) {
79
+            $status = get_post_stati( ['exclude_from_search' => false] );
80 80
         }
81
-        return glsr(SqlQueries::class)->getReviewsMeta($key, $status);
81
+        return glsr( SqlQueries::class )->getReviewsMeta( $key, $status );
82 82
     }
83 83
 
84 84
     /**
85 85
      * @param string $field
86 86
      * @return array
87 87
      */
88
-    public function getTermIds(array $values, $field)
88
+    public function getTermIds( array $values, $field )
89 89
     {
90 90
         $termIds = [];
91
-        foreach ($values as $value) {
92
-            $term = get_term_by($field, $value, Application::TAXONOMY);
93
-            if (!isset($term->term_id)) {
91
+        foreach( $values as $value ) {
92
+            $term = get_term_by( $field, $value, Application::TAXONOMY );
93
+            if( !isset($term->term_id) ) {
94 94
                 continue;
95 95
             }
96 96
             $termIds[] = $term->term_id;
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
     /**
102 102
      * @return array
103 103
      */
104
-    public function getTerms(array $args = [])
104
+    public function getTerms( array $args = [] )
105 105
     {
106
-        $args = wp_parse_args($args, [
106
+        $args = wp_parse_args( $args, [
107 107
             'count' => false,
108 108
             'fields' => 'id=>name',
109 109
             'hide_empty' => false,
110 110
             'taxonomy' => Application::TAXONOMY,
111
-        ]);
112
-        $terms = get_terms($args);
113
-        if (is_wp_error($terms)) {
114
-            glsr_log()->error($terms->get_error_message());
111
+        ] );
112
+        $terms = get_terms( $args );
113
+        if( is_wp_error( $terms ) ) {
114
+            glsr_log()->error( $terms->get_error_message() );
115 115
             return [];
116 116
         }
117 117
         return $terms;
@@ -121,36 +121,36 @@  discard block
 block discarded – undo
121 121
      * @param string $searchTerm
122 122
      * @return void|string
123 123
      */
124
-    public function searchPosts($searchTerm)
124
+    public function searchPosts( $searchTerm )
125 125
     {
126 126
         $args = [
127 127
             'post_status' => 'publish',
128 128
             'post_type' => 'any',
129 129
         ];
130
-        if (is_numeric($searchTerm)) {
130
+        if( is_numeric( $searchTerm ) ) {
131 131
             $args['post__in'] = [$searchTerm];
132 132
         } else {
133 133
             $args['orderby'] = 'relevance';
134 134
             $args['posts_per_page'] = 10;
135 135
             $args['s'] = $searchTerm;
136 136
         }
137
-        $queryBuilder = glsr(QueryBuilder::class);
138
-        add_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2);
139
-        $search = new WP_Query($args);
140
-        remove_filter('posts_search', [$queryBuilder, 'filterSearchByTitle'], 500);
141
-        if (!$search->have_posts()) {
137
+        $queryBuilder = glsr( QueryBuilder::class );
138
+        add_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500, 2 );
139
+        $search = new WP_Query( $args );
140
+        remove_filter( 'posts_search', [$queryBuilder, 'filterSearchByTitle'], 500 );
141
+        if( !$search->have_posts() ) {
142 142
             return;
143 143
         }
144 144
         $results = '';
145
-        while ($search->have_posts()) {
145
+        while( $search->have_posts() ) {
146 146
             $search->the_post();
147 147
             ob_start();
148
-            glsr()->render('partials/editor/search-result', [
148
+            glsr()->render( 'partials/editor/search-result', [
149 149
                 'ID' => get_the_ID(),
150
-                'permalink' => esc_url((string) get_permalink()),
151
-                'title' => esc_attr(get_the_title()),
152
-            ]);
153
-            $results.= ob_get_clean();
150
+                'permalink' => esc_url( (string)get_permalink() ),
151
+                'title' => esc_attr( get_the_title() ),
152
+            ] );
153
+            $results .= ob_get_clean();
154 154
         }
155 155
         wp_reset_postdata();
156 156
         return $results;
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
      * @param mixed $value
163 163
      * @return int|bool
164 164
      */
165
-    public function update($postId, $key, $value)
165
+    public function update( $postId, $key, $value )
166 166
     {
167
-        $key = glsr(Helper::class)->prefix('_', $key);
168
-        return update_post_meta($postId, $key, $value);
167
+        $key = glsr( Helper::class )->prefix( '_', $key );
168
+        return update_post_meta( $postId, $key, $value );
169 169
     }
170 170
 }
Please login to merge, or discard this patch.
config/forms/submission-form.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'rating' => [
5
-        'label' => __('Your overall rating', 'site-reviews'),
6
-        'type' => 'rating',
7
-    ],
8
-    'title' => [
9
-        'label' => __('Title of your review', 'site-reviews'),
10
-        'placeholder' => __('Summarize your review or highlight an interesting detail', 'site-reviews'),
11
-        'type' => 'text',
12
-    ],
13
-    'content' => [
14
-        'label' => __('Your review', 'site-reviews'),
15
-        'placeholder' => __('Tell people your review', 'site-reviews'),
16
-        'rows' => 5,
17
-        'type' => 'textarea',
18
-    ],
19
-    'name' => [
20
-        'label' => __('Your name', 'site-reviews'),
21
-        'placeholder' => __('Tell us your name', 'site-reviews'),
22
-        'type' => 'text',
23
-    ],
24
-    'email' => [
25
-        'label' => __('Your email', 'site-reviews'),
26
-        'placeholder' => __('Tell us your email', 'site-reviews'),
27
-        'type' => 'email',
28
-    ],
29
-    'terms' => [
30
-        'label' => __('This review is based on my own experience and is my genuine opinion.', 'site-reviews'),
31
-        'type' => 'checkbox',
32
-    ],
4
+	'rating' => [
5
+		'label' => __('Your overall rating', 'site-reviews'),
6
+		'type' => 'rating',
7
+	],
8
+	'title' => [
9
+		'label' => __('Title of your review', 'site-reviews'),
10
+		'placeholder' => __('Summarize your review or highlight an interesting detail', 'site-reviews'),
11
+		'type' => 'text',
12
+	],
13
+	'content' => [
14
+		'label' => __('Your review', 'site-reviews'),
15
+		'placeholder' => __('Tell people your review', 'site-reviews'),
16
+		'rows' => 5,
17
+		'type' => 'textarea',
18
+	],
19
+	'name' => [
20
+		'label' => __('Your name', 'site-reviews'),
21
+		'placeholder' => __('Tell us your name', 'site-reviews'),
22
+		'type' => 'text',
23
+	],
24
+	'email' => [
25
+		'label' => __('Your email', 'site-reviews'),
26
+		'placeholder' => __('Tell us your email', 'site-reviews'),
27
+		'type' => 'email',
28
+	],
29
+	'terms' => [
30
+		'label' => __('This review is based on my own experience and is my genuine opinion.', 'site-reviews'),
31
+		'type' => 'checkbox',
32
+	],
33 33
 ];
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,32 +2,32 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     'rating' => [
5
-        'label' => __('Your overall rating', 'site-reviews'),
5
+        'label' => __( 'Your overall rating', 'site-reviews' ),
6 6
         'type' => 'rating',
7 7
     ],
8 8
     'title' => [
9
-        'label' => __('Title of your review', 'site-reviews'),
10
-        'placeholder' => __('Summarize your review or highlight an interesting detail', 'site-reviews'),
9
+        'label' => __( 'Title of your review', 'site-reviews' ),
10
+        'placeholder' => __( 'Summarize your review or highlight an interesting detail', 'site-reviews' ),
11 11
         'type' => 'text',
12 12
     ],
13 13
     'content' => [
14
-        'label' => __('Your review', 'site-reviews'),
15
-        'placeholder' => __('Tell people your review', 'site-reviews'),
14
+        'label' => __( 'Your review', 'site-reviews' ),
15
+        'placeholder' => __( 'Tell people your review', 'site-reviews' ),
16 16
         'rows' => 5,
17 17
         'type' => 'textarea',
18 18
     ],
19 19
     'name' => [
20
-        'label' => __('Your name', 'site-reviews'),
21
-        'placeholder' => __('Tell us your name', 'site-reviews'),
20
+        'label' => __( 'Your name', 'site-reviews' ),
21
+        'placeholder' => __( 'Tell us your name', 'site-reviews' ),
22 22
         'type' => 'text',
23 23
     ],
24 24
     'email' => [
25
-        'label' => __('Your email', 'site-reviews'),
26
-        'placeholder' => __('Tell us your email', 'site-reviews'),
25
+        'label' => __( 'Your email', 'site-reviews' ),
26
+        'placeholder' => __( 'Tell us your email', 'site-reviews' ),
27 27
         'type' => 'email',
28 28
     ],
29 29
     'terms' => [
30
-        'label' => __('This review is based on my own experience and is my genuine opinion.', 'site-reviews'),
30
+        'label' => __( 'This review is based on my own experience and is my genuine opinion.', 'site-reviews' ),
31 31
         'type' => 'checkbox',
32 32
     ],
33 33
 ];
Please login to merge, or discard this patch.
config/styles/ninja_forms.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'ninja-forms-field nf-element',
6
-        'textarea' => 'ninja-forms-field nf-element',
7
-    ],
4
+	'fields' => [
5
+		'input' => 'ninja-forms-field nf-element',
6
+		'textarea' => 'ninja-forms-field nf-element',
7
+	],
8 8
 ];
Please login to merge, or discard this patch.
config/styles/contact_form_7.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'wpcf7-form-control',
6
-        'input_text' => 'wpcf7-form-control wpcf7-text',
7
-        'input_email' => 'wpcf7-form-control wpcf7-text wpcf7-email',
8
-        'select' => 'wpcf7-form-control wpcf7-select',
9
-        'textarea' => 'wpcf7-form-control wpcf7-textarea',
10
-    ],
11
-    'validation' => [
12
-        'error_tag' => 'span',
13
-        'error_tag_class' => 'wpcf7-not-valid-tip',
14
-        'input_error_class' => 'wpcf7-not-valid',
15
-        'message_initial_class' => 'wpcf7-display-none',
16
-        'message_success_class' => 'wpcf7-mail-sent-ok',
17
-        'message_tag_class' => 'wpcf7-response-output',
18
-    ],
4
+	'fields' => [
5
+		'input' => 'wpcf7-form-control',
6
+		'input_text' => 'wpcf7-form-control wpcf7-text',
7
+		'input_email' => 'wpcf7-form-control wpcf7-text wpcf7-email',
8
+		'select' => 'wpcf7-form-control wpcf7-select',
9
+		'textarea' => 'wpcf7-form-control wpcf7-textarea',
10
+	],
11
+	'validation' => [
12
+		'error_tag' => 'span',
13
+		'error_tag_class' => 'wpcf7-not-valid-tip',
14
+		'input_error_class' => 'wpcf7-not-valid',
15
+		'message_initial_class' => 'wpcf7-display-none',
16
+		'message_success_class' => 'wpcf7-mail-sent-ok',
17
+		'message_tag_class' => 'wpcf7-response-output',
18
+	],
19 19
 ];
Please login to merge, or discard this patch.
config/styles/wpforms.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'wpforms-field-large',
6
-        'label' => 'wpforms-field-label',
7
-        'label_checkbox' => 'wpforms-field-label-inline',
8
-        'label_radio' => 'wpforms-field-label-inline',
9
-        'select' => 'wpforms-field-large',
10
-        'textarea' => 'wpforms-field-large',
11
-    ],
4
+	'fields' => [
5
+		'input' => 'wpforms-field-large',
6
+		'label' => 'wpforms-field-label',
7
+		'label_checkbox' => 'wpforms-field-label-inline',
8
+		'label_radio' => 'wpforms-field-label-inline',
9
+		'select' => 'wpforms-field-large',
10
+		'textarea' => 'wpforms-field-large',
11
+	],
12 12
 ];
Please login to merge, or discard this patch.
config/styles/bootstrap_4_custom.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'form-control',
6
-        'input_checkbox' => 'custom-control-input',
7
-        'input_radio' => 'custom-control-input',
8
-        'label_checkbox' => 'custom-control-label',
9
-        'label_radio' => 'custom-control-label',
10
-        'select' => 'form-control',
11
-        'textarea' => 'form-control',
12
-    ],
13
-    'validation' => [
14
-        'error_tag' => 'div',
15
-        'error_tag_class' => 'invalid-feedback',
16
-        'field_class' => 'form-group',
17
-        'input_error_class' => 'is-invalid',
18
-    ],
4
+	'fields' => [
5
+		'input' => 'form-control',
6
+		'input_checkbox' => 'custom-control-input',
7
+		'input_radio' => 'custom-control-input',
8
+		'label_checkbox' => 'custom-control-label',
9
+		'label_radio' => 'custom-control-label',
10
+		'select' => 'form-control',
11
+		'textarea' => 'form-control',
12
+	],
13
+	'validation' => [
14
+		'error_tag' => 'div',
15
+		'error_tag_class' => 'invalid-feedback',
16
+		'field_class' => 'form-group',
17
+		'input_error_class' => 'is-invalid',
18
+	],
19 19
 ];
Please login to merge, or discard this patch.
config/styles/divi.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'label' => 'et_pb_contact_form_label',
6
-    ],
4
+	'fields' => [
5
+		'label' => 'et_pb_contact_form_label',
6
+	],
7 7
 ];
Please login to merge, or discard this patch.