mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 12:06:22 +05:30
Formatting
This commit is contained in:
parent
212bdf4152
commit
c4b4c89bd9
4 changed files with 138 additions and 131 deletions
|
|
@ -109,14 +109,14 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty
|
||||||
$post_tagmd[] = $t;
|
$post_tagmd[] = $t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_tag = safe_tag(implode(',', $post_tag));
|
$post_tag = safe_tag(implode(',', $post_tag));
|
||||||
$post_tagmd = safe_html(implode(',', $post_tagmd));
|
$post_tagmd = safe_html(implode(',', $post_tagmd));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$post_tag = safe_tag(implode(',', $tag));
|
$post_tag = safe_tag(implode(',', $tag));
|
||||||
$post_tagmd = safe_html(implode(',', $tag));
|
$post_tagmd = safe_html(implode(',', $tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_date = date('Y-m-d-H-i-s', strtotime($dateTime));
|
$post_date = date('Y-m-d-H-i-s', strtotime($dateTime));
|
||||||
$post_title = safe_html($title);
|
$post_title = safe_html($title);
|
||||||
|
|
@ -189,11 +189,11 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty
|
||||||
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $post_date . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
|
|
||||||
if (empty($draft)) {
|
if (empty($draft)) {
|
||||||
if (date('Y-m-d-H-i-s') >= $post_date) {
|
if (date('Y-m-d-H-i-s') >= $post_date) {
|
||||||
$dir = 'content/' . $user . '/blog/' . $category. '/'.$type. '/';
|
$dir = 'content/' . $user . '/blog/' . $category. '/'.$type. '/';
|
||||||
} else {
|
} else {
|
||||||
$dir = 'content/' . $user . '/blog/' . $category. '/'.$type. '/scheduled/';
|
$dir = 'content/' . $user . '/blog/' . $category. '/'.$type. '/scheduled/';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$dir = 'content/' . $user . '/blog/' . $category. '/draft/';
|
$dir = 'content/' . $user . '/blog/' . $category. '/draft/';
|
||||||
}
|
}
|
||||||
|
|
@ -211,11 +211,11 @@ function add_content($title, $tag, $url, $content, $user, $draft, $category, $ty
|
||||||
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename, $category, $type);
|
clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename, $category, $type);
|
||||||
|
|
||||||
if (empty($draft)) {
|
if (empty($draft)) {
|
||||||
if (date('Y-m-d-H-i-s') >= $post_date) {
|
if (date('Y-m-d-H-i-s') >= $post_date) {
|
||||||
$redirect = site_url() . 'admin/mine';
|
$redirect = site_url() . 'admin/mine';
|
||||||
} else {
|
} else {
|
||||||
$redirect = site_url() . 'admin/scheduled';
|
$redirect = site_url() . 'admin/scheduled';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$redirect = site_url() . 'admin/draft';
|
$redirect = site_url() . 'admin/draft';
|
||||||
}
|
}
|
||||||
|
|
@ -249,14 +249,14 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
$post_tagmd[] = $t;
|
$post_tagmd[] = $t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_tag = safe_tag(implode(',', $post_tag));
|
$post_tag = safe_tag(implode(',', $post_tag));
|
||||||
$post_tagmd = safe_html(implode(',', $post_tagmd));
|
$post_tagmd = safe_html(implode(',', $post_tagmd));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$post_tag = safe_tag(implode(',', $tag));
|
$post_tag = safe_tag(implode(',', $tag));
|
||||||
$post_tagmd = safe_html(implode(',', $tag));
|
$post_tagmd = safe_html(implode(',', $tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldurl = explode('_', $oldfile);
|
$oldurl = explode('_', $oldfile);
|
||||||
$dir = explode('/', $oldurl[0]);
|
$dir = explode('/', $oldurl[0]);
|
||||||
|
|
@ -319,25 +319,25 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
$post_media = "";
|
$post_media = "";
|
||||||
}
|
}
|
||||||
$post_content = "<!--t " . $post_title . " t-->" . $post_description . $tagmd . $post_media . "\n\n" . $content;
|
$post_content = "<!--t " . $post_title . " t-->" . $post_description . $tagmd . $post_media . "\n\n" . $content;
|
||||||
|
|
||||||
$dirBlog = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type . '/';
|
$dirBlog = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type . '/';
|
||||||
$dirDraft = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/draft/';
|
$dirDraft = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/draft/';
|
||||||
$dirScheduled = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type . '/scheduled/';
|
$dirScheduled = $dir[0] . '/' . $dir[1] . '/' . $dir[2] . '/' . $category . '/' . $type . '/scheduled/';
|
||||||
|
|
||||||
if (is_dir($dirBlog)) {
|
if (is_dir($dirBlog)) {
|
||||||
} else {
|
} else {
|
||||||
mkdir($dirBlog, 0775, true);
|
mkdir($dirBlog, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($dirDraft)) {
|
if (is_dir($dirDraft)) {
|
||||||
} else {
|
} else {
|
||||||
mkdir($dirDraft, 0775, true);
|
mkdir($dirDraft, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($dirScheduled)) {
|
if (is_dir($dirScheduled)) {
|
||||||
} else {
|
} else {
|
||||||
mkdir($dirScheduled, 0775, true);
|
mkdir($dirScheduled, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
|
if (!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) {
|
||||||
|
|
||||||
|
|
@ -346,11 +346,11 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
if(!empty($revertPost) || !empty($publishDraft)) {
|
if(!empty($revertPost) || !empty($publishDraft)) {
|
||||||
|
|
||||||
if($dir[4] == 'draft') {
|
if($dir[4] == 'draft') {
|
||||||
if (date('Y-m-d-H-i-s') >= $olddate) {
|
if (date('Y-m-d-H-i-s') >= $olddate) {
|
||||||
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
} else {
|
} else {
|
||||||
$filename = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
}
|
}
|
||||||
|
|
@ -361,18 +361,18 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($dir[3] === $category) {
|
if ($dir[3] === $category) {
|
||||||
|
|
||||||
if($dir[4] == 'draft') {
|
if($dir[4] == 'draft') {
|
||||||
$newfile = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$newfile = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
} else {
|
} else {
|
||||||
if (date('Y-m-d-H-i-s') >= $olddate) {
|
if (date('Y-m-d-H-i-s') >= $olddate) {
|
||||||
$newfile = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$newfile = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
} else {
|
} else {
|
||||||
$newfile = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$newfile = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oldfile === $newfile) {
|
if ($oldfile === $newfile) {
|
||||||
file_put_contents($oldfile, print_r($post_content, true));
|
file_put_contents($oldfile, print_r($post_content, true));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -384,11 +384,11 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
if($dir[4] == 'draft') {
|
if($dir[4] == 'draft') {
|
||||||
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirDraft . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
} else {
|
} else {
|
||||||
if (date('Y-m-d-H-i-s') >= $olddate) {
|
if (date('Y-m-d-H-i-s') >= $olddate) {
|
||||||
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirBlog . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
} else {
|
} else {
|
||||||
$filename = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
$filename = $dirScheduled . $olddate . '_' . $post_tag . '_' . $post_url . '.md';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents($filename, print_r($post_content, true));
|
file_put_contents($filename, print_r($post_content, true));
|
||||||
|
|
@ -431,21 +431,21 @@ function edit_content($title, $tag, $url, $content, $oldfile, $revertPost, $publ
|
||||||
$drafturl = site_url() . 'admin/draft';
|
$drafturl = site_url() . 'admin/draft';
|
||||||
header("Location: $drafturl");
|
header("Location: $drafturl");
|
||||||
} else {
|
} else {
|
||||||
if (date('Y-m-d-H-i-s') >= $olddate) {
|
if (date('Y-m-d-H-i-s') >= $olddate) {
|
||||||
header("Location: $posturl");
|
header("Location: $posturl");
|
||||||
} else {
|
} else {
|
||||||
$schurl = site_url() . 'admin/scheduled';
|
$schurl = site_url() . 'admin/scheduled';
|
||||||
header("Location: $schurl");
|
header("Location: $schurl");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!empty($publishDraft)) {
|
if(!empty($publishDraft)) {
|
||||||
if (date('Y-m-d-H-i-s') >= $olddate) {
|
if (date('Y-m-d-H-i-s') >= $olddate) {
|
||||||
header("Location: $posturl");
|
header("Location: $posturl");
|
||||||
} else {
|
} else {
|
||||||
$schurl = site_url() . 'admin/scheduled';
|
$schurl = site_url() . 'admin/scheduled';
|
||||||
header("Location: $schurl");
|
header("Location: $schurl");
|
||||||
}
|
}
|
||||||
} elseif (!empty($revertPost)) {
|
} elseif (!empty($revertPost)) {
|
||||||
$drafturl = site_url() . 'admin/draft';
|
$drafturl = site_url() . 'admin/draft';
|
||||||
header("Location: $drafturl");
|
header("Location: $drafturl");
|
||||||
|
|
@ -473,18 +473,18 @@ function add_page($title, $url, $content, $description = null)
|
||||||
} else {
|
} else {
|
||||||
$post_description = "";
|
$post_description = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts = get_static_pages();
|
$posts = get_static_pages();
|
||||||
$timestamp = date('YmdHis');
|
$timestamp = date('YmdHis');
|
||||||
foreach ($posts as $index => $v) {
|
foreach ($posts as $index => $v) {
|
||||||
$arr = explode('/', $v);
|
$arr = explode('/', $v);
|
||||||
if (strtolower($arr[2]) === strtolower($post_url . '.md')) {
|
if (strtolower($arr[2]) === strtolower($post_url . '.md')) {
|
||||||
$post_url = $post_url .'-'. $timestamp;
|
$post_url = $post_url .'-'. $timestamp;
|
||||||
} else {
|
} else {
|
||||||
$post_url = $post_url;
|
$post_url = $post_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
|
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
|
||||||
|
|
||||||
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
|
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
|
||||||
|
|
@ -562,7 +562,7 @@ function edit_page($title, $url, $content, $oldfile, $destination = null, $descr
|
||||||
} else {
|
} else {
|
||||||
$post_description = "";
|
$post_description = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
|
$post_content = '<!--t ' . $post_title . ' t-->' . $post_description . "\n\n" . $content;
|
||||||
|
|
||||||
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
|
if (!empty($post_title) && !empty($post_url) && !empty($post_content)) {
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,13 @@
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="<?php echo site_url();?>admin/scheduled" class="nav-link">
|
||||||
|
<p>
|
||||||
|
<?php echo 'Scheduled'; ?>
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="<?php echo site_url();?>admin/draft" class="nav-link">
|
<a href="<?php echo site_url();?>admin/draft" class="nav-link">
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -2302,7 +2302,7 @@ get('/post/:name', function ($name) {
|
||||||
$post = find_post(null, null, $name);
|
$post = find_post(null, null, $name);
|
||||||
if (is_null($post)) {
|
if (is_null($post)) {
|
||||||
not_found();
|
not_found();
|
||||||
} else {
|
} else {
|
||||||
$current = $post['current'];
|
$current = $post['current'];
|
||||||
}
|
}
|
||||||
$redir = site_url() . date('Y/m', $current->date) . '/' . $name;
|
$redir = site_url() . date('Y/m', $current->date) . '/' . $name;
|
||||||
|
|
@ -2319,9 +2319,9 @@ get('/post/:name', function ($name) {
|
||||||
|
|
||||||
if (is_null($post)) {
|
if (is_null($post)) {
|
||||||
not_found();
|
not_found();
|
||||||
} else {
|
} else {
|
||||||
$current = $post['current'];
|
$current = $post['current'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config("views.counter") == "true") {
|
if (config("views.counter") == "true") {
|
||||||
add_view($current->file);
|
add_view($current->file);
|
||||||
|
|
@ -2422,12 +2422,12 @@ get('/post/:name/edit', function ($name) {
|
||||||
|
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_draft($year, $month, $name);
|
$post = find_draft($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_scheduled($year, $month, $name);
|
$post = find_scheduled($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
not_found();
|
not_found();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2633,12 +2633,12 @@ get('/post/:name/delete', function ($name) {
|
||||||
|
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_draft($year, $month, $name);
|
$post = find_draft($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_scheduled($year, $month, $name);
|
$post = find_scheduled($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
not_found();
|
not_found();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3092,7 +3092,7 @@ get('/:static/:sub', function ($static, $sub) {
|
||||||
$url = site_url() . 'search/' . remove_accent($search);
|
$url = site_url() . 'search/' . remove_accent($search);
|
||||||
header("Location: $url");
|
header("Location: $url");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($static === 'front') {
|
if ($static === 'front') {
|
||||||
$redir = site_url();
|
$redir = site_url();
|
||||||
header("location: $redir", TRUE, 301);
|
header("location: $redir", TRUE, 301);
|
||||||
|
|
@ -3320,9 +3320,9 @@ get('/:year/:month/:name', function ($year, $month, $name) {
|
||||||
|
|
||||||
if (is_null($post)) {
|
if (is_null($post)) {
|
||||||
not_found();
|
not_found();
|
||||||
} else {
|
} else {
|
||||||
$current = $post['current'];
|
$current = $post['current'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config("views.counter") == "true") {
|
if (config("views.counter") == "true") {
|
||||||
add_view($current->file);
|
add_view($current->file);
|
||||||
|
|
@ -3423,12 +3423,12 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) {
|
||||||
|
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_draft($year, $month, $name);
|
$post = find_draft($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_scheduled($year, $month, $name);
|
$post = find_scheduled($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
not_found();
|
not_found();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3634,12 +3634,12 @@ get('/:year/:month/:name/delete', function ($year, $month, $name) {
|
||||||
|
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_draft($year, $month, $name);
|
$post = find_draft($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
$post = find_scheduled($year, $month, $name);
|
$post = find_scheduled($year, $month, $name);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
not_found();
|
not_found();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ function rebuilt_cache($type)
|
||||||
$posts_cache_unsorted = array();
|
$posts_cache_unsorted = array();
|
||||||
$page_cache = array();
|
$page_cache = array();
|
||||||
$author_cache = array();
|
$author_cache = array();
|
||||||
$scheduled = array();
|
$scheduled = array();
|
||||||
|
|
||||||
if (is_dir($dir) === false) {
|
if (is_dir($dir) === false) {
|
||||||
mkdir($dir, 0775, true);
|
mkdir($dir, 0775, true);
|
||||||
|
|
@ -203,7 +203,7 @@ function rebuilt_cache($type)
|
||||||
foreach ($tmp as $file) {
|
foreach ($tmp as $file) {
|
||||||
if(strpos($file, '/draft/') === false && strpos($file, '/scheduled/') === false) {
|
if(strpos($file, '/draft/') === false && strpos($file, '/scheduled/') === false) {
|
||||||
$posts_cache_unsorted[] = $file;
|
$posts_cache_unsorted[] = $file;
|
||||||
$posts_cache_sorted[] = pathinfo($file);
|
$posts_cache_sorted[] = pathinfo($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -229,15 +229,15 @@ function rebuilt_cache($type)
|
||||||
$string = serialize($category_cache);
|
$string = serialize($category_cache);
|
||||||
file_put_contents('cache/index/index-category.txt', print_r($string, true));
|
file_put_contents('cache/index/index-category.txt', print_r($string, true));
|
||||||
} elseif ($type === 'scheduled') {
|
} elseif ($type === 'scheduled') {
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$tmp = glob('content/*/*/*/*/scheduled/*.md', GLOB_NOSORT);
|
$tmp = glob('content/*/*/*/*/scheduled/*.md', GLOB_NOSORT);
|
||||||
if (is_array($tmp)) {
|
if (is_array($tmp)) {
|
||||||
foreach ($tmp as $file) {
|
foreach ($tmp as $file) {
|
||||||
$scheduled[] = pathinfo($file);
|
$scheduled[] = pathinfo($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usort($scheduled, "sortfile");
|
usort($scheduled, "sortfile");
|
||||||
$string = serialize($scheduled);
|
$string = serialize($scheduled);
|
||||||
file_put_contents('cache/index/index-scheduled.txt', print_r($string, true));
|
file_put_contents('cache/index/index-scheduled.txt', print_r($string, true));
|
||||||
} elseif ($type === 'all') {
|
} elseif ($type === 'all') {
|
||||||
rebuilt_cache('posts');
|
rebuilt_cache('posts');
|
||||||
|
|
@ -549,7 +549,7 @@ function find_scheduled($year, $month, $name)
|
||||||
function get_category($category, $page, $perpage, $random)
|
function get_category($category, $page, $perpage, $random)
|
||||||
{
|
{
|
||||||
$posts = get_post_sorted();
|
$posts = get_post_sorted();
|
||||||
|
|
||||||
if ($random === true) {
|
if ($random === true) {
|
||||||
shuffle($posts);
|
shuffle($posts);
|
||||||
}
|
}
|
||||||
|
|
@ -589,7 +589,7 @@ function get_category($category, $page, $perpage, $random)
|
||||||
|
|
||||||
// Return category info.
|
// Return category info.
|
||||||
function get_category_info($category)
|
function get_category_info($category)
|
||||||
{
|
{
|
||||||
$posts = get_category_files();
|
$posts = get_category_files();
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
|
@ -1576,7 +1576,7 @@ function tag_cloud($custom = null)
|
||||||
|
|
||||||
$posts = get_post_unsorted();
|
$posts = get_post_unsorted();
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
||||||
$tagcloud_count = config('tagcloud.count');
|
$tagcloud_count = config('tagcloud.count');
|
||||||
if(empty($tagcloud_count)) {
|
if(empty($tagcloud_count)) {
|
||||||
$tagcloud_count = 40;
|
$tagcloud_count = 40;
|
||||||
|
|
@ -3400,19 +3400,19 @@ function valueMaker($value)
|
||||||
function publish_scheduled()
|
function publish_scheduled()
|
||||||
{
|
{
|
||||||
$posts = get_scheduled_posts();
|
$posts = get_scheduled_posts();
|
||||||
if (!empty($posts)) {
|
if (!empty($posts)) {
|
||||||
foreach ($posts as $index => $v) {
|
foreach ($posts as $index => $v) {
|
||||||
$str = explode('_', $v['basename']);
|
$str = explode('_', $v['basename']);
|
||||||
$old = $v['dirname'] . '/' . $v['basename'];
|
$old = $v['dirname'] . '/' . $v['basename'];
|
||||||
$new = dirname($v['dirname']) . '/' . $v['basename'];
|
$new = dirname($v['dirname']) . '/' . $v['basename'];
|
||||||
$t = str_replace('-', '', $str[0]);
|
$t = str_replace('-', '', $str[0]);
|
||||||
$time = new DateTime($t);
|
$time = new DateTime($t);
|
||||||
$timestamp = $time->format("Y m d H:i:s");
|
$timestamp = $time->format("Y m d H:i:s");
|
||||||
if (date('Y m d H:i:s') >= $timestamp) {
|
if (date('Y m d H:i:s') >= $timestamp) {
|
||||||
rename($old, $new);
|
rename($old, $new);
|
||||||
rebuilt_cache('all');
|
rebuilt_cache('all');
|
||||||
clear_cache();
|
clear_cache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue