|
@@ -11,6 +11,7 @@ use \Michelf\MarkdownExtra;
|
|
*/
|
|
*/
|
|
class Pico {
|
|
class Pico {
|
|
|
|
|
|
|
|
+ private $columns = array();
|
|
private $plugins;
|
|
private $plugins;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -22,7 +23,11 @@ class Pico {
|
|
// Load plugins
|
|
// Load plugins
|
|
$this->load_plugins();
|
|
$this->load_plugins();
|
|
$this->run_hooks('plugins_loaded');
|
|
$this->run_hooks('plugins_loaded');
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // Load the settings
|
|
|
|
+ $settings = $this->get_config();
|
|
|
|
+ $this->run_hooks('config_loaded', array(&$settings));
|
|
|
|
+
|
|
// Get request url and script url
|
|
// Get request url and script url
|
|
$url = '';
|
|
$url = '';
|
|
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
|
|
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
|
|
@@ -51,10 +56,6 @@ class Pico {
|
|
$this->run_hooks('after_404_load_content', array(&$file, &$content));
|
|
$this->run_hooks('after_404_load_content', array(&$file, &$content));
|
|
}
|
|
}
|
|
$this->run_hooks('after_load_content', array(&$file, &$content));
|
|
$this->run_hooks('after_load_content', array(&$file, &$content));
|
|
-
|
|
|
|
- // Load the settings
|
|
|
|
- $settings = $this->get_config();
|
|
|
|
- $this->run_hooks('config_loaded', array(&$settings));
|
|
|
|
|
|
|
|
$meta = $this->read_file_meta($content);
|
|
$meta = $this->read_file_meta($content);
|
|
$this->run_hooks('file_meta', array(&$meta));
|
|
$this->run_hooks('file_meta', array(&$meta));
|
|
@@ -98,6 +99,9 @@ class Pico {
|
|
'next_page' => $next_page,
|
|
'next_page' => $next_page,
|
|
'is_front_page' => $url ? false : true,
|
|
'is_front_page' => $url ? false : true,
|
|
);
|
|
);
|
|
|
|
+ foreach ($this->columns as $var => $code) {
|
|
|
|
+ $twig_vars["column_{$var}"] = $code;
|
|
|
|
+ }
|
|
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
|
|
$this->run_hooks('before_render', array(&$twig_vars, &$twig));
|
|
$output = $twig->render('index.html', $twig_vars);
|
|
$output = $twig->render('index.html', $twig_vars);
|
|
$this->run_hooks('after_render', array(&$output));
|
|
$this->run_hooks('after_render', array(&$output));
|
|
@@ -133,6 +137,17 @@ class Pico {
|
|
{
|
|
{
|
|
$content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
|
|
$content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
|
|
$content = str_replace('%base_url%', $this->base_url(), $content);
|
|
$content = str_replace('%base_url%', $this->base_url(), $content);
|
|
|
|
+
|
|
|
|
+ // pattern to find {column:xyz} {/column:xyz} column marker
|
|
|
|
+ $pattern = '#({column:(.*?)})(.+?)({/column:\\2})#ims';
|
|
|
|
+ preg_match_all($pattern, $content, $matches);
|
|
|
|
+
|
|
|
|
+ $counter = 0;
|
|
|
|
+ foreach ($matches[2] as $var) {
|
|
|
|
+ $this->columns[$var] = MarkdownExtra::defaultTransform($matches[3][$counter]);
|
|
|
|
+ $counter++;
|
|
|
|
+ }
|
|
|
|
+
|
|
$content = MarkdownExtra::defaultTransform($content);
|
|
$content = MarkdownExtra::defaultTransform($content);
|
|
|
|
|
|
return $content;
|
|
return $content;
|