Skip to content

Commit

Permalink
fix urls to exclude, replace regex
Browse files Browse the repository at this point in the history
  • Loading branch information
edsonsantoro committed Oct 3, 2023
1 parent 1e46b66 commit 2853782
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions admin/class-wpmu-client-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public function replace_strings(string $status, string $directory = '', string $
$newContent = str_replace($search, $replace, $content);
if ($content !== $newContent) {
$count++;
$htmlContent = preg_replace("/\?ver=[^\s&]+/", '', $newContent);
$htmlContent = preg_replace("/\?ver=[^\s&\"]+/", '', $newContent);
file_put_contents($filePath, $htmlContent);
file_put_contents($log_file, "Substituição feita em " . $filePath . "\n", FILE_APPEND);
}
Expand Down Expand Up @@ -728,19 +728,18 @@ public function set_ss_options($new_blog_id, $prev_blog_id, $context)
$options = get_blog_option($new_blog_id, 'simply-static');

$urls_to_exclude = $options['urls_to_exclude'];
$exclude_feed = array(
site_url() . DIRECTORY_SEPARATOR . 'feed' => array(
'url' => site_url() . DIRECTORY_SEPARATOR . 'feed',
'do_not_save' => '1',
'do_not_follow' => '1',
)
);

if (is_array($urls_to_exclude)) {
$urls_to_exclude = array_merge($urls_to_exclude, $exclude_feed);
} else {
$urls_to_exclude = $exclude_feed;

if( !isset($urls_to_exclude) || empty($urls_to_exclude) ) {

$exclude_feed = "wp-json\nwp-login";

if (is_array($urls_to_exclude)) {
$urls_to_exclude = array_merge($urls_to_exclude, [$exclude_feed]);
} else {
$urls_to_exclude = $exclude_feed;
}
}

$options['force_replace_url'] = 'on';
$options['urls_to_exclude'] = $urls_to_exclude;
$options['clear_directory_before_export'] = 'on';
Expand Down Expand Up @@ -1129,4 +1128,4 @@ public function add_admin_button(WP_Admin_Bar $wp_admin_bar)

$wp_admin_bar->add_node($args);
}
}
}
2 changes: 1 addition & 1 deletion includes/class-wpmu-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,4 +568,4 @@ public function upgrade_blog_options(int $blog_id)
}
}
}
}
}

0 comments on commit 2853782

Please sign in to comment.