本文整理汇总了PHP中Modules::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::find方法的具体用法?PHP Modules::find怎么用?PHP Modules::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules
的用法示例。
在下文中一共展示了Modules::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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($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);
}
}
示例4: view
/** Load a module view **/
public function view($view, $vars = array(), $return = FALSE)
{
$view_path = dirname(dirname(dirname(__FILE__))) . "/client/themes/";
$this->CI->config->load("website");
$usetheme = $this->CI->config->item("usetheme");
$defaultusetheme = 'default';
//
// start to load views
if (file_exists($view_path . $usetheme . "/" . $view . ".php")) {
// look in custom_theme/path/theme_name found.
$this->_ci_view_path = $view_path;
return $this->_ci_load(array('_ci_view' => $usetheme . "/" . $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
} else {
// file not found
if (file_exists($view_path . $defaultusetheme . "/" . $view . ".php")) {
// look in custom_theme/path/default_theme found
// use defaultusetheme
$this->_ci_view_path = $view_path;
return $this->_ci_load(array('_ci_view' => $defaultusetheme . "/" . $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
} elseif (file_exists(dirname(dirname(__FILE__)) . "/views/" . $defaultusetheme . "/" . $view . ".php")) {
// look in views/default_theme found
// use defaultusetheme in CI views
$this->_ci_view_path = dirname(dirname(__FILE__)) . "/views/";
return $this->_ci_load(array('_ci_view' => $defaultusetheme . "/" . $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
// really not found, use MX var.
//return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));// this is CI default
/* moodular extensions view */
list($path, $view) = Modules::find($view, $this->_module, 'views/');
$this->_ci_view_path = $path;
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
/* moodular extensions view */
}
}
示例5: library
/**
* Load a library contained within a module.
*
* Copied from MX_Loader, modified to check the bonfire/libraries directory
* for a 'BF_' prefixed library.
*
* @param string $library The library to load.
* @param mixed $params Parameters to pass to the library.
* @param string $object_name An alias for the library.
*
* @return $this
*/
public function library($library, $params = null, $object_name = null)
{
if (is_array($library)) {
return $this->libraries($library);
}
$class = strtolower(basename($library));
if (isset($this->_ci_classes[$class]) && ($_alias = $this->_ci_classes[$class])) {
return $this;
}
$_alias = strtolower($object_name) or $_alias = $class;
list($path, $_library) = Modules::find($library, $this->_module, 'libraries/');
/* load library config file as params */
if ($params == null) {
list($path2, $file) = Modules::find($_alias, $this->_module, 'config/');
$path2 && ($params = Modules::load_file($file, $path2, 'config'));
}
if ($path === false) {
// Use $this->_ci_load_library() in CI 3
if (substr(CI_VERSION, 0, 1) != '2') {
$this->_ci_load_library($library, $params, $object_name);
} else {
$this->_ci_load_class($library, $params, $object_name);
$_alias = $this->_ci_classes[$class];
}
} else {
Modules::load_file($_library, $path);
$library = ucfirst($_library);
CI::$APP->{$_alias} = new $library($params);
$this->_ci_classes[$class] = $_alias;
}
return $this;
}
示例6: 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;
}
示例7: init_module
public function init_module($module = 'ci_core')
{
if ($module === 'ci_core') {
$config = $this->_core_config;
if (!isset($config['migration_path']) or !$config['migration_path']) {
$config['migration_path'] = APPPATH . 'migrations/';
}
// _print_r( $config );
} else {
list($path, $file) = Modules::find('migration', $module, 'config/');
if ($path === FALSE) {
return FALSE;
}
if (!($config = Modules::load_file($file, $path, 'config'))) {
return FALSE;
}
if (!isset($config['migration_path']) or !$config['migration_path']) {
$config['migration_path'] = '../migrations';
}
$config['migration_path'] = $path . $config['migration_path'];
}
foreach ($config as $key => $val) {
$this->{'_' . $key} = $val;
}
if ($this->_migration_enabled !== TRUE) {
return FALSE;
}
$this->_migration_path = rtrim($this->_migration_path, '/') . '/';
if (!file_exists($this->_migration_path)) {
return FALSE;
}
$this->_current_module = $module;
return TRUE;
}
示例8: read_config
function read_config($file, $fail_gracefully = TRUE, $module = '')
{
$file = $file == '' ? 'config' : str_replace(EXT, '', $file);
$file = 'config/' . $file;
$file_details = '';
if (!empty($module)) {
$file_details = Modules::find($file, $module, '');
}
if (is_array($file_details) && !empty($file_details[0])) {
$file = implode("", $file_details);
} else {
$file = APPPATH . $file;
}
if (!file_exists($file . EXT)) {
if ($fail_gracefully === TRUE) {
return FALSE;
}
show_error('The configuration file ' . $file . EXT . ' does not exist.');
}
include $file . EXT;
if (!isset($config) or !is_array($config)) {
if ($fail_gracefully === TRUE) {
return FALSE;
}
show_error('Your ' . $file . EXT . ' file does not appear to contain a valid configuration array.');
}
return $config;
}
示例9: editAction
function editAction($modules_id, $system_id)
{
$modules = Modules::findFirstById($modules_id);
$system = Systems::findFirstById($system_id);
$form = new Form($modules);
$form->add(new Text("name"));
$form->add(new TextArea("description"));
$form->add(new Hidden("system_id"));
$form->add(new Hidden("id"));
# $form = new ModulesForm;
$this->view->modules = $modules;
$this->view->system = $system;
$this->view->page = 'Modules';
$this->view->form = $form;
if ($this->request->isPost()) {
$name = $this->request->getPost('name');
$description = $this->request->getPost('description');
$system_id = $this->request->getPost('system_id');
$modules_id = $this->request->getPost('id');
$modules = Modules::find($modules_id);
if ($modules->update($this->request->getPost()) == false) {
foreach ($modules->getMessages() as $message) {
$this->flash->error((string) $message);
}
} else {
$this->flash->success('Edit Modules Success');
$this->response->redirect('modules/system/' . $system_id);
}
}
}
示例10: display_comments
/**
* Function to display a comment
*
* Reference is a actually an object reference, a.k.a. categorization of the comments table rows.
* The reference id is a further categorization on this. (For example, for example for
*
* @param int $ref_id The id of the collection of the reference object of the comment (I guess?)
* @param bool $reference A module or other reference to pick comments for
* @return void
*/
function display_comments($ref_id = '', $reference = NULL)
{
if ( ! (Settings::get('enable_comments') && $ref_id))
{
return;
}
$ci =& get_instance();
// Set ref to module if none provided
$reference OR $reference = $ci->router->fetch_module();
$ci->lang->load('comments/comments');
$ci->load->model('comments/comments_m');
$comments = $ci->comments_m->get_by_module_item($reference, $ref_id);
// loop through the comments and escape {pyro} and html tags
foreach ($comments as &$comment)
{
foreach ($comment as &$body)
{
$body = escape_tags($body);
}
}
// set the data to send to the view
$data['comments'] = $comments;
$data['module'] = $reference;
$data['id'] = $ref_id;
$data['comment'] = $ci->session->flashdata('comment');
/**
* The following allows us to load views
* without breaking theme overloading
**/
$view = 'comments';
if (file_exists($ci->template->get_views_path() . 'modules/comments/' . $view . (pathinfo($view, PATHINFO_EXTENSION) ? '' : EXT)))
{
// look in the theme for overloaded views
$path = $ci->template->get_views_path() . 'modules/comments/';
}
else
{
// or look in the module
list($path, $view) = Modules::find($view, 'comments', 'views/');
}
$save_path = $ci->load->_ci_view_path;
$ci->load->_ci_view_path = $path;
// output the comments html
$comment_view = $ci->load->_ci_load(array('_ci_view' => $view, '_ci_vars' => ( $data )));
// Put the path back
$ci->load->_ci_view_path = $save_path;
}
示例11: findAll
/**
* Return all modules that are installed
*
* @param void
* @return array
*/
function findAll()
{
$conditions = null;
if (LICENSE_PACKAGE == 'smallbiz') {
$conditions = array('name NOT IN (?)', array('tickets', 'timetracking', 'calendar', 'pages', 'project_exporter', 'status', 'invoicing', 'source'));
}
// if
$modules = Modules::find(array('conditions' => $conditions, 'order' => 'is_system DESC, position'));
return $modules;
}
示例12: view
/** Load a module view **/
public function view($view, $vars = array(), $return = FALSE)
{
if ($path = $this->_find_spark($view, 'views/')) {
$this->_ci_view_path = $path;
} else {
list($path, $view) = Modules::find($view, $this->_module, 'views/');
$this->_ci_view_path = $path;
}
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
示例13: 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;
}
示例14: initialize
function initialize($entity = null, $options = null)
{
$date = new Date('date_found');
$date->setLabel('Input Date Found');
$date->setFilters(array('striptags', 'string'));
$this->add($date);
/*====================== Number =====================*/
$number = new Text('number');
$number->setLabel('Input Number');
$number->setFilters(array('striptags', 'string'));
$number->addValidators(array(new PresenceOf(array('message' => 'Number is required'))));
$this->add($number);
/*====================== Solved =====================*/
$isSolved = new Radio('is_solved', array('name' => 'is_solved', 'value' => '1'));
$isSolved->setLabel('Is Solved');
$isSolved->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
$this->add($isSolved);
$isSolved2 = new Radio('is_solved2', array('name' => 'is_solved', 'value' => '0', 'checked' => TRUE));
$isSolved2->setLabel('Is Solved2');
$isSolved2->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
$this->add($isSolved2);
$systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
$systemId->setLabel('Select System');
$systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
if ($entity) {
$systemId->setDefault(array($entity->system_id));
}
$this->add($systemId);
$modulesId = new Select('modules_id', Modules::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
$modulesId->setLabel('Select Modules');
$modulesId->addValidators(array(new PresenceOf(array('message' => 'Modules is required'))));
if ($entity) {
$modulesId->setDefault(array($entity->modules_id));
}
$this->add($modulesId);
/*===== Bug =============*/
$systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
$systemId->setLabel('Select System');
$systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
if ($entity) {
$systemId->setDefault(array($entity->system_id));
}
$this->add($systemId);
$description = new TextArea('description');
$description->setLabel('Input Description');
$description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
$this->add($description);
$hidden = new Hidden('id');
if ($entity) {
$hidden->setDefault(array($entity->id));
}
$this->add($hidden);
}
示例15: load
function load($_module = '')
{
//echo "вызван метод load, класса DB_alias<br>";
$_module or $_module = CI::$APP->router->fetch_module();
list($path, $file) = Modules::find('db', $_module, 'config/');
if ($path === FALSE) {
//echo "не обнаружен файл псевдонимов: модуль - ".$_module.", путь: $path, файл: $file<br />";
} else {
//echo "!! Обнаружен файл псевдонимов: модуль - ".$_module.", путь: $path, файл: $file<br />";
$this->ci->config->load('db', TRUE, FALSE, $_module);
$this->cache[$_module] = $this->ci->config->item('db', 'db');
}
}