@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /** |
5 | 7 | * WP Query class for querying WP database |
@@ -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( |
@@ -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,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 |
@@ -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_id"); |
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,10 +177,10 @@ 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' ); |
|
180 | + add_settings_section('settings_id', __('Section Name', 'textdomain'), array($this, 'section_cb'), 'settings_name'); |
|
181 | 181 | |
182 | - register_setting( 'settings_id', 'settings_field_name' ); |
|
183 | - add_settings_field( 'settings_field_name', __( 'Field Name', 'textdomain' ), array( $this, 'settings_field_cb' ), 'settings_name', 'settings_id' ); |
|
182 | + register_setting('settings_id', 'settings_field_name'); |
|
183 | + add_settings_field('settings_field_name', __('Field Name', 'textdomain'), array($this, 'settings_field_cb'), 'settings_name', 'settings_id'); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | //Section description |
189 | 189 | public function section_cb() { |
190 | 190 | |
191 | - echo '<p class="description">' . __( 'Set up settings', 'textdomain' ) . '</p>'; |
|
191 | + echo '<p class="description">' . __('Set up settings', 'textdomain') . '</p>'; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 |
@@ -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 | * Build a sample metabox in editor screen |
6 | 6 | */ |
7 | -if ( ! class_exists( 'PLUGIN_METABOX' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_METABOX')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_METABOX { |
10 | 10 | |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | public function __construct() { |
14 | 14 | |
15 | 15 | //Adding the metabox. For custom post type use "add_meta_boxes_posttype" action |
16 | - add_action( 'add_meta_boxes', array( $this, 'register' ) ); |
|
17 | - add_action( 'save_post', array( $this, 'save' ), 10, 2 ); |
|
16 | + add_action('add_meta_boxes', array($this, 'register')); |
|
17 | + add_action('save_post', array($this, 'save'), 10, 2); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | add_meta_box( |
25 | 25 | 'meta-box-id', |
26 | - esc_html__( 'MetaBox Title', 'textdomain' ), |
|
27 | - array( $this, 'render' ), |
|
26 | + esc_html__('MetaBox Title', 'textdomain'), |
|
27 | + array($this, 'render'), |
|
28 | 28 | // Declare the post type to show meta box |
29 | 29 | 'post_type', |
30 | 30 | 'normal', |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | public function render() { |
38 | 38 | |
39 | - wp_nonce_field( basename( __FILE__ ), 'metabox_name_nonce' ); ?> |
|
39 | + wp_nonce_field(basename(__FILE__), 'metabox_name_nonce'); ?> |
|
40 | 40 | |
41 | 41 | <p> |
42 | - <label for="metabox_name"><?php _e( "Custom Text", 'textdomain' ); ?></label> |
|
42 | + <label for="metabox_name"><?php _e("Custom Text", 'textdomain'); ?></label> |
|
43 | 43 | <br /> |
44 | - <input class="widefat" type="text" name="metabox_field_name" id="metabox_field_name" value="<?php echo esc_attr( get_post_meta( $object->ID, 'metabox_name', true ) ); ?>" /> |
|
44 | + <input class="widefat" type="text" name="metabox_field_name" id="metabox_field_name" value="<?php echo esc_attr(get_post_meta($object->ID, 'metabox_name', true)); ?>" /> |
|
45 | 45 | </p> |
46 | 46 | <?php |
47 | 47 | } |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | //Save the post data |
52 | - function save( $post_id, $post ) { |
|
52 | + function save($post_id, $post) { |
|
53 | 53 | |
54 | 54 | //Check if doing autosave |
55 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; |
|
55 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; |
|
56 | 56 | |
57 | 57 | //Verify the nonce before proceeding. |
58 | - if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) return; |
|
58 | + if ( ! isset($_POST['metabox_name_nonce']) || ! wp_verify_nonce($_POST['metabox_name_nonce'], basename(__FILE__))) return; |
|
59 | 59 | |
60 | 60 | //Get the post type object. |
61 | - $post_type = get_post_type_object( $post->post_type ); |
|
61 | + $post_type = get_post_type_object($post->post_type); |
|
62 | 62 | |
63 | 63 | //Check if the current user has permission to edit the post. |
64 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; |
|
64 | + if ( ! current_user_can($post_type->cap->edit_post, $post_id)) return $post_id; |
|
65 | 65 | |
66 | - if ( isset( $_POST['metabox_field_name'] ) ) { |
|
67 | - update_post_meta( $post_id, 'metabox_field_name', esc_attr($_POST['metabox_field_name']) ); |
|
66 | + if (isset($_POST['metabox_field_name'])) { |
|
67 | + update_post_meta($post_id, 'metabox_field_name', esc_attr($_POST['metabox_field_name'])); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -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 | * Build a sample metabox in editor screen |
@@ -52,16 +54,22 @@ discard block |
||
52 | 54 | function save( $post_id, $post ) { |
53 | 55 | |
54 | 56 | //Check if doing autosave |
55 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; |
|
57 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
58 | + return; |
|
59 | + } |
|
56 | 60 | |
57 | 61 | //Verify the nonce before proceeding. |
58 | - if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) return; |
|
62 | + if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) { |
|
63 | + return; |
|
64 | + } |
|
59 | 65 | |
60 | 66 | //Get the post type object. |
61 | 67 | $post_type = get_post_type_object( $post->post_type ); |
62 | 68 | |
63 | 69 | //Check if the current user has permission to edit the post. |
64 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; |
|
70 | + if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) { |
|
71 | + return $post_id; |
|
72 | + } |
|
65 | 73 | |
66 | 74 | if ( isset( $_POST['metabox_field_name'] ) ) { |
67 | 75 | update_post_meta( $post_id, 'metabox_field_name', esc_attr($_POST['metabox_field_name']) ); |
@@ -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 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function cron_activation() { |
46 | 46 | |
47 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
47 | + if (class_exists('PLUGIN_CRON')) { |
|
48 | 48 | |
49 | 49 | $cron = new PLUGIN_CRON(); |
50 | 50 | $schedule = $cron->schedule_task( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function db_install() { |
69 | 69 | |
70 | - if ( class_exists( 'PLUGIN_DB' ) ) { |
|
70 | + if (class_exists('PLUGIN_DB')) { |
|
71 | 71 | |
72 | 72 | $db = new PLUGIN_DB(); |
73 | 73 | $db->table = self::$plugin_table; |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | $db->build(); |
78 | 78 | } |
79 | 79 | |
80 | - if (get_option( '_plugin_db_exist') == '0' ) { |
|
81 | - add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
|
80 | + if (get_option('_plugin_db_exist') == '0') { |
|
81 | + add_action('admin_notices', array($this, 'db_error_msg')); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | $options = array( |
85 | - array( 'option_name', '__value__' ), |
|
85 | + array('option_name', '__value__'), |
|
86 | 86 | ); |
87 | - foreach ( $options as $value ) { |
|
88 | - update_option( $value[0], $value[1] ); |
|
87 | + foreach ($options as $value) { |
|
88 | + update_option($value[0], $value[1]); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function db_error_msg() { ?> |
99 | 99 | |
100 | 100 | <div class="notice notice-error is-dismissible"> |
101 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
101 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
102 | 102 | </div> |
103 | 103 | <?php |
104 | 104 | } |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | $table_name = self::$plugin_table; |
115 | 115 | |
116 | 116 | global $wpdb; |
117 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" ); |
|
117 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name"); |
|
118 | 118 | |
119 | 119 | $options = array( |
120 | 120 | '_plugin_db_exist' |
121 | 121 | ); |
122 | - foreach ( $options as $value ) { |
|
123 | - delete_option( $value ); |
|
122 | + foreach ($options as $value) { |
|
123 | + delete_option($value); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function custom_cron_hook_cb() { |
145 | 145 | |
146 | - add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) ); |
|
146 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function cron_uninstall() { |
156 | 156 | |
157 | - wp_clear_scheduled_hook( 'custom_cron_hook' ); |
|
157 | + wp_clear_scheduled_hook('custom_cron_hook'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function scripts() { |
167 | 167 | |
168 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
168 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function settings() { |
178 | 178 | |
179 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
179 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function widgets() { |
189 | 189 | |
190 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
190 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function metabox() { |
200 | 200 | |
201 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
201 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function shortcode() { |
211 | 211 | |
212 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
212 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function functionality() { |
223 | 223 | |
224 | - require_once( 'src/install.php' ); |
|
225 | - require_once( 'src/db.php' ); |
|
226 | - require_once( 'src/query.php' ); |
|
227 | - require_once( 'src/settings.php' ); |
|
228 | - require_once( 'src/widget.php' ); |
|
229 | - require_once( 'src/metabox.php' ); |
|
230 | - require_once( 'src/shortcode.php' ); |
|
224 | + require_once('src/install.php'); |
|
225 | + require_once('src/db.php'); |
|
226 | + require_once('src/query.php'); |
|
227 | + require_once('src/settings.php'); |
|
228 | + require_once('src/widget.php'); |
|
229 | + require_once('src/metabox.php'); |
|
230 | + require_once('src/shortcode.php'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function helpers() { |
241 | 241 | |
242 | - require_once( 'lib/cron.php' ); |
|
243 | - require_once( 'lib/api.php' ); |
|
244 | - require_once( 'lib/table.php' ); |
|
245 | - require_once( 'lib/ajax.php' ); |
|
246 | - require_once( 'lib/upload.php' ); |
|
247 | - require_once( 'lib/script.php' ); |
|
242 | + require_once('lib/cron.php'); |
|
243 | + require_once('lib/api.php'); |
|
244 | + require_once('lib/table.php'); |
|
245 | + require_once('lib/ajax.php'); |
|
246 | + require_once('lib/upload.php'); |
|
247 | + require_once('lib/script.php'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -258,16 +258,16 @@ discard block |
||
258 | 258 | $this->helpers(); |
259 | 259 | $this->functionality(); |
260 | 260 | |
261 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
262 | - register_activation_hook( PLUGIN_FILE, array($this, 'cron_activation' ) ); |
|
261 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
262 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
263 | 263 | |
264 | 264 | //remove the DB and CORN upon uninstallation |
265 | 265 | //$this won't work here. |
266 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); |
|
267 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
266 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); |
|
267 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
268 | 268 | |
269 | - add_action( 'init', array( $this, 'installation' ) ); |
|
270 | - add_action( 'init', array( $this, 'custom_cron_hook_cb' ) ); |
|
269 | + add_action('init', array($this, 'installation')); |
|
270 | + add_action('init', array($this, 'custom_cron_hook_cb')); |
|
271 | 271 | |
272 | 272 | $this->scripts(); |
273 | 273 | $this->widgets(); |
@@ -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 | * Main plugin object to define the plugin |
@@ -165,7 +167,9 @@ discard block |
||
165 | 167 | */ |
166 | 168 | public function scripts() { |
167 | 169 | |
168 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
170 | + if ( class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
171 | + new PLUGIN_SCRIPT(); |
|
172 | + } |
|
169 | 173 | } |
170 | 174 | |
171 | 175 | |
@@ -176,7 +180,9 @@ discard block |
||
176 | 180 | */ |
177 | 181 | public function settings() { |
178 | 182 | |
179 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
183 | + if ( class_exists( 'PLUGIN_SETTINGS' ) ) { |
|
184 | + new PLUGIN_SETTINGS(); |
|
185 | + } |
|
180 | 186 | } |
181 | 187 | |
182 | 188 | |
@@ -187,7 +193,9 @@ discard block |
||
187 | 193 | */ |
188 | 194 | public function widgets() { |
189 | 195 | |
190 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
196 | + if ( class_exists( 'PLUGIN_WIDGET' ) ) { |
|
197 | + new PLUGIN_WIDGET(); |
|
198 | + } |
|
191 | 199 | } |
192 | 200 | |
193 | 201 | |
@@ -198,7 +206,9 @@ discard block |
||
198 | 206 | */ |
199 | 207 | public function metabox() { |
200 | 208 | |
201 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
209 | + if ( class_exists( 'PLUGIN_METABOX' ) ) { |
|
210 | + new PLUGIN_METABOX(); |
|
211 | + } |
|
202 | 212 | } |
203 | 213 | |
204 | 214 | |
@@ -209,7 +219,9 @@ discard block |
||
209 | 219 | */ |
210 | 220 | public function shortcode() { |
211 | 221 | |
212 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
222 | + if ( class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
223 | + new PLUGIN_SHORTCODE(); |
|
224 | + } |
|
213 | 225 | } |
214 | 226 | |
215 | 227 |
@@ -11,23 +11,23 @@ |
||
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' ); |
|
33 | -if ( class_exists( 'PLUGIN_BUILD' ) ) new PLUGIN_BUILD(); ?> |
|
32 | +require_once('autoload.php'); |
|
33 | +if (class_exists('PLUGIN_BUILD')) new PLUGIN_BUILD(); ?> |
@@ -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 |
@@ -30,4 +32,7 @@ discard block |
||
30 | 32 | |
31 | 33 | //The Plugin |
32 | 34 | require_once( 'autoload.php' ); |
33 | -if ( class_exists( 'PLUGIN_BUILD' ) ) new PLUGIN_BUILD(); ?> |
|
35 | +if ( class_exists( 'PLUGIN_BUILD' ) ) { |
|
36 | + new PLUGIN_BUILD(); |
|
37 | +} |
|
38 | +?> |