'Wp-Insert Ad Widget' ] ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', ( isset( $instance['title'] ) ? $instance['title'] : '' ) ); $adwidgets = get_option( 'wp_insert_adwidgets' ); if ( isset( $instance['instance'], $adwidgets[ $instance['instance'] ] ) && is_array( $adwidgets[ $instance['instance'] ] ) ) { if ( wp_insert_get_ad_status( $adwidgets[ $instance['instance'] ] ) ) { // Theme-supplied wrappers are trusted markup, matching core widget behavior. wp_insert_echo_html( $args['before_widget'] ?? '' ); if ( ! empty( $title ) ) { wp_insert_echo_html( ( $args['before_title'] ?? '' ) . esc_html( $title ) . ( $args['after_title'] ?? '' ) ); } wp_insert_echo_ad_code( wp_insert_get_ad_unit( $adwidgets[ $instance['instance'] ] ) ); wp_insert_echo_html( $args['after_widget'] ?? '' ); } } } public function update( $new_opts, $old_opts ) { $opts = []; $opts['title'] = sanitize_text_field( $new_opts['title'] ?? '' ); $opts['instance'] = sanitize_key( $new_opts['instance'] ?? '' ); return $opts; } public function form( $instance ) { $adwidgets = get_option( 'wp_insert_adwidgets' ); echo '

'; echo ''; echo ''; echo '

'; echo '

'; if ( is_array( $adwidgets ) && ( count( $adwidgets ) > 0 ) ) { echo ''; echo ''; } else { printf( /* translators: %s: URL of the Wp-Insert settings page. */ esc_html__( 'Please %s to Proceed.', 'wp-insert' ), '' . esc_html__( 'Configure an Ad-Widget', 'wp-insert' ) . '' ); echo ''; } echo '

'; } }