| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Converter. | |
| 4 | + * bbPress Converter | |
| 5 | 5 | * |
| 6 | - * Based on the hard work of Adam Ellis. | |
| 6 | + * Based on the hard work of Adam Ellis | |
| 7 | 7 | * |
| 8 | 8 | * @package bbPress |
| 9 | 9 | * @subpackage Administration |
| 10 | 10 | */ |
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | // Exit if accessed directly |
| 13 | 13 | defined( 'ABSPATH' ) || exit; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Return an array of available converters. | |
| 16 | + * Return an array of available converters | |
| 17 | 17 | * |
| 18 | 18 | * @since 2.6.0 bbPress (r6447) |
| 19 | 19 | * |
| 20 | 20 | * @return array |
| @@ -30,10 +30,8 @@ | ||
| 30 | 30 | $curdir = opendir( $path ); |
| 31 | 31 | |
| 32 | 32 | // Look for the converter file in the converters directory |
| 33 | 33 | if ( false !== $curdir ) { |
| 34 | - | |
| 35 | - // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition | |
| 36 | 34 | while ( $file = readdir( $curdir ) ) { |
| 37 | 35 | if ( stristr( $file, '.php' ) && stristr( $file, 'index' ) === false ) { |
| 38 | 36 | $name = preg_replace( '/.php/', '', $file ); |
| 39 | 37 | if ( 'Example' !== $name ) { |
| @@ -51,15 +49,9 @@ | ||
| 51 | 49 | natcasesort( $files ); |
| 52 | 50 | } |
| 53 | 51 | } |
| 54 | 52 | |
| 55 | - /** | |
| 56 | - * Filters the array of available converters. | |
| 57 | - * | |
| 58 | - * @since 2.6.0 bbPress (r6447) | |
| 59 | - * | |
| 60 | - * @param array $files Array of available converters with names as keys and file paths as values. | |
| 61 | - */ | |
| 53 | + // Filter & return | |
| 62 | 54 | return (array) apply_filters( 'bbp_get_converters', $files ); |
| 63 | 55 | } |
| 64 | 56 | |
| 65 | 57 | /** |
| @@ -94,9 +86,8 @@ | ||
| 94 | 86 | // Try to create a new converter object |
| 95 | 87 | if ( ! empty( $converter_file ) ) { |
| 96 | 88 | |
| 97 | 89 | // Try to include the converter |
| 98 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged | |
| 99 | 90 | @include_once $converter_file; |
| 100 | 91 | |
| 101 | 92 | // Try to instantiate the converter object |
| 102 | 93 | if ( class_exists( $platform ) ) { |
| @@ -103,14 +94,7 @@ | ||
| 103 | 94 | $converter = new $platform(); |
| 104 | 95 | } |
| 105 | 96 | } |
| 106 | 97 | |
| 107 | - /** | |
| 108 | - * Filters the newly created converter object. | |
| 109 | - * | |
| 110 | - * @since 2.0.0 | |
| 111 | - * | |
| 112 | - * @param mixed $converter The converter object if it exists, null otherwise. | |
| 113 | - * @param string $platform Name of the platform class used for conversion. | |
| 114 | - */ | |
| 98 | + // Filter & return | |
| 115 | 99 | return apply_filters( 'bbp_new_converter', $converter, $platform ); |
| 116 | 100 | } |