Example #1
0
 /**
  * @static
  * @access   private
  * @param    string $sConfigPath
  * @param    string $sFormat
  * @return   bool|Config\ConfigFileData
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 private static function findConfigFile($sConfigPath, $sFormat = 'php')
 {
     // firstly, check if particular config file is in application directory
     $sPathToAppConfig = PATH_APP . 'config' . DS . str_replace('.', DS, $sConfigPath) . '.' . $sFormat;
     if (file_exists($sPathToAppConfig)) {
         return new Config\ConfigFileData($sPathToAppConfig);
     } else {
         $aExploded = explode('.', $sConfigPath);
         $sModule = array_shift($aExploded);
         $sConfigPath = implode(DS, $aExploded);
         try {
             $sPathToModuleConfig = PATH_MODULES . Router::getModuleGroup($sModule) . DS . $sModule . DS . 'config' . DS . $sConfigPath . '.' . $sFormat;
             if (file_exists($sPathToModuleConfig)) {
                 return new Config\ConfigFileData($sPathToModuleConfig, $sModule);
             }
         } catch (Exception\Fatal $e) {
         }
     }
     return FALSE;
 }
Example #2
0
 /**
  * Getting view path based on parameter
  *
  * @static
  * @access   private
  * @param    string $sToRender Contains information about particular view destination (pattern:
  *                             viewPath.viewExtension)
  * @return   string
  * @throws   ViewException
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 private static function readViewPath($sToRender)
 {
     if (strpos($sToRender, '::') === FALSE) {
         $sViewPath = $sToRender;
         $sExt = 'php';
     } else {
         $aExploded = explode('::', $sToRender);
         $sViewPath = $aExploded[0];
         $sExt = $aExploded[1];
         unset($aExploded);
     }
     if (file_exists($sGlobalPath = PATH_G_VIEWS . $sViewPath . '.' . $sExt)) {
         return $sGlobalPath;
     } else {
         if (strpos($sViewPath, '/') !== FALSE) {
             $aExploded = explode('/', $sToRender);
             $sModule = $aExploded[0];
             unset($aExploded[0]);
             $sPathRest = implode('/', $aExploded);
             unset($aExploded);
             $sPath = PATH_MODULES . Router::getModuleGroup($sModule) . DS . $sModule . DS . 'views' . DS . $sPathRest . '.' . $sExt;
             if (file_exists($sPath)) {
                 return $sPath;
             }
         }
     }
     throw new ViewException('View with path "' . $sToRender . '" does not exist!');
 }