Skip to content

Commit

Permalink
Permalink without year-month
Browse files Browse the repository at this point in the history
  • Loading branch information
danpros committed Aug 13, 2015
1 parent f83e54e commit 26a1a97
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 21 deletions.
3 changes: 3 additions & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ blog.tagline = "Just another HTMLy blog"
blog.description = "Proudly powered by HTMLy, a databaseless blogging platform."
blog.copyright = "(c) Your name."

; Set permalink type. "default" using /year/month/title. "post" using /post/title
permalink.type = "default"

; Show the /blog url as the blog homepage
blog.enable = "false"

Expand Down
38 changes: 31 additions & 7 deletions system/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,

// The post date
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down Expand Up @@ -300,7 +304,11 @@ function edit_image($title, $tag, $url, $content, $oldfile, $destination = null,
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down Expand Up @@ -424,7 +432,11 @@ function edit_video($title, $tag, $url, $content, $oldfile, $destination = null,
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down Expand Up @@ -548,7 +560,11 @@ function edit_link($title, $tag, $url, $content, $oldfile, $destination = null,
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down Expand Up @@ -672,7 +688,11 @@ function edit_quote($title, $tag, $url, $content, $oldfile, $destination = null,
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down Expand Up @@ -796,7 +816,11 @@ function edit_audio($title, $tag, $url, $content, $oldfile, $destination = null,
$postdate = strtotime($timestamp);

// The post URL
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
if (config('permalink.type') == 'post') {
$posturl = site_url() . 'post/' . $post_url;
} else {
$posturl = site_url() . date('Y/m', $postdate) . '/' . $post_url;
}

save_tag_i18n($post_tag, $post_tagmd);

Expand Down
8 changes: 6 additions & 2 deletions system/admin/views/edit-audio.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@
$timestamp = $time->format("Y-m-d H:i:s");
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;

if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
Expand Down
8 changes: 6 additions & 2 deletions system/admin/views/edit-image.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;

if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
Expand Down
7 changes: 6 additions & 1 deletion system/admin/views/edit-link.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}

?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
Expand Down
7 changes: 6 additions & 1 deletion system/admin/views/edit-post.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}

?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
Expand Down
7 changes: 6 additions & 1 deletion system/admin/views/edit-quote.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}

?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
Expand Down
7 changes: 6 additions & 1 deletion system/admin/views/edit-video.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
// The post date
$postdate = strtotime($timestamp);
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
if (config('permalink.type') == 'post') {
$delete = site_url() . 'post/' . $oldmd . '/delete?destination=' . $destination;
} else {
// The post URL
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
}

?>
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
Expand Down
Loading

0 comments on commit 26a1a97

Please sign in to comment.