I am just wondering for those of you more skilled than I am, regarding this plugin:
http://wordpress.org/extend/plugins/hidepost/
If I enable Link Protection only (without using Hidepost's main feature to protect whole posts), I want to show the actual title/text for the link in question but without it being linked (ie, tags removed), or it being linked to the url I specify in $hidepost_link_text setting instead, how would I have to change the functions inside hidepost.php in order to accomplish this (and I've tried a few things, only resulting in errors and such)?
Keep in mind here is the default behaviour below (it replaces all links with $hidepost_link_text text instead of what I'm trying to do - replacing the value of href with my own link and or extra code, etc):
function hidepost_replace_link($content) {
global $current_user, $user_ID, $hidepost_link_text, $hidepost_link_text_hide, $m_id;
$m_id++;
preg_match_all('#\<a(.*?)\>(.*?)\</a\>#sie', $content, $matches); //Find all the link
get_currentuserinfo();
if ($user_ID == ''){//If not logged in
if ($hidepost_link_text_hide != 1) return $hidepost_link_text; else return '';
} else {return $matches[0][$m_id];} //Or return the content if user can see
}
function hidepost_filter_post($content) {
global $m_id, $hidepost_hide_link, $hidepost_hide_content;
hidepost_replace_pattern();
//Protect the link
if ($hidepost_hide_link == 1) {
$m_id = -1;//Magic ^.^
$content = preg_replace('#\<a(.*?)\>(.*?)\</a\>#sie','hidepost_replace_link($content)',$content);
}
//Protect content
if ($hidepost_hide_content == 1) {
$m_id = -1;
$content = preg_replace('#\[hidepost(.*?)\](.*?)\[/hidepost\]#sie','hidepost_replace_hide($content)',$content);
}
return $content;
}
Thanks!