本文整理汇总了PHP中OC_Template::appendIfExist方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Template::appendIfExist方法的具体用法?PHP OC_Template::appendIfExist怎么用?PHP OC_Template::appendIfExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Template
的用法示例。
在下文中一共展示了OC_Template::appendIfExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchPage
/**
* @brief Proceeds the template
* @returns content
*
* This function proceeds the template. If $this->renderas is set, it
* will produce a full page.
*/
public function fetchPage()
{
$data = $this->_fetch();
if ($this->renderas) {
// Decide which page we show
if ($this->renderas == "user") {
$page = new OC_Template("core", "layout.user");
$page->assign('searchurl', OC_Helper::linkTo('search', 'index.php'));
if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
$page->assign('bodyid', 'body-settings');
} else {
$page->assign('bodyid', 'body-user');
}
// Add navigation entry
$navigation = OC_App::getNavigation();
$page->assign("navigation", $navigation);
$page->assign("settingsnavigation", OC_App::getSettingsNavigation());
foreach ($navigation as $entry) {
if ($entry['active']) {
$page->assign('application', $entry['name']);
break;
}
}
} else {
$page = new OC_Template("core", "layout.guest");
}
// Read the selected theme from the config file
$theme = OC_Config::getValue("theme");
// Read the detected formfactor and use the right file name.
$fext = $this->getFormFactorExtension();
// Add the core js files or the js files provided by the selected theme
foreach (OC_Util::$scripts as $script) {
// Is it in 3rd party?
if ($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script . '.js')) {
// Is it in apps and overwritten by the theme?
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}.js")) {
// Is it part of an app?
} elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}.js")) {
// Is it in the owncloud root but overwritten by the theme?
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}.js")) {
// Is it in the owncloud root ?
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}.js")) {
// Is in core but overwritten by a theme?
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}.js")) {
// Is it in core?
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}{$fext}.js")) {
} elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}.js")) {
} else {
echo 'js file not found: script:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
die;
}
}
// Add the css files
foreach (OC_Util::$styles as $style) {
// is it in 3rdparty?
if ($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style . '.css')) {
// or in apps?
} elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}.css")) {
// or in the owncloud root?
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}.css")) {
// or in core ?
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}.css")) {
} else {
echo 'css file not found: style:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
die;
}
}
// Add the theme css files. you can override the default values here
if (!empty($theme)) {
foreach (OC_Util::$styles as $style) {
if ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}{$fext}.css")) {
} elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}.css")) {
}
}
}
// Add custom headers
$page->assign('headers', $this->headers);
foreach (OC_Util::$headers as $header) {
$page->append('headers', $header);
}
// Add css files and js files
//.........这里部分代码省略.........