mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 11:16:00 +05:30
Merge branch 'danpros:master' into master
This commit is contained in:
commit
b825d9186a
12 changed files with 137 additions and 81 deletions
2
cache/installedVersion.json
vendored
2
cache/installedVersion.json
vendored
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"tag_name": "v2.9.3"
|
||||
"tag_name": "v2.9.4"
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
define('HTMLY', true);
|
||||
define('HTMLY_VERSION', 'v2.9.3');
|
||||
define('HTMLY_VERSION', 'v2.9.4');
|
||||
$config_file = 'config/config.ini';
|
||||
require 'system/vendor/autoload.php';
|
||||
require 'system/htmly.php';
|
||||
|
|
|
|||
|
|
@ -1009,9 +1009,9 @@ function find_draft_page($static = null)
|
|||
$posts = get_draft_pages();
|
||||
|
||||
$tmp = array();
|
||||
|
||||
|
||||
$counter = config('views.counter');
|
||||
|
||||
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
|
|
@ -1079,9 +1079,9 @@ function find_draft_subpage($static = null, $sub_static = null)
|
|||
$posts = get_draft_subpages($static);
|
||||
|
||||
$tmp = array();
|
||||
|
||||
|
||||
$counter = config('views.counter');
|
||||
|
||||
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
|
|
@ -1626,3 +1626,29 @@ function reorder_subpages($subpages = null)
|
|||
|
||||
rebuilt_cache();
|
||||
}
|
||||
|
||||
// Return image gallery in pager.
|
||||
function image_gallery($images, $page = 1, $perpage = 0)
|
||||
{
|
||||
if (empty($images)) {
|
||||
$images = scan_images();
|
||||
}
|
||||
$tmp = '';
|
||||
$pagination = has_pagination(count($images), $perpage, $page);
|
||||
$images = array_slice($images, ($page - 1) * $perpage, $perpage);
|
||||
$tmp .= '<div class="cover-container">';
|
||||
foreach ($images as $index => $v) {
|
||||
$tmp .= '<div class="cover-item"><img loading="lazy" class="img-thumbnail the-img" src="' . site_url() . $v['dirname'] . '/'. $v['basename'].'"></div>';
|
||||
}
|
||||
$tmp .= '</div><br><div class="row">';
|
||||
if (!empty($pagination['prev'])) {
|
||||
$prev = $page - 1;
|
||||
$tmp .= '<a class="btn btn-primary left" style="margin: .25rem;" href="#'. $prev .'" onclick="loadImages(' . $prev . ')">← '. i18n('Prev') .'</a>';
|
||||
}
|
||||
if (!empty($pagination['next'])) {
|
||||
$next = $page + 1;
|
||||
$tmp .= '<a class="btn btn-primary right" style="margin: .25rem;" href="#'. $next .'" onclick="loadImages(' . $next . ')">'. i18n('Next') .' →</a>';
|
||||
}
|
||||
$tmp .= '</div>';
|
||||
return $tmp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
$('#insertImageDialogFile').val('');
|
||||
$('#insertMediaDialogURL').val('');
|
||||
$('#insertMediaDialogFile').val('');
|
||||
$('#gallery-1').html(initial_image);
|
||||
$('#gallery-2').html(initial_image);
|
||||
};
|
||||
$('#insertImageDialogInsert').click( function() {
|
||||
callbackFunc( $('#insertImageDialogURL').val().length > 0 ? $('#insertImageDialogURL').val() : null );
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if (file_exists($tagslang)) {
|
|||
file_put_contents($tagslang, print_r($tmp, true), LOCK_EX);
|
||||
}
|
||||
|
||||
$images = get_gallery();
|
||||
$images = image_gallery(null, 1, 40);
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -227,18 +227,12 @@ $( function() {
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-1">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertImageDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertImageDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -267,18 +261,12 @@ $( function() {
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-2">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertMediaDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertMediaDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -301,12 +289,25 @@ $( function() {
|
|||
</div>
|
||||
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>'; var initial_image = '<?php echo $images;?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/editor.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/resources/js/media.uploader.js"></script>
|
||||
<script>
|
||||
$('.the-img').click(function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
function loadImages(page) {
|
||||
$.ajax({
|
||||
url: '<?php echo site_url();?>admin/gallery',
|
||||
type: 'POST',
|
||||
data: { page: page },
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#gallery-1').html(response.images);
|
||||
$('#gallery-2').html(response.images);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.img-container').on("click", ".the-img", function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
|
||||
<?php $images = get_gallery(); ?>
|
||||
<?php $images = image_gallery(null, 1, 40); ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery-ui.min.js"></script>
|
||||
|
|
@ -91,18 +91,12 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-1">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertImageDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertImageDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -122,10 +116,24 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>'; var initial_image = '<?php echo $images;?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/editor.js"></script>
|
||||
<script>
|
||||
$('.the-img').click(function(e) {
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
function loadImages(page) {
|
||||
$.ajax({
|
||||
url: '<?php echo site_url();?>admin/gallery',
|
||||
type: 'POST',
|
||||
data: { page: page },
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#gallery-1').html(response.images);
|
||||
$('#gallery-2').html(response.images);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.img-container').on("click", ".the-img", function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ if (file_exists($tagslang)) {
|
|||
file_put_contents($tagslang, print_r($tmp, true), LOCK_EX);
|
||||
}
|
||||
|
||||
$images = get_gallery();
|
||||
$images = image_gallery(null, 1, 40);
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
|
|
@ -170,7 +170,7 @@ $( function() {
|
|||
</div>
|
||||
<br>
|
||||
<label for="pURL"><?php echo i18n('Slug');?> (<?php echo i18n('optional');?>)</label>
|
||||
<input type="text" id="pURL" name="url" class="form-control text" value="<?php echo $oldmd ?>" placeholder="<?php echo i18n('If_the_url_leave_empty_we_will_use_the_post_title');?>"//>
|
||||
<input type="text" id="pURL" name="url" class="form-control text" value="<?php echo $oldmd ?>" placeholder="<?php echo i18n('If_the_url_leave_empty_we_will_use_the_post_title');?>"/>
|
||||
<br>
|
||||
|
||||
<?php if ($type == 'is_audio'):?>
|
||||
|
|
@ -278,18 +278,12 @@ $( function() {
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-1">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertImageDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertImageDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -318,18 +312,12 @@ $( function() {
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-2">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertMediaDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertMediaDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -351,12 +339,25 @@ $( function() {
|
|||
|
||||
</div>
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>'; var initial_image = '<?php echo $images;?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/editor.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/resources/js/media.uploader.js"></script>
|
||||
<script>
|
||||
$('.the-img').click(function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
function loadImages(page) {
|
||||
$.ajax({
|
||||
url: '<?php echo site_url();?>admin/gallery',
|
||||
type: 'POST',
|
||||
data: { page: page },
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#gallery-1').html(response.images);
|
||||
$('#gallery-2').html(response.images);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
$('.img-container').on("click", ".the-img", function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
});
|
||||
</script>
|
||||
|
|
@ -76,7 +76,7 @@ if ($type == 'is_frontpage') {
|
|||
}
|
||||
}
|
||||
|
||||
$images = get_gallery();
|
||||
$images = image_gallery(null, 1, 40);
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
|
|
@ -184,18 +184,12 @@ $images = get_gallery();
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if (!empty($images)) :?>
|
||||
<div class="form-group">
|
||||
<div class="row-fluid cover-container">
|
||||
<?php foreach ($images as $img):?>
|
||||
<div class="cover-item">
|
||||
<img class="img-thumbnail the-img" src="<?php echo site_url() . $img['dirname'] . '/' . $img['basename']?>">
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<div class="row-fluid img-container" id="gallery-1">
|
||||
<?php echo $images;?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endif;?>
|
||||
<div class="form-group">
|
||||
<label for="insertImageDialogURL">URL</label>
|
||||
<input type="text" class="form-control" id="insertImageDialogURL" size="48" placeholder="<?php echo i18n('Enter_image_URL');?>" />
|
||||
|
|
@ -215,10 +209,24 @@ $images = get_gallery();
|
|||
</div>
|
||||
</div>
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>'; var initial_image = '<?php echo $images;?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/editor.js"></script>
|
||||
<script>
|
||||
$('.the-img').click(function(e) {
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
function loadImages(page) {
|
||||
$.ajax({
|
||||
url: '<?php echo site_url();?>admin/gallery',
|
||||
type: 'POST',
|
||||
data: { page: page },
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#gallery-1').html(response.images);
|
||||
$('#gallery-2').html(response.images);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.img-container').on("click", ".the-img", function(e) {
|
||||
$('#insertMediaDialogURL').val($(e.target).attr('src'));
|
||||
$('#insertImageDialogURL').val($(e.target).attr('src'));
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?php echo blog_language();?>">
|
||||
<head>
|
||||
<?php echo head_contents();?>
|
||||
<title><?php echo $title;?></title>
|
||||
|
|
|
|||
|
|
@ -1824,6 +1824,14 @@ post('/admin/menu', function () {
|
|||
}
|
||||
});
|
||||
|
||||
post('/admin/gallery', function () {
|
||||
|
||||
if (login()) {
|
||||
$page = from($_REQUEST, 'page');
|
||||
$images = image_gallery(null, $page, 40);
|
||||
echo json_encode(array('images' => $images));
|
||||
}
|
||||
});
|
||||
|
||||
// Show category page
|
||||
get('/admin/categories', function () {
|
||||
|
|
|
|||
|
|
@ -222,19 +222,19 @@ function get_zip_files()
|
|||
}
|
||||
|
||||
// Get images in content/images folder
|
||||
function get_gallery() {
|
||||
static $_gallery = array();
|
||||
if (empty($_gallery)) {
|
||||
function scan_images() {
|
||||
static $_images = array();
|
||||
if (empty($_images)) {
|
||||
$tmp = array();
|
||||
$tmp = glob('content/images/*', GLOB_NOSORT);
|
||||
if (is_array($tmp)) {
|
||||
foreach ($tmp as $file) {
|
||||
$_gallery[] = pathinfo($file);
|
||||
$_images[] = pathinfo($file);
|
||||
}
|
||||
}
|
||||
usort($_gallery, "sortfile_d");
|
||||
usort($_images, "sortfile_d");
|
||||
}
|
||||
return $_gallery;
|
||||
return $_images;
|
||||
}
|
||||
|
||||
// usort function. Sort by filename.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
$('#insertImageDialogFile').val('');
|
||||
$('#insertMediaDialogURL').val('');
|
||||
$('#insertMediaDialogFile').val('');
|
||||
$('#gallery-1').html(initial_image);
|
||||
$('#gallery-2').html(initial_image);
|
||||
};
|
||||
$('#insertMediaDialogInsert').click( function() {
|
||||
$('.media-uploader').val('');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue