Simple Custom CSS and JS - Version 3.37

Version Description

  • 07/12/2021
  • Fix: allow the TablePress plugin to load its JS files on the "Add custom code" page in admin
  • Feature: highlight active line in the editor
  • Feature: add "Ctrl + J" shortcut to the editor for jumping to the matching tag
Download this release

Release Info

Developer diana_burduja
Plugin Icon 128x128 Simple Custom CSS and JS
Version 3.37
Comparing to
See all releases

Code changes from version 3.36 to 3.37

assets/ccj_admin.css CHANGED
@@ -402,3 +402,9 @@ height: 3px;
402
  pre.CodeMirror-line {
403
  direction: ltr;
404
  }
 
 
 
 
 
 
402
  pre.CodeMirror-line {
403
  direction: ltr;
404
  }
405
+ .post-type-custom-css-js .metabox-prefs {
406
+ display: none;
407
+ }
408
+ .post-type-custom-css-js #url-rules[style], .post-type-custom-css-js #revisionsdiv[style], .post-type-custom-css-js #previewdiv[style], .post-type-custom-css-js #custom-code-options[style] {
409
+ display: block !important;
410
+ }
assets/ccj_admin.js CHANGED
@@ -17,6 +17,7 @@ jQuery(document).ready( function($) {
17
  mode: content_mode,
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
 
20
  extraKeys: {
21
  "F11": function(cm) {
22
  cm.setOption("fullScreen", !cm.getOption("fullScreen"));
@@ -32,6 +33,7 @@ jQuery(document).ready( function($) {
32
  "Cmd-F": "findPersistent",
33
  "Ctrl-/": "toggleComment",
34
  "Cmd-/": "toggleComment",
 
35
  },
36
  };
37
 
17
  mode: content_mode,
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
20
+ styleActiveLine: true,
21
  extraKeys: {
22
  "F11": function(cm) {
23
  cm.setOption("fullScreen", !cm.getOption("fullScreen"));
33
  "Cmd-F": "findPersistent",
34
  "Ctrl-/": "toggleComment",
35
  "Cmd-/": "toggleComment",
36
+ "Ctrl-J": "toMatchingTag",
37
  },
38
  };
39
 
assets/codemirror/addon/edit/matchtags.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../fold/xml-fold"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
15
+ if (old && old != CodeMirror.Init) {
16
+ cm.off("cursorActivity", doMatchTags);
17
+ cm.off("viewportChange", maybeUpdateMatch);
18
+ clear(cm);
19
+ }
20
+ if (val) {
21
+ cm.state.matchBothTags = typeof val == "object" && val.bothTags;
22
+ cm.on("cursorActivity", doMatchTags);
23
+ cm.on("viewportChange", maybeUpdateMatch);
24
+ doMatchTags(cm);
25
+ }
26
+ });
27
+
28
+ function clear(cm) {
29
+ if (cm.state.tagHit) cm.state.tagHit.clear();
30
+ if (cm.state.tagOther) cm.state.tagOther.clear();
31
+ cm.state.tagHit = cm.state.tagOther = null;
32
+ }
33
+
34
+ function doMatchTags(cm) {
35
+ cm.state.failedTagMatch = false;
36
+ cm.operation(function() {
37
+ clear(cm);
38
+ if (cm.somethingSelected()) return;
39
+ var cur = cm.getCursor(), range = cm.getViewport();
40
+ range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
41
+ var match = CodeMirror.findMatchingTag(cm, cur, range);
42
+ if (!match) return;
43
+ if (cm.state.matchBothTags) {
44
+ var hit = match.at == "open" ? match.open : match.close;
45
+ if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
46
+ }
47
+ var other = match.at == "close" ? match.open : match.close;
48
+ if (other)
49
+ cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
50
+ else
51
+ cm.state.failedTagMatch = true;
52
+ });
53
+ }
54
+
55
+ function maybeUpdateMatch(cm) {
56
+ if (cm.state.failedTagMatch) doMatchTags(cm);
57
+ }
58
+
59
+ CodeMirror.commands.toMatchingTag = function(cm) {
60
+ var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
61
+ if (found) {
62
+ var other = found.at == "close" ? found.open : found.close;
63
+ if (other) cm.extendSelection(other.to, other.from);
64
+ }
65
+ };
66
+ });
assets/codemirror/addon/fold/xml-fold.js ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var Pos = CodeMirror.Pos;
15
+ function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }
16
+
17
+ var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
18
+ var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
19
+ var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
20
+
21
+ function Iter(cm, line, ch, range) {
22
+ this.line = line; this.ch = ch;
23
+ this.cm = cm; this.text = cm.getLine(line);
24
+ this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine();
25
+ this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine();
26
+ }
27
+
28
+ function tagAt(iter, ch) {
29
+ var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));
30
+ return type && /\btag\b/.test(type);
31
+ }
32
+
33
+ function nextLine(iter) {
34
+ if (iter.line >= iter.max) return;
35
+ iter.ch = 0;
36
+ iter.text = iter.cm.getLine(++iter.line);
37
+ return true;
38
+ }
39
+ function prevLine(iter) {
40
+ if (iter.line <= iter.min) return;
41
+ iter.text = iter.cm.getLine(--iter.line);
42
+ iter.ch = iter.text.length;
43
+ return true;
44
+ }
45
+
46
+ function toTagEnd(iter) {
47
+ for (;;) {
48
+ var gt = iter.text.indexOf(">", iter.ch);
49
+ if (gt == -1) { if (nextLine(iter)) continue; else return; }
50
+ if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }
51
+ var lastSlash = iter.text.lastIndexOf("/", gt);
52
+ var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
53
+ iter.ch = gt + 1;
54
+ return selfClose ? "selfClose" : "regular";
55
+ }
56
+ }
57
+ function toTagStart(iter) {
58
+ for (;;) {
59
+ var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1;
60
+ if (lt == -1) { if (prevLine(iter)) continue; else return; }
61
+ if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }
62
+ xmlTagStart.lastIndex = lt;
63
+ iter.ch = lt;
64
+ var match = xmlTagStart.exec(iter.text);
65
+ if (match && match.index == lt) return match;
66
+ }
67
+ }
68
+
69
+ function toNextTag(iter) {
70
+ for (;;) {
71
+ xmlTagStart.lastIndex = iter.ch;
72
+ var found = xmlTagStart.exec(iter.text);
73
+ if (!found) { if (nextLine(iter)) continue; else return; }
74
+ if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }
75
+ iter.ch = found.index + found[0].length;
76
+ return found;
77
+ }
78
+ }
79
+ function toPrevTag(iter) {
80
+ for (;;) {
81
+ var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1;
82
+ if (gt == -1) { if (prevLine(iter)) continue; else return; }
83
+ if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }
84
+ var lastSlash = iter.text.lastIndexOf("/", gt);
85
+ var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
86
+ iter.ch = gt + 1;
87
+ return selfClose ? "selfClose" : "regular";
88
+ }
89
+ }
90
+
91
+ function findMatchingClose(iter, tag) {
92
+ var stack = [];
93
+ for (;;) {
94
+ var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);
95
+ if (!next || !(end = toTagEnd(iter))) return;
96
+ if (end == "selfClose") continue;
97
+ if (next[1]) { // closing tag
98
+ for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
99
+ stack.length = i;
100
+ break;
101
+ }
102
+ if (i < 0 && (!tag || tag == next[2])) return {
103
+ tag: next[2],
104
+ from: Pos(startLine, startCh),
105
+ to: Pos(iter.line, iter.ch)
106
+ };
107
+ } else { // opening tag
108
+ stack.push(next[2]);
109
+ }
110
+ }
111
+ }
112
+ function findMatchingOpen(iter, tag) {
113
+ var stack = [];
114
+ for (;;) {
115
+ var prev = toPrevTag(iter);
116
+ if (!prev) return;
117
+ if (prev == "selfClose") { toTagStart(iter); continue; }
118
+ var endLine = iter.line, endCh = iter.ch;
119
+ var start = toTagStart(iter);
120
+ if (!start) return;
121
+ if (start[1]) { // closing tag
122
+ stack.push(start[2]);
123
+ } else { // opening tag
124
+ for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {
125
+ stack.length = i;
126
+ break;
127
+ }
128
+ if (i < 0 && (!tag || tag == start[2])) return {
129
+ tag: start[2],
130
+ from: Pos(iter.line, iter.ch),
131
+ to: Pos(endLine, endCh)
132
+ };
133
+ }
134
+ }
135
+ }
136
+
137
+ CodeMirror.registerHelper("fold", "xml", function(cm, start) {
138
+ var iter = new Iter(cm, start.line, 0);
139
+ for (;;) {
140
+ var openTag = toNextTag(iter)
141
+ if (!openTag || iter.line != start.line) return
142
+ var end = toTagEnd(iter)
143
+ if (!end) return
144
+ if (!openTag[1] && end != "selfClose") {
145
+ var startPos = Pos(iter.line, iter.ch);
146
+ var endPos = findMatchingClose(iter, openTag[2]);
147
+ return endPos && cmp(endPos.from, startPos) > 0 ? {from: startPos, to: endPos.from} : null
148
+ }
149
+ }
150
+ });
151
+ CodeMirror.findMatchingTag = function(cm, pos, range) {
152
+ var iter = new Iter(cm, pos.line, pos.ch, range);
153
+ if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return;
154
+ var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);
155
+ var start = end && toTagStart(iter);
156
+ if (!end || !start || cmp(iter, pos) > 0) return;
157
+ var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};
158
+ if (end == "selfClose") return {open: here, close: null, at: "open"};
159
+
160
+ if (start[1]) { // closing tag
161
+ return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"};
162
+ } else { // opening tag
163
+ iter = new Iter(cm, to.line, to.ch, range);
164
+ return {open: here, close: findMatchingClose(iter, start[2]), at: "open"};
165
+ }
166
+ };
167
+
168
+ CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {
169
+ var iter = new Iter(cm, pos.line, pos.ch, range);
170
+ for (;;) {
171
+ var open = findMatchingOpen(iter, tag);
172
+ if (!open) break;
173
+ var forward = new Iter(cm, pos.line, pos.ch, range);
174
+ var close = findMatchingClose(forward, open.tag);
175
+ if (close) return {open: open, close: close};
176
+ }
177
+ };
178
+
179
+ // Used by addon/edit/closetag.js
180
+ CodeMirror.scanForClosingTag = function(cm, pos, name, end) {
181
+ var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);
182
+ return findMatchingClose(iter, name);
183
+ };
184
+ });
assets/codemirror/addon/selection/active-line.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+ var WRAP_CLASS = "CodeMirror-activeline";
14
+ var BACK_CLASS = "CodeMirror-activeline-background";
15
+ var GUTT_CLASS = "CodeMirror-activeline-gutter";
16
+
17
+ CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
18
+ var prev = old == CodeMirror.Init ? false : old;
19
+ if (val == prev) return
20
+ if (prev) {
21
+ cm.off("beforeSelectionChange", selectionChange);
22
+ clearActiveLines(cm);
23
+ delete cm.state.activeLines;
24
+ }
25
+ if (val) {
26
+ cm.state.activeLines = [];
27
+ updateActiveLines(cm, cm.listSelections());
28
+ cm.on("beforeSelectionChange", selectionChange);
29
+ }
30
+ });
31
+
32
+ function clearActiveLines(cm) {
33
+ for (var i = 0; i < cm.state.activeLines.length; i++) {
34
+ cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
35
+ cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
36
+ cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
37
+ }
38
+ }
39
+
40
+ function sameArray(a, b) {
41
+ if (a.length != b.length) return false;
42
+ for (var i = 0; i < a.length; i++)
43
+ if (a[i] != b[i]) return false;
44
+ return true;
45
+ }
46
+
47
+ function updateActiveLines(cm, ranges) {
48
+ var active = [];
49
+ for (var i = 0; i < ranges.length; i++) {
50
+ var range = ranges[i];
51
+ var option = cm.getOption("styleActiveLine");
52
+ if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
53
+ continue
54
+ var line = cm.getLineHandleVisualStart(range.head.line);
55
+ if (active[active.length - 1] != line) active.push(line);
56
+ }
57
+ if (sameArray(cm.state.activeLines, active)) return;
58
+ cm.operation(function() {
59
+ clearActiveLines(cm);
60
+ for (var i = 0; i < active.length; i++) {
61
+ cm.addLineClass(active[i], "wrap", WRAP_CLASS);
62
+ cm.addLineClass(active[i], "background", BACK_CLASS);
63
+ cm.addLineClass(active[i], "gutter", GUTT_CLASS);
64
+ }
65
+ cm.state.activeLines = active;
66
+ });
67
+ }
68
+
69
+ function selectionChange(cm, sel) {
70
+ updateActiveLines(cm, sel.ranges);
71
+ }
72
+ });
custom-css-js.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
- * Version: 3.36
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
@@ -12,7 +12,7 @@
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 3.0.0
15
- * WC tested up to: 5.3
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
@@ -228,7 +228,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
228
  function set_constants() {
229
  $dir = wp_upload_dir();
230
  $constants = array(
231
- 'CCJ_VERSION' => '3.36',
232
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
233
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
234
  'CCJ_PLUGIN_FILE' => __FILE__,
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
+ * Version: 3.37
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 3.0.0
15
+ * WC tested up to: 5.5
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
228
  function set_constants() {
229
  $dir = wp_upload_dir();
230
  $constants = array(
231
+ 'CCJ_VERSION' => '3.37',
232
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
233
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
234
  'CCJ_PLUGIN_FILE' => __FILE__,
includes/admin-screens.php CHANGED
@@ -97,13 +97,13 @@ class CustomCSSandJS_Admin {
97
  remove_submenu_page( $menu_slug, $submenu_slug );
98
 
99
  $title = __( 'Add Custom CSS', 'custom-css-js' );
100
- add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&language=css' );
101
 
102
  $title = __( 'Add Custom JS', 'custom-css-js' );
103
- add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&language=js' );
104
 
105
  $title = __( 'Add Custom HTML', 'custom-css-js' );
106
- add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&language=html' );
107
 
108
  }
109
 
@@ -152,6 +152,8 @@ class CustomCSSandJS_Admin {
152
  $cma = $cm . '/addon/';
153
  wp_enqueue_script( 'ccj-closebrackets', $cma . 'edit/closebrackets.js', array( 'ccj-codemirror' ), $v, false );
154
  wp_enqueue_script( 'ccj-matchbrackets', $cma . 'edit/matchbrackets.js', array( 'ccj-codemirror' ), $v, false );
 
 
155
  wp_enqueue_script( 'cm-dialog', $cma . 'dialog/dialog.js', array( 'ccj-codemirror' ), $v, false );
156
  wp_enqueue_script( 'cm-search', $cma . 'search/search.js', array( 'ccj-codemirror' ), $v, false );
157
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
@@ -160,6 +162,7 @@ class CustomCSSandJS_Admin {
160
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
161
  wp_enqueue_script( 'ccj-formatting', $cm . '/lib/util/formatting.js', array( 'ccj-codemirror' ), $v, false );
162
  wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
 
163
 
164
  // Hint Addons
165
  wp_enqueue_script( 'ccj-hint', $cma . 'hint/show-hint.js', array( 'ccj-codemirror' ), $v, false );
@@ -183,6 +186,7 @@ class CustomCSSandJS_Admin {
183
  && strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
184
  && strstr( $_value->src, 'plugins/wp-jquery-update-test/' ) === false
185
  && strstr( $_value->src, 'plugins/enable-jquery-migrate-helper/' ) === false
 
186
  && strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
187
  unset( $wp_scripts->registered[ $_key ] );
188
  }
@@ -897,11 +901,11 @@ End of comment */ ',
897
  'default' => 'header',
898
  'values' => array(
899
  'header' => array(
900
- 'title' => __( 'Header', 'custom-css-js' ),
901
  'dashicon' => 'arrow-up-alt2',
902
  ),
903
  'footer' => array(
904
- 'title' => __( 'Footer', 'custom-css-js' ),
905
  'dashicon' => 'arrow-down-alt2',
906
  ),
907
  ),
@@ -1432,9 +1436,13 @@ endif;
1432
  $post = $filename;
1433
  $slug = get_post_meta( $post->ID, '_slug', true );
1434
  $options = get_post_meta( $post->ID, 'options', true );
 
1435
  if ( isset( $options['language'] ) ) {
1436
  $filetype = $options['language'];
1437
  }
 
 
 
1438
  if ( ! @file_exists( CCJ_UPLOAD_DIR . '/' . $slug . '.' . $filetype ) ) {
1439
  $slug = false;
1440
  }
@@ -1530,7 +1538,7 @@ endif;
1530
  }
1531
 
1532
  $options = get_post_meta( $postid, 'options', true );
1533
- $options['language'] = strtolower( $options['language'] );
1534
  $options['language'] = in_array( $options['language'], array( 'html', 'js', 'css' ), true ) ? $options['language'] : 'css';
1535
 
1536
  $slug = get_post_meta( $postid, '_slug', true );
97
  remove_submenu_page( $menu_slug, $submenu_slug );
98
 
99
  $title = __( 'Add Custom CSS', 'custom-css-js' );
100
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&#038;language=css' );
101
 
102
  $title = __( 'Add Custom JS', 'custom-css-js' );
103
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&#038;language=js' );
104
 
105
  $title = __( 'Add Custom HTML', 'custom-css-js' );
106
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&#038;language=html' );
107
 
108
  }
109
 
152
  $cma = $cm . '/addon/';
153
  wp_enqueue_script( 'ccj-closebrackets', $cma . 'edit/closebrackets.js', array( 'ccj-codemirror' ), $v, false );
154
  wp_enqueue_script( 'ccj-matchbrackets', $cma . 'edit/matchbrackets.js', array( 'ccj-codemirror' ), $v, false );
155
+ wp_enqueue_script( 'ccj-xmlfold', $cma . 'fold/xml-fold.js', array( 'ccj-codemirror' ), $v, false );
156
+ wp_enqueue_script( 'ccj-matchtags', $cma . 'edit/matchtags.js', array( 'ccj-codemirror' ), $v, false );
157
  wp_enqueue_script( 'cm-dialog', $cma . 'dialog/dialog.js', array( 'ccj-codemirror' ), $v, false );
158
  wp_enqueue_script( 'cm-search', $cma . 'search/search.js', array( 'ccj-codemirror' ), $v, false );
159
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
162
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
163
  wp_enqueue_script( 'ccj-formatting', $cm . '/lib/util/formatting.js', array( 'ccj-codemirror' ), $v, false );
164
  wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
165
+ wp_enqueue_script( 'ccj-active-line', $cma . 'selection/active-line.js', array( 'ccj-codemirror' ), $v, false );
166
 
167
  // Hint Addons
168
  wp_enqueue_script( 'ccj-hint', $cma . 'hint/show-hint.js', array( 'ccj-codemirror' ), $v, false );
186
  && strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
187
  && strstr( $_value->src, 'plugins/wp-jquery-update-test/' ) === false
188
  && strstr( $_value->src, 'plugins/enable-jquery-migrate-helper/' ) === false
189
+ && strstr( $_value->src, 'plugins/tablepress/' ) === false
190
  && strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
191
  unset( $wp_scripts->registered[ $_key ] );
192
  }
901
  'default' => 'header',
902
  'values' => array(
903
  'header' => array(
904
+ 'title' => __( 'In the <head> element', 'custom-css-js' ),
905
  'dashicon' => 'arrow-up-alt2',
906
  ),
907
  'footer' => array(
908
+ 'title' => __( 'In the <footer> element', 'custom-css-js' ),
909
  'dashicon' => 'arrow-down-alt2',
910
  ),
911
  ),
1436
  $post = $filename;
1437
  $slug = get_post_meta( $post->ID, '_slug', true );
1438
  $options = get_post_meta( $post->ID, 'options', true );
1439
+
1440
  if ( isset( $options['language'] ) ) {
1441
  $filetype = $options['language'];
1442
  }
1443
+ if ( $filetype === 'html' ) {
1444
+ return;
1445
+ }
1446
  if ( ! @file_exists( CCJ_UPLOAD_DIR . '/' . $slug . '.' . $filetype ) ) {
1447
  $slug = false;
1448
  }
1538
  }
1539
 
1540
  $options = get_post_meta( $postid, 'options', true );
1541
+ $options['language'] = ( isset( $options['language'] ) ) ? strtolower( $options['language'] ) : 'css';
1542
  $options['language'] = in_array( $options['language'], array( 'html', 'js', 'css' ), true ) ? $options['language'] : 'css';
1543
 
1544
  $slug = get_post_meta( $postid, '_slug', true );
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: diana_burduja
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
- Tested up to: 5.7
8
- Stable tag: 3.36
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -105,6 +105,12 @@ $. Add/Edit HTML
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
  = 3.36 =
109
  * 02/23/2021
110
  * Fix: fatal error with PHP8.0
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
+ Tested up to: 5.8
8
+ Stable tag: 3.37
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
105
 
106
  == Changelog ==
107
 
108
+ = 3.37 =
109
+ * 07/12/2021
110
+ * Fix: allow the TablePress plugin to load its JS files on the "Add custom code" page in admin
111
+ * Feature: highlight active line in the editor
112
+ * Feature: add "Ctrl + J" shortcut to the editor for jumping to the matching tag
113
+
114
  = 3.36 =
115
  * 02/23/2021
116
  * Fix: fatal error with PHP8.0