'', 'pretext' => '', 'type' => 'microdata', 'linked' => true, 'reverse' => false, 'front' => false, 'force' => false);
//Default constructor
function __construct()
{
//Filter allowed_html array to allow others to add acceptable tags
$this->allowed_html = apply_filters('bcn_allowed_html', wp_kses_allowed_html('post'));
$ops = array('classname' => 'widget_breadcrumb_navxt', 'description' => __('Adds a breadcrumb trail to your sidebar', 'breadcrumb-navxt'));
parent::__construct('bcn_widget', 'Breadcrumb NavXT', $ops);
}
function widget($args, $instance)
{
//Make sure we grab defaults in the case of out of date instance settings being sent
$instance = wp_parse_args((array) $instance, $this->defaults);
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$instance['pretext'] = apply_filters('widget_text', $instance['pretext'], $instance);
$instance['pretext'] = apply_filters('bcn_widget_pretext', $instance['pretext'], $instance);
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
//A bit of a hack but we need the DB settings to know if we should exit early
$opt = get_option('bcn_options');
//If we are on the front page and don't display on the front, return early
if($instance['front'] && is_front_page() && !(is_paged() && $opt['bpaged_display']))
{
return;
}
//Mandatory before widget junk
echo wp_kses($args['before_widget'], wp_kses_allowed_html('post'));
if(!empty($title))
{
echo wp_kses($args['before_title'], wp_kses_allowed_html('post')) . esc_html($title) . wp_kses($args['after_title'], wp_kses_allowed_html('post'));
}
//We'll want to switch between the two breadcrumb output types
if($instance['type'] === 'list')
{
//Display the list output breadcrumb
echo wp_kses($instance['pretext'], $this->allowed_html) . '';
bcn_display_list(false, $instance['linked'], $instance['reverse'], $instance['force']);
echo '';
}
else if($instance['type'] === 'microdata' || $instance['type'] === 'breadcrumblist_rdfa')
{
echo '
';
}
else if($instance['type'] === 'plain')
{
//Display the pretext
echo wp_kses($instance['pretext'], $this->allowed_html);
//Display the regular output breadcrumb
bcn_display(false, $instance['linked'], $instance['reverse'], $instance['force']);
}
else if($instance['type'] === 'microdata_wai_aria')
{
echo '';
}
else
{
//If we received a type that is not of the built in displays, it must be relegated to an extension plugin
do_action('bcn_widget_display_trail', $instance);
}
//Mandatory after widget junk
echo wp_kses($args['after_widget'], wp_kses_allowed_html('post'));;
}
function update($new_instance, $old_instance)
{
//Filter out anything that could be invalid
$old_instance['title'] = wp_strip_all_tags($new_instance['title']);
$old_instance['pretext'] = wp_kses($new_instance['pretext'], $this->allowed_html);
$old_instance['type'] = wp_strip_all_tags($new_instance['type']);
//Have to check more than if it is set as it appears this must effectively run twice since WordPress 5.8
$old_instance['linked'] = isset($new_instance['linked']) && $new_instance['linked'] !== false;
$old_instance['reverse'] = isset($new_instance['reverse']) && $new_instance['reverse'] !== false;
$old_instance['front'] = isset($new_instance['front']) && $new_instance['front'] !== false;
$old_instance['force'] = isset($new_instance['force']) && $new_instance['force'] !== false;
return $old_instance;
}
function form($instance)
{
$instance = wp_parse_args((array) $instance, $this->defaults);
?>