Version Description
- Added highlight="false" attribute to temporarily disable highlighting.
- Fixed default color of font for twilight font.
=
Download this release
Release Info
Developer | akarmenia |
Plugin | Crayon Syntax Highlighter |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- crayon_highlighter.class.php +4 -0
- crayon_settings.class.php +14 -3
- crayon_wp.class.php +1 -1
- global.php +2 -2
- readme.txt +9 -2
- themes/twilight/twilight.css +1 -0
- util/help.htm +3 -1
crayon_highlighter.class.php
CHANGED
@@ -151,6 +151,10 @@ class CrayonHighlighter {
|
|
151 |
/* Sends the code to the formatter for printing. Apart from the getters and setters, this is
|
152 |
the only other function accessible outside this class. $show_lines can also be a string. */
|
153 |
function output($highlight = TRUE, $show_lines = TRUE, $print = TRUE) {
|
|
|
|
|
|
|
|
|
154 |
$this->process($highlight);
|
155 |
if (empty($this->error)) {
|
156 |
// If no errors have occured, print the formatted code
|
151 |
/* Sends the code to the formatter for printing. Apart from the getters and setters, this is
|
152 |
the only other function accessible outside this class. $show_lines can also be a string. */
|
153 |
function output($highlight = TRUE, $show_lines = TRUE, $print = TRUE) {
|
154 |
+
if ( !$this->settings->val(CrayonSettings::HIGHLIGHT) ) {
|
155 |
+
// Disable highlight
|
156 |
+
$highlight = FALSE;
|
157 |
+
}
|
158 |
$this->process($highlight);
|
159 |
if (empty($this->error)) {
|
160 |
// If no errors have occured, print the formatted code
|
crayon_settings.class.php
CHANGED
@@ -63,6 +63,7 @@ class CrayonSettings {
|
|
63 |
const ERROR_MSG_SHOW = 'error-msg-show';
|
64 |
const ERROR_MSG = 'error-msg';
|
65 |
const HIDE_HELP = 'hide-help';
|
|
|
66 |
|
67 |
// The current settings, should be loaded with default if none exists
|
68 |
private $settings = array();
|
@@ -137,7 +138,8 @@ class CrayonSettings {
|
|
137 |
new CrayonSetting(self::ERROR_LOG_SYS, TRUE),
|
138 |
new CrayonSetting(self::ERROR_MSG_SHOW, TRUE),
|
139 |
new CrayonSetting(self::ERROR_MSG, 'An error has occurred. Please try again later.'),
|
140 |
-
new CrayonSetting(self::HIDE_HELP, FALSE)
|
|
|
141 |
);
|
142 |
$this->set($settings);
|
143 |
}
|
@@ -198,6 +200,14 @@ class CrayonSettings {
|
|
198 |
return FALSE;
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
function get_array() {
|
202 |
$array = array();
|
203 |
foreach ($this->settings as $setting) {
|
@@ -415,12 +425,13 @@ class CrayonGlobalSettings {
|
|
415 |
}
|
416 |
|
417 |
public static function val($name = NULL) {
|
418 |
-
self::init();
|
419 |
if (($setting = self::get($name)) != FALSE) {
|
420 |
return $setting->value();
|
421 |
} else {
|
422 |
return NULL;
|
423 |
-
}
|
|
|
424 |
}
|
425 |
|
426 |
public static function set($name, $value = NULL, $replace = FALSE) {
|
63 |
const ERROR_MSG_SHOW = 'error-msg-show';
|
64 |
const ERROR_MSG = 'error-msg';
|
65 |
const HIDE_HELP = 'hide-help';
|
66 |
+
const HIGHLIGHT = 'highlight';
|
67 |
|
68 |
// The current settings, should be loaded with default if none exists
|
69 |
private $settings = array();
|
138 |
new CrayonSetting(self::ERROR_LOG_SYS, TRUE),
|
139 |
new CrayonSetting(self::ERROR_MSG_SHOW, TRUE),
|
140 |
new CrayonSetting(self::ERROR_MSG, 'An error has occurred. Please try again later.'),
|
141 |
+
new CrayonSetting(self::HIDE_HELP, FALSE),
|
142 |
+
new CrayonSetting(self::HIGHLIGHT, TRUE)
|
143 |
);
|
144 |
$this->set($settings);
|
145 |
}
|
200 |
return FALSE;
|
201 |
}
|
202 |
|
203 |
+
function val($name = NULL) {
|
204 |
+
if (($setting = self::get($name)) != FALSE) {
|
205 |
+
return $setting->value();
|
206 |
+
} else {
|
207 |
+
return NULL;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
function get_array() {
|
212 |
$array = array();
|
213 |
foreach ($this->settings as $setting) {
|
425 |
}
|
426 |
|
427 |
public static function val($name = NULL) {
|
428 |
+
/*self::init();
|
429 |
if (($setting = self::get($name)) != FALSE) {
|
430 |
return $setting->value();
|
431 |
} else {
|
432 |
return NULL;
|
433 |
+
}*/
|
434 |
+
return self::$global->val($name);
|
435 |
}
|
436 |
|
437 |
public static function set($name, $value = NULL, $replace = FALSE) {
|
crayon_wp.class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
-
Version: 1.0.
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
+
Version: 1.0.3
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
global.php
CHANGED
@@ -8,8 +8,8 @@ define('CRAYON_DEBUG', FALSE); // Enable to show exceptions on screen
|
|
8 |
|
9 |
$uid = CRAYON_DEBUG ? uniqid() : ''; // Prevent caching in debug mode
|
10 |
|
11 |
-
define('CRAYON_VERSION', '1.0.
|
12 |
-
define('CRAYON_DATE', '
|
13 |
define('CRAYON_AUTHOR', 'Aram Kocharyan');
|
14 |
// TODO These will be changed once I set up a site for docs
|
15 |
define('CRAYON_WEBSITE', 'http://ak.net84.net/?go=crayon');
|
8 |
|
9 |
$uid = CRAYON_DEBUG ? uniqid() : ''; // Prevent caching in debug mode
|
10 |
|
11 |
+
define('CRAYON_VERSION', '1.0.3' . $uid);
|
12 |
+
define('CRAYON_DATE', '23rd September, 2011');
|
13 |
define('CRAYON_AUTHOR', 'Aram Kocharyan');
|
14 |
// TODO These will be changed once I set up a site for docs
|
15 |
define('CRAYON_WEBSITE', 'http://ak.net84.net/?go=crayon');
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://ak.net84.net/
|
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2.1
|
7 |
-
Stable tag: 1.0.
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
@@ -48,6 +48,13 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
|
|
48 |
= 1.0.1 =
|
49 |
* Fixed a bug that caused Themes not to load for some Crayons due to Wordpress content formatting.
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
== Upgrade Notice ==
|
52 |
|
53 |
-
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2.1
|
7 |
+
Stable tag: 1.0.3
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
48 |
= 1.0.1 =
|
49 |
* Fixed a bug that caused Themes not to load for some Crayons due to Wordpress content formatting.
|
50 |
|
51 |
+
= 1.0.2 =
|
52 |
+
* Minor bug fixes.
|
53 |
+
|
54 |
+
= 1.0.3 =
|
55 |
+
* Added highlight="false" attribute to temporarily disable highlighting.
|
56 |
+
* Fixed default color of font for twilight font.
|
57 |
+
|
58 |
== Upgrade Notice ==
|
59 |
|
60 |
+
No issues upgrading.
|
themes/twilight/twilight.css
CHANGED
@@ -11,6 +11,7 @@ Author URI: http://ak.net84.net/
|
|
11 |
border: 1px #333 solid !important;
|
12 |
text-shadow: none !important;
|
13 |
background: #2d2d2d !important;
|
|
|
14 |
}
|
15 |
|
16 |
.crayon-theme-twilight span {
|
11 |
border: 1px #333 solid !important;
|
12 |
text-shadow: none !important;
|
13 |
background: #2d2d2d !important;
|
14 |
+
color: #fff;
|
15 |
}
|
16 |
|
17 |
.crayon-theme-twilight span {
|
util/help.htm
CHANGED
@@ -73,4 +73,6 @@
|
|
73 |
<p><strong>Languages</strong></p>
|
74 |
<p>You can customize and create new languages and define how to capture each element (keywords, comments, strings, etc.) with regular expressions. Languages are structured <code>/langs/lang-name/lang-name.txt</code>. Take a look at <code>/langs/default/default.txt</code> and check out the neat regex of the default/generic language. I've also spent considerable time putting together a <a href="{PLUGIN}langs/readme.txt" target="_blank">quick guide</a> in <code>/langs/readme.txt</code> that will be added to the online docs. If your language is missing, send me an <a href="#info" target="_blank">email</a>. There will be more languages added over time, of course.</p>
|
75 |
<p><strong>Fonts</strong></p>
|
76 |
-
<p>You can define fonts and font-sizes within Themes, but you can also override the theme's font with those inside <code>/fonts/</code> and also provide @font-face fonts just like in themes - it's just CSS after all.</p>
|
|
|
|
73 |
<p><strong>Languages</strong></p>
|
74 |
<p>You can customize and create new languages and define how to capture each element (keywords, comments, strings, etc.) with regular expressions. Languages are structured <code>/langs/lang-name/lang-name.txt</code>. Take a look at <code>/langs/default/default.txt</code> and check out the neat regex of the default/generic language. I've also spent considerable time putting together a <a href="{PLUGIN}langs/readme.txt" target="_blank">quick guide</a> in <code>/langs/readme.txt</code> that will be added to the online docs. If your language is missing, send me an <a href="#info" target="_blank">email</a>. There will be more languages added over time, of course.</p>
|
75 |
<p><strong>Fonts</strong></p>
|
76 |
+
<p>You can define fonts and font-sizes within Themes, but you can also override the theme's font with those inside <code>/fonts/</code> and also provide @font-face fonts just like in themes - it's just CSS after all.</p>
|
77 |
+
<p><strong>Disabling Highlight</strong></p>
|
78 |
+
<p>You can temporarily disable highlighting for a piece of code using the <code>highlight="false"</code> attribute.</p>
|