当前位置: 首页>>代码示例>>PHP>>正文


PHP MainWP_DB::fetch_object方法代码示例

本文整理汇总了PHP中MainWP_DB::fetch_object方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_DB::fetch_object方法的具体用法?PHP MainWP_DB::fetch_object怎么用?PHP MainWP_DB::fetch_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWP_DB的用法示例。


在下文中一共展示了MainWP_DB::fetch_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: render

    public static function render()
    {
        self::renderHeader('');
        ?>
        <a class="button-primary mwp-child-scan" href="#"><?php 
        _e('Scan', 'mainwp');
        ?>
</a>
        <?php 
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        if (!$websites) {
            echo __('<p>No websites to scan.</p>', 'mainwp');
        } else {
            ?>
			<table id="mwp_child_scan_childsites">
				<tr><th>Child</th><th>Status</th></tr>
			<?php 
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                $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;"/>&nbsp;';
                    }
                }
                if ($website->sync_errors == '') {
                    echo '<tr siteid="' . $website->id . '"><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td></td></tr>';
                } else {
                    echo '<tr><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td>Sync errors</td></tr>';
                }
            }
            @MainWP_DB::free_result($websites);
            ?>
			</table>
			<?php 
        }
        ?>
    <?php 
        self::renderFooter('');
    }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:41,代码来源:page-mainwp-child-scan.php

示例3: theme

 /**
  * List information about theme upgrades
  *
  * ## OPTIONS
  *
  * [<websiteid>]
  * : The id (or ids, comma separated) of the child sites that need to be listed/upgraded, when omitted all childsites are used.
  *
  * [--list]
  * : Get a list of themes with available upgrades
  *
  * [--upgrade=<theme>]
  * : Upgrade the themes
  *
  * [--upgrade-all]
  * : Upgrade all themes
  *
  * ## EXAMPLES
  *
  *     wp mainwp theme 2,5 --list
  *     wp mainwp theme --list
  *     wp mainwp theme 2,5 --upgrade-all
  *     wp mainwp theme 2,5 --upgrade=twentysixteen
  *
  * @synopsis [<websiteid>] [--list] [--upgrade=<theme>] [--upgrade-all]
  */
 public function theme($args, $assoc_args)
 {
     $sites = array();
     if (count($args) > 0) {
         $args_exploded = explode(',', $args[0]);
         foreach ($args_exploded as $arg) {
             if (!is_numeric(trim($arg))) {
                 WP_CLI::error('Child site ids should be numeric.');
             }
             $sites[] = trim($arg);
         }
     }
     if (isset($assoc_args['list'])) {
         $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
         $userExtension = MainWP_DB::Instance()->getUserExtension();
         $websites_to_upgrade = array();
         while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
             if (count($sites) > 0 && !in_array($website->id, $sites)) {
                 continue;
             }
             $theme_upgrades = json_decode($website->theme_upgrades, true);
             if (is_array($theme_upgrades)) {
                 $ignored_themes = json_decode($website->ignored_themes, true);
                 if (is_array($ignored_themes)) {
                     $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                 }
                 $ignored_themes = json_decode($userExtension->ignored_themes, true);
                 if (is_array($ignored_themes)) {
                     $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes);
                 }
                 $tmp = array();
                 foreach ($theme_upgrades as $theme_upgrade) {
                     $tmp[] = array('name' => $theme_upgrade['update']['theme'], 'version' => $theme_upgrade['Version'], 'new_version' => $theme_upgrade['update']['new_version']);
                 }
                 $websites_to_upgrade[] = array('id' => $website->id, 'name' => $website->name, 'themes' => $tmp);
             }
         }
         $idLength = strlen('id');
         $nameLength = strlen('name');
         $themeLength = strlen('theme');
         $oldVersionLength = strlen('version');
         $newVersionLength = strlen('new version');
         foreach ($websites_to_upgrade as $website_to_upgrade) {
             if ($idLength < strlen($website_to_upgrade['id'])) {
                 $idLength = strlen($website_to_upgrade['id']);
             }
             if ($nameLength < strlen($website_to_upgrade['name'])) {
                 $nameLength = strlen($website_to_upgrade['name']);
             }
             foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) {
                 if ($themeLength < strlen($theme_to_upgrade['name'])) {
                     $themeLength = strlen($theme_to_upgrade['name']);
                 }
                 if ($oldVersionLength < strlen($theme_to_upgrade['version'])) {
                     $oldVersionLength = strlen($theme_to_upgrade['version']);
                 }
                 if ($newVersionLength < strlen($theme_to_upgrade['new_version'])) {
                     $newVersionLength = strlen($theme_to_upgrade['new_version']);
                 }
             }
         }
         WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', ''));
         WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", 'id', 'name', 'theme', 'version', 'new version'));
         WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', ''));
         foreach ($websites_to_upgrade as $website_to_upgrade) {
             if ($idLength < strlen($website_to_upgrade['id'])) {
                 $idLength = strlen($website_to_upgrade['id']);
             }
             if ($nameLength < strlen($website_to_upgrade['name'])) {
                 $nameLength = strlen($website_to_upgrade['name']);
             }
             $i = 0;
             foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) {
                 if ($i == 0) {
//.........这里部分代码省略.........
开发者ID:reeslo,项目名称:mainwp,代码行数:101,代码来源:class-mainwp-wp-cli-command.php

示例4: 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);
    }
开发者ID:jexmex,项目名称:mainwp,代码行数:85,代码来源:widget-mainwp-sync-status.php

示例5: renderChild

    public static function renderChild()
    {
        self::renderHeader('ServerInformationChild');
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        ?>
		<div class="postbox">
			<h3 class="mainwp_box_title"><?php 
        _e('Child Site Server Information', 'mainwp');
        ?>
</h3>
			<div class="inside">
				<?php 
        _e('Select Child Site: ', 'mainwp');
        ?>
				<select name="" id="mainwp_serverInformation_child" style="margin-right: 2em">
					<option value="-1"><?php 
        _e('Select Child Site', 'mainwp');
        ?>
</option>
					<?php 
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            echo '<option value="' . $website->id . '">' . stripslashes($website->name) . '</option>';
        }
        @MainWP_DB::free_result($websites);
        ?>
				</select>
				<?php 
        _e('Select Information: ', 'mainwp');
        ?>
				<select name="" id="mainwp-server-info-filter">
					<option value=""><?php 
        _e('Full Information', 'mainwp');
        ?>
</option>
					<option value="server-information"><?php 
        _e('Server Information', 'mainwp');
        ?>
</option>
					<option value="cron-schedules"><?php 
        _e('Cron Schedules', 'mainwp');
        ?>
</option>
					<option value="wp-config"><?php 
        _e('WP-Config.php', 'mainwp');
        ?>
</option>
					<option value="error-log"><?php 
        _e('Error Log', 'mainwp');
        ?>
</option>
				</select>
			</div>
		</div>
		<div id="mainwp_serverInformation_child_loading">
			<span class="mainwp-grabbing-info-note"><i class="fa fa-spinner fa-pulse"></i> <?php 
        _e('Loading server information...', 'mainwp');
        ?>
</span>
		</div>
		<div id="mainwp_serverInformation_child_resp">

		</div>
		<?php 
        self::renderFooter('ServerInformationChild');
    }
开发者ID:jexmex,项目名称:mainwp,代码行数:65,代码来源:page-mainwp-server-information.php

示例6: syncSite

 public static function syncSite(&$pWebsite = null, $pForceFetch = false, $pAllowDisconnect = true)
 {
     if ($pWebsite == null) {
         return false;
     }
     $userExtension = MainWP_DB::Instance()->getUserExtensionByUserId($pWebsite->userid);
     if ($userExtension == null) {
         return false;
     }
     MainWP_Utility::endSession();
     try {
         $pluginDir = $pWebsite->pluginDir;
         if ($pluginDir == '') {
             $pluginDir = $userExtension->pluginDir;
         }
         $cloneEnabled = apply_filters('mainwp_clone_enabled', false);
         $cloneSites = array();
         if ($cloneEnabled) {
             $disallowedCloneSites = get_option('mainwp_clone_disallowedsites');
             if ($disallowedCloneSites === false) {
                 $disallowedCloneSites = array();
             }
             $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
             if ($websites) {
                 while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                     if (in_array($website->id, $disallowedCloneSites)) {
                         continue;
                     }
                     if ($website->id == $pWebsite->id) {
                         continue;
                     }
                     $cloneSites[$website->id] = array('name' => $website->name, 'url' => $website->url, 'extauth' => $website->extauth, 'size' => $website->totalsize);
                 }
                 @MainWP_DB::free_result($websites);
             }
         }
         $pluginConflicts = get_option('mainwp_pluginConflicts');
         if ($pluginConflicts !== false) {
             $pluginConflicts = array_keys($pluginConflicts);
         }
         $themeConflicts = get_option('mainwp_themeConflicts');
         if ($themeConflicts !== false) {
             $themeConflicts = array_keys($themeConflicts);
         }
         $othersData = apply_filters('mainwp-sync-others-data', array(), $pWebsite);
         $information = MainWP_Utility::fetchUrlAuthed($pWebsite, 'stats', array('optimize' => get_option('mainwp_optimize') == 1 ? 1 : 0, 'heatMap' => MainWP_Extensions::isExtensionAvailable('mainwp-heatmap-extension') ? $userExtension->heatMap : 0, 'pluginDir' => $pluginDir, 'cloneSites' => !$cloneEnabled ? 0 : urlencode(json_encode($cloneSites)), 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts), 'othersData' => json_encode($othersData), 'server' => get_admin_url(), 'numberdaysOutdatePluginTheme' => get_option('mainwp_numberdays_Outdate_Plugin_Theme', 365)), true, $pForceFetch);
         $return = self::syncInformationArray($pWebsite, $information, '', 1, false, $pAllowDisconnect);
         return $return;
     } catch (MainWP_Exception $e) {
         $sync_errors = '';
         $offline_check_result = 1;
         if ($e->getMessage() == 'HTTPERROR') {
             $sync_errors = __('HTTP error', 'mainwp') . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : '');
             $offline_check_result = -1;
         } else {
             if ($e->getMessage() == 'NOMAINWP') {
                 $sync_errors = __('MainWP not detected', 'mainwp');
                 $offline_check_result = 1;
             }
         }
         return self::syncInformationArray($pWebsite, $information, $sync_errors, $offline_check_result, true, $pAllowDisconnect);
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:63,代码来源:class-mainwp-sync.php

示例7: hookGetSites

 /**
  * @param string $pluginFile Extension plugin file to verify
  * @param string $key The child-key
  * @param int $websiteid The id of the child-site you wish to retrieve
  * @param bool $for_manager
  *
  * @return array|bool An array of arrays, the inner-array contains the id/url/name/totalsize of the website. False when something goes wrong.
  */
 public static function hookGetSites($pluginFile, $key, $websiteid = null, $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($websiteid) && $websiteid != null) {
         $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
         if (!MainWP_Utility::can_edit_website($website)) {
             return false;
         }
         if (!mainwp_current_user_can('site', $websiteid)) {
             return false;
         }
         return array(array('id' => $websiteid, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize));
     }
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp.url', false, false, null, $for_manager));
     $output = array();
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         $output[] = array('id' => $website->id, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize);
     }
     @MainWP_DB::free_result($websites);
     return $output;
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:34,代码来源:page-mainwp-extensions.php

示例8: checkWebsite

 public static function checkWebsite()
 {
     if (!isset($_POST['websiteid'])) {
         //Check all websites
         $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
     } else {
         $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsiteById($_POST['websiteid']));
         if (!$websites) {
             return 0;
         }
     }
     $output = array();
     if (!$websites) {
         $emailOutput = '';
     } else {
         $emailOutput = null;
     }
     $errors = false;
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         if (self::performCheck($website, true, $emailOutput)) {
             $output[$website->id] = 1;
         } else {
             $output[$website->id] = -1;
             $errors = true;
         }
     }
     @MainWP_DB::free_result($websites);
     if ($emailOutput != null) {
         if ($errors) {
             $emailOutput .= '<br /><br />Please take a look at the issues and make sure everything is ok.';
         }
         $email = MainWP_DB::Instance()->getUserNotificationEmail($website->userid);
         wp_mail($email, $errors ? 'Down Time Alert - MainWP' : 'Up Time Alert - MainWP', MainWP_Utility::formatEmail($email, $emailOutput), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
     }
     return array('result' => $output);
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:36,代码来源:page-mainwp-offline-checks.php

示例9: posting

    public static function posting()
    {
        //Posts the saved sites
        ?>
		<div class="wrap">
			<h2>New Post</h2>
			<?php 
        do_action('mainwp_bulkpost_before_post', $_GET['id']);
        $skip_post = false;
        if (isset($_GET['id'])) {
            if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) {
                $skip_post = true;
                wp_delete_post($_GET['id'], true);
            }
        }
        if (!$skip_post) {
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
                $post = get_post($id);
                if ($post) {
                    //                die('<pre>'.print_r($post, 1).'</pre>');
                    $selected_by = get_post_meta($id, '_selected_by', true);
                    $selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true)));
                    $selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true)));
                    /** @deprecated */
                    $post_category = base64_decode(get_post_meta($id, '_categories', true));
                    $post_tags = base64_decode(get_post_meta($id, '_tags', true));
                    $post_slug = base64_decode(get_post_meta($id, '_slug', true));
                    $post_custom = get_post_custom($id);
                    //                if (isset($post_custom['_tags'])) $post_custom['_tags'] = base64_decode(trim($post_custom['_tags']));
                    include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
                    $post_featured_image = get_post_thumbnail_id($id);
                    $mainwp_upload_dir = wp_upload_dir();
                    $new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_tags' => $post_tags, 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID);
                    if ($post_featured_image != null) {
                        //Featured image is set, retrieve URL
                        $img = wp_get_attachment_image_src($post_featured_image, 'full');
                        $post_featured_image = $img[0];
                    }
                    $dbwebsites = array();
                    if ($selected_by == 'site') {
                        //Get all selected websites
                        foreach ($selected_sites as $k) {
                            if (MainWP_Utility::ctype_digit($k)) {
                                $website = MainWP_DB::Instance()->getWebsiteById($k);
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                        }
                    } else {
                        //Get all websites from the selected groups
                        foreach ($selected_groups as $k) {
                            if (MainWP_Utility::ctype_digit($k)) {
                                $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                                while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                    if ($website->sync_errors != '') {
                                        continue;
                                    }
                                    $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                                }
                                @MainWP_DB::free_result($websites);
                            }
                        }
                    }
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    $startTime = time();
                    if (count($dbwebsites) > 0) {
                        $post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_category' => base64_encode($post_category), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
                        MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
                    }
                    $failed_posts = array();
                    foreach ($dbwebsites as $website) {
                        if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) {
                            do_action('mainwp-post-posting-post', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null);
                            do_action('mainwp-bulkposting-done', $post, $website, $output);
                        } else {
                            $failed_posts[] = $website->id;
                        }
                    }
                    $del_post = true;
                    $saved_draft = get_post_meta($id, '_saved_as_draft', true);
                    if ($saved_draft == 'yes') {
                        if (count($failed_posts) > 0) {
                            $del_post = false;
                            update_post_meta($post->ID, '_selected_sites', base64_encode(serialize($failed_posts)));
                            update_post_meta($post->ID, '_selected_groups', '');
                            wp_update_post(array('ID' => $id, 'post_status' => 'draft'));
                        }
                    }
                    if ($del_post) {
                        wp_delete_post($id, true);
                    }
                    $countSites = 0;
                    $countRealItems = 0;
                    foreach ($dbwebsites as $website) {
                        if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
                            $countSites++;
                            $countRealItems++;
                        }
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-post.php

示例10: getWebsiteListContent

    public static function getWebsiteListContent()
    {
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            ?>
			<li class="managegroups_site-listitem">
				<input type="checkbox" name="sites" value="<?php 
            echo $website->id;
            ?>
" id="<?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
" class="mainwp-checkbox2"><label for="<?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
" class="mainwp-label2"><span class="website_url" style="display: none;"><?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
</span><span class="website_name"><?php 
            echo stripslashes($website->name);
            ?>
</span></label>
			</li>
			<?php 
        }
        @MainWP_DB::free_result($websites);
    }
开发者ID:senlin,项目名称:mainwp,代码行数:27,代码来源:page-mainwp-manage-groups.php

示例11: 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">&nbsp;</span>
					<span class="mainwp-right-col"><a href="#" id="mainwp_securityissues_show" onClick="return rightnow_show('securityissues');"><?php 
            _e('Show All', 'mainwp');
            ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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');
        }
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-security-issues.php

示例12: select_categories_box

    public static function select_categories_box($params)
    {
        $title = $params['title'];
        $type = isset($params['type']) ? $params['type'] : 'checkbox';
        $show_group = isset($params['show_group']) ? $params['show_group'] : true;
        $selected_by = !empty($params['selected_by']) ? $params['selected_by'] : 'site';
        $class = isset($params['class']) ? $params['class'] : '';
        $style = isset($params['style']) ? $params['style'] : '';
        $selected_cats = is_array($params['selected_cats']) ? $params['selected_cats'] : array();
        $prefix = $params['prefix'];
        if ($type == 'checkbox') {
            $cbox_prefix = '[]';
        }
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        $groups = MainWP_DB::Instance()->getNotEmptyGroups();
        ?>
		<div class="mainwp_select_sites_box mainwp_select_categories <?php 
        if ($class) {
            echo esc_attr($class);
        }
        ?>
 mainwp_select_sites_wrapper" style="<?php 
        if ($style) {
            echo esc_attr($style);
        }
        ?>
">
			<div class="postbox">
				<h3 class="box_title mainwp_box_title"><?php 
        echo esc_html($title ? $title : __('Select Categories', 'mainwp'));
        ?>
</h3>
				<div class="inside mainwp_inside ">
					<input type="hidden" name="select_by_<?php 
        echo esc_attr($prefix);
        ?>
" class="select_by" value="<?php 
        echo esc_attr($selected_by);
        ?>
"/>
					<?php 
        if ($show_group) {
            ?>
						<div class="mainwp_ss_site_link" <?php 
            echo esc_html($selected_by == 'group' ? 'style="display: inline-block;"' : '');
            ?>
>
							<a href="#" onClick="return mainwp_ss_cats_select_by(this, 'site')"><?php 
            esc_html_e('By site', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp_ss_site_text" <?php 
            echo esc_html($selected_by == 'group' ? 'style="display: none;"' : '');
            ?>
><?php 
            esc_html('By site', 'mainwp');
            ?>
</div> |
						<div class="mainwp_ss_group_link" <?php 
            echo esc_html($selected_by == 'group' ? 'style="display: none;"' : '');
            ?>
>
							<a href="#" onClick="return mainwp_ss_cats_select_by(this, 'group')"><?php 
            esc_html_e('By group', 'mainwp');
            ?>
</a>
						</div>
						<div class="mainwp_ss_group_text" <?php 
            echo esc_html($selected_by == 'group' ? 'style="display: inline-block;"' : '');
            ?>
><?php 
            esc_html_e('By group', 'mainwp');
            ?>
</div>
					<?php 
        }
        ?>
					<div class="selected_sites" <?php 
        echo esc_html($selected_by == 'group' ? 'style = "display: none"' : '');
        ?>
>
					<?php 
        if (!$websites) {
            echo wp_kses_post(sprintf('<p>%s</p>', __('No websites have been found.', 'mainwp')));
        } else {
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                $cats = isset($selected_cats[$website->id]) && is_array($selected_cats[$website->id]) ? $selected_cats[$website->id] : array();
                ?>
							<div class="categories_site_<?php 
                echo esc_attr($website->id);
                ?>
">
								<div class="categories_list_header">
									<div><?php 
                echo esc_html(stripslashes($website->name));
                ?>
</div>
									<label><span class="url"><?php 
                echo esc_html($website->url);
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:class-mainwp-ui.php

示例13: render

    public static function render()
    {
        $show_form = true;
        if (isset($_POST['updateadminpassword'])) {
            check_admin_referer('mainwp_updateadminpassword', 'security');
            $errors = array();
            if (isset($_POST['select_by'])) {
                $selected_sites = array();
                if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
                    foreach ($_POST['selected_sites'] as $selected) {
                        $selected_sites[] = $selected;
                    }
                }
                $selected_groups = array();
                if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
                    foreach ($_POST['selected_groups'] as $selected) {
                        $selected_groups[] = $selected;
                    }
                }
                if ($_POST['select_by'] == 'group' && count($selected_groups) == 0 || $_POST['select_by'] == 'site' && count($selected_sites) == 0) {
                    $errors[] = __('Please select the sites or groups where you want to change the admin password.', 'mainwp');
                }
            } else {
                $errors[] = __('Please select whether you want to change the admin password for specific sites or groups.', 'mainwp');
            }
            if (!isset($_POST['pass1']) || $_POST['pass1'] == '' || !isset($_POST['pass2']) || $_POST['pass2'] == '') {
                $errors[] = __('Please enter the password twice.', 'mainwp');
            } else {
                if ($_POST['pass1'] != $_POST['pass2']) {
                    $errors[] = __('Please enter the same password in the two password fields.', 'mainwp');
                }
            }
            if (count($errors) == 0) {
                $show_form = false;
                $new_password = array('user_pass' => $_POST['pass1']);
                $dbwebsites = array();
                if ($_POST['select_by'] == 'site') {
                    //Get all selected websites
                    foreach ($selected_sites as $k) {
                        if (MainWP_Utility::ctype_digit($k)) {
                            $website = MainWP_DB::Instance()->getWebsiteById($k);
                            $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                        }
                    }
                } else {
                    //Get all websites from the selected groups
                    foreach ($selected_groups as $k) {
                        if (MainWP_Utility::ctype_digit($k)) {
                            $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                if ($website->sync_errors != '') {
                                    continue;
                                }
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                            @MainWP_DB::free_result($websites);
                        }
                    }
                }
                if (count($dbwebsites) > 0) {
                    $post_data = array('new_password' => base64_encode(serialize($new_password)));
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
                }
            }
        }
        if (!$show_form) {
            //Added to..
            ?>
			<div class="wrap">
                <h2 id="add-new-user"><i class="fa fa-key"></i> Update Admin Passwords</h2>

				<div id="message" class="updated">
					<?php 
            foreach ($dbwebsites as $website) {
                ?>
						<p>
							<a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a>: <?php 
                echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? __('Admin password updated.', 'mainwp') : __('ERROR: ', 'mainwp') . $output->errors[$website->id];
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
				<br/>
				<a href="<?php 
            echo get_admin_url();
            ?>
admin.php?page=UpdateAdminPasswords" class="add-new-h2" target="_top"><?php 
            _e('Update admin passwords', 'mainwp');
            ?>
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-bulk-update-admin-passwords.php

示例14: 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;
 }
开发者ID:jorrit,项目名称:mainwp,代码行数:28,代码来源:class-mainwp-db.php

示例15: renderTest

    public static function renderTest()
    {
        if (!mainwp_current_user_can('dashboard', 'test_connection')) {
            mainwp_do_not_have_permissions(__('test connection', 'mainwp'));
            return;
        }
        ?>
            <div id="mainwp_managesites_test_errors" class="mainwp_error error"></div>
            <div id="mainwp_managesites_test_message" class="mainwp_updated updated"></div>
            <form method="POST" action="" enctype="multipart/form-data" id="mainwp_testconnection_form">
            <div class="mainwp_info-box-blue">
                <span><?php 
        _e('The Test Connection feature is specifically testing what your Dashboard can "see" and what your Dashboard "sees" and what my Dashboard "sees" or what your browser "sees" can be completely different things.', 'mainwp');
        ?>
</span>
            </div>
            <div class="postbox">
            <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Test a Site Connection', 'mainwp');
        ?>
</span></h3>
            <div class="inside">
                <table class="form-table">
                    <tr class="form-field form-required">
                        <th scope="row"><?php 
        _e('Site URL:', 'mainwp');
        ?>
</th>
                        <td>
                            <input type="text" id="mainwp_managesites_test_wpurl"
                                   name="mainwp_managesites_add_wpurl"
                                   value="<?php 
        if (isset($_REQUEST['site'])) {
            echo $_REQUEST['site'];
        }
        ?>
" autocompletelist="mainwp-test-sites" class="mainwp_autocomplete" /><span class="mainwp-form_hint">Proper Format: <strong>http://address.com/</strong> or <strong>http://www.address.com/</strong></span>
                            <datalist id="mainwp-test-sites">
								<?php 
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            echo '<option>' . $website->url . '</option>';
        }
        @MainWP_DB::free_result($websites);
        ?>
                            </datalist>
                            <br/><em><?php 
        _e('Please only use the domain URL, do not add /wp-admin.', 'mainwp');
        ?>
</em>
                        </td>
                    </tr>
                </table>
                </div>
                </div>
                <div class="postbox">
                <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Advanced Options', 'mainwp');
        ?>
</span></h3>
                <div class="inside">
                    <table class="form-table">
                    <tr class="form-field form-required">
                       <th scope="row"><?php 
        _e('Verify Certificate', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
        ?>
</th>
                        <td>
                            <select id="mainwp_managesites_test_verifycertificate" name="mainwp_managesites_test_verifycertificate">
                                 <option selected value="1"><?php 
        _e('Yes', 'mainwp');
        ?>
</option>
                                 <option value="0"><?php 
        _e('No', 'mainwp');
        ?>
</option>
                                 <option value="2"><?php 
        _e('Use Global Setting', 'mainwp');
        ?>
</option>
                             </select> <em>(<?php 
        _e('Default: Yes', 'mainwp');
        ?>
)</em>
                        </td>
                    </tr>
                    <tr class="form-field form-required">
                       <th scope="row"><?php 
        _e('SSL Version', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp'));
        ?>
</th>
                        <td>
                            <select id="mainwp_managesites_test_ssl_version" name="mainwp_managesites_test_ssl_version">
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:view-mainwp-manage-sites-view.php


注:本文中的MainWP_DB::fetch_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。