Plugin not working & permalink erorr after upgrade to php 7x on Nginx

Please remember that you are more likely to get a helpful response if you ask a specific question. If the question is “what PHP do I have to change to make it work?” that would be better but most programmers can provide helpful answers if you describe the functionality you require (vs. just posting code from an unnamed plugin).

There are many things to keep in mind regarding the code you’ve sent:

  1. Either there is code missing (probable) or there is an issue with the plugin (in general). You’ll note that the method rewrite_rules requires a parameter called $rules and yet the filter doesn’t seem to pass a value to the method (but I could be missing something here).

  2. The plugin is failing because mod_rewrite is an Apache module and it is not supported by nginx. This plugin writes some custom mod_rewrite rules to .htaccess and since nginx doesn’t recognize the mod_rewrite apache module nor does it read .htaccess files, it will never work and would require a complete rewrite.

As a workaround, you might consider adding a simple filter in functions.php on the_content to rewrite the URLs to recreate the functionality that this plugin appears to provide. Here is an example:

add_filter('the_content', function( $input ) {
  $output = $input;
  $re="#href=.[^"\"]+.#';
  $replace="$1 target="_blank"";
  $output = preg_replace($re, $replace, $output);

  return $output;
}, 1);

Unfortunately, because I don’t know what this plugin is intended to do, I can’t provide a more detailed example but in all honesty, you’re probably better served by finding a URL rewriting plugin that does work under nginx.