aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/avatar/manager.php
diff options
context:
space:
mode:
authorCullen Walsh <ckwalsh@phpbb.com>2011-04-18 10:44:29 -0700
committerCullen Walsh <ckwalsh@cullenwalsh.com>2012-03-18 22:19:17 +0000
commitf102d9a631d6de464abefe2089ff1e6e13ed044d (patch)
tree6104027a7b9c263fe1a1bfd1d49d7057b59a30da /phpBB/includes/avatar/manager.php
parent7abded081d5ae3d231148b0485c8605b44973229 (diff)
downloadforums-f102d9a631d6de464abefe2089ff1e6e13ed044d.tar
forums-f102d9a631d6de464abefe2089ff1e6e13ed044d.tar.gz
forums-f102d9a631d6de464abefe2089ff1e6e13ed044d.tar.bz2
forums-f102d9a631d6de464abefe2089ff1e6e13ed044d.tar.xz
forums-f102d9a631d6de464abefe2089ff1e6e13ed044d.zip
[feature/avatars] Various cosmetic changes
Various small changes based on feedback from nn- * Renaming $php_ext to $phpEx * Fixing copyright years * Explain $ignore_config * Explain Regex * Copypasta package error * rename get_singleton PHPBB3-10018
Diffstat (limited to 'phpBB/includes/avatar/manager.php')
-rw-r--r--phpBB/includes/avatar/manager.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/phpBB/includes/avatar/manager.php b/phpBB/includes/avatar/manager.php
index 11b7e75017..6471c4cc9c 100644
--- a/phpBB/includes/avatar/manager.php
+++ b/phpBB/includes/avatar/manager.php
@@ -2,7 +2,7 @@
/**
*
* @package avatar
-* @copyright (c) 2010 phpBB Group
+* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@@ -16,12 +16,12 @@ if (!defined('IN_PHPBB'))
}
/**
-* @package acm
+* @package avatar
*/
class phpbb_avatar_manager
{
private $phpbb_root_path;
- private $php_ext;
+ private $phpEx;
private $config;
private $cache;
private static $valid_drivers = false;
@@ -29,10 +29,10 @@ class phpbb_avatar_manager
/**
* @TODO
**/
- public function __construct($phpbb_root_path, $php_ext = '.php', phpbb_config $config, phpbb_cache_driver_interface $cache = null)
+ public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, phpbb_cache_driver_interface $cache = null)
{
$this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
+ $this->phpEx = $phpEx;
$this->config = $config;
$this->cache = $cache;
}
@@ -40,7 +40,7 @@ class phpbb_avatar_manager
/**
* @TODO
**/
- public function get_singleton($avatar_type)
+ public function get_driver($avatar_type, $new = false)
{
if (self::$valid_drivers === false)
{
@@ -49,10 +49,10 @@ class phpbb_avatar_manager
if (isset(self::$valid_drivers[$avatar_type]))
{
- if (!is_object(self::$valid_drivers[$avatar_type]))
+ if ($new || !is_object(self::$valid_drivers[$avatar_type]))
{
$class_name = 'phpbb_avatar_driver_' . $avatar_type;
- self::$valid_drivers[$avatar_type] = new $class_name($this->config, $this->phpbb_root_path, $this->php_ext);
+ self::$valid_drivers[$avatar_type] = new $class_name($this->config, $this->phpbb_root_path, $this->phpEx, $this->cache);
}
return self::$valid_drivers[$avatar_type];
@@ -68,7 +68,7 @@ class phpbb_avatar_manager
**/
private function load_valid_drivers()
{
- require_once($this->phpbb_root_path . 'includes/avatar/driver.' . $this->php_ext);
+ require_once($this->phpbb_root_path . 'includes/avatar/driver.' . $this->phpEx);
if ($this->cache)
{
@@ -83,7 +83,8 @@ class phpbb_avatar_manager
foreach ($iterator as $file)
{
- if (preg_match("/^(.*)\.{$this->php_ext}$/", $file, $match))
+ // Match all files that appear to be php files
+ if (preg_match("/^(.*)\.{$this->phpEx}$/", $file, $match))
{
self::$valid_drivers[] = $match[1];
}