本文整理汇总了PHP中MainWP_Utility类的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility类的具体用法?PHP MainWP_Utility怎么用?PHP MainWP_Utility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainWP_Utility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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);
}
示例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;
}
示例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');
?>
//.........这里部分代码省略.........
示例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>
//.........这里部分代码省略.........
示例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;
}
示例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.')));
}
}
示例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;
}
示例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
}
示例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;
}
示例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');
}
示例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>
//.........这里部分代码省略.........
示例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));
}
示例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';
}
示例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;
}