@@ -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 |
@@ -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 | * Plugin upload for WordPress front end or backend |
@@ -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_UPLOAD' ) ) { |
|
| 11 | +if ( ! class_exists('PLUGIN_UPLOAD')) { |
|
| 12 | 12 | |
| 13 | 13 | final class PLUGIN_UPLOAD { |
| 14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | |
| 23 | - if ( isset($_POST['UploadSubmit']) ) { |
|
| 23 | + if (isset($_POST['UploadSubmit'])) { |
|
| 24 | 24 | $this->upload_controller(); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | <form method="POST" action="" enctype="multipart/form-data"> |
| 39 | 39 | <input name="UploadFile" type="file" multiple="false"/> |
| 40 | - <?php submit_button( __( 'Upload', 'stv' ), 'secondary', 'UploadSubmit' ); ?> |
|
| 40 | + <?php submit_button(__('Upload', 'stv'), 'secondary', 'UploadSubmit'); ?> |
|
| 41 | 41 | </form> |
| 42 | 42 | <?php |
| 43 | 43 | } |
@@ -54,28 +54,28 @@ discard block |
||
| 54 | 54 | $type = $file['type']; |
| 55 | 55 | |
| 56 | 56 | // Check in your file type |
| 57 | - if( $type != 'application/_TYPE_' ) { |
|
| 58 | - add_action( 'admin_notices', array( $this, 'file_type_error_admin_notice' ) ); |
|
| 57 | + if ($type != 'application/_TYPE_') { |
|
| 58 | + add_action('admin_notices', array($this, 'file_type_error_admin_notice')); |
|
| 59 | 59 | } else { |
| 60 | 60 | |
| 61 | - if (!function_exists('wp_handle_upload')){ |
|
| 61 | + if ( ! function_exists('wp_handle_upload')) { |
|
| 62 | 62 | require_once(ABSPATH . 'wp-admin/includes/image.php'); |
| 63 | 63 | require_once(ABSPATH . 'wp-admin/includes/file.php'); |
| 64 | 64 | require_once(ABSPATH . 'wp-admin/includes/media.php'); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $overrides = array( 'test_form' => false); |
|
| 67 | + $overrides = array('test_form' => false); |
|
| 68 | 68 | $attachment = wp_handle_upload($file, $overrides); |
| 69 | 69 | |
| 70 | - if( is_array( $attachment_id ) && array_key_exists( 'path', $attachment ) ) { |
|
| 70 | + if (is_array($attachment_id) && array_key_exists('path', $attachment)) { |
|
| 71 | 71 | $upload_path = $attachment['path']; |
| 72 | 72 | |
| 73 | - add_action( 'admin_notices', array( $this, 'success_notice' ) ); |
|
| 73 | + add_action('admin_notices', array($this, 'success_notice')); |
|
| 74 | 74 | |
| 75 | 75 | // Use $upload_path for any purpose. For example storing temporarily |
| 76 | 76 | // update_option( 'some_token', $upload_path ); |
| 77 | 77 | } else { |
| 78 | - add_action( 'admin_notices', array( $this, 'file_error_admin_notice' ) ); |
|
| 78 | + add_action('admin_notices', array($this, 'file_error_admin_notice')); |
|
| 79 | 79 | $upload_path = false; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function file_type_error_admin_notice() { ?> |
| 91 | 91 | |
| 92 | 92 | <div class="notice notice-error is-dismissible"> |
| 93 | - <p><?php _e( 'Please Upload correct type of file only.', 'textdomain' ); ?></p> |
|
| 93 | + <p><?php _e('Please Upload correct type of file only.', 'textdomain'); ?></p> |
|
| 94 | 94 | </div> |
| 95 | 95 | <?php |
| 96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function file_error_admin_notice() { ?> |
| 105 | 105 | |
| 106 | 106 | <div class="notice notice-error is-dismissible"> |
| 107 | - <p><?php _e( 'File Upload failed.', 'textdomain' ); ?></p> |
|
| 107 | + <p><?php _e('File Upload failed.', 'textdomain'); ?></p> |
|
| 108 | 108 | </div> |
| 109 | 109 | <?php |
| 110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public function success_notice() { ?> |
| 119 | 119 | |
| 120 | 120 | <div class="notice notice-success is-dismissible"> |
| 121 | - <p><?php _e( 'Successfully saved file details.', 'textdomain' ); ?></p> |
|
| 121 | + <p><?php _e('Successfully saved file details.', 'textdomain'); ?></p> |
|
| 122 | 122 | </div> |
| 123 | 123 | <?php |
| 124 | 124 | } |
@@ -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,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,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 | } |
@@ -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 |
@@ -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,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,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 2 | +if ( ! defined('ABSPATH')) exit; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Widget 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_WIDGET' ) ) { |
|
| 11 | +if ( ! class_exists('PLUGIN_WIDGET')) { |
|
| 12 | 12 | |
| 13 | 13 | final class PLUGIN_WIDGET extends WP_WIDGET { |
| 14 | 14 | |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $widget_ops = array( |
| 24 | 24 | 'classname' => 'plugin_widget', |
| 25 | - 'description' => __( 'Plugin widget', 'textdomain' ), |
|
| 25 | + 'description' => __('Plugin widget', 'textdomain'), |
|
| 26 | 26 | ); |
| 27 | - parent::__construct( 'my_widget_id', __( 'Plugin widget', 'textdomain' ), $widget_ops ); |
|
| 27 | + parent::__construct('my_widget_id', __('Plugin widget', 'textdomain'), $widget_ops); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return Html |
| 38 | 38 | */ |
| 39 | - public function widget( $args, $instance ) { |
|
| 39 | + public function widget($args, $instance) { |
|
| 40 | 40 | |
| 41 | 41 | echo $args['before_widget']; |
| 42 | - if ( ! empty( $instance['title'] ) ) { |
|
| 43 | - echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; |
|
| 42 | + if ( ! empty($instance['title'])) { |
|
| 43 | + echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; |
|
| 44 | 44 | } |
| 45 | - echo esc_html__( 'Hello, World!', 'textdomain' ); |
|
| 45 | + echo esc_html__('Hello, World!', 'textdomain'); |
|
| 46 | 46 | echo $args['after_widget']; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return Html |
| 56 | 56 | */ |
| 57 | - public function form( $instance ) { |
|
| 57 | + public function form($instance) { |
|
| 58 | 58 | |
| 59 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Internal Link Master', 'textdomain' ); ?> |
|
| 59 | + $title = ! empty($instance['title']) ? $instance['title'] : esc_html__('Internal Link Master', 'textdomain'); ?> |
|
| 60 | 60 | <p> |
| 61 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'textdomain' ); ?></label> |
|
| 62 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"> |
|
| 61 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'textdomain'); ?></label> |
|
| 62 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>"> |
|
| 63 | 63 | </p> |
| 64 | 64 | <?php |
| 65 | 65 | } |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return Array |
| 75 | 75 | */ |
| 76 | - public function update( $new_instance, $old_instance ) { |
|
| 76 | + public function update($new_instance, $old_instance) { |
|
| 77 | 77 | |
| 78 | 78 | $instance = array(); |
| 79 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '' ); |
|
| 79 | + $instance['title'] = ( ! empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : ''); |
|
| 80 | 80 | return $instance; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -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. |
@@ -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; |
@@ -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 |
@@ -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( |
@@ -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 | |
@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE |
| 12 | 12 | * @package wp-plugin-framework |
| 13 | 13 | */ |
| 14 | -if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
|
| 14 | +if ( ! class_exists('PLUGIN_BUILD')) { |
|
| 15 | 15 | |
| 16 | 16 | final class PLUGIN_BUILD { |
| 17 | 17 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public static function instance() { |
| 74 | 74 | |
| 75 | - if ( is_null( self::$_instance ) ) { |
|
| 75 | + if (is_null(self::$_instance)) { |
|
| 76 | 76 | self::$_instance = new self(); |
| 77 | 77 | self::$_instance->init(); |
| 78 | 78 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function cron_activation() { |
| 108 | 108 | |
| 109 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
| 109 | + if (class_exists('PLUGIN_CRON')) { |
|
| 110 | 110 | |
| 111 | 111 | $cron = new PLUGIN_CRON(); |
| 112 | 112 | $schedule = $cron->schedule_task( |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function db_install() { |
| 131 | 131 | |
| 132 | - if ( class_exists( 'PLUGIN_DB' ) ) { |
|
| 132 | + if (class_exists('PLUGIN_DB')) { |
|
| 133 | 133 | |
| 134 | 134 | $db = new PLUGIN_DB(); |
| 135 | 135 | $db->table = self::$plugin_table; |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | $db->build(); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if (get_option( '_plugin_db_exist') == '0' ) { |
|
| 143 | - add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
|
| 142 | + if (get_option('_plugin_db_exist') == '0') { |
|
| 143 | + add_action('admin_notices', array($this, 'db_error_msg')); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $options = array( |
| 147 | - array( 'option_name', '__value__' ), |
|
| 147 | + array('option_name', '__value__'), |
|
| 148 | 148 | ); |
| 149 | - foreach ( $options as $value ) { |
|
| 150 | - update_option( $value[0], $value[1] ); |
|
| 149 | + foreach ($options as $value) { |
|
| 150 | + update_option($value[0], $value[1]); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | public function db_error_msg() { ?> |
| 161 | 161 | |
| 162 | 162 | <div class="notice notice-error is-dismissible"> |
| 163 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
| 163 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
| 164 | 164 | </div> |
| 165 | 165 | <?php |
| 166 | 166 | } |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | $table_name = self::$plugin_table; |
| 177 | 177 | |
| 178 | 178 | global $wpdb; |
| 179 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" ); |
|
| 179 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name"); |
|
| 180 | 180 | |
| 181 | 181 | $options = array( |
| 182 | 182 | '_plugin_db_exist' |
| 183 | 183 | ); |
| 184 | - foreach ( $options as $value ) { |
|
| 185 | - delete_option( $value ); |
|
| 184 | + foreach ($options as $value) { |
|
| 185 | + delete_option($value); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function custom_cron_hook_cb() { |
| 207 | 207 | |
| 208 | - add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) ); |
|
| 208 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function cron_uninstall() { |
| 218 | 218 | |
| 219 | - wp_clear_scheduled_hook( 'custom_cron_hook' ); |
|
| 219 | + wp_clear_scheduled_hook('custom_cron_hook'); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function scripts() { |
| 229 | 229 | |
| 230 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
| 230 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function settings() { |
| 240 | 240 | |
| 241 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
| 241 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function widgets() { |
| 251 | 251 | |
| 252 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
| 252 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function metabox() { |
| 262 | 262 | |
| 263 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
| 263 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function shortcode() { |
| 273 | 273 | |
| 274 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
| 274 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function functionality() { |
| 285 | 285 | |
| 286 | - require_once( 'src/install.php' ); |
|
| 287 | - require_once( 'src/db.php' ); |
|
| 288 | - require_once( 'src/query.php' ); |
|
| 289 | - require_once( 'src/settings.php' ); |
|
| 290 | - require_once( 'src/widget.php' ); |
|
| 291 | - require_once( 'src/metabox.php' ); |
|
| 292 | - require_once( 'src/shortcode.php' ); |
|
| 286 | + require_once('src/install.php'); |
|
| 287 | + require_once('src/db.php'); |
|
| 288 | + require_once('src/query.php'); |
|
| 289 | + require_once('src/settings.php'); |
|
| 290 | + require_once('src/widget.php'); |
|
| 291 | + require_once('src/metabox.php'); |
|
| 292 | + require_once('src/shortcode.php'); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function helpers() { |
| 303 | 303 | |
| 304 | - require_once( 'lib/cron.php' ); |
|
| 305 | - require_once( 'lib/api.php' ); |
|
| 306 | - require_once( 'lib/table.php' ); |
|
| 307 | - require_once( 'lib/ajax.php' ); |
|
| 308 | - require_once( 'lib/upload.php' ); |
|
| 309 | - require_once( 'lib/script.php' ); |
|
| 304 | + require_once('lib/cron.php'); |
|
| 305 | + require_once('lib/api.php'); |
|
| 306 | + require_once('lib/table.php'); |
|
| 307 | + require_once('lib/ajax.php'); |
|
| 308 | + require_once('lib/upload.php'); |
|
| 309 | + require_once('lib/script.php'); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
@@ -320,16 +320,16 @@ discard block |
||
| 320 | 320 | $this->helpers(); |
| 321 | 321 | $this->functionality(); |
| 322 | 322 | |
| 323 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
| 324 | - register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) ); |
|
| 323 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
| 324 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
| 325 | 325 | |
| 326 | 326 | //remove the DB and CORN upon uninstallation |
| 327 | 327 | //using $this won't work here. |
| 328 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); |
|
| 329 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
| 328 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); |
|
| 329 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
| 330 | 330 | |
| 331 | - add_action( 'init', array( $this, 'installation' ) ); |
|
| 332 | - add_action( 'init', array( $this, 'custom_cron_hook_cb' ) ); |
|
| 331 | + add_action('init', array($this, 'installation')); |
|
| 332 | + add_action('init', array($this, 'custom_cron_hook_cb')); |
|
| 333 | 333 | |
| 334 | 334 | $this->scripts(); |
| 335 | 335 | $this->widgets(); |
@@ -11,27 +11,27 @@ |
||
| 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' ); |
|
| 32 | +require_once('autoload.php'); |
|
| 33 | 33 | function plugin() { |
| 34 | - if ( class_exists( 'PLUGIN_BUILD' ) ) return PLUGIN_BUILD::instance(); |
|
| 34 | + if (class_exists('PLUGIN_BUILD')) return PLUGIN_BUILD::instance(); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | global $plugin; |
@@ -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 |
@@ -31,8 +33,10 @@ discard block |
||
| 31 | 33 | //The Plugin |
| 32 | 34 | require_once( 'autoload.php' ); |
| 33 | 35 | function plugin() { |
| 34 | - if ( class_exists( 'PLUGIN_BUILD' ) ) return PLUGIN_BUILD::instance(); |
|
| 35 | -} |
|
| 36 | + if ( class_exists( 'PLUGIN_BUILD' ) ) { |
|
| 37 | + return PLUGIN_BUILD::instance(); |
|
| 38 | + } |
|
| 39 | + } |
|
| 36 | 40 | |
| 37 | 41 | global $plugin; |
| 38 | 42 | $plugin = plugin(); ?> |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @version 1.2.1 |
| 17 | 17 | * @package wp-plugin-framework |
| 18 | 18 | */ |
| 19 | -if ( ! class_exists( 'PLUGIN_API' ) ) { |
|
| 19 | +if ( ! class_exists('PLUGIN_API')) { |
|
| 20 | 20 | |
| 21 | 21 | class PLUGIN_API { |
| 22 | 22 | |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $curl = curl_init(); |
| 92 | 92 | |
| 93 | - curl_setopt_array( $curl, $this->build() ); |
|
| 93 | + curl_setopt_array($curl, $this->build()); |
|
| 94 | 94 | |
| 95 | - $result = curl_exec( $curl ); |
|
| 96 | - $err = curl_error( $curl ); |
|
| 95 | + $result = curl_exec($curl); |
|
| 96 | + $err = curl_error($curl); |
|
| 97 | 97 | |
| 98 | - curl_close( $curl ); |
|
| 98 | + curl_close($curl); |
|
| 99 | 99 | |
| 100 | - if ( $err ) { |
|
| 100 | + if ($err) { |
|
| 101 | 101 | $result = "cURL Error #:" . $err; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function parse($data) { |
| 114 | 114 | |
| 115 | - call_user_func( array( $this, $this->data_type ), $data ); |
|
| 115 | + call_user_func(array($this, $this->data_type), $data); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return Array |
| 123 | 123 | */ |
| 124 | - public function xml( $data ) { |
|
| 124 | + public function xml($data) { |
|
| 125 | 125 | |
| 126 | - libxml_use_internal_errors( true ); |
|
| 127 | - $parsed = ( ! $data || $data == '' ? false : simplexml_load_string( $data ) ); |
|
| 126 | + libxml_use_internal_errors(true); |
|
| 127 | + $parsed = ( ! $data || $data == '' ? false : simplexml_load_string($data)); |
|
| 128 | 128 | |
| 129 | - if ( ! $parsed ) { |
|
| 129 | + if ( ! $parsed) { |
|
| 130 | 130 | return false; |
| 131 | 131 | libxml_clear_errors(); |
| 132 | 132 | } else { |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return Array |
| 142 | 142 | */ |
| 143 | - public function json( $data ) { |
|
| 143 | + public function json($data) { |
|
| 144 | 144 | |
| 145 | - $parsed = ( ! $data || $data == '' ? false : json_decode( $data, 1 ) ); |
|
| 145 | + $parsed = ( ! $data || $data == '' ? false : json_decode($data, 1)); |
|
| 146 | 146 | return $parsed; |
| 147 | 147 | } |
| 148 | 148 | } |