Attachments - Version 1.1

Version Description

  • Fixed a bug where Attachments meta box would display on Custom Post Types even when set not to
  • Fixed a bug where special characters were lost on save
  • Fixed a bug where Browse/Add buttons failed to work when an Editor was not available on a Custom Post Type
Download this release

Release Info

Developer jchristopher
Plugin Icon wp plugin Attachments
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.9 to 1.1

Files changed (3) hide show
  1. attachments.options.php +16 -8
  2. attachments.php +9 -4
  3. readme.txt +6 -1
attachments.options.php CHANGED
@@ -5,8 +5,7 @@
5
  <?php wp_nonce_field('update-options'); ?>
6
 
7
  <?php if( function_exists( 'get_post_types' ) ) : ?>
8
- <h3><?php _e("Custom Post Type Settings", "attachments"); ?></h3>
9
- <p><?php _e("Include Attachments in the following Custom Post Types:", "attachments"); ?></p>
10
  <?php
11
  $args = array(
12
  'public' => true,
@@ -15,14 +14,23 @@
15
  $output = 'objects';
16
  $operator = 'and';
17
  $post_types = get_post_types( $args, $output, $operator );
18
- foreach($post_types as $post_type) : ?>
 
 
 
 
 
 
19
 
20
- <div class="attachments_checkbox">
21
- <input type="checkbox" name="attachments_cpt_<?php echo $post_type->name; ?>" id="attachments_cpt_<?php echo $post_type->name; ?>" value="true"<?php if (get_option('attachments_cpt_' . $post_type->name)=='true') : ?> checked="checked"<?php endif ?> />
22
- <label for="attachments_cpt_<?php echo $post_type->name; ?>"><?php echo $post_type->labels->name; ?></label>
23
- </div>
24
 
25
- <?php endforeach ?>
 
 
 
26
  <?php endif ?>
27
 
28
  <h3><?php _e("Privacy Settings", "attachments"); ?></h3>
5
  <?php wp_nonce_field('update-options'); ?>
6
 
7
  <?php if( function_exists( 'get_post_types' ) ) : ?>
8
+
 
9
  <?php
10
  $args = array(
11
  'public' => true,
14
  $output = 'objects';
15
  $operator = 'and';
16
  $post_types = get_post_types( $args, $output, $operator );
17
+ ?>
18
+
19
+ <?php if( count( $post_types ) ) : ?>
20
+
21
+ <h3><?php _e("Custom Post Type Settings", "attachments"); ?></h3>
22
+ <p><?php _e("Include Attachments in the following Custom Post Types:", "attachments"); ?></p>
23
+ <?php foreach($post_types as $post_type) : ?>
24
 
25
+ <div class="attachments_checkbox">
26
+ <input type="checkbox" name="attachments_cpt_<?php echo $post_type->name; ?>" id="attachments_cpt_<?php echo $post_type->name; ?>" value="true"<?php if (get_option('attachments_cpt_' . $post_type->name)=='true') : ?> checked="checked"<?php endif ?> />
27
+ <label for="attachments_cpt_<?php echo $post_type->name; ?>"><?php echo $post_type->labels->name; ?></label>
28
+ </div>
29
 
30
+ <?php endforeach ?>
31
+
32
+ <?php endif ?>
33
+
34
  <?php endif ?>
35
 
36
  <h3><?php _e("Privacy Settings", "attachments"); ?></h3>
attachments.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Attachments
4
  Plugin URI: http://mondaybynoon.com/wordpress-attachments/
5
  Description: Attachments gives the ability to append any number of Media Library items to Pages and Posts
6
- Version: 1.0.9
7
  Author: Jonathan Christopher
8
  Author URI: http://mondaybynoon.com/
9
  */
@@ -212,7 +212,10 @@ function attachments_meta_box()
212
  $post_types = get_post_types( $args, $output, $operator );
213
  foreach($post_types as $post_type)
214
  {
215
- add_meta_box( 'attachments_list', __( 'Attachments', 'attachments_textdomain' ), 'attachments_add', $post_type->name, 'normal' );
 
 
 
216
  }
217
  }
218
  }
@@ -296,8 +299,8 @@ function attachments_save($post_id)
296
  {
297
  $attachment_details = array(
298
  'id' => $_POST['attachment_id_' . $i],
299
- 'title' => $_POST['attachment_title_' . $i],
300
- 'caption' => $_POST['attachment_caption_' . $i],
301
  'order' => $_POST['attachment_order_' . $i]
302
  );
303
 
@@ -395,6 +398,8 @@ function attachments_init()
395
  {
396
  wp_enqueue_script('jquery-ui-core');
397
  wp_enqueue_script('jquery-ui-tabs');
 
 
398
  wp_enqueue_style('attachments', WP_PLUGIN_URL . '/attachments/css/attachments.css');
399
  wp_enqueue_script('attachments', WP_PLUGIN_URL . '/attachments/js/attachments.js');
400
 
3
  Plugin Name: Attachments
4
  Plugin URI: http://mondaybynoon.com/wordpress-attachments/
5
  Description: Attachments gives the ability to append any number of Media Library items to Pages and Posts
6
+ Version: 1.1
7
  Author: Jonathan Christopher
8
  Author URI: http://mondaybynoon.com/
9
  */
212
  $post_types = get_post_types( $args, $output, $operator );
213
  foreach($post_types as $post_type)
214
  {
215
+ if (get_option('attachments_cpt_' . $post_type->name)=='true')
216
+ {
217
+ add_meta_box( 'attachments_list', __( 'Attachments', 'attachments_textdomain' ), 'attachments_add', $post_type->name, 'normal' );
218
+ }
219
  }
220
  }
221
  }
299
  {
300
  $attachment_details = array(
301
  'id' => $_POST['attachment_id_' . $i],
302
+ 'title' => htmlentities( $_POST['attachment_title_' . $i] ),
303
+ 'caption' => htmlentities( $_POST['attachment_caption_' . $i] ),
304
  'order' => $_POST['attachment_order_' . $i]
305
  );
306
 
398
  {
399
  wp_enqueue_script('jquery-ui-core');
400
  wp_enqueue_script('jquery-ui-tabs');
401
+ wp_enqueue_script('thickbox');
402
+ wp_enqueue_style('thickbox');
403
  wp_enqueue_style('attachments', WP_PLUGIN_URL . '/attachments/css/attachments.css');
404
  wp_enqueue_script('attachments', WP_PLUGIN_URL . '/attachments/js/attachments.js');
405
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mondaybynoon.com/donate/
4
  Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
- Stable tag: 1.0.9
8
 
9
  Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages
10
 
@@ -41,6 +41,11 @@ Attachments uses WordPress' built in Media library for uploads and storage.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 1.0.9 =
45
  * Support for Custom Post Types (found in Settings)
46
  * Revised Portuguese Translation by [Miriam de Paula](http://www.tecsite.com.br)
4
  Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.1
8
 
9
  Attachments allows you to append any number of items from your WordPress Media Library to Posts and Pages
10
 
41
 
42
  == Changelog ==
43
 
44
+ = 1.1 =
45
+ * Fixed a bug where Attachments meta box would display on Custom Post Types even when set not to
46
+ * Fixed a bug where special characters were lost on save
47
+ * Fixed a bug where Browse/Add buttons failed to work when an Editor was not available on a Custom Post Type
48
+
49
  = 1.0.9 =
50
  * Support for Custom Post Types (found in Settings)
51
  * Revised Portuguese Translation by [Miriam de Paula](http://www.tecsite.com.br)