Passed
Push — master ( ae1954...aab291 )
by Paul
08:17 queued 04:15
created
plugin/Database.php 1 patch
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -11,171 +11,171 @@
 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 set($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 set($postId, $key, $value)
166
+	{
167
+		$key = glsr(Helper::class)->prefix('_', $key);
168
+		return update_post_meta($postId, $key, $value);
169
+	}
170 170
 
171
-    /**
172
-     * @param int $postId
173
-     * @param string $key
174
-     * @param mixed $value
175
-     * @return int|bool
176
-     */
177
-    public function update($postId, $key, $value)
178
-    {
179
-        return $this->set($postId, $key, $value);
180
-    }
171
+	/**
172
+	 * @param int $postId
173
+	 * @param string $key
174
+	 * @param mixed $value
175
+	 * @return int|bool
176
+	 */
177
+	public function update($postId, $key, $value)
178
+	{
179
+		return $this->set($postId, $key, $value);
180
+	}
181 181
 }
Please login to merge, or discard this patch.
plugin/Defaults/SiteReviewsDefaults.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $guarded = [
13
-        'fallback',
14
-        'title',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $guarded = [
13
+		'fallback',
14
+		'title',
15
+	];
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    protected function defaults()
21
-    {
22
-        return [
23
-            'assigned_to' => '',
24
-            'category' => '',
25
-            'class' => '',
26
-            'count' => 5,
27
-            'fallback' => '',
28
-            'hide' => [],
29
-            'id' => '',
30
-            'offset' => '',
31
-            'pagination' => false,
32
-            'rating' => 0,
33
-            'schema' => false,
34
-            'title' => '',
35
-            'type' => 'local',
36
-        ];
37
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	protected function defaults()
21
+	{
22
+		return [
23
+			'assigned_to' => '',
24
+			'category' => '',
25
+			'class' => '',
26
+			'count' => 5,
27
+			'fallback' => '',
28
+			'hide' => [],
29
+			'id' => '',
30
+			'offset' => '',
31
+			'pagination' => false,
32
+			'rating' => 0,
33
+			'schema' => false,
34
+			'title' => '',
35
+			'type' => 'local',
36
+		];
37
+	}
38 38
 }
Please login to merge, or discard this patch.
plugin/Controllers/NoticeController.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -8,86 +8,86 @@
 block discarded – undo
8 8
 
9 9
 class NoticeController extends Controller
10 10
 {
11
-    const USER_META_KEY = '_glsr_notices';
11
+	const USER_META_KEY = '_glsr_notices';
12 12
 
13
-    /**
14
-     * @return void
15
-     * @action admin_notices
16
-     */
17
-    public function filterAdminNotices()
18
-    {
19
-        $screen = glsr_current_screen();
20
-        $this->renderRebusifyNotice($screen->post_type);
21
-        $this->renderAddonsNotice($screen->id);
22
-    }
13
+	/**
14
+	 * @return void
15
+	 * @action admin_notices
16
+	 */
17
+	public function filterAdminNotices()
18
+	{
19
+		$screen = glsr_current_screen();
20
+		$this->renderRebusifyNotice($screen->post_type);
21
+		$this->renderAddonsNotice($screen->id);
22
+	}
23 23
 
24
-    /**
25
-     * @return void
26
-     */
27
-    public function routerDismissNotice(array $request)
28
-    {
29
-        $key = glsr_get($request, 'notice');
30
-        $method = glsr(Helper::class)->buildMethodName($key, 'dismiss');
31
-        if (method_exists($this, $method)) {
32
-            call_user_func([$this, $method], $key);
33
-        }
34
-    }
24
+	/**
25
+	 * @return void
26
+	 */
27
+	public function routerDismissNotice(array $request)
28
+	{
29
+		$key = glsr_get($request, 'notice');
30
+		$method = glsr(Helper::class)->buildMethodName($key, 'dismiss');
31
+		if (method_exists($this, $method)) {
32
+			call_user_func([$this, $method], $key);
33
+		}
34
+	}
35 35
 
36
-    /**
37
-     * @param string $key
38
-     * @return void
39
-     */
40
-    protected function dismissRebusify($key)
41
-    {
42
-        $this->setUserMeta($key, glsr()->version('major'));
43
-    }
36
+	/**
37
+	 * @param string $key
38
+	 * @return void
39
+	 */
40
+	protected function dismissRebusify($key)
41
+	{
42
+		$this->setUserMeta($key, glsr()->version('major'));
43
+	}
44 44
 
45
-    /**
46
-     * @param string $key
47
-     * @param mixed $fallback
48
-     * @return mixed
49
-     */
50
-    protected function getUserMeta($key, $fallback)
51
-    {
52
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
53
-        return glsr_get($meta, $key, $fallback);
54
-    }
45
+	/**
46
+	 * @param string $key
47
+	 * @param mixed $fallback
48
+	 * @return mixed
49
+	 */
50
+	protected function getUserMeta($key, $fallback)
51
+	{
52
+		$meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
53
+		return glsr_get($meta, $key, $fallback);
54
+	}
55 55
 
56
-    /**
57
-     * @param string $screenId
58
-     * @return void
59
-     */
60
-    protected function renderAddonsNotice($screenId)
61
-    {
62
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
63
-            echo glsr()->render('partials/notices/addons');
64
-        }
65
-    }
56
+	/**
57
+	 * @param string $screenId
58
+	 * @return void
59
+	 */
60
+	protected function renderAddonsNotice($screenId)
61
+	{
62
+		if (Application::POST_TYPE.'_page_addons' == $screenId) {
63
+			echo glsr()->render('partials/notices/addons');
64
+		}
65
+	}
66 66
 
67
-    /**
68
-     * @param string $screenPostType
69
-     * @return void
70
-     */
71
-    protected function renderRebusifyNotice($screenPostType)
72
-    {
73
-        if (Application::POST_TYPE == $screenPostType
74
-            && version_compare(glsr()->version('major'), $this->getUserMeta('rebusify', 0), '>')
75
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
76
-            echo glsr()->render('partials/notices/rebusify');
77
-        }
78
-    }
67
+	/**
68
+	 * @param string $screenPostType
69
+	 * @return void
70
+	 */
71
+	protected function renderRebusifyNotice($screenPostType)
72
+	{
73
+		if (Application::POST_TYPE == $screenPostType
74
+			&& version_compare(glsr()->version('major'), $this->getUserMeta('rebusify', 0), '>')
75
+			&& !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
76
+			echo glsr()->render('partials/notices/rebusify');
77
+		}
78
+	}
79 79
 
80
-    /**
81
-     * @param string $key
82
-     * @param mixed $fallback
83
-     * @return mixed
84
-     */
85
-    protected function setUserMeta($key, $value)
86
-    {
87
-        $userId = get_current_user_id();
88
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
89
-        $meta = array_filter(wp_parse_args($meta, []));
90
-        $meta[$key] = $value;
91
-        update_user_meta($userId, static::USER_META_KEY, $meta);
92
-    }
80
+	/**
81
+	 * @param string $key
82
+	 * @param mixed $fallback
83
+	 * @return mixed
84
+	 */
85
+	protected function setUserMeta($key, $value)
86
+	{
87
+		$userId = get_current_user_id();
88
+		$meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
89
+		$meta = array_filter(wp_parse_args($meta, []));
90
+		$meta[$key] = $value;
91
+		update_user_meta($userId, static::USER_META_KEY, $meta);
92
+	}
93 93
 }
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,60 +6,60 @@
 block discarded – undo
6 6
 
7 7
 class DefaultsManager
8 8
 {
9
-    /**
10
-     * @return array
11
-     */
12
-    public function defaults()
13
-    {
14
-        $settings = $this->settings();
15
-        $defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
-        return wp_parse_args($defaults, [
17
-            'version' => '',
18
-            'version_upgraded_from' => '',
19
-        ]);
20
-    }
9
+	/**
10
+	 * @return array
11
+	 */
12
+	public function defaults()
13
+	{
14
+		$settings = $this->settings();
15
+		$defaults = (array) array_combine(array_keys($settings), glsr_array_column($settings, 'default'));
16
+		return wp_parse_args($defaults, [
17
+			'version' => '',
18
+			'version_upgraded_from' => '',
19
+		]);
20
+	}
21 21
 
22
-    /**
23
-     * @return array
24
-     */
25
-    public function get()
26
-    {
27
-        return glsr(Helper::class)->convertDotNotationArray($this->defaults());
28
-    }
22
+	/**
23
+	 * @return array
24
+	 */
25
+	public function get()
26
+	{
27
+		return glsr(Helper::class)->convertDotNotationArray($this->defaults());
28
+	}
29 29
 
30
-    /**
31
-     * @return array
32
-     */
33
-    public function set()
34
-    {
35
-        $settings = glsr(OptionManager::class)->all();
36
-        $currentSettings = glsr(Helper::class)->removeEmptyArrayValues($settings);
37
-        $defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
-        $updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
-        update_option(OptionManager::databaseKey(), $updatedSettings);
40
-        return $defaultSettings;
41
-    }
30
+	/**
31
+	 * @return array
32
+	 */
33
+	public function set()
34
+	{
35
+		$settings = glsr(OptionManager::class)->all();
36
+		$currentSettings = glsr(Helper::class)->removeEmptyArrayValues($settings);
37
+		$defaultSettings = array_replace_recursive($this->get(), $currentSettings);
38
+		$updatedSettings = array_replace_recursive($settings, $defaultSettings);
39
+		update_option(OptionManager::databaseKey(), $updatedSettings);
40
+		return $defaultSettings;
41
+	}
42 42
 
43
-    /**
44
-     * @return array
45
-     */
46
-    public function settings()
47
-    {
48
-        $settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
-        return $this->normalize($settings);
50
-    }
43
+	/**
44
+	 * @return array
45
+	 */
46
+	public function settings()
47
+	{
48
+		$settings = apply_filters('site-reviews/addon/settings', glsr()->config('settings'));
49
+		return $this->normalize($settings);
50
+	}
51 51
 
52
-    /**
53
-     * @return array
54
-     */
55
-    protected function normalize(array $settings)
56
-    {
57
-        array_walk($settings, function (&$setting) {
58
-            if (isset($setting['default'])) {
59
-                return;
60
-            }
61
-            $setting['default'] = '';
62
-        });
63
-        return $settings;
64
-    }
52
+	/**
53
+	 * @return array
54
+	 */
55
+	protected function normalize(array $settings)
56
+	{
57
+		array_walk($settings, function (&$setting) {
58
+			if (isset($setting['default'])) {
59
+				return;
60
+			}
61
+			$setting['default'] = '';
62
+		});
63
+		return $settings;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -9,113 +9,113 @@
 block discarded – undo
9 9
 
10 10
 class SettingsController extends Controller
11 11
 {
12
-    /**
13
-     * @param mixed $input
14
-     * @return array
15
-     * @callback register_setting
16
-     */
17
-    public function callbackRegisterSettings($input)
18
-    {
19
-        $settings = glsr(Helper::class)->consolidateArray($input);
20
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
-            $options = $this->sanitizeGeneral($input, $options);
23
-            $options = $this->sanitizeSubmissions($input, $options);
24
-            $options = $this->sanitizeTranslations($input, $options);
25
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
28
-            }
29
-            return $options;
30
-        }
31
-        return $input;
32
-    }
12
+	/**
13
+	 * @param mixed $input
14
+	 * @return array
15
+	 * @callback register_setting
16
+	 */
17
+	public function callbackRegisterSettings($input)
18
+	{
19
+		$settings = glsr(Helper::class)->consolidateArray($input);
20
+		if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
+			$options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
+			$options = $this->sanitizeGeneral($input, $options);
23
+			$options = $this->sanitizeSubmissions($input, $options);
24
+			$options = $this->sanitizeTranslations($input, $options);
25
+			$options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
+			if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
+				glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
28
+			}
29
+			return $options;
30
+		}
31
+		return $input;
32
+	}
33 33
 
34
-    /**
35
-     * @return void
36
-     * @action admin_init
37
-     */
38
-    public function registerSettings()
39
-    {
40
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
41
-            'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-        ]);
43
-    }
34
+	/**
35
+	 * @return void
36
+	 * @action admin_init
37
+	 */
38
+	public function registerSettings()
39
+	{
40
+		register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
41
+			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
+		]);
43
+	}
44 44
 
45
-    /**
46
-     * @return array
47
-     */
48
-    protected function sanitizeGeneral(array $input, array $options)
49
-    {
50
-        $inputForm = $input['settings']['general'];
51
-        if (!$this->hasMultilingualIntegration($inputForm['support']['multilingual'])) {
52
-            $options['settings']['general']['support']['multilingual'] = '';
53
-        }
54
-        if ('' == trim($inputForm['notification_message'])) {
55
-            $options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
56
-        }
57
-        $options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
58
-        return $options;
59
-    }
45
+	/**
46
+	 * @return array
47
+	 */
48
+	protected function sanitizeGeneral(array $input, array $options)
49
+	{
50
+		$inputForm = $input['settings']['general'];
51
+		if (!$this->hasMultilingualIntegration($inputForm['support']['multilingual'])) {
52
+			$options['settings']['general']['support']['multilingual'] = '';
53
+		}
54
+		if ('' == trim($inputForm['notification_message'])) {
55
+			$options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
56
+		}
57
+		$options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
58
+		return $options;
59
+	}
60 60
 
61
-    /**
62
-     * @return array
63
-     */
64
-    protected function sanitizeSubmissions(array $input, array $options)
65
-    {
66
-        $inputForm = $input['settings']['submissions'];
67
-        $options['settings']['submissions']['required'] = isset($inputForm['required'])
68
-            ? $inputForm['required']
69
-            : [];
70
-        return $options;
71
-    }
61
+	/**
62
+	 * @return array
63
+	 */
64
+	protected function sanitizeSubmissions(array $input, array $options)
65
+	{
66
+		$inputForm = $input['settings']['submissions'];
67
+		$options['settings']['submissions']['required'] = isset($inputForm['required'])
68
+			? $inputForm['required']
69
+			: [];
70
+		return $options;
71
+	}
72 72
 
73
-    /**
74
-     * @return array
75
-     */
76
-    protected function sanitizeTranslations(array $input, array $options)
77
-    {
78
-        if (isset($input['settings']['strings'])) {
79
-            $options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
80
-            $allowedTags = [
81
-                'a' => ['class' => [], 'href' => [], 'target' => []],
82
-                'span' => ['class' => []],
83
-            ];
84
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
85
-                if (isset($string['s2'])) {
86
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
87
-                }
88
-                if (isset($string['p2'])) {
89
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
90
-                }
91
-            });
92
-        }
93
-        return $options;
94
-    }
73
+	/**
74
+	 * @return array
75
+	 */
76
+	protected function sanitizeTranslations(array $input, array $options)
77
+	{
78
+		if (isset($input['settings']['strings'])) {
79
+			$options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
80
+			$allowedTags = [
81
+				'a' => ['class' => [], 'href' => [], 'target' => []],
82
+				'span' => ['class' => []],
83
+			];
84
+			array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
85
+				if (isset($string['s2'])) {
86
+					$string['s2'] = wp_kses($string['s2'], $allowedTags);
87
+				}
88
+				if (isset($string['p2'])) {
89
+					$string['p2'] = wp_kses($string['p2'], $allowedTags);
90
+				}
91
+			});
92
+		}
93
+		return $options;
94
+	}
95 95
 
96
-    /**
97
-     * @return bool
98
-     */
99
-    protected function hasMultilingualIntegration($integration)
100
-    {
101
-        if (!in_array($integration, ['polylang', 'wpml'])) {
102
-            return false;
103
-        }
104
-        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
105
-        if (!glsr($integrationClass)->isActive()) {
106
-            glsr(Notice::class)->addError(sprintf(
107
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
108
-                constant($integrationClass.'::PLUGIN_NAME')
109
-            ));
110
-            return false;
111
-        } elseif (!glsr($integrationClass)->isSupported()) {
112
-            glsr(Notice::class)->addError(sprintf(
113
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
114
-                constant($integrationClass.'::PLUGIN_NAME'),
115
-                constant($integrationClass.'::SUPPORTED_VERSION')
116
-            ));
117
-            return false;
118
-        }
119
-        return true;
120
-    }
96
+	/**
97
+	 * @return bool
98
+	 */
99
+	protected function hasMultilingualIntegration($integration)
100
+	{
101
+		if (!in_array($integration, ['polylang', 'wpml'])) {
102
+			return false;
103
+		}
104
+		$integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
105
+		if (!glsr($integrationClass)->isActive()) {
106
+			glsr(Notice::class)->addError(sprintf(
107
+				__('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
108
+				constant($integrationClass.'::PLUGIN_NAME')
109
+			));
110
+			return false;
111
+		} elseif (!glsr($integrationClass)->isSupported()) {
112
+			glsr(Notice::class)->addError(sprintf(
113
+				__('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
114
+				constant($integrationClass.'::PLUGIN_NAME'),
115
+				constant($integrationClass.'::SUPPORTED_VERSION')
116
+			));
117
+			return false;
118
+		}
119
+		return true;
120
+	}
121 121
 }
Please login to merge, or discard this patch.
helpers.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
  * @return mixed
10 10
  */
11 11
 add_filter('plugins_loaded', function () {
12
-    $hooks = array(
13
-        'glsr_calculate_ratings' => 1,
14
-        'glsr_create_review' => 2,
15
-        'glsr_debug' => 10,
16
-        'glsr_get' => 4,
17
-        'glsr_get_option' => 4,
18
-        'glsr_get_options' => 1,
19
-        'glsr_get_review' => 2,
20
-        'glsr_get_reviews' => 2,
21
-        'glsr_log' => 3,
22
-        'glsr_star_rating' => 2,
23
-    );
24
-    foreach ($hooks as $function => $acceptedArgs) {
25
-        add_filter($function, function () use ($function) {
26
-            $args = func_get_args();
27
-            array_shift($args); // remove the fallback value
28
-            return call_user_func_array($function, $args);
29
-        }, 10, $acceptedArgs);
30
-    }
12
+	$hooks = array(
13
+		'glsr_calculate_ratings' => 1,
14
+		'glsr_create_review' => 2,
15
+		'glsr_debug' => 10,
16
+		'glsr_get' => 4,
17
+		'glsr_get_option' => 4,
18
+		'glsr_get_options' => 1,
19
+		'glsr_get_review' => 2,
20
+		'glsr_get_reviews' => 2,
21
+		'glsr_log' => 3,
22
+		'glsr_star_rating' => 2,
23
+	);
24
+	foreach ($hooks as $function => $acceptedArgs) {
25
+		add_filter($function, function () use ($function) {
26
+			$args = func_get_args();
27
+			array_shift($args); // remove the fallback value
28
+			return call_user_func_array($function, $args);
29
+		}, 10, $acceptedArgs);
30
+	}
31 31
 });
32 32
 
33 33
 /**
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function glsr($alias = null)
37 37
 {
38
-    $app = \GeminiLabs\SiteReviews\Application::load();
39
-    return !empty($alias)
40
-        ? $app->make($alias)
41
-        : $app;
38
+	$app = \GeminiLabs\SiteReviews\Application::load();
39
+	return !empty($alias)
40
+		? $app->make($alias)
41
+		: $app;
42 42
 }
43 43
 
44 44
 /**
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function glsr_array_column(array $array, $column)
50 50
 {
51
-    $result = array();
52
-    foreach ($array as $subarray) {
53
-        $subarray = (array) $subarray;
54
-        if (!isset($subarray[$column])) {
55
-            continue;
56
-        }
57
-        $result[] = $subarray[$column];
58
-    }
59
-    return $result;
51
+	$result = array();
52
+	foreach ($array as $subarray) {
53
+		$subarray = (array) $subarray;
54
+		if (!isset($subarray[$column])) {
55
+			continue;
56
+		}
57
+		$result[] = $subarray[$column];
58
+	}
59
+	return $result;
60 60
 }
61 61
 
62 62
 /**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function glsr_calculate_ratings()
66 66
 {
67
-    glsr('Controllers\AdminController')->routerCountReviews(false);
68
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
67
+	glsr('Controllers\AdminController')->routerCountReviews(false);
68
+	glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
69 69
 }
70 70
 
71 71
 /**
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function glsr_create_review($reviewValues = array())
75 75
 {
76
-    $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
-        glsr('Helper')->consolidateArray($reviewValues)
78
-    );
79
-    return glsr('Database\ReviewManager')->create($review);
76
+	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
+		glsr('Helper')->consolidateArray($reviewValues)
78
+	);
79
+	return glsr('Database\ReviewManager')->create($review);
80 80
 }
81 81
 
82 82
 /**
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function glsr_current_screen()
86 86
 {
87
-    if (function_exists('get_current_screen')) {
88
-        $screen = get_current_screen();
89
-    }
90
-    return empty($screen)
91
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
92
-        : $screen;
87
+	if (function_exists('get_current_screen')) {
88
+		$screen = get_current_screen();
89
+	}
90
+	return empty($screen)
91
+		? (object) array_fill_keys(['base', 'id', 'post_type'], null)
92
+		: $screen;
93 93
 }
94 94
 
95 95
 /**
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function glsr_debug(...$vars)
100 100
 {
101
-    if (1 == count($vars)) {
102
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
104
-    } else {
105
-        echo '<div class="glsr-debug-group">';
106
-        foreach ($vars as $var) {
107
-            glsr_debug($var);
108
-        }
109
-        echo '</div>';
110
-    }
101
+	if (1 == count($vars)) {
102
+		$value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
+		printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
104
+	} else {
105
+		echo '<div class="glsr-debug-group">';
106
+		foreach ($vars as $var) {
107
+			glsr_debug($var);
108
+		}
109
+		echo '</div>';
110
+	}
111 111
 }
112 112
 
113 113
 /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function glsr_get($array, $path = '', $fallback = '')
120 120
 {
121
-    return glsr('Helper')->dataGet($array, $path, $fallback);
121
+	return glsr('Helper')->dataGet($array, $path, $fallback);
122 122
 }
123 123
 
124 124
 /**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function glsr_get_option($path = '', $fallback = '', $cast = '')
131 131
 {
132
-    return is_string($path)
133
-        ? glsr('Database\OptionManager')->get(glsr('Helper')->prefix('settings.', $path), $fallback, $cast)
134
-        : $fallback;
132
+	return is_string($path)
133
+		? glsr('Database\OptionManager')->get(glsr('Helper')->prefix('settings.', $path), $fallback, $cast)
134
+		: $fallback;
135 135
 }
136 136
 
137 137
 /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function glsr_get_options()
141 141
 {
142
-    return glsr('Database\OptionManager')->get('settings');
142
+	return glsr('Database\OptionManager')->get('settings');
143 143
 }
144 144
 
145 145
 /**
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function glsr_get_review($post)
150 150
 {
151
-    if (is_numeric($post)) {
152
-        $post = get_post($post);
153
-    }
154
-    if (!($post instanceof WP_Post)) {
155
-        $post = new WP_Post((object) []);
156
-    }
157
-    return glsr('Database\ReviewManager')->single($post);
151
+	if (is_numeric($post)) {
152
+		$post = get_post($post);
153
+	}
154
+	if (!($post instanceof WP_Post)) {
155
+		$post = new WP_Post((object) []);
156
+	}
157
+	return glsr('Database\ReviewManager')->single($post);
158 158
 }
159 159
 
160 160
 /**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function glsr_get_reviews($args = array())
164 164
 {
165
-    return glsr('Database\ReviewManager')->get(glsr('Helper')->consolidateArray($args));
165
+	return glsr('Database\ReviewManager')->get(glsr('Helper')->consolidateArray($args));
166 166
 }
167 167
 
168 168
 /**
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function glsr_log()
172 172
 {
173
-    $args = func_get_args();
174
-    $console = glsr('Modules\Console');
175
-    if ($value = glsr_get($args, '0')) {
176
-        return $console->debug($value, glsr_get($args, '1', []));
177
-    }
178
-    return $console;
173
+	$args = func_get_args();
174
+	$console = glsr('Modules\Console');
175
+	if ($value = glsr_get($args, '0')) {
176
+		return $console->debug($value, glsr_get($args, '1', []));
177
+	}
178
+	return $console;
179 179
 }
180 180
 
181 181
 /**
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
  */
184 184
 function glsr_star_rating($rating)
185 185
 {
186
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
186
+	return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
187 187
 }
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -7,153 +7,153 @@
 block discarded – undo
7 7
 
8 8
 class OptionManager
9 9
 {
10
-    /**
11
-     * @var array
12
-     */
13
-    protected $options;
10
+	/**
11
+	 * @var array
12
+	 */
13
+	protected $options;
14 14
 
15
-    /**
16
-     * @return string
17
-     */
18
-    public static function databaseKey($version = null)
19
-    {
20
-        if (null === $version) {
21
-            $version = explode('.', glsr()->version);
22
-            $version = array_shift($version);
23
-        }
24
-        return glsr(Helper::class)->snakeCase(
25
-            Application::ID.'-v'.intval($version)
26
-        );
27
-    }
15
+	/**
16
+	 * @return string
17
+	 */
18
+	public static function databaseKey($version = null)
19
+	{
20
+		if (null === $version) {
21
+			$version = explode('.', glsr()->version);
22
+			$version = array_shift($version);
23
+		}
24
+		return glsr(Helper::class)->snakeCase(
25
+			Application::ID.'-v'.intval($version)
26
+		);
27
+	}
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    public function all()
33
-    {
34
-        if (empty($this->options)) {
35
-            $this->reset();
36
-        }
37
-        return $this->options;
38
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	public function all()
33
+	{
34
+		if (empty($this->options)) {
35
+			$this->reset();
36
+		}
37
+		return $this->options;
38
+	}
39 39
 
40
-    /**
41
-     * @param string $path
42
-     * @return bool
43
-     */
44
-    public function delete($path)
45
-    {
46
-        $keys = explode('.', $path);
47
-        $last = array_pop($keys);
48
-        $options = $this->all();
49
-        $pointer = &$options;
50
-        foreach ($keys as $key) {
51
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
-                continue;
53
-            }
54
-            $pointer = &$pointer[$key];
55
-        }
56
-        unset($pointer[$last]);
57
-        return $this->set($options);
58
-    }
40
+	/**
41
+	 * @param string $path
42
+	 * @return bool
43
+	 */
44
+	public function delete($path)
45
+	{
46
+		$keys = explode('.', $path);
47
+		$last = array_pop($keys);
48
+		$options = $this->all();
49
+		$pointer = &$options;
50
+		foreach ($keys as $key) {
51
+			if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
+				continue;
53
+			}
54
+			$pointer = &$pointer[$key];
55
+		}
56
+		unset($pointer[$last]);
57
+		return $this->set($options);
58
+	}
59 59
 
60
-    /**
61
-     * @param string $path
62
-     * @param mixed $fallback
63
-     * @param string $cast
64
-     * @return mixed
65
-     */
66
-    public function get($path = '', $fallback = '', $cast = '')
67
-    {
68
-        $result = glsr(Helper::class)->dataGet($this->all(), $path, $fallback);
69
-        return glsr(Helper::class)->castTo($cast, $result);
70
-    }
60
+	/**
61
+	 * @param string $path
62
+	 * @param mixed $fallback
63
+	 * @param string $cast
64
+	 * @return mixed
65
+	 */
66
+	public function get($path = '', $fallback = '', $cast = '')
67
+	{
68
+		$result = glsr(Helper::class)->dataGet($this->all(), $path, $fallback);
69
+		return glsr(Helper::class)->castTo($cast, $result);
70
+	}
71 71
 
72
-    /**
73
-     * @param string $path
74
-     * @return bool
75
-     */
76
-    public function getBool($path)
77
-    {
78
-        return glsr(Helper::class)->castTo('bool', $this->get($path));
79
-    }
72
+	/**
73
+	 * @param string $path
74
+	 * @return bool
75
+	 */
76
+	public function getBool($path)
77
+	{
78
+		return glsr(Helper::class)->castTo('bool', $this->get($path));
79
+	}
80 80
 
81
-    /**
82
-     * @param string $path
83
-     * @param mixed $fallback
84
-     * @param string $cast
85
-     * @return mixed
86
-     */
87
-    public function getWP($path, $fallback = '', $cast = '')
88
-    {
89
-        $option = get_option($path, $fallback);
90
-        if (empty($option)) {
91
-            $option = $fallback;
92
-        }
93
-        return glsr(Helper::class)->castTo($cast, $option);
94
-    }
81
+	/**
82
+	 * @param string $path
83
+	 * @param mixed $fallback
84
+	 * @param string $cast
85
+	 * @return mixed
86
+	 */
87
+	public function getWP($path, $fallback = '', $cast = '')
88
+	{
89
+		$option = get_option($path, $fallback);
90
+		if (empty($option)) {
91
+			$option = $fallback;
92
+		}
93
+		return glsr(Helper::class)->castTo($cast, $option);
94
+	}
95 95
 
96
-    /**
97
-     * @return string
98
-     */
99
-    public function json()
100
-    {
101
-        return json_encode($this->all());
102
-    }
96
+	/**
97
+	 * @return string
98
+	 */
99
+	public function json()
100
+	{
101
+		return json_encode($this->all());
102
+	}
103 103
 
104
-    /**
105
-     * @return array
106
-     */
107
-    public function normalize(array $options = [])
108
-    {
109
-        $options = wp_parse_args(
110
-            glsr(Helper::class)->flattenArray($options),
111
-            glsr(DefaultsManager::class)->defaults()
112
-        );
113
-        array_walk($options, function (&$value) {
114
-            if (!is_string($value)) {
115
-                return;
116
-            }
117
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
118
-        });
119
-        return glsr(Helper::class)->convertDotNotationArray($options);
120
-    }
104
+	/**
105
+	 * @return array
106
+	 */
107
+	public function normalize(array $options = [])
108
+	{
109
+		$options = wp_parse_args(
110
+			glsr(Helper::class)->flattenArray($options),
111
+			glsr(DefaultsManager::class)->defaults()
112
+		);
113
+		array_walk($options, function (&$value) {
114
+			if (!is_string($value)) {
115
+				return;
116
+			}
117
+			$value = wp_kses($value, wp_kses_allowed_html('post'));
118
+		});
119
+		return glsr(Helper::class)->convertDotNotationArray($options);
120
+	}
121 121
 
122
-    /**
123
-     * @return bool
124
-     */
125
-    public function isRecaptchaEnabled()
126
-    {
127
-        $integration = $this->get('settings.submissions.recaptcha.integration');
128
-        return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
129
-    }
122
+	/**
123
+	 * @return bool
124
+	 */
125
+	public function isRecaptchaEnabled()
126
+	{
127
+		$integration = $this->get('settings.submissions.recaptcha.integration');
128
+		return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
129
+	}
130 130
 
131
-    /**
132
-     * @return array
133
-     */
134
-    public function reset()
135
-    {
136
-        $options = $this->getWP(static::databaseKey(), []);
137
-        if (!is_array($options) || empty($options)) {
138
-            delete_option(static::databaseKey());
139
-            $options = glsr()->defaults ?: [];
140
-        }
141
-        $this->options = $options;
142
-    }
131
+	/**
132
+	 * @return array
133
+	 */
134
+	public function reset()
135
+	{
136
+		$options = $this->getWP(static::databaseKey(), []);
137
+		if (!is_array($options) || empty($options)) {
138
+			delete_option(static::databaseKey());
139
+			$options = glsr()->defaults ?: [];
140
+		}
141
+		$this->options = $options;
142
+	}
143 143
 
144
-    /**
145
-     * @param string|array $pathOrOptions
146
-     * @param mixed $value
147
-     * @return bool
148
-     */
149
-    public function set($pathOrOptions, $value = '')
150
-    {
151
-        if (is_string($pathOrOptions)) {
152
-            $pathOrOptions = glsr(Helper::class)->dataSet($this->all(), $pathOrOptions, $value);
153
-        }
154
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
155
-            $this->reset();
156
-        }
157
-        return $result;
158
-    }
144
+	/**
145
+	 * @param string|array $pathOrOptions
146
+	 * @param mixed $value
147
+	 * @return bool
148
+	 */
149
+	public function set($pathOrOptions, $value = '')
150
+	{
151
+		if (is_string($pathOrOptions)) {
152
+			$pathOrOptions = glsr(Helper::class)->dataSet($this->all(), $pathOrOptions, $value);
153
+		}
154
+		if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
155
+			$this->reset();
156
+		}
157
+		return $result;
158
+	}
159 159
 }
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -14,69 +14,69 @@
 block discarded – undo
14 14
 
15 15
 class Filters implements HooksContract
16 16
 {
17
-    protected $admin;
18
-    protected $app;
19
-    protected $basename;
20
-    protected $blocks;
21
-    protected $editor;
22
-    protected $listtable;
23
-    protected $public;
24
-    protected $rebusify;
25
-    protected $translator;
26
-    protected $welcome;
17
+	protected $admin;
18
+	protected $app;
19
+	protected $basename;
20
+	protected $blocks;
21
+	protected $editor;
22
+	protected $listtable;
23
+	protected $public;
24
+	protected $rebusify;
25
+	protected $translator;
26
+	protected $welcome;
27 27
 
28
-    public function __construct(Application $app)
29
-    {
30
-        $this->app = $app;
31
-        $this->admin = $app->make(AdminController::class);
32
-        $this->basename = plugin_basename($app->file);
33
-        $this->blocks = $app->make(BlocksController::class);
34
-        $this->editor = $app->make(EditorController::class);
35
-        $this->listtable = $app->make(ListTableController::class);
36
-        $this->public = $app->make(PublicController::class);
37
-        $this->rebusify = $app->make(RebusifyController::class);
38
-        $this->translator = $app->make(Translator::class);
39
-        $this->welcome = $app->make(WelcomeController::class);
40
-    }
28
+	public function __construct(Application $app)
29
+	{
30
+		$this->app = $app;
31
+		$this->admin = $app->make(AdminController::class);
32
+		$this->basename = plugin_basename($app->file);
33
+		$this->blocks = $app->make(BlocksController::class);
34
+		$this->editor = $app->make(EditorController::class);
35
+		$this->listtable = $app->make(ListTableController::class);
36
+		$this->public = $app->make(PublicController::class);
37
+		$this->rebusify = $app->make(RebusifyController::class);
38
+		$this->translator = $app->make(Translator::class);
39
+		$this->welcome = $app->make(WelcomeController::class);
40
+	}
41 41
 
42
-    /**
43
-     * @return void
44
-     */
45
-    public function run()
46
-    {
47
-        add_filter('map_meta_cap',                                              [$this->admin, 'filterCreateCapability'], 10, 2);
48
-        add_filter('mce_external_plugins',                                      [$this->admin, 'filterTinymcePlugins'], 15);
49
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->admin, 'filterActionLinks']);
50
-        add_filter('dashboard_glance_items',                                    [$this->admin, 'filterDashboardGlanceItems']);
51
-        add_filter('block_categories',                                          [$this->blocks, 'filterBlockCategories']);
52
-        add_filter('classic_editor_enabled_editors_for_post_type',              [$this->blocks, 'filterEnabledEditors'], 10, 2);
53
-        add_filter('use_block_editor_for_post_type',                            [$this->blocks, 'filterUseBlockEditor'], 10, 2);
54
-        add_filter('wp_editor_settings',                                        [$this->editor, 'filterEditorSettings']);
55
-        add_filter('the_editor',                                                [$this->editor, 'filterEditorTextarea']);
56
-        add_filter('is_protected_meta',                                         [$this->editor, 'filterIsProtectedMeta'], 10, 3);
57
-        add_filter('gettext',                                                   [$this->editor, 'filterPostStatusLabels'], 10, 3);
58
-        add_filter('gettext_with_context',                                      [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4);
59
-        add_filter('post_updated_messages',                                     [$this->editor, 'filterUpdateMessages']);
60
-        add_filter('bulk_post_updated_messages',                                [$this->listtable, 'filterBulkUpdateMessages'], 10, 2);
61
-        add_filter('manage_'.Application::POST_TYPE.'_posts_columns',           [$this->listtable, 'filterColumnsForPostType']);
62
-        add_filter('post_date_column_status',                                   [$this->listtable, 'filterDateColumnStatus'], 10, 2);
63
-        add_filter('default_hidden_columns',                                    [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2);
64
-        add_filter('display_post_states',                                       [$this->listtable, 'filterPostStates'], 10, 2);
65
-        add_filter('post_row_actions',                                          [$this->listtable, 'filterRowActions'], 10, 2);
66
-        add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns',   [$this->listtable, 'filterSortableColumns']);
67
-        add_filter('ngettext',                                                  [$this->listtable, 'filterStatusText'], 10, 5);
68
-        add_filter('script_loader_tag',                                         [$this->public, 'filterEnqueuedScripts'], 10, 2);
69
-        add_filter('site-reviews/config/forms/submission-form',                 [$this->public, 'filterFieldOrder'], 11);
70
-        add_filter('query_vars',                                                [$this->public, 'filterQueryVars']);
71
-        add_filter('site-reviews/render/view',                                  [$this->public, 'filterRenderView']);
72
-        add_filter('site-reviews/settings/callback',                            [$this->rebusify, 'filterSettingsCallback']);
73
-        add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3);
74
-        add_filter('gettext',                                                   [$this->translator, 'filterGettext'], 10, 3);
75
-        add_filter('gettext_with_context',                                      [$this->translator, 'filterGettextWithContext'], 10, 4);
76
-        add_filter('ngettext',                                                  [$this->translator, 'filterNgettext'], 10, 5);
77
-        add_filter('ngettext_with_context',                                     [$this->translator, 'filterNgettextWithContext'], 10, 6);
78
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
79
-        add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
80
-        add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
81
-    }
42
+	/**
43
+	 * @return void
44
+	 */
45
+	public function run()
46
+	{
47
+		add_filter('map_meta_cap',                                              [$this->admin, 'filterCreateCapability'], 10, 2);
48
+		add_filter('mce_external_plugins',                                      [$this->admin, 'filterTinymcePlugins'], 15);
49
+		add_filter('plugin_action_links_'.$this->basename,                      [$this->admin, 'filterActionLinks']);
50
+		add_filter('dashboard_glance_items',                                    [$this->admin, 'filterDashboardGlanceItems']);
51
+		add_filter('block_categories',                                          [$this->blocks, 'filterBlockCategories']);
52
+		add_filter('classic_editor_enabled_editors_for_post_type',              [$this->blocks, 'filterEnabledEditors'], 10, 2);
53
+		add_filter('use_block_editor_for_post_type',                            [$this->blocks, 'filterUseBlockEditor'], 10, 2);
54
+		add_filter('wp_editor_settings',                                        [$this->editor, 'filterEditorSettings']);
55
+		add_filter('the_editor',                                                [$this->editor, 'filterEditorTextarea']);
56
+		add_filter('is_protected_meta',                                         [$this->editor, 'filterIsProtectedMeta'], 10, 3);
57
+		add_filter('gettext',                                                   [$this->editor, 'filterPostStatusLabels'], 10, 3);
58
+		add_filter('gettext_with_context',                                      [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4);
59
+		add_filter('post_updated_messages',                                     [$this->editor, 'filterUpdateMessages']);
60
+		add_filter('bulk_post_updated_messages',                                [$this->listtable, 'filterBulkUpdateMessages'], 10, 2);
61
+		add_filter('manage_'.Application::POST_TYPE.'_posts_columns',           [$this->listtable, 'filterColumnsForPostType']);
62
+		add_filter('post_date_column_status',                                   [$this->listtable, 'filterDateColumnStatus'], 10, 2);
63
+		add_filter('default_hidden_columns',                                    [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2);
64
+		add_filter('display_post_states',                                       [$this->listtable, 'filterPostStates'], 10, 2);
65
+		add_filter('post_row_actions',                                          [$this->listtable, 'filterRowActions'], 10, 2);
66
+		add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns',   [$this->listtable, 'filterSortableColumns']);
67
+		add_filter('ngettext',                                                  [$this->listtable, 'filterStatusText'], 10, 5);
68
+		add_filter('script_loader_tag',                                         [$this->public, 'filterEnqueuedScripts'], 10, 2);
69
+		add_filter('site-reviews/config/forms/submission-form',                 [$this->public, 'filterFieldOrder'], 11);
70
+		add_filter('query_vars',                                                [$this->public, 'filterQueryVars']);
71
+		add_filter('site-reviews/render/view',                                  [$this->public, 'filterRenderView']);
72
+		add_filter('site-reviews/settings/callback',                            [$this->rebusify, 'filterSettingsCallback']);
73
+		add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3);
74
+		add_filter('gettext',                                                   [$this->translator, 'filterGettext'], 10, 3);
75
+		add_filter('gettext_with_context',                                      [$this->translator, 'filterGettextWithContext'], 10, 4);
76
+		add_filter('ngettext',                                                  [$this->translator, 'filterNgettext'], 10, 5);
77
+		add_filter('ngettext_with_context',                                     [$this->translator, 'filterNgettextWithContext'], 10, 6);
78
+		add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
79
+		add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
80
+		add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Field.php 1 patch
Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -8,241 +8,241 @@
 block discarded – undo
8 8
 
9 9
 class Field
10 10
 {
11
-    /**
12
-     * @var array
13
-     */
14
-    public $field;
15
-
16
-    public function __construct(array $field = [])
17
-    {
18
-        $this->field = wp_parse_args($field, [
19
-            'errors' => false,
20
-            'is_hidden' => false,
21
-            'is_multi' => false,
22
-            'is_public' => false,
23
-            'is_raw' => false,
24
-            'is_setting' => false,
25
-            'is_valid' => true,
26
-            'is_widget' => false,
27
-            'path' => '',
28
-        ]);
29
-        $this->normalize();
30
-    }
31
-
32
-    /**
33
-     * @return string
34
-     */
35
-    public function __toString()
36
-    {
37
-        return (string) $this->build();
38
-    }
39
-
40
-    /**
41
-     * @return void|string
42
-     */
43
-    public function build()
44
-    {
45
-        if (!$this->field['is_valid']) {
46
-            return;
47
-        }
48
-        if ($this->field['is_raw']) {
49
-            return glsr(Builder::class)->{$this->field['type']}($this->field);
50
-        }
51
-        if (!$this->field['is_setting']) {
52
-            return $this->buildField();
53
-        }
54
-        if (!$this->field['is_multi']) {
55
-            return $this->buildSettingField();
56
-        }
57
-        return $this->buildSettingMultiField();
58
-    }
59
-
60
-    /**
61
-     * @return void
62
-     */
63
-    public function render()
64
-    {
65
-        echo $this->build();
66
-    }
67
-
68
-    /**
69
-     * @return string
70
-     */
71
-    protected function buildField()
72
-    {
73
-        $field = glsr(Template::class)->build('templates/form/field_'.$this->field['type'], [
74
-            'context' => [
75
-                'class' => $this->getFieldClass(),
76
-                'errors' => $this->getFieldErrors(),
77
-                'field' => glsr(Builder::class)->raw($this->field),
78
-                'label' => glsr(Builder::class)->label([
79
-                    'class' => 'glsr-'.$this->field['type'].'-label',
80
-                    'for' => $this->field['id'],
81
-                    'is_public' => $this->field['is_public'],
82
-                    'text' => $this->field['label'].'<span></span>',
83
-                    'type' => $this->field['type'],
84
-                ]),
85
-            ],
86
-            'field' => $this->field,
87
-        ]);
88
-        return apply_filters('site-reviews/rendered/field', $field, $this->field['type'], $this->field);
89
-    }
90
-
91
-    /**
92
-     * @return string
93
-     */
94
-    protected function buildSettingField()
95
-    {
96
-        return glsr(Template::class)->build('partials/form/table-row', [
97
-            'context' => [
98
-                'class' => $this->getFieldClass(),
99
-                'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
100
-                'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
101
-            ],
102
-            'field' => $this->field,
103
-        ]);
104
-    }
105
-
106
-    /**
107
-     * @return string
108
-     */
109
-    protected function buildSettingMultiField()
110
-    {
111
-        $dependsOn = $this->getFieldDependsOn();
112
-        unset($this->field['data-depends']);
113
-        return glsr(Template::class)->build('partials/form/table-row-multiple', [
114
-            'context' => [
115
-                'class' => $this->getFieldClass(),
116
-                'depends_on' => $dependsOn,
117
-                'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
118
-                'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
119
-                'legend' => $this->field['legend'],
120
-            ],
121
-            'field' => $this->field,
122
-        ]);
123
-    }
124
-
125
-    /**
126
-     * @return string
127
-     */
128
-    protected function getFieldClass()
129
-    {
130
-        $classes = [];
131
-        if (!empty($this->field['errors'])) {
132
-            $classes[] = 'glsr-has-error';
133
-        }
134
-        if ($this->field['is_hidden']) {
135
-            $classes[] = 'hidden';
136
-        }
137
-        if (!empty($this->field['required'])) {
138
-            $classes[] = 'glsr-required';
139
-        }
140
-        $classes = apply_filters('site-reviews/rendered/field/classes', $classes, $this->field);
141
-        return implode(' ', $classes);
142
-    }
143
-
144
-    /**
145
-     * @return string
146
-     */
147
-    protected function getFieldDependsOn()
148
-    {
149
-        return !empty($this->field['data-depends'])
150
-            ? $this->field['data-depends']
151
-            : '';
152
-    }
153
-
154
-    /**
155
-     * @return void|string
156
-     */
157
-    protected function getFieldErrors()
158
-    {
159
-        if (empty($this->field['errors']) || !is_array($this->field['errors'])) {
160
-            return;
161
-        }
162
-        $errors = array_reduce($this->field['errors'], function ($carry, $error) {
163
-            return $carry.glsr(Builder::class)->span($error, ['class' => 'glsr-field-error']);
164
-        });
165
-        return glsr(Template::class)->build('templates/form/field-errors', [
166
-            'context' => [
167
-                'errors' => $errors,
168
-            ],
169
-            'field' => $this->field,
170
-        ]);
171
-    }
172
-
173
-    /**
174
-     * @return string
175
-     */
176
-    protected function getFieldPrefix()
177
-    {
178
-        return $this->field['is_setting']
179
-            ? OptionManager::databaseKey()
180
-            : Application::ID;
181
-    }
182
-
183
-    /**
184
-     * @return bool
185
-     */
186
-    protected function isFieldValid()
187
-    {
188
-        $missingValues = [];
189
-        $requiredValues = [
190
-            'name', 'type',
191
-        ];
192
-        foreach ($requiredValues as $value) {
193
-            if (isset($this->field[$value])) {
194
-                continue;
195
-            }
196
-            $missingValues[] = $value;
197
-            $this->field['is_valid'] = false;
198
-        }
199
-        if (!empty($missingValues)) {
200
-            glsr_log()
201
-                ->warning('Field is missing: '.implode(', ', $missingValues))
202
-                ->debug($this->field);
203
-        }
204
-        return $this->field['is_valid'];
205
-    }
206
-
207
-    /**
208
-     * @return void
209
-     */
210
-    protected function normalize()
211
-    {
212
-        if (!$this->isFieldValid()) {
213
-            return;
214
-        }
215
-        $this->field['path'] = $this->field['name'];
216
-        $className = glsr(Helper::class)->buildClassName($this->field['type'], __NAMESPACE__.'\Fields');
217
-        if (class_exists($className)) {
218
-            $this->field = $className::merge($this->field);
219
-        }
220
-        $this->normalizeFieldId();
221
-        $this->normalizeFieldName();
222
-    }
223
-
224
-    /**
225
-     * @return void
226
-     */
227
-    protected function normalizeFieldId()
228
-    {
229
-        if (isset($this->field['id']) || $this->field['is_raw']) {
230
-            return;
231
-        }
232
-        $this->field['id'] = glsr(Helper::class)->convertPathToId(
233
-            $this->field['path'],
234
-            $this->getFieldPrefix()
235
-        );
236
-    }
237
-
238
-    /**
239
-     * @return void
240
-     */
241
-    protected function normalizeFieldName()
242
-    {
243
-        $this->field['name'] = glsr(Helper::class)->convertPathToName(
244
-            $this->field['path'],
245
-            $this->getFieldPrefix()
246
-        );
247
-    }
11
+	/**
12
+	 * @var array
13
+	 */
14
+	public $field;
15
+
16
+	public function __construct(array $field = [])
17
+	{
18
+		$this->field = wp_parse_args($field, [
19
+			'errors' => false,
20
+			'is_hidden' => false,
21
+			'is_multi' => false,
22
+			'is_public' => false,
23
+			'is_raw' => false,
24
+			'is_setting' => false,
25
+			'is_valid' => true,
26
+			'is_widget' => false,
27
+			'path' => '',
28
+		]);
29
+		$this->normalize();
30
+	}
31
+
32
+	/**
33
+	 * @return string
34
+	 */
35
+	public function __toString()
36
+	{
37
+		return (string) $this->build();
38
+	}
39
+
40
+	/**
41
+	 * @return void|string
42
+	 */
43
+	public function build()
44
+	{
45
+		if (!$this->field['is_valid']) {
46
+			return;
47
+		}
48
+		if ($this->field['is_raw']) {
49
+			return glsr(Builder::class)->{$this->field['type']}($this->field);
50
+		}
51
+		if (!$this->field['is_setting']) {
52
+			return $this->buildField();
53
+		}
54
+		if (!$this->field['is_multi']) {
55
+			return $this->buildSettingField();
56
+		}
57
+		return $this->buildSettingMultiField();
58
+	}
59
+
60
+	/**
61
+	 * @return void
62
+	 */
63
+	public function render()
64
+	{
65
+		echo $this->build();
66
+	}
67
+
68
+	/**
69
+	 * @return string
70
+	 */
71
+	protected function buildField()
72
+	{
73
+		$field = glsr(Template::class)->build('templates/form/field_'.$this->field['type'], [
74
+			'context' => [
75
+				'class' => $this->getFieldClass(),
76
+				'errors' => $this->getFieldErrors(),
77
+				'field' => glsr(Builder::class)->raw($this->field),
78
+				'label' => glsr(Builder::class)->label([
79
+					'class' => 'glsr-'.$this->field['type'].'-label',
80
+					'for' => $this->field['id'],
81
+					'is_public' => $this->field['is_public'],
82
+					'text' => $this->field['label'].'<span></span>',
83
+					'type' => $this->field['type'],
84
+				]),
85
+			],
86
+			'field' => $this->field,
87
+		]);
88
+		return apply_filters('site-reviews/rendered/field', $field, $this->field['type'], $this->field);
89
+	}
90
+
91
+	/**
92
+	 * @return string
93
+	 */
94
+	protected function buildSettingField()
95
+	{
96
+		return glsr(Template::class)->build('partials/form/table-row', [
97
+			'context' => [
98
+				'class' => $this->getFieldClass(),
99
+				'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
100
+				'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
101
+			],
102
+			'field' => $this->field,
103
+		]);
104
+	}
105
+
106
+	/**
107
+	 * @return string
108
+	 */
109
+	protected function buildSettingMultiField()
110
+	{
111
+		$dependsOn = $this->getFieldDependsOn();
112
+		unset($this->field['data-depends']);
113
+		return glsr(Template::class)->build('partials/form/table-row-multiple', [
114
+			'context' => [
115
+				'class' => $this->getFieldClass(),
116
+				'depends_on' => $dependsOn,
117
+				'field' => glsr(Builder::class)->{$this->field['type']}($this->field),
118
+				'label' => glsr(Builder::class)->label($this->field['legend'], ['for' => $this->field['id']]),
119
+				'legend' => $this->field['legend'],
120
+			],
121
+			'field' => $this->field,
122
+		]);
123
+	}
124
+
125
+	/**
126
+	 * @return string
127
+	 */
128
+	protected function getFieldClass()
129
+	{
130
+		$classes = [];
131
+		if (!empty($this->field['errors'])) {
132
+			$classes[] = 'glsr-has-error';
133
+		}
134
+		if ($this->field['is_hidden']) {
135
+			$classes[] = 'hidden';
136
+		}
137
+		if (!empty($this->field['required'])) {
138
+			$classes[] = 'glsr-required';
139
+		}
140
+		$classes = apply_filters('site-reviews/rendered/field/classes', $classes, $this->field);
141
+		return implode(' ', $classes);
142
+	}
143
+
144
+	/**
145
+	 * @return string
146
+	 */
147
+	protected function getFieldDependsOn()
148
+	{
149
+		return !empty($this->field['data-depends'])
150
+			? $this->field['data-depends']
151
+			: '';
152
+	}
153
+
154
+	/**
155
+	 * @return void|string
156
+	 */
157
+	protected function getFieldErrors()
158
+	{
159
+		if (empty($this->field['errors']) || !is_array($this->field['errors'])) {
160
+			return;
161
+		}
162
+		$errors = array_reduce($this->field['errors'], function ($carry, $error) {
163
+			return $carry.glsr(Builder::class)->span($error, ['class' => 'glsr-field-error']);
164
+		});
165
+		return glsr(Template::class)->build('templates/form/field-errors', [
166
+			'context' => [
167
+				'errors' => $errors,
168
+			],
169
+			'field' => $this->field,
170
+		]);
171
+	}
172
+
173
+	/**
174
+	 * @return string
175
+	 */
176
+	protected function getFieldPrefix()
177
+	{
178
+		return $this->field['is_setting']
179
+			? OptionManager::databaseKey()
180
+			: Application::ID;
181
+	}
182
+
183
+	/**
184
+	 * @return bool
185
+	 */
186
+	protected function isFieldValid()
187
+	{
188
+		$missingValues = [];
189
+		$requiredValues = [
190
+			'name', 'type',
191
+		];
192
+		foreach ($requiredValues as $value) {
193
+			if (isset($this->field[$value])) {
194
+				continue;
195
+			}
196
+			$missingValues[] = $value;
197
+			$this->field['is_valid'] = false;
198
+		}
199
+		if (!empty($missingValues)) {
200
+			glsr_log()
201
+				->warning('Field is missing: '.implode(', ', $missingValues))
202
+				->debug($this->field);
203
+		}
204
+		return $this->field['is_valid'];
205
+	}
206
+
207
+	/**
208
+	 * @return void
209
+	 */
210
+	protected function normalize()
211
+	{
212
+		if (!$this->isFieldValid()) {
213
+			return;
214
+		}
215
+		$this->field['path'] = $this->field['name'];
216
+		$className = glsr(Helper::class)->buildClassName($this->field['type'], __NAMESPACE__.'\Fields');
217
+		if (class_exists($className)) {
218
+			$this->field = $className::merge($this->field);
219
+		}
220
+		$this->normalizeFieldId();
221
+		$this->normalizeFieldName();
222
+	}
223
+
224
+	/**
225
+	 * @return void
226
+	 */
227
+	protected function normalizeFieldId()
228
+	{
229
+		if (isset($this->field['id']) || $this->field['is_raw']) {
230
+			return;
231
+		}
232
+		$this->field['id'] = glsr(Helper::class)->convertPathToId(
233
+			$this->field['path'],
234
+			$this->getFieldPrefix()
235
+		);
236
+	}
237
+
238
+	/**
239
+	 * @return void
240
+	 */
241
+	protected function normalizeFieldName()
242
+	{
243
+		$this->field['name'] = glsr(Helper::class)->convertPathToName(
244
+			$this->field['path'],
245
+			$this->getFieldPrefix()
246
+		);
247
+	}
248 248
 }
Please login to merge, or discard this patch.