0

I get these PHP errors in error_log all the time and can't figure out how to solve it:

Errors:

PHP Strict Standards:  Non-static method wf_gmap::check_wp_footer() should not be called statically in /home/USERNAME/public_html/WEBSITE/wp-content/plugins/5sec-google-maps/5sec-gmaps.php on line 25

PHP Notice:  Use of undefined constant is_admin - assumed 'is_admin' in /home/USERNAME/public_html/WEBSITE/wp-content/plugins/5sec-google-maps/5sec-gmaps.php on line 21

PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method wf_gmap::init() should not be called statically in /home/USERNAME/public_html/WEBSITE/wp-includes/plugin.php on line 429

and 5sec-gmaps.php file's lines from 17 to 44 is this:

class wf_gmap {
  static $js_functions = '';

public function init() {
if(is_admin) {
  add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
}
// check wp_footer()
self::check_wp_footer();

// add shortcode
global $shortcode_tags;
if (isset($shortcode_tags[GMAP_SHORTCODE])) {
  add_action('admin_footer', array(__CLASS__, 'warning'));
} else {
  add_shortcode(GMAP_SHORTCODE, array(__CLASS__, 'shortcode'));
}

// add JS include files
add_action('wp_footer', array(__CLASS__, 'footer'), 2);

// add shortcode support in sidebar text widget
if (has_filter('widget_text', 'do_shortcode') === false) {
  add_filter('widget_text', 'do_shortcode');
}

return;

and plugin.php's line from 418 to 434:

    // Sort
if ( !isset( $merged_filters[ $tag ] ) ) {
    ksort($wp_filter[$tag]);
    $merged_filters[ $tag ] = true;
}

reset( $wp_filter[ $tag ] );

do {
    foreach ( (array) current($wp_filter[$tag]) as $the_ )
        if ( !is_null($the_['function']) )
            call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));

} while ( next($wp_filter[$tag]) !== false );

array_pop($wp_current_filter);

Any help would be appreciated.

3
  • Read the error messages and indent your code, please. Commented Oct 30, 2013 at 10:06
  • is_admin() needs the brackets to show it's a function, not a constant. Commented Oct 30, 2013 at 10:08
  • thank you Ben, changing it to if(is_admin()) fixed the notice. Commented Oct 30, 2013 at 10:33

2 Answers 2

1

You are invoking member methods with static context.

self::check_wp_footer(); should be $this->check_wp_footer();

Likewise, whatever $the_['function'] must be referring to a static method as well.

Sign up to request clarification or add additional context in comments.

2 Comments

Marcell, when i change it to $this->check_wp_footer(); the whole page breaks.
In the provided code, there's no declaration of check_wp_footer. The entire source code quotation is messy, cannot tell much about it. Edit the code and provide the full class declaration, make sure braces are terminated and please do proper indentation.
0

PHP Strict Standards: Non-static method wf_gmap::check_wp_footer() should

means function check_wp_footer is not static method so you can't call like this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.