_badFiles = array(); $this->_check($moduleDir); //pre $filterChain->execute($controller, $request, $user); //post if(0 < count($this->_badFiles)){ $style = ' text-align: center; vertical-align: middle; background-color: #FF3366; color: White; padding: 5px; '; echo '
以下のmojaviファイルエラーが見つかりました
'; print_a($this->_badFiles); } //post } else { // filter has already been loaded $filterChain->execute($controller, $request, $user); } } function _addBadFile($path, $error){ $this->_badFiles[] = array( 'path' => $path, 'error' => $error ); } function _check($path){ $files = File_Find::mapTreeMultiple($path, 5); foreach ($files as $key => $value){ if(is_array($value)){ $this->_check($path . '/' . $key); }else{ $currentDir = basename($path); //filter php files only if(eregi("\.php$", $value) && eregi("(actions|forms|views)", $currentDir)){ $className = ''; // actions -> Action | forms -> Form | views -> View | and so forth $suffix = ucfirst(substr($currentDir, 0, strlen($currentDir) - 1)); if($currentDir == 'views'){ if(!eregi($suffix . "_[a-z]*\.class\.php$", $value)){ $this->_addBadFile($path . '/' . $value, 'ファイル名不正'); } $splitted = split("_", $value); $className = $splitted[0]; }else{ if(!eregi($suffix . "\.class\.php$", $value)){ $this->_addBadFile($path . '/' . $value, 'ファイル名不正'); } $splitted = split("\.", $value); $className = $splitted[0]; } if(!ereg("class *$className", file_get_contents($path . '/' . $value))){ $this->_addBadFile($path . '/' . $value, 'クラス名不正'); } } } } } } ?>