Code: Select all
// Update the meta keywords
$matches = array();
preg_match('%<meta.*?content="(.*?)".+?name="keywords".*?>%si', $page_contents, $matches);
if (isset($matches[1])) {
$orig_file_contents = preg_replace('%(<meta.*?content=").*?(".+?name="keywords".*?>)%si', '\\1'.$matches[1].'\\2', $orig_file_contents);
}
$matches = array();
preg_match('%<meta.*?name="keywords".+?content="(.*?)".*?>%si', $page_contents, $matches);
if (isset($matches[1])) {
$orig_file_contents = preg_replace('%(<meta.*?name="keywords".+?content=").*?(".*?>)%si', '\\1'.$matches[1].'\\2', $orig_file_contents);
}<meta name="keyword" content="Some keywords" />
<meta content="Some keywords" name="keyword" />
Is there a way to join these two into a single statement, I think the doubling of the above two are causing some weird problems with meta tags for keywords, replacing those for descriptions, etc...
Any help appreciated