Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Unix line feeds
Browse files Browse the repository at this point in the history
Change to Unix type line feeds in generated hash files
  • Loading branch information
mattyrob committed Sep 18, 2015
1 parent c7e71b5 commit dc02b0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions esahg/esahg.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ function hash_files( $files = array() ) {

global $download_to;
sort( $files );
$file_hashes = '<?php' . "\r\n" . '$filehashes = array(' . "\r\n";
$file_hashes = '<?php' . "\n" . '$filehashes = array(' . "\n";
foreach ( $files as $file ) {
$file_hashes .= "'" . str_replace( $download_to . '/wordpress/', '', $file ) . "' => '" . md5( $file ) . "',\r\n";
$file_hashes .= "'" . str_replace( $download_to . '/wordpress/', '', $file ) . "' => '" . md5( $file ) . "',\n";
}
$file_hashes .= ");\r\n?>";
$file_hashes .= ");\n?>";

return $file_hashes;
} // end hash_files()
8 changes: 4 additions & 4 deletions hashes-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
}
}

$hashes = '$filehashes = array(' . "\r\n";
$hashes = '$filehashes = array(' . "\n";
$zip = zip_open( getcwd() . '/' . $file );
if ( is_resource( $zip ) ) {
while ( $zip_entry = zip_read( $zip ) ) {
zip_entry_open( $zip, $zip_entry, 'r' );
$wp_file = zip_entry_read( $zip_entry, zip_entry_filesize( $zip_entry ) );
if ( substr( zip_entry_name( $zip_entry ), -1, 1 ) !== '/' && false === strstr( zip_entry_name( $zip_entry ), 'wp-content/plugins/' ) && false === strstr( zip_entry_name( $zip_entry ), 'wp-content/themes/' ) ) {
list( $wp, $filename ) = explode( '/', zip_entry_name( $zip_entry ), 2 );
$hashes .= "'" . $filename . "' => '" . md5( $wp_file ) . "',\r\n";
$hashes .= "'" . $filename . "' => '" . md5( $wp_file ) . "',\n";
}
zip_entry_close( $zip_entry );
}
Expand All @@ -38,11 +38,11 @@
}

if ( 'cli' === php_sapi_name() ) {
print '<?php' . "\r\n" . $hashes . ");\r\n?>";
print '<?php' . "\r\n" . $hashes . ");\n?>";
} else {
echo 'Hashes for ' . $file;
echo '<pre>';
echo '&lt;?php' . "\r\n" . $hashes . ");\r\n?>";;
echo '&lt;?php' . "\r\n" . $hashes . ");\n?>";
echo '</pre>';
}
}

0 comments on commit dc02b0c

Please sign in to comment.