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


PHP Path::dirContent方法代码示例

本文整理汇总了PHP中Path::dirContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::dirContent方法的具体用法?PHP Path::dirContent怎么用?PHP Path::dirContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path::dirContent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 public function generate()
 {
     set_time_limit(600);
     $this->autoRender = false;
     App::uses('Path', 'Core.Vendor');
     Configure::write('Config.language', 'rus');
     $msgFile = '../Locale/' . Configure::read('Config.language') . '/LC_MESSAGES/default.';
     $this->msgFile = $msgFile . 'po';
     file_put_contents($msgFile . 'bak', file_get_contents($msgFile . 'po'), false);
     Path::process(Path::dirContent('../'), array($this, '_process'), true);
     echo $this->count . ' label(s) processed';
 }
开发者ID:Fyr,项目名称:frtm,代码行数:12,代码来源:IndexController.php

示例2: process

 public static function process($aPath, $callbackProcessFn, $recursive = false, $aParams = array())
 {
     if (isset($aPath['files'])) {
         foreach ($aPath['files'] as $fname) {
             call_user_func($callbackProcessFn, $fname, $aPath['path'], $aParams);
         }
     }
     if ($recursive && isset($aPath['folders'])) {
         foreach ($aPath['folders'] as $folder) {
             Path::process(Path::dirContent($aPath['path'] . $folder . '/'), $callbackProcessFn, true, $aParams);
         }
     }
 }
开发者ID:Fyr,项目名称:frtm,代码行数:13,代码来源:Path.php

示例3: beforeDelete

 /**
  * Removes actual media-files before delete a record
  *
  * @param bool $cascade
  * @return bool
  */
 public function beforeDelete($cascade = true)
 {
     App::uses('Path', 'Core.Vendor');
     $media = $this->findById($this->id);
     if ($media) {
         $path = $this->PHMedia->getPath($media[$this->alias]['object_type'], $this->id);
         if (file_exists($path)) {
             // remove all files in folder
             $aPath = Path::dirContent($path);
             if (isset($aPath['files']) && $aPath['files']) {
                 foreach ($aPath['files'] as $file) {
                     unlink($aPath['path'] . $file);
                 }
             }
             rmdir($path);
         }
     }
     return true;
 }
开发者ID:Mirocow,项目名称:gpz,代码行数:25,代码来源:Media.php

示例4: cleanCache

 /**
  * Removes all temp cached images
  *
  * @param int $id
  */
 public function cleanCache($id)
 {
     App::uses('Path', 'Core.Vendor');
     $media = $this->findById($id);
     if (Hash::get($media, $this->alias . '.media_type') == 'image') {
         $path = $this->PHMedia->getPath($media[$this->alias]['object_type'], $id);
         if (file_exists($path)) {
             // remove all files in folder
             $aPath = Path::dirContent($path);
             if (isset($aPath['files']) && $aPath['files']) {
                 foreach ($aPath['files'] as $file) {
                     if ($file != $media[$this->alias]['file'] . $media[$this->alias]['ext'] && $file != 'thumb.png') {
                         unlink($aPath['path'] . $file);
                     }
                 }
             }
         }
     }
 }
开发者ID:Fyr,项目名称:frtm,代码行数:24,代码来源:Media.php

示例5: beforeDelete

 /**
  * Removes actual media-files before delete a record
  *
  * @param bool $cascade
  * @return bool
  */
 public function beforeDelete($cascade = true)
 {
     App::uses('Path', 'Core.Vendor');
     $media = $this->findById($this->id);
     if (!empty($media['Media']['orig_fsize'])) {
         $file_size = $media['Media']['orig_fsize'];
         if ($file_size > 0) {
             App::uses('CakeSession', 'Model/Datasource');
             $user_id = CakeSession::read('Auth.User.id');
             $this->updateStorageData($user_id, 'Cloud', $file_size, $operation = 'subtract');
         }
     }
     if ($media) {
         $path = $this->PHMedia->getPath($media[$this->alias]['object_type'], $this->id);
         if (file_exists($path)) {
             // remove all files in folder
             $aPath = Path::dirContent($path);
             if (isset($aPath['files']) && $aPath['files']) {
                 foreach ($aPath['files'] as $file) {
                     unlink($aPath['path'] . $file);
                 }
             }
             rmdir($path);
         }
     }
     return true;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:33,代码来源:Media.php


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