Languages support

This commit is contained in:
dignajar 2015-07-03 17:44:26 -03:00
parent 4260863b9b
commit 8801ed0637
26 changed files with 338 additions and 222 deletions

View File

@ -43,8 +43,8 @@ $(document).ready(function() {
<nav class="navbar nav-fullwidth">
<h1>Bludit</h1>
<ul>
<li><a href="<?php echo HTML_PATH_ROOT ?>">Home</a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard">Dashboard</a></li>
<li>Welcome back, <?php echo $Login->username() ?></li>
<li><a target="_blank" href="<?php echo HTML_PATH_ROOT ?>">Website</a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>logout">Logout</a></li>
</ul>
</nav>
@ -57,6 +57,7 @@ $(document).ready(function() {
<div id="sidebar" class="nav">
<ul>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard"><i class="fa fa-sun-o"></i>Dashboard</a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>new-post"><i class="fa fa-pencil-square-o"></i>New post</a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>new-page"><i class="fa fa-pencil"></i>New page</a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>manage-posts"><i class="fa fa-file-text-o"></i>Manage</a></li>

View File

@ -1,38 +1,38 @@
<h2 class="title"><i class="fa fa-user-plus"></i> Add a new user</h2>
<h2 class="title"><i class="fa fa-user-plus"></i> <?php $Language->p('Add a new user') ?></h2>
<?php makeNavbar('users'); ?>
<form method="post" action="" class="forms">
<label>
Username
<?php $Language->p('Username') ?>
<input type="text" name="username" class="width-50">
</label>
<label>
Password
<?php $Language->p('Password') ?>
<input type="password" name="password" class="width-50">
</label>
<label>
Confirm Password
<?php $Language->p('Confirm Password') ?>
<input type="password" name="confirm-password" class="width-50">
</label>
<label for="country">
Role
<?php $Language->p('Role') ?>
<select name="role" class="width-50">
<option value="editor">Editor</option>
<option value="admin">Administrator</option>
<option value="editor"><?php $Language->p('Editor') ?></option>
<option value="admin"><?php $Language->p('Administrator') ?></option>
</select>
<div class="forms-desc">You can choose the user's privilege. The editor role only can write pages and posts.</div>
<div class="forms-desc"><?php $Language->p('you-can-choose-the-users-privilege') ?></div>
</label>
<label>
Email
<input type="text" name="email" class="width-50">
<div class="forms-desc">Email will not be publicly displayed. Recommended for recovery password and notifications.</div>
<div class="forms-desc"><?php $Language->p('email-will-not-be-publicly-displayed') ?></div>
</label>
<input type="submit" class="btn btn-blue" value="Add" name="add-user">
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn">Cancel</a>
<input type="submit" class="btn btn-blue" value="<?php $Language->p('Add') ?>" name="add-user">
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn"><?php $Language->p('Cancel') ?></a>
</form>

View File

@ -1,4 +1,4 @@
<h2 class="title">Dashboard</h2>
<h2 class="title"><?php $Language->p('Dashboard') ?> </h2>
<div class="units-row">
@ -7,7 +7,7 @@
<div class="dashboardBox">
<div class="content contentBlue">
<div class="bigContent"><?php echo $dbPosts->count() ?></div>
<div class="littleContent">posts</div>
<div class="littleContent"><?php $Language->p('Posts') ?></div>
<i class="iconContent fa fa-pie-chart"></i>
</div>
</div>
@ -15,7 +15,7 @@
<div class="dashboardBox">
<div class="content contentGreen">
<div class="bigContent"><?php echo $dbUsers->count() ?></div>
<div class="littleContent">Users</div>
<div class="littleContent"><?php $Language->p('Users') ?></div>
<i class="iconContent fa fa-user"></i>
</div>
</div>

View File

@ -1,43 +1,43 @@
<h2 class="title"><i class="fa fa-pencil"></i> Edit page</h2>
<h2 class="title"><i class="fa fa-pencil"></i> <?php $Language->p('Edit page') ?></h2>
<form method="post" action="" class="forms">
<input type="hidden" id="jsKey" name="key" value="<?php echo $_Page->key() ?>">
<input type="hidden" id="jskey" name="key" value="<?php echo $_Page->key() ?>">
<label>
Title
<input id="jsTitle" name="title" type="text" class="width-70" value="<?php echo $_Page->title() ?>">
<?php $Language->p('Title') ?>
<input id="jstitle" name="title" type="text" class="width-70" value="<?php echo $_Page->title() ?>">
</label>
<label>
Content <span class="forms-desc">HTML and Markdown code supported.</span>
<?php $Language->p('Content') ?> <span class="forms-desc"><?php $Language->p('HTML and Markdown code supported') ?></span>
<textarea name="content" rows="10" class="width-70"><?php echo $_Page->contentRaw(false) ?></textarea>
</label>
<?php
if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">';
echo '<div id="jsadvancedOptions">';
}
else
{
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>';
echo '<div id="jsAdvancedOptions" style="display:none">';
echo '<p class="advOptions">'.$Language->p('Enable more features at').'<a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">'.$Language->p('settings-advanced-writting-settings').'</a></p>';
echo '<div id="jsadvancedOptions" style="display:none">';
}
?>
<h4>Advanced options</h4>
<h4><?php $Language->p('Advanced options') ?></h4>
<?php
// Remove pages parents if the page is a parent.
if(count($_Page->children())===0)
{
?>
<?php
// Remove setting pages parents if the page is a parent.
if(count($_Page->children())===0)
{
?>
<label for="jsParent">
Page parent
<select id="jsParent" name="parent" class="width-50">
<label for="jsparent">
<?php $Language->p('Parent') ?>
<select id="jsparent" name="parent" class="width-50">
<?php
$htmlOptions[NO_PARENT_CHAR] = '(No parent)';
$htmlOptions[NO_PARENT_CHAR] = '('.$Language->p('No parent').')';
$htmlOptions += $dbPages->parentKeyList();
unset($htmlOptions[$_Page->key()]);
foreach($htmlOptions as $value=>$text) {
@ -48,41 +48,41 @@
<div class="forms-desc">Tip/Help ???</div>
</label>
<?php } ?>
<?php } ?>
<label>
Friendly url
<?php $Language->p('Friendly URL') ?>
<div class="input-groups width-50">
<span class="input-prepend"><?php echo $Site->url() ?><span id="jsParentExample"><?php echo $_Page->parentKey()?$_Page->parentKey().'/':''; ?></span></span>
<input id="jsSlug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
<span class="input-prepend"><?php echo $Site->url() ?><span id="jsparentExample"><?php echo $_Page->parentKey()?$_Page->parentKey().'/':''; ?></span></span>
<input id="jsslug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
</div>
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
<span class="forms-desc">You can modify the URL which identifies a page or post using human-readable keywords. No more than 150 characters.</span>
</label>
<label>
Description
<input id="jsDescription" type="text" name="description" class="width-50" value="<?php echo $_Page->description() ?>">
<span class="forms-desc">This field is for Twitter/Facebook/Google+ descriptions. No more than 150 characters.</span>
<?php $Language->p('Description') ?>
<input id="jsdescription" type="text" name="description" class="width-50" value="<?php echo $_Page->description() ?>">
<span class="forms-desc">This field can help describe the content in a few words. No more than 150 characters.</span>
</label>
<label>
Tags
<input id="jsTags" name="tags" type="text" class="width-50" value="<?php echo $_Page->tags() ?>">
<?php $Language->p('Tags') ?>
<input id="jstags" name="tags" type="text" class="width-50" value="<?php echo $_Page->tags() ?>">
<span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label>
<label>
Position
<input id="jsPosition" name="position" type="text" class="width-20" value="<?php echo $_Page->position() ?>">
<?php $Language->p('Position') ?>
<input id="jsposition" name="position" type="text" class="width-20" value="<?php echo $_Page->position() ?>">
</label>
</div>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i>Save</button>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i><?php $Language->p('Save') ?></button>
<?php if(count($_Page->children())===0) { ?>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i>Draft</button>
<button class="btn" name="delete"><i class="fa fa-remove fa-right"></i>Delete</button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i><?php $Language->p('Draft') ?></button>
<button class="btn" name="delete"><i class="fa fa-remove fa-right"></i><?php $Language->p('Delete') ?></button>
<?php } ?>
</form>
@ -91,34 +91,34 @@
$(document).ready(function()
{
var key = $("#jsKey").val();
var key = $("#jskey").val();
$("#jsSlug").keyup(function() {
$("#jsslug").keyup(function() {
var text = $(this).val();
var parent = $("#jsParent").val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, key, $("#jsSlug"));
checkSlugPage(text, parent, key, $("#jsslug"));
});
$("#jsTitle").keyup(function() {
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsParent").val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, key, $("#jsSlug"));
checkSlugPage(text, parent, key, $("#jsslug"));
});
$("#jsParent").change(function() {
$("#jsparent").change(function() {
var parent = $(this).val();
var text = $("#jsSlug").val();
var text = $("#jsslug").val();
if(parent==NO_PARENT_CHAR) {
$("#jsParentExample").text("");
$("#jsparentExample").text("");
}
else {
$("#jsParentExample").text(parent+"/");
$("#jsparentExample").text(parent+"/");
}
checkSlugPage(text, parent, key, $("#jsSlug"));
checkSlugPage(text, parent, key, $("#jsslug"));
});
});

View File

@ -1,57 +1,57 @@
<h2 class="title"><i class="fa fa-pencil"></i> Edit post</h2>
<h2 class="title"><i class="fa fa-pencil"></i> <?php $Language->p('Edit post') ?></h2>
<form method="post" action="" class="forms">
<input type="hidden" id="jsKey" name="key" value="<?php echo $_Post->key() ?>">
<input type="hidden" id="jskey" name="key" value="<?php echo $_Post->key() ?>">
<label>
Title
<input id="jsTitle" name="title" type="text" class="width-70" value="<?php echo $_Post->title() ?>">
<?php $Language->p('Title') ?>
<input id="jstitle" name="title" type="text" class="width-70" value="<?php echo $_Post->title() ?>">
</label>
<label>
Content <span class="forms-desc">HTML and Markdown code supported.</span>
<textarea name="content" rows="10" class="width-70"><?php echo $_Post->contentRaw(false) ?></textarea>
<?php $Language->p('Content') ?> <span class="forms-desc"><?php $Language->p('HTML and Markdown code supported') ?></span>
<textarea id="jscontent" name="content" rows="10" class="width-70"><?php echo $_Post->contentRaw(false) ?></textarea>
</label>
<?php
if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">';
echo '<div id="jsadvancedOptions">';
}
else
{
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>';
echo '<div id="jsAdvancedOptions" style="display:none">';
echo '<div id="jsadvancedOptions" style="display:none">';
}
?>
<h4>Advanced options</h4>
<h4><?php $Language->p('Advanced options') ?></h4>
<label>
Friendly url
<?php $Language->p('Friendly Url') ?>
<div class="input-groups width-50">
<span class="input-prepend"><?php echo $Site->urlPost() ?><span id="jsParentExample"></span></span>
<input id="jsSlug" type="text" name="slug" value="<?php echo $_Post->slug() ?>">
<span class="input-prepend"><?php echo $Site->urlPost() ?><span id="jsparentExample"></span></span>
<input id="jsslug" type="text" name="slug" value="<?php echo $_Post->slug() ?>">
</div>
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
</label>
<label>
Description
<input id="jsDescription" type="text" name="description" class="width-50" value="<?php echo $_Post->description() ?>">
<?php $Language->p('Description') ?>
<input id="jsdescription" type="text" name="description" class="width-50" value="<?php echo $_Post->description() ?>">
<span class="forms-desc">This field is for Twitter/Facebook/Google+ descriptions. No more than 150 characters.</span>
</label>
<label>
Tags
<input id="jsTags" name="tags" type="text" class="width-50" value="<?php echo $_Post->tags() ?>">
<?php $Language->p('Tags') ?>
<input id="jstags" name="tags" type="text" class="width-50" value="<?php echo $_Post->tags() ?>">
<span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label>
</div>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i>Save</button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i>Draft</button>
<button class="btn" name="delete"><i class="fa fa-remove fa-right"></i>Delete</button>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i><?php $Language->p('Save') ?></button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i><?php $Language->p('Draft') ?></button>
<button class="btn" name="delete"><i class="fa fa-remove fa-right"></i><?php $Language->p('Delete') ?></button>
</form>
@ -59,18 +59,18 @@
$(document).ready(function()
{
var key = $("#jsKey").val();
var key = $("#jskey").val();
$("#jsTitle").keyup(function() {
$("#jstitle").keyup(function() {
var slug = $(this).val();
checkSlugPost(slug, key, $("#jsSlug"));
checkSlugPost(slug, key, $("#jsslug"));
});
$("#jsSlug").keyup(function() {
var slug = $("#jsSlug").val();
$("#jsslug").keyup(function() {
var slug = $("#jsslug").val();
checkSlugPost(slug, key, $("#jsSlug"));
checkSlugPost(slug, key, $("#jsslug"));
});
});

View File

@ -3,33 +3,33 @@
<form method="post" action="" class="forms">
<label>
Title
<input id="jsTitle" name="title" type="text" class="width-70">
<?php $Language->p('Title') ?>
<input id="jstitle" name="title" type="text" class="width-70">
</label>
<label>
Content <span class="forms-desc">HTML and Markdown code supported.</span>
<textarea id="jsContent" name="content" rows="10" class="width-70"></textarea>
<?php $Language->p('Content') ?> <span class="forms-desc"><?php $Language->p('HTML and Markdown code supported') ?></span>
<textarea id="jscontent" name="content" rows="10" class="width-70"></textarea>
</label>
<?php
if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">';
echo '<div id="jsadvancedOptions">';
}
else
{
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>';
echo '<div id="jsAdvancedOptions" style="display:none">';
echo '<p class="advOptions">'.$Language->p('Enable more features at').'<a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">'.$Language->p('settings-advanced-writting-settings').'</a></p>';
echo '<div id="jsadvancedOptions" style="display:none">';
}
?>
<h4>Advanced options</h4>
<h4><?php $Language->p('Advanced options') ?></h4>
<label for="jsParent">
Page parent
<select id="jsParent" name="parent" class="width-50">
<label for="jsparent">
<?php $Language->p('Parent') ?>
<select id="jsparent" name="parent" class="width-50">
<?php
$htmlOptions[NO_PARENT_CHAR] = '(No parent)';
$htmlOptions[NO_PARENT_CHAR] = '('.$Language->p('No parent').')';
$htmlOptions += $dbPages->parentKeyList();
foreach($htmlOptions as $value=>$text) {
echo '<option value="'.$value.'">'.$text.'</option>';
@ -40,35 +40,35 @@
</label>
<label>
Friendly url
<?php $Language->p('Friendly Url') ?>
<div class="input-groups width-50">
<span class="input-prepend"><?php echo $Site->urlPage() ?><span id="jsParentExample"></span></span>
<input id="jsSlug" name="slug" type="text">
<span class="input-prepend"><?php echo $Site->urlPage() ?><span id="jsparentExample"></span></span>
<input id="jsslug" name="slug" type="text">
</div>
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
</label>
<label>
Description
<input id="jsDescription" name="description" type="text" class="width-50">
<?php $Language->p('Description') ?>
<input id="jsdescription" name="description" type="text" class="width-50">
<span class="forms-desc">This field is for Twitter/Facebook/Google+ descriptions. No more than 150 characters.</span>
</label>
<label>
Tags
<input id="jsTags" name="tags" type="text" class="width-50">
<?php $Language->p('Tags') ?>
<input id="jstags" name="tags" type="text" class="width-50">
<span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label>
<label>
Position
<input id="jsPosition" name="position" type="text" class="width-20" value="0">
<?php $Language->p('Position') ?>
<input id="jsposition" name="position" type="text" class="width-20" value="0">
</label>
</div>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i>Publish now</button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i>Draft</button>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i><?php $Language->p('Publish now') ?></button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i><?php $Language->p('Draft') ?></button>
</form>
@ -77,32 +77,32 @@
$(document).ready(function()
{
$("#jsSlug").keyup(function() {
$("#jsslug").keyup(function() {
var text = $(this).val();
var parent = $("#jsParent").val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, "", $("#jsSlug"));
checkSlugPage(text, parent, "", $("#jsslug"));
});
$("#jsTitle").keyup(function() {
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsParent").val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, "", $("#jsSlug"));
checkSlugPage(text, parent, "", $("#jsslug"));
});
$("#jsParent").change(function() {
$("#jsparent").change(function() {
var parent = $(this).val();
var text = $("#jsSlug").val();
var text = $("#jsslug").val();
if(parent==NO_PARENT_CHAR) {
$("#jsParentExample").text("");
$("#jsparentExample").text("");
}
else {
$("#jsParentExample").text(parent+"/");
$("#jsparentExample").text(parent+"/");
}
checkSlugPage(text, parent, "", $("#jsSlug"));
checkSlugPage(text, parent, "", $("#jsslug"));
});
});

View File

@ -3,53 +3,53 @@
<form method="post" action="" class="forms">
<label>
Title
<input id="jsTitle" name="title" type="text" class="width-70">
<?php $Language->p('Title') ?>
<input id="jstitle" name="title" type="text" class="width-70">
</label>
<label>
Content <span class="forms-desc">HTML and Markdown code supported.</span>
<textarea id="jsContent" name="content" rows="10" class="width-70"></textarea>
<?php $Language->p('Content') ?> <span class="forms-desc"><?php $Language->p('HTML and Markdown code supported') ?></span>
<textarea id="jscontent" name="content" rows="10" class="width-70"></textarea>
</label>
<?php
if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">';
echo '<div id="jsadvancedOptions">';
}
else
{
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>';
echo '<div id="jsAdvancedOptions" style="display:none">';
echo '<p class="advOptions">'.$Language->p('Enable more features at').'<a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">'.$Language->p('settings-advanced-writting-settings').'</a></p>';
echo '<div id="jsadvancedOptions" style="display:none">';
}
?>
<h4>Advanced options</h4>
<h4><?php $Language->p('Advanced options') ?></h4>
<label>
Friendly url
<?php $Language->p('Friendly Url') ?>
<div class="input-groups width-50">
<span class="input-prepend"><?php echo $Site->urlPost() ?><span id="jsParentExample"></span></span>
<input id="jsSlug" name="slug" type="text">
<span class="input-prepend"><?php echo $Site->urlPost() ?><span id="jsparentExample"></span></span>
<input id="jsslug" name="slug" type="text">
</div>
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
</label>
<label>
Description
<input id="jsDescription" name="description" type="text" class="width-50">
<?php $Language->p('Description') ?>
<input id="jsdescription" name="description" type="text" class="width-50">
<span class="forms-desc">This field is for Twitter/Facebook/Google+ descriptions. No more than 150 characters.</span>
</label>
<label>
Tags
<input id="jsTags" name="tags" type="text" class="width-50">
<?php $Language->p('Tags') ?>
<input id="jstags" name="tags" type="text" class="width-50">
<span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label>
</div>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i>Publish now</button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i>Draft</button>
<button class="btn btn-blue" name="publish"><i class="fa fa-sun-o fa-right"></i><?php $Language->p('Publish now') ?></button>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i><?php $Language->p('Draft') ?></button>
</form>
@ -58,16 +58,16 @@
$(document).ready(function()
{
$("#jsTitle").keyup(function() {
$("#jstitle").keyup(function() {
var slug = $(this).val();
checkSlugPost(slug, "", $("#jsSlug"));
checkSlugPost(slug, "", $("#jsslug"));
});
$("#jsSlug").keyup(function() {
var slug = $("#jsSlug").val();
$("#jsslug").keyup(function() {
var slug = $("#jsslug").val();
checkSlugPost(slug, "", $("#jsSlug"));
checkSlugPost(slug, "", $("#jsslug"));
});
});

View File

@ -5,7 +5,7 @@
{
echo '<div class="pluginBox">';
echo '<p>'.$Plugin->title().'</p>';
echo '<p>'.$Plugin->name().'</p>';
echo '<p>'.$Plugin->description().'</p>';
if($Plugin->installed()) {

View File

@ -109,9 +109,9 @@
<div id="regional">
<form method="post" action="" class="forms" name="form-regional">
<label for="language">
<label for="jslanguage">
Language
<select name="language" class="width-50">
<select id="jslanguage" name="language" class="width-50">
<?php
$htmlOptions = $Language->getLanguageList();
foreach($htmlOptions as $locale=>$nativeName) {
@ -122,9 +122,9 @@
<div class="forms-desc">Select your site's language.</div>
</label>
<label for="timezone">
<label for="jstimezone">
Timezone
<select name="timezone" class="width-50">
<select id="jstimezone" name="timezone" class="width-50">
<?php
$htmlOptions = Date::timezoneList();
foreach($htmlOptions as $text=>$value) {
@ -137,7 +137,7 @@
<label>
Locale
<input type="text" name="locale" class="width-50" value="<?php echo $Site->locale() ?>">
<input id="jslocale" type="text" name="locale" class="width-50" value="<?php echo $Site->locale() ?>">
<div class="forms-desc">You can use this field to define a set of parameters related to the languege, country and special preferences.</div>
</label>
@ -145,6 +145,18 @@
</form>
</div>
<script>
$(document).ready(function() {
$("#jslanguage").change(function () {
var locale = $("#jslanguage option:selected").val();
$("#jslocale").attr("value",locale);
});
});
</script>
<!-- ===================================== -->
<!-- About -->

View File

@ -2,37 +2,30 @@ Diego Najar
—————————
Implementar
- Links a Google+, Facebook y Twitter
- Plugins
- Plugins SEO, description, opengraph, etc..
- Comentarios
- Notificaciones
- iPhone app
ToDO
- Social links: Google+, Facebook y Twitter
- Plugins: Edit databases from Dashboard
- Plugins: SEO, Tinymce,
- Comments system
- Notifications system
- Cloud
- Users: delete user
- Implement User class
- Themes
- Plugins multilangueage
Check:
- ver casos de errores, filtros url iguales, con una /
- No permitir en filtros url iguales, agregar / al comienzo y final
- No permitir en filtros url iguales
- Usuarios de lectura ?, no vale la pena, y hay que hacer mas controles a nivel de administracion.
- Implementar algun limpiador**
—————————
**LIMPIADOR
- Recorrer directorios content/posts/, Si el post no tiene el archivo index.txt quiere decir que ese directorio no debe existir y debe ser eliminado
—————————
Habilitar rewriterules en el server, httpd.conf
<Directory /var/www/html>
AllowOverride All
————
find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Text/helperText/g'
find . -type f -name "*.php" -print0 | xargs -0 sed -i 's/Url/helperUrl/g'
find . -type f -name '*.php' -exec sed -i '' s/helperText/Text/ {} +
————
—————————
Editar una pagina
1- Usuario logueado

View File

@ -6,6 +6,7 @@ class dbJSON
public $file;
public $firstLine;
// $firstLine, TRUE if you want to remove the first line.
function __construct($file, $firstLine=true)
{
$this->file = $file;
@ -75,6 +76,11 @@ class dbJSON
return $this->save();
}
public function getDb()
{
return $this->db;
}
// DEBUG, se puede borrar
public function show()
{

View File

@ -16,12 +16,22 @@ class Plugin {
public $className;
public $data;
function __construct()
{
$reflector = new ReflectionClass(get_class($this));
$this->data = array(
'name'=>'',
'description'=>'',
'author'=>'',
'email'=>'',
'website'=>''
);
// Directory name
$this->directoryName = basename(dirname($reflector->getFileName()));
$this->directoryName = basename(dirname($reflector->getFileName())).DS;
// Class Name
$this->className = $reflector->getName();
@ -32,7 +42,7 @@ class Plugin {
// Init empty database
$this->db = $this->dbFields;
$this->fileDb = PATH_PLUGINS_DATABASES.$this->directoryName.'/db.php';
$this->fileDb = PATH_PLUGINS_DATABASES.$this->directoryName.'db.php';
// If the plugin installed then get the database.
if($this->installed())
@ -42,22 +52,43 @@ class Plugin {
}
}
public function title()
public function getData($key)
{
if(isset($this->db['title'])) {
return $this->db['title'];
if(isset($this->data[$key])) {
return $this->data[$key];
}
return '';
}
public function setData($array)
{
$this->data = $array;
}
public function name()
{
return $this->getData('name');
}
public function description()
{
if(isset($this->db['description'])) {
return $this->db['description'];
}
return $this->getData('description');
}
return '';
public function author()
{
return $this->getData('author');
}
public function email()
{
return $this->getData('email');
}
public function website()
{
return $this->getData('website');
}
public function className()
@ -65,6 +96,11 @@ class Plugin {
return $this->className;
}
public function directoryName()
{
return $this->directoryName;
}
// Return TRUE if the installation success, otherwise FALSE.
public function install()
{

View File

@ -37,9 +37,9 @@ if( $Login->isLogged() && ($layout['slug']==='ajax') )
else
{
// Boot rules
include(PATH_RULES.'60.plugins.php');
include(PATH_RULES.'70.build_posts.php');
include(PATH_RULES.'70.build_pages.php');
include(PATH_RULES.'80.plugins.php');
include(PATH_RULES.'99.header.php');
if($Url->notFound() || !$Login->isLogged() || ($Url->slug()==='login') )

View File

@ -142,9 +142,6 @@ function build_all_pages()
// Main
// ============================================================================
// Plugins before load pages
Theme::plugins('beforePagesLoad');
// Filter by page, then build it
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
{
@ -186,6 +183,3 @@ if($Url->notFound())
// Build all pages
build_all_pages();
// Plugins after load pages
Theme::plugins('afterPagesLoad');

View File

@ -92,9 +92,6 @@ function build_posts_per_page($pageNumber=0, $amount=5, $draftPosts=false)
// Main
// ============================================================================
// Plugins before load posts
Theme::plugins('beforePostsLoad');
// Filter by post, then build it
if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
{
@ -129,6 +126,3 @@ else
build_posts_per_page($Url->pageNumber(), $Site->postsPerPage(), false);
}
}
// Plugins after load posts
Theme::plugins('afterPostsLoad');

View File

@ -29,6 +29,8 @@ function build_plugins()
{
global $plugins;
global $pluginsEvents;
global $Language;
global $Site;
// List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS);
@ -38,7 +40,7 @@ function build_plugins()
// Load each plugin clasess
foreach($list as $pluginPath) {
include($pluginPath.'/plugin.php');
include($pluginPath.DS.'plugin.php');
}
// Get plugins clasess loaded
@ -48,10 +50,28 @@ function build_plugins()
{
$Plugin = new $pluginClass;
// All plugins installed and not installed.
// Set Plugin data
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.$Site->locale().'.json';
if( Sanitize::pathFile($languageFilename) )
{
$data = new dbJSON($languageFilename, false);
}
else
{
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().'language'.DS.'en_US.json';
$data = new dbJSON($languageFilename, false);
}
$data = $data->getDb();
$Plugin->setData( $data['plugin-data'] );
// Add words to language dictionary.
unset($data['plugin-data']);
$Language->add($data);
// Push Plugin to array all plugins installed and not installed.
array_push($plugins['all'], $Plugin);
// If the plugin installed, then add the plugin on the arrays.
// If the plugin installed
if($Plugin->installed())
{
foreach($pluginsEvents as $event=>$value)

View File

@ -1,9 +1,9 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// Boot rules
include(PATH_RULES.'60.plugins.php');
include(PATH_RULES.'70.build_posts.php');
include(PATH_RULES.'70.build_pages.php');
include(PATH_RULES.'80.plugins.php');
include(PATH_RULES.'99.header.php');
// Theme init.php

View File

@ -24,6 +24,8 @@ class dbLanguage extends dbJSON
parent::__construct($filename, false);
$this->data = $this->db['language-data'];
}
unset($this->db['language-data']);
}
public function getLanguageList()
@ -62,4 +64,9 @@ class dbLanguage extends dbJSON
echo $this->get($text);
}
public function add($array)
{
$this->db[] = $array;
}
}

View File

@ -28,12 +28,19 @@ class Sanitize {
return htmlspecialchars_decode($text, $flags);
}
public static function pathFile($path, $file)
public static function pathFile($path, $file=false)
{
// Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages
$path = str_replace('/', DS, $path);
if($file!==false){
$fullPath = $path.$file;
}
else {
$fullPath = $path;
}
$real = realpath($path.$file);
// Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages
$fullPath = str_replace('/', DS, $fullPath);
$real = realpath($fullPath);
// If $real is FALSE the file does not exist.
if($real===false) {
@ -41,7 +48,7 @@ class Sanitize {
}
// If the $real path does not start with the systemPath then this is Path Traversal.
if(strpos($path.$file, $real)!==0) {
if(strpos($fullPath, $real)!==0) {
return false;
}

View File

@ -9,7 +9,43 @@
"website": ""
},
"name": "Name",
"first-name": "First Name",
"posted-by": "Posted by"
"username": "Username",
"password": "Password",
"confirm-password": "Confirm Password",
"editor": "Editor",
"dashboard": "Dashboard",
"role": "Role",
"posts": "Posts",
"Users": "Users",
"administrator": "Administrator",
"add": "Add",
"cancel": "Cancel",
"content": "Content",
"title": "Title",
"no-parent": "No parent",
"edit-page": "Edit page",
"edit-post": "Edit post",
"you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.",
"email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.",
"add-a-new-user": "Add a new user",
"html-markdown-code-supported": "HTML and Markdown code supported.",
"parent": "Parent",
"friendly-url": "Friendly URL",
"description": "Description",
"tags": "Tags",
"position": "Position",
"save": "Save",
"draft": "Draft",
"delete": "Delete",
"advanced-options": "Advanced options",
"enable-more-features-at": "Enable more features at",
"settings-advanced-writting-settings": "Settings->Advanced->Writting Settings",
"publish-now": "Publish now",
"delete": "Delete",
"delete": "Delete",
"delete": "Delete",
"delete": "Delete",
"delete": "Delete",
"delete": "Delete"
}

View File

@ -1,7 +1,7 @@
{
"language-data":
{
"native": "Español (Argentina)",
"native": "Español (España)",
"english-name": "Spanish",
"last-update": "2015-06-28",
"author": "Diego",
@ -9,7 +9,5 @@
"website": ""
},
"name": "Name",
"first-name": "First Name",
"posted-by": "Posted by"
"test":"test"
}

View File

@ -0,0 +1,13 @@
{
"plugin-data":
{
"name": "Open Graph",
"description": "The Open Graph protocol enables any web page to become a rich object in a social graph.",
"author": "Diego",
"email": "",
"website": ""
},
"name": "Name",
"first-name": "First Name"
}

View File

@ -5,9 +5,8 @@ class pluginOpenGraph extends Plugin {
public function init()
{
$this->dbFields = array(
'title'=>'Open Graph',
'description'=>'The Open Graph protocol enables any web page to become a rich object in a social graph.'
);
'test'=>''
);
}
public function onSiteHead()
@ -22,7 +21,7 @@ class pluginOpenGraph extends Plugin {
'description' =>$Site->description(),
'url' =>$Site->url(),
'image' =>'',
'site_name' =>$Site->title()
'siteName' =>$Site->title()
);
switch($Url->whereAmI())
@ -48,7 +47,7 @@ class pluginOpenGraph extends Plugin {
$html .= '<meta property="og:description" content="'.$og['description'].'">'.PHP_EOL;
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
$html .= '<meta property="og:site_name" content="'.$og['site_name'].'">'.PHP_EOL;
$html .= '<meta property="og:siteName" content="'.$og['siteName'].'">'.PHP_EOL;
return $html;
}