@@ -15,7 +15,7 @@ discard block  | 
                                                    ||
| 15 | 15 | * @author Nirjhar Lo  | 
                                                        
| 16 | 16 | * @package wp-plugin-framework  | 
                                                        
| 17 | 17 | */  | 
                                                        
| 18 | -if ( ! class_exists( 'PLUGIN_API' ) ) { | 
                                                        |
| 18 | +if ( ! class_exists('PLUGIN_API')) { | 
                                                        |
| 19 | 19 | |
| 20 | 20 |  	class PLUGIN_API { | 
                                                        
| 21 | 21 | |
@@ -89,14 +89,14 @@ discard block  | 
                                                    ||
| 89 | 89 | |
| 90 | 90 | $curl = curl_init();  | 
                                                        
| 91 | 91 | |
| 92 | - curl_setopt_array( $curl, $this->build() );  | 
                                                        |
| 92 | + curl_setopt_array($curl, $this->build());  | 
                                                        |
| 93 | 93 | |
| 94 | - $result = curl_exec( $curl );  | 
                                                        |
| 95 | - $err = curl_error( $curl );  | 
                                                        |
| 94 | + $result = curl_exec($curl);  | 
                                                        |
| 95 | + $err = curl_error($curl);  | 
                                                        |
| 96 | 96 | |
| 97 | - curl_close( $curl );  | 
                                                        |
| 97 | + curl_close($curl);  | 
                                                        |
| 98 | 98 | |
| 99 | -			if ( $err ) { | 
                                                        |
| 99 | +			if ($err) { | 
                                                        |
| 100 | 100 | $result = "cURL Error #:" . $err;  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | |
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | */  | 
                                                        
| 112 | 112 |  		public function parse($data) { | 
                                                        
| 113 | 113 | |
| 114 | - call_user_func( array( $this, $this->data_type ), $data );  | 
                                                        |
| 114 | + call_user_func(array($this, $this->data_type), $data);  | 
                                                        |
| 115 | 115 | }  | 
                                                        
| 116 | 116 | |
| 117 | 117 | |
@@ -120,12 +120,12 @@ discard block  | 
                                                    ||
| 120 | 120 | *  | 
                                                        
| 121 | 121 | * @return Array  | 
                                                        
| 122 | 122 | */  | 
                                                        
| 123 | -		public function xml( $data ) { | 
                                                        |
| 123 | +		public function xml($data) { | 
                                                        |
| 124 | 124 | |
| 125 | - libxml_use_internal_errors( true );  | 
                                                        |
| 126 | - $parsed = ( ! $data || $data == '' ? false : simplexml_load_string( $data ) );  | 
                                                        |
| 125 | + libxml_use_internal_errors(true);  | 
                                                        |
| 126 | + $parsed = ( ! $data || $data == '' ? false : simplexml_load_string($data));  | 
                                                        |
| 127 | 127 | |
| 128 | -			if ( ! $parsed ) { | 
                                                        |
| 128 | +			if ( ! $parsed) { | 
                                                        |
| 129 | 129 | return false;  | 
                                                        
| 130 | 130 | libxml_clear_errors();  | 
                                                        
| 131 | 131 |  			} else { | 
                                                        
@@ -139,9 +139,9 @@ discard block  | 
                                                    ||
| 139 | 139 | *  | 
                                                        
| 140 | 140 | * @return Array  | 
                                                        
| 141 | 141 | */  | 
                                                        
| 142 | -		public function json( $data ) { | 
                                                        |
| 142 | +		public function json($data) { | 
                                                        |
| 143 | 143 | |
| 144 | - $parsed = ( ! $data || $data == '' ? false : json_decode( $data, 1 ) );  | 
                                                        |
| 144 | + $parsed = ( ! $data || $data == '' ? false : json_decode($data, 1));  | 
                                                        |
| 145 | 145 | return $parsed;  | 
                                                        
| 146 | 146 | }  | 
                                                        
| 147 | 147 | }  | 
                                                        
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 2 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 3 | 3 | |
| 4 | 4 | /**  | 
                                                        
| 5 | 5 | * Plugin upload for WordPress front end or backend  | 
                                                        
@@ -7,7 +7,7 @@ discard block  | 
                                                    ||
| 7 | 7 | * @author Nirjhar Lo  | 
                                                        
| 8 | 8 | * @package wp-plugin-framework  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if ( ! class_exists( 'PLUGIN_UPLOAD' ) ) { | 
                                                        |
| 10 | +if ( ! class_exists('PLUGIN_UPLOAD')) { | 
                                                        |
| 11 | 11 | |
| 12 | 12 |  	final class PLUGIN_UPLOAD { | 
                                                        
| 13 | 13 | |
@@ -19,7 +19,7 @@ discard block  | 
                                                    ||
| 19 | 19 | */  | 
                                                        
| 20 | 20 |  		public function __construct() { | 
                                                        
| 21 | 21 | |
| 22 | -			if ( isset($_POST['UploadSubmit']) ) { | 
                                                        |
| 22 | +			if (isset($_POST['UploadSubmit'])) { | 
                                                        |
| 23 | 23 | $this->upload_controller();  | 
                                                        
| 24 | 24 | }  | 
                                                        
| 25 | 25 | |
@@ -36,7 +36,7 @@ discard block  | 
                                                    ||
| 36 | 36 | |
| 37 | 37 | <form method="POST" action="" enctype="multipart/form-data">  | 
                                                        
| 38 | 38 | <input name="UploadFile" type="file" multiple="false"/>  | 
                                                        
| 39 | - <?php submit_button( __( 'Upload', 'stv' ), 'secondary', 'UploadSubmit' ); ?>  | 
                                                        |
| 39 | +				<?php submit_button(__('Upload', 'stv'), 'secondary', 'UploadSubmit'); ?> | 
                                                        |
| 40 | 40 | </form>  | 
                                                        
| 41 | 41 | <?php  | 
                                                        
| 42 | 42 | }  | 
                                                        
@@ -53,28 +53,28 @@ discard block  | 
                                                    ||
| 53 | 53 | $type = $file['type'];  | 
                                                        
| 54 | 54 | |
| 55 | 55 | // Check in your file type  | 
                                                        
| 56 | -			if( $type != 'application/_TYPE_' ) { | 
                                                        |
| 57 | - add_action( 'admin_notices', array( $this, 'file_type_error_admin_notice' ) );  | 
                                                        |
| 56 | +			if ($type != 'application/_TYPE_') { | 
                                                        |
| 57 | +				add_action('admin_notices', array($this, 'file_type_error_admin_notice')); | 
                                                        |
| 58 | 58 |  			} else { | 
                                                        
| 59 | 59 | |
| 60 | -				if (!function_exists('wp_handle_upload')){ | 
                                                        |
| 60 | +				if ( ! function_exists('wp_handle_upload')) { | 
                                                        |
| 61 | 61 | require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        
| 62 | 62 | require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        
| 63 | 63 | require_once(ABSPATH . 'wp-admin/includes/media.php');  | 
                                                        
| 64 | 64 | }  | 
                                                        
| 65 | 65 | |
| 66 | - $overrides = array( 'test_form' => false);  | 
                                                        |
| 66 | +				$overrides = array('test_form' => false); | 
                                                        |
| 67 | 67 | $attachment = wp_handle_upload($file, $overrides);  | 
                                                        
| 68 | 68 | |
| 69 | -				if( is_array( $attachment_id ) && array_key_exists( 'path', $attachment ) ) { | 
                                                        |
| 69 | +				if (is_array($attachment_id) && array_key_exists('path', $attachment)) { | 
                                                        |
| 70 | 70 | $upload_path = $attachment['path'];  | 
                                                        
| 71 | 71 | |
| 72 | - add_action( 'admin_notices', array( $this, 'success_notice' ) );  | 
                                                        |
| 72 | +					add_action('admin_notices', array($this, 'success_notice')); | 
                                                        |
| 73 | 73 | |
| 74 | 74 | // Use $upload_path for any purpose. For example storing temporarily  | 
                                                        
| 75 | 75 | // update_option( 'some_token', $upload_path );  | 
                                                        
| 76 | 76 |  				} else { | 
                                                        
| 77 | - add_action( 'admin_notices', array( $this, 'file_error_admin_notice' ) );  | 
                                                        |
| 77 | +					add_action('admin_notices', array($this, 'file_error_admin_notice')); | 
                                                        |
| 78 | 78 | $upload_path = false;  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | }  | 
                                                        
@@ -89,7 +89,7 @@ discard block  | 
                                                    ||
| 89 | 89 |  		public function file_type_error_admin_notice() { ?> | 
                                                        
| 90 | 90 | |
| 91 | 91 | <div class="notice notice-error is-dismissible">  | 
                                                        
| 92 | - <p><?php _e( 'Please Upload correct type of file only.', 'textdomain' ); ?></p>  | 
                                                        |
| 92 | +				<p><?php _e('Please Upload correct type of file only.', 'textdomain'); ?></p> | 
                                                        |
| 93 | 93 | </div>  | 
                                                        
| 94 | 94 | <?php  | 
                                                        
| 95 | 95 | }  | 
                                                        
@@ -103,7 +103,7 @@ discard block  | 
                                                    ||
| 103 | 103 |  		public function file_error_admin_notice() { ?> | 
                                                        
| 104 | 104 | |
| 105 | 105 | <div class="notice notice-error is-dismissible">  | 
                                                        
| 106 | - <p><?php _e( 'File Upload failed.', 'textdomain' ); ?></p>  | 
                                                        |
| 106 | +				<p><?php _e('File Upload failed.', 'textdomain'); ?></p> | 
                                                        |
| 107 | 107 | </div>  | 
                                                        
| 108 | 108 | <?php  | 
                                                        
| 109 | 109 | }  | 
                                                        
@@ -117,7 +117,7 @@ discard block  | 
                                                    ||
| 117 | 117 |  		public function success_notice() { ?> | 
                                                        
| 118 | 118 | |
| 119 | 119 | <div class="notice notice-success is-dismissible">  | 
                                                        
| 120 | - <p><?php _e( 'Successfully saved file details.', 'textdomain' ); ?></p>  | 
                                                        |
| 120 | +				<p><?php _e('Successfully saved file details.', 'textdomain'); ?></p> | 
                                                        |
| 121 | 121 | </div>  | 
                                                        
| 122 | 122 | <?php  | 
                                                        
| 123 | 123 | }  | 
                                                        
@@ -9,11 +9,11 @@ discard block  | 
                                                    ||
| 9 | 9 | * @author Nirjhar Lo  | 
                                                        
| 10 | 10 | * @package wp-plugin-framework  | 
                                                        
| 11 | 11 | */  | 
                                                        
| 12 | -if ( ! class_exists( 'PLUGIN_TABLE' ) ) { | 
                                                        |
| 12 | +if ( ! class_exists('PLUGIN_TABLE')) { | 
                                                        |
| 13 | 13 | |
| 14 | -	if ( ! class_exists( 'WP_List_Table' ) ) { | 
                                                        |
| 15 | - require_once( ABSPATH . 'wp-admin/includes/screen.php' );  | 
                                                        |
| 16 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );  | 
                                                        |
| 14 | +	if ( ! class_exists('WP_List_Table')) { | 
                                                        |
| 15 | + require_once(ABSPATH . 'wp-admin/includes/screen.php');  | 
                                                        |
| 16 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');  | 
                                                        |
| 17 | 17 | }  | 
                                                        
| 18 | 18 | |
| 19 | 19 |  	final class PLUGIN_TABLE extends WP_List_Table { | 
                                                        
@@ -26,11 +26,11 @@ discard block  | 
                                                    ||
| 26 | 26 | */  | 
                                                        
| 27 | 27 |  		public function __construct() { | 
                                                        
| 28 | 28 | |
| 29 | - parent::__construct( [  | 
                                                        |
| 30 | - 'singular' => __( 'Name', 'textdomain' ),  | 
                                                        |
| 31 | - 'plural' => __( 'Names', 'textdomain' ),  | 
                                                        |
| 29 | + parent::__construct([  | 
                                                        |
| 30 | +				'singular' => __('Name', 'textdomain'), | 
                                                        |
| 31 | +				'plural'   => __('Names', 'textdomain'), | 
                                                        |
| 32 | 32 | 'ajax' => false,  | 
                                                        
| 33 | - ] );  | 
                                                        |
| 33 | + ]);  | 
                                                        |
| 34 | 34 | }  | 
                                                        
| 35 | 35 | |
| 36 | 36 | |
@@ -39,27 +39,27 @@ discard block  | 
                                                    ||
| 39 | 39 | *  | 
                                                        
| 40 | 40 | * @return Array  | 
                                                        
| 41 | 41 | */  | 
                                                        
| 42 | -		public static function get_Table( $per_page = 5, $page_number = 1 ) { | 
                                                        |
| 42 | +		public static function get_Table($per_page = 5, $page_number = 1) { | 
                                                        |
| 43 | 43 | |
| 44 | 44 | global $wpdb;  | 
                                                        
| 45 | 45 | |
| 46 | 46 | //Take pivotal from URL  | 
                                                        
| 47 | - $link = ( isset( $_GET['link'] ) ? $_GET['link'] : 'link' );  | 
                                                        |
| 47 | + $link = (isset($_GET['link']) ? $_GET['link'] : 'link');  | 
                                                        |
| 48 | 48 | |
| 49 | 49 | //Build the db query base  | 
                                                        
| 50 | 50 |  			$sql = "SELECT * FROM {$wpdb->prefix}wordpress_table"; | 
                                                        
| 51 | 51 | $sql .= " QUERIES with $link'";  | 
                                                        
| 52 | 52 | |
| 53 | 53 | //Set filters in the query using $_REQUEST  | 
                                                        
| 54 | -			if ( ! empty( $_REQUEST['orderby'] ) ) { | 
                                                        |
| 55 | - $sql .= ' ORDER BY ' . esc_sql( $_REQUEST['orderby'] );  | 
                                                        |
| 56 | - $sql .= ! empty( $_REQUEST['order'] ) ? ' ' . esc_sql( $_REQUEST['order'] ) : ' ASC';  | 
                                                        |
| 54 | +			if ( ! empty($_REQUEST['orderby'])) { | 
                                                        |
| 55 | + $sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);  | 
                                                        |
| 56 | + $sql .= ! empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';  | 
                                                        |
| 57 | 57 | }  | 
                                                        
| 58 | 58 | $sql .= " LIMIT $per_page";  | 
                                                        
| 59 | - $sql .= ' OFFSET ' . ( $page_number - 1 ) * $per_page;  | 
                                                        |
| 59 | + $sql .= ' OFFSET ' . ($page_number - 1) * $per_page;  | 
                                                        |
| 60 | 60 | |
| 61 | 61 | //get the data from database  | 
                                                        
| 62 | - $result = $wpdb->get_results( $sql, 'ARRAY_A' );  | 
                                                        |
| 62 | + $result = $wpdb->get_results($sql, 'ARRAY_A');  | 
                                                        |
| 63 | 63 | |
| 64 | 64 | return $result;  | 
                                                        
| 65 | 65 | }  | 
                                                        
@@ -70,11 +70,11 @@ discard block  | 
                                                    ||
| 70 | 70 | *  | 
                                                        
| 71 | 71 | * @return Void  | 
                                                        
| 72 | 72 | */  | 
                                                        
| 73 | -		public static function delete_url( $id ) { | 
                                                        |
| 73 | +		public static function delete_url($id) { | 
                                                        |
| 74 | 74 | |
| 75 | 75 | global $wpdb;  | 
                                                        
| 76 | 76 | |
| 77 | -			$wpdb->delete( "{$wpdb->prefix}wordpress_table", array( 'ID' => $id ), array( '%s' ) ); | 
                                                        |
| 77 | +			$wpdb->delete("{$wpdb->prefix}wordpress_table", array('ID' => $id), array('%s')); | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | 79 | |
| 80 | 80 | |
@@ -85,7 +85,7 @@ discard block  | 
                                                    ||
| 85 | 85 | */  | 
                                                        
| 86 | 86 |  		public function no_items() { | 
                                                        
| 87 | 87 | |
| 88 | - _e( 'No Items Added yet.', 'textDomain' );  | 
                                                        |
| 88 | +			_e('No Items Added yet.', 'textDomain'); | 
                                                        |
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
| 91 | 91 | |
@@ -99,13 +99,13 @@ discard block  | 
                                                    ||
| 99 | 99 | global $wpdb;  | 
                                                        
| 100 | 100 | |
| 101 | 101 | //Take pivotal from URL  | 
                                                        
| 102 | - $link = ( isset( $_GET['link'] ) ? $_GET['link'] : 'link' );  | 
                                                        |
| 102 | + $link = (isset($_GET['link']) ? $_GET['link'] : 'link');  | 
                                                        |
| 103 | 103 | |
| 104 | 104 | //Build the db query base  | 
                                                        
| 105 | 105 |  			$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}wordpress_table"; | 
                                                        
| 106 | 106 | $sql .= " QUERIES with $link'";  | 
                                                        
| 107 | 107 | |
| 108 | - return $wpdb->get_var( $sql );  | 
                                                        |
| 108 | + return $wpdb->get_var($sql);  | 
                                                        |
| 109 | 109 | }  | 
                                                        
| 110 | 110 | |
| 111 | 111 | |
@@ -114,17 +114,17 @@ discard block  | 
                                                    ||
| 114 | 114 | *  | 
                                                        
| 115 | 115 | * @return Html  | 
                                                        
| 116 | 116 | */  | 
                                                        
| 117 | -		public function column_name( $item ) { | 
                                                        |
| 117 | +		public function column_name($item) { | 
                                                        |
| 118 | 118 | |
| 119 | - $delete_nonce = wp_create_nonce( 'delete_url' );  | 
                                                        |
| 120 | - $title = sprintf( '<strong>%s</strong>', $item['item_name'] );  | 
                                                        |
| 119 | +			$delete_nonce = wp_create_nonce('delete_url'); | 
                                                        |
| 120 | +			$title = sprintf('<strong>%s</strong>', $item['item_name']); | 
                                                        |
| 121 | 121 | |
| 122 | 122 | //Change the page instruction where you want to show it  | 
                                                        
| 123 | 123 | $actions = array(  | 
                                                        
| 124 | - 'delete' => sprintf( '<a href="?page=%s&action=%s&instruction=%s&_wpnonce=%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['ID'] ), $delete_nonce, __( 'Delete', 'textdomain' ) )  | 
                                                        |
| 124 | +					'delete' => sprintf('<a href="?page=%s&action=%s&instruction=%s&_wpnonce=%s">%s</a>', esc_attr($_REQUEST['page']), 'delete', absint($item['ID']), $delete_nonce, __('Delete', 'textdomain')) | 
                                                        |
| 125 | 125 | );  | 
                                                        
| 126 | 126 | |
| 127 | - return $title . $this->row_actions( $actions );  | 
                                                        |
| 127 | + return $title . $this->row_actions($actions);  | 
                                                        |
| 128 | 128 | }  | 
                                                        
| 129 | 129 | |
| 130 | 130 | |
@@ -133,22 +133,22 @@ discard block  | 
                                                    ||
| 133 | 133 | *  | 
                                                        
| 134 | 134 | * @return Html  | 
                                                        
| 135 | 135 | */  | 
                                                        
| 136 | -		public function column_default( $item, $column_name ) { | 
                                                        |
| 136 | +		public function column_default($item, $column_name) { | 
                                                        |
| 137 | 137 | |
| 138 | -			switch ( $column_name ) { | 
                                                        |
| 138 | +			switch ($column_name) { | 
                                                        |
| 139 | 139 | |
| 140 | 140 | case 'name':  | 
                                                        
| 141 | 141 | //This is the first column  | 
                                                        
| 142 | - return $this->column_name( $item );  | 
                                                        |
| 142 | + return $this->column_name($item);  | 
                                                        |
| 143 | 143 | case 'caseOne':  | 
                                                        
| 144 | 144 | case 'caseTwo':  | 
                                                        
| 145 | 145 | case 'caseThree':  | 
                                                        
| 146 | - return $item[ $column_name ];  | 
                                                        |
| 146 | + return $item[$column_name];  | 
                                                        |
| 147 | 147 | |
| 148 | 148 | default:  | 
                                                        
| 149 | 149 | |
| 150 | 150 | //Show the whole array for troubleshooting purposes  | 
                                                        
| 151 | - return print_r( $item, true );  | 
                                                        |
| 151 | + return print_r($item, true);  | 
                                                        |
| 152 | 152 | }  | 
                                                        
| 153 | 153 | }  | 
                                                        
| 154 | 154 | |
@@ -158,9 +158,9 @@ discard block  | 
                                                    ||
| 158 | 158 | *  | 
                                                        
| 159 | 159 | * @return Html  | 
                                                        
| 160 | 160 | */  | 
                                                        
| 161 | -		public function column_cb( $item ) { | 
                                                        |
| 161 | +		public function column_cb($item) { | 
                                                        |
| 162 | 162 | |
| 163 | - return sprintf( '<input type="checkbox" name="bulk-select[]" value="%s" />', $item['ID'] );  | 
                                                        |
| 163 | +			return sprintf('<input type="checkbox" name="bulk-select[]" value="%s" />', $item['ID']); | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | |
| 166 | 166 | |
@@ -173,10 +173,10 @@ discard block  | 
                                                    ||
| 173 | 173 | |
| 174 | 174 | $columns = array(  | 
                                                        
| 175 | 175 | 'cb' => '<input type="checkbox" />',  | 
                                                        
| 176 | - 'name' => __( 'Name', 'textdomain' ),  | 
                                                        |
| 177 | - 'caseOne' => __( 'Case One', 'textdomain' ),  | 
                                                        |
| 178 | - 'caseTwo' => __( 'Case Two', 'textdomain' ),  | 
                                                        |
| 179 | - 'caseThree' => __( 'Case Three', 'textdomain' ),  | 
                                                        |
| 176 | +							'name'	=> __('Name', 'textdomain'), | 
                                                        |
| 177 | +							'caseOne'	=> __('Case One', 'textdomain'), | 
                                                        |
| 178 | +							'caseTwo'	=> __('Case Two', 'textdomain'), | 
                                                        |
| 179 | +							'caseThree'	=> __('Case Three', 'textdomain'), | 
                                                        |
| 180 | 180 | );  | 
                                                        
| 181 | 181 | |
| 182 | 182 | return $columns;  | 
                                                        
@@ -191,9 +191,9 @@ discard block  | 
                                                    ||
| 191 | 191 |  		public function get_sortable_columns() { | 
                                                        
| 192 | 192 | |
| 193 | 193 | $sortable_columns = array(  | 
                                                        
| 194 | - 'name' => array( 'name', true ),  | 
                                                        |
| 195 | - 'caseOne' => array( 'caseOne', false ),  | 
                                                        |
| 196 | - 'caseTwo' => array( 'caseTwo', false ),  | 
                                                        |
| 194 | +				'name' => array('name', true), | 
                                                        |
| 195 | +				'caseOne' => array('caseOne', false), | 
                                                        |
| 196 | +				'caseTwo' => array('caseTwo', false), | 
                                                        |
| 197 | 197 | );  | 
                                                        
| 198 | 198 | |
| 199 | 199 | return $sortable_columns;  | 
                                                        
@@ -207,7 +207,7 @@ discard block  | 
                                                    ||
| 207 | 207 | */  | 
                                                        
| 208 | 208 |  		public function get_bulk_actions() { | 
                                                        
| 209 | 209 | |
| 210 | - $actions = array( 'bulk-delete' => 'Delete' );  | 
                                                        |
| 210 | +			$actions = array('bulk-delete' => 'Delete'); | 
                                                        |
| 211 | 211 | |
| 212 | 212 | return $actions;  | 
                                                        
| 213 | 213 | }  | 
                                                        
@@ -224,15 +224,15 @@ discard block  | 
                                                    ||
| 224 | 224 | |
| 225 | 225 | /** Process bulk action */  | 
                                                        
| 226 | 226 | $this->process_bulk_action();  | 
                                                        
| 227 | - $per_page = $this->get_items_per_page( 'option_name_per_page', 5 );  | 
                                                        |
| 227 | +			$per_page     = $this->get_items_per_page('option_name_per_page', 5); | 
                                                        |
| 228 | 228 | $current_page = $this->get_pagenum();  | 
                                                        
| 229 | 229 | $total_items = self::record_count();  | 
                                                        
| 230 | - $this->set_pagination_args( array(  | 
                                                        |
| 230 | + $this->set_pagination_args(array(  | 
                                                        |
| 231 | 231 | 'total_items' => $total_items,  | 
                                                        
| 232 | 232 | 'per_page' => $per_page,  | 
                                                        
| 233 | - ) );  | 
                                                        |
| 233 | + ));  | 
                                                        |
| 234 | 234 | |
| 235 | - $this->items = self::get_Table( $per_page, $current_page );  | 
                                                        |
| 235 | + $this->items = self::get_Table($per_page, $current_page);  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | 237 | |
| 238 | 238 | |
@@ -244,24 +244,24 @@ discard block  | 
                                                    ||
| 244 | 244 |  		public function process_bulk_action() { | 
                                                        
| 245 | 245 | |
| 246 | 246 | //Detect when a bulk action is being triggered...  | 
                                                        
| 247 | -			if ( 'delete' === $this->current_action() ) { | 
                                                        |
| 247 | +			if ('delete' === $this->current_action()) { | 
                                                        |
| 248 | 248 | |
| 249 | 249 | //In our file that handles the request, verify the nonce.  | 
                                                        
| 250 | - $nonce = esc_attr( $_REQUEST['_wpnonce'] );  | 
                                                        |
| 250 | + $nonce = esc_attr($_REQUEST['_wpnonce']);  | 
                                                        |
| 251 | 251 | |
| 252 | -				if ( ! wp_verify_nonce( $nonce, 'delete_url' ) ) { | 
                                                        |
| 253 | - die( 'Go get a live script kiddies' );  | 
                                                        |
| 252 | +				if ( ! wp_verify_nonce($nonce, 'delete_url')) { | 
                                                        |
| 253 | +					die('Go get a live script kiddies'); | 
                                                        |
| 254 | 254 |  				} else { | 
                                                        
| 255 | - self::delete_url( absint( $_GET['instruction'] ) ); //Remember the instruction param from column_name method  | 
                                                        |
| 255 | + self::delete_url(absint($_GET['instruction'])); //Remember the instruction param from column_name method  | 
                                                        |
| 256 | 256 | }  | 
                                                        
| 257 | 257 | }  | 
                                                        
| 258 | 258 | |
| 259 | 259 | //If the delete bulk action is triggered  | 
                                                        
| 260 | -			if ( isset( $_POST['action'] ) ) { | 
                                                        |
| 261 | -				if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'bulk-delete' ) ) { | 
                                                        |
| 262 | - $delete_ids = esc_sql( $_POST['bulk-select'] );  | 
                                                        |
| 263 | -					foreach ( $delete_ids as $id ) { | 
                                                        |
| 264 | - self::delete_url( $id );  | 
                                                        |
| 260 | +			if (isset($_POST['action'])) { | 
                                                        |
| 261 | +				if ((isset($_POST['action']) && $_POST['action'] == 'bulk-delete')) { | 
                                                        |
| 262 | + $delete_ids = esc_sql($_POST['bulk-select']);  | 
                                                        |
| 263 | +					foreach ($delete_ids as $id) { | 
                                                        |
| 264 | + self::delete_url($id);  | 
                                                        |
| 265 | 265 | }  | 
                                                        
| 266 | 266 | }  | 
                                                        
| 267 | 267 | }  | 
                                                        
@@ -6,10 +6,10 @@ discard block  | 
                                                    ||
| 6 | 6 | * @author Nirjhar Lo  | 
                                                        
| 7 | 7 | * @package wp-plugin-framework  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 9 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 10 | 10 | |
| 11 | 11 | //AJAX helper class  | 
                                                        
| 12 | -if ( ! class_exists( 'PLUGIN_AJAX' ) ) { | 
                                                        |
| 12 | +if ( ! class_exists('PLUGIN_AJAX')) { | 
                                                        |
| 13 | 13 | |
| 14 | 14 |  	final class PLUGIN_AJAX { | 
                                                        
| 15 | 15 | |
@@ -21,9 +21,9 @@ discard block  | 
                                                    ||
| 21 | 21 | */  | 
                                                        
| 22 | 22 |  		public function __construct() { | 
                                                        
| 23 | 23 | |
| 24 | - add_action( 'wp_footer', array( $this, 'custom_name_js' ) );  | 
                                                        |
| 25 | - add_action( 'wp_ajax_custom_name', array( $this, 'custom_name' ) );  | 
                                                        |
| 26 | - add_action( 'wp_ajax_nopriv_custom_name', array( $this, 'custom_name' ) );  | 
                                                        |
| 24 | +			add_action('wp_footer', array($this, 'custom_name_js')); | 
                                                        |
| 25 | +			add_action('wp_ajax_custom_name', array($this, 'custom_name')); | 
                                                        |
| 26 | +			add_action('wp_ajax_nopriv_custom_name', array($this, 'custom_name')); | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | 29 | |
@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 |  		public function form() { ?> | 
                                                        
| 36 | 36 | |
| 37 | 37 | <form id="add_by_ajax" method="POST" action="">  | 
                                                        
| 38 | - <input type="text" name="text_name" placeholder="<?php _e( 'Text', 'textdomain' ); ?>">  | 
                                                        |
| 38 | +				<input type="text" name="text_name" placeholder="<?php _e('Text', 'textdomain'); ?>"> | 
                                                        |
| 39 | 39 | <input id="ajax_submit" type="submit" name="submit" value="Submit">  | 
                                                        
| 40 | 40 | </form>  | 
                                                        
| 41 | 41 | <?php  | 
                                                        
@@ -88,8 +88,8 @@ discard block  | 
                                                    ||
| 88 | 88 | |
| 89 | 89 | // DO some stuff  | 
                                                        
| 90 | 90 | |
| 91 | - $response = array( 'val' => $value );  | 
                                                        |
| 92 | - echo json_encode( $response );  | 
                                                        |
| 91 | +			$response = array('val' => $value); | 
                                                        |
| 92 | + echo json_encode($response);  | 
                                                        |
| 93 | 93 | wp_die();  | 
                                                        
| 94 | 94 | }  | 
                                                        
| 95 | 95 | }  | 
                                                        
@@ -6,7 +6,9 @@  | 
                                                    ||
| 6 | 6 | * @author Nirjhar Lo  | 
                                                        
| 7 | 7 | * @package wp-plugin-framework  | 
                                                        
| 8 | 8 | */  | 
                                                        
| 9 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 10 | + exit;  | 
                                                        |
| 11 | +}  | 
                                                        |
| 10 | 12 | |
| 11 | 13 | //AJAX helper class  | 
                                                        
| 12 | 14 |  if ( ! class_exists( 'PLUGIN_AJAX' ) ) { | 
                                                        
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 2 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 3 | 3 | |
| 4 | 4 | /**  | 
                                                        
| 5 | 5 | * Add Cron schedules and cron task callback  | 
                                                        
@@ -7,7 +7,7 @@ discard block  | 
                                                    ||
| 7 | 7 | * @author Nirjhar Lo  | 
                                                        
| 8 | 8 | * @package wp-plugin-framework  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if ( ! class_exists( 'PLUGIN_CRON' ) ) { | 
                                                        |
| 10 | +if ( ! class_exists('PLUGIN_CRON')) { | 
                                                        |
| 11 | 11 | |
| 12 | 12 |  	final class PLUGIN_CRON { | 
                                                        
| 13 | 13 | |
@@ -20,7 +20,7 @@ discard block  | 
                                                    ||
| 20 | 20 |  		public function __construct() { | 
                                                        
| 21 | 21 | |
| 22 | 22 | //Add cron schedules  | 
                                                        
| 23 | -			add_filter('cron_schedules', array( $this, 'cron_schedules' ) ); | 
                                                        |
| 23 | +			add_filter('cron_schedules', array($this, 'cron_schedules')); | 
                                                        |
| 24 | 24 | }  | 
                                                        
| 25 | 25 | |
| 26 | 26 | |
@@ -29,7 +29,7 @@ discard block  | 
                                                    ||
| 29 | 29 | *  | 
                                                        
| 30 | 30 | * @return Void  | 
                                                        
| 31 | 31 | */  | 
                                                        
| 32 | -		public function cron_schedules( $schedules ) { | 
                                                        |
| 32 | +		public function cron_schedules($schedules) { | 
                                                        |
| 33 | 33 | |
| 34 | 34 | $prefix = 'prefix_'; // Avoid conflict with other crons. Example Reference: cron_30_mins  | 
                                                        
| 35 | 35 | |
@@ -50,13 +50,13 @@ discard block  | 
                                                    ||
| 50 | 50 | );  | 
                                                        
| 51 | 51 | |
| 52 | 52 | /* Add each custom schedule into the cron job system. */  | 
                                                        
| 53 | -			foreach($schedule_options as $schedule_key => $schedule){ | 
                                                        |
| 53 | +			foreach ($schedule_options as $schedule_key => $schedule) { | 
                                                        |
| 54 | 54 | |
| 55 | -				if(!isset($schedules[$prefix.$schedule_key])) { | 
                                                        |
| 55 | +				if ( ! isset($schedules[$prefix . $schedule_key])) { | 
                                                        |
| 56 | 56 | |
| 57 | - $schedules[$prefix.$schedule_key] = array(  | 
                                                        |
| 57 | + $schedules[$prefix . $schedule_key] = array(  | 
                                                        |
| 58 | 58 | 'interval' => $schedule['interval'],  | 
                                                        
| 59 | - 'display' => __( 'Every '.$schedule['display'] )  | 
                                                        |
| 59 | +									'display' => __('Every ' . $schedule['display']) | 
                                                        |
| 60 | 60 | );  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | }  | 
                                                        
@@ -72,7 +72,7 @@ discard block  | 
                                                    ||
| 72 | 72 | */  | 
                                                        
| 73 | 73 |  		public function schedule_task($task) { | 
                                                        
| 74 | 74 | |
| 75 | -			if( ! $task ) { | 
                                                        |
| 75 | +			if ( ! $task) { | 
                                                        |
| 76 | 76 | return false;  | 
                                                        
| 77 | 77 | }  | 
                                                        
| 78 | 78 | |
@@ -82,17 +82,17 @@ discard block  | 
                                                    ||
| 82 | 82 | 'hook'  | 
                                                        
| 83 | 83 | );  | 
                                                        
| 84 | 84 | $missing_keys = array();  | 
                                                        
| 85 | -			foreach( $required_keys as $key ){ | 
                                                        |
| 86 | -				if( ! array_key_exists( $key, $task ) ) { | 
                                                        |
| 85 | +			foreach ($required_keys as $key) { | 
                                                        |
| 86 | +				if ( ! array_key_exists($key, $task)) { | 
                                                        |
| 87 | 87 | $missing_keys[] = $key;  | 
                                                        
| 88 | 88 | }  | 
                                                        
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
| 91 | -			if( ! empty( $missing_keys ) ){ | 
                                                        |
| 91 | +			if ( ! empty($missing_keys)) { | 
                                                        |
| 92 | 92 | return false;  | 
                                                        
| 93 | 93 | }  | 
                                                        
| 94 | 94 | |
| 95 | -			if( wp_next_scheduled( $task['hook'] ) ){ | 
                                                        |
| 95 | +			if (wp_next_scheduled($task['hook'])) { | 
                                                        |
| 96 | 96 | wp_clear_scheduled_hook($task['hook']);  | 
                                                        
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
@@ -5,9 +5,9 @@ discard block  | 
                                                    ||
| 5 | 5 | * @author Nirjhar Lo  | 
                                                        
| 6 | 6 | * @package wp-plugin-framework  | 
                                                        
| 7 | 7 | */  | 
                                                        
| 8 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 8 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 9 | 9 | |
| 10 | -if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) { | 
                                                        |
| 10 | +if ( ! class_exists('PLUGIN_SCRIPT')) { | 
                                                        |
| 11 | 11 | |
| 12 | 12 |  	final class PLUGIN_SCRIPT { | 
                                                        
| 13 | 13 | |
@@ -19,9 +19,9 @@ discard block  | 
                                                    ||
| 19 | 19 | */  | 
                                                        
| 20 | 20 |  		public function __construct() { | 
                                                        
| 21 | 21 | |
| 22 | - add_action( 'admin_head', array( $this, 'data_table_css' ) );  | 
                                                        |
| 23 | - add_action( 'admin_enqueue_scripts', array( $this, 'backend_scripts' ) );  | 
                                                        |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );  | 
                                                        |
| 22 | +			add_action('admin_head', array($this, 'data_table_css')); | 
                                                        |
| 23 | +			add_action('admin_enqueue_scripts', array($this, 'backend_scripts')); | 
                                                        |
| 24 | +			add_action('wp_enqueue_scripts', array($this, 'frontend_scripts')); | 
                                                        |
| 25 | 25 | }  | 
                                                        
| 26 | 26 | |
| 27 | 27 | |
@@ -53,10 +53,10 @@ discard block  | 
                                                    ||
| 53 | 53 | // Set condition to add script  | 
                                                        
| 54 | 54 | // if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'pageName' ) return;  | 
                                                        
| 55 | 55 | |
| 56 | - wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() );  | 
                                                        |
| 57 | -			wp_localize_script( 'jsName', 'ajax', array( 'ajax_url' => admin_url('admin-ajax.php') ) ); | 
                                                        |
| 56 | +			wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array()); | 
                                                        |
| 57 | +			wp_localize_script('jsName', 'ajax', array('ajax_url' => admin_url('admin-ajax.php'))); | 
                                                        |
| 58 | 58 | |
| 59 | - wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' );  | 
                                                        |
| 59 | +			wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css'); | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
| 62 | 62 | |
@@ -67,10 +67,10 @@ discard block  | 
                                                    ||
| 67 | 67 | */  | 
                                                        
| 68 | 68 |  		public function frontend_scripts() { | 
                                                        
| 69 | 69 | |
| 70 | - wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() );  | 
                                                        |
| 71 | -			wp_localize_script( 'jsName', 'ajax', array( 'ajax_url' => admin_url('admin-ajax.php') ) ); | 
                                                        |
| 70 | +			wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array()); | 
                                                        |
| 71 | +			wp_localize_script('jsName', 'ajax', array('ajax_url' => admin_url('admin-ajax.php'))); | 
                                                        |
| 72 | 72 | |
| 73 | - wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' );  | 
                                                        |
| 73 | +			wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css'); | 
                                                        |
| 74 | 74 | }  | 
                                                        
| 75 | 75 | }  | 
                                                        
| 76 | 76 | } ?>  | 
                                                        
@@ -5,7 +5,9 @@  | 
                                                    ||
| 5 | 5 | * @author Nirjhar Lo  | 
                                                        
| 6 | 6 | * @package wp-plugin-framework  | 
                                                        
| 7 | 7 | */  | 
                                                        
| 8 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 9 | + exit;  | 
                                                        |
| 10 | +}  | 
                                                        |
| 9 | 11 | |
| 10 | 12 |  if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) { | 
                                                        
| 11 | 13 | |
@@ -1,5 +1,5 @@ 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  | 
                                                        
@@ -7,7 +7,7 @@ discard block  | 
                                                    ||
| 7 | 7 | * @author Nirjhar Lo  | 
                                                        
| 8 | 8 | * @package wp-plugin-framework  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if ( ! class_exists( 'PLUGIN_SETTINGS' ) ) { | 
                                                        |
| 10 | +if ( ! class_exists('PLUGIN_SETTINGS')) { | 
                                                        |
| 11 | 11 | |
| 12 | 12 |  	class PLUGIN_SETTINGS { | 
                                                        
| 13 | 13 | |
@@ -56,14 +56,14 @@ discard block  | 
                                                    ||
| 56 | 56 |  		public function __construct() { | 
                                                        
| 57 | 57 | |
| 58 | 58 | $this->capability = 'manage_options';  | 
                                                        
| 59 | - $this->menu_page = array( 'name' => '', 'heading' => '', 'slug' => '' );  | 
                                                        |
| 59 | +			$this->menu_page = array('name' => '', 'heading' => '', 'slug' => ''); | 
                                                        |
| 60 | 60 | $this->sub_menu_page = array(  | 
                                                        
| 61 | 61 | 'name' => '',  | 
                                                        
| 62 | 62 | 'heading' => '',  | 
                                                        
| 63 | 63 | 'slug' => '',  | 
                                                        
| 64 | 64 | 'parent_slug' => '',  | 
                                                        
| 65 | - 'help' => '',//true/false,  | 
                                                        |
| 66 | - 'screen' => '',//true/false  | 
                                                        |
| 65 | + 'help' => '', //true/false,  | 
                                                        |
| 66 | + 'screen' => '', //true/false  | 
                                                        |
| 67 | 67 | );  | 
                                                        
| 68 | 68 | $this->helpData = array(  | 
                                                        
| 69 | 69 | array(  | 
                                                        
@@ -72,11 +72,11 @@ discard block  | 
                                                    ||
| 72 | 72 | 'info' => array(  | 
                                                        
| 73 | 73 | array(  | 
                                                        
| 74 | 74 | 'id' => 'helpId',  | 
                                                        
| 75 | - 'title' => __( 'Title', 'textdomain' ),  | 
                                                        |
| 76 | - 'content' => __( 'Description', 'textdomain' ),  | 
                                                        |
| 75 | +															'title' => __('Title', 'textdomain'), | 
                                                        |
| 76 | +															'content' => __('Description', 'textdomain'), | 
                                                        |
| 77 | 77 | ),  | 
                                                        
| 78 | 78 | ),  | 
                                                        
| 79 | - 'link' => '<p><a href="#">' . __( 'helpLink', 'textdomain' ) . '</a></p>',  | 
                                                        |
| 79 | +											'link' => '<p><a href="#">' . __('helpLink', 'textdomain') . '</a></p>', | 
                                                        |
| 80 | 80 | )  | 
                                                        
| 81 | 81 | )  | 
                                                        
| 82 | 82 | );  | 
                                                        
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | $this->menu_page['heading'],  | 
                                                        
| 108 | 108 | $this->capability,  | 
                                                        
| 109 | 109 | $this->menu_page['slug'],  | 
                                                        
| 110 | - array( $this, 'menu_page_callback' )  | 
                                                        |
| 110 | + array($this, 'menu_page_callback')  | 
                                                        |
| 111 | 111 | );  | 
                                                        
| 112 | 112 | }  | 
                                                        
| 113 | 113 | }  | 
                                                        
@@ -120,8 +120,8 @@ discard block  | 
                                                    ||
| 120 | 120 | */  | 
                                                        
| 121 | 121 |  		public function sub_menu_page() { | 
                                                        
| 122 | 122 | |
| 123 | -			if ( $this->sub_menu_page ) { | 
                                                        |
| 124 | -				foreach ( $this->sub_menu_page as $page ) { | 
                                                        |
| 123 | +			if ($this->sub_menu_page) { | 
                                                        |
| 124 | +				foreach ($this->sub_menu_page as $page) { | 
                                                        |
| 125 | 125 | $hook = add_submenu_page(  | 
                                                        
| 126 | 126 | $page['parent_slug'],  | 
                                                        
| 127 | 127 | $page['name'],  | 
                                                        
@@ -130,13 +130,13 @@ discard block  | 
                                                    ||
| 130 | 130 | // For the first submenu page, slug should be same as menupage.  | 
                                                        
| 131 | 131 | $page['slug'],  | 
                                                        
| 132 | 132 | // For the first submenu page, callback should be same as menupage.  | 
                                                        
| 133 | - array( $this, 'menu_page_callback' )  | 
                                                        |
| 133 | + array($this, 'menu_page_callback')  | 
                                                        |
| 134 | 134 | );  | 
                                                        
| 135 | -					if ( $page['help'] ) { | 
                                                        |
| 136 | - add_action( 'load-' . $hook, array( $this, 'help_tabs' ) );  | 
                                                        |
| 135 | +					if ($page['help']) { | 
                                                        |
| 136 | +						add_action('load-' . $hook, array($this, 'help_tabs')); | 
                                                        |
| 137 | 137 | }  | 
                                                        
| 138 | -					if ( $page['screen'] ) { | 
                                                        |
| 139 | - add_action( 'load-' . $hook, array( $this, 'screen_option' ) );  | 
                                                        |
| 138 | +					if ($page['screen']) { | 
                                                        |
| 139 | +						add_action('load-' . $hook, array($this, 'screen_option')); | 
                                                        |
| 140 | 140 | }  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | }  | 
                                                        
@@ -163,7 +163,7 @@ discard block  | 
                                                    ||
| 163 | 163 | break;  | 
                                                        
| 164 | 164 | }  | 
                                                        
| 165 | 165 | |
| 166 | - if ( $output ) return $output; // Related to PLUGIN_TABLE()  | 
                                                        |
| 166 | + if ($output) return $output; // Related to PLUGIN_TABLE()  | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
| 169 | 169 | |
@@ -176,11 +176,11 @@ discard block  | 
                                                    ||
| 176 | 176 | |
| 177 | 177 | $option = 'per_page';  | 
                                                        
| 178 | 178 | $args = array(  | 
                                                        
| 179 | - 'label' => __( 'Show per page', 'textdomain' ),  | 
                                                        |
| 179 | +						'label'   => __('Show per page', 'textdomain'), | 
                                                        |
| 180 | 180 | 'default' => 10,  | 
                                                        
| 181 | 181 | 'option' => 'option_name_per_page' // Related to PLUGIN_TABLE()  | 
                                                        
| 182 | 182 | );  | 
                                                        
| 183 | - add_screen_option( $option, $args );  | 
                                                        |
| 183 | + add_screen_option($option, $args);  | 
                                                        |
| 184 | 184 | $this->table = new PLUGIN_TABLE(); // Source /lib/table.php  | 
                                                        
| 185 | 185 | }  | 
                                                        
| 186 | 186 | |
@@ -203,7 +203,7 @@ discard block  | 
                                                    ||
| 203 | 203 | <form method="post" action="">  | 
                                                        
| 204 | 204 |  						<?php settings_fields("settings_id"); | 
                                                        
| 205 | 205 |  						do_settings_sections("settings_name"); | 
                                                        
| 206 | - submit_button( __( 'Save', 'textdomain' ), 'primary', 'id' ); ?>  | 
                                                        |
| 206 | +						submit_button(__('Save', 'textdomain'), 'primary', 'id'); ?> | 
                                                        |
| 207 | 207 | </form>  | 
                                                        
| 208 | 208 | |
| 209 | 209 | <?php  | 
                                                        
@@ -231,10 +231,10 @@ discard block  | 
                                                    ||
| 231 | 231 |  			foreach ($this->helpData as $value) { | 
                                                        
| 232 | 232 |  				if ($_GET['page'] == $value['slug']) { | 
                                                        
| 233 | 233 | $this->screen = get_current_screen();  | 
                                                        
| 234 | -					foreach( $value['info'] as $key ) { | 
                                                        |
| 235 | - $this->screen->add_help_tab( $key );  | 
                                                        |
| 234 | +					foreach ($value['info'] as $key) { | 
                                                        |
| 235 | + $this->screen->add_help_tab($key);  | 
                                                        |
| 236 | 236 | }  | 
                                                        
| 237 | - $this->screen->set_help_sidebar( $value['link'] );  | 
                                                        |
| 237 | + $this->screen->set_help_sidebar($value['link']);  | 
                                                        |
| 238 | 238 | }  | 
                                                        
| 239 | 239 | }  | 
                                                        
| 240 | 240 | }  | 
                                                        
@@ -247,10 +247,10 @@ discard block  | 
                                                    ||
| 247 | 247 | */  | 
                                                        
| 248 | 248 |  		public function add_settings() { | 
                                                        
| 249 | 249 | |
| 250 | - add_settings_section( 'settings_id', __( 'Section Name', 'textdomain' ), array( $this,'section_cb' ), 'settings_name' );  | 
                                                        |
| 250 | +			add_settings_section('settings_id', __('Section Name', 'textdomain'), array($this, 'section_cb'), 'settings_name'); | 
                                                        |
| 251 | 251 | |
| 252 | - register_setting( 'settings_id', 'settings_field_name' );  | 
                                                        |
| 253 | - add_settings_field( 'settings_field_name', __( 'Field Name', 'textdomain' ), array( $this, 'settings_field_cb' ), 'settings_name', 'settings_id' );  | 
                                                        |
| 252 | +			register_setting('settings_id', 'settings_field_name'); | 
                                                        |
| 253 | +			add_settings_field('settings_field_name', __('Field Name', 'textdomain'), array($this, 'settings_field_cb'), 'settings_name', 'settings_id'); | 
                                                        |
| 254 | 254 | }  | 
                                                        
| 255 | 255 | |
| 256 | 256 | |
@@ -261,7 +261,7 @@ discard block  | 
                                                    ||
| 261 | 261 | */  | 
                                                        
| 262 | 262 |  		public function section_cb() { | 
                                                        
| 263 | 263 | |
| 264 | - echo '<p class="description">' . __( 'Set up settings', 'textdomain' ) . '</p>';  | 
                                                        |
| 264 | +			echo '<p class="description">' . __('Set up settings', 'textdomain') . '</p>'; | 
                                                        |
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
| 267 | 267 | |
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 2 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 3 | 3 | |
| 4 | 4 | /**  | 
                                                        
| 5 | 5 | * WP Query class for querying WP database  | 
                                                        
@@ -9,7 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 | * @author Nirjhar Lo  | 
                                                        
| 10 | 10 | * @package wp-plugin-framework  | 
                                                        
| 11 | 11 | */  | 
                                                        
| 12 | -if ( ! class_exists( 'PLUGIN_QUERY' ) ) { | 
                                                        |
| 12 | +if ( ! class_exists('PLUGIN_QUERY')) { | 
                                                        |
| 13 | 13 | |
| 14 | 14 |  	class PLUGIN_QUERY { | 
                                                        
| 15 | 15 | |
@@ -34,7 +34,7 @@ discard block  | 
                                                    ||
| 34 | 34 |  			$paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); | 
                                                        
| 35 | 35 | |
| 36 | 36 | $post_args = $this->post_args($paged);  | 
                                                        
| 37 | - $the_query = new WP_Query( $post_args );  | 
                                                        |
| 37 | + $the_query = new WP_Query($post_args);  | 
                                                        |
| 38 | 38 | |
| 39 | 39 | /**  | 
                                                        
| 40 | 40 | $user_args = $this->user_args($paged);  | 
                                                        
@@ -42,15 +42,15 @@ discard block  | 
                                                    ||
| 42 | 42 | */  | 
                                                        
| 43 | 43 | |
| 44 | 44 | // The Loop  | 
                                                        
| 45 | -			if ( $the_query->have_posts() ) { | 
                                                        |
| 46 | -				while ( $the_query->have_posts() ) { | 
                                                        |
| 45 | +			if ($the_query->have_posts()) { | 
                                                        |
| 46 | +				while ($the_query->have_posts()) { | 
                                                        |
| 47 | 47 | $the_query->the_post();  | 
                                                        
| 48 | 48 | // Do Stuff  | 
                                                        
| 49 | 49 | } // end while  | 
                                                        
| 50 | 50 | } // endif  | 
                                                        
| 51 | 51 | |
| 52 | -			if ( function_exists('wp_pagenavi' ) )  { | 
                                                        |
| 53 | - wp_pagenavi( array( 'query' => $the_query, 'echo' => true ) );//For user query add param 'type' => 'users'  | 
                                                        |
| 52 | +			if (function_exists('wp_pagenavi')) { | 
                                                        |
| 53 | +				wp_pagenavi(array('query' => $the_query, 'echo' => true)); //For user query add param 'type' => 'users' | 
                                                        |
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | // Reset Post Data  | 
                                                        
@@ -63,11 +63,11 @@ discard block  | 
                                                    ||
| 63 | 63 | *  | 
                                                        
| 64 | 64 | * @return Void  | 
                                                        
| 65 | 65 | */  | 
                                                        
| 66 | -		public function user_args( $paged ) { | 
                                                        |
| 66 | +		public function user_args($paged) { | 
                                                        |
| 67 | 67 | |
| 68 | - $offset = ( $paged - 1 ) * $this->display_count;  | 
                                                        |
| 68 | + $offset = ($paged - 1) * $this->display_count;  | 
                                                        |
| 69 | 69 | |
| 70 | - $args = array (  | 
                                                        |
| 70 | + $args = array(  | 
                                                        |
| 71 | 71 | 'role' => '', // user role  | 
                                                        
| 72 | 72 | 'order' => '', //ASC or DESC  | 
                                                        
| 73 | 73 | 'fields' => '', //  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | 'count_total' => true,  | 
                                                        
| 84 | 84 | 'paged' => $paged,  | 
                                                        
| 85 | 85 | 'offset' => $offset,  | 
                                                        
| 86 | - 'search' => '*' . esc_attr( $_GET['s'] ) . '*',  | 
                                                        |
| 86 | + 'search' => '*' . esc_attr($_GET['s']) . '*',  | 
                                                        |
| 87 | 87 | 'meta_query' => array( // It supports nested meta query  | 
                                                        
| 88 | 88 | 'relation' => 'AND', //or 'OR'  | 
                                                        
| 89 | 89 | array(  | 
                                                        
@@ -108,11 +108,11 @@ discard block  | 
                                                    ||
| 108 | 108 | *  | 
                                                        
| 109 | 109 | * @return Void  | 
                                                        
| 110 | 110 | */  | 
                                                        
| 111 | -		public function post_args( $paged ) { | 
                                                        |
| 111 | +		public function post_args($paged) { | 
                                                        |
| 112 | 112 | |
| 113 | - $offset = ( $paged - 1 ) * $this->display_count;  | 
                                                        |
| 113 | + $offset = ($paged - 1) * $this->display_count;  | 
                                                        |
| 114 | 114 | |
| 115 | - $args = array (  | 
                                                        |
| 115 | + $args = array(  | 
                                                        |
| 116 | 116 | 'post_type' => '', // array of type slugs  | 
                                                        
| 117 | 117 | 'order' => 'ASC',  | 
                                                        
| 118 | 118 | 'fields' => '', //  | 
                                                        
@@ -126,7 +126,7 @@ discard block  | 
                                                    ||
| 126 | 126 | 'count_total' => true,  | 
                                                        
| 127 | 127 | 'paged' => $paged,  | 
                                                        
| 128 | 128 | 'offset' => $offset,  | 
                                                        
| 129 | - 'search' => '*' . esc_attr( $_GET['s'] ) . '*',  | 
                                                        |
| 129 | + 'search' => '*' . esc_attr($_GET['s']) . '*',  | 
                                                        |
| 130 | 130 | 'meta_query' => array( // It supports nested meta query  | 
                                                        
| 131 | 131 | 'relation' => 'AND', //or 'OR'  | 
                                                        
| 132 | 132 | array(  | 
                                                        
@@ -1,5 +1,5 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit;  | 
                                                        |
| 2 | +if ( ! defined('ABSPATH')) exit; | 
                                                        |
| 3 | 3 | |
| 4 | 4 | /**  | 
                                                        
| 5 | 5 | * Widget class  | 
                                                        
@@ -7,7 +7,7 @@ discard block  | 
                                                    ||
| 7 | 7 | * @author Nirjhar Lo  | 
                                                        
| 8 | 8 | * @package wp-plugin-framework  | 
                                                        
| 9 | 9 | */  | 
                                                        
| 10 | -if ( ! class_exists( 'PLUGIN_WIDGET' ) ) { | 
                                                        |
| 10 | +if ( ! class_exists('PLUGIN_WIDGET')) { | 
                                                        |
| 11 | 11 | |
| 12 | 12 |  	final class PLUGIN_WIDGET extends WP_WIDGET { | 
                                                        
| 13 | 13 | |
@@ -21,9 +21,9 @@ discard block  | 
                                                    ||
| 21 | 21 | |
| 22 | 22 | $widget_ops = array(  | 
                                                        
| 23 | 23 | 'classname' => 'plugin_widget',  | 
                                                        
| 24 | - 'description' => __( 'Plugin widget', 'textdomain' ),  | 
                                                        |
| 24 | +							'description' => __('Plugin widget', 'textdomain'), | 
                                                        |
| 25 | 25 | );  | 
                                                        
| 26 | - parent::__construct( 'my_widget_id', __( 'Plugin widget', 'textdomain' ), $widget_ops );  | 
                                                        |
| 26 | +			parent::__construct('my_widget_id', __('Plugin widget', 'textdomain'), $widget_ops); | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | 29 | |
@@ -35,13 +35,13 @@ discard block  | 
                                                    ||
| 35 | 35 | *  | 
                                                        
| 36 | 36 | * @return Html  | 
                                                        
| 37 | 37 | */  | 
                                                        
| 38 | -		public function widget( $args, $instance ) { | 
                                                        |
| 38 | +		public function widget($args, $instance) { | 
                                                        |
| 39 | 39 | |
| 40 | 40 | echo $args['before_widget'];  | 
                                                        
| 41 | -			if ( ! empty( $instance['title'] ) ) { | 
                                                        |
| 42 | - echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];  | 
                                                        |
| 41 | +			if ( ! empty($instance['title'])) { | 
                                                        |
| 42 | +				echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | - echo esc_html__( 'Hello, World!', 'textdomain' );  | 
                                                        |
| 44 | +			echo esc_html__('Hello, World!', 'textdomain'); | 
                                                        |
| 45 | 45 | echo $args['after_widget'];  | 
                                                        
| 46 | 46 | }  | 
                                                        
| 47 | 47 | |
@@ -53,12 +53,12 @@ discard block  | 
                                                    ||
| 53 | 53 | *  | 
                                                        
| 54 | 54 | * @return Html  | 
                                                        
| 55 | 55 | */  | 
                                                        
| 56 | -		public function form( $instance ) { | 
                                                        |
| 56 | +		public function form($instance) { | 
                                                        |
| 57 | 57 | |
| 58 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Internal Link Master', 'textdomain' ); ?>  | 
                                                        |
| 58 | +			$title = ! empty($instance['title']) ? $instance['title'] : esc_html__('Internal Link Master', 'textdomain'); ?> | 
                                                        |
| 59 | 59 | <p>  | 
                                                        
| 60 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'textdomain' ); ?></label>  | 
                                                        |
| 61 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">  | 
                                                        |
| 60 | +				<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'textdomain'); ?></label> | 
                                                        |
| 61 | +				<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>"> | 
                                                        |
| 62 | 62 | </p>  | 
                                                        
| 63 | 63 | <?php  | 
                                                        
| 64 | 64 | }  | 
                                                        
@@ -72,10 +72,10 @@ discard block  | 
                                                    ||
| 72 | 72 | *  | 
                                                        
| 73 | 73 | * @return Array  | 
                                                        
| 74 | 74 | */  | 
                                                        
| 75 | -		public function update( $new_instance, $old_instance ) { | 
                                                        |
| 75 | +		public function update($new_instance, $old_instance) { | 
                                                        |
| 76 | 76 | |
| 77 | 77 | $instance = array();  | 
                                                        
| 78 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '' );  | 
                                                        |
| 78 | + $instance['title'] = ( ! empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '');  | 
                                                        |
| 79 | 79 | return $instance;  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | }  |