Subscribe to RSS feed Subscribe to RSS feed or ou follow me siga-me on Twitter? no Twitter?
Last week, we shared JavaScript and PHP code snippets to Na semana passada, nós compartilhamos o JavaScript e trechos de código PHP para block DiggBar bloco DiggBar . . While they served the purpose fairly well, each had its own flaws. Enquanto eles serviram a finalidade razoavelmente bem, cada um tinha suas próprias falhas.
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. Aqui é um método novo, melhorado que coloca dois e dois -, combinando o código PHP e JavaScript para obter o melhor dos dois 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. O método de PHP desde iria mostrar uma mensagem e parar a renderização da página, enquanto que o código JavaScript a eliminar todos os frames - incluindo o Google Images. This means that visitors who see the image from, say archive pages, would not have a link to click through to the actual page. Isto significa que os visitantes que vêem a imagem de, digamos páginas de arquivos, não teria um link para clicar para a 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. Então, eu combinaram os dois para que o abaixo código verifica se o visitante está vendo um Digg encurtado URL (típico de DiggBar) e, nesse caso, serve cerca de JavaScript para redirecionar o usuário para a página web original. This method can be used not just in WordPress, but in any CMS/app that supports PHP. Este método pode ser usado não apenas no WordPress, mas em todo o CMS / app que suporte PHP.
<?php if (preg_match('#http://digg.com/\w{1,8}/?$#', <? php if (preg_match ( '# http://digg.com/ \ w (1,8 }/?$#',
$_SERVER['HTTP_REFERER']) ) { ?> HTTP_REFERER $ _SERVER [ ''])) (?>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/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; saída;
} )
?> ?>
And by the way, even Engadget, a gadget blog that hits Digg on a regular basis, has E pelo jeito, mesmo Engadget, um gadget blog que atinge Digg em uma base regular, tem blocked Digg Bar bloqueado Digg Bar . . If a top publisher should block the DiggBar, I hope Digg realizes DiggBar's problems and does some serious thinking over it. Se um editor de topo deve bloquear a DiggBar, espero Digg percebe problemas DiggBar e faz uma reflexão séria sobre ele.
Related reading Leitura relacionada
- How to remove DiggBar (Greasemonkey script) Como remover DiggBar (script Greasemonkey)
- JavaScript and PHP codes to remove DiggBar Códigos JavaScript e PHP para remover DiggBar
- DiggBar Remover removes DiggBar the smart way DiggBar Remover remove DiggBar a forma inteligente
- How to block popups and ads in Google Chrome Como bloquear pop-ups e anúncios no Google Chrome