本文整理汇总了PHP中fs类的典型用法代码示例。如果您正苦于以下问题:PHP fs类的具体用法?PHP fs怎么用?PHP fs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: dialplan
public static function dialplan($number)
{
$xml = Telephony::getDriver()->xml;
$destination = $number['Destination'];
if (!empty($destination['time'])) {
$parts = explode(';', $destination['time']);
if (count($parts) != 2) {
kohana::log('error', 'Time was not comprised of two parts');
return FALSE;
}
if ($parts[0] == $parts[1]) {
$time = $parts;
} else {
$time = $parts[0] . '-' . $parts[1];
}
} else {
kohana::log('error', 'Time of day route had no time');
return FALSE;
}
$weekDayColumns = array('sun', 'mon', 'tue', 'wen', 'thur', 'fri', 'sat');
$wday = '';
foreach ($weekDayColumns as $pos => $weekDayColumn) {
if (!empty($destination[$weekDayColumn])) {
$wday .= $pos + 1 . ',';
}
}
$wday = rtrim($wday, ',');
// TODO: This makes no sense....
if (empty($wday)) {
$wday = '1-7';
}
$xml->setXmlRoot($xml->getExtensionRoot());
$xml->update('/condition[@wday="' . $wday . '"]{@minute-of-day="' . $time . '"}');
if ($action = fs::getTransferToNumber($destination['during_number_id'])) {
$action = str_replace('transfer ', '', $action);
$xml->update('/condition[@wday="' . $wday . '"]/action[@application="transfer"]{@data="' . $action . '"}');
} else {
$xml->update('/condition[@wday="' . $wday . '"]/action[@application="hangup"]');
}
if ($antiAction = fs::getTransferToNumber($destination['outside_number_id'])) {
$antiAction = str_replace('transfer ', '', $antiAction);
$xml->update('/condition[@wday="' . $wday . '"]/anti-action[@application="transfer"]{@data="' . $antiAction . '"}');
} else {
$xml->update('/condition[@wday="' . $wday . '"]/action[@application="hangup"]');
}
}
开发者ID:swk,项目名称:bluebox,代码行数:46,代码来源:timeofday.php
示例17: create
static function create($options)
{
if (isset($options->cache)) {
$cache = $options->cache . 'cache.tmp';
if ($www = fs::read($cache)) {
$www = unserialize($www);
$www->locale->setup($options->language, $options->country);
return $www;
} else {
$www = new www($options);
fs::write($cache, serialize($www));
return $www;
}
} else {
return new www($options);
}
}
开发者ID:nyan-cat,项目名称:easyweb,代码行数:17,代码来源:www.php
示例18: dialplan
public static function dialplan($number)
{
$xml = Telephony::getDriver()->xml;
$destination = $number['Destination'];
if ($destination instanceof Device) {
$domain = '$${location_' . $destination['User']['location_id'] . '}';
$numberOptions = fs::getNumberOptions($number);
$xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}');
$xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}');
$xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}');
if (!empty($destination['plugins']['callerid']['internal_name'])) {
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['plugins']['callerid']['internal_name'] . '"}');
} else {
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}');
}
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}');
$xml->update('/action[@application="bridge"]{@data="user\\/' . $destination['plugins']['sip']['username'] . '@' . $domain . '"}');
}
}
开发者ID:swk,项目名称:bluebox,代码行数:19,代码来源:device.php
示例19: get
/**
* Create a database handle
* Factory method
* @param array params
*/
public static function get(array $config)
{
$engine = $config['engine'];
if (isset(self::$dbs[$engine])) {
return self::$dbs[$engine];
}
$engine_script = loader::get_root() . loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP;
core::dprint('[db] ' . $engine_script);
fs::req($engine_script, true);
if (!isset($config['server'])) {
$config['server'] = 'localhost';
}
// create instance
$class = "{$engine}_db";
try {
return self::$dbs[$engine] = new $class($config['server'], $config['login'], $config['password'], $config['database'], $config['prefix']);
} catch (dbal_exception $e) {
return false;
}
}
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:25,代码来源:database.php
示例20: dialplan
public static function dialplan($number)
{
$xml = Telephony::getDriver()->xml;
$destination = $number['Destination'];
if ($destination instanceof Device) {
$domain = '$${location_' . $destination['User']['location_id'] . '}';
$numberOptions = fs::getNumberOptions($number);
$xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}');
$xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}');
$xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}');
if (!empty($destination['plugins']['callerid']['internal_name'])) {
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['plugins']['callerid']['internal_name'] . '"}');
} else {
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}');
}
$xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}');
if (arr::get($destination, 'plugins', 'sip', 'sip_invite_format') == Sip_Plugin::SIP_FORMAT_DIGITS) {
$xml->update('/action[@application="export"][@bluebox="settingXmlInviteFormat"]{@data="sip_invite_req_uri=sip:' . $number['number'] . '${regex(${sofia_contact(' . $destination['plugins']['sip']['username'] . '\\@' . $domain . ')}|(\\@.*)|$1)}"}');
} else {
$xml->deleteNode('/action[@application="export"][@bluebox="settingXmlInviteFormat"]');
}
$condition = '/condition[@field="${privacy_hide_number}"][@expression="false"][@break="never"]';
$extenRoot = $xml->getExtensionRoot();
//If allowing multi sip interfaces, then we need to change the @data field with sofia_contact.
$dataString = 'user\\/' . $destination['plugins']['sip']['username'] . '@' . $domain;
if (arr::get($destination, 'registry', 'multi_sipinterface')) {
$dataString = '${sofia_contact(*\\/' . $destination['plugins']['sip']['username'] . '@' . $domain . ')}';
}
if (arr::get($destination, 'registry', 'anonymous_reject')) {
$xml->setXmlRoot($extenRoot . $condition);
//$xml->update('/action[@application="bridge"]{@data="user\/' .$destination['plugins']['sip']['username'] .'@' .$domain .'"}');
$xml->update('/action[@application="bridge"]{@data="' . $dataString . '"}');
$xml->setXmlRoot($extenRoot . '/condition[@bluebox="no_answer"]');
} else {
//$xml->update('/action[@application="bridge"]{@data="user\/' .$destination['plugins']['sip']['username'] .'@' .$domain .'"}');
$xml->update('/action[@application="bridge"]{@data="' . $dataString . '"}');
$xml->deleteNode($extenRoot . $condition);
$xml->deleteNode($extenRoot . '/condition[@bluebox="no_answer"]');
}
}
}
开发者ID:swk,项目名称:bluebox,代码行数:41,代码来源:device.php
注:本文中的fs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论