| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined('ABSPATH') ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
$filterID = isset( $filter['ID']['value'] ) ? $filter['ID']['value'] : 0; |
| 8 |
$belongs_class = ( $filter['entity']['entity_belongs'] ) ? 'wpc-belongs ' : 'wpc-belongs-not '; |
| 9 |
$short_entity = $filter['entity']['short_entity']; |
| 10 |
$rowClass = ( $filterID === \FilterEverything\Filter\FilterFields::FLRT_NEW_FILTER_ID ) ? 'wpc-filter-item wpc-new-filter-item' : 'wpc-filter-item'; |
| 11 |
?> |
| 12 |
<div id="<?php echo esc_attr('wpc-filter-id-' . $filterID); ?>" class="wpc-filter-<?php echo esc_attr($filter['menu_order']['value']); ?> <?php echo esc_attr($belongs_class); ?><?php echo esc_attr($rowClass); ?>" data-fid="<?php echo esc_attr($filterID); ?>"> |
| 13 |
<div class="wpc-filter-head"> |
| 14 |
<div class="wpc-title-action widget-title-action"> |
| 15 |
<button type="button" class="wpc-action widget-action hide-if-no-js" aria-expanded="false"> |
| 16 |
<span class="toggle-indicator" aria-hidden="true"></span> |
| 17 |
</button> |
| 18 |
</div> |
| 19 |
<div class="wpc-filter-title ui-sortable-handle"> |
| 20 |
<ul class="wpc-custom-row wpc-filter-item-labels"> |
| 21 |
<li class="wpc-filter-order" title="<?php echo $filter['menu_order']['value']; ?>"><span class="wpc-filter-sortable-handle dashicons dashicons-menu"></span></li> |
| 22 |
<li class="wpc-filter-label"><?php echo esc_html($filter['label']['value']); ?></li> |
| 23 |
<li class="wpc-filter-entity"><?php |
| 24 |
echo flrt_get_filter_entity_name( $filter['entity']['value'] ); // Already escaped in function |
| 25 |
if( ! $filter['entity']['entity_belongs'] && ! in_array( $filter['entity']['value'], [ 'tax_numeric', 'post_meta_exists' ] ) ){ |
| 26 |
echo ' ' . flrt_help_tip( esc_html__('This filter is inactive because it is not related to the selected post type.', 'filter-everything'), $allow_html = false ); |
| 27 |
} |
| 28 |
?></li> |
| 29 |
<li class="wpc-filter-view"><?php echo flrt_get_filter_view_name( $filter['view']['value'] ); // Already escaped in function ?></li> |
| 30 |
<li class="wpc-filter-slug"><?php echo esc_html( $filter['slug']['value'] ); ?></li> |
| 31 |
</ul> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
<div class="wpc-filter-body"> |
| 35 |
<div class="wpc-additional-fields-selector"><a href="javascript:void(0);" class="wpc-more-options-toggle button"><?php esc_html_e('More options', 'filter-everything'); ?></a></div> |
| 36 |
<div class="wpc-filter-main-fields"> |
| 37 |
<table class="wpc-form-fields-table wpc-filter-<?php echo esc_attr($short_entity); ?>"> |
| 38 |
<tr class="wpc-filter-tr"> |
| 39 |
<td colspan="2"> |
| 40 |
<?php |
| 41 |
$meta = flrt_extract_vars( $filter, array( 'ID', 'parent', 'menu_order' ) ); |
| 42 |
$_meta = $meta; |
| 43 |
foreach ( $meta as $field_attributes ) { |
| 44 |
echo flrt_render_input( $field_attributes ); // Safe, escaped |
| 45 |
} |
| 46 |
?> |
| 47 |
</td> |
| 48 |
</tr> |
| 49 |
<?php |
| 50 |
|
| 51 |
$first_filters = flrt_extract_vars($filter, array( 'entity', 'instead-entity', 'e_name', 'label', 'slug', 'view', 'date_type', 'show_term_names', 'selected_and_above', 'show_range_list', 'range_list_input' ) ); |
| 52 |
|
| 53 |
foreach( $first_filters as $field_key => $field_attributes ){ |
| 54 |
|
| 55 |
if( isset( $field_attributes['skip_view'] ) && $field_attributes['skip_view'] ){ |
| 56 |
do_action_ref_array( 'wpc_cycle_filter_fields', array( &$first_filters, $field_key ) ); |
| 57 |
} else { |
| 58 |
flrt_include_admin_view('filter-field', array( |
| 59 |
'field_key' => $field_key, |
| 60 |
'attributes' => $field_attributes |
| 61 |
) |
| 62 |
); |
| 63 |
} |
| 64 |
} |
| 65 |
?> |
| 66 |
</table> |
| 67 |
</div> |
| 68 |
|
| 69 |
<div class="wpc-filter-additional-fields"> |
| 70 |
<table class="wpc-form-fields-table wpc-filter-<?php echo esc_attr($short_entity); ?>"> |
| 71 |
<?php |
| 72 |
|
| 73 |
foreach( $filter as $field_key => $field_attributes ) { |
| 74 |
|
| 75 |
if( isset( $field_attributes['skip_view'] ) && $field_attributes['skip_view'] ) { |
| 76 |
do_action_ref_array( 'wpc_cycle_filter_fields', array( &$filter, $field_key ) ); |
| 77 |
} else { |
| 78 |
flrt_include_admin_view('filter-field', array( |
| 79 |
'field_key' => $field_key, |
| 80 |
'attributes' => $field_attributes |
| 81 |
) |
| 82 |
); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
?> |
| 87 |
</table> |
| 88 |
</div> |
| 89 |
<div class="wpc-remove-filter-wrapper"> |
| 90 |
<table class="wpc-form-fields-table"> |
| 91 |
<tr class="wpc-filter-tr"> |
| 92 |
<td class="wpc-filter-label-td wpc-filter-delete-controls-td"> |
| 93 |
<div class="alignleft"> |
| 94 |
<span class="widget-control-close-wrapper"><button type="button" class="button-link wpc-done-action"><?php esc_html_e('Close', 'filter-everything'); ?></button> | |
| 95 |
<button type="button" class="button-link button-link-delete wpc-button-link-delete"><?php esc_html_e('Delete', 'filter-everything'); ?></button> |
| 96 |
</span> |
| 97 |
</div> |
| 98 |
<br class="clear" /> |
| 99 |
</td> |
| 100 |
<td class="wpc-filter-field-td wpc-filter-delete-td"> |
| 101 |
<div class="alignright wpc-filter-delete-wrapper" id="wpc-filter-delete-wrapper-<?php echo esc_attr( $_meta['ID']['value'] ); ?>"> |
| 102 |
<span class="spinner"></span> |
| 103 |
<input type="button" class="button wpc-filter-delete" data-fid="<?php echo esc_attr( $_meta['ID']['value'] ); ?>" value="<?php echo esc_attr( __('Delete, I\'m sure', 'filter-everything') ); ?>"> |
| 104 |
<input type="button" class="button right wpc-filter-delete-cancel" value="<?php echo esc_attr( __('Cancel', 'filter-everything') ); ?>"> |
| 105 |
</div> |
| 106 |
<br class="clear" /> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
</table> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
</div> |