array( 'name' => esc_html__( 'Ads', 'mega' ), 'description' => esc_html__( 'Ads block', 'mega' )),//Ad Manager? Ad?
'universal' => true
);
parent::__construct( __CLASS__, $args );
}
public function settings( $form )
{
$form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Alignment', 'mega' ), 'value' => 'center', 'name' => 'align',
'choices' => array(
'left' => esc_html__( 'Left', 'mega' ),
'center' => esc_html__( 'Center', 'mega' ),
'right' => esc_html__( 'Right', 'mega' )
)
));
$form->add_control( 'Mega_Control_Select', array( 'label' => esc_html__( 'Ad Size', 'mega' ), 'desc' => esc_html__( 'Enter size as (width)x(height), i.e 100x100', 'mega' ), 'value' => '120x240', 'name' => 'size',
'choices' => array(
'120x240' => esc_html__( '120 x 240', 'mega' ),
'120x600' => esc_html__( '120 x 600', 'mega' ),
'160x600' => esc_html__( '160 x 600', 'mega' ),
'125x125' => esc_html__( '125 x 125', 'mega' ),
'180x150' => esc_html__( '180 x 150', 'mega' ),
'200x200' => esc_html__( '200 x 200', 'mega' ),
'250x250' => esc_html__( '250 x 250', 'mega' ),
'300x250' => esc_html__( '300 x 250', 'mega' ),
'234x60' => esc_html__( '234 x 60', 'mega' ),
'320x50' => esc_html__( '320 x 50', 'mega' ),
'468x60' => esc_html__( '468 x 60', 'mega' ),
'728x90' => esc_html__( '728 x 90', 'mega' )
)
));
$form->add_control( 'Mega_Control_Text', array( 'label' => esc_html__( 'Link', 'mega' ), 'name' => 'link' ));
$form->add_control( 'Mega_Control_Text', array( 'label' => esc_html__( 'Image', 'mega' ), 'name' => 'image' ));
$form->add_control( 'Mega_Control_Textarea', array( 'label' => esc_html__( 'Custom Code', 'mega' ), 'desc' => wp_kses( __( 'Use the following snippets of code to output the necessary information:
Link - [link]
Image - [image]
Width - [width]
Height - [height]', 'mega' ), array( 'br' => true, 'strong' => true )), 'value' => '', 'name' => 'code' ));
}
public function block()//add adsense support // type: image & link or addsense
{
extract( $this->mega['settings'] );
$size = explode( 'x', $size );
$image = empty( $image ) ? sprintf( 'http://placehold.it/%sx%s/fff', $size[0], $size[1] ) : $image;
echo '