' . base64_encode( $output ) . '' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- to compatible with http encoding. } public static function close_connection( $val = null ) { if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) : $output = wp_json_encode( $val ); else : $output = serialize( $val ); // phpcs:ignore -- to compatible. endif; $output = '' . base64_encode( $output ) . ''; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons. // Close browser connection so that it can resume AJAX polling. header( 'Content-Length: ' . strlen( $output ) ); header( 'Connection: close' ); header( 'Content-Encoding: none' ); if ( session_id() ) { session_write_close(); } echo $output; if ( ob_get_level() ) { ob_end_flush(); } flush(); } public static function error( $error, $code = null ) { $information['error'] = $error; if ( null !== $code ) { $information['error_code'] = $code; } mainwp_child_helper()->write( $information ); } /** * PARSE * Parses some CSS into an array * CSSPARSER * Copyright (C) 2009 Peter Kröner */ public static function parse_css( $css ) { // Remove CSS-Comments. $css = preg_replace( '/\/\*.*?\*\//ms', '', $css ); // Remove HTML-Comments. $css = preg_replace( '/([^\'"]+?)(\