GRAYBYTE WORDPRESS FILE MANAGER1812

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/ninja-forms/includes/Fields/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/ninja-forms/includes/Fields//ListImage.php
<?php

if (!defined('ABSPATH')) exit;

/**
 * Class NF_Fields_ListImage
 */
class NF_Fields_ListImage extends NF_Abstracts_List
{
    protected $_name = 'listimage';

    protected $_type = 'listimage';

    protected $_nicename = 'Select Image';

    protected $_section = 'common';

    protected $_icon = 'image';

    protected $_templates = 'listimage';

    protected $option_type = 'radio';

    protected $_settings =  ['label', 'image_options', 'show_option_labels', 'allow_multi_select', 'list_orientation', 'num_columns'];

    protected $_settings_exclude = ['options'];

    public function __construct()
    {
        parent::__construct();

        $this->_nicename = esc_html__('Select Image', 'ninja-forms');

        add_filter('ninja_forms_merge_tag_calc_value_' . $this->_type, [$this, 'get_calc_value'], 10, 2);

        add_filter('ninja_forms_localize_field_listimage', [$this,'localizeField'], 10, 2);

        add_filter('ninja_forms_localize_field_listimage_preview', [$this,'localizeField'], 10, 2);
    }

    public function admin_form_element($id, $value)
    {
        $form_id = get_post_meta(absint($_GET['post']), '_form_id', true);

        $field = Ninja_Forms()->form($form_id)->get_field($id);

        $settings = $field->get_settings();
        $multi_select = $field->get_setting('allow_multi_select');
        $options = $field->get_setting('image_options');
        $options = apply_filters('ninja_forms_render_options', $options, $settings);
        $options = apply_filters('ninja_forms_render_options_' . $this->_type, $options, $settings);

        $list = '';
        foreach ($options as $option) {
            $checked = '';
            $type = '';
            if ($multi_select === 1 || is_array($value)) {
                $type = 'checkbox';
            } else {
                $type = 'radio';
            }
            if (is_array($value) && in_array($option['value'], $value)) {
                $checked = "checked";
            } elseif ($value === $option['value']) {
                $checked = 'checked';
            }
            $list .= "<li><label><input type='" . $type . "' value='{$option['value']}' name='fields[$id][]' $checked>{$option['label']}</label></li>";
        }

        return "<input type='hidden' name='fields[$id]' value='0' ><ul>$list</ul>";
    }

    /*
     * Appropriate output for a column cell in submissions list.
     */
    public function custom_columns( $value, $field )
    {
        if( $this->_name != $field->get_setting( 'type' ) ) return $value;
        
        //Consider &amp; to be the same as the & values in database in a selectbox saved value:
        if( ! is_array( $value ) ) $value = array( htmlspecialchars_decode($value) );

        $settings = $field->get_settings();
        $options = $field->get_setting( 'image_options' );
        $options = apply_filters( 'ninja_forms_render_options', $options, $settings );
        $options = apply_filters( 'ninja_forms_render_options_' . $field->get_setting( 'type' ), $options, $settings );

        $output = '';
        if( ! empty( $options ) ) {
            foreach ($options as $option) {

                if ( ! in_array( $option[ 'value' ], $value ) ) continue;

                $output .= esc_html( $option[ 'label' ] ) . "<br />";
            }
        }

        return $output;
    }

    public function get_calc_value($value, $field)
    {
        $selected = explode( ',', $value );
        $value = 0;
        if (isset($field['image_options'])) {
            foreach ($field['image_options'] as $option) {
                if( ! isset( $option[ 'value' ] ) || ! in_array( $option[ 'value' ], $selected )  || ! isset( $option[ 'calc' ] )  || ! is_numeric( $option[ 'calc' ] )) continue;
                $value +=  $option[ 'calc' ];
            }
        }
        return $value;
    }

    public function localizeField($field)
    {
        foreach ($field['settings']['image_options'] as $index => $img) {
            if (isset($img['image_id']) && is_numeric($img['image_id'])) {
                $post = get_post(intval($img['image_id']));
                if ($post) {
                    $img_alt = get_post_meta($img['image_id'], '_wp_attachment_image_alt');

                    $field['settings']['image_options'][$index]['img_title'] = esc_attr($post->post_title);
                    if (is_array($img_alt) && ! empty($img_alt)) {
                        $field['settings']['image_options'][$index]['alt_text'] = esc_attr($img_alt[0]);
                    } else {
                        $field['settings']['image_options'][$index]['alt_text'] = '';
                    }
                } else {
                    $field['settings']['image_options'][$index]['image'] = Ninja_forms::$url . 'assets/img/no-image-available-icon-6.jpg';
                    $field['settings']['image_options'][$index]['img_title'] = '';
                    $field['settings']['image_options'][$index]['alt_text'] = 'Image Not Available';
                }
            } else {
                $field['settings']['image_options'][$index]['image'] = Ninja_forms::$url . 'assets/img/no-image-available-icon-6.jpg';
                $field['settings']['image_options'][$index]['img_title'] = '';
                $field['settings']['image_options'][$index]['alt_text'] = 'Image Not Available';
            }
        }

        return $field;
    }
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:23
giriqfky / giriqfky
0755
.htaccess
0.41 KB
July 10 2025 04:32:23
giriqfky / giriqfky
0644
Address.php
0.678 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Address2.php
0.649 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Button.php
0.546 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Checkbox.php
6.439 KB
July 07 2025 22:00:20
giriqfky / giriqfky
0644
City.php
0.581 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Color.php
0.608 KB
March 15 2016 02:24:24
giriqfky / giriqfky
0644
Confirm.php
1.012 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCard.php
0.572 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCardCVC.php
0.803 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCardExpiration.php
0.975 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCardFullName.php
0.842 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCardNumber.php
0.844 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
CreditCardZip.php
0.776 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Date.php
9.434 KB
July 07 2025 22:00:20
giriqfky / giriqfky
0644
Email.php
1.603 KB
September 30 2024 22:20:16
giriqfky / giriqfky
0644
FirstName.php
1.134 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
HTML.php
2.262 KB
July 29 2024 13:30:44
giriqfky / giriqfky
0644
Hidden.php
0.954 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
LastName.php
1.126 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
ListCheckbox.php
2.09 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
ListCountry.php
4.855 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
ListImage.php
5.282 KB
October 24 2024 00:36:22
giriqfky / giriqfky
0644
ListModifier.php
0.468 KB
March 15 2016 02:24:24
giriqfky / giriqfky
0644
ListMultiSelect.php
2.031 KB
August 17 2021 13:06:24
giriqfky / giriqfky
0644
ListRadio.php
0.999 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
ListSelect.php
1.035 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
ListState.php
1.375 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Note.php
1.498 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Number.php
0.683 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Password.php
0.779 KB
February 08 2021 23:03:26
giriqfky / giriqfky
0644
PasswordConfirm.php
2.454 KB
March 12 2025 21:40:36
giriqfky / giriqfky
0644
Phone.php
0.61 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Product.php
8.379 KB
February 22 2023 23:20:58
giriqfky / giriqfky
0644
Quantity.php
0.673 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Recaptcha.php
3.26 KB
October 04 2023 20:07:10
giriqfky / giriqfky
0644
RecaptchaV3.php
0.422 KB
June 07 2021 21:40:12
giriqfky / giriqfky
0644
Repeater.php
8.702 KB
April 30 2024 21:16:06
giriqfky / giriqfky
0644
Shipping.php
2.505 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Spam.php
1.817 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
StarRating.php
0.771 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Submit.php
0.867 KB
July 29 2024 13:30:44
giriqfky / giriqfky
0644
Terms.php
6.291 KB
November 18 2024 20:55:28
giriqfky / giriqfky
0644
Textarea.php
1.597 KB
February 09 2023 21:52:18
giriqfky / giriqfky
0644
Textbox.php
1.011 KB
February 09 2023 21:52:18
giriqfky / giriqfky
0644
TimedSubmit.php
0.537 KB
March 15 2016 02:24:24
giriqfky / giriqfky
0644
Total.php
1.192 KB
February 22 2023 23:20:58
giriqfky / giriqfky
0644
Unknown.php
2.835 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
Zip.php
0.596 KB
February 04 2020 21:17:42
giriqfky / giriqfky
0644
hr.php
0.88 KB
July 29 2024 13:30:44
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF