@@ -64,12 +64,12 @@ |
||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Save the Metabox post data |
|
| 68 | - * |
|
| 69 | - * @param Array $atts |
|
| 70 | - * |
|
| 71 | - * @return Html |
|
| 72 | - */ |
|
| 67 | + * Save the Metabox post data |
|
| 68 | + * |
|
| 69 | + * @param Array $atts |
|
| 70 | + * |
|
| 71 | + * @return Html |
|
| 72 | + */ |
|
| 73 | 73 | function save( $post_id, $post ) { |
| 74 | 74 | |
| 75 | 75 | //Check if doing autosave |
@@ -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 | * Build a sample metabox in editor screen |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Nirjhar Lo |
| 8 | 8 | * @package wp-plugin-framework |
| 9 | 9 | */ |
| 10 | -if ( ! class_exists( 'PLUGIN_METABOX' ) ) { |
|
| 10 | +if ( ! class_exists('PLUGIN_METABOX')) { |
|
| 11 | 11 | |
| 12 | 12 | final class PLUGIN_METABOX { |
| 13 | 13 | |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | public function __construct() { |
| 21 | 21 | |
| 22 | 22 | //Adding the metabox. For custom post type use "add_meta_boxes_posttype" action |
| 23 | - add_action( 'add_meta_boxes', array( $this, 'register' ) ); |
|
| 24 | - add_action( 'save_post', array( $this, 'save' ), 10, 2 ); |
|
| 23 | + add_action('add_meta_boxes', array($this, 'register')); |
|
| 24 | + add_action('save_post', array($this, 'save'), 10, 2); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | add_meta_box( |
| 36 | 36 | 'meta-box-id', |
| 37 | - esc_html__( 'MetaBox Title', 'textdomain' ), |
|
| 38 | - array( $this, 'render' ), |
|
| 37 | + esc_html__('MetaBox Title', 'textdomain'), |
|
| 38 | + array($this, 'render'), |
|
| 39 | 39 | // Declare the post type to show meta box |
| 40 | 40 | 'post_type', |
| 41 | 41 | 'normal', |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function render() { |
| 53 | 53 | |
| 54 | - wp_nonce_field( basename( __FILE__ ), 'metabox_name_nonce' ); ?> |
|
| 54 | + wp_nonce_field(basename(__FILE__), 'metabox_name_nonce'); ?> |
|
| 55 | 55 | |
| 56 | 56 | <p> |
| 57 | - <label for="metabox_name"><?php _e( "Custom Text", 'textdomain' ); ?></label> |
|
| 57 | + <label for="metabox_name"><?php _e("Custom Text", 'textdomain'); ?></label> |
|
| 58 | 58 | <br /> |
| 59 | - <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 ) ); ?>" /> |
|
| 59 | + <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)); ?>" /> |
|
| 60 | 60 | </p> |
| 61 | 61 | <?php |
| 62 | 62 | } |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return Html |
| 71 | 71 | */ |
| 72 | - function save( $post_id, $post ) { |
|
| 72 | + function save($post_id, $post) { |
|
| 73 | 73 | |
| 74 | 74 | //Check if doing autosave |
| 75 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; |
|
| 75 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; |
|
| 76 | 76 | |
| 77 | 77 | //Verify the nonce before proceeding. |
| 78 | - if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) return; |
|
| 78 | + if ( ! isset($_POST['metabox_name_nonce']) || ! wp_verify_nonce($_POST['metabox_name_nonce'], basename(__FILE__))) return; |
|
| 79 | 79 | |
| 80 | 80 | //Get the post type object. |
| 81 | - $post_type = get_post_type_object( $post->post_type ); |
|
| 81 | + $post_type = get_post_type_object($post->post_type); |
|
| 82 | 82 | |
| 83 | 83 | //Check if the current user has permission to edit the post. |
| 84 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; |
|
| 84 | + if ( ! current_user_can($post_type->cap->edit_post, $post_id)) return $post_id; |
|
| 85 | 85 | |
| 86 | - if ( isset( $_POST['metabox_field_name'] ) ) { |
|
| 87 | - update_post_meta( $post_id, 'metabox_field_name', sanitize_text_field($_POST['metabox_field_name']) ); |
|
| 86 | + if (isset($_POST['metabox_field_name'])) { |
|
| 87 | + update_post_meta($post_id, 'metabox_field_name', sanitize_text_field($_POST['metabox_field_name'])); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -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 |
@@ -73,16 +75,22 @@ discard block |
||
| 73 | 75 | function save( $post_id, $post ) { |
| 74 | 76 | |
| 75 | 77 | //Check if doing autosave |
| 76 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; |
|
| 78 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 79 | + return; |
|
| 80 | + } |
|
| 77 | 81 | |
| 78 | 82 | //Verify the nonce before proceeding. |
| 79 | - if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) return; |
|
| 83 | + if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 80 | 86 | |
| 81 | 87 | //Get the post type object. |
| 82 | 88 | $post_type = get_post_type_object( $post->post_type ); |
| 83 | 89 | |
| 84 | 90 | //Check if the current user has permission to edit the post. |
| 85 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; |
|
| 91 | + if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) { |
|
| 92 | + return $post_id; |
|
| 93 | + } |
|
| 86 | 94 | |
| 87 | 95 | if ( isset( $_POST['metabox_field_name'] ) ) { |
| 88 | 96 | update_post_meta( $post_id, 'metabox_field_name', sanitize_text_field($_POST['metabox_field_name']) ); |
@@ -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. |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Nirjhar Lo |
| 8 | 8 | * @package wp-plugin-framework |
| 9 | 9 | */ |
| 10 | -if ( ! class_exists( 'PLUGIN_INSTALL' ) ) { |
|
| 10 | +if ( ! class_exists('PLUGIN_INSTALL')) { |
|
| 11 | 11 | |
| 12 | 12 | final class PLUGIN_INSTALL { |
| 13 | 13 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function execute() { |
| 39 | 39 | |
| 40 | - add_action( 'plugins_loaded', array( $this, 'text_domain_cb' ) ); |
|
| 41 | - add_action( 'admin_notices', array( $this, 'php_ver_incompatible' ) ); |
|
| 42 | - add_filter( 'plugin_action_links', array( $this, 'menu_page_link' ), 10, 2 ); |
|
| 40 | + add_action('plugins_loaded', array($this, 'text_domain_cb')); |
|
| 41 | + add_action('admin_notices', array($this, 'php_ver_incompatible')); |
|
| 42 | + add_filter('plugin_action_links', array($this, 'menu_page_link'), 10, 2); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | unload_textdomain($this->text_domain); |
| 57 | 57 | load_textdomain($this->text_domain, PLUGIN_LN . 'textdomain-' . $locale . '.mo'); |
| 58 | - load_plugin_textdomain( $this->text_domain, false, PLUGIN_LN ); |
|
| 58 | + load_plugin_textdomain($this->text_domain, false, PLUGIN_LN); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function php_ver_incompatible() { |
| 68 | 68 | |
| 69 | - if ( version_compare( phpversion(), $this->php_ver_allowed, '<' ) ) : |
|
| 70 | - $text = __( 'The Plugin can\'t be activated because your PHP version', 'textdomain' ); |
|
| 71 | - $text_last = __( 'is less than required '.$this->php_ver_allowed.'. See more information', 'textdomain' ); |
|
| 69 | + if (version_compare(phpversion(), $this->php_ver_allowed, '<')) : |
|
| 70 | + $text = __('The Plugin can\'t be activated because your PHP version', 'textdomain'); |
|
| 71 | + $text_last = __('is less than required ' . $this->php_ver_allowed . '. See more information', 'textdomain'); |
|
| 72 | 72 | $text_link = 'php.net/eol.php'; ?> |
| 73 | 73 | |
| 74 | 74 | <div id="message" class="updated notice notice-success is-dismissible"> |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return Array |
| 91 | 91 | */ |
| 92 | - public function menu_page_link( $links, $file ) { |
|
| 92 | + public function menu_page_link($links, $file) { |
|
| 93 | 93 | |
| 94 | 94 | if ($this->plugin_page_links) { |
| 95 | 95 | static $this_plugin; |
| 96 | - if ( ! $this_plugin ) { |
|
| 96 | + if ( ! $this_plugin) { |
|
| 97 | 97 | $this_plugin = PLUGIN_FILE; |
| 98 | 98 | } |
| 99 | - if ( $file == $this_plugin ) { |
|
| 99 | + if ($file == $this_plugin) { |
|
| 100 | 100 | $shift_link = array(); |
| 101 | 101 | foreach ($this->plugin_page_links as $value) { |
| 102 | - $shift_link[] = '<a href="'.$value['slug'].'">'.$value['label'].'</a>'; |
|
| 102 | + $shift_link[] = '<a href="' . $value['slug'] . '">' . $value['label'] . '</a>'; |
|
| 103 | 103 | } |
| 104 | - foreach( $shift_link as $val ) { |
|
| 105 | - array_unshift( $links, $val ); |
|
| 104 | + foreach ($shift_link as $val) { |
|
| 105 | + array_unshift($links, $val); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | return $links; |
@@ -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 | * Implimentation of WordPress inbuilt functions for plugin activation. |
@@ -44,13 +44,13 @@ |
||
| 44 | 44 | global $wpdb; |
| 45 | 45 | $wpdb->hide_errors(); |
| 46 | 46 | $collate = ""; |
| 47 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
| 47 | + if ( $wpdb->has_cap( 'collation' ) ) { |
|
| 48 | 48 | if( ! empty($wpdb->charset ) ) |
| 49 | 49 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
| 50 | 50 | if( ! empty($wpdb->collate ) ) |
| 51 | 51 | $collate .= " COLLATE $wpdb->collate"; |
| 52 | - } |
|
| 53 | - require_once( $this->up_path ); |
|
| 52 | + } |
|
| 53 | + require_once( $this->up_path ); |
|
| 54 | 54 | return $collate; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -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 |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Nirjhar Lo |
| 8 | 8 | * @package wp-plugin-framework |
| 9 | 9 | */ |
| 10 | -if ( ! class_exists( 'PLUGIN_DB' ) ) { |
|
| 10 | +if ( ! class_exists('PLUGIN_DB')) { |
|
| 11 | 11 | |
| 12 | 12 | class PLUGIN_DB { |
| 13 | 13 | |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | global $wpdb; |
| 45 | 45 | $wpdb->hide_errors(); |
| 46 | 46 | $this->table_name = $wpdb->prefix . $this->table; |
| 47 | - update_option( '_plugin_db_exist', 0 ); |
|
| 48 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '$this->table_name'" ) != $this->table_name ) { |
|
| 49 | - $execute_sql = $this->execute( $this->table_name, $this->collate(), $this->sql ); |
|
| 50 | - dbDelta( $execute_sql ); |
|
| 47 | + update_option('_plugin_db_exist', 0); |
|
| 48 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { |
|
| 49 | + $execute_sql = $this->execute($this->table_name, $this->collate(), $this->sql); |
|
| 50 | + dbDelta($execute_sql); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | global $wpdb; |
| 63 | 63 | $wpdb->hide_errors(); |
| 64 | 64 | $collate = ""; |
| 65 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
| 66 | - if( ! empty($wpdb->charset ) ) |
|
| 65 | + if ($wpdb->has_cap('collation')) { |
|
| 66 | + if ( ! empty($wpdb->charset)) |
|
| 67 | 67 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
| 68 | - if( ! empty($wpdb->collate ) ) |
|
| 68 | + if ( ! empty($wpdb->collate)) |
|
| 69 | 69 | $collate .= " COLLATE $wpdb->collate"; |
| 70 | 70 | } |
| 71 | - require_once( $this->up_path ); |
|
| 71 | + require_once($this->up_path); |
|
| 72 | 72 | return $collate; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return String |
| 84 | 84 | */ |
| 85 | - public function execute( $table_name, $collate, $sql ) { |
|
| 85 | + public function execute($table_name, $collate, $sql) { |
|
| 86 | 86 | |
| 87 | 87 | return "CREATE TABLE $table_name ( $sql ) $collate;"; |
| 88 | 88 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | global $wpdb; |
| 99 | 99 | |
| 100 | 100 | $this->table_name = $wpdb->prefix . $this->table; |
| 101 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '$this->table_name'" ) == $this->table_name ) { |
|
| 101 | + if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") == $this->table_name) { |
|
| 102 | 102 | |
| 103 | - update_option( '_plugin_db_exist', 1 ); |
|
| 103 | + update_option('_plugin_db_exist', 1); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -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; |
@@ -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 |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Nirjhar Lo |
| 8 | 8 | * @package wp-plugin-framework |
| 9 | 9 | */ |
| 10 | -if ( ! class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
| 10 | +if ( ! class_exists('PLUGIN_SHORTCODE')) { |
|
| 11 | 11 | |
| 12 | 12 | class PLUGIN_SHORTCODE { |
| 13 | 13 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - add_shortcode( 'shortcode_name', array( $this, 'cb' ) ); |
|
| 21 | + add_shortcode('shortcode_name', array($this, 'cb')); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function cb($atts) { |
| 32 | 32 | |
| 33 | - $data = shortcode_atts( array( |
|
| 33 | + $data = shortcode_atts(array( |
|
| 34 | 34 | 'type' => 'zip', |
| 35 | - ), $atts ); |
|
| 35 | + ), $atts); |
|
| 36 | 36 | |
| 37 | 37 | return $this->html(); |
| 38 | 38 | } |
@@ -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 |
@@ -49,24 +49,24 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function labels() { |
| 51 | 51 | |
| 52 | - $labels = array( |
|
| 53 | - 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
| 54 | - 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
| 55 | - 'menu_name' => __( '', 'textdomain' ), |
|
| 56 | - 'parent_item_colon' => __( '', 'textdomain' ), |
|
| 57 | - 'all_items' => __( '', 'textdomain' ), |
|
| 58 | - 'view_item' => __( '', 'textdomain' ), |
|
| 59 | - 'add_new_item' => __( '', 'textdomain' ), |
|
| 60 | - 'add_new' => __( '', 'textdomain' ), |
|
| 61 | - 'edit_item' => __( '', 'textdomain' ), |
|
| 62 | - 'update_item' => __( '', 'textdomain' ), |
|
| 63 | - 'search_items' => __( '', 'textdomain' ), |
|
| 64 | - 'not_found' => __( '', 'textdomain' ), |
|
| 65 | - 'not_found_in_trash' => __( '', 'textdomain' ), |
|
| 66 | - ); |
|
| 67 | - |
|
| 68 | - return $labels; |
|
| 69 | - } |
|
| 52 | + $labels = array( |
|
| 53 | + 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
| 54 | + 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
| 55 | + 'menu_name' => __( '', 'textdomain' ), |
|
| 56 | + 'parent_item_colon' => __( '', 'textdomain' ), |
|
| 57 | + 'all_items' => __( '', 'textdomain' ), |
|
| 58 | + 'view_item' => __( '', 'textdomain' ), |
|
| 59 | + 'add_new_item' => __( '', 'textdomain' ), |
|
| 60 | + 'add_new' => __( '', 'textdomain' ), |
|
| 61 | + 'edit_item' => __( '', 'textdomain' ), |
|
| 62 | + 'update_item' => __( '', 'textdomain' ), |
|
| 63 | + 'search_items' => __( '', 'textdomain' ), |
|
| 64 | + 'not_found' => __( '', 'textdomain' ), |
|
| 65 | + 'not_found_in_trash' => __( '', 'textdomain' ), |
|
| 66 | + ); |
|
| 67 | + |
|
| 68 | + return $labels; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -76,42 +76,42 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return Array |
| 78 | 78 | */ |
| 79 | - public function args( $labels ) { |
|
| 80 | - |
|
| 81 | - $args = array( |
|
| 82 | - 'label' => __( '', 'textdomain' ), |
|
| 83 | - 'description' => __( '', 'textdomain' ), |
|
| 84 | - 'labels' => $labels, |
|
| 85 | - 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
| 86 | - 'taxonomies' => array( 'topics', 'post_tag' ), |
|
| 87 | - 'hierarchical' => true, |
|
| 88 | - 'public' => true, |
|
| 79 | + public function args( $labels ) { |
|
| 80 | + |
|
| 81 | + $args = array( |
|
| 82 | + 'label' => __( '', 'textdomain' ), |
|
| 83 | + 'description' => __( '', 'textdomain' ), |
|
| 84 | + 'labels' => $labels, |
|
| 85 | + 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
| 86 | + 'taxonomies' => array( 'topics', 'post_tag' ), |
|
| 87 | + 'hierarchical' => true, |
|
| 88 | + 'public' => true, |
|
| 89 | 89 | 'rewrite' => array( 'slug' => 'slug_name' ), |
| 90 | - 'show_ui' => true, |
|
| 91 | - 'show_in_menu' => true, |
|
| 90 | + 'show_ui' => true, |
|
| 91 | + 'show_in_menu' => true, |
|
| 92 | 92 | 'menu_icon' => 'data:image/svg+xml;base64,' . self::$menu_svg, |
| 93 | - 'show_in_nav_menus' => true, |
|
| 94 | - 'show_in_admin_bar' => true, |
|
| 95 | - 'menu_position' => 5, |
|
| 96 | - 'can_export' => true, |
|
| 97 | - 'has_archive' => true, |
|
| 98 | - 'exclude_from_search' => false, |
|
| 99 | - 'publicly_queryable' => true, |
|
| 100 | - 'capability_type' => 'post', |
|
| 101 | - 'show_in_rest' => true, |
|
| 102 | - ); |
|
| 103 | - |
|
| 104 | - return $args; |
|
| 105 | - } |
|
| 93 | + 'show_in_nav_menus' => true, |
|
| 94 | + 'show_in_admin_bar' => true, |
|
| 95 | + 'menu_position' => 5, |
|
| 96 | + 'can_export' => true, |
|
| 97 | + 'has_archive' => true, |
|
| 98 | + 'exclude_from_search' => false, |
|
| 99 | + 'publicly_queryable' => true, |
|
| 100 | + 'capability_type' => 'post', |
|
| 101 | + 'show_in_rest' => true, |
|
| 102 | + ); |
|
| 103 | + |
|
| 104 | + return $args; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | - * Modify the cpt messages |
|
| 109 | + * Modify the cpt messages |
|
| 110 | 110 | * |
| 111 | 111 | * @param Array $messages |
| 112 | 112 | * |
| 113 | 113 | * @return Array |
| 114 | - */ |
|
| 114 | + */ |
|
| 115 | 115 | public function cpt_updated_messages( $messages ) { |
| 116 | 116 | |
| 117 | 117 | global $post, $post_ID; |
@@ -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 | * Custom post type class |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Nirjhar Lo |
| 8 | 8 | * @package wp-plugin-framework |
| 9 | 9 | */ |
| 10 | -if ( ! class_exists( 'PLUGIN_CPT' ) ) { |
|
| 10 | +if ( ! class_exists('PLUGIN_CPT')) { |
|
| 11 | 11 | |
| 12 | 12 | class PLUGIN_CPT { |
| 13 | 13 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function __construct() { |
| 36 | 36 | |
| 37 | 37 | $this->labels = $this->labels(); |
| 38 | - $this->args = $this->args( $this->labels ); |
|
| 38 | + $this->args = $this->args($this->labels); |
|
| 39 | 39 | |
| 40 | 40 | //register_post_type( 'cpt_name', $this->args ); |
| 41 | 41 | //add_filter( 'post_updated_messages', array( $this, 'group_updated_messages' ) ); |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | public function labels() { |
| 51 | 51 | |
| 52 | 52 | $labels = array( |
| 53 | - 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
| 54 | - 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
| 55 | - 'menu_name' => __( '', 'textdomain' ), |
|
| 56 | - 'parent_item_colon' => __( '', 'textdomain' ), |
|
| 57 | - 'all_items' => __( '', 'textdomain' ), |
|
| 58 | - 'view_item' => __( '', 'textdomain' ), |
|
| 59 | - 'add_new_item' => __( '', 'textdomain' ), |
|
| 60 | - 'add_new' => __( '', 'textdomain' ), |
|
| 61 | - 'edit_item' => __( '', 'textdomain' ), |
|
| 62 | - 'update_item' => __( '', 'textdomain' ), |
|
| 63 | - 'search_items' => __( '', 'textdomain' ), |
|
| 64 | - 'not_found' => __( '', 'textdomain' ), |
|
| 65 | - 'not_found_in_trash' => __( '', 'textdomain' ), |
|
| 53 | + 'name' => _x('', 'Post Type General Name', 'textdomain'), |
|
| 54 | + 'singular_name' => _x('', 'Post Type Singular Name', 'textdomain'), |
|
| 55 | + 'menu_name' => __('', 'textdomain'), |
|
| 56 | + 'parent_item_colon' => __('', 'textdomain'), |
|
| 57 | + 'all_items' => __('', 'textdomain'), |
|
| 58 | + 'view_item' => __('', 'textdomain'), |
|
| 59 | + 'add_new_item' => __('', 'textdomain'), |
|
| 60 | + 'add_new' => __('', 'textdomain'), |
|
| 61 | + 'edit_item' => __('', 'textdomain'), |
|
| 62 | + 'update_item' => __('', 'textdomain'), |
|
| 63 | + 'search_items' => __('', 'textdomain'), |
|
| 64 | + 'not_found' => __('', 'textdomain'), |
|
| 65 | + 'not_found_in_trash' => __('', 'textdomain'), |
|
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | return $labels; |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return Array |
| 78 | 78 | */ |
| 79 | - public function args( $labels ) { |
|
| 79 | + public function args($labels) { |
|
| 80 | 80 | |
| 81 | 81 | $args = array( |
| 82 | - 'label' => __( '', 'textdomain' ), |
|
| 83 | - 'description' => __( '', 'textdomain' ), |
|
| 82 | + 'label' => __('', 'textdomain'), |
|
| 83 | + 'description' => __('', 'textdomain'), |
|
| 84 | 84 | 'labels' => $labels, |
| 85 | - 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
| 86 | - 'taxonomies' => array( 'topics', 'post_tag' ), |
|
| 85 | + 'supports' => array('title', 'editor', 'thumbnail'), |
|
| 86 | + 'taxonomies' => array('topics', 'post_tag'), |
|
| 87 | 87 | 'hierarchical' => true, |
| 88 | 88 | 'public' => true, |
| 89 | - 'rewrite' => array( 'slug' => 'slug_name' ), |
|
| 89 | + 'rewrite' => array('slug' => 'slug_name'), |
|
| 90 | 90 | 'show_ui' => true, |
| 91 | 91 | 'show_in_menu' => true, |
| 92 | 92 | 'menu_icon' => 'data:image/svg+xml;base64,' . self::$menu_svg, |
@@ -112,22 +112,22 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return Array |
| 114 | 114 | */ |
| 115 | - public function cpt_updated_messages( $messages ) { |
|
| 115 | + public function cpt_updated_messages($messages) { |
|
| 116 | 116 | |
| 117 | 117 | global $post, $post_ID; |
| 118 | 118 | |
| 119 | 119 | $messages['cpt_name'] = array( |
| 120 | 120 | 0 => '', |
| 121 | - 1 => sprintf( __( 'CPT updated. <a href="%s">View CPT</a>', 'textdomain' ), esc_url( get_permalink( $post_ID ) ) ), |
|
| 122 | - 2 => __( 'field updated.', 'textdomain' ), |
|
| 123 | - 3 => __( 'field deleted.', 'textdomain' ), |
|
| 124 | - 4 => __( 'CPT updated.', 'textdomain' ), |
|
| 125 | - 5 => ( isset( $_GET['revision'] ) ? sprintf( __( 'CPT restored to revision from %s', 'textdomain' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false ), |
|
| 126 | - 6 => sprintf( __( 'CPT published. <a href="%s">View Cpt</a>', 'textdomain' ), esc_url( get_permalink( $post_ID ) ) ), |
|
| 127 | - 7 => __( 'CPT saved.', 'textdomain' ), |
|
| 128 | - 8 => sprintf( __( 'CPT submitted. <a target="_blank" href="%s">Preview cpt</a>', 'textdomain' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), |
|
| 129 | - 9 => sprintf( __( 'CPT scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview cpt</a>', 'textdomain' ), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ) ), |
|
| 130 | - 10 => sprintf( __( 'CPT draft updated. <a target="_blank" href="%s">Preview cpt</a>', 'textdomain' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), |
|
| 121 | + 1 => sprintf(__('CPT updated. <a href="%s">View CPT</a>', 'textdomain'), esc_url(get_permalink($post_ID))), |
|
| 122 | + 2 => __('field updated.', 'textdomain'), |
|
| 123 | + 3 => __('field deleted.', 'textdomain'), |
|
| 124 | + 4 => __('CPT updated.', 'textdomain'), |
|
| 125 | + 5 => (isset($_GET['revision']) ? sprintf(__('CPT restored to revision from %s', 'textdomain'), wp_post_revision_title((int) $_GET['revision'], false)) : false), |
|
| 126 | + 6 => sprintf(__('CPT published. <a href="%s">View Cpt</a>', 'textdomain'), esc_url(get_permalink($post_ID))), |
|
| 127 | + 7 => __('CPT saved.', 'textdomain'), |
|
| 128 | + 8 => sprintf(__('CPT submitted. <a target="_blank" href="%s">Preview cpt</a>', 'textdomain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))), |
|
| 129 | + 9 => sprintf(__('CPT scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview cpt</a>', 'textdomain'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post_ID))), |
|
| 130 | + 10 => sprintf(__('CPT draft updated. <a target="_blank" href="%s">Preview cpt</a>', 'textdomain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))), |
|
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | return $messages; |
@@ -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 | * Custom post type class |
@@ -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 | * Main plugin object to define the plugin |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Nirjhar Lo |
| 9 | 9 | * @package wp-plugin-framework |
| 10 | 10 | */ |
| 11 | -if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
|
| 11 | +if ( ! class_exists('PLUGIN_BUILD')) { |
|
| 12 | 12 | |
| 13 | 13 | final class PLUGIN_BUILD { |
| 14 | 14 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function instance() { |
| 71 | 71 | |
| 72 | - if ( is_null( self::$_instance ) ) { |
|
| 72 | + if (is_null(self::$_instance)) { |
|
| 73 | 73 | self::$_instance = new self(); |
| 74 | 74 | self::$_instance->init(); |
| 75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | //If CPT exists, include taht and flush the rewrite rules |
| 98 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
| 98 | + if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT(); |
|
| 99 | 99 | flush_rewrite_rules(); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function cron_activation() { |
| 109 | 109 | |
| 110 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
| 110 | + if (class_exists('PLUGIN_CRON')) { |
|
| 111 | 111 | |
| 112 | 112 | $cron = new PLUGIN_CRON(); |
| 113 | 113 | $schedule = $cron->schedule_task( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function db_install() { |
| 132 | 132 | |
| 133 | - if ( class_exists( 'PLUGIN_DB' ) ) { |
|
| 133 | + if (class_exists('PLUGIN_DB')) { |
|
| 134 | 134 | |
| 135 | 135 | $db = new PLUGIN_DB(); |
| 136 | 136 | $db->table = self::$plugin_table; |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | $db->build(); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if (get_option( '_plugin_db_exist') == '0' ) { |
|
| 144 | - add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
|
| 143 | + if (get_option('_plugin_db_exist') == '0') { |
|
| 144 | + add_action('admin_notices', array($this, 'db_error_msg')); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $options = array( |
| 148 | - array( 'option_name', '__value__' ), |
|
| 148 | + array('option_name', '__value__'), |
|
| 149 | 149 | ); |
| 150 | - foreach ( $options as $value ) { |
|
| 151 | - update_option( $value[0], $value[1] ); |
|
| 150 | + foreach ($options as $value) { |
|
| 151 | + update_option($value[0], $value[1]); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function db_error_msg() { ?> |
| 162 | 162 | |
| 163 | 163 | <div class="notice notice-error is-dismissible"> |
| 164 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
| 164 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
| 165 | 165 | </div> |
| 166 | 166 | <?php |
| 167 | 167 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | $table_name = self::$plugin_table; |
| 178 | 178 | |
| 179 | 179 | global $wpdb; |
| 180 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" ); |
|
| 180 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name"); |
|
| 181 | 181 | |
| 182 | 182 | $options = array( |
| 183 | 183 | '_plugin_db_exist' |
| 184 | 184 | ); |
| 185 | - foreach ( $options as $value ) { |
|
| 186 | - delete_option( $value ); |
|
| 185 | + foreach ($options as $value) { |
|
| 186 | + delete_option($value); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function custom_cron_hook_cb() { |
| 208 | 208 | |
| 209 | - add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) ); |
|
| 209 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function cron_uninstall() { |
| 219 | 219 | |
| 220 | - wp_clear_scheduled_hook( 'custom_cron_hook' ); |
|
| 220 | + wp_clear_scheduled_hook('custom_cron_hook'); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function cpt() { |
| 230 | 230 | |
| 231 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
| 231 | + if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT(); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function scripts() { |
| 241 | 241 | |
| 242 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
| 242 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function settings() { |
| 252 | 252 | |
| 253 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
| 253 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function widgets() { |
| 263 | 263 | |
| 264 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
| 264 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function metabox() { |
| 274 | 274 | |
| 275 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
| 275 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function shortcode() { |
| 285 | 285 | |
| 286 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
| 286 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | |
@@ -295,14 +295,14 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function functionality() { |
| 297 | 297 | |
| 298 | - require_once( 'src/class-install.php' ); |
|
| 299 | - require_once( 'src/class-db.php' ); |
|
| 300 | - require_once( 'src/class-query.php' ); |
|
| 301 | - require_once( 'src/class-settings.php' ); |
|
| 302 | - require_once( 'src/class-widget.php' ); |
|
| 303 | - require_once( 'src/class-metabox.php' ); |
|
| 304 | - require_once( 'src/class-shortcode.php' ); |
|
| 305 | - require_once( 'src/class-cpt.php' ); |
|
| 298 | + require_once('src/class-install.php'); |
|
| 299 | + require_once('src/class-db.php'); |
|
| 300 | + require_once('src/class-query.php'); |
|
| 301 | + require_once('src/class-settings.php'); |
|
| 302 | + require_once('src/class-widget.php'); |
|
| 303 | + require_once('src/class-metabox.php'); |
|
| 304 | + require_once('src/class-shortcode.php'); |
|
| 305 | + require_once('src/class-cpt.php'); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -314,12 +314,12 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function helpers() { |
| 316 | 316 | |
| 317 | - require_once( 'lib/class-cron.php' ); |
|
| 318 | - require_once( 'lib/class-api.php' ); |
|
| 319 | - require_once( 'lib/class-table.php' ); |
|
| 320 | - require_once( 'lib/class-ajax.php' ); |
|
| 321 | - require_once( 'lib/class-upload.php' ); |
|
| 322 | - require_once( 'lib/class-script.php' ); |
|
| 317 | + require_once('lib/class-cron.php'); |
|
| 318 | + require_once('lib/class-api.php'); |
|
| 319 | + require_once('lib/class-table.php'); |
|
| 320 | + require_once('lib/class-ajax.php'); |
|
| 321 | + require_once('lib/class-upload.php'); |
|
| 322 | + require_once('lib/class-script.php'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -333,17 +333,17 @@ discard block |
||
| 333 | 333 | $this->helpers(); |
| 334 | 334 | $this->functionality(); |
| 335 | 335 | |
| 336 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
| 337 | - register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) ); |
|
| 336 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
| 337 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
| 338 | 338 | |
| 339 | 339 | //remove the DB and CORN upon uninstallation |
| 340 | 340 | //using $this won't work here. |
| 341 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); |
|
| 342 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
| 341 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); |
|
| 342 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
| 343 | 343 | |
| 344 | - add_action( 'init', array( $this, 'installation' ) ); |
|
| 345 | - add_action( 'init', array( $this, 'custom_cron_hook_cb' ) ); |
|
| 346 | - add_action( 'init', array( $this, 'cpt' ) ); |
|
| 344 | + add_action('init', array($this, 'installation')); |
|
| 345 | + add_action('init', array($this, 'custom_cron_hook_cb')); |
|
| 346 | + add_action('init', array($this, 'cpt')); |
|
| 347 | 347 | |
| 348 | 348 | $this->scripts(); |
| 349 | 349 | $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 |
@@ -95,7 +97,9 @@ discard block |
||
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | //If CPT exists, include taht and flush the rewrite rules |
| 98 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
| 100 | + if ( class_exists( 'PLUGIN_CPT' ) ) { |
|
| 101 | + new PLUGIN_CPT(); |
|
| 102 | + } |
|
| 99 | 103 | flush_rewrite_rules(); |
| 100 | 104 | } |
| 101 | 105 | |
@@ -228,7 +232,9 @@ discard block |
||
| 228 | 232 | */ |
| 229 | 233 | public function cpt() { |
| 230 | 234 | |
| 231 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
| 235 | + if ( class_exists( 'PLUGIN_CPT' ) ) { |
|
| 236 | + new PLUGIN_CPT(); |
|
| 237 | + } |
|
| 232 | 238 | } |
| 233 | 239 | |
| 234 | 240 | |
@@ -239,7 +245,9 @@ discard block |
||
| 239 | 245 | */ |
| 240 | 246 | public function scripts() { |
| 241 | 247 | |
| 242 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
| 248 | + if ( class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
| 249 | + new PLUGIN_SCRIPT(); |
|
| 250 | + } |
|
| 243 | 251 | } |
| 244 | 252 | |
| 245 | 253 | |
@@ -250,7 +258,9 @@ discard block |
||
| 250 | 258 | */ |
| 251 | 259 | public function settings() { |
| 252 | 260 | |
| 253 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
| 261 | + if ( class_exists( 'PLUGIN_SETTINGS' ) ) { |
|
| 262 | + new PLUGIN_SETTINGS(); |
|
| 263 | + } |
|
| 254 | 264 | } |
| 255 | 265 | |
| 256 | 266 | |
@@ -261,7 +271,9 @@ discard block |
||
| 261 | 271 | */ |
| 262 | 272 | public function widgets() { |
| 263 | 273 | |
| 264 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
| 274 | + if ( class_exists( 'PLUGIN_WIDGET' ) ) { |
|
| 275 | + new PLUGIN_WIDGET(); |
|
| 276 | + } |
|
| 265 | 277 | } |
| 266 | 278 | |
| 267 | 279 | |
@@ -272,7 +284,9 @@ discard block |
||
| 272 | 284 | */ |
| 273 | 285 | public function metabox() { |
| 274 | 286 | |
| 275 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
| 287 | + if ( class_exists( 'PLUGIN_METABOX' ) ) { |
|
| 288 | + new PLUGIN_METABOX(); |
|
| 289 | + } |
|
| 276 | 290 | } |
| 277 | 291 | |
| 278 | 292 | |
@@ -283,7 +297,9 @@ discard block |
||
| 283 | 297 | */ |
| 284 | 298 | public function shortcode() { |
| 285 | 299 | |
| 286 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
| 300 | + if ( class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
| 301 | + new PLUGIN_SHORTCODE(); |
|
| 302 | + } |
|
| 287 | 303 | } |
| 288 | 304 | |
| 289 | 305 | |