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


PHP MainWP_Utility::getNiceURL方法代码示例

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


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

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

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

示例3: renderAllThemesTable

    public static function renderAllThemesTable($output = null)
    {
        $keyword = null;
        $search_status = 'all';
        if ($output == null) {
            $keyword = isset($_POST['keyword']) && !empty($_POST['keyword']) ? trim($_POST['keyword']) : null;
            $search_status = isset($_POST['status']) ? $_POST['status'] : 'all';
            $search_theme_status = isset($_POST['theme_status']) ? $_POST['theme_status'] : 'all';
            $output = new stdClass();
            $output->errors = array();
            $output->themes = array();
            if (get_option('mainwp_optimize') == 1) {
                //Fetch all!
                //Build websites array
                //Search in local cache
                $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
                while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                    $allThemes = json_decode($website->themes, true);
                    for ($i = 0; $i < count($allThemes); $i++) {
                        $theme = $allThemes[$i];
                        if ($search_theme_status != 'all') {
                            if ($theme['active'] == 1 && $search_theme_status !== 'active') {
                                continue;
                            } else {
                                if ($theme['active'] != 1 && $search_theme_status !== 'inactive') {
                                    continue;
                                }
                            }
                        }
                        if ($keyword != '' && stristr($theme['name'], $keyword) === false) {
                            continue;
                        }
                        $theme['websiteid'] = $website->id;
                        $theme['websiteurl'] = $website->url;
                        $output->themes[] = $theme;
                    }
                }
                @MainWP_DB::free_result($websites);
            } else {
                //Fetch all!
                //Build websites array
                $dbwebsites = array();
                $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
                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);
                $post_data = array('keyword' => $keyword);
                if ($search_theme_status == 'active' || $search_theme_status == 'inactive') {
                    $post_data['status'] = $search_theme_status;
                    $post_data['filter'] = true;
                } else {
                    $post_data['status'] = '';
                    $post_data['filter'] = false;
                }
                MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'get_all_themes', $post_data, array(MainWP_Themes::getClassName(), 'ThemesSearch_handler'), $output);
                if (count($output->errors) > 0) {
                    foreach ($output->errors as $siteid => $error) {
                        echo '<strong>Error on ' . MainWP_Utility::getNiceURL($dbwebsites[$siteid]->url) . ': ' . $error . ' <br /></strong>';
                    }
                    echo '<br />';
                }
                if (count($output->errors) == count($dbwebsites)) {
                    session_start();
                    $_SESSION['SNThemesAll'] = $output;
                    return;
                }
            }
            if (session_id() == '') {
                session_start();
            }
            $_SESSION['SNThemesAll'] = $output;
            $_SESSION['SNThemesAllStatus'] = array('keyword' => $keyword, 'status' => $search_status, 'theme_status' => $search_theme_status);
        } else {
            if (isset($_SESSION['SNThemesAllStatus'])) {
                $keyword = $_SESSION['SNThemesAllStatus']['keyword'];
                $search_status = $_SESSION['SNThemesAllStatus']['status'];
                $search_theme_status = $_SESSION['SNThemesAllStatus']['theme_status'];
            }
        }
        if (count($output->themes) == 0) {
            ?>
			No themes found
			<?php 
            return;
        }
        ?>
		<div class="alignleft">
			<select name="bulk_action" id="mainwp_bulk_action">
				<option value="none"><?php 
        _e('Choose Action', 'mainwp');
        ?>
</option>
				<option value="trust"><?php 
        _e('Trust', 'mainwp');
        ?>
</option>
				<option value="untrust"><?php 
        _e('Untrust', 'mainwp');
        ?>
//.........这里部分代码省略.........
开发者ID:jexmex,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-themes.php

示例4: 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;
    }
开发者ID:reeslo,项目名称:mainwp,代码行数:83,代码来源:class-mainwp-system.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;"/>&nbsp;';
            }
        }
        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: renderSites


//.........这里部分代码省略.........
            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>
						<span class="mainwp-mid-col">
							<a href="<?php 
            echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_published[$i]['website']->id . '&postid=' . $recent_pages_published[$i]['id']);
            ?>
" title="<?php 
            echo $recent_pages_published[$i]['comment_count'];
            ?>
" class="post-com-count" style="display: inline-block !important;">
								<span class="comment-count"><?php 
            echo $recent_pages_published[$i]['comment_count'];
            ?>
</span>
							</a>
						</span>
						<span class="mainwp-right-col">
							<a href="<?php 
            echo $recent_pages_published[$i]['website']->url;
            ?>
" target="_blank">
								<i class="fa fa-external-link"></i> <?php 
            echo MainWP_Utility::getNiceURL($recent_pages_published[$i]['website']->url);
            ?>
							</a>
							<br/>
							<?php 
            echo $recent_pages_published[$i]['dts'];
            ?>
						</span>

						<div style="clear: left;"></div>
						<div class="mainwp-row-actions">
							<a href="#" class="mainwp-post-unpublish"><?php 
            _e('Unpublish', 'mainwp');
            ?>
</a> |
							<a href="admin.php?page=SiteOpen&websiteid=<?php 
            echo $recent_pages_published[$i]['website']->id;
            ?>
&location=<?php 
            echo base64_encode('post.php?action=editpost&post=' . $recent_pages_published[$i]['id'] . '&action=edit');
            ?>
" title="Edit this post"><?php 
            _e('Edit', 'mainwp');
            ?>
</a> |
							<a href="#" class="mainwp-post-trash"><?php 
            _e('Trash', 'mainwp');
            ?>
</a>|
							<a href="<?php 
            echo $recent_pages_published[$i]['website']->url . (substr($recent_pages_published[$i]['website']->url, -1) != '/' ? '/' : '') . '?p=' . $recent_pages_published[$i]['id'];
            ?>
" target="_blank" title="View '<?php 
开发者ID:senlin,项目名称:mainwp,代码行数:67,代码来源:widget-mainwp-recent-pages.php

示例7: renderTable

    public static function renderTable($keyword, $status, $groups, $sites)
    {
        MainWP_Cache::initCache('Plugins');
        $output = new stdClass();
        $output->errors = array();
        $output->plugins = array();
        if (get_option('mainwp_optimize') == 1) {
            if ($sites != '') {
                foreach ($sites as $k => $v) {
                    if (MainWP_Utility::ctype_digit($v)) {
                        $website = MainWP_DB::Instance()->getWebsiteById($v);
                        $allPlugins = json_decode($website->plugins, true);
                        for ($i = 0; $i < count($allPlugins); $i++) {
                            $plugin = $allPlugins[$i];
                            if ($status == 'active' || $status == 'inactive') {
                                if ($plugin['active'] != ($status == 'active' ? 1 : 0)) {
                                    continue;
                                }
                            }
                            if ($keyword != '' && !stristr($plugin['name'], $keyword)) {
                                continue;
                            }
                            $plugin['websiteid'] = $website->id;
                            $plugin['websiteurl'] = $website->url;
                            $output->plugins[] = $plugin;
                        }
                    }
                }
            }
            if ($groups != '') {
                //Search in local cache
                foreach ($groups as $k => $v) {
                    if (MainWP_Utility::ctype_digit($v)) {
                        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($v));
                        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                            if ($website->sync_errors != '') {
                                continue;
                            }
                            $allPlugins = json_decode($website->plugins, true);
                            for ($i = 0; $i < count($allPlugins); $i++) {
                                $plugin = $allPlugins[$i];
                                if ($status == 'active' || $status == 'inactive') {
                                    if ($plugin['active'] != ($status == 'active' ? 1 : 0)) {
                                        continue;
                                    }
                                }
                                if ($keyword != '' && !stristr($plugin['name'], $keyword)) {
                                    continue;
                                }
                                $plugin['websiteid'] = $website->id;
                                $plugin['websiteurl'] = $website->url;
                                $output->plugins[] = $plugin;
                            }
                        }
                        @MainWP_DB::free_result($websites);
                    }
                }
            }
        } else {
            //Fetch all!
            //Build websites array
            $dbwebsites = array();
            if ($sites != '') {
                foreach ($sites as $k => $v) {
                    if (MainWP_Utility::ctype_digit($v)) {
                        $website = MainWP_DB::Instance()->getWebsiteById($v);
                        $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                    }
                }
            }
            if ($groups != '') {
                foreach ($groups as $k => $v) {
                    if (MainWP_Utility::ctype_digit($v)) {
                        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($v));
                        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);
                    }
                }
            }
            $post_data = array('keyword' => $keyword);
            if ($status == 'active' || $status == 'inactive') {
                $post_data['status'] = $status;
                $post_data['filter'] = true;
            } else {
                $post_data['status'] = '';
                $post_data['filter'] = false;
            }
            MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'get_all_plugins', $post_data, array(MainWP_Plugins::getClassName(), 'PluginsSearch_handler'), $output);
            if (count($output->errors) > 0) {
                foreach ($output->errors as $siteid => $error) {
                    echo '<strong>Error on ' . MainWP_Utility::getNiceURL($dbwebsites[$siteid]->url) . ': ' . $error . ' <br /></strong>';
                }
                echo '<br />';
            }
            if (count($output->errors) == count($dbwebsites)) {
//.........这里部分代码省略.........
开发者ID:jexmex,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-plugins.php

示例8: executeBackupTask

 public static function executeBackupTask($task, $nrOfSites = 0, $updateRun = true)
 {
     if ($updateRun) {
         MainWP_DB::Instance()->updateBackupRun($task->id);
     }
     $task = MainWP_DB::Instance()->getBackupTaskById($task->id);
     $completed_sites = $task->completed_sites;
     if ($completed_sites != '') {
         $completed_sites = json_decode($completed_sites, true);
     }
     if (!is_array($completed_sites)) {
         $completed_sites = array();
     }
     $sites = array();
     if ($task->groups == '') {
         if ($task->sites != '') {
             $sites = explode(',', $task->sites);
         }
     } else {
         $groups = explode(',', $task->groups);
         foreach ($groups as $groupid) {
             $group_sites = MainWP_DB::Instance()->getWebsitesByGroupId($groupid);
             foreach ($group_sites as $group_site) {
                 if (in_array($group_site->id, $sites)) {
                     continue;
                 }
                 $sites[] = $group_site->id;
             }
         }
     }
     $errorOutput = null;
     $lastStartNotification = $task->lastStartNotificationSent;
     if ($updateRun && get_option('mainwp_notificationOnBackupStart') == 1 && $lastStartNotification < $task->last_run) {
         $email = MainWP_DB::Instance()->getUserNotificationEmail($task->userid);
         if ($email != '') {
             $output = 'A scheduled backup has started with MainWP on ' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(time())) . ' for the following ' . count($sites) . ' sites:<br />';
             foreach ($sites as $siteid) {
                 $website = MainWP_DB::Instance()->getWebsiteById($siteid);
                 $output .= '&nbsp;&bull;&nbsp;<a href="' . $website->url . '">' . MainWP_Utility::getNiceURL($website->url) . '</a><br />';
             }
             $output .= '<br />Backup Details:<br /><br />';
             $output .= '<strong>Backup Task</strong>' . ' - ' . $task->name . '<br />';
             $output .= '<strong>Backup Type</strong>' . ' - ' . ($task->type == 'db' ? 'DATABASE BACKUP' : 'FULL BACKUP') . '<br />';
             $output .= '<strong>Backup Schedule</strong>' . ' - ' . strtoupper($task->schedule) . '<br />';
             wp_mail($email, 'A Scheduled Backup has been Started - MainWP', MainWP_Utility::formatEmail($email, $output), 'content-type: text/html');
             MainWP_DB::Instance()->updateBackupTaskWithValues($task->id, array('lastStartNotificationSent' => time()));
         }
     }
     $currentCount = 0;
     foreach ($sites as $siteid) {
         if (isset($completed_sites[$siteid]) && $completed_sites[$siteid] == true) {
             continue;
         }
         $website = MainWP_DB::Instance()->getWebsiteById($siteid);
         try {
             $subfolder = str_replace('%task%', MainWP_Utility::sanitize($task->name), $task->subfolder);
             $backupResult = MainWP_Manage_Sites::backupSite($siteid, $task, $subfolder);
             //When we receive a timeout, we return false..
             if ($backupResult === false) {
                 continue;
             }
             if ($errorOutput == null) {
                 $errorOutput = '';
             }
             $error = false;
             $tmpErrorOutput = '';
             if (isset($backupResult['error'])) {
                 $tmpErrorOutput .= $backupResult['error'] . '<br />';
                 $error = true;
             }
             if (isset($backupResult['ftp']) && $backupResult['ftp'] != 'success') {
                 $tmpErrorOutput .= 'FTP: ' . $backupResult['ftp'] . '<br />';
                 $error = true;
             }
             if (isset($backupResult['dropbox']) && $backupResult['dropbox'] != 'success') {
                 $tmpErrorOutput .= 'Dropbox: ' . $backupResult['dropbox'] . '<br />';
                 $error = true;
             }
             if (isset($backupResult['amazon']) && $backupResult['amazon'] != 'success') {
                 $tmpErrorOutput .= 'Amazon: ' . $backupResult['amazon'] . '<br />';
                 $error = true;
             }
             if ($error) {
                 $errorOutput .= 'Site: <strong>' . MainWP_Utility::getNiceURL($website->url) . '</strong><br />';
                 $errorOutput .= $tmpErrorOutput . '<br />';
             }
         } catch (Exception $e) {
             if ($errorOutput == null) {
                 $errorOutput = '';
             }
             $errorOutput .= 'Site: <strong>' . MainWP_Utility::getNiceURL($website->url) . '</strong><br />';
             $errorOutput .= MainWP_Error_Helper::getErrorMessage($e) . '<br />';
             $_error_output = MainWP_Error_Helper::getErrorMessage($e);
         }
         $_backup_result = isset($backupResult) ? $backupResult : (isset($_error_output) ? $_error_output : '');
         do_action('mainwp_managesite_schedule_backup', $website, array('type' => $task->type), $_backup_result);
         $currentCount++;
         $task = MainWP_DB::Instance()->getBackupTaskById($task->id);
         $completed_sites = $task->completed_sites;
         if ($completed_sites != '') {
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-manage-backups.php

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

示例10: backup

 public static function backup($pSiteId, $pType, $pSubfolder, $pExclude, $excludebackup, $excludecache, $excludenonwp, $excludezip, $pFilename = null, $pFileNameUID = '', $pArchiveFormat = false, $pMaximumFileDescriptorsOverride = false, $pMaximumFileDescriptorsAuto = false, $pMaximumFileDescriptors = false, $pLoadFilesBeforeZip = false, $pid = false, $append = false)
 {
     if (trim($pFilename) == '') {
         $pFilename = null;
     }
     $backup_result = array();
     //Creating a backup
     $website = MainWP_DB::Instance()->getWebsiteById($pSiteId);
     $subfolder = str_replace('%sitename%', MainWP_Utility::sanitize($website->name), $pSubfolder);
     $subfolder = str_replace('%url%', MainWP_Utility::sanitize(MainWP_Utility::getNiceURL($website->url)), $subfolder);
     $subfolder = str_replace('%type%', $pType, $subfolder);
     $subfolder = str_replace('%date%', MainWP_Utility::date('Ymd'), $subfolder);
     $subfolder = str_replace('%task%', '', $subfolder);
     $subfolder = str_replace('%', '', $subfolder);
     $subfolder = MainWP_Utility::removePreSlashSpaces($subfolder);
     $subfolder = MainWP_Utility::normalize_filename($subfolder);
     if (!MainWP_Utility::can_edit_website($website)) {
         throw new MainWP_Exception('You are not allowed to backup this site');
     }
     $websiteCleanUrl = $website->url;
     if (substr($websiteCleanUrl, -1) == '/') {
         $websiteCleanUrl = substr($websiteCleanUrl, 0, -1);
     }
     $websiteCleanUrl = str_replace(array('http://', 'https://', '/'), array('', '', '-'), $websiteCleanUrl);
     //Normal flow: use website & fallback to global
     if ($pMaximumFileDescriptorsOverride == false) {
         if ($website->maximumFileDescriptorsOverride == 1) {
             $maximumFileDescriptorsAuto = $website->maximumFileDescriptorsAuto == 1;
             $maximumFileDescriptors = $website->maximumFileDescriptors;
         } else {
             $maximumFileDescriptorsAuto = get_option('mainwp_maximumFileDescriptorsAuto');
             $maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
             $maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
         }
     } else {
         if ($pArchiveFormat != 'global' && $pMaximumFileDescriptorsOverride == 1) {
             $maximumFileDescriptorsAuto = $pMaximumFileDescriptorsAuto == 1;
             $maximumFileDescriptors = $pMaximumFileDescriptors;
         } else {
             $maximumFileDescriptorsAuto = get_option('mainwp_maximumFileDescriptorsAuto');
             $maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
             $maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
         }
     }
     $file = str_replace(array('%sitename%', '%url%', '%date%', '%time%', '%type%'), array(MainWP_Utility::sanitize($website->name), $websiteCleanUrl, MainWP_Utility::date('m-d-Y'), MainWP_Utility::date('G\\hi\\ms\\s'), $pType), $pFilename);
     $file = str_replace('%', '', $file);
     $file = MainWP_Utility::normalize_filename($file);
     //Normal flow: check site settings & fallback to global
     if ($pLoadFilesBeforeZip == false) {
         $loadFilesBeforeZip = $website->loadFilesBeforeZip;
         if ($loadFilesBeforeZip == 1) {
             $loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
             $loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
         } else {
             $loadFilesBeforeZip = $loadFilesBeforeZip == 2;
         }
     } else {
         if ($pArchiveFormat == 'global' || $pLoadFilesBeforeZip == 1) {
             $loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
             $loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
         } else {
             $loadFilesBeforeZip = $pLoadFilesBeforeZip == 2;
         }
     }
     //Nomral flow: check site settings & fallback to global
     if ($pArchiveFormat == false) {
         $archiveFormat = MainWP_Utility::getCurrentArchiveExtension($website);
     } else {
         if ($pArchiveFormat == 'global') {
             $archiveFormat = MainWP_Utility::getCurrentArchiveExtension();
         } else {
             $archiveFormat = $pArchiveFormat;
         }
     }
     MainWP_Utility::endSession();
     $information = MainWP_Utility::fetchUrlAuthed($website, 'backup', array('type' => $pType, 'exclude' => $pExclude, 'excludebackup' => $excludebackup, 'excludecache' => $excludecache, 'excludenonwp' => $excludenonwp, 'excludezip' => $excludezip, 'ext' => $archiveFormat, 'file_descriptors_auto' => $maximumFileDescriptorsAuto, 'file_descriptors' => $maximumFileDescriptors, 'loadFilesBeforeZip' => $loadFilesBeforeZip, MainWP_Utility::getFileParameter($website) => $file, 'fileUID' => $pFileNameUID, 'pid' => $pid, 'append' => $append ? 1 : 0), false, false, false);
     do_action('mainwp_managesite_backup', $website, array('type' => $pType), $information);
     if (isset($information['error'])) {
         throw new MainWP_Exception($information['error']);
     } else {
         if ($pType == 'db' && !$information['db']) {
             throw new MainWP_Exception('Database backup failed.');
         } else {
             if ($pType == 'full' && !$information['full']) {
                 throw new MainWP_Exception('Full backup failed.');
             } else {
                 if (isset($information['db'])) {
                     if ($information['db'] != false) {
                         $backup_result['url'] = $information['db'];
                         $backup_result['type'] = 'db';
                     } else {
                         if ($information['full'] != false) {
                             $backup_result['url'] = $information['full'];
                             $backup_result['type'] = 'full';
                         }
                     }
                     if (isset($information['size'])) {
                         $backup_result['size'] = $information['size'];
                     }
                     $backup_result['subfolder'] = $subfolder;
//.........这里部分代码省略.........
开发者ID:reeslo,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-manage-sites.php


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