Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added init/ directory handling to client framework.
Browse files Browse the repository at this point in the history
Created factory for retrieving system objects and libraries.
  • Loading branch information
Michael Chisari authored and The Appleseed Project committed Mar 4, 2011
1 parent 3c9343d commit 3360f78
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
14 changes: 14 additions & 0 deletions client/default/init/dojo.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions components/system/controllers/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ private function _ProcessScripts ( ) {

list ( $foundation, $null ) = explode ( '.php', $foundation );

/*
* Load all files in the init/ directory.
*/
foreach ( $clients as $c => $client ) {
$directory = ASD_PATH . 'client/' . $client . '/init/';
if ( !is_dir ( $directory ) ) continue;

$Storage = Wob::_('Storage');

$files = $Storage->Scan ( $directory );

foreach ( $files as $f => $file ) {
$inits[$file] = $client;
}
}

foreach ( $inits as $file => $client ) {
$initPath = 'http://' . ASD_DOMAIN . '/client/' . $client . '/init/'. $file;

$finalPaths[] = $initPath;
}

/*
* Find the most relevant global client js file.
*/
Expand Down
8 changes: 8 additions & 0 deletions hooks/filesystem/filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,13 @@ public function OnFileExists ( $pData = null ) {

return ( $exists );
}

public function OnScanDirectory ( $pData = null ) {
$Directory = $pData['Directory'];

$return = scandir ( $Directory );

return ( $return );
}

}
19 changes: 19 additions & 0 deletions libraries/storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,24 @@ public function Exists ( $pComponent, $pArea, $pDirectory, $pFilename ) {

return ( $return );
}

public function Scan ( $pDirectory ) {
eval ( GLOBALS );

$Data = array();

$Data['Directory'] = $pDirectory;

$files = $zApp->GetSys ( 'Event' )->Trigger ( 'On', 'Scan', 'Directory', $Data );

foreach ( $files as $f => $file ) {
if ( $file == '.' ) continue;
if ( $file == '..' ) continue;

$return[] = $file;
}

return ( $return );
}

}
17 changes: 17 additions & 0 deletions system/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,20 @@ function rmkdir ( $path, $mode = 0777 ) {
}
return @mkdir ( $path, $mode );
}

/*
* Factory class
*
*/
class Wob {

/*
* System Object Retrieval
*/
public static function _ ( $pObject ) {
global $zApp;

return ( $zApp->GetSys ( $pObject) );
}

}

0 comments on commit 3360f78

Please sign in to comment.