From 2af426028b36c8d8433857678f733f0736b1a6df Mon Sep 17 00:00:00 2001 From: mmk2410 Date: Fri, 27 Mar 2015 07:04:23 +0100 Subject: [PATCH] Version 2.0 (Share Buttons; Article Pages; config file; disqus) --- .gitignore | 1 + config.php | 25 +++ index.php | 174 +++++++++++++-- md/intro.md | 3 +- res/SocialBar.php | 14 ++ res/blog.css | 55 ++++- res/fb.png | Bin 0 -> 1587 bytes res/gplus.svg | 147 +++++++++++++ res/hrefgenerator.php | 50 +++++ res/twttr.svg | 458 ++++++++++++++++++++++++++++++++++++++++ res/umlautconverter.php | 33 +++ xml/posts.xml | 19 +- 12 files changed, 952 insertions(+), 27 deletions(-) create mode 100644 .gitignore create mode 100644 config.php create mode 100644 res/SocialBar.php create mode 100644 res/fb.png create mode 100644 res/gplus.svg create mode 100644 res/hrefgenerator.php create mode 100644 res/twttr.svg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80f408e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +nbproject/ diff --git a/config.php b/config.php new file mode 100644 index 0000000..a4b5c8b --- /dev/null +++ b/config.php @@ -0,0 +1,25 @@ +github.com/mmk2410/pBlog'; +?> diff --git a/index.php b/index.php index 546bbbf..39c07e8 100644 --- a/index.php +++ b/index.php @@ -1,39 +1,60 @@ + - + + - - pBlog - + <?php echo $blogtitle; ?> + + + - + - - +
- - pBlog - - Home + + + +
-
setBreaksEnabled(true) @@ -45,23 +66,130 @@ ?>
- - post as $post){ - ?> + $href = $post->title; + $HrefGenerator = new HrefGenerator; + $href = $HrefGenerator->createHref($href); + $titleArray[$i] = $href; + $i = $i + 1; + } + if($_GET['article'] != ""){ + $an = array_search($_GET['article'], $titleArray, true); + $post = $xml->post[$an]; + ?>
-

+ title; $UmlautConverter = new UmlautConverter; $title = $UmlautConverter->convert($title); echo $title; + ?> +
+
+ + pubdate; + $UmlautConverter = new UmlautConverter; + $pubdate = $UmlautConverter->convert($pubdate); + echo $pubdate; + ?> + +

+ setBreaksEnabled(true) + ->text($post->content); + $UmlautConverter = new UmlautConverter; + $content = $UmlautConverter->convert($content); + echo $content; ?>

+

+ otherlinks->otherlb as $olb){ + ?> + + otherlink; + $UmlautConverter = new UmlautConverter; + $otherlink = $UmlautConverter->convert($otherlink); + echo $otherlink; + ?> + + mainlink as $mainlink){ + ?> + + mainlink; + $UmlautConverter = new UmlautConverter; + $mainlink = $UmlautConverter->convert($mainlink); + echo $mainlink; + ?> + + +

+ + +
+ + + +
+ + post as $post){ + ?> +
+ + title; + $UmlautConverter = new UmlautConverter; + $title = $UmlautConverter->convert($title); + echo $title; + ?> +
+
pubdate; @@ -123,11 +251,11 @@
diff --git a/md/intro.md b/md/intro.md index b48a419..420d788 100644 --- a/md/intro.md +++ b/md/intro.md @@ -1,8 +1,7 @@ -#pBlog This is the Blog of the Blog Engine **pBlog** pBlog is based on PHP, XML and Markdown. It is easy to install and to configure. -The latest Version is **1.2** +The latest Version is **2.0** You can find the source code on [GitHub](https://github.com/mmk2410/pBlog). diff --git a/res/SocialBar.php b/res/SocialBar.php new file mode 100644 index 0000000..13ccc08 --- /dev/null +++ b/res/SocialBar.php @@ -0,0 +1,14 @@ + + + + +
+ + + + + + +
\ No newline at end of file diff --git a/res/blog.css b/res/blog.css index dabace2..bc4b449 100644 --- a/res/blog.css +++ b/res/blog.css @@ -1,4 +1,29 @@ -/* pBlog 0.2 */ +/* pBlog 2.0 */ + +/* + * The MIT License + * + * Copyright 2015 mmk2410. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FINESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ body{ margin-right: 15%; @@ -155,7 +180,23 @@ code{ color: rgb(33, 33, 33); line-height: 24px; letter-spacing: 0.05px; + text-decoration: none; } + +.texttitle:hover{ + color: #de3e0b; +} + +.texttitlemono{ + font-family: 'Roboto', sans-serif; + font-weight: 500; + font-size: 20px; + color: rgb(33, 33, 33); + line-height: 24px; + letter-spacing: 0.05px; + text-decoration: none; +} + .cc{ font-family: 'Roboto', sans-serif; font-size: 12px; @@ -177,6 +218,18 @@ code{ text-decoration: underline; } +.socialbar{ + display: inline-block; + height: 68px; + margin-top: 10px; +} + +.socialimg{ + height: 40px; + display: inline-block; + padding-right: 5px; +} + @media screen and (max-width: 700px){ body { margin-right: 40px; diff --git a/res/fb.png b/res/fb.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3a2370dd2bab99c363f5bf5d06d8e89ee30e5c GIT binary patch literal 1587 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m@_g%B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRK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+~hA!u><_SOCoI%C7r>mdKI;Vst0BVU;%K!iX literal 0 HcmV?d00001 diff --git a/res/gplus.svg b/res/gplus.svg new file mode 100644 index 0000000..ee51071 --- /dev/null +++ b/res/gplus.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/res/hrefgenerator.php b/res/hrefgenerator.php new file mode 100644 index 0000000..c52b4aa --- /dev/null +++ b/res/hrefgenerator.php @@ -0,0 +1,50 @@ + + */ + +class HrefGenerator { + + function createHref($text) + { + $output = str_replace(" ", "-", $text); + $output = str_replace("ä","ae",$output); + $output = str_replace("Ä","Ae",$output); + $output = str_replace("ö","oe",$output); + $output = str_replace("Ö","Oe",$output); + $output = str_replace("ü","ue",$output); + $output = str_replace("Ü","Ue",$output); + $output = str_replace("ß","ss",$output); + return $output; + } + +} diff --git a/res/twttr.svg b/res/twttr.svg new file mode 100644 index 0000000..57920f4 --- /dev/null +++ b/res/twttr.svg @@ -0,0 +1,458 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/res/umlautconverter.php b/res/umlautconverter.php index 2bf1b70..4b435d2 100644 --- a/res/umlautconverter.php +++ b/res/umlautconverter.php @@ -1,4 +1,37 @@ + */ + class UmlautConverter { function convert($text) diff --git a/xml/posts.xml b/xml/posts.xml index 198bd1f..484fd94 100644 --- a/xml/posts.xml +++ b/xml/posts.xml @@ -1,8 +1,25 @@ + + Version 2.0 + 27th March 2015 + +This version introduces some very imporant features: + - **Own page for every article** + - Social **sharing buttons** (at the moment: google+, twitter, facebook but more will follow) + - **Disqus** integration + - Local **config file** -> no more editing the index file + +pBlog 2.0 is only partially compatible with prior versions. You don't have to change anything in the posts or intro file (in case you have one), but to switch to version 2.0 you have to replace your index.php with the new one. With this step all your settings like the title will be lost and you have to set them in the new config.php file. For more questions write me a mail to marcelmichaelkapfer@yahoo.co.nz. + +In the near future I will spend more time in writing a documentation about the blog engine and adding more comments (especially in the css file). + + http://github.com/mmk2410/pBlog + GitHub + Version 1.2 - 8th February 2015 + 8th March 2015 In this Version code is better designed so you can read and recognise it better.