<?php
/**
 * CCTV Services functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @subpackage CCTV Services
 * @since CCTV Services 1.0
 */

if ( ! function_exists( 'cctv_services_setup' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which runs
 * before the init hook. The init hook is too late for some features, such as indicating
 * support post thumbnails.
 */
function cctv_services_setup() {
	load_theme_textdomain( 'cctv-services', get_template_directory() . '/languages' );

	// Enqueue editor styles.
	add_editor_style(get_stylesheet_directory_uri() . '/assets/css/editor-style.css');
}
endif;
add_action( 'after_setup_theme', 'cctv_services_setup' );

function cctv_services_block_assets(){
	wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/font-awesome/css/all.css', array(), '7.1.0' );
	wp_enqueue_style( 'animatecss', get_template_directory_uri() . '/assets/css/animate.css', array(), '4.1.1' );
	wp_enqueue_style( 'cctv-services-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
	wp_enqueue_script('wow-script', get_template_directory_uri() . '/assets/js/wow.js', array('jquery'), false, true);
	wp_enqueue_style( 'owlcarousel-css', get_template_directory_uri() . '/assets/css/owl.carousel.css', array(), '2.3.4' );
	wp_enqueue_script('owlcarousel-js', get_template_directory_uri() . '/assets/js/owl.carousel.js', array('jquery'), false, true);
	wp_enqueue_script('cctv-services-script', get_template_directory_uri() . '/assets/js/script.js', array(
            'wp-hooks',
            'wp-dom-ready',
            'wp-compose',
            'wp-element',
            'wp-data',
            'wp-block-editor',
            'jquery'
        ), '1.0.0', true);
	wp_style_add_data( 'cctv-services-style', 'rtl', 'replace' );
}
add_action('enqueue_block_assets', 'cctv_services_block_assets');

function cctv_services_add_to_cart_text( $text ) {

    if ( is_shop() || is_product_category() ) {
        return 'Add+';
    }

    return $text;
}
add_filter( 'woocommerce_product_add_to_cart_text', 'cctv_services_add_to_cart_text' );

/**
 * Load TGM.
 */
require get_template_directory() . '/inc/tgm/tgm.php';