403Webshell
Server IP : 104.26.5.103  /  Your IP : 216.73.216.4
Web Server : nginx/1.27.1
System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : arabianexpress ( 1872)
PHP Version : 8.0.30
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /storage/v9321/buzzbitesv3/public_html/wp-content/plugins/trx_addons/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /storage/v9321/buzzbitesv3/public_html/wp-content/plugins//trx_addons/trx_addons.php
<?php
/*
Plugin Name: ThemeREX Addons
Plugin URI: http://themerex.net
Description: Add many widgets, shortcodes and custom post types for your theme
Version: 2.42.0
Author: ThemeREX
Author URI: http://themerex.net
Text Domain: trx_addons
Domain Path: /languages
*/

// Don't load directly
if ( ! defined( 'ABSPATH' ) ) exit;

// Current version
if ( ! defined( 'TRX_ADDONS_VERSION' ) ) define( 'TRX_ADDONS_VERSION', '2.42.0' );

// Hooks order for the plugin and theme on action 'after_setup_theme'
// 1 - plugin's components and/or theme register hooks for next filters
//     'trx_addons_filter_options' - to add/remove plugin's options
//     'trx_addons_addons_list' - to enable/disable plugin's addons
//     'trx_addons_cpt_list' - to enable/disable plugin's CPT
//     'trx_addons_sc_list' - to enable/disable plugin's shortcodes
//     'trx_addons_widgets_list' - to enable/disable plugin's widgets
// 3 - plugin do apply_filters('trx_addons_filter_options', $options) and load options
// 4 - plugin save options (if on the ThemeREX Addons Options page)
// 6 - plugin include components (shortcodes, widgets, CPT, etc.) filtered by theme hooks

// Plugin's storage
if ( ! defined('TRX_ADDONS_PLUGIN_DIR') )				define( 'TRX_ADDONS_PLUGIN_DIR',  plugin_dir_path( __FILE__ ) );
if ( ! defined('TRX_ADDONS_PLUGIN_URL') )				define( 'TRX_ADDONS_PLUGIN_URL',  plugin_dir_url( __FILE__ ) );
if ( ! defined('TRX_ADDONS_PLUGIN_BASE') )				define( 'TRX_ADDONS_PLUGIN_BASE', dirname( plugin_basename( __FILE__ ) ) );

if ( ! defined('TRX_ADDONS_PLUGIN_DIR_INCLUDES') )		define( 'TRX_ADDONS_PLUGIN_DIR_INCLUDES', TRX_ADDONS_PLUGIN_DIR . 'includes/' );
if ( ! defined('TRX_ADDONS_PLUGIN_DIR_CLASSES') )		define( 'TRX_ADDONS_PLUGIN_DIR_CLASSES', TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'classes/' );

// Pluggable components
if ( ! defined('TRX_ADDONS_PLUGIN_COMPONENTS') )		define( 'TRX_ADDONS_PLUGIN_COMPONENTS',		'components/' );
if ( ! defined('TRX_ADDONS_PLUGIN_DIR_COMPONENTS') )	define( 'TRX_ADDONS_PLUGIN_DIR_COMPONENTS', TRX_ADDONS_PLUGIN_DIR . TRX_ADDONS_PLUGIN_COMPONENTS );

// Theme-specific addons
if ( ! defined('TRX_ADDONS_PLUGIN_ADDONS') )			define( 'TRX_ADDONS_PLUGIN_ADDONS',		'addons/' );
if ( ! defined('TRX_ADDONS_PLUGIN_DIR_ADDONS') )		define( 'TRX_ADDONS_PLUGIN_DIR_ADDONS', TRX_ADDONS_PLUGIN_DIR . TRX_ADDONS_PLUGIN_ADDONS );

// Enqueue frontend scripts and styles priority
if ( ! defined( 'TRX_ADDONS_ENQUEUE_SCRIPTS_PRIORITY' ) ) define( 'TRX_ADDONS_ENQUEUE_SCRIPTS_PRIORITY', 20 );

// Enqueue responsive styles priority
if ( ! defined( 'TRX_ADDONS_ENQUEUE_RESPONSIVE_PRIORITY' ) ) define( 'TRX_ADDONS_ENQUEUE_RESPONSIVE_PRIORITY', 2000 );

// Expire time for uploaded and generated files
if ( ! defined( 'TRX_ADDONS_UPLOADED_EXPIRE_TIME' ) )	define( 'TRX_ADDONS_UPLOADED_EXPIRE_TIME', 60 );
if ( ! defined( 'TRX_ADDONS_GENERATED_EXPIRE_TIME' ) )	define( 'TRX_ADDONS_GENERATED_EXPIRE_TIME', 10 * 60 );

// Disable using class WP_Filesystem for regular file operations.
// Attention! WordPress is not recommended use this class for regular file operations.
// Below is a message from WordPress "Theme Check" plugin:
//    WP_Filesystem sould only be used for theme upgrade operations, not for all file operations.
//    Consider using file_get_contents(), scandir() or glob()
if ( ! defined( 'TRX_ADDONS_USE_WP_FILESYSTEM' ) )		 define( 'TRX_ADDONS_USE_WP_FILESYSTEM', false );

// Need to declare next var as global to compatibility with WP-CLI
if ( defined( 'WP_CLI' ) ) {
	global $TRX_ADDONS_STORAGE;
}
$TRX_ADDONS_STORAGE = array(
	// Plugin's custom post types
	'post_types' => array(),
	// Plugin's messages with last operation's result
	'admin_message' => array( 'error' => '', 'success' => ''),
	'front_message' => array( 'error' => '', 'success' => ''),
	// Data for output to the console
	'dump_data' => array(),
	// Arguments to register widgets
	'widgets_args' => array(
		'before_widget' => '<aside class="widget %2$s">',	// %1$s - id, %2$s - class
		'after_widget'  => '</aside>',
		'before_title'  => '<h5 class="widget_title">',
		'after_title'   => '</h5>',
	),
	// Responsive resolutions
	'responsive' => array(
		// By size
		'xxl'        => array(                'max' => 1679 ),
		'xl'         => array(                'max' => 1439 ),
		'lg'         => array(                'max' => 1279 ),
		'md_lg'      => array( 'min' =>  768, 'max' => 1279 ),
		'md_over'    => array( 'min' => 1024 ),
		'md'         => array(                'max' => 1023 ),
		'wp_fix'     => array( 'min' =>  601, 'max' =>  782 ),
		'sm'         => array(                'max' =>  767 ),
		'sm_wp'      => array(                'max' =>  600 ),
		'xs'         => array(                'max' =>  479 ),
		// By device
		'wide'       => array( 'min' => 2160 ),
		'desktop'    => array( 'min' => 1680, 'max' => 2159 ),
		'notebook'   => array( 'min' => 1280, 'max' => 1679 ),
		'not_tablet' => array( 'min' => 1280 ),
		'tablet'     => array( 'min' =>  768, 'max' => 1279 ),
		'not_mobile' => array( 'min' =>  768 ),
		'mobile'     => array(                'max' =>  767 ),
		'not_small'  => array( 'min' =>  480 ),
		'small'      => array(                'max' =>  479 ),
	),
	// Components
	'components_list' => array(),
	// Addons
	'addons_list'     => array(),
	// Shortcodes stack
	'sc_stack'        => array(),
	'sc_stack_data'   => array(),
	// Current page template
	'_wp_page_template' => '',
	// CSS and JS enqueue list
	'enqueue_list'    => array(),
	// Catch output sections
	'catch_output'    => array()
);


//-------------------------------------------------------
//-- Plugin init
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_activate' ) ) {
	/**
	 * Plugin activate hook: set a flag to detect a first run after activation
	 * 
	 * @hooked register_activation_hook
	 */
	register_activation_hook( __FILE__, 'trx_addons_activate' );
	function trx_addons_activate() {
		update_option( 'trx_addons_just_activated', 'yes' );
	}
}


if ( ! function_exists( 'trx_addons_role_and_caps_init' ) ) {
	/**
	 * Add user's roles and capabilities
	 * 
	 * @hooked init
	 */
	add_action( 'init', 'trx_addons_role_and_caps_init', 1 );
	function trx_addons_role_and_caps_init() {
		// Register user's roles once
		if ( (int) get_option( 'trx_addons_roles_and_caps_added' ) < 1 ) {
			do_action( 'trx_addons_action_add_roles_and_caps' );
			update_option( 'trx_addons_roles_and_caps_added', 1 );
		}
	}
}


if ( ! function_exists( 'trx_addons_role_and_caps_reset' ) ) {
	/**
	 * Reset user's roles and capabilities after the theme / skin switched
	 * 
	 * @hooked after_switch_theme
	 * @hooked {theme_slug}_action_skin_switched
	 * @hooked {theme_slug}_action_skin_updated
	 * 
	 * @param string $skin       Current skin slug
	 * @param string $skin_name  Current skin name
	 */
	add_action( 'after_switch_theme', 'trx_addons_role_and_caps_reset' );
	add_action( str_replace( '-', '_', get_template() ) . '_action_skin_switched', 'trx_addons_role_and_caps_reset', 10, 2 );
	add_action( str_replace( '-', '_', get_template() ) . '_action_skin_updated', 'trx_addons_role_and_caps_reset', 10, 2 );
	function trx_addons_role_and_caps_reset( $skin = '', $skin_name = '' ) {
		delete_option( 'trx_addons_roles_and_caps_added' );
	}
}


if ( ! function_exists( 'trx_addons_role_and_caps_reset2' ) ) {
	/**
	 * Reset user's roles and capabilities after the theme updated
	 * 
	 * @hooked admin_init
	 */
	add_action( 'admin_init', 'trx_addons_role_and_caps_reset2' );
	function trx_addons_role_and_caps_reset2() {
		if ( ! wp_doing_ajax() ) {
			$theme_slug  = get_template();
			$cur_version = get_option( $theme_slug . '_theme_version' );
			if ( ! empty( $cur_version ) ) {
				$theme   = wp_get_theme( $theme_slug );
				$version = $theme->get( 'Version' );
				if ( ! empty( $version ) && $cur_version != $version ) {
					trx_addons_role_and_caps_reset();
				}
			}
		}
	}
}


if ( ! function_exists( 'trx_addons_get_thumb_sizes' ) ) {
	/**
	 * Return a list with plugin-specific thumb sizes
	 * 
	 * @return array  An array with thumb sizes
	 */
	function trx_addons_get_thumb_sizes() {
		return apply_filters('trx_addons_filter_add_thumb_sizes', array(
			'trx_addons-thumb-huge'			=> array(1170,658, true),
			'trx_addons-thumb-big'			=> array(760, 428, true),
			'trx_addons-thumb-medium'		=> array(370, 208, true),
			'trx_addons-thumb-small'		=> array(270, 152, true),
			'trx_addons-thumb-portrait'		=> array(370, 493, true),
			'trx_addons-thumb-avatar'		=> array(370, 370, true),
			'trx_addons-thumb-tiny'			=> array( 75,  75, true),
			'trx_addons-thumb-masonry-big'	=> array(760,   0, false),	// Only downscale, not crop
			'trx_addons-thumb-masonry'		=> array(370,   0, false)	// Only downscale, not crop
			)
		);
	}
}


if ( ! function_exists( 'trx_addons_init' ) ) {
	/**
	 * Plugin init (after init custom post types and after all other plugins)
	 * 
	 * @hooked init, 11
	 */
	add_action( 'init', 'trx_addons_init', 11 );
	function trx_addons_init() {
		// Add thumb sizes
		$thumb_sizes = trx_addons_get_thumb_sizes();
		$mult = trx_addons_get_option('retina_ready', 1);
		foreach ($thumb_sizes as $k=>$v) {
			// Add Original dimensions
			add_image_size( $k, $v[0], $v[1], $v[2]);
			// Add Retina dimensions
			if ($mult > 1) add_image_size( $k.'-@retina', $v[0]*$mult, $v[1]*$mult, $v[2]);
		}

		// If this is first run
		if ( get_option( 'trx_addons_just_activated' ) == 'yes' ) {
			do_action( 'trx_addons_first_run' );
			update_option( 'trx_addons_just_activated', 'no' );
		}
	}
}

if ( ! function_exists('trx_addons_flush_rewrite_rules') ) {
	/**
	 * Flush rewrite rules on first run after plugin activation.
	 * 
	 * @hooked trx_addons_first_run
	 */
	add_action( 'trx_addons_first_run', 'trx_addons_flush_rewrite_rules' );
	function trx_addons_flush_rewrite_rules() {
		flush_rewrite_rules();
	}
}

if ( ! function_exists('trx_addons_check_rewrite_rules') ) {
	/**
	 * Check rewrite rules on init and flush if needed.
	 * May be needed when rewrite rules was flushed by other plugin on the same hook with lower priority.
	 * For example, 'Give' plugin sometimes does it on priority 1.
	 * 
	 * @hooked init, 12
	 */
	add_action( 'init', 'trx_addons_check_rewrite_rules', 12 );
	function trx_addons_check_rewrite_rules() {
		global $TRX_ADDONS_STORAGE;
		$rules = get_option( 'rewrite_rules' );
		if ( is_array( $rules ) && is_array( $TRX_ADDONS_STORAGE['cpt_list'] ) && count( $TRX_ADDONS_STORAGE['cpt_list'] ) > 0 ) {
			$need_flush = false;
			foreach ( $TRX_ADDONS_STORAGE['cpt_list'] as $cpt => $params ) {
				if ( ! empty( $params['post_type_slug'] ) && trx_addons_components_is_allowed( 'cpt', $cpt ) && trx_addons_is_off( trx_addons_get_option( $cpt . '_disable', 0, false ) ) ) {
					if ( ! isset( $rules[ $params['post_type_slug'] . '/[^/]+/attachment/([^/]+)/?$' ] ) ) {
						$found = false;
						foreach( $rules as $rule => $rewrite ) {
							if ( strpos( $rule, $params['post_type_slug'] . '/' ) === 0 ) {
								$found = true;
								break;
							}
						}
						if ( ! $found ) {
							$need_flush = true;
							break;
						}
					}
				}
			}
			if ( $need_flush ) {
				flush_rewrite_rules();
			}
		}
	}
}


//-------------------------------------------------------
//-- Featured images
//-------------------------------------------------------

if ( ! function_exists('trx_addons_image_sizes') ) {
	/**
	 * Add plugin-specific thumb sizes to the list in Media Settings
	 * 
	 * @hooked image_size_names_choose
	 * 
	 * @param array $sizes  An array with thumb sizes
	 * 
	 * @return array        A modified array with thumb sizes
	 */
	add_filter( 'image_size_names_choose', 'trx_addons_image_sizes' );
	function trx_addons_image_sizes( $sizes ) {
		$thumb_sizes = apply_filters('trx_addons_filter_add_thumb_names', array(
			'trx_addons-thumb-big'		=> esc_html__( 'Large image', 'trx_addons' ),
			'trx_addons-thumb-medium'	=> esc_html__( 'Medium image', 'trx_addons' ),
			'trx_addons-thumb-small'	=> esc_html__( 'Small image', 'trx_addons' ),
			'trx_addons-thumb-portrait'	=> esc_html__( 'Portrait', 'trx_addons' ),
			'trx_addons-thumb-avatar'	=> esc_html__( 'Big square avatar', 'trx_addons' ),
			'trx_addons-thumb-tiny'		=> esc_html__( 'Small square avatar', 'trx_addons' ),
			'trx_addons-thumb-masonry'	=> esc_html__( 'Masonry (scaled)', 'trx_addons' )
			)
		);
		$mult = trx_addons_get_option('retina_ready', 1);
		foreach($thumb_sizes as $k=>$v) {
			$sizes[$k] = $v;
			if ($mult > 1) $sizes[$k.'-@retina'] = $v.' '.esc_html__('@2x', 'trx_addons' );
		}
		return $sizes;
	}
}


//-------------------------------------------------------
//-- Body classes
//-------------------------------------------------------

if ( ! function_exists('trx_addons_add_body_classes') ) {
	/**
	 * Add plugin-specific classes to the body tag:
	 * - 'hide_fixed_rows_enabled' - if the option 'hide_fixed_rows' is enabled
	 * - 'trx_addons_customizable_theme' - if the current theme supports the shortcodes customization in Elementor
	 * 
	 * @hooked body_class
	 * 
	 * @param array $classes  An array with body classes
	 * 
	 * @return array          A modified array with body classes
	 */
	add_filter( 'body_class', 'trx_addons_add_body_classes' );
	function trx_addons_add_body_classes( $classes ) {
		if ( (int) trx_addons_get_option('hide_fixed_rows') > 0 ) {
			$classes[] = 'hide_fixed_rows_enabled';
		}
		if ( apply_filters( 'trx_addons_filter_allow_sc_styles_in_elementor', false, 'body_classes' ) ) {
			$classes[] = 'trx_addons_customizable_theme';
		}

		return $classes;
	}
}


//-------------------------------------------------------
//-- Load scripts and styles
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_safari_to_top' ) ) {
	/**
	 * Add a <script> to redirect browser 'Safari mobile' from iframe-version to the whole page version
	 * because it incorrectly detect height of the window in the iframe
	 * 
	 * @hooked wp_head
	 */
	add_action('wp_head', 'trx_addons_safari_to_top', 0);
	function trx_addons_safari_to_top() {
		if ( wp_is_mobile() ) {	// && isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'themeforest')) {
			?><script>navigator.userAgent.match(/iPad|iPhone|iPod/i) != null && window.name != '' && top.location != window.location && (top.location.href = window.location.href);</script><?php
		}
	}
}

	
if ( ! function_exists( 'trx_addons_load_scripts_external' ) ) {
	/**
	 * Load required styles and scripts to the frontend
	 * 
	 * @hooked wp_enqueue_scripts
	 */
	add_action("wp_enqueue_scripts", 'trx_addons_load_scripts_external');
	function trx_addons_load_scripts_external() {
		// Load Popup script and styles
		trx_addons_enqueue_popup();
		// TweenMax library
		if ( trx_addons_get_option( 'smooth_scroll' ) || apply_filters( 'trx_addons_filter_load_tweenmax', false ) ) {
			trx_addons_enqueue_tweenmax( array(
				'ScrollTo' => trx_addons_get_option( 'smooth_scroll' ),
			) );
		}
	}
}

if ( ! function_exists( 'trx_addons_load_frontend_scripts' ) ) {
	/**
	 * Add styles to the list to future load
	 * 
	 * @hooked trx_addons_action_load_scripts_front
	 * 
	 * @trigger trx_addons_action_load_scripts_front_{$slug}
	 * 
	 * @param bool   $force  Optional. If true - load scripts/styles immediately
	 * @param string $slug   Optional. A slug to identify the scripts/styles set
	 * @param int    $value  Optional. A value to identify the scripts/styles set
	 */
	add_action( 'trx_addons_action_load_scripts_front', 'trx_addons_load_frontend_scripts', 1, 3 );
	function trx_addons_load_frontend_scripts( $force = false, $slug = '', $value = 1 ) {
		global $TRX_ADDONS_STORAGE;
		$slug = str_replace( '-', '_', $slug );
		$TRX_ADDONS_STORAGE['enqueue_list'][$slug] = $value;
		do_action( "trx_addons_action_load_scripts_front_{$slug}", $force );
	}
}

if ( ! function_exists( 'trx_addons_need_frontend_scripts' ) ) {
	/**
	 * Check if need to load script or style
	 * 
	 * @param string $slug   A slug to identify the scripts/styles set
	 * @param int    $value  Optional. A value to identify the scripts/styles set
	 * 
	 * @return bool          true if need to load styles/scripts
	 */
	function trx_addons_need_frontend_scripts( $slug, $value = 1 ) {
		global $TRX_ADDONS_STORAGE;
		$slug = str_replace( '-', '_', $slug );
		return isset( $TRX_ADDONS_STORAGE['enqueue_list'][$slug] ) && $TRX_ADDONS_STORAGE['enqueue_list'][$slug] == $value;
	}
}

if ( ! function_exists( 'trx_addons_load_icons_front' ) ) {
	/**
	 * Load a font with icons. Font with icons must be loaded before main stylesheet
	 * 
	 * @hooked wp_enqueue_scripts, 0
	 */
	add_action("wp_enqueue_scripts", 'trx_addons_load_icons_front', 0);
	function trx_addons_load_icons_front() {
		wp_enqueue_style( 'trx_addons-icons', trx_addons_get_file_url('css/font-icons/css/trx_addons_icons.css'), array(), null );
	}
}


if ( ! function_exists( 'trx_addons_load_scripts_front' ) ) {
	/**
	 * Load required styles and scripts to the frontend
	 * 
	 * @hooked wp_enqueue_scripts, TRX_ADDONS_ENQUEUE_SCRIPTS_PRIORITY
	 */
	add_action("wp_enqueue_scripts", 'trx_addons_load_scripts_front', TRX_ADDONS_ENQUEUE_SCRIPTS_PRIORITY);
	function trx_addons_load_scripts_front() {

		// If 'debug_mode' is off - load merged styles and scripts
		if ( trx_addons_is_off(trx_addons_get_option('debug_mode')) ) {
			wp_enqueue_style( 'trx_addons', trx_addons_get_file_url('css/__styles' . ( trx_addons_is_preview() || trx_addons_is_off( trx_addons_get_option( 'optimize_css_and_js_loading' ) ) ? '-full' : '' ) . '.css'), array(), null );
			wp_enqueue_script( 'trx_addons', trx_addons_get_file_url('js/__scripts' . ( trx_addons_is_preview() || trx_addons_is_off( trx_addons_get_option( 'optimize_css_and_js_loading' ) ) ? '-full' : '' ) . '.js'), apply_filters( 'trx_addons_filter_script_deps', array('jquery') ), null, true );

		// else load all scripts separate
		} else {
			wp_enqueue_style( 'trx_addons', trx_addons_get_file_url('css/trx_addons.front.css'), array(), null );
			wp_enqueue_style( 'trx_addons-hovers', trx_addons_get_file_url('css/trx_addons.hovers.css'), array(), null );
			wp_enqueue_script( 'trx_addons-utils', trx_addons_get_file_url('js/trx_addons.utils.js'), array('jquery'), null, true );
			wp_enqueue_script( 'trx_addons', trx_addons_get_file_url('js/trx_addons.front.js'), array('jquery'), null, true );
		}

		// Conditions to load animations.css
		if ( ! apply_filters( 'trx_addons_filter_disable_load_animation', false ) && ( ! wp_is_mobile() || ! apply_filters( 'trx_addons_filter_disable_animation_on_mobile', false ) ) ) {
			wp_enqueue_style( 'trx_addons-animations',	trx_addons_get_file_url('css/trx_addons.animations.css'), array(), null );
		}
	}
}

if ( ! function_exists( 'trx_addons_load_scripts_responsive' ) ) {
	/**
	 * Load responsive styles to the frontend
	 * 
	 * @hooked wp_enqueue_scripts, TRX_ADDONS_ENQUEUE_RESPONSIVE_PRIORITY
	 */
	add_action('wp_enqueue_scripts', 'trx_addons_load_scripts_responsive', TRX_ADDONS_ENQUEUE_RESPONSIVE_PRIORITY);
	function trx_addons_load_scripts_responsive() {
		// If 'debug_mode' is off - load merged styles and scripts
		if ( trx_addons_is_off(trx_addons_get_option('debug_mode')) ) {
			wp_enqueue_style( 
				'trx_addons-responsive', 
				trx_addons_get_file_url('css/__responsive' . ( trx_addons_is_preview() || trx_addons_is_off( trx_addons_get_option( 'optimize_css_and_js_loading' ) ) ? '-full' : '' ) . '.css'),
				array(),
				null,
				trx_addons_media_for_load_css_responsive( 'main', 'xl' )
			);
		} else {
			wp_enqueue_style(
				'trx_addons-responsive', 
				trx_addons_get_file_url('css/trx_addons.responsive.css'), 
				array(), 
				null, 
				trx_addons_media_for_load_css_responsive( 'main', 'xl' )
			);
		}
	}
}

if ( ! function_exists( 'trx_addons_media_for_load_css_responsive' ) ) {
	/**
	 * Return the attribute @media for loaded responsive CSS
	 * 
	 * @param string $slug   A slug to identify the responsive css-file
	 * @param string $media  A media descriptor to detect the @media condition
	 * 
	 * @return string        A @media condition
	 */
	function trx_addons_media_for_load_css_responsive( $slug = 'main', $media = 'all' ) {
		global $TRX_ADDONS_STORAGE;
		$condition = 'all';
		$media = apply_filters( 'trx_addons_filter_media_for_load_css_responsive', $media, $slug );
		if ( ! empty( $TRX_ADDONS_STORAGE['responsive'][ $media ]['max'] ) ) {
			$condition = sprintf( '(max-width:%dpx)', $TRX_ADDONS_STORAGE['responsive'][ $media ]['max'] );
		} 
		return apply_filters( 'trx_addons_filter_condition_for_load_css_responsive', $condition, $slug );
	}
}

if ( ! function_exists( 'trx_addons_media_for_load_css_responsive_callback' ) ) {
	add_filter( 'trx_addons_filter_media_for_load_css_responsive', 'trx_addons_media_for_load_css_responsive_callback', 10, 2 );
	/**
	 * Return a maximum 'media' slug to use as a default value for all responsive css-files
	 * (if corresponding media is not detected by a specified slug).
	 *
	 * Hooks: add_filter( 'trx_addons_filter_media_for_load_css_responsive', 'trx_addons_media_for_load_css_responsive_callback', 10, 2 );
	 *
	 * @param string $media  A current media descriptor.
	 * @param string $slug   A current slug to detect a media descriptor. Not used in this function.
	 *
	 * @return string        A default media descriptor, if media stay equal to 'all' after all previous hooks.
	 */
	function trx_addons_media_for_load_css_responsive_callback( $media, $slug ) {
		return 'all' == $media ? 'xxl' : $media;
	}
}

if ( ! function_exists( 'trx_addons_localize_scripts_front' ) ) {
	/**
	 * Add js variables to the frontend (localizetion of the script)
	 * 
	 * @hooked wp_footer
	 */
	add_action("wp_footer", 'trx_addons_localize_scripts_front');
	function trx_addons_localize_scripts_front() {
		wp_localize_script( 'trx_addons', 'TRX_ADDONS_STORAGE', apply_filters('trx_addons_filter_localize_script', array(
			'admin_mode' => false,
			// AJAX parameters
			'ajax_url'	=> esc_url(admin_url('admin-ajax.php')),
			'ajax_nonce'=> esc_attr(wp_create_nonce(admin_url('admin-ajax.php'))),
			// REST API url
			'rest_url'  => esc_url(get_rest_url()),
			// Site base url
			'site_url'	=> esc_url( home_url() ),
			// Plugin base url
			'plugin_url'=> TRX_ADDONS_PLUGIN_URL,
			// Is single page/post
			'post_id' => get_the_ID(),
			// VC frontend edit mode
			'vc_edit_mode'	=> function_exists('trx_addons_vc_is_frontend') && trx_addons_vc_is_frontend(),
			// Is preview mode
			'is_preview'	=> trx_addons_is_preview(),
			'is_preview_gb'	=> trx_addons_is_preview( 'gutenberg' ),
			'is_preview_elm'=> trx_addons_is_preview( 'elementor' ),
			// No image placeholder
			'no_image' => trx_addons_get_no_image(),
			// Popup engine
			'popup_engine'=> trx_addons_get_option('popup_engine'),
			// Show scroll progress
			'scroll_progress' => trx_addons_is_singular( 'post' ) ? trx_addons_get_option('scroll_progress') : 'hide',
			// Hide fixed rows on scroll down
			'hide_fixed_rows' => trx_addons_get_option('hide_fixed_rows'),
			// Smooth scroll
			'smooth_scroll' => trx_addons_get_option( 'smooth_scroll' ) && ! trx_addons_is_preview(),
			// Animate to the inner links
			'animate_inner_links' => trx_addons_get_option('animate_inner_links'),
			// Animations on mobile
			'disable_animation_on_mobile' => apply_filters( 'trx_addons_filter_disable_animation_on_mobile', true ),
			// Open external links in a new window
			'add_target_blank' => trx_addons_get_option('add_target_blank'),
			// Use menu collapse
			'menu_collapse' => trx_addons_get_option( 'menu_collapse', 1 ),
			'menu_collapse_icon' => trx_addons_get_option( 'menu_collapse_icon', 'trx_addons_icon-ellipsis-vert' ),
			// Stretch menu layouts
			'menu_stretch' => trx_addons_get_option( 'menu_stretch', 0 ),
			// Resize video and iframe
			'resize_tag_video' => false,
			'resize_tag_iframe' => true,
			// Allow to set cookie when a retina is detected
			'allow_cookie_is_retina' => apply_filters( 'trx_addons_filter_allow_cookie_is_retina', (int)trx_addons_get_option( 'retina_ready', 1 ) > 1 ),
			// Mediaelement player icon selector allowed
			'mediaplayer_icons_selector_allowed' => trx_addons_mediaplayer_icons_selector_allowed(),
			// User logged in
			'user_logged_in' => is_user_logged_in(),
			// Current theme slug
			'theme_slug' => get_template(),
			// Theme  colors
			'theme_bg_color' => apply_filters('trx_addons_filter_get_theme_bg_color', ''),
			'theme_accent_color' => apply_filters('trx_addons_filter_get_theme_accent_color', '#efa758'),
			// Theme-specific page wrap class
			'page_wrap_class'    => trim( trx_addons_get_option('page_wrap_class') )    !== '' ? trx_addons_get_option('page_wrap_class')    : '.page_wrap',
			'header_wrap_class'  => trim( trx_addons_get_option('header_wrap_class') )  !== '' ? trx_addons_get_option('header_wrap_class')  : '.top_panel',
			'footer_wrap_class'  => trim( trx_addons_get_option('footer_wrap_class') )  !== '' ? trx_addons_get_option('footer_wrap_class')  : '.footer_wrap',
			'sidebar_wrap_class' => trim( trx_addons_get_option('sidebar_wrap_class') ) !== '' ? trx_addons_get_option('sidebar_wrap_class') : '.sidebar',
			// Columns class template
			'columns_wrap_class' => trx_addons_get_columns_wrap_class(),
			'columns_in_single_row_class' => 'columns_in_single_row',
			'column_class_template' => trx_addons_get_column_class_template(),
			// Loading layout
			'loading_layout' => trx_addons_loading_layout( array( 'echo' => false ) ),
			// E-mail mask to validate forms
			'email_mask' => '^([a-zA-Z0-9_\\-]+\\.)*[a-zA-Z0-9_\\-]+@[a-zA-Z0-9_\\-]+(\\.[a-zA-Z0-9_\\-]+)*\\.[a-zA-Z0-9]{2,12}$',
			// Mobile breakpoints for JS (if window width less then)
			'mobile_breakpoint_fixedrows_off' => 768,
			'mobile_breakpoint_fixedcolumns_off' => 768,
			'mobile_breakpoint_stacksections_off' => 768,
			'mobile_breakpoint_scroll_lag_off' => 0,	//768,
			'mobile_breakpoint_fullheight_off' => 1025,
			'mobile_breakpoint_mousehelper_off' => 1025,

			// JS Messages for translation
			'msg_caption_yes'           => addslashes(esc_html__( 'Yes', 'trx_addons' )),
			'msg_caption_no'            => addslashes(esc_html__( 'No', 'trx_addons' )),
			'msg_caption_ok'            => addslashes(esc_html__( 'OK', 'trx_addons' )),
			'msg_caption_accept'        => addslashes(esc_html__( 'Accept', 'trx_addons' )),
			'msg_caption_apply'         => addslashes(esc_html__( 'Apply', 'trx_addons' )),
			'msg_caption_cancel'        => addslashes(esc_html__( 'Cancel', 'trx_addons' )),
			'msg_caption_attention'     => addslashes(esc_html__( 'Attention!', 'trx_addons' )),
			'msg_caption_warning'       => addslashes(esc_html__( 'Warning!', 'trx_addons' )),
			'msg_ajax_error'			=> addslashes(esc_html__('Invalid server answer!', 'trx_addons')),
			'msg_magnific_loading'		=> addslashes(esc_html__('Loading image', 'trx_addons')),
			'msg_magnific_error'		=> addslashes(esc_html__('Error loading image', 'trx_addons')),
			'msg_magnific_close'		=> addslashes(esc_html__('Close (Esc)', 'trx_addons')),
			'msg_error_like'			=> addslashes(esc_html__('Error saving your like! Please, try again later.', 'trx_addons')),
			'msg_field_name_empty'		=> addslashes(esc_html__("The name can't be empty", 'trx_addons')),
			'msg_field_email_empty'		=> addslashes(esc_html__('Too short (or empty) email address', 'trx_addons')),
			'msg_field_email_not_valid'	=> addslashes(esc_html__('Invalid email address', 'trx_addons')),
			'msg_field_text_empty'		=> addslashes(esc_html__("The message text can't be empty", 'trx_addons')),
			'msg_search_error'			=> addslashes(esc_html__('Search error! Try again later.', 'trx_addons')),
			'msg_send_complete'			=> addslashes(esc_html__("Send message complete!", 'trx_addons')),
			'msg_send_error'			=> addslashes(esc_html__('Transmit failed!', 'trx_addons')),
			'msg_validation_error'		=> addslashes(esc_html__('Error data validation!', 'trx_addons')),
			'msg_name_empty' 			=> addslashes(esc_html__("The name can't be empty", 'trx_addons')),
			'msg_name_long'				=> addslashes(esc_html__('Too long name', 'trx_addons')),
			'msg_email_empty'			=> addslashes(esc_html__('Too short (or empty) email address', 'trx_addons')),
			'msg_email_long'			=> addslashes(esc_html__('Too long email address', 'trx_addons')),
			'msg_email_not_valid'		=> addslashes(esc_html__('Invalid email address', 'trx_addons')),
			'msg_text_empty'			=> addslashes(esc_html__("The message text can't be empty", 'trx_addons')),
			'msg_copied'				=> addslashes(esc_html__("Copied!", 'trx_addons')),
		) ) );
	}
}

if ( ! function_exists( 'trx_addons_reorder_scripts' ) ) {
	/**
	 * Reorder plugin-specific scripts - put all our scripts after the script with the slug 'trx_addons'.
	 * Call after 'trx_addons_action_check_page_content' on priority 18
	 * Call before 'wp_print_footer_scripts' on priority 20
	 * 
	 * @hooked wp_footer, 19
	 */
	add_action( 'wp_footer', 'trx_addons_reorder_scripts', 19 );
	function trx_addons_reorder_scripts() {
		global $wp_scripts;
		if ( ! empty( $wp_scripts->queue ) && is_array( $wp_scripts->queue ) 
			&& ! empty( $wp_scripts->registered ) && is_array( $wp_scripts->registered )
		) {
			$our = array();
			$queue = array();
			$start = false;
			foreach ( $wp_scripts->registered as $slug => $data ) {
				if ( $start && ! empty( $wp_scripts->registered[$slug] ) ) {
					if ( ! empty( $data->src ) && is_string( $data->src ) && strpos( strtolower( $data->src ), 'trx_addons' ) > 0 ) {
						$our[ $slug ] = $data;
						unset( $wp_scripts->registered[ $slug ] );
						foreach( $wp_scripts->queue as $k => $v ) {
							if ( $v == $slug ) {
								$queue[] = $slug;
								unset( $wp_scripts->queue[ $k ] );
							}
						}
					}
				} if ( $slug == 'trx_addons' ) {
					$start = true;
				}
			}
			if ( count( $our ) > 0 ) {
				if ( isset( $wp_scripts->registered['trx_addons'] ) ) {
					trx_addons_array_insert_after( $wp_scripts->registered, 'trx_addons', $our );
				} else {
					$wp_scripts->registered = trx_addons_array_merge( $wp_scripts->registered, $our );
				}
			}
			if ( count( $queue ) > 0 ) {
				$found = false;
				foreach( $wp_scripts->queue as $k => $v ) {
					if ( $v == 'trx_addons' ) {
						trx_addons_array_insert_after( $wp_scripts->queue, $k, $queue );
						$found = true;
						break;
					}
				}
				if ( ! $found ) {
					$wp_scripts->queue = array_merge( $wp_scripts->queue, $queue );
				}
			}
		}
	}
}


if ( ! function_exists( 'trx_addons_move_scripts_down' ) ) {
	/**
	 * Move other scripts to the footer
	 * 
	 * @hooked wp_enqueue_scripts, 9999
	 * 
	 * @trigger trx_addons_filter_skip_move_scripts_down
	 * 
	 * @param string $src  Source URL of the enqueued script
	 */
	add_action( 'wp_enqueue_scripts', 'trx_addons_move_scripts_down', 9999 );
	function trx_addons_move_scripts_down( $src ) {
		global $wp_scripts;
		if ( trx_addons_is_on( trx_addons_get_option( 'move_scripts_to_footer' ) )
			&& ! empty( $wp_scripts->queue ) && is_array( $wp_scripts->queue ) 
			&& ! empty( $wp_scripts->registered ) && is_array( $wp_scripts->registered )
		) {
			$skip_list = array_merge(
							apply_filters( 'trx_addons_filter_skip_move_scripts_down',
								array(
									'modernizr',
									'jquery.js',
									'jquery.min.js',
									'jquery-migrate',
									'core.js',
									'core.min.js',
									'underscore',
									'wp-polyfill',
									'wp-backbone',
									'wp-util',
									'dom-ready',
									'i18n',
									'a11y',
									'js/dist',
									'tweenmax',
									'gsap',
									'tinymce',
									)
							),
							array_map( 'trim', explode( ',', trx_addons_get_option('move_scripts_to_footer_exclude') ) )
						);
			foreach ( $wp_scripts->registered as $slug => $data ) {
				if ( ! empty( $wp_scripts->registered[$slug] ) ) {
					if ( trx_addons_is_on( trx_addons_get_option( 'remove_ver_from_url' ) )
						&& isset( $wp_scripts->registered[$slug]->ver )
					) {
						$wp_scripts->registered[$slug]->ver = null;
					}
					$skip = false;
					foreach ( $skip_list as $s ) {
						if ( empty( $s ) ) continue;
						if ( strpos( strtolower( $slug ), $s ) === 0 || ( !empty( $data->src ) && is_string( $data->src ) && strpos( strtolower( $data->src ), $s ) > 0 ) ) {
							$skip = true;
							break;
						}
					}
					if ( ! $skip ) {
						if ( empty( $wp_scripts->registered[$slug]->extra ) ) {
							$wp_scripts->registered[$slug]->extra = array( 'group' => 1 );
						} else {	// if (empty($wp_scripts->registered[$slug]->extra['group'])) {
							$wp_scripts->registered[$slug]->extra['group'] = 1;
						}
					}
				}
			}
		}
	}
}


if ( ! function_exists( 'trx_addons_async_scripts_load' ) ) {
	/**
	 * Add the attribute 'defer' to the scripts
	 * 
	 * @hooked script_loader_tag, 9999
	 * 
	 * @param string $tag   HTML tag of the enqueued script
	 * @param string $slug  Slug of the enqueued script
	 * 
	 * @return string       Modified HTML tag of the enqueued script
	 */
	add_filter( 'script_loader_tag', 'trx_addons_async_scripts_load', 9999, 2 );
	function trx_addons_async_scripts_load( $tag, $slug ) {
		global $wp_scripts;
		if ( trx_addons_is_on( trx_addons_get_option('async_scripts_load') )
			&& ! is_admin()
			&& ! is_customize_preview()
			&& ! empty($wp_scripts->queue) && is_array($wp_scripts->queue) 
			&& ! empty($wp_scripts->registered) && is_array($wp_scripts->registered)
		) {
			$skip_list = array_merge(
							apply_filters( 'trx_addons_filter_skip_async_scripts_load',
								array(
									'modernizr',
									'jquery.js',
									'jquery.min.js',
									'jquery-migrate',
									'core.js',
									'core.min.js',
									'underscore',
									'wp-polyfill',
									'wp-backbone',
									'wp-util',
									'dom-ready',
									'i18n',
									'a11y',
									'js/dist',
									'tweenmax',
									'gsap',
									'tinymce',
									)
							),
							array_map( 'trim', explode( ',', trx_addons_get_option('async_scripts_exclude') ) )
						);
			$skip = false;
			foreach ($skip_list as $s) {
				if ( empty( $s ) ) continue;
				if ( strpos( strtolower( $slug ), $s ) === 0 || ( !empty( $wp_scripts->registered[$slug]->src ) && is_string( $wp_scripts->registered[$slug]->src ) && strpos( strtolower( $wp_scripts->registered[$slug]->src ), $s ) > 0 ) ) {
					$skip = true;
					break;
				}
			}
			if ( $skip ) {
				// Remove param 'defer'
				$tag = str_replace( array( 'defer="defer"', 'defer' ), '', $tag );
			} else if ( strpos( $tag, 'defer' ) === false ) {
				// Add param 'defer'
				$tag = str_replace( ' src', ' defer="defer" src', $tag );
			}
		}
		return $tag;
	}
}

if ( ! function_exists( 'trx_addons_remove_version' ) ) {
	/**
	 * Remove WordPress version parameter from styles and scripts
	 * 
	 * @hooked style_loader_src, 9999
	 * @hooked script_loader_src, 9999
	 * 
	 * @param string $src  Source URL of the enqueued style or script
	 * 
	 * @return string      Modified source URL of the enqueued style or script
	 */
	add_filter( 'style_loader_src', 'trx_addons_remove_version', 9999 );
	add_filter( 'script_loader_src', 'trx_addons_remove_version', 9999 );
	function trx_addons_remove_version( $src ) {
		if ( trx_addons_is_on( trx_addons_get_option( 'remove_ver_from_url' ) ) && ! is_admin() && strpos( $src, 'ver=' ) ) {
			$src = remove_query_arg( 'ver', $src );
		}
		return $src;
	}
}

if ( ! function_exists( 'trx_addons_disable_cache_in_the_debug_mode' ) ) {
	/**
	 * Disable a cache for scripts and styles in the debug mode - add random param to the URL
	 * 
	 * @hooked style_loader_src, 9999
	 * @hooked script_loader_src, 9999
	 * 
	 * @param string $src  Source URL of the enqueued style or script
	 * 
	 * @return string      Modified source URL of the enqueued style or script
	 */
	add_filter( 'style_loader_src', 'trx_addons_disable_cache_in_the_debug_mode', 9999 );
	add_filter( 'script_loader_src', 'trx_addons_disable_cache_in_the_debug_mode', 9999 );
	function trx_addons_disable_cache_in_the_debug_mode( $src ) {
		if ( trx_addons_is_on( trx_addons_get_option( 'disable_css_and_js_cache' ) )
				&& trx_addons_is_on( trx_addons_get_option( 'debug_mode' ) )
// Uncomment if not need to disable cache for the admin mode
//				&& ! is_admin()
				&& ( strpos( $src, 'trx_addons/' ) !== false
					|| strpos( $src, trailingslashit( get_stylesheet() ) ) !== false
					|| strpos( $src, trailingslashit( get_template() ) ) !== false
				)
		) {
			$src = add_query_arg( 'reload', mt_rand(), $src );
		}
		return $src;
	}
}


//-----------------------------------------
//--  Merge JS and CSS
//-----------------------------------------

if ( ! function_exists( 'trx_addons_itself_activated' ) ) {
	/**
	 * Plugin 'trx_addons' activation hook - regenerate merged files on first run
	 * 
	 * @hooked register_activation_hook
	 * 
	 * @trigger trx_addons_filter_regenerate_merged_files_after_activate_trx_addons
	 */
	register_activation_hook( __FILE__, 'trx_addons_itself_activated' );
	function trx_addons_itself_activated() {
		// Set this flag to regenerate styles and scripts on first run
		if ( apply_filters( 'trx_addons_filter_regenerate_merged_files_after_activate_trx_addons', true ) ) {
			trx_addons_merge_styles_schedule();
		}
	}
}

if ( ! function_exists( 'trx_addons_any_plugin_change_state' ) ) {
	/**
	 * Any plugin activated/deactivated - regenerate merged files on next load
	 * 
	 * @hooked activated_plugin
	 * @hooked deactivated_plugin
	 * 
	 * @trigger trx_addons_filter_regenerate_merged_files_after_activate_plugins
	 * 
	 * @param string $plugin                 A plugin slug
	 * @param bool   $network_activation     true if plugin is activated network wide
	 */
	add_action( 'activated_plugin', 'trx_addons_any_plugin_change_state', 10, 2 );
	add_action( 'deactivated_plugin', 'trx_addons_any_plugin_change_state', 10, 2 );
	function trx_addons_any_plugin_change_state( $plugin, $network_activation ) {
		// Set this flag to regenerate styles and scripts on first run
		if ( apply_filters( 'trx_addons_filter_regenerate_merged_files_after_activate_plugins', true ) ) {
			trx_addons_merge_styles_schedule();
		}
	}
}

if ( ! function_exists( 'trx_addons_update' ) ) {
	/**
	 * A plugin or a theme was updated via core update screen - regenerate merged files on next load
	 * 
	 * @hooked upgrader_process_complete
	 * 
	 * @trigger trx_addons_filter_regenerate_merged_files_after_update_trx_addons
	 * @trigger trx_addons_filter_regenerate_merged_files_after_update_theme
	 * 
	 * @param object $upgrader      An upgrader object
	 * @param array  $hook_extra    An array of hook extra parameters
	 */
	add_action( 'upgrader_process_complete', 'trx_addons_update', 10, 2 );
	function trx_addons_update( $upgrader, $hook_extra ) {
		if (   ! empty( $hook_extra['action'] )  && $hook_extra['action'] == 'update'
			&& ! empty( $hook_extra['type'] )    && in_array( $hook_extra['type'], array( 'plugin', 'theme' ) )
			&& ! empty( $hook_extra['bulk'] )
		) {
			if ( ! empty( $hook_extra['plugins'] ) && is_array( $hook_extra['plugins'] ) ) {
				if ( apply_filters( 'trx_addons_filter_regenerate_merged_files_after_update_trx_addons', true ) ) {
					foreach( $hook_extra['plugins'] as $plugin ) {
						if ( strpos( $plugin, 'trx_addons' ) !== false ) {
							// Set this flag to regenerate styles and scripts on first run
							trx_addons_merge_styles_schedule();
							break;
						}
					}
				}
			} else if ( ! empty( $hook_extra['themes'] ) && is_array( $hook_extra['themes'] ) ) {
				if ( apply_filters( 'trx_addons_filter_regenerate_merged_files_after_update_theme', true ) ) {
					$slug = get_template();
					foreach( $hook_extra['themes'] as $theme ) {
						if ( strpos( $theme, $slug ) !== false ) {
							// Set this flag to regenerate styles and scripts on first run
							trx_addons_merge_styles_schedule();
							break;
						}
					}
				}
			}
		}
	}
}

if ( ! function_exists( 'trx_addons_update2' ) ) {
	/**
	 * A plugin or a theme was updated via 'trx_updater' - regenerate merged files on next load
	 *
	 * @hooked trx_updater_action_after_plugin_upgrade
	 * @hooked trx_updater_action_after_theme_upgrade
	 * 
	 * @trigger trx_addons_filter_regenerate_merged_files_after_update_trx_addons
	 * @trigger trx_addons_filter_regenerate_merged_files_after_update_theme
	 * 
	 * @param string $slug    A plugin or a theme slug
	 */
	add_action( 'trx_updater_action_after_plugin_upgrade', 'trx_addons_update2', 10, 1 );
	add_action( 'trx_updater_action_after_theme_upgrade', 'trx_addons_update2', 10, 1 );
	function trx_addons_update2( $slug ) {
		$theme_slug = get_template();
		if ( ( current_action() == 'trx_updater_action_after_plugin_upgrade' && $slug == 'trx_addons' && apply_filters( 'trx_addons_filter_regenerate_merged_files_after_update_trx_addons', true ) )
			||
			( current_action() == 'trx_updater_action_after_theme_upgrade' && $slug == $theme_slug && apply_filters( 'trx_addons_filter_regenerate_merged_files_after_update_theme', true ) )
		) {
			// Set this flag to regenerate styles and scripts on first run
			trx_addons_merge_styles_schedule();
		}
	}
}

if ( ! function_exists( 'trx_addons_merge_styles_schedule' ) ) {
	/**
	 * Schedule action to merge all separate styles and scripts to the single file on next run after demo data import
	 * 
	 * @hooked trx_addons_action_importer_import_end
	 */
	add_action( 'trx_addons_action_importer_import_end', 'trx_addons_merge_styles_schedule');
	function trx_addons_merge_styles_schedule() {
   		// Set this flag to regenerate styles and scripts on first run
		update_option( 'trx_addons_action', 'trx_addons_action_save_options' );
	}
}

if ( ! function_exists( 'trx_addons_merge_styles' ) ) {
	/**
	 * Merge all separate styles and scripts to the single file to increase page upload speed
	 * 
	 * @hooked trx_addons_action_save_options, 20
	 */
	add_action( 'trx_addons_action_save_options', 'trx_addons_merge_styles', 20 );
	function trx_addons_merge_styles() {
		// Merge styles
		// CSS list must be in the next format:
		// 'relative url for css-file' => true | false
		//     true - merge this file always (to the __styles and to the __styles-full),
		//     false - not merge this file for optimized mode (only to the __styles-full)
		$css_list = apply_filters( 'trx_addons_filter_merge_styles', array(
																		'css/trx_addons.front.css' => true,
																		'css/trx_addons.hovers.css' => true
																		)
								);
		trx_addons_merge_css( 'css/__styles.css', array_keys( $css_list, true ) );
		trx_addons_merge_css( 'css/__styles-full.css', array_keys( $css_list ) );

		// Merge responsive styles
		$css_list = apply_filters( 'trx_addons_filter_merge_styles_responsive', array(
																					'css/trx_addons.responsive.css' => true
																					)
								);
		trx_addons_merge_css( 'css/__responsive.css', array_keys( $css_list, true ), true );
		trx_addons_merge_css( 'css/__responsive-full.css', array_keys( $css_list ), true );

		// Merge scripts
		// JS list must be in the next format:
		// 'relative url for js-file' => true | false
		//     true - merge this file always (to the __scripts and to the __scripts-full),
		//     false - not merge this file for optimized mode (only to the __scripts-full)
		$js_list = apply_filters( 'trx_addons_filter_merge_scripts', array(
																		'js/trx_addons.utils.js' => true,
																		'js/trx_addons.front.js' => true
																		)
								);
		trx_addons_merge_js( 'js/__scripts.js', array_keys( $js_list, true ) );
		trx_addons_merge_js( 'js/__scripts-full.js', array_keys( $js_list ) );
	}
}

if ( ! function_exists( 'trx_addons_merge_styles_convert_keys' ) ) {
	/**
	 * Convert an array items with numeric keys to the new format ( to compatibility with old themes )
	 * 
	 * @hooked trx_addons_filter_merge_styles, 9999
	 * @hooked trx_addons_filter_merge_styles_responsive, 9999
	 * @hooked trx_addons_filter_merge_scripts, 9999
	 * 
	 * @param array $list   An array of styles or scripts to merge
	 * 
	 * @return array        Modified array of styles or scripts to merge
	 */
	add_action( 'trx_addons_filter_merge_styles', 'trx_addons_merge_styles_convert_keys', 9999, 1 );
	add_action( 'trx_addons_filter_merge_styles_responsive', 'trx_addons_merge_styles_convert_keys', 9999, 1 );
	add_action( 'trx_addons_filter_merge_scripts', 'trx_addons_merge_styles_convert_keys', 9999, 1 );
	function trx_addons_merge_styles_convert_keys( $list ) {
		if ( is_array( $list ) ) {
			$new_list = array();
			foreach( $list as $k => $v ) {
				if ( is_numeric( $k ) ) {
					$new_list[ $v ] = true;
				} else {
					$new_list[ $k ] = $v;
				}
			}
			$list = $new_list;
			unset( $new_list );
		}
		return $list;
	}
}

if ( ! function_exists('trx_addons_do_delayed_action') ) {
	/**
	 * Delayed action from previous session (after save options) to save new CSS, etc.
	 * 
	 * @hooked after_setup_theme
	 * 
	 * @trigger trx_addons_action_save_options
	 * @trigger trx_addons_action_is_new_version_of_plugin
	 * 
	 * @return void
	 */
	add_action( 'after_setup_theme', 'trx_addons_do_delayed_action' );
	function trx_addons_do_delayed_action() {
		// If a delayed action is present
		$action = get_option( 'trx_addons_action' );
		if ( ! empty( $action ) ) {
		    do_action( $action );
			update_option( 'trx_addons_action', '' );
		}
		// If the plugin was updated manually
		$version = get_option( 'trx_addons_version' );
		if ( $version != TRX_ADDONS_VERSION ) {
			// Regenerate combined CSS and JS if not do it on delayed action
			if ( $action != 'trx_addons_action_save_options' ) {
				do_action( 'trx_addons_action_save_options' );
			}
			// Trigger action for a new version
			do_action( 'trx_addons_action_is_new_version_of_plugin', TRX_ADDONS_VERSION, $version );
			// Save current version
			update_option( 'trx_addons_version', TRX_ADDONS_VERSION );
		}
	}
}


//-------------------------------------------------------
//-- Add Google analitics and Google remarketing code
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_add_google_analitics' ) ) {
	/**
	 * Add Google Analytics code (before </head>)
	 * 
	 * @hooked wp_head, 1000
	 */
	add_action( 'wp_head', 'trx_addons_add_google_analitics', 1000 );
	function trx_addons_add_google_analitics() {
		// To prevent call again
		static $done = false;
		if ( $done ) return;
		$done = true;

		$ga = trx_addons_get_option( 'api_google_analitics', '', false );
		if ( ! empty( $ga ) ) {
			trx_addons_show_layout( $ga );
		}
	}
}

if ( ! function_exists( 'trx_addons_add_google_remarketing' ) ) {
	/**
	 * Add Google Remarketing code (before </body>)
	 * 
	 * @hooked wp_footer, 1000
	 */
	add_action( 'wp_footer', 'trx_addons_add_google_remarketing', 1000 );
	function trx_addons_add_google_remarketing() {
		// To prevent call again
		static $done = false;
		if ( $done ) return;
		$done = true;

		$gr = trx_addons_get_option( 'api_google_remarketing', '', false );
		if ( ! empty( $gr ) ) {
			trx_addons_show_layout( $gr );
		}
	}
}


//-------------------------------------------------------
//-- Load inline html and css
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_put_inline_html' ) ) {
	/**
	 * Load inline html
	 * Attention! Priority 9 is used because inline html must be loaded before moved scripts
	 * (see below on action 'wp_enqueue_scripts', 9999), called inside the action 'wp_footer' with the default priority 10
	 * 
	 * @hooked wp_footer, 9
	 * @hooked admin_footer, 9
	 * 
	 * @trigger trx_addons_filter_inline_html
	 */
	add_action( 'wp_footer', 'trx_addons_put_inline_html', 9 );
	add_action( 'admin_footer', 'trx_addons_put_inline_html', 9 );
	function trx_addons_put_inline_html() {
		// To prevent call again
		static $done = false;
		if ( $done ) return;
		$done = true;

		// Put custom html/js, prepared in shortcodes or any other output blocks
		trx_addons_show_layout( apply_filters( 'trx_addons_filter_inline_html', trx_addons_get_inline_html() ) );
	}
}

if ( ! function_exists( 'trx_addons_put_inline_css' ) ) {
	/**
	 * Load inline styles
	 * 
	 * @hooked wp_footer, 1000
	 * @hooked admin_footer, 1000
	 * 
	 * @trigger trx_addons_filter_inline_css
	 */
	add_action( 'wp_footer', 'trx_addons_put_inline_css', 1000 );
	add_action( 'admin_footer', 'trx_addons_put_inline_css', 1000 );
	function trx_addons_put_inline_css() {
		// To prevent call again
		static $done = false;
		if ( $done ) return;
		$done = true;
		// Attention! Don't change id in the tag 'style' - need to properly work the 'view more' script
		trx_addons_show_layout( apply_filters( 'trx_addons_filter_inline_css', trx_addons_get_inline_css() ),
								'<style type="text/css" id="trx_addons-inline-styles-inline-css">',
								'</style>'
								);
	}
}

if ( ! function_exists( 'trx_addons_check_print_footer_scripts' ) ) {
	/**
	 * Check if print_footer_scripts() was called manually ( not in the action 'wp_footer' )
	 * 
	 * @hooked print_footer_scripts, 9999
	 * 
	 * @param bool $doit    true if scripts must be printed
	 * 
	 * @return bool         true if scripts must be printed
	 */
	add_filter( 'print_footer_scripts', 'trx_addons_check_print_footer_scripts', 9999, 1 );
	function trx_addons_check_print_footer_scripts( $doit = true ) {
		static $done = false;
		if ( ! $done && ! doing_action('wp_footer') && ! doing_action('admin_footer') ) {
			$done = true;
			trx_addons_put_inline_html();
			if ( ! is_admin() ) {
				trx_addons_localize_scripts_front();
				trx_addons_check_page_content_for_used_styles_and_scripts();
				trx_addons_reorder_scripts();
			}
			trx_addons_put_inline_css();
		}
		return $doit;
	}
}


//-------------------------------------------------------
//-- Capture a page html output for further processing
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_grab_output_allowed' ) ) {
	/**
	 * Check if a page html capturing is enabled
	 * 
	 * @trigger trx_addons_filter_grab_output_allowed
	 * 
	 * @return bool    true if a page html capturing is enabled
	 */
	function trx_addons_grab_output_allowed() {
		return
			// Enable on a page requested via AJAX from frontend
			( ! is_admin() || wp_doing_ajax() )
			// Disable when a REST API is requested (for example, a block "legacy widget" from a new Widgets Editor)
			&& ! trx_addons_check_url( '/wp-json/' )
			// Allow a theme and 3rd-party plugins to disable a page capturing
			// Attention! If grab output is disabled, shortcodes "Horizontal Scroll" and "Switcher" are not works properly!
			&& apply_filters( 'trx_addons_filter_grab_output_allowed', true );
	}
}

if ( ! function_exists( 'trx_addons_grab_page_start_hook' ) ) {
	/**
	 * New way: Add a hook to start capturing a page.
	 * A priority 3 is used because an API support are loaded on priority 2
	 * 
	 * @hooked after_setup_theme, 3
	 */
	add_action( 'after_setup_theme', 'trx_addons_grab_page_start_hook', 3 );
	function trx_addons_grab_page_start_hook() {

		$grab_page_start_action = apply_filters( 'trx_addons_filter_grab_page_start_action', 'after_setup_theme' );	// Was 'wp_head' and 0
		$grab_page_start_priority = apply_filters( 'trx_addons_filter_grab_page_start_priority', 4 );				// and has conflict with the block 'Legacy Widget'

		if ( ! empty( $grab_page_start_action ) ) {
			add_action( $grab_page_start_action, 'trx_addons_grab_page_start', $grab_page_start_priority );
		}
	}
}

if ( ! function_exists( 'trx_addons_grab_page_start' ) ) {
	/**
	 * Starts capturing an output of the page
	 */
	function trx_addons_grab_page_start() {

		if ( ! trx_addons_grab_output_allowed() ) return;

		global $TRX_ADDONS_STORAGE;
		$TRX_ADDONS_STORAGE['capture_page'] = true;

		ob_start( 'trx_addons_grab_page_end' );
	}
}

if ( ! function_exists( 'trx_addons_grab_page_end' ) ) {
	/**
	 * Ends capturing an output of the page and move styles from the 'body' to the 'head'
	 * 
	 * @trigger trx_addons_action_before_move_styles
	 * @trigger trx_addons_action_after_move_styles
	 * @trigger trx_addons_filter_page_head
	 * @trigger trx_addons_filter_page_content
	 * 
	 * @param string $html    Captured html output of the page
	 * 
	 * @return string         Modified html output of the page
	 */
	function trx_addons_grab_page_end( $html = '' ) {

		global $TRX_ADDONS_STORAGE;
		$TRX_ADDONS_STORAGE['capture_page'] = false;

		// Parse a raw html output for the head and the body
		$TRX_ADDONS_STORAGE['capture_head_html'] = '';
		$TRX_ADDONS_STORAGE['capture_body_html'] = '';
		if ( ! empty( $html ) ) {
			$pos = strpos( $html, '</head>' );
			if ( $pos !== false ) {
				$TRX_ADDONS_STORAGE['capture_head_html'] = substr( $html, 0, $pos );
				$TRX_ADDONS_STORAGE['capture_body_html'] = substr( $html, $pos );
			}
		}

		// Prepare and output a head and a body (if present)
		if ( ! empty( $TRX_ADDONS_STORAGE['capture_head_html'] ) && ! empty( $TRX_ADDONS_STORAGE['capture_body_html'] ) ) {

			do_action( 'trx_addons_action_before_move_styles' );

			// Move styles from the folder 'trx_addons' from the body to the head
			trx_addons_move_own_styles_to_head();

			// Move styles from the theme and child-theme folders from the body to the head
			trx_addons_move_theme_styles_to_head();

			// Move other styles and links to the head
			trx_addons_move_other_styles_to_head();

			// Add captured and rearranged tags <link> and <style> to the end of <head>
			$TRX_ADDONS_STORAGE['capture_head_html'] = preg_replace( '/(\r?\n){2,}/', '$1', $TRX_ADDONS_STORAGE['capture_head_html'] )
				// Add all captured links from other 3rd-party plugins before own links
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_other_links'] ) ? $TRX_ADDONS_STORAGE['capture_other_links'] : '' )
				// Add all captured links from the trx_addons
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_own_links'] ) ? $TRX_ADDONS_STORAGE['capture_own_links'] : '' )
				// Add all captured links and styles from the theme and child-theme
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_theme_links'] ) ? $TRX_ADDONS_STORAGE['capture_theme_links'] : '' )
				// Add all captured responsive links from the trx_addons
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_own_links_responsive'] ) ? $TRX_ADDONS_STORAGE['capture_own_links_responsive'] : '' )
				// Add all captured responsive links and styles from the theme and child-theme
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_theme_links_responsive'] ) ? $TRX_ADDONS_STORAGE['capture_theme_links_responsive'] : '' )
				// Add all captured links from other 3rd-party plugins after theme's links
				. ( ! empty( $TRX_ADDONS_STORAGE['capture_other_links_last'] ) ? $TRX_ADDONS_STORAGE['capture_other_links_last'] : '' );

			// Allow other components, plugins and themes to move their styles
			do_action( 'trx_addons_action_after_move_styles' );

			// Replace a buffer with the modified content of the head and the body
			$html = apply_filters( 'trx_addons_filter_page_head', $TRX_ADDONS_STORAGE['capture_head_html'] )
					. apply_filters( 'trx_addons_filter_page_content', $TRX_ADDONS_STORAGE['capture_body_html'] );

			$TRX_ADDONS_STORAGE['capture_head_html'] = '';
			$TRX_ADDONS_STORAGE['capture_body_html'] = '';

		}

		return $html;
	}
}

if ( ! function_exists( 'trx_addons_move_own_styles_to_head' ) ) {
	/**
	 * Capture all tags like '<link href="trx_addons/*">' from the head and body
	 */
	function trx_addons_move_own_styles_to_head() {
		global $TRX_ADDONS_STORAGE;
		$TRX_ADDONS_STORAGE['capture_own_links'] = '';
		$TRX_ADDONS_STORAGE['capture_own_links_responsive'] = '';
		$theme_slug = get_template();
		$child_theme_slug = get_stylesheet();
		$regex = '/'
				. '(<link [^>]*href=[\'"][^\'"]*trx_addons[^\'"]*[\'"][^>]*>)'
				. '|(<link [^>]*id=[\'"]trx_addons-[^\'"]*[\'"][^>]*>)'
				. '|(<style[^>]*id=[\'"]trx_addons-[^\'"]*[\'"][^>]*>)'
				. '/Uix';
		foreach( array( 'head', 'body' ) as $part ) {
			$next_tag = array( 'tag' => '', 'pos' => 0 );
			do {
				$next_tag = trx_addons_get_next_style_tag( $TRX_ADDONS_STORAGE["capture_{$part}_html"], $next_tag, $regex, array( '/' . $theme_slug . '/', '/' . $child_theme_slug . '/' ) );
				if ( ! empty( $next_tag['tag'] ) ) {
					$TRX_ADDONS_STORAGE[ strpos( $next_tag['tag'], '<link ' ) === false || ( strpos( $next_tag['tag'], 'responsive-css' ) === false && strpos( $next_tag['tag'], 'responsive.css' ) === false )
						? 'capture_own_links'
						: 'capture_own_links_responsive'
					] .= "\n" . $next_tag['tag'];
				}
			} while ( ! empty( $next_tag['tag'] ) );
		}
	}
}

if ( ! function_exists( 'trx_addons_move_theme_styles_to_head' ) ) {
	/**
	 * Capture all tags like '<link href="/theme-slug/"' | '<link id="theme-slug-..."' | '<style id="theme-slug-..."'
	 * from the theme and child-theme folders from the head and body
	 */
	function trx_addons_move_theme_styles_to_head() {
		global $TRX_ADDONS_STORAGE;
		$TRX_ADDONS_STORAGE['capture_theme_links'] = '';
		$TRX_ADDONS_STORAGE['capture_theme_links_responsive'] = '';
		$theme_reg = str_replace( '/', '\\/', get_template() != get_stylesheet()
													? '(' . get_template() . '|' . get_stylesheet() . ')'
													: get_template()
								);
		$regex = '/'
				. '(<link [^>]*href=[\'"][^\'"]*\\/themes\\/' . $theme_reg . '[^\'"]*[\'"][^>]*>)'
				. '|(<link [^>]*id=[\'"]' . $theme_reg .'-[^\'"]*[\'"][^>]*>)'
				. '|(<style[^>]*id=[\'"]' . $theme_reg .'-[^\'"]*[\'"][^>]*>)'
				. '/Uix';
		foreach( array( 'head', 'body' ) as $part ) {
			$next_tag = array( 'tag' => '', 'pos' => 0 );
			do {
				$next_tag = trx_addons_get_next_style_tag( $TRX_ADDONS_STORAGE["capture_{$part}_html"], $next_tag, $regex );
				if ( ! empty( $next_tag['tag'] ) ) {
					$TRX_ADDONS_STORAGE[ strpos( $next_tag['tag'], '<link ' ) === false || ( strpos( $next_tag['tag'], 'responsive-css' ) === false && strpos( $next_tag['tag'], 'responsive.css' ) === false )
						? 'capture_theme_links'
						: 'capture_theme_links_responsive'
					] .= "\n" . $next_tag['tag'];
				}
			} while ( ! empty( $next_tag['tag'] ) );
		}
	}
}

if ( ! function_exists( 'trx_addons_move_other_styles_to_head' ) ) {
	/**
	 * Capture other 3rd-party styles and links from the body
	 * 
	 * @trigger trx_addons_filter_move_styles_to_head
	 * @trigger trx_addons_filter_move_3rd_party_styles_before_theme_styles
	 */
	function trx_addons_move_other_styles_to_head() {
		global $TRX_ADDONS_STORAGE;
		// A filter below is used instead an option
		// if ( trx_addons_is_on( trx_addons_get_option( 'move_styles_to_head' ) ) ) {
		if ( apply_filters( 'trx_addons_filter_move_styles_to_head', true ) ) {
			// Collect rest tags <link> and <style> from the body html
			$TRX_ADDONS_STORAGE['capture_other_links'] = '';
			$TRX_ADDONS_STORAGE['capture_other_links_last'] = '';
			$regex = '/'
					. "(<link [^>]*rel=['\"]stylesheet['\"][^>]*>)"
					. "|(<style[^>]*>)"
					. '/Uix';
			$next_tag = array( 'tag' => '', 'pos' => 0 );
			do {
				$next_tag = trx_addons_get_next_style_tag( $TRX_ADDONS_STORAGE["capture_body_html"], $next_tag, $regex );
				if ( ! empty( $next_tag['tag'] ) ) {
					$TRX_ADDONS_STORAGE[ apply_filters( 'trx_addons_filter_move_3rd_party_styles_before_theme_styles', true, $next_tag['tag'] )
											? 'capture_other_links'
											: 'capture_other_links_last'
										] .= "\n" . $next_tag['tag'];
				}
			} while ( ! empty( $next_tag['tag'] ) );
		}
	}
}

if ( ! function_exists( 'trx_addons_get_next_style_tag' ) ) {
	/**
	 * Find next tag <link> or <style> in the html content, then check it by the given regex and return it if matched (and cut from the content).
	 * If not matched - continue searching until the end of the content.
	 * If the tag <style> is found - search the end tag </style> too and return the full tag.
	 * Check also if the tag <style> is wrapped in the tag <noscript> - skip this tag then.
	 * 
	 * @param string $content    HTML content to search in
	 * @param array  $next_tag   An array with the last found tag and it's position: array( 'tag' => '', 'pos' => 0 )
	 * @param string $regex      A regex to check found tag
	 * @param array  $exclude    An array of strings to exclude found tag by (if one of the strings is found in the tag - the tag is skipped)
	 * 
	 * @return array			 An array with the found tag and it's position: array( 'tag' => '', 'pos' => 0 )            
	 */
	function trx_addons_get_next_style_tag( &$content, $next_tag, $regex, $exclude = array() ) {
		$next_tag['tag'] = '';
		do {
			$pos_link = strpos( $content, '<link ', $next_tag['pos'] );
			$pos_style = strpos( $content, '<style', $next_tag['pos'] );
			if ( $pos_link === false && $pos_style === false ) {
				$next_tag['pos'] = strlen( $content );
				break;
			}
			$pos_start = $pos_link === false
							? $pos_style
							: ( $pos_style === false
								? $pos_link
								: min( $pos_link, $pos_style )
								);
			$pos_end = strpos( $content, '>', $pos_start );
			$pos_end = $pos_end === false ? strlen( $content ) : $pos_end;
			$tag = substr( $content, $pos_start, $pos_end - $pos_start + 1 );
			// Check by the regex
			if ( ! preg_match( $regex, $tag ) ) {
				$next_tag['pos'] = $pos_end + 1;
				continue;
			}
			// Check by the exclude strings
			if ( is_array( $exclude ) && count( $exclude ) > 0 && strpos( $tag, '<link' ) !== false ) {
				$excluded = false;
				foreach( $exclude as $ex_str ) {
					if ( strpos( $tag, $ex_str ) !== false ) {
						$excluded = true;
						break;
					}
				}
				if ( $excluded ) {
					$next_tag['pos'] = $pos_end + 1;
					continue;
				}
			}
			// Get the full tag if it's <style>
			if ( strpos( $tag, '<style' ) !== false ) {
				$pos_end = strpos( $content, '</style>', $pos_start );
				$pos_end = $pos_end === false ? strlen( $content ) : $pos_end + 7;
				$tag = substr( $content, $pos_start, $pos_end - $pos_start + 1 );
				// Check if the tag <style> is wrapped in the tag <noscript>
				$noscript_start = strrpos( substr( $content, 0, $pos_start ), '<noscript>' );
				$noscript_end = strpos( $content, '</noscript>', $pos_end );
				if ( $noscript_start !== false && $noscript_end !== false && $noscript_end > $pos_end ) {
					$next_tag['pos'] = $noscript_end + 11;
					continue;
				}
			}
			// Put found tag to the result and cut it from the content
			$next_tag['tag'] = $tag;
			// $content = substr( $content, 0, $pos_start ) . substr( $content, $pos_end + 1 );
			$content = substr_replace( $content, '', $pos_start, $pos_end - $pos_start + 1 );
			break;
		} while ( true );
		return $next_tag;
	}
}

if ( ! function_exists( 'trx_addons_remove_attribute_type' ) ) {
	add_filter( 'trx_addons_filter_page_head', 'trx_addons_remove_attribute_type', 9999 );
	add_filter( 'trx_addons_filter_page_content', 'trx_addons_remove_attribute_type', 9999 );
	/**
	 * Remove attribute 'type="text/css"' from the tags <style> and 'type="text/javascript"' from the tags <script>
	 * 
	 * @hooked trx_addons_filter_page_head, 9999
	 * @hooked trx_addons_filter_page_content, 9999
	 * 
	 * @param string $html    Captured html output of the head or the body
	 * 
	 * @return string         Modified html output of the head or the body
	 */
	function trx_addons_remove_attribute_type( $html ) {
		if ( (int)trx_addons_get_option( 'remove_attribute_type' ) > 0 ) {
			$html = preg_replace(
				array(
					'/(<style[^>]*)(\s+type=[\'"]text\/css[\'"])/',			// Remove type="text/css"
					'/(<script[^>]*)(\s+type=[\'"]text\/javascript[\'"])/'	// Remove type="text/javascript"
				),
				'$1',
				$html
			);
		}
		return $html;
	}
}

if ( ! function_exists( 'trx_addons_check_page_content_for_used_styles_and_scripts' ) ) {
	/**
	 * A last chance to add scripts and styles for blocks, used on this page
	 * Call before 'wp_print_footer_scripts' on priority 20
	 * 
	 * @hooked wp_footer, 18
	 * 
	 * @trigger trx_addons_action_check_page_content
	 */
	add_action( 'wp_footer', 'trx_addons_check_page_content_for_used_styles_and_scripts', 18 );
	function trx_addons_check_page_content_for_used_styles_and_scripts() {

		if ( ! trx_addons_grab_output_allowed() ) return;

		global $TRX_ADDONS_STORAGE;
		// Get (only preview, not finish capture) a captured body output
		if ( ! empty( $TRX_ADDONS_STORAGE['capture_page'] ) ) {
			$html = ob_get_contents();
			if ( ! empty( $html ) ) {
				do_action( 'trx_addons_action_check_page_content', $html );
			}
		}
	}
}


//-------------------------------------------------------
//-- Translations
//-------------------------------------------------------

if ( ! function_exists( 'trx_addons_load_plugin_textdomain' ) ) {
	/**
	 * Load plugin's translation file
	 * Attention! It must be loaded before the first call of any translation function
	 * 
	 * @hooked after_setup_theme, 1
	 */
	add_action( 'after_setup_theme', 'trx_addons_load_plugin_textdomain', 1 );
	function trx_addons_load_plugin_textdomain() {
		static $loaded = false;
		if ( $loaded ) return true;
		$domain = 'trx_addons';
		if ( is_textdomain_loaded( $domain ) && ! is_a( $GLOBALS['l10n'][ $domain ], 'NOOP_Translations' ) ) return true;
		$loaded = true;
		load_plugin_textdomain( $domain, false, apply_filters( 'trx_addons_filter_load_textdomain_path', TRX_ADDONS_PLUGIN_BASE . '/languages' ) );
	}
}


// Next files must be loaded before options
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.socials.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.files.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.cache.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.uploads.php';

// Plugin's internal utilities
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.debug.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.utils.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.messages.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.media.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.wp.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.lists.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.html.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.users.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.banners.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.compatibilities.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.theme.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.db-update.php';

// Admin
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.admin.php';

// Plugin's options
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.options.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.options.components.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.options.meta-box.php';
require_once TRX_ADDONS_PLUGIN_DIR_INCLUDES . 'plugin.options.customizer.php';

// Pluggable modules
require_once TRX_ADDONS_PLUGIN_DIR_COMPONENTS . 'components.php';

// Theme-specific modules
require_once TRX_ADDONS_PLUGIN_DIR_ADDONS . 'addons.php';

Youez - 2016 - github.com/yon3zu
LinuXploit