XH 1.6: Editor Configuration as JSON

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
manu
Posts: 1090
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Editor Configuration as JSON

Post by manu » Thu Aug 08, 2013 3:29 pm

cmb wrote:
Holger wrote:But json_encode() / json_decode() was introduced with PHP 5.2. So we need to offer core-functions until XH sticks on PHP4.
Why not? JSON is a very simple format. A sufficient json_encode() is easy (I'm using a self-written one already in 2 plugins), and even json_decode() isn't too hard. Of course these functions are much slower than the native PHP alternatives, but they only have to be used as fallback for PHP < 5.2:

Code: Select all

if (!function_exists('json_decode') {
    require_once 'json.php';
} 
I missed this one. What are the system requirements for v1.6 (I remember seen it written somewhere).
What library did you use Christoph?
If still needed in 1.6, is there a way of common usage, system integrated/plugin?
regards
manu

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Editor Configuration as JSON

Post by cmb » Thu Aug 08, 2013 3:40 pm

manu wrote:What are the system requirements for v1.6 (I remember seen it written somewhere).
Not sure, if it has been explicitely stated already, but IMO we should stick with PHP 4.3 (however, I'd prefer PHP 4.3.10, because of PHP_EOL, but that shouldn't make a big difference).
manu wrote:If still needed in 1.6, is there a way of common usage, system integrated/plugin?
I have integrated the JSON class to cmsimple/classes/JSON.php (including some unit tests) and added simple wrapper functions XH_encodeJSON(), XH_decodeJSON() and XH_lastJsonError() (which use the JSON class only as fallback) to cmsimple/functions.php.

However, we have to decide how we'll handle those API extensions which may be useful for plugin developers. For compatibility with older CMSimple_XH versions and with CMSimple v4, we may consider putting them in a utility "plugin". There was some discussion about it in another thread already, but no final agreement was made.

PS:
manu wrote:What library did you use Christoph?
The code is self written. json_decode() was a nice exercise in writing a hand written LL parser. Only later I discovered the "reference" implementation of Douglas Crockford. I have not had a closer look at it, but perhaps it's faster or otherwise better. Porting it to PHP shouldn't be hard, if necessary (and perhaps somebody else already did so).
Last edited by cmb on Thu Aug 08, 2013 3:53 pm, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Editor Configuration as JSON

Post by cmb » Tue Oct 22, 2013 12:02 pm

cmb wrote:how about standardizing the format for the editor configuration files (aka. inits) as JSON?
Due to several restrictions of JSON, this may not be the best idea. We better postpone this decision to the next minor or major version.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply