Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Вебмастеру (http://forum.oszone.net/forumdisplay.php?f=22)
-   -   Скрипт для DLE (http://forum.oszone.net/showthread.php?t=204901)

Weblack 16-04-2011 00:12 1659353

Скрипт для DLE
 
Здрасьте! Т.к в php не знаю, то попрошу Вас помочь. В этом коде:
PHP код:

<?php

class image_controller
  
{
    var 
$images = array ();
    var 
$prefix 'dl';
    var 
$upload_images = array ();
  
    function 
reset_url($url)
    {
        
$value str_replace("http://"""$url);
        
$value str_replace("www.""",    $value);
        return 
reset(explode("/"$value));
    }
    function 
get_images ($content)
    {
      
preg_match_all ('#\\[img\\](.+?)\\[/img\\]#ie'$content$preg_array);
      if (
count ($preg_array[1]) != 0)
      {
        foreach (
$preg_array[1] as $item)
        {
            if (
$this->reset_url($_SERVER['HTTP_HOST'])!=$this->reset_url($item))
            {
                if (!(
in_array ($item$this->images)))
                {
                    
$this->images[] = $item;
                    continue;
                }
            }
        }
      }

    }

    function 
download ($image_url)
    {
      global 
$config;
      
$image_name basename ($image_url);
      
$image_arr explode ('_'$image_name);
      if (
count ($image_arr) != 0)
      {
        
$image_name end ($image_arr);
      }

      
$image_name $this->prefix '_' $image_name;      

      
$serv_image_url $config['http_home_url'] . 'uploads/posts/' $image_name;
      
$this->source str_replace ($image_url$serv_image_url$this->source);
      @
copy ($image_urlUPLOAD_PATH $image_name);
      if (!(
in_array (basename ($serv_image_url), $this->upload_images)))
      {
        
$this->upload_images[] = basename ($serv_image_url);
      }     

    }

    function 
process ($parse)
    {
     
$source preg_replace"'\[thumb\]([^\[]*)([/\\\\])(.*?)\[/thumb\]'ie""\$this->build_thumb('\$1\$2\$3', '\$1\$2thumbs\$2\$3')"$source );
  
$source preg_replace"'\[thumb=(.*?)\]([^\[]*)([/\\\\])(.*?)\[/thumb\]'ie""\$this->build_thumb('\$2\$3\$4', '\$2\$3thumbs\$3\$4', '\$1')"$source );
    
        
$this->source $parse->decodeBBCodes($this->source);
        
$this->prefix time ();

      if (
trim ($this->source) != '')
      {
        
$this->get_images ($this->source);
      }

      foreach (
$this->images as $image_url)
      {
        
$this->download ($image_url);
      }
     
        

    }
  }

  
define ('UPLOAD_PATH'ROOT_DIR '/uploads/posts/');

?>

...мне нужно, чтобы скрипт искал не [img] и [/img], а <img src=(какая-нить ссылка)>. Если что, то этот скрипт для DLE.

Dimchik 17-04-2011 14:32 1660227

зделай нормальний просмотр ....тогда может кто и откликнется а так...... :unsure:

Sham 21-04-2011 14:31 1663127

Цитата:

Цитата Weblack
preg_match_all*('#\\[img\\](.+?)\\[/img\\]#ie',*$content,*$preg_array); »

PHP код:

preg_match_all ('#\<img\s[^\>]*src\=[\"\']?([^\'\"\>\s]+)[\"\']?[^\>]*\>#ie'$content$preg_array); 



Время: 21:15.

Время: 21:15.
© OSzone.net 2001-