Updated coding standard, there is no spoon

This commit is contained in:
markseu 2018-08-11 00:23:50 +02:00
parent b2d0812f5b
commit 2f213b10bd
13 changed files with 8561 additions and 9079 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,312 +2,552 @@
/* Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se */
/* This file may be used and distributed under the terms of the public license. */
.yellow-bar { position:relative; line-height:2em; margin-bottom:10px; }
.yellow-bar-left { display:block; float:left; }
.yellow-bar-right { display:block; float:right; }
.yellow-bar-right a { margin-left:1em; }
.yellow-bar-right #yellow-pane-create-link { padding:0 0.5em; }
.yellow-bar-right #yellow-pane-delete-link { padding:0 0.5em; }
.yellow-bar-banner { clear:both; }
.yellow-body-modal-open { overflow:hidden; }
.yellow-bar {
position: relative;
line-height: 2em;
margin-bottom: 10px;
}
.yellow-bar-left {
display: block;
float: left;
}
.yellow-bar-right {
display: block;
float: right;
}
.yellow-bar-right a {
margin-left: 1em;
}
.yellow-bar-right #yellow-pane-create-link {
padding: 0 0.5em;
}
.yellow-bar-right #yellow-pane-delete-link {
padding: 0 0.5em;
}
.yellow-bar-banner {
clear: both;
}
.yellow-body-modal-open {
overflow: hidden;
}
.yellow-pane {
position:absolute; display:none; z-index:100; padding:10px;
background-color:#fff; color:#000;
border:1px solid #bbb;
border-radius:4px; box-shadow:2px 4px 10px rgba(0, 0, 0, 0.2);
position: absolute;
display: none;
z-index: 100;
padding: 10px;
background-color: #fff;
color: #000;
border: 1px solid #bbb;
border-radius: 4px;
box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.2);
}
.yellow-pane h1 {
color: #000;
font-size: 2em;
margin: 0 1em;
}
.yellow-pane p {
margin: 0.5em;
}
.yellow-pane .yellow-status {
margin-bottom: 1em;
}
.yellow-pane .yellow-fields {
width: 15em;
text-align: left;
margin: 0 auto;
}
.yellow-pane .yellow-form-control {
width: 15em;
box-sizing: border-box;
}
.yellow-pane .yellow-fields .yellow-btn {
width: 15em;
margin: 1em 0 0.5em 0;
}
.yellow-pane .yellow-buttons .yellow-btn {
width: 15em;
margin: 0.5em 0;
}
.yellow-pane h1 { color:#000; font-size:2em; margin:0 1em; }
.yellow-pane p { margin:0.5em; }
.yellow-pane .yellow-status { margin-bottom:1em; }
.yellow-pane .yellow-fields { width:15em; text-align:left; margin:0 auto; }
.yellow-pane .yellow-form-control { width:15em; box-sizing:border-box; }
.yellow-pane .yellow-fields .yellow-btn { width:15em; margin:1em 0 0.5em 0; }
.yellow-pane .yellow-buttons .yellow-btn { width:15em; margin:0.5em 0; }
.yellow-close {
position:absolute;
top:0.8em; right:1em; cursor:pointer;
font-size:0.9em; color:#bbb; text-decoration:none;
position: absolute;
top: 0.8em;
right: 1em;
cursor: pointer;
font-size: 0.9em;
color: #bbb;
text-decoration: none;
}
.yellow-close:hover { color:#000; text-decoration:none; }
.yellow-arrow { position:absolute; top:0; left:0; }
.yellow-arrow:after, .yellow-arrow:before {
position:absolute;
pointer-events:none;
bottom:100%;
height:0; width:0;
border:solid transparent;
content:"";
.yellow-close:hover {
color: #000;
text-decoration: none;
}
.yellow-arrow {
position: absolute;
top: 0;
left: 0;
}
.yellow-arrow:after,
.yellow-arrow:before {
position: absolute;
pointer-events: none;
bottom: 100%;
height: 0;
width: 0;
border: solid transparent;
content: "";
}
.yellow-arrow:after {
border-color:rgba(255, 255, 255, 0);
border-bottom-color:#fff;
border-width:10px;
margin-left:-10px;
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.yellow-arrow:before {
border-color:rgba(187, 187, 187, 0);
border-bottom-color:#bbb;
border-width:11px;
margin-left:-11px;
border-color: rgba(187, 187, 187, 0);
border-bottom-color: #bbb;
border-width: 11px;
margin-left: -11px;
}
.yellow-popup {
position:absolute; display:none; z-index:200; padding:10px 0;
background-color:#fff; color:#000;
border:1px solid #bbb;
border-radius:4px; box-shadow:2px 4px 10px rgba(0, 0, 0, 0.2);
position: absolute;
display: none;
z-index: 200;
padding: 10px 0;
background-color: #fff;
color: #000;
border: 1px solid #bbb;
border-radius: 4px;
box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.2);
}
.yellow-dropdown {
list-style: none;
margin: 0;
padding: 0;
}
.yellow-dropdown span {
display: block;
margin: 0;
padding: 0.25em 1em;
}
.yellow-dropdown a {
display: block;
padding: 0.2em 1em;
text-decoration: none;
}
.yellow-dropdown a:hover {
color: #fff;
background-color: #18e;
text-decoration: none;
}
.yellow-dropdown-menu a {
color: #000;
}
.yellow-toolbar {
list-style: none;
margin: 0;
padding: 0;
}
.yellow-toolbar-left {
display: inline-block;
float: left;
}
.yellow-toolbar-right {
display: inline-block;
float: right;
}
.yellow-toolbar-banner {
clear: both;
}
.yellow-toolbar li {
display: inline-block;
vertical-align: top;
}
.yellow-dropdown { list-style:none; margin:0; padding:0; }
.yellow-dropdown span { display:block; margin:0; padding:0.25em 1em; }
.yellow-dropdown a { display:block; padding:0.2em 1em; text-decoration:none; }
.yellow-dropdown a:hover { color:#fff; background-color:#18e; text-decoration:none; }
.yellow-dropdown-menu a { color:#000; }
.yellow-toolbar { list-style:none; margin:0; padding:0; }
.yellow-toolbar-left { display:inline-block; float:left; }
.yellow-toolbar-right { display:inline-block; float:right; }
.yellow-toolbar-banner { clear:both; }
.yellow-toolbar li { display:inline-block; vertical-align:top; }
.yellow-toolbar a {
display:inline-block; padding:6px 16px; text-decoration:none;
background-color:#fff; color:#000;
font-size:0.9em; font-weight:normal;
border:1px solid #bbb;
border-radius:4px;
display: inline-block;
padding: 6px 16px;
text-decoration: none;
background-color: #fff;
color: #000;
font-size: 0.9em;
font-weight: normal;
border: 1px solid #bbb;
border-radius: 4px;
}
.yellow-toolbar a:hover {
background-color:#18e; background-image:none; border-color:#18e; color:#fff;
text-decoration:none;
background-color: #18e;
background-image: none;
border-color: #18e;
color: #fff;
text-decoration: none;
}
.yellow-toolbar-left a { margin-right:4px; margin-bottom:10px; }
.yellow-toolbar-right a { margin-left:4px; margin-bottom:10px; }
.yellow-toolbar .yellow-icon
{
font-size:0.9em; min-width:1em; text-align:center;
.yellow-toolbar-left a {
margin-right: 4px;
margin-bottom: 10px;
}
.yellow-toolbar-right a {
margin-left: 4px;
margin-bottom: 10px;
}
.yellow-toolbar .yellow-icon {
font-size: 0.9em;
min-width: 1em;
text-align: center;
}
.yellow-toolbar .yellow-toolbar-btn {
padding:6px 10px; min-width:4em; text-align:center;
padding: 6px 10px;
min-width: 4em;
text-align: center;
}
.yellow-toolbar .yellow-toolbar-btn-edit {
background-color:#29f; border-color:#29f; color:#fff;
background-color: #29f;
border-color: #29f;
color: #fff;
}
.yellow-toolbar .yellow-toolbar-btn-create {
background-color:#29f; border-color:#29f; color:#fff
background-color: #29f;
border-color: #29f;
color: #fff;
}
.yellow-toolbar .yellow-toolbar-btn-delete {
background-color:#e55; border-color:#e55; color:#fff
background-color: #e55;
border-color: #e55;
color: #fff;
}
.yellow-toolbar .yellow-toolbar-btn-delete:hover { background-color:#d44; border-color:#d44; }
.yellow-toolbar .yellow-toolbar-btn-separator { visibility:hidden; padding:6px; }
.yellow-toolbar .yellow-toolbar-checked { background-color:#666; border-color:#666; color:#fff; }
.yellow-toolbar-tooltip { position:relative; }
.yellow-toolbar-tooltip::after, .yellow-toolbar-tooltip::before {
position:absolute; z-index:300; display:none;
pointer-events:none;
.yellow-toolbar .yellow-toolbar-btn-delete:hover {
background-color: #d44;
border-color: #d44;
}
.yellow-toolbar .yellow-toolbar-btn-separator {
visibility: hidden;
padding: 6px;
}
.yellow-toolbar .yellow-toolbar-checked {
background-color: #666;
border-color: #666;
color: #fff;
}
.yellow-toolbar-tooltip {
position: relative;
}
.yellow-toolbar-tooltip::after,
.yellow-toolbar-tooltip::before {
position: absolute;
z-index: 300;
display: none;
pointer-events: none;
}
.yellow-toolbar-tooltip::after {
padding:2px 9px;
font-weight:normal;
font-size:0.9em;
text-align:center;
white-space:nowrap;
content:attr(aria-label);
background-color:#111; color:#ddd;
border-radius:3px;
top:100%;
right:50%;
margin-top:6px;
transform:translateX(50%);
padding: 2px 9px;
font-weight: normal;
font-size: 0.9em;
text-align: center;
white-space: nowrap;
content: attr(aria-label);
background-color: #111;
color: #ddd;
border-radius: 3px;
top: 100%;
right: 50%;
margin-top: 6px;
transform: translateX(50%);
}
.yellow-toolbar-tooltip::before {
width:0; height:0;
content:"";
border:4px solid transparent;
top:auto;
right:50%;
bottom:-6px;
margin-right:-4px;
border-bottom-color:#111;
width: 0;
height: 0;
content: "";
border: 4px solid transparent;
top: auto;
right: 50%;
bottom: -6px;
margin-right: -4px;
border-bottom-color: #111;
}
.yellow-toolbar-tooltip:hover::before, .yellow-toolbar-tooltip:hover::after {
display:inline-block;
.yellow-toolbar-tooltip:hover::before,
.yellow-toolbar-tooltip:hover::after {
display: inline-block;
}
.yellow-toolbar-selected.yellow-toolbar-tooltip::before, .yellow-toolbar-selected.yellow-toolbar-tooltip::after {
display:none;
.yellow-toolbar-selected.yellow-toolbar-tooltip::before,
.yellow-toolbar-selected.yellow-toolbar-tooltip::after {
display: none;
}
.yellow-form-control {
margin:0; padding:2px 4px;
display:inline-block;
background-color:#fff; color:#000;
background-image:linear-gradient(to bottom, #fff, #fff);
border:1px solid #bbb;
border-radius:4px;
font-size:0.9em; font-family:inherit; font-weight:normal; line-height:normal;
margin: 0;
padding: 2px 4px;
display: inline-block;
background-color: #fff;
color: #000;
background-image: linear-gradient(to bottom, #fff, #fff);
border: 1px solid #bbb;
border-radius: 4px;
font-size: 0.9em;
font-family: inherit;
font-weight: normal;
line-height: normal;
}
.yellow-btn {
margin:0; padding:4px 22px;
display:inline-block; min-width:8em;
background-color:#eaeaea; color:#333333;
background-image:linear-gradient(to bottom, #f8f8f8, #e1e1e1);
border:1px solid #bbb;
border-color:#c1c1c1 #c1c1c1 #aaaaaa;
border-radius:4px;
outline-offset:-2px;
font-size:0.9em; font-family:inherit; font-weight:normal; line-height:1;
text-align:center; text-decoration:none;
box-sizing:border-box;
margin: 0;
padding: 4px 22px;
display: inline-block;
min-width: 8em;
background-color: #eaeaea;
color: #333333;
background-image: linear-gradient(to bottom, #f8f8f8, #e1e1e1);
border: 1px solid #bbb;
border-color: #c1c1c1 #c1c1c1 #aaaaaa;
border-radius: 4px;
outline-offset: -2px;
font-size: 0.9em;
font-family: inherit;
font-weight: normal;
line-height: 1;
text-align: center;
text-decoration: none;
box-sizing: border-box;
}
.yellow-btn:hover, .yellow-btn:focus, .yellow-btn:active {
color:#333333;
background-image:none;
text-decoration:none;
.yellow-btn:hover,
.yellow-btn:focus,
.yellow-btn:active {
color: #333333;
background-image: none;
text-decoration: none;
}
.yellow-btn:active { box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.1); }
#yellow-pane-login, #yellow-pane-signup, #yellow-pane-forgot, #yellow-pane-recover, #yellow-pane-settings, #yellow-pane-version, #yellow-pane-quit {
text-align:center;
.yellow-btn:active {
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
#yellow-pane-edit-toolbar-title { margin:-5px 0 0 0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#yellow-pane-edit-text { padding:0 2px; outline:none; resize:none; border:none; }
#yellow-pane-edit-preview { padding:0; overflow:auto; }
#yellow-pane-edit-preview h1 { margin:0.67em 0; }
#yellow-pane-edit-preview p { margin:1em 0; }
#yellow-pane-edit-preview .content { margin:0; padding:0; }
#yellow-pane-user { padding:10px 0; }
#yellow-popup-format, #yellow-popup-heading, #yellow-popup-list { width:16em; }
#yellow-popup-format a, #yellow-popup-heading a { padding:0.25em 16px; }
#yellow-popup-format #yellow-popup-format-h1, #yellow-popup-heading #yellow-popup-heading-h1 { font-size:2em; font-weight:bold; }
#yellow-popup-format #yellow-popup-format-h2, #yellow-popup-heading #yellow-popup-heading-h2 { font-size:1.6em; font-weight:bold; }
#yellow-popup-format #yellow-popup-format-h3, #yellow-popup-heading #yellow-popup-heading-h3 { font-size:1.3em; font-weight:bold; }
#yellow-popup-format #yellow-popup-format-quote { font-style:italic; }
#yellow-popup-format #yellow-popup-format-pre { font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace; font-size:0.9em; line-height:1.8; }
#yellow-popup-emojiawesome { padding:10px; width:14em; }
#yellow-popup-emojiawesome a { padding:0.2em; }
#yellow-popup-emojiawesome .yellow-dropdown li { display:inline-block; }
/* Specific panes */
#yellow-popup-fontawesome { padding:10px; width:13em; }
#yellow-popup-fontawesome a { padding:0.18em 0.3em; min-width:1em; text-align:center; }
#yellow-popup-fontawesome .yellow-dropdown li { display:inline-block; }
#yellow-pane-login,
#yellow-pane-signup,
#yellow-pane-forgot,
#yellow-pane-recover,
#yellow-pane-settings,
#yellow-pane-version,
#yellow-pane-quit {
text-align: center;
}
#yellow-pane-edit-toolbar-title {
margin: -5px 0 0 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#yellow-pane-edit-text {
padding: 0 2px;
outline: none;
resize: none;
border: none;
}
#yellow-pane-edit-preview {
padding: 0;
overflow: auto;
}
#yellow-pane-edit-preview h1 {
margin: 0.67em 0;
}
#yellow-pane-edit-preview p {
margin: 1em 0;
}
#yellow-pane-edit-preview .content {
margin: 0;
padding: 0;
}
#yellow-pane-user {
padding: 10px 0;
}
/* Specific popups */
#yellow-popup-format,
#yellow-popup-heading,
#yellow-popup-list {
width: 16em;
}
#yellow-popup-format a,
#yellow-popup-heading a {
padding: 0.25em 16px;
}
#yellow-popup-format #yellow-popup-format-h1,
#yellow-popup-heading #yellow-popup-heading-h1 {
font-size: 2em;
font-weight: bold;
}
#yellow-popup-format #yellow-popup-format-h2,
#yellow-popup-heading #yellow-popup-heading-h2 {
font-size: 1.6em;
font-weight: bold;
}
#yellow-popup-format #yellow-popup-format-h3,
#yellow-popup-heading #yellow-popup-heading-h3 {
font-size: 1.3em;
font-weight: bold;
}
#yellow-popup-format #yellow-popup-format-quote {
font-style: italic;
}
#yellow-popup-format #yellow-popup-format-pre {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 0.9em;
line-height: 1.8;
}
#yellow-popup-emojiawesome {
padding: 10px;
width: 14em;
}
#yellow-popup-emojiawesome a {
padding: 0.2em;
}
#yellow-popup-emojiawesome .yellow-dropdown li {
display: inline-block;
}
#yellow-popup-fontawesome {
padding: 10px;
width: 13em;
}
#yellow-popup-fontawesome a {
padding: 0.18em 0.3em;
min-width: 1em;
text-align: center;
}
#yellow-popup-fontawesome .yellow-dropdown li {
display: inline-block;
}
/* Icons */
@font-face {
font-family:'Edit';
font-weight:normal;
font-style:normal;
src:url('edit.woff') format('woff');
font-family: "Edit";
font-weight: normal;
font-style: normal;
src: url("edit.woff") format("woff");
}
.yellow-icon {
display:inline-block;
font-family:Edit;
font-style:normal;
font-weight:normal;
-webkit-font-smoothing:antialiased;
-moz-osx-font-smoothing:grayscale;
display: inline-block;
font-family: Edit;
font-style: normal;
font-weight: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.yellow-spin {
-webkit-animation:yellow-spin 1s infinite steps(16);
animation:yellow-spin 1s infinite steps(16);
-webkit-animation: yellow-spin 1s infinite steps(16);
animation: yellow-spin 1s infinite steps(16);
}
@-webkit-keyframes yellow-spin {
0% { -webkit-transform:rotate(0deg); transform:rotate(0deg); }
100% { -webkit-transform:rotate(359deg); transform:rotate(359deg); }
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes yellow-spin {
0% { -webkit-transform:rotate(0deg); transform:rotate(0deg); }
100% { -webkit-transform:rotate(359deg); transform:rotate(359deg); }
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.yellow-icon-preview:before {
content: "\f100";
content: "\f100";
}
.yellow-icon-format:before {
content: "\f101";
content: "\f101";
}
.yellow-icon-paragraph:before {
content: "\f101";
content: "\f101";
}
.yellow-icon-heading:before {
content: "\f102";
content: "\f102";
}
.yellow-icon-h1:before {
content: "\f103";
content: "\f103";
}
.yellow-icon-h2:before {
content: "\f104";
content: "\f104";
}
.yellow-icon-h3:before {
content: "\f105";
content: "\f105";
}
.yellow-icon-bold:before {
content: "\f106";
content: "\f106";
}
.yellow-icon-italic:before {
content: "\f0f7";
content: "\f0f7";
}
.yellow-icon-strikethrough:before {
content: "\f108";
content: "\f108";
}
.yellow-icon-quote:before {
content: "\f109";
content: "\f109";
}
.yellow-icon-code:before {
content: "\f10a";
content: "\f10a";
}
.yellow-icon-pre:before {
content: "\f10a";
content: "\f10a";
}
.yellow-icon-link:before {
content: "\f10b";
content: "\f10b";
}
.yellow-icon-file:before {
content: "\f10c";
content: "\f10c";
}
.yellow-icon-list:before {
content: "\f10d";
content: "\f10d";
}
.yellow-icon-ul:before {
content: "\f10d";
content: "\f10d";
}
.yellow-icon-ol:before {
content: "\f10e";
content: "\f10e";
}
.yellow-icon-tl:before {
content: "\f10f";
content: "\f10f";
}
.yellow-icon-hr:before {
content: "\f110";
content: "\f110";
}
.yellow-icon-table:before {
content: "\f111";
content: "\f111";
}
.yellow-icon-emojiawesome:before {
content: "\f112";
content: "\f112";
}
.yellow-icon-fontawesome:before {
content: "\f113";
content: "\f113";
}
.yellow-icon-draft:before {
content: "\f114";
content: "\f114";
}
.yellow-icon-undo:before {
content: "\f115";
content: "\f115";
}
.yellow-icon-redo:before {
content: "\f116";
content: "\f116";
}
.yellow-icon-spinner:before {
content: "\f200";
content: "\f200";
}
.yellow-icon-search:before {
content: "\f201";
content: "\f201";
}
.yellow-icon-close:before {
content: "\f202";
content: "\f202";
}
.yellow-icon-help:before {
content: "\f203";
content: "\f203";
}
.yellow-icon-markdown:before {
content: "\f203";
content: "\f203";
}
.yellow-icon-logo:before {
content: "\f8ff";
content: "\f8ff";
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,194 +3,168 @@
// Copyright (c) 2013-2017 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowImage
{
const VERSION = "0.7.3";
var $yellow; //access to API
var $graphicsLibrary; //graphics library support? (boolean)
class YellowImage {
const VERSION = "0.7.3";
public $yellow; //access to API
public $graphicsLibrary; //graphics library support? (boolean)
// Handle initialisation
function onLoad($yellow)
{
$this->yellow = $yellow;
$this->yellow->config->setDefault("imageThumbnailLocation", "/media/thumbnails/");
$this->yellow->config->setDefault("imageThumbnailDir", "media/thumbnails/");
$this->yellow->config->setDefault("imageThumbnailJpgQuality", 80);
$this->yellow->config->setDefault("imageAlt", "Image");
$this->graphicsLibrary = $this->isGraphicsLibrary();
}
// Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
$this->yellow->config->setDefault("imageThumbnailLocation", "/media/thumbnails/");
$this->yellow->config->setDefault("imageThumbnailDir", "media/thumbnails/");
$this->yellow->config->setDefault("imageThumbnailJpgQuality", 80);
$this->yellow->config->setDefault("imageAlt", "Image");
$this->graphicsLibrary = $this->isGraphicsLibrary();
}
// Handle page content parsing of custom block
function onParseContentBlock($page, $name, $text, $shortcut)
{
$output = null;
if($name=="image" && $shortcut)
{
if(!$this->graphicsLibrary)
{
$this->yellow->page->error(500, "Plugin 'image' requires GD library with gif/jpg/png support!");
return $output;
}
list($name, $alt, $style, $width, $height) = $this->yellow->toolbox->getTextArgs($text);
if(!preg_match("/^\w+:/", $name))
{
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);
} else {
if(empty($alt)) $alt = $this->yellow->config->get("imageAlt");
$src = $this->yellow->lookup->normaliseUrl("", "", "", $name);
$width = $height = 0;
}
$output = "<img src=\"".htmlspecialchars($src)."\"";
if($width && $height) $output .= " width=\"".htmlspecialchars($width)."\" height=\"".htmlspecialchars($height)."\"";
if(!empty($alt)) $output .= " alt=\"".htmlspecialchars($alt)."\" title=\"".htmlspecialchars($alt)."\"";
if(!empty($style)) $output .= " class=\"".htmlspecialchars($style)."\"";
$output .= " />";
}
return $output;
}
// Handle command
function onCommand($args)
{
list($command) = $args;
switch($command)
{
case "clean": $statusCode = $this->cleanCommand($args); break;
default: $statusCode = 0;
}
return $statusCode;
}
// Handle page content parsing of custom block
public function onParseContentBlock($page, $name, $text, $shortcut) {
$output = null;
if ($name=="image" && $shortcut) {
if (!$this->graphicsLibrary) {
$this->yellow->page->error(500, "Plugin 'image' requires GD library with gif/jpg/png support!");
return $output;
}
list($name, $alt, $style, $width, $height) = $this->yellow->toolbox->getTextArgs($text);
if (!preg_match("/^\w+:/", $name)) {
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);
} else {
if (empty($alt)) $alt = $this->yellow->config->get("imageAlt");
$src = $this->yellow->lookup->normaliseUrl("", "", "", $name);
$width = $height = 0;
}
$output = "<img src=\"".htmlspecialchars($src)."\"";
if ($width && $height) $output .= " width=\"".htmlspecialchars($width)."\" height=\"".htmlspecialchars($height)."\"";
if (!empty($alt)) $output .= " alt=\"".htmlspecialchars($alt)."\" title=\"".htmlspecialchars($alt)."\"";
if (!empty($style)) $output .= " class=\"".htmlspecialchars($style)."\"";
$output .= " />";
}
return $output;
}
// Handle command
public function onCommand($args) {
list($command) = $args;
switch ($command) {
case "clean": $statusCode = $this->cleanCommand($args); break;
default: $statusCode = 0;
}
return $statusCode;
}
// Clean thumbnails
function cleanCommand($args)
{
$statusCode = 0;
list($command, $path) = $args;
if($path=="all")
{
$path = $this->yellow->config->get("imageThumbnailDir");
foreach($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", false, false) as $entry)
{
if(!$this->yellow->toolbox->deleteFile($entry)) $statusCode = 500;
}
if($statusCode==500) echo "ERROR cleaning thumbnails: Can't delete files in directory '$path'!\n";
}
return $statusCode;
}
// Clean thumbnails
public function cleanCommand($args) {
$statusCode = 0;
list($command, $path) = $args;
if ($path=="all") {
$path = $this->yellow->config->get("imageThumbnailDir");
foreach ($this->yellow->toolbox->getDirectoryEntries($path, "/.*/", false, false) as $entry) {
if (!$this->yellow->toolbox->deleteFile($entry)) $statusCode = 500;
}
if ($statusCode==500) echo "ERROR cleaning thumbnails: Can't delete files in directory '$path'!\n";
}
return $statusCode;
}
// Return image info, create thumbnail on demand
function getImageInfo($fileName, $widthOutput, $heightOutput)
{
$fileNameShort = substru($fileName, strlenu($this->yellow->config->get("imageDir")));
list($widthInput, $heightInput, $type) = $this->yellow->toolbox->detectImageInfo($fileName);
$widthOutput = $this->convertValueAndUnit($widthOutput, $widthInput);
$heightOutput = $this->convertValueAndUnit($heightOutput, $heightInput);
if(($widthInput==$widthOutput && $heightInput==$heightOutput) || $type=="svg")
{
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageLocation").$fileNameShort;
$width = $widthOutput; $height = $heightOutput;
} else {
$fileNameThumb = ltrim(str_replace(array("/", "\\", "."), "-", dirname($fileNameShort)."/".pathinfo($fileName, PATHINFO_FILENAME)), "-");
$fileNameThumb .= "-".$widthOutput."x".$heightOutput;
$fileNameThumb .= ".".pathinfo($fileName, PATHINFO_EXTENSION);
$fileNameOutput = $this->yellow->config->get("imageThumbnailDir").$fileNameThumb;
if($this->isFileNotUpdated($fileName, $fileNameOutput))
{
$image = $this->loadImage($fileName, $type);
$image = $this->resizeImage($image, $widthInput, $heightInput, $widthOutput, $heightOutput);
if(!$this->saveImage($image, $fileNameOutput, $type) ||
!$this->yellow->toolbox->modifyFile($fileNameOutput, $this->yellow->toolbox->getFileModified($fileName)))
{
$this->yellow->page->error(500, "Can't write file '$fileNameOutput'!");
}
}
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageThumbnailLocation").$fileNameThumb;
list($width, $height) = $this->yellow->toolbox->detectImageInfo($fileNameOutput);
}
return array($src, $width, $height);
}
// Return image info, create thumbnail on demand
public function getImageInfo($fileName, $widthOutput, $heightOutput) {
$fileNameShort = substru($fileName, strlenu($this->yellow->config->get("imageDir")));
list($widthInput, $heightInput, $type) = $this->yellow->toolbox->detectImageInfo($fileName);
$widthOutput = $this->convertValueAndUnit($widthOutput, $widthInput);
$heightOutput = $this->convertValueAndUnit($heightOutput, $heightInput);
if (($widthInput==$widthOutput && $heightInput==$heightOutput) || $type=="svg") {
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageLocation").$fileNameShort;
$width = $widthOutput;
$height = $heightOutput;
} else {
$fileNameThumb = ltrim(str_replace(array("/", "\\", "."), "-", dirname($fileNameShort)."/".pathinfo($fileName, PATHINFO_FILENAME)), "-");
$fileNameThumb .= "-".$widthOutput."x".$heightOutput;
$fileNameThumb .= ".".pathinfo($fileName, PATHINFO_EXTENSION);
$fileNameOutput = $this->yellow->config->get("imageThumbnailDir").$fileNameThumb;
if ($this->isFileNotUpdated($fileName, $fileNameOutput)) {
$image = $this->loadImage($fileName, $type);
$image = $this->resizeImage($image, $widthInput, $heightInput, $widthOutput, $heightOutput);
if (!$this->saveImage($image, $fileNameOutput, $type) ||
!$this->yellow->toolbox->modifyFile($fileNameOutput, $this->yellow->toolbox->getFileModified($fileName))) {
$this->yellow->page->error(500, "Can't write file '$fileNameOutput'!");
}
}
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageThumbnailLocation").$fileNameThumb;
list($width, $height) = $this->yellow->toolbox->detectImageInfo($fileNameOutput);
}
return array($src, $width, $height);
}
// Load image from file
function loadImage($fileName, $type)
{
$image = false;
switch($type)
{
case "gif": $image = @imagecreatefromgif($fileName); break;
case "jpg": $image = @imagecreatefromjpeg($fileName); break;
case "png": $image = @imagecreatefrompng($fileName); break;
}
return $image;
}
// Save image to file
function saveImage($image, $fileName, $type)
{
$ok = false;
switch($type)
{
case "gif": $ok = @imagegif($image, $fileName); break;
case "jpg": $ok = @imagejpeg($image, $fileName, $this->yellow->config->get("imageThumbnailJpgQuality")); break;
case "png": $ok = @imagepng($image, $fileName); break;
}
return $ok;
}
// Load image from file
public function loadImage($fileName, $type) {
$image = false;
switch ($type) {
case "gif": $image = @imagecreatefromgif($fileName); break;
case "jpg": $image = @imagecreatefromjpeg($fileName); break;
case "png": $image = @imagecreatefrompng($fileName); break;
}
return $image;
}
// Save image to file
public function saveImage($image, $fileName, $type) {
$ok = false;
switch ($type) {
case "gif": $ok = @imagegif($image, $fileName); break;
case "jpg": $ok = @imagejpeg($image, $fileName, $this->yellow->config->get("imageThumbnailJpgQuality")); break;
case "png": $ok = @imagepng($image, $fileName); break;
}
return $ok;
}
// Create image from scratch
function createImage($width, $height)
{
$image = imagecreatetruecolor($width, $height);
imagealphablending($image, false);
imagesavealpha($image, true);
return $image;
}
// Create image from scratch
public function createImage($width, $height) {
$image = imagecreatetruecolor($width, $height);
imagealphablending($image, false);
imagesavealpha($image, true);
return $image;
}
// Resize image
function resizeImage($image, $widthInput, $heightInput, $widthOutput, $heightOutput)
{
$widthFit = $widthInput * ($heightOutput / $heightInput);
$heightFit = $heightInput * ($widthOutput / $widthInput);
$widthDiff = abs($widthOutput - $widthFit);
$heightDiff = abs($heightOutput - $heightFit);
$imageOutput = $this->createImage($widthOutput, $heightOutput);
if($heightFit>$heightOutput)
{
imagecopyresampled($imageOutput, $image, 0, $heightDiff/-2, 0, 0, $widthOutput, $heightFit, $widthInput, $heightInput);
} else {
imagecopyresampled($imageOutput, $image, $widthDiff/-2, 0, 0, 0, $widthFit, $heightOutput, $widthInput, $heightInput);
}
return $imageOutput;
}
// Return value according to unit
function convertValueAndUnit($text, $valueBase)
{
$value = $unit = "";
if(preg_match("/([\d\.]+)(\S*)/", $text, $matches))
{
$value = $matches[1];
$unit = $matches[2];
if($unit=="%") $value = $valueBase * $value / 100;
}
return intval($value);
}
// Resize image
public function resizeImage($image, $widthInput, $heightInput, $widthOutput, $heightOutput) {
$widthFit = $widthInput * ($heightOutput / $heightInput);
$heightFit = $heightInput * ($widthOutput / $widthInput);
$widthDiff = abs($widthOutput - $widthFit);
$heightDiff = abs($heightOutput - $heightFit);
$imageOutput = $this->createImage($widthOutput, $heightOutput);
if ($heightFit>$heightOutput) {
imagecopyresampled($imageOutput, $image, 0, $heightDiff/-2, 0, 0, $widthOutput, $heightFit, $widthInput, $heightInput);
} else {
imagecopyresampled($imageOutput, $image, $widthDiff/-2, 0, 0, 0, $widthFit, $heightOutput, $widthInput, $heightInput);
}
return $imageOutput;
}
// Return value according to unit
public function convertValueAndUnit($text, $valueBase) {
$value = $unit = "";
if (preg_match("/([\d\.]+)(\S*)/", $text, $matches)) {
$value = $matches[1];
$unit = $matches[2];
if ($unit=="%") $value = $valueBase * $value / 100;
}
return intval($value);
}
// Check if file needs to be updated
function isFileNotUpdated($fileNameInput, $fileNameOutput)
{
return $this->yellow->toolbox->getFileModified($fileNameInput)!=$this->yellow->toolbox->getFileModified($fileNameOutput);
}
// Check if file needs to be updated
public function isFileNotUpdated($fileNameInput, $fileNameOutput) {
return $this->yellow->toolbox->getFileModified($fileNameInput)!=$this->yellow->toolbox->getFileModified($fileNameOutput);
}
// Check graphics library support
function isGraphicsLibrary()
{
return extension_loaded("gd") && function_exists("gd_info") &&
((imagetypes()&(IMG_GIF|IMG_JPG|IMG_PNG))==(IMG_GIF|IMG_JPG|IMG_PNG));
}
// Check graphics library support
public function isGraphicsLibrary() {
return extension_loaded("gd") && function_exists("gd_info") &&
((imagetypes()&(IMG_GIF|IMG_JPG|IMG_PNG))==(IMG_GIF|IMG_JPG|IMG_PNG));
}
}
$yellow->plugins->register("image", "YellowImage", YellowImage::VERSION);
?>

View file

@ -3,10 +3,8 @@
// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowLanguage
{
const VERSION = "0.7.13";
class YellowLanguage {
const VERSION = "0.7.13";
}
$yellow->plugins->register("language", "YellowLanguage", YellowLanguage::VERSION);
?>

View file

@ -3,23 +3,20 @@
// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowMarkdown
{
const VERSION = "0.6.8";
var $yellow; //access to API
// Handle initialisation
function onLoad($yellow)
{
$this->yellow = $yellow;
}
// Handle page content parsing of raw format
function onParseContentRaw($page, $text)
{
$markdown = new YellowMarkdownExtraParser($this->yellow, $page);
return $markdown->transform($text);
}
class YellowMarkdown {
const VERSION = "0.6.8";
public $yellow; //access to API
// Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
}
// Handle page content parsing of raw format
public function onParseContentRaw($page, $text) {
$markdown = new YellowMarkdownExtraParser($this->yellow, $page);
return $markdown->transform($text);
}
}
// PHP Markdown Lib
@ -3734,154 +3731,138 @@ class MarkdownExtraParser extends MarkdownParser {
}
}
}
// Markdown extra parser extensions
// Copyright (c) 2013-2018 Datenstrom
class YellowMarkdownExtraParser extends MarkdownExtraParser
{
var $yellow; //access to API
var $page; //access to page
var $idAttributes; //id attributes
function __construct($yellow, $page)
{
$this->yellow = $yellow;
$this->page = $page;
$this->idAttributes = array();
$this->no_markup = $page->parserSafeMode;
$this->url_filter_func = function($url) use ($yellow, $page)
{
return $yellow->lookup->normaliseLocation($url, $page->location,
$page->parserSafeMode && $page->statusCode==200);
};
parent::__construct();
}
class YellowMarkdownExtraParser extends MarkdownExtraParser {
public $yellow; //access to API
public $page; //access to page
public $idAttributes; //id attributes
// Return unique id attribute
function getIdAttribute($text)
{
$text = $this->yellow->lookup->normaliseName($text, true, false, true);
$text = trim(preg_replace("/-+/", "-", $text), "-");
if(is_null($this->idAttributes[$text]))
{
$this->idAttributes[$text] = $text;
$attr = " id=\"$text\"";
}
return $attr;
}
// Handle links
function doAutoLinks($text)
{
$text = preg_replace_callback("/<(\w+:[^\'\">\s]+)>/", array(&$this, "_doAutoLinks_url_callback"), $text);
$text = preg_replace_callback("/<([\w\-\.]+@[\w\-\.]+)>/", array(&$this, "_doAutoLinks_email_callback"), $text);
$text = preg_replace_callback("/\[\-\-(.*?)\-\-\]/", array(&$this, "_doAutoLinks_comment_callback"), $text);
$text = preg_replace_callback("/\[(\w+)(.*?)\]/", array(&$this, "_doAutoLinks_shortcut_callback"), $text);
$text = preg_replace_callback("/\:([\w\+\-\_]+)\:/", array(&$this, "_doAutoLinks_shortcode_callback"), $text);
$text = preg_replace_callback("/((http|https|ftp):\/\/\S+[^\'\"\,\.\;\:\s]+)/", array(&$this, "_doAutoLinks_url_callback"), $text);
$text = preg_replace_callback("/([\w\-\.]+@[\w\-\.]+\.[\w]{2,4})/", array(&$this, "_doAutoLinks_email_callback"), $text);
return $text;
}
// Handle comments
function _doAutoLinks_comment_callback($matches)
{
$text = $matches[1];
$output = "<!--".htmlspecialchars($text, ENT_NOQUOTES)."-->";
if($text[0]=='-') $output = "";
return $this->hashBlock($output);
}
// Handle shortcuts
function _doAutoLinks_shortcut_callback($matches)
{
$output = $this->page->parseContentBlock($matches[1], trim($matches[2]), true);
if(is_null($output)) $output = htmlspecialchars($matches[0], ENT_NOQUOTES);
return substr($output, 0, 4)=="<div" ? $this->hashBlock(trim($output)) : $this->hashPart(trim($output));
}
public function __construct($yellow, $page) {
$this->yellow = $yellow;
$this->page = $page;
$this->idAttributes = array();
$this->no_markup = $page->parserSafeMode;
$this->url_filter_func = function($url) use ($yellow, $page) {
return $yellow->lookup->normaliseLocation($url, $page->location,
$page->parserSafeMode && $page->statusCode==200);
};
parent::__construct();
}
// Handle shortcodes
function _doAutoLinks_shortcode_callback($matches)
{
$output = $this->page->parseContentBlock("", $matches[1], true);
if(is_null($output)) $output = htmlspecialchars($matches[0], ENT_NOQUOTES);
return $this->hashPart($output);
}
// Handle fenced code blocks
function _doFencedCodeBlocks_callback($matches)
{
$text = $matches[4];
$name = empty($matches[2]) ? "" : "$matches[2] $matches[3]";
$output = $this->page->parseContentBlock($name, $text, false);
if(is_null($output))
{
$attr = $this->doExtraAttributes("pre", ".$matches[2] $matches[3]");
$output = "<pre$attr><code>".htmlspecialchars($text, ENT_NOQUOTES)."</code></pre>";
}
return "\n\n".$this->hashBlock($output)."\n\n";
}
// Handle headers, text style
function _doHeaders_callback_setext($matches)
{
if($matches[3]=='-' && preg_match('{^- }', $matches[1])) return $matches[0];
$text = $matches[1];
$level = $matches[3]{0}=='=' ? 1 : 2;
$attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2]);
if(empty($attr) && $level>=2 && $level<=3) $attr = $this->getIdAttribute($text);
$output = "<h$level$attr>".$this->runSpanGamut($text)."</h$level>";
return "\n".$this->hashBlock($output)."\n\n";
}
// Handle headers, atx style
function _doHeaders_callback_atx($matches)
{
$text = $matches[2];
$level = strlen($matches[1]);
$attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3]);
if(empty($attr) && $level>=2 && $level<=3) $attr = $this->getIdAttribute($text);
$output = "<h$level$attr>".$this->runSpanGamut($text)."</h$level>";
return "\n".$this->hashBlock($output)."\n\n";
}
// Handle inline links
function _doAnchors_inline_callback($matches)
{
$url = $matches[3]=="" ? $matches[4] : $matches[3];
$text = $matches[2];
$title = $matches[7];
$attr = $this->doExtraAttributes("a", $dummy =& $matches[8]);
$output = "<a href=\"".$this->encodeURLAttribute($url)."\"";
if(!empty($title)) $output .= " title=\"".$this->encodeAttribute($title)."\"";
$output .= $attr;
$output .= ">".$this->runSpanGamut($text)."</a>";
return $this->hashPart($output);
}
// Handle inline images
function _doImages_inline_callback($matches)
{
$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);
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageLocation").$src;
}
$alt = $matches[2];
$title = $matches[7]=="" ? $matches[2] : $matches[7];
$attr = $this->doExtraAttributes("img", $dummy =& $matches[8]);
$output = "<img src=\"".$this->encodeURLAttribute($src)."\"";
if($width && $height) $output .= " width=\"$width\" height=\"$height\"";
if(!empty($alt)) $output .= " alt=\"".$this->encodeAttribute($alt)."\"";
if(!empty($title)) $output .= " title=\"".$this->encodeAttribute($title)."\"";
$output .= $attr;
$output .= $this->empty_element_suffix;
return $this->hashPart($output);
}
// Return unique id attribute
public function getIdAttribute($text) {
$text = $this->yellow->lookup->normaliseName($text, true, false, true);
$text = trim(preg_replace("/-+/", "-", $text), "-");
if (is_null($this->idAttributes[$text])) {
$this->idAttributes[$text] = $text;
$attr = " id=\"$text\"";
}
return $attr;
}
// Handle links
public function doAutoLinks($text) {
$text = preg_replace_callback("/<(\w+:[^\'\">\s]+)>/", array(&$this, "_doAutoLinks_url_callback"), $text);
$text = preg_replace_callback("/<([\w\-\.]+@[\w\-\.]+)>/", array(&$this, "_doAutoLinks_email_callback"), $text);
$text = preg_replace_callback("/\[\-\-(.*?)\-\-\]/", array(&$this, "_doAutoLinks_comment_callback"), $text);
$text = preg_replace_callback("/\[(\w+)(.*?)\]/", array(&$this, "_doAutoLinks_shortcut_callback"), $text);
$text = preg_replace_callback("/\:([\w\+\-\_]+)\:/", array(&$this, "_doAutoLinks_shortcode_callback"), $text);
$text = preg_replace_callback("/((http|https|ftp):\/\/\S+[^\'\"\,\.\;\:\s]+)/", array(&$this, "_doAutoLinks_url_callback"), $text);
$text = preg_replace_callback("/([\w\-\.]+@[\w\-\.]+\.[\w]{2,4})/", array(&$this, "_doAutoLinks_email_callback"), $text);
return $text;
}
// Handle comments
public function _doAutoLinks_comment_callback($matches) {
$text = $matches[1];
$output = "<!--".htmlspecialchars($text, ENT_NOQUOTES)."-->";
if ($text[0]=="-") $output = "";
return $this->hashBlock($output);
}
// Handle shortcuts
public function _doAutoLinks_shortcut_callback($matches) {
$output = $this->page->parseContentBlock($matches[1], trim($matches[2]), true);
if (is_null($output)) $output = htmlspecialchars($matches[0], ENT_NOQUOTES);
return substr($output, 0, 4)=="<div" ? $this->hashBlock(trim($output)) : $this->hashPart(trim($output));
}
// Handle shortcodes
public function _doAutoLinks_shortcode_callback($matches) {
$output = $this->page->parseContentBlock("", $matches[1], true);
if (is_null($output)) $output = htmlspecialchars($matches[0], ENT_NOQUOTES);
return $this->hashPart($output);
}
// Handle fenced code blocks
public function _doFencedCodeBlocks_callback($matches) {
$text = $matches[4];
$name = empty($matches[2]) ? "" : "$matches[2] $matches[3]";
$output = $this->page->parseContentBlock($name, $text, false);
if (is_null($output)) {
$attr = $this->doExtraAttributes("pre", ".$matches[2] $matches[3]");
$output = "<pre$attr><code>".htmlspecialchars($text, ENT_NOQUOTES)."</code></pre>";
}
return "\n\n".$this->hashBlock($output)."\n\n";
}
// Handle headers, text style
public function _doHeaders_callback_setext($matches) {
if ($matches[3]=="-" && preg_match('{^- }', $matches[1])) return $matches[0];
$text = $matches[1];
$level = $matches[3]{0}=="=" ? 1 : 2;
$attr = $this->doExtraAttributes("h$level", $dummy =& $matches[2]);
if (empty($attr) && $level>=2 && $level<=3) $attr = $this->getIdAttribute($text);
$output = "<h$level$attr>".$this->runSpanGamut($text)."</h$level>";
return "\n".$this->hashBlock($output)."\n\n";
}
// Handle headers, atx style
public function _doHeaders_callback_atx($matches) {
$text = $matches[2];
$level = strlen($matches[1]);
$attr = $this->doExtraAttributes("h$level", $dummy =& $matches[3]);
if (empty($attr) && $level>=2 && $level<=3) $attr = $this->getIdAttribute($text);
$output = "<h$level$attr>".$this->runSpanGamut($text)."</h$level>";
return "\n".$this->hashBlock($output)."\n\n";
}
// Handle inline links
public function _doAnchors_inline_callback($matches) {
$url = $matches[3]=="" ? $matches[4] : $matches[3];
$text = $matches[2];
$title = $matches[7];
$attr = $this->doExtraAttributes("a", $dummy =& $matches[8]);
$output = "<a href=\"".$this->encodeURLAttribute($url)."\"";
if (!empty($title)) $output .= " title=\"".$this->encodeAttribute($title)."\"";
$output .= $attr;
$output .= ">".$this->runSpanGamut($text)."</a>";
return $this->hashPart($output);
}
// Handle inline images
public function _doImages_inline_callback($matches) {
$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);
$src = $this->yellow->config->get("serverBase").$this->yellow->config->get("imageLocation").$src;
}
$alt = $matches[2];
$title = $matches[7]=="" ? $matches[2] : $matches[7];
$attr = $this->doExtraAttributes("img", $dummy =& $matches[8]);
$output = "<img src=\"".$this->encodeURLAttribute($src)."\"";
if ($width && $height) $output .= " width=\"$width\" height=\"$height\"";
if (!empty($alt)) $output .= " alt=\"".$this->encodeAttribute($alt)."\"";
if (!empty($title)) $output .= " title=\"".$this->encodeAttribute($title)."\"";
$output .= $attr;
$output .= $this->empty_element_suffix;
return $this->hashPart($output);
}
}
$yellow->plugins->register("markdown", "YellowMarkdown", YellowMarkdown::VERSION);
?>

File diff suppressed because it is too large Load diff

View file

@ -2,184 +2,542 @@
/* Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se */
/* This file may be used and distributed under the terms of the public license. */
html, body, div, form, pre, span, tr, th, td, img { margin:0; padding:0; border:0; vertical-align:baseline; }
@font-face {
font-family:'Open Sans';
font-style:normal;
font-weight:300;
src:url(opensans-light.woff) format('woff');
html, body, div, form, pre, span, tr, th, td, img {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
}
@font-face {
font-family:'Open Sans';
font-style:normal;
font-weight:400;
src:url(opensans-regular.woff) format('woff');
font-family: "Open Sans";
font-style: normal;
font-weight: 300;
src: url(opensans-light.woff) format("woff");
}
@font-face {
font-family:'Open Sans';
font-style:normal;
font-weight:700;
src:url(opensans-bold.woff) format('woff');
font-family: "Open Sans";
font-style: normal;
font-weight: 400;
src: url(opensans-regular.woff) format("woff");
}
@font-face {
font-family: "Open Sans";
font-style: normal;
font-weight: 700;
src: url(opensans-bold.woff) format("woff");
}
body {
margin:1em;
background-color:#fff; color:#717171;
font-family:'Open Sans',Helvetica,sans-serif;
font-size:1em;
font-weight:300;
line-height:1.5;
margin: 1em;
background-color: #fff;
color: #717171;
font-family: "Open Sans", Helvetica, sans-serif;
font-size: 1em;
font-weight: 300;
line-height: 1.5;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #111;
font-weight: normal;
}
h1 {
font-size: 2em;
}
hr {
height: 1px;
background: #ddd;
border: 0;
}
strong {
font-weight: bold;
}
code {
font-size: 1.1em;
}
a {
color: #07d;
text-decoration: none;
}
a:hover {
color: #07d;
text-decoration: underline;
}
/* Content */
.content h1:first-child,
.content > *:first-child {
margin-top: 0;
}
.content h1 a {
color: #111;
}
.content h1 a:hover {
color: #111;
text-decoration: none;
}
.content img {
max-width: 100%;
height: auto;
}
.content form {
margin: 1em 0;
}
.content table {
border-spacing: 0;
border-collapse: collapse;
}
.content th {
text-align: left;
padding: 0.3em;
}
.content td {
text-align: left;
padding: 0.3em;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
.content blockquote {
margin-left: 0;
padding-left: 1em;
border-left: 0.5em solid #0a0;
}
.content blockquote blockquote {
margin-left: -1.5em;
border-left: 0.5em solid #fb0;
}
.content blockquote blockquote blockquote {
border-color: #d00;
}
.content code,
.content pre {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 90%;
}
.content code {
padding: 0.15em 0.4em;
margin: 0;
background-color: #f7f7f7;
border-radius: 3px;
}
.content pre > code {
padding: 0;
margin: 0;
white-space: pre;
background: transparent;
border: 0;
font-size: inherit;
}
.content pre {
padding: 1em;
overflow: auto;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
.content .flexible {
position: relative;
padding-top: 0;
padding-bottom: 56.25%;
}
.content .flexible iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.content .stretchable ul {
margin: 0 -0.5em;
padding: 0;
list-style: none;
text-align: center;
}
.content .stretchable li {
margin: 0;
padding: 1em 0;
display: inline-block;
text-align: center;
vertical-align: top;
}
.content .stretchable a {
color: #717171;
text-decoration: none;
}
.content .task-list-item {
list-style-type: none;
}
.content .task-list-item input {
margin: 0 0.2em 0.25em -1.75em;
vertical-align: middle;
}
.content .toc {
margin: 0;
padding: 0;
list-style: none;
}
.content .entry-links .previous {
margin-right: 1em;
}
.content .pagination .previous {
margin-right: 1em;
}
.content .pagination {
margin: 1em 0;
}
.content .left {
float: left;
margin: 0 1em 0 0;
}
.content .center {
display: block;
margin: 0 auto;
}
.content .right {
float: right;
margin: 0 0 0 1em;
}
.content .rounded {
border-radius: 4px;
}
h1, h2, h3, h4, h5, h6 { color:#111; font-weight:normal; }
h1 { font-size:2.0em; }
hr { height:1px; background:#ddd; border:0; }
strong { font-weight:bold; }
code { font-size:1.1em; }
a { color:#07d; text-decoration:none; }
a:hover { color:#07d; text-decoration:underline; }
.content h1:first-child, .content>*:first-child { margin-top:0; }
.content h1 a { color:#111; }
.content h1 a:hover { color:#111; text-decoration:none; }
.content img { max-width:100%; height:auto; }
.content form { margin:1em 0; }
.content table { border-spacing:0; border-collapse:collapse; }
.content th { text-align:left; padding:0.3em; }
.content td { text-align:left; padding:0.3em; border-top:1px solid #ddd; border-bottom:1px solid #ddd; }
.content blockquote { margin-left:0; padding-left:1em; border-left:.5em solid #0a0; }
.content blockquote blockquote { margin-left:-1.5em; border-left:.5em solid #fb0; }
.content blockquote blockquote blockquote { border-color:#d00; }
.content code, pre { font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace; font-size:90%; }
.content code { padding:0.15em 0.4em; margin:0; background-color:#f7f7f7; border-radius:3px; }
.content pre>code { padding:0; margin:0; white-space:pre; background:transparent; border:0; font-size:inherit; }
.content pre { padding:1em; overflow:auto; line-height:1.45; background-color:#f7f7f7; border-radius:3px; }
.content .flexible { position:relative; padding-top:0; padding-bottom:56.25%; }
.content .flexible iframe { position:absolute; top:0; left:0; width:100%; height:100%; }
.content .stretchable ul { margin:0 -0.5em; padding:0; list-style:none; text-align:center; }
.content .stretchable li { margin:0; padding:1em 0; display:inline-block; text-align:center; vertical-align:top; }
.content .stretchable a { color:#717171; text-decoration:none; }
.content .task-list-item { list-style-type:none; }
.content .task-list-item input { margin:0 0.2em 0.25em -1.75em; vertical-align:middle; }
.content .toc { margin:0; padding:0; list-style:none; }
.content .entry-links .previous { margin-right:1em; }
.content .pagination .previous { margin-right:1em; }
.content .pagination { margin:1em 0; }
.content .left { float:left; margin:0 1em 0 0; }
.content .center { display:block; margin:0 auto; }
.content .right { float:right; margin:0 0 0 1em; }
.content .rounded { border-radius:4px; }
/* Header */
.header .sitename { display:block; float:left; }
.header .sitename h1 { margin:0; }
.header .sitename h1 a { color:#111; text-decoration:none; }
.header .sitename h2 { margin-top:0; color:#717171; font-size:1.0em; font-weight:300; }
.header .sitename {
display: block;
float: left;
}
.header .sitename h1 {
margin: 0;
}
.header .sitename h1 a {
color: #111;
text-decoration: none;
}
.header .sitename h2 {
margin-top: 0;
color: #717171;
font-size: 1em;
font-weight: 300;
}
/* Navigation */
.navigation { display:block; float:right; }
.navigation { margin-top:0.9em; margin-bottom:0.9em; line-height:2; }
.navigation a { padding:0 0.3em; }
.navigation ul { margin:0 -0.3em; padding:0; list-style:none; }
.navigation li { display:inline; }
.navigation-tree { display:block; float:right; }
.navigation-tree { margin-top:0.9em; margin-bottom:0.9em; line-height:2; }
.navigation-tree a { padding:0 0.3em; }
.navigation-tree ul { margin:0 -0.3em; padding:0; list-style:none; }
.navigation-tree li { display:inline; }
.navigation-tree ul li { display:inline-block; position:relative; cursor:pointer; margin:0; }
.navigation-tree ul li ul { padding:0.3em; position:absolute; width:13em; background:#fff; z-index:100; display:none; }
.navigation-tree ul li ul { border:1px solid #bbb; border-radius:4px; box-shadow:2px 4px 10px rgba(0, 0, 0, 0.2); }
.navigation-tree ul li ul li { display:block; }
.navigation-tree>ul>li:hover>ul { display:block; }
.navigation-banner { clear:both; }
.navigation-search { padding-bottom:1em; }
.navigation-search .search-form { position:relative; }
.navigation-search .search-text { font-family:inherit; font-size:inherit; font-weight:inherit; }
.navigation-search .search-text { padding:0.5em; border:1px solid #bbb; border-radius:4px; width:100%; box-sizing:border-box; }
.navigation-search .search-text { background-color:#fff; background-image:linear-gradient(to bottom, #fff, #fff); }
.navigation-search .search-button { position:absolute; top:0; right:0; }
.navigation-search .search-button { font-family:inherit; font-size:inherit; font-weight:inherit; }
.navigation-search .search-button { margin:5px; padding:0.3em; border:none; background-color:transparent; }
.navigation {
display: block;
float: right;
}
.navigation {
margin-top: 0.9em;
margin-bottom: 0.9em;
line-height: 2;
}
.navigation a {
padding: 0 0.3em;
}
.navigation ul {
margin: 0 -0.3em;
padding: 0;
list-style: none;
}
.navigation li {
display: inline;
}
.navigation-tree {
display: block;
float: right;
}
.navigation-tree {
margin-top: 0.9em;
margin-bottom: 0.9em;
line-height: 2;
}
.navigation-tree a {
padding: 0 0.3em;
}
.navigation-tree ul {
margin: 0 -0.3em;
padding: 0;
list-style: none;
}
.navigation-tree li {
display: inline;
}
.navigation-tree ul li {
display: inline-block;
position: relative;
cursor: pointer;
margin: 0;
}
.navigation-tree ul li ul {
padding: 0.3em;
position: absolute;
width: 13em;
background: #fff;
z-index: 100;
display: none;
}
.navigation-tree ul li ul {
border: 1px solid #bbb;
border-radius: 4px;
box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.2);
}
.navigation-tree ul li ul li {
display: block;
}
.navigation-tree > ul > li:hover > ul {
display: block;
}
.navigation-banner {
clear: both;
}
.navigation-search {
padding-bottom: 1em;
}
.navigation-search .search-form {
position: relative;
}
.navigation-search .search-text {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
}
.navigation-search .search-text {
padding: 0.5em;
border: 1px solid #bbb;
border-radius: 4px;
width: 100%;
box-sizing: border-box;
}
.navigation-search .search-text {
background-color: #fff;
background-image: linear-gradient(to bottom, #fff, #fff);
}
.navigation-search .search-button {
position: absolute;
top: 0;
right: 0;
}
.navigation-search .search-button {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
}
.navigation-search .search-button {
margin: 5px;
padding: 0.3em;
border: none;
background-color: transparent;
}
/* Footer */
.footer { margin-top:2em; }
.footer .siteinfo a { color:#07d; }
.footer .siteinfo a:hover { color:#07d; text-decoration:underline; }
.footer .siteinfo a.language img { vertical-align:middle; margin-top:-5px; margin-right:0.75em; }
.footer .siteinfo-left { float:left; }
.footer .siteinfo-right { float:right; }
.footer .siteinfo-banner { clear:both; }
.footer {
margin-top: 2em;
}
.footer .siteinfo a {
color: #07d;
}
.footer .siteinfo a:hover {
color: #07d;
text-decoration: underline;
}
.footer .siteinfo a.language img {
vertical-align: middle;
margin-top: -5px;
margin-right: 0.75em;
}
.footer .siteinfo-left {
float: left;
}
.footer .siteinfo-right {
float: right;
}
.footer .siteinfo-banner {
clear: both;
}
/* Sidebar */
.with-sidebar .main { margin-right:15em; }
.with-sidebar .sidebar { float:right; width:13em; margin-top:3.2em; padding:2px; overflow:hidden; text-align:right; }
.with-sidebar .sidebar ul { padding:0; list-style:none; }
.with-sidebar .sidebar .search-form input { width:100%; box-sizing:border-box; }
.with-sidebar .content:after { content:""; display:table; clear:both; }
.with-sidebar .main {
margin-right: 15em;
}
.with-sidebar .sidebar {
float: right;
width: 13em;
margin-top: 3.2em;
padding: 2px;
overflow: hidden;
text-align: right;
}
.with-sidebar .sidebar ul {
padding: 0;
list-style: none;
}
.with-sidebar .sidebar .search-form input {
width: 100%;
box-sizing: border-box;
}
.with-sidebar .content:after {
content: "";
display: table;
clear: both;
}
/* Forms and buttons */
.form-control {
margin:0; padding:2px 4px;
display:inline-block; min-width:7em;
background-color:#fff; color:#555;
background-image:linear-gradient(to bottom, #fff, #fff);
border:1px solid #bbb;
border-radius:4px;
font-size:0.9em; font-family:inherit; font-weight:normal; line-height:normal;
margin: 0;
padding: 2px 4px;
display: inline-block;
min-width: 7em;
background-color: #fff;
color: #555;
background-image: linear-gradient(to bottom, #fff, #fff);
border: 1px solid #bbb;
border-radius: 4px;
font-size: 0.9em;
font-family: inherit;
font-weight: normal;
line-height: normal;
}
.btn {
margin:0; padding:4px 22px;
display:inline-block; min-width:7em;
background-color:#eaeaea; color:#333333;
background-image:linear-gradient(to bottom, #f8f8f8, #e1e1e1);
border:1px solid #bbb;
border-color:#c1c1c1 #c1c1c1 #aaaaaa;
border-radius:4px;
outline-offset:-2px;
font-size:0.9em; font-family:inherit; font-weight:normal; line-height:1;
text-align:center; text-decoration:none;
box-sizing:border-box;
margin: 0;
padding: 4px 22px;
display: inline-block;
min-width: 7em;
background-color: #eaeaea;
color: #333333;
background-image: linear-gradient(to bottom, #f8f8f8, #e1e1e1);
border: 1px solid #bbb;
border-color: #c1c1c1 #c1c1c1 #aaaaaa;
border-radius: 4px;
outline-offset: -2px;
font-size: 0.9em;
font-family: inherit;
font-weight: normal;
line-height: 1;
text-align: center;
text-decoration: none;
box-sizing: border-box;
}
.btn:hover, .btn:focus, .btn:active {
color:#333333;
background-image:none;
text-decoration:none;
.btn:hover,
.btn:focus,
.btn:active {
color: #333333;
background-image: none;
text-decoration: none;
}
.btn:active {
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.btn:active { box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.1); }
/* Misc */
.template-default .content img.screenshot { margin:0 -0.5em; }
.template-language .content div.language { font-size:1.2em; text-align:left; width:9em; margin:0 auto; }
.template-language .content div.language p { margin:1.5em 0em; }
.template-language .content div.language img { vertical-align:middle; margin-top:-5px; margin-right:1.5em; }
.hljs-meta, .hljs-keyword, .hljs-literal { color:#b0b; }
.hljs-attr, .hljs-attribute, .hljs-selector-id, .hljs-selector-class, .hljs-selector-pseudo { color:#b0b; }
.hljs-type, .hljs-built_in, .hljs-builtin-name, .hljs-params { color:#b0b; }
.hljs-string { color:#717171; }
.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-number { color:#717171; }
.template-default .content img.screenshot {
margin: 0 -0.5em;
}
.template-language .content div.language {
font-size: 1.2em;
text-align: left;
width: 9em;
margin: 0 auto;
}
.template-language .content div.language p {
margin: 1.5em 0em;
}
.template-language .content div.language img {
vertical-align: middle;
margin-top: -5px;
margin-right: 1.5em;
}
.hljs-meta,
.hljs-keyword,
.hljs-literal {
color: #b0b;
}
.hljs-attr,
.hljs-attribute,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-pseudo {
color: #b0b;
}
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-params {
color: #b0b;
}
.hljs-string {
color: #717171;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-number {
color: #717171;
}
/* Responsive and print */
.page { margin:0 auto; max-width:1000px; }
@media screen and (min-width:62em) {
body { width:60em; margin:1em auto; }
.page{ margin:0; max-width:none; }
.page {
margin: 0 auto;
max-width: 1000px;
}
@media screen and (max-width:32em) {
body { margin:0.5em; font-size:0.9em; }
.header .sitename h1, .content h1, .content h2 { font-size:1.3em; }
.header .sitename h1, .header .sitename h2, .footer, .page { margin:0; padding:0; }
.header .sitename, .navigation, .navigation-tree { float:none; }
.navigation { margin-top:0.5em; margin-bottom:0.5em; }
.navigation-search { padding-bottom:1em; }
.with-sidebar .main { margin-right:0; }
.with-sidebar .sidebar { display:none; }
@media screen and (min-width: 62em) {
body {
width: 60em;
margin: 1em auto;
}
.page {
margin: 0;
max-width: none;
}
}
@media screen and (max-width: 32em) {
body {
margin: 0.5em;
font-size: 0.9em;
}
.header .sitename h1,
.content h1,
.content h2 {
font-size: 1.3em;
}
.header .sitename h1,
.header .sitename h2,
.footer,
.page {
margin: 0;
padding: 0;
}
.header .sitename,
.navigation,
.navigation-tree {
float: none;
}
.navigation {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.navigation-search {
padding-bottom: 1em;
}
.with-sidebar .main {
margin-right: 0;
}
.with-sidebar .sidebar {
display: none;
}
}
@media print {
.page { border:none !important; }
.page {
border: none !important;
}
}

View file

@ -3,10 +3,8 @@
// Copyright (c) 2013-2018 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowThemeFlatsite
{
const VERSION = "0.7.6";
class YellowThemeFlatsite {
const VERSION = "0.7.6";
}
$yellow->themes->register("flatsite", "YellowThemeFlatsite", YellowThemeFlatsite::VERSION);
?>