mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge pull request #1496 from ultimatemember/fix/include_modal
Includes modal templates
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\core\Modal' ) ) {
|
||||
@@ -20,7 +21,7 @@ if ( ! class_exists( 'um\core\Modal' ) ) {
|
||||
/**
|
||||
* Modal constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
add_action( 'wp_footer', array( &$this, 'load_modal_content' ), $this->get_priority() );
|
||||
}
|
||||
|
||||
@@ -28,7 +29,7 @@ if ( ! class_exists( 'um\core\Modal' ) ) {
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
function get_priority() {
|
||||
public function get_priority() {
|
||||
return apply_filters( 'um_core_includes_modals_priority', 9 );
|
||||
}
|
||||
|
||||
@@ -36,18 +37,16 @@ if ( ! class_exists( 'um\core\Modal' ) ) {
|
||||
/**
|
||||
* Load modal content
|
||||
*/
|
||||
function 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 ) {
|
||||
include_once $modal_content;
|
||||
UM()->get_template( 'modal/' . $modal_content, '', array(), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user