Compare commits

...

38 commits
3.15.0 ... v3.0

Author SHA1 Message Date
Diego Najar
3c02c86498 feat: new bludit version with bug fix for php 5 2024-08-25 10:11:57 +02:00
Diego Najar
fa736d907b chore: fix versioning number 2024-08-06 22:48:54 +02:00
Diego Najar
16c70204dc
Merge pull request #1572 from basteyy/patch-1
Fix 2 deprecated messages
2024-08-06 22:48:24 +02:00
Diego Najar
151c5ab482
Merge pull request #1573 from bramley/correct_good_afternoon
Welcome message displays "good night" in the afternoon
2024-08-06 22:40:05 +02:00
Diego Najar
27f352f586
Merge pull request #1574 from kurisotofaa/patch-1
Create lt.json
2024-08-06 22:38:49 +02:00
Kristupas Grigas
76a3ea1c3d
Create lt.json
translated to lithuanian
2024-07-19 21:08:27 +02:00
Duncan Cameron
e17583fb63 Display correct welcome message when hour is exactly 6, 12 or 18 2024-07-07 13:50:14 +01:00
basteyy
593f5b3aed
Update pagex.class.php
Fix deprecated dynamic property creation and week calculation in relativeTime function

- Resolved deprecated warning by avoiding dynamic property creation on DateInterval object.
- Calculated weeks separately and included them correctly in the output string.
- Adjusted the logic to handle weeks within the string array without creating a dynamic property.
- Ensured compatibility with PHP 8.2 and higher, where dynamic properties are deprecated.

This fix prevents the "Deprecated: Creation of dynamic property DateInterval::$w is deprecated" warning and correctly formats the relative time string.
2024-07-06 23:05:51 +02:00
basteyy
4412f339cc
Update pages.class.php
Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /var/www/html/bludit/bl-kernel/pages.class.php on line 424
2024-07-06 23:03:12 +02:00
Diego Najar
49fb7f03b1 after save content redirect to the proper tab to avoid confusion if the content was created or not #1541 2024-06-30 21:59:24 +02:00
Diego Najar
437190fcbb add telegram support #1565 2024-06-30 21:48:29 +02:00
Diego Najar
4bfa4a74a9 fix: page upload symlink 2024-06-23 21:46:43 +02:00
Diego Najar
e770d6a972 fix: password length when changed user password 2024-06-22 16:34:24 +02:00
Diego Najar
6248ea0a62 chore: add prettierrc and dir=auto to form inputs 2024-06-22 16:22:05 +02:00
Diego Najar
16cd57029b
Merge pull request #1563 from bramley/footer_span_element
Remove spurious </span> from theme footer
2024-03-29 10:08:34 +01:00
Diego Najar
af7488f1b4
Merge pull request #1564 from bramley/remove_upload_when_deleting_content_page
Use the page UUID to identify the upload directory when deleting a page
2024-03-29 10:07:57 +01:00
Duncan Cameron
957663b48b Use the page UUID to identify the upload directory when deleting a page
Fixes #1545
2024-03-24 20:40:15 +00:00
Duncan Cameron
0b381e8df7 Remove spurious </span> 2024-03-24 12:32:29 +00:00
Diego Najar
d586fce4f2
Merge pull request #1553 from gaincoder/v3.0
Add .webp support and fix #1467
2024-01-28 20:13:39 +01:00
Diego Najar
4a645173f7
Merge pull request #1554 from gaincoder/bug-related 2024-01-13 16:03:38 -03:00
Tim Moritz
1c32692b2a fix crash if no releated pages found 2024-01-12 11:36:08 +01:00
Tim Moritz
1868c63b93 Add .webp support 2024-01-12 10:56:39 +01:00
Diego Najar
7995d862bc
Merge pull request #1543 from gentledawn/patch-1
Update theme.class.php
2023-10-14 10:07:09 +02:00
gentledawn
b05655717e
Update theme.class.php
Add missing Dribbble.
2023-10-14 14:52:53 +07:00
Diego Najar
be292c15ff
Merge pull request #1533 from hide-me/patch-1
Update ru_RU.json
2023-09-19 17:47:12 +02:00
Diego Najar
2d33a325d1
Merge pull request #1534 from hide-me/patch-2
Created ru.json
2023-09-19 17:47:04 +02:00
Diego Najar
d2f1068e08
Merge pull request #1535 from hide-me/patch-3
Update and rename ru_RU.json to ru.json
2023-09-19 17:46:42 +02:00
Diego Najar
53cc162d3a
Merge pull request #1536 from hide-me/patch-5
Rename ru_RU.json to ru.json
2023-09-19 17:46:31 +02:00
Diego Najar
39ff27bff6
Merge pull request #1537 from hide-me/patch-6
Rename ru_RU.json to ru.json
2023-09-19 17:46:08 +02:00
Diego Najar
e8e83a3219
Merge pull request #1538 from hide-me/patch-4
Create ru.json
2023-09-19 17:45:53 +02:00
Paul
90e81d7fe8
Rename ru_RU.json to ru.json 2023-09-19 14:26:04 +03:00
Paul
d7b76909f7
Update ru.json 2023-09-19 14:25:07 +03:00
Paul
c1093dbef1
Rename ru_RU.json to ru.json 2023-09-19 14:24:03 +03:00
Paul
e913a1a857
Rename ru_RU.json to ru.json 2023-09-19 14:23:06 +03:00
Paul
6331155414
Create ru.json
Added russian translation for this plugin
2023-09-19 14:21:11 +03:00
Paul
d9963918fb
Update and rename ru_RU.json to ru.json 2023-09-19 14:17:59 +03:00
Paul
f29db1eee0
Created ru.json
Added russian translation for this plugin
2023-09-19 14:11:11 +03:00
Paul
4998bc7005
Update ru_RU.json 2023-09-19 14:03:34 +03:00
83 changed files with 2899 additions and 2301 deletions

7
.prettierrc Normal file
View file

@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"printWidth": 100
}

View file

@ -55,4 +55,4 @@ a.text-danger:hover {
.table thead th {
font-size: 0.8em;
text-transform: uppercase!important;
}
}

View file

@ -1,8 +1,10 @@
<?php
class Bootstrap {
class Bootstrap
{
public static function modal($args) {
public static function modal($args)
{
$buttonSecondary = $args['buttonSecondary'];
$buttonSecondaryClass = $args['buttonSecondaryClass'];
@ -15,7 +17,7 @@ class Bootstrap {
$modalId = $args['modalId'];
return <<<EOF
return <<<EOF
<div id="$modalId" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@ -35,26 +37,26 @@ EOF;
public static function link($args)
{
$options = 'href="'.$args['href'].'"';
$options = 'href="' . $args['href'] . '"';
if (isset($args['class'])) {
$options .= ' class="'.$args['class'].'"';
$options .= ' class="' . $args['class'] . '"';
}
if (isset($args['target'])) {
$options .= ' target="'.$args['target'].'"';
$options .= ' target="' . $args['target'] . '"';
}
if (isset($args['icon'])) {
return '<a '.$options.'><span class="fa fa-'.$args['icon'].'"></span>'.$args['title'].'</a>';
return '<a ' . $options . '><span class="fa fa-' . $args['icon'] . '"></span>' . $args['title'] . '</a>';
}
return '<a '.$options.'>'.$args['title'].'</a>';
return '<a ' . $options . '>' . $args['title'] . '</a>';
}
public static function pageTitle($args)
{
$icon = $args['icon'];
$title = $args['title'];
return <<<EOF
return <<<EOF
<h2 class="mt-0 mb-3">
<span class="fa fa-$icon" style="font-size: 0.9em;"></span><span>$title</span>
</h2>
@ -63,21 +65,21 @@ EOF;
public static function formOpen($args)
{
$class = empty($args['class'])?'':'class="'.$args['class'].'"';
$id = empty($args['id'])?'':'id="'.$args['id'].'"';
$enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"';
$action = empty($args['action'])?'action=""':'action="'.$args['action'].'"';
$method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"';
$style = empty($args['style'])?'':'style="'.$args['style'].'"';
$class = empty($args['class']) ? '' : 'class="' . $args['class'] . '"';
$id = empty($args['id']) ? '' : 'id="' . $args['id'] . '"';
$enctype = empty($args['enctype']) ? '' : 'enctype="' . $args['enctype'] . '"';
$action = empty($args['action']) ? 'action=""' : 'action="' . $args['action'] . '"';
$method = empty($args['method']) ? 'method="post"' : 'method="' . $args['method'] . '"';
$style = empty($args['style']) ? '' : 'style="' . $args['style'] . '"';
return <<<EOF
return <<<EOF
<form $class $enctype $id $method $action $style autocomplete="off">
EOF;
}
public static function formClose()
{
return <<<EOF
return <<<EOF
</form>
<script>
$(document).ready(function() {
@ -95,7 +97,7 @@ EOF;
public static function formTitle($args)
{
$title = $args['title'];
return <<<EOF
return <<<EOF
<h6 class="mt-4 mb-2 pb-2 border-bottom text-uppercase">$title</h6>
EOF;
}
@ -103,18 +105,18 @@ EOF;
public static function formInputTextBlock($args)
{
$name = $args['name'];
$disabled = empty($args['disabled'])?'':'disabled';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$value = isset($args['value'])?$args['value']:'';
$disabled = empty($args['disabled']) ? '' : 'disabled';
$placeholder = isset($args['placeholder']) ? $args['placeholder'] : '';
$value = isset($args['value']) ? $args['value'] : '';
$id = 'js'.$name;
$id = 'js' . $name;
if (isset($args['id'])) {
$id = $args['id'];
}
$tip = '';
if (!empty($args['tip'])) {
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
$tip = '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$class = 'form-group m-0';
@ -129,7 +131,7 @@ EOF;
$label = '';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'" for="'.$id.'">'.$args['label'].'</label>';
$label = '<label class="' . $labelClass . '" for="' . $id . '">' . $args['label'] . '</label>';
}
$type = 'text';
@ -137,10 +139,10 @@ EOF;
$type = $args['type'];
}
return <<<EOF
return <<<EOF
<div class="$class">
$label
<input type="text" value="$value" class="form-control" id="$id" name="$name" placeholder="$placeholder" $disabled>
<input type="text" dir="auto" value="$value" class="form-control" id="$id" name="$name" placeholder="$placeholder" $disabled>
$tip
</div>
EOF;
@ -148,19 +150,19 @@ EOF;
public static function formInputFile($args)
{
$id = 'js'.$args['name'];
$id = 'js' . $args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-file';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$html = '<div class="'.$class.'">';
$html .= '<input type="file" class="custom-file-input" id="'.$id.'">';
$html .= '<label class="custom-file-label" for="'.$id.'">'.$args['label'].'</label>';
$html = '<div class="' . $class . '">';
$html .= '<input type="file" class="custom-file-input" id="' . $id . '">';
$html .= '<label class="custom-file-label" for="' . $id . '">' . $args['label'] . '</label>';
$html .= '</div>';
return $html;
@ -168,26 +170,26 @@ EOF;
public static function formTextarea($args)
{
$id = 'js'.$args['name'];
$id = 'js' . $args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'form-control';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$html = '<div class="form-group row">';
if (!empty($args['label'])) {
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
$html .= '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
}
$html .= '<div class="col-sm-10">';
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
$html .= '<textarea class="' . $class . '" id="' . $id . '" name="' . $args['name'] . '" rows="' . $args['rows'] . '" placeholder="' . $args['placeholder'] . '">' . $args['value'] . '</textarea>';
if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$html .= '</div>';
$html .= '</div>';
@ -197,24 +199,24 @@ EOF;
public static function formTextareaBlock($args)
{
$id = 'js'.$args['name'];
$id = 'js' . $args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'form-control';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$html = '<div class="form-group m-0">';
if (!empty($args['label'])) {
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="' . $id . '">' . $args['label'] . '</label>';
}
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
$html .= '<textarea class="' . $class . '" id="' . $id . '" name="' . $args['name'] . '" rows="' . $args['rows'] . '" placeholder="' . $args['placeholder'] . '">' . $args['value'] . '</textarea>';
if (!empty($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$html .= '</div>';
@ -224,29 +226,29 @@ EOF;
public static function formInputText($args)
{
$name = $args['name'];
$disabled = empty($args['disabled'])?'':'disabled';
$readonly = empty($args['readonly'])?'':'readonly';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$value = isset($args['value'])?$args['value']:'';
$disabled = empty($args['disabled']) ? '' : 'disabled';
$readonly = empty($args['readonly']) ? '' : 'readonly';
$placeholder = isset($args['placeholder']) ? $args['placeholder'] : '';
$value = isset($args['value']) ? $args['value'] : '';
$id = 'js'.$name;
$id = 'js' . $name;
if (isset($args['id'])) {
$id = $args['id'];
}
$tip = '';
if (isset($args['tip'])) {
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
$tip = '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$label = '';
if (isset($args['label'])) {
$label = '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
$label = '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
}
$class = 'form-control';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$type = 'text';
@ -254,11 +256,11 @@ EOF;
$type = $args['type'];
}
return <<<EOF
return <<<EOF
<div class="form-group row">
$label
<div class="col-sm-10">
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled $readonly>
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" dir="auto" $disabled $readonly>
$tip
</div>
</div>
@ -267,16 +269,16 @@ EOF;
public static function formCheckbox($args)
{
$labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:'';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$tip = isset($args['tip'])?'<small class="form-text text-muted">'.$args['tip'].'</small>':'';
$value = isset($args['value'])?$args['value']:'';
$labelForCheckbox = isset($args['labelForCheckbox']) ? $args['labelForCheckbox'] : '';
$placeholder = isset($args['placeholder']) ? $args['placeholder'] : '';
$tip = isset($args['tip']) ? '<small class="form-text text-muted">' . $args['tip'] . '</small>' : '';
$value = isset($args['value']) ? $args['value'] : '';
$name = $args['name'];
$id = 'js'.$name;
$id = 'js' . $name;
if (isset($args['id'])) {
$id = $args['id'];
}
$disabled = isset($args['disabled'])?'disabled':'';
$disabled = isset($args['disabled']) ? 'disabled' : '';
$class = 'form-group m-0';
if (isset($args['class'])) {
@ -295,13 +297,13 @@ EOF;
$label = '';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'">'.$args['label'].'</label>';
$label = '<label class="' . $labelClass . '">' . $args['label'] . '</label>';
}
$checked = $args['checked']?'checked':'';
$value = $checked?'1':'0';
$checked = $args['checked'] ? 'checked' : '';
$value = $checked ? '1' : '0';
return <<<EOF
return <<<EOF
<div class="$class">
$label
<div class="form-check">
@ -315,30 +317,30 @@ EOF;
public static function formSelect($args)
{
$id = 'js'.$args['name'];
$id = 'js' . $args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-select';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$html = '<div class="form-group row">';
if (isset($args['label'])) {
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
$html .= '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
}
$html .= '<div class="col-sm-10">';
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
foreach ($args['options'] as $key=>$value) {
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
$html .= '<select id="' . $id . '" name="' . $args['name'] . '" class="' . $class . '">';
foreach ($args['options'] as $key => $value) {
$html .= '<option ' . (($key == $args['selected']) ? 'selected' : '') . ' value="' . $key . '">' . $value . '</option>';
}
$html .= '</select>';
if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$html .= '</div>';
$html .= '</div>';
@ -348,32 +350,32 @@ EOF;
public static function formSelectBlock($args)
{
$id = 'js'.$args['name'];
$id = 'js' . $args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-select';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$html = '<div class="form-group m-0">';
if (!empty($args['label'])) {
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="' . $id . '">' . $args['label'] . '</label>';
}
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
$html .= '<select id="' . $id . '" name="' . $args['name'] . '" class="' . $class . '">';
if (!empty($args['emptyOption'])) {
$html .= '<option value="">'.$args['emptyOption'].'</option>';
$html .= '<option value="">' . $args['emptyOption'] . '</option>';
}
foreach ($args['options'] as $key=>$value) {
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
foreach ($args['options'] as $key => $value) {
$html .= '<option ' . (($key == $args['selected']) ? 'selected' : '') . ' value="' . $key . '">' . $value . '</option>';
}
$html .= '</select>';
if (!empty($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
}
$html .= '</div>';
@ -382,19 +384,19 @@ EOF;
public static function formInputHidden($args)
{
return '<input type="hidden" id="js'.$args['name'].'" name="'.$args['name'].'" value="'.$args['value'].'">';
return '<input type="hidden" id="js' . $args['name'] . '" name="' . $args['name'] . '" value="' . $args['value'] . '">';
}
public static function alert($args)
{
$class = 'alert';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
$class = $class . ' ' . $args['class'];
}
$text = $args['text'];
return <<<EOF
return <<<EOF
<div class="$class" role="alert">$text</div>
EOF;
}

View file

@ -1,140 +1,140 @@
<div id="dashboard" class="container">
<div class="row">
<div class="col-md-7">
<div class="row">
<div class="col-md-7">
<!-- Good message -->
<div>
<h2 id="hello-message" class="pt-0">
<?php
$username = $login->username();
$user = new User($username);
$name = '';
if ($user->nickname()) {
$name = $user->nickname();
} elseif ($user->firstName()) {
$name = $user->firstName();
}
?>
<span class="fa fa-hand-spock-o"></span><span><?php echo $L->g('welcome') ?></span>
</h2>
<script>
$(document).ready(function() {
$("#hello-message").fadeOut(2400, function() {
var date = new Date()
var hours = date.getHours()
if (hours > 6 && hours < 12) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-morning') . ', ' . $name ?>');
} else if (hours > 12 && hours < 18) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-afternoon') . ', ' . $name ?>');
} else if (hours > 18 && hours < 22) {
$(this).html('<span class="fa fa-moon-o"></span><?php echo $L->g('good-evening') . ', ' . $name ?>');
} else {
$(this).html('<span class="fa fa-moon-o"></span><span><?php echo $L->g('good-night') . ', ' . $name ?></span>');
}
}).fadeIn(1000);
});
</script>
</div>
<!-- Good message -->
<div>
<h2 id="hello-message" class="pt-0">
<?php
$username = $login->username();
$user = new User($username);
$name = '';
if ($user->nickname()) {
$name = $user->nickname();
} elseif ($user->firstName()) {
$name = $user->firstName();
}
?>
<span class="fa fa-hand-spock-o"></span><span><?php echo $L->g('welcome') ?></span>
</h2>
<script>
$(document).ready(function() {
$("#hello-message").fadeOut(2400, function() {
var date = new Date()
var hours = date.getHours()
if (hours >= 6 && hours < 12) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-morning') . ', ' . $name ?>');
} else if (hours >= 12 && hours < 18) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-afternoon') . ', ' . $name ?>');
} else if (hours >= 18 && hours < 22) {
$(this).html('<span class="fa fa-moon-o"></span><?php echo $L->g('good-evening') . ', ' . $name ?>');
} else {
$(this).html('<span class="fa fa-moon-o"></span><span><?php echo $L->g('good-night') . ', ' . $name ?></span>');
}
}).fadeIn(1000);
});
</script>
</div>
<!-- Quick Links -->
<div class="container pb-5" id="jsclippyContainer">
<!-- Quick Links -->
<div class="container pb-5" id="jsclippyContainer">
<div class="row">
<div class="col p-0">
<div class="form-group">
<select id="jsclippy" class="clippy" name="state"></select>
</div>
</div>
</div>
<div class="row">
<div class="col p-0">
<div class="form-group">
<select id="jsclippy" class="clippy" name="state"></select>
</div>
</div>
</div>
<script>
$(document).ready(function() {
<script>
$(document).ready(function() {
var clippy = $("#jsclippy").select2({
placeholder: "<?php $L->p('Start typing to see a list of suggestions') ?>",
allowClear: true,
width: "100%",
theme: "bootstrap4",
minimumInputLength: 2,
dropdownParent: "#jsclippyContainer",
language: {
inputTooShort: function() {
return '';
}
},
ajax: {
url: HTML_PATH_ADMIN_ROOT + "ajax/clippy",
data: function(params) {
var query = {
query: params.term
}
return query;
},
processResults: function(data) {
return data;
}
},
templateResult: function(data) {
// console.log(data);
var html = '';
if (data.type == 'menu') {
html += '<a href="' + data.url + '"><div class="search-suggestion">';
html += '<span class="fa fa-' + data.icon + '"></span>' + data.text + '</div></a>';
} else {
if (typeof data.id === 'undefined') {
return '';
}
html += '<div class="search-suggestion">';
html += '<div class="search-suggestion-item">' + data.text + ' <span class="badge badge-pill badge-light">' + data.type + '</span></div>';
html += '<div class="search-suggestion-options">';
html += '<a target="_blank" href="' + DOMAIN_PAGES + data.id + '"><?php $L->p('view') ?></a>';
html += '<a class="ml-2" href="' + DOMAIN_ADMIN + 'edit-content/' + data.id + '"><?php $L->p('edit') ?></a>';
html += '</div></div>';
}
var clippy = $("#jsclippy").select2({
placeholder: "<?php $L->p('Start typing to see a list of suggestions') ?>",
allowClear: true,
width: "100%",
theme: "bootstrap4",
minimumInputLength: 2,
dropdownParent: "#jsclippyContainer",
language: {
inputTooShort: function() {
return '';
}
},
ajax: {
url: HTML_PATH_ADMIN_ROOT + "ajax/clippy",
data: function(params) {
var query = {
query: params.term
}
return query;
},
processResults: function(data) {
return data;
}
},
templateResult: function(data) {
// console.log(data);
var html = '';
if (data.type == 'menu') {
html += '<a href="' + data.url + '"><div class="search-suggestion">';
html += '<span class="fa fa-' + data.icon + '"></span>' + data.text + '</div></a>';
} else {
if (typeof data.id === 'undefined') {
return '';
}
html += '<div class="search-suggestion">';
html += '<div class="search-suggestion-item">' + data.text + ' <span class="badge badge-pill badge-light">' + data.type + '</span></div>';
html += '<div class="search-suggestion-options">';
html += '<a target="_blank" href="' + DOMAIN_PAGES + data.id + '"><?php $L->p('view') ?></a>';
html += '<a class="ml-2" href="' + DOMAIN_ADMIN + 'edit-content/' + data.id + '"><?php $L->p('edit') ?></a>';
html += '</div></div>';
}
return html;
},
escapeMarkup: function(markup) {
return markup;
}
}).on("select2:closing", function(e) {
e.preventDefault();
}).on("select2:closed", function(e) {
clippy.select2("open");
});
clippy.select2("open");
return html;
},
escapeMarkup: function(markup) {
return markup;
}
}).on("select2:closing", function(e) {
e.preventDefault();
}).on("select2:closed", function(e) {
clippy.select2("open");
});
clippy.select2("open");
});
</script>
</div>
});
</script>
</div>
<?php Theme::plugins('dashboard') ?>
</div>
<div class="col-md-5">
<?php Theme::plugins('dashboard') ?>
</div>
<div class="col-md-5">
<!-- Notifications -->
<ul class="list-group list-group-striped b-0">
<li class="list-group-item pt-0">
<h4 class="m-0"><?php $L->p('Notifications') ?></h4>
</li>
<?php
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
foreach ($logs as $log) {
$phrase = $L->g($log['dictionaryKey']);
echo '<li class="list-group-item">';
echo $phrase;
if (!empty($log['notes'])) {
echo ' « <b>' . $log['notes'] . '</b> »';
}
echo '<br><span class="notification-date"><small>';
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
echo ' [ ' . $log['username'] . ' ]';
echo '</small></span>';
echo '</li>';
}
?>
</ul>
<!-- Notifications -->
<ul class="list-group list-group-striped b-0">
<li class="list-group-item pt-0">
<h4 class="m-0"><?php $L->p('Notifications') ?></h4>
</li>
<?php
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
foreach ($logs as $log) {
$phrase = $L->g($log['dictionaryKey']);
echo '<li class="list-group-item">';
echo $phrase;
if (!empty($log['notes'])) {
echo ' « <b>' . $log['notes'] . '</b> »';
}
echo '<br><span class="notification-date"><small>';
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
echo ' [ ' . $log['username'] . ' ]';
echo '</small></span>';
echo '</li>';
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>

View file

@ -4,46 +4,46 @@
// FORM START
echo Bootstrap::formOpen(array(
'id'=>'jsform',
'class'=>'d-flex flex-column h-100'
'id' => 'jsform',
'class' => 'd-flex flex-column h-100'
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name' => 'tokenCSRF',
'value' => $security->getTokenCSRF()
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name'=>'uuid',
'value'=>$page->uuid()
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name' => 'uuid',
'value' => $page->uuid()
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name'=>'type',
'value'=>$page->type()
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name' => 'type',
'value' => $page->type()
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name'=>'coverImage',
'value'=>$page->coverImage(false)
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name' => 'coverImage',
'value' => $page->coverImage(false)
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
// Content
echo Bootstrap::formInputHidden(array(
'name' => 'content',
'value' => ''
));
// Current page key
echo Bootstrap::formInputHidden(array(
'name'=>'key',
'value'=>$page->key()
));
// Current page key
echo Bootstrap::formInputHidden(array(
'name' => 'key',
'value' => $page->key()
));
?>
<!-- TOOLBAR -->
@ -56,11 +56,11 @@ echo Bootstrap::formOpen(array(
<div id="jseditorToolbarLeft">
<button type="button" class="btn btn-sm btn-primary" id="jsbuttonSave"><?php echo $L->g('Save') ?></button>
<button id="jsbuttonPreview" type="button" class="btn btn-sm btn-secondary"><?php $L->p('Preview') ?></button>
<span id="jsswitchButton" data-switch="<?php echo ($page->draft()?'draft':'publish') ?>" class="ml-2 text-secondary switch-button"><i class="fa fa-square switch-icon-<?php echo ($page->draft()?'draft':'publish') ?>"></i> <?php echo ($page->draft()?$L->g('Draft'):$L->g('Publish')) ?></span>
<span id="jsswitchButton" data-switch="<?php echo ($page->draft() ? 'draft' : 'publish') ?>" class="ml-2 text-secondary switch-button"><i class="fa fa-square switch-icon-<?php echo ($page->draft() ? 'draft' : 'publish') ?>"></i> <?php echo ($page->draft() ? $L->g('Draft') : $L->g('Publish')) ?></span>
</div>
<?php if($page->scheduled()): ?>
<div class="alert alert-warning p-1 mt-1 mb-0"><?php $L->p('scheduled') ?>: <?php echo $page->date(SCHEDULED_DATE_FORMAT) ?></div>
<?php if ($page->scheduled()) : ?>
<div class="alert alert-warning p-1 mt-1 mb-0"><?php $L->p('scheduled') ?>: <?php echo $page->date(SCHEDULED_DATE_FORMAT) ?></div>
<?php endif; ?>
</div>
<script>
@ -81,10 +81,10 @@ echo Bootstrap::formOpen(array(
<div id="jseditorSidebar">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link" id="nav-advanced-tab" data-toggle="tab" href="#nav-advanced" role="tab" aria-controls="advanced"><?php $L->p('Advanced') ?></a>
<?php if (!empty($site->customFields())): ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php if (!empty($site->customFields())) : ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php endif ?>
<a class="nav-link" id="nav-seo-tab" data-toggle="tab" href="#nav-seo" role="tab" aria-controls="seo"><?php $L->p('SEO') ?></a>
</div>
@ -93,40 +93,40 @@ echo Bootstrap::formOpen(array(
<div class="tab-content pr-3 pl-3 pb-3">
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
<?php
// Category
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>$L->g('Category'),
'selected'=>$page->categoryKey(),
'class'=>'',
'emptyOption'=>'- '.$L->g('Uncategorized').' -',
'options'=>$categories->getKeyNameArray()
));
// Category
echo Bootstrap::formSelectBlock(array(
'name' => 'category',
'label' => $L->g('Category'),
'selected' => $page->categoryKey(),
'class' => '',
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
'options' => $categories->getKeyNameArray()
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>$L->g('Description'),
'selected'=>'',
'class'=>'',
'value'=>$page->description(),
'rows'=>5,
'placeholder'=>$L->get('this-field-can-help-describe-the-content')
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => $page->description(),
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
?>
<!-- Cover Image -->
<?php
$coverImage = $page->coverImage(false);
$externalCoverImage = '';
if (filter_var($coverImage, FILTER_VALIDATE_URL)) {
$coverImage = '';
$externalCoverImage = $page->coverImage(false);
}
$coverImage = $page->coverImage(false);
$externalCoverImage = '';
if (filter_var($coverImage, FILTER_VALIDATE_URL)) {
$coverImage = '';
$externalCoverImage = $page->coverImage(false);
}
?>
<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
<div>
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (empty($coverImage) ? HTML_PATH_CORE_IMG.'default.svg' : $page->coverImage() ) ?>" />
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (empty($coverImage) ? HTML_PATH_CORE_IMG . 'default.svg' : $page->coverImage()) ?>" />
</div>
<div class="mt-2 text-center">
<button type="button" id="jsbuttonSelectCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Select cover image') ?></button>
@ -144,220 +144,222 @@ echo Bootstrap::formOpen(array(
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG + 'default.svg');
});
});
</script>
</div>
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
<?php
// Date
echo Bootstrap::formInputTextBlock(array(
'name'=>'date',
'label'=>$L->g('Date'),
'placeholder'=>'',
'value'=>$page->dateRaw(),
'tip'=>$L->g('date-format-format')
));
// Date
echo Bootstrap::formInputTextBlock(array(
'name' => 'date',
'label' => $L->g('Date'),
'placeholder' => '',
'value' => $page->dateRaw(),
'tip' => $L->g('date-format-format')
));
// Type
echo Bootstrap::formSelectBlock(array(
'name'=>'typeSelector',
'label'=>$L->g('Type'),
'selected'=>$page->type(),
'options'=>array(
'published'=>'- '.$L->g('Default').' -',
'sticky'=>$L->g('Sticky'),
'static'=>$L->g('Static')
),
'tip'=>''
));
// Type
echo Bootstrap::formSelectBlock(array(
'name' => 'typeSelector',
'label' => $L->g('Type'),
'selected' => $page->type(),
'options' => array(
'published' => '- ' . $L->g('Default') . ' -',
'sticky' => $L->g('Sticky'),
'static' => $L->g('Static')
),
'tip' => ''
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>$L->g('Field used when ordering content by position'),
'value'=>$page->position()
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name' => 'position',
'label' => $L->g('Position'),
'tip' => $L->g('Field used when ordering content by position'),
'value' => $page->position()
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'placeholder'=>'',
'tip'=>$L->g('Write the tags separated by comma'),
'value'=>$page->tags()
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name' => 'tags',
'label' => $L->g('Tags'),
'placeholder' => '',
'tip' => $L->g('Write the tags separated by comma'),
'value' => $page->tags()
));
// Parent
try {
$options = array();
$parentKey = $page->parent();
if (!empty($parentKey)) {
$parent = new Page($parentKey);
$options = array($parentKey=>$parent->title());
}
} catch (Exception $e) {
// continue
// Parent
try {
$options = array();
$parentKey = $page->parent();
if (!empty($parentKey)) {
$parent = new Page($parentKey);
$options = array($parentKey => $parent->title());
}
echo Bootstrap::formSelectBlock(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'options'=>$options,
'selected'=>false,
'class'=>'',
'tip'=>$L->g('Start typing a page title to see a list of suggestions.'),
));
} catch (Exception $e) {
// continue
}
echo Bootstrap::formSelectBlock(array(
'name' => 'parent',
'label' => $L->g('Parent'),
'options' => $options,
'selected' => false,
'class' => '',
'tip' => $L->g('Start typing a page title to see a list of suggestions.'),
));
?>
<script>
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = {
checkIsParent: true,
query: params.term
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT + "ajax/get-published",
data: function(params) {
var query = {
checkIsParent: true,
query: params.term
}
return query;
},
processResults: function(data) {
return data;
}
return query;
},
processResults: function (data) {
return data;
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text
if (data.type == "static") {
html += '<span class="badge badge-pill badge-light">' + data.type + '</span>';
}
return html;
}
},
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text
if (data.type=="static") {
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
}
return html;
}
});
});
});
</script>
<?php
// Template
echo Bootstrap::formInputTextBlock(array(
'name'=>'template',
'label'=>$L->g('Template'),
'placeholder'=>'',
'value'=>$page->template(),
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
// Template
echo Bootstrap::formInputTextBlock(array(
'name' => 'template',
'label' => $L->g('Template'),
'placeholder' => '',
'value' => $page->template(),
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'),
'placeholder'=>"https://",
'value'=>$externalCoverImage,
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
echo Bootstrap::formInputTextBlock(array(
'name' => 'externalCoverImage',
'label' => $L->g('External cover image'),
'placeholder' => "https://",
'value' => $externalCoverImage,
'tip' => $L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name'=>'',
'label'=>$L->g('Author'),
'placeholder'=>'',
'value'=>$page->username(),
'tip'=>'',
'disabled'=>true
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name' => '',
'label' => $L->g('Author'),
'placeholder' => '',
'value' => $page->username(),
'tip' => '',
'disabled' => true
));
?>
<script>
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val($(this).val());
});
// Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
});
// Datepicker
$("#jsdate").datetimepicker({
format: DB_DATE_FORMAT
});
});
</script>
</div>
<?php if (!empty($site->customFields())): ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( !isset($options['position']) ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'value'=>$page->custom($field)
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
));
<?php if (!empty($site->customFields())) : ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (!isset($options['position'])) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'value' => (isset($options['default']) ? $options['default'] : ''),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'value' => $page->custom($field)
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => $page->custom($field),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : '')
));
}
}
}
}
?>
</div>
?>
</div>
<?php endif ?>
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
<?php
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name'=>'slug',
'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'),
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.'),
'value'=>$page->slug()
));
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name' => 'slug',
'tip' => $L->g('URL associated with the content'),
'label' => $L->g('Friendly URL'),
'placeholder' => $L->g('Leave empty for autocomplete by Bludit.'),
'value' => $page->slug()
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noindex',
'label'=>'Robots',
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->noindex(),
'tip'=>$L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'noindex',
'label' => 'Robots',
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
'placeholder' => '',
'checked' => $page->noindex(),
'tip' => $L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'nofollow',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->nofollow(),
'tip'=>$L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'nofollow',
'label' => '',
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
'placeholder' => '',
'checked' => $page->nofollow(),
'tip' => $L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noarchive',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->noarchive(),
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'noarchive',
'label' => '',
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
'placeholder' => '',
'checked' => $page->noarchive(),
'tip' => $L->g('This tells search engines not to save a cached copy of this page.')
));
?>
</div>
</div>
@ -365,38 +367,38 @@ echo Bootstrap::formOpen(array(
<!-- Custom fields: TOP -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='top') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>$page->custom($field),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (isset($options['position']) && ($options['position'] == 'top')) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'value' => $page->custom($field),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'class' => 'mb-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => $page->custom($field),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : ''),
'class' => 'mb-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
<!-- Title -->
<div class="form-group mb-1">
<input id="jstitle" name="title" type="text" class="form-control form-control-lg rounded-0" value="<?php echo $page->title() ?>" placeholder="<?php $L->p('Enter title') ?>">
<input id="jstitle" name="title" type="text" dir="auto" class="form-control form-control-lg rounded-0" value="<?php echo $page->title() ?>" placeholder="<?php $L->p('Enter title') ?>">
</div>
<!-- Editor -->
@ -404,33 +406,33 @@ echo Bootstrap::formOpen(array(
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='bottom') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>$page->custom($field),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (isset($options['position']) && ($options['position'] == 'bottom')) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'value' => $page->custom($field),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'class' => 'mt-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => $page->custom($field),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : ''),
'class' => 'mt-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
</form>
@ -450,112 +452,112 @@ echo Bootstrap::formOpen(array(
</div>
</div>
<script>
$(document).ready(function() {
$("#jsbuttonDeleteAccept").on("click", function() {
$("#jstype").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
$(document).ready(function() {
$("#jsbuttonDeleteAccept").on("click", function() {
$("#jstype").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
});
});
});
</script>
</div>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<?php include(PATH_ADMIN_THEMES . 'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link){
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
};
}
// Button switch
$("#jsswitchButton").on("click", function() {
if ($(this).data("switch")=="publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function() {
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename) {
$("#jseditor").val($('#jseditor').val() + '<img src="' + filename + '" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link) {
$("#jseditor").val($('#jseditor').val() + '<a href="' + link + '"><img src="' + filename + '" alt=""></a>');
};
}
});
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
var ajax = new bluditAjax();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$page->uuid().'?preview='.md5('autosave-'.$page->uuid()) ?>", "bludit-preview");
preview.focus();
// Button switch
$("#jsswitchButton").on("click", function() {
if ($(this).data("switch") == "publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
}
});
});
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector
if ($("#jsswitchButton").data("switch")=="publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
var ajax = new bluditAjax();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES . 'autosave-' . $page->uuid() . '?preview=' . md5('autosave-' . $page->uuid()) ?>", "bludit-preview");
preview.focus();
});
});
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector
if ($("#jsswitchButton").data("switch") == "publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
$("#jstype").val("draft");
}
// Get the content
$("#jscontent").val(editorGetContent());
// Submit the form
$("#jsform").submit();
});
// Button Save as draft
$("#jsbuttonDraft").on("click", function() {
// Set the type as draft
$("#jstype").val("draft");
}
// Get the content
$("#jscontent").val( editorGetContent() );
// Get the content
$("#jscontent").val(editorGetContent());
// Submit the form
$("#jsform").submit();
});
// Submit the form
$("#jsform").submit();
});
// Button Save as draft
$("#jsbuttonDraft").on("click", function() {
// Set the type as draft
$("#jstype").val("draft");
// Get the content
$("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit();
});
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val() + "[<?php $L->p('Autosave') ?>]";
var content = editorGetContent();
// Autosave when content has at least 100 characters
if (content.length<100) {
if (content.length < 100) {
return false;
}
// Autosave only when the user change the content
if (currentContent!=content) {
if (currentContent != content) {
currentContent = content;
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
if (data.status==0) {
if (data.status == 0) {
showAlert("<?php $L->p('Autosave') ?>");
}
});
}
},1000*60*AUTOSAVE_INTERVAL);
}, 1000 * 60 * AUTOSAVE_INTERVAL);
});
});
</script>

View file

@ -1,13 +1,13 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<?php echo Bootstrap::formOpen(array('id' => 'jsform', 'class' => 'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT . 'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'user')); ?>
<?php echo Bootstrap::pageTitle(array('title' => $L->g('Edit user'), 'icon' => 'user')); ?>
</div>
<!-- TABS -->
@ -21,81 +21,81 @@
</nav>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name' => 'tokenCSRF',
'value' => $security->getTokenCSRF()
));
// Username
echo Bootstrap::formInputHidden(array(
'name'=>'username',
'value'=>$user->username()
));
// Username
echo Bootstrap::formInputHidden(array(
'name' => 'username',
'value' => $user->username()
));
?>
<div class="tab-content" id="nav-tabContent">
<!-- Profile tab -->
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
<?php
<?php
// Display username but disable the field
echo Bootstrap::formInputText(array(
'name'=>'usernameDisabled',
'label'=>$L->g('Username'),
'value'=>$user->username(),
'class'=>'',
'placeholder'=>'',
'disabled'=>true,
'tip'=>''
'name' => 'usernameDisabled',
'label' => $L->g('Username'),
'value' => $user->username(),
'class' => '',
'placeholder' => '',
'disabled' => true,
'tip' => ''
));
if ($login->role()==='admin') {
if ($login->role() === 'admin') {
echo Bootstrap::formSelect(array(
'name'=>'role',
'label'=>$L->g('Role'),
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>$user->role(),
'class'=>'',
'tip'=>$L->g('author-can-write-and-edit-their-own-content')
'name' => 'role',
'label' => $L->g('Role'),
'options' => array('author' => $L->g('Author'), 'editor' => $L->g('Editor'), 'admin' => $L->g('Administrator')),
'selected' => $user->role(),
'class' => '',
'tip' => $L->g('author-can-write-and-edit-their-own-content')
));
}
echo Bootstrap::formInputText(array(
'name'=>'email',
'label'=>$L->g('Email'),
'value'=>$user->email(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'email',
'label' => $L->g('Email'),
'value' => $user->email(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'nickname',
'label'=>$L->g('Nickname'),
'value'=>$user->nickname(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
'name' => 'nickname',
'label' => $L->g('Nickname'),
'value' => $user->nickname(),
'class' => '',
'placeholder' => '',
'tip' => $L->g('The nickname is almost used in the themes to display the author of the content')
));
echo Bootstrap::formInputText(array(
'name'=>'firstName',
'label'=>$L->g('First Name'),
'value'=>$user->firstName(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'firstName',
'label' => $L->g('First Name'),
'value' => $user->firstName(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'lastName',
'label'=>$L->g('Last Name'),
'value'=>$user->lastName(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'lastName',
'label' => $L->g('Last Name'),
'value' => $user->lastName(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
?>
?>
</div>
<!-- Profile picture tab -->
@ -110,71 +110,71 @@
<!-- <button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button> -->
</div>
<div class="col-lg-8 col-sm-12 p-0 text-center">
<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES . $user->username() . '.png') ? DOMAIN_UPLOADS_PROFILES . $user->username() . '.png?version=' . time() : HTML_PATH_CORE_IMG . 'default.svg') ?>" />
</div>
</div>
</div>
<script>
// $("#jsbuttonRemovePicture").on("click", function() {
// var username = $("#jsusername").val();
// bluditAjax.removeProfilePicture(username);
// $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
// });
// $("#jsbuttonRemovePicture").on("click", function() {
// var username = $("#jsusername").val();
// bluditAjax.removeProfilePicture(username);
// $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG . 'default.svg' ?>");
// });
$("#jsprofilePictureInputFile").on("change", function() {
var formData = new FormData();
formData.append('tokenCSRF', tokenCSRF);
formData.append('profilePictureInputFile', $(this)[0].files[0]);
formData.append('username', $("#jsusername").val());
$.ajax({
url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture-upload",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false
}).done(function(data) {
if (data.status==0) {
$("#jsprofilePicturePreview").attr('src',data.absoluteURL+"?time="+Math.random());
} else {
showAlert(data.message);
}
$("#jsprofilePictureInputFile").on("change", function() {
var formData = new FormData();
formData.append('tokenCSRF', tokenCSRF);
formData.append('profilePictureInputFile', $(this)[0].files[0]);
formData.append('username', $("#jsusername").val());
$.ajax({
url: HTML_PATH_ADMIN_ROOT + "ajax/profile-picture-upload",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false
}).done(function(data) {
if (data.status == 0) {
$("#jsprofilePicturePreview").attr('src', data.absoluteURL + "?time=" + Math.random());
} else {
showAlert(data.message);
}
});
});
});
</script>
</div>
<!-- Security tab -->
<div class="tab-pane fade" id="security" role="tabpanel" aria-labelledby="nav-security-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
<?php
echo Bootstrap::formTitle(array('title' => $L->g('Password')));
echo '
<div class="form-group">
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
<a href="' . HTML_PATH_ADMIN_ROOT . 'user-password/' . $user->username() . '" class="btn btn-primary mr-2">' . $L->g('Change password') . '</a>
</div>
';
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
echo Bootstrap::formTitle(array('title' => $L->g('Authentication Token')));
echo Bootstrap::formInputText(array(
'name'=>'tokenAuth',
'label'=>$L->g('Token'),
'value'=>$user->tokenAuth(),
'class'=>'',
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
'name' => 'tokenAuth',
'label' => $L->g('Token'),
'value' => $user->tokenAuth(),
'class' => '',
'tip' => $L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
));
if (checkRole(array('admin'),false)) {
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
if (checkRole(array('admin'), false)) {
echo Bootstrap::formTitle(array('title' => $L->g('Status')));
echo Bootstrap::formInputText(array(
'name'=>'status',
'label'=>$L->g('Current status'),
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
'class'=>'',
'disabled'=>true,
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
'name' => 'status',
'label' => $L->g('Current status'),
'value' => $user->enabled() ? $L->g('Enabled') : $L->g('Disabled'),
'class' => '',
'disabled' => true,
'tip' => $user->enabled() ? '' : $L->g('To enable the user you must set a new password')
));
if ($user->enabled()) {
@ -182,110 +182,119 @@
<div class="form-group row">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">' . $L->g('Disable user') . '</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">' . $L->g('Delete user and keep content') . '</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">' . $L->g('Delete user and delete content') . '</button>
</div>
</div>
';
}
}
?>
?>
</div>
<!-- Social Networks tab -->
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
<?php
<?php
echo Bootstrap::formInputText(array(
'name'=>'twitter',
'label'=>'Twitter',
'value'=>$user->twitter(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'twitter',
'label' => 'Twitter',
'value' => $user->twitter(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'facebook',
'label'=>'Facebook',
'value'=>$user->facebook(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'facebook',
'label' => 'Facebook',
'value' => $user->facebook(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'codepen',
'label'=>'CodePen',
'value'=>$user->codepen(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'codepen',
'label' => 'CodePen',
'value' => $user->codepen(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'instagram',
'label'=>'Instagram',
'value'=>$user->instagram(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'instagram',
'label' => 'Instagram',
'value' => $user->instagram(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'gitlab',
'label'=>'GitLab',
'value'=>$user->gitlab(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'gitlab',
'label' => 'GitLab',
'value' => $user->gitlab(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'github',
'label'=>'GitHub',
'value'=>$user->github(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'github',
'label' => 'GitHub',
'value' => $user->github(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'linkedin',
'label'=>'LinkedIn',
'value'=>$user->linkedin(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'linkedin',
'label' => 'LinkedIn',
'value' => $user->linkedin(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'xing',
'label'=>'Xing',
'value'=>$user->xing(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'xing',
'label' => 'Xing',
'value' => $user->xing(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'mastodon',
'label'=>'Mastodon',
'value'=>$user->mastodon(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'telegram',
'label' => 'Telegram',
'value' => $user->telegram(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name'=>'vk',
'label'=>'VK',
'value'=>$user->vk(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
'name' => 'mastodon',
'label' => 'Mastodon',
'value' => $user->mastodon(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
?>
echo Bootstrap::formInputText(array(
'name' => 'vk',
'label' => 'VK',
'value' => $user->vk(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
?>
</div>
</div>
@ -304,4 +313,4 @@
//window.localStorage.removeItem("activeTab");
}
});
</script>
</script>

View file

@ -1,38 +1,37 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
echo '<h1 class="text-center mb-3 mt-3 font-weight-normal" style="color: #555;">'.$site->title().'</h1>';
echo '<h1 class="text-center mb-3 mt-3 font-weight-normal" style="color: #555;">' . $site->title() . '</h1>';
echo Bootstrap::formOpen(array());
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
echo Bootstrap::formInputHidden(array(
'name' => 'tokenCSRF',
'value' => $security->getTokenCSRF()
));
echo '
echo '
<div class="form-group">
<input type="text" value="'.(isset($_POST['username'])?Sanitize::html($_POST['username']):'').'" class="form-control form-control-lg" id="jsusername" name="username" placeholder="'.$L->g('Username').'" autofocus>
<input type="text" dir="auto" value="' . (isset($_POST['username']) ? Sanitize::html($_POST['username']) : '') . '" class="form-control form-control-lg" id="jsusername" name="username" placeholder="' . $L->g('Username') . '" autofocus>
</div>
';
echo '
echo '
<div class="form-group">
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="'.$L->g('Password').'">
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="' . $L->g('Password') . '">
</div>
';
echo '
echo '
<div class="form-check">
<input class="form-check-input" type="checkbox" value="true" id="jsremember" name="remember">
<label class="form-check-label" for="jsremember">'.$L->g('Remember me').'</label>
<label class="form-check-label" for="jsremember">' . $L->g('Remember me') . '</label>
</div>
<div class="form-group mt-3">
<button type="submit" class="btn btn-primary btn-lg mr-2 w-100" name="save">'.$L->g('Login').'</button>
<button type="submit" class="btn btn-primary btn-lg mr-2 w-100" name="save">' . $L->g('Login') . '</button>
</div>
';
echo '</form>';
echo '<p class="mt-3 text-right">'.$L->g('Powered by Bludit').((defined('BLUDIT_PRO'))?' PRO':'').'</p>'
?>
echo '<p class="mt-3 text-right">' . $L->g('Powered by Bludit') . ((defined('BLUDIT_PRO')) ? ' PRO' : '') . '</p>';

View file

@ -4,40 +4,40 @@
// Start form
echo Bootstrap::formOpen(array(
'id'=>'jsform',
'class'=>'d-flex flex-column h-100'
'id' => 'jsform',
'class' => 'd-flex flex-column h-100'
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name' => 'tokenCSRF',
'value' => $security->getTokenCSRF()
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name'=>'uuid',
'value'=>$uuid
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name' => 'uuid',
'value' => $uuid
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name'=>'type',
'value'=>'published'
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name' => 'type',
'value' => 'published'
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name'=>'coverImage',
'value'=>''
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name' => 'coverImage',
'value' => ''
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
// Content
echo Bootstrap::formInputHidden(array(
'name' => 'content',
'value' => ''
));
?>
<!-- TOOLBAR -->
@ -48,7 +48,7 @@ echo Bootstrap::formOpen(array(
</div>
<div id="jseditorToolbarLeft">
<button id="jsbuttonSave" type="button" class="btn btn-sm btn-primary" ><?php $L->p('Save') ?></button>
<button id="jsbuttonSave" type="button" class="btn btn-sm btn-primary"><?php $L->p('Save') ?></button>
<button id="jsbuttonPreview" type="button" class="btn btn-sm btn-secondary"><?php $L->p('Preview') ?></button>
<span id="jsbuttonSwitch" data-switch="publish" class="ml-2 text-secondary switch-button"><i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?></span>
</div>
@ -71,10 +71,10 @@ echo Bootstrap::formOpen(array(
<div id="jseditorSidebar">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link" id="nav-advanced-tab" data-toggle="tab" href="#nav-advanced" role="tab" aria-controls="advanced"><?php $L->p('Advanced') ?></a>
<?php if (!empty($site->customFields())): ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php if (!empty($site->customFields())) : ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php endif ?>
<a class="nav-link" id="nav-seo-tab" data-toggle="tab" href="#nav-seo" role="tab" aria-controls="seo"><?php $L->p('SEO') ?></a>
</div>
@ -83,26 +83,26 @@ echo Bootstrap::formOpen(array(
<div class="tab-content pr-3 pl-3 pb-3">
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
<?php
// Category
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>$L->g('Category'),
'selected'=>'',
'class'=>'',
'emptyOption'=>'- '.$L->g('Uncategorized').' -',
'options'=>$categories->getKeyNameArray()
));
// Category
echo Bootstrap::formSelectBlock(array(
'name' => 'category',
'label' => $L->g('Category'),
'selected' => '',
'class' => '',
'emptyOption' => '- ' . $L->g('Uncategorized') . ' -',
'options' => $categories->getKeyNameArray()
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>$L->g('Description'),
'selected'=>'',
'class'=>'',
'value'=>'',
'rows'=>5,
'placeholder'=>$L->get('this-field-can-help-describe-the-content')
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => '',
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
?>
<!-- Cover Image -->
@ -126,218 +126,220 @@ echo Bootstrap::formOpen(array(
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG + 'default.svg');
});
});
</script>
</div>
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
<?php
// Date
echo Bootstrap::formInputTextBlock(array(
'name'=>'date',
'label'=>$L->g('Date'),
'placeholder'=>'',
'value'=>Date::current(DB_DATE_FORMAT),
'tip'=>$L->g('date-format-format')
));
// Date
echo Bootstrap::formInputTextBlock(array(
'name' => 'date',
'label' => $L->g('Date'),
'placeholder' => '',
'value' => Date::current(DB_DATE_FORMAT),
'tip' => $L->g('date-format-format')
));
// Type
echo Bootstrap::formSelectBlock(array(
'name'=>'typeSelector',
'label'=>$L->g('Type'),
'selected'=>'',
'options'=>array(
'published'=>'- '.$L->g('Default').' -',
'sticky'=>$L->g('Sticky'),
'static'=>$L->g('Static')
),
'tip'=>''
));
// Type
echo Bootstrap::formSelectBlock(array(
'name' => 'typeSelector',
'label' => $L->g('Type'),
'selected' => '',
'options' => array(
'published' => '- ' . $L->g('Default') . ' -',
'sticky' => $L->g('Sticky'),
'static' => $L->g('Static')
),
'tip' => ''
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>$L->g('Field used when ordering content by position'),
'value'=>$pages->nextPositionNumber()
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name' => 'position',
'label' => $L->g('Position'),
'tip' => $L->g('Field used when ordering content by position'),
'value' => $pages->nextPositionNumber()
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'placeholder'=>'',
'tip'=>$L->g('Write the tags separated by comma')
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name' => 'tags',
'label' => $L->g('Tags'),
'placeholder' => '',
'tip' => $L->g('Write the tags separated by comma')
));
// Parent
echo Bootstrap::formSelectBlock(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'options'=>array(),
'selected'=>false,
'class'=>'',
'tip'=>$L->g('Start typing a page title to see a list of suggestions.'),
));
// Parent
echo Bootstrap::formSelectBlock(array(
'name' => 'parent',
'label' => $L->g('Parent'),
'options' => array(),
'selected' => false,
'class' => '',
'tip' => $L->g('Start typing a page title to see a list of suggestions.'),
));
?>
<script>
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = {
checkIsParent: true,
query: params.term
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT + "ajax/get-published",
data: function(params) {
var query = {
checkIsParent: true,
query: params.term
}
return query;
},
processResults: function(data) {
return data;
}
return query;
},
processResults: function (data) {
return data;
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text;
if (data.type == "static") {
html += '<span class="badge badge-pill badge-light">' + data.type + '</span>';
}
return html;
}
},
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text;
if (data.type=="static") {
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
}
return html;
}
});
});
});
</script>
<?php
// Template
echo Bootstrap::formInputTextBlock(array(
'name'=>'template',
'label'=>$L->g('Template'),
'placeholder'=>'',
'value'=>'',
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
// Template
echo Bootstrap::formInputTextBlock(array(
'name' => 'template',
'label' => $L->g('Template'),
'placeholder' => '',
'value' => '',
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'),
'placeholder'=>"https://",
'value'=>'',
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
echo Bootstrap::formInputTextBlock(array(
'name' => 'externalCoverImage',
'label' => $L->g('External cover image'),
'placeholder' => "https://",
'value' => '',
'tip' => $L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name'=>'',
'label'=>$L->g('Author'),
'placeholder'=>'',
'value'=>$login->username(),
'tip'=>'',
'disabled'=>true
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name' => '',
'label' => $L->g('Author'),
'placeholder' => '',
'value' => $login->username(),
'tip' => '',
'disabled' => true
));
?>
<script>
$(document).ready(function() {
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val($(this).val());
});
// Generate slug when the user type the title
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
var currentKey = "";
var ajax = new bluditAjax();
var callBack = $("#jsslug");
ajax.generateSlug(text, parent, currentKey, callBack);
});
// Datepicker
$("#jsdate").datetimepicker({
format: DB_DATE_FORMAT
});
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
// Generate slug when the user type the title
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
var currentKey = "";
var ajax = new bluditAjax();
var callBack = $("#jsslug");
ajax.generateSlug(text, parent, currentKey, callBack);
});
// Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
});
</script>
</div>
<?php if (!empty($site->customFields())): ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( !isset($options['position']) ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:'')
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
));
<?php if (!empty($site->customFields())) : ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (!isset($options['position'])) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'value' => (isset($options['default']) ? $options['default'] : ''),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : '')
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => (isset($options['checked']) ? true : false),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : '')
));
}
}
}
}
?>
</div>
?>
</div>
<?php endif ?>
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
<?php
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name'=>'slug',
'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'),
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.')
));
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name' => 'slug',
'tip' => $L->g('URL associated with the content'),
'label' => $L->g('Friendly URL'),
'placeholder' => $L->g('Leave empty for autocomplete by Bludit.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noindex',
'label'=>'Robots',
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'noindex',
'label' => 'Robots',
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
'placeholder' => '',
'checked' => false,
'tip' => $L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'nofollow',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'nofollow',
'label' => '',
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
'placeholder' => '',
'checked' => false,
'tip' => $L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noarchive',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name' => 'noarchive',
'label' => '',
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
'placeholder' => '',
'checked' => false,
'tip' => $L->g('This tells search engines not to save a cached copy of this page.')
));
?>
</div>
</div>
@ -345,39 +347,39 @@ echo Bootstrap::formOpen(array(
<!-- Custom fields: TOP -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='top') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (isset($options['position']) && ($options['position'] == 'top')) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'value' => (isset($options['default']) ? $options['default'] : ''),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'class' => 'mb-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => (isset($options['checked']) ? true : false),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : ''),
'class' => 'mb-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
<!-- Title -->
<div id="jseditorTitle" class="form-group mb-1">
<input id="jstitle" name="title" type="text" class="form-control form-control-lg rounded-0" value="" placeholder="<?php $L->p('Enter title') ?>">
<input id="jstitle" name="title" type="text" dir="auto" class="form-control form-control-lg rounded-0" value="" placeholder="<?php $L->p('Enter title') ?>">
</div>
<!-- Editor -->
@ -385,120 +387,125 @@ echo Bootstrap::formOpen(array(
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='bottom') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
$customFields = $site->customFields();
foreach ($customFields as $field => $options) {
if (isset($options['position']) && ($options['position'] == 'bottom')) {
if ($options['type'] == "string") {
echo Bootstrap::formInputTextBlock(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'value' => (isset($options['default']) ? $options['default'] : ''),
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'class' => 'mt-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
));
} elseif ($options['type'] == "bool") {
echo Bootstrap::formCheckbox(array(
'name' => 'custom[' . $field . ']',
'label' => (isset($options['label']) ? $options['label'] : ''),
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
'checked' => (isset($options['checked']) ? true : false),
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : ''),
'class' => 'mt-2',
'labelClass' => 'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
</form>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<?php include(PATH_ADMIN_THEMES . 'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link){
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
};
}
// Button switch
$("#jsbuttonSwitch").on("click", function() {
if ($(this).data("switch")=="publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function() {
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename) {
$("#jseditor").val($('#jseditor').val() + '<img src="' + filename + '" alt="">');
};
}
if (typeof editorInsertLinkedMedia != "function") {
window.editorInsertLinkedMedia = function(filename, link) {
$("#jseditor").val($('#jseditor').val() + '<a href="' + link + '"><img src="' + filename + '" alt=""></a>');
};
}
});
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$uuid.'?preview='.md5('autosave-'.$uuid) ?>", "bludit-preview");
preview.focus();
// Button switch
$("#jsbuttonSwitch").on("click", function() {
if ($(this).data("switch") == "publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
}
});
});
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector
if ($("#jsbuttonSwitch").data("switch")=="publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
$("#jstype").val("draft");
}
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES . 'autosave-' . $uuid . '?preview=' . md5('autosave-' . $uuid) ?>", "bludit-preview");
preview.focus();
});
});
// Get the content
$("#jscontent").val( editorGetContent() );
// Button Save
$("#jsbuttonSave").on("click", function() {
let actionParameters = '';
// Submit the form
$("#jsform").submit();
});
// If the switch is setted to "published", get the value from the selector
if ($("#jsbuttonSwitch").data("switch") == "publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
actionParameters = '#' + value;
} else {
$("#jstype").val("draft");
actionParameters = '#draft';
}
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
// Get the content
$("#jscontent").val(editorGetContent());
// Submit the form
$("#jsform").attr('action', actionParameters);
$("#jsform").submit();
});
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val() + "[<?php $L->p('Autosave') ?>]";
var content = editorGetContent();
// Autosave when content has at least 100 characters
if (content.length<100) {
if (content.length < 100) {
return false;
}
// Autosave only when the user change the content
if (currentContent!=content) {
if (currentContent != content) {
currentContent = content;
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
if (data.status==0) {
if (data.status == 0) {
showAlert("<?php $L->p('Autosave') ?>");
}
});
}
},1000*60*AUTOSAVE_INTERVAL);
}, 1000 * 60 * AUTOSAVE_INTERVAL);
});
});
</script>

View file

@ -12,7 +12,7 @@ echo Bootstrap::formTitle(array('title' => $L->g('Search plugins')));
?>
<input type="text" class="form-control" id="search" placeholder="<?php $L->p('Search') ?>">
<input type="text" dir="auto" class="form-control" id="search" placeholder="<?php $L->p('Search') ?>">
<script>
$(document).ready(function() {
$("#search").on("keyup", function() {

View file

@ -415,6 +415,15 @@ echo Bootstrap::formInputHidden(array(
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name' => 'telegram',
'label' => 'Telegram',
'value' => $site->telegram(),
'class' => '',
'placeholder' => '',
'tip' => ''
));
echo Bootstrap::formInputText(array(
'name' => 'mastodon',
'label' => 'Mastodon',

View file

@ -25,8 +25,8 @@ if ($uuid) {
// Set upload directory
if ($uuid && IMAGE_RESTRICT) {
$imageDirectory = PATH_UPLOADS_PAGES.$uuid.DS;
$thumbnailDirectory = $imageDirectory.'thumbnails'.DS;
$imageDirectory = PATH_UPLOADS_PAGES . $uuid . DS;
$thumbnailDirectory = $imageDirectory . 'thumbnails' . DS;
if (!Filesystem::directoryExists($thumbnailDirectory)) {
Filesystem::mkdir($thumbnailDirectory, true);
}
@ -36,10 +36,10 @@ if ($uuid && IMAGE_RESTRICT) {
}
$images = array();
foreach ($_FILES['images']['name'] as $uuid=>$filename) {
foreach ($_FILES['images']['name'] as $uuid => $filename) {
// Check for errors
if ($_FILES['images']['error'][$uuid] != 0) {
$message = $L->g('Maximum load file size allowed:').' '.ini_get('upload_max_filesize');
$message = $L->g('Maximum load file size allowed:') . ' ' . ini_get('upload_max_filesize');
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
@ -57,27 +57,27 @@ foreach ($_FILES['images']['name'] as $uuid=>$filename) {
// Check file extension
$fileExtension = Filesystem::extension($filename);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, $GLOBALS['ALLOWED_IMG_EXTENSION']) ) {
$message = $L->g('File type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_EXTENSION']);
if (!in_array($fileExtension, $GLOBALS['ALLOWED_IMG_EXTENSION'])) {
$message = $L->g('File type is not supported. Allowed types:') . ' ' . implode(', ', $GLOBALS['ALLOWED_IMG_EXTENSION']);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Check file MIME Type
$fileMimeType = Filesystem::mimeType($_FILES['images']['tmp_name'][$uuid]);
if ($fileMimeType!==false) {
if ($fileMimeType !== false) {
if (!in_array($fileMimeType, $GLOBALS['ALLOWED_IMG_MIMETYPES'])) {
$message = $L->g('File mime type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_MIMETYPES']);
$message = $L->g('File mime type is not supported. Allowed types:') . ' ' . implode(', ', $GLOBALS['ALLOWED_IMG_MIMETYPES']);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
}
// Move from PHP tmp file to Bludit tmp directory
Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP.$filename);
Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP . $filename);
// Transform the image and generate the thumbnail
$image = transformImage(PATH_TMP.$filename, $imageDirectory, $thumbnailDirectory);
$image = transformImage(PATH_TMP . $filename, $imageDirectory, $thumbnailDirectory);
if ($image) {
chmod($image, 0644);
@ -91,7 +91,5 @@ foreach ($_FILES['images']['name'] as $uuid=>$filename) {
}
ajaxResponse(0, 'Images uploaded.', array(
'images'=>$images
'images' => $images
));
?>

View file

@ -1,13 +1,13 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// Bludit version
define('BLUDIT_VERSION', '3.15.0');
define('BLUDIT_CODENAME', 'Krakow');
define('BLUDIT_RELEASE_DATE', '2023-07-15');
define('BLUDIT_BUILD', '20230715');
define('BLUDIT_VERSION', '3.16.2');
define('BLUDIT_CODENAME', 'Valencia');
define('BLUDIT_RELEASE_DATE', '2024-08-23');
define('BLUDIT_BUILD', '20240806');
// Change to TRUE for debugging
define('DEBUG_MODE', FALSE);
define('DEBUG_MODE', TRUE);
define('DEBUG_TYPE', 'INFO'); // INFO, TRACE
// This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.

View file

@ -677,8 +677,8 @@ function changeUserPassword($args)
$confirmPassword = $args['confirmPassword'];
// Password length
if (Text::length($newPassword) < 6) {
Alert::set($L->g('Password must be at least 6 characters long'), ALERT_STATUS_FAIL);
if (Text::length($newPassword) < PASSWORD_LENGTH) {
Alert::set($L->g('Password must be at least ' . PASSWORD_LENGTH . ' characters long'), ALERT_STATUS_FAIL);
return false;
}
@ -932,7 +932,7 @@ function transformImage($file, $imageDir, $thumbnailDir = false)
// Generate Thumbnail
if (!empty($thumbnailDir)) {
if (($fileExtension == 'svg') || ($fileExtension == 'webp')) {
if (($fileExtension == 'svg')) {
Filesystem::symlink($image, $thumbnailDir . $nextFilename);
} else {
$Image = new Image();

View file

@ -1,21 +1,23 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Filesystem {
class Filesystem
{
// Returns an array with the absolutes directories.
public static function listDirectories($path, $regex='*', $sortByDate=false)
public static function listDirectories($path, $regex = '*', $sortByDate = false)
{
$directories = glob($path.$regex, GLOB_ONLYDIR);
$directories = glob($path . $regex, GLOB_ONLYDIR);
if(empty($directories)) {
if (empty($directories)) {
return array();
}
if($sortByDate) {
usort($directories,
function($a, $b) {
return filemtime($b) - filemtime($a);
}
if ($sortByDate) {
usort(
$directories,
function ($a, $b) {
return filemtime($b) - filemtime($a);
}
);
}
@ -25,18 +27,19 @@ class Filesystem {
// Returns an array with the list of files with the absolute path
// $sortByDate = TRUE, the first file is the newer file
// $chunk = amount of chunks, FALSE if you don't want to chunk
public static function listFiles($path, $regex='*', $extension='*', $sortByDate=false, $chunk=false)
public static function listFiles($path, $regex = '*', $extension = '*', $sortByDate = false, $chunk = false)
{
error_log($path.$regex.'.'.$extension);
$files = glob($path.$regex.'.'.$extension);
error_log($path . $regex . '.' . $extension);
$files = glob($path . $regex . '.' . $extension);
if (empty($files)) {
return array();
}
if ($sortByDate) {
usort($files,
function($a, $b) {
usort(
$files,
function ($a, $b) {
return filemtime($b) - filemtime($a);
}
);
@ -51,26 +54,27 @@ class Filesystem {
return $files;
}
public static function mkdir($pathname, $recursive=false)
public static function mkdir($pathname, $recursive = false)
{
Log::set('mkdir ' . $pathname . ' recursive = ' . $recursive, LOG_TYPE_INFO);
return mkdir($pathname, DIR_PERMISSIONS, $recursive);
}
public static function rmdir($pathname)
{
Log::set('rmdir = '.$pathname, LOG_TYPE_INFO);
Log::set('rmdir = ' . $pathname, LOG_TYPE_INFO);
return rmdir($pathname);
}
public static function mv($oldname, $newname)
{
Log::set('mv '.$oldname.' '.$newname, LOG_TYPE_INFO);
Log::set('mv ' . $oldname . ' ' . $newname, LOG_TYPE_INFO);
return rename($oldname, $newname);
}
public static function rmfile($filename)
{
Log::set('rmfile = '.$filename, LOG_TYPE_INFO);
Log::set('rmfile = ' . $filename, LOG_TYPE_INFO);
return unlink($filename);
}
@ -88,7 +92,7 @@ class Filesystem {
// If the destination directory not exists is created
// $source = /home/diego/example or /home/diego/example/
// $destination = /home/diego/newplace or /home/diego/newplace/
public static function copyRecursive($source, $destination, $skipDirectory=false)
public static function copyRecursive($source, $destination, $skipDirectory = false)
{
$source = rtrim($source, DS);
$destination = rtrim($destination, DS);
@ -107,15 +111,16 @@ class Filesystem {
}
foreach ($iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST) as $item) {
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
) as $item) {
$currentDirectory = dirname($item->getPathName());
if ($skipDirectory !== $currentDirectory) {
if ($item->isDir()) {
@mkdir($destination.DS.$iterator->getSubPathName());
@mkdir($destination . DS . $iterator->getSubPathName());
} else {
copy($item, $destination.DS.$iterator->getSubPathName());
copy($item, $destination . DS . $iterator->getSubPathName());
}
}
}
@ -125,9 +130,9 @@ class Filesystem {
// Delete a file or directory recursive
// The directory is delete
public static function deleteRecursive($source, $deleteDirectory=true)
public static function deleteRecursive($source, $deleteDirectory = true)
{
Log::set('deleteRecursive = '.$source, LOG_TYPE_INFO);
Log::set('deleteRecursive = ' . $source, LOG_TYPE_INFO);
if (!self::directoryExists($source)) {
return false;
@ -135,12 +140,13 @@ class Filesystem {
foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST) as $item) {
if ($item->isFile() || $item->isLink()) {
unlink($item);
} else {
rmdir($item);
}
RecursiveIteratorIterator::CHILD_FIRST
) as $item) {
if ($item->isFile() || $item->isLink()) {
unlink($item);
} else {
rmdir($item);
}
}
if ($deleteDirectory) {
@ -209,7 +215,7 @@ class Filesystem {
return $zip->close();
}
/*
/*
| Returns the next filename if the filename already exist otherwise returns the original filename
|
| @path string Path
@ -217,7 +223,8 @@ class Filesystem {
|
| @return string
*/
public static function nextFilename($filename, $path=PATH_UPLOADS) {
public static function nextFilename($filename, $path = PATH_UPLOADS)
{
// Clean filename and get extension
$fileExtension = pathinfo($filename, PATHINFO_EXTENSION);
$fileExtension = Text::lowercase($fileExtension);
@ -226,19 +233,19 @@ class Filesystem {
$filename = Text::removeQuotes($filename);
// Search for the next filename
$tmpName = $filename.'.'.$fileExtension;
if (Sanitize::pathFile($path.$tmpName)) {
$tmpName = $filename . '.' . $fileExtension;
if (Sanitize::pathFile($path . $tmpName)) {
$number = 0;
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
while (Sanitize::pathFile($path.$tmpName)) {
$tmpName = $filename . '_' . $number . '.' . $fileExtension;
while (Sanitize::pathFile($path . $tmpName)) {
$number = $number + 1;
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
$tmpName = $filename . '_' . $number . '.' . $fileExtension;
}
}
return $tmpName;
}
/*
/*
| Returns the filename
| Example:
| @file /home/diego/dog.jpg
@ -248,7 +255,8 @@ class Filesystem {
|
| @return string
*/
public static function filename($file) {
public static function filename($file)
{
return basename($file);
}
@ -262,7 +270,8 @@ class Filesystem {
|
| @return string
*/
public static function extension($file) {
public static function extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
@ -271,30 +280,32 @@ class Filesystem {
* @param [string] $fileOrDirectory
* @return [int|bool] [bytes or false on error]
*/
public static function getSize($fileOrDirectory) {
public static function getSize($fileOrDirectory)
{
// Files
if (is_file($fileOrDirectory)) {
return filesize($fileOrDirectory);
}
// Directories
if (file_exists($fileOrDirectory)) {
$size = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file){
$size = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file) {
try {
$size += $file->getSize();
} catch (Exception $e) {
// SplFileInfo::getSize RuntimeException will be thrown on broken symlinks/errors
}
}
return $size;
}
return $size;
}
return false;
}
public static function bytesToHumanFileSize($bytes, $decimals = 2) {
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f ", $bytes / pow(1024, $factor)) . @$size[$factor];
public static function bytesToHumanFileSize($bytes, $decimals = 2)
{
$size = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f ", $bytes / pow(1024, $factor)) . @$size[$factor];
}
/*
@ -307,7 +318,8 @@ class Filesystem {
|
| @return [string|bool] Mime type as string or FALSE if not possible to get the mime type
*/
public static function mimeType($file) {
public static function mimeType($file)
{
if (function_exists('mime_content_type')) {
return mime_content_type($file);
}
@ -322,12 +334,13 @@ class Filesystem {
return false;
}
public static function symlink($from, $to) {
public static function symlink($from, $to)
{
if (function_exists('symlink')) {
Log::set('symlink from = ' . $from . ' to = ' . $to, LOG_TYPE_INFO);
return symlink($from, $to);
} else {
return copy($from, $to);
}
}
}

View file

@ -2,236 +2,245 @@
class Image {
private $image;
private $width;
private $height;
private $imageResized;
private $image;
private $width;
private $height;
private $imageResized;
public function setImage($fileName, $newWidth, $newHeight, $option="auto")
{
// *** Open up the file
$this->image = $this->openImage($fileName);
public function setImage($fileName, $newWidth, $newHeight, $option="auto")
{
// *** Open up the file
$this->image = $this->openImage($fileName);
// *** Get width and height
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
// *** Get width and height
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
$this->resizeImage($newWidth, $newHeight, $option);
}
$this->resizeImage($newWidth, $newHeight, $option);
}
public function saveImage($savePath, $imageQuality="100", $forceJPG=false, $forcePNG=false)
{
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
public function saveImage($savePath, $imageQuality="100", $forceJPG=false, $forcePNG=false)
{
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
// Remove the extension
$filename = substr($savePath, 0,strrpos($savePath,'.'));
// Remove the extension
$filename = substr($savePath, 0,strrpos($savePath,'.'));
$path_complete = $filename.'.'.$extension;
$path_complete = $filename.'.'.$extension;
if ($forcePNG) {
$extension = 'png';
} elseif ($forceJPG) {
$extension = 'jpg';
}
if ($forcePNG) {
$extension = 'png';
} elseif ($forceJPG) {
$extension = 'jpg';
}
switch ($extension) {
case 'jpg':
case 'jpeg':
// Checking for JPG support
if (imagetypes() & IMG_JPG) {
imagejpeg($this->imageResized, $path_complete, $imageQuality);
}
break;
switch ($extension) {
case 'jpg':
case 'jpeg':
// Checking for JPG support
if (imagetypes() & IMG_JPG) {
imagejpeg($this->imageResized, $path_complete, $imageQuality);
}
break;
case 'gif':
// Checking for GIF support
if (imagetypes() & IMG_GIF) {
imagegif($this->imageResized, $path_complete);
}
break;
case 'gif':
// Checking for GIF support
if (imagetypes() & IMG_GIF) {
imagegif($this->imageResized, $path_complete);
}
break;
case 'png':
// *** Scale quality from 0-100 to 0-9
$scaleQuality = round(($imageQuality/100) * 9);
case 'png':
// *** Scale quality from 0-100 to 0-9
$scaleQuality = round(($imageQuality/100) * 9);
// *** Invert quality setting as 0 is best, not 9
$invertScaleQuality = 9 - $scaleQuality;
// *** Invert quality setting as 0 is best, not 9
$invertScaleQuality = 9 - $scaleQuality;
// Checking for PNG support
if (imagetypes() & IMG_PNG) {
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
}
break;
// Checking for PNG support
if (imagetypes() & IMG_PNG) {
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
}
break;
case 'webp':
// Checking for JPG support
if (imagetypes() & IMG_WEBP) {
imagewebp($this->imageResized, $path_complete, $imageQuality);
}
break;
default:
// Fail extension detection
break;
}
default:
// Fail extension detection
break;
}
imagedestroy($this->imageResized);
}
imagedestroy($this->imageResized);
}
private function openImage($file)
{
// *** Get extension
$extension = strtolower(strrchr($file, '.'));
private function openImage($file)
{
// *** Get extension
$extension = strtolower(strrchr($file, '.'));
switch($extension)
{
case '.jpg':
case '.jpeg':
$img = imagecreatefromjpeg($file);
break;
case '.gif':
$img = imagecreatefromgif($file);
break;
case '.png':
$img = imagecreatefrompng($file);
break;
default:
$img = false;
break;
}
return $img;
}
switch($extension)
{
case '.jpg':
case '.jpeg':
$img = imagecreatefromjpeg($file);
break;
case '.gif':
$img = imagecreatefromgif($file);
break;
case '.png':
$img = imagecreatefrompng($file);
break;
case '.webp':
$img = imagecreatefromwebp($file);
break;
default:
$img = false;
break;
}
return $img;
}
private function resizeImage($newWidth, $newHeight, $option)
{
// *** Get optimal width and height - based on $option
$optionArray = $this->getDimensions($newWidth, $newHeight, $option);
private function resizeImage($newWidth, $newHeight, $option)
{
// *** Get optimal width and height - based on $option
$optionArray = $this->getDimensions($newWidth, $newHeight, $option);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
// *** Resample - create image canvas of x, y size
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
// *** Resample - create image canvas of x, y size
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
// *** if option is 'crop', then crop too
if ($option == 'crop') {
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
}
}
// *** if option is 'crop', then crop too
if ($option == 'crop') {
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
}
}
private function getDimensions($newWidth, $newHeight, $option)
{
private function getDimensions($newWidth, $newHeight, $option)
{
if( ($this->width < $newWidth) and ($this->height < $newHeight) )
{
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
}
if( ($this->width < $newWidth) and ($this->height < $newHeight) )
{
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
}
switch ($option)
{
case 'exact':
$optimalWidth = $newWidth;
$optimalHeight= $newHeight;
break;
case 'portrait':
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
break;
case 'landscape':
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
break;
case 'auto':
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
case 'crop':
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
}
switch ($option)
{
case 'exact':
$optimalWidth = $newWidth;
$optimalHeight= $newHeight;
break;
case 'portrait':
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
break;
case 'landscape':
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
break;
case 'auto':
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
case 'crop':
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
$optimalWidth = $optionArray['optimalWidth'];
$optimalHeight = $optionArray['optimalHeight'];
break;
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function getSizeByFixedHeight($newHeight)
{
$ratio = $this->width / $this->height;
$newWidth = $newHeight * $ratio;
return $newWidth;
}
private function getSizeByFixedHeight($newHeight)
{
$ratio = $this->width / $this->height;
$newWidth = $newHeight * $ratio;
return $newWidth;
}
private function getSizeByFixedWidth($newWidth)
{
$ratio = $this->height / $this->width;
$newHeight = $newWidth * $ratio;
return $newHeight;
}
private function getSizeByFixedWidth($newWidth)
{
$ratio = $this->height / $this->width;
$newHeight = $newWidth * $ratio;
return $newHeight;
}
private function getSizeByAuto($newWidth, $newHeight)
{
if ($this->height < $this->width)
// *** Image to be resized is wider (landscape)
{
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
}
elseif ($this->height > $this->width)
// *** Image to be resized is taller (portrait)
{
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
}
else
// *** Image to be resizerd is a square
{
if ($newHeight < $newWidth) {
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
} else if ($newHeight > $newWidth) {
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
} else {
// *** Sqaure being resized to a square
$optimalWidth = $newWidth;
$optimalHeight= $newHeight;
}
}
private function getSizeByAuto($newWidth, $newHeight)
{
if ($this->height < $this->width)
// *** Image to be resized is wider (landscape)
{
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
}
elseif ($this->height > $this->width)
// *** Image to be resized is taller (portrait)
{
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
}
else
// *** Image to be resizerd is a square
{
if ($newHeight < $newWidth) {
$optimalWidth = $newWidth;
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
} else if ($newHeight > $newWidth) {
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
$optimalHeight= $newHeight;
} else {
// *** Sqaure being resized to a square
$optimalWidth = $newWidth;
$optimalHeight= $newHeight;
}
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function getOptimalCrop($newWidth, $newHeight)
{
private function getOptimalCrop($newWidth, $newHeight)
{
$heightRatio = $this->height / $newHeight;
$widthRatio = $this->width / $newWidth;
$heightRatio = $this->height / $newHeight;
$widthRatio = $this->width / $newWidth;
if ($heightRatio < $widthRatio) {
$optimalRatio = $heightRatio;
} else {
$optimalRatio = $widthRatio;
}
if ($heightRatio < $widthRatio) {
$optimalRatio = $heightRatio;
} else {
$optimalRatio = $widthRatio;
}
$optimalHeight = $this->height / $optimalRatio;
$optimalWidth = $this->width / $optimalRatio;
$optimalHeight = $this->height / $optimalRatio;
$optimalWidth = $this->width / $optimalRatio;
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
}
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
{
// *** Find center - this will be used for the crop
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
{
// *** Find center - this will be used for the crop
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
$crop = $this->imageResized;
//imagedestroy($this->imageResized);
$crop = $this->imageResized;
//imagedestroy($this->imageResized);
// *** Now crop from center to exact requested size
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
}
// *** Now crop from center to exact requested size
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
}
}

View file

@ -1,24 +1,27 @@
<?php
class Theme {
class Theme
{
public static function socialNetworks()
{
global $site;
$socialNetworks = array(
'github'=>'Github',
'gitlab'=>'GitLab',
'twitter'=>'Twitter',
'facebook'=>'Facebook',
'instagram'=>'Instagram',
'codepen'=>'Codepen',
'linkedin'=>'Linkedin',
'xing'=>'Xing',
'mastodon'=>'Mastodon',
'vk'=>'VK'
'github' => 'Github',
'gitlab' => 'GitLab',
'twitter' => 'Twitter',
'facebook' => 'Facebook',
'instagram' => 'Instagram',
'codepen' => 'Codepen',
'linkedin' => 'Linkedin',
'xing' => 'Xing',
'telegram' => 'Telegram',
'mastodon' => 'Mastodon',
'vk' => 'VK',
'dribbble' => 'Dribbble'
);
foreach ($socialNetworks as $key=>$label) {
foreach ($socialNetworks as $key => $label) {
if (!$site->{$key}()) {
unset($socialNetworks[$key]);
}
@ -59,7 +62,7 @@ class Theme {
public static function rssUrl()
{
if (pluginActivated('pluginRSS')) {
return DOMAIN_BASE.'rss.xml';
return DOMAIN_BASE . 'rss.xml';
}
return false;
}
@ -67,7 +70,7 @@ class Theme {
public static function sitemapUrl()
{
if (pluginActivated('pluginSitemap')) {
return DOMAIN_BASE.'sitemap.xml';
return DOMAIN_BASE . 'sitemap.xml';
}
return false;
}
@ -90,9 +93,9 @@ class Theme {
public static function metaTags($tag)
{
if ($tag=='title') {
if ($tag == 'title') {
return self::metaTagTitle();
} elseif ($tag=='description') {
} elseif ($tag == 'description') {
return self::metaTagDescription();
}
}
@ -106,11 +109,11 @@ class Theme {
global $WHERE_AM_I;
global $page;
if ($WHERE_AM_I=='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') {
} elseif ($WHERE_AM_I == 'tag') {
try {
$tagKey = $url->slug();
$tag = new Tag($tagKey);
@ -119,8 +122,7 @@ class Theme {
} catch (Exception $e) {
// Tag doesn't exist
}
} elseif ($WHERE_AM_I=='category') {
} elseif ($WHERE_AM_I == 'category') {
try {
$categoryKey = $url->slug();
$category = new Category($categoryKey);
@ -137,7 +139,7 @@ class Theme {
$format = Text::replace('{{site-slogan}}', $site->slogan(), $format);
$format = Text::replace('{{site-description}}', $site->description(), $format);
return '<title>'.$format.'</title>'.PHP_EOL;
return '<title>' . $format . '</title>' . PHP_EOL;
}
public static function metaTagDescription()
@ -149,9 +151,9 @@ class Theme {
$description = $site->description();
if ($WHERE_AM_I=='page') {
if ($WHERE_AM_I == 'page') {
$description = $page->description();
} elseif ($WHERE_AM_I=='category') {
} elseif ($WHERE_AM_I == 'category') {
try {
$categoryKey = $url->slug();
$category = new Category($categoryKey);
@ -161,7 +163,7 @@ class Theme {
}
}
return '<meta name="description" content="'.$description.'">'.PHP_EOL;
return '<meta name="description" content="' . $description . '">' . PHP_EOL;
}
// DEPRECATED v3.0.0
@ -180,48 +182,48 @@ class Theme {
public static function charset($charset)
{
return '<meta charset="'.$charset.'">'.PHP_EOL;
return '<meta charset="' . $charset . '">' . PHP_EOL;
}
public static function viewport($content)
{
return '<meta name="viewport" content="'.$content.'">'.PHP_EOL;
return '<meta name="viewport" content="' . $content . '">' . PHP_EOL;
}
public static function src($file, $base=DOMAIN_THEME)
public static function src($file, $base = DOMAIN_THEME)
{
return $base.$file;
return $base . $file;
}
public static function css($files, $base=DOMAIN_THEME)
public static function css($files, $base = DOMAIN_THEME)
{
if( !is_array($files) ) {
if (!is_array($files)) {
$files = array($files);
}
$links = '';
foreach($files as $file) {
$links .= '<link rel="stylesheet" type="text/css" href="'.$base.$file.'?version='.BLUDIT_VERSION.'">'.PHP_EOL;
foreach ($files as $file) {
$links .= '<link rel="stylesheet" type="text/css" href="' . $base . $file . '?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
}
return $links;
}
public static function javascript($files, $base=DOMAIN_THEME, $attributes='')
public static function javascript($files, $base = DOMAIN_THEME, $attributes = '')
{
if( !is_array($files) ) {
if (!is_array($files)) {
$files = array($files);
}
$scripts = '';
foreach($files as $file) {
$scripts .= '<script '.$attributes.' src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
foreach ($files as $file) {
$scripts .= '<script ' . $attributes . ' src="' . $base . $file . '?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
}
return $scripts;
}
public static function js($files, $base=DOMAIN_THEME, $attributes='')
public static function js($files, $base = DOMAIN_THEME, $attributes = '')
{
return self::javascript($files, $base, $attributes);
}
@ -234,9 +236,9 @@ class Theme {
}
}
public static function favicon($file='favicon.png', $typeIcon='image/png')
public static function favicon($file = 'favicon.png', $typeIcon = 'image/png')
{
return '<link rel="icon" href="'.DOMAIN_THEME.$file.'" type="'.$typeIcon.'">'.PHP_EOL;
return '<link rel="icon" href="' . DOMAIN_THEME . $file . '" type="' . $typeIcon . '">' . PHP_EOL;
}
public static function keywords($keywords)
@ -244,39 +246,38 @@ class Theme {
if (is_array($keywords)) {
$keywords = implode(',', $keywords);
}
return '<meta name="keywords" content="'.$keywords.'">'.PHP_EOL;
return '<meta name="keywords" content="' . $keywords . '">' . PHP_EOL;
}
public static function jquery()
{
return '<script src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script src="' . DOMAIN_CORE_JS . 'jquery.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
}
public static function jsBootstrap($attributes='')
public static function jsBootstrap($attributes = '')
{
return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'bootstrap.bundle.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
}
public static function cssBootstrap()
{
return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'bootstrap.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
}
public static function cssBootstrapIcons()
{
// https://icons.getbootstrap.com/
return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'bootstrap-icons/bootstrap-icons.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap-icons/bootstrap-icons.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
}
public static function cssLineAwesome()
{
return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'line-awesome/css/line-awesome-font-awesome.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'line-awesome/css/line-awesome-font-awesome.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
}
public static function jsSortable($attributes='')
public static function jsSortable($attributes = '')
{
// https://github.com/psfpro/bootstrap-html5sortable
return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
}
}

View file

@ -1,8 +1,9 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Login {
class Login
{
protected $users;
protected $site;
function __construct()
{
@ -12,11 +13,11 @@ class Login {
$this->users = new Users();
}
if (isset($GLOBALS['site'])) {
$this->site = $GLOBALS['site'];
} else {
$this->site = new Site();
}
if (isset($GLOBALS['site'])) {
$this->site = $GLOBALS['site'];
} else {
$this->site = new Site();
}
// Start the Session
if (!Session::started()) {
@ -39,18 +40,18 @@ class Login {
// Returns TRUE if the user is logged, FALSE otherwise
public function isLogged()
{
if (Session::get('fingerPrint')===$this->fingerPrint()) {
if (Session::get('fingerPrint') === $this->fingerPrint()) {
$username = Session::get('username');
if (!empty($username)) {
return true;
} else {
Log::set(__METHOD__.LOG_SEP.'Session username empty, destroying the session.');
Log::set(__METHOD__ . LOG_SEP . 'Session username empty, destroying the session.');
Session::destroy();
return false;
}
}
Log::set(__METHOD__.LOG_SEP.'FingerPrints are different. ['.Session::get('fingerPrint').'] != ['.$this->fingerPrint().']');
Log::set(__METHOD__ . LOG_SEP . 'FingerPrints are different. [' . Session::get('fingerPrint') . '] != [' . $this->fingerPrint() . ']');
return false;
}
@ -62,7 +63,7 @@ class Login {
Session::set('fingerPrint', $this->fingerPrint());
Session::set('sessionTime', time());
Log::set(__METHOD__.LOG_SEP.'User logged, fingerprint ['.$this->fingerPrint().']');
Log::set(__METHOD__ . LOG_SEP . 'User logged, fingerprint [' . $this->fingerPrint() . ']');
}
public function setRememberMe($username)
@ -77,7 +78,7 @@ class Login {
Cookie::set(REMEMBER_COOKIE_USERNAME, $username, REMEMBER_COOKIE_EXPIRE_IN_DAYS);
Cookie::set(REMEMBER_COOKIE_TOKEN, $token, REMEMBER_COOKIE_EXPIRE_IN_DAYS);
Log::set(__METHOD__.LOG_SEP.'Cookies set for Remember Me.');
Log::set(__METHOD__ . LOG_SEP . 'Cookies set for Remember Me.');
}
public function invalidateRememberMe()
@ -101,12 +102,12 @@ class Login {
$username = trim($username);
if (empty($username) || empty($password)) {
Log::set(__METHOD__.LOG_SEP.'Username or password empty. Username: '.$username);
Log::set(__METHOD__ . LOG_SEP . 'Username or password empty. Username: ' . $username);
return false;
}
if (Text::length($password)<PASSWORD_LENGTH) {
Log::set(__METHOD__.LOG_SEP.'Password length is shorter than required.');
if (Text::length($password) < PASSWORD_LENGTH) {
Log::set(__METHOD__ . LOG_SEP . 'Password length is shorter than required.');
return false;
}
@ -117,13 +118,13 @@ class Login {
}
$passwordHash = $this->users->generatePasswordHash($password, $user->salt());
if ($passwordHash===$user->password()) {
if ($passwordHash === $user->password()) {
$this->setLogin($username, $user->role());
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;
}
Log::set(__METHOD__.LOG_SEP.'Password incorrect.');
Log::set(__METHOD__ . LOG_SEP . 'Password incorrect.');
return false;
}
@ -145,20 +146,20 @@ class Login {
if (empty($username) || empty($token)) {
$this->invalidateRememberMe();
Log::set(__METHOD__.LOG_SEP.'Username or Token empty. Username: '.$username.' - Token: '.$token);
Log::set(__METHOD__ . LOG_SEP . 'Username or Token empty. Username: ' . $username . ' - Token: ' . $token);
return false;
}
if ($username !== $this->users->getByRememberToken($token)) {
$this->invalidateRememberMe();
Log::set(__METHOD__.LOG_SEP.'The user has different token or the token doesn\'t exist.');
Log::set(__METHOD__ . LOG_SEP . 'The user has different token or the token doesn\'t exist.');
return false;
}
// Get user from database and login
$user = $this->users->getUserDB($username);
$this->setLogin($username, $user['role']);
Log::set(__METHOD__.LOG_SEP.'User authenticated via Remember Me.');
Log::set(__METHOD__ . LOG_SEP . 'User authenticated via Remember Me.');
return true;
}
@ -177,4 +178,4 @@ class Login {
Session::destroy();
return true;
}
}
}

View file

@ -1,27 +1,28 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Pages extends dbJSON {
class Pages extends dbJSON
{
protected $parentKeyList = array();
protected $dbFields = array(
'title'=>'',
'description'=>'',
'username'=>'',
'tags'=>array(),
'type'=>'published', // published, static, draft, sticky, scheduled, autosave
'date'=>'',
'dateModified'=>'',
'position'=>0,
'coverImage'=>'',
'category'=>'',
'md5file'=>'',
'uuid'=>'',
'allowComments'=>true,
'template'=>'',
'noindex'=>false,
'nofollow'=>false,
'noarchive'=>false,
'custom'=>array()
'title' => '',
'description' => '',
'username' => '',
'tags' => array(),
'type' => 'published', // published, static, draft, sticky, scheduled, autosave
'date' => '',
'dateModified' => '',
'position' => 0,
'coverImage' => '',
'category' => '',
'md5file' => '',
'uuid' => '',
'allowComments' => true,
'template' => '',
'noindex' => false,
'nofollow' => false,
'noarchive' => false,
'custom' => array()
);
function __construct()
@ -47,7 +48,7 @@ class Pages extends dbJSON {
// Return TRUE if the page exists, FALSE otherwise
public function exists($key)
{
return isset( $this->db[$key] );
return isset($this->db[$key]);
}
// Create a new page
@ -57,18 +58,18 @@ class Pages extends dbJSON {
$row = array();
// Predefined values
foreach ($this->dbFields as $field=>$value) {
if ($field=='tags') {
foreach ($this->dbFields as $field => $value) {
if ($field == 'tags') {
$tags = '';
if (isset($args['tags'])) {
$tags = $args['tags'];
}
$finalValue = $this->generateTags($tags);
} elseif ($field=='custom') {
} elseif ($field == 'custom') {
if (isset($args['custom'])) {
global $site;
$customFields = $site->customFields();
foreach ($args['custom'] as $customField=>$customValue) {
foreach ($args['custom'] as $customField => $customValue) {
$html = Sanitize::html($customValue);
// Store the custom field as defined type
settype($html, $customFields[$customField]['type']);
@ -91,7 +92,7 @@ class Pages extends dbJSON {
// Content
// This variable is not belong to the database so is not defined in $row
$contentRaw = (empty($args['content'])?'':$args['content']);
$contentRaw = (empty($args['content']) ? '' : $args['content']);
// Parent
// This variable is not belong to the database so is not defined in $row
@ -128,24 +129,24 @@ class Pages extends dbJSON {
}
// Schedule page
if (($row['date']>Date::current(DB_DATE_FORMAT)) && ($row['type']=='published')) {
if (($row['date'] > Date::current(DB_DATE_FORMAT)) && ($row['type'] == 'published')) {
$row['type'] = 'scheduled';
}
// Create the directory
if (Filesystem::mkdir(PATH_PAGES.$key, true) === false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the directory ['.PATH_PAGES.$key.']',LOG_TYPE_ERROR);
if (Filesystem::mkdir(PATH_PAGES . $key, true) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the directory [' . PATH_PAGES . $key . ']', LOG_TYPE_ERROR);
return false;
}
// Create the index.txt and save the file
if (file_put_contents(PATH_PAGES.$key.DS.FILENAME, $contentRaw) === false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the content in the file ['.FILENAME.']',LOG_TYPE_ERROR);
if (file_put_contents(PATH_PAGES . $key . DS . FILENAME, $contentRaw) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the content in the file [' . FILENAME . ']', LOG_TYPE_ERROR);
return false;
}
// Checksum MD5
$row['md5file'] = md5_file(PATH_PAGES.$key.DS.FILENAME);
$row['md5file'] = md5_file(PATH_PAGES . $key . DS . FILENAME);
// Insert in database
$this->db[$key] = $row;
@ -156,10 +157,12 @@ class Pages extends dbJSON {
// Save database
$this->save();
// Create symlink for images directory
if (Filesystem::mkdir(PATH_UPLOADS_PAGES.$row['uuid'])) {
Filesystem::symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$key);
// Create upload page directory for images
if (!Filesystem::directoryExists(PATH_UPLOADS_PAGES . $row['uuid'])) {
Filesystem::mkdir(PATH_UPLOADS_PAGES . $row['uuid']);
}
// Create a symlink to the upload page directory for images for better SEO
Filesystem::symlink(PATH_UPLOADS_PAGES . $row['uuid'], PATH_UPLOADS_PAGES . $key);
return $key;
}
@ -179,14 +182,14 @@ class Pages extends dbJSON {
// Check values from the arguments ($args)
// If some field is missing the current value is taken
foreach ($this->dbFields as $field=>$value) {
if ( ($field=='tags') && isset($args['tags'])) {
foreach ($this->dbFields as $field => $value) {
if (($field == 'tags') && isset($args['tags'])) {
$finalValue = $this->generateTags($args['tags']);
} elseif ($field=='custom') {
} elseif ($field == 'custom') {
if (isset($args['custom'])) {
global $site;
$customFields = $site->customFields();
foreach ($args['custom'] as $customField=>$customValue) {
foreach ($args['custom'] as $customField => $customValue) {
$html = Sanitize::html($customValue);
// Store the custom field as defined type
settype($html, $customFields[$customField]['type']);
@ -241,27 +244,27 @@ class Pages extends dbJSON {
$row['dateModified'] = Date::current(DB_DATE_FORMAT);
// Schedule page
if (($row['date']>Date::current(DB_DATE_FORMAT)) && ($row['type']=='published')) {
if (($row['date'] > Date::current(DB_DATE_FORMAT)) && ($row['type'] == 'published')) {
$row['type'] = 'scheduled';
}
// Move the directory from old key to new key only if the keys are different
if ($newKey!==$key) {
if (Filesystem::mv(PATH_PAGES.$key, PATH_PAGES.$newKey) === false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to move the directory to '.PATH_PAGES.$newKey);
if ($newKey !== $key) {
if (Filesystem::mv(PATH_PAGES . $key, PATH_PAGES . $newKey) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to move the directory to ' . PATH_PAGES . $newKey);
return false;
}
// Regenerate the symlink to a proper directory
unlink(PATH_UPLOADS_PAGES.$key);
Filesystem::symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$newKey);
unlink(PATH_UPLOADS_PAGES . $key);
Filesystem::symlink(PATH_UPLOADS_PAGES . $row['uuid'], PATH_UPLOADS_PAGES . $newKey);
}
// If the content was passed via arguments replace the content
if (isset($args['content'])) {
// Make the index.txt and save the file.
if (file_put_contents(PATH_PAGES.$newKey.DS.FILENAME, $args['content'])===false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to put the content in the file '.FILENAME);
if (file_put_contents(PATH_PAGES . $newKey . DS . FILENAME, $args['content']) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to put the content in the file ' . FILENAME);
return false;
}
}
@ -273,7 +276,7 @@ class Pages extends dbJSON {
$this->reindexChildren($key, $newKey);
// Checksum MD5
$row['md5file'] = md5_file(PATH_PAGES.$newKey.DS.FILENAME);
$row['md5file'] = md5_file(PATH_PAGES . $newKey . DS . FILENAME);
// Insert in database the new row
$this->db[$newKey] = $row;
@ -289,14 +292,15 @@ class Pages extends dbJSON {
// This function reindex the orphan children with the new parent key
// If a page has subpages and the page change his key is necesarry check the children key
public function reindexChildren($oldParentKey, $newParentKey) {
if ($oldParentKey==$newParentKey){
public function reindexChildren($oldParentKey, $newParentKey)
{
if ($oldParentKey == $newParentKey) {
return false;
}
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if (Text::startsWith($key, $oldParentKey.'/')) {
$newKey = Text::replace($oldParentKey.'/', $newParentKey.'/', $key);
foreach ($tmp as $key => $fields) {
if (Text::startsWith($key, $oldParentKey . '/')) {
$newKey = Text::replace($oldParentKey . '/', $newParentKey . '/', $key);
$this->db[$newKey] = $this->db[$key];
unset($this->db[$key]);
}
@ -312,26 +316,28 @@ class Pages extends dbJSON {
// Page doesn't exist in database
if (!$this->exists($key)) {
Log::set(__METHOD__.LOG_SEP.'The page does not exist. Key: '.$key);
Log::set(__METHOD__ . LOG_SEP . 'The page does not exist. Key: ' . $key);
return false;
}
// Delete directory and files
if (Filesystem::deleteRecursive(PATH_PAGES.$key) === false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the directory '.PATH_PAGES.$key, LOG_TYPE_ERROR);
if (Filesystem::deleteRecursive(PATH_PAGES . $key) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the directory ' . PATH_PAGES . $key, LOG_TYPE_ERROR);
}
// Delete page images directory; The function already check if exists the directory
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES.$key) === false) {
Log::set(__METHOD__.LOG_SEP.'Directory with images not found '.PATH_UPLOADS_PAGES.$key);
if (($uuid = $this->getUUID($key))) {
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES . $uuid) === false) {
Log::set(__METHOD__ . LOG_SEP . 'Directory with images not found ' . PATH_UPLOADS_PAGES . $uuid);
}
}
// Remove from database
unset($this->db[$key]);
// Save the database
if ($this->save()===false) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
if ($this->save() === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to save the database file.');
}
return true;
@ -342,8 +348,8 @@ class Pages extends dbJSON {
{
$username = $args['username'];
foreach ($this->db as $key=>$fields) {
if ($fields['username']===$username) {
foreach ($this->db as $key => $fields) {
if ($fields['username'] === $username) {
$this->delete($key);
}
}
@ -357,8 +363,8 @@ class Pages extends dbJSON {
$oldUsername = $args['oldUsername'];
$newUsername = isset($args['newUsername']) ? $args['newUsername'] : 'admin';
foreach ($this->db as $key=>$fields) {
if ($fields['username']===$oldUsername) {
foreach ($this->db as $key => $fields) {
if ($fields['username'] === $oldUsername) {
$this->db[$key]['username'] = $newUsername;
}
}
@ -380,7 +386,7 @@ class Pages extends dbJSON {
// Returns a database with all pages
// $onlyKeys = true; Returns only the pages keys
// $onlyKeys = false; Returns part of the database, I do not recommend use this
public function getDB($onlyKeys=true)
public function getDB($onlyKeys = true)
{
$tmp = $this->db;
if ($onlyKeys) {
@ -392,11 +398,11 @@ class Pages extends dbJSON {
// Returns a database with published pages
// $onlyKeys = true; Returns only the pages keys
// $onlyKeys = false; Returns part of the database, I do not recommend use this
public function getPublishedDB($onlyKeys=true)
public function getPublishedDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if ($fields['type']!='published') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'published') {
unset($tmp[$key]);
}
}
@ -408,11 +414,11 @@ class Pages extends dbJSON {
// Returns an array with a list of keys/database of static pages
// By default the static pages are sort by position
public function getStaticDB($onlyKeys=true)
public function getStaticDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if ($fields['type']!='static') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'static') {
unset($tmp[$key]);
}
}
@ -424,11 +430,11 @@ class Pages extends dbJSON {
}
// Returns an array with a list of keys/database of draft pages
public function getDraftDB($onlyKeys=true)
public function getDraftDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if($fields['type']!='draft') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'draft') {
unset($tmp[$key]);
}
}
@ -439,11 +445,11 @@ class Pages extends dbJSON {
}
// Returns an array with a list of keys/database of autosave pages
public function getAutosaveDB($onlyKeys=true)
public function getAutosaveDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if($fields['type']!='autosave') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'autosave') {
unset($tmp[$key]);
}
}
@ -454,11 +460,11 @@ class Pages extends dbJSON {
}
// Returns an array with a list of keys/database of scheduled pages
public function getScheduledDB($onlyKeys=true)
public function getScheduledDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if($fields['type']!='scheduled') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'scheduled') {
unset($tmp[$key]);
}
}
@ -469,11 +475,11 @@ class Pages extends dbJSON {
}
// Returns an array with a list of keys of sticky pages
public function getStickyDB($onlyKeys=true)
public function getStickyDB($onlyKeys = true)
{
$tmp = $this->db;
foreach ($tmp as $key=>$fields) {
if($fields['type']!='sticky') {
foreach ($tmp as $key => $fields) {
if ($fields['type'] != 'sticky') {
unset($tmp[$key]);
}
}
@ -487,8 +493,8 @@ class Pages extends dbJSON {
public function nextPositionNumber()
{
$tmp = 1;
foreach ($this->db as $key=>$fields) {
if ($fields['position']>$tmp) {
foreach ($this->db as $key => $fields) {
if ($fields['position'] > $tmp) {
$tmp = $fields['position'];
}
}
@ -498,12 +504,12 @@ class Pages extends dbJSON {
// Returns the next page key of the current page key
public function nextPageKey($currentKey)
{
if ($this->db[$currentKey]['type']=='published') {
if ($this->db[$currentKey]['type'] == 'published') {
$keys = array_keys($this->db);
$position = array_search($currentKey, $keys) - 1;
if (isset($keys[$position])) {
$nextKey = $keys[$position];
if ($this->db[$nextKey]['type']=='published') {
if ($this->db[$nextKey]['type'] == 'published') {
return $nextKey;
}
}
@ -514,12 +520,12 @@ class Pages extends dbJSON {
// Returns the previous page key of the current page key
public function previousPageKey($currentKey)
{
if ($this->db[$currentKey]['type']=='published') {
if ($this->db[$currentKey]['type'] == 'published') {
$keys = array_keys($this->db);
$position = array_search($currentKey, $keys) + 1;
if (isset($keys[$position])) {
$prevKey = $keys[$position];
if ($this->db[$prevKey]['type']=='published') {
if ($this->db[$prevKey]['type'] == 'published') {
return $prevKey;
}
}
@ -532,24 +538,24 @@ class Pages extends dbJSON {
// (int) $pageNumber, the page number
// (int) $numberOfItems, amount of items to return, if -1 returns all the items
// (boolean) $onlyPublished, TRUE to return only published pages
public function getList($pageNumber, $numberOfItems, $published=true, $static=false, $sticky=false, $draft=false, $scheduled=false)
public function getList($pageNumber, $numberOfItems, $published = true, $static = false, $sticky = false, $draft = false, $scheduled = false)
{
$list = array();
foreach ($this->db as $key=>$fields) {
if ($published && $fields['type']=='published') {
foreach ($this->db as $key => $fields) {
if ($published && $fields['type'] == 'published') {
array_push($list, $key);
} elseif ($static && $fields['type']=='static') {
} elseif ($static && $fields['type'] == 'static') {
array_push($list, $key);
} elseif ($sticky && $fields['type']=='sticky') {
} elseif ($sticky && $fields['type'] == 'sticky') {
array_push($list, $key);
} elseif ($draft && $fields['type']=='draft') {
} elseif ($draft && $fields['type'] == 'draft') {
array_push($list, $key);
} elseif ($scheduled && $fields['type']=='scheduled') {
} elseif ($scheduled && $fields['type'] == 'scheduled') {
array_push($list, $key);
}
}
if ($numberOfItems==-1) {
if ($numberOfItems == -1) {
return $list;
}
@ -558,8 +564,8 @@ class Pages extends dbJSON {
$total = count($list);
$init = (int) $numberOfItems * $realPageNumber;
$end = (int) min( ($init + $numberOfItems - 1), $total );
$outrange = $init<0 ? true : $init>$end;
$end = (int) min(($init + $numberOfItems - 1), $total);
$outrange = $init < 0 ? true : $init > $end;
if (!$outrange) {
return array_slice($list, $init, $numberOfItems, true);
}
@ -570,7 +576,7 @@ class Pages extends dbJSON {
// Returns the amount of pages
// (boolean) $onlyPublished, TRUE returns the total of published pages (without draft and scheduled)
// (boolean) $onlyPublished, FALSE returns the total of pages
public function count($onlyPublished=true)
public function count($onlyPublished = true)
{
if ($onlyPublished) {
$db = $this->getPublishedDB(false);
@ -584,7 +590,7 @@ class Pages extends dbJSON {
public function getParents()
{
$db = $this->getPublishedDB();
foreach ($db as $key=>$pageKey) {
foreach ($db as $key => $pageKey) {
// if the key has slash then is a child
if (Text::stringContains($pageKey, '/')) {
unset($db[$key]);
@ -597,8 +603,8 @@ class Pages extends dbJSON {
{
$tmp = $this->db;
$list = array();
foreach ($tmp as $key=>$fields) {
if (Text::startsWith($key, $parentKey.'/')) {
foreach ($tmp as $key => $fields) {
if (Text::startsWith($key, $parentKey . '/')) {
array_push($list, $key);
}
}
@ -607,16 +613,16 @@ class Pages extends dbJSON {
public function sortBy()
{
if (ORDER_BY=='date') {
if (ORDER_BY == 'date') {
return $this->sortByDate(true);
}
return $this->sortByPosition(false);
}
// Sort pages by position
public function sortByPosition($HighToLow=false)
public function sortByPosition($HighToLow = false)
{
if($HighToLow) {
if ($HighToLow) {
uasort($this->db, array($this, 'sortByPositionHighToLow'));
} else {
uasort($this->db, array($this, 'sortByPositionLowToHigh'));
@ -626,17 +632,30 @@ class Pages extends dbJSON {
private function sortByPositionLowToHigh($a, $b)
{
return $a['position']>$b['position'];
if ($a['position'] < $b['position']) {
return -1;
} elseif ($a['position'] > $b['position']) {
return 1;
} else {
return 0;
}
}
private function sortByPositionHighToLow($a, $b)
{
return $a['position']<$b['position'];
if ($a['position'] > $b['position']) {
return -1;
} elseif ($a['position'] < $b['position']) {
return 1;
} else {
return 0;
}
}
// Sort pages by date
public function sortByDate($HighToLow=true)
public function sortByDate($HighToLow = true)
{
if($HighToLow) {
if ($HighToLow) {
uasort($this->db, array($this, 'sortByDateHighToLow'));
} else {
uasort($this->db, array($this, 'sortByDateLowToHigh'));
@ -646,15 +665,16 @@ class Pages extends dbJSON {
private function sortByDateLowToHigh($a, $b)
{
return $a['date']>$b['date'];
return $a['date'] > $b['date'];
}
private function sortByDateHighToLow($a, $b)
{
return $a['date']<$b['date'];
return $a['date'] < $b['date'];
}
function generateUUID() {
return md5( uniqid().time() );
function generateUUID()
{
return md5(uniqid() . time());
}
// Returns the UUID of a page, by the page key
@ -670,8 +690,8 @@ class Pages extends dbJSON {
// if the UUID doesn't exits returns FALSE
function getByUUID($uuid)
{
foreach ($this->db as $key=>$value) {
if ($value['uuid']==$uuid) {
foreach ($this->db as $key => $value) {
if ($value['uuid'] == $uuid) {
return $key;
}
}
@ -680,7 +700,7 @@ class Pages extends dbJSON {
// Returns string without HTML tags and truncated
private function generateSlug($text, $truncateLength=60)
private function generateSlug($text, $truncateLength = 60)
{
$tmpslug = Text::removeHTMLTags($text);
$tmpslug = Text::removeLineBreaks($tmpslug);
@ -696,25 +716,24 @@ class Pages extends dbJSON {
$saveDatabase = false;
// The database need to be sorted by date
foreach($this->db as $pageKey=>$fields) {
if($fields['type']=='scheduled') {
if($fields['date']<=$currentDate) {
foreach ($this->db as $pageKey => $fields) {
if ($fields['type'] == 'scheduled') {
if ($fields['date'] <= $currentDate) {
$this->db[$pageKey]['type'] = 'published';
$saveDatabase = true;
}
}
elseif( ($fields['type']=='published') && (ORDER_BY=='date') ) {
} elseif (($fields['type'] == 'published') && (ORDER_BY == 'date')) {
break;
}
}
if($saveDatabase) {
if( $this->save() === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
if ($saveDatabase) {
if ($this->save() === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to save the database file.');
return false;
}
Log::set(__METHOD__.LOG_SEP.'New pages published from the scheduler.');
Log::set(__METHOD__ . LOG_SEP . 'New pages published from the scheduler.');
return true;
}
@ -722,7 +741,7 @@ class Pages extends dbJSON {
}
// Generate a valid Key/Slug
public function generateKey($text, $parent=false, $returnSlug=false, $oldKey='')
public function generateKey($text, $parent = false, $returnSlug = false, $oldKey = '')
{
global $L;
global $site;
@ -734,7 +753,7 @@ class Pages extends dbJSON {
if (Text::isEmpty($parent)) {
$newKey = Text::cleanUrl($text);
} else {
$newKey = Text::cleanUrl($parent).'/'.Text::cleanUrl($text);
$newKey = Text::cleanUrl($parent) . '/' . Text::cleanUrl($text);
}
// cleanURL can return empty string
@ -742,14 +761,14 @@ class Pages extends dbJSON {
$newKey = $L->g('empty');
}
if ($newKey!==$oldKey) {
if ($newKey !== $oldKey) {
// Verify if the key is already been used
if (isset($this->db[$newKey])) {
$i = 0;
while (isset($this->db[$newKey.'-'.$i])) {
while (isset($this->db[$newKey . '-' . $i])) {
$i++;
}
$newKey = $newKey.'-'.$i;
$newKey = $newKey . '-' . $i;
}
}
@ -786,8 +805,8 @@ class Pages extends dbJSON {
// Change all pages with the old category key to the new category key
public function changeCategory($oldCategoryKey, $newCategoryKey)
{
foreach ($this->db as $key=>$value) {
if ($value['category']===$oldCategoryKey) {
foreach ($this->db as $key => $value) {
if ($value['category'] === $oldCategoryKey) {
$this->db[$key]['category'] = $newCategoryKey;
}
}
@ -804,8 +823,8 @@ class Pages extends dbJSON {
if (json_last_error() != JSON_ERROR_NONE) {
return false;
}
foreach ($this->db as $pageKey=>$pageFields) {
foreach ($customFields as $customField=>$customValues) {
foreach ($this->db as $pageKey => $pageFields) {
foreach ($customFields as $customField => $customValues) {
if (!isset($pageFields['custom'][$customField])) {
$defaultValue = '';
if (isset($customValues['default'])) {
@ -818,6 +837,4 @@ class Pages extends dbJSON {
return $this->save();
}
}

View file

@ -1,6 +1,7 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Page {
class Page
{
protected $vars;
@ -12,19 +13,19 @@ class Page {
// If key is FALSE, the page is create with default values, like an empty page
// Useful for Page Not Found
if ($key===false) {
if ($key === false) {
$row = $pages->getDefaultFields();
} else {
if (Text::isEmpty($key) || !$pages->exists($key)) {
$errorMessage = 'Page not found in database by key ['.$key.']';
Log::set(__METHOD__.LOG_SEP.$errorMessage);
$errorMessage = 'Page not found in database by key [' . $key . ']';
Log::set(__METHOD__ . LOG_SEP . $errorMessage);
throw new Exception($errorMessage);
}
$row = $pages->getPageDB($key);
}
foreach ($row as $field=>$value) {
if ($field=='date') {
foreach ($row as $field => $value) {
if ($field == 'date') {
$this->setField('dateRaw', $value);
} else {
$this->setField($field, $value);
@ -49,10 +50,10 @@ class Page {
// Returns the raw content
// This content is not markdown parser
// (boolean) $sanitize, TRUE returns the content sanitized
public function contentRaw($sanitize=false)
public function contentRaw($sanitize = false)
{
$key = $this->key();
$filePath = PATH_PAGES.$key.DS.FILENAME;
$filePath = PATH_PAGES . $key . DS . FILENAME;
$contentRaw = file_get_contents($filePath);
if ($sanitize) {
@ -64,7 +65,7 @@ class Page {
// Returns the full content
// This content is markdown parser
// (boolean) $sanitize, TRUE returns the content sanitized
public function content($sanitize=false)
public function content($sanitize = false)
{
// If already set the content, return it
$content = $this->getValue('content');
@ -83,7 +84,7 @@ class Page {
// Parse img src relative to absolute (with domain)
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
$domain = IMAGE_RESTRICT?DOMAIN_UPLOADS_PAGES.$this->uuid().'/':DOMAIN_UPLOADS;
$domain = IMAGE_RESTRICT ? DOMAIN_UPLOADS_PAGES . $this->uuid() . '/' : DOMAIN_UPLOADS;
$content = Text::imgRel2Abs($content, $domain);
}
@ -96,7 +97,7 @@ class Page {
// Returns the first part of the content if the content is splited, otherwise is returned the full content
// This content is markdown parser
// (boolean) $sanitize, TRUE returns the content sanitized
public function contentBreak($sanitize=false)
public function contentBreak($sanitize = false)
{
$content = $this->content($sanitize);
$explode = explode(PAGE_BREAK, $content);
@ -104,10 +105,10 @@ class Page {
}
// Returns the date according to locale settings and the format defined in the system
public function date($format=false)
public function date($format = false)
{
$dateRaw = $this->dateRaw();
if ($format===false) {
if ($format === false) {
global $site;
$format = $site->dateFormat();
}
@ -122,10 +123,10 @@ class Page {
}
// Returns the date according to locale settings and format settings
public function dateModified($format=false)
public function dateModified($format = false)
{
$dateRaw = $this->getValue('dateModified');
if ($format===false) {
if ($format === false) {
global $site;
$format = $site->dateFormat();
}
@ -146,16 +147,16 @@ class Page {
// Returns the permalink
// (boolean) $absolute, TRUE returns the page link with the DOMAIN, FALSE without the DOMAIN
public function permalink($absolute=true)
public function permalink($absolute = true)
{
// Get the key of the page
$key = $this->key();
if($absolute) {
return DOMAIN_PAGES.$key;
if ($absolute) {
return DOMAIN_PAGES . $key;
}
return HTML_PATH_ROOT.PAGE_URI_FILTER.$key;
return HTML_PATH_ROOT . PAGE_URI_FILTER . $key;
}
// Returns the previous page key
@ -199,7 +200,7 @@ class Page {
// Returns the category permalink
public function categoryPermalink()
{
return DOMAIN_CATEGORIES.$this->categoryKey();
return DOMAIN_CATEGORIES . $this->categoryKey();
}
// Returns the field from the array
@ -210,9 +211,9 @@ class Page {
$categoryKey = $this->categoryKey();
$map = $categories->getMap($categoryKey);
if ($field=='key') {
if ($field == 'key') {
return $this->categoryKey();
} elseif(isset($map[$field])) {
} elseif (isset($map[$field])) {
return $map[$field];
}
@ -220,7 +221,7 @@ class Page {
}
// Returns the user object or passing the method returns the object User method
public function user($method=false)
public function user($method = false)
{
$username = $this->username();
try {
@ -248,7 +249,7 @@ class Page {
// Returns the tags separated by comma
// (boolean) $returnsArray, TRUE to get the tags as an array, FALSE to get the tags separated by comma
// The tags in array format returns array( tagKey => tagName )
public function tags($returnsArray=false)
public function tags($returnsArray = false)
{
$tags = $this->getValue('tags');
if ($returnsArray) {
@ -267,7 +268,7 @@ class Page {
public function json($returnsArray=false)
public function json($returnsArray = false)
{
$tmp['key'] = $this->key();
$tmp['title'] = $this->title();
@ -297,7 +298,7 @@ class Page {
// Returns the endpoint of the coverimage, FALSE if the page doesn't have a cover image
// (boolean) $absolute, TRUE returns the complete URL, FALSE returns the filename
// If the user defined an external cover image the function returns it
public function coverImage($absolute=true)
public function coverImage($absolute = true)
{
$filename = $this->getValue('coverImage');
if (empty($filename)) {
@ -311,9 +312,9 @@ class Page {
if ($absolute) {
if (IMAGE_RESTRICT) {
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/'.$filename;
return DOMAIN_UPLOADS_PAGES . $this->uuid() . '/' . $filename;
}
return DOMAIN_UPLOADS.$filename;
return DOMAIN_UPLOADS . $filename;
}
return $filename;
@ -323,7 +324,7 @@ class Page {
public function thumbCoverImage()
{
$filename = $this->coverImage(false);
if ($filename==false) {
if ($filename == false) {
return false;
}
@ -333,9 +334,9 @@ class Page {
}
if (IMAGE_RESTRICT) {
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/thumbnails/'.$filename;
return DOMAIN_UPLOADS_PAGES . $this->uuid() . '/thumbnails/' . $filename;
}
return DOMAIN_UPLOADS_THUMBNAILS.$filename;
return DOMAIN_UPLOADS_THUMBNAILS . $filename;
}
// Returns TRUE if the content has the text splited
@ -359,37 +360,37 @@ class Page {
// (boolean) Returns TRUE if the page is published, FALSE otherwise
public function published()
{
return ($this->getValue('type')==='published');
return ($this->getValue('type') === 'published');
}
// (boolean) Returns TRUE if the page is scheduled, FALSE otherwise
public function scheduled()
{
return ($this->getValue('type')==='scheduled');
return ($this->getValue('type') === 'scheduled');
}
// (boolean) Returns TRUE if the page is draft, FALSE otherwise
public function draft()
{
return ($this->getValue('type')=='draft');
return ($this->getValue('type') == 'draft');
}
// (boolean) Returns TRUE if the page is autosave, FALSE otherwise
public function autosave()
{
return ($this->getValue('type')=='autosave');
return ($this->getValue('type') == 'autosave');
}
// (boolean) Returns TRUE if the page is sticky, FALSE otherwise
public function sticky()
{
return ($this->getValue('type')=='sticky');
return ($this->getValue('type') == 'sticky');
}
// (boolean) Returns TRUE if the page is static, FALSE otherwise
public function isStatic()
{
return ($this->getValue('type')=='static');
return ($this->getValue('type') == 'static');
}
// (string) Returns type of the page
@ -460,7 +461,7 @@ class Page {
// Returns TRUE if the page is a parent, has or not children
public function isParent()
{
return $this->parentKey()===false;
return $this->parentKey() === false;
}
// Returns the parent method output, if the page doesn't have a parent returns FALSE
@ -482,7 +483,7 @@ class Page {
// Returns TRUE if the page is a child, FALSE otherwise
public function isChild()
{
return $this->parentKey()!==false;
return $this->parentKey() !== false;
}
// Returns TRUE if the page has children
@ -519,7 +520,8 @@ class Page {
}
// Returns the amount of minutes takes to read the page
public function readingTime() {
public function readingTime()
{
global $L;
$words = $this->content(true);
@ -528,11 +530,11 @@ class Page {
$average = $words / 200;
$minutes = round($average);
if ($minutes>1) {
return $minutes.' '.$L->get('minutes');
if ($minutes > 1) {
return $minutes . ' ' . $L->get('minutes');
}
return '~1 '.$L->get('minute');
return '~1 ' . $L->get('minute');
}
// Returns relative time (e.g. "1 minute ago")
@ -540,42 +542,50 @@ class Page {
// Modified for Bludit
// $complete = false : short version
// $complete = true : full version
public function relativeTime($complete = false) {
$current = new DateTime;
$past = new DateTime($this->getValue('dateRaw'));
$elapsed = $current->diff($past);
public function relativeTime($complete = false)
{
$current = new DateTime;
$past = new DateTime($this->getValue('dateRaw'));
$elapsed = $current->diff($past);
// Calculate weeks separately
$weeks = floor($elapsed->d / 7);
$elapsed->d -= $weeks * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => $weeks,
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
$elapsed->w = floor($elapsed->d / 7);
$elapsed->d -= $elapsed->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
foreach($string as $key => &$value) {
if($elapsed->$key) {
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : ' ');
} else {
unset($string[$key]);
}
}
if(!$complete) {
$string = array_slice($string, 0 , 1);
}
return $string ? implode(', ', $string) . ' ago' : 'Just now';
}
foreach ($string as $key => &$value) {
if ($key == 'w') {
if ($weeks > 0) {
$value = $weeks . ' week' . ($weeks > 1 ? 's' : '');
} else {
unset($string[$key]);
}
} elseif ($elapsed->$key) {
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : '');
} else {
unset($string[$key]);
}
}
if (!$complete) {
$string = array_slice($string, 0, 1);
}
return $string ? implode(', ', $string) . ' ago' : 'Just now';
}
// Returns the value from the field, false if the fields doesn't exists
// If you set the $option as TRUE, the function returns an array with all the values of the field
public function custom($field, $options=false)
public function custom($field, $options = false)
{
if (isset($this->vars['custom'][$field])) {
if ($options) {
@ -588,14 +598,17 @@ class Page {
// Returns an array with all pages key related to the page
// The relation is based on the tags
public function related() {
public function related()
{
global $tags;
$pageTags = $this->tags(true);
$list = array();
// For each tag get the list of related pages
foreach ($pageTags as $tagKey=>$tagName) {
foreach ($pageTags as $tagKey => $tagName) {
$pagesRelated = $tags->getList($tagKey, 1, -1);
$list = array_merge($list, $pagesRelated);
if (is_array($pagesRelated)) {
$list = array_merge($list, $pagesRelated);
}
}
// Remove duplicates

View file

@ -32,6 +32,7 @@ class Site extends dbJSON
'gitlab' => '',
'linkedin' => '',
'xing' => '',
'telegram' => '',
'mastodon' => '',
'dribbble' => '',
'vk' => '',
@ -193,6 +194,11 @@ class Site extends dbJSON
return $this->getField('xing');
}
public function telegram()
{
return $this->getField('telegram');
}
public function mastodon()
{
return $this->getField('mastodon');

View file

@ -1,6 +1,7 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class User {
class User
{
protected $vars;
function __construct($username)
@ -9,18 +10,18 @@ class User {
$this->vars['username'] = $username;
if ($username===false) {
if ($username === false) {
$row = $users->getDefaultFields();
} else {
if (Text::isEmpty($username) || !$users->exists($username)) {
$errorMessage = 'User not found in the database by username ['.$username.']';
Log::set(__METHOD__.LOG_SEP.$errorMessage);
$errorMessage = 'User not found in the database by username [' . $username . ']';
Log::set(__METHOD__ . LOG_SEP . $errorMessage);
throw new Exception($errorMessage);
}
$row = $users->getUserDB($username);
}
foreach ($row as $field=>$value) {
foreach ($row as $field => $value) {
$this->setField($field, $value);
}
}
@ -145,6 +146,11 @@ class User {
return $this->getValue('xing');
}
public function telegram()
{
return $this->getValue('xing');
}
public function mastodon()
{
return $this->getValue('mastodon');
@ -157,14 +163,14 @@ class User {
public function profilePicture()
{
$filename = $this->getValue('username').'.png';
if (!file_exists(PATH_UPLOADS_PROFILES.$filename)) {
$filename = $this->getValue('username') . '.png';
if (!file_exists(PATH_UPLOADS_PROFILES . $filename)) {
return false;
}
return DOMAIN_UPLOADS_PROFILES.$filename;
return DOMAIN_UPLOADS_PROFILES . $filename;
}
public function json($returnsArray=false)
public function json($returnsArray = false)
{
$tmp['username'] = $this->username();
$tmp['firstName'] = $this->firstName();
@ -179,6 +185,7 @@ class User {
$tmp['gitlab'] = $this->gitlab();
$tmp['linkedin'] = $this->linkedin();
$tmp['xing'] = $this->xing();
$tmp['telegram'] = $this->telegram();
$tmp['mastodon'] = $this->mastodon();
$tmp['vk'] = $this->vk();
$tmp['profilePicture'] = $this->profilePicture();
@ -189,5 +196,4 @@ class User {
return json_encode($tmp);
}
}
}

397
bl-languages/lt.json Normal file
View file

@ -0,0 +1,397 @@
{
"language-data": {
"native": "Lietuvių",
"english-name": "Lithuanian",
"locale": "lt, lt_LT",
"last-update": "2024-07-19",
"authors": [
"Kristupas Grigas @kurisotofaa purelypost.com",
"",
"",
""
]
},
"dates": {
"Mon": "P",
"Tue": "A",
"Wed": "T",
"Thu": "K",
"Fri": "Pn",
"Sat": "Š",
"Sun": "S",
"Monday": "Pirmadienis",
"Tuesday": "Antradienis",
"Wednesday": "Trečiadienis",
"Thursday": "Ketvirtadienis",
"Friday": "Penktadienis",
"Saturday": "Šeštadienis",
"Sunday": "Sekmadienis",
"Jan": "Sau",
"Feb": "Vas",
"Mar": "Kov",
"Apr": "Bal",
"Jun": "Bir",
"Jul": "Lie",
"Aug": "Rgp",
"Sep": "Rgs",
"Oct": "Spa",
"Nov": "Lap",
"Dec": "Gru",
"January": "Sausis",
"February": "Vasaris",
"March": "Kovas",
"April": "Balandis",
"May": "Gegužė",
"June": "Birželis",
"July": "Liepa",
"August": "Rugpjūtis",
"September": "Rugsėjis",
"October": "Spalis",
"November": "Lapkritis",
"December": "Gruodis"
},
"dashboard": "prietaisų skydelis",
"manage-users": "Valdyti naudotojus",
"manage-categories": "Valdyti kategorijas",
"general-settings": "bendrieji nustatymai",
"advanced-settings": "išplėstiniai nustatymai",
"thanks-for-supporting-bludit": "Ačiū, kad palaikote Bludit",
"upgrade-to-bludit-pro": "Atnaujinti į Bludit PRO",
"language": "Kalba",
"plugin": "Įskiepis",
"plugins": "Įskiepiai",
"developers": "Kūrėjai",
"themes": "Temos",
"about": "Apie",
"url": "URL",
"welcome": "Sveiki atvykę",
"logout": "Atsijungti",
"website": "Svetainė",
"publish": "Paskelbti",
"manage": "Valdyti",
"content": "Turinys",
"category": "Kategorija",
"categories": "Kategorijos",
"users": "Naudotojai",
"settings": "Settings",
"general": "Bendrieji",
"advanced": "Išplėstinai",
"new-content": "Naujas turinys",
"manage-content": "Valdyti turinį",
"add-new-content": "Pridėti naujo turinio",
"new-category": "Nauja kategorija",
"you-do-not-have-sufficient-permissions": "Neturite pakankamų leidimų",
"add-a-new-user": "Pridėti naują naudotoją",
"url-associated-with-the-content": "su turiniu susietas URL adresas.",
"language-and-timezone": "Kalba ir laiko zona",
"change-your-language-and-region-settings": "Pakeisk tavo kalbą ir regiono nustatymus",
"notifications": "Pranešimai",
"plugin-activated": "Įskiepis aktyvuotas",
"plugin-deactivated": "Įskiepis išjungtas",
"new-theme-configured": "Nauja tema sukonfiguruota",
"settings-changes": "Nustatymų keitimai",
"plugin-configured": "Įskiepis sukonfiguruotas",
"welcome-to-bludit": "Sveiki atvykę į Bludit",
"statistics": "Statistikos",
"drafts": "Juodraščiai",
"title": "Antraštė",
"save": "Išsaugoti",
"save-as-draft": "Išsaugoti kaip juodraštį",
"cancel": "Atšaukti",
"description": "Aprašymas",
"this-field-can-help-describe-the-content": "Šis laukas gali padėti keliais žodžiais apibūdinti turinį.",
"images": "Nuotraukos",
"error": "Klaida",
"supported-image-file-types": "Palaikomi nuotraukų failų tipai",
"cover-image": "Viršelio vaizdas",
"drag-and-drop-or-click-here": "Vilkite ir nuleiskite arba spustelėkite čia",
"there-are-no-images": "Nėra nuotraukų",
"upload-and-more-images": "Įkėlimas ir daugiau nuotraukų",
"click-on-the-image-for-options": "Spustelėkite paveikslėlį, kad pamatytumėte parinktis.",
"click-here-to-cancel": "Spustelėkite čia ir atšaukite",
"insert-image": "Įterpti nuotrauką",
"set-as-cover-image": "Nustatyti kaip viršelio vaizdą",
"delete-image": "Ištrinti nuotrauką",
"tags": "Žymės",
"add": "Pridėti",
"status": "Statusas",
"published": "Paskelbta",
"draft": "Juodraštis",
"empty-title": "Tuščia antraštė",
"empty": "tuščia",
"date": "Data",
"external-cover-image": "Išorinis viršelio vaizdas",
"parent": "Pagrindinis",
"full-image-url": "Pilnas nuotraukos URL adresas.",
"this-field-is-used-when-you-order-the-content-by-position": "Šis laukas naudojamas, kai turinį rikiuojate pagal poziciją.",
"position": "Pozicija",
"friendly-url": "Draugiškas URL adresas",
"image-description": "Nuotraukos aprašymas",
"add-a-new-category": "Pridėti naują kategoriją",
"name": "Vardas",
"username": "Prisijungimo vardas",
"first-name": "Pirmas Vardas",
"last-name": "Pavardė",
"to-schedule-the-content-select-the-date-and-time": "Norėdami suplanuoti turinį, pasirinkite datą ir laiką, būseną reikia nustatyti į \"paskelbta\".",
"email": "El. Paštas",
"role": "Rolė",
"registered": "Prisiregistruota",
"site-information": "Svetainės informacija",
"site-title": "Svetainės antraštė",
"use-this-field-to-name-your-site": "Naudokite šį lauką svetainei pavadinti.",
"site-slogan": "Svetainės šūkis",
"use-this-field-to-add-a-catchy-phrase": "Šį lauką naudokite norėdami į svetainę įtraukti patrauklią frazę.",
"site-description": "Svetainės aprašymas",
"you-can-add-a-site-description-to-provide": "Šį lauką naudokite norėdami į svetainę įtraukti patrauklią frazę.",
"footer-text": "Tekstas apačioje",
"you-can-add-a-small-text-on-the-bottom": "Kiekvieno puslapio apačioje galite pridėti nedidelį tekstą, pvz., autorių teises, savininką, datas ir pan.",
"social-networks-links": "Socialinių tinklų nuorodos",
"site-url": "Svetainės URL adresas",
"email-account-settings": "El. pašto paskyros nustatymai",
"sender-email": "Siuntėjo el. paštas",
"emails-will-be-sent-from-this-address": "El. laiškai bus sunčiami iš šio adreso",
"url-filters": "URL adreso filtrai",
"select-your-sites-language": "Pasirinkite jūsų svetainės kalbą",
"timezone": "Laiko zona",
"select-a-timezone-for-a-correct": "Pasirinkite laiko zona teisingąi datai\/laiko parodymui jūsų svetainėje.",
"locale": "Vietovė",
"date-and-time-formats": "Datos ir laiko formatai",
"date-format": "Datos formatas",
"current-format": "Dabartinis formatas",
"version": "Versija",
"author": "Autorius",
"activate": "Aktyvuoti",
"deactivate": "Išjungti",
"edit-category": "Pakeisti kategoriją",
"delete": "Ištrinti",
"password": "Slaptažodis",
"confirm-password": "Patvirtinti slaptažodį",
"editor": "Redaktorius",
"administrator": "Administratorius",
"edit-user": "Pakeisti naudotoją",
"edit-content": "Pakeisti turinį",
"profile": "Profilis",
"change-password": "Pakeisti slaptažodį",
"enabled": "Įjungtas",
"disable-the-user": "Išjungti naudotoją",
"profile-picture": "Profilio nuotrauką",
"edit-or-delete-your-categories": "Pakeisti ar ištrinti jūsų kategorijas",
"create-a-new-category-to-organize-your-content": "Sukurti naują kategoriją tūrinio organizavimui",
"confirm-delete-this-action-cannot-be-undone": "Patvirtinkite ištrynimą, šio veiksmo atšaukti negalima.",
"do-you-want-to-disable-the-user": "Ar norite išjungti naudotoją ?",
"new-password": "Naujas slaptažodis",
"you-can-change-this-field-when-save-the-current-changes": "Šį lauką galite pakeisti, kai išsaugosite esamus pakeitimus.",
"items-per-page": "Elementai per puslapį",
"invite-a-friend-to-collaborate-on-your-site": "Pakvieskite draugą bendradarbiauti savo svetainėje",
"number-of-items-to-show-per-page": "Viename puslapyje rodomų elementų skaičius, -1 reiškia visus elementus.",
"website-or-blog": "Svetainė ar tinklaraštis",
"order-content-by": "Rikiuoti turinį pagal",
"edit-or-delete-content-from-your-site": "Redaguokite arba ištrinkite svetainės turinį",
"order-the-content-by-date-to-build-a-blog": "Jei norite sukurti tinklaraštį, sudėliokite turinį pagal datą, o jei norite sukurti svetainę, sudėliokite turinį pagal poziciją.",
"page-not-found-content": "Atrodo, kad šis puslapis neegzistuoja.",
"page-not-found": "Puslapis nerastas",
"predefined-pages": "Iš anksto nustatyti puslapiai",
"returning-page-when-the-page-doesnt-exist": "Puslapio grąžinimas, kai puslapis neegzistuoja, pagal numatytuosius nustatymus grąžinamas numatytasis pranešimas.",
"returning-page-for-the-main-page": "Pagal numatytuosius nustatymus pagrindiniame puslapyje rodomas naujausio turinio eiliškumas pagal datą arba poziciją.",
"full-url-of-your-site": "Pilnas jūsų svetainės URL adresas. Nurodykite HTTP arba HTTPS protokolą (tik jei serveryje įjungėte SSL).",
"with-the-locales-you-can-set-the-regional-user-interface": "Naudodami vietines sąsajas galite nustatyti regioninę naudotojo sąsają, pvz., datas savo kalba. Vietovės turi būti įdiegtos jūsų sistemoje.",
"bludit-installer": "Bludit Instaliuotojas",
"choose-your-language": "Pasirinkite kalbą",
"next": "Toliau",
"complete-the-form-choose-a-password-for-the-username-admin": "Pabaik formą, pasirink slaptažodį naudotojo vardui <b>< admin ><\/b>",
"show-password": "Parodyti slaptažodį",
"install": "Instaliuoti",
"login": "Prisijungti",
"back-to-login-form": "Grįžti į prisijungimo formą",
"get-login-access-code": "Gaukite prisijungimo prieigos kodą",
"email-access-code": "El. pašto prieigos kodas",
"whats-next": "Kas toliau",
"username-or-password-incorrect": "Prisijungimo vardas ar slaptažodis neteisingas",
"follow-bludit-on": "Sekite Bludit",
"this-is-a-brief-description-of-yourself-our-your-site": "Tai trumpas jūsų arba jūsų svetainės aprašymas, norėdami pakeisti šį tekstą, eikite į administratoriaus skydelį, nustatymus, įskiepius ir sukonfigūruokite įskiepį \"apie\".",
"new-version-available": "Nauja versija pasiekiama",
"new-category-created": "Nauja kategorija sukurta",
"category-deleted": "Kategorija ištrinta",
"category-edited": "Kategorija redaguota",
"new-user-created": "Naujas naudotojas sukurtas",
"user-edited": "Naudotojas redaguotas",
"user-deleted": "Naudotojas ištrintas",
"recommended-for-recovery-password-and-notifications": "Rekomenduojama naudoti slaptažodžio atkūrimui ir pranešimams.",
"authentication-token": "Autentifikavimo žetonas",
"token": "Žetonas",
"current-status": "Dabartinis statusas",
"upload-image": "Įkelti nuotrauką",
"the-changes-have-been-saved": "Pakeitimai išsaugoti",
"label": "Etiketė",
"links": "Nuorodos",
"this-title-is-almost-always-used-in-the-sidebar-of-the-site": "Šis pavadinimas beveik visada naudojamas svetainės šoninėje juostoje.",
"password-must-be-at-least-6-characters-long": "Slaptažodis turi būti bent 6 simbolių ilgio",
"ip-address-has-been-blocked": "IP addresas užblokuotas",
"try-again-in-a-few-minutes": "Pabandykite už kelių minučių",
"content-published-from-scheduler": "Iš tvarkaraščio sudarytojo skelbiamas turinys",
"blog": "Tinklaraštis",
"complete-all-fields": "Užpildykite visus laukelius",
"static": "Statinis",
"about-your-site-or-yourself": "Apie svetainę arba jus",
"homepage": "Pagrindinis puslapis",
"disabled": "Išjungta",
"to-enable-the-user-you-must-set-a-new-password": "Norėdami įjungti naudotoją, turite nustatyti naują slaptažodį.",
"delete-the-user-and-associate-his-content-to-admin-user": "Ištrinkite naudotoją ir susiekite jo turinį su administratoriaus naudotoju",
"delete-the-user-and-all-his-content": "Ištrinkite naudotoją ir visą jo turinį",
"user-disabled": "Naudotojas išjungtas",
"user-password-changed": "Naudotojo slaptažodis pakeistas",
"the-password-and-confirmation-password-do-not-match": "Nesutampa slaptažodis ir patvirtinimo slaptažodis",
"scheduled-content": "Suplanuotas turinys",
"there-are-no-scheduled-content": "Nėra suplanuoto turinio",
"new-content-created": "Naujas turinys sukurtas",
"content-edited": "Turinys redaguotas",
"content-deleted": "Turinys ištrintas",
"undefined": "Neapibrėžta",
"create-new-content-for-your-site": "Sukurkite naujo turinio jūsų svetainei",
"order-items-by": "Rušiuoti elementus pagal",
"all-content": "Visas turinys",
"dynamic": "Dinaminis",
"type": "Tipas",
"draft-content": "Juodraštinis turinys",
"post": "Paštas",
"default": "Numatytasis",
"latest-content": "Naujausias turinys",
"default-message": "Numatyta žinutė",
"no-parent": "Jokio pagrindo",
"have-you-seen-my-ball": "Matei mano kamuolį?",
"pagebreak": "Puslapio pertrauka",
"pages": "Puslapiai",
"this-plugin-may-not-be-supported-by-this-version-of-bludit": "Šis įskiepis gali būti nepalaikomas šios Bludit versijos",
"previous": "Praeitas",
"previous-page": "Praeitas puslapis",
"next-page": "Kitas puslapis",
"scheduled": "Suplanuota",
"this-token-is-similar-to-a-password-it-should-not-be-shared": "Šis žetonas yra panašus į slaptažodį, juo neturėtų būti dalijamasi.",
"congratulations-you-have-successfully-installed-your-bludit": "Sveikinimai, jūs instaliavote savo Bludit",
"this-theme-may-not-be-supported-by-this-version-of-bludit": "Ši tema gali būti nepalaikoma šios Bludit versijos",
"read-more": "Skaityti daugiau",
"remember-me": "Prisiminti mane",
"plugins-position": "Įskepio pozicija",
"plugins-sorted": "Surušiuoti įskiepiai",
"plugins-position-changed": "Įskiepio pozicija pakeista",
"drag-and-drop-to-set-the-position-of-the-plugin": "Vilkite ir nuleiskite, kad nustatytumėte įskiepių poziciją",
"change-the-position-of-the-plugins": "Pakeisti įskiepių poziciją",
"reading-time": "Skaitymo laikas",
"minutes": "Minučių",
"minute": "Minutė",
"example-page-1-slug": "sukurk-tavo-turini",
"example-page-1-title": "Sukurk tavo turinį",
"example-page-1-content": "Pradėkite rašyti savo turinį arba redaguokite esamą, kad jis atitiktų jūsų poreikius. Norėdami sukurti, redaguoti ar pašalinti turinį, turite prisijungti prie <a href=\".\/admin\/\">administratoriaus skydelio<\/a> su vartotojo vardu `admin` ir slaptažodžiu, kurį nustatėte diegimo metu.",
"example-page-2-slug": "konfiguruok-tavo-svetaine",
"example-page-2-title": "Konfiguruok tavo svetainę",
"example-page-2-content": "Atnaujinkite svetainės nustatymus iš <a href=\".\/admin\/\">administratoriaus skydelio<\/a>, pavadinimą, aprašymą ir socialinius tinklus galite pakeisti iš <a href=\".\/admin\/settings\">Nustatymai > Bendrieji<\/a>.",
"example-page-3-slug": "sekite-bludit",
"example-page-3-title": "Sekite Bludit",
"example-page-3-content": "Gaukite informaciją apie naujienas, naujus leidinius, naujas temas ar naujus įskiepius mūsų socialiniuose tinkluose <a href=\"https:\/\/www.facebook.com\/bluditcms\/\" target=\"_blank\">Facebook<\/a>, <a href=\"https:\/\/www.twitter.com\/bludit\/\" target=\"_blank\">Twitter<\/a> and <a href=\"https:\/\/www.youtube.com\/c\/Bluditcms\" target=\"_blank\">YouTube<\/a> arba apsilankykite mūsų <a href=\"https:\/\/blog.bludit.com\" target=\"_blank\">Tinklaraštyje<\/a>.",
"example-page-4-slug": "apie",
"example-page-4-title": "Apie",
"example-page-4-content": "Puslapis „Apie“ paprastai yra vienas iš labiausiai lankomų jūsų svetainės puslapių, jis turi būti paprastas, jame turi būti keli pagrindiniai dalykai, pvz., jūsų vardas ir pavardė, kas esate, kaip su jumis susisiekti, nedidelė istorija ir pan.",
"the-extension-zip-is-not-installed": "Zip plėtinys nėra įdiegtas, norėdami naudoti šį įskiepį, turite įdiegti plėtinį.",
"there-are-no-sticky-pages-at-this-moment": "Šiuo metu lipnių puslapių nėra.",
"there-are-no-scheduled-pages-at-this-moment": "Šiuo metu nėra suplanuotų puslapių.",
"update": "Atnaujinimas",
"template": "Šablonas",
"nickname": "Slapyvardis",
"disable-user": "Išjungti naudotoją",
"delete-user-and-keep-content": "Ištrinti naudotoją ir palikti turinį",
"delete-user-and-delete-content": "Ištrinti naudotoją ir ištrinti turinį (Įspėjimas)",
"social-networks": "Socialiniai tinklai",
"interval": "Laikotarpis",
"number-in-minutes-for-every-execution-of-autosave": "Kiekvieno automatinio išsaugojimo vykdymo skaičius minutėmis.",
"extreme-friendly-url": "Ekstremalus draugiškas URL",
"title-formats": "Pavadinimo formatai",
"delete-content": "Ištrinti turinį",
"are-you-sure-you-want-to-delete-this-page": "Ar tikrai norite ištrinti šį puslapį?",
"sticky": "Lipnus",
"actions": "Veiksmai",
"edit": "Redaguoti",
"options": "Pasirinkimai",
"enter-title": "Įvesti pavadinimą",
"media-manager": "Vaizdų valdymas",
"set-a-cover-image-from-external-url,-such-as-a-cdn-or-some-server-dedicated-for-images": "Nustatykite viršelio paveikslėlį iš išorinio URL adreso, pvz., CDN arba kokio nors vaizdams skirto serverio.",
"user": "Naudotojas",
"date-format-format": "Datos formatas: <code>MMMM-MėnMėn-DD Valandos:Minutės:Sekundės<\/code>",
"start-typing-a-page-title-to-see-a-list-of-suggestions": "Pradėkite rašyti puslapio pavadinimą ir pamatysite pasiūlymų sąrašą.",
"field-used-when-ordering-content-by-position": "Laukas, naudojamas rušiuojant turinį pagal poziciją.",
"write-a-template-name-to-filter-the-page-in-the-theme-and-change-the-style-of-the-page": "Įrašykite šablono pavadinimą, kad filtruotumėte puslapį temoje ir pakeistumėte puslapio stilių.",
"write-the-tags-separated-by-commas": "Įrašykite kableliais atskirtas žymas.",
"apply-code-noindex-code-to-this-page": "Taikyti <code>noindex<\/code> šiam puslapiui.",
"this-tells-search-engines-not-to-show-this-page-in-their-search-results": "Tai nurodo paieškos sistemoms nerodyti šio puslapio paieškos rezultatuose.",
"apply-code-nofollow-code-to-this-page": "Taikyti <code>nofollow<\/code> šiam puslapiui.",
"this-tells-search-engines-not-to-follow-links-on-this-page": "Tai nurodo paieškos sistemoms nesekti šio puslapio nuorodų.",
"apply-code-noarchive-code-to-this-page": "Taikyti <code>noarchive<\/code> šiam puslapiui.",
"this-tells-search-engines-not-to-save-a-cached-copy-of-this-page": "Tai nurodo paieškos sistemoms nesaugoti šio puslapio spartinančiosios kopijos.",
"uncategorized": "Be kategorijos",
"done": "Baigta",
"delete-category": "Delete category",
"are-you-sure-you-want-to-delete-this-category?": "Ar tikrai norite ištrinti šią kategoriją?",
"confirm-new-password": "Patvirtinti naują slaptažodį",
"the-nickname-is-almost-used-in-the-themes-to-display-the-author-of-the-content": "Slapyvardis beveik naudojamas temose turinio autoriui rodyti",
"allow-unicode": "Leisti Unicode",
"allow-unicode-characters-in-the-url-and-some-part-of-the-system": "URL ir kai kuriose sistemos dalyse leiskite naudoti „Unicode“ simbolius.",
"variables-allowed": "Kintamieji leidžiami",
"tag": "Žyma",
"drag-and-drop-to-sort-the-plugins": "Norėdami rūšiuoti įskiepius, vilkite ir nuleiskite.",
"seo": "SEO",
"documentation": "Dokumentacija",
"forum-support": "Forumo pagalba",
"chat-support": "Susirašinėjimo pagalba",
"quick-links": "Greitos nuorodos",
"leave-empty-for-autocomplete-by-bludit": "Palikite tuščią, jei norite, kad Bludit atliktų automatinį užbaigimą.",
"choose-a-password-for-the-user-admin": "Pasirinkite slaptažodį naudotojui <code>admin<\/code>",
"access-denied": "Prieiga nesuteikta",
"choose-images-to-upload": "Pasirinkite nuotraukas įkėlimui",
"insert": "Įterpti",
"upload": "Įkelti",
"autosave": "Automatiškai išsaugoti",
"the-content-is-saved-as-a-draft-to-publish-it": "Šis turinys išsaugotas kaip juodraštis. Norėdami jį paskelbti, spustelėkite mygtuką <b>Paskelbti<\/b> arba, jei vis dar dirbate, spustelėkite <b>Išsaugoti kaip juodraštį<\/b>.",
"site": "Svetainė",
"first": "Pirmas",
"last": "Paskutinys",
"there-are-no-pages-at-this-moment": "Šiuo momentu nėra jokių puslapių.",
"there-are-no-static-pages-at-this-moment": "Šiuo momentu nėra statinių puslapių.",
"there-are-no-draft-pages-at-this-moment": "Šiuo momentu nėra juodraščių-puslapių.",
"good-morning": "Labas rytas",
"good-afternoon": "Laba diena",
"good-evening": "Labas vakaras",
"good-night": "Labanakt",
"hello": "Labas",
"there-are-no-images-for-the-page": "Nėra nuotraukų puslapiui.",
"select-cover-image": "Pasirinkti viršelio vaizdą",
"this-plugin-depends-on-the-following-plugins": "Šis įskiepis priklauso nuo šių įskiepių.",
"no-pages-found": "Nerasta puslapių.",
"system-updated": "Systema atnaujinta.",
"security": "Saugumas",
"remove-cover-image": "Panaikinti viršelio vaizdą",
"width": "Plotis",
"height": "Aukštis",
"quality": "Kokybė",
"thumbnails": "Viršelio vaizdai",
"thumbnail": "Viršelio vaizdas",
"thumbnail-width-in-pixels": "Viršelio vaizdo plotis pikseliais (px).",
"thumbnail-height-in-pixels": "Viršelio vaizdo aukštis pikseliais (px).",
"thumbnail-quality-in-percentage": "TViršelio vaizdo kokybė procentais (%).",
"maximum-load-file-size-allowed:": "Didžiausias leidžiamas failo įkelimo dydis:",
"file-type-is-not-supported": "Failo tipas nepalaikomas. Leidžiami tipai:",
"page-content": "Puslapio turinys",
"markdown-parser": "Markdown analizatorius",
"site-logo": "Svetainės logotipas",
"search": "Paieška",
"search-plugins": "Ieškoti įskiepių",
"enabled-plugins": "Įjungti įskiepiai",
"disabled-plugins": "Išjungti įskiepiai",
"remove-logo": "Ištrinti logotipą",
"preview": "Peržiurėti",
"author-can-write-and-edit-their-own-content": "autorius: Gali rašyti ir redaguoti savo turinį. Redaktorius: Gali rašyti ir redaguoti kitų turinį.",
"custom-fields": "Pasirinktiniai laukai",
"define-custom-fields-for-the-content": "Apibrėžkite pasirinktinius turinio laukus. Daugiau informacijos apie pasirinktinius laukus rasite <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>dokumentacijoje<\/a>.",
"start-typing-to-see-a-list-of-suggestions": "Pradėkite rašyti, kad pamatytumėte pasiūlymų sąrašą.",
"view": "Žiūrėti",
"insert-thumbnail": "Įterpti viršelio vaizdą",
"insert-linked-thumbnail": "Įterpti susietą viršelio vaizdą"
}

View file

@ -3,11 +3,11 @@
"native": "Русский (Россия)",
"english-name": "Russian",
"locale": "ru, ru_RU",
"last-update": "2018-08-20",
"last-update": "2023-09-20",
"authors": [
"Сергей Ворон https:\/\/voron.pw",
"Макс Костиков https:\/\/kostikov.co",
"Paul https:\/\/paul.bid",
"Paul Bid (Павел Бид) https:\/\/paul.bid",
""
]
},
@ -183,7 +183,7 @@
"you-can-change-this-field-when-save-the-current-changes": "Вы сможете изменить это поле после того, как сохраните текущие настройки.",
"items-per-page": "Записей на странице",
"invite-a-friend-to-collaborate-on-your-site": "Пригласить друга для совместной работы на сайте",
"number-of-items-to-show-per-page": "Количество записей, отображаемых на странице.",
"number-of-items-to-show-per-page": "Количество записей, отображаемых на странице, -1 отобразит все записи.",
"website-or-blog": "«Веб-сайт» или «Блог»",
"order-content-by": "Сортировать записи по",
"edit-or-delete-content-from-your-site": "Редактировать или удалить запись на Вашем сайте",

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,12 +1,13 @@
<?php
class pluginAbout extends Plugin {
class pluginAbout extends Plugin
{
public function init()
{
$this->dbFields = array(
'label'=>'About',
'text'=>''
'label' => 'About',
'text' => ''
);
}
@ -19,14 +20,14 @@ class pluginAbout extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('About').'</label>';
$html .= '<textarea name="text" id="jstext">'.$this->getValue('text').'</textarea>';
$html .= '<label>' . $L->get('About') . '</label>';
$html .= '<textarea name="text" id="jstext">' . $this->getValue('text') . '</textarea>';
$html .= '</div>';
return $html;
@ -35,12 +36,12 @@ class pluginAbout extends Plugin {
public function siteSidebar()
{
$html = '<div class="plugin plugin-about">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= html_entity_decode(nl2br($this->getValue('text')));
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -0,0 +1,13 @@
{
"plugin-data": {
"name": "Настройки темы Alternative",
"description": "Этот плагин содержит настройки для темы Alternative."
},
"enable-or-disable-dark-mode": "Включить или выключить тёмный режим.",
"enable-or-disable-google-fonts": "Включить или выключить шрифты от Google (Google fonts).",
"relative": "Относительный",
"absolute": "Абсолютный",
"change-the-date-format-for-the-main-page": "Изменить формат даты для главной страницы.",
"show-tags": "Отображать теги",
"show-tags-in-the-main-page-for-each-article": "Показывать теги на главной странице для каждой записи."
}

View file

@ -2,10 +2,10 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"version": "3.16.2",
"releaseDate": "2023-07-10",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": "",
"type": "theme"
}

View file

@ -0,0 +1,11 @@
{
"plugin-data":
{
"name": "API",
"description": "Интерфейс для взаимодействия с Bludit по HTTP-протоколу.<br>Узнайте больше про этот плагин в разделе <a href=\"https://docs.bludit.com/en/api/introduction\">Введение в API для Bludit</a> (раздел на английском)."
},
"api-token": "API Tокен",
"amount-of-pages": "Количество страниц",
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Максимальное количество возвращаемых страниц при обращении к <code>/api/pages</code>",
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Данный токен используется только для чтения, токен обновляется при каждой переустановке плагина."
}

View file

@ -1,11 +0,0 @@
{
"plugin-data":
{
"name": "API",
"description": "Интерфейс для взаимодействия с Bludit по HTTP-протоколу. <br>Узнайте больше про этот плагин в разделе <a href=\"https://docs.bludit.com/en/api/introduction\">API Introduction</a>."
},
"api-token": "API Tокен",
"amount-of-pages": "Количество страниц",
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Максимальное количество возвращаемых страниц при обращении к /api/pages",
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Данный токен используется только для чтения, он обновляется при каждой переустановке плагина."
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,17 +1,18 @@
<?php
class pluginAPI extends Plugin {
class pluginAPI extends Plugin
{
private $method;
public function init()
{
// Generate the API Token
$token = md5( uniqid().time().DOMAIN );
$token = md5(uniqid() . time() . DOMAIN);
$this->dbFields = array(
'token'=>$token, // API Token
'numberOfItems'=>15 // Amount of items to return
'token' => $token, // API Token
'numberOfItems' => 15 // Amount of items to return
);
}
@ -29,28 +30,28 @@ class pluginAPI extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('URL').'</label>';
$html .= '<p class="text-muted">'.DOMAIN_BASE.'api/{endpoint}</p>';
$html .= '<label>' . $L->get('URL') . '</label>';
$html .= '<p class="text-muted">' . DOMAIN_BASE . 'api/{endpoint}</p>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('API Token').'</label>';
$html .= '<input name="token" type="text" value="'.$this->getValue('token').'">';
$html .= '<span class="tip">'.$L->get('This token is for read only and is regenerated every time you install the plugin').'</span>';
$html .= '<label>' . $L->get('API Token') . '</label>';
$html .= '<input name="token" type="text" dir="auto" value="' . $this->getValue('token') . '">';
$html .= '<span class="tip">' . $L->get('This token is for read only and is regenerated every time you install the plugin') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Amount of pages').'</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
$html .= '<span class="tip">'.$L->get('This is the maximum of pages to return when you call to').'</span>';
$html .= '<label>' . $L->get('Amount of pages') . '</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" dir="auto" value="' . $this->getValue('numberOfItems') . '">';
$html .= '<span class="tip">' . $L->get('This is the maximum of pages to return when you call to') . '</span>';
$html .= '</div>';
return $html;
}
// API HOOKS
// ----------------------------------------------------------------------------
// API HOOKS
// ----------------------------------------------------------------------------
public function beforeAll()
{
@ -60,8 +61,8 @@ class pluginAPI extends Plugin {
// CHECK URL
// ------------------------------------------------------------
$URI = $this->webhook('api', $returnsAfterURI=true, $fixed=false);
if ($URI===false) {
$URI = $this->webhook('api', $returnsAfterURI = true, $fixed = false);
if ($URI === false) {
return false;
}
@ -73,14 +74,14 @@ class pluginAPI extends Plugin {
// ------------------------------------------------------------
$inputs = $this->getMethodInputs();
if (empty($inputs)) {
$this->response(400, 'Bad Request', array('message'=>'Missing method inputs.'));
$this->response(400, 'Bad Request', array('message' => 'Missing method inputs.'));
}
// ENDPOINT PARAMETERS
// ------------------------------------------------------------
$parameters = $this->getEndpointParameters($URI);
if (empty($parameters)) {
$this->response(400, 'Bad Request', array('message'=>'Missing endpoint parameters.'));
$this->response(400, 'Bad Request', array('message' => 'Missing endpoint parameters.'));
}
// API TOKEN
@ -90,12 +91,12 @@ class pluginAPI extends Plugin {
// Check empty token
if (empty($inputs['token'])) {
$this->response(400, 'Bad Request', array('message'=>'Missing API token.'));
$this->response(400, 'Bad Request', array('message' => 'Missing API token.'));
}
// Check if the token is valid
if ($inputs['token']!==$tokenAPI) {
$this->response(401, 'Unauthorized', array('message'=>'Invalid API token.'));
if ($inputs['token'] !== $tokenAPI) {
$this->response(401, 'Unauthorized', array('message' => 'Invalid API token.'));
}
// AUTHENTICATION TOKEN
@ -105,10 +106,10 @@ class pluginAPI extends Plugin {
// Get the user with the authentication token, FALSE if doesn't exit
$username = $users->getByAuthToken($inputs['authentication']);
if ($username!==false) {
if ($username !== false) {
try {
$user = new User($username);
if (($user->role()=='admin') && ($user->enabled())) {
if (($user->role() == 'admin') && ($user->enabled())) {
// Loggin the user to create the session
$login = new Login();
$login->setLogin($username, 'admin');
@ -130,89 +131,88 @@ class pluginAPI extends Plugin {
// ------------------------------------------------------------
// (GET) /api/pages
if ( ($method==='GET') && ($parameters[0]==='pages') && empty($parameters[1]) ) {
if (($method === 'GET') && ($parameters[0] === 'pages') && empty($parameters[1])) {
$data = $this->getPages($inputs);
}
// (GET) /api/pages/<key>
elseif ( ($method==='GET') && ($parameters[0]==='pages') && !empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'pages') && !empty($parameters[1])) {
$pageKey = $parameters[1];
if (isset($parameters[2])) {
$pageKey = $parameters[1].'/'.$parameters[2];
$pageKey = $parameters[1] . '/' . $parameters[2];
}
$data = $this->getPage($pageKey);
}
// (PUT) /api/pages/<key>
elseif ( ($method==='PUT') && ($parameters[0]==='pages') && !empty($parameters[1]) && $writePermissions ) {
elseif (($method === 'PUT') && ($parameters[0] === 'pages') && !empty($parameters[1]) && $writePermissions) {
$pageKey = $parameters[1];
$data = $this->editPage($pageKey, $inputs);
}
// (DELETE) /api/pages/<key>
elseif ( ($method==='DELETE') && ($parameters[0]==='pages') && !empty($parameters[1]) && $writePermissions ) {
elseif (($method === 'DELETE') && ($parameters[0] === 'pages') && !empty($parameters[1]) && $writePermissions) {
$pageKey = $parameters[1];
$data = $this->deletePage($pageKey);
}
// (POST) /api/pages
elseif ( ($method==='POST') && ($parameters[0]==='pages') && empty($parameters[1]) && $writePermissions ) {
elseif (($method === 'POST') && ($parameters[0] === 'pages') && empty($parameters[1]) && $writePermissions) {
$data = $this->createPage($inputs);
}
// (GET) /api/settings
elseif ( ($method==='GET') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
elseif (($method === 'GET') && ($parameters[0] === 'settings') && empty($parameters[1]) && $writePermissions) {
$data = $this->getSettings();
}
// (PUT) /api/settings
elseif ( ($method==='PUT') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
elseif (($method === 'PUT') && ($parameters[0] === 'settings') && empty($parameters[1]) && $writePermissions) {
$data = $this->editSettings($inputs);
}
// (POST) /api/images
elseif ( ($method==='POST') && ($parameters[0]==='images') && $writePermissions ) {
elseif (($method === 'POST') && ($parameters[0] === 'images') && $writePermissions) {
$data = $this->uploadImage($inputs);
}
// (GET) /api/tags
elseif ( ($method==='GET') && ($parameters[0]==='tags') && empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'tags') && empty($parameters[1])) {
$data = $this->getTags();
}
// (GET) /api/tags/<key>
elseif ( ($method==='GET') && ($parameters[0]==='tags') && !empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'tags') && !empty($parameters[1])) {
$tagKey = $parameters[1];
$data = $this->getTag($tagKey);
}
// (GET) /api/categories
elseif ( ($method==='GET') && ($parameters[0]==='categories') && empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'categories') && empty($parameters[1])) {
$data = $this->getCategories();
}
// (GET) /api/categories/<key>
elseif ( ($method==='GET') && ($parameters[0]==='categories') && !empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'categories') && !empty($parameters[1])) {
$categoryKey = $parameters[1];
$data = $this->getCategory($categoryKey);
}
// (GET) /api/users
elseif ( ($method==='GET') && ($parameters[0]==='users') && empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'users') && empty($parameters[1])) {
$data = $this->getUsers();
}
// (GET) /api/users/<username>
elseif ( ($method==='GET') && ($parameters[0]==='users') && !empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'users') && !empty($parameters[1])) {
$username = $parameters[1];
$data = $this->getUser($username);
}
// (GET) /api/files/<page-key>
elseif ( ($method==='GET') && ($parameters[0]==='files') && !empty($parameters[1]) ) {
elseif (($method === 'GET') && ($parameters[0] === 'files') && !empty($parameters[1])) {
$pageKey = $parameters[1];
$data = $this->getFiles($pageKey);
}
// (POST) /api/files/<page-key>
elseif ( ($method==='POST') && ($parameters[0]==='files') && !empty($parameters[1]) ) {
elseif (($method === 'POST') && ($parameters[0] === 'files') && !empty($parameters[1])) {
$pageKey = $parameters[1];
$data = $this->uploadFile($pageKey);
}
else {
$this->response(401, 'Unauthorized', array('message'=>'Access denied or invalid endpoint.'));
} else {
$this->response(401, 'Unauthorized', array('message' => 'Access denied or invalid endpoint.'));
}
$this->response(200, 'OK', $data);
}
// PRIVATE METHODS
// ----------------------------------------------------------------------------
// PRIVATE METHODS
// ----------------------------------------------------------------------------
private function getMethod()
{
@ -229,7 +229,7 @@ class pluginAPI extends Plugin {
private function getMethodInputs()
{
switch($this->method) {
switch ($this->method) {
case "POST":
$inputs = $_POST;
break;
@ -259,12 +259,12 @@ class pluginAPI extends Plugin {
{
$tmp = array();
if (is_array($inputs)) {
foreach ($inputs as $key=>$value) {
foreach ($inputs as $key => $value) {
$tmp[$key] = Sanitize::html($value);
}
} elseif (is_string($inputs)) {
$tmp = json_decode($inputs, true);
if (json_last_error()!==JSON_ERROR_NONE) {
if (json_last_error() !== JSON_ERROR_NONE) {
$tmp = array();
}
}
@ -284,16 +284,16 @@ class pluginAPI extends Plugin {
$parameters = explode('/', $URI);
// Sanitize parameters
foreach ($parameters as $key=>$value) {
foreach ($parameters as $key => $value) {
$parameters[$key] = Sanitize::html($value);
}
return $parameters;
}
private function response($code=200, $message='OK', $data=array())
private function response($code = 200, $message = 'OK', $data = array())
{
header('HTTP/1.1 '.$code.' '.$message);
header('HTTP/1.1 ' . $code . ' ' . $message);
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$json = json_encode($data);
@ -304,9 +304,9 @@ class pluginAPI extends Plugin {
{
global $tags;
$tmp = array(
'status'=>'0',
'message'=>'List of tags.',
'data'=>array()
'status' => '0',
'message' => 'List of tags.',
'data' => array()
);
foreach ($tags->keys() as $key) {
$tag = $tags->getMap($key);
@ -323,8 +323,8 @@ class pluginAPI extends Plugin {
$tag = new Tag($key);
} catch (Exception $e) {
return array(
'status'=>'1',
'message'=>'Tag not found by the key: '.$key
'status' => '1',
'message' => 'Tag not found by the key: ' . $key
);
}
@ -332,17 +332,18 @@ class pluginAPI extends Plugin {
foreach ($tag->pages() as $pageKey) {
try {
$page = new Page($pageKey);
array_push($list, $page->json($returnsArray=true));
} catch (Exception $e){}
array_push($list, $page->json($returnsArray = true));
} catch (Exception $e) {
}
}
$data = $tag->json($returnsArray=true);
$data = $tag->json($returnsArray = true);
$data['pages'] = $list;
return array(
'status'=>'0',
'message'=>'Information about the tag and pages related.',
'data'=>$data
'status' => '0',
'message' => 'Information about the tag and pages related.',
'data' => $data
);
}
@ -351,22 +352,22 @@ class pluginAPI extends Plugin {
global $pages;
// Parameters and the default values
$published = (isset($args['published'])?$args['published']=='true':true);
$static = (isset($args['static'])?$args['static']=='true':false);
$draft = (isset($args['draft'])?$args['draft']=='true':false);
$sticky = (isset($args['sticky'])?$args['sticky']=='true':false);
$scheduled = (isset($args['scheduled'])?$args['scheduled']=='true':false);
$untagged = (isset($args['untagged'])?$args['untagged']=='true':false);
$published = (isset($args['published']) ? $args['published'] == 'true' : true);
$static = (isset($args['static']) ? $args['static'] == 'true' : false);
$draft = (isset($args['draft']) ? $args['draft'] == 'true' : false);
$sticky = (isset($args['sticky']) ? $args['sticky'] == 'true' : false);
$scheduled = (isset($args['scheduled']) ? $args['scheduled'] == 'true' : false);
$untagged = (isset($args['untagged']) ? $args['untagged'] == 'true' : false);
$numberOfItems = (isset($args['numberOfItems'])?$args['numberOfItems']:10);
$pageNumber = (isset($args['pageNumber'])?$args['pageNumber']:1);
$numberOfItems = (isset($args['numberOfItems']) ? $args['numberOfItems'] : 10);
$pageNumber = (isset($args['pageNumber']) ? $args['pageNumber'] : 1);
$list = $pages->getList($pageNumber, $numberOfItems, $published, $static, $sticky, $draft, $scheduled);
$tmp = array(
'status'=>'0',
'message'=>'List of pages',
'numberOfItems'=>$numberOfItems,
'data'=>array()
'status' => '0',
'message' => 'List of pages',
'numberOfItems' => $numberOfItems,
'data' => array()
);
foreach ($list as $pageKey) {
@ -374,12 +375,12 @@ class pluginAPI extends Plugin {
// Create the page object from the page key
$page = new Page($pageKey);
if ($untagged) {
if (empty($page->tags())) {
if (empty($page->tags())) {
// Push the page to the data array for the response
array_push($tmp['data'], $page->json($returnsArray=true));
array_push($tmp['data'], $page->json($returnsArray = true));
}
} else{
array_push($tmp['data'], $page->json($returnsArray=true));
} else {
array_push($tmp['data'], $page->json($returnsArray = true));
}
} catch (Exception $e) {
// Continue
@ -394,14 +395,14 @@ class pluginAPI extends Plugin {
try {
$page = new Page($key);
return array(
'status'=>'0',
'message'=>'Page filtered by key: '.$key,
'data'=>$page->json( $returnsArray=true )
'status' => '0',
'message' => 'Page filtered by key: ' . $key,
'data' => $page->json($returnsArray = true)
);
} catch (Exception $e) {
return array(
'status'=>'1',
'message'=>'Page not found.'
'status' => '1',
'message' => 'Page not found.'
);
}
}
@ -415,17 +416,17 @@ class pluginAPI extends Plugin {
// This function is defined on functions.php
$key = createPage($args);
if ($key===false) {
if ($key === false) {
return array(
'status'=>'1',
'message'=>'Error trying to create the new page.'
'status' => '1',
'message' => 'Error trying to create the new page.'
);
}
return array(
'status'=>'0',
'message'=>'Page created.',
'data'=>array('key'=>$key)
'status' => '0',
'message' => 'Page created.',
'data' => array('key' => $key)
);
}
@ -439,17 +440,17 @@ class pluginAPI extends Plugin {
$args['key'] = $key;
$newKey = editPage($args);
if ($newKey===false) {
if ($newKey === false) {
return array(
'status'=>'1',
'message'=>'Error trying to edit the page.'
'status' => '1',
'message' => 'Error trying to edit the page.'
);
}
return array(
'status'=>'0',
'message'=>'Page edited.',
'data'=>array('key'=>$newKey)
'status' => '0',
'message' => 'Page edited.',
'data' => array('key' => $newKey)
);
}
@ -457,14 +458,14 @@ class pluginAPI extends Plugin {
{
if (deletePage($key)) {
return array(
'status'=>'0',
'message'=>'Page deleted.'
'status' => '0',
'message' => 'Page deleted.'
);
}
return array(
'status'=>'1',
'message'=>'Error trying to delete the page.'
'status' => '1',
'message' => 'Error trying to delete the page.'
);
}
@ -482,10 +483,10 @@ class pluginAPI extends Plugin {
{
// Set upload directory
if (isset($inputs['uuid']) && IMAGE_RESTRICT) {
$imageDirectory = PATH_UPLOADS_PAGES.$inputs['uuid'].DS;
$thumbnailDirectory = $imageDirectory.'thumbnails'.DS;
$imageEndpoint = DOMAIN_UPLOADS_PAGES.$inputs['uuid'].'/';
$thumbnailEndpoint = $imageEndpoint.'thumbnails'.'/';
$imageDirectory = PATH_UPLOADS_PAGES . $inputs['uuid'] . DS;
$thumbnailDirectory = $imageDirectory . 'thumbnails' . DS;
$imageEndpoint = DOMAIN_UPLOADS_PAGES . $inputs['uuid'] . '/';
$thumbnailEndpoint = $imageEndpoint . 'thumbnails' . '/';
if (!Filesystem::directoryExists($thumbnailDirectory)) {
Filesystem::mkdir($thumbnailDirectory, true);
}
@ -498,36 +499,36 @@ class pluginAPI extends Plugin {
if (!isset($_FILES['image'])) {
return array(
'status'=>'1',
'message'=>'No image sent.'
'status' => '1',
'message' => 'No image sent.'
);
}
if ($_FILES['image']['error'] != 0) {
return array(
'status'=>'1',
'message'=>'Error uploading the image, maximum load file size allowed: '.ini_get('upload_max_filesize')
'status' => '1',
'message' => 'Error uploading the image, maximum load file size allowed: ' . ini_get('upload_max_filesize')
);
}
// Move from PHP tmp file to Bludit tmp directory
Filesystem::mv($_FILES['image']['tmp_name'], PATH_TMP.$_FILES['image']['name']);
Filesystem::mv($_FILES['image']['tmp_name'], PATH_TMP . $_FILES['image']['name']);
// Transform image and create thumbnails
$image = transformImage(PATH_TMP.$_FILES['image']['name'], $imageDirectory, $thumbnailDirectory);
$image = transformImage(PATH_TMP . $_FILES['image']['name'], $imageDirectory, $thumbnailDirectory);
if ($image) {
$filename = Filesystem::filename($image);
return array(
'status'=>'0',
'message'=>'Image uploaded.',
'image'=>$imageEndpoint.$filename,
'thumbnail'=>$thumbnailEndpoint.$filename
'status' => '0',
'message' => 'Image uploaded.',
'image' => $imageEndpoint . $filename,
'thumbnail' => $thumbnailEndpoint . $filename
);
}
return array(
'status'=>'1',
'message'=>'Image extension not allowed.'
'status' => '1',
'message' => 'Image extension not allowed.'
);
}
@ -542,9 +543,9 @@ class pluginAPI extends Plugin {
{
global $site;
return array(
'status'=>'0',
'message'=>'Settings.',
'data'=>$site->get()
'status' => '0',
'message' => 'Settings.',
'data' => $site->get()
);
}
@ -560,13 +561,13 @@ class pluginAPI extends Plugin {
{
if (editSettings($args)) {
return array(
'status'=>'0',
'message'=>'Settings edited.'
'status' => '0',
'message' => 'Settings edited.'
);
}
return array(
'status'=>'1',
'message'=>'Error trying to edit the settings.'
'status' => '1',
'message' => 'Error trying to edit the settings.'
);
}
@ -581,9 +582,9 @@ class pluginAPI extends Plugin {
{
global $categories;
$tmp = array(
'status'=>'0',
'message'=>'List of categories.',
'data'=>array()
'status' => '0',
'message' => 'List of categories.',
'data' => array()
);
foreach ($categories->keys() as $key) {
$category = $categories->getMap($key);
@ -607,8 +608,8 @@ class pluginAPI extends Plugin {
$category = new Category($key);
} catch (Exception $e) {
return array(
'status'=>'1',
'message'=>'Category not found by the key: '.$key
'status' => '1',
'message' => 'Category not found by the key: ' . $key
);
}
@ -616,17 +617,18 @@ class pluginAPI extends Plugin {
foreach ($category->pages() as $pageKey) {
try {
$page = new Page($pageKey);
array_push($list, $page->json($returnsArray=true));
} catch (Exception $e){}
array_push($list, $page->json($returnsArray = true));
} catch (Exception $e) {
}
}
$data = $category->json($returnsArray=true);
$data = $category->json($returnsArray = true);
$data['pages'] = $list;
return array(
'status'=>'0',
'message'=>'Information about the category and pages related.',
'data'=>$data
'status' => '0',
'message' => 'Information about the category and pages related.',
'data' => $data
);
}
@ -643,16 +645,16 @@ class pluginAPI extends Plugin {
$user = new User($username);
} catch (Exception $e) {
return array(
'status'=>'1',
'message'=>'User not found by username: '.$username
'status' => '1',
'message' => 'User not found by username: ' . $username
);
}
$data = $user->json($returnsArray=true);
$data = $user->json($returnsArray = true);
return array(
'status'=>'0',
'message'=>'User profile.',
'data'=>$data
'status' => '0',
'message' => 'User profile.',
'data' => $data
);
}
@ -665,19 +667,19 @@ class pluginAPI extends Plugin {
{
global $users;
$data = array();
foreach ($users->db as $username=>$profile) {
foreach ($users->db as $username => $profile) {
try {
$user = new User($username);
$data[$username] = $user->json($returnsArray=true);
$data[$username] = $user->json($returnsArray = true);
} catch (Exception $e) {
continue;
}
}
return array(
'status'=>'0',
'message'=>'Users profiles.',
'data'=>$data
'status' => '0',
'message' => 'Users profiles.',
'data' => $data
);
}
@ -690,19 +692,19 @@ class pluginAPI extends Plugin {
{
$chunk = false;
$sortByDate = true;
$path = PATH_UPLOADS_PAGES.$pageKey.DS;
$path = PATH_UPLOADS_PAGES . $pageKey . DS;
$listFiles = Filesystem::listFiles($path, '*', '*', $sortByDate, $chunk);
$files = array();
foreach ($listFiles as $file) {
$info = array('thumbnail'=>'');
$info = array('thumbnail' => '');
$info['file'] = $file;
$info['filename'] = basename($file);
$info['mime'] = Filesystem::mimeType($file);
$info['size'] = Filesystem::getSize($file);
// Check if thumbnail exists for the file
$thumbnail = $path.'thumbnails'.DS.$info['filename'];
$thumbnail = $path . 'thumbnails' . DS . $info['filename'];
if (Filesystem::fileExists($thumbnail)) {
$info['thumbnail'] = $thumbnail;
}
@ -711,9 +713,9 @@ class pluginAPI extends Plugin {
}
return array(
'status'=>'0',
'message'=>'Files for the page key: '.$pageKey,
'data'=>$files
'status' => '0',
'message' => 'Files for the page key: ' . $pageKey,
'data' => $files
);
}
@ -731,34 +733,34 @@ class pluginAPI extends Plugin {
{
if (!isset($_FILES['file'])) {
return array(
'status'=>'1',
'message'=>'File not sent.'
'status' => '1',
'message' => 'File not sent.'
);
}
if ($_FILES['file']['error'] != 0) {
return array(
'status'=>'1',
'message'=>'Error uploading the file.'
'status' => '1',
'message' => 'Error uploading the file.'
);
}
$filename = $_FILES['file']['name'];
$absoluteURL = DOMAIN_UPLOADS_PAGES.$pageKey.DS.$filename;
$absolutePath = PATH_UPLOADS_PAGES.$pageKey.DS.$filename;
$absoluteURL = DOMAIN_UPLOADS_PAGES . $pageKey . DS . $filename;
$absolutePath = PATH_UPLOADS_PAGES . $pageKey . DS . $filename;
if (Filesystem::mv($_FILES['file']['tmp_name'], $absolutePath)) {
return array(
'status'=>'0',
'message'=>'File uploaded.',
'filename'=>$filename,
'absolutePath'=>$absolutePath,
'absoluteURL'=>$absoluteURL
'status' => '0',
'message' => 'File uploaded.',
'filename' => $filename,
'absolutePath' => $absolutePath,
'absoluteURL' => $absoluteURL
);
}
return array(
'status'=>'1',
'message'=>'Error moving the file to the final path.'
'status' => '1',
'message' => 'Error moving the file to the final path.'
);
}
}
}

View file

@ -0,0 +1,7 @@
{
"plugin-data":
{
"name": "Canonical",
"description": "Плагин для использоания канонических URL-адресов. Использование канонических URL-адресов может помочь сообщить поисковым системам, какие URL-адреса имеют идентичный контент."
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,13 +1,14 @@
<?php
class pluginCategories extends Plugin {
class pluginCategories extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Categories',
'hideCero'=>true
'label' => 'Categories',
'hideCero' => true
);
}
@ -21,16 +22,16 @@ class pluginCategories extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Hide Categories without content').'</label>';
$html .= '<label>' . $L->get('Hide Categories without content') . '</label>';
$html .= '<select name="hideCero">';
$html .= '<option value="true" '.($this->getValue('hideCero')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('hideCero')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('hideCero') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('hideCero') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
@ -45,27 +46,27 @@ class pluginCategories extends Plugin {
// HTML for sidebar
$html = '<div class="plugin plugin-categories">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= '<ul>';
// By default the database of categories are alphanumeric sorted
foreach ($categories->db as $key=>$fields) {
foreach ($categories->db as $key => $fields) {
$count = count($fields['list']);
if (!$this->getValue('hideCero') || $count>0) {
if (!$this->getValue('hideCero') || $count > 0) {
$html .= '<li>';
$html .= '<a href="'.DOMAIN_CATEGORIES.$key.'">';
$html .= '<a href="' . DOMAIN_CATEGORIES . $key . '">';
$html .= $fields['name'];
$html .= ' ('.count($fields['list']).')';
$html .= ' (' . count($fields['list']) . ')';
$html .= '</a>';
$html .= '</li>';
}
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,14 +1,15 @@
<?php
class pluginDisqus extends Plugin {
class pluginDisqus extends Plugin
{
public function init()
{
$this->dbFields = array(
'shortname'=>'',
'enablePages'=>true,
'enableStatic'=>true,
'enableSticky'=>true
'shortname' => '',
'enablePages' => true,
'enableStatic' => true,
'enableSticky' => true
);
}
@ -21,34 +22,34 @@ class pluginDisqus extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('disqus-shortname').'</label>';
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
$html .= '<span class="tip">'.$L->get('Get the shortname from the Disqus general settings').'</span>';
$html .= '<label>' . $L->get('disqus-shortname') . '</label>';
$html .= '<input name="shortname" id="jsshortname" type="text" dir="auto" value="' . $this->getValue('shortname') . '">';
$html .= '<span class="tip">' . $L->get('Get the shortname from the Disqus general settings') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('enable-disqus-on-pages').'</label>';
$html .= '<select name="enablePages">';
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$L->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$L->get('disabled').'</option>';
$html .= '</select>';
$html .= '<div>';
$html .= '<label>' . $L->get('enable-disqus-on-pages') . '</label>';
$html .= '<select name="enablePages">';
$html .= '<option value="true" ' . ($this->getValue('enablePages') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('enablePages') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('enable-disqus-on-static-pages').'</label>';
$html .= '<select name="enableStatic">';
$html .= '<option value="true" '.($this->getValue('enableStatic')===true?'selected':'').'>'.$L->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('enableStatic')===false?'selected':'').'>'.$L->get('disabled').'</option>';
$html .= '</select>';
$html .= '<div>';
$html .= '<label>' . $L->get('enable-disqus-on-static-pages') . '</label>';
$html .= '<select name="enableStatic">';
$html .= '<option value="true" ' . ($this->getValue('enableStatic') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('enableStatic') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('enable-disqus-on-sticky-pages').'</label>';
$html .= '<select name="enableSticky">';
$html .= '<option value="true" '.($this->getValue('enableSticky')===true?'selected':'').'>'.$L->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('enableSticky')===false?'selected':'').'>'.$L->get('disabled').'</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('enable-disqus-on-sticky-pages') . '</label>';
$html .= '<select name="enableSticky">';
$html .= '<option value="true" ' . ($this->getValue('enableSticky') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('enableSticky') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
return $html;
}
@ -63,7 +64,7 @@ class pluginDisqus extends Plugin {
return false;
}
if ($WHERE_AM_I==='page') {
if ($WHERE_AM_I === 'page') {
global $page;
if ($page->published() && $this->getValue('enablePages')) {
return $this->javascript();
@ -86,7 +87,7 @@ class pluginDisqus extends Plugin {
$pageID = $page->uuid();
$shortname = $this->getValue('shortname');
$code = <<<EOF
$code = <<<EOF
<!-- Disqus plugin -->
<div id="disqus_thread"></div>
<script>
@ -108,5 +109,4 @@ $code = <<<EOF
EOF;
return $code;
}
}

View file

@ -5,6 +5,6 @@
"version": "2.18.0",
"releaseDate": "2022-09-20",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,6 +1,7 @@
<?php
class plugineasyMDE extends Plugin {
class plugineasyMDE extends Plugin
{
// The plugin is going to be loaded in this views
private $loadOnViews = array(
@ -11,9 +12,9 @@ class plugineasyMDE extends Plugin {
public function init()
{
$this->dbFields = array(
'tabSize'=>'2',
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
'spellChecker'=>true
'tabSize' => '2',
'toolbar' => '"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
'spellChecker' => true
);
}
@ -22,20 +23,20 @@ class plugineasyMDE extends Plugin {
global $L;
$html = '<div>';
$html .= '<label>'.$L->get('toolbar').'</label>';
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getValue('toolbar').'">';
$html .= '<label>' . $L->get('toolbar') . '</label>';
$html .= '<input name="toolbar" id="jstoolbar" type="text" dir="auto" value="' . $this->getValue('toolbar') . '">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('tab-size').'</label>';
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getValue('tabSize').'">';
$html .= '<label>' . $L->get('tab-size') . '</label>';
$html .= '<input name="tabSize" id="jstabSize" type="text" dir="auto" value="' . $this->getValue('tabSize') . '">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('spell-checker').'</label>';
$html .= '<label>' . $L->get('spell-checker') . '</label>';
$html .= '<select name="spellChecker">';
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>'.$L->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>'.$L->get('disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('spellChecker') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('spellChecker') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
@ -64,15 +65,15 @@ class plugineasyMDE extends Plugin {
global $L;
$langImage = $L->g('Image description');
$spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
$spellCheckerEnable = $this->getValue('spellChecker') ? 'true' : 'false';
$tabSize = $this->getValue('tabSize');
$toolbar = Sanitize::htmlDecode($this->getValue('toolbar'));
$pageBreak = PAGE_BREAK;
// Javascript path and file
$jsEasyMDE = $this->domainPath().'js/easymde.min.js?version='.BLUDIT_VERSION;
$jsEasyMDE = $this->domainPath() . 'js/easymde.min.js?version=' . BLUDIT_VERSION;
return <<<EOF
return <<<EOF
<script charset="utf-8" src="$jsEasyMDE"></script>
<script>
var easymde = null;
@ -120,4 +121,4 @@ return <<<EOF
</script>
EOF;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,12 +1,13 @@
<?php
class pluginHitCounter extends Plugin {
class pluginHitCounter extends Plugin
{
public function init()
{
$this->dbFields = array(
'label'=>'Hit Counter',
'showUniqueVisitors'=>false
'label' => 'Hit Counter',
'showUniqueVisitors' => false
);
}
@ -34,17 +35,17 @@ class pluginHitCounter extends Plugin {
// Label of the plugin to show in the sidebar
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
// Form "select" element for enable or disable Unique visitors properties
$html .= '<div>';
$html .= '<label>'.$L->get('Show unique visitors').'</label>';
$html .= '<label>' . $L->get('Show unique visitors') . '</label>';
$html .= '<select name="showUniqueVisitors">';
$html .= '<option value="true" '.($this->getValue('showUniqueVisitors')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('showUniqueVisitors')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('showUniqueVisitors') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('showUniqueVisitors') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
@ -74,12 +75,12 @@ class pluginHitCounter extends Plugin {
// Show in the sidebar the number of visitors
$html = '<div class="plugin plugin-hit-counter">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= '<div class="counter">'.$counter.'</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="counter">' . $counter . '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,19 +1,20 @@
<?php
class pluginLinks extends Plugin {
class pluginLinks extends Plugin
{
public function init()
{
// JSON database
$jsondb = json_encode(array(
'Bludit'=>'https://www.bludit.com',
'Bludit PRO'=>'https://pro.bludit.com'
'Bludit' => 'https://www.bludit.com',
'Bludit PRO' => 'https://pro.bludit.com'
));
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Links',
'jsondb'=>$jsondb
'label' => 'Links',
'jsondb' => $jsondb
);
// Disable default Save and Cancel button
@ -32,20 +33,21 @@ class pluginLinks extends Plugin {
$links = json_decode($jsondb, true);
// Check if the user click on the button delete or add
if( isset($_POST['deleteLink']) ) {
if (isset($_POST['deleteLink'])) {
// Values from $_POST
$name = $_POST['deleteLink'];
// Delete the link from the array
unset($links[$name]);
}
elseif( isset($_POST['addLink']) ) {
} elseif (isset($_POST['addLink'])) {
// Values from $_POST
$name = $_POST['linkName'];
$url = $_POST['linkURL'];
// Check empty string
if( empty($name) ) { return false; }
if (empty($name)) {
return false;
}
// Add the link
$links[$name] = $url;
@ -69,52 +71,52 @@ class pluginLinks extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input name="label" class="form-control" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" class="form-control" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<button name="save" class="btn btn-primary my-2" type="submit">'.$L->get('Save').'</button>';
$html .= '<button name="save" class="btn btn-primary my-2" type="submit">' . $L->get('Save') . '</button>';
$html .= '</div>';
// New link, when the user click on save button this call the method post()
// and the new link is added to the database
$html .= '<h4 class="mt-3">'.$L->get('Add a new link').'</h4>';
$html .= '<h4 class="mt-3">' . $L->get('Add a new link') . '</h4>';
$html .= '<div>';
$html .= '<label>'.$L->get('Name').'</label>';
$html .= '<input name="linkName" type="text" class="form-control" value="" placeholder="Bludit">';
$html .= '<label>' . $L->get('Name') . '</label>';
$html .= '<input name="linkName" type="text" dir="auto" class="form-control" value="" placeholder="Bludit">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Url').'</label>';
$html .= '<input name="linkURL" type="text" class="form-control" value="" placeholder="https://www.bludit.com/">';
$html .= '<label>' . $L->get('Url') . '</label>';
$html .= '<input name="linkURL" type="text" dir="auto" class="form-control" value="" placeholder="https://www.bludit.com/">';
$html .= '</div>';
$html .= '<div>';
$html .= '<button name="addLink" class="btn btn-primary my-2" type="submit">'.$L->get('Add').'</button>';
$html .= '<button name="addLink" class="btn btn-primary my-2" type="submit">' . $L->get('Add') . '</button>';
$html .= '</div>';
// Get the JSON DB, getValue() with the option unsanitized HTML code
$jsondb = $this->getValue('jsondb', $unsanitized=false);
$jsondb = $this->getValue('jsondb', $unsanitized = false);
$links = json_decode($jsondb, true);
$html .= !empty($links) ? '<h4 class="mt-3">'.$L->get('Links').'</h4>' : '';
$html .= !empty($links) ? '<h4 class="mt-3">' . $L->get('Links') . '</h4>' : '';
foreach($links as $name=>$url) {
foreach ($links as $name => $url) {
$html .= '<div class="my-2">';
$html .= '<label>'.$L->get('Name').'</label>';
$html .= '<input type="text" class="form-control" value="'.$name.'" disabled>';
$html .= '<label>' . $L->get('Name') . '</label>';
$html .= '<input type="text" dir="auto" class="form-control" value="' . $name . '" disabled>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Url').'</label>';
$html .= '<input type="text" class="form-control" value="'.$url.'" disabled>';
$html .= '<label>' . $L->get('Url') . '</label>';
$html .= '<input type="text" dir="auto" class="form-control" value="' . $url . '" disabled>';
$html .= '</div>';
$html .= '<div>';
$html .= '<button name="deleteLink" class="btn btn-secondary my-2" type="submit" value="'.$name.'">'.$L->get('Delete').'</button>';
$html .= '<button name="deleteLink" class="btn btn-secondary my-2" type="submit" value="' . $name . '">' . $L->get('Delete') . '</button>';
$html .= '</div>';
}
@ -129,7 +131,7 @@ class pluginLinks extends Plugin {
// HTML for sidebar
$html = '<div class="plugin plugin-pages">';
if ($this->getValue('label')) {
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
}
$html .= '<div class="plugin-content">';
$html .= '<ul>';
@ -139,17 +141,17 @@ class pluginLinks extends Plugin {
$links = json_decode($jsondb);
// By default the database of categories are alphanumeric sorted
foreach( $links as $name=>$url ) {
foreach ($links as $name => $url) {
$html .= '<li>';
$html .= '<a href="'.$url.'">';
$html .= '<a href="' . $url . '">';
$html .= $name;
$html .= '</a>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,12 +1,13 @@
<?php
class pluginMaintenanceMode extends Plugin {
class pluginMaintenanceMode extends Plugin
{
public function init()
{
$this->dbFields = array(
'enable'=>false,
'message'=>'Temporarily down for maintenance.'
'enable' => false,
'message' => 'Temporarily down for maintenance.'
);
}
@ -19,16 +20,16 @@ class pluginMaintenanceMode extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Enable maintenance mode').'</label>';
$html .= '<label>' . $L->get('Enable maintenance mode') . '</label>';
$html .= '<select name="enable">';
$html .= '<option value="true" '.($this->getValue('enable')===true?'selected':'').'>Enabled</option>';
$html .= '<option value="false" '.($this->getValue('enable')===false?'selected':'').'>Disabled</option>';
$html .= '<option value="true" ' . ($this->getValue('enable') === true ? 'selected' : '') . '>Enabled</option>';
$html .= '<option value="false" ' . ($this->getValue('enable') === false ? 'selected' : '') . '>Disabled</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Message').'</label>';
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getValue('message').'">';
$html .= '<label>' . $L->get('Message') . '</label>';
$html .= '<input name="message" id="jsmessage" type="text" dir="auto" value="' . $this->getValue('message') . '">';
$html .= '</div>';
return $html;
@ -37,7 +38,7 @@ class pluginMaintenanceMode extends Plugin {
public function beforeAll()
{
if ($this->getValue('enable')) {
exit( $this->getValue('message') );
exit($this->getValue('message'));
}
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,14 +1,15 @@
<?php
class pluginNavigation extends Plugin {
class pluginNavigation extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Navigation',
'homeLink'=>true,
'numberOfItems'=>5
'label' => 'Navigation',
'homeLink' => true,
'numberOfItems' => 5
);
}
@ -22,24 +23,24 @@ class pluginNavigation extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Home link').'</label>';
$html .= '<label>' . $L->get('Home link') . '</label>';
$html .= '<select name="homeLink">';
$html .= '<option value="true" '.($this->getValue('homeLink')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('homeLink')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('homeLink') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('homeLink') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '<span class="tip">'.$L->get('Show the home link on the sidebar').'</span>';
$html .= '<span class="tip">' . $L->get('Show the home link on the sidebar') . '</span>';
$html .= '</div>';
if (ORDER_BY=='date') {
if (ORDER_BY == 'date') {
$html .= '<div>';
$html .= '<label>'.$L->get('Amount of items').'</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
$html .= '<label>' . $L->get('Amount of items') . '</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" dir="auto" value="' . $this->getValue('numberOfItems') . '">';
$html .= '</div>';
}
@ -60,7 +61,7 @@ class pluginNavigation extends Plugin {
// Print the label if not empty
$label = $this->getValue('label');
if (!empty($label)) {
$html .= '<h2 class="plugin-label">'.$label.'</h2>';
$html .= '<h2 class="plugin-label">' . $label . '</h2>';
}
$html .= '<div class="plugin-content">';
@ -74,7 +75,7 @@ class pluginNavigation extends Plugin {
}
// Pages order by position
if (ORDER_BY=='position') {
if (ORDER_BY == 'position') {
// Get parents
$parents = buildParentPages();
foreach ($parents as $parent) {
@ -116,9 +117,9 @@ class pluginNavigation extends Plugin {
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,13 +1,14 @@
<?php
class pluginOpenGraph extends Plugin {
class pluginOpenGraph extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'defaultImage'=>'',
'fbAppId'=>''
'defaultImage' => '',
'fbAppId' => ''
);
}
@ -20,15 +21,15 @@ class pluginOpenGraph extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Default image').'</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" value="'.$this->getValue('defaultImage').'" placeholder="https://">';
$html .= '<span class="tip">'.$L->g('set-a-default-image-for-content').'</span>';
$html .= '<label>' . $L->get('Default image') . '</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">';
$html .= '<span class="tip">' . $L->g('set-a-default-image-for-content') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Facebook App ID').'</label>';
$html .= '<input name="fbAppId" type="text" value="'.$this->getValue('fbAppId').'" placeholder="App ID">';
$html .= '<span class="tip">'.$L->g('set-your-facebook-app-id').'</span>';
$html .= '<label>' . $L->get('Facebook App ID') . '</label>';
$html .= '<input name="fbAppId" type="text" dir="auto" value="' . $this->getValue('fbAppId') . '" placeholder="App ID">';
$html .= '<span class="tip">' . $L->g('set-your-facebook-app-id') . '</span>';
$html .= '</div>';
return $html;
@ -43,53 +44,52 @@ class pluginOpenGraph extends Plugin {
global $content;
$og = array(
'locale' =>$site->locale(),
'type' =>'website',
'title' =>$site->title(),
'description' =>$site->description(),
'url' =>$site->url(),
'image' =>'',
'siteName' =>$site->title()
'locale' => $site->locale(),
'type' => 'website',
'title' => $site->title(),
'description' => $site->description(),
'url' => $site->url(),
'image' => '',
'siteName' => $site->title()
);
switch ($WHERE_AM_I) {
// The user filter by page
// The user filter by page
case 'page':
$og['type'] = 'article';
$og['title'] = $page->title();
$og['description'] = $page->description();
$og['url'] = $page->permalink($absolute=true);
$og['image'] = $page->coverImage($absolute=true);
$og['url'] = $page->permalink($absolute = true);
$og['image'] = $page->coverImage($absolute = true);
$pageContent = $page->content();
break;
// The user is in the homepage
// The user is in the homepage
default:
$pageContent = '';
if (Text::isNotEmpty($this->getValue('defaultImage'))) {
$og['image'] = $this->getValue('defaultImage');
}
elseif (isset($content[0]) ) {
$og['image'] = $content[0]->coverImage($absolute=true);
} elseif (isset($content[0])) {
$og['image'] = $content[0]->coverImage($absolute = true);
$pageContent = $content[0]->content();
}
break;
}
$html = PHP_EOL.'<!-- Open Graph -->'.PHP_EOL;
$html .= '<meta property="og:locale" content="'.$og['locale'].'">'.PHP_EOL;
$html .= '<meta property="og:type" content="'.$og['type'].'">'.PHP_EOL;
$html .= '<meta property="og:title" content="'.$og['title'].'">'.PHP_EOL;
$html .= '<meta property="og:description" content="'.$og['description'].'">'.PHP_EOL;
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
$html .= '<meta property="og:site_name" content="'.$og['siteName'].'">'.PHP_EOL;
$html = PHP_EOL . '<!-- Open Graph -->' . PHP_EOL;
$html .= '<meta property="og:locale" content="' . $og['locale'] . '">' . PHP_EOL;
$html .= '<meta property="og:type" content="' . $og['type'] . '">' . PHP_EOL;
$html .= '<meta property="og:title" content="' . $og['title'] . '">' . PHP_EOL;
$html .= '<meta property="og:description" content="' . $og['description'] . '">' . PHP_EOL;
$html .= '<meta property="og:url" content="' . $og['url'] . '">' . PHP_EOL;
$html .= '<meta property="og:site_name" content="' . $og['siteName'] . '">' . PHP_EOL;
// 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 = DOM::getFirstImage($pageContent);
if ($src!==false) {
if ($src !== false) {
$og['image'] = $src;
} else {
if (Text::isNotEmpty($this->getValue('defaultImage'))) {
@ -98,11 +98,10 @@ class pluginOpenGraph extends Plugin {
}
}
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
$html .= '<meta property="og:image" content="' . $og['image'] . '">' . PHP_EOL;
if (Text::isNotEmpty($this->getValue('fbAppId'))) {
$html .= '<meta property="fb:app_id" content="'. $this->getValue('fbAppId').'">'.PHP_EOL;
$html .= '<meta property="fb:app_id" content="' . $this->getValue('fbAppId') . '">' . PHP_EOL;
}
return $html;
}
}
}

View file

@ -2,10 +2,10 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"version": "3.16.2",
"releaseDate": "2023-07-10",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": "",
"type": "theme"
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com/plugin/remote-content",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,6 +1,7 @@
<?php
class pluginRemoteContent extends Plugin {
class pluginRemoteContent extends Plugin
{
public function init()
{
@ -9,8 +10,8 @@ class pluginRemoteContent extends Plugin {
// Key and value for the database of the plugin
$this->dbFields = array(
'webhook'=>$randomWebhook,
'source'=>''
'webhook' => $randomWebhook,
'source' => ''
);
}
@ -18,9 +19,9 @@ class pluginRemoteContent extends Plugin {
{
global $language;
if (extension_loaded('zip')===false) {
if (extension_loaded('zip') === false) {
$this->formButtons = false;
return '<div class="alert alert-success">'.$language->get('the-extension-zip-is-not-installed').'</div>';
return '<div class="alert alert-success">' . $language->get('the-extension-zip-is-not-installed') . '</div>';
}
$html = '<div class="alert alert-primary" role="alert">';
@ -28,21 +29,21 @@ class pluginRemoteContent extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$language->get('Webhook').'</label>';
$html .= '<input id="jswebhook" name="webhook" type="text" value="'.$this->getValue('webhook').'">';
$html .= '<span class="tip">'.DOMAIN_BASE.$this->getValue('webhook').'</span>';
$html .= '<label>' . $language->get('Webhook') . '</label>';
$html .= '<input id="jswebhook" name="webhook" type="text" dir="auto" value="' . $this->getValue('webhook') . '">';
$html .= '<span class="tip">' . DOMAIN_BASE . $this->getValue('webhook') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$language->get('Source').'</label>';
$html .= '<input id="jssource" name="source" type="text" value="'.$this->getValue('source').'" placeholder="https://">';
$html .= '<span class="tip">'.$language->get('Complete URL of the zip file').'</span>';
$html .= '<label>' . $language->get('Source') . '</label>';
$html .= '<input id="jssource" name="source" type="text" dir="auto" value="' . $this->getValue('source') . '" placeholder="https://">';
$html .= '<span class="tip">' . $language->get('Complete URL of the zip file') . '</span>';
$html .= '</div>';
$html .= '<hr>';
$html .= '<div>';
$html .= '<button type="button" id="jstryWebhook" class="btn btn-primary" onclick="tryWebhook()">'.$language->get('Try webhook').'</button>';
$html .= <<<EOF
$html .= '<button type="button" id="jstryWebhook" class="btn btn-primary" onclick="tryWebhook()">' . $language->get('Try webhook') . '</button>';
$html .= <<<EOF
<script>
function tryWebhook() {
var webhook = document.getElementById("jswebhook").value;
@ -72,23 +73,23 @@ EOF;
$this->generateContent();
// End request
$this->response(array('status'=>'0'));
$this->response(array('status' => '0'));
}
}
private function downloadFiles()
{
// Download the zip file
Log::set('Plugin Remote Content'.LOG_SEP.'Downloading the zip file.');
Log::set('Plugin Remote Content' . LOG_SEP . 'Downloading the zip file.');
$source = $this->getValue('source');
$destinationPath = $this->workspace();
$destinationFile = $destinationPath.'content.zip';
$destinationFile = $destinationPath . 'content.zip';
TCP::download($source, $destinationFile);
// Uncompress the zip file
Log::set('Plugin Remote Content'.LOG_SEP.'Uncompress the zip file.');
Log::set('Plugin Remote Content' . LOG_SEP . 'Uncompress the zip file.');
$zip = new ZipArchive;
if ($zip->open($destinationFile)===true) {
if ($zip->open($destinationFile) === true) {
$zip->extractTo($destinationPath);
$zip->close();
}
@ -118,7 +119,7 @@ EOF;
private function cleanUp()
{
$workspace = $this->workspace();
Filesystem::deleteRecursive($workspace.DS);
Filesystem::deleteRecursive($workspace . DS);
mkdir($workspace, DIR_PERMISSIONS, true);
return true;
}
@ -132,21 +133,21 @@ EOF;
// For each page inside the pages directory
// Parse the page and add to the database
if (Filesystem::directoryExists($root.DS.'pages')) {
$parentList = Filesystem::listDirectories($root.DS.'pages'.DS);
if (Filesystem::directoryExists($root . DS . 'pages')) {
$parentList = Filesystem::listDirectories($root . DS . 'pages' . DS);
foreach ($parentList as $parentDirectory) {
$parentKey = basename($parentDirectory);
if (Filesystem::fileExists($parentDirectory.DS.'index.md')) {
$row = $this->parsePage($parentDirectory.DS.'index.md');
if (Filesystem::fileExists($parentDirectory . DS . 'index.md')) {
$row = $this->parsePage($parentDirectory . DS . 'index.md');
$row['slug'] = $parentKey;
$pages->add($row);
}
$childList = Filesystem::listDirectories($parentDirectory.DS);
$childList = Filesystem::listDirectories($parentDirectory . DS);
foreach ($childList as $childDirectory) {
$childKey = basename($childDirectory);
if (Filesystem::fileExists($childDirectory.DS.'index.md')) {
$row = $this->parsePage($childDirectory.DS.'index.md');
if (Filesystem::fileExists($childDirectory . DS . 'index.md')) {
$row = $this->parsePage($childDirectory . DS . 'index.md');
$row['slug'] = $childKey;
$row['parent'] = $parentKey;
$pages->add($row);
@ -162,7 +163,7 @@ EOF;
return true;
}
private function response($data=array())
private function response($data = array())
{
$json = json_encode($data);
header('Content-Type: application/json');
@ -180,7 +181,7 @@ EOF;
unset($lines[0]);
$row['title'] = $title;
foreach ($lines as $key=>$line) {
foreach ($lines as $key => $line) {
if (Text::startsWith($line, '<!--')) {
$line = preg_replace('/<!\-\-/', '', $line);
$line = preg_replace('/\-\->/', '', $line);
@ -205,5 +206,4 @@ EOF;
return $row;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,12 +1,13 @@
<?php
class pluginRSS extends Plugin {
class pluginRSS extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'numberOfItems'=>5
'numberOfItems' => 5
);
}
@ -20,23 +21,25 @@ class pluginRSS extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('RSS URL').'</label>';
$html .= '<a href="'.Theme::rssUrl().'">'.Theme::rssUrl().'</a>';
$html .= '<label>' . $L->get('RSS URL') . '</label>';
$html .= '<a href="' . Theme::rssUrl() . '">' . Theme::rssUrl() . '</a>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Amount of items').'</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
$html .= '<span class="tip">'.$L->get('Amount of items to show on the feed').'</span>';
$html .= '<label>' . $L->get('Amount of items') . '</label>';
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" dir="auto" value="' . $this->getValue('numberOfItems') . '">';
$html .= '<span class="tip">' . $L->get('Amount of items to show on the feed') . '</span>';
$html .= '</div>';
return $html;
}
private function encodeURL($url)
{
return preg_replace_callback('/[^\x20-\x7f]/', function($match) { return urlencode($match[0]); }, $url);
}
private function encodeURL($url)
{
return preg_replace_callback('/[^\x20-\x7f]/', function ($match) {
return urlencode($match[0]);
}, $url);
}
private function createXML()
{
@ -49,23 +52,23 @@ class pluginRSS extends Plugin {
// Get the list of public pages (sticky and static included)
$list = $pages->getList(
$pageNumber=1,
$pageNumber = 1,
$numberOfItems,
$published=true,
$static=true,
$sticky=true,
$draft=false,
$scheduled=false
$published = true,
$static = true,
$sticky = true,
$draft = false,
$scheduled = false
);
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
$xml .= '<channel>';
$xml .= '<atom:link href="'.DOMAIN_BASE.'rss.xml" rel="self" type="application/rss+xml" />';
$xml .= '<title>'.$site->title().'</title>';
$xml .= '<link>'.$this->encodeURL($site->url()).'</link>';
$xml .= '<description>'.$site->description().'</description>';
$xml .= '<lastBuildDate>'.date(DATE_RSS).'</lastBuildDate>';
$xml .= '<atom:link href="' . DOMAIN_BASE . 'rss.xml" rel="self" type="application/rss+xml" />';
$xml .= '<title>' . $site->title() . '</title>';
$xml .= '<link>' . $this->encodeURL($site->url()) . '</link>';
$xml .= '<description>' . $site->description() . '</description>';
$xml .= '<lastBuildDate>' . date(DATE_RSS) . '</lastBuildDate>';
// Get keys of pages
foreach ($list as $pageKey) {
@ -73,12 +76,12 @@ class pluginRSS extends Plugin {
// Create the page object from the page key
$page = new Page($pageKey);
$xml .= '<item>';
$xml .= '<title>'.$page->title().'</title>';
$xml .= '<link>'.$this->encodeURL($page->permalink()).'</link>';
$xml .= '<image>'.$page->coverImage(true).'</image>';
$xml .= '<description>'.Sanitize::html($page->contentBreak()).'</description>';
$xml .= '<pubDate>'.date(DATE_RSS,strtotime($page->getValue('dateRaw'))).'</pubDate>';
$xml .= '<guid isPermaLink="false">'.$page->uuid().'</guid>';
$xml .= '<title>' . $page->title() . '</title>';
$xml .= '<link>' . $this->encodeURL($page->permalink()) . '</link>';
$xml .= '<image>' . $page->coverImage(true) . '</image>';
$xml .= '<description>' . Sanitize::html($page->contentBreak()) . '</description>';
$xml .= '<pubDate>' . date(DATE_RSS, strtotime($page->getValue('dateRaw'))) . '</pubDate>';
$xml .= '<guid isPermaLink="false">' . $page->uuid() . '</guid>';
$xml .= '</item>';
} catch (Exception $e) {
// Continue
@ -91,10 +94,10 @@ class pluginRSS extends Plugin {
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->loadXML($xml);
return $doc->save($this->workspace().'rss.xml');
return $doc->save($this->workspace() . 'rss.xml');
}
public function install($position=0)
public function install($position = 0)
{
parent::install($position);
return $this->createXML();
@ -123,7 +126,7 @@ class pluginRSS extends Plugin {
public function siteHead()
{
return '<link rel="alternate" type="application/rss+xml" href="'.DOMAIN_BASE.'rss.xml" title="RSS Feed">'.PHP_EOL;
return '<link rel="alternate" type="application/rss+xml" href="' . DOMAIN_BASE . 'rss.xml" title="RSS Feed">' . PHP_EOL;
}
public function beforeAll()
@ -136,7 +139,7 @@ class pluginRSS extends Plugin {
// Load XML
libxml_disable_entity_loader(false);
$doc->load($this->workspace().'rss.xml');
$doc->load($this->workspace() . 'rss.xml');
libxml_disable_entity_loader(true);
// Print the XML

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,6 +1,7 @@
<?php
class pluginSearch extends Plugin {
class pluginSearch extends Plugin
{
private $pagesFound = array();
private $numberOfItems = 0;
@ -9,10 +10,10 @@ class pluginSearch extends Plugin {
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Search',
'minChars'=>3,
'wordsToCachePerPage'=>800,
'showButtonSearch'=>false
'label' => 'Search',
'minChars' => 3,
'wordsToCachePerPage' => 800,
'showButtonSearch' => false
);
}
@ -25,23 +26,23 @@ class pluginSearch extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Minimum number of characters when searching').'</label>';
$html .= '<input name="minChars" type="text" value="'.$this->getValue('minChars').'">';
$html .= '<label>' . $L->get('Minimum number of characters when searching') . '</label>';
$html .= '<input name="minChars" type="text" dir="auto" value="' . $this->getValue('minChars') . '">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Show button search').'</label>';
$html .= '<select name="showButtonSearch">';
$html .= '<option value="true" '.($this->getValue('showButtonSearch')===true?'selected':'').'>'.$L->get('enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('showButtonSearch')===false?'selected':'').'>'.$L->get('disabled').'</option>';
$html .= '<div>';
$html .= '<label>' . $L->get('Show button search') . '</label>';
$html .= '<select name="showButtonSearch">';
$html .= '<option value="true" ' . ($this->getValue('showButtonSearch') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('showButtonSearch') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '</div>';
$html .= '<div>';
return $html;
@ -53,17 +54,17 @@ class pluginSearch extends Plugin {
global $L;
$html = '<div class="plugin plugin-search">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= '<input type="text" id="jspluginSearchText" /> ';
$html .= '<input type="text" dir="auto" id="jspluginSearchText" /> ';
if ($this->getValue('showButtonSearch')) {
$html .= '<input type="button" value="'.$L->get('Search').'" onClick="pluginSearch()" />';
$html .= '<input type="button" value="' . $L->get('Search') . '" onClick="pluginSearch()" />';
}
$html .= '</div>';
$html .= '</div>';
$DOMAIN_BASE = DOMAIN_BASE;
$html .= <<<EOF
$html .= <<<EOF
<script>
function pluginSearch() {
var text = document.getElementById("jspluginSearchText").value;
@ -85,7 +86,7 @@ EOF;
return $html;
}
public function install($position=0)
public function install($position = 0)
{
parent::install($position);
return $this->createCache();
@ -137,8 +138,8 @@ EOF;
// The first page number is 1, so the real is 0
$realPageNumber = $url->pageNumber() - 1;
$itemsPerPage = $site->itemsPerPage();
if($itemsPerPage <= 0) {
if($realPageNumber === 0) {
if ($itemsPerPage <= 0) {
if ($realPageNumber === 0) {
$this->pagesFound = $list;
}
} else {
@ -190,7 +191,7 @@ EOF;
{
// Get all pages published
global $pages;
$list = $pages->getList($pageNumber=1, $numberOfItems=-1, $published=true, $static=true, $sticky=true, $draft=false, $scheduled=false);
$list = $pages->getList($pageNumber = 1, $numberOfItems = -1, $published = true, $static = true, $sticky = true, $draft = false, $scheduled = false);
$cache = array();
foreach ($list as $pageKey) {
@ -216,7 +217,7 @@ EOF;
// Returns the absolute path of the cache file
private function cacheFile()
{
return $this->workspace().'cache.json';
return $this->workspace() . 'cache.json';
}
// Search text inside the cache
@ -229,11 +230,10 @@ EOF;
$cache = json_decode($json, true);
// Inlcude Fuzz algorithm
require_once($this->phpPath().'vendors/fuzz.php');
require_once($this->phpPath() . 'vendors/fuzz.php');
$fuzz = new Fuzz($cache, 10, 1, true);
$results = $fuzz->search($text, $this->getValue('minChars'));
return(array_keys($results));
return (array_keys($results));
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,7 +2,8 @@
/*
This plugin uses the javascript library https://github.com/gionkunz/chartist-js
*/
class pluginSimpleStats extends Plugin {
class pluginSimpleStats extends Plugin
{
private $loadOnController = array(
'dashboard'
@ -14,10 +15,10 @@ class pluginSimpleStats extends Plugin {
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>$L->g('Visits'),
'numberOfDays'=>7,
'excludeAdmins'=>false,
'showContentStats'=>false
'label' => $L->g('Visits'),
'numberOfDays' => 7,
'excludeAdmins' => false,
'showContentStats' => false
);
}
@ -30,25 +31,25 @@ class pluginSimpleStats extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Show Content Stats').'</label>';
$html .= '<label>' . $L->get('Show Content Stats') . '</label>';
$html .= '<select name="showContentStats">';
$html .= '<option value="true" '.($this->getValue('showContentStats')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('showContentStats')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('showContentStats') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('showContentStats') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
if (defined('BLUDIT_PRO')) {
$html .= '<div>';
$html .= '<label>'.$L->get('Exclude administrators users').'</label>';
$html .= '<label>' . $L->get('Exclude administrators users') . '</label>';
$html .= '<select name="excludeAdmins">';
$html .= '<option value="true" '.($this->getValue('excludeAdmins')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('excludeAdmins')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('excludeAdmins') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('excludeAdmins') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
}
@ -80,7 +81,7 @@ class pluginSimpleStats extends Plugin {
$visitsToday = $this->visits($currentDate);
$uniqueVisitors = $this->uniqueVisitors($currentDate);
$html = <<<EOF
$html = <<<EOF
<div class="simple-stats-plugin">
<div class="my-4 pt-4 border-top">
<div class="ct-chart ct-perfect-fourth"></div>
@ -92,8 +93,8 @@ EOF;
$numberOfDays = $this->getValue('numberOfDays');
$numberOfDays = $numberOfDays - 1;
for ($i=$numberOfDays; $i >= 0 ; $i--) {
$dateWithOffset = Date::currentOffset('Y-m-d', '-'.$i.' day');
for ($i = $numberOfDays; $i >= 0; $i--) {
$dateWithOffset = Date::currentOffset('Y-m-d', '-' . $i . ' day');
$visits[$i] = $this->visits($dateWithOffset);
$unique[$i] = $this->uniqueVisitors($dateWithOffset);
$days[$i] = Date::format($dateWithOffset, 'Y-m-d', 'D');
@ -103,7 +104,7 @@ EOF;
$seriesVisits = implode(',', $visits);
$seriesUnique = implode(',', $unique);
$script = <<<EOF
$script = <<<EOF
<script>
var data = {
labels: [$labels],
@ -127,7 +128,7 @@ EOF;
/**
* Optional Content Stats Feature
*/
if ($this->getValue('showContentStats')) {
if ($this->getValue('showContentStats')) {
global $pages, $categories, $tags;
$data['title'] = $L->get('Statistics');
@ -145,7 +146,7 @@ EOF;
$this->deleteOldLogs();
return $html.PHP_EOL.$script.PHP_EOL;
return $html . PHP_EOL . $script . PHP_EOL;
}
public function siteBodyEnd()
@ -167,9 +168,9 @@ EOF;
// Returns the amount of visits by date
public function visits($date)
{
$file = $this->workspace().$date.'.log';
$file = $this->workspace() . $date . '.log';
$handle = @fopen($file, 'rb');
if ($handle===false) {
if ($handle === false) {
return 0;
}
@ -185,7 +186,7 @@ EOF;
// Returns the amount of unique visitors by date
public function uniqueVisitors($date)
{
$file = $this->workspace().$date.'.log';
$file = $this->workspace() . $date . '.log';
$lines = @file($file);
if (empty($lines)) {
return 0;
@ -207,15 +208,15 @@ EOF;
if (Cookie::get('BLUDIT-KEY') && defined('BLUDIT_PRO') && $this->getValue('excludeAdmins')) {
return false;
}
$currentTime = Date::current('Y-m-d H:i:s');
$currentTime = Date::current('Y-m-d H:i:s');
$ip = TCP::getIP();
$hashIP = md5($ip);
$line = json_encode(array($hashIP, $currentTime));
$currentDate = Date::current('Y-m-d');
$logFile = $this->workspace().$currentDate.'.log';
$logFile = $this->workspace() . $currentDate . '.log';
return file_put_contents($logFile, $line.PHP_EOL, FILE_APPEND | LOCK_EX)!==false;
return file_put_contents($logFile, $line . PHP_EOL, FILE_APPEND | LOCK_EX) !== false;
}
public function renderContentStatistics($data)
@ -230,8 +231,8 @@ EOF;
$html .= '
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-stats-chart-tab" data-toggle="tab" href="#nav-stats-chart" role="tab" aria-controls="nav-stats-chart" aria-selected="true">' . $data['tabTitleChart'] .'</a>
<a class="nav-item nav-link" id="nav-stats-table-tab" data-toggle="tab" href="#nav-stats-table" role="tab" aria-controls="nav-stats-table" aria-selected="false">' . $data['tabTitleTable'] .'</a>
<a class="nav-item nav-link active" id="nav-stats-chart-tab" data-toggle="tab" href="#nav-stats-chart" role="tab" aria-controls="nav-stats-chart" aria-selected="true">' . $data['tabTitleChart'] . '</a>
<a class="nav-item nav-link" id="nav-stats-table-tab" data-toggle="tab" href="#nav-stats-table" role="tab" aria-controls="nav-stats-table" aria-selected="false">' . $data['tabTitleTable'] . '</a>
</div>
</nav>
<div class="tab-content my-2" id="nav-tabContent">
@ -271,5 +272,4 @@ EOF;
return $html;
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,13 +1,14 @@
<?php
class pluginStaticPages extends Plugin {
class pluginStaticPages extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'label'=>'Static Pages',
'homeLink'=>true
'label' => 'Static Pages',
'homeLink' => true
);
}
@ -21,18 +22,18 @@ class pluginStaticPages extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Home link').'</label>';
$html .= '<label>' . $L->get('Home link') . '</label>';
$html .= '<select name="homeLink">';
$html .= '<option value="true" '.($this->getValue('homeLink')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('homeLink')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '<option value="true" ' . ($this->getValue('homeLink') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('homeLink') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '<span class="tip">'.$L->get('show-the-home-link-on-the-sidebar').'</span>';
$html .= '<span class="tip">' . $L->get('show-the-home-link-on-the-sidebar') . '</span>';
$html .= '</div>';
return $html;
@ -52,7 +53,7 @@ class pluginStaticPages extends Plugin {
// Print the label if not empty
$label = $this->getValue('label');
if (!empty($label)) {
$html .= '<h2 class="plugin-label">'.$label.'</h2>';
$html .= '<h2 class="plugin-label">' . $label . '</h2>';
}
$html .= '<div class="plugin-content">';
@ -78,9 +79,9 @@ class pluginStaticPages extends Plugin {
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,11 +1,12 @@
<?php
class pluginTags extends Plugin {
class pluginTags extends Plugin
{
public function init()
{
$this->dbFields = array(
'label'=>'Tags'
'label' => 'Tags'
);
}
@ -18,9 +19,9 @@ class pluginTags extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Label').'</label>';
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
return $html;
@ -35,23 +36,23 @@ class pluginTags extends Plugin {
$filter = $url->filters('tag');
$html = '<div class="plugin plugin-tags">';
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= '<ul>';
// By default the database of tags are alphanumeric sorted
foreach( $tags->db as $key=>$fields ) {
foreach ($tags->db as $key => $fields) {
$html .= '<li>';
$html .= '<a href="'.DOMAIN_TAGS.$key.'">';
$html .= '<a href="' . DOMAIN_TAGS . $key . '">';
$html .= $fields['name'];
$html .= '</a>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View file

@ -1,6 +1,7 @@
<?php
class pluginTinymce extends Plugin {
class pluginTinymce extends Plugin
{
private $loadOnController = array(
'new-content',
@ -10,10 +11,10 @@ class pluginTinymce extends Plugin {
public function init()
{
$this->dbFields = array(
'toolbar1'=>'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
'toolbar2'=>'',
'plugins'=>'code autolink image link pagebreak advlist lists textpattern table',
'codesampleLanguages'=>'HTML/XML markup|JavaScript javascript|CSS css|PHP php|Ruby ruby|Python python|Java java|C c|C# sharp|C++ cpp'
'toolbar1' => 'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code',
'toolbar2' => '',
'plugins' => 'code autolink image link pagebreak advlist lists textpattern table',
'codesampleLanguages' => 'HTML/XML markup|JavaScript javascript|CSS css|PHP php|Ruby ruby|Python python|Java java|C c|C# sharp|C++ cpp'
);
}
@ -26,25 +27,25 @@ class pluginTinymce extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('toolbar-top').'</label>';
$html .= '<input name="toolbar1" id="jstoolbar1" type="text" value="'.$this->getValue('toolbar1').'">';
$html .= '<label>' . $L->get('toolbar-top') . '</label>';
$html .= '<input name="toolbar1" id="jstoolbar1" type="text" dir="auto" value="' . $this->getValue('toolbar1') . '">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('toolbar-bottom').'</label>';
$html .= '<input name="toolbar2" id="jstoolbar2" type="text" value="'.$this->getValue('toolbar2').'">';
$html .= '<label>' . $L->get('toolbar-bottom') . '</label>';
$html .= '<input name="toolbar2" id="jstoolbar2" type="text" dir="auto" value="' . $this->getValue('toolbar2') . '">';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Plugins').'</label>';
$html .= '<input name="plugins" id="jsplugins" type="text" value="'.$this->getValue('plugins').'">';
$html .= '<label>' . $L->get('Plugins') . '</label>';
$html .= '<input name="plugins" id="jsplugins" type="text" dir="auto" value="' . $this->getValue('plugins') . '">';
$html .= '</div>';
if (strpos($this->getValue('plugins'), 'codesample') !== false) {
$html .= '<div>';
$html .= '<label>'.$L->get('codesample-languages').'</label>';
$html .= '<input name="codesampleLanguages" id="jsCodesampleLanguages" type="text" value="'.$this->getValue('codesampleLanguages').'">';
$html .= '<span class="tip">'.$L->get('codesample-supported-laguages').'</span>';
$html .= '<label>' . $L->get('codesample-languages') . '</label>';
$html .= '<input name="codesampleLanguages" id="jsCodesampleLanguages" type="text" dir="auto" value="' . $this->getValue('codesampleLanguages') . '">';
$html .= '<span class="tip">' . $L->get('codesample-supported-laguages') . '</span>';
$html .= '</div>';
}
@ -57,8 +58,8 @@ class pluginTinymce extends Plugin {
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return false;
}
$html = '<link rel="stylesheet" type="text/css" href="'.$this->htmlPath().'css/tinymce_toolbar.css">'.PHP_EOL;
$html .= '<script src="'.$this->htmlPath().'tinymce/tinymce.min.js?version='.$this->version().'"></script>';
$html = '<link rel="stylesheet" type="text/css" href="' . $this->htmlPath() . 'css/tinymce_toolbar.css">' . PHP_EOL;
$html .= '<script src="' . $this->htmlPath() . 'tinymce/tinymce.min.js?version=' . $this->version() . '"></script>';
return $html;
}
@ -73,32 +74,33 @@ class pluginTinymce extends Plugin {
$toolbar1 = $this->getValue('toolbar1');
$toolbar2 = $this->getValue('toolbar2');
$content_css = $this->htmlPath().'css/tinymce_content.css';
$content_css = $this->htmlPath() . 'css/tinymce_content.css';
$plugins = $this->getValue('plugins');
$version = $this->version();
if (strpos($this->getValue('plugins'), 'codesample') !== false) {
$codesampleConfig = '';
$codesampleLanguages = explode("|", $this->getValue('codesampleLanguages'));
foreach($codesampleLanguages AS $codesampleLang) {
foreach ($codesampleLanguages as $codesampleLang) {
$values = explode(" ", $codesampleLang);
$codesampleConfig .= "{ text: '" . $values[0] . "', value: '" . $values[1] . "' },";
}
}
$lang = 'en';
if (file_exists($this->phpPath().'tinymce'.DS.'langs'.DS.$L->currentLanguage().'.js')) {
if (file_exists($this->phpPath() . 'tinymce' . DS . 'langs' . DS . $L->currentLanguage() . '.js')) {
$lang = $L->currentLanguage();
} elseif (file_exists($this->phpPath().'tinymce'.DS.'langs'.DS.$L->currentLanguageShortVersion().'.js')) {
} elseif (file_exists($this->phpPath() . 'tinymce' . DS . 'langs' . DS . $L->currentLanguageShortVersion() . '.js')) {
$lang = $L->currentLanguageShortVersion();
}
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
$document_base_url = 'document_base_url: "'.DOMAIN_UPLOADS.'",';
$document_base_url = 'document_base_url: "' . DOMAIN_UPLOADS . '",';
} else {
$document_base_url = '';
}
$html = <<<EOF
$html = <<<EOF
<script>
// Insert an image in the editor at the cursor position
@ -150,5 +152,4 @@ $html = <<<EOF
EOF;
return $html;
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,12 +1,13 @@
<?php
class pluginTwitterCards extends Plugin {
class pluginTwitterCards extends Plugin
{
public function init()
{
// Fields and default values for the database of this plugin
$this->dbFields = array(
'defaultImage'=>''
'defaultImage' => ''
);
}
@ -19,8 +20,8 @@ class pluginTwitterCards extends Plugin {
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Default image').'</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" value="'.$this->getValue('defaultImage').'" placeholder="https://">';
$html .= '<label>' . $L->get('Default image') . '</label>';
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">';
$html .= '</div>';
return $html;
@ -35,45 +36,45 @@ class pluginTwitterCards extends Plugin {
global $page;
$data = array(
'card' =>'summary',
'site' =>'',
'title' =>$site->title(),
'description' =>$site->description(),
'image' =>''
'card' => 'summary',
'site' => '',
'title' => $site->title(),
'description' => $site->description(),
'image' => ''
);
switch($WHERE_AM_I) {
// The user filter by page
switch ($WHERE_AM_I) {
// The user filter by page
case 'page':
$data['title'] = $page->title();
$data['description'] = $page->description();
$data['image'] = $page->coverImage($absolute=true);
$data['image'] = $page->coverImage($absolute = true);
$pageContent = $page->content();
break;
// The user is in the homepage
// The user is in the homepage
default:
$pageContent = '';
// The image it's from the first page
if(isset($content[0]) ) {
$data['image'] = $content[0]->coverImage($absolute=true);
if (isset($content[0])) {
$data['image'] = $content[0]->coverImage($absolute = true);
$pageContent = $content[0]->content();
}
break;
}
$html = PHP_EOL.'<!-- Twitter Cards -->'.PHP_EOL;
$html .= '<meta property="twitter:card" content="'.$data['card'].'">'.PHP_EOL;
$html .= '<meta property="twitter:site" content="'.$data['site'].'">'.PHP_EOL;
$html .= '<meta property="twitter:title" content="'.$data['title'].'">'.PHP_EOL;
$html .= '<meta property="twitter:description" content="'.$data['description'].'">'.PHP_EOL;
$html = PHP_EOL . '<!-- Twitter Cards -->' . PHP_EOL;
$html .= '<meta property="twitter:card" content="' . $data['card'] . '">' . PHP_EOL;
$html .= '<meta property="twitter:site" content="' . $data['site'] . '">' . PHP_EOL;
$html .= '<meta property="twitter:title" content="' . $data['title'] . '">' . PHP_EOL;
$html .= '<meta property="twitter:description" content="' . $data['description'] . '">' . PHP_EOL;
// If the page doesn't have a coverImage try to get an image from the HTML content
if( empty($data['image']) ) {
if (empty($data['image'])) {
// Get the image from the content
$src = DOM::getFirstImage($pageContent);
if ($src!==false) {
if ($src !== false) {
$data['image'] = $src;
} else {
if (Text::isNotEmpty($this->getValue('defaultImage'))) {
@ -82,7 +83,7 @@ class pluginTwitterCards extends Plugin {
}
}
$html .= '<meta property="twitter:image" content="'.$data['image'].'">'.PHP_EOL;
$html .= '<meta property="twitter:image" content="' . $data['image'] . '">' . PHP_EOL;
return $html;
}
}
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -98,7 +98,7 @@ EOF;
$html = '<div class="mb-3">';
$html .= '<label class="form-label" for="label">' . $L->get('Label') . '</label>';
$html .= '<input class="form-control" id="label" name="label" type="text" value="' . $this->getValue('label') . '">';
$html .= '<input class="form-control" id="label" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<div class="form-text">' . $L->get('This title is almost always used in the sidebar of the site') . '</div>';
$html .= '</div>';

View file

@ -0,0 +1,32 @@
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 512 512" xml:space="preserve">
<path style="fill:#E1E1E3;" d="M483.643,42.893L18.751,222.234c-11.472,4.424-11.372,20.667,0.133,24.978l113.278,42.279
l43.845,141.006c2.806,9.031,13.849,12.369,21.179,6.377l63.142-51.475c6.618-5.393,16.046-5.662,22.963-0.641l113.887,82.685
c7.841,5.699,18.949,1.402,20.917-8.072l83.428-401.305C503.668,47.715,493.499,39.082,483.643,42.893z M395.044,136.412
L221.27,297.943c-6.108,5.686-10.048,13.295-11.164,21.553l-5.92,43.868c-0.784,5.858-9.012,6.439-10.628,0.77l-22.766-79.994
c-2.608-9.124,1.192-18.87,9.263-23.851l210.561-129.684C394.4,128.281,398.293,133.398,395.044,136.412z"/>
<g>
<path style="fill:#A0A0A1;" d="M405.003,480.205c-4.892,0-9.726-1.533-13.823-4.511l-113.882-82.681
c-3.166-2.299-7.496-2.178-10.528,0.295l-63.14,51.473c-6.056,4.953-14.159,6.566-21.66,4.31
c-7.506-2.258-13.377-8.077-15.703-15.566l-42.359-136.225L15.317,256.77C6.056,253.299,0.048,244.678,0,234.804
c-0.047-9.865,5.873-18.534,15.08-22.085L479.972,33.377c8.041-3.106,17.12-1.571,23.698,4.005
c6.587,5.584,9.589,14.303,7.838,22.755L428.08,461.446c-1.63,7.85-7.073,14.268-14.56,17.163
C410.753,479.679,407.868,480.205,405.003,480.205z M272.231,370.973c5.976,0,11.962,1.835,17.052,5.531l113.887,82.685
c1.212,0.881,2.397,0.624,2.997,0.393c0.596-0.23,1.64-0.833,1.942-2.284L491.536,55.99c0.33-1.592-0.519-2.593-1.054-3.047
c-0.531-0.451-1.648-1.121-3.159-0.538c-0.003,0.001-0.006,0.002-0.008,0.003L22.423,231.751c-1.68,0.648-2.028,1.964-2.023,2.955
c0.005,0.999,0.366,2.321,2.062,2.957l113.265,42.275c2.956,1.104,5.235,3.514,6.173,6.527l43.845,141.006
c0.434,1.396,1.501,1.906,2.099,2.086c0.595,0.178,1.761,0.343,2.885-0.577l63.154-51.485
C259.204,373.158,265.712,370.973,272.231,370.973z M198.75,378.286c-6.985,0-13.054-4.534-14.999-11.355l-22.768-80
c-3.839-13.438,1.8-27.967,13.716-35.323l210.569-129.69c6.121-3.759,13.996-2.284,18.329,3.425
c4.328,5.702,3.633,13.675-1.618,18.545L228.214,305.413c-4.359,4.058-7.204,9.548-8.001,15.45l-5.92,43.866
c-0.992,7.412-6.901,12.974-14.367,13.515C199.532,378.272,199.139,378.286,198.75,378.286z M339.662,173.966l-154.258,95.007
c-4.17,2.573-6.148,7.661-4.805,12.365l16.527,58.072l2.871-21.278c1.428-10.566,6.515-20.387,14.323-27.655L339.662,173.966z"/>
<path style="fill:#A0A0A1;" d="M423.776,279.45c-0.717,0-1.444-0.075-2.174-0.234c-5.505-1.195-8.999-6.627-7.804-12.131l1.55-7.14
c1.195-5.505,6.626-9,12.131-7.804c5.505,1.195,8.999,6.627,7.804,12.131l-1.55,7.14
C432.697,276.188,428.471,279.45,423.776,279.45z"/>
<path style="fill:#A0A0A1;" d="M391.668,427.341c-0.717,0-1.444-0.075-2.174-0.234c-5.504-1.195-8.998-6.627-7.803-12.131
l23.459-108.051c1.194-5.505,6.62-8.999,12.132-7.804c5.504,1.195,8.998,6.627,7.803,12.131l-23.459,108.051
C400.588,424.08,396.363,427.341,391.668,427.341z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -2,7 +2,7 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "3.15.0",
"version": "3.16.2",
"releaseDate": "2023-07-10",
"license": "MIT",
"compatible": "3.15",

View file

@ -1,5 +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="ml-5 text-warning"><img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/> Powered by <a target="_blank" class="text-white" href="https://www.bludit.com"><?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></span></a></span></p>
</div>
<div class="container">
<p class="m-0 text-center text-white text-uppercase"><?php echo $site->footer(); ?><span class="ml-5 text-warning"><img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/> Powered by <a target="_blank" class="text-white" href="https://www.bludit.com"><?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></a></span></p>
</div>
</footer>

View file

@ -0,0 +1,32 @@
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 512 512" xml:space="preserve">
<path style="fill:#E1E1E3;" d="M483.643,42.893L18.751,222.234c-11.472,4.424-11.372,20.667,0.133,24.978l113.278,42.279
l43.845,141.006c2.806,9.031,13.849,12.369,21.179,6.377l63.142-51.475c6.618-5.393,16.046-5.662,22.963-0.641l113.887,82.685
c7.841,5.699,18.949,1.402,20.917-8.072l83.428-401.305C503.668,47.715,493.499,39.082,483.643,42.893z M395.044,136.412
L221.27,297.943c-6.108,5.686-10.048,13.295-11.164,21.553l-5.92,43.868c-0.784,5.858-9.012,6.439-10.628,0.77l-22.766-79.994
c-2.608-9.124,1.192-18.87,9.263-23.851l210.561-129.684C394.4,128.281,398.293,133.398,395.044,136.412z"/>
<g>
<path style="fill:#A0A0A1;" d="M405.003,480.205c-4.892,0-9.726-1.533-13.823-4.511l-113.882-82.681
c-3.166-2.299-7.496-2.178-10.528,0.295l-63.14,51.473c-6.056,4.953-14.159,6.566-21.66,4.31
c-7.506-2.258-13.377-8.077-15.703-15.566l-42.359-136.225L15.317,256.77C6.056,253.299,0.048,244.678,0,234.804
c-0.047-9.865,5.873-18.534,15.08-22.085L479.972,33.377c8.041-3.106,17.12-1.571,23.698,4.005
c6.587,5.584,9.589,14.303,7.838,22.755L428.08,461.446c-1.63,7.85-7.073,14.268-14.56,17.163
C410.753,479.679,407.868,480.205,405.003,480.205z M272.231,370.973c5.976,0,11.962,1.835,17.052,5.531l113.887,82.685
c1.212,0.881,2.397,0.624,2.997,0.393c0.596-0.23,1.64-0.833,1.942-2.284L491.536,55.99c0.33-1.592-0.519-2.593-1.054-3.047
c-0.531-0.451-1.648-1.121-3.159-0.538c-0.003,0.001-0.006,0.002-0.008,0.003L22.423,231.751c-1.68,0.648-2.028,1.964-2.023,2.955
c0.005,0.999,0.366,2.321,2.062,2.957l113.265,42.275c2.956,1.104,5.235,3.514,6.173,6.527l43.845,141.006
c0.434,1.396,1.501,1.906,2.099,2.086c0.595,0.178,1.761,0.343,2.885-0.577l63.154-51.485
C259.204,373.158,265.712,370.973,272.231,370.973z M198.75,378.286c-6.985,0-13.054-4.534-14.999-11.355l-22.768-80
c-3.839-13.438,1.8-27.967,13.716-35.323l210.569-129.69c6.121-3.759,13.996-2.284,18.329,3.425
c4.328,5.702,3.633,13.675-1.618,18.545L228.214,305.413c-4.359,4.058-7.204,9.548-8.001,15.45l-5.92,43.866
c-0.992,7.412-6.901,12.974-14.367,13.515C199.532,378.272,199.139,378.286,198.75,378.286z M339.662,173.966l-154.258,95.007
c-4.17,2.573-6.148,7.661-4.805,12.365l16.527,58.072l2.871-21.278c1.428-10.566,6.515-20.387,14.323-27.655L339.662,173.966z"/>
<path style="fill:#A0A0A1;" d="M423.776,279.45c-0.717,0-1.444-0.075-2.174-0.234c-5.505-1.195-8.999-6.627-7.804-12.131l1.55-7.14
c1.195-5.505,6.626-9,12.131-7.804c5.505,1.195,8.999,6.627,7.804,12.131l-1.55,7.14
C432.697,276.188,428.471,279.45,423.776,279.45z"/>
<path style="fill:#A0A0A1;" d="M391.668,427.341c-0.717,0-1.444-0.075-2.174-0.234c-5.504-1.195-8.998-6.627-7.803-12.131
l23.459-108.051c1.194-5.505,6.62-8.999,12.132-7.804c5.504,1.195,8.998,6.627,7.803,12.131l-23.459,108.051
C400.588,424.08,396.363,427.341,391.668,427.341z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -2,9 +2,9 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "3.15.0",
"releaseDate": "2023-07-15",
"version": "3.16.2",
"releaseDate": "2024-08-23",
"license": "MIT",
"compatible": "3.15.0",
"compatible": "3.16.2",
"notes": ""
}

View file

@ -1,5 +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="ml-5 text-warning"><img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/> Powered by <a target="_blank" class="text-white" href="https://www.bludit.com"><?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></span></a></span></p>
</div>
<div class="container">
<p class="m-0 text-center text-white text-uppercase"><?php echo $site->footer(); ?><span class="ml-5 text-warning"><img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/> Powered by <a target="_blank" class="text-white" href="https://www.bludit.com"><?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></a></span></p>
</div>
</footer>

View file

@ -10,20 +10,20 @@
<ul class="navbar-nav ml-auto">
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php foreach ($staticContent as $staticPage) : ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php endforeach ?>
<!-- Social Networks -->
<?php foreach (Theme::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php foreach (Theme::socialNetworks() as $key => $label) : ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME . 'img/' . $key . '.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>

View file

@ -2,7 +2,7 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "3.15.0",
"version": "3.16.2",
"releaseDate": "2023-07-??",
"license": "MIT",
"compatible": "3.0",

View file

@ -396,6 +396,7 @@ function install($adminPassword, $timezone)
'gitlab' => '',
'linkedin' => '',
'xing' => '',
'telegram' => '',
'dateFormat' => 'F j, Y',
'extremeFriendly' => true,
'autosaveInterval' => 2,
@ -432,6 +433,7 @@ function install($adminPassword, $timezone)
'codepen' => '',
'linkedin' => '',
'xing' => '',
'telegram' => '',
'github' => '',
'gitlab' => ''
)
@ -650,7 +652,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<input type="hidden" name="timezone" id="jstimezone" value="UTC">
<div class="form-group">
<input type="text" value="admin" class="form-control form-control-lg" id="jsusername" name="username" placeholder="Username" disabled>
<input type="text" dir="auto" value="admin" class="form-control form-control-lg" id="jsusername" name="username" placeholder="Username" disabled>
</div>
<div class="form-group mb-0">