本文整理汇总了PHP中MainWP_Utility::endsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::endsWith方法的具体用法?PHP MainWP_Utility::endsWith怎么用?PHP MainWP_Utility::endsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::endsWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadFile
function uploadFile($file)
{
header('Content-Description: File Transfer');
if (MainWP_Utility::endsWith($file, '.tar.gz')) {
header('Content-Type: application/x-gzip');
header("Content-Encoding: gzip'");
} else {
header('Content-Type: application/octet-stream');
}
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
while (@ob_get_level()) {
@ob_end_clean();
}
$this->readfile_chunked($file);
exit;
}
示例2: addExcludedBackups
private static function addExcludedBackups(&$files, &$arr)
{
$newExcludes = array();
//Backup buddy
$newExcludes[] = 'wp-content/uploads/backupbuddy_backups';
$newExcludes[] = 'wp-content/uploads/backupbuddy_temp';
$newExcludes[] = 'wp-content/uploads/pb_backupbuddy';
//ManageWP
$newExcludes[] = 'wp-content/managewp';
//InfiniteWP
$newExcludes[] = 'wp-content/infinitewp';
//WordPress Backup to Dropbox
$newExcludes[] = 'wp-content/backups';
//BackWPUp
$newExcludes[] = 'wp-content/uploads/backwpup*';
//WP Complete Backup
$newExcludes[] = 'wp-content/plugins/wp-complete-backup/storage';
//Online Backup for WordPress
$newExcludes[] = 'wp-content/backups';
//XCloner
$newExcludes[] = 'administrator/backups';
foreach ($newExcludes as $newExclude) {
$path = explode('/', $newExclude);
$found = true;
$newExcludeSuffix = null;
$currentArr = null;
foreach ($path as $pathPart) {
if ($currentArr == null) {
if (isset($files[$pathPart])) {
$currentArr = $files[$pathPart];
}
} else {
if (isset($currentArr[$pathPart])) {
$currentArr = $currentArr[$pathPart];
} else {
if (MainWP_Utility::endsWith($pathPart, '*')) {
foreach ($currentArr as $key => $val) {
if (MainWP_Utility::startsWith($key, substr($pathPart, 0, strlen($pathPart) - 1))) {
if ($newExcludeSuffix == null) {
$newExcludeSuffix = array();
}
$newExcludeSuffix[] = $key;
}
}
if ($newExcludeSuffix != null && count($newExcludeSuffix) > 0) {
break;
}
}
$currentArr = null;
}
}
if (!is_array($currentArr)) {
$found = false;
break;
}
}
if ($found) {
if ($newExcludeSuffix != null) {
$newExclude = substr($newExclude, 0, strrpos($newExclude, '/') + 1);
foreach ($newExcludeSuffix as $newExcludeSuff) {
$arr[] = $newExclude . $newExcludeSuff;
}
} else {
$arr[] = $newExclude;
}
}
}
}