. */ // No direct call if( !defined( 'YOURLS_ABSPATH' ) ) die(); // Hook the custom function into the 'shunt_add_new_link' event yourls_add_filter( 'shunt_add_new_link', 'apelly_blacklist_domain_root' ); // Hook the admin page into the 'plugins_loaded' event yourls_add_action( 'plugins_loaded', 'apelly_blacklist_domain_add_page' ); // Get blacklisted domains from YOURLS options feature and compare with current domain address function apelly_blacklist_domain_root ( $bol, $url ) { $return = false; $domain_list = yourls_get_option ('apelly_blacklist_domain_list'); if ( $domain_list ) { $domain_list = unserialize ( $domain_list ); foreach($domain_list as $blacklisted_domain) { if (strpos($url,$blacklisted_domain)) { // Check if a YourlsBlacklistIPs is installed and active if (yourls_is_active_plugin( YOURLS_PLUGINDIR .'/BlackListIP/plugin.php' )) { $IP = yourls_get_IP(); // IP blacklisted already? ludo_blacklist_ip_root( array( $IP ) ); // <---- dies if ip is blacklisted // fetch the blacklisted IP addresses $IP_List = yourls_get_option ('ludo_blacklist_ip_liste'); $IP_List = ( $IP_List ) ? ( unserialize ( $IP_List ) ):((array)NULL); // add this IP $Parsed_IP = ludo_blacklist_ip_Analyze_IP ( $IP ) ; if ( $Parsed_IP != "NULL" ) { $IP_List[] = $Parsed_IP ; } // Update the blacklist yourls_update_option ( 'ludo_blacklist_ip_liste', serialize ( $IP_List ) ); } // stop //yourls_die( 'Blacklisted domain', 'Forbidden', 403 ); "