HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/lcc.kaunokolegija.lt/wp-content/plugins/so-widgets-bundle/base/inc/fields/radio.class.php
<?php

/**
 * Class SiteOrigin_Widget_Field_Radio
 */
class SiteOrigin_Widget_Field_Radio extends SiteOrigin_Widget_Field_Base {
/**
	 * The list of options which may be selected.
	 *
	 * @var array
	 */
	protected $options;

	protected function render_field( $value, $instance ) {
		if ( ! isset( $this->options ) || empty( $this->options ) ) {
			return;
		}
		$i = 0;

		foreach ( $this->options as $k => $v ) {
			?>
			<label for="<?php echo esc_attr( $this->element_id . '-' . $i ); ?>">
				<input
					type="radio"
					name="<?php echo esc_attr( $this->element_name ); ?>"
					id="<?php echo esc_attr( $this->element_id . '-' . $i ); ?>"
					class="siteorigin-widget-input"
					value="<?php echo esc_attr( $k ); ?>"
					<?php checked( $k, $value ); ?>
				>
				<?php echo esc_html( $v ); ?>
			</label>
			<?php
			++$i;
		}
	}

	protected function sanitize_field_input( $value, $instance ) {
		$sanitized_value = $value;
		$keys = array_keys( $this->options );

		if ( ! in_array( $sanitized_value, $keys ) ) {
			$sanitized_value = isset( $this->default ) ? $this->default : false;
		}

		return $sanitized_value;
	}
}