com web/php: Change dirname(__FILE__) to shorte r __DIR__: images/elephpants.php include/foot er.inc include/layout.inc manual/en/book.var.php
manual/en/class.exception.php manual/en/context.http. php manual/en/funcref.php manual/en/function.strpos.p hp manual/en/language.exceptions.php
manual/en/refs.b asic.vartype.php
| From: | Peter Kokot | Date: | Tue, 23 Oct 2018 15:30:55 +0000 |
| Subject: | com web/php: Change dirname(__FILE__) to shorte r __DIR__: images/elephpants.php include/foot er.inc include/layout.inc manual/en/book.var.php manual/en/class.exception.php manual/en/context.http. php manual/en/funcref.php manual/en/function.strpos.p hp manual/en/language.exceptions.php manual/en/refs.b asic.vartype.php |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-27385@lists.php.net to get a copy of this message | ||
Commit: b5edd2d17bc20ca361dfda7e5005fc12d1195f0c
Author: Peter Kokot <peterkokot@gmail.com> Tue, 23 Oct 2018 17:30:55 +0200
Parents: 29b30614a6942d57765d61b71a3b2e6c6a4d4a0c
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=b5edd2d17bc20ca361dfda7e5005fc12d1195f0c
Log:
Change dirname(__FILE__) to shorter __DIR__
Changed paths:
M images/elephpants.php
M include/footer.inc
M include/layout.inc
M manual/en/book.var.php
M manual/en/class.exception.php
M manual/en/context.http.php
M manual/en/funcref.php
M manual/en/function.strpos.php
M manual/en/language.exceptions.php
M manual/en/refs.basic.vartype.php
Diff:
diff --git a/images/elephpants.php b/images/elephpants.php
index 1563fdb..be39aa5 100644
--- a/images/elephpants.php
+++ b/images/elephpants.php
@@ -45,7 +45,7 @@ if (isset($_REQUEST['count'])) {
}
// read out photo metadata
-$path = dirname(__FILE__) . '/elephpants';
+$path = __DIR__ . '/elephpants';
$json = @file_get_contents($path . '/flickr.json');
$photos = json_decode($json, true);
diff --git a/include/footer.inc b/include/footer.inc
index e766001..698c92c 100644
--- a/include/footer.inc
+++ b/include/footer.inc
@@ -87,7 +87,7 @@
<?php
$jsfiles = array("ext/modernizr.js", "ext/hogan-2.0.0.min.js",
"ext/typeahead.min.js", "ext/mousetrap.min.js", "search.js",
"common.js");
foreach ($jsfiles as $filename) {
- $path = dirname(dirname(__FILE__)).'/js/'.$filename;
+ $path = dirname(__DIR__).'/js/'.$filename;
echo '<script type="text/javascript" src="/cached.php?t=' .
@filemtime($path) . '&f=/js/' . $filename .
'"></script>'."\n";
}
?>
diff --git a/include/layout.inc b/include/layout.inc
index 6ea12a9..a520d13 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -521,17 +521,17 @@ function site_header($title = '', $config = array())
$shorturl = "http://php.net/" . $shortname;
}
- require dirname(__FILE__) ."/header.inc";
+ require __DIR__ ."/header.inc";
}
function site_footer($config = array())
{
global $MYSITE;
- require dirname(__FILE__) . "/footer.inc";
+ require __DIR__ . "/footer.inc";
}
function get_news_changes()
{
- include dirname(__FILE__) . "/pregen-news.inc";
+ include __DIR__ . "/pregen-news.inc";
$date = date_create($NEWS_ENTRIES[0]["updated"]);
if (isset($_COOKIE["LAST_NEWS"]) && $_COOKIE["LAST_NEWS"] >=
$date->getTimestamp()) {
return false;
@@ -607,7 +607,7 @@ function get_usergroups_in($country, &$allcountries = array()) {
}
function news_toc($sections = null) {
- include dirname(__FILE__) . "/pregen-news.inc";
+ include __DIR__ . "/pregen-news.inc";
$items = array(
"news" => array(
"title" => "News",
@@ -640,12 +640,12 @@ function news_toc($sections = null) {
}
}
function doc_toc($lang) {
- $file = dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
+ $file = __DIR__ . "/../manual/$lang/toc/index.inc";
if (!file_exists($file)) {
$lang = "en"; // Fallback on english if the translation doesn't exist
- $file = dirname(__FILE__) . "/../manual/en/toc/index.inc";
+ $file = __DIR__ . "/../manual/en/toc/index.inc";
}
- require dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
+ require __DIR__ . "/../manual/$lang/toc/index.inc";
echo "<dl>\n";
doc_toc_list($lang, $TOC, "getting-started");
@@ -687,7 +687,7 @@ function doc_toc($lang) {
}
function doc_toc_list($lang, $index, $file) {
- include dirname(__FILE__) . "/../manual/$lang/toc/$file.inc";
+ include __DIR__ . "/../manual/$lang/toc/$file.inc";
doc_toc_title($lang, $index, $file);
foreach($TOC as $entry) {
diff --git a/manual/en/book.var.php b/manual/en/book.var.php
index 34ce538..085305b 100644
--- a/manual/en/book.var.php
+++ b/manual/en/book.var.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/refs.basic.vartype.inc";
+include_once __DIR__ ."/toc/refs.basic.vartype.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/class.exception.php b/manual/en/class.exception.php
index 765e8e4..13397d7 100644
--- a/manual/en/class.exception.php
+++ b/manual/en/class.exception.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/reserved.exceptions.inc";
+include_once __DIR__ ."/toc/reserved.exceptions.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/context.http.php b/manual/en/context.http.php
index 3fb0c4f..f7a3531 100644
--- a/manual/en/context.http.php
+++ b/manual/en/context.http.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/context.inc";
+include_once __DIR__ ."/toc/context.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/funcref.php b/manual/en/funcref.php
index ef6eec8..b22e8c1 100644
--- a/manual/en/funcref.php
+++ b/manual/en/funcref.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/index.inc";
+include_once __DIR__ ."/toc/index.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/function.strpos.php b/manual/en/function.strpos.php
index 25158aa..995867e 100644
--- a/manual/en/function.strpos.php
+++ b/manual/en/function.strpos.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] .. '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/ref.strings.inc";
+include_once __DIR__ ."/toc/ref.strings.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/language.exceptions.php b/manual/en/language.exceptions.php
index 64af0c4..5ea9cad 100644
--- a/manual/en/language.exceptions.php
+++ b/manual/en/language.exceptions.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual..inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/langref.inc";
+include_once __DIR__ ."/toc/langref.inc";
$setup = array (
'home' =>
array (
diff --git a/manual/en/refs.basic.vartype.php b/manual/en/refs.basic.vartype.php
index fe4725c..9a051ba 100644
--- a/manual/en/refs.basic.vartype.php
+++ b/manual/en/refs.basic.vartype.php
@@ -2,7 +2,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
-include_once dirname(__FILE__) ."/toc/funcref.inc";
+include_once __DIR__ ."/toc/funcref.inc";
$setup = array (
'home' =>
array (