summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRaimondas Rimkevičius <github@mekdrop.name>2022-09-27 13:03:34 +0300
committerGitHub <noreply@github.com>2022-09-27 12:03:34 +0200
commit1b556c7077c57b94e2cec093a0877c9d4d571188 (patch)
tree31cab7e615b37a49a7d31eca7e075e44f938025c /libs
parent4550fc03391bd120b4add41ad7934c4c59aa21e8 (diff)
downloadsmarty-1b556c7077c57b94e2cec093a0877c9d4d571188.tar.gz
smarty-1b556c7077c57b94e2cec093a0877c9d4d571188.tar.bz2
smarty-1b556c7077c57b94e2cec093a0877c9d4d571188.zip
Use __DIR__ instead of dirname(__FILE__) (#817)
Diffstat (limited to 'libs')
-rw-r--r--libs/Autoloader.php4
-rw-r--r--libs/Smarty.class.php6
-rw-r--r--libs/bootstrap.php2
-rw-r--r--libs/sysplugins/smarty_internal_debug.php4
-rw-r--r--libs/sysplugins/smarty_internal_testinstall.php2
5 files changed, 9 insertions, 9 deletions
diff --git a/libs/Autoloader.php b/libs/Autoloader.php
index c2081403..da7e32ab 100644
--- a/libs/Autoloader.php
+++ b/libs/Autoloader.php
@@ -7,7 +7,7 @@
if (!defined('SMARTY_HELPER_FUNCTIONS_LOADED')) {
- include dirname(__FILE__) . '/functions.php';
+ include __DIR__ . '/functions.php';
}
/**
@@ -78,7 +78,7 @@ class Smarty_Autoloader
*/
public static function register($prepend = false)
{
- self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
+ self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : __DIR__ . DIRECTORY_SEPARATOR;
self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 5507ebcd..22ea0c31 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -36,7 +36,7 @@ if (!defined('SMARTY_DIR')) {
/**
*
*/
- define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+ define('SMARTY_DIR', __DIR__ . DIRECTORY_SEPARATOR);
}
/**
* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
@@ -65,14 +65,14 @@ if (!defined('SMARTY_MBSTRING')) {
* Load helper functions
*/
if (!defined('SMARTY_HELPER_FUNCTIONS_LOADED')) {
- include dirname(__FILE__) . '/functions.php';
+ include __DIR__ . '/functions.php';
}
/**
* Load Smarty_Autoloader
*/
if (!class_exists('Smarty_Autoloader')) {
- include dirname(__FILE__) . '/bootstrap.php';
+ include __DIR__ . '/bootstrap.php';
}
/**
diff --git a/libs/bootstrap.php b/libs/bootstrap.php
index 2c830468..a226ac04 100644
--- a/libs/bootstrap.php
+++ b/libs/bootstrap.php
@@ -11,6 +11,6 @@
* Load and register Smarty Autoloader
*/
if (!class_exists('Smarty_Autoloader')) {
- include dirname(__FILE__) . '/Autoloader.php';
+ include __DIR__ . '/Autoloader.php';
}
Smarty_Autoloader::register(true);
diff --git a/libs/sysplugins/smarty_internal_debug.php b/libs/sysplugins/smarty_internal_debug.php
index 24b233e2..570819d2 100644
--- a/libs/sysplugins/smarty_internal_debug.php
+++ b/libs/sysplugins/smarty_internal_debug.php
@@ -210,7 +210,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
// copy the working dirs from application
$debObj->setCompileDir($smarty->getCompileDir());
// init properties by hand as user may have edited the original Smarty class
- $debObj->setPluginsDir(is_dir(dirname(__FILE__) . '/../plugins') ? dirname(__FILE__) .
+ $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ .
'/../plugins' : $smarty->getPluginsDir());
$debObj->force_compile = false;
$debObj->compile_check = Smarty::COMPILECHECK_ON;
@@ -221,7 +221,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
$debObj->debugging_ctrl = 'NONE';
$debObj->error_reporting = E_ALL & ~E_NOTICE;
$debObj->debug_tpl =
- isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . dirname(__FILE__) . '/../debug.tpl';
+ isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
$debObj->registered_plugins = array();
$debObj->registered_resources = array();
$debObj->registered_filters = array();
diff --git a/libs/sysplugins/smarty_internal_testinstall.php b/libs/sysplugins/smarty_internal_testinstall.php
index 1fac79b7..c8ffd4cc 100644
--- a/libs/sysplugins/smarty_internal_testinstall.php
+++ b/libs/sysplugins/smarty_internal_testinstall.php
@@ -144,7 +144,7 @@ class Smarty_Internal_TestInstall
}
// test if all registered plugins_dir are accessible
// and if core plugins directory is still registered
- $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins');
+ $_core_plugins_dir = realpath(__DIR__ . '/../plugins');
$_core_plugins_available = false;
foreach ($smarty->getPluginsDir() as $plugin_dir) {
$_plugin_dir = $plugin_dir;