| 1 |
<?php |
| 2 |
|
| 3 |
namespace Kibo\PhastPlugins\PhastPress; |
| 4 |
|
| 5 |
use Kibo\PhastPlugins\SDK\AdminPanel\InstallNoticeRenderer; |
| 6 |
|
| 7 |
class InstallNoticeRendererImplementation implements InstallNoticeRenderer { |
| 8 |
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; |
| 16 |
|
| 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 |
} |
| 29 |
|