diff --git a/admincssmu.php b/admincssmu.php index a065af3..22c1a14 100644 --- a/admincssmu.php +++ b/admincssmu.php @@ -5,7 +5,7 @@ Description: A plugin to load a CSS file to style the admin side. Works with Multisite. Author: Arun Basil Lal Author URI: http://millionclues.com -Version: 2.6 +Version: 2.7 Text Domain: admin-css-mu Domain Path: /languages License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html @@ -85,7 +85,7 @@ function admincssmu_register_settings() { * @refer https://codex.wordpress.org/Creating_Tables_with_Plugins#Adding_an_Upgrade_Function */ if (!defined('ADMINCSSMU_VERSION_NUM')) - define('ADMINCSSMU_VERSION_NUM', '2.6'); + define('ADMINCSSMU_VERSION_NUM', '2.7'); // update_option('abl_admincssmu_version', ADMINCSSMU_VERSION_NUM); // Disabled to set default values for Load Admin CSS checkbox /** diff --git a/csstidy/css_optimiser.php b/csstidy/css_optimiser.php deleted file mode 100644 index 8e286b1..0000000 --- a/csstidy/css_optimiser.php +++ /dev/null @@ -1,454 +0,0 @@ -. - * - * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007 - * @author Brett Zamir (brettz9 at yahoo dot com) 2007 - */ - -require('class.csstidy.php'); -require('lang.inc.php'); - - -if (get_magic_quotes_gpc()) { - if (isset($_REQUEST['css_text'])) { - $_REQUEST['css_text'] = stripslashes($_REQUEST['css_text']); - } - if (isset($_REQUEST['custom'])) { - $_REQUEST['custom'] = stripslashes($_REQUEST['custom']); - } - if (isset($_COOKIE['custom_template'])) { - $_COOKIE['custom_template'] = stripslashes($_COOKIE['custom_template']); - } -} - -function rmdirr($dirname,$oc=0) -{ - // Sanity check - if (!file_exists($dirname)) { - return false; - } - // Simple delete for a file - if (is_file($dirname) && (time()-fileatime($dirname))>3600) { - return unlink($dirname); - } - // Loop through the folder - if (is_dir($dirname)) { - $dir = dir($dirname); - while (false !== $entry = $dir->read()) { - // Skip pointers - if ($entry === '.' || $entry === '..') { - continue; - } - // Recurse - rmdirr($dirname.'/'.$entry,$oc); - } - $dir->close(); - } - // Clean up - if ($oc==1) { - return rmdir($dirname); - } -} - -function options($options, $selected = null, $labelIsValue = false) -{ - $html = ''; - - settype($selected, 'array'); - settype($options, 'array'); - - foreach ($options as $value=>$label) { - if (is_array($label)) { - $value = $label[0]; - $label = $label[1]; - } - $label = htmlspecialchars($label, ENT_QUOTES, 'utf-8'); - $value = $labelIsValue ? $label - : htmlspecialchars($value, ENT_QUOTES, 'utf-8'); - - $html .= ''; - } - - return $html; -} - -$css = new csstidy(); -$is_custom = isset($_REQUEST['custom']) && !empty($_REQUEST['custom']) && isset($_REQUEST['template']) && ($_REQUEST['template'] === '4'); -if ($is_custom) -{ - setcookie ('custom_template', $_REQUEST['custom'], time()+360000); -} - -rmdirr('temp'); - -if (isset($_REQUEST['case_properties'])) $css->set_cfg('case_properties',$_REQUEST['case_properties']); -if (isset($_REQUEST['lowercase'])) $css->set_cfg('lowercase_s',true); -if (!isset($_REQUEST['compress_c']) && isset($_REQUEST['post'])) $css->set_cfg('compress_colors',false); -if (!isset($_REQUEST['compress_fw']) && isset($_REQUEST['post'])) $css->set_cfg('compress_font-weight',false); -if (isset($_REQUEST['merge_selectors'])) $css->set_cfg('merge_selectors', $_REQUEST['merge_selectors']); -if (isset($_REQUEST['optimise_shorthands'])) $css->set_cfg('optimise_shorthands',$_REQUEST['optimise_shorthands']); -if (!isset($_REQUEST['rbs']) && isset($_REQUEST['post'])) $css->set_cfg('remove_bslash',false); -if (isset($_REQUEST['preserve_css'])) $css->set_cfg('preserve_css',true); -if (isset($_REQUEST['sort_sel'])) $css->set_cfg('sort_selectors',true); -if (isset($_REQUEST['sort_de'])) $css->set_cfg('sort_properties',true); -if (isset($_REQUEST['remove_last_sem'])) $css->set_cfg('remove_last_;',true); -if (isset($_REQUEST['discard'])) $css->set_cfg('discard_invalid_properties',true); -if (isset($_REQUEST['css_level'])) $css->set_cfg('css_level',$_REQUEST['css_level']); -if (isset($_REQUEST['timestamp'])) $css->set_cfg('timestamp',true); -if (isset($_REQUEST['rtl'])) $css->set_cfg('reverse_left_and_right',true); - - -// This by itself is enough since our scripts don't use DOM to create elements (in which case the namespace aware ones -// should be used when serving as application/xhtml+xml but not when served as text/html ; -// also, case will be different when retrieving element names, as HTML DOM returns in upper case, -// genuine XHTML DOM (when XHTML served as such) as lower -if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) { - $http_accept = 'application/xhtml+xml'; -} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'application/xml')) { - $http_accept = 'application/xml'; -} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'text/xml')) { - $http_accept = 'text/xml'; -} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Opera ') || stristr($_SERVER['HTTP_USER_AGENT'], 'Opera/')) { - preg_match('@Opera/(\d)@', $_SERVER['HTTP_USER_AGENT'], $matches); - if (isset($matches[1]) && $matches[1] >= 7) { - $http_accept = 'application/xhtml+xml'; - } else { - $http_accept = 'text/html'; - } -} else { - $http_accept = 'text/html'; -} - -header('Content-Type: '.$http_accept.'; charset=utf-8'); - -if ($http_accept === 'text/html') { - -?> - - -
- -- : English Deutsch French Chinese
-- -
- - - load_template($_REQUEST['custom'],false); - } - break; - - case 3: - $css->load_template('highest_compression'); - break; - - case 2: - $css->load_template('high_compression'); - break; - - case 0: - $css->load_template('low_compression'); - break; - } - } - - if ($url) { - if (substr($_REQUEST['url'],0,7) !== 'http://') { - $_REQUEST['url'] = 'http://'.$_REQUEST['url']; - } - $result = $css->parse_from_url($_REQUEST['url'],0); - } elseif (isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5) { - $result = $css->parse($_REQUEST['css_text']); - } - - if ($result) { - $ratio = $css->print->get_ratio(); - $diff = $css->print->get_diff(); - if (isset($_REQUEST['file_output'])) { - $filename = md5(mt_rand().time().mt_rand()); - if (!is_dir('temp')) { - $madedir = mkdir('temp'); - if (!$madedir) { - print 'Could not make directory "temp" in '.dirname(__FILE__); - exit; - } - } - $handle = fopen('temp/'.$filename.'.css','w'); - if ($handle) { - if (fwrite($handle,$css->print->plain())) { - $file_ok = true; - } - } - fclose($handle); - } - if ($ratio>0) $ratio = ''.$ratio.'% - ('.$diff.' Bytes)'; else $ratio = ''.$ratio.'% ('.$diff.' Bytes)'; - if (count($css->log) > 0): ?> - - ' - , ''
- , $css->print->formatted()
- , '
',$lang[$l][28],'
'; - } - ?> - - - diff --git a/csstidy/lang.inc.php b/csstidy/lang.inc.php deleted file mode 100644 index 998bbb3..0000000 --- a/csstidy/lang.inc.php +++ /dev/null @@ -1,311 +0,0 @@ -. - * - * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License - * @package csstidy - * @author Florian Schmitz (floele at gmail dot com) 2005-2007 - * @author Brett Zamir (brettz9 at yahoo dot com) 2007 - */ - - -if (isset($_GET['lang'])) { - $l = $_GET['lang']; -} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $l = $_SERVER['HTTP_ACCEPT_LANGUAGE']; - $l = strtolower(substr($l, 0, 2)); -} else { - $l = ''; -} - -$l = (in_array($l, array('de', 'fr', 'zh'))) ? $l : 'en'; - -// note 67 in all but English&French, and 5 and 40 in all are orphaned - -$lang = array(); -$lang['en'][0] = 'CSS Formatter and Optimiser/Optimizer (based on CSSTidy '; -$lang['en'][1] = 'CSS Formatter and Optimiser'; -$lang['en'][2] = '(based on'; -$lang['en'][3] = '(plaintext)'; -$lang['en'][4] = 'Important Note:'; -$lang['en'][6] = 'Your code should be well-formed. This is not a validator which points out errors in your CSS code. To make sure that your code is valid, use the W3C Validator.'; -$lang['en'][7] = 'all comments are removed'; -$lang['en'][8] = 'CSS Input:'; -$lang['en'][9] = 'CSS-Code:'; -$lang['en'][10] = 'CSS from URL:'; -$lang['en'][11] = 'Code Layout:'; -$lang['en'][12] = 'Compression (code layout):'; -$lang['en'][13] = 'Highest (no readability, smallest size)'; -$lang['en'][14] = 'High (moderate readability, smaller size)'; -$lang['en'][15] = 'Standard (balance between readability and size)'; -$lang['en'][16] = 'Low (higher readability)'; -$lang['en'][17] = 'Custom (enter below)'; -$lang['en'][18] = 'Custom template'; -$lang['en'][19] = 'Options'; -$lang['en'][20] = 'Sort Selectors (caution)'; -$lang['en'][21] = 'Sort Properties'; -$lang['en'][22] = 'Regroup selectors'; -$lang['en'][23] = 'Optimise shorthands'; -$lang['en'][24] = 'Compress colors'; -$lang['en'][25] = 'Lowercase selectors'; -$lang['en'][26] = 'Case for properties:'; -$lang['en'][27] = 'Lowercase'; -$lang['en'][28] = 'No or invalid CSS input or wrong URL!'; -$lang['en'][29] = 'Uppercase'; -$lang['en'][30] = 'lowercase elementnames needed for XHTML'; -$lang['en'][31] = 'Remove unnecessary backslashes'; -$lang['en'][32] = 'convert !important-hack'; -$lang['en'][33] = 'Output as file'; -$lang['en'][34] = 'Bigger compression because of smaller newlines (copy & paste doesn\'t work)'; -$lang['en'][35] = 'Process CSS'; -$lang['en'][36] = 'Compression Ratio'; -$lang['en'][37] = 'Input'; -$lang['en'][38] = 'Output'; -$lang['en'][39] = 'Language'; -$lang['en'][41] = 'Attention: This may change the behaviour of your CSS Code!'; -$lang['en'][42] = 'Remove last ;'; -$lang['en'][43] = 'Discard invalid properties'; -$lang['en'][44] = 'Only safe optimisations'; -$lang['en'][45] = 'Compress font-weight'; -$lang['en'][46] = 'Save comments'; -$lang['en'][47] = 'Do not change anything'; -$lang['en'][48] = 'Only seperate selectors (split at ,)'; -$lang['en'][49] = 'Merge selectors with the same properties (fast)'; -$lang['en'][50] = 'Merge selectors intelligently (slow)'; -$lang['en'][51] = 'Preserve CSS'; -$lang['en'][52] = 'Save comments, hacks, etc. Most optimisations can *not* be applied if this is enabled.'; -$lang['en'][53] = 'None'; -$lang['en'][54] = 'Don\'t optimise'; -$lang['en'][55] = 'Safe optimisations'; -$lang['en'][56] = 'All optimisations'; -$lang['en'][57] = 'Add timestamp'; -$lang['en'][58] = 'Copy to clipboard'; -$lang['en'][59] = 'Back to top'; -$lang['en'][60] = 'Your browser doesn\'t support copy to clipboard.'; -$lang['en'][61] = 'For bugs and suggestions feel free to'; -$lang['en'][62] = 'contact me'; -$lang['en'][63] = 'Output CSS code as complete HTML document'; -$lang['en'][64] = 'Code'; -$lang['en'][65] = 'CSS to style CSS output'; -$lang['en'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.'; -$lang['en'][67] = 'Reverse left and right directions'; - -$lang['de'][0] = 'CSS Formatierer und Optimierer (basierend auf CSSTidy '; -$lang['de'][1] = 'CSS Formatierer und Optimierer'; -$lang['de'][2] = '(basierend auf'; -$lang['de'][3] = '(Textversion)'; -$lang['de'][4] = 'Wichtiger Hinweis:'; -$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird nicht auf Gültigkeit überprüft. Um sicherzugehen dass dein Code valide ist, benutze den W3C Validierungsservice.'; -$lang['de'][7] = 'alle Kommentare werden entfernt'; -$lang['de'][8] = 'CSS Eingabe:'; -$lang['de'][9] = 'CSS-Code:'; -$lang['de'][10] = 'CSS von URL:'; -$lang['de'][11] = 'Code Layout:'; -$lang['de'][12] = 'Komprimierung (Code Layout):'; -$lang['de'][13] = 'Höchste (keine Lesbarkeit, niedrigste Größe)'; -$lang['de'][14] = 'Hoch (mittelmäßige Lesbarkeit, geringe Größe)'; -$lang['de'][15] = 'Standard (Kompromiss zwischen Lesbarkeit und Größe)'; -$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)'; -$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)'; -$lang['de'][18] = 'Benutzerdefinierte Vorlage'; -$lang['de'][19] = 'Optionen'; -$lang['de'][20] = 'Selektoren sortieren (Vorsicht)'; -$lang['de'][21] = 'Eigenschaften sortieren'; -$lang['de'][22] = 'Selektoren umgruppieren'; -$lang['de'][23] = 'Shorthands optimieren'; -$lang['de'][24] = 'Farben komprimieren'; -$lang['de'][25] = 'Selektoren in Kleinbuchstaben'; -$lang['de'][26] = 'Groß-/Kleinschreibung für Eigenschaften'; -$lang['de'][27] = 'Kleinbuchstaben'; -$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!'; -$lang['de'][29] = 'Großbuchstaben'; -$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML'; -$lang['de'][31] = 'Unnötige Backslashes entfernen'; -$lang['de'][32] = '!important-Hack konvertieren'; -$lang['de'][33] = 'Als Datei ausgeben'; -$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen'; -$lang['de'][35] = 'CSS verarbeiten'; -$lang['de'][36] = 'Komprimierungsrate'; -$lang['de'][37] = 'Eingabe'; -$lang['de'][38] = 'Ausgabe'; -$lang['de'][39] = 'Sprache'; -$lang['de'][41] = 'Achtung: Dies könnte das Verhalten ihres CSS-Codes verändern!'; -$lang['de'][42] = 'Letztes ; entfernen'; -$lang['de'][43] = 'Ungültige Eigenschaften entfernen'; -$lang['de'][44] = 'Nur sichere Optimierungen'; -$lang['de'][45] = 'font-weight komprimieren'; -$lang['de'][46] = 'Kommentare beibehalten'; -$lang['de'][47] = 'Nichts ändern'; -$lang['de'][48] = 'Selektoren nur trennen (am Komma)'; -$lang['de'][49] = 'Selektoren mit gleichen Eigenschaften zusammenfassen (schnell)'; -$lang['de'][50] = 'Selektoren intelligent zusammenfassen (langsam!)'; -$lang['de'][51] = 'CSS erhalten'; -$lang['de'][52] = 'Kommentare, Hacks, etc. speichern. Viele Optimierungen sind dann aber nicht mehr möglich.'; -$lang['de'][53] = 'Keine'; -$lang['de'][54] = 'Nicht optimieren'; -$lang['de'][55] = 'Sichere Optimierungen'; -$lang['de'][56] = 'Alle Optimierungen'; -$lang['de'][57] = 'Zeitstempel hinzufügen'; -$lang['de'][58] = 'Copy to clipboard'; -$lang['de'][59] = 'Back to top'; -$lang['de'][60] = 'Your browser doesn\'t support copy to clipboard.'; -$lang['de'][61] = 'For bugs and suggestions feel free to'; -$lang['de'][62] = 'contact me'; -$lang['de'][63] = 'Output CSS code as complete HTML document'; -$lang['de'][64] = 'Code'; -$lang['de'][65] = 'CSS to style CSS output'; -$lang['de'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.'; - - -$lang['fr'][0] = 'CSS Formateur et Optimiseur (basé sur CSSTidy '; -$lang['fr'][1] = 'CSS Formateur et Optimiseur'; -$lang['fr'][2] = '(basé sur '; -$lang['fr'][3] = '(Version texte)'; -$lang['fr'][4] = 'Note Importante :'; -$lang['fr'][6] = 'Votre code doit être valide. Ce n’est pas un validateur qui signale les erreurs dans votre code CSS. Pour être sûr que votre code est correct, utilisez le validateur : W3C Validator.'; -$lang['fr'][7] = 'tous les commentaires sont enlevés'; -$lang['fr'][8] = 'Champ CSS :'; -$lang['fr'][9] = 'Code CSS :'; -$lang['fr'][10] = 'CSS en provenance d’une URL :