public static function render(&$extensions) { $loader_url = '<i class="fa fa-spinner fa-pulse"></i>'; if (mainwp_current_user_can('dashboard', 'manage_extensions')) { ?> <?php } ?> <div class="postbox"> <div class="handlediv"><br></div> <h3 class="mainwp_box_title"> <span><?php printf(_n('%d Installed MainWP Extension', '%d Installed MainWP Extensions', count($extensions) == 1 ? 1 : 2, 'mainwp'), count($extensions)); ?> </span> </h3> <div id="mainwp-extensions-wrap"> <?php if (count($extensions) == 0) { ?> <div class="inside"> <div class="mainwp_info-box-blue"> <h3><?php _e('What are Extensions?', 'mainwp'); ?> </h3> <?php _e('Extensions are specific features or tools created for the purpose of expanding the basic functionality of MainWP.', 'mainwp'); ?> <h3><?php _e('Why have Extensions?', 'mainwp'); ?> </h3> <?php _e('The core of MainWP has been designed to provide the functions most needed by our users and minimize code bloat. Extensions offer custom functions and features so that each user can tailor their MainWP to their specific needs.', 'mainwp'); ?> <p> <a href="https://extensions.mainwp.com/"><?php _e('Download your first extension now.', 'mainwp'); ?> </a> </p> </div> </div> <?php } else { ?> <div style="background: #eee; padding: 1em .6em;"> <a class="mainwp_action left mainwp_action_down" href="#" id="mainwp-extensions-expand"><?php _e('Expand', 'mainwp'); ?> </a><a class="mainwp_action right" href="#" id="mainwp-extensions-collapse"><?php _e('Collapse', 'mainwp'); ?> </a> <?php if (mainwp_current_user_can('dashboard', 'manage_extensions')) { ?> <div style="float: right; margin-top: -3px;"> <a href="#" class="button mainwp-extensions-disable-all"><?php _e('Disable All', 'mainwp'); ?> </a> <a href="#" class="button-primary mainwp-extensions-enable-all"><?php _e('Enable All', 'mainwp'); ?> </a> <a href="<?php echo admin_url('plugin-install.php?tab=upload'); ?> " class="mainwp-upgrade-button button-primary button"><?php _e('Install New Extension', 'mainwp'); ?> </a> </div> <div style="clear: both;"></div> <?php } ?> </div> <div id="mainwp-extensions-list"> <?php $user_can_manage_extensions = mainwp_current_user_can('dashboard', 'manage_extensions'); if (isset($extensions) && is_array($extensions)) { foreach ($extensions as $extension) { if (!mainwp_current_user_can('extension', dirname($extension['slug']))) { continue; } $active = MainWP_Extensions::isExtensionActivated($extension['plugin']); $enabled = MainWP_Extensions::isExtensionEnabled($extension['plugin']); $queue_status = ''; if (isset($extension['apiManager']) && $extension['apiManager']) { $queue_status = 'status="queue"'; } ?> <div class="mainwp-extensions-childHolder" extension_slug="<?php echo $extension['slug']; ?> " <?php echo $queue_status; ?> license-status="<?php echo $active ? 'activated' : 'deactivated'; ?> "> <table style="width: 100%"> <td class="mainwp-extensions-childIcon"> <?php if (isset($extension['iconURI']) && $extension['iconURI'] != '') { ?> <img title="<?php echo $extension['name']; ?> " src="<?php echo MainWP_Utility::removeHttpPrefix($extension['iconURI']); ?> " class="mainwp-extensions-img large <?php echo $enabled ? '' : 'mainwp-extension-icon-desaturated'; ?> " /><?php } else { ?> <img title="MainWP Placeholder" src="<?php echo plugins_url('images/extensions/placeholder.png', dirname(__FILE__)); ?> " class="mainwp-extensions-img large <?php echo $enabled ? '' : 'mainwp-extension-icon-desaturated'; ?> " /><?php } ?> </td> <td valign="top"> <table style="width: 100%"> <tr> <td class="mainwp-extensions-childName"> <?php if (isset($extension['direct_page']) && !empty($extension['direct_page'])) { ?> <a href="<?php echo admin_url('admin.php?page=' . $extension['direct_page']); ?> " style="text-decoration: none;"> <?php echo $extension['name']; ?> </a> <?php } else { if (isset($extension['callback'])) { ?> <a href="<?php echo admin_url('admin.php?page=' . $extension['page']); ?> " style="text-decoration: none;"> <?php echo $extension['name']; ?> </a> <?php } else { echo $extension['name']; } } ?> </td> <td class="mainwp-extensions-childVersion">V. <?php echo $extension['version']; ?> </td> <td class="mainwp-extensions-childActions"> <?php if (isset($extension['apiManager']) && $extension['apiManager']) { ?> <?php if ($active) { ?> <a href="javascript:void(0)" class="api-status activated" ><?php _e('Activated', 'mainwp'); ?> </a> <?php } else { ?> <a href="javascript:void(0)" class="api-status deactivated" title="Not Activated"><?php _e('Deactivated', 'mainwp'); ?> </a> <?php } ?> <?php } ?> <?php if ($enabled) { ?> <button href="#" <?php echo $user_can_manage_extensions ? 'class="button mainwp-extensions-disable"' : 'disabled="disabled"'; ?> ><?php _e('Disable', 'mainwp'); ?> </button> <?php } else { ?> <button <?php echo $user_can_manage_extensions ? 'class="button-primary mainwp-extensions-enable"' : 'disabled="disabled"'; ?> ><?php _e('Enable', 'mainwp'); ?> </button> <?php } ?> <?php if (isset($extension['apiManager']) && $extension['apiManager']) { ?> <?php if ($user_can_manage_extensions) { ?> <?php if ($active) { ?> <a href="#" class="mainwp-extensions-api-activation" style="font-size: 28px;"><i class="fa fa-lock"></i></a> <?php } else { ?> <a href="#" class="mainwp-extensions-api-activation" style="font-size: 28px;"><i class="fa fa-unlock"></i></a> <?php } ?> <?php } else { ?> <?php if ($active) { ?> <span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-lock"></i></span> <?php } else { ?> <span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-unlock"></i></span> <?php } ?> <?php } ?> <?php } else { ?> <span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-lock"></i></span> <?php } ?> <?php if (isset($extension['direct_page']) && !empty($extension['direct_page'])) { ?> <a href="<?php echo admin_url('admin.php?page=' . $extension['direct_page']); ?> " style="font-size: 28px;"><i class="fa fa-wrench"></i></a> <?php } else { if (isset($extension['callback'])) { ?> <a href="<?php echo admin_url('admin.php?page=' . $extension['page']); ?> " style="font-size: 28px;"><i class="fa fa-wrench"></i></a> <?php } else { ?> <span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-wrench"></i></span> <?php } } ?> <?php if (false && $user_can_manage_extensions) { ?> <a href="#" class="mainwp-extensions-trash" style="font-size: 28px"><i class="fa fa-trash"></i></a> <?php } else { ?> <span style="font-size: 28px; color: #e5e5e5;"><i class="fa fa-trash"></i></span> <?php } ?> </td> </tr> <tr class="mainwp-extensions-extra mainwp-extension-description"> <td colspan="3"> <br/><br/><?php echo preg_replace('/\\<cite\\>.*\\<\\/cite\\>/', '', $extension['description']); ?> <br/><br/></td> </tr> <tr class="mainwp-extensions-links"> <td colspan="3"> <?php printf(__('By %s', 'mainwp'), str_replace(array('http:', 'https:'), '', $extension['author'])); ?> <?php echo isset($extension['DocumentationURI']) && !empty($extension['DocumentationURI']) ? ' | <a href="' . str_replace(array('http:', 'https:'), '', $extension['DocumentationURI']) . '" target="_blank" title="' . __('Documentation', 'mainwp') . '">' . __('Documentation', 'mainwp') . '</a>' : ''; ?> <?php echo isset($extension['SupportForumURI']) && !empty($extension['SupportForumURI']) ? ' | <a href="' . str_replace(array('http:', 'https:'), '', $extension['SupportForumURI']) . '" target="_blank" title="' . __('Support Forum', 'mainwp') . '">' . __('Support Forum', 'mainwp') . '</a>' : ''; ?> <?php if (isset($extension['apiManager']) && $extension['apiManager']) { ?> <?php echo ' | <a href="#" class="mainwp-extensions-api-activation" >' . __('Enter Activation API', 'mainwp') . '</a>'; ?> <?php } ?> </td> </tr> <?php if (isset($extension['apiManager']) && $extension['apiManager']) { ?> <tr class="mainwp-extensions-api-row"> <td colspan="3"> <div class="api-row-div"> <span> <input type="text" class="input api_key" placeholder="<?php esc_attr_e('API License Key', 'mainwp'); ?> " value="<?php echo $extension['api_key']; ?> "/> <input type="text" class="input api_email" placeholder="<?php esc_attr_e('API License Email', 'mainwp'); ?> " value="<?php echo $extension['activation_email']; ?> "/> <input type="button" class="button-primary mainwp-extensions-activate" value="<?php esc_attr_e('Activate', 'mainwp'); ?> "> <span class="mainwp_loading"><i class="fa fa-spinner fa-pulse"></i></span> </span> <span style="float:right"> <?php _e('Deactivate License Key', 'mainwp'); ?> <input type="checkbox" class="mainwp-extensions-deactivate-chkbox" <?php echo $extension['deactivate_checkbox'] == 'on' ? 'checked' : ''; ?> > <input type="button" class="button-primary mainwp-extensions-deactivate" value="<?php _e('Deactivate', 'mainwp'); ?> "> </span> </div> <span class="activate-api-status hidden"></span> </td> </tr> <?php } ?> </table> </td> </table> </div> <?php } } ?> </div> <?php } ?> </div></div><?php self::mainwpAvailableExtensions($extensions); }
public static function render() { $currentExtensions = self::$extensionsLoaded ? self::$extensions : get_option('mainwp_extensions'); if (count($currentExtensions) == 0) { ?> <span class="mainwp-no-extensions"> <div class="mainwp_info-box-yellow"><?php _e('You have no installed extensions.', 'mainwp'); ?> </div> <br/> <div style="text-align: center"> <a href="https://mainwp.com/extensions/" target="_blank" class="button button-hero button-primary"><?php _e('Add an Extension Today', 'mainwp'); ?> </a> </div> <br/> <h3 style="color: #7fb100;"><?php _e('What are Extensions?', 'mainwp'); ?> </h3> <p><?php _e('MainWP Extensions are specific features or tools created for the purpose of expanding the basic functionality of the MainWP plugin.', 'mainwp'); ?> </p> <h3 style="color: #7fb100;"><?php _e('Why have Extensions?', 'mainwp'); ?> </h3> <p><?php _e('The core of MainWP has been designed to provide the functions most needed by our users and minimize code bloat. Extensions offer custom functions and features so that each user can tailor their MainWP to their specific needs.', 'mainwp'); ?> </p> </span> <?php } else { $showGrid = get_option('mainwp_extension_widget_view', 'grid') == 'grid'; $showList = !$showGrid; $available_exts_data = MainWP_Extensions_View::getAvailableExtensions(); ?> <br/> <div id="mainwp-extensions-widget-grid" <?php echo !$showGrid ? "style='display:none;'" : ''; ?> > <?php foreach ($currentExtensions as $extension) { if (!mainwp_current_user_can('extension', dirname($extension['slug']))) { continue; } $ext_data = isset($available_exts_data[dirname($extension['slug'])]) ? $available_exts_data[dirname($extension['slug'])] : array(); if (isset($ext_data['img'])) { $img_url = $ext_data['img']; } else { if (isset($extension['iconURI']) && $extension['iconURI'] != '') { $img_url = MainWP_Utility::removeHttpPrefix($extension['iconURI']); } else { $img_url = plugins_url('images/extensions/placeholder.png', dirname(__FILE__)); } } if (isset($extension['direct_page']) && !empty($extension['direct_page'])) { $ext_page = $extension['direct_page']; } else { $ext_page = $extension['page']; } ?> <span class="mainwp-widget-extensions"> <a href="<?php echo admin_url('admin.php?page=' . $ext_page); ?> "> <img title="<?php echo $extension['name']; ?> " src="<?php echo $img_url; ?> " class="mainwp-widget-icon"/> </a> <h4> <a href="<?php echo admin_url('admin.php?page=' . $ext_page); ?> "><?php echo $extension['name']; ?> </a> </h4> </span> <?php } ?> </div> <div style="clear: both"></div> <table id="mainwp-extensions-widget-list" cellspacing="0" cellpadding="1" <?php echo !$showList ? "style='display:none;'" : ''; ?> > <tbody> <?php foreach ($currentExtensions as $extension) { if (!mainwp_current_user_can('extension', dirname($extension['slug']))) { continue; } $ext_data = isset($available_exts_data[dirname($extension['slug'])]) ? $available_exts_data[dirname($extension['slug'])] : array(); if (isset($ext_data['img'])) { $img_url = $ext_data['img']; } else { if (isset($extension['iconURI']) && $extension['iconURI'] != '') { $img_url = MainWP_Utility::removeHttpPrefix($extension['iconURI']); } else { $img_url = plugins_url('images/extensions/placeholder.png', dirname(__FILE__)); } } if (isset($extension['direct_page']) && !empty($extension['direct_page'])) { $ext_page = $extension['direct_page']; } else { $ext_page = $extension['page']; } ?> <tr class="mainwp-widget-extensions-list mainwp-extensions-childHolder" extension_slug="<?php echo $extension['slug']; ?> "> <td> <a href="<?php echo admin_url('admin.php?page=' . $ext_page); ?> "><img title="<?php echo $extension['name']; ?> " src="<?php echo $img_url; ?> " class="mainwp-widget-icon-list"/></a> </td> <td class="mainwp-extension-widget-title-list"> <a href="<?php echo admin_url('admin.php?page=' . $ext_page); ?> "><?php echo $extension['name']; ?> </a> </td> <td class="mainwp-extension-widget-version"><?php echo $extension['version']; ?> </td> <td class="mainwp-api-status-check" align="right" style="padding-right: 10px;"> <?php if (isset($extension['apiManager']) && $extension['apiManager'] && !empty($extension['api_key'])) { ?> <span style="color: #7fb100;"><i class="fa fa-unlock"></i> <?php _e('Activated', 'mainwp'); ?> </span> <?php } else { ?> <span style="color: #a00;"><i class="fa fa-lock"></i> <?php _e('Deactivated', 'mainwp'); ?> </span> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> <div style="clear: both; text-align: left; font-size: 12px; padding: .5em; border-top: 1px solid #dfdfdf;"> <a href="https://mainwp.com/extensions/" target="_blank" class="button mainwp-upgrade-button"><?php _e('GET MORE EXTENSIONS', 'mainwp'); ?> </a> <span style="float: right;"> <a href="#" class="mainwp-extension-widget-switch-grid" <?php echo !$showList ? "style='display:none;'" : ''; ?> ><?php _e('Show Grid View', 'mainwp'); ?> </a> <a href="#" class="mainwp-extension-widget-switch-list" <?php echo !$showGrid ? "style='display:none;'" : ''; ?> ><?php _e('Show List View', 'mainwp'); ?> </a> </span> </div> <?php } }
public static function renderAllSites(&$website, $updated, $groups, $statusses, $pluginDir) { if (!mainwp_current_user_can('dashboard', 'edit_sites')) { mainwp_do_not_have_permissions(__('edit sites', 'mainwp')); return; } $remote_destinations = apply_filters('mainwp_backups_remote_get_destinations', null, array('website' => $website->id)); $hasRemoteDestinations = $remote_destinations == null ? $remote_destinations : count($remote_destinations); ?> <div class="error below-h2" style="display: none;" id="ajax-error-zone"></div> <div id="ajax-information-zone" class="updated" style="display: none;"></div> <?php if ($updated) { ?> <div id="mainwp_managesites_edit_message" class="updated"><p><?php _e('Website updated.', 'mainwp'); ?> </p></div> <?php } ?> <form method="POST" action="" id="mainwp-edit-single-site-form" enctype="multipart/form-data"> <div class="postbox"> <h3 class="mainwp_box_title"><i class="fa fa-cog"></i> <?php _e('General Options', 'mainwp'); ?> </h3> <div class="inside"> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Site Name', 'mainwp'); ?> </th> <td><input type="text" name="mainwp_managesites_edit_sitename" value="<?php echo stripslashes($website->name); ?> " class="regular-text"/></td> </tr> <tr> <th scope="row"><?php _e('Site URL', 'mainwp'); ?> </th> <td><select id="mainwp_managesites_edit_siteurl_protocol" name="mainwp_managesites_edit_siteurl_protocol"><option <?php echo MainWP_Utility::startsWith($website->url, 'http:') ? 'selected' : ''; ?> value="http">http://</option><option <?php echo MainWP_Utility::startsWith($website->url, 'https:') ? 'selected' : ''; ?> value="https">https://</option></select> <input type="text" id="mainwp_managesites_edit_siteurl" disabled="disabled" value="<?php echo MainWP_Utility::removeHttpPrefix($website->url, true); ?> " class="regular-text" /> <span class="mainwp-form_hint-display"><?php _e('Site URL cannot be changed.', 'mainwp'); ?> </span></td> </tr> <tr> <th scope="row"><?php _e('Administrator Username', 'mainwp'); ?> </th> <td><input type="text" name="mainwp_managesites_edit_siteadmin" id="mainwp_managesites_edit_siteadmin" value="<?php echo $website->adminname; ?> " class="regular-text"/></td> </tr> <tr> <th scope="row"><?php _e('Groups', 'mainwp'); ?> </th> <td> <input type="text" name="mainwp_managesites_edit_addgroups" id="mainwp_managesites_edit_addgroups" value="" class="regular-text"/> <span class="mainwp-form_hint"><?php _e('Separate groups by commas (e.g. Group 1, Group 2).', 'mainwp'); ?> </span> <div id="selected_groups" style="display: block; width: 25em"> <?php if (count($groups) == 0) { echo 'No groups added yet.'; } $groupsSite = MainWP_DB::Instance()->getGroupsByWebsiteId($website->id); foreach ($groups as $group) { echo '<div class="mainwp_selected_groups_item"><input type="checkbox" name="selected_groups[]" value="' . $group->id . '" ' . (isset($groupsSite[$group->id]) && $groupsSite[$group->id] ? 'checked' : '') . ' /> ' . stripslashes($group->name) . '</div>'; } ?> </div> <span class="description"><?php _e('Or assign existing groups.', 'mainwp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Offline Checks', 'mainwp'); ?> </th> <td> <input type="radio" name="offline_checks" id="check_disabled" value="disabled" <?php echo !in_array($website->offline_checks, $statusses) ? 'checked="true"' : ''; ?> /> <?php _e('Disabled', 'mainwp'); ?> <input type="radio" name="offline_checks" id="check_hourly" value="hourly" <?php echo $website->offline_checks == 'hourly' ? 'checked="true"' : ''; ?> /> <?php _e('Hourly', 'mainwp'); ?> <input type="radio" name="offline_checks" id="check_2xday" value="2xday" <?php echo $website->offline_checks == '2xday' ? 'checked="true"' : ''; ?> /> <?php _e('2x Day', 'mainwp'); ?> <input type="radio" name="offline_checks" id="check_daily" value="daily" <?php echo $website->offline_checks == 'daily' ? 'checked="true"' : ''; ?> /> <?php _e('Daily', 'mainwp'); ?> <input type="radio" name="offline_checks" id="check_weekly" value="weekly" <?php echo $website->offline_checks == 'weekly' ? 'checked="true"' : ''; ?> /> Weekly <span class="mainwp-form_hint-display"><?php _e('Notifications are sent to:', 'mainwp'); ?> <?php echo MainWP_Utility::getNotificationEmail(); ?> (<?php _e('this address can be changed', 'mainwp'); ?> <a href="<?php echo get_admin_url(); ?> admin.php?page=Settings"><?php _e('here', 'mainwp'); ?> </a>)</span> </td> </tr> <tr> <th scope="row"><?php _e('Client Plugin Folder Option', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('Default, files/folders on the child site are viewable.<br />Hidden, when attempting to view files a 404 file will be returned, however a footprint does still exist.<br /><strong>Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.</strong>'); ?> </th> <td> <div class="mainwp-radio" style="float: left;"> <input type="radio" value="" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_global" <?php echo $pluginDir == '' ? 'checked="true"' : ''; ?> "/> <label for="mainwp_options_footprint_plugin_folder_global"></label> </div>Global Setting (<a href="<?php echo admin_url('admin.php?page=Settings#network-footprint'); ?> ">Change Here</a>)<br/> <div class="mainwp-radio" style="float: left;"> <input type="radio" value="default" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_default" <?php echo $pluginDir == 'default' ? 'checked="true"' : ''; ?> "/> <label for="mainwp_options_footprint_plugin_folder_default"></label> </div>Default<br/> <div class="mainwp-radio" style="float: left;"> <input type="radio" value="hidden" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_hidden" <?php echo $pluginDir == 'hidden' ? 'checked="true"' : ''; ?> /> <label for="mainwp_options_footprint_plugin_folder_hidden"></label> </div>Hidden (<strong>Note: </strong><i>If the heatmap is turned on, the heatmap javascript will still be visible.</i>) <br/> </td> </tr> <tr> <th scope="row"><?php _e('Require Backup Before Upgrade', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Backup only works when enabled in the global settings as well.', 'mainwp'), admin_url('admin.php?page=Settings')); ?> </th> <td> <select id="mainwp_backup_before_upgrade" name="mainwp_backup_before_upgrade"> <option <?php echo $website->backup_before_upgrade == 1 ? 'selected' : ''; ?> value="1"><?php _e('Yes', 'mainwp'); ?> </option> <option <?php echo $website->backup_before_upgrade == 0 ? 'selected' : ''; ?> value="0"><?php _e('No', 'mainwp'); ?> </option> <option <?php echo $website->backup_before_upgrade == 2 ? 'selected' : ''; ?> value="2"><?php _e('Use Global Setting', 'mainwp'); ?> </option> </select> <i>(<?php _e('Default', 'mainwp'); ?> : <?php _e('Use Global Setting', 'mainwp'); ?> )</i> </td> </tr> <tr> <th scope="row"><?php _e('Auto Update Core', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('Auto update only works when enabled in the global settings as well.', admin_url('admin.php?page=Settings')); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_automaticDailyUpdate" id="mainwp_automaticDailyUpdate" <?php echo $website->automatic_update == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_automaticDailyUpdate"></label> </div> </td> </tr> <?php if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { ?> <tr> <th scope="row"><?php _e('Ignore Core Updates', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('Set to YES if you want to Ignore Core Updates.'); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_is_ignoreCoreUpdates" id="mainwp_is_ignoreCoreUpdates" <?php echo $website->is_ignoreCoreUpdates == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_is_ignoreCoreUpdates"></label> </div> </td> </tr> <tr> <th scope="row"><?php _e('Ignore All Plugin Updates', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('Set to YES if you want to Ignore All Plugin Updates.'); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_is_ignorePluginUpdates" id="mainwp_is_ignorePluginUpdates" <?php echo $website->is_ignorePluginUpdates == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_is_ignorePluginUpdates"></label> </div> </td> </tr> <tr> <th scope="row"><?php _e('Ignore All Theme Updates', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('Set to YES if you want to Ignore All Theme Updates.'); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_is_ignoreThemeUpdates" id="mainwp_is_ignoreThemeUpdates" <?php echo $website->is_ignoreThemeUpdates == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_is_ignoreThemeUpdates"></label> </div> </td> </tr> <?php } ?> <?php do_action('mainwp_extension_sites_edit_tablerow', $website); ?> </tbody> </table> </div> </div> <div class="clear"></div> <div class="postbox"> <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php _e('Advanced Options', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table" style="width: 100%"> <?php $disabled_unique = empty($website->uniqueId) ? true : false; ?> <tr class="form-field form-required"> <th scope="row"><?php _e('Child Unique Security ID ', 'mainwp'); MainWP_Utility::renderToolTip('The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.'); ?> </th> <td><input type="text" id="mainwp_managesites_edit_uniqueId" style="width: 350px;" <?php echo $disabled_unique ? 'disabled="disabled"' : ''; ?> name="mainwp_managesites_edit_uniqueId" value="<?php echo $website->uniqueId; ?> " class=""/><span class="mainwp-form_hint">The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.</span></td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('Verify Certificate', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp')); ?> </th> <td> <select id="mainwp_managesites_edit_verifycertificate" name="mainwp_managesites_edit_verifycertificate"> <option <?php echo $website->verify_certificate == 1 ? 'selected' : ''; ?> value="1"><?php _e('Yes', 'mainwp'); ?> </option> <option <?php echo $website->verify_certificate == 0 ? 'selected' : ''; ?> value="0"><?php _e('No', 'mainwp'); ?> </option> <option <?php echo $website->verify_certificate == 2 ? 'selected' : ''; ?> value="2"><?php _e('Use Global Setting', 'mainwp'); ?> </option> </select> <i>(Default: Yes)</i> </td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('SSL Version', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp')); ?> </th> <td> <select id="mainwp_managesites_edit_ssl_version" name="mainwp_managesites_edit_ssl_version"> <option <?php echo $website->ssl_version == 'auto' ? 'selected' : ''; ?> value="auto"><?php _e('Auto detect', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '1.x' ? 'selected' : ''; ?> value="1.x"><?php _e('TLS v1.x', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '2' ? 'selected' : ''; ?> value="2"><?php _e('SSL v2', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '3' ? 'selected' : ''; ?> value="3"><?php _e('SSL v3', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '1.0' ? 'selected' : ''; ?> value="1.0"><?php _e('TLS v1.0', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '1.1' ? 'selected' : ''; ?> value="1.1"><?php _e('TLS v1.1', 'mainwp'); ?> </option> <option <?php echo $website->ssl_version == '1.2' ? 'selected' : ''; ?> value="1.2"><?php _e('TLS v1.2', 'mainwp'); ?> </option> </select> <em>(<?php _e('Default: Auto detect', 'mainwp'); ?> )</em> </td> </tr> <!-- fake fields are a workaround for chrome autofill getting the wrong fields --> <input style="display:none" type="text" name="fakeusernameremembered"/> <input style="display:none" type="password" name="fakepasswordremembered"/> <tr> <td colspan="2"><div class="mainwp_info-box"><?php _e('If your Child Site is protected with HTTP basic authentication, please set the username and password for authentication here.', 'mainwp'); ?> </div></td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('HTTP username ', 'mainwp'); ?> </th> <td><input type="text" id="mainwp_managesites_edit_http_user" style="width: 350px;" name="mainwp_managesites_edit_http_user" value="<?php echo empty($website->http_user) ? '' : $website->http_user; ?> " class=""/></td> </tr> <tr class="form-field form-required"> <th scope="row"><?php _e('HTTP password ', 'mainwp'); ?> </th> <td><input type="password" id="mainwp_managesites_edit_http_pass" style="width: 350px;" name="mainwp_managesites_edit_http_pass" value="<?php echo empty($website->http_pass) ? '' : $website->http_pass; ?> " class=""/></td> </tr> </table> </div> </div> <div class="clear"></div> <div class="postbox"> <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php _e('Backup Settings', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table" style="width: 100%"> <?php $globalArchiveFormat = get_option('mainwp_archiveFormat'); if ($globalArchiveFormat == false) { $globalArchiveFormat = 'tar.gz'; } if ($globalArchiveFormat == 'zip') { $globalArchiveFormatText = 'Zip'; } else { if ($globalArchiveFormat == 'tar') { $globalArchiveFormatText = 'Tar'; } else { if ($globalArchiveFormat == 'tar.gz') { $globalArchiveFormatText = 'Tar GZip'; } else { if ($globalArchiveFormat == 'tar.bz2') { $globalArchiveFormatText = 'Tar BZip2'; } } } } $backupSettings = MainWP_DB::Instance()->getWebsiteBackupSettings($website->id); $archiveFormat = $backupSettings->archiveFormat; $useGlobal = $archiveFormat == 'global'; ?> <tr> <th scope="row"><?php _e('Archive Format', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('', 'mainwp')); ?> </th> <td> <table class="mainwp-nomarkup"> <tr> <td valign="top"> <span class="mainwp-select-bg"><select name="mainwp_archiveFormat" id="mainwp_archiveFormat"> <option value="global" <?php if ($useGlobal) { ?> selected<?php } ?> >Global setting (<?php echo $globalArchiveFormatText; ?> )</option> <option value="zip" <?php if ($archiveFormat == 'zip') { ?> selected<?php } ?> >Zip</option> <option value="tar" <?php if ($archiveFormat == 'tar') { ?> selected<?php } ?> >Tar</option> <option value="tar.gz" <?php if ($archiveFormat == 'tar.gz') { ?> selected<?php } ?> >Tar GZip</option> <option value="tar.bz2" <?php if ($archiveFormat == 'tar.bz2') { ?> selected<?php } ?> >Tar BZip2</option> </select><label></label></span> </td> <td> <i> <span id="info_global" class="archive_info" <?php if (!$useGlobal) { ?> style="display: none;"<?php } ?> ><?php if ($globalArchiveFormat == 'zip') { ?> Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)<?php } elseif ($globalArchiveFormat == 'tar') { ?> Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)<?php } elseif ($globalArchiveFormat == 'tar.gz') { ?> Creates a GZipped tar-archive. (Good compression, fast, low memory usage)<?php } elseif ($globalArchiveFormat == 'tar.bz2') { ?> Creates a BZipped tar-archive. (Best compression, fast, low memory usage)<?php } ?> </span> <span id="info_zip" class="archive_info" <?php if ($archiveFormat != 'zip') { ?> style="display: none;"<?php } ?> >Uses PHP native Zip-library, when missing, the PCLZip library included in Wordpress will be used. (Good compression, fast with native zip-library)</span> <span id="info_tar" class="archive_info" <?php if ($archiveFormat != 'tar') { ?> style="display: none;"<?php } ?> >Creates an uncompressed tar-archive. (No compression, fast, low memory usage)</span> <span id="info_tar.gz" class="archive_info" <?php if ($archiveFormat != 'tar.gz') { ?> style="display: none;"<?php } ?> >Creates a GZipped tar-archive. (Good compression, fast, low memory usage)</span> <span id="info_tar.bz2" class="archive_info" <?php if ($archiveFormat != 'tar.bz2') { ?> style="display: none;"<?php } ?> >Creates a BZipped tar-archive. (Best compression, fast, low memory usage)</span> </i> </td> </tr> </table> </td> </tr> <?php $maximumFileDescriptorsOverride = $website->maximumFileDescriptorsOverride == 1; $maximumFileDescriptorsAuto = $website->maximumFileDescriptorsAuto == 1; $maximumFileDescriptors = $website->maximumFileDescriptors; ?> <tr class="archive_method archive_zip" <?php if ($archiveFormat != 'zip') { ?> style="display: none;"<?php } ?> > <th scope="row"><?php _e('Maximum File Descriptors on Child', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('The maximum number of open file descriptors on the child hosting.', 'http://docs.mainwp.com/maximum-number-of-file-descriptors/'); ?> </th> <td> <div class="mainwp-radio" style="float: left;"> <input type="radio" value="" name="mainwp_options_maximumFileDescriptorsOverride" id="mainwp_options_maximumFileDescriptorsOverride_global" <?php echo !$maximumFileDescriptorsOverride ? 'checked="true"' : ''; ?> "/> <label for="mainwp_options_maximumFileDescriptorsOverride_global"></label> </div>Global Setting (<a href="<?php echo admin_url('admin.php?page=Settings'); ?> ">Change Here</a>)<br/> <div class="mainwp-radio" style="float: left;"> <input type="radio" value="override" name="mainwp_options_maximumFileDescriptorsOverride" id="mainwp_options_maximumFileDescriptorsOverride_override" <?php echo $maximumFileDescriptorsOverride ? 'checked="true"' : ''; ?> "/> <label for="mainwp_options_maximumFileDescriptorsOverride_override"></label> </div>Override<br/><br /> <div style="float: left">Auto Detect: </div><div class="mainwp-checkbox"><input type="checkbox" id="mainwp_maximumFileDescriptorsAuto" name="mainwp_maximumFileDescriptorsAuto" <?php echo $maximumFileDescriptorsAuto ? 'checked="checked"' : ''; ?> /> <label for="mainwp_maximumFileDescriptorsAuto"></label></div><div style="float: left"><i>(<?php _e('Enter a fallback value because not all hosts support this function.', 'mainwp'); ?> )</i></div><div style="clear:both"></div> <input type="text" name="mainwp_options_maximumFileDescriptors" id="mainwp_options_maximumFileDescriptors" value="<?php echo $maximumFileDescriptors; ?> "/><span class="mainwp-form_hint"><?php _e('The maximum number of open file descriptors on the child hosting. 0 sets unlimited.', 'mainwp'); ?> </span> </td> </tr> <tr class="archive_method archive_zip" <?php if ($archiveFormat != 'zip') { ?> style="display: none;"<?php } ?> > <th scope="row"><?php _e('Load Files in Memory Before Zipping', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip('This causes the files to be opened and closed immediately, using less simultaneous I/O operations on the disk. For huge sites with a lot of files we advise to disable this, memory usage will drop but we will use more file handlers when backing up.', 'http://docs.mainwp.com/load-files-memory/'); ?> </th> <td> <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_global" value="1" <?php if ($website->loadFilesBeforeZip == false || $website->loadFilesBeforeZip == 1) { ?> checked="true"<?php } ?> /> Global setting (<a href="<?php echo admin_url('admin.php?page=Settings'); ?> ">Change Here</a>)<br /> <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_yes" value="2" <?php if ($website->loadFilesBeforeZip == 2) { ?> checked="true"<?php } ?> /> Yes<br /> <input type="radio" name="mainwp_options_loadFilesBeforeZip" id="mainwp_options_loadFilesBeforeZip_no" value="0" <?php if ($website->loadFilesBeforeZip == 0) { ?> checked="true"<?php } ?> /> No<br /> </td> </tr> <?php if ($hasRemoteDestinations !== null) { do_action('mainwp_backups_remote_settings', array('website' => $website->id, 'hide' => 'no')); } ?> </table> </div> </div> <?php $plugin_upgrades = json_decode($website->plugin_upgrades, true); if (!is_array($plugin_upgrades)) { $plugin_upgrades = array(); } $userExtension = MainWP_DB::Instance()->getUserExtension(); $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true); ?> <?php do_action('mainwp-extension-sites-edit', $website); ?> <p class="submit"><input type="submit" name="submit" id="submit" class="button-primary button button-hero" value="<?php _e('Update Site', 'mainwp'); ?> "/></p> </form> <?php }
public static function renderAllSites() { global $current_user; if (isset($_REQUEST['do'])) { if ($_REQUEST['do'] == 'new') { self::renderNewSite(); } else { if ($_REQUEST['do'] == 'test') { self::renderTest(); } } return; } $website = null; if (isset($_GET['backupid']) && MainWP_Utility::ctype_digit($_GET['backupid'])) { $websiteid = $_GET['backupid']; $backupwebsite = MainWP_DB::Instance()->getWebsiteById($websiteid); if (MainWP_Utility::can_edit_website($backupwebsite)) { MainWP_Manage_Sites::renderBackupSite($backupwebsite); return; } } if (isset($_GET['scanid']) && MainWP_Utility::ctype_digit($_GET['scanid'])) { $websiteid = $_GET['scanid']; $scanwebsite = MainWP_DB::Instance()->getWebsiteById($websiteid); if (MainWP_Utility::can_edit_website($scanwebsite)) { MainWP_Manage_Sites::renderScanSite($scanwebsite); return; } } if (isset($_GET['seowebsiteid']) && MainWP_Utility::ctype_digit($_GET['seowebsiteid'])) { $websiteid = $_GET['seowebsiteid']; $seoWebsite = MainWP_DB::Instance()->getWebsiteById($websiteid); if (MainWP_Utility::can_edit_website($seoWebsite)) { MainWP_Manage_Sites::renderSeoPage($seoWebsite); return; } } if (isset($_GET['dashboard']) && MainWP_Utility::ctype_digit($_GET['dashboard'])) { $websiteid = $_GET['dashboard']; $dashboardWebsite = MainWP_DB::Instance()->getWebsiteById($websiteid); if (MainWP_Utility::can_edit_website($dashboardWebsite)) { MainWP_Manage_Sites::renderDashboard($dashboardWebsite); return; } } if (isset($_GET['id']) && MainWP_Utility::ctype_digit($_GET['id'])) { $websiteid = $_GET['id']; $website = MainWP_DB::Instance()->getWebsiteById($websiteid); if (!MainWP_Utility::can_edit_website($website)) { $website = null; } } if ($website == null) { self::_renderAllSites(); } else { $updated = false; //Edit website! if (isset($_POST['submit']) && isset($_POST['mainwp_managesites_edit_siteadmin']) && $_POST['mainwp_managesites_edit_siteadmin'] != '') { //update site $groupids = array(); $groupnames = array(); if (isset($_POST['selected_groups'])) { foreach ($_POST['selected_groups'] as $group) { $groupids[] = $group; } } if (isset($_POST['mainwp_managesites_edit_addgroups']) && $_POST['mainwp_managesites_edit_addgroups'] != '') { $tmpArr = explode(',', $_POST['mainwp_managesites_edit_addgroups']); foreach ($tmpArr as $tmp) { $group = MainWP_DB::Instance()->getGroupByNameForUser(trim($tmp)); if ($group) { if (!in_array($group->id, $groupids)) { $groupids[] = $group->id; } } else { $groupnames[] = trim($tmp); } } } $newPluginDir = isset($_POST['mainwp_options_footprint_plugin_folder']) ? $_POST['mainwp_options_footprint_plugin_folder'] : ''; $maximumFileDescriptorsOverride = isset($_POST['mainwp_options_maximumFileDescriptorsOverride']); $maximumFileDescriptorsAuto = isset($_POST['mainwp_maximumFileDescriptorsAuto']); $maximumFileDescriptors = isset($_POST['mainwp_options_maximumFileDescriptors']) && MainWP_Utility::ctype_digit($_POST['mainwp_options_maximumFileDescriptors']) ? $_POST['mainwp_options_maximumFileDescriptors'] : 150; $archiveFormat = isset($_POST['mainwp_archiveFormat']) ? $_POST['mainwp_archiveFormat'] : 'global'; $http_user = $_POST['mainwp_managesites_edit_http_user']; $http_pass = $_POST['mainwp_managesites_edit_http_pass']; $url = $_POST['mainwp_managesites_edit_siteurl_protocol'] . '://' . MainWP_Utility::removeHttpPrefix($website->url, true); MainWP_DB::Instance()->updateWebsite($website->id, $url, $current_user->ID, $_POST['mainwp_managesites_edit_sitename'], $_POST['mainwp_managesites_edit_siteadmin'], $groupids, $groupnames, $_POST['offline_checks'], $newPluginDir, $maximumFileDescriptorsOverride, $maximumFileDescriptorsAuto, $maximumFileDescriptors, $_POST['mainwp_managesites_edit_verifycertificate'], $archiveFormat, isset($_POST['mainwp_managesites_edit_uniqueId']) ? $_POST['mainwp_managesites_edit_uniqueId'] : '', $http_user, $http_pass); do_action('mainwp_update_site', $website->id); $backup_before_upgrade = isset($_POST['mainwp_backup_before_upgrade']) ? intval($_POST['mainwp_backup_before_upgrade']) : 2; if ($backup_before_upgrade > 2) { $backup_before_upgrade = 2; } $newValues = array('automatic_update' => !isset($_POST['mainwp_automaticDailyUpdate']) ? 0 : 1, 'backup_before_upgrade' => $backup_before_upgrade, 'loadFilesBeforeZip' => $_POST['mainwp_options_loadFilesBeforeZip']); if (mainwp_current_user_can('dashboard', 'ignore_unignore_updates')) { $newValues['is_ignoreCoreUpdates'] = isset($_POST['mainwp_is_ignoreCoreUpdates']) && $_POST['mainwp_is_ignoreCoreUpdates'] ? 1 : 0; $newValues['is_ignorePluginUpdates'] = isset($_POST['mainwp_is_ignorePluginUpdates']) && $_POST['mainwp_is_ignorePluginUpdates'] ? 1 : 0; $newValues['is_ignoreThemeUpdates'] = isset($_POST['mainwp_is_ignoreThemeUpdates']) && $_POST['mainwp_is_ignoreThemeUpdates'] ? 1 : 0; } MainWP_DB::Instance()->updateWebsiteValues($website->id, $newValues); $updated = true; //Reload the site $website = MainWP_DB::Instance()->getWebsiteById($website->id); } $groups = MainWP_DB::Instance()->getGroupsForCurrentUser(); $statusses = array('hourly', '2xday', 'daily', 'weekly'); $pluginDir = $website->pluginDir; self::renderHeader('ManageSitesEdit'); MainWP_Manage_Sites_View::renderAllSites($website, $updated, $groups, $statusses, $pluginDir); self::renderFooter('ManageSitesEdit'); } }