| @@ -1,10 +1,10 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined('ABSPATH')) exit; | |
| 3 | 3 | |
| 4 | 4 | /** | 
| 5 | 5 | * DB installation class | 
| 6 | 6 | */ | 
| 7 | -if ( ! class_exists( 'CGSS_DB' ) ) { | |
| 7 | +if ( ! class_exists('CGSS_DB')) { | |
| 8 | 8 | |
| 9 | 9 |  	class CGSS_DB { | 
| 10 | 10 | |
| @@ -29,10 +29,10 @@ discard block | ||
| 29 | 29 | global $wpdb; | 
| 30 | 30 | $wpdb->hide_errors(); | 
| 31 | 31 | $this->table_name = $wpdb->prefix . $this->table; | 
| 32 | - update_option( '_plugin_db_exist', 0 ); | |
| 33 | -			if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name ) { | |
| 34 | - $execute_sql = $this->execute( $this->table_name, $this->collate(), $this->sql ); | |
| 35 | - dbDelta( $execute_sql ); | |
| 32 | +			update_option('_plugin_db_exist', 0); | |
| 33 | +			if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { | |
| 34 | + $execute_sql = $this->execute($this->table_name, $this->collate(), $this->sql); | |
| 35 | + dbDelta($execute_sql); | |
| 36 | 36 | } | 
| 37 | 37 | } | 
| 38 | 38 | |
| @@ -44,20 +44,20 @@ discard block | ||
| 44 | 44 | global $wpdb; | 
| 45 | 45 | $wpdb->hide_errors(); | 
| 46 | 46 | $collate = ""; | 
| 47 | -		    if ( $wpdb->has_cap( 'collation' ) ) { | |
| 48 | - if( ! empty($wpdb->charset ) ) | |
| 47 | +		    if ($wpdb->has_cap('collation')) { | |
| 48 | + if ( ! empty($wpdb->charset)) | |
| 49 | 49 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; | 
| 50 | - if( ! empty($wpdb->collate ) ) | |
| 50 | + if ( ! empty($wpdb->collate)) | |
| 51 | 51 | $collate .= " COLLATE $wpdb->collate"; | 
| 52 | 52 | } | 
| 53 | - require_once( $this->up_path ); | |
| 53 | + require_once($this->up_path); | |
| 54 | 54 | return $collate; | 
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | //SQL query to create the main plugin table. | 
| 60 | -		public function execute( $table_name, $collate, $sql ) { | |
| 60 | +		public function execute($table_name, $collate, $sql) { | |
| 61 | 61 | return "CREATE TABLE $table_name ( $sql ) $collate;"; | 
| 62 | 62 | } | 
| 63 | 63 | |
| @@ -67,8 +67,8 @@ discard block | ||
| 67 | 67 |  		public function __destruct() { | 
| 68 | 68 | global $wpdb; | 
| 69 | 69 | $this->table_name = $wpdb->prefix . $this->table; | 
| 70 | -			if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name ) { | |
| 71 | - update_option( '_plugin_db_exist', 1 ); | |
| 70 | +			if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name) { | |
| 71 | +				update_option('_plugin_db_exist', 1); | |
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | } | 
| @@ -1,5 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | /** | 
| 5 | 7 | * DB installation class | 
| @@ -45,10 +47,12 @@ discard block | ||
| 45 | 47 | $wpdb->hide_errors(); | 
| 46 | 48 | $collate = ""; | 
| 47 | 49 |  		    if ( $wpdb->has_cap( 'collation' ) ) { | 
| 48 | - if( ! empty($wpdb->charset ) ) | |
| 49 | - $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; | |
| 50 | - if( ! empty($wpdb->collate ) ) | |
| 51 | - $collate .= " COLLATE $wpdb->collate"; | |
| 50 | +				if( ! empty($wpdb->charset ) ) { | |
| 51 | + $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; | |
| 52 | + } | |
| 53 | +				if( ! empty($wpdb->collate ) ) { | |
| 54 | + $collate .= " COLLATE $wpdb->collate"; | |
| 55 | + } | |
| 52 | 56 | } | 
| 53 | 57 | require_once( $this->up_path ); | 
| 54 | 58 | return $collate; | 
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | /** | 
| 5 | 7 | * Perform scan action | 
| @@ -1,10 +1,10 @@ discard block | ||
| 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 | ||
| 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 | ||
| 21 | 21 | $crawl->execute(); | 
| 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 | } | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | $fb_like = $social['fb_like']; | 
| 38 | 38 | |
| 39 | 39 | $score_html = | 
| 40 | -			'<span>'.sprintf(__('Overall SEO score %d out of 10. Facebook shares: %d and likes: %d', 'cgss' ), $score, $fb_share, $fb_like ).'</span>'; | |
| 40 | +			'<span>' . sprintf(__('Overall SEO score %d out of 10. Facebook shares: %d and likes: %d', 'cgss'), $score, $fb_share, $fb_like) . '</span>'; | |
| 41 | 41 | |
| 42 | 42 | return $score_html; | 
| 43 | 43 | } | 
| @@ -58,17 +58,17 @@ discard block | ||
| 58 | 58 |  			$not_found = __('NOT_FOUND', 'cgss'); | 
| 59 | 59 | $snippet_html = | 
| 60 | 60 | '<ul> | 
| 61 | -				<li><strong>'.__('Search snippet', 'cgss').':</strong> | |
| 61 | +				<li><strong>'.__('Search snippet', 'cgss') . ':</strong> | |
| 62 | 62 | <ul> | 
| 63 | -						<li>'.sprintf(__('Title: %s', 'cgss'),($title ? $title : $not_found)).'</li> | |
| 64 | -						<li>'.sprintf(__('Description: %s', 'cgss'),($desc ? $desc : $not_found)).'</li> | |
| 63 | +						<li>'.sprintf(__('Title: %s', 'cgss'), ($title ? $title : $not_found)) . '</li> | |
| 64 | +						<li>'.sprintf(__('Description: %s', 'cgss'), ($desc ? $desc : $not_found)) . '</li> | |
| 65 | 65 | </ul> | 
| 66 | 66 | </li> | 
| 67 | -				<li><strong>'.__('Social snippet(OGP)', 'cgss').':</strong> | |
| 67 | +				<li><strong>'.__('Social snippet(OGP)', 'cgss') . ':</strong> | |
| 68 | 68 | <ul> | 
| 69 | -						<li>'.sprintf(__('Title: %s', 'cgss'),($social_title ? $social_title : $not_found)).'</li> | |
| 70 | -						<li>'.sprintf(__('Description: %s', 'cgss'),( $social_desc ? $social_desc : $not_found)).'</li> | |
| 71 | -						<li>'.sprintf(__('Image: %s', 'cgss'),( $social_image ? $social_image : $not_found)).'</li> | |
| 69 | +						<li>'.sprintf(__('Title: %s', 'cgss'), ($social_title ? $social_title : $not_found)) . '</li> | |
| 70 | +						<li>'.sprintf(__('Description: %s', 'cgss'), ($social_desc ? $social_desc : $not_found)) . '</li> | |
| 71 | +						<li>'.sprintf(__('Image: %s', 'cgss'), ($social_image ? $social_image : $not_found)) . '</li> | |
| 72 | 72 | </ul></li> | 
| 73 | 73 | </ul>'; | 
| 74 | 74 | |
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | $ratio = $text['ratio']; | 
| 86 | 86 | |
| 87 | 87 | $htags = $text['htags']; | 
| 88 | - $headings = implode( ', ', $htags['names'] ); | |
| 88 | +			$headings = implode(', ', $htags['names']); | |
| 89 | 89 | |
| 90 | 90 | $links = $text['links']; | 
| 91 | 91 | $link_count = $links['count']; | 
| @@ -94,11 +94,11 @@ discard block | ||
| 94 | 94 | |
| 95 | 95 | $text_html = | 
| 96 | 96 | '<ul> | 
| 97 | -				<li>'.sprintf(__('Keywords: %s','cgss'), $keys).'</li> | |
| 98 | -				<li>'.sprintf(__('Number of words: %s','cgss'), $count).'</li> | |
| 99 | -				<li>'.sprintf(__('Text to html ratio: %s percent','cgss'), $ratio).'</li> | |
| 100 | -				<li>'.sprintf(__('Heading tags in text hierarchy: %s','cgss'), $headings).'</li> | |
| 101 | -				<li>'.sprintf(__('Total Links: %d, Nofollow Links %d, External Links: %d','cgss'), $link_count, $link_nofollow, $link_external).'</li> | |
| 97 | +				<li>'.sprintf(__('Keywords: %s', 'cgss'), $keys) . '</li> | |
| 98 | +				<li>'.sprintf(__('Number of words: %s', 'cgss'), $count) . '</li> | |
| 99 | +				<li>'.sprintf(__('Text to html ratio: %s percent', 'cgss'), $ratio) . '</li> | |
| 100 | +				<li>'.sprintf(__('Heading tags in text hierarchy: %s', 'cgss'), $headings) . '</li> | |
| 101 | +				<li>'.sprintf(__('Total Links: %d, Nofollow Links %d, External Links: %d', 'cgss'), $link_count, $link_nofollow, $link_external) . '</li> | |
| 102 | 102 | </ul>'; | 
| 103 | 103 | |
| 104 | 104 | return $text_html; | 
| @@ -115,7 +115,7 @@ discard block | ||
| 115 | 115 | |
| 116 | 116 | $tag_style = $design['tag_style']; | 
| 117 | 117 | $tag_style_count = $tag_style['count']; | 
| 118 | - $tag_style_attributes = implode( ', ', $tag_style['tags'] ); | |
| 118 | +			$tag_style_attributes = implode(', ', $tag_style['tags']); | |
| 119 | 119 | |
| 120 | 120 | $nested_table = $design['nested_table']; | 
| 121 | 121 | $vport = $design['vport']; | 
| @@ -126,11 +126,11 @@ discard block | ||
| 126 | 126 | |
| 127 | 127 | $design_html = | 
| 128 | 128 | '<ul> | 
| 129 | -				<li>'.sprintf(__('Total images: %d and images without alt tags: %d','cgss'), $image_count, $image_no_alt_count).'</li> | |
| 130 | -				<li>'.sprintf(__('iframe: %d','cgss'), $iframe).'</li> | |
| 131 | -				<li>'.sprintf(__('Nested Tables: %d','cgss'), $nested_table).'</li> | |
| 132 | -				<li>'.sprintf(__('Tags with style attribute: %s(%s)','cgss'), $tag_style_count, $tag_style_attributes).'</li> | |
| 133 | -				<li>'.sprintf(__('Mobile optimization: Viewport Tag: %d, @media Queries: %d','cgss'), $vport, $media).'</li> | |
| 129 | +				<li>'.sprintf(__('Total images: %d and images without alt tags: %d', 'cgss'), $image_count, $image_no_alt_count) . '</li> | |
| 130 | +				<li>'.sprintf(__('iframe: %d', 'cgss'), $iframe) . '</li> | |
| 131 | +				<li>'.sprintf(__('Nested Tables: %d', 'cgss'), $nested_table) . '</li> | |
| 132 | +				<li>'.sprintf(__('Tags with style attribute: %s(%s)', 'cgss'), $tag_style_count, $tag_style_attributes) . '</li> | |
| 133 | +				<li>'.sprintf(__('Mobile optimization: Viewport Tag: %d, @media Queries: %d', 'cgss'), $vport, $media) . '</li> | |
| 134 | 134 | </ul>'; | 
| 135 | 135 | |
| 136 | 136 | return $design_html; | 
| @@ -152,17 +152,17 @@ discard block | ||
| 152 | 152 | $alive = $crawl['alive']; | 
| 153 | 153 | $robot = $crawl['meta_robot']; | 
| 154 | 154 | |
| 155 | - $on = __( 'on', 'cgss' ); | |
| 156 | - $off = __( 'off', 'cgss' ); | |
| 155 | +			$on = __('on', 'cgss'); | |
| 156 | +			$off = __('off', 'cgss'); | |
| 157 | 157 | |
| 158 | 158 | $crawl_html = | 
| 159 | 159 | '<ul> | 
| 160 | -				<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> | |
| 161 | -				<li>'.sprintf(__('If modified since header: %s','cgss'), ($if_mod == 0 ? $off : $on )).'</li> | |
| 162 | -				<li>'.sprintf(__('Canonical Url: %s','cgss'), ($cano == 0 ? $off : $on )).'</li> | |
| 163 | -				<li>'.sprintf(__('Meta Robot: %s','cgss'), (!$robot['ok'] ? $off : $on )).'</li> | |
| 164 | -				<li>'.sprintf(__('IP Forward: %s','cgss'), ($ip ? $ip : $off )).'</li> | |
| 165 | -				<li>'.sprintf(__('Keep alive connection: %s','cgss'), ($alive == 0 ? $off : $on )).'</li> | |
| 160 | +				<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> | |
| 161 | +				<li>'.sprintf(__('If modified since header: %s', 'cgss'), ($if_mod == 0 ? $off : $on)) . '</li> | |
| 162 | +				<li>'.sprintf(__('Canonical Url: %s', 'cgss'), ($cano == 0 ? $off : $on)) . '</li> | |
| 163 | +				<li>'.sprintf(__('Meta Robot: %s', 'cgss'), ( ! $robot['ok'] ? $off : $on)) . '</li> | |
| 164 | +				<li>'.sprintf(__('IP Forward: %s', 'cgss'), ($ip ? $ip : $off)) . '</li> | |
| 165 | +				<li>'.sprintf(__('Keep alive connection: %s', 'cgss'), ($alive == 0 ? $off : $on)) . '</li> | |
| 166 | 166 | </ul>'; | 
| 167 | 167 | |
| 168 | 168 | return $crawl_html; | 
| @@ -181,16 +181,16 @@ discard block | ||
| 181 | 181 | $css = $speed['css']; | 
| 182 | 182 | $js = $speed['js']; | 
| 183 | 183 | |
| 184 | - $on = __( 'on', 'cgss' ); | |
| 185 | - $off = __( 'off', 'cgss' ); | |
| 184 | +			$on = __('on', 'cgss'); | |
| 185 | +			$off = __('off', 'cgss'); | |
| 186 | 186 | |
| 187 | 187 | $speed_html = | 
| 188 | 188 | '<ul> | 
| 189 | - <li>'. sprintf( __( 'Header response time %s s and page downloading time %s s', 'cgss' ), $res_time, $down_time ). '</li> | |
| 190 | -				<li>'.sprintf(__('gZip compression: %s','cgss'), ($gzip ? $off : $on )).'</li> | |
| 191 | -				<li>'.sprintf(__('Browser caching: %s','cgss'), ($cache ? $off : $on )).'</li> | |
| 192 | -				<li>'.sprintf(__('Requests made by CSS is %s and by JS is %s','cgss'), $css['count'], $js['count']).'</li> | |
| 193 | -				<li>'.sprintf(__('Resources can be compressed by %s kb for CSS and %s kb for JS','cgss'), $css['compress_num'], $js['compress_num']).'</li> | |
| 189 | +				<li>'. sprintf(__('Header response time %s s and page downloading time %s s', 'cgss'), $res_time, $down_time) . '</li> | |
| 190 | +				<li>'.sprintf(__('gZip compression: %s', 'cgss'), ($gzip ? $off : $on)) . '</li> | |
| 191 | +				<li>'.sprintf(__('Browser caching: %s', 'cgss'), ($cache ? $off : $on)) . '</li> | |
| 192 | +				<li>'.sprintf(__('Requests made by CSS is %s and by JS is %s', 'cgss'), $css['count'], $js['count']) . '</li> | |
| 193 | +				<li>'.sprintf(__('Resources can be compressed by %s kb for CSS and %s kb for JS', 'cgss'), $css['compress_num'], $js['compress_num']) . '</li> | |
| 194 | 194 | </ul>'; | 
| 195 | 195 | |
| 196 | 196 | return $speed_html; | 
| @@ -200,19 +200,19 @@ discard block | ||
| 200 | 200 | // Render the HTML | 
| 201 | 201 |  		public function render() { | 
| 202 | 202 | |
| 203 | - $this->score_html = $this->score_html(); | |
| 204 | - $this->snippets_html = $this->snippet_display(); | |
| 203 | + $this->score_html = $this->score_html(); | |
| 204 | + $this->snippets_html = $this->snippet_display(); | |
| 205 | 205 | $this->text_html = $this->text_display(); | 
| 206 | 206 | $this->design_html = $this->design_display(); | 
| 207 | 207 | $this->crawl_html = $this->crawl_display(); | 
| 208 | 208 | $this->speed_html = $this->speed_display(); | 
| 209 | 209 | |
| 210 | - $this->box( null, null, $this->score_html ); | |
| 211 | -			$this->box( __( 'Snippets', 'cgss' ), $this->dashicon('align-none'), $this->snippets_html ); | |
| 212 | -			$this->box( __( 'Text & Links', 'cgss' ), $this->dashicon('text'), $this->text_html ); | |
| 213 | -			$this->box( __( 'Design', 'cgss' ), $this->dashicon('smartphone'), $this->design_html ); | |
| 214 | -			$this->box( __( 'Crawl', 'cgss' ), $this->dashicon('randomize'), $this->crawl_html ); | |
| 215 | -			$this->box( __( 'Speed', 'cgss' ), $this->dashicon('clock'), $this->speed_html ); | |
| 210 | + $this->box(null, null, $this->score_html); | |
| 211 | +			$this->box(__('Snippets', 'cgss'), $this->dashicon('align-none'), $this->snippets_html); | |
| 212 | +			$this->box(__('Text & Links', 'cgss'), $this->dashicon('text'), $this->text_html); | |
| 213 | +			$this->box(__('Design', 'cgss'), $this->dashicon('smartphone'), $this->design_html); | |
| 214 | +			$this->box(__('Crawl', 'cgss'), $this->dashicon('randomize'), $this->crawl_html); | |
| 215 | +			$this->box(__('Speed', 'cgss'), $this->dashicon('clock'), $this->speed_html); | |
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 | |
| @@ -232,7 +232,7 @@ discard block | ||
| 232 | 232 | |
| 233 | 233 |  		public function dashicon($icon) { | 
| 234 | 234 | |
| 235 | - return '<span class="dashicons dashicons-'.$icon.'"></span>'; | |
| 235 | + return '<span class="dashicons dashicons-' . $icon . '"></span>'; | |
| 236 | 236 | } | 
| 237 | 237 | } | 
| 238 | 238 | } ?> | 
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | /** | 
| 5 | 7 | * Perform fetch insight action | 
| @@ -1,10 +1,10 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined('ABSPATH')) exit; | |
| 3 | 3 | |
| 4 | 4 | /** | 
| 5 | 5 | * Perform fetch insight action | 
| 6 | 6 | */ | 
| 7 | -if ( ! class_exists( 'CGSS_INSIGHT' ) ) { | |
| 7 | +if ( ! class_exists('CGSS_INSIGHT')) { | |
| 8 | 8 | |
| 9 | 9 |  	final class CGSS_INSIGHT { | 
| 10 | 10 | |
| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 | $this->social, | 
| 35 | 35 | ); | 
| 36 | 36 |  			foreach ($result as $key => $value) { | 
| 37 | -				$sql = $wpdb->prepare("UPDATE {$wpdb->prefix}cgss_insight SET remark = %s WHERE ID = %d", $value, ($key+1)); | |
| 37 | +				$sql = $wpdb->prepare("UPDATE {$wpdb->prefix}cgss_insight SET remark = %s WHERE ID = %d", $value, ($key + 1)); | |
| 38 | 38 | $update = $wpdb->query($sql); | 
| 39 | 39 | } | 
| 40 | 40 | } | 
| @@ -45,9 +45,9 @@ discard block | ||
| 45 | 45 | |
| 46 | 46 | $score = $this->data['score']; | 
| 47 | 47 | $this->count = (count($score) == 0 ? 1 : count($score)); | 
| 48 | - $avarage_score = (count($score) == 0 ? 0 : round(array_sum($score)/count($score), 0)); | |
| 48 | + $avarage_score = (count($score) == 0 ? 0 : round(array_sum($score) / count($score), 0)); | |
| 49 | 49 | |
| 50 | -			$this->score = sprintf(__('Avarage SEO score is %d out of 10', 'cgss'),$avarage_score); | |
| 50 | +			$this->score = sprintf(__('Avarage SEO score is %d out of 10', 'cgss'), $avarage_score); | |
| 51 | 51 | $this->snippet = $this->snippet_analyze(); | 
| 52 | 52 | $this->text = $this->text_analyze(); | 
| 53 | 53 | $this->links = $this->link_analyze(); | 
| @@ -67,13 +67,13 @@ discard block | ||
| 67 | 67 |  			foreach ($snippets as $snippet) { | 
| 68 | 68 | $title = $snippet['title']; | 
| 69 | 69 | $desc = $snippet['desc']; | 
| 70 | -				if (!empty($title) && !empty($desc)) { | |
| 70 | +				if ( ! empty($title) && ! empty($desc)) { | |
| 71 | 71 | $snip_count++; | 
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | $snip_fraction = $this->count - $snip_count; | 
| 75 | 75 | |
| 76 | -			$output = ($snip_fraction == 0) ? __( 'All snippets are ok', 'cgss' ) : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __( 'have incomplete snippets', 'cgss' ); | |
| 76 | +			$output = ($snip_fraction == 0) ? __('All snippets are ok', 'cgss') : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __('have incomplete snippets', 'cgss'); | |
| 77 | 77 | return $output; | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | $count = round(array_sum(array_column($text, 'count')) / $this->count, 0); | 
| 86 | 86 | $ratio = round(array_sum(array_column($text, 'ratio')) / $this->count, 2); | 
| 87 | 87 | |
| 88 | -			$output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d word is','%d words are',$count,'cgss') . ' ' . __( 'found per page and avarage text to HTML ratio is %d', 'cgss'),$count,$ratio) . '%'; | |
| 88 | +			$output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d word is', '%d words are', $count, 'cgss') . ' ' . __('found per page and avarage text to HTML ratio is %d', 'cgss'), $count, $ratio) . '%'; | |
| 89 | 89 | return $output; | 
| 90 | 90 | } | 
| 91 | 91 | |
| @@ -98,10 +98,10 @@ discard block | ||
| 98 | 98 | $count = round(array_sum(array_column($links, 'count')) / $this->count, 0); | 
| 99 | 99 | $external = round(array_sum(array_column($links, 'external')) / $this->count, 0); | 
| 100 | 100 | $nofollow = round(array_sum(array_column($links, 'external')) / $this->count, 0); | 
| 101 | - $external_percentage = ($count == 0 ? 0 : round(($external/$count)*100, 0)); | |
| 102 | - $nofollow_percentage = ($count == 0 ? 0 : round(($nofollow/$count)*100, 0)); | |
| 101 | + $external_percentage = ($count == 0 ? 0 : round(($external / $count) * 100, 0)); | |
| 102 | + $nofollow_percentage = ($count == 0 ? 0 : round(($nofollow / $count) * 100, 0)); | |
| 103 | 103 | |
| 104 | -			$output = sprintf(__('Avarage', 'cgss') . ' '.  _n( '%d link is','%d links are', $count, 'cgss' ) . ' ' . __('found per page. %d% are external and %d% are nofollow among them.', 'cgss'),$count,$external_percentage,$nofollow_percentage); | |
| 104 | +			$output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d link is', '%d links are', $count, 'cgss') . ' ' . __('found per page. %d% are external and %d% are nofollow among them.', 'cgss'), $count, $external_percentage, $nofollow_percentage); | |
| 105 | 105 | return $output; | 
| 106 | 106 | } | 
| 107 | 107 | |
| @@ -124,7 +124,7 @@ discard block | ||
| 124 | 124 | $key_count = round(array_sum($key_collect) / $this->count, 1); | 
| 125 | 125 | $percent = round(array_sum($percent_collect) / $this->count, 1); | 
| 126 | 126 | |
| 127 | -			$output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n( '%d word','%d words',$key_count, 'cgss' ) . ' ' . __('long. Keyword frequency of %d%','cgss'),$key_count,$percent); | |
| 127 | +			$output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n('%d word', '%d words', $key_count, 'cgss') . ' ' . __('long. Keyword frequency of %d%', 'cgss'), $key_count, $percent); | |
| 128 | 128 | |
| 129 | 129 | return $output; | 
| 130 | 130 | } | 
| @@ -139,14 +139,14 @@ discard block | ||
| 139 | 139 | $image_count = array_sum(array_column($images, 'count')); | 
| 140 | 140 | $no_alt_image = array_sum(array_column($images, 'no_alt_count')); | 
| 141 | 141 | |
| 142 | - $avg_image = round(($image_count/$this->count), 0); | |
| 142 | + $avg_image = round(($image_count / $this->count), 0); | |
| 143 | 143 | |
| 144 | -			$output = sprintf(__('Avarage', 'cgss') . ' ' . _n( '%d image is', '%d images are', $avg_image, 'cgss' ) . ' ' . __( 'found per page.', 'cgss'),$avg_image) . ' '; | |
| 144 | +			$output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d image is', '%d images are', $avg_image, 'cgss') . ' ' . __('found per page.', 'cgss'), $avg_image) . ' '; | |
| 145 | 145 |  			if ($no_alt_image == 0) { | 
| 146 | 146 |  				$output .= ' ' . __('All of them are optimized', 'cgss'); | 
| 147 | 147 |  			} else { | 
| 148 | - $no_alt_percent = round(($no_alt_image/$image_count)*100, 0); | |
| 149 | -				$output .= ' ' . sprintf(__('%d% among them doesn\'t have alt tag', 'cgss'),$no_alt_percent); | |
| 148 | + $no_alt_percent = round(($no_alt_image / $image_count) * 100, 0); | |
| 149 | +				$output .= ' ' . sprintf(__('%d% among them doesn\'t have alt tag', 'cgss'), $no_alt_percent); | |
| 150 | 150 | } | 
| 151 | 151 | return $output; | 
| 152 | 152 | |
| @@ -162,8 +162,8 @@ discard block | ||
| 162 | 162 |  			if ($vport == $this->count) { | 
| 163 | 163 |  				$output = __('All pages are mobile optimized', 'cgss'); | 
| 164 | 164 |  			} else { | 
| 165 | - $no_mobile_percent = round(($vport/$this->count)*100, 0); | |
| 166 | -				$output = sprintf(__('%d% pages aren\'t mobile optimized', 'cgss'),$no_mobile_percent); | |
| 165 | + $no_mobile_percent = round(($vport / $this->count) * 100, 0); | |
| 166 | +				$output = sprintf(__('%d% pages aren\'t mobile optimized', 'cgss'), $no_mobile_percent); | |
| 167 | 167 | } | 
| 168 | 168 | |
| 169 | 169 | return $output; | 
| @@ -178,10 +178,10 @@ discard block | ||
| 178 | 178 | $res_time = array_sum(array_column($speed, 'res_time')); | 
| 179 | 179 | $down_time = array_sum(array_column($speed, 'down_time')); | 
| 180 | 180 | |
| 181 | - $avg_res_time = round(($res_time/$this->count) * 1000, 0); | |
| 182 | - $avg_down_time = round(($down_time/$this->count) * 1000, 0); | |
| 181 | + $avg_res_time = round(($res_time / $this->count) * 1000, 0); | |
| 182 | + $avg_down_time = round(($down_time / $this->count) * 1000, 0); | |
| 183 | 183 | |
| 184 | -			$output = sprintf( __('Average response time is %d miliseconds and average download time is %d miliseconds', 'cgss'), $avg_res_time, $avg_down_time); | |
| 184 | +			$output = sprintf(__('Average response time is %d miliseconds and average download time is %d miliseconds', 'cgss'), $avg_res_time, $avg_down_time); | |
| 185 | 185 | |
| 186 | 186 | return $output; | 
| 187 | 187 | } | 
| @@ -195,7 +195,7 @@ discard block | ||
| 195 | 195 | $fb_share = array_sum(array_column($social, 'fb_share')); | 
| 196 | 196 | $fb_like = array_sum(array_column($social, 'fb_like')); | 
| 197 | 197 | |
| 198 | -			$output = sprintf( __('Total', 'cgss') . ': ' . _n( '%d share', '%d shares', $fb_share, 'cgss' ) . ' ' . __( 'in Facebook', 'cgss' ). ' | ' . _n( '%d Facebook like', '%d Facebook likes', $fb_like, 'cgss' ), $fb_share, $fb_like); | |
| 198 | +			$output = sprintf(__('Total', 'cgss') . ': ' . _n('%d share', '%d shares', $fb_share, 'cgss') . ' ' . __('in Facebook', 'cgss') . ' | ' . _n('%d Facebook like', '%d Facebook likes', $fb_like, 'cgss'), $fb_share, $fb_like); | |
| 199 | 199 | |
| 200 | 200 | return $output; | 
| 201 | 201 | } | 
| @@ -206,12 +206,12 @@ discard block | ||
| 206 | 206 | |
| 207 | 207 | global $wpdb; | 
| 208 | 208 |  			$sql = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_type!='attachment'"; | 
| 209 | - $ids = $wpdb->get_results( $sql, 'ARRAY_A' );; | |
| 209 | + $ids = $wpdb->get_results($sql, 'ARRAY_A'); ; | |
| 210 | 210 | |
| 211 | 211 | $data_piece = array(); | 
| 212 | 212 |  			foreach ($ids as $id) { | 
| 213 | 213 | |
| 214 | - $meta = get_post_meta( $id['ID'], 'cgss_scan_result', true ); | |
| 214 | + $meta = get_post_meta($id['ID'], 'cgss_scan_result', true); | |
| 215 | 215 |  				if ($meta) { | 
| 216 | 216 | $data_piece[] = $meta; | 
| 217 | 217 | } | 
| @@ -2,7 +2,9 @@ | ||
| 2 | 2 | /** | 
| 3 | 3 | * Add scripts to the plugin. CSS and JS. | 
| 4 | 4 | */ | 
| 5 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 6 | + exit; | |
| 7 | +} | |
| 6 | 8 | |
| 7 | 9 |  if ( ! class_exists( 'CGSS_SCRIPT' ) ) { | 
| 8 | 10 | |
| @@ -2,16 +2,16 @@ | ||
| 2 | 2 | /** | 
| 3 | 3 | * Add scripts to the plugin. CSS and JS. | 
| 4 | 4 | */ | 
| 5 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 5 | +if ( ! defined('ABSPATH')) exit; | |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'CGSS_SCRIPT' ) ) { | |
| 7 | +if ( ! class_exists('CGSS_SCRIPT')) { | |
| 8 | 8 | |
| 9 | 9 |  	final class CGSS_SCRIPT { | 
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 |  		public function __construct() { | 
| 13 | 13 | |
| 14 | - add_action( 'admin_head', array( $this, 'data_table_css' ) ); | |
| 14 | +			add_action('admin_head', array($this, 'data_table_css')); | |
| 15 | 15 | } | 
| 16 | 16 | |
| 17 | 17 | |
| @@ -1,5 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | //Main plugin object to define the plugin | 
| 5 | 7 |  if ( ! class_exists( 'CGSS_BUILD' ) ) { | 
| @@ -83,7 +85,9 @@ discard block | ||
| 83 | 85 | //Include scripts | 
| 84 | 86 |  		public function scripts() { | 
| 85 | 87 | |
| 86 | - if ( class_exists( 'CGSS_SCRIPT' ) ) new CGSS_SCRIPT(); | |
| 88 | +			if ( class_exists( 'CGSS_SCRIPT' ) ) { | |
| 89 | + new CGSS_SCRIPT(); | |
| 90 | + } | |
| 87 | 91 | } | 
| 88 | 92 | |
| 89 | 93 | |
| @@ -91,7 +95,9 @@ discard block | ||
| 91 | 95 | //Include settings pages | 
| 92 | 96 |  		public function settings() { | 
| 93 | 97 | |
| 94 | - if ( class_exists( 'CGSS_SETTINGS' ) ) new CGSS_SETTINGS(); | |
| 98 | +			if ( class_exists( 'CGSS_SETTINGS' ) ) { | |
| 99 | + new CGSS_SETTINGS(); | |
| 100 | + } | |
| 95 | 101 | } | 
| 96 | 102 | |
| 97 | 103 | |
| @@ -99,7 +105,9 @@ discard block | ||
| 99 | 105 | // Add custom insight action | 
| 100 | 106 |  		public function insight() { | 
| 101 | 107 | |
| 102 | - if ( class_exists( 'CGSS_INSIGHT' ) ) new CGSS_INSIGHT(); | |
| 108 | +			if ( class_exists( 'CGSS_INSIGHT' ) ) { | |
| 109 | + new CGSS_INSIGHT(); | |
| 110 | + } | |
| 103 | 111 | } | 
| 104 | 112 | |
| 105 | 113 | |
| @@ -107,7 +115,9 @@ discard block | ||
| 107 | 115 | // Add custom insight action | 
| 108 | 116 |  		public function scan() { | 
| 109 | 117 | |
| 110 | - if ( class_exists( 'CGSS_SCAN' ) ) new CGSS_SCAN(); | |
| 118 | +			if ( class_exists( 'CGSS_SCAN' ) ) { | |
| 119 | + new CGSS_SCAN(); | |
| 120 | + } | |
| 111 | 121 | } | 
| 112 | 122 | |
| 113 | 123 | |
| @@ -1,8 +1,8 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined('ABSPATH')) exit; | |
| 3 | 3 | |
| 4 | 4 | //Main plugin object to define the plugin | 
| 5 | -if ( ! class_exists( 'CGSS_BUILD' ) ) { | |
| 5 | +if ( ! class_exists('CGSS_BUILD')) { | |
| 6 | 6 | |
| 7 | 7 |  	final class CGSS_BUILD { | 
| 8 | 8 | |
| @@ -17,8 +17,8 @@ discard block | ||
| 17 | 17 | $install->phpVerAllowed = '5.4'; | 
| 18 | 18 | $install->pluginPageLinks = array( | 
| 19 | 19 | array( | 
| 20 | - 'slug' => home_url().'/wp-admin/admin.php?page=seo-scan', | |
| 21 | - 'label' => __( 'Dashboard', 'cgss' ) | |
| 20 | + 'slug' => home_url() . '/wp-admin/admin.php?page=seo-scan', | |
| 21 | +													'label' => __('Dashboard', 'cgss') | |
| 22 | 22 | ), | 
| 23 | 23 | ); | 
| 24 | 24 | $install->execute(); | 
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 | |
| 29 | 29 |  		public function db_install() { | 
| 30 | 30 | |
| 31 | -			if ( class_exists( 'CGSS_DB' ) ) { | |
| 31 | +			if (class_exists('CGSS_DB')) { | |
| 32 | 32 | $db = new CGSS_DB(); | 
| 33 | 33 | $db->table = 'cgss_insight'; | 
| 34 | 34 | $db->sql = "ID mediumint(9) NOT NULL AUTO_INCREMENT, | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | $tableName = 'cgss_insight'; | 
| 48 | 48 | |
| 49 | 49 | global $wpdb; | 
| 50 | -			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$tableName" ); | |
| 50 | +			$wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$tableName"); | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 | |
| @@ -56,23 +56,23 @@ discard block | ||
| 56 | 56 | global $wpdb; | 
| 57 | 57 | |
| 58 | 58 |  			$result = $wpdb->get_results("SELECT * from {$wpdb->prefix}cgss_insight"); | 
| 59 | -    		if(count($result) == 0) { | |
| 59 | +    		if (count($result) == 0) { | |
| 60 | 60 | |
| 61 | 61 | $init_insight = array( | 
| 62 | -					__('Score','cgss'), | |
| 63 | -					__('Snippet','cgss'), | |
| 64 | -					__('Text','cgss'), | |
| 65 | -					__('Links','cgss'), | |
| 66 | -					__('Keywords','cgss'), | |
| 67 | -					__('Images','cgss'), | |
| 68 | -					__('Responsive','cgss'), | |
| 69 | -					__('Speed','cgss'), | |
| 70 | -					__('Social','cgss') | |
| 62 | +					__('Score', 'cgss'), | |
| 63 | +					__('Snippet', 'cgss'), | |
| 64 | +					__('Text', 'cgss'), | |
| 65 | +					__('Links', 'cgss'), | |
| 66 | +					__('Keywords', 'cgss'), | |
| 67 | +					__('Images', 'cgss'), | |
| 68 | +					__('Responsive', 'cgss'), | |
| 69 | +					__('Speed', 'cgss'), | |
| 70 | +					__('Social', 'cgss') | |
| 71 | 71 | ); | 
| 72 | - $no_data = __( 'No scan reports are available yet', 'cgss' ); | |
| 72 | +			$no_data = __('No scan reports are available yet', 'cgss'); | |
| 73 | 73 |  			foreach ($init_insight as $key => $value) { | 
| 74 | 74 | $sql = $wpdb->prepare( | 
| 75 | -					"INSERT INTO {$wpdb->prefix}cgss_insight ( ID, item, remark ) VALUES ( %d, %s, %s )", ($key+1), $value, $no_data | |
| 75 | +					"INSERT INTO {$wpdb->prefix}cgss_insight ( ID, item, remark ) VALUES ( %d, %s, %s )", ($key + 1), $value, $no_data | |
| 76 | 76 | ); | 
| 77 | 77 | $query = $wpdb->query($sql); | 
| 78 | 78 | } | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | //Include scripts | 
| 84 | 84 |  		public function scripts() { | 
| 85 | 85 | |
| 86 | - if ( class_exists( 'CGSS_SCRIPT' ) ) new CGSS_SCRIPT(); | |
| 86 | +			if (class_exists('CGSS_SCRIPT')) new CGSS_SCRIPT(); | |
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | 89 | |
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | //Include settings pages | 
| 92 | 92 |  		public function settings() { | 
| 93 | 93 | |
| 94 | - if ( class_exists( 'CGSS_SETTINGS' ) ) new CGSS_SETTINGS(); | |
| 94 | +			if (class_exists('CGSS_SETTINGS')) new CGSS_SETTINGS(); | |
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | |
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | // Add custom insight action | 
| 100 | 100 |  		public function insight() { | 
| 101 | 101 | |
| 102 | - if ( class_exists( 'CGSS_INSIGHT' ) ) new CGSS_INSIGHT(); | |
| 102 | +			if (class_exists('CGSS_INSIGHT')) new CGSS_INSIGHT(); | |
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | |
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | // Add custom insight action | 
| 108 | 108 |  		public function scan() { | 
| 109 | 109 | |
| 110 | - if ( class_exists( 'CGSS_SCAN' ) ) new CGSS_SCAN(); | |
| 110 | +			if (class_exists('CGSS_SCAN')) new CGSS_SCAN(); | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | |
| @@ -140,9 +140,9 @@ discard block | ||
| 140 | 140 | //Call the dependency files | 
| 141 | 141 |  		public function helpers() { | 
| 142 | 142 | |
| 143 | -			if ( ! class_exists( 'WP_List_Table' ) ) { | |
| 144 | - require_once( ABSPATH . 'wp-admin/includes/screen.php' ); | |
| 145 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); | |
| 143 | +			if ( ! class_exists('WP_List_Table')) { | |
| 144 | + require_once(ABSPATH . 'wp-admin/includes/screen.php'); | |
| 145 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); | |
| 146 | 146 | } | 
| 147 | 147 | |
| 148 | 148 |  			require_once ('lib/table.php'); | 
| @@ -161,8 +161,8 @@ discard block | ||
| 161 | 161 | $this->helpers(); | 
| 162 | 162 | $this->functionality(); | 
| 163 | 163 | |
| 164 | - register_activation_hook( CGSS_FILE, array( $this, 'db_install' ) ); | |
| 165 | - register_uninstall_hook( CGSS_FILE, array( 'CGSS_BUILD', 'db_uninstall' ) ); //$this won't work here. | |
| 164 | + register_activation_hook(CGSS_FILE, array($this, 'db_install')); | |
| 165 | +			register_uninstall_hook(CGSS_FILE, array('CGSS_BUILD', 'db_uninstall')); //$this won't work here. | |
| 166 | 166 | |
| 167 | 167 |  			add_action('init', array($this, 'installation')); | 
| 168 | 168 | |
| @@ -170,8 +170,8 @@ discard block | ||
| 170 | 170 | $this->settings(); | 
| 171 | 171 | |
| 172 | 172 | // Add custom actions, defined in settings | 
| 173 | - add_action( 'cgss_scan', array( $this, 'scan' ) ); | |
| 174 | - add_action( 'cgss_fetch_insight', array( $this, 'insight' ) ); | |
| 173 | +			add_action('cgss_scan', array($this, 'scan')); | |
| 174 | +			add_action('cgss_fetch_insight', array($this, 'insight')); | |
| 175 | 175 | } | 
| 176 | 176 | } | 
| 177 | 177 | } ?> | 
| @@ -7,24 +7,24 @@ discard block | ||
| 7 | 7 | * $Table->display(); | 
| 8 | 8 | * | 
| 9 | 9 | */ | 
| 10 | -if ( ! class_exists( 'CGSS_TABLE' ) ) { | |
| 10 | +if ( ! class_exists('CGSS_TABLE')) { | |
| 11 | 11 | |
| 12 | 12 |  	final class CGSS_TABLE extends WP_List_Table { | 
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 |  		public function __construct() { | 
| 16 | 16 | |
| 17 | - parent::__construct( [ | |
| 18 | - 'singular' => __( 'Post', 'cgss' ), | |
| 19 | - 'plural' => __( 'Posts', 'cgss' ), | |
| 17 | + parent::__construct([ | |
| 18 | +				'singular' => __('Post', 'cgss'), | |
| 19 | +				'plural'   => __('Posts', 'cgss'), | |
| 20 | 20 | 'ajax' => false, | 
| 21 | - ] ); | |
| 21 | + ]); | |
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | //fetch the data using custom named method function | 
| 27 | -		public static function get_posts( $per_page = 10, $page_number = 1 ) { | |
| 27 | +		public static function get_posts($per_page = 10, $page_number = 1) { | |
| 28 | 28 | |
| 29 | 29 | global $wpdb; | 
| 30 | 30 | |
| @@ -35,15 +35,15 @@ discard block | ||
| 35 | 35 | $sql .= " QUERIES WHERE post_status='publish' AND post_type='$page'"; | 
| 36 | 36 | |
| 37 | 37 | //Set filters in the query using $_REQUEST | 
| 38 | -			if ( ! empty( $_REQUEST['orderby'] ) ) { | |
| 39 | - $sql .= ' ORDER BY ' . esc_sql( $_REQUEST['orderby'] ); | |
| 40 | - $sql .= ! empty( $_REQUEST['order'] ) ? ' ' . esc_sql( $_REQUEST['order'] ) : ' ASC'; | |
| 38 | +			if ( ! empty($_REQUEST['orderby'])) { | |
| 39 | + $sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']); | |
| 40 | + $sql .= ! empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC'; | |
| 41 | 41 | } | 
| 42 | 42 | $sql .= " LIMIT $per_page"; | 
| 43 | - $sql .= ' OFFSET ' . ( $page_number - 1 ) * $per_page; | |
| 43 | + $sql .= ' OFFSET ' . ($page_number - 1) * $per_page; | |
| 44 | 44 | |
| 45 | 45 | //get the data from database | 
| 46 | - $result = $wpdb->get_results( $sql, 'ARRAY_A' ); | |
| 46 | + $result = $wpdb->get_results($sql, 'ARRAY_A'); | |
| 47 | 47 | |
| 48 | 48 | // FETCH POST META DATA AND MERGE IT WITH RESULTS | 
| 49 | 49 | $result = SELF::get_post_meta_data($result); | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | //If there is no data to show | 
| 57 | 57 |  		public function no_items() { | 
| 58 | 58 | |
| 59 | - _e( 'No Published Posts are available.', 'cgss' ); | |
| 59 | +			_e('No Published Posts are available.', 'cgss'); | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | |
| @@ -73,45 +73,45 @@ discard block | ||
| 73 | 73 |  			$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}posts"; | 
| 74 | 74 | $sql .= " QUERIES WHERE post_status='publish' AND post_type='$page'"; | 
| 75 | 75 | |
| 76 | - return $wpdb->get_var( $sql ); | |
| 76 | + return $wpdb->get_var($sql); | |
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | //Display columns content | 
| 82 | -		public function column_name( $item ) { | |
| 82 | +		public function column_name($item) { | |
| 83 | 83 | |
| 84 | - $title = sprintf( '<strong>%s</strong>', $item['post_title'] ); | |
| 84 | +			$title = sprintf('<strong>%s</strong>', $item['post_title']); | |
| 85 | 85 | |
| 86 | 86 | //Change the page instruction where you want to show it | 
| 87 | 87 | $actions = array( | 
| 88 | - 'scan' => sprintf( '<a href="?page='.$_GET['page'].'&scan='.$item['ID'].'" target="_blank">%s</a>', __( 'Scan', 'cgss' ) ), | |
| 89 | - 'view' => sprintf( '<a href="'.get_permalink($item['ID']).'" target="_blank">%s</a>', __( 'View', 'cgss' ) ) | |
| 88 | +					'scan' => sprintf('<a href="?page=' . $_GET['page'] . '&scan=' . $item['ID'] . '" target="_blank">%s</a>', __('Scan', 'cgss')), | |
| 89 | +					'view' => sprintf('<a href="' . get_permalink($item['ID']) . '" target="_blank">%s</a>', __('View', 'cgss')) | |
| 90 | 90 | ); | 
| 91 | - return $title . $this->row_actions( $actions ); | |
| 91 | + return $title . $this->row_actions($actions); | |
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | //set coulmns name | 
| 97 | -		public function column_default( $item, $column_name ) { | |
| 97 | +		public function column_default($item, $column_name) { | |
| 98 | 98 | |
| 99 | -			switch ( $column_name ) { | |
| 99 | +			switch ($column_name) { | |
| 100 | 100 | |
| 101 | 101 | case 'post_title': | 
| 102 | 102 | //This is the first column | 
| 103 | - return $this->column_name( $item ); | |
| 103 | + return $this->column_name($item); | |
| 104 | 104 | case 'focus': | 
| 105 | 105 | case 'word': | 
| 106 | 106 | case 'link': | 
| 107 | 107 | case 'image': | 
| 108 | 108 | case 'share': | 
| 109 | - return $item[ $column_name ]; | |
| 109 | + return $item[$column_name]; | |
| 110 | 110 | case 'time': | 
| 111 | - return $item[ $column_name ]; | |
| 111 | + return $item[$column_name]; | |
| 112 | 112 | default: | 
| 113 | 113 | //Show the whole array for troubleshooting purposes | 
| 114 | - return print_r( $item, true ); | |
| 114 | + return print_r($item, true); | |
| 115 | 115 | } | 
| 116 | 116 | } | 
| 117 | 117 | |
| @@ -121,13 +121,13 @@ discard block | ||
| 121 | 121 |  		public function get_columns() { | 
| 122 | 122 | |
| 123 | 123 | $columns = array( | 
| 124 | - 'post_title' => __( 'Post', 'cgss' ), | |
| 125 | - 'focus' => __( 'Focus', 'cgss' ), | |
| 126 | - 'word' => __( 'Words', 'cgss' ), | |
| 127 | - 'link' => __( 'Links', 'cgss' ), | |
| 128 | - 'image' => __( 'Images', 'cgss' ), | |
| 129 | - 'share' => __( 'Shares', 'cgss' ), | |
| 130 | - 'time' => __( 'Time(s)', 'cgss' ), | |
| 124 | +							'post_title'	=> __('Post', 'cgss'), | |
| 125 | +							'focus'	=> __('Focus', 'cgss'), | |
| 126 | +							'word'	=> __('Words', 'cgss'), | |
| 127 | +							'link'	=> __('Links', 'cgss'), | |
| 128 | +							'image'	=> __('Images', 'cgss'), | |
| 129 | +							'share'	=> __('Shares', 'cgss'), | |
| 130 | +							'time'	=> __('Time(s)', 'cgss'), | |
| 131 | 131 | |
| 132 | 132 | ); | 
| 133 | 133 | return $columns; | 
| @@ -139,7 +139,7 @@ discard block | ||
| 139 | 139 |  		public function get_sortable_columns() { | 
| 140 | 140 | |
| 141 | 141 | $sortable_columns = array( | 
| 142 | - 'post_title' => array( 'post_title', true ), | |
| 142 | +				'post_title' => array('post_title', true), | |
| 143 | 143 | ); | 
| 144 | 144 | return $sortable_columns; | 
| 145 | 145 | } | 
| @@ -152,15 +152,15 @@ discard block | ||
| 152 | 152 | $this->_column_headers = $this->get_column_info(); | 
| 153 | 153 | |
| 154 | 154 | /** Process bulk action */ | 
| 155 | - $per_page = $this->get_items_per_page( 'post_per_page', 5 ); | |
| 155 | +			$per_page     = $this->get_items_per_page('post_per_page', 5); | |
| 156 | 156 | $current_page = $this->get_pagenum(); | 
| 157 | 157 | $total_items = self::record_count(); | 
| 158 | - $this->set_pagination_args( array( | |
| 158 | + $this->set_pagination_args(array( | |
| 159 | 159 | 'total_items' => $total_items, | 
| 160 | 160 | 'per_page' => $per_page, | 
| 161 | - ) ); | |
| 161 | + )); | |
| 162 | 162 | |
| 163 | - $this->items = self::get_posts( $per_page, $current_page ); | |
| 163 | + $this->items = self::get_posts($per_page, $current_page); | |
| 164 | 164 | } | 
| 165 | 165 | |
| 166 | 166 | |
| @@ -174,18 +174,18 @@ discard block | ||
| 174 | 174 | 'text' => array( | 
| 175 | 175 | 'count' => '--', | 
| 176 | 176 | 'top_key' => '--', | 
| 177 | - 'links' => array( 'count' => '--' ), | |
| 177 | +										'links' => array('count' => '--'), | |
| 178 | 178 | ), | 
| 179 | 179 | 'design' => array( | 
| 180 | - 'image' => array( 'count' => '--' ) | |
| 180 | +										'image' => array('count' => '--') | |
| 181 | 181 | ), | 
| 182 | 182 | 'social' => '--', | 
| 183 | - 'speed' => array( 'down_time' => '--' ), | |
| 183 | +							'speed' => array('down_time' => '--'), | |
| 184 | 184 | ); | 
| 185 | 185 | |
| 186 | 186 | $metas = array(); | 
| 187 | 187 |  			foreach ($IDs as $post_id) { | 
| 188 | - $meta = get_post_meta( $post_id, 'cgss_scan_result', true ); | |
| 188 | + $meta = get_post_meta($post_id, 'cgss_scan_result', true); | |
| 189 | 189 | $metas[] = is_array($meta) ? $meta : $empty_metas; | 
| 190 | 190 | } | 
| 191 | 191 | $text = array_column($metas, 'text'); | 
| @@ -1,10 +1,10 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined('ABSPATH')) exit; | |
| 3 | 3 | |
| 4 | 4 | /** | 
| 5 | 5 | * Implimentation of WordPress inbuilt functions for plugin activation. | 
| 6 | 6 | */ | 
| 7 | -if ( ! class_exists( 'CGSS_INSTALL' ) ) { | |
| 7 | +if ( ! class_exists('CGSS_INSTALL')) { | |
| 8 | 8 | |
| 9 | 9 |  	final class CGSS_INSTALL { | 
| 10 | 10 | |
| @@ -25,9 +25,9 @@ discard block | ||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 |  		public function execute() { | 
| 28 | - add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) ); | |
| 29 | - add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) ); | |
| 30 | - add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 ); | |
| 28 | +			add_action('plugins_loaded', array($this, 'text_domain_cb')); | |
| 29 | +			add_action('admin_notices', array($this, 'php_ver_incompatible')); | |
| 30 | +			add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2); | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | |
| @@ -35,7 +35,7 @@ discard block | ||
| 35 | 35 | //Load plugin textdomain | 
| 36 | 36 |  		public function text_domain_cb() { | 
| 37 | 37 | |
| 38 | - load_plugin_textdomain( $this->textDomin, false, CGSS_LN ); | |
| 38 | + load_plugin_textdomain($this->textDomin, false, CGSS_LN); | |
| 39 | 39 | } | 
| 40 | 40 | |
| 41 | 41 | |
| @@ -43,9 +43,9 @@ discard block | ||
| 43 | 43 | //Define low php verson errors | 
| 44 | 44 |  		public function php_ver_incompatible() { | 
| 45 | 45 | |
| 46 | - if ( version_compare( phpversion(), $this->phpVerAllowed, '<' ) ) : | |
| 47 | - $text = __( 'The Plugin can\'t be activated because your PHP version', 'InLinkMaster' ); | |
| 48 | - $text_last = __( 'is less than required 5.3. See more information', 'InLinkMaster' ); | |
| 46 | + if (version_compare(phpversion(), $this->phpVerAllowed, '<')) : | |
| 47 | +				$text = __('The Plugin can\'t be activated because your PHP version', 'InLinkMaster'); | |
| 48 | +				$text_last = __('is less than required 5.3. See more information', 'InLinkMaster'); | |
| 49 | 49 | $text_link = 'php.net/eol.php'; ?> | 
| 50 | 50 | |
| 51 | 51 | <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $text . ' ' . phpversion() . ' ' . $text_last . ': '; ?><a href="http://php.net/eol.php/" target="_blank"><?php echo $text_link; ?></a></p></div> | 
| @@ -55,20 +55,20 @@ discard block | ||
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | // Add settings link to plugin page | 
| 58 | -		public function menu_page_link( $links, $file ) { | |
| 58 | +		public function menu_page_link($links, $file) { | |
| 59 | 59 | |
| 60 | 60 |  			if ($this->pluginPageLinks) { | 
| 61 | 61 | static $this_plugin; | 
| 62 | -				if ( ! $this_plugin ) { | |
| 62 | +				if ( ! $this_plugin) { | |
| 63 | 63 | $this_plugin = CGSS_FILE; | 
| 64 | 64 | } | 
| 65 | -				if ( $file == $this_plugin ) { | |
| 65 | +				if ($file == $this_plugin) { | |
| 66 | 66 | $shift_link = array(); | 
| 67 | 67 |  					foreach ($this->pluginPageLinks as $value) { | 
| 68 | - $shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>'; | |
| 68 | + $shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>'; | |
| 69 | 69 | } | 
| 70 | -					foreach( $shift_link as $val ) { | |
| 71 | - array_unshift( $links, $val ); | |
| 70 | +					foreach ($shift_link as $val) { | |
| 71 | + array_unshift($links, $val); | |
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | return $links; | 
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | /** | 
| 5 | 7 | * Implimentation of WordPress inbuilt functions for plugin activation. | 
| @@ -1,10 +1,10 @@ discard block | ||
| 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 | |
| @@ -20,13 +20,13 @@ discard block | ||
| 20 | 20 | |
| 21 | 21 | $this->capability = 'manage_options'; | 
| 22 | 22 | $this->menuPage = array( | 
| 23 | - 'name' => __( 'SEO Scan', 'cgss' ), | |
| 24 | - 'heading' => __( 'SEO Scan', 'cgss' ), | |
| 23 | +								'name' => __('SEO Scan', 'cgss'), | |
| 24 | +								'heading' => __('SEO Scan', 'cgss'), | |
| 25 | 25 | 'slug' => 'seo-scan' | 
| 26 | 26 | ); | 
| 27 | 27 | $this->subMenuPage = array( | 
| 28 | - 'name' => __( 'Seo Scan Overview', 'cgss' ), | |
| 29 | - 'heading' => __( 'Overview', 'cgss' ), | |
| 28 | +									'name' => __('Seo Scan Overview', 'cgss'), | |
| 29 | +									'heading' => __('Overview', 'cgss'), | |
| 30 | 30 | 'slug' => 'seo-scan', | 
| 31 | 31 | 'parent_slug' => 'seo-scan', | 
| 32 | 32 | 'help' => false, | 
| @@ -36,11 +36,11 @@ discard block | ||
| 36 | 36 | |
| 37 | 37 | $this->screen = ''; // true/false | 
| 38 | 38 | |
| 39 | - add_action( 'admin_menu', array( $this, 'menu_page' ) ); | |
| 40 | - add_action( 'admin_menu', array( $this, 'sub_menu_page' ) ); | |
| 41 | - add_action( 'admin_menu', array( $this, 'cpt_sub_menu_page' ) ); | |
| 42 | - add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 ); | |
| 43 | -			add_filter('screen_options_show_screen', array( $this, 'remove_screen_options')); | |
| 39 | +			add_action('admin_menu', array($this, 'menu_page')); | |
| 40 | +			add_action('admin_menu', array($this, 'sub_menu_page')); | |
| 41 | +			add_action('admin_menu', array($this, 'cpt_sub_menu_page')); | |
| 42 | +			add_filter('set-screen-option', array($this, 'set_screen'), 10, 3); | |
| 43 | +			add_filter('screen_options_show_screen', array($this, 'remove_screen_options')); | |
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | 46 | |
| @@ -58,17 +58,17 @@ discard block | ||
| 58 | 58 | |
| 59 | 59 | $menu_vars = array(); | 
| 60 | 60 | |
| 61 | - $post_types = get_post_types( array( 'public' => true, ), 'names' ); | |
| 62 | - unset( $post_types['attachment'] ); | |
| 61 | +			$post_types = get_post_types(array('public' => true,), 'names'); | |
| 62 | + unset($post_types['attachment']); | |
| 63 | 63 | |
| 64 | -			foreach ( $post_types as $type ) { | |
| 64 | +			foreach ($post_types as $type) { | |
| 65 | 65 | |
| 66 | - $count_posts = wp_count_posts( $type ); | |
| 67 | -				if ( $count_posts->publish > 0 ) { | |
| 66 | + $count_posts = wp_count_posts($type); | |
| 67 | +				if ($count_posts->publish > 0) { | |
| 68 | 68 | |
| 69 | - $type_name = ucwords( get_post_type_object( $type )->labels->singular_name ); | |
| 69 | + $type_name = ucwords(get_post_type_object($type)->labels->singular_name); | |
| 70 | 70 | $menu_vars[] = array( | 
| 71 | - 'name' => $type_name . ' ' . __( 'Seo Scan', 'cgss' ), | |
| 71 | +									'name' => $type_name . ' ' . __('Seo Scan', 'cgss'), | |
| 72 | 72 | 'heading' => $type_name, | 
| 73 | 73 | 'slug' => 'seo-scan-' . $type, | 
| 74 | 74 | 'parent_slug' => 'seo-scan', | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | $this->menuPage['heading'], | 
| 92 | 92 | $this->capability, | 
| 93 | 93 | $this->menuPage['slug'], | 
| 94 | - array( $this, 'overview_content_cb' ), | |
| 94 | + array($this, 'overview_content_cb'), | |
| 95 | 95 | 'dashicons-search' | 
| 96 | 96 | ); | 
| 97 | 97 | } | 
| @@ -109,10 +109,10 @@ discard block | ||
| 109 | 109 | $this->subMenuPage['heading'], | 
| 110 | 110 | $this->capability, | 
| 111 | 111 | $this->subMenuPage['slug'], | 
| 112 | - array( $this, 'overview_content_cb' ) | |
| 112 | + array($this, 'overview_content_cb') | |
| 113 | 113 | ); | 
| 114 | 114 |  				if ($this->subMenuPage['screen']) { | 
| 115 | - add_action( 'load-' . $hook, array( $this, 'overview_screen_option' ) ); | |
| 115 | +					add_action('load-' . $hook, array($this, 'overview_screen_option')); | |
| 116 | 116 | } | 
| 117 | 117 | } | 
| 118 | 118 | } | 
| @@ -130,10 +130,10 @@ discard block | ||
| 130 | 130 | $value['heading'], | 
| 131 | 131 | $this->capability, | 
| 132 | 132 | $value['slug'], | 
| 133 | - array( $this, 'cpt_content_cb' ) | |
| 133 | + array($this, 'cpt_content_cb') | |
| 134 | 134 | ); | 
| 135 | 135 |  					if ($value['screen']) { | 
| 136 | - add_action( 'load-' . $hook, array( $this, 'screen_option' ) ); | |
| 136 | +						add_action('load-' . $hook, array($this, 'screen_option')); | |
| 137 | 137 | } | 
| 138 | 138 | } | 
| 139 | 139 | } | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | //Set screen option | 
| 145 | 145 |  		public function set_screen($status, $option, $value) { | 
| 146 | 146 | |
| 147 | - if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() | |
| 147 | +    		if ('post_per_page' == $option) return $value; // Related to PLUGIN_TABLE() | |
| 148 | 148 | //return $status; | 
| 149 | 149 | } | 
| 150 | 150 | |
| @@ -163,11 +163,11 @@ discard block | ||
| 163 | 163 | |
| 164 | 164 | $option = 'per_page'; | 
| 165 | 165 | $args = array( | 
| 166 | - 'label' => __( 'Show per page', 'cgss' ), | |
| 166 | +						'label'   => __('Show per page', 'cgss'), | |
| 167 | 167 | 'default' => 10, | 
| 168 | 168 | 'option' => 'post_per_page' // Related to CGSS_TABLE() | 
| 169 | 169 | ); | 
| 170 | - add_screen_option( $option, $args ); | |
| 170 | + add_screen_option($option, $args); | |
| 171 | 171 | $this->table = new CGSS_TABLE(); | 
| 172 | 172 | } | 
| 173 | 173 | |
| @@ -180,12 +180,12 @@ discard block | ||
| 180 | 180 | <h1><?php echo get_admin_page_title(); ?> | 
| 181 | 181 |   | 
| 182 | 182 | <a href="?page=seo-scan&fetch=true" class="button button-secondary"> | 
| 183 | - <?php _e( 'Fetch Insight', 'cgss' ); ?> | |
| 183 | +						<?php _e('Fetch Insight', 'cgss'); ?> | |
| 184 | 184 | </a> | 
| 185 | 185 | </h1> | 
| 186 | 186 | <br class="clear"> | 
| 187 | 187 | <?php if (isset($_GET['fetch'])) : ?> | 
| 188 | - <?php do_action( 'cgss_fetch_insight' ); ?> | |
| 188 | +					<?php do_action('cgss_fetch_insight'); ?> | |
| 189 | 189 | <?php endif; ?> | 
| 190 | 190 | <?php | 
| 191 | 191 | // Source: /lib/overview-table.php | 
| @@ -207,9 +207,9 @@ discard block | ||
| 207 | 207 | <h1><?php echo get_admin_page_title(); ?></h1> | 
| 208 | 208 | <br class="clear"> | 
| 209 | 209 | <?php if (isset($_GET['scan'])) : ?> | 
| 210 | - <?php do_action( 'cgss_scan' ); ?> | |
| 210 | +						<?php do_action('cgss_scan'); ?> | |
| 211 | 211 | <?php elseif (isset($_GET['compete'])) : ?> | 
| 212 | - <?php do_action( 'cgss_compete' ); ?> | |
| 212 | +						<?php do_action('cgss_compete'); ?> | |
| 213 | 213 | <?php else : ?> | 
| 214 | 214 | <form method="post" action=""> | 
| 215 | 215 | <?php | 
| @@ -1,5 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 3 | 5 | |
| 4 | 6 | /** | 
| 5 | 7 | * Backend settings page class, can have settings fields or data table | 
| @@ -144,7 +146,10 @@ discard block | ||
| 144 | 146 | //Set screen option | 
| 145 | 147 |  		public function set_screen($status, $option, $value) { | 
| 146 | 148 | |
| 147 | - if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() | |
| 149 | +    		if ( 'post_per_page' == $option ) { | |
| 150 | + return $value; | |
| 151 | + } | |
| 152 | + // Related to PLUGIN_TABLE() | |
| 148 | 153 | //return $status; | 
| 149 | 154 | } | 
| 150 | 155 | |
| @@ -210,11 +215,13 @@ discard block | ||
| 210 | 215 | <?php do_action( 'cgss_scan' ); ?> | 
| 211 | 216 | <?php elseif (isset($_GET['compete'])) : ?> | 
| 212 | 217 | <?php do_action( 'cgss_compete' ); ?> | 
| 213 | - <?php else : ?> | |
| 218 | +					<?php else { | |
| 219 | + : ?> | |
| 214 | 220 | <form method="post" action=""> | 
| 215 | 221 | <?php | 
| 216 | 222 | // Source: /lib/table.php | 
| 217 | 223 | $this->table = new CGSS_TABLE(); | 
| 224 | +} | |
| 218 | 225 | $this->table->prepare_items(); | 
| 219 | 226 | $this->table->display(); | 
| 220 | 227 | ?> | 
| @@ -7,7 +7,7 @@ discard block | ||
| 7 | 7 | * $myPluginNameTable->display(); | 
| 8 | 8 | * | 
| 9 | 9 | */ | 
| 10 | -if ( ! class_exists( 'CGSS_OVERVIEW_TABLE' ) ) { | |
| 10 | +if ( ! class_exists('CGSS_OVERVIEW_TABLE')) { | |
| 11 | 11 | |
| 12 | 12 |  	final class CGSS_OVERVIEW_TABLE extends WP_List_Table { | 
| 13 | 13 | |
| @@ -15,11 +15,11 @@ discard block | ||
| 15 | 15 | |
| 16 | 16 |  		public function __construct() { | 
| 17 | 17 | |
| 18 | - parent::__construct( [ | |
| 19 | - 'singular' => __( 'Insight', 'textdomain' ), | |
| 20 | - 'plural' => __( 'Inssight', 'textdomain' ), | |
| 18 | + parent::__construct([ | |
| 19 | +				'singular' => __('Insight', 'textdomain'), | |
| 20 | +				'plural'   => __('Inssight', 'textdomain'), | |
| 21 | 21 | 'ajax' => false, | 
| 22 | - ] ); | |
| 22 | + ]); | |
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | 25 | |
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 |  			$sql = "SELECT * FROM {$wpdb->prefix}cgss_insight"; | 
| 34 | 34 | |
| 35 | 35 | //get the data from database | 
| 36 | - $result = $wpdb->get_results( $sql, 'ARRAY_A' ); | |
| 36 | + $result = $wpdb->get_results($sql, 'ARRAY_A'); | |
| 37 | 37 | |
| 38 | 38 | return $result; | 
| 39 | 39 | } | 
| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | //If there is no data to show | 
| 44 | 44 |  		public function no_items() { | 
| 45 | 45 | |
| 46 | - _e( 'Database is empty. Please reactivate the plugin.', 'cgss' ); | |
| 46 | +			_e('Database is empty. Please reactivate the plugin.', 'cgss'); | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | |
| @@ -56,38 +56,38 @@ discard block | ||
| 56 | 56 | //Build the db query base | 
| 57 | 57 |  			$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}cgss_insight"; | 
| 58 | 58 | |
| 59 | - return $wpdb->get_var( $sql ); | |
| 59 | + return $wpdb->get_var($sql); | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | //Display columns content | 
| 65 | -		public function column_name( $item ) { | |
| 65 | +		public function column_name($item) { | |
| 66 | 66 | |
| 67 | - $title = sprintf( '<strong>%s</strong>', $item['item'] ); | |
| 67 | +			$title = sprintf('<strong>%s</strong>', $item['item']); | |
| 68 | 68 | |
| 69 | 69 | //Change the page instruction where you want to show it | 
| 70 | 70 | $actions = array(); | 
| 71 | - return $title . $this->row_actions( $actions ); | |
| 71 | + return $title . $this->row_actions($actions); | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | //set coulmns name | 
| 77 | -		public function column_default( $item, $column_name ) { | |
| 77 | +		public function column_default($item, $column_name) { | |
| 78 | 78 | |
| 79 | -			switch ( $column_name ) { | |
| 79 | +			switch ($column_name) { | |
| 80 | 80 | |
| 81 | 81 | case 'item': | 
| 82 | 82 | //This is the first column | 
| 83 | - return $this->column_name( $item ); | |
| 83 | + return $this->column_name($item); | |
| 84 | 84 | case 'remark': | 
| 85 | - return $item[ $column_name ]; | |
| 85 | + return $item[$column_name]; | |
| 86 | 86 | |
| 87 | 87 | default: | 
| 88 | 88 | |
| 89 | 89 | //Show the whole array for troubleshooting purposes | 
| 90 | - return print_r( $item, true ); | |
| 90 | + return print_r($item, true); | |
| 91 | 91 | } | 
| 92 | 92 | } | 
| 93 | 93 | |
| @@ -97,8 +97,8 @@ discard block | ||
| 97 | 97 |  		public function get_columns() { | 
| 98 | 98 | |
| 99 | 99 | $columns = array( | 
| 100 | - 'item' => __( 'Item', 'textdomain' ), | |
| 101 | - 'remark' => __( 'Remark', 'textdomain' ), | |
| 100 | +							'item'	=> __('Item', 'textdomain'), | |
| 101 | +							'remark'	=> __('Remark', 'textdomain'), | |
| 102 | 102 | ); | 
| 103 | 103 | return $columns; | 
| 104 | 104 | } |