Notifications

Did we help you in something? If so, we would very much appreciate if you Share our website or forums link. Thank you!

[Solved] Osclass: How to Make all posted ads links NOFOLLOW and open in new window  

  RSS
Alessandro Cagliostro
(@alessandro-cagliostro)
Estimable Member

How to Make all posted ads links NOFOLLOW and open in new window ?

Posted : March 19, 2017 12:45
Alessandro Cagliostro
(@alessandro-cagliostro)
Estimable Member

This is for Osclass 3.6x & Osclass 3.7x.

Edit: /oc-includes/osclass/helpers/hItems.php

Find:

return ‘<a href=”‘.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'” >’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'</a>’;
} else {
return ‘<a href=” http://’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'” >’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8”).'</a>’;

Replace with:

return ‘<a href=”‘.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'” target=”_blank” rel=”nofollow” >’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'</a>’;
} else {
return ‘<a href=” http://’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8″).'” target=”_blank” rel=”nofollow” >’.html_entity_decode(osc_field(osc_item_meta(), ‘s_value’, ”), ENT_COMPAT, “UTF-8”).'</a>’;
Posted : November 18, 2017 18:23
Editor
(@editor)
Reputable Member Moderator

This still works in Osclass 3.9, i post here the exact code location and the changes needed. Maybe it is more clear since is it not good to post code in a Quote (you better use Code (<>) option (i edited the above post).

 

} else if($meta['e_type']=="URL") {
if($value!='') {
if(stripos($value,'http://')!==false || stripos($value,'https://')!==false) {

return '<a href="'.html_entity_decode($value, ENT_COMPAT, "UTF-8").'" target="_blank" rel="nofollow" >'.html_entity_decode($value, ENT_COMPAT, "UTF-8").'</a>';
} else {

return '<a href="http://'.html_entity_decode($value, ENT_COMPAT, "UTF-8").'" target="_blank" rel="nofollow" >'.html_entity_decode($value, ENT_COMPAT, "UTF-8").'</a>';
}
} else {
return '';
}

Here is the file also zipped (hitems.php)

 

Posted : January 14, 2020 14:06
Share: