PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.4.2
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.4.2
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
← All changes | common/admin.php +17 -457 0.5.00.4.2 View file →
@@ -3,12 +3,10 @@
3 3 if ( !class_exists( 'MeowKit_MWCODE_Admin' ) ) {
4 4
5 5 class MeowKit_MWCODE_Admin {
6 6 public static $loaded = false;
7 - public static $version = '5.0';
8 - public static $admin_version = '5.0';
9 - public static $network_license_modal_added = false;
10 - public static $network_license_plugins = [];
7 + public static $version = '4.0';
8 + public static $admin_version = '4.0';
11 9
12 10 /**
13 11 * Storage for instances that need deferred initialization.
14 12 *
@@ -157,13 +155,8 @@
157 155 if ( $page === 'meowapps-main-menu' ) {
158 156 add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ], 100000, 1 );
159 157 }
160 158
161 - // Promote AI Engine on the WordPress 7 Connectors page when AI Engine
162 - // itself isn't installed. When AI Engine is active, its own banner
163 - // takes over — so this path only runs on "bare" Meow Apps installs.
164 - add_action( 'admin_footer', [ $this, 'maybe_render_wpai_promo' ] );
165 -
166 159 MeowKit_MWCODE_Admin::$loaded = true;
167 160 }
168 161
169 162 // PER-INSTANCE SETUP: Run for each plugin that uses this library
@@ -203,193 +196,21 @@
203 196 return $links;
204 197 }
205 198 $isIssue = $this->isPro && !$this->is_registered();
206 199 if ( strpos( $pathName, $thisPathName ) !== false ) {
207 - // In network admin, handle differently (no settings page available)
208 - if ( is_network_admin() ) {
209 - if ( $this->isPro && !$this->is_registered() ) {
210 - // Show "Register License" link for unregistered Pro plugins
211 - $new_links = [
212 - 'license' => sprintf(
213 - '<a href="#" class="meowapps-network-license-link" data-prefix="%s" data-plugin="%s" style="color: #d63638;">%s</a>',
214 - esc_attr( $this->prefix ),
215 - esc_attr( $this->nice_name_from_file( $this->mainfile ) ),
216 - __( 'Register License', $this->domain )
217 - ),
218 - ];
219 - // Track this plugin for the modal
220 - self::$network_license_plugins[ $this->prefix ] = $this->nice_name_from_file( $this->mainfile );
221 - // Add modal output hook (only once)
222 - if ( !self::$network_license_modal_added ) {
223 - add_action( 'admin_footer', [ __CLASS__, 'output_network_license_modal' ] );
224 - self::$network_license_modal_added = true;
225 - }
226 - }
227 - elseif ( $this->isPro && $this->is_registered() ) {
228 - // Pro plugin is registered
229 - $new_links = [
230 - 'license' => '<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>',
231 - ];
232 - }
233 - else {
234 - // Free plugin
235 - $new_links = [
236 - 'license' => sprintf( '<span>' . __( '<a target="_blank" href="https://meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>',
237 - ];
238 - }
239 - }
240 - else {
241 - // Regular admin - show settings and license status
242 - $new_links = [
243 - 'settings' =>
244 - sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ),
245 - 'license' =>
246 - $this->is_registered() ?
247 - ( '<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>' ) :
248 - ( $isIssue ? ( sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>' ) : ( sprintf( '<span>' . __( '<a target="_blank" href="https://meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>' ) ),
249 - ];
250 - }
200 + $new_links = [
201 + 'settings' =>
202 + sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ),
203 + 'license' =>
204 + $this->is_registered() ?
205 + ( '<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>' ) :
206 + ( $isIssue ? ( sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>' ) : ( sprintf( '<span>' . __( '<a target="_blank" href="https://meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>' ) ),
207 + ];
251 208 $links = array_merge( $new_links, $links );
252 209 }
253 210 return $links;
254 211 }
255 212
256 - /**
257 - * Output the network license registration modal.
258 - * Called via admin_footer hook in network admin.
259 - */
260 - public static function output_network_license_modal() {
261 - $rest_url = esc_url( rest_url() );
262 - $nonce = wp_create_nonce( 'wp_rest' );
263 - ?>
264 - <div id="meowapps-network-license-modal" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index:100000; align-items:center; justify-content:center;">
265 - <div style="background:#fff; padding:24px; border-radius:8px; max-width:450px; width:90%; box-shadow:0 4px 20px rgba(0,0,0,0.3);">
266 - <h2 style="margin:0 0 8px 0; font-size:18px;">Register License</h2>
267 - <p id="meowapps-license-plugin-name" style="margin:0 0 16px 0; color:#666;"></p>
268 - <input type="text" id="meowapps-license-key-input" placeholder="Enter your license key" style="width:100%; padding:10px; font-size:14px; border:1px solid #8c8f94; border-radius:4px; box-sizing:border-box;" />
269 - <p id="meowapps-license-message" style="margin:12px 0 0 0; padding:10px; border-radius:4px; display:none;"></p>
270 - <div style="margin-top:16px; display:flex; gap:10px; justify-content:flex-end;">
271 - <button type="button" id="meowapps-license-cancel" class="button">Cancel</button>
272 - <button type="button" id="meowapps-license-submit" class="button button-primary">Validate & Register</button>
273 - </div>
274 - </div>
275 - </div>
276 - <script>
277 - (function() {
278 - var modal = document.getElementById('meowapps-network-license-modal');
279 - var input = document.getElementById('meowapps-license-key-input');
280 - var message = document.getElementById('meowapps-license-message');
281 - var pluginName = document.getElementById('meowapps-license-plugin-name');
282 - var submitBtn = document.getElementById('meowapps-license-submit');
283 - var cancelBtn = document.getElementById('meowapps-license-cancel');
284 - var currentPrefix = '';
285 -
286 - function showMessage(text, isError) {
287 - message.textContent = text;
288 - message.style.display = 'block';
289 - message.style.background = isError ? '#fcf0f1' : '#edfaef';
290 - message.style.color = isError ? '#d63638' : '#1e7e34';
291 - message.style.border = '1px solid ' + (isError ? '#d63638' : '#1e7e34');
292 - }
293 -
294 - function hideMessage() {
295 - message.style.display = 'none';
296 - }
297 -
298 - function openModal(prefix, plugin) {
299 - currentPrefix = prefix;
300 - pluginName.textContent = plugin;
301 - input.value = '';
302 - hideMessage();
303 - submitBtn.disabled = false;
304 - submitBtn.textContent = 'Validate & Register';
305 - modal.style.display = 'flex';
306 - input.focus();
307 - }
308 -
309 - function closeModal() {
310 - modal.style.display = 'none';
311 - currentPrefix = '';
312 - }
313 -
314 - // Handle click on "Register License" links
315 - document.addEventListener('click', function(e) {
316 - if (e.target.classList.contains('meowapps-network-license-link')) {
317 - e.preventDefault();
318 - var prefix = e.target.getAttribute('data-prefix');
319 - var plugin = e.target.getAttribute('data-plugin');
320 - openModal(prefix, plugin);
321 - }
322 - });
323 -
324 - // Close modal on cancel or clicking outside
325 - cancelBtn.addEventListener('click', closeModal);
326 - modal.addEventListener('click', function(e) {
327 - if (e.target === modal) closeModal();
328 - });
329 -
330 - // Handle escape key
331 - document.addEventListener('keydown', function(e) {
332 - if (e.key === 'Escape' && modal.style.display === 'flex') {
333 - closeModal();
334 - }
335 - });
336 -
337 - // Handle enter key in input
338 - input.addEventListener('keydown', function(e) {
339 - if (e.key === 'Enter') {
340 - submitBtn.click();
341 - }
342 - });
343 -
344 - // Submit license
345 - submitBtn.addEventListener('click', function() {
346 - var licenseKey = input.value.trim();
347 - if (!licenseKey) {
348 - showMessage('Please enter a license key.', true);
349 - return;
350 - }
351 -
352 - submitBtn.disabled = true;
353 - submitBtn.textContent = 'Validating...';
354 - hideMessage();
355 -
356 - var restUrl = '<?php echo $rest_url; ?>meow-licenser/' + currentPrefix + '/v1/set_license/';
357 -
358 - fetch(restUrl, {
359 - method: 'POST',
360 - headers: {
361 - 'Content-Type': 'application/json',
362 - 'X-WP-Nonce': '<?php echo $nonce; ?>'
363 - },
364 - body: JSON.stringify({ serialKey: licenseKey })
365 - })
366 - .then(function(response) { return response.json(); })
367 - .then(function(data) {
368 - if (data.success && data.data && !data.data.issue) {
369 - showMessage('License registered successfully! Reloading...', false);
370 - setTimeout(function() { location.reload(); }, 1500);
371 - } else {
372 - var errorMsg = 'License validation failed.';
373 - if (data.data && data.data.issue) {
374 - errorMsg = 'License issue: ' + data.data.issue;
375 - }
376 - showMessage(errorMsg, true);
377 - submitBtn.disabled = false;
378 - submitBtn.textContent = 'Validate & Register';
379 - }
380 - })
381 - .catch(function(error) {
382 - showMessage('Error: ' + error.message, true);
383 - submitBtn.disabled = false;
384 - submitBtn.textContent = 'Validate & Register';
385 - });
386 - });
387 - })();
388 - </script>
389 - <?php
390 - }
391 -
392 213 public function request_verify_ssl() {
393 214 return get_option( 'force_sslverify', false );
394 215 }
395 216
@@ -434,18 +255,14 @@
434 255 add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', [ $this, 'meowapps_hide_dashboard_callback' ], 'general' );
435 256 return;
436 257 }
437 258
438 - // Create standard menu if it does not already exist.
439 - // The cat logo is injected as an <img> inside the menu title (rather than passed as
440 - // the $icon_url argument) so the original SVG fills are preserved — passing it via
441 - // $icon_url makes WordPress add the .svg class and the admin color scheme strips
442 - // the colors to a single fill.
259 + // Create standard menu if it does not already exist
443 260 global $submenu;
444 261 if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
445 262 add_menu_page(
446 263 'Meow Apps',
447 - '<img alt="Meow Apps" class="meowapps-menu-icon" src="' . MeowKit_MWCODE_Admin::$logo . '" />Meow Apps',
264 + '<img alt="Meow Apps" style="width: 21px; margin-left: -28px; position: absolute; margin-top: 2px;" src="' . MeowKit_MWCODE_Admin::$logo . '" />Meow Apps',
448 265 'manage_options',
449 266 'meowapps-main-menu',
450 267 [ $this, 'admin_meow_apps' ],
451 268 '',
@@ -460,84 +277,15 @@
460 277 [ $this, 'admin_meow_apps' ]
461 278 );
462 279 }
463 280
464 - // Position the cat icon so it sits in the standard icon column in both the
465 - // expanded and the collapsed (folded) sidebar.
466 - //
467 - // The image lives inside the .wp-menu-name title (where the original code
468 - // put it) so the <img> renders with its native SVG fills. When the sidebar
469 - // is collapsed, WP hides .wp-menu-name (and everything inside it), so a
470 - // small JS snippet below clones the same <img> into the .wp-menu-image
471 - // slot — which WP keeps visible in both states. We use a real <img>
472 - // (not a background-image) on purpose: at small sizes WP's admin renders
473 - // background-image SVGs noticeably lighter than the equivalent <img>,
474 - // and we want the colored cat in both states.
475 - //
476 - // The !important rules also override an older "display: none" style that
477 - // previous-generation Meow Apps common copies inject for .wp-menu-image;
478 - // if any of them load first, ours still wins.
281 + // Add CSS to hide the default icon
479 282 add_action( 'admin_head', function () {
480 283 echo '<style>
481 - #toplevel_page_meowapps-main-menu .meowapps-menu-icon {
482 - width: 20px;
483 - height: auto;
484 - position: absolute;
485 - margin-left: -28px;
486 - margin-top: 3px;
487 - }
488 - #toplevel_page_meowapps-main-menu .wp-menu-image {
489 - display: block !important;
490 - position: relative;
491 - }
492 - #toplevel_page_meowapps-main-menu .wp-menu-image::before {
493 - display: none !important;
494 - }
495 - #toplevel_page_meowapps-main-menu .wp-menu-image .meowapps-menu-icon-folded {
496 - display: none;
497 - position: absolute;
498 - top: 50%;
499 - left: 50%;
500 - transform: translate(-50%, calc(-50% - 3px));
501 - width: 20px;
502 - height: auto;
503 - }
504 - body.folded #toplevel_page_meowapps-main-menu .wp-menu-image .meowapps-menu-icon-folded {
505 - display: block;
506 - }
507 - body.folded #toplevel_page_meowapps-main-menu .meowapps-menu-icon {
508 - display: none;
509 - }
510 - @media only screen and (max-width: 960px) {
511 - body.auto-fold #toplevel_page_meowapps-main-menu .wp-menu-image .meowapps-menu-icon-folded {
512 - display: block;
513 - }
514 - body.auto-fold #toplevel_page_meowapps-main-menu .meowapps-menu-icon {
515 - display: none;
516 - }
517 - }
518 - </style>';
519 - }, 999 );
520 -
521 - // Inject a clone of the in-title cat icon into the .wp-menu-image slot.
522 - // CSS above shows it only when the sidebar is folded; in the normal
523 - // expanded state the .wp-menu-name <img> stays the visible icon.
524 - add_action( 'admin_footer', function () {
525 - ?>
526 - <script>
527 - ( function () {
528 - var li = document.getElementById( 'toplevel_page_meowapps-main-menu' );
529 - if ( !li ) { return; }
530 - var src = li.querySelector( '.meowapps-menu-icon' );
531 - var slot = li.querySelector( '.wp-menu-image' );
532 - if ( !src || !slot || slot.querySelector( '.meowapps-menu-icon-folded' ) ) { return; }
533 - var clone = src.cloneNode();
534 - clone.className = 'meowapps-menu-icon-folded';
535 - clone.removeAttribute( 'style' );
536 - slot.appendChild( clone );
537 - } )();
538 - </script>
539 - <?php
284 + #toplevel_page_meowapps-main-menu .wp-menu-image {
285 + display: none;
286 + }
287 + </style>';
540 288 } );
541 289 }
542 290
543 291 public function meowapps_hide_dashboard_callback() {
@@ -581,195 +329,7 @@
581 329 __( 'Thanks for using <a href="https://meowapps.com">Meow Apps</a>! This is the Meow Admin %1$s <br /><i>Loaded from %2$s </i>', $this->domain ),
582 330 MeowKit_MWCODE_Admin::$version,
583 331 __FILE__
584 332 );
585 - }
586 -
587 - /**
588 - * Renders a promo banner on WordPress 7's Connectors page when AI Engine
589 - * isn't installed. Kept self-contained so the common library stays simple:
590 - * no new file, no REST endpoint, dismissal persists in localStorage.
591 - */
592 - public function maybe_render_wpai_promo() {
593 - // WordPress 7+ only.
594 - if ( ! class_exists( 'WP_Connector_Registry' ) ) {
595 - return;
596 - }
597 - // If AI Engine is installed, its own Connectors banner takes over.
598 - if ( class_exists( 'Meow_MWAI_Core' ) ) {
599 - return;
600 - }
601 - // Another Meow Apps plugin's common copy may have rendered already.
602 - if ( defined( 'MEOWAPPS_WPAI_PROMO_RENDERED' ) ) {
603 - return;
604 - }
605 - // Gate on the Connectors screen. The hook suffix differs between the
606 - // direct file (`options-connectors.php`) and the menu-page variant.
607 - $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
608 - $id = $screen ? $screen->id : ( isset( $GLOBALS['hook_suffix'] ) ? $GLOBALS['hook_suffix'] : '' );
609 - $targets = array( 'options-connectors', 'options-connectors.php', 'settings_page_options-connectors-wp-admin' );
610 - if ( ! in_array( $id, $targets, true ) ) {
611 - return;
612 - }
613 - define( 'MEOWAPPS_WPAI_PROMO_RENDERED', true );
614 -
615 - // Install button → WordPress's own plugin-install search page, pre-
616 - // filtered for AI Engine. One click from there to install. This is the
617 - // most reliable path: no custom nonces, native progress UI, native
618 - // filesystem credential prompt if needed.
619 - $can_install = current_user_can( 'install_plugins' );
620 - $install_url = $can_install
621 - ? self_admin_url( 'plugin-install.php?tab=search&type=term&s=AI+Engine' )
622 - : 'https://wordpress.org/plugins/ai-engine/';
623 - $wporg_url = 'https://wordpress.org/plugins/ai-engine/';
624 - $learn_url = 'https://meowapps.com/wordpress-7-ai-engine-gateway/';
625 -
626 - // Title is split so "AI Engine" can carry an anchor to wp.org. Keeping
627 - // the pieces as data (not one HTML string) avoids escaping surprises and
628 - // keeps the translation unit stable.
629 - $payload = array(
630 - 'titleBefore' => __( 'Highly recommended: Let ', 'meowapps' ),
631 - 'titleLink' => __( 'AI Engine', 'meowapps' ),
632 - 'titleAfter' => __( ' handle your connections.', 'meowapps' ),
633 - 'sub' => __( 'One plugin for every provider. Keep your AI setup clean and consistent: monitor your API costs in one place, log every single request, and avoid the mess of juggling separate plugins for each AI model.', 'meowapps' ),
634 - 'install' => __( 'Install AI Engine', 'meowapps' ),
635 - 'learn' => __( 'Learn more', 'meowapps' ),
636 - 'dismiss' => __( 'Dismiss', 'meowapps' ),
637 - 'installUrl' => $install_url,
638 - 'wporgUrl' => $wporg_url,
639 - 'learnUrl' => $learn_url,
640 - );
641 - ?>
642 - <style>
643 - .meowapps-wpai-promo {
644 - margin: 0 0 16px; padding: 14px 18px;
645 - display: flex; align-items: flex-start; gap: 14px;
646 - background: #f0f4ff; border: 1px solid #d6deff; border-radius: 4px;
647 - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
648 - font-size: 13px; line-height: 1.45; color: #1e1e1e;
649 - }
650 - .meowapps-wpai-promo-icon {
651 - width: 32px; height: 32px; border-radius: 50%;
652 - background: #2f5fff; color: #fff;
653 - display: flex; align-items: center; justify-content: center;
654 - flex-shrink: 0;
655 - margin-top: 1px;
656 - }
657 - .meowapps-wpai-promo-icon svg { width: 18px; height: 18px; display: block; }
658 - .meowapps-wpai-promo-body {
659 - flex: 1; min-width: 0;
660 - display: flex; flex-direction: column; gap: 10px;
661 - }
662 - .meowapps-wpai-promo-text strong { font-weight: 700; display: block; margin-bottom: 3px; }
663 - .meowapps-wpai-promo-text span { color: #50575e; }
664 - .meowapps-wpai-promo-titlelink {
665 - color: #2f5fff; text-decoration: none; border-bottom: 1px dashed #2f5fff;
666 - }
667 - .meowapps-wpai-promo-titlelink:hover { color: #2448cc; border-bottom-color: #2448cc; }
668 - .meowapps-wpai-promo-actions {
669 - display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
670 - }
671 - .meowapps-wpai-promo-btn {
672 - appearance: none; border: 1px solid transparent; border-radius: 4px;
673 - padding: 7px 16px; font: inherit; font-size: 12.5px; font-weight: 600;
674 - cursor: pointer; text-decoration: none;
675 - transition: background 0.12s ease, border-color 0.12s ease;
676 - }
677 - .meowapps-wpai-promo-btn-primary { background: #2f5fff; color: #fff; }
678 - .meowapps-wpai-promo-btn-primary:hover { background: #2448cc; color: #fff; }
679 - .meowapps-wpai-promo-btn-secondary { background: #7c3aed; color: #fff; }
680 - .meowapps-wpai-promo-btn-secondary:hover { background: #6527c9; color: #fff; }
681 - .meowapps-wpai-promo-btn-dismiss {
682 - margin-left: auto;
683 - background: transparent; color: #6b7280;
684 - font-weight: 500; padding: 7px 10px;
685 - }
686 - .meowapps-wpai-promo-btn-dismiss:hover { color: #1e1e1e; background: rgba(0,0,0,0.04); }
687 - </style>
688 - <script>
689 - (function () {
690 - var D = <?php echo wp_json_encode( $payload ); ?>;
691 - try { if (localStorage.getItem('meowapps-wpai-promo-dismissed') === '1') return; } catch (e) {}
692 -
693 - function build() {
694 - var host = document.createElement('div');
695 - host.className = 'meowapps-wpai-promo';
696 - host.setAttribute('role', 'status');
697 - var iconSvg = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>';
698 - host.innerHTML = [
699 - '<span class="meowapps-wpai-promo-icon">', iconSvg, '</span>',
700 - '<div class="meowapps-wpai-promo-body">',
701 - '<div class="meowapps-wpai-promo-text">',
702 - '<strong></strong> <span class="meowapps-wpai-promo-sub"></span>',
703 - '</div>',
704 - '<div class="meowapps-wpai-promo-actions"></div>',
705 - '</div>'
706 - ].join('');
707 - // Title carries an anchor on "AI Engine" → wp.org plugin page.
708 - var strong = host.querySelector('strong');
709 - strong.appendChild(document.createTextNode(D.titleBefore));
710 - var tLink = document.createElement('a');
711 - tLink.href = D.wporgUrl;
712 - tLink.target = '_blank';
713 - tLink.rel = 'noopener noreferrer';
714 - tLink.className = 'meowapps-wpai-promo-titlelink';
715 - tLink.textContent = D.titleLink;
716 - strong.appendChild(tLink);
717 - strong.appendChild(document.createTextNode(D.titleAfter));
718 - host.querySelector('.meowapps-wpai-promo-sub').textContent = D.sub;
719 - var actions = host.querySelector('.meowapps-wpai-promo-actions');
720 -
721 - function link(label, cls, href, newTab) {
722 - var a = document.createElement('a');
723 - a.className = 'meowapps-wpai-promo-btn ' + cls;
724 - a.textContent = label;
725 - a.href = href;
726 - if (newTab) { a.target = '_blank'; a.rel = 'noopener noreferrer'; }
727 - actions.appendChild(a);
728 - return a;
729 - }
730 -
731 - // Install → WordPress's plugin-install search page, pre-filtered.
732 - // User lands on a familiar screen with AI Engine as the top hit and
733 - // can install with the native WordPress UX.
734 - link(D.install, 'meowapps-wpai-promo-btn-primary', D.installUrl, false);
735 - link(D.learn, 'meowapps-wpai-promo-btn-secondary', D.learnUrl, true);
736 -
737 - var d = document.createElement('button');
738 - d.type = 'button';
739 - d.className = 'meowapps-wpai-promo-btn meowapps-wpai-promo-btn-dismiss';
740 - d.textContent = D.dismiss;
741 - d.addEventListener('click', function () {
742 - try { localStorage.setItem('meowapps-wpai-promo-dismissed', '1'); } catch (e) {}
743 - if (host.parentNode) host.parentNode.removeChild(host);
744 - });
745 - actions.appendChild(d);
746 - return host;
747 - }
748 -
749 - function ensure() {
750 - if (document.querySelector('.meowapps-wpai-promo')) return;
751 - var page = document.querySelector('.connectors-page');
752 - if (page) { page.insertBefore(build(), page.firstChild); return; }
753 - var header = document.querySelector('.boot-layout__stage header');
754 - if (header && header.parentNode) {
755 - header.parentNode.insertBefore(build(), header.nextSibling);
756 - }
757 - }
758 -
759 - var tries = 0;
760 - var iv = setInterval(function () {
761 - ensure();
762 - if (document.querySelector('.meowapps-wpai-promo') || ++tries > 40) clearInterval(iv);
763 - }, 120);
764 -
765 - var app = document.getElementById('options-connectors-wp-admin-app')
766 - || document.getElementById('options-connectors-app');
767 - if (app && 'MutationObserver' in window) {
768 - new MutationObserver(ensure).observe(app, { childList: true, subtree: true });
769 - }
770 - })();
771 - </script>
772 - <?php
773 333 }
774 334 }
775 335 }