'Choose place on website',
'id' => 'adfoxly-group-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' ),
6 => array( 'name' => 'Background', 'type' => 'img', 'image' => 'background.svg' ),
7 => array( 'name' => 'WordPress Widget', 'type' => 'img', 'image' => 'widget.svg' ),
2 => array( 'name' => 'Ad in Redirection', 'type' => 'img', 'image' => 'redirection.svg' ),
),
'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 adfoxlyGroupsSettings {
private $groups;
public $meta_fields;
function __construct() {
$this->meta_fields = array(
array(
'label' => 'Name',
'class' => 'form-control',
'id' => 'adfoxly-group-name',
'default' => '',
'type' => 'text',
),
array(
'label' => 'Ad zone rotate',
'class' => 'form-control',
'id' => 'adfoxly-group-is-rotate',
'default' => 'no',
'type' => 'radio',
'wrapper_id' => 'adfoxly-group-is-rotate-wrapper',
'options' => array(
'no' => 'No',
'yes' => 'Yes'
),
),
array(
'label' => 'How rotate',
'class' => 'form-control',
'id' => 'adfoxly-group-how-rotate',
'default' => 'refresh',
'type' => 'radio',
'wrapper_id' => 'adfoxly-group-how-rotate-wrapper',
'options' => array(
'refresh' => 'Refresh',
'time' => 'Time'
),
),
array(
'label' => 'Rotate time',
'class' => 'form-control',
'id' => 'adfoxly-group-rotate-time',
'wrapper_id' => 'adfoxly-group-rotate-time-wrapper',
'default' => '60',
'type' => 'number',
),
array(
'label' => 'Included Ads
Here you see only ads set to widget or shortcode place',
'class' => 'form-control',
'id' => 'adfoxly-group-ads-list',
'default' => '',
'type' => 'checkbox',
),
);
if ( isset( $_GET['edit'] ) ) {
if ( $_GET[ 'edit' ] !== 'new' ) {
$group = new GroupController();
$g_id = $_GET[ 'edit' ];
if ( isset( $group->getGroup( $g_id )[ 'details' ]->post_title ) && ! empty( $group->getGroup( $g_id )[ 'details' ]->post_title ) ) {
$this->meta_fields[ 0 ][ 'value' ] = $group->getGroup( $g_id )[ 'details' ]->post_title;
}
$g_is_rotate = esc_html( get_post_meta( $g_id, 'adfoxly-group-is-rotate', true ) );
$g_how_rotate = esc_html( get_post_meta( $g_id, 'adfoxly-group-how-rotate', true ) );
$g_time_rotate = esc_html( get_post_meta( $g_id, 'adfoxly-group-rotate-time', true ) );
if ( isset( $g_is_rotate ) && ! empty( $g_is_rotate ) ) {
$this->meta_fields[ 1 ][ 'value' ] = $g_is_rotate;
}
if ( isset( $g_how_rotate ) && ! empty( $g_how_rotate ) ) {
$this->meta_fields[ 2 ][ 'value' ] = $g_how_rotate;
}
if ( isset( $g_time_rotate ) && ! empty( $g_time_rotate ) ) {
$this->meta_fields[ 3 ][ 'value' ] = $g_time_rotate;
}
}
}
}
}