<?php
/**
 * @package MatrixAddons
 * @subpackage trainify
 * @since 1.0.2
 */

if (!function_exists('trainify_learnpress_enqueue_scripts')):

    function trainify_learnpress_enqueue_scripts()
    {

        global $trainify_version;

        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';

        wp_enqueue_style('trainify-learnpress', get_template_directory_uri() . '/assets/css/learnpress-style' . $min . '.css', array(), esc_attr($trainify_version));

    }

endif;
add_action('wp_enqueue_scripts', 'trainify_learnpress_enqueue_scripts', 1000);

if (!function_exists('trainify_before_left_user_profile')):

    function trainify_before_left_user_profile($profile)
    {

        echo '<div class="trainify-left-profile-wraper">';

    }

endif;
add_action('learn-press/before-user-profile', 'trainify_before_left_user_profile', 1, 1);


if (!function_exists('trainify_after_left_user_profile')):

    function trainify_after_left_user_profile($profile)
    {

        echo '</div>';

    }

endif;
add_action('learn-press/after-profile-nav', 'trainify_after_left_user_profile', 10, 1);

if (!function_exists('harmoclass_learnpress_thumbnail_change')):

    function harmoclass_learnpress_change_placeholder($thumbnail)
    {

        $search_image = plugins_url('learnpress/assets/images/placeholder-800x450.jpg');
        $replace_image = get_template_directory_uri() . '/assets/img/blank-image.jpg';
        $new_thumbnail = str_replace($search_image, $replace_image, $thumbnail);
        return $new_thumbnail;

    }

endif;
add_filter('trainify_learnpress_thumbnail', 'harmoclass_learnpress_change_placeholder', 10, 1);

if (!function_exists('trainify_learnpress_template_redirect_callback')):

    function trainify_learnpress_template_redirect_callback()
    {

        remove_action('learn-press/after-courses-loop-item', 'learn_press_course_loop_item_buttons', 35);

    }

endif;

add_action('plugins_loaded', 'trainify_learnpress_template_redirect_callback', 10);


if (!function_exists('trainify_learnpress_loop_item_before_title')):

    function trainify_learnpress_loop_item_before_title()
    {

        ?><div class="trainify-course-content"><?php

    }

endif;

add_action('learn-press/courses-loop-item-title', 'trainify_learnpress_loop_item_before_title', 11);

if (!function_exists('trainify_learnpress_loop_item_after_content')):

    function trainify_learnpress_loop_item_after_content()
    {

        ?></div> <!--.trainify-course-content-->
        <?php

    }

endif;
add_action('learn-press/after-courses-loop-item', 'trainify_learnpress_loop_item_after_content', 50);

if (!function_exists('trainify_learnpress_addons_tabs')):

    function trainify_learnpress_addons_tabs($tabs)
    {
        if (isset($tabs['more'])) {
            unset($tabs['more']);
        }
        if (isset($tabs['themes'])) {
            unset($tabs['themes']);
        }
        return $tabs;
    }

endif;

add_action('learn-press/admin/page-addons-tabs', 'trainify_learnpress_addons_tabs', 10, 1);