<?php
class TFLFrontend {
	public static function themeFixes($html, $currentPost = false){
		global $kc, $wpdb;
		if(isset($kc)) {
			$kcPostContent = $wpdb->get_var( $wpdb->prepare("SELECT post_content FROM {$wpdb->prefix}posts WHERE post_status = 'publish' AND ID = %d", $currentPost->ID));
			$html = $kcPostContent;
		}
		$currentTheme = wp_get_theme()->template;
		if($currentTheme == 'enfold') {
			$html = str_replace([
				'main_color',
				'container_wrap',
				"class='container'",
				'</div></div></div><!-- close content main div --></div></div>'
				], "", $html);

			$html = preg_replace("/\<div id=\'after_section(.*)\'/i", "</div></div></div></div></div><div id='after_section$1'", $html);
			for($i=2; $i<=100;$i++) {
				$html = str_replace("<div id='av_section_$i'", "</div></div></div></div></div><div id='av_section_$i'", $html);
			}
			$html .= '</div></div></div></div>';
		}else if($currentTheme == 'rosa' || $currentTheme == 'rosa-child') {
			
		}
		return $html;
	}

}