Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/widgets
File: widget-adsense.php
<?php class AdsenseWidget extends WP_Widget
[0] Fix | Delete
{
[1] Fix | Delete
function __construct(){
[2] Fix | Delete
$widget_ops = array( 'description' => esc_html__( 'Displays Adsense Ads', 'Divi' ) );
[3] Fix | Delete
$control_ops = array( 'width' => 400, 'height' => 500 );
[4] Fix | Delete
parent::__construct( false, $name = esc_html__( 'ET Adsense Widget', 'Divi' ), $widget_ops, $control_ops );
[5] Fix | Delete
}
[6] Fix | Delete
[7] Fix | Delete
/* Displays the Widget in the front-end */
[8] Fix | Delete
function widget( $args, $instance ){
[9] Fix | Delete
extract($args);
[10] Fix | Delete
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? esc_html__( 'Adsense', 'Divi' ) : esc_html( $instance['title'] ) );
[11] Fix | Delete
$adsenseCode = empty( $instance['adsenseCode'] ) ? '' : $instance['adsenseCode'];
[12] Fix | Delete
[13] Fix | Delete
echo et_core_intentionally_unescaped( $before_widget, 'html' );
[14] Fix | Delete
[15] Fix | Delete
if ( $title ) {
[16] Fix | Delete
echo et_core_intentionally_unescaped( $before_title . $title . $after_title, 'html' );
[17] Fix | Delete
}
[18] Fix | Delete
?>
[19] Fix | Delete
<div style="overflow: hidden;">
[20] Fix | Delete
<?php echo et_core_intentionally_unescaped( $adsenseCode, 'html' ); ?>
[21] Fix | Delete
<div class="clearfix"></div>
[22] Fix | Delete
</div> <!-- end adsense -->
[23] Fix | Delete
<?php
[24] Fix | Delete
echo et_core_intentionally_unescaped( $after_widget, 'html' );
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/*Saves the settings. */
[28] Fix | Delete
function update( $new_instance, $old_instance ){
[29] Fix | Delete
$instance = $old_instance;
[30] Fix | Delete
$instance['title'] = sanitize_text_field( $new_instance['title'] );
[31] Fix | Delete
$instance['adsenseCode'] = current_user_can('unfiltered_html') ? $new_instance['adsenseCode'] : stripslashes( wp_filter_post_kses( addslashes($new_instance['adsenseCode']) ) );
[32] Fix | Delete
[33] Fix | Delete
return $instance;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/*Creates the form for the widget in the back-end. */
[37] Fix | Delete
function form( $instance ){
[38] Fix | Delete
//Defaults
[39] Fix | Delete
$instance = wp_parse_args( (array) $instance, array( 'title' => esc_html__( 'Adsense', 'Divi' ), 'adsenseCode'=>'' ) );
[40] Fix | Delete
[41] Fix | Delete
$title = $instance['title'];
[42] Fix | Delete
$adsenseCode = $instance['adsenseCode'];
[43] Fix | Delete
[44] Fix | Delete
# Title
[45] Fix | Delete
echo '<p><label for="' . esc_attr( $this->get_field_id('title') ) . '">' . esc_html__( 'Title', 'Divi' ) . ':' . '</label><input class="widefat" id="' . esc_attr( $this->get_field_id('title') ) . '" name="' . esc_attr( $this->get_field_name('title') ) . '" type="text" value="' . esc_attr( $title ) . '" /></p>';
[46] Fix | Delete
# Adsense Code
[47] Fix | Delete
echo '<p><label for="' . esc_attr( $this->get_field_id('adsenseCode') ) . '">' . esc_html__( 'Adsense Code', 'Divi' ) . ':' . '</label><textarea cols="20" rows="12" class="widefat" id="' . esc_attr( $this->get_field_id('adsenseCode') ) . '" name="' . esc_attr( $this->get_field_name('adsenseCode') ) . '" >' . esc_textarea( $adsenseCode ) . '</textarea></p>';
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
}// end AdsenseWidget class
[51] Fix | Delete
[52] Fix | Delete
function AdsenseWidgetInit() {
[53] Fix | Delete
register_widget('AdsenseWidget');
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
add_action('widgets_init', 'AdsenseWidgetInit');
[57] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function