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"> <nav class="navbar nav-fullwidth">
<h1>Bludit</h1> <h1>Bludit</h1>
<ul> <ul>
<li><a href="<?php echo HTML_PATH_ROOT ?>">Home</a></li> <li>Welcome back, <?php echo $Login->username() ?></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard">Dashboard</a></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> <li><a href="<?php echo HTML_PATH_ADMIN_ROOT ?>logout">Logout</a></li>
</ul> </ul>
</nav> </nav>
@ -57,6 +57,7 @@ $(document).ready(function() {
<div id="sidebar" class="nav"> <div id="sidebar" class="nav">
<ul> <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-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 ?>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> <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'); ?> <?php makeNavbar('users'); ?>
<form method="post" action="" class="forms"> <form method="post" action="" class="forms">
<label> <label>
Username <?php $Language->p('Username') ?>
<input type="text" name="username" class="width-50"> <input type="text" name="username" class="width-50">
</label> </label>
<label> <label>
Password <?php $Language->p('Password') ?>
<input type="password" name="password" class="width-50"> <input type="password" name="password" class="width-50">
</label> </label>
<label> <label>
Confirm Password <?php $Language->p('Confirm Password') ?>
<input type="password" name="confirm-password" class="width-50"> <input type="password" name="confirm-password" class="width-50">
</label> </label>
<label for="country"> <label for="country">
Role <?php $Language->p('Role') ?>
<select name="role" class="width-50"> <select name="role" class="width-50">
<option value="editor">Editor</option> <option value="editor"><?php $Language->p('Editor') ?></option>
<option value="admin">Administrator</option> <option value="admin"><?php $Language->p('Administrator') ?></option>
</select> </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>
<label> <label>
Email Email
<input type="text" name="email" class="width-50"> <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> </label>
<input type="submit" class="btn btn-blue" value="Add" name="add-user"> <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">Cancel</a> <a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" class="btn"><?php $Language->p('Cancel') ?></a>
</form> </form>

View File

@ -1,4 +1,4 @@
<h2 class="title">Dashboard</h2> <h2 class="title"><?php $Language->p('Dashboard') ?> </h2>
<div class="units-row"> <div class="units-row">
@ -7,7 +7,7 @@
<div class="dashboardBox"> <div class="dashboardBox">
<div class="content contentBlue"> <div class="content contentBlue">
<div class="bigContent"><?php echo $dbPosts->count() ?></div> <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> <i class="iconContent fa fa-pie-chart"></i>
</div> </div>
</div> </div>
@ -15,7 +15,7 @@
<div class="dashboardBox"> <div class="dashboardBox">
<div class="content contentGreen"> <div class="content contentGreen">
<div class="bigContent"><?php echo $dbUsers->count() ?></div> <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> <i class="iconContent fa fa-user"></i>
</div> </div>
</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"> <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> <label>
Title <?php $Language->p('Title') ?>
<input id="jsTitle" name="title" type="text" class="width-70" value="<?php echo $_Page->title() ?>"> <input id="jstitle" name="title" type="text" class="width-70" value="<?php echo $_Page->title() ?>">
</label> </label>
<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> <textarea name="content" rows="10" class="width-70"><?php echo $_Page->contentRaw(false) ?></textarea>
</label> </label>
<?php <?php
if($Site->advancedOptions()) { if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">'; echo '<div id="jsadvancedOptions">';
} }
else else
{ {
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>'; 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">'; echo '<div id="jsadvancedOptions" style="display:none">';
} }
?> ?>
<h4>Advanced options</h4> <h4><?php $Language->p('Advanced options') ?></h4>
<?php <?php
// Remove pages parents if the page is a parent. // Remove setting pages parents if the page is a parent.
if(count($_Page->children())===0) if(count($_Page->children())===0)
{ {
?> ?>
<label for="jsParent"> <label for="jsparent">
Page parent <?php $Language->p('Parent') ?>
<select id="jsParent" name="parent" class="width-50"> <select id="jsparent" name="parent" class="width-50">
<?php <?php
$htmlOptions[NO_PARENT_CHAR] = '(No parent)'; $htmlOptions[NO_PARENT_CHAR] = '('.$Language->p('No parent').')';
$htmlOptions += $dbPages->parentKeyList(); $htmlOptions += $dbPages->parentKeyList();
unset($htmlOptions[$_Page->key()]); unset($htmlOptions[$_Page->key()]);
foreach($htmlOptions as $value=>$text) { foreach($htmlOptions as $value=>$text) {
@ -48,41 +48,41 @@
<div class="forms-desc">Tip/Help ???</div> <div class="forms-desc">Tip/Help ???</div>
</label> </label>
<?php } ?> <?php } ?>
<label> <label>
Friendly url <?php $Language->p('Friendly URL') ?>
<div class="input-groups width-50"> <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> <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() ?>"> <input id="jsslug" type="text" name="slug" value="<?php echo $_Page->slug() ?>">
</div> </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>
<label> <label>
Description <?php $Language->p('Description') ?>
<input id="jsDescription" type="text" name="description" class="width-50" value="<?php echo $_Page->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> <span class="forms-desc">This field can help describe the content in a few words. No more than 150 characters.</span>
</label> </label>
<label> <label>
Tags <?php $Language->p('Tags') ?>
<input id="jsTags" name="tags" type="text" class="width-50" value="<?php echo $_Page->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> <span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label> </label>
<label> <label>
Position <?php $Language->p('Position') ?>
<input id="jsPosition" name="position" type="text" class="width-20" value="<?php echo $_Page->position() ?>"> <input id="jsposition" name="position" type="text" class="width-20" value="<?php echo $_Page->position() ?>">
</label> </label>
</div> </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) { ?> <?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="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>Delete</button> <button class="btn" name="delete"><i class="fa fa-remove fa-right"></i><?php $Language->p('Delete') ?></button>
<?php } ?> <?php } ?>
</form> </form>
@ -91,34 +91,34 @@
$(document).ready(function() $(document).ready(function()
{ {
var key = $("#jsKey").val(); var key = $("#jskey").val();
$("#jsSlug").keyup(function() { $("#jsslug").keyup(function() {
var text = $(this).val(); 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 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 parent = $(this).val();
var text = $("#jsSlug").val(); var text = $("#jsslug").val();
if(parent==NO_PARENT_CHAR) { if(parent==NO_PARENT_CHAR) {
$("#jsParentExample").text(""); $("#jsparentExample").text("");
} }
else { 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"> <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> <label>
Title <?php $Language->p('Title') ?>
<input id="jsTitle" name="title" type="text" class="width-70" value="<?php echo $_Post->title() ?>"> <input id="jstitle" name="title" type="text" class="width-70" value="<?php echo $_Post->title() ?>">
</label> </label>
<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 $_Post->contentRaw(false) ?></textarea> <textarea id="jscontent" name="content" rows="10" class="width-70"><?php echo $_Post->contentRaw(false) ?></textarea>
</label> </label>
<?php <?php
if($Site->advancedOptions()) { if($Site->advancedOptions()) {
echo '<div id="jsAdvancedOptions">'; echo '<div id="jsadvancedOptions">';
} }
else else
{ {
echo '<p class="advOptions">Enable more features at <a href="'.HTML_PATH_ADMIN_ROOT.'settings#advanced">Settings->Advanced->Writting Settings</a></p>'; 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> <label>
Friendly url <?php $Language->p('Friendly Url') ?>
<div class="input-groups width-50"> <div class="input-groups width-50">
<span class="input-prepend"><?php echo $Site->urlPost() ?><span id="jsParentExample"></span></span> <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() ?>"> <input id="jsslug" type="text" name="slug" value="<?php echo $_Post->slug() ?>">
</div> </div>
<span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span> <span class="forms-desc">Short text no more than 150 characters. Special characters not allowed.</span>
</label> </label>
<label> <label>
Description <?php $Language->p('Description') ?>
<input id="jsDescription" type="text" name="description" class="width-50" value="<?php echo $_Post->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> <span class="forms-desc">This field is for Twitter/Facebook/Google+ descriptions. No more than 150 characters.</span>
</label> </label>
<label> <label>
Tags <?php $Language->p('Tags') ?>
<input id="jsTags" name="tags" type="text" class="width-50" value="<?php echo $_Post->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> <span class="forms-desc">Write the tags separeted by comma. eg: tag1, tag2, tag3</span>
</label> </label>
</div> </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>
<button class="btn" name="draft"><i class="fa fa-circle-o fa-right"></i>Draft</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>Delete</button> <button class="btn" name="delete"><i class="fa fa-remove fa-right"></i><?php $Language->p('Delete') ?></button>
</form> </form>
@ -59,18 +59,18 @@
$(document).ready(function() $(document).ready(function()
{ {
var key = $("#jsKey").val(); var key = $("#jskey").val();
$("#jsTitle").keyup(function() { $("#jstitle").keyup(function() {
var slug = $(this).val(); var slug = $(this).val();
checkSlugPost(slug, key, $("#jsSlug")); checkSlugPost(slug, key, $("#jsslug"));
}); });
$("#jsSlug").keyup(function() { $("#jsslug").keyup(function() {
var slug = $("#jsSlug").val(); var slug = $("#jsslug").val();
checkSlugPost(slug, key, $("#jsSlug")); checkSlugPost(slug, key, $("#jsslug"));
}); });
}); });

View File

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

View File

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

View File

@ -109,9 +109,9 @@
<div id="regional"> <div id="regional">
<form method="post" action="" class="forms" name="form-regional"> <form method="post" action="" class="forms" name="form-regional">
<label for="language"> <label for="jslanguage">
Language Language
<select name="language" class="width-50"> <select id="jslanguage" name="language" class="width-50">
<?php <?php
$htmlOptions = $Language->getLanguageList(); $htmlOptions = $Language->getLanguageList();
foreach($htmlOptions as $locale=>$nativeName) { foreach($htmlOptions as $locale=>$nativeName) {
@ -122,9 +122,9 @@
<div class="forms-desc">Select your site's language.</div> <div class="forms-desc">Select your site's language.</div>
</label> </label>
<label for="timezone"> <label for="jstimezone">
Timezone Timezone
<select name="timezone" class="width-50"> <select id="jstimezone" name="timezone" class="width-50">
<?php <?php
$htmlOptions = Date::timezoneList(); $htmlOptions = Date::timezoneList();
foreach($htmlOptions as $text=>$value) { foreach($htmlOptions as $text=>$value) {
@ -137,7 +137,7 @@
<label> <label>
Locale 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> <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> </label>
@ -145,6 +145,18 @@
</form> </form>
</div> </div>
<script>
$(document).ready(function() {
$("#jslanguage").change(function () {
var locale = $("#jslanguage option:selected").val();
$("#jslocale").attr("value",locale);
});
});
</script>
<!-- ===================================== --> <!-- ===================================== -->
<!-- About --> <!-- About -->

View File

@ -2,37 +2,30 @@ Diego Najar
————————— —————————
Implementar ToDO
- Links a Google+, Facebook y Twitter - Social links: Google+, Facebook y Twitter
- Plugins - Plugins: Edit databases from Dashboard
- Plugins SEO, description, opengraph, etc.. - Plugins: SEO, Tinymce,
- Comentarios - Comments system
- Notificaciones - Notifications system
- iPhone app
- Cloud - Cloud
- Users: delete user
- Implement User class
- Themes
- Plugins multilangueage
Check:
- ver casos de errores, filtros url iguales, con una / - 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. - Usuarios de lectura ?, no vale la pena, y hay que hacer mas controles a nivel de administracion.
- Implementar algun limpiador** - Implementar algun limpiador**
————————— —————————
**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 - 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/ {} + find . -type f -name '*.php' -exec sed -i '' s/helperText/Text/ {} +
———— —————————
Editar una pagina Editar una pagina
1- Usuario logueado 1- Usuario logueado

View File

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

View File

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

View File

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

View File

@ -142,9 +142,6 @@ function build_all_pages()
// Main // Main
// ============================================================================ // ============================================================================
// Plugins before load pages
Theme::plugins('beforePagesLoad');
// Filter by page, then build it // Filter by page, then build it
if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) ) if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
{ {
@ -186,6 +183,3 @@ if($Url->notFound())
// Build all pages // Build all pages
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 // Main
// ============================================================================ // ============================================================================
// Plugins before load posts
Theme::plugins('beforePostsLoad');
// Filter by post, then build it // Filter by post, then build it
if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) ) if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
{ {
@ -129,6 +126,3 @@ else
build_posts_per_page($Url->pageNumber(), $Site->postsPerPage(), false); 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 $plugins;
global $pluginsEvents; global $pluginsEvents;
global $Language;
global $Site;
// List plugins directories // List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS); $list = Filesystem::listDirectories(PATH_PLUGINS);
@ -38,7 +40,7 @@ function build_plugins()
// Load each plugin clasess // Load each plugin clasess
foreach($list as $pluginPath) { foreach($list as $pluginPath) {
include($pluginPath.'/plugin.php'); include($pluginPath.DS.'plugin.php');
} }
// Get plugins clasess loaded // Get plugins clasess loaded
@ -48,10 +50,28 @@ function build_plugins()
{ {
$Plugin = new $pluginClass; $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); array_push($plugins['all'], $Plugin);
// If the plugin installed, then add the plugin on the arrays. // If the plugin installed
if($Plugin->installed()) if($Plugin->installed())
{ {
foreach($pluginsEvents as $event=>$value) foreach($pluginsEvents as $event=>$value)

View File

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

View File

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

View File

@ -28,12 +28,19 @@ class Sanitize {
return htmlspecialchars_decode($text, $flags); 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 if($file!==false){
$path = str_replace('/', DS, $path); $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 is FALSE the file does not exist.
if($real===false) { 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 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; return false;
} }

View File

@ -9,7 +9,43 @@
"website": "" "website": ""
}, },
"name": "Name", "username": "Username",
"first-name": "First Name", "password": "Password",
"posted-by": "Posted by" "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": "language-data":
{ {
"native": "Español (Argentina)", "native": "Español (España)",
"english-name": "Spanish", "english-name": "Spanish",
"last-update": "2015-06-28", "last-update": "2015-06-28",
"author": "Diego", "author": "Diego",
@ -9,7 +9,5 @@
"website": "" "website": ""
}, },
"name": "Name", "test":"test"
"first-name": "First Name",
"posted-by": "Posted by"
} }

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