Skip to content

Commit

Permalink
Merge pull request #796 from brainstormforce/release-candidate
Browse files Browse the repository at this point in the history
Build version 1.6.28
  • Loading branch information
sushmak02 authored Apr 16, 2024
2 parents dcce8a3 + 0be6e49 commit 6eedcac
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 103 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Requires at least:** 4.4
**Requires PHP:** 5.4
**Tested up to:** 6.5
**Stable tag:** 1.6.27
**Stable tag:** 1.6.28
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -140,6 +140,9 @@ This same applies when you are creating your Header/Footer using this plugin.

## Changelog ##

### 1.6.28 ###
- Fix: Error messages appearing for Display rules.

### 1.6.27 ###
- Improvement: Compatibility with latest Elementor and Elementor Pro 3.21 version.
- Improvement: Compatibility with PHP 8.3 version.
Expand Down
12 changes: 7 additions & 5 deletions admin/class-hfe-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ public function column_content( $column, $post_id ) {
public function column_display_location_rules( $locations ) {

$location_label = [];
$index = array_search( 'specifics', $locations['rule'] );
if ( false !== $index && ! empty( $index ) ) {
unset( $locations['rule'][ $index ] );
if ( is_array( $locations ) && is_array( $locations['rule'] ) && isset( $locations['rule'] ) ) {
$index = array_search( 'specifics', $locations['rule'] );
if ( false !== $index && ! empty( $index ) ) {
unset( $locations['rule'][ $index ] );
}
}

if ( isset( $locations['rule'] ) && is_array( $locations['rule'] ) ) {
Expand Down Expand Up @@ -448,8 +450,8 @@ public function ehf_save_meta( $post_id ) {
return;
}

$target_locations = array_map( 'sanitize_text_field', Astra_Target_Rules_Fields::get_format_rule_value( $_POST, 'bsf-target-rules-location' ) );
$target_exclusion = array_map( 'sanitize_text_field', Astra_Target_Rules_Fields::get_format_rule_value( $_POST, 'bsf-target-rules-exclusion' ) );
$target_locations = Astra_Target_Rules_Fields::get_format_rule_value( $_POST, 'bsf-target-rules-location' );
$target_exclusion = Astra_Target_Rules_Fields::get_format_rule_value( $_POST, 'bsf-target-rules-exclusion' );
$target_users = [];

if ( isset( $_POST['bsf-target-rules-users'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions header-footer-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* Author URI: https://www.brainstormforce.com/
* Text Domain: header-footer-elementor
* Domain Path: /languages
* Version: 1.6.27
* Version: 1.6.28
* Elementor tested up to: 3.21
* Elementor Pro tested up to: 3.21
*
* @package header-footer-elementor
*/

define( 'HFE_VER', '1.6.27' );
define( 'HFE_VER', '1.6.28' );
define( 'HFE_FILE', __FILE__ );
define( 'HFE_DIR', plugin_dir_path( __FILE__ ) );
define( 'HFE_URL', plugins_url( '/', __FILE__ ) );
Expand Down
99 changes: 50 additions & 49 deletions inc/lib/target-rule/class-astra-target-rules-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,72 +765,73 @@ public static function generate_target_rule_selector( $type, $selection_options,
}

$index = 0;
if ( is_array( $saved_values ) && is_array( $saved_values['rule'] ) ) {
foreach ( $saved_values['rule'] as $index => $data ) {
$output .= '<div class="astra-target-rule-condition ast-target-rule-' . $index . '" data-rule="' . $index . '" >';
/* Condition Selection */
$output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>';
$output .= '<div class="target_rule-condition-wrap" >';
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][' . $index . ']" class="target_rule-condition form-control ast-input">';
$output .= '<option value="">' . __( 'Select', 'header-footer-elementor' ) . '</option>';

foreach ( $saved_values['rule'] as $index => $data ) {
$output .= '<div class="astra-target-rule-condition ast-target-rule-' . $index . '" data-rule="' . $index . '" >';
/* Condition Selection */
$output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>';
$output .= '<div class="target_rule-condition-wrap" >';
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][' . $index . ']" class="target_rule-condition form-control ast-input">';
$output .= '<option value="">' . __( 'Select', 'header-footer-elementor' ) . '</option>';
foreach ( $selection_options as $group => $group_data ) {
$output .= '<optgroup label="' . $group_data['label'] . '">';
foreach ( $group_data['value'] as $opt_key => $opt_value ) {

foreach ( $selection_options as $group => $group_data ) {
$output .= '<optgroup label="' . $group_data['label'] . '">';
foreach ( $group_data['value'] as $opt_key => $opt_value ) {
// specific rules.
$selected = '';

// specific rules.
$selected = '';
if ( $data == $opt_key ) {
$selected = 'selected="selected"';
}

if ( $data == $opt_key ) {
$selected = 'selected="selected"';
$output .= '<option value="' . $opt_key . '" ' . $selected . '>' . $opt_value . '</option>';
}

$output .= '<option value="' . $opt_key . '" ' . $selected . '>' . $opt_value . '</option>';
$output .= '</optgroup>';
}
$output .= '</optgroup>';
}
$output .= '</select>';
$output .= '</div>';
$output .= '</select>';
$output .= '</div>';

$output .= '</div>';
$output .= '</div>';

/* Specific page selection */
$output .= '<div class="target_rule-specific-page-wrap" style="display:none">';
$output .= '<select name="' . esc_attr( $input_name ) . '[specific][]" class="target-rule-select2 target_rule-specific-page form-control ast-input " multiple="multiple">';

if ( 'specifics' == $data && isset( $saved_values['specific'] ) && null != $saved_values['specific'] && is_array( $saved_values['specific'] ) ) {
foreach ( $saved_values['specific'] as $data_key => $sel_value ) {
// posts.
if ( strpos( $sel_value, 'post-' ) !== false ) {
$post_id = (int) str_replace( 'post-', '', $sel_value );
$post_title = get_the_title( $post_id );
$output .= '<option value="post-' . $post_id . '" selected="selected" >' . $post_title . '</option>';
}
/* Specific page selection */
$output .= '<div class="target_rule-specific-page-wrap" style="display:none">';
$output .= '<select name="' . esc_attr( $input_name ) . '[specific][]" class="target-rule-select2 target_rule-specific-page form-control ast-input " multiple="multiple">';

if ( 'specifics' == $data && isset( $saved_values['specific'] ) && null != $saved_values['specific'] && is_array( $saved_values['specific'] ) ) {
foreach ( $saved_values['specific'] as $data_key => $sel_value ) {
// posts.
if ( strpos( $sel_value, 'post-' ) !== false ) {
$post_id = (int) str_replace( 'post-', '', $sel_value );
$post_title = get_the_title( $post_id );
$output .= '<option value="post-' . $post_id . '" selected="selected" >' . $post_title . '</option>';
}

// taxonomy options.
if ( strpos( $sel_value, 'tax-' ) !== false ) {
$tax_data = explode( '-', $sel_value );
// taxonomy options.
if ( strpos( $sel_value, 'tax-' ) !== false ) {
$tax_data = explode( '-', $sel_value );

$tax_id = (int) str_replace( 'tax-', '', $sel_value );
$term = get_term( $tax_id );
$term_name = '';
$tax_id = (int) str_replace( 'tax-', '', $sel_value );
$term = get_term( $tax_id );
$term_name = '';

if ( ! is_wp_error( $term ) ) {
$term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) );
if ( ! is_wp_error( $term ) ) {
$term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) );

if ( isset( $tax_data[2] ) && 'single' === $tax_data[2] ) {
$term_name = 'All singulars from ' . $term->name;
} else {
$term_name = $term->name . ' - ' . $term_taxonomy;
if ( isset( $tax_data[2] ) && 'single' === $tax_data[2] ) {
$term_name = 'All singulars from ' . $term->name;
} else {
$term_name = $term->name . ' - ' . $term_taxonomy;
}
}
}

$output .= '<option value="' . $sel_value . '" selected="selected" >' . $term_name . '</option>';
$output .= '<option value="' . $sel_value . '" selected="selected" >' . $term_name . '</option>';
}
}
}
$output .= '</select>';
$output .= '</div>';
}
$output .= '</select>';
$output .= '</div>';
}

$output .= '</div>';
Expand Down
Loading

0 comments on commit 6eedcac

Please sign in to comment.