wordpress/wp-content/themes/basic/themify/themify-admin.php
/**
 * Enqueue JS and CSS for Themify settings page and meta boxes
 * @param String $page
 * @since 1.1.1
 *******************************************************/
Enqueue JS and CSS for Themify settings page and meta boxes
@param String $page
@since 1.1.1
Enqueue JS and CSS for Themify settings page and meta boxes @param String $page @since 1 . 1 . 1
function themify_enqueue_scripts($page){
	$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
	if ( 'themify' === $pagenow && isset( $_GET['action'] ) && 'upgrade' === $_GET['action'] ) {
		return;
	}
	global $typenow;
	$types = themify_post_types();
	$pages = apply_filters( 'themify_top_pages', array( 'post.php', 'post-new.php', 'toplevel_page_themify', 'nav-menus.php' ) );
	$pagenows = apply_filters( 'themify_pagenow', array( 'themify' ) );
	wp_register_style( 'tf-base', THEMIFY_URI . '/css/base.min.css', null, THEMIFY_VERSION);
	wp_register_style( 'themify-ui',  themify_enque(THEMIFY_URI . '/css/themify-ui.css'), array('tf-base'), THEMIFY_VERSION );
	wp_register_style( 'themify-ui-rtl',  themify_enque(THEMIFY_URI . '/css/themify-ui-rtl.css'), array('themify-ui'), THEMIFY_VERSION );
	wp_register_style( 'themify-colorpicker', themify_enque(THEMIFY_METABOX_URI . 'css/jquery.minicolors.css'), null, THEMIFY_VERSION );
	wp_register_script( 'validate', THEMIFY_URI . '/js/admin/jquery.validate.pack.min.js', array('jquery'), THEMIFY_VERSION,true );
	wp_register_script( 'markjs', THEMIFY_URI . '/js/admin/jquery.mark.min.js', array('jquery'), THEMIFY_VERSION,true );
	wp_register_script( 'themify-colorpicker', themify_enque(THEMIFY_METABOX_URI . 'js/jquery.minicolors.js'), array('jquery'), THEMIFY_VERSION,true );
	wp_localize_script( 'themify-colorpicker', 'themifyCM', Themify_Metabox::themify_localize_cm_data() );
	wp_register_script( 'themify-scripts', themify_enque(THEMIFY_URI . '/js/admin/scripts.js'), array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION,true );
	wp_register_script( 'themify-plupload', themify_enque(THEMIFY_METABOX_URI . 'js/plupload.js'), array('jquery', 'themify-scripts'), THEMIFY_VERSION,true);
	wp_register_style ( 'magnific', themify_enque(THEMIFY_URI . '/css/lightbox.css'), array(), THEMIFY_VERSION );
	wp_register_script( 'magnific', THEMIFY_URI . '/js/lightbox.min.js', array('jquery'), THEMIFY_VERSION, true );
	if( ($page === 'post.php' || $page === 'post-new.php') && in_array($typenow, $types,true) ){
		wp_enqueue_script( 'meta-box-tabs' );
		wp_enqueue_script( 'media-library-browse' );
	}
	wp_register_style( 'themify-icons', themify_enque(THEMIFY_URI . '/themify-icons/themify-icons.css'), array(), THEMIFY_VERSION );
	if( $page === 'toplevel_page_themify' ){
		wp_enqueue_script( 'jquery-ui-sortable' );
		wp_enqueue_script( 'themify-main-script', themify_enque(THEMIFY_URI.'/js/main.js'), array('jquery'), THEMIFY_VERSION, true );
		Themify_Enqueue_Assets::addLocalization('url', THEMIFY_URI, false);
		$tf_code = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
	}
	else{
	    $tf_code='';
	}
	if( in_array( $page, $pages,true ) ) {
		wp_enqueue_style( 'themify-ui' );
		wp_enqueue_style( 'themify-metabox' );
		if ( is_rtl() ) {
			wp_enqueue_style( 'themify-ui-rtl' );
		}
		wp_enqueue_style( 'themify-colorpicker' );
		wp_enqueue_script( 'jquery' );
		wp_enqueue_script( 'jquery-ui-core' );
		wp_enqueue_script( 'jquery-ui-tabs' );
		wp_enqueue_script( 'jquery-ui-slider' );
                if( 'themify' === $pagenow){
                        wp_enqueue_script( 'jquery-ui-autocomplete' );
                }
		wp_enqueue_script( 'json2' );
		wp_enqueue_script( 'plupload-all' );
		wp_enqueue_script( 'validate' );
		wp_enqueue_script( 'markjs' );
		wp_enqueue_script( 'themify-colorpicker' );
		if( in_array($typenow, $types,true) || in_array( $pagenow, $pagenows,true ) ){
			wp_enqueue_script( 'themify-scripts' );
			wp_enqueue_script( 'themify-plupload' );
			Themify_Metabox::get_instance()->enqueue();
		}
		wp_enqueue_style( 'themify-icons' );
		Themify_Icon_Font::enqueue();
		wp_enqueue_style ( 'magnific' );
		wp_enqueue_script( 'magnific' );
	}
	wp_localize_script('themify-scripts', 'themify_js_vars', array(
			'nonce' 	=> wp_create_nonce('ajax-nonce'),
			'admin_url' => admin_url( 'admin.php?page=themify' ),
			'page_not_found' => esc_html__( 'Page not found', 'themify' ),
			'code_editor'=>!empty($tf_code)?$tf_code:''
		)
	);
	$tf_code=null;
	wp_localize_script('themify-scripts', 'themify_lang', array(
			'confirm_reset_styling'	=> __('Are you sure you want to reset your theme style?', 'themify'),
			'confirm_reset_settings' => __('Are you sure you want to reset your theme settings?', 'themify'),
			'check_backup' => __('Make sure to backup before upgrading. Files and settings may get lost or changed.', 'themify'),
			'confirm_delete_image' => __('Do you want to delete this image permanently?', 'themify'),
			'invalid_login' => __('Invalid username or password.<br/>Contact <a href="https://themify.me/contact">Themify</a> for login issues.', 'themify'),
			'unsuscribed' => __('Your membership might be expired. Login to <a href="https://themify.me/member">Themify</a> to check.', 'themify'),
			'confirm_demo' => __( 'This will import demo and override current Themify panel settings.', 'themify' )
		)
	);
    wp_localize_script('themify-plupload', 'themify_plupload_lang', array(
            'enable_zip_upload' => sprintf(
                __('Install the "File Upload Types" plugin and add the file extension upload support.', 'themify'),
                esc_url( network_admin_url('settings.php').'#upload_filetypes' )
            ),
            'filesize_error' => __('The file you are trying to upload exceeds the maximum file size allowed.', 'themify'),
            'filesize_error_fix' => sprintf(
                __('Go to your <a href="%s">Network Settings</a> and increase the value of the <strong>Max upload file size</strong>.', 'themify'),
                esc_url( network_admin_url('settings.php').'#fileupload_maxk' )
            )
        )
    );
	if( $page === 'index.php' && themify_is_themify_theme()) {
		wp_enqueue_style( 'themify-admin-widgets-css' );
		wp_enqueue_script( 'themify-admin-widgets-js' );
	}
}
function themify_enqueue_scripts ( $ page ) { $ pagenow = isset ( $ _GET [ 'page' ] ) ? $ _GET [ 'page' ] : '' ; if ( 'themify' === $ pagenow && isset ( $ _GET [ 'action' ] ) && 'upgrade' === $ _GET [ 'action' ] ) { return ; } global $ typenow ; $ types = themify_post_types ( ) ; $ pages = apply_filters ( 'themify_top_pages' , array ( 'post.php' , 'post-new.php' , 'toplevel_page_themify' , 'nav-menus.php' ) ) ; $ pagenows = apply_filters ( 'themify_pagenow' , array ( 'themify' ) ) ; wp_register_style ( 'tf-base' , THEMIFY_URI . '/css/base.min.css' , null , THEMIFY_VERSION ) ; wp_register_style ( 'themify-ui' , themify_enque ( THEMIFY_URI . '/css/themify-ui.css' ) , array ( 'tf-base' ) , THEMIFY_VERSION ) ; wp_register_style ( 'themify-ui-rtl' , themify_enque ( THEMIFY_URI . '/css/themify-ui-rtl.css' ) , array ( 'themify-ui' ) , THEMIFY_VERSION ) ; wp_register_style ( 'themify-colorpicker' , themify_enque ( THEMIFY_METABOX_URI . 'css/jquery.minicolors.css' ) , null , THEMIFY_VERSION ) ; wp_register_script ( 'validate' , THEMIFY_URI . '/js/admin/jquery.validate.pack.min.js' , array ( 'jquery' ) , THEMIFY_VERSION , true ) ; wp_register_script ( 'markjs' , THEMIFY_URI . '/js/admin/jquery.mark.min.js' , array ( 'jquery' ) , THEMIFY_VERSION , true ) ; wp_register_script ( 'themify-colorpicker' , themify_enque ( THEMIFY_METABOX_URI . 'js/jquery.minicolors.js' ) , array ( 'jquery' ) , THEMIFY_VERSION , true ) ; wp_localize_script ( 'themify-colorpicker' , 'themifyCM' , Themify_Metabox :: themify_localize_cm_data ( ) ) ; wp_register_script ( 'themify-scripts' , themify_enque ( THEMIFY_URI . '/js/admin/scripts.js' ) , array ( 'jquery' , 'jquery-ui-tabs' ) , THEMIFY_VERSION , true ) ; wp_register_script ( 'themify-plupload' , themify_enque ( THEMIFY_METABOX_URI . 'js/plupload.js' ) , array ( 'jquery' , 'themify-scripts' ) , THEMIFY_VERSION , true ) ; wp_register_style ( 'magnific' , themify_enque ( THEMIFY_URI . '/css/lightbox.css' ) , array ( ) , THEMIFY_VERSION ) ; wp_register_script ( 'magnific' , THEMIFY_URI . '/js/lightbox.min.js' , array ( 'jquery' ) , THEMIFY_VERSION , true ) ; if ( ( $ page === 'post.php' || $ page === 'post-new.php' ) && in_array ( $ typenow , $ types , true ) ) { wp_enqueue_script ( 'meta-box-tabs' ) ; wp_enqueue_script ( 'media-library-browse' ) ; } wp_register_style ( 'themify-icons' , themify_enque ( THEMIFY_URI . '/themify-icons/themify-icons.css' ) , array ( ) , THEMIFY_VERSION ) ; if ( $ page === 'toplevel_page_themify' ) { wp_enqueue_script ( 'jquery-ui-sortable' ) ; wp_enqueue_script ( 'themify-main-script' , themify_enque ( THEMIFY_URI . '/js/main.js' ) , array ( 'jquery' ) , THEMIFY_VERSION , true ) ; Themify_Enqueue_Assets :: addLocalization ( 'url' , THEMIFY_URI , false ) ; $ tf_code = wp_enqueue_code_editor ( array ( 'type' => 'text/html' ) ) ; } else { $ tf_code = '' ; } if ( in_array ( $ page , $ pages , true ) ) { wp_enqueue_style ( 'themify-ui' ) ; wp_enqueue_style ( 'themify-metabox' ) ; if ( is_rtl ( ) ) { wp_enqueue_style ( 'themify-ui-rtl' ) ; } wp_enqueue_style ( 'themify-colorpicker' ) ; wp_enqueue_script ( 'jquery' ) ; wp_enqueue_script ( 'jquery-ui-core' ) ; wp_enqueue_script ( 'jquery-ui-tabs' ) ; wp_enqueue_script ( 'jquery-ui-slider' ) ; if ( 'themify' === $ pagenow ) { wp_enqueue_script ( 'jquery-ui-autocomplete' ) ; } wp_enqueue_script ( 'json2' ) ; wp_enqueue_script ( 'plupload-all' ) ; wp_enqueue_script ( 'validate' ) ; wp_enqueue_script ( 'markjs' ) ; wp_enqueue_script ( 'themify-colorpicker' ) ; if ( in_array ( $ typenow , $ types , true ) || in_array ( $ pagenow , $ pagenows , true ) ) { wp_enqueue_script ( 'themify-scripts' ) ; wp_enqueue_script ( 'themify-plupload' ) ; Themify_Metabox :: get_instance ( ) -> enqueue ( ) ; } wp_enqueue_style ( 'themify-icons' ) ; Themify_Icon_Font :: enqueue ( ) ; wp_enqueue_style ( 'magnific' ) ; wp_enqueue_script ( 'magnific' ) ; } wp_localize_script ( 'themify-scripts' , 'themify_js_vars' , array ( 'nonce' => wp_create_nonce ( 'ajax-nonce' ) , 'admin_url' => admin_url ( 'admin.php?page=themify' ) , 'page_not_found' => esc_html__ ( 'Page not found' , 'themify' ) , 'code_editor' => ! empty ( $ tf_code ) ? $ tf_code : '' ) ) ; $ tf_code = null ; wp_localize_script ( 'themify-scripts' , 'themify_lang' , array ( 'confirm_reset_styling' => __ ( 'Are you sure you want to reset your theme style?' , 'themify' ) , 'confirm_reset_settings' => __ ( 'Are you sure you want to reset your theme settings?' , 'themify' ) , 'check_backup' => __ ( 'Make sure to backup before upgrading. Files and settings may get lost or changed.' , 'themify' ) , 'confirm_delete_image' => __ ( 'Do you want to delete this image permanently?' , 'themify' ) , 'invalid_login' => __ ( 'Invalid username or password.<br/>Contact <a href="https://themify.me/contact">Themify</a> for login issues.' , 'themify' ) , 'unsuscribed' => __ ( 'Your membership might be expired. Login to <a href="https://themify.me/member">Themify</a> to check.' , 'themify' ) , 'confirm_demo' => __ ( 'This will import demo and override current Themify panel settings.' , 'themify' ) ) ) ; wp_localize_script ( 'themify-plupload' , 'themify_plupload_lang' , array ( 'enable_zip_upload' => sprintf ( __ ( 'Install the "File Upload Types" plugin and add the file extension upload support.' , 'themify' ) , esc_url ( network_admin_url ( 'settings.php' ) . '#upload_filetypes' ) ) , 'filesize_error' => __ ( 'The file you are trying to upload exceeds the maximum file size allowed.' , 'themify' ) , 'filesize_error_fix' => sprintf ( __ ( 'Go to your <a href="%s">Network Settings</a> and increase the value of the <strong>Max upload file size</strong>.' , 'themify' ) , esc_url ( network_admin_url ( 'settings.php' ) . '#fileupload_maxk' ) ) ) ) ; if ( $ page === 'index.php' && themify_is_themify_theme ( ) ) { wp_enqueue_style ( 'themify-admin-widgets-css' ) ; wp_enqueue_script ( 'themify-admin-widgets-js' ) ; } }
Enqueue JS and CSS for Themify settings page and meta boxes
 @param String $page
 @since 1.1.1
Enqueue JS and CSS for Themify settings page and meta boxes @param String $page @since 1 . 1 . 1
// Don't do anything while updating the theme // Custom Write Panel // Register icon assets for later enqueueing. // Settings Panel // Load main.js for using fontawsome function //Enqueue styles //Enqueue scripts //Don't include Themify JavaScript if we're not in one of the Themify-managed pages // Enqueue font icon assets. //Inject variable values to scripts.js previously enqueued // Enqueu admin widgets stuff