Skip to content

Commit b5edd2d

Browse files
committed
Change dirname(__FILE__) to shorter __DIR__
1 parent 29b3061 commit b5edd2d

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

images/elephpants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646

4747
// read out photo metadata
48-
$path = dirname(__FILE__) . '/elephpants';
48+
$path = __DIR__ . '/elephpants';
4949
$json = @file_get_contents($path . '/flickr.json');
5050
$photos = json_decode($json, true);
5151

include/footer.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<?php
8888
$jsfiles = array("ext/modernizr.js", "ext/hogan-2.0.0.min.js", "ext/typeahead.min.js", "ext/mousetrap.min.js", "search.js", "common.js");
8989
foreach ($jsfiles as $filename) {
90-
$path = dirname(dirname(__FILE__)).'/js/'.$filename;
90+
$path = dirname(__DIR__).'/js/'.$filename;
9191
echo '<script type="text/javascript" src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>'."\n";
9292
}
9393
?>

include/layout.inc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,17 @@ function site_header($title = '', $config = array())
521521
$shorturl = "http://php.net/" . $shortname;
522522
}
523523

524-
require dirname(__FILE__) ."/header.inc";
524+
require __DIR__ ."/header.inc";
525525
}
526526
function site_footer($config = array())
527527
{
528528
global $MYSITE;
529-
require dirname(__FILE__) . "/footer.inc";
529+
require __DIR__ . "/footer.inc";
530530
}
531531

532532
function get_news_changes()
533533
{
534-
include dirname(__FILE__) . "/pregen-news.inc";
534+
include __DIR__ . "/pregen-news.inc";
535535
$date = date_create($NEWS_ENTRIES[0]["updated"]);
536536
if (isset($_COOKIE["LAST_NEWS"]) && $_COOKIE["LAST_NEWS"] >= $date->getTimestamp()) {
537537
return false;
@@ -607,7 +607,7 @@ function get_usergroups_in($country, &$allcountries = array()) {
607607
}
608608

609609
function news_toc($sections = null) {
610-
include dirname(__FILE__) . "/pregen-news.inc";
610+
include __DIR__ . "/pregen-news.inc";
611611
$items = array(
612612
"news" => array(
613613
"title" => "News",
@@ -640,12 +640,12 @@ function news_toc($sections = null) {
640640
}
641641
}
642642
function doc_toc($lang) {
643-
$file = dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
643+
$file = __DIR__ . "/../manual/$lang/toc/index.inc";
644644
if (!file_exists($file)) {
645645
$lang = "en"; // Fallback on english if the translation doesn't exist
646-
$file = dirname(__FILE__) . "/../manual/en/toc/index.inc";
646+
$file = __DIR__ . "/../manual/en/toc/index.inc";
647647
}
648-
require dirname(__FILE__) . "/../manual/$lang/toc/index.inc";
648+
require __DIR__ . "/../manual/$lang/toc/index.inc";
649649

650650
echo "<dl>\n";
651651
doc_toc_list($lang, $TOC, "getting-started");
@@ -687,7 +687,7 @@ function doc_toc($lang) {
687687

688688
}
689689
function doc_toc_list($lang, $index, $file) {
690-
include dirname(__FILE__) . "/../manual/$lang/toc/$file.inc";
690+
include __DIR__ . "/../manual/$lang/toc/$file.inc";
691691

692692
doc_toc_title($lang, $index, $file);
693693
foreach($TOC as $entry) {

manual/en/book.var.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/refs.basic.vartype.inc";
5+
include_once __DIR__ ."/toc/refs.basic.vartype.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/class.exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/reserved.exceptions.inc";
5+
include_once __DIR__ ."/toc/reserved.exceptions.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/context.http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/context.inc";
5+
include_once __DIR__ ."/toc/context.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/funcref.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/index.inc";
5+
include_once __DIR__ ."/toc/index.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/function.strpos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
5+
include_once __DIR__ ."/toc/ref.strings.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/language.exceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/langref.inc";
5+
include_once __DIR__ ."/toc/langref.inc";
66
$setup = array (
77
'home' =>
88
array (

manual/en/refs.basic.vartype.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
33
$TOC = array();
44
$PARENTS = array();
5-
include_once dirname(__FILE__) ."/toc/funcref.inc";
5+
include_once __DIR__ ."/toc/funcref.inc";
66
$setup = array (
77
'home' =>
88
array (

0 commit comments

Comments
 (0)