mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed PHP notice;
This commit is contained in:
@@ -99,8 +99,11 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
* Enqueue Gutenberg Block Editor assets
|
||||
*/
|
||||
public function block_editor() {
|
||||
$suffix = self::get_suffix();
|
||||
$js_url = self::get_url( 'js' );
|
||||
$suffix = self::get_suffix();
|
||||
$js_url = self::get_url( 'js' );
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
$this->load_gutenberg_js();
|
||||
|
||||
wp_register_script( 'um_admin_blocks_shortcodes', $js_url . 'admin/block-renderer' . $suffix . '.js', array( 'wp-i18n', 'wp-blocks', 'wp-components' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_admin_blocks_shortcodes', 'ultimate-member' );
|
||||
@@ -135,7 +138,6 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
);
|
||||
$um_account_settings = apply_filters( 'um_extend_account_settings', $um_account_settings );
|
||||
wp_localize_script( 'um_admin_blocks_shortcodes', 'um_account_settings', $um_account_settings );
|
||||
|
||||
wp_enqueue_script( 'um_admin_blocks_shortcodes' );
|
||||
|
||||
wp_register_script( 'um_conditional', UM_URL . 'assets/js/um-conditional' . $suffix . '.js', array( 'jquery', 'wp-hooks' ), UM_VERSION, true );
|
||||
@@ -190,8 +192,47 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$custom_css = '.wp-block .um{opacity: 1;}.um_request_name {display: none !important;}';
|
||||
|
||||
wp_add_inline_style( 'um_styles', $custom_css );
|
||||
}
|
||||
|
||||
$this->load_gutenberg_js();
|
||||
/**
|
||||
* Load Gutenberg scripts.
|
||||
*/
|
||||
private function load_gutenberg_js() {
|
||||
/** This filter is documented in includes/core/class-blocks.php */
|
||||
$disable_script = apply_filters( 'um_disable_blocks_script', false );
|
||||
if ( $disable_script ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$restricted_blocks = UM()->options()->get( 'restricted_blocks' );
|
||||
if ( empty( $restricted_blocks ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$suffix = self::get_suffix();
|
||||
$js_url = self::get_url( 'js' );
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
wp_register_script( 'um_block_restrictions', $js_url . 'admin/block-restrictions' . $suffix . '.js', array( 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-hooks' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_block_restrictions', 'ultimate-member' );
|
||||
|
||||
$restrict_options = array();
|
||||
$roles = UM()->roles()->get_roles();
|
||||
if ( ! empty( $roles ) ) {
|
||||
foreach ( $roles as $role_key => $title ) {
|
||||
$restrict_options[] = array(
|
||||
'label' => $title,
|
||||
'value' => $role_key,
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_localize_script( 'um_block_restrictions', 'um_restrict_roles', $restrict_options );
|
||||
wp_enqueue_script( 'um_block_restrictions' );
|
||||
|
||||
wp_register_style( 'um_block_css', $css_url . 'admin/block' . $suffix . '.css', array(), UM_VERSION );
|
||||
wp_enqueue_style( 'um_block_css' );
|
||||
|
||||
do_action( 'um_load_gutenberg_js' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +317,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
wp_register_script( 'um_admin_forms', $js_url . 'admin/forms' . $suffix . '.js', array( 'um_admin_common', self::$select2_handle, 'jquery-ui-draggable', 'jquery-ui-sortable', 'jquery-ui-slider' ), UM_VERSION, true );
|
||||
|
||||
wp_set_script_translations( 'um_admin_forms', 'ultimate-member' );
|
||||
$forms_data = array(
|
||||
'successfully_redirect' => add_query_arg(
|
||||
array(
|
||||
@@ -310,6 +351,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
wp_register_script( 'um_admin_modal', $js_url . 'admin/modal' . $suffix . '.js', array( 'um_admin_common' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_admin_modal', 'ultimate-member' );
|
||||
wp_enqueue_script( 'um_admin_modal' );
|
||||
|
||||
wp_register_style( 'um_admin_modal', $css_url . 'admin/modal' . $suffix . '.css', array( 'um_admin_common' ), UM_VERSION );
|
||||
@@ -327,6 +369,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
wp_register_script( 'um_admin_builder', $js_url . 'admin/builder' . $suffix . '.js', array( 'um_admin_modal', 'jquery-ui-draggable', 'jquery-ui-sortable', 'editor', 'wp-tinymce', self::$select2_handle, 'um_raty' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_admin_builder', 'ultimate-member' );
|
||||
wp_enqueue_script( 'um_admin_builder' );
|
||||
|
||||
wp_register_style( 'um_admin_builder', $css_url . 'admin/builder' . $suffix . '.css', array( 'um_admin_modal', 'select2', 'um_raty' ), UM_VERSION );
|
||||
@@ -393,47 +436,6 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
wp_enqueue_style( 'um_admin_global' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Gutenberg scripts
|
||||
*/
|
||||
public function load_gutenberg_js() {
|
||||
/** This filter is documented in includes/core/class-blocks.php */
|
||||
$disable_script = apply_filters( 'um_disable_blocks_script', false );
|
||||
if ( $disable_script ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$restricted_blocks = UM()->options()->get( 'restricted_blocks' );
|
||||
if ( empty( $restricted_blocks ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$suffix = self::get_suffix();
|
||||
$js_url = self::get_url( 'js' );
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
wp_register_script( 'um_block_restrictions', $js_url . 'admin/block-restrictions' . $suffix . '.js', array( 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-hooks' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_block_restrictions', 'ultimate-member' );
|
||||
|
||||
$restrict_options = array();
|
||||
$roles = UM()->roles()->get_roles();
|
||||
if ( ! empty( $roles ) ) {
|
||||
foreach ( $roles as $role_key => $title ) {
|
||||
$restrict_options[] = array(
|
||||
'label' => $title,
|
||||
'value' => $role_key,
|
||||
);
|
||||
}
|
||||
}
|
||||
wp_localize_script( 'um_block_restrictions', 'um_restrict_roles', $restrict_options );
|
||||
wp_enqueue_script( 'um_block_restrictions' );
|
||||
|
||||
wp_register_style( 'um_block_css', $css_url . 'admin/block' . $suffix . '.css', array(), UM_VERSION );
|
||||
wp_enqueue_style( 'um_block_css' );
|
||||
|
||||
do_action( 'um_load_gutenberg_js' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Gutenberg category for UM shortcodes.
|
||||
*
|
||||
@@ -464,10 +466,9 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
* @param string $hook wp-admin screen.
|
||||
*/
|
||||
public function admin_enqueue_scripts( $hook ) {
|
||||
$suffix = self::get_suffix();
|
||||
$libs_url = self::get_url( 'libs' );
|
||||
$js_url = self::get_url( 'js' );
|
||||
$css_url = self::get_url( 'css' );
|
||||
$suffix = self::get_suffix();
|
||||
$js_url = self::get_url( 'js' );
|
||||
$css_url = self::get_url( 'css' );
|
||||
|
||||
$this->load_global_scripts();
|
||||
|
||||
@@ -506,6 +507,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification
|
||||
if ( isset( $_GET['tab'] ) && 'secure' === $_GET['tab'] ) {
|
||||
wp_register_script( 'um_admin_secure', $js_url . 'admin/secure' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_admin_secure', 'ultimate-member' );
|
||||
wp_enqueue_script( 'um_admin_secure' );
|
||||
}
|
||||
|
||||
@@ -513,6 +515,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
wp_enqueue_style( 'um_admin_settings' );
|
||||
|
||||
wp_register_script( 'um_admin_settings', $js_url . 'admin/settings' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_admin_settings', 'ultimate-member' );
|
||||
wp_enqueue_script( 'um_admin_settings' );
|
||||
} elseif ( 'ultimate-member_page_ultimatemember-extensions' === $hook ) {
|
||||
wp_register_style( 'um_admin_extensions', $css_url . 'admin/extensions' . $suffix . '.css', array(), UM_VERSION );
|
||||
|
||||
@@ -2479,7 +2479,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
case '_custom_dropdown_options_source':
|
||||
?>
|
||||
|
||||
<p><label for="_custom_dropdown_options_source"><?php _e( 'Choices Callback', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_custom_dropdown_options_source"><?php esc_html_e( 'Choices Callback', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="text" name="_custom_dropdown_options_source" id="_custom_dropdown_options_source" value="<?php echo esc_attr( $this->edit_mode_value ); ?>" />
|
||||
</p>
|
||||
|
||||
@@ -2489,17 +2489,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
case '_parent_dropdown_relationship':
|
||||
?>
|
||||
|
||||
<p><label for="_parent_dropdown_relationship"><?php _e( 'Parent Option', 'ultimate-member' ) ?><?php UM()->tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_parent_dropdown_relationship"><?php esc_html_e( 'Parent Option', 'ultimate-member' ); ?><?php UM()->tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?></label>
|
||||
<select name="_parent_dropdown_relationship" id="_parent_dropdown_relationship" style="width: 100%">
|
||||
<option value=""><?php _e( 'No Selected', 'ultimate-member' ) ?></option>
|
||||
|
||||
<?php if ( UM()->builtin()->custom_fields ) {
|
||||
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
|
||||
if ( in_array( $array['type'], array( 'select' ) ) && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) && isset( $array['title'] ) ) { ?>
|
||||
<option value="<?php echo esc_attr( $array['metakey'] ) ?>" <?php selected( $array['metakey'], $this->edit_mode_value ) ?>><?php echo $array['title'] ?></option>
|
||||
<?php }
|
||||
<option value=""><?php esc_html_e( 'No Selected', 'ultimate-member' ); ?></option>
|
||||
<?php
|
||||
if ( UM()->builtin()->custom_fields ) {
|
||||
foreach ( UM()->builtin()->custom_fields as $array ) {
|
||||
if ( array_key_exists( 'type', $array ) && 'select' === $array['type'] && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) && isset( $array['title'] ) ) {
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $array['metakey'] ); ?>" <?php selected( $array['metakey'], $this->edit_mode_value ); ?>><?php echo esc_html( $array['title'] ); ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
|
||||
wp_register_script('um_members', $this->js_baseurl . 'um-members' . $suffix . '.js', array( 'jquery', 'wp-util', 'jquery-ui-slider', 'um_dropdown', 'wp-hooks', 'jquery-masonry', 'um_scripts' ), UM_VERSION, true );
|
||||
wp_register_script('um_profile', $this->js_baseurl . 'um-profile' . $suffix . '.js', array( 'jquery', 'wp-util', 'wp-i18n' ), UM_VERSION, true );
|
||||
wp_set_script_translations( 'um_profile', 'ultimate-member' );
|
||||
|
||||
$account_deps = apply_filters( 'um_account_scripts_dependencies', array( 'jquery', 'wp-hooks' ) );
|
||||
wp_register_script('um_account', $this->js_baseurl . 'um-account' . $suffix . '.js', $account_deps, UM_VERSION, true );
|
||||
|
||||
Reference in New Issue
Block a user