Skip to content

Commit f0c8dfd

Browse files
author
Phil Sturgeon
committed
Merge pull request #28 from IT-Can/master
class name fixes + instagram fix
2 parents 1543d48 + df14d62 commit f0c8dfd

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

libraries/OAuth2.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
2+
33
include('Exception.php');
44
include('Token.php');
55
include('Provider.php');
@@ -10,7 +10,7 @@
1010
* @author Phil Sturgeon < @philsturgeon >
1111
*/
1212
class OAuth2 {
13-
13+
1414
/**
1515
* Create a new provider.
1616
*
@@ -23,11 +23,13 @@ class OAuth2 {
2323
*/
2424
public static function provider($name, array $options = NULL)
2525
{
26-
include_once 'Provider/'.ucfirst($name).'.php';
27-
28-
$class = 'OAuth2_Provider_'.ucfirst($name);
26+
$name = ucfirst(strtolower($name));
27+
28+
include_once 'Provider/'.$name.'.php';
29+
30+
$class = 'OAuth2_Provider_'.$name;
2931

3032
return new $class($options);
3133
}
32-
34+
3335
}

libraries/Provider/Instagram.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license http://philsturgeon.co.uk/code/dbad-license
1010
*/
1111

12-
class OAuth_Provider_Instagram extends OAuth2_Provider
12+
class OAuth2_Provider_Instagram extends OAuth2_Provider
1313
{
1414
/**
1515
* @var string scope separator, most use "," but some like Google are spaces

libraries/Token.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ abstract class OAuth2_Token {
2121
*/
2222
public static function factory($name = 'access', array $options = null)
2323
{
24-
include_once 'Token/'.ucfirst($name).'.php';
25-
26-
$class = 'OAuth2_Token_'.ucfirst($name);
27-
24+
$name = ucfirst(strtolower($name));
25+
26+
include_once 'Token/'.$name.'.php';
27+
28+
$class = 'OAuth2_Token_'.$name;
29+
2830
return new $class($options);
2931
}
3032

@@ -41,7 +43,7 @@ public function __get($key)
4143
{
4244
return $this->$key;
4345
}
44-
46+
4547
/**
4648
* Return a boolean if the property is set
4749
*

0 commit comments

Comments
 (0)