Passed
Push — master ( 27be6d...bb494a )
by Nirjhar
02:28
created
src/settings.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 
4 4
 /**
5 5
  * Backend settings page class, can have settings fields or data table
6 6
  */
7
-if ( ! class_exists( 'CGSS_SETTINGS' ) ) {
7
+if ( ! class_exists('CGSS_SETTINGS')) {
8 8
 
9 9
 	final class CGSS_SETTINGS {
10 10
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 
23 23
 			$this->capability = 'manage_options';
24 24
 			$this->menuPage = array(
25
-								'name' => __( 'SEO Scan', 'cgss' ),
26
-								'heading' => __( 'SEO Scan', 'cgss' ),
25
+								'name' => __('SEO Scan', 'cgss'),
26
+								'heading' => __('SEO Scan', 'cgss'),
27 27
 								'slug' => 'seo-scan'
28 28
 							);
29 29
 			$this->subMenuPage = array(
30
-									'name' => __( 'Seo Scan Overview', 'cgss' ),
31
-									'heading' => __( 'Overview', 'cgss' ),
30
+									'name' => __('Seo Scan Overview', 'cgss'),
31
+									'heading' => __('Overview', 'cgss'),
32 32
 									'slug' => 'seo-scan',
33 33
 									'parent_slug' => 'seo-scan',
34 34
 									'help' => false,
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 
39 39
 			$this->screen = ''; // true/false
40 40
 
41
-			add_action( 'admin_menu', array( $this, 'menu_page' ) );
42
-			add_action( 'admin_menu', array( $this, 'sub_menu_page' ) );
43
-			add_action( 'admin_menu', array( $this, 'cpt_sub_menu_page' ) );
44
-			add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
41
+			add_action('admin_menu', array($this, 'menu_page'));
42
+			add_action('admin_menu', array($this, 'sub_menu_page'));
43
+			add_action('admin_menu', array($this, 'cpt_sub_menu_page'));
44
+			add_filter('set-screen-option', array($this, 'set_screen'), 10, 3);
45 45
 		}
46 46
 
47 47
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 
52 52
 			$menu_vars = array();
53 53
 
54
-			$post_types = get_post_types( array( 'public' => true, ), 'names' );
55
-			unset( $post_types['attachment'] );
54
+			$post_types = get_post_types(array('public' => true,), 'names');
55
+			unset($post_types['attachment']);
56 56
 
57
-			foreach ( $post_types as $type ) {
57
+			foreach ($post_types as $type) {
58 58
 
59
-				$count_posts = wp_count_posts( $type );
60
-				if ( $count_posts->publish > 0 ) {
59
+				$count_posts = wp_count_posts($type);
60
+				if ($count_posts->publish > 0) {
61 61
 
62
-					$type_name = ucwords( get_post_type_object( $type )->labels->singular_name );
62
+					$type_name = ucwords(get_post_type_object($type)->labels->singular_name);
63 63
 					$menu_vars[] = array(
64
-									'name' => $type_name . ' ' . __( 'Seo Scan', 'cgss' ),
64
+									'name' => $type_name . ' ' . __('Seo Scan', 'cgss'),
65 65
 									'heading' => $type_name,
66 66
 									'slug' => 'seo-scan-' . $type,
67 67
 									'parent_slug' => 'seo-scan',
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 					$this->menuPage['heading'],
85 85
 					$this->capability,
86 86
 					$this->menuPage['slug'],
87
-					array( $this, 'overview_content_cb' ),
87
+					array($this, 'overview_content_cb'),
88 88
 					'dashicons-search'
89 89
 				);
90 90
 			}
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 							$this->subMenuPage['heading'],
103 103
 							$this->capability,
104 104
 							$this->subMenuPage['slug'],
105
-							array( $this, 'overview_content_cb' )
105
+							array($this, 'overview_content_cb')
106 106
 						);
107 107
 					if ($this->subMenuPage['screen']) {
108
-						add_action( 'load-' . $hook, array( $this, 'overview_screen_option' ) );
108
+						add_action('load-' . $hook, array($this, 'overview_screen_option'));
109 109
 					}
110 110
 				}
111 111
 			}
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 							$value['heading'],
124 124
 							$this->capability,
125 125
 							$value['slug'],
126
-							array( $this, 'cpt_content_cb' )
126
+							array($this, 'cpt_content_cb')
127 127
 						);
128 128
 					if ($value['screen']) {
129
-						add_action( 'load-' . $hook, array( $this, 'screen_option' ) );
129
+						add_action('load-' . $hook, array($this, 'screen_option'));
130 130
 					}
131 131
 				}
132 132
 			}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		//Set screen option
138 138
 		public function set_screen($status, $option, $value) {
139 139
  
140
-    		if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE()
140
+    		if ('post_per_page' == $option) return $value; // Related to PLUGIN_TABLE()
141 141
     			//return $status; 
142 142
 		}
143 143
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 
157 157
 			$option = 'per_page';
158 158
 			$args   = array(
159
-						'label'   => __( 'Show per page', 'cgss' ),
159
+						'label'   => __('Show per page', 'cgss'),
160 160
 						'default' => 10,
161 161
 						'option'  => 'post_per_page' // Related to CGSS_TABLE()
162 162
 						);
163
-			add_screen_option( $option, $args );
163
+			add_screen_option($option, $args);
164 164
 			$this->table = new CGSS_TABLE();
165 165
 		}
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
 			<div class="wrap">
173 173
 				<h1><?php echo get_admin_page_title(); ?>
174
-					&nbsp;<a href="?page=seo-scan&fetch=true" class="button button-secondary"><?php _e( 'Fetch Insight', 'cgss' ); ?></a>
174
+					&nbsp;<a href="?page=seo-scan&fetch=true" class="button button-secondary"><?php _e('Fetch Insight', 'cgss'); ?></a>
175 175
 				</h1>
176 176
 				<br class="clear">
177 177
 				<?php if (isset($_GET['fetch'])) : ?>
178
-					<?php do_action( 'cgss_fetch_insight' ); ?>
178
+					<?php do_action('cgss_fetch_insight'); ?>
179 179
 				<?php endif; ?>
180 180
 				<?php
181 181
 					// Source: /lib/overview-table.php
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 				<h1><?php echo get_admin_page_title(); ?></h1>
198 198
 				<br class="clear">
199 199
 					<?php if (isset($_GET['scan'])) : ?>
200
-						<?php do_action( 'cgss_scan' ); ?>
200
+						<?php do_action('cgss_scan'); ?>
201 201
 					<?php elseif (isset($_GET['compete'])) : ?>
202
-						<?php do_action( 'cgss_compete' ); ?>
202
+						<?php do_action('cgss_compete'); ?>
203 203
 					<?php else : ?>
204 204
 						<form method="post" action="">
205 205
 						<?php
Please login to merge, or discard this patch.
lib/action/scan.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) exit;
2
+if ( ! defined('ABSPATH')) exit;
3 3
 
4 4
 /**
5 5
  * Perform scan action
6 6
  */
7
-if ( ! class_exists( 'CGSS_SCAN' ) ) {
7
+if ( ! class_exists('CGSS_SCAN')) {
8 8
 
9 9
 	final class CGSS_SCAN {
10 10
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 		public function __construct() {
13 13
 
14 14
 			$post_id = intval($_GET['scan']);
15
-			$url = get_permalink( $post_id );
15
+			$url = get_permalink($post_id);
16 16
 
17 17
 			if (class_exists('CGSS_CRAWL')) {
18 18
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 				$crawl->do();
22 22
 				$this->result = $crawl->result();
23 23
 
24
-				update_post_meta( $post_id, 'cgss_scan_result', $this->result );
24
+				update_post_meta($post_id, 'cgss_scan_result', $this->result);
25 25
 
26 26
 				$this->render();
27 27
 			}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$fb_like = $social['fb_like'];
39 39
 
40 40
 			$score_html = 
41
-			'<span>'.sprintf(__('Overall SEO score %d out of 10. Total gPlus shares: %d Facebook shares: %d and likes: %d', 'cgss' ), $score, $gplus, $fb_share, $fb_like ).'</span>';
41
+			'<span>' . sprintf(__('Overall SEO score %d out of 10. Total gPlus shares: %d Facebook shares: %d and likes: %d', 'cgss'), $score, $gplus, $fb_share, $fb_like) . '</span>';
42 42
 
43 43
 			return $score_html;
44 44
 		}
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 			$not_found = __('NOT_FOUND', 'cgss');
60 60
 			$snippet_html = 
61 61
 			'<ul>
62
-				<li><strong>'.__('Search snippet', 'cgss').':</strong>
62
+				<li><strong>'.__('Search snippet', 'cgss') . ':</strong>
63 63
 					<ul>
64
-						<li>'.sprintf(__('Title: %s', 'cgss'),($title ? $title : $not_found)).'</li>
65
-						<li>'.sprintf(__('Description: %s', 'cgss'),($desc ? $desc : $not_found)).'</li>
64
+						<li>'.sprintf(__('Title: %s', 'cgss'), ($title ? $title : $not_found)) . '</li>
65
+						<li>'.sprintf(__('Description: %s', 'cgss'), ($desc ? $desc : $not_found)) . '</li>
66 66
 					</ul>
67 67
 				</li>
68
-				<li><strong>'.__('Social snippet(OGP)', 'cgss').':</strong>
68
+				<li><strong>'.__('Social snippet(OGP)', 'cgss') . ':</strong>
69 69
 					<ul>
70
-						<li>'.sprintf(__('Title: %s', 'cgss'),($social_title ? $social_title : $not_found)).'</li>
71
-						<li>'.sprintf(__('Description: %s', 'cgss'),( $social_desc ? $social_desc : $not_found)).'</li>
72
-						<li>'.sprintf(__('Image: %s', 'cgss'),( $social_image ? $social_image : $not_found)).'</li>
70
+						<li>'.sprintf(__('Title: %s', 'cgss'), ($social_title ? $social_title : $not_found)) . '</li>
71
+						<li>'.sprintf(__('Description: %s', 'cgss'), ($social_desc ? $social_desc : $not_found)) . '</li>
72
+						<li>'.sprintf(__('Image: %s', 'cgss'), ($social_image ? $social_image : $not_found)) . '</li>
73 73
 					</ul></li>
74 74
 			</ul>';
75 75
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			$ratio = $text['ratio'];
87 87
 
88 88
 			$htags = $text['htags'];
89
-			$headings = implode( ', ', $htags['names'] );
89
+			$headings = implode(', ', $htags['names']);
90 90
 
91 91
 			$links = $text['links'];
92 92
 			$link_count = $links['count'];
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 
96 96
 			$text_html = 
97 97
 			'<ul>
98
-				<li>'.sprintf(__('Keywords: %s','cgss'), $keys).'</li>
99
-				<li>'.sprintf(__('Number of words: %s','cgss'), $count).'</li>
100
-				<li>'.sprintf(__('Text to html ratio: %s percent','cgss'), $ratio).'</li>
101
-				<li>'.sprintf(__('Heading tags in text hierarchy: %s','cgss'), $headings).'</li>
102
-				<li>'.sprintf(__('Total Links: %d, Nofollow Links %d, External Links: %d','cgss'), $link_count, $link_nofollow, $link_external).'</li>
98
+				<li>'.sprintf(__('Keywords: %s', 'cgss'), $keys) . '</li>
99
+				<li>'.sprintf(__('Number of words: %s', 'cgss'), $count) . '</li>
100
+				<li>'.sprintf(__('Text to html ratio: %s percent', 'cgss'), $ratio) . '</li>
101
+				<li>'.sprintf(__('Heading tags in text hierarchy: %s', 'cgss'), $headings) . '</li>
102
+				<li>'.sprintf(__('Total Links: %d, Nofollow Links %d, External Links: %d', 'cgss'), $link_count, $link_nofollow, $link_external) . '</li>
103 103
 			</ul>';
104 104
 
105 105
 			return $text_html;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 			$tag_style = $design['tag_style'];
118 118
 			$tag_style_count = $tag_style['count'];
119
-			$tag_style_attributes = implode( ', ', $tag_style['tags'] );
119
+			$tag_style_attributes = implode(', ', $tag_style['tags']);
120 120
 
121 121
 			$nested_table = $design['nested_table'];
122 122
 			$vport = $design['vport'];
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
 			$design_html = 
129 129
 			'<ul>
130
-				<li>'.sprintf(__('Total images: %d and images without alt tags: %d','cgss'), $image_count, $image_no_alt_count).'</li>
131
-				<li>'.sprintf(__('iframe: %d','cgss'), $iframe).'</li>
132
-				<li>'.sprintf(__('Nested Tables: %d','cgss'), $nested_table).'</li>
133
-				<li>'.sprintf(__('Tags with style attribute: %s(%s)','cgss'), $tag_style_count, $tag_style_attributes).'</li>
134
-				<li>'.sprintf(__('Mobile optimization: Viewport Tag: %d, @media Queries: %d','cgss'), $vport, $media).'</li>
130
+				<li>'.sprintf(__('Total images: %d and images without alt tags: %d', 'cgss'), $image_count, $image_no_alt_count) . '</li>
131
+				<li>'.sprintf(__('iframe: %d', 'cgss'), $iframe) . '</li>
132
+				<li>'.sprintf(__('Nested Tables: %d', 'cgss'), $nested_table) . '</li>
133
+				<li>'.sprintf(__('Tags with style attribute: %s(%s)', 'cgss'), $tag_style_count, $tag_style_attributes) . '</li>
134
+				<li>'.sprintf(__('Mobile optimization: Viewport Tag: %d, @media Queries: %d', 'cgss'), $vport, $media) . '</li>
135 135
 			</ul>';
136 136
 
137 137
 			return $design_html;
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 			$alive = $crawl['alive'];
154 154
 			$robot = $crawl['meta_robot'];
155 155
 
156
-			$on = __( 'on', 'cgss' );
157
-			$off = __( 'off', 'cgss' );
156
+			$on = __('on', 'cgss');
157
+			$off = __('off', 'cgss');
158 158
 
159 159
 			$crawl_html = 
160 160
 			'<ul>
161
-				<li>'.sprintf(__('Your URL parameters: SSL security: %s, Static url: %s, underscores in Url: %s','cgss'), (!$ssl ? $off : $on ), (!$dynamic ? $off : $on ), (!$underscore ? $off : $on )).'</li>
162
-				<li>'.sprintf(__('If modified since header: %s','cgss'), ($if_mod == 0 ? $off : $on )).'</li>
163
-				<li>'.sprintf(__('Canonical Url: %s','cgss'), ($cano == 0 ? $off : $on )).'</li>
164
-				<li>'.sprintf(__('Meta Robot: %s','cgss'), (!$robot['ok'] ? $off : $on )).'</li>
165
-				<li>'.sprintf(__('IP Forward: %s','cgss'), ($ip ? $ip : $off )).'</li>
166
-				<li>'.sprintf(__('Keep alive connection: %s','cgss'), ($alive == 0 ? $off : $on )).'</li>
161
+				<li>'.sprintf(__('Your URL parameters: SSL security: %s, Static url: %s, underscores in Url: %s', 'cgss'), ( ! $ssl ? $off : $on), ( ! $dynamic ? $off : $on), ( ! $underscore ? $off : $on)) . '</li>
162
+				<li>'.sprintf(__('If modified since header: %s', 'cgss'), ($if_mod == 0 ? $off : $on)) . '</li>
163
+				<li>'.sprintf(__('Canonical Url: %s', 'cgss'), ($cano == 0 ? $off : $on)) . '</li>
164
+				<li>'.sprintf(__('Meta Robot: %s', 'cgss'), ( ! $robot['ok'] ? $off : $on)) . '</li>
165
+				<li>'.sprintf(__('IP Forward: %s', 'cgss'), ($ip ? $ip : $off)) . '</li>
166
+				<li>'.sprintf(__('Keep alive connection: %s', 'cgss'), ($alive == 0 ? $off : $on)) . '</li>
167 167
 			</ul>';
168 168
 
169 169
 			return $crawl_html;
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 			$css = $speed['css'];
183 183
 			$js = $speed['js'];
184 184
 
185
-			$on = __( 'on', 'cgss' );
186
-			$off = __( 'off', 'cgss' );
185
+			$on = __('on', 'cgss');
186
+			$off = __('off', 'cgss');
187 187
 
188 188
 			$speed_html = 
189 189
 			'<ul>
190
-				<li>'. sprintf( __( 'Header response time %s s and page downloading time %s s', 'cgss' ), $res_time, $down_time ). '</li>
191
-				<li>'.sprintf(__('gZip compression: %s','cgss'), ($gzip ? $off : $on )).'</li>
192
-				<li>'.sprintf(__('Browser caching: %s','cgss'), ($cache ? $off : $on )).'</li>
193
-				<li>'.sprintf(__('Requests made by CSS is %s and by JS is %s','cgss'), $css['count'], $js['count']).'</li>
194
-				<li>'.sprintf(__('Resources can be compressed by %s kb for CSS and %s kb for JS','cgss'), $css['compress_num'], $js['compress_num']).'</li>
190
+				<li>'. sprintf(__('Header response time %s s and page downloading time %s s', 'cgss'), $res_time, $down_time) . '</li>
191
+				<li>'.sprintf(__('gZip compression: %s', 'cgss'), ($gzip ? $off : $on)) . '</li>
192
+				<li>'.sprintf(__('Browser caching: %s', 'cgss'), ($cache ? $off : $on)) . '</li>
193
+				<li>'.sprintf(__('Requests made by CSS is %s and by JS is %s', 'cgss'), $css['count'], $js['count']) . '</li>
194
+				<li>'.sprintf(__('Resources can be compressed by %s kb for CSS and %s kb for JS', 'cgss'), $css['compress_num'], $js['compress_num']) . '</li>
195 195
 			</ul>';
196 196
 
197 197
 			return $speed_html;
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
 		// Render the HTML
202 202
 		public function render() {
203 203
 
204
-			$this->score_html	= $this->score_html();
205
-			$this->snippets_html	= $this->snippet_display();
204
+			$this->score_html = $this->score_html();
205
+			$this->snippets_html = $this->snippet_display();
206 206
 			$this->text_html = $this->text_display();
207 207
 			$this->design_html = $this->design_display();
208 208
 			$this->crawl_html = $this->crawl_display();
209 209
 			$this->speed_html = $this->speed_display();
210 210
 
211
-			$this->box( null, null, $this->score_html );
212
-			$this->box( __( 'Snippets', 'cgss' ), $this->dashicon('align-none'), $this->snippets_html );
213
-			$this->box( __( 'Text & Links', 'cgss' ), $this->dashicon('text'), $this->text_html );
214
-			$this->box( __( 'Design', 'cgss' ), $this->dashicon('smartphone'), $this->design_html );
215
-			$this->box( __( 'Crawl', 'cgss' ), $this->dashicon('randomize'), $this->crawl_html );
216
-			$this->box( __( 'Speed', 'cgss' ), $this->dashicon('clock'), $this->speed_html );
211
+			$this->box(null, null, $this->score_html);
212
+			$this->box(__('Snippets', 'cgss'), $this->dashicon('align-none'), $this->snippets_html);
213
+			$this->box(__('Text & Links', 'cgss'), $this->dashicon('text'), $this->text_html);
214
+			$this->box(__('Design', 'cgss'), $this->dashicon('smartphone'), $this->design_html);
215
+			$this->box(__('Crawl', 'cgss'), $this->dashicon('randomize'), $this->crawl_html);
216
+			$this->box(__('Speed', 'cgss'), $this->dashicon('clock'), $this->speed_html);
217 217
 		}
218 218
 
219 219
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 		public function dashicon($icon) {
235 235
 
236
-			return '<span class="dashicons dashicons-'.$icon.'"></span>';
236
+			return '<span class="dashicons dashicons-' . $icon . '"></span>';
237 237
 		}
238 238
 	}
239 239
 } ?>
240 240
\ No newline at end of file
Please login to merge, or discard this patch.