插件43:可以自动返回的链接
2011-10-31 14:20
218 查看
<?php // Plug-in 43: Auto Back Links $logfile = "refererlog"; echo "Referring URLs in logfile '$logfile':<br /><br />"; $results = PIPHP_AutoBackLinks($logfile); if (!$results[0]) echo "No referring URLs"; else foreach ($results[1] as $result) { $title = PIPHP_GetTitleFromURL($result); echo "<a href='$result'>"; echo $title ? $title : $result; echo "</a><br />"; } function PIPHP_AutoBackLinks($filename) { // Plug-in 42: Auto Back Links // // This plug-in takes the filename of a log file, as // supplied to Plug-in 30, PIPHP_RefererLog(), and returns // a two element array where the first value is TRUE and // the second is an array of inbound links sorted by the // amount of hits received. If there are no links only a // single element array is returned, with the value FALSE. // The argument required is: // // $filename: The name of a log file if (!file_exists($filename)) return array(FALSE); $inbound = array(); $logfile = file_get_contents($filename); $links = explode("\n", rtrim($logfile)); $links = array_count_values($links); arsort($links, SORT_NUMERIC); foreach ($links as $key => $val) if ($key != " No Referer") $inbound[] = $key; return array(TRUE, $inbound); } // The function below is repeated here to ensure that the // main function (which relies on it) has access to it function PIPHP_GetTitleFromURL($page) { // Plug-in 42: Get Title From URL // // This plug-in takes the URL of a web page and returns that // page's title. If the page cannot be loaded then FALSE is // returned. The argument required is: // // $page: The URL of a page, including the preceding // http:// $contents = @file_get_contents($page); if (!$contents) return FALSE; preg_match("/<title>(.*)<\/title>/i", $contents, $matches); if (count($matches)) return $matches[1]; else return FALSE; } ?>
插件说明:
本插件接受一个文件名,他保存了所有链接到当前网页的网站的详细信息。这个文件名由插件30的PIPHP_RefererLog()函数创建的。
本插件需要以下参数
$filename 文件名或路径
相关文章推荐
- 使用jQuery插件jRemoteValidate进行远程ajax验证,可以自定义返回的信息
- highcharts插件中,在外部点击一个按钮或者别的时间,可以链接highcharts上点击事件
- 第3款插件:scrolltopcontrol返回页顶的导航链接插件,超方便!
- 解决Mysql连接池被关闭 ,hibernate尝试连接不能连接的问题。 (默认mysql连接池可以访问的时间为8小时,如果超过8小时没有连接,mysql会自动关闭连接池。系统发布第二天访问链接关闭问题。
- UIWebView中 跳到新的链接 可以滑动返回
- Struts2.0里的过滤器interceptor之用户只可以访问Login.action与Register.action,访问其它.action的链接时,自动切换到登录页面
- 用gulp的spritesmith插件,可以自动化生成雪碧图,还可以自动生成样式以及定位。
- 非常好的插件(VAssitsx),可以对VS2005、2008、2010自动补齐
- gulp改造gulp-rev-append插件实现资源文件链接自动添加MD5版本号
- Eclipse在线安装插件spket(可以自动提示extjs,支持ext4.0.7版本)
- dede二次开发后台自动推送链接给百度的seo插件
- wordpress 为文章内容添加自动过滤,例如为出站链接添加nofollow,也可以将淘宝客链接转换。。
- 一个可以返回前一页并自动刷新页面的ASP代码.
- VS2012的插件,可以编辑lua,高亮,自动完成等。BabeLua is a free lua editor/debuger (vs extension)
- 背景图可以随时自动调整大小jquery插件backstretch
- input 的属性autocomplete 默认为on 其含义代表是否让浏览器自动记录之前输入的值 很多时候,需要对客户的资料进行保密,防止浏览器软件或者恶意插件获取到 可以在input中加入a
- Q:当我将USB设备链接至计算机时,WinDriver会自动显示出USB的ID,但当我在执行热插入时,该USB的ID会变更,因此我无法确认该ID是指何者设备。请问WinDriver是否可以定义该设备的ID内容在执行热插入前后皆是相同的?
- 使用无线方式发布ipa (即用户可以通过点击网页链接或扫瞄二维码来自动安装app)
- 自动增加WordPress博客的内外部链接的插件WP Keyword Link的介绍
- 使用localResizeIMG插件上传图片到七牛云返回链接通过PHP进行保存