本文整理汇总了PHP中ParseFileContent函数的典型用法代码示例。如果您正苦于以下问题:PHP ParseFileContent函数的具体用法?PHP ParseFileContent怎么用?PHP ParseFileContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseFileContent函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __struct_get_file_info
function __struct_get_file_info($abs_path, $file)
{
static $arTextExt = array("php", "htm", "html");
$io = CBXVirtualIo::GetInstance();
$arFile = array("file"=>$file, "name"=>"");
if($io->DirectoryExists($abs_path."/".$file))
{
$arFile["type"] = "D";
if($io->FileExists($abs_path."/".$file."/.section.php"))
{
$sSectionName = "";
$arDirProperties = array();
include($io->GetPhysicalName($abs_path."/".$file."/.section.php"));
$arFile["name"] = $sSectionName;
$arFile["properties"] = $arDirProperties;
}
}
else
{
$arFile["type"] = "F";
if(in_array(GetFileExtension($file), $arTextExt))
{
$f = $io->GetFile($abs_path."/".$file);
$sContent = $f->GetContents();
$arContent = ParseFileContent($sContent);
$arFile["name"] = CUtil::ConvertToLangCharset($arContent["TITLE"]);
$arFile["properties"] = $arContent["PROPERTIES"];
}
}
if($GLOBALS['arOptions']['show_file_info'] == true)
{
if ($io->DirectoryExists($abs_path."/".$file))
{
$f = $io->GetDirectory($abs_path."/".$file);
$arFile["time"] = $f->GetModificationTime();
}
else
{
$f = $io->GetFile($abs_path."/".$file);
$arFile["time"] = $f->GetModificationTime();
$arFile["size"] = $f->GetFileSize();
}
}
return $arFile;
}
示例2: OnChangeFile
public static function OnChangeFile($path, $site)
{
global $BX_WORKFLOW_PUBLISHED_PATH, $BX_WORKFLOW_PUBLISHED_SITE;
if ($BX_WORKFLOW_PUBLISHED_PATH == $path && $BX_WORKFLOW_PUBLISHED_SITE == $site) {
return;
}
$err_mess = CWorkflow::err_mess() . "<br>Function: OnChangeFile<br>Line: ";
global $DB, $USER, $APPLICATION;
$HISTORY_SIMPLE_EDITING = COption::GetOptionString("workflow", "HISTORY_SIMPLE_EDITING", "N");
if ($HISTORY_SIMPLE_EDITING == "Y") {
$HISTORY_COPIES = intval(COption::GetOptionString("workflow", "HISTORY_COPIES", "10"));
CWorkflow::CleanUpHistoryCopies_SE($path, $HISTORY_COPIES - 1);
if ($HISTORY_COPIES > 0) {
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$filesrc = $APPLICATION->GetFileContent($DOC_ROOT . $path);
$arContent = ParseFileContent($filesrc);
$TITLE = $arContent["TITLE"];
$BODY = $arContent["CONTENT"];
$arFields = array("DOCUMENT_ID" => 0, "MODIFIED_BY" => $USER->GetID(), "TITLE" => $TITLE, "FILENAME" => $path, "SITE_ID" => $site, "BODY" => $BODY, "BODY_TYPE" => "html", "STATUS_ID" => 1, "~TIMESTAMP_X" => $DB->CurrentTimeFunction());
$DB->Add("b_workflow_log", $arFields, array("BODY"), "workflow");
}
}
}
示例3: array
//Properties from fileman settings
$arFilemanProperties = array();
if (CModule::IncludeModule("fileman") && is_callable(array("CFileMan", "GetPropstypes"))) {
$arFilemanProperties = CFileMan::GetPropstypes($site);
}
//Properties from page
$arDirProperties = array();
if ($strWarning != "" && isset($_POST["PROPERTY"]) && is_array($_POST["PROPERTY"])) {
//Restore post values if error occured
foreach ($_POST["PROPERTY"] as $arProperty) {
if (isset($arProperty["VALUE"]) && strlen($arProperty["VALUE"]) > 0) {
$arDirProperties[$arProperty["CODE"]] = $arProperty["VALUE"];
}
}
} else {
$arPageSlice = ParseFileContent($fileContent);
$arDirProperties = $arPageSlice["PROPERTIES"];
}
//All file properties. Includes properties from root folders
$arInheritProperties = $APPLICATION->GetDirPropertyList(array($site, $path));
if ($arInheritProperties === false) {
$arInheritProperties = array();
}
//Tags
if (!$createNewFolder && IsModuleInstalled("search")) {
$tagPropertyCode = COption::GetOptionString("search", "page_tag_property", "tags");
unset($arFilemanProperties[$tagPropertyCode]);
unset($arDirProperties[$tagPropertyCode]);
unset($arInheritProperties[strtoupper($tagPropertyCode)]);
}
$bSearchExists = isset($tagPropertyCode) && CModule::IncludeModule("search");
示例4: elseif
$get_content = "Y";
} elseif (strlen($template) > 0) {
for ($i = 0; $i < count($arTemplates); $i++) {
if ($arTemplates[$i]["file"] == $template) {
$filesrc = GetTemplateContent($arTemplates[$i]["file"]);
$arContent = ParseFileContent($filesrc);
$str_TITLE = $arContent["TITLE"];
$str_BODY = $arContent["CONTENT"];
$get_content = "Y";
break;
}
}
}
if ($get_content != "Y") {
$filesrc = GetTemplateContent($arTemplates[0]["file"]);
$arContent = ParseFileContent($filesrc);
$str_TITLE = $arContent["TITLE"];
$str_BODY = $arContent["CONTENT"];
}
$str_FILENAME = strlen($fname) ? htmlspecialcharsbx($fname) : "/untitled.php";
$str_SITE_ID = htmlspecialcharsbx($site);
$str_BODY_TYPE = "html";
$str_TITLE = htmlspecialcharsbx($str_TITLE);
} else {
$doc_files = CWorkflow::GetFileList($ID);
while ($zr = $doc_files->GetNext()) {
$arDocFiles[] = $zr;
}
$str_BODY = htmlspecialcharsback($str_BODY);
}
if ($message) {
示例5: ParseFileContent
function ParseFileContent($filesrc, $bCheckProlog = false)
{
$res = ParseFileContent($filesrc);
if ($bCheckProlog) {
$prolog = trim(strtolower($res['PROLOG']));
if (strlen($prolog) > 0 && strpos($prolog, "prolog_before") === false && strpos($prolog, 'bitrix/header.php') === false && strpos($prolog, '$application->settitle') === false && strpos($prolog, '$application->setpageproperty') === false) {
$res['CONTENT'] = $res['PROLOG'] . "\n" . $res['CONTENT'];
$res['PROLOG'] = '';
}
$epilog = trim(strtolower($res['EPILOG']));
if (strlen($epilog) > 0 && strpos($epilog, 'bitrix/footer.php') === false && strpos($epilog, 'epilog.php') === false) {
$res['CONTENT'] = $res['CONTENT'] . "\n" . $res['EPILOG'];
$res['EPILOG'] = '';
}
}
return $res;
}
示例6: ReindexFile
function ReindexFile($path, $SEARCH_SESS_ID="")
{
global $APPLICATION;
$io = CBXVirtualIo::GetInstance();
$DB = CDatabase::GetModuleConnection('search');
if(!is_array($path))
return 0;
$file_doc_root = CSite::GetSiteDocRoot($path[0]);
$file_rel_path = $path[1];
$file_abs_path = preg_replace("#[\\\\\\/]+#", "/", $file_doc_root."/".$file_rel_path);
$f = $io->GetFile($file_abs_path);
if(!$f->IsExists() || !$f->IsReadable())
return 0;
if(!CSearch::CheckPath($file_rel_path))
return 0;
$max_file_size = COption::GetOptionInt("search", "max_file_size", 0);
if(
$max_file_size > 0
&& $f->GetFileSize() > ($max_file_size*1024)
)
return 0;
$file_site = "";
$rsSites = CSite::GetList($by = "lendir", $order = "desc");
while($arSite = $rsSites->Fetch())
{
$site_path = preg_replace("#[\\\\\\/]+#", "/", $arSite["ABS_DOC_ROOT"]."/".$arSite["DIR"]."/");
if(strpos($file_abs_path, $site_path) === 0)
{
$file_site = $arSite["ID"];
break;
}
}
if($file_site == "")
return 0;
$item_id = $file_site."|".$file_rel_path;
if (strlen($item_id) > 255)
return 0;
if(strlen($SEARCH_SESS_ID) > 0)
{
$DATE_CHANGE = $DB->CharToDateFunction(
FormatDate(
$DB->DateFormatToPHP(CLang::GetDateFormat("FULL")), $f->GetModificationTime() + CTimeZone::GetOffset()
)
);
$strSql = "
SELECT ID
FROM b_search_content
WHERE MODULE_ID = 'main'
AND ITEM_ID = '".$DB->ForSQL($item_id)."'
AND DATE_CHANGE = ".$DATE_CHANGE."
";
$r = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if($arR = $r->Fetch())
{
$strSql = "UPDATE b_search_content SET UPD='".$DB->ForSQL($SEARCH_SESS_ID)."' WHERE ID = ".$arR["ID"];
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
return $arR["ID"];
}
}
$arrFile = false;
foreach(GetModuleEvents("search", "OnSearchGetFileContent", true) as $arEvent)
{
if($arrFile = ExecuteModuleEventEx($arEvent, array($file_abs_path, $SEARCH_SESS_ID)))
break;
}
if(!is_array($arrFile))
{
$sFile = $APPLICATION->GetFileContent($file_abs_path);
$sHeadEndPos = strpos($sFile, "</head>");
if($sHeadEndPos===false)
$sHeadEndPos = strpos($sFile, "</HEAD>");
if($sHeadEndPos!==false)
{
//html header detected try to get document charset
$arMetaMatch = array();
if(preg_match("/<(meta)\\s+([^>]*)(content)\\s*=\\s*(['\"]).*?(charset)\\s*=\\s*(.*?)(\\4)/is", substr($sFile, 0, $sHeadEndPos), $arMetaMatch))
{
$doc_charset = $arMetaMatch[6];
if(defined("BX_UTF"))
{
if(strtoupper($doc_charset) != "UTF-8")
$sFile = $APPLICATION->ConvertCharset($sFile, $doc_charset, "UTF-8");
}
}
}
$arrFile = ParseFileContent($sFile);
}
$title = CSearch::KillTags(trim($arrFile["TITLE"]));
//.........这里部分代码省略.........