/**
  * @brief change the template if there is one available
  * 
  * If a template is found for the current exception then it is set 
  * 
  * @param string $exceptionClass The name of the exception class
  * @param string $plugin The plugin the exception belongs to
  */
 private function __changeTemplate($exceptionClass, $plugin)
 {
     $view = Inflector::underscore(str_replace(array('Exception', $plugin), '', $exceptionClass));
     try {
         $path = InfinitasPlugin::path($plugin) . 'View' . DS . 'Errors' . DS . $view . '.ctp';
         if (is_file($path)) {
             $this->method = '_infinitasError';
             $this->template = sprintf('%s.%s', $plugin, $view);
         }
     } catch (Exception $e) {
     }
     $path = APP . 'View' . DS . 'Errors' . DS . $view . '.ctp';
     if (is_file($path)) {
         $this->method = '_infinitasError';
         $this->template = $view;
     }
 }
示例#2
0
 /**
  * @brief generate the path to a plugins theme dir
  * 
  * If the specific theme is available it will return the path to the 
  * theme, if not it will return the path to where the themes for that plugin 
  * are kept
  * 
  * If no plugin is null, it is assumed that the path for app themes are required
  * 
  * @access public
  * 
  * @param string $plugin the name of the plugin
  * @param string $theme the name of the theme
  * 
  * @return string the path that is requested 
  */
 public static function themePath($plugin = null, $theme = null)
 {
     if (!$plugin) {
         if (!$theme) {
             return APP . 'View' . DS . 'Themed';
         }
         return APP . 'View' . DS . 'Themed' . DS . $theme;
     }
     if (!$theme) {
         return InfinitasPlugin::path($plugin) . 'View' . DS . 'Themed';
     }
     return InfinitasPlugin::path($plugin) . 'View' . DS . 'Themed' . DS . $theme;
 }
 private function __getPlugins()
 {
     $plugins = InfinitasPlugin::listPlugins('loaded');
     natcasesort($plugins);
     foreach ($plugins as &$plugin) {
         $plugin = InfinitasPlugin::path($plugin) . 'webroot' . DS . 'img' . DS;
     }
     $plugins[] = APP . DS . 'webroot' . DS . 'img' . DS;
     return $plugins;
 }