[wp-trac] [WordPress Trac] #22538: 'wp_image_editor_class' vs. 'wp_image_editors'
WordPress Trac
noreply at wordpress.org
Thu Nov 22 18:41:22 UTC 2012
#22538: 'wp_image_editor_class' vs. 'wp_image_editors'
--------------------------+--------------------
Reporter: scribu | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.5
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback |
--------------------------+--------------------
Comment (by scribu):
Here's what I had in mind:
{{{
class My_Image_Editor_Decorator {
function __construct( $editor ) {
$this->editor = $editor;
}
// Proxy all methods we're not interested in changing
function __call( $method, $args ) {
return call_user_func_array( array( $this->editor, $method
), $args );
}
function resize( $max_w, $max_h, $crop ) {
// Custom functionality goes here
return $this->editor->resize( $max_w, $max_h, $crop );
}
}
function my_image_editor_decorate( $instance, $args ) {
return new My_Image_Editor_Decorator( $instance );
}
add_filter( 'wp_image_editor_instance', 'my_image_editor_init', 10, 2 );
}}}
Now to see if we could use 'wp_image_editor_instance' in the unit tests
instead of 'wp_image_editor_class'.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22538#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list