Tinymce changes on plugins, Dom Helper, changes on Clean Blog Theme

This commit is contained in:
Diego Najar 2017-10-13 23:38:24 +02:00
parent 48d5c94dd1
commit 0ebee8526a
12 changed files with 65 additions and 11 deletions

View File

@ -199,6 +199,7 @@ include(PATH_HELPERS.'alert.class.php');
include(PATH_HELPERS.'paginator.class.php');
include(PATH_HELPERS.'image.class.php');
include(PATH_HELPERS.'tcp.class.php');
include(PATH_HELPERS.'dom.class.php');
if (file_exists(PATH_KERNEL.'bludit.pro.php')) {
include(PATH_KERNEL.'bludit.pro.php');

View File

@ -122,6 +122,10 @@ elseif ($Url->whereAmI()==='home') {
buildPagesForHome();
}
if (isset($pages[0])) {
$page = $Page = $pages[0];
}
// Set page 404 not found
if ($Url->notFound()) {
$pageNotFoundKey = $Site->pageNotFound();

View File

@ -0,0 +1,25 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class DOM {
public static function getFirstImage($content)
{
$dom = new DOMDocument();
$dom->loadHTML('<meta http-equiv="content-type" content="text/html; charset=utf-8">'.$content);
$finder = new DomXPath($dom);
$images = $finder->query("//img");
if($images->length>0) {
// First image from the list
$image = $images->item(0);
// Get value from attribute src
$imgSrc = $image->getAttribute('src');
// Returns the image src
return $imgSrc;
}
return false;
}
}

View File

@ -89,7 +89,7 @@ class pluginLinks extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<button name="addLink" class="blue" type="submit">Add</button>';
$html .= '<button name="addLink" class="blue" type="submit">'.$Language->get('Add').'</button>';
$html .= '</div>';
$html .= '<legend>'.$Language->get('Links').'</legend>';

View File

@ -2,7 +2,8 @@
"plugin-data":
{
"name": "RSS Feed",
"description": "This plugin generates an RSS feed of your site. The feed has the URL http://mydomain.com/rss.xml."
"description": "This plugin generates an RSS feed of your site.<br>The feed has the URL https://example.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Amount of items to show on the feed."
"amount-of-items-to-show-on-the-feed": "Amount of items to show on the feed.",
"rss-url": "RSS URL"
}

View File

@ -2,7 +2,8 @@
"plugin-data":
{
"name": "RSS Feed",
"description": "Este plugin genera contenido dinamico en formato RSS de tu sitio."
"description": "Este plugin genera contenido dinamico en formato RSS de tu sitio.<br>El plugin genera la URL https://example.com/rss.xml"
},
"amount-of-items-to-show-on-the-feed": "Cantidad de artículos para mostrar."
"amount-of-items-to-show-on-the-feed": "Cantidad de artículos para mostrar.",
"rss-url": "URL del RSS"
}

View File

@ -16,6 +16,11 @@ class pluginRSS extends Plugin {
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('RSS URL').'</label>';
$html .= '<a href="'.Theme::rssUrl().'">'.Theme::rssUrl().'</a>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Amount of items').'</label>';
$html .= '<input id="jsamountOfItems" name="amountOfItems" type="text" value="'.$this->getValue('amountOfItems').'">';
$html .= '<span class="tip">'.$Language->get('Amount of items to show on the feed').'</span>';

View File

@ -43,7 +43,7 @@ class pluginTinymce extends Plugin {
paste_as_text: true,
document_base_url: "'.DOMAIN_UPLOADS.'",
plugins: [
"autosave fullpage",
"autosave",
"searchreplace autolink directionality",
"visualblocks visualchars",
"fullscreen image link media template",

View File

@ -0,0 +1,16 @@
<?php
/*
This file is loaded before the theme
You can add some configuration code in this file
*/
// Background image
$backgroundImage = 'https://source.unsplash.com/1600x900/?nature';
if ($page->coverImage()===false) {
$domImage = DOM::getFirstImage($page->content($fullContent=true));
if ($domImage!==false) {
$backgroundImage = $domImage;
}
} else {
$backgroundImage = $page->coverImage($absolute=true);
}

View File

@ -3,5 +3,6 @@
{
"name": "Clean Blog",
"description": "Clean blog is a carefully styled Bootstrap blog theme that is perfect for personal or company blogs. This theme features four HTML pages including a blog index, an about page, a sample post, and a contact page."
}
},
"posted-by": "Posted by"
}

View File

@ -1,5 +1,5 @@
<!-- Page Header -->
<header class="masthead" style="background-image: url('https://source.unsplash.com/1600x900/?nature')">
<header class="masthead" style="background-image: url('<?php echo $backgroundImage ?>')">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
@ -27,7 +27,7 @@
<h2 class="post-title"><?php echo $page->title() ?></h2>
<h3 class="post-subtitle"><?php echo $page->description() ?></h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on September 18, 2017</p>
<p class="post-meta"><?php echo $Language->get('Posted by').' '.$page->user('username').' - '.$page->date() ?></p>
</div>
<hr>

View File

@ -1,12 +1,12 @@
<!-- Page Header -->
<header class="masthead" style="background-image: url('img/post-bg.jpg')">
<header class="masthead" style="background-image: url('<?php echo $backgroundImage ?>')">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="post-heading">
<h1><?php echo $page->title() ?></h1>
<h2 class="subheading"><?php echo $page->description() ?></h2>
<span class="meta">Posted by <a href="#">Start Bootstrap</a> on August 24, 2017</span>
<p class="meta"><?php echo $Language->get('Posted by').' '.$page->user('username').' - '.$page->date() ?></p>
</div>
</div>
</div>