New plugins and plugins updated for v2.0

This commit is contained in:
Diego Najar 2017-05-29 23:56:07 +02:00
parent 7d51652efc
commit 0d783359fa
22 changed files with 126 additions and 224 deletions

View File

@ -174,7 +174,7 @@ class dbSite extends dbJSON
}
// Returns the full domain and base url
// For example, https://www.domain.com/bludit/
// For example, https://www.domain.com/bludit
public function url()
{
return $this->getField('url');

View File

@ -1,10 +0,0 @@
{
"plugin-data":
{
"name": "Последни публикации",
"description": "Показва най-новите публикации."
},
"amount-of-posts": "Брой последни публикации",
"show-home-link": "Покажи връзка за начало"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Neueste Beiträge",
"description": "Anzeige der neuesten Beiträge."
},
"amount-of-posts": "Anzahl der Beiträge"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Neueste Beiträge",
"description": "Anzeige der neuesten Beiträge."
},
"amount-of-posts": "Anzahl der Beiträge"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Latest posts",
"description": "Shows the latest posts published."
},
"amount-of-posts": "Amount of posts"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Últimas entradas",
"description": "Muestra las últimas entradas publicadas."
},
"amount-of-posts": "Cantidad de entradas"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Últimas entradas",
"description": "Muestra las últimas entradas publicadas."
},
"amount-of-posts": "Cantidad de entradas"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Últimas entradas",
"description": "Muestra las últimas entradas publicadas."
},
"amount-of-posts": "Cantidad de entradas"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Latest posts",
"description": "公開された最近の投稿を表示します。"
},
"amount-of-posts": "投稿表示数"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Laatste posts",
"description": "Laat de laatste gepubliceerde posts zien."
},
"amount-of-posts": "Amount of posts"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Последние записи",
"description": "Показывает последние опубликованные записи."
},
"amount-of-posts": "Количество записей"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Son yazılar",
"description": "En son yayınlana yazıları gösterir."
},
"amount-of-posts": "Yazı sayısı"
}

View File

@ -1,9 +0,0 @@
{
"plugin-data":
{
"name": "Останні публікації",
"description": "Показує останні опубліковані публікації."
},
"amount-of-posts": "Кількість публікацій"
}

View File

@ -1,59 +0,0 @@
<?php
class pluginLatestPosts extends Plugin {
public function init()
{
$this->dbFields = array(
'label'=>'Latest posts',
'amount'=>5
);
}
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Plugin label').'</label>';
$html .= '<input name="label" id="jslabel" type="text" value="'.$this->getDbField('label').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Amount of posts').'</label>';
$html .= '<input name="amount" id="jsamount" type="text" value="'.$this->getDbField('amount').'">';
$html .= '</div>';
return $html;
}
public function siteSidebar()
{
// This function is declared in 70.posts.php
$posts = buildPostsForPage(0, $this->getDbField('amount'), true, false);
$html = '<div class="plugin plugin-latest-posts">';
// Print the label if not empty.
$label = $this->getDbField('label');
if( !empty($label) ) {
$html .= '<h2 class="plugin-title">'.$label.'</h2>';
}
$html .= '<div class="plugin-content">';
$html .= '<ul>';
foreach($posts as $Post)
{
$html .= '<li>';
$html .= '<a href="'.$Post->permalink().'">'.$Post->title().'</a>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}

View File

@ -0,0 +1,7 @@
{
"plugin-data":
{
"name": "Links",
"description": "Show a list of links."
}
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "1.5.2",
"releaseDate": "2016-05-28",
"version": "2.0",
"releaseDate": "2017-05-26",
"license": "MIT",
"compatible": "1.5.2",
"compatible": "2.0",
"notes": ""
}
}

View File

@ -0,0 +1,62 @@
<?php
class pluginLinks extends Plugin {
public function init()
{
$jsondb = json_encode(array(
'Bludit'=>'https://bludit.com',
'Donate'=>'https://paypal.me/bludit'
));
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Links',
'jsondb'=>$jsondb
);
}
// Method called on plugin settings on the admin area
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '</div>';
return $html;
}
// Method called on the sidebar of the website
public function siteSidebar()
{
global $Language;
// HTML for sidebar
$html = '<div class="plugin plugin-pages">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= '<ul>';
// Get the JSON DB, getValue() with the option unsanitized HTML code
$jsondb = $this->getValue('jsondb', false);
$links = json_decode($jsondb);
// By default the database of categories are alphanumeric sorted
foreach( $links as $name=>$url ) {
$html .= '<li>';
$html .= '<a href="'.$url.'">';
$html .= $name;
$html .= '</a>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "1.5.2",
"releaseDate": "2016-05-28",
"version": "2.0",
"releaseDate": "2017-05-26",
"license": "MIT",
"compatible": "1.5.2",
"compatible": "2.0",
"notes": ""
}
}

View File

@ -11,8 +11,7 @@ class pluginOpenGraph extends Plugin {
$images = $finder->query("//img");
if($images->length>0)
{
if($images->length>0) {
// First image from the list
$image = $images->item(0);
// Get value from attribute src
@ -26,8 +25,10 @@ class pluginOpenGraph extends Plugin {
public function siteHead()
{
global $Url, $Site;
global $Post, $Page, $posts;
global $Url;
global $Site;
global $WHERE_AM_I;
global $pages;
$og = array(
'locale' =>$Site->locale(),
@ -39,36 +40,25 @@ class pluginOpenGraph extends Plugin {
'siteName' =>$Site->title()
);
switch($Url->whereAmI())
switch($WHERE_AM_I)
{
// The user filter by post
case 'post':
$og['type'] = 'article';
$og['title'] = $Post->title().' | '.$og['title'];
$og['description'] = $Post->description();
$og['url'] = $Post->permalink(true);
$og['image'] = $Post->coverImage(false);
$content = $Post->content();
break;
// The user filter by page
case 'page':
$og['type'] = 'article';
$og['title'] = $Page->title().' | '.$og['title'];
$og['title'] = $Page->title();
$og['description'] = $Page->description();
$og['url'] = $Page->permalink(true);
$og['image'] = $Page->coverImage(false);
$og['url'] = $Page->permalink($absolute=true);
$og['image'] = $Page->coverImage($absolute=true);
$content = $Page->content();
break;
// The user is in the homepage
default:
// The image it's from the first post
if(isset($posts[0])) {
$og['image'] = $posts[0]->coverImage(false);
$content = $posts[0]->content();
// The image it's from the first page
if(isset($pages[0]) ) {
$og['image'] = $pages[0]->coverImage($absolute=true);
$content = $pages[0]->content();
}
break;
}
@ -81,19 +71,16 @@ class pluginOpenGraph extends Plugin {
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
$html .= '<meta property="og:siteName" content="'.$og['siteName'].'">'.PHP_EOL;
// If the post o page doesn't have a coverImage try to get an image from the HTML content
if($og['image']===false) {
// If the page doesn't have a coverImage try to get an image from the HTML content
if( empty($og['image']) ) {
// Get the image from the content
$src = $this->getImage( $content );
$src = $this->getImage($content);
if($src!==false) {
$html .= '<meta property="og:image" content="'.DOMAIN.$src.'">'.PHP_EOL;
$og['image'] = DOMAIN.$src;
}
}
else {
$html .= '<meta property="og:image" content="'.DOMAIN_UPLOADS.$og['image'].'">'.PHP_EOL;
}
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
return $html;
}

View File

@ -1,11 +1,11 @@
{
"plugin-data":
{
"name": "Page list",
"description": "Shows the list of pages in order."
"name": "Pages",
"description": "Shows a list of pages, you can define the amount of items and the order depends of settings."
},
"home": "Home",
"home-page": "Home page",
"show-home-link": "Show home link",
"show-children": "Show children"
"amount-of-items": "Amount of items"
}

View File

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "1.5.2",
"releaseDate": "2016-05-28",
"version": "2.0",
"releaseDate": "2017-05-26",
"license": "MIT",
"compatible": "1.5.2",
"compatible": "2.0",
"notes": ""
}
}

View File

@ -8,7 +8,7 @@ class pluginPages extends Plugin {
$this->dbFields = array(
'label'=>'Pages',
'homeLink'=>true,
'children'=>true
'amountOfItems'=>5
);
}
@ -23,15 +23,14 @@ class pluginPages extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="homeLink" value="0">';
$html .= '<input id="jshomeLink" name="homeLink" type="checkbox" value="true" '.($this->getValue('homeLink')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
$html .= '<label>'.$Language->get('Amount of items').'</label>';
$html .= '<input id="jsamountOfItems" name="amountOfItems" type="text" value="'.$this->getValue('amountOfItems').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="children" value="0">';
$html .= '<input id="jschildren" name="children" type="checkbox" value="true" '.($this->getValue('children')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jschildren">'.$Language->get('Show children').'</label>';
$html .= '<input type="hidden" name="homeLink" value="false">';
$html .= '<input id="jshomeLink" name="homeLink" type="checkbox" value="true" '.($this->getValue('homeLink')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
$html .= '</div>';
return $html;
@ -47,12 +46,27 @@ class pluginPages extends Plugin {
// URL base filter for categories
$filter = $Url->filters('page');
// Amount of pages to show
$amountOfItems = $this->getValue('amountOfItems');
// Slice array of pages
$pages = array_slice($pages, 0, $amountOfItems);
// HTML for sidebar
$html = '<div class="plugin plugin-pages">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<div class="plugin-content">';
$html .= '<ul>';
// Show Home page link
if( $this->getValue('homeLink') ) {
$html .= '<li>';
$html .= '<a href="'.DOMAIN_BASE.'">';
$html .= $Language->get('Home page');
$html .= '</a>';
$html .= '</li>';
}
// By default the database of categories are alphanumeric sorted
foreach( $pages as $page ) {
$html .= '<li>';