@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * DB installation class |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.2.1 |
9 | 9 | * @package wp-plugin-framework |
10 | 10 | */ |
11 | -if ( ! class_exists( 'PLUGIN_DB' ) ) { |
|
11 | +if ( ! class_exists('PLUGIN_DB')) { |
|
12 | 12 | |
13 | 13 | class PLUGIN_DB { |
14 | 14 | |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | global $wpdb; |
46 | 46 | $wpdb->hide_errors(); |
47 | 47 | $this->table_name = $wpdb->prefix . $this->table; |
48 | - update_option( '_plugin_db_exist', 0 ); |
|
49 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '$this->table_name'" ) != $this->table_name ) { |
|
50 | - $execute_sql = $this->execute( $this->table_name, $this->collate(), $this->sql ); |
|
51 | - dbDelta( $execute_sql ); |
|
48 | + update_option('_plugin_db_exist', 0); |
|
49 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { |
|
50 | + $execute_sql = $this->execute($this->table_name, $this->collate(), $this->sql); |
|
51 | + dbDelta($execute_sql); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | global $wpdb; |
64 | 64 | $wpdb->hide_errors(); |
65 | 65 | $collate = ""; |
66 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
67 | - if( ! empty($wpdb->charset ) ) |
|
66 | + if ($wpdb->has_cap('collation')) { |
|
67 | + if ( ! empty($wpdb->charset)) |
|
68 | 68 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
69 | - if( ! empty($wpdb->collate ) ) |
|
69 | + if ( ! empty($wpdb->collate)) |
|
70 | 70 | $collate .= " COLLATE $wpdb->collate"; |
71 | 71 | } |
72 | - require_once( $this->up_path ); |
|
72 | + require_once($this->up_path); |
|
73 | 73 | return $collate; |
74 | 74 | } |
75 | 75 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return String |
85 | 85 | */ |
86 | - public function execute( $table_name, $collate, $sql ) { |
|
86 | + public function execute($table_name, $collate, $sql) { |
|
87 | 87 | |
88 | 88 | return "CREATE TABLE $table_name ( $sql ) $collate;"; |
89 | 89 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | global $wpdb; |
100 | 100 | |
101 | 101 | $this->table_name = $wpdb->prefix . $this->table; |
102 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '$this->table_name'" ) == $this->table_name ) { |
|
102 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name) { |
|
103 | 103 | |
104 | - update_option( '_plugin_db_exist', 1 ); |
|
104 | + update_option('_plugin_db_exist', 1); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
@@ -24,11 +24,11 @@ |
||
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Shortcode callback |
27 | - * |
|
28 | - * @param Array $atts |
|
29 | - * |
|
30 | - * @return Html |
|
31 | - */ |
|
27 | + * |
|
28 | + * @param Array $atts |
|
29 | + * |
|
30 | + * @return Html |
|
31 | + */ |
|
32 | 32 | public function cb($atts) { |
33 | 33 | |
34 | 34 | $data = shortcode_atts( array( |
@@ -1,5 +1,5 @@ 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 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.2.1 |
9 | 9 | * @package wp-plugin-framework |
10 | 10 | */ |
11 | -if ( ! class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
11 | +if ( ! class_exists('PLUGIN_SHORTCODE')) { |
|
12 | 12 | |
13 | 13 | class PLUGIN_SHORTCODE { |
14 | 14 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | 21 | |
22 | - add_shortcode( 'shortcode_name', array( $this, 'cb' ) ); |
|
22 | + add_shortcode('shortcode_name', array($this, 'cb')); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function cb($atts) { |
33 | 33 | |
34 | - $data = shortcode_atts( array( |
|
34 | + $data = shortcode_atts(array( |
|
35 | 35 | 'type' => 'zip', |
36 | - ), $atts ); |
|
36 | + ), $atts); |
|
37 | 37 | |
38 | 38 | return $this->html(); |
39 | 39 | } |
@@ -1,5 +1,5 @@ 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. |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.2.1 |
9 | 9 | * @package wp-plugin-framework |
10 | 10 | */ |
11 | -if ( ! class_exists( 'PLUGIN_INSTALL' ) ) { |
|
11 | +if ( ! class_exists('PLUGIN_INSTALL')) { |
|
12 | 12 | |
13 | 13 | final class PLUGIN_INSTALL { |
14 | 14 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function execute() { |
40 | 40 | |
41 | - add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) ); |
|
42 | - add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) ); |
|
43 | - add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 ); |
|
41 | + add_action('plugins_loaded', array($this, 'text_domain_cb')); |
|
42 | + add_action('admin_notices', array($this, 'php_ver_incompatible')); |
|
43 | + add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | unload_textdomain($this->text_domain); |
58 | 58 | load_textdomain($this->text_domain, PLUGIN_LN . 'textdomain-' . $locale . '.mo'); |
59 | - load_plugin_textdomain( $this->text_domain, false, PLUGIN_LN ); |
|
59 | + load_plugin_textdomain($this->text_domain, false, PLUGIN_LN); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function php_ver_incompatible() { |
69 | 69 | |
70 | - if ( version_compare( phpversion(), $this->php_ver_allowed, '<' ) ) : |
|
71 | - $text = __( 'The Plugin can\'t be activated because your PHP version', 'textdomain' ); |
|
72 | - $text_last = __( 'is less than required '.$this->php_ver_allowed.'. See more information', 'textdomain' ); |
|
70 | + if (version_compare(phpversion(), $this->php_ver_allowed, '<')) : |
|
71 | + $text = __('The Plugin can\'t be activated because your PHP version', 'textdomain'); |
|
72 | + $text_last = __('is less than required ' . $this->php_ver_allowed . '. See more information', 'textdomain'); |
|
73 | 73 | $text_link = 'php.net/eol.php'; ?> |
74 | 74 | |
75 | 75 | <div id="message" class="updated notice notice-success is-dismissible"> |
@@ -90,20 +90,20 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return Array |
92 | 92 | */ |
93 | - public function menu_page_link( $links, $file ) { |
|
93 | + public function menu_page_link($links, $file) { |
|
94 | 94 | |
95 | 95 | if ($this->plugin_page_links) { |
96 | 96 | static $this_plugin; |
97 | - if ( ! $this_plugin ) { |
|
97 | + if ( ! $this_plugin) { |
|
98 | 98 | $this_plugin = PLUGIN_FILE; |
99 | 99 | } |
100 | - if ( $file == $this_plugin ) { |
|
100 | + if ($file == $this_plugin) { |
|
101 | 101 | $shift_link = array(); |
102 | 102 | foreach ($this->plugin_page_links as $value) { |
103 | - $shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>'; |
|
103 | + $shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>'; |
|
104 | 104 | } |
105 | - foreach( $shift_link as $val ) { |
|
106 | - array_unshift( $links, $val ); |
|
105 | + foreach ($shift_link as $val) { |
|
106 | + array_unshift($links, $val); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return $links; |
@@ -40,12 +40,12 @@ |
||
40 | 40 | /** |
41 | 41 | $user_args = $this->user_args($paged); |
42 | 42 | $the_query = new WP_User_Query( $user_args ); |
43 | - */ |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | // The Loop |
46 | 46 | if ( $the_query->have_posts() ) { |
47 | 47 | while ( $the_query->have_posts() ) { |
48 | - $the_query->the_post(); |
|
48 | + $the_query->the_post(); |
|
49 | 49 | // Do Stuff |
50 | 50 | } // end while |
51 | 51 | } // endif |
@@ -1,5 +1,5 @@ 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 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @version 1.2.1 |
11 | 11 | * @package wp-plugin-framework |
12 | 12 | */ |
13 | -if ( ! class_exists( 'PLUGIN_QUERY' ) ) { |
|
13 | +if ( ! class_exists('PLUGIN_QUERY')) { |
|
14 | 14 | |
15 | 15 | class PLUGIN_QUERY { |
16 | 16 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); |
36 | 36 | |
37 | 37 | $post_args = $this->post_args($paged); |
38 | - $the_query = new WP_Query( $post_args ); |
|
38 | + $the_query = new WP_Query($post_args); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | $user_args = $this->user_args($paged); |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | |
45 | 45 | // The Loop |
46 | - if ( $the_query->have_posts() ) { |
|
47 | - while ( $the_query->have_posts() ) { |
|
46 | + if ($the_query->have_posts()) { |
|
47 | + while ($the_query->have_posts()) { |
|
48 | 48 | $the_query->the_post(); |
49 | 49 | // Do Stuff |
50 | 50 | } // end while |
51 | 51 | } // endif |
52 | 52 | |
53 | - if ( function_exists('wp_pagenavi' ) ) { |
|
54 | - wp_pagenavi( array( 'query' => $the_query, 'echo' => true ) );//For user query add param 'type' => 'users' |
|
53 | + if (function_exists('wp_pagenavi')) { |
|
54 | + wp_pagenavi(array('query' => $the_query, 'echo' => true)); //For user query add param 'type' => 'users' |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Reset Post Data |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return Void |
66 | 66 | */ |
67 | - public function user_args( $paged ) { |
|
67 | + public function user_args($paged) { |
|
68 | 68 | |
69 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
69 | + $offset = ($paged - 1) * $this->display_count; |
|
70 | 70 | |
71 | - $args = array ( |
|
71 | + $args = array( |
|
72 | 72 | 'role' => '', // user role |
73 | 73 | 'order' => '', //ASC or DESC |
74 | 74 | 'fields' => '', // |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'count_total' => true, |
85 | 85 | 'paged' => $paged, |
86 | 86 | 'offset' => $offset, |
87 | - 'search' => '*' . esc_attr( $_GET['s'] ) . '*', |
|
87 | + 'search' => '*' . esc_attr($_GET['s']) . '*', |
|
88 | 88 | 'meta_query' => array( // It supports nested meta query |
89 | 89 | 'relation' => 'AND', //or 'OR' |
90 | 90 | array( |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return Void |
111 | 111 | */ |
112 | - public function post_args( $paged ) { |
|
112 | + public function post_args($paged) { |
|
113 | 113 | |
114 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
114 | + $offset = ($paged - 1) * $this->display_count; |
|
115 | 115 | |
116 | - $args = array ( |
|
116 | + $args = array( |
|
117 | 117 | 'post_type' => '', // array of type slugs |
118 | 118 | 'order' => 'ASC', |
119 | 119 | 'fields' => '', // |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | 'count_total' => true, |
128 | 128 | 'paged' => $paged, |
129 | 129 | 'offset' => $offset, |
130 | - 'search' => '*' . esc_attr( $_GET['s'] ) . '*', |
|
130 | + 'search' => '*' . esc_attr($_GET['s']) . '*', |
|
131 | 131 | 'meta_query' => array( // It supports nested meta query |
132 | 132 | 'relation' => 'AND', //or 'OR' |
133 | 133 | array( |