@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | public function installation() { |
12 | 12 | |
13 | 13 | /** |
14 | - * |
|
15 | - * Plugin installation |
|
16 | - * |
|
14 | + * |
|
15 | + * Plugin installation |
|
16 | + * |
|
17 | 17 | if (class_exists('PLUGIN_INSTALL')) { |
18 | 18 | |
19 | 19 | $install = new PLUGIN_INSTALL(); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | $this->corn(); |
32 | - * |
|
33 | - */ |
|
32 | + * |
|
33 | + */ |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | public function db_install() { |
57 | 57 | |
58 | 58 | /** |
59 | - * |
|
60 | - * Install database by defining your SQL |
|
61 | - * |
|
59 | + * |
|
60 | + * Install database by defining your SQL |
|
61 | + * |
|
62 | 62 | if ( class_exists( 'PLUGIN_DB' ) ) { |
63 | 63 | $db = new PLUGIN_DB(); |
64 | 64 | $db->table = 'plugin_db_table_name'; |
@@ -67,28 +67,28 @@ discard block |
||
67 | 67 | UNIQUE KEY ID (ID)"; |
68 | 68 | $db->build(); |
69 | 69 | } |
70 | - * |
|
71 | - * |
|
72 | - * Optionally check if the DB table is installed correctly |
|
73 | - * |
|
70 | + * |
|
71 | + * |
|
72 | + * Optionally check if the DB table is installed correctly |
|
73 | + * |
|
74 | 74 | if (get_option('_plugin_db_exist') == '0') { |
75 | 75 | add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
76 | 76 | } |
77 | - * |
|
78 | - */ |
|
77 | + * |
|
78 | + */ |
|
79 | 79 | |
80 | 80 | /** |
81 | - * |
|
82 | - * Install DB options |
|
83 | - * |
|
81 | + * |
|
82 | + * Install DB options |
|
83 | + * |
|
84 | 84 | $options = array( |
85 | 85 | array( 'option_name', '__value__' ), |
86 | 86 | ); |
87 | 87 | foreach ($options as $value) { |
88 | 88 | update_option( $value[0], $value[1] ); |
89 | 89 | } |
90 | - * |
|
91 | - */ |
|
90 | + * |
|
91 | + */ |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | public function db_uninstall() { |
108 | 108 | |
109 | 109 | /** |
110 | - * |
|
111 | - * Important table name declarition |
|
112 | - * |
|
110 | + * |
|
111 | + * Important table name declarition |
|
112 | + * |
|
113 | 113 | $tableName = 'plugin_db_table_name'; |
114 | 114 | |
115 | 115 | global $wpdb; |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | foreach ($options as $value) { |
121 | 121 | delete_option($value); |
122 | 122 | } |
123 | - * |
|
124 | - */ |
|
123 | + * |
|
124 | + */ |
|
125 | 125 | } |
126 | 126 | |
127 | 127 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | //Main plugin object to define the plugin |
5 | -if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
|
5 | +if ( ! class_exists('PLUGIN_BUILD')) { |
|
6 | 6 | |
7 | 7 | final class PLUGIN_BUILD { |
8 | 8 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | //Custom corn class, register it while activation |
39 | 39 | public function corn() { |
40 | 40 | |
41 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
41 | + if (class_exists('PLUGIN_CRON')) { |
|
42 | 42 | $cron = new PLUGIN_CRON(); |
43 | 43 | $schedule = $cron->schedule_task( |
44 | 44 | array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function db_error_msg() { ?> |
98 | 98 | |
99 | 99 | <div class="notice notice-error is-dismissible"> |
100 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
100 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
101 | 101 | </div> |
102 | 102 | <?php |
103 | 103 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | //Include scripts |
130 | 130 | public function scripts() { |
131 | 131 | |
132 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
132 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | //Include settings pages |
138 | 138 | public function settings() { |
139 | 139 | |
140 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
140 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | //Include widget classes |
145 | 145 | public function widgets() { |
146 | 146 | |
147 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
147 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | //Include metabox classes |
153 | 153 | public function metabox() { |
154 | 154 | |
155 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
155 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | //Include shortcode classes |
161 | 161 | public function shortcode() { |
162 | 162 | |
163 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
163 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $this->helpers(); |
203 | 203 | $this->functionality(); |
204 | 204 | |
205 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
205 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
206 | 206 | |
207 | 207 | //remove the DB upon uninstallation |
208 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); //$this won't work here. |
|
208 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); //$this won't work here. |
|
209 | 209 | |
210 | 210 | add_action('init', array($this, 'installation')); |
211 | 211 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
3 | 5 | |
4 | 6 | //Main plugin object to define the plugin |
5 | 7 | if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
@@ -129,7 +131,9 @@ discard block |
||
129 | 131 | //Include scripts |
130 | 132 | public function scripts() { |
131 | 133 | |
132 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
134 | + if ( class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
135 | + new PLUGIN_SCRIPT(); |
|
136 | + } |
|
133 | 137 | } |
134 | 138 | |
135 | 139 | |
@@ -137,14 +141,18 @@ discard block |
||
137 | 141 | //Include settings pages |
138 | 142 | public function settings() { |
139 | 143 | |
140 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
144 | + if ( class_exists( 'PLUGIN_SETTINGS' ) ) { |
|
145 | + new PLUGIN_SETTINGS(); |
|
146 | + } |
|
141 | 147 | } |
142 | 148 | |
143 | 149 | |
144 | 150 | //Include widget classes |
145 | 151 | public function widgets() { |
146 | 152 | |
147 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
153 | + if ( class_exists( 'PLUGIN_WIDGET' ) ) { |
|
154 | + new PLUGIN_WIDGET(); |
|
155 | + } |
|
148 | 156 | } |
149 | 157 | |
150 | 158 | |
@@ -152,7 +160,9 @@ discard block |
||
152 | 160 | //Include metabox classes |
153 | 161 | public function metabox() { |
154 | 162 | |
155 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
163 | + if ( class_exists( 'PLUGIN_METABOX' ) ) { |
|
164 | + new PLUGIN_METABOX(); |
|
165 | + } |
|
156 | 166 | } |
157 | 167 | |
158 | 168 | |
@@ -160,7 +170,9 @@ discard block |
||
160 | 170 | //Include shortcode classes |
161 | 171 | public function shortcode() { |
162 | 172 | |
163 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
173 | + if ( class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
174 | + new PLUGIN_SHORTCODE(); |
|
175 | + } |
|
164 | 176 | } |
165 | 177 | |
166 | 178 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Implimentation of WordPress inbuilt functions for plugin activation. |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_INSTALL' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_INSTALL')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_INSTALL { |
10 | 10 | |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | public function execute() { |
28 | - add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) ); |
|
29 | - add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) ); |
|
30 | - add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 ); |
|
28 | + add_action('plugins_loaded', array($this, 'text_domain_cb')); |
|
29 | + add_action('admin_notices', array($this, 'php_ver_incompatible')); |
|
30 | + add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //Load plugin textdomain |
36 | 36 | public function text_domain_cb() { |
37 | 37 | |
38 | - load_plugin_textdomain( $this->textDomin, false, PLUGIN_LN ); |
|
38 | + load_plugin_textdomain($this->textDomin, false, PLUGIN_LN); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | //Define low php verson errors |
44 | 44 | public function php_ver_incompatible() { |
45 | 45 | |
46 | - if ( version_compare( phpversion(), $this->phpVerAllowed, '<' ) ) : |
|
47 | - $text = __( 'The Plugin can\'t be activated because your PHP version', 'textdomain' ); |
|
48 | - $text_last = __( 'is less than required '.$this->phpVerAllowed.'. See more information', 'textdomain' ); |
|
46 | + if (version_compare(phpversion(), $this->phpVerAllowed, '<')) : |
|
47 | + $text = __('The Plugin can\'t be activated because your PHP version', 'textdomain'); |
|
48 | + $text_last = __('is less than required ' . $this->phpVerAllowed . '. See more information', 'textdomain'); |
|
49 | 49 | $text_link = 'php.net/eol.php'; ?> |
50 | 50 | |
51 | 51 | <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $text . ' ' . phpversion() . ' ' . $text_last . ': '; ?><a href="http://php.net/eol.php/" target="_blank"><?php echo $text_link; ?></a></p></div> |
@@ -55,20 +55,20 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | // Add settings link to plugin page |
58 | - public function menu_page_link( $links, $file ) { |
|
58 | + public function menu_page_link($links, $file) { |
|
59 | 59 | |
60 | 60 | if ($this->pluginPageLinks) { |
61 | 61 | static $this_plugin; |
62 | - if ( ! $this_plugin ) { |
|
62 | + if ( ! $this_plugin) { |
|
63 | 63 | $this_plugin = PLUGIN_FILE; |
64 | 64 | } |
65 | - if ( $file == $this_plugin ) { |
|
65 | + if ($file == $this_plugin) { |
|
66 | 66 | $shift_link = array(); |
67 | 67 | foreach ($this->pluginPageLinks as $value) { |
68 | - $shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>'; |
|
68 | + $shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>'; |
|
69 | 69 | } |
70 | - foreach( $shift_link as $val ) { |
|
71 | - array_unshift( $links, $val ); |
|
70 | + foreach ($shift_link as $val) { |
|
71 | + array_unshift($links, $val); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | return $links; |
@@ -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( 'wp_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('wp_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 { |
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-error 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-error 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 | } |