roles) && !current_user_can('export'); } if ($noCapabilitiesNotice) { $notices[] = array(__CLASS__, 'showNoExportCapabilityNotice'); } if (is_multisite()) { $displayNotices = is_super_admin() && current_user_can('export'); } else { $displayNotices = current_user_can('export'); } if ($displayNotices) { $notices[] = array(__CLASS__, 'clearInstallerFilesAction'); // BEFORE MIGRATION SUCCESS NOTICE $notices[] = array(__CLASS__, 'migrationSuccessNotice'); $notices[] = array(__CLASS__, 'addonInitFailNotice'); $notices[] = array('DUP_PRO_UI_Alert', 'activatePluginsAfterInstall'); } /* @var $system_global DUP_PRO_System_Global_Entity */ $system_global = \DUP_PRO_System_Global_Entity::get_instance(); if (count($system_global->recommended_fixes) > 0) { foreach ($system_global->recommended_fixes as $fix) { /* @var $fix \DUP_PRO_Recommended_Fix */ if ($fix->recommended_fix_type === \DUP_PRO_Recommended_Fix_Type::Text || $fix->recommended_fix_type === \DUP_PRO_Recommended_Fix_Type::QuickFix) { $notices[] = array(__CLASS__, 'showQuickFixNotice'); } } } if ($system_global->schedule_failed) { $notices[] = array(__CLASS__, 'showFailedSchedule'); } $action = is_multisite() ? 'network_admin_notices' : 'admin_notices'; foreach ($notices as $notice) { add_action($action, $notice); } } public static function addonInitFailNotice() { if (\Duplicator\Core\Addons\AddonsManager::getInstance()->isAddonsReady()) { return; } ob_start(); ?> Duplicator Pro

Duplicator Pro
Your logged-in user role does not have export capability so you don\'t have access to Duplicator Pro functionality.') . "
" . sprintf(DUP_PRO_U::__('RECOMMENDATION: Add export capability to your role. See FAQ: %s'), 'https://snapcreek.com/duplicator/docs/faqs-tech/#faq-licensing-040-q', DUP_PRO_U::__('Why is the Duplicator/Packages menu missing from my admin menu?')); DUP_PRO_UI_Notice::displayGeneralAdminNotice($errorMessage, DUP_PRO_UI_Notice::GEN_ERROR_NOTICE, true); } /** * Shows the scheduled failed alert */ public static function showFailedSchedule() { $img_url = plugins_url('duplicator-pro/assets/img/warning.png'); $clear_url = DupProSnapLibURLU::getCurrentUrl(); $clear_url = DupProSnapLibURLU::appendQueryValue($clear_url, 'dup_pro_clear_schedule_failure', 1); $html = "" . sprintf(DUP_PRO_U::esc_html__('%sWarning! A Duplicator Pro scheduled backup has failed.%s'), '', '
') . sprintf(DUP_PRO_U::esc_html__('This message will continue to be displayed until a %sscheduled build%s successfully runs. '), "", ' ') . sprintf(DUP_PRO_U::esc_html__('To ignore and clear this message %sclick here%s'), "", '.
'); self::displayGeneralAdminNotice( $html, self::GEN_WARNING_NOTICE, true, array( 'duplicator-pro-admin-notice', 'dpro-admin-notice', 'dup-pro-quick-fix-notice' ), array( 'data-to-dismiss' => self::FAILED_SCHEDULE_NOTICE ) ); } public static function showQuickFixNotice() { if (!ControllersManager::isCurrentPage(ControllersManager::PACKAGES_SUBMENU_SLUG)) { return; } $system_global = \DUP_PRO_System_Global_Entity::get_instance(); $html = ' ' . DUP_PRO_U::__('Duplicator Pro Quick Fix') . '
'; $html .= '' . DUP_PRO_U::__('Error(s) Detected:') . ' '; $html .= DUP_PRO_U::__('Please perform the actions below then build the package again.') . "
"; foreach ($system_global->recommended_fixes as $fix) { if ($fix->recommended_fix_type == DUP_PRO_Recommended_Fix_Type::Text) { $html .= "  " . $fix->parameter1 . "
"; } else if ($fix->recommended_fix_type == DUP_PRO_Recommended_Fix_Type::QuickFix) { $html .= '' . '' . '  ' . $fix->parameter1 . '' . '
'; } } self::displayGeneralAdminNotice( $html, self::GEN_WARNING_NOTICE, true, array( 'duplicator-pro-admin-notice', 'dpro-admin-notice', 'dup-pro-quick-fix-notice' ), array( 'data-to-dismiss' => self::QUICK_FIX_NOTICE ) ); } /** * display genral admin notice by printing it * * @param string $htmlMsg html code to be printed * @param integer $noticeType constant value of SELF::GEN_ * @param boolean $isDismissible whether the notice is dismissable or not. Default is true * @param array|string $extraClasses add more classes to the notice div * @param array|string $extraAtts assosiate array in which key as attr and value as value of the attr * @param bool $blockContent if false wraps htmlMsg in

otherwise allows to use block tags e.g.

* @return void * @throws Exception */ public static function displayGeneralAdminNotice($htmlMsg, $noticeType, $isDismissible = true, $extraClasses = array(), $extraAtts = array(), $blockContent = false) { if (empty($extraClasses)) { $classes = array(); } elseif (is_array($extraClasses)) { $classes = $extraClasses; } else { $classes = array($extraClasses); } $classes[] = 'notice'; switch ($noticeType) { case self::GEN_INFO_NOTICE: $classes[] = 'notice-info'; break; case self::GEN_SUCCESS_NOTICE: $classes[] = 'notice-success'; break; case self::GEN_WARNING_NOTICE: $classes[] = 'notice-warning'; break; case self::GEN_ERROR_NOTICE: $classes[] = 'notice-error'; break; default: throw new Exception('Invalid Admin notice type!'); } if ($isDismissible) { $classes[] = 'is-dismissible'; } $classesStr = implode(' ', $classes); $attsStr = ''; if (!empty($extraAtts)) { $attsStrArr = array(); foreach ($extraAtts as $att => $attVal) { $attsStrArr[] = $att . '="' . $attVal . '"'; } $attsStr = implode(' ', $attsStrArr); } $htmlMsg = self::GEN_ERROR_NOTICE == $noticeType ? "".$htmlMsg : $htmlMsg; $htmlMsg = !$blockContent ? "

".$htmlMsg."

" : $htmlMsg; ?>
>