本文整理汇总了PHP中MainWP_Utility类的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility类的具体用法?PHP MainWP_Utility怎么用?PHP MainWP_Utility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainWP_Utility类的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: warningForWebsite
public function warningForWebsite($pWebsite, $pAction, $pMessage, $addStackTrace = true)
{
$stackTrace = '';
if ($addStackTrace) {
@ob_start();
@debug_print_backtrace();
$stackTrace = "\n" . @ob_get_clean();
}
if (empty($pWebsite)) {
return $this->log('[-] [-] ::' . $pAction . ':: ' . $pMessage . $stackTrace, self::WARNING);
}
return $this->log('[' . $pWebsite->name . '] [' . MainWP_Utility::getNiceURL($pWebsite->url) . '] ::' . $pAction . ':: ' . $pMessage . $stackTrace, self::WARNING);
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:13,代码来源:class-mainwp-logger.php
示例3: testloginapi
public function testloginapi($args)
{
$defaults = array('request' => 'testloginapi');
$args = wp_parse_args($defaults, $args);
$target_url = self::create_software_api_url($args);
$request = wp_remote_get($target_url, array('timeout' => 50, 'sslverify' => self::$apisslverify));
// $request = wp_remote_post( MainWP_Api_Manager::instance()->getUpgradeUrl() . 'wc-api/am-software-api/', array('body' => $args) );
if (is_wp_error($request)) {
if (self::$apisslverify == 1) {
MainWP_Utility::update_option('mainwp_api_sslVerifyCertificate', 0);
return array('retry_action' => 1);
}
throw new Exception($request->get_error_message());
return false;
}
$code = wp_remote_retrieve_response_code($request);
if ($code != 200) {
throw new Exception('Error: code ' . $code);
return false;
}
$response = wp_remote_retrieve_body($request);
return $response;
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:23,代码来源:class-mainwp-api-manager-key.php
示例4: 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
示例5: 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::Instance()->getWebsiteOption($website, 'favi_icon', '');
$favi_url = MainWP_Utility::get_favico_url($favi, $website);
$imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/> ';
}
}
if ($website !== null) {
if (time() - $website->dtsSync > 60 * 60 * 24) {
?>
<h3>
<i class="fa fa-flag"></i> <?php
_e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp');
?>
</h3>
<p class="about-description"><?php
_e('Click the Sync Data button to get the latest data from child sites.', 'mainwp');
?>
</p>
<?php
} else {
?>
<h3><?php
echo sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name));
?>
</h3>
<p class="about-description"><?php
echo sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWP_Utility::getNiceURL($website->url, true));
?>
</p>
<?php
}
} else {
$sync_status = MainWP_DB::Instance()->getLastSyncStatus();
if ($sync_status === 'not_synced') {
?>
<h3>
<i class="fa fa-flag"></i> <?php
_e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp');
?>
</h3>
<p class="about-description"><?php
_e('Click the Sync Data button to get the latest data from child sites.', 'mainwp');
?>
</p>
<?php
} else {
if ($sync_status === 'all_synced') {
?>
<h3><?php
echo __('All sites have been synced within the last 24 hours!', 'mainwp');
?>
</h3>
<p class="about-description"><?php
echo __('Manage your WordPress sites with ease.', 'mainwp');
?>
</p>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-main.php
示例6: save
/**
* Save the file to the specified path
* @return boolean TRUE on success
*/
function save($path)
{
$wpFileSystem = MainWP_Utility::getWPFilesystem();
if ($wpFileSystem != null) {
$path = str_replace(MainWP_Utility::getBaseDir(), '', $path);
$moved = $wpFileSystem->put_contents($path, file_get_contents($_FILES['qqfile']['tmp_name']));
} else {
$moved = move_uploaded_file($_FILES['qqfile']['tmp_name'], $path);
}
if (!$moved) {
return false;
}
return true;
}
开发者ID:reeslo,项目名称:mainwp,代码行数:18,代码来源:page-mainwp-install-bulk.php
示例7: 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
示例8: getPostMeta
public static function getPostMeta($postId, $keys, $value, $websiteId)
{
if (!MainWP_Utility::ctype_digit($postId)) {
return;
}
if (!MainWP_Utility::ctype_digit($websiteId)) {
return;
}
$website = MainWP_DB::Instance()->getWebsiteById($websiteId);
if (!MainWP_Utility::can_edit_website($website)) {
return;
}
try {
$results = MainWP_Utility::fetchUrlAuthed($website, 'get_post_meta', array('id' => base64_encode($postId), 'keys' => base64_encode($keys), 'value' => base64_encode($value)));
} catch (MainWP_Exception $e) {
return;
}
return $results;
}
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-post.php
示例9: renderSettings
public static function renderSettings()
{
$userExtension = MainWP_DB::Instance()->getUserExtension();
$onlineNotifications = $userExtension == null || ($userExtension->offlineChecksOnlineNotification == null || $userExtension->offlineChecksOnlineNotification == '') ? '0' : $userExtension->offlineChecksOnlineNotification;
?>
<div class="postbox" id="mainwp-offline-check-options-settings">
<h3 class="mainwp_box_title">
<span><i class="fa fa-cog"></i> <?php
_e('Offline Check Options', 'mainwp');
?>
</span></h3>
<div class="inside">
<div class="mainwp_info-box-red">
<strong>IMPORTANT:</strong> This feature is being retired and replaced by the Free MainWP Advanced Uptime Monitor Extension which provides more advanced monitoring system.<br/>
<a href="https://mainwp.com/extension/advanced-uptime-monitor/">Get the Free MainWP Advanced Uptime Monitor Extension here!</a>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php
_e('Online Notifications', 'mainwp');
?>
<?php
MainWP_Utility::renderToolTip(__('Network will monitor your sites for downtime and uptime. By default emails are only sent when your site is down.', 'mainwp'));
?>
</th>
<td>
<div class="mainwp-checkbox">
<input type="checkbox" name="mainwp_options_offlinecheck_onlinenotification"
id="mainwp_options_offlinecheck_onlinenotification" <?php
echo $onlineNotifications == 1 ? 'checked="true"' : '';
?>
/>
<label for="mainwp_options_offlinecheck_onlinenotification"></label>
</div><?php
_e('Enable notifications even when the website is online', 'mainwp');
?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
}
开发者ID:jexmex,项目名称:mainwp,代码行数:46,代码来源:page-mainwp-offline-checks.php
示例10: checkBackups
public static function checkBackups()
{
//if (get_option('mainwp_backup_before_upgrade') != 1) return true;
if (!is_array($_POST['sites'])) {
return true;
}
$global_backup_before_upgrade = get_option('mainwp_backup_before_upgrade');
$output = array();
foreach ($_POST['sites'] as $siteId) {
$website = MainWP_DB::Instance()->getWebsiteById($siteId);
if ($website->backup_before_upgrade == 0 || $website->backup_before_upgrade == 2 && $global_backup_before_upgrade == 0) {
continue;
}
$dir = MainWP_Utility::getMainWPSpecificDir($siteId);
//Check if backup ok
$lastBackup = -1;
if (file_exists($dir) && ($dh = opendir($dir))) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
$theFile = $dir . $file;
if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file) && filemtime($theFile) > $lastBackup) {
$lastBackup = filemtime($theFile);
}
}
}
closedir($dh);
}
$output['sites'][$siteId] = $lastBackup < time() - 7 * 24 * 60 * 60 ? false : true;
}
return $output;
}
开发者ID:senlin,项目名称:mainwp,代码行数:31,代码来源:widget-mainwp-right-now.php
示例11: renderActionLogs
public static function renderActionLogs()
{
self::renderHeader('Action logs');
if (isset($_REQUEST['actionlogs_status'])) {
if ($_REQUEST['actionlogs_status'] != MainWP_Logger::DISABLED) {
MainWP_Logger::Instance()->setLogPriority($_REQUEST['actionlogs_status']);
}
MainWP_Logger::Instance()->log('Action logs set to: ' . MainWP_Logger::Instance()->getLogText($_REQUEST['actionlogs_status']), MainWP_Logger::LOG);
if ($_REQUEST['actionlogs_status'] == MainWP_Logger::DISABLED) {
MainWP_Logger::Instance()->setLogPriority($_REQUEST['actionlogs_status']);
}
MainWP_Utility::update_option('mainwp_actionlogs', $_REQUEST['actionlogs_status']);
}
$enabled = get_option('mainwp_actionlogs');
if ($enabled === false) {
$enabled = MainWP_Logger::DISABLED;
}
?>
<div class="postbox" id="mainwp-code-display">
<h3 class="hndle" style="padding: 8px 12px; font-size: 14px;"><span>Action logs</span></h3>
<div style="padding: 1em;">
<form method="POST" action="">
Status:
<select name="actionlogs_status">
<option value="<?php
echo MainWP_Logger::DISABLED;
?>
" <?php
if (MainWP_Logger::DISABLED == $enabled) {
echo 'selected';
}
?>
>Disabled
</option>
<option value="<?php
echo MainWP_Logger::WARNING;
?>
" <?php
if (MainWP_Logger::WARNING == $enabled) {
echo 'selected';
}
?>
>Warning
</option>
<option value="<?php
echo MainWP_Logger::INFO;
?>
" <?php
if (MainWP_Logger::INFO == $enabled) {
echo 'selected';
}
?>
>Info
</option>
<option value="<?php
echo MainWP_Logger::DEBUG;
?>
" <?php
if (MainWP_Logger::DEBUG == $enabled) {
echo 'selected';
}
?>
>Debug
</option>
</select> <input type="submit" class="button button-primary" value="Save"/>
</form>
</div>
<div style="padding: 1em;"><?php
MainWP_Logger::showLog();
?>
</div>
</div>
<?php
self::renderFooter('Action logs');
}
开发者ID:jexmex,项目名称:mainwp,代码行数:76,代码来源:page-mainwp-server-information.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: 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
示例14: unIgnorePluginThemeConflict
public static function unIgnorePluginThemeConflict($type, $name, $siteid)
{
if ($siteid != '') {
//For the sites..
if ($siteid == '_ALL_') {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
} else {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsiteById($siteid));
}
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (MainWP_Utility::can_edit_website($website)) {
$name = urldecode($name);
if ($type == 'plugin') {
$decodedIgnoredPlugins = json_decode($website->ignored_pluginConflicts, true);
if (!is_array($decodedIgnoredPlugins)) {
$decodedIgnoredPlugins = array();
}
if ($name == '') {
MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_pluginConflicts' => json_encode(array())));
} else {
if (in_array($name, $decodedIgnoredPlugins)) {
$idx = array_search($name, $decodedIgnoredPlugins);
array_splice($decodedIgnoredPlugins, $idx, 1);
MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_pluginConflicts' => json_encode($decodedIgnoredPlugins)));
}
}
} else {
if ($type == 'theme') {
$decodedIgnoredThemes = json_decode($website->ignored_themeConflicts, true);
if (!is_array($decodedIgnoredThemes)) {
$decodedIgnoredThemes = array();
}
if ($name == '') {
MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themeConflicts' => json_encode(array())));
} else {
if (in_array($name, $decodedIgnoredThemes)) {
$idx = array_search($name, $decodedIgnoredThemes);
array_splice($decodedIgnoredThemes, $idx, 1);
MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themeConflicts' => json_encode($decodedIgnoredThemes)));
}
}
}
}
}
}
@MainWP_DB::free_result($websites);
} else {
//unignore globally
$userExtension = MainWP_DB::Instance()->getUserExtension();
$name = urldecode($name);
if ($type == 'plugin') {
$globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
if (!is_array($globalIgnoredPluginConflicts)) {
$globalIgnoredPluginConflicts = array();
}
if ($name == '') {
//Unignore all
$globalIgnoredPluginConflicts = array();
$userExtension->ignored_pluginConflicts = json_encode($globalIgnoredPluginConflicts);
MainWP_DB::Instance()->updateUserExtension($userExtension);
} else {
if (in_array($name, $globalIgnoredPluginConflicts)) {
$idx = array_search($name, $globalIgnoredPluginConflicts);
array_splice($globalIgnoredPluginConflicts, $idx, 1);
$userExtension->ignored_pluginConflicts = json_encode($globalIgnoredPluginConflicts);
MainWP_DB::Instance()->updateUserExtension($userExtension);
}
}
} else {
if ($type == 'theme') {
$globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true);
if (!is_array($globalIgnoredThemeConflicts)) {
$globalIgnoredThemeConflicts = array();
}
if ($name == '') {
$globalIgnoredThemeConflicts = array();
$userExtension->ignored_themeConflicts = json_encode($globalIgnoredThemeConflicts);
MainWP_DB::Instance()->updateUserExtension($userExtension);
} else {
if (in_array($name, $globalIgnoredThemeConflicts)) {
$idx = array_search($name, $globalIgnoredThemeConflicts);
array_splice($globalIgnoredThemeConflicts, $idx, 1);
$userExtension->ignored_themeConflicts = json_encode($globalIgnoredThemeConflicts);
MainWP_DB::Instance()->updateUserExtension($userExtension);
}
}
}
}
}
return 'success';
}
开发者ID:jexmex,项目名称:mainwp,代码行数:91,代码来源:page-mainwp-plugins.php
示例15: updateCompletedSites
public function updateCompletedSites($id, $completedSites)
{
if (MainWP_Utility::ctype_digit($id)) {
return $this->wpdb->update($this->tableName('wp_backup'), array('completed_sites' => json_encode($completedSites)), array('id' => $id));
}
return false;
}
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:7,代码来源:class-mainwp-db.php
示例16: 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
示例17: render
//.........这里部分代码省略.........
<?php
$user_can_manage_extensions = mainwp_current_user_can('dashboard', 'manage_extensions');
if (isset($extensions) && is_array($extensions)) {
foreach ($extensions as $extension) {
if (!mainwp_current_user_can('extension', dirname($extension['slug']))) {
continue;
}
$active = MainWP_Extensions::isExtensionActivated($extension['plugin']);
$enabled = MainWP_Extensions::isExtensionEnabled($extension['plugin']);
$queue_status = '';
if (isset($extension['apiManager']) && $extension['apiManager']) {
$queue_status = 'status="queue"';
}
?>
<div class="mainwp-extensions-childHolder" extension_slug="<?php
echo $extension['slug'];
?>
" <?php
echo $queue_status;
?>
license-status="<?php
echo $active ? 'activated' : 'deactivated';
?>
">
<table style="width: 100%">
<td class="mainwp-extensions-childIcon">
<?php
if (isset($extension['iconURI']) && $extension['iconURI'] != '') {
?>
<img title="<?php
echo $extension['name'];
?>
" src="<?php
echo MainWP_Utility::removeHttpPrefix($extension['iconURI']);
?>
" class="mainwp-extensions-img large <?php
echo $enabled ? '' : 'mainwp-extension-icon-desaturated';
?>
" /><?php
} else {
?>
<img title="MainWP Placeholder" src="<?php
echo plugins_url('images/extensions/placeholder.png', dirname(__FILE__));
?>
" class="mainwp-extensions-img large <?php
echo $enabled ? '' : 'mainwp-extension-icon-desaturated';
?>
" /><?php
}
?>
</td>
<td valign="top">
<table style="width: 100%">
<tr>
<td class="mainwp-extensions-childName">
<?php
if (isset($extension['direct_page']) && !empty($extension['direct_page'])) {
?>
<a href="<?php
echo admin_url('admin.php?page=' . $extension['direct_page']);
?>
" style="text-decoration: none;">
<?php
echo $extension['name'];
?>
</a>
开发者ID:senlin,项目名称:mainwp,代码行数:67,代码来源:view-mainwp-extensions-view.php
-
The BolunHan/Krypton repository through 2021-06-03 on GitHub allows absolute pat
阅读:686|2022-07-29
-
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1223|2022-08-30
-
ozzieperez/packtpub-library-downloader: Script to download all your PacktPub ebo
阅读:534|2022-08-15
-
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1136|2022-08-17
-
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:946|2022-11-06
-
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1343|2022-08-18
-
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:490|2022-08-16
-
PacktPublishing/Mastering-Embedded-Linux-Programming-Third-Edition: Mastering Em
阅读:747|2022-08-15
-
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:644|2022-11-06
-
shem8/MaterialLogin: Login view with material design
阅读:726|2022-08-17
|
请发表评论