本文整理汇总了PHP中CMS::component_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::component_dir方法的具体用法?PHP CMS::component_dir怎么用?PHP CMS::component_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::component_dir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_paths
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));
}
示例2: partial_paths
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;
}
示例3: lang_messages_for
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;
}
示例4: dir
public function dir($path = '')
{
return CMS::component_dir($this->name, $path);
}
示例5: run
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);
}