: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\WordPress;
use Nextend\Framework\Pattern\SingletonTrait;
protected $priority = 100;
protected $extraObStart = 0;
protected function init() {
add_action('init', array(
add_action('shutdown', array(
), -1 * $this->priority);
* Fix for KeyCDN cache enabled
* @url https://wordpress.org/plugins/cache-enabler/
if (class_exists('Cache_Enabler', false)) {
add_action('template_redirect', function () {
* @url https://wordpress.org/plugins/hyper-cache/
if (function_exists('hyper_cache_callback')) {
add_filter('cache_buffer', array(
* Fix for Speed booster Pack
* @url https://wordpress.org/plugins/speed-booster-pack/
if (defined('SBP_VERSION')) {
add_filter('sbp_output_buffer', array(
if (class_exists('PagespeedNinja')) {
add_action('template_redirect', function () {
if (class_exists('Cachify')) {
add_action('template_redirect', function () {
if (class_exists('Ionos\Performance\Caching')) {
add_action('template_redirect', function () {
if (class_exists('WP_Grid_Builder\Autoload')) {
add_action('template_redirect', function () {
if (class_exists('wps_ic')) {
add_action('template_redirect', function () {
* Theme's functions.php loaded at this point.
public function onInit() {
* @url https://borlabs.io/download/
if (defined('BORLABS_CACHE_SLUG') && !is_admin()) {
add_action('template_redirect', array(
), -1 * $this->priority);
if (defined('THEMIFY_VERSION') && !is_admin()) {
add_filter('template_include', array(
'templateIncludeOutputStart'
), 1); // Themify use priority: 0
add_action('pp_end_html', array(
), -10000); // ProPhoto 6 theme: we must close the buffer before the cache
add_action('headway_html_close', array(
), $this->priority); // Headway theme
public function templateIncludeOutputStart($template) {
public function outputStart() {
if (defined('AUTOPTIMIZE_PLUGIN_DIR')) {
add_filter('autoptimize_filter_html_before_minify', array(
if (defined('WP_ROCKET_VERSION')) {
add_filter('rocket_buffer', array(
* Gantry 4 improvement to use the inbuilt output filter
if (defined('GANTRY_VERSION') && version_compare(GANTRY_VERSION, '4.0.0', '>=') && version_compare(GANTRY_VERSION, '5.0.0', '<')) {
add_filter('gantry_before_render_output', array(
remove_action('shutdown', array(
), -1 * $this->priority);
for ($i = 0; $i < $this->extraObStart; $i++) {
* Ultimate reviews open a buffer on init and tries to close it on wp_footer.
* To prevent that, lets open a new buffer which can be closed on wp_footer.
* @bug install Speed Contact Bar + Ultimate Reviews
* @see https://wordpress.org/plugins/ultimate-reviews/
if (function_exists('EWD_URP_add_ob_start')) {
* Cart66 closes our output buffer in forceDownload method
* @url http://www.cart66.com
if (class_exists('Cart66')) {
public function closeOutputBuffers() {
if (!defined('WC_DOING_AJAX') || !WC_DOING_AJAX) {
$handlers = ob_list_handlers();
$callback = self::class . '::outputCallback';
if (in_array($callback, $handlers)) {
for ($i = count($handlers) - 1; $i >= 0; $i--) {
if ($handlers[$i] === $callback) {
public function outputCallback($buffer, $phase) {
if ($phase & PHP_OUTPUT_HANDLER_FINAL || $phase & PHP_OUTPUT_HANDLER_END) {
return $this->prepareOutput($buffer);
public function prepareOutput($buffer) {
return apply_filters('wordpress_prepare_output', $buffer);
public function setPriority($priority) {
$this->priority = $priority;
* @param int $extraObStart
public function setExtraObStart($extraObStart) {
$this->extraObStart = $extraObStart;