| verzia 1.72, 2007/11/12 16:12:55 |
verzia 1.73, 2007/12/02 11:50:48 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/functions.inc.php,v 1.71 2007-11-01 23:01:40 nepto Exp $ */ |
/* $Platon: Metafox/functions.inc.php,v 1.72 2007-11-12 16:12:55 nepto Exp $ */ |
| |
|
| function ezin_eval($evalcode) /* {{{ */ |
function ezin_eval($evalcode) /* {{{ */ |
| { |
{ |
| Riadok 80 function ezin_process_text_flags(&$str, |
|
| Riadok 80 function ezin_process_text_flags(&$str, |
|
| function ezin_get_special_tags_flags($str) /* {{{ */ |
function ezin_get_special_tags_flags($str) /* {{{ */ |
| { |
{ |
| $ret = ''; |
$ret = ''; |
| |
preg_match('|<gallery\s[^>]+>|i', $str) && $ret .= 'G'.'I'; // we need <image-link> as well |
| preg_match('|<flash\s[^>]+>|i', $str) && $ret .= 'f'; |
preg_match('|<flash\s[^>]+>|i', $str) && $ret .= 'f'; |
| preg_match('|<image\s[^>]+>|i', $str) && $ret .= 'i'; |
preg_match('|<image\s[^>]+>|i', $str) && $ret .= 'i'; |
| preg_match('|<image-link\s[^>]+>|i', $str) && $ret .= 'I'; |
preg_match('|<image-link\s[^>]+>|i', $str) && $ret .= 'I'; |
| Riadok 130 function ezin_handle_special_tags(&$str, |
|
| Riadok 131 function ezin_handle_special_tags(&$str, |
|
| } |
} |
| $pattern = array(); |
$pattern = array(); |
| $replacement = array(); |
$replacement = array(); |
| |
if (strpos($mask, 'G') !== false) { /* {{{ */ |
| |
global $ezin_sys, $ezin_cfg; |
| |
/* TODO: caching is required here */ |
| |
preg_match_all('|<gallery\s+([^>\s]+)([^>]*)>|i', |
| |
$str, $matches, PREG_SET_ORDER); |
| |
foreach ($matches as $key => $val) { |
| |
$directory = $val[1]; |
| |
$attrs = $val[2]; |
| |
$g_pattern = '|<gallery\s+'.$directory.$attrs.'>|i'; |
| |
$g_replace = ''; |
| |
$directory = Platon::append_slash($directory); |
| |
$full_path = Platon::append_slash($ezin_sys['dir']['root']); |
| |
$full_path.= Platon::append_slash($ezin_cfg['upload']['dir']).$directory; |
| |
if (!is_dir($full_path) || !is_readable($full_path)) { |
| |
continue; |
| |
} |
| |
$handler = opendir($full_path); |
| |
while ($file = readdir($handler)) { |
| |
// if $file isn't this directory or its parent, |
| |
// add it to the replacement |
| |
if ($file{0} != '.') { |
| |
$g_replace .= "<image-link $directory$file $attrs>\n"; |
| |
} |
| |
} |
| |
closedir($handler); |
| |
$str = preg_replace($g_pattern, $g_replace, $str); |
| |
} |
| |
} /* }}} */ |
| if (strpos($mask, 'f') !== false) { /* {{{ */ |
if (strpos($mask, 'f') !== false) { /* {{{ */ |
| $pattern[] = '|<flash\s+(\w{3,6}://[^>\s]+)([^>]*)>\s*((?:(?!<flash).){0,499}?)\s*</flash>|si'; |
$pattern[] = '|<flash\s+(\w{3,6}://[^>\s]+)([^>]*)>\s*((?:(?!<flash).){0,499}?)\s*</flash>|si'; |
| $pattern[] = '|<flash\s+([^>\s]+)([^>]*)>\s*((?:(?!<flash).){0,499}?)\s*</flash>|si'; |
$pattern[] = '|<flash\s+([^>\s]+)([^>]*)>\s*((?:(?!<flash).){0,499}?)\s*</flash>|si'; |