PluginProbe
PhastPress / 1.78
PhastPress v1.78
3.12 3.11 1.75 1.76 1.77 1.78 1.79 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.90 1.91 1.92 1.93 1.94 1.95 1.96 1.97 All 119 releases
← All changes | classes/InstallNoticeRendererImplementation.php +15 -18 3.121.78 View file →
@@ -4,25 +4,22 @@
4 4
5 5 use Kibo\PhastPlugins\SDK\AdminPanel\InstallNoticeRenderer;
6 6
7 7 class InstallNoticeRendererImplementation implements InstallNoticeRenderer {
8 +
8 9 public function render($notice, $onCloseJSFunction) {
9 - return phastpress_script(sprintf(
10 - '
11 - (function () {
12 - var notice = document.createElement("div");
13 - notice.className = "notice notice-success is-dismissible";
14 - notice.addEventListener("click", %s);
15 - notice.innerHTML = %s;
10 + $template = '
11 + <script>
12 + jQuery(document).ready(function ($) {
13 + $("#phastpress-activated-notice").on("click", " .notice-dismiss", function() {
14 + (%s)()
15 + })
16 + });
17 + </script>';
18 + $template = sprintf($template, $onCloseJSFunction);
19 + $template .= '<div class="notice notice-success is-dismissible" id="phastpress-activated-notice">';
20 + $template .= '<p>' . $notice . '</p>';
21 + $template .= '</div>';
22 + return $template;
23 + }
16 24
17 - var hr =
18 - document.querySelector(".wp-header-end") ||
19 - document.querySelector("#wpbody-content > .wrap > h1");
20 -
21 - hr.parentNode.insertBefore(notice, hr.nextSibling);
22 - })();
23 - ',
24 - $onCloseJSFunction,
25 - json_encode("<p>{$notice}</p>")
26 - ));
27 - }
28 25 }