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


PHP fs类代码示例

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


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

示例1: 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)) {
         fs::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";
         $user =& user::instance();
         if (($user_id = $user->get_id()) != DEFAULT_USER_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,代码行数:33,代码来源:log.class.php

示例2: set

 public static function set($autoattendant)
 {
     $xml = FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id']);
     media::generateConfig($autoattendant, $xml);
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->setAttributeValue('', 'digit-len', $autoattendant['extension_digits']);
     }
     $xml->setAttributeValue('', 'timeout', $autoattendant['timeout'] * 1000);
     $xml->setAttributeValue('', 'inter-digit-timeout', $autoattendant['digit_timeout'] * 1000);
     if (!empty($autoattendant['registry']['max-failures'])) {
         $xml->setAttributeValue('', 'max-failures', $autoattendant['registry']['max-failures']);
     } else {
         $xml->setAttributeValue('', 'max-failures', '3');
     }
     $xml->deleteChildren();
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@name="catch_all"][@digits="\\/^([0-9]{%s})$\\/"][@param="execute_extension $1 XML context_%s"]', $autoattendant['extension_digits'], $autoattendant['extension_context_id']));
     }
     foreach ($autoattendant['keys'] as $key) {
         if (!isset($key['digits'])) {
             continue;
         }
         if (!($transferString = fs::getTransferToNumber($key['number_id']))) {
             continue;
         }
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@digits="%s"][@param="transfer %s"]', $key['digits'], $transferString));
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:28,代码来源:autoattendant.php

示例3: _clean_up

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

示例4: _add_project_controllers

 function _add_project_controllers(&$result)
 {
     $items = fs::find_subitems(PROJECT_DIR . '/core/controllers/', 'f', '', false);
     sort($items);
     foreach ($items as $item) {
         $class = $this->_clean_class_path($item);
         $result[$class] = $class;
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:controllers_classes_options_datasource.class.php

示例5: _get_ini_cache_size

  function _get_ini_cache_size()
  {
    $size = 0;
    $files = fs :: find_subitems(CACHE_DIR, 'f');
	  foreach($files as $file)
	    $size += filesize($file);     
	  
	  return $size;  
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:display_cache_manager_action.class.php

示例6: _get_directory_file_size

  function _get_directory_file_size($dir)
  {
    $size = 0;
    $files = fs :: find($dir, 'f');
    foreach($files as $file)
      $size += filesize($file);

    return $size;
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:display_cache_manager_action.class.php

示例7: actionOperation

 public function actionOperation()
 {
     Yii::import('mod.core.components.fs');
     if (isset($_GET['operation'])) {
         //$fs = new fs(dirname(__FILE__) . DS . 'data' . DS . 'root' . DS);
         $fs = new fs(Yii::getPathOfAlias('webroot.themes'));
         try {
             $rslt = null;
             switch ($_GET['operation']) {
                 case 'get_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $rslt = $fs->lst($node, isset($_GET['id']) && $_GET['id'] === '#');
                     break;
                 case "get_content":
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $rslt = $fs->data($node);
                     break;
                 case 'create_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $rslt = $fs->create($node, isset($_GET['text']) ? $_GET['text'] : '', !isset($_GET['type']) || $_GET['type'] !== 'file');
                     break;
                 case 'rename_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $rslt = $fs->rename($node, isset($_GET['text']) ? $_GET['text'] : '');
                     break;
                 case 'delete_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $rslt = $fs->remove($node);
                     break;
                 case 'move_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/';
                     $rslt = $fs->move($node, $parn);
                     break;
                 case 'copy_node':
                     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
                     $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/';
                     $rslt = $fs->copy($node, $parn);
                     break;
                 default:
                     throw new Exception('Unsupported operation: ' . $_GET['operation']);
                     break;
             }
             header('Content-Type: application/json; charset=utf-8');
             echo json_encode($rslt);
         } catch (Exception $e) {
             header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error');
             header('Status:  500 Server Error');
             echo $e->getMessage();
         }
         die;
     }
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:53,代码来源:TemplateController.php

示例8: write_template_file

/**
* Writes a compiled template file
*
* @param string $ filename
* @param string $ content to write to the file
* @return void
* @access protected
*/
function write_template_file($file, $data)
{
    if (!is_dir(dirname($file))) {
        fs::mkdir(dirname($file), 0777, true);
    }
    $fp = fopen($file, "wb");
    if (fwrite($fp, $data, strlen($data))) {
        fclose($fp);
    }
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:18,代码来源:compiler_support.inc.php

示例9: _add_project_site_objects

  function _add_project_site_objects(&$result)
  {
    $items = fs :: find_subitems(PROJECT_DIR . '/core/model/site_objects/', 'f', '', false);

    foreach($items as $item)
    {
      $class = $this->_clean_class_path($item);
      $result[$class] = $class;
    }
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:site_objects_classes_options_datasource.class.php

示例10: perform

  function perform(&$request, &$response)
  {
    $files = fs :: find(VAR_DIR . '/compiled', 'f');
    foreach($files as $file)
      unlink($file);

    if($request->has_attribute('popup'))
      $response->write(close_popup_response($request));

    $request->set_status(REQUEST_STATUS_SUCCESS);
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:flush_template_cache_action.class.php

示例11: get_classes_list

 function get_classes_list()
 {
     $contents = array_merge(fs::ls(LIMB_DIR . '/core/model/site_objects/'), fs::ls(PROJECT_DIR . '/core/model/site_objects/'));
     $classes_list = array();
     foreach ($contents as $file_name) {
         if (substr($file_name, -10, 10) == '.class.php') {
             $classes_list[] = substr($file_name, 0, strpos($file_name, '.'));
         }
     }
     return $classes_list;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:all_site_objects_loader.class.php

示例12: perform

 function perform(&$request, &$response)
 {
     $files = fs::find_subitems(CACHE_DIR, 'f');
     foreach ($files as $file) {
         unlink($file);
     }
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     }
     $request->set_status(REQUEST_STATUS_SUCCESS);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:flush_ini_cache_action.class.php

示例13: register

 /**
  * Register module
  * @throws modules_exception
  * @return object|bool module
  */
 public function register($module)
 {
     core::dprint('[mod_register] ' . $module);
     $module_class = loader::CLASS_PREFIX . $module;
     $module_path = loader::get_root() . loader::DIR_MODULES . $module . '/';
     $module_file = $module_path . 'module' . loader::DOT_PHP;
     if (!fs::file_exists($module_file)) {
         throw new modules_exception('Failed to register module ' . $module . '. File does not exists');
     }
     require_once $module_file;
     $this->set($module, new $module_class($module_path));
     return $this->get($module);
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:18,代码来源:modules.php

示例14: set

 public static function set($autoattendant)
 {
     $xml = FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id']);
     if (empty($autoattendant['registry']['mediafile_id']) or !class_exists('Media')) {
         $type = 'tty';
     } else {
         $type = $autoattendant['registry']['type'];
     }
     switch ($type) {
         case 'audio':
             $xml->setAttributeValue('', 'greet-long', Media::getMediaFile($autoattendant['registry']['mediafile_id']));
             $xml->setAttributeValue('', 'greet-short', Media::getMediaFile($autoattendant['registry']['mediafile_id']));
             break;
         default:
             if (empty($autoattendant['registry']['tts_string'])) {
                 $tts_string = 'Thank you for calling, your call is important to us.';
             } else {
                 $tts_string = $autoattendant['registry']['tts_string'];
             }
             $tts_string = 'say:' . preg_replace('/[^A-Za-z0-9.,!? ]/', '', $tts_string);
             $xml->setAttributeValue('', 'tts-engine', 'flite');
             $xml->setAttributeValue('', 'tts-voice', 'kal');
             $xml->setAttributeValue('', 'greet-long', $tts_string);
             $xml->setAttributeValue('', 'greet-short', $tts_string);
     }
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->setAttributeValue('', 'digit-len', $autoattendant['extension_digits']);
     }
     $xml->setAttributeValue('', 'timeout', $autoattendant['timeout'] * 1000);
     $xml->setAttributeValue('', 'inter-digit-timeout', $autoattendant['digit_timeout'] * 1000);
     if (!empty($autoattendant['registry']['max-failures'])) {
         $xml->setAttributeValue('', 'max-failures', $autoattendant['registry']['max-failures']);
     } else {
         $xml->setAttributeValue('', 'max-failures', '3');
     }
     $xml->deleteChildren();
     if (!empty($autoattendant['extension_context_id'])) {
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@name="catch_all"][@digits="\\/^([0-9]{%s})$\\/"][@param="execute_extension $1 XML context_%s"]', $autoattendant['extension_digits'], $autoattendant['extension_context_id']));
     }
     foreach ($autoattendant['keys'] as $key) {
         if (!isset($key['digits'])) {
             continue;
         }
         if (!($transferString = fs::getTransferToNumber($key['number_id']))) {
             continue;
         }
         $xml->update(sprintf('/entry[@action="menu-exec-app"][@digits="%s"][@param="transfer %s"]', $key['digits'], $transferString));
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:49,代码来源:autoattendant.php

示例15: clear_static

 function clear_static()
 {
     if (!$this->get_domain()) {
         return false;
     }
     $root = core::module('sat')->get_static_root($this);
     $data = array();
     fs::build_tree($root, $data);
     foreach ($data['files'] as $f) {
         fs::unlink($f);
     }
     $data['dirs'] = array_reverse($data['dirs']);
     foreach ($data['dirs'] as $f) {
         fs::unlink($f, true);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:16,代码来源:item.php


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