Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Kohana 3.2 config loader #7

Merged
merged 1 commit into from

2 participants

@sp1ky

Replaced Kohana::config with Kohana::$config->load (Kohana v3.2.0 compatability)

@mixu mixu merged commit 458bedd into from
@mixu
Owner

Thank you, very much appreciated. I'm currently much more involved with Node.js than Kohana, so sorry for the slowness!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 1, 2011
  1. @sp1ky
This page is out of date. Refresh to see the latest.
View
4 classes/useradmin/auth.php
@@ -20,7 +20,7 @@ public static function instance()
if ( ! isset(Auth::$_instance))
{
// Load the configuration for this type
- $config = Kohana::config('auth');
+ $config = Kohana::$config->load('auth');
if ( ! $type = $config->get('driver'))
{
@@ -30,7 +30,7 @@ public static function instance()
// Set the session class name
$class = 'Auth_'.ucfirst($type);
- $config->set("useradmin", Kohana::config('useradmin.auth') );
+ $config->set("useradmin", Kohana::$config->load('useradmin.auth') );
// Create a new session instance
Auth::$_instance = new $class($config);
View
20 classes/useradmin/controller/user.php
@@ -173,10 +173,10 @@ public function action_profile_edit()
public function action_register()
{
// Load reCaptcha if needed
- if (Kohana::config('useradmin')->captcha)
+ if (Kohana::$config->load('useradmin')->captcha)
{
include Kohana::find_file('vendor', 'recaptcha/recaptchalib');
- $recaptcha_config = Kohana::config('recaptcha');
+ $recaptcha_config = Kohana::$config->load('recaptcha');
$recaptcha_error = null;
}
// set the template title (see Controller_App for implementation)
@@ -195,7 +195,7 @@ public function action_register()
// optional checks (e.g. reCaptcha or some other additional check)
$optional_checks = true;
// if configured to use captcha, check the reCaptcha result
- if (Kohana::config('useradmin')->captcha)
+ if (Kohana::$config->load('useradmin')->captcha)
{
$recaptcha_resp = recaptcha_check_answer(
$recaptcha_config['privatekey'],
@@ -235,7 +235,7 @@ public function action_register()
$view->set('defaults', $_POST);
}
}
- if (Kohana::config('useradmin')->captcha)
+ if (Kohana::$config->load('useradmin')->captcha)
{
$view->set('captcha_enabled', true);
$view->set('recaptcha_html', recaptcha_get_html($recaptcha_config['publickey'], $recaptcha_error));
@@ -357,7 +357,7 @@ public function action_login()
{
$view->set('username', htmlspecialchars($_GET['username']));
}
- $providers = Kohana::config('useradmin.providers');
+ $providers = Kohana::$config->load('useradmin.providers');
$view->set('facebook_enabled',
isset($providers['facebook']) ? $providers['facebook'] : false);
$this->template->content = $view;
@@ -381,7 +381,7 @@ public function action_logout()
public function action_forgot()
{
// Password reset must be enabled in config/useradmin.php
- if (! Kohana::config('useradmin')->email)
+ if (! Kohana::$config->load('useradmin')->email)
{
Message::add('error', 'Password reset via email is not enabled. Please contact the site administrator to reset your password.');
$this->request->redirect('user/register');
@@ -407,7 +407,7 @@ public function action_forgot()
// MUST PASS ALL PARAMS AS REFS
$subject = __('Account password reset');
$to = $_POST['reset_email'];
- $from = Kohana::config('useradmin')->email_address;
+ $from = Kohana::$config->load('useradmin')->email_address;
$body = __($message, array(
':reset_token_link' => URL::site('user/reset?reset_token='.$user->reset_token.'&reset_email='.$_POST['reset_email'], TRUE),
':reset_link' => URL::site('user/reset', TRUE),
@@ -445,7 +445,7 @@ public function action_forgot()
function action_reset()
{
// Password reset must be enabled in config/useradmin.php
- if (! Kohana::config('useradmin')->email)
+ if (! Kohana::$config->load('useradmin')->email)
{
Message::add('error', 'Password reset via email is not enabled. Please contact the site administrator to reset your password.');
$this->request->redirect('user/register');
@@ -762,11 +762,11 @@ function action_provider_return($provider_name = null)
// Pass on the old form values
$values['password'] = $values['password_confirm'] = '';
$view->set('defaults', $values);
- if (Kohana::config('useradmin')->captcha)
+ if (Kohana::$config->load('useradmin')->captcha)
{
// FIXME: Is this the best place to include and use recaptcha?
include Kohana::find_file('vendor', 'recaptcha/recaptchalib');
- $recaptcha_config = Kohana::config('recaptcha');
+ $recaptcha_config = Kohana::$config->load('recaptcha');
$recaptcha_error = null;
$view->set('captcha_enabled', true);
$view->set('recaptcha_html', recaptcha_get_html($recaptcha_config['publickey'], $recaptcha_error));
View
2  classes/useradmin/provider.php
@@ -10,7 +10,7 @@
public static function factory($provider_name)
{
$provider = null;
- $providers = Kohana::config('useradmin.providers');
+ $providers = Kohana::$config->load('useradmin.providers');
if (! empty($provider_name) && isset($providers[$provider_name]) && $providers[$provider_name])
{
switch ($provider_name)
View
4 classes/useradmin/provider/facebook.php
@@ -17,8 +17,8 @@ public function __construct()
include_once Kohana::find_file('vendor', 'facebook/src/facebook');
// Create our Facebook SDK instance.
$this->facebook = new Facebook(array(
- 'appId' => Kohana::config('facebook')->app_id,
- 'secret' => Kohana::config('facebook')->secret,
+ 'appId' => Kohana::$config->load('facebook')->app_id,
+ 'secret' => Kohana::$config->load('facebook')->secret,
'cookie' => true // enable optional cookie support
));
}
View
2  classes/useradmin/provider/oauth.php
@@ -26,7 +26,7 @@ public function __construct($provider)
{
$this->provider_name = $provider;
// Load the configuration for this provider
- $config = Kohana::config('oauth.' . $this->provider_name);
+ $config = Kohana::$config->load('oauth.' . $this->provider_name);
// Create an consumer from the config
$this->consumer = OAuth_Consumer::factory($config);
// Load the provider
View
2  views/user/admin/index.php
@@ -19,7 +19,7 @@
// format data for DataTable
$data = array();
$merge = null;
-$providers = array_filter(Kohana::config('useradmin.providers'));
+$providers = array_filter(Kohana::$config->load('useradmin.providers'));
foreach ($users as $user) {
$row = $user->as_array();
// reformat dates
View
2  views/user/login.php
@@ -48,7 +48,7 @@
echo '<ul>';
echo '<li style="height: 61px">'.__('Don\'t have an account?').' '.Html::anchor('user/register', __('Register a new account')).'.</li>';
-$options = array_filter(Kohana::config('useradmin.providers'));
+$options = array_filter(Kohana::$config->load('useradmin.providers'));
if(!empty($options)) {
echo '<li style="padding-bottom: 8px;"><label>'.__('To register / log in using another account, please click your provider').':</label></li>';
echo '<li>';
View
2  views/user/profile.php
@@ -18,7 +18,7 @@
<p>Last login was <?php echo date('F jS, Y', $user->last_login) ?>, at <?php echo date('h:i:s a', $user->last_login) ?>.<br/>Total logins: <?php echo $user->logins ?></p>
<?php
- $providers = array_filter(Kohana::config('useradmin.providers'));
+ $providers = array_filter(Kohana::$config->load('useradmin.providers'));
$identities = $user->user_identity->find_all();
if($identities->count() > 0) {
echo '<h2>Accounts associated with your user profile</h2><p>';
Something went wrong with that request. Please try again.