HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vmi1674223.contaboserver.net 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: root (0)
PHP: 7.4.3-4ubuntu2.22
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/ruwebsiteok/wp-content/themes/interactive-education/functions.php
<?php
/**
 * Interactive Education functions and definitions
 *
 * @package Interactive Education
 */

if ( ! function_exists( 'interactive_education_setup' ) ) :
	function interactive_education_setup() {
		
		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		add_theme_support( 'woocommerce' );

		load_theme_textdomain( 'interactive-education', get_template_directory() . '/languages' );

		/*
		 * 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' );

		/*
		 * Post thumbnail support should be enabled for pages and posts.
		 */
		add_theme_support( 'post-thumbnails' );

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus( array(
			'menu-1' => esc_html__( 'Primary', 'interactive-education' ),
			'menu-2' => esc_html__( 'Footer', 'interactive-education' ),
		) );

		/*
		 * To produce valid HTML5, change the default core markup for the comments, search form, and search form.
		 */
		add_theme_support( 'html5', array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );
		
		/**
		 * Add support for core custom logo.
		 *
		 * @link https://codex.wordpress.org/Theme_Logo
		 */
		add_theme_support( 'custom-logo', array(
			'width'       => 270,
			'height'      => 80,
			'flex-height' => true,
			'flex-width'  => true,
		) );

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

		// Add custom image size.
		add_image_size( 'interactive-education-1920-550', 1920, 550, true );
		add_image_size( 'interactive-education-1370-550', 1370, 550, true );
		add_image_size( 'interactive-education-590-310', 590, 310, true );
		add_image_size( 'interactive-education-420-380', 420, 380, true );
		add_image_size( 'interactive-education-420-300', 420, 300, true );
		add_image_size( 'interactive-education-420-200', 420, 200, true );
		add_image_size( 'interactive-education-290-150', 290, 150, true );
		add_image_size( 'interactive-education-80-60', 80, 60, true );
		
		add_editor_style( array( '/assets/css/editor-style.min.css') );

		add_theme_support( 'align-wide' );
		add_theme_support( 'editor-styles' );
		add_theme_support( 'wp-block-styles' );

		add_theme_support( 'custom-background', apply_filters( 'interactive_education_custom_background', array(
            'default-color' => 'ffffff',
            'default-image' => '',
        )));
        
        add_theme_support( 'responsive-embeds' );

		add_theme_support('custom-header', array(
			'default-image'      => '',
			'width'              => 1920,
			'height'             => 200,
			'flex-height'        => true,
			'flex-width'         => true,
			'uploads'            => true,
		));

		define('INTERACTIVE_EDUCATION_BUY_NOW',__('https://www.themepixels.net/products/interactive-education-wordpress-theme/','interactive-education'));
		define('INTERACTIVE_EDUCATION_LIVE_DEMO',__('https://themepixels.net/demo-site/interactive-education/','interactive-education'));
		define('INTERACTIVE_EDUCATION_FREE_DOC',__('https://www.themepixels.net/docs/interactive-education-free/','interactive-education'));
		define('INTERACTIVE_EDUCATION_BUNDLE',__('https://www.themepixels.net/products/wp-theme-bundle/','interactive-education'));
		define('INTERACTIVE_EDUCATION_THEME_SUPPORT',__('https://wordpress.org/support/theme/interactive-education','interactive-education'));

		/**
		* FREE DEMO CONTENT.
		*/
		require get_template_directory() . '/inc/free-demo-content/interactive_education_config_file.php';

	}
endif;
add_action( 'after_setup_theme', 'interactive_education_setup' );

/**
 * Enqueue scripts and styles.
 */
function interactive_education_scripts() {

	wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap.min.css' );
	if ( is_rtl() ){
		wp_enqueue_style( 'bootstrap-rtl', get_template_directory_uri() . '/assets/bootstrap/css/rtl/bootstrap.min.css' );
	}

	wp_enqueue_style( 'interactive-education-style', get_stylesheet_uri() );
	
	wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/font-awesome/css/all.min.css' );
	
	wp_enqueue_style( 'owl.carousel.css', get_template_directory_uri() . '/assets/css/owl.carousel.css' );
	wp_enqueue_style( 'interactive-education-blocks', get_template_directory_uri() . '/assets/css/blocks.min.css' );
	wp_enqueue_style( 'poppins-google-font', 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap', false );

	$scripts = array(
		array(
			'id'     => 'bootstrap',
			'url'    => get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js',
			'footer' => true
		),
		array(
			'id'     => 'owl.carousel.js',
			'url'    => get_template_directory_uri() . '/assets/js/owl.carousel.js',
			'footer' => true
		),
		array(
			'id'     => 'interactive-education-custom',
			'url'    => get_template_directory_uri() . '/assets/js/custom.js',
			'footer' => true
		)
	);

	interactive_education_add_scripts( $scripts );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'interactive_education_scripts' );

/**
* Add script
* 
* @since Interactive Education 1.0.0
*/
function interactive_education_add_scripts( $scripts ){
	foreach ( $scripts as $key => $value ) {
		wp_enqueue_script( $value['id'] , $value['url'] , array( 'jquery', 'jquery-masonry' ), 0.8, $value['footer'] );
	}
}

/**
 * Sanitizes Image Upload.
 *
 * @param string $input potentially dangerous data.
 */
function interactive_education_sanitize_image( $input ) {
	$filetype = wp_check_filetype( $input );
	if ( $filetype['ext'] && wp_ext2type( $filetype['ext'] ) === 'image' ) {
		return esc_url( $input );
	}
	return '';
}

/**
* Enqueue editor styles for Gutenberg
* 
* @since Interactive Education 1.0.0
*/
function interactive_education_block_editor_styles() {
	// Block styles.
	wp_enqueue_style( 'interactive-education-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks.min.css' ) );
}
add_action( 'enqueue_block_editor_assets', 'interactive_education_block_editor_styles' );

// Sanitization function to ensure it's an integer within the range
function interactive_education_sanitize_number( $input ) {
    $input = absint( $input ); // Convert to a non-negative integer
    return ( $input >= 1 && $input <= 6 ) ? $input : 1; // Return input if within range, or default to 1
}

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

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer/customizer.php';

/**
 * Dynamic CSS.
 */
require get_template_directory() . '/inc/customizer/loader.php';

/**
* GET START.
*/
require get_template_directory() . '/themeinfo/interactive_education_themeinfo_page.php';


// NOTICE FUNCTION
function interactive_education_activation_notice() {
    if (get_option('interactive_education_notice_dismissed')) {
        return;
    }

    if (isset($_GET['page']) && $_GET['page'] === 'interactive-education-themeinfo-page') {
        return;
    }
    ?>
    <div class="updated notice notice-theme-info-class is-dismissible" data-notice="theme_info">
        <div class="interactive-education-theme-info-notice clearfix">
            <div class="interactive-education-theme-notice-content">
                <h2 class="interactive-education-notice-h2">
                    <?php
                    printf(
                        /* translators: 1: Theme name */
                        esc_html__('Hello! Thank you for choosing our %1$s!', 'interactive-education'), '<strong>' . esc_html(wp_get_theme()->get('Name')) . '</strong>'
                    );
                    ?>
                </h2>
                <a class="interactive-education-btn-theme-info button button-primary" target="_blank" href="<?php echo esc_url(admin_url('themes.php?page=interactive-education-themeinfo-page')); ?>" id="interactive-education-themeinfo-button"> <?php esc_html_e('Interactive Education Theme Information', 'interactive-education') ?></a>
				<a class="interactive-education-btn-theme-info button button-primary" target="_blank" href="<?php echo esc_url(admin_url('themes.php?page=interactiveeducation-freedemocontent')); ?>" id="interactive-education-freedemocontent-button"> <?php esc_html_e('Free Demo Content', 'interactive-education') ?></a>
            </div>
        </div>
    </div>
    <?php
}

add_action('admin_notices', 'interactive_education_activation_notice');

add_action('wp_ajax_interactive_education_dismiss_notice', 'interactive_education_dismiss_notice');

function interactive_education_notice_status() {
    delete_option('interactive_education_notice_dismissed');
}
add_action('after_switch_theme', 'interactive_education_notice_status');

function interactive_education_dismiss_notice() {
    update_option('interactive_education_notice_dismissed', true);
    wp_send_json_success();
}

function interactive_education_admin_enqueue_scripts(){
	wp_enqueue_style('interactive-education-admin-style', esc_url( get_template_directory_uri() ) . '/assets/css/interactive-education-notice.css');
	wp_enqueue_script('interactive-education-dismiss-notice-script', get_stylesheet_directory_uri() . '/assets/js/interactive-education-notice.js', array('jquery'), null, true);
}
add_action( 'admin_enqueue_scripts', 'interactive_education_admin_enqueue_scripts' );