From 9e2efb6029a6d98dbed7d8a98779514a67d40954 Mon Sep 17 00:00:00 2001 From: ozh Date: Mon, 17 Apr 2017 23:03:37 +0200 Subject: [PATCH] Use __DIR__ instead of dirname(__FILE__) --- admin/admin-ajax.php | 2 +- admin/index.php | 2 +- admin/install.php | 2 +- admin/plugins.php | 2 +- admin/tools.php | 2 +- admin/upgrade.php | 2 +- includes/functions-http.php | 2 +- includes/functions-l10n.php | 4 ++-- includes/load-yourls.php | 10 +++++----- includes/pomo/mo.php | 4 ++-- includes/pomo/po.php | 2 +- includes/pomo/translations.php | 2 +- user/plugins/random-bg/plugin.php | 4 ++-- user/plugins/sample-toolbar/plugin.php | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/admin/admin-ajax.php b/admin/admin-ajax.php index ba31536..a89912e 100644 --- a/admin/admin-ajax.php +++ b/admin/admin-ajax.php @@ -1,7 +1,7 @@ Cannot find config.php.

Please read the readme.html to learn how to install YOURLS

' ); @@ -23,7 +23,7 @@ if( !defined( 'YOURLS_DB_PREFIX' ) ) // physical path of YOURLS root if( !defined( 'YOURLS_ABSPATH' ) ) - define( 'YOURLS_ABSPATH', str_replace( '\\', '/', dirname( dirname( __FILE__ ) ) ) ); + define( 'YOURLS_ABSPATH', str_replace( '\\', '/', dirname( __DIR__ ) ) ); // physical path of includes directory if( !defined( 'YOURLS_INC' ) ) diff --git a/includes/pomo/mo.php b/includes/pomo/mo.php index a206da1..6937408 100644 --- a/includes/pomo/mo.php +++ b/includes/pomo/mo.php @@ -7,8 +7,8 @@ * @subpackage mo */ -require_once dirname(__FILE__) . '/translations.php'; -require_once dirname(__FILE__) . '/streams.php'; +require_once __DIR__ . '/translations.php'; +require_once __DIR__ . '/streams.php'; if ( !class_exists( 'MO', false ) ): class MO extends Gettext_Translations { diff --git a/includes/pomo/po.php b/includes/pomo/po.php index 6082d7a..f565748 100644 --- a/includes/pomo/po.php +++ b/includes/pomo/po.php @@ -7,7 +7,7 @@ * @subpackage po */ -require_once dirname(__FILE__) . '/translations.php'; +require_once __DIR__ . '/translations.php'; define('PO_MAX_LINE_LEN', 79); diff --git a/includes/pomo/translations.php b/includes/pomo/translations.php index 9bbd65a..4081ebc 100644 --- a/includes/pomo/translations.php +++ b/includes/pomo/translations.php @@ -7,7 +7,7 @@ * @subpackage translations */ -require_once dirname(__FILE__) . '/entry.php'; +require_once __DIR__ . '/entry.php'; if ( !class_exists( 'Translations', false ) ): class Translations { diff --git a/user/plugins/random-bg/plugin.php b/user/plugins/random-bg/plugin.php index e0c1ef1..a6768ff 100644 --- a/user/plugins/random-bg/plugin.php +++ b/user/plugins/random-bg/plugin.php @@ -14,8 +14,8 @@ if( !defined( 'YOURLS_ABSPATH' ) ) die(); // Add the inline style yourls_add_action( 'html_head', 'ozh_yourls_randombg' ); function ozh_yourls_randombg() { - $bg = glob( dirname( __FILE__ ).'/img/*png' ); - $url = yourls_plugin_url( dirname( __FILE__ ) ); + $bg = glob( __DIR__.'/img/*png' ); + $url = yourls_plugin_url( __DIR__ ); $rnd = yourls_plugin_url( $bg[ mt_rand( 0, count( $bg ) - 1 ) ] ); echo << diff --git a/user/plugins/sample-toolbar/plugin.php b/user/plugins/sample-toolbar/plugin.php index ed0745c..2467bb9 100644 --- a/user/plugins/sample-toolbar/plugin.php +++ b/user/plugins/sample-toolbar/plugin.php @@ -67,7 +67,7 @@ function ozh_toolbar_do( $args ) { $hits = $hits . ' ' . yourls_n( 'view', 'views', $hits ); // Plugin URL (no URL is hardcoded) - $pluginurl = YOURLS_PLUGINURL . '/'.yourls_plugin_basename( dirname(__FILE__) ); + $pluginurl = YOURLS_PLUGINURL . '/'.yourls_plugin_basename( __DIR__ ); // All set. Draw the toolbar itself. echo <<