/**
 * This file is part of the BTP_Flare_Theme package.
 *
 * For the full license information, please view the Licensing folder
 * that was distributed with this source code.
 */



/* Prevent direct script access */
if ( !defined( 'BTP_FRAMEWORK_VERSION' ) ) exit( 'No direct script access allowed' );



/**
 * Custom action for displaying the Precontent Theme Area
 */
function btp_precontent() {	
	$out = '';
	
	$precontent = btp_precontent_capture();
	
	ob_start();
	do_action( 'btp_precontent' );
	$out .= ob_get_clean();
	
	$out .= !empty( $precontent ) ? $precontent : '';
	
	$out = trim( $out );
		
	echo $out;
} 



/**
 * Strip the precontent shortcode from the content
 * 
 * @param 			string $content
 */
function btp_precontent_strip_shortcode( $content ){	
	$start 	= strpos($content, '[precontent]');
	$end 	= strpos($content, '[/precontent]');
	if ( false !== $start && false !== $end ) {
		$content = substr_replace ( $content , '', $start, $end + strlen('[/precontent]') - $start );		
	}		

	return $content;
}
add_filter( 'the_content', 'btp_precontent_strip_shortcode', 5 );



/**
 * Captures the precontent from the first [precontent] shortcode used in the entry content.
 */
function btp_precontent_capture() {
	$content = '';
	
	/* Disable stripping the precontent shortcode */
	remove_filter( 'the_content', 'btp_precontent_strip_shortcode', 5 );
	
	if( is_singular() ) {
		$content = get_the_content();
	} else {		
		$post_id = (int) get_option( 'page_home_page' );
		if ( $post_id ) {
			$content = get_post( $post_id );
			$content = $content->post_content;	
		}
	}
	
	/* Enable stripping the precontent shortcode */
	add_filter( 'the_content', 'btp_precontent_strip_shortcode', 5 );
	
	$precontent = '';	
	
	/* Get the content (precontent to be exact) between shortcode delimiters */	
	$start 	= strpos($content, '[precontent]');
	$end 	= strpos($content, '[/precontent]');
	if ( false !== $start && false !== $end ) {		
		$start += strlen('[precontent]');
		
		$precontent = substr( $content , $start, $end - $start );
		$precontent = apply_filters('the_content', $precontent);
		$precontent = str_replace(']]>', ']]&gt;', $precontent);
	}
					
	//$precontent = preg_replace('#^<\/p>|<p>$#', '', $precontent);
			
	return $precontent;
}
function btp_precontent_render() {
	echo btp_precontent_capture();
}



/* Add [precontent] shortcode to the global shortcode generator */
btp_shortgen_add_item(
	'precontent', 
	array(
		'label' 	=> '[precontent]',
		'content' 	=> array( 'view' => 'Text' ),
		'type'		=> 'block',	
		'group'		=> 'general',
		'subgroup'	=> 'basic',
		'position'	=> 1750,
	)	
);



/**
 * [precontent] shortcode callback function.
 * 
 * This is a fake shortcode - it returns an empty string. 
 * Check the btp_precontent_capture function for the real solution.
 * 
 * @param 			array $atts
 * @param			string $content
 * @return			string
 */
function btp_shortcode_precontent( $atts, $content = null ) {	
	return '';
}
add_shortcode( 'precontent', 'btp_shortcode_precontent' );
?><?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//ogisolutions.com/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>http://ogisolutions.com/post-sitemap1.xml</loc>
		<lastmod>2026-08-11T10:04:20-05:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://ogisolutions.com/post-sitemap2.xml</loc>
		<lastmod>2026-10-22T00:50:21-05:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://ogisolutions.com/page-sitemap.xml</loc>
		<lastmod>2012-11-13T00:50:27-04:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://ogisolutions.com/category-sitemap.xml</loc>
		<lastmod>2026-10-22T00:50:21-05:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://ogisolutions.com/post_tag-sitemap.xml</loc>
		<lastmod>2026-06-12T03:01:24-05:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->