Crayon Syntax Highlighter - Version 2.6.10

Version Description

  • ADDED:
    • Option to load crayon script in the footer to improve loading performance (thanks to sumhat).
    • X3Info theme
    • Papyrus language
  • FIXED:
    • Support for nested multi-line strings in Swift language (thanks to nicolafiorillo).
    • CrayonFormatter::print_error() called non-statically (thanks to https://github.com/ksubileau)
    • Admin CSS issue: https://github.com/aramk/crayon-syntax-highlighter/issues/250.
    • Table style incompatibility with WP 2015 theme.
    • Wrapped text now breaks per character.
Download this release

Release Info

Developer akarmenia
Plugin Icon wp plugin Crayon Syntax Highlighter
Version 2.6.10
Comparing to
See all releases

Code changes from version 2.6.8 to 2.6.10

Files changed (77) hide show
  1. .gitignore +1 -1
  2. crayon-syntax-highlighter.sublime-project +12 -0
  3. crayon_formatter.class.php +2 -2
  4. crayon_highlighter.class.php +3 -1
  5. crayon_settings.class.php +917 -907
  6. crayon_settings_wp.class.php +1272 -1260
  7. crayon_wp.class.php +1341 -1334
  8. css/min/crayon.min.css +1 -1
  9. css/src/admin_style.css +1 -1
  10. css/src/crayon_style.css +11 -8
  11. js/min/crayon.te.min.js +2 -2
  12. langs/extensions.txt +1 -0
  13. langs/go/go.txt +1 -1
  14. langs/ocaml/function.txt +27 -0
  15. langs/ocaml/ocaml.txt +36 -0
  16. langs/ocaml/operator.txt +31 -0
  17. langs/ocaml/reserved.txt +52 -0
  18. langs/ocaml/type.txt +6 -0
  19. langs/papyrus/papyrus.txt +23 -0
  20. langs/papyrus/reserved.txt +28 -0
  21. langs/papyrus/statement.txt +11 -0
  22. langs/papyrus/type.txt +74 -0
  23. langs/php/compile.txt +2 -0
  24. langs/php/construct.txt +4 -0
  25. langs/ruby/ruby.txt +1 -1
  26. langs/swift/swift.txt +1 -1
  27. readme.txt +48 -3
  28. themes/1c-kod/1c-kod.css +2 -9
  29. themes/1c-zapros/1c-zapros.css +2 -9
  30. themes/809finest/809finest.css +0 -7
  31. themes/ado/ado.css +2 -5
  32. themes/arduino-ide/arduino-ide.css +0 -7
  33. themes/bncplusplus/bncplusplus.css +0 -7
  34. themes/capacitacionti/capacitacionti.css +172 -0
  35. themes/cg-cookie/cg-cookie.css +0 -7
  36. themes/cisco-router/cisco-router.css +0 -7
  37. themes/classic/classic.css +0 -7
  38. themes/coda-special-board/coda-special-board.css +0 -29
  39. themes/dark-terminal/dark-terminal.css +4 -11
  40. themes/eclipse/eclipse.css +0 -7
  41. themes/epicgeeks/epicgeeks.css +0 -29
  42. themes/familiar/familiar.css +0 -7
  43. themes/feeldesign/feeldesign.css +0 -7
  44. themes/idle/idle.css +0 -7
  45. themes/iris-vfx/iris-vfx.css +0 -7
  46. themes/mirc-dark/mirc-dark.css +0 -7
  47. themes/monokai/monokai.css +0 -7
  48. themes/neon/neon.css +0 -29
  49. themes/obsidian/obsidian.css +0 -29
  50. themes/orange-code/orange-code.css +164 -0
  51. themes/powershell-ise/powershell-ise.css +9 -16
  52. themes/pspad/pspad.css +0 -7
  53. themes/raygun/raygun.css +160 -0
  54. themes/secrets-of-rock/secrets-of-rock.css +0 -7
  55. themes/shell-default/shell-default.css +0 -7
  56. themes/solarized-dark/solarized-dark.css +0 -29
  57. themes/solarized-light/solarized-light.css +0 -29
  58. themes/son-of-obsidian/son-of-obsidian.css +0 -29
  59. themes/ssms2012/ssms2012.css +0 -7
  60. themes/sublime-text/sublime-text.css +2 -9
  61. themes/terminal/terminal.css +0 -7
  62. themes/tomorrow-night/tomorrow-night.css +0 -7
  63. themes/tomorrow/tomorrow.css +0 -7
  64. themes/turnwall/turnwall.css +0 -7
  65. themes/twilight/twilight.css +0 -29
  66. themes/visual-assist/visual-assist.css +0 -7
  67. themes/vs2012-black/vs2012-black.css +0 -7
  68. themes/vs2012/vs2012.css +0 -7
  69. themes/x3info/x3info.css +165 -0
  70. trans/Update crayon-syntax-highlighter-ar_AR.mo +0 -0
  71. trans/Update crayon-syntax-highlighter-ar_AR.po +0 -1271
  72. trans/crayon-syntax-highlighter-ar_AR.mo +0 -0
  73. trans/crayon-syntax-highlighter-ar_AR.po +63 -61
  74. util/crayon_util.class.php +15 -3
  75. util/tag-editor/crayon_qt.js +38 -34
  76. util/tag-editor/crayon_tag_editor.js +1 -1
  77. util/tag-editor/crayon_tag_editor_wp.class.php +103 -102
.gitignore CHANGED
@@ -7,5 +7,5 @@ Thumbs.db
7
  *.pyc
8
  .idea/
9
  /log.txt
10
-
11
  .c9
7
  *.pyc
8
  .idea/
9
  /log.txt
10
+ *.sublime-workspace
11
  .c9
crayon-syntax-highlighter.sublime-project ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "folders":
3
+ [
4
+ {
5
+ "follow_symlinks": true,
6
+ "path": ".",
7
+ "folder_exclude_patterns": [
8
+ "min"
9
+ ]
10
+ }
11
+ ]
12
+ }
crayon_formatter.class.php CHANGED
@@ -481,7 +481,7 @@ class CrayonFormatter {
481
  }
482
  }
483
 
484
- function print_error($hl, $error, $line_numbers = 'ERROR', $print = TRUE) {
485
  if (get_class($hl) != CRAYON_HIGHLIGHTER) {
486
  return;
487
  }
@@ -627,4 +627,4 @@ class CrayonFormatter {
627
  return ' ' . $dim_mode . ': ' . $hl->setting_val($name) . $dim_unit . ';';
628
  }
629
  }
630
- ?>
481
  }
482
  }
483
 
484
+ public static function print_error($hl, $error, $line_numbers = 'ERROR', $print = TRUE) {
485
  if (get_class($hl) != CRAYON_HIGHLIGHTER) {
486
  return;
487
  }
627
  return ' ' . $dim_mode . ': ' . $hl->setting_val($name) . $dim_unit . ';';
628
  }
629
  }
630
+ ?>
crayon_highlighter.class.php CHANGED
@@ -123,7 +123,9 @@ class CrayonHighlighter {
123
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
124
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, FALSE);
125
  curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
126
- curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
 
 
127
  $content = curl_exec($ch);
128
  $error = curl_error($ch);
129
  $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
123
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
124
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, FALSE);
125
  curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
126
+ if (isset($_SERVER['HTTP_USER_AGENT'])) {
127
+ curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
128
+ }
129
  $content = curl_exec($ch);
130
  $error = curl_error($ch);
131
  $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
crayon_settings.class.php CHANGED
@@ -1,908 +1,918 @@
1
- <?php
2
- require_once('global.php');
3
- require_once(CRAYON_PARSER_PHP);
4
- require_once(CRAYON_THEMES_PHP);
5
-
6
- /**
7
- * Stores CrayonSetting objects.
8
- * Each Crayon instance stores an instance of this class containing its specific settings.
9
- */
10
- class CrayonSettings {
11
- // Properties and Constants ===============================================
12
- const INVALID = -1; // Used for invalid dropdown index
13
- // Plugin data
14
- const VERSION = 'version';
15
-
16
- // Added when used in HTML to avoid id conflicts
17
- const PREFIX = 'crayon-';
18
- const SETTING = 'crayon-setting';
19
- const SETTING_SELECTED = 'crayon-setting-selected';
20
- const SETTING_CHANGED = 'crayon-setting-changed';
21
- const SETTING_SPECIAL = 'crayon-setting-special';
22
- const SETTING_ORIG_VALUE = 'data-orig-value';
23
-
24
- // Global names for settings
25
- const THEME = 'theme';
26
- const FONT = 'font';
27
- const FONT_SIZE_ENABLE = 'font-size-enable';
28
- const FONT_SIZE = 'font-size';
29
- const LINE_HEIGHT = 'line-height';
30
- const PREVIEW = 'preview';
31
- const HEIGHT_SET = 'height-set';
32
- const HEIGHT_MODE = 'height-mode';
33
- const HEIGHT = 'height';
34
- const HEIGHT_UNIT = 'height-unit';
35
- const WIDTH_SET = 'width-set';
36
- const WIDTH_MODE = 'width-mode';
37
- const WIDTH = 'width';
38
- const WIDTH_UNIT = 'width-unit';
39
- const TOP_SET = 'top-set';
40
- const TOP_MARGIN = 'top-margin';
41
- const LEFT_SET = 'left-set';
42
- const LEFT_MARGIN = 'left-margin';
43
- const BOTTOM_SET = 'bottom-set';
44
- const BOTTOM_MARGIN = 'bottom-margin';
45
- const RIGHT_SET = 'right-set';
46
- const RIGHT_MARGIN = 'right-margin';
47
- const H_ALIGN = 'h-align';
48
- const FLOAT_ENABLE = 'float-enable';
49
- const TOOLBAR = 'toolbar';
50
- const TOOLBAR_OVERLAY = 'toolbar-overlay';
51
- const TOOLBAR_HIDE = 'toolbar-hide';
52
- const TOOLBAR_DELAY = 'toolbar-delay';
53
- const COPY = 'copy';
54
- const POPUP = 'popup';
55
- const SHOW_LANG = 'show-lang';
56
- const SHOW_TITLE = 'show-title';
57
- const STRIPED = 'striped';
58
- const MARKING = 'marking';
59
- const START_LINE = 'start-line';
60
- const NUMS = 'nums';
61
- const NUMS_TOGGLE = 'nums-toggle';
62
- const TRIM_WHITESPACE = 'trim-whitespace';
63
- const WHITESPACE_BEFORE = 'whitespace-before';
64
- const WHITESPACE_AFTER = 'whitespace-after';
65
- const TRIM_CODE_TAG = 'trim-code-tag';
66
- const TAB_SIZE = 'tab-size';
67
- const TAB_CONVERT = 'tab-convert';
68
- const FALLBACK_LANG = 'fallback-lang';
69
- const LOCAL_PATH = 'local-path';
70
- const SCROLL = 'scroll';
71
- const PLAIN = 'plain';
72
- const PLAIN_TOGGLE = 'plain-toggle';
73
- const SHOW_PLAIN = 'show-plain';
74
- const DISABLE_RUNTIME = 'runtime';
75
- const TOUCHSCREEN = 'touchscreen';
76
- const DISABLE_ANIM = 'disable-anim';
77
- const ERROR_LOG = 'error-log';
78
- const ERROR_LOG_SYS = 'error-log-sys';
79
- const ERROR_MSG_SHOW = 'error-msg-show';
80
- const ERROR_MSG = 'error-msg';
81
- const HIDE_HELP = 'hide-help';
82
- const CACHE = 'cache';
83
- const EFFICIENT_ENQUEUE = 'efficient-enqueue';
84
- const CAPTURE_PRE = 'capture-pre';
85
- const CAPTURE_MINI_TAG = 'capture-mini-tag';
86
- const MIXED = 'mixed';
87
- const SHOW_MIXED = 'show_mixed';
88
- const PLAIN_TAG = 'plain_tag';
89
- const SHOW_PLAIN_DEFAULT = 'show-plain-default';
90
- const ENQUEUE_THEMES = 'enqueque-themes';
91
- const ENQUEUE_FONTS = 'enqueque-fonts';
92
- const MAIN_QUERY = 'main-query';
93
- const SAFE_ENQUEUE = 'safe-enqueue';
94
- const INLINE_TAG = 'inline-tag';
95
- const INLINE_TAG_CAPTURE = 'inline-tag-capture';
96
- const CODE_TAG_CAPTURE = 'code-tag-capture';
97
- const CODE_TAG_CAPTURE_TYPE = 'code-tag-capture-type';
98
- const INLINE_MARGIN = 'inline-margin';
99
- const INLINE_WRAP = 'inline-wrap';
100
- const BACKQUOTE = 'backquote';
101
- const COMMENTS = 'comments';
102
- const DECODE = 'decode';
103
- const DECODE_ATTRIBUTES = 'decode-attributes';
104
- // const TINYMCE_USED = 'tinymce-used';
105
- const ATTR_SEP = 'attr-sep';
106
- const EXCERPT_STRIP = 'excerpt-strip';
107
- const RANGES = 'ranges';
108
- const TAG_EDITOR_FRONT = 'tag-editor-front';
109
- const TAG_EDITOR_SETTINGS = 'tag-editor-front-hide';
110
- const WRAP_TOGGLE = 'wrap-toggle';
111
- const WRAP = 'wrap';
112
- const EXPAND = 'expand';
113
- const EXPAND_TOGGLE = 'expand-toggle';
114
- const MINIMIZE = 'minimize';
115
- const IGNORE = 'ignore';
116
-
117
- private static $cache_array;
118
-
119
- public static function get_cache_sec($cache) {
120
- $values = array_values(self::$cache_array);
121
- if (array_key_exists($cache, $values)) {
122
- return $values[$cache];
123
- } else {
124
- return $values[0];
125
- }
126
- }
127
-
128
- // The current settings, should be loaded with default if none exists
129
- private $settings = array();
130
-
131
- // The settings with default values
132
- private static $default = NULL;
133
-
134
- function __construct() {
135
- $this->init();
136
- }
137
-
138
- function copy() {
139
- $settings = new CrayonSettings();
140
- foreach ($this->settings as $setting) {
141
- $settings->set($setting); // Overuse of set?
142
- }
143
- return $settings;
144
- }
145
-
146
- // Methods ================================================================
147
-
148
- private function init() {
149
- global $CRAYON_VERSION;
150
-
151
- crayon_load_plugin_textdomain();
152
-
153
- self::$cache_array = array(crayon__('Hourly') => 3600, crayon__('Daily') => 86400,
154
- crayon__('Weekly') => 604800, crayon__('Monthly') => 18144000,
155
- crayon__('Immediately') => 1);
156
-
157
- $settings = array(
158
- new CrayonSetting(self::VERSION, $CRAYON_VERSION, NULL, TRUE),
159
- new CrayonSetting(self::THEME, CrayonThemes::DEFAULT_THEME),
160
- new CrayonSetting(self::FONT, CrayonFonts::DEFAULT_FONT),
161
- new CrayonSetting(self::FONT_SIZE_ENABLE, TRUE),
162
- new CrayonSetting(self::FONT_SIZE, 12),
163
- new CrayonSetting(self::LINE_HEIGHT, 15),
164
- new CrayonSetting(self::PREVIEW, TRUE),
165
- new CrayonSetting(self::HEIGHT_SET, FALSE),
166
- new CrayonSetting(self::HEIGHT_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
167
- new CrayonSetting(self::HEIGHT, '500'),
168
- new CrayonSetting(self::HEIGHT_UNIT, array(crayon__('Pixels'), crayon__('Percent'))),
169
- new CrayonSetting(self::WIDTH_SET, FALSE),
170
- new CrayonSetting(self::WIDTH_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
171
- new CrayonSetting(self::WIDTH, '500'),
172
- new CrayonSetting(self::WIDTH_UNIT, array(crayon__('Pixels'), crayon__('Percent'))),
173
- new CrayonSetting(self::TOP_SET, TRUE),
174
- new CrayonSetting(self::TOP_MARGIN, 12),
175
- new CrayonSetting(self::BOTTOM_SET, TRUE),
176
- new CrayonSetting(self::BOTTOM_MARGIN, 12),
177
- new CrayonSetting(self::LEFT_SET, FALSE),
178
- new CrayonSetting(self::LEFT_MARGIN, 12),
179
- new CrayonSetting(self::RIGHT_SET, FALSE),
180
- new CrayonSetting(self::RIGHT_MARGIN, 12),
181
- new CrayonSetting(self::H_ALIGN, array(crayon__('None'), crayon__('Left'), crayon__('Center'), crayon__('Right'))),
182
- new CrayonSetting(self::FLOAT_ENABLE, FALSE),
183
- new CrayonSetting(self::TOOLBAR, array(crayon__('On MouseOver'), crayon__('Always'), crayon__('Never'))),
184
- new CrayonSetting(self::TOOLBAR_OVERLAY, TRUE),
185
- new CrayonSetting(self::TOOLBAR_HIDE, TRUE),
186
- new CrayonSetting(self::TOOLBAR_DELAY, TRUE),
187
- new CrayonSetting(self::COPY, TRUE),
188
- new CrayonSetting(self::POPUP, TRUE),
189
- new CrayonSetting(self::SHOW_LANG, array(crayon__('When Found'), crayon__('Always'), crayon__('Never'))),
190
- new CrayonSetting(self::SHOW_TITLE, TRUE),
191
- new CrayonSetting(self::STRIPED, TRUE),
192
- new CrayonSetting(self::MARKING, TRUE),
193
- new CrayonSetting(self::START_LINE, 1),
194
- new CrayonSetting(self::NUMS, TRUE),
195
- new CrayonSetting(self::NUMS_TOGGLE, TRUE),
196
- new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
197
- new CrayonSetting(self::WHITESPACE_BEFORE, 0),
198
- new CrayonSetting(self::WHITESPACE_AFTER, 0),
199
- new CrayonSetting(self::TRIM_CODE_TAG, TRUE),
200
- new CrayonSetting(self::TAB_CONVERT, FALSE),
201
- new CrayonSetting(self::TAB_SIZE, 4),
202
- new CrayonSetting(self::FALLBACK_LANG, CrayonLangs::DEFAULT_LANG),
203
- new CrayonSetting(self::LOCAL_PATH, ''),
204
- new CrayonSetting(self::SCROLL, FALSE),
205
- new CrayonSetting(self::PLAIN, TRUE),
206
- new CrayonSetting(self::PLAIN_TOGGLE, TRUE),
207
- new CrayonSetting(self::SHOW_PLAIN_DEFAULT, FALSE),
208
- new CrayonSetting(self::SHOW_PLAIN,
209
- array(crayon__('On Double Click'), crayon__('On Single Click'), crayon__('On MouseOver'), crayon__('Disable Mouse Events'))),
210
- new CrayonSetting(self::DISABLE_ANIM, FALSE),
211
- new CrayonSetting(self::TOUCHSCREEN, TRUE),
212
- new CrayonSetting(self::DISABLE_RUNTIME, FALSE),
213
- new CrayonSetting(self::ERROR_LOG, TRUE),
214
- new CrayonSetting(self::ERROR_LOG_SYS, TRUE),
215
- new CrayonSetting(self::ERROR_MSG_SHOW, TRUE),
216
- new CrayonSetting(self::ERROR_MSG, crayon__('An error has occurred. Please try again later.')),
217
- new CrayonSetting(self::HIDE_HELP, FALSE),
218
- new CrayonSetting(self::CACHE, array_keys(self::$cache_array), 1),
219
- new CrayonSetting(self::EFFICIENT_ENQUEUE, FALSE),
220
- new CrayonSetting(self::CAPTURE_PRE, TRUE),
221
- new CrayonSetting(self::CAPTURE_MINI_TAG, FALSE),
222
- new CrayonSetting(self::MIXED, TRUE),
223
- new CrayonSetting(self::SHOW_MIXED, TRUE),
224
- new CrayonSetting(self::PLAIN_TAG, FALSE),
225
- new CrayonSetting(self::ENQUEUE_THEMES, TRUE),
226
- new CrayonSetting(self::ENQUEUE_FONTS, TRUE),
227
- new CrayonSetting(self::MAIN_QUERY, FALSE),
228
- new CrayonSetting(self::SAFE_ENQUEUE, TRUE),
229
- new CrayonSetting(self::INLINE_TAG, TRUE),
230
- new CrayonSetting(self::INLINE_TAG_CAPTURE, FALSE),
231
- new CrayonSetting(self::CODE_TAG_CAPTURE, FALSE),
232
- new CrayonSetting(self::CODE_TAG_CAPTURE_TYPE, array(crayon__('Inline Tag'), crayon__('Block Tag'))),
233
- new CrayonSetting(self::INLINE_MARGIN, 5),
234
- new CrayonSetting(self::INLINE_WRAP, TRUE),
235
- new CrayonSetting(self::BACKQUOTE, TRUE),
236
- new CrayonSetting(self::COMMENTS, TRUE),
237
- new CrayonSetting(self::DECODE, FALSE),
238
- new CrayonSetting(self::DECODE_ATTRIBUTES, TRUE),
239
- // new CrayonSetting(self::TINYMCE_USED, FALSE),
240
- new CrayonSetting(self::ATTR_SEP, array(':', '_')),
241
- new CrayonSetting(self::EXCERPT_STRIP, FALSE),
242
- new CrayonSetting(self::RANGES, TRUE),
243
- new CrayonSetting(self::TAG_EDITOR_FRONT, FALSE),
244
- new CrayonSetting(self::TAG_EDITOR_SETTINGS, TRUE),
245
- new CrayonSetting(self::WRAP_TOGGLE, TRUE),
246
- new CrayonSetting(self::WRAP, FALSE),
247
- new CrayonSetting(self::EXPAND, FALSE),
248
- new CrayonSetting(self::EXPAND_TOGGLE, TRUE),
249
- new CrayonSetting(self::MINIMIZE, FALSE)
250
- );
251
-
252
- $this->set($settings);
253
-
254
- $nonNegs = array(self::FONT_SIZE, self::LINE_HEIGHT, self::HEIGHT, self::WIDTH, self::START_LINE, self::WHITESPACE_BEFORE, self::WHITESPACE_AFTER, self::TAB_SIZE, self::INLINE_MARGIN);
255
- $intNonNegValid = new CrayonNonNegIntValidator();
256
- foreach ($nonNegs as $name) {
257
- $this->get($name)->validator($intNonNegValid);
258
- }
259
- }
260
-
261
- // Getter and Setter ======================================================
262
-
263
- // TODO this needs simplification
264
- function set($name, $value = NULL, $replace = FALSE) {
265
- // Set associative array of settings
266
- if (is_array($name)) {
267
- $keys = array_keys($name);
268
- foreach ($keys as $key) {
269
- if (is_string($key)) {
270
- // Associative value
271
- $this->set($key, $name[$key], $replace);
272
- } else if (is_int($key)) {
273
- $setting = $name[$key];
274
- $this->set($setting, NULL, $replace);
275
- }
276
- }
277
- } else if (is_string($name) && !empty($name) && $value !== NULL) {
278
- $value = CrayonSettings::validate($name, $value);
279
- if ($replace || !$this->is_setting($name)) {
280
- // Replace/Create
281
- $this->settings[$name] = new CrayonSetting($name, $value);
282
- } else {
283
- // Update
284
- $this->settings[$name]->value($value);
285
- }
286
- } else if (is_object($name) && get_class($name) == CRAYON_SETTING_CLASS) {
287
- $setting = $name; // Semantics
288
- if ($replace || !$this->is_setting($setting->name())) {
289
- // Replace/Create
290
- $this->settings[$setting->name()] = $setting->copy();
291
- } else {
292
- // Update
293
- if ($setting->is_array()) {
294
- $this->settings[$setting->name()]->index($setting->index());
295
- } else {
296
- $this->settings[$setting->name()]->value($setting->value());
297
- }
298
- }
299
- }
300
- }
301
-
302
- function get($name = NULL) {
303
- if ($name === NULL) {
304
- $copy = array();
305
- foreach ($this->settings as $name => $setting) {
306
- $copy[$name] = $setting->copy(); // Deep copy
307
- }
308
- return $copy;
309
- } else if (is_string($name)) {
310
- if ($this->is_setting($name)) {
311
- return $this->settings[$name];
312
- }
313
- }
314
- return FALSE;
315
- }
316
-
317
- function val($name = NULL) {
318
- if (($setting = self::get($name)) != FALSE) {
319
- return $setting->value();
320
- } else {
321
- return NULL;
322
- }
323
- }
324
-
325
- function val_str($name) {
326
- if (($setting = self::get($name)) != FALSE) {
327
- $def = $setting->def();
328
- $index = $setting->value();
329
- if (array_key_exists($index, $def)) {
330
- return $def[$index];
331
- } else {
332
- return NULL;
333
- }
334
- }
335
- }
336
-
337
- function get_array() {
338
- $array = array();
339
- foreach ($this->settings as $setting) {
340
- $array[$setting->name()] = $setting->value();
341
- }
342
- return $array;
343
- }
344
-
345
- function is_setting($name) {
346
- return (is_string($name) && array_key_exists($name, $this->settings));
347
- }
348
-
349
- /* Gets default settings, either as associative array of name=>value or CrayonSetting
350
- objects */
351
- public static function get_defaults($name = NULL, $objects = TRUE) {
352
- if (self::$default === NULL) {
353
- self::$default = new CrayonSettings();
354
- }
355
- if ($name === NULL) {
356
- // Get all settings
357
- if ($objects) {
358
- // Return array of objects
359
- return self::$default->get();
360
- } else {
361
- // Return associative array of name=>value
362
- $settings = self::$default->get();
363
- $defaults = array();
364
- foreach ($settings as $setting) {
365
- $defaults[$setting->name()] = $setting->value();
366
- }
367
- return $defaults;
368
- }
369
- } else {
370
- // Return specific setting
371
- if ($objects) {
372
- return self::$default->get($name);
373
- } else {
374
- return self::$default->get($name)->value();
375
- }
376
- }
377
- }
378
-
379
- public static function get_defaults_array() {
380
- return self::get_defaults(NULL, FALSE);
381
- }
382
-
383
- // Validation =============================================================
384
-
385
- /**
386
- * Validates settings coming from an HTML form and also for internal use.
387
- * This is used when saving form an HTML form to the db, and also when reading from the db
388
- * back into the global settings.
389
- * @param string $name
390
- * @param mixed $value
391
- */
392
- public static function validate($name, $value) {
393
- if (!is_string($name)) {
394
- return '';
395
- }
396
-
397
- // Type-cast to correct value for known settings
398
- if (($setting = CrayonGlobalSettings::get($name)) != FALSE) {
399
- // Booleans settings that are sent as string are allowed to have "false" == false
400
- if (is_bool($setting->def())) {
401
- if (is_string($value)) {
402
- $value = CrayonUtil::str_to_bool($value);
403
- }
404
- } else {
405
- // Ensure we don't cast integer settings to 0 because $value doesn't have any numbers in it
406
- $value = strval($value);
407
- // Only occurs when saving from the form ($_POST values are strings)
408
- if ($value == '' || ($cleaned = $setting->sanitize($value, FALSE)) == '') {
409
- // The value sent has no integers, change to default
410
- $value = $setting->def();
411
- } else {
412
- // Cleaned value is int
413
- $value = $cleaned;
414
- }
415
- // Cast all other settings as usual
416
- if (!settype($value, $setting->type())) {
417
- // If we can't cast, then use default value
418
- if ($setting->is_array()) {
419
- $value = 0; // default index
420
- } else {
421
- $value = $setting->def();
422
- }
423
- }
424
- }
425
- } else {
426
- // If setting not found, remove value
427
- return '';
428
- }
429
-
430
- switch ($name) {
431
- case CrayonSettings::LOCAL_PATH:
432
- $path = parse_url($value, PHP_URL_PATH);
433
- // Remove all spaces, prefixed and trailing forward slashes
434
- $path = preg_replace('#^/*|/*$|\s*#', '', $path);
435
- // Replace backslashes
436
- $path = preg_replace('#\\\\#', '/', $path);
437
- // Append trailing forward slash
438
- if (!empty($path)) {
439
- $path .= '/';
440
- }
441
- return $path;
442
- case CrayonSettings::FONT_SIZE:
443
- if ($value < 1) {
444
- $value = 1;
445
- }
446
- break;
447
- case CrayonSettings::LINE_HEIGHT:
448
- $font_size = CrayonGlobalSettings::val(CrayonSettings::FONT_SIZE);
449
- $value = $value >= $font_size ? $value : $font_size;
450
- break;
451
- case CrayonSettings::THEME:
452
- $value = strtolower($value);
453
- // XXX validate settings here
454
- }
455
-
456
- // If no validation occurs, return value
457
- return $value;
458
- }
459
-
460
- // Takes an associative array of "smart settings" and regular settings. Smart settings can be used
461
- // to configure regular settings quickly.
462
- // E.g. 'max_height="20px"' will set 'height="20"', 'height_mode="0", height_unit="0"'
463
- public static function smart_settings($settings) {
464
- if (!is_array($settings)) {
465
- return FALSE;
466
- }
467
-
468
- // If a setting is given, it is automatically enabled
469
- foreach ($settings as $name => $value) {
470
- if (($setting = CrayonGlobalSettings::get($name)) !== FALSE && is_bool($setting->def())) {
471
- $value = CrayonUtil::str_to_bool($value);
472
- }
473
-
474
- // XXX removed height and width, since it wasn't using the global settings for mode if only height was provided
475
- if ($name == 'min-height' || $name == 'max-height' /* || $name == 'height'*/) {
476
- self::smart_hw($name, CrayonSettings::HEIGHT_SET, CrayonSettings::HEIGHT_MODE, CrayonSettings::HEIGHT_UNIT, $settings);
477
- } else if ($name == 'min-width' || $name == 'max-width' /* || $name == 'width'*/) {
478
- self::smart_hw($name, CrayonSettings::WIDTH_SET, CrayonSettings::WIDTH_MODE, CrayonSettings::WIDTH_UNIT, $settings);
479
- } else if ($name == CrayonSettings::FONT_SIZE) {
480
- $settings[CrayonSettings::FONT_SIZE_ENABLE] = TRUE;
481
- } else if ($name == CrayonSettings::TOP_MARGIN) {
482
- $settings[CrayonSettings::TOP_SET] = TRUE;
483
- } else if ($name == CrayonSettings::LEFT_MARGIN) {
484
- $settings[CrayonSettings::LEFT_SET] = TRUE;
485
- } else if ($name == CrayonSettings::BOTTOM_MARGIN) {
486
- $settings[CrayonSettings::BOTTOM_SET] = TRUE;
487
- } else if ($name == CrayonSettings::RIGHT_MARGIN) {
488
- $settings[CrayonSettings::RIGHT_SET] = TRUE;
489
- } else if ($name == CrayonSettings::ERROR_MSG) {
490
- $settings[CrayonSettings::ERROR_MSG_SHOW] = TRUE;
491
- } else if ($name == CrayonSettings::H_ALIGN) {
492
- $settings[CrayonSettings::FLOAT_ENABLE] = TRUE;
493
- $value = CrayonUtil::tlower($value);
494
- $values = array('none' => 0, 'left' => 1, 'center' => 2, 'right' => 3);
495
- if (array_key_exists($value, $values)) {
496
- $settings[CrayonSettings::H_ALIGN] = $values[$value];
497
- }
498
- } else if ($name == CrayonSettings::SHOW_LANG) {
499
- $value = CrayonUtil::tlower($value);
500
- $values = array('found' => 0, 'always' => 1, 'true' => 1, 'never' => 2, 'false' => 2);
501
- if (array_key_exists($value, $values)) {
502
- $settings[CrayonSettings::SHOW_LANG] = $values[$value];
503
- }
504
- } else if ($name == CrayonSettings::TOOLBAR) {
505
- if (CrayonUtil::tlower($value) == 'always') {
506
- $settings[CrayonSettings::TOOLBAR] = 1;
507
- } else if (CrayonUtil::str_to_bool($value) === FALSE) {
508
- $settings[CrayonSettings::TOOLBAR] = 2;
509
- }
510
- }
511
- }
512
-
513
- return $settings;
514
- }
515
-
516
- // Used for height and width smart settings, I couldn't bear to copy paste code twice...
517
- private static function smart_hw($name, $set, $mode, $unit, &$settings) {
518
- if (!is_string($name) || !is_string($set) || !is_string($mode) || !is_string($unit) || !is_array($settings)) {
519
- return;
520
- }
521
- $settings[$set] = TRUE;
522
- if (strpos($name, 'max-') !== FALSE) {
523
- $settings[$mode] = 0;
524
- } else if (strpos($name, 'min-') !== FALSE) {
525
- $settings[$mode] = 1;
526
- } else {
527
- $settings[$mode] = 2;
528
- }
529
- preg_match('#(\d+)\s*([^\s]*)#', $settings[$name], $match);
530
- if (count($match) == 3) {
531
- $name = str_replace(array('max-', 'min-'), '', $name);
532
- $settings[$name] = $match[1];
533
- switch (strtolower($match[2])) {
534
- case 'px':
535
- $settings[$unit] = 0;
536
- break;
537
- case '%':
538
- $settings[$unit] = 1;
539
- break;
540
- }
541
- }
542
- }
543
- }
544
-
545
- /**
546
- * Stores global/static copy of CrayonSettings loaded from db.
547
- * These settings can be overriden by individual Crayons.
548
- * Also manages global site settings and paths.
549
- */
550
- class CrayonGlobalSettings {
551
- // The global settings stored as a CrayonSettings object.
552
- private static $global = NULL;
553
- /* These are used to load local files reliably and prevent scripts like PHP from executing
554
- when attempting to load their code. */
555
- // The URL of the site (eg. http://localhost/example/)
556
- private static $site_http = '';
557
- // The absolute root directory of the site (eg. /User/example/)
558
- private static $site_path = '';
559
- // The absolute root directory of the plugins (eg. /User/example/plugins)
560
- private static $plugin_path = '';
561
- private static $upload_path = '';
562
- private static $upload_url = '';
563
- private static $mkdir = NULL;
564
-
565
- private function __construct() {
566
- }
567
-
568
- private static function init() {
569
- if (self::$global === NULL) {
570
- self::$global = new CrayonSettings();
571
- }
572
- }
573
-
574
- public static function get($name = NULL) {
575
- self::init();
576
- return self::$global->get($name);
577
- }
578
-
579
- public static function get_array() {
580
- self::init();
581
- return self::$global->get_array();
582
- }
583
-
584
- public static function get_obj() {
585
- self::init();
586
- return self::$global->copy();
587
- }
588
-
589
- public static function val($name = NULL) {
590
- self::init();
591
- return self::$global->val($name);
592
- }
593
-
594
- public static function val_str($name = NULL) {
595
- self::init();
596
- return self::$global->val_str($name);
597
- }
598
-
599
- public static function has_changed($input, $setting, $value) {
600
- return $input == $setting && $value != CrayonGlobalSettings::val($setting);
601
- }
602
-
603
- public static function set($name, $value = NULL, $replace = FALSE) {
604
- self::init();
605
- self::$global->set($name, $value, $replace);
606
- }
607
-
608
- public static function site_url($site_http = NULL) {
609
- if ($site_http === NULL) {
610
- return self::$site_http;
611
- } else {
612
- self::$site_http = CrayonUtil::url_slash($site_http);
613
- }
614
- }
615
-
616
- public static function site_path($site_path = NULL) {
617
- if ($site_path === NULL) {
618
- return self::$site_path;
619
- } else {
620
- self::$site_path = CrayonUtil::path_slash($site_path);
621
- }
622
- }
623
-
624
- public static function plugin_path($plugin_path = NULL) {
625
- if ($plugin_path === NULL) {
626
- return self::$plugin_path;
627
- } else {
628
- self::$plugin_path = CrayonUtil::path_slash($plugin_path);
629
- }
630
- }
631
-
632
- public static function upload_path($upload_path = NULL) {
633
- if ($upload_path === NULL) {
634
- return self::$upload_path;
635
- } else {
636
- self::$upload_path = CrayonUtil::path_slash($upload_path);
637
- }
638
- }
639
-
640
- public static function upload_url($upload_url = NULL) {
641
- if ($upload_url === NULL) {
642
- return self::$upload_url;
643
- } else {
644
- self::$upload_url = CrayonUtil::url_slash($upload_url);
645
- }
646
- }
647
-
648
- public static function set_mkdir($mkdir = NULL) {
649
- if ($mkdir === NULL) {
650
- return self::$mkdir;
651
- } else {
652
- self::$mkdir = $mkdir;
653
- }
654
- }
655
-
656
- public static function mkdir($dir = NULL) {
657
- if (self::$mkdir) {
658
- call_user_func(self::$mkdir, $dir);
659
- } else {
660
- @mkdir($dir, 0777, TRUE);
661
- }
662
- }
663
- }
664
-
665
-
666
- $INT = new CrayonValidator('#\d+#');
667
-
668
- /**
669
- * Validation class.
670
- */
671
- class CrayonValidator {
672
- private $pattern = '#*#msi';
673
-
674
- public function __construct($pattern) {
675
- $this->pattern($pattern);
676
- }
677
-
678
- public function pattern($pattern) {
679
- if ($pattern === NULL) {
680
- return $pattern;
681
- } else {
682
- $this->pattern = $pattern;
683
- }
684
- }
685
-
686
- public function validate($str) {
687
- return preg_match($this->pattern, $str) !== FALSE;
688
- }
689
-
690
- public function sanitize($str) {
691
- preg_match_all($this->pattern, $str, $matches);
692
- $result = '';
693
- foreach ($matches as $match) {
694
- $result .= $match[0];
695
- }
696
- return $result;
697
- }
698
- }
699
-
700
- class CrayonNonNegIntValidator extends CrayonValidator {
701
- public function __construct() {
702
- parent::__construct('#\d+#');
703
- }
704
- }
705
-
706
- class CrayonIntValidator extends CrayonValidator {
707
- public function __construct() {
708
- parent::__construct('#-?\d+#');
709
- }
710
- }
711
-
712
- /**
713
- * Individual setting.
714
- * Can store boolean, string, dropdown (with array of strings), etc.
715
- */
716
- class CrayonSetting {
717
- private $name = '';
718
- /* The type of variables that can be set as the value.
719
- * For dropdown settings, value is int, even though value() will return a string. */
720
- private $type = NULL;
721
- private $default = NULL; // stores string array for dropdown settings
722
-
723
- private $value = NULL; // stores index int for dropdown settings
724
-
725
- private $is_array = FALSE; // only TRUE for dropdown settings
726
- private $locked = FALSE;
727
-
728
- private $validator = NULL;
729
-
730
-
731
- public function __construct($name, $default = '', $value = NULL, $locked = NULL) {
732
- $this->name($name);
733
- if ($default !== NULL) {
734
- $this->def($default); // Perform first to set type
735
- }
736
- if ($value !== NULL) {
737
- $this->value($value);
738
- }
739
- if ($locked !== NULL) {
740
- $this->locked($locked);
741
- }
742
- }
743
-
744
- function __tostring() {
745
- return $this->name;
746
- }
747
-
748
- function copy() {
749
- return new CrayonSetting($this->name, $this->default, $this->value, $this->locked);
750
- }
751
-
752
- function name($name = NULL) {
753
- if (!CrayonUtil::str($this->name, $name)) {
754
- return $this->name;
755
- }
756
- }
757
-
758
- function type() {
759
- return $this->type;
760
- }
761
-
762
- function is_array() {
763
- return $this->is_array;
764
- }
765
-
766
- function locked($locked = NULL) {
767
- if ($locked === NULL) {
768
- return $this->locked;
769
- } else {
770
- $this->locked = ($locked == TRUE);
771
- }
772
- }
773
-
774
- /**
775
- * Sets/gets value;
776
- * Value is index (int) in default value (array) for dropdown settings.
777
- * value($value) is alias for index($index) if dropdown setting.
778
- * value() returns string value at current index for dropdown settings.
779
- * @param $value
780
- */
781
- function value($value = NULL) {
782
- if ($value === NULL) {
783
- /*if ($this->is_array) {
784
- return $this->default[$this->value]; // value at index
785
- } else */
786
- if ($this->value !== NULL) {
787
- return $this->value;
788
- } else {
789
- if ($this->is_array) {
790
- return 0;
791
- } else {
792
- return $this->default;
793
- }
794
- }
795
- } else if ($this->locked === FALSE) {
796
- if ($this->is_array) {
797
- $this->index($value); // $value is index
798
- } else {
799
- settype($value, $this->type); // Type cast
800
- $this->value = $value;
801
- }
802
- }
803
- }
804
-
805
- function array_value() {
806
- if ($this->is_array) {
807
- return NULL;
808
- }
809
- return $this->default[$this->value];
810
- }
811
-
812
- /**
813
- * Sets/gets default value.
814
- * For dropdown settings, default value is array of all possible value strings.
815
- * @param $default
816
- */
817
- function def($default = NULL) {
818
- // Only allow default to be set once
819
-
820
- if ($this->type === NULL && $default !== NULL) {
821
- // For dropdown settings
822
-
823
- if (is_array($default)) { // The only time we don't use $this->is_array
824
-
825
- // If empty, set to blank array
826
-
827
- if (empty($default)) {
828
- $default = array('');
829
- } else {
830
- // Ensure all values are unique strings
831
-
832
- $default = CrayonUtil::array_unique_str($default);
833
- }
834
- $this->value = 0; // initial index
835
-
836
- $this->is_array = TRUE;
837
- $this->type = gettype(0); // Type is int (index)
838
-
839
- } else {
840
- $this->is_array = FALSE;
841
- $this->type = gettype($default);
842
- if (is_int($default)) {
843
- $this->validator(new CrayonIntValidator());
844
- }
845
- }
846
- $this->default = $default;
847
- } else {
848
- return $this->default;
849
- }
850
- }
851
-
852
- /**
853
- * Sets/gets index.
854
- * @param int|string $index
855
- * @return FALSE if not dropdown setting
856
- */
857
- function index($index = NULL) {
858
- if (!$this->is_array) {
859
- return FALSE;
860
- } else if ($index === NULL) {
861
- return $this->value; // return current index
862
- } else {
863
- if (!is_int($index)) {
864
- // Ensure $value is int for index
865
- $index = intval($index);
866
- }
867
- // Validate index
868
- if ($index < 0 || $index > count($this->default) - 1) {
869
- $index = 0;
870
- }
871
- $this->value = $index;
872
- }
873
- }
874
-
875
- /**
876
- * Finds the index of a string in an array setting
877
- */
878
- function find_index($str) {
879
- if (!$this->is_array || is_string($str)) {
880
- return FALSE;
881
- }
882
- for ($i = 0; $i < count($this->default); $i++) {
883
- if ($this->default[$i] == $str) {
884
- return $i;
885
- }
886
- }
887
- return FALSE;
888
- }
889
-
890
- function validator($validator) {
891
- if ($validator === NULL) {
892
- return $this->validator;
893
- } else {
894
- $this->validator = $validator;
895
- }
896
- }
897
-
898
- function sanitize($str) {
899
- if ($this->validator != NULL) {
900
- return $this->validator->sanitize($str);
901
- } else {
902
- return $str;
903
- }
904
- }
905
-
906
- }
907
-
 
 
 
 
 
 
 
 
 
 
908
  ?>
1
+ <?php
2
+ require_once('global.php');
3
+ require_once(CRAYON_PARSER_PHP);
4
+ require_once(CRAYON_THEMES_PHP);
5
+
6
+ /**
7
+ * Stores CrayonSetting objects.
8
+ * Each Crayon instance stores an instance of this class containing its specific settings.
9
+ */
10
+ class CrayonSettings {
11
+ // Properties and Constants ===============================================
12
+ const INVALID = -1; // Used for invalid dropdown index
13
+ // Plugin data
14
+ const VERSION = 'version';
15
+
16
+ // Added when used in HTML to avoid id conflicts
17
+ const PREFIX = 'crayon-';
18
+ const SETTING = 'crayon-setting';
19
+ const SETTING_SELECTED = 'crayon-setting-selected';
20
+ const SETTING_CHANGED = 'crayon-setting-changed';
21
+ const SETTING_SPECIAL = 'crayon-setting-special';
22
+ const SETTING_ORIG_VALUE = 'data-orig-value';
23
+
24
+ // Global names for settings
25
+ const THEME = 'theme';
26
+ const FONT = 'font';
27
+ const FONT_SIZE_ENABLE = 'font-size-enable';
28
+ const FONT_SIZE = 'font-size';
29
+ const LINE_HEIGHT = 'line-height';
30
+ const PREVIEW = 'preview';
31
+ const HEIGHT_SET = 'height-set';
32
+ const HEIGHT_MODE = 'height-mode';
33
+ const HEIGHT = 'height';
34
+ const HEIGHT_UNIT = 'height-unit';
35
+ const WIDTH_SET = 'width-set';
36
+ const WIDTH_MODE = 'width-mode';
37
+ const WIDTH = 'width';
38
+ const WIDTH_UNIT = 'width-unit';
39
+ const TOP_SET = 'top-set';
40
+ const TOP_MARGIN = 'top-margin';
41
+ const LEFT_SET = 'left-set';
42
+ const LEFT_MARGIN = 'left-margin';
43
+ const BOTTOM_SET = 'bottom-set';
44
+ const BOTTOM_MARGIN = 'bottom-margin';
45
+ const RIGHT_SET = 'right-set';
46
+ const RIGHT_MARGIN = 'right-margin';
47
+ const H_ALIGN = 'h-align';
48
+ const FLOAT_ENABLE = 'float-enable';
49
+ const TOOLBAR = 'toolbar';
50
+ const TOOLBAR_OVERLAY = 'toolbar-overlay';
51
+ const TOOLBAR_HIDE = 'toolbar-hide';
52
+ const TOOLBAR_DELAY = 'toolbar-delay';
53
+ const COPY = 'copy';
54
+ const POPUP = 'popup';
55
+ const SHOW_LANG = 'show-lang';
56
+ const SHOW_TITLE = 'show-title';
57
+ const STRIPED = 'striped';
58
+ const MARKING = 'marking';
59
+ const START_LINE = 'start-line';
60
+ const NUMS = 'nums';
61
+ const NUMS_TOGGLE = 'nums-toggle';
62
+ const TRIM_WHITESPACE = 'trim-whitespace';
63
+ const WHITESPACE_BEFORE = 'whitespace-before';
64
+ const WHITESPACE_AFTER = 'whitespace-after';
65
+ const TRIM_CODE_TAG = 'trim-code-tag';
66
+ const TAB_SIZE = 'tab-size';
67
+ const TAB_CONVERT = 'tab-convert';
68
+ const FALLBACK_LANG = 'fallback-lang';
69
+ const LOCAL_PATH = 'local-path';
70
+ const SCROLL = 'scroll';
71
+ const PLAIN = 'plain';
72
+ const PLAIN_TOGGLE = 'plain-toggle';
73
+ const SHOW_PLAIN = 'show-plain';
74
+ const DISABLE_RUNTIME = 'runtime';
75
+ const DISABLE_DATE = 'disable-date';
76
+ const TOUCHSCREEN = 'touchscreen';
77
+ const DISABLE_ANIM = 'disable-anim';
78
+ const ERROR_LOG = 'error-log';
79
+ const ERROR_LOG_SYS = 'error-log-sys';
80
+ const ERROR_MSG_SHOW = 'error-msg-show';
81
+ const ERROR_MSG = 'error-msg';
82
+ const HIDE_HELP = 'hide-help';
83
+ const CACHE = 'cache';
84
+ const EFFICIENT_ENQUEUE = 'efficient-enqueue';
85
+ const CAPTURE_PRE = 'capture-pre';
86
+ const CAPTURE_MINI_TAG = 'capture-mini-tag';
87
+ const MIXED = 'mixed';
88
+ const SHOW_MIXED = 'show_mixed';
89
+ const PLAIN_TAG = 'plain_tag';
90
+ const SHOW_PLAIN_DEFAULT = 'show-plain-default';
91
+ const ENQUEUE_THEMES = 'enqueque-themes';
92
+ const ENQUEUE_FONTS = 'enqueque-fonts';
93
+ const MAIN_QUERY = 'main-query';
94
+ const SAFE_ENQUEUE = 'safe-enqueue';
95
+ const INLINE_TAG = 'inline-tag';
96
+ const INLINE_TAG_CAPTURE = 'inline-tag-capture';
97
+ const CODE_TAG_CAPTURE = 'code-tag-capture';
98
+ const CODE_TAG_CAPTURE_TYPE = 'code-tag-capture-type';
99
+ const INLINE_MARGIN = 'inline-margin';
100
+ const INLINE_WRAP = 'inline-wrap';
101
+ const BACKQUOTE = 'backquote';
102
+ const COMMENTS = 'comments';
103
+ const DECODE = 'decode';
104
+ const DECODE_ATTRIBUTES = 'decode-attributes';
105
+ // const TINYMCE_USED = 'tinymce-used';
106
+ const ATTR_SEP = 'attr-sep';
107
+ const EXCERPT_STRIP = 'excerpt-strip';
108
+ const RANGES = 'ranges';
109
+ const TAG_EDITOR_FRONT = 'tag-editor-front';
110
+ const TAG_EDITOR_SETTINGS = 'tag-editor-front-hide';
111
+ const TAG_EDITOR_ADD_BUTTON_TEXT = 'tag-editor-button-add-text';
112
+ const TAG_EDITOR_EDIT_BUTTON_TEXT = 'tag-editor-button-edit-text';
113
+ const TAG_EDITOR_QUICKTAG_BUTTON_TEXT = 'tag-editor-quicktag-button-text';
114
+ const WRAP_TOGGLE = 'wrap-toggle';
115
+ const WRAP = 'wrap';
116
+ const EXPAND = 'expand';
117
+ const EXPAND_TOGGLE = 'expand-toggle';
118
+ const MINIMIZE = 'minimize';
119
+ const IGNORE = 'ignore';
120
+ const DELAY_LOAD_JS = 'delay-load-js';
121
+
122
+ private static $cache_array;
123
+
124
+ public static function get_cache_sec($cache) {
125
+ $values = array_values(self::$cache_array);
126
+ if (array_key_exists($cache, $values)) {
127
+ return $values[$cache];
128
+ } else {
129
+ return $values[0];
130
+ }
131
+ }
132
+
133
+ // The current settings, should be loaded with default if none exists
134
+ private $settings = array();
135
+
136
+ // The settings with default values
137
+ private static $default = NULL;
138
+
139
+ function __construct() {
140
+ $this->init();
141
+ }
142
+
143
+ function copy() {
144
+ $settings = new CrayonSettings();
145
+ foreach ($this->settings as $setting) {
146
+ $settings->set($setting); // Overuse of set?
147
+ }
148
+ return $settings;
149
+ }
150
+
151
+ // Methods ================================================================
152
+
153
+ private function init() {
154
+ global $CRAYON_VERSION;
155
+
156
+ crayon_load_plugin_textdomain();
157
+
158
+ self::$cache_array = array(crayon__('Hourly') => 3600, crayon__('Daily') => 86400,
159
+ crayon__('Weekly') => 604800, crayon__('Monthly') => 18144000,
160
+ crayon__('Immediately') => 1);
161
+
162
+ $settings = array(
163
+ new CrayonSetting(self::VERSION, $CRAYON_VERSION, NULL, TRUE),
164
+ new CrayonSetting(self::THEME, CrayonThemes::DEFAULT_THEME),
165
+ new CrayonSetting(self::FONT, CrayonFonts::DEFAULT_FONT),
166
+ new CrayonSetting(self::FONT_SIZE_ENABLE, TRUE),
167
+ new CrayonSetting(self::FONT_SIZE, 12),
168
+ new CrayonSetting(self::LINE_HEIGHT, 15),
169
+ new CrayonSetting(self::PREVIEW, TRUE),
170
+ new CrayonSetting(self::HEIGHT_SET, FALSE),
171
+ new CrayonSetting(self::HEIGHT_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
172
+ new CrayonSetting(self::HEIGHT, '500'),
173
+ new CrayonSetting(self::HEIGHT_UNIT, array(crayon__('Pixels'), crayon__('Percent'))),
174
+ new CrayonSetting(self::WIDTH_SET, FALSE),
175
+ new CrayonSetting(self::WIDTH_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
176
+ new CrayonSetting(self::WIDTH, '500'),
177
+ new CrayonSetting(self::WIDTH_UNIT, array(crayon__('Pixels'), crayon__('Percent'))),
178
+ new CrayonSetting(self::TOP_SET, TRUE),
179
+ new CrayonSetting(self::TOP_MARGIN, 12),
180
+ new CrayonSetting(self::BOTTOM_SET, TRUE),
181
+ new CrayonSetting(self::BOTTOM_MARGIN, 12),
182
+ new CrayonSetting(self::LEFT_SET, FALSE),
183
+ new CrayonSetting(self::LEFT_MARGIN, 12),
184
+ new CrayonSetting(self::RIGHT_SET, FALSE),
185
+ new CrayonSetting(self::RIGHT_MARGIN, 12),
186
+ new CrayonSetting(self::H_ALIGN, array(crayon__('None'), crayon__('Left'), crayon__('Center'), crayon__('Right'))),
187
+ new CrayonSetting(self::FLOAT_ENABLE, FALSE),
188
+ new CrayonSetting(self::TOOLBAR, array(crayon__('On MouseOver'), crayon__('Always'), crayon__('Never'))),
189
+ new CrayonSetting(self::TOOLBAR_OVERLAY, TRUE),
190
+ new CrayonSetting(self::TOOLBAR_HIDE, TRUE),
191
+ new CrayonSetting(self::TOOLBAR_DELAY, TRUE),
192
+ new CrayonSetting(self::COPY, TRUE),
193
+ new CrayonSetting(self::POPUP, TRUE),
194
+ new CrayonSetting(self::SHOW_LANG, array(crayon__('When Found'), crayon__('Always'), crayon__('Never'))),
195
+ new CrayonSetting(self::SHOW_TITLE, TRUE),
196
+ new CrayonSetting(self::STRIPED, TRUE),
197
+ new CrayonSetting(self::MARKING, TRUE),
198
+ new CrayonSetting(self::START_LINE, 1),
199
+ new CrayonSetting(self::NUMS, TRUE),
200
+ new CrayonSetting(self::NUMS_TOGGLE, TRUE),
201
+ new CrayonSetting(self::TRIM_WHITESPACE, TRUE),
202
+ new CrayonSetting(self::WHITESPACE_BEFORE, 0),
203
+ new CrayonSetting(self::WHITESPACE_AFTER, 0),
204
+ new CrayonSetting(self::TRIM_CODE_TAG, TRUE),
205
+ new CrayonSetting(self::TAB_CONVERT, FALSE),
206
+ new CrayonSetting(self::TAB_SIZE, 4),
207
+ new CrayonSetting(self::FALLBACK_LANG, CrayonLangs::DEFAULT_LANG),
208
+ new CrayonSetting(self::LOCAL_PATH, ''),
209
+ new CrayonSetting(self::SCROLL, FALSE),
210
+ new CrayonSetting(self::PLAIN, TRUE),
211
+ new CrayonSetting(self::PLAIN_TOGGLE, TRUE),
212
+ new CrayonSetting(self::SHOW_PLAIN_DEFAULT, FALSE),
213
+ new CrayonSetting(self::SHOW_PLAIN,
214
+ array(crayon__('On Double Click'), crayon__('On Single Click'), crayon__('On MouseOver'), crayon__('Disable Mouse Events'))),
215
+ new CrayonSetting(self::DISABLE_ANIM, FALSE),
216
+ new CrayonSetting(self::TOUCHSCREEN, TRUE),
217
+ new CrayonSetting(self::DISABLE_RUNTIME, FALSE),
218
+ new CrayonSetting(self::DISABLE_DATE, ''),
219
+ new CrayonSetting(self::ERROR_LOG, TRUE),
220
+ new CrayonSetting(self::ERROR_LOG_SYS, TRUE),
221
+ new CrayonSetting(self::ERROR_MSG_SHOW, TRUE),
222
+ new CrayonSetting(self::ERROR_MSG, crayon__('An error has occurred. Please try again later.')),
223
+ new CrayonSetting(self::HIDE_HELP, FALSE),
224
+ new CrayonSetting(self::CACHE, array_keys(self::$cache_array), 1),
225
+ new CrayonSetting(self::EFFICIENT_ENQUEUE, FALSE),
226
+ new CrayonSetting(self::CAPTURE_PRE, TRUE),
227
+ new CrayonSetting(self::CAPTURE_MINI_TAG, FALSE),
228
+ new CrayonSetting(self::MIXED, TRUE),
229
+ new CrayonSetting(self::SHOW_MIXED, TRUE),
230
+ new CrayonSetting(self::PLAIN_TAG, FALSE),
231
+ new CrayonSetting(self::ENQUEUE_THEMES, TRUE),
232
+ new CrayonSetting(self::ENQUEUE_FONTS, TRUE),
233
+ new CrayonSetting(self::MAIN_QUERY, FALSE),
234
+ new CrayonSetting(self::SAFE_ENQUEUE, TRUE),
235
+ new CrayonSetting(self::INLINE_TAG, TRUE),
236
+ new CrayonSetting(self::INLINE_TAG_CAPTURE, FALSE),
237
+ new CrayonSetting(self::CODE_TAG_CAPTURE, FALSE),
238
+ new CrayonSetting(self::CODE_TAG_CAPTURE_TYPE, array(crayon__('Inline Tag'), crayon__('Block Tag'))),
239
+ new CrayonSetting(self::INLINE_MARGIN, 5),
240
+ new CrayonSetting(self::INLINE_WRAP, TRUE),
241
+ new CrayonSetting(self::BACKQUOTE, TRUE),
242
+ new CrayonSetting(self::COMMENTS, TRUE),
243
+ new CrayonSetting(self::DECODE, FALSE),
244
+ new CrayonSetting(self::DECODE_ATTRIBUTES, TRUE),
245
+ // new CrayonSetting(self::TINYMCE_USED, FALSE),
246
+ new CrayonSetting(self::ATTR_SEP, array(':', '_')),
247
+ new CrayonSetting(self::EXCERPT_STRIP, FALSE),
248
+ new CrayonSetting(self::RANGES, TRUE),
249
+ new CrayonSetting(self::TAG_EDITOR_FRONT, FALSE),
250
+ new CrayonSetting(self::TAG_EDITOR_SETTINGS, TRUE),
251
+ new CrayonSetting(self::TAG_EDITOR_ADD_BUTTON_TEXT, crayon__('Add Code')),
252
+ new CrayonSetting(self::TAG_EDITOR_EDIT_BUTTON_TEXT, crayon__('Edit Code')),
253
+ new CrayonSetting(self::TAG_EDITOR_QUICKTAG_BUTTON_TEXT, 'crayon'),
254
+ new CrayonSetting(self::WRAP_TOGGLE, TRUE),
255
+ new CrayonSetting(self::WRAP, FALSE),
256
+ new CrayonSetting(self::EXPAND, FALSE),
257
+ new CrayonSetting(self::EXPAND_TOGGLE, TRUE),
258
+ new CrayonSetting(self::MINIMIZE, FALSE),
259
+ new CrayonSetting(self::DELAY_LOAD_JS, FALSE)
260
+ );
261
+
262
+ $this->set($settings);
263
+
264
+ $nonNegs = array(self::FONT_SIZE, self::LINE_HEIGHT, self::HEIGHT, self::WIDTH, self::START_LINE, self::WHITESPACE_BEFORE, self::WHITESPACE_AFTER, self::TAB_SIZE, self::INLINE_MARGIN);
265
+ $intNonNegValid = new CrayonNonNegIntValidator();
266
+ foreach ($nonNegs as $name) {
267
+ $this->get($name)->validator($intNonNegValid);
268
+ }
269
+ }
270
+
271
+ // Getter and Setter ======================================================
272
+
273
+ // TODO this needs simplification
274
+ function set($name, $value = NULL, $replace = FALSE) {
275
+ // Set associative array of settings
276
+ if (is_array($name)) {
277
+ $keys = array_keys($name);
278
+ foreach ($keys as $key) {
279
+ if (is_string($key)) {
280
+ // Associative value
281
+ $this->set($key, $name[$key], $replace);
282
+ } else if (is_int($key)) {
283
+ $setting = $name[$key];
284
+ $this->set($setting, NULL, $replace);
285
+ }
286
+ }
287
+ } else if (is_string($name) && !empty($name) && $value !== NULL) {
288
+ $value = CrayonSettings::validate($name, $value);
289
+ if ($replace || !$this->is_setting($name)) {
290
+ // Replace/Create
291
+ $this->settings[$name] = new CrayonSetting($name, $value);
292
+ } else {
293
+ // Update
294
+ $this->settings[$name]->value($value);
295
+ }
296
+ } else if (is_object($name) && get_class($name) == CRAYON_SETTING_CLASS) {
297
+ $setting = $name; // Semantics
298
+ if ($replace || !$this->is_setting($setting->name())) {
299
+ // Replace/Create
300
+ $this->settings[$setting->name()] = $setting->copy();
301
+ } else {
302
+ // Update
303
+ if ($setting->is_array()) {
304
+ $this->settings[$setting->name()]->index($setting->index());
305
+ } else {
306
+ $this->settings[$setting->name()]->value($setting->value());
307
+ }
308
+ }
309
+ }
310
+ }
311
+
312
+ function get($name = NULL) {
313
+ if ($name === NULL) {
314
+ $copy = array();
315
+ foreach ($this->settings as $name => $setting) {
316
+ $copy[$name] = $setting->copy(); // Deep copy
317
+ }
318
+ return $copy;
319
+ } else if (is_string($name)) {
320
+ if ($this->is_setting($name)) {
321
+ return $this->settings[$name];
322
+ }
323
+ }
324
+ return FALSE;
325
+ }
326
+
327
+ function val($name = NULL) {
328
+ if (($setting = self::get($name)) != FALSE) {
329
+ return $setting->value();
330
+ } else {
331
+ return NULL;
332
+ }
333
+ }
334
+
335
+ function val_str($name) {
336
+ if (($setting = self::get($name)) != FALSE) {
337
+ $def = $setting->def();
338
+ $index = $setting->value();
339
+ if (array_key_exists($index, $def)) {
340
+ return $def[$index];
341
+ } else {
342
+ return NULL;
343
+ }
344
+ }
345
+ }
346
+
347
+ function get_array() {
348
+ $array = array();
349
+ foreach ($this->settings as $setting) {
350
+ $array[$setting->name()] = $setting->value();
351
+ }
352
+ return $array;
353
+ }
354
+
355
+ function is_setting($name) {
356
+ return (is_string($name) && array_key_exists($name, $this->settings));
357
+ }
358
+
359
+ /* Gets default settings, either as associative array of name=>value or CrayonSetting
360
+ objects */
361
+ public static function get_defaults($name = NULL, $objects = TRUE) {
362
+ if (self::$default === NULL) {
363
+ self::$default = new CrayonSettings();
364
+ }
365
+ if ($name === NULL) {
366
+ // Get all settings
367
+ if ($objects) {
368
+ // Return array of objects
369
+ return self::$default->get();
370
+ } else {
371
+ // Return associative array of name=>value
372
+ $settings = self::$default->get();
373
+ $defaults = array();
374
+ foreach ($settings as $setting) {
375
+ $defaults[$setting->name()] = $setting->value();
376
+ }
377
+ return $defaults;
378
+ }
379
+ } else {
380
+ // Return specific setting
381
+ if ($objects) {
382
+ return self::$default->get($name);
383
+ } else {
384
+ return self::$default->get($name)->value();
385
+ }
386
+ }
387
+ }
388
+
389
+ public static function get_defaults_array() {
390
+ return self::get_defaults(NULL, FALSE);
391
+ }
392
+
393
+ // Validation =============================================================
394
+
395
+ /**
396
+ * Validates settings coming from an HTML form and also for internal use.
397
+ * This is used when saving form an HTML form to the db, and also when reading from the db
398
+ * back into the global settings.
399
+ * @param string $name
400
+ * @param mixed $value
401
+ */
402
+ public static function validate($name, $value) {
403
+ if (!is_string($name)) {
404
+ return '';
405
+ }
406
+
407
+ // Type-cast to correct value for known settings
408
+ if (($setting = CrayonGlobalSettings::get($name)) != FALSE) {
409
+ // Booleans settings that are sent as string are allowed to have "false" == false
410
+ if (is_bool($setting->def())) {
411
+ if (is_string($value)) {
412
+ $value = CrayonUtil::str_to_bool($value);
413
+ }
414
+ } else {
415
+ // Ensure we don't cast integer settings to 0 because $value doesn't have any numbers in it
416
+ $value = strval($value);
417
+ // Only occurs when saving from the form ($_POST values are strings)
418
+ if ($value == '' || ($cleaned = $setting->sanitize($value, FALSE)) == '') {
419
+ // The value sent has no integers, change to default
420
+ $value = $setting->def();
421
+ } else {
422
+ // Cleaned value is int
423
+ $value = $cleaned;
424
+ }
425
+ // Cast all other settings as usual
426
+ if (!settype($value, $setting->type())) {
427
+ // If we can't cast, then use default value
428
+ if ($setting->is_array()) {
429
+ $value = 0; // default index
430
+ } else {
431
+ $value = $setting->def();
432
+ }
433
+ }
434
+ }
435
+ } else {
436
+ // If setting not found, remove value
437
+ return '';
438
+ }
439
+
440
+ switch ($name) {
441
+ case CrayonSettings::LOCAL_PATH:
442
+ $path = parse_url($value, PHP_URL_PATH);
443
+ // Remove all spaces, prefixed and trailing forward slashes
444
+ $path = preg_replace('#^/*|/*$|\s*#', '', $path);
445
+ // Replace backslashes
446
+ $path = preg_replace('#\\\\#', '/', $path);
447
+ // Append trailing forward slash
448
+ if (!empty($path)) {
449
+ $path .= '/';
450
+ }
451
+ return $path;
452
+ case CrayonSettings::FONT_SIZE:
453
+ if ($value < 1) {
454
+ $value = 1;
455
+ }
456
+ break;
457
+ case CrayonSettings::LINE_HEIGHT:
458
+ $font_size = CrayonGlobalSettings::val(CrayonSettings::FONT_SIZE);
459
+ $value = $value >= $font_size ? $value : $font_size;
460
+ break;
461
+ case CrayonSettings::THEME:
462
+ $value = strtolower($value);
463
+ // XXX validate settings here
464
+ }
465
+
466
+ // If no validation occurs, return value
467
+ return $value;
468
+ }
469
+
470
+ // Takes an associative array of "smart settings" and regular settings. Smart settings can be used
471
+ // to configure regular settings quickly.
472
+ // E.g. 'max_height="20px"' will set 'height="20"', 'height_mode="0", height_unit="0"'
473
+ public static function smart_settings($settings) {
474
+ if (!is_array($settings)) {
475
+ return FALSE;
476
+ }
477
+
478
+ // If a setting is given, it is automatically enabled
479
+ foreach ($settings as $name => $value) {
480
+ if (($setting = CrayonGlobalSettings::get($name)) !== FALSE && is_bool($setting->def())) {
481
+ $value = CrayonUtil::str_to_bool($value);
482
+ }
483
+
484
+ // XXX removed height and width, since it wasn't using the global settings for mode if only height was provided
485
+ if ($name == 'min-height' || $name == 'max-height' /* || $name == 'height'*/) {
486
+ self::smart_hw($name, CrayonSettings::HEIGHT_SET, CrayonSettings::HEIGHT_MODE, CrayonSettings::HEIGHT_UNIT, $settings);
487
+ } else if ($name == 'min-width' || $name == 'max-width' /* || $name == 'width'*/) {
488
+ self::smart_hw($name, CrayonSettings::WIDTH_SET, CrayonSettings::WIDTH_MODE, CrayonSettings::WIDTH_UNIT, $settings);
489
+ } else if ($name == CrayonSettings::FONT_SIZE) {
490
+ $settings[CrayonSettings::FONT_SIZE_ENABLE] = TRUE;
491
+ } else if ($name == CrayonSettings::TOP_MARGIN) {
492
+ $settings[CrayonSettings::TOP_SET] = TRUE;
493
+ } else if ($name == CrayonSettings::LEFT_MARGIN) {
494
+ $settings[CrayonSettings::LEFT_SET] = TRUE;
495
+ } else if ($name == CrayonSettings::BOTTOM_MARGIN) {
496
+ $settings[CrayonSettings::BOTTOM_SET] = TRUE;
497
+ } else if ($name == CrayonSettings::RIGHT_MARGIN) {
498
+ $settings[CrayonSettings::RIGHT_SET] = TRUE;
499
+ } else if ($name == CrayonSettings::ERROR_MSG) {
500
+ $settings[CrayonSettings::ERROR_MSG_SHOW] = TRUE;
501
+ } else if ($name == CrayonSettings::H_ALIGN) {
502
+ $settings[CrayonSettings::FLOAT_ENABLE] = TRUE;
503
+ $value = CrayonUtil::tlower($value);
504
+ $values = array('none' => 0, 'left' => 1, 'center' => 2, 'right' => 3);
505
+ if (array_key_exists($value, $values)) {
506
+ $settings[CrayonSettings::H_ALIGN] = $values[$value];
507
+ }
508
+ } else if ($name == CrayonSettings::SHOW_LANG) {
509
+ $value = CrayonUtil::tlower($value);
510
+ $values = array('found' => 0, 'always' => 1, 'true' => 1, 'never' => 2, 'false' => 2);
511
+ if (array_key_exists($value, $values)) {
512
+ $settings[CrayonSettings::SHOW_LANG] = $values[$value];
513
+ }
514
+ } else if ($name == CrayonSettings::TOOLBAR) {
515
+ if (CrayonUtil::tlower($value) == 'always') {
516
+ $settings[CrayonSettings::TOOLBAR] = 1;
517
+ } else if (CrayonUtil::str_to_bool($value) === FALSE) {
518
+ $settings[CrayonSettings::TOOLBAR] = 2;
519
+ }
520
+ }
521
+ }
522
+
523
+ return $settings;
524
+ }
525
+
526
+ // Used for height and width smart settings, I couldn't bear to copy paste code twice...
527
+ private static function smart_hw($name, $set, $mode, $unit, &$settings) {
528
+ if (!is_string($name) || !is_string($set) || !is_string($mode) || !is_string($unit) || !is_array($settings)) {
529
+ return;
530
+ }
531
+ $settings[$set] = TRUE;
532
+ if (strpos($name, 'max-') !== FALSE) {
533
+ $settings[$mode] = 0;
534
+ } else if (strpos($name, 'min-') !== FALSE) {
535
+ $settings[$mode] = 1;
536
+ } else {
537
+ $settings[$mode] = 2;
538
+ }
539
+ preg_match('#(\d+)\s*([^\s]*)#', $settings[$name], $match);
540
+ if (count($match) == 3) {
541
+ $name = str_replace(array('max-', 'min-'), '', $name);
542
+ $settings[$name] = $match[1];
543
+ switch (strtolower($match[2])) {
544
+ case 'px':
545
+ $settings[$unit] = 0;
546
+ break;
547
+ case '%':
548
+ $settings[$unit] = 1;
549
+ break;
550
+ }
551
+ }
552
+ }
553
+ }
554
+
555
+ /**
556
+ * Stores global/static copy of CrayonSettings loaded from db.
557
+ * These settings can be overriden by individual Crayons.
558
+ * Also manages global site settings and paths.
559
+ */
560
+ class CrayonGlobalSettings {
561
+ // The global settings stored as a CrayonSettings object.
562
+ private static $global = NULL;
563
+ /* These are used to load local files reliably and prevent scripts like PHP from executing
564
+ when attempting to load their code. */
565
+ // The URL of the site (eg. http://localhost/example/)
566
+ private static $site_http = '';
567
+ // The absolute root directory of the site (eg. /User/example/)
568
+ private static $site_path = '';
569
+ // The absolute root directory of the plugins (eg. /User/example/plugins)
570
+ private static $plugin_path = '';
571
+ private static $upload_path = '';
572
+ private static $upload_url = '';
573
+ private static $mkdir = NULL;
574
+
575
+ private function __construct() {
576
+ }
577
+
578
+ private static function init() {
579
+ if (self::$global === NULL) {
580
+ self::$global = new CrayonSettings();
581
+ }
582
+ }
583
+
584
+ public static function get($name = NULL) {
585
+ self::init();
586
+ return self::$global->get($name);
587
+ }
588
+
589
+ public static function get_array() {
590
+ self::init();
591
+ return self::$global->get_array();
592
+ }
593
+
594
+ public static function get_obj() {
595
+ self::init();
596
+ return self::$global->copy();
597
+ }
598
+
599
+ public static function val($name = NULL) {
600
+ self::init();
601
+ return self::$global->val($name);
602
+ }
603
+
604
+ public static function val_str($name = NULL) {
605
+ self::init();
606
+ return self::$global->val_str($name);
607
+ }
608
+
609
+ public static function has_changed($input, $setting, $value) {
610
+ return $input == $setting && $value != CrayonGlobalSettings::val($setting);
611
+ }
612
+
613
+ public static function set($name, $value = NULL, $replace = FALSE) {
614
+ self::init();
615
+ self::$global->set($name, $value, $replace);
616
+ }
617
+
618
+ public static function site_url($site_http = NULL) {
619
+ if ($site_http === NULL) {
620
+ return self::$site_http;
621
+ } else {
622
+ self::$site_http = CrayonUtil::url_slash($site_http);
623
+ }
624
+ }
625
+
626
+ public static function site_path($site_path = NULL) {
627
+ if ($site_path === NULL) {
628
+ return self::$site_path;
629
+ } else {
630
+ self::$site_path = CrayonUtil::path_slash($site_path);
631
+ }
632
+ }
633
+
634
+ public static function plugin_path($plugin_path = NULL) {
635
+ if ($plugin_path === NULL) {
636
+ return self::$plugin_path;
637
+ } else {
638
+ self::$plugin_path = CrayonUtil::path_slash($plugin_path);
639
+ }
640
+ }
641
+
642
+ public static function upload_path($upload_path = NULL) {
643
+ if ($upload_path === NULL) {
644
+ return self::$upload_path;
645
+ } else {
646
+ self::$upload_path = CrayonUtil::path_slash($upload_path);
647
+ }
648
+ }
649
+
650
+ public static function upload_url($upload_url = NULL) {
651
+ if ($upload_url === NULL) {
652
+ return self::$upload_url;
653
+ } else {
654
+ self::$upload_url = CrayonUtil::url_slash($upload_url);
655
+ }
656
+ }
657
+
658
+ public static function set_mkdir($mkdir = NULL) {
659
+ if ($mkdir === NULL) {
660
+ return self::$mkdir;
661
+ } else {
662
+ self::$mkdir = $mkdir;
663
+ }
664
+ }
665
+
666
+ public static function mkdir($dir = NULL) {
667
+ if (self::$mkdir) {
668
+ call_user_func(self::$mkdir, $dir);
669
+ } else {
670
+ @mkdir($dir, 0777, TRUE);
671
+ }
672
+ }
673
+ }
674
+
675
+
676
+ $INT = new CrayonValidator('#\d+#');
677
+
678
+ /**
679
+ * Validation class.
680
+ */
681
+ class CrayonValidator {
682
+ private $pattern = '#*#msi';
683
+
684
+ public function __construct($pattern) {
685
+ $this->pattern($pattern);
686
+ }
687
+
688
+ public function pattern($pattern) {
689
+ if ($pattern === NULL) {
690
+ return $pattern;
691
+ } else {
692
+ $this->pattern = $pattern;
693
+ }
694
+ }
695
+
696
+ public function validate($str) {
697
+ return preg_match($this->pattern, $str) !== FALSE;
698
+ }
699
+
700
+ public function sanitize($str) {
701
+ preg_match_all($this->pattern, $str, $matches);
702
+ $result = '';
703
+ foreach ($matches as $match) {
704
+ $result .= $match[0];
705
+ }
706
+ return $result;
707
+ }
708
+ }
709
+
710
+ class CrayonNonNegIntValidator extends CrayonValidator {
711
+ public function __construct() {
712
+ parent::__construct('#\d+#');
713
+ }
714
+ }
715
+
716
+ class CrayonIntValidator extends CrayonValidator {
717
+ public function __construct() {
718
+ parent::__construct('#-?\d+#');
719
+ }
720
+ }
721
+
722
+ /**
723
+ * Individual setting.
724
+ * Can store boolean, string, dropdown (with array of strings), etc.
725
+ */
726
+ class CrayonSetting {
727
+ private $name = '';
728
+ /* The type of variables that can be set as the value.
729
+ * For dropdown settings, value is int, even though value() will return a string. */
730
+ private $type = NULL;
731
+ private $default = NULL; // stores string array for dropdown settings
732
+
733
+ private $value = NULL; // stores index int for dropdown settings
734
+
735
+ private $is_array = FALSE; // only TRUE for dropdown settings
736
+ private $locked = FALSE;
737
+
738
+ private $validator = NULL;
739
+
740
+
741
+ public function __construct($name, $default = '', $value = NULL, $locked = NULL) {
742
+ $this->name($name);
743
+ if ($default !== NULL) {
744
+ $this->def($default); // Perform first to set type
745
+ }
746
+ if ($value !== NULL) {
747
+ $this->value($value);
748
+ }
749
+ if ($locked !== NULL) {
750
+ $this->locked($locked);
751
+ }
752
+ }
753
+
754
+ function __tostring() {
755
+ return $this->name;
756
+ }
757
+
758
+ function copy() {
759
+ return new CrayonSetting($this->name, $this->default, $this->value, $this->locked);
760
+ }
761
+
762
+ function name($name = NULL) {
763
+ if (!CrayonUtil::str($this->name, $name)) {
764
+ return $this->name;
765
+ }
766
+ }
767
+
768
+ function type() {
769
+ return $this->type;
770
+ }
771
+
772
+ function is_array() {
773
+ return $this->is_array;
774
+ }
775
+
776
+ function locked($locked = NULL) {
777
+ if ($locked === NULL) {
778
+ return $this->locked;
779
+ } else {
780
+ $this->locked = ($locked == TRUE);
781
+ }
782
+ }
783
+
784
+ /**
785
+ * Sets/gets value;
786
+ * Value is index (int) in default value (array) for dropdown settings.
787
+ * value($value) is alias for index($index) if dropdown setting.
788
+ * value() returns string value at current index for dropdown settings.
789
+ * @param $value
790
+ */
791
+ function value($value = NULL) {
792
+ if ($value === NULL) {
793
+ /*if ($this->is_array) {
794
+ return $this->default[$this->value]; // value at index
795
+ } else */
796
+ if ($this->value !== NULL) {
797
+ return $this->value;
798
+ } else {
799
+ if ($this->is_array) {
800
+ return 0;
801
+ } else {
802
+ return $this->default;
803
+ }
804
+ }
805
+ } else if ($this->locked === FALSE) {
806
+ if ($this->is_array) {
807
+ $this->index($value); // $value is index
808
+ } else {
809
+ settype($value, $this->type); // Type cast
810
+ $this->value = $value;
811
+ }
812
+ }
813
+ }
814
+
815
+ function array_value() {
816
+ if ($this->is_array) {
817
+ return NULL;
818
+ }
819
+ return $this->default[$this->value];
820
+ }
821
+
822
+ /**
823
+ * Sets/gets default value.
824
+ * For dropdown settings, default value is array of all possible value strings.
825
+ * @param $default
826
+ */
827
+ function def($default = NULL) {
828
+ // Only allow default to be set once
829
+
830
+ if ($this->type === NULL && $default !== NULL) {
831
+ // For dropdown settings
832
+
833
+ if (is_array($default)) { // The only time we don't use $this->is_array
834
+
835
+ // If empty, set to blank array
836
+
837
+ if (empty($default)) {
838
+ $default = array('');
839
+ } else {
840
+ // Ensure all values are unique strings
841
+
842
+ $default = CrayonUtil::array_unique_str($default);
843
+ }
844
+ $this->value = 0; // initial index
845
+
846
+ $this->is_array = TRUE;
847
+ $this->type = gettype(0); // Type is int (index)
848
+
849
+ } else {
850
+ $this->is_array = FALSE;
851
+ $this->type = gettype($default);
852
+ if (is_int($default)) {
853
+ $this->validator(new CrayonIntValidator());
854
+ }
855
+ }
856
+ $this->default = $default;
857
+ } else {
858
+ return $this->default;
859
+ }
860
+ }
861
+
862
+ /**
863
+ * Sets/gets index.
864
+ * @param int|string $index
865
+ * @return FALSE if not dropdown setting
866
+ */
867
+ function index($index = NULL) {
868
+ if (!$this->is_array) {
869
+ return FALSE;
870
+ } else if ($index === NULL) {
871
+ return $this->value; // return current index
872
+ } else {
873
+ if (!is_int($index)) {
874
+ // Ensure $value is int for index
875
+ $index = intval($index);
876
+ }
877
+ // Validate index
878
+ if ($index < 0 || $index > count($this->default) - 1) {
879
+ $index = 0;
880
+ }
881
+ $this->value = $index;
882
+ }
883
+ }
884
+
885
+ /**
886
+ * Finds the index of a string in an array setting
887
+ */
888
+ function find_index($str) {
889
+ if (!$this->is_array || is_string($str)) {
890
+ return FALSE;
891
+ }
892
+ for ($i = 0; $i < count($this->default); $i++) {
893
+ if ($this->default[$i] == $str) {
894
+ return $i;
895
+ }
896
+ }
897
+ return FALSE;
898
+ }
899
+
900
+ function validator($validator) {
901
+ if ($validator === NULL) {
902
+ return $this->validator;
903
+ } else {
904
+ $this->validator = $validator;
905
+ }
906
+ }
907
+
908
+ function sanitize($str) {
909
+ if ($this->validator != NULL) {
910
+ return $this->validator->sanitize($str);
911
+ } else {
912
+ return $str;
913
+ }
914
+ }
915
+
916
+ }
917
+
918
  ?>
crayon_settings_wp.class.php CHANGED
@@ -1,1260 +1,1272 @@
1
- <?php
2
- require_once('global.php');
3
- require_once(CRAYON_LANGS_PHP);
4
- require_once(CRAYON_THEMES_PHP);
5
- require_once(CRAYON_FONTS_PHP);
6
- require_once(CRAYON_SETTINGS_PHP);
7
-
8
- /* Manages global settings within WP and integrates them with CrayonSettings.
9
- CrayonHighlighter and any non-WP classes will only use CrayonSettings to separate
10
- the implementation of global settings and ensure any system can use them. */
11
-
12
- class CrayonSettingsWP {
13
- // Properties and Constants ===============================================
14
-
15
- // A copy of the current options in db
16
- private static $options = NULL;
17
- // Posts containing crayons in db
18
- private static $crayon_posts = NULL;
19
- // Posts containing legacy tags in db
20
- private static $crayon_legacy_posts = NULL;
21
- // An array of cache names for use with Transients API
22
- private static $cache = NULL;
23
- // Array of settings to pass to js
24
- private static $js_settings = NULL;
25
- private static $js_strings = NULL;
26
- private static $admin_js_settings = NULL;
27
- private static $admin_js_strings = NULL;
28
- private static $admin_page = '';
29
- private static $is_fully_loaded = FALSE;
30
-
31
- const SETTINGS = 'crayon_fields';
32
- const FIELDS = 'crayon_settings';
33
- const OPTIONS = 'crayon_options';
34
- const POSTS = 'crayon_posts';
35
- const LEGACY_POSTS = 'crayon_legacy_posts';
36
- const CACHE = 'crayon_cache';
37
- const GENERAL = 'crayon_general';
38
- const DEBUG = 'crayon_debug';
39
- const ABOUT = 'crayon_about';
40
-
41
- // Used on submit
42
- const LOG_CLEAR = 'log_clear';
43
- const LOG_EMAIL_ADMIN = 'log_email_admin';
44
- const LOG_EMAIL_DEV = 'log_email_dev';
45
- const SAMPLE_CODE = 'sample-code';
46
- const CACHE_CLEAR = 'crayon-cache-clear';
47
-
48
- private function __construct() {
49
- }
50
-
51
- // Methods ================================================================
52
-
53
- public static function admin_load() {
54
- self::$admin_page = $admin_page = add_options_page('Crayon Syntax Highlighter ' . crayon__('Settings'), 'Crayon', 'manage_options', 'crayon_settings', 'CrayonSettingsWP::settings');
55
- add_action("admin_print_scripts-$admin_page", 'CrayonSettingsWP::admin_scripts');
56
- add_action("admin_print_styles-$admin_page", 'CrayonSettingsWP::admin_styles');
57
- add_action("admin_print_scripts-$admin_page", 'CrayonThemeEditorWP::admin_resources');
58
- // Register settings, second argument is option name stored in db
59
- register_setting(self::FIELDS, self::OPTIONS, 'CrayonSettingsWP::settings_validate');
60
- add_action("admin_head-$admin_page", 'CrayonSettingsWP::admin_init');
61
- // Register settings for post page
62
- add_action("admin_print_styles-post-new.php", 'CrayonSettingsWP::admin_scripts');
63
- add_action("admin_print_styles-post.php", 'CrayonSettingsWP::admin_scripts');
64
- add_action("admin_print_styles-post-new.php", 'CrayonSettingsWP::admin_styles');
65
- add_action("admin_print_styles-post.php", 'CrayonSettingsWP::admin_styles');
66
-
67
- // TODO depreciated since WP 3.3, remove eventually
68
- global $wp_version;
69
- if ($wp_version >= '3.3') {
70
- add_action("load-$admin_page", 'CrayonSettingsWP::help_screen');
71
- } else {
72
- add_filter('contextual_help', 'CrayonSettingsWP::cont_help', 10, 3);
73
- }
74
- }
75
-
76
- public static function admin_styles() {
77
- global $CRAYON_VERSION;
78
- if (CRAYON_MINIFY) {
79
- wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE_MIN, __FILE__), array('editor-buttons'), $CRAYON_VERSION);
80
- } else {
81
- wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
82
- wp_enqueue_style('crayon_global', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
83
- wp_enqueue_style('crayon_admin', plugins_url(CRAYON_STYLE_ADMIN, __FILE__), array('editor-buttons'), $CRAYON_VERSION);
84
- }
85
- }
86
-
87
- public static function admin_scripts() {
88
- global $CRAYON_VERSION;
89
-
90
- if (CRAYON_MINIFY) {
91
- CrayonWP::enqueue_resources();
92
- } else {
93
- wp_enqueue_script('crayon_util_js', plugins_url(CRAYON_JS_UTIL, __FILE__), array('jquery'), $CRAYON_VERSION);
94
- self::other_scripts();
95
- }
96
-
97
- self::init_js_settings();
98
-
99
- if (is_admin()) {
100
- wp_enqueue_script('crayon_admin_js', plugins_url(CRAYON_JS_ADMIN, __FILE__), array('jquery', 'crayon_js', 'wpdialogs'), $CRAYON_VERSION);
101
- self::init_admin_js_settings();
102
- }
103
- }
104
-
105
- public static function other_scripts() {
106
- global $CRAYON_VERSION;
107
- self::load_settings(TRUE);
108
- $deps = array('jquery', 'crayon_util_js');
109
- if (CrayonGlobalSettings::val(CrayonSettings::POPUP) || is_admin()) {
110
- // TODO include anyway and minify
111
- wp_enqueue_script('crayon_jquery_popup', plugins_url(CRAYON_JQUERY_POPUP, __FILE__), array('jquery'), $CRAYON_VERSION);
112
- $deps[] = 'crayon_jquery_popup';
113
- }
114
- wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS, __FILE__), $deps, $CRAYON_VERSION);
115
- }
116
-
117
- public static function init_js_settings() {
118
- // This stores JS variables used in AJAX calls and in the JS files
119
- global $CRAYON_VERSION;
120
- self::load_settings(TRUE);
121
- if (!self::$js_settings) {
122
- self::$js_settings = array(
123
- 'version' => $CRAYON_VERSION,
124
- 'is_admin' => intval(is_admin()),
125
- 'ajaxurl' => admin_url('admin-ajax.php'),
126
- 'prefix' => CrayonSettings::PREFIX,
127
- 'setting' => CrayonSettings::SETTING,
128
- 'selected' => CrayonSettings::SETTING_SELECTED,
129
- 'changed' => CrayonSettings::SETTING_CHANGED,
130
- 'special' => CrayonSettings::SETTING_SPECIAL,
131
- 'orig_value' => CrayonSettings::SETTING_ORIG_VALUE,
132
- 'debug' => CRAYON_DEBUG
133
- );
134
- }
135
- if (!self::$js_strings) {
136
- self::$js_strings = array(
137
- 'copy' => crayon__('Press %s to Copy, %s to Paste'),
138
- 'minimize' => crayon__('Click To Expand Code')
139
- );
140
- }
141
- if (CRAYON_MINIFY) {
142
- wp_localize_script('crayon_js', 'CrayonSyntaxSettings', self::$js_settings);
143
- wp_localize_script('crayon_js', 'CrayonSyntaxStrings', self::$js_strings);
144
- } else {
145
- wp_localize_script('crayon_util_js', 'CrayonSyntaxSettings', self::$js_settings);
146
- wp_localize_script('crayon_util_js', 'CrayonSyntaxStrings', self::$js_strings);
147
- }
148
- }
149
-
150
- public static function init_admin_js_settings() {
151
- if (!self::$admin_js_settings) {
152
- // We need to load themes at this stage
153
- CrayonSettingsWP::load_settings();
154
- $themes_ = CrayonResources::themes()->get();
155
- $stockThemes = array();
156
- $userThemes = array();
157
- foreach ($themes_ as $theme) {
158
- $id = $theme->id();
159
- $name = $theme->name();
160
- if ($theme->user()) {
161
- $userThemes[$id] = $name;
162
- } else {
163
- $stockThemes[$id] = $name;
164
- }
165
- }
166
- self::$admin_js_settings = array(
167
- 'themes' => array_merge($stockThemes, $userThemes),
168
- 'stockThemes' => $stockThemes,
169
- 'userThemes' => $userThemes,
170
- 'defaultTheme' => CrayonThemes::DEFAULT_THEME,
171
- 'themesURL' => CrayonResources::themes()->dirurl(false),
172
- 'userThemesURL' => CrayonResources::themes()->dirurl(true),
173
- 'sampleCode' => self::SAMPLE_CODE,
174
- 'dialogFunction' => 'wpdialog'
175
- );
176
- wp_localize_script('crayon_admin_js', 'CrayonAdminSettings', self::$admin_js_settings);
177
- }
178
- if (!self::$admin_js_strings) {
179
- self::$admin_js_strings = array(
180
- 'prompt' => crayon__("Prompt"),
181
- 'value' => crayon__("Value"),
182
- 'alert' => crayon__("Alert"),
183
- 'no' => crayon__("No"),
184
- 'yes' => crayon__("Yes"),
185
- 'confirm' => crayon__("Confirm"),
186
- 'changeCode' => crayon__("Change Code")
187
- );
188
- wp_localize_script('crayon_admin_js', 'CrayonAdminStrings', self::$admin_js_strings);
189
- }
190
- }
191
-
192
- public static function settings() {
193
- if (!current_user_can('manage_options')) {
194
- wp_die(crayon__('You do not have sufficient permissions to access this page.'));
195
- }
196
- ?>
197
-
198
- <script type="text/javascript">
199
- jQuery(document).ready(function () {
200
- CrayonSyntaxAdmin.init();
201
- });
202
- </script>
203
-
204
- <div id="crayon-main-wrap" class="wrap">
205
-
206
- <div id="icon-options-general" class="icon32">
207
- <br>
208
- </div>
209
- <h2>
210
- Crayon Syntax Highlighter
211
- <?php crayon_e('Settings'); ?>
212
- </h2>
213
- <?php self::help(); ?>
214
- <form id="crayon-settings-form" action="options.php" method="post">
215
- <?php
216
- settings_fields(self::FIELDS);
217
- ?>
218
-
219
- <?php
220
- do_settings_sections(self::SETTINGS);
221
- ?>
222
-
223
- <p class="submit">
224
- <input type="submit" name="submit" id="submit" class="button-primary"
225
- value="<?php
226
- crayon_e('Save Changes');
227
- ?>"/><span style="width:10px; height: 5px; float:left;"></span>
228
- <input type="submit"
229
- name="<?php echo self::OPTIONS; ?>[reset]"
230
- id="reset"
231
- class="button-primary"
232
- value="<?php
233
- crayon_e('Reset Settings');
234
- ?>"/>
235
- </p>
236
- </form>
237
- </div>
238
-
239
- <div id="crayon-theme-editor-wrap" class="wrap"></div>
240
-
241
- <?php
242
- }
243
-
244
- // Load the global settings and update them from the db
245
- public static function load_settings($just_load_settings = FALSE) {
246
- if (self::$options === NULL) {
247
- // Load settings from db
248
- if (!(self::$options = get_option(self::OPTIONS))) {
249
- self::$options = CrayonSettings::get_defaults_array();
250
- update_option(self::OPTIONS, self::$options);
251
- }
252
- // Initialise default global settings and update them from db
253
- CrayonGlobalSettings::set(self::$options);
254
- }
255
-
256
- if (!self::$is_fully_loaded && !$just_load_settings) {
257
- // Load everything else as well
258
-
259
- // For local file loading
260
- // This is used to decouple WP functions from internal Crayon classes
261
- CrayonGlobalSettings::site_url(home_url());
262
- CrayonGlobalSettings::site_path(ABSPATH);
263
- CrayonGlobalSettings::plugin_path(plugins_url('', __FILE__));
264
- $upload = wp_upload_dir();
265
-
266
- CrayonLog::debug($upload, "WP UPLOAD FUNCTION");
267
- CrayonGlobalSettings::upload_path(CrayonUtil::path_slash($upload['basedir']) . CRAYON_DIR);
268
- CrayonGlobalSettings::upload_url($upload['baseurl'] . '/' . CRAYON_DIR);
269
- CrayonLog::debug(CrayonGlobalSettings::upload_path(), "UPLOAD PATH");
270
- CrayonGlobalSettings::set_mkdir('wp_mkdir_p');
271
-
272
- // Load all available languages and themes
273
- CrayonResources::langs()->load();
274
- CrayonResources::themes()->load();
275
-
276
- // Ensure all missing settings in db are replaced by default values
277
- $changed = FALSE;
278
- foreach (CrayonSettings::get_defaults_array() as $name => $value) {
279
- // Add missing settings
280
- if (!array_key_exists($name, self::$options)) {
281
- self::$options[$name] = $value;
282
- $changed = TRUE;
283
- }
284
- }
285
- // A setting was missing, update options
286
- if ($changed) {
287
- update_option(self::OPTIONS, self::$options);
288
- }
289
-
290
- self::$is_fully_loaded = TRUE;
291
- }
292
- }
293
-
294
- public static function get_settings() {
295
- return get_option(self::OPTIONS);
296
- }
297
-
298
- // Saves settings from CrayonGlobalSettings, or provided array, to the db
299
- public static function save_settings($settings = NULL) {
300
- if ($settings === NULL) {
301
- $settings = CrayonGlobalSettings::get_array();
302
- }
303
- update_option(self::OPTIONS, $settings);
304
- }
305
-
306
- // Crayon posts
307
-
308
- /**
309
- * This loads the posts marked as containing Crayons
310
- */
311
- public static function load_posts() {
312
- if (self::$crayon_posts === NULL) {
313
- // Load from db
314
- if (!(self::$crayon_posts = get_option(self::POSTS))) {
315
- // Posts don't exist! Scan for them. This will fill self::$crayon_posts
316
- self::$crayon_posts = CrayonWP::scan_posts();
317
- update_option(self::POSTS, self::$crayon_posts);
318
- }
319
- }
320
- return self::$crayon_posts;
321
- }
322
-
323
- /**
324
- * This looks through all posts and marks those which contain Crayons
325
- */
326
- // public static function scan_and_save_posts() {
327
- // self::save_posts(CrayonWP::scan_posts(TRUE, TRUE));
328
- // }
329
-
330
- /**
331
- * Saves the marked posts to the db
332
- */
333
- public static function save_posts($posts = NULL) {
334
- if ($posts === NULL) {
335
- $posts = self::$crayon_posts;
336
- }
337
- update_option(self::POSTS, $posts);
338
- self::load_posts();
339
- }
340
-
341
- /**
342
- * Adds a post as containing a Crayon
343
- */
344
- public static function add_post($id, $save = TRUE) {
345
- self::load_posts();
346
- if (!in_array($id, self::$crayon_posts)) {
347
- self::$crayon_posts[] = $id;
348
- }
349
- if ($save) {
350
- self::save_posts();
351
- }
352
- }
353
-
354
- /**
355
- * Removes a post as not containing a Crayon
356
- */
357
- public static function remove_post($id, $save = TRUE) {
358
- self::load_posts();
359
- $key = array_search($id, self::$crayon_posts);
360
- if ($key === false) {
361
- return;
362
- }
363
- unset(self::$crayon_posts[$key]);
364
- if ($save) {
365
- self::save_posts();
366
- }
367
- }
368
-
369
- public static function remove_posts() {
370
- self::$crayon_posts = array();
371
- self::save_posts();
372
- }
373
-
374
- // Crayon legacy posts
375
-
376
- /**
377
- * This loads the posts marked as containing Crayons
378
- */
379
- public static function load_legacy_posts($force = FALSE) {
380
- if (self::$crayon_legacy_posts === NULL || $force) {
381
- // Load from db
382
- if (!(self::$crayon_legacy_posts = get_option(self::LEGACY_POSTS))) {
383
- // Posts don't exist! Scan for them. This will fill self::$crayon_legacy_posts
384
- self::$crayon_legacy_posts = CrayonWP::scan_legacy_posts();
385
- update_option(self::LEGACY_POSTS, self::$crayon_legacy_posts);
386
- }
387
- }
388
- return self::$crayon_legacy_posts;
389
- }
390
-
391
- /**
392
- * This looks through all posts and marks those which contain Crayons
393
- */
394
- // public static function scan_and_save_posts() {
395
- // self::save_posts(CrayonWP::scan_posts(TRUE, TRUE));
396
- // }
397
-
398
- /**
399
- * Saves the marked posts to the db
400
- */
401
- public static function save_legacy_posts($posts = NULL) {
402
- if ($posts === NULL) {
403
- $posts = self::$crayon_legacy_posts;
404
- }
405
- update_option(self::LEGACY_POSTS, $posts);
406
- self::load_legacy_posts();
407
- }
408
-
409
- /**
410
- * Adds a post as containing a Crayon
411
- */
412
- public static function add_legacy_post($id, $save = TRUE) {
413
- self::load_legacy_posts();
414
- if (!in_array($id, self::$crayon_legacy_posts)) {
415
- self::$crayon_legacy_posts[] = $id;
416
- }
417
- if ($save) {
418
- self::save_legacy_posts();
419
- }
420
- }
421
-
422
- /**
423
- * Removes a post as not containing a Crayon
424
- */
425
- public static function remove_legacy_post($id, $save = TRUE) {
426
- self::load_legacy_posts();
427
- $key = array_search($id, self::$crayon_legacy_posts);
428
- if ($key === false) {
429
- return;
430
- }
431
- unset(self::$crayon_legacy_posts[$key]);
432
- if ($save) {
433
- self::save_legacy_posts();
434
- }
435
- }
436
-
437
- public static function remove_legacy_posts() {
438
- self::$crayon_legacy_posts = array();
439
- self::save_legacy_posts();
440
- }
441
-
442
- // Cache
443
-
444
- public static function add_cache($name) {
445
- self::load_cache();
446
- if (!in_array($name, self::$cache)) {
447
- self::$cache[] = $name;
448
- }
449
- self::save_cache();
450
- }
451
-
452
- public static function remove_cache($name) {
453
- self::load_cache();
454
- $key = array_search($name, self::$cache);
455
- if ($key === false) {
456
- return;
457
- }
458
- unset(self::$cache[$key]);
459
- self::save_cache();
460
- }
461
-
462
- public static function clear_cache() {
463
- self::load_cache();
464
- foreach (self::$cache as $name) {
465
- delete_transient($name);
466
- }
467
- self::$cache = array();
468
- self::save_cache();
469
- }
470
-
471
- public static function load_cache() {
472
- // Load cache from db
473
- if (!(self::$cache = get_option(self::CACHE))) {
474
- self::$cache = array();
475
- update_option(self::CACHE, self::$cache);
476
- }
477
- }
478
-
479
- public static function save_cache() {
480
- update_option(self::CACHE, self::$cache);
481
- self::load_cache();
482
- }
483
-
484
- // Paths
485
-
486
- public static function admin_init() {
487
- // Load default settings if they don't exist
488
- self::load_settings();
489
-
490
- // General
491
- // Some of these will the $editor arguments, if TRUE it will alter for use in the Tag Editor
492
- self::add_section(self::GENERAL, crayon__('General'));
493
- self::add_field(self::GENERAL, crayon__('Theme'), 'theme');
494
- self::add_field(self::GENERAL, crayon__('Font'), 'font');
495
- self::add_field(self::GENERAL, crayon__('Metrics'), 'metrics');
496
- self::add_field(self::GENERAL, crayon__('Toolbar'), 'toolbar');
497
- self::add_field(self::GENERAL, crayon__('Lines'), 'lines');
498
- self::add_field(self::GENERAL, crayon__('Code'), 'code');
499
- self::add_field(self::GENERAL, crayon__('Tags'), 'tags');
500
- self::add_field(self::GENERAL, crayon__('Languages'), 'langs');
501
- self::add_field(self::GENERAL, crayon__('Files'), 'files');
502
- self::add_field(self::GENERAL, crayon__('Posts'), 'posts');
503
- self::add_field(self::GENERAL, crayon__('Tag Editor'), 'tag_editor');
504
- self::add_field(self::GENERAL, crayon__('Misc'), 'misc');
505
-
506
- // Debug
507
- self::add_section(self::DEBUG, crayon__('Debug'));
508
- self::add_field(self::DEBUG, crayon__('Errors'), 'errors');
509
- self::add_field(self::DEBUG, crayon__('Log'), 'log');
510
- // ABOUT
511
-
512
- self::add_section(self::ABOUT, crayon__('About'));
513
- $image = '<div id="crayon-logo">
514
-
515
- <img src="' . plugins_url(CRAYON_LOGO, __FILE__) . '" /><br/></div>';
516
- self::add_field(self::ABOUT, $image, 'info');
517
- }
518
-
519
- // Wrapper functions
520
-
521
- private static function add_section($name, $title, $callback = NULL) {
522
- $callback = (empty($callback) ? 'blank' : $callback);
523
- add_settings_section($name, $title, 'CrayonSettingsWP::' . $callback, self::SETTINGS);
524
- }
525
-
526
- private static function add_field($section, $title, $callback, $args = array()) {
527
- $unique = preg_replace('#\\s#', '_', strtolower($title));
528
- add_settings_field($unique, $title, 'CrayonSettingsWP::' . $callback, self::SETTINGS, $section, $args);
529
- }
530
-
531
- // Validates all the settings passed from the form in $inputs
532
-
533
- public static function settings_validate($inputs) {
534
-
535
- // Load current settings from db
536
- self::load_settings(TRUE);
537
-
538
- global $CRAYON_EMAIL;
539
- // When reset button is pressed, remove settings so default loads next time
540
- if (array_key_exists('reset', $inputs)) {
541
- self::clear_cache();
542
- return array();
543
- }
544
- // Convert old tags
545
- if (array_key_exists('convert', $inputs)) {
546
- $encode = array_key_exists('convert_encode', $inputs);
547
- CrayonWP::convert_tags($encode);
548
- }
549
- // Refresh internal tag management
550
- if (array_key_exists('refresh_tags', $inputs)) {
551
- CrayonWP::refresh_posts();
552
- }
553
- // Clear the log if needed
554
- if (array_key_exists(self::LOG_CLEAR, $_POST)) {
555
- CrayonLog::clear();
556
- }
557
- // Send to admin
558
- if (array_key_exists(self::LOG_EMAIL_ADMIN, $_POST)) {
559
- CrayonLog::email(get_bloginfo('admin_email'));
560
- }
561
- // Send to developer
562
- if (array_key_exists(self::LOG_EMAIL_DEV, $_POST)) {
563
- CrayonLog::email($CRAYON_EMAIL, get_bloginfo('admin_email'));
564
- }
565
-
566
- // Clear the cache
567
- if (array_key_exists(self::CACHE_CLEAR, $_POST)) {
568
- self::clear_cache();
569
- }
570
-
571
- // If settings don't exist in input, set them to default
572
- $global_settings = CrayonSettings::get_defaults();
573
-
574
- $ignored = array(CrayonSettings::HIDE_HELP);
575
-
576
- foreach ($global_settings as $setting) {
577
- // XXX Ignore some settings
578
- if (in_array($setting->name(), $ignored)) {
579
- $inputs[$setting->name()] = CrayonGlobalSettings::val($setting->name());
580
- continue;
581
- }
582
-
583
- // If boolean setting is not in input, then it is set to FALSE in the form
584
- if (!array_key_exists($setting->name(), $inputs)) {
585
- // For booleans, set to FALSE (unchecked boxes are not sent as POST)
586
- if (is_bool($setting->def())) {
587
- $inputs[$setting->name()] = FALSE;
588
- } else {
589
- /* For array settings, set the input as the value, which by default is the
590
- default index */
591
- if (is_array($setting->def())) {
592
- $inputs[$setting->name()] = $setting->value();
593
- } else {
594
- $inputs[$setting->name()] = $setting->def();
595
- }
596
- }
597
- }
598
- }
599
-
600
- $refresh = array(
601
- // These should trigger a refresh of which posts contain crayons, since they affect capturing
602
- CrayonSettings::INLINE_TAG => TRUE,
603
- CrayonSettings::INLINE_TAG_CAPTURE => TRUE,
604
- CrayonSettings::CODE_TAG_CAPTURE => TRUE,
605
- CrayonSettings::BACKQUOTE => TRUE,
606
- CrayonSettings::CAPTURE_PRE => TRUE,
607
- CrayonSettings::CAPTURE_MINI_TAG => TRUE,
608
- CrayonSettings::PLAIN_TAG => TRUE
609
- );
610
-
611
- // Validate inputs
612
- foreach ($inputs as $input => $value) {
613
- // Convert all array setting values to ints
614
- $inputs[$input] = $value = CrayonSettings::validate($input, $value);
615
- // Clear cache when changed
616
- if (CrayonGlobalSettings::has_changed($input, CrayonSettings::CACHE, $value)) {
617
- self::clear_cache();
618
- }
619
- if (isset($refresh[$input])) {
620
- if (CrayonGlobalSettings::has_changed($input, $input, $value)) {
621
- // Needs to take place, in case it refresh depends on changed value
622
- CrayonGlobalSettings::set($input, $value);
623
- CrayonWP::refresh_posts();
624
- }
625
- }
626
- }
627
-
628
- return $inputs;
629
- }
630
-
631
- // Section callback functions
632
-
633
- public static function blank() {
634
- } // Used for required callbacks with blank content
635
-
636
- // Input Drawing ==========================================================
637
-
638
- private static function textbox($args) {
639
- $id = '';
640
- $size = 40;
641
- $margin = FALSE;
642
- $preview = 1;
643
- $break = FALSE;
644
- extract($args);
645
-
646
- echo '<input id="', CrayonSettings::PREFIX, $id, '" name="', self::OPTIONS, '[', $id, ']" class="' . CrayonSettings::SETTING . '" size="', $size, '" type="text" value="',
647
- self::$options[$id], '" style="margin-left: ', ($margin ? '20px' : '0px'), ';" crayon-preview="', ($preview ? 1 : 0), '" />', ($break ? CRAYON_BR : '');
648
- }
649
-
650
- private static function checkbox($args, $line_break = TRUE, $preview = TRUE) {
651
- if (empty($args) || !is_array($args) || count($args) != 2) {
652
- return;
653
- }
654
- $id = $args[0];
655
- $text = $args[1];
656
- $checked = (!array_key_exists($id, self::$options)) ? FALSE : self::$options[$id] == TRUE;
657
- $checked_str = $checked ? ' checked="checked"' : '';
658
- echo '<input id="', CrayonSettings::PREFIX, $id, '" name="', self::OPTIONS, '[', $id, ']" type="checkbox" class="' . CrayonSettings::SETTING . '" value="1"', $checked_str,
659
- ' crayon-preview="', ($preview ? 1 : 0), '" /> ', '<label for="', CrayonSettings::PREFIX, $id, '">', $text, '</label>', ($line_break ? CRAYON_BR : '');
660
- }
661
-
662
- // Draws a dropdown by loading the default value (an array) from a setting
663
- private static function dropdown($id, $line_break = TRUE, $preview = TRUE, $echo = TRUE, $resources = NULL, $selected = NULL) {
664
- if (!array_key_exists($id, self::$options)) {
665
- return;
666
- }
667
- $resources = $resources != NULL ? $resources : CrayonGlobalSettings::get($id)->def();
668
-
669
- $return = '<select id="' . CrayonSettings::PREFIX . $id . '" name="' . self::OPTIONS . '[' . $id . ']" class="' . CrayonSettings::SETTING . '" crayon-preview="' . ($preview ? 1 : 0) . '">';
670
- foreach ($resources as $k => $v) {
671
- if (is_array($v) && count($v)) {
672
- $data = $v[0];
673
- $text = $v[1];
674
- } else {
675
- $text = $v;
676
- }
677
- $is_selected = $selected !== NULL && $selected == $k ? 'selected' : selected(self::$options[$id], $k, FALSE);
678
- $return .= '<option ' . (isset($data) ? 'data-value="' . $data . '"' : '') . ' value="' . $k . '" ' . $is_selected . '>' . $text . '</option>';
679
- }
680
- $return .= '</select>' . ($line_break ? CRAYON_BR : '');
681
- if ($echo) {
682
- echo $return;
683
- } else {
684
- return $return;
685
- }
686
- }
687
-
688
- private static function button($args = array()) {
689
- extract($args);
690
- CrayonUtil::set_var($id, '');
691
- CrayonUtil::set_var($class, '');
692
- CrayonUtil::set_var($onclick, '');
693
- CrayonUtil::set_var($title, '');
694
- return '<a id="' . $id . '" class="button-primary ' . $class . '" onclick="' . $onclick . '">' . $title . '</a>';
695
- }
696
-
697
- private static function info_span($name, $text) {
698
- echo '<span id="', $name, '-info">', $text, '</span>';
699
- }
700
-
701
- private static function span($text) {
702
- echo '<span>', $text, '</span>';
703
- }
704
-
705
- // General Fields =========================================================
706
- public static function help() {
707
- global $CRAYON_WEBSITE, $CRAYON_TWITTER, $CRAYON_GIT, $CRAYON_PLUGIN_WP, $CRAYON_DONATE;
708
- if (CrayonGlobalSettings::val(CrayonSettings::HIDE_HELP)) {
709
- return;
710
- }
711
- echo '<div id="crayon-help" class="updated settings-error crayon-help">
712
- <p><strong>Howdy, coder!</strong> Thanks for using Crayon. <strong>Useful Links:</strong> <a href="' . $CRAYON_WEBSITE . '" target="_blank">Documentation</a>, <a href="' . $CRAYON_GIT . '" target="_blank">GitHub</a>, <a href="' . $CRAYON_PLUGIN_WP . '" target="_blank">Plugin Page</a>, <a href="' . $CRAYON_TWITTER . '" target="_blank">Twitter</a>. Crayon has always been free. If you value my work please consider a <a href="' . $CRAYON_DONATE . '">small donation</a> to show your appreciation. Thanks! <a class="crayon-help-close">X</a></p></div>
713
- ';
714
- }
715
-
716
- public static function help_screen() {
717
- $screen = get_current_screen();
718
-
719
- if ($screen->id != self::$admin_page) {
720
- return;
721
- }
722
- }
723
-
724
- public static function metrics() {
725
- echo '<div id="crayon-section-metrics" class="crayon-hide-inline">';
726
- self::checkbox(array(CrayonSettings::HEIGHT_SET, '<span class="crayon-span-50">' . crayon__('Height') . ' </span>'), FALSE);
727
- self::dropdown(CrayonSettings::HEIGHT_MODE, FALSE);
728
- echo ' ';
729
- self::textbox(array('id' => CrayonSettings::HEIGHT, 'size' => 8));
730
- echo ' ';
731
- self::dropdown(CrayonSettings::HEIGHT_UNIT);
732
- self::checkbox(array(CrayonSettings::WIDTH_SET, '<span class="crayon-span-50">' . crayon__('Width') . ' </span>'), FALSE);
733
- self::dropdown(CrayonSettings::WIDTH_MODE, FALSE);
734
- echo ' ';
735
- self::textbox(array('id' => CrayonSettings::WIDTH, 'size' => 8));
736
- echo ' ';
737
- self::dropdown(CrayonSettings::WIDTH_UNIT);
738
- $text = array(crayon__('Top Margin') => array(CrayonSettings::TOP_SET, CrayonSettings::TOP_MARGIN),
739
- crayon__('Bottom Margin') => array(CrayonSettings::BOTTOM_SET, CrayonSettings::BOTTOM_MARGIN),
740
- crayon__('Left Margin') => array(CrayonSettings::LEFT_SET, CrayonSettings::LEFT_MARGIN),
741
- crayon__('Right Margin') => array(CrayonSettings::RIGHT_SET, CrayonSettings::RIGHT_MARGIN));
742
- foreach ($text as $p => $s) {
743
- $set = $s[0];
744
- $margin = $s[1];
745
- $preview = ($p == crayon__('Left Margin') || $p == crayon__('Right Margin'));
746
- self::checkbox(array($set, '<span class="crayon-span-110">' . $p . '</span>'), FALSE, $preview);
747
- echo ' ';
748
- self::textbox(array('id' => $margin, 'size' => 8, 'preview' => FALSE));
749
- echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span>', CRAYON_BR;
750
- }
751
- echo '<span class="crayon-span" style="min-width: 135px;">' . crayon__('Horizontal Alignment') . ' </span>';
752
- self::dropdown(CrayonSettings::H_ALIGN);
753
- echo '<div id="crayon-subsection-float">';
754
- self::checkbox(array(CrayonSettings::FLOAT_ENABLE, crayon__('Allow floating elements to surround Crayon')), FALSE, FALSE);
755
- echo '</div>';
756
- echo '<span class="crayon-span-100">' . crayon__('Inline Margin') . ' </span>';
757
- self::textbox(array('id' => CrayonSettings::INLINE_MARGIN, 'size' => 2));
758
- echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span>';
759
- echo '</div>';
760
- }
761
-
762
- public static function toolbar() {
763
- echo '<div id="crayon-section-toolbar" class="crayon-hide-inline">';
764
- self::span(crayon__('Display the Toolbar') . ' ');
765
- self::dropdown(CrayonSettings::TOOLBAR);
766
- echo '<div id="crayon-subsection-toolbar">';
767
- self::checkbox(array(CrayonSettings::TOOLBAR_OVERLAY, crayon__('Overlay the toolbar on code rather than push it down when possible')));
768
- self::checkbox(array(CrayonSettings::TOOLBAR_HIDE, crayon__('Toggle the toolbar on single click when it is overlayed')));
769
- self::checkbox(array(CrayonSettings::TOOLBAR_DELAY, crayon__('Delay hiding the toolbar on MouseOut')));
770
- echo '</div>';
771
- self::checkbox(array(CrayonSettings::SHOW_TITLE, crayon__('Display the title when provided')));
772
- self::span(crayon__('Display the language') . ' ');
773
- self::dropdown(CrayonSettings::SHOW_LANG);
774
- echo '</div>';
775
- }
776
-
777
- public static function lines() {
778
- echo '<div id="crayon-section-lines" class="crayon-hide-inline">';
779
- self::checkbox(array(CrayonSettings::STRIPED, crayon__('Display striped code lines')));
780
- self::checkbox(array(CrayonSettings::MARKING, crayon__('Enable line marking for important lines')));
781
- self::checkbox(array(CrayonSettings::RANGES, crayon__('Enable line ranges for showing only parts of code')));
782
- self::checkbox(array(CrayonSettings::NUMS, crayon__('Display line numbers by default')));
783
- self::checkbox(array(CrayonSettings::NUMS_TOGGLE, crayon__('Enable line number toggling')));
784
- self::checkbox(array(CrayonSettings::WRAP, crayon__('Wrap lines by default')));
785
- self::checkbox(array(CrayonSettings::WRAP_TOGGLE, crayon__('Enable line wrap toggling')));
786
- self::span(crayon__('Start line numbers from') . ' ');
787
- self::textbox(array('id' => CrayonSettings::START_LINE, 'size' => 2, 'break' => TRUE));
788
- echo '</div>';
789
- }
790
-
791
- public static function langs() {
792
- echo '<a name="langs"></a>';
793
- // Specialised dropdown for languages
794
- if (array_key_exists(CrayonSettings::FALLBACK_LANG, self::$options)) {
795
- if (($langs = CrayonParser::parse_all()) != FALSE) {
796
- $langs = CrayonLangs::sort_by_name($langs);
797
- self::span(crayon__('When no language is provided, use the fallback') . ': ');
798
- self::dropdown(CrayonSettings::FALLBACK_LANG, FALSE, TRUE, TRUE, $langs);
799
- // Information about parsing
800
- $parsed = CrayonResources::langs()->is_parsed();
801
- $count = count($langs);
802
- echo '</select>', CRAYON_BR, ($parsed ? '' : '<span class="crayon-error">'),
803
- sprintf(crayon_n('%d language has been detected.', '%d languages have been detected.', $count), $count), ' ',
804
- $parsed ? crayon__('Parsing was successful') : crayon__('Parsing was unsuccessful'),
805
- ($parsed ? '. ' : '</span>');
806
- // Check if fallback from db is loaded
807
- $db_fallback = self::$options[CrayonSettings::FALLBACK_LANG]; // Fallback name from db
808
-
809
- if (!CrayonResources::langs()->is_loaded($db_fallback) || !CrayonResources::langs()->exists($db_fallback)) {
810
- echo '<br/><span class="crayon-error">', sprintf(crayon__('The selected language with id %s could not be loaded'), '<strong>' . $db_fallback . '</strong>'), '. </span>';
811
- }
812
- // Language parsing info
813
- echo CRAYON_BR, '<div id="crayon-subsection-langs-info"><div>' . self::button(array('id' => 'show-langs', 'title' => crayon__('Show Languages'))) . '</div></div>';
814
- } else {
815
- echo crayon__('No languages could be parsed.');
816
- }
817
- }
818
- }
819
-
820
- public static function show_langs() {
821
- CrayonSettingsWP::load_settings();
822
- require_once(CRAYON_PARSER_PHP);
823
- if (($langs = CrayonParser::parse_all()) != FALSE) {
824
- $langs = CrayonLangs::sort_by_name($langs);
825
- echo '<table class="crayon-table" cellspacing="0" cellpadding="0"><tr class="crayon-table-header">',
826
- '<td>',crayon__('ID'),'</td><td>',crayon__('Name'),'</td><td>',crayon__('Version'),'</td><td>',crayon__('File Extensions'),'</td><td>',crayon__('Aliases'),'</td><td>',crayon__('State'),'</td></tr>';
827
- $keys = array_values($langs);
828
- for ($i = 0; $i < count($langs); $i++) {
829
- $lang = $keys[$i];
830
- $tr = ($i == count($langs) - 1) ? 'crayon-table-last' : '';
831
- echo '<tr class="', $tr, '">',
832
- '<td>', $lang->id(), '</td>',
833
- '<td>', $lang->name(), '</td>',
834
- '<td>', $lang->version(), '</td>',
835
- '<td>', implode(', ', $lang->ext()), '</td>',
836
- '<td>', implode(', ', $lang->alias()), '</td>',
837
- '<td class="', strtolower(CrayonUtil::space_to_hyphen($lang->state_info())), '">',
838
- $lang->state_info(), '</td>',
839
- '</tr>';
840
- }
841
- echo '</table><br/>' . crayon__("Languages that have the same extension as their name don't need to explicitly map extensions.");
842
- } else {
843
- echo crayon__('No languages could be found.');
844
- }
845
- exit();
846
- }
847
-
848
- public static function posts() {
849
- echo '<a name="posts"></a>';
850
- echo self::button(array('id' => 'show-posts', 'title' => crayon__('Show Crayon Posts')));
851
- echo ' <input type="submit" name="', self::OPTIONS, '[refresh_tags]" id="refresh_tags" class="button-primary" value="', crayon__('Refresh'), '" />';
852
- echo self::help_button('http://aramk.com/blog/2012/09/26/internal-post-management-crayon/');
853
- echo '<div id="crayon-subsection-posts-info"></div>';
854
- }
855
-
856
- public static function post_cmp($a, $b) {
857
- $a = $a->post_modified;
858
- $b = $b->post_modified;
859
- if ($a == $b) {
860
- return 0;
861
- } else {
862
- return $a < $b ? 1 : -1;
863
- }
864
- }
865
-
866
- public static function show_posts() {
867
- CrayonSettingsWP::load_settings();
868
- $postIDs = self::load_posts();
869
- $legacy_posts = self::load_legacy_posts();
870
- // Avoids O(n^2) by using a hash map, tradeoff in using strval
871
- $legacy_map = array();
872
- foreach ($legacy_posts as $legacyID) {
873
- $legacy_map[strval($legacyID)] = TRUE;
874
- }
875
-
876
- echo '<table class="crayon-table" cellspacing="0" cellpadding="0"><tr class="crayon-table-header">',
877
- '<td>', crayon__('ID'), '</td><td>', crayon__('Title'), '</td><td>', crayon__('Posted'), '</td><td>', crayon__('Modifed'), '</td><td>', crayon__('Contains Legacy Tags?'), '</td></tr>';
878
-
879
- $posts = array();
880
- for ($i = 0; $i < count($postIDs); $i++) {
881
- $posts[$i] = get_post($postIDs[$i]);
882
- }
883
-
884
- usort($posts, 'CrayonSettingsWP::post_cmp');
885
-
886
- for ($i = 0; $i < count($posts); $i++) {
887
- $post = $posts[$i];
888
- $postID = $post->ID;
889
- $title = $post->post_title;
890
- $title = !empty($title) ? $title : 'N/A';
891
- $tr = ($i == count($posts) - 1) ? 'crayon-table-last' : '';
892
- echo '<tr class="', $tr, '">',
893
- '<td>', $postID, '</td>',
894
- '<td><a href="', $post->guid, '" target="_blank">', $title, '</a></td>',
895
- '<td>', $post->post_date, '</td>',
896
- '<td>', $post->post_modified, '</td>',
897
- '<td>', isset($legacy_map[strval($postID)]) ? '<span style="color: red;">' . crayon__('Yes') . '</a>' : crayon__('No'), '</td>',
898
- '</tr>';
899
- }
900
-
901
- echo '</table>';
902
- exit();
903
- }
904
-
905
- public static function show_preview() {
906
- echo '<div id="content">';
907
-
908
- self::load_settings(); // Run first to ensure global settings loaded
909
-
910
- $crayon = CrayonWP::instance();
911
-
912
- // Settings to prevent from validating
913
- $preview_settings = array(self::SAMPLE_CODE);
914
-
915
- // Load settings from GET and validate
916
- foreach ($_POST as $key => $value) {
917
- // echo $key, ' ', $value , '<br/>';
918
- $value = stripslashes($value);
919
- if (!in_array($key, $preview_settings)) {
920
- $_POST[$key] = CrayonSettings::validate($key, $value);
921
- } else {
922
- $_POST[$key] = $value;
923
- }
924
- }
925
- $crayon->settings($_POST);
926
- if (!isset($crayon_preview_dont_override_get) || !$crayon_preview_dont_override_get) {
927
- $settings = array(CrayonSettings::TOP_SET => TRUE, CrayonSettings::TOP_MARGIN => 10,
928
- CrayonSettings::BOTTOM_SET => FALSE, CrayonSettings::BOTTOM_MARGIN => 0);
929
- $crayon->settings($settings);
930
- }
931
-
932
- // Print the theme CSS
933
- $theme_id = $crayon->setting_val(CrayonSettings::THEME);
934
- if ($theme_id != NULL) {
935
- echo CrayonResources::themes()->get_css($theme_id, date('U'));
936
- }
937
-
938
- $font_id = $crayon->setting_val(CrayonSettings::FONT);
939
- if ($font_id != NULL /*&& $font_id != CrayonFonts::DEFAULT_FONT*/) {
940
- echo CrayonResources::fonts()->get_css($font_id);
941
- }
942
-
943
- // Load custom code based on language
944
- $lang = $crayon->setting_val(CrayonSettings::FALLBACK_LANG);
945
- $path = crayon_pf(CRAYON_UTIL_PATH . '/sample/' . $lang . '.txt', FALSE);
946
-
947
- if (isset($_POST[self::SAMPLE_CODE])) {
948
- $crayon->code($_POST[self::SAMPLE_CODE]);
949
- } else if ($lang && @file_exists($path)) {
950
- $crayon->url($path);
951
- } else {
952
- $code = "
953
- // A sample class
954
- class Human {
955
- private int age = 0;
956
- public void birthday() {
957
- age++;
958
- print('Happy Birthday!');
959
- }
960
- }
961
- ";
962
- $crayon->code($code);
963
- }
964
- $crayon->title('Sample Code');
965
- $crayon->marked('5-7');
966
- $crayon->output($highlight = true, $nums = true, $print = true);
967
- echo '</div>';
968
- crayon_load_plugin_textdomain();
969
- exit();
970
- }
971
-
972
- public static function theme($editor = FALSE) {
973
- $db_theme = self::$options[CrayonSettings::THEME]; // Theme name from db
974
- if (!array_key_exists(CrayonSettings::THEME, self::$options)) {
975
- $db_theme = '';
976
- }
977
- $themes_array = CrayonResources::themes()->get_array();
978
- // Mark user themes
979
- foreach ($themes_array as $id => $name) {
980
- $mark = CrayonResources::themes()->get($id)->user() ? ' *' : '';
981
- $themes_array[$id] = array($name, $name . $mark);
982
- }
983
- $missing_theme = !CrayonResources::themes()->is_loaded($db_theme) || !CrayonResources::themes()->exists($db_theme);
984
- self::dropdown(CrayonSettings::THEME, FALSE, FALSE, TRUE, $themes_array, $missing_theme ? CrayonThemes::DEFAULT_THEME : NULL);
985
- if ($editor) {
986
- return;
987
- }
988
- // Theme editor
989
- if (CRAYON_THEME_EDITOR) {
990
- // echo '<a id="crayon-theme-editor-button" class="button-primary crayon-admin-button" loading="'. crayon__('Loading...') .'" loaded="'. crayon__('Theme Editor') .'" >'. crayon__('Theme Editor') .'</a></br>';
991
- echo '<div id="crayon-theme-editor-admin-buttons">';
992
- $buttons = array('edit' => crayon__('Edit'), 'duplicate' => crayon__('Duplicate'), 'submit' => crayon__('Submit'),
993
- 'delete' => crayon__('Delete'));
994
- foreach ($buttons as $k => $v) {
995
- echo '<a id="crayon-theme-editor-', $k, '-button" class="button-secondary crayon-admin-button" loading="', crayon__('Loading...'), '" loaded="', $v, '" >', $v, '</a>';
996
- }
997
- echo '<span class="crayon-span-5"></span>', self::help_button('http://aramk.com/blog/2012/12/27/crayon-theme-editor/'), '<span class="crayon-span-5"></span>', crayon__("Duplicate a Stock Theme into a User Theme to allow editing.");
998
- echo '</br></div>';
999
- }
1000
- // Preview Box
1001
- ?>
1002
- <div id="crayon-theme-panel">
1003
- <div id="crayon-theme-info"></div>
1004
- <div id="crayon-live-preview-wrapper">
1005
- <div id="crayon-live-preview-inner">
1006
- <div id="crayon-live-preview"></div>
1007
- <div id="crayon-preview-info">
1008
- <?php printf(crayon__('Change the %1$sfallback language%2$s to change the sample code or %3$schange it manually%4$s. Lines 5-7 are marked.'), '<a href="#langs">', '</a>', '<a id="crayon-change-code" href="#">', '</a>'); ?>
1009
- </div>
1010
- </div>
1011
- </div>
1012
- </div>
1013
- <?php
1014
- // Preview checkbox
1015
- self::checkbox(array(CrayonSettings::PREVIEW, crayon__('Enable Live Preview')), FALSE, FALSE);
1016
- echo '</select><span class="crayon-span-10"></span>';
1017
- self::checkbox(array(CrayonSettings::ENQUEUE_THEMES, crayon__('Enqueue themes in the header (more efficient).') . self::help_button('http://aramk.com/blog/2012/01/07/enqueuing-themes-and-fonts-in-crayon/')));
1018
- // Check if theme from db is loaded
1019
- if ($missing_theme) {
1020
- echo '<span class="crayon-error">', sprintf(crayon__('The selected theme with id %s could not be loaded'), '<strong>' . $db_theme . '</strong>'), '. </span>';
1021
- }
1022
- }
1023
-
1024
- public static function font($editor = FALSE) {
1025
- $db_font = self::$options[CrayonSettings::FONT]; // Theme name from db
1026
- if (!array_key_exists(CrayonSettings::FONT, self::$options)) {
1027
- $db_font = '';
1028
- }
1029
- $fonts_array = CrayonResources::fonts()->get_array();
1030
- self::dropdown(CrayonSettings::FONT, FALSE, TRUE, TRUE, $fonts_array);
1031
- echo '<span class="crayon-span-5"></span>';
1032
- // TODO(aramk) Add this blog article back.
1033
- // echo '<a href="http://bit.ly/Yr2Xv6" target="_blank">', crayon__('Add More'), '</a>';
1034
- echo '<span class="crayon-span-10"></span>';
1035
- self::checkbox(array(CrayonSettings::FONT_SIZE_ENABLE, crayon__('Custom Font Size') . ' '), FALSE);
1036
- self::textbox(array('id' => CrayonSettings::FONT_SIZE, 'size' => 2));
1037
- echo '<span class="crayon-span-margin">', crayon__('Pixels'), ',&nbsp;&nbsp;', crayon__('Line Height'), ' </span>';
1038
- self::textbox(array('id' => CrayonSettings::LINE_HEIGHT, 'size' => 2));
1039
- echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span></br>';
1040
- if ((!CrayonResources::fonts()->is_loaded($db_font) || !CrayonResources::fonts()->exists($db_font))) {
1041
- // Default font doesn't actually exist as a file, it means do not override default theme font
1042
- echo '<span class="crayon-error">', sprintf(crayon__('The selected font with id %s could not be loaded'), '<strong>' . $db_font . '</strong>'), '. </span><br/>';
1043
- }
1044
- if ($editor) {
1045
- return;
1046
- }
1047
- echo '<div style="height:10px;"></div>';
1048
- self::checkbox(array(CrayonSettings::ENQUEUE_FONTS, crayon__('Enqueue fonts in the header (more efficient).') . self::help_button('http://aramk.com/blog/2012/01/07/enqueuing-themes-and-fonts-in-crayon/')));
1049
- }
1050
-
1051
- public static function code($editor = FALSE) {
1052
- echo '<div id="crayon-section-code-interaction" class="crayon-hide-inline-only">';
1053
- self::checkbox(array(CrayonSettings::PLAIN, crayon__('Enable plain code view and display') . ' '), FALSE);
1054
- self::dropdown(CrayonSettings::SHOW_PLAIN);
1055
- echo '<span id="crayon-subsection-copy-check">';
1056
- self::checkbox(array(CrayonSettings::PLAIN_TOGGLE, crayon__('Enable plain code toggling')));
1057
- self::checkbox(array(CrayonSettings::SHOW_PLAIN_DEFAULT, crayon__('Show the plain code by default')));
1058
- self::checkbox(array(CrayonSettings::COPY, crayon__('Enable code copy/paste')));
1059
- echo '</span>';
1060
- self::checkbox(array(CrayonSettings::POPUP, crayon__('Enable opening code in a window')));
1061
- self::checkbox(array(CrayonSettings::SCROLL, crayon__('Always display scrollbars')));
1062
- self::checkbox(array(CrayonSettings::MINIMIZE, crayon__('Minimize code') . self::help_button('http://aramk.com/blog/2013/01/15/minimizing-code-in-crayon/')));
1063
- self::checkbox(array(CrayonSettings::EXPAND, crayon__('Expand code beyond page borders on mouseover')));
1064
- self::checkbox(array(CrayonSettings::EXPAND_TOGGLE, crayon__('Enable code expanding toggling when possible')));
1065
- echo '</div>';
1066
- if (!$editor) {
1067
- self::checkbox(array(CrayonSettings::DECODE, crayon__('Decode HTML entities in code')));
1068
- }
1069
- self::checkbox(array(CrayonSettings::DECODE_ATTRIBUTES, crayon__('Decode HTML entities in attributes')));
1070
- echo '<div class="crayon-hide-inline-only">';
1071
- self::checkbox(array(CrayonSettings::TRIM_WHITESPACE, crayon__('Remove whitespace surrounding the shortcode content')));
1072
- echo '</div>';
1073
- self::checkbox(array(CrayonSettings::TRIM_CODE_TAG, crayon__('Remove &lt;code&gt; tags surrounding the shortcode content')));
1074
- self::checkbox(array(CrayonSettings::MIXED, crayon__('Allow Mixed Language Highlighting with delimiters and tags.') . self::help_button('http://aramk.com/blog/2011/12/25/mixed-language-highlighting-in-crayon/')));
1075
- echo '<div class="crayon-hide-inline-only">';
1076
- self::checkbox(array(CrayonSettings::SHOW_MIXED, crayon__('Show Mixed Language Icon (+)')));
1077
- echo '</div>';
1078
- self::checkbox(array(CrayonSettings::TAB_CONVERT, crayon__('Convert tabs to spaces')));
1079
- self::span(crayon__('Tab size in spaces') . ': ');
1080
- self::textbox(array('id' => CrayonSettings::TAB_SIZE, 'size' => 2, 'break' => TRUE));
1081
- self::span(crayon__('Blank lines before code:') . ' ');
1082
- self::textbox(array('id' => CrayonSettings::WHITESPACE_BEFORE, 'size' => 2, 'break' => TRUE));
1083
- self::span(crayon__('Blank lines after code:') . ' ');
1084
- self::textbox(array('id' => CrayonSettings::WHITESPACE_AFTER, 'size' => 2, 'break' => TRUE));
1085
- }
1086
-
1087
- public static function tags() {
1088
- self::checkbox(array(CrayonSettings::INLINE_TAG, crayon__('Capture Inline Tags') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1089
- self::checkbox(array(CrayonSettings::INLINE_WRAP, crayon__('Wrap Inline Tags') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1090
- self::checkbox(array(CrayonSettings::CODE_TAG_CAPTURE, crayon__('Capture &lt;code&gt; as')), FALSE);
1091
- echo ' ';
1092
- self::dropdown(CrayonSettings::CODE_TAG_CAPTURE_TYPE, FALSE);
1093
- echo self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/') . '<br/>';
1094
- self::checkbox(array(CrayonSettings::BACKQUOTE, crayon__('Capture `backquotes` as &lt;code&gt;') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1095
- self::checkbox(array(CrayonSettings::CAPTURE_PRE, crayon__('Capture &lt;pre&gt; tags as Crayons') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1096
-
1097
- echo '<div class="note" style="width: 350px;">', sprintf(crayon__("Using this markup for Mini Tags and Inline tags is now %sdepreciated%s! Use the %sTag Editor%s instead and convert legacy tags."), '<a href="http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/" target="_blank">', '</a>', '<a href="http://aramk.com/blog/2012/03/25/crayon-tag-editor/‎" target="_blank">', '</a>'), '</div>';
1098
- self::checkbox(array(CrayonSettings::CAPTURE_MINI_TAG, crayon__('Capture Mini Tags like [php][/php] as Crayons.') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1099
- self::checkbox(array(CrayonSettings::INLINE_TAG_CAPTURE, crayon__('Capture Inline Tags like {php}{/php} inside sentences.') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1100
- self::checkbox(array(CrayonSettings::PLAIN_TAG, crayon__('Enable [plain][/plain] tag.') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1101
- }
1102
-
1103
- public static function files() {
1104
- echo '<a name="files"></a>';
1105
- echo crayon__('When loading local files and a relative path is given for the URL, use the absolute path'), ': ',
1106
- '<div style="margin-left: 20px">', home_url(), '/';
1107
- self::textbox(array('id' => CrayonSettings::LOCAL_PATH));
1108
- echo '</div>', crayon__('Followed by your relative URL.');
1109
- }
1110
-
1111
- public static function tag_editor() {
1112
- $can_convert = self::load_legacy_posts();
1113
- if ($can_convert) {
1114
- $disabled = '';
1115
- $convert_text = crayon__('Convert Legacy Tags');
1116
- } else {
1117
- $disabled = 'disabled="disabled"';
1118
- $convert_text = crayon__('No Legacy Tags Found');
1119
- }
1120
-
1121
- echo '<input type="submit" name="', self::OPTIONS, '[convert]" id="convert" class="button-primary" value="', $convert_text, '"', $disabled, ' />&nbsp; ';
1122
- self::checkbox(array('convert_encode', crayon__("Encode")), FALSE);
1123
- echo self::help_button('http://aramk.com/blog/2012/09/26/converting-legacy-tags-to-pre/'), CRAYON_BR, CRAYON_BR;
1124
- $sep = sprintf(crayon__('Use %s to separate setting names from values in the &lt;pre&gt; class attribute'),
1125
- self::dropdown(CrayonSettings::ATTR_SEP, FALSE, FALSE, FALSE));
1126
- echo '<span>', $sep, self::help_button('http://aramk.com/blog/2012/03/25/crayon-tag-editor/'), '</span><br/>';
1127
- self::checkbox(array(CrayonSettings::TAG_EDITOR_FRONT, crayon__("Display the Tag Editor in any TinyMCE instances on the frontend (e.g. bbPress)") . self::help_button('http://aramk.com/blog/2012/09/08/crayon-with-bbpress/')));
1128
- self::checkbox(array(CrayonSettings::TAG_EDITOR_SETTINGS, crayon__("Display Tag Editor settings on the frontend")));
1129
- }
1130
-
1131
- public static function misc() {
1132
- echo crayon__('Clear the cache used to store remote code requests'), ': ';
1133
- self::dropdown(CrayonSettings::CACHE, false);
1134
- echo '<input type="submit" id="', self::CACHE_CLEAR, '" name="', self::CACHE_CLEAR, '" class="button-secondary" value="', crayon__('Clear Now'), '" /><br/>';
1135
- self::checkbox(array(CrayonSettings::EFFICIENT_ENQUEUE, crayon__('Attempt to load Crayon\'s CSS and JavaScript only when needed') . self::help_button('http://aramk.com/blog/2012/01/23/failing-to-load-crayons-on-pages/')));
1136
- self::checkbox(array(CrayonSettings::SAFE_ENQUEUE, crayon__('Disable enqueuing for page templates that may contain The Loop.') . self::help_button('http://aramk.com/blog/2012/01/23/failing-to-load-crayons-on-pages/')));
1137
- self::checkbox(array(CrayonSettings::COMMENTS, crayon__('Allow Crayons inside comments')));
1138
- self::checkbox(array(CrayonSettings::EXCERPT_STRIP, crayon__('Remove Crayons from excerpts')));
1139
- self::checkbox(array(CrayonSettings::MAIN_QUERY, crayon__('Load Crayons only from the main Wordpress query')));
1140
- self::checkbox(array(CrayonSettings::TOUCHSCREEN, crayon__('Disable mouse gestures for touchscreen devices (eg. MouseOver)')));
1141
- self::checkbox(array(CrayonSettings::DISABLE_ANIM, crayon__('Disable animations')));
1142
- self::checkbox(array(CrayonSettings::DISABLE_RUNTIME, crayon__('Disable runtime stats')));
1143
- }
1144
-
1145
- // Debug Fields ===========================================================
1146
-
1147
- public static function errors() {
1148
- self::checkbox(array(CrayonSettings::ERROR_LOG, crayon__('Log errors for individual Crayons')));
1149
- self::checkbox(array(CrayonSettings::ERROR_LOG_SYS, crayon__('Log system-wide errors')));
1150
- self::checkbox(array(CrayonSettings::ERROR_MSG_SHOW, crayon__('Display custom message for errors')));
1151
- self::textbox(array('id' => CrayonSettings::ERROR_MSG, 'size' => 60, 'margin' => TRUE));
1152
- }
1153
-
1154
- public static function log() {
1155
- $log = CrayonLog::log();
1156
- touch(CRAYON_LOG_FILE);
1157
- $exists = file_exists(CRAYON_LOG_FILE);
1158
- $writable = is_writable(CRAYON_LOG_FILE);
1159
- if (!empty($log)) {
1160
- echo '<div id="crayon-log-wrapper">', '<div id="crayon-log"><div id="crayon-log-text">', $log,
1161
- '</div></div>', '<div id="crayon-log-controls">',
1162
- '<input type="button" id="crayon-log-toggle" show_txt="', crayon__('Show Log'), '" hide_txt="', crayon__('Hide Log'), '" class="button-secondary" value="', crayon__('Show Log'), '"> ',
1163
- '<input type="submit" id="crayon-log-clear" name="', self::LOG_CLEAR,
1164
- '" class="button-secondary" value="', crayon__('Clear Log'), '"> ', '<input type="submit" id="crayon-log-email" name="',
1165
- self::LOG_EMAIL_ADMIN . '" class="button-secondary" value="', crayon__('Email Admin'), '"> ',
1166
- '<input type="submit" id="crayon-log-email" name="', self::LOG_EMAIL_DEV,
1167
- '" class="button-secondary" value="', crayon__('Email Developer'), '"> ', '</div>', '</div>';
1168
- }
1169
- echo '<span', (!empty($log)) ? ' class="crayon-span"' : '', '>', (empty($log)) ? crayon__('The log is currently empty.') . ' ' : '';
1170
- if ($exists) {
1171
- $writable ? crayon_e('The log file exists and is writable.') : crayon_e('The log file exists and is not writable.');
1172
- } else {
1173
- crayon_e('The log file does not exist and is not writable.');
1174
- }
1175
- echo '</span>';
1176
- }
1177
-
1178
- // About Fields ===========================================================
1179
-
1180
- public static function info() {
1181
- global $CRAYON_VERSION, $CRAYON_DATE, $CRAYON_AUTHOR, $CRAYON_WEBSITE, $CRAYON_TWITTER, $CRAYON_GIT, $CRAYON_PLUGIN_WP, $CRAYON_AUTHOR_SITE, $CRAYON_EMAIL, $CRAYON_DONATE;
1182
- echo '<a name="info"></a>';
1183
- $version = '<strong>' . crayon__('Version') . ':</strong> ' . $CRAYON_VERSION;
1184
- $date = $CRAYON_DATE;
1185
- $developer = '<strong>' . crayon__('Developer') . ':</strong> ' . '<a href="' . $CRAYON_AUTHOR_SITE . '" target="_blank">' . $CRAYON_AUTHOR . '</a>';
1186
- $translators = '<strong>' . crayon__('Translators') . ':</strong> ' .
1187
- '
1188
- Arabic (<a href="http://djennadhamza.eb2a.com/" target="_blank">Djennad Hamza</a>),
1189
- Chinese Simplified (<a href="http://smerpup.com/" target="_blank">Dezhi Liu</a>, <a href="http://neverno.me/" target="_blank">Jash Yin</a>),
1190
- Chinese Traditional (<a href="http://www.arefly.com/" target="_blank">Arefly</a>),
1191
- Dutch (<a href="https://twitter.com/RobinRoelofsen" target="_blank">Robin Roelofsen</a>, <a href="https://twitter.com/#!/chilionsnoek" target="_blank">Chilion Snoek</a>),
1192
- French (<a href="http://tech.dupeu.pl" target="_blank">Victor Felder</a>),
1193
- Finnish (<a href="https://github.com/vahalan" target="_blank">vahalan</a>),
1194
- German (<a href="http://www.technologyblog.de/" target="_blank">Stephan Knau&#223;</a>),
1195
- Italian (<a href="http://www.federicobellucci.net/" target="_blank">Federico Bellucci</a>),
1196
- Japanese (<a href="https://twitter.com/#!/west_323" target="_blank">@west_323</a>),
1197
- Korean (<a href="https://github.com/dokenzy" target="_blank">dokenzy</a>),
1198
- Lithuanian (Vincent G),
1199
- Persian (MahdiY),
1200
- Polish (<a href="https://github.com/toszcze" target="_blank">Bartosz Romanowski</a>),
1201
- Portuguese (<a href="http://www.adonai.eti.br" target="_blank">Adonai S. Canez</a>),
1202
- Russian (<a href="http://simplelib.com/" target="_blank">Minimus</a>, Di_Skyer),
1203
- Slovak (<a href="https://twitter.com/#!/webhostgeeks" target="_blank">webhostgeeks</a>),
1204
- Slovenian (<a href="http://jodlajodla.si/" target="_blank">Jan Su&#353;nik</a>),
1205
- Spanish (<a href="http://www.hbravo.com/" target="_blank">Hermann Bravo</a>),
1206
- Turkish (<a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>),
1207
- Ukrainian (<a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)';
1208
-
1209
- $links = '
1210
- <a id="docs-icon" class="small-icon" title="Documentation" href="' . $CRAYON_WEBSITE . '" target="_blank"></a>
1211
- <a id="git-icon" class="small-icon" title="GitHub" href="' . $CRAYON_GIT . '" target="_blank"></a>
1212
- <a id="wp-icon" class="small-icon" title="Plugin Page" href="' . $CRAYON_PLUGIN_WP . '" target="_blank"></a>
1213
- <a id="twitter-icon" class="small-icon" title="Twitter" href="' . $CRAYON_TWITTER . '" target="_blank"></a>
1214
- <a id="gmail-icon" class="small-icon" title="Email" href="mailto:' . $CRAYON_EMAIL . '" target="_blank"></a>
1215
- <div id="crayon-donate"><a href="' . $CRAYON_DONATE . '" title="Donate" target="_blank">
1216
- <img src="' . plugins_url(CRAYON_DONATE_BUTTON, __FILE__) . '"></a>
1217
- </div>';
1218
-
1219
- echo '
1220
- <table id="crayon-info" border="0">
1221
- <tr>
1222
- <td>' . $version . ' - ' . $date . '</td>
1223
- </tr>
1224
- <tr>
1225
- <td>' . $developer . '</td>
1226
- </tr>
1227
- <tr>
1228
- <td>' . $translators . '</td>
1229
- </tr>
1230
- <tr>
1231
- <td colspan="2">' . $links . '</td>
1232
- </tr>
1233
- </table>';
1234
-
1235
- }
1236
-
1237
- public static function help_button($link) {
1238
- return ' <a href="' . $link . '" target="_blank" class="crayon-question">' . crayon__('?') . '</a>';
1239
- }
1240
-
1241
- public static function plugin_row_meta($meta, $file) {
1242
- global $CRAYON_DONATE;
1243
- if ($file == CrayonWP::basename()) {
1244
- $meta[] = '<a href="options-general.php?page=crayon_settings">' . crayon__('Settings') . '</a>';
1245
- $meta[] = '<a href="options-general.php?page=crayon_settings&theme-editor=1">' . crayon__('Theme Editor') . '</a>';
1246
- $meta[] = '<a href="' . $CRAYON_DONATE . '" target="_blank">' . crayon__('Donate') . '</a>';
1247
- }
1248
- return $meta;
1249
- }
1250
- }
1251
-
1252
- // Add the settings menus
1253
-
1254
- if (defined('ABSPATH') && is_admin()) {
1255
- // For the admin section
1256
- add_action('admin_menu', 'CrayonSettingsWP::admin_load');
1257
- add_filter('plugin_row_meta', 'CrayonSettingsWP::plugin_row_meta', 10, 2);
1258
- }
1259
-
1260
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once('global.php');
3
+ require_once(CRAYON_LANGS_PHP);
4
+ require_once(CRAYON_THEMES_PHP);
5
+ require_once(CRAYON_FONTS_PHP);
6
+ require_once(CRAYON_SETTINGS_PHP);
7
+
8
+ /* Manages global settings within WP and integrates them with CrayonSettings.
9
+ CrayonHighlighter and any non-WP classes will only use CrayonSettings to separate
10
+ the implementation of global settings and ensure any system can use them. */
11
+
12
+ class CrayonSettingsWP {
13
+ // Properties and Constants ===============================================
14
+
15
+ // A copy of the current options in db
16
+ private static $options = NULL;
17
+ // Posts containing crayons in db
18
+ private static $crayon_posts = NULL;
19
+ // Posts containing legacy tags in db
20
+ private static $crayon_legacy_posts = NULL;
21
+ // An array of cache names for use with Transients API
22
+ private static $cache = NULL;
23
+ // Array of settings to pass to js
24
+ private static $js_settings = NULL;
25
+ private static $js_strings = NULL;
26
+ private static $admin_js_settings = NULL;
27
+ private static $admin_js_strings = NULL;
28
+ private static $admin_page = '';
29
+ private static $is_fully_loaded = FALSE;
30
+
31
+ const SETTINGS = 'crayon_fields';
32
+ const FIELDS = 'crayon_settings';
33
+ const OPTIONS = 'crayon_options';
34
+ const POSTS = 'crayon_posts';
35
+ const LEGACY_POSTS = 'crayon_legacy_posts';
36
+ const CACHE = 'crayon_cache';
37
+ const GENERAL = 'crayon_general';
38
+ const DEBUG = 'crayon_debug';
39
+ const ABOUT = 'crayon_about';
40
+
41
+ // Used on submit
42
+ const LOG_CLEAR = 'log_clear';
43
+ const LOG_EMAIL_ADMIN = 'log_email_admin';
44
+ const LOG_EMAIL_DEV = 'log_email_dev';
45
+ const SAMPLE_CODE = 'sample-code';
46
+ const CACHE_CLEAR = 'crayon-cache-clear';
47
+
48
+ private function __construct() {
49
+ }
50
+
51
+ // Methods ================================================================
52
+
53
+ public static function admin_load() {
54
+ self::$admin_page = $admin_page = add_options_page('Crayon Syntax Highlighter ' . crayon__('Settings'), 'Crayon', 'manage_options', 'crayon_settings', 'CrayonSettingsWP::settings');
55
+ add_action("admin_print_scripts-$admin_page", 'CrayonSettingsWP::admin_scripts');
56
+ add_action("admin_print_styles-$admin_page", 'CrayonSettingsWP::admin_styles');
57
+ add_action("admin_print_scripts-$admin_page", 'CrayonThemeEditorWP::admin_resources');
58
+ // Register settings, second argument is option name stored in db
59
+ register_setting(self::FIELDS, self::OPTIONS, 'CrayonSettingsWP::settings_validate');
60
+ add_action("admin_head-$admin_page", 'CrayonSettingsWP::admin_init');
61
+ // Register settings for post page
62
+ add_action("admin_print_styles-post-new.php", 'CrayonSettingsWP::admin_scripts');
63
+ add_action("admin_print_styles-post.php", 'CrayonSettingsWP::admin_scripts');
64
+ add_action("admin_print_styles-post-new.php", 'CrayonSettingsWP::admin_styles');
65
+ add_action("admin_print_styles-post.php", 'CrayonSettingsWP::admin_styles');
66
+
67
+ // TODO depreciated since WP 3.3, remove eventually
68
+ global $wp_version;
69
+ if ($wp_version >= '3.3') {
70
+ add_action("load-$admin_page", 'CrayonSettingsWP::help_screen');
71
+ } else {
72
+ add_filter('contextual_help', 'CrayonSettingsWP::cont_help', 10, 3);
73
+ }
74
+ }
75
+
76
+ public static function admin_styles() {
77
+ global $CRAYON_VERSION;
78
+ if (CRAYON_MINIFY) {
79
+ wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE_MIN, __FILE__), array('editor-buttons'), $CRAYON_VERSION);
80
+ } else {
81
+ wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
82
+ wp_enqueue_style('crayon_global', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
83
+ wp_enqueue_style('crayon_admin', plugins_url(CRAYON_STYLE_ADMIN, __FILE__), array('editor-buttons'), $CRAYON_VERSION);
84
+ }
85
+ }
86
+
87
+ public static function admin_scripts() {
88
+ global $CRAYON_VERSION;
89
+
90
+ if (CRAYON_MINIFY) {
91
+ CrayonWP::enqueue_resources();
92
+ } else {
93
+ wp_enqueue_script('crayon_util_js', plugins_url(CRAYON_JS_UTIL, __FILE__), array('jquery'), $CRAYON_VERSION);
94
+ self::other_scripts();
95
+ }
96
+
97
+ self::init_js_settings();
98
+
99
+ if (is_admin()) {
100
+ wp_enqueue_script('crayon_admin_js', plugins_url(CRAYON_JS_ADMIN, __FILE__), array('jquery', 'crayon_js', 'wpdialogs'), $CRAYON_VERSION);
101
+ self::init_admin_js_settings();
102
+ }
103
+ }
104
+
105
+ public static function other_scripts() {
106
+ global $CRAYON_VERSION;
107
+ self::load_settings(TRUE);
108
+ $deps = array('jquery', 'crayon_util_js');
109
+ if (CrayonGlobalSettings::val(CrayonSettings::POPUP) || is_admin()) {
110
+ // TODO include anyway and minify
111
+ wp_enqueue_script('crayon_jquery_popup', plugins_url(CRAYON_JQUERY_POPUP, __FILE__), array('jquery'), $CRAYON_VERSION);
112
+ $deps[] = 'crayon_jquery_popup';
113
+ }
114
+ wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS, __FILE__), $deps, $CRAYON_VERSION);
115
+ }
116
+
117
+ public static function init_js_settings() {
118
+ // This stores JS variables used in AJAX calls and in the JS files
119
+ global $CRAYON_VERSION;
120
+ self::load_settings(TRUE);
121
+ if (!self::$js_settings) {
122
+ self::$js_settings = array(
123
+ 'version' => $CRAYON_VERSION,
124
+ 'is_admin' => intval(is_admin()),
125
+ 'ajaxurl' => admin_url('admin-ajax.php'),
126
+ 'prefix' => CrayonSettings::PREFIX,
127
+ 'setting' => CrayonSettings::SETTING,
128
+ 'selected' => CrayonSettings::SETTING_SELECTED,
129
+ 'changed' => CrayonSettings::SETTING_CHANGED,
130
+ 'special' => CrayonSettings::SETTING_SPECIAL,
131
+ 'orig_value' => CrayonSettings::SETTING_ORIG_VALUE,
132
+ 'debug' => CRAYON_DEBUG
133
+ );
134
+ }
135
+ if (!self::$js_strings) {
136
+ self::$js_strings = array(
137
+ 'copy' => crayon__('Press %s to Copy, %s to Paste'),
138
+ 'minimize' => crayon__('Click To Expand Code')
139
+ );
140
+ }
141
+ if (CRAYON_MINIFY) {
142
+ wp_localize_script('crayon_js', 'CrayonSyntaxSettings', self::$js_settings);
143
+ wp_localize_script('crayon_js', 'CrayonSyntaxStrings', self::$js_strings);
144
+ } else {
145
+ wp_localize_script('crayon_util_js', 'CrayonSyntaxSettings', self::$js_settings);
146
+ wp_localize_script('crayon_util_js', 'CrayonSyntaxStrings', self::$js_strings);
147
+ }
148
+ }
149
+
150
+ public static function init_admin_js_settings() {
151
+ if (!self::$admin_js_settings) {
152
+ // We need to load themes at this stage
153
+ CrayonSettingsWP::load_settings();
154
+ $themes_ = CrayonResources::themes()->get();
155
+ $stockThemes = array();
156
+ $userThemes = array();
157
+ foreach ($themes_ as $theme) {
158
+ $id = $theme->id();
159
+ $name = $theme->name();
160
+ if ($theme->user()) {
161
+ $userThemes[$id] = $name;
162
+ } else {
163
+ $stockThemes[$id] = $name;
164
+ }
165
+ }
166
+ self::$admin_js_settings = array(
167
+ 'themes' => array_merge($stockThemes, $userThemes),
168
+ 'stockThemes' => $stockThemes,
169
+ 'userThemes' => $userThemes,
170
+ 'defaultTheme' => CrayonThemes::DEFAULT_THEME,
171
+ 'themesURL' => CrayonResources::themes()->dirurl(false),
172
+ 'userThemesURL' => CrayonResources::themes()->dirurl(true),
173
+ 'sampleCode' => self::SAMPLE_CODE,
174
+ 'dialogFunction' => 'wpdialog'
175
+ );
176
+ wp_localize_script('crayon_admin_js', 'CrayonAdminSettings', self::$admin_js_settings);
177
+ }
178
+ if (!self::$admin_js_strings) {
179
+ self::$admin_js_strings = array(
180
+ 'prompt' => crayon__("Prompt"),
181
+ 'value' => crayon__("Value"),
182
+ 'alert' => crayon__("Alert"),
183
+ 'no' => crayon__("No"),
184
+ 'yes' => crayon__("Yes"),
185
+ 'confirm' => crayon__("Confirm"),
186
+ 'changeCode' => crayon__("Change Code")
187
+ );
188
+ wp_localize_script('crayon_admin_js', 'CrayonAdminStrings', self::$admin_js_strings);
189
+ }
190
+ }
191
+
192
+ public static function settings() {
193
+ if (!current_user_can('manage_options')) {
194
+ wp_die(crayon__('You do not have sufficient permissions to access this page.'));
195
+ }
196
+ ?>
197
+
198
+ <script type="text/javascript">
199
+ jQuery(document).ready(function () {
200
+ CrayonSyntaxAdmin.init();
201
+ });
202
+ </script>
203
+
204
+ <div id="crayon-main-wrap" class="wrap">
205
+
206
+ <div id="icon-options-general" class="icon32">
207
+ <br>
208
+ </div>
209
+ <h2>
210
+ Crayon Syntax Highlighter
211
+ <?php crayon_e('Settings'); ?>
212
+ </h2>
213
+ <?php self::help(); ?>
214
+ <form id="crayon-settings-form" action="options.php" method="post">
215
+ <?php
216
+ settings_fields(self::FIELDS);
217
+ ?>
218
+
219
+ <?php
220
+ do_settings_sections(self::SETTINGS);
221
+ ?>
222
+
223
+ <p class="submit">
224
+ <input type="submit" name="submit" id="submit" class="button-primary"
225
+ value="<?php
226
+ crayon_e('Save Changes');
227
+ ?>"/><span style="width:10px; height: 5px; float:left;"></span>
228
+ <input type="submit"
229
+ name="<?php echo self::OPTIONS; ?>[reset]"
230
+ id="reset"
231
+ class="button-primary"
232
+ value="<?php
233
+ crayon_e('Reset Settings');
234
+ ?>"/>
235
+ </p>
236
+ </form>
237
+ </div>
238
+
239
+ <div id="crayon-theme-editor-wrap" class="wrap"></div>
240
+
241
+ <?php
242
+ }
243
+
244
+ // Load the global settings and update them from the db
245
+ public static function load_settings($just_load_settings = FALSE) {
246
+ if (self::$options === NULL) {
247
+ // Load settings from db
248
+ if (!(self::$options = get_option(self::OPTIONS))) {
249
+ self::$options = CrayonSettings::get_defaults_array();
250
+ update_option(self::OPTIONS, self::$options);
251
+ }
252
+ // Initialise default global settings and update them from db
253
+ CrayonGlobalSettings::set(self::$options);
254
+ }
255
+
256
+ if (!self::$is_fully_loaded && !$just_load_settings) {
257
+ // Load everything else as well
258
+
259
+ // For local file loading
260
+ // This is used to decouple WP functions from internal Crayon classes
261
+ CrayonGlobalSettings::site_url(home_url());
262
+ CrayonGlobalSettings::site_path(ABSPATH);
263
+ CrayonGlobalSettings::plugin_path(plugins_url('', __FILE__));
264
+ $upload = wp_upload_dir();
265
+
266
+ CrayonLog::debug($upload, "WP UPLOAD FUNCTION");
267
+ CrayonGlobalSettings::upload_path(CrayonUtil::path_slash($upload['basedir']) . CRAYON_DIR);
268
+ CrayonGlobalSettings::upload_url($upload['baseurl'] . '/' . CRAYON_DIR);
269
+ CrayonLog::debug(CrayonGlobalSettings::upload_path(), "UPLOAD PATH");
270
+ CrayonGlobalSettings::set_mkdir('wp_mkdir_p');
271
+
272
+ // Load all available languages and themes
273
+ CrayonResources::langs()->load();
274
+ CrayonResources::themes()->load();
275
+
276
+ // Ensure all missing settings in db are replaced by default values
277
+ $changed = FALSE;
278
+ foreach (CrayonSettings::get_defaults_array() as $name => $value) {
279
+ // Add missing settings
280
+ if (!array_key_exists($name, self::$options)) {
281
+ self::$options[$name] = $value;
282
+ $changed = TRUE;
283
+ }
284
+ }
285
+ // A setting was missing, update options
286
+ if ($changed) {
287
+ update_option(self::OPTIONS, self::$options);
288
+ }
289
+
290
+ self::$is_fully_loaded = TRUE;
291
+ }
292
+ }
293
+
294
+ public static function get_settings() {
295
+ return get_option(self::OPTIONS);
296
+ }
297
+
298
+ // Saves settings from CrayonGlobalSettings, or provided array, to the db
299
+ public static function save_settings($settings = NULL) {
300
+ if ($settings === NULL) {
301
+ $settings = CrayonGlobalSettings::get_array();
302
+ }
303
+ update_option(self::OPTIONS, $settings);
304
+ }
305
+
306
+ // Crayon posts
307
+
308
+ /**
309
+ * This loads the posts marked as containing Crayons
310
+ */
311
+ public static function load_posts() {
312
+ if (self::$crayon_posts === NULL) {
313
+ // Load from db
314
+ if (!(self::$crayon_posts = get_option(self::POSTS))) {
315
+ // Posts don't exist! Scan for them. This will fill self::$crayon_posts
316
+ self::$crayon_posts = CrayonWP::scan_posts();
317
+ update_option(self::POSTS, self::$crayon_posts);
318
+ }
319
+ }
320
+ return self::$crayon_posts;
321
+ }
322
+
323
+ /**
324
+ * This looks through all posts and marks those which contain Crayons
325
+ */
326
+ // public static function scan_and_save_posts() {
327
+ // self::save_posts(CrayonWP::scan_posts(TRUE, TRUE));
328
+ // }
329
+
330
+ /**
331
+ * Saves the marked posts to the db
332
+ */
333
+ public static function save_posts($posts = NULL) {
334
+ if ($posts === NULL) {
335
+ $posts = self::$crayon_posts;
336
+ }
337
+ update_option(self::POSTS, $posts);
338
+ self::load_posts();
339
+ }
340
+
341
+ /**
342
+ * Adds a post as containing a Crayon
343
+ */
344
+ public static function add_post($id, $save = TRUE) {
345
+ self::load_posts();
346
+ if (!in_array($id, self::$crayon_posts)) {
347
+ self::$crayon_posts[] = $id;
348
+ }
349
+ if ($save) {
350
+ self::save_posts();
351
+ }
352
+ }
353
+
354
+ /**
355
+ * Removes a post as not containing a Crayon
356
+ */
357
+ public static function remove_post($id, $save = TRUE) {
358
+ self::load_posts();
359
+ $key = array_search($id, self::$crayon_posts);
360
+ if ($key === false) {
361
+ return;
362
+ }
363
+ unset(self::$crayon_posts[$key]);
364
+ if ($save) {
365
+ self::save_posts();
366
+ }
367
+ }
368
+
369
+ public static function remove_posts() {
370
+ self::$crayon_posts = array();
371
+ self::save_posts();
372
+ }
373
+
374
+ // Crayon legacy posts
375
+
376
+ /**
377
+ * This loads the posts marked as containing Crayons
378
+ */
379
+ public static function load_legacy_posts($force = FALSE) {
380
+ if (self::$crayon_legacy_posts === NULL || $force) {
381
+ // Load from db
382
+ if (!(self::$crayon_legacy_posts = get_option(self::LEGACY_POSTS))) {
383
+ // Posts don't exist! Scan for them. This will fill self::$crayon_legacy_posts
384
+ self::$crayon_legacy_posts = CrayonWP::scan_legacy_posts();
385
+ update_option(self::LEGACY_POSTS, self::$crayon_legacy_posts);
386
+ }
387
+ }
388
+ return self::$crayon_legacy_posts;
389
+ }
390
+
391
+ /**
392
+ * This looks through all posts and marks those which contain Crayons
393
+ */
394
+ // public static function scan_and_save_posts() {
395
+ // self::save_posts(CrayonWP::scan_posts(TRUE, TRUE));
396
+ // }
397
+
398
+ /**
399
+ * Saves the marked posts to the db
400
+ */
401
+ public static function save_legacy_posts($posts = NULL) {
402
+ if ($posts === NULL) {
403
+ $posts = self::$crayon_legacy_posts;
404
+ }
405
+ update_option(self::LEGACY_POSTS, $posts);
406
+ self::load_legacy_posts();
407
+ }
408
+
409
+ /**
410
+ * Adds a post as containing a Crayon
411
+ */
412
+ public static function add_legacy_post($id, $save = TRUE) {
413
+ self::load_legacy_posts();
414
+ if (!in_array($id, self::$crayon_legacy_posts)) {
415
+ self::$crayon_legacy_posts[] = $id;
416
+ }
417
+ if ($save) {
418
+ self::save_legacy_posts();
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Removes a post as not containing a Crayon
424
+ */
425
+ public static function remove_legacy_post($id, $save = TRUE) {
426
+ self::load_legacy_posts();
427
+ $key = array_search($id, self::$crayon_legacy_posts);
428
+ if ($key === false) {
429
+ return;
430
+ }
431
+ unset(self::$crayon_legacy_posts[$key]);
432
+ if ($save) {
433
+ self::save_legacy_posts();
434
+ }
435
+ }
436
+
437
+ public static function remove_legacy_posts() {
438
+ self::$crayon_legacy_posts = array();
439
+ self::save_legacy_posts();
440
+ }
441
+
442
+ // Cache
443
+
444
+ public static function add_cache($name) {
445
+ self::load_cache();
446
+ if (!in_array($name, self::$cache)) {
447
+ self::$cache[] = $name;
448
+ }
449
+ self::save_cache();
450
+ }
451
+
452
+ public static function remove_cache($name) {
453
+ self::load_cache();
454
+ $key = array_search($name, self::$cache);
455
+ if ($key === false) {
456
+ return;
457
+ }
458
+ unset(self::$cache[$key]);
459
+ self::save_cache();
460
+ }
461
+
462
+ public static function clear_cache() {
463
+ self::load_cache();
464
+ foreach (self::$cache as $name) {
465
+ delete_transient($name);
466
+ }
467
+ self::$cache = array();
468
+ self::save_cache();
469
+ }
470
+
471
+ public static function load_cache() {
472
+ // Load cache from db
473
+ if (!(self::$cache = get_option(self::CACHE))) {
474
+ self::$cache = array();
475
+ update_option(self::CACHE, self::$cache);
476
+ }
477
+ }
478
+
479
+ public static function save_cache() {
480
+ update_option(self::CACHE, self::$cache);
481
+ self::load_cache();
482
+ }
483
+
484
+ // Paths
485
+
486
+ public static function admin_init() {
487
+ // Load default settings if they don't exist
488
+ self::load_settings();
489
+
490
+ // General
491
+ // Some of these will the $editor arguments, if TRUE it will alter for use in the Tag Editor
492
+ self::add_section(self::GENERAL, crayon__('General'));
493
+ self::add_field(self::GENERAL, crayon__('Theme'), 'theme');
494
+ self::add_field(self::GENERAL, crayon__('Font'), 'font');
495
+ self::add_field(self::GENERAL, crayon__('Metrics'), 'metrics');
496
+ self::add_field(self::GENERAL, crayon__('Toolbar'), 'toolbar');
497
+ self::add_field(self::GENERAL, crayon__('Lines'), 'lines');
498
+ self::add_field(self::GENERAL, crayon__('Code'), 'code');
499
+ self::add_field(self::GENERAL, crayon__('Tags'), 'tags');
500
+ self::add_field(self::GENERAL, crayon__('Languages'), 'langs');
501
+ self::add_field(self::GENERAL, crayon__('Files'), 'files');
502
+ self::add_field(self::GENERAL, crayon__('Posts'), 'posts');
503
+ self::add_field(self::GENERAL, crayon__('Tag Editor'), 'tag_editor');
504
+ self::add_field(self::GENERAL, crayon__('Misc'), 'misc');
505
+
506
+ // Debug
507
+ self::add_section(self::DEBUG, crayon__('Debug'));
508
+ self::add_field(self::DEBUG, crayon__('Errors'), 'errors');
509
+ self::add_field(self::DEBUG, crayon__('Log'), 'log');
510
+ // ABOUT
511
+
512
+ self::add_section(self::ABOUT, crayon__('About'));
513
+ $image = '<div id="crayon-logo">
514
+
515
+ <img src="' . plugins_url(CRAYON_LOGO, __FILE__) . '" /><br/></div>';
516
+ self::add_field(self::ABOUT, $image, 'info');
517
+ }
518
+
519
+ // Wrapper functions
520
+
521
+ private static function add_section($name, $title, $callback = NULL) {
522
+ $callback = (empty($callback) ? 'blank' : $callback);
523
+ add_settings_section($name, $title, 'CrayonSettingsWP::' . $callback, self::SETTINGS);
524
+ }
525
+
526
+ private static function add_field($section, $title, $callback, $args = array()) {
527
+ $unique = preg_replace('#\\s#', '_', strtolower($title));
528
+ add_settings_field($unique, $title, 'CrayonSettingsWP::' . $callback, self::SETTINGS, $section, $args);
529
+ }
530
+
531
+ // Validates all the settings passed from the form in $inputs
532
+
533
+ public static function settings_validate($inputs) {
534
+
535
+ // Load current settings from db
536
+ self::load_settings(TRUE);
537
+
538
+ global $CRAYON_EMAIL;
539
+ // When reset button is pressed, remove settings so default loads next time
540
+ if (array_key_exists('reset', $inputs)) {
541
+ self::clear_cache();
542
+ return array();
543
+ }
544
+ // Convert old tags
545
+ if (array_key_exists('convert', $inputs)) {
546
+ $encode = array_key_exists('convert_encode', $inputs);
547
+ CrayonWP::convert_tags($encode);
548
+ }
549
+ // Refresh internal tag management
550
+ if (array_key_exists('refresh_tags', $inputs)) {
551
+ CrayonWP::refresh_posts();
552
+ }
553
+ // Clear the log if needed
554
+ if (array_key_exists(self::LOG_CLEAR, $_POST)) {
555
+ CrayonLog::clear();
556
+ }
557
+ // Send to admin
558
+ if (array_key_exists(self::LOG_EMAIL_ADMIN, $_POST)) {
559
+ CrayonLog::email(get_bloginfo('admin_email'));
560
+ }
561
+ // Send to developer
562
+ if (array_key_exists(self::LOG_EMAIL_DEV, $_POST)) {
563
+ CrayonLog::email($CRAYON_EMAIL, get_bloginfo('admin_email'));
564
+ }
565
+
566
+ // Clear the cache
567
+ if (array_key_exists(self::CACHE_CLEAR, $_POST)) {
568
+ self::clear_cache();
569
+ }
570
+
571
+ // If settings don't exist in input, set them to default
572
+ $global_settings = CrayonSettings::get_defaults();
573
+
574
+ $ignored = array(CrayonSettings::HIDE_HELP);
575
+
576
+ foreach ($global_settings as $setting) {
577
+ // XXX Ignore some settings
578
+ if (in_array($setting->name(), $ignored)) {
579
+ $inputs[$setting->name()] = CrayonGlobalSettings::val($setting->name());
580
+ continue;
581
+ }
582
+
583
+ // If boolean setting is not in input, then it is set to FALSE in the form
584
+ if (!array_key_exists($setting->name(), $inputs)) {
585
+ // For booleans, set to FALSE (unchecked boxes are not sent as POST)
586
+ if (is_bool($setting->def())) {
587
+ $inputs[$setting->name()] = FALSE;
588
+ } else {
589
+ /* For array settings, set the input as the value, which by default is the
590
+ default index */
591
+ if (is_array($setting->def())) {
592
+ $inputs[$setting->name()] = $setting->value();
593
+ } else {
594
+ $inputs[$setting->name()] = $setting->def();
595
+ }
596
+ }
597
+ }
598
+ }
599
+
600
+ $refresh = array(
601
+ // These should trigger a refresh of which posts contain crayons, since they affect capturing
602
+ CrayonSettings::INLINE_TAG => TRUE,
603
+ CrayonSettings::INLINE_TAG_CAPTURE => TRUE,
604
+ CrayonSettings::CODE_TAG_CAPTURE => TRUE,
605
+ CrayonSettings::BACKQUOTE => TRUE,
606
+ CrayonSettings::CAPTURE_PRE => TRUE,
607
+ CrayonSettings::CAPTURE_MINI_TAG => TRUE,
608
+ CrayonSettings::PLAIN_TAG => TRUE
609
+ );
610
+
611
+ // Validate inputs
612
+ foreach ($inputs as $input => $value) {
613
+ // Convert all array setting values to ints
614
+ $inputs[$input] = $value = CrayonSettings::validate($input, $value);
615
+ // Clear cache when changed
616
+ if (CrayonGlobalSettings::has_changed($input, CrayonSettings::CACHE, $value)) {
617
+ self::clear_cache();
618
+ }
619
+ if (isset($refresh[$input])) {
620
+ if (CrayonGlobalSettings::has_changed($input, $input, $value)) {
621
+ // Needs to take place, in case it refresh depends on changed value
622
+ CrayonGlobalSettings::set($input, $value);
623
+ CrayonWP::refresh_posts();
624
+ }
625
+ }
626
+ }
627
+
628
+ return $inputs;
629
+ }
630
+
631
+ // Section callback functions
632
+
633
+ public static function blank() {
634
+ } // Used for required callbacks with blank content
635
+
636
+ // Input Drawing ==========================================================
637
+
638
+ private static function input($args) {
639
+ $id = '';
640
+ $size = 40;
641
+ $margin = FALSE;
642
+ $preview = 1;
643
+ $break = FALSE;
644
+ $type = 'text';
645
+ extract($args);
646
+
647
+ echo '<input id="', CrayonSettings::PREFIX, $id, '" name="', self::OPTIONS, '[', $id, ']" class="' . CrayonSettings::SETTING . '" size="', $size, '" type="', $type,'" value="',
648
+ self::$options[$id], '" style="margin-left: ', ($margin ? '20px' : '0px'), ';" crayon-preview="', ($preview ? 1 : 0), '" />', ($break ? CRAYON_BR : '');
649
+ }
650
+
651
+ private static function checkbox($args, $line_break = TRUE, $preview = TRUE) {
652
+ if (empty($args) || !is_array($args) || count($args) != 2) {
653
+ return;
654
+ }
655
+ $id = $args[0];
656
+ $text = $args[1];
657
+ $checked = (!array_key_exists($id, self::$options)) ? FALSE : self::$options[$id] == TRUE;
658
+ $checked_str = $checked ? ' checked="checked"' : '';
659
+ echo '<input id="', CrayonSettings::PREFIX, $id, '" name="', self::OPTIONS, '[', $id, ']" type="checkbox" class="' . CrayonSettings::SETTING . '" value="1"', $checked_str,
660
+ ' crayon-preview="', ($preview ? 1 : 0), '" /> ', '<label for="', CrayonSettings::PREFIX, $id, '">', $text, '</label>', ($line_break ? CRAYON_BR : '');
661
+ }
662
+
663
+ // Draws a dropdown by loading the default value (an array) from a setting
664
+ private static function dropdown($id, $line_break = TRUE, $preview = TRUE, $echo = TRUE, $resources = NULL, $selected = NULL) {
665
+ if (!array_key_exists($id, self::$options)) {
666
+ return;
667
+ }
668
+ $resources = $resources != NULL ? $resources : CrayonGlobalSettings::get($id)->def();
669
+
670
+ $return = '<select id="' . CrayonSettings::PREFIX . $id . '" name="' . self::OPTIONS . '[' . $id . ']" class="' . CrayonSettings::SETTING . '" crayon-preview="' . ($preview ? 1 : 0) . '">';
671
+ foreach ($resources as $k => $v) {
672
+ if (is_array($v) && count($v)) {
673
+ $data = $v[0];
674
+ $text = $v[1];
675
+ } else {
676
+ $text = $v;
677
+ }
678
+ $is_selected = $selected !== NULL && $selected == $k ? 'selected' : selected(self::$options[$id], $k, FALSE);
679
+ $return .= '<option ' . (isset($data) ? 'data-value="' . $data . '"' : '') . ' value="' . $k . '" ' . $is_selected . '>' . $text . '</option>';
680
+ }
681
+ $return .= '</select>' . ($line_break ? CRAYON_BR : '');
682
+ if ($echo) {
683
+ echo $return;
684
+ } else {
685
+ return $return;
686
+ }
687
+ }
688
+
689
+ private static function button($args = array()) {
690
+ extract($args);
691
+ CrayonUtil::set_var($id, '');
692
+ CrayonUtil::set_var($class, '');
693
+ CrayonUtil::set_var($onclick, '');
694
+ CrayonUtil::set_var($title, '');
695
+ return '<a id="' . $id . '" class="button-primary ' . $class . '" onclick="' . $onclick . '">' . $title . '</a>';
696
+ }
697
+
698
+ private static function info_span($name, $text) {
699
+ echo '<span id="', $name, '-info">', $text, '</span>';
700
+ }
701
+
702
+ private static function span($text) {
703
+ echo '<span>', $text, '</span>';
704
+ }
705
+
706
+ // General Fields =========================================================
707
+ public static function help() {
708
+ global $CRAYON_WEBSITE, $CRAYON_TWITTER, $CRAYON_GIT, $CRAYON_PLUGIN_WP, $CRAYON_DONATE;
709
+ if (CrayonGlobalSettings::val(CrayonSettings::HIDE_HELP)) {
710
+ return;
711
+ }
712
+ echo '<div id="crayon-help" class="updated settings-error crayon-help">
713
+ <p><strong>Howdy, coder!</strong> Thanks for using Crayon. <strong>Useful Links:</strong> <a href="' . $CRAYON_WEBSITE . '" target="_blank">Documentation</a>, <a href="' . $CRAYON_GIT . '" target="_blank">GitHub</a>, <a href="' . $CRAYON_PLUGIN_WP . '" target="_blank">Plugin Page</a>, <a href="' . $CRAYON_TWITTER . '" target="_blank">Twitter</a>. Crayon has always been free. If you value my work please consider a <a href="' . $CRAYON_DONATE . '">small donation</a> to show your appreciation. Thanks! <a class="crayon-help-close">X</a></p></div>
714
+ ';
715
+ }
716
+
717
+ public static function help_screen() {
718
+ $screen = get_current_screen();
719
+
720
+ if ($screen->id != self::$admin_page) {
721
+ return;
722
+ }
723
+ }
724
+
725
+ public static function metrics() {
726
+ echo '<div id="crayon-section-metrics" class="crayon-hide-inline">';
727
+ self::checkbox(array(CrayonSettings::HEIGHT_SET, '<span class="crayon-span-50">' . crayon__('Height') . ' </span>'), FALSE);
728
+ self::dropdown(CrayonSettings::HEIGHT_MODE, FALSE);
729
+ echo ' ';
730
+ self::input(array('id' => CrayonSettings::HEIGHT, 'size' => 8));
731
+ echo ' ';
732
+ self::dropdown(CrayonSettings::HEIGHT_UNIT);
733
+ self::checkbox(array(CrayonSettings::WIDTH_SET, '<span class="crayon-span-50">' . crayon__('Width') . ' </span>'), FALSE);
734
+ self::dropdown(CrayonSettings::WIDTH_MODE, FALSE);
735
+ echo ' ';
736
+ self::input(array('id' => CrayonSettings::WIDTH, 'size' => 8));
737
+ echo ' ';
738
+ self::dropdown(CrayonSettings::WIDTH_UNIT);
739
+ $text = array(crayon__('Top Margin') => array(CrayonSettings::TOP_SET, CrayonSettings::TOP_MARGIN),
740
+ crayon__('Bottom Margin') => array(CrayonSettings::BOTTOM_SET, CrayonSettings::BOTTOM_MARGIN),
741
+ crayon__('Left Margin') => array(CrayonSettings::LEFT_SET, CrayonSettings::LEFT_MARGIN),
742
+ crayon__('Right Margin') => array(CrayonSettings::RIGHT_SET, CrayonSettings::RIGHT_MARGIN));
743
+ foreach ($text as $p => $s) {
744
+ $set = $s[0];
745
+ $margin = $s[1];
746
+ $preview = ($p == crayon__('Left Margin') || $p == crayon__('Right Margin'));
747
+ self::checkbox(array($set, '<span class="crayon-span-110">' . $p . '</span>'), FALSE, $preview);
748
+ echo ' ';
749
+ self::input(array('id' => $margin, 'size' => 8, 'preview' => FALSE));
750
+ echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span>', CRAYON_BR;
751
+ }
752
+ echo '<span class="crayon-span" style="min-width: 135px;">' . crayon__('Horizontal Alignment') . ' </span>';
753
+ self::dropdown(CrayonSettings::H_ALIGN);
754
+ echo '<div id="crayon-subsection-float">';
755
+ self::checkbox(array(CrayonSettings::FLOAT_ENABLE, crayon__('Allow floating elements to surround Crayon')), FALSE, FALSE);
756
+ echo '</div>';
757
+ echo '<span class="crayon-span-100">' . crayon__('Inline Margin') . ' </span>';
758
+ self::input(array('id' => CrayonSettings::INLINE_MARGIN, 'size' => 2));
759
+ echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span>';
760
+ echo '</div>';
761
+ }
762
+
763
+ public static function toolbar() {
764
+ echo '<div id="crayon-section-toolbar" class="crayon-hide-inline">';
765
+ self::span(crayon__('Display the Toolbar') . ' ');
766
+ self::dropdown(CrayonSettings::TOOLBAR);
767
+ echo '<div id="crayon-subsection-toolbar">';
768
+ self::checkbox(array(CrayonSettings::TOOLBAR_OVERLAY, crayon__('Overlay the toolbar on code rather than push it down when possible')));
769
+ self::checkbox(array(CrayonSettings::TOOLBAR_HIDE, crayon__('Toggle the toolbar on single click when it is overlayed')));
770
+ self::checkbox(array(CrayonSettings::TOOLBAR_DELAY, crayon__('Delay hiding the toolbar on MouseOut')));
771
+ echo '</div>';
772
+ self::checkbox(array(CrayonSettings::SHOW_TITLE, crayon__('Display the title when provided')));
773
+ self::span(crayon__('Display the language') . ' ');
774
+ self::dropdown(CrayonSettings::SHOW_LANG);
775
+ echo '</div>';
776
+ }
777
+
778
+ public static function lines() {
779
+ echo '<div id="crayon-section-lines" class="crayon-hide-inline">';
780
+ self::checkbox(array(CrayonSettings::STRIPED, crayon__('Display striped code lines')));
781
+ self::checkbox(array(CrayonSettings::MARKING, crayon__('Enable line marking for important lines')));
782
+ self::checkbox(array(CrayonSettings::RANGES, crayon__('Enable line ranges for showing only parts of code')));
783
+ self::checkbox(array(CrayonSettings::NUMS, crayon__('Display line numbers by default')));
784
+ self::checkbox(array(CrayonSettings::NUMS_TOGGLE, crayon__('Enable line number toggling')));
785
+ self::checkbox(array(CrayonSettings::WRAP, crayon__('Wrap lines by default')));
786
+ self::checkbox(array(CrayonSettings::WRAP_TOGGLE, crayon__('Enable line wrap toggling')));
787
+ self::span(crayon__('Start line numbers from') . ' ');
788
+ self::input(array('id' => CrayonSettings::START_LINE, 'size' => 2, 'break' => TRUE));
789
+ echo '</div>';
790
+ }
791
+
792
+ public static function langs() {
793
+ echo '<a name="langs"></a>';
794
+ // Specialised dropdown for languages
795
+ if (array_key_exists(CrayonSettings::FALLBACK_LANG, self::$options)) {
796
+ if (($langs = CrayonParser::parse_all()) != FALSE) {
797
+ $langs = CrayonLangs::sort_by_name($langs);
798
+ self::span(crayon__('When no language is provided, use the fallback') . ': ');
799
+ self::dropdown(CrayonSettings::FALLBACK_LANG, FALSE, TRUE, TRUE, $langs);
800
+ // Information about parsing
801
+ $parsed = CrayonResources::langs()->is_parsed();
802
+ $count = count($langs);
803
+ echo '</select>', CRAYON_BR, ($parsed ? '' : '<span class="crayon-error">'),
804
+ sprintf(crayon_n('%d language has been detected.', '%d languages have been detected.', $count), $count), ' ',
805
+ $parsed ? crayon__('Parsing was successful') : crayon__('Parsing was unsuccessful'),
806
+ ($parsed ? '. ' : '</span>');
807
+ // Check if fallback from db is loaded
808
+ $db_fallback = self::$options[CrayonSettings::FALLBACK_LANG]; // Fallback name from db
809
+
810
+ if (!CrayonResources::langs()->is_loaded($db_fallback) || !CrayonResources::langs()->exists($db_fallback)) {
811
+ echo '<br/><span class="crayon-error">', sprintf(crayon__('The selected language with id %s could not be loaded'), '<strong>' . $db_fallback . '</strong>'), '. </span>';
812
+ }
813
+ // Language parsing info
814
+ echo CRAYON_BR, '<div id="crayon-subsection-langs-info"><div>' . self::button(array('id' => 'show-langs', 'title' => crayon__('Show Languages'))) . '</div></div>';
815
+ } else {
816
+ echo crayon__('No languages could be parsed.');
817
+ }
818
+ }
819
+ }
820
+
821
+ public static function show_langs() {
822
+ CrayonSettingsWP::load_settings();
823
+ require_once(CRAYON_PARSER_PHP);
824
+ if (($langs = CrayonParser::parse_all()) != FALSE) {
825
+ $langs = CrayonLangs::sort_by_name($langs);
826
+ echo '<table class="crayon-table" cellspacing="0" cellpadding="0"><tr class="crayon-table-header">',
827
+ '<td>',crayon__('ID'),'</td><td>',crayon__('Name'),'</td><td>',crayon__('Version'),'</td><td>',crayon__('File Extensions'),'</td><td>',crayon__('Aliases'),'</td><td>',crayon__('State'),'</td></tr>';
828
+ $keys = array_values($langs);
829
+ for ($i = 0; $i < count($langs); $i++) {
830
+ $lang = $keys[$i];
831
+ $tr = ($i == count($langs) - 1) ? 'crayon-table-last' : '';
832
+ echo '<tr class="', $tr, '">',
833
+ '<td>', $lang->id(), '</td>',
834
+ '<td>', $lang->name(), '</td>',
835
+ '<td>', $lang->version(), '</td>',
836
+ '<td>', implode(', ', $lang->ext()), '</td>',
837
+ '<td>', implode(', ', $lang->alias()), '</td>',
838
+ '<td class="', strtolower(CrayonUtil::space_to_hyphen($lang->state_info())), '">',
839
+ $lang->state_info(), '</td>',
840
+ '</tr>';
841
+ }
842
+ echo '</table><br/>' . crayon__("Languages that have the same extension as their name don't need to explicitly map extensions.");
843
+ } else {
844
+ echo crayon__('No languages could be found.');
845
+ }
846
+ exit();
847
+ }
848
+
849
+ public static function posts() {
850
+ echo '<a name="posts"></a>';
851
+ echo self::button(array('id' => 'show-posts', 'title' => crayon__('Show Crayon Posts')));
852
+ echo ' <input type="submit" name="', self::OPTIONS, '[refresh_tags]" id="refresh_tags" class="button-primary" value="', crayon__('Refresh'), '" />';
853
+ echo self::help_button('http://aramk.com/blog/2012/09/26/internal-post-management-crayon/');
854
+ echo '<div id="crayon-subsection-posts-info"></div>';
855
+ }
856
+
857
+ public static function post_cmp($a, $b) {
858
+ $a = $a->post_modified;
859
+ $b = $b->post_modified;
860
+ if ($a == $b) {
861
+ return 0;
862
+ } else {
863
+ return $a < $b ? 1 : -1;
864
+ }
865
+ }
866
+
867
+ public static function show_posts() {
868
+ CrayonSettingsWP::load_settings();
869
+ $postIDs = self::load_posts();
870
+ $legacy_posts = self::load_legacy_posts();
871
+ // Avoids O(n^2) by using a hash map, tradeoff in using strval
872
+ $legacy_map = array();
873
+ foreach ($legacy_posts as $legacyID) {
874
+ $legacy_map[strval($legacyID)] = TRUE;
875
+ }
876
+
877
+ echo '<table class="crayon-table" cellspacing="0" cellpadding="0"><tr class="crayon-table-header">',
878
+ '<td>', crayon__('ID'), '</td><td>', crayon__('Title'), '</td><td>', crayon__('Posted'), '</td><td>', crayon__('Modifed'), '</td><td>', crayon__('Contains Legacy Tags?'), '</td></tr>';
879
+
880
+ $posts = array();
881
+ for ($i = 0; $i < count($postIDs); $i++) {
882
+ $posts[$i] = get_post($postIDs[$i]);
883
+ }
884
+
885
+ usort($posts, 'CrayonSettingsWP::post_cmp');
886
+
887
+ for ($i = 0; $i < count($posts); $i++) {
888
+ $post = $posts[$i];
889
+ $postID = $post->ID;
890
+ $title = $post->post_title;
891
+ $title = !empty($title) ? $title : 'N/A';
892
+ $tr = ($i == count($posts) - 1) ? 'crayon-table-last' : '';
893
+ echo '<tr class="', $tr, '">',
894
+ '<td>', $postID, '</td>',
895
+ '<td><a href="', $post->guid, '" target="_blank">', $title, '</a></td>',
896
+ '<td>', $post->post_date, '</td>',
897
+ '<td>', $post->post_modified, '</td>',
898
+ '<td>', isset($legacy_map[strval($postID)]) ? '<span style="color: red;">' . crayon__('Yes') . '</a>' : crayon__('No'), '</td>',
899
+ '</tr>';
900
+ }
901
+
902
+ echo '</table>';
903
+ exit();
904
+ }
905
+
906
+ public static function show_preview() {
907
+ echo '<div id="content">';
908
+
909
+ self::load_settings(); // Run first to ensure global settings loaded
910
+
911
+ $crayon = CrayonWP::instance();
912
+
913
+ // Settings to prevent from validating
914
+ $preview_settings = array(self::SAMPLE_CODE);
915
+
916
+ // Load settings from GET and validate
917
+ foreach ($_POST as $key => $value) {
918
+ // echo $key, ' ', $value , '<br/>';
919
+ $value = stripslashes($value);
920
+ if (!in_array($key, $preview_settings)) {
921
+ $_POST[$key] = CrayonSettings::validate($key, $value);
922
+ } else {
923
+ $_POST[$key] = $value;
924
+ }
925
+ }
926
+ $crayon->settings($_POST);
927
+ if (!isset($crayon_preview_dont_override_get) || !$crayon_preview_dont_override_get) {
928
+ $settings = array(CrayonSettings::TOP_SET => TRUE, CrayonSettings::TOP_MARGIN => 10,
929
+ CrayonSettings::BOTTOM_SET => FALSE, CrayonSettings::BOTTOM_MARGIN => 0);
930
+ $crayon->settings($settings);
931
+ }
932
+
933
+ // Print the theme CSS
934
+ $theme_id = $crayon->setting_val(CrayonSettings::THEME);
935
+ if ($theme_id != NULL) {
936
+ echo CrayonResources::themes()->get_css($theme_id, date('U'));
937
+ }
938
+
939
+ $font_id = $crayon->setting_val(CrayonSettings::FONT);
940
+ if ($font_id != NULL /*&& $font_id != CrayonFonts::DEFAULT_FONT*/) {
941
+ echo CrayonResources::fonts()->get_css($font_id);
942
+ }
943
+
944
+ // Load custom code based on language
945
+ $lang = $crayon->setting_val(CrayonSettings::FALLBACK_LANG);
946
+ $path = crayon_pf(CRAYON_UTIL_PATH . '/sample/' . $lang . '.txt', FALSE);
947
+
948
+ if (isset($_POST[self::SAMPLE_CODE])) {
949
+ $crayon->code($_POST[self::SAMPLE_CODE]);
950
+ } else if ($lang && @file_exists($path)) {
951
+ $crayon->url($path);
952
+ } else {
953
+ $code = "
954
+ // A sample class
955
+ class Human {
956
+ private int age = 0;
957
+ public void birthday() {
958
+ age++;
959
+ print('Happy Birthday!');
960
+ }
961
+ }
962
+ ";
963
+ $crayon->code($code);
964
+ }
965
+ $crayon->title('Sample Code');
966
+ $crayon->marked('5-7');
967
+ $crayon->output($highlight = true, $nums = true, $print = true);
968
+ echo '</div>';
969
+ crayon_load_plugin_textdomain();
970
+ exit();
971
+ }
972
+
973
+ public static function theme($editor = FALSE) {
974
+ $db_theme = self::$options[CrayonSettings::THEME]; // Theme name from db
975
+ if (!array_key_exists(CrayonSettings::THEME, self::$options)) {
976
+ $db_theme = '';
977
+ }
978
+ $themes_array = CrayonResources::themes()->get_array();
979
+ // Mark user themes
980
+ foreach ($themes_array as $id => $name) {
981
+ $mark = CrayonResources::themes()->get($id)->user() ? ' *' : '';
982
+ $themes_array[$id] = array($name, $name . $mark);
983
+ }
984
+ $missing_theme = !CrayonResources::themes()->is_loaded($db_theme) || !CrayonResources::themes()->exists($db_theme);
985
+ self::dropdown(CrayonSettings::THEME, FALSE, FALSE, TRUE, $themes_array, $missing_theme ? CrayonThemes::DEFAULT_THEME : NULL);
986
+ if ($editor) {
987
+ return;
988
+ }
989
+ // Theme editor
990
+ if (CRAYON_THEME_EDITOR) {
991
+ // echo '<a id="crayon-theme-editor-button" class="button-primary crayon-admin-button" loading="'. crayon__('Loading...') .'" loaded="'. crayon__('Theme Editor') .'" >'. crayon__('Theme Editor') .'</a></br>';
992
+ echo '<div id="crayon-theme-editor-admin-buttons">';
993
+ $buttons = array('edit' => crayon__('Edit'), 'duplicate' => crayon__('Duplicate'), 'submit' => crayon__('Submit'),
994
+ 'delete' => crayon__('Delete'));
995
+ foreach ($buttons as $k => $v) {
996
+ echo '<a id="crayon-theme-editor-', $k, '-button" class="button-secondary crayon-admin-button" loading="', crayon__('Loading...'), '" loaded="', $v, '" >', $v, '</a>';
997
+ }
998
+ echo '<span class="crayon-span-5"></span>', self::help_button('http://aramk.com/blog/2012/12/27/crayon-theme-editor/'), '<span class="crayon-span-5"></span>', crayon__("Duplicate a Stock Theme into a User Theme to allow editing.");
999
+ echo '</br></div>';
1000
+ }
1001
+ // Preview Box
1002
+ ?>
1003
+ <div id="crayon-theme-panel">
1004
+ <div id="crayon-theme-info"></div>
1005
+ <div id="crayon-live-preview-wrapper">
1006
+ <div id="crayon-live-preview-inner">
1007
+ <div id="crayon-live-preview"></div>
1008
+ <div id="crayon-preview-info">
1009
+ <?php printf(crayon__('Change the %1$sfallback language%2$s to change the sample code or %3$schange it manually%4$s. Lines 5-7 are marked.'), '<a href="#langs">', '</a>', '<a id="crayon-change-code" href="#">', '</a>'); ?>
1010
+ </div>
1011
+ </div>
1012
+ </div>
1013
+ </div>
1014
+ <?php
1015
+ // Preview checkbox
1016
+ self::checkbox(array(CrayonSettings::PREVIEW, crayon__('Enable Live Preview')), FALSE, FALSE);
1017
+ echo '</select><span class="crayon-span-10"></span>';
1018
+ self::checkbox(array(CrayonSettings::ENQUEUE_THEMES, crayon__('Enqueue themes in the header (more efficient).') . self::help_button('http://aramk.com/blog/2012/01/07/enqueuing-themes-and-fonts-in-crayon/')));
1019
+ // Check if theme from db is loaded
1020
+ if ($missing_theme) {
1021
+ echo '<span class="crayon-error">', sprintf(crayon__('The selected theme with id %s could not be loaded'), '<strong>' . $db_theme . '</strong>'), '. </span>';
1022
+ }
1023
+ }
1024
+
1025
+ public static function font($editor = FALSE) {
1026
+ $db_font = self::$options[CrayonSettings::FONT]; // Theme name from db
1027
+ if (!array_key_exists(CrayonSettings::FONT, self::$options)) {
1028
+ $db_font = '';
1029
+ }
1030
+ $fonts_array = CrayonResources::fonts()->get_array();
1031
+ self::dropdown(CrayonSettings::FONT, FALSE, TRUE, TRUE, $fonts_array);
1032
+ echo '<span class="crayon-span-5"></span>';
1033
+ // TODO(aramk) Add this blog article back.
1034
+ // echo '<a href="http://bit.ly/Yr2Xv6" target="_blank">', crayon__('Add More'), '</a>';
1035
+ echo '<span class="crayon-span-10"></span>';
1036
+ self::checkbox(array(CrayonSettings::FONT_SIZE_ENABLE, crayon__('Custom Font Size') . ' '), FALSE);
1037
+ self::input(array('id' => CrayonSettings::FONT_SIZE, 'size' => 2));
1038
+ echo '<span class="crayon-span-margin">', crayon__('Pixels'), ',&nbsp;&nbsp;', crayon__('Line Height'), ' </span>';
1039
+ self::input(array('id' => CrayonSettings::LINE_HEIGHT, 'size' => 2));
1040
+ echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span></br>';
1041
+ if ((!CrayonResources::fonts()->is_loaded($db_font) || !CrayonResources::fonts()->exists($db_font))) {
1042
+ // Default font doesn't actually exist as a file, it means do not override default theme font
1043
+ echo '<span class="crayon-error">', sprintf(crayon__('The selected font with id %s could not be loaded'), '<strong>' . $db_font . '</strong>'), '. </span><br/>';
1044
+ }
1045
+ if ($editor) {
1046
+ return;
1047
+ }
1048
+ echo '<div style="height:10px;"></div>';
1049
+ self::checkbox(array(CrayonSettings::ENQUEUE_FONTS, crayon__('Enqueue fonts in the header (more efficient).') . self::help_button('http://aramk.com/blog/2012/01/07/enqueuing-themes-and-fonts-in-crayon/')));
1050
+ }
1051
+
1052
+ public static function code($editor = FALSE) {
1053
+ echo '<div id="crayon-section-code-interaction" class="crayon-hide-inline-only">';
1054
+ self::checkbox(array(CrayonSettings::PLAIN, crayon__('Enable plain code view and display') . ' '), FALSE);
1055
+ self::dropdown(CrayonSettings::SHOW_PLAIN);
1056
+ echo '<span id="crayon-subsection-copy-check">';
1057
+ self::checkbox(array(CrayonSettings::PLAIN_TOGGLE, crayon__('Enable plain code toggling')));
1058
+ self::checkbox(array(CrayonSettings::SHOW_PLAIN_DEFAULT, crayon__('Show the plain code by default')));
1059
+ self::checkbox(array(CrayonSettings::COPY, crayon__('Enable code copy/paste')));
1060
+ echo '</span>';
1061
+ self::checkbox(array(CrayonSettings::POPUP, crayon__('Enable opening code in a window')));
1062
+ self::checkbox(array(CrayonSettings::SCROLL, crayon__('Always display scrollbars')));
1063
+ self::checkbox(array(CrayonSettings::MINIMIZE, crayon__('Minimize code') . self::help_button('http://aramk.com/blog/2013/01/15/minimizing-code-in-crayon/')));
1064
+ self::checkbox(array(CrayonSettings::EXPAND, crayon__('Expand code beyond page borders on mouseover')));
1065
+ self::checkbox(array(CrayonSettings::EXPAND_TOGGLE, crayon__('Enable code expanding toggling when possible')));
1066
+ echo '</div>';
1067
+ if (!$editor) {
1068
+ self::checkbox(array(CrayonSettings::DECODE, crayon__('Decode HTML entities in code')));
1069
+ }
1070
+ self::checkbox(array(CrayonSettings::DECODE_ATTRIBUTES, crayon__('Decode HTML entities in attributes')));
1071
+ echo '<div class="crayon-hide-inline-only">';
1072
+ self::checkbox(array(CrayonSettings::TRIM_WHITESPACE, crayon__('Remove whitespace surrounding the shortcode content')));
1073
+ echo '</div>';
1074
+ self::checkbox(array(CrayonSettings::TRIM_CODE_TAG, crayon__('Remove &lt;code&gt; tags surrounding the shortcode content')));
1075
+ self::checkbox(array(CrayonSettings::MIXED, crayon__('Allow Mixed Language Highlighting with delimiters and tags.') . self::help_button('http://aramk.com/blog/2011/12/25/mixed-language-highlighting-in-crayon/')));
1076
+ echo '<div class="crayon-hide-inline-only">';
1077
+ self::checkbox(array(CrayonSettings::SHOW_MIXED, crayon__('Show Mixed Language Icon (+)')));
1078
+ echo '</div>';
1079
+ self::checkbox(array(CrayonSettings::TAB_CONVERT, crayon__('Convert tabs to spaces')));
1080
+ self::span(crayon__('Tab size in spaces') . ': ');
1081
+ self::input(array('id' => CrayonSettings::TAB_SIZE, 'size' => 2, 'break' => TRUE));
1082
+ self::span(crayon__('Blank lines before code:') . ' ');
1083
+ self::input(array('id' => CrayonSettings::WHITESPACE_BEFORE, 'size' => 2, 'break' => TRUE));
1084
+ self::span(crayon__('Blank lines after code:') . ' ');
1085
+ self::input(array('id' => CrayonSettings::WHITESPACE_AFTER, 'size' => 2, 'break' => TRUE));
1086
+ }
1087
+
1088
+ public static function tags() {
1089
+ self::checkbox(array(CrayonSettings::INLINE_TAG, crayon__('Capture Inline Tags') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1090
+ self::checkbox(array(CrayonSettings::INLINE_WRAP, crayon__('Wrap Inline Tags') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1091
+ self::checkbox(array(CrayonSettings::CODE_TAG_CAPTURE, crayon__('Capture &lt;code&gt; as')), FALSE);
1092
+ echo ' ';
1093
+ self::dropdown(CrayonSettings::CODE_TAG_CAPTURE_TYPE, FALSE);
1094
+ echo self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/') . '<br/>';
1095
+ self::checkbox(array(CrayonSettings::BACKQUOTE, crayon__('Capture `backquotes` as &lt;code&gt;') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1096
+ self::checkbox(array(CrayonSettings::CAPTURE_PRE, crayon__('Capture &lt;pre&gt; tags as Crayons') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1097
+
1098
+ echo '<div class="note" style="width: 350px;">', sprintf(crayon__("Using this markup for Mini Tags and Inline tags is now %sdepreciated%s! Use the %sTag Editor%s instead and convert legacy tags."), '<a href="http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/" target="_blank">', '</a>', '<a href="http://aramk.com/blog/2012/03/25/crayon-tag-editor/‎" target="_blank">', '</a>'), '</div>';
1099
+ self::checkbox(array(CrayonSettings::CAPTURE_MINI_TAG, crayon__('Capture Mini Tags like [php][/php] as Crayons.') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1100
+ self::checkbox(array(CrayonSettings::INLINE_TAG_CAPTURE, crayon__('Capture Inline Tags like {php}{/php} inside sentences.') . self::help_button('http://aramk.com/blog/2012/03/07/inline-crayons/')));
1101
+ self::checkbox(array(CrayonSettings::PLAIN_TAG, crayon__('Enable [plain][/plain] tag.') . self::help_button('http://aramk.com/blog/2011/12/27/mini-tags-in-crayon/')));
1102
+ }
1103
+
1104
+ public static function files() {
1105
+ echo '<a name="files"></a>';
1106
+ echo crayon__('When loading local files and a relative path is given for the URL, use the absolute path'), ': ',
1107
+ '<div style="margin-left: 20px">', home_url(), '/';
1108
+ self::input(array('id' => CrayonSettings::LOCAL_PATH));
1109
+ echo '</div>', crayon__('Followed by your relative URL.');
1110
+ }
1111
+
1112
+ public static function tag_editor() {
1113
+ $can_convert = self::load_legacy_posts();
1114
+ if ($can_convert) {
1115
+ $disabled = '';
1116
+ $convert_text = crayon__('Convert Legacy Tags');
1117
+ } else {
1118
+ $disabled = 'disabled="disabled"';
1119
+ $convert_text = crayon__('No Legacy Tags Found');
1120
+ }
1121
+
1122
+ echo '<input type="submit" name="', self::OPTIONS, '[convert]" id="convert" class="button-primary" value="', $convert_text, '"', $disabled, ' />&nbsp; ';
1123
+ self::checkbox(array('convert_encode', crayon__("Encode")), FALSE);
1124
+ echo self::help_button('http://aramk.com/blog/2012/09/26/converting-legacy-tags-to-pre/'), CRAYON_BR, CRAYON_BR;
1125
+ $sep = sprintf(crayon__('Use %s to separate setting names from values in the &lt;pre&gt; class attribute'),
1126
+ self::dropdown(CrayonSettings::ATTR_SEP, FALSE, FALSE, FALSE));
1127
+ echo '<span>', $sep, self::help_button('http://aramk.com/blog/2012/03/25/crayon-tag-editor/'), '</span><br/>';
1128
+ self::checkbox(array(CrayonSettings::TAG_EDITOR_FRONT, crayon__("Display the Tag Editor in any TinyMCE instances on the frontend (e.g. bbPress)") . self::help_button('http://aramk.com/blog/2012/09/08/crayon-with-bbpress/')));
1129
+ self::checkbox(array(CrayonSettings::TAG_EDITOR_SETTINGS, crayon__("Display Tag Editor settings on the frontend")));
1130
+ self::span(crayon__('Add Code button text') . ' ');
1131
+ self::input(array('id' => CrayonSettings::TAG_EDITOR_ADD_BUTTON_TEXT, 'break' => TRUE));
1132
+ self::span(crayon__('Edit Code button text') . ' ');
1133
+ self::input(array('id' => CrayonSettings::TAG_EDITOR_EDIT_BUTTON_TEXT, 'break' => TRUE));
1134
+ self::span(crayon__('Quicktag button text') . ' ');
1135
+ self::input(array('id' => CrayonSettings::TAG_EDITOR_QUICKTAG_BUTTON_TEXT, 'break' => TRUE));
1136
+ }
1137
+
1138
+ public static function misc() {
1139
+ echo crayon__('Clear the cache used to store remote code requests'), ': ';
1140
+ self::dropdown(CrayonSettings::CACHE, false);
1141
+ echo '<input type="submit" id="', self::CACHE_CLEAR, '" name="', self::CACHE_CLEAR, '" class="button-secondary" value="', crayon__('Clear Now'), '" /><br/>';
1142
+ self::checkbox(array(CrayonSettings::EFFICIENT_ENQUEUE, crayon__('Attempt to load Crayon\'s CSS and JavaScript only when needed') . self::help_button('http://aramk.com/blog/2012/01/23/failing-to-load-crayons-on-pages/')));
1143
+ self::checkbox(array(CrayonSettings::SAFE_ENQUEUE, crayon__('Disable enqueuing for page templates that may contain The Loop.') . self::help_button('http://aramk.com/blog/2012/01/23/failing-to-load-crayons-on-pages/')));
1144
+ self::checkbox(array(CrayonSettings::COMMENTS, crayon__('Allow Crayons inside comments')));
1145
+ self::checkbox(array(CrayonSettings::EXCERPT_STRIP, crayon__('Remove Crayons from excerpts')));
1146
+ self::checkbox(array(CrayonSettings::MAIN_QUERY, crayon__('Load Crayons only from the main Wordpress query')));
1147
+ self::checkbox(array(CrayonSettings::TOUCHSCREEN, crayon__('Disable mouse gestures for touchscreen devices (eg. MouseOver)')));
1148
+ self::checkbox(array(CrayonSettings::DISABLE_ANIM, crayon__('Disable animations')));
1149
+ self::checkbox(array(CrayonSettings::DISABLE_RUNTIME, crayon__('Disable runtime stats')));
1150
+ echo '<span class="crayon-span-100">' . crayon__('Disable for posts before') . ':</span> ';
1151
+ self::input(array('id' => CrayonSettings::DISABLE_DATE, 'type' => 'date', 'size' => 8, 'break' => FALSE));
1152
+ echo '<br/>';
1153
+ self::checkbox(array(CrayonSettings::DELAY_LOAD_JS, crayon__('Load scripts in the page footer using wp_footer() to improve loading performance.')));
1154
+ }
1155
+
1156
+ // Debug Fields ===========================================================
1157
+
1158
+ public static function errors() {
1159
+ self::checkbox(array(CrayonSettings::ERROR_LOG, crayon__('Log errors for individual Crayons')));
1160
+ self::checkbox(array(CrayonSettings::ERROR_LOG_SYS, crayon__('Log system-wide errors')));
1161
+ self::checkbox(array(CrayonSettings::ERROR_MSG_SHOW, crayon__('Display custom message for errors')));
1162
+ self::input(array('id' => CrayonSettings::ERROR_MSG, 'size' => 60, 'margin' => TRUE));
1163
+ }
1164
+
1165
+ public static function log() {
1166
+ $log = CrayonLog::log();
1167
+ touch(CRAYON_LOG_FILE);
1168
+ $exists = file_exists(CRAYON_LOG_FILE);
1169
+ $writable = is_writable(CRAYON_LOG_FILE);
1170
+ if (!empty($log)) {
1171
+ echo '<div id="crayon-log-wrapper">', '<div id="crayon-log"><div id="crayon-log-text">', $log,
1172
+ '</div></div>', '<div id="crayon-log-controls">',
1173
+ '<input type="button" id="crayon-log-toggle" show_txt="', crayon__('Show Log'), '" hide_txt="', crayon__('Hide Log'), '" class="button-secondary" value="', crayon__('Show Log'), '"> ',
1174
+ '<input type="submit" id="crayon-log-clear" name="', self::LOG_CLEAR,
1175
+ '" class="button-secondary" value="', crayon__('Clear Log'), '"> ', '<input type="submit" id="crayon-log-email" name="',
1176
+ self::LOG_EMAIL_ADMIN . '" class="button-secondary" value="', crayon__('Email Admin'), '"> ',
1177
+ '<input type="submit" id="crayon-log-email" name="', self::LOG_EMAIL_DEV,
1178
+ '" class="button-secondary" value="', crayon__('Email Developer'), '"> ', '</div>', '</div>';
1179
+ }
1180
+ echo '<span', (!empty($log)) ? ' class="crayon-span"' : '', '>', (empty($log)) ? crayon__('The log is currently empty.') . ' ' : '';
1181
+ if ($exists) {
1182
+ $writable ? crayon_e('The log file exists and is writable.') : crayon_e('The log file exists and is not writable.');
1183
+ } else {
1184
+ crayon_e('The log file does not exist and is not writable.');
1185
+ }
1186
+ echo '</span>';
1187
+ }
1188
+
1189
+ // About Fields ===========================================================
1190
+
1191
+ public static function info() {
1192
+ global $CRAYON_VERSION, $CRAYON_DATE, $CRAYON_AUTHOR, $CRAYON_WEBSITE, $CRAYON_TWITTER, $CRAYON_GIT, $CRAYON_PLUGIN_WP, $CRAYON_AUTHOR_SITE, $CRAYON_EMAIL, $CRAYON_DONATE;
1193
+ echo '<a name="info"></a>';
1194
+ $version = '<strong>' . crayon__('Version') . ':</strong> ' . $CRAYON_VERSION;
1195
+ $date = $CRAYON_DATE;
1196
+ $developer = '<strong>' . crayon__('Developer') . ':</strong> ' . '<a href="' . $CRAYON_AUTHOR_SITE . '" target="_blank">' . $CRAYON_AUTHOR . '</a>';
1197
+ $translators = '<strong>' . crayon__('Translators') . ':</strong> ' .
1198
+ '
1199
+ Arabic (<a href="http://djennadhamza.eb2a.com/" target="_blank">Djennad Hamza</a>),
1200
+ Chinese Simplified (<a href="http://smerpup.com/" target="_blank">Dezhi Liu</a>, <a href="http://neverno.me/" target="_blank">Jash Yin</a>),
1201
+ Chinese Traditional (<a href="http://www.arefly.com/" target="_blank">Arefly</a>),
1202
+ Dutch (<a href="https://twitter.com/RobinRoelofsen" target="_blank">Robin Roelofsen</a>, <a href="https://twitter.com/#!/chilionsnoek" target="_blank">Chilion Snoek</a>),
1203
+ French (<a href="http://tech.dupeu.pl" target="_blank">Victor Felder</a>),
1204
+ Finnish (<a href="https://github.com/vahalan" target="_blank">vahalan</a>),
1205
+ German (<a href="http://www.technologyblog.de/" target="_blank">Stephan Knau&#223;</a>),
1206
+ Italian (<a href="http://www.federicobellucci.net/" target="_blank">Federico Bellucci</a>),
1207
+ Japanese (<a href="https://twitter.com/#!/west_323" target="_blank">@west_323</a>),
1208
+ Korean (<a href="https://github.com/dokenzy" target="_blank">dokenzy</a>),
1209
+ Lithuanian (Vincent G),
1210
+ Persian (MahdiY),
1211
+ Polish (<a href="https://github.com/toszcze" target="_blank">Bartosz Romanowski</a>),
1212
+ Portuguese (<a href="http://www.adonai.eti.br" target="_blank">Adonai S. Canez</a>),
1213
+ Russian (<a href="http://simplelib.com/" target="_blank">Minimus</a>, Di_Skyer),
1214
+ Slovak (<a href="https://twitter.com/#!/webhostgeeks" target="_blank">webhostgeeks</a>),
1215
+ Slovenian (<a href="http://jodlajodla.si/" target="_blank">Jan Su&#353;nik</a>),
1216
+ Spanish (<a href="http://www.hbravo.com/" target="_blank">Hermann Bravo</a>),
1217
+ Tamil (<a href="http://kks21199.mrgoogleglass.com/" target="_blank">KKS21199</a>),
1218
+ Turkish (<a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>),
1219
+ Ukrainian (<a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)';
1220
+
1221
+ $links = '
1222
+ <a id="docs-icon" class="small-icon" title="Documentation" href="' . $CRAYON_WEBSITE . '" target="_blank"></a>
1223
+ <a id="git-icon" class="small-icon" title="GitHub" href="' . $CRAYON_GIT . '" target="_blank"></a>
1224
+ <a id="wp-icon" class="small-icon" title="Plugin Page" href="' . $CRAYON_PLUGIN_WP . '" target="_blank"></a>
1225
+ <a id="twitter-icon" class="small-icon" title="Twitter" href="' . $CRAYON_TWITTER . '" target="_blank"></a>
1226
+ <a id="gmail-icon" class="small-icon" title="Email" href="mailto:' . $CRAYON_EMAIL . '" target="_blank"></a>
1227
+ <div id="crayon-donate"><a href="' . $CRAYON_DONATE . '" title="Donate" target="_blank">
1228
+ <img src="' . plugins_url(CRAYON_DONATE_BUTTON, __FILE__) . '"></a>
1229
+ </div>';
1230
+
1231
+ echo '
1232
+ <table id="crayon-info" border="0">
1233
+ <tr>
1234
+ <td>' . $version . ' - ' . $date . '</td>
1235
+ </tr>
1236
+ <tr>
1237
+ <td>' . $developer . '</td>
1238
+ </tr>
1239
+ <tr>
1240
+ <td>' . $translators . '</td>
1241
+ </tr>
1242
+ <tr>
1243
+ <td colspan="2">' . $links . '</td>
1244
+ </tr>
1245
+ </table>';
1246
+
1247
+ }
1248
+
1249
+ public static function help_button($link) {
1250
+ return ' <a href="' . $link . '" target="_blank" class="crayon-question">' . crayon__('?') . '</a>';
1251
+ }
1252
+
1253
+ public static function plugin_row_meta($meta, $file) {
1254
+ global $CRAYON_DONATE;
1255
+ if ($file == CrayonWP::basename()) {
1256
+ $meta[] = '<a href="options-general.php?page=crayon_settings">' . crayon__('Settings') . '</a>';
1257
+ $meta[] = '<a href="options-general.php?page=crayon_settings&theme-editor=1">' . crayon__('Theme Editor') . '</a>';
1258
+ $meta[] = '<a href="' . $CRAYON_DONATE . '" target="_blank">' . crayon__('Donate') . '</a>';
1259
+ }
1260
+ return $meta;
1261
+ }
1262
+ }
1263
+
1264
+ // Add the settings menus
1265
+
1266
+ if (defined('ABSPATH') && is_admin()) {
1267
+ // For the admin section
1268
+ add_action('admin_menu', 'CrayonSettingsWP::admin_load');
1269
+ add_filter('plugin_row_meta', 'CrayonSettingsWP::plugin_row_meta', 10, 2);
1270
+ }
1271
+
1272
+ ?>
crayon_wp.class.php CHANGED
@@ -1,1334 +1,1341 @@
1
- <?php
2
- /*
3
- Plugin Name: Crayon Syntax Highlighter
4
- Plugin URI: https://github.com/aramk/crayon-syntax-highlighter
5
- Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
6
- Version: 2.6.8
7
- Author: Aram Kocharyan
8
- Author URI: http://aramk.com/
9
- Text Domain: crayon-syntax-highlighter
10
- Domain Path: /trans/
11
- License: GPL2
12
- Copyright 2013 Aram Kocharyan (email : akarmenia@gmail.com)
13
- This program is free software; you can redistribute it and/or modify
14
- it under the terms of the GNU General Public License, version 2, as
15
- published by the Free Software Foundation.
16
-
17
- This program is distributed in the hope that it will be useful,
18
- but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- GNU General Public License for more details.
21
-
22
- You should have received a copy of the GNU General Public License
23
- along with this program; if not, write to the Free Software
24
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
- */
26
- require_once('global.php');
27
- require_once(CRAYON_HIGHLIGHTER_PHP);
28
- if (CRAYON_TAG_EDITOR) {
29
- require_once(CRAYON_TAG_EDITOR_PHP);
30
- }
31
- if (CRAYON_THEME_EDITOR) {
32
- require_once(CRAYON_THEME_EDITOR_PHP);
33
- }
34
- require_once('crayon_settings_wp.class.php');
35
-
36
- if (defined('ABSPATH')) {
37
- // Used to get plugin version info
38
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
39
- crayon_set_info(get_plugin_data(__FILE__));
40
- }
41
-
42
- /* The plugin class that manages all other classes and integrates Crayon with WP */
43
-
44
- class CrayonWP {
45
- // Properties and Constants ===============================================
46
-
47
- // Associative array, keys are post IDs as strings and values are number of crayons parsed as ints
48
- private static $post_queue = array();
49
- // Ditto for comments
50
- private static $comment_queue = array();
51
- private static $post_captures = array();
52
- private static $comment_captures = array();
53
- // Whether we are displaying an excerpt
54
- private static $is_excerpt = FALSE;
55
- // Whether we have added styles and scripts
56
- private static $enqueued = FALSE;
57
- // Whether we have already printed the wp head
58
- private static $wp_head = FALSE;
59
- // Used to keep Crayon IDs
60
- private static $next_id = 0;
61
- // String to store the regex for capturing tags
62
- private static $alias_regex = '';
63
- private static $tags_regex = '';
64
- private static $tags_regex_legacy = '';
65
- private static $tag_regexes = array();
66
- // Defined constants used in bitwise flags
67
- private static $tag_types = array(
68
- CrayonSettings::CAPTURE_MINI_TAG,
69
- CrayonSettings::CAPTURE_PRE,
70
- CrayonSettings::INLINE_TAG,
71
- CrayonSettings::PLAIN_TAG,
72
- CrayonSettings::BACKQUOTE);
73
- private static $tag_bits = array();
74
- // Used to find legacy tags
75
- private static $legacy_flags = NULL;
76
-
77
- // Used to detect the shortcode
78
- private static $allowed_atts = array('url' => NULL, 'lang' => NULL, 'title' => NULL, 'mark' => NULL, 'range' => NULL, 'inline' => NULL);
79
- const REGEX_CLOSED = '(?:\[\s*crayon(?:-(\w+))?\b([^\]]*)/\s*\])'; // [crayon atts="" /]
80
- const REGEX_TAG = '(?:\[\s*crayon(?:-(\w+))?\b([^\]]*)\](.*?)\[\s*/\s*crayon\s*\])'; // [crayon atts=""] ... [/crayon]
81
- const REGEX_INLINE_CLASS = '\bcrayon-inline\b';
82
-
83
- const REGEX_CLOSED_NO_CAPTURE = '(?:\[\s*crayon\b[^\]]*/\])';
84
- const REGEX_TAG_NO_CAPTURE = '(?:\[\s*crayon\b[^\]]*\].*?\[/crayon\])';
85
-
86
- const REGEX_QUICK_CAPTURE = '(?:\[\s*crayon[^\]]*\].*?\[\s*/\s*crayon\s*\])|(?:\[\s*crayon[^\]]*/\s*\])';
87
-
88
- const REGEX_BETWEEN_PARAGRAPH = '<p[^<]*>(?:[^<]*<(?!/?p(\s+[^>]*)?>)[^>]+(\s+[^>]*)?>)*[^<]*((?:\[\s*crayon[^\]]*\].*?\[\s*/\s*crayon\s*\])|(?:\[\s*crayon[^\]]*/\s*\]))(?:[^<]*<(?!/?p(\s+[^>]*)?>)[^>]+(\s+[^>]*)?>)*[^<]*</p[^<]*>';
89
- const REGEX_BETWEEN_PARAGRAPH_SIMPLE = '(<p(?:\s+[^>]*)?>)(.*?)(</p(?:\s+[^>]*)?>)';
90
-
91
- // For [crayon-id/]
92
- const REGEX_BR_BEFORE = '#<\s*br\s*/?\s*>\s*(\[\s*crayon-\w+\])#msi';
93
- const REGEX_BR_AFTER = '#(\[\s*crayon-\w+\])\s*<\s*br\s*/?\s*>#msi';
94
-
95
- const REGEX_ID = '#(?<!\$)\[\s*crayon#mi';
96
- //const REGEX_WITH_ID = '#(\[\s*crayon-\w+)\b([^\]]*["\'])(\s*/?\s*\])#mi';
97
- const REGEX_WITH_ID = '#\[\s*(crayon-\w+)\b[^\]]*\]#mi';
98
-
99
- const MODE_NORMAL = 0, MODE_JUST_CODE = 1, MODE_PLAIN_CODE = 2;
100
-
101
- // Public Methods =========================================================
102
-
103
- public static function post_captures() {
104
- return self::$post_queue;
105
- }
106
-
107
- // Methods ================================================================
108
-
109
- private function __construct() {
110
- }
111
-
112
- public static function regex() {
113
- return '#(?<!\$)(?:' . self::REGEX_CLOSED . '|' . self::REGEX_TAG . ')(?!\$)#msi';
114
- }
115
-
116
- public static function regex_with_id($id) {
117
- return '#\[\s*(crayon-' . $id . ')\b[^\]]*\]#mi';
118
- }
119
-
120
- public static function regex_no_capture() {
121
- return '#(?<!\$)(?:' . self::REGEX_CLOSED_NO_CAPTURE . '|' . self::REGEX_TAG_NO_CAPTURE . ')(?!\$)#msi';
122
- }
123
-
124
- /**
125
- * Adds the actual Crayon instance.
126
- * $mode can be: 0 = return crayon content, 1 = return only code, 2 = return only plain code
127
- */
128
- public static function shortcode($atts, $content = NULL, $id = NULL) {
129
- CrayonLog::debug('shortcode');
130
-
131
- // Load attributes from shortcode
132
- $filtered_atts = shortcode_atts(self::$allowed_atts, $atts);
133
-
134
- // Clean attributes
135
- $keys = array_keys($filtered_atts);
136
- for ($i = 0; $i < count($keys); $i++) {
137
- $key = $keys[$i];
138
- $value = $filtered_atts[$key];
139
- if ($value !== NULL) {
140
- $filtered_atts[$key] = trim(strip_tags($value));
141
- }
142
- }
143
-
144
- // Contains all other attributes not found in allowed, used to override global settings
145
- $extra_attr = array();
146
- if (!empty($atts)) {
147
- $extra_attr = array_diff_key($atts, self::$allowed_atts);
148
- $extra_attr = CrayonSettings::smart_settings($extra_attr);
149
- }
150
- $url = $lang = $title = $mark = $range = $inline = '';
151
- extract($filtered_atts);
152
-
153
- $crayon = self::instance($extra_attr, $id);
154
-
155
- // Set URL
156
- $crayon->url($url);
157
- $crayon->code($content);
158
- // Set attributes, should be set after URL to allow language auto detection
159
- $crayon->language($lang);
160
- $crayon->title($title);
161
- $crayon->marked($mark);
162
- $crayon->range($range);
163
-
164
- $crayon->is_inline($inline);
165
-
166
- // Determine if we should highlight
167
- $highlight = array_key_exists('highlight', $atts) ? CrayonUtil::str_to_bool($atts['highlight'], FALSE) : TRUE;
168
- $crayon->is_highlighted($highlight);
169
- return $crayon;
170
- }
171
-
172
- /* Returns Crayon instance */
173
- public static function instance($extra_attr = array(), $id = NULL) {
174
- CrayonLog::debug('instance');
175
-
176
- // Create Crayon
177
- $crayon = new CrayonHighlighter();
178
-
179
- /* Load settings and merge shortcode attributes which will override any existing.
180
- * Stores the other shortcode attributes as settings in the crayon. */
181
- if (!empty($extra_attr)) {
182
- $crayon->settings($extra_attr);
183
- }
184
- if (!empty($id)) {
185
- $crayon->id($id);
186
- }
187
-
188
- return $crayon;
189
- }
190
-
191
- /* For manually highlighting code, useful for other PHP contexts */
192
- public static function highlight($code, $add_tags = FALSE) {
193
- $captures = CrayonWP::capture_crayons(0, $code);
194
- $the_captures = $captures['capture'];
195
- if (count($the_captures) == 0 && $add_tags) {
196
- // Nothing captured, so wrap in a pre and try again
197
- $code = '<pre>' . $code . '</pre>';
198
- $captures = CrayonWP::capture_crayons(0, $code);
199
- $the_captures = $captures['capture'];
200
- }
201
- $the_content = $captures['content'];
202
- foreach ($the_captures as $id => $capture) {
203
- $atts = $capture['atts'];
204
- $no_enqueue = array(
205
- CrayonSettings::ENQUEUE_THEMES => FALSE,
206
- CrayonSettings::ENQUEUE_FONTS => FALSE);
207
- $atts = array_merge($atts, $no_enqueue);
208
- $code = $capture['code'];
209
- $crayon = CrayonWP::shortcode($atts, $code, $id);
210
- $crayon_formatted = $crayon->output(TRUE, FALSE);
211
- $the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count);
212
- }
213
-
214
- return $the_content;
215
- }
216
-
217
- public static function ajax_highlight() {
218
- $code = isset($_POST['code']) ? $_POST['code'] : null;
219
- if (!$code) {
220
- $code = isset($_GET['code']) ? $_GET['code'] : null;
221
- }
222
- if ($code) {
223
- echo self::highlight($code);
224
- } else {
225
- echo "No code specified.";
226
- }
227
- exit();
228
- }
229
-
230
- /* Uses the main query */
231
- public static function wp() {
232
- CrayonLog::debug('wp (global)');
233
- global $wp_the_query;
234
- if (isset($wp_the_query->posts)) {
235
- $posts = $wp_the_query->posts;
236
- self::the_posts($posts);
237
- }
238
- }
239
-
240
- // TODO put args into an array
241
- public static function capture_crayons($wp_id, $wp_content, $extra_settings = array(), $args = array()) {
242
- extract($args);
243
- CrayonUtil::set_var($callback, NULL);
244
- CrayonUtil::set_var($callback_extra_args, NULL);
245
- CrayonUtil::set_var($ignore, TRUE);
246
- CrayonUtil::set_var($preserve_atts, FALSE);
247
- CrayonUtil::set_var($flags, NULL);
248
- CrayonUtil::set_var($skip_setting_check, FALSE);
249
- CrayonUtil::set_var($just_check, FALSE);
250
-
251
- // Will contain captured crayons and altered $wp_content
252
- $capture = array('capture' => array(), 'content' => $wp_content, 'has_captured' => FALSE);
253
-
254
- // Flags for which Crayons to convert
255
- $in_flag = self::in_flag($flags);
256
-
257
- CrayonLog::debug('capture for id ' . $wp_id . ' len ' . strlen($wp_content));
258
-
259
- // Convert <pre> tags to crayon tags, if needed
260
- if ((CrayonGlobalSettings::val(CrayonSettings::CAPTURE_PRE) || $skip_setting_check) && $in_flag[CrayonSettings::CAPTURE_PRE]) {
261
- // XXX This will fail if <pre></pre> is used inside another <pre></pre>
262
- $wp_content = preg_replace_callback('#(?<!\$)<\s*pre(?=(?:([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*))?)([^>]*)>(.*?)<\s*/\s*pre\s*>#msi', 'CrayonWP::pre_tag', $wp_content);
263
- }
264
-
265
- // Convert mini [php][/php] tags to crayon tags, if needed
266
- if ((CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::CAPTURE_MINI_TAG]) {
267
- $wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)\](.*?)\[\s*/\s*(?:\1)\s*\](?!\$)#msi', '[crayon lang="\1" \2]\3[/crayon]', $wp_content);
268
- $wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)/\s*\](?!\$)#msi', '[crayon lang="\1" \2 /]', $wp_content);
269
- }
270
-
271
- // Convert <code> to inline tags
272
- if (CrayonGlobalSettings::val(CrayonSettings::CODE_TAG_CAPTURE)) {
273
- $inline = CrayonGlobalSettings::val(CrayonSettings::CODE_TAG_CAPTURE_TYPE) === 0;
274
- $inline_setting = $inline ? 'inline="true"' : '';
275
- $wp_content = preg_replace('#<(\s*code\b)([^>]*)>(.*?)</\1[^>]*>#msi', '[crayon ' . $inline_setting . ' \2]\3[/crayon]', $wp_content);
276
- }
277
-
278
- if ((CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::INLINE_TAG]) {
279
- if (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) {
280
- // Convert inline {php}{/php} tags to crayon tags, if needed
281
- $wp_content = preg_replace('#(?<!\$)\{\s*(' . self::$alias_regex . ')\b([^\}]*)\}(.*?)\{/(?:\1)\}(?!\$)#msi', '[crayon lang="\1" inline="true" \2]\3[/crayon]', $wp_content);
282
- }
283
- // Convert <span class="crayon-inline"> tags to inline crayon tags
284
- $wp_content = preg_replace_callback('#(?<!\$)<\s*span([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*)>(.*?)<\s*/\s*span\s*>#msi', 'CrayonWP::span_tag', $wp_content);
285
- }
286
-
287
- // Convert [plain] tags into <pre><code></code></pre>, if needed
288
- if ((CrayonGlobalSettings::val(CrayonSettings::PLAIN_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::PLAIN_TAG]) {
289
- $wp_content = preg_replace_callback('#(?<!\$)\[\s*plain\s*\](.*?)\[\s*/\s*plain\s*\]#msi', 'CrayonFormatter::plain_code', $wp_content);
290
- }
291
-
292
- // Add IDs to the Crayons
293
- CrayonLog::debug('capture adding id ' . $wp_id . ' , now has len ' . strlen($wp_content));
294
- $wp_content = preg_replace_callback(self::REGEX_ID, 'CrayonWP::add_crayon_id', $wp_content);
295
-
296
- CrayonLog::debug('capture added id ' . $wp_id . ' : ' . strlen($wp_content));
297
-
298
- // Only include if a post exists with Crayon tag
299
- preg_match_all(self::regex(), $wp_content, $matches);
300
- $capture['has_captured'] = count($matches[0]) != 0;
301
- if ($just_check) {
302
- // Backticks are matched after other tags, so they need to be captured here.
303
- $result = self::replace_backquotes($wp_content);
304
- $wp_content = $result['content'];
305
- $capture['has_captured'] = $capture['has_captured'] || $result['changed'];
306
- $capture['content'] = $wp_content;
307
- return $capture;
308
- }
309
-
310
- CrayonLog::debug('capture ignore for id ' . $wp_id . ' : ' . strlen($capture['content']) . ' vs ' . strlen($wp_content));
311
-
312
- if ($capture['has_captured']) {
313
-
314
- // Crayons found! Load settings first to ensure global settings loaded
315
- CrayonSettingsWP::load_settings();
316
-
317
- CrayonLog::debug('CAPTURED FOR ID ' . $wp_id);
318
-
319
- $full_matches = $matches[0];
320
- $closed_ids = $matches[1];
321
- $closed_atts = $matches[2];
322
- $open_ids = $matches[3];
323
- $open_atts = $matches[4];
324
- $contents = $matches[5];
325
-
326
- // Make sure we enqueue the styles/scripts
327
- $enqueue = TRUE;
328
-
329
- for ($i = 0; $i < count($full_matches); $i++) {
330
- // Get attributes
331
- if (!empty($closed_atts[$i])) {
332
- $atts = $closed_atts[$i];
333
- } else if (!empty($open_atts[$i])) {
334
- $atts = $open_atts[$i];
335
- } else {
336
- $atts = '';
337
- }
338
-
339
- // Capture attributes
340
- preg_match_all('#([^="\'\s]+)[\t ]*=[\t ]*("|\')(.*?)\2#', $atts, $att_matches);
341
- // Add extra attributes
342
- $atts_array = $extra_settings;
343
- if (count($att_matches[0]) != 0) {
344
- for ($j = 0; $j < count($att_matches[1]); $j++) {
345
- $atts_array[trim(strtolower($att_matches[1][$j]))] = trim($att_matches[3][$j]);
346
- }
347
- }
348
-
349
- if (@$atts_array[CrayonSettings::IGNORE]) {
350
- // TODO(aramk) Revert to the original content.
351
- continue;
352
- }
353
-
354
- // Capture theme
355
- $theme_id = array_key_exists(CrayonSettings::THEME, $atts_array) ? $atts_array[CrayonSettings::THEME] : '';
356
- $theme = CrayonResources::themes()->get($theme_id);
357
- // If theme not found, use fallbacks
358
- if (!$theme) {
359
- // Given theme is invalid, try global setting
360
- $theme_id = CrayonGlobalSettings::val(CrayonSettings::THEME);
361
- $theme = CrayonResources::themes()->get($theme_id);
362
- if (!$theme) {
363
- // Global setting is invalid, fall back to default
364
- $theme = CrayonResources::themes()->get_default();
365
- $theme_id = CrayonThemes::DEFAULT_THEME;
366
- }
367
- }
368
- // If theme is now valid, change the array
369
- if ($theme) {
370
- if (!$preserve_atts || isset($atts_array[CrayonSettings::THEME])) {
371
- $atts_array[CrayonSettings::THEME] = $theme_id;
372
- }
373
- $theme->used(TRUE);
374
- }
375
-
376
- // Capture font
377
- $font_id = array_key_exists(CrayonSettings::FONT, $atts_array) ? $atts_array[CrayonSettings::FONT] : '';
378
- $font = CrayonResources::fonts()->get($font_id);
379
- // If font not found, use fallbacks
380
- if (!$font) {
381
- // Given font is invalid, try global setting
382
- $font_id = CrayonGlobalSettings::val(CrayonSettings::FONT);
383
- $font = CrayonResources::fonts()->get($font_id);
384
- if (!$font) {
385
- // Global setting is invalid, fall back to default
386
- $font = CrayonResources::fonts()->get_default();
387
- $font_id = CrayonFonts::DEFAULT_FONT;
388
- }
389
- }
390
-
391
- // If font is now valid, change the array
392
- if ($font /* != NULL && $font_id != CrayonFonts::DEFAULT_FONT*/) {
393
- if (!$preserve_atts || isset($atts_array[CrayonSettings::FONT])) {
394
- $atts_array[CrayonSettings::FONT] = $font_id;
395
- }
396
- $font->used(TRUE);
397
- }
398
-
399
- // Add array of atts and content to post queue with key as post ID
400
- // XXX If at this point no ID is added we have failed!
401
- $id = !empty($open_ids[$i]) ? $open_ids[$i] : $closed_ids[$i];
402
- //if ($ignore) {
403
- $code = self::crayon_remove_ignore($contents[$i]);
404
- //}
405
- $c = array('post_id' => $wp_id, 'atts' => $atts_array, 'code' => $code);
406
- $capture['capture'][$id] = $c;
407
- CrayonLog::debug('capture finished for post id ' . $wp_id . ' crayon-id ' . $id . ' atts: ' . count($atts_array) . ' code: ' . strlen($code));
408
- $is_inline = isset($atts_array['inline']) && CrayonUtil::str_to_bool($atts_array['inline'], FALSE) ? '-i' : '';
409
- if ($callback === NULL) {
410
- $wp_content = str_replace($full_matches[$i], '[crayon-' . $id . $is_inline . '/]', $wp_content);
411
- } else {
412
- $wp_content = call_user_func($callback, $c, $full_matches[$i], $id, $is_inline, $wp_content, $callback_extra_args);
413
- }
414
- }
415
-
416
- }
417
-
418
- if ($ignore) {
419
- // We need to escape ignored Crayons, since they won't be captured
420
- // XXX Do this after replacing the Crayon with the shorter ID tag, otherwise $full_matches will be different from $wp_content
421
- $wp_content = self::crayon_remove_ignore($wp_content);
422
- }
423
-
424
- $result = self::replace_backquotes($wp_content);
425
- $wp_content = $result['content'];
426
-
427
- $capture['content'] = $wp_content;
428
- return $capture;
429
- }
430
-
431
- public static function replace_backquotes($wp_content) {
432
- // Convert `` backquote tags into <code></code>, if needed
433
- // XXX Some code may contain `` so must do it after all Crayons are captured
434
- $result = array();
435
- $prev_count = strlen($wp_content);
436
- if (CrayonGlobalSettings::val(CrayonSettings::BACKQUOTE)) {
437
- $wp_content = preg_replace('#(?<!\\\\)`([^`]*)`#msi', '<code>$1</code>', $wp_content);
438
- }
439
- $result['changed'] = $prev_count !== strlen($wp_content);
440
- $result['content'] = $wp_content;
441
- return $result;
442
- }
443
-
444
- /* Search for Crayons in posts and queue them for creation */
445
- public static function the_posts($posts) {
446
- CrayonLog::debug('the_posts');
447
-
448
- // Whether to enqueue syles/scripts
449
- CrayonSettingsWP::load_settings(TRUE); // We will eventually need more than the settings
450
-
451
- self::init_tags_regex();
452
- $crayon_posts = CrayonSettingsWP::load_posts(); // Loads posts containing crayons
453
-
454
- // Search for shortcode in posts
455
- foreach ($posts as $post) {
456
- $wp_id = $post->ID;
457
- $is_page = $post->post_type == 'page';
458
- if (!in_array($wp_id, $crayon_posts)) {
459
- // If we get query for a page, then that page might have a template and load more posts containing Crayons
460
- // By this state, we would be unable to enqueue anything (header already written).
461
- if (CrayonGlobalSettings::val(CrayonSettings::SAFE_ENQUEUE) && $is_page) {
462
- CrayonGlobalSettings::set(CrayonSettings::ENQUEUE_THEMES, false);
463
- CrayonGlobalSettings::set(CrayonSettings::ENQUEUE_FONTS, false);
464
- }
465
- // Only include crayon posts
466
- continue;
467
- }
468
-
469
- $id_str = strval($wp_id);
470
-
471
- if (wp_is_post_revision($wp_id)) {
472
- // Ignore post revisions, use the parent, which has the updated post content
473
- continue;
474
- }
475
-
476
- if (isset(self::$post_captures[$id_str])) {
477
- // Don't capture twice
478
- // XXX post->post_content is reset each loop, replace content
479
- // Doing this might cause content changed by other plugins between the last loop
480
- // to fail, so be cautious
481
- $post->post_content = self::$post_captures[$id_str];
482
- continue;
483
- }
484
- // Capture post Crayons
485
- $captures = self::capture_crayons(intval($post->ID), $post->post_content);
486
-
487
- // XXX Careful not to undo changes by other plugins
488
- // XXX Must replace to remove $ for ignored Crayons
489
- $post->post_content = $captures['content'];
490
- self::$post_captures[$id_str] = $captures['content'];
491
- if ($captures['has_captured'] === TRUE) {
492
- self::$post_queue[$id_str] = array();
493
- foreach ($captures['capture'] as $capture_id => $capture_content) {
494
- self::$post_queue[$id_str][$capture_id] = $capture_content;
495
- }
496
- }
497
-
498
- // Search for shortcode in comments
499
- if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
500
- $comments = get_comments(array('post_id' => $post->ID));
501
- foreach ($comments as $comment) {
502
- $id_str = strval($comment->comment_ID);
503
- if (isset(self::$comment_queue[$id_str])) {
504
- // Don't capture twice
505
- continue;
506
- }
507
- // Capture comment Crayons, decode their contents if decode not specified
508
- $content = apply_filters('get_comment_text', $comment->comment_content, $comment);
509
- $captures = self::capture_crayons($comment->comment_ID, $content, array(CrayonSettings::DECODE => TRUE));
510
- self::$comment_captures[$id_str] = $captures['content'];
511
- if ($captures['has_captured'] === TRUE) {
512
- self::$comment_queue[$id_str] = array();
513
- foreach ($captures['capture'] as $capture_id => $capture_content) {
514
- self::$comment_queue[$id_str][$capture_id] = $capture_content;
515
- }
516
- }
517
- }
518
- }
519
- }
520
-
521
- return $posts;
522
- }
523
-
524
- private static function add_crayon_id($content) {
525
- $uid = $content[0] . '-' . str_replace('.', '', uniqid('', true));
526
- CrayonLog::debug('add_crayon_id ' . $uid);
527
- return $uid;
528
- }
529
-
530
- private static function get_crayon_id() {
531
- return self::$next_id++;
532
- }
533
-
534
- public static function enqueue_resources() {
535
- if (!self::$enqueued) {
536
-
537
- CrayonLog::debug('enqueue');
538
- global $CRAYON_VERSION;
539
- if (CRAYON_MINIFY) {
540
- wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE_MIN, __FILE__), array(), $CRAYON_VERSION);
541
- wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS_MIN, __FILE__), array('jquery'), $CRAYON_VERSION);
542
- } else {
543
- wp_enqueue_style('crayon_style', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
544
- wp_enqueue_style('crayon_global_style', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
545
- wp_enqueue_script('crayon_util_js', plugins_url(CRAYON_JS_UTIL, __FILE__), array('jquery'), $CRAYON_VERSION);
546
- CrayonSettingsWP::other_scripts();
547
- }
548
- CrayonSettingsWP::init_js_settings();
549
- self::$enqueued = TRUE;
550
- }
551
- }
552
-
553
- private static function init_tags_regex($force = FALSE, $flags = NULL, &$tags_regex = NULL) {
554
- CrayonSettingsWP::load_settings();
555
- self::init_tag_bits();
556
-
557
- // Default output
558
- if ($tags_regex === NULL) {
559
- $tags_regex = & self::$tags_regex;
560
- }
561
-
562
- if ($force || $tags_regex === "") {
563
- // Check which tags are in $flags. If it's NULL, then all flags are true.
564
- $in_flag = self::in_flag($flags);
565
-
566
- if (($in_flag[CrayonSettings::CAPTURE_MINI_TAG] && (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG)) || $force) ||
567
- ($in_flag[CrayonSettings::INLINE_TAG] && (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) && CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) || $force)
568
- ) {
569
- $aliases = CrayonResources::langs()->ids_and_aliases();
570
- self::$alias_regex = '';
571
- for ($i = 0; $i < count($aliases); $i++) {
572
- $alias = $aliases[$i];
573
- $alias_regex = CrayonUtil::esc_hash(CrayonUtil::esc_regex($alias));
574
- if ($i != count($aliases) - 1) {
575
- $alias_regex .= '|';
576
- }
577
- self::$alias_regex .= $alias_regex;
578
- }
579
- }
580
-
581
- // Add other tags
582
- $tags_regex = '#(?<!\$)(?:(\s*\[\s*crayon\b)';
583
-
584
- // TODO this is duplicated in capture_crayons()
585
- $tag_regexes = array(
586
- CrayonSettings::CAPTURE_MINI_TAG => '(\[\s*(' . self::$alias_regex . ')\b)',
587
- CrayonSettings::CAPTURE_PRE => '(<\s*pre\b)',
588
- CrayonSettings::INLINE_TAG => '(' . self::REGEX_INLINE_CLASS . ')' . '|(\{\s*(' . self::$alias_regex . ')\b([^\}]*)\})',
589
- CrayonSettings::PLAIN_TAG => '(\s*\[\s*plain\b)',
590
- CrayonSettings::BACKQUOTE => '(`[^`]*`)'
591
- );
592
-
593
- foreach ($tag_regexes as $tag => $regex) {
594
- if ($in_flag[$tag] && (CrayonGlobalSettings::val($tag) || $force)) {
595
- $tags_regex .= '|' . $regex;
596
- }
597
- }
598
- $tags_regex .= ')#msi';
599
- }
600
-
601
- }
602
-
603
- private static function init_tag_bits() {
604
- if (count(self::$tag_bits) == 0) {
605
- $values = array();
606
- for ($i = 0; $i < count(self::$tag_types); $i++) {
607
- $j = pow(2, $i);
608
- self::$tag_bits[self::$tag_types[$i]] = $j;
609
- }
610
- }
611
- }
612
-
613
- public static function tag_bit($tag) {
614
- self::init_tag_bits();
615
- if (isset(self::$tag_bits[$tag])) {
616
- return self::$tag_bits[$tag];
617
- } else {
618
- return null;
619
- }
620
- }
621
-
622
- public static function in_flag($flags) {
623
- $in_flag = array();
624
- foreach (self::$tag_types as $tag) {
625
- $in_flag[$tag] = $flags === NULL || ($flags & self::tag_bit($tag)) > 0;
626
- }
627
- return $in_flag;
628
- }
629
-
630
- private static function init_legacy_tag_bits() {
631
- if (self::$legacy_flags === NULL) {
632
- self::$legacy_flags = self::tag_bit(CrayonSettings::CAPTURE_MINI_TAG) |
633
- self::tag_bit(CrayonSettings::INLINE_TAG) |
634
- self::tag_bit(CrayonSettings::PLAIN_TAG);
635
- }
636
- if (self::$tags_regex_legacy === "") {
637
- self::init_tags_regex(TRUE, self::$legacy_flags, self::$tags_regex_legacy);
638
- }
639
- }
640
-
641
- // Add Crayon into the_content
642
- public static function the_content($the_content) {
643
- CrayonLog::debug('the_content');
644
-
645
- // Some themes make redundant queries and don't need extra work...
646
- if (strlen($the_content) == 0) {
647
- CrayonLog::debug('the_content blank');
648
- return $the_content;
649
- }
650
-
651
- global $post;
652
-
653
- // Go through queued posts and find crayons
654
- $post_id = strval($post->ID);
655
-
656
- if (self::$is_excerpt) {
657
- CrayonLog::debug('excerpt');
658
- if (CrayonGlobalSettings::val(CrayonSettings::EXCERPT_STRIP)) {
659
- CrayonLog::debug('excerpt strip');
660
- // Remove Crayon from content if we are displaying an excerpt
661
- $the_content = preg_replace(self::REGEX_WITH_ID, '', $the_content);
662
- }
663
- // Otherwise Crayon remains with ID and replaced later
664
- return $the_content;
665
- }
666
-
667
- // Find if this post has Crayons
668
- if (array_key_exists($post_id, self::$post_queue)) {
669
- self::enqueue_resources();
670
-
671
- // XXX We want the plain post content, no formatting
672
- $the_content_original = $the_content;
673
-
674
- // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed
675
- $the_content = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'CrayonWP::add_paragraphs', $the_content);
676
- // Loop through Crayons
677
- $post_in_queue = self::$post_queue[$post_id];
678
-
679
- foreach ($post_in_queue as $id => $v) {
680
- $atts = $v['atts'];
681
- $content = $v['code']; // The code we replace post content with
682
- $crayon = self::shortcode($atts, $content, $id);
683
- if (is_feed()) {
684
- // Convert the plain code to entities and put in a <pre></pre> tag
685
- $crayon_formatted = CrayonFormatter::plain_code($crayon->code(), $crayon->setting_val(CrayonSettings::DECODE));
686
- } else {
687
- // Apply shortcode to the content
688
- $crayon_formatted = $crayon->output(TRUE, FALSE);
689
- }
690
- // Replace the code with the Crayon
691
- CrayonLog::debug('the_content: id ' . $post_id . ' has UID ' . $id . ' : ' . intval(stripos($the_content, $id) !== FALSE));
692
- $the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count);
693
- CrayonLog::debug('the_content: REPLACED for id ' . $post_id . ' from len ' . strlen($the_content_original) . ' to ' . strlen($the_content));
694
- }
695
- }
696
-
697
- return $the_content;
698
- }
699
-
700
- public static function pre_comment_text($text) {
701
- global $comment;
702
- $comment_id = strval($comment->comment_ID);
703
- if (array_key_exists($comment_id, self::$comment_captures)) {
704
- // Replace with IDs now that we need to
705
- $text = self::$comment_captures[$comment_id];
706
- }
707
- return $text;
708
- }
709
-
710
- public static function comment_text($text) {
711
- global $comment;
712
- $comment_id = strval($comment->comment_ID);
713
- // Find if this post has Crayons
714
- if (array_key_exists($comment_id, self::$comment_queue)) {
715
- // XXX We want the plain post content, no formatting
716
- $the_content_original = $text;
717
- // Loop through Crayons
718
- $post_in_queue = self::$comment_queue[$comment_id];
719
-
720
- foreach ($post_in_queue as $id => $v) {
721
- $atts = $v['atts'];
722
- $content = $v['code']; // The code we replace post content with
723
- $crayon = self::shortcode($atts, $content, $id);
724
- $crayon_formatted = $crayon->output(TRUE, FALSE);
725
- // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed
726
- if (!$crayon->is_inline()) {
727
- $text = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'CrayonWP::add_paragraphs', $text);
728
- }
729
- // Replace the code with the Crayon
730
- $text = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $text, 1, $text);
731
- }
732
- }
733
- return $text;
734
- }
735
-
736
- public static function add_paragraphs($capture) {
737
- if (count($capture) != 4) {
738
- CrayonLog::debug('add_paragraphs: 0');
739
- return $capture[0];
740
- }
741
- $capture[2] = preg_replace('#(?:<\s*br\s*/\s*>\s*)?(\[\s*crayon-\w+/\])(?:<\s*br\s*/\s*>\s*)?#msi', '</p>$1<p>', $capture[2]);
742
- // If [crayon appears right after <p> then we will generate <p></p>, remove all these
743
- $paras = $capture[1] . $capture[2] . $capture[3];
744
- return $paras;
745
- }
746
-
747
- // Remove Crayons from the_excerpt
748
- public static function the_excerpt($the_excerpt) {
749
- CrayonLog::debug('excerpt');
750
- global $post;
751
- if (!empty($post->post_excerpt)) {
752
- // Use custom excerpt if defined
753
- $the_excerpt = wpautop($post->post_excerpt);
754
- } else {
755
- // Pass wp_trim_excerpt('') to gen from content (and remove [crayons])
756
- $the_excerpt = wpautop(wp_trim_excerpt(''));
757
- }
758
- // XXX Returning "" may cause it to default to full contents...
759
- return $the_excerpt . ' ';
760
- }
761
-
762
- // Used to capture pre and span tags which have settings in class attribute
763
- public static function class_tag($matches) {
764
- // If class exists, atts is not captured
765
- $pre_class = $matches[1];
766
- $quotes = $matches[2];
767
- $class = $matches[3];
768
- $post_class = $matches[4];
769
- $atts = $matches[5];
770
- $content = $matches[6];
771
-
772
- // If we find a crayon=false in the attributes, or a crayon[:_]false in the class, then we should not capture
773
- $ignore_regex_atts = '#crayon\s*=\s*(["\'])\s*(false|no|0)\s*\1#msi';
774
- $ignore_regex_class = '#crayon\s*[:_]\s*(false|no|0)#msi';
775
- if (preg_match($ignore_regex_atts, $atts) !== 0 ||
776
- preg_match($ignore_regex_class, $class) !== 0
777
- ) {
778
- return $matches[0];
779
- }
780
-
781
- if (!empty($class)) {
782
- if (preg_match('#\bignore\s*:\s*true#', $class)) {
783
- // Prevent any changes if ignoring the tag.
784
- return $matches[0];
785
- }
786
- // crayon-inline is turned into inline="1"
787
- $class = preg_replace('#' . self::REGEX_INLINE_CLASS . '#mi', 'inline="1"', $class);
788
- // "setting[:_]value" style settings in the class attribute
789
- $class = preg_replace('#\b([A-Za-z-]+)[_:](\S+)#msi', '$1=' . $quotes . '$2' . $quotes, $class);
790
- }
791
-
792
- // data-url is turned into url=""
793
- if (!empty($post_class)) {
794
- $post_class = preg_replace('#\bdata-url\s*=#mi', 'url=', $post_class);
795
- }
796
- if (!empty($pre_class)) {
797
- $pre_class = preg_replace('#\bdata-url\s*=#mi', 'url=', $post_class);
798
- }
799
-
800
- if (!empty($class)) {
801
- return "[crayon $pre_class $class $post_class]{$content}[/crayon]";
802
- } else {
803
- return "[crayon $atts]{$content}[/crayon]";
804
- }
805
- }
806
-
807
- // Capture span tag and extract settings from the class attribute, if present.
808
- public static function span_tag($matches) {
809
- // Only use <span> tags with crayon-inline class
810
- if (preg_match('#' . self::REGEX_INLINE_CLASS . '#mi', $matches[3])) {
811
- // no $atts
812
- $matches[6] = $matches[5];
813
- $matches[5] = '';
814
- return self::class_tag($matches);
815
- } else {
816
- // Don't turn regular <span>s into Crayons
817
- return $matches[0];
818
- }
819
- }
820
-
821
- // Capture pre tag and extract settings from the class attribute, if present.
822
- public static function pre_tag($matches) {
823
- return self::class_tag($matches);
824
- }
825
-
826
- /**
827
- * Check if the $ notation has been used to ignore [crayon] tags within posts and remove all matches
828
- * Can also remove if used without $ as a regular crayon
829
- *
830
- * @depreciated
831
- */
832
- public static function crayon_remove_ignore($the_content, $ignore_flag = '$') {
833
- if ($ignore_flag == FALSE) {
834
- $ignore_flag = '';
835
- }
836
- $ignore_flag_regex = preg_quote($ignore_flag);
837
-
838
- $the_content = preg_replace('#' . $ignore_flag_regex . '(\s*\[\s*crayon)#msi', '$1', $the_content);
839
- $the_content = preg_replace('#(crayon\s*\])\s*\$#msi', '$1', $the_content);
840
-
841
- if (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_PRE)) {
842
- $the_content = str_ireplace(array($ignore_flag . '<pre', 'pre>' . $ignore_flag), array('<pre', 'pre>'), $the_content);
843
- // Remove any <code> tags wrapping around the whole code, since we won't needed them
844
- // XXX This causes <code> tags to be stripped in the post content! Disabled now.
845
- // $the_content = preg_replace('#(^\s*<\s*code[^>]*>)|(<\s*/\s*code[^>]*>\s*$)#msi', '', $the_content);
846
- }
847
- if (CrayonGlobalSettings::val(CrayonSettings::PLAIN_TAG)) {
848
- $the_content = str_ireplace(array($ignore_flag . '[plain', 'plain]' . $ignore_flag), array('[plain', 'plain]'), $the_content);
849
- }
850
- if (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG) ||
851
- (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG && CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)))
852
- ) {
853
- self::init_tags_regex();
854
- // $the_content = preg_replace('#'.$ignore_flag_regex.'\s*([\[\{])\s*('. self::$alias_regex .')#', '$1$2', $the_content);
855
- // $the_content = preg_replace('#('. self::$alias_regex .')\s*([\]\}])\s*'.$ignore_flag_regex.'#', '$1$2', $the_content);
856
- $the_content = preg_replace('#' . $ignore_flag_regex . '(\s*[\[\{]\s*(' . self::$alias_regex . ')[^\]]*[\]\}])#', '$1', $the_content);
857
- }
858
- if (CrayonGlobalSettings::val(CrayonSettings::BACKQUOTE)) {
859
- $the_content = str_ireplace('\\`', '`', $the_content);
860
- }
861
- return $the_content;
862
- }
863
-
864
- public static function wp_head() {
865
- CrayonLog::debug('head');
866
-
867
- self::$wp_head = TRUE;
868
- if (!self::$enqueued) {
869
- CrayonLog::debug('head: missed enqueue');
870
- // We have missed our chance to check before enqueuing. Use setting to either load always or only in the_post
871
- CrayonSettingsWP::load_settings(TRUE); // Ensure settings are loaded
872
- // If we need the tag editor loaded at all times, we must enqueue at all times
873
- if (!CrayonGlobalSettings::val(CrayonSettings::EFFICIENT_ENQUEUE) || CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) {
874
- CrayonLog::debug('head: force enqueue');
875
- // Efficient enqueuing disabled, always load despite enqueuing or not in the_post
876
- self::enqueue_resources();
877
- }
878
- }
879
- // Enqueue Theme CSS
880
- if (CrayonGlobalSettings::val(CrayonSettings::ENQUEUE_THEMES)) {
881
- self::crayon_theme_css();
882
- }
883
- // Enqueue Font CSS
884
- if (CrayonGlobalSettings::val(CrayonSettings::ENQUEUE_FONTS)) {
885
- self::crayon_font_css();
886
- }
887
- }
888
-
889
- public static function save_post($update_id, $post) {
890
- self::refresh_post($post);
891
- }
892
-
893
- public static function filter_post_data($data, $postarr) {
894
- // Remove the selected CSS that may be present from the tag editor.
895
- CrayonTagEditorWP::init_settings();
896
- $css_selected = CrayonTagEditorWP::$settings['css_selected'];
897
- $data['post_content'] = preg_replace("#(class\s*=\s*(\\\\[\"'])[^\"']*)$css_selected([^\"']*\\2)#msi", '$1$3', $data['post_content']);
898
- return $data;
899
- }
900
-
901
- public static function refresh_post($post, $refresh_legacy = TRUE, $save = TRUE) {
902
- $postID = $post->ID;
903
- if (wp_is_post_revision($postID)) {
904
- // Ignore revisions
905
- return;
906
- }
907
- if (CrayonWP::scan_post($post)) {
908
- CrayonSettingsWP::add_post($postID, $save);
909
- if ($refresh_legacy) {
910
- if (self::scan_legacy_post($post)) {
911
- CrayonSettingsWP::add_legacy_post($postID, $save);
912
- } else {
913
- CrayonSettingsWP::remove_legacy_post($postID, $save);
914
- }
915
- }
916
- } else {
917
- CrayonSettingsWP::remove_post($postID, $save);
918
- CrayonSettingsWP::remove_legacy_post($postID, $save);
919
- }
920
- }
921
-
922
- public static function refresh_posts() {
923
- CrayonSettingsWP::remove_posts();
924
- CrayonSettingsWP::remove_legacy_posts();
925
- foreach (CrayonWP::get_posts() as $post) {
926
- self::refresh_post($post, TRUE, FALSE);
927
- }
928
- CrayonSettingsWP::save_posts();
929
- CrayonSettingsWP::save_legacy_posts();
930
-
931
- }
932
-
933
- public static function save_comment($id, $is_spam = NULL, $comment = NULL) {
934
- self::init_tags_regex();
935
- if ($comment === NULL) {
936
- $comment = get_comment($id);
937
- }
938
- $content = $comment->comment_content;
939
- $post_id = $comment->comment_post_ID;
940
- $found = preg_match(self::$tags_regex, $content);
941
- if ($found) {
942
- CrayonSettingsWP::add_post($post_id);
943
- }
944
- return $found;
945
- }
946
-
947
- public static function crayon_theme_css() {
948
- global $CRAYON_VERSION;
949
- CrayonSettingsWP::load_settings();
950
- $css = CrayonResources::themes()->get_used_css();
951
- foreach ($css as $theme => $url) {
952
- wp_enqueue_style('crayon-theme-' . $theme, $url, array(), $CRAYON_VERSION);
953
- }
954
- }
955
-
956
- public static function crayon_font_css() {
957
- global $CRAYON_VERSION;
958
- CrayonSettingsWP::load_settings();
959
- $css = CrayonResources::fonts()->get_used_css();
960
- foreach ($css as $font_id => $url) {
961
- wp_enqueue_style('crayon-font-' . $font_id, $url, array(), $CRAYON_VERSION);
962
- }
963
- }
964
-
965
- public static function init($request) {
966
- CrayonLog::debug('init');
967
- crayon_load_plugin_textdomain();
968
- }
969
-
970
- public static function init_ajax() {
971
- add_action('wp_ajax_crayon-tag-editor', 'CrayonTagEditorWP::content');
972
- add_action('wp_ajax_nopriv_crayon-tag-editor', 'CrayonTagEditorWP::content');
973
- add_action('wp_ajax_crayon-highlight', 'CrayonWP::ajax_highlight');
974
- add_action('wp_ajax_nopriv_crayon-highlight', 'CrayonWP::ajax_highlight');
975
- if (is_admin()) {
976
- add_action('wp_ajax_crayon-ajax', 'CrayonWP::ajax');
977
- add_action('wp_ajax_crayon-theme-editor', 'CrayonThemeEditorWP::content');
978
- add_action('wp_ajax_crayon-theme-editor-save', 'CrayonThemeEditorWP::save');
979
- add_action('wp_ajax_crayon-theme-editor-delete', 'CrayonThemeEditorWP::delete');
980
- add_action('wp_ajax_crayon-theme-editor-duplicate', 'CrayonThemeEditorWP::duplicate');
981
- add_action('wp_ajax_crayon-theme-editor-submit', 'CrayonThemeEditorWP::submit');
982
- add_action('wp_ajax_crayon-show-posts', 'CrayonSettingsWP::show_posts');
983
- add_action('wp_ajax_crayon-show-langs', 'CrayonSettingsWP::show_langs');
984
- add_action('wp_ajax_crayon-show-preview', 'CrayonSettingsWP::show_preview');
985
- }
986
- }
987
-
988
- public static function ajax() {
989
- $allowed = array(CrayonSettings::HIDE_HELP);
990
- foreach ($allowed as $allow) {
991
- if (array_key_exists($allow, $_GET)) {
992
- CrayonGlobalSettings::set($allow, $_GET[$allow]);
993
- CrayonSettingsWP::save_settings();
994
- }
995
- }
996
- }
997
-
998
- public static function get_posts() {
999
- $query = new WP_Query(array('post_type' => 'any', 'suppress_filters' => TRUE, 'posts_per_page' => '-1'));
1000
- if (isset($query->posts)) {
1001
- return $query->posts;
1002
- } else {
1003
- return array();
1004
- }
1005
- }
1006
-
1007
- /**
1008
- * Return an array of post IDs where crayons occur.
1009
- * Comments are ignored by default.
1010
- */
1011
- public static function scan_posts($check_comments = FALSE) {
1012
- $crayon_posts = array();
1013
- foreach (self::get_posts() as $post) {
1014
- if (self::scan_post($post)) {
1015
- $crayon_posts[] = $post->ID;
1016
- }
1017
- }
1018
- return $crayon_posts;
1019
- }
1020
-
1021
- public static function scan_legacy_posts($init_regex = TRUE, $check_comments = FALSE) {
1022
- if ($init_regex) {
1023
- // We can skip this if needed
1024
- self::init_tags_regex();
1025
- }
1026
- $crayon_posts = array();
1027
- foreach (self::get_posts() as $post) {
1028
- if (self::scan_legacy_post($post)) { // TODO this part is different
1029
- $crayon_posts[] = $post->ID;
1030
- }
1031
- }
1032
- return $crayon_posts;
1033
- }
1034
-
1035
- /**
1036
- * Returns TRUE if a given post contains a Crayon tag
1037
- */
1038
- public static function scan_post($post, $scan_comments = TRUE, $flags = NULL) {
1039
- if ($flags === NULL) {
1040
- self::init_tags_regex(TRUE);
1041
- }
1042
-
1043
- $id = $post->ID;
1044
-
1045
- $args = array(
1046
- 'ignore' => FALSE,
1047
- 'flags' => $flags,
1048
- 'skip_setting_check' => TRUE,
1049
- 'just_check' => TRUE
1050
- );
1051
- $captures = self::capture_crayons($id, $post->post_content, array(), $args);
1052
-
1053
- if ($captures['has_captured']) {
1054
- return TRUE;
1055
- } else if ($scan_comments) {
1056
- CrayonSettingsWP::load_settings(TRUE);
1057
- if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1058
- $comments = get_comments(array('post_id' => $id));
1059
- foreach ($comments as $comment) {
1060
- if (self::scan_comment($comment, $flags)) {
1061
- return TRUE;
1062
- }
1063
- }
1064
- }
1065
- }
1066
- return FALSE;
1067
- }
1068
-
1069
- public static function scan_legacy_post($post, $scan_comments = TRUE) {
1070
- self::init_legacy_tag_bits();
1071
- return self::scan_post($post, $scan_comments, self::$legacy_flags);
1072
- }
1073
-
1074
- /**
1075
- * Returns TRUE if the comment contains a Crayon tag
1076
- */
1077
- public static function scan_comment($comment, $flags = NULL) {
1078
- if ($flags === NULL) {
1079
- self::init_tags_regex();
1080
- }
1081
- $args = array(
1082
- 'ignore' => FALSE,
1083
- 'flags' => $flags,
1084
- 'skip_setting_check' => TRUE,
1085
- 'just_check' => TRUE
1086
- );
1087
- $content = apply_filters('get_comment_text', $comment->comment_content, $comment);
1088
- $captures = self::capture_crayons($comment->comment_ID, $content, array(), $args);
1089
- return $captures['has_captured'];
1090
- }
1091
-
1092
- public static function install() {
1093
- self::refresh_posts();
1094
- self::update();
1095
- }
1096
-
1097
- public static function uninstall() {
1098
-
1099
- }
1100
-
1101
- public static function update() {
1102
- global $CRAYON_VERSION;
1103
- CrayonSettingsWP::load_settings(TRUE);
1104
- $settings = CrayonSettingsWP::get_settings();
1105
- if ($settings === NULL || !isset($settings[CrayonSettings::VERSION])) {
1106
- return;
1107
- }
1108
-
1109
- $version = $settings[CrayonSettings::VERSION];
1110
-
1111
- // Only upgrade if the version differs
1112
- if ($version != $CRAYON_VERSION) {
1113
- $defaults = CrayonSettings::get_defaults_array();
1114
- $touched = FALSE;
1115
-
1116
- // Upgrade database and settings
1117
-
1118
- if (CrayonUtil::version_compare($version, '1.7.21') < 0) {
1119
- $settings[CrayonSettings::SCROLL] = $defaults[CrayonSettings::SCROLL];
1120
- $touched = TRUE;
1121
- }
1122
-
1123
- if (CrayonUtil::version_compare($version, '1.7.23') < 0 && $settings[CrayonSettings::FONT] == 'theme-font') {
1124
- $settings[CrayonSettings::FONT] = $defaults[CrayonSettings::FONT];
1125
- $touched = TRUE;
1126
- }
1127
-
1128
- if (CrayonUtil::version_compare($version, '1.14') < 0) {
1129
- CrayonLog::syslog("Updated to v1.14: Font size enabled");
1130
- $settings[CrayonSettings::FONT_SIZE_ENABLE] = TRUE;
1131
- }
1132
-
1133
- if (CrayonUtil::version_compare($version, '1.17') < 0) {
1134
- $settings[CrayonSettings::HIDE_HELP] = FALSE;
1135
- }
1136
-
1137
- // Save new version
1138
- $settings[CrayonSettings::VERSION] = $CRAYON_VERSION;
1139
- CrayonSettingsWP::save_settings($settings);
1140
- CrayonLog::syslog("Updated from $version to $CRAYON_VERSION");
1141
-
1142
- // Refresh to show new settings
1143
- header('Location: ' . CrayonUtil::current_url());
1144
- exit();
1145
- }
1146
- }
1147
-
1148
- public static function basename() {
1149
- return plugin_basename(__FILE__);
1150
- }
1151
-
1152
- // This should never be called through AJAX, only server side, since WP will not be loaded
1153
- public static function wp_load_path() {
1154
- if (defined('ABSPATH')) {
1155
- return ABSPATH . 'wp-load.php';
1156
- } else {
1157
- CrayonLog::syslog('wp_load_path could not find value for ABSPATH');
1158
- }
1159
- }
1160
-
1161
- public static function pre_excerpt($e) {
1162
- CrayonLog::debug('pre_excerpt');
1163
- self::$is_excerpt = TRUE;
1164
- return $e;
1165
- }
1166
-
1167
- public static function post_excerpt($e) {
1168
- CrayonLog::debug('post_excerpt');
1169
- self::$is_excerpt = FALSE;
1170
- $e = self::the_content($e);
1171
- return $e;
1172
- }
1173
-
1174
- public static function post_get_excerpt($e) {
1175
- CrayonLog::debug('post_get_excerpt');
1176
- self::$is_excerpt = FALSE;
1177
- return $e;
1178
- }
1179
-
1180
- /**
1181
- * Converts Crayon tags found in WP to <pre> form.
1182
- * XXX: This will alter blog content, so backup before calling.
1183
- * XXX: Do NOT call this while updating posts or comments, it may cause an infinite loop or fail.
1184
- * @param $encode Whether to detect missing "decode" attribute and encode html entities in the code.
1185
- */
1186
- public static function convert_tags($encode = FALSE) {
1187
- $crayon_posts = CrayonSettingsWP::load_legacy_posts();
1188
- if ($crayon_posts === NULL) {
1189
- return;
1190
- }
1191
-
1192
- self::init_legacy_tag_bits();
1193
- $args = array(
1194
- 'callback' => 'CrayonWP::capture_replace_pre',
1195
- 'callback_extra_args' => array('encode' => $encode),
1196
- 'ignore' => FALSE,
1197
- 'preserve_atts' => TRUE,
1198
- 'flags' => self::$legacy_flags,
1199
- 'skip_setting_check' => TRUE
1200
- );
1201
-
1202
- foreach ($crayon_posts as $postID) {
1203
- $post = get_post($postID);
1204
- $post_content = $post->post_content;
1205
- $post_captures = self::capture_crayons($postID, $post_content, array(), $args);
1206
-
1207
- if ($post_captures['has_captured'] === TRUE) {
1208
- $post_obj = array();
1209
- $post_obj['ID'] = $postID;
1210
- $post_obj['post_content'] = addslashes($post_captures['content']);
1211
- wp_update_post($post_obj);
1212
- CrayonLog::syslog("Converted Crayons in post ID $postID to pre tags", 'CONVERT');
1213
- }
1214
-
1215
- if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1216
- $comments = get_comments(array('post_id' => $postID));
1217
- foreach ($comments as $comment) {
1218
- $commentID = $comment->comment_ID;
1219
- $comment_captures = self::capture_crayons($commentID, $comment->comment_content, array(CrayonSettings::DECODE => TRUE), $args);
1220
-
1221
- if ($comment_captures['has_captured'] === TRUE) {
1222
- $comment_obj = array();
1223
- $comment_obj['comment_ID'] = $commentID;
1224
- $comment_obj['comment_content'] = $comment_captures['content'];
1225
- wp_update_comment($comment_obj);
1226
- CrayonLog::syslog("Converted Crayons in post ID $postID, comment ID $commentID to pre tags", 'CONVERT');
1227
- }
1228
- }
1229
- }
1230
- }
1231
-
1232
- self::refresh_posts();
1233
- }
1234
-
1235
- // Used as capture_crayons callback
1236
- public static function capture_replace_pre($capture, $original, $id, $is_inline, $wp_content, $args = array()) {
1237
- $code = $capture['code'];
1238
- $oldAtts = $capture['atts'];
1239
- $newAtts = array();
1240
- $encode = isset($args['encode']) ? $args['encode'] : FALSE;
1241
- if (!isset($oldAtts[CrayonSettings::DECODE]) && $encode) {
1242
- // Encode the content, since no decode information exists.
1243
- $code = CrayonUtil::htmlentities($code);
1244
- }
1245
- // We always set decode=1 irrespectively - so at this point the code is assumed to be encoded
1246
- $oldAtts[CrayonSettings::DECODE] = TRUE;
1247
- $newAtts['class'] = CrayonUtil::html_attributes($oldAtts, CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP), '');
1248
- return str_replace($original, CrayonUtil::html_element('pre', $code, $newAtts), $wp_content);
1249
- }
1250
-
1251
- // Add TinyMCE to comments
1252
- public static function tinymce_comment_enable($args) {
1253
- if (function_exists('wp_editor')) {
1254
- ob_start();
1255
- wp_editor('', 'comment', array('tinymce'));
1256
- $args['comment_field'] = ob_get_clean();
1257
- }
1258
- return $args;
1259
- }
1260
-
1261
- public static function allowed_tags() {
1262
- global $allowedtags;
1263
- $tags = array('pre', 'span', 'code');
1264
- foreach ($tags as $tag) {
1265
- $current_atts = isset($allowedtags[$tag]) ? $allowedtags[$tag] : array();
1266
- // TODO data-url isn't recognised by WP
1267
- $new_atts = array('class' => TRUE, 'title' => TRUE, 'data-url' => TRUE);
1268
- $allowedtags[$tag] = array_merge($current_atts, $new_atts);
1269
- }
1270
- }
1271
-
1272
- }
1273
-
1274
- // Only if WP is loaded
1275
- if (defined('ABSPATH')) {
1276
- if (!is_admin()) {
1277
- // Filters and Actions
1278
-
1279
- add_filter('init', 'CrayonWP::init');
1280
-
1281
- CrayonSettingsWP::load_settings(TRUE);
1282
- if (CrayonGlobalSettings::val(CrayonSettings::MAIN_QUERY)) {
1283
- add_action('wp', 'CrayonWP::wp', 100);
1284
- } else {
1285
- add_filter('the_posts', 'CrayonWP::the_posts', 100);
1286
- }
1287
-
1288
- // XXX Some themes like to play with the content, make sure we replace after they're done
1289
- add_filter('the_content', 'CrayonWP::the_content', 100);
1290
-
1291
- // Highlight bbPress content
1292
- add_filter('bbp_get_reply_content', 'CrayonWP::highlight', 100);
1293
- add_filter('bbp_get_topic_content', 'CrayonWP::highlight', 100);
1294
- add_filter('bbp_get_forum_content', 'CrayonWP::highlight', 100);
1295
- add_filter('bbp_get_topic_excerpt', 'CrayonWP::highlight', 100);
1296
-
1297
- // Allow tags
1298
- add_action('init', 'CrayonWP::allowed_tags', 11);
1299
-
1300
- if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1301
- /* XXX This is called first to match Crayons, then higher priority replaces after other filters.
1302
- Prevents Crayon from being formatted by the filters, and also keeps original comment formatting. */
1303
- add_filter('comment_text', 'CrayonWP::pre_comment_text', 1);
1304
- add_filter('comment_text', 'CrayonWP::comment_text', 100);
1305
- }
1306
-
1307
- // This ensures Crayons are not formatted by WP filters. Other plugins should specify priorities between 1 and 100.
1308
- add_filter('get_the_excerpt', 'CrayonWP::pre_excerpt', 1);
1309
- add_filter('get_the_excerpt', 'CrayonWP::post_get_excerpt', 100);
1310
- add_filter('the_excerpt', 'CrayonWP::post_excerpt', 100);
1311
-
1312
- add_action('template_redirect', 'CrayonWP::wp_head', 0);
1313
-
1314
- if (CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) {
1315
- add_filter('comment_form_defaults', 'CrayonWP::tinymce_comment_enable');
1316
- }
1317
- } else {
1318
- // Update between versions
1319
- CrayonWP::update();
1320
- // For marking a post as containing a Crayon
1321
- add_action('update_post', 'CrayonWP::save_post', 10, 2);
1322
- add_action('save_post', 'CrayonWP::save_post', 10, 2);
1323
- add_filter('wp_insert_post_data', 'CrayonWP::filter_post_data', '99', 2);
1324
- }
1325
- register_activation_hook(__FILE__, 'CrayonWP::install');
1326
- register_deactivation_hook(__FILE__, 'CrayonWP::uninstall');
1327
- if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1328
- add_action('comment_post', 'CrayonWP::save_comment', 10, 2);
1329
- add_action('edit_comment', 'CrayonWP::save_comment', 10, 2);
1330
- }
1331
- add_filter('init', 'CrayonWP::init_ajax');
1332
- }
1333
-
1334
- ?>
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Crayon Syntax Highlighter
4
+ Plugin URI: https://github.com/aramk/crayon-syntax-highlighter
5
+ Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
6
+ Version: 2.6.10
7
+ Author: Aram Kocharyan
8
+ Author URI: http://aramk.com/
9
+ Text Domain: crayon-syntax-highlighter
10
+ Domain Path: /trans/
11
+ License: GPL2
12
+ Copyright 2013 Aram Kocharyan (email : akarmenia@gmail.com)
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License, version 2, as
15
+ published by the Free Software Foundation.
16
+
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+ require_once('global.php');
27
+ require_once(CRAYON_HIGHLIGHTER_PHP);
28
+ if (CRAYON_TAG_EDITOR) {
29
+ require_once(CRAYON_TAG_EDITOR_PHP);
30
+ }
31
+ if (CRAYON_THEME_EDITOR) {
32
+ require_once(CRAYON_THEME_EDITOR_PHP);
33
+ }
34
+ require_once('crayon_settings_wp.class.php');
35
+
36
+ if (defined('ABSPATH')) {
37
+ // Used to get plugin version info
38
+ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
39
+ crayon_set_info(get_plugin_data(__FILE__));
40
+ }
41
+
42
+ /* The plugin class that manages all other classes and integrates Crayon with WP */
43
+
44
+ class CrayonWP {
45
+ // Properties and Constants ===============================================
46
+
47
+ // Associative array, keys are post IDs as strings and values are number of crayons parsed as ints
48
+ private static $post_queue = array();
49
+ // Ditto for comments
50
+ private static $comment_queue = array();
51
+ private static $post_captures = array();
52
+ private static $comment_captures = array();
53
+ // Whether we are displaying an excerpt
54
+ private static $is_excerpt = FALSE;
55
+ // Whether we have added styles and scripts
56
+ private static $enqueued = FALSE;
57
+ // Whether we have already printed the wp head
58
+ private static $wp_head = FALSE;
59
+ // Used to keep Crayon IDs
60
+ private static $next_id = 0;
61
+ // String to store the regex for capturing tags
62
+ private static $alias_regex = '';
63
+ private static $tags_regex = '';
64
+ private static $tags_regex_legacy = '';
65
+ private static $tag_regexes = array();
66
+ // Defined constants used in bitwise flags
67
+ private static $tag_types = array(
68
+ CrayonSettings::CAPTURE_MINI_TAG,
69
+ CrayonSettings::CAPTURE_PRE,
70
+ CrayonSettings::INLINE_TAG,
71
+ CrayonSettings::PLAIN_TAG,
72
+ CrayonSettings::BACKQUOTE);
73
+ private static $tag_bits = array();
74
+ // Used to find legacy tags
75
+ private static $legacy_flags = NULL;
76
+
77
+ // Used to detect the shortcode
78
+ private static $allowed_atts = array('url' => NULL, 'lang' => NULL, 'title' => NULL, 'mark' => NULL, 'range' => NULL, 'inline' => NULL);
79
+ const REGEX_CLOSED = '(?:\[\s*crayon(?:-(\w+))?\b([^\]]*)/\s*\])'; // [crayon atts="" /]
80
+ const REGEX_TAG = '(?:\[\s*crayon(?:-(\w+))?\b([^\]]*)\](.*?)\[\s*/\s*crayon\s*\])'; // [crayon atts=""] ... [/crayon]
81
+ const REGEX_INLINE_CLASS = '\bcrayon-inline\b';
82
+
83
+ const REGEX_CLOSED_NO_CAPTURE = '(?:\[\s*crayon\b[^\]]*/\])';
84
+ const REGEX_TAG_NO_CAPTURE = '(?:\[\s*crayon\b[^\]]*\].*?\[/crayon\])';
85
+
86
+ const REGEX_QUICK_CAPTURE = '(?:\[\s*crayon[^\]]*\].*?\[\s*/\s*crayon\s*\])|(?:\[\s*crayon[^\]]*/\s*\])';
87
+
88
+ const REGEX_BETWEEN_PARAGRAPH = '<p[^<]*>(?:[^<]*<(?!/?p(\s+[^>]*)?>)[^>]+(\s+[^>]*)?>)*[^<]*((?:\[\s*crayon[^\]]*\].*?\[\s*/\s*crayon\s*\])|(?:\[\s*crayon[^\]]*/\s*\]))(?:[^<]*<(?!/?p(\s+[^>]*)?>)[^>]+(\s+[^>]*)?>)*[^<]*</p[^<]*>';
89
+ const REGEX_BETWEEN_PARAGRAPH_SIMPLE = '(<p(?:\s+[^>]*)?>)(.*?)(</p(?:\s+[^>]*)?>)';
90
+
91
+ // For [crayon-id/]
92
+ const REGEX_BR_BEFORE = '#<\s*br\s*/?\s*>\s*(\[\s*crayon-\w+\])#msi';
93
+ const REGEX_BR_AFTER = '#(\[\s*crayon-\w+\])\s*<\s*br\s*/?\s*>#msi';
94
+
95
+ const REGEX_ID = '#(?<!\$)\[\s*crayon#mi';
96
+ //const REGEX_WITH_ID = '#(\[\s*crayon-\w+)\b([^\]]*["\'])(\s*/?\s*\])#mi';
97
+ const REGEX_WITH_ID = '#\[\s*(crayon-\w+)\b[^\]]*\]#mi';
98
+
99
+ const MODE_NORMAL = 0, MODE_JUST_CODE = 1, MODE_PLAIN_CODE = 2;
100
+
101
+ // Public Methods =========================================================
102
+
103
+ public static function post_captures() {
104
+ return self::$post_queue;
105
+ }
106
+
107
+ // Methods ================================================================
108
+
109
+ private function __construct() {
110
+ }
111
+
112
+ public static function regex() {
113
+ return '#(?<!\$)(?:' . self::REGEX_CLOSED . '|' . self::REGEX_TAG . ')(?!\$)#msi';
114
+ }
115
+
116
+ public static function regex_with_id($id) {
117
+ return '#\[\s*(crayon-' . $id . ')\b[^\]]*\]#mi';
118
+ }
119
+
120
+ public static function regex_no_capture() {
121
+ return '#(?<!\$)(?:' . self::REGEX_CLOSED_NO_CAPTURE . '|' . self::REGEX_TAG_NO_CAPTURE . ')(?!\$)#msi';
122
+ }
123
+
124
+ /**
125
+ * Adds the actual Crayon instance.
126
+ * $mode can be: 0 = return crayon content, 1 = return only code, 2 = return only plain code
127
+ */
128
+ public static function shortcode($atts, $content = NULL, $id = NULL) {
129
+ CrayonLog::debug('shortcode');
130
+
131
+ // Load attributes from shortcode
132
+ $filtered_atts = shortcode_atts(self::$allowed_atts, $atts);
133
+
134
+ // Clean attributes
135
+ $keys = array_keys($filtered_atts);
136
+ for ($i = 0; $i < count($keys); $i++) {
137
+ $key = $keys[$i];
138
+ $value = $filtered_atts[$key];
139
+ if ($value !== NULL) {
140
+ $filtered_atts[$key] = trim(strip_tags($value));
141
+ }
142
+ }
143
+
144
+ // Contains all other attributes not found in allowed, used to override global settings
145
+ $extra_attr = array();
146
+ if (!empty($atts)) {
147
+ $extra_attr = array_diff_key($atts, self::$allowed_atts);
148
+ $extra_attr = CrayonSettings::smart_settings($extra_attr);
149
+ }
150
+ $url = $lang = $title = $mark = $range = $inline = '';
151
+ extract($filtered_atts);
152
+
153
+ $crayon = self::instance($extra_attr, $id);
154
+
155
+ // Set URL
156
+ $crayon->url($url);
157
+ $crayon->code($content);
158
+ // Set attributes, should be set after URL to allow language auto detection
159
+ $crayon->language($lang);
160
+ $crayon->title($title);
161
+ $crayon->marked($mark);
162
+ $crayon->range($range);
163
+
164
+ $crayon->is_inline($inline);
165
+
166
+ // Determine if we should highlight
167
+ $highlight = array_key_exists('highlight', $atts) ? CrayonUtil::str_to_bool($atts['highlight'], FALSE) : TRUE;
168
+ $crayon->is_highlighted($highlight);
169
+ return $crayon;
170
+ }
171
+
172
+ /* Returns Crayon instance */
173
+ public static function instance($extra_attr = array(), $id = NULL) {
174
+ CrayonLog::debug('instance');
175
+
176
+ // Create Crayon
177
+ $crayon = new CrayonHighlighter();
178
+
179
+ /* Load settings and merge shortcode attributes which will override any existing.
180
+ * Stores the other shortcode attributes as settings in the crayon. */
181
+ if (!empty($extra_attr)) {
182
+ $crayon->settings($extra_attr);
183
+ }
184
+ if (!empty($id)) {
185
+ $crayon->id($id);
186
+ }
187
+
188
+ return $crayon;
189
+ }
190
+
191
+ /* For manually highlighting code, useful for other PHP contexts */
192
+ public static function highlight($code, $add_tags = FALSE) {
193
+ $captures = CrayonWP::capture_crayons(0, $code);
194
+ $the_captures = $captures['capture'];
195
+ if (count($the_captures) == 0 && $add_tags) {
196
+ // Nothing captured, so wrap in a pre and try again
197
+ $code = '<pre>' . $code . '</pre>';
198
+ $captures = CrayonWP::capture_crayons(0, $code);
199
+ $the_captures = $captures['capture'];
200
+ }
201
+ $the_content = $captures['content'];
202
+ foreach ($the_captures as $id => $capture) {
203
+ $atts = $capture['atts'];
204
+ $no_enqueue = array(
205
+ CrayonSettings::ENQUEUE_THEMES => FALSE,
206
+ CrayonSettings::ENQUEUE_FONTS => FALSE);
207
+ $atts = array_merge($atts, $no_enqueue);
208
+ $code = $capture['code'];
209
+ $crayon = CrayonWP::shortcode($atts, $code, $id);
210
+ $crayon_formatted = $crayon->output(TRUE, FALSE);
211
+ $the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count);
212
+ }
213
+
214
+ return $the_content;
215
+ }
216
+
217
+ public static function ajax_highlight() {
218
+ $code = isset($_POST['code']) ? $_POST['code'] : null;
219
+ if (!$code) {
220
+ $code = isset($_GET['code']) ? $_GET['code'] : null;
221
+ }
222
+ if ($code) {
223
+ echo self::highlight($code);
224
+ } else {
225
+ echo "No code specified.";
226
+ }
227
+ exit();
228
+ }
229
+
230
+ /* Uses the main query */
231
+ public static function wp() {
232
+ CrayonLog::debug('wp (global)');
233
+ global $wp_the_query;
234
+ if (isset($wp_the_query->posts)) {
235
+ $posts = $wp_the_query->posts;
236
+ self::the_posts($posts);
237
+ }
238
+ }
239
+
240
+ // TODO put args into an array
241
+ public static function capture_crayons($wp_id, $wp_content, $extra_settings = array(), $args = array()) {
242
+ extract($args);
243
+ CrayonUtil::set_var($callback, NULL);
244
+ CrayonUtil::set_var($callback_extra_args, NULL);
245
+ CrayonUtil::set_var($ignore, TRUE);
246
+ CrayonUtil::set_var($preserve_atts, FALSE);
247
+ CrayonUtil::set_var($flags, NULL);
248
+ CrayonUtil::set_var($skip_setting_check, FALSE);
249
+ CrayonUtil::set_var($just_check, FALSE);
250
+
251
+ // Will contain captured crayons and altered $wp_content
252
+ $capture = array('capture' => array(), 'content' => $wp_content, 'has_captured' => FALSE);
253
+
254
+ // Do not apply Crayon for posts older than a certain date.
255
+ $disable_date = trim(CrayonGlobalSettings::val(CrayonSettings::DISABLE_DATE));
256
+ if ($disable_date && get_post_time('U', true, $wp_id) <= strtotime($disable_date)) {
257
+ return $capture;
258
+ }
259
+
260
+ // Flags for which Crayons to convert
261
+ $in_flag = self::in_flag($flags);
262
+
263
+ CrayonLog::debug('capture for id ' . $wp_id . ' len ' . strlen($wp_content));
264
+
265
+ // Convert <pre> tags to crayon tags, if needed
266
+ if ((CrayonGlobalSettings::val(CrayonSettings::CAPTURE_PRE) || $skip_setting_check) && $in_flag[CrayonSettings::CAPTURE_PRE]) {
267
+ // XXX This will fail if <pre></pre> is used inside another <pre></pre>
268
+ $wp_content = preg_replace_callback('#(?<!\$)<\s*pre(?=(?:([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*))?)([^>]*)>(.*?)<\s*/\s*pre\s*>#msi', 'CrayonWP::pre_tag', $wp_content);
269
+ }
270
+
271
+ // Convert mini [php][/php] tags to crayon tags, if needed
272
+ if ((CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::CAPTURE_MINI_TAG]) {
273
+ $wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)\](.*?)\[\s*/\s*(?:\1)\s*\](?!\$)#msi', '[crayon lang="\1" \2]\3[/crayon]', $wp_content);
274
+ $wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)/\s*\](?!\$)#msi', '[crayon lang="\1" \2 /]', $wp_content);
275
+ }
276
+
277
+ // Convert <code> to inline tags
278
+ if (CrayonGlobalSettings::val(CrayonSettings::CODE_TAG_CAPTURE)) {
279
+ $inline = CrayonGlobalSettings::val(CrayonSettings::CODE_TAG_CAPTURE_TYPE) === 0;
280
+ $inline_setting = $inline ? 'inline="true"' : '';
281
+ $wp_content = preg_replace('#<(\s*code\b)([^>]*)>(.*?)</\1[^>]*>#msi', '[crayon ' . $inline_setting . ' \2]\3[/crayon]', $wp_content);
282
+ }
283
+
284
+ if ((CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::INLINE_TAG]) {
285
+ if (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) {
286
+ // Convert inline {php}{/php} tags to crayon tags, if needed
287
+ $wp_content = preg_replace('#(?<!\$)\{\s*(' . self::$alias_regex . ')\b([^\}]*)\}(.*?)\{/(?:\1)\}(?!\$)#msi', '[crayon lang="\1" inline="true" \2]\3[/crayon]', $wp_content);
288
+ }
289
+ // Convert <span class="crayon-inline"> tags to inline crayon tags
290
+ $wp_content = preg_replace_callback('#(?<!\$)<\s*span([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*)>(.*?)<\s*/\s*span\s*>#msi', 'CrayonWP::span_tag', $wp_content);
291
+ }
292
+
293
+ // Convert [plain] tags into <pre><code></code></pre>, if needed
294
+ if ((CrayonGlobalSettings::val(CrayonSettings::PLAIN_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::PLAIN_TAG]) {
295
+ $wp_content = preg_replace_callback('#(?<!\$)\[\s*plain\s*\](.*?)\[\s*/\s*plain\s*\]#msi', 'CrayonFormatter::plain_code', $wp_content);
296
+ }
297
+
298
+ // Add IDs to the Crayons
299
+ CrayonLog::debug('capture adding id ' . $wp_id . ' , now has len ' . strlen($wp_content));
300
+ $wp_content = preg_replace_callback(self::REGEX_ID, 'CrayonWP::add_crayon_id', $wp_content);
301
+
302
+ CrayonLog::debug('capture added id ' . $wp_id . ' : ' . strlen($wp_content));
303
+
304
+ // Only include if a post exists with Crayon tag
305
+ preg_match_all(self::regex(), $wp_content, $matches);
306
+ $capture['has_captured'] = count($matches[0]) != 0;
307
+ if ($just_check) {
308
+ // Backticks are matched after other tags, so they need to be captured here.
309
+ $result = self::replace_backquotes($wp_content);
310
+ $wp_content = $result['content'];
311
+ $capture['has_captured'] = $capture['has_captured'] || $result['changed'];
312
+ $capture['content'] = $wp_content;
313
+ return $capture;
314
+ }
315
+
316
+ CrayonLog::debug('capture ignore for id ' . $wp_id . ' : ' . strlen($capture['content']) . ' vs ' . strlen($wp_content));
317
+
318
+ if ($capture['has_captured']) {
319
+
320
+ // Crayons found! Load settings first to ensure global settings loaded
321
+ CrayonSettingsWP::load_settings();
322
+
323
+ CrayonLog::debug('CAPTURED FOR ID ' . $wp_id);
324
+
325
+ $full_matches = $matches[0];
326
+ $closed_ids = $matches[1];
327
+ $closed_atts = $matches[2];
328
+ $open_ids = $matches[3];
329
+ $open_atts = $matches[4];
330
+ $contents = $matches[5];
331
+
332
+ // Make sure we enqueue the styles/scripts
333
+ $enqueue = TRUE;
334
+
335
+ for ($i = 0; $i < count($full_matches); $i++) {
336
+ // Get attributes
337
+ if (!empty($closed_atts[$i])) {
338
+ $atts = $closed_atts[$i];
339
+ } else if (!empty($open_atts[$i])) {
340
+ $atts = $open_atts[$i];
341
+ } else {
342
+ $atts = '';
343
+ }
344
+
345
+ // Capture attributes
346
+ preg_match_all('#([^="\'\s]+)[\t ]*=[\t ]*("|\')(.*?)\2#', $atts, $att_matches);
347
+ // Add extra attributes
348
+ $atts_array = $extra_settings;
349
+ if (count($att_matches[0]) != 0) {
350
+ for ($j = 0; $j < count($att_matches[1]); $j++) {
351
+ $atts_array[trim(strtolower($att_matches[1][$j]))] = trim($att_matches[3][$j]);
352
+ }
353
+ }
354
+
355
+ if (isset($atts_array[CrayonSettings::IGNORE]) && $atts_array[CrayonSettings::IGNORE]) {
356
+ // TODO(aramk) Revert to the original content.
357
+ continue;
358
+ }
359
+
360
+ // Capture theme
361
+ $theme_id = array_key_exists(CrayonSettings::THEME, $atts_array) ? $atts_array[CrayonSettings::THEME] : '';
362
+ $theme = CrayonResources::themes()->get($theme_id);
363
+ // If theme not found, use fallbacks
364
+ if (!$theme) {
365
+ // Given theme is invalid, try global setting
366
+ $theme_id = CrayonGlobalSettings::val(CrayonSettings::THEME);
367
+ $theme = CrayonResources::themes()->get($theme_id);
368
+ if (!$theme) {
369
+ // Global setting is invalid, fall back to default
370
+ $theme = CrayonResources::themes()->get_default();
371
+ $theme_id = CrayonThemes::DEFAULT_THEME;
372
+ }
373
+ }
374
+ // If theme is now valid, change the array
375
+ if ($theme) {
376
+ if (!$preserve_atts || isset($atts_array[CrayonSettings::THEME])) {
377
+ $atts_array[CrayonSettings::THEME] = $theme_id;
378
+ }
379
+ $theme->used(TRUE);
380
+ }
381
+
382
+ // Capture font
383
+ $font_id = array_key_exists(CrayonSettings::FONT, $atts_array) ? $atts_array[CrayonSettings::FONT] : '';
384
+ $font = CrayonResources::fonts()->get($font_id);
385
+ // If font not found, use fallbacks
386
+ if (!$font) {
387
+ // Given font is invalid, try global setting
388
+ $font_id = CrayonGlobalSettings::val(CrayonSettings::FONT);
389
+ $font = CrayonResources::fonts()->get($font_id);
390
+ if (!$font) {
391
+ // Global setting is invalid, fall back to default
392
+ $font = CrayonResources::fonts()->get_default();
393
+ $font_id = CrayonFonts::DEFAULT_FONT;
394
+ }
395
+ }
396
+
397
+ // If font is now valid, change the array
398
+ if ($font /* != NULL && $font_id != CrayonFonts::DEFAULT_FONT*/) {
399
+ if (!$preserve_atts || isset($atts_array[CrayonSettings::FONT])) {
400
+ $atts_array[CrayonSettings::FONT] = $font_id;
401
+ }
402
+ $font->used(TRUE);
403
+ }
404
+
405
+ // Add array of atts and content to post queue with key as post ID
406
+ // XXX If at this point no ID is added we have failed!
407
+ $id = !empty($open_ids[$i]) ? $open_ids[$i] : $closed_ids[$i];
408
+ //if ($ignore) {
409
+ $code = self::crayon_remove_ignore($contents[$i]);
410
+ //}
411
+ $c = array('post_id' => $wp_id, 'atts' => $atts_array, 'code' => $code);
412
+ $capture['capture'][$id] = $c;
413
+ CrayonLog::debug('capture finished for post id ' . $wp_id . ' crayon-id ' . $id . ' atts: ' . count($atts_array) . ' code: ' . strlen($code));
414
+ $is_inline = isset($atts_array['inline']) && CrayonUtil::str_to_bool($atts_array['inline'], FALSE) ? '-i' : '';
415
+ if ($callback === NULL) {
416
+ $wp_content = str_replace($full_matches[$i], '[crayon-' . $id . $is_inline . '/]', $wp_content);
417
+ } else {
418
+ $wp_content = call_user_func($callback, $c, $full_matches[$i], $id, $is_inline, $wp_content, $callback_extra_args);
419
+ }
420
+ }
421
+
422
+ }
423
+
424
+ if ($ignore) {
425
+ // We need to escape ignored Crayons, since they won't be captured
426
+ // XXX Do this after replacing the Crayon with the shorter ID tag, otherwise $full_matches will be different from $wp_content
427
+ $wp_content = self::crayon_remove_ignore($wp_content);
428
+ }
429
+
430
+ $result = self::replace_backquotes($wp_content);
431
+ $wp_content = $result['content'];
432
+
433
+ $capture['content'] = $wp_content;
434
+ return $capture;
435
+ }
436
+
437
+ public static function replace_backquotes($wp_content) {
438
+ // Convert `` backquote tags into <code></code>, if needed
439
+ // XXX Some code may contain `` so must do it after all Crayons are captured
440
+ $result = array();
441
+ $prev_count = strlen($wp_content);
442
+ if (CrayonGlobalSettings::val(CrayonSettings::BACKQUOTE)) {
443
+ $wp_content = preg_replace('#(?<!\\\\)`([^`]*)`#msi', '<code>$1</code>', $wp_content);
444
+ }
445
+ $result['changed'] = $prev_count !== strlen($wp_content);
446
+ $result['content'] = $wp_content;
447
+ return $result;
448
+ }
449
+
450
+ /* Search for Crayons in posts and queue them for creation */
451
+ public static function the_posts($posts) {
452
+ CrayonLog::debug('the_posts');
453
+
454
+ // Whether to enqueue syles/scripts
455
+ CrayonSettingsWP::load_settings(TRUE); // We will eventually need more than the settings
456
+
457
+ self::init_tags_regex();
458
+ $crayon_posts = CrayonSettingsWP::load_posts(); // Loads posts containing crayons
459
+
460
+ // Search for shortcode in posts
461
+ foreach ($posts as $post) {
462
+ $wp_id = $post->ID;
463
+ $is_page = $post->post_type == 'page';
464
+ if (!in_array($wp_id, $crayon_posts)) {
465
+ // If we get query for a page, then that page might have a template and load more posts containing Crayons
466
+ // By this state, we would be unable to enqueue anything (header already written).
467
+ if (CrayonGlobalSettings::val(CrayonSettings::SAFE_ENQUEUE) && $is_page) {
468
+ CrayonGlobalSettings::set(CrayonSettings::ENQUEUE_THEMES, false);
469
+ CrayonGlobalSettings::set(CrayonSettings::ENQUEUE_FONTS, false);
470
+ }
471
+ // Only include crayon posts
472
+ continue;
473
+ }
474
+
475
+ $id_str = strval($wp_id);
476
+
477
+ if (wp_is_post_revision($wp_id)) {
478
+ // Ignore post revisions, use the parent, which has the updated post content
479
+ continue;
480
+ }
481
+
482
+ if (isset(self::$post_captures[$id_str])) {
483
+ // Don't capture twice
484
+ // XXX post->post_content is reset each loop, replace content
485
+ // Doing this might cause content changed by other plugins between the last loop
486
+ // to fail, so be cautious
487
+ $post->post_content = self::$post_captures[$id_str];
488
+ continue;
489
+ }
490
+ // Capture post Crayons
491
+ $captures = self::capture_crayons(intval($post->ID), $post->post_content);
492
+
493
+ // XXX Careful not to undo changes by other plugins
494
+ // XXX Must replace to remove $ for ignored Crayons
495
+ $post->post_content = $captures['content'];
496
+ self::$post_captures[$id_str] = $captures['content'];
497
+ if ($captures['has_captured'] === TRUE) {
498
+ self::$post_queue[$id_str] = array();
499
+ foreach ($captures['capture'] as $capture_id => $capture_content) {
500
+ self::$post_queue[$id_str][$capture_id] = $capture_content;
501
+ }
502
+ }
503
+
504
+ // Search for shortcode in comments
505
+ if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
506
+ $comments = get_comments(array('post_id' => $post->ID));
507
+ foreach ($comments as $comment) {
508
+ $id_str = strval($comment->comment_ID);
509
+ if (isset(self::$comment_queue[$id_str])) {
510
+ // Don't capture twice
511
+ continue;
512
+ }
513
+ // Capture comment Crayons, decode their contents if decode not specified
514
+ $content = apply_filters('get_comment_text', $comment->comment_content, $comment);
515
+ $captures = self::capture_crayons($comment->comment_ID, $content, array(CrayonSettings::DECODE => TRUE));
516
+ self::$comment_captures[$id_str] = $captures['content'];
517
+ if ($captures['has_captured'] === TRUE) {
518
+ self::$comment_queue[$id_str] = array();
519
+ foreach ($captures['capture'] as $capture_id => $capture_content) {
520
+ self::$comment_queue[$id_str][$capture_id] = $capture_content;
521
+ }
522
+ }
523
+ }
524
+ }
525
+ }
526
+
527
+ return $posts;
528
+ }
529
+
530
+ private static function add_crayon_id($content) {
531
+ $uid = $content[0] . '-' . str_replace('.', '', uniqid('', true));
532
+ CrayonLog::debug('add_crayon_id ' . $uid);
533
+ return $uid;
534
+ }
535
+
536
+ private static function get_crayon_id() {
537
+ return self::$next_id++;
538
+ }
539
+
540
+ public static function enqueue_resources() {
541
+ if (!self::$enqueued) {
542
+
543
+ CrayonLog::debug('enqueue');
544
+ global $CRAYON_VERSION;
545
+ CrayonSettingsWP::load_settings(TRUE);
546
+ if (CRAYON_MINIFY) {
547
+ wp_enqueue_style('crayon', plugins_url(CRAYON_STYLE_MIN, __FILE__), array(), $CRAYON_VERSION);
548
+ wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS_MIN, __FILE__), array('jquery'), $CRAYON_VERSION, CrayonGlobalSettings::val(CrayonSettings::DELAY_LOAD_JS));
549
+ } else {
550
+ wp_enqueue_style('crayon_style', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
551
+ wp_enqueue_style('crayon_global_style', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
552
+ wp_enqueue_script('crayon_util_js', plugins_url(CRAYON_JS_UTIL, __FILE__), array('jquery'), $CRAYON_VERSION);
553
+ CrayonSettingsWP::other_scripts();
554
+ }
555
+ CrayonSettingsWP::init_js_settings();
556
+ self::$enqueued = TRUE;
557
+ }
558
+ }
559
+
560
+ private static function init_tags_regex($force = FALSE, $flags = NULL, &$tags_regex = NULL) {
561
+ CrayonSettingsWP::load_settings();
562
+ self::init_tag_bits();
563
+
564
+ // Default output
565
+ if ($tags_regex === NULL) {
566
+ $tags_regex = & self::$tags_regex;
567
+ }
568
+
569
+ if ($force || $tags_regex === "") {
570
+ // Check which tags are in $flags. If it's NULL, then all flags are true.
571
+ $in_flag = self::in_flag($flags);
572
+
573
+ if (($in_flag[CrayonSettings::CAPTURE_MINI_TAG] && (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG)) || $force) ||
574
+ ($in_flag[CrayonSettings::INLINE_TAG] && (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) && CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) || $force)
575
+ ) {
576
+ $aliases = CrayonResources::langs()->ids_and_aliases();
577
+ self::$alias_regex = '';
578
+ for ($i = 0; $i < count($aliases); $i++) {
579
+ $alias = $aliases[$i];
580
+ $alias_regex = CrayonUtil::esc_hash(CrayonUtil::esc_regex($alias));
581
+ if ($i != count($aliases) - 1) {
582
+ $alias_regex .= '|';
583
+ }
584
+ self::$alias_regex .= $alias_regex;
585
+ }
586
+ }
587
+
588
+ // Add other tags
589
+ $tags_regex = '#(?<!\$)(?:(\s*\[\s*crayon\b)';
590
+
591
+ // TODO this is duplicated in capture_crayons()
592
+ $tag_regexes = array(
593
+ CrayonSettings::CAPTURE_MINI_TAG => '(\[\s*(' . self::$alias_regex . ')\b)',
594
+ CrayonSettings::CAPTURE_PRE => '(<\s*pre\b)',
595
+ CrayonSettings::INLINE_TAG => '(' . self::REGEX_INLINE_CLASS . ')' . '|(\{\s*(' . self::$alias_regex . ')\b([^\}]*)\})',
596
+ CrayonSettings::PLAIN_TAG => '(\s*\[\s*plain\b)',
597
+ CrayonSettings::BACKQUOTE => '(`[^`]*`)'
598
+ );
599
+
600
+ foreach ($tag_regexes as $tag => $regex) {
601
+ if ($in_flag[$tag] && (CrayonGlobalSettings::val($tag) || $force)) {
602
+ $tags_regex .= '|' . $regex;
603
+ }
604
+ }
605
+ $tags_regex .= ')#msi';
606
+ }
607
+
608
+ }
609
+
610
+ private static function init_tag_bits() {
611
+ if (count(self::$tag_bits) == 0) {
612
+ $values = array();
613
+ for ($i = 0; $i < count(self::$tag_types); $i++) {
614
+ $j = pow(2, $i);
615
+ self::$tag_bits[self::$tag_types[$i]] = $j;
616
+ }
617
+ }
618
+ }
619
+
620
+ public static function tag_bit($tag) {
621
+ self::init_tag_bits();
622
+ if (isset(self::$tag_bits[$tag])) {
623
+ return self::$tag_bits[$tag];
624
+ } else {
625
+ return null;
626
+ }
627
+ }
628
+
629
+ public static function in_flag($flags) {
630
+ $in_flag = array();
631
+ foreach (self::$tag_types as $tag) {
632
+ $in_flag[$tag] = $flags === NULL || ($flags & self::tag_bit($tag)) > 0;
633
+ }
634
+ return $in_flag;
635
+ }
636
+
637
+ private static function init_legacy_tag_bits() {
638
+ if (self::$legacy_flags === NULL) {
639
+ self::$legacy_flags = self::tag_bit(CrayonSettings::CAPTURE_MINI_TAG) |
640
+ self::tag_bit(CrayonSettings::INLINE_TAG) |
641
+ self::tag_bit(CrayonSettings::PLAIN_TAG);
642
+ }
643
+ if (self::$tags_regex_legacy === "") {
644
+ self::init_tags_regex(TRUE, self::$legacy_flags, self::$tags_regex_legacy);
645
+ }
646
+ }
647
+
648
+ // Add Crayon into the_content
649
+ public static function the_content($the_content) {
650
+ CrayonLog::debug('the_content');
651
+
652
+ // Some themes make redundant queries and don't need extra work...
653
+ if (strlen($the_content) == 0) {
654
+ CrayonLog::debug('the_content blank');
655
+ return $the_content;
656
+ }
657
+
658
+ global $post;
659
+
660
+ // Go through queued posts and find crayons
661
+ $post_id = strval($post->ID);
662
+
663
+ if (self::$is_excerpt) {
664
+ CrayonLog::debug('excerpt');
665
+ if (CrayonGlobalSettings::val(CrayonSettings::EXCERPT_STRIP)) {
666
+ CrayonLog::debug('excerpt strip');
667
+ // Remove Crayon from content if we are displaying an excerpt
668
+ $the_content = preg_replace(self::REGEX_WITH_ID, '', $the_content);
669
+ }
670
+ // Otherwise Crayon remains with ID and replaced later
671
+ return $the_content;
672
+ }
673
+
674
+ // Find if this post has Crayons
675
+ if (array_key_exists($post_id, self::$post_queue)) {
676
+ self::enqueue_resources();
677
+
678
+ // XXX We want the plain post content, no formatting
679
+ $the_content_original = $the_content;
680
+
681
+ // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed
682
+ $the_content = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'CrayonWP::add_paragraphs', $the_content);
683
+ // Loop through Crayons
684
+ $post_in_queue = self::$post_queue[$post_id];
685
+
686
+ foreach ($post_in_queue as $id => $v) {
687
+ $atts = $v['atts'];
688
+ $content = $v['code']; // The code we replace post content with
689
+ $crayon = self::shortcode($atts, $content, $id);
690
+ if (is_feed()) {
691
+ // Convert the plain code to entities and put in a <pre></pre> tag
692
+ $crayon_formatted = CrayonFormatter::plain_code($crayon->code(), $crayon->setting_val(CrayonSettings::DECODE));
693
+ } else {
694
+ // Apply shortcode to the content
695
+ $crayon_formatted = $crayon->output(TRUE, FALSE);
696
+ }
697
+ // Replace the code with the Crayon
698
+ CrayonLog::debug('the_content: id ' . $post_id . ' has UID ' . $id . ' : ' . intval(stripos($the_content, $id) !== FALSE));
699
+ $the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count);
700
+ CrayonLog::debug('the_content: REPLACED for id ' . $post_id . ' from len ' . strlen($the_content_original) . ' to ' . strlen($the_content));
701
+ }
702
+ }
703
+
704
+ return $the_content;
705
+ }
706
+
707
+ public static function pre_comment_text($text) {
708
+ global $comment;
709
+ $comment_id = strval($comment->comment_ID);
710
+ if (array_key_exists($comment_id, self::$comment_captures)) {
711
+ // Replace with IDs now that we need to
712
+ $text = self::$comment_captures[$comment_id];
713
+ }
714
+ return $text;
715
+ }
716
+
717
+ public static function comment_text($text) {
718
+ global $comment;
719
+ $comment_id = strval($comment->comment_ID);
720
+ // Find if this post has Crayons
721
+ if (array_key_exists($comment_id, self::$comment_queue)) {
722
+ // XXX We want the plain post content, no formatting
723
+ $the_content_original = $text;
724
+ // Loop through Crayons
725
+ $post_in_queue = self::$comment_queue[$comment_id];
726
+
727
+ foreach ($post_in_queue as $id => $v) {
728
+ $atts = $v['atts'];
729
+ $content = $v['code']; // The code we replace post content with
730
+ $crayon = self::shortcode($atts, $content, $id);
731
+ $crayon_formatted = $crayon->output(TRUE, FALSE);
732
+ // Replacing may cause <p> tags to become disjoint with a <div> inside them, close and reopen them if needed
733
+ if (!$crayon->is_inline()) {
734
+ $text = preg_replace_callback('#' . self::REGEX_BETWEEN_PARAGRAPH_SIMPLE . '#msi', 'CrayonWP::add_paragraphs', $text);
735
+ }
736
+ // Replace the code with the Crayon
737
+ $text = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $text, 1, $text);
738
+ }
739
+ }
740
+ return $text;
741
+ }
742
+
743
+ public static function add_paragraphs($capture) {
744
+ if (count($capture) != 4) {
745
+ CrayonLog::debug('add_paragraphs: 0');
746
+ return $capture[0];
747
+ }
748
+ $capture[2] = preg_replace('#(?:<\s*br\s*/\s*>\s*)?(\[\s*crayon-\w+/\])(?:<\s*br\s*/\s*>\s*)?#msi', '</p>$1<p>', $capture[2]);
749
+ // If [crayon appears right after <p> then we will generate <p></p>, remove all these
750
+ $paras = $capture[1] . $capture[2] . $capture[3];
751
+ return $paras;
752
+ }
753
+
754
+ // Remove Crayons from the_excerpt
755
+ public static function the_excerpt($the_excerpt) {
756
+ CrayonLog::debug('excerpt');
757
+ global $post;
758
+ if (!empty($post->post_excerpt)) {
759
+ // Use custom excerpt if defined
760
+ $the_excerpt = wpautop($post->post_excerpt);
761
+ } else {
762
+ // Pass wp_trim_excerpt('') to gen from content (and remove [crayons])
763
+ $the_excerpt = wpautop(wp_trim_excerpt(''));
764
+ }
765
+ // XXX Returning "" may cause it to default to full contents...
766
+ return $the_excerpt . ' ';
767
+ }
768
+
769
+ // Used to capture pre and span tags which have settings in class attribute
770
+ public static function class_tag($matches) {
771
+ // If class exists, atts is not captured
772
+ $pre_class = $matches[1];
773
+ $quotes = $matches[2];
774
+ $class = $matches[3];
775
+ $post_class = $matches[4];
776
+ $atts = $matches[5];
777
+ $content = $matches[6];
778
+
779
+ // If we find a crayon=false in the attributes, or a crayon[:_]false in the class, then we should not capture
780
+ $ignore_regex_atts = '#crayon\s*=\s*(["\'])\s*(false|no|0)\s*\1#msi';
781
+ $ignore_regex_class = '#crayon\s*[:_]\s*(false|no|0)#msi';
782
+ if (preg_match($ignore_regex_atts, $atts) !== 0 ||
783
+ preg_match($ignore_regex_class, $class) !== 0
784
+ ) {
785
+ return $matches[0];
786
+ }
787
+
788
+ if (!empty($class)) {
789
+ if (preg_match('#\bignore\s*:\s*true#', $class)) {
790
+ // Prevent any changes if ignoring the tag.
791
+ return $matches[0];
792
+ }
793
+ // crayon-inline is turned into inline="1"
794
+ $class = preg_replace('#' . self::REGEX_INLINE_CLASS . '#mi', 'inline="1"', $class);
795
+ // "setting[:_]value" style settings in the class attribute
796
+ $class = preg_replace('#\b([A-Za-z-]+)[_:](\S+)#msi', '$1=' . $quotes . '$2' . $quotes, $class);
797
+ }
798
+
799
+ // data-url is turned into url=""
800
+ if (!empty($post_class)) {
801
+ $post_class = preg_replace('#\bdata-url\s*=#mi', 'url=', $post_class);
802
+ }
803
+ if (!empty($pre_class)) {
804
+ $pre_class = preg_replace('#\bdata-url\s*=#mi', 'url=', $post_class);
805
+ }
806
+
807
+ if (!empty($class)) {
808
+ return "[crayon $pre_class $class $post_class]{$content}[/crayon]";
809
+ } else {
810
+ return "[crayon $atts]{$content}[/crayon]";
811
+ }
812
+ }
813
+
814
+ // Capture span tag and extract settings from the class attribute, if present.
815
+ public static function span_tag($matches) {
816
+ // Only use <span> tags with crayon-inline class
817
+ if (preg_match('#' . self::REGEX_INLINE_CLASS . '#mi', $matches[3])) {
818
+ // no $atts
819
+ $matches[6] = $matches[5];
820
+ $matches[5] = '';
821
+ return self::class_tag($matches);
822
+ } else {
823
+ // Don't turn regular <span>s into Crayons
824
+ return $matches[0];
825
+ }
826
+ }
827
+
828
+ // Capture pre tag and extract settings from the class attribute, if present.
829
+ public static function pre_tag($matches) {
830
+ return self::class_tag($matches);
831
+ }
832
+
833
+ /**
834
+ * Check if the $ notation has been used to ignore [crayon] tags within posts and remove all matches
835
+ * Can also remove if used without $ as a regular crayon
836
+ *
837
+ * @depreciated
838
+ */
839
+ public static function crayon_remove_ignore($the_content, $ignore_flag = '$') {
840
+ if ($ignore_flag == FALSE) {
841
+ $ignore_flag = '';
842
+ }
843
+ $ignore_flag_regex = preg_quote($ignore_flag);
844
+
845
+ $the_content = preg_replace('#' . $ignore_flag_regex . '(\s*\[\s*crayon)#msi', '$1', $the_content);
846
+ $the_content = preg_replace('#(crayon\s*\])\s*\$#msi', '$1', $the_content);
847
+
848
+ if (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_PRE)) {
849
+ $the_content = str_ireplace(array($ignore_flag . '<pre', 'pre>' . $ignore_flag), array('<pre', 'pre>'), $the_content);
850
+ // Remove any <code> tags wrapping around the whole code, since we won't needed them
851
+ // XXX This causes <code> tags to be stripped in the post content! Disabled now.
852
+ // $the_content = preg_replace('#(^\s*<\s*code[^>]*>)|(<\s*/\s*code[^>]*>\s*$)#msi', '', $the_content);
853
+ }
854
+ if (CrayonGlobalSettings::val(CrayonSettings::PLAIN_TAG)) {
855
+ $the_content = str_ireplace(array($ignore_flag . '[plain', 'plain]' . $ignore_flag), array('[plain', 'plain]'), $the_content);
856
+ }
857
+ if (CrayonGlobalSettings::val(CrayonSettings::CAPTURE_MINI_TAG) ||
858
+ (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG && CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)))
859
+ ) {
860
+ self::init_tags_regex();
861
+ // $the_content = preg_replace('#'.$ignore_flag_regex.'\s*([\[\{])\s*('. self::$alias_regex .')#', '$1$2', $the_content);
862
+ // $the_content = preg_replace('#('. self::$alias_regex .')\s*([\]\}])\s*'.$ignore_flag_regex.'#', '$1$2', $the_content);
863
+ $the_content = preg_replace('#' . $ignore_flag_regex . '(\s*[\[\{]\s*(' . self::$alias_regex . ')[^\]]*[\]\}])#', '$1', $the_content);
864
+ }
865
+ if (CrayonGlobalSettings::val(CrayonSettings::BACKQUOTE)) {
866
+ $the_content = str_ireplace('\\`', '`', $the_content);
867
+ }
868
+ return $the_content;
869
+ }
870
+
871
+ public static function wp_head() {
872
+ CrayonLog::debug('head');
873
+
874
+ self::$wp_head = TRUE;
875
+ if (!self::$enqueued) {
876
+ CrayonLog::debug('head: missed enqueue');
877
+ // We have missed our chance to check before enqueuing. Use setting to either load always or only in the_post
878
+ CrayonSettingsWP::load_settings(TRUE); // Ensure settings are loaded
879
+ // If we need the tag editor loaded at all times, we must enqueue at all times
880
+ if (!CrayonGlobalSettings::val(CrayonSettings::EFFICIENT_ENQUEUE) || CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) {
881
+ CrayonLog::debug('head: force enqueue');
882
+ // Efficient enqueuing disabled, always load despite enqueuing or not in the_post
883
+ self::enqueue_resources();
884
+ }
885
+ }
886
+ // Enqueue Theme CSS
887
+ if (CrayonGlobalSettings::val(CrayonSettings::ENQUEUE_THEMES)) {
888
+ self::crayon_theme_css();
889
+ }
890
+ // Enqueue Font CSS
891
+ if (CrayonGlobalSettings::val(CrayonSettings::ENQUEUE_FONTS)) {
892
+ self::crayon_font_css();
893
+ }
894
+ }
895
+
896
+ public static function save_post($update_id, $post) {
897
+ self::refresh_post($post);
898
+ }
899
+
900
+ public static function filter_post_data($data, $postarr) {
901
+ // Remove the selected CSS that may be present from the tag editor.
902
+ CrayonTagEditorWP::init_settings();
903
+ $css_selected = CrayonTagEditorWP::$settings['css_selected'];
904
+ $data['post_content'] = preg_replace("#(class\s*=\s*(\\\\[\"'])[^\"']*)$css_selected([^\"']*\\2)#msi", '$1$3', $data['post_content']);
905
+ return $data;
906
+ }
907
+
908
+ public static function refresh_post($post, $refresh_legacy = TRUE, $save = TRUE) {
909
+ $postID = $post->ID;
910
+ if (wp_is_post_revision($postID)) {
911
+ // Ignore revisions
912
+ return;
913
+ }
914
+ if (CrayonWP::scan_post($post)) {
915
+ CrayonSettingsWP::add_post($postID, $save);
916
+ if ($refresh_legacy) {
917
+ if (self::scan_legacy_post($post)) {
918
+ CrayonSettingsWP::add_legacy_post($postID, $save);
919
+ } else {
920
+ CrayonSettingsWP::remove_legacy_post($postID, $save);
921
+ }
922
+ }
923
+ } else {
924
+ CrayonSettingsWP::remove_post($postID, $save);
925
+ CrayonSettingsWP::remove_legacy_post($postID, $save);
926
+ }
927
+ }
928
+
929
+ public static function refresh_posts() {
930
+ CrayonSettingsWP::remove_posts();
931
+ CrayonSettingsWP::remove_legacy_posts();
932
+ foreach (CrayonWP::get_posts() as $post) {
933
+ self::refresh_post($post, TRUE, FALSE);
934
+ }
935
+ CrayonSettingsWP::save_posts();
936
+ CrayonSettingsWP::save_legacy_posts();
937
+
938
+ }
939
+
940
+ public static function save_comment($id, $is_spam = NULL, $comment = NULL) {
941
+ self::init_tags_regex();
942
+ if ($comment === NULL) {
943
+ $comment = get_comment($id);
944
+ }
945
+ $content = $comment->comment_content;
946
+ $post_id = $comment->comment_post_ID;
947
+ $found = preg_match(self::$tags_regex, $content);
948
+ if ($found) {
949
+ CrayonSettingsWP::add_post($post_id);
950
+ }
951
+ return $found;
952
+ }
953
+
954
+ public static function crayon_theme_css() {
955
+ global $CRAYON_VERSION;
956
+ CrayonSettingsWP::load_settings();
957
+ $css = CrayonResources::themes()->get_used_css();
958
+ foreach ($css as $theme => $url) {
959
+ wp_enqueue_style('crayon-theme-' . $theme, $url, array(), $CRAYON_VERSION);
960
+ }
961
+ }
962
+
963
+ public static function crayon_font_css() {
964
+ global $CRAYON_VERSION;
965
+ CrayonSettingsWP::load_settings();
966
+ $css = CrayonResources::fonts()->get_used_css();
967
+ foreach ($css as $font_id => $url) {
968
+ wp_enqueue_style('crayon-font-' . $font_id, $url, array(), $CRAYON_VERSION);
969
+ }
970
+ }
971
+
972
+ public static function init($request) {
973
+ CrayonLog::debug('init');
974
+ crayon_load_plugin_textdomain();
975
+ }
976
+
977
+ public static function init_ajax() {
978
+ add_action('wp_ajax_crayon-tag-editor', 'CrayonTagEditorWP::content');
979
+ add_action('wp_ajax_nopriv_crayon-tag-editor', 'CrayonTagEditorWP::content');
980
+ add_action('wp_ajax_crayon-highlight', 'CrayonWP::ajax_highlight');
981
+ add_action('wp_ajax_nopriv_crayon-highlight', 'CrayonWP::ajax_highlight');
982
+ if (is_admin()) {
983
+ add_action('wp_ajax_crayon-ajax', 'CrayonWP::ajax');
984
+ add_action('wp_ajax_crayon-theme-editor', 'CrayonThemeEditorWP::content');
985
+ add_action('wp_ajax_crayon-theme-editor-save', 'CrayonThemeEditorWP::save');
986
+ add_action('wp_ajax_crayon-theme-editor-delete', 'CrayonThemeEditorWP::delete');
987
+ add_action('wp_ajax_crayon-theme-editor-duplicate', 'CrayonThemeEditorWP::duplicate');
988
+ add_action('wp_ajax_crayon-theme-editor-submit', 'CrayonThemeEditorWP::submit');
989
+ add_action('wp_ajax_crayon-show-posts', 'CrayonSettingsWP::show_posts');
990
+ add_action('wp_ajax_crayon-show-langs', 'CrayonSettingsWP::show_langs');
991
+ add_action('wp_ajax_crayon-show-preview', 'CrayonSettingsWP::show_preview');
992
+ }
993
+ }
994
+
995
+ public static function ajax() {
996
+ $allowed = array(CrayonSettings::HIDE_HELP);
997
+ foreach ($allowed as $allow) {
998
+ if (array_key_exists($allow, $_GET)) {
999
+ CrayonGlobalSettings::set($allow, $_GET[$allow]);
1000
+ CrayonSettingsWP::save_settings();
1001
+ }
1002
+ }
1003
+ }
1004
+
1005
+ public static function get_posts() {
1006
+ $query = new WP_Query(array('post_type' => 'any', 'suppress_filters' => TRUE, 'posts_per_page' => '-1'));
1007
+ if (isset($query->posts)) {
1008
+ return $query->posts;
1009
+ } else {
1010
+ return array();
1011
+ }
1012
+ }
1013
+
1014
+ /**
1015
+ * Return an array of post IDs where crayons occur.
1016
+ * Comments are ignored by default.
1017
+ */
1018
+ public static function scan_posts($check_comments = FALSE) {
1019
+ $crayon_posts = array();
1020
+ foreach (self::get_posts() as $post) {
1021
+ if (self::scan_post($post)) {
1022
+ $crayon_posts[] = $post->ID;
1023
+ }
1024
+ }
1025
+ return $crayon_posts;
1026
+ }
1027
+
1028
+ public static function scan_legacy_posts($init_regex = TRUE, $check_comments = FALSE) {
1029
+ if ($init_regex) {
1030
+ // We can skip this if needed
1031
+ self::init_tags_regex();
1032
+ }
1033
+ $crayon_posts = array();
1034
+ foreach (self::get_posts() as $post) {
1035
+ if (self::scan_legacy_post($post)) { // TODO this part is different
1036
+ $crayon_posts[] = $post->ID;
1037
+ }
1038
+ }
1039
+ return $crayon_posts;
1040
+ }
1041
+
1042
+ /**
1043
+ * Returns TRUE if a given post contains a Crayon tag
1044
+ */
1045
+ public static function scan_post($post, $scan_comments = TRUE, $flags = NULL) {
1046
+ if ($flags === NULL) {
1047
+ self::init_tags_regex(TRUE);
1048
+ }
1049
+
1050
+ $id = $post->ID;
1051
+
1052
+ $args = array(
1053
+ 'ignore' => FALSE,
1054
+ 'flags' => $flags,
1055
+ 'skip_setting_check' => TRUE,
1056
+ 'just_check' => TRUE
1057
+ );
1058
+ $captures = self::capture_crayons($id, $post->post_content, array(), $args);
1059
+
1060
+ if ($captures['has_captured']) {
1061
+ return TRUE;
1062
+ } else if ($scan_comments) {
1063
+ CrayonSettingsWP::load_settings(TRUE);
1064
+ if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1065
+ $comments = get_comments(array('post_id' => $id));
1066
+ foreach ($comments as $comment) {
1067
+ if (self::scan_comment($comment, $flags)) {
1068
+ return TRUE;
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ return FALSE;
1074
+ }
1075
+
1076
+ public static function scan_legacy_post($post, $scan_comments = TRUE) {
1077
+ self::init_legacy_tag_bits();
1078
+ return self::scan_post($post, $scan_comments, self::$legacy_flags);
1079
+ }
1080
+
1081
+ /**
1082
+ * Returns TRUE if the comment contains a Crayon tag
1083
+ */
1084
+ public static function scan_comment($comment, $flags = NULL) {
1085
+ if ($flags === NULL) {
1086
+ self::init_tags_regex();
1087
+ }
1088
+ $args = array(
1089
+ 'ignore' => FALSE,
1090
+ 'flags' => $flags,
1091
+ 'skip_setting_check' => TRUE,
1092
+ 'just_check' => TRUE
1093
+ );
1094
+ $content = apply_filters('get_comment_text', $comment->comment_content, $comment);
1095
+ $captures = self::capture_crayons($comment->comment_ID, $content, array(), $args);
1096
+ return $captures['has_captured'];
1097
+ }
1098
+
1099
+ public static function install() {
1100
+ self::refresh_posts();
1101
+ self::update();
1102
+ }
1103
+
1104
+ public static function uninstall() {
1105
+
1106
+ }
1107
+
1108
+ public static function update() {
1109
+ global $CRAYON_VERSION;
1110
+ CrayonSettingsWP::load_settings(TRUE);
1111
+ $settings = CrayonSettingsWP::get_settings();
1112
+ if ($settings === NULL || !isset($settings[CrayonSettings::VERSION])) {
1113
+ return;
1114
+ }
1115
+
1116
+ $version = $settings[CrayonSettings::VERSION];
1117
+
1118
+ // Only upgrade if the version differs
1119
+ if ($version != $CRAYON_VERSION) {
1120
+ $defaults = CrayonSettings::get_defaults_array();
1121
+ $touched = FALSE;
1122
+
1123
+ // Upgrade database and settings
1124
+
1125
+ if (CrayonUtil::version_compare($version, '1.7.21') < 0) {
1126
+ $settings[CrayonSettings::SCROLL] = $defaults[CrayonSettings::SCROLL];
1127
+ $touched = TRUE;
1128
+ }
1129
+
1130
+ if (CrayonUtil::version_compare($version, '1.7.23') < 0 && $settings[CrayonSettings::FONT] == 'theme-font') {
1131
+ $settings[CrayonSettings::FONT] = $defaults[CrayonSettings::FONT];
1132
+ $touched = TRUE;
1133
+ }
1134
+
1135
+ if (CrayonUtil::version_compare($version, '1.14') < 0) {
1136
+ CrayonLog::syslog("Updated to v1.14: Font size enabled");
1137
+ $settings[CrayonSettings::FONT_SIZE_ENABLE] = TRUE;
1138
+ }
1139
+
1140
+ if (CrayonUtil::version_compare($version, '1.17') < 0) {
1141
+ $settings[CrayonSettings::HIDE_HELP] = FALSE;
1142
+ }
1143
+
1144
+ // Save new version
1145
+ $settings[CrayonSettings::VERSION] = $CRAYON_VERSION;
1146
+ CrayonSettingsWP::save_settings($settings);
1147
+ CrayonLog::syslog("Updated from $version to $CRAYON_VERSION");
1148
+
1149
+ // Refresh to show new settings
1150
+ header('Location: ' . CrayonUtil::current_url());
1151
+ exit();
1152
+ }
1153
+ }
1154
+
1155
+ public static function basename() {
1156
+ return plugin_basename(__FILE__);
1157
+ }
1158
+
1159
+ // This should never be called through AJAX, only server side, since WP will not be loaded
1160
+ public static function wp_load_path() {
1161
+ if (defined('ABSPATH')) {
1162
+ return ABSPATH . 'wp-load.php';
1163
+ } else {
1164
+ CrayonLog::syslog('wp_load_path could not find value for ABSPATH');
1165
+ }
1166
+ }
1167
+
1168
+ public static function pre_excerpt($e) {
1169
+ CrayonLog::debug('pre_excerpt');
1170
+ self::$is_excerpt = TRUE;
1171
+ return $e;
1172
+ }
1173
+
1174
+ public static function post_excerpt($e) {
1175
+ CrayonLog::debug('post_excerpt');
1176
+ self::$is_excerpt = FALSE;
1177
+ $e = self::the_content($e);
1178
+ return $e;
1179
+ }
1180
+
1181
+ public static function post_get_excerpt($e) {
1182
+ CrayonLog::debug('post_get_excerpt');
1183
+ self::$is_excerpt = FALSE;
1184
+ return $e;
1185
+ }
1186
+
1187
+ /**
1188
+ * Converts Crayon tags found in WP to <pre> form.
1189
+ * XXX: This will alter blog content, so backup before calling.
1190
+ * XXX: Do NOT call this while updating posts or comments, it may cause an infinite loop or fail.
1191
+ * @param $encode Whether to detect missing "decode" attribute and encode html entities in the code.
1192
+ */
1193
+ public static function convert_tags($encode = FALSE) {
1194
+ $crayon_posts = CrayonSettingsWP::load_legacy_posts();
1195
+ if ($crayon_posts === NULL) {
1196
+ return;
1197
+ }
1198
+
1199
+ self::init_legacy_tag_bits();
1200
+ $args = array(
1201
+ 'callback' => 'CrayonWP::capture_replace_pre',
1202
+ 'callback_extra_args' => array('encode' => $encode),
1203
+ 'ignore' => FALSE,
1204
+ 'preserve_atts' => TRUE,
1205
+ 'flags' => self::$legacy_flags,
1206
+ 'skip_setting_check' => TRUE
1207
+ );
1208
+
1209
+ foreach ($crayon_posts as $postID) {
1210
+ $post = get_post($postID);
1211
+ $post_content = $post->post_content;
1212
+ $post_captures = self::capture_crayons($postID, $post_content, array(), $args);
1213
+
1214
+ if ($post_captures['has_captured'] === TRUE) {
1215
+ $post_obj = array();
1216
+ $post_obj['ID'] = $postID;
1217
+ $post_obj['post_content'] = addslashes($post_captures['content']);
1218
+ wp_update_post($post_obj);
1219
+ CrayonLog::syslog("Converted Crayons in post ID $postID to pre tags", 'CONVERT');
1220
+ }
1221
+
1222
+ if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1223
+ $comments = get_comments(array('post_id' => $postID));
1224
+ foreach ($comments as $comment) {
1225
+ $commentID = $comment->comment_ID;
1226
+ $comment_captures = self::capture_crayons($commentID, $comment->comment_content, array(CrayonSettings::DECODE => TRUE), $args);
1227
+
1228
+ if ($comment_captures['has_captured'] === TRUE) {
1229
+ $comment_obj = array();
1230
+ $comment_obj['comment_ID'] = $commentID;
1231
+ $comment_obj['comment_content'] = $comment_captures['content'];
1232
+ wp_update_comment($comment_obj);
1233
+ CrayonLog::syslog("Converted Crayons in post ID $postID, comment ID $commentID to pre tags", 'CONVERT');
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+
1239
+ self::refresh_posts();
1240
+ }
1241
+
1242
+ // Used as capture_crayons callback
1243
+ public static function capture_replace_pre($capture, $original, $id, $is_inline, $wp_content, $args = array()) {
1244
+ $code = $capture['code'];
1245
+ $oldAtts = $capture['atts'];
1246
+ $newAtts = array();
1247
+ $encode = isset($args['encode']) ? $args['encode'] : FALSE;
1248
+ if (!isset($oldAtts[CrayonSettings::DECODE]) && $encode) {
1249
+ // Encode the content, since no decode information exists.
1250
+ $code = CrayonUtil::htmlentities($code);
1251
+ }
1252
+ // We always set decode=1 irrespectively - so at this point the code is assumed to be encoded
1253
+ $oldAtts[CrayonSettings::DECODE] = TRUE;
1254
+ $newAtts['class'] = CrayonUtil::html_attributes($oldAtts, CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP), '');
1255
+ return str_replace($original, CrayonUtil::html_element('pre', $code, $newAtts), $wp_content);
1256
+ }
1257
+
1258
+ // Add TinyMCE to comments
1259
+ public static function tinymce_comment_enable($args) {
1260
+ if (function_exists('wp_editor')) {
1261
+ ob_start();
1262
+ wp_editor('', 'comment', array('tinymce'));
1263
+ $args['comment_field'] = ob_get_clean();
1264
+ }
1265
+ return $args;
1266
+ }
1267
+
1268
+ public static function allowed_tags() {
1269
+ global $allowedtags;
1270
+ $tags = array('pre', 'span', 'code');
1271
+ foreach ($tags as $tag) {
1272
+ $current_atts = isset($allowedtags[$tag]) ? $allowedtags[$tag] : array();
1273
+ // TODO data-url isn't recognised by WP
1274
+ $new_atts = array('class' => TRUE, 'title' => TRUE, 'data-url' => TRUE);
1275
+ $allowedtags[$tag] = array_merge($current_atts, $new_atts);
1276
+ }
1277
+ }
1278
+
1279
+ }
1280
+
1281
+ // Only if WP is loaded
1282
+ if (defined('ABSPATH')) {
1283
+ if (!is_admin()) {
1284
+ // Filters and Actions
1285
+
1286
+ add_filter('init', 'CrayonWP::init');
1287
+
1288
+ CrayonSettingsWP::load_settings(TRUE);
1289
+ if (CrayonGlobalSettings::val(CrayonSettings::MAIN_QUERY)) {
1290
+ add_action('wp', 'CrayonWP::wp', 100);
1291
+ } else {
1292
+ add_filter('the_posts', 'CrayonWP::the_posts', 100);
1293
+ }
1294
+
1295
+ // XXX Some themes like to play with the content, make sure we replace after they're done
1296
+ add_filter('the_content', 'CrayonWP::the_content', 100);
1297
+
1298
+ // Highlight bbPress content
1299
+ add_filter('bbp_get_reply_content', 'CrayonWP::highlight', 100);
1300
+ add_filter('bbp_get_topic_content', 'CrayonWP::highlight', 100);
1301
+ add_filter('bbp_get_forum_content', 'CrayonWP::highlight', 100);
1302
+ add_filter('bbp_get_topic_excerpt', 'CrayonWP::highlight', 100);
1303
+
1304
+ // Allow tags
1305
+ add_action('init', 'CrayonWP::allowed_tags', 11);
1306
+
1307
+ if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1308
+ /* XXX This is called first to match Crayons, then higher priority replaces after other filters.
1309
+ Prevents Crayon from being formatted by the filters, and also keeps original comment formatting. */
1310
+ add_filter('comment_text', 'CrayonWP::pre_comment_text', 1);
1311
+ add_filter('comment_text', 'CrayonWP::comment_text', 100);
1312
+ }
1313
+
1314
+ // This ensures Crayons are not formatted by WP filters. Other plugins should specify priorities between 1 and 100.
1315
+ add_filter('get_the_excerpt', 'CrayonWP::pre_excerpt', 1);
1316
+ add_filter('get_the_excerpt', 'CrayonWP::post_get_excerpt', 100);
1317
+ add_filter('the_excerpt', 'CrayonWP::post_excerpt', 100);
1318
+
1319
+ add_action('template_redirect', 'CrayonWP::wp_head', 0);
1320
+
1321
+ if (CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) {
1322
+ add_filter('comment_form_defaults', 'CrayonWP::tinymce_comment_enable');
1323
+ }
1324
+ } else {
1325
+ // Update between versions
1326
+ CrayonWP::update();
1327
+ // For marking a post as containing a Crayon
1328
+ add_action('update_post', 'CrayonWP::save_post', 10, 2);
1329
+ add_action('save_post', 'CrayonWP::save_post', 10, 2);
1330
+ add_filter('wp_insert_post_data', 'CrayonWP::filter_post_data', '99', 2);
1331
+ }
1332
+ register_activation_hook(__FILE__, 'CrayonWP::install');
1333
+ register_deactivation_hook(__FILE__, 'CrayonWP::uninstall');
1334
+ if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
1335
+ add_action('comment_post', 'CrayonWP::save_comment', 10, 2);
1336
+ add_action('edit_comment', 'CrayonWP::save_comment', 10, 2);
1337
+ }
1338
+ add_filter('init', 'CrayonWP::init_ajax');
1339
+ }
1340
+
1341
+ ?>
css/min/crayon.min.css CHANGED
@@ -1 +1 @@
1
- #colorbox.crayon-colorbox,#cboxOverlay.crayon-colorbox,.crayon-colorbox #cboxWrapper{position:absolute;top:0;left:0;z-index:9999;overflow:hidden}#cboxOverlay.crayon-colorbox{position:fixed;width:100%;height:100%}.crayon-colorbox #cboxMiddleLeft,.crayon-colorbox #cboxBottomLeft{clear:left}.crayon-colorbox #cboxContent{position:relative}.crayon-colorbox #cboxLoadedContent{overflow:auto;-webkit-overflow-scrolling:touch}.crayon-colorbox #cboxTitle{display:none!important}.crayon-colorbox #cboxLoadingOverlay,.crayon-colorbox #cboxLoadingGraphic{position:absolute;top:0;left:0;width:100%;height:100%}.crayon-colorbox #cboxPrevious,.crayon-colorbox #cboxNext,.crayon-colorbox #cboxClose,.crayon-colorbox #cboxSlideshow{cursor:pointer}.crayon-colorbox .cboxPhoto{float:left;margin:auto;border:0;display:block;max-width:none;-ms-interpolation-mode:bicubic}.crayon-colorbox .cboxIframe{width:100%;height:100%;display:block;border:0}#colorbox.crayon-colorbox,.crayon-colorbox #cboxContent,.crayon-colorbox #cboxLoadedContent{box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}#cboxOverlay.crayon-colorbox{background:#000}#colorbox.crayon-colorbox{outline:0}.crayon-colorbox #cboxContent{margin-top:20px;background:#000}.crayon-colorbox .cboxIframe{background:#fff}.crayon-colorbox #cboxError{padding:50px;border:1px solid #ccc}.crayon-colorbox #cboxLoadedContent{border:5px solid #000;background:#fff}.crayon-colorbox #cboxTitle{position:absolute;top:-20px;left:0;color:#ccc}.crayon-colorbox #cboxCurrent{position:absolute;top:-20px;right:0;color:#ccc}.crayon-colorbox #cboxPrevious,.crayon-colorbox #cboxNext,.crayon-colorbox #cboxSlideshow,.crayon-colorbox #cboxClose{border:0;padding:0;margin:0;overflow:visible;width:auto;background:0}.crayon-colorbox #cboxPrevious:active,.crayon-colorbox #cboxNext:active,.crayon-colorbox #cboxSlideshow:active,.crayon-colorbox #cboxClose:active{outline:0}.crayon-colorbox #cboxSlideshow{position:absolute;top:-20px;right:90px;color:#fff}.crayon-colorbox #cboxContent{margin-top:0}.crayon-colorbox #cboxLoadedContent{border:0}#crayon-main-wrap .form-table th{width:100px}#crayon-log{display:none;max-height:200px;border-color:#dfdfdf;background-color:white;border-width:1px;border-style:solid;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;margin:1px;padding:3px;overflow:auto;white-space:pre;margin-bottom:5px}.crayon-span,.crayon-span-5,.crayon-span-10,.crayon-span-50,.crayon-span-100,.crayon-span-110{line-height:24px;display:inline-block}.crayon-span-5{min-width:5px}.crayon-span-10{min-width:10px}.crayon-span-50{min-width:50px}.crayon-span-100{min-width:100px}.crayon-span-110{min-width:117px}.crayon-span-margin{margin-left:5px}#height_mode,#width_mode{min-width:65px}.crayon-error{color:#F00}.crayon-success{color:#00F}.crayon-warning{color:#ff8000}.crayon-help{min-height:30px;padding:5px 10px}.crayon-help .crayon-help-close,.crayon-help .crayon-help-close:active,.crayon-help .crayon-help-close:hover{text-decoration:none;float:right;color:#000}.crayon-help span,.crayon-help a{margin:0;padding:0;font-size:12px}#crayon-log-text{font:11px/13px Monaco,'MonacoRegular','Courier New',monospace}#crayon-log-controls{float:left;margin-right:5px}.crayon-table{font-size:12px;border:1px solid #999;padding:0;margin:0;margin-top:12px}.crayon-table td{vertical-align:top;border-bottom:1px solid #AAA;padding:0 6px;margin:0;background:#EEE}.crayon-table-light td{background:#f8f8f8}.crayon-table-header td{font-weight:bold;background:#CCC}.crayon-table-last td,.crayon-table tr:last-child td{border:0}#lang-info div{padding:5px 0}.crayon-table .not-parsed{color:#F00}.crayon-table .parsed-with-errors{color:#f90}.crayon-table .successfully-parsed{color:#77a000}#crayon-live-preview,#crayon-log-wrapper{padding:0;width:100%;float:left;clear:both}#crayon-live-preview{float:none;padding:0}#crayon-logo{text-align:center}#crayon-info,#crayon-info td{border:0;padding:0 5px;margin:0}.crayon-admin-button{display:inline-block;text-align:center}#crayon-subsection-langs-info{margin-top:5px}#crayon-theme-editor-admin-buttons{display:inline}#crayon-theme-editor-admin-buttons .crayon-admin-button{margin-left:5px}#crayon-theme-info{display:table;padding:0;margin:0;margin-top:5px}#crayon-theme-info>div{display:table-cell;vertical-align:middle}#crayon-theme-info .content *{float:left}#crayon-theme-info .field{font-weight:bold}#crayon-theme-info .field,#crayon-theme-info .value{margin-left:5px}#crayon-theme-info .description.value{font-style:italic;color:#999}#crayon-theme-info .type{text-align:center;min-width:120px;font-weight:bold;border-right:1px solid #ccc;padding-right:5px}#crayon-theme-info .type.stock{color:#666}#crayon-theme-info .type.user{color:#5b9a00}#crayon-editor-table td{vertical-align:top}.small-icon{width:24px;height:24px;display:inline-block;margin:5px 5px 0 0}#twitter-icon{background:url(../images/twitter.png)}#gmail-icon{background:url(../images/google.png)}#docs-icon{background:url(../images/docs.png)}#git-icon{background:url(../images/github.png)}#wp-icon{background:url(../images/wordpress-blue.png)}#donate-icon{background:url(../images/donate.png);width:75px}#crayon-donate,#crayon-donate input{margin:0;display:inline;padding:0}#crayon-theme-editor-info a{text-decoration:none!important;font-style:italic!important;color:#666!important}.note{font-style:italic;color:#999}#crayon-change-code-text{width:400px;height:300px}.crayon-syntax{overflow:hidden!important;position:relative!important;direction:ltr;text-align:left;box-sizing:border-box;direction:ltr!important;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-text-size-adjust:none}.crayon-syntax div{background:0;border:0;padding:0;margin:0;text-align:left}.crayon-syntax.crayon-loading{visibility:hidden}.crayon-syntax,.crayon-syntax .crayon-main,.crayon-syntax .crayon-toolbar,.crayon-syntax .crayon-info,.crayon-syntax .crayon-plain,.crayon-syntax .crayon-code{width:100%}.crayon-syntax .crayon-main,.crayon-syntax .crayon-plain{overflow:auto}.crayon-syntax,.crayon-syntax .crayon-main,.crayon-syntax .crayon-plain,.crayon-syntax .crayon-table{padding:0;margin:0}.crayon-syntax-inline{margin:0 2px;padding:0 2px}.crayon-syntax .crayon-table{border:none!important;background:none!important;padding:0!important;margin-top:0!important;margin-right:0!important;margin-bottom:0!important;width:auto!important;border-spacing:0!important;border-collapse:collapse!important}.crayon-syntax .crayon-table td,.crayon-syntax .crayon-table tr{padding:0!important;border:none!important;background:0;vertical-align:top!important;margin:0!important}.crayon-syntax .crayon-invisible{display:none!important}.crayon-plain-tag{margin-bottom:12px}.crayon-popup .crayon-plain{display:block!important;width:100%!important;height:100%!important;opacity:100!important;position:relative!important}.crayon-popup-window{background:#fff}.crayon-syntax .crayon-num{text-align:center;padding:0 5px;margin:0}.crayon-syntax .crayon-toolbar{position:relative;overflow:hidden;z-index:4}.crayon-syntax .crayon-info{position:absolute;overflow:hidden;display:none;z-index:3;padding:0;min-height:18px;line-height:18px}.crayon-syntax .crayon-info div{padding:2px!important;text-align:center}.crayon-syntax .crayon-toolbar span{padding:0 4px!important}.crayon-syntax .crayon-toolbar .crayon-button{display:inline;float:left!important;position:relative;width:24px;background-repeat:no-repeat;line-height:15px;border:0;text-decoration:none}.crayon-toolbar .crayon-button,.crayon-toolbar .crayon-button:hover,.crayon-toolbar .crayon-button.crayon-pressed:hover{background-position:0 center}.crayon-toolbar .crayon-button.crayon-pressed,.crayon-toolbar .crayon-button:active,.crayon-toolbar .crayon-button.crayon-pressed:active{background-position:-24px 0}.crayon-toolbar .crayon-button.crayon-popup-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed:hover .crayon-button-icon{background-position:0 0}.crayon-toolbar .crayon-button.crayon-copy-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -16px}.crayon-toolbar .crayon-button.crayon-nums-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -32px}.crayon-toolbar .crayon-button.crayon-plain-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -48px}.crayon-toolbar .crayon-button.crayon-mixed-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -64px}.crayon-toolbar .crayon-button.crayon-minimize .crayon-button-icon{background-position:0 -80px;background-color:transparent!important}.crayon-toolbar .crayon-button.crayon-expand-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -96px}.crayon-toolbar .crayon-button.crayon-wrap-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -112px}.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed:active .crayon-button-icon{background-position:-24px 0}.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -16px}.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -32px}.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -48px}.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -64px}.crayon-toolbar .crayon-button.crayon-minimize .crayon-button-icon{background-position:-24px -80px;background-color:transparent!important}.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -96px}.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -112px}.crayon-syntax .crayon-toolbar .crayon-language{padding-right:8px!important}.crayon-syntax .crayon-title,.crayon-syntax .crayon-language{float:left}.crayon-main::-webkit-scrollbar,.crayon-plain::-webkit-scrollbar{height:6px;overflow:visible;width:6px;background:#EEE}.crayon-main::-webkit-scrollbar-thumb,.crayon-plain::-webkit-scrollbar-thumb{background-color:#CCC;background-clip:padding-box;border:1px solid #AAA;box-shadow:inset 0 0 2px #999;min-height:8px;padding:0;border-width:1px}.crayon-main::-webkit-scrollbar-button,.crayon-plain::-webkit-scrollbar-button{height:0;width:0;padding:0}.crayon-main::-webkit-scrollbar-track,.crayon-plain::-webkit-scrollbar-track{background-clip:padding-box;border:solid transparent;border-width:0 0 0 4px;border:1px solid #BBB;border-right:0;border-bottom:0}.crayon-main::-webkit-scrollbar-corner,.crayon-plain::-webkit-scrollbar-corner{background:#EEE}.crayon-main::-webkit-scrollbar-thumb:hover,.crayon-plain::-webkit-scrollbar-thumb:hover{background:#AAA;border:1px solid #777;box-shadow:inset 0 0 2px #777}.crayon-syntax .crayon-pre,.crayon-syntax pre{color:#000;white-space:pre;margin:0;padding:0;overflow:visible;background:none!important;border:none!important;tab-size:4}.crayon-syntax .crayon-line{padding:0 5px}.crayon-syntax.crayon-wrapped .crayon-line{white-space:pre-wrap!important}.crayon-syntax-inline .crayon-pre,.crayon-syntax-inline pre{white-space:normal}.crayon-syntax-inline-nowrap .crayon-pre,.crayon-syntax-inline-nowrap pre{white-space:pre}.crayon-syntax{font-family:Monaco,'MonacoRegular','Courier New',monospace;font-weight:500}.crayon-table .crayon-nums-content{white-space:nowrap}.crayon-syntax.crayon-wrapped .crayon-line{height:auto}.crayon-syntax .crayon-num,.crayon-syntax .crayon-pre .crayon-line,.crayon-syntax .crayon-toolbar *,.crayon-syntax .crayon-pre *{font-family:inherit;font-size:inherit!important;line-height:inherit!important;font-weight:inherit!important;height:inherit}.crayon-syntax .crayon-toolbar .crayon-button .crayon-button-icon{background-image:url('../images/toolbar/buttons.png');height:16px!important;width:100%;position:absolute;left:0;top:50%;margin-top:-8px}.crayon-syntax .crayon-toolbar .crayon-tools{position:absolute;right:0}.crayon-syntax.crayon-expanded{position:absolute!important;margin:0!important}.crayon-syntax.crayon-expanded .crayon-main{overflow:hidden!important}.crayon-placeholder{width:100%!important}.crayon-toolbar-visible .crayon-toolbar{position:relative!important;margin-top:0!important;display:block!important}.crayon-syntax.crayon-expanded .crayon-toolbar .crayon-tools{position:relative;right:auto;float:left!important}.crayon-syntax .crayon-plain-wrap{height:auto!important;padding:0!important;margin:0!important}.crayon-syntax .crayon-plain{width:100%;height:100%;position:absolute;opacity:0;padding:0 5px;margin:0;border:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-shadow:none;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;white-space:pre;word-wrap:normal;overflow:auto;resize:none;color:#000;background:#FFF}.crayon-wrapped .crayon-plain{white-space:pre-wrap}.bbp-body .crayon-syntax{clear:none!important}.crayon-minimized .crayon-toolbar{cursor:pointer}.crayon-minimized .crayon-plain-wrap,.crayon-minimized .crayon-main,.crayon-minimized .crayon-toolbar .crayon-tools *{display:none!important}.crayon-minimized .crayon-toolbar .crayon-tools .crayon-minimize{display:block!important}.crayon-minimized .crayon-toolbar{position:relative!important}.crayon-syntax.crayon-minimized .crayon-toolbar{border-bottom:none!important}.crayon-te *,#crayon-te-bar-content{font-family:"Lucida Grande",Arial,sans-serif!important;font-size:12px}.crayon-te input[type="text"],.crayon-te textarea{background:#f9f9f9;border:1px solid #CCC;box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);padding:2px 4px;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid}.crayon-te #crayon-code{font-family:monospace!important}#crayon-te-content,#crayon-te-table{width:100%;height:auto!important}#crayon-range,#crayon-mark{width:100px}#crayon-te-table th,#crayon-te-table td{vertical-align:top;text-align:left}.rtl #crayon-te-table th,.rtl #crayon-te-table td{text-align:right}#crayon-te-table .crayon-tr-center td,#crayon-te-table .crayon-tr-center th{vertical-align:middle}#crayon-te-table .crayon-nowrap{white-space:nowrap}#crayon-te-bar{position:absolute;top:0;left:0;width:100%}#crayon-te-bar-content{border:1px solid #666;border-bottom:0;height:26px;line-height:25px;padding:0 8px;padding-right:0;background-color:#222;color:#cfcfcf}#crayon-te-bar-content a{line-height:25px;padding:5px 10px;color:#DDD;font-weight:bold;text-decoration:none!important}#crayon-te-bar-content a:hover{color:#FFF}.crayon-te-seperator{color:#666;margin:0;padding:0}#crayon-te-bar-block{height:34px;width:100%}#crayon-te-title{float:left}#crayon-te-controls{float:right}#crayon-url-th{vertical-align:top!important;padding-top:5px}.crayon-te-heading{font-size:14px;font-weight:bold}#crayon-te-settings-info{text-align:center}.crayon-te-section{font-weight:bold;padding:0 10px}#crayon-te-sub-section{margin-left:10px}#crayon-te-sub-section .crayon-te-section{font-weight:normal;padding:0}#crayon-code{height:200px;white-space:pre}#crayon-code,#crayon-url{width:555px!important}.crayon-disabled{background:#EEE!important}.qt_crayon_highlight{background-image:-ms-linear-gradient(bottom,#daf2ff,white)!important;background-image:-moz-linear-gradient(bottom,#daf2ff,white)!important;background-image:-o-linear-gradient(bottom,#daf2ff,white)!important;background-image:-webkit-linear-gradient(bottom,#daf2ff,white)!important;background-image:linear-gradient(bottom,#daf2ff,white)!important}.qt_crayon_highlight:hover{background:#ddebf2!important}.crayon-tag-editor-button-wrapper{display:inline-block}.mce_crayon_tinymce{padding:0!important;margin:2px 3px!important}.mce-i-crayon_tinymce,.mce_crayon_tinymce{background:url(../images/crayon_tinymce.png) 0 0!important}a.mce_crayon_tinymce{background-position:2px 0!important}.wp_themeSkin .mceButtonEnabled:hover span.mce_crayon_tinymce,.wp_themeSkin .mceButtonActive span.mce_crayon_tinymce{background-position:-20px 0}.wp_themeSkin span.mce_crayon_tinymce{background:none!important}#crayon-te-table{margin-top:26px;padding:10px;border-collapse:separate!important;border-spacing:2px!important}#crayon-te-table th{width:100px}#crayon-te-clear{margin-left:10px;color:#666;background-color:#f4f4f4;border:1px solid #CCC;border-radius:3px;margin-left:8px}#crayon-title{width:360px}#TB_window.crayon-te-ajax{overflow:auto!important}#TB_window.crayon-te-ajax,#TB_window.crayon-te-ajax #TB_ajaxContent,#TB_window.crayon-te-ajax #TB_title{width:680px!important}#TB_window.crayon-te-ajax #TB_ajaxContent{padding:0!important;margin:0!important;width:100%!important;height:auto!important;margin-top:28px!important}#TB_window.crayon-te-ajax #TB_title{position:fixed!important}#TB_window.crayon-te-ajax #TB_title .crayon-te-submit{margin-top:3px!important;float:right!important}#TB_window.crayon-te-ajax a{color:#2587e2;text-decoration:none}#TB_window.crayon-te-ajax a:hover{color:#499ce9}.crayon-te-quote{background:#DDD;padding:0 2px}#crayon-te-submit-wrapper{display:none}#crayon-te-clear{display:none;margin:0;margin-top:10px}.crayon-syntax-pre{background:red;white-space:pre;overflow:auto;display:block;word-wrap:break-word}.crayon-question{padding:1px 4px!important;text-decoration:none!important;color:#83b3cb!important;border-radius:10px!important;height:15px!important;width:15px!important}.crayon-question:hover{background:#83b3cb!important;color:white!important;height:15px!important;width:15px!important}.crayon-setting-changed,.crayon-setting-selected{background:#fffaad!important}.crayon-question:hover{color:white;background:#a6d6ef}#crayon-te-warning{display:none}.crayon-te-info{padding:5px!important;margin:2px 0!important}#crayon-te-submit{margin-bottom:5px}
1
+ #colorbox.crayon-colorbox,#cboxOverlay.crayon-colorbox,.crayon-colorbox #cboxWrapper{position:absolute;top:0;left:0;z-index:9999;overflow:hidden}#cboxOverlay.crayon-colorbox{position:fixed;width:100%;height:100%}.crayon-colorbox #cboxMiddleLeft,.crayon-colorbox #cboxBottomLeft{clear:left}.crayon-colorbox #cboxContent{position:relative}.crayon-colorbox #cboxLoadedContent{overflow:auto;-webkit-overflow-scrolling:touch}.crayon-colorbox #cboxTitle{display:none!important}.crayon-colorbox #cboxLoadingOverlay,.crayon-colorbox #cboxLoadingGraphic{position:absolute;top:0;left:0;width:100%;height:100%}.crayon-colorbox #cboxPrevious,.crayon-colorbox #cboxNext,.crayon-colorbox #cboxClose,.crayon-colorbox #cboxSlideshow{cursor:pointer}.crayon-colorbox .cboxPhoto{float:left;margin:auto;border:0;display:block;max-width:none;-ms-interpolation-mode:bicubic}.crayon-colorbox .cboxIframe{width:100%;height:100%;display:block;border:0}#colorbox.crayon-colorbox,.crayon-colorbox #cboxContent,.crayon-colorbox #cboxLoadedContent{box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box}#cboxOverlay.crayon-colorbox{background:#000}#colorbox.crayon-colorbox{outline:0}.crayon-colorbox #cboxContent{margin-top:20px;background:#000}.crayon-colorbox .cboxIframe{background:#fff}.crayon-colorbox #cboxError{padding:50px;border:1px solid #ccc}.crayon-colorbox #cboxLoadedContent{border:5px solid #000;background:#fff}.crayon-colorbox #cboxTitle{position:absolute;top:-20px;left:0;color:#ccc}.crayon-colorbox #cboxCurrent{position:absolute;top:-20px;right:0;color:#ccc}.crayon-colorbox #cboxPrevious,.crayon-colorbox #cboxNext,.crayon-colorbox #cboxSlideshow,.crayon-colorbox #cboxClose{border:0;padding:0;margin:0;overflow:visible;width:auto;background:0}.crayon-colorbox #cboxPrevious:active,.crayon-colorbox #cboxNext:active,.crayon-colorbox #cboxSlideshow:active,.crayon-colorbox #cboxClose:active{outline:0}.crayon-colorbox #cboxSlideshow{position:absolute;top:-20px;right:90px;color:#fff}.crayon-colorbox #cboxContent{margin-top:0}.crayon-colorbox #cboxLoadedContent{border:0}#crayon-main-wrap .form-table th{width:100px}#crayon-log{display:none;max-height:200px;border-color:#dfdfdf;background-color:white;border-width:1px;border-style:solid;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;margin:1px;padding:3px;overflow:auto;white-space:pre;margin-bottom:5px}.crayon-span,.crayon-span-5,.crayon-span-10,.crayon-span-50,.crayon-span-100,.crayon-span-110{line-height:24px;display:inline-block}.crayon-span-5{min-width:5px}.crayon-span-10{min-width:10px}.crayon-span-50{min-width:50px}.crayon-span-100{min-width:100px}.crayon-span-110{min-width:117px}.crayon-span-margin{margin-left:5px}#height_mode,#width_mode{min-width:65px}.crayon-error{color:#F00}.crayon-success{color:#00F}.crayon-warning{color:#ff8000}.crayon-help{min-height:30px;padding:5px 10px}.crayon-help .crayon-help-close,.crayon-help .crayon-help-close:active,.crayon-help .crayon-help-close:hover{text-decoration:none;float:right;color:#000}.crayon-help span,.crayon-help a{margin:0;padding:0;font-size:12px}#crayon-log-text{font:11px/13px Monaco,'MonacoRegular','Courier New',monospace}#crayon-log-controls{float:left;margin-right:5px}.crayon-table{font-size:12px;border:1px solid #999;padding:0;margin:0;margin-top:12px}.crayon-table td{vertical-align:top;border-bottom:1px solid #AAA;padding:0 6px;margin:0;background:#EEE}.crayon-table-light td{background:#f8f8f8}.crayon-table-header td{font-weight:bold;background:#CCC}.crayon-table-last td,.crayon-table tr:last-child td{border:0}#lang-info div{padding:5px 0}.crayon-table .not-parsed{color:#F00}.crayon-table .parsed-with-errors{color:#f90}.crayon-table .successfully-parsed{color:#77a000}#crayon-live-preview,#crayon-log-wrapper{padding:0;width:100%;float:left;clear:both}#crayon-live-preview{float:none;padding:0}#crayon-logo{text-align:center}#crayon-info,#crayon-info td{border:0;padding:0 5px;margin:0}.crayon-admin-button{display:inline-block;text-align:center}#crayon-subsection-langs-info{margin-top:5px}#crayon-theme-editor-admin-buttons{display:inline}#crayon-theme-editor-admin-buttons .crayon-admin-button{margin-left:5px}#crayon-theme-info{display:table;padding:0;margin:0;margin-top:5px}#crayon-theme-info>div{display:table-cell;vertical-align:middle}#crayon-theme-info .content *{float:left}#crayon-theme-info .field{font-weight:bold}#crayon-theme-info .field,#crayon-theme-info .value{margin-left:5px}#crayon-theme-info .description.value{font-style:italic;color:#999}#crayon-theme-info .type{text-align:center;min-width:120px;font-weight:bold;border-right:1px solid #ccc;padding-right:5px}#crayon-theme-info .type.stock{color:#666}#crayon-theme-info .type.user{color:#5b9a00}#crayon-editor-table td{vertical-align:top}.small-icon{width:24px;height:24px;display:inline-block;margin:5px 5px 0 0}#twitter-icon{background:url(../images/twitter.png)}#gmail-icon{background:url(../images/google.png)}#docs-icon{background:url(../images/docs.png)}#git-icon{background:url(../images/github.png)}#wp-icon{background:url(../images/wordpress-blue.png)}#donate-icon{background:url(../images/donate.png);width:75px}#crayon-donate,#crayon-donate input{margin:0;display:inline;padding:0}#crayon-theme-editor-info a{text-decoration:none!important;font-style:italic!important;color:#666!important}#crayon-main-wrap .form-table .note{font-style:italic;color:#999}#crayon-change-code-text{width:400px;height:300px}.crayon-syntax{overflow:hidden!important;position:relative!important;direction:ltr;text-align:left;box-sizing:border-box;direction:ltr!important;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-text-size-adjust:none}.crayon-syntax div{background:0;border:0;padding:0;margin:0;text-align:left}.crayon-syntax.crayon-loading{visibility:hidden}.crayon-syntax,.crayon-syntax .crayon-main,.crayon-syntax .crayon-toolbar,.crayon-syntax .crayon-info,.crayon-syntax .crayon-plain,.crayon-syntax .crayon-code{width:100%}.crayon-syntax .crayon-main,.crayon-syntax .crayon-plain{overflow:auto}.crayon-syntax,.crayon-syntax .crayon-main,.crayon-syntax .crayon-plain,.crayon-syntax .crayon-table{padding:0;margin:0}.crayon-syntax-inline{margin:0 2px;padding:0 2px}.crayon-syntax .crayon-table{border:none!important;background:none!important;padding:0!important;margin-top:0!important;margin-right:0!important;margin-bottom:0!important;width:auto!important;border-spacing:0!important;border-collapse:collapse!important;table-layout:auto!important}.crayon-syntax .crayon-table td,.crayon-syntax .crayon-table tr{padding:0!important;border:none!important;background:0;vertical-align:top!important;margin:0!important}.crayon-syntax .crayon-invisible{display:none!important}.crayon-plain-tag{margin-bottom:12px}.crayon-popup .crayon-plain{display:block!important;width:100%!important;height:100%!important;opacity:100!important;position:relative!important}.crayon-popup-window{background:#fff}.crayon-syntax .crayon-num{text-align:center;padding:0 5px;margin:0}.crayon-syntax .crayon-toolbar{position:relative;overflow:hidden;z-index:4}.crayon-syntax .crayon-info{position:absolute;overflow:hidden;display:none;z-index:3;padding:0;min-height:18px;line-height:18px}.crayon-syntax .crayon-info div{padding:2px!important;text-align:center}.crayon-syntax .crayon-toolbar span{padding:0 4px!important}.crayon-syntax .crayon-toolbar .crayon-button{display:inline;float:left!important;position:relative;width:24px;background-repeat:no-repeat;line-height:15px;border:0;text-decoration:none}.crayon-toolbar .crayon-button,.crayon-toolbar .crayon-button:hover,.crayon-toolbar .crayon-button.crayon-pressed:hover{background-position:0 center}.crayon-toolbar .crayon-button.crayon-pressed,.crayon-toolbar .crayon-button:active,.crayon-toolbar .crayon-button.crayon-pressed:active{background-position:-24px 0}.crayon-toolbar .crayon-button.crayon-popup-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed:hover .crayon-button-icon{background-position:0 0}.crayon-toolbar .crayon-button.crayon-copy-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -16px}.crayon-toolbar .crayon-button.crayon-nums-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -32px}.crayon-toolbar .crayon-button.crayon-plain-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -48px}.crayon-toolbar .crayon-button.crayon-mixed-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -64px}.crayon-toolbar .crayon-button.crayon-minimize .crayon-button-icon{background-position:0 -80px;background-color:transparent!important}.crayon-toolbar .crayon-button.crayon-expand-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -96px}.crayon-toolbar .crayon-button.crayon-wrap-button .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button:hover .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed:hover .crayon-button-icon{background-position:0 -112px}.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-popup-button.crayon-pressed:active .crayon-button-icon{background-position:-24px 0}.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-copy-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -16px}.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-nums-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -32px}.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-plain-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -48px}.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-mixed-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -64px}.crayon-toolbar .crayon-button.crayon-minimize .crayon-button-icon{background-position:-24px -80px;background-color:transparent!important}.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-expand-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -96px}.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button:active .crayon-button-icon,.crayon-toolbar .crayon-button.crayon-wrap-button.crayon-pressed:active .crayon-button-icon{background-position:-24px -112px}.crayon-syntax .crayon-toolbar .crayon-language{padding-right:8px!important}.crayon-syntax .crayon-title,.crayon-syntax .crayon-language{float:left}.crayon-main::-webkit-scrollbar,.crayon-plain::-webkit-scrollbar{height:6px;overflow:visible;width:6px;background:#EEE}.crayon-main::-webkit-scrollbar-thumb,.crayon-plain::-webkit-scrollbar-thumb{background-color:#CCC;background-clip:padding-box;border:1px solid #AAA;box-shadow:inset 0 0 2px #999;min-height:8px;padding:0;border-width:1px}.crayon-main::-webkit-scrollbar-button,.crayon-plain::-webkit-scrollbar-button{height:0;width:0;padding:0}.crayon-main::-webkit-scrollbar-track,.crayon-plain::-webkit-scrollbar-track{background-clip:padding-box;border:solid transparent;border-width:0 0 0 4px;border:1px solid #BBB;border-right:0;border-bottom:0}.crayon-main::-webkit-scrollbar-corner,.crayon-plain::-webkit-scrollbar-corner{background:#EEE}.crayon-main::-webkit-scrollbar-thumb:hover,.crayon-plain::-webkit-scrollbar-thumb:hover{background:#AAA;border:1px solid #777;box-shadow:inset 0 0 2px #777}.crayon-syntax .crayon-pre,.crayon-syntax pre{color:#000;white-space:pre;margin:0;padding:0;overflow:visible;background:none!important;border:none!important;tab-size:4}.crayon-syntax .crayon-line{padding:0 5px}.crayon-syntax.crayon-wrapped .crayon-line{white-space:pre-wrap!important;height:auto;word-break:break-all}.crayon-syntax-inline .crayon-pre,.crayon-syntax-inline pre{white-space:normal}.crayon-syntax-inline-nowrap .crayon-pre,.crayon-syntax-inline-nowrap pre{white-space:pre}.crayon-syntax{font-family:Monaco,'MonacoRegular','Courier New',monospace;font-weight:500}.crayon-syntax .crayon-toolbar *::selection,.crayon-syntax .crayon-nums *::selection{background:transparent}.crayon-table .crayon-nums-content{white-space:nowrap}.crayon-syntax .crayon-num,.crayon-syntax .crayon-pre .crayon-line,.crayon-syntax .crayon-toolbar *,.crayon-syntax .crayon-pre *{font-family:inherit;font-size:inherit!important;line-height:inherit!important;font-weight:inherit!important;height:inherit}.crayon-syntax .crayon-toolbar .crayon-button .crayon-button-icon{background-image:url('../images/toolbar/buttons.png');height:16px!important;width:100%;position:absolute;left:0;top:50%;margin-top:-8px}.crayon-syntax .crayon-toolbar .crayon-tools{position:absolute;right:0}.crayon-syntax.crayon-expanded{position:absolute!important;margin:0!important}.crayon-syntax.crayon-expanded .crayon-main{overflow:hidden!important}.crayon-placeholder{width:100%!important}.crayon-toolbar-visible .crayon-toolbar{position:relative!important;margin-top:0!important;display:block!important}.crayon-syntax.crayon-expanded .crayon-toolbar .crayon-tools{position:relative;right:auto;float:left!important}.crayon-syntax .crayon-plain-wrap{height:auto!important;padding:0!important;margin:0!important}.crayon-syntax .crayon-plain{width:100%;height:100%;position:absolute;opacity:0;padding:0 5px;margin:0;border:0;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-shadow:none;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;white-space:pre;word-wrap:normal;overflow:auto;resize:none;color:#000;background:#FFF}.crayon-wrapped .crayon-plain{white-space:pre-wrap}.bbp-body .crayon-syntax{clear:none!important}.crayon-minimized .crayon-toolbar{cursor:pointer}.crayon-minimized .crayon-plain-wrap,.crayon-minimized .crayon-main,.crayon-minimized .crayon-toolbar .crayon-tools *{display:none!important}.crayon-minimized .crayon-toolbar .crayon-tools .crayon-minimize{display:block!important}.crayon-minimized .crayon-toolbar{position:relative!important}.crayon-syntax.crayon-minimized .crayon-toolbar{border-bottom:none!important}.crayon-te *,#crayon-te-bar-content{font-family:"Lucida Grande",Arial,sans-serif!important;font-size:12px}.crayon-te input[type="text"],.crayon-te textarea{background:#f9f9f9;border:1px solid #CCC;box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:inset 1px 1px 1px rgba(0,0,0,0.1);padding:2px 4px;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid}.crayon-te #crayon-code{font-family:monospace!important}#crayon-te-content,#crayon-te-table{width:100%;height:auto!important}#crayon-range,#crayon-mark{width:100px}#crayon-te-table th,#crayon-te-table td{vertical-align:top;text-align:left}.rtl #crayon-te-table th,.rtl #crayon-te-table td{text-align:right}#crayon-te-table .crayon-tr-center td,#crayon-te-table .crayon-tr-center th{vertical-align:middle}#crayon-te-table .crayon-nowrap{white-space:nowrap}#crayon-te-bar{position:absolute;top:0;left:0;width:100%}#crayon-te-bar-content{border:1px solid #666;border-bottom:0;height:26px;line-height:25px;padding:0 8px;padding-right:0;background-color:#222;color:#cfcfcf}#crayon-te-bar-content a{line-height:25px;padding:5px 10px;color:#DDD;font-weight:bold;text-decoration:none!important}#crayon-te-bar-content a:hover{color:#FFF}.crayon-te-seperator{color:#666;margin:0;padding:0}#crayon-te-bar-block{height:34px;width:100%}#crayon-te-title{float:left}#crayon-te-controls{float:right}#crayon-url-th{vertical-align:top!important;padding-top:5px}.crayon-te-heading{font-size:14px;font-weight:bold}#crayon-te-settings-info{text-align:center}.crayon-te-section{font-weight:bold;padding:0 10px}#crayon-te-sub-section{margin-left:10px}#crayon-te-sub-section .crayon-te-section{font-weight:normal;padding:0}#crayon-code{height:200px;white-space:pre}#crayon-code,#crayon-url{width:555px!important}.crayon-disabled{background:#EEE!important}.qt_crayon_highlight{background-image:-ms-linear-gradient(bottom,#daf2ff,white)!important;background-image:-moz-linear-gradient(bottom,#daf2ff,white)!important;background-image:-o-linear-gradient(bottom,#daf2ff,white)!important;background-image:-webkit-linear-gradient(bottom,#daf2ff,white)!important;background-image:linear-gradient(bottom,#daf2ff,white)!important}.qt_crayon_highlight:hover{background:#ddebf2!important}.crayon-tag-editor-button-wrapper{display:inline-block}.mce_crayon_tinymce{padding:0!important;margin:2px 3px!important}.mce-i-crayon_tinymce,.mce_crayon_tinymce{background:url(../images/crayon_tinymce.png) 0 0!important}a.mce_crayon_tinymce{background-position:2px 0!important}.wp_themeSkin .mceButtonEnabled:hover span.mce_crayon_tinymce,.wp_themeSkin .mceButtonActive span.mce_crayon_tinymce{background-position:-20px 0}.wp_themeSkin span.mce_crayon_tinymce{background:none!important}#crayon-te-table{margin-top:26px;padding:10px;border-collapse:separate!important;border-spacing:2px!important}#crayon-te-table th{width:100px}#crayon-te-clear{margin-left:10px;color:#666;background-color:#f4f4f4;border:1px solid #CCC;border-radius:3px;margin-left:8px}#crayon-title{width:360px}#TB_window.crayon-te-ajax{overflow:auto!important}#TB_window.crayon-te-ajax,#TB_window.crayon-te-ajax #TB_ajaxContent,#TB_window.crayon-te-ajax #TB_title{width:680px!important}#TB_window.crayon-te-ajax #TB_ajaxContent{padding:0!important;margin:0!important;width:100%!important;height:auto!important;margin-top:28px!important}#TB_window.crayon-te-ajax #TB_title{position:fixed!important}#TB_window.crayon-te-ajax #TB_title .crayon-te-submit{margin-top:3px!important;float:right!important}#TB_window.crayon-te-ajax a{color:#2587e2;text-decoration:none}#TB_window.crayon-te-ajax a:hover{color:#499ce9}.crayon-te-quote{background:#DDD;padding:0 2px}#crayon-te-submit-wrapper{display:none}#crayon-te-clear{display:none;margin:0;margin-top:10px}.crayon-syntax-pre{background:red;white-space:pre;overflow:auto;display:block;word-wrap:break-word}.crayon-question{padding:1px 4px!important;text-decoration:none!important;color:#83b3cb!important;border-radius:10px!important;height:15px!important;width:15px!important}.crayon-question:hover{background:#83b3cb!important;color:white!important;height:15px!important;width:15px!important}.crayon-setting-changed,.crayon-setting-selected{background:#fffaad!important}.crayon-question:hover{color:white;background:#a6d6ef}#crayon-te-warning{display:none}.crayon-te-info{padding:5px!important;margin:2px 0!important}#crayon-te-submit{margin-bottom:5px}
css/src/admin_style.css CHANGED
@@ -274,7 +274,7 @@
274
  color: #666 !important;
275
  }
276
 
277
- .note {
278
  font-style: italic;
279
  color: #999;
280
  }
274
  color: #666 !important;
275
  }
276
 
277
+ #crayon-main-wrap .form-table .note {
278
  font-style: italic;
279
  color: #999;
280
  }
css/src/crayon_style.css CHANGED
@@ -77,6 +77,7 @@ coloring etc.
77
  width: auto !important;
78
  border-spacing: 0 !important;
79
  border-collapse: collapse !important;
 
80
  }
81
 
82
  .crayon-syntax .crayon-table td,
@@ -151,9 +152,9 @@ coloring etc.
151
 
152
  /*.crayon-syntax .crayon-toolbar,*/
153
  /*.crayon-syntax .crayon-toolbar * {*/
154
- /*height: 18px;*/
155
- /*line-height: 18px;*/
156
- /*padding: 0px;*/
157
  /*}*/
158
 
159
  .crayon-syntax .crayon-toolbar span {
@@ -368,6 +369,8 @@ coloring etc.
368
  /* width: 500px !important; */
369
  white-space: pre-wrap !important;
370
  /* word-wrap:break-word !important;*/
 
 
371
  }
372
 
373
  .crayon-syntax-inline .crayon-pre,
@@ -388,6 +391,11 @@ coloring etc.
388
  font-weight: 500;
389
  }
390
 
 
 
 
 
 
391
  /*
392
 
393
  This has been disabled to allow more flexibility in changing font sizes.
@@ -405,11 +413,6 @@ This has been disabled to allow more flexibility in changing font sizes.
405
  white-space: nowrap; /* Prevent wrapping line numbers in some themes */
406
  }
407
 
408
- .crayon-syntax.crayon-wrapped .crayon-line {
409
- /* min-height: 15px;*/
410
- height: auto;
411
- }
412
-
413
  .crayon-syntax .crayon-num,
414
  .crayon-syntax .crayon-pre .crayon-line,
415
  .crayon-syntax .crayon-toolbar *,
77
  width: auto !important;
78
  border-spacing: 0 !important;
79
  border-collapse: collapse !important;
80
+ table-layout: auto !important;
81
  }
82
 
83
  .crayon-syntax .crayon-table td,
152
 
153
  /*.crayon-syntax .crayon-toolbar,*/
154
  /*.crayon-syntax .crayon-toolbar * {*/
155
+ /*height: 18px;*/
156
+ /*line-height: 18px;*/
157
+ /*padding: 0px;*/
158
  /*}*/
159
 
160
  .crayon-syntax .crayon-toolbar span {
369
  /* width: 500px !important; */
370
  white-space: pre-wrap !important;
371
  /* word-wrap:break-word !important;*/
372
+ height: auto;
373
+ word-break: break-all;
374
  }
375
 
376
  .crayon-syntax-inline .crayon-pre,
391
  font-weight: 500;
392
  }
393
 
394
+ .crayon-syntax .crayon-toolbar *::selection,
395
+ .crayon-syntax .crayon-nums *::selection {
396
+ background: transparent;
397
+ }
398
+
399
  /*
400
 
401
  This has been disabled to allow more flexibility in changing font sizes.
413
  white-space: nowrap; /* Prevent wrapping line numbers in some themes */
414
  }
415
 
 
 
 
 
 
416
  .crayon-syntax .crayon-num,
417
  .crayon-syntax .crayon-pre .crayon-line,
418
  .crayon-syntax .crayon-toolbar *,
js/min/crayon.te.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var jQueryCrayon=jQuery;(function(a){a(document).ready(function(){CrayonUtil.init()});CrayonUtil=new function(){var c=this;var b=null;c.init=function(){b=CrayonSyntaxSettings;c.initGET()};c.addPrefixToID=function(d){return d.replace(/^([#.])?(.*)$/,"$1"+b.prefix+"$2")};c.removePrefixFromID=function(e){var d=new RegExp("^[#.]?"+b.prefix,"i");return e.replace(d,"")};c.cssElem=function(d){return a(c.addPrefixToID(d))};c.setDefault=function(e,f){return(typeof e=="undefined")?f:e};c.setMax=function(e,d){return e<=d?e:d};c.setMin=function(d,e){return d>=e?d:e};c.setRange=function(e,f,d){return c.setMax(c.setMin(e,f),d)};c.getExt=function(e){if(e.indexOf(".")==-1){return undefined}var d=e.split(".");if(d.length){d=d[d.length-1]}else{d=""}return d};c.initGET=function(){window.currentURL=window.location.protocol+"//"+window.location.host+window.location.pathname;window.currentDir=window.currentURL.substring(0,window.currentURL.lastIndexOf("/"));function d(e){e=e.split("+").join(" ");var h={},g,f=/[?&]?([^=]+)=([^&]*)/g;while(g=f.exec(e)){h[decodeURIComponent(g[1])]=decodeURIComponent(g[2])}return h}window.GET=d(document.location.search)};c.getAJAX=function(d,e){d.version=b.version;a.get(b.ajaxurl,d,e)};c.postAJAX=function(d,e){d.version=b.version;a.post(b.ajaxurl,d,e)};c.reload=function(){var d="?";for(var e in window.GET){d+=e+"="+window.GET[e]+"&"}window.location=window.currentURL+d};c.escape=function(d){if(typeof encodeURIComponent=="function"){return encodeURIComponent(d)}else{if(typeof escape!="function"){return escape(d)}else{return d}}};c.log=function(d){if(typeof console!="undefined"&&b.debug){console.log(d)}};c.decode_html=function(d){return String(d).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")};c.encode_html=function(d){return String(d).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};c.getReadableColor=function(g,f){f=a.extend({amount:0.5,xMulti:1,yMulti:1.5,normalizeHue:[20,180],normalizeHueXMulti:1/2.5,normalizeHueYMulti:1},f);var d=tinycolor(g);var e=d.toHsv();var i={x:e.s,y:1-e.v};i.x*=f.xMulti;i.y*=f.yMulti;if(f.normalizeHue&&e.h>f.normalizeHue[0]&&e.h<f.normalizeHue[1]){i.x*=f.normalizeHueXMulti;i.y*=f.normalizeHueYMulti}var h=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2));if(h<f.amount){e.v=0}else{e.v=1}e.s=0;return tinycolor(e).toHexString()};c.removeChars=function(e,f){var d=new RegExp("["+e+"]","gmi");return f.replace(d,"")}};a.fn.bindFirst=function(c,e){this.bind(c,e);var b=this.data("events")[c.split(".")[0]];var d=b.pop();b.splice(0,0,d)};a.keys=function(d){var c=[];for(var b in d){c.push(b)}return c};RegExp.prototype.execAll=function(c){var f=[];var b=null;while((b=this.exec(c))!=null){var e=[];for(var d in b){if(parseInt(d)==d){e.push(b[d])}}f.push(e)}return f};RegExp.prototype.escape=function(b){return b.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};String.prototype.sliceReplace=function(d,b,c){return this.substring(0,d)+c+this.substring(b)};String.prototype.escape=function(){var b={"&":"&amp;","<":"&lt;",">":"&gt;"};return this.replace(/[&<>]/g,function(c){return b[c]||c})};String.prototype.linkify=function(b){b=typeof b!="undefined"?b:"";return this.replace(/(http(s)?:\/\/(\S)+)/gmi,'<a href="$1" target="'+b+'">$1</a>')};String.prototype.toTitleCase=function(){var b=this.split(/\s+/);var c="";a.each(b,function(e,d){if(d!=""){c+=d.slice(0,1).toUpperCase()+d.slice(1,d.length);if(e!=b.length-1&&b[e+1]!=""){c+=" "}}});return c}})(jQueryCrayon);jqueryPopup=Object();jqueryPopup.defaultSettings={centerBrowser:0,centerScreen:0,height:500,left:0,location:0,menubar:0,resizable:0,scrollbars:0,status:0,width:500,windowName:null,windowURL:null,top:0,toolbar:0,data:null,event:"click"};(function(a){popupWindow=function(d,c,f,b){f=typeof f!=="undefined"?f:null;b=typeof b!=="undefined"?b:null;if(typeof d=="string"){d=jQuery(d)}if(!(d instanceof jQuery)){return false}var e=jQuery.extend({},jqueryPopup.defaultSettings,c||{});d.handler=jQuery(d).bind(e.event,function(){if(f){f()}var g="height="+e.height+",width="+e.width+",toolbar="+e.toolbar+",scrollbars="+e.scrollbars+",status="+e.status+",resizable="+e.resizable+",location="+e.location+",menuBar="+e.menubar;e.windowName=e.windowName||jQuery(this).attr("name");var h=jQuery(this).attr("href");if(!e.windowURL&&!(h=="#")&&!(h=="")){e.windowURL=jQuery(this).attr("href")}var i,j;var k=null;if(e.centerBrowser){if(typeof window.screenY=="undefined"){i=(window.screenTop-120)+((((document.documentElement.clientHeight+120)/2)-(e.height/2)));j=window.screenLeft+((((document.body.offsetWidth+20)/2)-(e.width/2)))}else{i=window.screenY+(((window.outerHeight/2)-(e.height/2)));j=window.screenX+(((window.outerWidth/2)-(e.width/2)))}k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{if(e.centerScreen){i=(screen.height-e.height)/2;j=(screen.width-e.width)/2;k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{k=window.open(e.windowURL,e.windowName,g+",left="+e.left+",top="+e.top)}}if(k!=null){k.focus();if(e.data){k.document.write(e.data)}}if(b){b()}});return e};popdownWindow=function(b,c){if(typeof c=="undefined"){c="click"}b=jQuery(b);if(!(b instanceof jQuery)){return false}b.unbind(c,b.handler)}})(jQueryCrayon);(function(f){f.fn.exists=function(){return this.length!==0};f.fn.style=function(B,E,A){var D=this.get(0);if(typeof D=="undefined"){return}var C=D.style;if(typeof B!="undefined"){if(typeof E!="undefined"){A=typeof A!="undefined"?A:"";if(typeof C.setProperty!="undefined"){C.setProperty(B,E,A)}else{C[B]=E}}else{return C[B]}}else{return C}};var d="crayon-pressed";var a="";var n="div.crayon-syntax";var e=".crayon-toolbar";var c=".crayon-info";var w=".crayon-plain";var o=".crayon-main";var m=".crayon-table";var v=".crayon-loading";var h=".crayon-code";var p=".crayon-title";var l=".crayon-tools";var b=".crayon-nums";var j=".crayon-num";var q=".crayon-line";var g="crayon-wrapped";var s=".crayon-nums-content";var u=".crayon-nums-button";var k=".crayon-wrap-button";var i=".crayon-expand-button";var t="crayon-expanded crayon-toolbar-visible";var y="crayon-placeholder";var x=".crayon-popup-button";var r=".crayon-copy-button";var z=".crayon-plain-button";f(document).ready(function(){CrayonSyntax.init()});CrayonSyntax=new function(){var I=this;var N=new Object();var ag;var H;var G=0;var Z;I.init=function(){if(typeof N=="undefined"){N=new Object()}ag=CrayonSyntaxSettings;H=CrayonSyntaxStrings;f(n).each(function(){I.process(this)})};I.process=function(aD,aE){aD=f(aD);var ar=aD.attr("id");if(ar=="crayon-"){ar+=X()}aD.attr("id",ar);CrayonUtil.log(ar);if(typeof aE=="undefined"){aE=false}if(!aE&&!aa(ar)){return}var au=aD.find(e);var aC=aD.find(c);var ap=aD.find(w);var aq=aD.find(o);var aB=aD.find(m);var aj=aD.find(h);var aG=aD.find(p);var aA=aD.find(l);var ay=aD.find(b);var av=aD.find(s);var az=aD.find(u);var am=aD.find(k);var ao=aD.find(i);var aF=aD.find(x);var at=aD.find(r);var al=aD.find(z);N[ar]=aD;N[ar].toolbar=au;N[ar].plain=ap;N[ar].info=aC;N[ar].main=aq;N[ar].table=aB;N[ar].code=aj;N[ar].title=aG;N[ar].tools=aA;N[ar].nums=ay;N[ar].nums_content=av;N[ar].numsButton=az;N[ar].wrapButton=am;N[ar].expandButton=ao;N[ar].popup_button=aF;N[ar].copy_button=at;N[ar].plainButton=al;N[ar].numsVisible=true;N[ar].wrapped=false;N[ar].plainVisible=false;N[ar].toolbar_delay=0;N[ar].time=1;f(w).css("z-index",0);var aw=aq.style();N[ar].mainStyle={height:aw&&aw.height||"","max-height":aw&&aw.maxHeight||"","min-height":aw&&aw.minHeight||"",width:aw&&aw.width||"","max-width":aw&&aw.maxWidth||"","min-width":aw&&aw.minWidth||""};N[ar].mainHeightAuto=N[ar].mainStyle.height==""&&N[ar].mainStyle["max-height"]=="";var ak;var ax=0;N[ar].loading=true;N[ar].scrollBlockFix=false;az.click(function(){CrayonSyntax.toggleNums(ar)});am.click(function(){CrayonSyntax.toggleWrap(ar)});ao.click(function(){CrayonSyntax.toggleExpand(ar)});al.click(function(){CrayonSyntax.togglePlain(ar)});at.click(function(){CrayonSyntax.copyPlain(ar)});B(ar);var an=function(){if(ay.filter('[data-settings~="hide"]').length!=0){av.ready(function(){CrayonUtil.log("function"+ar);CrayonSyntax.toggleNums(ar,true,true)})}else{ac(ar)}if(typeof N[ar].expanded=="undefined"){if(Math.abs(N[ar].main.outerWidth()-N[ar].table.outerWidth())<10){N[ar].expandButton.hide()}else{N[ar].expandButton.show()}}if(ax==5){clearInterval(ak);N[ar].loading=false}ax++};ak=setInterval(an,300);C(ar);f(j,N[ar]).each(function(){var aJ=f(this).attr("data-line");var aI=f("#"+aJ);var aH=aI.style("height");if(aH){aI.attr("data-height",aH)}});aq.css("position","relative");aq.css("z-index",1);Z=(aD.filter('[data-settings~="touchscreen"]').length!=0);if(!Z){aq.click(function(){A(ar,"",false)});ap.click(function(){A(ar,"",false)});aC.click(function(){A(ar,"",false)})}if(aD.filter('[data-settings~="no-popup"]').length==0){N[ar].popup_settings=popupWindow(aF,{height:screen.height-200,width:screen.width-100,top:75,left:50,scrollbars:1,windowURL:"",data:""},function(){F(ar)},function(){})}ap.css("opacity",0);N[ar].toolbarVisible=true;N[ar].hasOneLine=aB.outerHeight()<au.outerHeight()*2;N[ar].toolbarMouseover=false;if(au.filter('[data-settings~="mouseover"]').length!=0&&!Z){N[ar].toolbarMouseover=true;N[ar].toolbarVisible=false;au.css("margin-top","-"+au.outerHeight()+"px");au.hide();if(au.filter('[data-settings~="overlay"]').length!=0&&!N[ar].hasOneLine){au.css("position","absolute");au.css("z-index",2);if(au.filter('[data-settings~="hide"]').length!=0){aq.click(function(){T(ar,undefined,undefined,0)});ap.click(function(){T(ar,false,undefined,0)})}}else{au.css("z-index",4)}if(au.filter('[data-settings~="delay"]').length!=0){N[ar].toolbar_delay=500}aD.mouseenter(function(){T(ar,true)}).mouseleave(function(){T(ar,false)})}else{if(Z){au.show()}}if(aD.filter('[data-settings~="minimize"]').length==0){I.minimize(ar)}if(ap.length!=0&&!Z){if(ap.filter('[data-settings~="dblclick"]').length!=0){aq.dblclick(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="click"]').length!=0){aq.click(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="mouseover"]').length!=0){aD.mouseenter(function(){CrayonSyntax.togglePlain(ar,true)}).mouseleave(function(){CrayonSyntax.togglePlain(ar,false)});az.hide()}}}if(ap.filter('[data-settings~="show-plain-default"]').length!=0){CrayonSyntax.togglePlain(ar,true)}}var ai=aD.filter('[data-settings~="expand"]').length!=0;if(!Z&&aD.filter('[data-settings~="scroll-mouseover"]').length!=0){aq.css("overflow","hidden");ap.css("overflow","hidden");aD.mouseenter(function(){M(ar,true,ai)}).mouseleave(function(){M(ar,false,ai)})}if(ai){aD.mouseenter(function(){D(ar,true)}).mouseleave(function(){D(ar,false)})}if(aD.filter('[data-settings~="disable-anim"]').length!=0){N[ar].time=0}if(aD.filter('[data-settings~="wrap"]').length!=0){N[ar].wrapped=true}N[ar].mac=aD.hasClass("crayon-os-mac");ac(ar);ab(ar);Y(ar)};var aa=function(ai){CrayonUtil.log(N);if(typeof N[ai]=="undefined"){N[ai]=f("#"+ai);CrayonUtil.log("make "+ai);return true}CrayonUtil.log("no make "+ai);return false};var X=function(){return G++};var F=function(ai){if(typeof N[ai]=="undefined"){return aa(ai)}var aj=N[ai].popup_settings;if(aj.data){return}var al=N[ai].clone(true);al.removeClass("crayon-wrapped");if(N[ai].wrapped){f(j,al).each(function(){var ao=f(this).attr("data-line");var an=f("#"+ao);var am=an.attr("data-height");am=am?am:"";if(typeof am!="undefined"){an.css("height",am);f(this).css("height",am)}})}al.find(o).css("height","");var ak="";if(N[ai].plainVisible){ak=al.find(w)}else{ak=al.find(o)}aj.data=I.getAllCSS()+'<body class="crayon-popup-window" style="padding:0; margin:0;"><div class="'+al.attr("class")+' crayon-popup">'+I.removeCssInline(I.getHtmlString(ak))+"</div></body>"};I.minimize=function(al){var ak=f('<div class="crayon-minimize crayon-button"><div>');N[al].tools.append(ak);N[al].origTitle=N[al].title.html();if(!N[al].origTitle){N[al].title.html(H.minimize)}var aj="crayon-minimized";var ai=function(){N[al].toolbarPreventHide=false;ak.remove();N[al].removeClass(aj);N[al].title.html(N[al].origTitle);var am=N[al].toolbar;if(am.filter('[data-settings~="never-show"]').length!=0){am.remove()}};N[al].toolbar.click(ai);ak.click(ai);N[al].addClass(aj);N[al].toolbarPreventHide=true;T(al,undefined,undefined,0)};I.getHtmlString=function(ai){return f("<div>").append(ai.clone()).remove().html()};I.removeCssInline=function(ak){var aj=/style\s*=\s*"([^"]+)"/gmi;var ai=null;while((ai=aj.exec(ak))!=null){var al=ai[1];al=al.replace(/\b(?:width|height)\s*:[^;]+;/gmi,"");ak=ak.sliceReplace(ai.index,ai.index+ai[0].length,'style="'+al+'"')}return ak};I.getAllCSS=function(){var ak="";var aj=f('link[rel="stylesheet"]');var ai=[];if(aj.length==1){ai=aj}else{ai=aj.filter('[href*="crayon-syntax-highlighter"], [href*="min/"]')}ai.each(function(){var al=I.getHtmlString(f(this));ak+=al});return ak};I.copyPlain=function(ak,al){if(typeof N[ak]=="undefined"){return aa(ak)}var aj=N[ak].plain;I.togglePlain(ak,true,true);T(ak,true);var ai=N[ak].mac?"\u2318":"CTRL";var am=H.copy;am=am.replace(/%s/,ai+"+C");am=am.replace(/%s/,ai+"+V");A(ak,am);return false};var A=function(aj,al,ai){if(typeof N[aj]=="undefined"){return aa(aj)}var ak=N[aj].info;if(typeof al=="undefined"){al=""}if(typeof ai=="undefined"){ai=true}if(L(ak)&&ai){ak.html("<div>"+al+"</div>");ak.css("margin-top",-ak.outerHeight());ak.show();Q(aj,ak,true);setTimeout(function(){Q(aj,ak,false)},5000)}if(!ai){Q(aj,ak,false)}};var B=function(ai){if(window.devicePixelRatio>1){var aj=f(".crayon-button-icon",N[ai].toolbar);aj.each(function(){var al=f(this).css("background-image");var ak=al.replace(/\.(?=[^\.]+$)/g,"@2x.");f(this).css("background-size","48px 128px");f(this).css("background-image",ak)})}};var L=function(ai){var aj="-"+ai.outerHeight()+"px";if(ai.css("margin-top")==aj||ai.css("display")=="none"){return true}else{return false}};var Q=function(al,ak,aj,an,am,ap){var ai=function(){if(ap){ap(al,ak)}};var ao="-"+ak.outerHeight()+"px";if(typeof aj=="undefined"){if(L(ak)){aj=true}else{aj=false}}if(typeof an=="undefined"){an=100}if(an==false){an=false}if(typeof am=="undefined"){am=0}ak.stop(true);if(aj==true){ak.show();ak.animate({marginTop:0},ah(an,al),ai)}else{if(aj==false){if(ak.css("margin-top")=="0px"&&am){ak.delay(am)}ak.animate({marginTop:ao},ah(an,al),function(){ak.hide();ai()})}}};I.togglePlain=function(al,am,aj){if(typeof N[al]=="undefined"){return aa(al)}var ai=N[al].main;var ak=N[al].plain;if((ai.is(":animated")||ak.is(":animated"))&&typeof am=="undefined"){return}ae(al);var ao,an;if(typeof am!="undefined"){if(am){ao=ai;an=ak}else{ao=ak;an=ai}}else{if(ai.css("z-index")==1){ao=ai;an=ak}else{ao=ak;an=ai}}N[al].plainVisible=(an==ak);N[al].top=ao.scrollTop();N[al].left=ao.scrollLeft();N[al].scrollChanged=false;C(al);ao.stop(true);ao.fadeTo(ah(500,al),0,function(){ao.css("z-index",0)});an.stop(true);an.fadeTo(ah(500,al),1,function(){an.css("z-index",1);if(an==ak){if(aj){ak.select()}else{}}an.scrollTop(N[al].top+1);an.scrollTop(N[al].top);an.scrollLeft(N[al].left+1);an.scrollLeft(N[al].left)});an.scrollTop(N[al].top);an.scrollLeft(N[al].left);ab(al);T(al,false);return false};I.toggleNums=function(am,al,ai){if(typeof N[am]=="undefined"){aa(am);return false}if(N[am].table.is(":animated")){return false}var ao=Math.round(N[am].nums_content.outerWidth()+1);var an="-"+ao+"px";var ak;if(typeof al!="undefined"){ak=false}else{ak=(N[am].table.css("margin-left")==an)}var aj;if(ak){aj="0px";N[am].numsVisible=true}else{N[am].table.css("margin-left","0px");N[am].numsVisible=false;aj=an}if(typeof ai!="undefined"){N[am].table.css("margin-left",aj);ac(am);return false}var ap=(N[am].table.outerWidth()+J(N[am].table.css("margin-left"))>N[am].main.outerWidth());var aq=(N[am].table.outerHeight()>N[am].main.outerHeight());if(!ap&&!aq){N[am].main.css("overflow","hidden")}N[am].table.animate({marginLeft:aj},ah(200,am),function(){if(typeof N[am]!="undefined"){ac(am);if(!ap&&!aq){N[am].main.css("overflow","auto")}}});return false};I.toggleWrap=function(ai){N[ai].wrapped=!N[ai].wrapped;Y(ai)};I.toggleExpand=function(ai){var aj=!CrayonUtil.setDefault(N[ai].expanded,false);D(ai,aj)};var Y=function(ai,aj){aj=CrayonUtil.setDefault(aj,true);if(N[ai].wrapped){N[ai].addClass(g)}else{N[ai].removeClass(g)}E(ai);if(!N[ai].expanded&&aj){V(ai)}N[ai].wrapTimes=0;clearInterval(N[ai].wrapTimer);N[ai].wrapTimer=setInterval(function(){if(N[ai].is(":visible")){O(ai);N[ai].wrapTimes++;if(N[ai].wrapTimes==5){clearInterval(N[ai].wrapTimer)}}},200)};var ad=function(ai){if(typeof N[ai]=="undefined"){aa(ai);return false}};var J=function(aj){if(typeof aj!="string"){return 0}var ai=aj.replace(/[^-0-9]/g,"");if(ai.length==0){return 0}else{return parseInt(ai)}};var ac=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].numsVisible=="undefined"){return}if(N[ai].numsVisible){N[ai].numsButton.removeClass(a);N[ai].numsButton.addClass(d)}else{N[ai].numsButton.removeClass(d);N[ai].numsButton.addClass(a)}};var E=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].wrapped=="undefined"){return}if(N[ai].wrapped){N[ai].wrapButton.removeClass(a);N[ai].wrapButton.addClass(d)}else{N[ai].wrapButton.removeClass(d);N[ai].wrapButton.addClass(a)}};var W=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].expanded=="undefined"){return}if(N[ai].expanded){N[ai].expandButton.removeClass(a);N[ai].expandButton.addClass(d)}else{N[ai].expandButton.removeClass(d);N[ai].expandButton.addClass(a)}};var ab=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].plainVisible=="undefined"){return}if(N[ai].plainVisible){N[ai].plainButton.removeClass(a);N[ai].plainButton.addClass(d)}else{N[ai].plainButton.removeClass(d);N[ai].plainButton.addClass(a)}};var T=function(aj,ai,al,ak){if(typeof N[aj]=="undefined"){return aa(aj)}else{if(!N[aj].toolbarMouseover){return}else{if(ai==false&&N[aj].toolbarPreventHide){return}else{if(Z){return}}}}var am=N[aj].toolbar;if(typeof ak=="undefined"){ak=N[aj].toolbar_delay}Q(aj,am,ai,al,ak,function(){N[aj].toolbarVisible=ai})};var R=function(ak,ai){var aj=f.extend({},ak);aj.width+=ai.width;aj.height+=ai.height;return aj};var P=function(ak,ai){var aj=f.extend({},ak);aj.width-=ai.width;aj.height-=ai.height;return aj};var U=function(ai){if(typeof N[ai].initialSize=="undefined"){N[ai].toolbarHeight=N[ai].toolbar.outerHeight();N[ai].innerSize={width:N[ai].width(),height:N[ai].height()};N[ai].outerSize={width:N[ai].outerWidth(),height:N[ai].outerHeight()};N[ai].borderSize=P(N[ai].outerSize,N[ai].innerSize);N[ai].initialSize={width:N[ai].main.outerWidth(),height:N[ai].main.outerHeight()};N[ai].initialSize.height+=N[ai].toolbarHeight;N[ai].initialOuterSize=R(N[ai].initialSize,N[ai].borderSize);N[ai].finalSize={width:N[ai].table.outerWidth(),height:N[ai].table.outerHeight()};N[ai].finalSize.height+=N[ai].toolbarHeight;N[ai].finalSize.width=CrayonUtil.setMin(N[ai].finalSize.width,N[ai].initialSize.width);N[ai].finalSize.height=CrayonUtil.setMin(N[ai].finalSize.height,N[ai].initialSize.height);N[ai].diffSize=P(N[ai].finalSize,N[ai].initialSize);N[ai].finalOuterSize=R(N[ai].finalSize,N[ai].borderSize);N[ai].initialSize.height+=N[ai].toolbar.outerHeight()}};var D=function(al,ao){if(typeof N[al]=="undefined"){return aa(al)}if(typeof ao=="undefined"){return}var aj=N[al].main;var aq=N[al].plain;if(ao){if(typeof N[al].expanded=="undefined"){U(al);N[al].expandTime=CrayonUtil.setRange(N[al].diffSize.width/3,300,800);N[al].expanded=false;var ap=N[al].finalOuterSize;N[al].placeholder=f("<div></div>");N[al].placeholder.addClass(y);N[al].placeholder.css(ap);N[al].before(N[al].placeholder);N[al].placeholder.css("margin",N[al].css("margin"));f(window).bind("resize",K)}var am={height:"auto","min-height":"none","max-height":"none"};var ai={width:"auto","min-width":"none","max-width":"none"};N[al].outerWidth(N[al].outerWidth());N[al].css({"min-width":"none","max-width":"none"});var an={width:N[al].finalOuterSize.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=N[al].finalOuterSize.height;N[al].outerHeight(N[al].outerHeight())}aj.css(am);aj.css(ai);N[al].stop(true);N[al].animate(an,ah(N[al].expandTime,al),function(){N[al].expanded=true;W(al)});N[al].placeholder.show();f("body").prepend(N[al]);N[al].addClass(t);K()}else{var ar=N[al].initialOuterSize;var ak=N[al].toolbar_delay;if(ar){N[al].stop(true);if(!N[al].expanded){N[al].delay(ak)}var an={width:ar.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=ar.height}N[al].animate(an,ah(N[al].expandTime,al),function(){af(al)})}else{setTimeout(function(){af(al)},ak)}N[al].placeholder.hide();N[al].placeholder.before(N[al]);N[al].css({left:"auto",top:"auto"});N[al].removeClass(t)}ae(al);if(ao){Y(al,false)}};var K=function(){for(uid in N){if(N[uid].hasClass(t)){N[uid].css(N[uid].placeholder.offset())}}};var af=function(ai){N[ai].expanded=false;V(ai);W(ai);if(N[ai].wrapped){Y(ai)}};var M=function(al,aj,am){if(typeof N[al]=="undefined"){return aa(al)}if(typeof aj=="undefined"||am||N[al].expanded){return}var ai=N[al].main;var ak=N[al].plain;if(aj){ai.css("overflow","auto");ak.css("overflow","auto");if(typeof N[al].top!="undefined"){visible=(ai.css("z-index")==1?ai:ak);visible.scrollTop(N[al].top-1);visible.scrollTop(N[al].top);visible.scrollLeft(N[al].left-1);visible.scrollLeft(N[al].left)}}else{visible=(ai.css("z-index")==1?ai:ak);N[al].top=visible.scrollTop();N[al].left=visible.scrollLeft();ai.css("overflow","hidden");ak.css("overflow","hidden")}N[al].scrollChanged=true;C(al)};var C=function(ai){N[ai].table.style("width","100%","important");var aj=setTimeout(function(){N[ai].table.style("width","");clearInterval(aj)},10)};var V=function(ak){var aj=N[ak].main;var ai=N[ak].mainStyle;aj.css(ai);N[ak].css("height","auto");N[ak].css("width",ai.width);N[ak].css("max-width",ai["max-width"]);N[ak].css("min-width",ai["min-width"])};var ae=function(ai){N[ai].plain.outerHeight(N[ai].main.outerHeight())};var O=function(ai){f(j,N[ai]).each(function(){var al=f(this).attr("data-line");var ak=f("#"+al);var aj=null;if(N[ai].wrapped){ak.css("height","");aj=ak.outerHeight();aj=aj?aj:""}else{aj=ak.attr("data-height");aj=aj?aj:"";ak.css("height",aj)}f(this).css("height",aj)})};var ah=function(ai,aj){if(ai=="fast"){ai=200}else{if(ai=="slow"){ai=600}else{if(!S(ai)){ai=parseInt(ai);if(isNaN(ai)){return 0}}}}return ai*N[aj].time};var S=function(ai){return typeof ai=="number"}}})(jQueryCrayon);(function(a){window.CrayonQuickTags=new function(){var b=this;b.init=function(){b.sel='*[id*="crayon_quicktag"],*[class*="crayon_quicktag"]';QTags.addButton("crayon_quicktag","crayon",function(){CrayonTagEditor.showDialog({insert:function(e){QTags.insertContent(e)},select:b.getSelectedText,editor_str:"html",output:"encode"});a(b.sel).removeClass("qt_crayon_highlight")});var c;var d=setInterval(function(){c=a(b.sel).first();if(typeof c!="undefined"){CrayonTagEditor.bind(b.sel);clearInterval(d)}},100)};b.getSelectedText=function(){if(QTags.instances.length==0){return null}else{var e=QTags.instances[0];var d=e.canvas.selectionStart;var c=e.canvas.selectionEnd;return e.canvas.value.substring(d,c)}}};a(document).ready(function(){CrayonQuickTags.init()})})(jQueryCrayon);
2
  /*!
3
  Colorbox v1.5.9 - 2014-04-25
4
  jQuery lightbox and modal window plugin
5
  (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
6
  license: http://www.opensource.org/licenses/mit-license.php
7
  */
8
- (function(aT,a8,a4){function aZ(a,d,c){var b=a8.createElement(a);return d&&(b.id=ab+d),c&&(b.style.cssText=c),aT(b)}function aY(){return a4.innerHeight?a4.innerHeight:aT(a4).height()}function aV(b,a){a!==Object(a)&&(a={}),this.cache={},this.el=b,this.value=function(c){var d;return void 0===this.cache[c]&&(d=aT(this.el).attr("data-cbox-"+c),void 0!==d?this.cache[c]=d:void 0!==a[c]?this.cache[c]=a[c]:void 0!==ad[c]&&(this.cache[c]=ad[c])),this.cache[c]},this.get=function(d){var c=this.value(d);return aT.isFunction(c)?c.call(this.el,this):c}}function a5(b){var c=ag.length,a=(aM+b)%c;return 0>a?c+a:a}function bd(a,b){return Math.round((/%/.test(a)?("x"===b?az.width():aY())/100:1)*parseInt(a,10))}function aU(a,b){return a.get("photo")||a.get("photoRegex").test(b)}function a1(a,b){return a.get("retinaUrl")&&a4.devicePixelRatio>1?b.replace(a.get("photoRegex"),a.get("retinaSuffix")):b}function a9(a){"contains" in aP[0]&&!aP[0].contains(a.target)&&a.target!==aR[0]&&(a.stopPropagation(),aP.focus())}function ba(a){ba.str!==a&&(aP.add(aR).removeClass(ba.str).addClass(a),ba.str=a)}function a6(a){aM=0,a&&a!==!1?(ag=aT("."+af).filter(function(){var b=aT.data(this,ac),c=new aV(this,b);return c.get("rel")===a}),aM=ag.index(bf.el),-1===aM&&(ag=ag.add(bf.el),aM=ag.length-1)):ag=aT(bf.el)}function aS(a){aT(a8).trigger(a),aA.triggerHandler(a)}function a7(b){var g;if(!ax){if(g=aT(b).data("colorbox"),bf=new aV(b,g),a6(bf.get("rel")),!aH){aH=aW=!0,ba(bf.get("className")),aP.css({visibility:"hidden",display:"block",opacity:""}),ar=aZ(aG,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),bb.css({width:"",height:""}).append(ar),aB=aj.height()+a2.height()+bb.outerHeight(!0)-bb.height(),a3=aC.width()+aw.width()+bb.outerWidth(!0)-bb.width(),aF=ar.outerHeight(!0),ap=ar.outerWidth(!0);var d=bd(bf.get("initialWidth"),"x"),c=bd(bf.get("initialHeight"),"y"),a=bf.get("maxWidth"),e=bf.get("maxHeight");bf.w=(a!==!1?Math.min(d,bd(a,"x")):d)-ap-a3,bf.h=(e!==!1?Math.min(c,bd(e,"y")):c)-aF-aB,ar.css({width:"",height:bf.h}),au.position(),aS(bc),bf.get("onOpen"),ao.add(av).hide(),aP.focus(),bf.get("trapFocus")&&a8.addEventListener&&(a8.addEventListener("focus",a9,!0),aA.one(aO,function(){a8.removeEventListener("focus",a9,!0)})),bf.get("returnFocus")&&aA.one(aO,function(){aT(bf.el).focus()})}aR.css({opacity:parseFloat(bf.get("opacity"))||"",cursor:bf.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),bf.get("closeButton")?aE.html(bf.get("close")).appendTo(bb):aE.appendTo("<div/>"),aQ()}}function aX(){!aP&&a8.body&&(ah=!1,az=aT(a4),aP=aZ(aG).attr({id:ac,"class":aT.support.opacity===!1?ab+"IE":"",role:"dialog",tabindex:"-1"}).hide(),aR=aZ(aG,"Overlay").hide(),ak=aT([aZ(aG,"LoadingOverlay")[0],aZ(aG,"LoadingGraphic")[0]]),aN=aZ(aG,"Wrapper"),bb=aZ(aG,"Content").append(av=aZ(aG,"Title"),al=aZ(aG,"Current"),an=aT('<button type="button"/>').attr({id:ab+"Previous"}),at=aT('<button type="button"/>').attr({id:ab+"Next"}),ay=aZ("button","Slideshow"),ak),aE=aT('<button type="button"/>').attr({id:ab+"Close"}),aN.append(aZ(aG).append(aZ(aG,"TopLeft"),aj=aZ(aG,"TopCenter"),aZ(aG,"TopRight")),aZ(aG,!1,"clear:left").append(aC=aZ(aG,"MiddleLeft"),bb,aw=aZ(aG,"MiddleRight")),aZ(aG,!1,"clear:left").append(aZ(aG,"BottomLeft"),a2=aZ(aG,"BottomCenter"),aZ(aG,"BottomRight"))).find("div div").css({"float":"left"}),aq=aZ(aG,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),ao=at.add(an).add(al).add(ay),aT(a8.body).append(aR,aP.append(aN,aq)))}function a0(){function a(b){b.which>1||b.shiftKey||b.altKey||b.metaKey||b.ctrlKey||(b.preventDefault(),a7(this))}return aP?(ah||(ah=!0,at.click(function(){au.next()}),an.click(function(){au.prev()}),aE.click(function(){au.close()}),aR.click(function(){bf.get("overlayClose")&&au.close()}),aT(a8).bind("keydown."+ab,function(b){var c=b.keyCode;aH&&bf.get("escKey")&&27===c&&(b.preventDefault(),au.close()),aH&&bf.get("arrowKey")&&ag[1]&&!b.altKey&&(37===c?(b.preventDefault(),an.click()):39===c&&(b.preventDefault(),at.click()))}),aT.isFunction(aT.fn.on)?aT(a8).on("click."+ab,"."+af,a):aT("."+af).live("click."+ab,a)),!0):!1}function aQ(){var f,i,b,a=au.prep,g=++aK;if(aW=!0,ai=!1,aS(be),aS(aJ),bf.get("onLoad"),bf.h=bf.get("height")?bd(bf.get("height"),"y")-aF-aB:bf.get("innerHeight")&&bd(bf.get("innerHeight"),"y"),bf.w=bf.get("width")?bd(bf.get("width"),"x")-ap-a3:bf.get("innerWidth")&&bd(bf.get("innerWidth"),"x"),bf.mw=bf.w,bf.mh=bf.h,bf.get("maxWidth")&&(bf.mw=bd(bf.get("maxWidth"),"x")-ap-a3,bf.mw=bf.w&&bf.w<bf.mw?bf.w:bf.mw),bf.get("maxHeight")&&(bf.mh=bd(bf.get("maxHeight"),"y")-aF-aB,bf.mh=bf.h&&bf.h<bf.mh?bf.h:bf.mh),f=bf.get("href"),am=setTimeout(function(){ak.show()},100),bf.get("inline")){var j=aT(f);b=aT("<div>").hide().insertBefore(j),aA.one(be,function(){b.replaceWith(j)}),a(j)}else{bf.get("iframe")?a(" "):bf.get("html")?a(bf.get("html")):aU(bf,f)?(f=a1(bf,f),ai=new Image,aT(ai).addClass(ab+"Photo").bind("error",function(){a(aZ(aG,"Error").html(bf.get("imgError")))}).one("load",function(){g===aK&&setTimeout(function(){var c;aT.each(["alt","longdesc","aria-describedby"],function(h,d){var k=aT(bf.el).attr(d)||aT(bf.el).attr("data-"+d);k&&ai.setAttribute(d,k)}),bf.get("retinaImage")&&a4.devicePixelRatio>1&&(ai.height=ai.height/a4.devicePixelRatio,ai.width=ai.width/a4.devicePixelRatio),bf.get("scalePhotos")&&(i=function(){ai.height-=ai.height*c,ai.width-=ai.width*c},bf.mw&&ai.width>bf.mw&&(c=(ai.width-bf.mw)/ai.width,i()),bf.mh&&ai.height>bf.mh&&(c=(ai.height-bf.mh)/ai.height,i())),bf.h&&(ai.style.marginTop=Math.max(bf.mh-ai.height,0)/2+"px"),ag[1]&&(bf.get("loop")||ag[aM+1])&&(ai.style.cursor="pointer",ai.onclick=function(){au.next()}),ai.style.width=ai.width+"px",ai.style.height=ai.height+"px",a(ai)},1)}),ai.src=f):f&&aq.load(f,bf.get("data"),function(d,c){g===aK&&a("error"===c?aZ(aG,"Error").html(bf.get("xhrError")):aT(this).contents())})}}var aR,aP,aN,bb,aj,aC,aw,a2,ag,az,ar,aq,ak,av,al,ay,at,an,aE,ao,bf,aB,a3,aF,ap,aM,ai,aH,aW,ax,am,au,ah,ad={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:0.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return aT(this).attr("href")},title:function(){return this.title}},ac="colorbox",ab="cbox",af=ab+"Element",bc=ab+"_open",aJ=ab+"_load",aa=ab+"_complete",aL=ab+"_cleanup",aO=ab+"_closed",be=ab+"_purge",aA=aT("<a/>"),aG="div",aK=0,aD={},aI=function(){function l(){clearTimeout(g)}function j(){(bf.get("loop")||ag[aM+1])&&(l(),g=setTimeout(au.next,bf.get("slideshowSpeed")))}function f(){ay.html(bf.get("slideshowStop")).unbind(m).one(m,d),aA.bind(aa,j).bind(aJ,l),aP.removeClass(k+"off").addClass(k+"on")}function d(){l(),aA.unbind(aa,j).unbind(aJ,l),ay.html(bf.get("slideshowStart")).unbind(m).one(m,function(){au.next(),f()}),aP.removeClass(k+"on").addClass(k+"off")}function c(){b=!1,ay.hide(),l(),aA.unbind(aa,j).unbind(aJ,l),aP.removeClass(k+"off "+k+"on")}var b,g,k=ab+"Slideshow_",m="click."+ab;return function(){b?bf.get("slideshow")||(aA.unbind(aL,c),c()):bf.get("slideshow")&&ag[1]&&(b=!0,aA.one(aL,c),bf.get("slideshowAuto")?f():d(),ay.show())}}();aT.colorbox||(aT(aX),au=aT.fn[ac]=aT[ac]=function(b,a){var d,c=this;if(b=b||{},aT.isFunction(c)){c=aT("<a/>"),b.open=!0}else{if(!c[0]){return c}}return c[0]?(aX(),a0()&&(a&&(b.onComplete=a),c.each(function(){var e=aT.data(this,ac)||{};aT.data(this,ac,aT.extend(e,b))}).addClass(af),d=new aV(c[0],b),d.get("open")&&a7(c[0])),c):c},au.position=function(o,j){function b(){aj[0].style.width=a2[0].style.width=bb[0].style.width=parseInt(aP[0].style.width,10)-a3+"px",bb[0].style.height=aC[0].style.height=aw[0].style.height=parseInt(aP[0].style.height,10)-aB+"px"}var a,k,t,f=0,p=0,q=aP.offset();if(az.unbind("resize."+ab),aP.css({top:-90000,left:-90000}),k=az.scrollTop(),t=az.scrollLeft(),bf.get("fixed")?(q.top-=k,q.left-=t,aP.css({position:"fixed"})):(f=k,p=t,aP.css({position:"absolute"})),p+=bf.get("right")!==!1?Math.max(az.width()-bf.w-ap-a3-bd(bf.get("right"),"x"),0):bf.get("left")!==!1?bd(bf.get("left"),"x"):Math.round(Math.max(az.width()-bf.w-ap-a3,0)/2),f+=bf.get("bottom")!==!1?Math.max(aY()-bf.h-aF-aB-bd(bf.get("bottom"),"y"),0):bf.get("top")!==!1?bd(bf.get("top"),"y"):Math.round(Math.max(aY()-bf.h-aF-aB,0)/2),aP.css({top:q.top,left:q.left,visibility:"visible"}),aN[0].style.width=aN[0].style.height="9999px",a={width:bf.w+ap+a3,height:bf.h+aF+aB,top:f,left:p},o){var m=0;aT.each(a,function(c){return a[c]!==aD[c]?(m=o,void 0):void 0}),o=m}aD=a,o||aP.css(a),aP.dequeue().animate(a,{duration:o||0,complete:function(){b(),aW=!1,aN[0].style.width=bf.w+ap+a3+"px",aN[0].style.height=bf.h+aF+aB+"px",bf.get("reposition")&&setTimeout(function(){az.bind("resize."+ab,au.position)},1),j&&j()},step:b})},au.resize=function(a){var b;aH&&(a=a||{},a.width&&(bf.w=bd(a.width,"x")-ap-a3),a.innerWidth&&(bf.w=bd(a.innerWidth,"x")),ar.css({width:bf.w}),a.height&&(bf.h=bd(a.height,"y")-aF-aB),a.innerHeight&&(bf.h=bd(a.innerHeight,"y")),a.innerHeight||a.height||(b=ar.scrollTop(),ar.css({height:"auto"}),bf.h=ar.height()),ar.css({height:bf.h}),b&&ar.scrollTop(b),au.position("none"===bf.get("transition")?0:bf.get("speed")))},au.prep=function(c){function h(){return bf.w=bf.w||ar.width(),bf.w=bf.mw&&bf.mw<bf.w?bf.mw:bf.w,bf.w}function b(){return bf.h=bf.h||ar.height(),bf.h=bf.mh&&bf.mh<bf.h?bf.mh:bf.h,bf.h}if(aH){var f,e="none"===bf.get("transition")?0:bf.get("speed");ar.remove(),ar=aZ(aG,"LoadedContent").append(c),ar.hide().appendTo(aq.show()).css({width:h(),overflow:bf.get("scrolling")?"auto":"hidden"}).css({height:b()}).prependTo(bb),aq.hide(),aT(ai).css({"float":"none"}),ba(bf.get("className")),f=function(){function g(){aT.support.opacity===!1&&aP[0].style.removeAttribute("filter")}var k,j,d=ag.length;aH&&(j=function(){clearTimeout(am),ak.hide(),aS(aa),bf.get("onComplete")},av.html(bf.get("title")).show(),ar.show(),d>1?("string"==typeof bf.get("current")&&al.html(bf.get("current").replace("{current}",aM+1).replace("{total}",d)).show(),at[bf.get("loop")||d-1>aM?"show":"hide"]().html(bf.get("next")),an[bf.get("loop")||aM?"show":"hide"]().html(bf.get("previous")),aI(),bf.get("preloading")&&aT.each([a5(-1),a5(1)],function(){var a,p=ag[this],m=new aV(p,aT.data(p,ac)),l=m.get("href");l&&aU(m,l)&&(l=a1(m,l),a=a8.createElement("img"),a.src=l)})):ao.hide(),bf.get("iframe")?(k=a8.createElement("iframe"),"frameBorder" in k&&(k.frameBorder=0),"allowTransparency" in k&&(k.allowTransparency="true"),bf.get("scrolling")||(k.scrolling="no"),aT(k).attr({src:bf.get("href"),name:(new Date).getTime(),"class":ab+"Iframe",allowFullScreen:!0}).one("load",j).appendTo(ar),aA.one(be,function(){k.src="//about:blank"}),bf.get("fastIframe")&&aT(k).trigger("load")):j(),"fade"===bf.get("transition")?aP.fadeTo(e,1,g):g())},"fade"===bf.get("transition")?aP.fadeTo(e,0,function(){au.position(0,f)}):au.position(e,f)}},au.next=function(){!aW&&ag[1]&&(bf.get("loop")||ag[aM+1])&&(aM=a5(1),a7(ag[aM]))},au.prev=function(){!aW&&ag[1]&&(bf.get("loop")||aM)&&(aM=a5(-1),a7(ag[aM]))},au.close=function(){aH&&!ax&&(ax=!0,aH=!1,aS(aL),bf.get("onCleanup"),az.unbind("."+ab),aR.fadeTo(bf.get("fadeOut")||0,0),aP.stop().fadeTo(bf.get("fadeOut")||0,0,function(){aP.hide(),aR.hide(),aS(be),ar.remove(),setTimeout(function(){ax=!1,aS(aO),bf.get("onClosed")},1)}))},au.remove=function(){aP&&(aP.stop(),aT.colorbox.close(),aP.stop().remove(),aR.remove(),ax=!1,aP=null,aT("."+af).removeData(ac).removeClass(af),aT(a8).unbind("click."+ab))},au.element=function(){return aT(bf.el)},au.settings=ad)})(jQuery,document,window);(function(a){window.CrayonTagEditor=new function(){var j=this;var B=false;var y=false;var e=false;var o,f,r,A,w;var C,t,i,v;var x=0;var k,q;var b=null;var g="";var D=false;var n,p,d;var z,c,u,l,h;var m={inline:true,width:690,height:"90%",closeButton:false,fixed:true,transition:"none",className:"crayon-colorbox",onOpen:function(){a(this.outer).prepend(a(n.bar_content))},onComplete:function(){a(n.code_css).focus()},onCleanup:function(){a(n.bar).prepend(a(n.bar_content))}};j.init=function(){n=CrayonTagEditorSettings;p=CrayonSyntaxSettings;d=CrayonUtil;m.href=n.content_css};j.bind=function(E){if(!B){B=true;j.init()}var s=a(E);s.each(function(G,F){var I=a(F);var H=a('<a class="crayon-tag-editor-button-wrapper"></a>').attr("href",n.content_css);I.after(H);H.append(I);H.colorbox(m)})};j.hide=function(){a.colorbox.close();return false};j.loadDialog=function(s){if(!y){y=true}else{s&&s();return}CrayonUtil.getAJAX({action:"crayon-tag-editor",is_admin:p.is_admin},function(I){z=a('<div id="'+n.css+'"></div>');z.appendTo("body").hide();z.html(I);j.setOrigValues();l=z.find(n.submit_css);h=z.find(n.cancel_css);c=a(n.code_css);u=a("#crayon-te-clear");k=function(){var J=u.is(":visible");if(c.val().length>0&&!J){u.show();c.removeClass(p.selected)}else{if(c.val().length<=0){u.hide()}}};c.keyup(k);c.change(k);u.click(function(){c.val("");c.removeClass(p.selected);c.focus()});var G=a(n.url_css);var F=a(n.url_info_css);var H=CrayonTagEditorSettings.extensions;q=function(){if(G.val().length>0&&!F.is(":visible")){F.show();G.removeClass(p.selected)}else{if(G.val().length<=0){F.hide()}}var L=CrayonUtil.getExt(G.val());if(L){var M=H[L];var K=M?M:L;var J=CrayonTagEditorSettings.fallback_lang;a(n.lang_css+" option").each(function(){if(a(this).val()==K){J=K}});a(n.lang_css).val(J)}};G.keyup(q);G.change(q);var E=function(){var L=a(this);var J=a(this).attr(p.orig_value);if(typeof J=="undefined"){J=""}var M=j.settingValue(L);CrayonUtil.log(L.attr("id")+" value: "+M);var K=null;if(L.is("input[type=checkbox]")){K=L.next("span")}CrayonUtil.log(" >>> "+L.attr("id")+" is "+J+" = "+M);if(J==M){L.removeClass(p.changed);if(K){K.removeClass(p.changed)}}else{L.addClass(p.changed);if(K){K.addClass(p.changed)}}j.settingValue(L,M)};a("."+p.setting+"[id]:not(."+p.special+")").each(function(){a(this).change(E);a(this).keyup(E)});s&&s()})};j.showDialog=function(E){var s=y;j.loadDialog(function(){if(!s){a.colorbox(m)}j._showDialog(E)})};j._showDialog=function(E){E=a.extend({insert:null,edit:null,show:null,hide:j.hide,select:null,editor_str:null,ed:null,node:null,input:null,output:null},E);j.resetSettings();o=E.insert;f=E.edit;r=E.show;A=E.hide;w=E.select;C=E.input;t=E.output;i=E.editor_str;var F=E.node;var F=E.node;D=false;l.unbind();l.click(function(V){j.submitButton();V.preventDefault()});j.setSubmitText(n.submit_add);h.unbind();h.click(function(V){j.hide();V.preventDefault()});if(j.isCrayon(F)){b=a(F);if(b.length!=0){g=b.attr("class");var L=new RegExp("\\b([A-Za-z-]+)"+n.attr_sep+"(\\S+)","gim");var s=L.execAll(g);g=a.trim(g.replace(L,""));var M={};for(var R in s){var J=s[R][1];var N=s[R][2];M[J]=N}var U=b.attr("title");if(U){M.title=U}var H=b.attr("data-url");if(H){M.url=H}if(typeof M.highlight!="undefined"){M.highlight="0"?"1":"0"}D=b.hasClass(n.inline_css);M.inline=D?"1":"0";var S=[];a(n.lang_css+" option").each(function(){var V=a(this).val();if(V){S.push(V)}});if(a.inArray(M.lang,S)==-1){M.lang=n.fallback_lang}M=j.validate(M);for(var O in M){var K=a("#"+p.prefix+O+"."+p.setting);var N=M[O];j.settingValue(K,N);K.change();if(!K.hasClass(p.special)){K.addClass(p.changed);if(K.is("input[type=checkbox]")){highlight=K.next("span");highlight.addClass(p.changed)}}CrayonUtil.log("loaded: "+O+":"+N)}e=true;j.setSubmitText(n.submit_edit);var Q=b.html();if(C=="encode"){Q=CrayonUtil.encode_html(Q)}else{if(C=="decode"){Q=CrayonUtil.decode_html(Q)}}c.val(Q)}else{CrayonUtil.log("cannot load currNode of type pre")}}else{if(w){c.val(w)}e=false;j.setSubmitText(n.submit_add);b=null;g=""}var G=a("#"+n.inline_css);G.change(function(){D=a(this).is(":checked");var V=a("."+n.inline_hide_css);var Z=a("."+n.inline_hide_only_css);var X=[n.mark_css,n.range_css,n.title_css,n.url_css];for(var W in X){var Y=a(X[W]);Y.attr("disabled",D)}if(D){V.hide();Z.hide();V.closest("tr").hide();for(var W in X){var Y=a(X[W]);Y.addClass("crayon-disabled")}}else{V.show();Z.show();V.closest("tr").show();for(var W in X){var Y=a(X[W]);Y.removeClass("crayon-disabled")}}});G.change();var I=e?n.dialog_title_edit:n.dialog_title_add;a(n.dialog_title_css).html(I);if(r){r()}c.focus();k();q();if(v){clearInterval(v);x=0}var T=a("#TB_window");T.hide();var P=function(){T.show();var V=a(window).scrollTop();a(window).scrollTop(V+10);a(window).scrollTop(V-10)};v=setInterval(function(){if(typeof T!="undefined"&&!T.hasClass("crayon-te-ajax")){T.addClass("crayon-te-ajax");clearInterval(v);P()}if(x>=100){clearInterval(v);P()}x++},40)};j.addCrayon=function(){var E=a(n.url_css);if(E.val().length==0&&c.val().length==0){c.addClass(p.selected);c.focus();return false}c.removeClass(p.selected);var M=a("#"+n.inline_css);D=M.length!=0&&M.is(":checked");var G=br_after="";if(!e){if(!D){if(i=="html"){br_after=G=" \n"}else{br_after="<p>&nbsp;</p>"}}else{if(i=="html"){br_after=G=" "}else{br_after="&nbsp;"}}}var P=(D?"span":"pre");var I=G+"<"+P+" ";var K={};I+='class="';var s=new RegExp("\\b"+n.inline_css+"\\b","gim");if(D){if(s.exec(g)==null){g+=" "+n.inline_css+" "}}else{g=g.replace(s,"")}a("."+p.changed+"[id],."+p.changed+"["+n.data_value+"]").each(function(){var R=a(this).attr("id");var Q=a(this).attr(n.data_value);R=d.removePrefixFromID(R);K[R]=Q});K.lang=a(n.lang_css).val();var H=a(n.mark_css).val();if(H.length!=0&&!D){K.mark=H}var J=a(n.range_css).val();if(J.length!=0&&!D){K.range=J}if(a(n.hl_css).is(":checked")){K.highlight="0"}K.decode="true";K=j.validate(K);for(var F in K){var O=K[F];CrayonUtil.log("add "+F+":"+O);I+=F+n.attr_sep+O+" "}I+=g;I+='" ';if(!D){var N=a(n.title_css).val();if(N.length!=0){I+='title="'+N+'" '}var E=a(n.url_css).val();if(E.length!=0){I+='data-url="'+E+'" '}}var L=a(n.code_css).val();if(t=="encode"){L=CrayonUtil.encode_html(L)}else{if(t=="decode"){L=CrayonUtil.decode_html(L)}}L=typeof L!="undefined"?L:"";I+=">"+L+"</"+P+">"+br_after;if(e&&f){f(I)}else{if(o){o(I)}}return true};j.submitButton=function(){CrayonUtil.log("submit");if(j.addCrayon()!=false){j.hideDialog()}};j.hideDialog=function(){CrayonUtil.log("hide");if(A){A()}};j.setOrigValues=function(){a("."+p.setting+"[id]").each(function(){var s=a(this);s.attr(p.orig_value,j.settingValue(s))})};j.resetSettings=function(){CrayonUtil.log("reset");a("."+p.setting).each(function(){var s=a(this);j.settingValue(s,s.attr(p.orig_value));s.change()});c.val("")};j.settingValue=function(s,E){if(typeof E=="undefined"){E="";if(s.is("input[type=checkbox]")){E=s.is(":checked")?"true":"false"}else{E=s.val()}return E}else{if(s.is("input[type=checkbox]")){if(typeof E=="string"){if(E=="true"||E=="1"){E=true}else{if(E=="false"||E=="0"){E=false}}}s.prop("checked",E)}else{s.val(E)}s.attr(n.data_value,E)}};j.validate=function(G){var s=["range","mark"];for(var E in s){var F=s[E];if(typeof G[F]!="undefined"){G[F]=G[F].replace(/\s/g,"")}}return G};j.isCrayon=function(s){return s!=null&&(s.nodeName=="PRE"||(s.nodeName=="SPAN"&&a(s).hasClass(n.inline_css)))};j.elemValue=function(E){var s=null;if(E.is("input[type=checkbox]")){s=E.is(":checked")}else{s=E.val()}return s};j.setSubmitText=function(s){l.html(s)}}})(jQueryCrayon);
1
+ var jQueryCrayon=jQuery;(function(a){a(document).ready(function(){CrayonUtil.init()});CrayonUtil=new function(){var c=this;var b=null;c.init=function(){b=CrayonSyntaxSettings;c.initGET()};c.addPrefixToID=function(d){return d.replace(/^([#.])?(.*)$/,"$1"+b.prefix+"$2")};c.removePrefixFromID=function(e){var d=new RegExp("^[#.]?"+b.prefix,"i");return e.replace(d,"")};c.cssElem=function(d){return a(c.addPrefixToID(d))};c.setDefault=function(e,f){return(typeof e=="undefined")?f:e};c.setMax=function(e,d){return e<=d?e:d};c.setMin=function(d,e){return d>=e?d:e};c.setRange=function(e,f,d){return c.setMax(c.setMin(e,f),d)};c.getExt=function(e){if(e.indexOf(".")==-1){return undefined}var d=e.split(".");if(d.length){d=d[d.length-1]}else{d=""}return d};c.initGET=function(){window.currentURL=window.location.protocol+"//"+window.location.host+window.location.pathname;window.currentDir=window.currentURL.substring(0,window.currentURL.lastIndexOf("/"));function d(e){e=e.split("+").join(" ");var h={},g,f=/[?&]?([^=]+)=([^&]*)/g;while(g=f.exec(e)){h[decodeURIComponent(g[1])]=decodeURIComponent(g[2])}return h}window.GET=d(document.location.search)};c.getAJAX=function(d,e){d.version=b.version;a.get(b.ajaxurl,d,e)};c.postAJAX=function(d,e){d.version=b.version;a.post(b.ajaxurl,d,e)};c.reload=function(){var d="?";for(var e in window.GET){d+=e+"="+window.GET[e]+"&"}window.location=window.currentURL+d};c.escape=function(d){if(typeof encodeURIComponent=="function"){return encodeURIComponent(d)}else{if(typeof escape!="function"){return escape(d)}else{return d}}};c.log=function(d){if(typeof console!="undefined"&&b.debug){console.log(d)}};c.decode_html=function(d){return String(d).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")};c.encode_html=function(d){return String(d).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};c.getReadableColor=function(g,f){f=a.extend({amount:0.5,xMulti:1,yMulti:1.5,normalizeHue:[20,180],normalizeHueXMulti:1/2.5,normalizeHueYMulti:1},f);var d=tinycolor(g);var e=d.toHsv();var i={x:e.s,y:1-e.v};i.x*=f.xMulti;i.y*=f.yMulti;if(f.normalizeHue&&e.h>f.normalizeHue[0]&&e.h<f.normalizeHue[1]){i.x*=f.normalizeHueXMulti;i.y*=f.normalizeHueYMulti}var h=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2));if(h<f.amount){e.v=0}else{e.v=1}e.s=0;return tinycolor(e).toHexString()};c.removeChars=function(e,f){var d=new RegExp("["+e+"]","gmi");return f.replace(d,"")}};a.fn.bindFirst=function(c,e){this.bind(c,e);var b=this.data("events")[c.split(".")[0]];var d=b.pop();b.splice(0,0,d)};a.keys=function(d){var c=[];for(var b in d){c.push(b)}return c};RegExp.prototype.execAll=function(c){var f=[];var b=null;while((b=this.exec(c))!=null){var e=[];for(var d in b){if(parseInt(d)==d){e.push(b[d])}}f.push(e)}return f};RegExp.prototype.escape=function(b){return b.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};String.prototype.sliceReplace=function(d,b,c){return this.substring(0,d)+c+this.substring(b)};String.prototype.escape=function(){var b={"&":"&amp;","<":"&lt;",">":"&gt;"};return this.replace(/[&<>]/g,function(c){return b[c]||c})};String.prototype.linkify=function(b){b=typeof b!="undefined"?b:"";return this.replace(/(http(s)?:\/\/(\S)+)/gmi,'<a href="$1" target="'+b+'">$1</a>')};String.prototype.toTitleCase=function(){var b=this.split(/\s+/);var c="";a.each(b,function(e,d){if(d!=""){c+=d.slice(0,1).toUpperCase()+d.slice(1,d.length);if(e!=b.length-1&&b[e+1]!=""){c+=" "}}});return c}})(jQueryCrayon);jqueryPopup=Object();jqueryPopup.defaultSettings={centerBrowser:0,centerScreen:0,height:500,left:0,location:0,menubar:0,resizable:0,scrollbars:0,status:0,width:500,windowName:null,windowURL:null,top:0,toolbar:0,data:null,event:"click"};(function(a){popupWindow=function(d,c,f,b){f=typeof f!=="undefined"?f:null;b=typeof b!=="undefined"?b:null;if(typeof d=="string"){d=jQuery(d)}if(!(d instanceof jQuery)){return false}var e=jQuery.extend({},jqueryPopup.defaultSettings,c||{});d.handler=jQuery(d).bind(e.event,function(){if(f){f()}var g="height="+e.height+",width="+e.width+",toolbar="+e.toolbar+",scrollbars="+e.scrollbars+",status="+e.status+",resizable="+e.resizable+",location="+e.location+",menuBar="+e.menubar;e.windowName=e.windowName||jQuery(this).attr("name");var h=jQuery(this).attr("href");if(!e.windowURL&&!(h=="#")&&!(h=="")){e.windowURL=jQuery(this).attr("href")}var i,j;var k=null;if(e.centerBrowser){if(typeof window.screenY=="undefined"){i=(window.screenTop-120)+((((document.documentElement.clientHeight+120)/2)-(e.height/2)));j=window.screenLeft+((((document.body.offsetWidth+20)/2)-(e.width/2)))}else{i=window.screenY+(((window.outerHeight/2)-(e.height/2)));j=window.screenX+(((window.outerWidth/2)-(e.width/2)))}k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{if(e.centerScreen){i=(screen.height-e.height)/2;j=(screen.width-e.width)/2;k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{k=window.open(e.windowURL,e.windowName,g+",left="+e.left+",top="+e.top)}}if(k!=null){k.focus();if(e.data){k.document.write(e.data)}}if(b){b()}});return e};popdownWindow=function(b,c){if(typeof c=="undefined"){c="click"}b=jQuery(b);if(!(b instanceof jQuery)){return false}b.unbind(c,b.handler)}})(jQueryCrayon);(function(f){f.fn.exists=function(){return this.length!==0};f.fn.style=function(B,E,A){var D=this.get(0);if(typeof D=="undefined"){return}var C=D.style;if(typeof B!="undefined"){if(typeof E!="undefined"){A=typeof A!="undefined"?A:"";if(typeof C.setProperty!="undefined"){C.setProperty(B,E,A)}else{C[B]=E}}else{return C[B]}}else{return C}};var d="crayon-pressed";var a="";var n="div.crayon-syntax";var e=".crayon-toolbar";var c=".crayon-info";var w=".crayon-plain";var o=".crayon-main";var m=".crayon-table";var v=".crayon-loading";var h=".crayon-code";var p=".crayon-title";var l=".crayon-tools";var b=".crayon-nums";var j=".crayon-num";var q=".crayon-line";var g="crayon-wrapped";var s=".crayon-nums-content";var u=".crayon-nums-button";var k=".crayon-wrap-button";var i=".crayon-expand-button";var t="crayon-expanded crayon-toolbar-visible";var y="crayon-placeholder";var x=".crayon-popup-button";var r=".crayon-copy-button";var z=".crayon-plain-button";f(document).ready(function(){CrayonSyntax.init()});CrayonSyntax=new function(){var I=this;var N=new Object();var ag;var H;var G=0;var Z;I.init=function(){if(typeof N=="undefined"){N=new Object()}ag=CrayonSyntaxSettings;H=CrayonSyntaxStrings;f(n).each(function(){I.process(this)})};I.process=function(aD,aE){aD=f(aD);var ar=aD.attr("id");if(ar=="crayon-"){ar+=X()}aD.attr("id",ar);CrayonUtil.log(ar);if(typeof aE=="undefined"){aE=false}if(!aE&&!aa(ar)){return}var au=aD.find(e);var aC=aD.find(c);var ap=aD.find(w);var aq=aD.find(o);var aB=aD.find(m);var aj=aD.find(h);var aG=aD.find(p);var aA=aD.find(l);var ay=aD.find(b);var av=aD.find(s);var az=aD.find(u);var am=aD.find(k);var ao=aD.find(i);var aF=aD.find(x);var at=aD.find(r);var al=aD.find(z);N[ar]=aD;N[ar].toolbar=au;N[ar].plain=ap;N[ar].info=aC;N[ar].main=aq;N[ar].table=aB;N[ar].code=aj;N[ar].title=aG;N[ar].tools=aA;N[ar].nums=ay;N[ar].nums_content=av;N[ar].numsButton=az;N[ar].wrapButton=am;N[ar].expandButton=ao;N[ar].popup_button=aF;N[ar].copy_button=at;N[ar].plainButton=al;N[ar].numsVisible=true;N[ar].wrapped=false;N[ar].plainVisible=false;N[ar].toolbar_delay=0;N[ar].time=1;f(w).css("z-index",0);var aw=aq.style();N[ar].mainStyle={height:aw&&aw.height||"","max-height":aw&&aw.maxHeight||"","min-height":aw&&aw.minHeight||"",width:aw&&aw.width||"","max-width":aw&&aw.maxWidth||"","min-width":aw&&aw.minWidth||""};N[ar].mainHeightAuto=N[ar].mainStyle.height==""&&N[ar].mainStyle["max-height"]=="";var ak;var ax=0;N[ar].loading=true;N[ar].scrollBlockFix=false;az.click(function(){CrayonSyntax.toggleNums(ar)});am.click(function(){CrayonSyntax.toggleWrap(ar)});ao.click(function(){CrayonSyntax.toggleExpand(ar)});al.click(function(){CrayonSyntax.togglePlain(ar)});at.click(function(){CrayonSyntax.copyPlain(ar)});B(ar);var an=function(){if(ay.filter('[data-settings~="hide"]').length!=0){av.ready(function(){CrayonUtil.log("function"+ar);CrayonSyntax.toggleNums(ar,true,true)})}else{ac(ar)}if(typeof N[ar].expanded=="undefined"){if(Math.abs(N[ar].main.outerWidth()-N[ar].table.outerWidth())<10){N[ar].expandButton.hide()}else{N[ar].expandButton.show()}}if(ax==5){clearInterval(ak);N[ar].loading=false}ax++};ak=setInterval(an,300);C(ar);f(j,N[ar]).each(function(){var aJ=f(this).attr("data-line");var aI=f("#"+aJ);var aH=aI.style("height");if(aH){aI.attr("data-height",aH)}});aq.css("position","relative");aq.css("z-index",1);Z=(aD.filter('[data-settings~="touchscreen"]').length!=0);if(!Z){aq.click(function(){A(ar,"",false)});ap.click(function(){A(ar,"",false)});aC.click(function(){A(ar,"",false)})}if(aD.filter('[data-settings~="no-popup"]').length==0){N[ar].popup_settings=popupWindow(aF,{height:screen.height-200,width:screen.width-100,top:75,left:50,scrollbars:1,windowURL:"",data:""},function(){F(ar)},function(){})}ap.css("opacity",0);N[ar].toolbarVisible=true;N[ar].hasOneLine=aB.outerHeight()<au.outerHeight()*2;N[ar].toolbarMouseover=false;if(au.filter('[data-settings~="mouseover"]').length!=0&&!Z){N[ar].toolbarMouseover=true;N[ar].toolbarVisible=false;au.css("margin-top","-"+au.outerHeight()+"px");au.hide();if(au.filter('[data-settings~="overlay"]').length!=0&&!N[ar].hasOneLine){au.css("position","absolute");au.css("z-index",2);if(au.filter('[data-settings~="hide"]').length!=0){aq.click(function(){T(ar,undefined,undefined,0)});ap.click(function(){T(ar,false,undefined,0)})}}else{au.css("z-index",4)}if(au.filter('[data-settings~="delay"]').length!=0){N[ar].toolbar_delay=500}aD.mouseenter(function(){T(ar,true)}).mouseleave(function(){T(ar,false)})}else{if(Z){au.show()}}if(aD.filter('[data-settings~="minimize"]').length==0){I.minimize(ar)}if(ap.length!=0&&!Z){if(ap.filter('[data-settings~="dblclick"]').length!=0){aq.dblclick(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="click"]').length!=0){aq.click(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="mouseover"]').length!=0){aD.mouseenter(function(){CrayonSyntax.togglePlain(ar,true)}).mouseleave(function(){CrayonSyntax.togglePlain(ar,false)});az.hide()}}}if(ap.filter('[data-settings~="show-plain-default"]').length!=0){CrayonSyntax.togglePlain(ar,true)}}var ai=aD.filter('[data-settings~="expand"]').length!=0;if(!Z&&aD.filter('[data-settings~="scroll-mouseover"]').length!=0){aq.css("overflow","hidden");ap.css("overflow","hidden");aD.mouseenter(function(){M(ar,true,ai)}).mouseleave(function(){M(ar,false,ai)})}if(ai){aD.mouseenter(function(){D(ar,true)}).mouseleave(function(){D(ar,false)})}if(aD.filter('[data-settings~="disable-anim"]').length!=0){N[ar].time=0}if(aD.filter('[data-settings~="wrap"]').length!=0){N[ar].wrapped=true}N[ar].mac=aD.hasClass("crayon-os-mac");ac(ar);ab(ar);Y(ar)};var aa=function(ai){CrayonUtil.log(N);if(typeof N[ai]=="undefined"){N[ai]=f("#"+ai);CrayonUtil.log("make "+ai);return true}CrayonUtil.log("no make "+ai);return false};var X=function(){return G++};var F=function(ai){if(typeof N[ai]=="undefined"){return aa(ai)}var aj=N[ai].popup_settings;if(aj.data){return}var al=N[ai].clone(true);al.removeClass("crayon-wrapped");if(N[ai].wrapped){f(j,al).each(function(){var ao=f(this).attr("data-line");var an=f("#"+ao);var am=an.attr("data-height");am=am?am:"";if(typeof am!="undefined"){an.css("height",am);f(this).css("height",am)}})}al.find(o).css("height","");var ak="";if(N[ai].plainVisible){ak=al.find(w)}else{ak=al.find(o)}aj.data=I.getAllCSS()+'<body class="crayon-popup-window" style="padding:0; margin:0;"><div class="'+al.attr("class")+' crayon-popup">'+I.removeCssInline(I.getHtmlString(ak))+"</div></body>"};I.minimize=function(al){var ak=f('<div class="crayon-minimize crayon-button"><div>');N[al].tools.append(ak);N[al].origTitle=N[al].title.html();if(!N[al].origTitle){N[al].title.html(H.minimize)}var aj="crayon-minimized";var ai=function(){N[al].toolbarPreventHide=false;ak.remove();N[al].removeClass(aj);N[al].title.html(N[al].origTitle);var am=N[al].toolbar;if(am.filter('[data-settings~="never-show"]').length!=0){am.remove()}};N[al].toolbar.click(ai);ak.click(ai);N[al].addClass(aj);N[al].toolbarPreventHide=true;T(al,undefined,undefined,0)};I.getHtmlString=function(ai){return f("<div>").append(ai.clone()).remove().html()};I.removeCssInline=function(ak){var aj=/style\s*=\s*"([^"]+)"/gmi;var ai=null;while((ai=aj.exec(ak))!=null){var al=ai[1];al=al.replace(/\b(?:width|height)\s*:[^;]+;/gmi,"");ak=ak.sliceReplace(ai.index,ai.index+ai[0].length,'style="'+al+'"')}return ak};I.getAllCSS=function(){var ak="";var aj=f('link[rel="stylesheet"]');var ai=[];if(aj.length==1){ai=aj}else{ai=aj.filter('[href*="crayon-syntax-highlighter"], [href*="min/"]')}ai.each(function(){var al=I.getHtmlString(f(this));ak+=al});return ak};I.copyPlain=function(ak,al){if(typeof N[ak]=="undefined"){return aa(ak)}var aj=N[ak].plain;I.togglePlain(ak,true,true);T(ak,true);var ai=N[ak].mac?"\u2318":"CTRL";var am=H.copy;am=am.replace(/%s/,ai+"+C");am=am.replace(/%s/,ai+"+V");A(ak,am);return false};var A=function(aj,al,ai){if(typeof N[aj]=="undefined"){return aa(aj)}var ak=N[aj].info;if(typeof al=="undefined"){al=""}if(typeof ai=="undefined"){ai=true}if(L(ak)&&ai){ak.html("<div>"+al+"</div>");ak.css("margin-top",-ak.outerHeight());ak.show();Q(aj,ak,true);setTimeout(function(){Q(aj,ak,false)},5000)}if(!ai){Q(aj,ak,false)}};var B=function(ai){if(window.devicePixelRatio>1){var aj=f(".crayon-button-icon",N[ai].toolbar);aj.each(function(){var al=f(this).css("background-image");var ak=al.replace(/\.(?=[^\.]+$)/g,"@2x.");f(this).css("background-size","48px 128px");f(this).css("background-image",ak)})}};var L=function(ai){var aj="-"+ai.outerHeight()+"px";if(ai.css("margin-top")==aj||ai.css("display")=="none"){return true}else{return false}};var Q=function(al,ak,aj,an,am,ap){var ai=function(){if(ap){ap(al,ak)}};var ao="-"+ak.outerHeight()+"px";if(typeof aj=="undefined"){if(L(ak)){aj=true}else{aj=false}}if(typeof an=="undefined"){an=100}if(an==false){an=false}if(typeof am=="undefined"){am=0}ak.stop(true);if(aj==true){ak.show();ak.animate({marginTop:0},ah(an,al),ai)}else{if(aj==false){if(ak.css("margin-top")=="0px"&&am){ak.delay(am)}ak.animate({marginTop:ao},ah(an,al),function(){ak.hide();ai()})}}};I.togglePlain=function(al,am,aj){if(typeof N[al]=="undefined"){return aa(al)}var ai=N[al].main;var ak=N[al].plain;if((ai.is(":animated")||ak.is(":animated"))&&typeof am=="undefined"){return}ae(al);var ao,an;if(typeof am!="undefined"){if(am){ao=ai;an=ak}else{ao=ak;an=ai}}else{if(ai.css("z-index")==1){ao=ai;an=ak}else{ao=ak;an=ai}}N[al].plainVisible=(an==ak);N[al].top=ao.scrollTop();N[al].left=ao.scrollLeft();N[al].scrollChanged=false;C(al);ao.stop(true);ao.fadeTo(ah(500,al),0,function(){ao.css("z-index",0)});an.stop(true);an.fadeTo(ah(500,al),1,function(){an.css("z-index",1);if(an==ak){if(aj){ak.select()}else{}}an.scrollTop(N[al].top+1);an.scrollTop(N[al].top);an.scrollLeft(N[al].left+1);an.scrollLeft(N[al].left)});an.scrollTop(N[al].top);an.scrollLeft(N[al].left);ab(al);T(al,false);return false};I.toggleNums=function(am,al,ai){if(typeof N[am]=="undefined"){aa(am);return false}if(N[am].table.is(":animated")){return false}var ao=Math.round(N[am].nums_content.outerWidth()+1);var an="-"+ao+"px";var ak;if(typeof al!="undefined"){ak=false}else{ak=(N[am].table.css("margin-left")==an)}var aj;if(ak){aj="0px";N[am].numsVisible=true}else{N[am].table.css("margin-left","0px");N[am].numsVisible=false;aj=an}if(typeof ai!="undefined"){N[am].table.css("margin-left",aj);ac(am);return false}var ap=(N[am].table.outerWidth()+J(N[am].table.css("margin-left"))>N[am].main.outerWidth());var aq=(N[am].table.outerHeight()>N[am].main.outerHeight());if(!ap&&!aq){N[am].main.css("overflow","hidden")}N[am].table.animate({marginLeft:aj},ah(200,am),function(){if(typeof N[am]!="undefined"){ac(am);if(!ap&&!aq){N[am].main.css("overflow","auto")}}});return false};I.toggleWrap=function(ai){N[ai].wrapped=!N[ai].wrapped;Y(ai)};I.toggleExpand=function(ai){var aj=!CrayonUtil.setDefault(N[ai].expanded,false);D(ai,aj)};var Y=function(ai,aj){aj=CrayonUtil.setDefault(aj,true);if(N[ai].wrapped){N[ai].addClass(g)}else{N[ai].removeClass(g)}E(ai);if(!N[ai].expanded&&aj){V(ai)}N[ai].wrapTimes=0;clearInterval(N[ai].wrapTimer);N[ai].wrapTimer=setInterval(function(){if(N[ai].is(":visible")){O(ai);N[ai].wrapTimes++;if(N[ai].wrapTimes==5){clearInterval(N[ai].wrapTimer)}}},200)};var ad=function(ai){if(typeof N[ai]=="undefined"){aa(ai);return false}};var J=function(aj){if(typeof aj!="string"){return 0}var ai=aj.replace(/[^-0-9]/g,"");if(ai.length==0){return 0}else{return parseInt(ai)}};var ac=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].numsVisible=="undefined"){return}if(N[ai].numsVisible){N[ai].numsButton.removeClass(a);N[ai].numsButton.addClass(d)}else{N[ai].numsButton.removeClass(d);N[ai].numsButton.addClass(a)}};var E=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].wrapped=="undefined"){return}if(N[ai].wrapped){N[ai].wrapButton.removeClass(a);N[ai].wrapButton.addClass(d)}else{N[ai].wrapButton.removeClass(d);N[ai].wrapButton.addClass(a)}};var W=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].expanded=="undefined"){return}if(N[ai].expanded){N[ai].expandButton.removeClass(a);N[ai].expandButton.addClass(d)}else{N[ai].expandButton.removeClass(d);N[ai].expandButton.addClass(a)}};var ab=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].plainVisible=="undefined"){return}if(N[ai].plainVisible){N[ai].plainButton.removeClass(a);N[ai].plainButton.addClass(d)}else{N[ai].plainButton.removeClass(d);N[ai].plainButton.addClass(a)}};var T=function(aj,ai,al,ak){if(typeof N[aj]=="undefined"){return aa(aj)}else{if(!N[aj].toolbarMouseover){return}else{if(ai==false&&N[aj].toolbarPreventHide){return}else{if(Z){return}}}}var am=N[aj].toolbar;if(typeof ak=="undefined"){ak=N[aj].toolbar_delay}Q(aj,am,ai,al,ak,function(){N[aj].toolbarVisible=ai})};var R=function(ak,ai){var aj=f.extend({},ak);aj.width+=ai.width;aj.height+=ai.height;return aj};var P=function(ak,ai){var aj=f.extend({},ak);aj.width-=ai.width;aj.height-=ai.height;return aj};var U=function(ai){if(typeof N[ai].initialSize=="undefined"){N[ai].toolbarHeight=N[ai].toolbar.outerHeight();N[ai].innerSize={width:N[ai].width(),height:N[ai].height()};N[ai].outerSize={width:N[ai].outerWidth(),height:N[ai].outerHeight()};N[ai].borderSize=P(N[ai].outerSize,N[ai].innerSize);N[ai].initialSize={width:N[ai].main.outerWidth(),height:N[ai].main.outerHeight()};N[ai].initialSize.height+=N[ai].toolbarHeight;N[ai].initialOuterSize=R(N[ai].initialSize,N[ai].borderSize);N[ai].finalSize={width:N[ai].table.outerWidth(),height:N[ai].table.outerHeight()};N[ai].finalSize.height+=N[ai].toolbarHeight;N[ai].finalSize.width=CrayonUtil.setMin(N[ai].finalSize.width,N[ai].initialSize.width);N[ai].finalSize.height=CrayonUtil.setMin(N[ai].finalSize.height,N[ai].initialSize.height);N[ai].diffSize=P(N[ai].finalSize,N[ai].initialSize);N[ai].finalOuterSize=R(N[ai].finalSize,N[ai].borderSize);N[ai].initialSize.height+=N[ai].toolbar.outerHeight()}};var D=function(al,ao){if(typeof N[al]=="undefined"){return aa(al)}if(typeof ao=="undefined"){return}var aj=N[al].main;var aq=N[al].plain;if(ao){if(typeof N[al].expanded=="undefined"){U(al);N[al].expandTime=CrayonUtil.setRange(N[al].diffSize.width/3,300,800);N[al].expanded=false;var ap=N[al].finalOuterSize;N[al].placeholder=f("<div></div>");N[al].placeholder.addClass(y);N[al].placeholder.css(ap);N[al].before(N[al].placeholder);N[al].placeholder.css("margin",N[al].css("margin"));f(window).bind("resize",K)}var am={height:"auto","min-height":"none","max-height":"none"};var ai={width:"auto","min-width":"none","max-width":"none"};N[al].outerWidth(N[al].outerWidth());N[al].css({"min-width":"none","max-width":"none"});var an={width:N[al].finalOuterSize.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=N[al].finalOuterSize.height;N[al].outerHeight(N[al].outerHeight())}aj.css(am);aj.css(ai);N[al].stop(true);N[al].animate(an,ah(N[al].expandTime,al),function(){N[al].expanded=true;W(al)});N[al].placeholder.show();f("body").prepend(N[al]);N[al].addClass(t);K()}else{var ar=N[al].initialOuterSize;var ak=N[al].toolbar_delay;if(ar){N[al].stop(true);if(!N[al].expanded){N[al].delay(ak)}var an={width:ar.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=ar.height}N[al].animate(an,ah(N[al].expandTime,al),function(){af(al)})}else{setTimeout(function(){af(al)},ak)}N[al].placeholder.hide();N[al].placeholder.before(N[al]);N[al].css({left:"auto",top:"auto"});N[al].removeClass(t)}ae(al);if(ao){Y(al,false)}};var K=function(){for(uid in N){if(N[uid].hasClass(t)){N[uid].css(N[uid].placeholder.offset())}}};var af=function(ai){N[ai].expanded=false;V(ai);W(ai);if(N[ai].wrapped){Y(ai)}};var M=function(al,aj,am){if(typeof N[al]=="undefined"){return aa(al)}if(typeof aj=="undefined"||am||N[al].expanded){return}var ai=N[al].main;var ak=N[al].plain;if(aj){ai.css("overflow","auto");ak.css("overflow","auto");if(typeof N[al].top!="undefined"){visible=(ai.css("z-index")==1?ai:ak);visible.scrollTop(N[al].top-1);visible.scrollTop(N[al].top);visible.scrollLeft(N[al].left-1);visible.scrollLeft(N[al].left)}}else{visible=(ai.css("z-index")==1?ai:ak);N[al].top=visible.scrollTop();N[al].left=visible.scrollLeft();ai.css("overflow","hidden");ak.css("overflow","hidden")}N[al].scrollChanged=true;C(al)};var C=function(ai){N[ai].table.style("width","100%","important");var aj=setTimeout(function(){N[ai].table.style("width","");clearInterval(aj)},10)};var V=function(ak){var aj=N[ak].main;var ai=N[ak].mainStyle;aj.css(ai);N[ak].css("height","auto");N[ak].css("width",ai.width);N[ak].css("max-width",ai["max-width"]);N[ak].css("min-width",ai["min-width"])};var ae=function(ai){N[ai].plain.outerHeight(N[ai].main.outerHeight())};var O=function(ai){f(j,N[ai]).each(function(){var al=f(this).attr("data-line");var ak=f("#"+al);var aj=null;if(N[ai].wrapped){ak.css("height","");aj=ak.outerHeight();aj=aj?aj:""}else{aj=ak.attr("data-height");aj=aj?aj:"";ak.css("height",aj)}f(this).css("height",aj)})};var ah=function(ai,aj){if(ai=="fast"){ai=200}else{if(ai=="slow"){ai=600}else{if(!S(ai)){ai=parseInt(ai);if(isNaN(ai)){return 0}}}}return ai*N[aj].time};var S=function(ai){return typeof ai=="number"}}})(jQueryCrayon);(function(b){var a=CrayonTagEditorSettings;window.CrayonQuickTags=new function(){var c=this;c.init=function(){c.sel='*[id*="crayon_quicktag"],*[class*="crayon_quicktag"]';var e=a.quicktag_text;e=e!==undefined?e:"crayon";QTags.addButton("crayon_quicktag",e,function(){CrayonTagEditor.showDialog({insert:function(g){QTags.insertContent(g)},select:c.getSelectedText,editor_str:"html",output:"encode"});b(c.sel).removeClass("qt_crayon_highlight")});var d;var f=setInterval(function(){d=b(c.sel).first();if(typeof d!="undefined"){CrayonTagEditor.bind(c.sel);clearInterval(f)}},100)};c.getSelectedText=function(){if(QTags.instances.length==0){return null}else{var f=QTags.instances[0];var e=f.canvas.selectionStart;var d=f.canvas.selectionEnd;return f.canvas.value.substring(e,d)}}};b(document).ready(function(){CrayonQuickTags.init()})})(jQueryCrayon);
2
  /*!
3
  Colorbox v1.5.9 - 2014-04-25
4
  jQuery lightbox and modal window plugin
5
  (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
6
  license: http://www.opensource.org/licenses/mit-license.php
7
  */
8
+ (function(aT,a8,a4){function aZ(a,d,c){var b=a8.createElement(a);return d&&(b.id=ab+d),c&&(b.style.cssText=c),aT(b)}function aY(){return a4.innerHeight?a4.innerHeight:aT(a4).height()}function aV(b,a){a!==Object(a)&&(a={}),this.cache={},this.el=b,this.value=function(c){var d;return void 0===this.cache[c]&&(d=aT(this.el).attr("data-cbox-"+c),void 0!==d?this.cache[c]=d:void 0!==a[c]?this.cache[c]=a[c]:void 0!==ad[c]&&(this.cache[c]=ad[c])),this.cache[c]},this.get=function(d){var c=this.value(d);return aT.isFunction(c)?c.call(this.el,this):c}}function a5(b){var c=ag.length,a=(aM+b)%c;return 0>a?c+a:a}function bd(a,b){return Math.round((/%/.test(a)?("x"===b?az.width():aY())/100:1)*parseInt(a,10))}function aU(a,b){return a.get("photo")||a.get("photoRegex").test(b)}function a1(a,b){return a.get("retinaUrl")&&a4.devicePixelRatio>1?b.replace(a.get("photoRegex"),a.get("retinaSuffix")):b}function a9(a){"contains" in aP[0]&&!aP[0].contains(a.target)&&a.target!==aR[0]&&(a.stopPropagation(),aP.focus())}function ba(a){ba.str!==a&&(aP.add(aR).removeClass(ba.str).addClass(a),ba.str=a)}function a6(a){aM=0,a&&a!==!1?(ag=aT("."+af).filter(function(){var b=aT.data(this,ac),c=new aV(this,b);return c.get("rel")===a}),aM=ag.index(bf.el),-1===aM&&(ag=ag.add(bf.el),aM=ag.length-1)):ag=aT(bf.el)}function aS(a){aT(a8).trigger(a),aA.triggerHandler(a)}function a7(b){var g;if(!ax){if(g=aT(b).data("colorbox"),bf=new aV(b,g),a6(bf.get("rel")),!aH){aH=aW=!0,ba(bf.get("className")),aP.css({visibility:"hidden",display:"block",opacity:""}),ar=aZ(aG,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),bb.css({width:"",height:""}).append(ar),aB=aj.height()+a2.height()+bb.outerHeight(!0)-bb.height(),a3=aC.width()+aw.width()+bb.outerWidth(!0)-bb.width(),aF=ar.outerHeight(!0),ap=ar.outerWidth(!0);var d=bd(bf.get("initialWidth"),"x"),c=bd(bf.get("initialHeight"),"y"),a=bf.get("maxWidth"),e=bf.get("maxHeight");bf.w=(a!==!1?Math.min(d,bd(a,"x")):d)-ap-a3,bf.h=(e!==!1?Math.min(c,bd(e,"y")):c)-aF-aB,ar.css({width:"",height:bf.h}),au.position(),aS(bc),bf.get("onOpen"),ao.add(av).hide(),aP.focus(),bf.get("trapFocus")&&a8.addEventListener&&(a8.addEventListener("focus",a9,!0),aA.one(aO,function(){a8.removeEventListener("focus",a9,!0)})),bf.get("returnFocus")&&aA.one(aO,function(){aT(bf.el).focus()})}aR.css({opacity:parseFloat(bf.get("opacity"))||"",cursor:bf.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),bf.get("closeButton")?aE.html(bf.get("close")).appendTo(bb):aE.appendTo("<div/>"),aQ()}}function aX(){!aP&&a8.body&&(ah=!1,az=aT(a4),aP=aZ(aG).attr({id:ac,"class":aT.support.opacity===!1?ab+"IE":"",role:"dialog",tabindex:"-1"}).hide(),aR=aZ(aG,"Overlay").hide(),ak=aT([aZ(aG,"LoadingOverlay")[0],aZ(aG,"LoadingGraphic")[0]]),aN=aZ(aG,"Wrapper"),bb=aZ(aG,"Content").append(av=aZ(aG,"Title"),al=aZ(aG,"Current"),an=aT('<button type="button"/>').attr({id:ab+"Previous"}),at=aT('<button type="button"/>').attr({id:ab+"Next"}),ay=aZ("button","Slideshow"),ak),aE=aT('<button type="button"/>').attr({id:ab+"Close"}),aN.append(aZ(aG).append(aZ(aG,"TopLeft"),aj=aZ(aG,"TopCenter"),aZ(aG,"TopRight")),aZ(aG,!1,"clear:left").append(aC=aZ(aG,"MiddleLeft"),bb,aw=aZ(aG,"MiddleRight")),aZ(aG,!1,"clear:left").append(aZ(aG,"BottomLeft"),a2=aZ(aG,"BottomCenter"),aZ(aG,"BottomRight"))).find("div div").css({"float":"left"}),aq=aZ(aG,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),ao=at.add(an).add(al).add(ay),aT(a8.body).append(aR,aP.append(aN,aq)))}function a0(){function a(b){b.which>1||b.shiftKey||b.altKey||b.metaKey||b.ctrlKey||(b.preventDefault(),a7(this))}return aP?(ah||(ah=!0,at.click(function(){au.next()}),an.click(function(){au.prev()}),aE.click(function(){au.close()}),aR.click(function(){bf.get("overlayClose")&&au.close()}),aT(a8).bind("keydown."+ab,function(b){var c=b.keyCode;aH&&bf.get("escKey")&&27===c&&(b.preventDefault(),au.close()),aH&&bf.get("arrowKey")&&ag[1]&&!b.altKey&&(37===c?(b.preventDefault(),an.click()):39===c&&(b.preventDefault(),at.click()))}),aT.isFunction(aT.fn.on)?aT(a8).on("click."+ab,"."+af,a):aT("."+af).live("click."+ab,a)),!0):!1}function aQ(){var f,i,b,a=au.prep,g=++aK;if(aW=!0,ai=!1,aS(be),aS(aJ),bf.get("onLoad"),bf.h=bf.get("height")?bd(bf.get("height"),"y")-aF-aB:bf.get("innerHeight")&&bd(bf.get("innerHeight"),"y"),bf.w=bf.get("width")?bd(bf.get("width"),"x")-ap-a3:bf.get("innerWidth")&&bd(bf.get("innerWidth"),"x"),bf.mw=bf.w,bf.mh=bf.h,bf.get("maxWidth")&&(bf.mw=bd(bf.get("maxWidth"),"x")-ap-a3,bf.mw=bf.w&&bf.w<bf.mw?bf.w:bf.mw),bf.get("maxHeight")&&(bf.mh=bd(bf.get("maxHeight"),"y")-aF-aB,bf.mh=bf.h&&bf.h<bf.mh?bf.h:bf.mh),f=bf.get("href"),am=setTimeout(function(){ak.show()},100),bf.get("inline")){var j=aT(f);b=aT("<div>").hide().insertBefore(j),aA.one(be,function(){b.replaceWith(j)}),a(j)}else{bf.get("iframe")?a(" "):bf.get("html")?a(bf.get("html")):aU(bf,f)?(f=a1(bf,f),ai=new Image,aT(ai).addClass(ab+"Photo").bind("error",function(){a(aZ(aG,"Error").html(bf.get("imgError")))}).one("load",function(){g===aK&&setTimeout(function(){var c;aT.each(["alt","longdesc","aria-describedby"],function(h,d){var k=aT(bf.el).attr(d)||aT(bf.el).attr("data-"+d);k&&ai.setAttribute(d,k)}),bf.get("retinaImage")&&a4.devicePixelRatio>1&&(ai.height=ai.height/a4.devicePixelRatio,ai.width=ai.width/a4.devicePixelRatio),bf.get("scalePhotos")&&(i=function(){ai.height-=ai.height*c,ai.width-=ai.width*c},bf.mw&&ai.width>bf.mw&&(c=(ai.width-bf.mw)/ai.width,i()),bf.mh&&ai.height>bf.mh&&(c=(ai.height-bf.mh)/ai.height,i())),bf.h&&(ai.style.marginTop=Math.max(bf.mh-ai.height,0)/2+"px"),ag[1]&&(bf.get("loop")||ag[aM+1])&&(ai.style.cursor="pointer",ai.onclick=function(){au.next()}),ai.style.width=ai.width+"px",ai.style.height=ai.height+"px",a(ai)},1)}),ai.src=f):f&&aq.load(f,bf.get("data"),function(d,c){g===aK&&a("error"===c?aZ(aG,"Error").html(bf.get("xhrError")):aT(this).contents())})}}var aR,aP,aN,bb,aj,aC,aw,a2,ag,az,ar,aq,ak,av,al,ay,at,an,aE,ao,bf,aB,a3,aF,ap,aM,ai,aH,aW,ax,am,au,ah,ad={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:0.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return aT(this).attr("href")},title:function(){return this.title}},ac="colorbox",ab="cbox",af=ab+"Element",bc=ab+"_open",aJ=ab+"_load",aa=ab+"_complete",aL=ab+"_cleanup",aO=ab+"_closed",be=ab+"_purge",aA=aT("<a/>"),aG="div",aK=0,aD={},aI=function(){function l(){clearTimeout(g)}function j(){(bf.get("loop")||ag[aM+1])&&(l(),g=setTimeout(au.next,bf.get("slideshowSpeed")))}function f(){ay.html(bf.get("slideshowStop")).unbind(m).one(m,d),aA.bind(aa,j).bind(aJ,l),aP.removeClass(k+"off").addClass(k+"on")}function d(){l(),aA.unbind(aa,j).unbind(aJ,l),ay.html(bf.get("slideshowStart")).unbind(m).one(m,function(){au.next(),f()}),aP.removeClass(k+"on").addClass(k+"off")}function c(){b=!1,ay.hide(),l(),aA.unbind(aa,j).unbind(aJ,l),aP.removeClass(k+"off "+k+"on")}var b,g,k=ab+"Slideshow_",m="click."+ab;return function(){b?bf.get("slideshow")||(aA.unbind(aL,c),c()):bf.get("slideshow")&&ag[1]&&(b=!0,aA.one(aL,c),bf.get("slideshowAuto")?f():d(),ay.show())}}();aT.colorbox||(aT(aX),au=aT.fn[ac]=aT[ac]=function(b,a){var d,c=this;if(b=b||{},aT.isFunction(c)){c=aT("<a/>"),b.open=!0}else{if(!c[0]){return c}}return c[0]?(aX(),a0()&&(a&&(b.onComplete=a),c.each(function(){var e=aT.data(this,ac)||{};aT.data(this,ac,aT.extend(e,b))}).addClass(af),d=new aV(c[0],b),d.get("open")&&a7(c[0])),c):c},au.position=function(o,j){function b(){aj[0].style.width=a2[0].style.width=bb[0].style.width=parseInt(aP[0].style.width,10)-a3+"px",bb[0].style.height=aC[0].style.height=aw[0].style.height=parseInt(aP[0].style.height,10)-aB+"px"}var a,k,t,f=0,p=0,q=aP.offset();if(az.unbind("resize."+ab),aP.css({top:-90000,left:-90000}),k=az.scrollTop(),t=az.scrollLeft(),bf.get("fixed")?(q.top-=k,q.left-=t,aP.css({position:"fixed"})):(f=k,p=t,aP.css({position:"absolute"})),p+=bf.get("right")!==!1?Math.max(az.width()-bf.w-ap-a3-bd(bf.get("right"),"x"),0):bf.get("left")!==!1?bd(bf.get("left"),"x"):Math.round(Math.max(az.width()-bf.w-ap-a3,0)/2),f+=bf.get("bottom")!==!1?Math.max(aY()-bf.h-aF-aB-bd(bf.get("bottom"),"y"),0):bf.get("top")!==!1?bd(bf.get("top"),"y"):Math.round(Math.max(aY()-bf.h-aF-aB,0)/2),aP.css({top:q.top,left:q.left,visibility:"visible"}),aN[0].style.width=aN[0].style.height="9999px",a={width:bf.w+ap+a3,height:bf.h+aF+aB,top:f,left:p},o){var m=0;aT.each(a,function(c){return a[c]!==aD[c]?(m=o,void 0):void 0}),o=m}aD=a,o||aP.css(a),aP.dequeue().animate(a,{duration:o||0,complete:function(){b(),aW=!1,aN[0].style.width=bf.w+ap+a3+"px",aN[0].style.height=bf.h+aF+aB+"px",bf.get("reposition")&&setTimeout(function(){az.bind("resize."+ab,au.position)},1),j&&j()},step:b})},au.resize=function(a){var b;aH&&(a=a||{},a.width&&(bf.w=bd(a.width,"x")-ap-a3),a.innerWidth&&(bf.w=bd(a.innerWidth,"x")),ar.css({width:bf.w}),a.height&&(bf.h=bd(a.height,"y")-aF-aB),a.innerHeight&&(bf.h=bd(a.innerHeight,"y")),a.innerHeight||a.height||(b=ar.scrollTop(),ar.css({height:"auto"}),bf.h=ar.height()),ar.css({height:bf.h}),b&&ar.scrollTop(b),au.position("none"===bf.get("transition")?0:bf.get("speed")))},au.prep=function(c){function h(){return bf.w=bf.w||ar.width(),bf.w=bf.mw&&bf.mw<bf.w?bf.mw:bf.w,bf.w}function b(){return bf.h=bf.h||ar.height(),bf.h=bf.mh&&bf.mh<bf.h?bf.mh:bf.h,bf.h}if(aH){var f,e="none"===bf.get("transition")?0:bf.get("speed");ar.remove(),ar=aZ(aG,"LoadedContent").append(c),ar.hide().appendTo(aq.show()).css({width:h(),overflow:bf.get("scrolling")?"auto":"hidden"}).css({height:b()}).prependTo(bb),aq.hide(),aT(ai).css({"float":"none"}),ba(bf.get("className")),f=function(){function g(){aT.support.opacity===!1&&aP[0].style.removeAttribute("filter")}var k,j,d=ag.length;aH&&(j=function(){clearTimeout(am),ak.hide(),aS(aa),bf.get("onComplete")},av.html(bf.get("title")).show(),ar.show(),d>1?("string"==typeof bf.get("current")&&al.html(bf.get("current").replace("{current}",aM+1).replace("{total}",d)).show(),at[bf.get("loop")||d-1>aM?"show":"hide"]().html(bf.get("next")),an[bf.get("loop")||aM?"show":"hide"]().html(bf.get("previous")),aI(),bf.get("preloading")&&aT.each([a5(-1),a5(1)],function(){var a,p=ag[this],m=new aV(p,aT.data(p,ac)),l=m.get("href");l&&aU(m,l)&&(l=a1(m,l),a=a8.createElement("img"),a.src=l)})):ao.hide(),bf.get("iframe")?(k=a8.createElement("iframe"),"frameBorder" in k&&(k.frameBorder=0),"allowTransparency" in k&&(k.allowTransparency="true"),bf.get("scrolling")||(k.scrolling="no"),aT(k).attr({src:bf.get("href"),name:(new Date).getTime(),"class":ab+"Iframe",allowFullScreen:!0}).one("load",j).appendTo(ar),aA.one(be,function(){k.src="//about:blank"}),bf.get("fastIframe")&&aT(k).trigger("load")):j(),"fade"===bf.get("transition")?aP.fadeTo(e,1,g):g())},"fade"===bf.get("transition")?aP.fadeTo(e,0,function(){au.position(0,f)}):au.position(e,f)}},au.next=function(){!aW&&ag[1]&&(bf.get("loop")||ag[aM+1])&&(aM=a5(1),a7(ag[aM]))},au.prev=function(){!aW&&ag[1]&&(bf.get("loop")||aM)&&(aM=a5(-1),a7(ag[aM]))},au.close=function(){aH&&!ax&&(ax=!0,aH=!1,aS(aL),bf.get("onCleanup"),az.unbind("."+ab),aR.fadeTo(bf.get("fadeOut")||0,0),aP.stop().fadeTo(bf.get("fadeOut")||0,0,function(){aP.hide(),aR.hide(),aS(be),ar.remove(),setTimeout(function(){ax=!1,aS(aO),bf.get("onClosed")},1)}))},au.remove=function(){aP&&(aP.stop(),aT.colorbox.close(),aP.stop().remove(),aR.remove(),ax=!1,aP=null,aT("."+af).removeData(ac).removeClass(af),aT(a8).unbind("click."+ab))},au.element=function(){return aT(bf.el)},au.settings=ad)})(jQuery,document,window);(function(a){window.CrayonTagEditor=new function(){var j=this;var B=false;var y=false;var e=false;var o,f,r,A,w;var C,t,i,v;var x=0;var k,q;var b=null;var g="";var D=false;var n,p,d;var z,c,u,l,h;var m={inline:true,width:690,height:"90%",closeButton:false,fixed:true,transition:"none",className:"crayon-colorbox",onOpen:function(){a(this.outer).prepend(a(n.bar_content))},onComplete:function(){a(n.code_css).focus()},onCleanup:function(){a(n.bar).prepend(a(n.bar_content))}};j.init=function(){n=CrayonTagEditorSettings;p=CrayonSyntaxSettings;d=CrayonUtil;m.href=n.content_css};j.bind=function(E){if(!B){B=true;j.init()}var s=a(E);s.each(function(G,F){var I=a(F);var H=a('<a class="crayon-tag-editor-button-wrapper"></a>').attr("href",n.content_css);I.after(H);H.append(I);H.colorbox(m)})};j.hide=function(){a.colorbox.close();return false};j.loadDialog=function(s){if(!y){y=true}else{s&&s();return}CrayonUtil.getAJAX({action:"crayon-tag-editor",is_admin:p.is_admin},function(I){z=a('<div id="'+n.css+'"></div>');z.appendTo("body").hide();z.html(I);j.setOrigValues();l=z.find(n.submit_css);h=z.find(n.cancel_css);c=a(n.code_css);u=a("#crayon-te-clear");k=function(){var J=u.is(":visible");if(c.val().length>0&&!J){u.show();c.removeClass(p.selected)}else{if(c.val().length<=0){u.hide()}}};c.keyup(k);c.change(k);u.click(function(){c.val("");c.removeClass(p.selected);c.focus()});var G=a(n.url_css);var F=a(n.url_info_css);var H=CrayonTagEditorSettings.extensions;q=function(){if(G.val().length>0&&!F.is(":visible")){F.show();G.removeClass(p.selected)}else{if(G.val().length<=0){F.hide()}}var L=CrayonUtil.getExt(G.val());if(L){var M=H[L];var K=M?M:L;var J=CrayonTagEditorSettings.fallback_lang;a(n.lang_css+" option").each(function(){if(a(this).val()==K){J=K}});a(n.lang_css).val(J)}};G.keyup(q);G.change(q);var E=function(){var L=a(this);var J=a(this).attr(p.orig_value);if(typeof J=="undefined"){J=""}var M=j.settingValue(L);CrayonUtil.log(L.attr("id")+" value: "+M);var K=null;if(L.is("input[type=checkbox]")){K=L.next("span")}CrayonUtil.log(" >>> "+L.attr("id")+" is "+J+" = "+M);if(J==M){L.removeClass(p.changed);if(K){K.removeClass(p.changed)}}else{L.addClass(p.changed);if(K){K.addClass(p.changed)}}j.settingValue(L,M)};a("."+p.setting+"[id]:not(."+p.special+")").each(function(){a(this).change(E);a(this).keyup(E)});s&&s()})};j.showDialog=function(E){var s=y;j.loadDialog(function(){if(!s){a.colorbox(m)}j._showDialog(E)})};j._showDialog=function(E){E=a.extend({insert:null,edit:null,show:null,hide:j.hide,select:null,editor_str:null,ed:null,node:null,input:null,output:null},E);j.resetSettings();o=E.insert;f=E.edit;r=E.show;A=E.hide;w=E.select;C=E.input;t=E.output;i=E.editor_str;var F=E.node;var F=E.node;D=false;l.unbind();l.click(function(V){j.submitButton();V.preventDefault()});j.setSubmitText(n.submit_add);h.unbind();h.click(function(V){j.hide();V.preventDefault()});if(j.isCrayon(F)){b=a(F);if(b.length!=0){g=b.attr("class");var L=new RegExp("\\b([A-Za-z-]+)"+n.attr_sep+"(\\S+)","gim");var s=L.execAll(g);g=a.trim(g.replace(L,""));var M={};for(var R in s){var J=s[R][1];var N=s[R][2];M[J]=N}var U=b.attr("title");if(U){M.title=U}var H=b.attr("data-url");if(H){M.url=H}if(typeof M.highlight!="undefined"){M.highlight="0"?"1":"0"}D=b.hasClass(n.inline_css);M.inline=D?"1":"0";var S=[];a(n.lang_css+" option").each(function(){var V=a(this).val();if(V){S.push(V)}});if(a.inArray(M.lang,S)==-1){M.lang=n.fallback_lang}M=j.validate(M);for(var O in M){var K=a("#"+p.prefix+O+"."+p.setting);var N=M[O];j.settingValue(K,N);K.change();if(!K.hasClass(p.special)){K.addClass(p.changed);if(K.is("input[type=checkbox]")){highlight=K.next("span");highlight.addClass(p.changed)}}CrayonUtil.log("loaded: "+O+":"+N)}e=true;j.setSubmitText(n.submit_edit);var Q=b.html();if(C=="encode"){Q=CrayonUtil.encode_html(Q)}else{if(C=="decode"){Q=CrayonUtil.decode_html(Q)}}c.val(Q)}else{CrayonUtil.log("cannot load currNode of type pre")}}else{if(w){c.val(w)}e=false;j.setSubmitText(n.submit_add);b=null;g=""}var G=a("#"+n.inline_css);G.change(function(){D=a(this).is(":checked");var V=a("."+n.inline_hide_css);var Z=a("."+n.inline_hide_only_css);var X=[n.mark_css,n.range_css,n.title_css,n.url_css];for(var W in X){var Y=a(X[W]);Y.attr("disabled",D)}if(D){V.hide();Z.hide();V.closest("tr").hide();for(var W in X){var Y=a(X[W]);Y.addClass("crayon-disabled")}}else{V.show();Z.show();V.closest("tr").show();for(var W in X){var Y=a(X[W]);Y.removeClass("crayon-disabled")}}});G.change();var I=e?n.edit_text:n.add_text;a(n.dialog_title_css).html(I);if(r){r()}c.focus();k();q();if(v){clearInterval(v);x=0}var T=a("#TB_window");T.hide();var P=function(){T.show();var V=a(window).scrollTop();a(window).scrollTop(V+10);a(window).scrollTop(V-10)};v=setInterval(function(){if(typeof T!="undefined"&&!T.hasClass("crayon-te-ajax")){T.addClass("crayon-te-ajax");clearInterval(v);P()}if(x>=100){clearInterval(v);P()}x++},40)};j.addCrayon=function(){var E=a(n.url_css);if(E.val().length==0&&c.val().length==0){c.addClass(p.selected);c.focus();return false}c.removeClass(p.selected);var M=a("#"+n.inline_css);D=M.length!=0&&M.is(":checked");var G=br_after="";if(!e){if(!D){if(i=="html"){br_after=G=" \n"}else{br_after="<p>&nbsp;</p>"}}else{if(i=="html"){br_after=G=" "}else{br_after="&nbsp;"}}}var P=(D?"span":"pre");var I=G+"<"+P+" ";var K={};I+='class="';var s=new RegExp("\\b"+n.inline_css+"\\b","gim");if(D){if(s.exec(g)==null){g+=" "+n.inline_css+" "}}else{g=g.replace(s,"")}a("."+p.changed+"[id],."+p.changed+"["+n.data_value+"]").each(function(){var R=a(this).attr("id");var Q=a(this).attr(n.data_value);R=d.removePrefixFromID(R);K[R]=Q});K.lang=a(n.lang_css).val();var H=a(n.mark_css).val();if(H.length!=0&&!D){K.mark=H}var J=a(n.range_css).val();if(J.length!=0&&!D){K.range=J}if(a(n.hl_css).is(":checked")){K.highlight="0"}K.decode="true";K=j.validate(K);for(var F in K){var O=K[F];CrayonUtil.log("add "+F+":"+O);I+=F+n.attr_sep+O+" "}I+=g;I+='" ';if(!D){var N=a(n.title_css).val();if(N.length!=0){I+='title="'+N+'" '}var E=a(n.url_css).val();if(E.length!=0){I+='data-url="'+E+'" '}}var L=a(n.code_css).val();if(t=="encode"){L=CrayonUtil.encode_html(L)}else{if(t=="decode"){L=CrayonUtil.decode_html(L)}}L=typeof L!="undefined"?L:"";I+=">"+L+"</"+P+">"+br_after;if(e&&f){f(I)}else{if(o){o(I)}}return true};j.submitButton=function(){CrayonUtil.log("submit");if(j.addCrayon()!=false){j.hideDialog()}};j.hideDialog=function(){CrayonUtil.log("hide");if(A){A()}};j.setOrigValues=function(){a("."+p.setting+"[id]").each(function(){var s=a(this);s.attr(p.orig_value,j.settingValue(s))})};j.resetSettings=function(){CrayonUtil.log("reset");a("."+p.setting).each(function(){var s=a(this);j.settingValue(s,s.attr(p.orig_value));s.change()});c.val("")};j.settingValue=function(s,E){if(typeof E=="undefined"){E="";if(s.is("input[type=checkbox]")){E=s.is(":checked")?"true":"false"}else{E=s.val()}return E}else{if(s.is("input[type=checkbox]")){if(typeof E=="string"){if(E=="true"||E=="1"){E=true}else{if(E=="false"||E=="0"){E=false}}}s.prop("checked",E)}else{s.val(E)}s.attr(n.data_value,E)}};j.validate=function(G){var s=["range","mark"];for(var E in s){var F=s[E];if(typeof G[F]!="undefined"){G[F]=G[F].replace(/\s/g,"")}}return G};j.isCrayon=function(s){return s!=null&&(s.nodeName=="PRE"||(s.nodeName=="SPAN"&&a(s).hasClass(n.inline_css)))};j.elemValue=function(E){var s=null;if(E.is("input[type=checkbox]")){s=E.is(":checked")}else{s=E.val()}return s};j.setSubmitText=function(s){l.html(s)}}})(jQueryCrayon);
langs/extensions.txt CHANGED
@@ -9,6 +9,7 @@ c++ h hh hpp hxx h++ cc cpp cxx c++
9
  html html htm xhtml xhtm xml xsd
10
  java java class jar
11
  objc m mm
 
12
  python py pyw pyc pyo pyd
13
  vb vbs
14
  ruby rb rbx rhtml
9
  html html htm xhtml xhtm xml xsd
10
  java java class jar
11
  objc m mm
12
+ papyrus psc
13
  python py pyw pyc pyo pyd
14
  vb vbs
15
  ruby rb rbx rhtml
langs/go/go.txt CHANGED
@@ -10,7 +10,7 @@
10
  STRING (?default)
11
 
12
  STATEMENT \b(?alt:statement.txt)\b
13
- RESERVED (?default)
14
  TYPE (?default)
15
  MODIFIER (?default)
16
 
10
  STRING (?default)
11
 
12
  STATEMENT \b(?alt:statement.txt)\b
13
+ RESERVED (?default)|\b(?alt:reserved.txt)\b
14
  TYPE (?default)
15
  MODIFIER (?default)
16
 
langs/ocaml/function.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ string_of_float
2
+ float_of_string
3
+ string_of_bool
4
+ bool_of_string
5
+ string_of_int
6
+ int_of_string
7
+ int_of_char
8
+ char_of_int
9
+ truncate
10
+ float
11
+ log10
12
+ floor
13
+ ceil
14
+ sqrt
15
+ acos
16
+ asin
17
+ atan
18
+ max
19
+ min
20
+ not
21
+ mod
22
+ cos
23
+ sin
24
+ tan
25
+ abs
26
+ exp
27
+ log
langs/ocaml/ocaml.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### OCaml LANGUAGE ###
2
+
3
+ # ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
4
+
5
+ NAME OCaml
6
+ VERSION 0.1.1
7
+
8
+ COMMENT \(\*.*?\*\)
9
+
10
+ # Get rid of 'xxxx' string because we can have 'a type name or a''' variable name in ocaml
11
+ STRING ((?<![^\\]\\)".*?(?<![^\\]\\)")
12
+
13
+ # This list(file: reserved.txt) is taken from:
14
+ # http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual044.html
15
+ # Sort the words: awk '{print length, $0}' x.words | sort -nr | awk '{print $2}'
16
+ RESERVED \b(?alt:reserved.txt)\b
17
+
18
+ # Basic types taken from:
19
+ # http://www.csc.villanova.edu/~dmatusze/resources/ocaml/ocaml.html#Types
20
+ TYPE \b(?alt:type.txt)\b
21
+
22
+ # These functions are also taken from previous page.
23
+ # There are acting more like operators
24
+ KEYWORD \b(?alt:function.txt)\b
25
+
26
+ ENTITY (?default)
27
+
28
+ CAPS:VARIABLE (?-i)\b[A-Z]\w+\b(?i)
29
+
30
+ IDENTIFIER (?default)
31
+ CONSTANT (?default)
32
+
33
+ # Taken from previous page.
34
+ # Might not be complete
35
+ OPERATOR (?alt:operator.txt)
36
+ SYMBOL (?default)
langs/ocaml/operator.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <=
2
+ >=
3
+ <>
4
+ ==
5
+ !=
6
+ &&
7
+ ||
8
+ |>
9
+ <-
10
+ ->
11
+ +.
12
+ -.
13
+ *.
14
+ /.
15
+ **
16
+ ::
17
+ :=
18
+ @
19
+ ^
20
+ <
21
+ =
22
+ +
23
+ -
24
+ *
25
+ /
26
+ :
27
+ |
28
+ =
29
+ <
30
+ >
31
+ .
langs/ocaml/reserved.txt ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ initializer
2
+ constraint
3
+ exception
4
+ inherit!
5
+ function
6
+ external
7
+ virtual
8
+ private
9
+ mutable
10
+ method!
11
+ inherit
12
+ include
13
+ functor
14
+ struct
15
+ object
16
+ module
17
+ method
18
+ downto
19
+ assert
20
+ while
21
+ match
22
+ false
23
+ class
24
+ begin
25
+ raise
26
+ with
27
+ when
28
+ val!
29
+ type
30
+ true
31
+ then
32
+ open
33
+ lazy
34
+ else
35
+ done
36
+ val
37
+ try
38
+ sig
39
+ rec
40
+ new
41
+ let
42
+ fun
43
+ for
44
+ end
45
+ and
46
+ to
47
+ or
48
+ of
49
+ in
50
+ if
51
+ do
52
+ as
langs/ocaml/type.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ string
2
+ float
3
+ unit
4
+ bool
5
+ char
6
+ int
langs/papyrus/papyrus.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### PAPYRUS LANGUAGE ###
2
+
3
+ # ELEMENT_NAME [optional-css-class] REGULAR_EXPRESSION
4
+
5
+ NAME Papyrus
6
+ VERSION 1.0.0
7
+
8
+ COMMENT ({.*?})|(;.*?$)
9
+ STRING (?default)
10
+
11
+ STATEMENT (?default)|\b(?alt:statement.txt)\b
12
+ RESERVED (?default)|\b(?alt:reserved.txt)\b
13
+ ENTITY (?default)|\b(?alt:type.txt)\b
14
+
15
+ VARIABLE (?default)
16
+ IDENTIFIER (?default)
17
+ CONSTANT (?default)
18
+ OPERATOR (?default)
19
+ SYMBOL (?default)
20
+
21
+
22
+
23
+
langs/papyrus/reserved.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ as
2
+ auto
3
+ autoreadonly
4
+ bool
5
+ conditional
6
+ debug
7
+ else
8
+ elseif
9
+ endproperty
10
+ extends
11
+ false
12
+ float
13
+ game
14
+ global
15
+ hidden
16
+ import
17
+ int
18
+ length
19
+ new
20
+ none
21
+ parent
22
+ property
23
+ return
24
+ scriptname
25
+ self
26
+ string
27
+ true
28
+ utility
langs/papyrus/statement.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ event
2
+ function
3
+ if
4
+ state
5
+ while
6
+ endevent
7
+ endfunction
8
+ endif
9
+ endstate
10
+ endwhile
11
+ native
langs/papyrus/type.txt ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ action
2
+ activator
3
+ activemagiceffect
4
+ actor
5
+ actorbase
6
+ alias
7
+ ammo
8
+ apparatus
9
+ armor
10
+ associationtype
11
+ book
12
+ cell
13
+ class
14
+ constructibleobject
15
+ container
16
+ debug
17
+ door
18
+ effectshader
19
+ enchantment
20
+ encounterzone
21
+ explosion
22
+ faction
23
+ flora
24
+ form
25
+ formlist
26
+ furniture
27
+ game
28
+ globalvariable
29
+ hazard
30
+ idle
31
+ imagespacemodifier
32
+ impactdataset
33
+ ingredient
34
+ key
35
+ keyword
36
+ leveledactor
37
+ leveleditem
38
+ leveledspell
39
+ light
40
+ location
41
+ locationalias
42
+ locationreftype
43
+ magiceffect
44
+ math
45
+ message
46
+ miscobject
47
+ musictype
48
+ objectreference
49
+ outfit
50
+ package
51
+ perk
52
+ potion
53
+ projectile
54
+ quest
55
+ race
56
+ referencealias
57
+ scene
58
+ scroll
59
+ shout
60
+ soulgem
61
+ sound
62
+ soundcategory
63
+ spell
64
+ static
65
+ talkingactivator
66
+ topic
67
+ topicinfo
68
+ utility
69
+ visualeffect
70
+ voicetype
71
+ weapon
72
+ weather
73
+ wordofpower
74
+ worldspace
langs/php/compile.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  __NAMESPACE__
2
  __METHOD__
3
  __FUNCTION__
@@ -5,3 +6,4 @@ __LINE__
5
  __FILE__
6
  __DIR__
7
  __CLASS__
 
1
+ # http://php.net/manual/en/language.constants.predefined.php
2
  __NAMESPACE__
3
  __METHOD__
4
  __FUNCTION__
6
  __FILE__
7
  __DIR__
8
  __CLASS__
9
+ __TRAIT__
langs/php/construct.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  unset
2
  print
3
  return
@@ -12,3 +13,6 @@ exit
12
  empty
13
  echo
14
  die
 
 
 
1
+ # http://php.net/manual/en/reserved.keywords.php
2
  unset
3
  print
4
  return
13
  empty
14
  echo
15
  die
16
+ yield
17
+ trait
18
+ insteadof
langs/ruby/ruby.txt CHANGED
@@ -14,7 +14,7 @@
14
  MODULE:KEYWORD \b(?alt:module.txt)\b
15
  EXCEPTION:KEYWORD \b(?alt:exception.txt)\b
16
  STATEMENT \b(?alt:statement.txt)\b
17
- RESERVED (?alt:reserved.txt)
18
  TYPE \b(?alt:type.txt)\b
19
  MODIFIER \b(?alt:modifier.txt)\b
20
 
14
  MODULE:KEYWORD \b(?alt:module.txt)\b
15
  EXCEPTION:KEYWORD \b(?alt:exception.txt)\b
16
  STATEMENT \b(?alt:statement.txt)\b
17
+ RESERVED \b(?alt:reserved.txt)\b
18
  TYPE \b(?alt:type.txt)\b
19
  MODIFIER \b(?alt:modifier.txt)\b
20
 
langs/swift/swift.txt CHANGED
@@ -5,7 +5,7 @@
5
  NAME Swift
6
  VERSION 1.0
7
 
8
- COMMENT (?default)
9
  STRING (?default)
10
 
11
  STATEMENT (?default)
5
  NAME Swift
6
  VERSION 1.0
7
 
8
+ COMMENT (/\*(?R)|(.*?)\*/)|(//.*?$)
9
  STRING (?default)
10
 
11
  STATEMENT (?default)
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=AW99E
4
  License: GPLv2 or later
5
  Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter, bbpress
6
  Requires at least: 3.0
7
- Tested up to: 4.0.0
8
  Stable tag: trunk
9
 
10
  Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
@@ -105,6 +105,7 @@ See the <a href="http://aramk.com/blog/2011/09/23/crayon-language-file-specifica
105
  * Java
106
  * JavaScript
107
  * Objective-C
 
108
  * Perl
109
  * PHP
110
  * PL/SQL
@@ -146,6 +147,7 @@ See the <a href="http://aramk.com/blog/2011/09/23/crayon-language-file-specifica
146
  * Slovak (thanks to Branco, <a href="https://twitter.com/#!/webhostgeeks" target="_blank">webhostgeeks/</a>)
147
  * Slovenian (thanks to Jan Su&#353;nik, <a href="http://jodlajodla.si/" target="_blank">http://jodlajodla.si/</a>)
148
  * Spanish (thanks to <a href="http://www.hbravo.com/" target="_blank">Hermann Bravo</a>)
 
149
  * Turkish (thanks to <a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>)
150
  * Ukrainian (thanks to <a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)
151
  * Help from translators at improving/adding to this list greatly appreciated!
@@ -196,6 +198,23 @@ A handful of articles from others written about Crayon, thanks guys!
196
 
197
  Thanks to all those who donate to the project:
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  * Raffael Vogler, Germany
200
  * Erdal Cicek, Turkey
201
  * Cloud-VPS, Poland
@@ -278,9 +297,36 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
278
 
279
  == Changelog ==
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  = 2.6.8 =
282
  * ADDED:
283
- * OCaml langauge thanks to <a href="https://github.com/zhenjie" target="_blank">zhenjie</a>
284
  * Added Capacitacionti theme
285
  * FIXED:
286
  * SVN issue with old versions of JS and CSS resources being deployed instead of the latest from the dev repo.
@@ -1135,4 +1181,3 @@ http://wordpress.org/support/topic/plugin-crayon-syntax-highlighter-this-plugin-
1135
  == Upgrade Notice ==
1136
 
1137
  Make sure to upgrade to the latest release when possible to ensure you avoid bugs others have found and enjoy new features.
1138
-
4
  License: GPLv2 or later
5
  Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter, bbpress
6
  Requires at least: 3.0
7
+ Tested up to: 4.1.0
8
  Stable tag: trunk
9
 
10
  Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
105
  * Java
106
  * JavaScript
107
  * Objective-C
108
+ * Papyrus
109
  * Perl
110
  * PHP
111
  * PL/SQL
147
  * Slovak (thanks to Branco, <a href="https://twitter.com/#!/webhostgeeks" target="_blank">webhostgeeks/</a>)
148
  * Slovenian (thanks to Jan Su&#353;nik, <a href="http://jodlajodla.si/" target="_blank">http://jodlajodla.si/</a>)
149
  * Spanish (thanks to <a href="http://www.hbravo.com/" target="_blank">Hermann Bravo</a>)
150
+ * Tamil (thanks to <a href="http://kks21199.mrgoogleglass.com/" target="_blank">KKS21199</a>)
151
  * Turkish (thanks to <a href="http://hakanertr.wordpress.com" target="_blank">Hakan</a>)
152
  * Ukrainian (thanks to <a href="http://getvoip.com/blog" target="_blank">Michael Yunat</a>)
153
  * Help from translators at improving/adding to this list greatly appreciated!
198
 
199
  Thanks to all those who donate to the project:
200
 
201
+ * ZengChun Yang, China
202
+ * Alan Kaplan, (http://www.akaplan.com/blog), US
203
+ * Christopher Yarbrough, (http://chrisyarbrough.com/), Germany
204
+ * Johann Weiher, (http://codequartett.de/), Germany
205
+ * Samuel Deering, Australia
206
+ * Billiard Greg, (http://billiardgreg.com/), USA
207
+ * Performance Simulations, (http://www.performancesimulations.com/), USA
208
+ * Lindsay Ross, (http://gravelrash.com), New Zealand
209
+ * Ruperto Coronado Muñoz, Mexico
210
+ * Stefan Onderka, (http://www.onderka.com), Germany
211
+ * Peter Kellner, (http://peterkellner.net), USA
212
+ * Open Hardware Design Group LLC, (http://opensourcehardwaregroup.com/), USA
213
+ * Helen McManus, (http://invisiblepixels.org/InvisibleWords/), Netherlands
214
+ * Thomas Fee, UK
215
+ * Julie Knowles, (http://knowlesfamily.com/), USA
216
+ * Peter Kriegel, (http://www.powershell-group.eu/), Germany
217
+ * Geo My WP, (http://geomywp.com), USA
218
  * Raffael Vogler, Germany
219
  * Erdal Cicek, Turkey
220
  * Cloud-VPS, Poland
297
 
298
  == Changelog ==
299
 
300
+ = 2.6.10 =
301
+ * ADDED:
302
+ * Option to load crayon script in the footer to improve loading performance (thanks to <a href="https://github.com/sumhat" target="_blank">sumhat</a>).
303
+ * X3Info theme
304
+ * Papyrus language
305
+ * FIXED:
306
+ * Support for nested multi-line strings in Swift language (thanks to <a href="https://github.com/nicolafiorillo" target="_blank">nicolafiorillo</a>).
307
+ * CrayonFormatter::print_error() called non-statically (thanks to <a href="https://github.com/ksubileau" target="_blank">https://github.com/ksubileau</a>)
308
+ * Admin CSS issue: https://github.com/aramk/crayon-syntax-highlighter/issues/250.
309
+ * Table style incompatibility with WP 2015 theme.
310
+ * Wrapped text now breaks per character.
311
+
312
+ = 2.6.9 =
313
+ * ADDED:
314
+ * Setting to disable Crayon for posts older than a given date (thanks to <a href="https://github.com/weismannweb" target="_blank">weismannweb</a>).
315
+ * Support for changing the text shown for "Add Code" and "Edit Code" buttons in the Tag Editor.
316
+ * Orange Code theme.
317
+ * Raygun theme.
318
+ * Tamil language.
319
+ * FIXED:
320
+ * Missing PHP keywords thanks to <a href="https://github.com/tst" target="_blank">tst</a>.
321
+ * Error with undefined HTTP_USER_AGENT thanks to Enrique Cordero.
322
+ * Removed misused error control operator.
323
+ * HTTPS check for whether to use https://
324
+ * Selection CSS style for plain code.
325
+ * Reserved keywords in Ruby.
326
+
327
  = 2.6.8 =
328
  * ADDED:
329
+ * OCaml language thanks to <a href="https://github.com/zhenjie" target="_blank">zhenjie</a>
330
  * Added Capacitacionti theme
331
  * FIXED:
332
  * SVN issue with old versions of JS and CSS resources being deployed instead of the latest from the dev repo.
1181
  == Upgrade Notice ==
1182
 
1183
  Make sure to upgrade to the latest release when possible to ensure you avoid bugs others have found and enjoy new features.
 
themes/1c-kod/1c-kod.css CHANGED
@@ -1,6 +1,6 @@
1
  /*
2
- Name: 1C (���)
3
- Description: ����� ��� ��������� ���� 1C
4
  Version: 1.0
5
  Author: Oparin Pavel
6
  URL: http://oparin.info
@@ -22,13 +22,6 @@ URL: http://oparin.info
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
25
- .crayon-theme-1c-kod *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-1c-kod .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-1c-kod .crayon-striped-line {
33
  background: #f7f7f7 !important;
34
  }
1
  /*
2
+ Name: 1C (���)
3
+ Description: ����� ��� ��������� ���� 1C
4
  Version: 1.0
5
  Author: Oparin Pavel
6
  URL: http://oparin.info
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-1c-kod .crayon-striped-line {
26
  background: #f7f7f7 !important;
27
  }
themes/1c-zapros/1c-zapros.css CHANGED
@@ -1,6 +1,6 @@
1
  /*
2
- Name: 1C (������)
3
- Description: ����� ��� ��������� ������� 1C
4
  Version: 1.0
5
  Author: Oparin Pavel
6
  URL: http://oparin.info
@@ -22,13 +22,6 @@ URL: http://oparin.info
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
25
- .crayon-theme-1c-zapros *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-1c-zapros .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-1c-zapros .crayon-striped-line {
33
  background: #f7f7f7 !important;
34
  }
1
  /*
2
+ Name: 1C (������)
3
+ Description: ����� ��� ��������� ������� 1C
4
  Version: 1.0
5
  Author: Oparin Pavel
6
  URL: http://oparin.info
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-1c-zapros .crayon-striped-line {
26
  background: #f7f7f7 !important;
27
  }
themes/809finest/809finest.css CHANGED
@@ -21,13 +21,6 @@ URL: http://809finest.com
21
  color: #ffffff !important;
22
  background: #BB0A1C !important;
23
  }
24
- .crayon-theme-809finest *::selection {
25
- background: transparent !important;
26
- }
27
- .crayon-theme-809finest .crayon-code *::selection {
28
- background: #ddeeff !important;
29
- color: #316ba5 !important;
30
- }
31
  .crayon-theme-809finest .crayon-striped-line {
32
  background: #162E53 !important;
33
  }
21
  color: #ffffff !important;
22
  background: #BB0A1C !important;
23
  }
 
 
 
 
 
 
 
24
  .crayon-theme-809finest .crayon-striped-line {
25
  background: #162E53 !important;
26
  }
themes/ado/ado.css CHANGED
@@ -28,11 +28,8 @@ URL: http://www.adostudio.it/
28
  border-right-style: solid !important;
29
  border-right-color: #202020 !important;
30
  }
31
- .crayon-theme-ado .crayon-code::selection {
32
- background: #BBEEDA !important;
33
- color: #269B6C !important;
34
- }
35
- .crayon-theme-ado .crayon-code *::selection {
36
  background: #BBEEDA !important;
37
  color: #269B6C !important;
38
  }
28
  border-right-style: solid !important;
29
  border-right-color: #202020 !important;
30
  }
31
+ .crayon-theme-ado .crayon-code *::selection,
32
+ .crayon-theme-ado .crayon-plain::selection {
 
 
 
33
  background: #BBEEDA !important;
34
  color: #269B6C !important;
35
  }
themes/arduino-ide/arduino-ide.css CHANGED
@@ -21,13 +21,6 @@ Url: http://majsterkowo.pl
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
24
- .crayon-theme-arduino-ide *::selection {
25
- background: transparent !important;
26
- }
27
- .crayon-theme-arduino-ide .crayon-code *::selection {
28
- background: #ddeeff !important;
29
- color: #316ba5 !important;
30
- }
31
  .crayon-theme-arduino-ide .crayon-striped-line {
32
  background: #fafafa !important;
33
  }
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
 
 
 
 
 
 
 
24
  .crayon-theme-arduino-ide .crayon-striped-line {
25
  background: #fafafa !important;
26
  }
themes/bncplusplus/bncplusplus.css CHANGED
@@ -23,13 +23,6 @@ URL: http://shipuahamed.blogspot.com/ http://bncplusplus.tk
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
26
- .crayon-theme-bncplusplus *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-bncplusplus .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-bncplusplus .crayon-striped-line {
34
  background: #000000 !important;
35
  }
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-bncplusplus .crayon-striped-line {
27
  background: #000000 !important;
28
  }
themes/capacitacionti/capacitacionti.css ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name: Capacitacionti
3
+ Description: Terminal en Ubuntu Server.
4
+ Version: 1.0
5
+ Author: Henry Taype
6
+ URL: http://capacitacionti.com/
7
+ */
8
+ .crayon-theme-capacitacionti {
9
+ border-width: 1px !important;
10
+ border-color: #999 !important;
11
+ border-style: solid !important;
12
+ text-shadow: none !important;
13
+ background: #167378 !important;
14
+ }
15
+ .crayon-theme-capacitacionti-inline {
16
+ border-width: 1px !important;
17
+ border-color: #ddd !important;
18
+ border-style: solid !important;
19
+ background: #22BCB4 !important;
20
+ }
21
+ .crayon-theme-capacitacionti .crayon-table .crayon-nums {
22
+ background: #22BCB4 !important;
23
+ color: #AEDE3D !important;
24
+ border-right-color: #22BCB4 !important;
25
+ border-right-width: 2px !important;
26
+ border-right-style: solid !important;
27
+ }
28
+ .crayon-theme-capacitacionti .crayon-striped-line {
29
+ background: #167378 !important;
30
+ }
31
+ .crayon-theme-capacitacionti .crayon-striped-num {
32
+ background: #22BCB4 !important;
33
+ color: #AEDE3D !important;
34
+ }
35
+ .crayon-theme-capacitacionti .crayon-marked-line {
36
+ background: #167378 !important;
37
+ border-width: 1px !important;
38
+ border-color: #22BCB4 !important;
39
+ }
40
+ .crayon-theme-capacitacionti .crayon-marked-num {
41
+ color: #AEDE3D !important;
42
+ background: #22BCB4 !important;
43
+ border-width: 1px !important;
44
+ border-color: #22BCB4 !important;
45
+ }
46
+ .crayon-theme-capacitacionti .crayon-marked-line.crayon-striped-line {
47
+ background: #167378 !important;
48
+ }
49
+ .crayon-theme-capacitacionti .crayon-marked-num.crayon-striped-num {
50
+ background: #22BCB4 !important;
51
+ color: #AEDE3D !important;
52
+ }
53
+ .crayon-theme-capacitacionti .crayon-marked-line.crayon-top {
54
+ border-top-style: solid !important;
55
+ }
56
+ .crayon-theme-capacitacionti .crayon-marked-num.crayon-top {
57
+ border-top-style: solid !important;
58
+ }
59
+ .crayon-theme-capacitacionti .crayon-marked-line.crayon-bottom {
60
+ border-bottom-style: solid !important;
61
+ }
62
+ .crayon-theme-capacitacionti .crayon-marked-num.crayon-bottom {
63
+ border-bottom-style: solid !important;
64
+ }
65
+ .crayon-theme-capacitacionti .crayon-info {
66
+ background: #faf9d7 !important;
67
+ border-bottom-width: 1px !important;
68
+ border-bottom-color: #b1af5e !important;
69
+ border-bottom-style: solid !important;
70
+ color: #7e7d34 !important;
71
+ }
72
+ .crayon-theme-capacitacionti .crayon-toolbar {
73
+ background: #00595E !important;
74
+ border-bottom-width: 1px !important;
75
+ border-bottom-color: #22BCB4 !important;
76
+ border-bottom-style: solid !important;
77
+ }
78
+ .crayon-theme-capacitacionti .crayon-toolbar > div {
79
+ float: left !important;
80
+ }
81
+ .crayon-theme-capacitacionti .crayon-toolbar .crayon-tools {
82
+ float: right !important;
83
+ }
84
+ .crayon-theme-capacitacionti .crayon-title {
85
+ color: #aede3d !important;
86
+ font-weight: bold !important;
87
+ }
88
+ .crayon-theme-capacitacionti .crayon-language {
89
+ color: #aede3d !important;
90
+ background-color: #00595E !important;
91
+ }
92
+ .crayon-theme-capacitacionti .crayon-button {
93
+ background-color: #C5E486 !important;
94
+ }
95
+ .crayon-theme-capacitacionti .crayon-button:hover {
96
+ background-color: #9FCF2E !important;
97
+ color: #666;
98
+ }
99
+ .crayon-theme-capacitacionti .crayon-button.crayon-pressed:hover {
100
+ background-color: #9FCF2E !important;
101
+ color: #666;
102
+ }
103
+ .crayon-theme-capacitacionti .crayon-button.crayon-pressed {
104
+ background-color: #7FB718 !important;
105
+ color: #FFF;
106
+ }
107
+ .crayon-theme-capacitacionti .crayon-button.crayon-pressed:active {
108
+ background-color: #7FB718 !important;
109
+ color: #FFF;
110
+ }
111
+ .crayon-theme-capacitacionti .crayon-button:active {
112
+ background-color: #7FB718 !important;
113
+ color: #FFF;
114
+ }
115
+ .crayon-theme-capacitacionti .crayon-pre {
116
+ color: #AEDE3D !important;
117
+ }
118
+ .crayon-theme-capacitacionti .crayon-pre .crayon-c {
119
+ color: #AEDE3D !important;
120
+ }
121
+ .crayon-theme-capacitacionti .crayon-pre .crayon-s {
122
+ color: #AEDE3D !important;
123
+ }
124
+ .crayon-theme-capacitacionti .crayon-pre .crayon-p {
125
+ color: #AEDE3D !important;
126
+ }
127
+ .crayon-theme-capacitacionti .crayon-pre .crayon-ta {
128
+ color: #AEDE3D !important;
129
+ }
130
+ .crayon-theme-capacitacionti .crayon-pre .crayon-k {
131
+ color: #AEDE3D !important;
132
+ }
133
+ .crayon-theme-capacitacionti .crayon-pre .crayon-st {
134
+ color: #AEDE3D !important;
135
+ }
136
+ .crayon-theme-capacitacionti .crayon-pre .crayon-r {
137
+ color: #AEDE3D !important;
138
+ }
139
+ .crayon-theme-capacitacionti .crayon-pre .crayon-t {
140
+ color: #AEDE3D !important;
141
+ }
142
+ .crayon-theme-capacitacionti .crayon-pre .crayon-m {
143
+ color: #AEDE3D !important;
144
+ }
145
+ .crayon-theme-capacitacionti .crayon-pre .crayon-i {
146
+ color: #AEDE3D !important;
147
+ }
148
+ .crayon-theme-capacitacionti .crayon-pre .crayon-e {
149
+ color: #AEDE3D !important;
150
+ }
151
+ .crayon-theme-capacitacionti .crayon-pre .crayon-v {
152
+ color: #AEDE3D !important;
153
+ }
154
+ .crayon-theme-capacitacionti .crayon-pre .crayon-cn {
155
+ color: #AEDE3D !important;
156
+ }
157
+ .crayon-theme-capacitacionti .crayon-pre .crayon-o {
158
+ color: #AEDE3D !important;
159
+ }
160
+ .crayon-theme-capacitacionti .crayon-pre .crayon-sy {
161
+ color: #AEDE3D !important;
162
+ }
163
+ .crayon-theme-capacitacionti .crayon-pre .crayon-n {
164
+ color: #AEDE3D !important;
165
+ font-style: italic !important;
166
+ }
167
+ .crayon-theme-capacitacionti .crayon-pre .crayon-f {
168
+ color: #AEDE3D !important;
169
+ }
170
+ .crayon-theme-capacitacionti .crayon-pre .crayon-h {
171
+ color: #AEDE3D !important;
172
+ }
themes/cg-cookie/cg-cookie.css CHANGED
@@ -23,13 +23,6 @@ URL: http://cgcookie.com
23
  border-right-color: #8c8d8f !important;
24
  border-right-style: dashed !important;
25
  }
26
- .crayon-theme-cg-cookie *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-cg-cookie .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-cg-cookie .crayon-striped-line {
34
  background: #24272e !important;
35
  }
23
  border-right-color: #8c8d8f !important;
24
  border-right-style: dashed !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-cg-cookie .crayon-striped-line {
27
  background: #24272e !important;
28
  }
themes/cisco-router/cisco-router.css CHANGED
@@ -25,13 +25,6 @@ URL: http://aramk.com/
25
  border-right-width: 2 !important;
26
  border-right-style: solid !important;
27
  }
28
- .crayon-theme-cisco-router *::selection {
29
- background: transparent !important;
30
- }
31
- .crayon-theme-cisco-router .crayon-code *::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
  .crayon-theme-cisco-router .crayon-striped-line {
36
  background: #000000 !important;
37
  }
25
  border-right-width: 2 !important;
26
  border-right-style: solid !important;
27
  }
 
 
 
 
 
 
 
28
  .crayon-theme-cisco-router .crayon-striped-line {
29
  background: #000000 !important;
30
  }
themes/classic/classic.css CHANGED
@@ -22,13 +22,6 @@ URL: http://aramk.com/
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
25
- .crayon-theme-classic *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-classic .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-classic .crayon-striped-line {
33
  background: #f7f7f7 !important;
34
  }
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-classic .crayon-striped-line {
26
  background: #f7f7f7 !important;
27
  }
themes/coda-special-board/coda-special-board.css CHANGED
@@ -32,35 +32,6 @@ URL: http://www.refuseall.it
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
35
- .crayon-theme-coda-special-board .crayon-code::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-coda-special-board .crayon-code *::selection {
40
- background: #ddeeff !important;
41
- color: #316ba5 !important;
42
- }
43
- .crayon-theme-coda-special-board::selection {
44
- background: transparent !important;
45
- }
46
- .crayon-theme-coda-special-board .crayon-toolbar::selection {
47
- background: transparent !important;
48
- }
49
- .crayon-theme-coda-special-board .crayon-toolbar *::selection {
50
- background: transparent !important;
51
- }
52
- .crayon-theme-coda-special-board .crayon-info::selection {
53
- background: transparent !important;
54
- }
55
- .crayon-theme-coda-special-board .crayon-info *::selection {
56
- background: transparent !important;
57
- }
58
- .crayon-theme-coda-special-board .crayon-nums::selection {
59
- background: transparent !important;
60
- }
61
- .crayon-theme-coda-special-board .crayon-nums *::selection {
62
- background: transparent !important;
63
- }
64
  .crayon-theme-coda-special-board .crayon-striped-line {
65
  background: #343434 !important;
66
  border-width: 1px !important;
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  .crayon-theme-coda-special-board .crayon-striped-line {
36
  background: #343434 !important;
37
  border-width: 1px !important;
themes/dark-terminal/dark-terminal.css CHANGED
@@ -20,23 +20,16 @@ URL: http://blog.naydenov.net/
20
  }
21
  .crayon-theme-dark-terminal .crayon-table .crayon-nums {
22
  background: #000000 !important;
23
- color: #000000 !important;
24
  border-right-width: 1px !important;
25
  border-right-color: #ffffff !important;
26
  }
27
- .crayon-theme-dark-terminal *::selection {
28
- background: transparent !important;
29
- }
30
- .crayon-theme-dark-terminal .crayon-code *::selection {
31
- background: #ddeeff !important;
32
- color: #316ba5 !important;
33
- }
34
  .crayon-theme-dark-terminal .crayon-striped-line {
35
  background: #000000 !important;
36
  }
37
  .crayon-theme-dark-terminal .crayon-striped-num {
38
  background: #000000 !important;
39
- color: #000000 !important;
40
  }
41
  .crayon-theme-dark-terminal .crayon-marked-line {
42
  background: #3b3b3b !important;
@@ -44,7 +37,7 @@ URL: http://blog.naydenov.net/
44
  border-color: #3a3a47 !important;
45
  }
46
  .crayon-theme-dark-terminal .crayon-marked-num {
47
- color: #000000 !important;
48
  background: #000000 !important;
49
  border-width: 1px !important;
50
  border-color: #000000 !important;
@@ -54,7 +47,7 @@ URL: http://blog.naydenov.net/
54
  }
55
  .crayon-theme-dark-terminal .crayon-marked-num.crayon-striped-num {
56
  background: #000000 !important;
57
- color: #000000 !important;
58
  }
59
  .crayon-theme-dark-terminal .crayon-marked-line.crayon-top {
60
  border-top-style: solid !important;
20
  }
21
  .crayon-theme-dark-terminal .crayon-table .crayon-nums {
22
  background: #000000 !important;
23
+ color: #494949 !important;
24
  border-right-width: 1px !important;
25
  border-right-color: #ffffff !important;
26
  }
 
 
 
 
 
 
 
27
  .crayon-theme-dark-terminal .crayon-striped-line {
28
  background: #000000 !important;
29
  }
30
  .crayon-theme-dark-terminal .crayon-striped-num {
31
  background: #000000 !important;
32
+ color: #494949 !important;
33
  }
34
  .crayon-theme-dark-terminal .crayon-marked-line {
35
  background: #3b3b3b !important;
37
  border-color: #3a3a47 !important;
38
  }
39
  .crayon-theme-dark-terminal .crayon-marked-num {
40
+ color: #494949 !important;
41
  background: #000000 !important;
42
  border-width: 1px !important;
43
  border-color: #000000 !important;
47
  }
48
  .crayon-theme-dark-terminal .crayon-marked-num.crayon-striped-num {
49
  background: #000000 !important;
50
+ color: #494949 !important;
51
  }
52
  .crayon-theme-dark-terminal .crayon-marked-line.crayon-top {
53
  border-top-style: solid !important;
themes/eclipse/eclipse.css CHANGED
@@ -24,13 +24,6 @@ Author: Sunil
24
  border-right-color: #008000 !important;
25
  border-right-style: solid !important;
26
  }
27
- .crayon-theme-eclipse *::selection {
28
- background: transparent !important;
29
- }
30
- .crayon-theme-eclipse .crayon-code *::selection {
31
- background: #ddeeff !important;
32
- color: #316ba5 !important;
33
- }
34
  .crayon-theme-eclipse .crayon-striped-line {
35
  background: #f7f7f7 !important;
36
  }
24
  border-right-color: #008000 !important;
25
  border-right-style: solid !important;
26
  }
 
 
 
 
 
 
 
27
  .crayon-theme-eclipse .crayon-striped-line {
28
  background: #f7f7f7 !important;
29
  }
themes/epicgeeks/epicgeeks.css CHANGED
@@ -28,35 +28,6 @@ URL: http://epicgeeks.net/
28
  border-right-color: #3cc0ff !important;
29
  border-right-style: dashed !important;
30
  }
31
- .crayon-theme-epicgeeks .crayon-code::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
- .crayon-theme-epicgeeks .crayon-code *::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-epicgeeks::selection {
40
- background: transparent !important;
41
- }
42
- .crayon-theme-epicgeeks .crayon-toolbar::selection {
43
- background: transparent !important;
44
- }
45
- .crayon-theme-epicgeeks .crayon-toolbar *::selection {
46
- background: transparent !important;
47
- }
48
- .crayon-theme-epicgeeks .crayon-info::selection {
49
- background: transparent !important;
50
- }
51
- .crayon-theme-epicgeeks .crayon-info *::selection {
52
- background: transparent !important;
53
- }
54
- .crayon-theme-epicgeeks .crayon-nums::selection {
55
- background: transparent !important;
56
- }
57
- .crayon-theme-epicgeeks .crayon-nums *::selection {
58
- background: transparent !important;
59
- }
60
  .crayon-theme-epicgeeks .crayon-striped-line {
61
  background: #ffffd2 !important;
62
  border-width: 1px !important;
28
  border-right-color: #3cc0ff !important;
29
  border-right-style: dashed !important;
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  .crayon-theme-epicgeeks .crayon-striped-line {
32
  background: #ffffd2 !important;
33
  border-width: 1px !important;
themes/familiar/familiar.css CHANGED
@@ -22,13 +22,6 @@ URL: http://aramk.com/
22
  padding-right: 5px !important;
23
  color: #afafaf !important;
24
  }
25
- .crayon-theme-familiar *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-familiar .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-familiar .crayon-striped-line {
33
  background: #f9f9f9 !important;
34
  }
22
  padding-right: 5px !important;
23
  color: #afafaf !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-familiar .crayon-striped-line {
26
  background: #f9f9f9 !important;
27
  }
themes/feeldesign/feeldesign.css CHANGED
@@ -23,13 +23,6 @@ URL: http://www.feeldesignstudio.com
23
  border-right-color: #555555 !important;
24
  border-right-style: solid !important;
25
  }
26
- .crayon-theme-feeldesign *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-feeldesign .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-feeldesign .crayon-striped-line {
34
  background: #363636 !important;
35
  }
23
  border-right-color: #555555 !important;
24
  border-right-style: solid !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-feeldesign .crayon-striped-line {
27
  background: #363636 !important;
28
  }
themes/idle/idle.css CHANGED
@@ -24,13 +24,6 @@ URL: http://aramk.com/
24
  border-right-width: 1px !important;
25
  border-right-style: solid !important;
26
  }
27
- .crayon-theme-idle *::selection {
28
- background: transparent !important;
29
- }
30
- .crayon-theme-idle .crayon-code *::selection {
31
- background: #ddeeff !important;
32
- color: #316ba5 !important;
33
- }
34
  .crayon-theme-idle .crayon-striped-line {
35
  background: #f9f9f9 !important;
36
  }
24
  border-right-width: 1px !important;
25
  border-right-style: solid !important;
26
  }
 
 
 
 
 
 
 
27
  .crayon-theme-idle .crayon-striped-line {
28
  background: #f9f9f9 !important;
29
  }
themes/iris-vfx/iris-vfx.css CHANGED
@@ -21,13 +21,6 @@ URL: http://irisvfx.com
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
24
- .crayon-theme-iris-vfx *::selection {
25
- background: transparent !important;
26
- }
27
- .crayon-theme-iris-vfx .crayon-code *::selection {
28
- background: #ddeeff !important;
29
- color: #316ba5 !important;
30
- }
31
  .crayon-theme-iris-vfx .crayon-striped-line {
32
  }
33
  .crayon-theme-iris-vfx .crayon-striped-num {
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
 
 
 
 
 
 
 
24
  .crayon-theme-iris-vfx .crayon-striped-line {
25
  }
26
  .crayon-theme-iris-vfx .crayon-striped-num {
themes/mirc-dark/mirc-dark.css CHANGED
@@ -23,13 +23,6 @@ URL: http://amfearliath.tk
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
26
- .crayon-theme-mirc-dark *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-mirc-dark .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-mirc-dark .crayon-striped-line {
34
  background: #000000 !important;
35
  }
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-mirc-dark .crayon-striped-line {
27
  background: #000000 !important;
28
  }
themes/monokai/monokai.css CHANGED
@@ -24,13 +24,6 @@ URL: http://www.bryanjhv.com
24
  border-right-color: #555555 !important;
25
  border-right-style: solid !important;
26
  }
27
- .crayon-theme-monokai *::selection {
28
- background: transparent !important;
29
- }
30
- .crayon-theme-monokai .crayon-code *::selection {
31
- background: #ddeeff !important;
32
- color: #316ba5 !important;
33
- }
34
  .crayon-theme-monokai .crayon-striped-line {
35
  background: #363636 !important;
36
  }
24
  border-right-color: #555555 !important;
25
  border-right-style: solid !important;
26
  }
 
 
 
 
 
 
 
27
  .crayon-theme-monokai .crayon-striped-line {
28
  background: #363636 !important;
29
  }
themes/neon/neon.css CHANGED
@@ -32,35 +32,6 @@ URL: http://atlocal.net/
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
35
- .crayon-theme-neon .crayon-code::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-neon .crayon-code *::selection {
40
- background: #ddeeff !important;
41
- color: #316ba5 !important;
42
- }
43
- .crayon-theme-neon::selection {
44
- background: #777 !important;
45
- }
46
- .crayon-theme-neon .crayon-toolbar::selection {
47
- background: #777 !important;
48
- }
49
- .crayon-theme-neon .crayon-toolbar *::selection {
50
- background: #777 !important;
51
- }
52
- .crayon-theme-neon .crayon-info::selection {
53
- background: #777 !important;
54
- }
55
- .crayon-theme-neon .crayon-info *::selection {
56
- background: #777 !important;
57
- }
58
- .crayon-theme-neon .crayon-nums::selection {
59
- background: #777 !important;
60
- }
61
- .crayon-theme-neon .crayon-nums *::selection {
62
- background: #777 !important;
63
- }
64
  .crayon-theme-neon .crayon-line {
65
  background: #050505 !important;
66
  }
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  .crayon-theme-neon .crayon-line {
36
  background: #050505 !important;
37
  }
themes/obsidian/obsidian.css CHANGED
@@ -32,35 +32,6 @@ URL: http://rakcheev.ru/
32
  border-right-width: 1px !important;
33
  border-right-color: #808080 !important;
34
  }
35
- .crayon-theme-obsidian .crayon-code::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-obsidian .crayon-code *::selection {
40
- background: #ddeeff !important;
41
- color: #316ba5 !important;
42
- }
43
- .crayon-theme-obsidian::selection {
44
- background: transparent !important;
45
- }
46
- .crayon-theme-obsidian .crayon-toolbar::selection {
47
- background: transparent !important;
48
- }
49
- .crayon-theme-obsidian .crayon-toolbar *::selection {
50
- background: transparent !important;
51
- }
52
- .crayon-theme-obsidian .crayon-info::selection {
53
- background: transparent !important;
54
- }
55
- .crayon-theme-obsidian .crayon-info *::selection {
56
- background: transparent !important;
57
- }
58
- .crayon-theme-obsidian .crayon-nums::selection {
59
- background: transparent !important;
60
- }
61
- .crayon-theme-obsidian .crayon-nums *::selection {
62
- background: transparent !important;
63
- }
64
  .crayon-theme-obsidian .crayon-striped-line {
65
  background: #283033 !important;
66
  border-width: 1px !important;
32
  border-right-width: 1px !important;
33
  border-right-color: #808080 !important;
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  .crayon-theme-obsidian .crayon-striped-line {
36
  background: #283033 !important;
37
  border-width: 1px !important;
themes/orange-code/orange-code.css ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name: Orange Code
3
+ Description: Orange Code Editor
4
+ Version: 1.0
5
+ Author: Murat Akdeniz
6
+ URL: http://webfikirleri.com/
7
+ */
8
+ .crayon-theme-orange-code {
9
+ margin-bottom: 25px !important;
10
+ background-color: #f8f8ff !important;
11
+ font-size: 100% !important;
12
+ line-height: 130% !important;
13
+ border-width: 1px !important;
14
+ border-color: #dedede !important;
15
+ background: #fdfdfd !important;
16
+ }
17
+ .crayon-theme-orange-code .crayon-toolbar {
18
+ background-color: #eee !important;
19
+ border-bottom-style: solid !important;
20
+ border-bottom-width: 1px !important;
21
+ border-bottom-color: #ff4500 !important;
22
+ background: #ffffff !important;
23
+ }
24
+ .crayon-theme-orange-code .crayon-toolbar .crayon-language {
25
+ font-size: 80% !important;
26
+ color: #666 !important;
27
+ }
28
+ .crayon-theme-orange-code .crayon-toolbar .crayon-title {
29
+ font-size: 80% !important;
30
+ color: #666 !important;
31
+ }
32
+ .crayon-theme-orange-code .crayon-table .crayon-nums {
33
+ background-color: #eee !important;
34
+ background: #fdfdfd !important;
35
+ border-right-color: #ffffff !important;
36
+ border-right-style: solid !important;
37
+ border-right-width: 2px !important;
38
+ color: #2c2c2c !important;
39
+ }
40
+ .crayon-theme-orange-code .crayon-table .crayon-nums-content {
41
+ padding-top: 5px !important;
42
+ padding-bottom: 3px !important;
43
+ }
44
+ .crayon-theme-orange-code .crayon-table .crayon-num {
45
+ min-width: 1.2em !important;
46
+ text-align: right !important;
47
+ color: #aaa !important;
48
+ border-right-style: solid !important;
49
+ border-right-width: 1px !important;
50
+ border-right-color: #dedede !important;
51
+ }
52
+ .crayon-theme-orange-code .crayon-pre {
53
+ padding-top: 5px !important;
54
+ padding-bottom: 3px !important;
55
+ }
56
+ .crayon-theme-orange-code .crayon-marked-line {
57
+ background: #fff5e2 !important;
58
+ border-width: 1px !important;
59
+ border-color: #DFDFDF !important;
60
+ }
61
+ .crayon-theme-orange-code .crayon-marked-num {
62
+ color: #ffffff !important;
63
+ background: #ff6400 !important;
64
+ border-width: 1px !important;
65
+ border-color: #c94f00 !important;
66
+ }
67
+ .crayon-theme-orange-code .crayon-pre .crayon-c {
68
+ color: #999 !important;
69
+ font-style: italic !important;
70
+ }
71
+ .crayon-theme-orange-code .crayon-pre .crayon-s {
72
+ color: #d14 !important;
73
+ }
74
+ .crayon-theme-orange-code .crayon-pre .crayon-p {
75
+ color: #b85c00 !important;
76
+ }
77
+ .crayon-theme-orange-code .crayon-pre .crayon-ta {
78
+ color: #FF0000 !important;
79
+ }
80
+ .crayon-theme-orange-code .crayon-pre .crayon-k {
81
+ color: teal !important;
82
+ }
83
+ .crayon-theme-orange-code .crayon-pre .crayon-st {
84
+ color: #000 !important;
85
+ font-weight: bold !important;
86
+ }
87
+ .crayon-theme-orange-code .crayon-pre .crayon-r {
88
+ color: #000 !important;
89
+ font-weight: bold !important;
90
+ }
91
+ .crayon-theme-orange-code .crayon-pre .crayon-t {
92
+ color: #800080 !important;
93
+ font-weight: bold !important;
94
+ }
95
+ .crayon-theme-orange-code .crayon-pre .crayon-m {
96
+ color: #800080 !important;
97
+ }
98
+ .crayon-theme-orange-code .crayon-pre .crayon-i {
99
+ color: #000 !important;
100
+ }
101
+ .crayon-theme-orange-code .crayon-pre .crayon-e {
102
+ color: teal !important;
103
+ }
104
+ .crayon-theme-orange-code .crayon-pre .crayon-v {
105
+ color: #002D7A !important;
106
+ }
107
+ .crayon-theme-orange-code .crayon-pre .crayon-cn {
108
+ color: #099 !important;
109
+ }
110
+ .crayon-theme-orange-code .crayon-pre .crayon-o {
111
+ color: #006fe0 !important;
112
+ }
113
+ .crayon-theme-orange-code .crayon-pre .crayon-sy {
114
+ color: #333 !important;
115
+ }
116
+ .crayon-theme-orange-code .crayon-pre .crayon-n {
117
+ color: #666 !important;
118
+ font-style: italic !important;
119
+ }
120
+ .crayon-theme-orange-code .crayon-pre .crayon-f {
121
+ color: #999 !important;
122
+ }
123
+ .crayon-theme-orange-code .crayon-pre .crayon-h {
124
+ color: #006fe0 !important;
125
+ }
126
+ .crayon-theme-orange-code-inline {
127
+ background: #ff8e00 !important;
128
+ }
129
+ .crayon-theme-orange-code .crayon-striped-line {
130
+ background: #f6f6f6 !important;
131
+ }
132
+ .crayon-theme-orange-code .crayon-marked-line.crayon-top {
133
+ border-top-style: dotted !important;
134
+ }
135
+ .crayon-theme-orange-code .crayon-marked-line.crayon-bottom {
136
+ border-bottom-style: dotted !important;
137
+ }
138
+ .crayon-theme-orange-code .crayon-marked-line.crayon-striped-line {
139
+ background: #fff1d7 !important;
140
+ }
141
+ .crayon-theme-orange-code .crayon-striped-num {
142
+ background: #f6f6f6 !important;
143
+ color: #2c2c2c !important;
144
+ }
145
+ .crayon-theme-orange-code .crayon-marked-num.crayon-striped-num {
146
+ background: #dd5200 !important;
147
+ color: #ffffff !important;
148
+ }
149
+ .crayon-theme-orange-code .crayon-marked-num.crayon-top {
150
+ border-top-style: dotted !important;
151
+ }
152
+ .crayon-theme-orange-code .crayon-marked-num.crayon-bottom {
153
+ border-bottom-style: dotted !important;
154
+ }
155
+ .crayon-theme-orange-code .crayon-title {
156
+ color: #ff4500 !important;
157
+ font-weight: bold !important;
158
+ }
159
+ .crayon-theme-orange-code .crayon-button:hover {
160
+ background-color: #ff4500 !important;
161
+ }
162
+ .crayon-theme-orange-code .crayon-button:active {
163
+ background-color: #ff4500 !important;
164
+ }
themes/powershell-ise/powershell-ise.css CHANGED
@@ -22,13 +22,6 @@ Url: http://itfiend.com/
22
  background: #cccccc !important;
23
  color: #8ac1f8 !important;
24
  }
25
- .crayon-theme-powershell-ise *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-powershell-ise .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-powershell-ise .crayon-striped-line {
33
  background: #ffffff !important;
34
  }
@@ -115,10 +108,10 @@ Url: http://itfiend.com/
115
  color: #FFF;
116
  }
117
  .crayon-theme-powershell-ise .crayon-pre .crayon-c {
118
- color: #006400 !important;//comments
119
  }
120
  .crayon-theme-powershell-ise .crayon-pre .crayon-s {
121
- color: #8b0000 !important;//strings
122
  }
123
  .crayon-theme-powershell-ise .crayon-pre .crayon-p {
124
  color: #b85c00 !important;
@@ -130,28 +123,28 @@ Url: http://itfiend.com/
130
  color: #3215eb !important;
131
  }
132
  .crayon-theme-powershell-ise .crayon-pre .crayon-st {
133
- color: #00008b !important;//foreach
134
  }
135
  .crayon-theme-powershell-ise .crayon-pre .crayon-r {
136
- color: #0000ff !important;//command
137
  }
138
  .crayon-theme-powershell-ise .crayon-pre .crayon-t {
139
- color: #000080 !important;//switch in (), commands in []
140
  }
141
  .crayon-theme-powershell-ise .crayon-pre .crayon-m {
142
  color: #3215eb !important;
143
  }
144
  .crayon-theme-powershell-ise .crayon-pre .crayon-i {
145
- color: #8a2be2 !important;//switch values, ().statements, [System.Math]:
146
  }
147
  .crayon-theme-powershell-ise .crayon-pre .crayon-e {
148
- color: #000000 !important;//adds/round/Pow, occasionally backtick switch text, affects backticked properties
149
  }
150
  .crayon-theme-powershell-ise .crayon-pre .crayon-v {
151
- color: #ff4500 !important;//variables
152
  }
153
  .crayon-theme-powershell-ise .crayon-pre .crayon-cn {
154
- color: #000080 !important;//Crayon Constant, assigned to Switches
155
  }
156
  .crayon-theme-powershell-ise .crayon-pre .crayon-o {
157
  color: #a9a9a9 !important;
22
  background: #cccccc !important;
23
  color: #8ac1f8 !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-powershell-ise .crayon-striped-line {
26
  background: #ffffff !important;
27
  }
108
  color: #FFF;
109
  }
110
  .crayon-theme-powershell-ise .crayon-pre .crayon-c {
111
+ color: #006400 !important;
112
  }
113
  .crayon-theme-powershell-ise .crayon-pre .crayon-s {
114
+ color: #8b0000 !important;
115
  }
116
  .crayon-theme-powershell-ise .crayon-pre .crayon-p {
117
  color: #b85c00 !important;
123
  color: #3215eb !important;
124
  }
125
  .crayon-theme-powershell-ise .crayon-pre .crayon-st {
126
+ color: #00008b !important;
127
  }
128
  .crayon-theme-powershell-ise .crayon-pre .crayon-r {
129
+ color: #0000ff !important;
130
  }
131
  .crayon-theme-powershell-ise .crayon-pre .crayon-t {
132
+ color: #000080 !important;
133
  }
134
  .crayon-theme-powershell-ise .crayon-pre .crayon-m {
135
  color: #3215eb !important;
136
  }
137
  .crayon-theme-powershell-ise .crayon-pre .crayon-i {
138
+ color: #8a2be2 !important;
139
  }
140
  .crayon-theme-powershell-ise .crayon-pre .crayon-e {
141
+ color: #000000 !important;
142
  }
143
  .crayon-theme-powershell-ise .crayon-pre .crayon-v {
144
+ color: #ff4500 !important;
145
  }
146
  .crayon-theme-powershell-ise .crayon-pre .crayon-cn {
147
+ color: #000080 !important;
148
  }
149
  .crayon-theme-powershell-ise .crayon-pre .crayon-o {
150
  color: #a9a9a9 !important;
themes/pspad/pspad.css CHANGED
@@ -21,13 +21,6 @@ URL: http://www.robertfassl.de
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
24
- .crayon-theme-pspad *::selection {
25
- background: transparent !important;
26
- }
27
- .crayon-theme-pspad .crayon-code *::selection {
28
- background: #ddeeff !important;
29
- color: #316ba5 !important;
30
- }
31
  .crayon-theme-pspad .crayon-striped-line {
32
  background: #f5f5f5 !important;
33
  }
21
  background: #fdfdfd !important;
22
  color: #d4d4d4 !important;
23
  }
 
 
 
 
 
 
 
24
  .crayon-theme-pspad .crayon-striped-line {
25
  background: #f5f5f5 !important;
26
  }
themes/raygun/raygun.css ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name: Raygun
3
+ Description: Raygun code snippets
4
+ Version: 1.0
5
+ Author: Samuel Holt
6
+ URL: http://zingdesign.com/
7
+ */
8
+ .crayon-theme-raygun {
9
+ border-width: 1px !important;
10
+ text-shadow: none !important;
11
+ border-style: solid !important;
12
+ border-color: #d7e0e9 !important;
13
+ background: #f0f3f8 !important;
14
+ }
15
+ .crayon-theme-raygun-inline {
16
+ border-width: 1px !important;
17
+ border-style: solid !important;
18
+ background: #F0F3F8 !important;
19
+ }
20
+ .crayon-theme-raygun .crayon-table .crayon-nums {
21
+ border-right-width: 1px !important;
22
+ border-right-style: solid !important;
23
+ border-right-color: #d7e0e9 !important;
24
+ padding-right: 5px !important;
25
+ color: #333333 !important;
26
+ }
27
+ .crayon-theme-raygun .crayon-striped-line {
28
+ background: #F0F3F8 !important;
29
+ }
30
+ .crayon-theme-raygun .crayon-striped-num {
31
+ color: #333333 !important;
32
+ }
33
+ .crayon-theme-raygun .crayon-line {
34
+ padding-left: 10px !important;
35
+ }
36
+ .crayon-theme-raygun .crayon-marked-line {
37
+ background: #fffee2 !important;
38
+ border-width: 1px !important;
39
+ border-color: #e9e579 !important;
40
+ }
41
+ .crayon-theme-raygun .crayon-marked-num {
42
+ border-width: 1px !important;
43
+ color: #333333 !important;
44
+ }
45
+ .crayon-theme-raygun .crayon-marked-line.crayon-striped-line {
46
+ }
47
+ .crayon-theme-raygun .crayon-marked-num.crayon-striped-num {
48
+ color: #333333 !important;
49
+ }
50
+ .crayon-theme-raygun .crayon-marked-line.crayon-top {
51
+ }
52
+ .crayon-theme-raygun .crayon-marked-num.crayon-top {
53
+ }
54
+ .crayon-theme-raygun .crayon-marked-line.crayon-bottom {
55
+ }
56
+ .crayon-theme-raygun .crayon-marked-num.crayon-bottom {
57
+ }
58
+ .crayon-theme-raygun .crayon-info {
59
+ background: #faf9d7 !important;
60
+ border-bottom-width: 1px !important;
61
+ border-bottom-color: #b1af5e !important;
62
+ border-bottom-style: solid !important;
63
+ color: #7e7d34 !important;
64
+ }
65
+ .crayon-theme-raygun .crayon-toolbar {
66
+ background: #eee !important;
67
+ border-bottom-width: 1px !important;
68
+ border-bottom-color: #dedede !important;
69
+ border-bottom-style: solid !important;
70
+ }
71
+ .crayon-theme-raygun .crayon-toolbar > div {
72
+ float: left !important;
73
+ }
74
+ .crayon-theme-raygun .crayon-toolbar .crayon-tools {
75
+ float: right !important;
76
+ }
77
+ .crayon-theme-raygun .crayon-title {
78
+ color: #333 !important;
79
+ }
80
+ .crayon-theme-raygun .crayon-language {
81
+ color: #999 !important;
82
+ }
83
+ .crayon-theme-raygun .crayon-button {
84
+ background-color: transparent !important;
85
+ }
86
+ .crayon-theme-raygun .crayon-button:hover {
87
+ background-color: #EEE !important;
88
+ color: #666;
89
+ }
90
+ .crayon-theme-raygun .crayon-button.crayon-pressed:hover {
91
+ background-color: #EEE !important;
92
+ color: #666;
93
+ }
94
+ .crayon-theme-raygun .crayon-button.crayon-pressed {
95
+ background-color: #BCBCBC !important;
96
+ color: #FFF;
97
+ }
98
+ .crayon-theme-raygun .crayon-button.crayon-pressed:active {
99
+ background-color: #BCBCBC !important;
100
+ color: #FFF;
101
+ }
102
+ .crayon-theme-raygun .crayon-button:active {
103
+ background-color: #BCBCBC !important;
104
+ color: #FFF;
105
+ }
106
+ .crayon-theme-raygun .crayon-pre .crayon-c {
107
+ color: #ff8000 !important;
108
+ }
109
+ .crayon-theme-raygun .crayon-pre .crayon-s {
110
+ color: #9ACA40 !important;
111
+ }
112
+ .crayon-theme-raygun .crayon-pre .crayon-p {
113
+ color: #b85c00 !important;
114
+ }
115
+ .crayon-theme-raygun .crayon-pre .crayon-ta {
116
+ color: #FF0000 !important;
117
+ }
118
+ .crayon-theme-raygun .crayon-pre .crayon-k {
119
+ color: #e6969e !important;
120
+ }
121
+ .crayon-theme-raygun .crayon-pre .crayon-st {
122
+ color: #e6969e !important;
123
+ }
124
+ .crayon-theme-raygun .crayon-pre .crayon-r {
125
+ color: #e6969e !important;
126
+ }
127
+ .crayon-theme-raygun .crayon-pre .crayon-t {
128
+ color: #158fef !important;
129
+ }
130
+ .crayon-theme-raygun .crayon-pre .crayon-m {
131
+ color: #e6969e !important;
132
+ }
133
+ .crayon-theme-raygun .crayon-pre .crayon-i {
134
+ color: #000 !important;
135
+ }
136
+ .crayon-theme-raygun .crayon-pre .crayon-e {
137
+ color: #004ed0 !important;
138
+ }
139
+ .crayon-theme-raygun .crayon-pre .crayon-v {
140
+ color: #002D7A !important;
141
+ }
142
+ .crayon-theme-raygun .crayon-pre .crayon-cn {
143
+ color: #ce0000 !important;
144
+ }
145
+ .crayon-theme-raygun .crayon-pre .crayon-o {
146
+ color: #006fe0 !important;
147
+ }
148
+ .crayon-theme-raygun .crayon-pre .crayon-sy {
149
+ color: #333 !important;
150
+ }
151
+ .crayon-theme-raygun .crayon-pre .crayon-n {
152
+ color: #666 !important;
153
+ font-style: italic !important;
154
+ }
155
+ .crayon-theme-raygun .crayon-pre .crayon-f {
156
+ color: #999 !important;
157
+ }
158
+ .crayon-theme-raygun .crayon-pre .crayon-h {
159
+ color: #006fe0 !important;
160
+ }
themes/secrets-of-rock/secrets-of-rock.css CHANGED
@@ -22,13 +22,6 @@ Url: http://www.secretsofrock.net
22
  background: #4fb9b1 !important;
23
  color: #333 !important;
24
  }
25
- .crayon-theme-secrets-of-rock *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-secrets-of-rock .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-secrets-of-rock .crayon-striped-line {
33
  background: #f7f7f7 !important;
34
  }
22
  background: #4fb9b1 !important;
23
  color: #333 !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-secrets-of-rock .crayon-striped-line {
26
  background: #f7f7f7 !important;
27
  }
themes/shell-default/shell-default.css CHANGED
@@ -23,13 +23,6 @@ URL: http://amfearliath.tk
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
26
- .crayon-theme-shell-default *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-shell-default .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-shell-default .crayon-striped-line {
34
  background: #000000 !important;
35
  }
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-shell-default .crayon-striped-line {
27
  background: #000000 !important;
28
  }
themes/solarized-dark/solarized-dark.css CHANGED
@@ -28,35 +28,6 @@ Notes: I don't provide striped lines because it would break the original purpose
28
  background: #073642 !important;
29
  color: #586e75 !important;
30
  }
31
- .crayon-theme-solarized-dark .crayon-code::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
- .crayon-theme-solarized-dark .crayon-code *::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-solarized-dark::selection {
40
- background: transparent !important;
41
- }
42
- .crayon-theme-solarized-dark .crayon-toolbar::selection {
43
- background: transparent !important;
44
- }
45
- .crayon-theme-solarized-dark .crayon-toolbar *::selection {
46
- background: transparent !important;
47
- }
48
- .crayon-theme-solarized-dark .crayon-info::selection {
49
- background: transparent !important;
50
- }
51
- .crayon-theme-solarized-dark .crayon-info *::selection {
52
- background: transparent !important;
53
- }
54
- .crayon-theme-solarized-dark .crayon-nums::selection {
55
- background: transparent !important;
56
- }
57
- .crayon-theme-solarized-dark .crayon-nums *::selection {
58
- background: transparent !important;
59
- }
60
  .crayon-theme-solarized-dark .crayon-striped-line {
61
  background: #002b36 !important;
62
  border-width: 1px !important;
28
  background: #073642 !important;
29
  color: #586e75 !important;
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  .crayon-theme-solarized-dark .crayon-striped-line {
32
  background: #002b36 !important;
33
  border-width: 1px !important;
themes/solarized-light/solarized-light.css CHANGED
@@ -28,35 +28,6 @@ Notes: I don't provide striped lines because it would break the original purpose
28
  background: #eee8d5 !important;
29
  color: #93a1a1 !important;
30
  }
31
- .crayon-theme-solarized-light .crayon-code::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
- .crayon-theme-solarized-light .crayon-code *::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-solarized-light::selection {
40
- background: transparent !important;
41
- }
42
- .crayon-theme-solarized-light .crayon-toolbar::selection {
43
- background: transparent !important;
44
- }
45
- .crayon-theme-solarized-light .crayon-toolbar *::selection {
46
- background: transparent !important;
47
- }
48
- .crayon-theme-solarized-light .crayon-info::selection {
49
- background: transparent !important;
50
- }
51
- .crayon-theme-solarized-light .crayon-info *::selection {
52
- background: transparent !important;
53
- }
54
- .crayon-theme-solarized-light .crayon-nums::selection {
55
- background: transparent !important;
56
- }
57
- .crayon-theme-solarized-light .crayon-nums *::selection {
58
- background: transparent !important;
59
- }
60
  .crayon-theme-solarized-light .crayon-striped-line {
61
  background: #fdf6e3 !important;
62
  border-width: 1px !important;
28
  background: #eee8d5 !important;
29
  color: #93a1a1 !important;
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  .crayon-theme-solarized-light .crayon-striped-line {
32
  background: #fdf6e3 !important;
33
  border-width: 1px !important;
themes/son-of-obsidian/son-of-obsidian.css CHANGED
@@ -25,35 +25,6 @@ Twitter: @__phiphou__
25
  border-right-width: 1px !important;
26
  border-right-color: #475459 !important;
27
  }
28
- .crayon-theme-son-of-obsidian .crayon-code::selection {
29
- background: #7c9299 !important;
30
- color: #FFFFFF !important;
31
- }
32
- .crayon-theme-son-of-obsidian .crayon-code *::selection {
33
- background: #7c9299 !important;
34
- color: #FFFFFF !important;
35
- }
36
- .crayon-theme-son-of-obsidian::selection {
37
- background: transparent !important;
38
- }
39
- .crayon-theme-son-of-obsidian .crayon-toolbar::selection {
40
- background: transparent !important;
41
- }
42
- .crayon-theme-son-of-obsidian .crayon-toolbar *::selection {
43
- background: transparent !important;
44
- }
45
- .crayon-theme-son-of-obsidian .crayon-info::selection {
46
- background: transparent !important;
47
- }
48
- .crayon-theme-son-of-obsidian .crayon-info *::selection {
49
- background: transparent !important;
50
- }
51
- .crayon-theme-son-of-obsidian .crayon-nums::selection {
52
- background: transparent !important;
53
- }
54
- .crayon-theme-son-of-obsidian .crayon-nums *::selection {
55
- background: transparent !important;
56
- }
57
  .crayon-theme-son-of-obsidian .crayon-striped-line {
58
  background: #22282a !important;
59
  border-width: 1px !important;
25
  border-right-width: 1px !important;
26
  border-right-color: #475459 !important;
27
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  .crayon-theme-son-of-obsidian .crayon-striped-line {
29
  background: #22282a !important;
30
  border-width: 1px !important;
themes/ssms2012/ssms2012.css CHANGED
@@ -22,13 +22,6 @@ URL: http://www.sqlxdetails.com
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
25
- .crayon-theme-ssms2012 *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-ssms2012 .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-ssms2012 .crayon-striped-line {
33
  }
34
  .crayon-theme-ssms2012 .crayon-striped-num {
22
  background: #dfefff !important;
23
  color: #5499de !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-ssms2012 .crayon-striped-line {
26
  }
27
  .crayon-theme-ssms2012 .crayon-striped-num {
themes/sublime-text/sublime-text.css CHANGED
@@ -14,21 +14,14 @@ URL: http://khosite.com/
14
  }
15
  .crayon-theme-sublime-text-inline {
16
  border-width: 1px !important;
17
- border-color: #ddd !important;
18
  border-style: solid !important;
19
- background: #fafafa !important;
20
  }
21
  .crayon-theme-sublime-text .crayon-table .crayon-nums {
22
  background: #272822 !important;
23
  color: #868686 !important;
24
  }
25
- .crayon-theme-sublime-text *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-sublime-text .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-sublime-text .crayon-striped-line {
33
  background: #272822 !important;
34
  }
14
  }
15
  .crayon-theme-sublime-text-inline {
16
  border-width: 1px !important;
17
+ border-color: #999 !important;
18
  border-style: solid !important;
19
+ background: #272822 !important;
20
  }
21
  .crayon-theme-sublime-text .crayon-table .crayon-nums {
22
  background: #272822 !important;
23
  color: #868686 !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-sublime-text .crayon-striped-line {
26
  background: #272822 !important;
27
  }
themes/terminal/terminal.css CHANGED
@@ -25,13 +25,6 @@ URL: http://aramk.com/
25
  border-right-width: 2 !important;
26
  border-right-style: solid !important;
27
  }
28
- .crayon-theme-terminal *::selection {
29
- background: transparent !important;
30
- }
31
- .crayon-theme-terminal .crayon-code *::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
  .crayon-theme-terminal .crayon-striped-line {
36
  background: #1a4100 !important;
37
  }
25
  border-right-width: 2 !important;
26
  border-right-style: solid !important;
27
  }
 
 
 
 
 
 
 
28
  .crayon-theme-terminal .crayon-striped-line {
29
  background: #1a4100 !important;
30
  }
themes/tomorrow-night/tomorrow-night.css CHANGED
@@ -23,13 +23,6 @@ URL: http://aramk.com/
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
26
- .crayon-theme-tomorrow-night *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-tomorrow-night .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-tomorrow-night .crayon-striped-line {
34
  background: #202326 !important;
35
  }
23
  color: #898989 !important;
24
  border-right-width: 1px !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-tomorrow-night .crayon-striped-line {
27
  background: #202326 !important;
28
  }
themes/tomorrow/tomorrow.css CHANGED
@@ -23,13 +23,6 @@ URL: http://aramk.com/
23
  color: #b5b5b5 !important;
24
  border-right-width: 1px !important;
25
  }
26
- .crayon-theme-tomorrow *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-tomorrow .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-tomorrow .crayon-striped-line {
34
  background: #f9f9f9 !important;
35
  }
23
  color: #b5b5b5 !important;
24
  border-right-width: 1px !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-tomorrow .crayon-striped-line {
27
  background: #f9f9f9 !important;
28
  }
themes/turnwall/turnwall.css CHANGED
@@ -25,13 +25,6 @@ URL: http://www.turnwall.com/
25
  padding-right: 5px !important;
26
  color: #afafaf !important;
27
  }
28
- .crayon-theme-turnwall *::selection {
29
- background: transparent !important;
30
- }
31
- .crayon-theme-turnwall .crayon-code *::selection {
32
- background: #ddeeff !important;
33
- color: #316ba5 !important;
34
- }
35
  .crayon-theme-turnwall .crayon-striped-line {
36
  background: #f9f9f9 !important;
37
  }
25
  padding-right: 5px !important;
26
  color: #afafaf !important;
27
  }
 
 
 
 
 
 
 
28
  .crayon-theme-turnwall .crayon-striped-line {
29
  background: #f9f9f9 !important;
30
  }
themes/twilight/twilight.css CHANGED
@@ -32,35 +32,6 @@ URL: http://aramk.com/
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
35
- .crayon-theme-twilight .crayon-code::selection {
36
- background: #ddeeff !important;
37
- color: #316ba5 !important;
38
- }
39
- .crayon-theme-twilight .crayon-code *::selection {
40
- background: #ddeeff !important;
41
- color: #316ba5 !important;
42
- }
43
- .crayon-theme-twilight::selection {
44
- background: transparent !important;
45
- }
46
- .crayon-theme-twilight .crayon-toolbar::selection {
47
- background: transparent !important;
48
- }
49
- .crayon-theme-twilight .crayon-toolbar *::selection {
50
- background: transparent !important;
51
- }
52
- .crayon-theme-twilight .crayon-info::selection {
53
- background: transparent !important;
54
- }
55
- .crayon-theme-twilight .crayon-info *::selection {
56
- background: transparent !important;
57
- }
58
- .crayon-theme-twilight .crayon-nums::selection {
59
- background: transparent !important;
60
- }
61
- .crayon-theme-twilight .crayon-nums *::selection {
62
- background: transparent !important;
63
- }
64
  .crayon-theme-twilight .crayon-striped-line {
65
  background: #343434 !important;
66
  border-width: 1px !important;
32
  border-right-width: 1px !important;
33
  border-right-color: #333 !important;
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  .crayon-theme-twilight .crayon-striped-line {
36
  background: #343434 !important;
37
  border-width: 1px !important;
themes/visual-assist/visual-assist.css CHANGED
@@ -23,13 +23,6 @@ URL:
23
  border-right-color: #8c8d8f !important;
24
  border-right-style: solid !important;
25
  }
26
- .crayon-theme-visual-assist *::selection {
27
- background: transparent !important;
28
- }
29
- .crayon-theme-visual-assist .crayon-code *::selection {
30
- background: #ddeeff !important;
31
- color: #316ba5 !important;
32
- }
33
  .crayon-theme-visual-assist .crayon-striped-line {
34
  background: #353535 !important;
35
  }
23
  border-right-color: #8c8d8f !important;
24
  border-right-style: solid !important;
25
  }
 
 
 
 
 
 
 
26
  .crayon-theme-visual-assist .crayon-striped-line {
27
  background: #353535 !important;
28
  }
themes/vs2012-black/vs2012-black.css CHANGED
@@ -22,13 +22,6 @@ URL: http://nikolayzahariev.com/
22
  background: #363232 !important;
23
  color: #1ba2c6 !important;
24
  }
25
- .crayon-theme-vs2012-black *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-vs2012-black .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-vs2012-black .crayon-striped-line {
33
  background: #363232 !important;
34
  }
22
  background: #363232 !important;
23
  color: #1ba2c6 !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-vs2012-black .crayon-striped-line {
26
  background: #363232 !important;
27
  }
themes/vs2012/vs2012.css CHANGED
@@ -22,13 +22,6 @@ Url: http://nikolayzahariev.com/
22
  background: #ffffff !important;
23
  color: #8ac1f8 !important;
24
  }
25
- .crayon-theme-vs2012 *::selection {
26
- background: transparent !important;
27
- }
28
- .crayon-theme-vs2012 .crayon-code *::selection {
29
- background: #ddeeff !important;
30
- color: #316ba5 !important;
31
- }
32
  .crayon-theme-vs2012 .crayon-striped-line {
33
  background: #ffffff !important;
34
  }
22
  background: #ffffff !important;
23
  color: #8ac1f8 !important;
24
  }
 
 
 
 
 
 
 
25
  .crayon-theme-vs2012 .crayon-striped-line {
26
  background: #ffffff !important;
27
  }
themes/x3info/x3info.css ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name: X3info
3
+ Description: X3info.com
4
+ Version: 1.0
5
+ Author: Jafran Ahmed
6
+ URL: http://x3info.com
7
+ */
8
+ .crayon-theme-x3info {
9
+ border-width: 1px !important;
10
+ border-color: #35907e !important;
11
+ border-style: solid !important;
12
+ text-shadow: none !important;
13
+ background: #f0f0f0 !important;
14
+ }
15
+ .crayon-theme-x3info-inline {
16
+ border-width: 0px !important;
17
+ border-color: #ddd !important;
18
+ border-style: solid !important;
19
+ background: #f0f0f0 !important;
20
+ }
21
+ .crayon-theme-x3info .crayon-table .crayon-nums {
22
+ background: #35907e !important;
23
+ color: #ffffff !important;
24
+ }
25
+ .crayon-theme-x3info .crayon-striped-line {
26
+ background: #fafafa !important;
27
+ }
28
+ .crayon-theme-x3info .crayon-striped-num {
29
+ background: #35907e !important;
30
+ color: #ffffff !important;
31
+ }
32
+ .crayon-theme-x3info .crayon-marked-line {
33
+ background: #acb1b0 !important;
34
+ border-width: 1px !important;
35
+ border-color: #4fb9b1 !important;
36
+ }
37
+ .crayon-theme-x3info .crayon-marked-num {
38
+ color: #fdfeff !important;
39
+ background: #333333 !important;
40
+ border-width: 0px !important;
41
+ border-color: #5999d9 !important;
42
+ }
43
+ .crayon-theme-x3info .crayon-marked-line.crayon-striped-line {
44
+ background: #cacfce !important;
45
+ }
46
+ .crayon-theme-x3info .crayon-marked-num.crayon-striped-num {
47
+ background: #666666 !important;
48
+ color: #afeeee !important;
49
+ }
50
+ .crayon-theme-x3info .crayon-marked-line.crayon-top {
51
+ border-top-style: solid !important;
52
+ }
53
+ .crayon-theme-x3info .crayon-marked-num.crayon-top {
54
+ border-top-style: solid !important;
55
+ }
56
+ .crayon-theme-x3info .crayon-marked-line.crayon-bottom {
57
+ border-bottom-style: solid !important;
58
+ }
59
+ .crayon-theme-x3info .crayon-marked-num.crayon-bottom {
60
+ border-bottom-style: solid !important;
61
+ }
62
+ .crayon-theme-x3info .crayon-info {
63
+ background: #faf9d7 !important;
64
+ border-bottom-width: 1px !important;
65
+ border-bottom-color: #b1af5e !important;
66
+ border-bottom-style: solid !important;
67
+ color: #65642c !important;
68
+ }
69
+ .crayon-theme-x3info .crayon-toolbar {
70
+ border-bottom-width: 0px !important;
71
+ border-bottom-color: #f0f0f0 !important;
72
+ background: #35907e !important;
73
+ }
74
+ .crayon-theme-x3info .crayon-toolbar > div {
75
+ float: left !important;
76
+ }
77
+ .crayon-theme-x3info .crayon-toolbar .crayon-tools {
78
+ float: right !important;
79
+ }
80
+ .crayon-theme-x3info .crayon-title {
81
+ color: #fbfbfb !important;
82
+ }
83
+ .crayon-theme-x3info .crayon-language {
84
+ color: #4fb9b1 !important;
85
+ }
86
+ .crayon-theme-x3info a.crayon-button {
87
+ background-color: transparent !important;
88
+ }
89
+ .crayon-theme-x3info a.crayon-button:hover {
90
+ background-color: #c0e3e1 !important;
91
+ color: #666;
92
+ }
93
+ .crayon-theme-x3info a.crayon-button.crayon-pressed:hover {
94
+ background-color: #EEE !important;
95
+ color: #666;
96
+ }
97
+ .crayon-theme-x3info a.crayon-button.crayon-pressed {
98
+ background-color: #4fb9b1 !important;
99
+ color: #FFF;
100
+ }
101
+ .crayon-theme-x3info a.crayon-button.crayon-pressed:active {
102
+ background-color: #4fb9b1 !important;
103
+ color: #FFF;
104
+ }
105
+ .crayon-theme-x3info a.crayon-button:active {
106
+ background-color: #4fb9b1 !important;
107
+ color: #FFF;
108
+ }
109
+ .crayon-theme-x3info .crayon-pre .crayon-c {
110
+ color: #c7562b !important;
111
+ }
112
+ .crayon-theme-x3info .crayon-pre .crayon-s {
113
+ color: #9c29b5 !important;
114
+ }
115
+ .crayon-theme-x3info .crayon-pre .crayon-p {
116
+ color: #cb7824 !important;
117
+ }
118
+ .crayon-theme-x3info .crayon-pre .crayon-ta {
119
+ color: #46b6db !important;
120
+ }
121
+ .crayon-theme-x3info .crayon-pre .crayon-k {
122
+ color: #173e36 !important;
123
+ }
124
+ .crayon-theme-x3info .crayon-pre .crayon-st {
125
+ color: #333 !important;
126
+ }
127
+ .crayon-theme-x3info .crayon-pre .crayon-r {
128
+ color: #4fb9b1 !important;
129
+ }
130
+ .crayon-theme-x3info .crayon-pre .crayon-t {
131
+ color: #387a6d !important;
132
+ }
133
+ .crayon-theme-x3info .crayon-pre .crayon-m {
134
+ color: #35907e !important;
135
+ }
136
+ .crayon-theme-x3info .crayon-pre .crayon-i {
137
+ color: #333 !important;
138
+ }
139
+ .crayon-theme-x3info .crayon-pre .crayon-e {
140
+ color: #008b8b !important;
141
+ }
142
+ .crayon-theme-x3info .crayon-pre .crayon-v {
143
+ color: #4ab28d !important;
144
+ }
145
+ .crayon-theme-x3info .crayon-pre .crayon-cn {
146
+ color: #2f4f4f !important;
147
+ }
148
+ .crayon-theme-x3info .crayon-pre .crayon-o {
149
+ color: #008b8b !important;
150
+ }
151
+ .crayon-theme-x3info .crayon-pre .crayon-sy {
152
+ color: #333 !important;
153
+ }
154
+ .crayon-theme-x3info .crayon-pre .crayon-n {
155
+ color: #666 !important;
156
+ font-style: italic !important;
157
+ }
158
+ .crayon-theme-x3info .crayon-pre .crayon-f {
159
+ color: #999 !important;
160
+ }
161
+ .crayon-theme-x3info .crayon-pre .crayon-h {
162
+ color: #3bbece !important;
163
+ }
164
+ .crayon-theme-x3info .crayon-button {
165
+ }
trans/Update crayon-syntax-highlighter-ar_AR.mo DELETED
Binary file
trans/Update crayon-syntax-highlighter-ar_AR.po DELETED
@@ -1,1271 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: crayon-syntax-highlighter\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-05-24 08:40+1000\n"
6
- "PO-Revision-Date: \n"
7
- "Last-Translator: \n"
8
- "Language-Team: \n"
9
- "Language: ar-AR\n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Poedit-SourceCharset: utf-8\n"
15
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
- "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
17
- "crayon__;crayon_n;crayon_e\n"
18
- "X-Poedit-Basepath: .\n"
19
- "X-Textdomain-Support: yes\n"
20
- "X-Generator: Poedit 1.5.4\n"
21
- "X-Poedit-SearchPath-0: .\n"
22
- "X-Poedit-SearchPath-1: ..\n"
23
-
24
- # @ crayon-syntax-highlighter
25
- #: ../crayon_formatter.class.php:286
26
- msgid "Toggle Line Numbers"
27
- msgstr "أظهر/أخف أرقام الأسطر"
28
-
29
- # @ crayon-syntax-highlighter
30
- #: ../crayon_formatter.class.php:290
31
- msgid "Toggle Plain Code"
32
- msgstr "الذهاب إلى كامل الكود"
33
-
34
- # @ crayon-syntax-highlighter
35
- #: ../crayon_formatter.class.php:294
36
- msgid "Toggle Line Wrap"
37
- msgstr "أظهر/ أخف الأسطر"
38
-
39
- # @ crayon-syntax-highlighter
40
- #: ../crayon_formatter.class.php:298 ../crayon_formatter.class.php:302
41
- #, fuzzy
42
- msgid "Expand Code"
43
- msgstr "إنسخ كامل الكود"
44
-
45
- # @ crayon-syntax-highlighter
46
- #: ../crayon_formatter.class.php:306
47
- msgid "Open Code In New Window"
48
- msgstr "إفتح الكود في نافذة جديدة"
49
-
50
- # @ crayon-syntax-highlighter
51
- #: ../crayon_formatter.class.php:333
52
- msgid "Contains Mixed Languages"
53
- msgstr "يحتوى على لغات مدمجة فيما بينها"
54
-
55
- # @ crayon-syntax-highlighter
56
- #: ../crayon_settings.class.php:150
57
- msgid "Hourly"
58
- msgstr "ساعيا"
59
-
60
- # @ crayon-syntax-highlighter
61
- #: ../crayon_settings.class.php:150
62
- msgid "Daily"
63
- msgstr "يوميا"
64
-
65
- # @ crayon-syntax-highlighter
66
- #: ../crayon_settings.class.php:151
67
- msgid "Weekly"
68
- msgstr "أسبوعيا"
69
-
70
- # @ crayon-syntax-highlighter
71
- #: ../crayon_settings.class.php:151
72
- msgid "Monthly"
73
- msgstr "شهريا"
74
-
75
- # @ crayon-syntax-highlighter
76
- #: ../crayon_settings.class.php:152
77
- msgid "Immediately"
78
- msgstr "حا?"
79
-
80
- # @ crayon-syntax-highlighter
81
- #: ../crayon_settings.class.php:163 ../crayon_settings.class.php:167
82
- msgid "Max"
83
- msgstr "أكبر"
84
-
85
- # @ crayon-syntax-highlighter
86
- #: ../crayon_settings.class.php:163 ../crayon_settings.class.php:167
87
- msgid "Min"
88
- msgstr "أقل"
89
-
90
- # @ crayon-syntax-highlighter
91
- #: ../crayon_settings.class.php:163 ../crayon_settings.class.php:167
92
- msgid "Static"
93
- msgstr "ثابتة"
94
-
95
- # @ crayon-syntax-highlighter
96
- #: ../crayon_settings.class.php:165 ../crayon_settings.class.php:169
97
- #: ../crayon_settings_wp.class.php:774 ../crayon_settings_wp.class.php:783
98
- #: ../crayon_settings_wp.class.php:1059 ../crayon_settings_wp.class.php:1061
99
- msgid "Pixels"
100
- msgstr "بيكسل"
101
-
102
- # @ crayon-syntax-highlighter
103
- #: ../crayon_settings.class.php:165 ../crayon_settings.class.php:169
104
- msgid "Percent"
105
- msgstr "بالمئة"
106
-
107
- # @ crayon-syntax-highlighter
108
- #: ../crayon_settings.class.php:178
109
- msgid "None"
110
- msgstr "بدون"
111
-
112
- # @ crayon-syntax-highlighter
113
- #: ../crayon_settings.class.php:178
114
- msgid "Left"
115
- msgstr "يسار"
116
-
117
- # @ crayon-syntax-highlighter
118
- #: ../crayon_settings.class.php:178
119
- msgid "Center"
120
- msgstr "توسيط"
121
-
122
- # @ crayon-syntax-highlighter
123
- #: ../crayon_settings.class.php:178
124
- msgid "Right"
125
- msgstr "يمين"
126
-
127
- # @ crayon-syntax-highlighter
128
- #: ../crayon_settings.class.php:180 ../crayon_settings.class.php:204
129
- msgid "On MouseOver"
130
- msgstr "عند تمرير الفأرة"
131
-
132
- # @ crayon-syntax-highlighter
133
- #: ../crayon_settings.class.php:180 ../crayon_settings.class.php:186
134
- msgid "Always"
135
- msgstr "دائما"
136
-
137
- # @ crayon-syntax-highlighter
138
- #: ../crayon_settings.class.php:180 ../crayon_settings.class.php:186
139
- msgid "Never"
140
- msgstr "أبدا"
141
-
142
- # @ crayon-syntax-highlighter
143
- #: ../crayon_settings.class.php:186
144
- msgid "When Found"
145
- msgstr "إذا استكشفت"
146
-
147
- # @ crayon-syntax-highlighter
148
- #: ../crayon_settings.class.php:204
149
- msgid "On Double Click"
150
- msgstr "عند النقر المزدوج"
151
-
152
- # @ crayon-syntax-highlighter
153
- #: ../crayon_settings.class.php:204
154
- msgid "On Single Click"
155
- msgstr "عند النقر مرة واحدة"
156
-
157
- # @ crayon-syntax-highlighter
158
- #: ../crayon_settings.class.php:204
159
- msgid "Disable Mouse Events"
160
- msgstr "تعطيل أفعال الفأرة"
161
-
162
- # @ crayon-syntax-highlighter
163
- #: ../crayon_settings.class.php:211
164
- msgid "An error has occurred. Please try again later."
165
- msgstr "لقد حدث خطأ . الرجاء اعادة المحاولة ?حقا."
166
-
167
- # @ crayon-syntax-highlighter
168
- #: ../crayon_settings.class.php:227
169
- #, fuzzy
170
- msgid "Inline Tag"
171
- msgstr "الهامش بين الاسطر"
172
-
173
- #: ../crayon_settings.class.php:227
174
- msgid "Block Tag"
175
- msgstr ""
176
-
177
- # @ crayon-syntax-highlighter
178
- #: ../crayon_settings_wp.class.php:53 ../crayon_settings_wp.class.php:210
179
- #: ../crayon_settings_wp.class.php:1257
180
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:254
181
- msgid "Settings"
182
- msgstr "إعدادات"
183
-
184
- # @ crayon-syntax-highlighter
185
- #: ../crayon_settings_wp.class.php:136
186
- #, php-format
187
- msgid "Press %s to Copy, %s to Paste"
188
- msgstr "قم ب %s للنسخ, %s للصق"
189
-
190
- #: ../crayon_settings_wp.class.php:137
191
- msgid "Click To Expand Code"
192
- msgstr ""
193
-
194
- #: ../crayon_settings_wp.class.php:179
195
- msgid "Prompt"
196
- msgstr ""
197
-
198
- #: ../crayon_settings_wp.class.php:180
199
- msgid "Value"
200
- msgstr ""
201
-
202
- #: ../crayon_settings_wp.class.php:181
203
- msgid "Alert"
204
- msgstr ""
205
-
206
- # @ crayon-syntax-highlighter
207
- #: ../crayon_settings_wp.class.php:182 ../crayon_settings_wp.class.php:920
208
- msgid "No"
209
- msgstr "لا"
210
-
211
- #: ../crayon_settings_wp.class.php:183 ../crayon_settings_wp.class.php:920
212
- msgid "Yes"
213
- msgstr "نعم"
214
-
215
- #: ../crayon_settings_wp.class.php:184
216
- msgid "Confirm"
217
- msgstr ""
218
-
219
- # @ crayon-syntax-highlighter
220
- #: ../crayon_settings_wp.class.php:185
221
- #, fuzzy
222
- msgid "Change Code"
223
- msgstr "إنسخ كامل الكود"
224
-
225
- # @ crayon-syntax-highlighter
226
- #: ../crayon_settings_wp.class.php:193
227
- msgid "You do not have sufficient permissions to access this page."
228
- msgstr "ليس لديك تصاريح كافية لدخول هذه الصفحة"
229
-
230
- # @ crayon-syntax-highlighter
231
- #: ../crayon_settings_wp.class.php:225
232
- msgid "Save Changes"
233
- msgstr "حفظ التغييرات"
234
-
235
- # @ crayon-syntax-highlighter
236
- #: ../crayon_settings_wp.class.php:233
237
- msgid "Reset Settings"
238
- msgstr "إعادة تعيين الاعدادات"
239
-
240
- # @ crayon-syntax-highlighter
241
- #: ../crayon_settings_wp.class.php:491
242
- msgid "General"
243
- msgstr "عام"
244
-
245
- # @ crayon-syntax-highlighter
246
- #: ../crayon_settings_wp.class.php:492
247
- msgid "Theme"
248
- msgstr "الشكل"
249
-
250
- # @ crayon-syntax-highlighter
251
- #: ../crayon_settings_wp.class.php:493
252
- msgid "Font"
253
- msgstr "الخط"
254
-
255
- # @ crayon-syntax-highlighter
256
- #: ../crayon_settings_wp.class.php:494
257
- msgid "Metrics"
258
- msgstr "الأبعاد"
259
-
260
- # @ crayon-syntax-highlighter
261
- #: ../crayon_settings_wp.class.php:495
262
- #: ../util/theme-editor/theme_editor.php:299
263
- msgid "Toolbar"
264
- msgstr "شريط الأدوات"
265
-
266
- # @ crayon-syntax-highlighter
267
- #: ../crayon_settings_wp.class.php:496
268
- #: ../util/theme-editor/theme_editor.php:297
269
- msgid "Lines"
270
- msgstr "سطر"
271
-
272
- # @ crayon-syntax-highlighter
273
- #: ../crayon_settings_wp.class.php:497
274
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:214
275
- msgid "Code"
276
- msgstr "كود"
277
-
278
- # @ crayon-syntax-highlighter
279
- #: ../crayon_settings_wp.class.php:498
280
- msgid "Tags"
281
- msgstr "أوسمة"
282
-
283
- # @ crayon-syntax-highlighter
284
- #: ../crayon_settings_wp.class.php:499
285
- msgid "Languages"
286
- msgstr "لغات"
287
-
288
- # @ crayon-syntax-highlighter
289
- #: ../crayon_settings_wp.class.php:500
290
- msgid "Files"
291
- msgstr "ملفات"
292
-
293
- #: ../crayon_settings_wp.class.php:501
294
- msgid "Posts"
295
- msgstr "تدوينات"
296
-
297
- # @ crayon-syntax-highlighter
298
- #: ../crayon_settings_wp.class.php:502
299
- msgid "Tag Editor"
300
- msgstr "محرر الأوسمة"
301
-
302
- # @ crayon-syntax-highlighter
303
- #: ../crayon_settings_wp.class.php:503
304
- msgid "Misc"
305
- msgstr "متفرقات"
306
-
307
- # @ crayon-syntax-highlighter
308
- #: ../crayon_settings_wp.class.php:506
309
- msgid "Debug"
310
- msgstr "تصحيح"
311
-
312
- # @ crayon-syntax-highlighter
313
- #: ../crayon_settings_wp.class.php:507
314
- msgid "Errors"
315
- msgstr "أخطاء"
316
-
317
- # @ crayon-syntax-highlighter
318
- #: ../crayon_settings_wp.class.php:508
319
- msgid "Log"
320
- msgstr "سجل"
321
-
322
- # @ crayon-syntax-highlighter
323
- #: ../crayon_settings_wp.class.php:511
324
- msgid "About"
325
- msgstr "حول"
326
-
327
- # @ crayon-syntax-highlighter
328
- #: ../crayon_settings_wp.class.php:751
329
- msgid "Height"
330
- msgstr "الارتفاع"
331
-
332
- # @ crayon-syntax-highlighter
333
- #: ../crayon_settings_wp.class.php:757
334
- msgid "Width"
335
- msgstr "الطول"
336
-
337
- # @ crayon-syntax-highlighter
338
- #: ../crayon_settings_wp.class.php:763
339
- msgid "Top Margin"
340
- msgstr "الهامش العلوي"
341
-
342
- # @ crayon-syntax-highlighter
343
- #: ../crayon_settings_wp.class.php:764
344
- msgid "Bottom Margin"
345
- msgstr "الهامش السفلي"
346
-
347
- # @ crayon-syntax-highlighter
348
- #: ../crayon_settings_wp.class.php:765 ../crayon_settings_wp.class.php:770
349
- msgid "Left Margin"
350
- msgstr "هامش اليسار"
351
-
352
- # @ crayon-syntax-highlighter
353
- #: ../crayon_settings_wp.class.php:766 ../crayon_settings_wp.class.php:770
354
- msgid "Right Margin"
355
- msgstr "هامش اليمين"
356
-
357
- # @ crayon-syntax-highlighter
358
- #: ../crayon_settings_wp.class.php:776
359
- msgid "Horizontal Alignment"
360
- msgstr "المحاذاة الأفقية"
361
-
362
- # @ crayon-syntax-highlighter
363
- #: ../crayon_settings_wp.class.php:779
364
- msgid "Allow floating elements to surround Crayon"
365
- msgstr "السماح لعناصر العائمة لتطويق ملون الكود"
366
-
367
- # @ crayon-syntax-highlighter
368
- #: ../crayon_settings_wp.class.php:781
369
- msgid "Inline Margin"
370
- msgstr "الهامش بين الاسطر"
371
-
372
- # @ crayon-syntax-highlighter
373
- #: ../crayon_settings_wp.class.php:789
374
- msgid "Display the Toolbar"
375
- msgstr "إظهار شريط الأدوات"
376
-
377
- # @ crayon-syntax-highlighter
378
- #: ../crayon_settings_wp.class.php:792
379
- msgid "Overlay the toolbar on code rather than push it down when possible"
380
- msgstr "ركب شريط الأدوات فوق الكود بدلا من دفعه نحو الأسفل إن كان ذلك ممكنا"
381
-
382
- # @ crayon-syntax-highlighter
383
- #: ../crayon_settings_wp.class.php:793
384
- msgid "Toggle the toolbar on single click when it is overlayed"
385
- msgstr "أظهر شريط الأدوات عند النقر مرة واحدةحينما يكون مركبا"
386
-
387
- # @ crayon-syntax-highlighter
388
- #: ../crayon_settings_wp.class.php:794
389
- msgid "Delay hiding the toolbar on MouseOut"
390
- msgstr "أخر اخفاء شريط الأدوات عندما تكون الفأرة فوقه"
391
-
392
- # @ crayon-syntax-highlighter
393
- #: ../crayon_settings_wp.class.php:796
394
- msgid "Display the title when provided"
395
- msgstr "أظهر العنوان اذا وجد"
396
-
397
- # @ crayon-syntax-highlighter
398
- #: ../crayon_settings_wp.class.php:797
399
- msgid "Display the language"
400
- msgstr "أظهر اللغة"
401
-
402
- # @ crayon-syntax-highlighter
403
- #: ../crayon_settings_wp.class.php:804
404
- msgid "Display striped code lines"
405
- msgstr "أظهر تلوين الأسطر"
406
-
407
- # @ crayon-syntax-highlighter
408
- #: ../crayon_settings_wp.class.php:805
409
- msgid "Enable line marking for important lines"
410
- msgstr "تفعيل تحديد الأسطر المهمة"
411
-
412
- #: ../crayon_settings_wp.class.php:806
413
- msgid "Enable line ranges for showing only parts of code"
414
- msgstr "تفعيل نطاق الأسطر لإظهار جزء من الكود فقط"
415
-
416
- # @ crayon-syntax-highlighter
417
- #: ../crayon_settings_wp.class.php:807
418
- msgid "Display line numbers by default"
419
- msgstr "عرض أرقام الأسطر افتراضيا"
420
-
421
- # @ crayon-syntax-highlighter
422
- #: ../crayon_settings_wp.class.php:808
423
- msgid "Enable line number toggling"
424
- msgstr "تفعيل عرض أرقام الأسطر"
425
-
426
- # @ crayon-syntax-highlighter
427
- #: ../crayon_settings_wp.class.php:809
428
- msgid "Wrap lines by default"
429
- msgstr "عرض أرقام الأسطر الافتراضية"
430
-
431
- # @ crayon-syntax-highlighter
432
- #: ../crayon_settings_wp.class.php:810
433
- msgid "Enable line wrap toggling"
434
- msgstr "تفعيل عرض أرقام الأسطر"
435
-
436
- # @ crayon-syntax-highlighter
437
- #: ../crayon_settings_wp.class.php:811
438
- msgid "Start line numbers from"
439
- msgstr "إبدأ ترقيم الأسطر بـــ "
440
-
441
- # @ crayon-syntax-highlighter
442
- #: ../crayon_settings_wp.class.php:822
443
- msgid "When no language is provided, use the fallback"
444
- msgstr "إذا لم تهتر اللغة ،، استخدم الافتراضية"
445
-
446
- # @ crayon-syntax-highlighter
447
- #: ../crayon_settings_wp.class.php:828
448
- #, php-format
449
- msgid "%d language has been detected."
450
- msgstr "تم ايجاد %d لغة"
451
-
452
- # @ crayon-syntax-highlighter
453
- #: ../crayon_settings_wp.class.php:829
454
- msgid "Parsing was successful"
455
- msgstr "تم التحويل بنجاح"
456
-
457
- # @ crayon-syntax-highlighter
458
- #: ../crayon_settings_wp.class.php:829
459
- msgid "Parsing was unsuccessful"
460
- msgstr "خطأ في التحويل "
461
-
462
- # @ crayon-syntax-highlighter
463
- #: ../crayon_settings_wp.class.php:835
464
- #, php-format
465
- msgid "The selected language with id %s could not be loaded"
466
- msgstr " (%s) ? نستطيع تحديد اللغة المختارة بـالرقم "
467
-
468
- # @ crayon-syntax-highlighter
469
- #: ../crayon_settings_wp.class.php:838
470
- msgid "Show Languages"
471
- msgstr "مشاهدة اللغات"
472
-
473
- #: ../crayon_settings_wp.class.php:874
474
- msgid "Show Crayon Posts"
475
- msgstr "مشاهدة تدوينات المستعملة للاضافة"
476
-
477
- #: ../crayon_settings_wp.class.php:875
478
- msgid "Refresh"
479
- msgstr "تحديث"
480
-
481
- #: ../crayon_settings_wp.class.php:900
482
- msgid "ID"
483
- msgstr "الرقم"
484
-
485
- # @ crayon-syntax-highlighter
486
- #: ../crayon_settings_wp.class.php:900
487
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:191
488
- #: ../util/theme-editor/theme_editor.php:314
489
- msgid "Title"
490
- msgstr "عنوان"
491
-
492
- #: ../crayon_settings_wp.class.php:900
493
- msgid "Posted"
494
- msgstr "كتب في"
495
-
496
- #: ../crayon_settings_wp.class.php:900
497
- msgid "Modifed"
498
- msgstr "حرر في"
499
-
500
- # @ crayon-syntax-highlighter
501
- #: ../crayon_settings_wp.class.php:900
502
- msgid "Contains Legacy Tags?"
503
- msgstr "يحتوي على الأوسمة؟"
504
-
505
- #: ../crayon_settings_wp.class.php:1015
506
- msgid "Edit"
507
- msgstr "حرر"
508
-
509
- #: ../crayon_settings_wp.class.php:1015
510
- #: ../util/theme-editor/theme_editor.php:199
511
- msgid "Duplicate"
512
- msgstr "انسخ"
513
-
514
- #: ../crayon_settings_wp.class.php:1015
515
- msgid "Submit"
516
- msgstr ""
517
-
518
- #: ../crayon_settings_wp.class.php:1016
519
- #: ../util/theme-editor/theme_editor.php:196
520
- msgid "Delete"
521
- msgstr "احذف"
522
-
523
- # @ crayon-syntax-highlighter
524
- #: ../crayon_settings_wp.class.php:1018
525
- msgid "Loading..."
526
- msgstr " جاري التحميل ..."
527
-
528
- #: ../crayon_settings_wp.class.php:1020
529
- msgid "Duplicate a Stock Theme into a User Theme to allow editing."
530
- msgstr ""
531
-
532
- # @ crayon-syntax-highlighter
533
- #: ../crayon_settings_wp.class.php:1031
534
- #, fuzzy, php-format
535
- msgid ""
536
- "Change the %1$sfallback language%2$s to change the sample code or %3$schange "
537
- "it manually%4$s. Lines 5-7 are marked."
538
- msgstr ""
539
- "غير الـ %1$s اللغة الاحتياطية %2$s لتغيير كود المثال.تم تعليم الأسطر 5-7 "
540
-
541
- # @ crayon-syntax-highlighter
542
- #: ../crayon_settings_wp.class.php:1038
543
- msgid "Enable Live Preview"
544
- msgstr "المشاهدة المباشرة"
545
-
546
- # @ crayon-syntax-highlighter
547
- #: ../crayon_settings_wp.class.php:1040
548
- msgid "Enqueue themes in the header (more efficient)."
549
- msgstr "تحميل اعدادات الاضافة في التروسية -أكثر فعالية "
550
-
551
- # @ crayon-syntax-highlighter
552
- #: ../crayon_settings_wp.class.php:1043
553
- #, php-format
554
- msgid "The selected theme with id %s could not be loaded"
555
- msgstr " %s ? نستطيع تحميل الشكل المحدد بالرقم "
556
-
557
- #: ../crayon_settings_wp.class.php:1055
558
- msgid "Add More"
559
- msgstr ""
560
-
561
- # @ crayon-syntax-highlighter
562
- #: ../crayon_settings_wp.class.php:1057
563
- msgid "Custom Font Size"
564
- msgstr "تخصيص حجم الخط"
565
-
566
- # @ crayon-syntax-highlighter
567
- #: ../crayon_settings_wp.class.php:1059
568
- #, fuzzy
569
- msgid "Line Height"
570
- msgstr "الارتفاع"
571
-
572
- # @ crayon-syntax-highlighter
573
- #: ../crayon_settings_wp.class.php:1064
574
- #, php-format
575
- msgid "The selected font with id %s could not be loaded"
576
- msgstr " (%s) ? يمكن تحديد الخط المحدد بالــ"
577
-
578
- # @ crayon-syntax-highlighter
579
- #: ../crayon_settings_wp.class.php:1070
580
- msgid "Enqueue fonts in the header (more efficient)."
581
- msgstr "إدراج الخطوط بالتروسية ( أكثر فعالية ) "
582
-
583
- # @ crayon-syntax-highlighter
584
- #: ../crayon_settings_wp.class.php:1075
585
- msgid "Enable plain code view and display"
586
- msgstr "تفعيل اظهار ومشاهدة كامل الكود"
587
-
588
- # @ crayon-syntax-highlighter
589
- #: ../crayon_settings_wp.class.php:1078
590
- msgid "Enable plain code toggling"
591
- msgstr "تفعيل تغيير كامل الكود"
592
-
593
- # @ crayon-syntax-highlighter
594
- #: ../crayon_settings_wp.class.php:1079
595
- msgid "Show the plain code by default"
596
- msgstr "اظهار كامل الكود افتراضيا"
597
-
598
- # @ crayon-syntax-highlighter
599
- #: ../crayon_settings_wp.class.php:1080
600
- msgid "Enable code copy/paste"
601
- msgstr "السماح بنسخ الكود"
602
-
603
- # @ crayon-syntax-highlighter
604
- #: ../crayon_settings_wp.class.php:1082
605
- msgid "Enable opening code in a window"
606
- msgstr "السماح بفتح الكود في نافذة جديدة"
607
-
608
- # @ crayon-syntax-highlighter
609
- #: ../crayon_settings_wp.class.php:1083
610
- msgid "Always display scrollbars"
611
- msgstr "اظهار شريط التمرير دائما "
612
-
613
- #: ../crayon_settings_wp.class.php:1084
614
- msgid "Minimize code"
615
- msgstr ""
616
-
617
- #: ../crayon_settings_wp.class.php:1085
618
- msgid "Expand code beyond page borders on mouseover"
619
- msgstr ""
620
-
621
- #: ../crayon_settings_wp.class.php:1086
622
- msgid "Enable code expanding toggling when possible"
623
- msgstr ""
624
-
625
- # @ crayon-syntax-highlighter
626
- #: ../crayon_settings_wp.class.php:1089
627
- msgid "Decode HTML entities in code"
628
- msgstr "تشفير أكواد الهتمل تلقائيا"
629
-
630
- # @ crayon-syntax-highlighter
631
- #: ../crayon_settings_wp.class.php:1091
632
- msgid "Decode HTML entities in attributes"
633
- msgstr "تشفير أكواد الهتمل تلقائيا "
634
-
635
- # @ crayon-syntax-highlighter
636
- #: ../crayon_settings_wp.class.php:1093
637
- msgid "Remove whitespace surrounding the shortcode content"
638
- msgstr "حذف الفراغات في حول الكود"
639
-
640
- # @ crayon-syntax-highlighter
641
- #: ../crayon_settings_wp.class.php:1095
642
- msgid "Allow Mixed Language Highlighting with delimiters and tags."
643
- msgstr "السماح بتلوين الكود المتعدد اللغات"
644
-
645
- # @ crayon-syntax-highlighter
646
- #: ../crayon_settings_wp.class.php:1097
647
- msgid "Show Mixed Language Icon (+)"
648
- msgstr "إظهار أيقونة اللغات المدمجة والمتعددة (+) "
649
-
650
- # @ crayon-syntax-highlighter
651
- #: ../crayon_settings_wp.class.php:1099
652
- msgid "Tab size in spaces"
653
- msgstr "حجم الفراغات"
654
-
655
- #: ../crayon_settings_wp.class.php:1101
656
- msgid "Blank lines before code:"
657
- msgstr "أسطر فارغة قبل الكود"
658
-
659
- #: ../crayon_settings_wp.class.php:1103
660
- msgid "Blank lines after code:"
661
- msgstr "أسطر فارغة بعد الكود"
662
-
663
- # @ crayon-syntax-highlighter
664
- #: ../crayon_settings_wp.class.php:1108
665
- #, fuzzy
666
- msgid "Capture Inline Tags"
667
- msgstr "تمكين التعرف على أوسمة الروج الى السطر"
668
-
669
- # @ crayon-syntax-highlighter
670
- #: ../crayon_settings_wp.class.php:1109
671
- msgid "Wrap Inline Tags"
672
- msgstr "تمكين التعرف على أوسمة الروج الى السطر"
673
-
674
- # @ crayon-syntax-highlighter
675
- #: ../crayon_settings_wp.class.php:1110
676
- #, fuzzy
677
- msgid "Capture &lt;code&gt; as"
678
- msgstr "تمكين التعرف على أوسمة &lt;pre&gt; في الاضافة "
679
-
680
- # @ crayon-syntax-highlighter
681
- #: ../crayon_settings_wp.class.php:1114
682
- msgid "Capture `backquotes` as &lt;code&gt;"
683
- msgstr "تمكين التعرف على الاقتباسات "
684
-
685
- # @ crayon-syntax-highlighter
686
- #: ../crayon_settings_wp.class.php:1115
687
- msgid "Capture &lt;pre&gt; tags as Crayons"
688
- msgstr "تمكين التعرف على أوسمة &lt;pre&gt; في الاضافة "
689
-
690
- #: ../crayon_settings_wp.class.php:1117
691
- #, php-format
692
- msgid ""
693
- "Using this markup for Mini Tags and Inline tags is now %sdepreciated%s! Use "
694
- "the %sTag Editor%s instead and convert legacy tags."
695
- msgstr ""
696
-
697
- # @ crayon-syntax-highlighter
698
- #: ../crayon_settings_wp.class.php:1118
699
- msgid "Capture Mini Tags like [php][/php] as Crayons."
700
- msgstr " [php][/php]تمكين التعرف على الاوسمة مثل "
701
-
702
- # @ crayon-syntax-highlighter
703
- #: ../crayon_settings_wp.class.php:1119
704
- msgid "Capture Inline Tags like {php}{/php} inside sentences."
705
- msgstr "تمكين التعرف على أكواد مثل {php}{/php} داخل التدوينات"
706
-
707
- # @ crayon-syntax-highlighter
708
- #: ../crayon_settings_wp.class.php:1120
709
- msgid "Enable [plain][/plain] tag."
710
- msgstr "تفعيل أوسمة [plain][/plain]"
711
-
712
- # @ crayon-syntax-highlighter
713
- #: ../crayon_settings_wp.class.php:1125
714
- msgid ""
715
- "When loading local files and a relative path is given for the URL, use the "
716
- "absolute path"
717
- msgstr "عند رفع ملفات من الجهاز ، عليك اعطاء الروابط الصحيحة "
718
-
719
- # @ crayon-syntax-highlighter
720
- #: ../crayon_settings_wp.class.php:1128
721
- msgid "Followed by your relative URL."
722
- msgstr "متبوعا برابطك "
723
-
724
- #: ../crayon_settings_wp.class.php:1135
725
- msgid "Convert Legacy Tags"
726
- msgstr "تحويل الأوسمة "
727
-
728
- #: ../crayon_settings_wp.class.php:1138
729
- msgid "No Legacy Tags Found"
730
- msgstr "لم يتم ايجاد اوسمة"
731
-
732
- #: ../crayon_settings_wp.class.php:1142
733
- msgid "Encode"
734
- msgstr ""
735
-
736
- # @ crayon-syntax-highlighter
737
- #: ../crayon_settings_wp.class.php:1144
738
- #, php-format
739
- msgid ""
740
- "Use %s to separate setting names from values in the &lt;pre&gt; class "
741
- "attribute"
742
- msgstr "استعمل %s لتفصل بين اسماء الاعدادات والقيم ف &lt;pre&gt; "
743
-
744
- #: ../crayon_settings_wp.class.php:1147
745
- msgid ""
746
- "Display the Tag Editor in any TinyMCE instances on the frontend (e.g. "
747
- "bbPress)"
748
- msgstr "عرض أوسمة المحرر في أي واجهة محرر TinyMCE آخر "
749
-
750
- #: ../crayon_settings_wp.class.php:1148
751
- msgid "Display Tag Editor settings on the frontend"
752
- msgstr "عرض أوسمة المحرر في الواجهة "
753
-
754
- # @ crayon-syntax-highlighter
755
- #: ../crayon_settings_wp.class.php:1152
756
- msgid "Clear the cache used to store remote code requests"
757
- msgstr "تفريغ الكاش المستعمل للحفظ التلقائي للكود"
758
-
759
- # @ crayon-syntax-highlighter
760
- #: ../crayon_settings_wp.class.php:1154
761
- msgid "Clear Now"
762
- msgstr "تفريغ الأن"
763
-
764
- # @ crayon-syntax-highlighter
765
- #: ../crayon_settings_wp.class.php:1155
766
- msgid "Attempt to load Crayon's CSS and JavaScript only when needed"
767
- msgstr "? تحاول أن تغير في ملفات الـ CSS و JavaScript في حالة الضرورة فقط "
768
-
769
- # @ crayon-syntax-highlighter
770
- #: ../crayon_settings_wp.class.php:1156
771
- msgid "Disable enqueuing for page templates that may contain The Loop."
772
- msgstr "تعطيل حقن الكود في القوالب التي تجتوي على Loop"
773
-
774
- # @ crayon-syntax-highlighter
775
- #: ../crayon_settings_wp.class.php:1157
776
- msgid "Allow Crayons inside comments"
777
- msgstr "تمكين الاضافة في التعليقات"
778
-
779
- #: ../crayon_settings_wp.class.php:1158
780
- msgid "Remove Crayons from excerpts"
781
- msgstr "حذف تنسيقات اضافة كود التلوين في ال excerpts"
782
-
783
- # @ crayon-syntax-highlighter
784
- #: ../crayon_settings_wp.class.php:1159
785
- msgid "Load Crayons only from the main Wordpress query"
786
- msgstr "تمكين الاضافة من استعلامات ووردبريس الرئيسية فقط "
787
-
788
- # @ crayon-syntax-highlighter
789
- #: ../crayon_settings_wp.class.php:1160
790
- msgid "Disable mouse gestures for touchscreen devices (eg. MouseOver)"
791
- msgstr "تعطيل اعدادات الفأرة للأجهزة اللوحية "
792
-
793
- # @ crayon-syntax-highlighter
794
- #: ../crayon_settings_wp.class.php:1161
795
- msgid "Disable animations"
796
- msgstr "تعطيل التتنسيقات المتحركة "
797
-
798
- # @ crayon-syntax-highlighter
799
- #: ../crayon_settings_wp.class.php:1162
800
- msgid "Disable runtime stats"
801
- msgstr "تعطيل احصاءات العمل "
802
-
803
- # @ crayon-syntax-highlighter
804
- #: ../crayon_settings_wp.class.php:1168
805
- msgid "Log errors for individual Crayons"
806
- msgstr "سجلات الأخطاء الفردية للاضافة "
807
-
808
- # @ crayon-syntax-highlighter
809
- #: ../crayon_settings_wp.class.php:1169
810
- msgid "Log system-wide errors"
811
- msgstr "سجلات أخطاء النظام"
812
-
813
- # @ crayon-syntax-highlighter
814
- #: ../crayon_settings_wp.class.php:1170
815
- msgid "Display custom message for errors"
816
- msgstr "عرض رسالة مخصصة للأخطاء"
817
-
818
- # @ crayon-syntax-highlighter
819
- #: ../crayon_settings_wp.class.php:1182
820
- msgid "Show Log"
821
- msgstr "عرض السجلات"
822
-
823
- # @ crayon-syntax-highlighter
824
- #: ../crayon_settings_wp.class.php:1182
825
- msgid "Hide Log"
826
- msgstr "اخفاء السجلات"
827
-
828
- # @ crayon-syntax-highlighter
829
- #: ../crayon_settings_wp.class.php:1184
830
- msgid "Clear Log"
831
- msgstr "تفريغ السجلات"
832
-
833
- # @ crayon-syntax-highlighter
834
- #: ../crayon_settings_wp.class.php:1185
835
- msgid "Email Admin"
836
- msgstr "ايميل الادارة"
837
-
838
- # @ crayon-syntax-highlighter
839
- #: ../crayon_settings_wp.class.php:1187
840
- msgid "Email Developer"
841
- msgstr "ايميل المطور"
842
-
843
- # @ crayon-syntax-highlighter
844
- #: ../crayon_settings_wp.class.php:1189
845
- msgid "The log is currently empty."
846
- msgstr "السجلات فارغة "
847
-
848
- # @ crayon-syntax-highlighter
849
- #: ../crayon_settings_wp.class.php:1191
850
- msgid "The log file exists and is writable."
851
- msgstr "السجلات متاحة وتستطيع الكتابة عليها "
852
-
853
- # @ crayon-syntax-highlighter
854
- #: ../crayon_settings_wp.class.php:1191
855
- msgid "The log file exists and is not writable."
856
- msgstr "السجلات موجودة لكن ? تسنطيع الكتابة عليها "
857
-
858
- # @ crayon-syntax-highlighter
859
- #: ../crayon_settings_wp.class.php:1193
860
- msgid "The log file does not exist and is not writable."
861
- msgstr "السجلات غير موجودة ، و? تستطيع كتابتها"
862
-
863
- # @ crayon-syntax-highlighter
864
- #: ../crayon_settings_wp.class.php:1203
865
- msgid "Version"
866
- msgstr "النسخة"
867
-
868
- # @ crayon-syntax-highlighter
869
- #: ../crayon_settings_wp.class.php:1205
870
- msgid "Developer"
871
- msgstr "المطور"
872
-
873
- # @ crayon-syntax-highlighter
874
- #: ../crayon_settings_wp.class.php:1206
875
- msgid "Translators"
876
- msgstr "المترجم"
877
-
878
- # @ crayon-syntax-highlighter
879
- #: ../crayon_settings_wp.class.php:1251
880
- msgid "?"
881
- msgstr "؟"
882
-
883
- # @ crayon-syntax-highlighter
884
- #: ../crayon_settings_wp.class.php:1258
885
- #: ../util/theme-editor/theme_editor.php:336
886
- msgid "Theme Editor"
887
- msgstr "محرر الاشكال"
888
-
889
- # @ crayon-syntax-highlighter
890
- #: ../crayon_settings_wp.class.php:1259
891
- msgid "Donate"
892
- msgstr "تبرع "
893
-
894
- # @ crayon-syntax-highlighter
895
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:62
896
- msgid "Add Crayon Code"
897
- msgstr "أظف كود تلوين جديد"
898
-
899
- # @ crayon-syntax-highlighter
900
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:63
901
- msgid "Edit Crayon Code"
902
- msgstr "عدل كود تلوين "
903
-
904
- # @ crayon-syntax-highlighter
905
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:64
906
- msgid "Add"
907
- msgstr "أظف"
908
-
909
- # @ crayon-syntax-highlighter
910
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:65
911
- #: ../util/theme-editor/theme_editor.php:352
912
- msgid "Save"
913
- msgstr "احفظ"
914
-
915
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:182
916
- msgid "OK"
917
- msgstr "تأكيد"
918
-
919
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:184
920
- msgid "Cancel"
921
- msgstr "إلغاء"
922
-
923
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:193
924
- msgid "A short description"
925
- msgstr "وصف قصير "
926
-
927
- # @ crayon-syntax-highlighter
928
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:195
929
- #: ../util/theme-editor/theme_editor.php:318
930
- msgid "Inline"
931
- msgstr "تضمين"
932
-
933
- # @ crayon-syntax-highlighter
934
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:197
935
- msgid "Don't Highlight"
936
- msgstr "تعطيل تلوين الكود"
937
-
938
- # @ crayon-syntax-highlighter
939
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:202
940
- #: ../util/theme-editor/theme_editor.php:322
941
- msgid "Language"
942
- msgstr "اللغات"
943
-
944
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:205
945
- msgid "Line Range"
946
- msgstr "نطاق الأسطر"
947
-
948
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:206
949
- msgid "(e.g. 3-5 or 3)"
950
- msgstr "(أمثلة : 3، 3-5 ) "
951
-
952
- # @ crayon-syntax-highlighter
953
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:207
954
- msgid "Marked Lines"
955
- msgstr "الأسطر المعلمة "
956
-
957
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:208
958
- msgid "(e.g. 1,2,3-5)"
959
- msgstr "( أمثلة 3،2،1-5 )"
960
-
961
- # @ crayon-syntax-highlighter
962
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:217
963
- msgid "Clear"
964
- msgstr "مسح"
965
-
966
- # @ crayon-syntax-highlighter
967
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:221
968
- msgid "Paste your code here, or type it in manually."
969
- msgstr "الصق الكود هنا ، أو اكتبه يدويا "
970
-
971
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:225
972
- msgid "URL"
973
- msgstr "الرابط"
974
-
975
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:227
976
- msgid "Relative local path or absolute URL"
977
- msgstr "رابط داخلي أو رابط خارجي "
978
-
979
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:230
980
- msgid ""
981
- "If the URL fails to load, the code above will be shown instead. If no code "
982
- "exists, an error is shown."
983
- msgstr ""
984
- "عند فشل تحميل الرابط ، سيظهر الكود مكانه ، في حال عدم وجود الكود ، ستظهر "
985
- "رسالة خطأ "
986
-
987
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:232
988
- #, php-format
989
- msgid ""
990
- "If a relative local path is given it will be appended to %s - which is "
991
- "defined in %sCrayon &gt; Settings &gt; Files%s."
992
- msgstr ""
993
- "في حالة اعطاء الرابط الداخلي ، سيتم اضافته الى %s الموجود على المسار "
994
- "%sكريون &gt; اعدادات &gt; ملفات %s."
995
-
996
- # @ crayon-syntax-highlighter
997
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:259
998
- msgid "Change the following settings to override their global values."
999
- msgstr "غير الاعدادات التالية لتحل محل الاعدادات العامة لهذه التدوينة"
1000
-
1001
- # @ crayon-syntax-highlighter
1002
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:261
1003
- msgid "Only changes (shown yellow) are applied."
1004
- msgstr "التغييرات باللون الاصفر هي فقط من فعلت "
1005
-
1006
- #: ../util/tag-editor/crayon_tag_editor_wp.class.php:263
1007
- #, php-format
1008
- msgid ""
1009
- "Future changes to the global settings under %sCrayon &gt; Settings%s won't "
1010
- "affect overridden settings."
1011
- msgstr ""
1012
- "التغييرات المستقبلية للاعدادات العامة %sللأضافة &gt; %s لن تأثر على "
1013
- "الاعدادات المغيرة يدويا"
1014
-
1015
- #: ../util/theme-editor/theme_editor.php:192
1016
- msgid "User-Defined Theme"
1017
- msgstr "ثيم معرف من المستخدم"
1018
-
1019
- # @ crayon-syntax-highlighter
1020
- #: ../util/theme-editor/theme_editor.php:193
1021
- #, fuzzy
1022
- msgid "Stock Theme"
1023
- msgstr "الشكل المخزن"
1024
-
1025
- #: ../util/theme-editor/theme_editor.php:194
1026
- msgid "Success!"
1027
- msgstr "نجح"
1028
-
1029
- #: ../util/theme-editor/theme_editor.php:195
1030
- msgid "Failed!"
1031
- msgstr "فشل"
1032
-
1033
- #: ../util/theme-editor/theme_editor.php:197
1034
- #, php-format
1035
- msgid "Are you sure you want to delete the \"%s\" theme?"
1036
- msgstr "؟ \"%s\" ىهل أنت متأكد من حذف الثيم المسمى بـ"
1037
-
1038
- #: ../util/theme-editor/theme_editor.php:198
1039
- #, fuzzy
1040
- msgid "Delete failed!"
1041
- msgstr "فشل الحذف"
1042
-
1043
- #: ../util/theme-editor/theme_editor.php:200
1044
- msgid "New Name"
1045
- msgstr "اسم جديد"
1046
-
1047
- #: ../util/theme-editor/theme_editor.php:201
1048
- #, fuzzy
1049
- msgid "Duplicate failed!"
1050
- msgstr "فشل النسخ"
1051
-
1052
- #: ../util/theme-editor/theme_editor.php:202
1053
- msgid "Please check the log for details."
1054
- msgstr "من فضلك ، تحقق من السجلات لمزيد من التفاصيل "
1055
-
1056
- #: ../util/theme-editor/theme_editor.php:203
1057
- msgid "Are you sure you want to discard all changes?"
1058
- msgstr "هل أنت متأكد من حذف جميع التغييرات ؟"
1059
-
1060
- #: ../util/theme-editor/theme_editor.php:204
1061
- #, fuzzy, php-format
1062
- msgid "Editing Theme: %s"
1063
- msgstr " \"%s\" تحرير الشكل "
1064
-
1065
- #: ../util/theme-editor/theme_editor.php:205
1066
- #, fuzzy, php-format
1067
- msgid "Creating Theme: %s"
1068
- msgstr " \"%s\" أنشأ شكلا مبني على "
1069
-
1070
- #: ../util/theme-editor/theme_editor.php:206
1071
- msgid "Submit Your Theme"
1072
- msgstr "ارسل الثيم"
1073
-
1074
- #: ../util/theme-editor/theme_editor.php:207
1075
- msgid ""
1076
- "Submit your User Theme for inclusion as a Stock Theme in Crayon! This will "
1077
- "email me your theme - make sure it's considerably different from the stock "
1078
- "themes :)"
1079
- msgstr ""
1080
- "ارسل هذا الثيم في الاضافة, وهذا سيرسل الى ايميل بهذا الثيمتأكد من أن يكون "
1081
- "الثيم فريد ولايشبه شكلا سابقا"
1082
-
1083
- #: ../util/theme-editor/theme_editor.php:208
1084
- msgid "Message"
1085
- msgstr "رسالة"
1086
-
1087
- #: ../util/theme-editor/theme_editor.php:209
1088
- msgid "Please include this theme in Crayon!"
1089
- msgstr "ضمن هذا الثيمفي الاضافة "
1090
-
1091
- # @ crayon-syntax-highlighter
1092
- #: ../util/theme-editor/theme_editor.php:210
1093
- #, fuzzy
1094
- msgid "Submit was successful."
1095
- msgstr "تم التحويل بنجاح"
1096
-
1097
- #: ../util/theme-editor/theme_editor.php:211
1098
- msgid "Submit failed!"
1099
- msgstr "فشل الارسال"
1100
-
1101
- #: ../util/theme-editor/theme_editor.php:294
1102
- msgid "Information"
1103
- msgstr "معلومات"
1104
-
1105
- # @ crayon-syntax-highlighter
1106
- #: ../util/theme-editor/theme_editor.php:295
1107
- #, fuzzy
1108
- msgid "Highlighting"
1109
- msgstr "تعطيل تلوين الكود"
1110
-
1111
- #: ../util/theme-editor/theme_editor.php:296
1112
- msgid "Frame"
1113
- msgstr "الاطار"
1114
-
1115
- # @ crayon-syntax-highlighter
1116
- #: ../util/theme-editor/theme_editor.php:298
1117
- #, fuzzy
1118
- msgid "Line Numbers"
1119
- msgstr "أظهر/أخف أرقام الأسطر"
1120
-
1121
- #: ../util/theme-editor/theme_editor.php:301
1122
- msgid "Background"
1123
- msgstr "الخلفية"
1124
-
1125
- #: ../util/theme-editor/theme_editor.php:302
1126
- msgid "Text"
1127
- msgstr "الرسالة"
1128
-
1129
- #: ../util/theme-editor/theme_editor.php:303
1130
- msgid "Border"
1131
- msgstr "الحدود"
1132
-
1133
- #: ../util/theme-editor/theme_editor.php:304
1134
- msgid "Top Border"
1135
- msgstr "الحد الأعلى"
1136
-
1137
- # @ crayon-syntax-highlighter
1138
- #: ../util/theme-editor/theme_editor.php:305
1139
- #, fuzzy
1140
- msgid "Bottom Border"
1141
- msgstr "الهامش السفلي"
1142
-
1143
- #: ../util/theme-editor/theme_editor.php:306
1144
- msgid "Right Border"
1145
- msgstr "الحد الأيمن"
1146
-
1147
- #: ../util/theme-editor/theme_editor.php:308
1148
- msgid "Hover"
1149
- msgstr "ممرر"
1150
-
1151
- #: ../util/theme-editor/theme_editor.php:309
1152
- msgid "Active"
1153
- msgstr "مفعل"
1154
-
1155
- #: ../util/theme-editor/theme_editor.php:310
1156
- msgid "Pressed"
1157
- msgstr "الضغط"
1158
-
1159
- #: ../util/theme-editor/theme_editor.php:311
1160
- msgid "Pressed & Hover"
1161
- msgstr "مضغط و عند التمرير"
1162
-
1163
- #: ../util/theme-editor/theme_editor.php:312
1164
- msgid "Pressed & Active"
1165
- msgstr "مضغط و معلم"
1166
-
1167
- #: ../util/theme-editor/theme_editor.php:315
1168
- msgid "Buttons"
1169
- msgstr "ازرار"
1170
-
1171
- #: ../util/theme-editor/theme_editor.php:317
1172
- msgid "Normal"
1173
- msgstr "عادي"
1174
-
1175
- #: ../util/theme-editor/theme_editor.php:319
1176
- msgid "Striped"
1177
- msgstr "ملقم"
1178
-
1179
- # @ crayon-syntax-highlighter
1180
- #: ../util/theme-editor/theme_editor.php:320
1181
- #, fuzzy
1182
- msgid "Marked"
1183
- msgstr "الأسطر المعلمة "
1184
-
1185
- #: ../util/theme-editor/theme_editor.php:321
1186
- msgid "Striped & Marked"
1187
- msgstr "ملقم ومعلم"
1188
-
1189
- # @ crayon-syntax-highlighter
1190
- #: ../util/theme-editor/theme_editor.php:351
1191
- msgid "Back To Settings"
1192
- msgstr "العودة للإعدادات"
1193
-
1194
- #: ../util/theme-editor/theme_editor.php:390
1195
- msgid "Comment"
1196
- msgstr "تعليق"
1197
-
1198
- #: ../util/theme-editor/theme_editor.php:391
1199
- msgid "String"
1200
- msgstr "حروف"
1201
-
1202
- #: ../util/theme-editor/theme_editor.php:392
1203
- msgid "Preprocessor"
1204
- msgstr "قبل المعالجة"
1205
-
1206
- # @ crayon-syntax-highlighter
1207
- #: ../util/theme-editor/theme_editor.php:393
1208
- #, fuzzy
1209
- msgid "Tag"
1210
- msgstr "أوسمة"
1211
-
1212
- #: ../util/theme-editor/theme_editor.php:394
1213
- msgid "Keyword"
1214
- msgstr "كلمات مفتاحية"
1215
-
1216
- #: ../util/theme-editor/theme_editor.php:395
1217
- msgid "Statement"
1218
- msgstr "تقرير"
1219
-
1220
- #: ../util/theme-editor/theme_editor.php:396
1221
- msgid "Reserved"
1222
- msgstr "محفوظة"
1223
-
1224
- #: ../util/theme-editor/theme_editor.php:397
1225
- msgid "Type"
1226
- msgstr "نوع"
1227
-
1228
- #: ../util/theme-editor/theme_editor.php:398
1229
- #, fuzzy
1230
- msgid "Modifier"
1231
- msgstr "حرر في"
1232
-
1233
- #: ../util/theme-editor/theme_editor.php:399
1234
- msgid "Identifier"
1235
- msgstr "معرف"
1236
-
1237
- #: ../util/theme-editor/theme_editor.php:400
1238
- msgid "Entity"
1239
- msgstr "وحدة"
1240
-
1241
- #: ../util/theme-editor/theme_editor.php:401
1242
- msgid "Variable"
1243
- msgstr "متغير"
1244
-
1245
- #: ../util/theme-editor/theme_editor.php:402
1246
- msgid "Constant"
1247
- msgstr "ثابت"
1248
-
1249
- #: ../util/theme-editor/theme_editor.php:403
1250
- msgid "Operator"
1251
- msgstr "معامل"
1252
-
1253
- #: ../util/theme-editor/theme_editor.php:404
1254
- msgid "Symbol"
1255
- msgstr "رمز"
1256
-
1257
- #: ../util/theme-editor/theme_editor.php:405
1258
- msgid "Notation"
1259
- msgstr "تدوين"
1260
-
1261
- #: ../util/theme-editor/theme_editor.php:406
1262
- msgid "Faded"
1263
- msgstr "تلاشي"
1264
-
1265
- #: ../util/theme-editor/theme_editor.php:407
1266
- msgid "HTML"
1267
- msgstr "HTML"
1268
-
1269
- #: ../util/theme-editor/theme_editor.php:540
1270
- msgid "(Used for Copy/Paste)"
1271
- msgstr "(مستخدم للنسخ/اللصق)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trans/crayon-syntax-highlighter-ar_AR.mo CHANGED
Binary file
trans/crayon-syntax-highlighter-ar_AR.po CHANGED
@@ -2,11 +2,11 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: crayon-syntax-highlighter\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-05-23 23:09+1000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
- "Language: fr_FR\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
@@ -75,7 +75,7 @@ msgstr "شهريا"
75
  # @ crayon-syntax-highlighter
76
  #: ../crayon_settings.class.php:152
77
  msgid "Immediately"
78
- msgstr "حاﻻ"
79
 
80
  # @ crayon-syntax-highlighter
81
  #: ../crayon_settings.class.php:163 ../crayon_settings.class.php:167
@@ -162,7 +162,7 @@ msgstr "تعطيل أفعال الفأرة"
162
  # @ crayon-syntax-highlighter
163
  #: ../crayon_settings.class.php:211
164
  msgid "An error has occurred. Please try again later."
165
- msgstr "لقد حدث خطأ . الرجاء اعادة المحاولة ﻻحقا."
166
 
167
  # @ crayon-syntax-highlighter
168
  #: ../crayon_settings.class.php:227
@@ -176,7 +176,7 @@ msgstr ""
176
 
177
  # @ crayon-syntax-highlighter
178
  #: ../crayon_settings_wp.class.php:53 ../crayon_settings_wp.class.php:210
179
- #: ../crayon_settings_wp.class.php:1255
180
  #: ../util/tag-editor/crayon_tag_editor_wp.class.php:254
181
  msgid "Settings"
182
  msgstr "إعدادات"
@@ -463,7 +463,7 @@ msgstr "خطأ في التحويل "
463
  #: ../crayon_settings_wp.class.php:835
464
  #, php-format
465
  msgid "The selected language with id %s could not be loaded"
466
- msgstr " (%s) نستطيع تحديد اللغة المختارة بـالرقم "
467
 
468
  # @ crayon-syntax-highlighter
469
  #: ../crayon_settings_wp.class.php:838
@@ -552,7 +552,7 @@ msgstr "تحميل اعدادات الاضافة في التروسية -أكث
552
  #: ../crayon_settings_wp.class.php:1043
553
  #, php-format
554
  msgid "The selected theme with id %s could not be loaded"
555
- msgstr " %s نستطيع تحميل الشكل المحدد بالرقم "
556
 
557
  #: ../crayon_settings_wp.class.php:1055
558
  msgid "Add More"
@@ -573,7 +573,7 @@ msgstr "الارتفاع"
573
  #: ../crayon_settings_wp.class.php:1064
574
  #, php-format
575
  msgid "The selected font with id %s could not be loaded"
576
- msgstr " (%s) يمكن تحديد الخط المحدد بالــ"
577
 
578
  # @ crayon-syntax-highlighter
579
  #: ../crayon_settings_wp.class.php:1070
@@ -764,7 +764,7 @@ msgstr "تفريغ الأن"
764
  # @ crayon-syntax-highlighter
765
  #: ../crayon_settings_wp.class.php:1155
766
  msgid "Attempt to load Crayon's CSS and JavaScript only when needed"
767
- msgstr " تحاول أن تغير في ملفات الـ CSS و JavaScript في حالة الضرورة فقط "
768
 
769
  # @ crayon-syntax-highlighter
770
  #: ../crayon_settings_wp.class.php:1156
@@ -853,12 +853,12 @@ msgstr "السجلات متاحة وتستطيع الكتابة عليها "
853
  # @ crayon-syntax-highlighter
854
  #: ../crayon_settings_wp.class.php:1191
855
  msgid "The log file exists and is not writable."
856
- msgstr "السجلات موجودة لكن تسنطيع الكتابة عليها "
857
 
858
  # @ crayon-syntax-highlighter
859
  #: ../crayon_settings_wp.class.php:1193
860
  msgid "The log file does not exist and is not writable."
861
- msgstr "السجلات غير موجودة ، وﻻ تستطيع كتابتها"
862
 
863
  # @ crayon-syntax-highlighter
864
  #: ../crayon_settings_wp.class.php:1203
@@ -876,18 +876,18 @@ msgid "Translators"
876
  msgstr "المترجم"
877
 
878
  # @ crayon-syntax-highlighter
879
- #: ../crayon_settings_wp.class.php:1249
880
  msgid "?"
881
  msgstr "؟"
882
 
883
  # @ crayon-syntax-highlighter
884
- #: ../crayon_settings_wp.class.php:1256
885
  #: ../util/theme-editor/theme_editor.php:336
886
  msgid "Theme Editor"
887
  msgstr "محرر الاشكال"
888
 
889
  # @ crayon-syntax-highlighter
890
- #: ../crayon_settings_wp.class.php:1257
891
  msgid "Donate"
892
  msgstr "تبرع "
893
 
@@ -1014,48 +1014,48 @@ msgstr ""
1014
 
1015
  #: ../util/theme-editor/theme_editor.php:192
1016
  msgid "User-Defined Theme"
1017
- msgstr ""
1018
 
1019
  # @ crayon-syntax-highlighter
1020
  #: ../util/theme-editor/theme_editor.php:193
1021
  #, fuzzy
1022
  msgid "Stock Theme"
1023
- msgstr "الشكل"
1024
 
1025
  #: ../util/theme-editor/theme_editor.php:194
1026
  msgid "Success!"
1027
- msgstr ""
1028
 
1029
  #: ../util/theme-editor/theme_editor.php:195
1030
  msgid "Failed!"
1031
- msgstr ""
1032
 
1033
  #: ../util/theme-editor/theme_editor.php:197
1034
  #, php-format
1035
  msgid "Are you sure you want to delete the \"%s\" theme?"
1036
- msgstr ""
1037
 
1038
  #: ../util/theme-editor/theme_editor.php:198
1039
  #, fuzzy
1040
  msgid "Delete failed!"
1041
- msgstr "احذف"
1042
 
1043
  #: ../util/theme-editor/theme_editor.php:200
1044
  msgid "New Name"
1045
- msgstr ""
1046
 
1047
  #: ../util/theme-editor/theme_editor.php:201
1048
  #, fuzzy
1049
  msgid "Duplicate failed!"
1050
- msgstr "انسخ"
1051
 
1052
  #: ../util/theme-editor/theme_editor.php:202
1053
  msgid "Please check the log for details."
1054
- msgstr ""
1055
 
1056
  #: ../util/theme-editor/theme_editor.php:203
1057
  msgid "Are you sure you want to discard all changes?"
1058
- msgstr ""
1059
 
1060
  #: ../util/theme-editor/theme_editor.php:204
1061
  #, fuzzy, php-format
@@ -1069,7 +1069,7 @@ msgstr " \"%s\" أنشأ شكلا مبني على "
1069
 
1070
  #: ../util/theme-editor/theme_editor.php:206
1071
  msgid "Submit Your Theme"
1072
- msgstr ""
1073
 
1074
  #: ../util/theme-editor/theme_editor.php:207
1075
  msgid ""
@@ -1077,14 +1077,16 @@ msgid ""
1077
  "email me your theme - make sure it's considerably different from the stock "
1078
  "themes :)"
1079
  msgstr ""
 
 
1080
 
1081
  #: ../util/theme-editor/theme_editor.php:208
1082
  msgid "Message"
1083
- msgstr ""
1084
 
1085
  #: ../util/theme-editor/theme_editor.php:209
1086
  msgid "Please include this theme in Crayon!"
1087
- msgstr ""
1088
 
1089
  # @ crayon-syntax-highlighter
1090
  #: ../util/theme-editor/theme_editor.php:210
@@ -1094,11 +1096,11 @@ msgstr "تم التحويل بنجاح"
1094
 
1095
  #: ../util/theme-editor/theme_editor.php:211
1096
  msgid "Submit failed!"
1097
- msgstr ""
1098
 
1099
  #: ../util/theme-editor/theme_editor.php:294
1100
  msgid "Information"
1101
- msgstr ""
1102
 
1103
  # @ crayon-syntax-highlighter
1104
  #: ../util/theme-editor/theme_editor.php:295
@@ -1108,7 +1110,7 @@ msgstr "تعطيل تلوين الكود"
1108
 
1109
  #: ../util/theme-editor/theme_editor.php:296
1110
  msgid "Frame"
1111
- msgstr ""
1112
 
1113
  # @ crayon-syntax-highlighter
1114
  #: ../util/theme-editor/theme_editor.php:298
@@ -1118,19 +1120,19 @@ msgstr "أظهر/أخف أرقام الأسطر"
1118
 
1119
  #: ../util/theme-editor/theme_editor.php:301
1120
  msgid "Background"
1121
- msgstr ""
1122
 
1123
  #: ../util/theme-editor/theme_editor.php:302
1124
  msgid "Text"
1125
- msgstr ""
1126
 
1127
  #: ../util/theme-editor/theme_editor.php:303
1128
  msgid "Border"
1129
- msgstr ""
1130
 
1131
  #: ../util/theme-editor/theme_editor.php:304
1132
  msgid "Top Border"
1133
- msgstr ""
1134
 
1135
  # @ crayon-syntax-highlighter
1136
  #: ../util/theme-editor/theme_editor.php:305
@@ -1140,39 +1142,39 @@ msgstr "الهامش السفلي"
1140
 
1141
  #: ../util/theme-editor/theme_editor.php:306
1142
  msgid "Right Border"
1143
- msgstr ""
1144
 
1145
  #: ../util/theme-editor/theme_editor.php:308
1146
  msgid "Hover"
1147
- msgstr ""
1148
 
1149
  #: ../util/theme-editor/theme_editor.php:309
1150
  msgid "Active"
1151
- msgstr ""
1152
 
1153
  #: ../util/theme-editor/theme_editor.php:310
1154
  msgid "Pressed"
1155
- msgstr ""
1156
 
1157
  #: ../util/theme-editor/theme_editor.php:311
1158
  msgid "Pressed & Hover"
1159
- msgstr ""
1160
 
1161
  #: ../util/theme-editor/theme_editor.php:312
1162
  msgid "Pressed & Active"
1163
- msgstr ""
1164
 
1165
  #: ../util/theme-editor/theme_editor.php:315
1166
  msgid "Buttons"
1167
- msgstr ""
1168
 
1169
  #: ../util/theme-editor/theme_editor.php:317
1170
  msgid "Normal"
1171
- msgstr ""
1172
 
1173
  #: ../util/theme-editor/theme_editor.php:319
1174
  msgid "Striped"
1175
- msgstr ""
1176
 
1177
  # @ crayon-syntax-highlighter
1178
  #: ../util/theme-editor/theme_editor.php:320
@@ -1182,7 +1184,7 @@ msgstr "الأسطر المعلمة "
1182
 
1183
  #: ../util/theme-editor/theme_editor.php:321
1184
  msgid "Striped & Marked"
1185
- msgstr ""
1186
 
1187
  # @ crayon-syntax-highlighter
1188
  #: ../util/theme-editor/theme_editor.php:351
@@ -1191,15 +1193,15 @@ msgstr "العودة للإعدادات"
1191
 
1192
  #: ../util/theme-editor/theme_editor.php:390
1193
  msgid "Comment"
1194
- msgstr ""
1195
 
1196
  #: ../util/theme-editor/theme_editor.php:391
1197
  msgid "String"
1198
- msgstr ""
1199
 
1200
  #: ../util/theme-editor/theme_editor.php:392
1201
  msgid "Preprocessor"
1202
- msgstr ""
1203
 
1204
  # @ crayon-syntax-highlighter
1205
  #: ../util/theme-editor/theme_editor.php:393
@@ -1209,19 +1211,19 @@ msgstr "أوسمة"
1209
 
1210
  #: ../util/theme-editor/theme_editor.php:394
1211
  msgid "Keyword"
1212
- msgstr ""
1213
 
1214
  #: ../util/theme-editor/theme_editor.php:395
1215
  msgid "Statement"
1216
- msgstr ""
1217
 
1218
  #: ../util/theme-editor/theme_editor.php:396
1219
  msgid "Reserved"
1220
- msgstr ""
1221
 
1222
  #: ../util/theme-editor/theme_editor.php:397
1223
  msgid "Type"
1224
- msgstr ""
1225
 
1226
  #: ../util/theme-editor/theme_editor.php:398
1227
  #, fuzzy
@@ -1230,40 +1232,40 @@ msgstr "حرر في"
1230
 
1231
  #: ../util/theme-editor/theme_editor.php:399
1232
  msgid "Identifier"
1233
- msgstr ""
1234
 
1235
  #: ../util/theme-editor/theme_editor.php:400
1236
  msgid "Entity"
1237
- msgstr ""
1238
 
1239
  #: ../util/theme-editor/theme_editor.php:401
1240
  msgid "Variable"
1241
- msgstr ""
1242
 
1243
  #: ../util/theme-editor/theme_editor.php:402
1244
  msgid "Constant"
1245
- msgstr ""
1246
 
1247
  #: ../util/theme-editor/theme_editor.php:403
1248
  msgid "Operator"
1249
- msgstr ""
1250
 
1251
  #: ../util/theme-editor/theme_editor.php:404
1252
  msgid "Symbol"
1253
- msgstr ""
1254
 
1255
  #: ../util/theme-editor/theme_editor.php:405
1256
  msgid "Notation"
1257
- msgstr ""
1258
 
1259
  #: ../util/theme-editor/theme_editor.php:406
1260
  msgid "Faded"
1261
- msgstr ""
1262
 
1263
  #: ../util/theme-editor/theme_editor.php:407
1264
  msgid "HTML"
1265
- msgstr ""
1266
 
1267
  #: ../util/theme-editor/theme_editor.php:540
1268
  msgid "(Used for Copy/Paste)"
1269
- msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: crayon-syntax-highlighter\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-05-24 08:40+1000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
+ "Language: ar-AR\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
75
  # @ crayon-syntax-highlighter
76
  #: ../crayon_settings.class.php:152
77
  msgid "Immediately"
78
+ msgstr "حا?"
79
 
80
  # @ crayon-syntax-highlighter
81
  #: ../crayon_settings.class.php:163 ../crayon_settings.class.php:167
162
  # @ crayon-syntax-highlighter
163
  #: ../crayon_settings.class.php:211
164
  msgid "An error has occurred. Please try again later."
165
+ msgstr "لقد حدث خطأ . الرجاء اعادة المحاولة ?حقا."
166
 
167
  # @ crayon-syntax-highlighter
168
  #: ../crayon_settings.class.php:227
176
 
177
  # @ crayon-syntax-highlighter
178
  #: ../crayon_settings_wp.class.php:53 ../crayon_settings_wp.class.php:210
179
+ #: ../crayon_settings_wp.class.php:1257
180
  #: ../util/tag-editor/crayon_tag_editor_wp.class.php:254
181
  msgid "Settings"
182
  msgstr "إعدادات"
463
  #: ../crayon_settings_wp.class.php:835
464
  #, php-format
465
  msgid "The selected language with id %s could not be loaded"
466
+ msgstr " (%s) ? نستطيع تحديد اللغة المختارة بـالرقم "
467
 
468
  # @ crayon-syntax-highlighter
469
  #: ../crayon_settings_wp.class.php:838
552
  #: ../crayon_settings_wp.class.php:1043
553
  #, php-format
554
  msgid "The selected theme with id %s could not be loaded"
555
+ msgstr " %s ? نستطيع تحميل الشكل المحدد بالرقم "
556
 
557
  #: ../crayon_settings_wp.class.php:1055
558
  msgid "Add More"
573
  #: ../crayon_settings_wp.class.php:1064
574
  #, php-format
575
  msgid "The selected font with id %s could not be loaded"
576
+ msgstr " (%s) ? يمكن تحديد الخط المحدد بالــ"
577
 
578
  # @ crayon-syntax-highlighter
579
  #: ../crayon_settings_wp.class.php:1070
764
  # @ crayon-syntax-highlighter
765
  #: ../crayon_settings_wp.class.php:1155
766
  msgid "Attempt to load Crayon's CSS and JavaScript only when needed"
767
+ msgstr "? تحاول أن تغير في ملفات الـ CSS و JavaScript في حالة الضرورة فقط "
768
 
769
  # @ crayon-syntax-highlighter
770
  #: ../crayon_settings_wp.class.php:1156
853
  # @ crayon-syntax-highlighter
854
  #: ../crayon_settings_wp.class.php:1191
855
  msgid "The log file exists and is not writable."
856
+ msgstr "السجلات موجودة لكن ? تسنطيع الكتابة عليها "
857
 
858
  # @ crayon-syntax-highlighter
859
  #: ../crayon_settings_wp.class.php:1193
860
  msgid "The log file does not exist and is not writable."
861
+ msgstr "السجلات غير موجودة ، و? تستطيع كتابتها"
862
 
863
  # @ crayon-syntax-highlighter
864
  #: ../crayon_settings_wp.class.php:1203
876
  msgstr "المترجم"
877
 
878
  # @ crayon-syntax-highlighter
879
+ #: ../crayon_settings_wp.class.php:1251
880
  msgid "?"
881
  msgstr "؟"
882
 
883
  # @ crayon-syntax-highlighter
884
+ #: ../crayon_settings_wp.class.php:1258
885
  #: ../util/theme-editor/theme_editor.php:336
886
  msgid "Theme Editor"
887
  msgstr "محرر الاشكال"
888
 
889
  # @ crayon-syntax-highlighter
890
+ #: ../crayon_settings_wp.class.php:1259
891
  msgid "Donate"
892
  msgstr "تبرع "
893
 
1014
 
1015
  #: ../util/theme-editor/theme_editor.php:192
1016
  msgid "User-Defined Theme"
1017
+ msgstr "ثيم معرف من المستخدم"
1018
 
1019
  # @ crayon-syntax-highlighter
1020
  #: ../util/theme-editor/theme_editor.php:193
1021
  #, fuzzy
1022
  msgid "Stock Theme"
1023
+ msgstr "الشكل المخزن"
1024
 
1025
  #: ../util/theme-editor/theme_editor.php:194
1026
  msgid "Success!"
1027
+ msgstr "نجح"
1028
 
1029
  #: ../util/theme-editor/theme_editor.php:195
1030
  msgid "Failed!"
1031
+ msgstr "فشل"
1032
 
1033
  #: ../util/theme-editor/theme_editor.php:197
1034
  #, php-format
1035
  msgid "Are you sure you want to delete the \"%s\" theme?"
1036
+ msgstr "؟ \"%s\" ىهل أنت متأكد من حذف الثيم المسمى بـ"
1037
 
1038
  #: ../util/theme-editor/theme_editor.php:198
1039
  #, fuzzy
1040
  msgid "Delete failed!"
1041
+ msgstr "فشل الحذف"
1042
 
1043
  #: ../util/theme-editor/theme_editor.php:200
1044
  msgid "New Name"
1045
+ msgstr "اسم جديد"
1046
 
1047
  #: ../util/theme-editor/theme_editor.php:201
1048
  #, fuzzy
1049
  msgid "Duplicate failed!"
1050
+ msgstr "فشل النسخ"
1051
 
1052
  #: ../util/theme-editor/theme_editor.php:202
1053
  msgid "Please check the log for details."
1054
+ msgstr "من فضلك ، تحقق من السجلات لمزيد من التفاصيل "
1055
 
1056
  #: ../util/theme-editor/theme_editor.php:203
1057
  msgid "Are you sure you want to discard all changes?"
1058
+ msgstr "هل أنت متأكد من حذف جميع التغييرات ؟"
1059
 
1060
  #: ../util/theme-editor/theme_editor.php:204
1061
  #, fuzzy, php-format
1069
 
1070
  #: ../util/theme-editor/theme_editor.php:206
1071
  msgid "Submit Your Theme"
1072
+ msgstr "ارسل الثيم"
1073
 
1074
  #: ../util/theme-editor/theme_editor.php:207
1075
  msgid ""
1077
  "email me your theme - make sure it's considerably different from the stock "
1078
  "themes :)"
1079
  msgstr ""
1080
+ "ارسل هذا الثيم في الاضافة, وهذا سيرسل الى ايميل بهذا الثيمتأكد من أن يكون "
1081
+ "الثيم فريد ولايشبه شكلا سابقا"
1082
 
1083
  #: ../util/theme-editor/theme_editor.php:208
1084
  msgid "Message"
1085
+ msgstr "رسالة"
1086
 
1087
  #: ../util/theme-editor/theme_editor.php:209
1088
  msgid "Please include this theme in Crayon!"
1089
+ msgstr "ضمن هذا الثيمفي الاضافة "
1090
 
1091
  # @ crayon-syntax-highlighter
1092
  #: ../util/theme-editor/theme_editor.php:210
1096
 
1097
  #: ../util/theme-editor/theme_editor.php:211
1098
  msgid "Submit failed!"
1099
+ msgstr "فشل الارسال"
1100
 
1101
  #: ../util/theme-editor/theme_editor.php:294
1102
  msgid "Information"
1103
+ msgstr "معلومات"
1104
 
1105
  # @ crayon-syntax-highlighter
1106
  #: ../util/theme-editor/theme_editor.php:295
1110
 
1111
  #: ../util/theme-editor/theme_editor.php:296
1112
  msgid "Frame"
1113
+ msgstr "الاطار"
1114
 
1115
  # @ crayon-syntax-highlighter
1116
  #: ../util/theme-editor/theme_editor.php:298
1120
 
1121
  #: ../util/theme-editor/theme_editor.php:301
1122
  msgid "Background"
1123
+ msgstr "الخلفية"
1124
 
1125
  #: ../util/theme-editor/theme_editor.php:302
1126
  msgid "Text"
1127
+ msgstr "الرسالة"
1128
 
1129
  #: ../util/theme-editor/theme_editor.php:303
1130
  msgid "Border"
1131
+ msgstr "الحدود"
1132
 
1133
  #: ../util/theme-editor/theme_editor.php:304
1134
  msgid "Top Border"
1135
+ msgstr "الحد الأعلى"
1136
 
1137
  # @ crayon-syntax-highlighter
1138
  #: ../util/theme-editor/theme_editor.php:305
1142
 
1143
  #: ../util/theme-editor/theme_editor.php:306
1144
  msgid "Right Border"
1145
+ msgstr "الحد الأيمن"
1146
 
1147
  #: ../util/theme-editor/theme_editor.php:308
1148
  msgid "Hover"
1149
+ msgstr "ممرر"
1150
 
1151
  #: ../util/theme-editor/theme_editor.php:309
1152
  msgid "Active"
1153
+ msgstr "مفعل"
1154
 
1155
  #: ../util/theme-editor/theme_editor.php:310
1156
  msgid "Pressed"
1157
+ msgstr "الضغط"
1158
 
1159
  #: ../util/theme-editor/theme_editor.php:311
1160
  msgid "Pressed & Hover"
1161
+ msgstr "مضغط و عند التمرير"
1162
 
1163
  #: ../util/theme-editor/theme_editor.php:312
1164
  msgid "Pressed & Active"
1165
+ msgstr "مضغط و معلم"
1166
 
1167
  #: ../util/theme-editor/theme_editor.php:315
1168
  msgid "Buttons"
1169
+ msgstr "ازرار"
1170
 
1171
  #: ../util/theme-editor/theme_editor.php:317
1172
  msgid "Normal"
1173
+ msgstr "عادي"
1174
 
1175
  #: ../util/theme-editor/theme_editor.php:319
1176
  msgid "Striped"
1177
+ msgstr "ملقم"
1178
 
1179
  # @ crayon-syntax-highlighter
1180
  #: ../util/theme-editor/theme_editor.php:320
1184
 
1185
  #: ../util/theme-editor/theme_editor.php:321
1186
  msgid "Striped & Marked"
1187
+ msgstr "ملقم ومعلم"
1188
 
1189
  # @ crayon-syntax-highlighter
1190
  #: ../util/theme-editor/theme_editor.php:351
1193
 
1194
  #: ../util/theme-editor/theme_editor.php:390
1195
  msgid "Comment"
1196
+ msgstr "تعليق"
1197
 
1198
  #: ../util/theme-editor/theme_editor.php:391
1199
  msgid "String"
1200
+ msgstr "حروف"
1201
 
1202
  #: ../util/theme-editor/theme_editor.php:392
1203
  msgid "Preprocessor"
1204
+ msgstr "قبل المعالجة"
1205
 
1206
  # @ crayon-syntax-highlighter
1207
  #: ../util/theme-editor/theme_editor.php:393
1211
 
1212
  #: ../util/theme-editor/theme_editor.php:394
1213
  msgid "Keyword"
1214
+ msgstr "كلمات مفتاحية"
1215
 
1216
  #: ../util/theme-editor/theme_editor.php:395
1217
  msgid "Statement"
1218
+ msgstr "تقرير"
1219
 
1220
  #: ../util/theme-editor/theme_editor.php:396
1221
  msgid "Reserved"
1222
+ msgstr "محفوظة"
1223
 
1224
  #: ../util/theme-editor/theme_editor.php:397
1225
  msgid "Type"
1226
+ msgstr "نوع"
1227
 
1228
  #: ../util/theme-editor/theme_editor.php:398
1229
  #, fuzzy
1232
 
1233
  #: ../util/theme-editor/theme_editor.php:399
1234
  msgid "Identifier"
1235
+ msgstr "معرف"
1236
 
1237
  #: ../util/theme-editor/theme_editor.php:400
1238
  msgid "Entity"
1239
+ msgstr "وحدة"
1240
 
1241
  #: ../util/theme-editor/theme_editor.php:401
1242
  msgid "Variable"
1243
+ msgstr "متغير"
1244
 
1245
  #: ../util/theme-editor/theme_editor.php:402
1246
  msgid "Constant"
1247
+ msgstr "ثابت"
1248
 
1249
  #: ../util/theme-editor/theme_editor.php:403
1250
  msgid "Operator"
1251
+ msgstr "معامل"
1252
 
1253
  #: ../util/theme-editor/theme_editor.php:404
1254
  msgid "Symbol"
1255
+ msgstr "رمز"
1256
 
1257
  #: ../util/theme-editor/theme_editor.php:405
1258
  msgid "Notation"
1259
+ msgstr "تدوين"
1260
 
1261
  #: ../util/theme-editor/theme_editor.php:406
1262
  msgid "Faded"
1263
+ msgstr "تلاشي"
1264
 
1265
  #: ../util/theme-editor/theme_editor.php:407
1266
  msgid "HTML"
1267
+ msgstr "HTML"
1268
 
1269
  #: ../util/theme-editor/theme_editor.php:540
1270
  msgid "(Used for Copy/Paste)"
1271
+ msgstr "(مستخدم للنسخ/اللصق)"
util/crayon_util.class.php CHANGED
@@ -334,6 +334,9 @@ EOT;
334
  return self::$touchscreen;
335
  }
336
  if (($devices = self::lines(CRAYON_TOUCH_FILE, 'lw')) !== FALSE) {
 
 
 
337
  // Create array of device strings from file
338
  $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
339
  self::$touchscreen = (self::strposa($user_agent, $devices) !== FALSE);
@@ -526,7 +529,7 @@ EOT;
526
  // Returns the current HTTP URL
527
  public static function current_url() {
528
  $p = self::isSecure() ? "https://" : "http://";
529
- return $p . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI];
530
  }
531
 
532
  // Removes crayon plugin path from absolute path
@@ -567,9 +570,18 @@ EOT;
567
 
568
  // returns 'true' or 'false' depending on whether this PHP file was served over HTTPS
569
  public static function isSecure() {
570
- return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
 
 
 
 
 
 
 
 
 
571
  }
572
-
573
  public static function startsWith($haystack, $needle) {
574
  return substr($haystack, 0, strlen($needle)) === $needle;
575
  }
334
  return self::$touchscreen;
335
  }
336
  if (($devices = self::lines(CRAYON_TOUCH_FILE, 'lw')) !== FALSE) {
337
+ if (!isset($_SERVER['HTTP_USER_AGENT'])) {
338
+ return false;
339
+ }
340
  // Create array of device strings from file
341
  $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
342
  self::$touchscreen = (self::strposa($user_agent, $devices) !== FALSE);
529
  // Returns the current HTTP URL
530
  public static function current_url() {
531
  $p = self::isSecure() ? "https://" : "http://";
532
+ return $p . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
533
  }
534
 
535
  // Removes crayon plugin path from absolute path
570
 
571
  // returns 'true' or 'false' depending on whether this PHP file was served over HTTPS
572
  public static function isSecure() {
573
+ // From https://core.trac.wordpress.org/browser/tags/4.0.1/src/wp-includes/functions.php
574
+ if ( isset($_SERVER['HTTPS']) ) {
575
+ if ( 'on' == strtolower($_SERVER['HTTPS']) )
576
+ return true;
577
+ if ( '1' == $_SERVER['HTTPS'] )
578
+ return true;
579
+ } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
580
+ return true;
581
+ }
582
+ return false;
583
  }
584
+
585
  public static function startsWith($haystack, $needle) {
586
  return substr($haystack, 0, strlen($needle)) === $needle;
587
  }
util/tag-editor/crayon_qt.js CHANGED
@@ -1,46 +1,50 @@
1
- (function($) {
2
 
3
- window.CrayonQuickTags = new function() {
4
-
5
- var base = this;
6
 
7
- base.init = function() {
8
- base.sel = '*[id*="crayon_quicktag"],*[class*="crayon_quicktag"]';
9
- QTags.addButton( 'crayon_quicktag', 'crayon', function() {
10
- CrayonTagEditor.showDialog({
11
- insert: function(shortcode) {
 
 
 
 
 
 
12
  QTags.insertContent(shortcode);
13
  },
14
  select: base.getSelectedText,
15
  editor_str: 'html',
16
  output: 'encode'
17
  });
18
- $(base.sel).removeClass('qt_crayon_highlight');
19
- });
20
- var qt_crayon;
21
- var find_qt_crayon = setInterval(function() {
22
- qt_crayon = $(base.sel).first();
23
- if (typeof qt_crayon != 'undefined') {
24
  CrayonTagEditor.bind(base.sel);
25
- clearInterval(find_qt_crayon);
26
- }
27
- }, 100);
28
- };
29
-
30
- base.getSelectedText = function() {
31
- if (QTags.instances.length == 0) {
32
- return null;
33
- } else {
34
- var qt = QTags.instances[0];
35
- var startPos = qt.canvas.selectionStart;
36
- var endPos = qt.canvas.selectionEnd;
37
- return qt.canvas.value.substring(startPos, endPos);
38
- }
39
- };
40
-
41
- };
42
-
43
- $(document).ready(function() {
44
  CrayonQuickTags.init();
45
  });
46
 
1
+ (function ($) {
2
 
3
+ var settings = CrayonTagEditorSettings;
 
 
4
 
5
+ window.CrayonQuickTags = new function () {
6
+
7
+ var base = this;
8
+
9
+ base.init = function () {
10
+ base.sel = '*[id*="crayon_quicktag"],*[class*="crayon_quicktag"]';
11
+ var buttonText = settings.quicktag_text;
12
+ buttonText = buttonText !== undefined ? buttonText : 'crayon';
13
+ QTags.addButton('crayon_quicktag', buttonText, function () {
14
+ CrayonTagEditor.showDialog({
15
+ insert: function (shortcode) {
16
  QTags.insertContent(shortcode);
17
  },
18
  select: base.getSelectedText,
19
  editor_str: 'html',
20
  output: 'encode'
21
  });
22
+ $(base.sel).removeClass('qt_crayon_highlight');
23
+ });
24
+ var qt_crayon;
25
+ var find_qt_crayon = setInterval(function () {
26
+ qt_crayon = $(base.sel).first();
27
+ if (typeof qt_crayon != 'undefined') {
28
  CrayonTagEditor.bind(base.sel);
29
+ clearInterval(find_qt_crayon);
30
+ }
31
+ }, 100);
32
+ };
33
+
34
+ base.getSelectedText = function () {
35
+ if (QTags.instances.length == 0) {
36
+ return null;
37
+ } else {
38
+ var qt = QTags.instances[0];
39
+ var startPos = qt.canvas.selectionStart;
40
+ var endPos = qt.canvas.selectionEnd;
41
+ return qt.canvas.value.substring(startPos, endPos);
42
+ }
43
+ };
44
+
45
+ };
46
+
47
+ $(document).ready(function () {
48
  CrayonQuickTags.init();
49
  });
50
 
util/tag-editor/crayon_tag_editor.js CHANGED
@@ -368,7 +368,7 @@
368
  inline.change();
369
 
370
  // Show the dialog
371
- var dialog_title = editing ? s.dialog_title_edit : s.dialog_title_add;
372
  $(s.dialog_title_css).html(dialog_title);
373
  if (showCallback) {
374
  showCallback();
368
  inline.change();
369
 
370
  // Show the dialog
371
+ var dialog_title = editing ? s.edit_text : s.add_text;
372
  $(s.dialog_title_css).html(dialog_title);
373
  if (showCallback) {
374
  showCallback();
util/tag-editor/crayon_tag_editor_wp.class.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- require_once (CRAYON_ROOT_PATH . 'crayon_settings_wp.class.php');
4
 
5
  class CrayonTagEditorWP {
6
 
@@ -62,8 +62,9 @@ class CrayonTagEditorWP {
62
  'attr_sep' => CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP),
63
  'css_sep' => '_',
64
  'fallback_lang' => CrayonGlobalSettings::val(CrayonSettings::FALLBACK_LANG),
65
- 'dialog_title_add' => crayon__('Add Crayon Code'),
66
- 'dialog_title_edit' => crayon__('Edit Crayon Code'),
 
67
  'submit_add' => crayon__('Add'),
68
  'submit_edit' => crayon__('Save'),
69
  'bar' => '#crayon-te-bar',
@@ -157,10 +158,10 @@ class CrayonTagEditorWP {
157
 
158
  public static function submit() {
159
  ?>
160
- <input type="button"
161
- class="button-primary <?php echo CrayonTagEditorWP::$settings['submit_css']; ?>"
162
- value="<?php echo CrayonTagEditorWP::$settings['submit_add']; ?>"
163
- name="submit"/>
164
  <?php
165
  }
166
 
@@ -176,109 +177,109 @@ class CrayonTagEditorWP {
176
 
177
  ?>
178
 
179
- <div id="crayon-te-content" class="crayon-te">
180
- <div id="crayon-te-bar">
181
- <div id="crayon-te-bar-content">
182
- <div id="crayon-te-title">Title</div>
183
- <div id="crayon-te-controls">
184
- <a id="crayon-te-ok" href="#"><?php crayon_e('OK'); ?></a> <span
185
- class="crayon-te-seperator">|</span> <a id="crayon-te-cancel"
186
- href="#"><?php crayon_e('Cancel'); ?></a>
 
187
  </div>
188
  </div>
189
- </div>
190
 
191
- <table id="crayon-te-table" class="describe">
192
- <tr class="crayon-tr-center">
193
- <th><?php crayon_e('Title'); ?>
194
- </th>
195
- <td class="crayon-nowrap"><?php self::textbox('title', array('placeholder' => crayon__('A short description'))); ?>
196
- <span id="crayon-te-sub-section"> <?php self::checkbox('inline'); ?>
197
- <span class="crayon-te-section"><?php crayon_e('Inline'); ?> </span>
198
  </span> <span id="crayon-te-sub-section"> <?php self::checkbox('highlight'); ?>
199
- <span class="crayon-te-section"><?php crayon_e("Don't Highlight"); ?>
200
  </span>
201
  </span></td>
202
- </tr>
203
- <tr class="crayon-tr-center">
204
- <th><?php crayon_e('Language'); ?>
205
- </th>
206
- <td class="crayon-nowrap"><?php self::select_resource('lang', $langs, $curr_lang); ?>
207
- <span class="crayon-te-section"><?php crayon_e('Line Range'); ?> </span>
208
- <?php self::textbox('range', array('placeholder' => crayon__('(e.g. 3-5 or 3)'))); ?>
209
- <span class="crayon-te-section"><?php crayon_e('Marked Lines'); ?> </span>
210
- <?php self::textbox('mark', array('placeholder' => crayon__('(e.g. 1,2,3-5)'))); ?>
211
- </td>
212
- </tr>
213
- <tr class="crayon-tr-center" style="text-align: center;">
214
- <th>
215
- <div>
216
- <?php crayon_e('Code'); ?>
217
- </div>
218
- <input type="button" id="crayon-te-clear"
219
- class="secondary-primary" value="<?php crayon_e('Clear'); ?>"
220
- name="clear"/>
221
- </th>
222
- <td><textarea id="crayon-code" name="code"
223
- placeholder="<?php crayon_e('Paste your code here, or type it in manually.'); ?>"></textarea>
224
- </td>
225
- </tr>
226
- <tr class="crayon-tr-center">
227
- <th id="crayon-url-th"><?php crayon_e('URL'); ?>
228
- </th>
229
- <td><?php self::textbox('url', array('placeholder' => crayon__('Relative local path or absolute URL'))); ?>
230
- <div id="crayon-te-url-info" class="crayon-te-info">
231
- <?php
232
- crayon_e("If the URL fails to load, the code above will be shown instead. If no code exists, an error is shown.");
233
- echo ' ';
234
- printf(crayon__('If a relative local path is given it will be appended to %s - which is defined in %sCrayon &gt; Settings &gt; Files%s.'), '<span class="crayon-te-quote">' . get_home_url() . '/' . CrayonGlobalSettings::val(CrayonSettings::LOCAL_PATH) . '</span>', '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>');
235
- ?>
236
- </div>
237
- </td>
238
- </tr>
239
- <tr>
240
- <td id="crayon-te-submit-wrapper" colspan="2"
241
- style="text-align: center;"><?php self::submit(); ?></td>
242
- </tr>
243
- <!-- <tr>-->
244
- <!-- <td colspan="2"><div id="crayon-te-warning" class="updated crayon-te-info"></div></td>-->
245
- <!-- </tr>-->
246
- <tr>
247
- <td colspan="2"><?php
248
- $admin = isset($_GET['is_admin']) ? intval($_GET['is_admin']) : is_admin();
249
- if (!$admin && !CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_SETTINGS)) {
250
- exit();
251
- }
252
- ?>
253
- <hr/>
254
- <div>
255
- <h2 class="crayon-te-heading">
256
- <?php crayon_e('Settings'); ?>
257
- </h2>
258
- </div>
259
- <div id="crayon-te-settings-info" class="crayon-te-info">
260
- <?php
261
- crayon_e('Change the following settings to override their global values.');
262
- echo ' <span class="', CrayonSettings::SETTING_CHANGED, '">';
263
- crayon_e('Only changes (shown yellow) are applied.');
264
- echo '</span><br/>';
265
- echo sprintf(crayon__('Future changes to the global settings under %sCrayon &gt; Settings%s won\'t affect overridden settings.'), '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>');
266
  ?>
267
- </div>
268
- </td>
269
- </tr>
270
- <?php
271
- $sections = array('Theme', 'Font', 'Metrics', 'Toolbar', 'Lines', 'Code');
272
- foreach ($sections as $section) {
273
- echo '<tr><th>', crayon__($section), '</th><td>';
274
- call_user_func('CrayonSettingsWP::' . strtolower($section), TRUE);
275
- echo '</td></tr>';
276
- }
277
- ?>
278
- </table>
279
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
 
281
- <?php
282
  exit();
283
  }
284
 
1
  <?php
2
 
3
+ require_once(CRAYON_ROOT_PATH . 'crayon_settings_wp.class.php');
4
 
5
  class CrayonTagEditorWP {
6
 
62
  'attr_sep' => CrayonGlobalSettings::val_str(CrayonSettings::ATTR_SEP),
63
  'css_sep' => '_',
64
  'fallback_lang' => CrayonGlobalSettings::val(CrayonSettings::FALLBACK_LANG),
65
+ 'add_text' => CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_ADD_BUTTON_TEXT),
66
+ 'edit_text' => CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_EDIT_BUTTON_TEXT),
67
+ 'quicktag_text' => CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_QUICKTAG_BUTTON_TEXT),
68
  'submit_add' => crayon__('Add'),
69
  'submit_edit' => crayon__('Save'),
70
  'bar' => '#crayon-te-bar',
158
 
159
  public static function submit() {
160
  ?>
161
+ <input type="button"
162
+ class="button-primary <?php echo CrayonTagEditorWP::$settings['submit_css']; ?>"
163
+ value="<?php echo CrayonTagEditorWP::$settings['submit_add']; ?>"
164
+ name="submit"/>
165
  <?php
166
  }
167
 
177
 
178
  ?>
179
 
180
+ <div id="crayon-te-content" class="crayon-te">
181
+ <div id="crayon-te-bar">
182
+ <div id="crayon-te-bar-content">
183
+ <div id="crayon-te-title">Title</div>
184
+ <div id="crayon-te-controls">
185
+ <a id="crayon-te-ok" href="#"><?php crayon_e('OK'); ?></a> <span
186
+ class="crayon-te-seperator">|</span> <a id="crayon-te-cancel"
187
+ href="#"><?php crayon_e('Cancel'); ?></a>
188
+ </div>
189
  </div>
190
  </div>
 
191
 
192
+ <table id="crayon-te-table" class="describe">
193
+ <tr class="crayon-tr-center">
194
+ <th><?php crayon_e('Title'); ?>
195
+ </th>
196
+ <td class="crayon-nowrap"><?php self::textbox('title', array('placeholder' => crayon__('A short description'))); ?>
197
+ <span id="crayon-te-sub-section"> <?php self::checkbox('inline'); ?>
198
+ <span class="crayon-te-section"><?php crayon_e('Inline'); ?> </span>
199
  </span> <span id="crayon-te-sub-section"> <?php self::checkbox('highlight'); ?>
200
+ <span class="crayon-te-section"><?php crayon_e("Don't Highlight"); ?>
201
  </span>
202
  </span></td>
203
+ </tr>
204
+ <tr class="crayon-tr-center">
205
+ <th><?php crayon_e('Language'); ?>
206
+ </th>
207
+ <td class="crayon-nowrap"><?php self::select_resource('lang', $langs, $curr_lang); ?>
208
+ <span class="crayon-te-section"><?php crayon_e('Line Range'); ?> </span>
209
+ <?php self::textbox('range', array('placeholder' => crayon__('(e.g. 3-5 or 3)'))); ?>
210
+ <span class="crayon-te-section"><?php crayon_e('Marked Lines'); ?> </span>
211
+ <?php self::textbox('mark', array('placeholder' => crayon__('(e.g. 1,2,3-5)'))); ?>
212
+ </td>
213
+ </tr>
214
+ <tr class="crayon-tr-center" style="text-align: center;">
215
+ <th>
216
+ <div>
217
+ <?php crayon_e('Code'); ?>
218
+ </div>
219
+ <input type="button" id="crayon-te-clear"
220
+ class="secondary-primary" value="<?php crayon_e('Clear'); ?>"
221
+ name="clear"/>
222
+ </th>
223
+ <td><textarea id="crayon-code" name="code"
224
+ placeholder="<?php crayon_e('Paste your code here, or type it in manually.'); ?>"></textarea>
225
+ </td>
226
+ </tr>
227
+ <tr class="crayon-tr-center">
228
+ <th id="crayon-url-th"><?php crayon_e('URL'); ?>
229
+ </th>
230
+ <td><?php self::textbox('url', array('placeholder' => crayon__('Relative local path or absolute URL'))); ?>
231
+ <div id="crayon-te-url-info" class="crayon-te-info">
232
+ <?php
233
+ crayon_e("If the URL fails to load, the code above will be shown instead. If no code exists, an error is shown.");
234
+ echo ' ';
235
+ printf(crayon__('If a relative local path is given it will be appended to %s - which is defined in %sCrayon &gt; Settings &gt; Files%s.'), '<span class="crayon-te-quote">' . get_home_url() . '/' . CrayonGlobalSettings::val(CrayonSettings::LOCAL_PATH) . '</span>', '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>');
236
+ ?>
237
+ </div>
238
+ </td>
239
+ </tr>
240
+ <tr>
241
+ <td id="crayon-te-submit-wrapper" colspan="2"
242
+ style="text-align: center;"><?php self::submit(); ?></td>
243
+ </tr>
244
+ <!-- <tr>-->
245
+ <!-- <td colspan="2"><div id="crayon-te-warning" class="updated crayon-te-info"></div></td>-->
246
+ <!-- </tr>-->
247
+ <tr>
248
+ <td colspan="2"><?php
249
+ $admin = isset($_GET['is_admin']) ? intval($_GET['is_admin']) : is_admin();
250
+ if (!$admin && !CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_SETTINGS)) {
251
+ exit();
252
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  ?>
254
+ <hr/>
255
+ <div>
256
+ <h2 class="crayon-te-heading">
257
+ <?php crayon_e('Settings'); ?>
258
+ </h2>
259
+ </div>
260
+ <div id="crayon-te-settings-info" class="crayon-te-info">
261
+ <?php
262
+ crayon_e('Change the following settings to override their global values.');
263
+ echo ' <span class="', CrayonSettings::SETTING_CHANGED, '">';
264
+ crayon_e('Only changes (shown yellow) are applied.');
265
+ echo '</span><br/>';
266
+ echo sprintf(crayon__('Future changes to the global settings under %sCrayon &gt; Settings%s won\'t affect overridden settings.'), '<a href="options-general.php?page=crayon_settings" target="_blank">', '</a>');
267
+ ?>
268
+ </div>
269
+ </td>
270
+ </tr>
271
+ <?php
272
+ $sections = array('Theme', 'Font', 'Metrics', 'Toolbar', 'Lines', 'Code');
273
+ foreach ($sections as $section) {
274
+ echo '<tr><th>', crayon__($section), '</th><td>';
275
+ call_user_func('CrayonSettingsWP::' . strtolower($section), TRUE);
276
+ echo '</td></tr>';
277
+ }
278
+ ?>
279
+ </table>
280
+ </div>
281
 
282
+ <?php
283
  exit();
284
  }
285