__( 'Display preset post lists', 'advanced-post-list' ) ) ); } /** * Widget * * This code displays the widget on the screen. * * @since 0.3.0 * * @global APL_Core $advanced_post_list * @param array $args * @param ? $instance */ public function widget( $args, $instance ) { global $advanced_post_list; extract( $args ); echo esc_html( $before_widget ); if ( ! empty( $instance['title'] ) ) { printf( '%1$s%2$s%3$s', esc_html( $before_title ), esc_html( $instance['title'] ), esc_html( $after_title ) ); } echo wp_kses( $advanced_post_list->display_post_list( $instance['apl_preset'] ), apl_allowed_tags_before() ); echo esc_html( $after_widget ); } /** * Form * * @since 0.3.0 * * @param type $instance */ public function form( $instance ) { $preset_db = new APL_Preset_Db( 'default' ); $html_options = ''; foreach ( $preset_db->_preset_db as $key => $value ) { if ( isset( $instance['apl_preset'] ) && $key === $instance['apl_preset'] ) { $html_options .= sprintf( '', $key ); } else { $html_options .= sprintf( '', $key ); } } printf( '




', esc_html( $this->get_field_id( 'title' ) ), ( isset( $instance['title'] ) ) ? esc_html( $instance['title'] ) : '', esc_html( $this->get_field_id( 'apl_preset' ) ), esc_html( $html_options ) ); } /** * Update * * Updates the settings. * * @since 0.3.0 * * @param type $new_instance * @param type $old_instance * @return type */ public function update( $new_instance, $old_instance ) { return $new_instance; } }