secret
Created

WP_Image_Editor choosing implementation

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?php
 
class WP_Image_Editor {
 
final public static function get_instance( $path ) {
$implementation = apply_filters( 'image_editor_class', self::choose_implementation(), $path );
 
if ( $implementation )
return new $implementation( $path );
 
return false;
}
 
// Chooses the best available image handling library available
private static function choose_implementation() {
static $implementation;
 
if ( null === $implementation ) {
// actual logic for setting $implementation goes here
 
...
}
 
return $implementation;
}
 
...
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.