HEX
Server: Apache
System: Linux hp3-wp-1011494.hostingp3.local 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User: csh2729955 (2121743)
PHP: 7.4.33
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/storage/162/3480162/user/htdocs/wp-content/plugins/envo-magazine-pro/envo-magazine-pro.php
<?php
/*
  Plugin Name: Envo Magazine PRO
  Plugin URL: https://envothemes.com/
  Description: PRO addon for Envo Magazine Theme
  Version: 1.9.1
  Author: EnvoThemes
  Author URI: https://envothemes.com/
 */

if (!function_exists('add_action')) {
    die('Nothing to do...');
}

$plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), false);
$plugin_version = $plugin_data['Version'];
define('ENVO_MAGAZINE_PRO_CURRENT_VERSION', $plugin_version);

add_action('plugins_loaded', 'envo_magazine_pro_load_textdomain');

function envo_magazine_pro_load_textdomain() {
    load_plugin_textdomain('envo-magazine-pro', false, basename(dirname(__FILE__)) . '/languages/');
}

function envo_magazine_pro_scripts() {
    wp_enqueue_style('envo-magazine-pro-css', plugin_dir_url(__FILE__) . 'css/style.css', array(), '1.9');
    wp_enqueue_script('envo-magazine-pro-js', plugin_dir_url(__FILE__) . 'js/envo-magazine-pro.js', array('jquery'), '1.9', true);
    wp_enqueue_script('slick', plugin_dir_url(__FILE__) . 'js/slick.min.js', array('jquery'), '1.9', true);
    if (is_rtl()) {
        wp_enqueue_script('envo-magazine-pro-rtl-js', plugin_dir_url(__FILE__) . '/js/envo-magazine-pro-rtl.js', array('jquery'), '1.9', true);
        wp_deregister_script('envo-magazine-pro-js');
    }
}

add_action('wp_enqueue_scripts', 'envo_magazine_pro_scripts');

function envo_magazine_pro_style_deregister() {
    wp_dequeue_style('envo-magazine-fonts');
}

add_action('wp_print_styles', 'envo_magazine_pro_style_deregister', 100);

/* Footer copy texts */
if (!function_exists('envo_magazine_pro_text')) {

    function envo_magazine_pro_text($rewritetexts) {

        $currentyear = date('Y');
        $copy = '&copy;';

        return str_replace(
                array('%current_year%', '%copy%'), array($currentyear, $copy), $rewritetexts
        );
    }

}

add_filter('envo_magazine_pro_footer_text', 'envo_magazine_pro_text');

add_action('after_setup_theme', 'envo_magazine_pro_action', 0);

function envo_magazine_pro_action() {

    remove_action('envo_magazine_generate_footer', 'envo_magazine_generate_construct_footer');
    add_action('envo_magazine_generate_footer', 'envo_magazine_pro_generate_construct_footer');
}

function envo_magazine_pro_generate_construct_footer() {
    if (get_theme_mod('footer-credits', '') != '') :
        ?>
        <div class="footer-credits-text text-center">
            <?php echo apply_filters('envo_magazine_pro_footer_text', get_theme_mod('footer-credits', '')); ?>
        </div>
    <?php else : ?>
        <div class="footer-credits-text text-center">
            <?php printf(__('Proudly powered by %s', 'envo-magazine-pro'), '<a href="' . esc_url(__('https://wordpress.org/', 'envo-magazine-pro')) . '">WordPress</a>'); ?>
            <span class="sep"> | </span>
            <?php printf(__('Theme: %1$s', 'envo-magazine-pro'), '<a href="http://envothemes.com/">Envo Magazine</a>'); ?>
        </div>
    <?php
    endif;
}

/* Check if Envo Magazine theme is activated */

if (!empty($GLOBALS['pagenow']) && 'plugins.php' === $GLOBALS['pagenow']) {
    add_action('admin_notices', 'envo_magazine_pro_admin_notices', 0);
}

function envo_magazine_pro_requirements() {

    $envo_magazine_pro_errors = array();
    $theme = wp_get_theme();

    if (( 'Envo Magazine' != $theme->name ) && ( 'Envo Magazine' != $theme->parent_theme )) {

        $envo_magazine_pro_errors[] = __('You need to have <a href="https://wordpress.org/themes/envo-magazine/" target="_blank">Envo Magazine</a> theme in order to use Envo Magazine PRO plugin.', 'envo-magazine-pro');
    }

    return $envo_magazine_pro_errors;
}

function envo_magazine_pro_admin_notices() {

    $envo_magazine_pro_errors = envo_magazine_pro_requirements();

    if (empty($envo_magazine_pro_errors))
        return;

    /* Suppress "Plugin activated" notice. */
    unset($_GET['activate']);

    echo '<div class="notice error my-envo-credits-notice is-dismissible">';
    echo '<p>' . join($envo_magazine_pro_errors) . '</p>';
    echo '<p>' . __('<i>Envo Magazine PRO</i> plugin has been deactivated.', 'envo-magazine-pro') . '</p>';
    echo '</div>';

    deactivate_plugins(plugin_basename(__FILE__));
}

/**
 * Mega Menu section
 */
function megamenu_add_theme_envo_magazine_1523343846($themes) {
    $themes["envo_magazine_1523343846"] = array(
        'title' => 'Envo Magazine',
        'container_background_from' => 'rgba(255, 255, 255, 0)',
        'container_background_to' => 'rgba(255, 255, 255, 0)',
        'menu_item_link_height' => '60px',
        'menu_item_link_color' => 'rgb(34, 34, 34)',
        'panel_background_from' => 'rgb(255, 255, 255)',
        'panel_background_to' => 'rgb(255, 255, 255)',
        'panel_border_color' => 'rgb(34, 34, 34)',
        'panel_border_top' => '3px',
        'panel_border_radius_top_left' => '4px',
        'panel_border_radius_top_right' => '4px',
        'panel_border_radius_bottom_left' => '4px',
        'panel_border_radius_bottom_right' => '4px',
        'panel_header_color' => 'rgb(34, 34, 34)',
        'panel_header_border_color' => '#555',
        'panel_padding_left' => '15px',
        'panel_padding_right' => '15px',
        'panel_padding_top' => '10px',
        'panel_padding_bottom' => '10px',
        'panel_font_size' => '14px',
        'panel_font_color' => '#666',
        'panel_font_family' => 'inherit',
        'panel_second_level_font_color' => '#555',
        'panel_second_level_font_color_hover' => '#555',
        'panel_second_level_text_transform' => 'uppercase',
        'panel_second_level_font' => 'inherit',
        'panel_second_level_font_size' => '16px',
        'panel_second_level_font_weight' => 'bold',
        'panel_second_level_font_weight_hover' => 'bold',
        'panel_second_level_text_decoration' => 'none',
        'panel_second_level_text_decoration_hover' => 'none',
        'panel_second_level_border_color' => '#555',
        'panel_third_level_font_color' => '#666',
        'panel_third_level_font_color_hover' => '#666',
        'panel_third_level_font' => 'inherit',
        'panel_third_level_font_size' => '14px',
        'flyout_width' => '220px',
        'flyout_menu_background_from' => 'rgb(255, 255, 255)',
        'flyout_menu_background_to' => 'rgb(255, 255, 255)',
        'flyout_border_color' => 'rgb(34, 34, 34)',
        'flyout_border_top' => '3px',
        'flyout_border_radius_top_left' => '4px',
        'flyout_border_radius_top_right' => '4px',
        'flyout_border_radius_bottom_left' => '4px',
        'flyout_border_radius_bottom_right' => '4px',
        'flyout_menu_item_divider' => 'on',
        'flyout_menu_item_divider_color' => 'rgba(0, 0, 0, 0.1)',
        'flyout_link_padding_top' => '5px',
        'flyout_link_padding_bottom' => '5px',
        'flyout_link_height' => '25px',
        'flyout_background_from' => 'rgb(255, 255, 255)',
        'flyout_background_to' => 'rgb(255, 255, 255)',
        'flyout_link_size' => '14px',
        'flyout_link_color' => '#666',
        'flyout_link_color_hover' => '#666',
        'flyout_link_family' => 'inherit',
        'shadow' => 'on',
        'shadow_vertical' => '10px',
        'shadow_blur' => '25px',
        'shadow_color' => 'rgba(0, 0, 0, 0.15)',
        'toggle_background_from' => 'rgba(255, 255, 255, 0)',
        'toggle_background_to' => 'rgba(255, 255, 255, 0)',
        'toggle_font_color' => 'rgb(34, 34, 34)',
        'toggle_bar_height' => '60px',
        'mobile_background_from' => 'rgb(255, 255, 255)',
        'mobile_background_to' => 'rgb(255, 255, 255)',
        'mobile_menu_item_link_font_size' => '14px',
        'mobile_menu_item_link_color' => 'rgb(34, 34, 34)',
        'mobile_menu_item_link_text_align' => 'left',
        'custom_css' => '/** Push menu onto new line **/ 
					#site-navigation .navbar-default .navbar-toggle {
						display: none;
					}
					.container > .navbar-header {
						float: left;
					}
					.shrink .navbar-brand {
						padding: 8px 15px;
					}
					.shrink .site-branding-logo img {
						max-height: 60px !important;
					}
					@media only screen and (max-width: 600px) {
					  .transparent-header #site-navigation:not(.shrink) #mega-menu-wrap-main_menu #mega-menu-main_menu > li.mega-menu-item > a.mega-menu-link {
						color: inherit !important;
					  }
					}
					.navbar-nav.search-icon.navbar-left, .navbar-nav.search-icon.navbar-right {
						display: none;
					}',
    );
    return $themes;
}

add_filter("megamenu_themes", "megamenu_add_theme_envo_magazine_1523343846");

function envo_magazine_megamenu_override_default_theme($value) {

    if (!isset($value['main_menu']['theme'])) {
        $value['main_menu']['theme'] = 'envo_magazine_1523343846';
    }

    return $value;
}

add_filter('default_option_megamenu_settings', 'envo_magazine_megamenu_override_default_theme');

function envo_magazine_pro_load_widgets() {

    register_widget('envo_magazine_zig_zag');
    register_widget('envo_magazine_posts_in_pictures');
    register_widget('envo_magazine_Mix_Column_News_Ext');
    register_widget('envo_magazine_Featured_Column_News_Ext');
    register_widget('envo_magazine_news_ticker');
    register_widget('envo_magazine_slider_widget');
    register_widget('envo_magazine_slider_widget_two');
    register_widget('envo_magazine_carousel_widget_one');
    register_widget('envo_magazine_carousel_widget_two');
    register_widget('envo_magazine_carousel_widget_three');
    register_widget('envo_magazine_tabbed_login');
    register_widget('envo_magazine_masonry_widget');
}

add_action('widgets_init', 'envo_magazine_pro_load_widgets');

require_once( plugin_dir_path(__FILE__) . 'lib/zigzag-widget.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/posts-in-pictures.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/mix-column-news-ext.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/featured-column-news-ext.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/news-ticker.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/slider-widget.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/slider-widget-two.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/carousel-widget-one.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/carousel-widget-two.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/carousel-widget-three.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/tabbed-login.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/masonry-widget.php' );

//require_once( plugin_dir_path(__FILE__) . 'lib/update-notifier.php' );
require_once( plugin_dir_path(__FILE__) . 'lib/vendor/sl-plugin.php' );

require_once( plugin_dir_path(__FILE__) . 'lib/page-templates.php' );

if (!class_exists('Kirki')) {
    include_once( plugin_dir_path(__FILE__) . 'include/kirki.php' );
}
add_filter('kirki_output_inline_styles', function() {
    return true;
});
/* Register the config */
Kirki::add_config('envo_magazine_pro', array(
    'capability' => 'edit_theme_options',
    'option_type' => 'theme_mod',
));

require_once( plugin_dir_path(__FILE__) . 'options/footer-credits.php' );
require_once( plugin_dir_path(__FILE__) . 'options/colors-typography.php' );
require_once( plugin_dir_path(__FILE__) . 'options/ad-spaces.php' );
require_once( plugin_dir_path(__FILE__) . 'options/header.php' );
require_once( plugin_dir_path(__FILE__) . 'options/global.php' );
require_once( plugin_dir_path(__FILE__) . 'options/metabox.php' );

function envo_magazine_lazy_load_images_filter_lazyload($content) {
    // Don't lazyload for feeds, previews, mobile
    if (is_feed() || is_preview())
        return $content;
    // Don't lazyload for amp-wp content
    if (function_exists('is_amp_endpoint') && is_amp_endpoint()) {
        return $content;
    }
    // Don't lazy-load if is this feature disabled
    if (get_theme_mod('lazy-load-on', 1) != 1)
        return $content;
    // Don't lazy-load if the content has already been run through previously
    if (false !== strpos($content, 'lazy'))
        return $content;

    $content = preg_replace_callback('/(<\s*img[^>]+)(src\s*=\s*"[^"]+")([^>]+>)/i', 'envo_magazine_lazy_load_images_preg_lazyload', $content);

    return $content;
}

// add_filter( 'the_content', 'envo_magazine_lazy_load_images_filter_lazyload', 999 );

function envo_magazine_lazy_load_images_preg_lazyload($img_match) {
    // Don't lazy-load if is this feature disabled
    if (get_theme_mod('lazy-load-on', 1) != 1)
        return;

    $img_replace = $img_match[1] . 'src="' . get_template_directory_uri() . '/img/placeholder.png" data-src' . substr($img_match[2], 3) . $img_match[3];

    $img_replace = preg_replace('/class\s*=\s*"/i', 'class="lazy ', $img_replace);

    if (!preg_match('/class\s*=\s*"/i', $img_replace)) {
        $img_replace = $img_match[1] . 'src="' . get_template_directory_uri() . '/img/placeholder.png" class="lazy" data-src' . substr($img_match[2], 3) . $img_match[3];
    }

    $img_replace .= '<noscript>' . $img_match[0] . '</noscript>';
    return $img_replace;
}

function envo_magazine_pro_thumb_img($img = 'full', $col = '', $link = true, $single = false) {
    global $post;
    $videoID = get_post_meta(get_the_ID(), 'envo_embed_url', true);
    $lazyON = get_theme_mod('lazy-load-on', 1);
    $galleryON = get_theme_mod('featured-gallery-on', 1);
    if (has_post_thumbnail() && $link == true) {
        ?>
        <div class="news-thumb <?php echo $col; ?>">
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
        <?php if ($lazyON == 1) { ?>
                    <img class="lazy" src="<?php echo esc_url(get_template_directory_uri()) . '/img/placeholder.png' ?>" data-src="<?php the_post_thumbnail_url($img); ?>" title="<?php the_title_attribute(); ?>" alt="<?php the_title_attribute(); ?>"/>
                    <noscript>
                    <?php the_post_thumbnail($img); ?>
                    </noscript>
                <?php } else { ?>
                    <?php the_post_thumbnail($img); ?>
        <?php } ?>
            </a>
        </div><!-- .news-thumb -->
    <?php } elseif ($videoID != '' && $single == true) { ?>
        <?php do_action('envo_magazine_pro_yt_video'); ?>	
    <?php } elseif (get_post_gallery() && $single == true && $galleryON == 1 && (function_exists('has_block') && !has_block('gallery', $post->post_content))) { ?>
        <?php do_action('envo_magazine_pro_gallery'); ?> 
        <?php } elseif (has_post_thumbnail()) { ?>
        <div class="news-thumb <?php echo $col; ?>">
        <?php if ($lazyON == 1) { ?>
                <img class="lazy" src="<?php echo esc_url(get_template_directory_uri()) . '/img/placeholder.png' ?>" data-src="<?php the_post_thumbnail_url($img); ?>" title="<?php the_title_attribute(); ?>" alt="<?php the_title_attribute(); ?>"/>
                <noscript>
                <?php the_post_thumbnail($img); ?>
                </noscript>
            <?php } else { ?>
                <?php the_post_thumbnail($img); ?>
        <?php } ?>
        </div><!-- .news-thumb -->
    <?php
    } elseif (!has_post_thumbnail() && get_theme_mod('default-image-url', '') != '' && !is_attachment() && !is_page()) {
        $img_url = wp_get_attachment_image_src(get_theme_mod('default-image-url', ''), $img);
        ?>
        <div class="news-thumb <?php echo $col; ?>">
            <?php if ($lazyON == 1) { ?>
                <img class="lazy" src="<?php echo esc_url(get_template_directory_uri()) . '/img/placeholder.png' ?>" data-src="<?php echo $img_url[0]; ?>" title="<?php the_title_attribute(); ?>" alt="<?php the_title_attribute(); ?>"/>
            <?php } else { ?>
                <img class="no-lazy" src="<?php echo $img_url[0]; ?>" title="<?php the_title_attribute(); ?>" alt="<?php the_title_attribute(); ?>"/>
        <?php } ?>
        </div><!-- .news-thumb -->
        <?php
    }
}

add_action('envo_magazine_pro_gallery', 'envo_magazine_pro_single_image_gallery');

function envo_magazine_pro_single_image_gallery() {
    global $post;
    $lazyON = get_theme_mod('lazy-load-on', 1);
    // if there is a gallery block do this
    if (function_exists('has_block') && has_block('gallery', $post->post_content)) {
        $post_blocks = parse_blocks($post->post_content);
        foreach ($post_blocks as $post_block) 
  {
    if ("core/gallery" == $post_block["blockName"]) 
    {
      $ids = $post_block["attrs"]["ids"];
    }
  }
    } 
    // if there is not a gallery block do this
    else {
        // gets the gallery info
        $gallery = get_post_gallery( $post->ID, false );
        // makes an array of image ids
        $ids = explode ( ",", $gallery['ids'] );
    }
    ?>
    <div class="slider-single-item-for" >
        <?php
        /* Loop through all the image and output them one by one */
        foreach ($ids as $src) :
            $imgs = wp_get_attachment_image_src($src, 'envo-magazine-single');
            ?>
            <div class="news-thumb">
                <?php if ($lazyON == 1) { ?>
                    <img class="lazy" src="<?php echo esc_url(get_template_directory_uri()) . '/img/placeholder.png' ?>" data-src="<?php echo $imgs[0]; ?>" />
                <?php } else { ?>
                    <img class="no-lazy" src="<?php echo $imgs[0]; ?>"/>
            <?php } ?>
            </div><!-- .news-thumb -->
            <?php
        endforeach;
        ?>
    </div>
    <div class="slider-single-item-sync" >
        <?php
        /* Loop through all the image and output them one by one */
        foreach ($ids as $src) :
            $imgs = wp_get_attachment_image_src($src, 'envo-magazine-med');
            ?>
            <div class="news-thumb">
                <?php if ($lazyON == 1) { ?>
                    <img class="lazy" src="<?php echo esc_url(get_template_directory_uri()) . '/img/placeholder.png' ?>" data-src="<?php echo $imgs[0]; ?>" />
                <?php } else { ?>
                    <img class="no-lazy" src="<?php echo $imgs[0]; ?>"/>
            <?php } ?>
            </div><!-- .news-thumb -->
            <?php
        endforeach;
        ?>
    </div>
    <?php
}

add_action('envo_magazine_pro_yt_video', 'envo_magazine_pro_single_yt_video');

function envo_magazine_pro_single_yt_video() {
    $theID = get_post_meta(get_the_ID(), 'envo_embed_url', true);
    // Check if there is in fact a video URL
    if ($theID) {
        ?>
        <div class="news-thumb oembed-url">
        <?php echo wp_oembed_get($theID); ?>
        </div><!-- .news-thumb -->
        <?php
    }
}

function envo_magazine_pro_import_files() {
    return array(
        array(
            'import_file_name' => 'Envo Magazine PRO',
            'import_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/default/envo-magazine-pro-content.xml',
            'import_widget_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/default/envo-magazine-pro-pro-widgets.wie',
            'import_customizer_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/default/envo-magazine-pro-customizer.dat',
            'import_preview_image_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/default/envo-magazine-pro-screenshot.jpg',
            'preview_url' => 'http://envothemes.com/envo-magazine-pro/',
        //'import_notice'              => __( 'The plugins settings (Mega Menu, Contact Form,...) are not included in this import.', 'envo-magazine-pro' ),
        ),
        array(
            'import_file_name' => 'Envo Magazine PRO - Dark',
            'import_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/dark/envo-magazine-pro-dark-content.xml',
            'import_widget_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/dark/envo-magazine-pro-dark-widgets.wie',
            'import_customizer_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/dark/envo-magazine-pro-dark-customizer.dat',
            'import_preview_image_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/dark/envo-magazine-pro-dark-screenshot.jpg',
            'preview_url' => 'http://envothemes.com/envo-magazine-pro-dark/',
        //'import_notice'              => __( 'The plugins settings (Mega Menu, Contact Form,...) are not included in this import.', 'envo-magazine-pro' ),
        ),
        array(
            'import_file_name' => 'Envo Magazine PRO - Sports',
            'import_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/sports/envo-magazine-pro-sports-content.xml',
            'import_widget_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/sports/envo-magazine-pro-sports-widgets.wie',
            'import_customizer_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/sports/envo-magazine-pro-sports-customizer.dat',
            'import_preview_image_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/sports/envo-magazine-pro-sports-screenshot.jpg',
            'preview_url' => 'http://envothemes.com/envo-magazine-pro-sports/',
        //'import_notice'              => __( 'The plugins settings (Mega Menu, Contact Form,...) are not included in this import.', 'envo-magazine-pro' ),
        ),
        array(
            'import_file_name' => 'Envo Magazine PRO - Tech',
            'import_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/tech/envo-magazine-pro-tech-content.xml',
            'import_widget_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/tech/envo-magazine-pro-tech-widgets.wie',
            'import_customizer_file_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/tech/envo-magazine-pro-tech-customizer.dat',
            'import_preview_image_url' => 'http://envothemes.com/wp-content/uploads/demo-import/envo-magazine-pro/tech/envo-magazine-pro-tech-screenshot.jpg',
            'preview_url' => 'http://envothemes.com/envo-magazine-pro-tech/',
        //'import_notice'              => __( 'The plugins settings (Mega Menu, Contact Form,...) are not included in this import.', 'envo-magazine-pro' ),
        ),
    );
}

add_filter('pt-ocdi/import_files', 'envo_magazine_pro_import_files');

function envo_magazine_pro_after_import($selected_import) {

    if ('Envo Magazine PRO' === $selected_import['import_file_name']) {
        //echo "This will be displayed only on after import if user selects Demo Import 1";
        // Set logo in customizer
        set_theme_mod('logo_img', plugin_dir_path(__FILE__) . '/img/envo-magazine-logo-pro.png');
    } elseif ('Envo Magazine PRO - Dark' === $selected_import['import_file_name']) {
        //echo "This will be displayed only on after import if user selects Demo Import 2";
        // Set logo in customizer
        set_theme_mod('logo_img', get_template_directory_uri() . '/img/envo-magazine-logo-pro-orange.png');
    } elseif ('Envo Magazine PRO - Tech' === $selected_import['import_file_name']) {
        //echo "This will be displayed only on after import if user selects Demo Import 2";
        // Set logo in customizer
        set_theme_mod('logo_img', get_template_directory_uri() . '/img/envo-magazine-logo-pro-tech-demo.png');
    }
}

add_action('pt-ocdi/after_import', 'envo_magazine_pro_after_import');

function envo_magazine_pro_after_import_setup() {
    // Assign menus to their locations.
    $main_menu = get_term_by('name', 'Main Menu', 'nav_menu');
    $top_left = get_term_by('name', 'top left', 'nav_menu');
    $top_right = get_term_by('name', 'top right', 'nav_menu');

    set_theme_mod('nav_menu_locations', array(
        'main_menu' => $main_menu->term_id,
        'top_menu_left' => $top_left->term_id,
        'top_menu_right' => $top_right->term_id,
            )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title('Homepage');
    $blog_page_id = get_page_by_title('Blog');

    update_option('show_on_front', 'page');
    update_option('page_on_front', $front_page_id->ID);
    update_option('page_for_posts', $blog_page_id->ID);
}

add_action('pt-ocdi/after_import', 'envo_magazine_pro_after_import_setup');

add_filter('pt-ocdi/disable_pt_branding', '__return_true');

add_action('customize_register', 'envo_magazine_pro_theme_customize_register', 99);

function envo_magazine_pro_theme_customize_register($wp_customize) {

    $wp_customize->remove_control('header_textcolor');
    $wp_customize->remove_section('envo_magazine_page_view_pro');
}

function envo_magazine_pro_gallery_icon_before_title($title = '', $id = null) {

    if (get_post_gallery($id) && ( is_front_page() || is_archive() )) {
        $title = '<i class="post-has-oembed fa fa-picture-o" aria-hidden="true"></i>' . $title;
    }

    return $title;
}

function insert_icon_before_title($title = '', $id = null) {
    $theID = get_post_meta(get_the_ID(), 'envo_embed_url', true);

    if ($theID && (false !== strpos($theID, 'youtube.com') || false !== strpos($theID, 'vimeo.com') || false !== strpos($theID, 'youtu.be') || false !== strpos($theID, 'wordpress.tv')) && ( is_front_page() || is_archive() )) {
        $title = '<i class="post-has-oembed fa fa-video-camera" aria-hidden="true"></i>';
    }
    if ($theID && (false !== strpos($theID, 'soundcloud.com') || false !== strpos($theID, 'mixcloud.com') || false !== strpos($theID, 'spotify.com')) && ( is_front_page() || is_archive() )) {
        $title = '<i class="post-has-oembed fa fa-music" aria-hidden="true"></i>';
    }

    return $title;
}

if (!function_exists('envo_magazine_pro_the_title')) :

    function envo_magazine_pro_the_title() {
        if (insert_icon_before_title()) {
            the_title('<h2 class="entry-titles"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . insert_icon_before_title(), '</a></h2>');
        } elseif (envo_magazine_pro_gallery_icon_before_title() && get_theme_mod('featured-gallery-on', 1) == 1) {
            the_title('<h2 class="entry-title-gallery"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . envo_magazine_pro_gallery_icon_before_title(), '</a></h2>');
        } else {
            the_title('<h2 class="entry-titles"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>');
        }
    }

endif;

function envo_magazine_pro_filter_post_class($classes) {

    // Test for your layout post meta
    $theID = get_post_meta(get_the_ID(), 'envo_embed_url', true);

    // If it's there, use it
    if ($theID) {
        $names = array(
            'animoto',
            'blip',
            'cloudup',
            'collegehumor',
            'dailymotion',
            'facebook',
            'flickr',
            'funnyordie',
            'hulu',
            'imgur',
            'instagram',
            'issuu',
            'kickstarter',
            'meetup',
            'mixcloud',
            'photobucket',
            'polldaddy',
            'reddit',
            'severbnation',
            'scribd',
            'slideshare',
            'smugmug',
            'soundcloud',
            'speakerdeck',
            'spotify',
            'ted',
            'tumblr',
            'twitter',
            'videopress',
            'vimeo',
            'vine',
            'wordpress',
            'youtube',
        );
        foreach ($names as $name) {
            if (false !== strpos($theID, $name)) {
                $classes[] = 'oembed-' . $name;
            }
        }
    }

    // Return the array
    return $classes;
}

add_filter('post_class', 'envo_magazine_pro_filter_post_class');