diff --git a/includes/class-init.php b/includes/class-init.php index a8005d2a..efa6cf07 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -553,7 +553,6 @@ if ( ! class_exists( 'UM' ) ) { $this->builtin(); $this->form()->hooks(); $this->permalinks(); - $this->modal(); $this->cron(); $this->mobile(); $this->external_integrations(); @@ -879,6 +878,17 @@ if ( ! class_exists( 'UM' ) ) { return $this->admin()->enqueue(); } + /** + * @since 2.0 + * @deprecated 2.8.6 + * + * @return um\frontend\Modal + */ + function modal() { + _deprecated_function( __METHOD__, '2.8.6', 'UM()->frontend()->modal()' ); + return $this->frontend()->modal(); + } + /** * @since 2.0 @@ -1387,21 +1397,6 @@ if ( ! class_exists( 'UM' ) ) { return $this->classes['logout']; } - - /** - * @since 2.0 - * - * @return um\core\Modal - */ - function modal() { - if ( empty( $this->classes['modal'] ) ) { - $this->classes['modal'] = new um\core\Modal(); - } - - return $this->classes['modal']; - } - - /** * @since 2.0 * diff --git a/includes/core/class-modal.php b/includes/core/class-modal.php deleted file mode 100644 index 7b3554e2..00000000 --- a/includes/core/class-modal.php +++ /dev/null @@ -1,53 +0,0 @@ -get_priority() ); - } - - - /** - * @return int - */ - public function get_priority() { - return apply_filters( 'um_core_includes_modals_priority', 9 ); - } - - - /** - * Load modal content - */ - public function load_modal_content() { - if ( ! is_admin() ) { - $modal_templates = glob( UM_PATH . 'templates/modal/*.php' ); - $modal_templates = array_map( 'basename', $modal_templates ); - if ( ! empty( $modal_templates ) ) { - foreach ( $modal_templates as $modal_content ) { - UM()->get_template( 'modal/' . $modal_content, '', array(), true ); - } - } - } - } - - } -} diff --git a/includes/frontend/class-init.php b/includes/frontend/class-init.php index cc5fb68a..b34cd983 100644 --- a/includes/frontend/class-init.php +++ b/includes/frontend/class-init.php @@ -21,6 +21,7 @@ if ( ! class_exists( 'um\frontend\Init' ) ) { */ public function includes() { $this->enqueue(); + $this->modal(); $this->secure(); } @@ -37,6 +38,19 @@ if ( ! class_exists( 'um\frontend\Init' ) ) { return UM()->classes['um\frontend\enqueue']; } + /** + * @since 2.8.6 + * + * @return Modal + */ + public function modal() { + if ( empty( UM()->classes['um\frontend\modal'] ) ) { + UM()->classes['um\frontend\modal'] = new Modal(); + } + + return UM()->classes['um\frontend\modal']; + } + /** * @since 2.6.8 * diff --git a/includes/frontend/class-modal.php b/includes/frontend/class-modal.php new file mode 100644 index 00000000..5076ec67 --- /dev/null +++ b/includes/frontend/class-modal.php @@ -0,0 +1,41 @@ +get_priority() ); + } + + /** + * @return int + */ + private function get_priority() { + return apply_filters( 'um_core_includes_modals_priority', 9 ); + } + + /** + * Load modal content. + */ + public function load_modal_content() { + $modal_templates = glob( UM_PATH . 'templates/modal/*.php' ); + $modal_templates = array_map( 'basename', $modal_templates ); + if ( ! empty( $modal_templates ) ) { + foreach ( $modal_templates as $modal_content ) { + UM()->get_template( 'modal/' . $modal_content, '', array(), true ); + } + } + } +} diff --git a/templates/modal/um_upload_single.php b/templates/modal/upload-single.php similarity index 56% rename from templates/modal/um_upload_single.php rename to templates/modal/upload-single.php index 00257bec..d6c6b701 100644 --- a/templates/modal/um_upload_single.php +++ b/templates/modal/upload-single.php @@ -2,12 +2,13 @@ /** * Template for the modal form * - * This template can be overridden by copying it to yourtheme/ultimate-member/modal/um_upload_single.php + * This template can be overridden by copying it to yourtheme/ultimate-member/modal/upload-single.php * - * @version 2.6.1 + * @version 2.8.6 */ if ( ! defined( 'ABSPATH' ) ) { exit; -} ?> +} +?> - + diff --git a/templates/modal/um_view_photo.php b/templates/modal/view-photo.php similarity index 61% rename from templates/modal/um_view_photo.php rename to templates/modal/view-photo.php index d926409f..0ec49f81 100644 --- a/templates/modal/um_view_photo.php +++ b/templates/modal/view-photo.php @@ -2,23 +2,21 @@ /** * Template for the modal photo * - * This template can be overridden by copying it to yourtheme/ultimate-member/modal/um_view_photo.php + * This template can be overridden by copying it to yourtheme/ultimate-member/modal/view-photo.php * - * @version 2.6.1 + * @version 2.8.6 */ if ( ! defined( 'ABSPATH' ) ) { exit; -} ?> +} +?> -