demo.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. $htmlData = '';
  3. if (!empty($_POST['content1'])) {
  4. if (get_magic_quotes_gpc()) {
  5. $htmlData = stripslashes($_POST['content1']);
  6. } else {
  7. $htmlData = $_POST['content1'];
  8. }
  9. }
  10. ?>
  11. <!doctype html>
  12. <html>
  13. <head>
  14. <meta charset="utf-8" />
  15. <title>KindEditor PHP</title>
  16. <link rel="stylesheet" href="../themes/default/default.css" />
  17. <link rel="stylesheet" href="../plugins/code/prettify.css" />
  18. <script charset="utf-8" src="../kindeditor.js"></script>
  19. <script charset="utf-8" src="../lang/zh-CN.js"></script>
  20. <script charset="utf-8" src="../plugins/code/prettify.js"></script>
  21. <script>
  22. KindEditor.ready(function(K) {
  23. var editor1 = K.create('textarea[name="content1"]', {
  24. cssPath : '../plugins/code/prettify.css',
  25. uploadJson : '../php/upload_json.php',
  26. fileManagerJson : '../php/file_manager_json.php',
  27. allowFileManager : true,
  28. afterCreate : function() {
  29. var self = this;
  30. K.ctrl(document, 13, function() {
  31. self.sync();
  32. K('form[name=example]')[0].submit();
  33. });
  34. K.ctrl(self.edit.doc, 13, function() {
  35. self.sync();
  36. K('form[name=example]')[0].submit();
  37. });
  38. }
  39. });
  40. prettyPrint();
  41. });
  42. </script>
  43. </head>
  44. <body>
  45. <?php echo $htmlData; ?>
  46. <form name="example" method="post" action="demo.php">
  47. <textarea name="content1" style="width:700px;height:200px;visibility:hidden;"><?php echo htmlspecialchars($htmlData); ?></textarea>
  48. <br />
  49. <input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
  50. </form>
  51. </body>
  52. </html>