• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP dir类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: read

 public function read($url = '', $recursive = false, $format = 'flat')
 {
     if (substr($url, -1) !== Application::DS) {
         $url .= Application::DS;
     }
     if ($this->ignore('find', $url)) {
         return array();
     }
     $list = array();
     $cwd = getcwd();
     chdir($url);
     if ($handle = opendir($url)) {
         while (false !== ($entry = readdir($handle))) {
             $recursiveList = array();
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             $file = new stdClass();
             $file->url = $url . $entry;
             if (is_dir($file->url)) {
                 $file->url .= Application::DS;
                 $file->type = 'dir';
             }
             if ($this->ignore('find', $file->url)) {
                 continue;
             }
             $file->name = $entry;
             if (isset($file->type)) {
                 if (!empty($recursive)) {
                     $directory = new dir();
                     $directory->ignore('list', $this->ignore());
                     $recursiveList = $directory->read($file->url, $recursive, $format);
                     if ($format !== 'flat') {
                         $file->list = $recursiveList;
                         unset($recursiveList);
                     }
                 }
             } else {
                 $file->type = 'file';
             }
             if (is_link($entry)) {
                 $file->link = true;
             }
             /* absolute url is_link wont work probably the targeting type
             			if(is_link($file->url)){
             				$file->link = true;
             			}
             			*/
             $list[] = $file;
             if (!empty($recursiveList)) {
                 foreach ($recursiveList as $recursive_nr => $recursive_file) {
                     $list[] = $recursive_file;
                 }
             }
         }
     }
     closedir($handle);
     return $list;
 }
开发者ID:remco-pc,项目名称:System,代码行数:59,代码来源:Dir.class.php


示例2: uninstall

 protected function uninstall($plugin, $output)
 {
     $root = $this->kirby()->roots()->plugins() . DS . $plugin;
     dir::remove($root);
     $output->writeln('<comment>The "' . $plugin . '" plugin has been removed!</comment>');
     $output->writeln('');
 }
开发者ID:getkirby,项目名称:cli,代码行数:7,代码来源:Uninstall.php


示例3: deleteFile

 public static function deleteFile($id)
 {
     $values = [];
     for ($i = 1; $i <= 10; $i++) {
         $values[] = '`media' . $i . '` = ' . $id;
     }
     for ($i = 1; $i <= 10; $i++) {
         $values[] = '`medialist' . $i . '` LIKE "%|' . $id . '|%"';
     }
     $sql = sql::factory();
     $sql->query('SELECT id FROM ' . sql::table('structure_area') . ' WHERE ' . implode(' OR ', $values))->result();
     if ($sql->num()) {
         echo message::warning(lang::get('file_in_use'));
     } else {
         $sql = sql::factory();
         $sql->setTable('media');
         $sql->setWhere('id=' . $id);
         $sql->select('filename');
         $sql->result();
         if (unlink(dir::media($sql->get('filename')))) {
             $sql->delete();
             return message::success(lang::get('file_deleted'), true);
         } else {
             return message::warning(sprintf(lang::get('file_not_deleted'), dyn::get('hp_url'), $sql->get('filename')), true);
         }
     }
 }
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:27,代码来源:mediaUtils.php


示例4: uninstall

 static function uninstall()
 {
     graphics::remove_rules("watermark");
     module::delete("watermark");
     Database::instance()->query("DROP TABLE `watermarks`");
     dir::unlink(VARPATH . "modules/watermark");
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:watermark_installer.php


示例5: __construct

 public function __construct($params = array())
 {
     $defaults = array('page' => page(), 'headline' => 'Mentions');
     if (is_a($params, 'Page')) {
         $params = array('page' => $params);
     } else {
         if (is_string($params)) {
             $params = array('headline' => $params);
         }
     }
     $this->options = array_merge($defaults, $params);
     $this->page = $this->options['page'];
     $this->root = $this->page->root() . DS . '.webmentions';
     $this->headline = new Field($this->page, 'headline', $this->options['headline']);
     if (!is_dir($this->root)) {
         return;
     }
     $files = dir::read($this->root);
     // flip direction
     rsort($files);
     foreach ($files as $file) {
         // skip the pings cache
         if ($file == 'pings.json') {
             continue;
         }
         // register a new webmention
         try {
             $mention = new Mention($this->page, $this->root . DS . $file);
             $this->append($mention->id(), $mention);
         } catch (Exception $e) {
         }
     }
 }
开发者ID:aizlewood,项目名称:2016,代码行数:33,代码来源:mentions.php


示例6: checkAvatars

 protected function checkAvatars()
 {
     $root = kirby()->roots()->avatars();
     // try to create the avatars folder
     dir::make($root);
     return is_writable($root);
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:7,代码来源:installer.php


示例7: _clean_up

 function _clean_up()
 {
     parent::_clean_up();
     dir::rm(MEDIA_DIR);
     $this->db->sql_delete('file_object');
     $this->db->sql_delete('media');
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:file_object_tester.class.php


示例8: write

 function write($log_file_data, $string)
 {
     $log_dir = $log_file_data[0];
     $log_name = $log_file_data[1];
     $file_name = $log_dir . $log_name;
     if (!is_dir($log_dir)) {
         dir::mkdir($log_dir, 0775, true);
     }
     $oldumask = @umask(0);
     $file_existed = @file_exists($file_name);
     $log_file = @fopen($file_name, 'a');
     if ($log_file) {
         $time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
         $notice = '[ ' . $time . " ]\n";
         if ($user_id = user::get_id()) {
             $notice .= '[ ' . $user_id . ' ] [ ' . user::get_login() . ' ] [ ' . user::get_email() . ' ] ';
         }
         $notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
         @fwrite($log_file, $notice);
         @fclose($log_file);
         if (!$file_existed) {
             @chmod($file_name, 0664);
         }
         @umask($oldumask);
         $result = true;
     } else {
         @umask($oldumask);
         $result = false;
         debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:log.class.php


示例9: _update_media_record

 function _update_media_record($id, $tmp_file_path, $file_name, $mime_type)
 {
     if (!file_exists($tmp_file_path)) {
         debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path));
         return false;
     }
     if (function_exists('md5_file')) {
         $etag = md5_file($tmp_file_path);
     } else {
         $fd = fopen($data['tmp_name'], 'rb');
         $contents = fread($fd, filesize($tmp_file_path));
         fclose($fd);
         $etag = md5($contents);
     }
     if (!is_dir(MEDIA_DIR)) {
         dir::mkdir(MEDIA_DIR, 777, true);
     }
     if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) {
         debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media'));
         return false;
     }
     $media_db_table = db_table_factory::instance('media');
     $media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag));
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:media_object.class.php


示例10: getUnInstalled

 public function getUnInstalled()
 {
     $installed = (array) $this->getInstalled();
     $folders = dir::folders(ZPATH_MODULES, '.', false);
     $folders = array_diff($folders, array_keys($installed));
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZPATH_MODULES . DS . $folder;
         $moduleUrl = url::modules() . '/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         if (file::exists($moduleFile)) {
             $m = (include $moduleFile);
             $m['path'] = '$modules/' . $folder;
             $m['url'] = '$modules/' . $folder;
             if (!isset($m['icon'])) {
                 if (!file::exists($modulePath . '/icon.png')) {
                     $m['icon'] = url::theme() . '/image/skin/none.png';
                 } else {
                     $m['icon'] = $moduleUrl . '/icon.png';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:26,代码来源:module.php


示例11: autoloader

 /**
  * Die eigentliche Funktion des Autoloader
  *
  * @param	string	$class			Der Klassennamen
  * @return	bool
  */
 public static function autoloader($class)
 {
     if (self::classExists($class)) {
         return true;
     }
     preg_match_all("/(?:^|[A-Z])[a-z]+/", $class, $treffer);
     $classPath = implode(DIRECTORY_SEPARATOR, array_map('strtolower', $treffer[0]));
     if (isset(self::$classes[$class])) {
         if (is_readable(self::$classes[$class])) {
             self::addClass($class, self::$classes[$class]);
             if (self::classExists($class)) {
                 return true;
             }
         }
         // Datei im Cache drin, jedoch exsistiert sie nichtmehr
         unset(self::$classes[$class]);
         self::$isNewCache = true;
     }
     if (is_readable(dir::classes($classPath . '.php'))) {
         self::addClass($class, dir::classes($classPath . '.php'));
     }
     if (self::classExists($class)) {
         return true;
     }
     $classPath = self::$composer->findFile($class);
     if (!is_null($classPath)) {
         self::addClass($class, $classPath);
     }
     return self::classExists($class);
 }
开发者ID:pasternt,项目名称:dynaoCMS,代码行数:36,代码来源:autoload.php


示例12: __construct

 /**
  * Constructor
  *
  * @param mixed $source
  * @param array $params
  */
 public function __construct($source, $params = array())
 {
     $this->source = $this->result = is_a($source, 'Media') ? $source : new Media($source);
     $this->options = array_merge(static::$defaults, $this->params($params));
     $this->destination = $this->destination();
     // don't create the thumbnail if it's not necessary
     if ($this->isObsolete()) {
         return;
     }
     // don't create the thumbnail if it exists
     if (!$this->isThere()) {
         // try to create the thumb folder if it is not there yet
         dir::make(dirname($this->destination->root));
         // check for a valid image
         if (!$this->source->exists() || $this->source->type() != 'image') {
             throw new Error('The given image is invalid', static::ERROR_INVALID_IMAGE);
         }
         // check for a valid driver
         if (!array_key_exists($this->options['driver'], static::$drivers)) {
             throw new Error('Invalid thumbnail driver', static::ERROR_INVALID_DRIVER);
         }
         // create the thumbnail
         $this->create();
         // check if creating the thumbnail failed
         if (!file_exists($this->destination->root)) {
             return;
         }
     }
     // create the result object
     $this->result = new Media($this->destination->root, $this->destination->url);
 }
开发者ID:getkirby,项目名称:toolkit,代码行数:37,代码来源:thumb.php


示例13: _reset

 private function _reset()
 {
     $db = Database::instance();
     // Drop all tables
     foreach ($db->list_tables() as $table) {
         $db->query("DROP TABLE IF EXISTS `{$table}`");
     }
     // Clean out data
     dir::unlink(VARPATH . "uploads");
     dir::unlink(VARPATH . "albums");
     dir::unlink(VARPATH . "resizes");
     dir::unlink(VARPATH . "thumbs");
     dir::unlink(VARPATH . "modules");
     dir::unlink(VARPATH . "tmp");
     $db->clear_cache();
     module::$modules = array();
     module::$active = array();
     // Use a known random seed so that subsequent packaging runs will reuse the same random
     // numbers, keeping our install.sql file more stable.
     srand(0);
     gallery_installer::install(true);
     module::load_modules();
     foreach (array("user", "comment", "organize", "info", "rss", "search", "slideshow", "tag") as $module_name) {
         module::install($module_name);
         module::activate($module_name);
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:27,代码来源:packager.php


示例14: save

 public static function save()
 {
     if (!self::$isChange) {
         return true;
     }
     $newEntrys = array_merge(self::$params, self::$newEntrys);
     return file_put_contents(dir::backend('lib' . DIRECTORY_SEPARATOR . 'config.json'), json_encode($newEntrys, JSON_PRETTY_PRINT));
 }
开发者ID:pasterntt,项目名称:dynaoCMS,代码行数:8,代码来源:dyn.php


示例15: getConfig

 public static function getConfig($name)
 {
     $configFile = dir::addon($name, 'config.json');
     if (file_exists($configFile)) {
         return json_decode(file_get_contents($configFile), true);
     }
     return false;
 }
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:8,代码来源:config.php


示例16: flush

 static function flush()
 {
     $root = c::get('root.cache');
     if (!is_dir($root)) {
         return $root;
     }
     dir::clean($root);
 }
开发者ID:narrenfrei,项目名称:kirbycms,代码行数:8,代码来源:cache.php


示例17: _listModaltpl

 /**
  * 列出前台风格的模型视图界面
  */
 private function _listModaltpl()
 {
     $dir = array();
     $front_config = (include PATH_ROOT . '/config/app.php');
     $style = $front_config['TPL_DIR'] . '/' . $front_config['TPL_STYLE'];
     $dir = dir::tree($style . '/model');
     return $dir;
 }
开发者ID:com-itzcy,项目名称:hdjob,代码行数:11,代码来源:dataModelControl.php


示例18: write

 public static function write($content, $id, $type = 'article')
 {
     $file = self::getFileName($id, $type);
     if (!file_put_contents(dir::cache(self::FOLDER . DIRECTORY_SEPARATOR . $file), $content, LOCK_EX)) {
         return false;
     }
     return true;
 }
开发者ID:pasterntt,项目名称:dynao-CMS,代码行数:8,代码来源:cache.php


示例19: test_mkdir_windows

 function test_mkdir_windows()
 {
     if (sys::os_type() != 'win32') {
         return;
     }
     dir::mkdir(VAR_DIR . '/./tmp\\../tmp/wow////hey/', 0777, true);
     $this->assertTrue(is_dir(VAR_DIR . '/tmp/wow/hey/'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:test_dir.php


示例20: custom

 public function custom()
 {
     $kirby = kirby();
     $root = $kirby->roots()->widgets();
     foreach (dir::read($root) as $dir) {
         $kirby->registry->set('widget', $dir, $root . DS . $dir, true);
     }
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:8,代码来源:widgets.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP discuz_censor类代码示例发布时间:2022-05-23
下一篇:
PHP dibi类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap