revert global changes

This commit is contained in:
Darko Luketic 2021-11-29 12:08:34 +01:00
parent a1190c52f2
commit 16bf4ac2de

View File

@ -1,35 +1,35 @@
<?php <?php
// Switches // Switches
const CRAYON_DEBUG = FALSE; define('CRAYON_DEBUG', FALSE);
const CRAYON_TAG_EDITOR = TRUE; define('CRAYON_TAG_EDITOR', TRUE);
const CRAYON_THEME_EDITOR = TRUE; define('CRAYON_THEME_EDITOR', TRUE);
const CRAYON_MINIFY = TRUE; define('CRAYON_MINIFY', TRUE);
// Constants // Constants
// General definitions // General definitions
const CRAYON_DOMAIN = 'crayon-syntax-highlighter'; define('CRAYON_DOMAIN', 'crayon-syntax-highlighter');
// These are overridden by functions since v1.1.1 // These are overridden by functions since v1.1.1
$CRAYON_VERSION = '2.8.6'; $CRAYON_VERSION = '1.1.1';
$CRAYON_DATE = '29th November, 2021'; $CRAYON_DATE = '27th September, 2011';
$CRAYON_AUTHOR = 'Aram Kocharyan'; $CRAYON_AUTHOR = 'Aram Kocharyan';
$CRAYON_AUTHOR_SITE = 'https://aramk.com'; $CRAYON_AUTHOR_SITE = 'http://aramk.com';
$CRAYON_DONATE = 'https://bit.ly/crayondonate'; $CRAYON_DONATE = 'http://bit.ly/crayondonate';
$CRAYON_WEBSITE = 'https://github.com/aramk/crayon-syntax-highlighter'; $CRAYON_WEBSITE = 'https://github.com/aramk/crayon-syntax-highlighter';
$CRAYON_EMAIL = 'crayon.syntax@gmail.com'; $CRAYON_EMAIL = 'crayon.syntax@gmail.com';
$CRAYON_TWITTER = 'https://twitter.com/crayonsyntax'; $CRAYON_TWITTER = 'http://twitter.com/crayonsyntax';
$CRAYON_GIT = 'https://git.icod.de/dalu/crayon-syntax-highlighter'; $CRAYON_GIT = 'http://github.com/aramk/crayon-syntax-highlighter';
$CRAYON_PLUGIN_WP = 'https://wordpress.org/plugins/crayon-syntax-highlighter/'; $CRAYON_PLUGIN_WP = 'https://wordpress.org/plugins/crayon-syntax-highlighter/';
// XXX Used to name the class // XXX Used to name the class
const CRAYON_HIGHLIGHTER = 'CrayonHighlighter'; define('CRAYON_HIGHLIGHTER', 'CrayonHighlighter');
const CRAYON_ELEMENT_CLASS = 'CrayonElement'; define('CRAYON_ELEMENT_CLASS', 'CrayonElement');
const CRAYON_SETTING_CLASS = 'CrayonSetting'; define('CRAYON_SETTING_CLASS', 'CrayonSetting');
// Directories // Directories
@ -50,81 +50,83 @@ define('CRAYON_TAG_EDITOR_DIR', crayon_s('tag-editor'));
// Paths // Paths
define("CRAYON_ROOT_PATH", crayon_pf(dirname(__FILE__))); define('CRAYON_ROOT_PATH', crayon_pf(dirname(__FILE__)));
const CRAYON_LANG_PATH = CRAYON_ROOT_PATH . CRAYON_LANG_DIR; define('CRAYON_LANG_PATH', CRAYON_ROOT_PATH . CRAYON_LANG_DIR);
const CRAYON_THEME_PATH = CRAYON_ROOT_PATH . CRAYON_THEME_DIR; define('CRAYON_THEME_PATH', CRAYON_ROOT_PATH . CRAYON_THEME_DIR);
const CRAYON_FONT_PATH = CRAYON_ROOT_PATH . CRAYON_FONT_DIR; define('CRAYON_FONT_PATH', CRAYON_ROOT_PATH . CRAYON_FONT_DIR);
const CRAYON_UTIL_PATH = CRAYON_ROOT_PATH . CRAYON_UTIL_DIR; define('CRAYON_UTIL_PATH', CRAYON_ROOT_PATH . CRAYON_UTIL_DIR);
const CRAYON_TAG_EDITOR_PATH = CRAYON_ROOT_PATH . CRAYON_UTIL_DIR . CRAYON_TAG_EDITOR_DIR; define('CRAYON_TAG_EDITOR_PATH', CRAYON_ROOT_PATH . CRAYON_UTIL_DIR . CRAYON_TAG_EDITOR_DIR);
const CRAYON_THEME_EDITOR_PATH = CRAYON_ROOT_PATH . CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR; define('CRAYON_THEME_EDITOR_PATH', CRAYON_ROOT_PATH . CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR);
// Files // Files
const CRAYON_LOG_FILE = CRAYON_ROOT_PATH . 'log.txt'; define('CRAYON_LOG_FILE', CRAYON_ROOT_PATH . 'log.txt');
const CRAYON_TOUCH_FILE = CRAYON_UTIL_PATH . 'touch.txt'; define('CRAYON_TOUCH_FILE', CRAYON_UTIL_PATH . 'touch.txt');
const CRAYON_LOG_MAX_SIZE = 50000; // Bytes define('CRAYON_LOG_MAX_SIZE', 50000); // Bytes
const CRAYON_README_FILE = CRAYON_ROOT_PATH . 'readme.txt'; define('CRAYON_README_FILE', CRAYON_ROOT_PATH . 'readme.txt');
const CRAYON_LANG_EXT = CRAYON_LANG_PATH . 'extensions.txt'; define('CRAYON_LANG_EXT', CRAYON_LANG_PATH . 'extensions.txt');
const CRAYON_LANG_ALIAS = CRAYON_LANG_PATH . 'aliases.txt'; define('CRAYON_LANG_ALIAS', CRAYON_LANG_PATH . 'aliases.txt');
const CRAYON_LANG_DELIM = CRAYON_LANG_PATH . 'delimiters.txt'; define('CRAYON_LANG_DELIM', CRAYON_LANG_PATH . 'delimiters.txt');
const CRAYON_HELP_FILE = CRAYON_UTIL_PATH . 'help.htm'; define('CRAYON_HELP_FILE', CRAYON_UTIL_PATH . 'help.htm');
// Minified // Minified
const CRAYON_JS_MIN = CRAYON_JS_MIN_DIR . 'crayon.min.js'; define('CRAYON_JS_MIN', CRAYON_JS_MIN_DIR . 'crayon.min.js');
const CRAYON_JS_TE_MIN = CRAYON_JS_MIN_DIR . 'crayon.te.min.js'; define('CRAYON_JS_TE_MIN', CRAYON_JS_MIN_DIR . 'crayon.te.min.js');
// Source // Source
const CRAYON_JQUERY_POPUP = CRAYON_JS_SRC_DIR . 'jquery.popup.js'; define('CRAYON_JQUERY_POPUP', CRAYON_JS_SRC_DIR . 'jquery.popup.js');
const CRAYON_JS = CRAYON_JS_SRC_DIR . 'crayon.js'; define('CRAYON_JS', CRAYON_JS_SRC_DIR . 'crayon.js');
const CRAYON_JS_ADMIN = CRAYON_JS_SRC_DIR . 'crayon_admin.js'; define('CRAYON_JS_ADMIN', CRAYON_JS_SRC_DIR . 'crayon_admin.js');
const CRAYON_JS_UTIL = CRAYON_JS_SRC_DIR . 'util.js'; define('CRAYON_JS_UTIL', CRAYON_JS_SRC_DIR . 'util.js');
const CRAYON_CSSJSON_JS = CRAYON_JS_SRC_DIR . 'cssjson.js'; define('CRAYON_CSSJSON_JS', CRAYON_JS_SRC_DIR . 'cssjson.js');
const CRAYON_CSS_JQUERY_COLORPICKER = CRAYON_JS_DIR . 'jquery-colorpicker/jquery.colorpicker.css'; define('CRAYON_CSS_JQUERY_COLORPICKER', CRAYON_JS_DIR . 'jquery-colorpicker/jquery.colorpicker.css');
const CRAYON_JS_JQUERY_COLORPICKER = CRAYON_JS_DIR . 'jquery-colorpicker/jquery.colorpicker.js'; define('CRAYON_JS_JQUERY_COLORPICKER', CRAYON_JS_DIR . 'jquery-colorpicker/jquery.colorpicker.js');
const CRAYON_JS_TINYCOLOR = CRAYON_JS_DIR . 'tinycolor-min.js'; define('CRAYON_JS_TINYCOLOR', CRAYON_JS_DIR . 'tinycolor-min.js');
const CRAYON_TAG_EDITOR_JS = 'crayon_tag_editor.js'; define('CRAYON_TAG_EDITOR_JS', 'crayon_tag_editor.js');
const CRAYON_COLORBOX_JS = 'colorbox/jquery.colorbox-min.js'; define('CRAYON_COLORBOX_JS', 'colorbox/jquery.colorbox-min.js');
const CRAYON_COLORBOX_CSS = 'colorbox/colorbox.css'; define('CRAYON_COLORBOX_CSS', 'colorbox/colorbox.css');
const CRAYON_TAG_EDITOR_PHP = CRAYON_TAG_EDITOR_PATH . 'crayon_tag_editor_wp.class.php'; define('CRAYON_TAG_EDITOR_PHP', CRAYON_TAG_EDITOR_PATH . 'crayon_tag_editor_wp.class.php');
const CRAYON_TINYMCE_JS = 'crayon_tinymce.js'; define('CRAYON_TINYMCE_JS', 'crayon_tinymce.js');
const CRAYON_QUICKTAGS_JS = 'crayon_qt.js'; define('CRAYON_QUICKTAGS_JS', 'crayon_qt.js');
const CRAYON_STYLE = CRAYON_CSS_SRC_DIR . 'crayon_style.css'; define('CRAYON_STYLE', CRAYON_CSS_SRC_DIR . 'crayon_style.css');
const CRAYON_STYLE_ADMIN = CRAYON_CSS_SRC_DIR . 'admin_style.css'; define('CRAYON_STYLE_ADMIN', CRAYON_CSS_SRC_DIR . 'admin_style.css');
const CRAYON_STYLE_GLOBAL = CRAYON_CSS_SRC_DIR . 'global_style.css'; define('CRAYON_STYLE_GLOBAL', CRAYON_CSS_SRC_DIR . 'global_style.css');
const CRAYON_STYLE_MIN = CRAYON_CSS_MIN_DIR . 'crayon.min.css'; define('CRAYON_STYLE_MIN', CRAYON_CSS_MIN_DIR . 'crayon.min.css');
const CRAYON_LOGO = CRAYON_CSS_DIR . 'images/crayon_logo.png'; define('CRAYON_LOGO', CRAYON_CSS_DIR . 'images/crayon_logo.png');
const CRAYON_THEME_EDITOR_PHP = CRAYON_THEME_EDITOR_PATH . 'theme_editor.php'; define('CRAYON_DONATE_BUTTON', CRAYON_CSS_DIR . 'images/donate.png');
const CRAYON_THEME_EDITOR_JS = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.js'; define('CRAYON_THEME_EDITOR_PHP', CRAYON_THEME_EDITOR_PATH . 'theme_editor.php');
const CRAYON_THEME_EDITOR_STYLE = CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.css'; define('CRAYON_THEME_EDITOR_JS', CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.js');
define('CRAYON_THEME_EDITOR_STYLE', CRAYON_UTIL_DIR . CRAYON_THEME_EDITOR_DIR . 'theme_editor.css');
define('CRAYON_THEME_EDITOR_BUTTON', CRAYON_CSS_DIR . 'images/theme_editor.png');
// PHP Files // PHP Files
const CRAYON_FORMATTER_PHP = CRAYON_ROOT_PATH . 'crayon_formatter.class.php'; define('CRAYON_FORMATTER_PHP', CRAYON_ROOT_PATH . 'crayon_formatter.class.php');
const CRAYON_HIGHLIGHTER_PHP = CRAYON_ROOT_PATH . 'crayon_highlighter.class.php'; define('CRAYON_HIGHLIGHTER_PHP', CRAYON_ROOT_PATH . 'crayon_highlighter.class.php');
const CRAYON_LANGS_PHP = CRAYON_ROOT_PATH . 'crayon_langs.class.php'; define('CRAYON_LANGS_PHP', CRAYON_ROOT_PATH . 'crayon_langs.class.php');
const CRAYON_PARSER_PHP = CRAYON_ROOT_PATH . 'crayon_parser.class.php'; define('CRAYON_PARSER_PHP', CRAYON_ROOT_PATH . 'crayon_parser.class.php');
const CRAYON_SETTINGS_PHP = CRAYON_ROOT_PATH . 'crayon_settings.class.php'; define('CRAYON_SETTINGS_PHP', CRAYON_ROOT_PATH . 'crayon_settings.class.php');
const CRAYON_THEMES_PHP = CRAYON_ROOT_PATH . 'crayon_themes.class.php'; define('CRAYON_THEMES_PHP', CRAYON_ROOT_PATH . 'crayon_themes.class.php');
const CRAYON_FONTS_PHP = CRAYON_ROOT_PATH . 'crayon_fonts.class.php'; define('CRAYON_FONTS_PHP', CRAYON_ROOT_PATH . 'crayon_fonts.class.php');
const CRAYON_RESOURCE_PHP = CRAYON_ROOT_PATH . 'crayon_resource.class.php'; define('CRAYON_RESOURCE_PHP', CRAYON_ROOT_PATH . 'crayon_resource.class.php');
const CRAYON_UTIL_PHP = CRAYON_UTIL_DIR . 'crayon_util.class.php'; define('CRAYON_UTIL_PHP', CRAYON_UTIL_DIR . 'crayon_util.class.php');
const CRAYON_TIMER_PHP = CRAYON_UTIL_DIR . 'crayon_timer.class.php'; define('CRAYON_TIMER_PHP', CRAYON_UTIL_DIR . 'crayon_timer.class.php');
const CRAYON_LOG_PHP = CRAYON_UTIL_DIR . 'crayon_log.class.php'; define('CRAYON_LOG_PHP', CRAYON_UTIL_DIR . 'crayon_log.class.php');
// Script time // Script time
const CRAYON_LOAD_TIME = 'Load Time'; define('CRAYON_LOAD_TIME', 'Load Time');
//define('CRAYON_PARSE_TIME', 'Parse Time'); //define('CRAYON_PARSE_TIME', 'Parse Time');
const CRAYON_FORMAT_TIME = 'Format Time'; define('CRAYON_FORMAT_TIME', 'Format Time');
// Printing // Printing
const CRAYON_BR = "<br />"; define('CRAYON_BR', "<br />");
const CRAYON_NL = "\r\n"; define('CRAYON_NL', "\r\n");
const CRAYON_BL = CRAYON_BR . CRAYON_NL; define('CRAYON_BL', CRAYON_BR . CRAYON_NL);
const CRAYON_DASH = "=============================================================================="; define('CRAYON_DASH', "==============================================================================");
const CRAYON_LINE = "------------------------------------------------------------------------------"; define('CRAYON_LINE', "------------------------------------------------------------------------------");
// Load utilities // Load utilities
@ -138,8 +140,7 @@ require_once(CRAYON_LOG_PHP);
// GLOBAL FUNCTIONS // GLOBAL FUNCTIONS
// Check for forwardslash/backslash in folder path to structure paths // Check for forwardslash/backslash in folder path to structure paths
function crayon_s($url = '') function crayon_s($url = '') {
{
$url = strval($url); $url = strval($url);
if (!empty($url) && !preg_match('#(\\\\|/)$#', $url)) { if (!empty($url) && !preg_match('#(\\\\|/)$#', $url)) {
return $url . '/'; return $url . '/';
@ -151,8 +152,7 @@ function crayon_s($url = '')
} }
// Returns path using forward slashes, slash added at the end // Returns path using forward slashes, slash added at the end
function crayon_pf($url, $slash = TRUE) function crayon_pf($url, $slash = TRUE) {
{
$url = trim(strval($url)); $url = trim(strval($url));
if ($slash) { if ($slash) {
$url = crayon_s($url); $url = crayon_s($url);
@ -161,14 +161,12 @@ function crayon_pf($url, $slash = TRUE)
} }
// Returns path using back slashes // Returns path using back slashes
function crayon_pb($url) function crayon_pb($url) {
{
return str_replace('/', '\\', crayon_s(trim(strval($url)))); return str_replace('/', '\\', crayon_s(trim(strval($url))));
} }
// Get/Set plugin information // Get/Set plugin information
function crayon_set_info($info_array) function crayon_set_info($info_array) {
{
global $CRAYON_VERSION, $CRAYON_DATE, $CRAYON_AUTHOR, $CRAYON_WEBSITE; global $CRAYON_VERSION, $CRAYON_DATE, $CRAYON_AUTHOR, $CRAYON_WEBSITE;
if (!is_array($info_array)) { if (!is_array($info_array)) {
return; return;
@ -179,53 +177,45 @@ function crayon_set_info($info_array)
crayon_set_info_key('PluginURI', $info_array, $CRAYON_WEBSITE); crayon_set_info_key('PluginURI', $info_array, $CRAYON_WEBSITE);
} }
function crayon_set_info_key($key, $array, &$info) function crayon_set_info_key($key, $array, &$info) {
{
if (array_key_exists($key, $array)) { if (array_key_exists($key, $array)) {
$info = $array[$key]; $info = $array[$key];
return true;
} else { } else {
return FALSE; return FALSE;
} }
} }
function crayon_vargs(&$var, $default) function crayon_vargs(&$var, $default) {
{
$var = isset($var) ? $var : $default; $var = isset($var) ? $var : $default;
} }
// Checks if the input is a valid PHP file and matches the $valid filename // Checks if the input is a valid PHP file and matches the $valid filename
function crayon_is_php_file($filepath, $valid) function crayon_is_php_file($filepath, $valid) {
{
$path = pathinfo(crayon_pf($filepath)); $path = pathinfo(crayon_pf($filepath));
return is_file($filepath) && $path['extension'] === 'php' && $path['filename'] === $valid; return is_file($filepath) && $path['extension'] === 'php' && $path['filename'] === $valid;
} }
// Stops the script if crayon_is_php_file() returns false or a remote path is given // Stops the script if crayon_is_php_file() returns false or a remote path is given
function crayon_die_if_not_php($filepath, $valid) function crayon_die_if_not_php($filepath, $valid) {
{
if (!crayon_is_php_file($filepath, $valid) || crayon_is_path_url($filepath)) { if (!crayon_is_php_file($filepath, $valid) || crayon_is_path_url($filepath)) {
die("[ERROR] '$filepath' is not a valid PHP file for '$valid'"); die("[ERROR] '$filepath' is not a valid PHP file for '$valid'");
} }
} }
function crayon_is_path_url($path) function crayon_is_path_url($path) {
{
$parts = parse_url($path); $parts = parse_url($path);
return isset($parts['scheme']) && strlen($parts['scheme']) > 1; return isset($parts['scheme']) && strlen($parts['scheme']) > 1;
} }
// LANGUAGE TRANSLATION FUNCTIONS // LANGUAGE TRANSLATION FUNCTIONS
function crayon_load_plugin_textdomain() function crayon_load_plugin_textdomain() {
{
if (function_exists('load_plugin_textdomain')) { if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain(CRAYON_DOMAIN, false, CRAYON_DIR . CRAYON_TRANS_DIR); load_plugin_textdomain(CRAYON_DOMAIN, false, CRAYON_DIR . CRAYON_TRANS_DIR);
} }
} }
function crayon__($text) function crayon__($text) {
{
if (function_exists('__')) { if (function_exists('__')) {
return __($text, CRAYON_DOMAIN); return __($text, CRAYON_DOMAIN);
} else { } else {
@ -233,8 +223,7 @@ function crayon__($text)
} }
} }
function crayon_e($text) function crayon_e($text) {
{
if (function_exists('_e')) { if (function_exists('_e')) {
_e($text, CRAYON_DOMAIN); _e($text, CRAYON_DOMAIN);
} else { } else {
@ -242,8 +231,7 @@ function crayon_e($text)
} }
} }
function crayon_n($singular, $plural, $count) function crayon_n($singular, $plural, $count) {
{
if (function_exists('_n')) { if (function_exists('_n')) {
return _n($singular, $plural, $count, CRAYON_DOMAIN); return _n($singular, $plural, $count, CRAYON_DOMAIN);
} else { } else {
@ -251,11 +239,12 @@ function crayon_n($singular, $plural, $count)
} }
} }
function crayon_x($text, $context) function crayon_x($text, $context) {
{
if (function_exists('_x')) { if (function_exists('_x')) {
return _x($text, $context, CRAYON_DOMAIN); return _x($text, $context, CRAYON_DOMAIN);
} else { } else {
return $text; return $text;
} }
} }
?>