[Plugin] Risolvere un conflitto di programmazione tra "My Custom CSS" e "Wp Editor"
Il mio plugin (My Custom Css) va in conflitto con WP Editor a causa del fatto che usano entrambi le stesse librerie (CodeMirror)!
Solo che il mio carica css e js solo nella pagina interessata, mentre WP Editor in tutto il pannello amministrativo -.-'
---
Ciò che dovrei eliminare dal backend - almeno nella pagina di My Custom CSS, è:
Ciò che dovrebbe eliminare dal sorgente del backend:
Codice HTML:
<link rel='stylesheet' id='wpeditor-css' href='http://***/wp-content/plugins/wp-editor/wpeditor.css?ver=1.2' type='text/css' media='all' />
<link rel='stylesheet' id='fancybox-css' href='http://***/wp-content/plugins/wp-editor/extensions/fancybox/jquery.fancybox-1.3.4.css?ver=1.2' type='text/css' media='all' />
<link rel='stylesheet' id='codemirror-css' href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/codemirror.css?ver=1.2' type='text/css' media='all' />
<link rel='stylesheet' id='codemirror_dialog-css' href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/dialog.css?ver=1.2' type='text/css' media='all' />
<link rel='stylesheet' id='codemirror_themes-css' href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/themes/themes.css?ver=1.2' type='text/css' media='all' />
Più:
E dai sorgenti di Wp Editor ho rintracciato questa struttura (.classes/WPEditor.php):
Codice PHP:
public function registerDefaultStylesheet() {
wp_register_style('wpeditor', WPEDITOR_URL . '/wpeditor.css', false, WPEDITOR_VERSION_NUMBER);
wp_register_style('fancybox', WPEDITOR_URL . '/extensions/fancybox/jquery.fancybox-1.3.4.css', false, WPEDITOR_VERSION_NUMBER);
wp_register_style('codemirror', WPEDITOR_URL . '/extensions/codemirror/codemirror.css', false, WPEDITOR_VERSION_NUMBER);
wp_register_style('codemirror_dialog', WPEDITOR_URL . '/extensions/codemirror/dialog.css', false, WPEDITOR_VERSION_NUMBER);
wp_register_style('codemirror_themes', WPEDITOR_URL . '/extensions/codemirror/themes/themes.css', false, WPEDITOR_VERSION_NUMBER);
}
public function registerDefaultScript() {
wp_register_script('wpeditor', WPEDITOR_URL . '/js/wpeditor.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('wp-editor-posts-jquery', WPEDITOR_URL . '/js/posts-jquery.js', false, WPEDITOR_VERSION_NUMBER, true);
wp_register_script('fancybox', WPEDITOR_URL . '/extensions/fancybox/js/jquery.fancybox-1.3.4.pack.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror', WPEDITOR_URL . '/extensions/codemirror/js/codemirror.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_php', WPEDITOR_URL . '/extensions/codemirror/js/php.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_javascript', WPEDITOR_URL . '/extensions/codemirror/js/javascript.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_css', WPEDITOR_URL . '/extensions/codemirror/js/css.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_xml', WPEDITOR_URL . '/extensions/codemirror/js/xml.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_clike', WPEDITOR_URL . '/extensions/codemirror/js/clike.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_dialog', WPEDITOR_URL . '/extensions/codemirror/js/dialog.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_search', WPEDITOR_URL . '/extensions/codemirror/js/search.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_searchcursor', WPEDITOR_URL . '/extensions/codemirror/js/searchcursor.js', false, WPEDITOR_VERSION_NUMBER);
wp_register_script('codemirror_mustache', WPEDITOR_URL . '/extensions/codemirror/js/mustache.js', false, WPEDITOR_VERSION_NUMBER);
//wp_register_script('codemirror_foldcode', WPEDITOR_URL . '/extensions/codemirror/js/foldcode.js');
}
Quindi avevo provato a disabilitare il tutto da My Custom CSS con questo codice:
Codice PHP:
<?php
// Disable "WP Editor" in this page if is active: http://wordpress.org/extend/plugins/wp-editor/
If (is_plugin_active("wp-editor/wpeditor.php")) {
wp_deregister_style('wpeditor');
wp_deregister_style('fancybox');
wp_deregister_style('codemirror');
wp_deregister_style('codemirror_dialog');
wp_deregister_style('codemirror_themes');
wp_deregister_script('wpeditor');
wp_deregister_script('wp-editor-posts-jquery');
wp_deregister_script('codemirror');
wp_deregister_script('codemirror_php');
wp_deregister_script('codemirror_javascript');
wp_deregister_script('codemirror_css');
wp_deregister_script('codemirror_xml');
wp_deregister_script('codemirror_clike');
wp_deregister_script('codemirror_dialog');
wp_deregister_script('codemirror_search');
wp_deregister_script('codemirror_searchcursor');
wp_deregister_script('codemirror_mustache');
}
?>
Ma non mi funziona... :|
-
Qualche idea sul perché? :???: