本文整理汇总了PHP中Container::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::append方法的具体用法?PHP Container::append怎么用?PHP Container::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadLanguageSettings
/**
* Load language settings
*
* @access public
* @param void
* @throws DirDnxError If language dir does not exists
* @throws FileDnxError If language settings file for this local settings
* does not exists in lanuage dir
*/
private function loadLanguageSettings()
{
// Check dir...
if (!is_dir($this->getLanguageDirPath())) {
throw new DirDnxError($this->getLanguageDirPath());
}
// if
// Get settings file path and include it
$settings_file = $this->getLanguageDirPath() . '/' . $this->getLocale() . '.php';
if (is_file($settings_file)) {
include $settings_file;
} else {
throw new FileDnxError($settings_file, "Failed to find language settings file. Expected location: '{$settings_file}'.");
}
// if
// Clear langs
$this->langs->clear();
// Get langs dir
$langs_dir = $this->getLanguageDirPath() . '/' . $this->getLocale();
if (is_dir($langs_dir)) {
$files = get_files($langs_dir, 'php');
// Loop through files and add langs
if (is_array($files)) {
sort($files);
foreach ($files as $file) {
$langs = (include $file);
if (is_array($langs)) {
$this->langs->append($langs);
}
}
// foreach
}
// if
//Load plugin langs after fengoffice default langs
$plugins_dir = $langs_dir . '/plugins';
if (is_dir($plugins_dir)) {
sort($files);
$files = get_files($plugins_dir, 'php');
// Loop through files and add langs
if (is_array($files)) {
foreach ($files as $file) {
$langs = (include $file);
if (is_array($langs)) {
$this->langs->append($langs);
}
}
// foreach
}
// if
}
// if
} else {
throw new DirDnxError($langs_dir);
}
// if
// Done!
return true;
}
示例2: loadLanguageFiles
/**
* loadLanguageFiles
*
* @access private
* @param String $dir Select files from this dir
* @param String $ext Select files with given extension
* @return string
*/
private function loadLanguageFiles($dir, $ext = 'php') {
trace(__FILE__,"loadLanguageFiles($dir, $ext):begin");
$files = get_files($dir, $ext);
// Loop through files and add langs
if (is_array($files)) {
foreach ($files as $file) {
//try {
$langs = include_once $file;
//} catch (Exception $e) {}
if (is_array($langs)) {
$this->langs->append($langs);
} // if
} // foreach
} // if
}
示例3: loadLanguageSettings
/**
* Load language settings
*
* @access public
* @param void
* @throws DirDnxError If language dir does not exists
* @throws FileDnxError If language settings file for this local settings
* does not exists in lanuage dir
*/
private function loadLanguageSettings()
{
// Check dir...
if (!is_dir($this->getLanguageDirPath())) {
throw new DirDnxError($this->getLanguageDirPath());
}
// if
// Get settings file path and include it
$settings_file = $this->getLanguageDirPath() . '/' . $this->getLocale() . '.php';
if (is_file($settings_file)) {
include $settings_file;
} else {
$base_settings = $this->getLanguageDirPath() . '/default.php';
if (is_file($base_settings)) {
include $base_settings;
} else {
throw new FileDnxError($settings_file, "Failed to find language settings file. Expected location: '{$settings_file}'.");
}
}
// Clear langs
$this->langs->clear();
// Get langs dir - ONLY PHP langs !
$langs_dir = $this->getLanguageDirPath() . '/' . $this->getLocale();
if (is_dir($langs_dir)) {
$files = get_files($langs_dir, 'php');
// Loop through files and add langs
if (is_array($files)) {
sort($files);
foreach ($files as $file) {
$langs = (include $file);
if (is_array($langs)) {
$this->langs->append($langs);
}
}
}
// Plugins - Only PHP langs - include all installed plugins, no matter if they they have not been activated
$plugins = Plugins::instance()->getAll();
foreach ($plugins as $plugin) {
/* @var $plugin Plugin */
$plg_dir = $plugin->getLanguagePath() . "/" . $this->getLocale();
if (is_dir($plg_dir)) {
$files = get_files($plg_dir, 'php');
// Loop through files and add langs
if (is_array($files)) {
sort($files);
foreach ($files as $file) {
$langs = (include $file);
if (is_array($langs)) {
$this->langs->append($langs);
}
}
}
}
}
} else {
throw new DirDnxError($langs_dir);
}
// if
// Done!
return true;
}