Skip to content
Snippets Groups Projects
Commit 62f5ff57 authored by lucha's avatar lucha
Browse files

rewrite links regex

parent 0b6389fe
Branches
Tags
No related merge requests found
......@@ -19,7 +19,7 @@ if ( !function_exists('add_action') ) {
function rewrite_links($buffer) {
// replace href or src attributes within script, link, base, and img tags with just "//" for protocol
$re = "/(<(?:script|link|base|img|form|a)(?:[^>]*)(?:href|src|action)=[\"'])http:\\/\\/([^.]+\.noblogs\.org)/i";
$re = "#(<(?:script|link|base|img|form|a)(?:[^>]*)(?:href|src|action)=[\"'])http://([^.]+\.noblogs\.org)#i";
$subst = "$1https://$2";
return preg_replace($re, $subst, $buffer);
}
......@@ -30,7 +30,7 @@ function noblogs_wp_ssl_buffer_wrapup($buffer) {
if (empty($_SERVER['HTTPS'])) {
return $buffer;
}
// Check for a Content-Type header. Currently only apply rewriting to "text/html" or undefined
$headers = headers_list();
$content_type = null;
......@@ -51,11 +51,11 @@ function noblogs_wp_ssl_buffer_wrapup($buffer) {
$buffer = $return;
}
}
return $buffer;
return $buffer;
}
// This is a filter function that act on the post $content
// This is a filter function that act on the post $content
function noblogs_wp_ssl_content_filter($content) {
// skip rewrite if not on HTTPS
if (empty($_SERVER['HTTPS'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment