From 401828178bdc62f5566911d27a6ec23e01159ef0 Mon Sep 17 00:00:00 2001 From: jorge-vitrubio Date: Wed, 30 Mar 2022 13:11:52 +0200 Subject: [PATCH] all plugin add into includes folder --- arcHIVE-wp-plugin.php | 36 +++++++------------- assets/css/arcHIVE-wp-plugin.css | 32 ----------------- assets/css/arcHIVE-wpplugin-admin-styles.css | 20 +++++++++++ assets/css/arcHIVE-wpplugin-styles.css | 20 +++++++++++ includes/arcHIVE-admin-stylesheet.php | 26 ++++++++++++++ includes/arcHIVE-enable-svg.php | 27 +++++++++++++++ includes/arcHIVE-init-textdomain.php | 26 ++++++++++++++ includes/arcHIVE-public-stylesheet.php | 26 ++++++++++++++ 8 files changed, 158 insertions(+), 55 deletions(-) delete mode 100644 assets/css/arcHIVE-wp-plugin.css create mode 100644 assets/css/arcHIVE-wpplugin-admin-styles.css create mode 100644 assets/css/arcHIVE-wpplugin-styles.css create mode 100644 includes/arcHIVE-admin-stylesheet.php create mode 100644 includes/arcHIVE-enable-svg.php create mode 100644 includes/arcHIVE-init-textdomain.php create mode 100644 includes/arcHIVE-public-stylesheet.php diff --git a/arcHIVE-wp-plugin.php b/arcHIVE-wp-plugin.php index 606d6f2..914307f 100644 --- a/arcHIVE-wp-plugin.php +++ b/arcHIVE-wp-plugin.php @@ -46,32 +46,22 @@ if ( ! defined( 'WPINC' ) ) { */ define( 'ARCHIVE_WPPLUGIN_VERSION', '1.1.0' ); - /* * - * Load translation, if it exists + * define Plugin path + * https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-1113 * * * * * * * * * * * * * * * * * * */ +define( 'ARCHIVE_WPPLUGIN_PATH', plugin_dir_path( __FILE__ ) ); - function arcHIVE_init_textdomain() { - $plugin_dir = basename(dirname(__FILE__)); - load_plugin_textdomain( 'archive-wpplugin', null, $plugin_dir.'/assets/languages/' ); - } - add_action('plugins_loaded', 'arcHIVE_init_textdomain'); +include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-init-textdomain.php'); - /* * - * Add mimetypes support: svg - * * * * * * * * * * * * * * * * * * */ +include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-enable-svg.php'); - function arcHIVE_enable_mime_types( $mimes ) { - $mimes['svg'] = 'image/svg+xml'; - return $mimes; - } - add_filter('upload_mimes', 'arcHIVE_enable_mime_types'); - - - /** - * Registers stylesheet for a custom plugin. - */ -function arcHIVE_wp_plugin_styles_admin() { - add_editor_style( 'assets/css/arcHIVE-wp-plugin.css' ); +if ( is_admin() ) { + //include_once( plugin_dir_path( __FILE__ ) . 'includes/arcHIVE-admin-stylesheet.php' ); + include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-admin-stylesheet.php'); +} else { + //include_once( plugin_dir_path( __FILE__ ) . 'includes/arcHIVE-public-stylesheet.php' ); + include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-public-stylesheet.php'); } -add_action( 'admin_init', 'arcHIVE_wp_plugin_styles_admin' ); + +//include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-custom-post-type-resources.php'); diff --git a/assets/css/arcHIVE-wp-plugin.css b/assets/css/arcHIVE-wp-plugin.css deleted file mode 100644 index f7e7002..0000000 --- a/assets/css/arcHIVE-wp-plugin.css +++ /dev/null @@ -1,32 +0,0 @@ -/* #bfr_meta{ - overflow: hidden; - padding-bottom: 1em; -} - -#bfr_meta p{ - clear: both; -} - -.bfr-row-title{ - display: block; - float: left; - width: 200px; -} - -.bfr-row-content{ - float: left; - padding-bottom: 1em; -} - -.bfr-row-content label{ - display: block; - line-height: 1.75em; -} */ - -.button a, .button a:not(.button) { - background-color: transparent !important; -} - -.button a:hover, .button a:not(.button):hover { - background-color: transparent !important; -} diff --git a/assets/css/arcHIVE-wpplugin-admin-styles.css b/assets/css/arcHIVE-wpplugin-admin-styles.css new file mode 100644 index 0000000..0c0ed31 --- /dev/null +++ b/assets/css/arcHIVE-wpplugin-admin-styles.css @@ -0,0 +1,20 @@ +/** + * admin css styles. + * + * @link https://arc-hive.zone + * @since 1.1.0 + * + * @package archive_wpplugin + * @subpackage archive_wpplugin/includes + */ + +/** + * admin css styles. + * + * This class defines all code necessary to run during the plugin's activation. + * + * @since 1.1.0 + * @package archive_wpplugin + * @subpackage archive_wpplugin/includes + * @author Jorge - vitrubio.net + */ diff --git a/assets/css/arcHIVE-wpplugin-styles.css b/assets/css/arcHIVE-wpplugin-styles.css new file mode 100644 index 0000000..f7400e3 --- /dev/null +++ b/assets/css/arcHIVE-wpplugin-styles.css @@ -0,0 +1,20 @@ +/** + * public css styles. + * + * @link https://arc-hive.zone + * @since 1.1.0 + * + * @package archive_wpplugin + * @subpackage archive_wpplugin/includes + */ + +/** + * public css styles. + * + * This class defines all code necessary to run during the plugin's activation. + * + * @since 1.1.0 + * @package archive_wpplugin + * @subpackage archive_wpplugin/includes + * @author Jorge - vitrubio.net + */ diff --git a/includes/arcHIVE-admin-stylesheet.php b/includes/arcHIVE-admin-stylesheet.php new file mode 100644 index 0000000..1d8e527 --- /dev/null +++ b/includes/arcHIVE-admin-stylesheet.php @@ -0,0 +1,26 @@ + + */ + +function arcHIVE_wpplugin_admin_styles() { + add_editor_style( 'assets/css/arcHIVE-wpplugin-admin-styles.css' ); +} +add_action( 'admin_init', 'arcHIVE_wpplugin_admin_styles' ); diff --git a/includes/arcHIVE-enable-svg.php b/includes/arcHIVE-enable-svg.php new file mode 100644 index 0000000..dcd6543 --- /dev/null +++ b/includes/arcHIVE-enable-svg.php @@ -0,0 +1,27 @@ + + */ + + function arcHIVE_enable_mime_types( $mimes ) { + $mimes['svg'] = 'image/svg+xml'; + return $mimes; + } + add_filter('upload_mimes', 'arcHIVE_enable_mime_types'); diff --git a/includes/arcHIVE-init-textdomain.php b/includes/arcHIVE-init-textdomain.php new file mode 100644 index 0000000..1c1f2ef --- /dev/null +++ b/includes/arcHIVE-init-textdomain.php @@ -0,0 +1,26 @@ + + */ + +function arcHIVE_init_textdomain() { + load_plugin_textdomain( 'archive-wpplugin', null, plugin_dir_path( __FILE__ ).'/assets/languages/' ); +} +add_action('plugins_loaded', 'arcHIVE_init_textdomain'); diff --git a/includes/arcHIVE-public-stylesheet.php b/includes/arcHIVE-public-stylesheet.php new file mode 100644 index 0000000..35f3cdb --- /dev/null +++ b/includes/arcHIVE-public-stylesheet.php @@ -0,0 +1,26 @@ + + */ + +function arcHIVE_wpplugin_public_styles() { + add_editor_style( 'assets/css/arcHIVE-wpplugin-styles.css' ); +} +add_action( 'admin_init', 'arcHIVE_wpplugin_public_styles' );