SILENT KILLERPanel

Current Path: > home > codekrsu > > shopceylon.store > wp-content > plugins > code-snippets > php


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//shopceylon.store/wp-content/plugins/code-snippets/php

NameTypeSizeLast ModifiedActions
admin-menus Directory - -
cloud Directory - -
export Directory - -
front-end Directory - -
rest-api Directory - -
settings Directory - -
views Directory - -
class-active-snippets.php File 1892 bytes February 14 2025 13:16:14.
class-admin.php File 10843 bytes February 14 2025 13:16:14.
class-contextual-help.php File 6388 bytes February 14 2025 13:16:14.
class-data-item.php File 6379 bytes February 14 2025 13:16:14.
class-db.php File 7870 bytes November 27 2024 21:28:50.
class-licensing.php File 314 bytes February 14 2025 13:16:14.
class-list-table.php File 38586 bytes February 14 2025 13:16:14.
class-plugin.php File 10009 bytes February 14 2025 13:16:14.
class-snippet.php File 13381 bytes February 14 2025 13:16:14.
class-upgrade.php File 6712 bytes February 14 2025 13:16:14.
class-validator.php File 7188 bytes November 27 2024 21:28:50.
class-welcome-api.php File 9762 bytes November 27 2024 21:52:46.
deactivation-notice.php File 1991 bytes November 27 2024 21:28:50.
editor.php File 3280 bytes November 06 2023 19:43:04.
load.php File 1464 bytes February 14 2025 13:16:14.
snippet-ops.php File 21480 bytes February 14 2025 13:16:14.
strings.php File 1848 bytes May 19 2023 18:41:32.
uninstall.php File 2129 bytes February 14 2025 13:16:14.

Reading File: /home/codekrsu//shopceylon.store/wp-content/plugins/code-snippets/php/editor.php

<?php
/**
 * Functions for using the built-in code editor library
 *
 * @package Code_Snippets
 */

namespace Code_Snippets;

use function Code_Snippets\Settings\get_setting;

/**
 * Register and load the CodeMirror library.
 *
 * @param string               $type       Type of code editor – either 'php', 'css', 'js', or 'html'.
 * @param array<string, mixed> $extra_atts Pass a list of attributes to override the saved ones.
 */
function enqueue_code_editor( string $type, array $extra_atts = [] ) {
	$plugin = code_snippets();

	$modes = [
		'css'  => 'text/css',
		'php'  => 'php-snippet',
		'js'   => 'javascript',
		'html' => 'application/x-httpd-php',
	];

	if ( ! isset( $modes[ $type ] ) ) {
		$type = 'php';
	}

	$default_atts = [
		'mode'          => $modes[ $type ],
		'inputStyle'    => 'textarea',
		'matchBrackets' => true,
		'extraKeys'     => [
			'Alt-F'      => 'findPersistent',
			'Ctrl-Space' => 'autocomplete',
			'Ctrl-/'     => 'toggleComment',
			'Cmd-/'      => 'toggleComment',
			'Alt-Up'     => 'swapLineUp',
			'Alt-Down'   => 'swapLineDown',
		],
		'gutters'       => [ 'CodeMirror-lint-markers', 'CodeMirror-foldgutter' ],
		'lint'          => 'css' === $type || 'php' === $type,
		'direction'     => 'ltr',
		'colorpicker'   => [ 'mode' => 'edit' ],
		'foldOptions'   => [ 'widget' => '...' ],
	];

	// Add relevant saved setting values to the default attributes.
	$plugin_settings = Settings\get_settings_values();
	$setting_fields = Settings\get_settings_fields();

	foreach ( $setting_fields['editor'] as $field_id => $field ) {
		// The 'codemirror' setting field specifies the name of the attribute.
		$default_atts[ $field['codemirror'] ] = $plugin_settings['editor'][ $field_id ];
	}

	// Merge the default attributes with the ones passed into the function.
	$atts = wp_parse_args( $default_atts, $extra_atts );
	$atts = apply_filters( 'code_snippets_codemirror_atts', $atts );

	// Ensure number values are not formatted as strings.
	foreach ( [ 'indentUnit', 'tabSize' ] as $number_att ) {
		$atts[ $number_att ] = intval( $atts[ $number_att ] );
	}

	wp_enqueue_code_editor(
		[
			'type'       => $modes[ $type ],
			'codemirror' => $atts,
		]
	);

	wp_enqueue_script( 'htmlhint' );
	wp_enqueue_script( 'csslint' );
	wp_enqueue_script( 'jshint' );

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

	// CodeMirror Theme.
	$theme = get_setting( 'editor', 'theme' );

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

/**
 * Retrieve a list of the available CodeMirror themes.
 *
 * @return array<string> The available themes.
 */
function get_editor_themes(): array {
	static $themes = null;

	if ( ! is_null( $themes ) ) {
		return $themes;
	}

	$themes = array();
	$themes_dir = plugin_dir_path( PLUGIN_FILE ) . 'dist/editor-themes/';

	$theme_files = glob( $themes_dir . '*.css' );

	foreach ( $theme_files as $theme ) {
		$theme = str_replace( $themes_dir, '', $theme );
		$theme = str_replace( '.css', '', $theme );
		$themes[] = $theme;
	}

	return $themes;
}

SILENT KILLER Tool