Ticket #2872 (closed New Feature: fixed)
Server side integration - CKEditor creator
| Reported by: | wwalc | Owned by: | wwalc |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.1 |
| Component: | Server : PHP | Version: | |
| Keywords: | Confirmed Review+ | Cc: |
Description
Port the integration files from V2.
Attachments
Change History
comment:2 Changed 3 years ago by wwalc
- Keywords Review? added
Setting Review? keyword to start the discussion.
comment:3 Changed 3 years ago by fredck
- Milestone changed from CKEditor 3.0 to CKEditor 3.x
We'll have server side integration after the first stable release only.
comment:5 Changed 2 years ago by wwalc
- Keywords Review? added
Few notes about the patch:
- PHP5+ only, once the patch is approved, I'll create a similar file for PHP4
- does not work with the SVN (source) version of CKEditor - this is because CKEditor doesn't load if
<script type="text/javascript" src="ckeditor/ckeditor_source.js"></script>
is placed inside of the <body> tag. - The attached php_ssi_docs.zip file contains documentation created with Doxygen, it may be easier to understand the patch with it.
- I'm not sure if the "textarea" method has the best name, but couldn't find anything better.
- The "replace" and "replaceAll" methods are needed in many situations when textarea elements are already available and we just want to add CKEditor support.
comment:6 Changed 2 years ago by wwalc
...
- At this moment, generated javascript code is returned, not printed. That's why in examples PHP "echo" function is used (echo $CKEditor->replace(...);). Because there are three methods to create CKEditor (textarea, replace, replaceAll) it doesn't seem to be the best solution to create separate methods that will return or output created code (like Create and CreateHtml in FCKeditor). Perhaps adding property $returnOutput ("false" by default) would suit better here?
comment:8 Changed 2 years ago by fredck
- Keywords Review- added; Review? removed
- We may have a different solution for the server side error regarding the ckeditor.js existence check. If the '%VERSION%' version is detected we output an additional script that checks for the CKEDITOR object at client site. If not found, an alert like "The CKEDITOR object was not found. Please be sure that the ckeditor.js file is available in your installation." is shown.
- The textarea() method name is not so clear. It makes me feel that we're creating a <textarea>, but I really want to create and editor. So, what about calling it editor()?
- Very few devs will care about the attributes to be set to the <textarea> element output by the SSI. Again, they just want an editor. So, let's not require them to pass the $attributes param to the (now named) textarea() method. We may have it as a property in the class, with some good default values.
- Let's have a linebreak after the <textarea> just to make the source a better.
- There are some "�" chars in the code for me. For example, the copyright char at the sample files, but also in the SSI code comments.
There are even other things that I've talked about with Wiktor in a chat.
comment:9 Changed 2 years ago by wwalc
- Keywords Review? added; Review- removed
To avoid problems with patches creating new files with broken encoding, I have attached zipped file with all PHP files (+documentation for better understanding): php_ssi.zip.
New methods:
- addEventHandler
- addGlobalEventHandler
- clearEventHandlers
- clearGlobalEventHandlers
New properties:
- $textareaAttributes
- $returnOutput
Static variables are used in the init function (and in some other functions) to remember the state of CKEditor (whether it has been already initialized) across multiple CKEditor PHP class instances (similar trick should work in PHP4, that's why I didn't use static properties).
comment:10 Changed 2 years ago by fredck
- Keywords Review+ added; Review? removed
This is a wonderful SSI for PHP. We can still refine it, but the important is that the public API looks good.
comment:11 Changed 2 years ago by fredck
Please commit it into the 3.1.x branch, not on trunk.
comment:12 Changed 2 years ago by wwalc
- Status changed from new to closed
- Resolution set to fixed
Fixed with [4692].

