Top Menu

简单的API请求试验

今天在查看订阅的时候发现一个网站,汇总了至今为止所有被黑客攻击过的网站泄露的帐号,提供查询,试了一下,发现自己的帐号也在Adobe泄密事件的帐号中。另外发现这个网站也提供API,遂比较好奇想尝试下API的用法

首先是HTML页面,负责用户界面的输入和输出,由于功能比较简单,只需要用户输入帐号,只设置了一个输入框,另外预留了两个div,一个显示文字提示,一个显示返回的结果。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="jquery-1.10.2.js"></script><!--调用jquery--> <script type="text/javascript" src="do.js"></script><!--调用后台处理js--> <title>无标题文档</title> </head> <body> <input id="inputxt" name="input" type="text" value="foo%40bar.com" size="30" /><!--用户输入--> <!--<button id="button">发送请求</button> --><br /> <div id="textbefore"></div><!--说明文字预留--> <div id="text"></div><!--返回结果预留--> </body> </html>

Continue Reading 0

如何在WordPress后台首页添加widget

本次研究的插件是backupbuddy,WordPress后台首页widget如下图,看看backupbuddy是怎么写的

首先找到了它的显示代码,用于输出widget内容

<?php class pb_backupbuddy_dashboard extends pb_backupbuddy_dashboardcore {//继承pb_backupbuddy_dashboardcore类 /* stats() * * Displays (echos out) an overview of stats into the WordPress Dashboard. * * @return null */ function stats() { echo '<style type="text/css">'; echo ' .pb_fancy {'; echo ' font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;'; echo ' font-size: 18px;'; echo ' color: #21759B;'; echo ' }'; echo '</style>'; echo '<div>'; $backup_url = 'admin.php?page=pb_backupbuddy_backup'; $files = glob( backupbuddy_core::getBackupDirectory() . 'backup*.zip' );//搜索备份文件 if ( !is_array( $files ) || empty( $files ) ) {//判断是否有备份 $files = array();//没有则初始化$files为数组 } echo sprintf( __('You currently have %s stored backups.', 'it-l10n-backupbuddy' ), '<span class="pb_fancy"><a href="' . $backup_url . '">' . count( $files ) . '</a></span>'); if ( pb_backupbuddy::$options['last_backup_finish'] == 0 ) { echo ' ', __( 'You have not successfully created any backups.', 'it-l10n-backupbuddy' ); } else { echo ' ', sprintf( __(' Your most recent successful backup was %s ago.', 'it-l10n-backupbuddy' ), '<span class="pb_fancy"><a href="' . $backup_url . '">' . pb_backupbuddy::$format->time_ago( pb_backupbuddy::$options['last_backup_finish'] ) . '</a></span>'); } echo ' ', sprintf( __('There have been %s post/page modifications since your last backup.', 'it-l10n-backupbuddy' ), '<span class="pb_fancy"><a href="' . $backup_url . '">' . pb_backupbuddy::$options['edits_since_last'] . '</a></span>' ); echo ' <span class="pb_fancy"><a href="' . $backup_url . '">', __('Go create a backup!', 'it-l10n-backupbuddy' ), '</a></span>'; echo '</div>'; } } ?>

Continue Reading 0

AF Tools update to V1.2

今天在更新店铺的时候发现一个问题,就是抓取到的店铺其实已经没有了,在获取店铺id的时候报错,遂加入判断,没有找到指定div就跳过循环。

if($html->find('#LineZing',0)) $e = $html->find('#LineZing',0)->getAttribute ('shopid'); else continue; $shopid = $e;//}

Continue Reading 0

相声

这几天在看相声瓦舍的相声,感觉和国内的相声差别很大,首先是表现形式更接近于舞台剧,没有明显的捧逗分工。其次是很多笑点的逻辑都比较好,都倾向于表演

Continue Reading 0

Powered by WordPress. Designed by WooThemes