| @@ 1004-1020 (lines=17) @@ | ||
| 1001 | * @return bool|string False if no such file exists, otherwise returns |
|
| 1002 | * a path to it. |
|
| 1003 | */ |
|
| 1004 | public static function getExtAuthorsFileName( $extDir ) { |
|
| 1005 | if ( !$extDir ) { |
|
| 1006 | return false; |
|
| 1007 | } |
|
| 1008 | ||
| 1009 | foreach ( scandir( $extDir ) as $file ) { |
|
| 1010 | $fullPath = $extDir . DIRECTORY_SEPARATOR . $file; |
|
| 1011 | if ( preg_match( '/^((AUTHORS)|(CREDITS))(\.txt|\.wiki|\.mediawiki)?$/', $file ) && |
|
| 1012 | is_readable( $fullPath ) && |
|
| 1013 | is_file( $fullPath ) |
|
| 1014 | ) { |
|
| 1015 | return $fullPath; |
|
| 1016 | } |
|
| 1017 | } |
|
| 1018 | ||
| 1019 | return false; |
|
| 1020 | } |
|
| 1021 | ||
| 1022 | /** |
|
| 1023 | * Obtains the full path of an extensions copying or license file if |
|
| @@ 1033-1049 (lines=17) @@ | ||
| 1030 | * @return bool|string False if no such file exists, otherwise returns |
|
| 1031 | * a path to it. |
|
| 1032 | */ |
|
| 1033 | public static function getExtLicenseFileName( $extDir ) { |
|
| 1034 | if ( !$extDir ) { |
|
| 1035 | return false; |
|
| 1036 | } |
|
| 1037 | ||
| 1038 | foreach ( scandir( $extDir ) as $file ) { |
|
| 1039 | $fullPath = $extDir . DIRECTORY_SEPARATOR . $file; |
|
| 1040 | if ( preg_match( '/^((COPYING)|(LICENSE))(\.txt)?$/', $file ) && |
|
| 1041 | is_readable( $fullPath ) && |
|
| 1042 | is_file( $fullPath ) |
|
| 1043 | ) { |
|
| 1044 | return $fullPath; |
|
| 1045 | } |
|
| 1046 | } |
|
| 1047 | ||
| 1048 | return false; |
|
| 1049 | } |
|
| 1050 | ||
| 1051 | /** |
|
| 1052 | * Convert an array of items into a list for display. |
|