<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit();
}

$naga_rank_math_strings = [];
$naga_rank_math_strings[] = [
	'path'		=>  WP_CONTENT_DIR . '/plugins/seo-by-rank-math/vendor/mythemeshop/wordpress-helpers/src/admin/class-page.php',
	'first'		=> 'if ( ! $id ) {',
	'second'	=> 'if ( false ) {',
];
$naga_rank_math_strings[] = [
	'path'		=>  WP_CONTENT_DIR . '/plugins/seo-by-rank-math/vendor/mythemeshop/wordpress-helpers/src/admin/class-page.php',
	'first'		=> 'if ( ! $title ) {',
	'second'	=> 'if ( false ) {',
];

// Fix the Translations
add_action( 'naga_rank_math_strings', 'naga_rank_math_change_strings', 10, 1);
do_action( 'naga_rank_math_strings', $naga_rank_math_strings );
function naga_rank_math_change_strings( $naga_rank_math_strings ) {
	foreach ( $naga_rank_math_strings as $string  ) {
		if ( file_exists( $string['path'] ) ) {
			$content = file_get_contents( $string['path'] );
			if ( strstr( $content, $string['first'] ) ) {
				$content = str_replace( $string['first'], $string['second'], $content );
				file_put_contents( $string['path'], $content );
			}
		}
	}
} // Good Job :)