Plugin Directory

Changeset 3216886


Ignore:
Timestamp:
01/04/2025 02:08:40 PM (15 months ago)
Author:
yehi
Message:

Version 1.2.8

Location:
advanced-notifications/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • advanced-notifications/trunk/plugins/easy-interface-settings/assets/js/eis-settings-fields.js

    r3214908 r3216886  
    11jQuery(document).ready( function($) {
    2     // HIDE CHILD FIELDS
    3     function eis_hide_children_of_hidden_parent(element) {
     2    // HIDE CHILDREN FIELDS
     3    function eis_hide_children_field(element) {
    44        element = typeof element !== 'undefined' ? element : false;
    55        if (element) {
    6             let parent_option_name = $(element).closest('[data-option-name]').data('option-name');
     6            let parent_option_name = $(element).attr('data-option-name');
    77            if (typeof parent_option_name != 'undefined') {
    88                let parent_value = $(element).val();
    9                 let children = $('[data-parent-option="'+parent_option_name+'"]');
    10                 children.each(function(index,child) {
    11                     let child_option_name = $(child).closest('[data-option-name]').data('option-name');
    12                     if ($(child).hasClass('hidden')) {
    13                         let children_2 = $('[data-parent-option="'+child_option_name+'"]').addClass('eis-children-hidden');
    14                     } else {
    15                         let children_2 = $('[data-parent-option="'+child_option_name+'"]').removeClass('eis-children-hidden');
    16                     }
     9                let children_option = $('[data-parent-option="'+parent_option_name+'"]');
     10                children_option.each(function(index,child) {
     11                    $(child).addClass('hidden');
    1712                });
    1813            }
    19         } else {
    20             $('[data-parent-option]').each(function(index,element) {
    21                 var parent_attr = $(element).find('select').attr("name");
    22                 if (typeof parent_attr != 'undefined') {
    23                     $('[data-parent-option]').each(function(index,ele) {
    24                         var parent_option = $(this).data('parent-option');
    25                         var parent = $('select[name$="['+parent_option+']"]').closest('.form-field');
    26                         var is_parent = parent_attr.includes('['+parent_option+']');
    27                         if (is_parent) {
    28                             $(this).addClass('eis-children-hidden');
    29                         } else if ($(parent).hasClass('hidden') != true) {
    30                             $(this).removeClass('eis-children-hidden');
    31                         }
    32                     });
    33                 }
    34             });
    3514        }
    3615    }
    37     function eis_hide_unselected_child_field(element) {
     16    // HIDE CHILD FIELDS
     17    function eis_hide_child_field(element) {
    3818        element = typeof element !== 'undefined' ? element : false;
     19        if (!$(element).is('input, select')) {
     20            element = $(element).find('input, select')[0];
     21        }
    3922        if (element) {
    40             let parent_option_name = $(element).closest('[data-option-name]').data('option-name');
     23            let parent_option_name = $(element).closest('[data-option-name]').attr('data-option-name');
    4124            if (typeof parent_option_name != 'undefined') {
    4225                let parent_value = $(element).val();
    43                 let children = $('[data-parent-option="'+parent_option_name+'"]');
    44                 children.each(function(index,child) {
    45                     let child_value = $(child).data('parent-value');
    46                     if (typeof child_value != 'undefined') {
    47                         if (jQuery.inArray(parent_value, child_value.split(',')) !== -1) {
     26                let children_option = $('[data-parent-option="'+parent_option_name+'"]');
     27                children_option.each(function(index,child) {
     28                    let child_parent_show_value = $(child).attr('data-parent-value');
     29                    let child_parent_hide_value = $(child).attr('data-hide-value');
     30                    if (typeof child_parent_show_value != 'undefined') {
     31                        if (jQuery.inArray(parent_value, child_parent_show_value.split(',')) !== -1) {
    4832                            $(child).removeClass('hidden');
     33                            eis_hide_child_field(child);
    4934                        } else {
    5035                            $(child).addClass('hidden');
     36                            eis_hide_children_field(child);
     37                        }
     38                    } else if (typeof child_parent_hide_value != 'undefined') {
     39                        if (jQuery.inArray(parent_value, child_parent_hide_value.split(',')) !== -1) {
     40                            $(child).addClass('hidden');
     41                            eis_hide_children_field(child);
     42                        } else {
     43                            $(child).removeClass('hidden');
     44                            eis_hide_child_field(child);
    5145                        }
    5246                    }
    5347                });
    5448            }
    55         } else {
    56             $('[data-parent-option]').each(function(index,element) {
    57                 let parent_option = $(element).data('parent-option');
    58                 let parent_value = $(element).data('parent-value');
    59                 if (typeof parent_value != 'undefined') {
    60                     let parent = $('select[name$="['+parent_option+']"]').val();
    61                     if (jQuery.inArray(parent, parent_value.split(',')) !== -1) {
    62                         $(element).removeClass('hidden');
    63                     } else {
    64                         $(element).addClass('hidden');
    65                     }
    66                 }
    67             });
    6849        }
    69         eis_hide_children_of_hidden_parent(element);
    7050    }
    71     // eis_hide_unselected_child_field();
    72     function eis_hide_selected_child_field(element) {
    73         element = typeof element !== 'undefined' ? element : false;
    74         if (element) {
    75             let parent_option_name = $(element).closest('[data-option-name]').data('option-name');
    76             if (typeof parent_option_name != 'undefined') {
    77                 let parent_value = $(element).val();
    78                 let children = $('[data-parent-option="'+parent_option_name+'"]');
    79                 children.each(function(index,child) {
    80                     let child_value = $(child).data('hide-value');
    81                     if (typeof child_value != 'undefined') {
    82                         if (jQuery.inArray(parent_value, child_value.split(',')) !== -1) {
    83                             $(child).addClass('hidden');
    84                         } else {
    85                             $(child).removeClass('hidden');
    86                         }
    87                     }
    88                 });
    89             }
    90         } else {
    91             $('[data-parent-option]').each(function(index,element) {
    92                 let parent_option = $(element).data('parent-option');
    93                 let hide_value = $(element).data('hide-value');
    94                 if (typeof hide_value != 'undefined') {
    95                     let parent = $('select[name$="['+parent_option+']"]').val();
    96                     if (jQuery.inArray(parent, hide_value.split(',')) !== -1) {
    97                         $(element).addClass('hidden');
    98                     } else {
    99                         $(element).removeClass('hidden');
    100                     }
    101                 }
    102             });
    103         }
    104         eis_hide_children_of_hidden_parent(element);
    105     }
    106     // eis_hide_selected_child_field();
    10751    $(document).on("input", ".eis-interface-settings input, .eis-interface-settings select", function(e){
    10852        e.stopPropagation();
    109         eis_hide_unselected_child_field(this);
    110         eis_hide_selected_child_field(this);
     53        eis_hide_child_field(this);
    11154    });
    112 
    11355    $(document).on("click", "input[name*=_display_eis_checkbox]", function(e) {
    11456        if ($(this).is(":checked")) {
  • advanced-notifications/trunk/plugins/easy-interface-settings/easy-interface-settings.php

    r3214908 r3216886  
    22/*
    33*
    4 *   Easy Interface Settings V 1.0.8
     4*   Easy Interface Settings V 1.0.9
    55*   ------------------------------------------------
    66*   Copyright Linker  - https://linker.co.il
  • advanced-notifications/trunk/plugins/easy-interface-settings/includes/eis-admin-functions.php

    r3214908 r3216886  
    695695    $return = false;
    696696    $current_input_register_info = get_register_eis_interfaces_options($current_interface_id, $current_input_id);
    697     $current_input_parent_name = (isset($current_input_register_info['parent_name'])) ? $current_input_register_info['parent_name'] : null;
    698     $current_input_show_on_value = (isset($current_input_register_info['show_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['show_on_value'])) : null;
    699     $current_input_hide_on_value = (isset($current_input_register_info['hide_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['hide_on_value'])) : null;
    700     if ($current_input_parent_name != null && $current_input_show_on_value != null) {
    701         $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name);
    702         $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id);
    703         $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val);
    704         if ($current_input_parent_name_val != null && !in_array($current_input_parent_name_val, $current_input_show_on_value)) {
     697    $current_input_parent_name = (isset($current_input_register_info['parent_name'])) ? $current_input_register_info['parent_name'] : false;
     698    if ($current_input_parent_name) {
     699        if (is_eis_option_hidden($current_interface_id, $current_input_parent_name)) {
    705700            $return = true;
    706         } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') {
    707             $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null;
    708             if (!in_array($current_input_parent_name_first_select, $current_input_show_on_value)) {
    709                 $return = true;
    710             }
    711         }
    712     } elseif ($current_input_parent_name != null && $current_input_hide_on_value != null) {
    713         $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name);
    714         $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id);
    715         $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val);
    716         if ($current_input_parent_name_val != null && in_array($current_input_parent_name_val, $current_input_hide_on_value)) {
    717             $return = true;
    718         } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') {
    719             $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null;
    720             if (in_array($current_input_parent_name_first_select, $current_input_hide_on_value)) {
    721                 $return = true;
     701        } else {
     702            $current_input_show_on_value = (isset($current_input_register_info['show_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['show_on_value'])) : false;
     703            $current_input_hide_on_value = (isset($current_input_register_info['hide_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['hide_on_value'])) : false;
     704            if ($current_input_show_on_value) {
     705                $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name);
     706                $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id);
     707                $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val);
     708                if ($current_input_parent_name_val && !in_array($current_input_parent_name_val, $current_input_show_on_value)) {
     709                    $return = true;
     710                } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') {
     711                    $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null;
     712                    if (!in_array($current_input_parent_name_first_select, $current_input_show_on_value)) {
     713                        $return = true;
     714                    }
     715                }
     716            } elseif ($current_input_hide_on_value) {
     717                $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name);
     718                $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id);
     719                $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val);
     720                if ($current_input_parent_name_val != null && in_array($current_input_parent_name_val, $current_input_hide_on_value)) {
     721                    $return = true;
     722                } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') {
     723                    $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null;
     724                    if (in_array($current_input_parent_name_first_select, $current_input_hide_on_value)) {
     725                        $return = true;
     726                    }
     727                }
    722728            }
    723729        }
  • advanced-notifications/trunk/readme.txt

    r3214908 r3216886  
    33Tags: notice, notifications, alerts, popup, messages
    44Requires at least: 5.6.2
    5 Tested up to: 6.5.0
    6 Stable tag: 1.2.7
     5Tested up to: 6.7.1
     6Stable tag: 1.2.8
    77License: GPLv2 or later
    88
     
    7676
    7777== Changelog ==
     78
     79= 1.2.8 =
     80* Update: eis plugin
    7881
    7982= 1.2.7 =
Note: See TracChangeset for help on using the changeset viewer.