From e946fec5c647e01c272c5ebb70a959ca14c8c1f0 Mon Sep 17 00:00:00 2001 From: Maksym Tsypliakov Date: Sun, 5 Jul 2020 18:50:19 +0200 Subject: [PATCH] Allow import images function to be defined in singletone class --- rapid-addon.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rapid-addon.php b/rapid-addon.php index 8fd178d..dd782b1 100644 --- a/rapid-addon.php +++ b/rapid-addon.php @@ -896,7 +896,11 @@ function import_images( $slug, $title, $type = 'images' ){ if ( empty($title) or empty($slug) ) return; - $section_slug = 'pmxi_' . $slug; + if (is_array($slug)) { + $section_slug = 'pmxi_' . md5(serialize($slug)); + } else { + $section_slug = 'pmxi_' . $slug; + } $this->image_sections[] = array( 'title' => $title, @@ -914,7 +918,9 @@ function import_images( $slug, $title, $type = 'images' ){ add_filter('wp_all_import_is_allow_import_images', array($this, 'is_allow_import_images'), 10, 2); - if (function_exists($slug)) add_action( $section_slug, $slug, 10, 4); + if (is_callable($slug)) { + add_action( $section_slug, $slug, 10, 4); + } } /** *