Merge branch 'maint/7.0'
[ninja.git] / application / models / module_manifest.php
blob136784868dbbff81f99aa00fff2b55439623bdd8
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
3 /**
4 * Handle manifest files from modules
5 */
6 class Module_Manifest_Model {
7 private static $manifests = array();
9 /**
10 * Load manifest files from modules manifest directories
12 private static function load_manifest( $name ) {
13 $manifest = array();
14 if(!preg_match('/^[a-z_]+$/',$name)) {
15 return array();
17 $files = glob(MODPATH . '*/manifest/'.$name.'.php' );
18 foreach( $files as $file ) {
19 require( $file );
21 return $manifest;
24 /**
25 * Load manifest parameters from modules
27 public static function get( $name ) {
28 if( !isset( self::$manifests[$name] ) ) {
29 self::$manifests[$name] = self::load_manifest( $name );
31 return self::$manifests[$name];