mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- changed form builder > icon field to new dropdown type;
This commit is contained in:
@@ -40,6 +40,14 @@ class Site_Health {
|
||||
);
|
||||
}
|
||||
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
if ( ! empty( $first_activation_date ) && $first_activation_date < 1713342395 ) {
|
||||
$tests['direct']['um_outdated_icons'] = array(
|
||||
'label' => esc_html__( 'Are the icons in Ultimate Member Forms and Settings out of date?', 'ultimate-member' ),
|
||||
'test' => array( $this, 'outdated_icons_test' ),
|
||||
);
|
||||
}
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
@@ -77,6 +85,131 @@ class Site_Health {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|array
|
||||
*/
|
||||
private function get_outdated_icons() {
|
||||
$result = array(
|
||||
'description' => '',
|
||||
'actions' => '',
|
||||
);
|
||||
|
||||
$old_icons = UM()->fonticons()->all;
|
||||
|
||||
$forms = get_posts(
|
||||
array(
|
||||
'post_type' => 'um_form',
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
|
||||
$forms_count = 0;
|
||||
$break_forms = array();
|
||||
if ( ! empty( $forms ) ) {
|
||||
foreach ( $forms as $form_id ) {
|
||||
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
||||
if ( empty( $fields ) ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $fields as $field ) {
|
||||
if ( empty( $field['icon'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( in_array( $field['icon'], $old_icons, true ) ) {
|
||||
$break_forms[] = array(
|
||||
'id' => $form_id,
|
||||
'title' => get_the_title( $form_id ),
|
||||
'link' => get_edit_post_link( $form_id ),
|
||||
);
|
||||
$forms_count++;
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 < $forms_count ) {
|
||||
$result['description'] .= sprintf(
|
||||
'<p>%s</p>',
|
||||
__( 'Your fields\' icons in the Ultimate Member Forms are out of date.', 'ultimate-member' )
|
||||
);
|
||||
|
||||
if ( ! empty( $break_forms ) ) {
|
||||
$result['description'] .= sprintf(
|
||||
'<p>%s',
|
||||
__( 'Related to Ultimate Member Forms: ', 'ultimate-member' )
|
||||
);
|
||||
|
||||
$form_links = array();
|
||||
foreach ( $break_forms as $break_form ) {
|
||||
$form_links[] = sprintf(
|
||||
'<a href="%s" target="_blank">%s (#ID: %s)</a>',
|
||||
esc_url( $break_form['link'] ),
|
||||
esc_html( $break_form['title'] ),
|
||||
esc_html( $break_form['id'] )
|
||||
);
|
||||
}
|
||||
|
||||
$result['description'] .= sprintf(
|
||||
'%s</p><hr />',
|
||||
implode( ', ', $form_links )
|
||||
);
|
||||
}
|
||||
|
||||
$result['actions'] .= sprintf(
|
||||
'<p><a href="%s">%s</a></p>',
|
||||
admin_url( 'edit.php?post_type=um_form' ),
|
||||
esc_html__( 'Edit form fields and update', 'ultimate-member' )
|
||||
);
|
||||
}
|
||||
|
||||
$result = apply_filters( 'um_get_outdated_icons_result', $result, $old_icons );
|
||||
|
||||
if ( ! empty( $result['description'] ) ) {
|
||||
$result['description'] .= sprintf(
|
||||
'<p>%s</p>',
|
||||
__( 'As soon as legacy icons will be removed old icons may break the website\'s functionality.', 'ultimate-member' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $result['description'] ) && ! empty( $result['actions'] ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function outdated_icons_test() {
|
||||
$result = array(
|
||||
'label' => __( 'You have the most recent version of icons in Ultimate Member forms and settings', 'ultimate-member' ),
|
||||
'status' => 'good',
|
||||
'badge' => array(
|
||||
'label' => UM_PLUGIN_NAME,
|
||||
'color' => self::BADGE_COLOR,
|
||||
),
|
||||
'description' => sprintf(
|
||||
'<p>%s</p>',
|
||||
__( 'Your fields in the Ultimate Member Forms and settings have the most recent version and are ready to use.', 'ultimate-member' )
|
||||
),
|
||||
'actions' => '',
|
||||
'test' => 'um_outdated_icons',
|
||||
);
|
||||
|
||||
$outdated_icons = $this->get_outdated_icons();
|
||||
|
||||
if ( false !== $outdated_icons ) {
|
||||
$result['label'] = __( 'Some field icons and (or) Ultimate Member settings icons are out of date', 'ultimate-member' );
|
||||
$result['status'] = 'recommended';
|
||||
$result['badge']['color'] = 'orange';
|
||||
$result['description'] = $outdated_icons['description'];
|
||||
$result['actions'] = $outdated_icons['actions'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function get_roles() {
|
||||
return UM()->roles()->get_roles();
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || UM()->options()->get( 'enable_new_fonticons' ) ) {
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 ) {
|
||||
UM()->setup()->set_icons_options();
|
||||
|
||||
$um_icons_list = get_option( 'um_icons_list' );
|
||||
|
||||
@@ -1557,7 +1557,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
case '_icon':
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || UM()->options()->get( 'enable_new_fonticons' ) ) {
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 ) {
|
||||
UM()->setup()->set_icons_options();
|
||||
|
||||
$um_icons_list = get_option( 'um_icons_list' );
|
||||
@@ -1593,52 +1593,85 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
|
||||
}
|
||||
} else {
|
||||
if ( 'row' === $this->set_field_type ) {
|
||||
$back = 'UM_edit_row';
|
||||
?>
|
||||
<p class="_heading_text">
|
||||
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
||||
<span class="um_admin_fonticon_wrapper">
|
||||
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
|
||||
|
||||
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ); ?><?php } ?></span>
|
||||
UM()->setup()->set_icons_options();
|
||||
|
||||
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
|
||||
$um_icons_list = get_option( 'um_icons_list' );
|
||||
|
||||
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
|
||||
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
||||
<?php } else { ?>
|
||||
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</p>
|
||||
<?php
|
||||
} else {
|
||||
if ( $this->in_edit ) {
|
||||
$back = 'UM_edit_field';
|
||||
} else {
|
||||
$back = 'UM_add_field';
|
||||
}
|
||||
?>
|
||||
<div class="um-admin-tri">
|
||||
<p>
|
||||
if ( empty( $this->edit_mode_value ) || array_key_exists( $this->edit_mode_value, $um_icons_list ) ) {
|
||||
if ( 'row' === $this->set_field_type ) {
|
||||
?>
|
||||
|
||||
<p class="_heading_text">
|
||||
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
||||
<span class="um_admin_fonticon_wrapper">
|
||||
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php esc_html_e( 'Choose Icon', 'ultimate-member' ); ?></a>
|
||||
|
||||
<span class="um-admin-icon-value"><?php if ( ! empty( $this->edit_mode_value ) ) { ?><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i><?php } else { ?><?php esc_html_e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
|
||||
|
||||
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
|
||||
|
||||
<?php if ( ! empty( $this->edit_mode_value ) ) { ?>
|
||||
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
||||
<?php } else { ?>
|
||||
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
<select name="_icon" id="_icon" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>" >
|
||||
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
|
||||
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
|
||||
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="um-admin-tri">
|
||||
<p>
|
||||
<label for="_icon"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
||||
<select name="_icon" id="_icon" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>">
|
||||
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
|
||||
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
|
||||
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
} else {
|
||||
if ( 'row' === $this->set_field_type ) {
|
||||
?>
|
||||
|
||||
<p class="_heading_text">
|
||||
<label for="um_ui_icon_new"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
||||
<select name="um_ui_icon_new" id="um_ui_icon_new" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>" >
|
||||
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
|
||||
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
|
||||
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<span class="um_admin_fonticon_wrapper">
|
||||
<span><?php esc_html_e( 'Icon is outdated. Please set the new one above.', 'ultimate-member' ); ?></span>
|
||||
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
|
||||
<span class="um-admin-icon-value"><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i></span>
|
||||
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="um-admin-tri">
|
||||
<p>
|
||||
<label for="um_ui_icon_new"><?php esc_html_e( 'Icon', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
||||
<select name="um_ui_icon_new" id="um_ui_icon_new" class="um-icon-select-field" data-placeholder="<?php esc_attr_e( 'Select Icon', 'ultimate-member' ); ?>">
|
||||
<option value=""><?php esc_html_e( 'Select Icon', 'ultimate-member' ); ?></option>
|
||||
<?php if ( ! empty( $this->edit_mode_value ) && array_key_exists( $this->edit_mode_value, $um_icons_list ) ) { ?>
|
||||
<option value="<?php echo esc_attr( $this->edit_mode_value ); ?>" selected><?php echo esc_html( $um_icons_list[ $this->edit_mode_value ]['label'] ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<span class="um_admin_fonticon_wrapper">
|
||||
<span><?php esc_html_e( 'Icon is outdated. Please set the new one above.', 'ultimate-member' ); ?></span>
|
||||
<input type="hidden" name="_icon" id="_icon" value="<?php echo ! empty( $this->edit_mode_value ) ? esc_attr( $this->edit_mode_value ) : ''; ?>" />
|
||||
<span class="um-admin-icon-value"><i class="<?php echo esc_attr( $this->edit_mode_value ); ?>"></i></span>
|
||||
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2112,13 +2112,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'checkbox_label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ),
|
||||
'description' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'enable_new_fonticons',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'New fonticons', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Enable new fonticons', 'ultimate-member' ),
|
||||
'description' => __( 'Check this box if you would like to enable new Ultimate Member fonticons used latest version of FontAwesome library.', 'ultimate-member' ),
|
||||
),
|
||||
$same_page_update,
|
||||
),
|
||||
),
|
||||
@@ -2229,12 +2222,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
} else {
|
||||
unset( $this->settings_structure['advanced']['sections']['features']['form_sections']['beta_features'] );
|
||||
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 ) {
|
||||
unset( $this->settings_structure['advanced']['sections']['features']['form_sections']['features']['fields'][1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || UM()->options()->get( 'enable_new_fonticons' ) ) {
|
||||
|
||||
} else {
|
||||
if ( ! empty( $first_activation_date ) && $first_activation_date < 1713342395 ) {
|
||||
?>
|
||||
<div id="UM_fonticons" style="display:none">
|
||||
|
||||
|
||||
@@ -600,16 +600,8 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'secure_notify_admins_banned_accounts__interval' => 'instant',
|
||||
'secure_allowed_redirect_hosts' => '',
|
||||
'delete_comments' => false,
|
||||
'enable_new_fonticons' => false,
|
||||
);
|
||||
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 ) {
|
||||
// first install set this option to true by default
|
||||
$this->settings_defaults['enable_new_fonticons'] = true;
|
||||
}
|
||||
|
||||
add_filter( 'um_get_tabs_from_config', '__return_true' );
|
||||
|
||||
$tabs = UM()->profile()->tabs();
|
||||
|
||||
@@ -270,13 +270,10 @@ class Enqueue {
|
||||
wp_register_style( 'um_fonticons_fa', $libs_url . 'legacy/fonticons/fonticons-fa' . $suffix . '.css', array(), UM_VERSION ); // FontAwesome
|
||||
$fonticons_handlers = array( 'um_fonticons_ii', 'um_fonticons_fa' );
|
||||
// New FontIcons from FontAwesome.
|
||||
$first_activation_date = get_option( 'um_first_activation_date', false );
|
||||
// @todo new version
|
||||
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || UM()->options()->get( 'enable_new_fonticons' ) ) {
|
||||
// First install set this option to true by default and use new FontAwesome icons
|
||||
wp_register_style( 'um_fontawesome', $css_url . 'um-fontawesome' . $suffix . '.css', array(), self::$fa_version ); // New FontAwesome
|
||||
$fonticons_handlers[] = 'um_fontawesome';
|
||||
}
|
||||
// First install set this option to true by default and use new FontAwesome icons
|
||||
wp_register_style( 'um_fontawesome', $css_url . 'um-fontawesome' . $suffix . '.css', array(), self::$fa_version ); // New FontAwesome
|
||||
$fonticons_handlers[] = 'um_fontawesome';
|
||||
self::$fonticons_handlers = $fonticons_handlers;
|
||||
|
||||
// Select2 JS.
|
||||
|
||||
Reference in New Issue
Block a user