Subscribe to RSS feed اشترك في آر إس إس or أو follow me يتبعني on Twitter? على التغريد؟
Last week, we shared JavaScript and PHP code snippets to وفي الأسبوع الماضي ، شاركنا جافا سكريبت و [فب مقتطفات الشفرة ل block DiggBar كتلة DiggBar . . While they served the purpose fairly well, each had its own flaws. في حين أنها تخدم غرض جيد الى حد ما ، كان كل عيوبها الخاصة بها.
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. هنا هو جديد ، وتحسين الأسلوب الذي يضع اثنين واثنين معا -- عن طريق الجمع بين بى وشفرة جافا سكريبت للحصول على أفضل ما في العالمين. The PHP method provided would display a message and stop rendering the page, whereas the JavaScript code would remove all frames – including 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. هذا يعني ان الزوار الذين يرون في الصورة ، ويقول أرشيف صفحات ، لن يكون له صلة من خلال النقر على صفحة الفعلية.
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. لذا ، أنا الجمع بين الاثنين بحيث يتحقق رمز أدناه ما إذا كان الزائر مشاهدة يسو اختصار عنوان (نموذجي من DiggBar) ، وإذا كان الأمر كذلك ، ويخدم بعض جافا سكريبت لإعادة توجيه المستخدم لصفحة الويب الأصلية. This method can be used not just in WordPress, but in any CMS/app that supports PHP. هذه الطريقة يمكن استخدامها ليس فقط في وورد ، ولكن في أي اتفاقية الأنواع المهاجرة / الوكالة التي تدعم بي.
<?php if (preg_match('#http://digg.com/\w{1,8}/?$#', <؟ [فب] إذا (preg_match ( '# http://digg.com/ \ ث (1،8}/؟$#'،
$_SERVER['HTTP_REFERER']) ) { ?> $ _SERVER [ 'HTTP_REFERER'])) (؟>
<script language="JavaScript" type="text/javascript"> <scriptlanguage="JavaScript" type="text/javascript">
if (top.location != self.location) top.location.replace(self.location); إذا كان (top.location! = self.location) top.location.replace (self.location) ؛
</script> </ النصي>
<?php <؟ [فب]
exit; خروج ؛
} )
?> ؟>
And by the way, even Engadget, a gadget blog that hits Digg on a regular basis, has وبالمناسبة ، حتى إنغدجت ، وهي الأداة بلوق الذي يضرب يسو على أساس منتظم ، قد blocked Digg Bar منعت يسو بار . . If a top publisher should block the DiggBar, I hope Digg realizes DiggBar's problems and does some serious thinking over it. إذا كان الناشر أعلى ينبغي عرقلة DiggBar ، وآمل أن يدرك يسو DiggBar مشاكل وبعض التفكير الجدي لا أكثر من ذلك.
Related reading قراءة كلمات
- How to remove DiggBar (Greasemonkey script) كيفية إزالة DiggBar (غرسمونكي النصي)
- JavaScript and PHP codes to remove DiggBar جافا سكريبت و [فب رموز لإزالة DiggBar
- DiggBar Remover removes DiggBar the smart way DiggBar مزيل يزيل DiggBar الطريقة الذكية
- How to block popups and ads in Google Chrome كيفية منع النوافذ المنبثقة والاعلانات في جوجل كروم