updated plugin Menu Icons version 0.13.23
This commit is contained in:
@ -51,6 +51,19 @@ final class Menu_Icons_Front_End {
|
||||
*/
|
||||
protected static $hidden_label_class = 'visuallyhidden';
|
||||
|
||||
/**
|
||||
* Align-self map for vertical-align values.
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private static $align_self_map = array(
|
||||
'top' => 'flex-start',
|
||||
'middle' => 'center',
|
||||
'bottom' => 'flex-end',
|
||||
'baseline' => 'baseline',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Add hooks for front-end functionalities
|
||||
@ -339,6 +352,18 @@ final class Menu_Icons_Front_End {
|
||||
|
||||
$rule = self::$default_style[ $key ];
|
||||
|
||||
// Special handling for vertical-align because it affects the layout of flex containers.
|
||||
if ( 'vertical_align' === $key ) {
|
||||
if ( ! isset( $meta[ $key ] ) || $meta[ $key ] === $rule['value'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$stored = $meta[ $key ];
|
||||
$style_a[ $rule['property'] ] = $stored;
|
||||
$style_a['align-self'] = isset( self::$align_self_map[ $stored ] ) ? self::$align_self_map[ $stored ] : 'center';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! isset( $meta[ $key ] ) || $meta[ $key ] === $rule['value'] ) {
|
||||
continue;
|
||||
}
|
||||
@ -355,13 +380,13 @@ final class Menu_Icons_Front_End {
|
||||
return $style_s;
|
||||
}
|
||||
|
||||
foreach ( $style_a as $key => $value ) {
|
||||
$style_s .= "{$key}:{$value};";
|
||||
foreach ( $style_a as $prop => $value ) {
|
||||
$style_s .= "{$prop}:{$value};";
|
||||
}
|
||||
|
||||
$style_s = esc_attr( $style_s );
|
||||
|
||||
if ( $as_attribute ) {
|
||||
if ( $as_attribute ) {
|
||||
$style_s = sprintf( ' style="%s"', $style_s );
|
||||
}
|
||||
|
||||
@ -483,10 +508,10 @@ final class Menu_Icons_Front_End {
|
||||
}
|
||||
}
|
||||
if ( ! empty( $width ) ) {
|
||||
$width = sprintf( ' width="%d"', $width );
|
||||
$width = sprintf( ' width="%d"', esc_attr( $width ) );
|
||||
}
|
||||
if ( ! empty( $height ) ) {
|
||||
$height = sprintf( ' height="%d"', $height );
|
||||
$height = sprintf( ' height="%d"', esc_attr( $height ) );
|
||||
}
|
||||
$image_alt = get_post_meta( $meta['icon'], '_wp_attachment_image_alt', true );
|
||||
$image_alt = $image_alt ? wp_strip_all_tags( $image_alt ) : '';
|
||||
@ -494,7 +519,7 @@ final class Menu_Icons_Front_End {
|
||||
'<img src="%s" class="%s" aria-hidden="true" alt="%s"%s%s%s/>',
|
||||
esc_url( wp_get_attachment_url( $meta['icon'] ) ),
|
||||
esc_attr( $classes ),
|
||||
$image_alt,
|
||||
esc_attr( $image_alt ),
|
||||
$width,
|
||||
$height,
|
||||
$style
|
||||
|
||||
@ -113,7 +113,7 @@ final class Menu_Icons_Font_Awesome {
|
||||
</div>
|
||||
</div>
|
||||
<a class="check" href="#" title="%s"><div class="media-modal-icon"></div></a>',
|
||||
esc_attr__( 'Deselect', 'icon-picker' )
|
||||
esc_attr__( 'Deselect', 'menu-icons' )
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -75,6 +75,15 @@ abstract class Kucrut_Form_Field {
|
||||
'multiple',
|
||||
);
|
||||
|
||||
/**
|
||||
* URL path to this directory
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected static $url_path;
|
||||
|
||||
/**
|
||||
* Holds allowed html tags
|
||||
*
|
||||
@ -114,6 +123,15 @@ abstract class Kucrut_Form_Field {
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Holds field arguments
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @var stdClass
|
||||
* @access protected
|
||||
*/
|
||||
protected $args;
|
||||
|
||||
|
||||
/**
|
||||
* Loader
|
||||
@ -149,6 +167,7 @@ abstract class Kucrut_Form_Field {
|
||||
) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
// translators: %1$s - the name of the class, %2$s - the type of the field.
|
||||
esc_html__( '%1$s: Type %2$s is not supported, reverting to text.', 'menu-icons' ),
|
||||
__CLASS__,
|
||||
esc_html( $field['type'] )
|
||||
@ -384,6 +403,13 @@ class Kucrut_Form_Field_Textarea extends Kucrut_Form_Field {
|
||||
);
|
||||
|
||||
|
||||
protected function set_properties() {
|
||||
if ( ! is_string( $this->field['value'] ) ) {
|
||||
$this->field['value'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function render() {
|
||||
printf( // WPCS: XSS ok.
|
||||
$this->template,
|
||||
|
||||
@ -103,6 +103,14 @@ final class Menu_Icons_Meta {
|
||||
$value['position'] = $defaults['position'];
|
||||
}
|
||||
|
||||
// Backward-compatibility: values removed in favour of align-self support.
|
||||
$supported_vertical_align = array( 'top', 'middle', 'bottom', 'baseline' );
|
||||
if ( isset( $value['vertical_align'] ) &&
|
||||
! in_array( $value['vertical_align'], $supported_vertical_align, true )
|
||||
) {
|
||||
$value['vertical_align'] = 'middle';
|
||||
}
|
||||
|
||||
if ( isset( $value['size'] ) && ! isset( $value['font_size'] ) ) {
|
||||
$value['font_size'] = $value['size'];
|
||||
unset( $value['size'] );
|
||||
|
||||
@ -473,6 +473,7 @@ final class Menu_Icons_Settings {
|
||||
'id' => $menu_key,
|
||||
'title' => __( 'Current Menu', 'menu-icons' ),
|
||||
'description' => sprintf(
|
||||
// translators: %s - the name of the menu.
|
||||
__( '"%s" menu settings', 'menu-icons' ),
|
||||
apply_filters( 'single_term_title', $menu_term->name )
|
||||
),
|
||||
@ -534,18 +535,10 @@ final class Menu_Icons_Settings {
|
||||
'label' => __( 'Vertical Align', 'menu-icons' ),
|
||||
'default' => 'middle',
|
||||
'choices' => array(
|
||||
array(
|
||||
'value' => 'super',
|
||||
'label' => __( 'Super', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'top',
|
||||
'label' => __( 'Top', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'text-top',
|
||||
'label' => __( 'Text Top', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'middle',
|
||||
'label' => __( 'Middle', 'menu-icons' ),
|
||||
@ -554,18 +547,10 @@ final class Menu_Icons_Settings {
|
||||
'value' => 'baseline',
|
||||
'label' => __( 'Baseline', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'text-bottom',
|
||||
'label' => __( 'Text Bottom', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'bottom',
|
||||
'label' => __( 'Bottom', 'menu-icons' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'sub',
|
||||
'label' => __( 'Sub', 'menu-icons' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'font_size' => array(
|
||||
@ -770,6 +755,7 @@ final class Menu_Icons_Settings {
|
||||
'all' => __( 'All', 'menu-icons' ),
|
||||
'preview' => __( 'Preview', 'menu-icons' ),
|
||||
'settingsInfo' => sprintf(
|
||||
// translators: %2$s - a link to the Customizer with the label `the customizer`.
|
||||
'<div> %1$s <p>' . esc_html__( 'Please note that the actual look of the icons on the front-end will also be affected by the style of your active theme. You can add your own CSS using %2$s.', 'menu-icons' ) . '</p></div>',
|
||||
$box_data,
|
||||
sprintf(
|
||||
|
||||
Reference in New Issue
Block a user