public static function showWarnings() { if (stristr($_SERVER['REQUEST_URI'], 'MainWP_Child_Server_Information')) { return; } $conflicts = self::getConflicts(); $warnings = self::getWarnings(); $dismissWarnings = get_option('mainwp_child_dismiss_warnings'); if (!is_array($dismissWarnings)) { $dismissWarnings = array(); } if (isset($dismissWarnings['warnings']) && $dismissWarnings['warnings'] >= $warnings) { $warnings = 0; } if (isset($dismissWarnings['conflicts']) && MainWP_Helper::containsAll($dismissWarnings['conflicts'], $conflicts)) { $conflicts = array(); } if (0 === $warnings && 0 === count($conflicts)) { return; } if ($warnings > 0) { $dismissWarnings['warnings'] = 0; } if (count($conflicts) > 0) { $dismissWarnings['conflicts'] = array(); } MainWP_Helper::update_option('mainwp_child_dismiss_warnings', $dismissWarnings); $itheme_ext_activated = 'Y' === get_option('mainwp_ithemes_ext_activated') ? true : false; if ($itheme_ext_activated) { foreach ($conflicts as $key => $cf) { if ('iThemes Security' === $cf) { unset($conflicts[$key]); } } if (0 === $warnings && 0 === count($conflicts)) { return; } } ?> <script language="javascript"> dismiss_warnings = function ( pElement, pAction ) { var table = jQuery( pElement.parents( 'table' )[0] ); pElement.parents( 'tr' )[0].remove(); if ( table.find( 'tr' ).length == 0 ) { jQuery( '#mainwp-child_server_warnings' ).hide(); } var data = { action: 'mainwp-child_dismiss_warnings', what: pAction }; jQuery.ajax( { type: "POST", url: ajaxurl, data: data, success: function ( resp ) { }, error: function () { }, dataType: 'json' } ); return false; }; jQuery( document ).on( 'click', '#mainwp-child-connect-warning-dismiss', function () { return dismiss_warnings( jQuery( this ), 'warning' ); } ); jQuery( document ).on( 'click', '#mainwp-child-all-pages-warning-dismiss', function () { return dismiss_warnings( jQuery( this ), 'conflict' ); } ); </script> <style type="text/css"> .mainwp-child_info-box-red-warning { background-color: rgba(187, 114, 57, 0.2) !important; border-bottom: 4px solid #bb7239 !important; border-top: 1px solid #bb7239 !important; border-left: 1px solid #bb7239 !important; border-right: 1px solid #bb7239 !important; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; margin: 1em 0 !important; background-image: url('<?php echo esc_url(plugins_url('images/mainwp-icon-orange.png', dirname(__FILE__))); ?> ') !important; background-position: 1.5em 50% !important; background-repeat: no-repeat !important; background-size: 30px !important; } .mainwp-child_info-box-red-warning table { background-color: rgba(187, 114, 57, 0) !important; border: 0px; padding-left: 4.5em; background-position: 1.5em 50% !important; background-repeat: no-repeat !important; background-size: 30px !important; } </style> <div class="updated mainwp-child_info-box-red-warning" id="mainwp-child_server_warnings"> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0"> <tbody id="the-sites-list" class="list:sites"> <?php $warning = ''; if ($warnings > 0) { $warning .= '<tr><td colspan="2">This site may not connect to your dashboard or may have other issues. Check your <a href="admin.php?page=MainWP_Child_Server_Information">MainWP Server Information page</a> to review and <a href="http://docs.mainwp.com/child-site-issues/">check here for more information on possible fixes</a></td><td style="text-align: right;"><a href="#" id="mainwp-child-connect-warning-dismiss">Dismiss</a></td></tr>'; } if (count($conflicts) > 0) { $warning .= '<tr><td colspan="2">'; if (1 === count($conflicts)) { $warning .= '"' . $conflicts[0] . '" is'; } else { $warning .= '"' . join('", "', $conflicts) . '" are'; } $warning .= ' installed on this site. This is known to have a potential conflict with MainWP functions. <a href="http://docs.mainwp.com/known-plugin-conflicts/">Please click this link for possible solutions</a></td><td style="text-align: right;"><a href="#" id="mainwp-child-all-pages-warning-dismiss">Dismiss</a></td></tr>'; } echo $warning; ?> </tbody> </table> </div> <?php }