As the sun rises and the forest mist clears, and the clouds return and the caves darken, these changes of light and shadow are the morning and evening in the mountains. Wildflowers bloom with their subtle fragrance, fine trees flourish with their dense shade, the wind and frost are pure and clean, and the water recedes to reveal the rocks—these are the four seasons in the mountains. Going out in the morning and returning in the evening, the scenery of the four seasons is different, and the joy is endless.至于负者歌于途,行者休于树,前者呼,后者应,伛偻提携,往来而不绝者,滁人游也。临溪而渔,溪深而鱼肥,酿泉为酒,泉香而酒洌,山肴野蔌,杂然而前陈者,太守宴也。宴酣之乐,非丝非竹,射者中,弈者胜,觥筹交错,起坐而喧哗者,众宾欢也。苍颜白发,颓然乎其间者,太守醉也。 HEX
HEX
Server: Apache
System: Linux webd003.cluster106.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: labeautef (51223)
PHP: 8.0.30
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/labeautef/fiestaparc.net/wp-content/plugins/code-snippets/php/settings/editor-preview.php
<?php
/**
 * This file handles the editor preview setting
 *
 * @since   2.0.0
 * @package Code_Snippets
 */

namespace Code_Snippets\Settings;

use function Code_Snippets\code_snippets;
use function Code_Snippets\enqueue_code_editor;
use function Code_Snippets\get_editor_themes;

/**
 * Load the CSS and JavaScript for the editor preview field
 */
function enqueue_editor_preview_assets() {
	$plugin = code_snippets();

	enqueue_code_editor( 'php' );

	// Enqueue all editor themes.
	$themes = get_editor_themes();

	foreach ( $themes as $theme ) {
		wp_enqueue_style(
			'code-snippets-editor-theme-' . $theme,
			plugins_url( "dist/editor-themes/$theme.css", $plugin->file ),
			[ 'code-editor' ],
			$plugin->version
		);
	}

	// Enqueue the menu scripts.
	wp_enqueue_script(
		'code-snippets-settings-menu',
		plugins_url( 'dist/settings.js', $plugin->file ),
		[ 'code-snippets-code-editor' ],
		$plugin->version,
		true
	);

	wp_set_script_translations( 'code-snippets-settings-menu', 'code-snippets' );

	// Extract the CodeMirror-specific editor settings.
	$setting_fields = get_settings_fields();
	$editor_fields = array();

	foreach ( $setting_fields['editor'] as $name => $field ) {
		if ( empty( $field['codemirror'] ) ) {
			continue;
		}

		$editor_fields[] = array(
			'name'       => $name,
			'type'       => $field['type'],
			'codemirror' => addslashes( $field['codemirror'] ),
		);
	}

	// Pass the saved options to the external JavaScript file.
	$inline_script = 'var code_snippets_editor_settings = ' . wp_json_encode( $editor_fields ) . ';';

	wp_add_inline_script( 'code-snippets-settings-menu', $inline_script, 'before' );

	// Provide configuration and simple i18n for the version switch JS module.
	$version_switch = array(
		'ajaxurl' => admin_url( 'admin-ajax.php' ),
		'nonce_switch' => wp_create_nonce( 'code_snippets_version_switch' ),
		'nonce_refresh' => wp_create_nonce( 'code_snippets_refresh_versions' ),
	);

	$strings = array(
		'selectDifferent' => esc_html__( 'Please select a different version to switch to.', 'code-snippets' ),
		'switching' => esc_html__( 'Switching...', 'code-snippets' ),
		'processing' => esc_html__( 'Processing version switch. Please wait...', 'code-snippets' ),
		'error' => esc_html__( 'An error occurred.', 'code-snippets' ),
		'errorSwitch' => esc_html__( 'An error occurred while switching versions. Please try again.', 'code-snippets' ),
		'refreshing' => esc_html__( 'Refreshing...', 'code-snippets' ),
		'refreshed' => esc_html__( 'Refreshed!', 'code-snippets' ),
	);

	wp_add_inline_script( 'code-snippets-settings-menu', 'var code_snippets_version_switch = ' . wp_json_encode( $version_switch ) . '; var __code_snippets_i18n = ' . wp_json_encode( $strings ) . ';', 'before' );
}

/**
 * Retrieve the list of code editor themes.
 *
 * @return array<string, string> List of editor themes.
 */
function get_editor_theme_list(): array {
	$themes = [
		'default' => __( 'Default', 'code-snippets' ),
	];

	foreach ( get_editor_themes() as $theme ) {

		// Skip mobile themes.
		if ( '-mobile' === substr( $theme, -7 ) ) {
			continue;
		}

		$themes[ $theme ] = ucwords( str_replace( '-', ' ', $theme ) );
	}

	return $themes;
}

/**
 * Render the editor preview setting
 */
function render_editor_preview() {
	$settings = get_settings_values();
	$settings = $settings['editor'];

	$indent_unit = absint( $settings['indent_unit'] );
	$tab_size = absint( $settings['tab_size'] );

	$n_tabs = $settings['indent_with_tabs'] ? floor( $indent_unit / $tab_size ) : 0;
	$n_spaces = $settings['indent_with_tabs'] ? $indent_unit % $tab_size : $indent_unit;

	$indent = str_repeat( "\t", $n_tabs ) . str_repeat( ' ', $n_spaces );

	$code = "add_filter( 'admin_footer_text', function ( \$text ) {\n\n" .
	        $indent . "\$site_name = get_bloginfo( 'name' );\n\n" .
	        $indent . '$text = "Thank you for visiting $site_name.";' . "\n" .
	        $indent . 'return $text;' . "\n" .
	        "} );\n";

	echo '<textarea id="code_snippets_editor_preview">', esc_textarea( $code ), '</textarea>';
}