# phastpress/3.6/classes/InstallNoticeRendererImplementation.php

PhastPress, version 3.6. 29 lines.

- Page: https://pluginprobe.com/plugins/phastpress/3.6/code/classes/InstallNoticeRendererImplementation.php
- Raw: https://pluginprobe.com/plugins/phastpress/3.6/raw/classes/InstallNoticeRendererImplementation.php
- Modified: 2023-05-14T09:06:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/phastpress/3.6/code/classes/InstallNoticeRendererImplementation.php#L10-L20`.

```php
<?php

namespace Kibo\PhastPlugins\PhastPress;

use Kibo\PhastPlugins\SDK\AdminPanel\InstallNoticeRenderer;

class InstallNoticeRendererImplementation implements InstallNoticeRenderer {
    public function render($notice, $onCloseJSFunction) {
        return phastpress_script(sprintf(
            '
                (function () {
                    var notice = document.createElement("div");
                    notice.className = "notice notice-success is-dismissible";
                    notice.addEventListener("click", %s);
                    notice.innerHTML = %s;

                    var hr =
                        document.querySelector(".wp-header-end") ||
                        document.querySelector("#wpbody-content > .wrap > h1");

                    hr.parentNode.insertBefore(notice, hr.nextSibling);
                })();
            ',
            $onCloseJSFunction,
            json_encode("<p>{$notice}</p>")
        ));
    }
}

```
