Support » Plugin: Widget Context » code styling plugin reports there is an error in widget contect

  • Hi,
    I installed the code styler plugin on the recommendation of woocommerce support.

    It flagged 2 issues once installed, one was with widget context…

    Scripting Guard. The Plugin Codestyling Localization was forced to protect its own page rendering process against 2 incidents !
    PHP runtime error reporting detected !
    Reason: some executed PHP code is not written proper | Originator: unknown (probably by Theme or Plugin)
    Below listed error reports has been traced and removed during page creation:
    NOTICE Error: [8] Use of undefined constant __DIR__ – assumed \’__DIR__\’ plugins/widget-context/widget-context.php on line 63

    Their further explanation is…
    The plugin Codestyling Localization introduced a high sophisticated inject detection and will show error messages, if themes or plugins try to inject their own scripts into this plugin pages. Furthermore all embedded scripts will be safe guarded and traced in case they will raise runtime exceptions. Doing so this plugin protects itself of malfunction caused by 3rd party plugin/theme authors. This will ensure the correct behavoir for this page, but expect at other backend pages malfunctioning code, because this is a global issue.
    What can I do, if I get this protection message alert?
    If your Installation has this kind of problems, please contact the author of theme or plugin(s) which inject their script code either accidentally or intentionally (click message details). He/she must repair the affected theme/plugin to play nicely with other plugins at WordPress backend and/or restrict its scripts to the 3rd party theme/plugin pages only.

Viewing 1 replies (of 1 total)
  • Just saw the same error when developing a new site with the debug option turned on. Edit the plugin file “widget-content.php” and change the admin_scripts function to this:

    function admin_scripts() {
    if ( defined(‘__DIR__’) ) { // support for php v5.3 and later
    wp_enqueue_style( ‘widget-context-admin’, WP_CONTENT_URL . ‘/plugins/’. basename(__DIR__) . ‘/admin-style.css’ );
    } else { // support for php prior to v5.3
    wp_enqueue_style( ‘widget-context-admin’, WP_CONTENT_URL . ‘/plugins/’. basename(dirname(__FILE__)) . ‘/admin-style.css’ );

    This has more to do with the version of php that you are using. __DIR__ was added in php v5.3.0, so if you are still on a server using 5.2, you will see this error pop up. Using dirname(__FILE__) instead for older servers will fix your problem.

Viewing 1 replies (of 1 total)
  • The topic ‘code styling plugin reports there is an error in widget contect’ is closed to new replies.