commit 5dfcbf1b1d7d896c578df5d49af58b6be174d5a6
parent c7c46371c70ed55b85fe1d30a9dc520baf1e11c2
Author: markseu <mark2011@mayberg.se>
Date: Sat, 29 Mar 2014 00:35:14 +0100
Core update (good design is made for people)
Diffstat:
4 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
@@ -16,10 +16,10 @@ With Yellow you don't get a lot of extra stuff. There are [Yellow extensions](ht
How do I get started?
----------------------
-You already have everything you need. Start editing your website.
+You already have everything you need. Start by editing your website.
That's it. For more information see [Yellow documentation](https://github.com/markseu/yellowcms-extensions/blob/master/documentation/README.md).
License and thanks
------------------
* Yellow by Mark Seuffert and David Fehrmann is licensed under [GPLv2](http://opensource.org/licenses/GPL-2.0).
-* [PHP Markdown Extra](https://github.com/michelf/php-markdown) by Michel Fortin is licensed under [BSD license](http://opensource.org/licenses/BSD-3-Clause)
-\ No newline at end of file
+* [PHP Markdown Extra](https://github.com/michelf/php-markdown) by Michel Fortin is licensed under [BSD license](http://opensource.org/licenses/BSD-3-Clause).
+\ No newline at end of file
diff --git a/media/styles/default.css b/media/styles/default.css
@@ -1,6 +1,6 @@
-/* Yellow default style 0.1.4 */
+/* Yellow default style 0.1.5 */
-html, body, div, pre, span, tr, th, td { margin:0; padding:0; border:0; vertical-align:baseline; }
+html, body, div, form, pre, span, tr, th, td { margin:0; padding:0; border:0; vertical-align:baseline; }
body {
margin:1em;
background-color:#fff; color:#717171;
@@ -28,6 +28,7 @@ a:hover { color:#07d; }
.content a { color:#07d; }
.content a:hover { color:#07d; text-decoration:underline; }
.content img { max-width:100%; height:auto; }
+.content form { margin:1em 0; }
.content .flexible { position:relative; padding-bottom:56.25%; padding-top:30px; }
.content .flexible iframe { position:absolute; top:0; left:0; width:100%; height:100%; }
.footer { margin-top:1em; border-top:1px solid #ddd; line-height:2em; }
diff --git a/system/core/core-webinterface.php b/system/core/core-webinterface.php
@@ -131,7 +131,7 @@ class YellowWebinterface
return $statusCode;
}
- // Create or update user
+ // Create or update user account
function userCommand($args)
{
$statusCode = 0;
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.14";
+ const Version = "0.2.15";
var $page; //current page
var $pages; //pages from file system
var $config; //configuration
@@ -277,7 +277,7 @@ class Yellow
}
}
- // Execute code snippet
+ // Execute snippet code
function snippet($name, $args = NULL)
{
$this->pages->snippetArgs = func_get_args();
@@ -362,9 +362,9 @@ class YellowPage
$this->fileName = $fileName;
$this->rawData = $rawData;
$this->active = $this->yellow->toolbox->isActiveLocation($this->yellow->pages->serverBase, $this->location,
- $this->yellow->page->location);
+ $this->yellow->page->location);
$this->visible = $this->yellow->toolbox->isVisibleLocation($this->yellow->pages->serverBase, $this->location,
- $fileName, $this->yellow->config->get("contentDir"));
+ $fileName, $this->yellow->config->get("contentDir"));
$this->cacheable = $cacheable;
$this->statusCode = $statusCode;
if(!empty($pageError)) $this->error($statusCode, $pageError);
@@ -381,7 +381,8 @@ class YellowPage
$this->set("sitename", $this->yellow->config->get("sitename"));
$this->set("author", $this->yellow->config->get("author"));
$this->set("language", $this->yellow->config->get("language"));
- $this->set("template", $this->yellow->config->get("template"));
+ $this->set("template", $this->yellow->toolbox->findTemplateFromFile($this->fileName,
+ $this->yellow->config->get("templateDir"), $this->yellow->config->get("template")));
$this->set("style", $this->yellow->config->get("style"));
$this->set("parser", $this->yellow->config->get("parser"));
@@ -678,7 +679,7 @@ class YellowPageCollection extends ArrayObject
$pageValueLength = $exactMatch ? strlenu($pageValue) : $valueLength;
if($value == substru(strreplaceu(' ', '-', strtoloweru($pageValue)), 0, $pageValueLength))
{
- $this->filterValue = $pageValue;
+ $this->filterValue = substru($pageValue, 0, $pageValueLength);
array_push($array, $page);
}
}
@@ -1485,6 +1486,13 @@ class YellowToolbox
return $fileNames;
}
+ // Return template from file path
+ function findTemplateFromFile($fileName, $templateDir, $templateDefault)
+ {
+ if(preg_match("/^.*\/(.+?)$/", dirname($fileName), $matches)) $templateFolder = $this->normaliseName($matches[1]);
+ return is_file("$templateDir$templateFolder.php") ? $templateFolder : $templateDefault;
+ }
+
// Normalise directory/file/attribute name
function normaliseName($text, $removeExtension = false, $filterStrict = false)
{