Changeset 1160880
- Timestamp:
- 05/15/2015 03:36:03 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fotoexpose/trunk/includes/models/fotoexpose-model.php
r1158403 r1160880 22 22 $dom = new domDocument; 23 23 24 $content = str_replace('<p>','', $this->content); 25 26 $content = str_replace('</p>','', $content); 27 24 28 //add html tags to vaildate the content 25 $dom->loadHTML('<html><body>'.$ this->content.'</body></html>');29 $dom->loadHTML('<html><body>'.$content.'</body></html>'); 26 30 27 31 $dom->preserveWhiteSpace = false; … … 31 35 32 36 33 $image_list = array(); 37 $image_list = array(); 38 39 foreach($images as $image) { 40 41 //creating an array of the image to find in the post 42 preg_match('/wp-image-(?P<id>\d+)/',$image->getAttribute('class'),$matches); 34 43 35 foreach($images as $image) { 36 37 //creating an array of the image to find in the post 38 array_push($image_list, $image->getAttribute('src')); 39 40 } 41 42 $args = array( 43 44 'post_parent' => get_the_ID(), 45 46 'post_type' => 'attachment' 47 48 ); 49 50 $attachement_list = get_children( $args ); 51 52 $thumbs = ''; 53 54 if(is_array($attachement_list)) { 55 56 foreach($attachement_list AS $attachment_id => $attachment) { 57 58 $img_thumbs = wp_get_attachment_image_src( $attachment_id, 'thumbnail'); 59 60 $img_medium = wp_get_attachment_image_src( $attachment_id, 'medium'); 61 62 $img_large = wp_get_attachment_image_src( $attachment_id, 'large'); 63 64 if( in_array($img_medium[0],$image_list) ) { 65 66 $thumbs .= '<img src="'.$img_thumbs[0].'" fe-full="'.$img_large[0].'" width="'.$img_thumbs[1].'" height="'.$img_thumbs[2].'" alt="galleryphoto" class="fe-thumbs">'; 67 68 69 } 70 71 } 72 73 return $thumbs; 74 75 } 76 else { 77 78 return false; 44 array_push($image_list, $matches['id']); 79 45 80 46 } 81 47 82 } 48 $thumbs = ''; 49 50 if(is_array($image_list)) { 51 52 foreach($image_list AS $list_key => $attachment_id) { 53 54 $img_thumbs = wp_get_attachment_image_src( $attachment_id, 'thumbnail'); 55 56 $img_medium = wp_get_attachment_image_src( $attachment_id, 'medium'); 57 58 $img_large = wp_get_attachment_image_src( $attachment_id, 'large'); 59 60 $thumbs .= '<img src="'.$img_thumbs[0].'" fe-full="'.$img_large[0].'" width="'.$img_thumbs[1].'" height="'.$img_thumbs[2].'" alt="galleryphoto" class="fe-thumbs">'; 61 62 } 63 64 return $thumbs; 65 66 } 67 else { 68 69 return false; 70 71 } 72 73 } 83 74 84 75 }
Note: See TracChangeset
for help on using the changeset viewer.