'Choose place on website', 'id' => 'adfoxly-adzone-place', 'type' => 'image_checkbox', 'options' => array( 3 => array( 'name' => 'Before post', 'type' => 'img', 'image' => 'before_content.svg' ), 4 => array( 'name' => 'After post', 'type' => 'img', 'image' => 'after_content.svg' ), 5 => array( 'name' => 'Inside the post', 'type' => 'img', 'image' => 'inside_content.svg' ), 9 => array( 'name' => 'After comments', 'type' => 'img', 'image' => 'after_comments.svg' ), 1 => array( 'name' => 'Popup on Start', 'type' => 'img', 'image' => 'popup.svg', 'soon' => true ), 6 => array( 'name' => 'Background', 'type' => 'img', 'image' => 'background.svg', 'soon' => true ), 7 => array( 'name' => 'WordPress Widget', 'type' => 'img', 'image' => 'widget.svg' ), 2 => array( 'name' => 'Ad in Redirection', 'type' => 'img', 'image' => 'redirection.svg', 'soon' => true ), ), 'required' => true, 'data-parsley-multiple' => 'adfoxly-format', 'data-parsley-errors-container' => '#alert-step-1' ) ); public function field_generator( $id = null ) { if ( isset( $id ) && ! empty( $id ) ) { $this->banner_id = $id; } $output = ''; $form = new adfoxlyForm( $id ); foreach ( $this->meta_fields as $meta_field ) { $output .= $form->generate_field( $meta_field ); } return $output; } } class adfoxlyPlacesSettings { private $places; public $meta_fields = array( array( 'label' => 'Width', 'class' => 'form-control', 'id' => 'adfoxly-adzone-width', 'default' => '0', 'type' => 'number', ), array( 'label' => 'Height', 'class' => 'form-control', 'id' => 'adfoxly-adzone-height', 'default' => '0', 'type' => 'number', ), array( 'label' => 'Ad zone rotate', 'class' => 'form-control', 'id' => 'adfoxly-adzone-is-rotate', 'default' => 'no', 'type' => 'radio', 'wrapper_id' => 'adfoxly-adzone-is-rotate-wrapper', 'options' => array( 'no' => 'No', 'yes' => 'Yes' ), ), array( 'label' => 'How rotate', 'class' => 'form-control', 'id' => 'adfoxly-adzone-how-rotate', 'default' => 'refresh', 'type' => 'radio', 'wrapper_id' => 'adfoxly-adzone-how-rotate-wrapper', 'options' => array( 'refresh' => 'Refresh', 'time' => 'Time' ), ), array( 'label' => 'Rotate time', 'class' => 'form-control', 'id' => 'adfoxly-adzone-rotate-time', 'wrapper_id' => 'adfoxly-adzone-rotate-time-wrapper', 'default' => '60', 'type' => 'number', ), ); function __construct() { if ( isset( $_GET[ 'edit' ] ) ) { $this->places = get_option( 'adfoxly_places' ); if ( isset( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-width' ] ) && ! empty( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-width' ] ) ) { $this->meta_fields[ 0 ][ 'value' ] = $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-width' ]; } if ( isset( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-height' ] ) && ! empty( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-height' ] ) ) { $this->meta_fields[ 1 ][ 'value' ] = $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-height' ]; } if ( isset( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-is-rotate' ] ) && ! empty( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-is-rotate' ] ) ) { $this->meta_fields[ 2 ][ 'value' ] = $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-is-rotate' ]; } if ( isset( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-how-rotate' ] ) && ! empty( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-how-rotate' ] ) ) { $this->meta_fields[ 3 ][ 'value' ] = $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-how-rotate' ]; } if ( isset( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-rotate-time' ] ) && ! empty( $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-rotate-time' ] ) ) { $this->meta_fields[ 4 ][ 'value' ] = $this->places[ $_GET[ 'edit' ] ][ 'options' ][ 'adfoxly-adzone-rotate-time' ]; } } } }