Core update (summer plugin remix)
This commit is contained in:
parent
ef460b25d0
commit
0c9d4bcc76
|
@ -1,6 +1,6 @@
|
|||
Yellow 0.3.6
|
||||
Yellow 0.3.7
|
||||
============
|
||||
Yellow is for people who make websites.
|
||||
Yellow is for people who make websites. [Visit website](http://datenstrom.se/yellow/).
|
||||
|
||||
[![Status](https://travis-ci.org/markseu/yellowcms.svg)](https://travis-ci.org/markseu/yellowcms)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Command line core plugin
|
||||
class YellowCommandline
|
||||
{
|
||||
const Version = "0.3.3";
|
||||
const Version = "0.3.4";
|
||||
var $yellow; //access to API
|
||||
var $content; //number of content pages
|
||||
var $media; //number of media files
|
||||
|
@ -358,5 +358,5 @@ class YellowCommandline
|
|||
}
|
||||
}
|
||||
|
||||
$yellow->registerPlugin("commandline", "YellowCommandline", YellowCommandline::Version);
|
||||
$yellow->plugins->register("commandline", "YellowCommandline", YellowCommandline::Version);
|
||||
?>
|
|
@ -5,7 +5,7 @@
|
|||
// Markdown extra core plugin
|
||||
class YellowMarkdownExtra
|
||||
{
|
||||
const Version = "0.3.4";
|
||||
const Version = "0.3.5";
|
||||
var $yellow; //access to API
|
||||
|
||||
// Handle plugin initialisation
|
||||
|
@ -14,11 +14,11 @@ class YellowMarkdownExtra
|
|||
$this->yellow = $yellow;
|
||||
}
|
||||
|
||||
// Handle page text parsing, raw format
|
||||
function onParseText($page, $text)
|
||||
// Handle page content parsing of raw format
|
||||
function onParseContentText($page, $text)
|
||||
{
|
||||
$markdown = new YellowMarkdownExtraParser($this->yellow);
|
||||
return $markdown->transformText($page, $text);
|
||||
$markdown = new YellowMarkdownExtraParser($this->yellow, $page);
|
||||
return $markdown->transformText($text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,24 +26,26 @@ class YellowMarkdownExtra
|
|||
class YellowMarkdownExtraParser extends MarkdownExtraParser
|
||||
{
|
||||
var $yellow; //access to API
|
||||
var $page; //access to page
|
||||
var $idAttributes; //id attributes
|
||||
|
||||
function __construct($yellow)
|
||||
function __construct($yellow, $page)
|
||||
{
|
||||
$this->yellow = $yellow;
|
||||
$this->page = $page;
|
||||
$this->idAttributes = array();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
// Transform page text
|
||||
function transformText($page, $text)
|
||||
function transformText($text)
|
||||
{
|
||||
$text = preg_replace("/@pageRead/i", $page->get("pageRead"), $text);
|
||||
$text = preg_replace("/@pageEdit/i", $page->get("pageEdit"), $text);
|
||||
$text = preg_replace("/@pageError/i", $page->get("pageError"), $text);
|
||||
$callback = function($matches) use ($page)
|
||||
$text = preg_replace("/@pageRead/i", $this->page->get("pageRead"), $text);
|
||||
$text = preg_replace("/@pageEdit/i", $this->page->get("pageEdit"), $text);
|
||||
$text = preg_replace("/@pageError/i", $this->page->get("pageError"), $text);
|
||||
$callback = function($matches)
|
||||
{
|
||||
$matches[2] = $page->yellow->toolbox->normaliseLocation($matches[2], $page->base, $page->location);
|
||||
$matches[2] = $this->yellow->toolbox->normaliseLocation($matches[2], $this->page->base, $this->page->location);
|
||||
return "<a$matches[1]href=\"$matches[2]\"$matches[3]>";
|
||||
};
|
||||
return preg_replace_callback("/<a(.*?)href=\"([^\"]+)\"(.*?)>/i", $callback, $this->transform($text));
|
||||
|
@ -77,7 +79,7 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser
|
|||
function _doAutoLinks_shortcut_callback($matches)
|
||||
{
|
||||
$text = preg_replace("/\s+/s", " ", $matches[2]);
|
||||
$output = $this->yellow->page->parseType($matches[1], $text, true);
|
||||
$output = $this->page->parseType($matches[1], $text, true);
|
||||
if(is_null($output)) $output = $matches[0];
|
||||
return $this->hashBlock($output);
|
||||
}
|
||||
|
@ -86,7 +88,7 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser
|
|||
function _doFencedCodeBlocks_callback($matches)
|
||||
{
|
||||
$text = $matches[4];
|
||||
$output = $this->yellow->page->parseType($matches[2], $text, false);
|
||||
$output = $this->page->parseType($matches[2], $text, false);
|
||||
if(is_null($output))
|
||||
{
|
||||
$attr = $this->doExtraAttributes("pre", $dummy =& $matches[3]);
|
||||
|
@ -3243,5 +3245,5 @@ class MarkdownExtraParser extends MarkdownParser {
|
|||
|
||||
}
|
||||
|
||||
$yellow->registerPlugin("markdownextra", "YellowMarkdownExtra", YellowMarkdownExtra::Version);
|
||||
$yellow->plugins->register("markdownextra", "YellowMarkdownExtra", YellowMarkdownExtra::Version);
|
||||
?>
|
|
@ -5,7 +5,7 @@
|
|||
// Web interface core plugin
|
||||
class YellowWebinterface
|
||||
{
|
||||
const Version = "0.3.2";
|
||||
const Version = "0.3.3";
|
||||
var $yellow; //access to API
|
||||
var $users; //web interface users
|
||||
var $active; //web interface is active? (boolean)
|
||||
|
@ -485,5 +485,5 @@ class YellowWebinterfaceUsers
|
|||
}
|
||||
}
|
||||
|
||||
$yellow->registerPlugin("webinterface", "YellowWebinterface", YellowWebinterface::Version);
|
||||
$yellow->plugins->register("webinterface", "YellowWebinterface", YellowWebinterface::Version);
|
||||
?>
|
|
@ -5,7 +5,7 @@
|
|||
// Yellow main class
|
||||
class Yellow
|
||||
{
|
||||
const Version = "0.3.6";
|
||||
const Version = "0.3.7";
|
||||
var $page; //current page
|
||||
var $pages; //pages from file system
|
||||
var $config; //configuration
|
||||
|
@ -221,7 +221,7 @@ class Yellow
|
|||
}
|
||||
}
|
||||
|
||||
// Update configuration
|
||||
// Update dynamic configuration
|
||||
function updateConfig()
|
||||
{
|
||||
if(!$this->isContentDirectory("/"))
|
||||
|
@ -277,6 +277,21 @@ class Yellow
|
|||
return is_dir($path);
|
||||
}
|
||||
|
||||
// Execute command
|
||||
function command($name, $args = NULL)
|
||||
{
|
||||
$statusCode = 0;
|
||||
if($this->plugins->isExisting($name))
|
||||
{
|
||||
$plugin = $this->plugins->plugins[$name];
|
||||
if(method_exists($plugin["obj"], "onCommand")) $statusCode = $plugin["obj"]->onCommand(func_get_args());
|
||||
} else {
|
||||
$statusCode = 500;
|
||||
$this->page->error($statusCode, "Plugin '$name' does not exist!");
|
||||
}
|
||||
return $statusCode;
|
||||
}
|
||||
|
||||
// Execute template
|
||||
function template($name)
|
||||
{
|
||||
|
@ -310,22 +325,7 @@ class Yellow
|
|||
return $this->pages->snippetArgs;
|
||||
}
|
||||
|
||||
// Execute plugin command
|
||||
function plugin($name, $args = NULL)
|
||||
{
|
||||
$statusCode = 0;
|
||||
if($this->plugins->isExisting($name))
|
||||
{
|
||||
$plugin = $this->plugins->plugins[$name];
|
||||
if(method_exists($plugin["obj"], "onCommand")) $statusCode = $plugin["obj"]->onCommand(func_get_args());
|
||||
} else {
|
||||
$statusCode = 500;
|
||||
$this->page->error($statusCode, "Plugin '$name' does not exist!");
|
||||
}
|
||||
return $statusCode;
|
||||
}
|
||||
|
||||
// Register plugin
|
||||
// Register plugin, OBSOLETE AND WILL BE REMOVED SOON
|
||||
function registerPlugin($name, $class, $version)
|
||||
{
|
||||
$this->plugins->register($name, $class, $version);
|
||||
|
@ -452,10 +452,10 @@ class YellowPage
|
|||
if($this->yellow->plugins->isExisting($this->get("parser")))
|
||||
{
|
||||
$plugin = $this->yellow->plugins->plugins[$this->get("parser")];
|
||||
if(method_exists($plugin["obj"], "onParseText"))
|
||||
if(method_exists($plugin["obj"], "onParseContentText"))
|
||||
{
|
||||
$this->parser = $plugin["obj"];
|
||||
$this->parserData = $this->parser->onParseText($this, $this->getContent(true));
|
||||
$this->parserData = $this->parser->onParseContentText($this, $this->getContent(true));
|
||||
foreach($this->yellow->plugins->plugins as $key=>$value)
|
||||
{
|
||||
if(method_exists($value["obj"], "onParseContent"))
|
||||
|
@ -478,7 +478,7 @@ class YellowPage
|
|||
}
|
||||
}
|
||||
|
||||
// Parse custom type
|
||||
// Parse page custom type
|
||||
function parseType($name, $text, $typeShortcut)
|
||||
{
|
||||
$output = NULL;
|
||||
|
@ -486,7 +486,7 @@ class YellowPage
|
|||
{
|
||||
if(method_exists($value["obj"], "onParseType"))
|
||||
{
|
||||
$output = $value["obj"]->onParseType($name, $text, $typeShortcut);
|
||||
$output = $value["obj"]->onParseType($this, $name, $text, $typeShortcut);
|
||||
if(!is_null($output)) break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ class YellowExample
|
|||
const Version = "0.0.0";
|
||||
}
|
||||
|
||||
$yellow->registerPlugin("example", "YellowExample", YellowExample::Version);
|
||||
$yellow->plugins->register("example", "YellowExample", YellowExample::Version);
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<div class="footer">
|
||||
© 2014 <?php echo $yellow->page->getHtml("sitename") ?>. <a href="https://github.com/markseu/yellowcms">Built with Yellow</a>.
|
||||
© 2014 <?php echo $yellow->page->getHtml("sitename") ?>. <a href="http://datenstrom.se/yellow">Made with Yellow</a>.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
// Yellow is for people who make websites. https://github.com/markseu/yellowcms
|
||||
// For more information see Yellow documentation.
|
||||
// Yellow is for people who make websites. http://datenstrom.se/yellow
|
||||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
require_once("system/core/core.php");
|
||||
if(PHP_SAPI != "cli")
|
||||
|
@ -11,7 +11,7 @@ if(PHP_SAPI != "cli")
|
|||
} else {
|
||||
$yellow = new Yellow();
|
||||
$yellow->plugins->load();
|
||||
$statusCode = $yellow->plugin("commandline", $argv[1], $argv[2], $argv[3], $argv[4], $argv[5], $argv[6]);
|
||||
$statusCode = $yellow->command("commandline", $argv[1], $argv[2], $argv[3], $argv[4], $argv[5], $argv[6]);
|
||||
exit($statusCode<=200 ? 0 : 1);
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue