This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This little add-on blocks a visitor using the country reported by AbuseIPDB. This code is intended to be placed | |
* inside a functions.php file into a WordPress theme. | |
* | |
* Also, this check happens as soon as possible, using the very first available hook for the theme. Other good options | |
* include "init" and "wp_loaded" hooks. | |
* | |
* You can also try and use the "plugins_loaded" hook, but it is meant to be used more when this code is into |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# coding=utf-8 | |
from subprocess import run | |
import requests | |
abuseipdb_apikey = 'YOUR_API_KEY' | |
abuseipdb_url = 'https://api.abuseipdb.com/api/v2/blacklist' | |
set_name = 'abuseipdb_blacklist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_enqueue_scripts', 'dtorrer_agregarFontAwesome'); | |
function dtorrer_agregarFontAwesome(){ | |
wp_enqueue_script('fontawesome', 'https://use.fontawesome.com/releases/v5.7.2/js/all.js', array(), '5.7.2'); | |
wp_enqueue_style('miestilo', plugin_dir_url( __FILE__ ) . 'estilos/miestilo.css', array('jquery', 'fontawesome'), '1.0.0'); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* We verify the HTTP code that WordPress will send and then we decide if the current page | |
* should be allowed to be cached. | |
*/ | |
add_filter('swift_performance_is_cacheable', 'dtorrer_swift_iscacheable', 20, 1); | |
function dtorrer_swift_iscacheable( $cacheable = FALSE ){ | |
if( FALSE === $cacheable ){ return $cacheable; } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'dtorrer_agregar_estilos_al_tema' ); | |
function dtorrer_agregar_estilos_al_tema() { | |
wp_enqueue_style( 'estilos-temapadre', get_template_directory_uri() . '/style.css' ); | |
wp_enqueue_style( 'estilos-temahijo', get_stylesheet_directory_uri() . '/style.css',array( 'estilos-temapadre' ) ); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* SI TENEMOS UN REDIRECTING LOOP CON CLOUDFLARE Y HTTPS */ | |
/* LE OBLIGAMOS AL SERVIDOR A "ACTIVAR" EL MODO HTTPS */ | |
define('FORCE_SSL_ADMIN', true); | |
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) | |
$_SERVER['HTTPS']='on'; | |
/* SI USAMOS CLOUDFLARE, USAMOS ESTO PARA RESTAURAR EL IP DEL VISITANTE */ | |
if ( !empty( $_SERVER['REMOTE_ADDR'] ) && !empty( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wp_footer', dtorrer_diagnostico); | |
function dtorrer_diagnostico(){ | |
$datos = array(); | |
$datos[] = 'Fecha: ' . date('Y-m-d H:i:s'); | |
$datos[] = 'Tiempo: ' . timer_stop(0, 2) . ' segundos.'; | |
if (function_exists('memory_get_usage')) { | |
$unidades = array('b','kb','mb','gb','tb','pb'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE $tableprefix_et_social_stats ( | |
id mediumint(9) NOT NULL AUTO_INCREMENT, | |
sharing_date datetime DEFAULT '1000-01-01 00:00:00' NOT NULL, | |
network varchar(20) NOT NULL, | |
action varchar(10) NOT NULL, | |
post_id bigint(20) NOT NULL, | |
ip_address varchar(45) NOT NULL, | |
media_url varchar(2083) NOT NULL, | |
location varchar(20) NOT NULL, | |
UNIQUE KEY id (id)) DEFAULT CHARACTER SET utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dtorrer_agregar_seguimiento_envio() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
ga( 'send', 'event', 'Contact Form', 'submit' ); | |
location = 'https://dtorrer.com/url-destino'; | |
}, false ); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dtorrer_agregar_seguimiento_envio() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
location = 'https://dtorrer.com/url-destino'; | |
}, false ); | |
</script> | |
<?php |
NewerOlder