@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | add_action( 'admin_menu', array( $this, 'menu_page' ) ); |
| 54 | 54 | add_action( 'admin_menu', array( $this, 'sub_menu_page' ) ); |
| 55 | 55 | add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 ); |
| 56 | - * |
|
| 57 | - */ |
|
| 56 | + * |
|
| 57 | + */ |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -103,8 +103,8 @@ 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() |
|
| 107 | - //return $status; |
|
| 106 | + if ( 'option_name_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
| 107 | + //return $status; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | echo '<textarea name="settings_field_name" id="settings_field_name" value="' . get_option('settings_field_name') . '>'. __( 'Enter Value', 'textdomain' ) . '</textarea>'; |
| 202 | 202 | echo '<select name="settings_field_name" id="settings_field_name"><option value="value" ' . selected( 'value', get_option('settings_field_name'), false) . '>Value</option></select>'; |
| 203 | 203 | echo '<input type="checkbox" id="settings_field_name" name="settings_field_name" value="1"' . checked( 1, get_option('settings_field_name'), false ) . '/>'; |
| 204 | - */ |
|
| 204 | + */ |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | } ?> |
@@ -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("settings_name"); |
| 140 | 140 | do_settings_sections("settings_name"); |
| 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( 'settings_id', __( 'Section Name', 'textdomain' ), array( $this,'section_cb' ), 'settings_name' ); |
|
| 181 | - register_setting( 'settings_name', 'settings_field' ); |
|
| 182 | - add_settings_field( 'settings_field_name', __( 'Field Name', 'textdomain' ), array( $this, 'settings_field_cb' ), 'settings_name', 'settings_id' ); |
|
| 180 | + add_settings_section('settings_id', __('Section Name', 'textdomain'), array($this, 'section_cb'), 'settings_name'); |
|
| 181 | + register_setting('settings_name', 'settings_field'); |
|
| 182 | + add_settings_field('settings_field_name', __('Field Name', 'textdomain'), array($this, 'settings_field_cb'), 'settings_name', 'settings_id'); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | //Section description |
| 188 | 188 | public function section_cb() { |
| 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 | |
@@ -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 | /** |
| 5 | 7 | * Backend settings page class, can have settings fields or data table |
@@ -103,7 +105,10 @@ discard block |
||
| 103 | 105 | //Set screen option |
| 104 | 106 | public function set_screen($status, $option, $value) { |
| 105 | 107 | |
| 106 | - if ( 'option_name_per_page' == $option ) return $value; // Related to PLUGIN_TABLE() |
|
| 108 | + if ( 'option_name_per_page' == $option ) { |
|
| 109 | + return $value; |
|
| 110 | + } |
|
| 111 | + // Related to PLUGIN_TABLE() |
|
| 107 | 112 | //return $status; |
| 108 | 113 | } |
| 109 | 114 | |
@@ -29,12 +29,12 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | $user_args = $this->user_args($paged); |
| 31 | 31 | $the_query = new WP_User_Query( $user_args ); |
| 32 | - */ |
|
| 32 | + */ |
|
| 33 | 33 | |
| 34 | 34 | // The Loop |
| 35 | 35 | if ( $the_query->have_posts() ) { |
| 36 | 36 | while ( $the_query->have_posts() ) { |
| 37 | - $the_query->the_post(); |
|
| 37 | + $the_query->the_post(); |
|
| 38 | 38 | // Do Stuff |
| 39 | 39 | } // end while |
| 40 | 40 | } // endif |
@@ -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 | * WP Query class for querying WP database |
| 6 | 6 | * For more reference of arguments visit: https://gist.github.com/nirjharlo/5c6f8ac4cc5271f88376788e599c287b |
| 7 | 7 | * This class depends on WP pagenavi plugin: https://wordpress.org/plugins/wp-pagenavi/ |
| 8 | 8 | */ |
| 9 | -if ( ! class_exists( 'PLUGIN_QUERY' ) ) { |
|
| 9 | +if ( ! class_exists('PLUGIN_QUERY')) { |
|
| 10 | 10 | |
| 11 | 11 | class PLUGIN_QUERY { |
| 12 | 12 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | get_query_var('page') : 1); |
| 25 | 25 | |
| 26 | 26 | $post_args = $this->post_args($paged); |
| 27 | - $the_query = new WP_Query( $post_args ); |
|
| 27 | + $the_query = new WP_Query($post_args); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | $user_args = $this->user_args($paged); |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | // The Loop |
| 35 | - if ( $the_query->have_posts() ) { |
|
| 36 | - while ( $the_query->have_posts() ) { |
|
| 35 | + if ($the_query->have_posts()) { |
|
| 36 | + while ($the_query->have_posts()) { |
|
| 37 | 37 | $the_query->the_post(); |
| 38 | 38 | // Do Stuff |
| 39 | 39 | } // end while |
| 40 | 40 | } // endif |
| 41 | 41 | |
| 42 | - if (function_exists('wp_pagenavi')) { |
|
| 43 | - wp_pagenavi( array( 'query' => $the_query, 'echo' => true ) );//For user query add param 'type' => 'users' |
|
| 42 | + if (function_exists('wp_pagenavi')) { |
|
| 43 | + wp_pagenavi(array('query' => $the_query, 'echo' => true)); //For user query add param 'type' => 'users' |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Reset Post Data |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function user_args($paged) { |
| 55 | 55 | |
| 56 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
| 56 | + $offset = ($paged - 1) * $this->display_count; |
|
| 57 | 57 | |
| 58 | - $args = array ( |
|
| 58 | + $args = array( |
|
| 59 | 59 | 'role' => '', // user role |
| 60 | 60 | 'order' => '', //ASC or DESC |
| 61 | 61 | 'fields' => '', // |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | 'count_total' => true, |
| 72 | 72 | 'paged' => $paged, |
| 73 | 73 | 'offset' => $offset, |
| 74 | - 'search' => '*'.esc_attr( $_GET['search'] ).'*', |
|
| 74 | + 'search' => '*' . esc_attr($_GET['search']) . '*', |
|
| 75 | 75 | 'meta_query' => array( // It supports nested meta query |
| 76 | 76 | 'relation' => 'AND', //or 'OR' |
| 77 | 77 | array( |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function post_args($paged) { |
| 98 | 98 | |
| 99 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
| 99 | + $offset = ($paged - 1) * $this->display_count; |
|
| 100 | 100 | |
| 101 | - $args = array ( |
|
| 101 | + $args = array( |
|
| 102 | 102 | 'post_type' => '', // array of type slugs |
| 103 | 103 | 'order' => 'ASC', |
| 104 | 104 | 'fields' => '', // |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'count_total' => true, |
| 113 | 113 | 'paged' => $paged, |
| 114 | 114 | 'offset' => $offset, |
| 115 | - 'search' => '*'.esc_attr( $_GET['search'] ).'*', |
|
| 115 | + 'search' => '*' . esc_attr($_GET['search']) . '*', |
|
| 116 | 116 | 'meta_query' => array( // It supports nested meta query |
| 117 | 117 | 'relation' => 'AND', //or 'OR' |
| 118 | 118 | array( |
@@ -1,25 +1,25 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * |
| 6 | 6 | * Add Cron schedules and cron task callback |
| 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 | 15 | //Add cron schedules |
| 16 | - add_filter('cron_schedules', array( $this, 'cron_schedules' ) ); |
|
| 16 | + add_filter('cron_schedules', array($this, 'cron_schedules')); |
|
| 17 | 17 | |
| 18 | 18 | //Add cron callbacks |
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function cron_schedules( $schedules ) { |
|
| 22 | + public function cron_schedules($schedules) { |
|
| 23 | 23 | |
| 24 | 24 | $prefix = 'prefix_'; // Avoid conflict with other crons. Example Reference: cron_30_mins |
| 25 | 25 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | /* Add each custom schedule into the cron job system. */ |
| 43 | - foreach($schedule_options as $schedule_key => $schedule){ |
|
| 43 | + foreach ($schedule_options as $schedule_key => $schedule) { |
|
| 44 | 44 | |
| 45 | - if(!isset($schedules[$prefix.$schedule_key])) { |
|
| 45 | + if ( ! isset($schedules[$prefix . $schedule_key])) { |
|
| 46 | 46 | |
| 47 | - $schedules[$prefix.$schedule_key] = array( |
|
| 47 | + $schedules[$prefix . $schedule_key] = array( |
|
| 48 | 48 | 'interval' => $schedule['interval'], |
| 49 | - 'display' => __('Every '.$schedule['display']) |
|
| 49 | + 'display' => __('Every ' . $schedule['display']) |
|
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | //Called in autoload.php |
| 58 | 58 | public function schedule_task($task) { |
| 59 | 59 | |
| 60 | - if( ! $task ) { |
|
| 60 | + if ( ! $task) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -67,17 +67,17 @@ discard block |
||
| 67 | 67 | 'hook' |
| 68 | 68 | ); |
| 69 | 69 | $missing_keys = array(); |
| 70 | - foreach( $required_keys as $key ){ |
|
| 71 | - if( ! array_key_exists( $key, $task ) ) { |
|
| 70 | + foreach ($required_keys as $key) { |
|
| 71 | + if ( ! array_key_exists($key, $task)) { |
|
| 72 | 72 | $missing_keys[] = $key; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if( ! empty( $missing_keys ) ){ |
|
| 76 | + if ( ! empty($missing_keys)) { |
|
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if( wp_next_scheduled( $task['hook'] ) ){ |
|
| 80 | + if (wp_next_scheduled($task['hook'])) { |
|
| 81 | 81 | wp_clear_scheduled_hook($task['hook']); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -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(); |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | ); |
| 28 | 28 | $install->execute(); |
| 29 | 29 | } |
| 30 | - * |
|
| 31 | - */ |
|
| 30 | + * |
|
| 31 | + */ |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | public function db_install() { |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * |
|
| 58 | - * Install database by defining your SQL |
|
| 59 | - * |
|
| 57 | + * |
|
| 58 | + * Install database by defining your SQL |
|
| 59 | + * |
|
| 60 | 60 | if ( class_exists( 'PLUGIN_DB' ) ) { |
| 61 | 61 | $db = new PLUGIN_DB(); |
| 62 | 62 | $db->table = 'plugin_db_table_name'; |
@@ -65,28 +65,28 @@ discard block |
||
| 65 | 65 | UNIQUE KEY ID (ID)"; |
| 66 | 66 | $db->build(); |
| 67 | 67 | } |
| 68 | - * |
|
| 69 | - * |
|
| 70 | - * Optionally check if the DB table is installed correctly |
|
| 71 | - * |
|
| 68 | + * |
|
| 69 | + * |
|
| 70 | + * Optionally check if the DB table is installed correctly |
|
| 71 | + * |
|
| 72 | 72 | if (get_option('_plugin_db_exist') == '0') { |
| 73 | 73 | add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
| 74 | 74 | } |
| 75 | - * |
|
| 76 | - */ |
|
| 75 | + * |
|
| 76 | + */ |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * |
|
| 80 | - * Install DB options |
|
| 81 | - * |
|
| 79 | + * |
|
| 80 | + * Install DB options |
|
| 81 | + * |
|
| 82 | 82 | $options = array( |
| 83 | 83 | array( 'option_name', '__value__' ), |
| 84 | 84 | ); |
| 85 | 85 | foreach ($options as $value) { |
| 86 | 86 | update_option( $value[0], $value[1] ); |
| 87 | 87 | } |
| 88 | - * |
|
| 89 | - */ |
|
| 88 | + * |
|
| 89 | + */ |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | public function db_uninstall() { |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * |
|
| 109 | - * Important table name declarition |
|
| 110 | - * |
|
| 108 | + * |
|
| 109 | + * Important table name declarition |
|
| 110 | + * |
|
| 111 | 111 | $tableName = 'plugin_db_table_name'; |
| 112 | 112 | |
| 113 | 113 | global $wpdb; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | foreach ($options as $value) { |
| 119 | 119 | delete_option($value); |
| 120 | 120 | } |
| 121 | - * |
|
| 122 | - */ |
|
| 121 | + * |
|
| 122 | + */ |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | //Custom corn class, register it while activation |
| 37 | 37 | public function cron_activation() { |
| 38 | 38 | |
| 39 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
| 39 | + if (class_exists('PLUGIN_CRON')) { |
|
| 40 | 40 | $cron = new PLUGIN_CRON(); |
| 41 | 41 | $schedule = $cron->schedule_task( |
| 42 | 42 | array( |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function db_error_msg() { ?> |
| 96 | 96 | |
| 97 | 97 | <div class="notice notice-error is-dismissible"> |
| 98 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
| 98 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | public function custom_cron_hook_cb() { |
| 133 | 133 | |
| 134 | - add_action('custom_cron_hook', array( $this, 'do_cron_job_function')); |
|
| 134 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | //Include scripts |
| 145 | 145 | public function scripts() { |
| 146 | 146 | |
| 147 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
| 147 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | //Include settings pages |
| 153 | 153 | public function settings() { |
| 154 | 154 | |
| 155 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
| 155 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | //Include widget classes |
| 160 | 160 | public function widgets() { |
| 161 | 161 | |
| 162 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
| 162 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | //Include metabox classes |
| 168 | 168 | public function metabox() { |
| 169 | 169 | |
| 170 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
| 170 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | //Include shortcode classes |
| 176 | 176 | public function shortcode() { |
| 177 | 177 | |
| 178 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
| 178 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | $this->helpers(); |
| 219 | 219 | $this->functionality(); |
| 220 | 220 | |
| 221 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
| 222 | - register_activation_hook( PLUGIN_FILE, array($this, 'cron_activation' )); |
|
| 221 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
| 222 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
| 223 | 223 | |
| 224 | 224 | //remove the DB upon uninstallation |
| 225 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); //$this won't work here. |
|
| 226 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
| 225 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); //$this won't work here. |
|
| 226 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
| 227 | 227 | |
| 228 | 228 | add_action('init', array($this, 'installation')); |
| 229 | 229 | add_action('init', array($this, 'custom_cron_hook_cb')); |