Enable API when the user login, starting new default theme for Bludit v4 Popeye
This commit is contained in:
parent
1c5992477f
commit
930dd9a01b
17 changed files with 372 additions and 85 deletions
|
@ -25,7 +25,7 @@ checkRole(array('admin'));
|
||||||
activatePlugin('pluginAPI');
|
activatePlugin('pluginAPI');
|
||||||
$apiURL = DOMAIN_BASE.'api/';
|
$apiURL = DOMAIN_BASE.'api/';
|
||||||
$pluginAPI = getPlugin('pluginAPI');
|
$pluginAPI = getPlugin('pluginAPI');
|
||||||
$apiToken = $pluginAPI->getToken();
|
$apiToken = $pluginAPI->token();
|
||||||
$username = $login->username();
|
$username = $login->username();
|
||||||
$admin = new User($username);
|
$admin = new User($username);
|
||||||
$authToken = $admin->tokenAuth();
|
$authToken = $admin->tokenAuth();
|
||||||
|
|
7
bl-kernel/admin/themes/booty/init.php
Normal file
7
bl-kernel/admin/themes/booty/init.php
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
|
// Init scripts for the theme
|
||||||
|
|
||||||
|
// This theme use the API to work
|
||||||
|
activatePlugin('pluginAPI');
|
||||||
|
$plugins['all']['pluginAPI']->newToken();
|
|
@ -82,6 +82,88 @@ class HTML {
|
||||||
return '<script '.$attributes.' src="'.DOMAIN_CORE_VENDORS.'bootstrap-html5sortable/jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
return '<script '.$attributes.' src="'.DOMAIN_CORE_VENDORS.'bootstrap-html5sortable/jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generates a dynamiclly the meta tag title for the themes === Bludit v4
|
||||||
|
|
||||||
|
@return string Returns the meta tag title <title>...</title>
|
||||||
|
*/
|
||||||
|
public static function metaTagTitle()
|
||||||
|
{
|
||||||
|
global $url;
|
||||||
|
global $site;
|
||||||
|
global $page;
|
||||||
|
global $WHERE_AM_I;
|
||||||
|
|
||||||
|
if ($WHERE_AM_I=='page') {
|
||||||
|
$format = $site->titleFormatPages();
|
||||||
|
$format = Text::replace('{{page-title}}', $page->title(), $format);
|
||||||
|
$format = Text::replace('{{page-description}}', $page->description(), $format);
|
||||||
|
} elseif ($WHERE_AM_I=='tag') {
|
||||||
|
try {
|
||||||
|
$tagKey = $url->slug();
|
||||||
|
$tag = new Tag($tagKey);
|
||||||
|
$format = $site->titleFormatTag();
|
||||||
|
$format = Text::replace('{{tag-name}}', $tag->name(), $format);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Tag doesn't exist
|
||||||
|
}
|
||||||
|
} elseif ($WHERE_AM_I=='category') {
|
||||||
|
try {
|
||||||
|
$categoryKey = $url->slug();
|
||||||
|
$category = new Category($categoryKey);
|
||||||
|
$format = $site->titleFormatCategory();
|
||||||
|
$format = Text::replace('{{category-name}}', $category->name(), $format);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Category doesn't exist
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$format = $site->titleFormatHomepage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$format = Text::replace('{{site-title}}', $site->title(), $format);
|
||||||
|
$format = Text::replace('{{site-slogan}}', $site->slogan(), $format);
|
||||||
|
$format = Text::replace('{{site-description}}', $site->description(), $format);
|
||||||
|
|
||||||
|
return '<title>'.$format.'</title>'.PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generates a dynamiclly the meta tag description for the themes === Bludit v4
|
||||||
|
|
||||||
|
@return string Returns the meta tag title <meta name="description" content="">
|
||||||
|
*/
|
||||||
|
public static function metaTagDescription()
|
||||||
|
{
|
||||||
|
global $site;
|
||||||
|
global $page;
|
||||||
|
global $url;
|
||||||
|
global $WHERE_AM_I;
|
||||||
|
|
||||||
|
$description = $site->description();
|
||||||
|
|
||||||
|
if ($WHERE_AM_I=='page') {
|
||||||
|
$description = $page->description();
|
||||||
|
} elseif ($WHERE_AM_I=='category') {
|
||||||
|
try {
|
||||||
|
$categoryKey = $url->slug();
|
||||||
|
$category = new Category($categoryKey);
|
||||||
|
$description = $category->description();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// description from the site
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<meta name="description" content="'.$description.'">'.PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns the short version of the current languages of the site === Bludit v4
|
||||||
|
|
||||||
|
@return string Returns the language sort version, for example: "en" or "de"
|
||||||
|
*/
|
||||||
|
public static function lang()
|
||||||
|
{
|
||||||
|
global $language;
|
||||||
|
return $language->currentLanguageShortVersion();
|
||||||
|
}
|
||||||
|
|
||||||
// --- CHECK OLD
|
// --- CHECK OLD
|
||||||
|
|
||||||
public static function charset($charset)
|
public static function charset($charset)
|
||||||
|
@ -147,12 +229,6 @@ class HTML {
|
||||||
return $site->footer();
|
return $site->footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function lang()
|
|
||||||
{
|
|
||||||
global $language;
|
|
||||||
return $language->currentLanguageShortVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function rssUrl()
|
public static function rssUrl()
|
||||||
{
|
{
|
||||||
if (pluginActivated('pluginRSS')) {
|
if (pluginActivated('pluginRSS')) {
|
||||||
|
@ -194,72 +270,9 @@ class HTML {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function metaTagTitle()
|
|
||||||
{
|
|
||||||
global $url;
|
|
||||||
global $site;
|
|
||||||
global $tags;
|
|
||||||
global $categories;
|
|
||||||
global $WHERE_AM_I;
|
|
||||||
global $page;
|
|
||||||
|
|
||||||
if ($WHERE_AM_I=='page') {
|
|
||||||
$format = $site->titleFormatPages();
|
|
||||||
$format = Text::replace('{{page-title}}', $page->title(), $format);
|
|
||||||
$format = Text::replace('{{page-description}}', $page->description(), $format);
|
|
||||||
} elseif ($WHERE_AM_I=='tag') {
|
|
||||||
try {
|
|
||||||
$tagKey = $url->slug();
|
|
||||||
$tag = new Tag($tagKey);
|
|
||||||
$format = $site->titleFormatTag();
|
|
||||||
$format = Text::replace('{{tag-name}}', $tag->name(), $format);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// Tag doesn't exist
|
|
||||||
}
|
|
||||||
|
|
||||||
} elseif ($WHERE_AM_I=='category') {
|
|
||||||
try {
|
|
||||||
$categoryKey = $url->slug();
|
|
||||||
$category = new Category($categoryKey);
|
|
||||||
$format = $site->titleFormatCategory();
|
|
||||||
$format = Text::replace('{{category-name}}', $category->name(), $format);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// Category doesn't exist
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$format = $site->titleFormatHomepage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$format = Text::replace('{{site-title}}', $site->title(), $format);
|
|
||||||
$format = Text::replace('{{site-slogan}}', $site->slogan(), $format);
|
|
||||||
$format = Text::replace('{{site-description}}', $site->description(), $format);
|
|
||||||
|
|
||||||
return '<title>'.$format.'</title>'.PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function metaTagDescription()
|
|
||||||
{
|
|
||||||
global $site;
|
|
||||||
global $WHERE_AM_I;
|
|
||||||
global $page;
|
|
||||||
global $url;
|
|
||||||
|
|
||||||
$description = $site->description();
|
|
||||||
|
|
||||||
if ($WHERE_AM_I=='page') {
|
|
||||||
$description = $page->description();
|
|
||||||
} elseif ($WHERE_AM_I=='category') {
|
|
||||||
try {
|
|
||||||
$categoryKey = $url->slug();
|
|
||||||
$category = new Category($categoryKey);
|
|
||||||
$description = $category->description();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// description from the site
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<meta name="description" content="'.$description.'">'.PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
class API {
|
class API {
|
||||||
|
|
||||||
constructor(apiURL, apiToken, apiAuth) {
|
constructor(apiURL, apiToken, apiAuth) {
|
||||||
this.apiURL = "http://localhost:8000/api/";
|
this.apiURL = apiURL;
|
||||||
this.body = {
|
this.body = {
|
||||||
token: '45643a4071fad6a12261bb0763550feb',
|
token: apiToken,
|
||||||
authentication: '02707c99183896203b41d4a9b5c42692'
|
authentication: apiAuth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ echo 'var tokenCSRF = "'.$security->getTokenCSRF().'";'.PHP_EOL;
|
||||||
echo 'var UPLOAD_MAX_FILESIZE = '.Text::toBytes( ini_get('upload_max_filesize') ).';'.PHP_EOL;
|
echo 'var UPLOAD_MAX_FILESIZE = '.Text::toBytes( ini_get('upload_max_filesize') ).';'.PHP_EOL;
|
||||||
echo 'var DEBUG_MODE = '.(DEBUG_MODE?'true':'false').';'.PHP_EOL;
|
echo 'var DEBUG_MODE = '.(DEBUG_MODE?'true':'false').';'.PHP_EOL;
|
||||||
echo 'var PASSWORD_LENGTH = '.PASSWORD_LENGTH.';'.PHP_EOL;
|
echo 'var PASSWORD_LENGTH = '.PASSWORD_LENGTH.';'.PHP_EOL;
|
||||||
echo 'var api = new API("", "", "", tokenCSRF);'.PHP_EOL;
|
echo 'var api = new API("'.DOMAIN.'/api/", "'.$plugins['all']['pluginAPI']->token().'", "'.$login->tokenAuth().'", tokenCSRF);'.PHP_EOL;
|
||||||
echo '</script>'.PHP_EOL;
|
echo '</script>'.PHP_EOL;
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -18,18 +18,24 @@ class Login {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the username of the user logged
|
// Returns the username
|
||||||
public function username()
|
public function username()
|
||||||
{
|
{
|
||||||
return Session::get('username');
|
return Session::get('username');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the role of the user logged
|
// Returns the role
|
||||||
public function role()
|
public function role()
|
||||||
{
|
{
|
||||||
return Session::get('role');
|
return Session::get('role');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the authentication token
|
||||||
|
public function tokenAuth()
|
||||||
|
{
|
||||||
|
return Session::get('tokenAuth');
|
||||||
|
}
|
||||||
|
|
||||||
// Returns TRUE if the user is logged, FALSE otherwise
|
// Returns TRUE if the user is logged, FALSE otherwise
|
||||||
public function isLogged()
|
public function isLogged()
|
||||||
{
|
{
|
||||||
|
@ -49,10 +55,11 @@ class Login {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the session for the user logged
|
// Set the session for the user logged
|
||||||
public function setLogin($username, $role)
|
public function setLogin($username, $role, $tokenAuth)
|
||||||
{
|
{
|
||||||
Session::set('username', $username);
|
Session::set('username', $username);
|
||||||
Session::set('role', $role);
|
Session::set('role', $role);
|
||||||
|
Session::set('tokenAuth', $tokenAuth);
|
||||||
Session::set('fingerPrint', $this->fingerPrint());
|
Session::set('fingerPrint', $this->fingerPrint());
|
||||||
Session::set('sessionTime', time());
|
Session::set('sessionTime', time());
|
||||||
|
|
||||||
|
@ -112,7 +119,7 @@ class Login {
|
||||||
|
|
||||||
$passwordHash = $this->users->generatePasswordHash($password, $user->salt());
|
$passwordHash = $this->users->generatePasswordHash($password, $user->salt());
|
||||||
if ($passwordHash===$user->password()) {
|
if ($passwordHash===$user->password()) {
|
||||||
$this->setLogin($username, $user->role());
|
$this->setLogin($username, $user->role(), $user->tokenAuth());
|
||||||
Log::set(__METHOD__.LOG_SEP.'Successful user login by username and password - Username ['.$username.']');
|
Log::set(__METHOD__.LOG_SEP.'Successful user login by username and password - Username ['.$username.']');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +158,7 @@ class Login {
|
||||||
|
|
||||||
// Get user from database and login
|
// Get user from database and login
|
||||||
$user = $this->users->getUserDB($username);
|
$user = $this->users->getUserDB($username);
|
||||||
$this->setLogin($username, $user['role']);
|
$this->setLogin($username, $user['role'], $user->tokenAuth());
|
||||||
Log::set(__METHOD__.LOG_SEP.'User authenticated via Remember Me.');
|
Log::set(__METHOD__.LOG_SEP.'User authenticated via Remember Me.');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,9 +600,13 @@ class Page {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array with all pages key related to the page
|
/* Returns an array with all pages key related to the page === Bludit v4
|
||||||
// The relation is based on the tags
|
The relation is based on the tags.
|
||||||
public function related() {
|
|
||||||
|
@sortByDate boolean TRUE if you want to get sort by date the pages, FALSE random order
|
||||||
|
@return array Returns an array with the page keys related to page
|
||||||
|
*/
|
||||||
|
public function related($sortByDate=false) {
|
||||||
global $tags;
|
global $tags;
|
||||||
$pageTags = $this->tags(true);
|
$pageTags = $this->tags(true);
|
||||||
$list = array();
|
$list = array();
|
||||||
|
@ -620,6 +624,19 @@ class Page {
|
||||||
unset($list[$key]);
|
unset($list[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort by date if requested
|
||||||
|
if ($sortByDate) {
|
||||||
|
$listSortByDate = array();
|
||||||
|
foreach ($list as $pageKey) {
|
||||||
|
$tmpPage = new Page($pageKey);
|
||||||
|
$listSortByDate[$tmpPage->date('U')] = new Page($pageKey);
|
||||||
|
}
|
||||||
|
krsort($listSortByDate);
|
||||||
|
return $listSortByDate;
|
||||||
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ class pluginAPI extends Plugin {
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
// Generate the API Token
|
// Generate the API Token
|
||||||
$token = md5( uniqid().time().DOMAIN );
|
$token = $this->generateToken();
|
||||||
|
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'token'=>$token, // API Token
|
'token'=>$token, // API Token
|
||||||
|
@ -15,11 +15,22 @@ class pluginAPI extends Plugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToken()
|
public function generateToken()
|
||||||
|
{
|
||||||
|
return md5( uniqid().time().DOMAIN );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function token()
|
||||||
{
|
{
|
||||||
return $this->getValue('token');
|
return $this->getValue('token');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newToken()
|
||||||
|
{
|
||||||
|
$this->db['token'] = $this->generateToken();
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
public function form()
|
public function form()
|
||||||
{
|
{
|
||||||
global $L;
|
global $L;
|
||||||
|
@ -116,7 +127,7 @@ class pluginAPI extends Plugin {
|
||||||
if (($user->role()=='admin') && ($user->enabled())) {
|
if (($user->role()=='admin') && ($user->enabled())) {
|
||||||
// Loggin the user to create the session
|
// Loggin the user to create the session
|
||||||
$login = new Login();
|
$login = new Login();
|
||||||
$login->setLogin($username, 'admin');
|
$login->setLogin($username, 'admin', $user->tokenAuth());
|
||||||
// Enable write permissions
|
// Enable write permissions
|
||||||
$writePermissions = true;
|
$writePermissions = true;
|
||||||
}
|
}
|
||||||
|
|
14
bl-themes/popeye/css/style.css
Executable file
14
bl-themes/popeye/css/style.css
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
/* VIDEO EMBED RESPONSIVE */
|
||||||
|
.video-embed {
|
||||||
|
overflow:hidden;
|
||||||
|
padding-bottom: 56.25%; /* 16:9 */
|
||||||
|
position:relative;
|
||||||
|
height:0;
|
||||||
|
}
|
||||||
|
.video-embed iframe{
|
||||||
|
left:0;
|
||||||
|
top:0;
|
||||||
|
height:100%;
|
||||||
|
width:100%;
|
||||||
|
position:absolute;
|
||||||
|
}
|
BIN
bl-themes/popeye/img/favicon.png
Normal file
BIN
bl-themes/popeye/img/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
66
bl-themes/popeye/index.php
Executable file
66
bl-themes/popeye/index.php
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="<?php echo HTML::lang() ?>">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="generator" content="Bludit">
|
||||||
|
|
||||||
|
<!-- Generate <title>...</title> -->
|
||||||
|
<?php echo HTML::metaTagTitle(); ?>
|
||||||
|
|
||||||
|
<!-- Generate <meta name="description" content="..."> -->
|
||||||
|
<?php echo HTML::metaTagDescription(); ?>
|
||||||
|
|
||||||
|
<!-- Generate <link rel="icon" href="..."> -->
|
||||||
|
<?php echo HTML::favicon('img/favicon.png'); ?>
|
||||||
|
|
||||||
|
<!-- Include CSS Bootstrap file from Bludit Core -->
|
||||||
|
<?php echo HTML::cssBootstrap(); ?>
|
||||||
|
|
||||||
|
<!-- Include CSS Styles from this theme -->
|
||||||
|
<?php echo HTML::css('css/style.css'); ?>
|
||||||
|
|
||||||
|
<!-- Execute Bludit plugins for the hook "Site head" -->
|
||||||
|
<?php execPluginsByHook('siteHead'); ?>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Execute Bludit plugins for the hook "Site body begin" -->
|
||||||
|
<?php execPluginsByHook('siteBodyBegin'); ?>
|
||||||
|
|
||||||
|
<!-- Navbar -->
|
||||||
|
<?php include(THEME_DIR_PHP.'navbar.php'); ?>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<?php
|
||||||
|
// $WHERE_AM_I variable provides where the user is browsing
|
||||||
|
// If the user is watching a particular page the variable takes the value "page"
|
||||||
|
// If the user is watching the frontpage the variable takes the value "home"
|
||||||
|
// If the user is watching a particular category the variable takes the value "category"
|
||||||
|
if ($WHERE_AM_I == 'page') {
|
||||||
|
// Check if the page has a template
|
||||||
|
$template = $page->template();
|
||||||
|
if (($template) && file_exists(THEME_DIR_TEMPLATES.$template)) {
|
||||||
|
include(THEME_DIR_TEMPLATES.$template);
|
||||||
|
} else {
|
||||||
|
include(THEME_DIR_PHP.'page.php');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
include(THEME_DIR_PHP.'home.php');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<?php include(THEME_DIR_PHP.'footer.php'); ?>
|
||||||
|
|
||||||
|
<!-- Include Jquery file from Bludit Core -->
|
||||||
|
<?php echo HTML::jquery(); ?>
|
||||||
|
|
||||||
|
<!-- Include javascript Bootstrap file from Bludit Core -->
|
||||||
|
<?php echo HTML::jsBootstrap(); ?>
|
||||||
|
|
||||||
|
<!-- Execute Bludit plugins for the hook "Site body end" -->
|
||||||
|
<?php execPluginsByHook('siteBodyEnd'); ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
7
bl-themes/popeye/languages/en.json
Normal file
7
bl-themes/popeye/languages/en.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"theme-data":
|
||||||
|
{
|
||||||
|
"name": "Popeye",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
10
bl-themes/popeye/metadata.json
Normal file
10
bl-themes/popeye/metadata.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"author": "Bludit",
|
||||||
|
"email": "",
|
||||||
|
"website": "https://themes.bludit.com",
|
||||||
|
"version": "4.0",
|
||||||
|
"releaseDate": "2020-07-28",
|
||||||
|
"license": "MIT",
|
||||||
|
"compatible": "4.0",
|
||||||
|
"notes": ""
|
||||||
|
}
|
5
bl-themes/popeye/php/footer.php
Normal file
5
bl-themes/popeye/php/footer.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<footer class="footer bg-dark">
|
||||||
|
<div class="container">
|
||||||
|
<p class="m-0 text-center text-white text-uppercase"><?php echo $site->footer(); ?><span class="ms-5 text-warning">Powered by<img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/><a target="_blank" class="text-white" href="https://www.bludit.com">Bludit</a></span></p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
92
bl-themes/popeye/php/home.php
Normal file
92
bl-themes/popeye/php/home.php
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<!-- Site logo and description -->
|
||||||
|
<header class="bg-light p-3">
|
||||||
|
<div class="container text-center">
|
||||||
|
|
||||||
|
<div class="site-logo">
|
||||||
|
<img class="img-thumbnail rounded mx-auto d-block" height="150px" width="150px" src="<?php echo $site->logo() ?>" alt="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($site->description()) : ?>
|
||||||
|
<div class="site-description mt-2">
|
||||||
|
<p><?php echo $site->description(); ?></p>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<?php if (empty($content)) : ?>
|
||||||
|
<div class="text-center p-4">
|
||||||
|
<?php $language->p('No pages found') ?>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<!-- Print all the content -->
|
||||||
|
<section class="mt-4 mb-4">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 mx-auto">
|
||||||
|
<!-- Search input -->
|
||||||
|
<form class="d-flex mb-4">
|
||||||
|
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
||||||
|
<button class="btn btn-outline-success" type="submit">Search</button>
|
||||||
|
</form>
|
||||||
|
<!-- Pages -->
|
||||||
|
<div class="list-group list-group-flush">
|
||||||
|
<?php foreach ($content as $page) : ?>
|
||||||
|
<div href="#" class="list-group-item list-group-item-action pt-3 pb-3" aria-current="true">
|
||||||
|
<div class="d-flex w-100 justify-content-between">
|
||||||
|
<!-- Print page's title -->
|
||||||
|
<h5 class="mb-1"><?php echo $page->title() ?></h5>
|
||||||
|
<!-- Print page's date -->
|
||||||
|
<small>3 days ago</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Print page's description -->
|
||||||
|
<p class="mb-1">Some placeholder content in a paragraph.</p>
|
||||||
|
|
||||||
|
<!-- Print page's tags -->
|
||||||
|
<?php
|
||||||
|
$tmp = $page->tags(true);
|
||||||
|
if (!empty($tmp)) {
|
||||||
|
echo '<small>';
|
||||||
|
foreach ($tmp as $tagKey => $tagName) {
|
||||||
|
echo '<a class="badge bg-light text-dark text-decoration-none" href="' . DOMAIN_TAGS . $tagKey . '">' . $tagName . '</a>';
|
||||||
|
}
|
||||||
|
echo '</small>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Pagination -->
|
||||||
|
<?php if (Paginator::numberOfPages() > 1) : ?>
|
||||||
|
<nav class="paginator">
|
||||||
|
<ul class="pagination flex-wrap justify-content-center">
|
||||||
|
|
||||||
|
<!-- Previous button -->
|
||||||
|
<?php if (Paginator::showPrev()) : ?>
|
||||||
|
<li class="page-item me-2">
|
||||||
|
<a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>" tabindex="-1">◀ <?php echo $L->get('Previous'); ?></a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Home button -->
|
||||||
|
<li class="page-item <?php if (Paginator::currentPage() == 1) echo 'disabled' ?>">
|
||||||
|
<a class="page-link" href="<?php echo HTML::siteUrl() ?>"><?php echo $L->get('Home'); ?></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- Next button -->
|
||||||
|
<?php if (Paginator::showNext()) : ?>
|
||||||
|
<li class="page-item ms-2">
|
||||||
|
<a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>"><?php echo $L->get('Next'); ?> ►</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<?php endif ?>
|
5
bl-themes/popeye/php/navbar.php
Normal file
5
bl-themes/popeye/php/navbar.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<nav class="navbar sticky-top navbar-light bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="#">Sticky top</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
33
bl-themes/popeye/php/page.php
Normal file
33
bl-themes/popeye/php/page.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<section class="page">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 mx-auto">
|
||||||
|
<!-- Load Bludit Plugins: Page Begin -->
|
||||||
|
<?php execPluginsByHook('pageBegin'); ?>
|
||||||
|
|
||||||
|
<!-- Page title -->
|
||||||
|
<h1 class="title"><?php echo $page->title(); ?></h1>
|
||||||
|
|
||||||
|
<!-- Page description -->
|
||||||
|
<?php if ($page->description()): ?>
|
||||||
|
<p class="page-description"><?php echo $page->description(); ?></p>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<!-- Page cover image -->
|
||||||
|
<?php if ($page->coverImage()): ?>
|
||||||
|
<div class="page-cover-image py-6 mb-4" style="background-image: url('<?php echo $page->coverImage(); ?>');">
|
||||||
|
<div style="height: 300px;"></div>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<!-- Page content -->
|
||||||
|
<div class="page-content">
|
||||||
|
<?php echo $page->content(); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Load Bludit Plugins: Page End -->
|
||||||
|
<?php execPluginsByHook('pageEnd'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
Loading…
Add table
Reference in a new issue