mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit d8ead85404a76fec5c31a0de85a9f11cb7721c62
parent 53c164655b6adf9cfb87d7c504969da228e00967
Author: markseu <mark2011@mayberg.se>
Date:   Thu, 29 May 2014 23:33:01 +0200

Core update (API summer remix)

Diffstat:
MREADME.md | 2+-
Msystem/core/core-commandline.php | 4++--
Msystem/core/core-markdownextra.php | 12++++++------
Msystem/core/core-webinterface.php | 16++++++++--------
Msystem/core/core.php | 26++++++++++++++++----------
Msystem/plugins/example.php | 4+---
Msystem/snippets/header.php | 2+-
7 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/README.md b/README.md @@ -16,7 +16,7 @@ Yellow doesn't come with a lot of stuff. [Download Yellow extensions](https://gi How do I get started? --------------------- -You already have everything you need. Edit your website. [Test online demo](http://demo.datenstrom.se). +You already have everything you need. Edit your website. [Test demo](http://demo.datenstrom.se). How to use it? -------------- diff --git a/system/core/core-commandline.php b/system/core/core-commandline.php @@ -5,7 +5,7 @@ // Command line core plugin class YellowCommandline { - const Version = "0.2.8"; + const Version = "0.2.9"; var $yellow; //access to API var $content; //number of content pages var $media; //number of media files @@ -15,7 +15,7 @@ class YellowCommandline var $locationsPagination; //locations with pagination detected var $fileNamesPlugin; //plugin files detected - // Initialise plugin + // Handle plugin initialisation function onLoad($yellow) { $this->yellow = $yellow; diff --git a/system/core/core-markdownextra.php b/system/core/core-markdownextra.php @@ -5,20 +5,20 @@ // Markdown extra core plugin class YellowMarkdownExtra { - const Version = "0.2.10"; + const Version = "0.2.11"; var $yellow; //access to API - // Initialise plugin + // Handle plugin initialisation function onLoad($yellow) { $this->yellow = $yellow; } - // Handle page parsing - function onParse($page, $text) + // Handle page text parsing, raw format + function onParseText($page, $text) { $markdown = new YellowMarkdownExtraParser($this->yellow); - return $markdown->transformPage($page, $text); + return $markdown->transformText($page, $text); } } @@ -36,7 +36,7 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser } // Transform page text - function transformPage($page, $text) + function transformText($page, $text) { $text = preg_replace("/@pageRead/i", $page->get("pageRead"), $text); $text = preg_replace("/@pageEdit/i", $page->get("pageEdit"), $text); diff --git a/system/core/core-webinterface.php b/system/core/core-webinterface.php @@ -5,14 +5,14 @@ // Web interface core plugin class YellowWebinterface { - const Version = "0.2.9"; + const Version = "0.2.10"; var $yellow; //access to API var $users; //web interface users var $active; //web interface is active? (boolean) var $loginFailed; //web interface login failed? (boolean) var $rawDataOriginal; //raw data of page in case of errors - // Initialise plugin + // Handle plugin initialisation function onLoad($yellow) { $this->yellow = $yellow; @@ -27,7 +27,7 @@ class YellowWebinterface $this->users->load($this->yellow->config->get("configDir").$this->yellow->config->get("webinterfaceUserFile")); } - // Handle web interface location + // Handle request function onRequest($serverScheme, $serverName, $base, $location, $fileName) { $statusCode = 0; @@ -96,8 +96,8 @@ class YellowWebinterface return $output; } - // Handle extra HTML header lines - function onHeaderExtra() + // Handle page extra header + function onHeaderExtra($page) { $header = ""; if($this->isActive()) @@ -109,12 +109,12 @@ class YellowWebinterface $header .= "// <![CDATA[\n"; if($this->isUser()) { - $permissions = $this->checkPermissions($this->yellow->page->location, $this->yellow->page->fileName); - $header .= "yellow.page.rawData = ".json_encode($this->yellow->page->rawData).";\n"; + $permissions = $this->checkPermissions($page->location, $page->fileName); + $header .= "yellow.page.rawData = ".json_encode($page->rawData).";\n"; $header .= "yellow.page.permissions = " .json_encode($permissions).";\n"; $header .= "yellow.config = ".json_encode($this->getConfigData()).";\n"; } - $language = $this->isUser() ? $this->users->getLanguage() : $this->yellow->page->get("language"); + $language = $this->isUser() ? $this->users->getLanguage() : $page->get("language"); $header .= "yellow.text = ".json_encode($this->yellow->text->getData("webinterface", $language)).";\n"; if(defined("DEBUG")) $header .= "yellow.debug = ".json_encode(DEBUG).";\n"; $header .= "// ]]>\n"; diff --git a/system/core/core.php b/system/core/core.php @@ -5,7 +5,7 @@ // Yellow main class class Yellow { - const Version = "0.2.20"; + const Version = "0.2.21"; var $page; //current page var $pages; //pages from file system var $config; //configuration @@ -300,15 +300,10 @@ class Yellow return $this->pages->snippetArgs; } - // Return extra HTML header lines + // Return page extra header, OBSOLETE WILL BE REMOVED function getHeaderExtra() { - $header = ""; - foreach($this->plugins->plugins as $key=>$value) - { - if(method_exists($value["obj"], "onHeaderExtra")) $header .= $value["obj"]->onHeaderExtra(); - } - return $header; + return $this->page->getHeaderExtra(); } // Execute plugin command @@ -453,10 +448,10 @@ class YellowPage if($this->yellow->plugins->isExisting($this->get("parser"))) { $plugin = $this->yellow->plugins->plugins[$this->get("parser")]; - if(method_exists($plugin["obj"], "onParse")) + if(method_exists($plugin["obj"], "onParseText")) { $this->parser = $plugin["obj"]; - $this->parserData = $this->parser->onParse($this, $this->getContent(true)); + $this->parserData = $this->parser->onParseText($this, $this->getContent(true)); foreach($this->yellow->plugins->plugins as $key=>$value) { if(method_exists($value["obj"], "onParseContent")) @@ -539,6 +534,17 @@ class YellowPage return $text; } + // Return page extra header, HTML encoded + function getHeaderExtra() + { + $header = ""; + foreach($this->yellow->plugins->plugins as $key=>$value) + { + if(method_exists($value["obj"], "onHeaderExtra")) $header .= $value["obj"]->onHeaderExtra($this); + } + return $header; + } + // Return parent page relative to current page function getParent() { diff --git a/system/plugins/example.php b/system/plugins/example.php @@ -1,12 +1,10 @@ <?php -// Copyright (c) 2013 Datenstrom, http://datenstrom.se +// Copyright (c) 2013-2014 Datenstrom, http://datenstrom.se // This file may be used and distributed under the terms of the public license. // Example plugin class YellowExample { - //You can download plugins and extensions from Github. - //See https://github.com/markseu/yellowcms-extensions const Version = "0.0.0"; } diff --git a/system/snippets/header.php b/system/snippets/header.php @@ -8,7 +8,7 @@ <title><?php echo $yellow->page->getHtml("titleHeader") ?></title> <link rel="shortcut icon" href="<?php echo $yellow->config->get("serverBase").$yellow->config->get("imageLocation")."icon.png" ?>" /> <link rel="stylesheet" type="text/css" media="all" href="<?php echo $yellow->config->get("serverBase").$yellow->config->get("styleLocation").$yellow->page->get("style").".css" ?>" /> -<?php echo $yellow->getHeaderExtra() ?> +<?php echo $yellow->page->getHeaderExtra() ?> </head> <body> <div class="page">