本文整理汇总了PHP中MainWP_Utility::getFileParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getFileParameter方法的具体用法?PHP MainWP_Utility::getFileParameter怎么用?PHP MainWP_Utility::getFileParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getFileParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: openSiteRestore
public static function openSiteRestore($website, $file, $size)
{
?>
<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-globe"></i> <?php
echo stripslashes($website->name);
?>
</h2>
<div style="clear: both;"></div>
<br/>
<div id="mainwp_background-box">
<?php
_e('Will redirect to your website immediately.', 'mainwp');
$url = isset($website->siteurl) && $website->siteurl != '' ? $website->siteurl : $website->url;
$url .= substr($url, -1) != '/' ? '/' : '';
$postdata = MainWP_Utility::getGetDataAuthed($website, $file, MainWP_Utility::getFileParameter($website), true);
$postdata['size'] = $size;
?>
<form method="POST" action="<?php
echo $url;
?>
" id="redirectForm">
<?php
foreach ($postdata as $name => $value) {
echo '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
}
?>
</form>
</div>
</div>
<?php
}
示例2: backup
public static function backup($pSiteId, $pType, $pSubfolder, $pExclude, $excludebackup, $excludecache, $excludenonwp, $excludezip, $pFilename = null, $pFileNameUID = '', $pArchiveFormat = false, $pMaximumFileDescriptorsOverride = false, $pMaximumFileDescriptorsAuto = false, $pMaximumFileDescriptors = false, $pLoadFilesBeforeZip = false, $pid = false, $append = false)
{
if (trim($pFilename) == '') {
$pFilename = null;
}
$backup_result = array();
//Creating a backup
$website = MainWP_DB::Instance()->getWebsiteById($pSiteId);
$subfolder = str_replace('%sitename%', MainWP_Utility::sanitize($website->name), $pSubfolder);
$subfolder = str_replace('%url%', MainWP_Utility::sanitize(MainWP_Utility::getNiceURL($website->url)), $subfolder);
$subfolder = str_replace('%type%', $pType, $subfolder);
$subfolder = str_replace('%date%', MainWP_Utility::date('Ymd'), $subfolder);
$subfolder = str_replace('%task%', '', $subfolder);
$subfolder = str_replace('%', '', $subfolder);
$subfolder = MainWP_Utility::removePreSlashSpaces($subfolder);
$subfolder = MainWP_Utility::normalize_filename($subfolder);
if (!MainWP_Utility::can_edit_website($website)) {
throw new MainWP_Exception('You are not allowed to backup this site');
}
$websiteCleanUrl = $website->url;
if (substr($websiteCleanUrl, -1) == '/') {
$websiteCleanUrl = substr($websiteCleanUrl, 0, -1);
}
$websiteCleanUrl = str_replace(array('http://', 'https://', '/'), array('', '', '-'), $websiteCleanUrl);
//Normal flow: use website & fallback to global
if ($pMaximumFileDescriptorsOverride == false) {
if ($website->maximumFileDescriptorsOverride == 1) {
$maximumFileDescriptorsAuto = $website->maximumFileDescriptorsAuto == 1;
$maximumFileDescriptors = $website->maximumFileDescriptors;
} else {
$maximumFileDescriptorsAuto = get_option('mainwp_maximumFileDescriptorsAuto');
$maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
$maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
}
} else {
if ($pArchiveFormat != 'global' && $pMaximumFileDescriptorsOverride == 1) {
$maximumFileDescriptorsAuto = $pMaximumFileDescriptorsAuto == 1;
$maximumFileDescriptors = $pMaximumFileDescriptors;
} else {
$maximumFileDescriptorsAuto = get_option('mainwp_maximumFileDescriptorsAuto');
$maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
$maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
}
}
$file = str_replace(array('%sitename%', '%url%', '%date%', '%time%', '%type%'), array(MainWP_Utility::sanitize($website->name), $websiteCleanUrl, MainWP_Utility::date('m-d-Y'), MainWP_Utility::date('G\\hi\\ms\\s'), $pType), $pFilename);
$file = str_replace('%', '', $file);
$file = MainWP_Utility::normalize_filename($file);
//Normal flow: check site settings & fallback to global
if ($pLoadFilesBeforeZip == false) {
$loadFilesBeforeZip = $website->loadFilesBeforeZip;
if ($loadFilesBeforeZip == 1) {
$loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
$loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
} else {
$loadFilesBeforeZip = $loadFilesBeforeZip == 2;
}
} else {
if ($pArchiveFormat == 'global' || $pLoadFilesBeforeZip == 1) {
$loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
$loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
} else {
$loadFilesBeforeZip = $pLoadFilesBeforeZip == 2;
}
}
//Nomral flow: check site settings & fallback to global
if ($pArchiveFormat == false) {
$archiveFormat = MainWP_Utility::getCurrentArchiveExtension($website);
} else {
if ($pArchiveFormat == 'global') {
$archiveFormat = MainWP_Utility::getCurrentArchiveExtension();
} else {
$archiveFormat = $pArchiveFormat;
}
}
MainWP_Utility::endSession();
$information = MainWP_Utility::fetchUrlAuthed($website, 'backup', array('type' => $pType, 'exclude' => $pExclude, 'excludebackup' => $excludebackup, 'excludecache' => $excludecache, 'excludenonwp' => $excludenonwp, 'excludezip' => $excludezip, 'ext' => $archiveFormat, 'file_descriptors_auto' => $maximumFileDescriptorsAuto, 'file_descriptors' => $maximumFileDescriptors, 'loadFilesBeforeZip' => $loadFilesBeforeZip, MainWP_Utility::getFileParameter($website) => $file, 'fileUID' => $pFileNameUID, 'pid' => $pid, 'append' => $append ? 1 : 0), false, false, false);
do_action('mainwp_managesite_backup', $website, array('type' => $pType), $information);
if (isset($information['error'])) {
throw new MainWP_Exception($information['error']);
} else {
if ($pType == 'db' && !$information['db']) {
throw new MainWP_Exception('Database backup failed.');
} else {
if ($pType == 'full' && !$information['full']) {
throw new MainWP_Exception('Full backup failed.');
} else {
if (isset($information['db'])) {
if ($information['db'] != false) {
$backup_result['url'] = $information['db'];
$backup_result['type'] = 'db';
} else {
if ($information['full'] != false) {
$backup_result['url'] = $information['full'];
$backup_result['type'] = 'full';
}
}
if (isset($information['size'])) {
$backup_result['size'] = $information['size'];
}
$backup_result['subfolder'] = $subfolder;
//.........这里部分代码省略.........