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('');
    }
Exemplo n.º 2
0
    function sites_fly_menu()
    {
        global $wpdb;
        $where = MainWP_DB::Instance()->getWhereAllowAccessSites();
        $websites = $wpdb->get_results('SELECT id,name,url FROM `' . $wpdb->prefix . 'mainwp_wp` WHERE 1 ' . $where);
        ?>
		<div id="mainwp-sites-menu" style="direction: rtl;">
			<div style="direction: ltr;">
				<ul>
					<?php 
        foreach ($websites as $website) {
            $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:bottom;"/>&nbsp;';
                }
            }
            echo wp_kses_post('<li class="mwp-child-site-item" value="' . $website->id . '">' . $imgfavi . '<a href="admin.php?page=managesites&dashboard=' . $website->id . '" class="mainpw-fly-meny-lnk">' . MainWP_Utility::getNiceURL($website->url) . '</a></li>');
        }
        ?>
				</ul>
				<div id="mainwp-sites-menu-filter">
					<input id="mainwp-fly-manu-filter" style="margin-top: .5em; width: 100%;" type="text" value="" placeholder="<?php 
        esc_attr_e('Type here to filter sites', 'mainwp');
        ?>
" />
				</div>
			</div>
		</div>
		<?php 
    }
Exemplo n.º 3
0
    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>
										<?php 
                } else {
                    ?>
										<h3><i class="fa fa-flag"></i> <?php 
                    echo __("Some child sites didn't sync correctly!", 'mainwp');
                    ?>
</h3>
										<p class="about-description"><?php 
                    echo __('Check the Sync Status widget to review sites that have not been synced.', 'mainwp');
                    ?>
</p>
										<?php 
                }
            }
        }
        ?>
							</div>
							<br/>
							<span style="float: right; margin-right: 1em;"><a id="mainwp-link-showhide-welcome-shortcuts" status="<?php 
        echo $hide_shortcuts ? 'hide' : 'show';
        ?>
" href="#"><?php 
        echo $hide_shortcuts ? __('Show Shortcuts', 'mainwp') : __('Hide Shortcuts', 'mainwp');
        ?>
</a></span>

							<div id="mainwp-welcome-bar-shotcuts" style="clear: both;<?php 
        echo $hide_shortcuts ? 'display: none;' : '';
        ?>
">
								<div class="welcome-panel-column">
									<h4><?php 
        _e('Get Started', 'mainwp');
        ?>
</h4>
									<ul>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=managesites&do=new"><i class="fa fa-globe"></i> <?php 
        _e('Add New Site', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=ManageGroups"><i class="fa fa-globe"></i> <?php 
        _e('Create Child Site Groups', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=ManageBackupsAddNew"><i class="fa fa-hdd-o"></i> <?php 
        _e('Schedule Backups', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=Settings"><i class="fa fa-cogs"></i> <?php 
        _e('Check MainWP Settings', 'mainwp');
        ?>
											</a></li>

									</ul>
								</div>
								<div class="welcome-panel-column">
									<h4><?php 
        _e('Next Steps', 'mainwp');
        ?>
</h4>
									<ul>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=PostBulkAdd"><i class="fa fa-file-text"></i> <?php 
        _e('Add Post to Child Site(s)', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=PageBulkAdd"><i class="fa fa-file"></i> <?php 
        _e('Add Page to Child Site(s)', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=PluginsInstall"><i class="fa fa-plug"></i> <?php 
        _e('Add Plugin to Child Site(s)', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=ThemesInstall"><i class="fa fa-paint-brush"></i> <?php 
        _e('Add Theme to Child Site(s)', 'mainwp');
        ?>
											</a></li>
									</ul>
								</div>
								<div class="welcome-panel-column welcome-panel-last">
									<h4><?php 
        _e('More Actions', 'mainwp');
        ?>
</h4>
									<ul>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=managesites&do=test"><i class="fa fa-globe"></i> <?php 
        _e('Test Connection', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=Extensions"><i class="fa fa-plug"></i> <?php 
        _e('Manage Extensions', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=ServerInformation"><i class="fa fa-server"></i> <?php 
        _e('Check MainWP Requirements', 'mainwp');
        ?>
											</a></li>
										<li>
											<a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=DashboardOptions"><i class="fa fa-cogs"></i> <?php 
        _e('Set Your Preferences', 'mainwp');
        ?>
											</a></li>
									</ul>
								</div>
							</div>
							<div id="dashboard_refresh_statusextra" style="display: none">
								<i class="fa fa-spinner fa-pulse"></i></div>
			</div>
			<div id="mainwp_dashboard_refresh_status"></div>
			</td></tr></tbody>
			</table>
			</div>
			<div id="mainwp_main_errors" class="mainwp_error"></div>
		</form>

		<div id="mainwp-dashboard-info-box">
		<?php 
        if (empty($current_wp_id) && MainWP_Twitter::enabledTwitterMessages()) {
            $filter = array('upgrade_everything', 'upgrade_all_wp_core', 'upgrade_all_plugins', 'upgrade_all_themes');
            foreach ($filter as $what) {
                $twitters = MainWP_Twitter::getTwitterNotice($what);
                if (is_array($twitters)) {
                    foreach ($twitters as $timeid => $twit_mess) {
                        $sendText = "";
                        if (!empty($twit_mess)) {
                            if (!empty($sendText)) {
                                $sendText = MainWP_Twitter::getTwitToSend($what, $timeid);
                                ?>
								<div class="mainwp-tips mainwp_info-box-blue twitter">
									<span class="mainwp-tip" twit-what="<?php 
                                echo $what;
                                ?>
"
										  twit-id="<?php 
                                echo $timeid;
                                ?>
"><?php 
                                echo $twit_mess;
                                ?>
</span>&nbsp;<?php 
                                MainWP_Twitter::genTwitterButton($sendText);
                                ?>
									<span><a href="#" class="mainwp-dismiss-twit"><i
												class="fa fa-times-circle"></i> <?php 
                                _e('Dismiss', 'mainwp');
                                ?>
										</a></span></div>
								<?php 
                            }
                        }
                    }
                }
            }
            ?>
		<?php 
        }
        ?>
		</div>


		<div id="dashboard-widgets-wrap">

			<?php 
        require_once ABSPATH . 'wp-admin/includes/dashboard.php';
        wp_dashboard();
        ?>

			<div class="clear"></div>
		</div><!-- dashboard-widgets-wrap -->
		<?php 
    }
 function column_site($item)
 {
     $actions = array('dashboard' => sprintf('<a href="admin.php?page=managesites&dashboard=%s">' . __('Dashboard', 'mainwp') . '</a>', $item['id']), 'edit' => sprintf('<a href="admin.php?page=managesites&id=%s">' . __('Edit', 'mainwp') . '</a>', $item['id']), 'delete' => sprintf('<a class="submitdelete" href="#" onClick="return managesites_remove(' . "'" . '%s' . "'" . ');">' . __('Delete', 'mainwp') . '</a>', $item['id']));
     if (!mainwp_current_user_can('dashboard', 'access_individual_dashboard')) {
         unset($actions['dashboard']);
     }
     if (!mainwp_current_user_can('dashboard', 'edit_sites')) {
         unset($actions['edit']);
     }
     if (!mainwp_current_user_can('dashboard', 'delete_sites')) {
         unset($actions['delete']);
     }
     if ($item['sync_errors'] != '') {
         $actions['reconnect'] = sprintf('<a class="mainwp_site_reconnect" href="#" siteid="%s">' . __('Reconnect', 'mainwp') . '</a>', $item['id']);
     }
     $imgfavi = '';
     if (get_option('mainwp_use_favicon', 1) == 1) {
         $siteObj = (object) $item;
         $favi = MainWP_DB::Instance()->getWebsiteOption($siteObj, 'favi_icon', '');
         $favi_url = MainWP_Utility::get_favico_url($favi, $siteObj);
         $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/>&nbsp;';
     }
     $loader = '<span class="bulk_running"><i class="fa fa-spinner fa-pulse" style="display:none"></i><span class="status hidden"></span></span>';
     return $imgfavi . sprintf('<a href="admin.php?page=managesites&dashboard=%s" id="mainwp_notes_%s_url">%s</a>%s' . $loader, $item['id'], $item['id'], stripslashes($item['name']), $this->row_actions($actions));
 }
Exemplo n.º 5
0
    public static function select_sites_box_body(&$selected_websites = array(), &$selected_groups = array(), $type = 'checkbox', $show_group = true, $show_select_all = true, $updateQty = false, $enableOfflineSites = false)
    {
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        $groups = MainWP_DB::Instance()->getNotEmptyGroups(null, $enableOfflineSites);
        ?>
        <input type="hidden" name="select_by" id="select_by" value="<?php 
        echo esc_attr(count($selected_groups) > 0 ? 'group' : 'site');
        ?>
"/>
		<?php 
        if ($show_select_all) {
            ?>
			<div style="float:right"><?php 
            esc_html_e('Select: ', 'mainwp');
            ?>
				<a href="#" onClick="return mainwp_ss_select(this, true)"><?php 
            esc_html_e('All', 'mainwp');
            ?>
</a>
				| <a href="#" onClick="return mainwp_ss_select(this, false)"><?php 
            esc_html_e('None', 'mainwp');
            ?>
</a>
			</div>
		<?php 
        }
        ?>
		<?php 
        if ($show_group) {
            ?>
			<div id="mainwp_ss_site_link" <?php 
            echo esc_html(count($selected_groups) > 0 ? 'style="display: inline-block;"' : '');
            ?>
>
				<a href="#" onClick="return mainwp_ss_select_by(this, 'site')"><?php 
            esc_html_e('By site', 'mainwp');
            ?>
</a>
			</div>
			<div id="mainwp_ss_site_text" <?php 
            echo esc_html(count($selected_groups) > 0 ? 'style="display: none;"' : '');
            ?>
>
				<?php 
            esc_html_e('By site', 'mainwp');
            ?>
</div> |
			<div id="mainwp_ss_group_link" <?php 
            echo esc_html(count($selected_groups) > 0 ? 'style="display: none;"' : '');
            ?>
>
				<a href="#" onClick="return mainwp_ss_select_by(this, 'group')"><?php 
            esc_html_e('By group', 'mainwp');
            ?>
</a>
			</div>
			<div id="mainwp_ss_group_text" <?php 
            echo esc_html(count($selected_groups) > 0 ? 'style="display: inline-block;"' : '');
            ?>
>
				<?php 
            esc_html_e('By group', 'mainwp');
            ?>
			</div>
		<?php 
        }
        ?>
		<div id="selected_sites" <?php 
        echo esc_html(count($selected_groups) > 0 ? 'style="display: none;"' : '');
        ?>
>
			<?php 
        if (!$websites) {
            echo '<p>' . esc_html('No websites have been found.', 'mainwp') . '</p>';
        } else {
            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 == '' || $enableOfflineSites) {
                    $selected = $selected_websites == 'all' || in_array($website->id, $selected_websites);
                    echo '<div title="' . $website->url . '" class="mainwp_selected_sites_item ' . ($selected ? 'selected_sites_item_checked' : '') . '"><input onClick="mainwp_site_select(this)" type="' . $type . '" name="' . ($type == 'radio' ? 'selected_site' : 'selected_sites[]') . '" siteid="' . $website->id . '" value="' . $website->id . '" id="selected_sites_' . $website->id . '" ' . ($selected ? 'checked="true"' : '') . '/> <label for="selected_sites_' . $website->id . '">' . $imgfavi . stripslashes($website->name) . '<span class="url">' . $website->url . '</span>' . '</label></div>';
                } else {
                    echo '<div title="' . $website->url . '" class="mainwp_selected_sites_item disabled"><input type="' . $type . '" disabled=disabled /> <label for="selected_sites_' . $website->id . '">' . $imgfavi . stripslashes($website->name) . '<span class="url">' . $website->url . '</span>' . '</label></div>';
                }
            }
            @MainWP_DB::free_result($websites);
        }
        ?>
		</div>
		<input id="selected_sites-filter" style="margin-top: .5em" type="text" value="" placeholder="<?php 
        esc_attr_e('Type here to filter sites', 'mainwp');
        ?>
" <?php 
        echo esc_attr(count($selected_groups) > 0 ? 'style="display: none;"' : '');
        ?>
 />
		<?php 
        if ($show_group) {
            ?>
			<div id="selected_groups" <?php 
            echo esc_html(count($selected_groups) > 0 ? 'style="display: block;"' : '');
            ?>
>
				<?php 
            if (count($groups) == 0) {
                echo wp_kses_post(sprintf('<p>%s</p>', __('No groups with entries have been found.', 'mainwp')));
            }
            foreach ($groups as $group) {
                $selected = in_array($group->id, $selected_groups);
                echo '<div class="mainwp_selected_groups_item ' . ($selected ? 'selected_groups_item_checked' : '') . '"><input onClick="mainwp_group_select(this)" type="' . $type . '" name="' . ($type == 'radio' ? 'selected_group' : 'selected_groups[]') . '" value="' . $group->id . '" id="selected_groups_' . $group->id . '" ' . ($selected ? 'checked="true"' : '') . '/> <label for="selected_groups_' . $group->id . '">' . stripslashes($group->name) . '</label></div>';
            }
            ?>
            </div>
		<input id="selected_groups-filter" style="margin-top: .5em" type="text" value="" placeholder="<?php 
            esc_attr_e('Type here to filter groups', 'mainwp');
            ?>
" <?php 
            echo esc_attr(count($selected_groups) > 0 ? 'style="display: block;"' : '');
            ?>
 />
		<?php 
        }
        ?>
		<?php 
        if ($updateQty) {
            echo '<script>jQuery(document).ready(function () {jQuery(".mainwp_sites_selectcount").html(' . (!is_array($selected_websites) ? '0' : count($selected_websites)) . ');});</script>';
        }
    }