replaced closure by callbacks

This commit is contained in:
Jonathan Labreuille
2016-02-17 13:02:35 +01:00
parent 9b1503dc7a
commit 31a4575d43

View File

@ -116,21 +116,32 @@ class Hooks {
} }
function setupImageSize() { function setupImageSize() {
add_filter('image_size_names_choose', function($sizes) { add_filter(
return array_merge($sizes, array( 'image_size_names_choose',
'mailpoet_newsletter_max' => __('MailPoet Newsletter') array($this, 'appendImageSize'),
)); 10, 1
}); );
}
function appendImageSize($sizes) {
return array_merge($sizes, array(
'mailpoet_newsletter_max' => __('MailPoet Newsletter')
));
} }
function setupListing() { function setupListing() {
// handle saving "per_page" screen option add_filter(
add_filter('set-screen-option', function($status, $option, $value) { 'set-screen-option',
if(preg_match('/^mailpoet_(.*)_per_page$/', $option)) { array($this, 'setScreenOption'),
return $value; 10, 3
} else { );
return $status; }
}
}, 10, 3); function setScreenOption($status, $option, $value) {
if(preg_match('/^mailpoet_(.*)_per_page$/', $option)) {
return $value;
} else {
return $status;
}
} }
} }