HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wptuneprotect/wp-content/plugins/insert-php/includes/controls/class.dropdown.php
<?php

/**
 * Woody Dropdown List Control
 *
 * Main options:
 *  name            => a name of the control
 *  value           => a value to show in the control
 *  default         => a default value of the control if the "value" option is not specified
 *  items           => a callback to return items or an array of items to select
 *
 * @author Artem Prihodko <webtemyk@ya.ru>
 * @copyright (c) 2021, CreativeMotion
 *
 * @package factory-forms
 * @since 1.0.0
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'WINP_FactoryForms_Dropdown' ) ) {

	class WINP_FactoryForms_Dropdown extends Wbcr_FactoryForms460_DropdownControl {

		public $type = 'winp-dropdown';

		/**
		 * @param array $items
		 * @param null $selected
		 */
		protected function printItems( $items, $selected = null ) {
			foreach ( (array) $items as $item ) {
				$subitems = array();
				$data     = null;

				// this item is an associative array
				if ( isset( $item['type'] ) || isset( $item['value'] ) ) {
					$type     = isset( $item['type'] ) ? $item['type'] : 'option';
					$disabled = isset( $item['disabled'] ) && $item['disabled'] == 'disabled' ? 'disabled' : '';

					if ( 'group' === $type ) {
						$subitems = isset( $item['items'] ) ? $item['items'] : array();
					}

					$value = isset( $item['value'] ) ? $item['value'] : '';
					$title = isset( $item['title'] ) ? $item['title'] : __( '- empty -', 'wbcr_factory_forms_460' );

					$data = isset( $item['data'] ) ? $item['data'] : null;
				} else {
					$type = ( count( $item ) == 3 && $item[0] === 'group' ) ? 'group' : 'option';
					if ( 'group' === $type ) {
						$subitems = $item[2];
					}

					$title = $item[1];
					$value = esc_attr( $item[0] );
				}

				if ( 'group' === $type ) {
					?>
                    <optgroup label="<?php echo $title ?>" <?php echo $disabled; ?>>
						<?php $this->printItems( $subitems, $selected ); ?>
                    </optgroup>
					<?php
				} else {
					$attr    = ( $selected == $value ) ? 'selected="selected"' : '';
					$strData = '';

					if ( ! empty( $data ) ) {
						foreach ( $data as $key => $values ) {
							$strData = $strData . ' data-' . $key . '="' . ( is_array( $values ) ? implode( ',', $values ) : $values ) . '"';
						}
					}

					?>
                    <option value='<?php echo $value ?>' <?php echo $attr ?> <?php echo $strData ?>>
						<?php echo $title ?>
                    </option>
					<?php
				}
			}
		}
	}
}