本文整理汇总了PHP中IO_Read函数的典型用法代码示例。如果您正苦于以下问题:PHP IO_Read函数的具体用法?PHP IO_Read怎么用?PHP IO_Read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IO_Read函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Load
public function Load()
{
#-----------------------------------------------------------------------------
$SessionID = $this->SessionID;
#-----------------------------------------------------------------------------
if (!$SessionID) {
return FALSE;
}
#-----------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error('[Session->Load]: не удалось найти временную папку');
}
#-----------------------------------------------------------------------------
$Path = SPrintF('%s/sessions/%s', $Tmp, $SessionID);
#-----------------------------------------------------------------------------
if (!File_Exists($Path)) {
return FALSE;
}
#-----------------------------------------------------------------------------
$Content = IO_Read($Path);
if (Is_Error($Content)) {
return ERROR | @Trigger_Error('[Session->Load]: не удалось прочитать файл сессии');
}
#-----------------------------------------------------------------------------
#$this->Data = @UnSerialize($Content);
$this->Data = @JSON_Decode($Content, true);
if ($this->Data === FALSE) {
return ERROR | @Trigger_Error('[Session->Load]: не удалось восстановить данные из файла сессии');
}
#-----------------------------------------------------------------------------
return TRUE;
}
示例2: Load
public function Load($TemplateID)
{
/****************************************************************************/
$__args_types = array('string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
foreach ($__args__ as $__arg__) {
#---------------------------------------------------------------------------
$this->TemplateID = $__arg__;
#---------------------------------------------------------------------------
$Path = System_Element(SPrintF('templates/%s.xml', $__arg__));
if (!Is_Error($Path)) {
#-------------------------------------------------------------------------
$Source = IO_Read($Path);
if (Is_Error($Source)) {
return ERROR | @Trigger_Error('[DOM->Load]: не удалось загрузить файл шаблона');
}
#-------------------------------------------------------------------------
$this->Object = String_XML_Parse($Source);
if (Is_Exception($this->Object)) {
return ERROR | @Trigger_Error('[DOM->Load]: не удалось преобразовать XML');
}
#-------------------------------------------------------------------------
$this->Object = Current($this->Object->Childs);
#-------------------------------------------------------------------------
$this->Linking();
#-------------------------------------------------------------------------
break;
}
}
#-----------------------------------------------------------------------------
$Trigger = SPrintF('Triggers/DOM/Before/%s', $this->TemplateID);
#-----------------------------------------------------------------------------
if ($this->TemplateID) {
#---------------------------------------------------------------------------
if (!Is_Error(System_Element(SPrintF('comp/%s.comp.php', $Trigger)))) {
#-------------------------------------------------------------------------
$LinkID = UniqID('DOM-');
#-------------------------------------------------------------------------
$Links =& Links();
# Коллекция ссылок
$Links[$LinkID] =& $this;
#-------------------------------------------------------------------------
$Comp = Comp_Load($Trigger, $LinkID, COMP_ALL_HOSTS);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error('[DOM->Load]: ошибка загрузки предобработчика');
}
#-------------------------------------------------------------------------
unset($Links[$LinkID]);
}
}
#-----------------------------------------------------------------------------
return TRUE;
}
示例3: TemplateReplace
function TemplateReplace($Text, $Params = array(), $NoBody = TRUE)
{
#-------------------------------------------------------------------------------
$Text = Trim($Text);
#-------------------------------------------------------------------------------
# проверяем что нам сунули - текст или файл
if (!Preg_Match('/\\s/', $Text)) {
#-------------------------------------------------------------------------------
# достаём текст из файла
$Path = System_Element(SPrintF('templates/modules/%s.html', $Text));
#-------------------------------------------------------------------------------
if (Is_Error($Path)) {
#-------------------------------------------------------------------------------
$Text = SprintF('Отсутствует шаблон сообщения (templates/modules/%s.html)', $Text);
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$Text = Trim(IO_Read($Path));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($NoBody) {
$Text = SPrintF('<NOBODY><SPAN>%s</SPAN></NOBODY>', $Text);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Replace = Array_ToLine($Params, '%');
#-------------------------------------------------------------------------------
foreach (Array_Keys($Replace) as $Key) {
$Text = Str_Replace($Key, $Replace[$Key], $Text);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Text;
#-------------------------------------------------------------------------------
}
示例4: Tag
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Tr = new Tag('TR');
#-------------------------------------------------------------------------------
if (!isset($GLOBALS['__USER'])) {
#-------------------------------------------------------------------------------
$Links['DOM']->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Logon.js}')));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Path = System_Element('templates/TopPanel/Logon.xml');
if (Is_Error($Path)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Parse = IO_Read($Path);
if (Is_Error($Parse)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Tr->AddHTML($Parse);
#-------------------------------------------------------------------------------
$Script = new Tag('SCRIPT', array('type' => 'text/javascript'), "function TopPanelLogon(){ Logon(document.getElementById('TopPanelEmail').value,document.getElementById('TopPanelPassword').value,document.getElementById('TopPanelIsRemember').checked); }");
#-------------------------------------------------------------------------------
$Links['DOM']->AddChild('Head', $Script);
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
$__USER = $GLOBALS['__USER'];
#-------------------------------------------------------------------------------
if (Is_Null($__USER)) {
示例5: FadeIn
//----------------------------------------------------------------------------
var Element = document.getElementById(ElementID);
if(!Element)
return;
//----------------------------------------------------------------------------
var Style = Element.style;
//----------------------------------------------------------------------------
Style.display = (Style.display != 'none'?'none':'');
//----------------------------------------------------------------------------
FadeIn(Element);
}
EOD;
#-------------------------------------------------------------------------------
$DOM->AddChild('Head', new Tag('SCRIPT', $JavaScript));
#-------------------------------------------------------------------------------
$Parse = IO_Read('/work/joonte/Repository.xml');
if (Is_Error($Parse)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$DB = new DOM($Parse);
if (Is_Error($DB)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
function XML_Read($Object, $Level = 1)
{
#-----------------------------------------------------------------------------
static $Index = 1;
#-----------------------------------------------------------------------------
$Md5 = Md5($Index++);
示例6: System_Element
$Mime = (string) @$Args['Mime'];
#-------------------------------------------------------------------------------
if (!Preg_Match('/^[a-zA-Z0-9\\_\\.\\]\\[]+$/', $File)) {
return 'Не верно указано имя файла';
}
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Path = SPrintF('%s/files/%s', $Tmp, $File);
#-------------------------------------------------------------------------------
if (!File_Exists($Path)) {
return 'Файл не существует';
}
#-------------------------------------------------------------------------------
$Source = IO_Read($Path);
if (Is_Error($Source)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Length = MB_StrLen($Source, 'ASCII');
#-------------------------------------------------------------------------------
Header(SPrintF('Content-Type: %s; charset=utf-8', $Mime ? $Mime : 'application'));
Header(SPrintF('Content-Length: %u', $Length));
Header(SPrintF('Content-Disposition: attachment; filename="%s";', $Name ? AddSlashes($Name) : $File));
Header('Pragma: nocache');
#-------------------------------------------------------------------------------
echo $Source;
#-------------------------------------------------------------------------------
示例7: IO_Read
<?php
#-------------------------------------------------------------------------------
$Config = IO_Read($Path = SPrintF('%s/hosts/%s/host.ini', SYSTEM_PATH, HOST_ID));
if (Is_Error($Config)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Config = Str_Replace('JBsServer', 'jbs-server', $Config);
#-------------------------------------------------------------------------------
$IsWrite = IO_Write($Path, $Config, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
示例8: SPrintF
#-------------------------------------------------------------------------------
$Folder = SPrintF('%s/hosts/%s', SYSTEM_PATH, HOST_ID);
#-------------------------------------------------------------------------------
$Files = IO_Files($Folder);
if (Is_Error($Files)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
foreach ($Files as $File) {
#-----------------------------------------------------------------------------
if (!Preg_Match('/\\.xml/', $File)) {
continue;
}
#-----------------------------------------------------------------------------
$Sourse = IO_Read($File);
if (Is_Error($Sourse)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$Out = Str_Replace('path="MenuLeft"', 'path="Menus/Left"', $Sourse);
#-----------------------------------------------------------------------------
if ($Out != $Sourse) {
#---------------------------------------------------------------------------
$IsWrite = IO_Write($File, $Out, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
}
}
#-------------------------------------------------------------------------------
示例9: Header
#-------------------------------------------------------------------------------
$Search = "case\\s'xception\\'\\:\n\\s+return\\s\$";
#-------------------------------------------------------------------------------
Header('Content-type: text/plain; charset=utf-8');
#-------------------------------------------------------------------------------
$Files = IO_Files(SYSTEM_PATH);
if (Is_Error($Files)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Count = Count($Files);
#-------------------------------------------------------------------------------
echo SPrintF("Finded %s files\n", $Count);
#-------------------------------------------------------------------------------
echo SPrintF("Search (%s)\n", $Search);
#-------------------------------------------------------------------------------
foreach ($Files as $File) {
#-----------------------------------------------------------------------------
$Source = IO_Read($File);
if (Is_Error($Source)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
#if(!Preg_Match('/\.comp.php/',$File))
# continue;
#-----------------------------------------------------------------------------
if (Preg_Match(SPrintF('/%s/sU', $Search), $Source)) {
echo SPrintF("%s\n", $File);
}
}
#-------------------------------------------------------------------------------
示例10: Styles_XML
function Styles_XML($Element)
{
/****************************************************************************/
$__args_types = array('string');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$CacheID = SPrintF('Styles_XML[%s]', Md5($Element));
#-----------------------------------------------------------------------------
$Result = CacheManager::get($CacheID);
if ($Result) {
return $Result;
}
#-----------------------------------------------------------------------------
$HostsIDs = Styles_HostsIDs($Element);
if (Is_Error($HostsIDs)) {
return ERROR | @Trigger_Error('[Styles_XML]: список хостов содержащих элемент не найдены');
}
#-----------------------------------------------------------------------------
$Result = array();
#-----------------------------------------------------------------------------
foreach (Array_Reverse($HostsIDs) as $HostID) {
#---------------------------------------------------------------------------
$Path = SPrintF('%s/styles/%s/%s', SYSTEM_PATH, $HostID, $Element);
#---------------------------------------------------------------------------
$File = IO_Read($Path);
if (Is_Error($File)) {
return ERROR | @Trigger_Error('[Styles_XML]: не удалось прочитать XML-файл');
}
#---------------------------------------------------------------------------
$XML = String_XML_Parse($File);
if (Is_Exception($XML)) {
return ERROR | @Trigger_Error('[Styles_XML]: не удалось разобрать XML-строку');
}
#---------------------------------------------------------------------------
$Child = Current($XML->Childs);
#---------------------------------------------------------------------------
if (isset($Child->Attribs['recursive'])) {
$Result = array();
}
#---------------------------------------------------------------------------
$Adding = $XML->ToArray();
#---------------------------------------------------------------------------
$Adding = $Adding['XML'];
#---------------------------------------------------------------------------
Array_Union($Result, $Adding);
}
#-----------------------------------------------------------------------------
CacheManager::add($CacheID, $Result);
#-----------------------------------------------------------------------------
return $Result;
}
示例11: IO_Read
function IO_Read($Path, $IsUseLinks = TRUE)
{
/******************************************************************************/
$__args_types = array('string', 'boolean');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
Debug(SPrintF('[IO_Read]: открытие файла (%s)', $Path));
#-------------------------------------------------------------------------------
if (!File_Exists($Path)) {
return ERROR | @Trigger_Error('[IO_Read]: файл не существует');
}
#-------------------------------------------------------------------------------
if (!($File = @Fopen($Path, 'r'))) {
return ERROR | @Trigger_Error('[IO_Read]: ошибка открытия файла');
}
#-------------------------------------------------------------------------------
$Size = @FileSize($Path);
if (!$Size) {
return '';
}
#-------------------------------------------------------------------------------
if (!($Result = @Fread($File, $Size))) {
return ERROR | @Trigger_Error('[IO_Read]: ошибка чтения файла');
}
#-------------------------------------------------------------------------------
if (!Fclose($File)) {
return ERROR | @Trigger_Error('[IO_Read]: ошибка закрытия файла');
}
#-------------------------------------------------------------------------------
if (Mb_StrLen($Result) > 4) {
#-------------------------------------------------------------------------------
if (Mb_SubStr($Result, 1, 4) == 'link' && $IsUseLinks) {
#-------------------------------------------------------------------------------
$LinkPath = Trim(Mb_SubStr($Result, Mb_StrPos($Result, ':') + 1));
#-------------------------------------------------------------------------------
switch ($Result[0]) {
case '#':
# Абсолюная ссылка
# No more...
break;
case '@':
# Относительная ссылка
#-------------------------------------------------------------------------------
$Folder = Mb_SubStr($Path, 0, Mb_StrrPos($Path, '/'));
#-------------------------------------------------------------------------------
$LinkPath = SPrintF('%s/%s', $Folder, $LinkPath);
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error('[IO_Read]: тип ссылки не определён');
}
#-------------------------------------------------------------------------------
if ($Path == $LinkPath) {
return ERROR | @Trigger_Error(SPrintF('[IO_Read]: ссылка сама на себя в файле(%s)', $Path));
}
#-------------------------------------------------------------------------------
Debug(SPrintF('[IO_Read]: символическая ссылка (%s) на (%s)', $Path, $LinkPath));
#-------------------------------------------------------------------------------
$Result = IO_Read($LinkPath);
if (Is_Error($Result)) {
return ERROR | @Trigger_Error('[IO_Read]: ошибка рекурсивного вызова');
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Result;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
}
示例12: IO_Write
</TD>
</TR>
</TABLE>
</FORM>
</TD>
<TD>
<IFRAME name="Main" src="FileList.html" style="width:100%;height:100%;s" />
</TD>
</TR>
</TABLE>
EOD;
#-------------------------------------------------------------------------------
$DOM->AddHTML('Into', $Parse);
#-------------------------------------------------------------------------------
$Out = $DOM->Build();
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/Index.html', $JBsDocPath), $Out, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$File = IO_Read(SPrintF('%s/styles/root/Css/Standard.css', SYSTEM_PATH));
if (Is_Error($File)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/Standard.css', $JBsDocPath), $File, TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例13: array
#-------------------------------------------------------------------------------
$DOM->AddAttribs('MenuLeft', array('args' => 'Administrator/AddIns'));
#-------------------------------------------------------------------------------
$DOM->AddText('Title', 'Дополнения → Мастера настройки → Базовый шаблон');
#-------------------------------------------------------------------------------
$Script = new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Pages/Administrator/BaseEdit.js}'));
#-------------------------------------------------------------------------------
$DOM->AddChild('Head', $Script);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Element = System_Element('templates/Base.xml');
if (Is_Error($Element)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Base = IO_Read($Element);
if (Is_Error($Base)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table = array();
#-------------------------------------------------------------------------------
$Comp = Comp_Load('CodePress', 'Base', 'html', $Base);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = $Comp;
#-------------------------------------------------------------------------------
$Div = new Tag('DIV', array('align' => 'right'));
#-------------------------------------------------------------------------------
示例14: SPrintF
#-------------------------------------------------------------------------------
if (!File_Exists($Uploads)) {
if (!@MkDir(SPrintF('%s/uploads', $Tmp), 0777, TRUE)) {
return ERROR | @Trigger_Error(500);
}
}
#-------------------------------------------------------------------------------
if (!Copy($Path, SPrintF('%s/%s', $Uploads, $Hash))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Name = $File['name'];
#-------------------------------------------------------------------------------
$NamesPath = SPrintF('%s/names.txt', $Uploads);
#-------------------------------------------------------------------------------
$Names = Is_Error($Names = IO_Read($NamesPath)) ? array() : JSON_Decode($Names, true);
#-------------------------------------------------------------------------------
$Names[$Hash] = $Name;
#-------------------------------------------------------------------------------
$IsWrite = IO_Write($NamesPath, JSON_Encode($Names), TRUE);
if (Is_Error($IsWrite)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Size = Round($File['size'] / 1024);
#-------------------------------------------------------------------------------
# вывод для JS в браузере...
if (!isset($GLOBALS['IsCron'])) {
echo SPrintF('%s^%s^%s^', $Name, $Size, $Hash);
}
#-------------------------------------------------------------------------------
示例15: System_Read
function System_Read($Element)
{
#-----------------------------------------------------------------------------
$Path = System_Element($Element);
if (Is_Error($Path)) {
return ERROR | @Trigger_Error('[System_Read]: не удалось найти элемент');
}
#-----------------------------------------------------------------------------
$Result = IO_Read($Path);
if (Is_Error($Result)) {
return ERROR | @Trigger_Error('[System_Read]: не удалось прочитать данные');
}
#-----------------------------------------------------------------------------
return $Result;
}