| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ict/wp-content/plugins/so-widgets-bundle/base/inc/fields/ |
Upload File : |
<?php
/**
* The common base class for text input type fields.
*
* Class SiteOrigin_Widget_Field_Text
*/
abstract class SiteOrigin_Widget_Field_Text_Input_Base extends SiteOrigin_Widget_Field_Base {
/**
* A string to display before any text has been input.
*
* @var string
*/
protected $placeholder;
/**
* If true, this field will not be editable.
*
* @var bool
*/
protected $readonly;
/**
* The type of this input.
*
* @var string
*/
protected $input_type;
protected $onclick;
protected $sanitize = 'text';
/**
* The CSS classes to be applied to the rendered text input.
*/
protected function get_input_classes() {
return array( 'widefat', 'siteorigin-widget-input' );
}
/**
* The data attributes to be added to the input element.
*/
protected function get_input_data_attributes() {
return array();
}
/**
* The attributes to be added to the input element.
*/
protected function get_input_attributes() {
return array();
}
protected function get_default_options() {
return array(
'input_type' => 'text',
);
}
protected function render_data_attributes( $data_attributes ) {
$attr_string = '';
foreach ( $data_attributes as $name => $value ) {
$attr_string .= ' data-' . esc_html( $name ) . '="' . esc_attr( $value ) . '"';
}
echo $attr_string;
}
protected function render_attributes( $attributes ) {
$attr_string = '';
foreach ( $attributes as $name => $value ) {
$attr_string .= ' ' . esc_html( $name ) . '="' . esc_attr( $value ) . '"';
}
echo $attr_string;
}
protected function render_field( $value, $instance ) {
?>
<input type="<?php echo esc_attr( $this->input_type ); ?>"
name="<?php echo esc_attr( $this->element_name ); ?>"
id="<?php echo esc_attr( $this->element_id ); ?>"
value="<?php echo esc_attr( $value ); ?>"
<?php $this->render_data_attributes( $this->get_input_data_attributes() ); ?>
<?php $this->render_attributes( $this->get_input_attributes() ); ?>
<?php $this->render_CSS_classes( $this->get_input_classes() ); ?>
<?php
if ( ! empty( $this->placeholder ) ) {
echo 'placeholder="' . esc_attr( $this->placeholder ) . '"';
}
if ( ! empty( $this->readonly ) ) {
echo 'readonly';
}
?>
/>
<?php
}
protected function sanitize_field_input( $value, $instance ) {
$sanitized_value = wp_kses_post( $value );
$sanitized_value = balanceTags( $sanitized_value, true );
// Remove escape sequences.
$sanitized_value = siteorigin_widgets_strip_escape_sequences( $sanitized_value );
if ( ! empty( $this->onclick ) ) {
return siteorigin_widget_onclick( $sanitized_value );
}
return $sanitized_value;
}
}