不允许eval() [英] eval() is not allowed
本文介绍了不允许eval()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的wordpress主题中将WPAlchemy MetaBox PHP类用于某些自定义帖子类型. 运行主题检查时出现问题:
I am using the WPAlchemy MetaBox PHP Class in my wordpress theme for some custom post types. Problem appears when I run the Theme-Check:
WARNING: Found eval in the file inc/metaboxes/MediaAccess.php. eval() is not allowed..
Line 375: data = eval('(' + (data.indexOf('{') < 0 ? '{' + data + '}' : data) + ')');
我不知道为什么会这样,因为第375行包含在JavaScript中:CDATA
I don't know why this is coming up, as line 375 is JavaScript enclosed in: CDATA
请参见下面的MediaAccess.php摘录
See below excerpt from MediaAccess.php
// include javascript for special functionality
?><script type="text/javascript">
/* <![CDATA[ */
var interval = null;
var data = $(this).attr('class').match(/({.*})/i);
data = (data && data[1]) ? data[1] : '' ;
data = eval("(" + (data.indexOf('{') < 0 ? '{' + data + '}' : data) + ")");
/* ]]> */
</script><?php
我想将此主题提交到wordpress目录,但他们不允许出现此错误:/
I want to submit this theme to the wordpress directory but they don't allow it with this error :/
推荐答案
尝试$.parseJSON(data.indexOf('{') < 0 ? '{' + data + '}' : data)
评价是邪恶的
这篇关于不允许eval()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文