diff --git a/README.md b/README.md index 148299f..b30e5c0 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ ``` http://zapatista.kompot.si ``` -[http://zapatista.kompot.si](http://zapatista.kompot.si) \ No newline at end of file + + \ No newline at end of file diff --git a/assets/ZaZivljenje-slo-CL.mp3 b/assets/ZaZivljenje-slo-CL.mp3 new file mode 100644 index 0000000..4d97fc6 Binary files /dev/null and b/assets/ZaZivljenje-slo-CL.mp3 differ diff --git a/config/config.yml b/config/config.yml index ca6229e..d22f613 100644 --- a/config/config.yml +++ b/config/config.yml @@ -59,3 +59,4 @@ DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disab # Custom # my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }} +rss_feed: http://enlacezapatista.ezln.org.mx/feed diff --git a/content/navbar.md b/content/navbar.md index f8d8aad..876c816 100644 --- a/content/navbar.md +++ b/content/navbar.md @@ -5,5 +5,3 @@ title: Navigation bar - [Domov](%base_url%) - [Kdo smo?](%base_url%?kdosmo) - [Izjava za življenje](%base_url%?izjava) - - [Novice](%base_url%?novice/gora) - diff --git a/content/novice/kolaz-video.md b/content/novice/kolaz-video.md new file mode 100644 index 0000000..e1efb94 --- /dev/null +++ b/content/novice/kolaz-video.md @@ -0,0 +1,9 @@ +--- + +Title: Kolaž dobrodošlice iz Evrope +Description: Video kolaž dobrodošlic iz različnih koncev Evrope! +Date: 2021-05-10 + +--- + + \ No newline at end of file diff --git a/content/novice/video-izjava.md b/content/novice/video-izjava.md new file mode 100644 index 0000000..2657ce0 --- /dev/null +++ b/content/novice/video-izjava.md @@ -0,0 +1,10 @@ +--- + +Title: Za življenje +Description: Domači video izjave za življenje +Date: 2021-05-10 + +--- + + + diff --git a/content/sidebars/2_kolaz-video.md b/content/sidebars/2_kolaz-video.md new file mode 100644 index 0000000..81eb7b9 --- /dev/null +++ b/content/sidebars/2_kolaz-video.md @@ -0,0 +1,7 @@ +--- + +Title: Kolaž dobrodošlice iz Evrope + +--- + + \ No newline at end of file diff --git a/content/sidebars/3_izjava.md b/content/sidebars/3_izjava.md new file mode 100644 index 0000000..ff154d1 --- /dev/null +++ b/content/sidebars/3_izjava.md @@ -0,0 +1,4 @@ +--- +Title: Izjava za življenje +--- + \ No newline at end of file diff --git a/plugins/rss_to_md.php b/plugins/rss_to_md.php new file mode 100644 index 0000000..efd968e --- /dev/null +++ b/plugins/rss_to_md.php @@ -0,0 +1,125 @@ + + */ + +class Rss_to_md { + + public function __construct() { + + } + + // Get the settings from config.php + public function config_loaded(&$settings) { + + $this->config = $settings; + + } + + //Set the twig variable + public function before_render(&$twig_vars, &$twig) { + + $twig_vars['rss_to_md'] = $this->rss_to_md(); + + } + + /** + * Get the rss data + */ + + private function rss_to_md() { + + /* ============================= + Debugging + @description: Debug an array + @lastupdated: 26/02/2014 + @updatedby: James Kemp + + $item string/array + $die boolean Should we kill PHP after showing the debug data? + $vardump boolean + ============================= */ + + function d($item, $die = true, $vardump = false) { + if($die) { + die('
' . ($vardump ? var_dump($item) : print_r($item, true)) . '
'); + } else { + echo '
';
+                    ($vardump ? var_dump($item) : print_r($item));
+                echo '
'; + } + } + + if (isset($_GET['importer'])) { + + // include the config + $config = $this->config; + + // get the feed url + if (isset($config['rss_feed'])) { + $url = $config['rss_feed']; + } + + // set date format to default + $date_format = $config['date_format']; + + // build the array + $rss = new DOMDocument(); + $rss->load($url); + + //d($rss); + + function seoUrl($string) { + //Lower case everything + $string = strtolower($string); + //Make alphanumeric (removes all other characters) + $string = preg_replace("/[^a-z0-9_\s-]/", "", $string); + //Clean up multiple dashes or whitespaces + $string = preg_replace("/[\s-]+/", " ", $string); + //Convert whitespaces and underscore to dash + $string = preg_replace("/[\s_]/", "-", $string); + return $string; + } + + foreach ($rss->getElementsByTagName('item') as $node) { + + $title = $node->getElementsByTagName('title')->item(0)->nodeValue; + $date = date($date_format, strtotime($node->getElementsByTagName('pubDate')->item(0)->nodeValue)); + $description = $node->getElementsByTagName('description')->item(0)->nodeValue; + $permalink = seoUrl($title); + $rssLink = $node->getElementsByTagName('link')->item(0)->nodeValue; + + $postMd = fopen('content/sidebars/'.$permalink.".md", "w") or die("Unable to open file!"); + // open meta + $content = "/*\n"; + fwrite($postMd, $content); + + $content = 'Title: '.$title."\n"; + fwrite($postMd, $content); + + $content = 'Date: '.$date."\n"; + fwrite($postMd, $content); + + $content = 'Link: '.$rssLink."\n"; + fwrite($postMd, $content); + + // close meta + $content = "*/\n\n"; + fwrite($postMd, $content); + // close meta + $content = $description."\n"; + fwrite($postMd, $content); + + fclose($postMd); + } + + } + + } + +} diff --git a/themes/Travelify-tr00/index-novice.twig b/themes/Travelify-tr00/index-novice.twig index 5f915f0..1147a69 100644 --- a/themes/Travelify-tr00/index-novice.twig +++ b/themes/Travelify-tr00/index-novice.twig @@ -48,6 +48,7 @@ {% for page in pages("novice/")|sort_by("date")|reverse if not page.hidden %}

{{ page.title }}

+

{{ page.description }}

{{ page.date_formatted }}

{% endfor %}