@@ -36,35 +36,56 @@ public function register() {
3636 * Differently from the `register` method this method will not check for options to hook.
3737 */
3838 public function hook () {
39- add_action ( 'load-post.php ' , function () {
40- return ContentImporter::instance ()->handle_import ();
41- } );
42- add_action ( 'load-post.php ' , function () {
43- add_action ( 'admin_notices ' , function () {
44- AdminNoticeLogger::instance ()->show_last_log ();
45- } );
46- } );
47- add_action ( 'load-post-new.php ' , function () {
48- return ContentImporter::instance ()->handle_import ();
49- } );
50- add_filter ( 'wp_insert_post_empty_content ' , function ( $ empty ) {
51- return ContentImporter::instance ()->filter_empty ( $ empty );
52- } );
53- add_filter ( 'wp_get_attachment_url ' , function ( $ url , $ post_id ) {
54- return AttachmentPathFinder::instance ()->filter_attachment_url ( $ url , $ post_id );
55- }, 99 , 2 );
56- add_filter ( 'wp_calculate_image_srcset ' ,
39+ add_action (
40+ 'load-post.php ' ,
41+ function () {
42+ return ContentImporter::instance ()->handle_import ();
43+ }
44+ );
45+ add_action (
46+ 'load-post.php ' ,
47+ function () {
48+ add_action (
49+ 'admin_notices ' ,
50+ function () {
51+ AdminNoticeLogger::instance ()->show_last_log ();
52+ }
53+ );
54+ }
55+ );
56+ add_action (
57+ 'load-post-new.php ' ,
58+ function () {
59+ return ContentImporter::instance ()->handle_import ();
60+ }
61+ );
62+ add_filter (
63+ 'wp_insert_post_empty_content ' ,
64+ function ( $ empty ) {
65+ return ContentImporter::instance ()->filter_empty ( $ empty );
66+ }
67+ );
68+ add_filter (
69+ 'wp_get_attachment_url ' ,
70+ function ( $ url , $ post_id ) {
71+ return AttachmentPathFinder::instance ()->filter_attachment_url ( $ url , $ post_id );
72+ },
73+ 99 ,
74+ 2
75+ );
76+ add_filter (
77+ 'wp_calculate_image_srcset ' ,
5778 function ( $ sources , $ sizeArray , $ imageSrc , $ imageMeta , $ attachmentId ) {
58- return AttachmentPathFinder::instance ()->filter_srcset ( $ sources ,
79+ return AttachmentPathFinder::instance ()->filter_srcset (
80+ $ sources ,
5981 $ sizeArray ,
6082 $ imageSrc ,
6183 $ imageMeta ,
62- $ attachmentId );
84+ $ attachmentId
85+ );
6386 },
6487 99 ,
65- 5 );
66-
67- if ( is_admin () ) {
68- }
88+ 5
89+ );
6990 }
70- }
91+ }
0 commit comments