mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 11:16:00 +05:30
Local lables in themes, comments functions improvements.
This commit is contained in:
parent
008ab9e11a
commit
8f1d51764b
5 changed files with 35 additions and 12 deletions
|
|
@ -428,5 +428,3 @@ sysmsg_subscribe_success = "Your will receive now new comment notifications on t
|
||||||
sysmsg_subscribe_fail = "Something went wrong during subscription verification process."
|
sysmsg_subscribe_fail = "Something went wrong during subscription verification process."
|
||||||
sysmsg_unsubscribe_success = "You have successfully unsubscribed from notification emails."
|
sysmsg_unsubscribe_success = "You have successfully unsubscribed from notification emails."
|
||||||
sysmsg_unsubscribe_fail = "Something wrong during unsubscription process"
|
sysmsg_unsubscribe_fail = "Something wrong during unsubscription process"
|
||||||
codebtn_copy = "Copy"
|
|
||||||
codebtn_copied = "Copied!"
|
|
||||||
|
|
|
||||||
|
|
@ -2025,6 +2025,13 @@ function delete_comments($mdfile) {
|
||||||
// regardless if file is content .md file or comments .json file
|
// regardless if file is content .md file or comments .json file
|
||||||
function get_url_from_file($file)
|
function get_url_from_file($file)
|
||||||
{
|
{
|
||||||
|
// Ensure config is loaded - if not loads it
|
||||||
|
$config_loaded = config('permalink.type');
|
||||||
|
if (!$config_loaded) {
|
||||||
|
if (file_exists('config/config.ini')) {
|
||||||
|
config('source', 'config/config.ini');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Normalize path separators (Windows/Linux))
|
// Normalize path separators (Windows/Linux))
|
||||||
$file = str_replace('\\', '/', $file);
|
$file = str_replace('\\', '/', $file);
|
||||||
|
|
@ -2096,9 +2103,6 @@ function get_url_from_file($file)
|
||||||
// return site_url() . $slug;
|
// return site_url() . $slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check if it's a blog post: {username}/blog/{category}/{type}/[scheduled/]{date}_{tags}_{slug}.md
|
// Check if it's a blog post: {username}/blog/{category}/{type}/[scheduled/]{date}_{tags}_{slug}.md
|
||||||
if (count($parts) >= 5 && $parts[1] == 'blog') {
|
if (count($parts) >= 5 && $parts[1] == 'blog') {
|
||||||
$filename_parts = explode('_', pathinfo($basename, PATHINFO_FILENAME));
|
$filename_parts = explode('_', pathinfo($basename, PATHINFO_FILENAME));
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo site_url() . get_url_from_file($comment['file']); ?>" target="_blank">
|
<a href="<?php echo site_url() . $comment['url']; ?>" target="_blank">
|
||||||
<?php echo _h(get_url_from_file($comment['file'])); ?>
|
<?php echo _h($comment['url']); ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
|
|
@ -213,9 +213,6 @@ function get_comments_file_from_url($url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all comments for a post/page
|
* Get all comments for a post/page
|
||||||
*
|
*
|
||||||
|
|
@ -283,11 +280,12 @@ function getAllComments($page = null, $perpage = null)
|
||||||
|
|
||||||
$allComments = array();
|
$allComments = array();
|
||||||
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$comments = getComments('', $file, true);
|
$comments = getComments('', $file, true);
|
||||||
|
$url = get_url_from_file($file);
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
$comment['file'] = $file;
|
$comment['file'] = $file;
|
||||||
|
$comment['url'] = $url;
|
||||||
$allComments[] = $comment;
|
$allComments[] = $comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -308,6 +306,22 @@ function getAllComments($page = null, $perpage = null)
|
||||||
return $allComments;
|
return $allComments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getPublishedComments($limit = 5)
|
||||||
|
{
|
||||||
|
$comments = array();
|
||||||
|
$counter = 0;
|
||||||
|
$allComments = getAllComments();
|
||||||
|
foreach ($allComments as $comment) {
|
||||||
|
if ($comment['published'] == 1) {
|
||||||
|
$comments[] = $comment;
|
||||||
|
}
|
||||||
|
if (count($comments) >= $limit) break;
|
||||||
|
}
|
||||||
|
return $comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate unique comment ID
|
* Generate unique comment ID
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,13 @@ function i18n($key, $value = null)
|
||||||
$_i18n = parse_ini_file($value, true);
|
$_i18n = parse_ini_file($value, true);
|
||||||
else
|
else
|
||||||
$_i18n = parse_ini_file('lang/en_US.ini', true);
|
$_i18n = parse_ini_file('lang/en_US.ini', true);
|
||||||
|
$theme_path = parse_url(theme_path(), PHP_URL_PATH);
|
||||||
|
$theme_lang_file = $_SERVER['DOCUMENT_ROOT'] . $theme_path . 'lang/en_US.ini';
|
||||||
|
$_i18n_local = array();
|
||||||
|
if (file_exists($theme_lang_file)) {
|
||||||
|
$_i18n_local = parse_ini_file($theme_lang_file, true);
|
||||||
|
}
|
||||||
|
$_i18n = array_replace($_i18n, $_i18n_local);
|
||||||
} elseif ($value == null)
|
} elseif ($value == null)
|
||||||
return (isset($_i18n[$key]) ? $_i18n[$key] : $key);
|
return (isset($_i18n[$key]) ? $_i18n[$key] : $key);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue