@@ -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 | * Main plugin object to define the plugin |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_BUILD')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_BUILD { |
10 | 10 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public static function instance() { |
67 | 67 | |
68 | - if ( is_null( self::$_instance ) ) { |
|
68 | + if (is_null(self::$_instance)) { |
|
69 | 69 | self::$_instance = new self(); |
70 | 70 | self::$_instance->init(); |
71 | 71 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function cron_activation() { |
101 | 101 | |
102 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
102 | + if (class_exists('PLUGIN_CRON')) { |
|
103 | 103 | |
104 | 104 | $cron = new PLUGIN_CRON(); |
105 | 105 | $schedule = $cron->schedule_task( |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function db_install() { |
124 | 124 | |
125 | - if ( class_exists( 'PLUGIN_DB' ) ) { |
|
125 | + if (class_exists('PLUGIN_DB')) { |
|
126 | 126 | |
127 | 127 | $db = new PLUGIN_DB(); |
128 | 128 | $db->table = self::$plugin_table; |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | $db->build(); |
133 | 133 | } |
134 | 134 | |
135 | - if (get_option( '_plugin_db_exist') == '0' ) { |
|
136 | - add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
|
135 | + if (get_option('_plugin_db_exist') == '0') { |
|
136 | + add_action('admin_notices', array($this, 'db_error_msg')); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $options = array( |
140 | - array( 'option_name', '__value__' ), |
|
140 | + array('option_name', '__value__'), |
|
141 | 141 | ); |
142 | - foreach ( $options as $value ) { |
|
143 | - update_option( $value[0], $value[1] ); |
|
142 | + foreach ($options as $value) { |
|
143 | + update_option($value[0], $value[1]); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function db_error_msg() { ?> |
154 | 154 | |
155 | 155 | <div class="notice notice-error is-dismissible"> |
156 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
156 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
157 | 157 | </div> |
158 | 158 | <?php |
159 | 159 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | $table_name = self::$plugin_table; |
170 | 170 | |
171 | 171 | global $wpdb; |
172 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" ); |
|
172 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name"); |
|
173 | 173 | |
174 | 174 | $options = array( |
175 | 175 | '_plugin_db_exist' |
176 | 176 | ); |
177 | - foreach ( $options as $value ) { |
|
178 | - delete_option( $value ); |
|
177 | + foreach ($options as $value) { |
|
178 | + delete_option($value); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function custom_cron_hook_cb() { |
200 | 200 | |
201 | - add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) ); |
|
201 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function cron_uninstall() { |
211 | 211 | |
212 | - wp_clear_scheduled_hook( 'custom_cron_hook' ); |
|
212 | + wp_clear_scheduled_hook('custom_cron_hook'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function scripts() { |
222 | 222 | |
223 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
223 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function settings() { |
233 | 233 | |
234 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
234 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function widgets() { |
244 | 244 | |
245 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
245 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function metabox() { |
255 | 255 | |
256 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
256 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function shortcode() { |
266 | 266 | |
267 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
267 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function functionality() { |
278 | 278 | |
279 | - require_once( 'src/install.php' ); |
|
280 | - require_once( 'src/db.php' ); |
|
281 | - require_once( 'src/query.php' ); |
|
282 | - require_once( 'src/settings.php' ); |
|
283 | - require_once( 'src/widget.php' ); |
|
284 | - require_once( 'src/metabox.php' ); |
|
285 | - require_once( 'src/shortcode.php' ); |
|
279 | + require_once('src/install.php'); |
|
280 | + require_once('src/db.php'); |
|
281 | + require_once('src/query.php'); |
|
282 | + require_once('src/settings.php'); |
|
283 | + require_once('src/widget.php'); |
|
284 | + require_once('src/metabox.php'); |
|
285 | + require_once('src/shortcode.php'); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function helpers() { |
296 | 296 | |
297 | - require_once( 'lib/cron.php' ); |
|
298 | - require_once( 'lib/api.php' ); |
|
299 | - require_once( 'lib/table.php' ); |
|
300 | - require_once( 'lib/ajax.php' ); |
|
301 | - require_once( 'lib/upload.php' ); |
|
302 | - require_once( 'lib/script.php' ); |
|
297 | + require_once('lib/cron.php'); |
|
298 | + require_once('lib/api.php'); |
|
299 | + require_once('lib/table.php'); |
|
300 | + require_once('lib/ajax.php'); |
|
301 | + require_once('lib/upload.php'); |
|
302 | + require_once('lib/script.php'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | $this->helpers(); |
314 | 314 | $this->functionality(); |
315 | 315 | |
316 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
317 | - register_activation_hook( PLUGIN_FILE, array($this, 'cron_activation' ) ); |
|
316 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
317 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
318 | 318 | |
319 | 319 | //remove the DB and CORN upon uninstallation |
320 | 320 | //$this won't work here. |
321 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); |
|
322 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
321 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); |
|
322 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
323 | 323 | |
324 | - add_action( 'init', array( $this, 'installation' ) ); |
|
325 | - add_action( 'init', array( $this, 'custom_cron_hook_cb' ) ); |
|
324 | + add_action('init', array($this, 'installation')); |
|
325 | + add_action('init', array($this, 'custom_cron_hook_cb')); |
|
326 | 326 | |
327 | 327 | $this->scripts(); |
328 | 328 | $this->widgets(); |
@@ -11,27 +11,27 @@ |
||
11 | 11 | License: GPLv2 |
12 | 12 | License URI: http://www.gnu.org/licenses/gpl-3.0.html |
13 | 13 | */ |
14 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
14 | +if ( ! defined('ABSPATH')) exit; |
|
15 | 15 | |
16 | 16 | |
17 | 17 | //Define basic names |
18 | 18 | //Edit the "_PLUGIN" in following namespaces for compatibility with your desired name. |
19 | -defined( 'PLUGIN_DEBUG' ) or define( 'PLUGIN_DEBUG', false ); |
|
19 | +defined('PLUGIN_DEBUG') or define('PLUGIN_DEBUG', false); |
|
20 | 20 | |
21 | -defined( 'PLUGIN_PATH' ) or define( 'PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
|
22 | -defined( 'PLUGIN_FILE' ) or define( 'PLUGIN_FILE', plugin_basename( __FILE__ ) ); |
|
21 | +defined('PLUGIN_PATH') or define('PLUGIN_PATH', plugin_dir_path(__FILE__)); |
|
22 | +defined('PLUGIN_FILE') or define('PLUGIN_FILE', plugin_basename(__FILE__)); |
|
23 | 23 | |
24 | -defined( 'PLUGIN_TRANSLATE' ) or define( 'PLUGIN_TRANSLATE', plugin_basename( plugin_dir_path( __FILE__ ) . 'asset/ln/' ) ); |
|
24 | +defined('PLUGIN_TRANSLATE') or define('PLUGIN_TRANSLATE', plugin_basename(plugin_dir_path(__FILE__) . 'asset/ln/')); |
|
25 | 25 | |
26 | -defined( 'PLUGIN_JS' ) or define( 'PLUGIN_JS', plugins_url( '/asset/js/', __FILE__ ) ); |
|
27 | -defined( 'PLUGIN_CSS' ) or define( 'PLUGIN_CSS', plugins_url( '/asset/css/', __FILE__ ) ); |
|
28 | -defined( 'PLUGIN_IMAGE' ) or define( 'PLUGIN_IMAGE', plugins_url( '/asset/img/', __FILE__ ) ); |
|
26 | +defined('PLUGIN_JS') or define('PLUGIN_JS', plugins_url('/asset/js/', __FILE__)); |
|
27 | +defined('PLUGIN_CSS') or define('PLUGIN_CSS', plugins_url('/asset/css/', __FILE__)); |
|
28 | +defined('PLUGIN_IMAGE') or define('PLUGIN_IMAGE', plugins_url('/asset/img/', __FILE__)); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | //The Plugin |
32 | -require_once( 'autoload.php' ); |
|
32 | +require_once('autoload.php'); |
|
33 | 33 | function plugin() { |
34 | - if ( class_exists( 'PLUGIN_BUILD' ) ) return PLUGIN_BUILD::instance(); |
|
34 | + if (class_exists('PLUGIN_BUILD')) return PLUGIN_BUILD::instance(); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | global $plugin; |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | License: GPLv2 |
12 | 12 | License URI: http://www.gnu.org/licenses/gpl-3.0.html |
13 | 13 | */ |
14 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
14 | +if ( !defined( 'ABSPATH' ) ) { |
|
15 | + exit; |
|
16 | +} |
|
15 | 17 | |
16 | 18 | |
17 | 19 | //Define basic names |
@@ -31,8 +33,10 @@ discard block |
||
31 | 33 | //The Plugin |
32 | 34 | require_once( 'autoload.php' ); |
33 | 35 | function plugin() { |
34 | - if ( class_exists( 'PLUGIN_BUILD' ) ) return PLUGIN_BUILD::instance(); |
|
35 | -} |
|
36 | + if ( class_exists( 'PLUGIN_BUILD' ) ) { |
|
37 | + return PLUGIN_BUILD::instance(); |
|
38 | + } |
|
39 | + } |
|
36 | 40 | |
37 | 41 | global $plugin; |
38 | 42 | $plugin = plugin(); ?> |