本文整理汇总了PHP中validate_active_plugins函数的典型用法代码示例。如果您正苦于以下问题:PHP validate_active_plugins函数的具体用法?PHP validate_active_plugins怎么用?PHP validate_active_plugins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_active_plugins函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wp_install
/**
* Installs the blog
*
* {@internal Missing Long Description}}
*
* @since 2.1.0
*
* @param string $blog_title Blog title.
* @param string $user_name User's username.
* @param string $user_email User's email.
* @param bool $public Whether blog is public.
* @param null $deprecated Optional. Not used.
* @param string $user_password Optional. User's chosen password. Will default to a random password.
* @return array Array keys 'url', 'user_id', 'password', 'password_message'.
*/
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
if (!empty($deprecated)) {
_deprecated_argument(__FUNCTION__, '2.6');
}
wp_check_mysql_version();
wp_cache_flush();
make_db_current_silent();
if (!is_file(ABSPATH . 'wp-admin/install.sql')) {
//[ysd]如果有install.sql不设置默认options数据
populate_options();
} else {
validate_active_plugins();
//[ysd] 禁用 不可用的插件
}
populate_roles();
update_option('blogname', $blog_title);
update_option('admin_email', $user_email);
update_option('blog_public', $public);
$guessurl = isset($_SERVER['HTTP_APPNAME']) ? 'http://' . substr($_SERVER['HTTP_APPNAME'], 5) . '.1kapp.com' : wp_guess_url();
//[ysd] 固定了guessurl
update_option('siteurl', $guessurl);
update_option('home', $guessurl);
get_option('siteurl');
// If not a public blog, don't ping.
if (!$public) {
update_option('default_pingback_flag', 0);
}
// Create default user. If the user already exists, the user tables are
// being shared among blogs. Just set the role in that case.
$user_id = username_exists($user_name);
$user_password = trim($user_password);
$email_password = false;
if (!$user_id && empty($user_password)) {
$user_password = wp_generate_password(12, false);
$message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
$user_id = wp_create_user($user_name, $user_password, $user_email);
update_user_option($user_id, 'default_password_nag', true, true);
$email_password = true;
} else {
if (!$user_id) {
// Password has been provided
$message = '<em>' . __('Your chosen password.') . '</em>';
$user_id = wp_create_user($user_name, $user_password, $user_email);
} else {
$message = __('User already exists. Password inherited.');
}
}
$user = new WP_User($user_id);
$user->set_role('administrator');
if (!file_exists(ABSPATH . 'wp-admin/without_default')) {
wp_install_defaults($user_id);
}
//[ysd],如果打包时设置了默认数据,才会设置默认数据
flush_rewrite_rules();
wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
wp_cache_flush();
return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
开发者ID:ramo01,项目名称:1kapp,代码行数:74,代码来源:upgrade.php
示例2: update_option
update_option('recently_activated', array());
}
break;
}
}
$wp_list_table->prepare_items();
wp_enqueue_script('plugin-install');
add_thickbox();
add_screen_option('per_page', array('default' => 999));
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'https://wordpress.org/plugins/') . '</p>'));
get_current_screen()->add_help_tab(array('id' => 'compatibility-problems', 'title' => __('Troubleshooting'), 'content' => '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . '<p>' . sprintf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>'));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
$title = __('Plugins');
$parent_file = 'plugins.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
$invalid = validate_active_plugins();
if (!empty($invalid)) {
foreach ($invalid as $plugin_file => $error) {
echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>';
}
}
?>
<?php
if (isset($_GET['error'])) {
if (isset($_GET['main'])) {
$errmsg = __('You cannot delete a plugin while it is active on the main site.');
} elseif (isset($_GET['charsout'])) {
$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
} else {
$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
开发者ID:Plego,项目名称:toyoa,代码行数:31,代码来源:plugins.php
示例3: test_validate_active_plugins_empty
/**
* @covers ::validate_active_plugins
*/
public function test_validate_active_plugins_empty()
{
$this->assertEquals(array(), validate_active_plugins());
}
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:includesPlugin.php
注:本文中的validate_active_plugins函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论