mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-17 13:43:38 +09:00
- reviewed #1496;
This commit is contained in:
+11
-16
@@ -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
|
||||
*
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\core\Modal' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Modal
|
||||
*
|
||||
* @package um\core
|
||||
*/
|
||||
class Modal {
|
||||
|
||||
|
||||
/**
|
||||
* Modal constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_footer', array( &$this, 'load_modal_content' ), $this->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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace um\frontend;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Modal
|
||||
*
|
||||
* @package um\frontend
|
||||
*/
|
||||
class Modal {
|
||||
|
||||
/**
|
||||
* Modal constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_footer', array( &$this, 'load_modal_content' ), $this->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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user