Skip to content

Commit

Permalink
Merge branch 'release/1.64.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Nov 24, 2024
2 parents d014a5c + a5c789d commit d18b658
Show file tree
Hide file tree
Showing 32 changed files with 495 additions and 69 deletions.
20 changes: 11 additions & 9 deletions admin/tpl/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@
</div>
<?php } ?>
<div class="so-action-links">
<div class="so-widget-toggle-active">
<button class="button-secondary so-widget-activate" data-status="1">
<?php esc_html_e( 'Activate', 'so-widgets-bundle' ); ?>
</button>

<button class="button-secondary so-widget-deactivate" data-status="0">
<?php esc_html_e( 'Deactivate', 'so-widgets-bundle' ); ?>
</button>
</div>
<?php if ( empty( $widget['HideActivate'] ) ) { ?>
<div class="so-widget-toggle-active">
<button class="button-secondary so-widget-activate" data-status="1">
<?php esc_html_e( 'Activate', 'so-widgets-bundle' ); ?>
</button>

<button class="button-secondary so-widget-deactivate" data-status="0">
<?php esc_html_e( 'Deactivate', 'so-widgets-bundle' ); ?>
</button>
</div>
<?php } ?>

<?php
/** @var SiteOrigin_Widget $widget_object */
Expand Down
34 changes: 22 additions & 12 deletions base/css/admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ div.siteorigin-widget-form {
.select2 {
width: 100% !important;

.select2-selection__choice__remove {
height: 100%;

span {
display: inline-block;
margin-top: 8px;
transform: translateY(-50%);
}
}

.select2-selection--multiple {
align-items: center;
background-color: #fff;
Expand Down Expand Up @@ -945,18 +955,6 @@ div.siteorigin-widget-form {

}

/* Icons */
.widget-icon.so-widget-icon {
background-size: cover;
background-image: url("img/bundle-icon.png");

&.so-block-editor-icon {
width: 20px;
height: 20px;
display: inline-block;
}
}

// WP 5 Block Editor compatibility styles
.block-editor,
.block-editor-page {
Expand Down Expand Up @@ -1119,3 +1117,15 @@ div.siteorigin-widget-form {
}
}
}

// SiteOrigin Widget Icon.
.widget-icon.so-widget-icon {
background-image: url('img/bundle-icon.png');
background-size: cover;

&.so-block-editor-icon {
background-size: contain;
height: 100%;
width: 40px;
}
}
18 changes: 12 additions & 6 deletions base/inc/fields/font.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Class SiteOrigin_Widget_Field_Font
*/
class SiteOrigin_Widget_Field_Font extends SiteOrigin_Widget_Field_Base {

protected function render_field( $value, $instance ) {
static $widget_font_families;

Expand All @@ -12,11 +13,12 @@ protected function render_field( $value, $instance ) {
}
?>
<div class="siteorigin-widget-font-selector siteorigin-widget-field-subcontainer">
<select name="<?php echo esc_attr( $this->element_name ); ?>" id="<?php echo esc_attr( $this->element_id ); ?>" class="siteorigin-widget-input">
<select
name="<?php echo esc_attr( $this->element_name ); ?>"
id="<?php echo esc_attr( $this->element_id ); ?>" class="siteorigin-widget-input"
data-selected="<?php echo esc_attr( $value ); ?>"
>
<option value="default" selected="selected"><?php esc_html_e( 'Use theme font', 'so-widgets-bundle' ); ?></option>
<?php foreach ( $widget_font_families as $key => $val ) { ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $value ); ?>><?php echo esc_html( $val ); ?></option>
<?php } ?>
</select>
</div>
<?php
Expand All @@ -28,6 +30,7 @@ protected function sanitize_field_input( $value, $instance ) {
}

$sanitized_value = trim( $value );

// Any alphanumeric character followed by alphanumeric or whitespace characters (except newline),
// with optional colon followed by optional variant.
if ( preg_match( '/[\w\d]+[\w\d\t\r ]*(:\w+)?/', $sanitized_value, $sanitized_matches ) ) {
Expand All @@ -41,9 +44,12 @@ protected function sanitize_field_input( $value, $instance ) {
if ( empty( $widget_font_families ) ) {
$widget_font_families = siteorigin_widgets_font_families();
}
$keys = array_keys( $widget_font_families );

if ( ! in_array( $sanitized_value, $keys ) ) {
// If selected font isn't set to default, ensure the font is valid.
if (
$sanitized_value !== 'default' &&
! isset( $widget_font_families[ $sanitized_value ] )
) {
$sanitized_value = isset( $this->default ) ? $this->default : 'default';
}

Expand Down
6 changes: 5 additions & 1 deletion base/inc/fields/select.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ protected function render_field( $value, $instance ) {
}
?>
<select
name="<?php echo esc_attr( $this->element_name ); ?>"
name="<?php echo esc_attr( $this->element_name );
if ( ! empty( $this->multiple ) ) {
echo '[]';
}
?>"
id="<?php echo esc_attr( $this->element_id ); ?>"
class="siteorigin-widget-input siteorigin-widget-input-select<?php if ( ! empty( $this->input_css_classes ) ) {
echo ' ' . implode( ' ', $this->input_css_classes );
Expand Down
Loading

0 comments on commit d18b658

Please sign in to comment.