Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6: Apply coding style guide PSR 1 and PSR 2 to ./modules/about (with…
… php-cs-fixer)
- Loading branch information
1 parent
abe8ce6
commit 65daf6a
Showing
5 changed files
with
63 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,3 @@ | |
|
||
$dsp->AddBackButton("index.php?mod=about", "about/credits"); | ||
$dsp->AddContent(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,58 @@ | ||
<?php | ||
|
||
$dir = "."; | ||
$dir = "."; | ||
|
||
function lets_open_the_dir( $dir ) { | ||
global $files; | ||
|
||
// Open the design-dir | ||
$thedir = opendir( $dir ); | ||
|
||
// Reading all subdirs from design and fill them into an array | ||
while( false !== ( $content = readdir($thedir) ) ) { | ||
if( $content != "." AND $content != ".." ) { | ||
if( is_dir( $dir."/".$content ) ) { | ||
lets_open_the_dir( $dir."/".$content ); | ||
} | ||
if( file_exists($dir."/".$content) ) { | ||
$files[] = $dir."/".$content; | ||
} | ||
} | ||
} | ||
} | ||
function get_the_lines_and_chars( $file ) { | ||
$file_content = file( $file ); | ||
$data[0] = count($file_content); | ||
for( $i=0; $i < count($file_content); $i++ ) { | ||
$data[1] += strlen( $file_content[$i] ); | ||
} | ||
return $data; | ||
} | ||
|
||
lets_open_the_dir( $dir ); | ||
|
||
foreach ( $files as $file ) { | ||
if( eregi( ".php", $file ) ) { | ||
$data = get_the_lines_and_chars( $file ); | ||
$php_lines += $data[0]; | ||
$php_chars += $data[1]; | ||
} | ||
if( eregi( ".htm", $file ) ) { | ||
$data = get_the_lines_and_chars( $file ); | ||
$html_lines += $data[0]; | ||
$html_chars += $data[1]; | ||
} | ||
} | ||
|
||
$filecontents = file( "modules/about/credits.php" ); | ||
$fo = fopen( "modules/about/credits.php", "w" ); | ||
foreach ( $filecontents as $filecontent ) { | ||
$filecontent = eregi_replace( "<!--PHP-LINES-START-->(.*)<!--PHP-LINES-STOP-->", "<!--PHP-LINES-START-->$php_lines<!--PHP-LINES-STOP-->", $filecontent ); | ||
$filecontent = eregi_replace( "<!--PHP-CHARS-START-->(.*)<!--PHP-CHARS-STOP-->", "<!--PHP-CHARS-START-->$php_chars<!--PHP-CHARS-STOP-->", $filecontent ); | ||
$filecontent = eregi_replace( "<!--HTML-LINES-START-->(.*)<!--HTML-LINES-STOP-->", "<!--HTML-LINES-START-->$html_lines<!--HTML-LINES-STOP-->", $filecontent ); | ||
$filecontent = eregi_replace( "<!--HTML-CHARS-START-->(.*)<!--HTML-CHARS-STOP-->", "<!--HTML-CHARS-START-->$html_chars<!--HTML-CHARS-STOP-->", $filecontent ); | ||
fwrite( $fo, $filecontent ); | ||
} | ||
fclose( $fo ); | ||
|
||
|
||
?> | ||
function lets_open_the_dir($dir) | ||
{ | ||
global $files; | ||
|
||
// Open the design-dir | ||
$thedir = opendir($dir); | ||
|
||
// Reading all subdirs from design and fill them into an array | ||
while (false !== ($content = readdir($thedir))) { | ||
if ($content != "." and $content != "..") { | ||
if (is_dir($dir."/".$content)) { | ||
lets_open_the_dir($dir."/".$content); | ||
} | ||
if (file_exists($dir."/".$content)) { | ||
$files[] = $dir."/".$content; | ||
} | ||
} | ||
} | ||
} | ||
function get_the_lines_and_chars($file) | ||
{ | ||
$file_content = file($file); | ||
$data[0] = count($file_content); | ||
for ($i=0; $i < count($file_content); $i++) { | ||
$data[1] += strlen($file_content[$i]); | ||
} | ||
return $data; | ||
} | ||
|
||
lets_open_the_dir($dir); | ||
|
||
foreach ($files as $file) { | ||
if (eregi(".php", $file)) { | ||
$data = get_the_lines_and_chars($file); | ||
$php_lines += $data[0]; | ||
$php_chars += $data[1]; | ||
} | ||
if (eregi(".htm", $file)) { | ||
$data = get_the_lines_and_chars($file); | ||
$html_lines += $data[0]; | ||
$html_chars += $data[1]; | ||
} | ||
} | ||
|
||
$filecontents = file("modules/about/credits.php"); | ||
$fo = fopen("modules/about/credits.php", "w"); | ||
foreach ($filecontents as $filecontent) { | ||
$filecontent = eregi_replace("<!--PHP-LINES-START-->(.*)<!--PHP-LINES-STOP-->", "<!--PHP-LINES-START-->$php_lines<!--PHP-LINES-STOP-->", $filecontent); | ||
$filecontent = eregi_replace("<!--PHP-CHARS-START-->(.*)<!--PHP-CHARS-STOP-->", "<!--PHP-CHARS-START-->$php_chars<!--PHP-CHARS-STOP-->", $filecontent); | ||
$filecontent = eregi_replace("<!--HTML-LINES-START-->(.*)<!--HTML-LINES-STOP-->", "<!--HTML-LINES-START-->$html_lines<!--HTML-LINES-STOP-->", $filecontent); | ||
$filecontent = eregi_replace("<!--HTML-CHARS-START-->(.*)<!--HTML-CHARS-STOP-->", "<!--HTML-CHARS-START-->$html_chars<!--HTML-CHARS-STOP-->", $filecontent); | ||
fwrite($fo, $filecontent); | ||
} | ||
fclose($fo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters