'A widget for placing advertise world advertisements!' ) ); } /** * Renders the widget. * * Add styling to theme extras. * * @since 1.0.0 * * @param array $args Widget options * @param array $instance Widget object instance */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['adspace'] ); $last_element = 0; $element_end = 1; $style = 'style="display: block !important;"'; // Make sure all theme added styles are display: block !important while ( $element_end ) { $element_end = strpos( $args['before_widget'], '>', $last_element ); if ( $element_end !== false ) { $existing_style = strpos( $args['before_widget'], 'style="', $last_element ); if ( $existing_style ) { $args['before_widget'] = substr_replace( $args['before_widget'], 'display: block !important;', $existing_style + strlen( 'style="' ), 0 ); $last_element = $element_end + strlen( 'display: block !important;' ) + 1; } else { $args['before_widget'] = substr_replace( $args['before_widget'], $style, $element_end, 0 ); $last_element = $element_end + strlen( $style ) + 1; } } } // before and after widget arguments are defined by themes echo $args['before_widget']; $output = self::output( $instance['id'], null, null, $instance['fixed-size'] ); echo $output; echo $args['after_widget']; } /** * Fires when the widget is updated from the admin section. * * @since 1.0.0 * * @param array $new_instance Attributes of widget * @param array $old_instance Attributes of widget * * @return array Attributes of widget */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['id'] = $new_instance['id']; $instance['title'] = $new_instance['title']; $instance['adspace'] = $new_instance['adspace']; $instance['fixed-size'] = $new_instance['fixed-size']; return $instance; } /** * Displays widget options update form. * * Displays form for updating widget options prefilled with existing options. * * @since 1.0.0 * * @param array $instance Attributes of widget */ function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'id' => '', 'title' => '', 'adspace' => '', 'fixed-size' => '' ) ); $id = strip_tags( $instance['id'] ); $name = strip_tags( $instance['title'] ); $title = strip_tags( $instance['adspace'] ); $fixed_size = strip_tags( $instance['fixed-size'] ); ?>
';
} else {
return '