Пример #1
0
 public static function getThumbnailURL($postID, $size = 'thumbnail', $placeholderURL = null)
 {
     if (!$placeholderURL) {
         $placeholderURL = ImgPlaceholder::getThumbnailPlaceholderURL();
     }
     $imgURL = null;
     /** check sinapicv2 thumbnail */
     if (class_exists('\\sinapicv2\\sinapicv2')) {
         $imgURL = \sinapicv2\sinapicv2::get_post_thumbnail_url($postID, true);
     } else {
         if (\has_post_thumbnail($postID)) {
             $thumbnailID = \get_post_thumbnail_id($postID);
             $imgURL = \wp_get_attachment_image_src($thumbnailID, $size)[0];
             if ($size !== 'thumbnail') {
                 if (\wp_get_attachment_image_src($thumbnailID, 'full')[0] === $imgURL) {
                     $imgURL = \wp_get_attachment_image_src($thumbnailID, 'thumbnail')[0];
                 }
             }
         }
     }
     if (!$imgURL) {
         $post = static::getPost($postID);
         $imgURL = $post ? Functions::getImgURL($post->post_content) : false;
         unset($post);
     }
     if (!$imgURL) {
         $imgURL = $placeholderURL;
     }
     return $imgURL;
     //if (\is_ssl() && stripos($imgURL, 'https://')) {
     //}
     //return stripos(Other::getBlogInfo('home')) Url::esc($imgURL);
 }