Attachments - Version 3.3.2

Version Description

  • You can now specify which view is default when browsing the Media modal (e.g. have 'Upload Files' be default instead of 'Media Library')
Download this release

Release Info

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

Code changes from version 3.3.1 to 3.3.2

Files changed (4) hide show
  1. README.md +10 -4
  2. classes/class.attachments.php +10 -2
  3. index.php +1 -1
  4. readme.txt +25 -29
README.md CHANGED
@@ -157,6 +157,9 @@ function my_attachments( $attachments )
157
  // text for modal 'Attach' button (string)
158
  'modal_text' => __( 'Attach', 'attachments' ),
159
 
 
 
 
160
  // fields array
161
  'fields' => $fields,
162
 
@@ -410,15 +413,18 @@ Attachments uses WordPress' built in Media library for uploads and storage.
410
 
411
  #### I lost my Attachments after upgrading!
412
 
413
- ***DO NOT update any Post/Page/CPT with Attachments***, the data has not been lost. Please **[Upgrade notice](#upgrade-notice)**.
414
 
415
  ## Changelog
416
 
417
  <dl>
418
 
419
- <dd>3.3.1</dd>
420
- <dt>Added meta box positioning arguments when registering instances</dt>
421
- <dt>Cleaned up some CSS when Attachments instances are in the sidebar</dt>
 
 
 
422
 
423
  <dt>3.3</dt>
424
  <dd>Added a <code>search()</code> method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)</dd>
157
  // text for modal 'Attach' button (string)
158
  'modal_text' => __( 'Attach', 'attachments' ),
159
 
160
+ // which tab should be the default in the modal (string) (browse|upload)
161
+ 'router' => 'browse',
162
+
163
  // fields array
164
  'fields' => $fields,
165
 
413
 
414
  #### I lost my Attachments after upgrading!
415
 
416
+ ***DO NOT update any Post/Page/CPT with Attachments***, the data has not been lost. Please reference the **[Upgrade notice](#upgrade-notice)**.
417
 
418
  ## Changelog
419
 
420
  <dl>
421
 
422
+ <dt>3.3.2</dt>
423
+ <dd>You can now specify which view is default when browsing the Media modal (e.g. have 'Upload Files' be default instead of 'Media Library')</dd>
424
+
425
+ <dt>3.3.1</dt>
426
+ <dd>Added meta box positioning arguments when registering instances</dd>
427
+ <dd>Cleaned up some CSS when Attachments instances are in the sidebar</dd>
428
 
429
  <dt>3.3</dt>
430
  <dd>Added a <code>search()</code> method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)</dd>
classes/class.attachments.php CHANGED
@@ -59,7 +59,7 @@ if ( !class_exists( 'Attachments' ) ) :
59
 
60
  // establish our environment variables
61
 
62
- $this->version = '3.3.1';
63
  $this->url = ATTACHMENTS_URL;
64
  $this->dir = ATTACHMENTS_DIR;
65
 
@@ -654,6 +654,7 @@ if ( !class_exists( 'Attachments' ) ) :
654
  var $element = $('#attachments-<?php echo esc_attr( $instance->name ); ?>'),
655
  title = '<?php echo __( esc_attr( $instance->label ) ); ?>',
656
  button = '<?php echo __( esc_attr( $instance->modal_text ) ); ?>',
 
657
  attachmentsframe;
658
 
659
  $element.on( 'click', '.attachments-invoke', function( event ) {
@@ -664,6 +665,7 @@ if ( !class_exists( 'Attachments' ) ) :
664
  // if the frame already exists, open it
665
  if ( attachmentsframe ) {
666
  attachmentsframe.open();
 
667
  return;
668
  }
669
 
@@ -684,7 +686,9 @@ if ( !class_exists( 'Attachments' ) ) :
684
  button: {
685
  // Set the text of the button.
686
  text: button
687
- }
 
 
688
  });
689
 
690
  // set up our select handler
@@ -759,6 +763,7 @@ if ( !class_exists( 'Attachments' ) ) :
759
 
760
  // open the frame
761
  attachmentsframe.open();
 
762
 
763
  });
764
 
@@ -918,6 +923,9 @@ if ( !class_exists( 'Attachments' ) ) :
918
  // text for modal 'Attach' button (string)
919
  'modal_text' => __( 'Attach', 'attachments' ),
920
 
 
 
 
921
  // fields for this instance (array)
922
  'fields' => array(
923
  array(
59
 
60
  // establish our environment variables
61
 
62
+ $this->version = '3.3.2';
63
  $this->url = ATTACHMENTS_URL;
64
  $this->dir = ATTACHMENTS_DIR;
65
 
654
  var $element = $('#attachments-<?php echo esc_attr( $instance->name ); ?>'),
655
  title = '<?php echo __( esc_attr( $instance->label ) ); ?>',
656
  button = '<?php echo __( esc_attr( $instance->modal_text ) ); ?>',
657
+ router = '<?php echo __( esc_attr( $instance->router ) ); ?>',
658
  attachmentsframe;
659
 
660
  $element.on( 'click', '.attachments-invoke', function( event ) {
665
  // if the frame already exists, open it
666
  if ( attachmentsframe ) {
667
  attachmentsframe.open();
668
+ attachmentsframe.content.mode(router);
669
  return;
670
  }
671
 
686
  button: {
687
  // Set the text of the button.
688
  text: button
689
+ },
690
+
691
+ router: 'upload'
692
  });
693
 
694
  // set up our select handler
763
 
764
  // open the frame
765
  attachmentsframe.open();
766
+ attachmentsframe.content.mode(router);
767
 
768
  });
769
 
923
  // text for modal 'Attach' button (string)
924
  'modal_text' => __( 'Attach', 'attachments' ),
925
 
926
+ // which tab should be the default in the modal (string) (browse|upload)
927
+ 'router' => 'browse',
928
+
929
  // fields for this instance (array)
930
  'fields' => array(
931
  array(
index.php CHANGED
@@ -6,7 +6,7 @@
6
  * Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
7
  * Author: Jonathan Christopher
8
  * Author URI: http://mondaybynoon.com/
9
- * Version: 3.3.1
10
  * Text Domain: attachments
11
  * Domain Path: /languages/
12
  * License: GPLv2 or later
6
  * Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
7
  * Author: Jonathan Christopher
8
  * Author URI: http://mondaybynoon.com/
9
+ * Version: 3.3.2
10
  * Text Domain: attachments
11
  * Domain Path: /languages/
12
  * License: GPLv2 or later
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jchristopher
3
  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: 3.0
6
- Tested up to: 3.5
7
- Stable tag: 3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,9 @@ Else: please reference the **Installation > Upgrade Notice** details.
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 3.3.1 =
111
  * Added meta box positioning arguments when registering instances
112
  * Cleaned up some CSS when Attachments instances are in the sidebar
@@ -343,7 +346,6 @@ Planned feature additions include:
343
 
344
  * Additional field type: checkbox
345
  * Additional field type: radio
346
- * Additional field type: select
347
  * User-defined limiting the number of Attachments per instance
348
  * User-defined custom field types
349
  * Additional hooks/actions from top to bottom
@@ -379,6 +381,21 @@ You may create instances with your own custom fields by using the `attachments_r
379
 
380
  function my_attachments( $attachments )
381
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  $args = array(
383
 
384
  // title of the meta box (string)
@@ -405,32 +422,11 @@ function my_attachments( $attachments )
405
  // text for modal 'Attach' button (string)
406
  'modal_text' => __( 'Attach', 'attachments' ),
407
 
408
- /**
409
- * Fields for the instance are stored in an array. Each field consists of
410
- * an array with three keys: name, type, label.
411
- *
412
- * name - (string) The field name used. No special characters.
413
- * type - (string) The registered field type.
414
- * Fields available: text, textarea, wysiwyg
415
- * label - (string) The label displayed for the field.
416
- * caption - (string) The default WordPress metadata to use when initially adding the Attachment
417
- * Defaults available: title, caption, alt, description
418
- */
419
-
420
- 'fields' => array(
421
- array(
422
- 'name' => 'title', // unique field name
423
- 'type' => 'text', // registered field type
424
- 'label' => __( 'Title', 'attachments' ), // label to display
425
- 'default' => 'title', // default value upon selection
426
- ),
427
- array(
428
- 'name' => 'caption', // unique field name
429
- 'type' => 'textarea', // registered field type
430
- 'label' => __( 'Caption', 'attachments' ), // label to display
431
- 'default' => 'caption', // default value upon selection
432
- )
433
- ),
434
 
435
  );
436
 
3
  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: 3.0
6
+ Tested up to: 3.5.1
7
+ Stable tag: 3.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 3.3.2 =
111
+ * You can now specify which view is default when browsing the Media modal (e.g. have 'Upload Files' be default instead of 'Media Library')
112
+
113
  = 3.3.1 =
114
  * Added meta box positioning arguments when registering instances
115
  * Cleaned up some CSS when Attachments instances are in the sidebar
346
 
347
  * Additional field type: checkbox
348
  * Additional field type: radio
 
349
  * User-defined limiting the number of Attachments per instance
350
  * User-defined custom field types
351
  * Additional hooks/actions from top to bottom
381
 
382
  function my_attachments( $attachments )
383
  {
384
+ $fields => array(
385
+ array(
386
+ 'name' => 'title', // unique field name
387
+ 'type' => 'text', // registered field type
388
+ 'label' => __( 'Title', 'attachments' ), // label to display
389
+ 'default' => 'title', // default value upon selection
390
+ ),
391
+ array(
392
+ 'name' => 'caption', // unique field name
393
+ 'type' => 'textarea', // registered field type
394
+ 'label' => __( 'Caption', 'attachments' ), // label to display
395
+ 'default' => 'caption', // default value upon selection
396
+ ),
397
+ );
398
+
399
  $args = array(
400
 
401
  // title of the meta box (string)
422
  // text for modal 'Attach' button (string)
423
  'modal_text' => __( 'Attach', 'attachments' ),
424
 
425
+ // which tab should be the default in the modal (string) (browse|upload)
426
+ 'router' => 'browse',
427
+
428
+ // fields array
429
+ 'fields' => $fields,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
 
431
  );
432