esc_html__( 'Displays Advertisements', 'Divi' ) ); $control_ops = array('width' => 400, 'height' => 500); parent::__construct( false, $name = esc_html__( 'ET Advertisement', 'Divi' ), $widget_ops, $control_ops ); } /* Displays the Widget in the front-end */ function widget($args, $instance){ extract($args); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? esc_html__( 'Advertisement', 'Divi' ) : esc_html( $instance['title'] ) ); $use_relpath = isset($instance['use_relpath']) ? $instance['use_relpath'] : false; $new_window = isset($instance['new_window']) ? $instance['new_window'] : false; $bannerPath[1] = empty($instance['bannerOnePath']) ? '' : $instance['bannerOnePath']; $bannerUrl[1] = empty($instance['bannerOneUrl']) ? '' : $instance['bannerOneUrl']; $bannerTitle[1] = empty($instance['bannerOneTitle']) ? '' : $instance['bannerOneTitle']; $bannerAlt[1] = empty($instance['bannerOneAlt']) ? '' : $instance['bannerOneAlt']; $bannerPath[2] = empty($instance['bannerTwoPath']) ? '' : $instance['bannerTwoPath']; $bannerUrl[2] = empty($instance['bannerTwoUrl']) ? '' : $instance['bannerTwoUrl']; $bannerTitle[2] = empty($instance['bannerTwoTitle']) ? '' : $instance['bannerTwoTitle']; $bannerAlt[2] = empty($instance['bannerTwoAlt']) ? '' : $instance['bannerTwoAlt']; $bannerPath[3] = empty($instance['bannerThreePath']) ? '' : $instance['bannerThreePath']; $bannerUrl[3] = empty($instance['bannerThreeUrl']) ? '' : $instance['bannerThreeUrl']; $bannerTitle[3] = empty($instance['bannerThreeTitle']) ? '' : $instance['bannerThreeTitle']; $bannerAlt[3] = empty($instance['bannerThreeAlt']) ? '' : $instance['bannerThreeAlt']; $bannerPath[4] = empty($instance['bannerFourPath']) ? '' : $instance['bannerFourPath']; $bannerUrl[4] = empty($instance['bannerFourUrl']) ? '' : $instance['bannerFourUrl']; $bannerTitle[4] = empty($instance['bannerFourTitle']) ? '' : $instance['bannerFourTitle']; $bannerAlt[4] = empty($instance['bannerFourAlt']) ? '' : $instance['bannerFourAlt']; $bannerPath[5] = empty($instance['bannerFivePath']) ? '' : $instance['bannerFivePath']; $bannerUrl[5] = empty($instance['bannerFiveUrl']) ? '' : $instance['bannerFiveUrl']; $bannerTitle[5] = empty($instance['bannerFiveTitle']) ? '' : $instance['bannerFiveTitle']; $bannerAlt[5] = empty($instance['bannerFiveAlt']) ? '' : $instance['bannerFiveAlt']; $bannerPath[6] = empty($instance['bannerSixPath']) ? '' : $instance['bannerSixPath']; $bannerUrl[6] = empty($instance['bannerSixUrl']) ? '' : $instance['bannerSixUrl']; $bannerTitle[6] = empty($instance['bannerSixTitle']) ? '' : $instance['bannerSixTitle']; $bannerAlt[6] = empty($instance['bannerSixAlt']) ? '' : $instance['bannerSixAlt']; $bannerPath[7] = empty($instance['bannerSevenPath']) ? '' : $instance['bannerSevenPath']; $bannerUrl[7] = empty($instance['bannerSevenUrl']) ? '' : $instance['bannerSevenUrl']; $bannerTitle[7] = empty($instance['bannerSevenTitle']) ? '' : $instance['bannerSevenTitle']; $bannerAlt[7] = empty($instance['bannerSevenAlt']) ? '' : $instance['bannerSevenAlt']; $bannerPath[8] = empty($instance['bannerEightPath']) ? '' : $instance['bannerEightPath']; $bannerUrl[8] = empty($instance['bannerEightUrl']) ? '' : $instance['bannerEightUrl']; $bannerTitle[8] = empty($instance['bannerEightTitle']) ? '' : $instance['bannerEightTitle']; $bannerAlt[8] = empty($instance['bannerEightAlt']) ? '' : $instance['bannerEightAlt']; echo et_core_intentionally_unescaped( $before_widget, 'html' ); if ( $title ) { echo et_core_intentionally_unescaped( $before_title . $title . $after_title, 'html' ); } ?>
__( 'Advertisement', 'Divi' ), 'use_relpath' => false, 'new_window' => true, 'bannerOnePath'=>'', 'bannerOneUrl'=>'', 'bannerOneTitle'=>'', 'bannerOneAlt'=>'', 'bannerTwoPath'=>'', 'bannerTwoUrl'=>'', 'bannerTwoTitle'=>'', 'bannerTwoAlt'=>'','bannerThreePath'=>'', 'bannerThreeUrl'=>'','bannerThreeTitle'=>'', 'bannerThreeAlt'=>'','bannerFourPath'=>'', 'bannerFourUrl'=>'','bannerFourTitle'=>'', 'bannerFourAlt'=>'','bannerFivePath'=>'', 'bannerFiveUrl'=>'','bannerFiveTitle'=>'', 'bannerFiveAlt'=>'','bannerSixPath'=>'', 'bannerSixUrl'=>'','bannerSixTitle'=>'','bannerSixAlt'=>'', 'bannerSevenPath'=>'', 'bannerSevenUrl'=>'','bannerSevenTitle'=>'','bannerSevenAlt'=>'','bannerEightPath'=>'', 'bannerEightUrl'=>'','bannerEightTitle'=>'','bannerEightAlt'=>'') ); $title = $instance['title']; $bannerPath[1] = $instance['bannerOnePath']; $bannerUrl[1] = $instance['bannerOneUrl']; $bannerTitle[1] = $instance['bannerOneTitle']; $bannerAlt[1] = $instance['bannerOneAlt']; $bannerPath[2] = $instance['bannerTwoPath']; $bannerUrl[2] = $instance['bannerTwoUrl']; $bannerTitle[2] = $instance['bannerTwoTitle']; $bannerAlt[2] = $instance['bannerTwoAlt']; $bannerPath[3] = $instance['bannerThreePath']; $bannerUrl[3] = $instance['bannerThreeUrl']; $bannerTitle[3] = $instance['bannerThreeTitle']; $bannerAlt[3] = $instance['bannerThreeAlt']; $bannerPath[4] = $instance['bannerFourPath']; $bannerUrl[4] = $instance['bannerFourUrl']; $bannerTitle[4] = $instance['bannerFourTitle']; $bannerAlt[4] = $instance['bannerFourAlt']; $bannerPath[5] = $instance['bannerFivePath']; $bannerUrl[5] = $instance['bannerFiveUrl']; $bannerTitle[5] = $instance['bannerFiveTitle']; $bannerAlt[5] = $instance['bannerFiveAlt']; $bannerPath[6] = $instance['bannerSixPath']; $bannerUrl[6] = $instance['bannerSixUrl']; $bannerTitle[6] = $instance['bannerSixTitle']; $bannerAlt[6] = $instance['bannerSixAlt']; $bannerPath[7] = $instance['bannerSevenPath']; $bannerUrl[7] = $instance['bannerSevenUrl']; $bannerTitle[7] = $instance['bannerSevenTitle']; $bannerAlt[7] = $instance['bannerSevenAlt']; $bannerPath[8] = esc_attr($instance['bannerEightPath']); $bannerUrl[8] = esc_url($instance['bannerEightUrl']); $bannerTitle[8] = esc_attr($instance['bannerEightTitle']); $bannerAlt[8] = esc_attr($instance['bannerEightAlt']); # Title echo ''; ?> id="get_field_id('use_relpath') ); ?>" name="get_field_name('use_relpath') ); ?>" />' . esc_html__( "If you don't want to display some banners - leave approptiate fields blank", 'Divi' ) . '.
'; } }// end AdvWidget class function AdvWidgetInit() { register_widget('AdvWidget'); } add_action('widgets_init', 'AdvWidgetInit');