WordPress.org

Forums

Widget Context
code styling plugin reports there is an error in widget contect (2 posts)

  1. mgason
    Member
    Posted 2 years ago #

    Hi,
    I installed the code styler plugin on the recommendation of woocommerce support.
    http://wordpress.org/extend/plugins/codestyling-localization/

    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.

    http://wordpress.org/extend/plugins/widget-context/

  2. jayque9
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Widget Context
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic