Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion no_follow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ parameter is set.
### 3.0

- Updated plugin to be 6.0 compatible
- Removed deprecated blacklist/whitelist in favor of blockedlist/allowlist
- Removed deprecated blacklist/whitelist in favor of blockedlist/allowlist for EE6 and newer
- `whitelist` parameter is now `allowlist`

### 2.0

Expand Down
29 changes: 20 additions & 9 deletions no_follow/pi.no_follow.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,20 @@ function __construct($str = '')

$ignore = array();

if (is_array(ee()->blockedlist->allowed))
if (version_compare(ee()->config->item('app_version'), '6.0', '<'))
{
$ignore = ee()->blockedlist->allowed;
$allowed = ee()->blacklist->whitelisted;
$allowedtablename = "whitelisted";
}
else
{
$allowed = ee()->blockedlist->allowed;
$allowedtablename = "allowedlist";
}

if (is_array($allowed))
{
$ignore = $allowed;
$group = 'none';
$allowedlist = 'n';
}
Expand All @@ -84,24 +95,24 @@ function __construct($str = '')
// Retrieve allowedlist URLs
// -------------------------------

if ($allowedlist == 'y' && ee()->db->table_exists('allowedlist'))
if ($allowedlist == 'y' && ee()->db->table_exists($allowedtablename))
{
ee()->db->select('allowedlist_value');
ee()->db->where('allowedlist_type', 'url');
ee()->db->where('allowedlist_value !=', '');
$query = ee()->db->get('allowedlist');
ee()->db->select("{$allowedtablename}_value");
ee()->db->where("{$allowedtablename}_type", 'url');
ee()->db->where("{$allowedtablename}_value !=", '');
$query = ee()->db->get($allowedtablename);

if ($query->num_rows() > 0)
{
$ignore = array_merge($ignore, explode('|', $query->row('allowedlist_value')));
$ignore = array_merge($ignore, explode('|', $query->row("{$allowedtablename}_value")));
}
}

// -------------------------------
// Cache Ignored URLs
// -------------------------------

ee()->blockedlist->allowed = $ignore;
$allowed = $ignore;

// -------------------------------
// Search and Modify URLs
Expand Down