Passed
Push — feature/rebusify ( 495106...67b08f )
by Paul
06:10 queued 02:03
created
plugin/Handlers/RegisterTaxonomy.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
 
8 8
 class RegisterTaxonomy
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
-        register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
17
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
+		register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
17
+	}
18 18
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args);
16
-        register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE);
15
+        register_taxonomy( Application::TAXONOMY, Application::POST_TYPE, $command->args );
16
+        register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE );
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAdminAssets.php 2 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -10,158 +10,158 @@
 block discarded – undo
10 10
 
11 11
 class EnqueueAdminAssets
12 12
 {
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $pointers;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $pointers;
17 17
 
18
-    /**
19
-     * @return void
20
-     */
21
-    public function handle(Command $command)
22
-    {
23
-        $this->generatePointers($command->pointers);
24
-        $this->enqueueAssets();
25
-        $this->localizeAssets();
26
-    }
18
+	/**
19
+	 * @return void
20
+	 */
21
+	public function handle(Command $command)
22
+	{
23
+		$this->generatePointers($command->pointers);
24
+		$this->enqueueAssets();
25
+		$this->localizeAssets();
26
+	}
27 27
 
28
-    /**
29
-     * @return void
30
-     */
31
-    public function enqueueAssets()
32
-    {
33
-        wp_enqueue_style(
34
-            Application::ID,
35
-            glsr()->url('assets/styles/'.Application::ID.'-admin.css'),
36
-            [],
37
-            glsr()->version
38
-        );
39
-        if (!$this->isCurrentScreen()) {
40
-            return;
41
-        }
42
-        wp_enqueue_script(
43
-            Application::ID,
44
-            glsr()->url('assets/scripts/'.Application::ID.'-admin.js'),
45
-            $this->getDependencies(),
46
-            glsr()->version,
47
-            true
48
-        );
49
-        if (!empty($this->pointers)) {
50
-            wp_enqueue_style('wp-pointer');
51
-            wp_enqueue_script('wp-pointer');
52
-        }
53
-    }
28
+	/**
29
+	 * @return void
30
+	 */
31
+	public function enqueueAssets()
32
+	{
33
+		wp_enqueue_style(
34
+			Application::ID,
35
+			glsr()->url('assets/styles/'.Application::ID.'-admin.css'),
36
+			[],
37
+			glsr()->version
38
+		);
39
+		if (!$this->isCurrentScreen()) {
40
+			return;
41
+		}
42
+		wp_enqueue_script(
43
+			Application::ID,
44
+			glsr()->url('assets/scripts/'.Application::ID.'-admin.js'),
45
+			$this->getDependencies(),
46
+			glsr()->version,
47
+			true
48
+		);
49
+		if (!empty($this->pointers)) {
50
+			wp_enqueue_style('wp-pointer');
51
+			wp_enqueue_script('wp-pointer');
52
+		}
53
+	}
54 54
 
55
-    /**
56
-     * @return void
57
-     */
58
-    public function localizeAssets()
59
-    {
60
-        $variables = [
61
-            'action' => Application::PREFIX.'action',
62
-            'addons' => [],
63
-            'ajaxurl' => admin_url('admin-ajax.php'),
64
-            'hideoptions' => [
65
-                'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
66
-                'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(),
67
-                'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(),
68
-            ],
69
-            'nameprefix' => Application::ID,
70
-            'nonce' => [
71
-                'change-status' => wp_create_nonce('change-status'),
72
-                'clear-console' => wp_create_nonce('clear-console'),
73
-                'count-reviews' => wp_create_nonce('count-reviews'),
74
-                'fetch-console' => wp_create_nonce('fetch-console'),
75
-                'mce-shortcode' => wp_create_nonce('mce-shortcode'),
76
-                'sync-reviews' => wp_create_nonce('sync-reviews'),
77
-                'toggle-pinned' => wp_create_nonce('toggle-pinned'),
78
-            ],
79
-            'pointers' => $this->pointers,
80
-            'shortcodes' => [],
81
-            'tinymce' => [
82
-                'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'),
83
-            ],
84
-        ];
85
-        if (user_can_richedit()) {
86
-            $variables['shortcodes'] = $this->localizeShortcodes();
87
-        }
88
-        $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables);
89
-        wp_localize_script(Application::ID, 'GLSR', $variables);
90
-    }
55
+	/**
56
+	 * @return void
57
+	 */
58
+	public function localizeAssets()
59
+	{
60
+		$variables = [
61
+			'action' => Application::PREFIX.'action',
62
+			'addons' => [],
63
+			'ajaxurl' => admin_url('admin-ajax.php'),
64
+			'hideoptions' => [
65
+				'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
66
+				'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(),
67
+				'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(),
68
+			],
69
+			'nameprefix' => Application::ID,
70
+			'nonce' => [
71
+				'change-status' => wp_create_nonce('change-status'),
72
+				'clear-console' => wp_create_nonce('clear-console'),
73
+				'count-reviews' => wp_create_nonce('count-reviews'),
74
+				'fetch-console' => wp_create_nonce('fetch-console'),
75
+				'mce-shortcode' => wp_create_nonce('mce-shortcode'),
76
+				'sync-reviews' => wp_create_nonce('sync-reviews'),
77
+				'toggle-pinned' => wp_create_nonce('toggle-pinned'),
78
+			],
79
+			'pointers' => $this->pointers,
80
+			'shortcodes' => [],
81
+			'tinymce' => [
82
+				'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'),
83
+			],
84
+		];
85
+		if (user_can_richedit()) {
86
+			$variables['shortcodes'] = $this->localizeShortcodes();
87
+		}
88
+		$variables = apply_filters('site-reviews/enqueue/admin/localize', $variables);
89
+		wp_localize_script(Application::ID, 'GLSR', $variables);
90
+	}
91 91
 
92
-    /**
93
-     * @return array
94
-     */
95
-    protected function getDependencies()
96
-    {
97
-        $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []);
98
-        $dependencies = array_merge($dependencies, [
99
-            'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
100
-        ]);
101
-        return $dependencies;
102
-    }
92
+	/**
93
+	 * @return array
94
+	 */
95
+	protected function getDependencies()
96
+	{
97
+		$dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []);
98
+		$dependencies = array_merge($dependencies, [
99
+			'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
100
+		]);
101
+		return $dependencies;
102
+	}
103 103
 
104
-    /**
105
-     * @return array
106
-     */
107
-    protected function generatePointer(array $pointer)
108
-    {
109
-        return [
110
-            'id' => $pointer['id'],
111
-            'options' => [
112
-                'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>',
113
-                'position' => $pointer['position'],
114
-            ],
115
-            'screen' => $pointer['screen'],
116
-            'target' => $pointer['target'],
117
-        ];
118
-    }
104
+	/**
105
+	 * @return array
106
+	 */
107
+	protected function generatePointer(array $pointer)
108
+	{
109
+		return [
110
+			'id' => $pointer['id'],
111
+			'options' => [
112
+				'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>',
113
+				'position' => $pointer['position'],
114
+			],
115
+			'screen' => $pointer['screen'],
116
+			'target' => $pointer['target'],
117
+		];
118
+	}
119 119
 
120
-    /**
121
-     * @return void
122
-     */
123
-    protected function generatePointers(array $pointers)
124
-    {
125
-        $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
126
-        $dismissedPointers = explode(',', (string) $dismissedPointers);
127
-        $generatedPointers = [];
128
-        foreach ($pointers as $pointer) {
129
-            if ($pointer['screen'] != glsr_current_screen()->id) {
130
-                continue;
131
-            }
132
-            if (in_array($pointer['id'], $dismissedPointers)) {
133
-                continue;
134
-            }
135
-            $generatedPointers[] = $this->generatePointer($pointer);
136
-        }
137
-        $this->pointers = $generatedPointers;
138
-    }
120
+	/**
121
+	 * @return void
122
+	 */
123
+	protected function generatePointers(array $pointers)
124
+	{
125
+		$dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
126
+		$dismissedPointers = explode(',', (string) $dismissedPointers);
127
+		$generatedPointers = [];
128
+		foreach ($pointers as $pointer) {
129
+			if ($pointer['screen'] != glsr_current_screen()->id) {
130
+				continue;
131
+			}
132
+			if (in_array($pointer['id'], $dismissedPointers)) {
133
+				continue;
134
+			}
135
+			$generatedPointers[] = $this->generatePointer($pointer);
136
+		}
137
+		$this->pointers = $generatedPointers;
138
+	}
139 139
 
140
-    /**
141
-     * @return bool
142
-     */
143
-    protected function isCurrentScreen()
144
-    {
145
-        $screen = glsr_current_screen();
146
-        return $screen && (Application::POST_TYPE == $screen->post_type
147
-            || 'post' == $screen->base
148
-            || 'dashboard' == $screen->id
149
-            || 'widgets' == $screen->id
150
-        );
151
-    }
140
+	/**
141
+	 * @return bool
142
+	 */
143
+	protected function isCurrentScreen()
144
+	{
145
+		$screen = glsr_current_screen();
146
+		return $screen && (Application::POST_TYPE == $screen->post_type
147
+			|| 'post' == $screen->base
148
+			|| 'dashboard' == $screen->id
149
+			|| 'widgets' == $screen->id
150
+		);
151
+	}
152 152
 
153
-    /**
154
-     * @return array
155
-     */
156
-    protected function localizeShortcodes()
157
-    {
158
-        $variables = [];
159
-        foreach (glsr()->mceShortcodes as $tag => $args) {
160
-            if (empty($args['required'])) {
161
-                continue;
162
-            }
163
-            $variables[$tag] = $args['required'];
164
-        }
165
-        return $variables;
166
-    }
153
+	/**
154
+	 * @return array
155
+	 */
156
+	protected function localizeShortcodes()
157
+	{
158
+		$variables = [];
159
+		foreach (glsr()->mceShortcodes as $tag => $args) {
160
+			if (empty($args['required'])) {
161
+				continue;
162
+			}
163
+			$variables[$tag] = $args['required'];
164
+		}
165
+		return $variables;
166
+	}
167 167
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return void
20 20
      */
21
-    public function handle(Command $command)
21
+    public function handle( Command $command )
22 22
     {
23
-        $this->generatePointers($command->pointers);
23
+        $this->generatePointers( $command->pointers );
24 24
         $this->enqueueAssets();
25 25
         $this->localizeAssets();
26 26
     }
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
     {
33 33
         wp_enqueue_style(
34 34
             Application::ID,
35
-            glsr()->url('assets/styles/'.Application::ID.'-admin.css'),
35
+            glsr()->url( 'assets/styles/'.Application::ID.'-admin.css' ),
36 36
             [],
37 37
             glsr()->version
38 38
         );
39
-        if (!$this->isCurrentScreen()) {
39
+        if( !$this->isCurrentScreen() ) {
40 40
             return;
41 41
         }
42 42
         wp_enqueue_script(
43 43
             Application::ID,
44
-            glsr()->url('assets/scripts/'.Application::ID.'-admin.js'),
44
+            glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ),
45 45
             $this->getDependencies(),
46 46
             glsr()->version,
47 47
             true
48 48
         );
49
-        if (!empty($this->pointers)) {
50
-            wp_enqueue_style('wp-pointer');
51
-            wp_enqueue_script('wp-pointer');
49
+        if( !empty($this->pointers) ) {
50
+            wp_enqueue_style( 'wp-pointer' );
51
+            wp_enqueue_script( 'wp-pointer' );
52 52
         }
53 53
     }
54 54
 
@@ -60,33 +60,33 @@  discard block
 block discarded – undo
60 60
         $variables = [
61 61
             'action' => Application::PREFIX.'action',
62 62
             'addons' => [],
63
-            'ajaxurl' => admin_url('admin-ajax.php'),
63
+            'ajaxurl' => admin_url( 'admin-ajax.php' ),
64 64
             'hideoptions' => [
65
-                'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
66
-                'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(),
67
-                'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(),
65
+                'site_reviews' => glsr( SiteReviewsShortcode::class )->getHideOptions(),
66
+                'site_reviews_form' => glsr( SiteReviewsFormShortcode::class )->getHideOptions(),
67
+                'site_reviews_summary' => glsr( SiteReviewsSummaryShortcode::class )->getHideOptions(),
68 68
             ],
69 69
             'nameprefix' => Application::ID,
70 70
             'nonce' => [
71
-                'change-status' => wp_create_nonce('change-status'),
72
-                'clear-console' => wp_create_nonce('clear-console'),
73
-                'count-reviews' => wp_create_nonce('count-reviews'),
74
-                'fetch-console' => wp_create_nonce('fetch-console'),
75
-                'mce-shortcode' => wp_create_nonce('mce-shortcode'),
76
-                'sync-reviews' => wp_create_nonce('sync-reviews'),
77
-                'toggle-pinned' => wp_create_nonce('toggle-pinned'),
71
+                'change-status' => wp_create_nonce( 'change-status' ),
72
+                'clear-console' => wp_create_nonce( 'clear-console' ),
73
+                'count-reviews' => wp_create_nonce( 'count-reviews' ),
74
+                'fetch-console' => wp_create_nonce( 'fetch-console' ),
75
+                'mce-shortcode' => wp_create_nonce( 'mce-shortcode' ),
76
+                'sync-reviews' => wp_create_nonce( 'sync-reviews' ),
77
+                'toggle-pinned' => wp_create_nonce( 'toggle-pinned' ),
78 78
             ],
79 79
             'pointers' => $this->pointers,
80 80
             'shortcodes' => [],
81 81
             'tinymce' => [
82
-                'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'),
82
+                'glsr_shortcode' => glsr()->url( 'assets/scripts/mce-plugin.js' ),
83 83
             ],
84 84
         ];
85
-        if (user_can_richedit()) {
85
+        if( user_can_richedit() ) {
86 86
             $variables['shortcodes'] = $this->localizeShortcodes();
87 87
         }
88
-        $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables);
89
-        wp_localize_script(Application::ID, 'GLSR', $variables);
88
+        $variables = apply_filters( 'site-reviews/enqueue/admin/localize', $variables );
89
+        wp_localize_script( Application::ID, 'GLSR', $variables );
90 90
     }
91 91
 
92 92
     /**
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
      */
95 95
     protected function getDependencies()
96 96
     {
97
-        $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []);
98
-        $dependencies = array_merge($dependencies, [
97
+        $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] );
98
+        $dependencies = array_merge( $dependencies, [
99 99
             'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
100
-        ]);
100
+        ] );
101 101
         return $dependencies;
102 102
     }
103 103
 
104 104
     /**
105 105
      * @return array
106 106
      */
107
-    protected function generatePointer(array $pointer)
107
+    protected function generatePointer( array $pointer )
108 108
     {
109 109
         return [
110 110
             'id' => $pointer['id'],
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return void
122 122
      */
123
-    protected function generatePointers(array $pointers)
123
+    protected function generatePointers( array $pointers )
124 124
     {
125
-        $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
126
-        $dismissedPointers = explode(',', (string) $dismissedPointers);
125
+        $dismissedPointers = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true );
126
+        $dismissedPointers = explode( ',', (string)$dismissedPointers );
127 127
         $generatedPointers = [];
128
-        foreach ($pointers as $pointer) {
129
-            if ($pointer['screen'] != glsr_current_screen()->id) {
128
+        foreach( $pointers as $pointer ) {
129
+            if( $pointer['screen'] != glsr_current_screen()->id ) {
130 130
                 continue;
131 131
             }
132
-            if (in_array($pointer['id'], $dismissedPointers)) {
132
+            if( in_array( $pointer['id'], $dismissedPointers ) ) {
133 133
                 continue;
134 134
             }
135
-            $generatedPointers[] = $this->generatePointer($pointer);
135
+            $generatedPointers[] = $this->generatePointer( $pointer );
136 136
         }
137 137
         $this->pointers = $generatedPointers;
138 138
     }
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
     protected function localizeShortcodes()
157 157
     {
158 158
         $variables = [];
159
-        foreach (glsr()->mceShortcodes as $tag => $args) {
160
-            if (empty($args['required'])) {
159
+        foreach( glsr()->mceShortcodes as $tag => $args ) {
160
+            if( empty($args['required']) ) {
161 161
                 continue;
162 162
             }
163 163
             $variables[$tag] = $args['required'];
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPostType.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 
7 7
 class RegisterPostType
8 8
 {
9
-    /**
10
-     * @return void
11
-     */
12
-    public function handle(Command $command)
13
-    {
14
-        if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
-            register_post_type($command->postType, $command->args);
16
-            glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
-                $command->postType => $command->columns,
18
-            ]);
19
-        }
20
-    }
9
+	/**
10
+	 * @return void
11
+	 */
12
+	public function handle(Command $command)
13
+	{
14
+		if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
+			register_post_type($command->postType, $command->args);
16
+			glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
+				$command->postType => $command->columns,
18
+			]);
19
+		}
20
+	}
21 21
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
     /**
10 10
      * @return void
11 11
      */
12
-    public function handle(Command $command)
12
+    public function handle( Command $command )
13 13
     {
14
-        if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
-            register_post_type($command->postType, $command->args);
16
-            glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
14
+        if( !in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) ) {
15
+            register_post_type( $command->postType, $command->args );
16
+            glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [
17 17
                 $command->postType => $command->columns,
18
-            ]);
18
+            ] );
19 19
         }
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterShortcodes.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 class RegisterShortcodes
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = glsr(Helper::class)->buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
-                continue;
20
-            }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
-        }
23
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		foreach ($command->shortcodes as $shortcode) {
16
+			$shortcodeClass = glsr(Helper::class)->buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
+			if (!class_exists($shortcodeClass)) {
18
+				glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
+				continue;
20
+			}
21
+			add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
+		}
23
+	}
24 24
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
     /**
11 11
      * @return void
12 12
      */
13
-    public function handle(Command $command)
13
+    public function handle( Command $command )
14 14
     {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = glsr(Helper::class)->buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
15
+        foreach( $command->shortcodes as $shortcode ) {
16
+            $shortcodeClass = glsr( Helper::class )->buildClassName( $shortcode.'-shortcode', 'Shortcodes' );
17
+            if( !class_exists( $shortcodeClass ) ) {
18
+                glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) );
19 19
                 continue;
20 20
             }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
21
+            add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] );
22 22
         }
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,8 @@
 block discarded – undo
148 148
     {
149 149
         if ('parent_id' == $postId) {
150 150
             $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
151
-        } elseif ('post_id' == $postId) {
151
+        }
152
+        elseif ('post_id' == $postId) {
152 153
             $postId = intval(get_the_ID());
153 154
         }
154 155
         return $postId;
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -10,223 +10,223 @@
 block discarded – undo
10 10
 
11 11
 abstract class Shortcode implements ShortcodeContract
12 12
 {
13
-    /**
14
-     * @var string
15
-     */
16
-    protected $partialName;
17
-
18
-    /**
19
-     * @var string
20
-     */
21
-    protected $shortcodeName;
22
-
23
-    /**
24
-     * @param string|array $atts
25
-     * @param string $type
26
-     * @return string
27
-     */
28
-    public function build($atts, array $args = [], $type = 'shortcode')
29
-    {
30
-        $this->partialName = $this->getShortcodePartialName();
31
-        $this->shortcodeName = $this->getShortcodeName();
32
-        $args = $this->normalizeArgs($args, $type);
33
-        $atts = $this->normalizeAtts($atts, $type);
34
-        $partial = glsr(Partial::class)->build($this->partialName, $atts);
35
-        $title = !empty($atts['title'])
36
-            ? $args['before_title'].$atts['title'].$args['after_title']
37
-            : '';
38
-        $debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
39
-        return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
40
-    }
41
-
42
-    /**
43
-     * @param string|array $atts
44
-     * @return string
45
-     */
46
-    public function buildShortcode($atts = [])
47
-    {
48
-        return $this->build($atts);
49
-    }
50
-
51
-    /**
52
-     * @return array
53
-     */
54
-    public function getDefaults($atts)
55
-    {
56
-        return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
57
-    }
58
-
59
-    /**
60
-     * @return array
61
-     */
62
-    public function getHideOptions()
63
-    {
64
-        $options = $this->hideOptions();
65
-        return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
66
-    }
67
-
68
-    /**
69
-     * @return string
70
-     */
71
-    public function getShortcodeClassName($replace = '', $search = 'Shortcode')
72
-    {
73
-        return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
74
-    }
75
-
76
-    /**
77
-     * @return string
78
-     */
79
-    public function getShortcodeDefaultsClassName()
80
-    {
81
-        return glsr(Helper::class)->buildClassName(
82
-            $this->getShortcodeClassName('Defaults'),
83
-            'Defaults'
84
-        );
85
-    }
86
-
87
-    /**
88
-     * @return string
89
-     */
90
-    public function getShortcodeName()
91
-    {
92
-        return glsr(Helper::class)->snakeCase($this->getShortcodeClassName());
93
-    }
94
-
95
-    /**
96
-     * @return string
97
-     */
98
-    public function getShortcodePartialName()
99
-    {
100
-        return glsr(Helper::class)->dashCase($this->getShortcodeClassName());
101
-    }
102
-
103
-    /**
104
-     * @param array|string $args
105
-     * @param string $type
106
-     * @return array
107
-     */
108
-    public function normalizeArgs($args, $type = 'shortcode')
109
-    {
110
-        $args = wp_parse_args($args, [
111
-            'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
112
-            'after_widget' => '</div>',
113
-            'before_title' => '<h3 class="glsr-'.$type.'-title">',
114
-            'after_title' => '</h3>',
115
-        ]);
116
-        return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
117
-    }
118
-
119
-    /**
120
-     * @param array|string $atts
121
-     * @param string $type
122
-     * @return array
123
-     */
124
-    public function normalizeAtts($atts, $type = 'shortcode')
125
-    {
126
-        $atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
127
-        $atts = $this->getDefaults($atts);
128
-        array_walk($atts, function (&$value, $key) {
129
-            $methodName = glsr(Helper::class)->buildMethodName($key, 'normalize');
130
-            if (!method_exists($this, $methodName)) {
131
-                return;
132
-            }
133
-            $value = $this->$methodName($value);
134
-        });
135
-        return $atts;
136
-    }
137
-
138
-    /**
139
-     * @return array
140
-     */
141
-    abstract protected function hideOptions();
142
-
143
-    /**
144
-     * @param string $postId
145
-     * @return int|string
146
-     */
147
-    protected function normalizeAssignedTo($postId)
148
-    {
149
-        if ('parent_id' == $postId) {
150
-            $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
151
-        } elseif ('post_id' == $postId) {
152
-            $postId = intval(get_the_ID());
153
-        }
154
-        return $postId;
155
-    }
156
-
157
-    /**
158
-     * @param string $postId
159
-     * @return int|string
160
-     */
161
-    protected function normalizeAssignTo($postId)
162
-    {
163
-        return $this->normalizeAssignedTo($postId);
164
-    }
165
-
166
-    /**
167
-     * @param string|array $hide
168
-     * @return array
169
-     */
170
-    protected function normalizeHide($hide)
171
-    {
172
-        if (is_string($hide)) {
173
-            $hide = explode(',', $hide);
174
-        }
175
-        $hideKeys = array_keys($this->getHideOptions());
176
-        return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
177
-            return in_array($value, $hideKeys);
178
-        });
179
-    }
180
-
181
-    /**
182
-     * @param string $id
183
-     * @return string
184
-     */
185
-    protected function normalizeId($id)
186
-    {
187
-        return sanitize_title($id);
188
-    }
189
-
190
-    /**
191
-     * @param string $labels
192
-     * @return array
193
-     */
194
-    protected function normalizeLabels($labels)
195
-    {
196
-        $defaults = [
197
-            __('Excellent', 'site-reviews'),
198
-            __('Very good', 'site-reviews'),
199
-            __('Average', 'site-reviews'),
200
-            __('Poor', 'site-reviews'),
201
-            __('Terrible', 'site-reviews'),
202
-        ];
203
-        $maxRating = glsr()->constant('MAX_RATING', Rating::class);
204
-        $defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
205
-        $labels = array_map('trim', explode(',', $labels));
206
-        foreach ($defaults as $i => $label) {
207
-            if (empty($labels[$i])) {
208
-                continue;
209
-            }
210
-            $defaults[$i] = $labels[$i];
211
-        }
212
-        return array_combine(range($maxRating, 1), $defaults);
213
-    }
214
-
215
-    /**
216
-     * @param string $schema
217
-     * @return bool
218
-     */
219
-    protected function normalizeSchema($schema)
220
-    {
221
-        return wp_validate_boolean($schema);
222
-    }
223
-
224
-    /**
225
-     * @param string $text
226
-     * @return string
227
-     */
228
-    protected function normalizeText($text)
229
-    {
230
-        return trim($text);
231
-    }
13
+	/**
14
+	 * @var string
15
+	 */
16
+	protected $partialName;
17
+
18
+	/**
19
+	 * @var string
20
+	 */
21
+	protected $shortcodeName;
22
+
23
+	/**
24
+	 * @param string|array $atts
25
+	 * @param string $type
26
+	 * @return string
27
+	 */
28
+	public function build($atts, array $args = [], $type = 'shortcode')
29
+	{
30
+		$this->partialName = $this->getShortcodePartialName();
31
+		$this->shortcodeName = $this->getShortcodeName();
32
+		$args = $this->normalizeArgs($args, $type);
33
+		$atts = $this->normalizeAtts($atts, $type);
34
+		$partial = glsr(Partial::class)->build($this->partialName, $atts);
35
+		$title = !empty($atts['title'])
36
+			? $args['before_title'].$atts['title'].$args['after_title']
37
+			: '';
38
+		$debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
39
+		return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
40
+	}
41
+
42
+	/**
43
+	 * @param string|array $atts
44
+	 * @return string
45
+	 */
46
+	public function buildShortcode($atts = [])
47
+	{
48
+		return $this->build($atts);
49
+	}
50
+
51
+	/**
52
+	 * @return array
53
+	 */
54
+	public function getDefaults($atts)
55
+	{
56
+		return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
57
+	}
58
+
59
+	/**
60
+	 * @return array
61
+	 */
62
+	public function getHideOptions()
63
+	{
64
+		$options = $this->hideOptions();
65
+		return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
66
+	}
67
+
68
+	/**
69
+	 * @return string
70
+	 */
71
+	public function getShortcodeClassName($replace = '', $search = 'Shortcode')
72
+	{
73
+		return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
74
+	}
75
+
76
+	/**
77
+	 * @return string
78
+	 */
79
+	public function getShortcodeDefaultsClassName()
80
+	{
81
+		return glsr(Helper::class)->buildClassName(
82
+			$this->getShortcodeClassName('Defaults'),
83
+			'Defaults'
84
+		);
85
+	}
86
+
87
+	/**
88
+	 * @return string
89
+	 */
90
+	public function getShortcodeName()
91
+	{
92
+		return glsr(Helper::class)->snakeCase($this->getShortcodeClassName());
93
+	}
94
+
95
+	/**
96
+	 * @return string
97
+	 */
98
+	public function getShortcodePartialName()
99
+	{
100
+		return glsr(Helper::class)->dashCase($this->getShortcodeClassName());
101
+	}
102
+
103
+	/**
104
+	 * @param array|string $args
105
+	 * @param string $type
106
+	 * @return array
107
+	 */
108
+	public function normalizeArgs($args, $type = 'shortcode')
109
+	{
110
+		$args = wp_parse_args($args, [
111
+			'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
112
+			'after_widget' => '</div>',
113
+			'before_title' => '<h3 class="glsr-'.$type.'-title">',
114
+			'after_title' => '</h3>',
115
+		]);
116
+		return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
117
+	}
118
+
119
+	/**
120
+	 * @param array|string $atts
121
+	 * @param string $type
122
+	 * @return array
123
+	 */
124
+	public function normalizeAtts($atts, $type = 'shortcode')
125
+	{
126
+		$atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
127
+		$atts = $this->getDefaults($atts);
128
+		array_walk($atts, function (&$value, $key) {
129
+			$methodName = glsr(Helper::class)->buildMethodName($key, 'normalize');
130
+			if (!method_exists($this, $methodName)) {
131
+				return;
132
+			}
133
+			$value = $this->$methodName($value);
134
+		});
135
+		return $atts;
136
+	}
137
+
138
+	/**
139
+	 * @return array
140
+	 */
141
+	abstract protected function hideOptions();
142
+
143
+	/**
144
+	 * @param string $postId
145
+	 * @return int|string
146
+	 */
147
+	protected function normalizeAssignedTo($postId)
148
+	{
149
+		if ('parent_id' == $postId) {
150
+			$postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
151
+		} elseif ('post_id' == $postId) {
152
+			$postId = intval(get_the_ID());
153
+		}
154
+		return $postId;
155
+	}
156
+
157
+	/**
158
+	 * @param string $postId
159
+	 * @return int|string
160
+	 */
161
+	protected function normalizeAssignTo($postId)
162
+	{
163
+		return $this->normalizeAssignedTo($postId);
164
+	}
165
+
166
+	/**
167
+	 * @param string|array $hide
168
+	 * @return array
169
+	 */
170
+	protected function normalizeHide($hide)
171
+	{
172
+		if (is_string($hide)) {
173
+			$hide = explode(',', $hide);
174
+		}
175
+		$hideKeys = array_keys($this->getHideOptions());
176
+		return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
177
+			return in_array($value, $hideKeys);
178
+		});
179
+	}
180
+
181
+	/**
182
+	 * @param string $id
183
+	 * @return string
184
+	 */
185
+	protected function normalizeId($id)
186
+	{
187
+		return sanitize_title($id);
188
+	}
189
+
190
+	/**
191
+	 * @param string $labels
192
+	 * @return array
193
+	 */
194
+	protected function normalizeLabels($labels)
195
+	{
196
+		$defaults = [
197
+			__('Excellent', 'site-reviews'),
198
+			__('Very good', 'site-reviews'),
199
+			__('Average', 'site-reviews'),
200
+			__('Poor', 'site-reviews'),
201
+			__('Terrible', 'site-reviews'),
202
+		];
203
+		$maxRating = glsr()->constant('MAX_RATING', Rating::class);
204
+		$defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
205
+		$labels = array_map('trim', explode(',', $labels));
206
+		foreach ($defaults as $i => $label) {
207
+			if (empty($labels[$i])) {
208
+				continue;
209
+			}
210
+			$defaults[$i] = $labels[$i];
211
+		}
212
+		return array_combine(range($maxRating, 1), $defaults);
213
+	}
214
+
215
+	/**
216
+	 * @param string $schema
217
+	 * @return bool
218
+	 */
219
+	protected function normalizeSchema($schema)
220
+	{
221
+		return wp_validate_boolean($schema);
222
+	}
223
+
224
+	/**
225
+	 * @param string $text
226
+	 * @return string
227
+	 */
228
+	protected function normalizeText($text)
229
+	{
230
+		return trim($text);
231
+	}
232 232
 }
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
      * @param string $type
26 26
      * @return string
27 27
      */
28
-    public function build($atts, array $args = [], $type = 'shortcode')
28
+    public function build( $atts, array $args = [], $type = 'shortcode' )
29 29
     {
30 30
         $this->partialName = $this->getShortcodePartialName();
31 31
         $this->shortcodeName = $this->getShortcodeName();
32
-        $args = $this->normalizeArgs($args, $type);
33
-        $atts = $this->normalizeAtts($atts, $type);
34
-        $partial = glsr(Partial::class)->build($this->partialName, $atts);
32
+        $args = $this->normalizeArgs( $args, $type );
33
+        $atts = $this->normalizeAtts( $atts, $type );
34
+        $partial = glsr( Partial::class )->build( $this->partialName, $atts );
35 35
         $title = !empty($atts['title'])
36 36
             ? $args['before_title'].$atts['title'].$args['after_title']
37 37
             : '';
38
-        $debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
38
+        $debug = sprintf( '<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json'] );
39 39
         return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
40 40
     }
41 41
 
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
      * @param string|array $atts
44 44
      * @return string
45 45
      */
46
-    public function buildShortcode($atts = [])
46
+    public function buildShortcode( $atts = [] )
47 47
     {
48
-        return $this->build($atts);
48
+        return $this->build( $atts );
49 49
     }
50 50
 
51 51
     /**
52 52
      * @return array
53 53
      */
54
-    public function getDefaults($atts)
54
+    public function getDefaults( $atts )
55 55
     {
56
-        return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
56
+        return glsr( $this->getShortcodeDefaultsClassName() )->restrict( wp_parse_args( $atts ) );
57 57
     }
58 58
 
59 59
     /**
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
     public function getHideOptions()
63 63
     {
64 64
         $options = $this->hideOptions();
65
-        return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
65
+        return apply_filters( 'site-reviews/shortcode/hide-options', $options, $this->shortcodeName );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return string
70 70
      */
71
-    public function getShortcodeClassName($replace = '', $search = 'Shortcode')
71
+    public function getShortcodeClassName( $replace = '', $search = 'Shortcode' )
72 72
     {
73
-        return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
73
+        return str_replace( $search, $replace, (new ReflectionClass( $this ))->getShortName() );
74 74
     }
75 75
 
76 76
     /**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function getShortcodeDefaultsClassName()
80 80
     {
81
-        return glsr(Helper::class)->buildClassName(
82
-            $this->getShortcodeClassName('Defaults'),
81
+        return glsr( Helper::class )->buildClassName(
82
+            $this->getShortcodeClassName( 'Defaults' ),
83 83
             'Defaults'
84 84
         );
85 85
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function getShortcodeName()
91 91
     {
92
-        return glsr(Helper::class)->snakeCase($this->getShortcodeClassName());
92
+        return glsr( Helper::class )->snakeCase( $this->getShortcodeClassName() );
93 93
     }
94 94
 
95 95
     /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function getShortcodePartialName()
99 99
     {
100
-        return glsr(Helper::class)->dashCase($this->getShortcodeClassName());
100
+        return glsr( Helper::class )->dashCase( $this->getShortcodeClassName() );
101 101
     }
102 102
 
103 103
     /**
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
      * @param string $type
106 106
      * @return array
107 107
      */
108
-    public function normalizeArgs($args, $type = 'shortcode')
108
+    public function normalizeArgs( $args, $type = 'shortcode' )
109 109
     {
110
-        $args = wp_parse_args($args, [
110
+        $args = wp_parse_args( $args, [
111 111
             'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
112 112
             'after_widget' => '</div>',
113 113
             'before_title' => '<h3 class="glsr-'.$type.'-title">',
114 114
             'after_title' => '</h3>',
115
-        ]);
116
-        return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
115
+        ] );
116
+        return apply_filters( 'site-reviews/shortcode/args', $args, $type, $this->partialName );
117 117
     }
118 118
 
119 119
     /**
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
      * @param string $type
122 122
      * @return array
123 123
      */
124
-    public function normalizeAtts($atts, $type = 'shortcode')
124
+    public function normalizeAtts( $atts, $type = 'shortcode' )
125 125
     {
126
-        $atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
127
-        $atts = $this->getDefaults($atts);
128
-        array_walk($atts, function (&$value, $key) {
129
-            $methodName = glsr(Helper::class)->buildMethodName($key, 'normalize');
130
-            if (!method_exists($this, $methodName)) {
126
+        $atts = apply_filters( 'site-reviews/shortcode/atts', $atts, $type, $this->partialName );
127
+        $atts = $this->getDefaults( $atts );
128
+        array_walk( $atts, function( &$value, $key ) {
129
+            $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
130
+            if( !method_exists( $this, $methodName ) ) {
131 131
                 return;
132 132
             }
133
-            $value = $this->$methodName($value);
133
+            $value = $this->$methodName( $value );
134 134
         });
135 135
         return $atts;
136 136
     }
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
      * @param string $postId
145 145
      * @return int|string
146 146
      */
147
-    protected function normalizeAssignedTo($postId)
147
+    protected function normalizeAssignedTo( $postId )
148 148
     {
149
-        if ('parent_id' == $postId) {
150
-            $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
151
-        } elseif ('post_id' == $postId) {
152
-            $postId = intval(get_the_ID());
149
+        if( 'parent_id' == $postId ) {
150
+            $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ) ) );
151
+        } elseif( 'post_id' == $postId ) {
152
+            $postId = intval( get_the_ID() );
153 153
         }
154 154
         return $postId;
155 155
     }
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
      * @param string $postId
159 159
      * @return int|string
160 160
      */
161
-    protected function normalizeAssignTo($postId)
161
+    protected function normalizeAssignTo( $postId )
162 162
     {
163
-        return $this->normalizeAssignedTo($postId);
163
+        return $this->normalizeAssignedTo( $postId );
164 164
     }
165 165
 
166 166
     /**
167 167
      * @param string|array $hide
168 168
      * @return array
169 169
      */
170
-    protected function normalizeHide($hide)
170
+    protected function normalizeHide( $hide )
171 171
     {
172
-        if (is_string($hide)) {
173
-            $hide = explode(',', $hide);
172
+        if( is_string( $hide ) ) {
173
+            $hide = explode( ',', $hide );
174 174
         }
175
-        $hideKeys = array_keys($this->getHideOptions());
176
-        return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
177
-            return in_array($value, $hideKeys);
175
+        $hideKeys = array_keys( $this->getHideOptions() );
176
+        return array_filter( array_map( 'trim', $hide ), function( $value ) use ($hideKeys) {
177
+            return in_array( $value, $hideKeys );
178 178
         });
179 179
     }
180 180
 
@@ -182,51 +182,51 @@  discard block
 block discarded – undo
182 182
      * @param string $id
183 183
      * @return string
184 184
      */
185
-    protected function normalizeId($id)
185
+    protected function normalizeId( $id )
186 186
     {
187
-        return sanitize_title($id);
187
+        return sanitize_title( $id );
188 188
     }
189 189
 
190 190
     /**
191 191
      * @param string $labels
192 192
      * @return array
193 193
      */
194
-    protected function normalizeLabels($labels)
194
+    protected function normalizeLabels( $labels )
195 195
     {
196 196
         $defaults = [
197
-            __('Excellent', 'site-reviews'),
198
-            __('Very good', 'site-reviews'),
199
-            __('Average', 'site-reviews'),
200
-            __('Poor', 'site-reviews'),
201
-            __('Terrible', 'site-reviews'),
197
+            __( 'Excellent', 'site-reviews' ),
198
+            __( 'Very good', 'site-reviews' ),
199
+            __( 'Average', 'site-reviews' ),
200
+            __( 'Poor', 'site-reviews' ),
201
+            __( 'Terrible', 'site-reviews' ),
202 202
         ];
203
-        $maxRating = glsr()->constant('MAX_RATING', Rating::class);
204
-        $defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
205
-        $labels = array_map('trim', explode(',', $labels));
206
-        foreach ($defaults as $i => $label) {
207
-            if (empty($labels[$i])) {
203
+        $maxRating = glsr()->constant( 'MAX_RATING', Rating::class );
204
+        $defaults = array_pad( array_slice( $defaults, 0, $maxRating ), $maxRating, '' );
205
+        $labels = array_map( 'trim', explode( ',', $labels ) );
206
+        foreach( $defaults as $i => $label ) {
207
+            if( empty($labels[$i]) ) {
208 208
                 continue;
209 209
             }
210 210
             $defaults[$i] = $labels[$i];
211 211
         }
212
-        return array_combine(range($maxRating, 1), $defaults);
212
+        return array_combine( range( $maxRating, 1 ), $defaults );
213 213
     }
214 214
 
215 215
     /**
216 216
      * @param string $schema
217 217
      * @return bool
218 218
      */
219
-    protected function normalizeSchema($schema)
219
+    protected function normalizeSchema( $schema )
220 220
     {
221
-        return wp_validate_boolean($schema);
221
+        return wp_validate_boolean( $schema );
222 222
     }
223 223
 
224 224
     /**
225 225
      * @param string $text
226 226
      * @return string
227 227
      */
228
-    protected function normalizeText($text)
228
+    protected function normalizeText( $text )
229 229
     {
230
-        return trim($text);
230
+        return trim( $text );
231 231
     }
232 232
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormPopup.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -4,50 +4,50 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsFormPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'type' => 'container',
14
-            'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
-        ], [
16
-            'label' => esc_html__('Title', 'site-reviews'),
17
-            'name' => 'title',
18
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
-            'type' => 'textbox',
20
-        ], [
21
-            'label' => esc_html__('Description', 'site-reviews'),
22
-            'minHeight' => 60,
23
-            'minWidth' => 240,
24
-            'multiline' => true,
25
-            'name' => 'description',
26
-            'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
-            'type' => 'textbox',
28
-        ],
29
-        $this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
-        [
31
-            'label' => esc_html__('Assign To', 'site-reviews'),
32
-            'name' => 'assign_to',
33
-            'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
-            'type' => 'textbox',
35
-        ], [
36
-            'label' => esc_html__('Classes', 'site-reviews'),
37
-            'name' => 'class',
38
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
-            'type' => 'textbox',
40
-        ], [
41
-            'columns' => 2,
42
-            'items' => $this->getHideOptions(),
43
-            'label' => esc_html__('Hide', 'site-reviews'),
44
-            'layout' => 'grid',
45
-            'spacing' => 5,
46
-            'type' => 'container',
47
-        ], [
48
-            'hidden' => true,
49
-            'name' => 'id',
50
-            'type' => 'textbox',
51
-        ], ];
52
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'type' => 'container',
14
+			'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
+		], [
16
+			'label' => esc_html__('Title', 'site-reviews'),
17
+			'name' => 'title',
18
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+			'type' => 'textbox',
20
+		], [
21
+			'label' => esc_html__('Description', 'site-reviews'),
22
+			'minHeight' => 60,
23
+			'minWidth' => 240,
24
+			'multiline' => true,
25
+			'name' => 'description',
26
+			'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
+			'type' => 'textbox',
28
+		],
29
+		$this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
+		[
31
+			'label' => esc_html__('Assign To', 'site-reviews'),
32
+			'name' => 'assign_to',
33
+			'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
+			'type' => 'textbox',
35
+		], [
36
+			'label' => esc_html__('Classes', 'site-reviews'),
37
+			'name' => 'class',
38
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
+			'type' => 'textbox',
40
+		], [
41
+			'columns' => 2,
42
+			'items' => $this->getHideOptions(),
43
+			'label' => esc_html__('Hide', 'site-reviews'),
44
+			'layout' => 'grid',
45
+			'spacing' => 5,
46
+			'type' => 'container',
47
+		], [
48
+			'hidden' => true,
49
+			'name' => 'id',
50
+			'type' => 'textbox',
51
+		], ];
52
+	}
53 53
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
     {
12 12
         return [[
13 13
             'type' => 'container',
14
-            'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
14
+            'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
15 15
         ], [
16
-            'label' => esc_html__('Title', 'site-reviews'),
16
+            'label' => esc_html__( 'Title', 'site-reviews' ),
17 17
             'name' => 'title',
18
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
18
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
19 19
             'type' => 'textbox',
20 20
         ], [
21
-            'label' => esc_html__('Description', 'site-reviews'),
21
+            'label' => esc_html__( 'Description', 'site-reviews' ),
22 22
             'minHeight' => 60,
23 23
             'minWidth' => 240,
24 24
             'multiline' => true,
25 25
             'name' => 'description',
26
-            'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
26
+            'tooltip' => __( 'Enter a custom shortcode description.', 'site-reviews' ),
27 27
             'type' => 'textbox',
28 28
         ],
29
-        $this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
29
+        $this->getCategories( __( 'Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews' ) ),
30 30
         [
31
-            'label' => esc_html__('Assign To', 'site-reviews'),
31
+            'label' => esc_html__( 'Assign To', 'site-reviews' ),
32 32
             'name' => 'assign_to',
33
-            'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
33
+            'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
34 34
             'type' => 'textbox',
35 35
         ], [
36
-            'label' => esc_html__('Classes', 'site-reviews'),
36
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
37 37
             'name' => 'class',
38
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
38
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
39 39
             'type' => 'textbox',
40 40
         ], [
41 41
             'columns' => 2,
42 42
             'items' => $this->getHideOptions(),
43
-            'label' => esc_html__('Hide', 'site-reviews'),
43
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
44 44
             'layout' => 'grid',
45 45
             'spacing' => 5,
46 46
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsSummaryPopup extends SiteReviewsPopup
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ],
22
-        $this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
-        [
25
-            'label' => esc_html__('Assigned To', 'site-reviews'),
26
-            'name' => 'assigned_to',
27
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Schema', 'site-reviews'),
31
-            'name' => 'schema',
32
-            'options' => [
33
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
-            ],
36
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
-            'type' => 'listbox',
38
-        ], [
39
-            'label' => esc_html__('Classes', 'site-reviews'),
40
-            'name' => 'class',
41
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
-            'type' => 'textbox',
43
-        ], [
44
-            'columns' => 2,
45
-            'items' => $this->getHideOptions(),
46
-            'label' => esc_html__('Hide', 'site-reviews'),
47
-            'layout' => 'grid',
48
-            'spacing' => 5,
49
-            'type' => 'container',
50
-        ], ];
51
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		],
22
+		$this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
+		[
25
+			'label' => esc_html__('Assigned To', 'site-reviews'),
26
+			'name' => 'assigned_to',
27
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Schema', 'site-reviews'),
31
+			'name' => 'schema',
32
+			'options' => [
33
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
+			],
36
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
+			'type' => 'listbox',
38
+		], [
39
+			'label' => esc_html__('Classes', 'site-reviews'),
40
+			'name' => 'class',
41
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
+			'type' => 'textbox',
43
+		], [
44
+			'columns' => 2,
45
+			'items' => $this->getHideOptions(),
46
+			'label' => esc_html__('Hide', 'site-reviews'),
47
+			'layout' => 'grid',
48
+			'spacing' => 5,
49
+			'type' => 'container',
50
+		], ];
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ],
22
-        $this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
22
+        $this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' ) ),
23
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
24 24
         [
25
-            'label' => esc_html__('Assigned To', 'site-reviews'),
25
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
26 26
             'name' => 'assigned_to',
27
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
27
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Schema', 'site-reviews'),
30
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
31 31
             'name' => 'schema',
32 32
             'options' => [
33
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
33
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
34
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
35 35
             ],
36
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
36
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
37 37
             'type' => 'listbox',
38 38
         ], [
39
-            'label' => esc_html__('Classes', 'site-reviews'),
39
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
40 40
             'name' => 'class',
41
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
41
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
42 42
             'type' => 'textbox',
43 43
         ], [
44 44
             'columns' => 2,
45 45
             'items' => $this->getHideOptions(),
46
-            'label' => esc_html__('Hide', 'site-reviews'),
46
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
47 47
             'layout' => 'grid',
48 48
             'spacing' => 5,
49 49
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormShortcode.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsFormShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'rating' => __('Hide the rating field', 'site-reviews'),
11
-            'title' => __('Hide the title field', 'site-reviews'),
12
-            'content' => __('Hide the review field', 'site-reviews'),
13
-            'name' => __('Hide the name field', 'site-reviews'),
14
-            'email' => __('Hide the email field', 'site-reviews'),
15
-            'terms' => __('Hide the terms field', 'site-reviews'),
16
-        ];
17
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'rating' => __('Hide the rating field', 'site-reviews'),
11
+			'title' => __('Hide the title field', 'site-reviews'),
12
+			'content' => __('Hide the review field', 'site-reviews'),
13
+			'name' => __('Hide the name field', 'site-reviews'),
14
+			'email' => __('Hide the email field', 'site-reviews'),
15
+			'terms' => __('Hide the terms field', 'site-reviews'),
16
+		];
17
+	}
18 18
 
19
-    /**
20
-     * @param array|string $atts
21
-     * @param string $type
22
-     * @return array
23
-     */
24
-    public function normalizeAtts($atts, $type = 'shortcode')
25
-    {
26
-        $atts = parent::normalizeAtts($atts, $type);
27
-        if (empty($atts['id'])) {
28
-            $atts['id'] = substr(md5(serialize($atts)), 0, 8);
29
-        }
30
-        return $atts;
31
-    }
19
+	/**
20
+	 * @param array|string $atts
21
+	 * @param string $type
22
+	 * @return array
23
+	 */
24
+	public function normalizeAtts($atts, $type = 'shortcode')
25
+	{
26
+		$atts = parent::normalizeAtts($atts, $type);
27
+		if (empty($atts['id'])) {
28
+			$atts['id'] = substr(md5(serialize($atts)), 0, 8);
29
+		}
30
+		return $atts;
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
     protected function hideOptions()
8 8
     {
9 9
         return [
10
-            'rating' => __('Hide the rating field', 'site-reviews'),
11
-            'title' => __('Hide the title field', 'site-reviews'),
12
-            'content' => __('Hide the review field', 'site-reviews'),
13
-            'name' => __('Hide the name field', 'site-reviews'),
14
-            'email' => __('Hide the email field', 'site-reviews'),
15
-            'terms' => __('Hide the terms field', 'site-reviews'),
10
+            'rating' => __( 'Hide the rating field', 'site-reviews' ),
11
+            'title' => __( 'Hide the title field', 'site-reviews' ),
12
+            'content' => __( 'Hide the review field', 'site-reviews' ),
13
+            'name' => __( 'Hide the name field', 'site-reviews' ),
14
+            'email' => __( 'Hide the email field', 'site-reviews' ),
15
+            'terms' => __( 'Hide the terms field', 'site-reviews' ),
16 16
         ];
17 17
     }
18 18
 
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
      * @param string $type
22 22
      * @return array
23 23
      */
24
-    public function normalizeAtts($atts, $type = 'shortcode')
24
+    public function normalizeAtts( $atts, $type = 'shortcode' )
25 25
     {
26
-        $atts = parent::normalizeAtts($atts, $type);
27
-        if (empty($atts['id'])) {
28
-            $atts['id'] = substr(md5(serialize($atts)), 0, 8);
26
+        $atts = parent::normalizeAtts( $atts, $type );
27
+        if( empty($atts['id']) ) {
28
+            $atts['id'] = substr( md5( serialize( $atts ) ), 0, 8 );
29 29
         }
30 30
         return $atts;
31 31
     }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsPopup.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -4,84 +4,84 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ], [
22
-            'label' => esc_html__('Count', 'site-reviews'),
23
-            'maxLength' => 5,
24
-            'name' => 'count',
25
-            'size' => 3,
26
-            'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
31
-            'name' => 'rating',
32
-            'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
39
-            ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
-            'type' => 'listbox',
42
-        ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
44
-            'name' => 'pagination',
45
-            'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
49
-            ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
-            'type' => 'listbox',
52
-        ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
-        [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
57
-            'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
-            'type' => 'textbox',
60
-        ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
62
-            'name' => 'schema',
63
-            'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
-            ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
-            'type' => 'listbox',
69
-        ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
71
-            'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
-            'type' => 'textbox',
74
-        ], [
75
-            'columns' => 2,
76
-            'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
78
-            'layout' => 'grid',
79
-            'spacing' => 5,
80
-            'type' => 'container',
81
-        ], [
82
-            'hidden' => true,
83
-            'name' => 'id',
84
-            'type' => 'textbox',
85
-        ], ];
86
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		], [
22
+			'label' => esc_html__('Count', 'site-reviews'),
23
+			'maxLength' => 5,
24
+			'name' => 'count',
25
+			'size' => 3,
26
+			'text' => '10',
27
+			'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Rating', 'site-reviews'),
31
+			'name' => 'rating',
32
+			'options' => [
33
+				'5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
+				'4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
+				'3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
+				'2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
+				'1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
+				'0' => esc_html(__('Unrated', 'site-reviews')),
39
+			],
40
+			'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
+			'type' => 'listbox',
42
+		], [
43
+			'label' => esc_html__('Pagination', 'site-reviews'),
44
+			'name' => 'pagination',
45
+			'options' => [
46
+				'true' => esc_html__('Enable', 'site-reviews'),
47
+				'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
+				'false' => esc_html__('Disable', 'site-reviews'),
49
+			],
50
+			'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
+			'type' => 'listbox',
52
+		],
53
+		$this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
+		[
56
+			'label' => esc_html__('Assigned To', 'site-reviews'),
57
+			'name' => 'assigned_to',
58
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
+			'type' => 'textbox',
60
+		], [
61
+			'label' => esc_html__('Schema', 'site-reviews'),
62
+			'name' => 'schema',
63
+			'options' => [
64
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
+			],
67
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
+			'type' => 'listbox',
69
+		], [
70
+			'label' => esc_html__('Classes', 'site-reviews'),
71
+			'name' => 'class',
72
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
+			'type' => 'textbox',
74
+		], [
75
+			'columns' => 2,
76
+			'items' => $this->getHideOptions(),
77
+			'label' => esc_html__('Hide', 'site-reviews'),
78
+			'layout' => 'grid',
79
+			'spacing' => 5,
80
+			'type' => 'container',
81
+		], [
82
+			'hidden' => true,
83
+			'name' => 'id',
84
+			'type' => 'textbox',
85
+		], ];
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ], [
22
-            'label' => esc_html__('Count', 'site-reviews'),
22
+            'label' => esc_html__( 'Count', 'site-reviews' ),
23 23
             'maxLength' => 5,
24 24
             'name' => 'count',
25 25
             'size' => 3,
26 26
             'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
27
+            'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
30
+            'label' => esc_html__( 'Rating', 'site-reviews' ),
31 31
             'name' => 'rating',
32 32
             'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
33
+                '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
34
+                '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
35
+                '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
36
+                '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
37
+                '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
38
+                '0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
39 39
             ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
40
+            'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
41 41
             'type' => 'listbox',
42 42
         ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
43
+            'label' => esc_html__( 'Pagination', 'site-reviews' ),
44 44
             'name' => 'pagination',
45 45
             'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
46
+                'true' => esc_html__( 'Enable', 'site-reviews' ),
47
+                'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
48
+                'false' => esc_html__( 'Disable', 'site-reviews' ),
49 49
             ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
50
+            'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
51 51
             'type' => 'listbox',
52 52
         ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
53
+        $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ),
54
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
55 55
         [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
56
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
57 57
             'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
58
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
59 59
             'type' => 'textbox',
60 60
         ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
61
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
62 62
             'name' => 'schema',
63 63
             'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
64
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
65
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
66 66
             ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
67
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
68 68
             'type' => 'listbox',
69 69
         ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
70
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
71 71
             'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
72
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
73 73
             'type' => 'textbox',
74 74
         ], [
75 75
             'columns' => 2,
76 76
             'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
77
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
78 78
             'layout' => 'grid',
79 79
             'spacing' => 5,
80 80
             'type' => 'container',
Please login to merge, or discard this patch.