Explorar el Código

Add Pico::VERSION constant

Daniel Rudolf hace 9 años
padre
commit
479926eeb4
Se han modificado 2 ficheros con 13 adiciones y 2 borrados
  1. 2 2
      content-sample/index.md
  2. 11 0
      lib/Pico.php

+ 2 - 2
content-sample/index.md

@@ -5,8 +5,8 @@ Description: Pico is a stupidly simple, blazing fast, flat file CMS.
 
 ## Welcome to Pico
 
-Congratulations, you have successfully installed [Pico](http://picocms.org/).
-%meta.description% <!-- replaced by the above Description meta header -->
+Congratulations, you have successfully installed [Pico](http://picocms.org/)
+%version%. %meta.description% <!-- replaced by the above Description header -->
 
 ## Creating Content
 

+ 11 - 0
lib/Pico.php

@@ -26,6 +26,13 @@
  */
 class Pico
 {
+    /**
+     * Pico version
+     *
+     * @var string
+     */
+    const VERSION = '1.1.0-dev';
+
     /**
      * Sort files in alphabetical ascending order
      *
@@ -907,6 +914,9 @@ class Pico
             . "(?:(.*?)(?:\r)?\n)?(?(2)\*\/|---)[[:blank:]]*(?:(?:\r)?\n|$)/s";
         $content = preg_replace($metaHeaderPattern, '', $rawContent, 1);
 
+        // replace %version%
+        $content = str_replace('%version%', static::VERSION, $content);
+
         // replace %site_title%
         $content = str_replace('%site_title%', $this->getConfig('site_title'), $content);
 
@@ -1267,6 +1277,7 @@ class Pico
             'current_page' => $this->currentPage,
             'next_page' => $this->nextPage,
             'is_front_page' => ($this->requestFile === $frontPage),
+            'version' => static::VERSION
         );
     }