function pt_clean_text($text, $no_semiologic = false)
{
    $text = strip_tags(stripslashes($text));
    if (function_exists('jLanguage_processTitle')) {
        $text = jLanguage_processTitle($text);
    }
    $pattern = '/\\[MEDIA=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[PTPLAYLIST=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[dailymotion=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[youtube=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[PTSET=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[PTALBUM=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    $pattern = '/\\[PTTAG=([^\\]]*)\\]/i';
    $text = preg_replace($pattern, '', $text);
    // This is for semiologic smart link plugin
    if ($no_semiologic) {
        $pattern = '/\\[([^\\]]*)\\-(\\>|\\&gt)([^\\]]*)\\]/i';
        if (preg_match_all($pattern, $text, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                $text = str_replace($match[0], $match[1], $text);
            }
        }
    }
    // Trim all unwanted/unnecessary characters
    return rtrim($text, "\\s\n\t\r\v");
}
 function pt_post_thumbnail($settings, $post = '', $arg = '', $default_image = '', $default_media = '', $permalink = '', $title = '', $date = '', $author = '', $link = '', $search = true)
 {
     // Get all parameters
     $this->post = $post;
     $this->settings = $settings;
     $this->arg = $arg;
     $this->the_default_image = $default_image;
     $this->the_default_media = $default_media;
     $this->permalink = $permalink;
     $this->default_title = $title;
     $this->default_date = $date;
     $this->default_author = $author;
     $this->default_link = $link;
     $this->search = $search;
     unset($settings);
     unset($post);
     // Init local parameters
     $path = pathinfo($this->the_default_media);
     $this->has_media = $this->the_default_media != '' && $path['extension'] != '';
     $this->has_youtube = $this->the_default_media != '' && $path['extension'] == '';
     $this->def_url = $this->settings['full_domain_name'] . "/" . $this->settings['default_image'];
     $this->use_hs = $this->settings['hs_use'] == 'true';
     $this->use_tb = $this->settings['tb_use'] == 'true';
     $this->use_sb = $this->settings['sb_use'] == 'true';
     if ($this->has_youtube) {
         $this->arg .= '&ADDAPPEND=' . $this->the_default_media;
     }
     // Sets title && use jLanguage if present
     if ($this->default_title != '') {
         $this->title = $this->default_title;
     } else {
         $this->title = $this->post->post_title;
     }
     if (function_exists('jLanguage_processTitle')) {
         $this->title = jLanguage_processTitle($this->title);
     }
     // Init permalink
     if ($permalink == '') {
         $this->post_url = get_permalink($this->post->ID);
     } else {
         $this->post_url = $permalink;
     }
     // Set all the parameter options
     $this->parse_arg();
     // Check if image should be retrieved first from meta data
     if ($this->settings['use_meta'] == 'true' && $this->search) {
         $this->meta_content = get_post_meta($this->post->ID, 'pt_meta_thumb', true);
     }
     // Get the image to thumbnailed
     if ($this->search) {
         $this->search_the_image();
     } else {
         $this->get_the_image();
     }
     // Generate thumbnail
     $t = new pt_thumbnail($this->settings, $this->the_image, $this->arg, $this->def_image);
     if ($t->error) {
         unset($t);
         $t = new pt_thumbnail($this->settings, $this->def_url, $this->arg, true);
     }
     $this->thumb_url = $t->thumb_url;
     $this->thumb_path = $t->thumb_path;
     $this->width = $t->width;
     $this->height = $t->height;
     unset($t);
     // Use $this->GetImgHTML(); to get output string
 }