Browse Source

dev 2021-01

Max F 4 years ago
parent
commit
d374846c05
2 changed files with 21 additions and 1 deletions
  1. 17 0
      src/Database/Sql/WhereQuery.php
  2. 4 1
      src/Templates/LightweightTemplate.php

+ 17 - 0
src/Database/Sql/WhereQuery.php

@@ -46,6 +46,23 @@ class WhereQuery
 		return $this;
 	}
 
+	public function options($options)
+	{
+		$this->options += $options;
+		$this->options = $this->options;
+
+		return $this;
+	}
+
+	public function getOptions()
+	{
+		return $this->options;
+	}
+
+	public function setOptions($options=[])
+	{
+		$this->options = $options;
+	}
 
 
 	public function select($select)

+ 4 - 1
src/Templates/LightweightTemplate.php

@@ -310,7 +310,10 @@ class LightweightTemplate {
 		foreach ($matches as $value) {
 			
 			$replaced = '<' . '?php elseif ( $1 ) : ?' . '>';
-			$value[2] = preg_replace('/{elseif (.*?) ?}/', $replaced, $value[2]);
+			$value[2] = preg_replace('/\{ ?elseif (.*?) ?\}/', $replaced, $value[2]);
+
+			$replaced = '<' . '?php else : ?' . '>';
+			$value[2] = preg_replace('/\{ ?else ?\}/', $replaced, $value[2]);
 
 			$replaced = PHP_EOL . '<' . '?php if (' . $value[1] . ') : ?' . '>' . PHP_EOL . $value[2] . PHP_EOL . '<' . '?php endif; ?' . '>';
 			$code = str_replace($value[0], $replaced, $code);