Improves to get the content
This commit is contained in:
parent
cfe4fb79a2
commit
341858ce02
|
@ -40,8 +40,15 @@ class Page {
|
|||
|
||||
// Check if the current line start the content of the page
|
||||
// We have two breakers, the word content or 3 dash ---
|
||||
if( ($field==='content') || ($field==='---') ) {
|
||||
if ($field==='content') {
|
||||
$tmp = $lineNumber;
|
||||
$styleTypeUsed = 'Content:';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($field==='---') {
|
||||
$tmp = $lineNumber;
|
||||
$styleTypeUsed = '---';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -68,12 +75,14 @@ class Page {
|
|||
|
||||
// Process the content
|
||||
if ($tmp!==0) {
|
||||
// Next line after "Content:" or "---"
|
||||
$tmp++;
|
||||
|
||||
// Get all lines after "Content:" or "---"
|
||||
// Get all lines starting from "Content:" or "---"
|
||||
$content = array_slice($file, $tmp);
|
||||
|
||||
// Remove "Content:" or "---" and keep next characters if there are
|
||||
$content[0] = substr($content[0], strpos($content[0], $styleTypeUsed) + strlen($styleTypeUsed));
|
||||
|
||||
$content[0] = trim($content[0]);
|
||||
|
||||
// Join lines in one variable, this is RAW content from file
|
||||
$this->vars['contentRaw'] = implode($content);
|
||||
}
|
||||
|
@ -84,7 +93,7 @@ class Page {
|
|||
// Returns TRUE if the content is loaded correctly, FALSE otherwise
|
||||
public function isValid()
|
||||
{
|
||||
return($this->vars!==false);
|
||||
return $this->vars!==false;
|
||||
}
|
||||
|
||||
// DEPRACTED
|
||||
|
|
Loading…
Reference in New Issue