Version Description
- Fixed an issue in Firefox where you weren't able to focus inputs unless you clicked their label
- New field: textarea
Download this release
Release Info
Developer | jchristopher |
Plugin | Attachments |
Version | 3.0.8 |
Comparing to | |
See all releases |
Code changes from version 3.0.7 to 3.0.8
- README.md +18 -6
- classes/class.attachments.php +3 -2
- classes/fields/class.field.textarea.php +35 -0
- css/attachments.css +45 -6
- index.php +1 -1
- js/attachments.js +0 -1
- readme.txt +20 -7
README.md
CHANGED
@@ -106,27 +106,36 @@ function my_attachments( $attachments )
|
|
106 |
// include a note within the meta box (string)
|
107 |
'note' => 'Attach files here!',
|
108 |
|
109 |
-
// text for 'Attach' button (string)
|
110 |
'button_text' => __( 'Attach Files', 'attachments' ),
|
111 |
|
112 |
// text for modal 'Attach' button (string)
|
113 |
'modal_text' => __( 'Attach', 'attachments' ),
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
'fields' => array(
|
117 |
array(
|
118 |
'name' => 'title', // unique field name
|
119 |
-
'type' => 'text', // registered field type
|
120 |
'label' => __( 'Title', 'attachments' ), // label to display
|
121 |
),
|
122 |
array(
|
123 |
'name' => 'caption', // unique field name
|
124 |
-
'type' => '
|
125 |
'label' => __( 'Caption', 'attachments' ), // label to display
|
126 |
),
|
127 |
array(
|
128 |
'name' => 'copyright', // unique field name
|
129 |
-
'type' => 'text', // registered field type
|
130 |
'label' => __( 'Copyright', 'attachments' ), // label to display
|
131 |
),
|
132 |
),
|
@@ -246,6 +255,10 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
246 |
|
247 |
<dl>
|
248 |
|
|
|
|
|
|
|
|
|
249 |
<dt>3.0.7</dt>
|
250 |
<dd>Proper sanitization of Custom Post Type names (as WordPress does it)</dd>
|
251 |
|
@@ -293,7 +306,6 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
293 |
|
294 |
Planned feature additions include:
|
295 |
|
296 |
-
* Additional field type: textarea
|
297 |
* Additional field type: WYSIWYG
|
298 |
* Additional field type: checkbox
|
299 |
* Additional field type: radio
|
106 |
// include a note within the meta box (string)
|
107 |
'note' => 'Attach files here!',
|
108 |
|
109 |
+
// text for 'Attach' button in meta box (string)
|
110 |
'button_text' => __( 'Attach Files', 'attachments' ),
|
111 |
|
112 |
// text for modal 'Attach' button (string)
|
113 |
'modal_text' => __( 'Attach', 'attachments' ),
|
114 |
|
115 |
+
/**
|
116 |
+
* Fields for the instance are stored in an array. Each field consists of
|
117 |
+
* an array with three keys: name, type, label.
|
118 |
+
*
|
119 |
+
* name - (string) The field name used. No special characters.
|
120 |
+
* type - (string) The registered field type.
|
121 |
+
* Fields available: text, textarea
|
122 |
+
* label - (string) The label displayed for the field.
|
123 |
+
*/
|
124 |
+
|
125 |
'fields' => array(
|
126 |
array(
|
127 |
'name' => 'title', // unique field name
|
128 |
+
'type' => 'text', // registered field type
|
129 |
'label' => __( 'Title', 'attachments' ), // label to display
|
130 |
),
|
131 |
array(
|
132 |
'name' => 'caption', // unique field name
|
133 |
+
'type' => 'textarea', // registered field type
|
134 |
'label' => __( 'Caption', 'attachments' ), // label to display
|
135 |
),
|
136 |
array(
|
137 |
'name' => 'copyright', // unique field name
|
138 |
+
'type' => 'text', // registered field type
|
139 |
'label' => __( 'Copyright', 'attachments' ), // label to display
|
140 |
),
|
141 |
),
|
255 |
|
256 |
<dl>
|
257 |
|
258 |
+
<dt>3.0.8</dt>
|
259 |
+
<dd>Fixed an issue in Firefox where you weren't able to focus inputs unless you clicked their label</dd>
|
260 |
+
<dd>New field: textarea</dd>
|
261 |
+
|
262 |
<dt>3.0.7</dt>
|
263 |
<dd>Proper sanitization of Custom Post Type names (as WordPress does it)</dd>
|
264 |
|
306 |
|
307 |
Planned feature additions include:
|
308 |
|
|
|
309 |
* Additional field type: WYSIWYG
|
310 |
* Additional field type: checkbox
|
311 |
* Additional field type: radio
|
classes/class.attachments.php
CHANGED
@@ -56,7 +56,7 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
56 |
global $_wp_additional_image_sizes;
|
57 |
|
58 |
// establish our environment variables
|
59 |
-
$this->version = '3.0.
|
60 |
$this->url = ATTACHMENTS_URL;
|
61 |
$this->dir = ATTACHMENTS_DIR;
|
62 |
|
@@ -547,7 +547,8 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
547 |
function get_field_types()
|
548 |
{
|
549 |
$field_types = array(
|
550 |
-
'text'
|
|
|
551 |
);
|
552 |
|
553 |
// support custom field types
|
56 |
global $_wp_additional_image_sizes;
|
57 |
|
58 |
// establish our environment variables
|
59 |
+
$this->version = '3.0.8';
|
60 |
$this->url = ATTACHMENTS_URL;
|
61 |
$this->dir = ATTACHMENTS_DIR;
|
62 |
|
547 |
function get_field_types()
|
548 |
{
|
549 |
$field_types = array(
|
550 |
+
'text' => ATTACHMENTS_DIR . 'classes/fields/class.field.text.php',
|
551 |
+
'textarea' => ATTACHMENTS_DIR . 'classes/fields/class.field.textarea.php',
|
552 |
);
|
553 |
|
554 |
// support custom field types
|
classes/fields/class.field.textarea.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Attachments text field
|
5 |
+
*
|
6 |
+
* @package Attachments
|
7 |
+
* @subpackage Main
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Attachments_Field_Textarea extends Attachments_Field implements Attachments_Field_Template
|
11 |
+
{
|
12 |
+
|
13 |
+
function __construct( $name = 'name', $label = 'Name', $value = null )
|
14 |
+
{
|
15 |
+
parent::__construct( $name, $label, $value );
|
16 |
+
}
|
17 |
+
|
18 |
+
function html( $field )
|
19 |
+
{
|
20 |
+
?>
|
21 |
+
<textarea type="text" name="<?php esc_attr_e( $field->field_name ); ?>" id="<?php esc_attr_e( $field->field_id ); ?>" class="attachments attachments-field attachments-field-<?php esc_attr_e( $field->field_name ); ?> attachments-field-<?php esc_attr_e( $field->field_id ); ?>"><?php echo esc_textarea( $field->value ); ?></textarea>
|
22 |
+
<?php
|
23 |
+
}
|
24 |
+
|
25 |
+
function format_value_for_input( $value, $field = null )
|
26 |
+
{
|
27 |
+
return htmlspecialchars( $value, ENT_QUOTES );
|
28 |
+
}
|
29 |
+
|
30 |
+
public function input_head()
|
31 |
+
{
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
css/attachments.css
CHANGED
@@ -5,12 +5,24 @@ a.attachments-invoke {
|
|
5 |
|
6 |
.attachments-attachment {
|
7 |
position:relative;
|
8 |
-
overflow:hidden;
|
9 |
-
zoom:1;
|
10 |
padding:5px 0 25px;
|
11 |
border-bottom:1px solid #e7e7e7;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
.attachments-attachment:first-of-type {
|
15 |
padding-top:0;
|
16 |
}
|
@@ -70,8 +82,6 @@ a.attachments-invoke {
|
|
70 |
top:0;
|
71 |
margin-top:36px;
|
72 |
width:225px;
|
73 |
-
overflow:hidden;
|
74 |
-
zoom:1;
|
75 |
padding:5px;
|
76 |
background:#fdfdfd;
|
77 |
border:1px solid #DFDFDF;
|
@@ -79,6 +89,20 @@ a.attachments-invoke {
|
|
79 |
border-radius:2px;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
.attachments-attachment:first-of-type .attachment-meta {
|
83 |
margin-top:32px;
|
84 |
}
|
@@ -132,11 +156,19 @@ a.attachments-invoke {
|
|
132 |
}
|
133 |
|
134 |
.attachments-fields .attachments-attachment-field {
|
135 |
-
overflow:hidden;
|
136 |
-
zoom:1;
|
137 |
padding:8px 0;
|
138 |
}
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
.attachments-fields label {
|
141 |
display:block;
|
142 |
margin-bottom:3px;
|
@@ -149,6 +181,13 @@ a.attachments-invoke {
|
|
149 |
width:100%;
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
.attachments-handle {
|
153 |
position:absolute;
|
154 |
left:0;
|
5 |
|
6 |
.attachments-attachment {
|
7 |
position:relative;
|
|
|
|
|
8 |
padding:5px 0 25px;
|
9 |
border-bottom:1px solid #e7e7e7;
|
10 |
}
|
11 |
|
12 |
+
.attachments-attachment:before,
|
13 |
+
.attachments-attachment:after {
|
14 |
+
content: " "; /* 1 */
|
15 |
+
display: table; /* 2 */
|
16 |
+
}
|
17 |
+
|
18 |
+
.attachments-attachment:after {
|
19 |
+
clear: both;
|
20 |
+
}
|
21 |
+
|
22 |
+
.attachments-attachment {
|
23 |
+
*zoom: 1;
|
24 |
+
}
|
25 |
+
|
26 |
.attachments-attachment:first-of-type {
|
27 |
padding-top:0;
|
28 |
}
|
82 |
top:0;
|
83 |
margin-top:36px;
|
84 |
width:225px;
|
|
|
|
|
85 |
padding:5px;
|
86 |
background:#fdfdfd;
|
87 |
border:1px solid #DFDFDF;
|
89 |
border-radius:2px;
|
90 |
}
|
91 |
|
92 |
+
.attachments-attachment .attachment-meta:before,
|
93 |
+
.attachments-attachment .attachment-meta:after {
|
94 |
+
content: " "; /* 1 */
|
95 |
+
display: table; /* 2 */
|
96 |
+
}
|
97 |
+
|
98 |
+
.attachments-attachment .attachment-meta:after {
|
99 |
+
clear: both;
|
100 |
+
}
|
101 |
+
|
102 |
+
.attachments-attachment {
|
103 |
+
*zoom: 1;
|
104 |
+
}
|
105 |
+
|
106 |
.attachments-attachment:first-of-type .attachment-meta {
|
107 |
margin-top:32px;
|
108 |
}
|
156 |
}
|
157 |
|
158 |
.attachments-fields .attachments-attachment-field {
|
|
|
|
|
159 |
padding:8px 0;
|
160 |
}
|
161 |
|
162 |
+
.attachments-fields .attachments-attachment-field:before,
|
163 |
+
.attachments-fields .attachments-attachment-field:after {
|
164 |
+
content: " "; /* 1 */
|
165 |
+
display: table; /* 2 */
|
166 |
+
}
|
167 |
+
|
168 |
+
.attachments-fields .attachments-attachment-field:after {
|
169 |
+
clear: both;
|
170 |
+
}
|
171 |
+
|
172 |
.attachments-fields label {
|
173 |
display:block;
|
174 |
margin-bottom:3px;
|
181 |
width:100%;
|
182 |
}
|
183 |
|
184 |
+
.attachments-attachment-field-textarea textarea {
|
185 |
+
display:block;
|
186 |
+
width:100%;
|
187 |
+
height:150px;
|
188 |
+
resize:vertical;
|
189 |
+
}
|
190 |
+
|
191 |
.attachments-handle {
|
192 |
position:absolute;
|
193 |
left:0;
|
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.0.
|
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.0.8
|
10 |
* Text Domain: attachments
|
11 |
* Domain Path: /languages/
|
12 |
* License: GPLv2 or later
|
js/attachments.js
CHANGED
@@ -86,5 +86,4 @@ jQuery(document).ready(function($){
|
|
86 |
containment: 'parent',
|
87 |
handle: '.attachments-handle img'
|
88 |
});
|
89 |
-
$( '.attachments-container' ).disableSelection();
|
90 |
});
|
86 |
containment: 'parent',
|
87 |
handle: '.attachments-handle img'
|
88 |
});
|
|
|
89 |
});
|
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: 3.0
|
6 |
Tested up to: 3.5
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -95,6 +95,10 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
95 |
|
96 |
== Changelog ==
|
97 |
|
|
|
|
|
|
|
|
|
98 |
= 3.0.7 =
|
99 |
* Proper sanitization of Custom Post Type names (as WordPress does it)
|
100 |
|
@@ -284,7 +288,6 @@ Attachments are now stored in such a way that removes an in-place limitation on
|
|
284 |
|
285 |
Planned feature additions include:
|
286 |
|
287 |
-
* Additional field type: textarea
|
288 |
* Additional field type: WYSIWYG
|
289 |
* Additional field type: checkbox
|
290 |
* Additional field type: radio
|
@@ -309,6 +312,7 @@ If you would like to *disable the default instance* (meta box titled 'Attachment
|
|
309 |
You may create instances with your own custom fields by using the `attachments_register` action. To create your own instance add the following to your theme's `functions.php` or your own plugin:
|
310 |
|
311 |
`<?php
|
|
|
312 |
function my_attachments( $attachments )
|
313 |
{
|
314 |
$args = array(
|
@@ -325,27 +329,36 @@ function my_attachments( $attachments )
|
|
325 |
// include a note within the meta box (string)
|
326 |
'note' => 'Attach files here!',
|
327 |
|
328 |
-
// text for 'Attach' button (string)
|
329 |
'button_text' => __( 'Attach Files', 'attachments' ),
|
330 |
|
331 |
// text for modal 'Attach' button (string)
|
332 |
'modal_text' => __( 'Attach', 'attachments' ),
|
333 |
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
'fields' => array(
|
336 |
array(
|
337 |
'name' => 'title', // unique field name
|
338 |
-
'type' => 'text', // registered field type
|
339 |
'label' => __( 'Title', 'attachments' ), // label to display
|
340 |
),
|
341 |
array(
|
342 |
'name' => 'caption', // unique field name
|
343 |
-
'type' => '
|
344 |
'label' => __( 'Caption', 'attachments' ), // label to display
|
345 |
),
|
346 |
array(
|
347 |
'name' => 'copyright', // unique field name
|
348 |
-
'type' => 'text', // registered field type
|
349 |
'label' => __( 'Copyright', 'attachments' ), // label to display
|
350 |
),
|
351 |
),
|
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.0.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
95 |
|
96 |
== Changelog ==
|
97 |
|
98 |
+
= 3.0.8 =
|
99 |
+
* Fixed an issue in Firefox where you weren't able to focus inputs unless you clicked their label
|
100 |
+
* New field: textarea
|
101 |
+
|
102 |
= 3.0.7 =
|
103 |
* Proper sanitization of Custom Post Type names (as WordPress does it)
|
104 |
|
288 |
|
289 |
Planned feature additions include:
|
290 |
|
|
|
291 |
* Additional field type: WYSIWYG
|
292 |
* Additional field type: checkbox
|
293 |
* Additional field type: radio
|
312 |
You may create instances with your own custom fields by using the `attachments_register` action. To create your own instance add the following to your theme's `functions.php` or your own plugin:
|
313 |
|
314 |
`<?php
|
315 |
+
|
316 |
function my_attachments( $attachments )
|
317 |
{
|
318 |
$args = array(
|
329 |
// include a note within the meta box (string)
|
330 |
'note' => 'Attach files here!',
|
331 |
|
332 |
+
// text for 'Attach' button in meta box (string)
|
333 |
'button_text' => __( 'Attach Files', 'attachments' ),
|
334 |
|
335 |
// text for modal 'Attach' button (string)
|
336 |
'modal_text' => __( 'Attach', 'attachments' ),
|
337 |
|
338 |
+
/**
|
339 |
+
* Fields for the instance are stored in an array. Each field consists of
|
340 |
+
* an array with three keys: name, type, label.
|
341 |
+
*
|
342 |
+
* name - (string) The field name used. No special characters.
|
343 |
+
* type - (string) The registered field type.
|
344 |
+
* Fields available: text, textarea
|
345 |
+
* label - (string) The label displayed for the field.
|
346 |
+
*/
|
347 |
+
|
348 |
'fields' => array(
|
349 |
array(
|
350 |
'name' => 'title', // unique field name
|
351 |
+
'type' => 'text', // registered field type
|
352 |
'label' => __( 'Title', 'attachments' ), // label to display
|
353 |
),
|
354 |
array(
|
355 |
'name' => 'caption', // unique field name
|
356 |
+
'type' => 'textarea', // registered field type
|
357 |
'label' => __( 'Caption', 'attachments' ), // label to display
|
358 |
),
|
359 |
array(
|
360 |
'name' => 'copyright', // unique field name
|
361 |
+
'type' => 'text', // registered field type
|
362 |
'label' => __( 'Copyright', 'attachments' ), // label to display
|
363 |
),
|
364 |
),
|