Created
April 15, 2009 06:09
-
-
Save newism/95643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function load_settings($force_refresh = FALSE, $return_all = FALSE) | |
{ | |
global $SESS, $DB, $REGX, $PREFS; | |
$settings = array(); | |
$site_id = $PREFS->ini('site_id'); | |
if( | |
isset($SESS->cache[$this->developer_key][$this->package]['settings']) === FALSE | |
|| $force_refresh === TRUE | |
) | |
{ | |
$query = $DB->query("SELECT settings | |
FROM exp_extensions | |
WHERE class = '{$this->package}_ext' | |
AND settings != '' | |
LIMIT 1"); | |
if ($query->num_rows > 0) | |
{ | |
$settings = $REGX->array_stripslashes(unserialize($query->row['settings'])); | |
} | |
$default_site_settings = $this->build_default_site_settings(); | |
$settings[$site_id] = (isset($settings[$site_id]) === FALSE) ? $default_site_settings : array_merge($settings[$site_id], $default_site_settings); | |
$SESS->cache[$this->developer_key][$this->package]['settings'] = $settings; | |
} | |
if($return_all === TRUE) | |
{ | |
$settings = $SESS->cache[$this->developer_key][$this->package]['settings']; | |
} | |
else | |
{ | |
$settings = $SESS->cache[$this->developer_key][$this->package]['settings'][$PREFS->ini('site_id')]; | |
} | |
$this->settings = $settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment