本文整理汇总了PHP中validate_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP validate_plugin函数的具体用法?PHP validate_plugin怎么用?PHP validate_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _pp_file_filtering_promo
function _pp_file_filtering_promo()
{
if (0 === validate_plugin("pp-file-url-filter/pp-file-url-filter.php")) {
$msg = __('To block direct URL access to attachments of unreadable posts, activate the PP File URL Filter plugin.', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To block direct URL access to attachments of unreadable posts, %1$sinstall%2$s the PP File URL Filter plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To block direct URL access to attachments of unreadable posts, %1$senter%2$s or %3$spurchase%4$s a support key and install the PP File URL Filter plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>');
}
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready( function($) {
$('#posts-filter').after('<a href="#" class="pp-file-filtering-promo" style="margin-left:5px"><?php
_e('Block URL access', 'pp');
?>
</a><span class="pp-ext-promo" style="display:none;"><?php
echo $msg;
?>
</span>');
$('a.pp-file-filtering-promo').click(function() {
$(this).hide().next('span').show();
return false;
});
});
/* ]]> */
</script>
<?php
}
示例2: deactivate_plugin
/**
* Deactivate a plugin
*
* @since 1.0
*
* @param string $plugin_file Relative path to plugin
* @return bool Whether plugin was deactivated
*/
function deactivate_plugin($plugin_file)
{
global $current_plugins;
if (!isset($current_plugins[md5($plugin_file)])) {
return false;
}
if (!validate_plugin($plugin_file)) {
return false;
}
unset($current_plugins[md5($plugin_file)]);
$data = new DataHandler();
$data->save('plugins.data', serialize($current_plugins));
return true;
}
示例3: display_notice
/**
* Display a notice if AudioTheme isn't active.
*
* @since 1.0.0
*/
public function display_notice()
{
$user_id = get_current_user_id();
// Return early if user already dismissed the notice.
if ('dismissed' == get_user_meta($user_id, $this->notice_key(), true)) {
return;
}
?>
<div id="audiotheme-required-notice" class="error">
<p>
<?php
echo $this->strings['notice'];
if (0 === validate_plugin('audiotheme/audiotheme.php')) {
$activate_url = wp_nonce_url('plugins.php?action=activate&plugin=audiotheme/audiotheme.php', 'activate-plugin_audiotheme/audiotheme.php');
printf(' <a href="%s"><strong>%s</strong></a>', esc_url($activate_url), $this->strings['activate']);
} else {
printf(' <a href="https://audiotheme.com/view/audiotheme/"><strong>%s</strong></a>', $this->strings['learn_more']);
}
$dismiss_url = wp_nonce_url(add_query_arg(get_template(), 'dismiss-notice'), $this->dismiss_notice_action());
printf(' <a href="%s" class="dismiss" style="float: right">%s</a>', esc_url($dismiss_url), $this->strings['dismiss']);
?>
</p>
</div>
<script type="text/javascript">
jQuery( '#audiotheme-required-notice' ).on( 'click', '.dismiss', function( e ) {
var $notice = jQuery( this ).closest( '.error' );
e.preventDefault();
jQuery.get( ajaxurl, {
action: '<?php
echo $this->dismiss_notice_action();
?>
',
_wpnonce: '<?php
echo wp_create_nonce($this->dismiss_notice_action());
?>
'
}, function() {
$notice.slideUp();
});
});
</script>
<?php
}
示例4: _ppc_item_ui_hints
function _ppc_item_ui_hints($for_item_type)
{
if ('attachment' == $for_item_type && !defined('PPFF_VERSION')) {
if (0 === validate_plugin("pp-file-url-filter/pp-file-url-filter.php")) {
$msg = __('To block direct access to unreadable files, activate the PP File URL Filter plugin.', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To block direct access to unreadable files, %1$sinstall%2$s the PP File URL Filter plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To block direct access to unreadable files, %1$spurchase a support key%2$s and install the PP File URL Filter plugin.', 'pp'), '<a href="http://presspermit.com/purchase">', '</a>');
}
echo "<div class='pp-ext-promo' style='padding:0.5em'>{$msg}</div>";
}
if (!defined('PPCE_VERSION')) {
if (0 === validate_plugin("pp-collaborative-editing/pp-collaborative-editing.php")) {
$msg = __('To customize editing permissions, activate the PP Collaborative Editing plugin.', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To customize editing permissions, %1$sinstall%2$s the PP Collaborative Editing plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To customize editing permissions, %1$spurchase a support key%2$s and install the PP Collaborative Editing plugin.', 'pp'), '<a href="http://presspermit.com/purchase">', '</a>');
}
echo "<div class='pp-ext-promo' style='padding:0.5em;margin-top:0'>{$msg}</div>";
}
}
示例5: elseif
<?php
//echo esc_html( __( 'Posts with a custom Visibility or Editability require a corresponding Permission Group role assignment.', 'pp' ) );
$pp_groups_list_table->search_box(__('Search Groups', 'pp'), 'group');
?>
<?php
$pp_groups_list_table->display();
?>
</form>
<br class="clear" />
<?php
if (defined('BP_VERSION') && !defined('PPCE_VERSION') && pp_get_option('display_extension_hints')) {
if (0 === validate_plugin("pp-buddypress-role-groups/pp-buddypress-role-groups.php")) {
$msg = __('To assign roles or exceptions to BuddyPress groups, activate the PP BuddyPress Role Groups', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To assign roles or exceptions to BuddyPress groups, %1$sinstall%2$s the PP BuddyPress Role Groups plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To assign roles or exceptions to BuddyPress groups, %1$senter%2$s or %3$spurchase%4$s a support key and install the PP BuddyPress Role Groups plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>');
}
echo "<div class='pp-ext-promo'>{$msg}</div>";
}
?>
</div>
<?php
break;
}
// end of the $doaction switch
示例6: _pp_post_status_promo
function _pp_post_status_promo()
{
if (!defined('PPS_VERSION')) {
if (0 === validate_plugin("pp-custom-post-statuses/pp-custom-post-statuses.php")) {
$msg = __('To define custom privacy statuses, activate the PP Custom Post Statuses plugin.', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To define custom privacy statuses, %1$sinstall%2$s the PP Custom Post Statuses plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To define custom privacy statuses, %1$senter%2$s or %3$spurchase%4$s a support key and install the PP Custom Post Statuses plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>');
}
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready( function($) {
$('#visibility-radio-private').next('label').after('<a href="#" class="pp-custom-privacy-promo" style="margin-left:5px"><?php
_e('define custom privacy', 'pp');
?>
</a><span class="pp-ext-promo" style="display:none;"><br /><?php
echo $msg;
?>
</span>');
$('a.pp-custom-privacy-promo').click(function() {
$(this).hide().next('span').show();
return false;
});
});
/* ]]> */
</script>
<?php
}
if (!defined('PPS_VERSION') || !defined('PPCE_VERSION')) {
$need_exts = array();
if (!defined('PPCE_VERSION')) {
$need_exts[] = 'PP Collaborative Editing Pack';
}
if (!defined('PPS_VERSION')) {
$need_exts[] = 'PP Custom Post Statuses';
}
$need_exts = implode(' and ', $need_exts);
if (true == pp_key_status()) {
$msg = sprintf(__('To define custom moderation statuses, %1$sactivate%2$s %3$s.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', $need_exts);
} else {
$msg = sprintf(__('To define custom moderation statuses, %1$senter%2$s or %3$spurchase%4$s a Press Permit support key. Then install %5$s.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>', $need_exts);
}
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready( function($) {
$('a.edit-post-status').after('<a href="#" class="pp-custom-moderation-promo" style="margin-left:5px"><?php
_e('Customize', 'pp');
?>
</a><span class="pp-ext-promo" style="display:none;"><br /><?php
echo $msg;
?>
</span>');
$('a.pp-custom-moderation-promo').click(function() {
$(this).hide().next('span').show();
return false;
});
});
/* ]]> */
</script>
<?php
}
}
示例7: options_ui
//.........这里部分代码省略.........
<div class="pp-subtext" style="margin-top:10px">
<?php
if (pp_key_active()) {
_e('To customize bbPress forum permissions, activate PP Compatibility Pack.', 'pp');
} else {
_e('To customize bbPress forum permissions, activate your Press Permit Pro support key.', 'pp');
}
?>
</div>
<?php
}
?>
<?php
}
}
if (pp_wp_ver('3.5')) {
echo '<br /><div>';
$hint = __('If enabled, the create_posts, create_pages, etc. capabilities will be enforced for all Filtered Post Types. <strong>NOTE: You will also need to use a WordPress Role Editor</strong> such as Capability Manager Enhanced to add the create_posts capability to desired roles.', 'pp');
$ret = $ui->option_checkbox('define_create_posts_cap', $tab, $section, $hint, '');
echo '</div>';
}
}
?>
</td></tr>
<?php
}
// end foreach scope
$section = 'front_end';
// --- FRONT END SECTION ---
if (!empty($ui->form_options[$tab][$section])) {
?>
<tr><th scope="row"><?php
echo $ui->section_captions[$tab][$section];
?>
</th><td>
<?php
$hint = __('Remove the "Private:" and "Protected" prefix from Post, Page titles', 'pp');
$ui->option_checkbox('strip_private_caption', $tab, $section, $hint);
?>
</td></tr>
<?php
}
// any options accessable in this section
$section = 'admin';
// --- BACK END SECTION ---
if (!empty($ui->form_options[$tab][$section])) {
?>
<tr><th scope="row"><?php
echo $ui->section_captions[$tab][$section];
?>
</th><td>
<?php
$hint = 0 === validate_plugin("pp-collaborative-editing/pp-collaborative-editing.php") ? __('Note: pending further development, uneditable posts will always be hidden if the PP Collaborative Editing extension is active', 'pp') : '';
if (defined('PPCE_VERSION')) {
$args = array('val' => 1, 'disabled' => true, 'no_storage' => true);
}
$ui->option_checkbox('admin_hide_uneditable_posts', $tab, $section, $hint, '', $args);
?>
</td></tr>
<?php
}
// any options accessable in this section
$section = 'user_profile';
// --- USER PROFILE SECTION ---
if (!empty($ui->form_options[$tab][$section])) {
?>
<tr><th scope="row"><?php
echo $ui->section_captions[$tab][$section];
?>
</th><td>
<?php
$hint = '';
if (!defined('PP_MULTISITE')) {
$ui->option_checkbox('new_user_groups_ui', $tab, $section, $hint, '<br />');
}
$hint = __('note: Groups and Roles are always displayed in "Edit User"', 'pp');
$ui->option_checkbox('display_user_profile_groups', $tab, $section);
$ui->option_checkbox('display_user_profile_roles', $tab, $section, $hint);
?>
</td></tr>
<?php
}
// any options accessable in this section
$section = 'db_maint';
if (get_option('pp_need_group_index_drop')) {
?>
<tr><th scope="row"><?php
echo $ui->section_captions[$tab][$section];
?>
</th><td>
<?php
$hint = '';
$ui->option_checkbox('do_group_index_drop', $tab, $section, $hint, '<br />', array('no_storage' => true));
?>
</td></tr>
<?php
}
}
示例8: deactivate_plugins
deactivate_plugins($file, true);
}
update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated'));
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file={$file}&liveupdate=1&scrollto={$scrollto}&networkwide=" . $network_wide));
exit;
}
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&a=te&scrollto={$scrollto}"));
} else {
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&scrollto={$scrollto}"));
}
exit;
break;
default:
if (isset($_GET['liveupdate'])) {
check_admin_referer('edit-plugin-test_' . $file);
$error = validate_plugin($file);
if (is_wp_error($error)) {
wp_die($error);
}
if (!empty($_GET['networkwide']) && !is_plugin_active_for_network($file) || !is_plugin_active($file)) {
activate_plugin($file, "plugin-editor.php?file={$file}&phperror=1", !empty($_GET['networkwide']));
}
// we'll override this later if the plugin can be included without fatal error
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&a=te&scrollto={$scrollto}"));
exit;
}
// List of allowable extensions
$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
$editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
if (!is_file($real_file)) {
wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
示例9: validate_active_plugins
/**
* Validate active plugins
*
* Validate all active plugins, deactivates invalid and
* returns an array of deactivated ones.
*
* @since 2.5.0
* @return array invalid plugins, plugin as key, error as value
*/
function validate_active_plugins() {
$plugins = get_option( 'active_plugins', array() );
// Validate vartype: array.
if ( ! is_array( $plugins ) ) {
update_option( 'active_plugins', array() );
$plugins = array();
}
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
$network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
$plugins = array_merge( $plugins, array_keys( $network_plugins ) );
}
if ( empty( $plugins ) )
return array();
$invalid = array();
// Invalid plugins get deactivated.
foreach ( $plugins as $plugin ) {
$result = validate_plugin( $plugin );
if ( is_wp_error( $result ) ) {
$invalid[$plugin] = $result;
deactivate_plugins( $plugin, true );
}
}
return $invalid;
}
示例10: validate_active_plugins
function validate_active_plugins()
{
$check_plugins = get_option('active_plugins');
// Sanity check. If the active plugin list is not an array, make it an
// empty array.
if (!is_array($check_plugins)) {
update_option('active_plugins', array());
return;
}
//Invalid is any plugin that is deactivated due to error.
$invalid = array();
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ($check_plugins as $check_plugin) {
$result = validate_plugin($check_plugin);
if (is_wp_error($result)) {
$invalid[$check_plugin] = $result;
deactivate_plugins($check_plugin, true);
}
}
return $invalid;
}
示例11: display
//.........这里部分代码省略.........
<?php
if ('user' == $agent_type) {
$display_property = defined('PP_USER_RESULTS_DISPLAY_NAME') ? 'display_name' : 'user_login';
} else {
$display_property = 'display_name';
}
foreach ($current_selections as $agent) {
$attribs = isset($agent->display_name) && $agent->user_login != $agent->display_name ? 'title="' . esc_attr($agent->display_name) . '"' : '';
?>
<?php
$data = apply_filters('pp_agents_selection_ui_attribs', array('attribs' => $attribs, 'user_caption' => $agent->{$display_property}), $agent_type, $id_suffix, $agent);
?>
<option value="<?php
echo $agent->ID;
?>
" <?php
echo $data['attribs'];
?>
><?php
echo $data['user_caption'];
?>
</option>
<?php
}
?>
</select><br />
</td>
<?php
}
?>
</tr>
<?php
do_action('_pp_agents_selection_ui_select_pre', $id_suffix);
?>
<tr>
<?php
do_action('pp_agents_selection_ui_select_pre', $id_suffix);
?>
<td><button type="button" id="select_agents_<?php
echo $id_suffix;
?>
" class="pp_add" style="float:right<?php
if (!$multi_select) {
?>
;display:none;<?php
}
?>
"><?php
echo $label_select;
?>
</button></td>
<?php
if ($display_stored_selections) {
?>
<td class="pp-members-current"><button type="button" id="unselect_agents_<?php
echo $id_suffix;
?>
" class="pp_remove"><?php
echo $label_unselect;
?>
</button></td>
<?php
}
?>
</tr>
</table>
<?php
if (!defined('PPM_VERSION') && pp_get_option('display_extension_hints')) {
if (0 === validate_plugin("pp-membership/pp-membership.php")) {
$msg = __('To set date limits on group membership, activate the PP Membership plugin.', 'pp');
} elseif (true == pp_key_status()) {
$msg = sprintf(__('To set date limits on group membership, %1$sinstall%2$s the PP Membership plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
} else {
$msg = sprintf(__('To set date limits on group membership, %1$senter%2$s or %3$spurchase%4$s a support key and install the PP Membership plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>');
}
echo "<div class='pp-ext-promo'>{$msg}</div>";
}
$csv = $current_selections ? implode(',', array_keys($current_selections)) : '';
$csv = apply_filters('pp_agents_selection_ui_csv', $csv, $id_suffix, $current_selections);
?>
<input type="hidden" id="<?php
echo $id_suffix;
?>
_csv" name="<?php
echo $id_suffix;
?>
_csv" value="<?php
echo $csv;
?>
" />
<?php
}
示例12: check_upgrades
//.........这里部分代码省略.........
if ($name == 'core') {
$toupgrade['core']->disablelogin = $disablelogin;
return $toupgrade['core'];
}
if (!$installing && (empty($name) || $name == 'local')) {
$localversion = get_config('localversion');
$localrelease = get_config('localrelease');
if (is_null($localversion)) {
$localversion = 0;
$localrelease = 0;
}
$config = new StdClass();
require get_config('docroot') . 'local/version.php';
if ($config->version > $localversion) {
$toupgradecount++;
$toupgrade['local'] = (object) array('upgrade' => true, 'from' => $localversion, 'fromrelease' => $localrelease, 'to' => $config->version, 'torelease' => $config->release);
}
if ($name == 'local') {
$toupgrade['local']->disablelogin = $disablelogin;
return $toupgrade['local'];
}
}
$plugins = array();
if (!empty($name)) {
try {
$bits = explode('.', $name);
$pt = $bits[0];
$pn = $bits[1];
$pp = null;
if ($pt == 'blocktype' && strpos($pn, '/') !== false) {
$bits = explode('/', $pn);
$pp = get_config('docroot') . 'artefact/' . $bits[0] . '/blocktype/' . $bits[1];
}
validate_plugin($pt, $pn, $pp);
$plugins[] = explode('.', $name);
} catch (InstallationException $_e) {
log_warn("Plugin {$pt} {$pn} is not installable: " . $_e->GetMessage());
}
} else {
foreach ($pluginstocheck as $plugin) {
$dirhandle = opendir(get_config('docroot') . $plugin);
while (false !== ($dir = readdir($dirhandle))) {
if (strpos($dir, '.') === 0 or 'CVS' == $dir) {
continue;
}
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir)) {
continue;
}
try {
validate_plugin($plugin, $dir);
$plugins[] = array($plugin, $dir);
} catch (InstallationException $_e) {
log_warn("Plugin {$plugin} {$dir} is not installable: " . $_e->GetMessage());
}
if ($plugin == 'artefact') {
// go check it for blocks as well
$btlocation = get_config('docroot') . $plugin . '/' . $dir . '/blocktype';
if (!is_dir($btlocation)) {
continue;
}
$btdirhandle = opendir($btlocation);
while (false !== ($btdir = readdir($btdirhandle))) {
if (strpos($btdir, '.') === 0 or 'CVS' == $btdir) {
continue;
}
if (!is_dir(get_config('docroot') . $plugin . '/' . $dir . '/blocktype/' . $btdir)) {
示例13: update_option
update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated'));
} else {
update_site_option('recently_activated', array($file => time()) + (array) get_site_option('recently_activated'));
}
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file={$file}&plugin={$plugin}&liveupdate=1&scrollto={$scrollto}&networkwide=" . $network_wide));
exit;
}
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&plugin={$plugin}&a=te&scrollto={$scrollto}"));
} else {
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&plugin={$plugin}&scrollto={$scrollto}"));
}
exit;
} else {
if (isset($_GET['liveupdate'])) {
check_admin_referer('edit-plugin-test_' . $file);
$error = validate_plugin($plugin);
if (is_wp_error($error)) {
wp_die($error);
}
if (!empty($_GET['networkwide']) && !is_plugin_active_for_network($file) || !is_plugin_active($file)) {
activate_plugin($plugin, "plugin-editor.php?file={$file}&phperror=1", !empty($_GET['networkwide']));
}
// we'll override this later if the plugin can be included without fatal error
wp_redirect(self_admin_url("plugin-editor.php?file={$file}&plugin={$plugin}&a=te&scrollto={$scrollto}"));
exit;
}
// List of allowable extensions
$editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
/**
* Filters file type extensions editable in the plugin editor.
*
示例14: activate_plugin
function activate_plugin($plugin, $redirect = '') {
$current = get_option('active_plugins');
$plugin = trim($plugin);
$valid = validate_plugin($plugin);
if ( is_wp_error($valid) )
return $valid;
if ( !in_array($plugin, $current) ) {
if ( !empty($redirect) )
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
ob_start();
@include(ABSPATH . PLUGINDIR . '/' . $plugin);
$current[] = $plugin;
sort($current);
update_option('active_plugins', $current);
do_action('activate_' . $plugin);
ob_end_clean();
}
return null;
}
示例15: resetwp
/**
* reset wp learn from plugin wordpress-reset
* @param $args
* @param $assoc_args
*/
public function resetwp($args, $assoc_args)
{
global $current_user, $user_id;
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
$blogname = get_option('blogname');
$admin_email = get_option('admin_email');
$blog_public = get_option('blog_public');
if ($current_user->user_login != 'admin') {
$user = get_user_by('login', 'admin');
}
if (empty($user->user_level) || $user->user_level < 10) {
$user = $current_user;
}
global $wpdb, $reactivate_wp_reset_additional;
$prefix = str_replace('_', '\\_', $wpdb->prefix);
$tables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}%'");
foreach ($tables as $table) {
$wpdb->query("DROP TABLE {$table}");
}
$result = wp_install($blogname, $user->user_login, $user->user_email, $blog_public);
extract($result, EXTR_SKIP);
$query = $wpdb->prepare("UPDATE {$wpdb->users} SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $user->user_pass, $user_id);
$wpdb->query($query);
$get_user_meta = function_exists('get_user_meta') ? 'get_user_meta' : 'get_usermeta';
$update_user_meta = function_exists('update_user_meta') ? 'update_user_meta' : 'update_usermeta';
if ($get_user_meta($user_id, 'default_password_nag')) {
$update_user_meta($user_id, 'default_password_nag', false);
}
if ($get_user_meta($user_id, $wpdb->prefix . 'default_password_nag')) {
$update_user_meta($user_id, $wpdb->prefix . 'default_password_nag', false);
}
if (defined('REACTIVATE_WP_RESET') && REACTIVATE_WP_RESET === true) {
@activate_plugin(plugin_basename(__FILE__));
}
if (!empty($reactivate_wp_reset_additional)) {
foreach ($reactivate_wp_reset_additional as $plugin) {
$plugin = plugin_basename($plugin);
if (!is_wp_error(validate_plugin($plugin))) {
@activate_plugin($plugin);
}
}
}
wp_clear_auth_cookie();
wp_set_auth_cookie($user_id);
wp_redirect(admin_url() . '?reset');
//exit();
$this->result('Reset WP successful.');
}