Subscribe to RSS feed Subscribe to RSS Feed or o follow me sígueme on Twitter? en Twitter?
Last week, we shared JavaScript and PHP code snippets to La semana pasada, hemos compartido JavaScript y fragmentos de código PHP block DiggBar bloque DiggBar . . While they served the purpose fairly well, each had its own flaws. Mientras que sirvieron para bastante bien, cada uno tenía sus propias fallas.
Here is a new, improved method that puts two and two together – by combining the PHP and JavaScript code to get the best of both worlds. Aquí está un nuevo y mejor método que pone dos y dos juntos - por la combinación de PHP y el código JavaScript para obtener lo mejor de ambos mundos. The PHP method provided would display a message and stop rendering the page, whereas the JavaScript code would remove all frames – including Google Images. El método de PHP siempre se mostrará un mensaje y dejar de hacer la página, mientras que el código JavaScript que eliminar todos los marcos - incluyendo imágenes de Google. This means that visitors who see the image from, say archive pages, would not have a link to click through to the actual page. Esto significa que los usuarios que ven la imagen de, por ejemplo, páginas de archivo, no habría que hacer clic en un vínculo a través de la página real.
So, I combined the two so that the below code checks whether the visitor is viewing a Digg shortened URL (typical of DiggBar), and if so, serves some JavaScript to redirect the user to the original web page. Entonces, los dos combinados de manera que el siguiente código comprueba si el visitante es la visualización de una URL abreviada Digg (típico de DiggBar), y si es así, sirve JavaScript para redirigir al usuario a la página web original. This method can be used not just in WordPress, but in any CMS/app that supports PHP. Este método puede ser utilizado no sólo en WordPress, pero, en cualquier CMS / app que soporta PHP.
<?php if (preg_match('#http://digg.com/\w{1,8}/?$#', <? php if (preg_match ( '# http://digg.com/ \ w (1,8 }/?$#',
$_SERVER['HTTP_REFERER']) ) { ?> $ _SERVER [ 'HTTP_REFERER'])) (?>
<script language="JavaScript" type="text/javascript"> <script type="text/javascript"> language="JavaScript"
if (top.location != self.location) top.location.replace(self.location); if (top.location! = self.location) top.location.replace (self.location);
</script> </ script>
<?php <? php
exit; salida;
} )
?> ?>
And by the way, even Engadget, a gadget blog that hits Digg on a regular basis, has Y, por cierto, incluso Engadget, un blog de gadget que llega a Digg sobre una base regular, ha blocked Digg Bar Digg bloqueado Bar . . If a top publisher should block the DiggBar, I hope Digg realizes DiggBar's problems and does some serious thinking over it. Si un editor superior debería bloquear la DiggBar, espero Digg DiggBar se da cuenta de los problemas graves y no pensar sobre ella.
Related reading Relacionados con la lectura
- How to remove DiggBar (Greasemonkey script) Cómo quitar DiggBar (Greasemonkey script)
- JavaScript and PHP codes to remove DiggBar Códigos JavaScript y PHP para eliminar DiggBar
- DiggBar Remover removes DiggBar the smart way Remover DiggBar elimina la DiggBar manera inteligente
- How to block popups and ads in Google Chrome Cómo bloquear los pop-ups y los anuncios en Google cromo