Exemplo n.º 1
0
 protected function module_paths($module)
 {
     $component = $this->component;
     $mname = str_replace("Component.{$component}", '', $module);
     $mname = str_replace('.', '/', $mname);
     $component_dir = CMS::component_dir($component);
     if (!$mname) {
         $file = $component_dir . "/{$component}.php";
     } else {
         $file = $component_dir . "/lib{$mname}.php";
     }
     return array($file, preg_replace('{/[^/]+$}', '', $file));
 }
Exemplo n.º 2
0
Arquivo: View.php Projeto: techart/tao
 public function partial_paths($paths = array(), $base_name = '')
 {
     $paths = parent::partial_paths($paths, $base_name);
     if ($this->current_helper instanceof Templates_HelperInterface) {
         $cname = CMS::get_component_name_for($this->current_helper);
         if ($cname) {
             $component_paths = array();
             foreach (array('app/views', 'views') as $v) {
                 $component_paths[] = rtrim(CMS::component_dir($cname, $v), '/');
             }
             $paths = array_merge($component_paths, $paths);
         }
     }
     $paths = array_merge(array(CMS::current_component_dir('app/views'), CMS::current_component_dir('views')), $paths);
     return $paths;
 }
Exemplo n.º 3
0
Arquivo: Lang.php Projeto: techart/tao
 protected function lang_messages_for($file, $lang)
 {
     $dir = CMS::site_dir();
     if (strpos($file, $dir) === 0) {
         $rfile = substr($file, strlen($dir));
     } else {
         return false;
     }
     $files = array();
     if (strpos($rfile, 'tao/') === 0) {
         $rfile = substr($rfile, 4);
         $this->add_lang_file_if_exists($files, CMS::tao_path("lang/{$rfile}/{$lang}.php"));
     }
     $components_dir = $this->components_dir();
     if (strpos($file, $components_dir) === 0) {
         $cfile = substr($file, strlen($components_dir));
         if ($m = Core_Regexps::match_with_results('{^/([^/]+)/(.+)$}', $cfile)) {
             $component = $m[1];
             $cfile = $m[2];
             $this->add_lang_file_if_exists($files, CMS::component_dir($component, "app/lang/{$lang}.php"));
             $this->add_lang_file_if_exists($files, CMS::component_dir($component, "lang/{$lang}.php"));
             $this->add_lang_file_if_exists($files, CMS::component_dir($component, "app/lang/{$cfile}/{$lang}.php"));
             $this->add_lang_file_if_exists($files, CMS::component_dir($component, "lang/{$cfile}/{$lang}.php"));
         }
     }
     $this->add_lang_file_if_exists($files, CMS::app_path("lang/{$lang}.php"));
     $this->add_lang_file_if_exists($files, CMS::app_path("lang/{$rfile}/{$lang}.php"));
     if (count($files) == 0) {
         return false;
     }
     $messages = array();
     foreach ($files as $file) {
         $fm = (include $file);
         if (is_array($fm)) {
             $messages = array_merge($messages, $fm);
         }
     }
     if (count($messages) == 0) {
         return false;
     }
     return $messages;
 }
Exemplo n.º 4
0
 public function dir($path = '')
 {
     return CMS::component_dir($this->name, $path);
 }
Exemplo n.º 5
0
 public function run(WS_Environment $env)
 {
     if (isset($_SERVER['REQUEST_URI']) && ($uri = $_SERVER['REQUEST_URI'])) {
         if (strpos($uri, '/component-static/') === 0) {
             $uri = substr($uri, 18);
             if ($m = Core_regexps::match_with_results('{^([^/]+)/(.+(css|js|gif|jpg|png))/(\\d+)/$}', $uri)) {
                 $component = $m[1];
                 $file = $m[2];
                 $path = CMS::component_dir($component, $file);
                 if (IO_FS::exists($path)) {
                     Core::load('WS.Adapters');
                     $adapter = WS_Adapters::apache();
                     $adapter->process_response(Net_HTTP::Download($path, true));
                     exit;
                 }
             }
         }
     }
     return $this->application->run($env);
 }