function _smartyDisplay(&$_sm,$_tpl){
$_buff = _smartyFetch($_sm,$_tpl);
echo $_buff;
}
function _smartyFetch(&$_sm,$_tpl){
$_sm->register_prefilter('_smartyPreFilter');
$_sm->register_postfilter('_smartyPostFilter');
$_buff = $_sm->fetch($_tpl);
return $_buff;
}
function _smartyPreFilter($_buff, &$_sm){
return mb_convert_encoding($_buff,"EUC-JP",ENCODING_SRC);
}
function _smartyPostFilter($_buff, &$_sm){
return mb_convert_encoding($_buff,ENCODING_SRC,"EUC-JP");
}
while(preg_match('/<a [^>]*href ?= ?"?([^>" ]*)"?[^>]*>/is',$buff,$matches,PREG_OFFSET_CAPTURE) > 0){
$rand = rand();
$find_tag = $matches[0][0];
$find_link = $matches[1][0];
if(strtolower(substr($find_link,0,1))!="#" &&
strpos(strtolower($find_link), "mailto:") ===FALSE &&
strpos(strtolower($find_link), "tel:") ===FALSE &&
strpos(strtolower($find_link), "javascript:") ===FALSE &&
strpos(strtolower($find_link), "callto:") ===FALSE ){
if(stristr($find_link, '?') === FALSE){
$join_str = "?";
}else{
$join_str = "&";
}
if(stristr($find_link, '#') !== FALSE){
$warr = split("#",$find_link,2);
$new_link = $warr[0] . $join_str . 'ss=' . $ss . '&rand=' . $rand ."#".$warr[1];
}else{
$new_link = $find_link . $join_str . 'ss=' . $ss . '&rand=' . $rand;
}
$buff = preg_replace('/<a ([^>]*)href ?= ?"?([^>" ]*)"?([^>]*)>/is',
'<a $1 href ="'.$new_link. '" $3>',
$buff,1);
}else{
$buff = preg_replace('/<a ([^>]*)href ?= ?"?([^>" ]*)"?([^>]*)>/is',
'<a $1 href ="$2" $3>',
$buff,1);
}
}
$_buff = _smartyFetch($_sm,$_tpl);
echo $_buff;
}
function _smartyFetch(&$_sm,$_tpl){
$_sm->register_prefilter('_smartyPreFilter');
$_sm->register_postfilter('_smartyPostFilter');
$_buff = $_sm->fetch($_tpl);
return $_buff;
}
function _smartyPreFilter($_buff, &$_sm){
return mb_convert_encoding($_buff,"EUC-JP",ENCODING_SRC);
}
function _smartyPostFilter($_buff, &$_sm){
return mb_convert_encoding($_buff,ENCODING_SRC,"EUC-JP");
}
while(preg_match('/<a [^>]*href ?= ?"?([^>" ]*)"?[^>]*>/is',$buff,$matches,PREG_OFFSET_CAPTURE) > 0){
$rand = rand();
$find_tag = $matches[0][0];
$find_link = $matches[1][0];
if(strtolower(substr($find_link,0,1))!="#" &&
strpos(strtolower($find_link), "mailto:") ===FALSE &&
strpos(strtolower($find_link), "tel:") ===FALSE &&
strpos(strtolower($find_link), "javascript:") ===FALSE &&
strpos(strtolower($find_link), "callto:") ===FALSE ){
if(stristr($find_link, '?') === FALSE){
$join_str = "?";
}else{
$join_str = "&";
}
if(stristr($find_link, '#') !== FALSE){
$warr = split("#",$find_link,2);
$new_link = $warr[0] . $join_str . 'ss=' . $ss . '&rand=' . $rand ."#".$warr[1];
}else{
$new_link = $find_link . $join_str . 'ss=' . $ss . '&rand=' . $rand;
}
$buff = preg_replace('/<a ([^>]*)href ?= ?"?([^>" ]*)"?([^>]*)>/is',
'<a $1 href ="'.$new_link. '" $3>',
$buff,1);
}else{
$buff = preg_replace('/<a ([^>]*)href ?= ?"?([^>" ]*)"?([^>]*)>/is',
'<a $1 href ="$2" $3>',
$buff,1);
}
}
'TIP' 카테고리의 다른 글
携帯ShiftJIS (0) | 2010.06.16 |
---|---|
asp2php, php2asp (0) | 2010.06.14 |
日本P2P (0) | 2010.06.09 |
Drag and Drop Tree (0) | 2010.06.02 |
맥킨토쉬 OS 10 스타일 Dock menu 7 (0) | 2010.06.02 |