: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( $this->current_user_can( 'et_support_center_safe_mode' ) ) {
$card_title = esc_html__( 'Safe Mode', 'et-core' );
$card_content = __( '<p>Enabling <strong>Safe Mode</strong> will temporarily disable features and plugins that may be causing problems with your Elegant Themes product. This includes all Plugins, Child Themes, and Custom Code added to your integration areas. These items are only disabled for your current user session so your visitors will not be disrupted. Enabling Safe Mode makes it easy to figure out what is causing problems on your website by identifying or eliminating third party plugins and code as potential causes.</p>', 'et-core' );
$safe_mode_active = ( et_core_is_safe_mode_active() ) ? ' et_pb_on_state' : ' et_pb_off_state';
$has_mu_plugins_dir = wp_mkdir_p( WPMU_PLUGIN_DIR ) && wp_is_writable( WPMU_PLUGIN_DIR );
$can_create_mu_plugins_dir = wp_is_writable( WP_CONTENT_DIR ) && ! wp_mkdir_p( WPMU_PLUGIN_DIR );
if ( $has_mu_plugins_dir || $can_create_mu_plugins_dir ) {
// Gather list of plugins that will be temporarily deactivated in Safe Mode
$all_plugins = get_plugins();
$active_plugins = get_option( 'active_plugins' );
foreach ( $active_plugins as $plugin ) {
// Verify this 'active' plugin actually exists in the plugins directory
if ( ! in_array( $plugin, array_keys( $all_plugins ) ) ) {
// If it's not in our allowlist, add it to the list of plugins we'll disable
if ( ! in_array( $plugin, $this->safe_mode_plugins_allowlist ) ) {
$plugins_list[] = '<li>' . esc_html( $all_plugins[ $plugin ]['Name'] ) . '</li>';
$error_message = et_get_safe_localization( sprintf( __( '<p class="et-safe-mode-error">Plugins cannot be disabled because your <code>wp-content</code> directory has inconsistent file permissions. <a href="%1$s" target="_blank">Click here</a> for more information.</p>', 'et-core' ), 'https://wordpress.org/support/article/changing-file-permissions/' ) );
if ( count( $plugins_list ) > 0 ) {
$plugins_output = sprintf( '<p>%1$s</p><ul>%2$s</ul>',
esc_html__( 'The following plugins will be temporarily disabled for you only:', 'et-core' ),
et_core_intentionally_unescaped( implode( ' ', $plugins_list ), 'html' )
// Toggle Safe Mode activation
$card_content .= sprintf( '<div id="et_card_safe_mode" class="et-safe-mode" data-et-product="%8$s">'
. '<div class="et_safe_mode_toggle">'
. '<div class="%5$s_wrapper"><div class="%5$s %1$s">'
. '<span class="%6$s et_pb_on_value">%2$s</span>'
. '<span class="et_pb_button_slider"></span>'
. '<span class="%6$s et_pb_off_value">%3$s</span>'
esc_attr( $safe_mode_active ),
esc_html__( 'Enabled', 'et-core' ),
esc_html__( 'Disabled', 'et-core' ),
esc_attr( $this->parent )
print $this->add_support_center_card( array(
'content' => $card_content,
'additional_classes' => array(
* Run code after the 4th Support Center card has been output
do_action( 'et_support_center_below_position_4' );
if ( $this->current_user_can( 'et_support_center_logs' ) ) {
$debug_log_lines = apply_filters( 'et_debug_log_lines', 200 );
$wp_debug_log = $this->get_wp_debug_log( $debug_log_lines );
$card_title = esc_html__( 'Logs', 'et-core' );
$card_content = '<p>If you have <a href="https://codex.wordpress.org/Debugging_in_WordPress" target=_blank" >WP_DEBUG_LOG</a> enabled, WordPress related errors will be archived in a log file. For your convenience, we have aggregated the contents of this log file so that you and the Elegant Themes support team can view it easily. The file cannot be edited here.</p>';
if ( isset( $wp_debug_log['error'] ) ) {
$card_content .= '<div class="et_system_status_log_preview">'
. '<textarea>' . $wp_debug_log['error'] . '</textarea>'
$card_content .= '<div class="et_system_status_log_preview">'
. '<textarea id="et_logs_display">' . $wp_debug_log['entries'] . '</textarea>'
. '<textarea id="et_logs_recent">' . $wp_debug_log['entries'] . '</textarea>'
. '<div class="et_card_cta">'
. '<a href="' . content_url( 'debug.log' ) . '" class="download_debug_log" download>'
. esc_html__( 'Download Full Debug Log', 'et-core' )
. ' (' . $wp_debug_log['size'] . ')'
. '<a class="copy_debug_log">'
. esc_html__( 'Copy Recent Log Entries', 'et-core' )
print $this->add_support_center_card( array(
'content' => $card_content,
'additional_classes' => array(
* Run code after all of the Support Center cards have been output
do_action( 'et_support_center_below_cards' );
<div id="et-ajax-saving">
<img src="<?php echo esc_url( $this->local_path . 'admin/images/ajax-loader.gif' ); ?>" alt="loading" id="loading" />
* SUPPORT CENTER :: DIVI HOSTING CARD
* Conditionally display Divi Hosting Card in the Support Center
public function maybe_display_divi_hosting_card() {
// Sanity Check: Exit early if the user does not have permission
if ( ! $this->current_user_can( 'et_support_center_system' ) ) {
// Exit if Admin dismissed the Divi Hosting Card
if ( get_option( 'et_hosting_card_dismissed', false ) ) {
// Show the Divi Hosting Card
add_action( 'et_support_center_below_position_1', array( $this, 'print_divi_hosting_card' ) );
* Prepare Settings for ET API request
* Returns false when ET username/api_key is not found, and ET subscription is not active
protected function get_et_api_request_settings( $action ) {
$et_account = et_core_get_et_account();
$et_username = et_()->array_get( $et_account, 'et_username', '' );
$et_api_key = et_()->array_get( $et_account, 'et_api_key', '' );
// Only when ET Username and ET API Key is found
if ( '' !== $et_username && '' !== $et_api_key ) {
// Prepare settings for API request
'username' => $et_username,
'api_key' => $et_api_key,
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
* Check ET API whether ET User has disabled Divi Hosting Card
protected function maybe_api_has_hosting_card_disabled() {
$api_settings = $this->get_et_api_request_settings( 'check_hosting_card_status' );
// Check API only when ET Username, ET API Key is found and Account is active
if ( is_array( $api_settings ) ) {
$request = wp_remote_post( 'https://www.elegantthemes.com/api/api.php', $api_settings );
$request_response_code = wp_remote_retrieve_response_code( $request );
// Do not show the Hosting Card when API Request, or, API Response has any error
if ( is_wp_error( $request ) || 200 !== $request_response_code ) {
$response_body = wp_remote_retrieve_body( $request );
$response = (array) json_decode( $response_body );
// Check whether the User has disabled the card
if ( et_()->array_get( $response, 'success' ) && et_()->array_get( $response, 'status' ) === 'disabled' ) {
// Mark it dismissed, so it won't be displayed anymore on this website
update_option( 'et_hosting_card_dismissed', true );
// Do not show the Hosting Card
* Return Data for Divi Hosting Card
protected function get_divi_hosting_features() {
'title' => esc_html__( 'Get Recommended Divi Hosting', 'et-core' ),
'summary' => esc_html__( 'Upgrade your hosting to the most reliable, Divi-compatible hosting. Enjoy perfectly configured hosting environments pre-installed with the tools you need to be successful with Divi.', 'et-core' ),
'url' => 'https://www.elegantthemes.com/hosting/',
'learn_more' => esc_html__( 'Learn About Divi Hosting', 'et-core' ),
'dismiss_tooltip' => esc_html__( 'Remove This Recommendation On All Of Your Websites And Your Client\'s Websites Forever', 'et-core' ),
'title' => esc_html__( 'Divi-Optimized Servers', 'et-core' ),
'tooltip' => esc_html__( "We worked with our parters to make sure that their hosting solutions meet all of Divi's requirements out of the box. No hosting headaches on Divi Hosting.", 'et-core' ),
'title' => esc_html__( 'Blazing Fast Speed', 'et-core' ),
'tooltip' => esc_html__( 'Divi Hosting is powered by fast networks, modern hosting infrastructures and the latest server software. Plus you will enjoy automatic caching and a free CDN.', 'et-core' ),
'title' => esc_html__( 'A Focus On Security', 'et-core' ),
'tooltip' => esc_html__( 'All of our hosting partners are dedicated to security. That means up-to-date server software and secure hosting practices.', 'et-core' ),
'title' => esc_html__( 'Automatic Backups', 'et-core' ),
'tooltip' => esc_html__( 'Every website needs backups! Each of our hosting partners provide automatic daily backups. If disaster strikes, these hosting companies have your back.', 'et-core' ),
'title' => esc_html__( 'Free Site Migration', 'et-core' ),
'tooltip' => esc_html__( "Already have a Divi website hosted somewhere else? All of our hosting partners provide free assisted migration. It's easy to switch to Divi Hosting.", 'et-core' ),
'title' => esc_html__( 'Easy Staging Sites', 'et-core' ),
'tooltip' => esc_html__( 'Automatic staging sites make it easy to develop new designs for your clients without disrupting visitors. Finish your work and push it live all at once.', 'et-core' ),
* Build and display Divi Hosting Card
public function print_divi_hosting_card() {
// Gather System status data
$report = $this->system_diagnostics_generate_report( false );
// Prepare the report data to check against when to show the Divi Hosting Card
foreach ( $report as $status ) {
$result[] = et_()->array_get( $status, 'pass_fail' );
// Exit if any system status item is not in a warning state (red dot indicator)
if ( ! in_array( 'fail', array_values( $result ), true ) ) {
// Exit if ET User has disabled the Divi Hosting card
if ( $this->maybe_api_has_hosting_card_disabled() ) {
// JS dependency for Tooltips
wp_enqueue_script( 'popper', $this->local_path . 'admin/js/popper.min.js', array( 'jquery' ), ET_CORE_VERSION );
wp_enqueue_script( 'tippy', $this->local_path . 'admin/js/tippy.min.js', array( 'jquery', 'popper' ), ET_CORE_VERSION );
$card = $this->get_divi_hosting_features();
// HTML Template for Features of the Divi Hosting Card
foreach ( $card['features'] as $name => $feature ) {
'<div class="et_hosting_card--feature" data-tippy-content="%1$s">%2$s <h4>%3$s</h4></div>',
esc_html( $feature['tooltip'] ),
'<object type="image/svg+xml" className="fitvidsignore" data="%1$s" width="32" height="32"></object>',
esc_url( "{$this->local_path}admin/images/svg/{$name}.svg" )
esc_html( $feature['title'] )
// HTML Template for the Divi Hosting Card
'<p class="et_card_summary">%1$s</p>
<div class="et_card_content et_hosting_card--features">%2$s</div>
<div class="et_card_cta et_hosting_card--cta">%3$s</div>',
esc_html( $card['summary'] ),
et_core_esc_previously( $features ),
'<a class="et_hosting_card--link" target="_blank" href="%1$s" title="%2$s">%3$s</a>',
esc_attr( $card['learn_more'] ),
esc_html( $card['learn_more'] )
// Display the Divi Hosting Card
print $this->add_support_center_card( array(
'title' => $card['title'],
'content' => $card_content,
'additional_classes' => array(
'dismiss_button' => array(
'card_key' => 'et_hosting_card',
'tooltip' => $card['dismiss_tooltip'],
'additional_classes' => array(
'et_hosting_card--dismiss',