當前位置: 首頁>>代碼示例>>PHP>>正文


PHP validate_active_plugins函數代碼示例

本文整理匯總了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&#8217;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&#8217;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 &#8220;headers already sent&#8221; 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;未經允許,請勿轉載。