当前位置: 首页>>代码示例>>PHP>>正文


PHP MainWP_Utility::endsWith方法代码示例

本文整理汇总了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;
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:20,代码来源:class-mainwp-system.php

示例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;
             }
         }
     }
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:68,代码来源:page-mainwp-manage-backups.php


注:本文中的MainWP_Utility::endsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。