Subscribe to RSS feed Subscriure's al feed RSS or o follow me em segueixen on Twitter? a Twitter?
Last week, we shared JavaScript and PHP code snippets to La setmana passada, hem compartit els fragments de codi JavaScript i PHP block DiggBar bloc DiggBar . . While they served the purpose fairly well, each had its own flaws. Si bé van complir amb el propòsit bastant bé, cadascun tenia els seus propis defectes.
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í hi ha un mètode nou i millorat que posa dos i dos junts - mitjançant la combinació de PHP i codi JavaScript per a obtenir el millor d'ambdós mons. 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ètode de PHP sempre es mostrarà un missatge i aturar el renderitzat de la pàgina, mentre que el JavaScript podria eliminar tots els marcs - incloent 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. Això significa que els visitants que veuen la imatge de, per exemple les pàgines d'arxiu, no s'hauria de fer clic a un enllaç 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. Així que els dos combinats de manera que el següent codi comprova si l'usuari està veient una Digg escurçar URL (típic de DiggBar), i si és així, serveix d'alguna cosa Javascript per redirigir l'usuari a la pàgina web original. This method can be used not just in WordPress, but in any CMS/app that supports PHP. Aquest mètode pot utilitzar no només a WordPress, però en qualsevol CMS / aplicació que suporti 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"> language = "JavaScript" <script 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 De SPAM
exit; sortida;
} )
?> ?>
And by the way, even Engadget, a gadget blog that hits Digg on a regular basis, has I, per cert, fins i tot Engadget, un bloc amb gadget que colpeja Digg sobre una base regular, s'ha blocked Digg Bar bloquejat Digg 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 ha de bloquejar la DiggBar, espero que Digg es dóna compte dels problemes de DiggBar i fa alguna cosa d'una reflexió seriosa sobre la mateixa.
Related reading Lectura relacionada
- How to remove DiggBar (Greasemonkey script) Com eliminar DiggBar (script de Greasemonkey)
- JavaScript and PHP codes to remove DiggBar JavaScript i PHP codis per eliminar DiggBar
- DiggBar Remover removes DiggBar the smart way DiggBar Remenar elimina DiggBar la manera més intel ligent
- How to block popups and ads in Google Chrome Com bloquejar finestres emergents i anuncis a Google Chrome