From e40e1e05d8baf22454986bcc2e2113b1b9eb0844 Mon Sep 17 00:00:00 2001 From: Anass Rahou Date: Wed, 23 Oct 2019 22:18:20 -0500 Subject: [PATCH 1/2] Enhance files requiring code --- wp-show-posts.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-show-posts.php b/wp-show-posts.php index d4426e0..8466a0d 100644 --- a/wp-show-posts.php +++ b/wp-show-posts.php @@ -24,16 +24,16 @@ require_once plugin_dir_path( __FILE__ ) . 'inc/image-resizer.php'; } -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/functions.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/compat.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/styling.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/deprecated.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/post-type.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/metabox.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/ajax.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/admin.php'; -require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/widget.php'; +require_once dirname( __FILE__ ) . '/inc/defaults.php'; +require_once dirname( __FILE__ ) . '/inc/functions.php'; +require_once dirname( __FILE__ ) . '/inc/compat.php'; +require_once dirname( __FILE__ ) . '/inc/styling.php'; +require_once dirname( __FILE__ ) . '/inc/deprecated.php'; +require_once dirname( __FILE__ ) . '/admin/post-type.php'; +require_once dirname( __FILE__ ) . '/admin/metabox.php'; +require_once dirname( __FILE__ ) . '/admin/ajax.php'; +require_once dirname( __FILE__ ) . '/admin/admin.php'; +require_once dirname( __FILE__ ) . '/admin/widget.php'; add_action( 'plugins_loaded', 'wpsp_load_textdomain' ); /** From 6b34f1f7a8e6651c319727b248f4a64f41a1c7a8 Mon Sep 17 00:00:00 2001 From: Anass Rahou Date: Sun, 27 Oct 2019 03:06:24 -0500 Subject: [PATCH 2/2] Define path plugin constant --- wp-show-posts.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/wp-show-posts.php b/wp-show-posts.php index 8466a0d..0cf3682 100644 --- a/wp-show-posts.php +++ b/wp-show-posts.php @@ -19,21 +19,24 @@ // Define the current version define( 'WPSP_VERSION', '1.1.3' ); +// Define the path of the plugin +define( 'WPSP_PATH', dirname( __FILE__ ) . '/' ); + // Add resizer script if ( ! class_exists( 'WPSP_Resize' ) ) { - require_once plugin_dir_path( __FILE__ ) . 'inc/image-resizer.php'; + require_once WPSP_PATH . 'inc/image-resizer.php'; } -require_once dirname( __FILE__ ) . '/inc/defaults.php'; -require_once dirname( __FILE__ ) . '/inc/functions.php'; -require_once dirname( __FILE__ ) . '/inc/compat.php'; -require_once dirname( __FILE__ ) . '/inc/styling.php'; -require_once dirname( __FILE__ ) . '/inc/deprecated.php'; -require_once dirname( __FILE__ ) . '/admin/post-type.php'; -require_once dirname( __FILE__ ) . '/admin/metabox.php'; -require_once dirname( __FILE__ ) . '/admin/ajax.php'; -require_once dirname( __FILE__ ) . '/admin/admin.php'; -require_once dirname( __FILE__ ) . '/admin/widget.php'; +require_once WPSP_PATH . 'inc/defaults.php'; +require_once WPSP_PATH . 'inc/functions.php'; +require_once WPSP_PATH . 'inc/compat.php'; +require_once WPSP_PATH . 'inc/styling.php'; +require_once WPSP_PATH . 'inc/deprecated.php'; +require_once WPSP_PATH . 'admin/post-type.php'; +require_once WPSP_PATH . 'admin/metabox.php'; +require_once WPSP_PATH . 'admin/ajax.php'; +require_once WPSP_PATH . 'admin/admin.php'; +require_once WPSP_PATH . 'admin/widget.php'; add_action( 'plugins_loaded', 'wpsp_load_textdomain' ); /**