mirror of
https://github.com/danpros/htmly.git
synced 2026-04-23 14:06:23 +05:30
Adding language support - currently only English and German
system/htmly.php - Loads language files from folder lang/ - Sets language settings for date and time format system/includes/dispatch.php - function i18n() returns translated strings
This commit is contained in:
parent
5423d65cdc
commit
4fde479aba
41 changed files with 352 additions and 147 deletions
|
|
@ -673,14 +673,16 @@ function get_feed($feed_url, $credit)
|
|||
// Get recent posts by user
|
||||
function get_user_posts()
|
||||
{
|
||||
global $date_format;
|
||||
|
||||
if (isset($_SESSION[config("site.url")]['user'])) {
|
||||
$posts = get_profile_posts($_SESSION[config("site.url")]['user'], 1, 5);
|
||||
if (!empty($posts)) {
|
||||
echo '<table class="post-list">';
|
||||
echo '<tr class="head"><th>Title</th><th>Published</th>';
|
||||
echo '<tr class="head"><th>' . i18n('Title') . '</th><th>' . i18n('Published') . '</th>';
|
||||
if (config("views.counter") == "true")
|
||||
echo '<th>Views</th>';
|
||||
echo '<th>Tag</th><th>Operations</th></tr>';
|
||||
echo '<th>' . i18n('Tag') . '</th><th>' . i18n('Operations') . '</th></tr>';
|
||||
$i = 0;
|
||||
$len = count($posts);
|
||||
foreach ($posts as $p) {
|
||||
|
|
@ -694,11 +696,11 @@ function get_user_posts()
|
|||
$i++;
|
||||
echo '<tr class="' . $class . '">';
|
||||
echo '<td><a target="_blank" href="' . $p->url . '">' . $p->title . '</a></td>';
|
||||
echo '<td>' . date('d F Y', $p->date) . '</td>';
|
||||
echo '<td>' . strftime($date_format, $p->date) . '</td>';
|
||||
if (config("views.counter") == "true")
|
||||
echo '<td>' . $p->views . '</td>';
|
||||
echo '<td>' . $p->tag . '</td>';
|
||||
echo '<td><a href="' . $p->url . '/edit?destination=admin">Edit</a> <a href="' . $p->url . '/delete?destination=admin">Delete</a></td>';
|
||||
echo '<td><a href="' . $p->url . '/edit?destination=admin">' . i18n('Edit') . '</a> <a href="' . $p->url . '/delete?destination=admin">' . i18n('Delete') . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
|
|
@ -714,10 +716,10 @@ function get_user_pages()
|
|||
if (!empty($posts)) {
|
||||
krsort($posts);
|
||||
echo '<table class="post-list">';
|
||||
echo '<tr class="head"><th>Title</th>';
|
||||
echo '<tr class="head"><th>' . i18n('Title') . '</th>';
|
||||
if (config("views.counter") == "true")
|
||||
echo '<th>Views</th>';
|
||||
echo '<th>Operations</th></tr>';
|
||||
echo '<th>' . i18n('Operations') . '</th></tr>';
|
||||
$i = 0;
|
||||
$len = count($posts);
|
||||
foreach ($posts as $p) {
|
||||
|
|
@ -734,7 +736,7 @@ function get_user_pages()
|
|||
echo '<td><a target="_blank" href="' . $p->url . '">' . $p->title . '</a></td>';
|
||||
if (config("views.counter") == "true")
|
||||
echo '<td>' . $p->views . '</td>';
|
||||
echo '<td><a href="' . $p->url . '/add?destination=admin">Add Sub</a> <a href="' . $p->url . '/edit?destination=admin">Edit</a> <a href="' . $p->url . '/delete?destination=admin">Delete</a></td>';
|
||||
echo '<td><a href="' . $p->url . '/add?destination=admin">' . i18n('Add_sub') . '</a> <a href="' . $p->url . '/edit?destination=admin">' . i18n('Edit') . '</a> <a href="' . $p->url . '/delete?destination=admin">' . i18n('Delete') . '</a></td>';
|
||||
echo '</tr>';
|
||||
|
||||
$shortUrl = substr($p->url, strrpos($p->url, "/") + 1);
|
||||
|
|
@ -745,7 +747,7 @@ function get_user_pages()
|
|||
echo '<td> »<a target="_blank" href="' . $sp->url . '">' . $sp->title . '</a></td>';
|
||||
if (config("views.counter") == "true")
|
||||
echo '<td>' . $sp->views . '</td>';
|
||||
echo '<td><a href="' . $sp->url . '/edit?destination=admin">Edit</a> <a href="' . $sp->url . '/delete?destination=admin">Delete</a></td>';
|
||||
echo '<td><a href="' . $sp->url . '/edit?destination=admin">' . i18n('Edit') . '</a> <a href="' . $sp->url . '/delete?destination=admin">' . i18n('Delete') . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
|
@ -762,7 +764,7 @@ function get_backup_files()
|
|||
if (!empty($files)) {
|
||||
krsort($files);
|
||||
echo '<table class="backup-list">';
|
||||
echo '<tr class="head"><th>Filename</th><th>Date</th><th>Operations</th></tr>';
|
||||
echo '<tr class="head"><th>' . i18n('Filename') . '</th><th>Date</th><th>' . i18n('Operations') . '</th></tr>';
|
||||
$i = 0;
|
||||
$len = count($files);
|
||||
foreach ($files as $file) {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ $desc = get_category_info(null);
|
|||
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span>
|
||||
<?php echo i18n('Title');?> <span class="required">*</span>
|
||||
<br>
|
||||
<input type="text" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" name="title" value="<?php if (isset($postTitle)) { echo $postTitle;} ?>"/>
|
||||
<br><br>
|
||||
Category <span class="required">*</span>
|
||||
<?php echo i18n('Category');?> <span class="required">*</span>
|
||||
<br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<option value="uncategorized"><?php echo i18n("Uncategorized");?></option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
|
|
@ -48,7 +48,7 @@ $desc = get_category_info(null);
|
|||
<br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span>
|
||||
<br><br>
|
||||
Meta Description (optional)<br>
|
||||
<?php echo i18n('Meta_description');?> (optional)<br>
|
||||
<textarea name="description" rows="3" cols="20"><?php if (isset($p->description)) { echo $p->description;} ?></textarea>
|
||||
<br><br>
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ $desc = get_category_info(null);
|
|||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error'; } } ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) { echo $postContent;} ?></textarea>
|
||||
<br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
<input type="submit" name="publish" class="submit" value="<?php echo i18n('Publish');?>"/> <input type="submit" name="draft" class="draft" value="<?php echo i18n('Save_as_draft');?>"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<?php $desc = get_category_info(null); ?>
|
||||
|
||||
<a href="<?php echo site_url();?>add/category">Add category</a>
|
||||
<a href="<?php echo site_url();?>add/category"><?php echo i18n('Add_category');?></a>
|
||||
<table class="category-list">
|
||||
<tr class="head">
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Contents</th>
|
||||
<th>Operations</th>
|
||||
<th><?php echo i18n('Description');?></th>
|
||||
<th><?php echo i18n('Contents');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="<?php echo site_url();?>category/uncategorized" target="_blank">Uncategorized</a></td>
|
||||
<td><p>Topics that don't need a category, or don't fit into any other existing category.</p></td>
|
||||
<td><a href="<?php echo site_url();?>category/uncategorized" target="_blank"><?php echo i18n("Uncategorized");?></a></td>
|
||||
<td><p><?php echo i18n('Uncategorized_comment');?>.</p></td>
|
||||
<td><?php $total = get_draftcount('uncategorized') + get_categorycount('uncategorized'); echo $total?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<td><a href="<?php echo $d->url;?>" target="_blank"><?php echo $d->title;?></a></td>
|
||||
<td><?php echo $d->body;?></td>
|
||||
<td><?php $total = get_draftcount($d->md) + get_categorycount($d->md); echo $total?></td>
|
||||
<td><a href="<?php echo $d->url;?>/edit?destination=admin/categories">Edit</a> <?php if (get_categorycount($d->md) == 0 && get_draftcount($d->md) == 0 ){echo '<a href="' . $d->url . '/delete?destination=admin/categories">Delete</a>';}?></td>
|
||||
<td><a href="<?php echo $d->url;?>/edit?destination=admin/categories"><?php echo i18n('Edit');?></a> <?php if (get_categorycount($d->md) == 0 && get_draftcount($d->md) == 0 ){echo '<a href="' . $d->url . '/delete?destination=admin/categories">' . i18n('Delete') . '</a>';}?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<h2>Add content</h2>
|
||||
<h2><?php echo i18n('Add_content');?></h2>
|
||||
|
||||
<p><a href="<?php echo site_url();?>add/content?type=post">Regular post</a><br>Creating regular blog post.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=image">Image post</a><br>Creating blog post with featured image.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=video">Video post</a><br>Creating blog post with featured video.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=audio">Audio post</a><br>Creating blog post with featured audio.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=link">Link post</a><br>Creating blog post with featured link.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=quote">Quote post</a><br>Creating blog post with featured quote.</p>
|
||||
<p><a href="<?php echo site_url();?>add/page">Static page</a><br>Creating static page.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=post"><?php echo i18n('Regular_post')?></a><br><?php echo i18n('Regular_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=image"><?php echo i18n('Image_post')?></a><br><?php echo i18n('Image_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=video"><?php echo i18n('Video_post')?></a><br><?php echo i18n('Video_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=audio"><?php echo i18n('Audio_post')?></a><br><?php echo i18n('Audio_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=link"><?php echo i18n('Link_post')?></a><br><?php echo i18n('Link_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/content?type=quote"><?php echo i18n('Quote_post')?></a><br><?php echo i18n('Quote_post_comment')?>.</p>
|
||||
<p><a href="<?php echo site_url();?>add/page"><?php echo i18n('Static_page')?></a><br><?php echo i18n('Static_page_comment')?>.</p>
|
||||
|
|
@ -21,10 +21,10 @@ if (isset($destination)) {
|
|||
$back = site_url();
|
||||
}
|
||||
?>
|
||||
<p>Are you sure want to delete <strong><?php echo $p->title; ?></strong>?</p>
|
||||
<p><?php echo sprintf(i18n('Are_you_sure_you_want_to_delete_'), $p->title);?></p>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="file" value="<?php echo $p->file ?>"/><br>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" value="Delete"/>
|
||||
<span><a href="<?php echo $back ?>">Cancel</a></span>
|
||||
<input type="submit" name="submit" value="<?php echo i18n('Delete');?>"/>
|
||||
<span><a href="<?php echo $back . '">' . i18n('Cancel');?></a></span>
|
||||
</form>
|
||||
|
|
@ -21,10 +21,10 @@ if (isset($destination)) {
|
|||
$back = site_url();
|
||||
}
|
||||
?>
|
||||
<p>Are you sure want to delete <strong><?php echo $p->title; ?></strong>?</p>
|
||||
<p><?php echo sprintf(i18n('Are_you_sure_you_want_to_delete_'), $p->title);?></p>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="file" value="<?php echo $p->file ?>"/><br>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" value="Delete"/>
|
||||
<span><a href="<?php echo $back ?>">Cancel</a></span>
|
||||
<input type="submit" name="submit" value="<?php echo i18n('Delete');?>"/>
|
||||
<span><a href="<?php echo $back . '">' . i18n('Cancel');?></a></span>
|
||||
</form>
|
||||
|
|
@ -29,10 +29,10 @@ if (isset($destination)) {
|
|||
}
|
||||
|
||||
?>
|
||||
<?php echo '<p>Are you sure want to delete <strong>' . $p->title . '</strong>?</p>'; ?>
|
||||
<p><?php echo sprintf(i18n('Are_you_sure_you_want_to_delete_'), $p->title);?></p>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="file" value="<?php echo $p->file ?>"/><br>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" value="Delete"/>
|
||||
<span><a href="<?php echo $back ?>">Cancel</a></span>
|
||||
<input type="submit" name="submit" value="<?php echo i18n('Delete');?>"/>
|
||||
<span><a href="<?php echo $back . '">' . i18n('Cancel');?></a></span>
|
||||
</form>
|
||||
|
|
@ -71,14 +71,14 @@ if (config('permalink.type') == 'post') {
|
|||
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span>
|
||||
<?php echo i18n('Title');?> <span class="required">*</span>
|
||||
<br>
|
||||
<input type="text" name="title" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';} } ?>" value="<?php echo $oldtitle ?>"/>
|
||||
<br><br>
|
||||
Category <span class="required">*</span>
|
||||
<?php echo i18n('Category');?> <span class="required">*</span>
|
||||
<br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<option value="uncategorized"><?php echo i18n("Uncategorized");?></option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
|
|
@ -146,9 +146,9 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<input type="submit" name="publishdraft" class="submit" value="<?php echo i18n('Publish_draft');?>"/> <input type="submit" name="updatedraft" class="draft" value="<?php echo i18n('Update_draft');?>"/> <a href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<input type="submit" name="updatepost" class="submit" value="<?php echo i18n('Update_post');?>"/> <input type="submit" name="revertpost" class="revert" value="<?php echo i18n('Revert_to_draft');?>"/> <a href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ if ($type == 'is_frontpage') {
|
|||
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span>
|
||||
<?php echo i18n('Title');?> <span class="required">*</span>
|
||||
<br>
|
||||
<input type="text" name="title" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error'; } } ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
<?php if($type != 'is_frontpage' && $type != 'is_profile') { ?>
|
||||
|
|
@ -87,7 +87,7 @@ if ($type == 'is_frontpage') {
|
|||
<br>
|
||||
<span class="help">If the url leave empty we will use the page title.</span>
|
||||
<br><br>
|
||||
Meta Description (optional)<br><textarea name="description" rows="3" cols="20"><?php if (isset($p->description)) { echo $p->description;} else {echo $olddescription;}?></textarea>
|
||||
<?php echo i18n('Meta_description');?> (optional)<br><textarea name="description" rows="3" cols="20"><?php if (isset($p->description)) { echo $p->description;} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
<?php } ?>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
|
|
@ -101,7 +101,7 @@ if ($type == 'is_frontpage') {
|
|||
<input type="submit" name="submit" class="submit" value="Save category"/>
|
||||
<?php } else {?>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="submit" name="submit" class="submit" value="Save"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<input type="submit" name="submit" class="submit" value="<?php echo i18n('Save');?>"/> <a href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a>
|
||||
<?php } ?>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
echo '<h2>Your recent posts</h2>';
|
||||
echo '<h2>' . i18n('Your_recent_posts') . '</h2>';
|
||||
get_user_posts();
|
||||
echo '<h2>Static pages</h2>';
|
||||
echo '<h2>' . i18n('Static_pages') . '</h2>';
|
||||
get_user_pages(); ?>
|
||||
|
|
@ -1 +1 @@
|
|||
<h1>No posts found!</h1>
|
||||
<h1><?php echo i18n('No_posts_found');?>!</h1>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
<?php if (!empty($posts)) { ?>
|
||||
<table class="post-list">
|
||||
<tr class="head">
|
||||
<th>Title</th>
|
||||
<th>Published</th><?php if (config("views.counter") == "true"): ?>
|
||||
<th>Views</th><?php endif; ?>
|
||||
<th>Author</th>
|
||||
<th>Tag</th>
|
||||
<th>Operations</th>
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
|
||||
<th><?php echo i18n('Views');?></th><?php endif; ?>
|
||||
<th><?php echo i18n('Author');?></th>
|
||||
<th><?php echo i18n('Tag');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php $i = 0;
|
||||
$len = count($posts); ?>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
?>
|
||||
<tr class="<?php echo $class ?>">
|
||||
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
|
||||
<td><?php echo date('d F Y', $p->date) ?></td>
|
||||
<td><?php echo strftime($date_format, $p->date) ?></td>
|
||||
<?php if (config("views.counter") == "true"): ?>
|
||||
<td><?php echo $p->views ?></td><?php endif; ?>
|
||||
<td><a target="_blank" href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></td>
|
||||
|
|
@ -35,5 +35,5 @@
|
|||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php } else {
|
||||
echo 'No posts found!';
|
||||
echo i18n('No_posts_found') . '!';
|
||||
} ?>
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
<?php if (!empty($posts)) { ?>
|
||||
<table class="post-list">
|
||||
<tr class="head">
|
||||
<th>Title</th>
|
||||
<th>Published</th><?php if (config("views.counter") == "true"): ?>
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
|
||||
<th>Views</th><?php endif; ?>
|
||||
<th>Author</th>
|
||||
<th>Tag</th>
|
||||
<th>Operations</th>
|
||||
<th><?php echo i18n('Author');?></th>
|
||||
<th><?php echo i18n('Tag');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php $i = 0;
|
||||
$len = count($posts); ?>
|
||||
|
|
@ -24,13 +24,13 @@
|
|||
?>
|
||||
<tr class="<?php echo $class ?>">
|
||||
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
|
||||
<td><?php echo date('d F Y', $p->date) ?></td>
|
||||
<td><?php echo strftime($date_format, $p->date) ?></td>
|
||||
<?php if (config("views.counter") == "true"): ?>
|
||||
<td><?php echo $p->views ?></td><?php endif; ?>
|
||||
<td><a target="_blank" href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></td>
|
||||
<td><?php echo $p->tag ?></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/posts">Edit</a> <a
|
||||
href="<?php echo $p->url ?>/delete?destination=admin/posts">Delete</a></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/posts"><?php echo i18n('Edit');?></a> <a
|
||||
href="<?php echo $p->url ?>/delete?destination=admin/posts"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -45,5 +45,5 @@
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
<?php } else {
|
||||
echo 'No posts found!';
|
||||
echo i18n('No_posts_found') . '!';
|
||||
} ?>
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
<?php if (!empty($posts)) { ?>
|
||||
<table class="post-list">
|
||||
<tr class="head">
|
||||
<th>Title</th>
|
||||
<th>Created</th>
|
||||
<th>Tag</th>
|
||||
<th>Operations</th>
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Created');?></th>
|
||||
<th><?php echo i18n('Tag');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php $i = 0;
|
||||
$len = count($posts); ?>
|
||||
|
|
@ -22,12 +22,12 @@
|
|||
?>
|
||||
<tr class="<?php echo $class ?>">
|
||||
<td><?php echo $p->title ?></td>
|
||||
<td><?php echo date('d F Y', $p->date) ?></td>
|
||||
<td><?php echo strftime($date_format, $p->date) ?></td>
|
||||
<td><?php echo strip_tags($p->tag) ?></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/draft">Edit</a> <a href="<?php echo $p->url ?>/delete?destination=admin/draft">Delete</a></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a href="<?php echo $p->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php } else {
|
||||
echo 'No draft found!';
|
||||
echo i18n('No_draft_found') . '!';
|
||||
} ?>
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
<?php if (!empty($posts)) { ?>
|
||||
<table class="post-list">
|
||||
<tr class="head">
|
||||
<th>Title</th>
|
||||
<th>Published</th>
|
||||
<th><?php echo i18n('Title');?></th>
|
||||
<th><?php echo i18n('Published');?></th>
|
||||
<?php if (config("views.counter") == "true"): ?>
|
||||
<th>Views</th>
|
||||
<?php endif; ?>
|
||||
<th>Tag</th>
|
||||
<th>Operations</th>
|
||||
<th><?php echo i18n('Tag');?></th>
|
||||
<th><?php echo i18n('Operations');?></th>
|
||||
</tr>
|
||||
<?php $i = 0;
|
||||
$len = count($posts); ?>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<td><?php echo $p->views ?></td>
|
||||
<?php endif; ?>
|
||||
<td><?php echo $p->tag ?></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/mine">Edit</a> <a href="<?php echo $p->url ?>/delete?destination=admin/mine">Delete</a></td>
|
||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/mine">Edit</a> <a href="<?php echo $p->url ?>/delete?destination=admin/mine"><?php echo i18n('Delete');?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
|
@ -45,5 +45,5 @@
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
<?php } else {
|
||||
echo 'No posts found!';
|
||||
echo i18n('No_posts_found') . '!';
|
||||
} ?>
|
||||
|
|
@ -3,6 +3,17 @@
|
|||
// Load the configuration file
|
||||
config('source', $config_file);
|
||||
|
||||
// Settings for the language
|
||||
if ( config('language') === "de" ) {
|
||||
i18n('source', 'lang/lang-de.ini'); // Load the German language file
|
||||
$date_format = '%d. %B %Y'; // Date format German style
|
||||
setlocale(LC_TIME, 'de_DE', 'de_DE.utf8', "German"); // Change time format to German
|
||||
} else { // Default: English ("en")
|
||||
i18n('source', 'lang/lang-en.ini'); // Load the English language file
|
||||
$date_format = '%B %d, %Y'; // Date format English style
|
||||
setlocale(LC_TIME, 'en_US', 'en_US.utf8', "English"); // Change time format to English
|
||||
}
|
||||
|
||||
// Set the timezone
|
||||
if (config('timezone')) {
|
||||
date_default_timezone_set(config('timezone'));
|
||||
|
|
@ -403,7 +414,7 @@ get('/add/content', function () {
|
|||
config('views.root', 'system/admin/views');
|
||||
|
||||
render('add-content', array(
|
||||
'title' => 'Add content - ' . blog_title(),
|
||||
'title' => i18n('Add_content') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'type' => $type,
|
||||
|
|
@ -866,7 +877,7 @@ get('/admin/posts', function () {
|
|||
|
||||
// a non-existing page
|
||||
render('no-posts', array(
|
||||
'title' => 'All blog posts - ' . blog_title(),
|
||||
'title' => i18n('All_blog_posts') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'bodyclass' => 'no-posts',
|
||||
|
|
@ -884,10 +895,10 @@ get('/admin/posts', function () {
|
|||
}
|
||||
|
||||
render('posts-list', array(
|
||||
'title' => 'All blog posts - ' . blog_title(),
|
||||
'title' => i18n('All_blog_posts') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'heading' => 'All blog posts',
|
||||
'heading' => i18n('All_blog_posts'),
|
||||
'page' => $page,
|
||||
'posts' => $posts,
|
||||
'bodyclass' => 'all-posts',
|
||||
|
|
@ -898,7 +909,7 @@ get('/admin/posts', function () {
|
|||
));
|
||||
} else {
|
||||
render('denied', array(
|
||||
'title' => 'All blog posts - ' . blog_title(),
|
||||
'title' => i18n('All_blog_posts') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'type' => 'is_admin-posts',
|
||||
|
|
@ -1012,7 +1023,7 @@ get('/admin/mine', function () {
|
|||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'page' => $page,
|
||||
'heading' => 'My posts',
|
||||
'heading' => i18n('My_posts'),
|
||||
'posts' => null,
|
||||
'about' => $author->about,
|
||||
'name' => $author->name,
|
||||
|
|
@ -1029,7 +1040,7 @@ get('/admin/mine', function () {
|
|||
'title' => 'My blog posts - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'heading' => 'My posts',
|
||||
'heading' => i18n('My_posts'),
|
||||
'page' => $page,
|
||||
'posts' => $posts,
|
||||
'about' => $author->about,
|
||||
|
|
@ -1073,11 +1084,11 @@ get('/admin/draft', function () {
|
|||
|
||||
if (empty($posts) || $page < 1) {
|
||||
render('user-draft', array(
|
||||
'title' => 'My draft - ' . blog_title(),
|
||||
'title' => i18n('My_draft') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'page' => $page,
|
||||
'heading' => 'My draft',
|
||||
'heading' => i18n('My_draft'),
|
||||
'posts' => null,
|
||||
'about' => $author->about,
|
||||
'name' => $author->name,
|
||||
|
|
@ -1090,10 +1101,10 @@ get('/admin/draft', function () {
|
|||
}
|
||||
|
||||
render('user-draft', array(
|
||||
'title' => 'My draft - ' . blog_title(),
|
||||
'title' => i18n('My_draft') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'heading' => 'My draft',
|
||||
'heading' => i18n('My_draft'),
|
||||
'page' => $page,
|
||||
'posts' => $posts,
|
||||
'about' => $author->about,
|
||||
|
|
@ -1114,13 +1125,13 @@ get('/admin/content', function () {
|
|||
if (login()) {
|
||||
config('views.root', 'system/admin/views');
|
||||
render('content-type', array(
|
||||
'title' => 'Add content - ' . blog_title(),
|
||||
'title' => i18n('Add_content') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'type' => 'is_admin-content',
|
||||
'is_admin' => true,
|
||||
'bodyclass' => 'admin-content',
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Add content'
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » ' . i18n('Add_content')
|
||||
));
|
||||
} else {
|
||||
$login = site_url() . 'login';
|
||||
|
|
@ -2319,7 +2330,7 @@ get('/:static', function ($static) {
|
|||
if (login()) {
|
||||
config('views.root', 'system/admin/views');
|
||||
render('main', array(
|
||||
'title' => 'Admin - ' . blog_title(),
|
||||
'title' => i18n('Admin') . ' - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'bodyclass' => 'admin-front',
|
||||
|
|
|
|||
|
|
@ -40,6 +40,22 @@ function error($code, $message)
|
|||
die($message);
|
||||
}
|
||||
|
||||
// i18n provides strings in the current language
|
||||
function i18n($key, $value = null)
|
||||
{
|
||||
static $_i18n = array();
|
||||
|
||||
if ($key === 'source') {
|
||||
if (file_exists($value))
|
||||
$_i18n = parse_ini_file($value, true);
|
||||
else
|
||||
$_i18n = parse_ini_file('lang/lang-en.ini', true);
|
||||
} elseif ($value == null)
|
||||
return (isset($_i18n[$key]) ? $_i18n[$key] : '_i18n_' . $key . '_i18n_');
|
||||
else
|
||||
$_i18n[$key] = $value;
|
||||
}
|
||||
|
||||
function config($key, $value = null)
|
||||
{
|
||||
static $_config = array();
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ function default_category()
|
|||
$tmp = array();
|
||||
$desc = new stdClass;
|
||||
|
||||
$desc->title = 'Uncategorized';
|
||||
$desc->title = i18n("Uncategorized");
|
||||
$desc->url = site_url() . 'category/uncategorized';
|
||||
$desc->body = '<p>Topics that don't need a category, or don't fit into any other existing category.</p>';
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ function category_list($custom = null) {
|
|||
foreach ($arr as $a) {
|
||||
$cat[] = array($a->md, $a->title);
|
||||
}
|
||||
array_push($cat, array('uncategorized', 'Uncategorized'));
|
||||
array_push($cat, array('uncategorized', i18n('Uncategorized')));
|
||||
asort($cat);
|
||||
$tmp = serialize($cat);
|
||||
file_put_contents($filename, print_r($tmp, true));
|
||||
|
|
@ -988,7 +988,7 @@ function get_related($tag, $custom = null, $count = null)
|
|||
echo '</ul>';
|
||||
|
||||
} else {
|
||||
echo '<ul><li>No related post found</li></ul>';
|
||||
echo '<ul><li>' . i18n('No_related_post_found') . '</li></ul>';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -1406,7 +1406,7 @@ EOF;
|
|||
echo '<ul class="month">';
|
||||
|
||||
foreach ($by_month as $month => $count) {
|
||||
$name = date('F', mktime(0, 0, 0, $month, 1, 2010));
|
||||
$name = strftime('%B', mktime(0, 0, 0, $month, 1, 2010));
|
||||
echo '<li class="item"><a href="' . site_url() . 'archive/' . $year . '-' . $month . '">' . $name . '</a>';
|
||||
echo ' <span class="count">(' . $count . ')</span></li>';
|
||||
}
|
||||
|
|
@ -2150,10 +2150,11 @@ function search($text = null)
|
|||
</form>
|
||||
EOF;
|
||||
} else {
|
||||
$search = i18n('Search');
|
||||
echo <<<EOF
|
||||
<form id="search-form" method="get">
|
||||
<input type="text" class="search-input" name="search" value="Search" onfocus="if (this.value == 'Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search';}">
|
||||
<input type="submit" value="Search" class="search-button">
|
||||
<input type="text" class="search-input" name="search" value="{$search}" onfocus="if (this.value == '{$search}') {this.value = '';}" onblur="if (this.value == '') {this.value = '{$search}';}">
|
||||
<input type="submit" value="{$search}" class="search-button">
|
||||
</form>
|
||||
EOF;
|
||||
}
|
||||
|
|
@ -2760,28 +2761,28 @@ function toolbar()
|
|||
<link href="{$base}system/resources/css/toolbar.css" rel="stylesheet" />
|
||||
EOF;
|
||||
echo '<div id="toolbar"><ul>';
|
||||
echo '<li><a href="' . $base . 'admin">Admin</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin">' . i18n('Admin') . '</a></li>';
|
||||
if ($role === 'admin') {
|
||||
echo '<li><a href="' . $base . 'admin/posts">Posts</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/posts">' . i18n('Posts') . '</a></li>';
|
||||
if (config('views.counter') == 'true') {
|
||||
echo '<li><a href="' . $base . 'admin/popular">Popular</a></li>';
|
||||
}
|
||||
}
|
||||
echo '<li><a href="' . $base . 'admin/mine">Mine</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/draft">Draft</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/content">Add content</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/mine">' . i18n('Mine') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/draft">' . i18n('Draft') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/content">' . i18n('Add_content') . '</a></li>';
|
||||
if ($role === 'admin') {
|
||||
echo '<li><a href="' . $base . 'admin/categories">Categories</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/categories">' . i18n('Categories') . '</a></li>';
|
||||
}
|
||||
echo '<li><a href="' . $base . 'edit/profile">Edit profile</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/import">Import</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/backup">Backup</a></li>';
|
||||
echo '<li><a href="' . $base . 'edit/profile">' . i18n('Edit_profile') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/import">' . i18n('Import') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/backup">' . i18n('Backup') . '</a></li>';
|
||||
if ($role === 'admin') {
|
||||
echo '<li><a href="' . $base . 'admin/config">Config</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/config">' . i18n('Config') . '</a></li>';
|
||||
}
|
||||
echo '<li><a href="' . $base . 'admin/clear-cache">Clear cache</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/update">Update</a></li>';
|
||||
echo '<li><a href="' . $base . 'logout">Logout</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/clear-cache">' . i18n('Clear_cache') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'admin/update">' . i18n('Update') . '</a></li>';
|
||||
echo '<li><a href="' . $base . 'logout">' . i18n('Logout') . '</a></li>';
|
||||
|
||||
echo '</ul></div>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue