@@ -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,46 +73,46 @@ 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 | - 'compete' => sprintf( '<a href="?page='.$_GET['page'].'&compete='.$item['ID'].'" target="_blank">%s</a>', __( 'Compete', 'cgss' ) ), |
|
| 90 | - '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 | + 'compete' => sprintf('<a href="?page=' . $_GET['page'] . '&compete=' . $item['ID'] . '" target="_blank">%s</a>', __('Compete', 'cgss')), |
|
| 90 | + 'view' => sprintf('<a href="' . get_permalink($item['ID']) . '" target="_blank">%s</a>', __('View', 'cgss')) |
|
| 91 | 91 | ); |
| 92 | - return $title . $this->row_actions( $actions ); |
|
| 92 | + return $title . $this->row_actions($actions); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | //set coulmns name |
| 98 | - public function column_default( $item, $column_name ) { |
|
| 98 | + public function column_default($item, $column_name) { |
|
| 99 | 99 | |
| 100 | - switch ( $column_name ) { |
|
| 100 | + switch ($column_name) { |
|
| 101 | 101 | |
| 102 | 102 | case 'post_title': |
| 103 | 103 | //This is the first column |
| 104 | - return $this->column_name( $item ); |
|
| 104 | + return $this->column_name($item); |
|
| 105 | 105 | case 'focus': |
| 106 | 106 | case 'word': |
| 107 | 107 | case 'link': |
| 108 | 108 | case 'image': |
| 109 | 109 | case 'share': |
| 110 | - return $item[ $column_name ]; |
|
| 110 | + return $item[$column_name]; |
|
| 111 | 111 | case 'time': |
| 112 | - return $item[ $column_name ]; |
|
| 112 | + return $item[$column_name]; |
|
| 113 | 113 | default: |
| 114 | 114 | //Show the whole array for troubleshooting purposes |
| 115 | - return print_r( $item, true ); |
|
| 115 | + return print_r($item, true); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | public function get_columns() { |
| 123 | 123 | |
| 124 | 124 | $columns = array( |
| 125 | - 'post_title' => __( 'Post', 'cgss' ), |
|
| 126 | - 'focus' => __( 'Focus', 'cgss' ), |
|
| 127 | - 'word' => __( 'Words', 'cgss' ), |
|
| 128 | - 'link' => __( 'Links', 'cgss' ), |
|
| 129 | - 'image' => __( 'Images', 'cgss' ), |
|
| 130 | - 'share' => __( 'Shares', 'cgss' ), |
|
| 131 | - 'time' => __( 'Time(s)', 'cgss' ), |
|
| 125 | + 'post_title' => __('Post', 'cgss'), |
|
| 126 | + 'focus' => __('Focus', 'cgss'), |
|
| 127 | + 'word' => __('Words', 'cgss'), |
|
| 128 | + 'link' => __('Links', 'cgss'), |
|
| 129 | + 'image' => __('Images', 'cgss'), |
|
| 130 | + 'share' => __('Shares', 'cgss'), |
|
| 131 | + 'time' => __('Time(s)', 'cgss'), |
|
| 132 | 132 | |
| 133 | 133 | ); |
| 134 | 134 | return $columns; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function get_sortable_columns() { |
| 141 | 141 | |
| 142 | 142 | $sortable_columns = array( |
| 143 | - 'post_title' => array( 'post_title', true ), |
|
| 143 | + 'post_title' => array('post_title', true), |
|
| 144 | 144 | ); |
| 145 | 145 | return $sortable_columns; |
| 146 | 146 | } |
@@ -153,15 +153,15 @@ discard block |
||
| 153 | 153 | $this->_column_headers = $this->get_column_info(); |
| 154 | 154 | |
| 155 | 155 | /** Process bulk action */ |
| 156 | - $per_page = $this->get_items_per_page( 'post_per_page', 5 ); |
|
| 156 | + $per_page = $this->get_items_per_page('post_per_page', 5); |
|
| 157 | 157 | $current_page = $this->get_pagenum(); |
| 158 | 158 | $total_items = self::record_count(); |
| 159 | - $this->set_pagination_args( array( |
|
| 159 | + $this->set_pagination_args(array( |
|
| 160 | 160 | 'total_items' => $total_items, |
| 161 | 161 | 'per_page' => $per_page, |
| 162 | - ) ); |
|
| 162 | + )); |
|
| 163 | 163 | |
| 164 | - $this->items = self::get_posts( $per_page, $current_page ); |
|
| 164 | + $this->items = self::get_posts($per_page, $current_page); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | 'text' => array( |
| 176 | 176 | 'count' => '--', |
| 177 | 177 | 'top_key' => '--', |
| 178 | - 'links' => array( 'count' => '--' ), |
|
| 178 | + 'links' => array('count' => '--'), |
|
| 179 | 179 | ), |
| 180 | 180 | 'design' => array( |
| 181 | - 'image' => array( 'count' => '--' ) |
|
| 181 | + 'image' => array('count' => '--') |
|
| 182 | 182 | ), |
| 183 | 183 | 'social' => '--', |
| 184 | - 'speed' => array( 'down_time' => '--' ), |
|
| 184 | + 'speed' => array('down_time' => '--'), |
|
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | 187 | $metas = array(); |
| 188 | 188 | foreach ($IDs as $post_id) { |
| 189 | - $meta = get_post_meta( $post_id, 'cgss_scan_result', true ); |
|
| 189 | + $meta = get_post_meta($post_id, 'cgss_scan_result', true); |
|
| 190 | 190 | $metas[] = is_array($meta) ? $meta : $empty_metas; |
| 191 | 191 | } |
| 192 | 192 | $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 | * 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); |
| 48 | - $avarage_score = round(array_sum($score)/count($score), 0); |
|
| 48 | + $avarage_score = round(array_sum($score) / count($score), 0); |
|
| 49 | 49 | |
| 50 | - $this->score = sprintf(__('Avarage SEO score is %d', 'cgss'),$avarage_score); |
|
| 50 | + $this->score = sprintf(__('Avarage SEO score is %d', 'cgss'), $avarage_score); |
|
| 51 | 51 | $this->snippet = $this->snippet_analyze(); |
| 52 | 52 | $this->text = $this->text_analyze(); |
| 53 | 53 | $this->links = $this->link_analyze(); |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | $count = round(array_sum(array_column($links, 'count')) / $this->count, 0); |
| 69 | 69 | $external = round(array_sum(array_column($links, 'external')) / $this->count, 0); |
| 70 | 70 | $nofollow = round(array_sum(array_column($links, 'external')) / $this->count, 0); |
| 71 | - $external_percentage = round(($external/$count)*100, 0); |
|
| 72 | - $nofollow_percentage = round(($nofollow/$count)*100, 0); |
|
| 71 | + $external_percentage = round(($external / $count) * 100, 0); |
|
| 72 | + $nofollow_percentage = round(($nofollow / $count) * 100, 0); |
|
| 73 | 73 | |
| 74 | - $output = sprintf(__('Avarage', 'cgss') . ' '. _n( '%d link','%d links', $count, 'cgss' ) . ' ' . __('are found per page and %d percent are external and %d percent are nofollow among them.', 'cgss'),$count,$external_percentage,$nofollow_percentage); |
|
| 74 | + $output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d link', '%d links', $count, 'cgss') . ' ' . __('are found per page and %d percent are external and %d percent are nofollow among them.', 'cgss'), $count, $external_percentage, $nofollow_percentage); |
|
| 75 | 75 | return $output; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $key_count = round(array_sum($key_collect) / $this->count, 1); |
| 95 | 95 | $percent = round(array_sum($percent_collect) / $this->count, 1); |
| 96 | 96 | |
| 97 | - $output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n( '%d word','%d words',$key_count, 'cgss' ) . ' ' . __('long with keywords frequency of %d percent','cgss'),$key_count,$percent); |
|
| 97 | + $output = sprintf(__('Avarage foucs keyword is', 'cgss') . ' ' . _n('%d word', '%d words', $key_count, 'cgss') . ' ' . __('long with keywords frequency of %d percent', 'cgss'), $key_count, $percent); |
|
| 98 | 98 | |
| 99 | 99 | return $output; |
| 100 | 100 | } |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | $image_count = array_sum(array_column($images, 'count')); |
| 110 | 110 | $no_alt_image = array_sum(array_column($images, 'no_alt_count')); |
| 111 | 111 | |
| 112 | - $avg_image = round(($image_count/$this->count), 0); |
|
| 112 | + $avg_image = round(($image_count / $this->count), 0); |
|
| 113 | 113 | |
| 114 | - $output = sprintf(__('Avarage', 'cgss') . ' ' . _n( '%d image', '%d images', $avg_image, 'cgss' ) . ' ' . __( 'are found per page and', 'cgss'),$avg_image) . ' '; |
|
| 114 | + $output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d image', '%d images', $avg_image, 'cgss') . ' ' . __('are found per page and', 'cgss'), $avg_image) . ' '; |
|
| 115 | 115 | if ($no_alt_image == 0) { |
| 116 | 116 | $output .= __('all of them are optimized', 'cgss'); |
| 117 | 117 | } else { |
| 118 | - $no_alt_percent = round(($no_alt_image/$image_count)*100, 0); |
|
| 119 | - $output .= sprintf(__('%d percent among them doesn\'t have alt tag', 'cgss'),$no_alt_percent); |
|
| 118 | + $no_alt_percent = round(($no_alt_image / $image_count) * 100, 0); |
|
| 119 | + $output .= sprintf(__('%d percent among them doesn\'t have alt tag', 'cgss'), $no_alt_percent); |
|
| 120 | 120 | } |
| 121 | 121 | return $output; |
| 122 | 122 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | if ($vport == $this->count) { |
| 133 | 133 | $output = __('All pages are mobile optimized', 'cgss'); |
| 134 | 134 | } else { |
| 135 | - $no_mobile_percent = round(($vport/$this->count)*100, 0); |
|
| 136 | - $output = sprintf(__('%d percent pages aren\'t mobile optimized', 'cgss'),$no_mobile_percent); |
|
| 135 | + $no_mobile_percent = round(($vport / $this->count) * 100, 0); |
|
| 136 | + $output = sprintf(__('%d percent pages aren\'t mobile optimized', 'cgss'), $no_mobile_percent); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return $output; |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | $res_time = array_sum(array_column($speed, 'res_time')); |
| 148 | 148 | $down_time = array_sum(array_column($speed, 'down_time')); |
| 149 | 149 | |
| 150 | - $avg_res_time = round(($res_time/$this->count), 2); |
|
| 151 | - $avg_down_time = round(($down_time/$this->count), 2); |
|
| 150 | + $avg_res_time = round(($res_time / $this->count), 2); |
|
| 151 | + $avg_down_time = round(($down_time / $this->count), 2); |
|
| 152 | 152 | |
| 153 | - $output = sprintf( __('Average response time is %d s and average download time is %d s', 'cgss'), $avg_res_time, $avg_down_time); |
|
| 153 | + $output = sprintf(__('Average response time is %d s and average download time is %d s', 'cgss'), $avg_res_time, $avg_down_time); |
|
| 154 | 154 | |
| 155 | 155 | return $output; |
| 156 | 156 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $fb_share = array_sum(array_column($social, 'fb_share')); |
| 166 | 166 | $fb_like = array_sum(array_column($social, 'fb_like')); |
| 167 | 167 | |
| 168 | - $output = sprintf( __('Total', 'cgss' ). ' ' . _n( '%d share', '%d shares', $gplus, 'cgss' ) . ' ' . __( 'in g+ and', 'cgss' ). ' ' . _n( '%d share', '%d shares', $fb_share, 'cgss' ) . ' ' . __( 'in FB and', 'cgss' ). ' ' . _n( '%d FB like', '%d FB likes', $fb_like, 'cgss' ) . ' ' . __( 'are present', 'cgss'), $gplus, $fb_share, $fb_like); |
|
| 168 | + $output = sprintf(__('Total', 'cgss') . ' ' . _n('%d share', '%d shares', $gplus, 'cgss') . ' ' . __('in g+ and', 'cgss') . ' ' . _n('%d share', '%d shares', $fb_share, 'cgss') . ' ' . __('in FB and', 'cgss') . ' ' . _n('%d FB like', '%d FB likes', $fb_like, 'cgss') . ' ' . __('are present', 'cgss'), $gplus, $fb_share, $fb_like); |
|
| 169 | 169 | |
| 170 | 170 | return $output; |
| 171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $count = round(array_sum(array_column($text, 'count')) / $this->count, 0); |
| 179 | 179 | $ratio = round(array_sum(array_column($text, 'ratio')) / $this->count, 2); |
| 180 | 180 | |
| 181 | - $output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d word','%d words',$count,'cgss') . ' ' . __( 'are found per page and avarage text to HTML ratio is %d percent', 'cgss'),$count,$ratio); |
|
| 181 | + $output = sprintf(__('Avarage', 'cgss') . ' ' . _n('%d word', '%d words', $count, 'cgss') . ' ' . __('are found per page and avarage text to HTML ratio is %d percent', 'cgss'), $count, $ratio); |
|
| 182 | 182 | return $output; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | foreach ($snippets as $snippet) { |
| 192 | 192 | $title = $snippet['title']; |
| 193 | 193 | $desc = $snippet['desc']; |
| 194 | - if (!empty($title) && !empty($desc)) { |
|
| 194 | + if ( ! empty($title) && ! empty($desc)) { |
|
| 195 | 195 | $snip_count++; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | $snip_fraction = $this->count - $snip_count; |
| 199 | 199 | |
| 200 | - $output = ($snip_fraction > 0) ? __( 'All snippets are ok', 'cgss' ) : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __( 'have incomplete snippets', 'cgss' ); |
|
| 200 | + $output = ($snip_fraction > 0) ? __('All snippets are ok', 'cgss') : sprintf(_n('%d page', '%d pages', $snip_fraction, 'cgss'), $snip_fraction) . ' ' . __('have incomplete snippets', 'cgss'); |
|
| 201 | 201 | return $output; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | global $wpdb; |
| 209 | 209 | $sql = "SELECT ID FROM {$wpdb->prefix}posts WHERE post_type!='attachment'"; |
| 210 | - $ids = $wpdb->get_results( $sql, 'ARRAY_A' );; |
|
| 210 | + $ids = $wpdb->get_results($sql, 'ARRAY_A'); ; |
|
| 211 | 211 | |
| 212 | 212 | $data_piece = array(); |
| 213 | 213 | foreach ($ids as $id) { |
| 214 | 214 | |
| 215 | - $meta = get_post_meta( $id['ID'], 'cgss_scan_result', true ); |
|
| 215 | + $meta = get_post_meta($id['ID'], 'cgss_scan_result', true); |
|
| 216 | 216 | if ($meta) { |
| 217 | 217 | $data_piece[] = $meta; |
| 218 | 218 | } |
@@ -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( 'cgss_insight DB table is empty. Please reactivate the plugin.', 'cgss' ); |
|
| 46 | + _e('cgss_insight DB table 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 | } |
@@ -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->do(); |
@@ -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 compete() { |
| 109 | 109 | |
| 110 | - if ( class_exists( 'CGSS_COMPETE' ) ) new CGSS_COMPETE(); |
|
| 110 | + if (class_exists('CGSS_COMPETE')) new CGSS_COMPETE(); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // Add custom insight action |
| 116 | 116 | public function scan() { |
| 117 | 117 | |
| 118 | - if ( class_exists( 'CGSS_SCAN' ) ) new CGSS_SCAN(); |
|
| 118 | + if (class_exists('CGSS_SCAN')) new CGSS_SCAN(); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | //Call the dependency files |
| 149 | 149 | public function helpers() { |
| 150 | 150 | |
| 151 | - if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 152 | - require_once( ABSPATH . 'wp-admin/includes/screen.php' ); |
|
| 153 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 151 | + if ( ! class_exists('WP_List_Table')) { |
|
| 152 | + require_once(ABSPATH . 'wp-admin/includes/screen.php'); |
|
| 153 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | require_once ('lib/table.php'); |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | $this->helpers(); |
| 171 | 171 | $this->functionality(); |
| 172 | 172 | |
| 173 | - register_activation_hook( CGSS_FILE, array( $this, 'db_install' ) ); |
|
| 174 | - register_uninstall_hook( CGSS_FILE, array( 'CGSS_BUILD', 'db_uninstall' ) ); //$this won't work here. |
|
| 173 | + register_activation_hook(CGSS_FILE, array($this, 'db_install')); |
|
| 174 | + register_uninstall_hook(CGSS_FILE, array('CGSS_BUILD', 'db_uninstall')); //$this won't work here. |
|
| 175 | 175 | |
| 176 | 176 | add_action('init', array($this, 'installation')); |
| 177 | 177 | |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | $this->settings(); |
| 181 | 181 | |
| 182 | 182 | // Add custom actions, defined in settings |
| 183 | - add_action( 'cgss_scan', array( $this, 'scan' ) ); |
|
| 184 | - add_action( 'cgss_compete', array( $this, 'compete' ) ); |
|
| 185 | - add_action( 'cgss_fetch_insight', array( $this, 'insight' ) ); |
|
| 183 | + add_action('cgss_scan', array($this, 'scan')); |
|
| 184 | + add_action('cgss_compete', array($this, 'compete')); |
|
| 185 | + add_action('cgss_fetch_insight', array($this, 'insight')); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | } ?> |
| 189 | 189 | \ No newline at end of file |