| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/so-widgets-bundle/base/inc/fields/ |
Upload File : |
<?php
/**
* Class SiteOrigin_Widget_Field_Order
*/
class SiteOrigin_Widget_Field_Order extends SiteOrigin_Widget_Field_Base {
protected $options;
protected function render_field( $value, $instance ) {
$value = $this->sanitize_field_input( $value, $instance );
if( ! empty( $this->options ) && ! empty( $value ) ) {
?><div class="siteorigin-widget-order-items"><?php
foreach( $value as $key ) {
?>
<div class="siteorigin-widget-order-item" data-value="<?php echo esc_attr( $key ) ?>">
<?php echo esc_html( $this->options[ $key ] ) ?>
</div>
<?php
}
?></div><?php
}
?>
<input
type="hidden"
name="<?php echo esc_attr( $this->element_name ) ?>"
id="<?php echo esc_attr( $this->element_id ) ?>"
class="siteorigin-widget-input"
value="<?php echo esc_attr( implode( ',', $value ) ) ?>">
<?php
}
protected function sanitize_field_input( $value, $instance ) {
if( is_string( $value ) ) {
$value = explode(',', $value);
$value = array_map( 'trim', $value );
}
if ( ! is_array( $value ) ) {
$value = array();
}
foreach( $value as $i => $k ) {
if( empty( $this->options[$k] ) ) {
unset( $value[ $i ] );
}
}
return $value;
}
public function enqueue_scripts() {
wp_enqueue_script( 'so-order-field', plugin_dir_url(__FILE__) . 'js/order-field' . SOW_BUNDLE_JS_SUFFIX . '.js', array( 'jquery', 'jquery-ui-sortable' ), SOW_BUNDLE_VERSION );
wp_enqueue_style( 'so-order-field', plugin_dir_url(__FILE__) . 'css/order-field.css', array( ), SOW_BUNDLE_VERSION );
}
}