@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | * Doing AJAX the WordPress way. |
4 | 4 | * Use this class in admin or user side |
5 | 5 | */ |
6 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
6 | +if ( ! defined('ABSPATH')) exit; |
|
7 | 7 | |
8 | 8 | //AJAX helper class |
9 | -if ( ! class_exists( 'PLUGIN_AJAX' ) ) { |
|
9 | +if ( ! class_exists('PLUGIN_AJAX')) { |
|
10 | 10 | |
11 | 11 | final class PLUGIN_AJAX { |
12 | 12 | |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | public function __construct() { |
16 | 16 | |
17 | 17 | //Adding the AJAX |
18 | - add_action( 'admin_footer', array( $this, 'customName_js' ) ); |
|
19 | - add_action( 'wp_ajax_customName', array( $this, 'customName' ) ); |
|
20 | - add_action( 'wp_ajax_nopriv_customName', array( $this, 'customName' ) ); |
|
18 | + add_action('admin_footer', array($this, 'customName_js')); |
|
19 | + add_action('wp_ajax_customName', array($this, 'customName')); |
|
20 | + add_action('wp_ajax_nopriv_customName', array($this, 'customName')); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function form() { ?> |
27 | 27 | |
28 | 28 | <form id="addByAjax" method="POST" action=""> |
29 | - <input type="text" name="textName" placeholder="<?php _e( 'Text', 'textdomain' ); ?>"> |
|
29 | + <input type="text" name="textName" placeholder="<?php _e('Text', 'textdomain'); ?>"> |
|
30 | 30 | <input id="AjaxSubmit" type="submit" name="submit" value="Submit"> |
31 | 31 | </form> |
32 | 32 | <?php |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | // DO some stuff |
79 | 79 | |
80 | - $response = array( 'val' => $value ); |
|
81 | - echo json_encode( $response ); |
|
80 | + $response = array('val' => $value); |
|
81 | + echo json_encode($response); |
|
82 | 82 | wp_die(); |
83 | 83 | } |
84 | 84 | } |
@@ -1,12 +1,12 @@ 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 |
6 | 6 | * |
7 | 7 | * |
8 | 8 | */ |
9 | -if ( ! class_exists( 'PLUGIN_UPLOAD' ) ) { |
|
9 | +if ( ! class_exists('PLUGIN_UPLOAD')) { |
|
10 | 10 | |
11 | 11 | final class PLUGIN_UPLOAD extends WP_WIDGET { |
12 | 12 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // Add basic form |
16 | 16 | public function __construct() { |
17 | 17 | |
18 | - if ( isset($_POST['UploadSubmit']) ) { |
|
18 | + if (isset($_POST['UploadSubmit'])) { |
|
19 | 19 | $this->upload_controller(); |
20 | 20 | } |
21 | 21 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | <form method="POST" action="" enctype="multipart/form-data"> |
31 | 31 | <input name="UploadFile" type="file" multiple="false"/> |
32 | - <?php submit_button( __( 'Upload', 'stv' ), 'secondary', 'UploadSubmit' ); ?> |
|
32 | + <?php submit_button(__('Upload', 'stv'), 'secondary', 'UploadSubmit'); ?> |
|
33 | 33 | </form> |
34 | 34 | <?php |
35 | 35 | } |
@@ -43,28 +43,28 @@ discard block |
||
43 | 43 | $type = $file['type']; |
44 | 44 | |
45 | 45 | // Check in your file type |
46 | - if( $type != 'application/_TYPE_' ) { |
|
47 | - add_action( 'admin_notices', array( $this, 'file_type_error_admin_notice' ) ); |
|
46 | + if ($type != 'application/_TYPE_') { |
|
47 | + add_action('admin_notices', array($this, 'file_type_error_admin_notice')); |
|
48 | 48 | } else { |
49 | 49 | |
50 | - if (!function_exists('wp_handle_upload')){ |
|
50 | + if ( ! function_exists('wp_handle_upload')) { |
|
51 | 51 | require_once(ABSPATH . 'wp-admin/includes/image.php'); |
52 | 52 | require_once(ABSPATH . 'wp-admin/includes/file.php'); |
53 | 53 | require_once(ABSPATH . 'wp-admin/includes/media.php'); |
54 | 54 | } |
55 | 55 | |
56 | - $overrides = array( 'test_form' => false); |
|
56 | + $overrides = array('test_form' => false); |
|
57 | 57 | $attachment_id = wp_handle_upload($file, $overrides); |
58 | 58 | |
59 | - if( is_array( $attachment_id ) && array_key_exists( 'url', $attachment_id ) ) { |
|
59 | + if (is_array($attachment_id) && array_key_exists('url', $attachment_id)) { |
|
60 | 60 | $upload_id = $attachment_id['url']; |
61 | 61 | |
62 | - add_action( 'admin_notices', array( $this, 'success_notice' ) ); |
|
62 | + add_action('admin_notices', array($this, 'success_notice')); |
|
63 | 63 | |
64 | 64 | // Use $upload_id for any purpose. For example storing temporarily |
65 | 65 | //update_option('some_token', $upload_id); |
66 | 66 | } else { |
67 | - add_action( 'admin_notices', array( $this, 'file_error_admin_notice' ) ); |
|
67 | + add_action('admin_notices', array($this, 'file_error_admin_notice')); |
|
68 | 68 | $upload_id = false; |
69 | 69 | } |
70 | 70 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function file_type_error_admin_notice() { ?> |
76 | 76 | |
77 | 77 | <div class="notice notice-success is-dismissible"> |
78 | - <p><?php _e( 'Please Upload correct type of file only.', 'textdomain' ); ?></p> |
|
78 | + <p><?php _e('Please Upload correct type of file only.', 'textdomain'); ?></p> |
|
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function file_error_admin_notice() { ?> |
86 | 86 | |
87 | 87 | <div class="notice notice-success is-dismissible"> |
88 | - <p><?php _e( 'File Upload failed.', 'textdomain' ); ?></p> |
|
88 | + <p><?php _e('File Upload failed.', 'textdomain'); ?></p> |
|
89 | 89 | </div> |
90 | 90 | <?php |
91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function success_notice() { ?> |
96 | 96 | |
97 | 97 | <div class="notice notice-success is-dismissible"> |
98 | - <p><?php _e( 'Successfully saved file details.', 'textdomain' ); ?></p> |
|
98 | + <p><?php _e('Successfully saved file details.', 'textdomain'); ?></p> |
|
99 | 99 | </div> |
100 | 100 | <?php |
101 | 101 | } |
@@ -2,18 +2,18 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Add scripts to the plugin. CSS and JS. |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined('ABSPATH')) exit; |
|
6 | 6 | |
7 | -if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_SCRIPT')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_SCRIPT { |
10 | 10 | |
11 | 11 | |
12 | 12 | public function __construct() { |
13 | 13 | |
14 | - add_action( 'admin_head', array( $this, 'data_table_css' ) ); |
|
15 | - add_action( 'admin_enqueue_scripts', array( $this, 'backend_scripts' ) ); |
|
16 | - add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); |
|
14 | + add_action('admin_head', array($this, 'data_table_css')); |
|
15 | + add_action('admin_enqueue_scripts', array($this, 'backend_scripts')); |
|
16 | + add_action('wp_enqueue_scripts', array($this, 'frontend_scripts')); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | // Set condition to add script |
40 | 40 | // if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'pageName' ) return; |
41 | 41 | |
42 | - wp_enqueue_script( 'jsName', _PLUGIN_JS . 'ui.js', array() ); |
|
43 | - wp_enqueue_style( 'cssName', _PLUGIN_CSS . 'css.css' ); |
|
42 | + wp_enqueue_script('jsName', _PLUGIN_JS . 'ui.js', array()); |
|
43 | + wp_enqueue_style('cssName', _PLUGIN_CSS . 'css.css'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | // Enter scripts into pages |
49 | 49 | public function frontend_scripts() { |
50 | 50 | |
51 | - wp_enqueue_script( 'jsName', _PLUGIN_JS . 'ui.js', array() ); |
|
52 | - wp_enqueue_style( 'cssName', _PLUGIN_CSS . 'css.css' ); |
|
51 | + wp_enqueue_script('jsName', _PLUGIN_JS . 'ui.js', array()); |
|
52 | + wp_enqueue_style('cssName', _PLUGIN_CSS . 'css.css'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } ?> |
56 | 56 | \ No newline at end of file |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Add settings page with regarding options |
7 | 7 | * |
8 | 8 | */ |
9 | -if ( ! class_exists( 'PLUGIN_CRON' ) ) { |
|
9 | +if ( ! class_exists('PLUGIN_CRON')) { |
|
10 | 10 | |
11 | 11 | final class PLUGIN_CRON { |
12 | 12 | |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - add_filter('cron_schedules', array( $this, 'cron_schedules' ) ); |
|
15 | + add_filter('cron_schedules', array($this, 'cron_schedules')); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function cron_schedules( $schedules ) { |
|
18 | + public function cron_schedules($schedules) { |
|
19 | 19 | |
20 | 20 | $prefix = 'prefix_'; // Avoid conflict with other crons. Example Reference: cron_30_mins |
21 | 21 | // Example schedule options |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | ); |
36 | 36 | |
37 | 37 | /* Add each custom schedule into the cron job system. */ |
38 | - foreach($schedule_options as $schedule_key => $schedule){ |
|
38 | + foreach ($schedule_options as $schedule_key => $schedule) { |
|
39 | 39 | |
40 | - $schedules[$prefix.$schedule_key] = array( |
|
40 | + $schedules[$prefix . $schedule_key] = array( |
|
41 | 41 | 'interval' => $schedule['interval'], |
42 | - 'display' => __('Every '.$schedule['display']) |
|
42 | + 'display' => __('Every ' . $schedule['display']) |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function schedule_task($task) { |
50 | 50 | |
51 | - if( ! $task ) { |
|
51 | + if ( ! $task) { |
|
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | 'hook' |
59 | 59 | ); |
60 | 60 | $missing_keys = array(); |
61 | - foreach( $required_keys as $key ){ |
|
62 | - if( ! array_key_exists( $key, $task ) ) { |
|
61 | + foreach ($required_keys as $key) { |
|
62 | + if ( ! array_key_exists($key, $task)) { |
|
63 | 63 | $missing_keys[] = $key; |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if( ! empty( $missing_keys ) ){ |
|
67 | + if ( ! empty($missing_keys)) { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | |
71 | - if( wp_next_scheduled( $task['hook'] ) ){ |
|
71 | + if (wp_next_scheduled($task['hook'])) { |
|
72 | 72 | wp_clear_scheduled_hook($task['hook']); |
73 | 73 | } |
74 | 74 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * $data = $api->parse(); |
14 | 14 | * |
15 | 15 | */ |
16 | -if ( ! class_exists( 'PLUGIN_API' ) ) { |
|
16 | +if ( ! class_exists('PLUGIN_API')) { |
|
17 | 17 | |
18 | 18 | class PLUGIN_API { |
19 | 19 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $curl = curl_init(); |
50 | 50 | |
51 | - curl_setopt_array( $curl, $this->build() ); |
|
51 | + curl_setopt_array($curl, $this->build()); |
|
52 | 52 | |
53 | 53 | $result = curl_exec($curl); |
54 | 54 | $err = curl_error($curl); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | //Check options and tables and output the info to check if db install is successful |
68 | 68 | public function parse($data) { |
69 | 69 | |
70 | - call_user_func( array( $this, $this->data_type ), $data ); |
|
70 | + call_user_func(array($this, $this->data_type), $data); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | public function xml($data) { |
77 | 77 | |
78 | 78 | libxml_use_internal_errors(true); |
79 | - $parsed = ( ! $data || $data == '' ? false : simplexml_load_string( $data ) ); |
|
79 | + $parsed = ( ! $data || $data == '' ? false : simplexml_load_string($data)); |
|
80 | 80 | |
81 | - if ( ! $parsed ) { |
|
81 | + if ( ! $parsed) { |
|
82 | 82 | return false; |
83 | 83 | libxml_clear_errors(); |
84 | 84 | } else { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | //Parse JSON data type |
92 | 92 | public function json($data) { |
93 | 93 | |
94 | - $parsed = ( ! $data || $data == '' ? false : json_decode( $data, 1 ) ); |
|
94 | + $parsed = ( ! $data || $data == '' ? false : json_decode($data, 1)); |
|
95 | 95 | return $parsed; |
96 | 96 | } |
97 | 97 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * DB installation class |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_DB' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_DB')) { |
|
8 | 8 | |
9 | 9 | class PLUGIN_DB { |
10 | 10 | |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | global $wpdb; |
30 | 30 | $wpdb->hide_errors(); |
31 | 31 | $this->table_name = $wpdb->prefix . $this->table; |
32 | - update_option( '_plugin_db_exist', 0 ); |
|
33 | - if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name ) { |
|
34 | - $execute_sql = $this->execute( $this->table_name, $this->collate(), $this->sql ); |
|
35 | - dbDelta( $execute_sql ); |
|
32 | + update_option('_plugin_db_exist', 0); |
|
33 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { |
|
34 | + $execute_sql = $this->execute($this->table_name, $this->collate(), $this->sql); |
|
35 | + dbDelta($execute_sql); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -44,20 +44,20 @@ discard block |
||
44 | 44 | global $wpdb; |
45 | 45 | $wpdb->hide_errors(); |
46 | 46 | $collate = ""; |
47 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
48 | - if( ! empty($wpdb->charset ) ) |
|
47 | + if ($wpdb->has_cap('collation')) { |
|
48 | + if ( ! empty($wpdb->charset)) |
|
49 | 49 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
50 | - if( ! empty($wpdb->collate ) ) |
|
50 | + if ( ! empty($wpdb->collate)) |
|
51 | 51 | $collate .= " COLLATE $wpdb->collate"; |
52 | 52 | } |
53 | - require_once( $this->up_path ); |
|
53 | + require_once($this->up_path); |
|
54 | 54 | return $collate; |
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | 59 | //SQL query to create the main plugin table. |
60 | - public function execute( $table_name, $collate, $sql ) { |
|
60 | + public function execute($table_name, $collate, $sql) { |
|
61 | 61 | return "CREATE TABLE $table_name ( $sql ) $collate;"; |
62 | 62 | } |
63 | 63 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | public function __destruct() { |
68 | 68 | global $wpdb; |
69 | 69 | $this->table_name = $wpdb->prefix . $this->table; |
70 | - if ( $wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name ) { |
|
71 | - update_option( '_plugin_db_exist', 1 ); |
|
70 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name) { |
|
71 | + update_option('_plugin_db_exist', 1); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Shortcode class for rendering in front end |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_SHORTCODE')) { |
|
8 | 8 | |
9 | 9 | class PLUGIN_SHORTCODE { |
10 | 10 | |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - add_shortcode( 'shortcode_name', array( $this, 'cb' ) ); |
|
15 | + add_shortcode('shortcode_name', array($this, 'cb')); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | 20 | public function cb($atts) { |
21 | 21 | |
22 | - $data = shortcode_atts( array( |
|
22 | + $data = shortcode_atts(array( |
|
23 | 23 | 'type' => 'zip', |
24 | - ), $atts ); |
|
24 | + ), $atts); |
|
25 | 25 | |
26 | 26 | return $this->html(); |
27 | 27 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Backend settings page class, can have settings fields or data table |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_SETTINGS' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_SETTINGS')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_SETTINGS { |
10 | 10 | |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | public function __construct() { |
21 | 21 | |
22 | 22 | $this->capability = 'manage_options'; |
23 | - $this->menuPage = array( 'name' => '', 'heading' => '', 'slug' => '' ); |
|
23 | + $this->menuPage = array('name' => '', 'heading' => '', 'slug' => ''); |
|
24 | 24 | $this->subMenuPage = array( |
25 | 25 | 'name' => '', |
26 | 26 | 'heading' => '', |
27 | 27 | 'slug' => '', |
28 | 28 | 'parent_slug' => '', |
29 | - 'help' => '',//true/false, |
|
30 | - 'screen' => '',//true/false |
|
29 | + 'help' => '', //true/false, |
|
30 | + 'screen' => '', //true/false |
|
31 | 31 | ); |
32 | 32 | $this->helpData = array( |
33 | 33 | array( |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | 'info' => array( |
37 | 37 | array( |
38 | 38 | 'id' => 'helpId', |
39 | - 'title' => __( 'Title', 'textdomain' ), |
|
40 | - 'content' => __( 'Description', 'textdomain' ), |
|
39 | + 'title' => __('Title', 'textdomain'), |
|
40 | + 'content' => __('Description', 'textdomain'), |
|
41 | 41 | ), |
42 | 42 | ), |
43 | - 'link' => '<p><a href="#">' . __( 'helpLink', 'textdomain' ) . '</a></p>', |
|
43 | + 'link' => '<p><a href="#">' . __('helpLink', 'textdomain') . '</a></p>', |
|
44 | 44 | ) |
45 | 45 | ) |
46 | 46 | ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $this->menuPage['heading'], |
69 | 69 | $this->capability, |
70 | 70 | $this->menuPage['slug'], |
71 | - array( $this, 'menu_page_callback' ) |
|
71 | + array($this, 'menu_page_callback') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | } |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | // For the first submenu page, slug should be same as menupage. |
88 | 88 | $this->subMenuPage['slug'], |
89 | 89 | // For the first submenu page, callback should be same as menupage. |
90 | - array( $this, 'menu_page_callback' ) |
|
90 | + array($this, 'menu_page_callback') |
|
91 | 91 | ); |
92 | 92 | if ($this->subMenuPage['help']) { |
93 | - add_action( 'load-' . $hook, array( $this, 'help_tabs' ) ); |
|
93 | + add_action('load-' . $hook, array($this, 'help_tabs')); |
|
94 | 94 | } |
95 | 95 | if ($this->subMenuPage['screen']) { |
96 | - add_action( 'load-' . $hook, array( $this, 'screen_option' ) ); |
|
96 | + add_action('load-' . $hook, array($this, 'screen_option')); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | //Set screen option |
104 | 104 | public function set_screen($status, $option, $value) { |
105 | 105 | |
106 | - if ( 'option_name_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
106 | + if ('option_name_per_page' == $option) return $value; // Related to PLUGIN_TABLE() |
|
107 | 107 | //return $status; |
108 | 108 | } |
109 | 109 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | |
115 | 115 | $option = 'per_page'; |
116 | 116 | $args = array( |
117 | - 'label' => __( 'Show per page', '' ), |
|
117 | + 'label' => __('Show per page', ''), |
|
118 | 118 | 'default' => 10, |
119 | 119 | 'option' => 'option_name_per_page' // Related to PLUGIN_TABLE() |
120 | 120 | ); |
121 | - add_screen_option( $option, $args ); |
|
121 | + add_screen_option($option, $args); |
|
122 | 122 | $this->Table = new PLUGIN_TABLE(); |
123 | 123 | } |
124 | 124 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | <form method="post" action=""> |
139 | 139 | <?php settings_fields("addPdfsId"); |
140 | 140 | do_settings_sections("addPdfs"); |
141 | - submit_button( __( 'Save', 'textdomain' ), 'primary', 'id' ); ?> |
|
141 | + submit_button(__('Save', 'textdomain'), 'primary', 'id'); ?> |
|
142 | 142 | </form> |
143 | 143 | |
144 | 144 | <?php |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | foreach ($this->helpData as $value) { |
165 | 165 | if ($_GET['page'] == $value['slug']) { |
166 | 166 | $this->screen = get_current_screen(); |
167 | - foreach( $value['info'] as $key ) { |
|
168 | - $this->screen->add_help_tab( $key ); |
|
167 | + foreach ($value['info'] as $key) { |
|
168 | + $this->screen->add_help_tab($key); |
|
169 | 169 | } |
170 | - $this->screen->set_help_sidebar( $value['link'] ); |
|
170 | + $this->screen->set_help_sidebar($value['link']); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | //Add different types of settings and corrosponding sections |
178 | 178 | public function add_settings() { |
179 | 179 | |
180 | - add_settings_section( 'SettingsId', __( 'Section Name', 'textdomain' ), array( $this,'SectionCb' ), 'SettingsName' ); |
|
181 | - register_setting( 'SettingsId', 'SettingsField' ); |
|
182 | - add_settings_field( 'SettingsFieldName', __( 'Field Name', 'textdomain' ), array( $this, 'SettingsFieldCb' ), 'SettingsName', 'SettingsId' ); |
|
180 | + add_settings_section('SettingsId', __('Section Name', 'textdomain'), array($this, 'SectionCb'), 'SettingsName'); |
|
181 | + register_setting('SettingsId', 'SettingsField'); |
|
182 | + add_settings_field('SettingsFieldName', __('Field Name', 'textdomain'), array($this, 'SettingsFieldCb'), 'SettingsName', 'SettingsId'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | //Section description |
188 | 188 | public function SectionCb() { |
189 | 189 | |
190 | - echo '<p class="description">' . __( 'Set up settings', 'textdomain' ) . '</p>'; |
|
190 | + echo '<p class="description">' . __('Set up settings', 'textdomain') . '</p>'; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | //Field explanation |
196 | 196 | public function SettingsFieldCb() { |
197 | 197 | |
198 | - echo '<input type="text" class="medium-text" name="SettingsFieldName" id="SettingsFieldName" value="' . get_option('SettingsFieldName') . '" placeholder="' . __( 'Enter Value', 'textdomain' ) . '" required />'; |
|
198 | + echo '<input type="text" class="medium-text" name="SettingsFieldName" id="SettingsFieldName" value="' . get_option('SettingsFieldName') . '" placeholder="' . __('Enter Value', 'textdomain') . '" required />'; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } ?> |
202 | 202 | \ No newline at end of file |
@@ -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 | * Widget class |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_WIDGET' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_WIDGET')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_WIDGET extends WP_WIDGET { |
10 | 10 | |
@@ -15,33 +15,33 @@ discard block |
||
15 | 15 | |
16 | 16 | $widget_ops = array( |
17 | 17 | 'classname' => 'plugin_widget', |
18 | - 'description' => __( 'Plugin widget', 'textdomain' ), |
|
18 | + 'description' => __('Plugin widget', 'textdomain'), |
|
19 | 19 | ); |
20 | - parent::__construct( 'my_widget_id', __( 'Plugin widget', 'textdomain' ), $widget_ops ); |
|
20 | + parent::__construct('my_widget_id', __('Plugin widget', 'textdomain'), $widget_ops); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | 25 | //Outputs the content of the widget |
26 | - public function widget( $args, $instance ) { |
|
26 | + public function widget($args, $instance) { |
|
27 | 27 | |
28 | 28 | echo $args['before_widget']; |
29 | - if ( ! empty( $instance['title'] ) ) { |
|
30 | - echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; |
|
29 | + if ( ! empty($instance['title'])) { |
|
30 | + echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; |
|
31 | 31 | } |
32 | - echo esc_html__( 'Hello, World!', 'textdomain' ); |
|
32 | + echo esc_html__('Hello, World!', 'textdomain'); |
|
33 | 33 | echo $args['after_widget']; |
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | 38 | //Outputs the options form on admin |
39 | - public function form( $instance ) { |
|
39 | + public function form($instance) { |
|
40 | 40 | |
41 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Internal Link Master', 'textdomain' ); ?> |
|
41 | + $title = ! empty($instance['title']) ? $instance['title'] : esc_html__('Internal Link Master', 'textdomain'); ?> |
|
42 | 42 | <p> |
43 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'textdomain' ); ?></label> |
|
44 | - <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 ); ?>"> |
|
43 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'textdomain'); ?></label> |
|
44 | + <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); ?>"> |
|
45 | 45 | </p> |
46 | 46 | <?php |
47 | 47 | } |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | //Processing widget options on save |
52 | - public function update( $new_instance, $old_instance ) { |
|
52 | + public function update($new_instance, $old_instance) { |
|
53 | 53 | |
54 | 54 | $instance = array(); |
55 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; |
|
55 | + $instance['title'] = ( ! empty($new_instance['title'])) ? strip_tags($new_instance['title']) : ''; |
|
56 | 56 | return $instance; |
57 | 57 | } |
58 | 58 | } |