Last active
July 27, 2020 23:57
-
-
Save relliv/adbc36451c227583ce2c746638fd01c3 to your computer and use it in GitHub Desktop.
PHP CKEditor content save to database and load from database
This file contains hidden or 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 | |
| /*--------------------- CKEditor ----------------- START */ | |
| // CKEditor content prepare to database add process | |
| public function CKEditorContentPrepare($content) | |
| { | |
| $content = trim($content); | |
| $content = stripslashes($content); | |
| $content = htmlspecialchars($content); | |
| return $content; | |
| } | |
| // CKEditor content read from database to print process | |
| public function CKEditorContentRead($content) | |
| { | |
| return html_entity_decode(htmlspecialchars_decode($content)); | |
| } | |
| /*--------------------- CKEditor ----------------- END */ |
This file contains hidden or 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
| /** | |
| * CK Editor update before send | |
| */ | |
| function CKUpdate() { | |
| for (instance in CKEDITOR.instances) { | |
| CKEDITOR.instances[instance].updateElement(); | |
| } | |
| } | |
| /** | |
| * CK Editor clear editor field | |
| */ | |
| function CKClear() { | |
| CKEDITOR.instances.editor.setData(''); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
asdasdasdasd