Merge pull request #1509 from ultimatemember/feature/new_fa

Include FontAwesome 6.5.2
This commit is contained in:
Mykyta Synelnikov
2024-05-01 14:14:23 +03:00
committed by GitHub
53 changed files with 116198 additions and 153 deletions
+1 -1
View File
@@ -624,7 +624,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
'sanitize' => 'text',
),
'_icon' => array(
'sanitize' => 'key',
'sanitize' => 'text',
),
'_css_class' => array(
'sanitize' => 'text',
+5 -2
View File
@@ -191,7 +191,9 @@ final class Enqueue extends \um\common\Enqueue {
wp_style_add_data( 'um_members', 'suffix', $suffix );
}
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', array( 'um_ui', 'um_tipsy', 'um_raty', 'um_fonticons_ii', 'um_fonticons_fa', 'select2' ), UM_VERSION );
$deps = array_merge( array( 'um_ui', 'um_tipsy', 'um_raty', 'select2' ), self::$fonticons_handlers );
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', $deps, UM_VERSION );
wp_register_style( 'um_profile', $css_url . 'um-profile' . $suffix . '.css', array(), UM_VERSION );
wp_register_style( 'um_responsive', $css_url . 'um-responsive' . $suffix . '.css', array( 'um_profile' ), UM_VERSION );
wp_register_style( 'um_account', $css_url . 'um-account' . $suffix . '.css', array(), UM_VERSION );
@@ -390,7 +392,8 @@ final class Enqueue extends \um\common\Enqueue {
wp_localize_script( 'um_admin_forms', 'um_forms_data', $forms_data );
wp_enqueue_script( 'um_admin_forms' );
wp_register_style( 'um_admin_forms', $css_url . 'admin/forms' . $suffix . '.css', array( 'wp-color-picker', 'um_ui', 'select2' ), UM_VERSION );
$deps = array_merge( array( 'wp-color-picker', 'um_ui', 'select2' ), self::$fonticons_handlers );
wp_register_style( 'um_admin_forms', $css_url . 'admin/forms' . $suffix . '.css', $deps, UM_VERSION );
// RTL styles.
if ( is_rtl() ) {
wp_style_add_data( 'um_admin_forms', 'rtl', true );
+133
View File
@@ -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();
}
+27 -20
View File
@@ -541,9 +541,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
if ( empty( $field_data['id'] ) ) {
return false;
}
// Required modal scripts for proper functioning
UM()->admin()->enqueue()->load_modal();
$html = '';
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
$id_attr = ' id="' . esc_attr( $id ) . '" ';
@@ -555,28 +553,37 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
$value = $this->get_field_value( $field_data );
$value_attr = ' value="' . esc_attr( $value ) . '" ';
$html = '<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="" data-icon_field="' . esc_attr( $id ) . '">' . esc_html__( 'Choose Icon', 'ultimate-member' ) . '</a>
<span class="um-admin-icon-value">';
UM()->setup()->set_icons_options();
$um_icons_list = get_option( 'um_icons_list' );
$first_activation_date = get_option( 'um_first_activation_date', false );
// @todo new version
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || empty( $value ) || array_key_exists( $value, $um_icons_list ) ) {
$html .= '<select ' . $name_attr . ' ' . $id_attr . ' class="um-icon-select-field" data-placeholder="' . esc_attr__( 'Select Icon', 'ultimate-member' ) . '" ><option value="">' . esc_html__( 'Select Icon', 'ultimate-member' ) . '</option>';
if ( ! empty( $value ) && array_key_exists( $value, $um_icons_list ) ) {
$html .= '<option ' . $value_attr . ' selected>' . esc_html( $um_icons_list[ $value ]['label'] ) . '</option>';
}
$html .= '</select>';
} else {
// Required modal scripts for proper functioning
UM()->admin()->enqueue()->load_modal();
$html .= '<select name="um_ui_icon_new" id="um_ui_icon_new" class="um-icon-select-field" data-placeholder="' . esc_attr__( 'Select Icon', 'ultimate-member' ) . '" ><option value="">' . esc_html__( 'Select Icon', 'ultimate-member' ) . '</option>';
$html .= '</select>';
$html .= '<span class="um_admin_fonticon_wrapper"><span>' . esc_html__( 'The selected icon is using an outdated version. Please select the icon above to use latest version.', 'ultimate-member' ) . '</span>
<span class="um-admin-icon-value">';
if ( ! empty( $value ) ) {
$html .= '<i class="' . esc_attr( $value ) . '"></i>';
} else {
$html .= esc_html__( 'No Icon', 'ultimate-member' );
}
$html .= '</span><input type="hidden" ' . $name_attr . ' ' . $id_attr . ' ' . $value_attr . ' />';
if ( ! empty( $value ) ) {
$html .= '</span><input type="hidden" ' . $name_attr . ' ' . $id_attr . ' ' . $value_attr . ' class="um_old_icon_field_value"/>';
$html .= '<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>';
} else {
$html .= '<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>';
$html .= '</span></span>';
// Required include the fonticons modal *.php file.
UM()->metabox()->init_icon = true;
}
$html .= '</span></span>';
// Required include the fonticons modal *.php file.
UM()->metabox()->init_icon = true;
return $html;
}
+33 -39
View File
@@ -1320,6 +1320,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
}
}
// Old interface for icon selector in UM admin forms field-type 'icon'.
if ( $this->init_icon ) {
include_once UM_PATH . 'includes/admin/templates/modal/forms/fonticons.php';
}
@@ -1554,52 +1555,45 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
break;
case '_icon':
UM()->setup()->set_icons_options();
$um_icons_list = get_option( 'um_icons_list' );
$first_activation_date = get_option( 'um_first_activation_date', false );
$wrapper_classes = array(
'um-icon-select-field-wrapper',
);
if ( 'row' === $this->set_field_type ) {
$back = 'UM_edit_row';
$wrapper_classes[] = '_heading_text';
}
$wrapper_classes = implode( ' ', $wrapper_classes );
// @todo new version
if ( empty( $first_activation_date ) || $first_activation_date >= 1713342395 || empty( $this->edit_mode_value ) || array_key_exists( $this->edit_mode_value, $um_icons_list ) ) {
?>
<p class="_heading_text">
<p class="<?php echo esc_attr( $wrapper_classes ); ?>">
<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>
<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>
<?php } else { ?>
<p class="<?php echo esc_attr( $wrapper_classes ); ?>">
<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>
</select>
<span class="um_admin_fonticon_wrapper">
<span><?php esc_html_e( 'The selected icon is using an outdated version. Please select the icon above to use latest version.', 'ultimate-member' ); ?></span>
<input type="hidden" name="_icon" id="_icon" class="um_old_icon_field_value" value="<?php echo 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 {
if ( $this->in_edit ) {
$back = 'UM_edit_field';
} else {
$back = 'UM_add_field';
}
?>
<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>
<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>
</p>
</div>
<?php
}
break;
@@ -1,23 +1,31 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
<?php
// @todo deprecate this way to select the icon as soon as possible.
if ( ! defined( 'ABSPATH' ) ) {
exit;
} ?>
}
<div id="UM_fonticons" style="display:none">
$first_activation_date = get_option( 'um_first_activation_date', false );
// @todo new version
if ( ! empty( $first_activation_date ) && $first_activation_date < 1713342395 ) {
?>
<div id="UM_fonticons" style="display:none">
<div class="um-admin-modal-head">
<h3>
<?php
// translators: %s: icons nubber.
echo wp_kses( sprintf( __( 'Choose from %s available icons', 'ultimate-member' ), count( UM()->fonticons()->all ) ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</h3>
</div>
<div class="um-admin-modal-body"></div>
<div class="um-admin-modal-foot">
<a href="javascript:void(0);" class="button-primary um-admin-modal-back" data-code=""><?php _e( 'Finish', 'ultimate-member' ) ?></a>
<a href="javascript:void(0);" class="button um-admin-modal-back um-admin-modal-cancel" data-action="UM_remove_modal"><?php _e( 'Cancel', 'ultimate-member' ) ?></a>
</div>
<div class="um-admin-modal-head">
<h3>
<?php
// translators: %s: icons nubber.
echo wp_kses( sprintf( __( 'Choose from %s available icons', 'ultimate-member' ), count( UM()->fonticons()->all ) ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</h3>
</div>
<div class="um-admin-modal-body"></div>
<div class="um-admin-modal-foot">
<a href="javascript:void(0);" class="button-primary um-admin-modal-back" data-code=""><?php _e( 'Finish', 'ultimate-member' ) ?></a>
<a href="javascript:void(0);" class="button um-admin-modal-back um-admin-modal-cancel" data-action="UM_remove_modal"><?php _e( 'Cancel', 'ultimate-member' ) ?></a>
</div>
</div>
<?php
}
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace um\ajax;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Forms
*
* @package um\ajax
*/
class Forms {
/**
* Forms constructor.
*/
public function __construct() {
add_action( 'wp_ajax_um_get_icons', array( $this, 'get_icons' ) );
}
/**
* Get the list of the icons.
*/
public function get_icons() {
UM()->admin()->check_ajax_nonce();
$search_request = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : '';
$page = ! empty( $_REQUEST['page'] ) ? absint( $_REQUEST['page'] ) : 1;
$per_page = 50;
UM()->setup()->set_icons_options();
$um_icons_list = get_option( 'um_icons_list' );
if ( ! empty( $search_request ) ) {
$um_icons_list = array_filter(
$um_icons_list,
function( $item ) use ( $search_request ) {
$result = array_filter(
$item['search'],
function( $search_item ) use ( $search_request ) {
return stripos( $search_item, $search_request ) !== false;
}
);
return count( $result ) > 0;
}
);
}
$total_count = count( $um_icons_list );
$um_icons_list = array_slice( $um_icons_list, $per_page * ( $page - 1 ), $per_page );
wp_send_json_success(
array(
'icons' => $um_icons_list,
'total_count' => $total_count,
)
);
}
}
+13
View File
@@ -20,10 +20,23 @@ if ( ! class_exists( 'um\ajax\Init' ) ) {
* @used-by \UM::includes()
*/
public function includes() {
$this->forms();
$this->pages();
$this->secure();
}
/**
* @since 2.8.6
*
* @return Forms
*/
public function forms() {
if ( empty( UM()->classes['um\ajax\forms'] ) ) {
UM()->classes['um\ajax\forms'] = new Forms();
}
return UM()->classes['um\ajax\forms'];
}
/**
* @since 2.8.3
*
+18 -1
View File
@@ -36,6 +36,15 @@ class Enqueue {
*/
public static $select2_handle = 'select2';
public static $fonticons_handlers = array();
/**
* FontAwesome version.
*
* @var string
*/
public static $fa_version = '6.5.2';
/**
* Enqueue constructor.
*
@@ -259,6 +268,13 @@ class Enqueue {
// Legacy FontIcons.
wp_register_style( 'um_fonticons_ii', $libs_url . 'legacy/fonticons/fonticons-ii' . $suffix . '.css', array(), UM_VERSION ); // Ionicons
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.
// @todo new version
// 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.
$this->register_select2();
@@ -310,6 +326,7 @@ class Enqueue {
$um_common_variables = apply_filters( 'um_common_js_variables', $um_common_variables );
wp_localize_script( 'um_common', 'um_common_variables', $um_common_variables );
wp_register_style( 'um_common', $css_url . 'common' . $suffix . '.css', array( 'um_tipsy', 'um_datetime_date', 'um_datetime_time', 'um_fonticons_ii', 'um_fonticons_fa' ), UM_VERSION );
$common_css_deps = array_merge( array( 'um_tipsy', 'um_datetime_date', 'um_datetime_time' ), self::$fonticons_handlers );
wp_register_style( 'um_common', $css_url . 'common' . $suffix . '.css', $common_css_deps, UM_VERSION );
}
}
+65 -62
View File
@@ -251,7 +251,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'in_fields' => false,
'form_only' => true,
'conditional_support' => 0,
'icon' => 'um-faicon-pencil',
'icon' => 'fas fa-pencil',
'col1' => array('_id','_background','_text_color','_padding','_margin','_border','_borderradius','_borderstyle','_bordercolor'),
'col2' => array('_heading','_heading_text','_heading_background_color','_heading_text_color','_icon','_icon_color','_css_class'),
),
@@ -259,8 +259,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'text' => array(
'name' => 'Text Box',
'col1' => array('_title','_metakey','_help','_default','_min_chars','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -275,8 +275,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'tel' => array(
'name' => __( 'Telephone', 'ultimate-member' ),
'col1' => array('_title','_metakey','_help','_default','_min_chars','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -291,8 +291,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'number' => array(
'name' => __('Number','ultimate-member'),
'col1' => array('_title','_metakey','_help','_default','_min','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate','_max'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -307,8 +307,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'textarea' => array(
'name' => 'Textarea',
'col1' => array('_title','_metakey','_help','_height','_max_chars','_max_words','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_default','_html'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_default','_html'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -323,8 +323,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'select' => array(
'name' => 'Dropdown',
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_custom_dropdown_options_source','_parent_dropdown_relationship'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_custom_dropdown_options_source','_parent_dropdown_relationship'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -343,8 +343,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'multiselect' => array(
'name' => 'Multi-Select',
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_min_selections','_max_selections','_custom_dropdown_options_source'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_min_selections','_max_selections','_custom_dropdown_options_source'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -363,8 +363,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'radio' => array(
'name' => 'Radio',
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
'col2' => array('_label','_public','_roles'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_public','_roles'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -383,8 +383,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'checkbox' => array(
'name' => 'Checkbox',
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
'col2' => array('_label','_public','_roles','_max_selections'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_public','_roles','_max_selections'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -403,8 +403,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'url' => array(
'name' => 'URL',
'col1' => array('_title','_metakey','_help','_default','_url_text','_visibility'),
'col2' => array('_label','_placeholder','_url_target','_url_rel','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_url_target','_url_rel','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -419,8 +419,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'password' => array(
'name' => 'Password',
'col1' => array('_title','_metakey','_help','_min_chars','_max_chars','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_force_good_pass','_force_confirm_pass','_label_confirm_pass'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_force_good_pass','_force_confirm_pass','_label_confirm_pass'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -435,8 +435,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'image' => array(
'name' => 'Image Upload',
'col1' => array('_title','_metakey','_help','_allowed_types','_max_size','_crop','_visibility'),
'col2' => array('_label','_public','_roles','_upload_text','_upload_help_text','_button_text'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_public','_roles','_upload_text','_upload_help_text','_button_text'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -455,8 +455,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'file' => array(
'name' => 'File Upload',
'col1' => array('_title','_metakey','_help','_allowed_types','_max_size','_visibility'),
'col2' => array('_label','_public','_roles','_upload_text','_upload_help_text','_button_text'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_public','_roles','_upload_text','_upload_help_text','_button_text'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -475,8 +475,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'date' => array(
'name' => 'Date Picker',
'col1' => array( '_title', '_metakey', '_help', '_default', '_range', '_years', '_years_x', '_range_start', '_range_end', '_visibility' ),
'col2' => array( '_label', '_placeholder', '_public', '_roles', '_format', '_format_custom', '_pretty_format', '_disabled_weekdays' ),
'col3' => array( '_required', '_editable', '_icon' ),
'col2' => array( '_label', '_icon', '_placeholder', '_public', '_roles', '_format', '_format_custom', '_pretty_format', '_disabled_weekdays' ),
'col3' => array( '_required', '_editable' ),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -501,8 +501,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'time' => array(
'name' => 'Time Picker',
'col1' => array('_title','_metakey','_help','_format','_visibility'),
'col2' => array('_label','_placeholder','_default','_public','_roles','_intervals'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_default','_public','_roles','_intervals'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -517,8 +517,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'rating' => array(
'name' => 'Rating',
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_public','_roles','_number','_default'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_public','_roles','_number','_default'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -590,8 +590,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'googlemap' => array(
'name' => 'Google Map',
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -606,8 +606,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'youtube_video' => array(
'name' => 'YouTube Video',
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -622,8 +622,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'vimeo_video' => array(
'name' => 'Vimeo Video',
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -638,8 +638,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'soundcloud_track' => array(
'name' => 'SoundCloud Track',
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -653,8 +653,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'spotify' => array(
'name' => __( 'Spotify URL', 'ultimate-member' ),
'col1' => array('_title','_metakey','_help','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable','_icon'),
'col2' => array('_label','_icon','_placeholder','_public','_roles','_validate','_custom_validate'),
'col3' => array('_required','_editable'),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -668,8 +668,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'oembed' => array(
'name' => __( 'oEmbed', 'ultimate-member' ),
'col1' => array( '_title', '_metakey', '_help', '_default', '_visibility' ),
'col2' => array( '_label', '_placeholder', '_public', '_roles', '_validate', '_custom_validate' ),
'col3' => array( '_required', '_editable', '_icon' ),
'col2' => array( '_label', '_icon', '_placeholder', '_public', '_roles', '_validate', '_custom_validate' ),
'col3' => array( '_required', '_editable' ),
'validate' => array(
'_title' => array(
'mode' => 'required',
@@ -917,7 +917,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'pretty_format' => 1,
'years' => 115,
'years_x' => 'past',
'icon' => 'um-faicon-calendar',
'icon' => 'far fa-calendar-days',
),
'gender' => array(
@@ -956,7 +956,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-facebook',
'icon' => 'fab fa-facebook-f',
'validate' => 'facebook_url',
'url_text' => 'Facebook',
'advanced' => 'social',
@@ -974,11 +974,11 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-twitter', // 'fa-brands fa-x-twitter' for new FA styles
'icon' => 'fab fa-square-x-twitter',
'validate' => 'twitter_url',
'url_text' => 'X',
'advanced' => 'social',
'color' => '#4099FF', // #0f1419 for X symbol
'color' => '#0f1419',
'match' => 'https://twitter.com/',
),
@@ -992,7 +992,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-linkedin',
'icon' => 'fab fa-linkedin-in',
'validate' => 'linkedin_url',
'url_text' => 'LinkedIn',
'advanced' => 'social',
@@ -1010,7 +1010,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-instagram',
'icon' => 'fab fa-instagram',
'validate' => 'instagram_url',
'url_text' => 'Instagram',
'advanced' => 'social',
@@ -1028,7 +1028,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-skype',
'icon' => 'fab fa-skype',
'validate' => 'skype',
'url_text' => __( 'Join chat', 'ultimate-member' ),
),
@@ -1043,7 +1043,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-icon-ios-telephone',
'icon' => 'fab fa-viber',
'validate' => 'phone_number',
),
@@ -1057,7 +1057,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-icon-social-whatsapp',
'icon' => 'fab fa-whatsapp',
'validate' => 'phone_number',
),
@@ -1071,7 +1071,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-paper-plane',
'icon' => 'fab fa-telegram',
'validate' => 'telegram_url',
'url_text' => 'Telegram',
'match' => 'https://t.me/',
@@ -1085,9 +1085,12 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'required' => 0,
'public' => 1,
'editable' => true,
'icon' => 'fab fa-discord',
'url_target' => '_blank',
'url_text' => __( 'Discord', 'ultimate-member' ),
'url_rel' => 'nofollow',
'validate' => 'discord',
'color' => '#7289da',
),
'tiktok' => array(
@@ -1100,7 +1103,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-icon-ios-musical-note',
'icon' => 'fab fa-tiktok',
'validate' => 'tiktok_url',
'url_text' => 'TikTok',
'advanced' => 'social',
@@ -1116,7 +1119,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'required' => 0,
'public' => 1,
'editable' => true,
'icon' => 'um-faicon-twitch',
'icon' => 'fab fa-twitch',
'url_target' => '_blank',
'url_rel' => 'nofollow',
'validate' => 'twitch_url',
@@ -1134,7 +1137,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'required' => 0,
'public' => 1,
'editable' => true,
'icon' => 'um-icon-social-reddit',
'icon' => 'fab fa-reddit-alien',
'url_target' => '_blank',
'url_rel' => 'nofollow',
'validate' => 'reddit_url',
@@ -1154,7 +1157,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-youtube',
'icon' => 'fab fa-youtube',
'validate' => 'youtube_url',
'url_text' => __( 'YouTube', 'ultimate-member' ),
'advanced' => 'social',
@@ -1175,7 +1178,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'editable' => true,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-soundcloud',
'icon' => 'fab fa-soundcloud',
'validate' => 'soundcloud_url',
'url_text' => 'SoundCloud',
'advanced' => 'social',
@@ -1227,7 +1230,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'public' => 1,
'editable' => true,
'validate' => 'phone_number',
'icon' => 'um-faicon-phone',
'icon' => 'fas fa-phone',
),
'mobile_number' => array(
@@ -1239,7 +1242,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'public' => 1,
'editable' => true,
'validate' => 'phone_number',
'icon' => 'um-faicon-mobile',
'icon' => 'fas fa-mobile-screen',
),
// private use ( not public list )
@@ -1250,7 +1253,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'type' => 'image',
'label' => __('Change your profile photo','ultimate-member'),
'upload_text' => __('Upload your photo here','ultimate-member'),
'icon' => 'um-faicon-camera',
'icon' => 'fas fa-camera',
'crop' => 1,
'max_size' => ( UM()->options()->get('profile_photo_max_size') ) ? UM()->options()->get('profile_photo_max_size') : 999999999,
'min_width' => str_replace('px','',UM()->options()->get('profile_photosize')),
@@ -1264,7 +1267,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'type' => 'image',
'label' => __('Change your cover photo','ultimate-member'),
'upload_text' => __('Upload profile cover here','ultimate-member'),
'icon' => 'um-faicon-picture-o',
'icon' => 'far fa-image',
'crop' => 2,
'max_size' => ( UM()->options()->get('cover_photo_max_size') ) ? UM()->options()->get('cover_photo_max_size') : 999999999,
'modal_size' => 'large',
+44
View File
@@ -342,5 +342,49 @@ KEY meta_value_indx (um_value(191))
update_user_meta( $user_id, 'account_status', 'approved' );
}
}
/**
*
*/
public function set_icons_options() {
$fa_version = get_option( 'um_fa_version' );
$um_icons_list = get_option( 'um_icons_list' );
if ( empty( $um_icons_list ) || UM()->admin()->enqueue()::$fa_version !== $fa_version ) {
update_option( 'um_fa_version', UM()->admin()->enqueue()::$fa_version, false );
$common_icons = array();
$icons = file_get_contents( UM_PATH . 'assets/libs/fontawesome/metadata/icons.json' );
$icons = json_decode( $icons );
foreach ( $icons as $key => $data ) {
if ( ! isset( $data->styles ) ) {
continue;
}
foreach ( $data->styles as $style ) {
$style_class = '';
if ( 'solid' === $style ) {
$style_class = 'fas fa-';
} elseif ( 'regular' === $style ) {
$style_class = 'far fa-';
} elseif ( 'brands' === $style ) {
$style_class = 'fab fa-';
}
$label = count( $data->styles ) > 1 ? $data->label . ' (' . $style . ')' : $data->label;
$search = array_unique( array_merge( $data->search->terms, array( $key, strtolower( $data->label ) ) ) );
$common_icons[ $style_class . $key ] = array(
'label' => $label,
'search' => $search,
);
}
}
update_option( 'um_icons_list', $common_icons, false );
}
}
}
}
+2 -1
View File
@@ -191,7 +191,8 @@ final class Enqueue extends \um\common\Enqueue {
// Workaround when select2 deregistered (e.g. Woo + Impreza theme activated).
$this->register_select2();
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', array( 'um_ui', 'um_tipsy', 'um_raty', 'um_fonticons_ii', 'um_fonticons_fa', 'select2', 'um_fileupload', 'um_common', 'um_responsive', 'um_modal' ), UM_VERSION );
$deps = array_merge( array( 'um_ui', 'um_tipsy', 'um_raty', 'select2', 'um_fileupload', 'um_common', 'um_responsive', 'um_modal' ), self::$fonticons_handlers );
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', $deps, UM_VERSION );
wp_register_style( 'um_members', $css_url . 'um-members' . $suffix . '.css', array( 'um_styles' ), UM_VERSION );
// RTL styles.