PluginProbe
WP Attachments / 3.1
WP Attachments v3.1
6.0.2 6.0.3 trunk 2.0 3 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.4 3.5 3.5.1 3.5.2 3.5.3 3.5.4 All 52 releases
← All changes | wp-attachments.php +9 -16 3.1.13.1 View file →
@@ -3,9 +3,9 @@
3 3 Plugin Name: WP Attachments
4 4 Plugin URI: http://marcomilesi.ml
5 5 Description: Automatically shows your attachments under every post and page content. Simple. Automatic. Easy. As it has to be!
6 6 Author: Marco Milesi
7 -Version: 3.1.1
7 +Version: 3.1
8 8 Author URI: http://marcomilesi.ml
9 9 */
10 10
11 11
@@ -51,10 +51,9 @@
51 51
52 52 function wpatt_job_cpt_template_filter($content)
53 53 {
54 54 global $post;
55 - $somethingtoshow = 0;
56 -
55 +
57 56 $attachments = get_posts(array(
58 57 'post_type' => 'attachment',
59 58 'orderby' => 'menu_order',
60 59 'posts_per_page' => 100,
@@ -62,9 +61,9 @@
62 61 ));
63 62
64 63 if ($attachments)
65 64 {
66 - $content_l .= '<div style="width:100%;float:left;margin:10px 0 10px 0;"><h3>' . get_option('wpatt_option_localization') . '</h3>
65 + $content .= '<div style="width:100%;float:left;margin:10px 0 10px 0;"><h3>' . get_option('wpatt_option_localization') . '</h3>
67 66 <style>
68 67 ul.post-attachments{list-style:none;margin:0;}
69 68 li.post-attachment{background:url(' . plugin_dir_url(__FILE__) . 'icons/document.png) 0 4px no-repeat;padding-left:24px} .post-attachment.mime-imagejpeg,.post-attachment.mime-imagepng,.post-attachment.mime-imagejpeg,.post-attachment.mime-imagegif{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-image.png)}
70 69 .post-attachment.mime-applicationzip{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-zipper.png)}
@@ -82,13 +81,12 @@
82 81 if ($wpatt_option_includeimages_get == '1') {
83 82 } else if ( wp_attachment_is_image( $attachment->ID ) ) {
84 83 continue;
85 84 }
86 - $somethingtoshow = 1;
87 -
85 +
88 86 $class = "post-attachment mime-" . sanitize_title($attachment->post_mime_type);
89 87
90 - $content_l .= '<li class="' . $class . '"><a href="' . wp_get_attachment_url($attachment->ID) . '">' . $attachment->post_title . '</a> (' . wpatt_format_bytes(filesize(get_attached_file($attachment->ID)));
88 + $content .= '<li class="' . $class . '"><a href="' . wp_get_attachment_url($attachment->ID) . '">' . $attachment->post_title . '</a> (' . wpatt_format_bytes(filesize(get_attached_file($attachment->ID)));
91 89
92 90
93 91 $wpatt_option_showdate_get = get_option('wpatt_option_showdate');
94 92
@@ -96,24 +94,19 @@
96 94 {
97 95
98 96 $wpatt_date = new DateTime($attachment->post_date);
99 97
100 - $content_l .= '<div style="float:right;">' . $wpatt_date->format('d.m.Y') . '</div>';
98 + $content .= '<div style="float:right;">' . $wpatt_date->format('d.m.Y') . '</div>';
101 99
102 100 }
103 101
104 - $content_l .= ')</li>';
102 + $content .= ')</li>';
105 103
106 104 }
107 - $content_l .= '</ul></div>';
105 + $content .= '</ul></div>';
108 106
109 107 }
110 - if ($somethingtoshow == 1) {
111 - $content .= $content_l;
112 - return $content_l;
113 - } else {
114 - return $content;
115 - }
108 + return $content;
116 109
117 110 }
118 111
119 112