mirror of
https://github.com/danpros/htmly.git
synced 2026-04-23 14:06:23 +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
|
|
@ -213,9 +213,6 @@ function get_comments_file_from_url($url) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get all comments for a post/page
|
||||
*
|
||||
|
|
@ -283,11 +280,12 @@ function getAllComments($page = null, $perpage = null)
|
|||
|
||||
$allComments = array();
|
||||
|
||||
|
||||
foreach ($files as $file) {
|
||||
$comments = getComments('', $file, true);
|
||||
$url = get_url_from_file($file);
|
||||
foreach ($comments as $comment) {
|
||||
$comment['file'] = $file;
|
||||
$comment['url'] = $url;
|
||||
$allComments[] = $comment;
|
||||
}
|
||||
}
|
||||
|
|
@ -308,6 +306,22 @@ function getAllComments($page = null, $perpage = null)
|
|||
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
|
||||
*
|
||||
|
|
@ -702,7 +716,7 @@ function commentPublish($file, $commentId)
|
|||
if ($comment['id'] === $commentId) {
|
||||
$comment['published'] = true;
|
||||
$updated = true;
|
||||
|
||||
|
||||
$url = get_url_from_file($file);
|
||||
|
||||
// Send notifications only to subscribers when publishing (admin already saw it in moderation)
|
||||
|
|
|
|||
|
|
@ -90,6 +90,13 @@ function i18n($key, $value = null)
|
|||
$_i18n = parse_ini_file($value, true);
|
||||
else
|
||||
$_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)
|
||||
return (isset($_i18n[$key]) ? $_i18n[$key] : $key);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue