HEX
Server: Apache
System: Linux webd003.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: slyfwmm (169339)
PHP: 8.1.34
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/slyfwmm/studiomilighetti/wp-content/themes/domik/functions.php
<?php
/* banner-php */

/**
 * Domik only works in WordPress 5.0 or later.
 */
if ( version_compare( $GLOBALS['wp_version'], '5.0', '<' ) ) {
    require get_template_directory() . '/includes/back-compat.php';
    return;
}

if ( file_exists(get_template_directory() . '/includes/redux-configs.php')) {
    require_once get_template_directory() . '/includes/redux-configs.php';
}

$old_theme_version = wp_get_theme()->get( 'Version' );
if( version_compare( $old_theme_version, '3.0.1', '<' ) ){
    $old_theme_option = get_option( 'theme_options', false );
    if( !empty( $old_theme_option ) ){
        update_option( 'domik_options', $old_theme_option );
        delete_option( 'theme_options' );
    } 
}


if(!isset($domik_options)) $domik_options = get_option( 'domik_options', array() ); 


/*  Add responsive container to embeds
/* ------------------------------------ */ 
function domik_embed_html( $html ) {
    return '<div class="responsive-video">' . $html . '</div>';
}
add_filter( 'video_embed_html', 'domik_embed_html' );


//navigation modified
add_filter('nav_menu_css_class', 'domik_nav_menu_css_class_func', 10, 2);
$link_class = array();
if(!function_exists('domik_nav_menu_css_class_func')){
    function domik_nav_menu_css_class_func($classes, $item) {
        global $link_class;
        $link_class = array();
        $ajax_key = array_search("ajax", $classes);
        if ($ajax_key !== false) {
            $link_class[] = 'ajax';
            unset($classes[$ajax_key]);
        }
        $custom_key = array_search("custom-scroll-link", $classes);
        if ($custom_key !== false) {
            $link_class[] = 'custom-scroll-link';
            unset($classes[$custom_key]);
        }
        $pp_key = array_search("pp", $classes);
        if ($pp_key !== false) {
            $link_class[] = 'pp';
            unset($classes[$pp_key]);
        }
        $pa_key = array_search("pa", $classes);
        if ($pa_key !== false) {
            $link_class[] = 'pa';
            unset($classes[$pa_key]);
        }
        $ph_key = array_search("ph", $classes);
        if ($ph_key !== false) {
            $link_class[] = 'ph';
            unset($classes[$ph_key]);
        }
        
        $current_key = array_search("current-menu-item", $classes);
        if ($current_key !== false) {
            $link_class[] = 'act-link';
        }
        $current_ancestor_key = array_search("current-menu-ancestor", $classes);
        if ($current_ancestor_key !== false) {
            $link_class[] = 'act-link';
        }
        return $classes;
    }
}

add_filter('nav_menu_link_attributes', 'domik_nav_menu_link_attributes_func', 10, 3);
if(!function_exists('domik_nav_menu_link_attributes_func')){
    function domik_nav_menu_link_attributes_func($atts, $item, $args) {
        global $link_class;
        if (!empty($link_class)) {
            $atts['class'] = implode(" ", $link_class);
        }
        
        return $atts;
    }
}

/* Register Sidebars */
function domik_register_sidebars() {
    
    register_sidebar(
        array(
            'name' => __('Main Sidebar', 'domik'), 
            'id' => 'sidebar-1', 
            'description' => __('Appears in the sidebar section of the site.', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="head">', 
            'after_title' => '</h3>',
        )
    );
    
    register_sidebar(
        array(
            'name' => __('Page Sidebar', 'domik'), 
            'id' => 'sidebar-2', 
            'description' => __('Appears in the sidebar section of the page template.', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget cth %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="head">', 
            'after_title' => '</h3>',
        )
    );

    register_sidebar(
        array(
            'name' => __('Shop Sidebar', 'domik'), 
            'id' => 'sidebar-3', 
            'description' => __('Appears in the shop pages sidebar section.', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="head">', 
            'after_title' => '</h3>',
        )
    );
    register_sidebar(
        array(
            'name' => esc_html__('Social Share', 'domik'), 
            'id' => 'social_share_widget', 
            'description' => esc_html__('Widget area for Share menu. To use this area you must leave Share Names field on Theme Options &gt; Social Settings empty', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="widget-title">', 
            'after_title' => '</h3>',
        )
    );
    
    register_sidebar(
        array(
            'name' => __('Right Menu Widget', 'domik'), 
            'id' => 'right_menu_widget', 
            'description' => __('Appears in right menu widget', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="head">', 
            'after_title' => '</h3>',
        )
    );
    register_sidebar(
        array(
            'name' => __('Right Parallax Widget', 'domik'), 
            'id' => 'right_social_widget', 
            'description' => __('Appears in right sidebar widget, after parallax background', 'domik'), 
            'before_widget' => '<div id="%1$s" class="widget %2$s">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3 class="head">', 
            'after_title' => '</h3>',
        )
    );
}

add_action('widgets_init', 'domik_register_sidebars');


if(!function_exists('domik_theme_setup')){
    function domik_theme_setup() {
        
        /*
         * Make theme available for translation.
         * Translations can be filed in the /languages/ directory.
         */
        load_theme_textdomain( 'domik', get_template_directory() . '/languages' );

        // Add default posts and comments RSS feed links to head.
        add_theme_support( 'automatic-feed-links' );

        /*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
        add_theme_support( 'title-tag' );

        
        add_theme_support('post-thumbnails');

        domik_get_thumbnail_sizes();

        // Set the default content width.
        $GLOBALS['content_width'] = apply_filters( 'domik_content_width', 760 ); 

        // This theme uses wp_nav_menu() in one location.
        register_nav_menu('primary', __('Main Navigation Menu', 'domik'));
        
        //register_nav_menu('landing-menu', __('Landing Page Navigation Menu', 'domik'));

        /*
         * Switch default core markup for search form, comment form, and comments
         * to output valid HTML5.
         */
        add_theme_support( 'html5', array(
            'search-form',
            'comment-form',
            'comment-list',
            'gallery',
            'caption',
        ) );

        /*
         * Enable support for Post Formats.
         *
         * See: https://codex.wordpress.org/Post_Formats
         */
        add_theme_support( 'post-formats', array(
            'aside',
            'image',
            'video',
            'quote',
            'link',
            'gallery',
            'audio',
        ) );

        // Add theme support for Custom Logo.
        add_theme_support( 'custom-logo', array(
            'width'       => 37,
            'height'      => 30,
            'flex-width'  => true,
            'flex-height' => true,
            'header-text' => array( 'site-title', 'site-description' ),

        ) );

        // Add theme support for selective refresh for widgets.
        add_theme_support( 'customize-selective-refresh-widgets' );

        // from version 2.0
        add_theme_support( 'woocommerce' );
        // add_theme_support( 'wc-product-gallery-zoom' );
        //add_theme_support( 'wc-product-gallery-lightbox' );
        //add_theme_support( 'wc-product-gallery-slider' );

        add_theme_support( 'woocommerce', array(
            'thumbnail_image_width' => esc_attr_x( '300', 'WooCommerce thumbnail width', 'domik' ),
            'single_image_width'    => esc_attr_x( '500', 'WooCommerce single image width', 'domik' ),

            'product_grid'          => array(
                'default_rows'    => 3,
                'min_rows'        => 2,
                'max_rows'        => 8,
                'default_columns' => 4,
                'min_columns'     => 2,
                'max_columns'     => 5,
            ),
        ) );
        add_theme_support( 'wc-product-gallery-zoom' );
        // add_theme_support( 'wc-product-gallery-lightbox' );
        add_theme_support( 'wc-product-gallery-slider' );
        
        
        add_filter('use_default_gallery_style', '__return_false');

        /*
         * This theme styles the visual editor to resemble the theme style,
         * specifically font, colors, and column width.
         */
        add_editor_style( array( 'assets/css/editor-style.css' ) );

        // deactivate new block editor
        remove_theme_support( 'widgets-block-editor' );
    }
}
add_action('after_setup_theme', 'domik_theme_setup');


if(!function_exists('domik_get_thumbnail_sizes')){
    function domik_get_thumbnail_sizes(){
        // options default must have these values
        if( false == domik_get_option('enable_custom_sizes') ) return;
        $option_sizes = array(
            'domikfull-width'=>'fullscreen_thumb',
            'service-thumb'=>'service_thumb',
            'member-thumb'=>'team_thumb',
            'folio-size-one'=>'folio_size_one',
            'folio-size-second'=>'folio_size_two',
            
            'folio-size-three'=>'folio_size_three',
            'folio-size-one-tall'=>'folio_size_one_tall',
            'blog-thumb'=>'blog_image_thumb',
            
            
        );

        foreach ($option_sizes as $name => $opt) {
            $option_size = domik_get_option($opt);
            if($option_size !== false && is_array($option_size)){
                $size_val = array(
                    'width' => (isset($option_size['width']) && !empty($option_size['width']) )? (int)$option_size['width'] : (int)'9999',
                    'height' => (isset($option_size['height']) && !empty($option_size['height']) )? (int)$option_size['height'] : (int)'9999',
                    'hard_crop' => (isset($option_size['hard_crop']) && !empty($option_size['hard_crop']) )? (bool)$option_size['hard_crop'] : (bool)'0',
                );

                add_image_size( $name, $size_val['width'], $size_val['height'], $size_val['hard_crop'] );
            }
        }

        add_image_size('story-thumb', 159, 96, true);
        
    }
}

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function domik_content_width() {

    $content_width = $GLOBALS['content_width'];


    // Check if is single post and there is no sidebar.
    if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) {
        $content_width = 1024;
    }

    /**
     * Filter domik content width of the theme.
     *
     *
     * @param int $content_width Content width in pixels.
     */
    $GLOBALS['content_width'] = apply_filters( 'domik_content_width_templ', $content_width );
}
add_action( 'template_redirect', 'domik_content_width', 0 );

if(!function_exists('domik_theme_scripts_styles')){
    function domik_theme_scripts_styles() {
        
        if (is_singular() && comments_open() && get_option('thread_comments')) {
            wp_enqueue_script('comment-reply');
        }
        
        wp_enqueue_script("domik-plugins", get_template_directory_uri() . "/assets/js/plugins.js", array('jquery'), null, true);
        wp_enqueue_script("domik-core", get_template_directory_uri() . "/assets/js/core.js", array(), null, true);
        wp_enqueue_script("domik-scripts", get_template_directory_uri() . "/assets/js/scripts.js", array('imagesloaded'), null, true);
        //if( domik_get_option('gmap_api_key') != ''){
            wp_enqueue_script('gmap-api', 'https://maps.googleapis.com/maps/api/js?key='.domik_get_option('gmap_api_key'), array('jquery'), null, true);
        //}
        
        wp_enqueue_script('domik-gmap',get_template_directory_uri() . "/assets/js/domik_gmap.js", array(), null, true);
        $domik_obj = array();
        // if (is_rtl()) {
        //     $domik_obj['rtl'] = true;
        // } 
        // else {
        //     $domik_obj['rtl'] = false;
        // }
        $domik_obj['disable_ajax'] = domik_get_option('disable_ajax_transition');

        $domik_obj['nf_tit'] = '<h2>'.esc_html__('404','domik').'</h2><br>'.esc_html__('page not found','domik') ;
        $domik_obj['nf_msg'] = domik_get_option('404_intro');
        $domik_obj['nf_linktext'] = _x('Back to the last page','not found link text','domik');
        $domik_obj['nf_bg'] = domik_global_var('404_right_parallax_bg','url',true);
        wp_localize_script('domik-scripts', 'domik_obj', $domik_obj);

        if( false == domik_get_option('disable_ajax_transition') ){
            wp_enqueue_script("wpb_composer_front_js", plugins_url() . '/js_composer/assets/js/dist/js_composer_front.min.js', array('jquery'), null, true);

            wp_register_script( 'vc_accordion_script', plugins_url() . '/js_composer/assets/lib/vc_accordion/vc-accordion.min.js' , array( 'jquery' ), null, true );
            wp_register_script( 'vc_tta_autoplay_script', plugins_url() . '/js_composer/assets/lib/vc-tta-autoplay/vc-tta-autoplay.min.js' , array( 'vc_accordion_script' ), null, true );



            wp_enqueue_script( 'vc_accordion_script' );
            /*if ( ! vc_is_page_editable() ) {
                wp_enqueue_script( 'vc_tta_autoplay_script' );
            }*/

            wp_register_script( 'vc_tabs_script', plugins_url() . '/js_composer/assets/lib/vc_tabs/vc-tabs.min.js', array( 'vc_accordion_script' ), null, true );
            wp_enqueue_script( 'vc_tabs_script' );

            //single popup image
            wp_register_script( 'prettyphoto', plugins_url() . '/js_composer/assets/lib/prettyphoto/js/jquery.prettyPhoto.min.js', array( 'jquery' ), null , true );

            wp_enqueue_script( 'prettyphoto' );
        }
        
        //wp_enqueue_style('reset', get_template_directory_uri() . '/assets/css/reset.css',array(),null);
        wp_enqueue_style('domik-reset-plugins', get_template_directory_uri() . '/assets/css/plugins.css',array(),null);
        wp_enqueue_style('domik-style', get_stylesheet_uri(), array(),array(),null);
        if( false == domik_get_option('disable_ajax_transition') ){
            wp_enqueue_style('js_composer_front', plugins_url() . '/js_composer/assets/css/js_composer.min.css',array(),null);
        }
        wp_enqueue_style('domik-custom', get_template_directory_uri() . '/assets/css/custom.css',array(),null);
        if (domik_get_option('override-preset') ) {
            $inline_style = theme_domik_overridestyle();
            if(!empty($inline_style)){
                wp_add_inline_style('domik-custom', $inline_style);
            }  
        }
        

        $inline_custom_style = trim( domik_get_option('custom-css') );
        $medium_css = trim( domik_get_option('custom-css-medium') );
        if( !empty( $medium_css ) ){
            $inline_custom_style .= '@media only screen and  (max-width: 1036px){'.$medium_css.'}';
        }
        $tablet_css = trim( domik_get_option('custom-css-tablet') );
        if( !empty( $tablet_css ) ){
            $inline_custom_style .= '@media only screen and  (max-width: 768px){'.$tablet_css.'}';
        }
        $mobile_css = trim( domik_get_option('custom-css-mobile') );
        if( !empty( $mobile_css ) ){
            $inline_custom_style .= '@media only screen and  (max-width: 640px){'.$mobile_css.'}';
        }
        
        if (!empty($inline_custom_style)) {
            wp_add_inline_style('domik-custom', domik_stripWhitespace($inline_custom_style) );
        }


    }
}
add_action('wp_enqueue_scripts', 'domik_theme_scripts_styles');




function allinone_excerpt_more($more) {
    return '...';
}
add_filter('excerpt_more', 'allinone_excerpt_more');

//pagination
function domik_pagination($prev = 'Prev', $next = 'Next', $pages = '') {
    global $wp_query, $wp_rewrite;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    if ($pages == '') {
        global $wp_query;
        $pages = $wp_query->max_num_pages;
        if (!$pages) {
            $pages = 1;
        }
    }
    $pagination = array('base' => str_replace(999999999, '%#%', get_pagenum_link(999999999)), 'format' => '', 'current' => max(1, get_query_var('paged')), 'total' => $pages, 'prev_text' => $prev, 'next_text' => $next, 'type' => 'list', 'end_size' => 3, 'mid_size' => 3);
    $return = paginate_links($pagination);
    if (!$return) return;
    $return = str_replace("<ul class='page-numbers'>", '<ul class="domik_pagi">', $return);
    echo '<div class="content-nav">' . str_replace("page-numbers", "ajax", $return) . '</div>';
}
//pagination
function domik_folio_pagination($prev = 'Prev', $next = 'Next', $pages = '') {
    global $wp_query, $wp_rewrite;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    if ($pages == '') {
        global $wp_query;
        $pages = $wp_query->max_num_pages;
        if (!$pages) {
            $pages = 1;
        }
    }
    $pagination = array('base' => str_replace(999999999, '%#%', get_pagenum_link(999999999)), 'format' => '', 'current' => max(1, get_query_var('paged')), 'total' => $pages, 'prev_text' => $prev, 'next_text' => $next, 'type' => 'plain', 'end_size' => 3, 'mid_size' => 3);
    $return = paginate_links($pagination);
    if (!$return) return;
    //$return = str_replace("<ul class='page-numbers'>", '<ul class="domik_pagi">', $return);
    //echo '<div class="content-nav">' . str_replace("page-numbers", "ajax", $return) . '</div>';
    echo '<div class="domik_pagination folio_pagination clearfix">' . str_replace("page-numbers", "ajax", $return) . '</div>';
}

function domik_custom_pagination($pages = '', $range = 2, $current_query = '') {
    
    $showitems = ($range * 2) + 1;
    
    if ($current_query == '') {
        global $paged;
        if (empty($paged)) $paged = 1;
    } 
    else {
        $paged = $current_query->query_vars['paged'];
    }
    
    if ($pages == '') {
        if ($current_query == '') {
            global $wp_query;
            $pages = $wp_query->max_num_pages;
            if (!$pages) {
                $pages = 1;
            }
        } 
        else {
            $pages = $current_query->max_num_pages;
        }
    }
    
    if (1 != $pages) {
        echo '<div class="domik_pagination folio_pagination content-nav clearfix"><ul class="domik_pagi">';
        
        if ($paged > 1) echo "<li><a class='pagination-prev ajax' href='" . get_pagenum_link($paged - 1) . "'>" . esc_html__('&laquo; ','domik' ) . "</a></li>";
        
        for ($i = 1; $i <= $pages; $i++) {
            if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
                if($paged == $i)
                    echo "<li><span class='current'>" . $i . "</span></li>";
                else 
                    echo "<li><a href='" . get_pagenum_link($i) . "' class='inactive' >" . $i . "</a></li>";
            }
        }
        
        if ($paged < $pages) echo "<li><a class='pagination-next ajax' href='" . get_pagenum_link($paged + 1) . "'>" . esc_html__(' &raquo;','domik' ) . "</a></li>";
        
        echo "</ul></div>\n";
    }
}


function domik_post_nav($extraclass = '') {
    
    if(!domik_get_option('blog_single_navigation') ) return;
?>
    <ul class="pager <?php echo esc_attr($extraclass); ?> clearfix">
<?php
$prev_post = get_adjacent_post( domik_get_option('blog_single_nav_same_term'), '', true );
if ( is_a( $prev_post, 'WP_Post' ) ) :
?>
    <li class="previous"><a href="<?php echo get_permalink( $prev_post->ID ); ?>" class="arrow-nav lef-ar-nav ajax" title="<?php echo get_the_title($prev_post->ID ); ?>"><?php echo _x('<i class="fa fa-long-arrow-left"></i>', 'Previous post link', 'domik');?></a></li>
<?php endif ?>
    <li class="remove-if-first"><span>/</span></li>
<?php
$next_post = get_adjacent_post( domik_get_option('blog_single_nav_same_term'), '', false );
if ( is_a( $next_post, 'WP_Post' ) ) :
?>
    <li class="next"><a href="<?php echo get_permalink( $next_post->ID ); ?>" class="arrow-nav rig-ar-nav ajax" title="<?php echo get_the_title($next_post->ID ); ?>"><?php echo _x('<i class="fa fa-long-arrow-right"></i>', 'Next post link', 'domik');?></a></li>
<?php endif ?>
    </ul>   
<?php
}

function domik_portfolio_nav(){
    $in_same_term = false;
    $same_term = _x( 'no', 'Next/Previous portfolio items will be in the same category. yes or no', 'domik' );
    if($same_term == 'yes'){
        $in_same_term = true;
    }
?>
<div class="clearfix"></div>
<div class="content-nav domik-folio-single-nav">
    <ul class="pager mgt20 clearfix">
    <?php
    $prev_post = get_adjacent_post( $in_same_term, '', true, 'skill' );
    if ( is_a( $prev_post, 'WP_Post' ) ) :
    ?>
        <li class="previous"><a href="<?php echo get_permalink( $prev_post->ID ); ?>" class="arrow-nav lef-ar-nav ajax" title="<?php echo get_the_title($prev_post->ID ); ?>"><?php echo _x('<i class="fa fa-long-arrow-left"></i>', 'Previous portfolio link', 'domik');?></a></li>
    <?php endif ?>
        <li class="remove-if-first"><span>/</span></li>
    <?php
    $next_post = get_adjacent_post( $in_same_term, '', false, 'skill' );
    if ( is_a( $next_post, 'WP_Post' ) ) :
    ?>
        <li class="next"><a href="<?php echo get_permalink( $next_post->ID ); ?>" class="arrow-nav rig-ar-nav ajax" title="<?php echo get_the_title($next_post->ID ); ?>"><?php echo _x('<i class="fa fa-long-arrow-right"></i>', 'Next portfolio link', 'domik');?></a></li>
    <?php endif ?>
    </ul> 
    <?php if(domik_global_var('folio_list_link')) : ?>
    <div class="p-all">
        <a href="<?php echo esc_url( domik_global_var('folio_list_link') );?>" class="ajax"><i class="fa fa-th-large"></i></a>
    </div>
    <?php endif; ?>
</div>
<?php
}

function domik_search_form($form) {
    $form = '
      <form role="search" method="get" id="searchform" action="' . home_url('/') . '" >
      <div class="search">
      <input type="text" size="16" class="search-field form-control" placeholder="' . __('Search ...', 'domik') . '" value="' . get_search_query() . '" name="s" id="s" />
        <input type="hidden" name="post_type" value="post">
      </div>
      </form>
   ';
    return $form;
}

//Custom comment List:
function domik_theme_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    
    //echo '<pre>';var_dump($comment);die;
    
    if ('div' == $args['style']) {
        $tag = 'div';
        $add_below = 'comment';
    } 
    else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
?>
    <<?php
    echo esc_attr($tag); ?> <?php
    comment_class(empty($args['has_children']) ? 'media' : 'media parent') ?> id="comment-<?php
    comment_ID() ?>">
    <?php
    if ('div' != $args['style']): ?>
    <div id="div-comment-<?php
        comment_ID() ?>" <?php
        comment_class('comment-body'); ?>>
    <?php
    endif; ?>
        <div class="comment-author">
            <?php
    if ($args['avatar_size'] != 0) echo get_avatar($comment, $args['avatar_size']); ?>
        </div>
        <cite class="fn"><a href="#"><?php
    echo get_comment_author_link($comment->comment_ID); ?></a></cite>
        <div class="comment-meta">
            <h6><a href="<?php
    echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?>">
        <?php
    
    /* translators: 1: date, 2: time */
    printf(__('%1$s at %2$s', 'domik'), get_comment_date(), get_comment_time()); ?></a> / <?php
    comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> <?php
    edit_comment_link(__('/ (Edit)', 'domik'), '  ', ''); ?> </h6>
        </div>
        <?php
    comment_text(); ?>

        <?php
    if ($comment->comment_approved == '0'): ?>
            <em class="comment-awaiting-moderation aligncenter"><?php
        _e('Your comment is awaiting moderation.', 'domik'); ?></em>
            <br />
        <?php
    endif; ?>
    
    
    
    <?php
    if ('div' != $args['style']): ?>
    </div> 
    <?php
    endif; ?>
<?php
}


/** 
 * Echo VC custom style for ajax page transition
 * 
 */ 
if(!function_exists('theme_domik_echo_vc_custom_styles')){
    function theme_domik_echo_vc_custom_styles(){
        global $post;

        if( !domik_get_option('disable_ajax_transition') && isset($post) ){
            $cus_style_metas = get_post_meta( $post->ID, '_wpb_shortcodes_custom_css', true );
            $post_custom_css = get_post_meta( $post->ID, '_wpb_post_custom_css', true );
            if(!empty($cus_style_metas) || !empty($post_custom_css)){
                echo '<div id="ajax-page-inline-div-css" class="no-dis" type="text/css">'.esc_attr($post_custom_css).esc_attr($cus_style_metas).'</div>';
            }
        }
        
    }
}


/**
 * Reorder comment field output
 *
 */
function domik_remove_comment_field($string) {
    
    return '';
}
add_filter( 'comment_form_field_comment', 'domik_remove_comment_field' );

/**
 * Then add comment field after
 *
 */
function domik_add_comment_field_after() {
    //$commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? " aria-required='true'" : '' );
    echo '<textarea  placeholder="'.esc_html__('Message','domik').'"  id="comment" rows="9" name="comment"  '.$aria_req.'></textarea>';
}
add_filter( 'comment_form_after_fields', 'domik_add_comment_field_after' );
add_filter( 'comment_form_logged_in_after', 'domik_add_comment_field_after' );





/**
 * Custom template tags for this theme.
 */
require get_parent_theme_file_path( '/includes/template-tags.php' );

/**
 * Additional features to allow styling of the templates.
 */
require get_parent_theme_file_path( '/includes/template-functions.php' );

/**
 * Custom meta box for page, post, portfolio...
 *
 */
// require_once get_template_directory() . '/cmb2/functions.php';

// require_once get_template_directory() . '/vc_extend/vc_shortcodes.php';

/**
 * Taxonomy meta box
 *
 */
// require_once get_template_directory() . '/inc/cth_taxonomy_fields.php';
// require_once get_template_directory() . '/inc/portfolio_cat_metabox_fields.php';



/**
 * Ajax request
 *
 */
require_once get_parent_theme_file_path( '/includes/ajax-callback.php' );
/**
 * Theme custom style
 *
 *
 */

require_once get_parent_theme_file_path( '/includes/overridestyle.php' );


/**
 * Implement the One Click to import demo data
 *
 */
require_once get_parent_theme_file_path( '/includes/one-click-import-data.php' );

/**
 * Include the TGM_Plugin_Activation class.
 */
require_once get_parent_theme_file_path( '/lib/class-tgm-plugin-activation.php' );

add_action('tgmpa_register', 'domik_register_required_plugins');

/**
 * Register the required plugins for this theme.
 *
 * In this example, we register five plugins:
 * - one included with the TGMPA library
 * - two from an external source, one from an arbitrary source, one from a GitHub repository
 * - two from the .org repo, where one demonstrates the use of the `is_callable` argument
 *
 * The variables passed to the `tgmpa()` function should be:
 * - an array of plugin arrays;
 * - optionally a configuration array.
 * If you are not changing anything in the configuration array, you can remove the array and remove the
 * variable from the function call: `tgmpa( $plugins );`.
 * In that case, the TGMPA default settings will be used.
 *
 * This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10.
 */
function domik_register_required_plugins() {
    /*
     * Array of plugin arrays. Required keys are name and slug.
     * If the source is NOT from the .org repo, then source is also required.
     */
    $plugins = array(

        array('name' => esc_html__('WPBakery Page Builder','domik'),
             // The plugin name.
            'slug' => 'js_composer',
             // The plugin slug (typically the folder name).
            'source' => 'http://assets.cththemes.com/plugins/js_composer.zip',
             // The plugin source.
            'required' => true,
            'external_url' => esc_url(domik_relative_protocol_url().'://codecanyon.net/item/visual-composer-page-builder-for-wordpress/242431' ),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => '',
            'class_to_check'            => 'Vc_Manager'
        ), 

        array('name' => esc_html__('Redux Framework','domik'),
             // The plugin name.
            'slug' => 'redux-framework',
             // The plugin source.
            'required' => true,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/plugins/redux-framework/' ),
             // If set, overrides default API URL and points to an external URL.
            'function_to_check'         => '',
            'class_to_check'            => 'ReduxFramework'
        ), 

        array(
            'name' => esc_html__('Contact Form 7','domik'),
             // The plugin name.
            'slug' => 'contact-form-7',
             // The plugin slug (typically the folder name).
            'required' => true,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/plugins/contact-form-7/' ),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => 'wpcf7',
            'class_to_check'            => 'WPCF7'
        ), 


        array(
            'name' => esc_html__('CMB2','domik'),
             // The plugin name.
            'slug' => 'cmb2',
             // The plugin slug (typically the folder name).
            'required' => true,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/support/plugin/cmb2'),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => 'cmb2_bootstrap',
            'class_to_check'            => 'CMB2_Base'
        ),
        

        array(
            'name' => esc_html__('Domik Add-ons','domik' ),
             // The plugin name.
            'slug' => 'domik-add-ons',
             // The plugin slug (typically the folder name).
            'source' => 'domik-add-ons.zip',
             // The plugin source.
            'required' => true,
             // If false, the plugin is only 'recommended' instead of required.

            'force_deactivation'        => true,

            'function_to_check'         => '',
            'class_to_check'            => 'Domik_Addons'
        ), 

        array(
            'name' => esc_html__('Loco Translate','domik'),
             // The plugin name.
            'slug' => 'loco-translate',
             // The plugin slug (typically the folder name).
            'required' => false,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/plugins/loco-translate/'),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => 'loco_autoload',
            'class_to_check'            => 'Loco_Locale'
        ),

        
        array(
            'name' => esc_html__('Envato Market','domik' ),
             // The plugin name.
            'slug' => 'envato-market',
             // The plugin slug (typically the folder name).
            'source' => esc_url(domik_relative_protocol_url().'://envato.github.io/wp-envato-market/dist/envato-market.zip' ),
             // The plugin source.
            'required' => false,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url('//envato.github.io/wp-envato-market/' ),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => 'envato_market',
            'class_to_check'            => 'Envato_Market'
        ),

        array('name' => esc_html__('One Click Demo Import','domik'),
             // The plugin name.
            'slug' => 'one-click-demo-import',
             // The plugin slug (typically the folder name).
            'required' => false,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/plugins/one-click-demo-import/'),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => '',
            'class_to_check'            => 'OCDI_Plugin'
        ),

        array('name' => esc_html__('Regenerate Thumbnails','domik'),
             // The plugin name.
            'slug' => 'regenerate-thumbnails',
             // The plugin slug (typically the folder name).
            'required' => false,
             // If false, the plugin is only 'recommended' instead of required.
            'external_url' => esc_url(domik_relative_protocol_url().'://wordpress.org/plugins/regenerate-thumbnails/' ),
             // If set, overrides default API URL and points to an external URL.

            'function_to_check'         => 'RegenerateThumbnails',
            'class_to_check'            => 'RegenerateThumbnails'
        ),

        


    );

    /*
     * Array of configuration settings. Amend each line as needed.
     *
     * TGMPA will start providing localized text strings soon. If you already have translations of our standard
     * strings available, please help us make TGMPA even better by giving us access to these translations or by
     * sending in a pull-request with .po file(s) with the translations.
     *
     * Only uncomment the strings in the config array if you want to customize the strings.
     */
    $config = array(
        'id'           => 'domik',                 // Unique ID for hashing notices for multiple instances of TGMPA.
        'default_path' => get_template_directory() . '/lib/plugins/',                      // Default absolute path to bundled plugins.
        'menu'         => 'tgmpa-install-plugins', // Menu slug.
        'has_notices'  => true,                    // Show admin notices or not.
        'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
        'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
        'is_automatic' => false,                   // Automatically activate plugins after installation or not.
        'message'      => '',                      // Message to output right before the plugins table.

        
    );

    tgmpa( $plugins, $config );
}