本文整理汇总了PHP中MainWP_Utility::mapSite方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::mapSite方法的具体用法?PHP MainWP_Utility::mapSite怎么用?PHP MainWP_Utility::mapSite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::mapSite方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hookGetDBSites
public static function hookGetDBSites($pluginFile, $key, $sites, $groups, $options = false)
{
if (!self::hookVerify($pluginFile, $key)) {
return false;
}
$dbwebsites = array();
$data = array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey', 'verify_certificate', 'ssl_version');
if (is_array($options)) {
foreach ($options as $option_name => $value) {
if ($value === true && isset(self::$possible_options[$option_name])) {
$data[] = self::$possible_options[$option_name];
}
}
}
if ($sites != '') {
foreach ($sites as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$website = MainWP_DB::Instance()->getWebsiteById($v);
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, $data);
}
}
}
if ($groups != '') {
foreach ($groups as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($v));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, $data);
}
@MainWP_DB::free_result($websites);
}
}
}
return $dbwebsites;
}
示例2: getTerms
public static function getTerms($websiteid, $prefix = '', $what = 'site', $gen_type = 'post')
{
$output = new stdClass();
$output->errors = array();
$output->cats = array();
$dbwebsites = array();
if ($what == 'group') {
$input_name = 'groups_selected_cats_' . $prefix . '[]';
} else {
$input_name = 'sites_selected_cats_' . $prefix . '[]';
}
if (!empty($websiteid)) {
if (MainWP_Utility::ctype_digit($websiteid)) {
$website = MainWP_DB::Instance()->getWebsiteById($websiteid);
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
}
if ($gen_type == 'post') {
$bkc_option_path = 'default_keywords_post';
$keyword_option = 'keywords_page';
} else {
if ($gen_type == 'page') {
$bkc_option_path = 'default_keywords_page';
$keyword_option = 'keywords_page';
}
}
if ($prefix == 'bulk') {
$opt = apply_filters('mainwp-get-options', $value = '', 'mainwp_content_extension', 'bulk_keyword_cats', $bkc_option_path);
$selected_cats = unserialize(base64_decode($opt));
} else {
$opt = apply_filters('mainwp-get-options', $value = '', 'mainwp_content_extension', $keyword_option);
if (is_array($opt) && is_array($opt[$prefix])) {
$selected_cats = unserialize(base64_decode($opt[$prefix]['selected_cats']));
}
}
$selected_cats = is_array($selected_cats) ? $selected_cats : array();
$ret = '';
if (count($dbwebsites) > 0) {
$opt = apply_filters('mainwp-get-options', $value = '', 'mainwp_content_extension', 'taxonomy');
$post_data = array('taxonomy' => base64_encode($opt));
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'get_terms', $post_data, array(MainWP_Post::getClassName(), 'PostsGetTerms_handler'), $output);
foreach ($dbwebsites as $siteid => $website) {
$cats = array();
if (is_array($selected_cats[$siteid])) {
foreach ($selected_cats[$siteid] as $val) {
$cats[] = $val['term_id'];
}
}
if (!empty($output->errors[$siteid])) {
$ret .= '<p> ' . __('Error - ', 'mainwp') . $output->errors[$siteid] . '</p>';
} else {
if (count($output->cats[$siteid]) > 0) {
foreach ($output->cats[$siteid] as $cat) {
if ($cat->term_id) {
if (in_array($cat->term_id, $cats)) {
$checked = ' checked="checked" ';
} else {
$checked = '';
}
$ret .= '<div class="mainwp_selected_sites_item ' . (!empty($checked) ? 'selected_sites_item_checked' : '') . '"><input type="checkbox" name="' . $input_name . '" value="' . $siteid . ',' . $cat->term_id . ',' . stripslashes($cat->name) . '" ' . $checked . '/><label>' . $cat->name . '</label></div>';
}
}
} else {
$ret .= '<p>No categories have been found</p>';
}
}
}
} else {
$ret .= '<p>' . __('Error - ', 'mainwp') . ' no site</p>';
}
echo $ret;
}
示例3: renderAllThemesTable
public static function renderAllThemesTable($output = null)
{
$keyword = null;
$search_status = 'all';
if ($output == null) {
$keyword = isset($_POST['keyword']) && !empty($_POST['keyword']) ? trim($_POST['keyword']) : null;
$search_status = isset($_POST['status']) ? $_POST['status'] : 'all';
$search_theme_status = isset($_POST['theme_status']) ? $_POST['theme_status'] : 'all';
$output = new stdClass();
$output->errors = array();
$output->themes = array();
if (get_option('mainwp_optimize') == 1) {
//Fetch all!
//Build websites array
//Search in local cache
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
$allThemes = json_decode($website->themes, true);
for ($i = 0; $i < count($allThemes); $i++) {
$theme = $allThemes[$i];
if ($search_theme_status != 'all') {
if ($theme['active'] == 1 && $search_theme_status !== 'active') {
continue;
} else {
if ($theme['active'] != 1 && $search_theme_status !== 'inactive') {
continue;
}
}
}
if ($keyword != '' && stristr($theme['name'], $keyword) === false) {
continue;
}
$theme['websiteid'] = $website->id;
$theme['websiteurl'] = $website->url;
$output->themes[] = $theme;
}
}
@MainWP_DB::free_result($websites);
} else {
//Fetch all!
//Build websites array
$dbwebsites = array();
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
@MainWP_DB::free_result($websites);
$post_data = array('keyword' => $keyword);
if ($search_theme_status == 'active' || $search_theme_status == 'inactive') {
$post_data['status'] = $search_theme_status;
$post_data['filter'] = true;
} else {
$post_data['status'] = '';
$post_data['filter'] = false;
}
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'get_all_themes', $post_data, array(MainWP_Themes::getClassName(), 'ThemesSearch_handler'), $output);
if (count($output->errors) > 0) {
foreach ($output->errors as $siteid => $error) {
echo '<strong>Error on ' . MainWP_Utility::getNiceURL($dbwebsites[$siteid]->url) . ': ' . $error . ' <br /></strong>';
}
echo '<br />';
}
if (count($output->errors) == count($dbwebsites)) {
session_start();
$_SESSION['SNThemesAll'] = $output;
return;
}
}
if (session_id() == '') {
session_start();
}
$_SESSION['SNThemesAll'] = $output;
$_SESSION['SNThemesAllStatus'] = array('keyword' => $keyword, 'status' => $search_status, 'theme_status' => $search_theme_status);
} else {
if (isset($_SESSION['SNThemesAllStatus'])) {
$keyword = $_SESSION['SNThemesAllStatus']['keyword'];
$search_status = $_SESSION['SNThemesAllStatus']['status'];
$search_theme_status = $_SESSION['SNThemesAllStatus']['theme_status'];
}
}
if (count($output->themes) == 0) {
?>
No themes found
<?php
return;
}
?>
<div class="alignleft">
<select name="bulk_action" id="mainwp_bulk_action">
<option value="none"><?php
_e('Choose Action', 'mainwp');
?>
</option>
<option value="trust"><?php
_e('Trust', 'mainwp');
?>
</option>
<option value="untrust"><?php
_e('Untrust', 'mainwp');
?>
//.........这里部分代码省略.........
示例4: renderTable
public static function renderTable($keyword, $status, $groups, $sites)
{
MainWP_Cache::initCache('Plugins');
$output = new stdClass();
$output->errors = array();
$output->plugins = array();
if (get_option('mainwp_optimize') == 1) {
if ($sites != '') {
foreach ($sites as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$website = MainWP_DB::Instance()->getWebsiteById($v);
$allPlugins = json_decode($website->plugins, true);
for ($i = 0; $i < count($allPlugins); $i++) {
$plugin = $allPlugins[$i];
if ($status == 'active' || $status == 'inactive') {
if ($plugin['active'] != ($status == 'active' ? 1 : 0)) {
continue;
}
}
if ($keyword != '' && !stristr($plugin['name'], $keyword)) {
continue;
}
$plugin['websiteid'] = $website->id;
$plugin['websiteurl'] = $website->url;
$output->plugins[] = $plugin;
}
}
}
}
if ($groups != '') {
//Search in local cache
foreach ($groups as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($v));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$allPlugins = json_decode($website->plugins, true);
for ($i = 0; $i < count($allPlugins); $i++) {
$plugin = $allPlugins[$i];
if ($status == 'active' || $status == 'inactive') {
if ($plugin['active'] != ($status == 'active' ? 1 : 0)) {
continue;
}
}
if ($keyword != '' && !stristr($plugin['name'], $keyword)) {
continue;
}
$plugin['websiteid'] = $website->id;
$plugin['websiteurl'] = $website->url;
$output->plugins[] = $plugin;
}
}
@MainWP_DB::free_result($websites);
}
}
}
} else {
//Fetch all!
//Build websites array
$dbwebsites = array();
if ($sites != '') {
foreach ($sites as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$website = MainWP_DB::Instance()->getWebsiteById($v);
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
}
}
if ($groups != '') {
foreach ($groups as $k => $v) {
if (MainWP_Utility::ctype_digit($v)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($v));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
@MainWP_DB::free_result($websites);
}
}
}
$post_data = array('keyword' => $keyword);
if ($status == 'active' || $status == 'inactive') {
$post_data['status'] = $status;
$post_data['filter'] = true;
} else {
$post_data['status'] = '';
$post_data['filter'] = false;
}
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'get_all_plugins', $post_data, array(MainWP_Plugins::getClassName(), 'PluginsSearch_handler'), $output);
if (count($output->errors) > 0) {
foreach ($output->errors as $siteid => $error) {
echo '<strong>Error on ' . MainWP_Utility::getNiceURL($dbwebsites[$siteid]->url) . ': ' . $error . ' <br /></strong>';
}
echo '<br />';
}
if (count($output->errors) == count($dbwebsites)) {
//.........这里部分代码省略.........
示例5: doImport
public static function doImport()
{
if (isset($_POST['select_by'])) {
$selected_sites = array();
if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
foreach ($_POST['selected_sites'] as $selected) {
$selected_sites[] = $selected;
}
}
$selected_groups = array();
if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
foreach ($_POST['selected_groups'] as $selected) {
$selected_groups[] = $selected;
}
}
}
$user_to_add = array('user_pass' => $_POST['pass1'], 'user_login' => $_POST['user_login'], 'user_url' => $_POST['url'], 'user_email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'role' => $_POST['role']);
$ret = array();
$dbwebsites = array();
$not_valid = array();
$error_sites = '';
if ($_POST['select_by'] == 'site') {
//Get all selected websites
foreach ($selected_sites as $url) {
if (!empty($url)) {
$website = MainWP_DB::Instance()->getWebsitesByUrl($url);
if ($website) {
$dbwebsites[$website[0]->id] = MainWP_Utility::mapSite($website[0], array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
} else {
$not_valid[] = __("Error - The website doesn't exist in the Network.", 'mainwp') . " " . $url;
$error_sites .= $url . ';';
}
}
}
} else {
//Get all websites from the selected groups
foreach ($selected_groups as $group) {
if (MainWP_DB::Instance()->getGroupsByName($group)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupName($group));
if ($websites) {
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
@MainWP_DB::free_result($websites);
} else {
$not_valid[] = __('Error - These are not websites in the group. ', 'mainwp') . $group;
$error_sites .= $group . ';';
}
} else {
$not_valid[] = __("Error - The group doesn't exist in the Network. ", 'mainwp') . $group;
$error_sites .= $group . ';';
}
}
}
if (count($dbwebsites) > 0) {
$post_data = array('new_user' => base64_encode(serialize($user_to_add)), 'send_password' => isset($_POST['send_password']) ? $_POST['send_password'] : '');
$output = new stdClass();
$output->ok = array();
$output->errors = array();
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newuser', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
}
$ret['ok_list'] = $ret['error_list'] = array();
foreach ($dbwebsites as $website) {
if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
$ret['ok_list'][] = 'New user(s) created: ' . stripslashes($website->name);
} else {
$ret['error_list'][] = $output->errors[$website->id] . ' ' . stripslashes($website->name);
$error_sites .= $website->url . ';';
}
}
foreach ($not_valid as $val) {
$ret['error_list'][] = $val;
}
$ret['failed_logging'] = '';
if (!empty($error_sites)) {
$error_sites = rtrim($error_sites, ';');
$ret['failed_logging'] = $_POST['user_login'] . ',' . $_POST['email'] . ',' . $_POST['first_name'] . ',' . $_POST['last_name'] . ',' . $_POST['url'] . ',' . $_POST['pass1'] . ',' . intval($_POST['send_password']) . ',' . $_POST['role'] . ',' . $error_sites . ',';
}
$ret['line_number'] = $_POST['line_number'];
die(json_encode($ret));
}
示例6: prepareUpload
public static function prepareUpload()
{
include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
$output = array();
$output['sites'] = array();
if ($_POST['selected_by'] == 'site') {
//Get sites
foreach ($_POST['selected_sites'] as $enc_id) {
$websiteid = $enc_id;
if (MainWP_Utility::ctype_digit($websiteid)) {
$website = MainWP_DB::Instance()->getWebsiteById($websiteid);
$output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
}
}
} else {
//Get sites from group
foreach ($_POST['selected_groups'] as $enc_id) {
$groupid = $enc_id;
if (MainWP_Utility::ctype_digit($groupid)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($groupid));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
}
@MainWP_DB::free_result($websites);
}
}
}
$output['urls'] = array();
foreach ($_POST['files'] as $file) {
$output['urls'][] = MainWP_Utility::getDownloadUrl('bulk', $file);
}
$output['urls'] = implode('||', $output['urls']);
$output['urls'] = apply_filters('mainwp_installbulk_prepareupload', $output['urls']);
die(json_encode($output));
}
示例7: posting
public static function posting()
{
?>
<div class="wrap">
<?php
// Use this to add a new page. To bulk change pages click on the "Manage" tab.
do_action('mainwp_bulkpage_before_post', $_GET['id']);
$skip_post = false;
if (isset($_GET['id'])) {
if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) {
$skip_post = true;
wp_delete_post($_GET['id'], true);
}
}
if (!$skip_post) {
//Posts the saved sites
if (isset($_GET['id'])) {
$id = $_GET['id'];
$post = get_post($id);
if ($post) {
$selected_by = get_post_meta($id, '_selected_by', true);
$selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true)));
$selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true)));
$post_slug = base64_decode(get_post_meta($id, '_slug', true));
$post_custom = get_post_custom($id);
include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
$post_featured_image = get_post_thumbnail_id($id);
$mainwp_upload_dir = wp_upload_dir();
$new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_type' => 'page', 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID);
if ($post_featured_image != null) {
//Featured image is set, retrieve URL
$img = wp_get_attachment_image_src($post_featured_image, 'full');
$post_featured_image = $img[0];
}
$dbwebsites = array();
if ($selected_by == 'site') {
//Get all selected websites
foreach ($selected_sites as $k) {
if (MainWP_Utility::ctype_digit($k)) {
$website = MainWP_DB::Instance()->getWebsiteById($k);
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
}
} else {
//Get all websites from the selected groups
foreach ($selected_groups as $k) {
if (MainWP_Utility::ctype_digit($k)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
@MainWP_DB::free_result($websites);
}
}
}
$output = new stdClass();
$output->ok = array();
$output->errors = array();
$startTime = time();
if (count($dbwebsites) > 0) {
$post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
$post_data = apply_filters('mainwp_bulkpage_posting', $post_data, $id);
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
}
$failed_posts = array();
foreach ($dbwebsites as $website) {
if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) {
do_action('mainwp-post-posting-page', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null);
do_action('mainwp-bulkposting-done', $post, $website, $output);
} else {
$failed_posts[] = $website->id;
}
}
$del_post = true;
$saved_draft = get_post_meta($id, '_saved_as_draft', true);
if ($saved_draft == 'yes') {
if (count($failed_posts) > 0) {
$del_post = false;
update_post_meta($post->ID, '_selected_sites', base64_encode(serialize($failed_posts)));
update_post_meta($post->ID, '_selected_groups', '');
wp_update_post(array('ID' => $id, 'post_status' => 'draft'));
}
}
if ($del_post) {
wp_delete_post($id, true);
}
$countSites = 0;
$countRealItems = 0;
foreach ($dbwebsites as $website) {
if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
$countSites++;
$countRealItems++;
}
}
if (!empty($countSites)) {
$seconds = time() - $startTime;
MainWP_Twitter::updateTwitterInfo('new_page', $countSites, $seconds, $countRealItems, $startTime, 1);
//.........这里部分代码省略.........
示例8: render
public static function render()
{
$show_form = true;
if (isset($_POST['updateadminpassword'])) {
check_admin_referer('mainwp_updateadminpassword', 'security');
$errors = array();
if (isset($_POST['select_by'])) {
$selected_sites = array();
if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
foreach ($_POST['selected_sites'] as $selected) {
$selected_sites[] = $selected;
}
}
$selected_groups = array();
if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
foreach ($_POST['selected_groups'] as $selected) {
$selected_groups[] = $selected;
}
}
if ($_POST['select_by'] == 'group' && count($selected_groups) == 0 || $_POST['select_by'] == 'site' && count($selected_sites) == 0) {
$errors[] = __('Please select the sites or groups where you want to change the admin password.', 'mainwp');
}
} else {
$errors[] = __('Please select whether you want to change the admin password for specific sites or groups.', 'mainwp');
}
if (!isset($_POST['pass1']) || $_POST['pass1'] == '' || !isset($_POST['pass2']) || $_POST['pass2'] == '') {
$errors[] = __('Please enter the password twice.', 'mainwp');
} else {
if ($_POST['pass1'] != $_POST['pass2']) {
$errors[] = __('Please enter the same password in the two password fields.', 'mainwp');
}
}
if (count($errors) == 0) {
$show_form = false;
$new_password = array('user_pass' => $_POST['pass1']);
$dbwebsites = array();
if ($_POST['select_by'] == 'site') {
//Get all selected websites
foreach ($selected_sites as $k) {
if (MainWP_Utility::ctype_digit($k)) {
$website = MainWP_DB::Instance()->getWebsiteById($k);
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
}
} else {
//Get all websites from the selected groups
foreach ($selected_groups as $k) {
if (MainWP_Utility::ctype_digit($k)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
}
@MainWP_DB::free_result($websites);
}
}
}
if (count($dbwebsites) > 0) {
$post_data = array('new_password' => base64_encode(serialize($new_password)));
$output = new stdClass();
$output->ok = array();
$output->errors = array();
MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
}
}
}
if (!$show_form) {
//Added to..
?>
<div class="wrap">
<h2 id="add-new-user"><i class="fa fa-key"></i> Update Admin Passwords</h2>
<div id="message" class="updated">
<?php
foreach ($dbwebsites as $website) {
?>
<p>
<a href="<?php
echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
?>
"><?php
echo stripslashes($website->name);
?>
</a>: <?php
echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? __('Admin password updated.', 'mainwp') : __('ERROR: ', 'mainwp') . $output->errors[$website->id];
?>
</p>
<?php
}
?>
</div>
<br/>
<a href="<?php
echo get_admin_url();
?>
admin.php?page=UpdateAdminPasswords" class="add-new-h2" target="_top"><?php
_e('Update admin passwords', 'mainwp');
?>
//.........这里部分代码省略.........