1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
3 * Controller to fetch manifest variables for usage in client side scripts
5 * op5, and the op5 logo are trademarks, servicemarks, registered servicemarks
6 * or registered trademarks of op5 AB.
7 * All other trademarks, servicemarks, registered trademarks, and registered
8 * servicemarks mentioned herein may be the property of their respective owner(s).
9 * The information contained herein is provided AS IS with NO WARRANTY OF ANY
10 * KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR A
14 class Manifest_Controller
extends Ninja_Controller
{
16 * Load a manifest as an ajax request
18 public function ajax( $name ) {
19 $this->auto_render
= false;
20 $manifest = Module_Manifest_Model
::get( $name );
21 return json
::ok( $manifest );
25 * Return a manifest variable as a javascript file, for loading through a script tag
27 public function js( $name ) {
28 if( substr( $name, -3 ) == '.js' ) {
29 $name = substr( $name, 0, -3 );
32 $this->auto_render
= false;
33 $manifest = Module_Manifest_Model
::get( $name );
35 header('Content-Type: text/javascript');
37 print "var $name = " . json_encode( $manifest ) . ";";