Skip to content

Commit

Permalink
Merge pull request #33 from soflyy/fix/import-images-singletone
Browse files Browse the repository at this point in the history
Allow import images function to be defined in singletone class
  • Loading branch information
trey8611 authored Jul 10, 2020
2 parents 7353eb5 + e946fec commit f23bd12
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rapid-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
}
/**
*
Expand Down

0 comments on commit f23bd12

Please sign in to comment.