注意:未定义常量REDUX_TEXT_DOMAIN的使用-假定为‘REDUX_TEXT_DOMAIN’

时间:2014-07-02 作者:ewizard

我正在建立我的第一个Wordpress网站,我刚刚下载并安装了v3。9.1。我买了一个主题(rustik3)并试图安装它,但我遇到了WP\\U调试产生的以下错误:

Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed \'Redux_TEXT_DOMAIN\' in /var/www/wp-content/themes/rustik3/admin/options.php on line 501

Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed \'Redux_TEXT_DOMAIN\' in /var/www/wp-content/themes/rustik3/admin/options.php on line 502

Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed \'Redux_TEXT_DOMAIN\' in /var/www/wp-content/themes/rustik3/admin/options.php on line 503

Notice: Undefined variable: item_info in /var/www/wp-content/themes/rustik3/admin/theme-functions.php on line 23
我在google上做了一些搜索,我开始认为Wordpress的上一次更新导致Redux框架被弃用,无法使用。不过这只是一种预感。截至目前,主题已安装,但它显示为完全空白-无论何时http://localhost 或者当我试图在Wordpress UI中自定义它时。我还没有查看错误消息日志的最后一部分(第23行错误)。。。但这只是一个未定义的变量,所以我可以自己解决这个问题。有什么想法吗?

UPDATE

这就是代码块在options.php:

array(
            \'id\' => \'google_webfonts\',
            \'type\' => \'google_webfonts\',
            \'title\' => __(\'Enable Google Webfonts\', Redux_TEXT_DOMAIN), 
            \'sub_desc\' => __(\'Pick from over 600 Google Webfonts to use on the site. Then select below which elements you want to apply it to.\', Redux_TEXT_DOMAIN),
                \'desc\' => __(\'\', Redux_TEXT_DOMAIN)
      ),

UPDATE

我在所有wordpress文件中搜索了Redux_TEXT_DOMAIN 它唯一出现的地方就是上面的代码块。。。

UPDATE

这段代码是什么加载在我的主题文本域。。。我不熟悉什么是文本域,但这可能与此相关:

public function load_textdomain() {
        if ( isset( $this->textdomain_loaded ) )
            return $this->textdomain_loaded;

        $textdomain = $this->get(\'TextDomain\');
        if ( ! $textdomain ) {
            $this->textdomain_loaded = false;
            return false;
        }

        if ( is_textdomain_loaded( $textdomain ) ) {
            $this->textdomain_loaded = true;
            return true;
        }

        $path = $this->get_stylesheet_directory();
        if ( $domainpath = $this->get(\'DomainPath\') )
            $path .= $domainpath;
        else
            $path .= \'/languages\';

        $this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );
        return $this->textdomain_loaded;
    }
上述代码是否有问题?

注意:我发布了一个重复的问题here. 在我意识到堆栈交换中有一个特定于Wordpress的部分之前,我这样做了。如果您关心stackoverflow。com-你可以在那里回答问题。。。我已经悬赏50分:)。您还应该阅读该页上的评论。。。我想我可能找到了一些相关信息。

UPDATE

感谢cybmeta的评论-我摆脱了Redux_TEXT_DOMAIN 错误。。。剩下的最后一个是:

Notice: Undefined variable: item_info in /var/www/wp-content/themes/rustik3/admin/theme-functions.php on line 23

代码如下:

$item_info .= \'<div class="rustik_updated"><div class="mc_embed_signup_admin">
        <form action="http://doublerainbowx.us6.list-manage2.com/subscribe/post?u=eac2b83a92633c39dae8a663b&amp;id=334c60b856" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
            <label for="mce-EMAIL">Get e-mails about important updates and helpful tips on how to run your store by joining the Rustik newsletter.</label>
            <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
            <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
            <div style="position: absolute; left: -5000px;"><input type="text" name="b_eac2b83a92633c39dae8a663b_334c60b856" value=""></div>
            <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
            <span><a href="?rustik_updates_nag_ignore=0">Hide Notice</a></span>
        </form>

        </div></div>\';

        echo $item_info;
错误在echo $item_info 线条-因此,它似乎不是因为某种原因而设置的。。。尽管它看起来像是在上面。

1 个回复
最合适的回答,由SO网友:Jonathan Lafleur 整理而成

您的$item_info 在尝试附加到变量之前,该变量未初始化。$item_info .= \'String content\';$item_info = $item_info . \'String content\';, 因此,您只需检查此变量是否存在:

if (!isset($item_info)) { 
    $item_info = \'\';
}
$item_info .= \'<div class="rustik_updated"><div class="mc_embed_signup_admin">
    <form action="http://doublerainbowx.us6.list-manage2.com/subscribe/post?u=eac2b83a92633c39dae8a663b&amp;id=334c60b856" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
        <label for="mce-EMAIL">Get e-mails about important updates and helpful tips on how to run your store by joining the Rustik newsletter.</label>
        <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
        <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
        <div style="position: absolute; left: -5000px;"><input type="text" name="b_eac2b83a92633c39dae8a663b_334c60b856" value=""></div>
        <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
        <span><a href="?rustik_updates_nag_ignore=0">Hide Notice</a></span>
    </form>

    </div></div>\';
有时开发人员在销售主题/插件时没有对其进行测试并发出警告,这就是为什么会出现此错误。

结束