Permalink
Browse files

Take advantage of PHP 5.3's new __DIR__ constant.

  • Loading branch information...
1 parent 0fc0e90 commit a5c90d39d5c102af5ee489ac89f74a49c3377fff @realityking realityking committed Aug 2, 2012
Showing with 96 additions and 98 deletions.
  1. +1 −1 administrator/components/com_banners/models/fields/bannerclient.php
  2. +1 −2 administrator/components/com_content/content.php
  3. +1 −1 administrator/components/com_content/controllers/featured.php
  4. +1 −1 administrator/components/com_content/models/feature.php
  5. +1 −1 administrator/components/com_content/models/featured.php
  6. +4 −5 administrator/components/com_finder/helpers/indexer/adapter.php
  7. +2 −2 administrator/components/com_finder/helpers/indexer/helper.php
  8. +5 −5 administrator/components/com_finder/helpers/indexer/indexer.php
  9. +1 −1 administrator/components/com_finder/helpers/indexer/parser.php
  10. +2 −3 administrator/components/com_finder/helpers/indexer/query.php
  11. +1 −1 administrator/components/com_finder/helpers/indexer/result.php
  12. +1 −1 administrator/components/com_finder/helpers/indexer/stemmer.php
  13. +1 −2 administrator/components/com_installer/models/database.php
  14. +1 −1 administrator/components/com_installer/models/discover.php
  15. +1 −2 administrator/components/com_installer/models/manage.php
  16. +1 −1 administrator/components/com_installer/views/database/view.html.php
  17. +1 −1 administrator/components/com_installer/views/discover/view.html.php
  18. +1 −1 administrator/components/com_installer/views/install/view.html.php
  19. +1 −1 administrator/components/com_installer/views/manage/view.html.php
  20. +1 −1 administrator/components/com_installer/views/update/view.html.php
  21. +1 −1 administrator/components/com_installer/views/warnings/view.html.php
  22. +1 −1 administrator/components/com_templates/templates.php
  23. +1 −1 administrator/components/com_users/users.php
  24. +3 −3 administrator/index.php
  25. +1 −1 administrator/modules/mod_feed/mod_feed.php
  26. +1 −1 administrator/modules/mod_latest/mod_latest.php
  27. +1 −1 administrator/modules/mod_logged/mod_logged.php
  28. +1 −1 administrator/modules/mod_login/mod_login.php
  29. +6 −4 administrator/modules/mod_menu/mod_menu.php
  30. +1 −1 administrator/modules/mod_popular/mod_popular.php
  31. +1 −1 administrator/modules/mod_quickicon/mod_quickicon.php
  32. +3 −3 administrator/modules/mod_submenu/mod_submenu.php
  33. +1 −1 administrator/modules/mod_version/mod_version.php
  34. +1 −1 administrator/templates/system/index.php
  35. +3 −3 cli/finder_indexer.php
  36. +3 −3 cli/garbagecron.php
  37. +3 −3 cli/update_cron.php
  38. +1 −1 components/com_content/models/archive.php
  39. +1 −1 components/com_content/models/featured.php
  40. +3 −3 index.php
  41. +1 −1 libraries/cms.php
  42. +1 −1 libraries/cms/schema/changeitem.php
  43. +1 −1 libraries/cms/schema/changeitemsqlazure.php
  44. +1 −1 modules/mod_articles_archive/mod_articles_archive.php
  45. +1 −1 modules/mod_articles_categories/mod_articles_categories.php
  46. +1 −1 modules/mod_articles_category/mod_articles_category.php
  47. +1 −1 modules/mod_articles_latest/mod_articles_latest.php
  48. +1 −1 modules/mod_articles_news/mod_articles_news.php
  49. +1 −1 modules/mod_articles_popular/mod_articles_popular.php
  50. +1 −1 modules/mod_banners/mod_banners.php
  51. +1 −1 modules/mod_breadcrumbs/mod_breadcrumbs.php
  52. +1 −1 modules/mod_feed/mod_feed.php
  53. +1 −1 modules/mod_finder/mod_finder.php
  54. +1 −1 modules/mod_languages/mod_languages.php
  55. +1 −1 modules/mod_login/mod_login.php
  56. +1 −1 modules/mod_menu/mod_menu.php
  57. +1 −1 modules/mod_random_image/mod_random_image.php
  58. +1 −1 modules/mod_related_items/mod_related_items.php
  59. +1 −1 modules/mod_search/mod_search.php
  60. +1 −1 modules/mod_stats/mod_stats.php
  61. +1 −1 modules/mod_syndicate/mod_syndicate.php
  62. +2 −1 modules/mod_users_latest/mod_users_latest.php
  63. +1 −1 modules/mod_weblinks/mod_weblinks.php
  64. +1 −1 modules/mod_whosonline/mod_whosonline.php
  65. +1 −1 modules/mod_wrapper/mod_wrapper.php
  66. +1 −1 plugins/content/geshi/geshi.php
  67. +2 −2 plugins/user/profile/profile.php
  68. +1 −1 templates/system/index.php
@@ -11,7 +11,7 @@
JFormHelper::loadFieldClass('list');
-require_once dirname(__FILE__) . '/../../helpers/banners.php';
+require_once __DIR__ . '/../../helpers/banners.php';
/**
* Bannerclient Field class for the Joomla Framework.
@@ -14,8 +14,7 @@
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
-// Register helper class
-JLoader::register('ContentHelper', dirname(__FILE__) . '/helpers/content.php');
+JLoader::register('ContentHelper', __DIR__ . '/helpers/content.php');
$controller = JControllerLegacy::getInstance('Content');
$controller->execute(JFactory::getApplication()->input->get('task'));
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__).'/articles.php';
+require_once __DIR__ . '/articles.php';
/**
* @package Joomla.Administrator
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__).'/article.php';
+require_once __DIR__ . '/article.php';
/**
* Feature model.
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__) . '/articles.php';
+require_once __DIR__ . '/articles.php';
/**
* About Page Model
@@ -9,11 +9,10 @@
defined('_JEXEC') or die;
-// Register dependent classes.
-JLoader::register('FinderIndexer', dirname(__FILE__) . '/indexer.php');
-JLoader::register('FinderIndexerHelper', dirname(__FILE__) . '/helper.php');
-JLoader::register('FinderIndexerResult', dirname(__FILE__) . '/result.php');
-JLoader::register('FinderIndexerTaxonomy', dirname(__FILE__) . '/taxonomy.php');
+JLoader::register('FinderIndexer', __DIR__ . '/indexer.php');
+JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php');
+JLoader::register('FinderIndexerResult', __DIR__ . '/result.php');
+JLoader::register('FinderIndexerTaxonomy', __DIR__ . '/taxonomy.php');
/**
* Prototype adapter class for the Finder indexer package.
@@ -9,8 +9,8 @@
defined('_JEXEC') or die;
-JLoader::register('FinderIndexerStemmer', dirname(__FILE__) . '/stemmer.php');
-JLoader::register('FinderIndexerToken', dirname(__FILE__) . '/token.php');
+JLoader::register('FinderIndexerStemmer', __DIR__ . '/stemmer.php');
+JLoader::register('FinderIndexerToken', __DIR__ . '/token.php');
/**
* Helper class for the Finder indexer package.
@@ -9,11 +9,11 @@
defined('_JEXEC') or die;
-JLoader::register('FinderIndexerHelper', dirname(__FILE__) . '/helper.php');
-JLoader::register('FinderIndexerParser', dirname(__FILE__) . '/parser.php');
-JLoader::register('FinderIndexerStemmer', dirname(__FILE__) . '/stemmer.php');
-JLoader::register('FinderIndexerTaxonomy', dirname(__FILE__) . '/taxonomy.php');
-JLoader::register('FinderIndexerToken', dirname(__FILE__) . '/token.php');
+JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php');
+JLoader::register('FinderIndexerParser', __DIR__ . '/parser.php');
+JLoader::register('FinderIndexerStemmer', __DIR__ . '/stemmer.php');
+JLoader::register('FinderIndexerTaxonomy', __DIR__ . '/taxonomy.php');
+JLoader::register('FinderIndexerToken', __DIR__ . '/token.php');
jimport('joomla.filesystem.file');
@@ -46,7 +46,7 @@ public static function getInstance($format)
// Setup the adapter for the parser.
$format = JFilterInput::getInstance()->clean($format, 'cmd');
- $path = dirname(__FILE__) . '/parser/' . $format . '.php';
+ $path = __DIR__ . '/parser/' . $format . '.php';
$class = 'FinderIndexerParser' . ucfirst($format);
// Check if a parser exists for the format.
@@ -9,9 +9,8 @@
defined('_JEXEC') or die;
-// Register dependent classes.
-JLoader::register('FinderIndexerHelper', dirname(__FILE__) . '/helper.php');
-JLoader::register('FinderIndexerTaxonomy', dirname(__FILE__) . '/taxonomy.php');
+JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php');
+JLoader::register('FinderIndexerTaxonomy', __DIR__ . '/taxonomy.php');
JLoader::register('FinderHelperRoute', JPATH_SITE . '/components/com_finder/helpers/route.php');
JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php');
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-JLoader::register('FinderIndexer', dirname(__FILE__) . '/indexer.php');
+JLoader::register('FinderIndexer', __DIR__ . '/indexer.php');
/**
* Result class for the Finder indexer package.
@@ -54,7 +54,7 @@ public static function getInstance($adapter)
// Setup the adapter for the stemmer.
$adapter = JFilterInput::getInstance()->clean($adapter, 'cmd');
- $path = dirname(__FILE__) . '/stemmer/' . $adapter . '.php';
+ $path = __DIR__ . '/stemmer/' . $adapter . '.php';
$class = 'FinderIndexerStemmer' . ucfirst($adapter);
// Check if a stemmer exists for the adapter.
@@ -9,8 +9,7 @@
defined('_JEXEC') or die;
-// Import library dependencies
-JLoader::register('InstallerModel', dirname(__FILE__) . '/extension.php');
+JLoader::register('InstallerModel', __DIR__ . '/extension.php');
JLoader::register('joomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');
/**
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__) . '/extension.php';
+require_once __DIR__ . '/extension.php';
/**
* Installer Manage Model
@@ -9,8 +9,7 @@
defined('_JEXEC') or die;
-// Import library dependencies
-require_once dirname(__FILE__) . '/extension.php';
+require_once __DIR__ . '/extension.php';
/**
* Installer Manage Model
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Manage View
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Manage View
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Install View
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Manage View
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Update View
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-include_once dirname(__FILE__).'/../default/view.php';
+include_once __DIR__ . '/../default/view.php';
/**
* Extension Manager Templates View
@@ -14,7 +14,7 @@
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
-JLoader::register('TemplatesHelper', dirname(__FILE__) . '/helpers/templates.php');
+JLoader::register('TemplatesHelper', __DIR__ . '/helpers/templates.php');
$controller = JControllerLegacy::getInstance('Templates');
$controller->execute(JFactory::getApplication()->input->get('task'));
@@ -14,7 +14,7 @@
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
-JLoader::register('UsersHelper', dirname(__FILE__) . '/helpers/users.php');
+JLoader::register('UsersHelper', __DIR__ . '/helpers/users.php');
$controller = JControllerLegacy::getInstance('Users');
$controller->execute(JFactory::getApplication()->input->get('task'));
View
@@ -9,12 +9,12 @@
// Set flag that this is a parent file
const _JEXEC = 1;
-if (file_exists(dirname(__FILE__) . '/defines.php')) {
- include_once dirname(__FILE__) . '/defines.php';
+if (file_exists(__DIR__ . '/defines.php')) {
+ include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES')) {
- define('JPATH_BASE', dirname(__FILE__));
+ define('JPATH_BASE', __DIR__);
require_once JPATH_BASE.'/includes/defines.php';
}
@@ -10,7 +10,7 @@
defined('_JEXEC') or die;
// Include the syndicate functions only once
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$rssurl = $params->get('rssurl', '');
$rssrtl = $params->get('rssrtl', 0);
@@ -10,7 +10,7 @@
defined('_JEXEC') or die;
// Include dependancies.
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$list = modLatestHelper::getList($params);
require JModuleHelper::getLayoutPath('mod_latest', $params->get('layout', 'default'));
@@ -10,7 +10,7 @@
defined('_JEXEC') or die;
// Include dependancies.
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$users = modLoggedHelper::getList($params);
require JModuleHelper::getLayoutPath('mod_logged', $params->get('layout', 'default'));
@@ -10,7 +10,7 @@
defined('_JEXEC') or die;
// Include the syndicate functions only once
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$langs = modLoginHelper::getLanguageList();
$return = modLoginHelper::getReturnURI();
@@ -10,12 +10,14 @@
defined('_JEXEC') or die;
// Include the module helper classes.
-if (!class_exists('ModMenuHelper')) {
- require dirname(__FILE__).'/helper.php';
+if (!class_exists('ModMenuHelper'))
+{
+ require __DIR__ . '/helper.php';
}
-if (!class_exists('JAdminCssMenu')) {
- require dirname(__FILE__).'/menu.php';
+if (!class_exists('JAdminCssMenu'))
+{
+ require __DIR__ . '/menu.php';
}
// Initialise variables.
@@ -10,7 +10,7 @@
defined('_JEXEC') or die;
// Include the mod_popular functions only once.
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
// Get module data.
$list = modPopularHelper::getList($params);
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$buttons = modQuickIconHelper::getButtons($params);
@@ -9,9 +9,9 @@
defined('_JEXEC') or die;
-// Include dependancies.
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
-if ($list = modSubmenuHelper::getItems()) {
+if ($list = modSubmenuHelper::getItems())
+{
require JModuleHelper::getLayoutPath('mod_submenu', $params->get('layout', 'default'));
}
@@ -9,7 +9,7 @@
defined('_JEXEC') or die;
-require_once dirname(__FILE__).'/helper.php';
+require_once __DIR__ . '/helper.php';
$version = modVersionHelper::getVersion($params);
@@ -9,4 +9,4 @@
defined('_JEXEC') or die;
-include dirname(__FILE__).DIRECTORY_SEPARATOR.'component.php';
+include __DIR__ . '/component.php';
View
@@ -16,14 +16,14 @@
const _JEXEC = 1;
// Load system defines
-if (file_exists(dirname(dirname(__FILE__)) . '/defines.php'))
+if (file_exists(dirname(__DIR__) . '/defines.php'))
{
- require_once dirname(dirname(__FILE__)) . '/defines.php';
+ require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
- define('JPATH_BASE', dirname(dirname(__FILE__)));
+ define('JPATH_BASE', dirname(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}
View
@@ -10,14 +10,14 @@
const _JEXEC = 1;
// Load system defines
-if (file_exists(dirname(dirname(__FILE__)) . '/defines.php'))
+if (file_exists(dirname(__DIR__) . '/defines.php'))
{
- require_once dirname(dirname(__FILE__)) . '/defines.php';
+ require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
- define('JPATH_BASE', dirname(dirname(__FILE__)));
+ define('JPATH_BASE', dirname(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}
Oops, something went wrong.

0 comments on commit a5c90d3

Please sign in to comment.