Example #1
0
    public static function render()
    {
        self::renderHeader('');
        ?>
        <a class="button-primary mwp-child-scan" href="#"><?php 
        _e('Scan', "mainwp");
        ?>
</a>
        <?php 
        $websites = MainWPDB::Instance()->query(MainWPDB::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 = @MainWPDB::fetch_object($websites))) {
                $imgfavi = "";
                if ($website !== null) {
                    if (get_option('mainwp_use_favicon', 1) == 1) {
                        $favi = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', "");
                        $favi_url = MainWPUtility::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>';
                }
            }
            @MainWPDB::free_result($websites);
            ?>
            </table>
            <?php 
        }
        ?>
    <?php 
        self::renderFooter('');
    }
Example #2
0
    function sites_fly_menu()
    {
        global $wpdb;
        $where = MainWPDB::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 = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', "");
                    $favi_url = MainWPUtility::get_favico_url($favi, $website);
                    $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:bottom;"/>&nbsp;';
                }
            }
            echo '<li class="mwp-child-site-item" value="' . $website->id . '">' . $imgfavi . '<a href="admin.php?page=managesites&dashboard=' . $website->id . '" class="mainpw-fly-meny-lnk">' . MainWPUtility::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 
        _e('Type here to filter sites', 'mainwp');
        ?>
" />
                </div>
                </div>
            </div>
        <?php 
    }
Example #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 MainWPRightNow::renderLastUpdate();
        ?>
"><?php 
        _e('<i class="fa fa-refresh"></i> Sync Data', 'mainwp');
        ?>
</a>
                    <a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><?php 
        _e('<i class="fa fa-cart-plus"></i> Get New Extensions', 'mainwp');
        ?>
</a>
                    </span>
                    <?php 
        $current_wp_id = MainWPUtility::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 = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', "");
                $favi_url = MainWPUtility::get_favico_url($favi, $website);
                $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/>&nbsp;';
            }
        }
        if (time() - ($website == null ? MainWPDB::Instance()->getFirstSyncedSite() : $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 $website == null ? __('Welcome to Your MainWP Dashboard!', 'mainwp') : sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name));
            ?>
</h3>
                    <p class="about-description"><?php 
            echo $website == null ? __('Manage your WordPress sites with ease.', 'mainwp') : sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWPUtility::getNiceURL($website->url, true));
            ?>
</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>

    <?php 
        if (empty($current_wp_id) && MainWPTwitter::enabledTwitterMessages()) {
            $filter = array('upgrade_everything', 'upgrade_all_wp_core', 'upgrade_all_plugins', 'upgrade_all_themes');
            foreach ($filter as $what) {
                $twitters = MainWPTwitter::getTwitterNotice($what);
                if (is_array($twitters)) {
                    foreach ($twitters as $timeid => $twit_mess) {
                        if (!empty($twit_mess)) {
                            $sendText = MainWPTwitter::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 
                            MainWPTwitter::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 id="dashboard-widgets-wrap">

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

    <div class="clear"></div>
    </div><!-- dashboard-widgets-wrap -->
    <?php 
    }
Example #4
0
    public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout)
    {
        ?>
    <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 class="postbox" style="padding-top: 1em;">
            <table id="mainwp-refresh-bar" width="100%">
                <tbody><tr>
                    <?php 
        $current_wp_id = MainWPUtility::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 = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', "");
                $favi_url = MainWPUtility::get_favico_url($favi, $website);
                $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/>&nbsp;';
            }
        }
        if (time() - ($website == null ? MainWPDB::Instance()->getFirstSyncedSite() : $website->dtsSync) > 60 * 60 * 24) {
            ?>
                <td id="mainwp-welcome-bar" width="47%" style="padding-left: 1em;">
                    <span class="mainwp-reminder"><?php 
            _e('Your MainWP Dashboard has not been synced for 24 hours! Click the Sync Data button to get the latest data from child sites.', 'mainwp');
            ?>
</span><br/>
                </td>
                    <?php 
        } else {
            ?>
                <td id="mainwp-welcome-bar" width="47%" style="padding-left: 1em;">
                    <span style="font-size: 24px"><?php 
            echo $website == null ? __('Welcome to Your MainWP Dashboard!', 'mainwp') : sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name));
            ?>
</span><br/>
                    <span style="font-style: italic; font-size: 14px;"><?php 
            echo $website == null ? __('Manage your WordPress sites with ease.', 'mainwp') : sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWPUtility::getNiceURL($website->url, true));
            ?>
</span>
                </td>
                    <?php 
        }
        ?>
                <td id="mainwp-refresh-bar-buttons">
                <a class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php 
        echo MainWPRightNow::renderLastUpdate();
        ?>
"><?php 
        _e('<i class="fa fa-refresh"></i> Sync Data', 'mainwp');
        ?>
</a>
                <a class="button-hero button-primary button mainwp-addsite-button" href="admin.php?page=managesites&do=new"><?php 
        _e('<i class="fa fa-plus"></i> Add New Site', 'mainwp');
        ?>
</a>
                <a class="button-hero button-primary button mainwp-button-red" target="_blank" href="https://extensions.mainwp.com"><?php 
        _e('<i class="fa fa-cart-plus"></i> Get New Extensions', 'mainwp');
        ?>
</a>
                </td>
            <div id="dashboard_refresh_statusextra" style="display: none"> <i class="fa fa-spinner fa-pulse"></i> </div>
                </tr></tbody>
            </table>
            <div id="mainwp_dashboard_refresh_status"></div>
        </div>
        <div id="mainwp_main_errors" class="mainwp_error"></div>
    </form>

    <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 = MainWPDB::Instance()->getWebsiteOption($siteObj, 'favi_icon', "");
         $favi_url = MainWPUtility::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));
 }
Example #6
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 = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser());
        $groups = MainWPDB::Instance()->getNotEmptyGroups(null, $enableOfflineSites);
        ?>
        <input type="hidden" name="select_by" id="select_by" value="<?php 
        echo count($selected_groups) > 0 ? 'group' : 'site';
        ?>
" />
        <?php 
        if ($show_select_all) {
            ?>
        <div style="float:right"><?php 
            _e('Select: ', 'mainwp');
            ?>
<a href="#" onClick="return mainwp_ss_select(this, true)"><?php 
            _e('All', 'mainwp');
            ?>
</a> | <a href="#" onClick="return mainwp_ss_select(this, false)"><?php 
            _e('None', 'mainwp');
            ?>
</a></div>
        <?php 
        }
        ?>
        <?php 
        if ($show_group) {
            ?>
        <div id="mainwp_ss_site_link" <?php 
            echo count($selected_groups) > 0 ? 'style="display: inline-block;"' : '';
            ?>
><a href="#" onClick="return mainwp_ss_select_by(this, 'site')"><?php 
            _e('By site', 'mainwp');
            ?>
</a></div><div id="mainwp_ss_site_text" <?php 
            echo count($selected_groups) > 0 ? 'style="display: none;"' : '';
            ?>
><?php 
            _e('By site', 'mainwp');
            ?>
</div> | <div id="mainwp_ss_group_link" <?php 
            echo count($selected_groups) > 0 ? 'style="display: none;"' : '';
            ?>
><a href="#" onClick="return mainwp_ss_select_by(this, 'group')"><?php 
            _e('By group', 'mainwp');
            ?>
</a></div><div id="mainwp_ss_group_text" <?php 
            echo count($selected_groups) > 0 ? 'style="display: inline-block;"' : '';
            ?>
><?php 
            _e('By group', 'mainwp');
            ?>
</div>
        <?php 
        }
        ?>
        <div id="selected_sites" <?php 
        echo count($selected_groups) > 0 ? 'style="display: none;"' : '';
        ?>
>
            <?php 
        if (!$websites) {
            echo __('<p>No websites have been found.</p>', 'mainwp');
        } else {
            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                $imgfavi = "";
                if ($website !== null) {
                    if (get_option('mainwp_use_favicon', 1) == 1) {
                        $favi = MainWPDB::Instance()->getWebsiteOption($website, 'favi_icon', "");
                        $favi_url = MainWPUtility::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 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 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>';
                }
            }
            @MainWPDB::free_result($websites);
        }
        ?>
        </div>
        <input id="selected_sites-filter" style="margin-top: .5em" type="text" value="" placeholder="Type here to filter sites" <?php 
        echo count($selected_groups) > 0 ? 'style="display: none;"' : '';
        ?>
 />
        <?php 
        if ($show_group) {
            ?>
        <div id="selected_groups" <?php 
            echo count($selected_groups) > 0 ? 'style="display: block;"' : '';
            ?>
>
            <?php 
            if (count($groups) == 0) {
                echo __('<p>No groups with entries have been found.</p>', '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 . '">' . $group->name . '</label></div>';
            }
            ?>
        </div>
        <input id="selected_groups-filter"  style="margin-top: .5em" type="text" value="" placeholder="Type here to filter groups" <?php 
            echo 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>';
        }
    }