Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Bug in custom editor logic (I think. At least typo in documentation)

    I'll start with the typo.

    in admin\includes\init_includes\init_html_editor.php there is the following hint/comments:

    /**
    * List of potential editors apps
    *
    * CONSTANTS are used for language-specific display names, and are defined in /YOUR_ADMIN_FOLDER/includes/languages/extra_definitions/editor_EDITORNAME.php
    *
    * To add additional editors, add your own entries to the $editors_list array by creating a NEW FILE in /YOUR_ADMIN_FOLDER/includes/extra_functions/editor_EDITORNAME.php containing just one line of PHP:
    * <?php $editors_list['NAME_OF_EDITOR'] = array('desc' => EDITOR_CONSTANT, 'handler' => 'editorhandlerfilename.php', 'special_needs' => '');
    *
    *
    * NOTE: THERE SHOULD BE NO NEED TO EDIT ANYTHING BELOW THIS LINE:
    */
    It would seem to me the paths of the language and function is missing a level. It should read (I think):

    /**
    * List of potential editors apps
    *
    * CONSTANTS are used for language-specific display names, and are defined in /YOUR_ADMIN_FOLDER/includes/languages/english/extra_definitions/editor_EDITORNAME.php
    *
    * To add additional editors, add your own entries to the $editors_list array by creating a NEW FILE in /YOUR_ADMIN_FOLDER/includes/functions/extra_functions/editor_EDITORNAME.php containing just one line of PHP:
    * <?php $editors_list['NAME_OF_EDITOR'] = array('desc' => EDITOR_CONSTANT, 'handler' => 'editorhandlerfilename.php', 'special_needs' => '');
    *
    *
    * NOTE: THERE SHOULD BE NO NEED TO EDIT ANYTHING BELOW THIS LINE:
    */
    Making that change got me somewhere, but I was still having trouble getting the friendly name of the editor to be shown in the drop-down. I think I discovered that, perhaps, the functions are being read in before the language defines, but they use the language defines so it ends up reporting the constant name as a literal instead of the string it represents. In other words, "EDITOR_CONSTANT" would be shown in the drop-down instead of "my test" (despite the constant being properly registered, as confirmed by a simply echo test in any file that loads after the languages). I can "fix" this by putting the define in the function, something like this:

    Code:
    <?php
    define("EDITOR_TEST", "Test");
     $editors_list['TEST']  = array('desc' => EDITOR_TEST,  'handler' => 'test.php',  'special_needs' => '');
    but clearly that's not the proper way to do it.

    Did I do something wrong? I'm fairly sure this is a bug and you'll see if you attempt to follow your own instructions, exactly and/or with my modifications, for adding an editor.

  2. #2
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Bug in custom editor logic (I think. At least typo in documentation)

    One solution: ignore the comments/notes (which contain incorrect paths anyway) and override the init_html_editor.php file entirely, and simply do what the comments say not to do and add the editor into the list. That way the define is properly read-in.

    It works.

    So I'm happy. No need to fix this for me specifically, and obviously there's not many people bothered by it so just take a look at the comments for 1.6 and make sure they are consistent with reality, and perhaps take a look at the order in which extra_defines are read in relation to extra_functions. All on the admin side (I never looked at front end for any of this)

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Bug in custom editor logic (I think. At least typo in documentation)

    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Possible logic bug in zone comparisions
    By hem in forum Bug Reports
    Replies: 6
    Last Post: 21 Oct 2007, 10:05 AM
  2. I think this is my last question...for a few at least
    By julia44 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 27 Dec 2006, 05:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR