不推荐使用的构造函数:class [英] Deprecated constructor: class

查看:105
本文介绍了不推荐使用的构造函数:class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我刚开始在Wordpress网站上工作。现在,在每一行(前端和后端)上,我的网站都给了我以下信息:



不推荐使用:与他们的班级同名的方法将在未来的PHP版本中不是构造函数; Qode_Theme_Options在第14行的[LOCATION]中有一个弃用的构造函数。



在第14行,我找到以下代码:



  class  Qode_Theme_Options {

/ * ** qode选项类构造函数,兼容PHP4 *** /
函数qode_Theme_Options(){
add_action(' admin_menu',array(& $ this,' qode_admin_menu'));
add_action(' admin_init',数组(& $ this,' register_qode_theme_settings'));
}

函数init_qode_theme_options(){
global $ qode_options_theme16 < /跨度>;
if(isset($ qode_options_theme16 [' reset_to_defaults'])){
if($ qode_options_theme16 [' reset_to_defaults'] == ' yes')delete_option( qode_options_theme16 );
}
if (!get_option( qode_options_theme16)){
add_option( qode_options_theme16
数组(
reset_to_defaults => ' '
number_of_chars => 45,
first_color => ' '
second_color => ' '
background_color => '
'
< span class =code-string> background_color_box
=> ' '
highlight_color => ' '
selection_color => ' '
favicon_image => QODE_ROOT。 / img / favicon.ico



请注意,此代码的第一行是第14行。数组继续并且是类似项目的列表。



我有什么尝试过:



我一直在谷歌上搜索一下这个问题似乎很常见,但我找到的所有解决方案都是针对略有不同的问题。

解决方案

this,' qode_admin_menu')) ;
add_action(' admin_init',array(&


this,' register_qode_theme_settings'));
}

函数init_qode_theme_options(){
global

qode_options_theme16 ;
if(isset(


Hi all,

I just started working on a Wordpress website. Now, on every line (both front-end and back-end) my websites gives me the following message:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Qode_Theme_Options has a deprecated constructor in [LOCATION] on line 14.

On line 14, I find the following code:

class Qode_Theme_Options {

	/*** qode options class constructor, alse compatible for PHP4 ***/
	function qode_Theme_Options() {
		add_action('admin_menu', array(&$this, 'qode_admin_menu'));
		add_action('admin_init', array(&$this, 'register_qode_theme_settings'));
	}

	function init_qode_theme_options() {
		global $qode_options_theme16;
		if(isset($qode_options_theme16['reset_to_defaults'])){ 
			if( $qode_options_theme16['reset_to_defaults'] == 'yes' ) delete_option( "qode_options_theme16");
		}
		if (! get_option("qode_options_theme16")) {
			add_option( "qode_options_theme16",
				array(
					"reset_to_defaults" => '',
					"number_of_chars" => 45,
					"first_color" => '',
					"second_color" => '',
					"background_color" => '',
					"background_color_box" => '',
					"highlight_color" => '',
					"selection_color" => '',
					"favicon_image" => QODE_ROOT."/img/favicon.ico",


Note that the first line of this code is line 14. The array goes on and is a list of similar items.

What I have tried:

I've been googling for a while and the problem seems quite common, but all solutions I find are for slightly different problems.

解决方案

this, 'qode_admin_menu')); add_action('admin_init', array(&


this, 'register_qode_theme_settings')); } function init_qode_theme_options() { global


qode_options_theme16; if(isset(


这篇关于不推荐使用的构造函数:class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆