Permalink
Browse files

Replace all occurences of dirname(__FILE__) with __DIR__.

  • Loading branch information...
1 parent 85e8a8a commit 133d981fb75ccac9d3a0774a5197e020c2b43749 @realityking realityking committed Jan 11, 2012
Showing with 49 additions and 49 deletions.
  1. +1 −1 build/changelog.php
  2. +1 −1 libraries/import.php
  3. +1 −1 libraries/joomla/application/input.php
  4. +1 −1 libraries/joomla/application/web.php
  5. +4 −4 libraries/joomla/cache/cache.php
  6. +3 −3 libraries/joomla/database/database.php
  7. +3 −3 libraries/joomla/database/database/mysql.php
  8. +4 −4 libraries/joomla/database/database/mysqli.php
  9. +1 −1 libraries/joomla/database/database/mysqliexporter.php
  10. +1 −1 libraries/joomla/database/database/mysqliimporter.php
  11. +1 −1 libraries/joomla/database/database/mysqliquery.php
  12. +2 −2 libraries/joomla/database/database/sqlazure.php
  13. +1 −1 libraries/joomla/database/database/sqlsrv.php
  14. +1 −1 libraries/joomla/database/table.php
  15. +4 −4 libraries/joomla/document/document.php
  16. +1 −1 libraries/joomla/filesystem/archive.php
  17. +1 −1 libraries/joomla/filesystem/helper.php
  18. +1 −1 libraries/joomla/filesystem/stream.php
  19. +1 −1 libraries/joomla/form/helper.php
  20. +2 −2 libraries/joomla/html/toolbar.php
  21. +1 −1 libraries/joomla/http/transport/curl.php
  22. +1 −1 libraries/joomla/installer/installer.php
  23. +1 −1 libraries/joomla/language/language.php
  24. +1 −1 libraries/joomla/log/log.php
  25. +1 −1 libraries/joomla/log/loggers/w3c.php
  26. +1 −1 libraries/joomla/registry/format.php
  27. +1 −1 libraries/joomla/registry/registry.php
  28. +3 −3 libraries/joomla/session/session.php
  29. +1 −1 libraries/joomla/session/storage.php
  30. +1 −1 libraries/joomla/updater/updater.php
  31. +1 −1 libraries/loader.php
  32. +1 −1 tests/suite/joomla/form/fields/JFormFieldDatabaseConnectionTest.php
View
@@ -11,7 +11,7 @@
define('_JEXEC', 1);
// Setup the path related constants.
-define('JPATH_BASE', dirname(__FILE__));
+define('JPATH_BASE', __DIR__);
// Bootstrap the application.
require '../libraries/import.php';
View
@@ -9,7 +9,7 @@
// Set the platform root path as a constant if necessary.
if (!defined('JPATH_PLATFORM'))
{
- define('JPATH_PLATFORM', dirname(__FILE__));
+ define('JPATH_PLATFORM', __DIR__);
}
// Set the directory separator define if necessary.
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-JLoader::discover('JInput', dirname(__FILE__) . '/input');
+JLoader::discover('JInput', __DIR__ . '/input');
/**
* Joomla! Input Base Class
@@ -373,7 +373,7 @@ protected function render()
// Fall back to constants.
else
{
- $options['directory'] = (defined('JPATH_BASE') ? JPATH_BASE : dirname(__FILE__)) . '/themes';
+ $options['directory'] = (defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes';
}
// Parse the document.
@@ -10,10 +10,10 @@
defined('JPATH_PLATFORM') or die;
//Register the storage class with the loader
-JLoader::register('JCacheStorage', dirname(__FILE__) . '/storage.php');
+JLoader::register('JCacheStorage', __DIR__ . '/storage.php');
//Register the controller class with the loader
-JLoader::register('JCacheController', dirname(__FILE__) . '/controller.php');
+JLoader::register('JCacheController', __DIR__ . '/controller.php');
// Almost everything must be public here to allow overloading.
@@ -100,7 +100,7 @@ public static function getInstance($type = 'output', $options = array())
public static function getStores()
{
jimport('joomla.filesystem.folder');
- $handlers = JFolder::files(dirname(__FILE__) . '/storage', '.php');
+ $handlers = JFolder::files(__DIR__ . '/storage', '.php');
$names = array();
foreach ($handlers as $handler)
@@ -110,7 +110,7 @@ public static function getStores()
if (!class_exists($class))
{
- include_once dirname(__FILE__) . '/storage/' . $name . '.php';
+ include_once __DIR__ . '/storage/' . $name . '.php';
}
if (call_user_func_array(array(trim($class), 'test'), array()))
@@ -181,7 +181,7 @@ public static function getConnectors()
$connectors = array();
// Get a list of types.
- $types = JFolder::files(dirname(__FILE__) . '/database');
+ $types = JFolder::files(__DIR__ . '/database');
// Loop through the types and find the ones that are available.
foreach ($types as $type)
@@ -199,7 +199,7 @@ public static function getConnectors()
if (!class_exists($class))
{
// Derive the file path for the driver class.
- $path = dirname(__FILE__) . '/database/' . $type;
+ $path = __DIR__ . '/database/' . $type;
// If the file exists register the class with our class loader.
if (file_exists($path))
@@ -268,7 +268,7 @@ public static function getInstance($options = array())
{
// Derive the file path for the driver class.
- $path = dirname(__FILE__) . '/database/' . $options['driver'] . '.php';
+ $path = __DIR__ . '/database/' . $options['driver'] . '.php';
// If the file exists register the class with our class loader.
if (file_exists($path))
@@ -9,9 +9,9 @@
defined('JPATH_PLATFORM') or die;
-JLoader::register('JDatabaseQueryMySQL', dirname(__FILE__) . '/mysqlquery.php');
-JLoader::register('JDatabaseExporterMySQL', dirname(__FILE__) . '/mysqlexporter.php');
-JLoader::register('JDatabaseImporterMySQL', dirname(__FILE__) . '/mysqlimporter.php');
+JLoader::register('JDatabaseQueryMySQL', __DIR__ . '/mysqlquery.php');
+JLoader::register('JDatabaseExporterMySQL', __DIR__ . '/mysqlexporter.php');
+JLoader::register('JDatabaseImporterMySQL', __DIR__ . '/mysqlimporter.php');
/**
* MySQL database driver
@@ -9,10 +9,10 @@
defined('JPATH_PLATFORM') or die;
-JLoader::register('JDatabaseMySQL', dirname(__FILE__) . '/mysql.php');
-JLoader::register('JDatabaseQueryMySQLi', dirname(__FILE__) . '/mysqliquery.php');
-JLoader::register('JDatabaseExporterMySQLi', dirname(__FILE__) . '/mysqliexporter.php');
-JLoader::register('JDatabaseImporterMySQLi', dirname(__FILE__) . '/mysqliimporter.php');
+JLoader::register('JDatabaseMySQL', __DIR__ . '/mysql.php');
+JLoader::register('JDatabaseQueryMySQLi', __DIR__ . '/mysqliquery.php');
+JLoader::register('JDatabaseExporterMySQLi', __DIR__ . '/mysqliexporter.php');
+JLoader::register('JDatabaseImporterMySQLi', __DIR__ . '/mysqliimporter.php');
/**
* MySQLi database driver
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-require_once dirname(__FILE__) . '/mysqlexporter.php';
+require_once __DIR__ . '/mysqlexporter.php';
/**
* MySQL export driver.
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-require_once dirname(__FILE__) . '/mysqlimporter.php';
+require_once __DIR__ . '/mysqlimporter.php';
/**
* MySQL import driver.
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-require_once dirname(__FILE__) . '/mysqlquery.php';
+require_once __DIR__ . '/mysqlquery.php';
/**
* Query Building Class.
@@ -9,9 +9,9 @@
defined('JPATH_PLATFORM') or die;
-JLoader::register('JDatabaseSQLSrv', dirname(__FILE__) . '/sqlsrv.php');
+JLoader::register('JDatabaseSQLSrv', __DIR__ . '/sqlsrv.php');
-JLoader::register('JDatabaseQuerySQLAzure', dirname(__FILE__) . '/sqlazurequery.php');
+JLoader::register('JDatabaseQuerySQLAzure', __DIR__ . '/sqlazurequery.php');
/**
* SQL Server database driver
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-JLoader::register('JDatabaseQuerySQLSrv', dirname(__FILE__) . '/sqlsrvquery.php');
+JLoader::register('JDatabaseQuerySQLSrv', __DIR__ . '/sqlsrvquery.php');
/**
* SQL Server database driver
@@ -215,7 +215,7 @@ public static function addIncludePath($path = null)
// If the internal paths have not been initialised, do so with the base table path.
if (!isset($_paths))
{
- $_paths = array(dirname(__FILE__) . '/table');
+ $_paths = array(__DIR__ . '/table');
}
// Convert the passed path(s) to add to an array.
@@ -9,7 +9,7 @@
defined('JPATH_PLATFORM') or die;
-JLoader::register('JDocumentRenderer', dirname(__FILE__) . '/renderer.php');
+JLoader::register('JDocumentRenderer', __DIR__ . '/renderer.php');
jimport('joomla.environment.response');
jimport('joomla.filter.filteroutput');
@@ -268,7 +268,7 @@ public static function getInstance($type = 'html', $attributes = array())
if (empty(self::$instances[$signature]))
{
$type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type);
- $path = dirname(__FILE__) . '/' . $type . '/' . $type . '.php';
+ $path = __DIR__ . '/' . $type . '/' . $type . '.php';
$ntype = null;
// Check if the document type exists
@@ -283,7 +283,7 @@ public static function getInstance($type = 'html', $attributes = array())
$class = 'JDocument' . $type;
if (!class_exists($class))
{
- $path = dirname(__FILE__) . '/' . $type . '/' . $type . '.php';
+ $path = __DIR__ . '/' . $type . '/' . $type . '.php';
if (file_exists($path))
{
require_once $path;
@@ -915,7 +915,7 @@ public function loadRenderer($type)
if (!class_exists($class))
{
- $path = dirname(__FILE__) . '/' . $this->_type . '/renderer/' . $type . '.php';
+ $path = __DIR__ . '/' . $this->_type . '/renderer/' . $type . '.php';
if (file_exists($path))
{
@@ -187,7 +187,7 @@ public static function getAdapter($type)
if (!class_exists($class))
{
- $path = dirname(__FILE__) . '/archive/' . strtolower($type) . '.php';
+ $path = __DIR__ . '/archive/' . strtolower($type) . '.php';
if (file_exists($path))
{
require_once $path;
@@ -267,7 +267,7 @@ public static function getJStreams()
if (!$streams)
{
- $streams = array_map(array('JFile', 'stripExt'), JFolder::files(dirname(__FILE__) . '/streams', '.php'));
+ $streams = array_map(array('JFile', 'stripExt'), JFolder::files(__DIR__ . '/streams', '.php'));
}
return $streams;
@@ -199,7 +199,7 @@ public function open($filename, $mode = 'r', $use_include_path = false, $context
// If we're dealing with a Joomla! stream, load it
if (JFilesystemHelper::isJoomlaStream($url['scheme']))
{
- require_once dirname(__FILE__) . '/streams/' . $url['scheme'] . '.php';
+ require_once __DIR__ . '/streams/' . $url['scheme'] . '.php';
}
// We have a scheme! force the method to be f
@@ -293,7 +293,7 @@ protected static function addPath($entity, $new = null)
// But when someday we would want to support more entities, then we should consider adding
// an inflector class to "libraries/joomla/utilities" and use it here (or somebody can use a real inflector in his subclass).
// see also: pluralization snippet by Paul Osman in JControllerForm's constructor.
- $paths[] = dirname(__FILE__) . '/' . $entity_plural;
+ $paths[] = __DIR__ . '/' . $entity_plural;
}
// Force the new path(s) to an array.
@@ -10,7 +10,7 @@
defined('JPATH_PLATFORM') or die;
//Register the session storage class with the loader
-JLoader::register('JButton', dirname(__FILE__) . '/toolbar/button.php');
+JLoader::register('JButton', __DIR__ . '/toolbar/button.php');
/**
* ToolBar handler
@@ -61,7 +61,7 @@ public function __construct($name = 'toolbar')
$this->_name = $name;
// Set base path to find buttons.
- $this->_buttonPath[] = dirname(__FILE__) . '/toolbar/button';
+ $this->_buttonPath[] = __DIR__ . '/toolbar/button';
}
@@ -65,7 +65,7 @@ public function request($method, JUri $uri, $data = null, array $headers = null,
$options[CURLOPT_CUSTOMREQUEST] = strtoupper($method);
// Initialize the certificate store
- $options[CURLOPT_CAINFO] = dirname(__FILE__) . '/cacert.pem';
+ $options[CURLOPT_CAINFO] = __DIR__ . '/cacert.pem';
// If data exists let's encode it and make sure our Content-type header is set.
if (isset($data))
@@ -117,7 +117,7 @@ class JInstaller extends JAdapter
*/
public function __construct()
{
- parent::__construct(dirname(__FILE__), 'JInstaller');
+ parent::__construct(__DIR__, 'JInstaller');
}
/**
@@ -359,7 +359,7 @@ public function _($string, $jsSafe = false, $interpretBackSlashes = true)
*/
public function transliterate($string)
{
- include_once dirname(__FILE__) . '/latin_transliterate.php';
+ include_once __DIR__ . '/latin_transliterate.php';
if ($this->transliterator !== null)
{
@@ -13,7 +13,7 @@
JLoader::register('LogException', JPATH_PLATFORM . '/joomla/log/logexception.php');
-JLoader::discover('JLogger', dirname(__FILE__) . '/loggers');
+JLoader::discover('JLogger', __DIR__ . '/loggers');
// @deprecated 12.1
jimport('joomla.filesystem.path');
@@ -12,7 +12,7 @@
jimport('joomla.log.logger');
// Register the JLoggerFormattedText class with the autoloader.
-JLoader::register('JLoggerFormattedText', dirname(__FILE__) . '/formattedtext.php');
+JLoader::register('JLoggerFormattedText', __DIR__ . '/formattedtext.php');
/**
* Joomla! W3C Logging class
@@ -47,7 +47,7 @@ public static function getInstance($type)
$class = 'JRegistryFormat' . $type;
if (!class_exists($class))
{
- $path = dirname(__FILE__) . '/format/' . $type . '.php';
+ $path = __DIR__ . '/format/' . $type . '.php';
if (is_file($path))
{
include_once $path;
@@ -10,7 +10,7 @@
defined('JPATH_PLATFORM') or die;
jimport('joomla.utilities.arrayhelper');
-JLoader::register('JRegistryFormat', dirname(__FILE__) . '/format.php');
+JLoader::register('JRegistryFormat', __DIR__ . '/format.php');
/**
* JRegistry class
@@ -10,7 +10,7 @@
defined('JPATH_PLATFORM') or die;
// Register the session storage class with the loader
-JLoader::register('JSessionStorage', dirname(__FILE__) . '/storage.php');
+JLoader::register('JSessionStorage', __DIR__ . '/storage.php');
jimport('joomla.environment.request');
@@ -300,7 +300,7 @@ public function getId()
public static function getStores()
{
jimport('joomla.filesystem.folder');
- $handlers = JFolder::files(dirname(__FILE__) . '/storage', '.php$');
+ $handlers = JFolder::files(__DIR__ . '/storage', '.php$');
$names = array();
foreach ($handlers as $handler)
@@ -311,7 +311,7 @@ public static function getStores()
//Load the class only if needed
if (!class_exists($class))
{
- require_once dirname(__FILE__) . '/storage/' . $name . '.php';
+ require_once __DIR__ . '/storage/' . $name . '.php';
}
if (call_user_func_array(array(trim($class), 'test'), array()))
@@ -57,7 +57,7 @@ public static function getInstance($name = 'none', $options = array())
if (!class_exists($class))
{
- $path = dirname(__FILE__) . '/storage/' . $name . '.php';
+ $path = __DIR__ . '/storage/' . $name . '.php';
if (file_exists($path))
{
@@ -39,7 +39,7 @@ class JUpdater extends JAdapter
public function __construct()
{
// Adapter base path, class prefix
- parent::__construct(dirname(__FILE__), 'JUpdater');
+ parent::__construct(__DIR__, 'JUpdater');
}
/**
View
@@ -116,7 +116,7 @@ public static function import($key, $base = null)
$success = false;
$parts = explode('.', $key);
$class = array_pop($parts);
- $base = (!empty($base)) ? $base : dirname(__FILE__);
+ $base = (!empty($base)) ? $base : __DIR__;
$path = str_replace('.', DS, $key);
// Handle special case for helper classes.
@@ -21,7 +21,7 @@ class JFormFieldDatabaseConnectionTest extends JoomlaTestCase
protected function setUp()
{
require_once JPATH_PLATFORM.'/joomla/form/fields/databaseconnection.php';
- include_once dirname(dirname(__FILE__)).'/inspectors.php';
+ include_once dirname(__DIR__).'/inspectors.php';
}
/**

0 comments on commit 133d981

Please sign in to comment.