本文整理汇总了PHP中CBLib\Language\CBTxt::import方法的典型用法代码示例。如果您正苦于以下问题:PHP CBTxt::import方法的具体用法?PHP CBTxt::import怎么用?PHP CBTxt::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBLib\Language\CBTxt
的用法示例。
在下文中一共展示了CBTxt::import方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadPluginFile
/**
* loads a plugins main php file
*
* @param PluginTable $plugin
* @return bool
*/
public function _loadPluginFile($plugin)
{
/** @noinspection PhpUnusedLocalVariableInspection */
global $_CB_framework, $_PLUGINS;
// $_PLUGINS is needed for the include below.
// We don't want language files PHP loading as we do that through cbimport:
if ($plugin->type == 'language') {
return false;
}
$path = $_CB_framework->getCfg('absolute_path') . '/' . $this->getPluginRelPath($plugin) . '/' . $plugin->element . '.php';
if (file_exists($path) && is_readable($path)) {
$savePreviousPluginId = $this->_setLoading($plugin, true);
$langCache = CBTxt::setLanguage(null);
$plgLangPath = $_CB_framework->getCfg('absolute_path') . '/' . $this->getPluginRelPath($plugin) . '/language';
$langPath = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/language';
$lang = $_CB_framework->getCfg('lang_tag');
if ($_CB_framework->getUi() == 2) {
$langLoaded = CBTxt::import($langPath, $lang, '/cbplugin/' . $plugin->element . '-admin_language.php', false);
if (!$langLoaded) {
CBTxt::import($plgLangPath, $lang, 'admin_language.php');
}
}
$langLoaded = CBTxt::import($langPath, $lang, 'cbplugin/' . $plugin->element . '-language.php', false);
if (!$langLoaded) {
CBTxt::import($plgLangPath, $lang, 'language.php');
}
// We don't want plugins language files to alter the current language loaded so lets reset it:
CBTxt::setLanguage($langCache);
/** @noinspection PhpIncludeInspection */
require_once $path;
$this->_setLoading($plugin, $savePreviousPluginId);
return true;
} else {
return false;
}
}
示例2: cbimport
/**
* Includes CB library
* --- usage: cbimport('cb.xml.simplexml');
*
* @param string $lib
* @return void
*/
function cbimport($lib)
{
global $_CB_framework;
static $imported = array();
static $tmpClasses = array('cb.html', 'cb.tabs', 'cb.field', 'cb.calendar', 'cb.connection', 'cb.notification');
if (!isset($imported[$lib])) {
$liblow = strtolower($lib);
$pathAr = explode('.', $liblow);
if ($pathAr[0] == 'language') {
$langPath = $_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/language';
$langTag = $_CB_framework->getCfg('lang_tag');
if (!isset($imported['language.front'])) {
$imported['language.front'] = true;
CBTxt::import($langPath, $langTag, 'language.php');
}
if ($pathAr[1] == 'all' && !isset($imported['language.admin'])) {
$imported['language.admin'] = true;
CBTxt::import($langPath, $langTag, 'admin_language.php');
}
} elseif ($lib == 'cb.plugins') {
// this part is temporary until we refactor those 2 files into the corresponding CB libraries:
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.class.php';
} elseif (in_array($lib, $tmpClasses)) {
// We need to make absolute sure we have our translations before we load our plugins and classes:
if ($_CB_framework->getUi() == 1) {
$loadLang = 'language.front';
} else {
$loadLang = 'language.all';
}
if (!isset($imported[$loadLang])) {
cbimport($loadLang);
}
// this part is temporary until we refactor those 2 files into the corresponding CB libraries:
if (!isset($imported['cb.plugins'])) {
$imported['cb.plugins'] = true;
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.class.php';
}
if (!isset($imported['class'])) {
$imported['class'] = true;
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/comprofiler.class.php';
new LegacyComprofilerFunctions();
}
} elseif ($lib == 'cb.imgtoolbox') {
// this part is temporary until we refactor those 2 files into the corresponding CB libraries:
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/imgToolbox.class.php';
} elseif ($lib == 'cb.snoopy') {
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/Snoopy.class.php';
} else {
array_pop($pathAr);
$filepath = implode('/', $pathAr) . (count($pathAr) ? '/' : '') . $liblow . '.php';
/** @noinspection PhpIncludeInspection */
require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_comprofiler/library/' . $filepath;
}
$imported[$lib] = true;
}
}