Bug fixes, developer area, google plugin updated, rss and sitemap updated
This commit is contained in:
parent
19d6ab347b
commit
1f5dd3ac99
|
@ -11,6 +11,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-draft,
|
.label-draft,
|
||||||
|
.label-fixed,
|
||||||
|
.label-sticky,
|
||||||
.label-empty-title,
|
.label-empty-title,
|
||||||
.label-time {
|
.label-time {
|
||||||
background: #A979D1 none repeat scroll 0 0;
|
background: #A979D1 none repeat scroll 0 0;
|
||||||
|
@ -24,6 +26,10 @@
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label-fixed {
|
||||||
|
background: #7BD179;
|
||||||
|
}
|
||||||
|
|
||||||
.label-empty-title {
|
.label-empty-title {
|
||||||
background: #53D192;
|
background: #53D192;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,13 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
|
||||||
'name'=>'status',
|
'name'=>'status',
|
||||||
'label'=>$L->g('Status'),
|
'label'=>$L->g('Status'),
|
||||||
'class'=>'uk-width-1-1 uk-form-medium',
|
'class'=>'uk-width-1-1 uk-form-medium',
|
||||||
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
|
'options'=>array(
|
||||||
'selected'=>($page->draft()?'draft':'published'),
|
'published'=>$L->g('Published'),
|
||||||
|
'draft'=>$L->g('Draft'),
|
||||||
|
'fixed'=>$L->g('Fixed'),
|
||||||
|
'sticky'=>$L->g('Sticky')
|
||||||
|
),
|
||||||
|
'selected'=>$page->status(),
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,12 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
|
||||||
'name'=>'status',
|
'name'=>'status',
|
||||||
'label'=>$L->g('Status'),
|
'label'=>$L->g('Status'),
|
||||||
'class'=>'uk-width-1-1 uk-form-medium',
|
'class'=>'uk-width-1-1 uk-form-medium',
|
||||||
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
|
'options'=>array(
|
||||||
|
'published'=>$L->g('Published'),
|
||||||
|
'draft'=>$L->g('Draft'),
|
||||||
|
'fixed'=>$L->g('Fixed'),
|
||||||
|
'sticky'=>$L->g('Sticky')
|
||||||
|
),
|
||||||
'selected'=>'published',
|
'selected'=>'published',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
|
@ -22,14 +22,11 @@ echo '
|
||||||
|
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
$status = false;
|
$status = false;
|
||||||
if($page->scheduled()) {
|
if($page->status()!='published') {
|
||||||
$status = $Language->g('Scheduled');
|
$status = $Language->g( $page->status() );
|
||||||
}
|
|
||||||
elseif(!$page->published()) {
|
|
||||||
$status = $Language->g('Draft');
|
|
||||||
}
|
}
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'.($status?'<span class="label-draft">'.$status.'</span>':'').($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a></td>';
|
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$page->key().'">'.($status?'<span class="label-'.$page->status().'">'.$status.'</span>':'').($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a></td>';
|
||||||
|
|
||||||
echo '<td class="uk-text-center">'.( (ORDER_BY=='date') ? $page->dateRaw() : $page->position() ).'</td>';
|
echo '<td class="uk-text-center">'.( (ORDER_BY=='date') ? $page->dateRaw() : $page->position() ).'</td>';
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,18 @@ class dbPages extends dbJSON
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// (array) Returns a database with the fixed pages
|
||||||
|
public function getFixedDB()
|
||||||
|
{
|
||||||
|
$tmp = $this->db;
|
||||||
|
foreach($tmp as $key=>$fields) {
|
||||||
|
if($fields['status']!='fixed') {
|
||||||
|
unset($tmp[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a database with drafts pages
|
// Returns a database with drafts pages
|
||||||
public function getDraftDB()
|
public function getDraftDB()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,8 @@ class dbUsers extends dbJSON
|
||||||
'registered'=> array('inFile'=>false, 'value'=>'1985-03-15 10:00'),
|
'registered'=> array('inFile'=>false, 'value'=>'1985-03-15 10:00'),
|
||||||
'tokenEmail'=> array('inFile'=>false, 'value'=>''),
|
'tokenEmail'=> array('inFile'=>false, 'value'=>''),
|
||||||
'tokenEmailTTL'=> array('inFile'=>false, 'value'=>'2009-03-15 14:00'),
|
'tokenEmailTTL'=> array('inFile'=>false, 'value'=>'2009-03-15 14:00'),
|
||||||
|
'tokenAuth'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'tokenAuthTTL'=> array('inFile'=>false, 'value'=>'2009-03-15 14:00'),
|
||||||
'twitter'=> array('inFile'=>false, 'value'=>''),
|
'twitter'=> array('inFile'=>false, 'value'=>''),
|
||||||
'facebook'=> array('inFile'=>false, 'value'=>''),
|
'facebook'=> array('inFile'=>false, 'value'=>''),
|
||||||
'googlePlus'=> array('inFile'=>false, 'value'=>''),
|
'googlePlus'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
@ -72,6 +74,17 @@ class dbUsers extends dbJSON
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the username with the authentication token assigned, FALSE otherwise
|
||||||
|
public function getByAuthToken($token)
|
||||||
|
{
|
||||||
|
foreach($this->db as $username=>$fields) {
|
||||||
|
if($fields['tokenAuth']==$token) {
|
||||||
|
return $username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Return TRUE if the user exists, FALSE otherwise.
|
// Return TRUE if the user exists, FALSE otherwise.
|
||||||
public function userExists($username)
|
public function userExists($username)
|
||||||
{
|
{
|
||||||
|
|
|
@ -353,6 +353,22 @@ class Page {
|
||||||
return ($this->getValue('status')=='draft');
|
return ($this->getValue('status')=='draft');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sticky()
|
||||||
|
{
|
||||||
|
return ($this->getValue('status')=='sticky');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fixed()
|
||||||
|
{
|
||||||
|
return ($this->getValue('status')=='fixed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// (string) Returns status of the page
|
||||||
|
public function status()
|
||||||
|
{
|
||||||
|
return $this->getValue('status');
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the title field
|
// Returns the title field
|
||||||
public function title()
|
public function title()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,14 +4,12 @@ class pluginAPI extends Plugin {
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
global $Security;
|
// Generate the API Token
|
||||||
|
$token = md5( uniqid().time().DOMAIN );
|
||||||
// This key is used for request such as get the list of all posts and pages
|
|
||||||
$token = md5($Security->key1().time().DOMAIN);
|
|
||||||
|
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'ping'=>0, // 0 = false, 1 = true
|
'ping'=>0, // 0 = false, 1 = true
|
||||||
'token'=>$token, // Private key
|
'token'=>$token, // API Token
|
||||||
'showAllAmount'=>15, // Amount of posts and pages for return
|
'showAllAmount'=>15, // Amount of posts and pages for return
|
||||||
'authentication'=>1 // Authentication required
|
'authentication'=>1 // Authentication required
|
||||||
);
|
);
|
||||||
|
@ -56,9 +54,11 @@ class pluginAPI extends Plugin {
|
||||||
public function beforeRulesLoad()
|
public function beforeRulesLoad()
|
||||||
{
|
{
|
||||||
global $Url;
|
global $Url;
|
||||||
global $dbPosts;
|
|
||||||
global $dbPages;
|
global $dbPages;
|
||||||
|
global $dbUsers;
|
||||||
|
|
||||||
|
// CHECK URL
|
||||||
|
// ------------------------------------------------------------
|
||||||
// Check if the URI start with /api/
|
// Check if the URI start with /api/
|
||||||
$startString = HTML_PATH_ROOT.'api/';
|
$startString = HTML_PATH_ROOT.'api/';
|
||||||
$URI = $Url->uri();
|
$URI = $Url->uri();
|
||||||
|
@ -70,72 +70,46 @@ class pluginAPI extends Plugin {
|
||||||
// Remove the first part of the URI
|
// Remove the first part of the URI
|
||||||
$URI = mb_substr($URI, $length);
|
$URI = mb_substr($URI, $length);
|
||||||
|
|
||||||
// METHODS
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
// GET
|
|
||||||
// POST
|
|
||||||
// PUT
|
|
||||||
// DELETE
|
|
||||||
|
|
||||||
$method = $_SERVER['REQUEST_METHOD'];
|
|
||||||
|
|
||||||
// INPUTS
|
// INPUTS
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// token | authentication token
|
$inputs = $this->getInputs();
|
||||||
|
|
||||||
$inputs = json_decode(file_get_contents('php://input'),true);
|
|
||||||
|
|
||||||
if( empty($inputs) ) {
|
|
||||||
// Default variables for $input
|
|
||||||
$inputs = array(
|
|
||||||
'token'=>''
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Sanitize inputs
|
|
||||||
foreach( $inputs as $key=>$value ) {
|
|
||||||
if(empty($value)) {
|
|
||||||
$this->response(array(
|
|
||||||
'status'=>'1',
|
|
||||||
'message'=>'Invalid input.'
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
$inputs[$key] = Sanitize::html($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PARAMETERS
|
// PARAMETERS
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// /api/posts | GET | returns all posts
|
$parameters = $this->getParameters($URI);
|
||||||
// /api/posts/{key} | GET | returns the post with the {key}
|
|
||||||
// /api/pages | GET | returns all pages
|
|
||||||
// /api/pages/{key} | GET | returns the page with the {key}
|
|
||||||
// /api/cli/regenerate | POST | check for new posts and pages
|
|
||||||
|
|
||||||
$parameters = explode('/', $URI);
|
// API TOKEN
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
$tokenAPI = $this->getValue('token');
|
||||||
|
|
||||||
// Sanitize parameters
|
// Check empty token
|
||||||
foreach( $parameters as $key=>$value ) {
|
if( empty($inputs['token']) ) {
|
||||||
if(empty($value)) {
|
$this->response(array(
|
||||||
$this->response(array(
|
'status'=>'1',
|
||||||
'status'=>'1',
|
'message'=>'Missing API token.'
|
||||||
'message'=>'Invalid parameter.'
|
));
|
||||||
));
|
}
|
||||||
} else {
|
|
||||||
$parameters[$key] = Sanitize::html($value);
|
// Check the token is valid
|
||||||
|
if( $inputs['token']!=$tokenAPI ) {
|
||||||
|
$this->response(array(
|
||||||
|
'status'=>'1',
|
||||||
|
'message'=>'Invalid API token.'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// AUTHENTICATION TOKEN
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
$writePermissions = false;
|
||||||
|
if( !empty($inputs['authentication']) ) {
|
||||||
|
// Get the user with the authentication token
|
||||||
|
$username = $dbUsers->getByAuthToken($inputs['authentication']);
|
||||||
|
if( $username!==false ) {
|
||||||
|
// Enable write permissions
|
||||||
|
$writePermissions = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check authentication
|
|
||||||
if( $this->getDbField('authentication')==1 ) {
|
|
||||||
if( $inputs['token']!=$this->getDbField('token') ) {
|
|
||||||
$this->response(array(
|
|
||||||
'status'=>'1',
|
|
||||||
'message'=>'Invalid token.'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /api/posts
|
// /api/posts
|
||||||
if( ($method==='GET') && ($parameters[0]==='posts') && empty($parameters[1]) ) {
|
if( ($method==='GET') && ($parameters[0]==='posts') && empty($parameters[1]) ) {
|
||||||
|
@ -175,13 +149,68 @@ class pluginAPI extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTIONS
|
// PRIVATE METHODS
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
private function getParameters($URI)
|
||||||
|
{
|
||||||
|
// PARAMETERS
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// /api/pages | GET | returns all pages
|
||||||
|
// /api/pages/{key} | GET | returns the page with the {key}
|
||||||
|
// /api/cli/regenerate | POST | check for new posts and pages
|
||||||
|
|
||||||
|
$parameters = explode('/', $URI);
|
||||||
|
|
||||||
|
// Sanitize parameters
|
||||||
|
foreach($parameters as $key=>$value) {
|
||||||
|
$parameters[$key] = Sanitize::html($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getInputs()
|
||||||
|
{
|
||||||
|
// METHODS
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// GET
|
||||||
|
// POST
|
||||||
|
// PUT
|
||||||
|
// DELETE
|
||||||
|
|
||||||
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
|
switch($method) {
|
||||||
|
case "POST":
|
||||||
|
$inputs = $_POST;
|
||||||
|
break;
|
||||||
|
case "GET":
|
||||||
|
case "DELETE":
|
||||||
|
$inputs = $_GET;
|
||||||
|
break;
|
||||||
|
case "PUT":
|
||||||
|
$inputs = file_get_contents("php://input");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$inputs = json_encode(array());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input data need to be JSON
|
||||||
|
$inputs = json_decode(file_get_contents('php://input'),true);
|
||||||
|
|
||||||
|
// Sanitize inputs
|
||||||
|
foreach($inputs as $key=>$value) {
|
||||||
|
$inputs[$key] = Sanitize::html($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $inputs;
|
||||||
|
}
|
||||||
|
|
||||||
private function response($data=array())
|
private function response($data=array())
|
||||||
{
|
{
|
||||||
$json = json_encode($data);
|
$json = json_encode($data);
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
exit($json);
|
exit($json);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
{
|
{
|
||||||
"plugin-data":
|
"plugin-data":
|
||||||
{
|
{
|
||||||
"name": "Fixed Pages",
|
"name": "Fixed pages",
|
||||||
"description": "Show a list of links."
|
"description": "Shows a list of pages, you can define the amount of items and the order depends of settings."
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"home-page": "Home page",
|
||||||
|
"show-home-link": "Show home link",
|
||||||
|
"amount-of-items": "Amount of items"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,140 +4,33 @@ class pluginFixedPages extends Plugin {
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
// JSON database
|
|
||||||
$jsondb = json_encode(array(
|
|
||||||
'about'=>'About'
|
|
||||||
));
|
|
||||||
|
|
||||||
// Fields and default values for the database of this plugin
|
// Fields and default values for the database of this plugin
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'label'=>'Fixed Pages',
|
'label'=>'Fixed Pages',
|
||||||
'jsondb'=>$jsondb
|
'homeLink'=>true
|
||||||
);
|
);
|
||||||
|
|
||||||
// Disable default Save and Cancel button
|
|
||||||
$this->formButtons = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method called when a POST request is sent
|
// Method called on the settings of the plugin on the admin area
|
||||||
public function post()
|
|
||||||
{
|
|
||||||
global $dbPages;
|
|
||||||
|
|
||||||
// Get current jsondb value from database
|
|
||||||
// All data stored in the database is html encoded
|
|
||||||
$jsondb = $this->db['jsondb'];
|
|
||||||
$jsondb = Sanitize::htmlDecode($jsondb);
|
|
||||||
|
|
||||||
// Convert JSON to Array
|
|
||||||
$pagesFixed = json_decode($jsondb, true);
|
|
||||||
|
|
||||||
// Check if the user click on the button delete or add
|
|
||||||
if( isset($_POST['delete']) ) {
|
|
||||||
// Values from $_POST
|
|
||||||
$pageKey = $_POST['delete'];
|
|
||||||
|
|
||||||
// Change the status of the page from fixed to published
|
|
||||||
$dbPages->setStatus($pageKey, 'published');
|
|
||||||
|
|
||||||
// Delete the link from the array
|
|
||||||
unset($pagesFixed[$pageKey]);
|
|
||||||
}
|
|
||||||
elseif( isset($_POST['add']) ) {
|
|
||||||
// Values from $_POST
|
|
||||||
$pageTitle = $_POST['newPageTitle'];
|
|
||||||
$pageKey = $_POST['newPageKey'];
|
|
||||||
|
|
||||||
// Change the status of the page from fixed to published
|
|
||||||
$dbPages->setStatus($pageKey, 'fixed');
|
|
||||||
|
|
||||||
// Add the link
|
|
||||||
$pagesFixed[$pageKey] = $pageTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encode html to store the values on the database
|
|
||||||
$this->db['label'] = Sanitize::html($_POST['label']);
|
|
||||||
$this->db['jsondb'] = Sanitize::html(json_encode($pagesFixed));
|
|
||||||
|
|
||||||
// Save the database
|
|
||||||
return $this->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Method called on plugin settings on the admin area
|
|
||||||
public function form()
|
public function form()
|
||||||
{
|
{
|
||||||
global $Language;
|
global $Language;
|
||||||
global $dbPages;
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
foreach($dbPages->db as $key=>$fields) {
|
|
||||||
$page = buildPage($key);
|
|
||||||
if($page->published()) {
|
|
||||||
$options[$key] = $page->title();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$html = '<div>';
|
$html = '<div>';
|
||||||
$html .= '<label>'.$Language->get('Label').'</label>';
|
$html .= '<label>'.$Language->get('Label').'</label>';
|
||||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
||||||
$html .= '<span class="tip">'.$Language->get('Title of the plugin for the sidebar').'</span>';
|
$html .= '<span class="tip">'.$Language->get('Title of the plugin for the sidebar').'</span>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
$html .= '<div>';
|
$html .= '<div>';
|
||||||
$html .= '<button name="save" class="blue" type="submit">Save</button>';
|
$html .= '<label>'.$Language->get('Home link').'</label>';
|
||||||
$html .= '</div>';
|
$html .= '<select name="homeLink">';
|
||||||
|
$html .= '<option value="true" '.($this->getValue('showCero')?'checked':'').'>Enabled</option>';
|
||||||
// NEW PAGE
|
$html .= '<option value="false" '.($this->getValue('showCero')?'checked':'').'>Disabled</option>';
|
||||||
$html .= '<legend>'.$Language->get('New fixed page').'</legend>';
|
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label>'.$Language->get('Title').'</label>';
|
|
||||||
$html .= '<input name="newPageTitle" type="text" value="">';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label>'.$Language->get('Page').'</label>';
|
|
||||||
$html .= '<select name="newPageKey">';
|
|
||||||
foreach($options as $key=>$title) {
|
|
||||||
$html .= '<option value="'.$key.'">'.$title.'</option>';
|
|
||||||
}
|
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
|
$html .= '<span class="tip">'.$Language->get('Show the home link on the sidebar').'</span>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<button name="add" class="blue" type="submit">Add</button>';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
// LIST OF PAGES
|
|
||||||
$html .= '<legend>'.$Language->get('Fixed pages').'</legend>';
|
|
||||||
|
|
||||||
$jsondb = $this->getValue('jsondb', $unsanitized=false);
|
|
||||||
$pagesFixed = json_decode($jsondb, true);
|
|
||||||
foreach($pagesFixed as $pageKey=>$pageTitle) {
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label>'.$Language->get('Title').'</label>';
|
|
||||||
$html .= '<input type="text" value="'.$pageTitle.'" disabled>';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
$page = buildPage($pageKey);
|
|
||||||
if($page) {
|
|
||||||
$title = $page->title();
|
|
||||||
} else {
|
|
||||||
$title = $Language->get('Error page deleted');
|
|
||||||
}
|
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<label>'.$Language->get('Page linked').'</label>';
|
|
||||||
$html .= '<input type="text" value="'.$title.'" disabled>';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
$html .= '<div>';
|
|
||||||
$html .= '<button name="delete" type="submit" value="'.$pageKey.'">Delete</button>';
|
|
||||||
$html .= '</div>';
|
|
||||||
|
|
||||||
$html .= '</br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +38,11 @@ class pluginFixedPages extends Plugin {
|
||||||
public function siteSidebar()
|
public function siteSidebar()
|
||||||
{
|
{
|
||||||
global $Language;
|
global $Language;
|
||||||
|
global $Url;
|
||||||
|
global $Site;
|
||||||
|
global $dbPages;
|
||||||
|
|
||||||
|
$pages = $dbPages->getFixedDB();
|
||||||
|
|
||||||
// HTML for sidebar
|
// HTML for sidebar
|
||||||
$html = '<div class="plugin plugin-pages">';
|
$html = '<div class="plugin plugin-pages">';
|
||||||
|
@ -152,15 +50,23 @@ class pluginFixedPages extends Plugin {
|
||||||
$html .= '<div class="plugin-content">';
|
$html .= '<div class="plugin-content">';
|
||||||
$html .= '<ul>';
|
$html .= '<ul>';
|
||||||
|
|
||||||
// Get the JSON DB, getValue() with the option unsanitized HTML code
|
// Show Home page link
|
||||||
$jsondb = $this->getValue('jsondb', false);
|
if( $this->getValue('homeLink') ) {
|
||||||
$pagesFixed = json_decode($jsondb);
|
|
||||||
|
|
||||||
// By default the database of categories are alphanumeric sorted
|
|
||||||
foreach($pagesFixed as $key=>$title) {
|
|
||||||
$html .= '<li>';
|
$html .= '<li>';
|
||||||
$html .= '<a href="'.DOMAIN_PAGES.$key.'">';
|
$html .= '<a href="'.$Site->url().'">';
|
||||||
$html .= $title;
|
$html .= $Language->get('Home page');
|
||||||
|
$html .= '</a>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get keys of pages
|
||||||
|
$keys = array_keys($pages);
|
||||||
|
foreach($keys as $pageKey) {
|
||||||
|
// Create the page object from the page key
|
||||||
|
$page = buildPage($pageKey);
|
||||||
|
$html .= '<li>';
|
||||||
|
$html .= '<a href="'.$page->permalink().'">';
|
||||||
|
$html .= $page->title();
|
||||||
$html .= '</a>';
|
$html .= '</a>';
|
||||||
$html .= '</li>';
|
$html .= '</li>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ class pluginOpenGraph extends Plugin {
|
||||||
'siteName' =>$Site->title()
|
'siteName' =>$Site->title()
|
||||||
);
|
);
|
||||||
|
|
||||||
switch($WHERE_AM_I)
|
switch($WHERE_AM_I) {
|
||||||
{
|
|
||||||
// The user filter by page
|
// The user filter by page
|
||||||
case 'page':
|
case 'page':
|
||||||
$og['type'] = 'article';
|
$og['type'] = 'article';
|
||||||
|
@ -56,6 +55,7 @@ class pluginOpenGraph extends Plugin {
|
||||||
|
|
||||||
// The user is in the homepage
|
// The user is in the homepage
|
||||||
default:
|
default:
|
||||||
|
$content = '';
|
||||||
// The image it's from the first page
|
// The image it's from the first page
|
||||||
if(isset($pages[0]) ) {
|
if(isset($pages[0]) ) {
|
||||||
$og['image'] = $pages[0]->coverImage($absolute=true);
|
$og['image'] = $pages[0]->coverImage($absolute=true);
|
||||||
|
|
Loading…
Reference in New Issue