0

我一直在 error_log 中收到这些 PHP 错误,但不知道如何解决它:

错误:

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

和 5sec-gmaps.php 文件从 17 到 44 的行是这样的:

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;

和 plugin.php 的行从 418 到 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);

任何帮助,将不胜感激。

4

2 回答 2

1

您正在使用静态上下文调用成员方法。

self::check_wp_footer();应该$this->check_wp_footer();

同样,任何东西也$the_['function']必须引用静态方法。

于 2013-10-30T10:06:50.673 回答
0

PHP 严格标准:非静态方法 wf_gmap::check_wp_footer() 应该

意味着函数 check_wp_footer 不是静态方法,所以你不能这样调用

于 2013-10-30T10:07:01.453 回答