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(
'image_size_names_choose',
array($this, 'appendImageSize'),
10, 1
);
}
function appendImageSize($sizes) {
return array_merge($sizes, array( return array_merge($sizes, array(
'mailpoet_newsletter_max' => __('MailPoet Newsletter') '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',
array($this, 'setScreenOption'),
10, 3
);
}
function setScreenOption($status, $option, $value) {
if(preg_match('/^mailpoet_(.*)_per_page$/', $option)) { if(preg_match('/^mailpoet_(.*)_per_page$/', $option)) {
return $value; return $value;
} else { } else {
return $status; return $status;
} }
}, 10, 3);
} }
} }