@@ -3,7 +3,9 @@ |
||
| 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' ) ) { |
|
| 7 | + exit; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | //AJAX helper class |
| 9 | 11 | if ( ! class_exists( 'PLUGIN_AJAX' ) ) { |
@@ -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 | * Plugin upload for WordPress front end or backend |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | /** |
| 3 | 3 | * Add scripts to the plugin. CSS and JS. |
| 4 | 4 | */ |
| 5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | + exit; |
|
| 7 | +} |
|
| 6 | 8 | |
| 7 | 9 | if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) { |
| 8 | 10 | |
@@ -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 | * |
@@ -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 | * DB installation class |
@@ -45,10 +47,12 @@ discard block |
||
| 45 | 47 | $wpdb->hide_errors(); |
| 46 | 48 | $collate = ""; |
| 47 | 49 | if ( $wpdb->has_cap( 'collation' ) ) { |
| 48 | - if( ! empty($wpdb->charset ) ) |
|
| 49 | - $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
|
| 50 | - if( ! empty($wpdb->collate ) ) |
|
| 51 | - $collate .= " COLLATE $wpdb->collate"; |
|
| 50 | + if( ! empty($wpdb->charset ) ) { |
|
| 51 | + $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
|
| 52 | + } |
|
| 53 | + if( ! empty($wpdb->collate ) ) { |
|
| 54 | + $collate .= " COLLATE $wpdb->collate"; |
|
| 55 | + } |
|
| 52 | 56 | } |
| 53 | 57 | require_once( $this->up_path ); |
| 54 | 58 | return $collate; |
@@ -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 | * Shortcode class for rendering in front end |
@@ -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,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | /** |
| 5 | 7 | * Widget class |
@@ -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,15 +54,17 @@ discard block |
||
| 52 | 54 | function save( $post_id, $post ) { |
| 53 | 55 | |
| 54 | 56 | //Verify the nonce before proceeding. |
| 55 | - if ( !isset( $_POST['metaBoxName_nonce'] ) || !wp_verify_nonce( $_POST['metaBoxName_nonce'], basename( __FILE__ ) ) ) |
|
| 56 | - return $post_id; |
|
| 57 | + if ( !isset( $_POST['metaBoxName_nonce'] ) || !wp_verify_nonce( $_POST['metaBoxName_nonce'], basename( __FILE__ ) ) ) { |
|
| 58 | + return $post_id; |
|
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | //Get the post type object. |
| 59 | 62 | $post_type = get_post_type_object( $post->post_type ); |
| 60 | 63 | |
| 61 | 64 | //Check if the current user has permission to edit the post. |
| 62 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) |
|
| 63 | - return $post_id; |
|
| 65 | + if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) { |
|
| 66 | + return $post_id; |
|
| 67 | + } |
|
| 64 | 68 | |
| 65 | 69 | //Get the posted data and sanitize it for use as an HTML class. |
| 66 | 70 | $new_meta_value = ( isset( $_POST['metaBoxName'] ) ? sanitize_html_class( $_POST['metaBoxName'] ) : '' ); |