demo.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. K.create('#content1', {
  42. themeType : 'qq',
  43. items : [
  44. 'bold','italic','underline','fontname','fontsize','forecolor','hilitecolor','plug-align','plug-order','plug-indent','link'
  45. ]
  46. });
  47. });
  48. </script>
  49. </head>
  50. <body>
  51. <?php echo $htmlData; ?>
  52. <form name="example" method="post" action="demo.php">
  53. <textarea name="content1" style="width:700px;height:200px;visibility:hidden;"><?php echo htmlspecialchars($htmlData); ?></textarea>
  54. <br />
  55. <input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
  56. </form>
  57. </body>
  58. </html>