Exemplo n.º 1
0
 public function get_items($args = array())
 {
     $result = array();
     $this->fetch($args);
     if (is_array($this->items)) {
         $items = $this->items;
         foreach ($items as $item) {
             $description = $item->get_description();
             $thumbnail = SB_PHP::get_first_image($description);
             $description = strip_tags($description);
             $description = wp_strip_all_tags($description);
             $content = $item->get_content();
             if (empty($thumbnail)) {
                 $thumbnail = SB_PHP::get_first_image($content);
             }
             $value = array('permalink' => $item->get_permalink(), 'title' => $item->get_title(), 'date' => $item->get_date(SB_Option::get_date_time_format()), 'image_url' => $thumbnail, 'description' => $description, 'content' => $content);
             array_push($result, $value);
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 public static function get_thumbnail_full_url($post_id = '')
 {
     if (empty($post_id)) {
         $post_id = get_the_ID();
     }
     $result = '';
     if (has_post_thumbnail($post_id)) {
         $image_path = get_attached_file(get_post_thumbnail_id($post_id));
         if (file_exists($image_path)) {
             $image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id($post_id));
             if ($image_attributes) {
                 $result = $image_attributes[0];
             }
         }
     }
     if (empty($result)) {
         $result = apply_filters('hocwp_post_image_url', '');
     }
     if (empty($result)) {
         $result = self::get_first_image_url($post_id);
     }
     if (empty($result)) {
         $post = get_post($post_id);
         if ($post && !is_wp_error($post)) {
             $result = SB_PHP::get_first_image($post->post_content);
         }
     }
     if (empty($result)) {
         $result = SB_Option::get_theme_thumbnail_url();
     }
     return apply_filters('sb_thumbnail_full_url', $result);
 }
Exemplo n.º 3
0
 public static function get_avatar_url($id_or_email, $size)
 {
     $avatar = self::get_avatar_image($id_or_email, $size);
     return SB_PHP::get_first_image($avatar);
 }