HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/refonte2023/wordpress/wp-content/plugins/ova-career/inc/class-ova-assets.php
<?php 
defined( 'ABSPATH' ) || exit();

if( !class_exists( 'OVACAREER_assets' ) ){
	class OVACAREER_assets{

		public function __construct(){

			/* Add JS, CSS for admin */
			add_action( 'admin_enqueue_scripts', array( $this, 'ovacareer_admin_enqueue_scripts' ), 10, 0 );
            
            /* Add JS, CSS for frontend */
			add_action( 'wp_enqueue_scripts', array( $this, 'ovacareer_enqueue_scripts' ), 10, 0 );

			/* Add JS for Elementor */
			add_action( 'elementor/frontend/after_register_scripts', array( $this, 'ova_enqueue_scripts_elementor_career' ) );

		}

        public function ovacareer_admin_enqueue_scripts(){

        	// Map
        	global $pagenow;
        	if ( ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) && 'career' === get_post_type() ) {
        		if ( get_theme_mod( 'ova_career_google_key_map', false ) ) {
					wp_enqueue_script( 'pw-google-maps-api', 'https://maps.googleapis.com/maps/api/js?key='.get_theme_mod( 'ova_career_google_key_map', '' ).'&libraries=places', false, true );
				} else {
					wp_enqueue_script( 'pw-google-maps-api','https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places', array('jquery'), false, true );
				}
        	}

			// Add JS
			wp_enqueue_script( 'script-admin-career', OVACAREER_PLUGIN_URI. 'assets/js/script-admin.js', [ 'jquery' ], false, true );	

			// Init Css
			wp_enqueue_style( 'career-admin-style', OVACAREER_PLUGIN_URI.'assets/css/admin-style.css' );
		}

		public function ovacareer_enqueue_scripts(){

			// Map
			if ( is_singular( 'career' ) || is_post_type_archive( 'career' ) || is_tax( 'cat_career' ) ) {
				if ( get_theme_mod( 'ova_career_google_key_map', false ) ) {
					wp_enqueue_script( 'pw-google-maps-api', 'https://maps.googleapis.com/maps/api/js?key='.get_theme_mod( 'ova_career_google_key_map', '' ).'&libraries=places', false, true );
				} else {
					wp_enqueue_script( 'pw-google-maps-api','https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places', array('jquery'), false, true );
				}
			}
			
			if( is_singular('career') ){
				// Fancybox
				wp_enqueue_script('fancybox', GIMONT_URI.'/assets/libs/fancybox/fancybox.umd.js', array('jquery'),null,true);
				wp_enqueue_style('fancybox', GIMONT_URI.'/assets/libs/fancybox/fancybox.css', array(), null);
			}

			// Add JS
			wp_enqueue_script( 'script-career', OVACAREER_PLUGIN_URI. 'assets/js/script.js', [ 'jquery' ], false, true );

			// Init Css
			wp_enqueue_style( 'career-style', OVACAREER_PLUGIN_URI.'assets/css/style.css' );	

		}

		// Add JS for elementor
		public function ova_enqueue_scripts_elementor_career(){
			wp_enqueue_script( 'script-elementor-career', OVACAREER_PLUGIN_URI. 'assets/js/script-elementor.js', [ 'jquery' ], false, true );
		}


	}
	new OVACAREER_assets();
}