function mbdbif_fix_images($images, $restore) { $errors = array(); foreach ($images as $image) { $error = array(); switch ($image) { case 'coming-soon': case 'goodreads': $error = mbdbif_fix_single_image($image, $restore); break; case 'retailers': if (function_exists('mbdb_get_default_retailers')) { $defaults = mbdb_get_default_retailers(); } else { $defaults = mbdbma_get_default_retailers(); } $error = mbdbif_fix_multiple_images($image, $defaults, $restore); break; case 'formats': if (function_exists('mbdb_get_default_formats')) { $defaults = mbdb_get_default_formats(); } else { $defaults = mbdbma_get_default_formats(); } $error = mbdbif_fix_multiple_images($image, $defaults, $restore); break; } $errors = array_merge($errors, $error); } if (count($errors) > 0) { $message = __('The following images were not able to be fixed:', 'mooberry-book-manager-image-fixer'); $message .= '<ul>'; foreach ($errors as $error) { $message .= '<li>' . $error . '</li>'; } $message .= '</ul>'; $class = 'error'; } else { $class = 'updated'; $message = __('Images updated!', 'mooberry-book-manager-image-fixer'); } add_settings_error('mbdbif_options-notices', '', $message, $class); settings_errors('mbdbif_options-notices'); }
function mbdb_insert_default_formats(&$mbdb_options) { $default_formats = mbdb_get_default_formats(); mbdb_insert_defaults($default_formats, 'formats', $mbdb_options); }