Last active
August 29, 2015 14:13
-
-
Save tablatronix/ef96e121e5adaae3f3e4 to your computer and use it in GitHub Desktop.
GS plugin - removes ckeditor and inserts lepture markdown editor in its place
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* GSEditorPatch.php | |
* @name GS Editor plugin | |
* | |
* removes ckeditor and inserts lepture markdown editor in its place | |
* https://github.com/lepture | |
* | |
* @version 0.1 | |
* @author Shawn Alverson | |
* @link http://get-simple.info | |
* @file GSEditorPatch.php | |
*/ | |
$pluginid = "GSEditorPatch"; | |
function init_GSEditorPatch($pluginid){ | |
$thisfile = basename(__FILE__, ".php"); // Plugin File | |
$name = $pluginid; | |
$version = "0.2"; | |
$author = "getsimple"; | |
$url = "http://get-simple.info"; | |
$desc = "Overrides ckeditor 3.x with custom"; | |
$type = ""; | |
$func = ""; | |
register_plugin($thisfile,$name,$version,$author,$url,$desc,$type,$func); | |
} | |
init_GSEditorPatch($pluginid); | |
if($HTMLEDITOR && get_filename_id() == 'edit'){ | |
add_action("header",$pluginid.'_header',$pluginid); | |
add_action("edit-content",$pluginid.'_edit_content'); | |
} | |
function GSEditorPatch_edit_content(){ | |
GLOBAL $HTMLEDITOR; | |
$HTMLEDITOR = false; | |
ob_start('GSEditorPatch_obfilter'); | |
} | |
function GSEditorPatch_obfilter($buffer){ | |
return str_replace('<script type="text/javascript" src="template/js/ckeditor/ckeditor.js"></script>','',$buffer); | |
} | |
function GSEditorPatch_header($pluginid){ | |
global $SITEURL; | |
// echo '<script type="text/javascript" src="'.$SITEURL.'plugins/'.$pluginid.'/js/ckeditor/ckeditor.js"></script>'; | |
echo '<link rel="stylesheet" href="//cdn.jsdelivr.net/editor/0.1.0/editor.css">'; | |
echo '<script src="//cdn.jsdelivr.net/editor/0.1.0/editor.js"></script>'; | |
echo '<script src="//cdn.jsdelivr.net/editor/0.1.0/marked.js"></script>'; | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function () { | |
var editor = new Editor({ | |
element : $('#post-content').get(0) | |
}); | |
}); | |
</script> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment