本文整理汇总了PHP中Modules::locations方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::locations方法的具体用法?PHP Modules::locations怎么用?PHP Modules::locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules
的用法示例。
在下文中一共展示了Modules::locations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setModulesLocations
/**
* Adding dirs that may contain modules
*/
private function setModulesLocations()
{
if (FALSE !== ($modulesLocations = \CI::$APP->config->item('modules_locations'))) {
$locationsToSet = array();
for ($i = 0; $i < count($modulesLocations); $i++) {
$withinPath = trim($modulesLocations[$i], '/') . '/';
$locationsToSet[APPPATH . $withinPath] = "../{$withinPath}";
}
\Modules::$locations = $locationsToSet;
}
}
示例2: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
defined('EXT') or define('EXT', '.php');
global $CFG;
/* get module locations from config settings or use the default module location and offset */
is_array(Modules::$locations = $CFG->item('modules_locations')) or Modules::$locations = array(APPPATH . 'modules/' => '../modules/');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Modular Extensions - HMVC
*
* Adapted from the CodeIgniter Core Classes
* @link http://codeigniter.com
*
* Description:
* This library provides functions to load and instantiate controllers
* and module controllers allowing use of modules and the HMVC design pattern.
*
* Install this file as app/third_party/MX/Modules.php
*
* @copyright Copyright (c) 2015 Wiredesignz
* @version 5.5
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
示例3: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/* define the module locations and offset */
Modules::$locations = array(APPPATH . 'modules/' => '../modules/', 'third_party/modules/' => '../../third_party/modules/');
/**
* Modular Separation - PHP5
*
* Adapted from the CodeIgniter Core Classes
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @link http://codeigniter.com
*
* Description:
* This library extends the CodeIgniter router class.
*
* Install this file as application/libraries/MY_Router.php
*
* @copyright Copyright (c) Wiredesignz 2010-03-01
* @version 1.11
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例4: exit
<?php
defined('BASEPATH') || exit('No direct script access allowed');
global $CFG;
/* Get module locations from config settings, or use the default module location
* and offset
*/
is_array(Modules::$locations = $CFG->item('modules_locations')) || (Modules::$locations = array(realpath(APPPATH) . '/modules/' => '../../application/modules/', realpath(BFPATH) . '/modules/' => '../../bonfire/modules/'));
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Bonfire
*
* An open source project to allow developers to jumpstart their development of
* CodeIgniter applications.
*
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2015, Bonfire Dev Team
* @license http://opensource.org/licenses/MIT The MIT License
* @link http://cibonfire.com
* @since Version 1.0
* @filesource
*/
/**
* Modules class for Bonfire.
*
* Adapted from Wiredesignz Modular Extensions - HMVC.
* @link https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc
*
* Provides utility functions for working with modules, as well as an autoloader
示例5: update_module_locations
private function update_module_locations($site_ref)
{
$locations = array();
foreach (config_item('modules_locations') as $location => $offset) {
$locations[str_replace('__SITE_REF__', $site_ref, $location)] = str_replace('__SITE_REF__', $site_ref, $offset);
}
Modules::$locations = $locations;
}
示例6: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* define the module locations and offset */
Modules::$locations = array(MODULES_PATH => MODULES_FROM_APPCONTROLLERS);
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Modular Extensions - HMVC
*
* Adapted from the CodeIgniter Core Classes
* @link http://codeigniter.com
*
* Description:
* This library provides functions to load and instantiate controllers
* and module controllers allowing use of modules and the HMVC design pattern.
*
* Install this file as application/third_party/MX/Modules.php
*
* @copyright Copyright (c) Wiredesignz 2010-11-12
* @version 5.3.5
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例7: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/* define the module locations and offset */
Modules::$locations = array(APPPATH . 'modules/' => '../modules/');
/**
* Modular Separation - PHP5
*
* Adapted from the CodeIgniter Core Classes
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @link http://codeigniter.com
*
* Description:
* This library extends the CodeIgniter router class.
*
* Install this file as application/libraries/MY_Router.php
*
* @copyright Copyright (c) Wiredesignz 2010-03-01
* @version 2.3
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例8: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/* define the module locations and offset */
Modules::$locations = array(APPPATH . 'modules/core/' => '../modules/core/', APPPATH . 'modules/third_party/' => '../modules/third_party/');
/**
* Modular Separation - PHP5
*
* Adapted from the CodeIgniter Core Classes
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @link http://codeigniter.com
*
* Description:
* This library extends the CodeIgniter router class.
*
* Install this file as application/libraries/MY_Router.php
*
* @copyright Copyright (c) Wiredesignz 2010-03-01
* @version 1.11
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例9: exit
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
/* get module locations from config settings or use the default module location and offset */
is_array(Modules::$locations = config_item('modules_locations')) OR Modules::$locations = array(
APPPATH.'modules/' => '../modules/',
);
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Modular Extensions - HMVC
*
* Adapted from the CodeIgniter Core Classes
* @link http://codeigniter.com
*
* Description:
* This library provides functions to load and instantiate controllers
* and module controllers allowing use of modules and the HMVC design pattern.
*
* Install this file as application/third_party/MX/Modules.php
*
* @copyright Copyright (c) 2011 Wiredesignz
* @version 5.4
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
示例10: locate
/** Locate the controller **/
public function locate($segments)
{
$this->located = 0;
$ext = $this->config->item('controller_suffix') . EXT;
/* use module route if available */
// habría que ver por qué entra acá . . . .
if (isset($segments[0]) && ($routes = Modules::parse_routes($segments[0], implode('/', $segments)))) {
$segments = $routes;
}
/* get the segments array elements */
list($module, $directory, $controller) = array_pad($segments, 3, NULL);
// Agrego esta sección para controlar el frontend y el backend.
if (isset($segments[0]) && $segments[0] != 'admin') {
// si no figura admin, FRONTEND
$prev_locations = Modules::$locations;
if (is_array($prev_locations) and array_key_exists('application/backend/', $prev_locations)) {
unset($prev_locations['application/backend/']);
Modules::$locations = $prev_locations;
}
$this->config->config['modules_locations'] = array(APPPATH . 'frontend/' => '../frontend/');
} else {
// si dice /admin/xxxx BACKEND
$prev_locations = Modules::$locations;
if (is_array($prev_locations) and array_key_exists('application/frontend/', $prev_locations)) {
unset($prev_locations['application/frontend/']);
Modules::$locations = $prev_locations;
}
//unset($segments[0]);
$this->config->config['modules_locations'] = array(APPPATH . 'backend/' => '../backend/');
}
// FIN
/* check modules */
foreach (Modules::$locations as $location => $offset) {
if (isset($segments[0]) && $segments[0] == 'admin' && $offset == '../backend/') {
if (isset($segments[1])) {
$source = $location . 'controllers/';
if (isset($segments[2]) and !is_dir($source . $directory . "/")) {
$module = $segments[1];
$controller = $segments[2];
} else {
$module = $segments[1];
if (isset($segments[2])) {
$controller = $segments[2];
}
}
} else {
if (isset($this->routes['default_controller_admin'])) {
$module = $this->routes['default_controller_admin'];
$source = $location . 'controllers/';
}
}
/* module exists? */
if (is_dir($source = $location . $module . '/controllers/')) {
$this->module = $module;
$this->directory = $offset . $module . '/controllers/';
/* module sub-controller exists? */
if ($directory) {
/* module sub-directory exists? */
if (is_dir($source . $directory . '/')) {
$source .= $directory . '/';
$this->directory .= $directory . '/';
/* module sub-directory controller exists? */
if ($controller) {
if (is_file($source . ucfirst($controller) . $ext)) {
$this->located = 3;
return array_slice($segments, 2);
} else {
$this->located = -1;
}
}
} else {
if (is_file($source . ucfirst($directory) . $ext)) {
$this->located = 2;
return array_slice($segments, 1);
} else {
$this->located = -1;
}
}
}
/* module controller exists? */
if (is_file($source . ucfirst($module) . $ext)) {
$this->located = 1;
return $segments;
}
}
} else {
/* module exists? */
if (is_dir($source = $location . $module . '/controllers/')) {
$this->module = $module;
$this->directory = $offset . $module . '/controllers/';
/* module sub-controller exists? */
if ($directory) {
/* module sub-directory exists? */
if (is_dir($source . $directory . '/')) {
$source .= $directory . '/';
$this->directory .= $directory . '/';
/* module sub-directory controller exists? */
if ($controller) {
if (is_file($source . ucfirst($controller) . $ext)) {
//.........这里部分代码省略.........
示例11: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/* define the module locations and offset */
Modules::$locations = array(APPPATH . 'modules/' => '../modules/', ADDONPATH . 'modules/' => '../../../addons/modules/');
/**
* Modular Separation - PHP5
*
* Adapted from the CodeIgniter Core Classes
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @link http://codeigniter.com
*
* Description:
* This library extends the CodeIgniter router class.
*
* Install this file as application/libraries/MY_Router.php
*
* @copyright Copyright (c) Wiredesignz 2010-03-01
* @version 2.3
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例12: locate
/** Locate the controller **/
public function locate($segments)
{
/**
* Load the site ref for multi-site support
*/
if (!defined('SITE_REF')) {
require_once BASEPATH . 'database/DB' . EXT;
if (DB()->table_exists('core_sites')) {
$site = DB()->where('domain', SITE_DOMAIN)->get('core_sites')->row();
$locations = array();
// Check to see if the site retrieval was successful. If not then
// we will let MY_Controller handle the errors.
if (isset($site->ref)) {
foreach (config_item('modules_locations') as $location => $offset) {
$locations[str_replace('__SITE_REF__', $site->ref, $location)] = str_replace('__SITE_REF__', $site->ref, $offset);
}
// Set the session config to the correct table using the config name (but removing 'default_')
$this->config->set_item('sess_table_name', $site->ref . '_' . str_replace('default_', '', config_item('sess_table_name')));
// The site ref. Used for building site specific paths
define('SITE_REF', $site->ref);
// Path to uploaded files for this site
define('UPLOAD_PATH', 'uploads/' . SITE_REF . '/');
// Path to the addon folder for this site
define('ADDONPATH', ADDON_FOLDER . SITE_REF . '/');
Modules::$locations = $locations;
}
}
}
$this->module = '';
$this->directory = '';
$ext = $this->config->item('controller_suffix') . EXT;
/* use module route if available */
if (isset($segments[0]) and $routes = Modules::parse_routes($segments[0], implode('/', $segments))) {
$segments = $routes;
}
/* get the segments array elements */
list($module, $directory, $controller) = array_pad($segments, 3, NULL);
/* check modules */
foreach (Modules::$locations as $location => $offset) {
/* module exists? */
if (is_dir($source = $location . $module . '/controllers/')) {
$this->module = $module;
$this->directory = $offset . $module . '/controllers/';
/* module sub-controller exists? */
if ($directory and is_file($source . $directory . $ext)) {
return array_slice($segments, 1);
}
/* module sub-directory exists? */
if ($directory and is_dir($source . $directory . '/')) {
$source = $source . $directory . '/';
$this->directory .= $directory . '/';
/* module sub-directory controller exists? */
if (is_file($source . $directory . $ext)) {
return array_slice($segments, 1);
}
/* module sub-directory sub-controller exists? */
if ($controller and is_file($source . $controller . $ext)) {
return array_slice($segments, 2);
}
}
/* module controller exists? */
if (is_file($source . $module . $ext)) {
return $segments;
}
}
}
/* application controller exists? */
if (is_file(APPPATH . 'controllers/' . $module . $ext)) {
return $segments;
}
/* application sub-directory controller exists? */
if ($directory and is_file(APPPATH . 'controllers/' . $module . '/' . $directory . $ext)) {
$this->directory = $module . '/';
return array_slice($segments, 1);
}
/* application sub-directory default controller exists? */
if (is_file(APPPATH . 'controllers/' . $module . '/' . $this->default_controller . $ext)) {
$this->directory = $module . '/';
return array($this->default_controller);
}
}
示例13: exit
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/* define the module locations and offsets */
Modules::$locations = array(APPPATH . 'modules/' => '../modules/', VENDORSPATH . 'modules/' => '../../' . VENDORSPATH . 'modules/');
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Modular Extensions - HMVC
*
* Adapted from the CodeIgniter Core Classes
* @link http://codeigniter.com
*
* Description:
* This library provides functions to load and instantiate controllers
* and module controllers allowing use of modules and the HMVC design pattern.
*
* Install this file as application/third_party/MX/Modules.php
*
* @copyright Copyright (c) Wiredesignz 2010-09-09
* @version 5.3.4
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
示例14: locate
/** Locate the controller **/
public function locate($segments)
{
/**
* Load the site ref for multi-site support
*/
if (!defined('SITE_REF')) {
require_once BASEPATH . 'database/DB' . EXT;
# deprecated Remove this for 2.3, as this was too early for a migration
if (!DB()->table_exists('core_domains')) {
// Create alias table
DB()->query('
CREATE TABLE `core_domains` (
`id` int NOT NULL AUTO_INCREMENT,
`domain` varchar(100) NOT NULL,
`site_id` int NOT NULL,
`type` enum("park", "redirect") NOT NULL DEFAULT "park",
PRIMARY KEY (`id`),
KEY `domain` (`domain`),
UNIQUE `unique` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ');
}
$site = DB()->select('site.name, site.ref, site.domain, alias.domain as alias_domain, alias.type as alias_type')->where('site.domain', SITE_DOMAIN)->or_where('alias.domain', SITE_DOMAIN)->join('core_domains alias', 'alias.site_id = site.id', 'left')->get('core_sites site')->row();
// If the site is disabled we set the message in a constant for MY_Controller to display
if (isset($site->active) and !$site->active) {
$status = DB()->where('slug', 'status_message')->get('core_settings')->row();
define('STATUS', $status ? $status->value : 'This site has been disabled by a super-administrator');
}
// If this domain is an alias and it is a redirect
if ($site->alias_domain !== NULL and $site->alias_type === 'redirect' and str_replace(array('http://', 'https://'), '', trim(strtolower(BASE_URL), '/')) !== $site->domain) {
$protocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
// Send them off to the original domain
header("Location: {$protocol}://{$site->domain}{$_SERVER['REQUEST_URI']}");
exit;
}
$locations = array();
// Check to see if the site retrieval was successful. If not then
// we will let MY_Controller handle the errors.
if (isset($site->ref)) {
foreach (config_item('modules_locations') as $location => $offset) {
$locations[str_replace('__SITE_REF__', $site->ref, $location)] = str_replace('__SITE_REF__', $site->ref, $offset);
}
// Set the session config to the correct table using the config name (but removing 'default_')
$this->config->set_item('sess_table_name', $site->ref . '_' . str_replace('default_', '', config_item('sess_table_name')));
// The site ref. Used for building site specific paths
define('SITE_REF', $site->ref);
// Path to uploaded files for this site
define('UPLOAD_PATH', 'uploads/' . SITE_REF . '/');
// Path to the addon folder for this site
define('ADDONPATH', ADDON_FOLDER . SITE_REF . '/');
Modules::$locations = $locations;
}
}
$this->module = '';
$this->directory = '';
$ext = $this->config->item('controller_suffix') . EXT;
/* use module route if available */
if (isset($segments[0]) and $routes = Modules::parse_routes($segments[0], implode('/', $segments))) {
$segments = $routes;
}
/* get the segments array elements */
list($module, $directory, $controller) = array_pad($segments, 3, NULL);
/* check modules */
foreach (Modules::$locations as $location => $offset) {
/* module exists? */
if (is_dir($source = $location . $module . '/controllers/')) {
$this->module = $module;
$this->directory = $offset . $module . '/controllers/';
/* module sub-controller exists? */
if ($directory and is_file($source . $directory . $ext)) {
return array_slice($segments, 1);
}
/* module sub-directory exists? */
if ($directory and is_dir($source . $directory . '/')) {
$source = $source . $directory . '/';
$this->directory .= $directory . '/';
/* module sub-directory controller exists? */
if (is_file($source . $directory . $ext)) {
return array_slice($segments, 1);
}
/* module sub-directory sub-controller exists? */
if ($controller and is_file($source . $controller . $ext)) {
return array_slice($segments, 2);
}
}
/* module controller exists? */
if (is_file($source . $module . $ext)) {
return $segments;
}
}
}
/* application controller exists? */
if (is_file(APPPATH . 'controllers/' . $module . $ext)) {
return $segments;
}
/* application sub-directory controller exists? */
if ($directory and is_file(APPPATH . 'controllers/' . $module . '/' . $directory . $ext)) {
$this->directory = $module . '/';
return array_slice($segments, 1);
}
//.........这里部分代码省略.........
示例15: exit
<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
/* define the module locations and offset */
Modules::$locations = array(
FCPATH .'bonfire/modules/' => '../../modules/',
FCPATH .'bonfire/application/core_modules/' => '../core_modules/'
);
/* PHP5 spl_autoload */
spl_autoload_register('Modules::autoload');
/**
* Modular Extensions - HMVC
*
* Adapted from the CodeIgniter Core Classes
* @link http://codeigniter.com
*
* Description:
* This library provides functions to load and instantiate controllers
* and module controllers allowing use of modules and the HMVC design pattern.
*
* Install this file as application/third_party/MX/Modules.php
*
* @copyright Copyright (c) Wiredesignz 2010-11-12
* @version 5.3.5
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is