本文整理汇总了PHP中Modules::load_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::load_file方法的具体用法?PHP Modules::load_file怎么用?PHP Modules::load_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules
的用法示例。
在下文中一共展示了Modules::load_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Loads the library's dependencies and configuration.
*
* @return void
*/
public static function initialize()
{
// get all installed extensions
if (empty(self::$extensions)) {
self::$CI =& get_instance();
self::$extensions = self::$CI->extension->getInstalledExtensions();
}
// Merge events from indivdual modules.
foreach (Modules::list_modules() as $module) {
// Skip if module is not installed
if (!isset(self::$extensions[$module])) {
continue;
}
$path = ROOTPATH . EXTPATH . "{$module}/config/";
if (is_file($path . 'events.php')) {
$module_events = Modules::load_file('events', $path, 'config');
if (is_array($module_events)) {
self::$events = array_merge_recursive(self::$events, $module_events);
}
}
}
if (self::$events === FALSE) {
self::$events = array();
}
}
示例2: load
public function load($langfile, $lang = '', $return = FALSE, $_module = NULL)
{
if (is_array($langfile)) {
return $this->load_many($langfile);
}
$deft_lang = CI::$APP->config->item('language');
$idiom = $lang == '' ? $deft_lang : $lang;
if (in_array($langfile . '_lang', $this->is_loaded, TRUE)) {
return $this->language;
}
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
// Falls back to a default language if the current language file is missing.
if ($path === FALSE && FALLBACK_LANGUAGE) {
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . FALLBACK_LANGUAGE . '/');
}
if ($path === FALSE) {
if ($lang = parent::load($langfile, $lang, $return)) {
return $lang;
}
} else {
if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
if ($return) {
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang';
unset($lang);
}
}
return $this->language;
}
示例3: load
public function load($langfile, $lang = '', $return = FALSE, $_module = NULL)
{
if (is_array($langfile)) {
return $this->load_many($langfile);
}
$deft_lang = CI::$APP->config->item('language');
$idiom = $lang == '' ? $deft_lang : $lang;
if (in_array($langfile . '_lang', $this->is_loaded, TRUE)) {
return $this->language;
}
$_module || ($_module = CI::$APP->router->fetch_module());
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
if ($path === FALSE) {
if ($lang = parent::load($langfile, $lang, $return)) {
return $lang;
}
} else {
if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
if ($return) {
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang';
unset($lang);
}
}
return $this->language;
}
示例4: load
public function load($langfile = array(), $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')
{
if (is_array($langfile)) {
foreach ($langfile as $_lang) {
$this->load($_lang);
}
return $this->language;
}
$deft_lang = CI::$APP->config->item('language');
$idiom = $lang == '' ? $deft_lang : $lang;
if (in_array($langfile . '_lang' . EXT, $this->is_loaded, TRUE)) {
return $this->language;
}
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
if ($path === FALSE) {
if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) {
return $lang;
}
} else {
if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
if ($return) {
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang' . EXT;
unset($lang);
}
}
return $this->language;
}
示例5: control
function control($name, $vars = array(), $flag = '')
{
if (!class_exists('MY_Control')) {
$control = load_class('Control', 'core');
}
$module = CI::$APP->router->fetch_module();
// list($path, $_control) = Modules::find($name.'_control', $module, 'controls/');
$path = APPPATH . 'modules/' . $module . '/controls/' . $name . '_control';
if (file_exists($path . '.php')) {
$_control = $name . '_control';
//$_control = ucfirst($name.'_control');
Modules::load_file($_control, APPPATH . 'modules/' . $module . '/controls/');
$control = new $_control($vars);
$control->set_file($_control);
return $control->render($vars);
} else {
if (empty($vars)) {
include_once APPPATH . 'libraries/Template.php';
$template = new Template();
$content = $template->sreadfile($path . '.htm');
} else {
$control->set_file($path);
$content = $control->render($vars);
}
return $content;
}
}
示例6: load
public function load($file = 'config', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = '')
{
if (in_array($file, $this->is_loaded, TRUE)) {
return $this->item($file);
}
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $file) = Modules::find($file, $_module, 'config/');
if ($path === FALSE) {
parent::load($file, $use_sections, $fail_gracefully);
return $this->item($file);
}
if ($config = Modules::load_file($file, $path, 'config')) {
/* reference to the config array */
$current_config =& $this->config;
if ($use_sections === TRUE) {
if (isset($current_config[$file])) {
$current_config[$file] = array_merge($current_config[$file], $config);
} else {
$current_config[$file] = $config;
}
} else {
$current_config = array_merge($current_config, $config);
}
$this->is_loaded[] = $file;
unset($config);
return $this->item($file);
}
}
示例7: load
public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')
{
// Are we loading an array of languages? If so, handle each one on its own.
if (is_array($langfile)) {
foreach ($langfile as $_lang) {
$this->load($_lang);
}
return $this->language;
}
// --------------------------------------------------------------------------
// Determine which language we're using, if not specified, use the app's default
$_default = CI::$APP->config->item('language');
$idiom = $lang == '' ? $_default : $lang;
// --------------------------------------------------------------------------
// Check to see if the language file has already been loaded
if (in_array($langfile . '_lang' . EXT, $this->is_loaded, TRUE)) {
return $this->language;
}
// --------------------------------------------------------------------------
// Look for the language
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
/**
*
* Confession. I'm not entirely sure how/why this works. Dumping out debug statements confuses
* me as they don't make sense, but the right lang files seem to be laoded. Sorry, future Pablo.
*
**/
if ($path === FALSE) {
// File not found, fallback to the default language if not already using it
if ($idiom != $_default) {
// Using MXs version seems to work as expected.
if ($lang = parent::load($langfile, $_default, $return, $add_suffix, $alt_path)) {
return $lang;
}
} else {
// Not found within modules, try normal load()
if ($lang = CI_Lang::load($langfile, $idiom, $return, $add_suffix, $alt_path)) {
return $lang;
}
}
} else {
// Lang file was found. Load it.
if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
if ($return) {
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang' . EXT;
unset($lang);
}
}
// --------------------------------------------------------------------------
return $this->language;
}
示例8: load
public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') {
if (is_array($langfile)) {
foreach($langfile as $_lang) $this->load($_lang);
return $this->language;
}
$deft_lang = CI::$APP->config->item('language');
$idiom = ($lang == '') ? $deft_lang : $lang;
if (in_array($langfile . '_lang'.EXT, $this->is_loaded, TRUE))
{
return $this->language;
}
$_module OR $_module = CI::$APP->router->fetch_module();
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
// Falls back to a default language if the current language file is missing.
if ($path === FALSE && self::$fall_back)
{
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . self::$fall_back . '/');
}
if ($path === FALSE)
{
if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path))
{
return $lang;
}
}
else
{
if ($lang = Modules::load_file($_langfile, $path, 'lang'))
{
if ($return)
{
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang'.EXT;
unset($lang);
}
}
return $this->language;
}
示例9: helper
/**
* Load a helper contained within a module.
*
* Copied from MX_Loader, modified to check the /bonfire/helpers directory for
* a 'BF_' prefixed helper.
*
* @param string $helper The helper to load.
*
* @return void;
**/
public function helper($helper = array())
{
if (is_array($helper)) {
return $this->helpers($helper);
}
if (isset($this->_ci_helpers[$helper])) {
return;
}
list($path, $_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/');
if ($path === false) {
if (file_exists(BFPATH . "helpers/BF_{$helper}_helper.php")) {
include_once BFPATH . "helpers/BF_{$helper}_helper.php";
}
return parent::helper($helper);
}
Modules::load_file($_helper, $path);
$this->_ci_helpers[$_helper] = TRUE;
}
示例10: loadConfig
public function loadConfig($module, $fail_gracefully = FALSE, $non_persistent = FALSE)
{
if (!is_string($module)) {
return FALSE;
}
// and retrieve the configuration items
if ($non_persistent === TRUE) {
$path = ROOTPATH . EXTPATH . "{$module}/config/";
$config = is_file($path . "{$module}.php") ? Modules::load_file($module, $path, 'config') : NULL;
} else {
$this->CI->config->load($module . '/' . $module, TRUE);
$config = $this->CI->config->item($module);
}
if ($error = $this->checkConfig($module, $config)) {
return $fail_gracefully === FALSE ? $error : show_error($error);
}
return $config;
}
示例11: run
function run($file, $param = null)
{
$args = func_get_args();
$module = '';
/* is module in filename? */
if (($pos = strrpos($file, '/')) !== FALSE) {
$module = substr($file, 0, $pos);
$file = substr($file, $pos + 1);
}
list($path, $file) = Modules::find($file, $module, 'widgets/');
if ($path === FALSE) {
$path = APPPATH . 'widgets/';
}
Modules::load_file($file, $path);
$file = ucfirst($file);
$widget = new $file($param);
return $widget->run();
}
示例12: load
public function load($file = 'config', $use_sections = FALSE, $fail_gracefully = FALSE, $_module = '')
{
//if (in_array($file, $this->is_loaded, TRUE)) return $this->item($file);
//echo "Модуль до определения = $_module<br>";
if ($_module === false) {
$_module = '';
} else {
$_module or $_module = CI::$APP->router->fetch_module();
}
//echo "Модуль после определения = $_module<br>";
list($path, $file) = Modules::find($file, $_module, 'config/');
if ($path === FALSE) {
parent::load($file, $use_sections, $fail_gracefully);
return $this->item($file);
}
//echo "Путь - $path, файл-$file<br>";
// добавлено для корректной работы уже загруженных файлов модулей
$file_path = $path . $file . EXT;
//echo "Данные $file_path:<br>";
//print_r($this->item($file_path));
//if (in_array($file_path, $this->is_loaded, TRUE)) return $this->item($file);
// конец добавления
if ($config = Modules::load_file($file, $path, 'config')) {
/* reference to the config array */
$current_config =& $this->config;
if ($use_sections === TRUE) {
if (isset($current_config[$file])) {
//$current_config[$file] = array_merge($current_config[$file], $config);
$current_config[$file] = $this->array_merge_recursive_distinct($current_config[$file], $config);
} else {
$current_config[$file] = $config;
}
} else {
$current_config = array_merge($current_config, $config);
}
//$this->is_loaded[] = $file;
// исправлено на:
$this->is_loaded[] = $file_path;
unset($config);
return $this->item($file);
}
}
示例13: autoloadModules
/**
* Run ImageCMS modules autoload method for admin-page
* @access private
* @copyright ImageCMS (c) 2013, Kaero <dev@imagecms.net>
*/
private function autoloadModules()
{
/** Search module with autoload */
$query = $this->db->select('name')->where('autoload', 1)->get('components');
if ($query) {
$moduleName = null;
/** Run all Admin autoload method */
foreach ($query->result_array() as $module) {
$moduleName = $module['name'];
Modules::load_file($moduleName, APPPATH . 'modules' . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR);
$moduleName = ucfirst($moduleName);
if (class_exists($moduleName)) {
if (method_exists($moduleName, 'adminAutoload')) {
$moduleName::adminAutoload();
// self::$detect_load_admin[$moduleName] = 1;
}
}
}
}
}
示例14: model
/** Load a module model **/
public function model($model, $object_name = NULL, $connect = FALSE)
{
if (is_array($model)) {
return $this->models($model);
}
$_alias = $object_name or $_alias = basename($model);
if (in_array($_alias, $this->_ci_models, TRUE)) {
return CI::$APP->{$_alias};
}
/* check module */
list($path, $_model) = Modules::find(strtolower($model), $this->_module, 'models/');
//AG_ ***************************
if ($path == FALSE) {
$model_e = explode('/', $model, 2);
if (count($model_e) > 1) {
list($path, $_model) = Modules::find(strtolower($model_e[1]), $model_e[0], 'models/');
}
}
//AG_ ----------------------------
if ($path == FALSE) {
/* check application & packages */
parent::model($model, $object_name);
} else {
class_exists('CI_Model', FALSE) or load_class('Model', 'core');
if ($connect !== FALSE and !class_exists('CI_DB', FALSE)) {
if ($connect === TRUE) {
$connect = '';
}
$this->database($connect, FALSE, TRUE);
}
Modules::load_file($_model, $path);
$model = ucfirst($_model);
if (class_exists(users_class_prefix . $model)) {
$model = users_class_prefix . $model;
}
CI::$APP->{$_alias} = new $model();
$this->_ci_models[] = $_alias;
}
return CI::$APP->{$_alias};
}
示例15: load
public function load($langfile = '', $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')
{
if (is_array($langfile)) {
foreach ($langfile as $_lang) {
$this->load($_lang);
}
return $this->language;
}
if (!class_exists('CI')) {
exit('An error has occured that cannot be reported correctly. Check your database settings.');
}
$deft_lang = CI::$APP->config->item('language');
$idiom = $lang == '' ? $deft_lang : $lang;
if (in_array($langfile . '_lang' . EXT, $this->is_loaded, TRUE)) {
return $this->language;
}
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . $idiom . '/');
// Falls back to a default language if the current language file is missing.
if ($path === FALSE && self::$fall_back) {
list($path, $_langfile) = Modules::find($langfile . '_lang', $_module, 'language/' . self::$fall_back . '/');
}
if ($path === FALSE) {
if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) {
return $lang;
}
} else {
if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
if ($return) {
return $lang;
}
$this->language = array_merge($this->language, $lang);
$this->is_loaded[] = $langfile . '_lang' . EXT;
unset($lang);
}
}
return $this->language;
}