Osclass: How to Mak...
 
Notifications
Clear all

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

3 Posts
2 Users
0 Reactions
1,105 Views
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
Topic starter
 

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

 
Posted : March 19, 2017 14:45
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
Topic starter
 

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 20:23
Editor
(@editor)
Posts: 553
Honorable Member Admin
 

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 16:06