本文整理汇总了PHP中MainWP_DB类的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_DB类的具体用法?PHP MainWP_DB怎么用?PHP MainWP_DB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainWP_DB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
public static function render()
{
$current_wpid = MainWP_Utility::get_current_wpid();
if (!MainWP_Utility::ctype_digit($current_wpid)) {
return;
}
$website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true);
?>
<div id="mainwp-notes-area">
<div id="mainwp-notes-note" style="padding-bottom: 1em;">
<?php
if ($website->note == '') {
echo 'No Saved Notes';
} else {
echo $website->note;
}
?>
</div>
<div style="text-align: center; border-top: 1px Solid #f4f4f4; padding-top: 1em;">
<a href="#" class="mainwp_notes_show_all button button-primary" id="mainwp_notes_<?php
echo $website->id;
?>
"><?php
_e('Edit Notes', 'mainwp');
?>
</a>
</div>
</div>
<?php
}
开发者ID:senlin,项目名称:mainwp,代码行数:30,代码来源:widget-mainwp-notes.php
示例2: sync
public function sync($args, $assoc_args)
{
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
WP_CLI::line('Syncing ' . MainWP_DB::num_rows($websites) . ' sites');
$warnings = 0;
$errors = 0;
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
WP_CLI::line(' -> ' . $website->name . ' (' . $website->url . ')');
try {
if (MainWP_Sync::syncSite($website)) {
WP_CLI::success(' Sync succeeded');
} else {
WP_CLI::warning(' Sync failed');
$warnings++;
}
} catch (Exception $e) {
WP_CLI::error(' Sync failed');
$errors++;
}
}
@MainWP_DB::free_result($websites);
if ($errors > 0) {
WP_CLI::error('Sync completed with errors');
} else {
if ($warnings > 0) {
WP_CLI::warning('Sync completed with warnings');
} else {
WP_CLI::success('Sync completed');
}
}
}
开发者ID:jexmex,项目名称:mainwp,代码行数:31,代码来源:class-mainwp-wp-cli-command.php
示例3: handleSettingsPost
public static function handleSettingsPost()
{
if (isset($_POST['submit'])) {
$userExtension = MainWP_DB::Instance()->getUserExtension();
$userExtension->heatMap = !isset($_POST['mainwp_options_footprint_heatmap']) ? 1 : 0;
$userExtension->pluginDir = !isset($_POST['mainwp_options_footprint_plugin_folder']) ? 'default' : 'hidden';
MainWP_DB::Instance()->updateUserExtension($userExtension);
return true;
}
return false;
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:11,代码来源:widget-mainwp-footprint.php
示例4: addSite
public static function addSite($website)
{
$error = '';
$message = '';
if ($website) {
$error = __('Your site is already added to MainWP', 'mainwp');
} else {
try {
//Add
if (function_exists('openssl_pkey_new')) {
$conf = array('private_key_bits' => 384);
$conf_loc = MainWP_System::get_openssl_conf();
if (!empty($conf_loc)) {
$conf['config'] = $conf_loc;
}
$res = openssl_pkey_new($conf);
@openssl_pkey_export($res, $privkey, null, $conf);
$pubkey = openssl_pkey_get_details($res);
$pubkey = $pubkey['key'];
} else {
$privkey = '-1';
$pubkey = '-1';
}
$url = $_POST['managesites_add_wpurl'];
$pluginConflicts = get_option('mainwp_pluginConflicts');
if ($pluginConflicts !== false) {
$pluginConflicts = array_keys($pluginConflicts);
}
$themeConflicts = get_option('mainwp_themeConflicts');
if ($themeConflicts !== false) {
$themeConflicts = array_keys($themeConflicts);
}
// to fix bug
if (is_array($pluginConflicts)) {
$pluginConflicts = array_filter($pluginConflicts);
}
if (is_array($themeConflicts)) {
$themeConflicts = array_filter($themeConflicts);
}
$verifyCertificate = !isset($_POST['verify_certificate']) || empty($_POST['verify_certificate']) ? null : $_POST['verify_certificate'];
$sslVersion = MainWP_Utility::getCURLSSLVersion(!isset($_POST['ssl_version']) || empty($_POST['ssl_version']) ? null : $_POST['ssl_version']);
$addUniqueId = isset($_POST['managesites_add_uniqueId']) ? $_POST['managesites_add_uniqueId'] : '';
$http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : '';
$http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : '';
$information = MainWP_Utility::fetchUrlNotAuthed($url, $_POST['managesites_add_wpadmin'], 'register', array('pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $addUniqueId, 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts)), false, $verifyCertificate, $http_user, $http_pass, $sslVersion);
if (isset($information['error']) && $information['error'] != '') {
$error = $information['error'];
} else {
if (isset($information['register']) && $information['register'] == 'OK') {
//Add website to database
$groupids = array();
$groupnames = array();
if (isset($_POST['groupids'])) {
foreach ($_POST['groupids'] as $group) {
$groupids[] = $group;
}
}
if (isset($_POST['groupnames']) && $_POST['groupnames'] != '' || isset($_POST['groupnames_import']) && $_POST['groupnames_import'] != '') {
if ($_POST['groupnames']) {
$tmpArr = explode(',', $_POST['groupnames']);
} else {
if ($_POST['groupnames_import']) {
$tmpArr = explode(';', $_POST['groupnames_import']);
}
}
foreach ($tmpArr as $tmp) {
$group = MainWP_DB::Instance()->getGroupByNameForUser(trim($tmp));
if ($group) {
if (!in_array($group->id, $groupids)) {
$groupids[] = $group->id;
}
} else {
$groupnames[] = trim($tmp);
}
}
}
if (!isset($information['uniqueId']) || empty($information['uniqueId'])) {
$addUniqueId = '';
}
$http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : '';
$http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : '';
global $current_user;
$id = MainWP_DB::Instance()->addWebsite($current_user->ID, $_POST['managesites_add_wpname'], $_POST['managesites_add_wpurl'], $_POST['managesites_add_wpadmin'], base64_encode($pubkey), base64_encode($privkey), $information['nossl'], isset($information['nosslkey']) ? $information['nosslkey'] : null, $groupids, $groupnames, $verifyCertificate, $addUniqueId, $http_user, $http_pass, $sslVersion);
$message = sprintf(__('Site successfully added - Visit the Site\'s %sDashboard%s now.', 'mainwp'), '<a href="admin.php?page=managesites&dashboard=' . $id . '" style="text-decoration: none;" title="' . __('Dashboard', 'mainwp') . '">', '</a>');
$website = MainWP_DB::Instance()->getWebsiteById($id);
MainWP_Sync::syncInformationArray($website, $information);
} else {
$error = __('Undefined error.', 'mainwp');
}
}
} catch (MainWP_Exception $e) {
if ($e->getMessage() == 'HTTPERROR') {
$error = 'HTTP error' . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : '');
} else {
if ($e->getMessage() == 'NOMAINWP') {
$error = __('No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue please ', 'mainwp');
if ($e->getMessageExtra() != null) {
$error .= sprintf(__('test your connection %shere%s or ', 'mainwp'), '<a href="' . admin_url('admin.php?page=managesites&do=test&site=' . urlencode($e->getMessageExtra())) . '">', '</a>');
}
$error .= sprintf(__('post as much information as possible on the error in the %ssupport forum%s.', 'mainwp'), '<a href="https://mainwp.com/forum/">', '</a>');
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:view-mainwp-manage-sites-view.php
示例5: mainwp_force_destroy_sessions
function mainwp_force_destroy_sessions()
{
$this->secure_request('mainwp_force_destroy_sessions');
$website_id = isset($_POST['website_id']) ? (int) $_POST['website_id'] : 0;
if (!MainWP_DB::Instance()->getWebsiteById($website_id)) {
die(json_encode(array('error' => array('message' => __('This website does not exist', 'mainwp')))));
}
$website = MainWP_DB::Instance()->getWebsiteById($website_id);
if (!MainWP_Utility::can_edit_website($website)) {
die(json_encode(array('error' => array('message' => __('You cannot edit this website', 'mainwp')))));
}
try {
$information = MainWP_Utility::fetchUrlAuthed($website, 'settings_tools', array('action' => 'force_destroy_sessions'));
global $mainWP;
if ($mainWP->getVersion() == '2.0.22' || $mainWP->getVersion() == '2.0.23') {
if (get_option('mainwp_fixed_security_2022') != 1) {
update_option('mainwp_fixed_security_2022', 1);
}
}
} catch (Exception $e) {
$information = array('error' => __('fetchUrlAuthed exception', 'mainwp'));
}
die(json_encode($information));
}
开发者ID:jexmex,项目名称:mainwp,代码行数:24,代码来源:class-mainwp-post-handler.php
示例6: action
public static function action($pAction)
{
$plugin = $_POST['plugin'];
$websiteIdEnc = $_POST['websiteId'];
if (empty($plugin)) {
die(json_encode(array('error' => 'Invalid Request.')));
}
$websiteId = $websiteIdEnc;
if (!MainWP_Utility::ctype_digit($websiteId)) {
die(json_encode(array('error' => 'Invalid Request.')));
}
$website = MainWP_DB::Instance()->getWebsiteById($websiteId);
if (!MainWP_Utility::can_edit_website($website)) {
die(json_encode(array('error' => 'You can not edit this website.')));
}
try {
$information = MainWP_Utility::fetchUrlAuthed($website, 'plugin_action', array('action' => $pAction, 'plugin' => $plugin));
} catch (MainWP_Exception $e) {
die(json_encode(array('error' => $e->getMessage())));
}
if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
die(json_encode(array('error' => 'Unexpected error.')));
}
}
开发者ID:senlin,项目名称:mainwp,代码行数:24,代码来源:widget-mainwp-widget-plugins.php
示例7: renderMetabox
public static function renderMetabox()
{
$website = MainWP_Utility::get_current_wpid();
if (!$website) {
return;
}
$website = MainWP_DB::Instance()->getWebsiteById($website);
MainWP_Manage_Sites::showBackups($website);
?>
<?php
if (mainwp_current_user_can('dashboard', 'execute_backups')) {
?>
<hr/>
<div style="text-align: center;">
<a href="<?php
echo admin_url('admin.php?page=managesites&backupid=' . $website->id);
?>
" class="button-primary"><?php
_e('Backup Now', 'mainwp');
?>
</a>
</div>
<?php
}
?>
<?php
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:27,代码来源:page-mainwp-manage-backups.php
示例8: mwp_setup_notification_save
public function mwp_setup_notification_save()
{
check_admin_referer('mwp-setup');
$important_notification = !isset($_POST['mwp_setup_options_important_notification']) ? 0 : 1;
update_option('mwp_setup_importantNotification', $important_notification);
MainWP_Utility::update_option('mainwp_notificationOnBackupFail', $important_notification);
MainWP_Utility::update_option('mainwp_automaticDailyUpdate', $important_notification ? 2 : 0);
$userExtension = MainWP_DB::Instance()->getUserExtension();
$userExtension->offlineChecksOnlineNotification = $important_notification;
$userExtension->user_email = isset($_POST['mwp_setup_options_email']) && !empty($_POST['mwp_setup_options_email']) ? $_POST['mwp_setup_options_email'] : "";
MainWP_DB::Instance()->updateUserExtension($userExtension);
wp_redirect($this->get_next_step_link());
exit;
}
开发者ID:reeslo,项目名称:mainwp,代码行数:14,代码来源:page-mainwp-setup-wizard.php
示例9: hookGetGroups
/**
* @param string $pluginFile Extension plugin file to verify
* @param string $key The child-key
* @param int $groupid The id of the group you wish to retrieve
* @param bool $for_manager
*
* @return array|bool An array of arrays, the inner-array contains the id/name/array of site ids for the supplied groupid/all groups. False when something goes wrong.
*/
public static function hookGetGroups($pluginFile, $key, $groupid, $for_manager = false)
{
if (!self::hookVerify($pluginFile, $key)) {
return false;
}
if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) {
return false;
}
if (isset($groupid)) {
$group = MainWP_DB::Instance()->getGroupById($groupid);
if (!MainWP_Utility::can_edit_group($group)) {
return false;
}
$websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
$websitesOut = array();
foreach ($websites as $website) {
$websitesOut[] = $website->id;
}
return array(array('id' => $groupid, 'name' => $group->name, 'websites' => $websitesOut));
}
$groups = MainWP_DB::Instance()->getGroupsAndCount(null, $for_manager);
$output = array();
foreach ($groups as $group) {
$websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
$websitesOut = array();
foreach ($websites as $website) {
if (in_array($website->id, $websitesOut)) {
continue;
}
$websitesOut[] = $website->id;
}
$output[] = array('id' => $group->id, 'name' => $group->name, 'websites' => $websitesOut);
}
return $output;
}
开发者ID:jexmex,项目名称:mainwp,代码行数:43,代码来源:page-mainwp-extensions.php
示例10: display_rows
function display_rows()
{
foreach ($this->items as $item) {
$sites = $item->sites == '' ? array() : explode(',', $item->sites);
$groups = $item->groups == '' ? array() : explode(',', $item->groups);
foreach ($groups as $group) {
$websites = MainWP_DB::Instance()->getWebsitesByGroupId($group);
if ($websites == null) {
continue;
}
foreach ($websites as $website) {
if (!in_array($website->id, $sites)) {
$sites[] = $website->id;
}
}
}
$item->the_sites = $sites;
$this->single_row($item);
}
}
开发者ID:jexmex,项目名称:mainwp,代码行数:20,代码来源:table-mainwp-manage-backups-list-table.php
示例11: update
function update()
{
MainWP_DB::Instance()->update();
MainWP_DB::Instance()->install();
}
开发者ID:reeslo,项目名称:mainwp,代码行数:5,代码来源:class-mainwp-system.php
示例12: renderSites
public static function renderSites($renew, $pExit = true)
{
$current_wpid = MainWP_Utility::get_current_wpid();
if ($current_wpid) {
$sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
} else {
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
}
$websites = MainWP_DB::Instance()->query($sql);
$allPages = array();
if ($websites) {
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->recent_pages == '') {
continue;
}
$pages = json_decode($website->recent_pages, 1);
if (count($pages) == 0) {
continue;
}
foreach ($pages as $page) {
$page['website'] = (object) array('id' => $website->id, 'url' => $website->url);
$allPages[] = $page;
}
}
@MainWP_DB::free_result($websites);
}
$recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish');
$recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc');
$recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft');
$recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc');
$recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending');
$recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc');
$recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash');
$recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc');
?>
<div class="clear">
<a href="<?php
echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all'));
?>
" class="button-primary" style="float: right"><?php
_e('Add New', 'mainwp');
?>
</a>
<a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php
_e('Published', 'mainwp');
?>
(<?php
echo count($recent_pages_published);
?>
)</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php
_e('Draft', 'mainwp');
?>
(<?php
echo count($recent_pages_draft);
?>
)</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php
_e('Pending', 'mainwp');
?>
(<?php
echo count($recent_pages_pending);
?>
)</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php
_e('Trash', 'mainwp');
?>
(<?php
echo count($recent_pages_trash);
?>
)</a><br/><br/>
<div class="recent_posts_published">
<?php
for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) {
if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') {
$recent_pages_published[$i]['title'] = '(No Title)';
}
if (isset($recent_pages_published[$i]['dts'])) {
if (!stristr($recent_pages_published[$i]['dts'], '-')) {
$recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts']));
}
}
?>
<div class="mainwp-row mainwp-recent">
<input class="postId" type="hidden" name="id" value="<?php
echo $recent_pages_published[$i]['id'];
?>
"/>
<input class="websiteId" type="hidden" name="id" value="<?php
echo $recent_pages_published[$i]['website']->id;
?>
"/>
<span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php
echo $recent_pages_published[$i]['website']->url;
?>
?p=<?php
echo $recent_pages_published[$i]['id'];
?>
" target="_blank"><?php
echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
?>
</a></span>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-recent-pages.php
示例13: extra_tablenav
function extra_tablenav($which)
{
?>
<div class="alignleft actions">
<form method="GET" action="">
<input type="hidden" value="<?php
echo esc_attr($_REQUEST['page']);
?>
" name="page"/>
<select name="g">
<option value=""><?php
_e('All Groups', 'mainwp');
?>
</option>
<?php
$groups = MainWP_DB::Instance()->getGroupsForCurrentUser();
foreach ($groups as $group) {
echo '<option value="' . $group->id . '" ' . (isset($_REQUEST['g']) && $_REQUEST['g'] == $group->id ? 'selected' : '') . '>' . stripslashes($group->name) . '</option>';
}
?>
</select>
<input type="hidden" value="<?php
echo $_REQUEST['page'];
?>
" name="page"/>
<select name="status">
<option value=""><?php
_e('All Statuses', 'mainwp');
?>
</option>
<option value="online" <?php
echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'online' ? 'selected' : '';
?>
>Online</option>
<option value="offline" <?php
echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'offline' ? 'selected' : '';
?>
>Offline</option>
<option value="disconnected" <?php
echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'disconnected' ? 'selected' : '';
?>
>Disconnected</option>
<option value="update" <?php
echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'update' ? 'selected' : '';
?>
>Available update</option>
</select>
<input type="submit" value="<?php
_e('Display');
?>
" class="button" name="">
</form>
</div>
<div class="alignleft actions">
<form method="GET" action="">
<input type="hidden" value="<?php
echo $_REQUEST['page'];
?>
" name="page"/>
<input type="text" value="<?php
echo isset($_REQUEST['s']) ? esc_attr($_REQUEST['s']) : '';
?>
"
autocompletelist="sites" name="s" class="mainwp_autocomplete"/>
<datalist id="sites">
<?php
if (MainWP_DB::is_result($this->items)) {
while ($this->items && ($item = @MainWP_DB::fetch_array($this->items))) {
echo '<option>' . $item['name'] . '</option>';
}
MainWP_DB::data_seek($this->items, 0);
}
?>
</datalist>
<input type="submit" value="<?php
_e('Search Sites');
?>
" class="button" name=""/>
</form>
</div>
<?php
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:86,代码来源:table-mainwp-manage-sites-list-table.php
示例14: query
public function query($sql)
{
if ($sql == null) {
return false;
}
$result = @self::_query($sql, $this->wpdb->dbh);
if (!$result || @MainWP_DB::num_rows($result) == 0) {
return false;
}
return $result;
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:11,代码来源:class-mainwp-db.php
示例15: 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));
}
开发者ID:senlin,项目名称:mainwp,代码行数:81,代码来源:page-mainwp-user.php
示例16: performUpload
public static function performUpload()
{
MainWP_Utility::endSession();
//Fetch info..
$post_data = array('url' => json_encode(explode('||', $_POST['urls'])), 'type' => $_POST['type']);
if ($_POST['activatePlugin'] == 'true') {
$post_data['activatePlugin'] = 'yes';
}
if ($_POST['overwrite'] == 'true') {
$post_data['overwrite'] = true;
}
$output = new stdClass();
$output->ok = array();
$output->errors = array();
$websites = array(MainWP_DB::Instance()->getWebsiteById($_POST['siteId']));
MainWP_Utility::fetchUrlsAuthed($websites, 'installplugintheme', $post_data, array(MainWP_Install_Bulk::getClassName(), 'InstallPluginTheme_handler'), $output);
die(json_encode($output));
}
开发者ID:reeslo,项目名称:mainwp,代码行数:18,代码来源:page-mainwp-install-bulk.php
示例17: getCurrentArchiveExtension
public static function getCurrentArchiveExtension($website = false, $task = false)
{
$useSite = true;
if ($task != false) {
if ($task->archiveFormat == 'global') {
$useGlobal = true;
$useSite = false;
} else {
if ($task->archiveFormat == '' || $task->archiveFormat == 'site') {
$useGlobal = false;
$useSite = true;
} else {
$archiveFormat = $task->archiveFormat;
$useGlobal = false;
$useSite = false;
}
}
}
if ($useSite) {
if ($website == false) {
$useGlobal = true;
} else {
$backupSettings = MainWP_DB::Instance()->getWebsiteBackupSettings($website->id);
$archiveFormat = $backupSettings->archiveFormat;
$useGlobal = $archiveFormat == 'global';
}
}
if ($useGlobal) {
$archiveFormat = get_option('mainwp_archiveFormat');
if ($archiveFormat === false) {
$archiveFormat = 'tar.gz';
}
}
return $archiveFormat;
}
开发者ID:reeslo,项目名称:mainwp,代码行数:35,代码来源:class-mainwp-utility.php
示例18: renderSettings
public static function renderSettings()
{
$userExtension = MainWP_DB::Instance()->getUserExtension();
$pluginDir = $userExtension == null || ($userExtension->pluginDir == null || $userExtension->pluginDir == '') ? 'default' : $userExtension->pluginDir;
$user_email = MainWP_Utility::getNotificationEmail();
$siteview = $userExtension->site_view;
$snAutomaticDailyUpdate = get_option('mainwp_automaticDailyUpdate');
$backup_before_upgrade = get_option('mainwp_backup_before_upgrade');
$lastAutomaticUpdate = MainWP_DB::Instance()->getWebsitesLastAutomaticSync();
if ($lastAutomaticUpdate == 0) {
$nextAutomaticUpdate = 'Any minute';
} else {
if (MainWP_DB::Instance()->getWebsitesCountWhereDtsAutomaticSyncSmallerThenStart() > 0 || MainWP_DB::Instance()->getWebsitesCheckUpdatesCount() > 0) {
$nextAutomaticUpdate = 'Processing your websites.';
} else {
$nextAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(mktime(0, 0, 0, date('n'), date('j') + 1)));
}
}
if ($lastAutomaticUpdate == 0) {
$lastAutomaticUpdate = 'Never';
} else {
$lastAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($lastAutomaticUpdate));
}
?>
<div class="postbox" id="mainwp-hide-child-plugin-settings">
<h3 class="mainwp_box_title">
<span><i class="fa fa-cog"></i> <?php
_e('Network Optimization', 'mainwp');
?>
</span></h3>
<div class="inside">
<div class="mainwp_info-box-red" style="margin-top: 5px;"><?php
_e('<strong>STOP BEFORE TURNING ON!</strong> Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp');
?>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php
_e('Hide MainWP Child Plugin from Search Engines', 'mainwp');
?>
<br/>
<em style="font-size: 12px;">(<?php
_e('does not hide from users', 'mainwp');
?>
)</em>
</th>
<td>
<table>
<tr>
<td valign="top" style="padding-left: 0; padding-right: 5px; padding-top: 0px; padding-bottom: 0px; vertical-align: top;">
<div class="mainwp-checkbox">
<input type="checkbox" value="hidden" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_default" <?php
echo $pluginDir == 'hidden' ? 'checked="true"' : '';
?>
/><label for="mainwp_options_footprint_plugin_folder_default"></label>
</div>
</td>
<td valign="top" style="padding: 0">
<label for="mainwp_options_footprint_plugin_folder_default">
<em><?php
_e('This will make anyone including Search Engines trying find your Child Plugin encounter a 404 page. Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp');
?>
</em>
</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Optimize for Shared Hosting or Big Networks', 'mainwp');
?>
<?php
MainWP_Utility::renderToolTip(__('Updates will be cached for quick loading. A manual refresh from the Dashboard is required to view new plugins, themes, pages or users. Recommended for Networks over 50 sites.', 'mainwp'));
?>
</th>
<td>
<div class="mainwp-checkbox">
<input type="checkbox" name="mainwp_optimize"
id="mainwp_optimize" <?php
echo get_option('mainwp_optimize') == 1 ? 'checked="true"' : '';
?>
/>
<label for="mainwp_optimize"></label>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="postbox" id="mainwp-global-options-settings">
<h3 class="mainwp_box_title">
<span><i class="fa fa-cog"></i> <?php
_e('Global Options', 'mainwp');
?>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-options.php
示例19: renderDashboardBody
public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout)
{
$opts = get_option('mainwp_opts_showhide_sections', false);
$hide_shortcuts = is_array($opts) && isset($opts['welcome_shortcuts']) && $opts['welcome_shortcuts'] == 'hide' ? true : false;
?>
<form action="admin-post.php" method="post">
<?php
wp_nonce_field('mainwp_tab-general');
?>
<?php
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
?>
<?php
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
?>
<input type="hidden" name="action" value="save_howto_testPages_general"/>
<div id="mainwp-welocme-bar" class="welcome-panel" style="padding-left: 2em;">
<table id="mainwp-refresh-bar" width="100%">
<tbody>
<tr>
<td>
<div id="mainwp-welocme-bar-top">
<span style="float:right;">
<a style="font-size: 18px;" class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php
echo MainWP_Right_Now::renderLastUpdate();
?>
"><i class="fa fa-refresh"></i> <?php
_e('Sync Data with Child Sites', 'mainwp');
?>
</a>
<a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><i class="fa fa-cart-plus"></i> <?php
_e('Get New Extensions', 'mainwp');
?>
</a>
</span>
<?php
$current_wp_id = MainWP_Utility::get_current_wpid();
$website = null;
if (!empty($current_wp_id)) {
$website = $websites[0];
}
$imgfavi = '';
if ($website !== null) {
if (get_option('mainwp_use_favicon', 1) == 1) {
$favi = MainWP_DB::
|
请发表评论