Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, November 12, 2026

Diff for Metafox/functions.inc.php between version 1.87 and 1.88

version 1.87, 2010/05/07 20:07:40 version 1.88, 2010/10/08 09:12:24
Line 17 
Line 17 
  * http://platon.sk/projects/Metafox/   * http://platon.sk/projects/Metafox/
  */   */
   
 /* $Platon: Metafox/functions.inc.php,v 1.86 2009-09-25 15:50:59 nepto Exp $ */  /* $Platon: Metafox/functions.inc.php,v 1.87 2010-05-07 20:07:40 nepto Exp $ */
   
 function ezin_eval($evalcode) /* {{{ */  function ezin_eval($evalcode) /* {{{ */
 {  {
Line 144  function ezin_handle_special_tags(&$str,
Line 144  function ezin_handle_special_tags(&$str,
         $replace = array();          $replace = array();
         $rpttr   = array();          $rpttr   = array();
         $rrplc   = array();          $rrplc   = array();
           $included_jquery = false;
           $jquery = '<script type="text/javascript" src="libpub/jquery.js"></script>'."\n";
           $included_lightbox = false;
           $lightbox = '<script type="text/javascript" src="libpub/lightbox/jquery.lightbox-0.5.js"></script>'."\n"
                                   .'<link type="text/css" rel="stylesheet" href="libpub/lightbox/jquery.lightbox-0.5.css">'."\n";
   
         if (strpos($mask, 'G') !== false) { /* {{{ */          if (strpos($mask, 'G') !== false) { /* {{{ */
                 global $ezin_sys, $ezin_cfg;                  global $ezin_sys, $ezin_cfg;
Line 174  function ezin_handle_special_tags(&$str,
Line 179  function ezin_handle_special_tags(&$str,
                                                 && is_readable($full_path.$file)                                                  && is_readable($full_path.$file)
                                                 && ! is_dir($full_path.$file))                                                  && ! is_dir($full_path.$file))
                                 {                                  {
                                         $g_replace .= "<image-link $directory$file $attrs>$file</image-link>\n";                                          $g_replace .= "<image-link-gal $directory$file $attrs>$file</image-link>\n";
                                 }                                  }
                         }                          }
                           $id = 'gal-'.rand(1,999999);
                           switch ($ezin_cfg['gallery_type']) {
                                   case 'javascript':
                                           $include_jquery = '';
                                           if (!$included_jquery) {
                                                   $include_jquery = $jquery;
                                                   $included_jquery = true;
                                           }
                                           $include_lightbox = '';
                                           if (!$included_lightbox) {
                                                   $include_lightbox = $lightbox;
                                                   $included_lightbox = true;
                                           }
                                           $g_replace = $include_jquery
                                                                   .$include_lightbox
                                                                   .'<script type="text/javascript">'."\n"
                                                                   .'      $(function() { '."\n"
                                                                   .'              $("#'.$id.' a").lightBox();'."\n"
                                                                   .'      });'."\n"
                                                                   .'</script>'."\n"
                                                                   .'<div id="'.$id.'">'."\n"
                                                                   .$g_replace
                                                                   .'</div> <!-- '.$id.' -->'."\n";
                                           break;
                                   case 'default':
                                   default:
                           }
                         unset($img_ar);                          unset($img_ar);
                         closedir($handler);                          closedir($handler);
                         $str = preg_replace($g_pattern, $g_replace, $str);                          $str = preg_replace($g_pattern, $g_replace, $str);
Line 185  function ezin_handle_special_tags(&$str,
Line 217  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|-link-gal)?\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 != $old_file) {                          if ($new_file != false && $new_file != $old_file) {
                                 if ($is_link) {                                  switch (strtolower($val[1])) {
                                         $pattern[] = '|<image-link\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>([^<>]*)</image-link>|i';                                          case '-link':
                                         $replace[] = "<repository-link $old_file><image $new_file\\1\\2>\\3</image></repository-link>";                                                  $id_image = 'img-'.rand(1,999999);
                                         $pattern[] = '|<image-link\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i';                                                  switch ($ezin_cfg['gallery_type']) {
                                         $replace[] = "<repository-link $old_file><image $new_file\\1\\2></repository-link>";                                                          case 'javascript':
                                         $mask .= 'R';                                                                  $include_jquery = '';
                                 } else {                                                                  if (!$included_jquery) {
                                         $pattern[] = '|<image\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i';                                                                          $include_jquery = $jquery;
                                         $replace[] = "<image $new_file\\1\\2>";                                                                          $included_jquery = true;
                                                                   }
                                                                   $include_lightbox = '';
                                                                   if (!$included_lightbox) {
                                                                           $include_lightbox = $lightbox;
                                                                           $included_lightbox = true;
                                                                   }
                                                                   $include_js = $include_jquery
                                                                                           .$include_lightbox
                                                                                           .'<script type="text/javascript">'."\n"
                                                                                           .'      $(function() { '."\n"
                                                                                           .'              $("#'.$id_image.'").lightBox();'."\n"
                                                                                           .'      });'."\n"
                                                                                           .'</script>'."\n";
                                                                   break;
                                                           case 'default':
                                                           default:
                                                                   $include_js = '';
                                                   }
                                                   $pattern[] = '|<image-link\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>([^<>]*)</image-link>|i';
                                                   $replace[] = $include_js."<repository-link $old_file id=\"$id_image\"><image $new_file\\1\\2>\\3</image></repository-link>";
                                                   $pattern[] = '|<image-link\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i';
                                                   $replace[] = $include_js."<repository-link $old_file id=\"$id_image\"><image $new_file\\1\\2></repository-link>";
                                                   $mask .= 'R';
                                                   break;
                                           case '-link-gal':
                                                   $pattern[] = '|<image-link-gal\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>([^<>]*)</image-link>|i';
                                                   $replace[] = "<repository-link $old_file id=\"$id_image\"><image $new_file\\1\\2>\\3</image></repository-link>";
                                                   $pattern[] = '|<image-link-gal\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i';
                                                   $replace[] = "<repository-link $old_file id=\"$id_image\"><image $new_file\\1\\2></repository-link>";
                                                   $mask .= 'R';
                                                   break;
                                           default:
                                                   $pattern[] = '|<image\s+'.$old_file.'([^<>]*)width='.$width.'([^<>]*)>|i';
                                                   $replace[] = "<image $new_file\\1\\2>";
                                 }                                  }
                         }                          }
                         //echo "FILE: $val[2], WIDTH: $val[3], newfile: $new_file, RET: $ret<br>";                          //echo "FILE: $val[2], WIDTH: $val[3], newfile: $new_file, RET: $ret<br>";

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top