• shayt

    (@shayt)


    Hi
    i used another plugin that also using “simple_html_dom” & “dom-parser”
    and i got error –
    AH01071: Got error ‘PHP message: PHP Fatal error: Cannot declare class simple_html_dom_node, because the name is already in use in…

    if think instead of
    include_once(‘lib/dom-parser.php’);
    in flying-scripts/html-rewrite.php

    you should do something like
    if ( ! class_exists(‘simple_html_dom_node’) && ! class_exists(‘simple_html_dom’) && !function_exists(‘file_get_html’) ) include_once(‘lib/dom-parser.php’);

    Shay

Viewing 1 replies (of 1 total)
  • No, Shay, the dom-parser.php contains a check for class existence already – look into it: the file contents won’t be executed if the class is present.

    The real problem arises in case the next load of any dom parsers does not contain an existence check. It’s a problem of execution order. So as I had the same problem I could solve it like this (inside flying-scripts.php):

    add_action( 'plugins_loaded', function() {
        include('init-config.php');
        include('settings/index.php');
        include('inject-js.php');
        include('html-rewrite.php');
        include('shortcuts.php');
    }, 15 );

    This way the dom parser of Flying Scripts will be loaded after all other plugins which in my case effectively could avoid the class-already-exists error.

Viewing 1 replies (of 1 total)
  • The topic ‘dom-parser conflict error’ is closed to new replies.