コード例 #1
0
 public static function handleSettingsPost()
 {
     if (isset($_POST['submit'])) {
         $userExtension = MainWPDB::Instance()->getUserExtension();
         $userExtension->user_email = $_POST['mainwp_options_email'];
         $userExtension->site_view = !isset($_POST['mainwp_options_siteview']) ? 0 : 1;
         $userExtension->heatMap = !isset($_POST['mainwp_options_footprint_heatmap']) ? 1 : 0;
         $userExtension->pluginDir = isset($_POST['mainwp_options_footprint_plugin_folder']) ? $_POST['mainwp_options_footprint_plugin_folder'] : 'default';
         MainWPDB::Instance()->updateUserExtension($userExtension);
         if (MainWPUtility::isAdmin()) {
             MainWPUtility::update_option('mainwp_optimize', !isset($_POST['mainwp_optimize']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_seo', !isset($_POST['mainwp_seo']) ? 0 : 1);
             $val = !isset($_POST['mainwp_automaticDailyUpdate']) ? 2 : $_POST['mainwp_automaticDailyUpdate'];
             MainWPUtility::update_option('mainwp_automaticDailyUpdate', $val);
             $val = !isset($_POST['mainwp_backup_before_upgrade']) ? 0 : 1;
             MainWPUtility::update_option('mainwp_backup_before_upgrade', $val);
             MainWPUtility::update_option('mainwp_maximumPosts', $_POST['mainwp_maximumPosts']);
             MainWPUtility::update_option('mainwp_maximumComments', $_POST['mainwp_maximumComments']);
             MainWPUtility::update_option('mainwp_cron_jobs', !isset($_POST['mainwp_options_cron_jobs']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_wp_cron', !isset($_POST['mainwp_options_wp_cron']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_use_favicon', !isset($_POST['mainwp_use_favicon']) ? 0 : 1);
         }
         return true;
     }
     return false;
 }
コード例 #2
0
    public static function renderActionLogs()
    {
        self::renderHeader('Action logs');
        if (isset($_REQUEST['actionlogs_status'])) {
            if ($_REQUEST['actionlogs_status'] != MainWPLogger::DISABLED) {
                MainWPLogger::Instance()->setLogPriority($_REQUEST['actionlogs_status']);
            }
            MainWPLogger::Instance()->log('Action logs set to: ' . MainWPLogger::Instance()->getLogText($_REQUEST['actionlogs_status']), MainWPLogger::LOG);
            if ($_REQUEST['actionlogs_status'] == MainWPLogger::DISABLED) {
                MainWPLogger::Instance()->setLogPriority($_REQUEST['actionlogs_status']);
            }
            MainWPUtility::update_option('mainwp_actionlogs', $_REQUEST['actionlogs_status']);
        }
        $enabled = get_option('mainwp_actionlogs');
        if ($enabled === false) {
            $enabled = MainWPLogger::DISABLED;
        }
        ?>
        <div class="postbox" id="mainwp-code-display">
            <h3 class="hndle" style="padding: 8px 12px; font-size: 14px;"><span>Action logs</span></h3>
            <div style="padding: 1em;"><form method="POST" action="">
                Status:
                <select name="actionlogs_status">
                    <option value="<?php 
        echo MainWPLogger::DISABLED;
        ?>
" <?php 
        if (MainWPLogger::DISABLED == $enabled) {
            echo 'selected';
        }
        ?>
>Disabled</option>
                    <option value="<?php 
        echo MainWPLogger::WARNING;
        ?>
" <?php 
        if (MainWPLogger::WARNING == $enabled) {
            echo 'selected';
        }
        ?>
>Warning</option>
                    <option value="<?php 
        echo MainWPLogger::INFO;
        ?>
" <?php 
        if (MainWPLogger::INFO == $enabled) {
            echo 'selected';
        }
        ?>
>Info</option>
                    <option value="<?php 
        echo MainWPLogger::DEBUG;
        ?>
" <?php 
        if (MainWPLogger::DEBUG == $enabled) {
            echo 'selected';
        }
        ?>
>Debug</option>
                </select> <input type="submit" class="button button-primary" value="Save" />
            </form></div>
            <div style="padding: 1em;"><?php 
        MainWPLogger::showLog();
        ?>
</div>
        </div>
        <?php 
        self::renderFooter('Action logs');
    }
コード例 #3
0
 function secure_request($action = '', $query_arg = 'security')
 {
     if (!MainWPUtility::isAdmin()) {
         die(0);
     }
     if ($action == '') {
         return;
     }
     if (!$this->check_security($action, $query_arg)) {
         die(json_encode(array('error' => 'Invalid request')));
     }
     if (isset($_POST['dts'])) {
         $ajaxPosts = get_option('mainwp_ajaxposts');
         if (!is_array($ajaxPosts)) {
             $ajaxPosts = array();
         }
         //If already processed, just quit!
         if (isset($ajaxPosts[$action]) && $ajaxPosts[$action] == $_POST['dts']) {
             die(json_encode(array('error' => 'Double request')));
         }
         $ajaxPosts[$action] = $_POST['dts'];
         MainWPUtility::update_option('mainwp_ajaxposts', $ajaxPosts);
     }
 }
コード例 #4
0
 public static function changeDefaultView()
 {
     if (!isset($_POST['view'])) {
         throw new Exception(__('Invalid Request'));
     }
     if ($_POST['view'] == 'list') {
         MainWPUtility::update_option('mainwp_extension_widget_view', 'list');
     } else {
         MainWPUtility::update_option('mainwp_extension_widget_view', 'grid');
     }
     return array('result' => 'SUCCESS');
 }
コード例 #5
0
ファイル: MainWPSystem.class.php プロジェクト: sdmtt/mainwp
 function activation()
 {
     delete_option('mainwp_requests');
     MainWPDB::Instance()->update();
     MainWPDB::Instance()->install();
     //Redirect to settings page
     MainWPUtility::update_option('mainwp_activated', 'yes');
 }
コード例 #6
0
 public static function handleSettingsPost()
 {
     if (MainWPUtility::isAdmin()) {
         if (isset($_POST['submit'])) {
             if (MainWPUtility::ctype_digit($_POST['mainwp_options_backupOnServer']) && $_POST['mainwp_options_backupOnServer'] > 0) {
                 MainWPUtility::update_option('mainwp_backupsOnServer', $_POST['mainwp_options_backupOnServer']);
             }
             if (MainWPUtility::ctype_digit($_POST['mainwp_options_maximumFileDescriptors']) && $_POST['mainwp_options_maximumFileDescriptors'] > -1) {
                 MainWPUtility::update_option('mainwp_maximumFileDescriptors', $_POST['mainwp_options_maximumFileDescriptors']);
             }
             MainWPUtility::update_option('mainwp_maximumFileDescriptorsAuto', !isset($_POST['mainwp_maximumFileDescriptorsAuto']) ? 0 : 1);
             if (MainWPUtility::ctype_digit($_POST['mainwp_options_backupOnExternalSources']) && $_POST['mainwp_options_backupOnExternalSources'] >= 0) {
                 MainWPUtility::update_option('mainwp_backupOnExternalSources', $_POST['mainwp_options_backupOnExternalSources']);
             }
             MainWPUtility::update_option('mainwp_archiveFormat', $_POST['mainwp_archiveFormat']);
             MainWPUtility::update_option('mainwp_options_loadFilesBeforeZip', !isset($_POST['mainwp_options_loadFilesBeforeZip']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_notificationOnBackupFail', !isset($_POST['mainwp_options_notificationOnBackupFail']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_notificationOnBackupStart', !isset($_POST['mainwp_options_notificationOnBackupStart']) ? 0 : 1);
             MainWPUtility::update_option('mainwp_chunkedBackupTasks', !isset($_POST['mainwp_options_chunkedBackupTasks']) ? 0 : 1);
             return true;
         }
     }
     return false;
 }
コード例 #7
0
ファイル: MainWPDB.class.php プロジェクト: HasClass0/mainwp
 function post_update()
 {
     $currentVersion = get_site_option('mainwp_db_version');
     if ($currentVersion === false) {
         return;
     }
     if (version_compare($currentVersion, '2.5', '<')) {
         $requests = array('lastRequest' => time(), 'requests' => base64_encode(serialize(array('main' => MainWPSystem::Instance()->getAPIStatus()))));
         MainWPUtility::update_option('mainwp_requests', $requests);
     }
     if (version_compare($currentVersion, '2.8', '<')) {
         $this->wpdb->update($this->tableName('wp_backup'), array('subfolder' => 'MainWP Backups/%url%/%type%/%date%'), array('template' => '0'));
     }
     if (version_compare($currentVersion, '4.3', '<')) {
         $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('users'), OBJECT);
         if ($row != null) {
             $row->userid = 0;
             $this->updateUserExtension($row);
         }
     }
     if (version_compare($currentVersion, '5.3', '<')) {
         if (MainWPSystem::Instance()->isSingleUser()) {
             $row = $this->wpdb->get_row('SELECT * FROM ' . $this->tableName('ga'), OBJECT);
             $this->wpdb->update($this->tableName('ga'), array('userid' => 0), array('userid' => $row->userid));
         }
     }
     if (version_compare($currentVersion, '6.0', '=')) {
         $this->wpdb->query('ALTER TABLE ' . $this->tableName('request_log') . ' CHANGE micro_timestamp_stop micro_timestamp_stop DECIMAL( 12, 2 ) NOT NULL DEFAULT 0');
         $this->wpdb->query('ALTER TABLE ' . $this->tableName('request_log') . ' CHANGE micro_timestamp_start micro_timestamp_start DECIMAL( 12, 2 ) NOT NULL DEFAULT 0');
         $this->wpdb->query('DELETE FROM ' . $this->tableName('request_log') . ' WHERE 1 ');
     }
     if (version_compare($currentVersion, '6.2', '<')) {
         $options = array('mainwp_db_version', 'mainwp_requests', 'mainwp_plugin_version', 'mainwp_upgradeVersionInfo', 'mainwp_cron_last_offlinecheck', 'mainwp_cron_last_updatescheck', 'mainwp_automaticUpdate_backupChecks', 'mainwp_updatescheck_mail_update_core_new', 'mainwp_updatescheck_mail_update_plugins_new', 'mainwp_updatescheck_mail_update_themes_new', 'mainwp_updatescheck_mail_update_core', 'mainwp_updatescheck_mail_update_plugins', 'mainwp_updatescheck_mail_update_themes', 'mainwp_updatescheck_mail_ignore_core', 'mainwp_updatescheck_mail_ignore_plugins', 'mainwp_updatescheck_mail_ignore_themes', 'mainwp_updatescheck_mail_ignore_core_new', 'mainwp_updatescheck_mail_ignore_plugins_new', 'mainwp_updatescheck_mail_ignore_themes_new', 'mainwp_updatescheck_mail_pluginconflicts', 'mainwp_updatescheck_mail_themeconflicts', 'mainwp_updatescheck_last', 'mainwp_updatescheck_mail_email', 'mainwp_cron_last_ping', 'mainwp_cron_last_cronconflicts', 'mainwp_pluginConflicts', 'mainwp_themeConflicts', 'mainwp_cron_last_backups_continue', 'mainwp_cron_last_backups', 'mainwp_cron_last_stats', 'mainwp_backupsOnServer', 'mainwp_maximumFileDescriptors', 'mainwp_backupOnExternalSources', 'mainwp_notificationOnBackupFail', 'mainwp_notificationOnBackupStart', 'mainwp_chunkedBackupTasks', 'mainwp_maximumRequests', 'mainwp_minimumDelay', 'mainwp_maximumIPRequests', 'mainwp_minimumIPDelay', 'mainwp_extensions', 'mainwp_extloaded', 'mainwp_api_username', 'mainwp_api_password', 'mainwp_extension_widget_view', 'mainwp_news', 'mainwp_news_timestamp', 'mainwp_optimize', 'mainwp_seo', 'mainwp_automaticDailyUpdate', 'mainwp_backup_before_upgrade', 'mainwp_maximumPosts', 'mainwp_maximumComments', 'mainwp_cron_jobs', 'mainwp_wp_cron');
         foreach ($options as $option) {
             MainWPUtility::fix_option($option);
         }
     }
     if (version_compare($currentVersion, '7.3', '<')) {
         //get all sites
         $sites = $this->wpdb->get_results('SELECT id FROM ' . $this->tableName('wp'));
         if (!empty($sites)) {
             foreach ($sites as $site) {
                 $this->wpdb->insert($this->tableName('wp_settings_backup'), array('wpid' => $site->id, 'archiveFormat' => 'global'));
             }
         }
     }
     if (version_compare($currentVersion, '8', '<')) {
         $apiPass = get_option('mainwp_api_password');
         MainWPUtility::update_option('mainwp_api_password', MainWPUtility::encrypt($apiPass, 'MainWPAPI'));
     }
     if (version_compare($currentVersion, '8.1', '<')) {
         //We can't split up here!
         $wpSyncColumns = array('version', 'totalsize', 'dbsize', 'extauth', 'last_post_gmt', 'uptodate', 'sync_errors', 'dtsSync', 'dtsSyncStart', 'dtsAutomaticSync', 'dtsAutomaticSyncStart');
         foreach ($wpSyncColumns as $wpSyncColumn) {
             $rslts = $this->wpdb->get_results('SELECT id,' . $wpSyncColumn . ' FROM ' . $this->tableName('wp'), ARRAY_A);
             if (empty($rslts)) {
                 continue;
             }
             foreach ($rslts as $rslt) {
                 $exists = $this->wpdb->get_results('SELECT wpid FROM ' . $this->tableName('wp_sync') . ' WHERE wpid = ' . $rslt['id'], ARRAY_A);
                 if (empty($exists)) {
                     $this->wpdb->insert($this->tableName('wp_sync'), array('wpid' => $rslt['id'], $wpSyncColumn => $rslt[$wpSyncColumn]));
                 } else {
                     $this->wpdb->update($this->tableName('wp_sync'), array($wpSyncColumn => $rslt[$wpSyncColumn]), array('wpid' => $rslt['id']));
                 }
             }
             $suppress = $this->wpdb->suppress_errors();
             $this->wpdb->query('ALTER TABLE ' . $this->tableName('wp') . ' DROP COLUMN ' . $wpSyncColumn);
             $this->wpdb->suppress_errors($suppress);
         }
         $optionColumns = array('last_wp_upgrades', 'last_plugin_upgrades', 'last_theme_upgrades', 'wp_upgrades', 'recent_comments', 'recent_posts', 'recent_pages');
         foreach ($optionColumns as $optionColumn) {
             $rslts = $this->wpdb->get_results('SELECT id,' . $optionColumn . ' FROM ' . $this->tableName('wp'), ARRAY_A);
             if (empty($rslts)) {
                 continue;
             }
             foreach ($rslts as $rslt) {
                 MainWPDB::updateWebsiteOption((object) $rslt, $optionColumn, $rslt[$optionColumn]);
             }
             $suppress = $this->wpdb->suppress_errors();
             $this->wpdb->query('ALTER TABLE ' . $this->tableName('wp') . ' DROP COLUMN ' . $optionColumn);
             $this->wpdb->suppress_errors($suppress);
         }
     }
 }
コード例 #8
0
ファイル: MainWPSettings.page.php プロジェクト: BjornW/mainwp
    public static function renderAdvanced()
    {
        if (!mainwp_current_user_can("dashboard", "manage_dashboard_settings")) {
            mainwp_do_not_have_permissions("manage dashboard settings");
            return;
        }
        if (isset($_POST['submit'])) {
            MainWPUtility::update_option('mainwp_maximumRequests', $_POST['mainwp_maximumRequests']);
            MainWPUtility::update_option('mainwp_minimumDelay', $_POST['mainwp_minimumDelay']);
            MainWPUtility::update_option('mainwp_maximumIPRequests', $_POST['mainwp_maximumIPRequests']);
            MainWPUtility::update_option('mainwp_minimumIPDelay', $_POST['mainwp_minimumIPDelay']);
            MainWPUtility::update_option('mainwp_sslVerifyCertificate', isset($_POST['mainwp_sslVerifyCertificate']) ? 1 : 0);
        }
        self::renderHeader('Advanced');
        ?>
    <form method="POST" action="" id="mainwp-settings-page-form">
    <div class="postbox" id="mainwp-advanced-options">
        <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Cross IP Settings', 'mainwp');
        ?>
</span></h3>
        <div class="inside">

        <table class="form-table">
            <tbody>
                <tr>
                    <th scope="row"><?php 
        _e('Maximum simultaneous requests', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Maximum simultaneous requests. When too many requests are sent out, they will begin to time out. This will cause child sites to be shown as offline while they are online. With a typical shared host you should set this at 4, set to 0 for unlimited.', 'mainwp'));
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_maximumRequests" class="mainwp-field mainwp-settings-icon"
                               id="mainwp_maximumRequests" value="<?php 
        echo get_option('mainwp_maximumRequests') === false ? 4 : get_option('mainwp_maximumRequests');
        ?>
"/> <i>Default: 4</i>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Minimum delay between requests (milliseconds)', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Minimum delay between requests (milliseconds). With a typical shared host you should set this at 200.', 'mainwp'));
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_minimumDelay"  class="mainwp-field mainwp-settings-icon"
                               id="mainwp_minimumDelay" value="<?php 
        echo get_option('mainwp_minimumDelay') === false ? 200 : get_option('mainwp_minimumDelay');
        ?>
"/> <i>Default: 200</i>
                    </td>
                </tr>
                 </tbody>
        </table>
        </div>
    </div>
    <div class="postbox" id="mainwp-advanced-options">
        <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('IP Settings', 'mainwp');
        ?>
</span></h3>
        <div class="inside">
        <table class="form-table">
            <tbody>
                <tr>
                    <th scope="row"><?php 
        _e('Maximum simultaneous requests per ip', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Maximum simultaneous requests per IP. When too many requests are sent out, they will begin to time out. This will cause child sites to be shown as offline while they are online. With a typical shared host you should set this at 1, set to 0 for unlimited.', 'mainwp'));
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_maximumIPRequests"  class="mainwp-field mainwp-settings-icon"
                               id="mainwp_maximumIPRequests" value="<?php 
        echo get_option('mainwp_maximumIPRequests') === false ? 1 : get_option('mainwp_maximumIPRequests');
        ?>
"/> <i>Default: 1</i>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><?php 
        _e('Minimum delay between requests to the same ip (milliseconds)', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Minimum delay between requests (milliseconds) per IP. With a typical shared host you should set this at 1000.', 'mainwp'));
        ?>
</th>
                    <td>
                        <input type="text" name="mainwp_minimumIPDelay"  class="mainwp-field mainwp-settings-icon"
                               id="mainwp_minimumIPDelay" value="<?php 
        echo get_option('mainwp_minimumIPDelay') === false ? 1000 : get_option('mainwp_minimumIPDelay');
        ?>
"/> <i>Default: 1000</i>
                    </td>
                </tr>
                </tbody>
        </table>
        </div>
    </div>
    <div class="postbox" id="mainwp-advanced-options">
        <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('SSL Settings', 'mainwp');
        ?>
</span></h3>
        <div class="inside">
        <table class="form-table">
            </tbody>
                <tr><th scope="row"><?php 
        _e('Verify certificate', 'mainwp');
        ?>
 <?php 
        MainWPUtility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
        ?>
</th>
                   <td  style="width: 100px;">
                        <div class="mainwp-checkbox">
                            <input type="checkbox" name="mainwp_sslVerifyCertificate"
                               id="mainwp_sslVerifyCertificate" value="checked" <?php 
        echo get_option('mainwp_sslVerifyCertificate') === false || get_option('mainwp_sslVerifyCertificate') == 1 ? 'checked="checked"' : '';
        ?>
/><label for="mainwp_sslVerifyCertificate"></label>
                        </div>
                   </td>
                   <td><em><?php 
        _e('Default: YES', 'mainwp');
        ?>
</em></td>
                </tr>
            </tbody>
        </table>
    </div>
    </div>
    <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="<?php 
        _e('Save Settings', 'mainwp');
        ?>
"/></p>
    </form>
        <?php 
        self::renderFooter('Advanced');
    }
コード例 #9
0
 public static function disableExtension()
 {
     $snEnabledExtensions = get_option('mainwp_extloaded');
     if (!is_array($snEnabledExtensions)) {
         $snEnabledExtensions = array();
     }
     $key = array_search($_POST['slug'], $snEnabledExtensions);
     if ($key !== false) {
         unset($snEnabledExtensions[$key]);
     }
     MainWPUtility::update_option('mainwp_extloaded', $snEnabledExtensions);
     die(json_encode(array('result' => 'SUCCESS')));
 }
コード例 #10
0
 public function testloginapi($args)
 {
     $defaults = array('request' => 'testloginapi');
     $args = wp_parse_args($defaults, $args);
     $target_url = self::create_software_api_url($args);
     $request = wp_remote_get($target_url, array('timeout' => 50, 'sslverify' => self::$apisslverify));
     //                $request = wp_remote_post( MainWPApiManager::instance()->upgrade_url . 'wc-api/am-software-api/', array('body' => $args) );
     if (is_wp_error($request)) {
         if (self::$apisslverify == 1) {
             MainWPUtility::update_option("mainwp_api_sslVerifyCertificate", 0);
             return array('retry_action' => 1);
         }
         throw new Exception($request->get_error_message());
         return false;
     }
     $code = wp_remote_retrieve_response_code($request);
     if ($code != 200) {
         throw new Exception("Error: code " . $code);
         return false;
     }
     $response = wp_remote_retrieve_body($request);
     return $response;
 }
コード例 #11
0
 function prepare_items($globalIgnoredPluginConflicts = array(), $globalIgnoredThemeConflicts = array())
 {
     $this->globalIgnoredPluginConflicts = $globalIgnoredPluginConflicts;
     $this->globalIgnoredThemeConflicts = $globalIgnoredThemeConflicts;
     $orderby = 'wp.url';
     if (!isset($_GET['orderby'])) {
         $_order_by = get_option('mainwp_managesites_orderby');
         $_order = get_option('mainwp_managesites_order');
         if (!empty($_order_by)) {
             $_GET['orderby'] = $_order_by;
             $_GET['order'] = $_order;
         }
     } else {
         MainWPUtility::update_option('mainwp_managesites_orderby', $_GET['orderby']);
         MainWPUtility::update_option('mainwp_managesites_order', $_GET['order']);
     }
     if (isset($_GET['orderby'])) {
         if ($_GET['orderby'] == 'site') {
             $orderby = 'wp.name ' . ($_GET['order'] == 'asc' ? 'asc' : 'desc');
         } else {
             if ($_GET['orderby'] == 'url') {
                 $orderby = 'wp.url ' . ($_GET['order'] == 'asc' ? 'asc' : 'desc');
             } else {
                 if ($_GET['orderby'] == 'group') {
                     $orderby = 'GROUP_CONCAT(gr.name ORDER BY gr.name SEPARATOR ", ") ' . ($_GET['order'] == 'asc' ? 'asc' : 'desc');
                 } else {
                     if ($_GET['orderby'] == 'status') {
                         $orderby = 'CASE true
                             WHEN ((pluginConflicts <> "[]") AND (pluginConflicts IS NOT NULL) AND (pluginConflicts <> ""))
                                 THEN 1
                             WHEN (offline_check_result = -1)
                                 THEN 2
                             WHEN (wp_sync.sync_errors IS NOT NULL) AND (wp_sync.sync_errors <> "")
                                 THEN 3
                             ELSE 4
                                 + (CASE plugin_upgrades WHEN "[]" THEN 0 ELSE 1 + LENGTH(plugin_upgrades) - LENGTH(REPLACE(plugin_upgrades, "\\"Name\\":", "\\"Name\\"")) END)
                                 + (CASE theme_upgrades WHEN "[]" THEN 0 ELSE 1 + LENGTH(theme_upgrades) - LENGTH(REPLACE(theme_upgrades, "\\"Name\\":", "\\"Name\\"")) END)
                                 + (CASE wp_upgrades WHEN "[]" THEN 0 ELSE 1 END)
                         END ' . ($_GET['order'] == 'asc' ? 'asc' : 'desc');
                     } else {
                         if ($_REQUEST['orderby'] == 'last_post') {
                             $orderby = 'wp_sync.last_post_gmt ' . ($_GET['order'] == 'asc' ? 'asc' : 'desc');
                         }
                     }
                 }
             }
         }
     }
     $perPage = $this->get_items_per_page('mainwp_managesites_per_page');
     $currentPage = $this->get_pagenum();
     $no_request = !isset($_REQUEST['s']) && !isset($_REQUEST['g']) && !isset($_REQUEST['status']);
     if (!isset($_REQUEST['status'])) {
         if ($no_request) {
             $_status = get_option('mainwp_managesites_filter_status');
             if (!empty($_status)) {
                 $_REQUEST['status'] = $_status;
             }
         } else {
             MainWPUtility::update_option('mainwp_managesites_filter_status', '');
         }
     } else {
         MainWPUtility::update_option('mainwp_managesites_filter_status', $_REQUEST['status']);
     }
     if (!isset($_REQUEST['g'])) {
         if ($no_request) {
             $_g = get_option('mainwp_managesites_filter_group');
             if (!empty($_g)) {
                 $_REQUEST['g'] = $_g;
             }
         } else {
             MainWPUtility::update_option('mainwp_managesites_filter_group', '');
         }
     } else {
         MainWPUtility::update_option('mainwp_managesites_filter_group', $_REQUEST['g']);
     }
     $where = null;
     if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
         if ($_REQUEST['status'] == 'online') {
             $where = 'wp.offline_check_result = 1';
         } else {
             if ($_REQUEST['status'] == 'offline') {
                 $where = 'wp.offline_check_result = -1';
             } else {
                 if ($_REQUEST['status'] == 'disconnected') {
                     $where = 'wp_sync.sync_errors != ""';
                 } else {
                     if ($_REQUEST['status'] == 'update') {
                         $where = '(wp_optionview.wp_upgrades != "[]" OR wp.plugin_upgrades != "[]" OR wp.theme_upgrades != "[]")';
                     }
                 }
             }
         }
     }
     if (isset($_REQUEST['g']) && $_REQUEST['g'] != '') {
         $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($_REQUEST['g'], true));
         $totalRecords = $websites ? MainWPDB::num_rows($websites) : 0;
         if ($websites) {
             @MainWPDB::free_result($websites);
         }
         if (isset($_GET['orderby']) && $_GET['orderby'] == 'group') {
             $orderby = 'wp.url';
         }
         $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($_REQUEST['g'], true, $orderby, ($currentPage - 1) * $perPage, $perPage, $where));
     } else {
         if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
             $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser(true, null, $orderby, false, false, $where));
             $totalRecords = $websites ? MainWPDB::num_rows($websites) : 0;
             if ($websites) {
                 @MainWPDB::free_result($websites);
             }
             $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser(true, null, $orderby, ($currentPage - 1) * $perPage, $perPage, $where));
         } else {
             $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser(true, isset($_REQUEST['s']) && $_REQUEST['s'] != '' ? $_REQUEST['s'] : null, $orderby));
             $totalRecords = $websites ? MainWPDB::num_rows($websites) : 0;
             if ($websites) {
                 @MainWPDB::free_result($websites);
             }
             $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesForCurrentUser(true, isset($_REQUEST['s']) && $_REQUEST['s'] != '' ? $_REQUEST['s'] : null, $orderby, ($currentPage - 1) * $perPage, $perPage));
         }
     }
     $this->set_pagination_args(array('total_items' => $totalRecords, 'per_page' => $perPage));
     $this->items = $websites;
 }
コード例 #12
0
ファイル: MainWPUtility.class.php プロジェクト: BjornW/mainwp
 public static function resetUserCookie($what, $value = "")
 {
     global $current_user;
     if ($user_id = $current_user->ID) {
         $reset_cookies = get_option("mainwp_reset_user_cookies");
         if (!is_array($reset_cookies)) {
             $reset_cookies = array();
         }
         if (!isset($reset_cookies[$user_id]) || !isset($reset_cookies[$user_id][$what])) {
             $reset_cookies[$user_id][$what] = 1;
             MainWPUtility::update_option("mainwp_reset_user_cookies", $reset_cookies);
             update_user_option($user_id, "mainwp_saved_user_cookies", array());
             return false;
         }
         $user_cookies = get_user_option('mainwp_saved_user_cookies');
         if (!is_array($user_cookies)) {
             $user_cookies = array();
         }
         if (!isset($user_cookies[$what])) {
             return false;
         }
     }
     return true;
 }
コード例 #13
0
 public static function testAPIs($pAPI = null, $forceRequest = false, $username = null, $password = null, $pIgnoreLastCheckTime = false, $saveAnyway = false)
 {
     if ($username == null) {
         $username = get_option('mainwp_api_username');
     }
     if ($password == null) {
         $password = MainWPUtility::decrypt(get_option('mainwp_api_password'), 'MainWPAPI');
     }
     $requestsDB = get_option('mainwp_requests');
     $requests = isset($requestsDB['requests']) ? unserialize(base64_decode($requestsDB['requests'])) : array();
     $lastRequests = isset($requestsDB['lastRequests']) ? unserialize(base64_decode($requestsDB['lastRequests'])) : array();
     $maxOccurences = isset($requestsDB['maxOccurences']) ? unserialize(base64_decode($requestsDB['maxOccurences'])) : 0;
     $exclusiveResult = '';
     if (!isset($GLOBALS['pagenow'])) {
         $GLOBALS['pagenow'] = '';
     }
     $url = get_home_url();
     //If we force a request,
     //  or API is not yet checked or invalid,
     //  or last request was too long ago
     if ($forceRequest || $pAPI != null && (!isset($requests[$pAPI]) || $requests[$pAPI] == MAINWP_API_INVALID) || time() - $requestsDB['lastRequest'] > 48 * 60 * 60) {
         //init requests
         if (!is_array($requests) || !isset($requests['main'])) {
             $requests = array('main' => MAINWP_API_INVALID);
         }
         //Not exclusive
         if ($pAPI == null) {
             //Check all requests
             foreach ($requests as $api => $current) {
                 $request = "do=logintest2&username="******"&password="******"&url=" . urlencode($url);
                 }
                 $responseArray = MainWPUtility::http_post($request, "mainwp.com", "/versioncontrol/rqst.php", 80, $api, $forceRequest && !$saveAnyway);
                 $jsonDecodedResp = json_decode($responseArray[1], true);
                 $requests[$api] = $jsonDecodedResp['status'] == 'valid' ? MAINWP_API_VALID : MAINWP_API_INVALID;
                 if ($api == 'main') {
                     $maxOccurences = $jsonDecodedResp['max'];
                 }
                 $lastRequests[$api] = time();
             }
         } else {
             // compatible
             $activated_info = get_option($pAPI . "_APIManAdder");
             if ($activated_info && is_array($activated_info) && isset($activated_info["activated_key"]) && !empty($activated_info["api_key"])) {
                 if ($activated_info['activated_key'] == 'Activated') {
                     $exclusiveResult = MAINWP_API_VALID;
                 } else {
                     $exclusiveResult = MAINWP_API_INVALID;
                 }
             } else {
                 //If it was forced or the API is not yet fetched or (invalid && last fetched later then 10 minutes ago)
                 if ($forceRequest || !isset($requests[$pAPI]) || $requests[$pAPI] == MAINWP_API_INVALID && ($pIgnoreLastCheckTime || (!isset($lastRequests[$pAPI]) || time() - $lastRequests[$pAPI] > 10 * 60))) {
                     $request = "do=logintest2&username="******"&password="******"&url=" . urlencode($url);
                     }
                     $responseArray = MainWPUtility::http_post($request, "mainwp.com", "/versioncontrol/rqst.php", 80, $pAPI, $forceRequest && !$saveAnyway);
                     $jsonDecodedResp = json_decode($responseArray[1], true);
                     $requests[$pAPI] = $jsonDecodedResp['status'] == 'valid' ? MAINWP_API_VALID : MAINWP_API_INVALID;
                     if ($pAPI == 'main') {
                         $maxOccurences = $jsonDecodedResp['max'];
                     }
                     $lastRequests[$pAPI] = time();
                     $exclusiveResult = $requests[$pAPI];
                     //If it was forced we just return the value without saving
                     if ($forceRequest && !$saveAnyway) {
                         if (isset($jsonDecodedResp['error']) && $jsonDecodedResp['error'] != '') {
                             throw new Exception($jsonDecodedResp['error']);
                         }
                         return $exclusiveResult;
                     }
                 }
             }
         }
         $requestsDB = array('lastRequest' => $pAPI != null ? isset($requests['lastRequest']) ? $requests['lastRequest'] : '' : time(), 'requests' => base64_encode(serialize($requests)), 'lastRequests' => base64_encode(serialize($lastRequests)), 'maxOccurences' => base64_encode(serialize($maxOccurences)));
         MainWPUtility::update_option('mainwp_requests', $requestsDB);
     }
     return $exclusiveResult != '' ? $exclusiveResult : ($pAPI == null ? null : $requests[$pAPI]);
 }
コード例 #14
0
 public function grab_license_key($api, $username, $password)
 {
     $options = get_option($api . "_APIManAdder");
     if (!is_array($options)) {
         $options = array();
     }
     $activation_status = isset($options['activated_key']) ? $options['activated_key'] : "";
     $api_key = isset($options['api_key']) ? $options['api_key'] : "";
     $api_email = isset($options['activation_email']) ? $options['activation_email'] : "";
     if ($activation_status == 'Deactivated' || $activation_status == '' || $api_key == '' || $api_email == '') {
         $return = array();
         if ($username != '' && $password != '') {
             $args = array('username' => $username, 'password' => $password, 'product_id' => $options['product_id'], 'instance' => $options['instance_id'], 'software_version' => $options['software_version'], 'platform' => $this->domain);
             $activate_results = json_decode(MainWPApiManagerKey::instance()->grabapikey($args), true);
             $options['api_key'] = '';
             $options['activation_email'] = '';
             $options['activated_key'] = 'Deactivated';
             if (is_array($activate_results) && $activate_results['activated'] == true && !empty($activate_results['api_key'])) {
                 $return['result'] = 'SUCCESS';
                 $mess = isset($activate_results['message']) ? $activate_results['message'] : "";
                 $return['message'] = __('Plugin activated. ', 'mainwp') . $mess;
                 $options['api_key'] = $return['api_key'] = $activate_results['api_key'];
                 $options['activation_email'] = $return['activation_email'] = $activate_results['activation_email'];
                 $options['activated_key'] = 'Activated';
                 $options['deactivate_checkbox'] = 'off';
             } else {
                 if ($activate_results == false) {
                     $return['error'] = __('Connection failed to the License Key API server. Try again later.', "mainwp");
                 } else {
                     if (empty($activate_results['api_key'])) {
                         $return['error'] = __('License key is empty.', "mainwp");
                     } else {
                         $return['error'] = __('Undefined error.', "mainwp");
                     }
                 }
             }
             if (isset($activate_results['code'])) {
                 switch ($activate_results['code']) {
                     case '100':
                     case '101':
                     case '102':
                     case '103':
                     case '104':
                     case '105':
                     case '106':
                         $error = isset($activate_results['error']) ? $activate_results['error'] : "";
                         $info = isset($activate_results['additional info']) ? ' ' . $activate_results['additional info'] : "";
                         $return['error'] = $error . $info;
                         break;
                 }
             }
             MainWPUtility::update_option($api . "_APIManAdder", $options);
             return $return;
         } else {
             return array('error' => __('Username and Password is required to grab Extension API Key.', 'mainwp'));
         }
     }
     return array('result' => 'SUCCESS');
 }
コード例 #15
0
    public static function render()
    {
        $news = get_option('mainwp_news');
        $newstimestamp = get_option('mainwp_news_timestamp');
        if ($newstimestamp === false || time() - $newstimestamp > 60 * 60 * 24) {
            try {
                $result = MainWPUtility::http_post("do=news", "mainwp.com", "/versioncontrol/rqst.php", 80, 'main', true);
            } catch (Exception $e) {
                MainWPLogger::Instance()->warning('An error occured when trying to reach the MainWP server: ' . $e->getMessage());
            }
            //get news..
            if (isset($result[1])) {
                $news = json_decode($result[1], true);
                MainWPUtility::update_option('mainwp_news', $news);
                MainWPUtility::update_option('mainwp_news_timestamp', time());
            }
        }
        if (!is_array($news) || count($news) == 0) {
            //No news..
            ?>
            <div>No news items found.</div>
            <?php 
            return;
        }
        ?>
        <div>
            <div id="mainwp-news-tabs" class="mainwp-row" style="border-top: 0px">
                <?php 
        $newsCategories = array();
        foreach ($news as $newsItem) {
            if (!in_array($newsItem['category'], $newsCategories)) {
                $newsCategories[] = $newsItem['category'];
            }
        }
        for ($i = 0; $i < count($newsCategories); $i++) {
            $category = $newsCategories[$i];
            /** @var $class string */
            if (count($newsCategories) == 1) {
                $class = 'single';
            } else {
                if ($i == count($newsCategories) - 1) {
                    $class = 'right';
                } else {
                    if ($i == 0) {
                        $class = 'left';
                    } else {
                        $class = 'mid';
                    }
                }
            }
            if ($category == 'MainWP') {
                $class .= ' mainwp_action_down';
            }
            ?>
<a class="mainwp_action <?php 
            echo $class;
            ?>
 mainwp-news-tab" href="#" name="<?php 
            echo MainWPUtility::sanitize($category);
            ?>
"><?php 
            _e($category, 'mainwp');
            ?>
</a><?php 
        }
        ?>
            </div>
            <div id="mainwp-news-list">
                <?php 
        $category = '';
        foreach ($news as $newsItem) {
            if ($category != $newsItem['category']) {
                if ($category != '') {
                    echo '</div>';
                }
                echo '<div class="mainwp-news-items" name="' . MainWPUtility::sanitize($newsItem['category']) . '" ' . ($newsItem['category'] == 'MainWP' ? '' : 'style="display: none;"') . '>';
            }
            ?>
                    <div class="mainwp-news-item" title="<?php 
            echo MainWPUtility::sanitize($newsItem['title']);
            ?>
">
                        <strong><?php 
            echo $newsItem['title'];
            ?>
</strong><br />
                        <?php 
            echo $newsItem['body'];
            ?>
                        <div style="text-align: right"><em>Submitted <?php 
            if (isset($newsItem['submitter']) && $newsItem['submitter'] != '') {
                echo 'by <strong>' . $newsItem['submitter'] . '</strong> ';
            }
            ?>
 at <strong><?php 
            echo MainWPUtility::formatTimestamp(MainWPUtility::getTimestamp($newsItem['timestamp']));
            ?>
</strong></em></div>
                    </div>
                    <?php 
            if ($category != $newsItem['category']) {
                $category = $newsItem['category'];
            }
        }
        if ($category != '') {
            echo '</div>';
        }
        ?>
            </div>
        </div>
    <?php 
    }
コード例 #16
0
    public static function renderHeader($shownPage, &$extensions)
    {
        ?>
    <div class="wrap">
        <a href="https://mainwp.com" id="mainwplogo" title="MainWP" target="_blank"><img
                src="<?php 
        echo plugins_url('images/logo.png', dirname(__FILE__));
        ?>
" height="50"
                alt="MainWP"/></a>
        <h2><i class="fa fa-plug"></i> <?php 
        _e('Extensions', 'mainwp');
        ?>
</h2><div style="clear: both;"></div><br/><br/>
        <?php 
        if ($shownPage === '') {
            ?>
        <div id="mainwp-extensions-categories-menu" class="postbox">
                <div class="mainwp-inside"><span id="mainwp-extensions-menu-title"><?php 
            _e('Get MainWP Extensions', 'mainwp');
            ?>
</span></div>
                <div style="border-bottom: 1px Solid #e5e5e5;"></div>
                <div class="mainwp-inside mainwp-align-center" style="clear: both;">
                <div id="mainwp-extensions-cat-menu">
                    <ul id="mainwp-extensions-menu-cat-list">
                        <li class="mainwp-extensions-menu-item mainwp-category-1"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/administrative/"><?php 
            _e('Administrative', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-2"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/content/"><?php 
            _e('Content', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-3"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/visitor-data/"><?php 
            _e('Visitor Data', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-4"><a href="https://extensions.mainwp.com/product-category/mainwp-extensions/free/"><?php 
            _e('Free Extensions', 'mainwp');
            ?>
</a></li>
                        <li class="mainwp-extensions-menu-item mainwp-category-5"><a href="https://extensions.mainwp.com/shop/"><?php 
            _e('All Extensions', 'mainwp');
            ?>
</a></li>
                    </ul>
                </div>
                    <div style="clear: both;"></div>
                </div>
        </div>        
       
<?php 
            $loader_url = '<i class="fa fa-spinner fa-pulse"></i>';
            if (mainwp_current_user_can("dashboard", "bulk_install_and_activate_extensions")) {
                $username = $password = "";
                $checked_save = false;
                if (get_option("mainwp_extensions_api_save_login") == true) {
                    $enscrypt_u = get_option('mainwp_extensions_api_username');
                    $enscrypt_p = get_option('mainwp_extensions_api_password');
                    $username = !empty($enscrypt_u) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_u) : "";
                    $password = !empty($enscrypt_p) ? MainWPApiManagerPasswordManagement::decrypt_string($enscrypt_p) : "";
                    $checked_save = true;
                }
                if (!MainWPUtility::resetUserCookie('api_bulk_install')) {
                    ?>
            <span id="mainwp_api_postbox_reset_showhide"></span>
        <?php 
                }
                ?>
        
    <div class="postbox mainwp_api_postbox" section="1" >
           <!-- <div class="handlediv"><br></div> -->
           <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
                _e("Bulk Install and Activate Extensions", "mainwp");
                ?>
</span></h3>                          
           <div class="mainwp-inside" style="clear: both;">
            <div style="padding: 0 5px;">
            <?php 
                $apisslverify = get_option('mainwp_api_sslVerifyCertificate');
                if (defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER <= 0x9080bf && $apisslverify === false) {
                    $apisslverify = 0;
                    MainWPUtility::update_option("mainwp_api_sslVerifyCertificate", $apisslverify);
                }
                $_selected_1 = $apisslverify === false || $apisslverify == 1 ? "selected" : '';
                $_selected_0 = empty($_selected_1) ? "selected" : "";
                ?>
                
                <div class="mainwp_info-box-red">
                <?php 
                if (defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER <= 0x9080bf) {
                    ?>
                        <p><?php 
                    _e("<strong style=\"color:#a00\">WARNING:</strong> MainWP has detected an older install of OpenSSL that does not support Server Name Indication (SNI). This will cause API Activation failure.", "mainwp");
                    ?>
</p>
                        <p><?php 
                    _e("We highly recommend, for your security, that you have your host update your OpenSSL to a current version that does support Server Name Indication (SNI).", "mainwp");
                    ?>
</p>
                        <p><?php 
                    _e("If you do not want to or cannot update your OpenSSL to a current version you can change the verify certificate option to No <strong>(Not recommended)</strong>", "mainwp");
                    ?>
</p>
                    <?php 
                } else {
                    ?>
                        <p><?php 
                    _e("<strong>Notice:</strong> We did not detect any SSL issues.", "mainwp");
                    ?>
</p>                         
                        <p><?php 
                    _e("However, if you are having an issue connecting to, logging in or updating Extensions try setting the verify certificate option below to No and pressing Save.", "mainwp");
                    ?>
</p>                         
                    <?php 
                }
                ?>
                    <table class="form-table">
                        </tbody>
                            <tr>
                                <th scope="row"><?php 
                _e('Verify certificate', 'mainwp');
                ?>
 <?php 
                MainWPUtility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
                ?>
</th>
                                   <td>
                                       <span><select name="mainwp_api_sslVerifyCertificate" id="mainwp_api_sslVerifyCertificate" style="width: 200px;">
                                            <option value="0" <?php 
                echo $_selected_0;
                ?>
 ><?php 
                _e("No", "mainwp");
                ?>
</option>
                                            <option value="1" <?php 
                echo $_selected_1;
                ?>
 ><?php 
                _e("Yes", "mainwp");
                ?>
</option>                                               
                                        </select><label></label></span>&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span class="extension_api_sslverify_loading">
                                            <input type="button" value="<?php 
                _e("Save", "mainwp");
                ?>
" id="mainwp-extensions-api-sslverify-certificate" class="button-primary">
                                            <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                                        </span>
                                </td>
                            </tr>
                        </tbody>
                    </table>                
                </div>
                  
                <strong><?php 
                _e("Step 1", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("Enter your MainWP Extensions (https://extensions.mainwp.com) Login to automatically install and activate purchased extensions.");
                ?>
</span></p>
                <span><?php 
                _e("MainWP Extensions Login:"******"mainwp");
                ?>
</span><br /><br />
                <div class="api-grabbing-fields">              
                    <input type="text" class="input username" placeholder="<?php 
                echo __("Username", "mainwp");
                ?>
" value="<?php 
                echo $username;
                ?>
"/>&nbsp;
                    <input type="password" class="input passwd" placeholder="<?php 
                echo __("Password", "mainwp");
                ?>
" value="<?php 
                echo $password;
                ?>
"/>&nbsp;
                    <label><input type="checkbox" <?php 
                echo $checked_save ? 'checked="checked"' : "";
                ?>
 name="extensions_api_savemylogin_chk" id="extensions_api_savemylogin_chk"><?php 
                _e("Save API login", "mainwp");
                ?>
</label>
                </div>  
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="button-primary" id="mainwp-extensions-savelogin" value="<?php 
                _e("Save Login", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <p><hr></p>            
                <strong><?php 
                _e("Step 2", "mainwp");
                ?>
</strong>
                <div id="mainwp-install-purchased-extensions">
                <p><span class="description"><?php 
                _e("The Install Purchased Extensions button will automatically install all your MainWP Extensions. You can also install them manually using the directions <a href=\"http://docs.mainwp.com/how-to-install-mainwp-extensions/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-bulkinstall" value="<?php 
                _e("Install purchased extensions", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>                            
                </div>
                <p><hr></p>
                <strong><?php 
                _e("Step 3", "mainwp");
                ?>
</strong>
                <p><span class="description"><?php 
                _e("The Grab API Keys will automatically add your API Keys and activate your Extensions. You can also manually enter your API for each Extension following the steps <a href=\"http://docs.mainwp.com/enter-extensions-api-keys/\" >here</a>.");
                ?>
</span></p>
                <p>
                    <span class="extension_api_loading">
                        <input type="button" class="mainwp-upgrade-button button-primary" id="mainwp-extensions-grabkeys" value="<?php 
                _e("Grab Api Keys", "mainwp");
                ?>
">
                        <i class="fa fa-spinner fa-pulse" style="display: none;"></i><span class="status hidden"></span>
                    </span>
                </p>  
                <div style="clear: both;"></div>
            </div>
        </div>
    </div> 
       <?php 
            }
            ?>
         
<?php 
        }
        ?>
    
        
        <div class="mainwp-tabs" id="mainwp-tabs">            
            <a class="nav-tab pos-nav-tab <?php 
        if ($shownPage === '') {
            echo "nav-tab-active";
        }
        ?>
" href="admin.php?page=Extensions"><?php 
        _e('Manage Extensions', 'mainwp');
        ?>
</a>            
            <?php 
        if (isset($extensions) && is_array($extensions)) {
            foreach ($extensions as $extension) {
                if ($extension['plugin'] == $shownPage) {
                    ?>
                        <a class="nav-tab pos-nav-tab echo nav-tab-active" href="admin.php?page=<?php 
                    echo $extension['page'];
                    ?>
"><?php 
                    echo $extension['name'];
                    ?>
</a>
                        <?php 
                }
            }
        }
        ?>
        </div>
        <div id="mainwp_wrap-inside">
        <?php 
    }