本文整理汇总了PHP中kohana::config_load方法的典型用法代码示例。如果您正苦于以下问题:PHP kohana::config_load方法的具体用法?PHP kohana::config_load怎么用?PHP kohana::config_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kohana
的用法示例。
在下文中一共展示了kohana::config_load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: spatial_index_builder_get_type_filter
/**
* Reads the config file, if any, and returns details of the join and where clause that must be added
* to the indexing query to respect the location type filter in the config file.
* @return array Array containing the join SQL in the first entry and where SQL in the second.
*/
function spatial_index_builder_get_type_filter()
{
$config = kohana::config_load('spatial_index_builder', false);
$surveyRestriction = '';
if (array_key_exists('location_types', $config)) {
$join = 'join cache_termlists_terms t on t.id=l.location_type_id';
$where = "and t.preferred_term in ('" . implode("','", $config['location_types']) . "')";
if (array_key_exists('survey_restrictions', $config)) {
foreach ($config['survey_restrictions'] as $type => $surveyIds) {
$surveys = implode(', ', $surveyIds);
$surveyRestriction .= "and (t.preferred_term<>'{$type}' or s.survey_id in ({$surveys}))\n";
}
}
} else {
$join = '';
$where = '';
}
return array($join, $where, $surveyRestriction);
}
示例2: check_db
/**
* Ensure that the PHP version running on the server is at least 5.2, which supports
* JSON properly.
*
* @param array $messages List of messages that any information should be appended to.
* @param boolean $problems_only Set to true to report only the problems, not the successful
* checks. False reports both failures and successes.
*/
public static function check_db(&$messages, $problems_only)
{
// The Indicia config file is only created after a successful db creation.
$config = kohana::config_load('indicia', false);
if (!$config) {
$problem = array('title' => 'Database configuration', 'description' => '<p>Database configuration options need to be set allowing the Indicia Warehouse to access your ' . 'database. Indicia will then install the required database tables for you.</p>', 'success' => false);
$other_problems = false;
for ($i = 0; $i < count($messages); $i++) {
$other_problems = $other_problems || $messages[$i]['success'] == false;
}
if (!$other_problems) {
// No other problems, so can proceed to install the database.
$problem['action'] = array('title' => 'Configure database', 'link' => 'config_db');
} else {
$problem['description'] .= '<p>Fix the other issues listed on this page before proceeding to configure and install the database.</p>';
}
array_push($messages, $problem);
} elseif (!$problems_only) {
array_push($messages, array('title' => 'Database configuration', 'description' => '<p>The Indicia Warehouse database has been configured and installed.</p>', 'success' => true));
}
}
示例3: array
<!-- Main template -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta id="baseURI" name="baseURI" content="<?php
echo url::site();
?>
" />
<meta id="routedURI" name="routedURI" content="<?php
echo url::site() . router::$routed_uri;
?>
" />
<?php
// during setup, the indicia config file does not exist
$indicia = kohana::config_load('indicia', false);
$theme = $indicia ? $indicia['theme'] : 'default';
echo html::stylesheet(array('media/css/site', 'media/css/forms', 'media/js/fancybox/jquery.fancybox.css', 'media/css/jquery.autocomplete', 'media/themes/' . $theme . '/jquery-ui.custom'), array('screen'));
?>
<!-- BEGIN: jquery/superfish init -->
<?php
echo html::script(array('media/js/json2.js', 'media/js/jquery.js', 'media/js/jquery.url.js', 'media/js/fancybox/jquery.fancybox.pack.js', 'media/js/hasharray.js', 'media/js/superfish.js', 'media/js/jquery-ui.custom.min.js'), FALSE);
?>
<?php
echo html::stylesheet(array('media/css/menus'), array('screen'));
?>
<script type="text/javascript">
示例4: spatial_index_builder_get_type_filter
/**
* Reads the config file, if any, and returns details of the join and where clause that must be added
* to the indexing query to respect the location type filter in the config file.
* @return array Array containing the join SQL in the first entry and where SQL in the second.
*/
function spatial_index_builder_get_type_filter()
{
$config = kohana::config_load('spatial_index_builder', false);
if (array_key_exists('location_types', $config)) {
$join = 'join cache_termlists_terms t on t.id=l.location_type_id';
$where = "and t.preferred_term in ('" . implode("','", $config['location_types']) . "')";
} else {
$join = '';
$where = '';
}
return array($join, $where);
}
示例5: processIndexGroupsLocations
/**
* Method to populate the indexed locations that this group intersects with. Makes it easy to do things like
* suggest groups based on geographic region.
*/
private function processIndexGroupsLocations()
{
$filter = json_decode($this->filter->definition, true);
$exist = $this->db->select('id', 'location_id')->from('index_groups_locations')->where('group_id', $this->id)->get();
$location_ids = array();
// backwards compatibility
if (!empty($filter['indexed_location_id']) && empty($filter['indexed_location_list'])) {
$filter['indexed_location_list'] = $filter['location_id'];
}
// backwards compatibility
if (!empty($filter['location_id']) && empty($filter['location_list'])) {
$filter['location_list'] = $filter['location_id'];
}
// backwards compatibility
if (!empty($filter['indexed_location_list'])) {
// Got an indexed location as the filter boundary definition, so we can use that as it is.
$location_ids = explode(',', $filter['indexed_location_list']);
} elseif (!empty($filter['location_list']) || !empty($filter['searchArea'])) {
// got either an unindexed location, or a freehand boundary, so need to intersect to find the indexed locations
// Without a configuration for the indexed location type layers we can't go any further.
$config = kohana::config_load('spatial_index_builder', false);
if (array_key_exists('location_types', $config)) {
$types = "'" . implode("','", $config['location_types']) . "'";
if (!empty($filter['location_list'])) {
$rows = $this->db->query('select l.id from locations l ' . 'join locations search on ' . ' (st_intersects(coalesce(search.boundary_geom, search.centroid_geom), coalesce(l.boundary_geom, l.centroid_geom)) ' . ' and not st_touches(coalesce(search.boundary_geom, search.centroid_geom), coalesce(l.boundary_geom, l.centroid_geom)))' . 'join cache_termlists_terms t on t.id=l.location_type_id ' . "where search.id in ({$filter['location_list']}) and t.preferred_term in ({$types})")->result();
} else {
$srid = kohana::config('sref_notations.internal_srid');
$rows = $this->db->query('select l.id from locations l ' . 'join cache_termlists_terms t on t.id=l.location_type_id ' . "where (st_intersects(st_geomfromtext('{$filter['searchArea']}', {$srid}), coalesce(l.boundary_geom, l.centroid_geom)) " . " and not st_touches(st_geomfromtext('{$filter['searchArea']}', {$srid}), coalesce(l.boundary_geom, l.centroid_geom)))" . "and t.preferred_term in ({$types})")->result();
}
foreach ($rows as $row) {
$location_ids[] = $row->id;
}
}
}
// go through the existing index entries for this group. Remove any that are not needed now.
foreach ($exist as $record) {
if (in_array($record->location_id, $location_ids)) {
// Got a correct one already. Remove the location ID from the list we want to add later
unset($location_ids[$record->location_id]);
} else {
// Got one we didn't actually want.
$this->db->delete('index_groups_locations', array('id' => $record->id));
}
}
// Any remaining in our list now need to be added.
foreach ($location_ids as $location_id) {
$this->db->insert('index_groups_locations', array('group_id' => $this->id, 'location_id' => $location_id));
}
}
示例6: _check_module_active
private function _check_module_active($module)
{
$config = kohana::config_load('core');
foreach ($config['modules'] as $path) {
if (strlen($path) >= strlen($module) && substr_compare($path, $module, strlen($path) - strlen($module), strlen($module), true) === 0) {
return true;
}
}
return false;
}
示例7: __upgrade
*
* @package Indicia
* @subpackage Hook
* @license http://www.gnu.org/licenses/gpl.html GPL
* @author Indicia Team
* @version $Rev$ / $LastChangedDate$ / $Author$
*/
class Dev
{
public static function __upgrade()
{
$uri = URI::instance();
// we havent to proceed futher if a setup call was made
if ($uri->segment(1) == 'setup_check' || $uri->segment(2) == 'upgrade') {
return;
}
// also do not proceed when responding to a web service call
// as we may not have update permission on the database
if ($uri->segment(1) == 'services') {
return;
}
// Invoke the upgrader
$upgrader = new Upgrade_Model();
$upgrader->run();
}
}
// load the optional config file to specify continuous updates
$upgradeConfig = kohana::config_load('upgrade', false);
if ($upgradeConfig && $upgradeConfig['continuous_upgrade']) {
Event::add('system.pre_controller', array('Dev', '__upgrade'));
}