-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththeme_highlighter.php
executable file
·44 lines (38 loc) · 1.41 KB
/
theme_highlighter.php
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
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/*
Plugin Name: Theme Highlighter
Description: Syntax highlighting of theme files (CSS, Templates, JS) and components
Version: 1.1
Author: Martin Vlcek
Author URI: http://mvlcek.bplaced.net
*/
$thisfile = basename(__FILE__, ".php");
register_plugin(
$thisfile,
'Theme Highlighter',
'1.1',
'Martin Vlcek',
'http://mvlcek.bplaced.net',
'Syntax highlighting when editing themes and components',
'',
''
);
add_action('header','theme_highlighter_header');
add_action('footer','theme_highlighter_footer');
function theme_highlighter_header(){
if (basename($_SERVER['PHP_SELF']) == 'components.php' ||
basename($_SERVER['PHP_SELF']) == 'theme-edit.php' ||
(basename($_SERVER['PHP_SELF']) == 'load.php' && @$_GET['id'] == 'custom-admin-css') ||
(basename($_SERVER['PHP_SELF']) == 'load.php' && @$_GET['id'] == 'i18n_specialpages' && isset($_GET['config']))) {
include(GSPLUGINPATH.'theme_highlighter/header.php');
}
}
//only displayed at the theme edit page
function theme_highlighter_footer() {
if (basename($_SERVER['PHP_SELF']) == 'components.php' ||
basename($_SERVER['PHP_SELF']) == 'theme-edit.php' ||
(basename($_SERVER['PHP_SELF']) == 'load.php' && @$_GET['id'] == 'custom-admin-css') ||
(basename($_SERVER['PHP_SELF']) == 'load.php' && @$_GET['id'] == 'i18n_specialpages' && isset($_GET['config']))) {
include(GSPLUGINPATH.'theme_highlighter/footer.php');
}
}