ThreadAD

마지막으로 [b]

sub thread {
	my ($txt) = @_;

    # 페이지 이름을 쓰지 않음
	$txt =~ s/(&__LT__;thread\()([-+]?\d+(,\d+)?)(\)&__GT__;)/$1$pageid,$2$4/gi;

	$txt =~ s/(&__LT__;thread\(([^,]+),([-+]?\d+),(\d+)\)&__GT__;)/&MacroThread($1,$2,$3,1,$4)/gei;
	$txt =~ s/(&__LT__;thread\(([^,]+),([-+]?\d+)\)&__GT__;)/&MacroThread($1,$2,$3,1,0)/gei;
	$txt =~ s/(&__LT__;thread&__GT__;((.)*?)&__LT__;\/thread&__GT__;)/&MacroThreadBlock($2)/geis;

	return $txt;
}

sub MacroThread {
	my ($itself, $id, $up, $long, $threadindent) = @_;
	my $txt;

	if ($threadindent > 0) {
		my $marginleft = 0;
		$marginleft = 3.3*($threadindent-1) if ($threadindent > 0);
		$txt .= "<DIV class='threadreply' style='margin-left: $marginleft"."em'>";
	} else {
		$txt .= "<DIV class='threadnew'>";
	}
	$txt .= &MacroComments($itself, $id, $up, $long, $threadindent)."</DIV>";
	if ($threadindent >= 1) {
		$txt .= "<A name='$up'></A>";
	}

	return $txt;
}

sub MacroThreadBlock {
	my ($blocktext) = @_;
	my $txt;

	$txt = "<DIV class='threaditem'>" . $blocktext . "</DIV>";

	return $txt;
}

1;

# 전역 변수로 $MyAdCounter 추가

sub thread {
	my ($txt) = @_;

# 추가
$MyAdCounter = 0;

    # 페이지 이름을 쓰지 않음
	$txt =~ s/(&__LT__;thread\()([-+]?\d+(,\d+)?)(\)&__GT__;)/$1$pageid,$2$4/gi;

	$txt =~ s/(&__LT__;thread\(([^,]+),([-+]?\d+),(\d+)\)&__GT__;)/&MacroThread($1,$2,$3,1,$4)/gei;
	$txt =~ s/(&__LT__;thread\(([^,]+),([-+]?\d+)\)&__GT__;)/&MacroThread($1,$2,$3,1,0)/gei;
	$txt =~ s/(&__LT__;thread&__GT__;((.)*?)&__LT__;\/thread&__GT__;)/&MacroThreadBlock($2)/geis;

	return $txt;
}


sub MacroThread {
	my ($itself, $id, $up, $long, $threadindent) = @_;
	my $txt;

	if ($threadindent > 0) {
		my $marginleft = 0;
		$marginleft = 3.3*($threadindent-1) if ($threadindent > 0);
		$txt .= "<DIV class='threadreply' style='margin-left: $marginleft"."em'>";
	} else {
		$txt .= "<DIV class='threadnew'>";
	}
	$txt .= &MacroComments($itself, $id, $up, $long, $threadindent)."</DIV>";
	if ($threadindent >= 1) {
		$txt .= "<A name='$up'></A>";
	}

# 추가
	if (($threadindent == 0 and int(rand(20)) == 0 and $MyAdCounter < 1))
	{
		$MyAdCounter = $MyAdCounter + 1;
		
		$txt .= qq(
<p> </p>		
<div>
# 구글 광고에서 만들어준 스크립트
</div>
		);
	}
# 여기까지

	return $txt;
}

트랙백 주고받기

마지막 편집일: 2007-3-7 2:13 pm (변경사항 [d])
1487 hits | 변경내역 보기 [h] | 이 페이지를 수정 [e]