本文整理汇总了PHP中MainWP_Utility::removeHttpPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::removeHttpPrefix方法的具体用法?PHP MainWP_Utility::removeHttpPrefix怎么用?PHP MainWP_Utility::removeHttpPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::removeHttpPrefix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
//.........这里部分代码省略.........
<?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>
示例2: render
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;'" : '';
?>
>
//.........这里部分代码省略.........
示例3: renderAllSites
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>
//.........这里部分代码省略.........
示例4: renderAllSites
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;
}
//.........这里部分代码省略.........