Browse Source

Finished Feature custom meta description

pull/77/head^2
Kanti 11 years ago
parent
commit
f81b68db2d
7 changed files with 49 additions and 51 deletions
  1. +4
    -4
      system/admin/admin.php
  2. +3
    -2
      system/admin/views/add-page.html.php
  3. +2
    -1
      system/admin/views/add-post.html.php
  4. +2
    -0
      system/admin/views/edit-page.html.php
  5. +2
    -1
      system/admin/views/edit-post.html.php
  6. +2
    -0
      system/admin/views/edit-profile.html.php
  7. +34
    -43
      system/htmly.php

+ 4
- 4
system/admin/admin.php View File

@ -46,7 +46,7 @@ function edit_post($title, $tag, $url, $content, $oldfile, $destination = null,
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "<!--d " . $description . " d-->";
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
@ -134,7 +134,7 @@ function add_post($title, $tag, $url, $content, $user, $desciption = null) {
$post_tag = preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($tag));
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "<!--d " . $description . " d-->";
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
@ -166,7 +166,7 @@ function add_page($title, $url, $content, $description = null) {
$post_title = $title;
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "<!--d " . $description . " d-->";
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}
@ -198,7 +198,7 @@ function add_sub_page($title, $url, $content, $static, $description = null) {
$post_title = $title;
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
if ($description !== null) {
$post_description = "<!--d " . $description . " d-->";
$post_description = "\n<!--d " . $description . " d-->";
} else {
$post_description = "";
}


+ 3
- 2
system/admin/views/add-page.html.php View File

@ -9,8 +9,9 @@
<form method="POST">
Title <span class="required">*</span><br><input type="text" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" name="title" value="<?php if (isset($postTitle)) { echo $postTitle;} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) { echo $postUrl;} ?>"/><br>
<span class="help">If the url leave empty we will use the page title.</span>
<br><br>
<span class="help">If the url leave empty we will use the page title.</span><br><br>
Meta Description (optional)<br><input type="text" class="text" name="description" value="<?php if (isset($postDescription)) { echo $postDescription;} ?>"/><br>
<br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) { echo $postContent;} ?></textarea><br/>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf()?>">


+ 2
- 1
system/admin/views/add-post.html.php View File

@ -10,7 +10,8 @@
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" name="title" value="<?php if (isset($postTitle)) { echo $postTitle;} ?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) { if (empty($postTag)) { echo 'error';}} ?>" name="tag" value="<?php if (isset($postTag)) { echo $postTag;} ?>"/><br><br>
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) { echo $postUrl;} ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><input type="text" class="text" name="description" value="<?php if (isset($postDescription)) { echo $postDescription;} ?>"/><br>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) { echo $postContent;} ?></textarea><br/>


+ 2
- 0
system/admin/views/edit-page.html.php View File

@ -35,6 +35,8 @@
Title <span class="required">*</span><br><input type="text" name="title" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" value="<?php echo $oldtitle?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the page title.</span><br><br>
Meta Description (optional)<br><input type="text" class="text" name="description" value="<?php if (isset($p->description)) { echo $p->description;} ?>"/><br>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>


+ 2
- 1
system/admin/views/edit-post.html.php View File

@ -48,7 +48,8 @@
Title <span class="required">*</span> <br><input type="text" name="title" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" value="<?php echo $oldtitle?>"/><br><br>
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) { if (empty($postTag)) { echo 'error';}} ?>" value="<?php echo $oldtag?>"/><br><br>
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
<span class="help">If the url leave empty we will use the post title.</span>
<span class="help">If the url leave empty we will use the post title.</span><br><br>
Meta Description (optional)<br><input type="text" class="text" name="description" value="<?php if (isset($p->description)) { echo $p->description;} ?>"/><br>
<br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>


+ 2
- 0
system/admin/views/edit-profile.html.php View File

@ -28,6 +28,8 @@
<div class="wmd-panel">
<form method="POST">
Title <span class="required">*</span> <br><input type="text" name="title" class="text <?php if (isset($postTitle)) { if (empty($postTitle)) { echo 'error';}} ?>" value="<?php echo $oldtitle?>"/><br><br>
Meta Description (optional)<br><input type="text" class="text" name="description" value="<?php if (isset($postDescription)) { echo $postDescription;} ?>"/><br>
<br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) { if (empty($postContent)) { echo 'error';}} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
<input type="hidden" name="csrf_token" value="<?php echo get_csrf()?>">


+ 34
- 43
system/htmly.php View File

@ -108,7 +108,7 @@ post('/login', function() {
}
});
get("/:static/:sub/edit", function($static,$sub) {
get("/:static/:sub/edit", function($static, $sub) {
if (login()) {
@ -120,8 +120,8 @@ get("/:static/:sub/edit", function($static,$sub) {
}
$post = $post[0];
$page = get_static_sub_post($static,$sub);
$page = get_static_sub_post($static, $sub);
if (!$page) {
not_found();
@ -141,23 +141,21 @@ get("/:static/:sub/edit", function($static,$sub) {
header("location: $login");
}
});
post("/:static/:sub/edit", function($static,$sub) {
post("/:static/:sub/edit", function($static, $sub) {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
if(!login())
{
if (!login()) {
$login = site_url() . 'login';
header("location: $login");
header("location: $login");
}
$title = from($_REQUEST, 'title');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
$oldfile = from($_REQUEST, 'oldfile');
$destination = from($_GET, 'destination');
$description = from($_REQUEST, 'description');
if($destination === null)
{
if ($destination === null) {
$destination = $static . "/" . $sub;
}
if ($proper && !empty($title) && !empty($content)) {
@ -193,7 +191,7 @@ post("/:static/:sub/edit", function($static,$sub) {
}
});
get("/:static/:sub/delete", function($static,$sub) {
get("/:static/:sub/delete", function($static, $sub) {
if (login()) {
@ -206,7 +204,7 @@ get("/:static/:sub/delete", function($static,$sub) {
$post = $post[0];
$page = get_static_sub_post($static,$sub);
$page = get_static_sub_post($static, $sub);
if (!$page) {
not_found();
@ -239,8 +237,7 @@ post("/:static/:sub/delete", function() {
// The blog post page
get('/:year/:month/:name', function($year, $month, $name) {
if(config("views.counter") != "true")
{
if (config("views.counter") != "true") {
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
@ -253,9 +250,8 @@ get('/:year/:month/:name', function($year, $month, $name) {
if (!$current) {
not_found();
}
if(config("views.counter") == "true")
{
if (config("views.counter") == "true") {
add_view($current->file);
if (!login()) {
@ -284,7 +280,7 @@ get('/:year/:month/:name', function($year, $month, $name) {
}
render('post', array(
'head_contents' => head_contents($current->title . ' - ' . blog_title(), $description = get_description($current->body), $current->url),
'head_contents' => head_contents($current->title . ' - ' . blog_title(), $current->description, $current->url),
'p' => $current,
'authorinfo' => authorinfo($bio->title, $bio->body),
'bodyclass' => 'inpost',
@ -707,14 +703,13 @@ get('/:static', function($static) {
}
die;
} else {
if( config("views.counter") != "true")
{
if (config("views.counter") != "true") {
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
}
$post = get_static_post($static);
if (!$post) {
@ -723,8 +718,7 @@ get('/:static', function($static) {
$post = $post[0];
if(config("views.counter") == "true")
{
if (config("views.counter") == "true") {
add_view($post->file);
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
@ -732,7 +726,7 @@ get('/:static', function($static) {
}
render('static', array(
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $description = get_description($post->body), $post->url),
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $post->description, $post->url),
'bodyclass' => 'inpage',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; ' . $post->title,
'p' => $post,
@ -772,12 +766,11 @@ get('/:static/edit', function($static) {
post('/:static/edit', function() {
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
if(!login())
{
if (!login()) {
$login = site_url() . 'login';
header("location: $login");
header("location: $login");
}
$title = from($_REQUEST, 'title');
$url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content');
@ -1244,14 +1237,13 @@ get('/:static/add', function($static) {
config('views.root', 'system/admin/views');
$post = get_static_post($static);
if(! $post)
{
if (!$post) {
not_found();
}
$post = $post[0];
render('add-page', array(
'head_contents' => head_contents('Add page - ' . blog_title(), blog_description(), site_url()),
'bodyclass' => 'addpage',
@ -1301,29 +1293,28 @@ post('/:static/add', function($static) {
}
});
get('/:static/:sub', function($static,$sub) {
get('/:static/:sub', function($static, $sub) {
$father_post = get_static_post($static);
if (!$father_post) {
not_found();
}
$post = get_static_sub_post($static,$sub);
$post = get_static_sub_post($static, $sub);
if (!$post) {
not_found();
}
$post = $post[0];
if(config("views.counter") == "true")
{
add_view($post->file);
}
if (config("views.counter") == "true") {
add_view($post->file);
}
if (!login()) {
file_cache($_SERVER['REQUEST_URI']);
}
render('static', array(
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $description = get_description($post->body), $post->url),
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $post->description, $post->url),
'bodyclass' => 'inpage',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . $father_post[0]->url . '">' . $father_post[0]->title . '</a> &#187; ' . $post->title,
'p' => $post,


Loading…
Cancel
Save