mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 12:36:23 +05:30
Changes
Make HTMLy more flexibel.
This commit is contained in:
parent
c7bf485275
commit
095cfee286
17 changed files with 329 additions and 194 deletions
|
|
@ -519,10 +519,10 @@ function get_feed($feed_url, $credit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get recent posts by user
|
// Get recent posts by user
|
||||||
function get_recent_posts()
|
function get_user_posts()
|
||||||
{
|
{
|
||||||
if (isset($_SESSION[config("site.url")]['user'])) {
|
if (isset($_SESSION[config("site.url")]['user'])) {
|
||||||
$posts = get_profile($_SESSION[config("site.url")]['user'], 1, 5);
|
$posts = get_profile_posts($_SESSION[config("site.url")]['user'], 1, 5);
|
||||||
if (!empty($posts)) {
|
if (!empty($posts)) {
|
||||||
echo '<table class="post-list">';
|
echo '<table class="post-list">';
|
||||||
echo '<tr class="head"><th>Title</th><th>Published</th>';
|
echo '<tr class="head"><th>Title</th><th>Published</th>';
|
||||||
|
|
@ -555,7 +555,7 @@ function get_recent_posts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all static pages
|
// Get all static pages
|
||||||
function get_recent_pages()
|
function get_user_pages()
|
||||||
{
|
{
|
||||||
if (isset($_SESSION[config("site.url")]['user'])) {
|
if (isset($_SESSION[config("site.url")]['user'])) {
|
||||||
$posts = get_static_post(null);
|
$posts = get_static_post(null);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
echo '<h2>Your recent posts</h2>';
|
echo '<h2>Your recent posts</h2>';
|
||||||
get_recent_posts();
|
get_user_posts();
|
||||||
echo '<h2>Static pages</h2>';
|
echo '<h2>Static pages</h2>';
|
||||||
get_recent_pages(); ?>
|
get_user_pages(); ?>
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<td><?php echo date('d F Y', $p->date) ?></td>
|
<td><?php echo date('d F Y', $p->date) ?></td>
|
||||||
<?php if (config("views.counter") == "true"): ?>
|
<?php if (config("views.counter") == "true"): ?>
|
||||||
<td><?php echo $p->views ?></td><?php endif; ?>
|
<td><?php echo $p->views ?></td><?php endif; ?>
|
||||||
<td><a target="_blank" href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></td>
|
<td><a target="_blank" href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></td>
|
||||||
<td><?php echo $p->tag ?></td>
|
<td><?php echo $p->tag ?></td>
|
||||||
<td><a href="<?php echo $p->url ?>/edit?destination=admin/posts">Edit</a> <a
|
<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>
|
href="<?php echo $p->url ?>/delete?destination=admin/posts">Delete</a></td>
|
||||||
|
|
|
||||||
120
system/htmly.php
120
system/htmly.php
|
|
@ -41,6 +41,7 @@ get('/index', function () {
|
||||||
'description' => blog_description(),
|
'description' => blog_description(),
|
||||||
'canonical' => site_url(),
|
'canonical' => site_url(),
|
||||||
'bodyclass' => 'noposts',
|
'bodyclass' => 'noposts',
|
||||||
|
'is_front' => is_front(true),
|
||||||
));
|
));
|
||||||
|
|
||||||
die;
|
die;
|
||||||
|
|
@ -54,7 +55,8 @@ get('/index', function () {
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bodyclass' => 'infront',
|
'bodyclass' => 'infront',
|
||||||
'breadcrumb' => '',
|
'breadcrumb' => '',
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page),
|
||||||
|
'is_front' => is_front(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -115,7 +117,7 @@ post('/login', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show the author page
|
// Show the author page
|
||||||
get('/author/:profile', function ($profile) {
|
get('/author/:name', function ($name) {
|
||||||
|
|
||||||
if (!login()) {
|
if (!login()) {
|
||||||
file_cache($_SERVER['REQUEST_URI']);
|
file_cache($_SERVER['REQUEST_URI']);
|
||||||
|
|
@ -125,45 +127,46 @@ get('/author/:profile', function ($profile) {
|
||||||
$page = $page ? (int)$page : 1;
|
$page = $page ? (int)$page : 1;
|
||||||
$perpage = config('profile.perpage');
|
$perpage = config('profile.perpage');
|
||||||
|
|
||||||
$posts = get_profile($profile, $page, $perpage);
|
$posts = get_profile_posts($name, $page, $perpage);
|
||||||
|
|
||||||
$total = get_count($profile, 'dirname');
|
$total = get_count($name, 'dirname');
|
||||||
|
|
||||||
$bio = get_bio($profile);
|
$author = get_author($name);
|
||||||
|
|
||||||
if (isset($bio[0])) {
|
if (isset($author[0])) {
|
||||||
$bio = $bio[0];
|
$author = $author[0];
|
||||||
} else {
|
} else {
|
||||||
$bio = default_profile($profile);
|
$author = default_profile($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($posts) || $page < 1) {
|
if (empty($posts) || $page < 1) {
|
||||||
render('profile', array(
|
render('profile', array(
|
||||||
'title' => 'Profile for: ' . $bio->title . ' - ' . blog_title(),
|
'title' => 'Profile for: ' . $author->name . ' - ' . blog_title(),
|
||||||
'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . blog_title() . '.',
|
'description' => 'Profile page and all posts by ' . $author->name . ' on ' . blog_title() . '.',
|
||||||
'canonical' => site_url() . 'author/' . $profile,
|
'canonical' => site_url() . 'author/' . $name,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'posts' => null,
|
'posts' => null,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'inprofile',
|
'bodyclass' => 'inprofile',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $author->name,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page)
|
||||||
));
|
));
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
render('profile', array(
|
render('profile', array(
|
||||||
'title' => 'Profile for: ' . $bio->title . ' - ' . blog_title(),
|
'title' => 'Profile for: ' . $author->name . ' - ' . blog_title(),
|
||||||
'description' => 'Profile page and all posts by ' . $bio->title . ' on ' . blog_title() . '.',
|
'description' => 'Profile page and all posts by ' . $author->name . ' on ' . blog_title() . '.',
|
||||||
'canonical' => site_url() . 'author/' . $profile,
|
'canonical' => site_url() . 'author/' . $name,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'inprofile',
|
'bodyclass' => 'inprofile',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $author->name,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page),
|
||||||
|
'is_profile' => is_profile(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -430,22 +433,22 @@ get('/admin/mine', function () {
|
||||||
|
|
||||||
config('views.root', 'system/admin/views');
|
config('views.root', 'system/admin/views');
|
||||||
|
|
||||||
$profile = $_SESSION[config("site.url")]['user'];
|
$name = $_SESSION[config("site.url")]['user'];
|
||||||
|
|
||||||
$page = from($_GET, 'page');
|
$page = from($_GET, 'page');
|
||||||
$page = $page ? (int)$page : 1;
|
$page = $page ? (int)$page : 1;
|
||||||
$perpage = config('profile.perpage');
|
$perpage = config('profile.perpage');
|
||||||
|
|
||||||
$posts = get_profile($profile, $page, $perpage);
|
$posts = get_profile_posts($name, $page, $perpage);
|
||||||
|
|
||||||
$total = get_count($profile, 'dirname');
|
$total = get_count($name, 'dirname');
|
||||||
|
|
||||||
$bio = get_bio($profile);
|
$author = get_author($name);
|
||||||
|
|
||||||
if (isset($bio[0])) {
|
if (isset($author[0])) {
|
||||||
$bio = $bio[0];
|
$author = $author[0];
|
||||||
} else {
|
} else {
|
||||||
$bio = default_profile($profile);
|
$author = default_profile($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($posts) || $page < 1) {
|
if (empty($posts) || $page < 1) {
|
||||||
|
|
@ -456,10 +459,10 @@ get('/admin/mine', function () {
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'heading' => 'My posts',
|
'heading' => 'My posts',
|
||||||
'posts' => null,
|
'posts' => null,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'userposts',
|
'bodyclass' => 'userposts',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $author->name,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page)
|
||||||
));
|
));
|
||||||
die;
|
die;
|
||||||
|
|
@ -472,10 +475,10 @@ get('/admin/mine', function () {
|
||||||
'heading' => 'My posts',
|
'heading' => 'My posts',
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'userposts',
|
'bodyclass' => 'userposts',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Profile for: ' . $author->name,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page)
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -491,22 +494,22 @@ get('/admin/draft', function () {
|
||||||
|
|
||||||
config('views.root', 'system/admin/views');
|
config('views.root', 'system/admin/views');
|
||||||
|
|
||||||
$profile = $_SESSION[config("site.url")]['user'];
|
$name = $_SESSION[config("site.url")]['user'];
|
||||||
|
|
||||||
$page = from($_GET, 'page');
|
$page = from($_GET, 'page');
|
||||||
$page = $page ? (int)$page : 1;
|
$page = $page ? (int)$page : 1;
|
||||||
$perpage = config('profile.perpage');
|
$perpage = config('profile.perpage');
|
||||||
|
|
||||||
$posts = get_draft($profile, $page, $perpage);
|
$posts = get_draft($name, $page, $perpage);
|
||||||
|
|
||||||
$total = get_count($profile, 'dirname');
|
$total = get_count($name, 'dirname');
|
||||||
|
|
||||||
$bio = get_bio($profile);
|
$author = get_author($name);
|
||||||
|
|
||||||
if (isset($bio[0])) {
|
if (isset($author[0])) {
|
||||||
$bio = $bio[0];
|
$author = $author[0];
|
||||||
} else {
|
} else {
|
||||||
$bio = default_profile($profile);
|
$author = default_profile($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($posts) || $page < 1) {
|
if (empty($posts) || $page < 1) {
|
||||||
|
|
@ -517,10 +520,10 @@ get('/admin/draft', function () {
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'heading' => 'My draft',
|
'heading' => 'My draft',
|
||||||
'posts' => null,
|
'posts' => null,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'userdraft',
|
'bodyclass' => 'userdraft',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Draft for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Draft for: ' . $author->name,
|
||||||
));
|
));
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
@ -532,10 +535,10 @@ get('/admin/draft', function () {
|
||||||
'heading' => 'My draft',
|
'heading' => 'My draft',
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bio' => $bio->body,
|
'about' => $author->about,
|
||||||
'name' => $bio->title,
|
'name' => $author->name,
|
||||||
'bodyclass' => 'userdraft',
|
'bodyclass' => 'userdraft',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Draft for: ' . $bio->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Draft for: ' . $author->name,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$login = site_url() . 'login';
|
$login = site_url() . 'login';
|
||||||
|
|
@ -782,7 +785,8 @@ get('/tag/:tag', function ($tag) {
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bodyclass' => 'intag',
|
'bodyclass' => 'intag',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Posts tagged: ' . $tag,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Posts tagged: ' . $tag,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page),
|
||||||
|
'is_tag' => is_tag(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -830,7 +834,8 @@ get('/archive/:req', function ($req) {
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bodyclass' => 'inarchive',
|
'bodyclass' => 'inarchive',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Archive for: ' . $timestamp,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Archive for: ' . $timestamp,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page),
|
||||||
|
'is_archive' => is_archive(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -863,7 +868,8 @@ get('/search/:keyword', function ($keyword) {
|
||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
'bodyclass' => 'insearch',
|
'bodyclass' => 'insearch',
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Search results for: ' . $keyword,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Search results for: ' . $keyword,
|
||||||
'pagination' => has_pagination($total, $perpage, $page)
|
'pagination' => has_pagination($total, $perpage, $page),
|
||||||
|
'is_search' => is_search(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -992,6 +998,7 @@ get('/:static', function ($static) {
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » ' . $post->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » ' . $post->title,
|
||||||
'p' => $post,
|
'p' => $post,
|
||||||
'type' => 'staticpage',
|
'type' => 'staticpage',
|
||||||
|
'is_page' => is_page(true),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1214,6 +1221,7 @@ get('/:static/:sub', function ($static, $sub) {
|
||||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . $father_post[0]->url . '">' . $father_post[0]->title . '</a> » ' . $post->title,
|
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . $father_post[0]->url . '">' . $father_post[0]->title . '</a> » ' . $post->title,
|
||||||
'p' => $post,
|
'p' => $post,
|
||||||
'type' => 'staticpage',
|
'type' => 'staticpage',
|
||||||
|
'is_subpage' => is_subpage(true),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1380,12 +1388,12 @@ get('/:year/:month/:name', function ($year, $month, $name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$bio = get_bio($current->author);
|
$author = get_author($current->author);
|
||||||
|
|
||||||
if (isset($bio[0])) {
|
if (isset($author[0])) {
|
||||||
$bio = $bio[0];
|
$author = $author[0];
|
||||||
} else {
|
} else {
|
||||||
$bio = default_profile($current->author);
|
$author = default_profile($current->author);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('prev', $post)) {
|
if (array_key_exists('prev', $post)) {
|
||||||
|
|
@ -1405,13 +1413,15 @@ get('/:year/:month/:name', function ($year, $month, $name) {
|
||||||
'description' => $current->description,
|
'description' => $current->description,
|
||||||
'canonical' => $current->url,
|
'canonical' => $current->url,
|
||||||
'p' => $current,
|
'p' => $current,
|
||||||
'authorinfo' => authorinfo($bio->title, $bio->body),
|
'author' => $author,
|
||||||
'bodyclass' => 'inpost',
|
'bodyclass' => 'inpost',
|
||||||
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> » ' . $current->tagb . ' » ' . $current->title,
|
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> » ' . $current->tagb . ' » ' . $current->title,
|
||||||
'prev' => has_prev($prev),
|
'prev' => has_prev($prev),
|
||||||
'next' => has_next($next),
|
'next' => has_next($next),
|
||||||
'type' => 'blogpost',
|
'type' => 'blogpost',
|
||||||
|
'is_post' => is_post(true),
|
||||||
));
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit blog post
|
// Edit blog post
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ function get_static_sub_pages($static = null)
|
||||||
return $_sub_page;
|
return $_sub_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get author bio path. Unsorted.
|
// Get author name. Unsorted.
|
||||||
function get_author_names()
|
function get_author_name()
|
||||||
{
|
{
|
||||||
static $_author = array();
|
static $_author = array();
|
||||||
|
|
||||||
|
|
@ -138,6 +138,12 @@ function sortdate($a, $b)
|
||||||
return $a->date == $b->date ? 0 : ($a->date < $b->date) ? 1 : -1;
|
return $a->date == $b->date ? 0 : ($a->date < $b->date) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// usort function. Sort by views.
|
||||||
|
function sortviews($a, $b)
|
||||||
|
{
|
||||||
|
return $a[$page] == $b[$page] ? 0 : ($a[$page] < $b[$page]) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Rebuilt cache index
|
// Rebuilt cache index
|
||||||
function rebuilt_cache($type)
|
function rebuilt_cache($type)
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +154,7 @@ function rebuilt_cache($type)
|
||||||
$author_cache = array();
|
$author_cache = array();
|
||||||
|
|
||||||
if (is_dir($dir) === false) {
|
if (is_dir($dir) === false) {
|
||||||
mkdir($dir, 0777, true);
|
mkdir($dir, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type === 'posts') {
|
if ($type === 'posts') {
|
||||||
|
|
@ -220,7 +226,7 @@ function get_posts($posts, $page = 1, $perpage = 0)
|
||||||
|
|
||||||
// The post author + author url
|
// The post author + author url
|
||||||
$post->author = $author;
|
$post->author = $author;
|
||||||
$post->authorurl = site_url() . 'author/' . $author;
|
$post->authorUrl = site_url() . 'author/' . $author;
|
||||||
|
|
||||||
$dt = str_replace($replaced, '', $arr[0]);
|
$dt = str_replace($replaced, '', $arr[0]);
|
||||||
$t = str_replace('-', '', $dt);
|
$t = str_replace('-', '', $dt);
|
||||||
|
|
@ -424,7 +430,7 @@ function get_archive($req, $page, $perpage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return posts list on profile.
|
// Return posts list on profile.
|
||||||
function get_profile($profile, $page, $perpage)
|
function get_profile_posts($name, $page, $perpage)
|
||||||
{
|
{
|
||||||
$posts = get_post_sorted();
|
$posts = get_post_sorted();
|
||||||
|
|
||||||
|
|
@ -434,7 +440,7 @@ function get_profile($profile, $page, $perpage)
|
||||||
$url = $v['dirname'];
|
$url = $v['dirname'];
|
||||||
$str = explode('/', $url);
|
$str = explode('/', $url);
|
||||||
$author = $str[count($str) - 2];
|
$author = $str[count($str) - 2];
|
||||||
if ($profile === $author) {
|
if ($name === $author) {
|
||||||
$tmp[] = $v;
|
$tmp[] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -469,19 +475,20 @@ function get_draft($profile, $page, $perpage)
|
||||||
return $tmp = get_posts($tmp, $page, $perpage);
|
return $tmp = get_posts($tmp, $page, $perpage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return author bio.
|
// Return author info.
|
||||||
function get_bio($author)
|
function get_author($name)
|
||||||
{
|
{
|
||||||
$names = get_author_names();
|
$names = get_author_name();
|
||||||
|
|
||||||
$username = 'config/users/' . $author . '.ini';
|
$username = 'config/users/' . $name . '.ini';
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
|
||||||
if (!empty($names)) {
|
if (!empty($names)) {
|
||||||
|
|
||||||
foreach ($names as $index => $v) {
|
foreach ($names as $index => $v) {
|
||||||
$post = new stdClass;
|
|
||||||
|
$author = new stdClass;
|
||||||
|
|
||||||
// Replaced string
|
// Replaced string
|
||||||
$replaced = substr($v, 0, strrpos($v, '/')) . '/';
|
$replaced = substr($v, 0, strrpos($v, '/')) . '/';
|
||||||
|
|
@ -490,19 +497,19 @@ function get_bio($author)
|
||||||
$str = explode('/', $replaced);
|
$str = explode('/', $replaced);
|
||||||
$profile = $str[count($str) - 2];
|
$profile = $str[count($str) - 2];
|
||||||
|
|
||||||
if ($author === $profile) {
|
if ($name === $profile) {
|
||||||
// Profile URL
|
// Profile URL
|
||||||
$url = str_replace($replaced, '', $v);
|
$url = str_replace($replaced, '', $v);
|
||||||
$post->url = site_url() . 'author/' . $profile;
|
$author->url = site_url() . 'author/' . $profile;
|
||||||
|
|
||||||
// Get the contents and convert it to HTML
|
// Get the contents and convert it to HTML
|
||||||
$content = file_get_contents($v);
|
$content = file_get_contents($v);
|
||||||
|
|
||||||
// Extract the title and body
|
// Extract the title and body
|
||||||
$post->title = get_content_tag('t', $content, $author);
|
$author->name = get_content_tag('t', $content, $author);
|
||||||
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
|
$author->about = MarkdownExtra::defaultTransform(remove_html_comments($content));
|
||||||
|
|
||||||
$tmp[] = $post;
|
$tmp[] = $author;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -515,17 +522,17 @@ function get_bio($author)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return default profile
|
// Return default profile
|
||||||
function default_profile($author)
|
function default_profile($name)
|
||||||
{
|
{
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$profile = new stdClass;
|
$author = new stdClass;
|
||||||
|
|
||||||
$profile->title = $author;
|
$author->name = $name;
|
||||||
$profile->body = '<p>Just another HTMLy user.</p>';
|
$author->about = '<p>Just another HTMLy user.</p>';
|
||||||
|
|
||||||
$profile->descirption = 'Just another HTMLy user';
|
$author->description = 'Just another HTMLy user';
|
||||||
|
|
||||||
return $tmp[] = $profile;
|
return $tmp[] = $author;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return static page.
|
// Return static page.
|
||||||
|
|
@ -643,7 +650,7 @@ function get_keyword($keyword, $page, $perpage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get related posts base on post tag.
|
// Get related posts base on post tag.
|
||||||
function get_related($tag)
|
function get_related($tag, $custom = null)
|
||||||
{
|
{
|
||||||
$perpage = config('related.count');
|
$perpage = config('related.count');
|
||||||
$posts = get_tag(strip_tags($tag), 1, $perpage + 1, true);
|
$posts = get_tag(strip_tags($tag), 1, $perpage + 1, true);
|
||||||
|
|
@ -656,23 +663,29 @@ function get_related($tag)
|
||||||
$tmp[] = $post;
|
$tmp[] = $post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($custom)) {
|
||||||
|
|
||||||
$total = count($tmp);
|
$total = count($tmp);
|
||||||
|
|
||||||
if ($total >= 1) {
|
if ($total >= 1) {
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
foreach ($tmp as $post) {
|
foreach ($tmp as $post) {
|
||||||
echo '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
|
echo '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
|
||||||
if ($i++ >= $perpage)
|
if ($i++ >= $perpage)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo '<ul><li>No related post found</li></ul>';
|
echo '<ul><li>No related post found</li></ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -694,7 +707,7 @@ function get_count($var, $str)
|
||||||
return count($tmp);
|
return count($tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return post count. Matching $var and $str provided.
|
// Return tag count. Matching $var and $str provided.
|
||||||
function get_tagcount($var, $str)
|
function get_tagcount($var, $str)
|
||||||
{
|
{
|
||||||
$posts = get_post_sorted();
|
$posts = get_post_sorted();
|
||||||
|
|
@ -712,7 +725,7 @@ function get_tagcount($var, $str)
|
||||||
return count($tmp);
|
return count($tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return seaarch result count
|
// Return search result count
|
||||||
function keyword_count($keyword)
|
function keyword_count($keyword)
|
||||||
{
|
{
|
||||||
$posts = get_post_sorted();
|
$posts = get_post_sorted();
|
||||||
|
|
@ -737,28 +750,37 @@ function keyword_count($keyword)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return recent posts lists
|
// Return recent posts lists
|
||||||
function recent()
|
function recent_posts($custom = null, $count = null)
|
||||||
{
|
{
|
||||||
$count = config('recent.count');
|
|
||||||
|
|
||||||
if (empty($count)) {
|
if (empty($count)) {
|
||||||
$count = 5;
|
$count = config('recent.count');
|
||||||
|
if (empty($count)) {
|
||||||
|
$count = 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = '<ul>';
|
|
||||||
$posts = get_posts(null, 1, $count);
|
$posts = get_posts(null, 1, $count);
|
||||||
foreach ($posts as $post) {
|
|
||||||
$str .= '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
|
if (!empty($custom)) {
|
||||||
|
return $posts;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$str = '<ul>';
|
||||||
|
foreach ($posts as $post) {
|
||||||
|
$str .= '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
|
||||||
|
}
|
||||||
|
if (empty($posts)) {
|
||||||
|
$str .= '<li>No recent posts found</li>';
|
||||||
|
}
|
||||||
|
$str .= '</ul>';
|
||||||
|
return $str;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (empty($posts)) {
|
|
||||||
$str .= '<li>No recent posts found</li>';
|
|
||||||
}
|
|
||||||
$str .= '</ul>';
|
|
||||||
return $str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return an archive list, categorized by year and month.
|
// Return an archive list, categorized by year and month.
|
||||||
function archive_list()
|
function archive_list($custom = null)
|
||||||
{
|
{
|
||||||
$posts = get_post_unsorted();
|
$posts = get_post_unsorted();
|
||||||
$by_year = array();
|
$by_year = array();
|
||||||
|
|
@ -789,46 +811,51 @@ function archive_list()
|
||||||
# Most recent year first
|
# Most recent year first
|
||||||
krsort($by_year);
|
krsort($by_year);
|
||||||
# Iterate for display
|
# Iterate for display
|
||||||
$script = <<<EOF
|
|
||||||
if (this.parentNode.className.indexOf('expanded') > -1){this.parentNode.className = 'collapsed';this.innerHTML = '►';} else {this.parentNode.className = 'expanded';this.innerHTML = '▼';}
|
|
||||||
EOF;
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$len = count($by_year);
|
$len = count($by_year);
|
||||||
foreach ($by_year as $year => $months) {
|
if (empty($custom)) {
|
||||||
if ($i == 0) {
|
foreach ($by_year as $year => $months) {
|
||||||
$class = 'expanded';
|
if ($i == 0) {
|
||||||
$arrow = '▼';
|
$class = 'expanded';
|
||||||
} else {
|
$arrow = '▼';
|
||||||
$class = 'collapsed';
|
} else {
|
||||||
$arrow = '►';
|
$class = 'collapsed';
|
||||||
|
$arrow = '►';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$by_month = array_count_values($months);
|
||||||
|
# Sort the months
|
||||||
|
krsort($by_month);
|
||||||
|
|
||||||
|
$script = <<<EOF
|
||||||
|
if (this.parentNode.className.indexOf('expanded') > -1){this.parentNode.className = 'collapsed';this.innerHTML = '►';} else {this.parentNode.className = 'expanded';this.innerHTML = '▼';}
|
||||||
|
EOF;
|
||||||
|
echo '<ul class="archivegroup">';
|
||||||
|
echo '<li class="' . $class . '">';
|
||||||
|
echo '<a href="javascript:void(0)" class="toggle" onclick="' . $script . '">' . $arrow . '</a> ';
|
||||||
|
echo '<a href="' . site_url() . 'archive/' . $year . '">' . $year . '</a> ';
|
||||||
|
echo '<span class="count">(' . count($months) . ')</span>';
|
||||||
|
echo '<ul class="month">';
|
||||||
|
|
||||||
|
foreach ($by_month as $month => $count) {
|
||||||
|
$name = date('F', 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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</ul>';
|
||||||
|
echo '</li>';
|
||||||
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
$i++;
|
} else {
|
||||||
|
return $by_year;
|
||||||
echo '<ul class="archivegroup">';
|
|
||||||
echo '<li class="' . $class . '">';
|
|
||||||
echo '<a href="javascript:void(0)" class="toggle" onclick="' . $script . '">' . $arrow . '</a> ';
|
|
||||||
echo '<a href="' . site_url() . 'archive/' . $year . '">' . $year . '</a> ';
|
|
||||||
echo '<span class="count">(' . count($months) . ')</span>';
|
|
||||||
echo '<ul class="month">';
|
|
||||||
|
|
||||||
$by_month = array_count_values($months);
|
|
||||||
# Sort the months
|
|
||||||
krsort($by_month);
|
|
||||||
foreach ($by_month as $month => $count) {
|
|
||||||
$name = date('F', 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>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</ul>';
|
|
||||||
echo '</li>';
|
|
||||||
echo '</ul>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return tag cloud.
|
// Return tag cloud.
|
||||||
function tag_cloud()
|
function tag_cloud($custom = null)
|
||||||
{
|
{
|
||||||
$posts = get_post_unsorted();
|
$posts = get_post_unsorted();
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
@ -848,12 +875,16 @@ function tag_cloud()
|
||||||
|
|
||||||
$tag_collection = array_count_values($tags);
|
$tag_collection = array_count_values($tags);
|
||||||
ksort($tag_collection);
|
ksort($tag_collection);
|
||||||
|
|
||||||
echo '<ul class="taglist">';
|
if(empty($custom)) {
|
||||||
foreach ($tag_collection as $tag => $count) {
|
echo '<ul class="taglist">';
|
||||||
echo '<li class="item"><a href="' . site_url() . 'tag/' . $tag . '">' . $tag . '</a> <span class="count">(' . $count . ')</span></li>';
|
foreach ($tag_collection as $tag => $count) {
|
||||||
|
echo '<li class="item"><a href="' . site_url() . 'tag/' . $tag . '">' . $tag . '</a> <span class="count">(' . $count . ')</span></li>';
|
||||||
|
}
|
||||||
|
echo '</ul>';
|
||||||
|
} else {
|
||||||
|
return $tag_collection;
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -895,25 +926,32 @@ function has_pagination($total, $perpage, $page = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the meta description
|
// Get the meta description
|
||||||
function get_description($string)
|
function get_description($string, $char = null)
|
||||||
{
|
{
|
||||||
|
if(empty($char)) {
|
||||||
|
$char = config('description.char');
|
||||||
|
}
|
||||||
$string = remove_accent($string);
|
$string = remove_accent($string);
|
||||||
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string));
|
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string));
|
||||||
$string = ltrim($string);
|
$string = ltrim($string);
|
||||||
$string = substr($string, 0, config('description.char'));
|
$string = substr($string, 0, $char);
|
||||||
return $string = substr($string, 0, strrpos($string, ' '));
|
return $string = substr($string, 0, strrpos($string, ' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the teaser
|
// Get the teaser
|
||||||
function get_teaser($text)
|
function get_teaser($text, $char = null)
|
||||||
{
|
{
|
||||||
$teaserType = config('teaser.type');
|
$teaserType = config('teaser.type');
|
||||||
|
|
||||||
|
if(empty($char)) {
|
||||||
|
$char = config('teaser.char');
|
||||||
|
}
|
||||||
|
|
||||||
if ($teaserType === 'full') {
|
if ($teaserType === 'full') {
|
||||||
echo $text;
|
echo $text;
|
||||||
} else {
|
} else {
|
||||||
$string = preg_replace('/\s\s+/', ' ', strip_tags($text));
|
$string = preg_replace('/\s\s+/', ' ', strip_tags($text));
|
||||||
$string = substr($string, 0, config('teaser.char'));
|
$string = substr($string, 0, $char);
|
||||||
$string = substr($string, 0, strrpos($string, ' '));
|
$string = substr($string, 0, strrpos($string, ' '));
|
||||||
echo $string;
|
echo $string;
|
||||||
}
|
}
|
||||||
|
|
@ -1074,7 +1112,6 @@ function recent_comments()
|
||||||
$disqus = config('disqus.shortname');
|
$disqus = config('disqus.shortname');
|
||||||
$script = <<<EOF
|
$script = <<<EOF
|
||||||
<script type="text/javascript" src="//{$disqus}.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=0&avatar_size=48&excerpt_length=200&hide_mods=0"></script>
|
<script type="text/javascript" src="//{$disqus}.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=0&avatar_size=48&excerpt_length=200&hide_mods=0"></script>
|
||||||
<style>li.dsq-widget-item {border-bottom: 1px solid #ebebeb;margin:0;margin-bottom:10px;padding:0;padding-bottom:10px;}a.dsq-widget-user {font-weight:normal;}img.dsq-widget-avatar {margin-right:10px; }.dsq-widget-comment {display:block;padding-top:5px;}.dsq-widget-comment p {display:block;margin:0;}p.dsq-widget-meta {padding-top:5px;margin:0;}#dsq-combo-widget.grey #dsq-combo-content .dsq-combo-box {background: transparent;}#dsq-combo-widget.grey #dsq-combo-tabs li {background: none repeat scroll 0 0 #DDDDDD;}</style>
|
|
||||||
EOF;
|
EOF;
|
||||||
if (!empty($disqus) && $comment == 'disqus') {
|
if (!empty($disqus) && $comment == 'disqus') {
|
||||||
return $script;
|
return $script;
|
||||||
|
|
@ -1301,14 +1338,23 @@ function get_menu()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search form
|
// Search form
|
||||||
function search()
|
function search($text = null)
|
||||||
{
|
{
|
||||||
echo <<<EOF
|
if(!empty($text)) {
|
||||||
|
echo <<<EOF
|
||||||
|
<form id="search-form" method="get">
|
||||||
|
<input type="text" class="search-input" name="search" value="{$text}" onfocus="if (this.value == '{$text}') {this.value = '';}" onblur="if (this.value == '') {this.value = '{$text}';}">
|
||||||
|
<input type="submit" value="{$text}" class="search-button">
|
||||||
|
</form>
|
||||||
|
EOF;
|
||||||
|
} else {
|
||||||
|
echo <<<EOF
|
||||||
<form id="search-form" method="get">
|
<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="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="submit" value="Search" class="search-button">
|
||||||
</form>
|
</form>
|
||||||
EOF;
|
EOF;
|
||||||
|
}
|
||||||
if (isset($_GET['search'])) {
|
if (isset($_GET['search'])) {
|
||||||
$url = site_url() . 'search/' . $_GET['search'];
|
$url = site_url() . 'search/' . $_GET['search'];
|
||||||
header("Location: $url");
|
header("Location: $url");
|
||||||
|
|
@ -1370,7 +1416,7 @@ function generate_rss($posts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return post, archive url for sitemap
|
// Return post, archive url for sitemap
|
||||||
function get_path()
|
function sitemap_post_path()
|
||||||
{
|
{
|
||||||
$posts = get_post_sorted();
|
$posts = get_post_sorted();
|
||||||
|
|
||||||
|
|
@ -1392,7 +1438,7 @@ function get_path()
|
||||||
$str = explode('/', $replaced);
|
$str = explode('/', $replaced);
|
||||||
$author = $str[count($str) - 3];
|
$author = $str[count($str) - 3];
|
||||||
|
|
||||||
$post->authorurl = site_url() . 'author/' . $author;
|
$post->authorUrl = site_url() . 'author/' . $author;
|
||||||
|
|
||||||
$dt = str_replace($replaced, '', $arr[0]);
|
$dt = str_replace($replaced, '', $arr[0]);
|
||||||
$t = str_replace('-', '', $dt);
|
$t = str_replace('-', '', $dt);
|
||||||
|
|
@ -1421,7 +1467,7 @@ function get_path()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return static page path for sitemap
|
// Return static page path for sitemap
|
||||||
function get_static_path()
|
function sitemap_page_path()
|
||||||
{
|
{
|
||||||
$posts = get_static_pages();
|
$posts = get_static_pages();
|
||||||
|
|
||||||
|
|
@ -1471,7 +1517,7 @@ function generate_sitemap($str)
|
||||||
echo '</urlset>';
|
echo '</urlset>';
|
||||||
} elseif ($str == 'post') {
|
} elseif ($str == 'post') {
|
||||||
|
|
||||||
$posts = get_path();
|
$posts = sitemap_post_path();
|
||||||
|
|
||||||
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
||||||
|
|
||||||
|
|
@ -1482,7 +1528,7 @@ function generate_sitemap($str)
|
||||||
echo '</urlset>';
|
echo '</urlset>';
|
||||||
} elseif ($str == 'static') {
|
} elseif ($str == 'static') {
|
||||||
|
|
||||||
$posts = get_static_path();
|
$posts = sitemap_page_path();
|
||||||
|
|
||||||
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
||||||
|
|
||||||
|
|
@ -1530,7 +1576,7 @@ function generate_sitemap($str)
|
||||||
}
|
}
|
||||||
} elseif ($str == 'archive') {
|
} elseif ($str == 'archive') {
|
||||||
|
|
||||||
$posts = get_path();
|
$posts = sitemap_post_path();
|
||||||
$day = array();
|
$day = array();
|
||||||
$month = array();
|
$month = array();
|
||||||
$year = array();
|
$year = array();
|
||||||
|
|
@ -1562,11 +1608,11 @@ function generate_sitemap($str)
|
||||||
echo '</urlset>';
|
echo '</urlset>';
|
||||||
} elseif ($str == 'author') {
|
} elseif ($str == 'author') {
|
||||||
|
|
||||||
$posts = get_path();
|
$posts = sitemap_post_path();
|
||||||
$author = array();
|
$author = array();
|
||||||
|
|
||||||
foreach ($posts as $p) {
|
foreach ($posts as $p) {
|
||||||
$author[] = $p->authorurl;
|
$author[] = $p->authorUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$author = array_unique($author, SORT_REGULAR);
|
$author = array_unique($author, SORT_REGULAR);
|
||||||
|
|
@ -1655,22 +1701,91 @@ function Zip($source, $destination, $include_dir = false)
|
||||||
return $zip->close();
|
return $zip->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRUE if the current page is the front page.
|
// TRUE if the current page is an index page like frontpage, tag index, archive index and search index.
|
||||||
function is_front()
|
function is_index()
|
||||||
{
|
{
|
||||||
$req = $_SERVER['REQUEST_URI'];
|
$req = $_SERVER['REQUEST_URI'];
|
||||||
if ($req == site_path() . '/' || strpos($req, site_path() . '/?page') !== false) {
|
if (strpos($req, '/archive/') !== false || strpos($req, '/tag/') !== false || strpos($req, '/search/') !== false || $req == site_path() . '/' || strpos($req, site_path() . '/?page') !== false) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRUE if the current page is an index page like frontpage, tag index, archive index and search index.
|
// TRUE if the current page is the front page.
|
||||||
function is_index()
|
function is_front($value = null)
|
||||||
{
|
{
|
||||||
$req = $_SERVER['REQUEST_URI'];
|
if (!empty($value)) {
|
||||||
if (strpos($req, '/archive/') !== false || strpos($req, '/tag/') !== false || strpos($req, '/search/') !== false || $req == site_path() . '/' || strpos($req, site_path() . '/?page') !== false) {
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is tag index.
|
||||||
|
function is_tag($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is archive index.
|
||||||
|
function is_archive($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is search index.
|
||||||
|
function is_search($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is profile page.
|
||||||
|
function is_profile($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is post page.
|
||||||
|
function is_post($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is static page page.
|
||||||
|
function is_page($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TRUE if the current page is sub static page.
|
||||||
|
function is_subpage($value = null)
|
||||||
|
{
|
||||||
|
if (!empty($value)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1701,11 +1816,11 @@ function blog_copyright()
|
||||||
return config('blog.copyright');
|
return config('blog.copyright');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return author info
|
// Return author info. Deprecated
|
||||||
function authorinfo($title = null, $body = null)
|
function authorinfo($name = null, $about = null)
|
||||||
{
|
{
|
||||||
if (config('author.info') == 'true') {
|
if (config('author.info') == 'true') {
|
||||||
return '<div class="author-info"><h4>by <strong>' . $title . '</strong></h4>' . $body . '</div>';
|
return '<div class="author-info"><h4>by <strong>' . $name . '</strong></h4>' . $about . '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1734,12 +1849,12 @@ function head_contents()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($styleImage == 'on') {
|
if ($styleImage == 'on') {
|
||||||
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . $sitemap . "\n" . $feed . "\n" . $lightboxcss . "\n" . $jquery . "\n" . $lightbox . "\n" . $corejs . "\n" . $webmasterTools;
|
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . $sitemap . "\n" . $feed . "\n" . $lightboxcss . "\n" . $jquery . "\n" . $lightbox . "\n" . $corejs . "\n" . $webmasterTools . "\n";
|
||||||
} else {
|
} else {
|
||||||
if ($jq == 'enable') {
|
if ($jq == 'enable') {
|
||||||
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . "\n" . $sitemap . "\n" . $feed . "\n" . $jquery . "\n" . $webmasterTools;
|
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . "\n" . $sitemap . "\n" . $feed . "\n" . $jquery . "\n" . $webmasterTools. "\n";
|
||||||
} else {
|
} else {
|
||||||
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . "\n" . $sitemap . "\n" . $feed . "\n" . $webmasterTools;
|
$output .= $charset . "\n" . $xua . "\n" . $viewport . "\n" . $generator . "\n" . $favicon . "\n" . $sitemap . "\n" . $feed . "\n" . $webmasterTools. "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="social"><?php echo social() ?></div>
|
<div class="social"><?php echo social() ?></div>
|
||||||
<div class="menu"><?php echo menu() ?></div>
|
<div class="menu"><?php echo menu() ?></div>
|
||||||
<div class="recent"><h3>Recent Posts</h3><?php echo recent() ?></div>
|
<div class="recent"><h3>Recent Posts</h3><?php echo recent_posts() ?></div>
|
||||||
<div class="archive"><h3>Archive</h3><?php echo archive_list() ?></div>
|
<div class="archive"><h3>Archive</h3><?php echo archive_list() ?></div>
|
||||||
<div class="tagcloud"><h3>Tags</h3><?php echo tag_cloud() ?></div>
|
<div class="tagcloud"><h3>Tags</h3><?php echo tag_cloud() ?></div>
|
||||||
<div class="copyright"><?php echo copyright() ?></div>
|
<div class="copyright"><?php echo copyright() ?></div>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span>
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span>
|
||||||
<?php if (disqus_count()) { ?> -
|
<?php if (disqus_count()) { ?> -
|
||||||
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
||||||
<?php } elseif (facebook()) { ?> -
|
<?php } elseif (facebook()) { ?> -
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
<a name="more"></a>
|
<a name="more"></a>
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date) ?></a></span>
|
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this month"><?php echo date('d F Y', $p->date) ?></a></span>
|
||||||
- Posted in
|
- Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> -
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span> -
|
||||||
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
||||||
</div>
|
</div>
|
||||||
<?php if (!empty($p->image)) { ?>
|
<?php if (!empty($p->image)) { ?>
|
||||||
|
|
@ -29,7 +29,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="separator">→</div>
|
<div class="separator">→</div>
|
||||||
<div class="share-box">
|
<div class="share-box">
|
||||||
<?php echo $authorinfo ?>
|
<div class="author-info">
|
||||||
|
<h4>By <strong><?php echo $author->name ?></strong></h4>
|
||||||
|
<?php echo $author->about ?>
|
||||||
|
</div>
|
||||||
<div class="share">
|
<div class="share">
|
||||||
<h4>Share this post</h4>
|
<h4>Share this post</h4>
|
||||||
<a class="twitter" target="_blank"
|
<a class="twitter" target="_blank"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
||||||
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
||||||
<div class="bio" itemprop="description"><?php echo $bio ?></div>
|
<div class="bio" itemprop="description"><?php echo $about ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="post-index">Posts by this author</h2>
|
<h2 class="post-index">Posts by this author</h2>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<footer id="footer">
|
<footer id="footer">
|
||||||
<div class="footer-column">
|
<div class="footer-column">
|
||||||
<div class="recent column">
|
<div class="recent column">
|
||||||
<div class="inner"><h3>Recent Posts</h3><?php echo recent() ?></div>
|
<div class="inner"><h3>Recent Posts</h3><?php echo recent_posts() ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="archive column">
|
<div class="archive column">
|
||||||
<div class="inner"><h3>Archive</h3><?php echo archive_list() ?></div>
|
<div class="inner"><h3>Archive</h3><?php echo archive_list() ?></div>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span>
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span>
|
||||||
<?php if (disqus_count()) { ?> -
|
<?php if (disqus_count()) { ?> -
|
||||||
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
||||||
<?php } elseif (facebook()) { ?> -
|
<?php } elseif (facebook()) { ?> -
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
<a name="more"></a>
|
<a name="more"></a>
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date) ?></a></span>
|
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this month"><?php echo date('d F Y', $p->date) ?></a></span>
|
||||||
- Posted in
|
- Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> -
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span> -
|
||||||
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
||||||
</div>
|
</div>
|
||||||
<?php if (!empty($p->image)) { ?>
|
<?php if (!empty($p->image)) { ?>
|
||||||
|
|
@ -29,7 +29,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="separator">→</div>
|
<div class="separator">→</div>
|
||||||
<div class="share-box">
|
<div class="share-box">
|
||||||
<?php echo $authorinfo ?>
|
<div class="author-info">
|
||||||
|
<h4>By <strong><?php echo $author->name ?></strong></h4>
|
||||||
|
<?php echo $author->about ?>
|
||||||
|
</div>
|
||||||
<div class="share">
|
<div class="share">
|
||||||
<h4>Share this post</h4>
|
<h4>Share this post</h4>
|
||||||
<a class="twitter" target="_blank" href="https://twitter.com/share?url=<?php echo $p->url ?>&text=<?php echo $p->title ?>">Twitter</a>
|
<a class="twitter" target="_blank" href="https://twitter.com/share?url=<?php echo $p->url ?>&text=<?php echo $p->title ?>">Twitter</a>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
||||||
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
||||||
<div class="bio" itemprop="description"><?php echo $bio ?></div>
|
<div class="bio" itemprop="description"><?php echo $about ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="post-index">Posts by this author</h2>
|
<h2 class="post-index">Posts by this author</h2>
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="recent">
|
<div class="recent">
|
||||||
<h3>Recent Posts</h3>
|
<h3>Recent Posts</h3>
|
||||||
<?php echo recent() ?>
|
<?php echo recent_posts() ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="archive">
|
<div class="archive">
|
||||||
<h3>Archive</h3>
|
<h3>Archive</h3>
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
<div class="comments">
|
<div class="comments">
|
||||||
<h3>Comments</h3>
|
<h3>Comments</h3>
|
||||||
<?php echo recent_comments() ?>
|
<?php echo recent_comments() ?>
|
||||||
|
<style>li.dsq-widget-item {border-bottom: 1px solid #ebebeb;margin:0;margin-bottom:10px;padding:0;padding-bottom:10px;}a.dsq-widget-user {font-weight:normal;}img.dsq-widget-avatar {margin-right:10px; }.dsq-widget-comment {display:block;padding-top:5px;}.dsq-widget-comment p {display:block;margin:0;}p.dsq-widget-meta {padding-top:5px;margin:0;}#dsq-combo-widget.grey #dsq-combo-content .dsq-combo-box {background: transparent;}#dsq-combo-widget.grey #dsq-combo-tabs li {background: none repeat scroll 0 0 #DDDDDD;}</style>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="tagcloud">
|
<div class="tagcloud">
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
<span itemprop="datePublished"><?php echo date('d F Y', $p->date) ?></span> - Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span>
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span>
|
||||||
<?php if (disqus_count()) { ?> -
|
<?php if (disqus_count()) { ?> -
|
||||||
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
<span><a href="<?php echo $p->url ?>#disqus_thread">Comments</a></span>
|
||||||
<?php } elseif (facebook()) { ?> -
|
<?php } elseif (facebook()) { ?> -
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
<a name="more"></a>
|
<a name="more"></a>
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $p->title ?></h1>
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this day"><?php echo date('d F Y', $p->date) ?></a></span>
|
<span itemprop="datePublished"><a href="<?php echo $p->archive ?>" title="Show all posts made on this month"><?php echo date('d F Y', $p->date) ?></a></span>
|
||||||
- Posted in
|
- Posted in
|
||||||
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
<span itemprop="articleSection"><?php echo $p->tag ?></span> by
|
||||||
<span itemprop="author"><a href="<?php echo $p->authorurl ?>"><?php echo $p->author ?></a></span> -
|
<span itemprop="author"><a href="<?php echo $p->authorUrl ?>"><?php echo $p->author ?></a></span> -
|
||||||
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
<span><a href="<?php echo $p->url ?>" rel="permalink">Permalink</a></span>
|
||||||
</div>
|
</div>
|
||||||
<?php if (!empty($p->image)) { ?>
|
<?php if (!empty($p->image)) { ?>
|
||||||
|
|
@ -29,8 +29,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="separator">→</div>
|
<div class="separator">→</div>
|
||||||
<div class="share-box">
|
<div class="share-box">
|
||||||
<?php echo $authorinfo ?>
|
<div class="author-info">
|
||||||
<div class="share">
|
<h4>By <strong><?php echo $author->name ?></strong></h4>
|
||||||
|
<?php echo $author->about ?>
|
||||||
|
</div>
|
||||||
|
<div class="share">
|
||||||
<h4>Share this post</h4>
|
<h4>Share this post</h4>
|
||||||
<a class="twitter" target="_blank"
|
<a class="twitter" target="_blank"
|
||||||
href="https://twitter.com/share?url=<?php echo $p->url ?>&text=<?php echo $p->title ?>">Twitter</a>
|
href="https://twitter.com/share?url=<?php echo $p->url ?>&text=<?php echo $p->title ?>">Twitter</a>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
<div class="profile-wrapper" itemprop="accountablePerson" itemscope="itemscope">
|
||||||
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
<div class="profile" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="Person">
|
||||||
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
<h1 class="title-post" itemprop="name"><?php echo $name ?></h1>
|
||||||
<div class="bio" itemprop="description"><?php echo $bio ?></div>
|
<div class="bio" itemprop="description"><?php echo $about ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="post-index">Posts by this author</h2>
|
<h2 class="post-index">Posts by this author</h2>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue