Version Description
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 4.12.5 |
Comparing to | |
See all releases |
Code changes from version 4.12.4 to 4.12.5
- css/file.css +40 -25
- css/image.css +1 -1
- css/media.css +12 -8
- css/range.css +2 -9
- css/style.css +10 -7
- inc/clone.php +9 -2
- inc/field-registry.php +11 -0
- inc/fields/color.php +9 -6
- inc/fields/file.php +111 -81
- inc/fields/image.php +10 -8
- inc/fields/input-list.php +1 -1
- inc/fields/key-value.php +1 -1
- inc/loader.php +1 -1
- inc/templates/media.php +9 -9
- js/clone.js +4 -3
- js/file.js +34 -33
- js/input-list.js +2 -2
- js/map.js +14 -4
- js/thickbox-image.js +1 -1
- js/wp-color-picker-alpha/wp-color-picker-alpha.min.js +5 -4
- meta-box.php +1 -1
- readme.txt +33 -32
css/file.css
CHANGED
@@ -1,36 +1,51 @@
|
|
1 |
-
.rwmb-
|
2 |
-
|
3 |
-
margin: 0 10px 10px 0;
|
4 |
-
transition: width .25s, opacity .25s;
|
5 |
-
}
|
6 |
-
.rwmb-file-wrapper .rwmb-uploaded .rwmb-icon {
|
7 |
-
width: 60px;
|
8 |
-
text-align: center;
|
9 |
-
vertical-align: middle;
|
10 |
overflow: hidden;
|
11 |
}
|
12 |
-
.rwmb-file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
max-height: 60px;
|
14 |
max-width: 60px;
|
15 |
}
|
16 |
-
.rwmb-file-
|
17 |
-
|
18 |
-
vertical-align: top;
|
19 |
-
overflow: hidden;
|
20 |
-
}
|
21 |
-
.rwmb-file-wrapper .rwmb-uploaded .rwmb-info p {
|
22 |
-
margin: .1em 0;
|
23 |
}
|
24 |
-
.rwmb-file-
|
25 |
font-weight: bold;
|
26 |
text-decoration: none;
|
27 |
}
|
28 |
-
.rwmb-file-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
-
.rwmb-file-
|
34 |
-
|
35 |
-
margin: 0 0 2px 2px;
|
36 |
}
|
1 |
+
.rwmb-uploaded {
|
2 |
+
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
overflow: hidden;
|
4 |
}
|
5 |
+
.rwmb-file {
|
6 |
+
display: flex;
|
7 |
+
margin-bottom: 10px;
|
8 |
+
background: #fff;
|
9 |
+
cursor: move;
|
10 |
+
}
|
11 |
+
.rwmb-file-icon {
|
12 |
+
min-width: 60px;
|
13 |
+
flex-basis: 60px;
|
14 |
+
margin-right: 5px;
|
15 |
+
}
|
16 |
+
.rwmb-file-icon img {
|
17 |
max-height: 60px;
|
18 |
max-width: 60px;
|
19 |
}
|
20 |
+
.rwmb-file-info {
|
21 |
+
flex: 1;
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
+
.rwmb-file-title {
|
24 |
font-weight: bold;
|
25 |
text-decoration: none;
|
26 |
}
|
27 |
+
.rwmb-file-name {
|
28 |
+
margin: 0 0 4px;
|
29 |
+
white-space: nowrap;
|
30 |
+
}
|
31 |
+
.rwmb-file-actions {
|
32 |
+
margin: 0;
|
33 |
+
font-size: 11px;
|
34 |
+
}
|
35 |
+
.rwmb-file-edit,
|
36 |
+
.rwmb-file-delete {
|
37 |
+
color: inherit;
|
38 |
+
text-decoration: none;
|
39 |
+
}
|
40 |
+
.rwmb-file-edit {
|
41 |
+
margin-right: 6px;
|
42 |
+
}
|
43 |
+
.rwmb-file-actions .dashicons {
|
44 |
+
font-size: 1em;
|
45 |
+
width: 1em;
|
46 |
+
height: 1em;
|
47 |
+
vertical-align: middle;
|
48 |
}
|
49 |
+
.rwmb-file-input {
|
50 |
+
width: 100%;
|
|
|
51 |
}
|
css/image.css
CHANGED
@@ -37,7 +37,7 @@ li:hover .rwmb-image-bar {
|
|
37 |
text-decoration: none;
|
38 |
vertical-align: middle;
|
39 |
}
|
40 |
-
.rwmb-image-bar a.rwmb-delete
|
41 |
font-size: 23px;
|
42 |
width: 18px;
|
43 |
font-weight: normal;
|
37 |
text-decoration: none;
|
38 |
vertical-align: middle;
|
39 |
}
|
40 |
+
.rwmb-image-bar a.rwmb-file-delete {
|
41 |
font-size: 23px;
|
42 |
width: 18px;
|
43 |
font-weight: normal;
|
css/media.css
CHANGED
@@ -20,22 +20,26 @@
|
|
20 |
.rwmb-media-info {
|
21 |
margin-left: 65px;
|
22 |
}
|
23 |
-
.rwmb-media-
|
|
|
24 |
text-decoration: none;
|
25 |
}
|
26 |
-
.rwmb-media-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
}
|
30 |
.rwmb-edit-media,
|
31 |
.rwmb-remove-media {
|
32 |
font-size: 11px;
|
33 |
color: inherit;
|
|
|
34 |
}
|
35 |
-
.rwmb-media-
|
36 |
-
font-size:
|
37 |
-
width:
|
38 |
-
height:
|
39 |
vertical-align: middle;
|
40 |
}
|
41 |
|
20 |
.rwmb-media-info {
|
21 |
margin-left: 65px;
|
22 |
}
|
23 |
+
.rwmb-media-title {
|
24 |
+
font-weight: bold;
|
25 |
text-decoration: none;
|
26 |
}
|
27 |
+
.rwmb-media-name {
|
28 |
+
margin: 0 0 4px;
|
29 |
+
}
|
30 |
+
.rwmb-media-actions {
|
31 |
+
margin: 0;
|
32 |
}
|
33 |
.rwmb-edit-media,
|
34 |
.rwmb-remove-media {
|
35 |
font-size: 11px;
|
36 |
color: inherit;
|
37 |
+
text-decoration: none;
|
38 |
}
|
39 |
+
.rwmb-media-actions .dashicons {
|
40 |
+
font-size: 1em;
|
41 |
+
width: 1em;
|
42 |
+
height: 1em;
|
43 |
vertical-align: middle;
|
44 |
}
|
45 |
|
css/range.css
CHANGED
@@ -1,13 +1,6 @@
|
|
1 |
-
|
2 |
vertical-align: middle;
|
3 |
-
border-radius: 2px;
|
4 |
-
border: 1px solid #dfdfdf;
|
5 |
}
|
6 |
-
|
7 |
.rwmb-output {
|
8 |
-
|
9 |
-
display: inline-block;
|
10 |
-
position: relative;
|
11 |
-
padding: 5px 10px;
|
12 |
-
line-height: 20px;
|
13 |
}
|
1 |
+
.rwmb-range {
|
2 |
vertical-align: middle;
|
|
|
|
|
3 |
}
|
|
|
4 |
.rwmb-output {
|
5 |
+
margin-left: 8px;
|
|
|
|
|
|
|
|
|
6 |
}
|
css/style.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*
|
2 |
-------------------------------------------------------------- */
|
3 |
|
4 |
/* Clearfix for field */
|
@@ -90,11 +90,6 @@
|
|
90 |
left: 0;
|
91 |
top: 0;
|
92 |
}
|
93 |
-
.rwmb-clone-placeholder {
|
94 |
-
background: #fcf8e3;
|
95 |
-
border: 1px solid #faebcc;
|
96 |
-
display: block;
|
97 |
-
}
|
98 |
.rwmb-sort-clone {
|
99 |
padding-left: 15px;
|
100 |
}
|
@@ -111,8 +106,16 @@ select.error {
|
|
111 |
background: #ffebe8 !important;
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
/*
|
116 |
-------------------------------------------------------------- */
|
117 |
|
118 |
#side-sortables .rwmb-label,
|
1 |
+
/* Styles for 'normal' meta boxes
|
2 |
-------------------------------------------------------------- */
|
3 |
|
4 |
/* Clearfix for field */
|
90 |
left: 0;
|
91 |
top: 0;
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
93 |
.rwmb-sort-clone {
|
94 |
padding-left: 15px;
|
95 |
}
|
106 |
background: #ffebe8 !important;
|
107 |
}
|
108 |
|
109 |
+
/* Utilities
|
110 |
+
-------------------------------------------------------------- */
|
111 |
+
.rwmb-sortable-placeholder {
|
112 |
+
background: #fcf8e3;
|
113 |
+
border: 1px solid #faebcc;
|
114 |
+
display: block;
|
115 |
+
}
|
116 |
+
|
117 |
|
118 |
+
/* Styles for 'side' meta boxes
|
119 |
-------------------------------------------------------------- */
|
120 |
|
121 |
#side-sortables .rwmb-label,
|
inc/clone.php
CHANGED
@@ -39,7 +39,9 @@ class RWMB_Clone {
|
|
39 |
}
|
40 |
}
|
41 |
|
42 |
-
if ( $
|
|
|
|
|
43 |
$sub_field['field_name'] .= '[]';
|
44 |
}
|
45 |
|
@@ -78,7 +80,11 @@ class RWMB_Clone {
|
|
78 |
*/
|
79 |
public static function value( $new, $old, $post_id, $field ) {
|
80 |
if ( ! is_array( $new ) ) {
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
|
84 |
foreach ( $new as $key => $value ) {
|
@@ -86,6 +92,7 @@ class RWMB_Clone {
|
|
86 |
$value = RWMB_Field::call( $field, 'value', $value, $old_value, $post_id );
|
87 |
$new[ $key ] = RWMB_Field::filter( 'sanitize', $value, $field );
|
88 |
}
|
|
|
89 |
return $new;
|
90 |
}
|
91 |
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
if ( in_array( $sub_field['type'], array( 'file', 'image' ), true ) ) {
|
43 |
+
$sub_field['file_input_name'] = $field['file_input_name'] . "[{$index}]";
|
44 |
+
} elseif ( $field['multiple'] ) {
|
45 |
$sub_field['field_name'] .= '[]';
|
46 |
}
|
47 |
|
80 |
*/
|
81 |
public static function value( $new, $old, $post_id, $field ) {
|
82 |
if ( ! is_array( $new ) ) {
|
83 |
+
$new = array();
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( in_array( $field['type'], array( 'file', 'image' ), true ) ) {
|
87 |
+
return RWMB_Field::call( $field, 'value', $new, '', $post_id );
|
88 |
}
|
89 |
|
90 |
foreach ( $new as $key => $value ) {
|
92 |
$value = RWMB_Field::call( $field, 'value', $value, $old_value, $post_id );
|
93 |
$new[ $key ] = RWMB_Field::filter( 'sanitize', $value, $field );
|
94 |
}
|
95 |
+
|
96 |
return $new;
|
97 |
}
|
98 |
|
inc/field-registry.php
CHANGED
@@ -50,4 +50,15 @@ class RWMB_Field_Registry {
|
|
50 |
public function get( $id, $type, $object_type = 'post' ) {
|
51 |
return isset( $this->data[ $object_type ][ $type ][ $id ] ) ? $this->data[ $object_type ][ $type ][ $id ] : false;
|
52 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
50 |
public function get( $id, $type, $object_type = 'post' ) {
|
51 |
return isset( $this->data[ $object_type ][ $type ][ $id ] ) ? $this->data[ $object_type ][ $type ][ $id ] : false;
|
52 |
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve fields by object type.
|
56 |
+
*
|
57 |
+
* @param string $object_type Object type which the field belongs to.
|
58 |
+
*
|
59 |
+
* @return array List of fields.
|
60 |
+
*/
|
61 |
+
public function get_by_object_type( $object_type = 'post' ) {
|
62 |
+
return isset( $this->data[ $object_type ] ) ? $this->data[ $object_type ] : array();
|
63 |
+
}
|
64 |
}
|
inc/fields/color.php
CHANGED
@@ -13,9 +13,15 @@ class RWMB_Color_Field extends RWMB_Text_Field {
|
|
13 |
* Enqueue scripts and styles.
|
14 |
*/
|
15 |
public static function admin_enqueue_scripts() {
|
|
|
|
|
|
|
16 |
wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL . 'color.css', array( 'wp-color-picker' ), RWMB_VER );
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
@@ -26,11 +32,8 @@ class RWMB_Color_Field extends RWMB_Text_Field {
|
|
26 |
*/
|
27 |
public static function normalize( $field ) {
|
28 |
$field = wp_parse_args( $field, array(
|
29 |
-
'size' => 7,
|
30 |
-
'maxlength' => 7,
|
31 |
'alpha_channel' => false,
|
32 |
-
|
33 |
-
'js_options' => array(),
|
34 |
) );
|
35 |
|
36 |
$field['js_options'] = wp_parse_args( $field['js_options'], array(
|
13 |
* Enqueue scripts and styles.
|
14 |
*/
|
15 |
public static function admin_enqueue_scripts() {
|
16 |
+
$args = func_get_args();
|
17 |
+
$field = $args[0];
|
18 |
+
$js_dependency = array( 'wp-color-picker' );
|
19 |
wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL . 'color.css', array( 'wp-color-picker' ), RWMB_VER );
|
20 |
+
if ( $field['alpha_channel'] ) {
|
21 |
+
wp_enqueue_script( 'wp-color-picker-alpha', RWMB_JS_URL . 'wp-color-picker-alpha/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), RWMB_VER, true );
|
22 |
+
$js_dependency = array( 'wp-color-picker-alpha' );
|
23 |
+
}
|
24 |
+
wp_enqueue_script( 'rwmb-color', RWMB_JS_URL . 'color.js', $js_dependency, RWMB_VER, true );
|
25 |
}
|
26 |
|
27 |
/**
|
32 |
*/
|
33 |
public static function normalize( $field ) {
|
34 |
$field = wp_parse_args( $field, array(
|
|
|
|
|
35 |
'alpha_channel' => false,
|
36 |
+
'js_options' => array(),
|
|
|
37 |
) );
|
38 |
|
39 |
$field['js_options'] = wp_parse_args( $field['js_options'], array(
|
inc/fields/file.php
CHANGED
@@ -29,8 +29,7 @@ class RWMB_File_Field extends RWMB_Field {
|
|
29 |
*/
|
30 |
public static function add_actions() {
|
31 |
add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
|
32 |
-
add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, '
|
33 |
-
add_action( 'wp_ajax_rwmb_reorder_files', array( __CLASS__, 'wp_ajax_reorder_files' ) );
|
34 |
}
|
35 |
|
36 |
/**
|
@@ -40,44 +39,15 @@ class RWMB_File_Field extends RWMB_Field {
|
|
40 |
echo ' enctype="multipart/form-data"';
|
41 |
}
|
42 |
|
43 |
-
/**
|
44 |
-
* Ajax callback for reordering images
|
45 |
-
*/
|
46 |
-
public static function wp_ajax_reorder_files() {
|
47 |
-
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
48 |
-
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
49 |
-
$order = (string) filter_input( INPUT_POST, 'order' );
|
50 |
-
$object_type = (string) filter_input( INPUT_POST, 'object_type' );
|
51 |
-
$storage = rwmb_get_storage( $object_type );
|
52 |
-
|
53 |
-
check_ajax_referer( "rwmb-reorder-files_{$field_id}" );
|
54 |
-
parse_str( $order, $items );
|
55 |
-
$storage->delete( $post_id, $field_id );
|
56 |
-
foreach ( $items['item'] as $item ) {
|
57 |
-
$storage->add( $post_id, $field_id, $item, false );
|
58 |
-
}
|
59 |
-
wp_send_json_success();
|
60 |
-
}
|
61 |
-
|
62 |
/**
|
63 |
* Ajax callback for deleting files.
|
64 |
-
* Modified from a function used by "Verve Meta Boxes" plugin.
|
65 |
-
*
|
66 |
-
* @link http://goo.gl/LzYSq
|
67 |
*/
|
68 |
-
public static function
|
69 |
-
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
70 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
71 |
$attachment_id = (int) filter_input( INPUT_POST, 'attachment_id', FILTER_SANITIZE_NUMBER_INT );
|
72 |
-
$force_delete = (int) filter_input( INPUT_POST, 'force_delete', FILTER_SANITIZE_NUMBER_INT );
|
73 |
-
$object_type = (string) filter_input( INPUT_POST, 'object_type' );
|
74 |
-
$storage = rwmb_get_storage( $object_type );
|
75 |
|
76 |
check_ajax_referer( "rwmb-delete-file_{$field_id}" );
|
77 |
-
|
78 |
-
$success = $force_delete ? wp_delete_attachment( $attachment_id ) : true;
|
79 |
-
|
80 |
-
if ( $success ) {
|
81 |
wp_send_json_success();
|
82 |
}
|
83 |
wp_send_json_error( __( 'Error: Cannot delete file', 'meta-box' ) );
|
@@ -92,19 +62,17 @@ class RWMB_File_Field extends RWMB_Field {
|
|
92 |
* @return string
|
93 |
*/
|
94 |
public static function html( $meta, $field ) {
|
95 |
-
$meta
|
96 |
-
$
|
97 |
-
$
|
98 |
-
|
99 |
-
$html = self::get_uploaded_files( $meta, $field );
|
100 |
|
101 |
// Show form upload.
|
102 |
$html .= sprintf(
|
103 |
-
'<div class="rwmb-new
|
104 |
-
<
|
105 |
-
<a class="rwmb-add
|
106 |
</div>',
|
107 |
-
$field['
|
108 |
$i18n_more
|
109 |
);
|
110 |
|
@@ -121,9 +89,13 @@ class RWMB_File_Field extends RWMB_Field {
|
|
121 |
protected static function get_uploaded_files( $files, $field ) {
|
122 |
$reorder_nonce = wp_create_nonce( "rwmb-reorder-files_{$field['id']}" );
|
123 |
$delete_nonce = wp_create_nonce( "rwmb-delete-file_{$field['id']}" );
|
|
|
124 |
|
125 |
foreach ( (array) $files as $k => $file ) {
|
126 |
-
|
|
|
|
|
|
|
127 |
}
|
128 |
return sprintf(
|
129 |
'<ul class="rwmb-uploaded" data-field_id="%s" data-delete_nonce="%s" data-reorder_nonce="%s" data-force_delete="%s" data-max_file_uploads="%s" data-mime_type="%s">%s</ul>',
|
@@ -133,40 +105,44 @@ class RWMB_File_Field extends RWMB_Field {
|
|
133 |
$field['force_delete'] ? 1 : 0,
|
134 |
$field['max_file_uploads'],
|
135 |
$field['mime_type'],
|
136 |
-
|
137 |
);
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
* Get HTML for uploaded file.
|
142 |
*
|
143 |
-
* @param int
|
|
|
|
|
144 |
* @return string
|
145 |
*/
|
146 |
-
protected static function file_html( $file ) {
|
147 |
$i18n_delete = apply_filters( 'rwmb_file_delete_string', _x( 'Delete', 'file upload', 'meta-box' ) );
|
148 |
$i18n_edit = apply_filters( 'rwmb_file_edit_string', _x( 'Edit', 'file upload', 'meta-box' ) );
|
149 |
-
$
|
|
|
|
|
150 |
|
151 |
return sprintf(
|
152 |
-
'<li
|
153 |
-
<div class="rwmb-icon">%s</div>
|
154 |
-
<div class="rwmb-info">
|
155 |
-
<a href="%s" target="_blank">%s</a>
|
156 |
-
<p>%s</p>
|
157 |
-
<
|
158 |
-
|
|
|
|
|
159 |
</div>
|
|
|
160 |
</li>',
|
161 |
-
$file,
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
$
|
166 |
-
|
167 |
-
$i18n_edit,
|
168 |
-
$file,
|
169 |
-
$i18n_delete
|
170 |
);
|
171 |
}
|
172 |
|
@@ -181,44 +157,96 @@ class RWMB_File_Field extends RWMB_Field {
|
|
181 |
* @return array|mixed
|
182 |
*/
|
183 |
public static function value( $new, $old, $post_id, $field ) {
|
|
|
|
|
184 |
// @codingStandardsIgnoreLine
|
185 |
-
if ( empty( $_FILES[ $
|
186 |
return $new;
|
187 |
}
|
188 |
|
189 |
-
$new
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
|
|
|
|
|
|
|
|
195 |
}
|
|
|
196 |
}
|
197 |
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
/**
|
202 |
* Transform $_FILES from $_FILES['field']['key']['index'] to $_FILES['field_index']['key'].
|
203 |
*
|
204 |
-
* @param string $
|
205 |
*
|
206 |
* @return int The number of uploaded files.
|
207 |
*/
|
208 |
-
protected static function transform( $
|
209 |
-
// @
|
210 |
-
foreach ( $_FILES[ $
|
211 |
foreach ( $list as $index => $value ) {
|
212 |
-
|
213 |
-
if ( ! isset( $_FILES[
|
214 |
-
$_FILES[
|
215 |
}
|
216 |
-
$_FILES[
|
217 |
}
|
218 |
}
|
219 |
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
|
224 |
/**
|
@@ -237,6 +265,8 @@ class RWMB_File_Field extends RWMB_Field {
|
|
237 |
) );
|
238 |
$field['multiple'] = true;
|
239 |
|
|
|
|
|
240 |
return $field;
|
241 |
}
|
242 |
|
29 |
*/
|
30 |
public static function add_actions() {
|
31 |
add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
|
32 |
+
add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, 'ajax_delete_file' ) );
|
|
|
33 |
}
|
34 |
|
35 |
/**
|
39 |
echo ' enctype="multipart/form-data"';
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Ajax callback for deleting files.
|
|
|
|
|
|
|
44 |
*/
|
45 |
+
public static function ajax_delete_file() {
|
|
|
46 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
47 |
$attachment_id = (int) filter_input( INPUT_POST, 'attachment_id', FILTER_SANITIZE_NUMBER_INT );
|
|
|
|
|
|
|
48 |
|
49 |
check_ajax_referer( "rwmb-delete-file_{$field_id}" );
|
50 |
+
if ( wp_delete_attachment( $attachment_id ) ) {
|
|
|
|
|
|
|
51 |
wp_send_json_success();
|
52 |
}
|
53 |
wp_send_json_error( __( 'Error: Cannot delete file', 'meta-box' ) );
|
62 |
* @return string
|
63 |
*/
|
64 |
public static function html( $meta, $field ) {
|
65 |
+
$meta = array_filter( (array) $meta );
|
66 |
+
$i18n_more = apply_filters( 'rwmb_file_add_string', _x( '+ Add new file', 'file upload', 'meta-box' ), $field );
|
67 |
+
$html = self::get_uploaded_files( $meta, $field );
|
|
|
|
|
68 |
|
69 |
// Show form upload.
|
70 |
$html .= sprintf(
|
71 |
+
'<div class="rwmb-file-new">
|
72 |
+
<input type="file" name="%s[]" class="rwmb-file-input">
|
73 |
+
<a class="rwmb-file-add" href="#"><strong>%s</strong></a>
|
74 |
</div>',
|
75 |
+
$field['file_input_name'],
|
76 |
$i18n_more
|
77 |
);
|
78 |
|
89 |
protected static function get_uploaded_files( $files, $field ) {
|
90 |
$reorder_nonce = wp_create_nonce( "rwmb-reorder-files_{$field['id']}" );
|
91 |
$delete_nonce = wp_create_nonce( "rwmb-delete-file_{$field['id']}" );
|
92 |
+
$output = '';
|
93 |
|
94 |
foreach ( (array) $files as $k => $file ) {
|
95 |
+
// Ignore deleted files (if users accidentally deleted files or uses `force_delete` without saving post).
|
96 |
+
if ( get_attached_file( $file ) ) {
|
97 |
+
$output .= self::call( $field, 'file_html', $file, $k );
|
98 |
+
}
|
99 |
}
|
100 |
return sprintf(
|
101 |
'<ul class="rwmb-uploaded" data-field_id="%s" data-delete_nonce="%s" data-reorder_nonce="%s" data-force_delete="%s" data-max_file_uploads="%s" data-mime_type="%s">%s</ul>',
|
105 |
$field['force_delete'] ? 1 : 0,
|
106 |
$field['max_file_uploads'],
|
107 |
$field['mime_type'],
|
108 |
+
$output
|
109 |
);
|
110 |
}
|
111 |
|
112 |
/**
|
113 |
* Get HTML for uploaded file.
|
114 |
*
|
115 |
+
* @param int $file Attachment (file) ID.
|
116 |
+
* @param int $index File index.
|
117 |
+
* @param array $field Field data.
|
118 |
* @return string
|
119 |
*/
|
120 |
+
protected static function file_html( $file, $index, $field ) {
|
121 |
$i18n_delete = apply_filters( 'rwmb_file_delete_string', _x( 'Delete', 'file upload', 'meta-box' ) );
|
122 |
$i18n_edit = apply_filters( 'rwmb_file_edit_string', _x( 'Edit', 'file upload', 'meta-box' ) );
|
123 |
+
$attributes = self::get_attributes( $field, $file );
|
124 |
+
$path = get_attached_file( $file );
|
125 |
+
$icon = wp_get_attachment_image( $file, array( 60, 60 ), true );
|
126 |
|
127 |
return sprintf(
|
128 |
+
'<li class="rwmb-file">
|
129 |
+
<div class="rwmb-file-icon"><a href="%s" target="_blank">%s</a></div>
|
130 |
+
<div class="rwmb-file-info">
|
131 |
+
<a href="%s" target="_blank" class="rwmb-file-title">%s</a>
|
132 |
+
<p class="rwmb-file-name">%s</p>
|
133 |
+
<p class="rwmb-file-actions">
|
134 |
+
<a href="%s" class="rwmb-file-edit" target="_blank"><span class="dashicons dashicons-edit"></span>%s</a>
|
135 |
+
<a href="#" class="rwmb-file-delete" data-attachment_id="%s"><span class="dashicons dashicons-no-alt"></span>%s</a>
|
136 |
+
</p>
|
137 |
</div>
|
138 |
+
<input type="hidden" name="%s[%s]" value="%s">
|
139 |
</li>',
|
140 |
+
wp_get_attachment_url( $file ), $icon,
|
141 |
+
wp_get_attachment_url( $file ), get_the_title( $file ),
|
142 |
+
basename( $path ),
|
143 |
+
get_edit_post_link( $file ), $i18n_edit,
|
144 |
+
$file, $i18n_delete,
|
145 |
+
$attributes['name'], $index, $file
|
|
|
|
|
|
|
146 |
);
|
147 |
}
|
148 |
|
157 |
* @return array|mixed
|
158 |
*/
|
159 |
public static function value( $new, $old, $post_id, $field ) {
|
160 |
+
$input = $field['file_input_name'];
|
161 |
+
|
162 |
// @codingStandardsIgnoreLine
|
163 |
+
if ( empty( $_FILES[ $input ] ) ) {
|
164 |
return $new;
|
165 |
}
|
166 |
|
167 |
+
$new = array_filter( (array) $new );
|
168 |
+
|
169 |
+
// Non-cloneable field.
|
170 |
+
if ( ! $field['clone'] ) {
|
171 |
+
$count = self::transform( $input );
|
172 |
+
for ( $i = 0; $i <= $count; $i ++ ) {
|
173 |
+
$attachment = media_handle_upload( "{$input}_{$i}", $post_id );
|
174 |
+
if ( ! is_wp_error( $attachment ) ) {
|
175 |
+
$new[] = $attachment;
|
176 |
+
}
|
177 |
}
|
178 |
+
return $new;
|
179 |
}
|
180 |
|
181 |
+
|
182 |
+
// Cloneable field.
|
183 |
+
$counts = self::transform_cloneable( $input );
|
184 |
+
foreach ( $counts as $clone_index => $count ) {
|
185 |
+
if ( empty( $new[ $clone_index ] ) ) {
|
186 |
+
$new[ $clone_index ] = array();
|
187 |
+
}
|
188 |
+
for ( $i = 0; $i <= $count; $i ++ ) {
|
189 |
+
$attachment = media_handle_upload( "{$input}_{$clone_index}_{$i}", $post_id );
|
190 |
+
if ( ! is_wp_error( $attachment ) ) {
|
191 |
+
$new[ $clone_index ][] = $attachment;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
return $new;
|
197 |
}
|
198 |
|
199 |
/**
|
200 |
* Transform $_FILES from $_FILES['field']['key']['index'] to $_FILES['field_index']['key'].
|
201 |
*
|
202 |
+
* @param string $input_name The field input name.
|
203 |
*
|
204 |
* @return int The number of uploaded files.
|
205 |
*/
|
206 |
+
protected static function transform( $input_name ) {
|
207 |
+
// @codingStandardsIgnoreStart
|
208 |
+
foreach ( $_FILES[ $input_name ] as $key => $list ) {
|
209 |
foreach ( $list as $index => $value ) {
|
210 |
+
$file_key = "{$input_name}_{$index}";
|
211 |
+
if ( ! isset( $_FILES[ $file_key ] ) ) {
|
212 |
+
$_FILES[ $file_key ] = array();
|
213 |
}
|
214 |
+
$_FILES[ $file_key ][ $key ] = $value;
|
215 |
}
|
216 |
}
|
217 |
|
218 |
+
return count( $_FILES[ $input_name ]['name'] );
|
219 |
+
// @codingStandardsIgnoreEnd
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Transform $_FILES from $_FILES['field']['key']['cloneIndex']['index'] to $_FILES['field_cloneIndex_index']['key'].
|
224 |
+
*
|
225 |
+
* @param string $input_name The field input name.
|
226 |
+
*
|
227 |
+
* @return array
|
228 |
+
*/
|
229 |
+
protected static function transform_cloneable( $input_name ) {
|
230 |
+
// @codingStandardsIgnoreStart
|
231 |
+
foreach ( $_FILES[ $input_name ] as $key => $list ) {
|
232 |
+
foreach ( $list as $clone_index => $clone_values ) {
|
233 |
+
foreach ( $clone_values as $index => $value ) {
|
234 |
+
$file_key = "{$input_name}_{$clone_index}_{$index}";
|
235 |
+
|
236 |
+
if ( ! isset( $_FILES[ $file_key ] ) ) {
|
237 |
+
$_FILES[ $file_key ] = array();
|
238 |
+
}
|
239 |
+
$_FILES[ $file_key ][ $key ] = $value;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
$counts = array();
|
245 |
+
foreach ( $_FILES[ $input_name ]['name'] as $clone_index => $clone_values ) {
|
246 |
+
$counts[ $clone_index ] = count( $clone_values );
|
247 |
+
}
|
248 |
+
return $counts;
|
249 |
+
// @codingStandardsIgnoreEnd
|
250 |
}
|
251 |
|
252 |
/**
|
265 |
) );
|
266 |
$field['multiple'] = true;
|
267 |
|
268 |
+
$field['file_input_name'] = '_file_' . $field['id'];
|
269 |
+
|
270 |
return $field;
|
271 |
}
|
272 |
|
inc/fields/image.php
CHANGED
@@ -18,25 +18,27 @@ class RWMB_Image_Field extends RWMB_File_Field {
|
|
18 |
}
|
19 |
|
20 |
/**
|
21 |
-
* Get HTML
|
22 |
*
|
23 |
-
* @param int
|
|
|
|
|
24 |
* @return string
|
25 |
*/
|
26 |
-
|
27 |
-
list( $src ) = wp_get_attachment_image_src( $
|
28 |
return sprintf(
|
29 |
'<li id="item_%s">
|
30 |
<img src="%s">
|
31 |
<div class="rwmb-image-bar">
|
32 |
<a href="%s" target="_blank"><span class="dashicons dashicons-edit"></span></a> |
|
33 |
-
<a class="rwmb-delete
|
34 |
</div>
|
35 |
</li>',
|
36 |
-
$
|
37 |
$src,
|
38 |
-
get_edit_post_link( $
|
39 |
-
$
|
40 |
);
|
41 |
}
|
42 |
|
18 |
}
|
19 |
|
20 |
/**
|
21 |
+
* Get HTML for uploaded file.
|
22 |
*
|
23 |
+
* @param int $file Attachment (file) ID.
|
24 |
+
* @param int $index File index.
|
25 |
+
* @param array $field Field data.
|
26 |
* @return string
|
27 |
*/
|
28 |
+
protected static function file_html( $file, $index, $field ) {
|
29 |
+
list( $src ) = wp_get_attachment_image_src( $file, 'thumbnail' );
|
30 |
return sprintf(
|
31 |
'<li id="item_%s">
|
32 |
<img src="%s">
|
33 |
<div class="rwmb-image-bar">
|
34 |
<a href="%s" target="_blank"><span class="dashicons dashicons-edit"></span></a> |
|
35 |
+
<a href="#" class="rwmb-file-delete" data-attachment_id="%s">×</a>
|
36 |
</div>
|
37 |
</li>',
|
38 |
+
$file,
|
39 |
$src,
|
40 |
+
get_edit_post_link( $file ),
|
41 |
+
$file
|
42 |
);
|
43 |
}
|
44 |
|
inc/fields/input-list.php
CHANGED
@@ -87,7 +87,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field {
|
|
87 |
*/
|
88 |
public static function get_select_all_html( $field ) {
|
89 |
if ( $field['multiple'] && $field['select_all_none'] ) {
|
90 |
-
return sprintf( '<p><button class="rwmb-input-list-select-all-none" data-name="%s">%s</button></p>', $field['id'], __( 'Select All / None','meta-box' ) );
|
91 |
}
|
92 |
return '';
|
93 |
}
|
87 |
*/
|
88 |
public static function get_select_all_html( $field ) {
|
89 |
if ( $field['multiple'] && $field['select_all_none'] ) {
|
90 |
+
return sprintf( '<p><button class="rwmb-input-list-select-all-none button" data-name="%s">%s</button></p>', $field['id'], __( 'Select All / None','meta-box' ) );
|
91 |
}
|
92 |
return '';
|
93 |
}
|
inc/fields/key-value.php
CHANGED
@@ -139,7 +139,7 @@ class RWMB_Key_Value_Field extends RWMB_Text_Field {
|
|
139 |
public static function format_value( $field, $value ) {
|
140 |
$output = '<ul>';
|
141 |
foreach ( $value as $subvalue ) {
|
142 |
-
$output .= sprintf( '<li><label>%s
|
143 |
}
|
144 |
$output .= '</ul>';
|
145 |
return $output;
|
139 |
public static function format_value( $field, $value ) {
|
140 |
$output = '<ul>';
|
141 |
foreach ( $value as $subvalue ) {
|
142 |
+
$output .= sprintf( '<li><label>%s:</label> %s</li>', $subvalue[0], $subvalue[1] );
|
143 |
}
|
144 |
$output .= '</ul>';
|
145 |
return $output;
|
inc/loader.php
CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
|
|
18 |
*/
|
19 |
protected function constants() {
|
20 |
// Script version, used to add version for scripts and styles.
|
21 |
-
define( 'RWMB_VER', '4.12.
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
18 |
*/
|
19 |
protected function constants() {
|
20 |
// Script version, used to add version for scripts and styles.
|
21 |
+
define( 'RWMB_VER', '4.12.5' );
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
inc/templates/media.php
CHANGED
@@ -20,15 +20,15 @@
|
|
20 |
</div>
|
21 |
</div>
|
22 |
<div class="rwmb-media-info">
|
23 |
-
<
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
</
|
30 |
-
<p>{{{ data.
|
31 |
-
<p>
|
32 |
<a class="rwmb-edit-media" title="{{{ i18nRwmbMedia.edit }}}" href="{{{ data.editLink }}}" target="_blank">
|
33 |
<span class="dashicons dashicons-edit"></span>{{{ i18nRwmbMedia.edit }}}
|
34 |
</a>
|
20 |
</div>
|
21 |
</div>
|
22 |
<div class="rwmb-media-info">
|
23 |
+
<a href="{{{ data.url }}}" class="rwmb-media-title" target="_blank">
|
24 |
+
<# if( data.title ) { #>
|
25 |
+
{{{ data.title }}}
|
26 |
+
<# } else { #>
|
27 |
+
{{{ i18nRwmbMedia.noTitle }}}
|
28 |
+
<# } #>
|
29 |
+
</a>
|
30 |
+
<p class="rwmb-media-name">{{{ data.filename }}}</p>
|
31 |
+
<p class="rwmb-media-actions">
|
32 |
<a class="rwmb-edit-media" title="{{{ i18nRwmbMedia.edit }}}" href="{{{ data.editLink }}}" target="_blank">
|
33 |
<span class="dashicons dashicons-edit"></span>{{{ i18nRwmbMedia.edit }}}
|
34 |
</a>
|
js/clone.js
CHANGED
@@ -92,6 +92,7 @@ jQuery( function ( $ ) {
|
|
92 |
reset: function() {
|
93 |
cloneValue.$field = $( this );
|
94 |
cloneValue.type = cloneValue.$field.attr( 'type' );
|
|
|
95 |
|
96 |
if ( true === cloneValue.$field.data( 'clone-default' ) ) {
|
97 |
cloneValue.resetToDefault();
|
@@ -110,7 +111,7 @@ jQuery( function ( $ ) {
|
|
110 |
cloneValue.$field.prop( 'checked', !!defaultValue );
|
111 |
} else if ( 'select' === cloneValue.type ) {
|
112 |
cloneValue.$field.find( 'option[value="' + defaultValue + '"]' ).prop( 'selected', true );
|
113 |
-
} else if (
|
114 |
cloneValue.$field.val( defaultValue );
|
115 |
}
|
116 |
},
|
@@ -122,7 +123,7 @@ jQuery( function ( $ ) {
|
|
122 |
cloneValue.$field.prop( 'checked', false );
|
123 |
} else if ( 'select' === cloneValue.type ) {
|
124 |
cloneValue.$field.prop( 'selectedIndex', - 1 );
|
125 |
-
} else if (
|
126 |
cloneValue.$field.val( '' );
|
127 |
}
|
128 |
}
|
@@ -221,7 +222,7 @@ jQuery( function ( $ ) {
|
|
221 |
.data( 'next-index', $container.children( '.rwmb-clone' ).length )
|
222 |
.sortable( {
|
223 |
handle: '.rwmb-clone-icon',
|
224 |
-
placeholder: ' rwmb-clone rwmb-
|
225 |
items: '.rwmb-clone',
|
226 |
start: function ( event, ui ) {
|
227 |
// Make the placeholder has the same height as dragged item
|
92 |
reset: function() {
|
93 |
cloneValue.$field = $( this );
|
94 |
cloneValue.type = cloneValue.$field.attr( 'type' );
|
95 |
+
cloneValue.isHiddenField = cloneValue.$field.hasClass( 'rwmb-hidden' );
|
96 |
|
97 |
if ( true === cloneValue.$field.data( 'clone-default' ) ) {
|
98 |
cloneValue.resetToDefault();
|
111 |
cloneValue.$field.prop( 'checked', !!defaultValue );
|
112 |
} else if ( 'select' === cloneValue.type ) {
|
113 |
cloneValue.$field.find( 'option[value="' + defaultValue + '"]' ).prop( 'selected', true );
|
114 |
+
} else if ( ! cloneValue.isHiddenField ) {
|
115 |
cloneValue.$field.val( defaultValue );
|
116 |
}
|
117 |
},
|
123 |
cloneValue.$field.prop( 'checked', false );
|
124 |
} else if ( 'select' === cloneValue.type ) {
|
125 |
cloneValue.$field.prop( 'selectedIndex', - 1 );
|
126 |
+
} else if ( ! cloneValue.isHiddenField ) {
|
127 |
cloneValue.$field.val( '' );
|
128 |
}
|
129 |
}
|
222 |
.data( 'next-index', $container.children( '.rwmb-clone' ).length )
|
223 |
.sortable( {
|
224 |
handle: '.rwmb-clone-icon',
|
225 |
+
placeholder: ' rwmb-clone rwmb-sortable-placeholder',
|
226 |
items: '.rwmb-clone',
|
227 |
start: function ( event, ui ) {
|
228 |
// Make the placeholder has the same height as dragged item
|
js/file.js
CHANGED
@@ -14,9 +14,9 @@
|
|
14 |
event.preventDefault();
|
15 |
|
16 |
var $this = $( this ),
|
17 |
-
$clone = $this.
|
18 |
|
19 |
-
$clone.insertBefore( this );
|
20 |
file.updateVisibility.call( $this.closest( '.rwmb-input' ).find( '.rwmb-uploaded' )[0] );
|
21 |
};
|
22 |
|
@@ -31,21 +31,21 @@
|
|
31 |
|
32 |
var $this = $( this ),
|
33 |
$item = $this.closest( 'li' ),
|
34 |
-
$uploaded = $this.closest( '.rwmb-uploaded' )
|
35 |
-
data = {
|
36 |
-
action: 'rwmb_delete_file',
|
37 |
-
_ajax_nonce: $uploaded.data( 'delete_nonce' ),
|
38 |
-
post_id: $( '#post_ID' ).val(),
|
39 |
-
field_id: $uploaded.data( 'field_id' ),
|
40 |
-
object_type: $this.closest('.rwmb-meta-box').attr('data-object-type'),
|
41 |
-
attachment_id: $this.data( 'attachment_id' ),
|
42 |
-
force_delete: $uploaded.data( 'force_delete' )
|
43 |
-
};
|
44 |
|
45 |
$item.remove();
|
46 |
file.updateVisibility.call( $uploaded );
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if ( ! response.success ) {
|
50 |
alert( response.data );
|
51 |
}
|
@@ -57,20 +57,12 @@
|
|
57 |
* Expects `this` to equal the uploaded file list.
|
58 |
*/
|
59 |
file.sort = function () {
|
60 |
-
|
61 |
-
|
62 |
-
action: 'rwmb_reorder_files',
|
63 |
-
_ajax_nonce: $this.data( 'reorder_nonce' ),
|
64 |
-
post_id: $( '#post_ID' ).val(),
|
65 |
-
field_id: $this.data( 'field_id' ),
|
66 |
-
object_type: $this.closest('.rwmb-meta-box').attr('data-object-type')
|
67 |
-
};
|
68 |
-
$this.sortable( {
|
69 |
-
placeholder: 'ui-state-highlight',
|
70 |
items: 'li',
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
}
|
75 |
} );
|
76 |
};
|
@@ -82,24 +74,33 @@
|
|
82 |
file.updateVisibility = function () {
|
83 |
var $uploaded = $( this ),
|
84 |
max = parseInt( $uploaded.data( 'max_file_uploads' ), 10 ),
|
85 |
-
$
|
86 |
-
$
|
87 |
numFiles = $uploaded.children().length,
|
88 |
-
numInputs = $
|
89 |
|
90 |
$uploaded.toggle( 0 < numFiles );
|
91 |
if ( 0 === max ) {
|
92 |
return;
|
93 |
}
|
94 |
-
$
|
95 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
};
|
97 |
|
98 |
// Initialize when document ready.
|
99 |
$( function ( $ ) {
|
100 |
$( document )
|
101 |
-
.on( 'click', '.rwmb-add
|
102 |
-
.on( 'click', '.rwmb-delete
|
|
|
103 |
|
104 |
var $uploaded = $( '.rwmb-uploaded' );
|
105 |
$uploaded.each( file.sort );
|
14 |
event.preventDefault();
|
15 |
|
16 |
var $this = $( this ),
|
17 |
+
$clone = $this.prev().clone();
|
18 |
|
19 |
+
$clone.insertBefore( this ).val( '' );
|
20 |
file.updateVisibility.call( $this.closest( '.rwmb-input' ).find( '.rwmb-uploaded' )[0] );
|
21 |
};
|
22 |
|
31 |
|
32 |
var $this = $( this ),
|
33 |
$item = $this.closest( 'li' ),
|
34 |
+
$uploaded = $this.closest( '.rwmb-uploaded' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
$item.remove();
|
37 |
file.updateVisibility.call( $uploaded );
|
38 |
|
39 |
+
if ( 1 > $uploaded.data( 'force_delete' ) ) {
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
$.post( ajaxurl, {
|
44 |
+
action: 'rwmb_delete_file',
|
45 |
+
_ajax_nonce: $uploaded.data( 'delete_nonce' ),
|
46 |
+
field_id: $uploaded.data( 'field_id' ),
|
47 |
+
attachment_id: $this.data( 'attachment_id' )
|
48 |
+
}, function ( response ) {
|
49 |
if ( ! response.success ) {
|
50 |
alert( response.data );
|
51 |
}
|
57 |
* Expects `this` to equal the uploaded file list.
|
58 |
*/
|
59 |
file.sort = function () {
|
60 |
+
$( this ).sortable( {
|
61 |
+
placeholder: 'rwmb-file rwmb-sortable-placeholder',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
items: 'li',
|
63 |
+
start: function ( e, ui ) {
|
64 |
+
ui.placeholder.height( ui.helper.outerHeight() );
|
65 |
+
ui.placeholder.width( ui.helper.outerWidth() );
|
66 |
}
|
67 |
} );
|
68 |
};
|
74 |
file.updateVisibility = function () {
|
75 |
var $uploaded = $( this ),
|
76 |
max = parseInt( $uploaded.data( 'max_file_uploads' ), 10 ),
|
77 |
+
$new = $uploaded.siblings( '.rwmb-file-new' ),
|
78 |
+
$add = $new.find( '.rwmb-file-add' ),
|
79 |
numFiles = $uploaded.children().length,
|
80 |
+
numInputs = $new.find( '.rwmb-file-input' ).length;
|
81 |
|
82 |
$uploaded.toggle( 0 < numFiles );
|
83 |
if ( 0 === max ) {
|
84 |
return;
|
85 |
}
|
86 |
+
$new.toggle( numFiles < max );
|
87 |
+
$add.toggle( numFiles + numInputs < max );
|
88 |
+
};
|
89 |
+
|
90 |
+
// Reset field when cloning.
|
91 |
+
file.resetClone = function() {
|
92 |
+
var $this = $( this ),
|
93 |
+
$clone = $this.closest( '.rwmb-clone' );
|
94 |
+
$clone.find( '.rwmb-uploaded' ).remove();
|
95 |
+
$clone.find( '.rwmb-file-input' ).not( ':first' ).remove();
|
96 |
};
|
97 |
|
98 |
// Initialize when document ready.
|
99 |
$( function ( $ ) {
|
100 |
$( document )
|
101 |
+
.on( 'click', '.rwmb-file-add', file.addHandler )
|
102 |
+
.on( 'click', '.rwmb-file-delete', file.deleteHandler )
|
103 |
+
.on( 'clone', '.rwmb-file-input', file.resetClone );
|
104 |
|
105 |
var $uploaded = $( '.rwmb-uploaded' );
|
106 |
$uploaded.each( file.sort );
|
js/input-list.js
CHANGED
@@ -20,10 +20,10 @@ jQuery( function ( $ ) {
|
|
20 |
|
21 |
$( '.rwmb-input-list-select-all-none' ).toggle(
|
22 |
function () {
|
23 |
-
$('input
|
24 |
},
|
25 |
function () {
|
26 |
-
$('input
|
27 |
}
|
28 |
);
|
29 |
} );
|
20 |
|
21 |
$( '.rwmb-input-list-select-all-none' ).toggle(
|
22 |
function () {
|
23 |
+
$('input[name="' + $(this).data('name') + '[]"]').prop('checked', true);
|
24 |
},
|
25 |
function () {
|
26 |
+
$('input[name="' + $(this).data('name') + '[]"]').prop('checked', false);
|
27 |
}
|
28 |
);
|
29 |
} );
|
js/map.js
CHANGED
@@ -130,7 +130,12 @@
|
|
130 |
return;
|
131 |
}
|
132 |
|
133 |
-
var $address = $( '
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
// If Meta Box Geo Location installed. Do not run auto complete.
|
136 |
if ( $( '.rwmb-geo-binding' ).length ) {
|
@@ -205,10 +210,15 @@
|
|
205 |
|
206 |
function update() {
|
207 |
$( '.rwmb-map-field' ).each( function () {
|
208 |
-
var
|
209 |
-
|
|
|
|
|
|
|
210 |
|
211 |
-
$( this )
|
|
|
|
|
212 |
} );
|
213 |
}
|
214 |
|
130 |
return;
|
131 |
}
|
132 |
|
133 |
+
var $address = $( 'input[name="' + this.addressField + '"]');
|
134 |
+
|
135 |
+
// If map and address is inside a group, the input name of address field is changed.
|
136 |
+
if ( 0 === $address.length ) {
|
137 |
+
$address = this.$container.closest( '.rwmb-group-wrapper' ).find( 'input[name*="[' + this.addressField + ']"]' );
|
138 |
+
}
|
139 |
|
140 |
// If Meta Box Geo Location installed. Do not run auto complete.
|
141 |
if ( $( '.rwmb-geo-binding' ).length ) {
|
210 |
|
211 |
function update() {
|
212 |
$( '.rwmb-map-field' ).each( function () {
|
213 |
+
var $this = $( this ),
|
214 |
+
controller = $this.data( 'mapController' );
|
215 |
+
if ( controller ) {
|
216 |
+
return;
|
217 |
+
}
|
218 |
|
219 |
+
controller = new MapField( $( this ) );
|
220 |
+
controller.init();
|
221 |
+
$this.data( 'mapController', controller );
|
222 |
} );
|
223 |
}
|
224 |
|
js/thickbox-image.js
CHANGED
@@ -17,7 +17,7 @@ jQuery( function ( $ ) {
|
|
17 |
html = '<li id="item_' + id + '">';
|
18 |
html += '<img src="' + url + '">';
|
19 |
html += '<div class="rwmb-image-bar">';
|
20 |
-
html += '<a class="rwmb-delete
|
21 |
html += '</div>';
|
22 |
html += '<input type="hidden" name="' + field_id + '[]" value="' + id + '">';
|
23 |
html += '</li>';
|
17 |
html = '<li id="item_' + id + '">';
|
18 |
html += '<img src="' + url + '">';
|
19 |
html += '<div class="rwmb-image-bar">';
|
20 |
+
html += '<a class="rwmb-file-delete" href="#" data-attachment_id="' + id + '">×</a>';
|
21 |
html += '</div>';
|
22 |
html += '<input type="hidden" name="' + field_id + '[]" value="' + id + '">';
|
23 |
html += '</li>';
|
js/wp-color-picker-alpha/wp-color-picker-alpha.min.js
CHANGED
@@ -4,9 +4,10 @@
|
|
4 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
* Only run in input and is defined data alpha in true
|
6 |
*
|
7 |
-
* Version: 1.2
|
8 |
-
* https://github.com/
|
9 |
-
* Copyright (c) 2015 Sergio P.A. (23r9i0).
|
10 |
* Licensed under the GPLv2 license.
|
11 |
*/
|
12 |
-
!function(t){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",
|
|
|
|
4 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
* Only run in input and is defined data alpha in true
|
6 |
*
|
7 |
+
* Version: 2.1.2
|
8 |
+
* https://github.com/kallookoo/wp-color-picker-alpha
|
|
|
9 |
* Licensed under the GPLv2 license.
|
10 |
*/
|
11 |
+
!function(t){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',i='<input type="button" class="button button-small" />',a=void 0!==wpColorPickerL10n.current;if(a)n='<a tabindex="0" class="wp-color-result" />';else var n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>',l="<label></label>",s='<span class="screen-reader-text"></span>';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),a?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(i).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(i)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),a||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),a||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),a?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),a?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(a&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r)):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),i={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(i,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var a=o.picker.width()-o.controls.square.width()-20,n=a/6,l=a/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,i=parseInt(100*t._color._alpha),a=t._color.toRgb(),n=["rgb("+a.r+","+a.g+","+a.b+") 0%","rgba("+a.r+","+a.g+","+a.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",i),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()})},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),i=t.val();t.removeClass("iris-error"),e.error?""!==i&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&i.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}(jQuery),
|
12 |
+
// Auto call with colo-picker class
|
13 |
+
jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
meta-box.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields in WordPress.
|
6 |
-
* Version: 4.12.
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields in WordPress.
|
6 |
+
* Version: 4.12.5
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, ruanmer, Omnicia
|
3 |
Donate link: http://paypal.me/anhtnt
|
4 |
Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 4.12.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
|
@@ -30,9 +30,9 @@ The plugin requires a little coding, but if you're not familiar with coding or p
|
|
30 |
|
31 |
#### Wide-range of field types and options
|
32 |
|
33 |
-
* Supports 40+ built-in [field types](https://metabox.io/
|
34 |
* Support cloning (repeatable) fields for most field types, including WYSIWYG/editor field. Also support [repeatable field groups](https://metabox.io/plugins/meta-box-group/).
|
35 |
-
* Powerful [actions and filters](https://metabox.io/
|
36 |
|
37 |
#### Create meta boxes and custom fields with UI
|
38 |
|
@@ -46,61 +46,62 @@ The plugin is built mostly for developers with a little coding, but if you prefe
|
|
46 |
|
47 |
#### Developer-friendly
|
48 |
|
49 |
-
* Uses the [native WordPress meta data storage](https://metabox.io/
|
50 |
-
* [Easily integrate with themes and plugins](https://metabox.io/
|
51 |
-
* [Works with Composer](https://metabox.io/
|
52 |
* Compatible with WPML multilingual plugin (officially supported by WPML team).
|
53 |
|
54 |
#### Detailed Documentation
|
55 |
|
56 |
We provide regular updated and extensive documentation. Not only technical things, but also tutorials on how to use the plugin better.
|
57 |
|
58 |
-
- [
|
59 |
-
- [
|
60 |
-
- [
|
61 |
-
- [
|
62 |
|
63 |
-
See more documentation [here](https://metabox.io
|
64 |
|
65 |
### Extensions
|
66 |
|
67 |
#### Free Extensions
|
68 |
|
69 |
-
- [MB Comment Meta](https://wordpress.org/plugins/mb-comment-meta/): Add custom fields to comments in WordPress. Support all field types and options.
|
70 |
- [MB Custom Post Type](https://wordpress.org/plugins/mb-custom-post-type/): Create and manage custom post types and taxonomies easily in WordPress with an easy-to-use interface.
|
71 |
-
- [MB Custom Taxonomy](https://metabox.io/plugins/custom-taxonomy/): Create and manage custom taxonomies with an easy-to-use interface in WordPress.
|
72 |
- [Meta Box Yoast SEO](https://wordpress.org/plugins/meta-box-yoast-seo/): Add content of custom fields to Yoast SEO Content Analysis to have better/correct SEO score.
|
73 |
-
- [Meta Box Text Limiter](https://wordpress.org/plugins/meta-box-text-limiter/): Limit the number of characters or words entered for text and textarea fields.
|
74 |
- [MB Rest API](https://metabox.io/plugins/mb-rest-api/): Pull all meta value from posts, terms into the WP REST API responses.
|
|
|
|
|
|
|
|
|
75 |
|
76 |
#### Premium Extensions
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
- [MB Custom Table](https://metabox.io/plugins/mb-custom-table/): Save custom fields data to custom table instead of the default meta tables. Reduce database size and increase performance.
|
79 |
- [MB Revision](https://metabox.io/plugins/mb-revision/): Track changes of custom fields with WordPress revision. Save, compare, restore the changes easily.
|
80 |
-
- [MB Frontend Submission](https://metabox.io/plugins/mb-frontend-submission/): Create frontend forms for users to submit custom content. Embed everywhere with shortcode.
|
81 |
- [MB User Meta](https://metabox.io/plugins/mb-user-meta/): Add custom fields to user profile (user meta) quickly with simple syntax.
|
82 |
- [Meta Box Geolocation](https://metabox.io/plugins/meta-box-geolocation/): Automatically and instantly populate location data with the power of Google Maps Geolocation API.
|
83 |
-
- [MB Admin Columns](https://metabox.io/plugins/mb-admin-columns/): Display custom fields in table columns in admin screens for All Posts (types).
|
84 |
-
- [MB Term Meta](https://metabox.io/plugins/mb-term-meta/): Add meta data to categories, tags or any custom taxonomy with simple syntax.
|
85 |
-
- [MB Settings Page](https://metabox.io/plugins/mb-settings-page/): Create settings pages for themes, plugins or websites with beautiful syntax.
|
86 |
-
- [Meta Box Conditional Logic](https://metabox.io/plugins/meta-box-conditional-logic/): Add visibility dependency for custom meta boxes and custom fields in WordPress.
|
87 |
-
- [Meta Box Group](https://metabox.io/plugins/meta-box-group/): Create repeatable groups of custom fields for better appearance and structure.
|
88 |
-
- [Meta Box Builder](https://metabox.io/plugins/meta-box-builder/): Create custom meta boxes and custom fields in WordPress using the drag-and-drop interface.
|
89 |
- [Meta Box Template](https://metabox.io/plugins/meta-box-template/): Define custom meta boxes and custom fields easier with templates.
|
90 |
- [Meta Box Tooltip](https://metabox.io/plugins/meta-box-tooltip/): Display help information for fields using beautiful tooltips.
|
91 |
-
- [Meta Box Show Hide
|
92 |
-
- [Meta Box Tabs](https://metabox.io/plugins/meta-box-tabs/): Create tabs for meta boxes easily. Support 3 WordPress-native tab styles and tab icon.
|
93 |
-
- [Meta Box Columns](https://metabox.io/plugins/meta-box-columns/): Display fields more beautiful by putting them into 12-columns grid.
|
94 |
-
- [Meta Box Include Exclude](https://metabox.io/plugins/meta-box-include-exclude/): Show/hide meta boxes by ID, page template, taxonomy or custom function.
|
95 |
|
96 |
See all extensions [here](https://metabox.io/plugins/).
|
97 |
|
98 |
### Plugin Links
|
99 |
|
100 |
- [Project Page](https://metabox.io)
|
101 |
-
- [Documentation](https://metabox.io
|
102 |
-
- [Report Bugs/Issues](https://github.com/
|
103 |
-
- [Premium Extensions](https://metabox.io)
|
104 |
|
105 |
== Installation ==
|
106 |
|
@@ -117,7 +118,7 @@ Manually
|
|
117 |
1. Upload `meta-box` to the `/wp-content/plugins/` directory
|
118 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
119 |
|
120 |
-
To getting started with the plugin, please read [this tutorial](https://metabox.io/
|
121 |
|
122 |
== Frequently Asked Questions ==
|
123 |
|
@@ -131,6 +132,6 @@ To getting started with the plugin, please read [this tutorial](https://metabox.
|
|
131 |
|
132 |
== Changelog ==
|
133 |
|
134 |
-
[See full changelog here](https://github.com/
|
135 |
|
136 |
== Upgrade Notice ==
|
2 |
Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, ruanmer, Omnicia
|
3 |
Donate link: http://paypal.me/anhtnt
|
4 |
Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
|
5 |
+
Requires at least: 4.3
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 4.12.5
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
|
30 |
|
31 |
#### Wide-range of field types and options
|
32 |
|
33 |
+
* Supports 40+ built-in [field types](https://docs.metabox.io/field-settings/) for all your needs (text, textarea, wysiwyg/editor, image, file, post, select, checkbox, radio buttons, date time picker, taxonomy, user, oembed and more to come!). You can also [create your own field type](https://docs.metabox.io/custom-field-type/) easily.
|
34 |
* Support cloning (repeatable) fields for most field types, including WYSIWYG/editor field. Also support [repeatable field groups](https://metabox.io/plugins/meta-box-group/).
|
35 |
+
* Powerful [actions](https://docs.metabox.io/actions/) and [filters](https://docs.metabox.io/filters/) that developers can build or change the appearance and behavior in the plugin.
|
36 |
|
37 |
#### Create meta boxes and custom fields with UI
|
38 |
|
46 |
|
47 |
#### Developer-friendly
|
48 |
|
49 |
+
* Uses the [native WordPress meta data storage](https://docs.metabox.io/database/) and functions for ease of use and fast processing.
|
50 |
+
* [Easily integrate with themes and plugins](https://docs.metabox.io/integration/).
|
51 |
+
* [Works with Composer](https://docs.metabox.io/composer/) if you want to include the plugin in your project.
|
52 |
* Compatible with WPML multilingual plugin (officially supported by WPML team).
|
53 |
|
54 |
#### Detailed Documentation
|
55 |
|
56 |
We provide regular updated and extensive documentation. Not only technical things, but also tutorials on how to use the plugin better.
|
57 |
|
58 |
+
- [Quick Start Guide](https://docs.metabox.io/quick-start/)
|
59 |
+
- [Creating Meta Boxes](https://docs.metabox.io/creating-meta-boxes/)
|
60 |
+
- [Field Settings](https://docs.metabox.io/field-settings/)
|
61 |
+
- [Displaying Fields](https://docs.metabox.io/displaying-fields/)
|
62 |
|
63 |
+
See more documentation [here](https://docs.metabox.io).
|
64 |
|
65 |
### Extensions
|
66 |
|
67 |
#### Free Extensions
|
68 |
|
|
|
69 |
- [MB Custom Post Type](https://wordpress.org/plugins/mb-custom-post-type/): Create and manage custom post types and taxonomies easily in WordPress with an easy-to-use interface.
|
|
|
70 |
- [Meta Box Yoast SEO](https://wordpress.org/plugins/meta-box-yoast-seo/): Add content of custom fields to Yoast SEO Content Analysis to have better/correct SEO score.
|
|
|
71 |
- [MB Rest API](https://metabox.io/plugins/mb-rest-api/): Pull all meta value from posts, terms into the WP REST API responses.
|
72 |
+
- [MB Comment Meta](https://wordpress.org/plugins/mb-comment-meta/): Add custom fields to comments in WordPress. Support all field types and options.
|
73 |
+
- [MB Custom Taxonomy](https://metabox.io/plugins/custom-taxonomy/): Create and manage custom taxonomies with an easy-to-use interface in WordPress.
|
74 |
+
- [Meta Box Text Limiter](https://wordpress.org/plugins/meta-box-text-limiter/): Limit the number of characters or words entered for text and textarea fields.
|
75 |
+
- [Meta Box – FacetWP Integrator](https://metabox.io/plugins/meta-box-facetwp-integrator/): Integrates Meta Box and FacetWP, makes custom fields searchable and filterable in the frontend.
|
76 |
|
77 |
#### Premium Extensions
|
78 |
|
79 |
+
- [Meta Box Builder](https://metabox.io/plugins/meta-box-builder/): Create custom meta boxes and custom fields in WordPress using the drag-and-drop interface.
|
80 |
+
- [Meta Box Group](https://metabox.io/plugins/meta-box-group/): Create repeatable groups of custom fields for better appearance and structure.
|
81 |
+
- [MB Settings Page](https://metabox.io/plugins/mb-settings-page/): Create settings pages for themes, plugins or websites with beautiful syntax.
|
82 |
+
- [MB Term Meta](https://metabox.io/plugins/mb-term-meta/): Add meta data to categories, tags or any custom taxonomy with simple syntax.
|
83 |
+
- [Meta Box Conditional Logic](https://metabox.io/plugins/meta-box-conditional-logic/): Add visibility dependency for custom meta boxes and custom fields in WordPress.
|
84 |
+
- [Meta Box Include Exclude](https://metabox.io/plugins/meta-box-include-exclude/): Show/hide meta boxes by ID, page template, taxonomy or custom function.
|
85 |
+
- [MB Frontend Submission](https://metabox.io/plugins/mb-frontend-submission/): Create frontend forms for users to submit custom content. Embed everywhere with shortcode.
|
86 |
+
- [Meta Box Columns](https://metabox.io/plugins/meta-box-columns/): Display fields more beautiful by putting them into 12-columns grid.
|
87 |
+
- [Meta Box Tabs](https://metabox.io/plugins/meta-box-tabs/): Create tabs for meta boxes easily. Support 3 WordPress-native tab styles and tab icon.
|
88 |
+
- [MB Admin Columns](https://metabox.io/plugins/mb-admin-columns/): Display custom fields in table columns in admin screens for All Posts (types).
|
89 |
- [MB Custom Table](https://metabox.io/plugins/mb-custom-table/): Save custom fields data to custom table instead of the default meta tables. Reduce database size and increase performance.
|
90 |
- [MB Revision](https://metabox.io/plugins/mb-revision/): Track changes of custom fields with WordPress revision. Save, compare, restore the changes easily.
|
|
|
91 |
- [MB User Meta](https://metabox.io/plugins/mb-user-meta/): Add custom fields to user profile (user meta) quickly with simple syntax.
|
92 |
- [Meta Box Geolocation](https://metabox.io/plugins/meta-box-geolocation/): Automatically and instantly populate location data with the power of Google Maps Geolocation API.
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
- [Meta Box Template](https://metabox.io/plugins/meta-box-template/): Define custom meta boxes and custom fields easier with templates.
|
94 |
- [Meta Box Tooltip](https://metabox.io/plugins/meta-box-tooltip/): Display help information for fields using beautiful tooltips.
|
95 |
+
- [Meta Box Show Hide](https://metabox.io/plugins/meta-box-show-hide-javascript/): Toggle meta boxes by page template, post format, taxonomy (including category) via Javascript.
|
|
|
|
|
|
|
96 |
|
97 |
See all extensions [here](https://metabox.io/plugins/).
|
98 |
|
99 |
### Plugin Links
|
100 |
|
101 |
- [Project Page](https://metabox.io)
|
102 |
+
- [Documentation](https://docs.metabox.io)
|
103 |
+
- [Report Bugs/Issues](https://github.com/wpmetabox/meta-box/issues)
|
104 |
+
- [Premium Extensions](https://metabox.io/plugins/)
|
105 |
|
106 |
== Installation ==
|
107 |
|
118 |
1. Upload `meta-box` to the `/wp-content/plugins/` directory
|
119 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
120 |
|
121 |
+
To getting started with the plugin, please read [this tutorial](https://docs.metabox.io/quick-start/).
|
122 |
|
123 |
== Frequently Asked Questions ==
|
124 |
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
+
[See full changelog here](https://github.com/wpmetabox/meta-box/blob/master/CHANGELOG.md).
|
136 |
|
137 |
== Upgrade Notice ==
|