| @@ -73,21 +73,25 @@ | ||
| 73 | 73 | if(preg_match($wp_shortinit_section, $_wp_settings) && ($_wp_settings_parts = preg_split($wp_shortinit_section, $_wp_settings, 2)) && ($_wp_settings = trim($_wp_settings_parts[1])) && ($_wp_settings = '<?php'."\n".$_wp_settings)) |
| 74 | 74 | { |
| 75 | 75 | if(($_wp_settings = str_replace('__FILE__', "'".str_replace("'", "'", $wp_settings)."'", $_wp_settings))) // Eval compatible. Hard-code the ``__FILE__`` location here. |
| 76 | 76 | { |
| 77 | - $mu_plugins_section = '/['."\r\n\t".'\s]+foreach\s*\(\s*wp_get_mu_plugins\s*\(\s*\)\s*as\s*\$mu_plugin\s*\)['."\r\n\t".'\s]*\{?['."\r\n\t".'\s]*include_once\s*\(\s*\$mu_plugin\s*\)\s*;['."\r\n\t".'\s]*\}?['."\r\n\t".'\s]*unset\s*\(\s*\$mu_plugin\s*\)\s*;/'; | |
| 77 | + //260903.2216 Match stable loader boundaries instead of exact loop bodies; WordPress 5.1+ adds per-plugin hooks and later releases add more statements inside these loops. | |
| 78 | + $mu_plugins_section = '/\s+foreach\s*\(\s*wp_get_mu_plugins\s*\(\s*\)\s*as\s*\$mu_plugin\s*\)\s*\{.*?\}\s*unset\s*\(\s*\$mu_plugin(?:\s*,[^)]*)?\s*\)\s*;/s'; | |
| 78 | 79 | $mu_plugins_replace = "\n\n".c_ws_plugin__s2member_utils_s2o::esc_ds(trim(c_ws_plugin__s2member_utils_s2o::evl(file_get_contents(dirname(dirname(__FILE__)).'/templates/cfg-files/s2o-mu-plugins.php'))))."\n"; |
| 79 | 80 | if(($_wp_settings = preg_replace($mu_plugins_section, $mu_plugins_replace, $_wp_settings, 1, $mu_plugins_replaced)) && $mu_plugins_replaced) |
| 80 | 81 | { |
| 81 | - $nw_plugins_section = '/['."\r\n\t".'\s]+foreach\s*\(\s*wp_get_active_network_plugins\s*\(\s*\)\s*as\s*\$network_plugin\s*\)['."\r\n\t".'\s]*\{?['."\r\n\t".'\s]*wp_register_plugin_realpath\s*\(\s*\$network_plugin\s*\)\s*;['."\r\n\t".'\s]*include_once\s*\(\s*\$network_plugin\s*\)\s*;['."\r\n\t".'\s]*\}?['."\r\n\t".'\s]*unset\s*\(\s*\$network_plugin\s*\)\s*;/'; | |
| 82 | + //260903.2216 Keep the network-plugin replacement tolerant of WordPress statements added between the loader's stable foreach/unset boundaries. | |
| 83 | + $nw_plugins_section = '/\s+foreach\s*\(\s*wp_get_active_network_plugins\s*\(\s*\)\s*as\s*\$network_plugin\s*\)\s*\{.*?\}\s*unset\s*\(\s*\$network_plugin(?:\s*,[^)]*)?\s*\)\s*;/s'; | |
| 82 | 84 | $nw_plugins_replace = "\n\n".c_ws_plugin__s2member_utils_s2o::esc_ds(trim(c_ws_plugin__s2member_utils_s2o::evl(file_get_contents(dirname(dirname(__FILE__)).'/templates/cfg-files/s2o-nw-plugins.php'))))."\n"; |
| 83 | 85 | if(($_wp_settings = preg_replace($nw_plugins_section, $nw_plugins_replace, $_wp_settings, 1, $nw_plugins_replaced)) && $nw_plugins_replaced) |
| 84 | 86 | { |
| 85 | - $st_plugins_section = '/['."\r\n\t".'\s]+foreach\s*\(\s*wp_get_active_and_valid_plugins\s*\(\s*\)\s*as\s*\$plugin\s*\)['."\r\n\t".'\s]*\{?['."\r\n\t".'\s]*wp_register_plugin_realpath\s*\(\s*\$plugin\s*\)\s*;['."\r\n\t".'\s]*include_once\s*\(\s*\$plugin\s*\)\s*;['."\r\n\t".'\s]*\}?['."\r\n\t".'\s ]*unset\s*\(\s*\$plugin\s*\)\s*;/'; | |
| 87 | + //260903.2216 Keep the active-plugin replacement tolerant of metadata, translation, and plugin-loaded bookkeeping added by newer WordPress releases. | |
| 88 | + $st_plugins_section = '/\s+foreach\s*\(\s*wp_get_active_and_valid_plugins\s*\(\s*\)\s*as\s*\$plugin\s*\)\s*\{.*?\}\s*unset\s*\(\s*\$plugin(?:\s*,[^)]*)?\s*\)\s*;/s'; | |
| 86 | 89 | $st_plugins_replace = "\n\n".c_ws_plugin__s2member_utils_s2o::esc_ds(trim(c_ws_plugin__s2member_utils_s2o::evl(file_get_contents(dirname(dirname(__FILE__)).'/templates/cfg-files/s2o-st-plugins.php'))))."\n"; |
| 87 | 90 | if(($_wp_settings = preg_replace($st_plugins_section, $st_plugins_replace, $_wp_settings, 1, $st_plugins_replaced)) && $st_plugins_replaced) |
| 88 | 91 | { |
| 89 | - $th_funcs_section = '/['."\r\n\t".'\s]+if\s*\(\s*\!\s*defined\s*\(\s*[\'"]WP_INSTALLING[\'"]\s*\)\s*\|\|\s*[\'"]wp\-activate\.php[\'"]\s*\=\=\=\s*\$pagenow\s*\)['."\r\n\t".'\s]*\{['."\r\n\t".'\s]*if\s*\(\s*TEMPLATEPATH\s*\!\=\=\s*STYLESHEETPATH\s*&&\s*file_exists\s*\(\s*STYLESHEETPATH\s*\.\s*[\'"]\/functions\.php[\'"]\s*\)\s*\)['."\r\n\t".'\s]*\{?['."\r\n\t".'\s]*include\s*\(\s*STYLESHEETPATH\s*\.\s*[\'"]\/functions\.php[\'"]\s*\);['."\r\n\t".'\s]*\}?['."\r\n\t".'\s]*if\s*\(\s*file_exists\s*\(\s*TEMPLATEPATH\s*\.\s*[\'"]\/functions\.php[\'"]\s*\)\s*\)['."\r\n\t".'\s]*\{?['."\r\n\t".'\s]*include\s*\(\s*TEMPLATEPATH\s*\.\s*[\'"]\/functions\.php[\'"]\s*\);['."\r\n\t".'\s]*\}?['."\r\n\t".'\s]*\}/'; | |
| 92 | + //260903.2302 Support all declared WordPress 4.2+ theme-loader forms: WP_INSTALLING through 4.3, wp_installing() in 4.4–5.0, and wp_get_active_and_valid_themes() from 5.1 onward. | |
| 93 | + $th_funcs_section = '/(?:\s+if\s*\(\s*!\s*(?:defined\s*\(\s*[\'"]WP_INSTALLING[\'"]\s*\)|wp_installing\s*\(\s*\))\s*\|\|\s*[\'"]wp\-activate\.php[\'"]\s*\=\=\=\s*\$pagenow\s*\)\s*\{.*?\}\s*(?=\/\*\*)|\s+foreach\s*\(\s*wp_get_active_and_valid_themes\s*\(\s*\)\s*as\s*\$theme\s*\)\s*\{.*?\}\s*unset\s*\(\s*\$theme(?:\s*,[^)]*)?\s*\)\s*;)/s'; | |
| 90 | 94 | $th_funcs_replace = "\n\n".c_ws_plugin__s2member_utils_s2o::esc_ds(trim(c_ws_plugin__s2member_utils_s2o::evl(file_get_contents(dirname(dirname(__FILE__)).'/templates/cfg-files/s2o-th-funcs.php'))))."\n"; |
| 91 | 95 | if(($_wp_settings = preg_replace($th_funcs_section, $th_funcs_replace, $_wp_settings, 1, $th_funcs_replaced)) && $th_funcs_replaced) |
| 92 | 96 | { |
| 93 | 97 | if(($_wp_settings = str_replace('__FILE__', '"'.str_replace('"', '\"', $o_file).'"', $_wp_settings))) // Eval compatible. |