Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Text response type

givanz9ed440e14d06
diff --git a/system/core/response.php b/system/core/response.php
index ead8eaf..96b0709 100755
--- a/system/core/response.php
+++ b/system/core/response.php
@@ -29,7 +29,7 @@ class Response {
private $type = ''; //html, json, xml
- private $typeHeaders = ['html' => 'text/html', 'xml' => 'text/xml', 'json' => 'application/json'];
+ private $typeHeaders = ['html' => 'text/html', 'xml' => 'text/xml', 'text' => 'text/plain', 'json' => 'application/json'];
protected static $instance;
diff --git a/system/core/view.php b/system/core/view.php
index d805aad..23799c3 100755
--- a/system/core/view.php
+++ b/system/core/view.php
@@ -167,7 +167,7 @@ class View {
if (! $this->template) {
return false;
}
-
+
$this->template = str_replace(['/', '\\'], DS, $this->template);
$templatePath = $this->templatePath;
$template = $this->template;
@@ -344,6 +344,14 @@ class View {
$this->_type = 'json';
}*/
+ if ($this->_type == 'text') {
+ if (isset($this->text)) {
+ echo $this->text;
+ }
+
+ return;
+ }
+
if ($this->_type == 'json') {
$jsonFlags = 0;
@@ -351,7 +359,11 @@ class View {
$jsonFlags = JSON_PRETTY_PRINT;
//}
ob_start();
- echo json_encode($this, $jsonFlags);
+ if (isset($this->json)) {
+ echo json_encode($this->json, $jsonFlags);
+ } else {
+ echo json_encode($this, $jsonFlags);
+ }
return ob_end_flush();
} else { //html