小邪的Dabr程序与模板修改手记 [详细]

1. Dabr 的安装与密码保护教程:

> 呵呵,关于 Dabr 的安装与使用 Cookies 加密码来保护的方法,小邪前天就已经写过教程了。
> 超强力的穿越传送门 - http://www.evlos.org/2010/02/09/how-to-build-a-pretected-dabr

2. 关于 ./browsers/desktop.php 文件:

1
2
3
4
function desktop_theme_action_icon($url, $image_url, $text) {
  return "<a href='$url'>$text</a>";
}
//在文件的顶部增加以上代码,就可以使 DM RT @ 等图标使用文本显示来加快加载速度。
1
2
3
4
5
6
function desktop_theme_status_form($text = '', $in_reply_to_id = NULL) {
//为缩短文章长度,此处内容省略掉鸟,下面省略此将用长长的点号表示。
  <textarea id="status" name="status" rows="3">
  //这里把 style="width:100%; max-width: 400px;" 这段代码去掉,我们用 CSS 来重新指定。
//......................
}

3. 关于 ./common/menu.php 文件:

1
2
3
4
5
function theme_menu_both($menu) {
//................................
  return "<div class='menu menu-$menu'><div class='menuc'>".implode(' | ', $links).'</div></div>';
  //这里增加一个 DIV 同时 Class 指定为 Menuc 来微调顶部与底部菜单的显示位置。
}

4. 关于 ./common/theme.php 文件:

1
2
3
4
5
6
function theme_page($title, $content) {
//......................
<body><div id="wrap">', $body, '</div></body>
//这里增加一个 DIV 同时 Id 指定为 Wrap 来居中显示 Twitter 消息面板并。
//..........................
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function theme_css() {
  $c = theme('colours');
  return "<style type='text/css'>
	#wrap { width:660px; margin:0 auto; background:#fff; }
	textarea#status { width:99%; height:50px; }
	#message { width:95%; height:50px; }
	.timeline { width:100%; }
	.menu { width:100%; }
	.menuc { padding:2px 3px; }
	a{color:#{$c->links}}
	table{border-collapse:collapse}
	form{margin:.3em;}
	td{vertical-align:top;padding:0.3em}
	img{border:0}
	small,small a{color:#{$c->small}}
	body{background:#{$c->bodybg};
	color:#{$c->bodyt};margin:0;font:90% sans-serif}
	tr.odd td{background:#{$c->odd}}
	tr.even td{background:#{$c->even}}
	tr.reply td{background:#{$c->replyodd}
	}tr.reply.even td{background: #{$c->replyeven}}
	.menu{color:#{$c->menut};background:#{$c->menubg};}
	.menu a{color:#{$c->menua};text-decoration: none}
	</style>";
}
//请在 Theme.php 找到函数 Theme_css 文件,然后进行整个函数的替换即可。

5. 关于 ./common/twitter.php 文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function js_counter($name)
{
	$script = '<script type="text/javascript">
	function updateCount() 
	{
		document.getElementById("remaining").innerHTML = 140 - 
document.getElementById("' . $name . '").value.length;
		setTimeout(updateCount, 400);
	}
	updateCount();</script>';
	return $script;
}
//在 Twitter.php 文件里面找到 js_counter 函数,把它整个替换成上面的这个样子。
//具体的修改就是,小邪删除了 js_counter 函数中的 confirmShortTweet() 函数。
//因为这个函数实在是太烦人了,只要发言低于 30 个字符就跳出一个对话框提醒你发言短。
1
2
3
4
5
6
7
function twitter_process($url, $post_data = false) {
//............................
  if (user_type() != 'oauth' && user_is_authenticated())
    curl_setopt($ch, CURLOPT_USERPWD, user_current_username().':'.$GLOBALS['user']['password']);
//关键是在这里增加这一行代码,就可以避免出现 417 expect 100-continue 错误。
//...............................
}
1
2
3
4
5
6
7
8
9
10
11
12
13
function twitter_parse_tags($input) 
{
//.....................
	if (!in_array(setting_fetch('browser'), array('text', 'worksafe'))) 
	{
		//Add in images
		//$out = twitter_photo_replace($out);
//这里的关键是把 $out = twitter_photo_replace($out); 给注释掉。
//这样子就可以不直接显示比如 Img.ly 里面的图片了,因为经常被墙,所以很多图无法显示。
//结果载入要载入半天,然后才显示一个叉叉,这样就太杯具了,所以不要直接显示,而是给个链接。
	}
//..........................
}

6. 关于 ./about.html 文件:

> ╮(╯▽╰)╭,空即是色,色即是空,所以咱把它清空了算了,显示那么长的英文说明没啥意义。

Comments are closed.