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 +15 -17 3.1.43.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.4
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,25 +94,24 @@
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 - }
113 108 return $content;
109 +
114 110 }
115 111
116 112
113 +
117 114 /* Register Settings */
118 115
119 116 add_action('admin_init', 'wpatt_reg_settings');
120 117
@@ -125,10 +122,8 @@
125 122
126 123 register_setting('wpatt_options_group', 'wpatt_option_includeimages', 'intval');
127 124
128 125 register_setting('wpatt_options_group', 'wpatt_option_localization');
129 -
130 - register_setting('wpatt_options_group', 'wpatt_disable_backend');
131 126
132 127 /* Preopulate 'Attachments' */
133 128
134 129 $wpatt_option_showdate_get = get_option('wpatt_option_showdate');
@@ -134,10 +129,13 @@
134 129 $wpatt_option_showdate_get = get_option('wpatt_option_showdate');
135 130
136 131 if (get_option('wpatt_option_localization') == '')
137 132 {
133 +
138 134 update_option('wpatt_option_localization', 'Attachments');
135 +
139 136 }
137 +
140 138 }
141 139
142 140
143 141
@@ -186,9 +184,8 @@
186 184 update_option('wpatt_option_includeimages', '1');
187 185 } else {
188 186 update_option('wpatt_option_includeimages', '0');
189 187 }
190 -
191 188 }
192 189
193 190
194 191
@@ -229,8 +226,9 @@
229 226 }
230 227 echo '/>&nbsp;Check this if you want to include images (.jpg, .jpeg, .gif, .png) from being listed.</td>';
231 228 echo '</tr>';
232 229
230 +
233 231 echo '<tr><th scope="row">Show date?</th>
234 232 <td><input type="checkbox" name="wpatt_option_showdate_n" ';
235 233 $wpatt_option_showdate_get = get_option('wpatt_option_showdate');
236 234 if ($wpatt_option_showdate_get == '1') {
@@ -245,10 +243,10 @@
245 243
246 244 echo '</form></div>
247 245 <h3>HELP, SUPPORT & FEEDBACK</h3>
248 246 <a href="http://wordpress.org/plugins/wp-attachments/" title "WP Attachments Wordpress Plugin>http://wordpress.org/plugins/wp-attachments/</a><br/>
249 - This plugin is continuously developed by Marco Milesi focusing on simplicity, intuitiveness and cleanness. Keep updated :)<br/>
247 + This plugin is continuously developed by Marco Milesi focusing on semplicity, intuitiveness and cleanness. Keep updated :)<br/>
250 248 Thank You for using this plugin.</div>';
251 249
252 250 }
253 251
254 252 ?>