| version 1.82, 2009/07/01 20:49:03 |
version 1.83, 2009/07/02 20:14:12 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/functions.inc.php,v 1.81 2008-08-01 14:53:23 nepto Exp $ */ |
/* $Platon: Metafox/functions.inc.php,v 1.82 2009-07-01 20:49:03 nepto Exp $ */ |
| |
|
| function ezin_eval($evalcode) /* {{{ */ |
function ezin_eval($evalcode) /* {{{ */ |
| { |
{ |
| Line 139 function ezin_handle_special_tags(&$str, |
|
| Line 139 function ezin_handle_special_tags(&$str, |
|
| $repository_url = Platon::append_slash($ezin_url.$ezin_sys['dir']['upload']); |
$repository_url = Platon::append_slash($ezin_url.$ezin_sys['dir']['upload']); |
| $link_file_type = $ezin_cfg['link_file_type']; |
$link_file_type = $ezin_cfg['link_file_type']; |
| } |
} |
| $pattern = array(); |
|
| $replacement = array(); |
$pattern = array(); |
| |
$replace = array(); |
| |
$rpttr = array(); |
| |
$rrplc = array(); |
| |
|
| if (strpos($mask, 'G') !== false) { /* {{{ */ |
if (strpos($mask, 'G') !== false) { /* {{{ */ |
| global $ezin_sys, $ezin_cfg; |
global $ezin_sys, $ezin_cfg; |
| /* TODO: caching is required here */ |
/* TODO: caching is required here */ |
| Line 181 function ezin_handle_special_tags(&$str, |
|
| Line 185 function ezin_handle_special_tags(&$str, |
|
| |
|
| // Resize images if neccessary |
// Resize images if neccessary |
| if (strpos(strtolower($mask), 'i') !== false) { /* {{{ */ |
if (strpos(strtolower($mask), 'i') !== false) { /* {{{ */ |
| preg_match_all('|<image(-link)?\s+([^>\s]+)([^>]*width=([^>\s]+)[^>]*)>|i', |
preg_match_all('|<image(-link)?\s+([^<>\s]+)([^<>]*width=([^<>\s]+)[^<>]*)>|i', |
| $str, $matches, PREG_SET_ORDER); |
$str, $matches, PREG_SET_ORDER); |
| foreach ($matches as $key => $val) { |
foreach ($matches as $key => $val) { |
| |
$is_link = strtolower($val[1]) == '-link'; |
| $old_file = $val[2]; |
$old_file = $val[2]; |
| $width = $val[4]; |
$width = $val[4]; |
| $new_file = ezin_scale_upload_image($old_file, $width); |
$new_file = ezin_scale_upload_image($old_file, $width); |
| if ($new_file != false && $new_file != $val[1]) { |
if ($new_file != false && $new_file != $old_file) { |
| $pattern[] = '|<image\s+'.$old_file.'([^>]*)width='.$width.'([^>]*)>|i'; |
if ($is_link) { |
| $replacement[] = "<image $new_file\\1\\2>"; |
$pattern[] = '|<image-link\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i'; |
| |
$replace[] = "<repository-link $old_file><image $new_file\\1\\2></repository-link>"; |
| |
} else { |
| |
$pattern[] = '|<image\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i'; |
| |
$replace[] = "<image $new_file\\1\\2>"; |
| |
} |
| } |
} |
| //echo "FILE: $val[1], WIDTH: $val[3], RET: $ret<br>"; |
//echo "FILE: $val[2], WIDTH: $val[3], newfile: $new_file, RET: $ret<br>"; |
| } |
} |
| } |
} /* }}} */ |
| |
|
| if (strpos($mask, 'f') !== false) { /* {{{ */ |
if (strpos($mask, 'f') !== false) { /* {{{ */ |
| // URL in http:// form |
// URL in http:// form |
| Line 210 function ezin_handle_special_tags(&$str, |
|
| Line 220 function ezin_handle_special_tags(&$str, |
|
| $rpttr[] = sprintf('|%s|i', $opentag); |
$rpttr[] = sprintf('|%s|i', $opentag); |
| $rrplc[] = strrev('<object type="application/x-shockwave-flash" data="'.$repository_url.'3\\"2\\>'."\n" |
$rrplc[] = strrev('<object type="application/x-shockwave-flash" data="'.$repository_url.'3\\"2\\>'."\n" |
| .'<param name="movie" value="'.$repository_url.'3\\"><embed src="'.$repository_url.'3\\"2\\>1\\</object>'); |
.'<param name="movie" value="'.$repository_url.'3\\"><embed src="'.$repository_url.'3\\"2\\>1\\</object>'); |
| $rrplc[] = strrrev('<object type="application/x-shockwave-flash" data="'.$repository_url.'2\\"1\\>'."\n" |
$rrplc[] = strrev('<object type="application/x-shockwave-flash" data="'.$repository_url.'2\\"1\\>'."\n" |
| .'<param name="movie" value="'.$repository_url.'2\\"><embed src="'.$repository_url.'2\\"1\\></object>'); |
.'<param name="movie" value="'.$repository_url.'2\\"><embed src="'.$repository_url.'2\\"1\\></object>'); |
| } /* }}} */ |
} /* }}} */ |
| if (strpos($mask, 'I') !== false) { /* {{{ */ |
if (strpos($mask, 'I') !== false) { /* {{{ */ |
| Line 336 function ezin_handle_special_tags(&$str, |
|
| Line 346 function ezin_handle_special_tags(&$str, |
|
| $rrplc[] = ezin_str_rev_args(strrev('<a href="'.$ezin_url.$sub_url),'\\3','"','\\2','>','\\1',strrev('</a>')); |
$rrplc[] = ezin_str_rev_args(strrev('<a href="'.$ezin_url.$sub_url),'\\3','"','\\2','>','\\1',strrev('</a>')); |
| $rrplc[] = ezin_str_rev_args(strrev('<a href="'.$ezin_url.$sub_url),'\\2','"','\\1','>','\\2',strrev('</a>')); |
$rrplc[] = ezin_str_rev_args(strrev('<a href="'.$ezin_url.$sub_url),'\\2','"','\\1','>','\\2',strrev('</a>')); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
// Normal replacement |
| |
if (count($pattern) > 0) { |
| |
$str = preg_replace($pattern, $replace, $str); |
| |
} |
| |
|
| |
// Reversed replacement |
| if (count($rpttr) > 0) { |
if (count($rpttr) > 0) { |
| $str = strrev($str); |
$str = strrev($str); |
| $str = preg_replace($rpttr, $rrplc, $str); |
$str = preg_replace($rpttr, $rrplc, $str); |