@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib\Analysis\Lib; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | /** |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | public function fb() { |
21 | 21 | |
22 | 22 | $share = false; |
23 | - $fb_data = @file_get_contents( 'http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=' . $this->url ); |
|
24 | - if ( ! empty( $fb_data ) ) { |
|
25 | - $fb_shares = json_decode( $fb_data, true ); |
|
26 | - if ( array_key_exists ( 0, $fb_shares ) ) { |
|
23 | + $fb_data = @file_get_contents('http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=' . $this->url); |
|
24 | + if ( ! empty($fb_data)) { |
|
25 | + $fb_shares = json_decode($fb_data, true); |
|
26 | + if (array_key_exists(0, $fb_shares)) { |
|
27 | 27 | $fb_shares_act = $fb_shares[0]; |
28 | - if ( is_array( $fb_shares_act ) and array_key_exists ( 'share_count', $fb_shares_act ) and array_key_exists ( 'like_count', $fb_shares_act ) ) { |
|
28 | + if (is_array($fb_shares_act) and array_key_exists('share_count', $fb_shares_act) and array_key_exists('like_count', $fb_shares_act)) { |
|
29 | 29 | $share = array( |
30 | 30 | 'share' => $fb_shares_act['share_count'], |
31 | 31 | 'like' => $fb_shares_act['like_count'], |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | } |
36 | - if (!$share) { |
|
36 | + if ( ! $share) { |
|
37 | 37 | $share = 0; |
38 | 38 | } |
39 | 39 | return $share; |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib\Analysis\Lib; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | /** |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib\Action; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | /** |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib\Action; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | /** |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - try{ |
|
15 | + try { |
|
16 | 16 | $this->data = $this->fetch(); |
17 | 17 | $this->compile(); |
18 | 18 | $this->save(); |
19 | - } catch(Exception $e) { |
|
20 | - echo __( 'Something went wrong', 'cgss') . ' ' . $e->get_message(); |
|
19 | + } catch (Exception $e) { |
|
20 | + echo __('Something went wrong', 'cgss') . ' ' . $e->get_message(); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->social, |
40 | 40 | ); |
41 | 41 | foreach ($result as $key => $value) { |
42 | - $sql = $wpdb->prepare("UPDATE {$wpdb->prefix}cgss_insight SET remark = %s WHERE ID = %d", $value, ($key+1)); |
|
42 | + $sql = $wpdb->prepare("UPDATE {$wpdb->prefix}cgss_insight SET remark = %s WHERE ID = %d", $value, ($key + 1)); |
|
43 | 43 | $update = $wpdb->query($sql); |
44 | 44 | } |
45 | 45 | } |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $score = $this->data['score']; |
52 | 52 | $this->count = (count($score) == 0 ? 1 : count($score)); |
53 | - $avarage_score = (count($score) == 0 ? 0 : round(array_sum($score)/count($score), 0)); |
|
53 | + $avarage_score = (count($score) == 0 ? 0 : round(array_sum($score) / count($score), 0)); |
|
54 | 54 | |
55 | - $this->score = sprintf(__('Avarage SEO score is %d out of 10', 'cgss'),$avarage_score); |
|
55 | + $this->score = sprintf(__('Avarage SEO score is %d out of 10', 'cgss'), $avarage_score); |
|
56 | 56 | $this->snippet = $this->snippet_analyze(); |
57 | 57 | $this->text = $this->text_analyze(); |
58 | 58 | $this->links = $this->link_analyze(); |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | foreach ($snippets as $snippet) { |
73 | 73 | $title = $snippet['title']; |
74 | 74 | $desc = $snippet['desc']; |
75 | - if (!empty($title) && !empty($desc)) { |
|
75 | + if ( ! empty($title) && ! empty($desc)) { |
|
76 | 76 | $snip_count++; |
77 | 77 | } |
78 | 78 | } |
79 | 79 | $snip_fraction = $this->count - $snip_count; |
80 | 80 | |
81 | - $output = ($snip_fraction == 0) ? __( 'All snippets are ok', 'cgss' ) : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __( 'have incomplete snippets', 'cgss' ); |
|
81 | + $output = ($snip_fraction == 0) ? __('All snippets are ok', 'cgss') : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __('have incomplete snippets', 'cgss'); |
|
82 | 82 | return $output; |
83 | 83 | } |
84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $count = round(array_sum(array_column($text, 'count')) / $this->count, 0); |
91 | 91 | $ratio = round(array_sum(array_column($text, 'ratio')) / $this->count, 2); |
92 | 92 | |
93 | - $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) . '%'; |
|
93 | + $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) . '%'; |
|
94 | 94 | return $output; |
95 | 95 | } |
96 | 96 | |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | $count = round(array_sum(array_column($links, 'count')) / $this->count, 0); |
104 | 104 | $external = round(array_sum(array_column($links, 'external')) / $this->count, 0); |
105 | 105 | $nofollow = round(array_sum(array_column($links, 'external')) / $this->count, 0); |
106 | - $external_percentage = ($count == 0 ? 0 : round(($external/$count)*100, 0)); |
|
107 | - $nofollow_percentage = ($count == 0 ? 0 : round(($nofollow/$count)*100, 0)); |
|
106 | + $external_percentage = ($count == 0 ? 0 : round(($external / $count) * 100, 0)); |
|
107 | + $nofollow_percentage = ($count == 0 ? 0 : round(($nofollow / $count) * 100, 0)); |
|
108 | 108 | |
109 | - $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); |
|
109 | + $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); |
|
110 | 110 | return $output; |
111 | 111 | } |
112 | 112 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $key_collect = array(); |
121 | 121 | $percent_collect = array(); |
122 | 122 | foreach ($keywords as $keyword) { |
123 | - $keys = (!empty($keyword) ? array_keys($keyword) : []); |
|
123 | + $keys = ( ! empty($keyword) ? array_keys($keyword) : []); |
|
124 | 124 | $top_key = $keys[0]; |
125 | 125 | $key_collect[] = count(explode(' ', $top_key)); |
126 | 126 | $percent_collect[] = $keyword[$top_key]; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $key_count = round(array_sum($key_collect) / $this->count, 1); |
130 | 130 | $percent = round(array_sum($percent_collect) / $this->count, 1); |
131 | 131 | |
132 | - $output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n( '%d word','%d words',$key_count, 'cgss' ) . ' ' . __('long. Keyword frequency of %d%','cgss'),$key_count,$percent); |
|
132 | + $output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n('%d word', '%d words', $key_count, 'cgss') . ' ' . __('long. Keyword frequency of %d%', 'cgss'), $key_count, $percent); |
|
133 | 133 | |
134 | 134 | return $output; |
135 | 135 | } |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | $image_count = array_sum(array_column($images, 'count')); |
145 | 145 | $no_alt_image = array_sum(array_column($images, 'no_alt_count')); |
146 | 146 | |
147 | - $avg_image = round(($image_count/$this->count), 0); |
|
147 | + $avg_image = round(($image_count / $this->count), 0); |
|
148 | 148 | |
149 | - $output = sprintf(__('Avarage', 'cgss') . ' ' . _n( '%d image is', '%d images are', $avg_image, 'cgss' ) . ' ' . __( 'found per page.', 'cgss'),$avg_image) . ' '; |
|
149 | + $output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d image is', '%d images are', $avg_image, 'cgss') . ' ' . __('found per page.', 'cgss'), $avg_image) . ' '; |
|
150 | 150 | if ($no_alt_image == 0) { |
151 | 151 | $output .= ' ' . __('All of them are optimized', 'cgss'); |
152 | 152 | } else { |
153 | - $no_alt_percent = round(($no_alt_image/$image_count)*100, 0); |
|
154 | - $output .= ' ' . sprintf(__('%d% among them doesn\'t have alt tag', 'cgss'),$no_alt_percent); |
|
153 | + $no_alt_percent = round(($no_alt_image / $image_count) * 100, 0); |
|
154 | + $output .= ' ' . sprintf(__('%d% among them doesn\'t have alt tag', 'cgss'), $no_alt_percent); |
|
155 | 155 | } |
156 | 156 | return $output; |
157 | 157 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | if ($vport == $this->count) { |
168 | 168 | $output = __('All pages are mobile optimized', 'cgss'); |
169 | 169 | } else { |
170 | - $no_mobile_percent = round(($vport/$this->count)*100, 0); |
|
171 | - $output = sprintf(__('%d% pages aren\'t mobile optimized', 'cgss'),$no_mobile_percent); |
|
170 | + $no_mobile_percent = round(($vport / $this->count) * 100, 0); |
|
171 | + $output = sprintf(__('%d% pages aren\'t mobile optimized', 'cgss'), $no_mobile_percent); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $output; |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $res_time = array_sum(array_column($speed, 'res_time')); |
184 | 184 | $down_time = array_sum(array_column($speed, 'down_time')); |
185 | 185 | |
186 | - $avg_res_time = round(($res_time/$this->count) * 1000, 0); |
|
187 | - $avg_down_time = round(($down_time/$this->count) * 1000, 0); |
|
186 | + $avg_res_time = round(($res_time / $this->count) * 1000, 0); |
|
187 | + $avg_down_time = round(($down_time / $this->count) * 1000, 0); |
|
188 | 188 | |
189 | - $output = sprintf( __('Average response time is %d miliseconds and average download time is %d miliseconds', 'cgss'), $avg_res_time, $avg_down_time); |
|
189 | + $output = sprintf(__('Average response time is %d miliseconds and average download time is %d miliseconds', 'cgss'), $avg_res_time, $avg_down_time); |
|
190 | 190 | |
191 | 191 | return $output; |
192 | 192 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $fb_share = array_sum(array_column($social, 'fb_share')); |
201 | 201 | $fb_like = array_sum(array_column($social, 'fb_like')); |
202 | 202 | |
203 | - $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); |
|
203 | + $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); |
|
204 | 204 | |
205 | 205 | return $output; |
206 | 206 | } |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | |
212 | 212 | global $wpdb; |
213 | 213 | $sql = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_type!='attachment'"; |
214 | - $ids = $wpdb->get_results( $sql, 'ARRAY_A' );; |
|
214 | + $ids = $wpdb->get_results($sql, 'ARRAY_A'); ; |
|
215 | 215 | |
216 | 216 | $data_piece = array(); |
217 | 217 | foreach ($ids as $id) { |
218 | 218 | |
219 | - $meta = get_post_meta( $id['ID'], 'cgss_scan_result', true ); |
|
219 | + $meta = get_post_meta($id['ID'], 'cgss_scan_result', true); |
|
220 | 220 | if ($meta) { |
221 | 221 | $data_piece[] = $meta; |
222 | 222 | } |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace NirjharLo\Cgss\Lib\Action; |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
6 | + exit; |
|
7 | +} |
|
6 | 8 | |
7 | 9 | use \NirjharLo\Cgss\Lib\Analysis\Crawl; |
8 | 10 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace NirjharLo\Cgss\Lib\Action; |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined('ABSPATH')) exit; |
|
6 | 6 | |
7 | 7 | use \NirjharLo\Cgss\Lib\Analysis\Crawl; |
8 | 8 | |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public function __construct() { |
16 | 16 | |
17 | 17 | $post_id = intval($_GET['scan']); |
18 | - $url = get_permalink( $post_id ); |
|
18 | + $url = get_permalink($post_id); |
|
19 | 19 | |
20 | 20 | $crawl = new Crawl(); |
21 | 21 | $crawl->url = esc_url_raw($url); |
22 | 22 | $crawl->execute(); |
23 | 23 | $this->result = $crawl->result(); |
24 | 24 | |
25 | - update_post_meta( $post_id, 'cgss_scan_result', $this->result ); |
|
25 | + update_post_meta($post_id, 'cgss_scan_result', $this->result); |
|
26 | 26 | |
27 | 27 | $this->render(); |
28 | 28 | } |
@@ -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 | |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | public function text_display() { |
81 | 81 | |
82 | 82 | $text = $this->result['text']; |
83 | - $keys = (!empty($text['keys']) ? implode(', ', array_keys($text['keys'])) : ''); |
|
83 | + $keys = ( ! empty($text['keys']) ? implode(', ', array_keys($text['keys'])) : ''); |
|
84 | 84 | $count = $text['count']; |
85 | 85 | $ratio = $text['ratio']; |
86 | 86 | |
87 | 87 | $htags = $text['htags']; |
88 | - $headings = (!empty($htags['names']) ? implode( ', ', $htags['names'] ) : ''); |
|
88 | + $headings = ( ! empty($htags['names']) ? 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,6 +232,6 @@ 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 | } ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | use \WP_List_Table; |
7 | 7 | |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct() { |
22 | 22 | |
23 | - parent::__construct( [ |
|
24 | - 'singular' => __( 'Insight', 'cgss' ), |
|
25 | - 'plural' => __( 'Inssight', 'cgss' ), |
|
23 | + parent::__construct([ |
|
24 | + 'singular' => __('Insight', 'cgss'), |
|
25 | + 'plural' => __('Inssight', 'cgss'), |
|
26 | 26 | 'ajax' => false, |
27 | - ] ); |
|
27 | + ]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $sql = "SELECT * FROM {$wpdb->prefix}cgss_insight"; |
39 | 39 | |
40 | 40 | //get the data from database |
41 | - $result = $wpdb->get_results( $sql, 'ARRAY_A' ); |
|
41 | + $result = $wpdb->get_results($sql, 'ARRAY_A'); |
|
42 | 42 | |
43 | 43 | return $result; |
44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //If there is no data to show |
49 | 49 | public function no_items() { |
50 | 50 | |
51 | - _e( 'Database is empty. Please reactivate the plugin.', 'cgss' ); |
|
51 | + _e('Database is empty. Please reactivate the plugin.', 'cgss'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -61,38 +61,38 @@ discard block |
||
61 | 61 | //Build the db query base |
62 | 62 | $sql = "SELECT COUNT(*) FROM {$wpdb->prefix}cgss_insight"; |
63 | 63 | |
64 | - return $wpdb->get_var( $sql ); |
|
64 | + return $wpdb->get_var($sql); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | 69 | //Display columns content |
70 | - public function column_name( $item ) { |
|
70 | + public function column_name($item) { |
|
71 | 71 | |
72 | - $title = sprintf( '<strong>%s</strong>', $item['item'] ); |
|
72 | + $title = sprintf('<strong>%s</strong>', $item['item']); |
|
73 | 73 | |
74 | 74 | //Change the page instruction where you want to show it |
75 | 75 | $actions = array(); |
76 | - return $title . $this->row_actions( $actions ); |
|
76 | + return $title . $this->row_actions($actions); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | 81 | //set coulmns name |
82 | - public function column_default( $item, $column_name ) { |
|
82 | + public function column_default($item, $column_name) { |
|
83 | 83 | |
84 | - switch ( $column_name ) { |
|
84 | + switch ($column_name) { |
|
85 | 85 | |
86 | 86 | case 'item': |
87 | 87 | //This is the first column |
88 | - return $this->column_name( $item ); |
|
88 | + return $this->column_name($item); |
|
89 | 89 | case 'remark': |
90 | - return $item[ $column_name ]; |
|
90 | + return $item[$column_name]; |
|
91 | 91 | |
92 | 92 | default: |
93 | 93 | |
94 | 94 | //Show the whole array for troubleshooting purposes |
95 | - return print_r( $item, true ); |
|
95 | + return print_r($item, true); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | public function get_columns() { |
103 | 103 | |
104 | 104 | $columns = array( |
105 | - 'item' => __( 'Item', 'cgss' ), |
|
106 | - 'remark' => __( 'Remark', 'cgss' ), |
|
105 | + 'item' => __('Item', 'cgss'), |
|
106 | + 'remark' => __('Remark', 'cgss'), |
|
107 | 107 | ); |
108 | 108 | return $columns; |
109 | 109 | } |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Lib; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | use \WP_List_Table; |
@@ -144,8 +144,8 @@ |
||
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() |
|
148 | - //return $status; |
|
147 | + if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
148 | + //return $status; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace NirjharLo\Cgss\Src; |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined('ABSPATH')) exit; |
|
6 | 6 | |
7 | 7 | use \NirjharLo\Cgss\Lib\Table; |
8 | 8 | use \NirjharLo\Cgss\Lib\OverviewTable; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | |
27 | 27 | $this->capability = 'manage_options'; |
28 | 28 | $this->menuPage = array( |
29 | - 'name' => __( 'SEO Scan', 'cgss' ), |
|
30 | - 'heading' => __( 'SEO Scan', 'cgss' ), |
|
29 | + 'name' => __('SEO Scan', 'cgss'), |
|
30 | + 'heading' => __('SEO Scan', 'cgss'), |
|
31 | 31 | 'slug' => 'seo-scan' |
32 | 32 | ); |
33 | 33 | $this->subMenuPage = array( |
34 | - 'name' => __( 'Seo Scan Overview', 'cgss' ), |
|
35 | - 'heading' => __( 'Overview', 'cgss' ), |
|
34 | + 'name' => __('Seo Scan Overview', 'cgss'), |
|
35 | + 'heading' => __('Overview', 'cgss'), |
|
36 | 36 | 'slug' => 'seo-scan', |
37 | 37 | 'parent_slug' => 'seo-scan', |
38 | 38 | 'help' => false, |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->screen = ''; // true/false |
44 | 44 | |
45 | - add_action( 'admin_menu', array( $this, 'menu_page' ) ); |
|
46 | - add_action( 'admin_menu', array( $this, 'sub_menu_page' ) ); |
|
47 | - add_action( 'admin_menu', array( $this, 'cpt_sub_menu_page' ) ); |
|
48 | - add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 ); |
|
49 | - add_filter('screen_options_show_screen', array( $this, 'remove_screen_options')); |
|
45 | + add_action('admin_menu', array($this, 'menu_page')); |
|
46 | + add_action('admin_menu', array($this, 'sub_menu_page')); |
|
47 | + add_action('admin_menu', array($this, 'cpt_sub_menu_page')); |
|
48 | + add_filter('set-screen-option', array($this, 'set_screen'), 10, 3); |
|
49 | + add_filter('screen_options_show_screen', array($this, 'remove_screen_options')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | |
65 | 65 | $menu_vars = array(); |
66 | 66 | |
67 | - $post_types = get_post_types( array( 'public' => true, ), 'names' ); |
|
68 | - unset( $post_types['attachment'] ); |
|
67 | + $post_types = get_post_types(array('public' => true,), 'names'); |
|
68 | + unset($post_types['attachment']); |
|
69 | 69 | |
70 | - foreach ( $post_types as $type ) { |
|
70 | + foreach ($post_types as $type) { |
|
71 | 71 | |
72 | - $count_posts = wp_count_posts( $type ); |
|
73 | - if ( $count_posts->publish > 0 ) { |
|
72 | + $count_posts = wp_count_posts($type); |
|
73 | + if ($count_posts->publish > 0) { |
|
74 | 74 | |
75 | - $type_name = ucwords( get_post_type_object( $type )->labels->singular_name ); |
|
75 | + $type_name = ucwords(get_post_type_object($type)->labels->singular_name); |
|
76 | 76 | $menu_vars[] = array( |
77 | - 'name' => $type_name . ' ' . __( 'Seo Scan', 'cgss' ), |
|
77 | + 'name' => $type_name . ' ' . __('Seo Scan', 'cgss'), |
|
78 | 78 | 'heading' => $type_name, |
79 | 79 | 'slug' => 'seo-scan-' . $type, |
80 | 80 | 'parent_slug' => 'seo-scan', |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->menuPage['heading'], |
98 | 98 | $this->capability, |
99 | 99 | $this->menuPage['slug'], |
100 | - array( $this, 'overview_content_cb' ), |
|
100 | + array($this, 'overview_content_cb'), |
|
101 | 101 | 'dashicons-search' |
102 | 102 | ); |
103 | 103 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | $this->subMenuPage['heading'], |
116 | 116 | $this->capability, |
117 | 117 | $this->subMenuPage['slug'], |
118 | - array( $this, 'overview_content_cb' ) |
|
118 | + array($this, 'overview_content_cb') |
|
119 | 119 | ); |
120 | 120 | if ($this->subMenuPage['screen']) { |
121 | - add_action( 'load-' . $hook, array( $this, 'overview_screen_option' ) ); |
|
121 | + add_action('load-' . $hook, array($this, 'overview_screen_option')); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $value['heading'], |
137 | 137 | $this->capability, |
138 | 138 | $value['slug'], |
139 | - array( $this, 'cpt_content_cb' ) |
|
139 | + array($this, 'cpt_content_cb') |
|
140 | 140 | ); |
141 | 141 | if ($value['screen']) { |
142 | - add_action( 'load-' . $hook, array( $this, 'screen_option' ) ); |
|
142 | + add_action('load-' . $hook, array($this, 'screen_option')); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | //Set screen option |
151 | 151 | public function set_screen($status, $option, $value) { |
152 | 152 | |
153 | - if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
153 | + if ('post_per_page' == $option) return $value; // Related to PLUGIN_TABLE() |
|
154 | 154 | //return $status; |
155 | 155 | } |
156 | 156 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | |
170 | 170 | $option = 'per_page'; |
171 | 171 | $args = array( |
172 | - 'label' => __( 'Show per page', 'cgss' ), |
|
172 | + 'label' => __('Show per page', 'cgss'), |
|
173 | 173 | 'default' => 10, |
174 | 174 | 'option' => 'post_per_page' // Related to TABLE() |
175 | 175 | ); |
176 | - add_screen_option( $option, $args ); |
|
176 | + add_screen_option($option, $args); |
|
177 | 177 | $this->table = new Table(); |
178 | 178 | } |
179 | 179 | |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | <h1><?php echo get_admin_page_title(); ?> |
187 | 187 | |
188 | 188 | <a href="?page=seo-scan&fetch=true" class="button button-secondary"> |
189 | - <?php _e( 'Fetch Insight', 'cgss' ); ?> |
|
189 | + <?php _e('Fetch Insight', 'cgss'); ?> |
|
190 | 190 | </a> |
191 | 191 | </h1> |
192 | 192 | <br class="clear"> |
193 | 193 | <?php if (isset($_GET['fetch'])) : ?> |
194 | - <?php do_action( 'cgss_fetch_insight' ); ?> |
|
194 | + <?php do_action('cgss_fetch_insight'); ?> |
|
195 | 195 | <?php endif; ?> |
196 | 196 | <?php |
197 | 197 | // Source: /lib/overview-table.php |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | <h1><?php echo get_admin_page_title(); ?></h1> |
214 | 214 | <br class="clear"> |
215 | 215 | <?php if (isset($_GET['scan'])) : ?> |
216 | - <?php do_action( 'cgss_scan' ); ?> |
|
216 | + <?php do_action('cgss_scan'); ?> |
|
217 | 217 | <?php elseif (isset($_GET['compete'])) : ?> |
218 | - <?php do_action( 'cgss_compete' ); ?> |
|
218 | + <?php do_action('cgss_compete'); ?> |
|
219 | 219 | <?php else : ?> |
220 | 220 | <form method="post" action=""> |
221 | 221 | <?php |
@@ -2,7 +2,9 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace NirjharLo\Cgss\Src; |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
6 | + exit; |
|
7 | +} |
|
6 | 8 | |
7 | 9 | use \NirjharLo\Cgss\Lib\Table; |
8 | 10 | use \NirjharLo\Cgss\Lib\OverviewTable; |
@@ -150,7 +152,10 @@ discard block |
||
150 | 152 | //Set screen option |
151 | 153 | public function set_screen($status, $option, $value) { |
152 | 154 | |
153 | - if ( 'post_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
155 | + if ( 'post_per_page' == $option ) { |
|
156 | + return $value; |
|
157 | + } |
|
158 | + // Related to PLUGIN_TABLE() |
|
154 | 159 | //return $status; |
155 | 160 | } |
156 | 161 | |
@@ -216,11 +221,13 @@ discard block |
||
216 | 221 | <?php do_action( 'cgss_scan' ); ?> |
217 | 222 | <?php elseif (isset($_GET['compete'])) : ?> |
218 | 223 | <?php do_action( 'cgss_compete' ); ?> |
219 | - <?php else : ?> |
|
224 | + <?php else { |
|
225 | + : ?> |
|
220 | 226 | <form method="post" action=""> |
221 | 227 | <?php |
222 | 228 | // Source: /lib/table.php |
223 | 229 | $this->table = new Table(); |
230 | +} |
|
224 | 231 | $this->table->prepare_items(); |
225 | 232 | $this->table->display(); |
226 | 233 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Src; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | /** |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | |
22 | 22 | public function execute() { |
23 | - add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) ); |
|
24 | - add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) ); |
|
25 | - add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 ); |
|
23 | + add_action('plugins_loaded', array($this, 'text_domain_cb')); |
|
24 | + add_action('admin_notices', array($this, 'php_ver_incompatible')); |
|
25 | + add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | //Load plugin cgss |
31 | 31 | public function text_domain_cb() { |
32 | 32 | |
33 | - load_plugin_cgss( $this->textDomin, false, CGSS_LN ); |
|
33 | + load_plugin_cgss($this->textDomin, false, CGSS_LN); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | //Define low php verson errors |
39 | 39 | public function php_ver_incompatible() { |
40 | 40 | |
41 | - if ( version_compare( phpversion(), $this->phpVerAllowed, '<' ) ) : |
|
42 | - $text = __( 'The Plugin can\'t be activated because your PHP version', 'InLinkMaster' ); |
|
43 | - $text_last = __( 'is less than required 5.3. See more information', 'InLinkMaster' ); |
|
41 | + if (version_compare(phpversion(), $this->phpVerAllowed, '<')) : |
|
42 | + $text = __('The Plugin can\'t be activated because your PHP version', 'InLinkMaster'); |
|
43 | + $text_last = __('is less than required 5.3. See more information', 'InLinkMaster'); |
|
44 | 44 | $text_link = 'php.net/eol.php'; ?> |
45 | 45 | |
46 | 46 | <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> |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | // Add settings link to plugin page |
53 | - public function menu_page_link( $links, $file ) { |
|
53 | + public function menu_page_link($links, $file) { |
|
54 | 54 | |
55 | 55 | if ($this->pluginPageLinks) { |
56 | 56 | static $this_plugin; |
57 | - if ( ! $this_plugin ) { |
|
57 | + if ( ! $this_plugin) { |
|
58 | 58 | $this_plugin = CGSS_FILE; |
59 | 59 | } |
60 | - if ( $file == $this_plugin ) { |
|
60 | + if ($file == $this_plugin) { |
|
61 | 61 | $shift_link = array(); |
62 | 62 | foreach ($this->pluginPageLinks as $value) { |
63 | - $shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>'; |
|
63 | + $shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>'; |
|
64 | 64 | } |
65 | - foreach( $shift_link as $val ) { |
|
66 | - array_unshift( $links, $val ); |
|
65 | + foreach ($shift_link as $val) { |
|
66 | + array_unshift($links, $val); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return $links; |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Src; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | /** |
@@ -44,13 +44,13 @@ |
||
44 | 44 | global $wpdb; |
45 | 45 | $wpdb->hide_errors(); |
46 | 46 | $collate = ""; |
47 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
47 | + if ( $wpdb->has_cap( 'collation' ) ) { |
|
48 | 48 | if( ! empty($wpdb->charset ) ) |
49 | 49 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
50 | 50 | if( ! empty($wpdb->collate ) ) |
51 | 51 | $collate .= " COLLATE $wpdb->collate"; |
52 | - } |
|
53 | - require_once( $this->up_path ); |
|
52 | + } |
|
53 | + require_once( $this->up_path ); |
|
54 | 54 | return $collate; |
55 | 55 | } |
56 | 56 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Src; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | global $wpdb; |
32 | 32 | $wpdb->hide_errors(); |
33 | 33 | $this->table_name = $wpdb->prefix . $this->table; |
34 | - update_option( '_plugin_db_exist', 0 ); |
|
35 | - if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name ) { |
|
36 | - $execute_sql = $this->execute( $this->table_name, $this->collate(), $this->sql ); |
|
37 | - dbDelta( $execute_sql ); |
|
34 | + update_option('_plugin_db_exist', 0); |
|
35 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { |
|
36 | + $execute_sql = $this->execute($this->table_name, $this->collate(), $this->sql); |
|
37 | + dbDelta($execute_sql); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | global $wpdb; |
47 | 47 | $wpdb->hide_errors(); |
48 | 48 | $collate = ""; |
49 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
50 | - if( ! empty($wpdb->charset ) ) |
|
49 | + if ($wpdb->has_cap('collation')) { |
|
50 | + if ( ! empty($wpdb->charset)) |
|
51 | 51 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
52 | - if( ! empty($wpdb->collate ) ) |
|
52 | + if ( ! empty($wpdb->collate)) |
|
53 | 53 | $collate .= " COLLATE $wpdb->collate"; |
54 | 54 | } |
55 | - require_once( $this->up_path ); |
|
55 | + require_once($this->up_path); |
|
56 | 56 | return $collate; |
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | 61 | //SQL query to create the main plugin table. |
62 | - public function execute( $table_name, $collate, $sql ) { |
|
62 | + public function execute($table_name, $collate, $sql) { |
|
63 | 63 | return "CREATE TABLE $table_name ( $sql ) $collate;"; |
64 | 64 | } |
65 | 65 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function __destruct() { |
70 | 70 | global $wpdb; |
71 | 71 | $this->table_name = $wpdb->prefix . $this->table; |
72 | - if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name ) { |
|
73 | - update_option( '_plugin_db_exist', 1 ); |
|
72 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name) { |
|
73 | + update_option('_plugin_db_exist', 1); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } ?> |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss\Src; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | /** |
@@ -47,10 +49,12 @@ discard block |
||
47 | 49 | $wpdb->hide_errors(); |
48 | 50 | $collate = ""; |
49 | 51 | if ( $wpdb->has_cap( 'collation' ) ) { |
50 | - if( ! empty($wpdb->charset ) ) |
|
51 | - $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
|
52 | - if( ! empty($wpdb->collate ) ) |
|
53 | - $collate .= " COLLATE $wpdb->collate"; |
|
52 | + if( ! empty($wpdb->charset ) ) { |
|
53 | + $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
|
54 | + } |
|
55 | + if( ! empty($wpdb->collate ) ) { |
|
56 | + $collate .= " COLLATE $wpdb->collate"; |
|
57 | + } |
|
54 | 58 | } |
55 | 59 | require_once( $this->up_path ); |
56 | 60 | return $collate; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | use \NirjharLo\Cgss\Lib\Script; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function instance() { |
33 | 33 | |
34 | - if ( is_null( self::$instance ) ) { |
|
34 | + if (is_null(self::$instance)) { |
|
35 | 35 | self::$instance = new self(); |
36 | 36 | self::$instance->init(); |
37 | 37 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $install->phpVerAllowed = '5.4'; |
47 | 47 | $install->pluginPageLinks = array( |
48 | 48 | array( |
49 | - 'slug' => home_url().'/wp-admin/admin.php?page=seo-scan', |
|
50 | - 'label' => __( 'Dashboard', 'cgss' ) |
|
49 | + 'slug' => home_url() . '/wp-admin/admin.php?page=seo-scan', |
|
50 | + 'label' => __('Dashboard', 'cgss') |
|
51 | 51 | ), |
52 | 52 | ); |
53 | 53 | $install->execute(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $tableName = 'cgss_insight'; |
74 | 74 | |
75 | 75 | global $wpdb; |
76 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$tableName" ); |
|
76 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$tableName"); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | global $wpdb; |
83 | 83 | |
84 | 84 | $result = $wpdb->get_results("SELECT * from {$wpdb->prefix}cgss_insight"); |
85 | - if(count($result) == 0) { |
|
85 | + if (count($result) == 0) { |
|
86 | 86 | |
87 | 87 | $init_insight = array( |
88 | - __('Score','cgss'), |
|
89 | - __('Snippet','cgss'), |
|
90 | - __('Text','cgss'), |
|
91 | - __('Links','cgss'), |
|
92 | - __('Keywords','cgss'), |
|
93 | - __('Images','cgss'), |
|
94 | - __('Responsive','cgss'), |
|
95 | - __('Speed','cgss'), |
|
96 | - __('Social','cgss') |
|
88 | + __('Score', 'cgss'), |
|
89 | + __('Snippet', 'cgss'), |
|
90 | + __('Text', 'cgss'), |
|
91 | + __('Links', 'cgss'), |
|
92 | + __('Keywords', 'cgss'), |
|
93 | + __('Images', 'cgss'), |
|
94 | + __('Responsive', 'cgss'), |
|
95 | + __('Speed', 'cgss'), |
|
96 | + __('Social', 'cgss') |
|
97 | 97 | ); |
98 | - $no_data = __( 'No scan reports are available yet', 'cgss' ); |
|
98 | + $no_data = __('No scan reports are available yet', 'cgss'); |
|
99 | 99 | foreach ($init_insight as $key => $value) { |
100 | 100 | $sql = $wpdb->prepare( |
101 | - "INSERT INTO {$wpdb->prefix}cgss_insight ( ID, item, remark ) VALUES ( %d, %s, %s )", ($key+1), $value, $no_data |
|
101 | + "INSERT INTO {$wpdb->prefix}cgss_insight ( ID, item, remark ) VALUES ( %d, %s, %s )", ($key + 1), $value, $no_data |
|
102 | 102 | ); |
103 | 103 | $query = $wpdb->query($sql); |
104 | 104 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | public function init() { |
141 | 141 | |
142 | - register_activation_hook( CGSS_FILE, array( $this, 'db_install' ) ); |
|
143 | - register_uninstall_hook( CGSS_FILE, array( 'BUILD', 'db_uninstall' ) ); //$this won't work here. |
|
142 | + register_activation_hook(CGSS_FILE, array($this, 'db_install')); |
|
143 | + register_uninstall_hook(CGSS_FILE, array('BUILD', 'db_uninstall')); //$this won't work here. |
|
144 | 144 | |
145 | 145 | add_action('init', array($this, 'installation')); |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->settings(); |
149 | 149 | |
150 | 150 | // Add custom actions, defined in settings |
151 | - add_action( 'cgss_scan', array( $this, 'scan' ) ); |
|
152 | - add_action( 'cgss_fetch_insight', array( $this, 'insight' ) ); |
|
151 | + add_action('cgss_scan', array($this, 'scan')); |
|
152 | + add_action('cgss_fetch_insight', array($this, 'insight')); |
|
153 | 153 | } |
154 | 154 | } ?> |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace NirjharLo\Cgss; |
3 | 3 | |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | |
7 | 9 | use \NirjharLo\Cgss\Lib\Script; |