function wpmc_check_in_gallery($file) { $images = wpmc_get_galleries_images(); foreach ($images as $image) { if (strpos($image, $file) !== false) { return true; } } return false; }
function wpmc_check_in_gallery($file) { $file = wpmc_clean_uploaded_filename($file); $images = wpmc_get_galleries_images(); foreach ($images as $image) { if (strpos($image, $file) !== false) { //error_log("{$file} found in GALLERY"); return true; } } return false; }
function wpmc_check_in_gallery($file) { global $wpmc_debug; $file = wpmc_clean_uploaded_filename($file); $uploads = wp_upload_dir(); $parsedURL = parse_url($uploads['baseurl']); $regex_match_file = '(' . preg_quote($file) . ')'; $regex = addcslashes('(?:(?:http(?:s)?\\:)?//' . preg_quote($parsedURL['host']) . ')?' . preg_quote($parsedURL['path']) . '/' . $regex_match_file, '/'); $images = wpmc_get_galleries_images(); foreach ($images as $image) { $found = preg_match('/' . $regex . '/i', $image); if ($wpmc_debug && $found) { error_log("{$file} found in GALLERY"); } if ($found) { return true; } } return false; }