Setting headers and shit
This commit is contained in:
parent
0fdf2149be
commit
e299d268c8
2 changed files with 22 additions and 18 deletions
|
@ -87,7 +87,7 @@ class Display extends Object
|
|||
|
||||
$loaded = false;
|
||||
|
||||
if ($return_template)
|
||||
if ($return_template && $this->module->templates)
|
||||
{
|
||||
// Determines if we're using a custom class or not
|
||||
$dynamic_class = (class_exists('CustomDynamic') ? 'CustomDynamic' : 'Dynamic');
|
||||
|
@ -127,6 +127,10 @@ class Display extends Object
|
|||
}
|
||||
}
|
||||
|
||||
if (!$loaded)
|
||||
{
|
||||
if (!$return_template || !$this->module->templates)
|
||||
{
|
||||
$meta = [
|
||||
'status' => $this->module->status,
|
||||
'message' => $this->module->message,
|
||||
|
@ -136,16 +140,17 @@ class Display extends Object
|
|||
'meta' => $meta,
|
||||
'response' => $this->module->response,
|
||||
];
|
||||
}
|
||||
|
||||
if (!$loaded)
|
||||
{
|
||||
if ($return_json)
|
||||
{
|
||||
header('Content-type: application/json');
|
||||
$pretty = isset($_REQUEST['pretty']) ? JSON_PRETTY_PRINT : false;
|
||||
echo json_encode($response, $pretty);
|
||||
}
|
||||
elseif ($return_xml)
|
||||
{
|
||||
header('Content-type: text/xml');
|
||||
echo Convert::arrayToXML($response, isset($_REQUEST['pretty']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* be JSON encoded. In the future this may need to be changed out for logic
|
||||
* that allows the requested module to specify what display type(s) it can use.
|
||||
*/
|
||||
class Module extends Object
|
||||
abstract class Module extends Object
|
||||
{
|
||||
/**
|
||||
* Page Title
|
||||
|
@ -181,13 +181,12 @@ class Module extends Object
|
|||
/**
|
||||
* Default "Magic" Method
|
||||
*
|
||||
* This function is overloaded by the module. The __default() method is
|
||||
* where you want to place any code that needs to be executed at runtime.
|
||||
* The __default() method is where you want to place any code that needs to
|
||||
* be executed at runtime.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
public function __default()
|
||||
{
|
||||
|
||||
}
|
||||
abstract public function __default();
|
||||
|
||||
/**
|
||||
* Magic Setter Method
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue