File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/select.class.php.tar
httpdocs/wp-content/plugins/so-widgets-bundle/widgets/contact/fields/select.class.php 0000644 00000003246 15154764110 0033423 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
class SiteOrigin_Widget_ContactForm_Field_Select extends SiteOrigin_Widget_ContactForm_Field_Base {
public function render_field( $options ) {
if ( ! empty( $options['field']['multiple_select'] ) ) {
wp_enqueue_script( 'select2' );
wp_enqueue_style( 'select2' );
}
?>
<select
name="<?php echo esc_attr( $options['field_name'] ); ?><?php echo ! empty( $options['field']['multiple_select'] ) ? '[]' : ''; ?>"
id="<?php echo esc_attr( $options['field_id'] ); ?>"
<?php self::add_custom_attrs( 'select', $options ); ?>
<?php echo ! empty( $options['field']['multiple_select'] ) ? 'multiple' : ''; ?>
>
<?php
if ( $options['show_placeholder'] && empty( $options['field']['multiple_select'] ) ) {
?>
<option selected disabled>
<?php echo esc_html__( $options['field']['label'], 'so-widgets-bundle' ); ?>
</option>
<?php
}
if ( ! empty( $options['field']['options'] ) ) {
if (
! $options['show_placeholder'] &&
$options['field']['required']['required'] &&
empty( $options['field']['multiple_select'] )
) {
?>
<option selected <?php if ( ! $options['field']['required']['required'] ) {
echo 'disabled';
} ?>></option>
<?php
}
foreach ( $options['field']['options'] as $i => $option ) {
$value = ! empty( $options['field']['multiple_select'] ) && is_array( $options['value'] ) ? $options['value'][ $i ] : $options['value'];
?>
<option
value="<?php echo esc_attr( $option['value'] ); ?>"<?php echo selected( $option['value'], $value, false ); ?>>
<?php echo esc_html( $option['value'] ); ?>
</option>
<?php
}
}
?>
</select>
<?php
}
}
uyarreklam.com.tr/httpdocs/wp-content/plugins/so-widgets-bundle/base/inc/fields/select.class.php 0000644 00000007112 15155106206 0031776 0 ustar 00 var/www/vhosts <?php
/**
* Class SiteOrigin_Widget_Field_Select
*/
class SiteOrigin_Widget_Field_Select extends SiteOrigin_Widget_Field_Base {
/**
* The list of options which may be selected.
*
* @var array
*/
protected $options;
/**
* If present, this string is included as a disabled (not selectable) value at the top of the list of options. If
* there is no default value, it is selected by default. You might even want to leave the label value blank when
* you use this.
*
* @var string
*/
protected $prompt;
/**
* Determines whether this is a single or multiple select field.
*
* @var bool
*/
protected $multiple;
/**
* Determines whether this is a single or multiple select field.
*
* @var bool
*/
protected $select2;
public function enqueue_scripts() {
if ( empty( $this->select2 ) ) {
return;
}
wp_enqueue_script( 'select2' );
wp_enqueue_script(
'so-select-field',
plugin_dir_url( __FILE__ ) . 'js/select-field' . SOW_BUNDLE_JS_SUFFIX . '.js',
array( 'jquery' ),
SOW_BUNDLE_VERSION
);
wp_enqueue_style(
'so-select-field',
plugin_dir_url( __FILE__ ) . 'css/select-field.css',
array(),
SOW_BUNDLE_VERSION
);
}
/**
* Get the field name for the select element.
*
* This method returns the field name for the select element. If the
* select element supports multiple selections and the current context is
* not from Page Builder, '[]' is appended to the field name to indicate
* that it is an array. Otherwise, the field name is returned as is.
*
* @return string The field name for the select element.
*/
private function get_select_field_name() {
if (
! empty( $this->multiple ) &&
filter_input( INPUT_POST, 'action' ) !== 'so_panels_widget_form'
) {
return $this->element_name . '[]';
}
return $this->element_name;
}
protected function render_field( $value, $instance ) {
if ( ! empty( $this->select2 ) ) {
if ( ! empty( $this->input_css_classes ) ) {
$this->input_css_classes = array();
}
$this->input_css_classes[] = 'sow-select2';
}
?>
<select
name="<?php echo esc_attr( $this->get_select_field_name() ); ?>"
id="<?php echo esc_attr( $this->element_id ); ?>"
class="siteorigin-widget-input siteorigin-widget-input-select<?php if ( ! empty( $this->input_css_classes ) ) {
echo ' ' . implode( ' ', $this->input_css_classes );
} ?>"
<?php if ( ! empty( $this->multiple ) ) {
echo 'multiple';
} ?>>
<?php if ( empty( $this->multiple ) && isset( $this->prompt ) ) { ?>
<option value="default" disabled="disabled" selected="selected"><?php echo esc_html( $this->prompt ); ?></option>
<?php } ?>
<?php if ( isset( $this->options ) && ! empty( $this->options ) ) { ?>
<?php foreach ( $this->options as $key => $val ) { ?>
<?php
if ( is_array( $value ) ) {
$selected = selected( true, in_array( $key, $value ), false );
} else {
$selected = selected( $key, $value, false );
} ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php echo $selected; ?>><?php echo esc_html( $val ); ?></option>
<?php } ?>
<?php } ?>
</select>
<?php
}
protected function sanitize_field_input( $value, $instance ) {
$values = is_array( $value ) ? $value : array( $value );
$keys = array_keys( $this->options );
$sanitized_value = array();
foreach ( $values as $value ) {
if ( ! in_array( $value, $keys ) ) {
$sanitized_value[] = isset( $this->default ) ? $this->default : false;
} else {
$sanitized_value[] = $value;
}
}
return count( $sanitized_value ) == 1 ? $sanitized_value[0] : $sanitized_value;
}
}