主题检查插件生成的WordPress错误

时间:2013-12-26 作者:Furqan Mahmood

请帮助我解决这些警告,以便提交主题供提交。提前谢谢。

多亏了wordpress,我发现了许多警告并解决了其中的许多问题。stackexchange。com,但仍然无法解决以下问题,请帮助我。

WARNING: Found base64_encode in the file twitteroauth.php. base64_encode() is not allowed.
Line 123: return base64_encode(hash_hmac(\'sha1\', $base_string, $key, true));
Line 203: return base64_encode($signature);

WARNING: Found base64_decode in the file twitteroauth.php. base64_decode() is not allowed.
Line 207: $decoded_sig = base64_decode($signature);

WARNING: file_get_contents was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line 277: file_get_contents(self::$POST_INPUT)

WARNING: curl_init was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line 1084: $ci = curl_init();

WARNING: curl_exec was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
Line 1110: $response = curl_exec($ci);

REQUIRED: plugin-activation.php. Themes should use add_theme_page() for adding admin pages.
Line 335: add_submenu_page(

REQUIRED: innovative_panel_functions.php. Themes should use add_theme_page() for adding admin pages.
Line 143: add_menu_page(theme_name.\' Settings\', theme_name ,\'install_themes\', \'panel\'

RECOMMENDED: Possible variable $instance found in translation function in plugin-activation.php. Translation function calls must NOT contain PHP variables.
Line 2043: echo \'<p><a href=\'\' . add_query_arg( \'page\', TGM_Plugin_Activation::$instance->menu, admin_url( TGM_Plugin_Activation::$instance->parent_url_slug ) ) . \'\' title=\'\' . esc_attr( TGM_Plugin_Activation::$instance->strings[\'return\'] ) . \'\' target=\'_parent\'>\' . __( TGM_Plugin_Activation::$instance->strings[\'return\'], \'tgmpa\' ) . \'</a><

1 个回复
SO网友:Benny Neugebauer

File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.
WordPress编码风格要求您使用WP文件系统,而不是直接使用PHP文件函数。您可以替换file_get_contents 通过以下方式轻松通话:

$response = wp_remote_get($feed_url);
$file_content = $response[\'body\'];
有关更多具体信息,请查看:“A Look at the WordPress HTTP API: A Practical Example of wp_remote_get“。

如果要读取的文件不是本地文件,请参阅WordPress Filesystem_API.

结束

相关推荐

Displaying oEmbed errors?

有时,通过oEmbed嵌入项目是不可能的,例如,当YouTube视频已禁用嵌入时。The oEmbed service will return a 401 Unauthorized, 并且不会转换代码。有没有办法通知用户这一点?当前的工作流是非直观的(至少对我来说),我更喜欢在WordPress页面上,或者更好的是,在编辑器中显示一条消息,说明对象无法嵌入。