本文整理汇总了PHP中MainWP_DB::data_seek方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_DB::data_seek方法的具体用法?PHP MainWP_DB::data_seek怎么用?PHP MainWP_DB::data_seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_DB
的用法示例。
在下文中一共展示了MainWP_DB::data_seek方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sites
/**
* List information about added child sites
*
* ## OPTIONS
*
* [--list]
* : Get a list of all child sites
*
* @todo: allow to add or remove child sites
* @synopsis [--list]
*/
public function sites($args, $assoc_args)
{
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
$idLength = strlen('id');
$nameLength = strlen('name');
$urlLength = strlen('url');
$versionLength = strlen('version');
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($idLength < strlen($website->id)) {
$idLength = strlen($website->id);
}
if ($nameLength < strlen($website->name)) {
$nameLength = strlen($website->name);
}
if ($urlLength < strlen($website->url)) {
$urlLength = strlen($website->url);
}
if ($versionLength < strlen($website->version)) {
$versionLength = strlen($website->version);
}
}
@MainWP_DB::data_seek($websites, 0);
WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $urlLength . "s | %-" . $versionLength . "s |", 'id', 'name', 'url', 'version'));
WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $urlLength . "s | %-" . $versionLength . "s |", $website->id, $website->name, $website->url, $website->version));
}
WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($urlLength + 2) . "s+%'--" . ($versionLength + 2) . "s+", '', '', '', ''));
@MainWP_DB::free_result($websites);
}
示例2: renderIgnoredAbandoned
//.........这里部分代码省略.........
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
<caption><?php
_e('Per Site Ignored Abandoned Themes', 'mainwp');
?>
</caption>
<thead>
<tr>
<th scope="col" class="manage-column" style="width: 300px"><?php
_e('Site', 'mainwp');
?>
</th>
<th scope="col" class="manage-column" style="width: 650px"><?php
_e('Themes', 'mainwp');
?>
</th>
<th scope="col" class="manage-column" style="text-align: right; padding-right: 10px"><?php
if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) {
if ($cnt > 0) {
?>
<a href="#" class="button-primary mainwp-unignore-detail-all" onClick="return rightnow_themes_unignore_abandoned_detail_all();"><?php
_e('Allow All', 'mainwp');
?>
</a><?php
}
}
?>
</th>
</tr>
</thead>
<tbody id="ignored-themes-list" class="list:sites">
<?php
if ($cnt > 0) {
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
$decodedIgnoredThemes = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true);
if (!is_array($decodedIgnoredThemes) || count($decodedIgnoredThemes) == 0) {
continue;
}
$first = true;
foreach ($decodedIgnoredThemes as $ignoredTheme => $ignoredThemeName) {
?>
<tr site_id="<?php
echo $website->id;
?>
" theme_slug="<?php
echo urlencode($ignoredTheme);
?>
">
<td>
<span class="websitename" <?php
if (!$first) {
echo 'style="display: none;"';
} else {
$first = false;
}
?>
>
<a href="<?php
echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
?>
"><?php
echo stripslashes($website->name);
?>
</a>
</span>
示例3: update_footer
function update_footer()
{
if (!self::isMainWP_Pages()) {
return;
}
$current_wpid = MainWP_Utility::get_current_wpid();
if ($current_wpid) {
$website = MainWP_DB::Instance()->getWebsiteById($current_wpid);
$websites = array($website);
} else {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp_sync.dtsSync DESC, wp.url ASC'));
}
ob_start();
$cntr = 0;
if (is_array($websites)) {
for ($i = 0; $i < count($websites); $i++) {
$website = $websites[$i];
if ($website->sync_errors == '') {
$cntr++;
echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />';
}
}
} else {
if ($websites !== false) {
while ($website = @MainWP_DB::fetch_object($websites)) {
if ($website->sync_errors == '') {
$cntr++;
echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />';
}
}
}
}
?>
<div id="refresh-status-box" title="Syncing Websites" style="display: none; text-align: center">
<div id="refresh-status-progress"></div>
<span id="refresh-status-current">0</span> / <span id="refresh-status-total"><?php
echo esc_html($cntr);
?>
</span>
<span id="refresh-status-text"><?php
esc_html_e('synced', 'mainwp');
?>
</span>
<div style="height: 160px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="refresh-status-content">
<table style="width: 100%">
<?php
if (is_array($websites)) {
for ($i = 0; $i < count($websites); $i++) {
$website = $websites[$i];
if ($website->sync_errors == '') {
echo '<tr><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
} else {
echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>';
}
}
} else {
@MainWP_DB::data_seek($websites, 0);
while ($website = @MainWP_DB::fetch_object($websites)) {
if ($website->sync_errors == '') {
echo '<tr><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
} else {
echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>';
}
}
}
?>
</table>
</div>
<input id="refresh-status-close" type="button" name="Close" value="Close" class="button"/>
</div>
<?php
if (!self::isHideFooter()) {
self::sites_fly_menu();
self::add_new_links();
}
$newOutput = ob_get_clean();
$output = '';
if (!self::isHideFooter()) {
$output .= '<a href="javascript:void(0)" id="dashboard_refresh" title="Sync Data" class="mainwp-left-margin-2 mainwp-green"><i class="fa fa-refresh fa-2x"></i></a> <a id="mainwp-add-new-button" class="mainwp-blue mainwp-left-margin-2" title="Add New" href="javascript:void(0)"><i class="fa fa-plus fa-2x"></i></a> <a class="mainwp-red mainwp-left-margin-2" title="Get MainWP Extensions" href="https://mainwp.com/extensions/" target="_blank"><i class="fa fa-shopping-cart fa-2x"></i></a> <a class="mainwp-white mainwp-left-margin-2" title="Get Support" href="http://support.mainwp.com" target="_blank"><i class="fa fa-life-ring fa-2x"></i></a>' . '<a href="https://www.facebook.com/mainwp" class="mainwp-link-clean mainwp-left-margin-2" style="color: #3B5998;" target="_blank"><i class="fa fa-facebook-square fa-2x"></i></a> ' . ' <a href="https://twitter.com/mymainwp" class="mainwp-link-clean" target="_blank" style="color: #4099FF;"><i class="fa fa-twitter-square fa-2x"></i></a>.';
}
return $output . $newOutput;
}
示例4: 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
}
示例5: renderSites
public static function renderSites()
{
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
$websites = MainWP_DB::Instance()->query($sql);
if (!$websites) {
return;
}
$all_sites_synced = true;
$top_row = true;
?>
<div class="clear">
<div id="wp_syncs">
<?php
ob_start();
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (empty($website) || $website->sync_errors != '') {
continue;
}
if (time() - $website->dtsSync < 60 * 60 * 24) {
continue;
}
$all_sites_synced = false;
$lastSyncTime = !empty($website->dtsSync) ? MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($website->dtsSync)) : '';
?>
<div class="<?php
echo $top_row ? 'mainwp-row-top' : 'mainwp-row';
?>
mainwp_wp_sync" site_id="<?php
echo $website->id;
?>
" site_name="<?php
echo rawurlencode($website->name);
?>
">
<span class="mainwp-left-col"><a href="<?php
echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
?>
"><?php
echo stripslashes($website->name);
?>
</a><input type="hidden" id="wp_sync<?php
echo $website->id;
?>
" /></span>
<span class="mainwp-mid-col wordpressInfo" id="wp_sync_<?php
echo $website->id;
?>
">
<?php
echo $lastSyncTime;
?>
</span>
<span class="mainwp-right-col wordpressAction">
<div id="wp_syncs_<?php
echo $website->id;
?>
">
<a class="mainwp-upgrade-button button" onClick="rightnow_wp_sync('<?php
echo $website->id;
?>
')"><?php
_e('Sync Now', 'mainwp');
?>
</a>
</div>
</span>
</div>
<?php
$top_row = false;
}
$output = ob_get_clean();
if ($all_sites_synced) {
echo esc_html__('All sites have been synced within the last 24 hours', 'mainwp') . ".";
} else {
echo '<div class="mainwp_info-box-red">' . esc_html__('Sites not synced in the last 24 hours.', 'mainwp') . '</div>';
echo $output;
}
?>
</div>
</div>
<?php
@MainWP_DB::free_result($websites);
}
示例6: renderSites
public static function renderSites()
{
$globalView = true;
$current_wpid = MainWP_Utility::get_current_wpid();
if ($current_wpid) {
$sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
$globalView = false;
} else {
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
}
$websites = MainWP_DB::Instance()->query($sql);
if (!$websites) {
return;
}
$userExtension = MainWP_DB::Instance()->getUserExtension();
$total_themesIgnored = $total_pluginsIgnored = 0;
$total_themesIgnoredAbandoned = $total_pluginsIgnoredAbandoned = 0;
if ($globalView) {
$decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true);
$decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true);
$total_pluginsIgnored = is_array($decodedIgnoredPlugins) ? count($decodedIgnoredPlugins) : 0;
$total_themesIgnored = is_array($decodedIgnoredThemes) ? count($decodedIgnoredThemes) : 0;
$decodedIgnoredPluginsAbandoned = json_decode($userExtension->dismissed_plugins, true);
$decodedIgnoredThemesAbandoned = json_decode($userExtension->dismissed_themes, true);
$total_pluginsIgnoredAbandoned = is_array($decodedIgnoredPluginsAbandoned) ? count($decodedIgnoredPluginsAbandoned) : 0;
$total_themesIgnoredAbandoned = is_array($decodedIgnoredThemesAbandoned) ? count($decodedIgnoredThemesAbandoned) : 0;
}
$decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true);
$decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true);
$globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
if (!is_array($globalIgnoredPluginConflicts)) {
$globalIgnoredPluginConflicts = array();
}
$globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true);
if (!is_array($globalIgnoredThemeConflicts)) {
$globalIgnoredThemeConflicts = array();
}
$total_wp_upgrades = 0;
$total_plugin_upgrades = 0;
$total_theme_upgrades = 0;
$total_sync_errors = 0;
$total_uptodate = 0;
$total_offline = 0;
$total_conflict = 0;
$total_plugins_outdate = 0;
$total_themes_outdate = 0;
$allPlugins = array();
$pluginsInfo = array();
$allThemes = array();
$themesInfo = array();
$allPluginsOutdate = array();
$pluginsOutdateInfo = array();
$allThemesOutdate = array();
$themesOutdateInfo = array();
@MainWP_DB::data_seek($websites, 0);
$currentSite = null;
$pluginsIgnored_perSites = $themesIgnored_perSites = array();
$pluginsIgnoredAbandoned_perSites = $themesIgnoredAbandoned_perSites = array();
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (!$globalView) {
$currentSite = $website;
}
$wp_upgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true);
if ($website->is_ignoreCoreUpdates) {
$wp_upgrades = array();
}
if (is_array($wp_upgrades) && count($wp_upgrades) > 0) {
$total_wp_upgrades++;
}
$plugin_upgrades = json_decode($website->plugin_upgrades, true);
if ($website->is_ignorePluginUpdates) {
$plugin_upgrades = array();
}
$theme_upgrades = json_decode($website->theme_upgrades, true);
if ($website->is_ignoreThemeUpdates) {
$theme_upgrades = array();
}
$decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
if (is_array($decodedPremiumUpgrades)) {
foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
$premiumUpgrade['premium'] = true;
if ($premiumUpgrade['type'] == 'plugin') {
if (!is_array($plugin_upgrades)) {
$plugin_upgrades = array();
}
if (!$website->is_ignorePluginUpdates) {
$plugin_upgrades[$crrSlug] = $premiumUpgrade;
}
} else {
if ($premiumUpgrade['type'] == 'theme') {
if (!is_array($theme_upgrades)) {
$theme_upgrades = array();
}
if (!$website->is_ignoreThemeUpdates) {
$theme_upgrades[$crrSlug] = $premiumUpgrade;
}
}
}
}
}
//.........这里部分代码省略.........
示例7: renderSites
public static function renderSites()
{
$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);
if (!$websites) {
return;
}
$total_securityIssues = 0;
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (MainWP_Utility::ctype_digit($website->securityIssues)) {
$total_securityIssues += $website->securityIssues;
}
}
//We found some with security issues!
if ($total_securityIssues > 0) {
?>
<div class="clear">
<div class="mainwp-row-top darkred">
<span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php
echo $total_securityIssues;
?>
</span> <?php
_e('Security issue', 'mainwp');
echo $total_securityIssues > 1 ? 's' : '';
?>
</span>
<span class="mainwp-mid-col"> </span>
<span class="mainwp-right-col"><a href="#" id="mainwp_securityissues_show" onClick="return rightnow_show('securityissues');"><?php
_e('Show All', 'mainwp');
?>
</a> <input type="button" class="securityIssues_dashboard_allFixAll button-primary" value="<?php
_e('Fix All', 'mainwp');
?>
"/></span>
</div>
<div id="wp_securityissues" style="display: none">
<?php
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (!MainWP_Utility::ctype_digit($website->securityIssues) || $website->securityIssues == 0) {
continue;
}
?>
<div class="mainwp-row" siteid="<?php
echo $website->id;
?>
">
<span class="mainwp-left-col"><a href="admin.php?page=managesites&scanid=<?php
echo $website->id;
?>
"><?php
echo stripslashes($website->name);
?>
</a></span>
<span class="mainwp-mid-col"><span class="<?php
echo $website->securityIssues > 0 ? 'darkred' : 'mainwp_ga_plus';
?>
"><span class="mainwp-rightnow-number"><?php
echo $website->securityIssues;
?>
</span> Issue<?php
echo $website->securityIssues > 1 ? 's' : '';
?>
</span></span>
<span class="mainwp-right-col">
<?php
if ($website->securityIssues == 0) {
?>
<input type="button" class="securityIssues_dashboard_unfixAll button" value="<?php
_e('Unfix All', 'mainwp');
?>
"/>
<?php
} else {
?>
<input type="button" class="securityIssues_dashboard_fixAll button-primary" value="<?php
_e('Fix All', 'mainwp');
?>
"/>
<?php
}
?>
<i class="fa fa-spinner fa-pulse img-loader" style="display: none;"></i>
</span>
</div>
<?php
}
?>
</div>
</div>
<?php
} else {
esc_html_e('No security issues detected.', 'mainwp');
}
//.........这里部分代码省略.........
示例8: getLastSyncStatus
public function getLastSyncStatus($userId = null)
{
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
$websites = MainWP_DB::Instance()->query($sql);
if (!$websites) {
return 'all_synced';
}
$total_sites = 0;
$synced_sites = 0;
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (empty($website) || $website->sync_errors != '') {
continue;
}
$total_sites++;
if (time() - $website->dtsSync < 60 * 60 * 24) {
$synced_sites++;
}
}
if ($total_sites == $synced_sites) {
return 'all_synced';
} else {
if ($synced_sites == 0) {
return 'not_synced';
}
}
return false;
}