Performance improvements and refactoring
This commit is contained in:
parent
830928e8f7
commit
0d7b59c5d8
10 changed files with 86 additions and 149 deletions
|
@ -43,6 +43,7 @@ NewFile: page-new-(.*).txt
|
|||
RobotsFile: robots.txt
|
||||
FaviconFile: favicon.ico
|
||||
ServerUrl:
|
||||
StartupUpdate: none
|
||||
Template: default
|
||||
Navigation: navigation
|
||||
Sidebar: sidebar
|
||||
|
@ -52,7 +53,7 @@ Parser: markdown
|
|||
ParserSafeMode: 0
|
||||
MultiLanguageMode: 0
|
||||
InstallationMode: 1
|
||||
StartupUpdate: none
|
||||
BundleAndMinify: 1
|
||||
EditLocation: /edit/
|
||||
EditUploadNewLocation: /media/@group/@filename
|
||||
EditUploadExtensions: .gif, .jpg, .pdf, .png, .svg, .tgz, .zip
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowCommand {
|
||||
const VERSION = "0.7.8";
|
||||
const VERSION = "0.7.9";
|
||||
public $yellow; //access to API
|
||||
public $files; //number of files
|
||||
public $links; //number of links
|
||||
|
@ -130,7 +130,7 @@ class YellowCommand {
|
|||
} else {
|
||||
$statusCode = $this->copyStaticFile($path, $location);
|
||||
}
|
||||
if ($statusCode==200 && $analyse) $this->analyseStaticFile($scheme, $address, $base, $fileData);
|
||||
if ($statusCode==200 && $analyse) $this->analyseLocations($scheme, $address, $base, $fileData);
|
||||
if ($statusCode==404 && $probe) $statusCode = 100;
|
||||
if ($statusCode==404 && $error) $statusCode = 200;
|
||||
if ($statusCode>=200) ++$this->files;
|
||||
|
@ -190,8 +190,8 @@ class YellowCommand {
|
|||
return $statusCode;
|
||||
}
|
||||
|
||||
// Analyse static file, detect locations with arguments
|
||||
public function analyseStaticFile($scheme, $address, $base, $rawData) {
|
||||
// Analyse locations with arguments
|
||||
public function analyseLocations($scheme, $address, $base, $rawData) {
|
||||
$pagination = $this->yellow->config->get("contentPagination");
|
||||
preg_match_all("/<(.*?)href=\"([^\"]+)\"(.*?)>/i", $rawData, $matches);
|
||||
foreach ($matches[2] as $match) {
|
||||
|
@ -209,13 +209,13 @@ class YellowCommand {
|
|||
$location = rtrim($location, "/")."/";
|
||||
if (is_null($this->locationsArgs[$location])) {
|
||||
$this->locationsArgs[$location] = $location;
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseStaticFile detected location:$location<br/>\n";
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseLocations detected location:$location<br/>\n";
|
||||
}
|
||||
} else {
|
||||
$location = rtrim($location, "0..9");
|
||||
if (is_null($this->locationsArgsPagination[$location])) {
|
||||
$this->locationsArgsPagination[$location] = $location;
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseStaticFile detected location:$location<br/>\n";
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseLocations detected location:$location<br/>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,8 +249,8 @@ class YellowCommand {
|
|||
$this->files = $this->links = 0;
|
||||
$regex = "/^[^.]+$|".$this->yellow->config->get("staticDefaultFile")."$/";
|
||||
$fileNames = $this->yellow->toolbox->getDirectoryEntriesRecursive($path, $regex, false, false);
|
||||
list($statusCodeFiles, $links) = $this->analyseStaticFiles($path, $locationFilter, $fileNames);
|
||||
list($statusCodeLinks, $broken, $redirect) = $this->analyseLinks($path, $links);
|
||||
list($statusCodeFiles, $links) = $this->analyseLinks($path, $locationFilter, $fileNames);
|
||||
list($statusCodeLinks, $broken, $redirect) = $this->analyseStatus($path, $links);
|
||||
if ($statusCodeLinks!=200) {
|
||||
$this->showLinks($broken, "Broken links");
|
||||
$this->showLinks($redirect, "Redirect links");
|
||||
|
@ -258,8 +258,8 @@ class YellowCommand {
|
|||
return max($statusCodeFiles, $statusCodeLinks);
|
||||
}
|
||||
|
||||
// Analyse static files, detect links
|
||||
public function analyseStaticFiles($path, $locationFilter, $fileNames) {
|
||||
// Analyse links in static files
|
||||
public function analyseLinks($path, $locationFilter, $fileNames) {
|
||||
$statusCode = 200;
|
||||
$links = array();
|
||||
if (!empty($fileNames)) {
|
||||
|
@ -278,12 +278,12 @@ class YellowCommand {
|
|||
$url = $location.(empty($matches[3]) ? "/" : "");
|
||||
if (!is_null($links[$url])) $links[$url] .= ",";
|
||||
$links[$url] .= $locationSource;
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseStaticFiles detected url:$url<br/>\n";
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseLinks detected url:$url<br/>\n";
|
||||
} elseif ($location[0]=="/") {
|
||||
$url = "$scheme://$address$location";
|
||||
if (!is_null($links[$url])) $links[$url] .= ",";
|
||||
$links[$url] .= $locationSource;
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseStaticFiles detected url:$url<br/>\n";
|
||||
if (defined("DEBUG") && DEBUG>=2) echo "YellowCommand::analyseLinks detected url:$url<br/>\n";
|
||||
}
|
||||
}
|
||||
++$this->files;
|
||||
|
@ -300,8 +300,8 @@ class YellowCommand {
|
|||
return array($statusCode, $links);
|
||||
}
|
||||
|
||||
// Analyse links, detect status
|
||||
public function analyseLinks($path, $links) {
|
||||
// Analyse link status
|
||||
public function analyseStatus($path, $links) {
|
||||
$statusCode = 200;
|
||||
$broken = $redirect = $data = array();
|
||||
$staticUrl = $this->yellow->config->get("staticUrl");
|
||||
|
@ -310,7 +310,7 @@ class YellowCommand {
|
|||
$staticLocations = $this->getContentLocations(true);
|
||||
uksort($links, "strnatcasecmp");
|
||||
foreach ($links as $url=>$value) {
|
||||
if (defined("DEBUG") && DEBUG>=1) echo "YellowCommand::analyseLinks url:$url\n";
|
||||
if (defined("DEBUG") && DEBUG>=1) echo "YellowCommand::analyseStatus url:$url\n";
|
||||
if (preg_match("#^$staticUrl#", $url)) {
|
||||
$location = substru($url, $staticUrlLength);
|
||||
$fileName = $path.substru($url, $staticUrlLength);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowCore {
|
||||
const VERSION = "0.7.5";
|
||||
const VERSION = "0.7.6";
|
||||
public $page; //current page
|
||||
public $pages; //pages from file system
|
||||
public $files; //files from file system
|
||||
|
@ -68,6 +68,7 @@ class YellowCore {
|
|||
$this->config->setDefault("robotsFile", "robots.txt");
|
||||
$this->config->setDefault("faviconFile", "favicon.ico");
|
||||
$this->config->setDefault("serverUrl", "");
|
||||
$this->config->setDefault("startupUpdate", "none");
|
||||
$this->config->setDefault("template", "default");
|
||||
$this->config->setDefault("navigation", "navigation");
|
||||
$this->config->setDefault("sidebar", "sidebar");
|
||||
|
@ -77,7 +78,6 @@ class YellowCore {
|
|||
$this->config->setDefault("parserSafeMode", "0");
|
||||
$this->config->setDefault("multiLanguageMode", "0");
|
||||
$this->config->setDefault("installationMode", "0");
|
||||
$this->config->setDefault("startupUpdate", "none");
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
|
@ -315,10 +315,10 @@ class YellowCore {
|
|||
}
|
||||
}
|
||||
|
||||
// Parse snippet
|
||||
// Include snippet
|
||||
public function snippet($name, $args = null) {
|
||||
$this->lookup->snippetArgs = func_get_args();
|
||||
$this->page->parseSnippet($name);
|
||||
$this->page->includePageSnippet($name);
|
||||
}
|
||||
|
||||
// Return snippet arguments
|
||||
|
@ -551,18 +551,7 @@ class YellowPage {
|
|||
|
||||
// Parse page
|
||||
public function parsePage() {
|
||||
$this->outputData = null;
|
||||
if (!$this->isError()) {
|
||||
foreach ($this->yellow->plugins->plugins as $key=>$value) {
|
||||
if (method_exists($value["obj"], "onParsePage")) $value["obj"]->onParsePage();
|
||||
}
|
||||
}
|
||||
if (is_null($this->outputData)) {
|
||||
ob_start();
|
||||
$this->parseTemplate($this->get("template"));
|
||||
$this->outputData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
$this->parsePageTemplate($this->get("template"));
|
||||
if (!$this->isCacheable()) $this->setHeader("Cache-Control", "no-cache, must-revalidate");
|
||||
if (!$this->isHeader("Content-Type")) $this->setHeader("Content-Type", "text/html; charset=utf-8");
|
||||
if (!$this->isHeader("Page-Modified")) $this->setHeader("Page-Modified", $this->getModified(true));
|
||||
|
@ -592,10 +581,36 @@ class YellowPage {
|
|||
$this->error(404);
|
||||
}
|
||||
if ($this->isExisting("pageClean")) $this->outputData = null;
|
||||
foreach ($this->yellow->plugins->plugins as $key=>$value) {
|
||||
if (method_exists($value["obj"], "onParsePageOutput")) {
|
||||
$output = $value["obj"]->onParsePageOutput($this, $this->outputData);
|
||||
if (!is_null($output)) $this->outputData = $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse template
|
||||
public function parseTemplate($name) {
|
||||
// Parse page template
|
||||
public function parsePageTemplate($name) {
|
||||
$this->outputData = null;
|
||||
if (!$this->isError()) {
|
||||
foreach ($this->yellow->plugins->plugins as $key=>$value) {
|
||||
if (method_exists($value["obj"], "onParsePageTemplate")) {
|
||||
$value["obj"]->onParsePageTemplate($this, $name);
|
||||
} elseif (method_exists($value["obj"], "onParsePage")) { //TODO: remove later, old event handler
|
||||
$value["obj"]->onParsePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_null($this->outputData)) {
|
||||
ob_start();
|
||||
$this->includePageTemplate($name);
|
||||
$this->outputData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
}
|
||||
|
||||
// Include page template
|
||||
public function includePageTemplate($name) {
|
||||
$fileNameTemplate = $this->yellow->config->get("templateDir").$this->yellow->lookup->normaliseName($name).".html";
|
||||
if (is_file($fileNameTemplate)) {
|
||||
$this->setLastModified(filemtime($fileNameTemplate));
|
||||
|
@ -607,8 +622,8 @@ class YellowPage {
|
|||
}
|
||||
}
|
||||
|
||||
// Parse snippet
|
||||
public function parseSnippet($name) {
|
||||
// Include page snippet
|
||||
public function includePageSnippet($name) {
|
||||
$fileNameSnippet = $this->yellow->config->get("snippetDir").$this->yellow->lookup->normaliseName($name).".php";
|
||||
if (is_file($fileNameSnippet)) {
|
||||
$this->setLastModified(filemtime($fileNameSnippet));
|
||||
|
@ -687,13 +702,13 @@ class YellowPage {
|
|||
return $sizeMax ? substrb($text, 0, $sizeMax) : $text;
|
||||
}
|
||||
|
||||
// Return parent page of current page, null if none
|
||||
// Return parent page, null if none
|
||||
public function getParent() {
|
||||
$parentLocation = $this->yellow->pages->getParentLocation($this->location);
|
||||
return $this->yellow->pages->find($parentLocation);
|
||||
}
|
||||
|
||||
// Return top-level page for current page, null if none
|
||||
// Return top-level parent page, null if none
|
||||
public function getParentTop($homeFailback = true) {
|
||||
$parentTopLocation = $this->yellow->pages->getParentTopLocation($this->location);
|
||||
if (!$this->yellow->pages->find($parentTopLocation) && $homeFailback) {
|
||||
|
@ -702,28 +717,28 @@ class YellowPage {
|
|||
return $this->yellow->pages->find($parentTopLocation);
|
||||
}
|
||||
|
||||
// Return page collection with pages on the same level as current page
|
||||
// Return page collection with pages on the same level
|
||||
public function getSiblings($showInvisible = false) {
|
||||
$parentLocation = $this->yellow->pages->getParentLocation($this->location);
|
||||
return $this->yellow->pages->getChildren($parentLocation, $showInvisible);
|
||||
}
|
||||
|
||||
// Return page collection with child pages of current page
|
||||
// Return page collection with child pages
|
||||
public function getChildren($showInvisible = false) {
|
||||
return $this->yellow->pages->getChildren($this->location, $showInvisible);
|
||||
}
|
||||
|
||||
// Return page collection with sub pages of current page
|
||||
// Return page collection with sub pages
|
||||
public function getChildrenRecursive($showInvisible = false, $levelMax = 0) {
|
||||
return $this->yellow->pages->getChildrenRecursive($this->location, $showInvisible, $levelMax);
|
||||
}
|
||||
|
||||
// Set page collection with additional pages for current page
|
||||
// Set page collection with additional pages
|
||||
public function setPages($pages) {
|
||||
$this->pageCollection = $pages;
|
||||
}
|
||||
|
||||
// Return page collection with additional pages for current page
|
||||
// Return page collection with additional pages
|
||||
public function getPages() {
|
||||
return $this->pageCollection;
|
||||
}
|
||||
|
@ -753,11 +768,14 @@ class YellowPage {
|
|||
return $this->yellow->lookup->normaliseUrl($this->scheme, $this->address, $this->base, $this->location);
|
||||
}
|
||||
|
||||
// Return page extra HTML data
|
||||
// Return page extra data
|
||||
public function getExtra($name) {
|
||||
$output = "";
|
||||
foreach ($this->yellow->plugins->plugins as $key=>$value) {
|
||||
if (method_exists($value["obj"], "onExtra")) {
|
||||
if (method_exists($value["obj"], "onParsePageExtra")) {
|
||||
$outputPlugin = $value["obj"]->onParsePageExtra($this, $name);
|
||||
if (!is_null($outputPlugin)) $output .= $outputPlugin;
|
||||
} elseif (method_exists($value["obj"], "onExtra")) { //TODO: remove later, old event handler
|
||||
$outputPlugin = $value["obj"]->onExtra($name);
|
||||
if (!is_null($outputPlugin)) $output .= $outputPlugin;
|
||||
}
|
||||
|
@ -781,28 +799,7 @@ class YellowPage {
|
|||
$output .= "<link rel=\"apple-touch-icon\" type=\"$contentType\" href=\"".htmlspecialchars($location)."\" />\n";
|
||||
}
|
||||
}
|
||||
return $this->normaliseExtra($output);
|
||||
}
|
||||
|
||||
// Normalise page extra HTML data
|
||||
public function normaliseExtra($text) {
|
||||
$outputScript = $outputStylesheet = $outputOther = $locations = array();
|
||||
foreach ($this->yellow->toolbox->getTextLines($text) as $line) {
|
||||
if (preg_match("/^<script (.*?)src=\"([^\"]+)\"(.*?)><\/script>$/i", $line, $matches)) {
|
||||
if (is_null($locations[$matches[2]])) {
|
||||
$locations[$matches[2]] = $matches[2];
|
||||
array_push($outputScript, $line);
|
||||
}
|
||||
} elseif (preg_match("/^<link rel=\"stylesheet\"(.*?)href=\"([^\"]+)\"(.*?)>$/i", $line, $matches)) {
|
||||
if (is_null($locations[$matches[2]])) {
|
||||
$locations[$matches[2]] = $matches[2];
|
||||
array_push($outputStylesheet, $line);
|
||||
}
|
||||
} else {
|
||||
array_push($outputOther, $line);
|
||||
}
|
||||
}
|
||||
return implode($outputScript).implode($outputStylesheet).implode($outputOther);
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Set page response output
|
||||
|
@ -880,7 +877,7 @@ class YellowPage {
|
|||
return $this->visible;
|
||||
}
|
||||
|
||||
// Check if page is within current request
|
||||
// Check if page is within current HTTP request
|
||||
public function isActive() {
|
||||
return $this->active;
|
||||
}
|
||||
|
@ -1546,7 +1543,7 @@ class YellowThemes {
|
|||
if (defined("DEBUG") && DEBUG>=3) echo "YellowThemes::load file:$entry<br/>\n";
|
||||
$this->modified = max($this->modified, filemtime($entry));
|
||||
$name = $this->yellow->lookup->normaliseName(basename($entry), true, true);
|
||||
$this->register($name, "", "");
|
||||
if (substru($name, 0, 7)!="bundle-") $this->register($name, "", "");
|
||||
}
|
||||
$callback = function ($a, $b) {
|
||||
return $a["priority"] - $b["priority"];
|
||||
|
@ -2295,7 +2292,7 @@ class YellowLookup {
|
|||
return $visible;
|
||||
}
|
||||
|
||||
// Check if location is within current request
|
||||
// Check if location is within current HTTP request
|
||||
public function isActiveLocation($location, $currentLocation) {
|
||||
if ($this->isFileLocation($location)) {
|
||||
$active = $currentLocation==$location;
|
||||
|
@ -2994,7 +2991,7 @@ class YellowToolbox {
|
|||
}
|
||||
|
||||
// Detect image dimensions and type for gif/jpg/png/svg
|
||||
public function detectImageInfo($fileName) {
|
||||
public function detectImageInformation($fileName) {
|
||||
$width = $height = 0;
|
||||
$type = "";
|
||||
$fileHandle = @fopen($fileName, "rb");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowEdit {
|
||||
const VERSION = "0.7.27";
|
||||
const VERSION = "0.7.28";
|
||||
public $yellow; //access to API
|
||||
public $response; //web response
|
||||
public $users; //user accounts
|
||||
|
@ -73,7 +73,7 @@ class YellowEdit {
|
|||
return $statusCode;
|
||||
}
|
||||
|
||||
// Handle page meta data parsing
|
||||
// Handle page meta data
|
||||
public function onParseMeta($page) {
|
||||
if ($page==$this->yellow->page && $this->response->isActive()) {
|
||||
if ($this->response->isUser()) {
|
||||
|
@ -89,7 +89,7 @@ class YellowEdit {
|
|||
}
|
||||
}
|
||||
|
||||
// Handle page content parsing of custom block
|
||||
// Handle page content of custom block
|
||||
public function onParseContentBlock($page, $name, $text, $shortcut) {
|
||||
$output = null;
|
||||
if ($name=="edit" && $shortcut) {
|
||||
|
@ -100,13 +100,13 @@ class YellowEdit {
|
|||
return $output;
|
||||
}
|
||||
|
||||
// Handle page extra HTML data
|
||||
public function onExtra($name) {
|
||||
// Handle page extra data
|
||||
public function onParsePageExtra($page, $name) {
|
||||
$output = null;
|
||||
if ($name=="header" && $this->response->isActive()) {
|
||||
$pluginLocation = $this->yellow->config->get("serverBase").$this->yellow->config->get("pluginLocation");
|
||||
$output = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$pluginLocation}edit.css\" />\n";
|
||||
$output .= "<script type=\"text/javascript\" src=\"{$pluginLocation}edit.js\"></script>\n";
|
||||
$output = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" data-bundle=\"none\" href=\"{$pluginLocation}edit.css\" />\n";
|
||||
$output .= "<script type=\"text/javascript\" data-bundle=\"none\" src=\"{$pluginLocation}edit.js\"></script>\n";
|
||||
$output .= "<script type=\"text/javascript\">\n";
|
||||
$output .= "// <![CDATA[\n";
|
||||
$output .= "yellow.page = ".json_encode($this->response->getPageData()).";\n";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowImage {
|
||||
const VERSION = "0.7.3";
|
||||
const VERSION = "0.7.4";
|
||||
public $yellow; //access to API
|
||||
public $graphicsLibrary; //graphics library support? (boolean)
|
||||
|
||||
|
@ -18,7 +18,7 @@ class YellowImage {
|
|||
$this->graphicsLibrary = $this->isGraphicsLibrary();
|
||||
}
|
||||
|
||||
// Handle page content parsing of custom block
|
||||
// Handle page content of custom block
|
||||
public function onParseContentBlock($page, $name, $text, $shortcut) {
|
||||
$output = null;
|
||||
if ($name=="image" && $shortcut) {
|
||||
|
@ -31,7 +31,7 @@ class YellowImage {
|
|||
if (empty($alt)) $alt = $this->yellow->config->get("imageAlt");
|
||||
if (empty($width)) $width = "100%";
|
||||
if (empty($height)) $height = $width;
|
||||
list($src, $width, $height) = $this->getImageInfo($this->yellow->config->get("imageDir").$name, $width, $height);
|
||||
list($src, $width, $height) = $this->getImageInformation($this->yellow->config->get("imageDir").$name, $width, $height);
|
||||
} else {
|
||||
if (empty($alt)) $alt = $this->yellow->config->get("imageAlt");
|
||||
$src = $this->yellow->lookup->normaliseUrl("", "", "", $name);
|
||||
|
@ -71,9 +71,9 @@ class YellowImage {
|
|||
}
|
||||
|
||||
// Return image info, create thumbnail on demand
|
||||
public function getImageInfo($fileName, $widthOutput, $heightOutput) {
|
||||
public function getImageInformation($fileName, $widthOutput, $heightOutput) {
|
||||
$fileNameShort = substru($fileName, strlenu($this->yellow->config->get("imageDir")));
|
||||
list($widthInput, $heightInput, $type) = $this->yellow->toolbox->detectImageInfo($fileName);
|
||||
list($widthInput, $heightInput, $type) = $this->yellow->toolbox->detectImageInformation($fileName);
|
||||
$widthOutput = $this->convertValueAndUnit($widthOutput, $widthInput);
|
||||
$heightOutput = $this->convertValueAndUnit($heightOutput, $heightInput);
|
||||
if (($widthInput==$widthOutput && $heightInput==$heightOutput) || $type=="svg") {
|
||||
|
@ -94,7 +94,7 @@ class YellowImage {
|
|||
}
|
||||
}
|
||||
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageThumbnailLocation").$fileNameThumb;
|
||||
list($width, $height) = $this->yellow->toolbox->detectImageInfo($fileNameOutput);
|
||||
list($width, $height) = $this->yellow->toolbox->detectImageInformation($fileNameOutput);
|
||||
}
|
||||
return array($src, $width, $height);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class YellowMarkdown {
|
|||
$this->yellow = $yellow;
|
||||
}
|
||||
|
||||
// Handle page content parsing of raw format
|
||||
// Handle page content in raw format
|
||||
public function onParseContentRaw($page, $text) {
|
||||
$markdown = new YellowMarkdownExtraParser($this->yellow, $page);
|
||||
return $markdown->transform($text);
|
||||
|
@ -3848,7 +3848,7 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser {
|
|||
$width = $height = 0;
|
||||
$src = $matches[3]=="" ? $matches[4] : $matches[3];
|
||||
if (!preg_match("/^\w+:/", $src)) {
|
||||
list($width, $height) = $this->yellow->toolbox->detectImageInfo($this->yellow->config->get("imageDir").$src);
|
||||
list($width, $height) = $this->yellow->toolbox->detectImageInformation($this->yellow->config->get("imageDir").$src);
|
||||
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageLocation").$src;
|
||||
}
|
||||
$alt = $matches[2];
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowUpdate {
|
||||
const VERSION = "0.7.16";
|
||||
const VERSION = "0.7.17";
|
||||
public $yellow; //access to API
|
||||
public $updates; //number of updates
|
||||
|
||||
|
@ -40,67 +40,6 @@ class YellowUpdate {
|
|||
}
|
||||
if ($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileNameConfig, $fileDataNew);
|
||||
}
|
||||
if ($update) { //TODO: remove later, converts old theme
|
||||
$path = $this->yellow->config->get("themeDir");
|
||||
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/^.*\.css$/", true, false) as $entry) {
|
||||
$fileNameAsset = $this->yellow->config->get("assetDir").basename($entry);
|
||||
if (!is_file($fileNameAsset)) {
|
||||
$fileData = $this->yellow->toolbox->readFile($entry);
|
||||
$fileData = preg_replace("#url\(assets/(.*?)\)#", "url($1)", $fileData);
|
||||
$this->yellow->toolbox->createFile($fileNameAsset, $fileData);
|
||||
}
|
||||
$this->yellow->toolbox->deleteFile($entry, $this->yellow->config->get("trashDir"));
|
||||
$_GET["clean-url"] = "theme-has-been-updated";
|
||||
}
|
||||
}
|
||||
if ($update) { //TODO: remove later, converts old error page
|
||||
$fileName = $this->yellow->config->get("configDir")."page-error-500.txt";
|
||||
if (is_file($fileName)) {
|
||||
$fileData = $this->yellow->toolbox->readFile($fileName);
|
||||
$fileDataNew = preg_replace("/@pageerror/", "[yellow error]", $fileData);
|
||||
if ($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileName, $fileDataNew);
|
||||
}
|
||||
}
|
||||
if ($update) { //TODO: remove later, converts new blog page
|
||||
$fileName = $this->yellow->config->get("configDir")."page-new-blog.txt";
|
||||
if (is_file($fileName)) {
|
||||
$fileData = $this->yellow->toolbox->readFile($fileName);
|
||||
$fileDataNew = $this->yellow->toolbox->setMetaData($fileData, "template", "blog");
|
||||
if ($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileName, $fileDataNew);
|
||||
}
|
||||
}
|
||||
if ($update) { //TODO: remove later, converts new wiki page
|
||||
$fileName = $this->yellow->config->get("configDir")."page-new-wiki.txt";
|
||||
if (is_file($fileName)) {
|
||||
$fileData = $this->yellow->toolbox->readFile($fileName);
|
||||
$fileDataNew = $this->yellow->toolbox->setMetaData($fileData, "template", "wiki");
|
||||
if ($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileName, $fileDataNew);
|
||||
}
|
||||
}
|
||||
if ($update) { //TODO: remove later, converts template settings
|
||||
$valueDefault = $this->yellow->config->get("template");
|
||||
foreach ($this->yellow->pages->index(true, true) as $page) {
|
||||
preg_match("/^.*\/(.+?)$/", dirname($page->fileName), $matches);
|
||||
$value = $this->yellow->lookup->normaliseName($matches[1], true, false, true);
|
||||
if (!is_file($this->yellow->config->get("templateDir").$value.".html")) $value = $valueDefault;
|
||||
$pageTemplate = $this->yellow->toolbox->getMetaData($page->rawData, "template");
|
||||
$pagePublished = $this->yellow->toolbox->getMetaData($page->rawData, "published");
|
||||
if (empty($pagePublished) && $value=="blog") $value = $valueDefault;
|
||||
if (empty($pageTemplate) && $value!=$valueDefault) {
|
||||
$rawDataNew = $this->yellow->toolbox->setMetaData($page->rawData, "template", $value);
|
||||
if ($page->rawData!=$rawDataNew) $this->yellow->toolbox->createFile($page->fileName, $rawDataNew);
|
||||
}
|
||||
}
|
||||
foreach ($this->yellow->pages->index(true, true)->filter("template", "blogpages") as $page) {
|
||||
$rawDataNew = $this->yellow->toolbox->setMetaData($page->rawData, "templateNew", "blog");
|
||||
if ($page->rawData!=$rawDataNew) $this->yellow->toolbox->createFile($page->fileName, $rawDataNew);
|
||||
}
|
||||
foreach ($this->yellow->pages->index(true, true)->filter("template", "wikipages") as $page) {
|
||||
$rawDataNew = $this->yellow->toolbox->setMetaData($page->rawData, "templateNew", "wiki");
|
||||
if ($page->rawData!=$rawDataNew) $this->yellow->toolbox->createFile($page->fileName, $rawDataNew);
|
||||
}
|
||||
$this->yellow->pages = new YellowPages($this->yellow);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle request
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<!DOCTYPE html><html lang="<?php echo $yellow->page->getHtml("language") ?>">
|
||||
<head>
|
||||
<title><?php echo $yellow->page->getHtml("titleHeader") ?></title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="description" content="<?php echo $yellow->page->getHtml("description") ?>" />
|
||||
<meta name="keywords" content="<?php echo $yellow->page->getHtml("keywords") ?>" />
|
||||
<meta name="author" content="<?php echo $yellow->page->getHtml("author") ?>" />
|
||||
<meta name="generator" content="Datenstrom Yellow" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?php echo $yellow->page->getHtml("titleHeader") ?></title>
|
||||
<?php echo $yellow->page->getExtra("header") ?>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Add table
Reference in a new issue