Changeset 1136

Show
Ignore:
Timestamp:
06/01/08 06:18:31 (6 months ago)
Author:
A1ex
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-lightbox2/trunk/bb-lightbox2.php

    r1135 r1136  
    33Plugin Name: bb-Lightbox2 
    44Plugin URI: http://bbpress.ru/ 
    5 Description: Used to overlay images on the current page. Lightbox JS v2.2 by <a href="http://www.huddletogether.com/projects/lightbox2/" title="Lightbox JS v2.2 ">Lokesh Dhakar</a>. This plugin is based on "Lightbox 2" plugin for WordPress. 
    6 Version: 0.12 
     5Description: Used to overlay images on the current page. Lightbox JS v2.2 by <a href="http://www.huddletogether.com/projects/lightbox2/" title="Lightbox JS v2.2 ">Lokesh Dhakar</a>. This plugin is based on "Lightbox 2" plugin for WordPress. Example: http://www.sablinov.ru/forums/topic/1 
     6Version: 0.14 
    77Author: A1ex 
    88Author URI: http://bbpress.ru 
     
    2626 
    2727function bb_preg_callback2($matches) { 
    28   return '<a href="'.$matches[2].'" rel="lightbox">'.'<img src="'.ImgTumb($matches).'" />'.'</a>'; 
    29 }  
     28  return '<a href="'.$matches[2].'" rel="lightbox">'.'<img src="'.ImgTumb($matches[2],$matches[4]).'" /></a>'; 
     29
     30 
     31function bb_preg_callback3($matches) { 
     32  return '<a href="'.$matches[2].'" rel="lightbox">'.'[img]'.ImgTumb($matches[2],$matches[3]).'[/img]</a>'; 
     33
    3034 
    3135function bb_removeLinks($content) { 
    3236 
    33   $content = preg_replace_callback('@(]|<img.*src="(([^>"]*/)(.*[^"]))".[^<]*>)(?!<\/a>)@i', "bb_preg_callback2", $content); 
    34  
     37  $content = preg_replace_callback('@(<img.*src="(([^>"]*/)(.*[^"]))".[^<]*>)(?!<\/a>)@i', "bb_preg_callback2", $content); 
     38  $content = preg_replace_callback('@(\[img\](.*[^\[]*\/(.*))\[/img\])(?!<\/a>)@i', "bb_preg_callback3", $content); 
     39   
    3540  return $content; 
    3641}  
     
    8085} 
    8186 
    82 function ImgTumb($matches
     87function ImgTumb($image_path, $image_file
    8388{ 
    8489 global $tumb_width, $tumb_height, $tumbs_path, $tumbs_url; 
     
    9095   $tumbs_url = bb_get_option('uri').'tumbs/'; 
    9196 } 
    92  $tumb_name = 'tumb_'.md5($matches[2]).'_'.$matches[4]
     97 $tumb_name = 'tumb_'.md5($image_path).'_'.$image_file
    9398 $tumb_path = $tumbs_path.$tumb_name; 
    9499 $tumb_url = $tumbs_url.$tumb_name; 
     
    96101 if(!is_file($tumb_path)) 
    97102 { 
    98   $image = $matches[2]
     103  $image = $image_path
    99104  $this_type = GetImgType($image); 
    100105  switch($this_type)