Version Description
- Improvement: Re-add change event on media fields to make Conditional Logic extension works with media fields.
- Improvement: Add
rwmb_choice_label
,rwmv_{$field_type}_choice_label
andrwmb_{field_id}_choice_label
filters for post, user, taxonomy fields, allowing users to customize the labels of choice fields. - Improvement: Change coding styles to follow WordPress Coding Standards.
- Various improvements to reduce duplicated code.
- Fix: Map field now works in the frontend.
- Fix:
std
now works for taxonomy fields.
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 4.9.7 |
Comparing to | |
See all releases |
Code changes from version 4.9.6 to 4.9.7
- inc/autoloader.php +23 -31
- inc/clone.php +21 -24
- inc/core.php +40 -46
- inc/field.php +106 -106
- inc/fields/autocomplete.php +18 -34
- inc/fields/button.php +5 -8
- inc/fields/checkbox-list.php +5 -5
- inc/fields/checkbox.php +9 -12
- inc/fields/choice.php +17 -25
- inc/fields/color.php +7 -10
- inc/fields/custom-html.php +4 -6
- inc/fields/date.php +4 -6
- inc/fields/datetime.php +43 -40
- inc/fields/divider.php +5 -8
- inc/fields/fieldset-text.php +17 -26
- inc/fields/file-input.php +8 -19
- inc/fields/file-upload.php +4 -6
- inc/fields/file.php +62 -90
- inc/fields/heading.php +5 -8
- inc/fields/image-advanced.php +13 -16
- inc/fields/image-select.php +9 -13
- inc/fields/image-upload.php +4 -6
- inc/fields/image.php +11 -18
- inc/fields/input-list.php +6 -10
- inc/fields/input.php +10 -15
- inc/fields/key-value.php +19 -25
- inc/fields/map.php +46 -46
- inc/fields/media.php +33 -49
- inc/fields/multiple-values.php +8 -8
- inc/fields/number.php +4 -6
- inc/fields/object-choice.php +15 -24
- inc/fields/oembed.php +13 -20
- inc/fields/password.php +4 -4
- inc/fields/post.php +13 -21
- inc/fields/radio.php +4 -4
- inc/fields/range.php +9 -14
- inc/fields/select-advanced.php +6 -10
- inc/fields/select-tree.php +6 -10
- inc/fields/select.php +9 -16
- inc/fields/slider.php +5 -8
- inc/fields/taxonomy-advanced.php +17 -43
- inc/fields/taxonomy.php +27 -53
- inc/fields/text-list.php +14 -22
- inc/fields/text.php +4 -6
- inc/fields/textarea.php +6 -10
- inc/fields/thickbox-image.php +9 -12
- inc/fields/time.php +4 -6
- inc/fields/user.php +8 -12
- inc/fields/wysiwyg.php +8 -12
- inc/functions.php +16 -22
- inc/helper.php +20 -30
- inc/loader.php +11 -13
- inc/meta-box.php +56 -74
- inc/sanitizer.php +9 -10
- inc/validation.php +13 -23
- inc/walkers/base.php +3 -4
- inc/walkers/input-list.php +7 -11
- inc/walkers/select-tree.php +13 -16
- inc/walkers/select.php +5 -6
- inc/wpml.php +43 -44
- js/autocomplete.js +8 -14
- js/autosave.js +5 -10
- js/clone.js +26 -50
- js/color.js +5 -10
- js/date.js +15 -23
- js/datetime.js +19 -29
- js/file-input.js +7 -12
- js/file-upload.js +65 -73
- js/file.js +38 -65
- js/image-advanced.js +6 -8
- js/image-select.js +5 -11
- js/image-upload.js +6 -8
- js/input-list.js +17 -22
- js/jquery-validation/additional-methods.min.js +3 -3
- js/map-frontend.js +10 -18
- js/map.js +49 -84
- js/media.js +86 -121
- js/range.js +5 -8
- js/select-advanced.js +2 -4
- js/select-tree.js +2 -4
- js/select.js +12 -24
- js/slider.js +6 -11
- js/thickbox-image.js +3 -6
- js/time.js +7 -13
- js/validate.js +5 -10
- js/wysiwyg.js +21 -31
- languages/default.pot +179 -0
- {lang → languages}/meta-box-ar.mo +0 -0
- languages/meta-box-ar.po +122 -0
- {lang → languages}/meta-box-de_DE.mo +0 -0
- languages/meta-box-de_DE.po +160 -0
- {lang → languages}/meta-box-fa_IR.mo +0 -0
- languages/meta-box-fa_IR.po +232 -0
- {lang → languages}/meta-box-fr_FR.mo +0 -0
- languages/meta-box-fr_FR.po +456 -0
- {lang → languages}/meta-box-it_IT.mo +0 -0
- languages/meta-box-it_IT.po +126 -0
- {lang → languages}/meta-box-nb_NO.mo +0 -0
- languages/meta-box-nb_NO.po +149 -0
- {lang → languages}/meta-box-nl_NL.mo +0 -0
- languages/meta-box-nl_NL.po +130 -0
- {lang → languages}/meta-box-pl_PL.mo +0 -0
- languages/meta-box-pl_PL.po +212 -0
- {lang → languages}/meta-box-pt_BR.mo +0 -0
- languages/meta-box-pt_BR.po +124 -0
- {lang → languages}/meta-box-ru_RU.mo +0 -0
- languages/meta-box-ru_RU.po +637 -0
- {lang → languages}/meta-box-sv_SE.mo +0 -0
- languages/meta-box-sv_SE.po +118 -0
- {lang → languages}/meta-box-tr_TR.mo +0 -0
- languages/meta-box-tr_TR.po +384 -0
- {lang → languages}/meta-box-zh_CN.mo +0 -0
- languages/meta-box-zh_CN.po +189 -0
- {lang → languages}/meta-box-zh_TW.mo +0 -0
- languages/meta-box-zh_TW.po +189 -0
- meta-box.php +3 -4
- readme.txt +9 -1
inc/autoloader.php
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Autoload plugin classes.
|
|
|
4 |
* @package Meta Box
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Autoload class
|
9 |
*/
|
10 |
-
class RWMB_Autoloader
|
11 |
-
|
12 |
/**
|
13 |
* List of directories to load classes.
|
|
|
14 |
* @var array
|
15 |
*/
|
16 |
protected $dirs = array();
|
@@ -22,8 +24,7 @@ class RWMB_Autoloader
|
|
22 |
* @param string $prefix The class name prefix.
|
23 |
* @param string $suffix The class name suffix.
|
24 |
*/
|
25 |
-
public function add( $base_dir, $prefix, $suffix = '' )
|
26 |
-
{
|
27 |
$this->dirs[] = array(
|
28 |
'dir' => trailingslashit( $base_dir ),
|
29 |
'prefix' => $prefix,
|
@@ -35,43 +36,38 @@ class RWMB_Autoloader
|
|
35 |
* Register autoloader for plugin classes.
|
36 |
* In PHP 5.3, SPL extension cannot be disabled and it's safe to use autoload.
|
37 |
* However, hosting providers can disable it in PHP 5.2. In that case, we provide a fallback for autoload.
|
|
|
38 |
* @link http://php.net/manual/en/spl.installation.php
|
39 |
* @link https://github.com/rilwis/meta-box/issues/810
|
40 |
*/
|
41 |
-
public function register()
|
42 |
-
{
|
43 |
spl_autoload_register( array( $this, 'autoload' ) );
|
44 |
-
if ( ! class_exists( 'RWMB_Core' ) )
|
45 |
-
{
|
46 |
$this->fallback();
|
47 |
}
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Autoload fields' classes.
|
|
|
52 |
* @param string $class Class name
|
53 |
* @return mixed Boolean false if no mapped file can be loaded, or the name of the mapped file that was loaded.
|
54 |
*/
|
55 |
-
public function autoload( $class )
|
56 |
-
|
57 |
-
foreach ( $this->dirs as $dir )
|
58 |
-
{
|
59 |
if (
|
60 |
( $dir['prefix'] && 0 !== strpos( $class, $dir['prefix'] ) )
|
61 |
&& ( $dir['suffix'] && substr( $class, - strlen( $dir['suffix'] ) ) !== $dir['suffix'] )
|
62 |
-
)
|
63 |
-
{
|
64 |
continue;
|
65 |
}
|
66 |
$file = substr( $class, strlen( $dir['prefix'] ) );
|
67 |
-
if ( $dir['suffix'] && strlen( $file ) > strlen( $dir['suffix'] ) )
|
68 |
-
{
|
69 |
$file = substr( $file, 0, - strlen( $dir['suffix'] ) );
|
70 |
}
|
71 |
$file = strtolower( str_replace( '_', '-', $file ) ) . '.php';
|
72 |
$file = $dir['dir'] . $file;
|
73 |
-
if ( $this->require_file( $file ) )
|
74 |
-
{
|
75 |
return $file;
|
76 |
}
|
77 |
}
|
@@ -81,8 +77,7 @@ class RWMB_Autoloader
|
|
81 |
/**
|
82 |
* Fallback for autoload in PHP 5.2.
|
83 |
*/
|
84 |
-
protected function fallback()
|
85 |
-
{
|
86 |
$files = array(
|
87 |
// Core
|
88 |
'core',
|
@@ -157,22 +152,19 @@ class RWMB_Autoloader
|
|
157 |
'fields/textarea',
|
158 |
'fields/wysiwyg',
|
159 |
);
|
160 |
-
foreach ( $files as $file )
|
161 |
-
{
|
162 |
$this->require_file( RWMB_INC_DIR . "$file.php" );
|
163 |
}
|
164 |
}
|
165 |
|
166 |
/**
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
protected function require_file( $file )
|
173 |
-
|
174 |
-
if ( file_exists( $file ) )
|
175 |
-
{
|
176 |
require_once $file;
|
177 |
return true;
|
178 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Autoload plugin classes.
|
4 |
+
*
|
5 |
* @package Meta Box
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Autoload class
|
10 |
*/
|
11 |
+
class RWMB_Autoloader {
|
12 |
+
|
13 |
/**
|
14 |
* List of directories to load classes.
|
15 |
+
*
|
16 |
* @var array
|
17 |
*/
|
18 |
protected $dirs = array();
|
24 |
* @param string $prefix The class name prefix.
|
25 |
* @param string $suffix The class name suffix.
|
26 |
*/
|
27 |
+
public function add( $base_dir, $prefix, $suffix = '' ) {
|
|
|
28 |
$this->dirs[] = array(
|
29 |
'dir' => trailingslashit( $base_dir ),
|
30 |
'prefix' => $prefix,
|
36 |
* Register autoloader for plugin classes.
|
37 |
* In PHP 5.3, SPL extension cannot be disabled and it's safe to use autoload.
|
38 |
* However, hosting providers can disable it in PHP 5.2. In that case, we provide a fallback for autoload.
|
39 |
+
*
|
40 |
* @link http://php.net/manual/en/spl.installation.php
|
41 |
* @link https://github.com/rilwis/meta-box/issues/810
|
42 |
*/
|
43 |
+
public function register() {
|
|
|
44 |
spl_autoload_register( array( $this, 'autoload' ) );
|
45 |
+
if ( ! class_exists( 'RWMB_Core' ) ) {
|
|
|
46 |
$this->fallback();
|
47 |
}
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Autoload fields' classes.
|
52 |
+
*
|
53 |
* @param string $class Class name
|
54 |
* @return mixed Boolean false if no mapped file can be loaded, or the name of the mapped file that was loaded.
|
55 |
*/
|
56 |
+
public function autoload( $class ) {
|
57 |
+
foreach ( $this->dirs as $dir ) {
|
|
|
|
|
58 |
if (
|
59 |
( $dir['prefix'] && 0 !== strpos( $class, $dir['prefix'] ) )
|
60 |
&& ( $dir['suffix'] && substr( $class, - strlen( $dir['suffix'] ) ) !== $dir['suffix'] )
|
61 |
+
) {
|
|
|
62 |
continue;
|
63 |
}
|
64 |
$file = substr( $class, strlen( $dir['prefix'] ) );
|
65 |
+
if ( $dir['suffix'] && strlen( $file ) > strlen( $dir['suffix'] ) ) {
|
|
|
66 |
$file = substr( $file, 0, - strlen( $dir['suffix'] ) );
|
67 |
}
|
68 |
$file = strtolower( str_replace( '_', '-', $file ) ) . '.php';
|
69 |
$file = $dir['dir'] . $file;
|
70 |
+
if ( $this->require_file( $file ) ) {
|
|
|
71 |
return $file;
|
72 |
}
|
73 |
}
|
77 |
/**
|
78 |
* Fallback for autoload in PHP 5.2.
|
79 |
*/
|
80 |
+
protected function fallback() {
|
|
|
81 |
$files = array(
|
82 |
// Core
|
83 |
'core',
|
152 |
'fields/textarea',
|
153 |
'fields/wysiwyg',
|
154 |
);
|
155 |
+
foreach ( $files as $file ) {
|
|
|
156 |
$this->require_file( RWMB_INC_DIR . "$file.php" );
|
157 |
}
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
+
* If a file exists, require it from the file system.
|
162 |
+
*
|
163 |
+
* @param string $file The file to require.
|
164 |
+
* @return bool True if the file exists, false if not.
|
165 |
+
*/
|
166 |
+
protected function require_file( $file ) {
|
167 |
+
if ( file_exists( $file ) ) {
|
|
|
|
|
168 |
require_once $file;
|
169 |
return true;
|
170 |
}
|
inc/clone.php
CHANGED
@@ -2,10 +2,11 @@
|
|
2 |
|
3 |
/**
|
4 |
* The Meta Box Clone class.
|
|
|
5 |
* @package Meta Box
|
6 |
*/
|
7 |
-
class RWMB_Clone
|
8 |
-
|
9 |
/**
|
10 |
* Get clone field HTML
|
11 |
*
|
@@ -14,32 +15,31 @@ class RWMB_Clone
|
|
14 |
*
|
15 |
* @return string
|
16 |
*/
|
17 |
-
public static function html( $meta, $field )
|
18 |
-
{
|
19 |
$field_html = '';
|
20 |
|
21 |
/**
|
22 |
* Note: $meta must contain value so that the foreach loop runs!
|
|
|
23 |
* @see meta()
|
24 |
*/
|
25 |
-
foreach ( $meta as $index => $sub_meta )
|
26 |
-
{
|
27 |
$sub_field = $field;
|
28 |
$sub_field['field_name'] = $field['field_name'] . "[{$index}]";
|
29 |
-
if ( $index > 0 )
|
30 |
-
|
31 |
-
if ( isset( $sub_field['address_field'] ) )
|
32 |
$sub_field['address_field'] = $field['address_field'] . "_{$index}";
|
|
|
33 |
$sub_field['id'] = $field['id'] . "_{$index}";
|
34 |
}
|
35 |
-
if ( $field['multiple'] )
|
36 |
$sub_field['field_name'] .= '[]';
|
|
|
37 |
|
38 |
// Wrap field HTML in a div with class="rwmb-clone" if needed
|
39 |
$class = "rwmb-clone rwmb-{$field['type']}-clone";
|
40 |
$sort_icon = '';
|
41 |
-
if ( $field['sort_clone'] )
|
42 |
-
{
|
43 |
$class .= ' rwmb-sort-clone';
|
44 |
$sort_icon = "<a href='javascript:;' class='rwmb-clone-icon'></a>";
|
45 |
}
|
@@ -69,26 +69,23 @@ class RWMB_Clone
|
|
69 |
*
|
70 |
* @return mixed
|
71 |
*/
|
72 |
-
public static function value( $new, $old, $post_id, $field )
|
73 |
-
|
74 |
-
|
75 |
-
{
|
76 |
-
$old_value = isset( $old[$key] ) ? $old[$key] : null;
|
77 |
$value = RWMB_Field::call( $field, 'value', $value, $old_value, $post_id );
|
78 |
-
$new[$key] = RWMB_Field::filter( 'sanitize', $value, $field );
|
79 |
}
|
80 |
return $new;
|
81 |
}
|
82 |
|
83 |
/**
|
84 |
* Add clone button
|
|
|
85 |
* @param array $field Field parameter
|
86 |
* @return string $html
|
87 |
*/
|
88 |
-
public static function add_clone_button( $field )
|
89 |
-
|
90 |
-
if ( ! $field['clone'] )
|
91 |
-
{
|
92 |
return '';
|
93 |
}
|
94 |
$text = RWMB_Field::filter( 'add_clone_button_text', __( '+ Add more', 'meta-box' ), $field );
|
@@ -97,11 +94,11 @@ class RWMB_Clone
|
|
97 |
|
98 |
/**
|
99 |
* Remove clone button
|
|
|
100 |
* @param array $field Field parameter
|
101 |
* @return string $html
|
102 |
*/
|
103 |
-
public static function remove_clone_button( $field )
|
104 |
-
{
|
105 |
$text = RWMB_Field::filter( 'remove_clone_button_text', '<i class="dashicons dashicons-minus"></i>', $field );
|
106 |
return '<a href="#" class="rwmb-button remove-clone">' . $text . '</a>';
|
107 |
}
|
2 |
|
3 |
/**
|
4 |
* The Meta Box Clone class.
|
5 |
+
*
|
6 |
* @package Meta Box
|
7 |
*/
|
8 |
+
class RWMB_Clone {
|
9 |
+
|
10 |
/**
|
11 |
* Get clone field HTML
|
12 |
*
|
15 |
*
|
16 |
* @return string
|
17 |
*/
|
18 |
+
public static function html( $meta, $field ) {
|
|
|
19 |
$field_html = '';
|
20 |
|
21 |
/**
|
22 |
* Note: $meta must contain value so that the foreach loop runs!
|
23 |
+
*
|
24 |
* @see meta()
|
25 |
*/
|
26 |
+
foreach ( $meta as $index => $sub_meta ) {
|
|
|
27 |
$sub_field = $field;
|
28 |
$sub_field['field_name'] = $field['field_name'] . "[{$index}]";
|
29 |
+
if ( $index > 0 ) {
|
30 |
+
if ( isset( $sub_field['address_field'] ) ) {
|
|
|
31 |
$sub_field['address_field'] = $field['address_field'] . "_{$index}";
|
32 |
+
}
|
33 |
$sub_field['id'] = $field['id'] . "_{$index}";
|
34 |
}
|
35 |
+
if ( $field['multiple'] ) {
|
36 |
$sub_field['field_name'] .= '[]';
|
37 |
+
}
|
38 |
|
39 |
// Wrap field HTML in a div with class="rwmb-clone" if needed
|
40 |
$class = "rwmb-clone rwmb-{$field['type']}-clone";
|
41 |
$sort_icon = '';
|
42 |
+
if ( $field['sort_clone'] ) {
|
|
|
43 |
$class .= ' rwmb-sort-clone';
|
44 |
$sort_icon = "<a href='javascript:;' class='rwmb-clone-icon'></a>";
|
45 |
}
|
69 |
*
|
70 |
* @return mixed
|
71 |
*/
|
72 |
+
public static function value( $new, $old, $post_id, $field ) {
|
73 |
+
foreach ( $new as $key => $value ) {
|
74 |
+
$old_value = isset( $old[ $key ] ) ? $old[ $key ] : null;
|
|
|
|
|
75 |
$value = RWMB_Field::call( $field, 'value', $value, $old_value, $post_id );
|
76 |
+
$new[ $key ] = RWMB_Field::filter( 'sanitize', $value, $field );
|
77 |
}
|
78 |
return $new;
|
79 |
}
|
80 |
|
81 |
/**
|
82 |
* Add clone button
|
83 |
+
*
|
84 |
* @param array $field Field parameter
|
85 |
* @return string $html
|
86 |
*/
|
87 |
+
public static function add_clone_button( $field ) {
|
88 |
+
if ( ! $field['clone'] ) {
|
|
|
|
|
89 |
return '';
|
90 |
}
|
91 |
$text = RWMB_Field::filter( 'add_clone_button_text', __( '+ Add more', 'meta-box' ), $field );
|
94 |
|
95 |
/**
|
96 |
* Remove clone button
|
97 |
+
*
|
98 |
* @param array $field Field parameter
|
99 |
* @return string $html
|
100 |
*/
|
101 |
+
public static function remove_clone_button( $field ) {
|
|
|
102 |
$text = RWMB_Field::filter( 'remove_clone_button_text', '<i class="dashicons dashicons-minus"></i>', $field );
|
103 |
return '<a href="#" class="rwmb-button remove-clone">' . $text . '</a>';
|
104 |
}
|
inc/core.php
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* The plugin core class which initialize plugin's code.
|
|
|
4 |
* @package Meta Box
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* The Meta Box core class.
|
|
|
9 |
* @package Meta Box
|
10 |
*/
|
11 |
-
class RWMB_Core
|
12 |
-
|
13 |
/**
|
14 |
* Stores all registered meta boxes
|
|
|
15 |
* @var array
|
16 |
*/
|
17 |
private static $meta_boxes = null;
|
@@ -19,13 +22,12 @@ class RWMB_Core
|
|
19 |
/**
|
20 |
* Register hooks.
|
21 |
*/
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
$plugin = 'meta-box/meta-box.php';
|
25 |
add_filter( "plugin_action_links_$plugin", array( $this, 'plugin_links' ) );
|
26 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
27 |
add_action( 'init', array( $this, 'register_meta_boxes' ) );
|
28 |
-
|
29 |
add_action( 'edit_page_form', array( $this, 'fix_page_template' ) );
|
30 |
}
|
31 |
|
@@ -36,8 +38,7 @@ class RWMB_Core
|
|
36 |
* @param array $links Array of action links
|
37 |
* @return array
|
38 |
*/
|
39 |
-
public function plugin_links( $links )
|
40 |
-
{
|
41 |
$links[] = '<a href="https://metabox.io/docs/">' . __( 'Documentation', 'meta-box' ) . '</a>';
|
42 |
$links[] = '<a href="https://metabox.io/plugins/">' . __( 'Extensions', 'meta-box' ) . '</a>';
|
43 |
return $links;
|
@@ -46,9 +47,8 @@ class RWMB_Core
|
|
46 |
/**
|
47 |
* Load plugin translation.
|
48 |
*/
|
49 |
-
public function load_textdomain()
|
50 |
-
|
51 |
-
load_plugin_textdomain( 'meta-box', false, plugin_basename( RWMB_DIR ) . '/lang/' );
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -57,11 +57,9 @@ class RWMB_Core
|
|
57 |
* - prevents incorrect hook.
|
58 |
* - no need to check for class existences.
|
59 |
*/
|
60 |
-
public function register_meta_boxes()
|
61 |
-
{
|
62 |
$meta_boxes = self::get_meta_boxes();
|
63 |
-
foreach ( $meta_boxes as $meta_box )
|
64 |
-
{
|
65 |
new RW_Meta_Box( $meta_box );
|
66 |
}
|
67 |
}
|
@@ -72,34 +70,32 @@ class RWMB_Core
|
|
72 |
* - prevents duplicated global variables.
|
73 |
* - allows users to remove/hide registered meta boxes.
|
74 |
*/
|
75 |
-
public static function get_meta_boxes()
|
76 |
-
|
77 |
-
if ( null === self::$meta_boxes )
|
78 |
-
{
|
79 |
self::$meta_boxes = apply_filters( 'rwmb_meta_boxes', array() );
|
80 |
self::$meta_boxes = empty( self::$meta_boxes ) || ! is_array( self::$meta_boxes ) ? array() : self::$meta_boxes;
|
81 |
}
|
82 |
return self::$meta_boxes;
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
|
104 |
/**
|
105 |
* WordPress will prevent post data saving if a page template has been selected that does not exist
|
@@ -109,24 +105,22 @@ class RWMB_Core
|
|
109 |
* @param WP_Post $post
|
110 |
* @since 4.3.10
|
111 |
*/
|
112 |
-
public function fix_page_template( WP_Post $post )
|
113 |
-
{
|
114 |
$template = get_post_meta( $post->ID, '_wp_page_template', true );
|
115 |
$page_templates = wp_get_theme()->get_page_templates();
|
116 |
|
117 |
// If the template doesn't exists, remove the data to allow WordPress to save
|
118 |
-
if ( ! isset( $page_templates[$template] ) )
|
119 |
-
{
|
120 |
delete_post_meta( $post->ID, '_wp_page_template' );
|
121 |
}
|
122 |
}
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
}
|
132 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
* The plugin core class which initialize plugin's code.
|
4 |
+
*
|
5 |
* @package Meta Box
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* The Meta Box core class.
|
10 |
+
*
|
11 |
* @package Meta Box
|
12 |
*/
|
13 |
+
class RWMB_Core {
|
14 |
+
|
15 |
/**
|
16 |
* Stores all registered meta boxes
|
17 |
+
*
|
18 |
* @var array
|
19 |
*/
|
20 |
private static $meta_boxes = null;
|
22 |
/**
|
23 |
* Register hooks.
|
24 |
*/
|
25 |
+
public function __construct() {
|
|
|
26 |
$plugin = 'meta-box/meta-box.php';
|
27 |
add_filter( "plugin_action_links_$plugin", array( $this, 'plugin_links' ) );
|
28 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
29 |
add_action( 'init', array( $this, 'register_meta_boxes' ) );
|
30 |
+
add_action( 'init', array( $this, 'register_wpml_hooks' ) );
|
31 |
add_action( 'edit_page_form', array( $this, 'fix_page_template' ) );
|
32 |
}
|
33 |
|
38 |
* @param array $links Array of action links
|
39 |
* @return array
|
40 |
*/
|
41 |
+
public function plugin_links( $links ) {
|
|
|
42 |
$links[] = '<a href="https://metabox.io/docs/">' . __( 'Documentation', 'meta-box' ) . '</a>';
|
43 |
$links[] = '<a href="https://metabox.io/plugins/">' . __( 'Extensions', 'meta-box' ) . '</a>';
|
44 |
return $links;
|
47 |
/**
|
48 |
* Load plugin translation.
|
49 |
*/
|
50 |
+
public function load_textdomain() {
|
51 |
+
load_plugin_textdomain( 'meta-box', false, plugin_basename( RWMB_DIR ) . '/languages/' );
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
57 |
* - prevents incorrect hook.
|
58 |
* - no need to check for class existences.
|
59 |
*/
|
60 |
+
public function register_meta_boxes() {
|
|
|
61 |
$meta_boxes = self::get_meta_boxes();
|
62 |
+
foreach ( $meta_boxes as $meta_box ) {
|
|
|
63 |
new RW_Meta_Box( $meta_box );
|
64 |
}
|
65 |
}
|
70 |
* - prevents duplicated global variables.
|
71 |
* - allows users to remove/hide registered meta boxes.
|
72 |
*/
|
73 |
+
public static function get_meta_boxes() {
|
74 |
+
if ( null === self::$meta_boxes ) {
|
|
|
|
|
75 |
self::$meta_boxes = apply_filters( 'rwmb_meta_boxes', array() );
|
76 |
self::$meta_boxes = empty( self::$meta_boxes ) || ! is_array( self::$meta_boxes ) ? array() : self::$meta_boxes;
|
77 |
}
|
78 |
return self::$meta_boxes;
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Get all registered fields.
|
83 |
+
*
|
84 |
+
* @return array
|
85 |
+
*/
|
86 |
+
public static function get_fields() {
|
87 |
+
$fields = array();
|
88 |
|
89 |
+
foreach ( self::$meta_boxes as $meta_box ) {
|
90 |
+
foreach ( $meta_box['fields'] as $field ) {
|
91 |
+
if ( ! empty( $field['id'] ) ) {
|
92 |
+
$fields[ $field['id'] ] = $field;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
|
97 |
+
return $fields;
|
98 |
+
}
|
99 |
|
100 |
/**
|
101 |
* WordPress will prevent post data saving if a page template has been selected that does not exist
|
105 |
* @param WP_Post $post
|
106 |
* @since 4.3.10
|
107 |
*/
|
108 |
+
public function fix_page_template( WP_Post $post ) {
|
|
|
109 |
$template = get_post_meta( $post->ID, '_wp_page_template', true );
|
110 |
$page_templates = wp_get_theme()->get_page_templates();
|
111 |
|
112 |
// If the template doesn't exists, remove the data to allow WordPress to save
|
113 |
+
if ( ! isset( $page_templates[ $template ] ) ) {
|
|
|
114 |
delete_post_meta( $post->ID, '_wp_page_template' );
|
115 |
}
|
116 |
}
|
117 |
|
118 |
+
/**
|
119 |
+
* Register wpml compatibility hooks
|
120 |
+
*/
|
121 |
+
public function register_wpml_hooks() {
|
122 |
+
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
123 |
+
new RWMB_WPML;
|
124 |
+
}
|
125 |
}
|
126 |
+
}
|
inc/field.php
CHANGED
@@ -4,20 +4,33 @@
|
|
4 |
* Base field class which defines all necessary methods.
|
5 |
* Fields must inherit this class and overwrite methods with its own.
|
6 |
*/
|
7 |
-
abstract class RWMB_Field
|
8 |
-
|
9 |
/**
|
10 |
* Add actions
|
11 |
*/
|
12 |
-
public static function add_actions()
|
13 |
-
{
|
14 |
}
|
15 |
|
16 |
/**
|
17 |
* Enqueue scripts and styles
|
18 |
*/
|
19 |
-
public static function admin_enqueue_scripts()
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
/**
|
@@ -29,8 +42,7 @@ abstract class RWMB_Field
|
|
29 |
* @param array $field
|
30 |
* @param bool $saved
|
31 |
*/
|
32 |
-
public static function show( $field, $saved )
|
33 |
-
{
|
34 |
$post = get_post();
|
35 |
$post_id = isset( $post->ID ) ? $post->ID : 0;
|
36 |
|
@@ -41,15 +53,11 @@ abstract class RWMB_Field
|
|
41 |
$begin = self::filter( 'begin_html', $begin, $field, $meta );
|
42 |
|
43 |
// Separate code for cloneable and non-cloneable fields to make easy to maintain
|
44 |
-
|
45 |
// Cloneable fields
|
46 |
-
if ( $field['clone'] )
|
47 |
-
{
|
48 |
$field_html = RWMB_Clone::html( $meta, $field );
|
49 |
-
}
|
50 |
-
|
51 |
-
else
|
52 |
-
{
|
53 |
// Call separated methods for displaying each type of field
|
54 |
$field_html = self::call( $field, 'html', $meta );
|
55 |
$field_html = self::filter( 'html', $field_html, $field, $meta );
|
@@ -62,10 +70,12 @@ abstract class RWMB_Field
|
|
62 |
|
63 |
// Display label and input in DIV and allow user-defined classes to be appended
|
64 |
$classes = "rwmb-field rwmb-{$field['type']}-wrapper " . $field['class'];
|
65 |
-
if ( 'hidden' === $field['type'] )
|
66 |
$classes .= ' hidden';
|
67 |
-
|
|
|
68 |
$classes .= ' required';
|
|
|
69 |
|
70 |
$outer_html = sprintf(
|
71 |
$field['before'] . '<div class="%s">%s</div>' . $field['after'],
|
@@ -85,8 +95,7 @@ abstract class RWMB_Field
|
|
85 |
*
|
86 |
* @return string
|
87 |
*/
|
88 |
-
public static function html( $meta, $field )
|
89 |
-
{
|
90 |
return '';
|
91 |
}
|
92 |
|
@@ -98,11 +107,9 @@ abstract class RWMB_Field
|
|
98 |
*
|
99 |
* @return string
|
100 |
*/
|
101 |
-
public static function begin_html( $meta, $field )
|
102 |
-
{
|
103 |
$field_label = '';
|
104 |
-
if ( $field['name'] )
|
105 |
-
{
|
106 |
$field_label = sprintf(
|
107 |
'<div class="rwmb-label"><label for="%s">%s</label></div>',
|
108 |
$field['id'],
|
@@ -128,22 +135,38 @@ abstract class RWMB_Field
|
|
128 |
*
|
129 |
* @return string
|
130 |
*/
|
131 |
-
public static function end_html( $meta, $field )
|
132 |
-
{
|
133 |
return RWMB_Clone::add_clone_button( $field ) . self::call( 'element_description', $field ) . '</div>';
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
* Display field description.
|
|
|
138 |
* @param array $field
|
139 |
* @return string
|
140 |
*/
|
141 |
-
protected static function element_description( $field )
|
142 |
-
{
|
143 |
$id = $field['id'] ? " id='{$field['id']}-description'" : '';
|
144 |
return $field['desc'] ? "<p{$id} class='description'>{$field['desc']}</p>" : '';
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
/**
|
148 |
* Get meta value
|
149 |
*
|
@@ -153,17 +176,17 @@ abstract class RWMB_Field
|
|
153 |
*
|
154 |
* @return mixed
|
155 |
*/
|
156 |
-
public static function meta( $post_id, $saved, $field )
|
157 |
-
{
|
158 |
/**
|
159 |
* For special fields like 'divider', 'heading' which don't have ID, just return empty string
|
160 |
* to prevent notice error when displaying fields
|
161 |
*/
|
162 |
-
if ( empty( $field['id'] ) )
|
163 |
return '';
|
|
|
164 |
|
165 |
-
|
166 |
-
$meta
|
167 |
|
168 |
// Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
|
169 |
$meta = ! $saved ? $field['std'] : $meta;
|
@@ -172,13 +195,12 @@ abstract class RWMB_Field
|
|
172 |
$meta = self::call( $field, 'esc_meta', $meta );
|
173 |
|
174 |
// Make sure meta value is an array for clonable and multiple fields
|
175 |
-
if ( $field['clone'] || $field['multiple'] )
|
176 |
-
|
177 |
-
if ( empty( $meta ) || ! is_array( $meta ) )
|
178 |
-
{
|
179 |
/**
|
180 |
* Note: if field is clonable, $meta must be an array with values
|
181 |
* so that the foreach loop in self::show() runs properly
|
|
|
182 |
* @see self::show()
|
183 |
*/
|
184 |
$meta = $field['clone'] ? array( '' ) : array();
|
@@ -195,8 +217,7 @@ abstract class RWMB_Field
|
|
195 |
*
|
196 |
* @return mixed
|
197 |
*/
|
198 |
-
public static function esc_meta( $meta )
|
199 |
-
{
|
200 |
return is_array( $meta ) ? array_map( __METHOD__, $meta ) : esc_attr( $meta );
|
201 |
}
|
202 |
|
@@ -210,8 +231,7 @@ abstract class RWMB_Field
|
|
210 |
*
|
211 |
* @return int
|
212 |
*/
|
213 |
-
public static function value( $new, $old, $post_id, $field )
|
214 |
-
{
|
215 |
return $new;
|
216 |
}
|
217 |
|
@@ -223,26 +243,23 @@ abstract class RWMB_Field
|
|
223 |
* @param $post_id
|
224 |
* @param $field
|
225 |
*/
|
226 |
-
public static function save( $new, $old, $post_id, $field )
|
227 |
-
{
|
228 |
$name = $field['id'];
|
229 |
|
230 |
// Remove post meta if it's empty
|
231 |
-
if ( '' === $new || array() === $new )
|
232 |
-
{
|
233 |
delete_post_meta( $post_id, $name );
|
234 |
return;
|
235 |
}
|
236 |
|
237 |
// If field is cloneable, value is saved as a single entry in the database
|
238 |
-
if ( $field['clone'] )
|
239 |
-
{
|
240 |
// Remove empty values
|
241 |
$new = (array) $new;
|
242 |
-
foreach ( $new as $k => $v )
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
}
|
247 |
// Reset indexes
|
248 |
$new = array_values( $new );
|
@@ -251,16 +268,13 @@ abstract class RWMB_Field
|
|
251 |
}
|
252 |
|
253 |
// If field is multiple, value is saved as multiple entries in the database (WordPress behaviour)
|
254 |
-
if ( $field['multiple'] )
|
255 |
-
{
|
256 |
$new_values = array_diff( $new, $old );
|
257 |
-
foreach ( $new_values as $new_value )
|
258 |
-
{
|
259 |
add_post_meta( $post_id, $name, $new_value, false );
|
260 |
}
|
261 |
$old_values = array_diff( $old, $new );
|
262 |
-
foreach ( $old_values as $old_value )
|
263 |
-
{
|
264 |
delete_post_meta( $post_id, $name, $old_value );
|
265 |
}
|
266 |
return;
|
@@ -277,8 +291,7 @@ abstract class RWMB_Field
|
|
277 |
*
|
278 |
* @return array
|
279 |
*/
|
280 |
-
public static function normalize( $field )
|
281 |
-
{
|
282 |
$field = wp_parse_args( $field, array(
|
283 |
'id' => '',
|
284 |
'name' => '',
|
@@ -312,16 +325,17 @@ abstract class RWMB_Field
|
|
312 |
*
|
313 |
* @return array
|
314 |
*/
|
315 |
-
public static function get_attributes( $field, $value = null )
|
316 |
-
{
|
317 |
$attributes = wp_parse_args( $field['attributes'], array(
|
318 |
'disabled' => $field['disabled'],
|
319 |
'required' => $field['required'],
|
320 |
-
'class' => "rwmb-{$field['type']}",
|
321 |
'id' => $field['id'],
|
|
|
322 |
'name' => $field['field_name'],
|
323 |
) );
|
324 |
|
|
|
|
|
325 |
return $attributes;
|
326 |
}
|
327 |
|
@@ -332,17 +346,17 @@ abstract class RWMB_Field
|
|
332 |
*
|
333 |
* @return string
|
334 |
*/
|
335 |
-
public static function render_attributes( $attributes )
|
336 |
-
{
|
337 |
$output = '';
|
338 |
|
339 |
-
foreach ( $attributes as $key => $value )
|
340 |
-
|
341 |
-
if ( false === $value || '' === $value )
|
342 |
continue;
|
|
|
343 |
|
344 |
-
if ( is_array( $value ) )
|
345 |
$value = json_encode( $value );
|
|
|
346 |
|
347 |
$output .= sprintf( true === $value ? ' %s' : ' %s="%s"', $key, esc_attr( $value ) );
|
348 |
}
|
@@ -365,24 +379,21 @@ abstract class RWMB_Field
|
|
365 |
*
|
366 |
* @return mixed Field value
|
367 |
*/
|
368 |
-
public static function get_value( $field, $args = array(), $post_id = null )
|
369 |
-
{
|
370 |
// Some fields does not have ID like heading, custom HTML, etc.
|
371 |
-
if ( empty( $field['id'] ) )
|
372 |
-
{
|
373 |
return '';
|
374 |
}
|
375 |
|
376 |
-
if ( ! $post_id )
|
377 |
$post_id = get_the_ID();
|
|
|
378 |
|
379 |
// Get raw meta value in the database, no escape
|
380 |
-
$
|
381 |
-
$value = get_post_meta( $post_id, $field['id'], $single );
|
382 |
|
383 |
// Make sure meta value is an array for cloneable and multiple fields
|
384 |
-
if ( $field['clone'] || $field['multiple'] )
|
385 |
-
{
|
386 |
$value = is_array( $value ) && $value ? $value : array();
|
387 |
}
|
388 |
|
@@ -406,27 +417,24 @@ abstract class RWMB_Field
|
|
406 |
*
|
407 |
* @return string HTML output of the field
|
408 |
*/
|
409 |
-
public static function the_value( $field, $args = array(), $post_id = null )
|
410 |
-
{
|
411 |
$value = self::call( 'get_value', $field, $args, $post_id );
|
412 |
return self::call( 'format_value', $field, $value );
|
413 |
}
|
414 |
|
415 |
/**
|
416 |
* Format value for the helper functions.
|
|
|
417 |
* @param array $field Field parameter
|
418 |
* @param string|array $value The field meta value
|
419 |
* @return string
|
420 |
*/
|
421 |
-
public static function format_value( $field, $value )
|
422 |
-
|
423 |
-
if ( ! is_array( $value ) )
|
424 |
-
{
|
425 |
return self::call( 'format_single_value', $field, $value );
|
426 |
}
|
427 |
$output = '<ul>';
|
428 |
-
foreach ( $value as $subvalue )
|
429 |
-
{
|
430 |
$output .= '<li>' . self::call( 'format_value', $field, $subvalue ) . '</li>';
|
431 |
}
|
432 |
$output .= '</ul>';
|
@@ -435,35 +443,32 @@ abstract class RWMB_Field
|
|
435 |
|
436 |
/**
|
437 |
* Format a single value for the helper functions. Sub-fields should overwrite this method if necessary.
|
|
|
438 |
* @param array $field Field parameter
|
439 |
* @param string $value The value
|
440 |
* @return string
|
441 |
*/
|
442 |
-
public static function format_single_value( $field, $value )
|
443 |
-
{
|
444 |
return $value;
|
445 |
}
|
446 |
|
447 |
/**
|
448 |
* Call a method of a field.
|
449 |
* This should be replaced by static::$method( $args ) in PHP 5.3.
|
|
|
450 |
* @return mixed
|
451 |
*/
|
452 |
-
public static function call()
|
453 |
-
{
|
454 |
$args = func_get_args();
|
455 |
|
456 |
$check = reset( $args );
|
457 |
|
458 |
// Params: method name, field, other params.
|
459 |
-
if ( is_string( $check ) )
|
460 |
-
{
|
461 |
$method = array_shift( $args );
|
462 |
$field = reset( $args ); // Keep field as 1st param
|
463 |
-
}
|
464 |
-
|
465 |
-
else
|
466 |
-
{
|
467 |
$field = array_shift( $args );
|
468 |
$method = array_shift( $args );
|
469 |
$args[] = $field; // Add field as last param
|
@@ -478,15 +483,12 @@ abstract class RWMB_Field
|
|
478 |
* @param array $field Field array
|
479 |
* @return string Field class name
|
480 |
*/
|
481 |
-
public static function get_class_name( $field )
|
482 |
-
{
|
483 |
$type = $field['type'];
|
484 |
-
if ( 'file_advanced' == $field['type'] )
|
485 |
-
{
|
486 |
$type = 'media';
|
487 |
}
|
488 |
-
if ( 'plupload_image' == $field['type'] )
|
489 |
-
{
|
490 |
$type = 'image_upload';
|
491 |
}
|
492 |
$type = str_replace( array( '-', '_' ), ' ', $type );
|
@@ -501,10 +503,10 @@ abstract class RWMB_Field
|
|
501 |
* - rwmb_{$name}
|
502 |
* - rwmb_{$field['type']}_{$name}
|
503 |
* - rwmb_{$field['id']}_{$name}
|
|
|
504 |
* @return mixed
|
505 |
*/
|
506 |
-
public static function filter()
|
507 |
-
{
|
508 |
$args = func_get_args();
|
509 |
|
510 |
// 3 first params must be: filter name, value, field. Other params will be used for filters.
|
@@ -517,15 +519,13 @@ abstract class RWMB_Field
|
|
517 |
'rwmb_' . $name,
|
518 |
'rwmb_' . $field['type'] . '_' . $name,
|
519 |
);
|
520 |
-
if ( isset( $field['id'] ) )
|
521 |
-
{
|
522 |
$filters[] = 'rwmb_' . $field['id'] . '_' . $name;
|
523 |
}
|
524 |
|
525 |
// Filter params: value, field, other params. Note: value is changed after each run.
|
526 |
array_unshift( $args, $field );
|
527 |
-
foreach ( $filters as $filter )
|
528 |
-
{
|
529 |
$filter_args = $args;
|
530 |
array_unshift( $filter_args, $value );
|
531 |
$value = apply_filters_ref_array( $filter, $filter_args );
|
4 |
* Base field class which defines all necessary methods.
|
5 |
* Fields must inherit this class and overwrite methods with its own.
|
6 |
*/
|
7 |
+
abstract class RWMB_Field {
|
8 |
+
|
9 |
/**
|
10 |
* Add actions
|
11 |
*/
|
12 |
+
public static function add_actions() {
|
|
|
13 |
}
|
14 |
|
15 |
/**
|
16 |
* Enqueue scripts and styles
|
17 |
*/
|
18 |
+
public static function admin_enqueue_scripts() {
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* ELocalize scripts
|
23 |
+
*/
|
24 |
+
public static function localize_script( $handle, $name, $data ) {
|
25 |
+
/**
|
26 |
+
* Prevent loading localized string twice.
|
27 |
+
*
|
28 |
+
* @link https://github.com/rilwis/meta-box/issues/850
|
29 |
+
*/
|
30 |
+
$wp_scripts = wp_scripts();
|
31 |
+
if ( ! $wp_scripts->get_data( $handle, 'data' ) ) {
|
32 |
+
wp_localize_script( $handle, $name, $data );
|
33 |
+
}
|
34 |
}
|
35 |
|
36 |
/**
|
42 |
* @param array $field
|
43 |
* @param bool $saved
|
44 |
*/
|
45 |
+
public static function show( $field, $saved ) {
|
|
|
46 |
$post = get_post();
|
47 |
$post_id = isset( $post->ID ) ? $post->ID : 0;
|
48 |
|
53 |
$begin = self::filter( 'begin_html', $begin, $field, $meta );
|
54 |
|
55 |
// Separate code for cloneable and non-cloneable fields to make easy to maintain
|
|
|
56 |
// Cloneable fields
|
57 |
+
if ( $field['clone'] ) {
|
|
|
58 |
$field_html = RWMB_Clone::html( $meta, $field );
|
59 |
+
} // End if().
|
60 |
+
else {
|
|
|
|
|
61 |
// Call separated methods for displaying each type of field
|
62 |
$field_html = self::call( $field, 'html', $meta );
|
63 |
$field_html = self::filter( 'html', $field_html, $field, $meta );
|
70 |
|
71 |
// Display label and input in DIV and allow user-defined classes to be appended
|
72 |
$classes = "rwmb-field rwmb-{$field['type']}-wrapper " . $field['class'];
|
73 |
+
if ( 'hidden' === $field['type'] ) {
|
74 |
$classes .= ' hidden';
|
75 |
+
}
|
76 |
+
if ( ! empty( $field['required'] ) ) {
|
77 |
$classes .= ' required';
|
78 |
+
}
|
79 |
|
80 |
$outer_html = sprintf(
|
81 |
$field['before'] . '<div class="%s">%s</div>' . $field['after'],
|
95 |
*
|
96 |
* @return string
|
97 |
*/
|
98 |
+
public static function html( $meta, $field ) {
|
|
|
99 |
return '';
|
100 |
}
|
101 |
|
107 |
*
|
108 |
* @return string
|
109 |
*/
|
110 |
+
public static function begin_html( $meta, $field ) {
|
|
|
111 |
$field_label = '';
|
112 |
+
if ( $field['name'] ) {
|
|
|
113 |
$field_label = sprintf(
|
114 |
'<div class="rwmb-label"><label for="%s">%s</label></div>',
|
115 |
$field['id'],
|
135 |
*
|
136 |
* @return string
|
137 |
*/
|
138 |
+
public static function end_html( $meta, $field ) {
|
|
|
139 |
return RWMB_Clone::add_clone_button( $field ) . self::call( 'element_description', $field ) . '</div>';
|
140 |
}
|
141 |
|
142 |
/**
|
143 |
* Display field description.
|
144 |
+
*
|
145 |
* @param array $field
|
146 |
* @return string
|
147 |
*/
|
148 |
+
protected static function element_description( $field ) {
|
|
|
149 |
$id = $field['id'] ? " id='{$field['id']}-description'" : '';
|
150 |
return $field['desc'] ? "<p{$id} class='description'>{$field['desc']}</p>" : '';
|
151 |
}
|
152 |
|
153 |
+
/**
|
154 |
+
* Get raw meta value
|
155 |
+
*
|
156 |
+
* @param int $post_id
|
157 |
+
* @param array $field
|
158 |
+
*
|
159 |
+
* @return mixed
|
160 |
+
*/
|
161 |
+
public static function raw_meta( $post_id, $field ) {
|
162 |
+
if ( empty( $field['id'] ) ) {
|
163 |
+
return '';
|
164 |
+
}
|
165 |
+
|
166 |
+
$single = $field['clone'] || ! $field['multiple'];
|
167 |
+
return get_post_meta( $post_id, $field['id'], $single );
|
168 |
+
}
|
169 |
+
|
170 |
/**
|
171 |
* Get meta value
|
172 |
*
|
176 |
*
|
177 |
* @return mixed
|
178 |
*/
|
179 |
+
public static function meta( $post_id, $saved, $field ) {
|
|
|
180 |
/**
|
181 |
* For special fields like 'divider', 'heading' which don't have ID, just return empty string
|
182 |
* to prevent notice error when displaying fields
|
183 |
*/
|
184 |
+
if ( empty( $field['id'] ) ) {
|
185 |
return '';
|
186 |
+
}
|
187 |
|
188 |
+
// Get raw meta
|
189 |
+
$meta = self::call( $field, 'raw_meta', $post_id );
|
190 |
|
191 |
// Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
|
192 |
$meta = ! $saved ? $field['std'] : $meta;
|
195 |
$meta = self::call( $field, 'esc_meta', $meta );
|
196 |
|
197 |
// Make sure meta value is an array for clonable and multiple fields
|
198 |
+
if ( $field['clone'] || $field['multiple'] ) {
|
199 |
+
if ( empty( $meta ) || ! is_array( $meta ) ) {
|
|
|
|
|
200 |
/**
|
201 |
* Note: if field is clonable, $meta must be an array with values
|
202 |
* so that the foreach loop in self::show() runs properly
|
203 |
+
*
|
204 |
* @see self::show()
|
205 |
*/
|
206 |
$meta = $field['clone'] ? array( '' ) : array();
|
217 |
*
|
218 |
* @return mixed
|
219 |
*/
|
220 |
+
public static function esc_meta( $meta ) {
|
|
|
221 |
return is_array( $meta ) ? array_map( __METHOD__, $meta ) : esc_attr( $meta );
|
222 |
}
|
223 |
|
231 |
*
|
232 |
* @return int
|
233 |
*/
|
234 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
235 |
return $new;
|
236 |
}
|
237 |
|
243 |
* @param $post_id
|
244 |
* @param $field
|
245 |
*/
|
246 |
+
public static function save( $new, $old, $post_id, $field ) {
|
|
|
247 |
$name = $field['id'];
|
248 |
|
249 |
// Remove post meta if it's empty
|
250 |
+
if ( '' === $new || array() === $new ) {
|
|
|
251 |
delete_post_meta( $post_id, $name );
|
252 |
return;
|
253 |
}
|
254 |
|
255 |
// If field is cloneable, value is saved as a single entry in the database
|
256 |
+
if ( $field['clone'] ) {
|
|
|
257 |
// Remove empty values
|
258 |
$new = (array) $new;
|
259 |
+
foreach ( $new as $k => $v ) {
|
260 |
+
if ( '' === $v || array() === $v ) {
|
261 |
+
unset( $new[ $k ] );
|
262 |
+
}
|
263 |
}
|
264 |
// Reset indexes
|
265 |
$new = array_values( $new );
|
268 |
}
|
269 |
|
270 |
// If field is multiple, value is saved as multiple entries in the database (WordPress behaviour)
|
271 |
+
if ( $field['multiple'] ) {
|
|
|
272 |
$new_values = array_diff( $new, $old );
|
273 |
+
foreach ( $new_values as $new_value ) {
|
|
|
274 |
add_post_meta( $post_id, $name, $new_value, false );
|
275 |
}
|
276 |
$old_values = array_diff( $old, $new );
|
277 |
+
foreach ( $old_values as $old_value ) {
|
|
|
278 |
delete_post_meta( $post_id, $name, $old_value );
|
279 |
}
|
280 |
return;
|
291 |
*
|
292 |
* @return array
|
293 |
*/
|
294 |
+
public static function normalize( $field ) {
|
|
|
295 |
$field = wp_parse_args( $field, array(
|
296 |
'id' => '',
|
297 |
'name' => '',
|
325 |
*
|
326 |
* @return array
|
327 |
*/
|
328 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
329 |
$attributes = wp_parse_args( $field['attributes'], array(
|
330 |
'disabled' => $field['disabled'],
|
331 |
'required' => $field['required'],
|
|
|
332 |
'id' => $field['id'],
|
333 |
+
'class' => '',
|
334 |
'name' => $field['field_name'],
|
335 |
) );
|
336 |
|
337 |
+
$attributes['class'] = implode( ' ', array_merge( array( "rwmb-{$field['type']}" ), (array) $attributes['class'] ) );
|
338 |
+
|
339 |
return $attributes;
|
340 |
}
|
341 |
|
346 |
*
|
347 |
* @return string
|
348 |
*/
|
349 |
+
public static function render_attributes( $attributes ) {
|
|
|
350 |
$output = '';
|
351 |
|
352 |
+
foreach ( $attributes as $key => $value ) {
|
353 |
+
if ( false === $value || '' === $value ) {
|
|
|
354 |
continue;
|
355 |
+
}
|
356 |
|
357 |
+
if ( is_array( $value ) ) {
|
358 |
$value = json_encode( $value );
|
359 |
+
}
|
360 |
|
361 |
$output .= sprintf( true === $value ? ' %s' : ' %s="%s"', $key, esc_attr( $value ) );
|
362 |
}
|
379 |
*
|
380 |
* @return mixed Field value
|
381 |
*/
|
382 |
+
public static function get_value( $field, $args = array(), $post_id = null ) {
|
|
|
383 |
// Some fields does not have ID like heading, custom HTML, etc.
|
384 |
+
if ( empty( $field['id'] ) ) {
|
|
|
385 |
return '';
|
386 |
}
|
387 |
|
388 |
+
if ( ! $post_id ) {
|
389 |
$post_id = get_the_ID();
|
390 |
+
}
|
391 |
|
392 |
// Get raw meta value in the database, no escape
|
393 |
+
$value = RWMB_Field::call( $field, 'raw_meta', $post_id );
|
|
|
394 |
|
395 |
// Make sure meta value is an array for cloneable and multiple fields
|
396 |
+
if ( $field['clone'] || $field['multiple'] ) {
|
|
|
397 |
$value = is_array( $value ) && $value ? $value : array();
|
398 |
}
|
399 |
|
417 |
*
|
418 |
* @return string HTML output of the field
|
419 |
*/
|
420 |
+
public static function the_value( $field, $args = array(), $post_id = null ) {
|
|
|
421 |
$value = self::call( 'get_value', $field, $args, $post_id );
|
422 |
return self::call( 'format_value', $field, $value );
|
423 |
}
|
424 |
|
425 |
/**
|
426 |
* Format value for the helper functions.
|
427 |
+
*
|
428 |
* @param array $field Field parameter
|
429 |
* @param string|array $value The field meta value
|
430 |
* @return string
|
431 |
*/
|
432 |
+
public static function format_value( $field, $value ) {
|
433 |
+
if ( ! is_array( $value ) ) {
|
|
|
|
|
434 |
return self::call( 'format_single_value', $field, $value );
|
435 |
}
|
436 |
$output = '<ul>';
|
437 |
+
foreach ( $value as $subvalue ) {
|
|
|
438 |
$output .= '<li>' . self::call( 'format_value', $field, $subvalue ) . '</li>';
|
439 |
}
|
440 |
$output .= '</ul>';
|
443 |
|
444 |
/**
|
445 |
* Format a single value for the helper functions. Sub-fields should overwrite this method if necessary.
|
446 |
+
*
|
447 |
* @param array $field Field parameter
|
448 |
* @param string $value The value
|
449 |
* @return string
|
450 |
*/
|
451 |
+
public static function format_single_value( $field, $value ) {
|
|
|
452 |
return $value;
|
453 |
}
|
454 |
|
455 |
/**
|
456 |
* Call a method of a field.
|
457 |
* This should be replaced by static::$method( $args ) in PHP 5.3.
|
458 |
+
*
|
459 |
* @return mixed
|
460 |
*/
|
461 |
+
public static function call() {
|
|
|
462 |
$args = func_get_args();
|
463 |
|
464 |
$check = reset( $args );
|
465 |
|
466 |
// Params: method name, field, other params.
|
467 |
+
if ( is_string( $check ) ) {
|
|
|
468 |
$method = array_shift( $args );
|
469 |
$field = reset( $args ); // Keep field as 1st param
|
470 |
+
} // End if().
|
471 |
+
else {
|
|
|
|
|
472 |
$field = array_shift( $args );
|
473 |
$method = array_shift( $args );
|
474 |
$args[] = $field; // Add field as last param
|
483 |
* @param array $field Field array
|
484 |
* @return string Field class name
|
485 |
*/
|
486 |
+
public static function get_class_name( $field ) {
|
|
|
487 |
$type = $field['type'];
|
488 |
+
if ( 'file_advanced' == $field['type'] ) {
|
|
|
489 |
$type = 'media';
|
490 |
}
|
491 |
+
if ( 'plupload_image' == $field['type'] ) {
|
|
|
492 |
$type = 'image_upload';
|
493 |
}
|
494 |
$type = str_replace( array( '-', '_' ), ' ', $type );
|
503 |
* - rwmb_{$name}
|
504 |
* - rwmb_{$field['type']}_{$name}
|
505 |
* - rwmb_{$field['id']}_{$name}
|
506 |
+
*
|
507 |
* @return mixed
|
508 |
*/
|
509 |
+
public static function filter() {
|
|
|
510 |
$args = func_get_args();
|
511 |
|
512 |
// 3 first params must be: filter name, value, field. Other params will be used for filters.
|
519 |
'rwmb_' . $name,
|
520 |
'rwmb_' . $field['type'] . '_' . $name,
|
521 |
);
|
522 |
+
if ( isset( $field['id'] ) ) {
|
|
|
523 |
$filters[] = 'rwmb_' . $field['id'] . '_' . $name;
|
524 |
}
|
525 |
|
526 |
// Filter params: value, field, other params. Note: value is changed after each run.
|
527 |
array_unshift( $args, $field );
|
528 |
+
foreach ( $filters as $filter ) {
|
|
|
529 |
$filter_args = $args;
|
530 |
array_unshift( $filter_args, $value );
|
531 |
$value = apply_filters_ref_array( $filter, $filter_args );
|
inc/fields/autocomplete.php
CHANGED
@@ -3,25 +3,17 @@
|
|
3 |
/**
|
4 |
* Autocomplete field class.
|
5 |
*/
|
6 |
-
class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
-
static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-autocomplete', RWMB_CSS_URL . 'autocomplete.css', array( 'wp-admin' ), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-autocomplete', RWMB_JS_URL . 'autocomplete.js', array( 'jquery-ui-autocomplete' ), RWMB_VER, true );
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
* @link https://github.com/rilwis/meta-box/issues/850
|
19 |
-
*/
|
20 |
-
$wp_scripts = wp_scripts();
|
21 |
-
if ( ! $wp_scripts->get_data( 'rwmb-autocomplete', 'data' ) )
|
22 |
-
{
|
23 |
-
wp_localize_script( 'rwmb-autocomplete', 'RWMB_Autocomplete', array( 'delete' => __( 'Delete', 'meta-box' ) ) );
|
24 |
-
}
|
25 |
}
|
26 |
|
27 |
/**
|
@@ -31,19 +23,17 @@ class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field
|
|
31 |
* @param array $field
|
32 |
* @return string
|
33 |
*/
|
34 |
-
static function html( $meta, $field )
|
35 |
-
|
36 |
-
if ( ! is_array( $meta ) )
|
37 |
$meta = array( $meta );
|
|
|
38 |
|
39 |
$field = apply_filters( 'rwmb_autocomplete_field', $field, $meta );
|
40 |
$options = $field['options'];
|
41 |
|
42 |
-
if ( ! is_string( $field['options'] ) )
|
43 |
-
{
|
44 |
$options = array();
|
45 |
-
foreach ( (array) $field['options'] as $value => $label )
|
46 |
-
{
|
47 |
$options[] = array(
|
48 |
'value' => $value,
|
49 |
'label' => $label,
|
@@ -75,12 +65,9 @@ class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field
|
|
75 |
</div>
|
76 |
';
|
77 |
|
78 |
-
if ( is_array( $field['options'] ) )
|
79 |
-
|
80 |
-
|
81 |
-
{
|
82 |
-
if ( in_array( $value, $meta ) )
|
83 |
-
{
|
84 |
$html .= sprintf(
|
85 |
$tpl,
|
86 |
$label,
|
@@ -90,13 +77,11 @@ class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field
|
|
90 |
);
|
91 |
}
|
92 |
}
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
foreach ( $meta as $value )
|
97 |
-
{
|
98 |
-
if ( empty( $value ) )
|
99 |
continue;
|
|
|
100 |
$label = apply_filters( 'rwmb_autocomplete_result_label', $value, $field );
|
101 |
$html .= sprintf(
|
102 |
$tpl,
|
@@ -119,8 +104,7 @@ class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field
|
|
119 |
* @param array $field
|
120 |
* @return array
|
121 |
*/
|
122 |
-
static function normalize( $field )
|
123 |
-
{
|
124 |
$field = parent::normalize( $field );
|
125 |
$field = wp_parse_args( $field, array(
|
126 |
'size' => 30,
|
3 |
/**
|
4 |
* Autocomplete field class.
|
5 |
*/
|
6 |
+
class RWMB_Autocomplete_Field extends RWMB_Multiple_Values_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
+
static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-autocomplete', RWMB_CSS_URL . 'autocomplete.css', array( 'wp-admin' ), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-autocomplete', RWMB_JS_URL . 'autocomplete.js', array( 'jquery-ui-autocomplete' ), RWMB_VER, true );
|
14 |
|
15 |
+
self::localize_script( 'rwmb-autocomplete', 'RWMB_Autocomplete', array( 'delete' => __( 'Delete', 'meta-box' ) ) );
|
16 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
/**
|
23 |
* @param array $field
|
24 |
* @return string
|
25 |
*/
|
26 |
+
static function html( $meta, $field ) {
|
27 |
+
if ( ! is_array( $meta ) ) {
|
|
|
28 |
$meta = array( $meta );
|
29 |
+
}
|
30 |
|
31 |
$field = apply_filters( 'rwmb_autocomplete_field', $field, $meta );
|
32 |
$options = $field['options'];
|
33 |
|
34 |
+
if ( ! is_string( $field['options'] ) ) {
|
|
|
35 |
$options = array();
|
36 |
+
foreach ( (array) $field['options'] as $value => $label ) {
|
|
|
37 |
$options[] = array(
|
38 |
'value' => $value,
|
39 |
'label' => $label,
|
65 |
</div>
|
66 |
';
|
67 |
|
68 |
+
if ( is_array( $field['options'] ) ) {
|
69 |
+
foreach ( $field['options'] as $value => $label ) {
|
70 |
+
if ( in_array( $value, $meta ) ) {
|
|
|
|
|
|
|
71 |
$html .= sprintf(
|
72 |
$tpl,
|
73 |
$label,
|
77 |
);
|
78 |
}
|
79 |
}
|
80 |
+
} else {
|
81 |
+
foreach ( $meta as $value ) {
|
82 |
+
if ( empty( $value ) ) {
|
|
|
|
|
|
|
83 |
continue;
|
84 |
+
}
|
85 |
$label = apply_filters( 'rwmb_autocomplete_result_label', $value, $field );
|
86 |
$html .= sprintf(
|
87 |
$tpl,
|
104 |
* @param array $field
|
105 |
* @return array
|
106 |
*/
|
107 |
+
static function normalize( $field ) {
|
|
|
108 |
$field = parent::normalize( $field );
|
109 |
$field = wp_parse_args( $field, array(
|
110 |
'size' => 30,
|
inc/fields/button.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Button field class.
|
4 |
*/
|
5 |
-
class RWMB_Button_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
@@ -11,8 +11,7 @@ class RWMB_Button_Field extends RWMB_Field
|
|
11 |
* @param array $field
|
12 |
* @return string
|
13 |
*/
|
14 |
-
static function html( $meta, $field )
|
15 |
-
{
|
16 |
$attributes = self::get_attributes( $field );
|
17 |
return sprintf( '<a href="#" %s>%s</a>', self::render_attributes( $attributes ), $field['std'] );
|
18 |
}
|
@@ -23,8 +22,7 @@ class RWMB_Button_Field extends RWMB_Field
|
|
23 |
* @param array $field
|
24 |
* @return array
|
25 |
*/
|
26 |
-
static function normalize( $field )
|
27 |
-
{
|
28 |
$field = parent::normalize( $field );
|
29 |
$field['std'] = $field['std'] ? $field['std'] : __( 'Click me', 'meta-box' );
|
30 |
return $field;
|
@@ -37,8 +35,7 @@ class RWMB_Button_Field extends RWMB_Field
|
|
37 |
* @param mixed $value
|
38 |
* @return array
|
39 |
*/
|
40 |
-
static function get_attributes( $field, $value = null )
|
41 |
-
{
|
42 |
$attributes = parent::get_attributes( $field, $value );
|
43 |
$attributes['class'] .= ' button hide-if-no-js';
|
44 |
|
2 |
/**
|
3 |
* Button field class.
|
4 |
*/
|
5 |
+
class RWMB_Button_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
11 |
* @param array $field
|
12 |
* @return string
|
13 |
*/
|
14 |
+
static function html( $meta, $field ) {
|
|
|
15 |
$attributes = self::get_attributes( $field );
|
16 |
return sprintf( '<a href="#" %s>%s</a>', self::render_attributes( $attributes ), $field['std'] );
|
17 |
}
|
22 |
* @param array $field
|
23 |
* @return array
|
24 |
*/
|
25 |
+
static function normalize( $field ) {
|
|
|
26 |
$field = parent::normalize( $field );
|
27 |
$field['std'] = $field['std'] ? $field['std'] : __( 'Click me', 'meta-box' );
|
28 |
return $field;
|
35 |
* @param mixed $value
|
36 |
* @return array
|
37 |
*/
|
38 |
+
static function get_attributes( $field, $value = null ) {
|
|
|
39 |
$attributes = parent::get_attributes( $field, $value );
|
40 |
$attributes['class'] .= ' button hide-if-no-js';
|
41 |
|
inc/fields/checkbox-list.php
CHANGED
@@ -2,17 +2,17 @@
|
|
2 |
/**
|
3 |
* Checkbox list field class.
|
4 |
*/
|
5 |
-
class RWMB_Checkbox_List_Field extends RWMB_Input_List_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
|
|
9 |
* @param array $field
|
10 |
* @return array
|
11 |
*/
|
12 |
-
static function normalize( $field )
|
13 |
-
{
|
14 |
$field['multiple'] = true;
|
15 |
-
$field = parent::normalize( $field );
|
16 |
|
17 |
return $field;
|
18 |
}
|
2 |
/**
|
3 |
* Checkbox list field class.
|
4 |
*/
|
5 |
+
class RWMB_Checkbox_List_Field extends RWMB_Input_List_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
+
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
+
static function normalize( $field ) {
|
|
|
14 |
$field['multiple'] = true;
|
15 |
+
$field = parent::normalize( $field );
|
16 |
|
17 |
return $field;
|
18 |
}
|
inc/fields/checkbox.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
/**
|
4 |
* Checkbox field class.
|
5 |
*/
|
6 |
-
class RWMB_Checkbox_Field extends RWMB_Input_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
-
public static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-checkbox', RWMB_CSS_URL . 'checkbox.css', array(), RWMB_VER );
|
14 |
}
|
15 |
|
@@ -20,16 +19,14 @@ class RWMB_Checkbox_Field extends RWMB_Input_Field
|
|
20 |
* @param array $field
|
21 |
* @return string
|
22 |
*/
|
23 |
-
public static function html( $meta, $field )
|
24 |
-
{
|
25 |
$attributes = self::get_attributes( $field, 1 );
|
26 |
$output = sprintf(
|
27 |
'<input %s %s>',
|
28 |
self::render_attributes( $attributes ),
|
29 |
checked( ! empty( $meta ), 1, false )
|
30 |
);
|
31 |
-
if ( $field['desc'] )
|
32 |
-
{
|
33 |
$output = "<label id='{$field['id']}_description' class='description'>$output {$field['desc']}</label>";
|
34 |
}
|
35 |
return $output;
|
@@ -37,22 +34,22 @@ class RWMB_Checkbox_Field extends RWMB_Input_Field
|
|
37 |
|
38 |
/**
|
39 |
* Do not show field description.
|
|
|
40 |
* @param array $field
|
41 |
* @return string
|
42 |
*/
|
43 |
-
public static function element_description( $field )
|
44 |
-
{
|
45 |
return '';
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Format a single value for the helper functions.
|
|
|
50 |
* @param array $field Field parameter
|
51 |
* @param string $value The value
|
52 |
* @return string
|
53 |
*/
|
54 |
-
public static function format_single_value( $field, $value )
|
55 |
-
{
|
56 |
return $value ? __( 'Yes', 'meta-box' ) : __( 'No', 'meta-box' );
|
57 |
}
|
58 |
}
|
3 |
/**
|
4 |
* Checkbox field class.
|
5 |
*/
|
6 |
+
class RWMB_Checkbox_Field extends RWMB_Input_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
+
public static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-checkbox', RWMB_CSS_URL . 'checkbox.css', array(), RWMB_VER );
|
13 |
}
|
14 |
|
19 |
* @param array $field
|
20 |
* @return string
|
21 |
*/
|
22 |
+
public static function html( $meta, $field ) {
|
|
|
23 |
$attributes = self::get_attributes( $field, 1 );
|
24 |
$output = sprintf(
|
25 |
'<input %s %s>',
|
26 |
self::render_attributes( $attributes ),
|
27 |
checked( ! empty( $meta ), 1, false )
|
28 |
);
|
29 |
+
if ( $field['desc'] ) {
|
|
|
30 |
$output = "<label id='{$field['id']}_description' class='description'>$output {$field['desc']}</label>";
|
31 |
}
|
32 |
return $output;
|
34 |
|
35 |
/**
|
36 |
* Do not show field description.
|
37 |
+
*
|
38 |
* @param array $field
|
39 |
* @return string
|
40 |
*/
|
41 |
+
public static function element_description( $field ) {
|
|
|
42 |
return '';
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
* Format a single value for the helper functions.
|
47 |
+
*
|
48 |
* @param array $field Field parameter
|
49 |
* @param string $value The value
|
50 |
* @return string
|
51 |
*/
|
52 |
+
public static function format_single_value( $field, $value ) {
|
|
|
53 |
return $value ? __( 'Yes', 'meta-box' ) : __( 'No', 'meta-box' );
|
54 |
}
|
55 |
}
|
inc/fields/choice.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Abstract class for any kind of choice field.
|
5 |
*/
|
6 |
-
abstract class RWMB_Choice_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Walk options
|
10 |
*
|
@@ -14,8 +14,7 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
14 |
* @param mixed $db_fields
|
15 |
* @return string
|
16 |
*/
|
17 |
-
public static function walk( $field, $options, $db_fields, $meta )
|
18 |
-
{
|
19 |
return '';
|
20 |
}
|
21 |
|
@@ -26,8 +25,7 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
26 |
* @param array $field
|
27 |
* @return string
|
28 |
*/
|
29 |
-
public static function html( $meta, $field )
|
30 |
-
{
|
31 |
$meta = (array) $meta;
|
32 |
$options = self::call( 'get_options', $field );
|
33 |
$options = self::call( 'filter_options', $field, $options );
|
@@ -41,8 +39,7 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
41 |
* @param array $field
|
42 |
* @return array
|
43 |
*/
|
44 |
-
public static function normalize( $field )
|
45 |
-
{
|
46 |
$field = parent::normalize( $field );
|
47 |
$field = wp_parse_args( $field, array(
|
48 |
'flatten' => true,
|
@@ -57,8 +54,7 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
57 |
*
|
58 |
* @return array
|
59 |
*/
|
60 |
-
public static function get_db_fields()
|
61 |
-
{
|
62 |
return array(
|
63 |
'parent' => 'parent',
|
64 |
'id' => 'value',
|
@@ -73,14 +69,13 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
73 |
*
|
74 |
* @return array
|
75 |
*/
|
76 |
-
public static function get_options( $field )
|
77 |
-
{
|
78 |
$options = array();
|
79 |
-
foreach ( (array) $field['options'] as $value => $label )
|
80 |
-
{
|
81 |
$option = is_array( $label ) ? $label : array( 'label' => (string) $label, 'value' => (string) $value );
|
82 |
-
if ( isset( $option['label'] ) && isset( $option['value'] ) )
|
83 |
-
$options[$option['value']] = (object) $option;
|
|
|
84 |
}
|
85 |
return $options;
|
86 |
}
|
@@ -92,12 +87,10 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
92 |
*
|
93 |
* @return array
|
94 |
*/
|
95 |
-
public static function filter_options( $field, $options )
|
96 |
-
{
|
97 |
$db_fields = self::call( 'get_db_fields', $field );
|
98 |
$label = $db_fields['label'];
|
99 |
-
foreach ( $options as &$option )
|
100 |
-
{
|
101 |
$option = apply_filters( 'rwmb_option', $option, $field );
|
102 |
$option->$label = apply_filters( 'rwmb_option_label', $option->$label, $option, $field );
|
103 |
}
|
@@ -106,12 +99,12 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
106 |
|
107 |
/**
|
108 |
* Format a single value for the helper functions.
|
|
|
109 |
* @param array $field Field parameter
|
110 |
* @param string $value The value
|
111 |
* @return string
|
112 |
*/
|
113 |
-
public static function format_single_value( $field, $value )
|
114 |
-
{
|
115 |
return self::call( 'get_option_label', $field, $value );
|
116 |
}
|
117 |
|
@@ -123,9 +116,8 @@ abstract class RWMB_Choice_Field extends RWMB_Field
|
|
123 |
*
|
124 |
* @return string
|
125 |
*/
|
126 |
-
public static function get_option_label( $field, $value )
|
127 |
-
{
|
128 |
$options = self::call( 'get_options', $field );
|
129 |
-
return $options[$value]->label;
|
130 |
}
|
131 |
}
|
3 |
/**
|
4 |
* Abstract class for any kind of choice field.
|
5 |
*/
|
6 |
+
abstract class RWMB_Choice_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Walk options
|
10 |
*
|
14 |
* @param mixed $db_fields
|
15 |
* @return string
|
16 |
*/
|
17 |
+
public static function walk( $field, $options, $db_fields, $meta ) {
|
|
|
18 |
return '';
|
19 |
}
|
20 |
|
25 |
* @param array $field
|
26 |
* @return string
|
27 |
*/
|
28 |
+
public static function html( $meta, $field ) {
|
|
|
29 |
$meta = (array) $meta;
|
30 |
$options = self::call( 'get_options', $field );
|
31 |
$options = self::call( 'filter_options', $field, $options );
|
39 |
* @param array $field
|
40 |
* @return array
|
41 |
*/
|
42 |
+
public static function normalize( $field ) {
|
|
|
43 |
$field = parent::normalize( $field );
|
44 |
$field = wp_parse_args( $field, array(
|
45 |
'flatten' => true,
|
54 |
*
|
55 |
* @return array
|
56 |
*/
|
57 |
+
public static function get_db_fields() {
|
|
|
58 |
return array(
|
59 |
'parent' => 'parent',
|
60 |
'id' => 'value',
|
69 |
*
|
70 |
* @return array
|
71 |
*/
|
72 |
+
public static function get_options( $field ) {
|
|
|
73 |
$options = array();
|
74 |
+
foreach ( (array) $field['options'] as $value => $label ) {
|
|
|
75 |
$option = is_array( $label ) ? $label : array( 'label' => (string) $label, 'value' => (string) $value );
|
76 |
+
if ( isset( $option['label'] ) && isset( $option['value'] ) ) {
|
77 |
+
$options[ $option['value'] ] = (object) $option;
|
78 |
+
}
|
79 |
}
|
80 |
return $options;
|
81 |
}
|
87 |
*
|
88 |
* @return array
|
89 |
*/
|
90 |
+
public static function filter_options( $field, $options ) {
|
|
|
91 |
$db_fields = self::call( 'get_db_fields', $field );
|
92 |
$label = $db_fields['label'];
|
93 |
+
foreach ( $options as &$option ) {
|
|
|
94 |
$option = apply_filters( 'rwmb_option', $option, $field );
|
95 |
$option->$label = apply_filters( 'rwmb_option_label', $option->$label, $option, $field );
|
96 |
}
|
99 |
|
100 |
/**
|
101 |
* Format a single value for the helper functions.
|
102 |
+
*
|
103 |
* @param array $field Field parameter
|
104 |
* @param string $value The value
|
105 |
* @return string
|
106 |
*/
|
107 |
+
public static function format_single_value( $field, $value ) {
|
|
|
108 |
return self::call( 'get_option_label', $field, $value );
|
109 |
}
|
110 |
|
116 |
*
|
117 |
* @return string
|
118 |
*/
|
119 |
+
public static function get_option_label( $field, $value ) {
|
|
|
120 |
$options = self::call( 'get_options', $field );
|
121 |
+
return $options[ $value ]->label;
|
122 |
}
|
123 |
}
|
inc/fields/color.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
/**
|
4 |
* Color field class.
|
5 |
*/
|
6 |
-
class RWMB_Color_Field extends RWMB_Text_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
-
static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL . 'color.css', array( 'wp-color-picker' ), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-color', RWMB_JS_URL . 'color.js', array( 'wp-color-picker' ), RWMB_VER, true );
|
15 |
}
|
@@ -20,8 +19,7 @@ class RWMB_Color_Field extends RWMB_Text_Field
|
|
20 |
* @param array $field
|
21 |
* @return array
|
22 |
*/
|
23 |
-
static function normalize( $field )
|
24 |
-
{
|
25 |
$field = wp_parse_args( $field, array(
|
26 |
'size' => 7,
|
27 |
'maxlength' => 7,
|
@@ -47,8 +45,7 @@ class RWMB_Color_Field extends RWMB_Text_Field
|
|
47 |
* @param mixed $value
|
48 |
* @return array
|
49 |
*/
|
50 |
-
static function get_attributes( $field, $value = null )
|
51 |
-
{
|
52 |
$attributes = parent::get_attributes( $field, $value );
|
53 |
$attributes = wp_parse_args( $attributes, array(
|
54 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
@@ -60,12 +57,12 @@ class RWMB_Color_Field extends RWMB_Text_Field
|
|
60 |
|
61 |
/**
|
62 |
* Format a single value for the helper functions.
|
|
|
63 |
* @param array $field Field parameter
|
64 |
* @param string $value The value
|
65 |
* @return string
|
66 |
*/
|
67 |
-
static function format_single_value( $field, $value )
|
68 |
-
{
|
69 |
return sprintf( "<span style='display:inline-block;width:20px;height:20px;border-radius:50%%;background:%s;'></span>", $value );
|
70 |
}
|
71 |
}
|
3 |
/**
|
4 |
* Color field class.
|
5 |
*/
|
6 |
+
class RWMB_Color_Field extends RWMB_Text_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
+
static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL . 'color.css', array( 'wp-color-picker' ), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-color', RWMB_JS_URL . 'color.js', array( 'wp-color-picker' ), RWMB_VER, true );
|
14 |
}
|
19 |
* @param array $field
|
20 |
* @return array
|
21 |
*/
|
22 |
+
static function normalize( $field ) {
|
|
|
23 |
$field = wp_parse_args( $field, array(
|
24 |
'size' => 7,
|
25 |
'maxlength' => 7,
|
45 |
* @param mixed $value
|
46 |
* @return array
|
47 |
*/
|
48 |
+
static function get_attributes( $field, $value = null ) {
|
|
|
49 |
$attributes = parent::get_attributes( $field, $value );
|
50 |
$attributes = wp_parse_args( $attributes, array(
|
51 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
57 |
|
58 |
/**
|
59 |
* Format a single value for the helper functions.
|
60 |
+
*
|
61 |
* @param array $field Field parameter
|
62 |
* @param string $value The value
|
63 |
* @return string
|
64 |
*/
|
65 |
+
static function format_single_value( $field, $value ) {
|
|
|
66 |
return sprintf( "<span style='display:inline-block;width:20px;height:20px;border-radius:50%%;background:%s;'></span>", $value );
|
67 |
}
|
68 |
}
|
inc/fields/custom-html.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Custom HTML field class.
|
4 |
*/
|
5 |
-
class RWMB_Custom_Html_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
@@ -12,11 +12,9 @@ class RWMB_Custom_Html_Field extends RWMB_Field
|
|
12 |
*
|
13 |
* @return string
|
14 |
*/
|
15 |
-
static function html( $meta, $field )
|
16 |
-
{
|
17 |
$html = ! empty( $field['std'] ) ? $field['std'] : '';
|
18 |
-
if ( ! empty( $field['callback'] ) && is_callable( $field['callback'] ) )
|
19 |
-
{
|
20 |
$html = call_user_func_array( $field['callback'], array( $meta, $field ) );
|
21 |
}
|
22 |
return $html;
|
2 |
/**
|
3 |
* Custom HTML field class.
|
4 |
*/
|
5 |
+
class RWMB_Custom_Html_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
12 |
*
|
13 |
* @return string
|
14 |
*/
|
15 |
+
static function html( $meta, $field ) {
|
|
|
16 |
$html = ! empty( $field['std'] ) ? $field['std'] : '';
|
17 |
+
if ( ! empty( $field['callback'] ) && is_callable( $field['callback'] ) ) {
|
|
|
18 |
$html = call_user_func_array( $field['callback'], array( $meta, $field ) );
|
19 |
}
|
20 |
return $html;
|
inc/fields/date.php
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
/**
|
3 |
* Date field class.
|
4 |
*/
|
5 |
-
class RWMB_Date_Field extends RWMB_Datetime_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
public static function admin_enqueue_scripts()
|
13 |
-
{
|
14 |
parent::admin_register_scripts();
|
15 |
wp_enqueue_style( 'jquery-ui-datepicker' );
|
16 |
wp_enqueue_script( 'rwmb-date' );
|
@@ -24,8 +23,7 @@ class RWMB_Date_Field extends RWMB_Datetime_Field
|
|
24 |
*
|
25 |
* @return string
|
26 |
*/
|
27 |
-
public static function translate_format( $field )
|
28 |
-
{
|
29 |
return strtr( $field['js_options']['dateFormat'], self::$date_formats );
|
30 |
}
|
31 |
}
|
2 |
/**
|
3 |
* Date field class.
|
4 |
*/
|
5 |
+
class RWMB_Date_Field extends RWMB_Datetime_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
public static function admin_enqueue_scripts() {
|
|
|
13 |
parent::admin_register_scripts();
|
14 |
wp_enqueue_style( 'jquery-ui-datepicker' );
|
15 |
wp_enqueue_script( 'rwmb-date' );
|
23 |
*
|
24 |
* @return string
|
25 |
*/
|
26 |
+
public static function translate_format( $field ) {
|
|
|
27 |
return strtr( $field['js_options']['dateFormat'], self::$date_formats );
|
28 |
}
|
29 |
}
|
inc/fields/datetime.php
CHANGED
@@ -3,35 +3,53 @@
|
|
3 |
/**
|
4 |
* Datetime field class.
|
5 |
*/
|
6 |
-
class RWMB_Datetime_Field extends RWMB_Text_Field
|
7 |
-
|
8 |
/**
|
9 |
* Translate date format from jQuery UI date picker to PHP date()
|
10 |
* It's used to store timestamp value of the field
|
11 |
* Missing: '!' => '', 'oo' => '', '@' => '', "''" => "'"
|
|
|
12 |
* @var array
|
13 |
*/
|
14 |
protected static $date_formats = array(
|
15 |
-
'd' => 'j',
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
);
|
18 |
|
19 |
/**
|
20 |
* Translate time format from jQuery UI time picker to PHP date()
|
21 |
* It's used to store timestamp value of the field
|
22 |
* Missing: 't' => '', T' => '', 'm' => '', 's' => ''
|
|
|
23 |
* @var array
|
24 |
*/
|
25 |
protected static $time_formats = array(
|
26 |
-
'H' => 'G',
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
);
|
29 |
|
30 |
/**
|
31 |
* Register scripts and styles
|
32 |
*/
|
33 |
-
public static function admin_register_scripts()
|
34 |
-
{
|
35 |
$url = RWMB_CSS_URL . 'jqueryui';
|
36 |
wp_register_style( 'jquery-ui-core', "$url/jquery.ui.core.css", array(), '1.8.17' );
|
37 |
wp_register_style( 'jquery-ui-theme', "$url/jquery.ui.theme.css", array(), '1.8.17' );
|
@@ -51,6 +69,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
51 |
|
52 |
/**
|
53 |
* Add data to scripts. Prevent loading localized string twice.
|
|
|
54 |
* @link https://github.com/rilwis/meta-box/issues/850
|
55 |
*/
|
56 |
$wp_scripts = wp_scripts();
|
@@ -61,20 +80,15 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
61 |
'locale' => $locale,
|
62 |
'localeShort' => $locale_short,
|
63 |
);
|
64 |
-
foreach ( $handles as $handle )
|
65 |
-
|
66 |
-
if ( ! $wp_scripts->get_data( "rwmb-$handle", 'data' ) )
|
67 |
-
{
|
68 |
-
wp_localize_script( "rwmb-$handle", 'RWMB_' . ucfirst( $handle ), $data );
|
69 |
-
}
|
70 |
}
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
* Enqueue scripts and styles
|
75 |
*/
|
76 |
-
public static function admin_enqueue_scripts()
|
77 |
-
{
|
78 |
self::admin_register_scripts();
|
79 |
wp_enqueue_style( 'jquery-ui-timepicker' );
|
80 |
wp_enqueue_script( 'rwmb-datetime' );
|
@@ -88,12 +102,10 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
88 |
*
|
89 |
* @return string
|
90 |
*/
|
91 |
-
public static function html( $meta, $field )
|
92 |
-
{
|
93 |
$output = '';
|
94 |
|
95 |
-
if ( $field['timestamp'] )
|
96 |
-
{
|
97 |
$name = $field['field_name'];
|
98 |
$field = wp_parse_args( array( 'field_name' => $name . '[formatted]' ), $field );
|
99 |
$output .= sprintf(
|
@@ -106,8 +118,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
106 |
|
107 |
$output .= parent::html( $meta, $field );
|
108 |
|
109 |
-
if ( $field['inline'] )
|
110 |
-
{
|
111 |
$output .= '<div class="rwmb-datetime-inline"></div>';
|
112 |
}
|
113 |
|
@@ -125,8 +136,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
125 |
*
|
126 |
* @return string|int
|
127 |
*/
|
128 |
-
public static function value( $new, $old, $post_id, $field )
|
129 |
-
{
|
130 |
return $field['timestamp'] ? $new['timestamp'] : $new;
|
131 |
}
|
132 |
|
@@ -139,11 +149,9 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
139 |
*
|
140 |
* @return mixed
|
141 |
*/
|
142 |
-
public static function meta( $post_id, $saved, $field )
|
143 |
-
{
|
144 |
$meta = parent::meta( $post_id, $saved, $field );
|
145 |
-
if ( $field['timestamp'] )
|
146 |
-
{
|
147 |
$meta = self::prepare_meta( $meta, $field );
|
148 |
}
|
149 |
return $meta;
|
@@ -151,14 +159,13 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
151 |
|
152 |
/**
|
153 |
* Format meta value if set 'timestamp'
|
|
|
154 |
* @param array|string $meta The meta value
|
155 |
* @param array $field Field parameter
|
156 |
* @return array
|
157 |
*/
|
158 |
-
protected static function prepare_meta( $meta, $field )
|
159 |
-
|
160 |
-
if ( is_array( $meta ) )
|
161 |
-
{
|
162 |
return array_map( __METHOD__, $meta );
|
163 |
}
|
164 |
return array(
|
@@ -173,8 +180,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
173 |
* @param array $field
|
174 |
* @return array
|
175 |
*/
|
176 |
-
public static function normalize( $field )
|
177 |
-
{
|
178 |
$field = wp_parse_args( $field, array(
|
179 |
'timestamp' => false,
|
180 |
'inline' => false,
|
@@ -190,8 +196,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
190 |
'showButtonPanel' => true,
|
191 |
) );
|
192 |
|
193 |
-
if ( $field['inline'] )
|
194 |
-
{
|
195 |
$field['js_options'] = wp_parse_args( $field['js_options'], array(
|
196 |
'altFieldTimeOnly' => false,
|
197 |
) );
|
@@ -210,8 +215,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
210 |
*
|
211 |
* @return array
|
212 |
*/
|
213 |
-
public static function get_attributes( $field, $value = null )
|
214 |
-
{
|
215 |
$attributes = parent::get_attributes( $field, $value );
|
216 |
$attributes = wp_parse_args( $attributes, array(
|
217 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
@@ -229,8 +233,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
|
|
229 |
*
|
230 |
* @return string
|
231 |
*/
|
232 |
-
public static function translate_format( $field )
|
233 |
-
{
|
234 |
return strtr( $field['js_options']['dateFormat'], self::$date_formats )
|
235 |
. $field['js_options']['separator']
|
236 |
. strtr( $field['js_options']['timeFormat'], self::$time_formats );
|
3 |
/**
|
4 |
* Datetime field class.
|
5 |
*/
|
6 |
+
class RWMB_Datetime_Field extends RWMB_Text_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Translate date format from jQuery UI date picker to PHP date()
|
10 |
* It's used to store timestamp value of the field
|
11 |
* Missing: '!' => '', 'oo' => '', '@' => '', "''" => "'"
|
12 |
+
*
|
13 |
* @var array
|
14 |
*/
|
15 |
protected static $date_formats = array(
|
16 |
+
'd' => 'j',
|
17 |
+
'dd' => 'd',
|
18 |
+
'oo' => 'z',
|
19 |
+
'D' => 'D',
|
20 |
+
'DD' => 'l',
|
21 |
+
'm' => 'n',
|
22 |
+
'mm' => 'm',
|
23 |
+
'M' => 'M',
|
24 |
+
'MM' => 'F',
|
25 |
+
'y' => 'y',
|
26 |
+
'yy' => 'Y',
|
27 |
+
'o' => 'z',
|
28 |
);
|
29 |
|
30 |
/**
|
31 |
* Translate time format from jQuery UI time picker to PHP date()
|
32 |
* It's used to store timestamp value of the field
|
33 |
* Missing: 't' => '', T' => '', 'm' => '', 's' => ''
|
34 |
+
*
|
35 |
* @var array
|
36 |
*/
|
37 |
protected static $time_formats = array(
|
38 |
+
'H' => 'G',
|
39 |
+
'HH' => 'H',
|
40 |
+
'h' => 'g',
|
41 |
+
'hh' => 'h',
|
42 |
+
'mm' => 'i',
|
43 |
+
'ss' => 's',
|
44 |
+
'l' => 'u',
|
45 |
+
'tt' => 'a',
|
46 |
+
'TT' => 'A',
|
47 |
);
|
48 |
|
49 |
/**
|
50 |
* Register scripts and styles
|
51 |
*/
|
52 |
+
public static function admin_register_scripts() {
|
|
|
53 |
$url = RWMB_CSS_URL . 'jqueryui';
|
54 |
wp_register_style( 'jquery-ui-core', "$url/jquery.ui.core.css", array(), '1.8.17' );
|
55 |
wp_register_style( 'jquery-ui-theme', "$url/jquery.ui.theme.css", array(), '1.8.17' );
|
69 |
|
70 |
/**
|
71 |
* Add data to scripts. Prevent loading localized string twice.
|
72 |
+
*
|
73 |
* @link https://github.com/rilwis/meta-box/issues/850
|
74 |
*/
|
75 |
$wp_scripts = wp_scripts();
|
80 |
'locale' => $locale,
|
81 |
'localeShort' => $locale_short,
|
82 |
);
|
83 |
+
foreach ( $handles as $handle ) {
|
84 |
+
self::localize_script( "rwmb-$handle", 'RWMB_' . ucfirst( $handle ), $data );
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Enqueue scripts and styles
|
90 |
*/
|
91 |
+
public static function admin_enqueue_scripts() {
|
|
|
92 |
self::admin_register_scripts();
|
93 |
wp_enqueue_style( 'jquery-ui-timepicker' );
|
94 |
wp_enqueue_script( 'rwmb-datetime' );
|
102 |
*
|
103 |
* @return string
|
104 |
*/
|
105 |
+
public static function html( $meta, $field ) {
|
|
|
106 |
$output = '';
|
107 |
|
108 |
+
if ( $field['timestamp'] ) {
|
|
|
109 |
$name = $field['field_name'];
|
110 |
$field = wp_parse_args( array( 'field_name' => $name . '[formatted]' ), $field );
|
111 |
$output .= sprintf(
|
118 |
|
119 |
$output .= parent::html( $meta, $field );
|
120 |
|
121 |
+
if ( $field['inline'] ) {
|
|
|
122 |
$output .= '<div class="rwmb-datetime-inline"></div>';
|
123 |
}
|
124 |
|
136 |
*
|
137 |
* @return string|int
|
138 |
*/
|
139 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
140 |
return $field['timestamp'] ? $new['timestamp'] : $new;
|
141 |
}
|
142 |
|
149 |
*
|
150 |
* @return mixed
|
151 |
*/
|
152 |
+
public static function meta( $post_id, $saved, $field ) {
|
|
|
153 |
$meta = parent::meta( $post_id, $saved, $field );
|
154 |
+
if ( $field['timestamp'] ) {
|
|
|
155 |
$meta = self::prepare_meta( $meta, $field );
|
156 |
}
|
157 |
return $meta;
|
159 |
|
160 |
/**
|
161 |
* Format meta value if set 'timestamp'
|
162 |
+
*
|
163 |
* @param array|string $meta The meta value
|
164 |
* @param array $field Field parameter
|
165 |
* @return array
|
166 |
*/
|
167 |
+
protected static function prepare_meta( $meta, $field ) {
|
168 |
+
if ( is_array( $meta ) ) {
|
|
|
|
|
169 |
return array_map( __METHOD__, $meta );
|
170 |
}
|
171 |
return array(
|
180 |
* @param array $field
|
181 |
* @return array
|
182 |
*/
|
183 |
+
public static function normalize( $field ) {
|
|
|
184 |
$field = wp_parse_args( $field, array(
|
185 |
'timestamp' => false,
|
186 |
'inline' => false,
|
196 |
'showButtonPanel' => true,
|
197 |
) );
|
198 |
|
199 |
+
if ( $field['inline'] ) {
|
|
|
200 |
$field['js_options'] = wp_parse_args( $field['js_options'], array(
|
201 |
'altFieldTimeOnly' => false,
|
202 |
) );
|
215 |
*
|
216 |
* @return array
|
217 |
*/
|
218 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
219 |
$attributes = parent::get_attributes( $field, $value );
|
220 |
$attributes = wp_parse_args( $attributes, array(
|
221 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
233 |
*
|
234 |
* @return string
|
235 |
*/
|
236 |
+
public static function translate_format( $field ) {
|
|
|
237 |
return strtr( $field['js_options']['dateFormat'], self::$date_formats )
|
238 |
. $field['js_options']['separator']
|
239 |
. strtr( $field['js_options']['timeFormat'], self::$time_formats );
|
inc/fields/divider.php
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
/**
|
3 |
* Divider field class.
|
4 |
*/
|
5 |
-
class RWMB_Divider_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
static function admin_enqueue_scripts()
|
13 |
-
{
|
14 |
wp_enqueue_style( 'rwmb-divider', RWMB_CSS_URL . 'divider.css', array(), RWMB_VER );
|
15 |
}
|
16 |
|
@@ -22,8 +21,7 @@ class RWMB_Divider_Field extends RWMB_Field
|
|
22 |
*
|
23 |
* @return string
|
24 |
*/
|
25 |
-
static function begin_html( $meta, $field )
|
26 |
-
{
|
27 |
$attributes = empty( $field['id'] ) ? '' : " id='{$field['id']}'";
|
28 |
return "<hr$attributes>";
|
29 |
}
|
@@ -36,8 +34,7 @@ class RWMB_Divider_Field extends RWMB_Field
|
|
36 |
*
|
37 |
* @return string
|
38 |
*/
|
39 |
-
static function end_html( $meta, $field )
|
40 |
-
{
|
41 |
return '';
|
42 |
}
|
43 |
}
|
2 |
/**
|
3 |
* Divider field class.
|
4 |
*/
|
5 |
+
class RWMB_Divider_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
static function admin_enqueue_scripts() {
|
|
|
13 |
wp_enqueue_style( 'rwmb-divider', RWMB_CSS_URL . 'divider.css', array(), RWMB_VER );
|
14 |
}
|
15 |
|
21 |
*
|
22 |
* @return string
|
23 |
*/
|
24 |
+
static function begin_html( $meta, $field ) {
|
|
|
25 |
$attributes = empty( $field['id'] ) ? '' : " id='{$field['id']}'";
|
26 |
return "<hr$attributes>";
|
27 |
}
|
34 |
*
|
35 |
* @return string
|
36 |
*/
|
37 |
+
static function end_html( $meta, $field ) {
|
|
|
38 |
return '';
|
39 |
}
|
40 |
}
|
inc/fields/fieldset-text.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Fieldset text class.
|
5 |
*/
|
6 |
-
class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
7 |
-
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
@@ -13,14 +13,12 @@ class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
|
13 |
*
|
14 |
* @return string
|
15 |
*/
|
16 |
-
static function html( $meta, $field )
|
17 |
-
{
|
18 |
$html = array();
|
19 |
$tpl = '<label>%s %s</label>';
|
20 |
|
21 |
-
foreach ( $field['options'] as $key => $label )
|
22 |
-
|
23 |
-
$value = isset( $meta[$key] ) ? $meta[$key] : '';
|
24 |
$field['attributes']['name'] = $field['field_name'] . "[{$key}]";
|
25 |
$html[] = sprintf( $tpl, $label, parent::html( $value, $field ) );
|
26 |
}
|
@@ -32,11 +30,11 @@ class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
|
32 |
|
33 |
/**
|
34 |
* Do not show field description.
|
|
|
35 |
* @param array $field
|
36 |
* @return string
|
37 |
*/
|
38 |
-
public static function element_description( $field )
|
39 |
-
{
|
40 |
return '';
|
41 |
}
|
42 |
|
@@ -47,8 +45,7 @@ class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
|
47 |
*
|
48 |
* @return array
|
49 |
*/
|
50 |
-
static function normalize( $field )
|
51 |
-
{
|
52 |
$field = parent::normalize( $field );
|
53 |
$field['multiple'] = false;
|
54 |
$field['attributes']['id'] = false;
|
@@ -58,27 +55,22 @@ class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
|
58 |
|
59 |
/**
|
60 |
* Format value for the helper functions.
|
|
|
61 |
* @param array $field Field parameter
|
62 |
* @param string|array $value The field meta value
|
63 |
* @return string
|
64 |
*/
|
65 |
-
public static function format_value( $field, $value )
|
66 |
-
{
|
67 |
$output = '<table><thead><tr>';
|
68 |
-
foreach ( $field['options'] as $label )
|
69 |
-
{
|
70 |
$output .= "<th>$label</th>";
|
71 |
}
|
72 |
$output .= '<tr>';
|
73 |
|
74 |
-
if ( ! $field['clone'] )
|
75 |
-
{
|
76 |
$output .= self::format_single_value( $field, $value );
|
77 |
-
}
|
78 |
-
|
79 |
-
{
|
80 |
-
foreach ( $value as $subvalue )
|
81 |
-
{
|
82 |
$output .= self::format_single_value( $field, $subvalue );
|
83 |
}
|
84 |
}
|
@@ -88,15 +80,14 @@ class RWMB_Fieldset_Text_Field extends RWMB_Text_Field
|
|
88 |
|
89 |
/**
|
90 |
* Format a single value for the helper functions.
|
|
|
91 |
* @param array $field Field parameter
|
92 |
* @param array $value The value
|
93 |
* @return string
|
94 |
*/
|
95 |
-
public static function format_single_value( $field, $value )
|
96 |
-
{
|
97 |
$output = '<tr>';
|
98 |
-
foreach ( $value as $subvalue )
|
99 |
-
{
|
100 |
$output .= "<td>$subvalue</td>";
|
101 |
}
|
102 |
$output .= '</tr>';
|
3 |
/**
|
4 |
* Fieldset text class.
|
5 |
*/
|
6 |
+
class RWMB_Fieldset_Text_Field extends RWMB_Text_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
13 |
*
|
14 |
* @return string
|
15 |
*/
|
16 |
+
static function html( $meta, $field ) {
|
|
|
17 |
$html = array();
|
18 |
$tpl = '<label>%s %s</label>';
|
19 |
|
20 |
+
foreach ( $field['options'] as $key => $label ) {
|
21 |
+
$value = isset( $meta[ $key ] ) ? $meta[ $key ] : '';
|
|
|
22 |
$field['attributes']['name'] = $field['field_name'] . "[{$key}]";
|
23 |
$html[] = sprintf( $tpl, $label, parent::html( $value, $field ) );
|
24 |
}
|
30 |
|
31 |
/**
|
32 |
* Do not show field description.
|
33 |
+
*
|
34 |
* @param array $field
|
35 |
* @return string
|
36 |
*/
|
37 |
+
public static function element_description( $field ) {
|
|
|
38 |
return '';
|
39 |
}
|
40 |
|
45 |
*
|
46 |
* @return array
|
47 |
*/
|
48 |
+
static function normalize( $field ) {
|
|
|
49 |
$field = parent::normalize( $field );
|
50 |
$field['multiple'] = false;
|
51 |
$field['attributes']['id'] = false;
|
55 |
|
56 |
/**
|
57 |
* Format value for the helper functions.
|
58 |
+
*
|
59 |
* @param array $field Field parameter
|
60 |
* @param string|array $value The field meta value
|
61 |
* @return string
|
62 |
*/
|
63 |
+
public static function format_value( $field, $value ) {
|
|
|
64 |
$output = '<table><thead><tr>';
|
65 |
+
foreach ( $field['options'] as $label ) {
|
|
|
66 |
$output .= "<th>$label</th>";
|
67 |
}
|
68 |
$output .= '<tr>';
|
69 |
|
70 |
+
if ( ! $field['clone'] ) {
|
|
|
71 |
$output .= self::format_single_value( $field, $value );
|
72 |
+
} else {
|
73 |
+
foreach ( $value as $subvalue ) {
|
|
|
|
|
|
|
74 |
$output .= self::format_single_value( $field, $subvalue );
|
75 |
}
|
76 |
}
|
80 |
|
81 |
/**
|
82 |
* Format a single value for the helper functions.
|
83 |
+
*
|
84 |
* @param array $field Field parameter
|
85 |
* @param array $value The value
|
86 |
* @return string
|
87 |
*/
|
88 |
+
public static function format_single_value( $field, $value ) {
|
|
|
89 |
$output = '<tr>';
|
90 |
+
foreach ( $value as $subvalue ) {
|
|
|
91 |
$output .= "<td>$subvalue</td>";
|
92 |
}
|
93 |
$output .= '</tr>';
|
inc/fields/file-input.php
CHANGED
@@ -3,28 +3,19 @@
|
|
3 |
/**
|
4 |
* File input field class which uses an input for file URL.
|
5 |
*/
|
6 |
-
class RWMB_File_Input_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*
|
11 |
* @return void
|
12 |
*/
|
13 |
-
static function admin_enqueue_scripts()
|
14 |
-
{
|
15 |
wp_enqueue_media();
|
16 |
wp_enqueue_script( 'rwmb-file-input', RWMB_JS_URL . 'file-input.js', array( 'jquery' ), RWMB_VER, true );
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
*/
|
21 |
-
$wp_scripts = wp_scripts();
|
22 |
-
if ( ! $wp_scripts->get_data( 'rwmb-file-input', 'data' ) )
|
23 |
-
{
|
24 |
-
wp_localize_script( 'rwmb-file-input', 'rwmbFileInput', array(
|
25 |
-
'frameTitle' => __( 'Select File', 'meta-box' ),
|
26 |
-
) );
|
27 |
-
}
|
28 |
}
|
29 |
|
30 |
/**
|
@@ -35,8 +26,7 @@ class RWMB_File_Input_Field extends RWMB_Field
|
|
35 |
*
|
36 |
* @return string
|
37 |
*/
|
38 |
-
static function html( $meta, $field )
|
39 |
-
{
|
40 |
return sprintf(
|
41 |
'<input type="text" class="rwmb-file-input" name="%s" id="%s" value="%s" placeholder="%s" size="%s">
|
42 |
<a href="#" class="rwmb-file-input-select button-primary">%s</a>
|
@@ -59,8 +49,7 @@ class RWMB_File_Input_Field extends RWMB_Field
|
|
59 |
*
|
60 |
* @return array
|
61 |
*/
|
62 |
-
static function normalize( $field )
|
63 |
-
{
|
64 |
$field = parent::normalize( $field );
|
65 |
$field = wp_parse_args( $field, array(
|
66 |
'size' => 30,
|
3 |
/**
|
4 |
* File input field class which uses an input for file URL.
|
5 |
*/
|
6 |
+
class RWMB_File_Input_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*
|
11 |
* @return void
|
12 |
*/
|
13 |
+
static function admin_enqueue_scripts() {
|
|
|
14 |
wp_enqueue_media();
|
15 |
wp_enqueue_script( 'rwmb-file-input', RWMB_JS_URL . 'file-input.js', array( 'jquery' ), RWMB_VER, true );
|
16 |
+
self::localize_script('rwmb-file-input', 'rwmbFileInput', array(
|
17 |
+
'frameTitle' => __( 'Select File', 'meta-box' ),
|
18 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
26 |
*
|
27 |
* @return string
|
28 |
*/
|
29 |
+
static function html( $meta, $field ) {
|
|
|
30 |
return sprintf(
|
31 |
'<input type="text" class="rwmb-file-input" name="%s" id="%s" value="%s" placeholder="%s" size="%s">
|
32 |
<a href="#" class="rwmb-file-input-select button-primary">%s</a>
|
49 |
*
|
50 |
* @return array
|
51 |
*/
|
52 |
+
static function normalize( $field ) {
|
|
|
53 |
$field = parent::normalize( $field );
|
54 |
$field = wp_parse_args( $field, array(
|
55 |
'size' => 30,
|
inc/fields/file-upload.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* File advanced field class which users WordPress media popup to upload and select files.
|
4 |
*/
|
5 |
-
class RWMB_File_Upload_Field extends RWMB_Media_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
public static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
parent::admin_enqueue_scripts();
|
13 |
wp_enqueue_style( 'rwmb-upload', RWMB_CSS_URL . 'upload.css', array( 'rwmb-media' ), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-file-upload', RWMB_JS_URL . 'file-upload.js', array( 'rwmb-media' ), RWMB_VER, true );
|
@@ -17,8 +16,7 @@ class RWMB_File_Upload_Field extends RWMB_Media_Field
|
|
17 |
/**
|
18 |
* Template for media item
|
19 |
*/
|
20 |
-
public static function print_templates()
|
21 |
-
{
|
22 |
parent::print_templates();
|
23 |
require_once RWMB_INC_DIR . 'templates/upload.php';
|
24 |
}
|
2 |
/**
|
3 |
* File advanced field class which users WordPress media popup to upload and select files.
|
4 |
*/
|
5 |
+
class RWMB_File_Upload_Field extends RWMB_Media_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
public static function admin_enqueue_scripts() {
|
|
|
11 |
parent::admin_enqueue_scripts();
|
12 |
wp_enqueue_style( 'rwmb-upload', RWMB_CSS_URL . 'upload.css', array( 'rwmb-media' ), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-file-upload', RWMB_JS_URL . 'file-upload.js', array( 'rwmb-media' ), RWMB_VER, true );
|
16 |
/**
|
17 |
* Template for media item
|
18 |
*/
|
19 |
+
public static function print_templates() {
|
|
|
20 |
parent::print_templates();
|
21 |
require_once RWMB_INC_DIR . 'templates/upload.php';
|
22 |
}
|
inc/fields/file.php
CHANGED
@@ -3,35 +3,25 @@
|
|
3 |
/**
|
4 |
* File field class which uses HTML <input type="file"> to upload file.
|
5 |
*/
|
6 |
-
class RWMB_File_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
-
public static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-file', RWMB_CSS_URL . 'file.css', array(), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-file', RWMB_JS_URL . 'file.js', array( 'jquery' ), RWMB_VER, true );
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
$wp_scripts = wp_scripts();
|
21 |
-
if ( ! $wp_scripts->get_data( 'rwmb-file', 'data' ) )
|
22 |
-
{
|
23 |
-
wp_localize_script( 'rwmb-file', 'rwmbFile', array(
|
24 |
-
'maxFileUploadsSingle' => __( 'You may only upload maximum %d file', 'meta-box' ),
|
25 |
-
'maxFileUploadsPlural' => __( 'You may only upload maximum %d files', 'meta-box' ),
|
26 |
-
) );
|
27 |
-
}
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Add custom actions
|
32 |
*/
|
33 |
-
public static function add_actions()
|
34 |
-
{
|
35 |
add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
|
36 |
add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, 'wp_ajax_delete_file' ) );
|
37 |
add_action( 'wp_ajax_rwmb_reorder_files', array( __CLASS__, 'wp_ajax_reorder_files' ) );
|
@@ -40,16 +30,14 @@ class RWMB_File_Field extends RWMB_Field
|
|
40 |
/**
|
41 |
* Add data encoding type for file uploading
|
42 |
*/
|
43 |
-
public static function post_edit_form_tag()
|
44 |
-
{
|
45 |
echo ' enctype="multipart/form-data"';
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Ajax callback for reordering images
|
50 |
*/
|
51 |
-
public static function wp_ajax_reorder_files()
|
52 |
-
{
|
53 |
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
54 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
55 |
$order = (string) filter_input( INPUT_POST, 'order' );
|
@@ -57,8 +45,7 @@ class RWMB_File_Field extends RWMB_Field
|
|
57 |
check_ajax_referer( "rwmb-reorder-files_{$field_id}" );
|
58 |
parse_str( $order, $items );
|
59 |
delete_post_meta( $post_id, $field_id );
|
60 |
-
foreach ( $items['item'] as $item )
|
61 |
-
{
|
62 |
add_post_meta( $post_id, $field_id, $item, false );
|
63 |
}
|
64 |
wp_send_json_success();
|
@@ -67,10 +54,10 @@ class RWMB_File_Field extends RWMB_Field
|
|
67 |
/**
|
68 |
* Ajax callback for deleting files.
|
69 |
* Modified from a function used by "Verve Meta Boxes" plugin
|
|
|
70 |
* @link http://goo.gl/LzYSq
|
71 |
*/
|
72 |
-
public static function wp_ajax_delete_file()
|
73 |
-
{
|
74 |
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
75 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
76 |
$attachment_id = (int) filter_input( INPUT_POST, 'attachment_id', FILTER_SANITIZE_NUMBER_INT );
|
@@ -80,8 +67,9 @@ class RWMB_File_Field extends RWMB_Field
|
|
80 |
delete_post_meta( $post_id, $field_id, $attachment_id );
|
81 |
$success = $force_delete ? wp_delete_attachment( $attachment_id ) : true;
|
82 |
|
83 |
-
if ( $success )
|
84 |
wp_send_json_success();
|
|
|
85 |
wp_send_json_error( __( 'Error: Cannot delete file', 'meta-box' ) );
|
86 |
}
|
87 |
|
@@ -93,16 +81,16 @@ class RWMB_File_Field extends RWMB_Field
|
|
93 |
*
|
94 |
* @return string
|
95 |
*/
|
96 |
-
public static function html( $meta, $field )
|
97 |
-
{
|
98 |
$i18n_title = apply_filters( 'rwmb_file_upload_string', _x( 'Upload Files', 'file upload', 'meta-box' ), $field );
|
99 |
$i18n_more = apply_filters( 'rwmb_file_add_string', _x( '+ Add new file', 'file upload', 'meta-box' ), $field );
|
100 |
|
101 |
// Uploaded files
|
102 |
$html = self::get_uploaded_files( $meta, $field );
|
103 |
$classes = 'new-files';
|
104 |
-
if ( ! empty( $field['max_file_uploads'] ) && count( $meta ) >= (int) $field['max_file_uploads'] )
|
105 |
$classes .= ' hidden';
|
|
|
106 |
|
107 |
// Show form upload
|
108 |
$html .= sprintf(
|
@@ -122,22 +110,22 @@ class RWMB_File_Field extends RWMB_Field
|
|
122 |
|
123 |
/**
|
124 |
* Get HTML for uploaded files.
|
|
|
125 |
* @param array $files List of uploaded files
|
126 |
* @param array $field Field parameters
|
127 |
* @return string
|
128 |
*/
|
129 |
-
protected static function get_uploaded_files( $files, $field )
|
130 |
-
{
|
131 |
$reorder_nonce = wp_create_nonce( "rwmb-reorder-files_{$field['id']}" );
|
132 |
$delete_nonce = wp_create_nonce( "rwmb-delete-file_{$field['id']}" );
|
133 |
|
134 |
$classes = 'rwmb-uploaded';
|
135 |
-
if ( count( $files ) <= 0 )
|
136 |
$classes .= ' hidden';
|
|
|
137 |
|
138 |
-
foreach ( (array) $files as $k => $file )
|
139 |
-
|
140 |
-
$files[$k] = self::call( $field, 'file_html', $file );
|
141 |
}
|
142 |
return sprintf(
|
143 |
'<ul class="%s" 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>',
|
@@ -154,11 +142,11 @@ class RWMB_File_Field extends RWMB_Field
|
|
154 |
|
155 |
/**
|
156 |
* Get HTML for uploaded file.
|
|
|
157 |
* @param int $file Attachment (file) ID
|
158 |
* @return string
|
159 |
*/
|
160 |
-
protected static function file_html( $file )
|
161 |
-
{
|
162 |
$i18n_delete = apply_filters( 'rwmb_file_delete_string', _x( 'Delete', 'file upload', 'meta-box' ) );
|
163 |
$i18n_edit = apply_filters( 'rwmb_file_edit_string', _x( 'Edit', 'file upload', 'meta-box' ) );
|
164 |
$mime_type = get_post_mime_type( $file );
|
@@ -195,15 +183,14 @@ class RWMB_File_Field extends RWMB_Field
|
|
195 |
*
|
196 |
* @return array|mixed
|
197 |
*/
|
198 |
-
public static function value( $new, $old, $post_id, $field )
|
199 |
-
|
200 |
-
if ( empty( $_FILES[$field['id']] ) )
|
201 |
return $new;
|
|
|
202 |
|
203 |
$new = array();
|
204 |
-
$files = self::transform( $_FILES[$field['id']] );
|
205 |
-
foreach ( $files as $file )
|
206 |
-
{
|
207 |
$new[] = self::upload( $file, $post_id );
|
208 |
}
|
209 |
|
@@ -212,15 +199,16 @@ class RWMB_File_Field extends RWMB_Field
|
|
212 |
|
213 |
/**
|
214 |
* Handle upload file.
|
|
|
215 |
* @param array $file
|
216 |
* @param int $post Post parent ID
|
217 |
* @return int Attachment ID on success, false on failure.
|
218 |
*/
|
219 |
-
protected static function upload( $file, $post )
|
220 |
-
{
|
221 |
$file = wp_handle_upload( $file, array( 'test_form' => false ) );
|
222 |
-
if ( ! isset( $file['file'] ) )
|
223 |
return false;
|
|
|
224 |
|
225 |
$attachment = wp_insert_attachment( array(
|
226 |
'post_mime_type' => $file['type'],
|
@@ -229,8 +217,7 @@ class RWMB_File_Field extends RWMB_Field
|
|
229 |
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file['file'] ) ),
|
230 |
'post_content' => '',
|
231 |
), $file['file'], $post );
|
232 |
-
if ( is_wp_error( $attachment ) || ! $attachment )
|
233 |
-
{
|
234 |
return false;
|
235 |
}
|
236 |
wp_update_attachment_metadata( $attachment, wp_generate_attachment_metadata( $attachment, $file['file'] ) );
|
@@ -239,17 +226,15 @@ class RWMB_File_Field extends RWMB_Field
|
|
239 |
|
240 |
/**
|
241 |
* Transform $_FILES from $_FILES['field']['key']['index'] to $_FILES['field']['index']['key']
|
|
|
242 |
* @param array $files
|
243 |
* @return array
|
244 |
*/
|
245 |
-
protected static function transform( $files )
|
246 |
-
{
|
247 |
$output = array();
|
248 |
-
foreach ( $files as $key => $list )
|
249 |
-
|
250 |
-
|
251 |
-
{
|
252 |
-
$output[$index][$key] = $value;
|
253 |
}
|
254 |
}
|
255 |
|
@@ -258,11 +243,11 @@ class RWMB_File_Field extends RWMB_Field
|
|
258 |
|
259 |
/**
|
260 |
* Normalize parameters for field
|
|
|
261 |
* @param array $field
|
262 |
* @return array
|
263 |
*/
|
264 |
-
public static function normalize( $field )
|
265 |
-
{
|
266 |
$field = parent::normalize( $field );
|
267 |
$field = wp_parse_args( $field, array(
|
268 |
'std' => array(),
|
@@ -284,24 +269,18 @@ class RWMB_File_Field extends RWMB_Field
|
|
284 |
*
|
285 |
* @return mixed Full info of uploaded files
|
286 |
*/
|
287 |
-
public static function get_value( $field, $args = array(), $post_id = null )
|
288 |
-
{
|
289 |
$value = parent::get_value( $field, $args, $post_id );
|
290 |
-
if ( ! $field['clone'] )
|
291 |
-
{
|
292 |
$value = self::call( 'files_info', $field, $value, $args );
|
293 |
-
}
|
294 |
-
else
|
295 |
-
{
|
296 |
$return = array();
|
297 |
-
foreach ( $value as $subvalue )
|
298 |
-
{
|
299 |
$return[] = self::call( 'files_info', $field, $subvalue, $args );
|
300 |
}
|
301 |
$value = $return;
|
302 |
}
|
303 |
-
if ( isset( $args['limit'] ) )
|
304 |
-
{
|
305 |
$value = array_slice( $value, 0, intval( $args['limit'] ) );
|
306 |
}
|
307 |
return $value;
|
@@ -309,19 +288,17 @@ class RWMB_File_Field extends RWMB_Field
|
|
309 |
|
310 |
/**
|
311 |
* Get uploaded files information
|
|
|
312 |
* @param array $field Field parameter
|
313 |
* @param array $files Files IDs
|
314 |
* @param array $args Additional arguments (for image size)
|
315 |
* @return array
|
316 |
*/
|
317 |
-
public static function files_info( $field, $files, $args )
|
318 |
-
{
|
319 |
$return = array();
|
320 |
-
foreach ( (array) $files as $file )
|
321 |
-
|
322 |
-
|
323 |
-
{
|
324 |
-
$return[$file] = $info;
|
325 |
}
|
326 |
}
|
327 |
return $return;
|
@@ -335,10 +312,8 @@ class RWMB_File_Field extends RWMB_Field
|
|
335 |
*
|
336 |
* @return array|bool False if file not found. Array of (id, name, path, url) on success
|
337 |
*/
|
338 |
-
public static function file_info( $file, $args = array() )
|
339 |
-
|
340 |
-
if ( ! $path = get_attached_file( $file ) )
|
341 |
-
{
|
342 |
return false;
|
343 |
}
|
344 |
|
@@ -353,19 +328,17 @@ class RWMB_File_Field extends RWMB_Field
|
|
353 |
|
354 |
/**
|
355 |
* Format value for the helper functions.
|
|
|
356 |
* @param array $field Field parameter
|
357 |
* @param string|array $value The field meta value
|
358 |
* @return string
|
359 |
*/
|
360 |
-
public static function format_value( $field, $value )
|
361 |
-
|
362 |
-
if ( ! $field['clone'] )
|
363 |
-
{
|
364 |
return self::call( 'format_single_value', $field, $value );
|
365 |
}
|
366 |
$output = '<ul>';
|
367 |
-
foreach ( $value as $subvalue )
|
368 |
-
{
|
369 |
$output .= '<li>' . self::call( 'format_single_value', $field, $subvalue ) . '</li>';
|
370 |
}
|
371 |
$output .= '</ul>';
|
@@ -374,15 +347,14 @@ class RWMB_File_Field extends RWMB_Field
|
|
374 |
|
375 |
/**
|
376 |
* Format a single value for the helper functions.
|
|
|
377 |
* @param array $field Field parameter
|
378 |
* @param array $value The value
|
379 |
* @return string
|
380 |
*/
|
381 |
-
public static function format_single_value( $field, $value )
|
382 |
-
{
|
383 |
$output = '<ul>';
|
384 |
-
foreach ( $value as $file )
|
385 |
-
{
|
386 |
$output .= sprintf( '<li><a href="%s" target="_blank">%s</a></li>', $file['url'], $file['title'] );
|
387 |
}
|
388 |
$output .= '</ul>';
|
3 |
/**
|
4 |
* File field class which uses HTML <input type="file"> to upload file.
|
5 |
*/
|
6 |
+
class RWMB_File_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
+
public static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-file', RWMB_CSS_URL . 'file.css', array(), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-file', RWMB_JS_URL . 'file.js', array( 'jquery' ), RWMB_VER, true );
|
14 |
|
15 |
+
self::localize_script( 'rwmb-file', 'rwmbFile', array(
|
16 |
+
'maxFileUploadsSingle' => __( 'You may only upload maximum %d file', 'meta-box' ),
|
17 |
+
'maxFileUploadsPlural' => __( 'You may only upload maximum %d files', 'meta-box' ),
|
18 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
* Add custom actions
|
23 |
*/
|
24 |
+
public static function add_actions() {
|
|
|
25 |
add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
|
26 |
add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, 'wp_ajax_delete_file' ) );
|
27 |
add_action( 'wp_ajax_rwmb_reorder_files', array( __CLASS__, 'wp_ajax_reorder_files' ) );
|
30 |
/**
|
31 |
* Add data encoding type for file uploading
|
32 |
*/
|
33 |
+
public static function post_edit_form_tag() {
|
|
|
34 |
echo ' enctype="multipart/form-data"';
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
* Ajax callback for reordering images
|
39 |
*/
|
40 |
+
public static function wp_ajax_reorder_files() {
|
|
|
41 |
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
42 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
43 |
$order = (string) filter_input( INPUT_POST, 'order' );
|
45 |
check_ajax_referer( "rwmb-reorder-files_{$field_id}" );
|
46 |
parse_str( $order, $items );
|
47 |
delete_post_meta( $post_id, $field_id );
|
48 |
+
foreach ( $items['item'] as $item ) {
|
|
|
49 |
add_post_meta( $post_id, $field_id, $item, false );
|
50 |
}
|
51 |
wp_send_json_success();
|
54 |
/**
|
55 |
* Ajax callback for deleting files.
|
56 |
* Modified from a function used by "Verve Meta Boxes" plugin
|
57 |
+
*
|
58 |
* @link http://goo.gl/LzYSq
|
59 |
*/
|
60 |
+
public static function wp_ajax_delete_file() {
|
|
|
61 |
$post_id = (int) filter_input( INPUT_POST, 'post_id', FILTER_SANITIZE_NUMBER_INT );
|
62 |
$field_id = (string) filter_input( INPUT_POST, 'field_id' );
|
63 |
$attachment_id = (int) filter_input( INPUT_POST, 'attachment_id', FILTER_SANITIZE_NUMBER_INT );
|
67 |
delete_post_meta( $post_id, $field_id, $attachment_id );
|
68 |
$success = $force_delete ? wp_delete_attachment( $attachment_id ) : true;
|
69 |
|
70 |
+
if ( $success ) {
|
71 |
wp_send_json_success();
|
72 |
+
}
|
73 |
wp_send_json_error( __( 'Error: Cannot delete file', 'meta-box' ) );
|
74 |
}
|
75 |
|
81 |
*
|
82 |
* @return string
|
83 |
*/
|
84 |
+
public static function html( $meta, $field ) {
|
|
|
85 |
$i18n_title = apply_filters( 'rwmb_file_upload_string', _x( 'Upload Files', 'file upload', 'meta-box' ), $field );
|
86 |
$i18n_more = apply_filters( 'rwmb_file_add_string', _x( '+ Add new file', 'file upload', 'meta-box' ), $field );
|
87 |
|
88 |
// Uploaded files
|
89 |
$html = self::get_uploaded_files( $meta, $field );
|
90 |
$classes = 'new-files';
|
91 |
+
if ( ! empty( $field['max_file_uploads'] ) && count( $meta ) >= (int) $field['max_file_uploads'] ) {
|
92 |
$classes .= ' hidden';
|
93 |
+
}
|
94 |
|
95 |
// Show form upload
|
96 |
$html .= sprintf(
|
110 |
|
111 |
/**
|
112 |
* Get HTML for uploaded files.
|
113 |
+
*
|
114 |
* @param array $files List of uploaded files
|
115 |
* @param array $field Field parameters
|
116 |
* @return string
|
117 |
*/
|
118 |
+
protected static function get_uploaded_files( $files, $field ) {
|
|
|
119 |
$reorder_nonce = wp_create_nonce( "rwmb-reorder-files_{$field['id']}" );
|
120 |
$delete_nonce = wp_create_nonce( "rwmb-delete-file_{$field['id']}" );
|
121 |
|
122 |
$classes = 'rwmb-uploaded';
|
123 |
+
if ( count( $files ) <= 0 ) {
|
124 |
$classes .= ' hidden';
|
125 |
+
}
|
126 |
|
127 |
+
foreach ( (array) $files as $k => $file ) {
|
128 |
+
$files[ $k ] = self::call( $field, 'file_html', $file );
|
|
|
129 |
}
|
130 |
return sprintf(
|
131 |
'<ul class="%s" 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>',
|
142 |
|
143 |
/**
|
144 |
* Get HTML for uploaded file.
|
145 |
+
*
|
146 |
* @param int $file Attachment (file) ID
|
147 |
* @return string
|
148 |
*/
|
149 |
+
protected static function file_html( $file ) {
|
|
|
150 |
$i18n_delete = apply_filters( 'rwmb_file_delete_string', _x( 'Delete', 'file upload', 'meta-box' ) );
|
151 |
$i18n_edit = apply_filters( 'rwmb_file_edit_string', _x( 'Edit', 'file upload', 'meta-box' ) );
|
152 |
$mime_type = get_post_mime_type( $file );
|
183 |
*
|
184 |
* @return array|mixed
|
185 |
*/
|
186 |
+
public static function value( $new, $old, $post_id, $field ) {
|
187 |
+
if ( empty( $_FILES[ $field['id'] ] ) ) {
|
|
|
188 |
return $new;
|
189 |
+
}
|
190 |
|
191 |
$new = array();
|
192 |
+
$files = self::transform( $_FILES[ $field['id'] ] );
|
193 |
+
foreach ( $files as $file ) {
|
|
|
194 |
$new[] = self::upload( $file, $post_id );
|
195 |
}
|
196 |
|
199 |
|
200 |
/**
|
201 |
* Handle upload file.
|
202 |
+
*
|
203 |
* @param array $file
|
204 |
* @param int $post Post parent ID
|
205 |
* @return int Attachment ID on success, false on failure.
|
206 |
*/
|
207 |
+
protected static function upload( $file, $post ) {
|
|
|
208 |
$file = wp_handle_upload( $file, array( 'test_form' => false ) );
|
209 |
+
if ( ! isset( $file['file'] ) ) {
|
210 |
return false;
|
211 |
+
}
|
212 |
|
213 |
$attachment = wp_insert_attachment( array(
|
214 |
'post_mime_type' => $file['type'],
|
217 |
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file['file'] ) ),
|
218 |
'post_content' => '',
|
219 |
), $file['file'], $post );
|
220 |
+
if ( is_wp_error( $attachment ) || ! $attachment ) {
|
|
|
221 |
return false;
|
222 |
}
|
223 |
wp_update_attachment_metadata( $attachment, wp_generate_attachment_metadata( $attachment, $file['file'] ) );
|
226 |
|
227 |
/**
|
228 |
* Transform $_FILES from $_FILES['field']['key']['index'] to $_FILES['field']['index']['key']
|
229 |
+
*
|
230 |
* @param array $files
|
231 |
* @return array
|
232 |
*/
|
233 |
+
protected static function transform( $files ) {
|
|
|
234 |
$output = array();
|
235 |
+
foreach ( $files as $key => $list ) {
|
236 |
+
foreach ( $list as $index => $value ) {
|
237 |
+
$output[ $index ][ $key ] = $value;
|
|
|
|
|
238 |
}
|
239 |
}
|
240 |
|
243 |
|
244 |
/**
|
245 |
* Normalize parameters for field
|
246 |
+
*
|
247 |
* @param array $field
|
248 |
* @return array
|
249 |
*/
|
250 |
+
public static function normalize( $field ) {
|
|
|
251 |
$field = parent::normalize( $field );
|
252 |
$field = wp_parse_args( $field, array(
|
253 |
'std' => array(),
|
269 |
*
|
270 |
* @return mixed Full info of uploaded files
|
271 |
*/
|
272 |
+
public static function get_value( $field, $args = array(), $post_id = null ) {
|
|
|
273 |
$value = parent::get_value( $field, $args, $post_id );
|
274 |
+
if ( ! $field['clone'] ) {
|
|
|
275 |
$value = self::call( 'files_info', $field, $value, $args );
|
276 |
+
} else {
|
|
|
|
|
277 |
$return = array();
|
278 |
+
foreach ( $value as $subvalue ) {
|
|
|
279 |
$return[] = self::call( 'files_info', $field, $subvalue, $args );
|
280 |
}
|
281 |
$value = $return;
|
282 |
}
|
283 |
+
if ( isset( $args['limit'] ) ) {
|
|
|
284 |
$value = array_slice( $value, 0, intval( $args['limit'] ) );
|
285 |
}
|
286 |
return $value;
|
288 |
|
289 |
/**
|
290 |
* Get uploaded files information
|
291 |
+
*
|
292 |
* @param array $field Field parameter
|
293 |
* @param array $files Files IDs
|
294 |
* @param array $args Additional arguments (for image size)
|
295 |
* @return array
|
296 |
*/
|
297 |
+
public static function files_info( $field, $files, $args ) {
|
|
|
298 |
$return = array();
|
299 |
+
foreach ( (array) $files as $file ) {
|
300 |
+
if ( $info = self::call( $field, 'file_info', $file, $args ) ) {
|
301 |
+
$return[ $file ] = $info;
|
|
|
|
|
302 |
}
|
303 |
}
|
304 |
return $return;
|
312 |
*
|
313 |
* @return array|bool False if file not found. Array of (id, name, path, url) on success
|
314 |
*/
|
315 |
+
public static function file_info( $file, $args = array() ) {
|
316 |
+
if ( ! $path = get_attached_file( $file ) ) {
|
|
|
|
|
317 |
return false;
|
318 |
}
|
319 |
|
328 |
|
329 |
/**
|
330 |
* Format value for the helper functions.
|
331 |
+
*
|
332 |
* @param array $field Field parameter
|
333 |
* @param string|array $value The field meta value
|
334 |
* @return string
|
335 |
*/
|
336 |
+
public static function format_value( $field, $value ) {
|
337 |
+
if ( ! $field['clone'] ) {
|
|
|
|
|
338 |
return self::call( 'format_single_value', $field, $value );
|
339 |
}
|
340 |
$output = '<ul>';
|
341 |
+
foreach ( $value as $subvalue ) {
|
|
|
342 |
$output .= '<li>' . self::call( 'format_single_value', $field, $subvalue ) . '</li>';
|
343 |
}
|
344 |
$output .= '</ul>';
|
347 |
|
348 |
/**
|
349 |
* Format a single value for the helper functions.
|
350 |
+
*
|
351 |
* @param array $field Field parameter
|
352 |
* @param array $value The value
|
353 |
* @return string
|
354 |
*/
|
355 |
+
public static function format_single_value( $field, $value ) {
|
|
|
356 |
$output = '<ul>';
|
357 |
+
foreach ( $value as $file ) {
|
|
|
358 |
$output .= sprintf( '<li><a href="%s" target="_blank">%s</a></li>', $file['url'], $file['title'] );
|
359 |
}
|
360 |
$output .= '</ul>';
|
inc/fields/heading.php
CHANGED
@@ -3,15 +3,14 @@
|
|
3 |
/**
|
4 |
* Heading field class.
|
5 |
*/
|
6 |
-
class RWMB_Heading_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*
|
11 |
* @return void
|
12 |
*/
|
13 |
-
static function admin_enqueue_scripts()
|
14 |
-
{
|
15 |
wp_enqueue_style( 'rwmb-heading', RWMB_CSS_URL . 'heading.css', array(), RWMB_VER );
|
16 |
}
|
17 |
|
@@ -23,8 +22,7 @@ class RWMB_Heading_Field extends RWMB_Field
|
|
23 |
*
|
24 |
* @return string
|
25 |
*/
|
26 |
-
static function begin_html( $meta, $field )
|
27 |
-
{
|
28 |
$attributes = empty( $field['id'] ) ? '' : " id='{$field['id']}'";
|
29 |
return sprintf( '<h4%s>%s</h4>', $attributes, $field['name'] );
|
30 |
}
|
@@ -37,8 +35,7 @@ class RWMB_Heading_Field extends RWMB_Field
|
|
37 |
*
|
38 |
* @return string
|
39 |
*/
|
40 |
-
static function end_html( $meta, $field )
|
41 |
-
{
|
42 |
return self::element_description( $field );
|
43 |
}
|
44 |
}
|
3 |
/**
|
4 |
* Heading field class.
|
5 |
*/
|
6 |
+
class RWMB_Heading_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*
|
11 |
* @return void
|
12 |
*/
|
13 |
+
static function admin_enqueue_scripts() {
|
|
|
14 |
wp_enqueue_style( 'rwmb-heading', RWMB_CSS_URL . 'heading.css', array(), RWMB_VER );
|
15 |
}
|
16 |
|
22 |
*
|
23 |
* @return string
|
24 |
*/
|
25 |
+
static function begin_html( $meta, $field ) {
|
|
|
26 |
$attributes = empty( $field['id'] ) ? '' : " id='{$field['id']}'";
|
27 |
return sprintf( '<h4%s>%s</h4>', $attributes, $field['name'] );
|
28 |
}
|
35 |
*
|
36 |
* @return string
|
37 |
*/
|
38 |
+
static function end_html( $meta, $field ) {
|
|
|
39 |
return self::element_description( $field );
|
40 |
}
|
41 |
}
|
inc/fields/image-advanced.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* Image advanced field class which users WordPress media popup to upload and select images.
|
4 |
*/
|
5 |
-
class RWMB_Image_Advanced_Field extends RWMB_Media_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
parent::admin_enqueue_scripts();
|
13 |
wp_enqueue_style( 'rwmb-image-advanced', RWMB_CSS_URL . 'image-advanced.css', array( 'rwmb-media' ), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-image-advanced', RWMB_JS_URL . 'image-advanced.js', array( 'rwmb-media' ), RWMB_VER, true );
|
@@ -21,8 +20,7 @@ class RWMB_Image_Advanced_Field extends RWMB_Media_Field
|
|
21 |
*
|
22 |
* @return array
|
23 |
*/
|
24 |
-
static function normalize( $field )
|
25 |
-
{
|
26 |
$field = parent::normalize( $field );
|
27 |
$field['mime_type'] = 'image';
|
28 |
return $field;
|
@@ -30,13 +28,13 @@ class RWMB_Image_Advanced_Field extends RWMB_Media_Field
|
|
30 |
|
31 |
/**
|
32 |
* Get the field value.
|
|
|
33 |
* @param array $field
|
34 |
* @param array $args
|
35 |
* @param null $post_id
|
36 |
* @return mixed
|
37 |
*/
|
38 |
-
static function get_value( $field, $args = array(), $post_id = null )
|
39 |
-
{
|
40 |
return RWMB_Image_Field::get_value( $field, $args, $post_id );
|
41 |
}
|
42 |
|
@@ -47,39 +45,38 @@ class RWMB_Image_Advanced_Field extends RWMB_Media_Field
|
|
47 |
* @param array $args Array of arguments (for size).
|
48 |
* @return array|bool False if file not found. Array of image info on success
|
49 |
*/
|
50 |
-
static function file_info( $file, $args = array() )
|
51 |
-
{
|
52 |
return RWMB_Image_Field::file_info( $file, $args );
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
* Format value for the helper functions.
|
|
|
57 |
* @param array $field Field parameter
|
58 |
* @param string|array $value The field meta value
|
59 |
* @return string
|
60 |
*/
|
61 |
-
public static function format_value( $field, $value )
|
62 |
-
{
|
63 |
return RWMB_Image_Field::format_value( $field, $value );
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
* Format a single value for the helper functions.
|
|
|
68 |
* @param array $field Field parameter
|
69 |
* @param array $value The value
|
70 |
* @return string
|
71 |
*/
|
72 |
-
public static function format_single_value( $field, $value )
|
73 |
-
{
|
74 |
return RWMB_Image_Field::format_single_value( $field, $value );
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
* Template for media item
|
|
|
79 |
* @return void
|
80 |
*/
|
81 |
-
public static function print_templates()
|
82 |
-
{
|
83 |
parent::print_templates();
|
84 |
require_once RWMB_INC_DIR . 'templates/image-advanced.php';
|
85 |
}
|
2 |
/**
|
3 |
* Image advanced field class which users WordPress media popup to upload and select images.
|
4 |
*/
|
5 |
+
class RWMB_Image_Advanced_Field extends RWMB_Media_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
static function admin_enqueue_scripts() {
|
|
|
11 |
parent::admin_enqueue_scripts();
|
12 |
wp_enqueue_style( 'rwmb-image-advanced', RWMB_CSS_URL . 'image-advanced.css', array( 'rwmb-media' ), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-image-advanced', RWMB_JS_URL . 'image-advanced.js', array( 'rwmb-media' ), RWMB_VER, true );
|
20 |
*
|
21 |
* @return array
|
22 |
*/
|
23 |
+
static function normalize( $field ) {
|
|
|
24 |
$field = parent::normalize( $field );
|
25 |
$field['mime_type'] = 'image';
|
26 |
return $field;
|
28 |
|
29 |
/**
|
30 |
* Get the field value.
|
31 |
+
*
|
32 |
* @param array $field
|
33 |
* @param array $args
|
34 |
* @param null $post_id
|
35 |
* @return mixed
|
36 |
*/
|
37 |
+
static function get_value( $field, $args = array(), $post_id = null ) {
|
|
|
38 |
return RWMB_Image_Field::get_value( $field, $args, $post_id );
|
39 |
}
|
40 |
|
45 |
* @param array $args Array of arguments (for size).
|
46 |
* @return array|bool False if file not found. Array of image info on success
|
47 |
*/
|
48 |
+
static function file_info( $file, $args = array() ) {
|
|
|
49 |
return RWMB_Image_Field::file_info( $file, $args );
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
* Format value for the helper functions.
|
54 |
+
*
|
55 |
* @param array $field Field parameter
|
56 |
* @param string|array $value The field meta value
|
57 |
* @return string
|
58 |
*/
|
59 |
+
public static function format_value( $field, $value ) {
|
|
|
60 |
return RWMB_Image_Field::format_value( $field, $value );
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
* Format a single value for the helper functions.
|
65 |
+
*
|
66 |
* @param array $field Field parameter
|
67 |
* @param array $value The value
|
68 |
* @return string
|
69 |
*/
|
70 |
+
public static function format_single_value( $field, $value ) {
|
|
|
71 |
return RWMB_Image_Field::format_single_value( $field, $value );
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
* Template for media item
|
76 |
+
*
|
77 |
* @return void
|
78 |
*/
|
79 |
+
public static function print_templates() {
|
|
|
80 |
parent::print_templates();
|
81 |
require_once RWMB_INC_DIR . 'templates/image-advanced.php';
|
82 |
}
|
inc/fields/image-select.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
/**
|
4 |
* Image select field class which uses images as radio options.
|
5 |
*/
|
6 |
-
class RWMB_Image_Select_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
-
static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-image-select', RWMB_CSS_URL . 'image-select.css', array(), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-image-select', RWMB_JS_URL . 'image-select.js', array( 'jquery' ), RWMB_VER, true );
|
15 |
}
|
@@ -21,14 +20,12 @@ class RWMB_Image_Select_Field extends RWMB_Field
|
|
21 |
* @param array $field
|
22 |
* @return string
|
23 |
*/
|
24 |
-
static function html( $meta, $field )
|
25 |
-
{
|
26 |
$html = array();
|
27 |
$tpl = '<label class="rwmb-image-select"><img src="%s"><input type="%s" class="rwmb-image_select hidden" name="%s" value="%s"%s></label>';
|
28 |
|
29 |
$meta = (array) $meta;
|
30 |
-
foreach ( $field['options'] as $value => $image )
|
31 |
-
{
|
32 |
$html[] = sprintf(
|
33 |
$tpl,
|
34 |
$image,
|
@@ -48,8 +45,7 @@ class RWMB_Image_Select_Field extends RWMB_Field
|
|
48 |
* @param array $field
|
49 |
* @return array
|
50 |
*/
|
51 |
-
static function normalize( $field )
|
52 |
-
{
|
53 |
$field = parent::normalize( $field );
|
54 |
$field['field_name'] .= $field['multiple'] ? '[]' : '';
|
55 |
|
@@ -58,12 +54,12 @@ class RWMB_Image_Select_Field extends RWMB_Field
|
|
58 |
|
59 |
/**
|
60 |
* Format a single value for the helper functions.
|
|
|
61 |
* @param array $field Field parameter
|
62 |
* @param string $value The value
|
63 |
* @return string
|
64 |
*/
|
65 |
-
static function format_single_value( $field, $value )
|
66 |
-
|
67 |
-
return sprintf( '<img src="%s">', esc_url( $field['options'][$value] ) );
|
68 |
}
|
69 |
}
|
3 |
/**
|
4 |
* Image select field class which uses images as radio options.
|
5 |
*/
|
6 |
+
class RWMB_Image_Select_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
+
static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-image-select', RWMB_CSS_URL . 'image-select.css', array(), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-image-select', RWMB_JS_URL . 'image-select.js', array( 'jquery' ), RWMB_VER, true );
|
14 |
}
|
20 |
* @param array $field
|
21 |
* @return string
|
22 |
*/
|
23 |
+
static function html( $meta, $field ) {
|
|
|
24 |
$html = array();
|
25 |
$tpl = '<label class="rwmb-image-select"><img src="%s"><input type="%s" class="rwmb-image_select hidden" name="%s" value="%s"%s></label>';
|
26 |
|
27 |
$meta = (array) $meta;
|
28 |
+
foreach ( $field['options'] as $value => $image ) {
|
|
|
29 |
$html[] = sprintf(
|
30 |
$tpl,
|
31 |
$image,
|
45 |
* @param array $field
|
46 |
* @return array
|
47 |
*/
|
48 |
+
static function normalize( $field ) {
|
|
|
49 |
$field = parent::normalize( $field );
|
50 |
$field['field_name'] .= $field['multiple'] ? '[]' : '';
|
51 |
|
54 |
|
55 |
/**
|
56 |
* Format a single value for the helper functions.
|
57 |
+
*
|
58 |
* @param array $field Field parameter
|
59 |
* @param string $value The value
|
60 |
* @return string
|
61 |
*/
|
62 |
+
static function format_single_value( $field, $value ) {
|
63 |
+
return sprintf( '<img src="%s">', esc_url( $field['options'][ $value ] ) );
|
|
|
64 |
}
|
65 |
}
|
inc/fields/image-upload.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* File advanced field class which users WordPress media popup to upload and select files.
|
4 |
*/
|
5 |
-
class RWMB_Image_Upload_Field extends RWMB_Image_Advanced_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
public static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
parent::admin_enqueue_scripts();
|
13 |
RWMB_File_Upload_Field::admin_enqueue_scripts();
|
14 |
wp_enqueue_script( 'rwmb-image-upload', RWMB_JS_URL . 'image-upload.js', array( 'rwmb-file-upload', 'rwmb-image-advanced' ), RWMB_VER, true );
|
@@ -17,8 +16,7 @@ class RWMB_Image_Upload_Field extends RWMB_Image_Advanced_Field
|
|
17 |
/**
|
18 |
* Template for media item
|
19 |
*/
|
20 |
-
public static function print_templates()
|
21 |
-
{
|
22 |
parent::print_templates();
|
23 |
RWMB_File_Upload_Field::print_templates();
|
24 |
}
|
2 |
/**
|
3 |
* File advanced field class which users WordPress media popup to upload and select files.
|
4 |
*/
|
5 |
+
class RWMB_Image_Upload_Field extends RWMB_Image_Advanced_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
public static function admin_enqueue_scripts() {
|
|
|
11 |
parent::admin_enqueue_scripts();
|
12 |
RWMB_File_Upload_Field::admin_enqueue_scripts();
|
13 |
wp_enqueue_script( 'rwmb-image-upload', RWMB_JS_URL . 'image-upload.js', array( 'rwmb-file-upload', 'rwmb-image-advanced' ), RWMB_VER, true );
|
16 |
/**
|
17 |
* Template for media item
|
18 |
*/
|
19 |
+
public static function print_templates() {
|
|
|
20 |
parent::print_templates();
|
21 |
RWMB_File_Upload_Field::print_templates();
|
22 |
}
|
inc/fields/image.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
/**
|
4 |
* Image field class which uses <input type="file"> to upload.
|
5 |
*/
|
6 |
-
class RWMB_Image_Field extends RWMB_File_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
-
public static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
parent::admin_enqueue_scripts();
|
14 |
wp_enqueue_style( 'rwmb-image', RWMB_CSS_URL . 'image.css', array(), RWMB_VER );
|
15 |
}
|
@@ -20,8 +19,7 @@ class RWMB_Image_Field extends RWMB_File_Field
|
|
20 |
* @param int $image Image ID
|
21 |
* @return string
|
22 |
*/
|
23 |
-
public static function file_html( $image )
|
24 |
-
{
|
25 |
list( $src ) = wp_get_attachment_image_src( $image, 'thumbnail' );
|
26 |
return sprintf(
|
27 |
'<li id="item_%s">
|
@@ -40,20 +38,18 @@ class RWMB_Image_Field extends RWMB_File_Field
|
|
40 |
|
41 |
/**
|
42 |
* Format a single value for the helper functions.
|
|
|
43 |
* @param array $field Field parameter
|
44 |
* @param array $value The value
|
45 |
* @return string
|
46 |
*/
|
47 |
-
public static function format_single_value( $field, $value )
|
48 |
-
{
|
49 |
$output = '<ul>';
|
50 |
-
foreach ( $value as $file )
|
51 |
-
{
|
52 |
$img = sprintf( '<img src="%s" alt="%s">', esc_url( $file['url'] ), esc_attr( $file['alt'] ) );
|
53 |
|
54 |
// Link thumbnail to full size image?
|
55 |
-
if ( isset( $args['link'] ) && $args['link'] )
|
56 |
-
{
|
57 |
$img = sprintf( '<a href="%s" title="%s">%s</a>', esc_url( $file['full_url'] ), esc_attr( $file['title'] ), $img );
|
58 |
}
|
59 |
$output .= "<li>$img</li>";
|
@@ -70,10 +66,8 @@ class RWMB_Image_Field extends RWMB_File_Field
|
|
70 |
*
|
71 |
* @return array|bool False if file not found. Array of image info on success
|
72 |
*/
|
73 |
-
public static function file_info( $file, $args = array() )
|
74 |
-
|
75 |
-
if ( ! $path = get_attached_file( $file ) )
|
76 |
-
{
|
77 |
return false;
|
78 |
}
|
79 |
|
@@ -93,8 +87,7 @@ class RWMB_Image_Field extends RWMB_File_Field
|
|
93 |
'description' => $attachment->post_content,
|
94 |
'alt' => get_post_meta( $file, '_wp_attachment_image_alt', true ),
|
95 |
);
|
96 |
-
if ( function_exists( 'wp_get_attachment_image_srcset' ) )
|
97 |
-
{
|
98 |
$info['srcset'] = wp_get_attachment_image_srcset( $file );
|
99 |
}
|
100 |
|
3 |
/**
|
4 |
* Image field class which uses <input type="file"> to upload.
|
5 |
*/
|
6 |
+
class RWMB_Image_Field extends RWMB_File_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles.
|
10 |
*/
|
11 |
+
public static function admin_enqueue_scripts() {
|
|
|
12 |
parent::admin_enqueue_scripts();
|
13 |
wp_enqueue_style( 'rwmb-image', RWMB_CSS_URL . 'image.css', array(), RWMB_VER );
|
14 |
}
|
19 |
* @param int $image Image ID
|
20 |
* @return string
|
21 |
*/
|
22 |
+
public static function file_html( $image ) {
|
|
|
23 |
list( $src ) = wp_get_attachment_image_src( $image, 'thumbnail' );
|
24 |
return sprintf(
|
25 |
'<li id="item_%s">
|
38 |
|
39 |
/**
|
40 |
* Format a single value for the helper functions.
|
41 |
+
*
|
42 |
* @param array $field Field parameter
|
43 |
* @param array $value The value
|
44 |
* @return string
|
45 |
*/
|
46 |
+
public static function format_single_value( $field, $value ) {
|
|
|
47 |
$output = '<ul>';
|
48 |
+
foreach ( $value as $file ) {
|
|
|
49 |
$img = sprintf( '<img src="%s" alt="%s">', esc_url( $file['url'] ), esc_attr( $file['alt'] ) );
|
50 |
|
51 |
// Link thumbnail to full size image?
|
52 |
+
if ( isset( $args['link'] ) && $args['link'] ) {
|
|
|
53 |
$img = sprintf( '<a href="%s" title="%s">%s</a>', esc_url( $file['full_url'] ), esc_attr( $file['title'] ), $img );
|
54 |
}
|
55 |
$output .= "<li>$img</li>";
|
66 |
*
|
67 |
* @return array|bool False if file not found. Array of image info on success
|
68 |
*/
|
69 |
+
public static function file_info( $file, $args = array() ) {
|
70 |
+
if ( ! $path = get_attached_file( $file ) ) {
|
|
|
|
|
71 |
return false;
|
72 |
}
|
73 |
|
87 |
'description' => $attachment->post_content,
|
88 |
'alt' => get_post_meta( $file, '_wp_attachment_image_alt', true ),
|
89 |
);
|
90 |
+
if ( function_exists( 'wp_get_attachment_image_srcset' ) ) {
|
|
|
91 |
$info['srcset'] = wp_get_attachment_image_srcset( $file );
|
92 |
}
|
93 |
|
inc/fields/input-list.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* Input list field.
|
4 |
*/
|
5 |
-
class RWMB_Input_List_Field extends RWMB_Choice_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
public static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
wp_enqueue_style( 'rwmb-input-list', RWMB_CSS_URL . 'input-list.css', array(), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-input-list', RWMB_JS_URL . 'input-list.js', array(), RWMB_VER, true );
|
14 |
}
|
@@ -23,8 +22,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field
|
|
23 |
*
|
24 |
* @return string
|
25 |
*/
|
26 |
-
public static function walk( $field, $options, $db_fields, $meta )
|
27 |
-
{
|
28 |
$walker = new RWMB_Walker_Input_List( $db_fields, $field, $meta );
|
29 |
$output = sprintf( '<ul class="rwmb-input-list %s %s">',
|
30 |
$field['collapse'] ? 'collapse' : '',
|
@@ -42,8 +40,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field
|
|
42 |
* @param array $field
|
43 |
* @return array
|
44 |
*/
|
45 |
-
public static function normalize( $field )
|
46 |
-
{
|
47 |
$field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize( $field ) : $field;
|
48 |
$field = RWMB_Input_Field::normalize( $field );
|
49 |
$field = parent::normalize( $field );
|
@@ -66,8 +63,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field
|
|
66 |
*
|
67 |
* @return array
|
68 |
*/
|
69 |
-
public static function get_attributes( $field, $value = null )
|
70 |
-
{
|
71 |
$attributes = RWMB_Input_Field::get_attributes( $field, $value );
|
72 |
$attributes['id'] = false;
|
73 |
$attributes['type'] = $field['multiple'] ? 'checkbox' : 'radio';
|
2 |
/**
|
3 |
* Input list field.
|
4 |
*/
|
5 |
+
class RWMB_Input_List_Field extends RWMB_Choice_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
public static function admin_enqueue_scripts() {
|
|
|
11 |
wp_enqueue_style( 'rwmb-input-list', RWMB_CSS_URL . 'input-list.css', array(), RWMB_VER );
|
12 |
wp_enqueue_script( 'rwmb-input-list', RWMB_JS_URL . 'input-list.js', array(), RWMB_VER, true );
|
13 |
}
|
22 |
*
|
23 |
* @return string
|
24 |
*/
|
25 |
+
public static function walk( $field, $options, $db_fields, $meta ) {
|
|
|
26 |
$walker = new RWMB_Walker_Input_List( $db_fields, $field, $meta );
|
27 |
$output = sprintf( '<ul class="rwmb-input-list %s %s">',
|
28 |
$field['collapse'] ? 'collapse' : '',
|
40 |
* @param array $field
|
41 |
* @return array
|
42 |
*/
|
43 |
+
public static function normalize( $field ) {
|
|
|
44 |
$field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize( $field ) : $field;
|
45 |
$field = RWMB_Input_Field::normalize( $field );
|
46 |
$field = parent::normalize( $field );
|
63 |
*
|
64 |
* @return array
|
65 |
*/
|
66 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
67 |
$attributes = RWMB_Input_Field::get_attributes( $field, $value );
|
68 |
$attributes['id'] = false;
|
69 |
$attributes['type'] = $field['multiple'] ? 'checkbox' : 'radio';
|
inc/fields/input.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Abstract input field class which is used for all <input> fields.
|
5 |
*/
|
6 |
-
abstract class RWMB_Input_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
@@ -12,8 +12,7 @@ abstract class RWMB_Input_Field extends RWMB_Field
|
|
12 |
* @param array $field
|
13 |
* @return string
|
14 |
*/
|
15 |
-
public static function html( $meta, $field )
|
16 |
-
{
|
17 |
$attributes = self::call( 'get_attributes', $field, $meta );
|
18 |
return sprintf( '<input %s>%s', self::render_attributes( $attributes ), self::datalist( $field ) );
|
19 |
}
|
@@ -24,15 +23,13 @@ abstract class RWMB_Input_Field extends RWMB_Field
|
|
24 |
* @param array $field
|
25 |
* @return array
|
26 |
*/
|
27 |
-
public static function normalize( $field )
|
28 |
-
{
|
29 |
$field = parent::normalize( $field );
|
30 |
$field = wp_parse_args( $field, array(
|
31 |
'datalist' => false,
|
32 |
'readonly' => false,
|
33 |
) );
|
34 |
-
if ( $field['datalist'] )
|
35 |
-
{
|
36 |
$field['datalist'] = wp_parse_args( $field['datalist'], array(
|
37 |
'id' => $field['id'] . '_list',
|
38 |
'options' => array(),
|
@@ -48,8 +45,7 @@ abstract class RWMB_Input_Field extends RWMB_Field
|
|
48 |
* @param mixed $value
|
49 |
* @return array
|
50 |
*/
|
51 |
-
public static function get_attributes( $field, $value = null )
|
52 |
-
{
|
53 |
$attributes = parent::get_attributes( $field, $value );
|
54 |
$attributes = wp_parse_args( $attributes, array(
|
55 |
'list' => $field['datalist'] ? $field['datalist']['id'] : false,
|
@@ -68,15 +64,14 @@ abstract class RWMB_Input_Field extends RWMB_Field
|
|
68 |
* @param array $field
|
69 |
* @return array
|
70 |
*/
|
71 |
-
protected static function datalist( $field )
|
72 |
-
|
73 |
-
if ( empty( $field['datalist'] ) )
|
74 |
return '';
|
|
|
75 |
|
76 |
$datalist = $field['datalist'];
|
77 |
$html = sprintf( '<datalist id="%s">', $datalist['id'] );
|
78 |
-
foreach ( $datalist['options'] as $option )
|
79 |
-
{
|
80 |
$html .= sprintf( '<option value="%s"></option>', $option );
|
81 |
}
|
82 |
$html .= '</datalist>';
|
3 |
/**
|
4 |
* Abstract input field class which is used for all <input> fields.
|
5 |
*/
|
6 |
+
abstract class RWMB_Input_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
12 |
* @param array $field
|
13 |
* @return string
|
14 |
*/
|
15 |
+
public static function html( $meta, $field ) {
|
|
|
16 |
$attributes = self::call( 'get_attributes', $field, $meta );
|
17 |
return sprintf( '<input %s>%s', self::render_attributes( $attributes ), self::datalist( $field ) );
|
18 |
}
|
23 |
* @param array $field
|
24 |
* @return array
|
25 |
*/
|
26 |
+
public static function normalize( $field ) {
|
|
|
27 |
$field = parent::normalize( $field );
|
28 |
$field = wp_parse_args( $field, array(
|
29 |
'datalist' => false,
|
30 |
'readonly' => false,
|
31 |
) );
|
32 |
+
if ( $field['datalist'] ) {
|
|
|
33 |
$field['datalist'] = wp_parse_args( $field['datalist'], array(
|
34 |
'id' => $field['id'] . '_list',
|
35 |
'options' => array(),
|
45 |
* @param mixed $value
|
46 |
* @return array
|
47 |
*/
|
48 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
49 |
$attributes = parent::get_attributes( $field, $value );
|
50 |
$attributes = wp_parse_args( $attributes, array(
|
51 |
'list' => $field['datalist'] ? $field['datalist']['id'] : false,
|
64 |
* @param array $field
|
65 |
* @return array
|
66 |
*/
|
67 |
+
protected static function datalist( $field ) {
|
68 |
+
if ( empty( $field['datalist'] ) ) {
|
|
|
69 |
return '';
|
70 |
+
}
|
71 |
|
72 |
$datalist = $field['datalist'];
|
73 |
$html = sprintf( '<datalist id="%s">', $datalist['id'] );
|
74 |
+
foreach ( $datalist['options'] as $option ) {
|
|
|
75 |
$html .= sprintf( '<option value="%s"></option>', $option );
|
76 |
}
|
77 |
$html .= '</datalist>';
|
inc/fields/key-value.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Key-value field class.
|
5 |
*/
|
6 |
-
abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
7 |
-
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
@@ -12,8 +12,7 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
12 |
* @param array $field
|
13 |
* @return string
|
14 |
*/
|
15 |
-
static function html( $meta, $field )
|
16 |
-
{
|
17 |
// Key
|
18 |
$key = isset( $meta[0] ) ? $meta[0] : '';
|
19 |
$attributes = self::get_attributes( $field, $key );
|
@@ -36,12 +35,12 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
36 |
* @param array $field
|
37 |
* @return string
|
38 |
*/
|
39 |
-
static function begin_html( $meta, $field )
|
40 |
-
{
|
41 |
$desc = $field['desc'] ? "<p id='{$field['id']}_description' class='description'>{$field['desc']}</p>" : '';
|
42 |
|
43 |
-
if ( empty( $field['name'] ) )
|
44 |
return '<div class="rwmb-input">' . $desc;
|
|
|
45 |
|
46 |
return sprintf(
|
47 |
'<div class="rwmb-label">
|
@@ -57,11 +56,11 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
57 |
|
58 |
/**
|
59 |
* Do not show field description.
|
|
|
60 |
* @param array $field
|
61 |
* @return string
|
62 |
*/
|
63 |
-
public static function element_description( $field )
|
64 |
-
{
|
65 |
return '';
|
66 |
}
|
67 |
|
@@ -71,11 +70,9 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
71 |
* @param mixed $meta
|
72 |
* @return mixed
|
73 |
*/
|
74 |
-
static function esc_meta( $meta )
|
75 |
-
|
76 |
-
|
77 |
-
{
|
78 |
-
$meta[$k] = array_map( 'esc_attr', (array) $pairs );
|
79 |
}
|
80 |
return $meta;
|
81 |
}
|
@@ -90,12 +87,11 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
90 |
*
|
91 |
* @return string
|
92 |
*/
|
93 |
-
static function value( $new, $old, $post_id, $field )
|
94 |
-
|
95 |
-
|
96 |
-
{
|
97 |
-
if ( empty( $arr[0] ) && empty( $arr[1] ) )
|
98 |
$arr = false;
|
|
|
99 |
}
|
100 |
$new = array_filter( $new );
|
101 |
return $new;
|
@@ -107,8 +103,7 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
107 |
* @param array $field
|
108 |
* @return array
|
109 |
*/
|
110 |
-
static function normalize( $field )
|
111 |
-
{
|
112 |
$field = parent::normalize( $field );
|
113 |
$field['clone'] = true;
|
114 |
$field['multiple'] = true;
|
@@ -122,15 +117,14 @@ abstract class RWMB_Key_Value_Field extends RWMB_Text_Field
|
|
122 |
|
123 |
/**
|
124 |
* Format value for the helper functions.
|
|
|
125 |
* @param array $field Field parameter
|
126 |
* @param string|array $value The field meta value
|
127 |
* @return string
|
128 |
*/
|
129 |
-
public static function format_value( $field, $value )
|
130 |
-
{
|
131 |
$output = '<ul>';
|
132 |
-
foreach ( $value as $subvalue )
|
133 |
-
{
|
134 |
$output .= sprintf( '<li><label>%s</label>: %s</li>', $subvalue[0], $subvalue[1] );
|
135 |
}
|
136 |
$output .= '</ul>';
|
3 |
/**
|
4 |
* Key-value field class.
|
5 |
*/
|
6 |
+
abstract class RWMB_Key_Value_Field extends RWMB_Text_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
12 |
* @param array $field
|
13 |
* @return string
|
14 |
*/
|
15 |
+
static function html( $meta, $field ) {
|
|
|
16 |
// Key
|
17 |
$key = isset( $meta[0] ) ? $meta[0] : '';
|
18 |
$attributes = self::get_attributes( $field, $key );
|
35 |
* @param array $field
|
36 |
* @return string
|
37 |
*/
|
38 |
+
static function begin_html( $meta, $field ) {
|
|
|
39 |
$desc = $field['desc'] ? "<p id='{$field['id']}_description' class='description'>{$field['desc']}</p>" : '';
|
40 |
|
41 |
+
if ( empty( $field['name'] ) ) {
|
42 |
return '<div class="rwmb-input">' . $desc;
|
43 |
+
}
|
44 |
|
45 |
return sprintf(
|
46 |
'<div class="rwmb-label">
|
56 |
|
57 |
/**
|
58 |
* Do not show field description.
|
59 |
+
*
|
60 |
* @param array $field
|
61 |
* @return string
|
62 |
*/
|
63 |
+
public static function element_description( $field ) {
|
|
|
64 |
return '';
|
65 |
}
|
66 |
|
70 |
* @param mixed $meta
|
71 |
* @return mixed
|
72 |
*/
|
73 |
+
static function esc_meta( $meta ) {
|
74 |
+
foreach ( (array) $meta as $k => $pairs ) {
|
75 |
+
$meta[ $k ] = array_map( 'esc_attr', (array) $pairs );
|
|
|
|
|
76 |
}
|
77 |
return $meta;
|
78 |
}
|
87 |
*
|
88 |
* @return string
|
89 |
*/
|
90 |
+
static function value( $new, $old, $post_id, $field ) {
|
91 |
+
foreach ( $new as &$arr ) {
|
92 |
+
if ( empty( $arr[0] ) && empty( $arr[1] ) ) {
|
|
|
|
|
93 |
$arr = false;
|
94 |
+
}
|
95 |
}
|
96 |
$new = array_filter( $new );
|
97 |
return $new;
|
103 |
* @param array $field
|
104 |
* @return array
|
105 |
*/
|
106 |
+
static function normalize( $field ) {
|
|
|
107 |
$field = parent::normalize( $field );
|
108 |
$field['clone'] = true;
|
109 |
$field['multiple'] = true;
|
117 |
|
118 |
/**
|
119 |
* Format value for the helper functions.
|
120 |
+
*
|
121 |
* @param array $field Field parameter
|
122 |
* @param string|array $value The field meta value
|
123 |
* @return string
|
124 |
*/
|
125 |
+
public static function format_value( $field, $value ) {
|
|
|
126 |
$output = '<ul>';
|
127 |
+
foreach ( $value as $subvalue ) {
|
|
|
128 |
$output .= sprintf( '<li><label>%s</label>: %s</li>', $subvalue[0], $subvalue[1] );
|
129 |
}
|
130 |
$output .= '</ul>';
|
inc/fields/map.php
CHANGED
@@ -2,26 +2,27 @@
|
|
2 |
/**
|
3 |
* Map field class.
|
4 |
*/
|
5 |
-
class RWMB_Map_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
static function admin_enqueue_scripts()
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
* Allows developers load more libraries via a filter.
|
|
|
25 |
* @link https://developers.google.com/maps/documentation/javascript/libraries
|
26 |
*/
|
27 |
$google_maps_url = apply_filters( 'rwmb_google_maps_url', $google_maps_url );
|
@@ -38,8 +39,7 @@ class RWMB_Map_Field extends RWMB_Field
|
|
38 |
*
|
39 |
* @return string
|
40 |
*/
|
41 |
-
static function html( $meta, $field )
|
42 |
-
{
|
43 |
$html = '<div class="rwmb-map-field">';
|
44 |
|
45 |
$html .= sprintf(
|
@@ -50,8 +50,7 @@ class RWMB_Map_Field extends RWMB_Field
|
|
50 |
esc_attr( $meta )
|
51 |
);
|
52 |
|
53 |
-
if ( $address = $field['address_field'] )
|
54 |
-
{
|
55 |
$html .= sprintf(
|
56 |
'<button class="button rwmb-map-goto-address-button" value="%s">%s</button>',
|
57 |
is_array( $address ) ? implode( ',', $address ) : $address,
|
@@ -71,16 +70,15 @@ class RWMB_Map_Field extends RWMB_Field
|
|
71 |
*
|
72 |
* @return array
|
73 |
*/
|
74 |
-
static function normalize( $field )
|
75 |
-
{
|
76 |
$field = parent::normalize( $field );
|
77 |
$field = wp_parse_args( $field, array(
|
78 |
-
|
79 |
-
|
80 |
|
81 |
// Default API key, required by Google Maps since June 2016.
|
82 |
// Users should overwrite this key with their own key.
|
83 |
-
|
84 |
) );
|
85 |
|
86 |
return $field;
|
@@ -97,8 +95,7 @@ class RWMB_Map_Field extends RWMB_Field
|
|
97 |
*
|
98 |
* @return mixed Array(latitude, longitude, zoom)
|
99 |
*/
|
100 |
-
static function get_value( $field, $args = array(), $post_id = null )
|
101 |
-
{
|
102 |
$value = parent::get_value( $field, $args, $post_id );
|
103 |
list( $latitude, $longitude, $zoom ) = explode( ',', $value . ',,' );
|
104 |
return compact( 'latitude', 'longitude', 'zoom' );
|
@@ -114,32 +111,15 @@ class RWMB_Map_Field extends RWMB_Field
|
|
114 |
*
|
115 |
* @return mixed Field value
|
116 |
*/
|
117 |
-
static function the_value( $field, $args = array(), $post_id = null )
|
118 |
-
{
|
119 |
$value = self::get_value( $field, $args, $post_id );
|
120 |
-
if ( ! $value['latitude'] || ! $value['longitude'] )
|
121 |
-
{
|
122 |
return '';
|
123 |
}
|
124 |
-
if ( ! $value['zoom'] )
|
125 |
-
{
|
126 |
$value['zoom'] = 14;
|
127 |
}
|
128 |
|
129 |
-
/**
|
130 |
-
* Enqueue scripts
|
131 |
-
* Note: We still can enqueue script which outputs in the footer
|
132 |
-
*/
|
133 |
-
/**
|
134 |
-
* Allows developers load more libraries via a filter.
|
135 |
-
* @link https://developers.google.com/maps/documentation/javascript/libraries
|
136 |
-
*/
|
137 |
-
$google_maps_url = add_query_arg( 'key', $field['api_key'], 'https://maps.google.com/maps/api/js' );
|
138 |
-
$google_maps_url = apply_filters( 'rwmb_google_maps_url', $google_maps_url );
|
139 |
-
wp_register_script( 'google-maps', esc_url_raw( $google_maps_url ), array(), '', true );
|
140 |
-
wp_enqueue_script( 'rwmb-map-frontend', RWMB_JS_URL . 'map-frontend.js', array( 'google-maps' ), '', true );
|
141 |
-
|
142 |
-
// Map parameters
|
143 |
$args = wp_parse_args( $args, array(
|
144 |
'latitude' => $value['latitude'],
|
145 |
'longitude' => $value['longitude'],
|
@@ -149,9 +129,29 @@ class RWMB_Map_Field extends RWMB_Field
|
|
149 |
'marker_title' => '', // Marker title, when hover
|
150 |
'info_window' => '', // Content of info window (when click on marker). HTML allowed
|
151 |
'js_options' => array(),
|
|
|
|
|
|
|
|
|
152 |
) );
|
153 |
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
* Google Maps options
|
156 |
* Option name is the same as specified in Google Maps documentation
|
157 |
* This array will be convert to Javascript Object and pass as map options
|
2 |
/**
|
3 |
* Map field class.
|
4 |
*/
|
5 |
+
class RWMB_Map_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
static function admin_enqueue_scripts() {
|
13 |
+
/**
|
14 |
+
* Since June 2016, Google Maps requires a valid API key.
|
15 |
+
*
|
16 |
+
* @link http://googlegeodevelopers.blogspot.com/2016/06/building-for-scale-updates-to-google.html
|
17 |
+
* @link https://developers.google.com/maps/documentation/javascript/get-api-key
|
18 |
+
*/
|
19 |
+
$args = func_get_args();
|
20 |
+
$field = $args[0];
|
21 |
+
$google_maps_url = add_query_arg( 'key', $field['api_key'], 'https://maps.google.com/maps/api/js' );
|
22 |
+
|
23 |
+
/**
|
24 |
* Allows developers load more libraries via a filter.
|
25 |
+
*
|
26 |
* @link https://developers.google.com/maps/documentation/javascript/libraries
|
27 |
*/
|
28 |
$google_maps_url = apply_filters( 'rwmb_google_maps_url', $google_maps_url );
|
39 |
*
|
40 |
* @return string
|
41 |
*/
|
42 |
+
static function html( $meta, $field ) {
|
|
|
43 |
$html = '<div class="rwmb-map-field">';
|
44 |
|
45 |
$html .= sprintf(
|
50 |
esc_attr( $meta )
|
51 |
);
|
52 |
|
53 |
+
if ( $address = $field['address_field'] ) {
|
|
|
54 |
$html .= sprintf(
|
55 |
'<button class="button rwmb-map-goto-address-button" value="%s">%s</button>',
|
56 |
is_array( $address ) ? implode( ',', $address ) : $address,
|
70 |
*
|
71 |
* @return array
|
72 |
*/
|
73 |
+
static function normalize( $field ) {
|
|
|
74 |
$field = parent::normalize( $field );
|
75 |
$field = wp_parse_args( $field, array(
|
76 |
+
'std' => '',
|
77 |
+
'address_field' => '',
|
78 |
|
79 |
// Default API key, required by Google Maps since June 2016.
|
80 |
// Users should overwrite this key with their own key.
|
81 |
+
'api_key' => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ',
|
82 |
) );
|
83 |
|
84 |
return $field;
|
95 |
*
|
96 |
* @return mixed Array(latitude, longitude, zoom)
|
97 |
*/
|
98 |
+
static function get_value( $field, $args = array(), $post_id = null ) {
|
|
|
99 |
$value = parent::get_value( $field, $args, $post_id );
|
100 |
list( $latitude, $longitude, $zoom ) = explode( ',', $value . ',,' );
|
101 |
return compact( 'latitude', 'longitude', 'zoom' );
|
111 |
*
|
112 |
* @return mixed Field value
|
113 |
*/
|
114 |
+
static function the_value( $field, $args = array(), $post_id = null ) {
|
|
|
115 |
$value = self::get_value( $field, $args, $post_id );
|
116 |
+
if ( ! $value['latitude'] || ! $value['longitude'] ) {
|
|
|
117 |
return '';
|
118 |
}
|
119 |
+
if ( ! $value['zoom'] ) {
|
|
|
120 |
$value['zoom'] = 14;
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
$args = wp_parse_args( $args, array(
|
124 |
'latitude' => $value['latitude'],
|
125 |
'longitude' => $value['longitude'],
|
129 |
'marker_title' => '', // Marker title, when hover
|
130 |
'info_window' => '', // Content of info window (when click on marker). HTML allowed
|
131 |
'js_options' => array(),
|
132 |
+
|
133 |
+
// Default API key, required by Google Maps since June 2016.
|
134 |
+
// Users should overwrite this key with their own key.
|
135 |
+
'api_key' => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ',
|
136 |
) );
|
137 |
|
138 |
+
/*
|
139 |
+
* Enqueue scripts
|
140 |
+
* API key is get from $field (if found by RWMB_Helper::find_field()) or $args as a fallback
|
141 |
+
* Note: We still can enqueue script which outputs in the footer
|
142 |
+
*/
|
143 |
+
$api_key = isset( $field['api_key'] ) ? $field['api_key'] : $args['api_key'];
|
144 |
+
$google_maps_url = add_query_arg( 'key', $api_key, 'https://maps.google.com/maps/api/js' );
|
145 |
+
|
146 |
+
/*
|
147 |
+
* Allows developers load more libraries via a filter.
|
148 |
+
* @link https://developers.google.com/maps/documentation/javascript/libraries
|
149 |
+
*/
|
150 |
+
$google_maps_url = apply_filters( 'rwmb_google_maps_url', $google_maps_url );
|
151 |
+
wp_register_script( 'google-maps', esc_url_raw( $google_maps_url ), array(), '', true );
|
152 |
+
wp_enqueue_script( 'rwmb-map-frontend', RWMB_JS_URL . 'map-frontend.js', array( 'google-maps' ), '', true );
|
153 |
+
|
154 |
+
/*
|
155 |
* Google Maps options
|
156 |
* Option name is the same as specified in Google Maps documentation
|
157 |
* This array will be convert to Javascript Object and pass as map options
|
inc/fields/media.php
CHANGED
@@ -3,46 +3,36 @@
|
|
3 |
/**
|
4 |
* Media field class which users WordPress media popup to upload and select files.
|
5 |
*/
|
6 |
-
class RWMB_Media_Field extends RWMB_File_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
-
public static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_media();
|
14 |
wp_enqueue_style( 'rwmb-media', RWMB_CSS_URL . 'media.css', array(), RWMB_VER );
|
15 |
wp_enqueue_script( 'rwmb-media', RWMB_JS_URL . 'media.js', array( 'jquery-ui-sortable', 'underscore', 'backbone', 'media-grid' ), RWMB_VER, true );
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
'noTitle' => _x( 'No Title', 'media', 'meta-box' ),
|
32 |
-
'loadingUrl' => RWMB_URL . 'img/loader.gif',
|
33 |
-
'extensions' => self::get_mime_extensions(),
|
34 |
-
'select' => apply_filters( 'rwmb_media_select_string', _x( 'Select Files', 'media', 'meta-box' ) ),
|
35 |
-
'or' => apply_filters( 'rwmb_media_or_string', _x( 'or', 'media', 'meta-box' ) ),
|
36 |
-
'uploadInstructions' => apply_filters( 'rwmb_media_upload_instructions_string', _x( 'Drop files here to upload', 'media', 'meta-box' ) ),
|
37 |
-
) );
|
38 |
-
}
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* Add actions
|
43 |
*/
|
44 |
-
public static function add_actions()
|
45 |
-
{
|
46 |
$args = func_get_args();
|
47 |
$field = reset( $args );
|
48 |
add_action( 'print_media_templates', array( self::get_class_name( $field ), 'print_templates' ) );
|
@@ -56,8 +46,7 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
56 |
*
|
57 |
* @return string
|
58 |
*/
|
59 |
-
public static function html( $meta, $field )
|
60 |
-
{
|
61 |
$meta = (array) $meta;
|
62 |
$meta = implode( ',', $meta );
|
63 |
$attributes = $load_test_attr = self::get_attributes( $field, $meta );
|
@@ -82,8 +71,7 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
82 |
*
|
83 |
* @return array
|
84 |
*/
|
85 |
-
public static function normalize( $field )
|
86 |
-
{
|
87 |
$field = parent::normalize( $field );
|
88 |
$field = wp_parse_args( $field, array(
|
89 |
'std' => array(),
|
@@ -106,8 +94,7 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
106 |
*
|
107 |
* @return array
|
108 |
*/
|
109 |
-
public static function get_attributes( $field, $value = null )
|
110 |
-
{
|
111 |
$attributes = parent::get_attributes( $field, $value );
|
112 |
$attributes['type'] = 'hidden';
|
113 |
$attributes['name'] .= ! $field['clone'] && $field['multiple'] ? '[]' : '';
|
@@ -120,21 +107,21 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
120 |
|
121 |
/**
|
122 |
* Get supported mime extensions.
|
|
|
123 |
* @return array
|
124 |
*/
|
125 |
-
protected static function get_mime_extensions()
|
126 |
-
{
|
127 |
$mime_types = wp_get_mime_types();
|
128 |
$extensions = array();
|
129 |
-
foreach ( $mime_types as $ext => $mime )
|
130 |
-
{
|
131 |
$ext = explode( '|', $ext );
|
132 |
-
$extensions[$mime] = $ext;
|
133 |
|
134 |
$mime_parts = explode( '/', $mime );
|
135 |
-
if ( empty( $extensions[$mime_parts[0]] ) )
|
136 |
-
$extensions[$mime_parts[0]] = array();
|
137 |
-
|
|
|
138 |
|
139 |
}
|
140 |
|
@@ -151,10 +138,9 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
151 |
*
|
152 |
* @return array|mixed
|
153 |
*/
|
154 |
-
public static function value( $new, $old, $post_id, $field )
|
155 |
-
{
|
156 |
array_walk( $new, 'absint' );
|
157 |
-
return array_filter(
|
158 |
}
|
159 |
|
160 |
/**
|
@@ -165,8 +151,7 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
165 |
* @param $post_id
|
166 |
* @param $field
|
167 |
*/
|
168 |
-
public static function save( $new, $old, $post_id, $field )
|
169 |
-
{
|
170 |
delete_post_meta( $post_id, $field['id'] );
|
171 |
parent::save( $new, array(), $post_id, $field );
|
172 |
}
|
@@ -174,8 +159,7 @@ class RWMB_Media_Field extends RWMB_File_Field
|
|
174 |
/**
|
175 |
* Template for media item
|
176 |
*/
|
177 |
-
public static function print_templates()
|
178 |
-
{
|
179 |
require_once RWMB_INC_DIR . 'templates/media.php';
|
180 |
}
|
181 |
}
|
3 |
/**
|
4 |
* Media field class which users WordPress media popup to upload and select files.
|
5 |
*/
|
6 |
+
class RWMB_Media_Field extends RWMB_File_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
+
public static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_media();
|
13 |
wp_enqueue_style( 'rwmb-media', RWMB_CSS_URL . 'media.css', array(), RWMB_VER );
|
14 |
wp_enqueue_script( 'rwmb-media', RWMB_JS_URL . 'media.js', array( 'jquery-ui-sortable', 'underscore', 'backbone', 'media-grid' ), RWMB_VER, true );
|
15 |
|
16 |
+
self::localize_script( 'rwmb-media', 'i18nRwmbMedia', array(
|
17 |
+
'add' => apply_filters( 'rwmb_media_add_string', _x( '+ Add Media', 'media', 'meta-box' ) ),
|
18 |
+
'single' => apply_filters( 'rwmb_media_single_files_string', _x( ' file', 'media', 'meta-box' ) ),
|
19 |
+
'multiple' => apply_filters( 'rwmb_media_multiple_files_string', _x( ' files', 'media', 'meta-box' ) ),
|
20 |
+
'remove' => apply_filters( 'rwmb_media_remove_string', _x( 'Remove', 'media', 'meta-box' ) ),
|
21 |
+
'edit' => apply_filters( 'rwmb_media_edit_string', _x( 'Edit', 'media', 'meta-box' ) ),
|
22 |
+
'view' => apply_filters( 'rwmb_media_view_string', _x( 'View', 'media', 'meta-box' ) ),
|
23 |
+
'noTitle' => _x( 'No Title', 'media', 'meta-box' ),
|
24 |
+
'loadingUrl' => RWMB_URL . 'img/loader.gif',
|
25 |
+
'extensions' => self::get_mime_extensions(),
|
26 |
+
'select' => apply_filters( 'rwmb_media_select_string', _x( 'Select Files', 'media', 'meta-box' ) ),
|
27 |
+
'or' => apply_filters( 'rwmb_media_or_string', _x( 'or', 'media', 'meta-box' ) ),
|
28 |
+
'uploadInstructions' => apply_filters( 'rwmb_media_upload_instructions_string', _x( 'Drop files here to upload', 'media', 'meta-box' ) ),
|
29 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
* Add actions
|
34 |
*/
|
35 |
+
public static function add_actions() {
|
|
|
36 |
$args = func_get_args();
|
37 |
$field = reset( $args );
|
38 |
add_action( 'print_media_templates', array( self::get_class_name( $field ), 'print_templates' ) );
|
46 |
*
|
47 |
* @return string
|
48 |
*/
|
49 |
+
public static function html( $meta, $field ) {
|
|
|
50 |
$meta = (array) $meta;
|
51 |
$meta = implode( ',', $meta );
|
52 |
$attributes = $load_test_attr = self::get_attributes( $field, $meta );
|
71 |
*
|
72 |
* @return array
|
73 |
*/
|
74 |
+
public static function normalize( $field ) {
|
|
|
75 |
$field = parent::normalize( $field );
|
76 |
$field = wp_parse_args( $field, array(
|
77 |
'std' => array(),
|
94 |
*
|
95 |
* @return array
|
96 |
*/
|
97 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
98 |
$attributes = parent::get_attributes( $field, $value );
|
99 |
$attributes['type'] = 'hidden';
|
100 |
$attributes['name'] .= ! $field['clone'] && $field['multiple'] ? '[]' : '';
|
107 |
|
108 |
/**
|
109 |
* Get supported mime extensions.
|
110 |
+
*
|
111 |
* @return array
|
112 |
*/
|
113 |
+
protected static function get_mime_extensions() {
|
|
|
114 |
$mime_types = wp_get_mime_types();
|
115 |
$extensions = array();
|
116 |
+
foreach ( $mime_types as $ext => $mime ) {
|
|
|
117 |
$ext = explode( '|', $ext );
|
118 |
+
$extensions[ $mime ] = $ext;
|
119 |
|
120 |
$mime_parts = explode( '/', $mime );
|
121 |
+
if ( empty( $extensions[ $mime_parts[0] ] ) ) {
|
122 |
+
$extensions[ $mime_parts[0] ] = array();
|
123 |
+
}
|
124 |
+
$extensions[ $mime_parts[0] ] = $extensions[ $mime_parts[0] . '/*' ] = array_merge( $extensions[ $mime_parts[0] ], $ext );
|
125 |
|
126 |
}
|
127 |
|
138 |
*
|
139 |
* @return array|mixed
|
140 |
*/
|
141 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
142 |
array_walk( $new, 'absint' );
|
143 |
+
return array_filter( array_unique( $new ) );
|
144 |
}
|
145 |
|
146 |
/**
|
151 |
* @param $post_id
|
152 |
* @param $field
|
153 |
*/
|
154 |
+
public static function save( $new, $old, $post_id, $field ) {
|
|
|
155 |
delete_post_meta( $post_id, $field['id'] );
|
156 |
parent::save( $new, array(), $post_id, $field );
|
157 |
}
|
159 |
/**
|
160 |
* Template for media item
|
161 |
*/
|
162 |
+
public static function print_templates() {
|
|
|
163 |
require_once RWMB_INC_DIR . 'templates/media.php';
|
164 |
}
|
165 |
}
|
inc/fields/multiple-values.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
* - If field is cloneable, value is saved as a single entry in the database
|
9 |
* - Otherwise value is saved as multiple entries
|
10 |
*/
|
11 |
-
abstract class RWMB_Multiple_Values_Field extends RWMB_Field
|
12 |
-
|
13 |
/**
|
14 |
* Normalize parameters for field
|
15 |
*
|
@@ -17,25 +17,25 @@ abstract class RWMB_Multiple_Values_Field extends RWMB_Field
|
|
17 |
*
|
18 |
* @return array
|
19 |
*/
|
20 |
-
static function normalize( $field )
|
21 |
-
{
|
22 |
$field = parent::normalize( $field );
|
23 |
$field['multiple'] = true;
|
24 |
$field['field_name'] = $field['id'];
|
25 |
-
if ( ! $field['clone'] )
|
26 |
$field['field_name'] .= '[]';
|
|
|
27 |
|
28 |
return $field;
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
* Format a single value for the helper functions.
|
|
|
33 |
* @param array $field Field parameter
|
34 |
* @param string $value The value
|
35 |
* @return string
|
36 |
*/
|
37 |
-
static function format_single_value( $field, $value )
|
38 |
-
|
39 |
-
return $field['options'][$value];
|
40 |
}
|
41 |
}
|
8 |
* - If field is cloneable, value is saved as a single entry in the database
|
9 |
* - Otherwise value is saved as multiple entries
|
10 |
*/
|
11 |
+
abstract class RWMB_Multiple_Values_Field extends RWMB_Field {
|
12 |
+
|
13 |
/**
|
14 |
* Normalize parameters for field
|
15 |
*
|
17 |
*
|
18 |
* @return array
|
19 |
*/
|
20 |
+
static function normalize( $field ) {
|
|
|
21 |
$field = parent::normalize( $field );
|
22 |
$field['multiple'] = true;
|
23 |
$field['field_name'] = $field['id'];
|
24 |
+
if ( ! $field['clone'] ) {
|
25 |
$field['field_name'] .= '[]';
|
26 |
+
}
|
27 |
|
28 |
return $field;
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
* Format a single value for the helper functions.
|
33 |
+
*
|
34 |
* @param array $field Field parameter
|
35 |
* @param string $value The value
|
36 |
* @return string
|
37 |
*/
|
38 |
+
static function format_single_value( $field, $value ) {
|
39 |
+
return $field['options'][ $value ];
|
|
|
40 |
}
|
41 |
}
|
inc/fields/number.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Number field class.
|
4 |
*/
|
5 |
-
class RWMB_Number_Field extends RWMB_Input_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
@@ -11,8 +11,7 @@ class RWMB_Number_Field extends RWMB_Input_Field
|
|
11 |
*
|
12 |
* @return array
|
13 |
*/
|
14 |
-
static function normalize( $field )
|
15 |
-
{
|
16 |
$field = parent::normalize( $field );
|
17 |
|
18 |
$field = wp_parse_args( $field, array(
|
@@ -32,8 +31,7 @@ class RWMB_Number_Field extends RWMB_Input_Field
|
|
32 |
*
|
33 |
* @return array
|
34 |
*/
|
35 |
-
static function get_attributes( $field, $value = null )
|
36 |
-
{
|
37 |
$attributes = parent::get_attributes( $field, $value );
|
38 |
$attributes = wp_parse_args( $attributes, array(
|
39 |
'step' => $field['step'],
|
2 |
/**
|
3 |
* Number field class.
|
4 |
*/
|
5 |
+
class RWMB_Number_Field extends RWMB_Input_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
11 |
*
|
12 |
* @return array
|
13 |
*/
|
14 |
+
static function normalize( $field ) {
|
|
|
15 |
$field = parent::normalize( $field );
|
16 |
|
17 |
$field = wp_parse_args( $field, array(
|
31 |
*
|
32 |
* @return array
|
33 |
*/
|
34 |
+
static function get_attributes( $field, $value = null ) {
|
|
|
35 |
$attributes = parent::get_attributes( $field, $value );
|
36 |
$attributes = wp_parse_args( $attributes, array(
|
37 |
'step' => $field['step'],
|
inc/fields/object-choice.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Abstract field to select an object: post, user, taxonomy, etc.
|
5 |
*/
|
6 |
-
abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
7 |
-
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
@@ -14,8 +14,7 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
14 |
* @param array $field
|
15 |
* @return string
|
16 |
*/
|
17 |
-
public static function walk( $field, $options, $db_fields, $meta )
|
18 |
-
{
|
19 |
return call_user_func( array( self::get_type_class( $field ), 'walk' ), $field, $options, $db_fields, $meta );
|
20 |
}
|
21 |
|
@@ -26,8 +25,7 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
26 |
*
|
27 |
* @return array
|
28 |
*/
|
29 |
-
public static function normalize( $field )
|
30 |
-
{
|
31 |
$field = parent::normalize( $field );
|
32 |
$field = wp_parse_args( $field, array(
|
33 |
'flatten' => true,
|
@@ -35,17 +33,14 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
35 |
'field_type' => 'select_advanced',
|
36 |
) );
|
37 |
|
38 |
-
if ( 'checkbox_tree' === $field['field_type'] )
|
39 |
-
{
|
40 |
$field['field_type'] = 'checkbox_list';
|
41 |
$field['flatten'] = false;
|
42 |
}
|
43 |
-
if ( 'radio_list' == $field['field_type'] )
|
44 |
-
{
|
45 |
$field['multiple'] = false;
|
46 |
}
|
47 |
-
if ( 'checkbox_list' == $field['field_type'] )
|
48 |
-
{
|
49 |
$field['multiple'] = true;
|
50 |
}
|
51 |
return call_user_func( array( self::get_type_class( $field ), 'normalize' ), $field );
|
@@ -59,11 +54,9 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
59 |
*
|
60 |
* @return array
|
61 |
*/
|
62 |
-
public static function get_attributes( $field, $value = null )
|
63 |
-
{
|
64 |
$attributes = call_user_func( array( self::get_type_class( $field ), 'get_attributes' ), $field, $value );
|
65 |
-
if ( 'select_advanced' == $field['field_type'] )
|
66 |
-
{
|
67 |
$attributes['class'] .= ' rwmb-select_advanced';
|
68 |
}
|
69 |
return $attributes;
|
@@ -71,10 +64,10 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
71 |
|
72 |
/**
|
73 |
* Get field names of object to be used by walker
|
|
|
74 |
* @return array
|
75 |
*/
|
76 |
-
public static function get_db_fields()
|
77 |
-
{
|
78 |
return array(
|
79 |
'parent' => '',
|
80 |
'id' => '',
|
@@ -86,8 +79,7 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
86 |
/**
|
87 |
* Enqueue scripts and styles
|
88 |
*/
|
89 |
-
public static function admin_enqueue_scripts()
|
90 |
-
{
|
91 |
RWMB_Input_List_Field::admin_enqueue_scripts();
|
92 |
RWMB_Select_Field::admin_enqueue_scripts();
|
93 |
RWMB_Select_Tree_Field::admin_enqueue_scripts();
|
@@ -96,13 +88,12 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field
|
|
96 |
|
97 |
/**
|
98 |
* Get correct rendering class for the field.
|
|
|
99 |
* @param array $field Field parameter
|
100 |
* @return string
|
101 |
*/
|
102 |
-
protected static function get_type_class( $field )
|
103 |
-
|
104 |
-
if ( in_array( $field['field_type'], array( 'checkbox_list', 'radio_list' ) ) )
|
105 |
-
{
|
106 |
return 'RWMB_Input_List_Field';
|
107 |
}
|
108 |
return self::get_class_name( array( 'type' => $field['field_type'] ) );
|
3 |
/**
|
4 |
* Abstract field to select an object: post, user, taxonomy, etc.
|
5 |
*/
|
6 |
+
abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
14 |
* @param array $field
|
15 |
* @return string
|
16 |
*/
|
17 |
+
public static function walk( $field, $options, $db_fields, $meta ) {
|
|
|
18 |
return call_user_func( array( self::get_type_class( $field ), 'walk' ), $field, $options, $db_fields, $meta );
|
19 |
}
|
20 |
|
25 |
*
|
26 |
* @return array
|
27 |
*/
|
28 |
+
public static function normalize( $field ) {
|
|
|
29 |
$field = parent::normalize( $field );
|
30 |
$field = wp_parse_args( $field, array(
|
31 |
'flatten' => true,
|
33 |
'field_type' => 'select_advanced',
|
34 |
) );
|
35 |
|
36 |
+
if ( 'checkbox_tree' === $field['field_type'] ) {
|
|
|
37 |
$field['field_type'] = 'checkbox_list';
|
38 |
$field['flatten'] = false;
|
39 |
}
|
40 |
+
if ( 'radio_list' == $field['field_type'] ) {
|
|
|
41 |
$field['multiple'] = false;
|
42 |
}
|
43 |
+
if ( 'checkbox_list' == $field['field_type'] ) {
|
|
|
44 |
$field['multiple'] = true;
|
45 |
}
|
46 |
return call_user_func( array( self::get_type_class( $field ), 'normalize' ), $field );
|
54 |
*
|
55 |
* @return array
|
56 |
*/
|
57 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
58 |
$attributes = call_user_func( array( self::get_type_class( $field ), 'get_attributes' ), $field, $value );
|
59 |
+
if ( 'select_advanced' == $field['field_type'] ) {
|
|
|
60 |
$attributes['class'] .= ' rwmb-select_advanced';
|
61 |
}
|
62 |
return $attributes;
|
64 |
|
65 |
/**
|
66 |
* Get field names of object to be used by walker
|
67 |
+
*
|
68 |
* @return array
|
69 |
*/
|
70 |
+
public static function get_db_fields() {
|
|
|
71 |
return array(
|
72 |
'parent' => '',
|
73 |
'id' => '',
|
79 |
/**
|
80 |
* Enqueue scripts and styles
|
81 |
*/
|
82 |
+
public static function admin_enqueue_scripts() {
|
|
|
83 |
RWMB_Input_List_Field::admin_enqueue_scripts();
|
84 |
RWMB_Select_Field::admin_enqueue_scripts();
|
85 |
RWMB_Select_Tree_Field::admin_enqueue_scripts();
|
88 |
|
89 |
/**
|
90 |
* Get correct rendering class for the field.
|
91 |
+
*
|
92 |
* @param array $field Field parameter
|
93 |
* @return string
|
94 |
*/
|
95 |
+
protected static function get_type_class( $field ) {
|
96 |
+
if ( in_array( $field['field_type'], array( 'checkbox_list', 'radio_list' ) ) ) {
|
|
|
|
|
97 |
return 'RWMB_Input_List_Field';
|
98 |
}
|
99 |
return self::get_class_name( array( 'type' => $field['field_type'] ) );
|
inc/fields/oembed.php
CHANGED
@@ -3,13 +3,12 @@
|
|
3 |
/**
|
4 |
* oEmbed field class.
|
5 |
*/
|
6 |
-
class RWMB_OEmbed_Field extends RWMB_Text_Field
|
7 |
-
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
-
public static function admin_enqueue_scripts()
|
12 |
-
{
|
13 |
wp_enqueue_style( 'rwmb-oembed', RWMB_CSS_URL . 'oembed.css' );
|
14 |
wp_enqueue_script( 'rwmb-oembed', RWMB_JS_URL . 'oembed.js', array(), RWMB_VER, true );
|
15 |
}
|
@@ -17,16 +16,14 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
17 |
/**
|
18 |
* Add actions
|
19 |
*/
|
20 |
-
public static function add_actions()
|
21 |
-
{
|
22 |
add_action( 'wp_ajax_rwmb_get_embed', array( __CLASS__, 'wp_ajax_get_embed' ) );
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
* Ajax callback for returning oEmbed HTML
|
27 |
*/
|
28 |
-
public static function wp_ajax_get_embed()
|
29 |
-
{
|
30 |
$url = (string) filter_input( INPUT_POST, 'url', FILTER_SANITIZE_URL );
|
31 |
wp_send_json_success( self::get_embed( $url ) );
|
32 |
}
|
@@ -37,19 +34,18 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
37 |
* @param string $url
|
38 |
* @return string
|
39 |
*/
|
40 |
-
public static function get_embed( $url )
|
41 |
-
{
|
42 |
/**
|
43 |
* Set arguments for getting embeded HTML.
|
44 |
* Without arguments, default width will be taken from global $content_width, which can break UI in the admin
|
|
|
45 |
* @link https://github.com/rilwis/meta-box/issues/801
|
46 |
* @see WP_oEmbed::fetch()
|
47 |
* @see WP_Embed::shortcode()
|
48 |
* @see wp_embed_defaults()
|
49 |
*/
|
50 |
$args = array();
|
51 |
-
if ( is_admin() )
|
52 |
-
{
|
53 |
$args['width'] = 360;
|
54 |
}
|
55 |
|
@@ -57,8 +53,7 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
57 |
$embed = wp_oembed_get( $url, $args );
|
58 |
|
59 |
// If no oembed provides found, try WordPress auto embed
|
60 |
-
if ( ! $embed )
|
61 |
-
{
|
62 |
$embed = $GLOBALS['wp_embed']->shortcode( $args, $url );
|
63 |
}
|
64 |
|
@@ -72,8 +67,7 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
72 |
* @param array $field
|
73 |
* @return string
|
74 |
*/
|
75 |
-
public static function html( $meta, $field )
|
76 |
-
{
|
77 |
return parent::html( $meta, $field ) . sprintf(
|
78 |
'<a href="#" class="rwmb-embed-show button">%s</a>
|
79 |
<span class="spinner"></span>
|
@@ -91,8 +85,7 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
91 |
*
|
92 |
* @return array
|
93 |
*/
|
94 |
-
public static function get_attributes( $field, $value = null )
|
95 |
-
{
|
96 |
$attributes = parent::get_attributes( $field, $value );
|
97 |
$attributes['type'] = 'url';
|
98 |
return $attributes;
|
@@ -100,12 +93,12 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field
|
|
100 |
|
101 |
/**
|
102 |
* Format a single value for the helper functions.
|
|
|
103 |
* @param array $field Field parameter
|
104 |
* @param string $value The value
|
105 |
* @return string
|
106 |
*/
|
107 |
-
public static function format_single_value( $field, $value )
|
108 |
-
{
|
109 |
return self::get_embed( $value );
|
110 |
}
|
111 |
}
|
3 |
/**
|
4 |
* oEmbed field class.
|
5 |
*/
|
6 |
+
class RWMB_OEmbed_Field extends RWMB_Text_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Enqueue scripts and styles
|
10 |
*/
|
11 |
+
public static function admin_enqueue_scripts() {
|
|
|
12 |
wp_enqueue_style( 'rwmb-oembed', RWMB_CSS_URL . 'oembed.css' );
|
13 |
wp_enqueue_script( 'rwmb-oembed', RWMB_JS_URL . 'oembed.js', array(), RWMB_VER, true );
|
14 |
}
|
16 |
/**
|
17 |
* Add actions
|
18 |
*/
|
19 |
+
public static function add_actions() {
|
|
|
20 |
add_action( 'wp_ajax_rwmb_get_embed', array( __CLASS__, 'wp_ajax_get_embed' ) );
|
21 |
}
|
22 |
|
23 |
/**
|
24 |
* Ajax callback for returning oEmbed HTML
|
25 |
*/
|
26 |
+
public static function wp_ajax_get_embed() {
|
|
|
27 |
$url = (string) filter_input( INPUT_POST, 'url', FILTER_SANITIZE_URL );
|
28 |
wp_send_json_success( self::get_embed( $url ) );
|
29 |
}
|
34 |
* @param string $url
|
35 |
* @return string
|
36 |
*/
|
37 |
+
public static function get_embed( $url ) {
|
|
|
38 |
/**
|
39 |
* Set arguments for getting embeded HTML.
|
40 |
* Without arguments, default width will be taken from global $content_width, which can break UI in the admin
|
41 |
+
*
|
42 |
* @link https://github.com/rilwis/meta-box/issues/801
|
43 |
* @see WP_oEmbed::fetch()
|
44 |
* @see WP_Embed::shortcode()
|
45 |
* @see wp_embed_defaults()
|
46 |
*/
|
47 |
$args = array();
|
48 |
+
if ( is_admin() ) {
|
|
|
49 |
$args['width'] = 360;
|
50 |
}
|
51 |
|
53 |
$embed = wp_oembed_get( $url, $args );
|
54 |
|
55 |
// If no oembed provides found, try WordPress auto embed
|
56 |
+
if ( ! $embed ) {
|
|
|
57 |
$embed = $GLOBALS['wp_embed']->shortcode( $args, $url );
|
58 |
}
|
59 |
|
67 |
* @param array $field
|
68 |
* @return string
|
69 |
*/
|
70 |
+
public static function html( $meta, $field ) {
|
|
|
71 |
return parent::html( $meta, $field ) . sprintf(
|
72 |
'<a href="#" class="rwmb-embed-show button">%s</a>
|
73 |
<span class="spinner"></span>
|
85 |
*
|
86 |
* @return array
|
87 |
*/
|
88 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
89 |
$attributes = parent::get_attributes( $field, $value );
|
90 |
$attributes['type'] = 'url';
|
91 |
return $attributes;
|
93 |
|
94 |
/**
|
95 |
* Format a single value for the helper functions.
|
96 |
+
*
|
97 |
* @param array $field Field parameter
|
98 |
* @param string $value The value
|
99 |
* @return string
|
100 |
*/
|
101 |
+
public static function format_single_value( $field, $value ) {
|
|
|
102 |
return self::get_embed( $value );
|
103 |
}
|
104 |
}
|
inc/fields/password.php
CHANGED
@@ -2,18 +2,18 @@
|
|
2 |
/**
|
3 |
* Password field class.
|
4 |
*/
|
5 |
-
class RWMB_Password_Field extends RWMB_Text_Field
|
6 |
-
|
7 |
/**
|
8 |
* Store secured password in the database.
|
|
|
9 |
* @param mixed $new
|
10 |
* @param mixed $old
|
11 |
* @param int $post_id
|
12 |
* @param array $field
|
13 |
* @return string
|
14 |
*/
|
15 |
-
static function value( $new, $old, $post_id, $field )
|
16 |
-
{
|
17 |
$new = $new != $old ? wp_hash_password( $new ) : $new;
|
18 |
return $new;
|
19 |
}
|
2 |
/**
|
3 |
* Password field class.
|
4 |
*/
|
5 |
+
class RWMB_Password_Field extends RWMB_Text_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Store secured password in the database.
|
9 |
+
*
|
10 |
* @param mixed $new
|
11 |
* @param mixed $old
|
12 |
* @param int $post_id
|
13 |
* @param array $field
|
14 |
* @return string
|
15 |
*/
|
16 |
+
static function value( $new, $old, $post_id, $field ) {
|
|
|
17 |
$new = $new != $old ? wp_hash_password( $new ) : $new;
|
18 |
return $new;
|
19 |
}
|
inc/fields/post.php
CHANGED
@@ -2,16 +2,15 @@
|
|
2 |
/**
|
3 |
* Post field class.
|
4 |
*/
|
5 |
-
class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
-
public static function normalize( $field )
|
14 |
-
{
|
15 |
/**
|
16 |
* Set default field args
|
17 |
*/
|
@@ -21,19 +20,18 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
21 |
'parent' => false,
|
22 |
) );
|
23 |
|
24 |
-
if ( ! isset( $field['query_args']['post_type'] ) )
|
25 |
$field['query_args']['post_type'] = $field['post_type'];
|
|
|
26 |
|
27 |
/**
|
28 |
* Set default placeholder
|
29 |
* - If multiple post types: show 'Select a post'
|
30 |
* - If single post type: show 'Select a %post_type_name%'
|
31 |
*/
|
32 |
-
if ( empty( $field['placeholder'] ) )
|
33 |
-
{
|
34 |
$field['placeholder'] = __( 'Select a post', 'meta-box' );
|
35 |
-
if ( is_string( $field['query_args']['post_type'] ) && post_type_exists( $field['query_args']['post_type'] ) )
|
36 |
-
{
|
37 |
$post_type_object = get_post_type_object( $field['query_args']['post_type'] );
|
38 |
$field['placeholder'] = sprintf( __( 'Select a %s', 'meta-box' ), $post_type_object->labels->singular_name );
|
39 |
}
|
@@ -42,8 +40,7 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
42 |
/**
|
43 |
* Set parent option, which will change field name to `parent_id` to save as post parent
|
44 |
*/
|
45 |
-
if ( $field['parent'] )
|
46 |
-
{
|
47 |
$field['multiple'] = false;
|
48 |
$field['field_name'] = 'parent_id';
|
49 |
}
|
@@ -64,8 +61,7 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
64 |
*
|
65 |
* @return array
|
66 |
*/
|
67 |
-
public static function get_db_fields()
|
68 |
-
{
|
69 |
return array(
|
70 |
'parent' => 'post_parent',
|
71 |
'id' => 'ID',
|
@@ -86,10 +82,8 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
86 |
*
|
87 |
* @return array
|
88 |
*/
|
89 |
-
public static function meta( $post_id, $saved, $field )
|
90 |
-
|
91 |
-
if ( isset( $field['parent'] ) && $field['parent'] )
|
92 |
-
{
|
93 |
$post = get_post( $post_id );
|
94 |
return $post->post_parent;
|
95 |
}
|
@@ -103,8 +97,7 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
103 |
* @param array $field
|
104 |
* @return array
|
105 |
*/
|
106 |
-
public static function get_options( $field )
|
107 |
-
{
|
108 |
$query = new WP_Query( $field['query_args'] );
|
109 |
return $query->have_posts() ? $query->posts : array();
|
110 |
}
|
@@ -117,8 +110,7 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field
|
|
117 |
*
|
118 |
* @return string
|
119 |
*/
|
120 |
-
public static function get_option_label( $field, $value )
|
121 |
-
{
|
122 |
return sprintf(
|
123 |
'<a href="%s" title="%s">%s</a>',
|
124 |
esc_url( get_permalink( $value ) ),
|
2 |
/**
|
3 |
* Post field class.
|
4 |
*/
|
5 |
+
class RWMB_Post_Field extends RWMB_Object_Choice_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
+
public static function normalize( $field ) {
|
|
|
14 |
/**
|
15 |
* Set default field args
|
16 |
*/
|
20 |
'parent' => false,
|
21 |
) );
|
22 |
|
23 |
+
if ( ! isset( $field['query_args']['post_type'] ) ) {
|
24 |
$field['query_args']['post_type'] = $field['post_type'];
|
25 |
+
}
|
26 |
|
27 |
/**
|
28 |
* Set default placeholder
|
29 |
* - If multiple post types: show 'Select a post'
|
30 |
* - If single post type: show 'Select a %post_type_name%'
|
31 |
*/
|
32 |
+
if ( empty( $field['placeholder'] ) ) {
|
|
|
33 |
$field['placeholder'] = __( 'Select a post', 'meta-box' );
|
34 |
+
if ( is_string( $field['query_args']['post_type'] ) && post_type_exists( $field['query_args']['post_type'] ) ) {
|
|
|
35 |
$post_type_object = get_post_type_object( $field['query_args']['post_type'] );
|
36 |
$field['placeholder'] = sprintf( __( 'Select a %s', 'meta-box' ), $post_type_object->labels->singular_name );
|
37 |
}
|
40 |
/**
|
41 |
* Set parent option, which will change field name to `parent_id` to save as post parent
|
42 |
*/
|
43 |
+
if ( $field['parent'] ) {
|
|
|
44 |
$field['multiple'] = false;
|
45 |
$field['field_name'] = 'parent_id';
|
46 |
}
|
61 |
*
|
62 |
* @return array
|
63 |
*/
|
64 |
+
public static function get_db_fields() {
|
|
|
65 |
return array(
|
66 |
'parent' => 'post_parent',
|
67 |
'id' => 'ID',
|
82 |
*
|
83 |
* @return array
|
84 |
*/
|
85 |
+
public static function meta( $post_id, $saved, $field ) {
|
86 |
+
if ( isset( $field['parent'] ) && $field['parent'] ) {
|
|
|
|
|
87 |
$post = get_post( $post_id );
|
88 |
return $post->post_parent;
|
89 |
}
|
97 |
* @param array $field
|
98 |
* @return array
|
99 |
*/
|
100 |
+
public static function get_options( $field ) {
|
|
|
101 |
$query = new WP_Query( $field['query_args'] );
|
102 |
return $query->have_posts() ? $query->posts : array();
|
103 |
}
|
110 |
*
|
111 |
* @return string
|
112 |
*/
|
113 |
+
public static function get_option_label( $field, $value ) {
|
|
|
114 |
return sprintf(
|
115 |
'<a href="%s" title="%s">%s</a>',
|
116 |
esc_url( get_permalink( $value ) ),
|
inc/fields/radio.php
CHANGED
@@ -2,15 +2,15 @@
|
|
2 |
/**
|
3 |
* Radio field class.
|
4 |
*/
|
5 |
-
class RWMB_Radio_Field extends RWMB_Input_List_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
|
|
9 |
* @param array $field
|
10 |
* @return array
|
11 |
*/
|
12 |
-
static function normalize( $field )
|
13 |
-
{
|
14 |
$field['multiple'] = false;
|
15 |
$field = parent::normalize( $field );
|
16 |
|
2 |
/**
|
3 |
* Radio field class.
|
4 |
*/
|
5 |
+
class RWMB_Radio_Field extends RWMB_Input_List_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
+
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
+
static function normalize( $field ) {
|
|
|
14 |
$field['multiple'] = false;
|
15 |
$field = parent::normalize( $field );
|
16 |
|
inc/fields/range.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* HTML5 range field class.
|
4 |
*/
|
5 |
-
class RWMB_Range_Field extends RWMB_Number_Field
|
6 |
-
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
@@ -11,8 +11,7 @@ class RWMB_Range_Field extends RWMB_Number_Field
|
|
11 |
* @param array $field
|
12 |
* @return string
|
13 |
*/
|
14 |
-
public static function html( $meta, $field )
|
15 |
-
{
|
16 |
$output = parent::html( $meta, $field );
|
17 |
$output .= sprintf( '<span class="rwmb-output">%s</span>', $meta );
|
18 |
return $output;
|
@@ -21,19 +20,18 @@ class RWMB_Range_Field extends RWMB_Number_Field
|
|
21 |
/**
|
22 |
* Enqueue styles
|
23 |
*/
|
24 |
-
public static function admin_enqueue_scripts()
|
25 |
-
{
|
26 |
wp_enqueue_style( 'rwmb-range', RWMB_CSS_URL . 'range.css', array(), RWMB_VER );
|
27 |
wp_enqueue_script( 'rwmb-range', RWMB_JS_URL . 'range.js', array(), RWMB_VER, true );
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Normalize parameters for field.
|
|
|
32 |
* @param array $field
|
33 |
* @return array
|
34 |
*/
|
35 |
-
public static function normalize( $field )
|
36 |
-
{
|
37 |
$field = wp_parse_args( $field, array(
|
38 |
'max' => 10,
|
39 |
) );
|
@@ -51,18 +49,15 @@ class RWMB_Range_Field extends RWMB_Number_Field
|
|
51 |
*
|
52 |
* @return int
|
53 |
*/
|
54 |
-
public static function value( $new, $old, $post_id, $field )
|
55 |
-
{
|
56 |
$new = intval( $new );
|
57 |
$min = intval( $field['min'] );
|
58 |
$max = intval( $field['max'] );
|
59 |
|
60 |
-
if ( $new < $min )
|
61 |
-
{
|
62 |
return $min;
|
63 |
}
|
64 |
-
if ( $new > $max )
|
65 |
-
{
|
66 |
return $max;
|
67 |
}
|
68 |
return $new;
|
2 |
/**
|
3 |
* HTML5 range field class.
|
4 |
*/
|
5 |
+
class RWMB_Range_Field extends RWMB_Number_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
11 |
* @param array $field
|
12 |
* @return string
|
13 |
*/
|
14 |
+
public static function html( $meta, $field ) {
|
|
|
15 |
$output = parent::html( $meta, $field );
|
16 |
$output .= sprintf( '<span class="rwmb-output">%s</span>', $meta );
|
17 |
return $output;
|
20 |
/**
|
21 |
* Enqueue styles
|
22 |
*/
|
23 |
+
public static function admin_enqueue_scripts() {
|
|
|
24 |
wp_enqueue_style( 'rwmb-range', RWMB_CSS_URL . 'range.css', array(), RWMB_VER );
|
25 |
wp_enqueue_script( 'rwmb-range', RWMB_JS_URL . 'range.js', array(), RWMB_VER, true );
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
* Normalize parameters for field.
|
30 |
+
*
|
31 |
* @param array $field
|
32 |
* @return array
|
33 |
*/
|
34 |
+
public static function normalize( $field ) {
|
|
|
35 |
$field = wp_parse_args( $field, array(
|
36 |
'max' => 10,
|
37 |
) );
|
49 |
*
|
50 |
* @return int
|
51 |
*/
|
52 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
53 |
$new = intval( $new );
|
54 |
$min = intval( $field['min'] );
|
55 |
$max = intval( $field['max'] );
|
56 |
|
57 |
+
if ( $new < $min ) {
|
|
|
58 |
return $min;
|
59 |
}
|
60 |
+
if ( $new > $max ) {
|
|
|
61 |
return $max;
|
62 |
}
|
63 |
return $new;
|
inc/fields/select-advanced.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* Select advanced field which uses select2 library.
|
4 |
*/
|
5 |
-
class RWMB_Select_Advanced_Field extends RWMB_Select_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
public static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
parent::admin_enqueue_scripts();
|
13 |
wp_enqueue_style( 'rwmb-select2', RWMB_CSS_URL . 'select2/select2.css', array(), '4.0.1' );
|
14 |
wp_enqueue_style( 'rwmb-select-advanced', RWMB_CSS_URL . 'select-advanced.css', array(), RWMB_VER );
|
@@ -21,8 +20,7 @@ class RWMB_Select_Advanced_Field extends RWMB_Select_Field
|
|
21 |
$locale_short = substr( $locale, 0, 2 );
|
22 |
$locale = file_exists( RWMB_DIR . "js/select2/i18n/$locale.js" ) ? $locale : $locale_short;
|
23 |
|
24 |
-
if ( file_exists( RWMB_DIR . "js/select2/i18n/$locale.js" ) )
|
25 |
-
{
|
26 |
wp_register_script( 'rwmb-select2-i18n', RWMB_JS_URL . "select2/i18n/$locale.js", array( 'rwmb-select2' ), '4.0.2', true );
|
27 |
$dependencies[] = 'rwmb-select2-i18n';
|
28 |
}
|
@@ -37,8 +35,7 @@ class RWMB_Select_Advanced_Field extends RWMB_Select_Field
|
|
37 |
* @param array $field
|
38 |
* @return array
|
39 |
*/
|
40 |
-
public static function normalize( $field )
|
41 |
-
{
|
42 |
$field = wp_parse_args( $field, array(
|
43 |
'js_options' => array(),
|
44 |
'placeholder' => __( 'Select an item', 'meta-box' ),
|
@@ -62,8 +59,7 @@ class RWMB_Select_Advanced_Field extends RWMB_Select_Field
|
|
62 |
* @param mixed $value
|
63 |
* @return array
|
64 |
*/
|
65 |
-
public static function get_attributes( $field, $value = null )
|
66 |
-
{
|
67 |
$attributes = parent::get_attributes( $field, $value );
|
68 |
$attributes = wp_parse_args( $attributes, array(
|
69 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
2 |
/**
|
3 |
* Select advanced field which uses select2 library.
|
4 |
*/
|
5 |
+
class RWMB_Select_Advanced_Field extends RWMB_Select_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
public static function admin_enqueue_scripts() {
|
|
|
11 |
parent::admin_enqueue_scripts();
|
12 |
wp_enqueue_style( 'rwmb-select2', RWMB_CSS_URL . 'select2/select2.css', array(), '4.0.1' );
|
13 |
wp_enqueue_style( 'rwmb-select-advanced', RWMB_CSS_URL . 'select-advanced.css', array(), RWMB_VER );
|
20 |
$locale_short = substr( $locale, 0, 2 );
|
21 |
$locale = file_exists( RWMB_DIR . "js/select2/i18n/$locale.js" ) ? $locale : $locale_short;
|
22 |
|
23 |
+
if ( file_exists( RWMB_DIR . "js/select2/i18n/$locale.js" ) ) {
|
|
|
24 |
wp_register_script( 'rwmb-select2-i18n', RWMB_JS_URL . "select2/i18n/$locale.js", array( 'rwmb-select2' ), '4.0.2', true );
|
25 |
$dependencies[] = 'rwmb-select2-i18n';
|
26 |
}
|
35 |
* @param array $field
|
36 |
* @return array
|
37 |
*/
|
38 |
+
public static function normalize( $field ) {
|
|
|
39 |
$field = wp_parse_args( $field, array(
|
40 |
'js_options' => array(),
|
41 |
'placeholder' => __( 'Select an item', 'meta-box' ),
|
59 |
* @param mixed $value
|
60 |
* @return array
|
61 |
*/
|
62 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
63 |
$attributes = parent::get_attributes( $field, $value );
|
64 |
$attributes = wp_parse_args( $attributes, array(
|
65 |
'data-options' => wp_json_encode( $field['js_options'] ),
|
inc/fields/select-tree.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Select tree field class.
|
4 |
*/
|
5 |
-
class RWMB_Select_Tree_Field extends RWMB_Select_Field
|
6 |
-
|
7 |
/**
|
8 |
* Walk options
|
9 |
*
|
@@ -14,8 +14,7 @@ class RWMB_Select_Tree_Field extends RWMB_Select_Field
|
|
14 |
*
|
15 |
* @return string
|
16 |
*/
|
17 |
-
public static function walk( $field, $options, $db_fields, $meta )
|
18 |
-
{
|
19 |
$walker = new RWMB_Walker_Select_Tree( $db_fields, $field, $meta );
|
20 |
return $walker->walk( $options );
|
21 |
}
|
@@ -23,8 +22,7 @@ class RWMB_Select_Tree_Field extends RWMB_Select_Field
|
|
23 |
/**
|
24 |
* Enqueue scripts and styles
|
25 |
*/
|
26 |
-
public static function admin_enqueue_scripts()
|
27 |
-
{
|
28 |
parent::admin_enqueue_scripts();
|
29 |
wp_enqueue_style( 'rwmb-select-tree', RWMB_CSS_URL . 'select-tree.css', array( 'rwmb-select' ), RWMB_VER );
|
30 |
wp_enqueue_script( 'rwmb-select-tree', RWMB_JS_URL . 'select-tree.js', array( 'rwmb-select' ), RWMB_VER, true );
|
@@ -36,8 +34,7 @@ class RWMB_Select_Tree_Field extends RWMB_Select_Field
|
|
36 |
* @param array $field
|
37 |
* @return array
|
38 |
*/
|
39 |
-
public static function normalize( $field )
|
40 |
-
{
|
41 |
$field['multiple'] = true;
|
42 |
$field['size'] = 0;
|
43 |
$field = parent::normalize( $field );
|
@@ -53,8 +50,7 @@ class RWMB_Select_Tree_Field extends RWMB_Select_Field
|
|
53 |
*
|
54 |
* @return array
|
55 |
*/
|
56 |
-
public static function get_attributes( $field, $value = null )
|
57 |
-
{
|
58 |
$attributes = parent::get_attributes( $field, $value );
|
59 |
$attributes['multiple'] = false;
|
60 |
$attributes['id'] = false;
|
2 |
/**
|
3 |
* Select tree field class.
|
4 |
*/
|
5 |
+
class RWMB_Select_Tree_Field extends RWMB_Select_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Walk options
|
9 |
*
|
14 |
*
|
15 |
* @return string
|
16 |
*/
|
17 |
+
public static function walk( $field, $options, $db_fields, $meta ) {
|
|
|
18 |
$walker = new RWMB_Walker_Select_Tree( $db_fields, $field, $meta );
|
19 |
return $walker->walk( $options );
|
20 |
}
|
22 |
/**
|
23 |
* Enqueue scripts and styles
|
24 |
*/
|
25 |
+
public static function admin_enqueue_scripts() {
|
|
|
26 |
parent::admin_enqueue_scripts();
|
27 |
wp_enqueue_style( 'rwmb-select-tree', RWMB_CSS_URL . 'select-tree.css', array( 'rwmb-select' ), RWMB_VER );
|
28 |
wp_enqueue_script( 'rwmb-select-tree', RWMB_JS_URL . 'select-tree.js', array( 'rwmb-select' ), RWMB_VER, true );
|
34 |
* @param array $field
|
35 |
* @return array
|
36 |
*/
|
37 |
+
public static function normalize( $field ) {
|
|
|
38 |
$field['multiple'] = true;
|
39 |
$field['size'] = 0;
|
40 |
$field = parent::normalize( $field );
|
50 |
*
|
51 |
* @return array
|
52 |
*/
|
53 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
54 |
$attributes = parent::get_attributes( $field, $value );
|
55 |
$attributes['multiple'] = false;
|
56 |
$attributes['id'] = false;
|
inc/fields/select.php
CHANGED
@@ -2,13 +2,12 @@
|
|
2 |
/**
|
3 |
* Select field class.
|
4 |
*/
|
5 |
-
class RWMB_Select_Field extends RWMB_Choice_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
-
public static function admin_enqueue_scripts()
|
11 |
-
{
|
12 |
wp_enqueue_style( 'rwmb-select', RWMB_CSS_URL . 'select.css', array(), RWMB_VER );
|
13 |
wp_enqueue_script( 'rwmb-select', RWMB_JS_URL . 'select.js', array(), RWMB_VER, true );
|
14 |
}
|
@@ -23,16 +22,14 @@ class RWMB_Select_Field extends RWMB_Choice_Field
|
|
23 |
*
|
24 |
* @return string
|
25 |
*/
|
26 |
-
public static function walk( $field, $options, $db_fields, $meta )
|
27 |
-
{
|
28 |
$attributes = self::call( 'get_attributes', $field, $meta );
|
29 |
$walker = new RWMB_Walker_Select( $db_fields, $field, $meta );
|
30 |
$output = sprintf(
|
31 |
'<select %s>',
|
32 |
self::render_attributes( $attributes )
|
33 |
);
|
34 |
-
if ( false === $field['multiple'] )
|
35 |
-
{
|
36 |
$output .= $field['placeholder'] ? '<option value="">' . esc_html( $field['placeholder'] ) . '</option>' : '';
|
37 |
}
|
38 |
$output .= $walker->walk( $options, $field['flatten'] ? - 1 : 0 );
|
@@ -47,8 +44,7 @@ class RWMB_Select_Field extends RWMB_Choice_Field
|
|
47 |
* @param array $field
|
48 |
* @return array
|
49 |
*/
|
50 |
-
public static function normalize( $field )
|
51 |
-
{
|
52 |
$field = parent::normalize( $field );
|
53 |
$field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize( $field ) : $field;
|
54 |
$field = wp_parse_args( $field, array(
|
@@ -67,8 +63,7 @@ class RWMB_Select_Field extends RWMB_Choice_Field
|
|
67 |
*
|
68 |
* @return array
|
69 |
*/
|
70 |
-
public static function get_attributes( $field, $value = null )
|
71 |
-
{
|
72 |
$attributes = parent::get_attributes( $field, $value );
|
73 |
$attributes = wp_parse_args( $attributes, array(
|
74 |
'multiple' => $field['multiple'],
|
@@ -84,10 +79,8 @@ class RWMB_Select_Field extends RWMB_Choice_Field
|
|
84 |
* @param array $field
|
85 |
* @return string
|
86 |
*/
|
87 |
-
public static function get_select_all_html( $field )
|
88 |
-
|
89 |
-
if ( $field['multiple'] && $field['select_all_none'] )
|
90 |
-
{
|
91 |
return '<div class="rwmb-select-all-none">' . __( 'Select', 'meta-box' ) . ': <a data-type="all" href="#">' . __( 'All', 'meta-box' ) . '</a> | <a data-type="none" href="#">' . __( 'None', 'meta-box' ) . '</a></div>';
|
92 |
}
|
93 |
return '';
|
2 |
/**
|
3 |
* Select field class.
|
4 |
*/
|
5 |
+
class RWMB_Select_Field extends RWMB_Choice_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*/
|
10 |
+
public static function admin_enqueue_scripts() {
|
|
|
11 |
wp_enqueue_style( 'rwmb-select', RWMB_CSS_URL . 'select.css', array(), RWMB_VER );
|
12 |
wp_enqueue_script( 'rwmb-select', RWMB_JS_URL . 'select.js', array(), RWMB_VER, true );
|
13 |
}
|
22 |
*
|
23 |
* @return string
|
24 |
*/
|
25 |
+
public static function walk( $field, $options, $db_fields, $meta ) {
|
|
|
26 |
$attributes = self::call( 'get_attributes', $field, $meta );
|
27 |
$walker = new RWMB_Walker_Select( $db_fields, $field, $meta );
|
28 |
$output = sprintf(
|
29 |
'<select %s>',
|
30 |
self::render_attributes( $attributes )
|
31 |
);
|
32 |
+
if ( false === $field['multiple'] ) {
|
|
|
33 |
$output .= $field['placeholder'] ? '<option value="">' . esc_html( $field['placeholder'] ) . '</option>' : '';
|
34 |
}
|
35 |
$output .= $walker->walk( $options, $field['flatten'] ? - 1 : 0 );
|
44 |
* @param array $field
|
45 |
* @return array
|
46 |
*/
|
47 |
+
public static function normalize( $field ) {
|
|
|
48 |
$field = parent::normalize( $field );
|
49 |
$field = $field['multiple'] ? RWMB_Multiple_Values_Field::normalize( $field ) : $field;
|
50 |
$field = wp_parse_args( $field, array(
|
63 |
*
|
64 |
* @return array
|
65 |
*/
|
66 |
+
public static function get_attributes( $field, $value = null ) {
|
|
|
67 |
$attributes = parent::get_attributes( $field, $value );
|
68 |
$attributes = wp_parse_args( $attributes, array(
|
69 |
'multiple' => $field['multiple'],
|
79 |
* @param array $field
|
80 |
* @return string
|
81 |
*/
|
82 |
+
public static function get_select_all_html( $field ) {
|
83 |
+
if ( $field['multiple'] && $field['select_all_none'] ) {
|
|
|
|
|
84 |
return '<div class="rwmb-select-all-none">' . __( 'Select', 'meta-box' ) . ': <a data-type="all" href="#">' . __( 'All', 'meta-box' ) . '</a> | <a data-type="none" href="#">' . __( 'None', 'meta-box' ) . '</a></div>';
|
85 |
}
|
86 |
return '';
|
inc/fields/slider.php
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
/**
|
3 |
* jQueryUI slider field class.
|
4 |
*/
|
5 |
-
class RWMB_Slider_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
static function admin_enqueue_scripts()
|
13 |
-
{
|
14 |
$url = RWMB_CSS_URL . 'jqueryui';
|
15 |
wp_enqueue_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
|
16 |
wp_enqueue_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
|
@@ -28,8 +27,7 @@ class RWMB_Slider_Field extends RWMB_Field
|
|
28 |
*
|
29 |
* @return string
|
30 |
*/
|
31 |
-
static function html( $meta, $field )
|
32 |
-
{
|
33 |
return sprintf(
|
34 |
'<div class="clearfix">
|
35 |
<div class="rwmb-slider" id="%s" data-options="%s"></div>
|
@@ -49,8 +47,7 @@ class RWMB_Slider_Field extends RWMB_Field
|
|
49 |
*
|
50 |
* @return array
|
51 |
*/
|
52 |
-
static function normalize( $field )
|
53 |
-
{
|
54 |
$field = parent::normalize( $field );
|
55 |
$field = wp_parse_args( $field, array(
|
56 |
'prefix' => '',
|
2 |
/**
|
3 |
* jQueryUI slider field class.
|
4 |
*/
|
5 |
+
class RWMB_Slider_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
static function admin_enqueue_scripts() {
|
|
|
13 |
$url = RWMB_CSS_URL . 'jqueryui';
|
14 |
wp_enqueue_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17' );
|
15 |
wp_enqueue_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17' );
|
27 |
*
|
28 |
* @return string
|
29 |
*/
|
30 |
+
static function html( $meta, $field ) {
|
|
|
31 |
return sprintf(
|
32 |
'<div class="clearfix">
|
33 |
<div class="rwmb-slider" id="%s" data-options="%s"></div>
|
47 |
*
|
48 |
* @return array
|
49 |
*/
|
50 |
+
static function normalize( $field ) {
|
|
|
51 |
$field = parent::normalize( $field );
|
52 |
$field = wp_parse_args( $field, array(
|
53 |
'prefix' => '',
|
inc/fields/taxonomy-advanced.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Taxonomy advanced field class which saves terms' IDs in the post meta.
|
4 |
*/
|
5 |
-
class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field
|
6 |
-
|
7 |
/**
|
8 |
* Get meta values to save
|
9 |
* Save terms in custom field, no more by setting post terms
|
@@ -16,8 +16,7 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field
|
|
16 |
*
|
17 |
* @return string
|
18 |
*/
|
19 |
-
public static function value( $new, $old, $post_id, $field )
|
20 |
-
{
|
21 |
return implode( ',', array_unique( (array) $new ) );
|
22 |
}
|
23 |
|
@@ -29,50 +28,25 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field
|
|
29 |
* @param int $post_id
|
30 |
* @param array $field
|
31 |
*/
|
32 |
-
public static function save( $new, $old, $post_id, $field )
|
33 |
-
|
34 |
-
if ( $new )
|
35 |
update_post_meta( $post_id, $field['id'], $new );
|
36 |
-
else
|
37 |
-
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
-
*
|
42 |
*
|
43 |
* @param int $post_id
|
44 |
-
* @param bool $saved
|
45 |
* @param array $field
|
46 |
*
|
47 |
-
* @return
|
48 |
*/
|
49 |
-
public static function
|
50 |
-
{
|
51 |
$meta = get_post_meta( $post_id, $field['id'], true );
|
52 |
$meta = wp_parse_id_list( $meta );
|
53 |
-
|
54 |
-
|
55 |
-
// Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
|
56 |
-
$meta = ! $saved ? $field['std'] : $meta;
|
57 |
-
|
58 |
-
// Escape attributes
|
59 |
-
$meta = self::call( $field, 'esc_meta', $meta );
|
60 |
-
|
61 |
-
// Make sure meta value is an array for clonable and multiple fields
|
62 |
-
if ( $field['clone'] || $field['multiple'] )
|
63 |
-
{
|
64 |
-
if ( empty( $meta ) || ! is_array( $meta ) )
|
65 |
-
{
|
66 |
-
/**
|
67 |
-
* Note: if field is clonable, $meta must be an array with values
|
68 |
-
* so that the foreach loop in self::show() runs properly
|
69 |
-
* @see self::show()
|
70 |
-
*/
|
71 |
-
$meta = $field['clone'] ? array( '' ) : array();
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
return $meta;
|
76 |
}
|
77 |
|
78 |
/**
|
@@ -85,14 +59,15 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field
|
|
85 |
*
|
86 |
* @return array List of post term objects
|
87 |
*/
|
88 |
-
public static function get_value( $field, $args = array(), $post_id = null )
|
89 |
-
|
90 |
-
if ( ! $post_id )
|
91 |
$post_id = get_the_ID();
|
|
|
92 |
|
93 |
$value = self::meta( $post_id, '', $field );
|
94 |
-
if( empty( $value ) )
|
95 |
return null;
|
|
|
96 |
|
97 |
// Allow to pass more arguments to "get_terms"
|
98 |
$args = wp_parse_args( array(
|
@@ -102,8 +77,7 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field
|
|
102 |
$value = get_terms( $field['taxonomy'], $args );
|
103 |
|
104 |
// Get single value if necessary
|
105 |
-
if ( ! $field['clone'] && ! $field['multiple'] )
|
106 |
-
{
|
107 |
$value = reset( $value );
|
108 |
}
|
109 |
return $value;
|
2 |
/**
|
3 |
* Taxonomy advanced field class which saves terms' IDs in the post meta.
|
4 |
*/
|
5 |
+
class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Get meta values to save
|
9 |
* Save terms in custom field, no more by setting post terms
|
16 |
*
|
17 |
* @return string
|
18 |
*/
|
19 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
20 |
return implode( ',', array_unique( (array) $new ) );
|
21 |
}
|
22 |
|
28 |
* @param int $post_id
|
29 |
* @param array $field
|
30 |
*/
|
31 |
+
public static function save( $new, $old, $post_id, $field ) {
|
32 |
+
if ( $new ) {
|
|
|
33 |
update_post_meta( $post_id, $field['id'], $new );
|
34 |
+
} else { delete_post_meta( $post_id, $field['id'] );
|
35 |
+
}
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
+
* Get raw meta value
|
40 |
*
|
41 |
* @param int $post_id
|
|
|
42 |
* @param array $field
|
43 |
*
|
44 |
+
* @return mixed
|
45 |
*/
|
46 |
+
public static function raw_meta( $post_id, $field ) {
|
|
|
47 |
$meta = get_post_meta( $post_id, $field['id'], true );
|
48 |
$meta = wp_parse_id_list( $meta );
|
49 |
+
return array_filter( $meta );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
/**
|
59 |
*
|
60 |
* @return array List of post term objects
|
61 |
*/
|
62 |
+
public static function get_value( $field, $args = array(), $post_id = null ) {
|
63 |
+
if ( ! $post_id ) {
|
|
|
64 |
$post_id = get_the_ID();
|
65 |
+
}
|
66 |
|
67 |
$value = self::meta( $post_id, '', $field );
|
68 |
+
if ( empty( $value ) ) {
|
69 |
return null;
|
70 |
+
}
|
71 |
|
72 |
// Allow to pass more arguments to "get_terms"
|
73 |
$args = wp_parse_args( array(
|
77 |
$value = get_terms( $field['taxonomy'], $args );
|
78 |
|
79 |
// Get single value if necessary
|
80 |
+
if ( ! $field['clone'] && ! $field['multiple'] ) {
|
|
|
81 |
$value = reset( $value );
|
82 |
}
|
83 |
return $value;
|
inc/fields/taxonomy.php
CHANGED
@@ -2,25 +2,27 @@
|
|
2 |
/**
|
3 |
* Taxonomy field class which set post terms when saving.
|
4 |
*/
|
5 |
-
class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
6 |
-
|
7 |
/**
|
8 |
* Add default value for 'taxonomy' field
|
9 |
*
|
10 |
* @param $field
|
11 |
* @return array
|
12 |
*/
|
13 |
-
public static function normalize( $field )
|
14 |
-
{
|
15 |
/**
|
16 |
* Backwards compatibility with field args
|
17 |
*/
|
18 |
-
if ( isset( $field['options']['args'] ) )
|
19 |
$field['query_args'] = $field['options']['args'];
|
20 |
-
|
|
|
21 |
$field['taxonomy'] = $field['options']['taxonomy'];
|
22 |
-
|
|
|
23 |
$field['field_type'] = $field['options']['type'];
|
|
|
24 |
|
25 |
/**
|
26 |
* Set default field args
|
@@ -42,11 +44,9 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
42 |
* - If multiple taxonomies: show 'Select a term'
|
43 |
* - If single taxonomy: show 'Select a %taxonomy_name%'
|
44 |
*/
|
45 |
-
if ( empty( $field['placeholder'] ) )
|
46 |
-
{
|
47 |
$field['placeholder'] = __( 'Select a term', 'meta-box' );
|
48 |
-
if ( is_string( $field['taxonomy'] ) && taxonomy_exists( $field['taxonomy'] ) )
|
49 |
-
{
|
50 |
$taxonomy_object = get_taxonomy( $field['taxonomy'] );
|
51 |
$field['placeholder'] = sprintf( __( 'Select a %s', 'meta-box' ), $taxonomy_object->labels->singular_name );
|
52 |
}
|
@@ -65,8 +65,7 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
65 |
*
|
66 |
* @return array
|
67 |
*/
|
68 |
-
public static function get_db_fields()
|
69 |
-
{
|
70 |
return array(
|
71 |
'parent' => 'parent',
|
72 |
'id' => 'term_id',
|
@@ -81,8 +80,7 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
81 |
*
|
82 |
* @return array
|
83 |
*/
|
84 |
-
public static function get_options( $field )
|
85 |
-
{
|
86 |
$options = get_terms( $field['taxonomy'], $field['query_args'] );
|
87 |
return $options;
|
88 |
}
|
@@ -95,49 +93,28 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
95 |
* @param int $post_id
|
96 |
* @param array $field
|
97 |
*/
|
98 |
-
public static function save( $new, $old, $post_id, $field )
|
99 |
-
{
|
100 |
$new = array_unique( array_map( 'intval', (array) $new ) );
|
101 |
$new = empty( $new ) ? null : $new;
|
102 |
wp_set_object_terms( $post_id, $new, $field['taxonomy'] );
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
-
*
|
107 |
*
|
108 |
* @param int $post_id
|
109 |
-
* @param bool $saved
|
110 |
* @param array $field
|
111 |
*
|
112 |
-
* @return
|
113 |
*/
|
114 |
-
public static function
|
115 |
-
|
116 |
-
|
117 |
-
$meta = (array) $meta;
|
118 |
-
$meta = wp_list_pluck( $meta, 'term_id' );
|
119 |
-
|
120 |
-
// Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
|
121 |
-
$meta = ! $saved ? $field['std'] : $meta;
|
122 |
-
|
123 |
-
// Escape attributes
|
124 |
-
$meta = self::call( $field, 'esc_meta', $meta );
|
125 |
-
|
126 |
-
// Make sure meta value is an array for clonable and multiple fields
|
127 |
-
if ( $field['clone'] || $field['multiple'] )
|
128 |
-
{
|
129 |
-
if ( empty( $meta ) || ! is_array( $meta ) )
|
130 |
-
{
|
131 |
-
/**
|
132 |
-
* Note: if field is clonable, $meta must be an array with values
|
133 |
-
* so that the foreach loop in self::show() runs properly
|
134 |
-
* @see self::show()
|
135 |
-
*/
|
136 |
-
$meta = $field['clone'] ? array( '' ) : array();
|
137 |
-
}
|
138 |
}
|
139 |
|
140 |
-
|
|
|
|
|
141 |
}
|
142 |
|
143 |
/**
|
@@ -150,13 +127,11 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
150 |
*
|
151 |
* @return array List of post term objects
|
152 |
*/
|
153 |
-
public static function get_value( $field, $args = array(), $post_id = null )
|
154 |
-
{
|
155 |
$value = get_the_terms( $post_id, $field['taxonomy'] );
|
156 |
|
157 |
// Get single value if necessary
|
158 |
-
if ( ! $field['clone'] && ! $field['multiple'] && is_array( $value ) )
|
159 |
-
{
|
160 |
$value = reset( $value );
|
161 |
}
|
162 |
return $value;
|
@@ -165,13 +140,12 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field
|
|
165 |
/**
|
166 |
* Get option label
|
167 |
*
|
168 |
-
* @param string
|
169 |
-
* @param array
|
170 |
*
|
171 |
* @return string
|
172 |
*/
|
173 |
-
public static function get_option_label( $field, $value )
|
174 |
-
{
|
175 |
return sprintf(
|
176 |
'<a href="%s" title="%s">%s</a>',
|
177 |
esc_url( get_term_link( $value ) ),
|
2 |
/**
|
3 |
* Taxonomy field class which set post terms when saving.
|
4 |
*/
|
5 |
+
class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Add default value for 'taxonomy' field
|
9 |
*
|
10 |
* @param $field
|
11 |
* @return array
|
12 |
*/
|
13 |
+
public static function normalize( $field ) {
|
|
|
14 |
/**
|
15 |
* Backwards compatibility with field args
|
16 |
*/
|
17 |
+
if ( isset( $field['options']['args'] ) ) {
|
18 |
$field['query_args'] = $field['options']['args'];
|
19 |
+
}
|
20 |
+
if ( isset( $field['options']['taxonomy'] ) ) {
|
21 |
$field['taxonomy'] = $field['options']['taxonomy'];
|
22 |
+
}
|
23 |
+
if ( isset( $field['options']['type'] ) ) {
|
24 |
$field['field_type'] = $field['options']['type'];
|
25 |
+
}
|
26 |
|
27 |
/**
|
28 |
* Set default field args
|
44 |
* - If multiple taxonomies: show 'Select a term'
|
45 |
* - If single taxonomy: show 'Select a %taxonomy_name%'
|
46 |
*/
|
47 |
+
if ( empty( $field['placeholder'] ) ) {
|
|
|
48 |
$field['placeholder'] = __( 'Select a term', 'meta-box' );
|
49 |
+
if ( is_string( $field['taxonomy'] ) && taxonomy_exists( $field['taxonomy'] ) ) {
|
|
|
50 |
$taxonomy_object = get_taxonomy( $field['taxonomy'] );
|
51 |
$field['placeholder'] = sprintf( __( 'Select a %s', 'meta-box' ), $taxonomy_object->labels->singular_name );
|
52 |
}
|
65 |
*
|
66 |
* @return array
|
67 |
*/
|
68 |
+
public static function get_db_fields() {
|
|
|
69 |
return array(
|
70 |
'parent' => 'parent',
|
71 |
'id' => 'term_id',
|
80 |
*
|
81 |
* @return array
|
82 |
*/
|
83 |
+
public static function get_options( $field ) {
|
|
|
84 |
$options = get_terms( $field['taxonomy'], $field['query_args'] );
|
85 |
return $options;
|
86 |
}
|
93 |
* @param int $post_id
|
94 |
* @param array $field
|
95 |
*/
|
96 |
+
public static function save( $new, $old, $post_id, $field ) {
|
|
|
97 |
$new = array_unique( array_map( 'intval', (array) $new ) );
|
98 |
$new = empty( $new ) ? null : $new;
|
99 |
wp_set_object_terms( $post_id, $new, $field['taxonomy'] );
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
+
* Get raw meta value
|
104 |
*
|
105 |
* @param int $post_id
|
|
|
106 |
* @param array $field
|
107 |
*
|
108 |
+
* @return mixed
|
109 |
*/
|
110 |
+
public static function raw_meta( $post_id, $field ) {
|
111 |
+
if ( empty( $field['id'] ) ) {
|
112 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
+
$meta = get_the_terms( $post_id, $field['taxonomy'] );
|
116 |
+
$meta = (array) $meta;
|
117 |
+
return wp_list_pluck( $meta, 'term_id' );
|
118 |
}
|
119 |
|
120 |
/**
|
127 |
*
|
128 |
* @return array List of post term objects
|
129 |
*/
|
130 |
+
public static function get_value( $field, $args = array(), $post_id = null ) {
|
|
|
131 |
$value = get_the_terms( $post_id, $field['taxonomy'] );
|
132 |
|
133 |
// Get single value if necessary
|
134 |
+
if ( ! $field['clone'] && ! $field['multiple'] && is_array( $value ) ) {
|
|
|
135 |
$value = reset( $value );
|
136 |
}
|
137 |
return $value;
|
140 |
/**
|
141 |
* Get option label
|
142 |
*
|
143 |
+
* @param string $value Option value
|
144 |
+
* @param array $field Field parameter
|
145 |
*
|
146 |
* @return string
|
147 |
*/
|
148 |
+
public static function get_option_label( $field, $value ) {
|
|
|
149 |
return sprintf(
|
150 |
'<a href="%s" title="%s">%s</a>',
|
151 |
esc_url( get_term_link( $value ) ),
|
inc/fields/text-list.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
/**
|
4 |
* Text list field class.
|
5 |
*/
|
6 |
-
class RWMB_Text_List_Field extends RWMB_Multiple_Values_Field
|
7 |
-
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
@@ -13,18 +13,16 @@ class RWMB_Text_List_Field extends RWMB_Multiple_Values_Field
|
|
13 |
*
|
14 |
* @return string
|
15 |
*/
|
16 |
-
static function html( $meta, $field )
|
17 |
-
{
|
18 |
$html = array();
|
19 |
$input = '<label><input type="text" class="rwmb-text-list" name="%s" value="%s" placeholder="%s"> %s</label>';
|
20 |
|
21 |
$count = 0;
|
22 |
-
foreach ( $field['options'] as $placeholder => $label )
|
23 |
-
{
|
24 |
$html[] = sprintf(
|
25 |
$input,
|
26 |
$field['field_name'],
|
27 |
-
isset( $meta[$count] ) ? esc_attr( $meta[$count] ) : '',
|
28 |
$placeholder,
|
29 |
$label
|
30 |
);
|
@@ -36,27 +34,22 @@ class RWMB_Text_List_Field extends RWMB_Multiple_Values_Field
|
|
36 |
|
37 |
/**
|
38 |
* Format value for the helper functions.
|
|
|
39 |
* @param array $field Field parameter
|
40 |
* @param string|array $value The field meta value
|
41 |
* @return string
|
42 |
*/
|
43 |
-
public static function format_value( $field, $value )
|
44 |
-
{
|
45 |
$output = '<table><thead><tr>';
|
46 |
-
foreach ( $field['options'] as $label )
|
47 |
-
{
|
48 |
$output .= "<th>$label</th>";
|
49 |
}
|
50 |
$output .= '<tr>';
|
51 |
|
52 |
-
if ( ! $field['clone'] )
|
53 |
-
{
|
54 |
$output .= self::format_single_value( $field, $value );
|
55 |
-
}
|
56 |
-
|
57 |
-
{
|
58 |
-
foreach ( $value as $subvalue )
|
59 |
-
{
|
60 |
$output .= self::format_single_value( $field, $subvalue );
|
61 |
}
|
62 |
}
|
@@ -66,15 +59,14 @@ class RWMB_Text_List_Field extends RWMB_Multiple_Values_Field
|
|
66 |
|
67 |
/**
|
68 |
* Format a single value for the helper functions.
|
|
|
69 |
* @param array $field Field parameter
|
70 |
* @param array $value The value
|
71 |
* @return string
|
72 |
*/
|
73 |
-
public static function format_single_value( $field, $value )
|
74 |
-
{
|
75 |
$output = '<tr>';
|
76 |
-
foreach ( $value as $subvalue )
|
77 |
-
{
|
78 |
$output .= "<td>$subvalue</td>";
|
79 |
}
|
80 |
$output .= '</tr>';
|
3 |
/**
|
4 |
* Text list field class.
|
5 |
*/
|
6 |
+
class RWMB_Text_List_Field extends RWMB_Multiple_Values_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Get field HTML
|
10 |
*
|
13 |
*
|
14 |
* @return string
|
15 |
*/
|
16 |
+
static function html( $meta, $field ) {
|
|
|
17 |
$html = array();
|
18 |
$input = '<label><input type="text" class="rwmb-text-list" name="%s" value="%s" placeholder="%s"> %s</label>';
|
19 |
|
20 |
$count = 0;
|
21 |
+
foreach ( $field['options'] as $placeholder => $label ) {
|
|
|
22 |
$html[] = sprintf(
|
23 |
$input,
|
24 |
$field['field_name'],
|
25 |
+
isset( $meta[ $count ] ) ? esc_attr( $meta[ $count ] ) : '',
|
26 |
$placeholder,
|
27 |
$label
|
28 |
);
|
34 |
|
35 |
/**
|
36 |
* Format value for the helper functions.
|
37 |
+
*
|
38 |
* @param array $field Field parameter
|
39 |
* @param string|array $value The field meta value
|
40 |
* @return string
|
41 |
*/
|
42 |
+
public static function format_value( $field, $value ) {
|
|
|
43 |
$output = '<table><thead><tr>';
|
44 |
+
foreach ( $field['options'] as $label ) {
|
|
|
45 |
$output .= "<th>$label</th>";
|
46 |
}
|
47 |
$output .= '<tr>';
|
48 |
|
49 |
+
if ( ! $field['clone'] ) {
|
|
|
50 |
$output .= self::format_single_value( $field, $value );
|
51 |
+
} else {
|
52 |
+
foreach ( $value as $subvalue ) {
|
|
|
|
|
|
|
53 |
$output .= self::format_single_value( $field, $subvalue );
|
54 |
}
|
55 |
}
|
59 |
|
60 |
/**
|
61 |
* Format a single value for the helper functions.
|
62 |
+
*
|
63 |
* @param array $field Field parameter
|
64 |
* @param array $value The value
|
65 |
* @return string
|
66 |
*/
|
67 |
+
public static function format_single_value( $field, $value ) {
|
|
|
68 |
$output = '<tr>';
|
69 |
+
foreach ( $value as $subvalue ) {
|
|
|
70 |
$output .= "<td>$subvalue</td>";
|
71 |
}
|
72 |
$output .= '</tr>';
|
inc/fields/text.php
CHANGED
@@ -2,16 +2,15 @@
|
|
2 |
/**
|
3 |
* Text field class.
|
4 |
*/
|
5 |
-
class RWMB_Text_Field extends RWMB_Input_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
-
static function normalize( $field )
|
14 |
-
{
|
15 |
$field = parent::normalize( $field );
|
16 |
|
17 |
$field = wp_parse_args( $field, array(
|
@@ -31,8 +30,7 @@ class RWMB_Text_Field extends RWMB_Input_Field
|
|
31 |
*
|
32 |
* @return array
|
33 |
*/
|
34 |
-
static function get_attributes( $field, $value = null )
|
35 |
-
{
|
36 |
$attributes = parent::get_attributes( $field, $value );
|
37 |
$attributes = wp_parse_args( $attributes, array(
|
38 |
'size' => $field['size'],
|
2 |
/**
|
3 |
* Text field class.
|
4 |
*/
|
5 |
+
class RWMB_Text_Field extends RWMB_Input_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
10 |
* @param array $field
|
11 |
* @return array
|
12 |
*/
|
13 |
+
static function normalize( $field ) {
|
|
|
14 |
$field = parent::normalize( $field );
|
15 |
|
16 |
$field = wp_parse_args( $field, array(
|
30 |
*
|
31 |
* @return array
|
32 |
*/
|
33 |
+
static function get_attributes( $field, $value = null ) {
|
|
|
34 |
$attributes = parent::get_attributes( $field, $value );
|
35 |
$attributes = wp_parse_args( $attributes, array(
|
36 |
'size' => $field['size'],
|
inc/fields/textarea.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Textarea field class.
|
4 |
*/
|
5 |
-
class RWMB_Textarea_Field extends RWMB_Field
|
6 |
-
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
@@ -12,8 +12,7 @@ class RWMB_Textarea_Field extends RWMB_Field
|
|
12 |
*
|
13 |
* @return string
|
14 |
*/
|
15 |
-
static function html( $meta, $field )
|
16 |
-
{
|
17 |
$attributes = self::get_attributes( $field, $meta );
|
18 |
return sprintf(
|
19 |
'<textarea %s>%s</textarea>',
|
@@ -28,8 +27,7 @@ class RWMB_Textarea_Field extends RWMB_Field
|
|
28 |
* @param mixed $meta
|
29 |
* @return mixed
|
30 |
*/
|
31 |
-
static function esc_meta( $meta )
|
32 |
-
{
|
33 |
return is_array( $meta ) ? array_map( 'esc_textarea', $meta ) : esc_textarea( $meta );
|
34 |
}
|
35 |
|
@@ -39,8 +37,7 @@ class RWMB_Textarea_Field extends RWMB_Field
|
|
39 |
* @param array $field
|
40 |
* @return array
|
41 |
*/
|
42 |
-
static function normalize( $field )
|
43 |
-
{
|
44 |
$field = parent::normalize( $field );
|
45 |
$field = wp_parse_args( $field, array(
|
46 |
'cols' => 60,
|
@@ -61,8 +58,7 @@ class RWMB_Textarea_Field extends RWMB_Field
|
|
61 |
*
|
62 |
* @return array
|
63 |
*/
|
64 |
-
static function get_attributes( $field, $value = null )
|
65 |
-
{
|
66 |
$attributes = parent::get_attributes( $field, $value );
|
67 |
$attributes = wp_parse_args( $attributes, array(
|
68 |
'cols' => $field['cols'],
|
2 |
/**
|
3 |
* Textarea field class.
|
4 |
*/
|
5 |
+
class RWMB_Textarea_Field extends RWMB_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Get field HTML
|
9 |
*
|
12 |
*
|
13 |
* @return string
|
14 |
*/
|
15 |
+
static function html( $meta, $field ) {
|
|
|
16 |
$attributes = self::get_attributes( $field, $meta );
|
17 |
return sprintf(
|
18 |
'<textarea %s>%s</textarea>',
|
27 |
* @param mixed $meta
|
28 |
* @return mixed
|
29 |
*/
|
30 |
+
static function esc_meta( $meta ) {
|
|
|
31 |
return is_array( $meta ) ? array_map( 'esc_textarea', $meta ) : esc_textarea( $meta );
|
32 |
}
|
33 |
|
37 |
* @param array $field
|
38 |
* @return array
|
39 |
*/
|
40 |
+
static function normalize( $field ) {
|
|
|
41 |
$field = parent::normalize( $field );
|
42 |
$field = wp_parse_args( $field, array(
|
43 |
'cols' => 60,
|
58 |
*
|
59 |
* @return array
|
60 |
*/
|
61 |
+
static function get_attributes( $field, $value = null ) {
|
|
|
62 |
$attributes = parent::get_attributes( $field, $value );
|
63 |
$attributes = wp_parse_args( $attributes, array(
|
64 |
'cols' => $field['cols'],
|
inc/fields/thickbox-image.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Image upload field which uses thickbox library to upload.
|
|
|
4 |
* @deprecated Use image_advanced instead
|
5 |
*/
|
6 |
-
class RWMB_Thickbox_Image_Field extends RWMB_Image_Field
|
7 |
-
|
8 |
/**
|
9 |
* Add custom actions for the field.
|
10 |
*/
|
11 |
-
public static function add_actions()
|
12 |
-
{
|
13 |
parent::add_actions();
|
14 |
add_filter( 'get_media_item_args', array( __CLASS__, 'allow_img_insertion' ) );
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
* Always enable insert to post button in the popup
|
|
|
19 |
* @link https://github.com/rilwis/meta-box/issues/809
|
20 |
* @link http://wordpress.stackexchange.com/q/22175/2051
|
21 |
* @param array $vars
|
22 |
* @return array
|
23 |
*/
|
24 |
-
public static function allow_img_insertion( $vars )
|
25 |
-
{
|
26 |
$vars['send'] = true; // 'send' as in "Send to Editor"
|
27 |
return $vars;
|
28 |
}
|
@@ -30,8 +30,7 @@ class RWMB_Thickbox_Image_Field extends RWMB_Image_Field
|
|
30 |
/**
|
31 |
* Enqueue scripts and styles
|
32 |
*/
|
33 |
-
public static function admin_enqueue_scripts()
|
34 |
-
{
|
35 |
parent::admin_enqueue_scripts();
|
36 |
|
37 |
add_thickbox();
|
@@ -48,8 +47,7 @@ class RWMB_Thickbox_Image_Field extends RWMB_Image_Field
|
|
48 |
*
|
49 |
* @return string
|
50 |
*/
|
51 |
-
public static function html( $meta, $field )
|
52 |
-
{
|
53 |
$i18n_title = apply_filters( 'rwmb_thickbox_image_upload_string', _x( 'Upload Images', 'image upload', 'meta-box' ), $field );
|
54 |
|
55 |
// Uploaded images
|
@@ -72,8 +70,7 @@ class RWMB_Thickbox_Image_Field extends RWMB_Image_Field
|
|
72 |
*
|
73 |
* @return array
|
74 |
*/
|
75 |
-
public static function value( $new, $old, $post_id, $field )
|
76 |
-
{
|
77 |
return array_filter( array_unique( array_merge( (array) $old, (array) $new ) ) );
|
78 |
}
|
79 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Image upload field which uses thickbox library to upload.
|
4 |
+
*
|
5 |
* @deprecated Use image_advanced instead
|
6 |
*/
|
7 |
+
class RWMB_Thickbox_Image_Field extends RWMB_Image_Field {
|
8 |
+
|
9 |
/**
|
10 |
* Add custom actions for the field.
|
11 |
*/
|
12 |
+
public static function add_actions() {
|
|
|
13 |
parent::add_actions();
|
14 |
add_filter( 'get_media_item_args', array( __CLASS__, 'allow_img_insertion' ) );
|
15 |
}
|
16 |
|
17 |
/**
|
18 |
* Always enable insert to post button in the popup
|
19 |
+
*
|
20 |
* @link https://github.com/rilwis/meta-box/issues/809
|
21 |
* @link http://wordpress.stackexchange.com/q/22175/2051
|
22 |
* @param array $vars
|
23 |
* @return array
|
24 |
*/
|
25 |
+
public static function allow_img_insertion( $vars ) {
|
|
|
26 |
$vars['send'] = true; // 'send' as in "Send to Editor"
|
27 |
return $vars;
|
28 |
}
|
30 |
/**
|
31 |
* Enqueue scripts and styles
|
32 |
*/
|
33 |
+
public static function admin_enqueue_scripts() {
|
|
|
34 |
parent::admin_enqueue_scripts();
|
35 |
|
36 |
add_thickbox();
|
47 |
*
|
48 |
* @return string
|
49 |
*/
|
50 |
+
public static function html( $meta, $field ) {
|
|
|
51 |
$i18n_title = apply_filters( 'rwmb_thickbox_image_upload_string', _x( 'Upload Images', 'image upload', 'meta-box' ), $field );
|
52 |
|
53 |
// Uploaded images
|
70 |
*
|
71 |
* @return array
|
72 |
*/
|
73 |
+
public static function value( $new, $old, $post_id, $field ) {
|
|
|
74 |
return array_filter( array_unique( array_merge( (array) $old, (array) $new ) ) );
|
75 |
}
|
76 |
}
|
inc/fields/time.php
CHANGED
@@ -2,15 +2,14 @@
|
|
2 |
/**
|
3 |
* Time field class.
|
4 |
*/
|
5 |
-
class RWMB_Time_Field extends RWMB_Datetime_Field
|
6 |
-
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
public static function admin_enqueue_scripts()
|
13 |
-
{
|
14 |
parent::admin_register_scripts();
|
15 |
wp_enqueue_style( 'jquery-ui-timepicker' );
|
16 |
wp_enqueue_script( 'rwmb-time' );
|
@@ -22,8 +21,7 @@ class RWMB_Time_Field extends RWMB_Datetime_Field
|
|
22 |
* @param array $field
|
23 |
* @return array
|
24 |
*/
|
25 |
-
public static function normalize( $field )
|
26 |
-
{
|
27 |
$field = parent::normalize( $field );
|
28 |
$field['js_options']['timeFormat'] = empty( $field['format'] ) ? $field['js_options']['timeFormat'] : $field['format'];
|
29 |
return $field;
|
2 |
/**
|
3 |
* Time field class.
|
4 |
*/
|
5 |
+
class RWMB_Time_Field extends RWMB_Datetime_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Enqueue scripts and styles
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
+
public static function admin_enqueue_scripts() {
|
|
|
13 |
parent::admin_register_scripts();
|
14 |
wp_enqueue_style( 'jquery-ui-timepicker' );
|
15 |
wp_enqueue_script( 'rwmb-time' );
|
21 |
* @param array $field
|
22 |
* @return array
|
23 |
*/
|
24 |
+
public static function normalize( $field ) {
|
|
|
25 |
$field = parent::normalize( $field );
|
26 |
$field['js_options']['timeFormat'] = empty( $field['format'] ) ? $field['js_options']['timeFormat'] : $field['format'];
|
27 |
return $field;
|
inc/fields/user.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* User field class.
|
4 |
*/
|
5 |
-
class RWMB_User_Field extends RWMB_Object_Choice_Field
|
6 |
-
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
@@ -11,8 +11,7 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field
|
|
11 |
*
|
12 |
* @return array
|
13 |
*/
|
14 |
-
public static function normalize( $field )
|
15 |
-
{
|
16 |
/**
|
17 |
* Set default field args
|
18 |
*/
|
@@ -53,8 +52,7 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field
|
|
53 |
*
|
54 |
* @return array
|
55 |
*/
|
56 |
-
public static function get_options( $field )
|
57 |
-
{
|
58 |
$query = new WP_User_Query( $field['query_args'] );
|
59 |
return $query->get_results();
|
60 |
}
|
@@ -64,8 +62,7 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field
|
|
64 |
*
|
65 |
* @return array
|
66 |
*/
|
67 |
-
public static function get_db_fields()
|
68 |
-
{
|
69 |
return array(
|
70 |
'parent' => 'parent',
|
71 |
'id' => 'ID',
|
@@ -76,13 +73,12 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field
|
|
76 |
/**
|
77 |
* Get option label
|
78 |
*
|
79 |
-
* @param string
|
80 |
-
* @param array
|
81 |
*
|
82 |
* @return string
|
83 |
*/
|
84 |
-
public static function get_option_label( $field, $value )
|
85 |
-
{
|
86 |
$user = get_userdata( $value );
|
87 |
return '<a href="' . get_author_posts_url( $value ) . '">' . $user->display_name . '</a>';
|
88 |
}
|
2 |
/**
|
3 |
* User field class.
|
4 |
*/
|
5 |
+
class RWMB_User_Field extends RWMB_Object_Choice_Field {
|
6 |
+
|
7 |
/**
|
8 |
* Normalize parameters for field
|
9 |
*
|
11 |
*
|
12 |
* @return array
|
13 |
*/
|
14 |
+
public static function normalize( $field ) {
|
|
|
15 |
/**
|
16 |
* Set default field args
|
17 |
*/
|
52 |
*
|
53 |
* @return array
|
54 |
*/
|
55 |
+
public static function get_options( $field ) {
|
|
|
56 |
$query = new WP_User_Query( $field['query_args'] );
|
57 |
return $query->get_results();
|
58 |
}
|
62 |
*
|
63 |
* @return array
|
64 |
*/
|
65 |
+
public static function get_db_fields() {
|
|
|
66 |
return array(
|
67 |
'parent' => 'parent',
|
68 |
'id' => 'ID',
|
73 |
/**
|
74 |
* Get option label
|
75 |
*
|
76 |
+
* @param string $value Option value
|
77 |
+
* @param array $field Field parameter
|
78 |
*
|
79 |
* @return string
|
80 |
*/
|
81 |
+
public static function get_option_label( $field, $value ) {
|
|
|
82 |
$user = get_userdata( $value );
|
83 |
return '<a href="' . get_author_posts_url( $value ) . '">' . $user->display_name . '</a>';
|
84 |
}
|
inc/fields/wysiwyg.php
CHANGED
@@ -3,10 +3,11 @@
|
|
3 |
/**
|
4 |
* WYSIWYG (editor) field class.
|
5 |
*/
|
6 |
-
class RWMB_Wysiwyg_Field extends RWMB_Field
|
7 |
-
|
8 |
/**
|
9 |
* Array of cloneable editors.
|
|
|
10 |
* @var array
|
11 |
*/
|
12 |
static $cloneable_editors = array();
|
@@ -14,8 +15,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field
|
|
14 |
/**
|
15 |
* Enqueue scripts and styles.
|
16 |
*/
|
17 |
-
static function admin_enqueue_scripts()
|
18 |
-
{
|
19 |
wp_enqueue_style( 'rwmb-wysiwyg', RWMB_CSS_URL . 'wysiwyg.css', array(), RWMB_VER );
|
20 |
wp_enqueue_script( 'rwmb-wysiwyg', RWMB_JS_URL . 'wysiwyg.js', array( 'jquery' ), RWMB_VER, true );
|
21 |
}
|
@@ -29,8 +29,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field
|
|
29 |
* @param array $field
|
30 |
* @return string
|
31 |
*/
|
32 |
-
static function value( $new, $old, $post_id, $field )
|
33 |
-
{
|
34 |
return $field['raw'] ? $new : wpautop( $new );
|
35 |
}
|
36 |
|
@@ -41,8 +40,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field
|
|
41 |
* @param array $field
|
42 |
* @return string
|
43 |
*/
|
44 |
-
static function html( $meta, $field )
|
45 |
-
{
|
46 |
// Using output buffering because wp_editor() echos directly
|
47 |
ob_start();
|
48 |
|
@@ -61,8 +59,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field
|
|
61 |
* @param mixed $meta
|
62 |
* @return mixed
|
63 |
*/
|
64 |
-
static function esc_meta( $meta )
|
65 |
-
{
|
66 |
return $meta;
|
67 |
}
|
68 |
|
@@ -72,8 +69,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field
|
|
72 |
* @param array $field
|
73 |
* @return array
|
74 |
*/
|
75 |
-
static function normalize( $field )
|
76 |
-
{
|
77 |
$field = parent::normalize( $field );
|
78 |
$field = wp_parse_args( $field, array(
|
79 |
'raw' => false,
|
3 |
/**
|
4 |
* WYSIWYG (editor) field class.
|
5 |
*/
|
6 |
+
class RWMB_Wysiwyg_Field extends RWMB_Field {
|
7 |
+
|
8 |
/**
|
9 |
* Array of cloneable editors.
|
10 |
+
*
|
11 |
* @var array
|
12 |
*/
|
13 |
static $cloneable_editors = array();
|
15 |
/**
|
16 |
* Enqueue scripts and styles.
|
17 |
*/
|
18 |
+
static function admin_enqueue_scripts() {
|
|
|
19 |
wp_enqueue_style( 'rwmb-wysiwyg', RWMB_CSS_URL . 'wysiwyg.css', array(), RWMB_VER );
|
20 |
wp_enqueue_script( 'rwmb-wysiwyg', RWMB_JS_URL . 'wysiwyg.js', array( 'jquery' ), RWMB_VER, true );
|
21 |
}
|
29 |
* @param array $field
|
30 |
* @return string
|
31 |
*/
|
32 |
+
static function value( $new, $old, $post_id, $field ) {
|
|
|
33 |
return $field['raw'] ? $new : wpautop( $new );
|
34 |
}
|
35 |
|
40 |
* @param array $field
|
41 |
* @return string
|
42 |
*/
|
43 |
+
static function html( $meta, $field ) {
|
|
|
44 |
// Using output buffering because wp_editor() echos directly
|
45 |
ob_start();
|
46 |
|
59 |
* @param mixed $meta
|
60 |
* @return mixed
|
61 |
*/
|
62 |
+
static function esc_meta( $meta ) {
|
|
|
63 |
return $meta;
|
64 |
}
|
65 |
|
69 |
* @param array $field
|
70 |
* @return array
|
71 |
*/
|
72 |
+
static function normalize( $field ) {
|
|
|
73 |
$field = parent::normalize( $field );
|
74 |
$field = wp_parse_args( $field, array(
|
75 |
'raw' => false,
|
inc/functions.php
CHANGED
@@ -3,8 +3,7 @@
|
|
3 |
* Plugin public functions.
|
4 |
*/
|
5 |
|
6 |
-
if ( ! function_exists( 'rwmb_meta' ) )
|
7 |
-
{
|
8 |
/**
|
9 |
* Get post meta
|
10 |
*
|
@@ -14,8 +13,7 @@ if ( ! function_exists( 'rwmb_meta' ) )
|
|
14 |
*
|
15 |
* @return mixed
|
16 |
*/
|
17 |
-
function rwmb_meta( $key, $args = array(), $post_id = null )
|
18 |
-
{
|
19 |
$args = wp_parse_args( $args );
|
20 |
/*
|
21 |
* If meta boxes is registered in the backend only, we can't get field's params
|
@@ -27,8 +25,7 @@ if ( ! function_exists( 'rwmb_meta' ) )
|
|
27 |
* If field is not found, which can caused by registering meta boxes for the backend only or conditional registration
|
28 |
* Then fallback to the old method to retrieve meta (which uses get_post_meta() as the latest fallback)
|
29 |
*/
|
30 |
-
if ( false === $field )
|
31 |
-
{
|
32 |
return apply_filters( 'rwmb_meta', RWMB_Helper::meta( $key, $args, $post_id ) );
|
33 |
}
|
34 |
$meta = in_array( $field['type'], array( 'oembed', 'map' ) ) ?
|
@@ -38,8 +35,7 @@ if ( ! function_exists( 'rwmb_meta' ) )
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
-
if ( ! function_exists( 'rwmb_get_value' ) )
|
42 |
-
{
|
43 |
/**
|
44 |
* Get value of custom field.
|
45 |
* This is used to replace old version of rwmb_meta key.
|
@@ -50,8 +46,7 @@ if ( ! function_exists( 'rwmb_get_value' ) )
|
|
50 |
*
|
51 |
* @return mixed false if field doesn't exist. Field value otherwise.
|
52 |
*/
|
53 |
-
function rwmb_get_value( $field_id, $args = array(), $post_id = null )
|
54 |
-
{
|
55 |
$args = wp_parse_args( $args );
|
56 |
$field = RWMB_Helper::find_field( $field_id, $post_id );
|
57 |
|
@@ -73,8 +68,7 @@ if ( ! function_exists( 'rwmb_get_value' ) )
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
if ( ! function_exists( 'rwmb_the_value' ) )
|
77 |
-
{
|
78 |
/**
|
79 |
* Display the value of a field
|
80 |
*
|
@@ -85,13 +79,13 @@ if ( ! function_exists( 'rwmb_the_value' ) )
|
|
85 |
*
|
86 |
* @return string
|
87 |
*/
|
88 |
-
function rwmb_the_value( $field_id, $args = array(), $post_id = null, $echo = true )
|
89 |
-
{
|
90 |
$args = wp_parse_args( $args );
|
91 |
$field = RWMB_Helper::find_field( $field_id, $post_id );
|
92 |
|
93 |
-
if ( ! $field )
|
94 |
return '';
|
|
|
95 |
|
96 |
$output = RWMB_Field::call( 'the_value', $field, $args, $post_id );
|
97 |
|
@@ -106,15 +100,15 @@ if ( ! function_exists( 'rwmb_the_value' ) )
|
|
106 |
*/
|
107 |
$output = apply_filters( 'rwmb_the_value', $output, $field, $args, $post_id );
|
108 |
|
109 |
-
if ( $echo )
|
110 |
echo $output;
|
|
|
111 |
|
112 |
return $output;
|
113 |
}
|
114 |
-
}
|
115 |
|
116 |
-
if ( ! function_exists( 'rwmb_meta_shortcode' ) )
|
117 |
-
{
|
118 |
/**
|
119 |
* Shortcode to display meta value
|
120 |
*
|
@@ -122,13 +116,13 @@ if ( ! function_exists( 'rwmb_meta_shortcode' ) )
|
|
122 |
*
|
123 |
* @return string
|
124 |
*/
|
125 |
-
function rwmb_meta_shortcode( $atts )
|
126 |
-
{
|
127 |
$atts = wp_parse_args( $atts, array(
|
128 |
'post_id' => get_the_ID(),
|
129 |
) );
|
130 |
-
if ( empty( $atts['meta_key'] ) )
|
131 |
return '';
|
|
|
132 |
|
133 |
$field_id = $atts['meta_key'];
|
134 |
$post_id = $atts['post_id'];
|
3 |
* Plugin public functions.
|
4 |
*/
|
5 |
|
6 |
+
if ( ! function_exists( 'rwmb_meta' ) ) {
|
|
|
7 |
/**
|
8 |
* Get post meta
|
9 |
*
|
13 |
*
|
14 |
* @return mixed
|
15 |
*/
|
16 |
+
function rwmb_meta( $key, $args = array(), $post_id = null ) {
|
|
|
17 |
$args = wp_parse_args( $args );
|
18 |
/*
|
19 |
* If meta boxes is registered in the backend only, we can't get field's params
|
25 |
* If field is not found, which can caused by registering meta boxes for the backend only or conditional registration
|
26 |
* Then fallback to the old method to retrieve meta (which uses get_post_meta() as the latest fallback)
|
27 |
*/
|
28 |
+
if ( false === $field ) {
|
|
|
29 |
return apply_filters( 'rwmb_meta', RWMB_Helper::meta( $key, $args, $post_id ) );
|
30 |
}
|
31 |
$meta = in_array( $field['type'], array( 'oembed', 'map' ) ) ?
|
35 |
}
|
36 |
}
|
37 |
|
38 |
+
if ( ! function_exists( 'rwmb_get_value' ) ) {
|
|
|
39 |
/**
|
40 |
* Get value of custom field.
|
41 |
* This is used to replace old version of rwmb_meta key.
|
46 |
*
|
47 |
* @return mixed false if field doesn't exist. Field value otherwise.
|
48 |
*/
|
49 |
+
function rwmb_get_value( $field_id, $args = array(), $post_id = null ) {
|
|
|
50 |
$args = wp_parse_args( $args );
|
51 |
$field = RWMB_Helper::find_field( $field_id, $post_id );
|
52 |
|
68 |
}
|
69 |
}
|
70 |
|
71 |
+
if ( ! function_exists( 'rwmb_the_value' ) ) {
|
|
|
72 |
/**
|
73 |
* Display the value of a field
|
74 |
*
|
79 |
*
|
80 |
* @return string
|
81 |
*/
|
82 |
+
function rwmb_the_value( $field_id, $args = array(), $post_id = null, $echo = true ) {
|
|
|
83 |
$args = wp_parse_args( $args );
|
84 |
$field = RWMB_Helper::find_field( $field_id, $post_id );
|
85 |
|
86 |
+
if ( ! $field ) {
|
87 |
return '';
|
88 |
+
}
|
89 |
|
90 |
$output = RWMB_Field::call( 'the_value', $field, $args, $post_id );
|
91 |
|
100 |
*/
|
101 |
$output = apply_filters( 'rwmb_the_value', $output, $field, $args, $post_id );
|
102 |
|
103 |
+
if ( $echo ) {
|
104 |
echo $output;
|
105 |
+
}
|
106 |
|
107 |
return $output;
|
108 |
}
|
109 |
+
}// End if().
|
110 |
|
111 |
+
if ( ! function_exists( 'rwmb_meta_shortcode' ) ) {
|
|
|
112 |
/**
|
113 |
* Shortcode to display meta value
|
114 |
*
|
116 |
*
|
117 |
* @return string
|
118 |
*/
|
119 |
+
function rwmb_meta_shortcode( $atts ) {
|
|
|
120 |
$atts = wp_parse_args( $atts, array(
|
121 |
'post_id' => get_the_ID(),
|
122 |
) );
|
123 |
+
if ( empty( $atts['meta_key'] ) ) {
|
124 |
return '';
|
125 |
+
}
|
126 |
|
127 |
$field_id = $atts['meta_key'];
|
128 |
$post_id = $atts['post_id'];
|
inc/helper.php
CHANGED
@@ -6,35 +6,32 @@
|
|
6 |
/**
|
7 |
* Wrapper class for helper functions.
|
8 |
*/
|
9 |
-
class RWMB_Helper
|
10 |
-
|
11 |
/**
|
12 |
* Stores all registered fields
|
|
|
13 |
* @var array
|
14 |
*/
|
15 |
private static $fields = array();
|
16 |
|
17 |
/**
|
18 |
* Hash all fields into an indexed array for search
|
|
|
19 |
* @param string $post_type Post type
|
20 |
*/
|
21 |
-
public static function hash_fields( $post_type )
|
22 |
-
|
23 |
-
self::$fields[$post_type] = array();
|
24 |
|
25 |
$meta_boxes = RWMB_Core::get_meta_boxes();
|
26 |
-
foreach ( $meta_boxes as $meta_box )
|
27 |
-
{
|
28 |
$meta_box = RW_Meta_Box::normalize( $meta_box );
|
29 |
-
if ( ! in_array( $post_type, $meta_box['post_types'] ) )
|
30 |
-
{
|
31 |
continue;
|
32 |
}
|
33 |
-
foreach ( $meta_box['fields'] as $field )
|
34 |
-
|
35 |
-
|
36 |
-
{
|
37 |
-
self::$fields[$post_type][$field['id']] = $field;
|
38 |
}
|
39 |
}
|
40 |
}
|
@@ -48,19 +45,16 @@ class RWMB_Helper
|
|
48 |
* @param int $post_id
|
49 |
* @return array|false Field params (array) if success. False otherwise.
|
50 |
*/
|
51 |
-
public static function find_field( $field_id, $post_id = null )
|
52 |
-
{
|
53 |
$post_type = get_post_type( $post_id );
|
54 |
-
if ( empty( self::$fields[$post_type] ) )
|
55 |
-
{
|
56 |
self::hash_fields( $post_type );
|
57 |
}
|
58 |
-
$fields = self::$fields[$post_type];
|
59 |
-
if ( ! isset( $fields[$field_id] ) )
|
60 |
-
{
|
61 |
return false;
|
62 |
}
|
63 |
-
$field = $fields[$field_id];
|
64 |
return RWMB_Field::call( 'normalize', $field );
|
65 |
}
|
66 |
|
@@ -73,8 +67,7 @@ class RWMB_Helper
|
|
73 |
*
|
74 |
* @return mixed
|
75 |
*/
|
76 |
-
public static function meta( $key, $args = array(), $post_id = null )
|
77 |
-
{
|
78 |
$post_id = empty( $post_id ) ? get_the_ID() : $post_id;
|
79 |
$args = wp_parse_args( $args, array(
|
80 |
'type' => 'text',
|
@@ -82,8 +75,7 @@ class RWMB_Helper
|
|
82 |
'clone' => false,
|
83 |
) );
|
84 |
// Always set 'multiple' true for following field types
|
85 |
-
if ( in_array( $args['type'], array( 'checkbox_list', 'autocomplete', 'file', 'file_advanced', 'image', 'image_advanced', 'plupload_image', 'thickbox_image' ) ) )
|
86 |
-
{
|
87 |
$args['multiple'] = true;
|
88 |
}
|
89 |
|
@@ -94,11 +86,9 @@ class RWMB_Helper
|
|
94 |
'multiple' => $args['multiple'],
|
95 |
);
|
96 |
|
97 |
-
switch ( $args['type'] )
|
98 |
-
{
|
99 |
case 'taxonomy_advanced':
|
100 |
-
if ( empty( $args['taxonomy'] ) )
|
101 |
-
{
|
102 |
break;
|
103 |
}
|
104 |
$meta = get_post_meta( $post_id, $key, ! $args['multiple'] );
|
6 |
/**
|
7 |
* Wrapper class for helper functions.
|
8 |
*/
|
9 |
+
class RWMB_Helper {
|
10 |
+
|
11 |
/**
|
12 |
* Stores all registered fields
|
13 |
+
*
|
14 |
* @var array
|
15 |
*/
|
16 |
private static $fields = array();
|
17 |
|
18 |
/**
|
19 |
* Hash all fields into an indexed array for search
|
20 |
+
*
|
21 |
* @param string $post_type Post type
|
22 |
*/
|
23 |
+
public static function hash_fields( $post_type ) {
|
24 |
+
self::$fields[ $post_type ] = array();
|
|
|
25 |
|
26 |
$meta_boxes = RWMB_Core::get_meta_boxes();
|
27 |
+
foreach ( $meta_boxes as $meta_box ) {
|
|
|
28 |
$meta_box = RW_Meta_Box::normalize( $meta_box );
|
29 |
+
if ( ! in_array( $post_type, $meta_box['post_types'] ) ) {
|
|
|
30 |
continue;
|
31 |
}
|
32 |
+
foreach ( $meta_box['fields'] as $field ) {
|
33 |
+
if ( ! empty( $field['id'] ) ) {
|
34 |
+
self::$fields[ $post_type ][ $field['id'] ] = $field;
|
|
|
|
|
35 |
}
|
36 |
}
|
37 |
}
|
45 |
* @param int $post_id
|
46 |
* @return array|false Field params (array) if success. False otherwise.
|
47 |
*/
|
48 |
+
public static function find_field( $field_id, $post_id = null ) {
|
|
|
49 |
$post_type = get_post_type( $post_id );
|
50 |
+
if ( empty( self::$fields[ $post_type ] ) ) {
|
|
|
51 |
self::hash_fields( $post_type );
|
52 |
}
|
53 |
+
$fields = self::$fields[ $post_type ];
|
54 |
+
if ( ! isset( $fields[ $field_id ] ) ) {
|
|
|
55 |
return false;
|
56 |
}
|
57 |
+
$field = $fields[ $field_id ];
|
58 |
return RWMB_Field::call( 'normalize', $field );
|
59 |
}
|
60 |
|
67 |
*
|
68 |
* @return mixed
|
69 |
*/
|
70 |
+
public static function meta( $key, $args = array(), $post_id = null ) {
|
|
|
71 |
$post_id = empty( $post_id ) ? get_the_ID() : $post_id;
|
72 |
$args = wp_parse_args( $args, array(
|
73 |
'type' => 'text',
|
75 |
'clone' => false,
|
76 |
) );
|
77 |
// Always set 'multiple' true for following field types
|
78 |
+
if ( in_array( $args['type'], array( 'checkbox_list', 'autocomplete', 'file', 'file_advanced', 'image', 'image_advanced', 'plupload_image', 'thickbox_image' ) ) ) {
|
|
|
79 |
$args['multiple'] = true;
|
80 |
}
|
81 |
|
86 |
'multiple' => $args['multiple'],
|
87 |
);
|
88 |
|
89 |
+
switch ( $args['type'] ) {
|
|
|
90 |
case 'taxonomy_advanced':
|
91 |
+
if ( empty( $args['taxonomy'] ) ) {
|
|
|
92 |
break;
|
93 |
}
|
94 |
$meta = get_post_meta( $post_id, $key, ! $args['multiple'] );
|
inc/loader.php
CHANGED
@@ -3,22 +3,23 @@
|
|
3 |
* Load plugin's files with check for installing it as a standalone plugin or
|
4 |
* a module of a theme / plugin. If standalone plugin is already installed, it
|
5 |
* will take higher priority.
|
|
|
6 |
* @package Meta Box
|
7 |
*/
|
8 |
|
9 |
/**
|
10 |
* Plugin loader class.
|
|
|
11 |
* @package Meta Box
|
12 |
*/
|
13 |
-
class RWMB_Loader
|
14 |
-
|
15 |
/**
|
16 |
* Define plugin constants.
|
17 |
*/
|
18 |
-
protected function constants()
|
19 |
-
{
|
20 |
// Script version, used to add version for scripts and styles
|
21 |
-
define( 'RWMB_VER', '4.9.
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
@@ -35,12 +36,12 @@ class RWMB_Loader
|
|
35 |
/**
|
36 |
* Get plugin base path and URL.
|
37 |
* The method is static and can be used in extensions.
|
|
|
38 |
* @link http://www.deluxeblogtips.com/2013/07/get-url-of-php-file-in-wordpress.html
|
39 |
* @param string $path Base folder path
|
40 |
* @return array Path and URL.
|
41 |
*/
|
42 |
-
public static function get_path( $path = '' )
|
43 |
-
{
|
44 |
// Plugin base path
|
45 |
$path = wp_normalize_path( untrailingslashit( $path ) );
|
46 |
$themes_dir = wp_normalize_path( untrailingslashit( dirname( realpath( get_stylesheet_directory() ) ) ) );
|
@@ -53,8 +54,7 @@ class RWMB_Loader
|
|
53 |
0 !== strpos( $path, wp_normalize_path( WP_PLUGIN_DIR ) )
|
54 |
&& 0 !== strpos( $path, wp_normalize_path( WPMU_PLUGIN_DIR ) )
|
55 |
&& 0 === strpos( $path, $themes_dir )
|
56 |
-
)
|
57 |
-
{
|
58 |
$themes_url = untrailingslashit( dirname( get_stylesheet_directory_uri() ) );
|
59 |
$url = str_replace( $themes_dir, $themes_url, $path );
|
60 |
}
|
@@ -68,8 +68,7 @@ class RWMB_Loader
|
|
68 |
/**
|
69 |
* Bootstrap the plugin.
|
70 |
*/
|
71 |
-
public function init()
|
72 |
-
{
|
73 |
$this->constants();
|
74 |
|
75 |
// Register autoload for classes
|
@@ -84,8 +83,7 @@ class RWMB_Loader
|
|
84 |
// Plugin core
|
85 |
new RWMB_Core;
|
86 |
|
87 |
-
if ( is_admin() )
|
88 |
-
{
|
89 |
// Validation module
|
90 |
new RWMB_Validation;
|
91 |
|
3 |
* Load plugin's files with check for installing it as a standalone plugin or
|
4 |
* a module of a theme / plugin. If standalone plugin is already installed, it
|
5 |
* will take higher priority.
|
6 |
+
*
|
7 |
* @package Meta Box
|
8 |
*/
|
9 |
|
10 |
/**
|
11 |
* Plugin loader class.
|
12 |
+
*
|
13 |
* @package Meta Box
|
14 |
*/
|
15 |
+
class RWMB_Loader {
|
16 |
+
|
17 |
/**
|
18 |
* Define plugin constants.
|
19 |
*/
|
20 |
+
protected function constants() {
|
|
|
21 |
// Script version, used to add version for scripts and styles
|
22 |
+
define( 'RWMB_VER', '4.9.7' );
|
23 |
|
24 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
25 |
|
36 |
/**
|
37 |
* Get plugin base path and URL.
|
38 |
* The method is static and can be used in extensions.
|
39 |
+
*
|
40 |
* @link http://www.deluxeblogtips.com/2013/07/get-url-of-php-file-in-wordpress.html
|
41 |
* @param string $path Base folder path
|
42 |
* @return array Path and URL.
|
43 |
*/
|
44 |
+
public static function get_path( $path = '' ) {
|
|
|
45 |
// Plugin base path
|
46 |
$path = wp_normalize_path( untrailingslashit( $path ) );
|
47 |
$themes_dir = wp_normalize_path( untrailingslashit( dirname( realpath( get_stylesheet_directory() ) ) ) );
|
54 |
0 !== strpos( $path, wp_normalize_path( WP_PLUGIN_DIR ) )
|
55 |
&& 0 !== strpos( $path, wp_normalize_path( WPMU_PLUGIN_DIR ) )
|
56 |
&& 0 === strpos( $path, $themes_dir )
|
57 |
+
) {
|
|
|
58 |
$themes_url = untrailingslashit( dirname( get_stylesheet_directory_uri() ) );
|
59 |
$url = str_replace( $themes_dir, $themes_url, $path );
|
60 |
}
|
68 |
/**
|
69 |
* Bootstrap the plugin.
|
70 |
*/
|
71 |
+
public function init() {
|
|
|
72 |
$this->constants();
|
73 |
|
74 |
// Register autoload for classes
|
83 |
// Plugin core
|
84 |
new RWMB_Core;
|
85 |
|
86 |
+
if ( is_admin() ) {
|
|
|
87 |
// Validation module
|
88 |
new RWMB_Validation;
|
89 |
|
inc/meta-box.php
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
* @license GNU GPL2+
|
9 |
* @package Meta Box
|
10 |
*/
|
11 |
-
class RW_Meta_Box
|
12 |
-
|
13 |
/**
|
14 |
* @var array Meta box information
|
15 |
*/
|
@@ -27,10 +27,10 @@ class RW_Meta_Box
|
|
27 |
|
28 |
/**
|
29 |
* Create meta box based on given data
|
|
|
30 |
* @param array $meta_box Meta box definition
|
31 |
*/
|
32 |
-
public function __construct( $meta_box )
|
33 |
-
{
|
34 |
$meta_box = self::normalize( $meta_box );
|
35 |
$meta_box['fields'] = self::normalize_fields( $meta_box['fields'] );
|
36 |
|
@@ -42,15 +42,15 @@ class RW_Meta_Box
|
|
42 |
// 2nd action applies to only current meta box
|
43 |
$show = apply_filters( 'rwmb_show', true, $this->meta_box );
|
44 |
$show = apply_filters( "rwmb_show_{$this->meta_box['id']}", $show, $this->meta_box );
|
45 |
-
if ( ! $show )
|
46 |
return;
|
|
|
47 |
|
48 |
// Enqueue common styles and scripts
|
49 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
50 |
|
51 |
// Add additional actions for fields
|
52 |
-
foreach ( $this->fields as $field )
|
53 |
-
{
|
54 |
RWMB_Field::call( $field, 'add_actions' );
|
55 |
}
|
56 |
|
@@ -61,17 +61,13 @@ class RW_Meta_Box
|
|
61 |
add_filter( 'default_hidden_meta_boxes', array( $this, 'hide' ), 10, 2 );
|
62 |
|
63 |
// Save post meta
|
64 |
-
foreach ( $this->meta_box['post_types'] as $post_type )
|
65 |
-
|
66 |
-
if ( 'attachment' === $post_type )
|
67 |
-
{
|
68 |
// Attachment uses other hooks
|
69 |
// @see wp_update_post(), wp_insert_attachment()
|
70 |
add_action( 'edit_attachment', array( $this, 'save_post' ) );
|
71 |
add_action( 'add_attachment', array( $this, 'save_post' ) );
|
72 |
-
}
|
73 |
-
else
|
74 |
-
{
|
75 |
add_action( "save_post_{$post_type}", array( $this, 'save_post' ) );
|
76 |
}
|
77 |
}
|
@@ -80,37 +76,37 @@ class RW_Meta_Box
|
|
80 |
/**
|
81 |
* Enqueue common scripts and styles.
|
82 |
*/
|
83 |
-
public function enqueue()
|
84 |
-
|
85 |
-
if ( ! $this->is_edit_screen() )
|
86 |
return;
|
|
|
87 |
|
88 |
wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
|
89 |
-
if ( is_rtl() )
|
90 |
wp_enqueue_style( 'rwmb-rtl', RWMB_CSS_URL . 'style-rtl.css', array(), RWMB_VER );
|
|
|
91 |
|
92 |
// Load clone script conditionally
|
93 |
-
foreach ( $this->fields as $field )
|
94 |
-
|
95 |
-
if ( $field['clone'] )
|
96 |
-
{
|
97 |
wp_enqueue_script( 'rwmb-clone', RWMB_JS_URL . 'clone.js', array( 'jquery-ui-sortable' ), RWMB_VER, true );
|
98 |
break;
|
99 |
}
|
100 |
}
|
101 |
|
102 |
// Enqueue scripts and styles for fields
|
103 |
-
foreach ( $this->fields as $field )
|
104 |
-
{
|
105 |
RWMB_Field::call( $field, 'admin_enqueue_scripts' );
|
106 |
}
|
107 |
|
108 |
// Auto save
|
109 |
-
if ( $this->meta_box['autosave'] )
|
110 |
wp_enqueue_script( 'rwmb-autosave', RWMB_JS_URL . 'autosave.js', array( 'jquery' ), RWMB_VER, true );
|
|
|
111 |
|
112 |
/**
|
113 |
* Allow developers to enqueue more scripts and styles
|
|
|
114 |
* @param RW_Meta_Box $object Meta Box object
|
115 |
*/
|
116 |
do_action( 'rwmb_enqueue_scripts', $this );
|
@@ -119,10 +115,8 @@ class RW_Meta_Box
|
|
119 |
/**
|
120 |
* Add meta box for multiple post types
|
121 |
*/
|
122 |
-
public function add_meta_boxes()
|
123 |
-
|
124 |
-
foreach ( $this->meta_box['post_types'] as $post_type )
|
125 |
-
{
|
126 |
add_meta_box(
|
127 |
$this->meta_box['id'],
|
128 |
$this->meta_box['title'],
|
@@ -142,10 +136,8 @@ class RW_Meta_Box
|
|
142 |
*
|
143 |
* @return array
|
144 |
*/
|
145 |
-
public function hide( $hidden, $screen )
|
146 |
-
|
147 |
-
if ( $this->is_edit_screen( $screen ) && $this->meta_box['default_hidden'] )
|
148 |
-
{
|
149 |
$hidden[] = $this->meta_box['id'];
|
150 |
}
|
151 |
|
@@ -155,8 +147,7 @@ class RW_Meta_Box
|
|
155 |
/**
|
156 |
* Callback function to show fields in meta box
|
157 |
*/
|
158 |
-
public function show()
|
159 |
-
{
|
160 |
$saved = $this->is_saved();
|
161 |
|
162 |
// Container
|
@@ -173,8 +164,7 @@ class RW_Meta_Box
|
|
173 |
do_action( 'rwmb_before', $this );
|
174 |
do_action( "rwmb_before_{$this->meta_box['id']}", $this );
|
175 |
|
176 |
-
foreach ( $this->fields as $field )
|
177 |
-
{
|
178 |
RWMB_Field::call( 'show', $field, $saved );
|
179 |
}
|
180 |
|
@@ -190,35 +180,33 @@ class RW_Meta_Box
|
|
190 |
|
191 |
/**
|
192 |
* Save data from meta box
|
|
|
193 |
* @param int $post_id Post ID
|
194 |
*/
|
195 |
-
public function save_post( $post_id )
|
196 |
-
|
197 |
-
if ( ! $this->validate() )
|
198 |
return;
|
|
|
199 |
$this->saved = true;
|
200 |
|
201 |
// Make sure meta is added to the post, not a revision
|
202 |
-
if ( $the_post = wp_is_post_revision( $post_id ) )
|
203 |
$post_id = $the_post;
|
|
|
204 |
|
205 |
// Before save action
|
206 |
do_action( 'rwmb_before_save_post', $post_id );
|
207 |
do_action( "rwmb_{$this->meta_box['id']}_before_save_post", $post_id );
|
208 |
|
209 |
-
foreach ( $this->fields as $field )
|
210 |
-
{
|
211 |
$single = $field['clone'] || ! $field['multiple'];
|
212 |
-
$old =
|
213 |
-
$new = isset( $_POST[$field['id']] ) ? $_POST[$field['id']] : ( $single ? '' : array() );
|
214 |
|
215 |
// Allow field class change the value
|
216 |
-
if ( $field['clone'] )
|
217 |
-
{
|
218 |
$new = RWMB_Clone::value( $new, $old, $post_id, $field );
|
219 |
-
}
|
220 |
-
else
|
221 |
-
{
|
222 |
$new = RWMB_Field::call( $field, 'value', $new, $old, $post_id );
|
223 |
$new = RWMB_Field::filter( 'sanitize', $new, $field );
|
224 |
}
|
@@ -238,10 +226,10 @@ class RW_Meta_Box
|
|
238 |
* - If this function is called to prevent duplicated calls like revisions, manual hook to wp_insert_post, etc.
|
239 |
* - Autosave
|
240 |
* - If form is submitted properly
|
|
|
241 |
* @return bool
|
242 |
*/
|
243 |
-
protected function validate()
|
244 |
-
{
|
245 |
$nonce = (string) filter_input( INPUT_POST, "nonce_{$this->meta_box['id']}" );
|
246 |
return
|
247 |
true !== $this->saved
|
@@ -251,11 +239,11 @@ class RW_Meta_Box
|
|
251 |
|
252 |
/**
|
253 |
* Normalize parameters for meta box
|
|
|
254 |
* @param array $meta_box Meta box definition
|
255 |
* @return array $meta_box Normalized meta box
|
256 |
*/
|
257 |
-
public static function normalize( $meta_box )
|
258 |
-
{
|
259 |
// Set default values for meta box
|
260 |
$meta_box = wp_parse_args( $meta_box, array(
|
261 |
'id' => sanitize_title( $meta_box['title'] ),
|
@@ -268,10 +256,10 @@ class RW_Meta_Box
|
|
268 |
|
269 |
/**
|
270 |
* Use 'post_types' for better understanding and fallback to 'pages' for previous versions
|
|
|
271 |
* @since 4.4.1
|
272 |
*/
|
273 |
-
if ( ! empty( $meta_box['pages'] ) )
|
274 |
-
{
|
275 |
$meta_box['post_types'] = $meta_box['pages'];
|
276 |
}
|
277 |
|
@@ -283,13 +271,12 @@ class RW_Meta_Box
|
|
283 |
|
284 |
/**
|
285 |
* Normalize an array of fields
|
|
|
286 |
* @param array $fields Array of fields
|
287 |
* @return array $fields Normalized fields
|
288 |
*/
|
289 |
-
public static function normalize_fields( $fields )
|
290 |
-
|
291 |
-
foreach ( $fields as $k => $field )
|
292 |
-
{
|
293 |
$field = RWMB_Field::call( 'normalize', $field );
|
294 |
|
295 |
// Allow to add default values for fields
|
@@ -297,7 +284,7 @@ class RW_Meta_Box
|
|
297 |
$field = apply_filters( "rwmb_normalize_{$field['type']}_field", $field );
|
298 |
$field = apply_filters( "rwmb_normalize_{$field['id']}_field", $field );
|
299 |
|
300 |
-
$fields[$k] = $field;
|
301 |
}
|
302 |
|
303 |
return $fields;
|
@@ -306,24 +293,21 @@ class RW_Meta_Box
|
|
306 |
/**
|
307 |
* Check if meta box is saved before.
|
308 |
* This helps saving empty value in meta fields (text, check box, etc.) and set the correct default values.
|
|
|
309 |
* @return bool
|
310 |
*/
|
311 |
-
public function is_saved()
|
312 |
-
{
|
313 |
$post = get_post();
|
314 |
|
315 |
-
foreach ( $this->fields as $field )
|
316 |
-
|
317 |
-
if ( empty( $field['id'] ) )
|
318 |
-
{
|
319 |
continue;
|
320 |
}
|
321 |
-
$value =
|
322 |
if (
|
323 |
( ! $field['multiple'] && '' !== $value )
|
324 |
|| ( $field['multiple'] && array() !== $value )
|
325 |
-
)
|
326 |
-
{
|
327 |
return true;
|
328 |
}
|
329 |
}
|
@@ -337,10 +321,8 @@ class RW_Meta_Box
|
|
337 |
* @param WP_Screen $screen Screen object. Optional. Use current screen object by default.
|
338 |
* @return bool
|
339 |
*/
|
340 |
-
public function is_edit_screen( $screen = null )
|
341 |
-
|
342 |
-
if ( ! ( $screen instanceof WP_Screen ) )
|
343 |
-
{
|
344 |
$screen = get_current_screen();
|
345 |
}
|
346 |
return 'post' == $screen->base && in_array( $screen->post_type, $this->meta_box['post_types'] );
|
8 |
* @license GNU GPL2+
|
9 |
* @package Meta Box
|
10 |
*/
|
11 |
+
class RW_Meta_Box {
|
12 |
+
|
13 |
/**
|
14 |
* @var array Meta box information
|
15 |
*/
|
27 |
|
28 |
/**
|
29 |
* Create meta box based on given data
|
30 |
+
*
|
31 |
* @param array $meta_box Meta box definition
|
32 |
*/
|
33 |
+
public function __construct( $meta_box ) {
|
|
|
34 |
$meta_box = self::normalize( $meta_box );
|
35 |
$meta_box['fields'] = self::normalize_fields( $meta_box['fields'] );
|
36 |
|
42 |
// 2nd action applies to only current meta box
|
43 |
$show = apply_filters( 'rwmb_show', true, $this->meta_box );
|
44 |
$show = apply_filters( "rwmb_show_{$this->meta_box['id']}", $show, $this->meta_box );
|
45 |
+
if ( ! $show ) {
|
46 |
return;
|
47 |
+
}
|
48 |
|
49 |
// Enqueue common styles and scripts
|
50 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
51 |
|
52 |
// Add additional actions for fields
|
53 |
+
foreach ( $this->fields as $field ) {
|
|
|
54 |
RWMB_Field::call( $field, 'add_actions' );
|
55 |
}
|
56 |
|
61 |
add_filter( 'default_hidden_meta_boxes', array( $this, 'hide' ), 10, 2 );
|
62 |
|
63 |
// Save post meta
|
64 |
+
foreach ( $this->meta_box['post_types'] as $post_type ) {
|
65 |
+
if ( 'attachment' === $post_type ) {
|
|
|
|
|
66 |
// Attachment uses other hooks
|
67 |
// @see wp_update_post(), wp_insert_attachment()
|
68 |
add_action( 'edit_attachment', array( $this, 'save_post' ) );
|
69 |
add_action( 'add_attachment', array( $this, 'save_post' ) );
|
70 |
+
} else {
|
|
|
|
|
71 |
add_action( "save_post_{$post_type}", array( $this, 'save_post' ) );
|
72 |
}
|
73 |
}
|
76 |
/**
|
77 |
* Enqueue common scripts and styles.
|
78 |
*/
|
79 |
+
public function enqueue() {
|
80 |
+
if ( ! $this->is_edit_screen() ) {
|
|
|
81 |
return;
|
82 |
+
}
|
83 |
|
84 |
wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
|
85 |
+
if ( is_rtl() ) {
|
86 |
wp_enqueue_style( 'rwmb-rtl', RWMB_CSS_URL . 'style-rtl.css', array(), RWMB_VER );
|
87 |
+
}
|
88 |
|
89 |
// Load clone script conditionally
|
90 |
+
foreach ( $this->fields as $field ) {
|
91 |
+
if ( $field['clone'] ) {
|
|
|
|
|
92 |
wp_enqueue_script( 'rwmb-clone', RWMB_JS_URL . 'clone.js', array( 'jquery-ui-sortable' ), RWMB_VER, true );
|
93 |
break;
|
94 |
}
|
95 |
}
|
96 |
|
97 |
// Enqueue scripts and styles for fields
|
98 |
+
foreach ( $this->fields as $field ) {
|
|
|
99 |
RWMB_Field::call( $field, 'admin_enqueue_scripts' );
|
100 |
}
|
101 |
|
102 |
// Auto save
|
103 |
+
if ( $this->meta_box['autosave'] ) {
|
104 |
wp_enqueue_script( 'rwmb-autosave', RWMB_JS_URL . 'autosave.js', array( 'jquery' ), RWMB_VER, true );
|
105 |
+
}
|
106 |
|
107 |
/**
|
108 |
* Allow developers to enqueue more scripts and styles
|
109 |
+
*
|
110 |
* @param RW_Meta_Box $object Meta Box object
|
111 |
*/
|
112 |
do_action( 'rwmb_enqueue_scripts', $this );
|
115 |
/**
|
116 |
* Add meta box for multiple post types
|
117 |
*/
|
118 |
+
public function add_meta_boxes() {
|
119 |
+
foreach ( $this->meta_box['post_types'] as $post_type ) {
|
|
|
|
|
120 |
add_meta_box(
|
121 |
$this->meta_box['id'],
|
122 |
$this->meta_box['title'],
|
136 |
*
|
137 |
* @return array
|
138 |
*/
|
139 |
+
public function hide( $hidden, $screen ) {
|
140 |
+
if ( $this->is_edit_screen( $screen ) && $this->meta_box['default_hidden'] ) {
|
|
|
|
|
141 |
$hidden[] = $this->meta_box['id'];
|
142 |
}
|
143 |
|
147 |
/**
|
148 |
* Callback function to show fields in meta box
|
149 |
*/
|
150 |
+
public function show() {
|
|
|
151 |
$saved = $this->is_saved();
|
152 |
|
153 |
// Container
|
164 |
do_action( 'rwmb_before', $this );
|
165 |
do_action( "rwmb_before_{$this->meta_box['id']}", $this );
|
166 |
|
167 |
+
foreach ( $this->fields as $field ) {
|
|
|
168 |
RWMB_Field::call( 'show', $field, $saved );
|
169 |
}
|
170 |
|
180 |
|
181 |
/**
|
182 |
* Save data from meta box
|
183 |
+
*
|
184 |
* @param int $post_id Post ID
|
185 |
*/
|
186 |
+
public function save_post( $post_id ) {
|
187 |
+
if ( ! $this->validate() ) {
|
|
|
188 |
return;
|
189 |
+
}
|
190 |
$this->saved = true;
|
191 |
|
192 |
// Make sure meta is added to the post, not a revision
|
193 |
+
if ( $the_post = wp_is_post_revision( $post_id ) ) {
|
194 |
$post_id = $the_post;
|
195 |
+
}
|
196 |
|
197 |
// Before save action
|
198 |
do_action( 'rwmb_before_save_post', $post_id );
|
199 |
do_action( "rwmb_{$this->meta_box['id']}_before_save_post", $post_id );
|
200 |
|
201 |
+
foreach ( $this->fields as $field ) {
|
|
|
202 |
$single = $field['clone'] || ! $field['multiple'];
|
203 |
+
$old = RWMB_Field::call( $field, 'raw_meta', $post_id );
|
204 |
+
$new = isset( $_POST[ $field['id'] ] ) ? $_POST[ $field['id'] ] : ( $single ? '' : array() );
|
205 |
|
206 |
// Allow field class change the value
|
207 |
+
if ( $field['clone'] ) {
|
|
|
208 |
$new = RWMB_Clone::value( $new, $old, $post_id, $field );
|
209 |
+
} else {
|
|
|
|
|
210 |
$new = RWMB_Field::call( $field, 'value', $new, $old, $post_id );
|
211 |
$new = RWMB_Field::filter( 'sanitize', $new, $field );
|
212 |
}
|
226 |
* - If this function is called to prevent duplicated calls like revisions, manual hook to wp_insert_post, etc.
|
227 |
* - Autosave
|
228 |
* - If form is submitted properly
|
229 |
+
*
|
230 |
* @return bool
|
231 |
*/
|
232 |
+
protected function validate() {
|
|
|
233 |
$nonce = (string) filter_input( INPUT_POST, "nonce_{$this->meta_box['id']}" );
|
234 |
return
|
235 |
true !== $this->saved
|
239 |
|
240 |
/**
|
241 |
* Normalize parameters for meta box
|
242 |
+
*
|
243 |
* @param array $meta_box Meta box definition
|
244 |
* @return array $meta_box Normalized meta box
|
245 |
*/
|
246 |
+
public static function normalize( $meta_box ) {
|
|
|
247 |
// Set default values for meta box
|
248 |
$meta_box = wp_parse_args( $meta_box, array(
|
249 |
'id' => sanitize_title( $meta_box['title'] ),
|
256 |
|
257 |
/**
|
258 |
* Use 'post_types' for better understanding and fallback to 'pages' for previous versions
|
259 |
+
*
|
260 |
* @since 4.4.1
|
261 |
*/
|
262 |
+
if ( ! empty( $meta_box['pages'] ) ) {
|
|
|
263 |
$meta_box['post_types'] = $meta_box['pages'];
|
264 |
}
|
265 |
|
271 |
|
272 |
/**
|
273 |
* Normalize an array of fields
|
274 |
+
*
|
275 |
* @param array $fields Array of fields
|
276 |
* @return array $fields Normalized fields
|
277 |
*/
|
278 |
+
public static function normalize_fields( $fields ) {
|
279 |
+
foreach ( $fields as $k => $field ) {
|
|
|
|
|
280 |
$field = RWMB_Field::call( 'normalize', $field );
|
281 |
|
282 |
// Allow to add default values for fields
|
284 |
$field = apply_filters( "rwmb_normalize_{$field['type']}_field", $field );
|
285 |
$field = apply_filters( "rwmb_normalize_{$field['id']}_field", $field );
|
286 |
|
287 |
+
$fields[ $k ] = $field;
|
288 |
}
|
289 |
|
290 |
return $fields;
|
293 |
/**
|
294 |
* Check if meta box is saved before.
|
295 |
* This helps saving empty value in meta fields (text, check box, etc.) and set the correct default values.
|
296 |
+
*
|
297 |
* @return bool
|
298 |
*/
|
299 |
+
public function is_saved() {
|
|
|
300 |
$post = get_post();
|
301 |
|
302 |
+
foreach ( $this->fields as $field ) {
|
303 |
+
if ( empty( $field['id'] ) ) {
|
|
|
|
|
304 |
continue;
|
305 |
}
|
306 |
+
$value = RWMB_Field::call( $field, 'raw_meta', $post->ID );
|
307 |
if (
|
308 |
( ! $field['multiple'] && '' !== $value )
|
309 |
|| ( $field['multiple'] && array() !== $value )
|
310 |
+
) {
|
|
|
311 |
return true;
|
312 |
}
|
313 |
}
|
321 |
* @param WP_Screen $screen Screen object. Optional. Use current screen object by default.
|
322 |
* @return bool
|
323 |
*/
|
324 |
+
public function is_edit_screen( $screen = null ) {
|
325 |
+
if ( ! ( $screen instanceof WP_Screen ) ) {
|
|
|
|
|
326 |
$screen = get_current_screen();
|
327 |
}
|
328 |
return 'post' == $screen->base && in_array( $screen->post_type, $this->meta_box['post_types'] );
|
inc/sanitizer.php
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Sanitize field value before saving.
|
|
|
4 |
* @package Meta Box
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Sanitize class.
|
9 |
*/
|
10 |
-
class RWMB_Sanitizer
|
11 |
-
|
12 |
/**
|
13 |
* Built-in callbacks for some specific types.
|
|
|
14 |
* @var array
|
15 |
*/
|
16 |
protected $callbacks = array(
|
@@ -23,18 +25,15 @@ class RWMB_Sanitizer
|
|
23 |
/**
|
24 |
* Register hook to sanitize field value.
|
25 |
*/
|
26 |
-
public function init()
|
27 |
-
{
|
28 |
// Built-in callback
|
29 |
-
foreach ( $this->callbacks as $type => $callback )
|
30 |
-
{
|
31 |
add_filter( "rwmb_{$type}_sanitize", $callback );
|
32 |
}
|
33 |
|
34 |
// Custom callback
|
35 |
$types = array_diff( get_class_methods( __CLASS__ ), array( 'init' ) );
|
36 |
-
foreach ( $types as $type )
|
37 |
-
{
|
38 |
add_filter( "rwmb_{$type}_sanitize", array( $this, $type ) );
|
39 |
}
|
40 |
}
|
@@ -42,12 +41,12 @@ class RWMB_Sanitizer
|
|
42 |
/**
|
43 |
* Set the value of checkbox to 1 or 0 instead of 'checked' and empty string.
|
44 |
* This prevents using default value once the checkbox has been unchecked.
|
|
|
45 |
* @link https://github.com/rilwis/meta-box/issues/6
|
46 |
* @param string $value
|
47 |
* @return int
|
48 |
*/
|
49 |
-
public function checkbox( $value )
|
50 |
-
{
|
51 |
return (int) ! empty( $value );
|
52 |
}
|
53 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Sanitize field value before saving.
|
4 |
+
*
|
5 |
* @package Meta Box
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Sanitize class.
|
10 |
*/
|
11 |
+
class RWMB_Sanitizer {
|
12 |
+
|
13 |
/**
|
14 |
* Built-in callbacks for some specific types.
|
15 |
+
*
|
16 |
* @var array
|
17 |
*/
|
18 |
protected $callbacks = array(
|
25 |
/**
|
26 |
* Register hook to sanitize field value.
|
27 |
*/
|
28 |
+
public function init() {
|
|
|
29 |
// Built-in callback
|
30 |
+
foreach ( $this->callbacks as $type => $callback ) {
|
|
|
31 |
add_filter( "rwmb_{$type}_sanitize", $callback );
|
32 |
}
|
33 |
|
34 |
// Custom callback
|
35 |
$types = array_diff( get_class_methods( __CLASS__ ), array( 'init' ) );
|
36 |
+
foreach ( $types as $type ) {
|
|
|
37 |
add_filter( "rwmb_{$type}_sanitize", array( $this, $type ) );
|
38 |
}
|
39 |
}
|
41 |
/**
|
42 |
* Set the value of checkbox to 1 or 0 instead of 'checked' and empty string.
|
43 |
* This prevents using default value once the checkbox has been unchecked.
|
44 |
+
*
|
45 |
* @link https://github.com/rilwis/meta-box/issues/6
|
46 |
* @param string $value
|
47 |
* @return int
|
48 |
*/
|
49 |
+
public function checkbox( $value ) {
|
|
|
50 |
return (int) ! empty( $value );
|
51 |
}
|
52 |
}
|
inc/validation.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Validation module.
|
|
|
4 |
* @package Meta Box
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Validation class.
|
9 |
*/
|
10 |
-
class RWMB_Validation
|
11 |
-
|
12 |
/**
|
13 |
* Add hooks when module is loaded.
|
14 |
*/
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
add_action( 'rwmb_after', array( $this, 'rules' ) );
|
18 |
add_action( 'rwmb_enqueue_scripts', array( $this, 'enqueue' ) );
|
19 |
}
|
@@ -21,40 +21,30 @@ class RWMB_Validation
|
|
21 |
/**
|
22 |
* Output validation rules of each meta box.
|
23 |
* The rules are outputted in [data-rules] attribute of an hidden <script> and will be converted into JSON by JS.
|
|
|
24 |
* @param RW_Meta_Box $object Meta Box object
|
25 |
*/
|
26 |
-
public function rules( $object )
|
27 |
-
|
28 |
-
if ( ! empty( $object->meta_box['validation'] ) )
|
29 |
-
{
|
30 |
echo '<script type="text/html" class="rwmb-validation-rules" data-rules="' . esc_attr( json_encode( $object->meta_box['validation'] ) ) . '"></script>';
|
31 |
}
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
* Enqueue scripts for validation.
|
|
|
36 |
* @param RW_Meta_Box $object Meta Box object
|
37 |
*/
|
38 |
-
public function enqueue( $object )
|
39 |
-
|
40 |
-
if ( empty( $object->meta_box['validation'] ) )
|
41 |
-
{
|
42 |
return;
|
43 |
}
|
44 |
wp_enqueue_script( 'jquery-validation', RWMB_JS_URL . 'jquery-validation/jquery.validate.min.js', array( 'jquery' ), '1.15.0', true );
|
45 |
wp_enqueue_script( 'jquery-validation-additional-methods', RWMB_JS_URL . 'jquery-validation/additional-methods.min.js', array( 'jquery-validation' ), '1.15.0', true );
|
46 |
wp_enqueue_script( 'rwmb-validate', RWMB_JS_URL . 'validate.js', array( 'jquery-validation', 'jquery-validation-additional-methods' ), RWMB_VER, true );
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
*/
|
52 |
-
$wp_scripts = wp_scripts();
|
53 |
-
if ( ! $wp_scripts->get_data( 'rwmb-validate', 'data' ) )
|
54 |
-
{
|
55 |
-
wp_localize_script( 'rwmb-validate', 'rwmbValidate', array(
|
56 |
-
'summaryMessage' => esc_html__( 'Please correct the errors highlighted below and try again.', 'meta-box' ),
|
57 |
-
) );
|
58 |
-
}
|
59 |
}
|
60 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Validation module.
|
4 |
+
*
|
5 |
* @package Meta Box
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Validation class.
|
10 |
*/
|
11 |
+
class RWMB_Validation {
|
12 |
+
|
13 |
/**
|
14 |
* Add hooks when module is loaded.
|
15 |
*/
|
16 |
+
public function __construct() {
|
|
|
17 |
add_action( 'rwmb_after', array( $this, 'rules' ) );
|
18 |
add_action( 'rwmb_enqueue_scripts', array( $this, 'enqueue' ) );
|
19 |
}
|
21 |
/**
|
22 |
* Output validation rules of each meta box.
|
23 |
* The rules are outputted in [data-rules] attribute of an hidden <script> and will be converted into JSON by JS.
|
24 |
+
*
|
25 |
* @param RW_Meta_Box $object Meta Box object
|
26 |
*/
|
27 |
+
public function rules( $object ) {
|
28 |
+
if ( ! empty( $object->meta_box['validation'] ) ) {
|
|
|
|
|
29 |
echo '<script type="text/html" class="rwmb-validation-rules" data-rules="' . esc_attr( json_encode( $object->meta_box['validation'] ) ) . '"></script>';
|
30 |
}
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* Enqueue scripts for validation.
|
35 |
+
*
|
36 |
* @param RW_Meta_Box $object Meta Box object
|
37 |
*/
|
38 |
+
public function enqueue( $object ) {
|
39 |
+
if ( empty( $object->meta_box['validation'] ) ) {
|
|
|
|
|
40 |
return;
|
41 |
}
|
42 |
wp_enqueue_script( 'jquery-validation', RWMB_JS_URL . 'jquery-validation/jquery.validate.min.js', array( 'jquery' ), '1.15.0', true );
|
43 |
wp_enqueue_script( 'jquery-validation-additional-methods', RWMB_JS_URL . 'jquery-validation/additional-methods.min.js', array( 'jquery-validation' ), '1.15.0', true );
|
44 |
wp_enqueue_script( 'rwmb-validate', RWMB_JS_URL . 'validate.js', array( 'jquery-validation', 'jquery-validation-additional-methods' ), RWMB_VER, true );
|
45 |
|
46 |
+
self::localize_script( 'rwmb-validate', 'rwmbValidate', array(
|
47 |
+
'summaryMessage' => esc_html__( 'Please correct the errors highlighted below and try again.', 'meta-box' ),
|
48 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
}
|
inc/walkers/base.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
* Base Walker
|
4 |
* Walkers must inherit this class and overwrite methods with its own.
|
5 |
*/
|
6 |
-
abstract class RWMB_Walker_Base extends Walker
|
7 |
-
|
8 |
/**
|
9 |
* Field data.
|
10 |
*
|
@@ -21,8 +21,7 @@ abstract class RWMB_Walker_Base extends Walker
|
|
21 |
*/
|
22 |
public $meta = array();
|
23 |
|
24 |
-
function __construct( $db_fields, $field, $meta )
|
25 |
-
{
|
26 |
$this->db_fields = wp_parse_args( (array) $db_fields, array(
|
27 |
'parent' => '',
|
28 |
'id' => '',
|
3 |
* Base Walker
|
4 |
* Walkers must inherit this class and overwrite methods with its own.
|
5 |
*/
|
6 |
+
abstract class RWMB_Walker_Base extends Walker {
|
7 |
+
|
8 |
/**
|
9 |
* Field data.
|
10 |
*
|
21 |
*/
|
22 |
public $meta = array();
|
23 |
|
24 |
+
function __construct( $db_fields, $field, $meta ) {
|
|
|
25 |
$this->db_fields = wp_parse_args( (array) $db_fields, array(
|
26 |
'parent' => '',
|
27 |
'id' => '',
|
inc/walkers/input-list.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
* Input List Walker
|
5 |
* For checkbox and radio list fields
|
6 |
*/
|
7 |
-
class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
8 |
-
|
9 |
/**
|
10 |
* @see Walker::start_lvl()
|
11 |
*
|
@@ -13,8 +13,7 @@ class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
|
13 |
* @param int $depth Depth of item.
|
14 |
* @param array $args
|
15 |
*/
|
16 |
-
public function start_lvl( &$output, $depth = 0, $args = array() )
|
17 |
-
{
|
18 |
$output .= '<ul class="rwmb-input-list">';
|
19 |
}
|
20 |
|
@@ -25,8 +24,7 @@ class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
|
25 |
* @param int $depth Depth of item.
|
26 |
* @param array $args
|
27 |
*/
|
28 |
-
public function end_lvl( &$output, $depth = 0, $args = array() )
|
29 |
-
{
|
30 |
$output .= '</ul>';
|
31 |
}
|
32 |
|
@@ -39,8 +37,7 @@ class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
|
39 |
* @param int $current_object_id Item ID.
|
40 |
* @param array $args
|
41 |
*/
|
42 |
-
public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 )
|
43 |
-
{
|
44 |
$label = $this->db_fields['label'];
|
45 |
$id = $this->db_fields['id'];
|
46 |
$attributes = RWMB_Field::call( 'get_attributes', $this->field, $object->$id );
|
@@ -49,7 +46,7 @@ class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
|
49 |
'<li><label><input %s %s>%s</label>',
|
50 |
RWMB_Field::render_attributes( $attributes ),
|
51 |
checked( in_array( $object->$id, $this->meta ), 1, false ),
|
52 |
-
$object->$label
|
53 |
);
|
54 |
}
|
55 |
|
@@ -61,8 +58,7 @@ class RWMB_Walker_Input_List extends RWMB_Walker_Base
|
|
61 |
* @param int $depth Depth of page. Not Used.
|
62 |
* @param array $args
|
63 |
*/
|
64 |
-
public function end_el( &$output, $page, $depth = 0, $args = array() )
|
65 |
-
{
|
66 |
$output .= '</li>';
|
67 |
}
|
68 |
}
|
4 |
* Input List Walker
|
5 |
* For checkbox and radio list fields
|
6 |
*/
|
7 |
+
class RWMB_Walker_Input_List extends RWMB_Walker_Base {
|
8 |
+
|
9 |
/**
|
10 |
* @see Walker::start_lvl()
|
11 |
*
|
13 |
* @param int $depth Depth of item.
|
14 |
* @param array $args
|
15 |
*/
|
16 |
+
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
|
|
17 |
$output .= '<ul class="rwmb-input-list">';
|
18 |
}
|
19 |
|
24 |
* @param int $depth Depth of item.
|
25 |
* @param array $args
|
26 |
*/
|
27 |
+
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
|
|
28 |
$output .= '</ul>';
|
29 |
}
|
30 |
|
37 |
* @param int $current_object_id Item ID.
|
38 |
* @param array $args
|
39 |
*/
|
40 |
+
public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
|
|
41 |
$label = $this->db_fields['label'];
|
42 |
$id = $this->db_fields['id'];
|
43 |
$attributes = RWMB_Field::call( 'get_attributes', $this->field, $object->$id );
|
46 |
'<li><label><input %s %s>%s</label>',
|
47 |
RWMB_Field::render_attributes( $attributes ),
|
48 |
checked( in_array( $object->$id, $this->meta ), 1, false ),
|
49 |
+
RWMB_Field::filter( 'choice_label', $object->$label, $this->field, $object )
|
50 |
);
|
51 |
}
|
52 |
|
58 |
* @param int $depth Depth of page. Not Used.
|
59 |
* @param array $args
|
60 |
*/
|
61 |
+
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
|
|
|
62 |
$output .= '</li>';
|
63 |
}
|
64 |
}
|
inc/walkers/select-tree.php
CHANGED
@@ -2,24 +2,26 @@
|
|
2 |
|
3 |
/**
|
4 |
* Select Tree Walker for cascading select fields.
|
|
|
5 |
* @uses RWMB_Walker_Select
|
6 |
*/
|
7 |
-
class RWMB_Walker_Select_Tree
|
8 |
-
|
9 |
/**
|
10 |
* Field data.
|
|
|
11 |
* @var string
|
12 |
*/
|
13 |
public $field;
|
14 |
|
15 |
/**
|
16 |
* Field meta value.
|
|
|
17 |
* @var array
|
18 |
*/
|
19 |
public $meta = array();
|
20 |
|
21 |
-
function __construct( $db_fields, $field, $meta )
|
22 |
-
{
|
23 |
$this->db_fields = wp_parse_args( (array) $db_fields, array(
|
24 |
'parent' => '',
|
25 |
'id' => '',
|
@@ -29,27 +31,24 @@ class RWMB_Walker_Select_Tree
|
|
29 |
$this->meta = (array) $meta;
|
30 |
}
|
31 |
|
32 |
-
function walk( $options )
|
33 |
-
{
|
34 |
$parent = $this->db_fields['parent'];
|
35 |
$children = array();
|
36 |
|
37 |
-
foreach ( $options as $option )
|
38 |
-
|
39 |
-
$children[$option->$parent][] = $option;
|
40 |
}
|
41 |
$top_level = isset( $children[0] ) ? 0 : $options[0]->$parent;
|
42 |
return $this->display_level( $children, $top_level, true );
|
43 |
}
|
44 |
|
45 |
-
function display_level( $options, $parent_id = 0, $active = false )
|
46 |
-
{
|
47 |
$id = $this->db_fields['id'];
|
48 |
$field = $this->field;
|
49 |
$walker = new RWMB_Walker_Select( $this->db_fields, $field, $this->meta );
|
50 |
$attributes = RWMB_Field::call( 'get_attributes', $field, $this->meta );
|
51 |
|
52 |
-
$children = $options[$parent_id];
|
53 |
$output = sprintf(
|
54 |
'<div class="rwmb-select-tree %s" data-parent-id="%s"><select %s>',
|
55 |
$active ? '' : 'hidden',
|
@@ -60,10 +59,8 @@ class RWMB_Walker_Select_Tree
|
|
60 |
$output .= $walker->walk( $children, - 1 );
|
61 |
$output .= '</select>';
|
62 |
|
63 |
-
foreach ( $children as $c )
|
64 |
-
|
65 |
-
if ( isset( $options[$c->$id] ) )
|
66 |
-
{
|
67 |
$output .= $this->display_level( $options, $c->$id, in_array( $c->$id, $this->meta ) && $active );
|
68 |
}
|
69 |
}
|
2 |
|
3 |
/**
|
4 |
* Select Tree Walker for cascading select fields.
|
5 |
+
*
|
6 |
* @uses RWMB_Walker_Select
|
7 |
*/
|
8 |
+
class RWMB_Walker_Select_Tree {
|
9 |
+
|
10 |
/**
|
11 |
* Field data.
|
12 |
+
*
|
13 |
* @var string
|
14 |
*/
|
15 |
public $field;
|
16 |
|
17 |
/**
|
18 |
* Field meta value.
|
19 |
+
*
|
20 |
* @var array
|
21 |
*/
|
22 |
public $meta = array();
|
23 |
|
24 |
+
function __construct( $db_fields, $field, $meta ) {
|
|
|
25 |
$this->db_fields = wp_parse_args( (array) $db_fields, array(
|
26 |
'parent' => '',
|
27 |
'id' => '',
|
31 |
$this->meta = (array) $meta;
|
32 |
}
|
33 |
|
34 |
+
function walk( $options ) {
|
|
|
35 |
$parent = $this->db_fields['parent'];
|
36 |
$children = array();
|
37 |
|
38 |
+
foreach ( $options as $option ) {
|
39 |
+
$children[ $option->$parent ][] = $option;
|
|
|
40 |
}
|
41 |
$top_level = isset( $children[0] ) ? 0 : $options[0]->$parent;
|
42 |
return $this->display_level( $children, $top_level, true );
|
43 |
}
|
44 |
|
45 |
+
function display_level( $options, $parent_id = 0, $active = false ) {
|
|
|
46 |
$id = $this->db_fields['id'];
|
47 |
$field = $this->field;
|
48 |
$walker = new RWMB_Walker_Select( $this->db_fields, $field, $this->meta );
|
49 |
$attributes = RWMB_Field::call( 'get_attributes', $field, $this->meta );
|
50 |
|
51 |
+
$children = $options[ $parent_id ];
|
52 |
$output = sprintf(
|
53 |
'<div class="rwmb-select-tree %s" data-parent-id="%s"><select %s>',
|
54 |
$active ? '' : 'hidden',
|
59 |
$output .= $walker->walk( $children, - 1 );
|
60 |
$output .= '</select>';
|
61 |
|
62 |
+
foreach ( $children as $c ) {
|
63 |
+
if ( isset( $options[ $c->$id ] ) ) {
|
|
|
|
|
64 |
$output .= $this->display_level( $options, $c->$id, in_array( $c->$id, $this->meta ) && $active );
|
65 |
}
|
66 |
}
|
inc/walkers/select.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
* Select Walker
|
4 |
* For generating Select fields
|
5 |
*/
|
6 |
-
class RWMB_Walker_Select extends RWMB_Walker_Base
|
7 |
-
|
8 |
/**
|
9 |
* @see Walker::start_el()
|
10 |
*
|
@@ -14,19 +14,18 @@ class RWMB_Walker_Select extends RWMB_Walker_Base
|
|
14 |
* @param int $current_object_id Item id.
|
15 |
* @param array $args
|
16 |
*/
|
17 |
-
public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 )
|
18 |
-
{
|
19 |
$label = $this->db_fields['label'];
|
20 |
$id = $this->db_fields['id'];
|
21 |
$meta = $this->meta;
|
22 |
-
$indent = str_repeat(
|
23 |
|
24 |
$output .= sprintf(
|
25 |
'<option value="%s" %s>%s%s</option>',
|
26 |
$object->$id,
|
27 |
selected( in_array( $object->$id, $meta ), 1, false ),
|
28 |
$indent,
|
29 |
-
$object->$label
|
30 |
);
|
31 |
}
|
32 |
}
|
3 |
* Select Walker
|
4 |
* For generating Select fields
|
5 |
*/
|
6 |
+
class RWMB_Walker_Select extends RWMB_Walker_Base {
|
7 |
+
|
8 |
/**
|
9 |
* @see Walker::start_el()
|
10 |
*
|
14 |
* @param int $current_object_id Item id.
|
15 |
* @param array $args
|
16 |
*/
|
17 |
+
public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
|
|
18 |
$label = $this->db_fields['label'];
|
19 |
$id = $this->db_fields['id'];
|
20 |
$meta = $this->meta;
|
21 |
+
$indent = str_repeat( ' ', $depth * 4 );
|
22 |
|
23 |
$output .= sprintf(
|
24 |
'<option value="%s" %s>%s%s</option>',
|
25 |
$object->$id,
|
26 |
selected( in_array( $object->$id, $meta ), 1, false ),
|
27 |
$indent,
|
28 |
+
RWMB_Field::filter( 'choice_label', $object->$label, $this->field, $object )
|
29 |
);
|
30 |
}
|
31 |
}
|
inc/wpml.php
CHANGED
@@ -5,47 +5,46 @@
|
|
5 |
*/
|
6 |
class RWMB_WPML {
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
}
|
5 |
*/
|
6 |
class RWMB_WPML {
|
7 |
|
8 |
+
/**
|
9 |
+
* Register hooks.
|
10 |
+
*/
|
11 |
+
public function __construct() {
|
12 |
+
add_filter( 'wpml_duplicate_generic_string', array( $this, 'wpml_translate_values' ), 10, 3 );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Translating IDs stored as field values upon WPML post/page duplication.
|
17 |
+
*
|
18 |
+
* @param $value
|
19 |
+
* @param $target_language
|
20 |
+
* @param $meta_data
|
21 |
+
* @return mixed
|
22 |
+
*/
|
23 |
+
public function wpml_translate_values( $value, $target_language, $meta_data ) {
|
24 |
+
$fields = RWMB_Core::get_fields();
|
25 |
+
|
26 |
+
foreach ( $fields as $field ) {
|
27 |
+
if ( in_array( $field['type'], array( 'post', 'taxonomy_advanced' ) ) && $field['id'] === $meta_data['key'] ) {
|
28 |
+
// Post type needed for WPML filter differs between fields
|
29 |
+
$post_type = $field['type'] === 'taxonomy_advanced' ? $field['taxonomy'] : $field['post_type'];
|
30 |
+
|
31 |
+
// Translating values, whether are stored as comma separated strings or not.
|
32 |
+
if ( ( strpos( $value, ',' ) === false ) ) {
|
33 |
+
$value = apply_filters( 'wpml_object_id', $value, $post_type, true, $target_language );
|
34 |
+
} else {
|
35 |
+
// Dealing with IDs stored as comma separated strings
|
36 |
+
$translated_values = array();
|
37 |
+
$values = explode( ',', $value );
|
38 |
+
|
39 |
+
foreach ( $values as $v ) {
|
40 |
+
$translated_values[] = apply_filters( 'wpml_object_id', $v, $post_type, true, $target_language );
|
41 |
+
}
|
42 |
+
|
43 |
+
$value = implode( ',', $translated_values );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return $value;
|
49 |
+
}
|
50 |
+
}
|
|
js/autocomplete.js
CHANGED
@@ -1,32 +1,27 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update date picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function updateAutocomplete( e )
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
-
$search = $this.siblings( '.rwmb-autocomplete-search'),
|
13 |
$result = $this.siblings( '.rwmb-autocomplete-results' ),
|
14 |
name = $this.attr( 'name' );
|
15 |
|
16 |
// If the function is called on cloning, then change the field name and clear all results
|
17 |
// @see clone.js
|
18 |
-
if ( e.hasOwnProperty( 'type' ) && 'clone' == e.type )
|
19 |
-
{
|
20 |
// Clear all results
|
21 |
$result.html( '' );
|
22 |
}
|
23 |
|
24 |
-
$search.removeClass( 'ui-autocomplete-input' )
|
25 |
-
.autocomplete( {
|
26 |
minLength: 0,
|
27 |
-
source
|
28 |
-
select
|
29 |
-
{
|
30 |
$result.append(
|
31 |
'<div class="rwmb-autocomplete-result">' +
|
32 |
'<div class="label">' + ( typeof ui.item.excerpt !== 'undefined' ? ui.item.excerpt : ui.item.label ) + '</div>' +
|
@@ -47,8 +42,7 @@ jQuery( function ( $ )
|
|
47 |
$( '.rwmb-input' ).on( 'clone', ':input.rwmb-autocomplete', updateAutocomplete );
|
48 |
|
49 |
// Handle remove action
|
50 |
-
$( document ).on( 'click', '.rwmb-autocomplete-result .actions', function ()
|
51 |
-
{
|
52 |
// remove result
|
53 |
$( this ).parent().remove();
|
54 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update date picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function updateAutocomplete( e ) {
|
|
|
9 |
var $this = $( this ),
|
10 |
+
$search = $this.siblings( '.rwmb-autocomplete-search' ),
|
11 |
$result = $this.siblings( '.rwmb-autocomplete-results' ),
|
12 |
name = $this.attr( 'name' );
|
13 |
|
14 |
// If the function is called on cloning, then change the field name and clear all results
|
15 |
// @see clone.js
|
16 |
+
if ( e.hasOwnProperty( 'type' ) && 'clone' == e.type ) {
|
|
|
17 |
// Clear all results
|
18 |
$result.html( '' );
|
19 |
}
|
20 |
|
21 |
+
$search.removeClass( 'ui-autocomplete-input' ).autocomplete( {
|
|
|
22 |
minLength: 0,
|
23 |
+
source: $this.data( 'options' ),
|
24 |
+
select: function ( event, ui ) {
|
|
|
25 |
$result.append(
|
26 |
'<div class="rwmb-autocomplete-result">' +
|
27 |
'<div class="label">' + ( typeof ui.item.excerpt !== 'undefined' ? ui.item.excerpt : ui.item.label ) + '</div>' +
|
42 |
$( '.rwmb-input' ).on( 'clone', ':input.rwmb-autocomplete', updateAutocomplete );
|
43 |
|
44 |
// Handle remove action
|
45 |
+
$( document ).on( 'click', '.rwmb-autocomplete-result .actions', function () {
|
|
|
46 |
// remove result
|
47 |
$( this ).parent().remove();
|
48 |
} );
|
js/autosave.js
CHANGED
@@ -1,16 +1,11 @@
|
|
1 |
-
jQuery( function( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
-
$( document ).ajaxSend( function( e, xhr, s )
|
6 |
-
|
7 |
-
|
8 |
-
{
|
9 |
-
$( '.rwmb-meta-box').each( function()
|
10 |
-
{
|
11 |
var $meta_box = $( this );
|
12 |
-
if ( $meta_box.data( 'autosave' ) === true )
|
13 |
-
{
|
14 |
s.data += '&' + $meta_box.find( ':input' ).serialize();
|
15 |
}
|
16 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
+
$( document ).ajaxSend( function ( e, xhr, s ) {
|
5 |
+
if ( typeof s.data !== 'undefined' && - 1 !== s.data.indexOf( 'action=autosave' ) ) {
|
6 |
+
$( '.rwmb-meta-box' ).each( function () {
|
|
|
|
|
|
|
7 |
var $meta_box = $( this );
|
8 |
+
if ( $meta_box.data( 'autosave' ) === true ) {
|
|
|
9 |
s.data += '&' + $meta_box.find( ':input' ).serialize();
|
10 |
}
|
11 |
} );
|
js/clone.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
/* global jQuery */
|
2 |
-
jQuery( function ( $ )
|
3 |
-
{
|
4 |
'use strict';
|
5 |
|
6 |
// Object holds all methods related to fields' index when clone
|
@@ -10,31 +9,26 @@ jQuery( function ( $ )
|
|
10 |
* @param $clone .rwmb-clone element
|
11 |
* @param index Index value
|
12 |
*/
|
13 |
-
set: function ( $clone, index )
|
14 |
-
|
15 |
-
$clone.find( ':input[class|="rwmb"]' ).each( function ()
|
16 |
-
{
|
17 |
var $field = $( this );
|
18 |
|
19 |
// Name attribute
|
20 |
var name = $field.attr( 'name' );
|
21 |
-
if ( name &&
|
22 |
-
{
|
23 |
$field.attr( 'name', cloneIndex.replace( index, name, '[', ']', false ) );
|
24 |
}
|
25 |
|
26 |
// ID attribute
|
27 |
var id = this.id;
|
28 |
-
if ( id )
|
29 |
-
{
|
30 |
$field.attr( 'id', cloneIndex.replace( index, id, '_' ) );
|
31 |
}
|
32 |
} );
|
33 |
|
34 |
// Address button's value attribute
|
35 |
var $address = $clone.find( '.rwmb-map-goto-address-button' );
|
36 |
-
if ( $address.length )
|
37 |
-
{
|
38 |
var value = $address.attr( 'value' );
|
39 |
$address.attr( 'value', cloneIndex.replace( index, value, '_' ) );
|
40 |
}
|
@@ -49,8 +43,7 @@ jQuery( function ( $ )
|
|
49 |
* @param alternative Check if attribute does not contain any integer, will reset the attribute?
|
50 |
* @return string
|
51 |
*/
|
52 |
-
replace: function ( index, value, before, after, alternative )
|
53 |
-
{
|
54 |
before = before || '';
|
55 |
after = after || '';
|
56 |
alternative = alternative || true;
|
@@ -67,8 +60,7 @@ jQuery( function ( $ )
|
|
67 |
* @param string
|
68 |
* @return string
|
69 |
*/
|
70 |
-
escapeRegex: function ( string )
|
71 |
-
{
|
72 |
return string.replace( /[.*+?^${}()|[\]\\]/g, "\\$&" );
|
73 |
},
|
74 |
|
@@ -77,8 +69,7 @@ jQuery( function ( $ )
|
|
77 |
* @param $container .rwmb-input container
|
78 |
* @return integer
|
79 |
*/
|
80 |
-
nextIndex: function ( $container )
|
81 |
-
{
|
82 |
var nextIndex = $container.data( 'next-index' );
|
83 |
$container.data( 'next-index', nextIndex + 1 );
|
84 |
return nextIndex;
|
@@ -90,29 +81,22 @@ jQuery( function ( $ )
|
|
90 |
* @param $container A div container which has all fields
|
91 |
* @return void
|
92 |
*/
|
93 |
-
function clone( $container )
|
94 |
-
{
|
95 |
var $last = $container.children( '.rwmb-clone:last' ),
|
96 |
$clone = $last.clone(),
|
97 |
$input = $clone.find( ':input[class|="rwmb"]' ),
|
98 |
nextIndex = cloneIndex.nextIndex( $container );
|
99 |
|
100 |
// Reset value for fields
|
101 |
-
$input.each( function ()
|
102 |
-
{
|
103 |
var $field = $( this );
|
104 |
-
if ( $field.is( ':radio' ) || $field.is( ':checkbox' ) )
|
105 |
-
{
|
106 |
// Reset 'checked' attribute
|
107 |
$field.prop( 'checked', false );
|
108 |
-
}
|
109 |
-
else if ( $field.is( 'select' ) )
|
110 |
-
{
|
111 |
// Reset select
|
112 |
-
$field.prop( 'selectedIndex', -1 )
|
113 |
-
}
|
114 |
-
else if ( ! $field.hasClass( 'rwmb-hidden' ) )
|
115 |
-
{
|
116 |
// Reset value
|
117 |
$field.val( '' );
|
118 |
}
|
@@ -138,14 +122,12 @@ jQuery( function ( $ )
|
|
138 |
*
|
139 |
* @return void
|
140 |
*/
|
141 |
-
function toggleRemoveButtons( $container )
|
142 |
-
{
|
143 |
var $clones = $container.children( '.rwmb-clone' );
|
144 |
$clones.children( '.remove-clone' ).toggle( $clones.length > 1 );
|
145 |
|
146 |
// Recursive for nested groups.
|
147 |
-
$container.find( '.rwmb-input' ).each( function ()
|
148 |
-
{
|
149 |
toggleRemoveButtons( $( this ) );
|
150 |
} );
|
151 |
}
|
@@ -158,8 +140,7 @@ jQuery( function ( $ )
|
|
158 |
*
|
159 |
* @return void
|
160 |
*/
|
161 |
-
function toggleAddButton( $container )
|
162 |
-
{
|
163 |
var $button = $container.find( '.add-clone' ),
|
164 |
maxClone = parseInt( $container.data( 'max-clone' ) ),
|
165 |
numClone = $container.find( '.rwmb-clone' ).length;
|
@@ -168,9 +149,8 @@ jQuery( function ( $ )
|
|
168 |
}
|
169 |
|
170 |
$( '#wpbody-content' )
|
171 |
-
|
172 |
-
.on( 'click', '.add-clone', function ( e )
|
173 |
-
{
|
174 |
e.preventDefault();
|
175 |
|
176 |
var $container = $( this ).closest( '.rwmb-input' );
|
@@ -180,16 +160,14 @@ jQuery( function ( $ )
|
|
180 |
toggleAddButton( $container );
|
181 |
} )
|
182 |
// Remove clones
|
183 |
-
.on( 'click', '.remove-clone', function ( e )
|
184 |
-
{
|
185 |
e.preventDefault();
|
186 |
|
187 |
var $this = $( this ),
|
188 |
$container = $this.closest( '.rwmb-input' );
|
189 |
|
190 |
// Remove clone only if there are 2 or more of them
|
191 |
-
if ( $container.children( '.rwmb-clone' ).length < 2 )
|
192 |
-
{
|
193 |
return;
|
194 |
}
|
195 |
|
@@ -198,8 +176,7 @@ jQuery( function ( $ )
|
|
198 |
toggleAddButton( $container )
|
199 |
} );
|
200 |
|
201 |
-
$( '.rwmb-input' ).each( function ()
|
202 |
-
{
|
203 |
var $container = $( this );
|
204 |
toggleRemoveButtons( $container );
|
205 |
toggleAddButton( $container );
|
@@ -207,11 +184,10 @@ jQuery( function ( $ )
|
|
207 |
$container
|
208 |
.data( 'next-index', $container.children( '.rwmb-clone' ).length )
|
209 |
.sortable( {
|
210 |
-
handle
|
211 |
placeholder: ' rwmb-clone rwmb-clone-placeholder',
|
212 |
-
items
|
213 |
-
start
|
214 |
-
{
|
215 |
// Make the placeholder has the same height as dragged item
|
216 |
ui.placeholder.height( ui.item.height() );
|
217 |
}
|
1 |
/* global jQuery */
|
2 |
+
jQuery( function ( $ ) {
|
|
|
3 |
'use strict';
|
4 |
|
5 |
// Object holds all methods related to fields' index when clone
|
9 |
* @param $clone .rwmb-clone element
|
10 |
* @param index Index value
|
11 |
*/
|
12 |
+
set: function ( $clone, index ) {
|
13 |
+
$clone.find( ':input[class|="rwmb"]' ).each( function () {
|
|
|
|
|
14 |
var $field = $( this );
|
15 |
|
16 |
// Name attribute
|
17 |
var name = $field.attr( 'name' );
|
18 |
+
if ( name && ! $field.closest( '.rwmb-group-clone' ).length ) {
|
|
|
19 |
$field.attr( 'name', cloneIndex.replace( index, name, '[', ']', false ) );
|
20 |
}
|
21 |
|
22 |
// ID attribute
|
23 |
var id = this.id;
|
24 |
+
if ( id ) {
|
|
|
25 |
$field.attr( 'id', cloneIndex.replace( index, id, '_' ) );
|
26 |
}
|
27 |
} );
|
28 |
|
29 |
// Address button's value attribute
|
30 |
var $address = $clone.find( '.rwmb-map-goto-address-button' );
|
31 |
+
if ( $address.length ) {
|
|
|
32 |
var value = $address.attr( 'value' );
|
33 |
$address.attr( 'value', cloneIndex.replace( index, value, '_' ) );
|
34 |
}
|
43 |
* @param alternative Check if attribute does not contain any integer, will reset the attribute?
|
44 |
* @return string
|
45 |
*/
|
46 |
+
replace: function ( index, value, before, after, alternative ) {
|
|
|
47 |
before = before || '';
|
48 |
after = after || '';
|
49 |
alternative = alternative || true;
|
60 |
* @param string
|
61 |
* @return string
|
62 |
*/
|
63 |
+
escapeRegex: function ( string ) {
|
|
|
64 |
return string.replace( /[.*+?^${}()|[\]\\]/g, "\\$&" );
|
65 |
},
|
66 |
|
69 |
* @param $container .rwmb-input container
|
70 |
* @return integer
|
71 |
*/
|
72 |
+
nextIndex: function ( $container ) {
|
|
|
73 |
var nextIndex = $container.data( 'next-index' );
|
74 |
$container.data( 'next-index', nextIndex + 1 );
|
75 |
return nextIndex;
|
81 |
* @param $container A div container which has all fields
|
82 |
* @return void
|
83 |
*/
|
84 |
+
function clone( $container ) {
|
|
|
85 |
var $last = $container.children( '.rwmb-clone:last' ),
|
86 |
$clone = $last.clone(),
|
87 |
$input = $clone.find( ':input[class|="rwmb"]' ),
|
88 |
nextIndex = cloneIndex.nextIndex( $container );
|
89 |
|
90 |
// Reset value for fields
|
91 |
+
$input.each( function () {
|
|
|
92 |
var $field = $( this );
|
93 |
+
if ( $field.is( ':radio' ) || $field.is( ':checkbox' ) ) {
|
|
|
94 |
// Reset 'checked' attribute
|
95 |
$field.prop( 'checked', false );
|
96 |
+
} else if ( $field.is( 'select' ) ) {
|
|
|
|
|
97 |
// Reset select
|
98 |
+
$field.prop( 'selectedIndex', - 1 )
|
99 |
+
} else if ( ! $field.hasClass( 'rwmb-hidden' ) ) {
|
|
|
|
|
100 |
// Reset value
|
101 |
$field.val( '' );
|
102 |
}
|
122 |
*
|
123 |
* @return void
|
124 |
*/
|
125 |
+
function toggleRemoveButtons( $container ) {
|
|
|
126 |
var $clones = $container.children( '.rwmb-clone' );
|
127 |
$clones.children( '.remove-clone' ).toggle( $clones.length > 1 );
|
128 |
|
129 |
// Recursive for nested groups.
|
130 |
+
$container.find( '.rwmb-input' ).each( function () {
|
|
|
131 |
toggleRemoveButtons( $( this ) );
|
132 |
} );
|
133 |
}
|
140 |
*
|
141 |
* @return void
|
142 |
*/
|
143 |
+
function toggleAddButton( $container ) {
|
|
|
144 |
var $button = $container.find( '.add-clone' ),
|
145 |
maxClone = parseInt( $container.data( 'max-clone' ) ),
|
146 |
numClone = $container.find( '.rwmb-clone' ).length;
|
149 |
}
|
150 |
|
151 |
$( '#wpbody-content' )
|
152 |
+
// Add clones
|
153 |
+
.on( 'click', '.add-clone', function ( e ) {
|
|
|
154 |
e.preventDefault();
|
155 |
|
156 |
var $container = $( this ).closest( '.rwmb-input' );
|
160 |
toggleAddButton( $container );
|
161 |
} )
|
162 |
// Remove clones
|
163 |
+
.on( 'click', '.remove-clone', function ( e ) {
|
|
|
164 |
e.preventDefault();
|
165 |
|
166 |
var $this = $( this ),
|
167 |
$container = $this.closest( '.rwmb-input' );
|
168 |
|
169 |
// Remove clone only if there are 2 or more of them
|
170 |
+
if ( $container.children( '.rwmb-clone' ).length < 2 ) {
|
|
|
171 |
return;
|
172 |
}
|
173 |
|
176 |
toggleAddButton( $container )
|
177 |
} );
|
178 |
|
179 |
+
$( '.rwmb-input' ).each( function () {
|
|
|
180 |
var $container = $( this );
|
181 |
toggleRemoveButtons( $container );
|
182 |
toggleAddButton( $container );
|
184 |
$container
|
185 |
.data( 'next-index', $container.children( '.rwmb-clone' ).length )
|
186 |
.sortable( {
|
187 |
+
handle: '.rwmb-clone-icon',
|
188 |
placeholder: ' rwmb-clone rwmb-clone-placeholder',
|
189 |
+
items: '.rwmb-clone',
|
190 |
+
start: function ( event, ui ) {
|
|
|
191 |
// Make the placeholder has the same height as dragged item
|
192 |
ui.placeholder.height( ui.item.height() );
|
193 |
}
|
js/color.js
CHANGED
@@ -1,23 +1,19 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update color picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function update()
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
$container = $this.closest( '.wp-picker-container' ),
|
13 |
data = $.extend(
|
14 |
{
|
15 |
-
change: function ()
|
16 |
-
{
|
17 |
$( this ).trigger( 'color:change' );
|
18 |
},
|
19 |
-
clear
|
20 |
-
{
|
21 |
$( this ).trigger( 'color:clear' );
|
22 |
}
|
23 |
},
|
@@ -25,8 +21,7 @@ jQuery( function ( $ )
|
|
25 |
);
|
26 |
|
27 |
// Clone doesn't have input for color picker, we have to add the input and remove the color picker container
|
28 |
-
if ( $container.length > 0 )
|
29 |
-
{
|
30 |
$this.insertBefore( $container );
|
31 |
$container.remove();
|
32 |
}
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update color picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function update() {
|
|
|
9 |
var $this = $( this ),
|
10 |
$container = $this.closest( '.wp-picker-container' ),
|
11 |
data = $.extend(
|
12 |
{
|
13 |
+
change: function () {
|
|
|
14 |
$( this ).trigger( 'color:change' );
|
15 |
},
|
16 |
+
clear: function () {
|
|
|
17 |
$( this ).trigger( 'color:clear' );
|
18 |
}
|
19 |
},
|
21 |
);
|
22 |
|
23 |
// Clone doesn't have input for color picker, we have to add the input and remove the color picker container
|
24 |
+
if ( $container.length > 0 ) {
|
|
|
25 |
$this.insertBefore( $container );
|
26 |
$container.remove();
|
27 |
}
|
js/date.js
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update date picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function update()
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
options = $this.data( 'options' ),
|
13 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
@@ -16,22 +14,19 @@ jQuery( function ( $ )
|
|
16 |
$picker = $inline.length ? $inline : $this;
|
17 |
|
18 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
19 |
-
if ( $timestamp.length )
|
20 |
-
|
21 |
-
options.onClose = options.onSelect = function ()
|
22 |
-
{
|
23 |
$timestamp.val( getTimestamp( $picker.datepicker( 'getDate' ) ) );
|
24 |
};
|
25 |
}
|
26 |
|
27 |
-
if ( $inline.length )
|
28 |
-
{
|
29 |
options.altField = '#' + $this.attr( 'id' );
|
30 |
-
$this.on( 'keydown', _.debounce( function(){
|
31 |
$picker
|
32 |
.datepicker( 'setDate', $this.val() )
|
33 |
-
.find(".ui-datepicker-current-day")
|
34 |
-
.trigger("click");
|
35 |
}, 600 ) );
|
36 |
|
37 |
$inline
|
@@ -41,8 +36,7 @@ jQuery( function ( $ )
|
|
41 |
.datepicker( options )
|
42 |
.datepicker( 'setDate', current );
|
43 |
}
|
44 |
-
else
|
45 |
-
{
|
46 |
$this.removeClass( 'hasDatepicker' ).datepicker( options );
|
47 |
}
|
48 |
}
|
@@ -53,21 +47,19 @@ jQuery( function ( $ )
|
|
53 |
* @param date
|
54 |
* @return number
|
55 |
*/
|
56 |
-
function getTimestamp( date )
|
57 |
-
|
58 |
-
if ( date === null )
|
59 |
return "";
|
|
|
60 |
var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
|
61 |
return Math.floor( milliseconds / 1000 );
|
62 |
}
|
63 |
|
64 |
-
$.datepicker.setDefaults( $.datepicker.regional[
|
65 |
-
if ( $.datepicker.regional.hasOwnProperty( RWMB_Date.locale ) )
|
66 |
-
{
|
67 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Date.locale] );
|
68 |
}
|
69 |
-
else if ( $.datepicker.regional.hasOwnProperty( RWMB_Date.localeShort ) )
|
70 |
-
{
|
71 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Date.localeShort] );
|
72 |
}
|
73 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update date picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function update() {
|
|
|
9 |
var $this = $( this ),
|
10 |
options = $this.data( 'options' ),
|
11 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
14 |
$picker = $inline.length ? $inline : $this;
|
15 |
|
16 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
17 |
+
if ( $timestamp.length ) {
|
18 |
+
options.onClose = options.onSelect = function () {
|
|
|
|
|
19 |
$timestamp.val( getTimestamp( $picker.datepicker( 'getDate' ) ) );
|
20 |
};
|
21 |
}
|
22 |
|
23 |
+
if ( $inline.length ) {
|
|
|
24 |
options.altField = '#' + $this.attr( 'id' );
|
25 |
+
$this.on( 'keydown', _.debounce( function () {
|
26 |
$picker
|
27 |
.datepicker( 'setDate', $this.val() )
|
28 |
+
.find( ".ui-datepicker-current-day" )
|
29 |
+
.trigger( "click" );
|
30 |
}, 600 ) );
|
31 |
|
32 |
$inline
|
36 |
.datepicker( options )
|
37 |
.datepicker( 'setDate', current );
|
38 |
}
|
39 |
+
else {
|
|
|
40 |
$this.removeClass( 'hasDatepicker' ).datepicker( options );
|
41 |
}
|
42 |
}
|
47 |
* @param date
|
48 |
* @return number
|
49 |
*/
|
50 |
+
function getTimestamp( date ) {
|
51 |
+
if ( date === null ) {
|
|
|
52 |
return "";
|
53 |
+
}
|
54 |
var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
|
55 |
return Math.floor( milliseconds / 1000 );
|
56 |
}
|
57 |
|
58 |
+
$.datepicker.setDefaults( $.datepicker.regional[""] );
|
59 |
+
if ( $.datepicker.regional.hasOwnProperty( RWMB_Date.locale ) ) {
|
|
|
60 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Date.locale] );
|
61 |
}
|
62 |
+
else if ( $.datepicker.regional.hasOwnProperty( RWMB_Date.localeShort ) ) {
|
|
|
63 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Date.localeShort] );
|
64 |
}
|
65 |
|
js/datetime.js
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update datetime picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function update()
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
options = $this.data( 'options' ),
|
13 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
@@ -16,24 +14,21 @@ jQuery( function ( $ )
|
|
16 |
$picker = $inline.length ? $inline : $this;
|
17 |
|
18 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
19 |
-
if ( $timestamp.length )
|
20 |
-
|
21 |
-
options.onClose = options.onSelect = function ()
|
22 |
-
{
|
23 |
$timestamp.val( getTimestamp( $picker.datetimepicker( 'getDate' ) ) );
|
24 |
};
|
25 |
}
|
26 |
|
27 |
-
if ( $inline.length )
|
28 |
-
{
|
29 |
options.altField = '#' + $this.attr( 'id' );
|
30 |
-
$this.on( 'keydown', _.debounce( function(){
|
31 |
$picker
|
32 |
.datepicker( 'setDate', $this.val() )
|
33 |
-
.find(".ui-datepicker-current-day")
|
34 |
-
.trigger("click");
|
35 |
}, 600 ) );
|
36 |
-
|
37 |
$inline
|
38 |
.removeClass( 'hasDatepicker' )
|
39 |
.empty()
|
@@ -41,8 +36,7 @@ jQuery( function ( $ )
|
|
41 |
.datetimepicker( options )
|
42 |
.datetimepicker( 'setDate', current );
|
43 |
}
|
44 |
-
else
|
45 |
-
{
|
46 |
$this.removeClass( 'hasDatepicker' ).datetimepicker( options );
|
47 |
}
|
48 |
}
|
@@ -53,31 +47,27 @@ jQuery( function ( $ )
|
|
53 |
* @param date
|
54 |
* @return number
|
55 |
*/
|
56 |
-
function getTimestamp( date )
|
57 |
-
|
58 |
-
if ( date === null )
|
59 |
return "";
|
|
|
60 |
var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
|
61 |
return Math.floor( milliseconds / 1000 );
|
62 |
}
|
63 |
|
64 |
// Set language if available
|
65 |
-
$.datepicker.setDefaults( $.datepicker.regional[
|
66 |
-
if ( $.datepicker.regional.hasOwnProperty( RWMB_Datetime.locale ) )
|
67 |
-
{
|
68 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Datetime.locale] );
|
69 |
}
|
70 |
-
else if ( $.datepicker.regional.hasOwnProperty( RWMB_Datetime.localeShort ) )
|
71 |
-
{
|
72 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Datetime.localeShort] );
|
73 |
}
|
74 |
-
$.timepicker.setDefaults( $.timepicker.regional[
|
75 |
-
if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.locale ) )
|
76 |
-
{
|
77 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.locale] );
|
78 |
}
|
79 |
-
else if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.localeShort ) )
|
80 |
-
{
|
81 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.localeShort] );
|
82 |
}
|
83 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update datetime picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function update() {
|
|
|
9 |
var $this = $( this ),
|
10 |
options = $this.data( 'options' ),
|
11 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
14 |
$picker = $inline.length ? $inline : $this;
|
15 |
|
16 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
17 |
+
if ( $timestamp.length ) {
|
18 |
+
options.onClose = options.onSelect = function () {
|
|
|
|
|
19 |
$timestamp.val( getTimestamp( $picker.datetimepicker( 'getDate' ) ) );
|
20 |
};
|
21 |
}
|
22 |
|
23 |
+
if ( $inline.length ) {
|
|
|
24 |
options.altField = '#' + $this.attr( 'id' );
|
25 |
+
$this.on( 'keydown', _.debounce( function () {
|
26 |
$picker
|
27 |
.datepicker( 'setDate', $this.val() )
|
28 |
+
.find( ".ui-datepicker-current-day" )
|
29 |
+
.trigger( "click" );
|
30 |
}, 600 ) );
|
31 |
+
|
32 |
$inline
|
33 |
.removeClass( 'hasDatepicker' )
|
34 |
.empty()
|
36 |
.datetimepicker( options )
|
37 |
.datetimepicker( 'setDate', current );
|
38 |
}
|
39 |
+
else {
|
|
|
40 |
$this.removeClass( 'hasDatepicker' ).datetimepicker( options );
|
41 |
}
|
42 |
}
|
47 |
* @param date
|
48 |
* @return number
|
49 |
*/
|
50 |
+
function getTimestamp( date ) {
|
51 |
+
if ( date === null ) {
|
|
|
52 |
return "";
|
53 |
+
}
|
54 |
var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
|
55 |
return Math.floor( milliseconds / 1000 );
|
56 |
}
|
57 |
|
58 |
// Set language if available
|
59 |
+
$.datepicker.setDefaults( $.datepicker.regional[""] );
|
60 |
+
if ( $.datepicker.regional.hasOwnProperty( RWMB_Datetime.locale ) ) {
|
|
|
61 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Datetime.locale] );
|
62 |
}
|
63 |
+
else if ( $.datepicker.regional.hasOwnProperty( RWMB_Datetime.localeShort ) ) {
|
|
|
64 |
$.datepicker.setDefaults( $.datepicker.regional[RWMB_Datetime.localeShort] );
|
65 |
}
|
66 |
+
$.timepicker.setDefaults( $.timepicker.regional[""] );
|
67 |
+
if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.locale ) ) {
|
|
|
68 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.locale] );
|
69 |
}
|
70 |
+
else if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.localeShort ) ) {
|
|
|
71 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.localeShort] );
|
72 |
}
|
73 |
|
js/file-input.js
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
var frame;
|
6 |
|
7 |
-
$( 'body' ).on( 'click', '.rwmb-file-input-select', function ( e )
|
8 |
-
{
|
9 |
e.preventDefault();
|
10 |
var $el = $( this );
|
11 |
|
12 |
// Create a frame only if needed
|
13 |
-
if ( !frame )
|
14 |
-
{
|
15 |
frame = wp.media( {
|
16 |
className: 'media-frame rwmb-file-frame',
|
17 |
-
multiple
|
18 |
-
title
|
19 |
} );
|
20 |
}
|
21 |
|
@@ -26,16 +23,14 @@ jQuery( function ( $ )
|
|
26 |
frame.off( 'select' );
|
27 |
|
28 |
// Handle selection
|
29 |
-
frame.on( 'select', function ()
|
30 |
-
{
|
31 |
var url = frame.state().get( 'selection' ).first().toJSON().url;
|
32 |
$el.siblings( 'input' ).val( url ).siblings( 'a' ).removeClass( 'hidden' );
|
33 |
} );
|
34 |
} );
|
35 |
|
36 |
// Clear selected images
|
37 |
-
$( 'body' ).on( 'click', '.rwmb-file-input-remove', function ( e )
|
38 |
-
{
|
39 |
e.preventDefault();
|
40 |
$( this ).addClass( 'hidden' ).siblings( 'input' ).val( '' );
|
41 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
var frame;
|
5 |
|
6 |
+
$( 'body' ).on( 'click', '.rwmb-file-input-select', function ( e ) {
|
|
|
7 |
e.preventDefault();
|
8 |
var $el = $( this );
|
9 |
|
10 |
// Create a frame only if needed
|
11 |
+
if ( ! frame ) {
|
|
|
12 |
frame = wp.media( {
|
13 |
className: 'media-frame rwmb-file-frame',
|
14 |
+
multiple: false,
|
15 |
+
title: rwmbFileInput.frameTitle
|
16 |
} );
|
17 |
}
|
18 |
|
23 |
frame.off( 'select' );
|
24 |
|
25 |
// Handle selection
|
26 |
+
frame.on( 'select', function () {
|
|
|
27 |
var url = frame.state().get( 'selection' ).first().toJSON().url;
|
28 |
$el.siblings( 'input' ).val( url ).siblings( 'a' ).removeClass( 'hidden' );
|
29 |
} );
|
30 |
} );
|
31 |
|
32 |
// Clear selected images
|
33 |
+
$( 'body' ).on( 'click', '.rwmb-file-input-remove', function ( e ) {
|
|
|
34 |
e.preventDefault();
|
35 |
$( this ).addClass( 'hidden' ).siblings( 'input' ).val( '' );
|
36 |
} );
|
js/file-upload.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
var views = rwmb.views = rwmb.views || {},
|
@@ -9,65 +8,61 @@ jQuery( function ( $ )
|
|
9 |
FileUploadField, UploadButton;
|
10 |
|
11 |
FileUploadField = views.FileUploadField = MediaField.extend( {
|
12 |
-
createAddButton: function ()
|
13 |
-
|
14 |
-
this.addButton = new UploadButton( { controller: this.controller } );
|
15 |
}
|
16 |
} );
|
17 |
|
18 |
UploadButton = views.UploadButton = Backbone.View.extend( {
|
19 |
className: 'rwmb-upload-area',
|
20 |
-
tagName
|
21 |
template: wp.template( 'rwmb-upload-area' ),
|
22 |
-
render
|
23 |
-
{
|
24 |
this.$el.html( this.template( {} ) );
|
25 |
return this;
|
26 |
},
|
27 |
|
28 |
-
initialize: function ( options )
|
29 |
-
{
|
30 |
this.controller = options.controller;
|
31 |
-
this.el.id = _.uniqueId( 'rwmb-upload-area-');
|
32 |
this.render();
|
33 |
|
34 |
//Areas
|
35 |
this.dropzone = this.el;
|
36 |
-
this.browser
|
37 |
|
38 |
if ( wp.Uploader.browser.supported ) {
|
39 |
this.initUploader();
|
40 |
}
|
41 |
|
42 |
// Auto hide if you reach the max number of media
|
43 |
-
this.listenTo( this.controller, 'change:full', function ()
|
44 |
-
{
|
45 |
this.$el.toggle( ! this.controller.get( 'full' ) );
|
46 |
} );
|
47 |
},
|
48 |
|
49 |
//Initializes plupload
|
50 |
//Uses code from wp.Uploader
|
51 |
-
initUploader: function ()
|
52 |
-
|
53 |
-
var isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1,
|
54 |
self = this,
|
55 |
extensions = this.getExtensions().join( ',' );
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
66 |
|
67 |
// Make sure flash sends cookies (seems in IE it does without switching to urlstream mode)
|
68 |
if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) &&
|
69 |
-
|
70 |
-
{
|
71 |
this.plupload.required_features = this.plupload.required_features || {};
|
72 |
this.plupload.required_features.send_binary_string = true;
|
73 |
}
|
@@ -76,35 +71,31 @@ jQuery( function ( $ )
|
|
76 |
this.uploader = new plupload.Uploader( this.plupload );
|
77 |
this.uploader.init();
|
78 |
|
79 |
-
this.uploader.bind( 'FilesAdded', function( up, files )
|
80 |
-
|
81 |
-
_.each( files, function( file )
|
82 |
-
{
|
83 |
var attributes, image;
|
84 |
|
85 |
// Ignore failed uploads.
|
86 |
-
if ( plupload.FAILED === file.status )
|
87 |
-
{
|
88 |
return;
|
89 |
}
|
90 |
|
91 |
// Generate attributes for a new `Attachment` model.
|
92 |
-
attributes = _.extend({
|
93 |
-
file:
|
94 |
-
uploading:
|
95 |
-
date:
|
96 |
-
filename:
|
97 |
-
menuOrder:
|
98 |
-
uploadedTo:
|
99 |
-
icon:
|
100 |
}, _.pick( file, 'loaded', 'size', 'percent' ) );
|
101 |
|
102 |
// Handle early mime type scanning for images.
|
103 |
image = /(?:jpe?g|png|gif)$/i.exec( file.name );
|
104 |
|
105 |
// For images set the model's type and subtype attributes.
|
106 |
-
if ( image )
|
107 |
-
{
|
108 |
attributes.type = 'image';
|
109 |
|
110 |
// `jpeg`, `png` and `gif` are valid subtypes.
|
@@ -117,17 +108,17 @@ jQuery( function ( $ )
|
|
117 |
file.attachment = wp.media.model.Attachment.create( attributes );
|
118 |
wp.Uploader.queue.add( file.attachment );
|
119 |
self.controller.addItems( [file.attachment] );
|
120 |
-
});
|
121 |
|
122 |
up.refresh();
|
123 |
up.start();
|
124 |
-
});
|
125 |
|
126 |
-
this.uploader.bind( 'UploadProgress', function( up, file ) {
|
127 |
file.attachment.set( _.pick( file, 'loaded', 'percent' ) );
|
128 |
-
});
|
129 |
|
130 |
-
this.uploader.bind( 'FileUploaded', function( up, file, response ) {
|
131 |
var complete;
|
132 |
|
133 |
try {
|
@@ -136,41 +127,42 @@ jQuery( function ( $ )
|
|
136 |
return false;
|
137 |
}
|
138 |
|
139 |
-
if ( ! _.isObject( response ) || _.isUndefined( response.success ) || ! response.success )
|
140 |
return false;
|
|
|
141 |
|
142 |
-
_.each(['file','loaded','size','percent'], function( key ) {
|
143 |
file.attachment.unset( key );
|
144 |
-
});
|
145 |
|
146 |
-
file.attachment.set( _.extend( response.data, {
|
147 |
wp.media.model.Attachment.get( response.data.id, file.attachment );
|
148 |
|
149 |
-
complete = wp.Uploader.queue.all( function( attachment ) {
|
150 |
-
return ! attachment.get('uploading');
|
151 |
-
});
|
152 |
|
153 |
-
if ( complete )
|
154 |
wp.Uploader.queue.reset();
|
155 |
-
|
|
|
156 |
|
157 |
-
this.uploader.bind( 'Error', function ( up, error )
|
158 |
-
|
159 |
-
if( error.file.attachment )
|
160 |
error.file.attachment.destroy();
|
|
|
161 |
} );
|
162 |
},
|
163 |
|
164 |
-
getExtensions: function ()
|
165 |
-
|
166 |
-
var mimeTypes = this.controller.get( 'mimeType' ).split(','),
|
167 |
exts = [];
|
168 |
|
169 |
-
_.each( mimeTypes, function( current, index )
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
});
|
174 |
return exts;
|
175 |
}
|
176 |
} );
|
@@ -179,10 +171,10 @@ jQuery( function ( $ )
|
|
179 |
* Initialize fields
|
180 |
* @return void
|
181 |
*/
|
182 |
-
function init()
|
183 |
-
|
184 |
-
new FileUploadField( { input: this, el: $( this ).siblings( 'div.rwmb-media-view' ) } );
|
185 |
}
|
|
|
186 |
$( ':input.rwmb-file_upload' ).each( init );
|
187 |
$( '.rwmb-input' )
|
188 |
.on( 'clone', ':input.rwmb-file_upload', init )
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
var views = rwmb.views = rwmb.views || {},
|
8 |
FileUploadField, UploadButton;
|
9 |
|
10 |
FileUploadField = views.FileUploadField = MediaField.extend( {
|
11 |
+
createAddButton: function () {
|
12 |
+
this.addButton = new UploadButton( {controller: this.controller} );
|
|
|
13 |
}
|
14 |
} );
|
15 |
|
16 |
UploadButton = views.UploadButton = Backbone.View.extend( {
|
17 |
className: 'rwmb-upload-area',
|
18 |
+
tagName: 'div',
|
19 |
template: wp.template( 'rwmb-upload-area' ),
|
20 |
+
render: function () {
|
|
|
21 |
this.$el.html( this.template( {} ) );
|
22 |
return this;
|
23 |
},
|
24 |
|
25 |
+
initialize: function ( options ) {
|
|
|
26 |
this.controller = options.controller;
|
27 |
+
this.el.id = _.uniqueId( 'rwmb-upload-area-' );
|
28 |
this.render();
|
29 |
|
30 |
//Areas
|
31 |
this.dropzone = this.el;
|
32 |
+
this.browser = this.$( '.rwmb-browse-button' )[0];
|
33 |
|
34 |
if ( wp.Uploader.browser.supported ) {
|
35 |
this.initUploader();
|
36 |
}
|
37 |
|
38 |
// Auto hide if you reach the max number of media
|
39 |
+
this.listenTo( this.controller, 'change:full', function () {
|
|
|
40 |
this.$el.toggle( ! this.controller.get( 'full' ) );
|
41 |
} );
|
42 |
},
|
43 |
|
44 |
//Initializes plupload
|
45 |
//Uses code from wp.Uploader
|
46 |
+
initUploader: function () {
|
47 |
+
var isIE = navigator.userAgent.indexOf( 'Trident/' ) != - 1 || navigator.userAgent.indexOf( 'MSIE ' ) != - 1,
|
|
|
48 |
self = this,
|
49 |
extensions = this.getExtensions().join( ',' );
|
50 |
+
this.plupload = $.extend( true, {
|
51 |
+
multipart_params: {},
|
52 |
+
multipart: true,
|
53 |
+
urlstream_upload: true,
|
54 |
+
drop_element: this.dropzone,
|
55 |
+
browse_button: this.browser,
|
56 |
+
filters: {}
|
57 |
+
}, wp.Uploader.defaults );
|
58 |
+
|
59 |
+
if ( extensions ) {
|
60 |
+
this.plupload.filters.mime_types = [{title: i18nRwmbMedia.select, extensions: extensions}];
|
61 |
+
}
|
62 |
|
63 |
// Make sure flash sends cookies (seems in IE it does without switching to urlstream mode)
|
64 |
if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) &&
|
65 |
+
( ! this.plupload.required_features || ! this.plupload.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
|
|
|
66 |
this.plupload.required_features = this.plupload.required_features || {};
|
67 |
this.plupload.required_features.send_binary_string = true;
|
68 |
}
|
71 |
this.uploader = new plupload.Uploader( this.plupload );
|
72 |
this.uploader.init();
|
73 |
|
74 |
+
this.uploader.bind( 'FilesAdded', function ( up, files ) {
|
75 |
+
_.each( files, function ( file ) {
|
|
|
|
|
76 |
var attributes, image;
|
77 |
|
78 |
// Ignore failed uploads.
|
79 |
+
if ( plupload.FAILED === file.status ) {
|
|
|
80 |
return;
|
81 |
}
|
82 |
|
83 |
// Generate attributes for a new `Attachment` model.
|
84 |
+
attributes = _.extend( {
|
85 |
+
file: file,
|
86 |
+
uploading: true,
|
87 |
+
date: new Date(),
|
88 |
+
filename: file.name,
|
89 |
+
menuOrder: 0,
|
90 |
+
uploadedTo: wp.media.model.settings.post.id,
|
91 |
+
icon: i18nRwmbMedia.loadingUrl
|
92 |
}, _.pick( file, 'loaded', 'size', 'percent' ) );
|
93 |
|
94 |
// Handle early mime type scanning for images.
|
95 |
image = /(?:jpe?g|png|gif)$/i.exec( file.name );
|
96 |
|
97 |
// For images set the model's type and subtype attributes.
|
98 |
+
if ( image ) {
|
|
|
99 |
attributes.type = 'image';
|
100 |
|
101 |
// `jpeg`, `png` and `gif` are valid subtypes.
|
108 |
file.attachment = wp.media.model.Attachment.create( attributes );
|
109 |
wp.Uploader.queue.add( file.attachment );
|
110 |
self.controller.addItems( [file.attachment] );
|
111 |
+
} );
|
112 |
|
113 |
up.refresh();
|
114 |
up.start();
|
115 |
+
} );
|
116 |
|
117 |
+
this.uploader.bind( 'UploadProgress', function ( up, file ) {
|
118 |
file.attachment.set( _.pick( file, 'loaded', 'percent' ) );
|
119 |
+
} );
|
120 |
|
121 |
+
this.uploader.bind( 'FileUploaded', function ( up, file, response ) {
|
122 |
var complete;
|
123 |
|
124 |
try {
|
127 |
return false;
|
128 |
}
|
129 |
|
130 |
+
if ( ! _.isObject( response ) || _.isUndefined( response.success ) || ! response.success ) {
|
131 |
return false;
|
132 |
+
}
|
133 |
|
134 |
+
_.each( ['file', 'loaded', 'size', 'percent'], function ( key ) {
|
135 |
file.attachment.unset( key );
|
136 |
+
} );
|
137 |
|
138 |
+
file.attachment.set( _.extend( response.data, {uploading: false} ) );
|
139 |
wp.media.model.Attachment.get( response.data.id, file.attachment );
|
140 |
|
141 |
+
complete = wp.Uploader.queue.all( function ( attachment ) {
|
142 |
+
return ! attachment.get( 'uploading' );
|
143 |
+
} );
|
144 |
|
145 |
+
if ( complete ) {
|
146 |
wp.Uploader.queue.reset();
|
147 |
+
}
|
148 |
+
} );
|
149 |
|
150 |
+
this.uploader.bind( 'Error', function ( up, error ) {
|
151 |
+
if ( error.file.attachment ) {
|
|
|
152 |
error.file.attachment.destroy();
|
153 |
+
}
|
154 |
} );
|
155 |
},
|
156 |
|
157 |
+
getExtensions: function () {
|
158 |
+
var mimeTypes = this.controller.get( 'mimeType' ).split( ',' ),
|
|
|
159 |
exts = [];
|
160 |
|
161 |
+
_.each( mimeTypes, function ( current, index ) {
|
162 |
+
if ( i18nRwmbMedia.extensions[current] ) {
|
163 |
+
exts = exts.concat( i18nRwmbMedia.extensions[current] );
|
164 |
+
}
|
165 |
+
} );
|
166 |
return exts;
|
167 |
}
|
168 |
} );
|
171 |
* Initialize fields
|
172 |
* @return void
|
173 |
*/
|
174 |
+
function init() {
|
175 |
+
new FileUploadField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
|
|
|
176 |
}
|
177 |
+
|
178 |
$( ':input.rwmb-file_upload' ).each( init );
|
179 |
$( '.rwmb-input' )
|
180 |
.on( 'clone', ':input.rwmb-file_upload', init )
|
js/file.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
jQuery(
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
@@ -7,21 +6,18 @@ jQuery( document ).ready( function ( $ )
|
|
7 |
* @link https://davidwalsh.name/css-animation-callback
|
8 |
* @returns string
|
9 |
*/
|
10 |
-
function whichTransitionEvent()
|
11 |
-
{
|
12 |
var t,
|
13 |
el = document.createElement( 'fakeelement' ),
|
14 |
transitions = {
|
15 |
-
'transition'
|
16 |
-
'OTransition'
|
17 |
-
'MozTransition'
|
18 |
'WebkitTransition': 'webkitTransitionEnd'
|
19 |
};
|
20 |
|
21 |
-
for ( t in transitions )
|
22 |
-
|
23 |
-
if ( el.style[t] !== undefined )
|
24 |
-
{
|
25 |
return transitions[t];
|
26 |
}
|
27 |
}
|
@@ -34,8 +30,7 @@ jQuery( document ).ready( function ( $ )
|
|
34 |
|
35 |
|
36 |
// Add more file
|
37 |
-
$( '.rwmb-add-file' ).each( function ()
|
38 |
-
{
|
39 |
var $this = $( this ),
|
40 |
$uploads = $this.siblings( '.file-input' ),
|
41 |
$first = $uploads.first(),
|
@@ -45,29 +40,23 @@ jQuery( document ).ready( function ( $ )
|
|
45 |
maxFileUploads = $fileList.data( 'max_file_uploads' );
|
46 |
|
47 |
// Hide "Add New File" and input fields when loaded
|
48 |
-
if ( maxFileUploads > 0 )
|
49 |
-
|
50 |
-
if ( uploadCount + fileCount >= maxFileUploads )
|
51 |
-
{
|
52 |
$this.hide();
|
53 |
}
|
54 |
-
if ( fileCount >= maxFileUploads )
|
55 |
-
{
|
56 |
$uploads.hide();
|
57 |
}
|
58 |
}
|
59 |
|
60 |
-
$this.click( function ()
|
61 |
-
{
|
62 |
// Clone upload input only when needed
|
63 |
-
if ( maxFileUploads <= 0 || uploadCount + fileCount < maxFileUploads )
|
64 |
-
{
|
65 |
$first.clone().insertBefore( $this );
|
66 |
-
uploadCount++;
|
67 |
|
68 |
// If there're too many upload inputs, hide "Add New File"
|
69 |
-
if ( maxFileUploads > 0 && uploadCount + fileCount >= maxFileUploads )
|
70 |
-
{
|
71 |
$this.hide();
|
72 |
}
|
73 |
}
|
@@ -77,24 +66,21 @@ jQuery( document ).ready( function ( $ )
|
|
77 |
} );
|
78 |
|
79 |
// Delete file via Ajax
|
80 |
-
$uploaded.on( 'click', '.rwmb-delete-file', function ()
|
81 |
-
{
|
82 |
var $this = $( this ),
|
83 |
$parent = $this.parents( 'li' ),
|
84 |
$container = $this.closest( '.rwmb-uploaded' ),
|
85 |
data = {
|
86 |
-
action
|
87 |
-
_ajax_nonce
|
88 |
-
post_id
|
89 |
-
field_id
|
90 |
attachment_id: $this.data( 'attachment_id' ),
|
91 |
-
force_delete
|
92 |
};
|
93 |
|
94 |
-
$.post( ajaxurl, data, function ( r )
|
95 |
-
|
96 |
-
if ( !r.success )
|
97 |
-
{
|
98 |
alert( r.data );
|
99 |
return;
|
100 |
}
|
@@ -102,15 +88,13 @@ jQuery( document ).ready( function ( $ )
|
|
102 |
$parent.addClass( 'removed' );
|
103 |
|
104 |
// If transition event is not supported
|
105 |
-
if ( !event )
|
106 |
-
{
|
107 |
$parent.remove();
|
108 |
$container.trigger( 'update.rwmbFile' );
|
109 |
}
|
110 |
|
111 |
// If transition is supported
|
112 |
-
$( '.rwmb-uploaded' ).on( event, 'li.removed', function ()
|
113 |
-
{
|
114 |
$( this ).remove();
|
115 |
$container.trigger( 'update.rwmbFile' );
|
116 |
} );
|
@@ -120,40 +104,31 @@ jQuery( document ).ready( function ( $ )
|
|
120 |
} );
|
121 |
|
122 |
// Remove deleted file
|
123 |
-
$uploaded.on( event, 'li.removed', function ()
|
124 |
-
{
|
125 |
$( this ).remove();
|
126 |
} );
|
127 |
|
128 |
-
$( 'body' ).on( 'update.rwmbFile', '.rwmb-uploaded', function ()
|
129 |
-
{
|
130 |
var $fileList = $( this ),
|
131 |
maxFileUploads = $fileList.data( 'max_file_uploads' ),
|
132 |
$uploader = $fileList.siblings( '.new-files' ),
|
133 |
numFiles = $fileList.children().length;
|
134 |
|
135 |
-
if ( numFiles > 0 )
|
136 |
-
{
|
137 |
$fileList.removeClass( 'hidden' );
|
138 |
-
}
|
139 |
-
else
|
140 |
-
{
|
141 |
$fileList.addClass( 'hidden' );
|
142 |
}
|
143 |
|
144 |
// Return if maxFileUpload = 0
|
145 |
-
if ( maxFileUploads === 0 )
|
146 |
-
{
|
147 |
return false;
|
148 |
}
|
149 |
|
150 |
// Hide files button if reach max file uploads
|
151 |
-
if ( numFiles >= maxFileUploads )
|
152 |
-
{
|
153 |
$uploader.addClass( 'hidden' );
|
154 |
-
}
|
155 |
-
else
|
156 |
-
{
|
157 |
$uploader.removeClass( 'hidden' );
|
158 |
}
|
159 |
|
@@ -161,20 +136,18 @@ jQuery( document ).ready( function ( $ )
|
|
161 |
} );
|
162 |
|
163 |
// Reorder files
|
164 |
-
$uploaded.each( function ()
|
165 |
-
{
|
166 |
var $this = $( this ),
|
167 |
data = {
|
168 |
-
action
|
169 |
_ajax_nonce: $this.data( 'reorder_nonce' ),
|
170 |
-
post_id
|
171 |
-
field_id
|
172 |
};
|
173 |
$this.sortable( {
|
174 |
placeholder: 'ui-state-highlight',
|
175 |
-
items
|
176 |
-
update
|
177 |
-
{
|
178 |
|
179 |
data.order = $this.sortable( 'serialize' );
|
180 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
6 |
* @link https://davidwalsh.name/css-animation-callback
|
7 |
* @returns string
|
8 |
*/
|
9 |
+
function whichTransitionEvent() {
|
|
|
10 |
var t,
|
11 |
el = document.createElement( 'fakeelement' ),
|
12 |
transitions = {
|
13 |
+
'transition': 'transitionend',
|
14 |
+
'OTransition': 'oTransitionEnd',
|
15 |
+
'MozTransition': 'transitionend',
|
16 |
'WebkitTransition': 'webkitTransitionEnd'
|
17 |
};
|
18 |
|
19 |
+
for ( t in transitions ) {
|
20 |
+
if ( el.style[t] !== undefined ) {
|
|
|
|
|
21 |
return transitions[t];
|
22 |
}
|
23 |
}
|
30 |
|
31 |
|
32 |
// Add more file
|
33 |
+
$( '.rwmb-add-file' ).each( function () {
|
|
|
34 |
var $this = $( this ),
|
35 |
$uploads = $this.siblings( '.file-input' ),
|
36 |
$first = $uploads.first(),
|
40 |
maxFileUploads = $fileList.data( 'max_file_uploads' );
|
41 |
|
42 |
// Hide "Add New File" and input fields when loaded
|
43 |
+
if ( maxFileUploads > 0 ) {
|
44 |
+
if ( uploadCount + fileCount >= maxFileUploads ) {
|
|
|
|
|
45 |
$this.hide();
|
46 |
}
|
47 |
+
if ( fileCount >= maxFileUploads ) {
|
|
|
48 |
$uploads.hide();
|
49 |
}
|
50 |
}
|
51 |
|
52 |
+
$this.click( function () {
|
|
|
53 |
// Clone upload input only when needed
|
54 |
+
if ( maxFileUploads <= 0 || uploadCount + fileCount < maxFileUploads ) {
|
|
|
55 |
$first.clone().insertBefore( $this );
|
56 |
+
uploadCount ++;
|
57 |
|
58 |
// If there're too many upload inputs, hide "Add New File"
|
59 |
+
if ( maxFileUploads > 0 && uploadCount + fileCount >= maxFileUploads ) {
|
|
|
60 |
$this.hide();
|
61 |
}
|
62 |
}
|
66 |
} );
|
67 |
|
68 |
// Delete file via Ajax
|
69 |
+
$uploaded.on( 'click', '.rwmb-delete-file', function () {
|
|
|
70 |
var $this = $( this ),
|
71 |
$parent = $this.parents( 'li' ),
|
72 |
$container = $this.closest( '.rwmb-uploaded' ),
|
73 |
data = {
|
74 |
+
action: 'rwmb_delete_file',
|
75 |
+
_ajax_nonce: $container.data( 'delete_nonce' ),
|
76 |
+
post_id: $( '#post_ID' ).val(),
|
77 |
+
field_id: $container.data( 'field_id' ),
|
78 |
attachment_id: $this.data( 'attachment_id' ),
|
79 |
+
force_delete: $container.data( 'force_delete' )
|
80 |
};
|
81 |
|
82 |
+
$.post( ajaxurl, data, function ( r ) {
|
83 |
+
if ( ! r.success ) {
|
|
|
|
|
84 |
alert( r.data );
|
85 |
return;
|
86 |
}
|
88 |
$parent.addClass( 'removed' );
|
89 |
|
90 |
// If transition event is not supported
|
91 |
+
if ( ! event ) {
|
|
|
92 |
$parent.remove();
|
93 |
$container.trigger( 'update.rwmbFile' );
|
94 |
}
|
95 |
|
96 |
// If transition is supported
|
97 |
+
$( '.rwmb-uploaded' ).on( event, 'li.removed', function () {
|
|
|
98 |
$( this ).remove();
|
99 |
$container.trigger( 'update.rwmbFile' );
|
100 |
} );
|
104 |
} );
|
105 |
|
106 |
// Remove deleted file
|
107 |
+
$uploaded.on( event, 'li.removed', function () {
|
|
|
108 |
$( this ).remove();
|
109 |
} );
|
110 |
|
111 |
+
$( 'body' ).on( 'update.rwmbFile', '.rwmb-uploaded', function () {
|
|
|
112 |
var $fileList = $( this ),
|
113 |
maxFileUploads = $fileList.data( 'max_file_uploads' ),
|
114 |
$uploader = $fileList.siblings( '.new-files' ),
|
115 |
numFiles = $fileList.children().length;
|
116 |
|
117 |
+
if ( numFiles > 0 ) {
|
|
|
118 |
$fileList.removeClass( 'hidden' );
|
119 |
+
} else {
|
|
|
|
|
120 |
$fileList.addClass( 'hidden' );
|
121 |
}
|
122 |
|
123 |
// Return if maxFileUpload = 0
|
124 |
+
if ( maxFileUploads === 0 ) {
|
|
|
125 |
return false;
|
126 |
}
|
127 |
|
128 |
// Hide files button if reach max file uploads
|
129 |
+
if ( numFiles >= maxFileUploads ) {
|
|
|
130 |
$uploader.addClass( 'hidden' );
|
131 |
+
} else {
|
|
|
|
|
132 |
$uploader.removeClass( 'hidden' );
|
133 |
}
|
134 |
|
136 |
} );
|
137 |
|
138 |
// Reorder files
|
139 |
+
$uploaded.each( function () {
|
|
|
140 |
var $this = $( this ),
|
141 |
data = {
|
142 |
+
action: 'rwmb_reorder_files',
|
143 |
_ajax_nonce: $this.data( 'reorder_nonce' ),
|
144 |
+
post_id: $( '#post_ID' ).val(),
|
145 |
+
field_id: $this.data( 'field_id' )
|
146 |
};
|
147 |
$this.sortable( {
|
148 |
placeholder: 'ui-state-highlight',
|
149 |
+
items: 'li',
|
150 |
+
update: function () {
|
|
|
151 |
|
152 |
data.order = $this.sortable( 'serialize' );
|
153 |
|
js/image-advanced.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
var views = rwmb.views = rwmb.views || {},
|
@@ -11,13 +10,12 @@ jQuery( function ( $ )
|
|
11 |
ImageField;
|
12 |
|
13 |
ImageField = views.ImageField = MediaField.extend( {
|
14 |
-
createList: function ()
|
15 |
-
{
|
16 |
this.list = new MediaList( {
|
17 |
controller: this.controller,
|
18 |
itemView: MediaItem.extend( {
|
19 |
className: 'rwmb-image-item',
|
20 |
-
template
|
21 |
} )
|
22 |
} );
|
23 |
}
|
@@ -26,10 +24,10 @@ jQuery( function ( $ )
|
|
26 |
/**
|
27 |
* Initialize image fields
|
28 |
*/
|
29 |
-
function initImageField()
|
30 |
-
|
31 |
-
new ImageField( { input: this, el: $( this ).siblings( 'div.rwmb-media-view' ) } );
|
32 |
}
|
|
|
33 |
$( 'input.rwmb-image_advanced' ).each( initImageField );
|
34 |
$( '#wpbody' ).on( 'clone', 'input.rwmb-image_advanced', initImageField )
|
35 |
} );
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
var views = rwmb.views = rwmb.views || {},
|
10 |
ImageField;
|
11 |
|
12 |
ImageField = views.ImageField = MediaField.extend( {
|
13 |
+
createList: function () {
|
|
|
14 |
this.list = new MediaList( {
|
15 |
controller: this.controller,
|
16 |
itemView: MediaItem.extend( {
|
17 |
className: 'rwmb-image-item',
|
18 |
+
template: wp.template( 'rwmb-image-item' )
|
19 |
} )
|
20 |
} );
|
21 |
}
|
24 |
/**
|
25 |
* Initialize image fields
|
26 |
*/
|
27 |
+
function initImageField() {
|
28 |
+
new ImageField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
|
|
|
29 |
}
|
30 |
+
|
31 |
$( 'input.rwmb-image_advanced' ).each( initImageField );
|
32 |
$( '#wpbody' ).on( 'clone', 'input.rwmb-image_advanced', initImageField )
|
33 |
} );
|
js/image-select.js
CHANGED
@@ -1,24 +1,18 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
-
$( 'body' ).on( 'change', '.rwmb-image-select input', function ()
|
6 |
-
{
|
7 |
var $this = $( this ),
|
8 |
type = $this.attr( 'type' ),
|
9 |
selected = $this.is( ':checked' ),
|
10 |
$parent = $this.parent(),
|
11 |
$others = $parent.siblings();
|
12 |
-
if ( selected )
|
13 |
-
{
|
14 |
$parent.addClass( 'rwmb-active' );
|
15 |
-
if ( type === 'radio' )
|
16 |
-
{
|
17 |
$others.removeClass( 'rwmb-active' );
|
18 |
}
|
19 |
-
}
|
20 |
-
else
|
21 |
-
{
|
22 |
$parent.removeClass( 'rwmb-active' );
|
23 |
}
|
24 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
+
$( 'body' ).on( 'change', '.rwmb-image-select input', function () {
|
|
|
5 |
var $this = $( this ),
|
6 |
type = $this.attr( 'type' ),
|
7 |
selected = $this.is( ':checked' ),
|
8 |
$parent = $this.parent(),
|
9 |
$others = $parent.siblings();
|
10 |
+
if ( selected ) {
|
|
|
11 |
$parent.addClass( 'rwmb-active' );
|
12 |
+
if ( type === 'radio' ) {
|
|
|
13 |
$others.removeClass( 'rwmb-active' );
|
14 |
}
|
15 |
+
} else {
|
|
|
|
|
16 |
$parent.removeClass( 'rwmb-active' );
|
17 |
}
|
18 |
} );
|
js/image-upload.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
var views = rwmb.views = rwmb.views || {},
|
@@ -10,9 +9,8 @@ jQuery( function ( $ )
|
|
10 |
UploadButton = views.UploadButton;
|
11 |
|
12 |
ImageUploadField = views.ImageUploadField = ImageField.extend( {
|
13 |
-
createAddButton: function ()
|
14 |
-
|
15 |
-
this.addButton = new UploadButton( { controller: this.controller } );
|
16 |
}
|
17 |
} );
|
18 |
|
@@ -20,10 +18,10 @@ jQuery( function ( $ )
|
|
20 |
* Initialize fields
|
21 |
* @return void
|
22 |
*/
|
23 |
-
function init()
|
24 |
-
|
25 |
-
new ImageUploadField( { input: this, el: $( this ).siblings( 'div.rwmb-media-view' ) } );
|
26 |
}
|
|
|
27 |
$( ':input.rwmb-image_upload, :input.rwmb-plupload_image' ).each( init );
|
28 |
$( '.rwmb-input' )
|
29 |
.on( 'clone', ':input.rwmb-image_upload, :input.rwmb-plupload_image', init )
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
var views = rwmb.views = rwmb.views || {},
|
9 |
UploadButton = views.UploadButton;
|
10 |
|
11 |
ImageUploadField = views.ImageUploadField = ImageField.extend( {
|
12 |
+
createAddButton: function () {
|
13 |
+
this.addButton = new UploadButton( {controller: this.controller} );
|
|
|
14 |
}
|
15 |
} );
|
16 |
|
18 |
* Initialize fields
|
19 |
* @return void
|
20 |
*/
|
21 |
+
function init() {
|
22 |
+
new ImageUploadField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
|
|
|
23 |
}
|
24 |
+
|
25 |
$( ':input.rwmb-image_upload, :input.rwmb-plupload_image' ).each( init );
|
26 |
$( '.rwmb-input' )
|
27 |
.on( 'clone', ':input.rwmb-image_upload, :input.rwmb-plupload_image', init )
|
js/input-list.js
CHANGED
@@ -1,25 +1,20 @@
|
|
1 |
-
jQuery( function( $ )
|
2 |
-
{
|
3 |
-
|
4 |
-
|
5 |
-
var $this = $( this ),
|
6 |
-
$children = $this.closest( 'li' ).children('ul');
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
.removeAttr( 'checked' );
|
18 |
-
}
|
19 |
-
}
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
2 |
+
function update() {
|
3 |
+
var $this = $( this ),
|
4 |
+
$children = $this.closest( 'li' ).children( 'ul' );
|
|
|
|
|
5 |
|
6 |
+
if ( $this.is( ':checked' ) ) {
|
7 |
+
$children.removeClass( 'hidden' );
|
8 |
+
} else {
|
9 |
+
$children
|
10 |
+
.addClass( 'hidden' )
|
11 |
+
.find( 'input' )
|
12 |
+
.removeAttr( 'checked' );
|
13 |
+
}
|
14 |
+
}
|
|
|
|
|
|
|
15 |
|
16 |
+
$( '.rwmb-input' )
|
17 |
+
.on( 'change', '.rwmb-input-list.collapse :checkbox', update )
|
18 |
+
.on( 'clone', '.rwmb-input-list.collapse :checkbox', update );
|
19 |
+
$( '.rwmb-input-list.collapse :checkbox' ).each( update );
|
20 |
} );
|
js/jquery-validation/additional-methods.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! jQuery Validation Plugin - v1.15.0 - 2/24/2016
|
2 |
-
* http://jqueryvalidation.org/
|
3 |
-
* Copyright (c) 2016 Jörn Zaefferer; Licensed MIT */
|
4 |
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a): "object" == typeof module && module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){!function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c) || b(a).match(/\b\w+\b/g).length <= d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c) || b(a).match(/\b\w+\b/g).length >= d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace("/*","/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please"),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;h>c;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number"),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number"),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code"),a.validator.addMethod("cifES",function(a){"use strict";var b,c,d,e,f,g,h=[];if(a=a.toUpperCase(),!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)"))return!1;for(d=0;9>d;d++)h[d]=parseInt(a.charAt(d),10);for(c=h[2]+h[4]+h[6],e=1;8>e;e+=2)f=(2*h[e]).toString(),g=f.charAt(1),c+=parseInt(f.charAt(0),10)+(""===g?0:parseInt(g,10));return/^[ABCDEFGHJNPQRSUVW]{1}/.test(a)?(c+="",b=10-parseInt(c.charAt(c.length-1),10),a+=b,h[8].toString()===String.fromCharCode(64+b)||h[8].toString()===a.charAt(a.length-1)):!1},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;9>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;10>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=e?!0:c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="";if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN"),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please"),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please"),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please"),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number"),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[T]{1}/.test(a)?a[8]===/^[T]{1}[A-Z0-9]{8}$/.test(a):/^[XYZ]{1}/.test(a)?a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.replace("X","0").replace("Y","1").replace("Z","2").substring(0,8)%23):!1:!1},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):/^[KLM]{1}/.test(a)?a[8]===String.fromCharCode(64):!1:!1},"Please specify a valid NIF number."),jQuery.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return this.optional(b)?!0:("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=e||"undefined"==typeof c.caseSensitive?!1:c.caseSensitive,g=e||"undefined"==typeof c.includeTerritories?!1:c.includeTerritories,h=e||"undefined"==typeof c.includeMilitary?!1:c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;17>b;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid"),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx")});
|
1 |
+
/*! jQuery Validation Plugin - v1.15.0 - 2/24/2016
|
2 |
+
* http://jqueryvalidation.org/
|
3 |
+
* Copyright (c) 2016 Jörn Zaefferer; Licensed MIT */
|
4 |
!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a): "object" == typeof module && module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){!function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c) || b(a).match(/\b\w+\b/g).length <= d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c) || b(a).match(/\b\w+\b/g).length >= d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace("/*","/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please"),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;h>c;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number"),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number"),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code"),a.validator.addMethod("cifES",function(a){"use strict";var b,c,d,e,f,g,h=[];if(a=a.toUpperCase(),!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)"))return!1;for(d=0;9>d;d++)h[d]=parseInt(a.charAt(d),10);for(c=h[2]+h[4]+h[6],e=1;8>e;e+=2)f=(2*h[e]).toString(),g=f.charAt(1),c+=parseInt(f.charAt(0),10)+(""===g?0:parseInt(g,10));return/^[ABCDEFGHJNPQRSUVW]{1}/.test(a)?(c+="",b=10-parseInt(c.charAt(c.length-1),10),a+=b,h[8].toString()===String.fromCharCode(64+b)||h[8].toString()===a.charAt(a.length-1)):!1},"Please specify a valid CIF number."),a.validator.addMethod("cpfBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f=0;if(b=parseInt(a.substring(9,10),10),c=parseInt(a.substring(10,11),10),d=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(e=1;9>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(11-e);if(d(f,b)){for(f=0,e=1;10>=e;e++)f+=parseInt(a.substring(e-1,e),10)*(12-e);return d(f,c)}return!1},"Please specify a valid CPF number"),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&/^(5[12345])/.test(a)?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=e?!0:c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency"),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number"),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="";if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN"),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please"),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please"),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please"),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number"),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),a.validator.addMethod("nieES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[T]{1}/.test(a)?a[8]===/^[T]{1}[A-Z0-9]{8}$/.test(a):/^[XYZ]{1}/.test(a)?a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.replace("X","0").replace("Y","1").replace("Z","2").substring(0,8)%23):!1:!1},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a){"use strict";return a=a.toUpperCase(),a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")?/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):/^[KLM]{1}/.test(a)?a[8]===String.fromCharCode(64):!1:!1},"Please specify a valid NIF number."),jQuery.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please"),a.validator.addMethod("pattern",function(a,b,c){return this.optional(b)?!0:("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number"),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/)},"Please specify a valid phone number"),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code"),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode"),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=e||"undefined"==typeof c.caseSensitive?!1:c.caseSensitive,g=e||"undefined"==typeof c.includeTerritories?!1:c.includeTerritories,h=e||"undefined"==typeof c.includeMilitary?!1:c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state"),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59"),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format"),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;17>b;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid"),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx")});
|
js/map-frontend.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/* global google, jQuery */
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
/**
|
@@ -9,8 +8,7 @@ jQuery( function ( $ )
|
|
9 |
*
|
10 |
* @return void
|
11 |
*/
|
12 |
-
function displayMap()
|
13 |
-
{
|
14 |
var $container = $( this ),
|
15 |
options = $container.data( 'map_options' );
|
16 |
|
@@ -18,8 +16,7 @@ jQuery( function ( $ )
|
|
18 |
center = new google.maps.LatLng( options.latitude, options.longitude ),
|
19 |
map;
|
20 |
|
21 |
-
switch ( mapOptions.mapTypeId )
|
22 |
-
{
|
23 |
case 'ROADMAP':
|
24 |
mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;
|
25 |
break;
|
@@ -40,36 +37,31 @@ jQuery( function ( $ )
|
|
40 |
map = new google.maps.Map( this, mapOptions );
|
41 |
|
42 |
// Set marker
|
43 |
-
if ( options.marker )
|
44 |
-
{
|
45 |
var marker = new google.maps.Marker( {
|
46 |
position: center,
|
47 |
-
map
|
48 |
} );
|
49 |
|
50 |
// Set marker title
|
51 |
-
if ( options.marker_title )
|
52 |
-
{
|
53 |
marker.setTitle( options.marker_title );
|
54 |
}
|
55 |
|
56 |
// Set marker icon
|
57 |
-
if ( options.marker_icon )
|
58 |
-
{
|
59 |
marker.setIcon( options.marker_icon );
|
60 |
}
|
61 |
}
|
62 |
|
63 |
// Set info window
|
64 |
-
if ( options.info_window )
|
65 |
-
{
|
66 |
var infoWindow = new google.maps.InfoWindow( {
|
67 |
-
content
|
68 |
minWidth: 200
|
69 |
} );
|
70 |
|
71 |
-
google.maps.event.addListener( marker, 'click', function ()
|
72 |
-
{
|
73 |
infoWindow.open( map, marker );
|
74 |
} );
|
75 |
}
|
1 |
/* global google, jQuery */
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
/**
|
8 |
*
|
9 |
* @return void
|
10 |
*/
|
11 |
+
function displayMap() {
|
|
|
12 |
var $container = $( this ),
|
13 |
options = $container.data( 'map_options' );
|
14 |
|
16 |
center = new google.maps.LatLng( options.latitude, options.longitude ),
|
17 |
map;
|
18 |
|
19 |
+
switch ( mapOptions.mapTypeId ) {
|
|
|
20 |
case 'ROADMAP':
|
21 |
mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;
|
22 |
break;
|
37 |
map = new google.maps.Map( this, mapOptions );
|
38 |
|
39 |
// Set marker
|
40 |
+
if ( options.marker ) {
|
|
|
41 |
var marker = new google.maps.Marker( {
|
42 |
position: center,
|
43 |
+
map: map
|
44 |
} );
|
45 |
|
46 |
// Set marker title
|
47 |
+
if ( options.marker_title ) {
|
|
|
48 |
marker.setTitle( options.marker_title );
|
49 |
}
|
50 |
|
51 |
// Set marker icon
|
52 |
+
if ( options.marker_icon ) {
|
|
|
53 |
marker.setIcon( options.marker_icon );
|
54 |
}
|
55 |
}
|
56 |
|
57 |
// Set info window
|
58 |
+
if ( options.info_window ) {
|
|
|
59 |
var infoWindow = new google.maps.InfoWindow( {
|
60 |
+
content: options.info_window,
|
61 |
minWidth: 200
|
62 |
} );
|
63 |
|
64 |
+
google.maps.event.addListener( marker, 'click', function () {
|
|
|
65 |
infoWindow.open( map, marker );
|
66 |
} );
|
67 |
}
|
js/map.js
CHANGED
@@ -1,18 +1,15 @@
|
|
1 |
-
(function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
// Use function construction to store map & DOM elements separately for each instance
|
6 |
-
var MapField = function ( $container )
|
7 |
-
{
|
8 |
this.$container = $container;
|
9 |
};
|
10 |
|
11 |
// Use prototype for better performance
|
12 |
MapField.prototype = {
|
13 |
// Initialize everything
|
14 |
-
init: function ()
|
15 |
-
{
|
16 |
this.initDomElements();
|
17 |
this.initMapElements();
|
18 |
|
@@ -22,8 +19,7 @@
|
|
22 |
},
|
23 |
|
24 |
// Initialize DOM elements
|
25 |
-
initDomElements: function ()
|
26 |
-
{
|
27 |
this.canvas = this.$container.find( '.rwmb-map-canvas' )[0];
|
28 |
this.$coordinate = this.$container.find( '.rwmb-map-coordinate' );
|
29 |
this.$findButton = this.$container.find( '.rwmb-map-goto-address-button' );
|
@@ -31,33 +27,30 @@
|
|
31 |
},
|
32 |
|
33 |
// Initialize map elements
|
34 |
-
initMapElements: function ()
|
35 |
-
{
|
36 |
var defaultLoc = $( this.canvas ).data( 'default-loc' ),
|
37 |
latLng;
|
38 |
|
39 |
-
defaultLoc = defaultLoc ? defaultLoc.split( ',' ) : [53.346881, -6.258860];
|
40 |
latLng = new google.maps.LatLng( defaultLoc[0], defaultLoc[1] ); // Initial position for map
|
41 |
|
42 |
this.map = new google.maps.Map( this.canvas, {
|
43 |
-
center
|
44 |
-
zoom
|
45 |
streetViewControl: 0,
|
46 |
-
mapTypeId
|
47 |
} );
|
48 |
-
this.marker = new google.maps.Marker( {
|
49 |
this.geocoder = new google.maps.Geocoder();
|
50 |
},
|
51 |
|
52 |
// Initialize marker position
|
53 |
-
initMarkerPosition: function ()
|
54 |
-
{
|
55 |
var coord = this.$coordinate.val(),
|
56 |
l,
|
57 |
zoom;
|
58 |
|
59 |
-
if ( coord )
|
60 |
-
{
|
61 |
l = coord.split( ',' );
|
62 |
this.marker.setPosition( new google.maps.LatLng( l[0], l[1] ) );
|
63 |
|
@@ -66,34 +59,28 @@
|
|
66 |
this.map.setCenter( this.marker.position );
|
67 |
this.map.setZoom( zoom );
|
68 |
}
|
69 |
-
else if ( this.addressField )
|
70 |
-
{
|
71 |
this.geocodeAddress();
|
72 |
}
|
73 |
},
|
74 |
|
75 |
// Add event listeners for 'click' & 'drag'
|
76 |
-
addListeners: function ()
|
77 |
-
{
|
78 |
var that = this;
|
79 |
-
google.maps.event.addListener( this.map, 'click', function ( event )
|
80 |
-
{
|
81 |
that.marker.setPosition( event.latLng );
|
82 |
that.updateCoordinate( event.latLng );
|
83 |
} );
|
84 |
|
85 |
-
google.maps.event.addListener( this.map, 'zoom_changed', function ( event )
|
86 |
-
{
|
87 |
that.updateCoordinate( that.marker.getPosition() );
|
88 |
} );
|
89 |
|
90 |
-
google.maps.event.addListener( this.marker, 'drag', function ( event )
|
91 |
-
{
|
92 |
that.updateCoordinate( event.latLng );
|
93 |
} );
|
94 |
|
95 |
-
this.$findButton.on( 'click', function ()
|
96 |
-
{
|
97 |
that.geocodeAddress();
|
98 |
return false;
|
99 |
} );
|
@@ -105,30 +92,25 @@
|
|
105 |
* @see https://developers.google.com/maps/documentation/javascript/reference
|
106 |
* ('resize' Event)
|
107 |
*/
|
108 |
-
$( window ).on( 'rwmb_map_refresh', function ()
|
109 |
-
{
|
110 |
that.refresh();
|
111 |
} );
|
112 |
|
113 |
// Refresh on meta box hide and show
|
114 |
-
$( document ).on( 'postbox-toggled', function ()
|
115 |
-
{
|
116 |
that.refresh();
|
117 |
} );
|
118 |
// Refresh on sorting meta boxes
|
119 |
-
$( '.meta-box-sortables' ).on( 'sortstop', function ()
|
120 |
-
{
|
121 |
that.refresh();
|
122 |
} );
|
123 |
},
|
124 |
|
125 |
-
refresh: function ()
|
126 |
-
{
|
127 |
var zoom = this.map.getZoom(),
|
128 |
center = this.map.getCenter();
|
129 |
|
130 |
-
if ( this.map )
|
131 |
-
{
|
132 |
google.maps.event.trigger( this.map, 'resize' );
|
133 |
this.map.setZoom( zoom );
|
134 |
this.map.setCenter( center );
|
@@ -136,46 +118,39 @@
|
|
136 |
},
|
137 |
|
138 |
// Autocomplete address
|
139 |
-
autocomplete: function ()
|
140 |
-
{
|
141 |
var that = this;
|
142 |
|
143 |
// No address field or more than 1 address fields, ignore
|
144 |
-
if ( !this.addressField || this.addressField.split( ',' ).length > 1 )
|
145 |
-
{
|
146 |
return;
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
});
|
155 |
|
156 |
-
|
157 |
-
|
158 |
|
159 |
$( '#' + this.addressField ).autocomplete( {
|
160 |
-
source: function ( request, response )
|
161 |
-
{
|
162 |
that.geocoder.geocode( {
|
163 |
'address': request.term
|
164 |
-
}, function ( results )
|
165 |
-
|
166 |
-
response( $.map( results, function ( item )
|
167 |
-
{
|
168 |
return {
|
169 |
-
label
|
170 |
-
value
|
171 |
-
latitude
|
172 |
longitude: item.geometry.location.lng()
|
173 |
};
|
174 |
} ) );
|
175 |
} );
|
176 |
},
|
177 |
-
select: function ( event, ui )
|
178 |
-
{
|
179 |
var latLng = new google.maps.LatLng( ui.item.latitude, ui.item.longitude );
|
180 |
|
181 |
that.map.setCenter( latLng );
|
@@ -186,34 +161,28 @@
|
|
186 |
},
|
187 |
|
188 |
// Update coordinate to input field
|
189 |
-
updateCoordinate: function ( latLng )
|
190 |
-
{
|
191 |
var zoom = this.map.getZoom();
|
192 |
this.$coordinate.val( latLng.lat() + ',' + latLng.lng() + ',' + zoom );
|
193 |
},
|
194 |
|
195 |
// Find coordinates by address
|
196 |
-
geocodeAddress: function ()
|
197 |
-
{
|
198 |
var address,
|
199 |
addressList = [],
|
200 |
fieldList = this.addressField.split( ',' ),
|
201 |
loop,
|
202 |
that = this;
|
203 |
|
204 |
-
for ( loop = 0; loop < fieldList.length; loop++ )
|
205 |
-
{
|
206 |
addressList[loop] = jQuery( '#' + fieldList[loop] ).val();
|
207 |
}
|
208 |
|
209 |
address = addressList.join( ',' ).replace( /\n/g, ',' ).replace( /,,/g, ',' );
|
210 |
|
211 |
-
if ( address )
|
212 |
-
|
213 |
-
|
214 |
-
{
|
215 |
-
if ( status === google.maps.GeocoderStatus.OK )
|
216 |
-
{
|
217 |
that.map.setCenter( results[0].geometry.location );
|
218 |
that.marker.setPosition( results[0].geometry.location );
|
219 |
that.updateCoordinate( results[0].geometry.location );
|
@@ -223,20 +192,16 @@
|
|
223 |
}
|
224 |
};
|
225 |
|
226 |
-
$( function ()
|
227 |
-
|
228 |
-
$( '.rwmb-map-field' ).each( function ()
|
229 |
-
{
|
230 |
var field = new MapField( $( this ) );
|
231 |
field.init();
|
232 |
|
233 |
$( this ).data( 'mapController', field );
|
234 |
} );
|
235 |
|
236 |
-
$( '.rwmb-input' ).on( 'clone', function ()
|
237 |
-
|
238 |
-
$( '.rwmb-map-field' ).each( function ()
|
239 |
-
{
|
240 |
var field = new MapField( $( this ) );
|
241 |
field.init();
|
242 |
|
1 |
+
(function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
// Use function construction to store map & DOM elements separately for each instance
|
5 |
+
var MapField = function ( $container ) {
|
|
|
6 |
this.$container = $container;
|
7 |
};
|
8 |
|
9 |
// Use prototype for better performance
|
10 |
MapField.prototype = {
|
11 |
// Initialize everything
|
12 |
+
init: function () {
|
|
|
13 |
this.initDomElements();
|
14 |
this.initMapElements();
|
15 |
|
19 |
},
|
20 |
|
21 |
// Initialize DOM elements
|
22 |
+
initDomElements: function () {
|
|
|
23 |
this.canvas = this.$container.find( '.rwmb-map-canvas' )[0];
|
24 |
this.$coordinate = this.$container.find( '.rwmb-map-coordinate' );
|
25 |
this.$findButton = this.$container.find( '.rwmb-map-goto-address-button' );
|
27 |
},
|
28 |
|
29 |
// Initialize map elements
|
30 |
+
initMapElements: function () {
|
|
|
31 |
var defaultLoc = $( this.canvas ).data( 'default-loc' ),
|
32 |
latLng;
|
33 |
|
34 |
+
defaultLoc = defaultLoc ? defaultLoc.split( ',' ) : [53.346881, - 6.258860];
|
35 |
latLng = new google.maps.LatLng( defaultLoc[0], defaultLoc[1] ); // Initial position for map
|
36 |
|
37 |
this.map = new google.maps.Map( this.canvas, {
|
38 |
+
center: latLng,
|
39 |
+
zoom: 14,
|
40 |
streetViewControl: 0,
|
41 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
42 |
} );
|
43 |
+
this.marker = new google.maps.Marker( {position: latLng, map: this.map, draggable: true} );
|
44 |
this.geocoder = new google.maps.Geocoder();
|
45 |
},
|
46 |
|
47 |
// Initialize marker position
|
48 |
+
initMarkerPosition: function () {
|
|
|
49 |
var coord = this.$coordinate.val(),
|
50 |
l,
|
51 |
zoom;
|
52 |
|
53 |
+
if ( coord ) {
|
|
|
54 |
l = coord.split( ',' );
|
55 |
this.marker.setPosition( new google.maps.LatLng( l[0], l[1] ) );
|
56 |
|
59 |
this.map.setCenter( this.marker.position );
|
60 |
this.map.setZoom( zoom );
|
61 |
}
|
62 |
+
else if ( this.addressField ) {
|
|
|
63 |
this.geocodeAddress();
|
64 |
}
|
65 |
},
|
66 |
|
67 |
// Add event listeners for 'click' & 'drag'
|
68 |
+
addListeners: function () {
|
|
|
69 |
var that = this;
|
70 |
+
google.maps.event.addListener( this.map, 'click', function ( event ) {
|
|
|
71 |
that.marker.setPosition( event.latLng );
|
72 |
that.updateCoordinate( event.latLng );
|
73 |
} );
|
74 |
|
75 |
+
google.maps.event.addListener( this.map, 'zoom_changed', function ( event ) {
|
|
|
76 |
that.updateCoordinate( that.marker.getPosition() );
|
77 |
} );
|
78 |
|
79 |
+
google.maps.event.addListener( this.marker, 'drag', function ( event ) {
|
|
|
80 |
that.updateCoordinate( event.latLng );
|
81 |
} );
|
82 |
|
83 |
+
this.$findButton.on( 'click', function () {
|
|
|
84 |
that.geocodeAddress();
|
85 |
return false;
|
86 |
} );
|
92 |
* @see https://developers.google.com/maps/documentation/javascript/reference
|
93 |
* ('resize' Event)
|
94 |
*/
|
95 |
+
$( window ).on( 'rwmb_map_refresh', function () {
|
|
|
96 |
that.refresh();
|
97 |
} );
|
98 |
|
99 |
// Refresh on meta box hide and show
|
100 |
+
$( document ).on( 'postbox-toggled', function () {
|
|
|
101 |
that.refresh();
|
102 |
} );
|
103 |
// Refresh on sorting meta boxes
|
104 |
+
$( '.meta-box-sortables' ).on( 'sortstop', function () {
|
|
|
105 |
that.refresh();
|
106 |
} );
|
107 |
},
|
108 |
|
109 |
+
refresh: function () {
|
|
|
110 |
var zoom = this.map.getZoom(),
|
111 |
center = this.map.getCenter();
|
112 |
|
113 |
+
if ( this.map ) {
|
|
|
114 |
google.maps.event.trigger( this.map, 'resize' );
|
115 |
this.map.setZoom( zoom );
|
116 |
this.map.setCenter( center );
|
118 |
},
|
119 |
|
120 |
// Autocomplete address
|
121 |
+
autocomplete: function () {
|
|
|
122 |
var that = this;
|
123 |
|
124 |
// No address field or more than 1 address fields, ignore
|
125 |
+
if ( ! this.addressField || this.addressField.split( ',' ).length > 1 ) {
|
|
|
126 |
return;
|
127 |
}
|
128 |
|
129 |
+
// If Meta Box Geo Location installed. Do not run auto complete.
|
130 |
+
if ( $( '.rwmb-geo-binding' ).length ) {
|
131 |
+
$( '#' + this.addressField ).on( 'selected_address', function () {
|
132 |
+
that.$findButton.trigger( 'click' );
|
133 |
+
} );
|
|
|
134 |
|
135 |
+
return false;
|
136 |
+
}
|
137 |
|
138 |
$( '#' + this.addressField ).autocomplete( {
|
139 |
+
source: function ( request, response ) {
|
|
|
140 |
that.geocoder.geocode( {
|
141 |
'address': request.term
|
142 |
+
}, function ( results ) {
|
143 |
+
response( $.map( results, function ( item ) {
|
|
|
|
|
144 |
return {
|
145 |
+
label: item.formatted_address,
|
146 |
+
value: item.formatted_address,
|
147 |
+
latitude: item.geometry.location.lat(),
|
148 |
longitude: item.geometry.location.lng()
|
149 |
};
|
150 |
} ) );
|
151 |
} );
|
152 |
},
|
153 |
+
select: function ( event, ui ) {
|
|
|
154 |
var latLng = new google.maps.LatLng( ui.item.latitude, ui.item.longitude );
|
155 |
|
156 |
that.map.setCenter( latLng );
|
161 |
},
|
162 |
|
163 |
// Update coordinate to input field
|
164 |
+
updateCoordinate: function ( latLng ) {
|
|
|
165 |
var zoom = this.map.getZoom();
|
166 |
this.$coordinate.val( latLng.lat() + ',' + latLng.lng() + ',' + zoom );
|
167 |
},
|
168 |
|
169 |
// Find coordinates by address
|
170 |
+
geocodeAddress: function () {
|
|
|
171 |
var address,
|
172 |
addressList = [],
|
173 |
fieldList = this.addressField.split( ',' ),
|
174 |
loop,
|
175 |
that = this;
|
176 |
|
177 |
+
for ( loop = 0; loop < fieldList.length; loop ++ ) {
|
|
|
178 |
addressList[loop] = jQuery( '#' + fieldList[loop] ).val();
|
179 |
}
|
180 |
|
181 |
address = addressList.join( ',' ).replace( /\n/g, ',' ).replace( /,,/g, ',' );
|
182 |
|
183 |
+
if ( address ) {
|
184 |
+
this.geocoder.geocode( {'address': address}, function ( results, status ) {
|
185 |
+
if ( status === google.maps.GeocoderStatus.OK ) {
|
|
|
|
|
|
|
186 |
that.map.setCenter( results[0].geometry.location );
|
187 |
that.marker.setPosition( results[0].geometry.location );
|
188 |
that.updateCoordinate( results[0].geometry.location );
|
192 |
}
|
193 |
};
|
194 |
|
195 |
+
$( function () {
|
196 |
+
$( '.rwmb-map-field' ).each( function () {
|
|
|
|
|
197 |
var field = new MapField( $( this ) );
|
198 |
field.init();
|
199 |
|
200 |
$( this ).data( 'mapController', field );
|
201 |
} );
|
202 |
|
203 |
+
$( '.rwmb-input' ).on( 'clone', function () {
|
204 |
+
$( '.rwmb-map-field' ).each( function () {
|
|
|
|
|
205 |
var field = new MapField( $( this ) );
|
206 |
field.init();
|
207 |
|
js/media.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
var views = rwmb.views = rwmb.views || {},
|
@@ -15,26 +14,24 @@ jQuery( function ( $ )
|
|
15 |
Controller = models.Controller = Backbone.Model.extend( {
|
16 |
//Default options
|
17 |
defaults: {
|
18 |
-
maxFiles
|
19 |
-
ids
|
20 |
-
mimeType
|
21 |
forceDelete: false,
|
22 |
-
showStatus
|
23 |
-
length
|
24 |
},
|
25 |
|
26 |
//Initialize Controller model
|
27 |
-
initialize: function ( options )
|
28 |
-
{
|
29 |
var that = this;
|
30 |
// All numbers, no 0 ids
|
31 |
-
this.set( 'ids', _.without( _.map( this.get( 'ids' ), Number ), 0, -1 ) );
|
32 |
|
33 |
// Create items collection
|
34 |
this.set( 'items', new wp.media.model.Attachments() );
|
35 |
|
36 |
-
this.listenTo( this.get( 'items' ), 'add remove reset', function ()
|
37 |
-
{
|
38 |
var items = this.get( 'items' ),
|
39 |
length = items.length,
|
40 |
max = this.get( 'maxFiles' );
|
@@ -44,12 +41,9 @@ jQuery( function ( $ )
|
|
44 |
} );
|
45 |
|
46 |
// Listen for destroy event on controller, delete all models when triggered
|
47 |
-
this.on( 'destroy', function ( e )
|
48 |
-
|
49 |
-
|
50 |
-
{
|
51 |
-
this.get( 'items' ).each( function ( item )
|
52 |
-
{
|
53 |
item.destroy();
|
54 |
} );
|
55 |
}
|
@@ -58,19 +52,17 @@ jQuery( function ( $ )
|
|
58 |
|
59 |
|
60 |
// Method to load media
|
61 |
-
load: function ()
|
62 |
-
{
|
63 |
var that = this;
|
64 |
// Load initial media
|
65 |
-
if ( !_.isEmpty( this.get( 'ids' ) ) )
|
66 |
-
{
|
67 |
this.get( 'items' ).props.set( {
|
68 |
-
query
|
69 |
include: this.get( 'ids' ),
|
70 |
orderby: 'post__in',
|
71 |
-
order
|
72 |
-
type
|
73 |
-
perPage: this.get( 'maxFiles' ) || -1
|
74 |
} );
|
75 |
// Get more then trigger ready
|
76 |
this.get( 'items' ).more();
|
@@ -78,21 +70,20 @@ jQuery( function ( $ )
|
|
78 |
},
|
79 |
|
80 |
// Method to remove media items
|
81 |
-
removeItem: function ( item )
|
82 |
-
{
|
83 |
this.get( 'items' ).remove( item );
|
84 |
-
if ( this.get( 'forceDelete' ) )
|
85 |
item.destroy();
|
|
|
86 |
},
|
87 |
|
88 |
// Method to add items
|
89 |
-
addItems: function ( items )
|
90 |
-
|
91 |
-
if ( this.get( 'maxFiles' ) )
|
92 |
-
{
|
93 |
var left = this.get( 'maxFiles' ) - this.get( 'items' ).length;
|
94 |
-
if ( left <= 0 )
|
95 |
return this;
|
|
|
96 |
|
97 |
items = _.difference( items, this.get( 'items' ).models );
|
98 |
items = _.first( items, left );
|
@@ -106,14 +97,13 @@ jQuery( function ( $ )
|
|
106 |
* Sets up media field view and subviews
|
107 |
*/
|
108 |
MediaField = views.MediaField = Backbone.View.extend( {
|
109 |
-
initialize: function ( options )
|
110 |
-
{
|
111 |
var that = this;
|
112 |
this.$input = $( options.input );
|
113 |
this.controller = new Controller( _.extend(
|
114 |
{
|
115 |
fieldName: this.$input.attr( 'name' ),
|
116 |
-
ids
|
117 |
},
|
118 |
this.$el.data()
|
119 |
) );
|
@@ -130,33 +120,32 @@ jQuery( function ( $ )
|
|
130 |
this.controller.load();
|
131 |
|
132 |
// Listen for destroy event on input
|
133 |
-
this.$input.on( 'remove', function ()
|
134 |
-
{
|
135 |
this.controller.destroy();
|
136 |
-
} )
|
|
|
|
|
|
|
|
|
137 |
},
|
138 |
|
139 |
// Creates media list
|
140 |
-
createList: function ()
|
141 |
-
|
142 |
-
this.list = new MediaList( { controller: this.controller } );
|
143 |
},
|
144 |
|
145 |
// Creates button that adds media
|
146 |
-
createAddButton: function ()
|
147 |
-
|
148 |
-
this.addButton = new MediaButton( { controller: this.controller } );
|
149 |
},
|
150 |
|
151 |
// Creates status
|
152 |
-
createStatus: function ()
|
153 |
-
|
154 |
-
this.status = new MediaStatus( { controller: this.controller } );
|
155 |
},
|
156 |
|
157 |
// Render field and adds sub fields
|
158 |
-
render: function ()
|
159 |
-
{
|
160 |
// Empty then add parts
|
161 |
this.$el.empty().append(
|
162 |
this.list.el,
|
@@ -171,14 +160,13 @@ jQuery( function ( $ )
|
|
171 |
* lists media
|
172 |
*/
|
173 |
MediaList = views.MediaList = Backbone.View.extend( {
|
174 |
-
tagName
|
175 |
className: 'rwmb-media-list',
|
176 |
|
177 |
//Add item view
|
178 |
-
addItemView: function ( item )
|
179 |
-
{
|
180 |
var view = this._views[item.cid] = new this.itemView( {
|
181 |
-
model
|
182 |
controller: this.controller
|
183 |
} );
|
184 |
|
@@ -186,17 +174,14 @@ jQuery( function ( $ )
|
|
186 |
},
|
187 |
|
188 |
//Remove item view
|
189 |
-
removeItemView: function ( item )
|
190 |
-
|
191 |
-
if ( this._views[item.cid] )
|
192 |
-
{
|
193 |
this._views[item.cid].remove();
|
194 |
delete this._views[item.cid];
|
195 |
}
|
196 |
},
|
197 |
|
198 |
-
initialize: function ( options )
|
199 |
-
{
|
200 |
this._views = {};
|
201 |
this.controller = options.controller;
|
202 |
this.itemView = options.itemView || MediaItem;
|
@@ -207,14 +192,12 @@ jQuery( function ( $ )
|
|
207 |
this.initSortable();
|
208 |
},
|
209 |
|
210 |
-
setEvents: function ()
|
211 |
-
{
|
212 |
this.listenTo( this.controller.get( 'items' ), 'add', this.addItemView );
|
213 |
this.listenTo( this.controller.get( 'items' ), 'remove', this.removeItemView );
|
214 |
},
|
215 |
|
216 |
-
initSortable: function ()
|
217 |
-
{
|
218 |
var collection = this.controller.get( 'items' );
|
219 |
this.$el.sortable( {
|
220 |
// Change the position of the attachment as soon as the
|
@@ -222,15 +205,13 @@ jQuery( function ( $ )
|
|
222 |
tolerance: 'pointer',
|
223 |
|
224 |
// Record the initial `index` of the dragged model.
|
225 |
-
start: function ( event, ui )
|
226 |
-
{
|
227 |
ui.item.data( 'sortableIndexStart', ui.item.index() );
|
228 |
},
|
229 |
|
230 |
// Update the model's index in the collection.
|
231 |
// Do so silently, as the view is already accurate.
|
232 |
-
update: function ( event, ui )
|
233 |
-
{
|
234 |
var model = collection.at( ui.item.data( 'sortableIndexStart' ) );
|
235 |
|
236 |
// Silently shift the model to its new index.
|
@@ -239,7 +220,7 @@ jQuery( function ( $ )
|
|
239 |
} );
|
240 |
collection.add( model, {
|
241 |
silent: true,
|
242 |
-
at
|
243 |
} );
|
244 |
|
245 |
// Fire the `reset` event to ensure other collections sync.
|
@@ -254,18 +235,18 @@ jQuery( function ( $ )
|
|
254 |
* Tracks status of media field if maxStatus is greater than 0
|
255 |
*/
|
256 |
MediaStatus = views.MediaStatus = Backbone.View.extend( {
|
257 |
-
tagName
|
258 |
className: 'rwmb-media-status',
|
259 |
-
template
|
260 |
|
261 |
//Initialize
|
262 |
-
initialize: function ( options )
|
263 |
-
{
|
264 |
this.controller = options.controller;
|
265 |
|
266 |
//Auto hide if showStatus is false
|
267 |
-
if ( !this.controller.get( 'showStatus' ) )
|
268 |
this.$el.hide();
|
|
|
269 |
|
270 |
//Rerender if changes happen in controller
|
271 |
this.listenTo( this.controller, 'change:length', this.render );
|
@@ -274,8 +255,7 @@ jQuery( function ( $ )
|
|
274 |
this.render();
|
275 |
},
|
276 |
|
277 |
-
render: function ()
|
278 |
-
{
|
279 |
var attrs = _.clone( this.controller.attributes );
|
280 |
this.$el.html( this.template( attrs ) );
|
281 |
}
|
@@ -287,29 +267,26 @@ jQuery( function ( $ )
|
|
287 |
*/
|
288 |
MediaButton = views.MediaButton = Backbone.View.extend( {
|
289 |
className: 'rwmb-add-media button',
|
290 |
-
tagName
|
291 |
-
events
|
292 |
-
click: function ()
|
293 |
-
{
|
294 |
// Destroy the previous collection frame.
|
295 |
-
if ( this._frame )
|
296 |
-
{
|
297 |
//this.stopListening( this._frame );
|
298 |
this._frame.dispose();
|
299 |
}
|
300 |
|
301 |
this._frame = wp.media( {
|
302 |
className: 'media-frame rwmb-media-frame',
|
303 |
-
multiple
|
304 |
-
title
|
305 |
-
editing
|
306 |
-
library
|
307 |
type: this.controller.get( 'mimeType' )
|
308 |
}
|
309 |
} );
|
310 |
|
311 |
-
this._frame.on( 'select', function ()
|
312 |
-
{
|
313 |
var selection = this._frame.state().get( 'selection' );
|
314 |
this.controller.addItems( selection.models );
|
315 |
}, this );
|
@@ -317,20 +294,17 @@ jQuery( function ( $ )
|
|
317 |
this._frame.open();
|
318 |
}
|
319 |
},
|
320 |
-
render
|
321 |
-
{
|
322 |
this.$el.text( i18nRwmbMedia.add );
|
323 |
return this;
|
324 |
},
|
325 |
|
326 |
-
initialize: function ( options )
|
327 |
-
{
|
328 |
this.controller = options.controller;
|
329 |
|
330 |
// Auto hide if you reach the max number of media
|
331 |
-
this.listenTo( this.controller, 'change:full', function ()
|
332 |
-
|
333 |
-
this.$el.toggle( !this.controller.get( 'full' ) );
|
334 |
} );
|
335 |
|
336 |
this.render();
|
@@ -342,15 +316,13 @@ jQuery( function ( $ )
|
|
342 |
* View for individual media items
|
343 |
*/
|
344 |
MediaItem = views.MediaItem = Backbone.View.extend( {
|
345 |
-
tagName
|
346 |
-
className
|
347 |
-
template
|
348 |
-
initialize: function ( options )
|
349 |
-
{
|
350 |
this.controller = options.controller;
|
351 |
this.render();
|
352 |
-
this.listenTo( this.model, 'change', function ()
|
353 |
-
{
|
354 |
this.render();
|
355 |
} );
|
356 |
|
@@ -360,37 +332,32 @@ jQuery( function ( $ )
|
|
360 |
|
361 |
events: {
|
362 |
// Event when remove button clicked
|
363 |
-
'click .rwmb-remove-media': function ( e )
|
364 |
-
{
|
365 |
this.controller.removeItem( this.model );
|
366 |
return false;
|
367 |
},
|
368 |
|
369 |
-
'click .rwmb-edit-media': function ( e )
|
370 |
-
{
|
371 |
// Destroy the previous collection frame.
|
372 |
-
if ( this._frame )
|
373 |
-
{
|
374 |
//this.stopListening( this._frame );
|
375 |
this._frame.dispose();
|
376 |
}
|
377 |
|
378 |
// Trigger the media frame to open the correct item
|
379 |
this._frame = wp.media( {
|
380 |
-
frame
|
381 |
controller: {
|
382 |
// Needed to trick Edit modal to think there is a gridRouter
|
383 |
gridRouter: {
|
384 |
-
navigate: function ( destination )
|
385 |
-
{
|
386 |
},
|
387 |
-
baseUrl
|
388 |
-
{
|
389 |
}
|
390 |
}
|
391 |
},
|
392 |
-
library
|
393 |
-
model
|
394 |
} );
|
395 |
|
396 |
this._frame.open();
|
@@ -399,8 +366,7 @@ jQuery( function ( $ )
|
|
399 |
}
|
400 |
},
|
401 |
|
402 |
-
render: function ()
|
403 |
-
{
|
404 |
var attrs = _.clone( this.model.attributes );
|
405 |
attrs.fieldName = this.controller.get( 'fieldName' );
|
406 |
this.$el.html( this.template( attrs ) );
|
@@ -412,9 +378,8 @@ jQuery( function ( $ )
|
|
412 |
* Initialize media fields
|
413 |
* @return void
|
414 |
*/
|
415 |
-
function initMediaField()
|
416 |
-
|
417 |
-
new MediaField( { input: this, el: $( this ).siblings( 'div.rwmb-media-view' ) } );
|
418 |
}
|
419 |
|
420 |
|
1 |
window.rwmb = window.rwmb || {};
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
var views = rwmb.views = rwmb.views || {},
|
14 |
Controller = models.Controller = Backbone.Model.extend( {
|
15 |
//Default options
|
16 |
defaults: {
|
17 |
+
maxFiles: 0,
|
18 |
+
ids: [],
|
19 |
+
mimeType: '',
|
20 |
forceDelete: false,
|
21 |
+
showStatus: true,
|
22 |
+
length: 0
|
23 |
},
|
24 |
|
25 |
//Initialize Controller model
|
26 |
+
initialize: function ( options ) {
|
|
|
27 |
var that = this;
|
28 |
// All numbers, no 0 ids
|
29 |
+
this.set( 'ids', _.without( _.map( this.get( 'ids' ), Number ), 0, - 1 ) );
|
30 |
|
31 |
// Create items collection
|
32 |
this.set( 'items', new wp.media.model.Attachments() );
|
33 |
|
34 |
+
this.listenTo( this.get( 'items' ), 'add remove reset', function () {
|
|
|
35 |
var items = this.get( 'items' ),
|
36 |
length = items.length,
|
37 |
max = this.get( 'maxFiles' );
|
41 |
} );
|
42 |
|
43 |
// Listen for destroy event on controller, delete all models when triggered
|
44 |
+
this.on( 'destroy', function ( e ) {
|
45 |
+
if ( this.get( 'forceDelete' ) ) {
|
46 |
+
this.get( 'items' ).each( function ( item ) {
|
|
|
|
|
|
|
47 |
item.destroy();
|
48 |
} );
|
49 |
}
|
52 |
|
53 |
|
54 |
// Method to load media
|
55 |
+
load: function () {
|
|
|
56 |
var that = this;
|
57 |
// Load initial media
|
58 |
+
if ( ! _.isEmpty( this.get( 'ids' ) ) ) {
|
|
|
59 |
this.get( 'items' ).props.set( {
|
60 |
+
query: true,
|
61 |
include: this.get( 'ids' ),
|
62 |
orderby: 'post__in',
|
63 |
+
order: 'ASC',
|
64 |
+
type: this.get( 'mimeType' ),
|
65 |
+
perPage: this.get( 'maxFiles' ) || - 1
|
66 |
} );
|
67 |
// Get more then trigger ready
|
68 |
this.get( 'items' ).more();
|
70 |
},
|
71 |
|
72 |
// Method to remove media items
|
73 |
+
removeItem: function ( item ) {
|
|
|
74 |
this.get( 'items' ).remove( item );
|
75 |
+
if ( this.get( 'forceDelete' ) ) {
|
76 |
item.destroy();
|
77 |
+
}
|
78 |
},
|
79 |
|
80 |
// Method to add items
|
81 |
+
addItems: function ( items ) {
|
82 |
+
if ( this.get( 'maxFiles' ) ) {
|
|
|
|
|
83 |
var left = this.get( 'maxFiles' ) - this.get( 'items' ).length;
|
84 |
+
if ( left <= 0 ) {
|
85 |
return this;
|
86 |
+
}
|
87 |
|
88 |
items = _.difference( items, this.get( 'items' ).models );
|
89 |
items = _.first( items, left );
|
97 |
* Sets up media field view and subviews
|
98 |
*/
|
99 |
MediaField = views.MediaField = Backbone.View.extend( {
|
100 |
+
initialize: function ( options ) {
|
|
|
101 |
var that = this;
|
102 |
this.$input = $( options.input );
|
103 |
this.controller = new Controller( _.extend(
|
104 |
{
|
105 |
fieldName: this.$input.attr( 'name' ),
|
106 |
+
ids: this.$input.val().split( ',' )
|
107 |
},
|
108 |
this.$el.data()
|
109 |
) );
|
120 |
this.controller.load();
|
121 |
|
122 |
// Listen for destroy event on input
|
123 |
+
this.$input.on( 'remove', function () {
|
|
|
124 |
this.controller.destroy();
|
125 |
+
} );
|
126 |
+
|
127 |
+
this.controller.on( 'change:length', function ( e ) {
|
128 |
+
that.$input.trigger( 'change' );
|
129 |
+
} );
|
130 |
},
|
131 |
|
132 |
// Creates media list
|
133 |
+
createList: function () {
|
134 |
+
this.list = new MediaList( {controller: this.controller} );
|
|
|
135 |
},
|
136 |
|
137 |
// Creates button that adds media
|
138 |
+
createAddButton: function () {
|
139 |
+
this.addButton = new MediaButton( {controller: this.controller} );
|
|
|
140 |
},
|
141 |
|
142 |
// Creates status
|
143 |
+
createStatus: function () {
|
144 |
+
this.status = new MediaStatus( {controller: this.controller} );
|
|
|
145 |
},
|
146 |
|
147 |
// Render field and adds sub fields
|
148 |
+
render: function () {
|
|
|
149 |
// Empty then add parts
|
150 |
this.$el.empty().append(
|
151 |
this.list.el,
|
160 |
* lists media
|
161 |
*/
|
162 |
MediaList = views.MediaList = Backbone.View.extend( {
|
163 |
+
tagName: 'ul',
|
164 |
className: 'rwmb-media-list',
|
165 |
|
166 |
//Add item view
|
167 |
+
addItemView: function ( item ) {
|
|
|
168 |
var view = this._views[item.cid] = new this.itemView( {
|
169 |
+
model: item,
|
170 |
controller: this.controller
|
171 |
} );
|
172 |
|
174 |
},
|
175 |
|
176 |
//Remove item view
|
177 |
+
removeItemView: function ( item ) {
|
178 |
+
if ( this._views[item.cid] ) {
|
|
|
|
|
179 |
this._views[item.cid].remove();
|
180 |
delete this._views[item.cid];
|
181 |
}
|
182 |
},
|
183 |
|
184 |
+
initialize: function ( options ) {
|
|
|
185 |
this._views = {};
|
186 |
this.controller = options.controller;
|
187 |
this.itemView = options.itemView || MediaItem;
|
192 |
this.initSortable();
|
193 |
},
|
194 |
|
195 |
+
setEvents: function () {
|
|
|
196 |
this.listenTo( this.controller.get( 'items' ), 'add', this.addItemView );
|
197 |
this.listenTo( this.controller.get( 'items' ), 'remove', this.removeItemView );
|
198 |
},
|
199 |
|
200 |
+
initSortable: function () {
|
|
|
201 |
var collection = this.controller.get( 'items' );
|
202 |
this.$el.sortable( {
|
203 |
// Change the position of the attachment as soon as the
|
205 |
tolerance: 'pointer',
|
206 |
|
207 |
// Record the initial `index` of the dragged model.
|
208 |
+
start: function ( event, ui ) {
|
|
|
209 |
ui.item.data( 'sortableIndexStart', ui.item.index() );
|
210 |
},
|
211 |
|
212 |
// Update the model's index in the collection.
|
213 |
// Do so silently, as the view is already accurate.
|
214 |
+
update: function ( event, ui ) {
|
|
|
215 |
var model = collection.at( ui.item.data( 'sortableIndexStart' ) );
|
216 |
|
217 |
// Silently shift the model to its new index.
|
220 |
} );
|
221 |
collection.add( model, {
|
222 |
silent: true,
|
223 |
+
at: ui.item.index()
|
224 |
} );
|
225 |
|
226 |
// Fire the `reset` event to ensure other collections sync.
|
235 |
* Tracks status of media field if maxStatus is greater than 0
|
236 |
*/
|
237 |
MediaStatus = views.MediaStatus = Backbone.View.extend( {
|
238 |
+
tagName: 'span',
|
239 |
className: 'rwmb-media-status',
|
240 |
+
template: wp.template( 'rwmb-media-status' ),
|
241 |
|
242 |
//Initialize
|
243 |
+
initialize: function ( options ) {
|
|
|
244 |
this.controller = options.controller;
|
245 |
|
246 |
//Auto hide if showStatus is false
|
247 |
+
if ( ! this.controller.get( 'showStatus' ) ) {
|
248 |
this.$el.hide();
|
249 |
+
}
|
250 |
|
251 |
//Rerender if changes happen in controller
|
252 |
this.listenTo( this.controller, 'change:length', this.render );
|
255 |
this.render();
|
256 |
},
|
257 |
|
258 |
+
render: function () {
|
|
|
259 |
var attrs = _.clone( this.controller.attributes );
|
260 |
this.$el.html( this.template( attrs ) );
|
261 |
}
|
267 |
*/
|
268 |
MediaButton = views.MediaButton = Backbone.View.extend( {
|
269 |
className: 'rwmb-add-media button',
|
270 |
+
tagName: 'a',
|
271 |
+
events: {
|
272 |
+
click: function () {
|
|
|
273 |
// Destroy the previous collection frame.
|
274 |
+
if ( this._frame ) {
|
|
|
275 |
//this.stopListening( this._frame );
|
276 |
this._frame.dispose();
|
277 |
}
|
278 |
|
279 |
this._frame = wp.media( {
|
280 |
className: 'media-frame rwmb-media-frame',
|
281 |
+
multiple: true,
|
282 |
+
title: i18nRwmbMedia.select,
|
283 |
+
editing: true,
|
284 |
+
library: {
|
285 |
type: this.controller.get( 'mimeType' )
|
286 |
}
|
287 |
} );
|
288 |
|
289 |
+
this._frame.on( 'select', function () {
|
|
|
290 |
var selection = this._frame.state().get( 'selection' );
|
291 |
this.controller.addItems( selection.models );
|
292 |
}, this );
|
294 |
this._frame.open();
|
295 |
}
|
296 |
},
|
297 |
+
render: function () {
|
|
|
298 |
this.$el.text( i18nRwmbMedia.add );
|
299 |
return this;
|
300 |
},
|
301 |
|
302 |
+
initialize: function ( options ) {
|
|
|
303 |
this.controller = options.controller;
|
304 |
|
305 |
// Auto hide if you reach the max number of media
|
306 |
+
this.listenTo( this.controller, 'change:full', function () {
|
307 |
+
this.$el.toggle( ! this.controller.get( 'full' ) );
|
|
|
308 |
} );
|
309 |
|
310 |
this.render();
|
316 |
* View for individual media items
|
317 |
*/
|
318 |
MediaItem = views.MediaItem = Backbone.View.extend( {
|
319 |
+
tagName: 'li',
|
320 |
+
className: 'rwmb-media-item',
|
321 |
+
template: wp.template( 'rwmb-media-item' ),
|
322 |
+
initialize: function ( options ) {
|
|
|
323 |
this.controller = options.controller;
|
324 |
this.render();
|
325 |
+
this.listenTo( this.model, 'change', function () {
|
|
|
326 |
this.render();
|
327 |
} );
|
328 |
|
332 |
|
333 |
events: {
|
334 |
// Event when remove button clicked
|
335 |
+
'click .rwmb-remove-media': function ( e ) {
|
|
|
336 |
this.controller.removeItem( this.model );
|
337 |
return false;
|
338 |
},
|
339 |
|
340 |
+
'click .rwmb-edit-media': function ( e ) {
|
|
|
341 |
// Destroy the previous collection frame.
|
342 |
+
if ( this._frame ) {
|
|
|
343 |
//this.stopListening( this._frame );
|
344 |
this._frame.dispose();
|
345 |
}
|
346 |
|
347 |
// Trigger the media frame to open the correct item
|
348 |
this._frame = wp.media( {
|
349 |
+
frame: 'edit-attachments',
|
350 |
controller: {
|
351 |
// Needed to trick Edit modal to think there is a gridRouter
|
352 |
gridRouter: {
|
353 |
+
navigate: function ( destination ) {
|
|
|
354 |
},
|
355 |
+
baseUrl: function ( url ) {
|
|
|
356 |
}
|
357 |
}
|
358 |
},
|
359 |
+
library: this.controller.get( 'items' ),
|
360 |
+
model: this.model
|
361 |
} );
|
362 |
|
363 |
this._frame.open();
|
366 |
}
|
367 |
},
|
368 |
|
369 |
+
render: function () {
|
|
|
370 |
var attrs = _.clone( this.model.attributes );
|
371 |
attrs.fieldName = this.controller.get( 'fieldName' );
|
372 |
this.$el.html( this.template( attrs ) );
|
378 |
* Initialize media fields
|
379 |
* @return void
|
380 |
*/
|
381 |
+
function initMediaField() {
|
382 |
+
new MediaField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
|
|
|
383 |
}
|
384 |
|
385 |
|
js/range.js
CHANGED
@@ -1,20 +1,17 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update color picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function update()
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
$output = $this.siblings( '.rwmb-output' );
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
} );
|
18 |
|
19 |
}
|
20 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update color picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function update() {
|
|
|
9 |
var $this = $( this ),
|
10 |
$output = $this.siblings( '.rwmb-output' );
|
11 |
|
12 |
+
$this.on( 'input propertychange change', function ( e ) {
|
13 |
+
$output.html( $this.val() );
|
14 |
+
} );
|
|
|
15 |
|
16 |
}
|
17 |
|
js/select-advanced.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
@@ -8,8 +7,7 @@ jQuery( function ( $ )
|
|
8 |
*
|
9 |
* @return void
|
10 |
*/
|
11 |
-
function update()
|
12 |
-
{
|
13 |
var $this = $( this ),
|
14 |
options = $this.data( 'options' );
|
15 |
$this.siblings( '.select2-container' ).remove();
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
7 |
*
|
8 |
* @return void
|
9 |
*/
|
10 |
+
function update() {
|
|
|
11 |
var $this = $( this ),
|
12 |
options = $this.data( 'options' );
|
13 |
$this.siblings( '.select2-container' ).remove();
|
js/select-tree.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
-
jQuery( function( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
-
function update()
|
6 |
-
{
|
7 |
var $this = $( this ),
|
8 |
val = $this.val(),
|
9 |
$selected = $this.siblings( "[data-parent-id='" + val + "']" ),
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
+
function update() {
|
|
|
5 |
var $this = $( this ),
|
6 |
val = $this.val(),
|
7 |
$selected = $this.siblings( "[data-parent-id='" + val + "']" ),
|
js/select.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
@@ -14,29 +13,23 @@ jQuery( function ( $ )
|
|
14 |
*
|
15 |
* @return void
|
16 |
*/
|
17 |
-
selectAllNone: function ( $input )
|
18 |
-
{
|
19 |
var $element = $input.find( 'select' );
|
20 |
|
21 |
-
$input.on( 'click', '.rwmb-select-all-none a', function ( e )
|
22 |
-
{
|
23 |
e.preventDefault();
|
24 |
-
if ( 'all' == $( this ).data( 'type' ) )
|
25 |
-
{
|
26 |
var selected = [];
|
27 |
-
$element.find( 'option' ).each( function ( i, e )
|
28 |
-
{
|
29 |
var $value = $( e ).attr( 'value' );
|
30 |
|
31 |
-
if ( $value != '' )
|
32 |
-
{
|
33 |
selected.push( $value );
|
34 |
}
|
35 |
} );
|
36 |
$element.val( selected ).trigger( 'change' );
|
37 |
}
|
38 |
-
else
|
39 |
-
{
|
40 |
$element.val( '' );
|
41 |
}
|
42 |
} );
|
@@ -49,20 +42,16 @@ jQuery( function ( $ )
|
|
49 |
*
|
50 |
* @return void
|
51 |
*/
|
52 |
-
bindEvents: function ( $el )
|
53 |
-
{
|
54 |
var $input = $el.closest( '.rwmb-input' ),
|
55 |
$clone = $input.find( '.rwmb-clone' );
|
56 |
|
57 |
-
if ( $clone.length )
|
58 |
-
|
59 |
-
$clone.each( function ()
|
60 |
-
{
|
61 |
select.selectAllNone( $( this ) );
|
62 |
} );
|
63 |
}
|
64 |
-
else
|
65 |
-
{
|
66 |
select.selectAllNone( $input );
|
67 |
}
|
68 |
}
|
@@ -73,8 +62,7 @@ jQuery( function ( $ )
|
|
73 |
*
|
74 |
* @return void
|
75 |
*/
|
76 |
-
function update()
|
77 |
-
{
|
78 |
select.bindEvents( $( this ) );
|
79 |
}
|
80 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
13 |
*
|
14 |
* @return void
|
15 |
*/
|
16 |
+
selectAllNone: function ( $input ) {
|
|
|
17 |
var $element = $input.find( 'select' );
|
18 |
|
19 |
+
$input.on( 'click', '.rwmb-select-all-none a', function ( e ) {
|
|
|
20 |
e.preventDefault();
|
21 |
+
if ( 'all' == $( this ).data( 'type' ) ) {
|
|
|
22 |
var selected = [];
|
23 |
+
$element.find( 'option' ).each( function ( i, e ) {
|
|
|
24 |
var $value = $( e ).attr( 'value' );
|
25 |
|
26 |
+
if ( $value != '' ) {
|
|
|
27 |
selected.push( $value );
|
28 |
}
|
29 |
} );
|
30 |
$element.val( selected ).trigger( 'change' );
|
31 |
}
|
32 |
+
else {
|
|
|
33 |
$element.val( '' );
|
34 |
}
|
35 |
} );
|
42 |
*
|
43 |
* @return void
|
44 |
*/
|
45 |
+
bindEvents: function ( $el ) {
|
|
|
46 |
var $input = $el.closest( '.rwmb-input' ),
|
47 |
$clone = $input.find( '.rwmb-clone' );
|
48 |
|
49 |
+
if ( $clone.length ) {
|
50 |
+
$clone.each( function () {
|
|
|
|
|
51 |
select.selectAllNone( $( this ) );
|
52 |
} );
|
53 |
}
|
54 |
+
else {
|
|
|
55 |
select.selectAllNone( $input );
|
56 |
}
|
57 |
}
|
62 |
*
|
63 |
* @return void
|
64 |
*/
|
65 |
+
function update() {
|
|
|
66 |
select.bindEvents( $( this ) );
|
67 |
}
|
68 |
|
js/slider.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
-
jQuery( function( $ )
|
2 |
-
|
3 |
-
'use strict';
|
4 |
|
5 |
-
function rwmb_update_slider()
|
6 |
-
{
|
7 |
var $input = $( this ),
|
8 |
$slider = $input.siblings( '.rwmb-slider' ),
|
9 |
$valueLabel = $slider.siblings( '.rwmb-slider-value-label' ).find( 'span' ),
|
@@ -13,21 +11,18 @@ jQuery( function( $ )
|
|
13 |
|
14 |
$slider.html( '' );
|
15 |
|
16 |
-
if ( !value )
|
17 |
-
{
|
18 |
value = 0;
|
19 |
$input.val( 0 );
|
20 |
$valueLabel.text( '0' );
|
21 |
}
|
22 |
-
else
|
23 |
-
{
|
24 |
$valueLabel.text( value );
|
25 |
}
|
26 |
|
27 |
// Assign field value and callback function when slide
|
28 |
options.value = value;
|
29 |
-
options.slide = function( event, ui )
|
30 |
-
{
|
31 |
$input.val( ui.value );
|
32 |
$valueLabel.text( ui.value );
|
33 |
};
|
1 |
+
jQuery( function ( $ ) {
|
2 |
+
'use strict';
|
|
|
3 |
|
4 |
+
function rwmb_update_slider() {
|
|
|
5 |
var $input = $( this ),
|
6 |
$slider = $input.siblings( '.rwmb-slider' ),
|
7 |
$valueLabel = $slider.siblings( '.rwmb-slider-value-label' ).find( 'span' ),
|
11 |
|
12 |
$slider.html( '' );
|
13 |
|
14 |
+
if ( ! value ) {
|
|
|
15 |
value = 0;
|
16 |
$input.val( 0 );
|
17 |
$valueLabel.text( '0' );
|
18 |
}
|
19 |
+
else {
|
|
|
20 |
$valueLabel.text( value );
|
21 |
}
|
22 |
|
23 |
// Assign field value and callback function when slide
|
24 |
options.value = value;
|
25 |
+
options.slide = function ( event, ui ) {
|
|
|
26 |
$input.val( ui.value );
|
27 |
$valueLabel.text( ui.value );
|
28 |
};
|
js/thickbox-image.js
CHANGED
@@ -1,17 +1,14 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
-
$( 'body' ).on( 'click', '.rwmb-thickbox-upload', function ()
|
6 |
-
{
|
7 |
var $this = $( this ),
|
8 |
$holder = $this.siblings( '.rwmb-images' ),
|
9 |
post_id = $( '#post_ID' ).val(),
|
10 |
field_id = $this.data( 'field_id' ),
|
11 |
backup = window.send_to_editor;
|
12 |
|
13 |
-
window.send_to_editor = function ( html )
|
14 |
-
{
|
15 |
var $img = $( '<div />' ).append( html ).find( 'img' ),
|
16 |
url = $img.attr( 'src' ),
|
17 |
img_class = $img.attr( 'class' ),
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
+
$( 'body' ).on( 'click', '.rwmb-thickbox-upload', function () {
|
|
|
5 |
var $this = $( this ),
|
6 |
$holder = $this.siblings( '.rwmb-images' ),
|
7 |
post_id = $( '#post_ID' ).val(),
|
8 |
field_id = $this.data( 'field_id' ),
|
9 |
backup = window.send_to_editor;
|
10 |
|
11 |
+
window.send_to_editor = function ( html ) {
|
|
|
12 |
var $img = $( '<div />' ).append( html ).find( 'img' ),
|
13 |
url = $img.attr( 'src' ),
|
14 |
img_class = $img.attr( 'class' ),
|
js/time.js
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
/**
|
6 |
* Update datetime picker element
|
7 |
* Used for static & dynamic added elements (when clone)
|
8 |
*/
|
9 |
-
function update()
|
10 |
-
{
|
11 |
var $this = $( this ),
|
12 |
options = $this.data( 'options' ),
|
13 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
@@ -15,8 +13,7 @@ jQuery( function ( $ )
|
|
15 |
|
16 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
17 |
|
18 |
-
if( $inline.length )
|
19 |
-
{
|
20 |
options.altField = '#' + $this.attr( 'id' );
|
21 |
$inline
|
22 |
.removeClass( 'hasDatepicker' )
|
@@ -25,20 +22,17 @@ jQuery( function ( $ )
|
|
25 |
.timepicker( options )
|
26 |
.timepicker( "setTime", current );
|
27 |
}
|
28 |
-
else
|
29 |
-
{
|
30 |
$this.removeClass( 'hasDatepicker' ).timepicker( options );
|
31 |
}
|
32 |
}
|
33 |
|
34 |
// Set language if available
|
35 |
-
$.timepicker.setDefaults( $.timepicker.regional[
|
36 |
-
if ( $.timepicker.regional.hasOwnProperty( RWMB_Time.locale ) )
|
37 |
-
{
|
38 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Time.locale] );
|
39 |
}
|
40 |
-
else if ( $.timepicker.regional.hasOwnProperty( RWMB_Time.localeShort ) )
|
41 |
-
{
|
42 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Time.localeShort] );
|
43 |
}
|
44 |
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
/**
|
5 |
* Update datetime picker element
|
6 |
* Used for static & dynamic added elements (when clone)
|
7 |
*/
|
8 |
+
function update() {
|
|
|
9 |
var $this = $( this ),
|
10 |
options = $this.data( 'options' ),
|
11 |
$inline = $this.siblings( '.rwmb-datetime-inline' ),
|
13 |
|
14 |
$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
|
15 |
|
16 |
+
if ( $inline.length ) {
|
|
|
17 |
options.altField = '#' + $this.attr( 'id' );
|
18 |
$inline
|
19 |
.removeClass( 'hasDatepicker' )
|
22 |
.timepicker( options )
|
23 |
.timepicker( "setTime", current );
|
24 |
}
|
25 |
+
else {
|
|
|
26 |
$this.removeClass( 'hasDatepicker' ).timepicker( options );
|
27 |
}
|
28 |
}
|
29 |
|
30 |
// Set language if available
|
31 |
+
$.timepicker.setDefaults( $.timepicker.regional[""] );
|
32 |
+
if ( $.timepicker.regional.hasOwnProperty( RWMB_Time.locale ) ) {
|
|
|
33 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Time.locale] );
|
34 |
}
|
35 |
+
else if ( $.timepicker.regional.hasOwnProperty( RWMB_Time.localeShort ) ) {
|
|
|
36 |
$.timepicker.setDefaults( $.timepicker.regional[RWMB_Time.localeShort] );
|
37 |
}
|
38 |
|
js/validate.js
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
jQuery( function ( $ )
|
2 |
-
{
|
3 |
'use strict';
|
4 |
|
5 |
var $form = $( '#post' ),
|
6 |
rules = {
|
7 |
-
invalidHandler: function ()
|
8 |
-
{
|
9 |
// Re-enable the submit ( publish/update ) button and hide the ajax indicator
|
10 |
$( '#publish' ).removeClass( 'button-primary-disabled' );
|
11 |
$( '#ajax-loading' ).attr( 'style', '' );
|
@@ -16,16 +14,13 @@ jQuery( function ( $ )
|
|
16 |
};
|
17 |
|
18 |
// Gather all validation rules
|
19 |
-
$( '.rwmb-validation-rules' ).each( function ()
|
20 |
-
{
|
21 |
var subRules = $( this ).data( 'rules' );
|
22 |
$.extend( true, rules, subRules );
|
23 |
|
24 |
// Required field styling
|
25 |
-
$.each( subRules.rules, function ( k, v )
|
26 |
-
|
27 |
-
if ( v['required'] )
|
28 |
-
{
|
29 |
$( '#' + k ).parent().siblings( '.rwmb-label' ).addClass( 'required' ).append( '<span>*</span>' );
|
30 |
}
|
31 |
} );
|
1 |
+
jQuery( function ( $ ) {
|
|
|
2 |
'use strict';
|
3 |
|
4 |
var $form = $( '#post' ),
|
5 |
rules = {
|
6 |
+
invalidHandler: function () {
|
|
|
7 |
// Re-enable the submit ( publish/update ) button and hide the ajax indicator
|
8 |
$( '#publish' ).removeClass( 'button-primary-disabled' );
|
9 |
$( '#ajax-loading' ).attr( 'style', '' );
|
14 |
};
|
15 |
|
16 |
// Gather all validation rules
|
17 |
+
$( '.rwmb-validation-rules' ).each( function () {
|
|
|
18 |
var subRules = $( this ).data( 'rules' );
|
19 |
$.extend( true, rules, subRules );
|
20 |
|
21 |
// Required field styling
|
22 |
+
$.each( subRules.rules, function ( k, v ) {
|
23 |
+
if ( v['required'] ) {
|
|
|
|
|
24 |
$( '#' + k ).parent().siblings( '.rwmb-label' ).addClass( 'required' ).append( '<span>*</span>' );
|
25 |
}
|
26 |
} );
|
js/wysiwyg.js
CHANGED
@@ -1,29 +1,25 @@
|
|
1 |
/* global tinymce, quicktags */
|
2 |
|
3 |
-
jQuery( function ( $ )
|
4 |
-
{
|
5 |
'use strict';
|
6 |
|
7 |
/**
|
8 |
* Update date picker element
|
9 |
* Used for static & dynamic added elements (when clone)
|
10 |
*/
|
11 |
-
function update()
|
12 |
-
{
|
13 |
var $this = $( this ),
|
14 |
$wrapper = $this.closest( '.wp-editor-wrap' ),
|
15 |
id = $this.attr( 'id' );
|
16 |
|
17 |
// Ignore existing editor.
|
18 |
-
if ( tinyMCEPreInit.mceInit[id] )
|
19 |
-
{
|
20 |
return;
|
21 |
}
|
22 |
|
23 |
// Get id of the original editor to get its tinyMCE and quick tags settings
|
24 |
var originalId = getOriginalId( $this );
|
25 |
-
if ( !originalId )
|
26 |
-
{
|
27 |
return;
|
28 |
}
|
29 |
|
@@ -37,8 +33,7 @@ jQuery( function ( $ )
|
|
37 |
tinymce.init( settings );
|
38 |
|
39 |
// Quick tags
|
40 |
-
if ( typeof quicktags === 'function' && tinyMCEPreInit.qtInit.hasOwnProperty( originalId ) )
|
41 |
-
{
|
42 |
var qtSettings = tinyMCEPreInit.qtInit[originalId];
|
43 |
qtSettings.id = id;
|
44 |
quicktags( qtSettings );
|
@@ -51,19 +46,15 @@ jQuery( function ( $ )
|
|
51 |
* The ID will be used to reference to tinyMCE and quick tags settings
|
52 |
* @param $el Current cloned textarea
|
53 |
*/
|
54 |
-
function getOriginalId( $el )
|
55 |
-
{
|
56 |
var $clones = $el.closest( '.rwmb-clone' ).siblings( '.rwmb-clone' ),
|
57 |
id = '';
|
58 |
-
$clones.each( function ()
|
59 |
-
{
|
60 |
var currentId = $( this ).find( '.rwmb-wysiwyg' ).attr( 'id' );
|
61 |
-
if ( /_\d+$/.test( currentId ) )
|
62 |
-
{
|
63 |
currentId = currentId.replace( /_\d+$/, '' );
|
64 |
}
|
65 |
-
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) )
|
66 |
-
{
|
67 |
id = currentId;
|
68 |
return false; // Immediately stop the .each() loop
|
69 |
}
|
@@ -76,27 +67,26 @@ jQuery( function ( $ )
|
|
76 |
* @param $wrapper Editor wrapper element
|
77 |
* @param id Editor ID
|
78 |
*/
|
79 |
-
function updateDom( $wrapper, id )
|
80 |
-
{
|
81 |
// Wrapper div and media buttons
|
82 |
$wrapper.attr( 'id', 'wp-' + id + '-wrap' )
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
// Editor tabs
|
90 |
$wrapper.find( '.switch-tmce' )
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
// Quick tags
|
98 |
$wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
|
99 |
-
|
100 |
}
|
101 |
|
102 |
$( ':input.rwmb-wysiwyg' ).each( update );
|
1 |
/* global tinymce, quicktags */
|
2 |
|
3 |
+
jQuery( function ( $ ) {
|
|
|
4 |
'use strict';
|
5 |
|
6 |
/**
|
7 |
* Update date picker element
|
8 |
* Used for static & dynamic added elements (when clone)
|
9 |
*/
|
10 |
+
function update() {
|
|
|
11 |
var $this = $( this ),
|
12 |
$wrapper = $this.closest( '.wp-editor-wrap' ),
|
13 |
id = $this.attr( 'id' );
|
14 |
|
15 |
// Ignore existing editor.
|
16 |
+
if ( tinyMCEPreInit.mceInit[id] ) {
|
|
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
// Get id of the original editor to get its tinyMCE and quick tags settings
|
21 |
var originalId = getOriginalId( $this );
|
22 |
+
if ( ! originalId ) {
|
|
|
23 |
return;
|
24 |
}
|
25 |
|
33 |
tinymce.init( settings );
|
34 |
|
35 |
// Quick tags
|
36 |
+
if ( typeof quicktags === 'function' && tinyMCEPreInit.qtInit.hasOwnProperty( originalId ) ) {
|
|
|
37 |
var qtSettings = tinyMCEPreInit.qtInit[originalId];
|
38 |
qtSettings.id = id;
|
39 |
quicktags( qtSettings );
|
46 |
* The ID will be used to reference to tinyMCE and quick tags settings
|
47 |
* @param $el Current cloned textarea
|
48 |
*/
|
49 |
+
function getOriginalId( $el ) {
|
|
|
50 |
var $clones = $el.closest( '.rwmb-clone' ).siblings( '.rwmb-clone' ),
|
51 |
id = '';
|
52 |
+
$clones.each( function () {
|
|
|
53 |
var currentId = $( this ).find( '.rwmb-wysiwyg' ).attr( 'id' );
|
54 |
+
if ( /_\d+$/.test( currentId ) ) {
|
|
|
55 |
currentId = currentId.replace( /_\d+$/, '' );
|
56 |
}
|
57 |
+
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) ) {
|
|
|
58 |
id = currentId;
|
59 |
return false; // Immediately stop the .each() loop
|
60 |
}
|
67 |
* @param $wrapper Editor wrapper element
|
68 |
* @param id Editor ID
|
69 |
*/
|
70 |
+
function updateDom( $wrapper, id ) {
|
|
|
71 |
// Wrapper div and media buttons
|
72 |
$wrapper.attr( 'id', 'wp-' + id + '-wrap' )
|
73 |
+
.removeClass( 'html-active' ).addClass( 'mce-active' ) // Active the visual mode by default
|
74 |
+
.find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
|
75 |
+
.find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
|
76 |
+
.find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
|
77 |
+
.find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
|
78 |
|
79 |
// Editor tabs
|
80 |
$wrapper.find( '.switch-tmce' )
|
81 |
+
.attr( 'id', id + 'tmce' )
|
82 |
+
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
|
83 |
+
.find( '.switch-html' )
|
84 |
+
.attr( 'id', id + 'html' )
|
85 |
+
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
|
86 |
|
87 |
// Quick tags
|
88 |
$wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
|
89 |
+
.find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
|
90 |
}
|
91 |
|
92 |
$( ':input.rwmb-wysiwyg' ).each( update );
|
languages/default.pot
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# <!=Copyright (C) 2014 Rilwis
|
2 |
+
# This file is distributed under the GPL2+.=!>
|
3 |
+
#, fuzzy
|
4 |
+
msgid ""
|
5 |
+
msgstr ""
|
6 |
+
"Project-Id-Version: Meta Box 4.8.7\n"
|
7 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/meta-box\n"
|
8 |
+
"POT-Creation-Date: 2016-06-03 15:10+0700\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
+
"Language-Team: Meta Box <admin@metabox.io>\n"
|
15 |
+
"X-Generator: Poedit 1.8.8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_x;_e;_ex;_n;_nx;esc_attr__;esc_attr_e;esc_attr_x;esc_html__;esc_html_e;esc_html_x;_n_noop;_nx_noop\n"
|
17 |
+
"X-Poedit-Basepath: ..\n"
|
18 |
+
"X-Poedit-SearchPath-0: .\n"
|
19 |
+
"X-Poedit-SearchPathExcluded-0: js\n"
|
20 |
+
"X-Poedit-SearchPathExcluded-1: demo\n"
|
21 |
+
"X-Poedit-SearchPathExcluded-2: tests\n"
|
22 |
+
"X-Poedit-SearchPathExcluded-3: css\n"
|
23 |
+
"X-Poedit-SearchPathExcluded-4: lang\n"
|
24 |
+
|
25 |
+
#: inc/core.php:40
|
26 |
+
msgid "Documentation"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: inc/core.php:41
|
30 |
+
msgid "Extensions"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: inc/field.php:192
|
34 |
+
msgid "+ Add more"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: inc/fields/autocomplete.php:23 inc/fields/autocomplete.php:87
|
38 |
+
#: inc/fields/autocomplete.php:104 inc/fields/file.php:162
|
39 |
+
msgid "Delete"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: inc/fields/button.php:29
|
43 |
+
msgid "Click me"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: inc/fields/checkbox.php:82
|
47 |
+
msgid "Yes"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: inc/fields/checkbox.php:82
|
51 |
+
msgid "No"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: inc/fields/file-input.php:25
|
55 |
+
msgid "Select File"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: inc/fields/file-input.php:49 inc/fields/select.php:91
|
59 |
+
msgid "Select"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: inc/fields/file-input.php:51 inc/fields/media.php:28
|
63 |
+
msgid "Remove"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: inc/fields/file.php:24
|
67 |
+
#, php-format
|
68 |
+
msgid "You may only upload maximum %d file"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: inc/fields/file.php:25
|
72 |
+
#, php-format
|
73 |
+
msgid "You may only upload maximum %d files"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: inc/fields/file.php:85
|
77 |
+
msgid "Error: Cannot delete file"
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: inc/fields/file.php:98
|
81 |
+
msgid "Upload Files"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: inc/fields/file.php:99
|
85 |
+
msgid "+ Add new file"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: inc/fields/file.php:163 inc/fields/media.php:29
|
89 |
+
msgid "Edit"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: inc/fields/key-value.php:20
|
93 |
+
msgid "Key"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: inc/fields/key-value.php:26
|
97 |
+
msgid "Value"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: inc/fields/map.php:49
|
101 |
+
msgid "Find Address"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: inc/fields/media.php:25
|
105 |
+
msgid "+ Add Media"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: inc/fields/media.php:26
|
109 |
+
msgid " file"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: inc/fields/media.php:27
|
113 |
+
msgid " files"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: inc/fields/media.php:30
|
117 |
+
msgid "View"
|
118 |
+
msgstr ""
|
119 |
+
|
120 |
+
#: inc/fields/media.php:31
|
121 |
+
msgid "No Title"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: inc/fields/media.php:34
|
125 |
+
msgid "Select Files"
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: inc/fields/media.php:35
|
129 |
+
msgid "or"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: inc/fields/media.php:36
|
133 |
+
msgid "Drop files here to upload"
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
#: inc/fields/oembed.php:65
|
137 |
+
msgid "Embed HTML not available."
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: inc/fields/oembed.php:81
|
141 |
+
msgid "Preview"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: inc/fields/post.php:34
|
145 |
+
msgid "Select a post"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: inc/fields/post.php:38 inc/fields/taxonomy.php:51
|
149 |
+
#, php-format
|
150 |
+
msgid "Select a %s"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: inc/fields/select-advanced.php:44
|
154 |
+
msgid "Select an item"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: inc/fields/select.php:91
|
158 |
+
msgid "All"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: inc/fields/select.php:91
|
162 |
+
msgid "None"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: inc/fields/taxonomy.php:47
|
166 |
+
msgid "Select a term"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: inc/fields/thickbox-image.php:53
|
170 |
+
msgid "Upload Images"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: inc/fields/user.php:34
|
174 |
+
msgid "Select an user"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: inc/validation.php:49
|
178 |
+
msgid "Please correct the errors highlighted below and try again."
|
179 |
+
msgstr ""
|
{lang → languages}/meta-box-ar.mo
RENAMED
File without changes
|
languages/meta-box-ar.po
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-06-03 15:09+0700\n"
|
6 |
+
"PO-Revision-Date: 2012-12-29 23:40-0500\n"
|
7 |
+
"Last-Translator: Adel Qalieh <aqalieh95@gmail.com>\n"
|
8 |
+
"Language-Team: Adel Qalieh <aqalieh95@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
|
13 |
+
"_nx_noop:1,2\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"Plural-Forms: nplurals=6; plural= n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
|
17 |
+
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
|
18 |
+
"X-Language: ar\n"
|
19 |
+
"X-Source-Language: en\n"
|
20 |
+
"Language: ar\n"
|
21 |
+
"X-Poedit-SearchPath-0: ..\n"
|
22 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
23 |
+
|
24 |
+
#: ../meta-box.php:79
|
25 |
+
msgid "RW_Meta_Box Debug:"
|
26 |
+
msgstr "RW_Meta_Box Debug:"
|
27 |
+
|
28 |
+
#: ../inc/classes/meta-box.php:316
|
29 |
+
msgid "+"
|
30 |
+
msgstr "+"
|
31 |
+
|
32 |
+
#: ../inc/classes/meta-box.php:340
|
33 |
+
msgid "–"
|
34 |
+
msgstr "–"
|
35 |
+
|
36 |
+
#: ../inc/fields/file.php:69
|
37 |
+
msgid "Error: Cannot delete file"
|
38 |
+
msgstr "خطأ: لا يمكن حذف الملف"
|
39 |
+
|
40 |
+
#: ../inc/fields/file.php:83
|
41 |
+
msgctxt "file upload"
|
42 |
+
msgid "Uploaded files"
|
43 |
+
msgstr "ملفات محملة"
|
44 |
+
|
45 |
+
#: ../inc/fields/file.php:84
|
46 |
+
msgctxt "file upload"
|
47 |
+
msgid "Delete this file"
|
48 |
+
msgstr "حذف هذا الملف"
|
49 |
+
|
50 |
+
#: ../inc/fields/file.php:85
|
51 |
+
msgctxt "file upload"
|
52 |
+
msgid "Delete"
|
53 |
+
msgstr "حذف"
|
54 |
+
|
55 |
+
#: ../inc/fields/file.php:86
|
56 |
+
msgctxt "file upload"
|
57 |
+
msgid "Upload files"
|
58 |
+
msgstr "تحميل الملفات"
|
59 |
+
|
60 |
+
#: ../inc/fields/file.php:87
|
61 |
+
msgctxt "file upload"
|
62 |
+
msgid "+ Add new file"
|
63 |
+
msgstr "+ إضافة ملف جديد"
|
64 |
+
|
65 |
+
#: ../inc/fields/image.php:75
|
66 |
+
msgid "Order saved"
|
67 |
+
msgstr "حفظ الترتيب"
|
68 |
+
|
69 |
+
#: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
|
70 |
+
msgctxt "image upload"
|
71 |
+
msgid "Uploaded files"
|
72 |
+
msgstr "ملفات محملة"
|
73 |
+
|
74 |
+
#: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
|
75 |
+
msgctxt "image upload"
|
76 |
+
msgid "Delete this file"
|
77 |
+
msgstr "حذف هذا الملف"
|
78 |
+
|
79 |
+
#: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
|
80 |
+
msgctxt "image upload"
|
81 |
+
msgid "Delete"
|
82 |
+
msgstr "حذف"
|
83 |
+
|
84 |
+
#: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
|
85 |
+
msgctxt "image upload"
|
86 |
+
msgid "Edit"
|
87 |
+
msgstr "حرر"
|
88 |
+
|
89 |
+
#: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
|
90 |
+
msgctxt "image upload"
|
91 |
+
msgid "Upload files"
|
92 |
+
msgstr "تحميل الملفات"
|
93 |
+
|
94 |
+
#: ../inc/fields/image.php:96
|
95 |
+
msgctxt "image upload"
|
96 |
+
msgid "+ Add new image"
|
97 |
+
msgstr "إضافة صورة جديدة"
|
98 |
+
|
99 |
+
#: ../inc/fields/plupload-image.php:95
|
100 |
+
msgctxt "image upload"
|
101 |
+
msgid "Allowed Image Files"
|
102 |
+
msgstr "أنواع الصور المسموحة"
|
103 |
+
|
104 |
+
#: ../inc/fields/plupload-image.php:160
|
105 |
+
msgctxt "image upload"
|
106 |
+
msgid "Drop images here"
|
107 |
+
msgstr "إفلت الصور هنا"
|
108 |
+
|
109 |
+
#: ../inc/fields/plupload-image.php:161
|
110 |
+
msgctxt "image upload"
|
111 |
+
msgid "or"
|
112 |
+
msgstr "أو"
|
113 |
+
|
114 |
+
#: ../inc/fields/plupload-image.php:162
|
115 |
+
msgctxt "image upload"
|
116 |
+
msgid "Select Files"
|
117 |
+
msgstr "إختر الملفات"
|
118 |
+
|
119 |
+
#: ../inc/fields/thickbox-image.php:45
|
120 |
+
msgctxt "image upload"
|
121 |
+
msgid "Upload image"
|
122 |
+
msgstr "حمل الصورة"
|
{lang → languages}/meta-box-de_DE.mo
RENAMED
File without changes
|
languages/meta-box-de_DE.po
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-03-23 22:08+0100\n"
|
6 |
+
"PO-Revision-Date: 2013-03-23 22:21+0100\n"
|
7 |
+
"Last-Translator: Johann Kratzik <johann@kratzik.com>\n"
|
8 |
+
"Language-Team: Johann Kratzik <info@zoomdrive.at>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: German\n"
|
15 |
+
"X-Poedit-Country: AUSTRIA\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
19 |
+
|
20 |
+
#: ../inc/classes/meta-box.php:296
|
21 |
+
msgid "Please correct the errors highlighted below and try again."
|
22 |
+
msgstr "Bitte beheben Sie die unten angeführten Fehler und versuchen Sie es erneut."
|
23 |
+
|
24 |
+
#: ../inc/classes/meta-box.php:357
|
25 |
+
msgid "+"
|
26 |
+
msgstr "+"
|
27 |
+
|
28 |
+
#: ../inc/classes/meta-box.php:379
|
29 |
+
msgid "–"
|
30 |
+
msgstr "–"
|
31 |
+
|
32 |
+
#: ../inc/fields/file-advanced.php:59
|
33 |
+
msgctxt "file upload"
|
34 |
+
msgid "Select Files"
|
35 |
+
msgstr "Dateien auswählen"
|
36 |
+
|
37 |
+
#: ../inc/fields/file.php:66
|
38 |
+
msgid "Error: Cannot delete file"
|
39 |
+
msgstr "Fehler: Datei kann nicht gelöscht werden"
|
40 |
+
|
41 |
+
#: ../inc/fields/file.php:80
|
42 |
+
msgctxt "file upload"
|
43 |
+
msgid "Upload Files"
|
44 |
+
msgstr "Dateien hochladen"
|
45 |
+
|
46 |
+
#: ../inc/fields/file.php:81
|
47 |
+
msgctxt "file upload"
|
48 |
+
msgid "+ Add new file"
|
49 |
+
msgstr "+ Neue Datei hinzufügen"
|
50 |
+
|
51 |
+
#: ../inc/fields/file.php:133
|
52 |
+
msgctxt "file upload"
|
53 |
+
msgid "Delete"
|
54 |
+
msgstr "Löschen"
|
55 |
+
|
56 |
+
#: ../inc/fields/file.php:134
|
57 |
+
msgctxt "file upload"
|
58 |
+
msgid "Edit"
|
59 |
+
msgstr "Bearbeiten"
|
60 |
+
|
61 |
+
#: ../inc/fields/image-advanced.php:63
|
62 |
+
msgctxt "image upload"
|
63 |
+
msgid "Select or Upload Images"
|
64 |
+
msgstr "Bilder auswählen oder hochladen"
|
65 |
+
|
66 |
+
#: ../inc/fields/image.php:64
|
67 |
+
msgid "Order saved"
|
68 |
+
msgstr "Reihenfolge gespeichert"
|
69 |
+
|
70 |
+
#: ../inc/fields/image.php:78
|
71 |
+
msgctxt "image upload"
|
72 |
+
msgid "Upload Images"
|
73 |
+
msgstr "Bilder hochladen"
|
74 |
+
|
75 |
+
#: ../inc/fields/image.php:79
|
76 |
+
msgctxt "image upload"
|
77 |
+
msgid "+ Add new image"
|
78 |
+
msgstr "+ Neues Bild hinzufügen"
|
79 |
+
|
80 |
+
#: ../inc/fields/image.php:144
|
81 |
+
msgctxt "image upload"
|
82 |
+
msgid "Delete"
|
83 |
+
msgstr "Löschen"
|
84 |
+
|
85 |
+
#: ../inc/fields/image.php:145
|
86 |
+
msgctxt "image upload"
|
87 |
+
msgid "Edit"
|
88 |
+
msgstr "Bearbeiten"
|
89 |
+
|
90 |
+
#: ../inc/fields/map.php:46
|
91 |
+
msgid "Find Address"
|
92 |
+
msgstr "Adresse finden"
|
93 |
+
|
94 |
+
#: ../inc/fields/plupload-image.php:104
|
95 |
+
msgctxt "image upload"
|
96 |
+
msgid "Drop images here"
|
97 |
+
msgstr "Bilder hierher ziehen"
|
98 |
+
|
99 |
+
#: ../inc/fields/plupload-image.php:105
|
100 |
+
msgctxt "image upload"
|
101 |
+
msgid "or"
|
102 |
+
msgstr "oder"
|
103 |
+
|
104 |
+
#: ../inc/fields/plupload-image.php:106
|
105 |
+
msgctxt "image upload"
|
106 |
+
msgid "Select Files"
|
107 |
+
msgstr "Dateien auswählen"
|
108 |
+
|
109 |
+
#: ../inc/fields/plupload-image.php:181
|
110 |
+
msgctxt "image upload"
|
111 |
+
msgid "Allowed Image Files"
|
112 |
+
msgstr "Erlaubte Typen von Bilddateien"
|
113 |
+
|
114 |
+
#: ../inc/fields/posts.php:54
|
115 |
+
msgid "Post"
|
116 |
+
msgstr "Beitrag"
|
117 |
+
|
118 |
+
#: ../inc/fields/posts.php:64
|
119 |
+
#: ../inc/fields/taxonomy.php:42
|
120 |
+
#, php-format
|
121 |
+
msgid "Select a %s"
|
122 |
+
msgstr "%s auswählen"
|
123 |
+
|
124 |
+
#: ../inc/fields/select-advanced.php:69
|
125 |
+
msgid "Select a value"
|
126 |
+
msgstr "Einen Wert wählen"
|
127 |
+
|
128 |
+
#, fuzzy
|
129 |
+
#~ msgctxt "file upload"
|
130 |
+
|
131 |
+
#~ msgid "Uploaded files"
|
132 |
+
#~ msgstr "Dateien fertig geladen"
|
133 |
+
#~ msgctxt "file upload"
|
134 |
+
|
135 |
+
#~ msgid "Delete this file"
|
136 |
+
#~ msgstr "Datei löschen"
|
137 |
+
|
138 |
+
#, fuzzy
|
139 |
+
#~ msgctxt "image upload"
|
140 |
+
|
141 |
+
#~ msgid "Uploaded files"
|
142 |
+
#~ msgstr "Dateien fertig geladen"
|
143 |
+
#~ msgctxt "image upload"
|
144 |
+
|
145 |
+
#~ msgid "Delete this file"
|
146 |
+
#~ msgstr "Datei löschen"
|
147 |
+
#~ msgctxt "image upload"
|
148 |
+
|
149 |
+
#~ msgid "Upload files"
|
150 |
+
#~ msgstr "Dateien hochladen"
|
151 |
+
#~ msgctxt "image upload"
|
152 |
+
|
153 |
+
#~ msgid "Add another file"
|
154 |
+
#~ msgstr "Weitere Datei"
|
155 |
+
|
156 |
+
#~ msgid "Cannot delete file. Something's wrong."
|
157 |
+
#~ msgstr "Fehler: Datei kann nicht gelöscht werden."
|
158 |
+
|
159 |
+
#~ msgid "Upload new files"
|
160 |
+
#~ msgstr "Neue Dateien hochladen"
|
{lang → languages}/meta-box-fa_IR.mo
RENAMED
File without changes
|
languages/meta-box-fa_IR.po
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box\n"
|
4 |
+
"POT-Creation-Date: 2016-03-27 19:26+0430\n"
|
5 |
+
"PO-Revision-Date: 2016-03-27 19:34+0430\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: Sam Najian <samnajian@gmail.com>\n"
|
8 |
+
"Language: fa\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
13 |
+
"X-Generator: Poedit 1.8.7\n"
|
14 |
+
"X-Poedit-Basepath: ../../meta-box-builder\n"
|
15 |
+
"X-Poedit-WPHeader: meta-box.php\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
18 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
|
19 |
+
"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Poedit-SearchPath-1: .\n"
|
22 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
23 |
+
|
24 |
+
#: inc/core.php:40
|
25 |
+
msgid "Documentation"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: inc/core.php:41
|
29 |
+
msgid "Extensions"
|
30 |
+
msgstr "افزونه ها"
|
31 |
+
|
32 |
+
#: inc/field.php:196
|
33 |
+
msgid "+ Add more"
|
34 |
+
msgstr "افزودن +"
|
35 |
+
|
36 |
+
#: inc/fields/autocomplete.php:14 inc/fields/autocomplete.php:75
|
37 |
+
#: inc/fields/autocomplete.php:92
|
38 |
+
msgid "Delete"
|
39 |
+
msgstr "حذف"
|
40 |
+
|
41 |
+
#: inc/fields/button.php:29
|
42 |
+
msgid "Click me"
|
43 |
+
msgstr "کلیک"
|
44 |
+
|
45 |
+
#: inc/fields/checkbox.php:85
|
46 |
+
msgid "Yes"
|
47 |
+
msgstr "بله"
|
48 |
+
|
49 |
+
#: inc/fields/checkbox.php:85
|
50 |
+
msgid "No"
|
51 |
+
msgstr "خیر"
|
52 |
+
|
53 |
+
#: inc/fields/file-input.php:18
|
54 |
+
msgid "Select File"
|
55 |
+
msgstr "انتخاب فایل"
|
56 |
+
|
57 |
+
#: inc/fields/file-input.php:41 inc/fields/select.php:91
|
58 |
+
msgid "Select"
|
59 |
+
msgstr "انتخاب"
|
60 |
+
|
61 |
+
#: inc/fields/file-input.php:43
|
62 |
+
msgid "Remove"
|
63 |
+
msgstr "حذف"
|
64 |
+
|
65 |
+
#: inc/fields/file.php:15
|
66 |
+
#, php-format
|
67 |
+
msgid "You may only upload maximum %d file"
|
68 |
+
msgstr "شما فقط می توانید تعداد %d فایل آپلود نمایید"
|
69 |
+
|
70 |
+
#: inc/fields/file.php:16
|
71 |
+
#, php-format
|
72 |
+
msgid "You may only upload maximum %d files"
|
73 |
+
msgstr "شما فقط می توانید تعداد %d فایل آپلود نمایید"
|
74 |
+
|
75 |
+
#: inc/fields/file.php:83
|
76 |
+
msgid "Error: Cannot delete file"
|
77 |
+
msgstr "خطا در حذف فایل"
|
78 |
+
|
79 |
+
#: inc/fields/file.php:96
|
80 |
+
msgctxt "file upload"
|
81 |
+
msgid "Upload Files"
|
82 |
+
msgstr "آپلود فایل"
|
83 |
+
|
84 |
+
#: inc/fields/file.php:97
|
85 |
+
msgctxt "file upload"
|
86 |
+
msgid "+ Add new file"
|
87 |
+
msgstr "افزودن فایل جدید"
|
88 |
+
|
89 |
+
#: inc/fields/file.php:153
|
90 |
+
msgctxt "file upload"
|
91 |
+
msgid "Delete"
|
92 |
+
msgstr "حذف"
|
93 |
+
|
94 |
+
#: inc/fields/file.php:154
|
95 |
+
msgctxt "file upload"
|
96 |
+
msgid "Edit"
|
97 |
+
msgstr "ویرایش"
|
98 |
+
|
99 |
+
#: inc/fields/image.php:61 inc/fields/thickbox-image.php:53
|
100 |
+
msgctxt "image upload"
|
101 |
+
msgid "Upload Images"
|
102 |
+
msgstr "آپلود تصویر"
|
103 |
+
|
104 |
+
#: inc/fields/image.php:62
|
105 |
+
msgctxt "image upload"
|
106 |
+
msgid "+ Add new image"
|
107 |
+
msgstr "افزودن تصویر جدید + "
|
108 |
+
|
109 |
+
#: inc/fields/image.php:124
|
110 |
+
msgctxt "image upload"
|
111 |
+
msgid "Delete"
|
112 |
+
msgstr "حذف"
|
113 |
+
|
114 |
+
#: inc/fields/image.php:125
|
115 |
+
msgctxt "image upload"
|
116 |
+
msgid "Edit"
|
117 |
+
msgstr "ویرایش"
|
118 |
+
|
119 |
+
#: inc/fields/key-value.php:19
|
120 |
+
msgid "Key"
|
121 |
+
msgstr "کلید"
|
122 |
+
|
123 |
+
#: inc/fields/key-value.php:25
|
124 |
+
msgid "Value"
|
125 |
+
msgstr "مقدار"
|
126 |
+
|
127 |
+
#: inc/fields/map.php:49
|
128 |
+
msgid "Find Address"
|
129 |
+
msgstr "یافتن آدرس"
|
130 |
+
|
131 |
+
#: inc/fields/media.php:18
|
132 |
+
msgctxt "media"
|
133 |
+
msgid "+ Add Media"
|
134 |
+
msgstr "افزودن فایل"
|
135 |
+
|
136 |
+
#: inc/fields/media.php:19
|
137 |
+
msgctxt "media"
|
138 |
+
msgid " file"
|
139 |
+
msgstr "فایل"
|
140 |
+
|
141 |
+
#: inc/fields/media.php:20
|
142 |
+
msgctxt "media"
|
143 |
+
msgid " files"
|
144 |
+
msgstr "فایل"
|
145 |
+
|
146 |
+
#: inc/fields/media.php:21
|
147 |
+
msgctxt "media"
|
148 |
+
msgid "Remove"
|
149 |
+
msgstr "حذف"
|
150 |
+
|
151 |
+
#: inc/fields/media.php:22
|
152 |
+
msgctxt "media"
|
153 |
+
msgid "Edit"
|
154 |
+
msgstr "ویرایش"
|
155 |
+
|
156 |
+
#: inc/fields/media.php:23
|
157 |
+
msgctxt "media"
|
158 |
+
msgid "View"
|
159 |
+
msgstr "نمایش"
|
160 |
+
|
161 |
+
#: inc/fields/media.php:24
|
162 |
+
msgctxt "media"
|
163 |
+
msgid "No Title"
|
164 |
+
msgstr "بدون عنوان"
|
165 |
+
|
166 |
+
#: inc/fields/media.php:27
|
167 |
+
msgctxt "media"
|
168 |
+
msgid "Select Files"
|
169 |
+
msgstr "انتخاب فایل ها"
|
170 |
+
|
171 |
+
#: inc/fields/media.php:28
|
172 |
+
msgctxt "media"
|
173 |
+
msgid "Drop files here to upload"
|
174 |
+
msgstr "برای آپلود فایل آن را به اینجا بکشید"
|
175 |
+
|
176 |
+
#: inc/fields/oembed.php:65
|
177 |
+
msgid "Embed HTML not available."
|
178 |
+
msgstr "HTML امبد شده در دسترس نیست"
|
179 |
+
|
180 |
+
#: inc/fields/oembed.php:84
|
181 |
+
msgid "Preview"
|
182 |
+
msgstr "پیش نمایش"
|
183 |
+
|
184 |
+
#: inc/fields/post.php:35
|
185 |
+
msgid "Select a post"
|
186 |
+
msgstr "انتخاب یک پست"
|
187 |
+
|
188 |
+
#: inc/fields/post.php:39 inc/fields/taxonomy.php:51
|
189 |
+
#, php-format
|
190 |
+
msgid "Select a %s"
|
191 |
+
msgstr "انتخاب یک %s"
|
192 |
+
|
193 |
+
#: inc/fields/select.php:91
|
194 |
+
msgid "All"
|
195 |
+
msgstr "همه"
|
196 |
+
|
197 |
+
#: inc/fields/select.php:91
|
198 |
+
msgid "None"
|
199 |
+
msgstr "هیچ کدام"
|
200 |
+
|
201 |
+
#: inc/fields/taxonomy.php:47
|
202 |
+
msgid "Select a term"
|
203 |
+
msgstr "انتخاب ترم"
|
204 |
+
|
205 |
+
#: inc/fields/user.php:34
|
206 |
+
msgid "Select an user"
|
207 |
+
msgstr "انتخاب کاربر"
|
208 |
+
|
209 |
+
#: inc/validation.php:42
|
210 |
+
msgid "Please correct the errors highlighted below and try again."
|
211 |
+
msgstr "لطفا خطاهای زیر را تصحیح نمایید و دوباره تلاش کنید"
|
212 |
+
|
213 |
+
#. Plugin Name of the plugin/theme
|
214 |
+
msgid "Meta Box"
|
215 |
+
msgstr "جعبه متا"
|
216 |
+
|
217 |
+
#. Plugin URI of the plugin/theme
|
218 |
+
msgid "https://metabox.io"
|
219 |
+
msgstr "http://samnajian.com"
|
220 |
+
|
221 |
+
#. Description of the plugin/theme
|
222 |
+
msgid ""
|
223 |
+
"Create custom meta boxes and custom fields for any post type in WordPress."
|
224 |
+
msgstr "ایجاد متاباکس و فیلد دلخواه برای هر نوع پست "
|
225 |
+
|
226 |
+
#. Author of the plugin/theme
|
227 |
+
msgid "Rilwis"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#. Author URI of the plugin/theme
|
231 |
+
msgid "http://www.deluxeblogtips.com"
|
232 |
+
msgstr ""
|
{lang → languages}/meta-box-fr_FR.mo
RENAMED
File without changes
|
languages/meta-box-fr_FR.po
ADDED
@@ -0,0 +1,456 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box\n"
|
4 |
+
"POT-Creation-Date: 2015-02-27 16:16+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-02-28 09:09+0100\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: Frédéric Serva <fred.serva@gmail.com>\n"
|
8 |
+
"Language: fr\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.7.4\n"
|
13 |
+
"X-Poedit-Basepath: ..\n"
|
14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
16 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
|
17 |
+
"_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
18 |
+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
21 |
+
|
22 |
+
#: demo/all-custom-post-types.php:15
|
23 |
+
msgid "Personal Information"
|
24 |
+
msgstr "Informations personnelles"
|
25 |
+
|
26 |
+
#: demo/all-custom-post-types.php:20
|
27 |
+
msgid "Full name"
|
28 |
+
msgstr "Nom et prénom"
|
29 |
+
|
30 |
+
#: demo/better-include.php:16 demo/include-by-ID-or-page-template.php:8
|
31 |
+
msgid "Meta Box Title"
|
32 |
+
msgstr "Titre de la Meta Box"
|
33 |
+
|
34 |
+
#: demo/better-include.php:19 demo/include-by-ID-or-page-template.php:14
|
35 |
+
msgid "Your images"
|
36 |
+
msgstr "Vos images"
|
37 |
+
|
38 |
+
#: demo/date-time-js-options.php:8
|
39 |
+
msgid "Date Time Picker With JS Options"
|
40 |
+
msgstr "Sélecteur Date et Heure avec Options JS"
|
41 |
+
|
42 |
+
#: demo/date-time-js-options.php:12
|
43 |
+
msgid "Date"
|
44 |
+
msgstr "Date"
|
45 |
+
|
46 |
+
#: demo/date-time-js-options.php:18 demo/demo.php:193
|
47 |
+
msgid "(yyyy-mm-dd)"
|
48 |
+
msgstr "(yyyy-mm-dd)"
|
49 |
+
|
50 |
+
#: demo/date-time-js-options.php:20
|
51 |
+
msgid "Select Date"
|
52 |
+
msgstr "Sélectionnez la date"
|
53 |
+
|
54 |
+
#: demo/date-time-js-options.php:21 demo/demo.php:194
|
55 |
+
msgid "yy-mm-dd"
|
56 |
+
msgstr "yy-mm-dd"
|
57 |
+
|
58 |
+
#: demo/date-time-js-options.php:27
|
59 |
+
msgid "Datetime"
|
60 |
+
msgstr "Date & Heure combinées"
|
61 |
+
|
62 |
+
#: demo/date-time-js-options.php:38
|
63 |
+
msgid "Time"
|
64 |
+
msgstr "Heure"
|
65 |
+
|
66 |
+
#: demo/demo.php:42
|
67 |
+
msgid "Standard Fields"
|
68 |
+
msgstr "Champs standards"
|
69 |
+
|
70 |
+
#: demo/demo.php:61
|
71 |
+
msgid "Text"
|
72 |
+
msgstr "Texte"
|
73 |
+
|
74 |
+
#: demo/demo.php:65
|
75 |
+
msgid "Text description"
|
76 |
+
msgstr "Description du texte"
|
77 |
+
|
78 |
+
#: demo/demo.php:68
|
79 |
+
msgid "Default text value"
|
80 |
+
msgstr "Valeur texte par défaut"
|
81 |
+
|
82 |
+
#: demo/demo.php:74
|
83 |
+
msgid "Checkbox"
|
84 |
+
msgstr "Case à cocher"
|
85 |
+
|
86 |
+
#: demo/demo.php:82
|
87 |
+
msgid "Radio"
|
88 |
+
msgstr "Bouton Radio"
|
89 |
+
|
90 |
+
#: demo/demo.php:88 demo/demo.php:99 demo/demo.php:242 demo/demo.php:253
|
91 |
+
#: demo/demo.php:302
|
92 |
+
msgid "Label1"
|
93 |
+
msgstr "Étiquette1"
|
94 |
+
|
95 |
+
#: demo/demo.php:89 demo/demo.php:100 demo/demo.php:243 demo/demo.php:254
|
96 |
+
#: demo/demo.php:303
|
97 |
+
msgid "Label2"
|
98 |
+
msgstr "Étiquette2"
|
99 |
+
|
100 |
+
#: demo/demo.php:94 demo/demo.php:297 inc/fields/file-input.php:40
|
101 |
+
msgid "Select"
|
102 |
+
msgstr "Choisissez"
|
103 |
+
|
104 |
+
#: demo/demo.php:105 demo/demo.php:308 demo/demo.php:333
|
105 |
+
msgid "Select an Item"
|
106 |
+
msgstr "Choisissez un élément"
|
107 |
+
|
108 |
+
#: demo/demo.php:112
|
109 |
+
msgid "Hidden value"
|
110 |
+
msgstr "Valeur cachée"
|
111 |
+
|
112 |
+
#: demo/demo.php:116
|
113 |
+
msgid "Password"
|
114 |
+
msgstr "Mot de passe"
|
115 |
+
|
116 |
+
#: demo/demo.php:122
|
117 |
+
msgid "Textarea"
|
118 |
+
msgstr "Zone de texte"
|
119 |
+
|
120 |
+
#: demo/demo.php:123
|
121 |
+
msgid "Textarea description"
|
122 |
+
msgstr "Description de la zone de texte"
|
123 |
+
|
124 |
+
#: demo/demo.php:140
|
125 |
+
msgid "Password is required"
|
126 |
+
msgstr "Mot de passe requis"
|
127 |
+
|
128 |
+
#: demo/demo.php:141
|
129 |
+
msgid "Password must be at least 7 characters"
|
130 |
+
msgstr "Le mot de passe doit comporter au moins 7 caractères."
|
131 |
+
|
132 |
+
#: demo/demo.php:149
|
133 |
+
msgid "Advanced Fields"
|
134 |
+
msgstr "Champs spéciaux"
|
135 |
+
|
136 |
+
#: demo/demo.php:155
|
137 |
+
msgid "Heading"
|
138 |
+
msgstr "Intertitre"
|
139 |
+
|
140 |
+
#: demo/demo.php:157
|
141 |
+
msgid "Optional description for this heading"
|
142 |
+
msgstr "Description facultative pour cet intertitre"
|
143 |
+
|
144 |
+
#: demo/demo.php:161 demo/slider.php:9
|
145 |
+
msgid "Slider"
|
146 |
+
msgstr "Slider"
|
147 |
+
|
148 |
+
#: demo/demo.php:166 demo/slider.php:14
|
149 |
+
msgid "$"
|
150 |
+
msgstr "$"
|
151 |
+
|
152 |
+
#: demo/demo.php:167 demo/slider.php:15
|
153 |
+
msgid " USD"
|
154 |
+
msgstr " USD"
|
155 |
+
|
156 |
+
#: demo/demo.php:178
|
157 |
+
msgid "Number"
|
158 |
+
msgstr "Nombre"
|
159 |
+
|
160 |
+
#: demo/demo.php:187
|
161 |
+
msgid "Date picker"
|
162 |
+
msgstr "Sélecteur de date"
|
163 |
+
|
164 |
+
#: demo/demo.php:202
|
165 |
+
msgid "Datetime picker"
|
166 |
+
msgstr "Sélecteur de Date & Heure combinées"
|
167 |
+
|
168 |
+
#: demo/demo.php:216
|
169 |
+
msgid "Time picker"
|
170 |
+
msgstr "Sélecteur d'heure"
|
171 |
+
|
172 |
+
#: demo/demo.php:231
|
173 |
+
msgid "Color picker"
|
174 |
+
msgstr "Sélecteur de couleur"
|
175 |
+
|
176 |
+
#: demo/demo.php:237
|
177 |
+
msgid "Checkbox list"
|
178 |
+
msgstr "liste de cases à cocher"
|
179 |
+
|
180 |
+
#: demo/demo.php:248
|
181 |
+
msgid "Autocomplete"
|
182 |
+
msgstr "Complétion automatique"
|
183 |
+
|
184 |
+
#: demo/demo.php:263
|
185 |
+
msgid "Email"
|
186 |
+
msgstr "Email"
|
187 |
+
|
188 |
+
#: demo/demo.php:265
|
189 |
+
msgid "Email description"
|
190 |
+
msgstr "Description de l'email"
|
191 |
+
|
192 |
+
#: demo/demo.php:271
|
193 |
+
msgid "Range"
|
194 |
+
msgstr "Fourchette"
|
195 |
+
|
196 |
+
#: demo/demo.php:273
|
197 |
+
msgid "Range description"
|
198 |
+
msgstr "Description de la fourchette"
|
199 |
+
|
200 |
+
#: demo/demo.php:282
|
201 |
+
msgid "URL"
|
202 |
+
msgstr "URL"
|
203 |
+
|
204 |
+
#: demo/demo.php:284
|
205 |
+
msgid "URL description"
|
206 |
+
msgstr "Description de l'URL"
|
207 |
+
|
208 |
+
#: demo/demo.php:290
|
209 |
+
msgid "oEmbed"
|
210 |
+
msgstr "oEmbed"
|
211 |
+
|
212 |
+
#: demo/demo.php:292
|
213 |
+
msgid "oEmbed description"
|
214 |
+
msgstr "Description oEmbed"
|
215 |
+
|
216 |
+
#: demo/demo.php:312
|
217 |
+
msgid "Taxonomy"
|
218 |
+
msgstr "Taxonomie"
|
219 |
+
|
220 |
+
#: demo/demo.php:326
|
221 |
+
msgid "Posts (Pages)"
|
222 |
+
msgstr "Articles (Pages)"
|
223 |
+
|
224 |
+
#: demo/demo.php:342
|
225 |
+
msgid "WYSIWYG / Rich Text Editor"
|
226 |
+
msgstr "Éditeur de texte (WYSIWYG)"
|
227 |
+
|
228 |
+
#: demo/demo.php:347
|
229 |
+
msgid "WYSIWYG default value"
|
230 |
+
msgstr "Valeur par défaut WYSIWYG"
|
231 |
+
|
232 |
+
#: demo/demo.php:363 demo/force-delete.php:12
|
233 |
+
msgid "File Upload"
|
234 |
+
msgstr "Mise en ligne d'un fichier"
|
235 |
+
|
236 |
+
#: demo/demo.php:369
|
237 |
+
msgid "File Advanced Upload"
|
238 |
+
msgstr "Mise en ligne avancée d'un fichier"
|
239 |
+
|
240 |
+
#: demo/demo.php:377 demo/force-delete.php:19
|
241 |
+
msgid "Image Upload"
|
242 |
+
msgstr "Mise en ligne d'une image"
|
243 |
+
|
244 |
+
#: demo/demo.php:383 demo/force-delete.php:25
|
245 |
+
msgid "Thickbox Image Upload"
|
246 |
+
msgstr "Mise en ligne d'une image (Thickbox)"
|
247 |
+
|
248 |
+
#: demo/demo.php:389 demo/force-delete.php:32
|
249 |
+
msgid "Plupload Image Upload"
|
250 |
+
msgstr "Mise en ligne d'une image (Plupload)"
|
251 |
+
|
252 |
+
#: demo/demo.php:396
|
253 |
+
msgid "Image Advanced Upload"
|
254 |
+
msgstr "Mise en ligne avancée d'une image"
|
255 |
+
|
256 |
+
#: demo/force-delete.php:8
|
257 |
+
msgid "Test Meta Box"
|
258 |
+
msgstr "Test de Meta Box"
|
259 |
+
|
260 |
+
#: demo/image-select.php:6
|
261 |
+
msgid "Image Select Demo"
|
262 |
+
msgstr "Démo de Sélection d'image"
|
263 |
+
|
264 |
+
#: demo/image-select.php:10
|
265 |
+
msgid "Layout"
|
266 |
+
msgstr "Disposition:"
|
267 |
+
|
268 |
+
#: demo/map.php:6
|
269 |
+
msgid "Google Map"
|
270 |
+
msgstr "Google Map"
|
271 |
+
|
272 |
+
#: demo/map.php:10
|
273 |
+
msgid "Address"
|
274 |
+
msgstr "Adresse"
|
275 |
+
|
276 |
+
#: demo/map.php:12
|
277 |
+
msgid "Hanoi, Vietnam"
|
278 |
+
msgstr "Hanoi, Vietnam"
|
279 |
+
|
280 |
+
#: demo/map.php:16
|
281 |
+
msgid "Location"
|
282 |
+
msgstr "Localisation"
|
283 |
+
|
284 |
+
#: demo/oembed.php:6
|
285 |
+
msgid "oEmbed Demo"
|
286 |
+
msgstr "oEmbed Démo"
|
287 |
+
|
288 |
+
#: demo/oembed.php:10
|
289 |
+
msgid "oEmbed(s)"
|
290 |
+
msgstr "oEmbed (s)"
|
291 |
+
|
292 |
+
#: demo/slider.php:6
|
293 |
+
msgid "Slider Demo"
|
294 |
+
msgstr "Démo de Slider"
|
295 |
+
|
296 |
+
#: demo/url.php:6
|
297 |
+
msgid "URL Demo"
|
298 |
+
msgstr "Démo d'URL"
|
299 |
+
|
300 |
+
#: demo/url.php:10
|
301 |
+
msgid "URL(s)"
|
302 |
+
msgstr "URL(s)"
|
303 |
+
|
304 |
+
#: inc/common.php:53
|
305 |
+
msgid "Documentation"
|
306 |
+
msgstr "Documentation"
|
307 |
+
|
308 |
+
#: inc/common.php:54
|
309 |
+
msgid "Extensions"
|
310 |
+
msgstr "Extensions"
|
311 |
+
|
312 |
+
#: inc/field.php:225
|
313 |
+
msgid "+"
|
314 |
+
msgstr "+"
|
315 |
+
|
316 |
+
#: inc/field.php:235
|
317 |
+
msgid "–"
|
318 |
+
msgstr "–"
|
319 |
+
|
320 |
+
#: inc/fields/autocomplete.php:18 inc/fields/autocomplete.php:72
|
321 |
+
msgid "Delete"
|
322 |
+
msgstr "Supprimer"
|
323 |
+
|
324 |
+
#: inc/fields/button.php:35
|
325 |
+
msgid "Click me"
|
326 |
+
msgstr "Cliquez-ici"
|
327 |
+
|
328 |
+
#: inc/fields/file-advanced.php:23
|
329 |
+
msgid "Select Files"
|
330 |
+
msgstr "Sélectionnez les fichiers"
|
331 |
+
|
332 |
+
#: inc/fields/file-advanced.php:66
|
333 |
+
msgctxt "file upload"
|
334 |
+
msgid "Select or Upload Files"
|
335 |
+
msgstr "Sélectionnez ou mettez en ligne des fichiers"
|
336 |
+
|
337 |
+
#: inc/fields/file-advanced.php:103 inc/fields/file.php:168
|
338 |
+
msgctxt "file upload"
|
339 |
+
msgid "Delete"
|
340 |
+
msgstr "Supprimer"
|
341 |
+
|
342 |
+
#: inc/fields/file-advanced.php:104 inc/fields/file.php:169
|
343 |
+
msgctxt "file upload"
|
344 |
+
msgid "Edit"
|
345 |
+
msgstr "Modifier"
|
346 |
+
|
347 |
+
#: inc/fields/file-input.php:17
|
348 |
+
msgid "Select File"
|
349 |
+
msgstr "Choisissez un fichier"
|
350 |
+
|
351 |
+
#: inc/fields/file-input.php:42
|
352 |
+
msgid "Remove"
|
353 |
+
msgstr "Supprimer"
|
354 |
+
|
355 |
+
#: inc/fields/file.php:19
|
356 |
+
#, php-format
|
357 |
+
msgid "You may only upload maximum %d file"
|
358 |
+
msgstr "Vous ne pouvez mettre en ligne qu'un fichier de %d maximum"
|
359 |
+
|
360 |
+
#: inc/fields/file.php:20
|
361 |
+
#, php-format
|
362 |
+
msgid "You may only upload maximum %d files"
|
363 |
+
msgstr "Vous ne pouvez mettre en ligne que des fichiers de %d maximum"
|
364 |
+
|
365 |
+
#: inc/fields/file.php:98
|
366 |
+
msgid "Error: Cannot delete file"
|
367 |
+
msgstr "Erreur : Impossible de supprimer le fichier"
|
368 |
+
|
369 |
+
#: inc/fields/file.php:111
|
370 |
+
msgctxt "file upload"
|
371 |
+
msgid "Upload Files"
|
372 |
+
msgstr "Mettez en ligne des fichiers"
|
373 |
+
|
374 |
+
#: inc/fields/file.php:112
|
375 |
+
msgctxt "file upload"
|
376 |
+
msgid "+ Add new file"
|
377 |
+
msgstr "+ Ajouter un nouveau fichier"
|
378 |
+
|
379 |
+
#: inc/fields/image-advanced.php:23
|
380 |
+
msgid "Select Images"
|
381 |
+
msgstr "Sélectionner des images"
|
382 |
+
|
383 |
+
#: inc/fields/image-advanced.php:71
|
384 |
+
msgctxt "image upload"
|
385 |
+
msgid "Select or Upload Images"
|
386 |
+
msgstr "Sélectionnez ou mettez en ligne des images"
|
387 |
+
|
388 |
+
#: inc/fields/image-advanced.php:108 inc/fields/image.php:136
|
389 |
+
msgctxt "image upload"
|
390 |
+
msgid "Delete"
|
391 |
+
msgstr "Supprimer"
|
392 |
+
|
393 |
+
#: inc/fields/image-advanced.php:109 inc/fields/image.php:137
|
394 |
+
msgctxt "image upload"
|
395 |
+
msgid "Edit"
|
396 |
+
msgstr "Modifier"
|
397 |
+
|
398 |
+
#: inc/fields/image.php:70 inc/fields/thickbox-image.php:34
|
399 |
+
msgctxt "image upload"
|
400 |
+
msgid "Upload Images"
|
401 |
+
msgstr "Mettez en ligne des images"
|
402 |
+
|
403 |
+
#: inc/fields/image.php:71
|
404 |
+
msgctxt "image upload"
|
405 |
+
msgid "+ Add new image"
|
406 |
+
msgstr "+ Ajouter une nouvelle image"
|
407 |
+
|
408 |
+
#: inc/fields/map.php:48
|
409 |
+
msgid "Find Address"
|
410 |
+
msgstr "Trouver une adresse"
|
411 |
+
|
412 |
+
#: inc/fields/oembed.php:55
|
413 |
+
msgid "Embed HTML not available."
|
414 |
+
msgstr "Intégration du code HTML non disponible."
|
415 |
+
|
416 |
+
#: inc/fields/oembed.php:77
|
417 |
+
msgid "Preview"
|
418 |
+
msgstr "Aperçu"
|
419 |
+
|
420 |
+
#: inc/fields/plupload-image.php:105
|
421 |
+
msgctxt "image upload"
|
422 |
+
msgid "Drop images here"
|
423 |
+
msgstr "Déposez des images ici"
|
424 |
+
|
425 |
+
#: inc/fields/plupload-image.php:106
|
426 |
+
msgctxt "image upload"
|
427 |
+
msgid "or"
|
428 |
+
msgstr "ou"
|
429 |
+
|
430 |
+
#: inc/fields/plupload-image.php:107
|
431 |
+
msgctxt "image upload"
|
432 |
+
msgid "Select Files"
|
433 |
+
msgstr "Sélectionnez des fichiers"
|
434 |
+
|
435 |
+
#: inc/fields/plupload-image.php:182
|
436 |
+
msgctxt "image upload"
|
437 |
+
msgid "Allowed Image Files"
|
438 |
+
msgstr "Types d'images autorisés"
|
439 |
+
|
440 |
+
#: inc/fields/post.php:52
|
441 |
+
msgid "Post"
|
442 |
+
msgstr "Article"
|
443 |
+
|
444 |
+
#: inc/fields/post.php:66 inc/fields/taxonomy.php:40 inc/fields/user.php:62
|
445 |
+
#, php-format
|
446 |
+
msgid "Select a %s"
|
447 |
+
msgstr "Choisissez un %s"
|
448 |
+
|
449 |
+
#: inc/fields/user.php:54
|
450 |
+
msgid "User"
|
451 |
+
msgstr "Utilisateur"
|
452 |
+
|
453 |
+
#: inc/meta-box.php:245
|
454 |
+
msgid "Please correct the errors highlighted below and try again."
|
455 |
+
msgstr ""
|
456 |
+
"Merci de corriger les erreurs mises en évidence ci-dessous et de réessayer."
|
{lang → languages}/meta-box-it_IT.mo
RENAMED
File without changes
|
languages/meta-box-it_IT.po
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-03-02 14:08+0700\n"
|
6 |
+
"PO-Revision-Date: 2012-03-02 14:08+0700\n"
|
7 |
+
"Last-Translator: name <email@domain.com>\n"
|
8 |
+
"Language-Team: Rilwis <rilwis@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2;_x:2c,1\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: UNITED STATES\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
18 |
+
"X-Poedit-SearchPath-0: ..\n"
|
19 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
20 |
+
|
21 |
+
#: ../meta-box.php:334
|
22 |
+
msgid "+"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: ../meta-box.php:358
|
26 |
+
msgid "–"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: ../meta-box.php:691
|
30 |
+
msgid "RW_Meta_Box Debug:"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: ../inc/fields/color.php:45
|
34 |
+
msgid "Select a color"
|
35 |
+
msgstr "Seleziona un colore"
|
36 |
+
|
37 |
+
#: ../inc/fields/file.php:69
|
38 |
+
msgid "Error: Cannot delete file"
|
39 |
+
msgstr "Errore: impossibile cancellare il file"
|
40 |
+
|
41 |
+
#: ../inc/fields/file.php:83
|
42 |
+
msgctxt "file upload"
|
43 |
+
msgid "Uploaded files"
|
44 |
+
msgstr "Carica i files"
|
45 |
+
|
46 |
+
#: ../inc/fields/file.php:84
|
47 |
+
msgctxt "file upload"
|
48 |
+
msgid "Delete this file"
|
49 |
+
msgstr "Elimina file"
|
50 |
+
|
51 |
+
#: ../inc/fields/file.php:85
|
52 |
+
msgctxt "file upload"
|
53 |
+
msgid "Delete"
|
54 |
+
msgstr "Elimina"
|
55 |
+
|
56 |
+
#: ../inc/fields/file.php:86
|
57 |
+
msgctxt "file upload"
|
58 |
+
msgid "Upload files"
|
59 |
+
msgstr "Carica files"
|
60 |
+
|
61 |
+
#: ../inc/fields/file.php:87
|
62 |
+
msgctxt "file upload"
|
63 |
+
msgid "Add another file"
|
64 |
+
msgstr "Aggiungi altro file"
|
65 |
+
|
66 |
+
#: ../inc/fields/image.php:68
|
67 |
+
msgid "Order saved"
|
68 |
+
msgstr "Ordine salvato"
|
69 |
+
|
70 |
+
#: ../inc/fields/image.php:84
|
71 |
+
#: ../inc/fields/plupload-image.php:178
|
72 |
+
msgctxt "image upload"
|
73 |
+
msgid "Uploaded files"
|
74 |
+
msgstr "Files caricati"
|
75 |
+
|
76 |
+
#: ../inc/fields/image.php:85
|
77 |
+
#: ../inc/fields/plupload-image.php:140
|
78 |
+
msgctxt "image upload"
|
79 |
+
msgid "Delete this file"
|
80 |
+
msgstr "Elimina file"
|
81 |
+
|
82 |
+
#: ../inc/fields/image.php:86
|
83 |
+
#: ../inc/fields/plupload-image.php:141
|
84 |
+
msgctxt "image upload"
|
85 |
+
msgid "Delete"
|
86 |
+
msgstr "Cancella"
|
87 |
+
|
88 |
+
#: ../inc/fields/image.php:87
|
89 |
+
#: ../inc/fields/plupload-image.php:142
|
90 |
+
msgctxt "image upload"
|
91 |
+
msgid "Edit"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: ../inc/fields/image.php:88
|
95 |
+
#: ../inc/fields/plupload-image.php:179
|
96 |
+
msgctxt "image upload"
|
97 |
+
msgid "Upload files"
|
98 |
+
msgstr "Carica files"
|
99 |
+
|
100 |
+
#: ../inc/fields/image.php:89
|
101 |
+
#: ../inc/fields/plupload-image.php:180
|
102 |
+
msgctxt "image upload"
|
103 |
+
msgid "Add another file"
|
104 |
+
msgstr "Aggiungi altro file"
|
105 |
+
|
106 |
+
#: ../inc/fields/plupload-image.php:112
|
107 |
+
msgctxt "image upload"
|
108 |
+
msgid "Allowed Image Files"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: ../inc/fields/plupload-image.php:183
|
112 |
+
msgctxt "image upload"
|
113 |
+
msgid "Drop images here"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: ../inc/fields/plupload-image.php:184
|
117 |
+
msgctxt "image upload"
|
118 |
+
msgid "or"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: ../inc/fields/plupload-image.php:185
|
122 |
+
#, fuzzy
|
123 |
+
msgctxt "image upload"
|
124 |
+
msgid "Select Files"
|
125 |
+
msgstr "Seleziona un colore"
|
126 |
+
|
{lang → languages}/meta-box-nb_NO.mo
RENAMED
File without changes
|
languages/meta-box-nb_NO.po
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-03-02 14:08+0700\n"
|
6 |
+
"PO-Revision-Date: 2012-03-05 22:32+0100\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: Magnus Kolstad <mrkolby@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2;_x:2c,1\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: Norwegian (Bokmål)\n"
|
15 |
+
"X-Poedit-Country: Norwegian\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
18 |
+
"X-Poedit-SearchPath-0: ..\n"
|
19 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
20 |
+
|
21 |
+
#: ../meta-box.php:334
|
22 |
+
msgid "+"
|
23 |
+
msgstr "+"
|
24 |
+
|
25 |
+
#: ../meta-box.php:358
|
26 |
+
msgid "–"
|
27 |
+
msgstr "–"
|
28 |
+
|
29 |
+
#: ../meta-box.php:691
|
30 |
+
msgid "RW_Meta_Box Debug:"
|
31 |
+
msgstr "RW_Meta_Box-debug"
|
32 |
+
|
33 |
+
#: ../inc/fields/color.php:45
|
34 |
+
msgid "Select a color"
|
35 |
+
msgstr "Velg en farge"
|
36 |
+
|
37 |
+
#: ../inc/fields/file.php:69
|
38 |
+
msgid "Error: Cannot delete file"
|
39 |
+
msgstr "Feil: Kan ikke slette fil"
|
40 |
+
|
41 |
+
#: ../inc/fields/file.php:83
|
42 |
+
msgctxt "file upload"
|
43 |
+
msgid "Uploaded files"
|
44 |
+
msgstr "Opplastede filer"
|
45 |
+
|
46 |
+
#: ../inc/fields/file.php:84
|
47 |
+
msgctxt "file upload"
|
48 |
+
msgid "Delete this file"
|
49 |
+
msgstr "Slett denne filen"
|
50 |
+
|
51 |
+
#: ../inc/fields/file.php:85
|
52 |
+
msgctxt "file upload"
|
53 |
+
msgid "Delete"
|
54 |
+
msgstr "Slett"
|
55 |
+
|
56 |
+
#: ../inc/fields/file.php:86
|
57 |
+
msgctxt "file upload"
|
58 |
+
msgid "Upload files"
|
59 |
+
msgstr "Last opp filer"
|
60 |
+
|
61 |
+
#: ../inc/fields/file.php:87
|
62 |
+
msgctxt "file upload"
|
63 |
+
msgid "Add another file"
|
64 |
+
msgstr "Legg til en fil"
|
65 |
+
|
66 |
+
#: ../inc/fields/image.php:68
|
67 |
+
msgid "Order saved"
|
68 |
+
msgstr "Sortering lagret"
|
69 |
+
|
70 |
+
#: ../inc/fields/image.php:84
|
71 |
+
#: ../inc/fields/plupload-image.php:178
|
72 |
+
msgctxt "image upload"
|
73 |
+
msgid "Uploaded files"
|
74 |
+
msgstr "Opplastede filer"
|
75 |
+
|
76 |
+
#: ../inc/fields/image.php:85
|
77 |
+
#: ../inc/fields/plupload-image.php:140
|
78 |
+
msgctxt "image upload"
|
79 |
+
msgid "Delete this file"
|
80 |
+
msgstr "Slett denne filen"
|
81 |
+
|
82 |
+
#: ../inc/fields/image.php:86
|
83 |
+
#: ../inc/fields/plupload-image.php:141
|
84 |
+
msgctxt "image upload"
|
85 |
+
msgid "Delete"
|
86 |
+
msgstr "Slett"
|
87 |
+
|
88 |
+
#: ../inc/fields/image.php:87
|
89 |
+
#: ../inc/fields/plupload-image.php:142
|
90 |
+
msgctxt "image upload"
|
91 |
+
msgid "Edit"
|
92 |
+
msgstr "Endre"
|
93 |
+
|
94 |
+
#: ../inc/fields/image.php:88
|
95 |
+
#: ../inc/fields/plupload-image.php:179
|
96 |
+
msgctxt "image upload"
|
97 |
+
msgid "Upload files"
|
98 |
+
msgstr "Last opp filer"
|
99 |
+
|
100 |
+
#: ../inc/fields/image.php:89
|
101 |
+
#: ../inc/fields/plupload-image.php:180
|
102 |
+
msgctxt "image upload"
|
103 |
+
msgid "Add another file"
|
104 |
+
msgstr "Legg til en fil"
|
105 |
+
|
106 |
+
#: ../inc/fields/plupload-image.php:112
|
107 |
+
msgctxt "image upload"
|
108 |
+
msgid "Allowed Image Files"
|
109 |
+
msgstr "Tillate bilde-filer"
|
110 |
+
|
111 |
+
#: ../inc/fields/plupload-image.php:183
|
112 |
+
msgctxt "image upload"
|
113 |
+
msgid "Drop images here"
|
114 |
+
msgstr "Slipp bildene her"
|
115 |
+
|
116 |
+
#: ../inc/fields/plupload-image.php:184
|
117 |
+
msgctxt "image upload"
|
118 |
+
msgid "or"
|
119 |
+
msgstr "eller"
|
120 |
+
|
121 |
+
#: ../inc/fields/plupload-image.php:185
|
122 |
+
#, fuzzy
|
123 |
+
msgctxt "image upload"
|
124 |
+
msgid "Select Files"
|
125 |
+
msgstr "Velg en farge"
|
126 |
+
|
127 |
+
#~ msgid "Cannot delete file. Something's wrong."
|
128 |
+
#~ msgstr "Kan ikke slette filen. Noe er galt."
|
129 |
+
|
130 |
+
#~ msgid "Uploaded files"
|
131 |
+
#~ msgstr "Opplastede filer."
|
132 |
+
|
133 |
+
#~ msgid "Delete"
|
134 |
+
#~ msgstr "Slett"
|
135 |
+
|
136 |
+
#~ msgid "Upload new files"
|
137 |
+
#~ msgstr "Last opp nye filer"
|
138 |
+
|
139 |
+
#~ msgid "Add more file"
|
140 |
+
#~ msgstr "Legg til flere filer"
|
141 |
+
|
142 |
+
#~ msgid "Uploaded images"
|
143 |
+
#~ msgstr "Opplastede bilder"
|
144 |
+
|
145 |
+
#~ msgid "Delete this image"
|
146 |
+
#~ msgstr "Slett dette bildet"
|
147 |
+
|
148 |
+
#~ msgid "Upload new images"
|
149 |
+
#~ msgstr "Last opp nye bilder"
|
{lang → languages}/meta-box-nl_NL.mo
RENAMED
File without changes
|
languages/meta-box-nl_NL.po
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-04-21 01:56+0100\n"
|
6 |
+
"PO-Revision-Date: 2013-04-21 01:56+0100\n"
|
7 |
+
"Last-Translator: Cor van Noorloos <info@webvorm.nl>\n"
|
8 |
+
"Language-Team: Rilwis <rilwis@gmail.com>\n"
|
9 |
+
"Language: nl_NL\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
|
14 |
+
"_nx_noop:1,2\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Generator: Poedit 1.5.5\n"
|
18 |
+
"X-Poedit-SearchPath-0: ..\n"
|
19 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
20 |
+
|
21 |
+
#: ../inc/classes/meta-box.php:299
|
22 |
+
msgid "Please correct the errors highlighted below and try again."
|
23 |
+
msgstr "Corrigeer de fouten hieronder gemarkeerd en probeer opnieuw."
|
24 |
+
|
25 |
+
#: ../inc/classes/meta-box.php:360
|
26 |
+
msgid "+"
|
27 |
+
msgstr "+"
|
28 |
+
|
29 |
+
#: ../inc/classes/meta-box.php:382
|
30 |
+
msgid "–"
|
31 |
+
msgstr "–"
|
32 |
+
|
33 |
+
#: ../inc/fields/file-advanced.php:62
|
34 |
+
msgctxt "file upload"
|
35 |
+
msgid "Select or Upload Files"
|
36 |
+
msgstr "Bestanden selecteren of uploaden"
|
37 |
+
|
38 |
+
#: ../inc/fields/file.php:66
|
39 |
+
msgid "Error: Cannot delete file"
|
40 |
+
msgstr "Foutmelding: Kan bestand niet verwijderen"
|
41 |
+
|
42 |
+
#: ../inc/fields/file.php:80
|
43 |
+
msgctxt "file upload"
|
44 |
+
msgid "Upload Files"
|
45 |
+
msgstr "Bestanden uploaden"
|
46 |
+
|
47 |
+
#: ../inc/fields/file.php:81
|
48 |
+
msgctxt "file upload"
|
49 |
+
msgid "+ Add new file"
|
50 |
+
msgstr "+ Nieuw bestand toevoegen"
|
51 |
+
|
52 |
+
#: ../inc/fields/file.php:133
|
53 |
+
msgctxt "file upload"
|
54 |
+
msgid "Delete"
|
55 |
+
msgstr "Verwijderen"
|
56 |
+
|
57 |
+
#: ../inc/fields/file.php:134
|
58 |
+
msgctxt "file upload"
|
59 |
+
msgid "Edit"
|
60 |
+
msgstr "Bewerken"
|
61 |
+
|
62 |
+
#: ../inc/fields/image-advanced.php:68
|
63 |
+
msgctxt "image upload"
|
64 |
+
msgid "Select or Upload Images"
|
65 |
+
msgstr "Afbeeldingen selecteren of uploaden"
|
66 |
+
|
67 |
+
#: ../inc/fields/image.php:64
|
68 |
+
msgid "Order saved"
|
69 |
+
msgstr "Volgorde opgeslagen"
|
70 |
+
|
71 |
+
#: ../inc/fields/image.php:78 ../inc/fields/thickbox-image.php:35
|
72 |
+
msgctxt "image upload"
|
73 |
+
msgid "Upload Images"
|
74 |
+
msgstr "Afbeeldingen uploaden"
|
75 |
+
|
76 |
+
#: ../inc/fields/image.php:79
|
77 |
+
msgctxt "image upload"
|
78 |
+
msgid "+ Add new image"
|
79 |
+
msgstr "+ Nieuwe afbeelding toevoegen"
|
80 |
+
|
81 |
+
#: ../inc/fields/image.php:144
|
82 |
+
msgctxt "image upload"
|
83 |
+
msgid "Delete"
|
84 |
+
msgstr "Verwijderen"
|
85 |
+
|
86 |
+
#: ../inc/fields/image.php:145
|
87 |
+
msgctxt "image upload"
|
88 |
+
msgid "Edit"
|
89 |
+
msgstr "Bewerken"
|
90 |
+
|
91 |
+
#: ../inc/fields/map.php:46
|
92 |
+
msgid "Find Address"
|
93 |
+
msgstr "Adres vinden"
|
94 |
+
|
95 |
+
#: ../inc/fields/plupload-image.php:104
|
96 |
+
msgctxt "image upload"
|
97 |
+
msgid "Drop images here"
|
98 |
+
msgstr "Afbeeldingen naar hier verslepen"
|
99 |
+
|
100 |
+
#: ../inc/fields/plupload-image.php:105
|
101 |
+
msgctxt "image upload"
|
102 |
+
msgid "or"
|
103 |
+
msgstr "of"
|
104 |
+
|
105 |
+
#: ../inc/fields/plupload-image.php:106
|
106 |
+
msgctxt "image upload"
|
107 |
+
msgid "Select Files"
|
108 |
+
msgstr "Bestanden selecteren"
|
109 |
+
|
110 |
+
#: ../inc/fields/plupload-image.php:181
|
111 |
+
msgctxt "image upload"
|
112 |
+
msgid "Allowed Image Files"
|
113 |
+
msgstr "Toegestane afbeeldingsbestanden"
|
114 |
+
|
115 |
+
#: ../inc/fields/post.php:54
|
116 |
+
msgid "Post"
|
117 |
+
msgstr "Bericht"
|
118 |
+
|
119 |
+
#: ../inc/fields/post.php:68 ../inc/fields/taxonomy.php:40
|
120 |
+
#, php-format
|
121 |
+
msgid "Select a %s"
|
122 |
+
msgstr "Een %s selecteren"
|
123 |
+
|
124 |
+
#: ../inc/fields/select-advanced.php:71
|
125 |
+
msgid "Select a value"
|
126 |
+
msgstr "Een waarde selecteren"
|
127 |
+
|
128 |
+
#~ msgctxt "file upload"
|
129 |
+
#~ msgid "Select Files"
|
130 |
+
#~ msgstr "Bestanden selecteren"
|
{lang → languages}/meta-box-pl_PL.mo
RENAMED
File without changes
|
languages/meta-box-pl_PL.po
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: meta-box\n"
|
4 |
+
"POT-Creation-Date: 2015-05-24 18:55+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-05-24 18:58+0100\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: MM Studio <kontakt@michalmleczko.waw.pl>\n"
|
8 |
+
"Language: pl_PL\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.8\n"
|
13 |
+
"X-Poedit-Basepath: ..\\\n"
|
14 |
+
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
|
15 |
+
"|| n%100>=20) ? 1 : 2);\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2;"
|
18 |
+
"_x:1,2c\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
#: inc/common.php:53
|
22 |
+
msgid "Documentation"
|
23 |
+
msgstr "Dokumentacja"
|
24 |
+
|
25 |
+
#: inc/common.php:54
|
26 |
+
msgid "Extensions"
|
27 |
+
msgstr "Rozszerzenia"
|
28 |
+
|
29 |
+
#: inc/field.php:229
|
30 |
+
msgid "+"
|
31 |
+
msgstr "+"
|
32 |
+
|
33 |
+
#: inc/field.php:242
|
34 |
+
msgid "–"
|
35 |
+
msgstr "–"
|
36 |
+
|
37 |
+
#: inc/fields/autocomplete.php:18 inc/fields/autocomplete.php:83
|
38 |
+
#: inc/fields/autocomplete.php:100
|
39 |
+
msgid "Delete"
|
40 |
+
msgstr "Usuń"
|
41 |
+
|
42 |
+
#: inc/fields/button.php:35
|
43 |
+
msgid "Click me"
|
44 |
+
msgstr "Kliknij mnie"
|
45 |
+
|
46 |
+
#: inc/fields/checkbox.php:75
|
47 |
+
msgid "Yes"
|
48 |
+
msgstr "Tak"
|
49 |
+
|
50 |
+
#: inc/fields/checkbox.php:75
|
51 |
+
msgid "No"
|
52 |
+
msgstr "Nie"
|
53 |
+
|
54 |
+
#: inc/fields/file-advanced.php:23
|
55 |
+
msgid "Select Files"
|
56 |
+
msgstr "Wybierz pliki"
|
57 |
+
|
58 |
+
#: inc/fields/file-advanced.php:66
|
59 |
+
msgctxt "file upload"
|
60 |
+
msgid "Select or Upload Files"
|
61 |
+
msgstr "Wybierz lub wyślij pliki"
|
62 |
+
|
63 |
+
#: inc/fields/file-advanced.php:103 inc/fields/file.php:168
|
64 |
+
msgctxt "file upload"
|
65 |
+
msgid "Delete"
|
66 |
+
msgstr "Usuń"
|
67 |
+
|
68 |
+
#: inc/fields/file-advanced.php:104 inc/fields/file.php:169
|
69 |
+
msgctxt "file upload"
|
70 |
+
msgid "Edit"
|
71 |
+
msgstr "Edytuj"
|
72 |
+
|
73 |
+
#: inc/fields/file-input.php:17
|
74 |
+
msgid "Select File"
|
75 |
+
msgstr "Wybierz plik"
|
76 |
+
|
77 |
+
#: inc/fields/file-input.php:40
|
78 |
+
msgid "Select"
|
79 |
+
msgstr "Zaznacz"
|
80 |
+
|
81 |
+
#: inc/fields/file-input.php:42
|
82 |
+
msgid "Remove"
|
83 |
+
msgstr "Usuń"
|
84 |
+
|
85 |
+
#: inc/fields/file.php:19
|
86 |
+
#, php-format
|
87 |
+
msgid "You may only upload maximum %d file"
|
88 |
+
msgstr "Możesz wysłać maksymalnie %d plik"
|
89 |
+
|
90 |
+
#: inc/fields/file.php:20
|
91 |
+
#, php-format
|
92 |
+
msgid "You may only upload maximum %d files"
|
93 |
+
msgstr "Możesz wysłać maksymalnie %d pliki/plików"
|
94 |
+
|
95 |
+
#: inc/fields/file.php:98
|
96 |
+
msgid "Error: Cannot delete file"
|
97 |
+
msgstr "Błąd: Nie można usunąć pliku"
|
98 |
+
|
99 |
+
#: inc/fields/file.php:111
|
100 |
+
msgctxt "file upload"
|
101 |
+
msgid "Upload Files"
|
102 |
+
msgstr "Wyślij pliki"
|
103 |
+
|
104 |
+
#: inc/fields/file.php:112
|
105 |
+
msgctxt "file upload"
|
106 |
+
msgid "+ Add new file"
|
107 |
+
msgstr "+ Dodaj nowy plik"
|
108 |
+
|
109 |
+
#: inc/fields/image-advanced.php:23
|
110 |
+
msgid "Select Images"
|
111 |
+
msgstr "Zaznacz zdjęcia"
|
112 |
+
|
113 |
+
#: inc/fields/image-advanced.php:71
|
114 |
+
msgctxt "image upload"
|
115 |
+
msgid "Select or Upload Images"
|
116 |
+
msgstr "Wybierz lub wyślij obrazek"
|
117 |
+
|
118 |
+
#: inc/fields/image-advanced.php:108 inc/fields/image.php:136
|
119 |
+
msgctxt "image upload"
|
120 |
+
msgid "Delete"
|
121 |
+
msgstr "Usuń"
|
122 |
+
|
123 |
+
#: inc/fields/image-advanced.php:109 inc/fields/image.php:137
|
124 |
+
msgctxt "image upload"
|
125 |
+
msgid "Edit"
|
126 |
+
msgstr "Edytuj"
|
127 |
+
|
128 |
+
#: inc/fields/image.php:70 inc/fields/thickbox-image.php:34
|
129 |
+
msgctxt "image upload"
|
130 |
+
msgid "Upload Images"
|
131 |
+
msgstr "Wyślij obrazki"
|
132 |
+
|
133 |
+
#: inc/fields/image.php:71
|
134 |
+
msgctxt "image upload"
|
135 |
+
msgid "+ Add new image"
|
136 |
+
msgstr "Dodaj nowy obrazek"
|
137 |
+
|
138 |
+
#: inc/fields/map.php:46
|
139 |
+
msgid "Find Address"
|
140 |
+
msgstr "Wyszukaj adres"
|
141 |
+
|
142 |
+
#: inc/fields/oembed.php:55
|
143 |
+
msgid "Embed HTML not available."
|
144 |
+
msgstr "Osadzenie HTML nie jest możliwe."
|
145 |
+
|
146 |
+
#: inc/fields/oembed.php:77
|
147 |
+
msgid "Preview"
|
148 |
+
msgstr "Podgląd"
|
149 |
+
|
150 |
+
#: inc/fields/plupload-image.php:105
|
151 |
+
msgctxt "image upload"
|
152 |
+
msgid "Drop images here"
|
153 |
+
msgstr "Upuść obrazki w tym miejscu"
|
154 |
+
|
155 |
+
#: inc/fields/plupload-image.php:106
|
156 |
+
msgctxt "image upload"
|
157 |
+
msgid "or"
|
158 |
+
msgstr "lub"
|
159 |
+
|
160 |
+
#: inc/fields/plupload-image.php:107
|
161 |
+
msgctxt "image upload"
|
162 |
+
msgid "Select Files"
|
163 |
+
msgstr "Wybierz pliki"
|
164 |
+
|
165 |
+
#: inc/fields/plupload-image.php:182
|
166 |
+
msgctxt "image upload"
|
167 |
+
msgid "Allowed Image Files"
|
168 |
+
msgstr "Dozwolene pliki graficzne"
|
169 |
+
|
170 |
+
#: inc/fields/post.php:56
|
171 |
+
msgid "Select a post"
|
172 |
+
msgstr "Wybierz wpis"
|
173 |
+
|
174 |
+
#: inc/fields/post.php:60 inc/fields/taxonomy.php:40
|
175 |
+
#, php-format
|
176 |
+
msgid "Select a %s"
|
177 |
+
msgstr "Wybierz %s"
|
178 |
+
|
179 |
+
#: inc/fields/user.php:49
|
180 |
+
msgid "Select an user"
|
181 |
+
msgstr "Wybierz użytkownika"
|
182 |
+
|
183 |
+
#: inc/meta-box.php:245
|
184 |
+
msgid "Please correct the errors highlighted below and try again."
|
185 |
+
msgstr "Prosze popraw podświetlone błędy i spróbuj ponownie."
|
186 |
+
|
187 |
+
#~ msgid "Select or Upload Files"
|
188 |
+
#~ msgstr "Wybierz lub wyślij pliki"
|
189 |
+
|
190 |
+
#~ msgid "Edit"
|
191 |
+
#~ msgstr "Edycja"
|
192 |
+
|
193 |
+
#~ msgid "Upload Files"
|
194 |
+
#~ msgstr "Wyślij pliki"
|
195 |
+
|
196 |
+
#~ msgid "+ Add new file"
|
197 |
+
#~ msgstr "+ Dodaj nowy plik"
|
198 |
+
|
199 |
+
#~ msgid "Select or Upload Images"
|
200 |
+
#~ msgstr "Wybierz lub wyślij obrazek"
|
201 |
+
|
202 |
+
#~ msgid "Upload Images"
|
203 |
+
#~ msgstr "Wyślij obrazki"
|
204 |
+
|
205 |
+
#~ msgid "+ Add new image"
|
206 |
+
#~ msgstr "+ Dodaj nowe grafiki"
|
207 |
+
|
208 |
+
#~ msgid "Drop images here"
|
209 |
+
#~ msgstr "Upuść obrazki w tym miejscu"
|
210 |
+
|
211 |
+
#~ msgid "or"
|
212 |
+
#~ msgstr "lub"
|
{lang → languages}/meta-box-pt_BR.mo
RENAMED
File without changes
|
languages/meta-box-pt_BR.po
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-03-02 14:08+0700\n"
|
6 |
+
"PO-Revision-Date: 2012-03-19 02:59-0300\n"
|
7 |
+
"Last-Translator: name <email@domain.com>\n"
|
8 |
+
"Language-Team: Rilwis <rilwis@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: VIET NAM\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
19 |
+
|
20 |
+
#: ../meta-box.php:334
|
21 |
+
msgid "+"
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: ../meta-box.php:358
|
25 |
+
msgid "–"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: ../meta-box.php:691
|
29 |
+
msgid "RW_Meta_Box Debug:"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: ../inc/fields/color.php:45
|
33 |
+
msgid "Select a color"
|
34 |
+
msgstr "Selecione a cor"
|
35 |
+
|
36 |
+
#: ../inc/fields/file.php:69
|
37 |
+
msgid "Error: Cannot delete file"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: ../inc/fields/file.php:83
|
41 |
+
msgctxt "file upload"
|
42 |
+
msgid "Uploaded files"
|
43 |
+
msgstr "Arquivos carregados"
|
44 |
+
|
45 |
+
#: ../inc/fields/file.php:84
|
46 |
+
msgctxt "file upload"
|
47 |
+
msgid "Delete this file"
|
48 |
+
msgstr "Deletar esse arquivo"
|
49 |
+
|
50 |
+
#: ../inc/fields/file.php:85
|
51 |
+
msgctxt "file upload"
|
52 |
+
msgid "Delete"
|
53 |
+
msgstr "Deletar"
|
54 |
+
|
55 |
+
#: ../inc/fields/file.php:86
|
56 |
+
msgctxt "file upload"
|
57 |
+
msgid "Upload files"
|
58 |
+
msgstr "Carregar arquivos"
|
59 |
+
|
60 |
+
#: ../inc/fields/file.php:87
|
61 |
+
msgctxt "file upload"
|
62 |
+
msgid "Add another file"
|
63 |
+
msgstr "Adicionar outro arquivo"
|
64 |
+
|
65 |
+
#: ../inc/fields/image.php:68
|
66 |
+
msgid "Order saved"
|
67 |
+
msgstr "Salvar ordem"
|
68 |
+
|
69 |
+
#: ../inc/fields/image.php:84
|
70 |
+
#: ../inc/fields/plupload-image.php:178
|
71 |
+
msgctxt "image upload"
|
72 |
+
msgid "Uploaded files"
|
73 |
+
msgstr "Arquivos carregados"
|
74 |
+
|
75 |
+
#: ../inc/fields/image.php:85
|
76 |
+
#: ../inc/fields/plupload-image.php:140
|
77 |
+
msgctxt "image upload"
|
78 |
+
msgid "Delete this file"
|
79 |
+
msgstr "Deletar esse arquivo"
|
80 |
+
|
81 |
+
#: ../inc/fields/image.php:86
|
82 |
+
#: ../inc/fields/plupload-image.php:141
|
83 |
+
msgctxt "image upload"
|
84 |
+
msgid "Delete"
|
85 |
+
msgstr "Deletar"
|
86 |
+
|
87 |
+
#: ../inc/fields/image.php:87
|
88 |
+
#: ../inc/fields/plupload-image.php:142
|
89 |
+
msgctxt "image upload"
|
90 |
+
msgid "Edit"
|
91 |
+
msgstr "Editar"
|
92 |
+
|
93 |
+
#: ../inc/fields/image.php:88
|
94 |
+
#: ../inc/fields/plupload-image.php:179
|
95 |
+
msgctxt "image upload"
|
96 |
+
msgid "Upload files"
|
97 |
+
msgstr "Carregar arquivos"
|
98 |
+
|
99 |
+
#: ../inc/fields/image.php:89
|
100 |
+
#: ../inc/fields/plupload-image.php:180
|
101 |
+
msgctxt "image upload"
|
102 |
+
msgid "Add another file"
|
103 |
+
msgstr "Adicionar outro arquivo"
|
104 |
+
|
105 |
+
#: ../inc/fields/plupload-image.php:112
|
106 |
+
msgctxt "image upload"
|
107 |
+
msgid "Allowed Image Files"
|
108 |
+
msgstr "Arquivos de imagem permetidos"
|
109 |
+
|
110 |
+
#: ../inc/fields/plupload-image.php:183
|
111 |
+
msgctxt "image upload"
|
112 |
+
msgid "Drop images here"
|
113 |
+
msgstr "Largue as imagens aqui"
|
114 |
+
|
115 |
+
#: ../inc/fields/plupload-image.php:184
|
116 |
+
msgctxt "image upload"
|
117 |
+
msgid "or"
|
118 |
+
msgstr "ou"
|
119 |
+
|
120 |
+
#: ../inc/fields/plupload-image.php:185
|
121 |
+
msgctxt "image upload"
|
122 |
+
msgid "Select Files"
|
123 |
+
msgstr "Selecione os arquivos"
|
124 |
+
|
{lang → languages}/meta-box-ru_RU.mo
RENAMED
File without changes
|
languages/meta-box-ru_RU.po
ADDED
@@ -0,0 +1,637 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# <!=Copyright (C) 2014 Rilwis
|
2 |
+
# This file is distributed under the GPL2+.=!>
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Meta Box 4.3.10\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/meta-box\n"
|
7 |
+
"POT-Creation-Date: 2015-08-28 23:44+0300\n"
|
8 |
+
"PO-Revision-Date: 2015-09-02 11:09+0300\n"
|
9 |
+
"Last-Translator: \n"
|
10 |
+
"Language-Team: \n"
|
11 |
+
"Language: ru_RU\n"
|
12 |
+
"MIME-Version: 1.0\n"
|
13 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
14 |
+
"Content-Transfer-Encoding: 8bit\n"
|
15 |
+
"X-Generator: Poedit 1.7.5\n"
|
16 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
17 |
+
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
18 |
+
"X-Poedit-Basepath: ../\n"
|
19 |
+
"X-Poedit-KeywordsList: __;_x\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
|
22 |
+
#: demo/all-custom-post-types.php:15
|
23 |
+
msgid "Personal Information"
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: demo/all-custom-post-types.php:20
|
27 |
+
msgid "Full name"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: demo/better-include.php:16 demo/include-by-ID-or-page-template.php:8
|
31 |
+
msgid "Meta Box Title"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: demo/better-include.php:19 demo/include-by-ID-or-page-template.php:14
|
35 |
+
msgid "Your images"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: demo/checkbox.php:10
|
39 |
+
msgid "Checkbox Upload Demo"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: demo/checkbox.php:14 demo/demo.php:74
|
43 |
+
msgid "Checkbox"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: demo/checkbox.php:16
|
47 |
+
msgid "Check or not check?"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: demo/date-time-js-options.php:8
|
51 |
+
msgid "Date Time Picker With JS Options"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: demo/date-time-js-options.php:12
|
55 |
+
msgid "Date"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: demo/date-time-js-options.php:18 demo/demo.php:193
|
59 |
+
msgid "(yyyy-mm-dd)"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: demo/date-time-js-options.php:20
|
63 |
+
msgid "Select Date"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: demo/date-time-js-options.php:21 demo/demo.php:194
|
67 |
+
msgid "yy-mm-dd"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: demo/date-time-js-options.php:27
|
71 |
+
msgid "Datetime"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: demo/date-time-js-options.php:38
|
75 |
+
msgid "Time"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: demo/demo.php:42
|
79 |
+
msgid "Standard Fields"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: demo/demo.php:61 demo/text.php:12
|
83 |
+
msgid "Text"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: demo/demo.php:65 demo/text.php:14
|
87 |
+
msgid "Text description"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#: demo/demo.php:68 demo/text.php:18
|
91 |
+
msgid "Default text value"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: demo/demo.php:82 demo/radio.php:13
|
95 |
+
msgid "Radio"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: demo/demo.php:88 demo/demo.php:99 demo/demo.php:242 demo/demo.php:253
|
99 |
+
#: demo/demo.php:302 demo/radio.php:20 demo/select.php:21
|
100 |
+
#: demo/select.php:41
|
101 |
+
msgid "Label1"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: demo/demo.php:89 demo/demo.php:100 demo/demo.php:243 demo/demo.php:254
|
105 |
+
#: demo/demo.php:303 demo/radio.php:21 demo/select.php:22
|
106 |
+
#: demo/select.php:42
|
107 |
+
msgid "Label2"
|
108 |
+
msgstr ""
|
109 |
+
|
110 |
+
#: demo/demo.php:94 demo/demo.php:297 demo/select.php:13
|
111 |
+
#: inc/fields/file-input.php:40 inc/fields/select.php:207
|
112 |
+
msgid "Select"
|
113 |
+
msgstr "Выбрать"
|
114 |
+
|
115 |
+
#: demo/demo.php:105 demo/demo.php:308 demo/demo.php:333 demo/post.php:30
|
116 |
+
#: demo/select.php:32 demo/select.php:49
|
117 |
+
msgid "Select an Item"
|
118 |
+
msgstr ""
|
119 |
+
|
120 |
+
#: demo/demo.php:112
|
121 |
+
msgid "Hidden value"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
#: demo/demo.php:116
|
125 |
+
msgid "Password"
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: demo/demo.php:122 demo/textarea.php:12
|
129 |
+
msgid "Textarea"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: demo/demo.php:123 demo/textarea.php:14
|
133 |
+
msgid "Textarea description"
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
#: demo/demo.php:140
|
137 |
+
msgid "Password is required"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: demo/demo.php:141
|
141 |
+
msgid "Password must be at least 7 characters"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: demo/demo.php:149
|
145 |
+
msgid "Advanced Fields"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: demo/demo.php:155
|
149 |
+
msgid "Heading"
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: demo/demo.php:157
|
153 |
+
msgid "Optional description for this heading"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: demo/demo.php:161 demo/slider.php:12
|
157 |
+
msgid "Slider"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: demo/demo.php:166 demo/slider.php:17
|
161 |
+
msgid "$"
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: demo/demo.php:167 demo/slider.php:18
|
165 |
+
msgid " USD"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: demo/demo.php:178 demo/number.php:13
|
169 |
+
msgid "Number"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: demo/demo.php:187
|
173 |
+
msgid "Date picker"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: demo/demo.php:202
|
177 |
+
msgid "Datetime picker"
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: demo/demo.php:216
|
181 |
+
msgid "Time picker"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: demo/demo.php:231
|
185 |
+
msgid "Color picker"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: demo/demo.php:237
|
189 |
+
msgid "Checkbox list"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: demo/demo.php:248
|
193 |
+
msgid "Autocomplete"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: demo/demo.php:263 demo/fieldset-text.php:28 demo/text-list.php:23
|
197 |
+
msgid "Email"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: demo/demo.php:265
|
201 |
+
msgid "Email description"
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: demo/demo.php:271 demo/range.php:13
|
205 |
+
msgid "Range"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: demo/demo.php:273
|
209 |
+
msgid "Range description"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: demo/demo.php:282
|
213 |
+
msgid "URL"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: demo/demo.php:284
|
217 |
+
msgid "URL description"
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: demo/demo.php:290
|
221 |
+
msgid "oEmbed"
|
222 |
+
msgstr ""
|
223 |
+
|
224 |
+
#: demo/demo.php:292
|
225 |
+
msgid "oEmbed description"
|
226 |
+
msgstr ""
|
227 |
+
|
228 |
+
#: demo/demo.php:312 demo/taxonomy-advanced.php:12 demo/taxonomy.php:12
|
229 |
+
msgid "Taxonomy"
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: demo/demo.php:326
|
233 |
+
msgid "Posts (Pages)"
|
234 |
+
msgstr ""
|
235 |
+
|
236 |
+
#: demo/demo.php:342
|
237 |
+
msgid "WYSIWYG / Rich Text Editor"
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: demo/demo.php:347
|
241 |
+
msgid "WYSIWYG default value"
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
+
#: demo/demo.php:363 demo/force-delete.php:12
|
245 |
+
msgid "File Upload"
|
246 |
+
msgstr ""
|
247 |
+
|
248 |
+
#: demo/demo.php:369
|
249 |
+
msgid "File Advanced Upload"
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
+
#: demo/demo.php:377 demo/force-delete.php:19
|
253 |
+
msgid "Image Upload"
|
254 |
+
msgstr ""
|
255 |
+
|
256 |
+
#: demo/demo.php:383 demo/force-delete.php:25
|
257 |
+
msgid "Thickbox Image Upload"
|
258 |
+
msgstr ""
|
259 |
+
|
260 |
+
#: demo/demo.php:389 demo/force-delete.php:32
|
261 |
+
msgid "Plupload Image Upload"
|
262 |
+
msgstr ""
|
263 |
+
|
264 |
+
#: demo/demo.php:396
|
265 |
+
msgid "Image Advanced Upload"
|
266 |
+
msgstr ""
|
267 |
+
|
268 |
+
#: demo/fieldset-text.php:10
|
269 |
+
msgid "Fieldset Text Demo"
|
270 |
+
msgstr ""
|
271 |
+
|
272 |
+
#: demo/fieldset-text.php:14
|
273 |
+
msgid "Fieldset Text"
|
274 |
+
msgstr ""
|
275 |
+
|
276 |
+
#: demo/fieldset-text.php:17
|
277 |
+
msgid "Please enter following details:"
|
278 |
+
msgstr ""
|
279 |
+
|
280 |
+
#: demo/fieldset-text.php:26 demo/text-list.php:22
|
281 |
+
msgid "Name"
|
282 |
+
msgstr ""
|
283 |
+
|
284 |
+
#: demo/fieldset-text.php:27 demo/map.php:14
|
285 |
+
msgid "Address"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: demo/file.php:10
|
289 |
+
msgid "File Upload Demo"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: demo/file.php:14
|
293 |
+
msgid "File"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: demo/file.php:26
|
297 |
+
msgid "File Advanced"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#: demo/file.php:38
|
301 |
+
msgid "File Input"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: demo/file.php:42
|
305 |
+
msgid "Please select a file or paste file URL here"
|
306 |
+
msgstr ""
|
307 |
+
|
308 |
+
#: demo/force-delete.php:8
|
309 |
+
msgid "Test Meta Box"
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
+
#: demo/image-select.php:9
|
313 |
+
msgid "Image Select Demo"
|
314 |
+
msgstr ""
|
315 |
+
|
316 |
+
#: demo/image-select.php:13
|
317 |
+
msgid "Layout"
|
318 |
+
msgstr ""
|
319 |
+
|
320 |
+
#: demo/image.php:10
|
321 |
+
msgid "Image Upload Demo"
|
322 |
+
msgstr ""
|
323 |
+
|
324 |
+
#: demo/image.php:14
|
325 |
+
msgid "Image"
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: demo/image.php:26
|
329 |
+
msgid "Image Advanced"
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
+
#: demo/image.php:38
|
333 |
+
msgid "Plupload Image"
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: demo/image.php:50
|
337 |
+
msgid "Thickbox Image"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: demo/key-value.php:10
|
341 |
+
msgid "Key Value Demo"
|
342 |
+
msgstr ""
|
343 |
+
|
344 |
+
#: demo/key-value.php:14
|
345 |
+
msgid "Key Value"
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: demo/key-value.php:17
|
349 |
+
msgid "Add more additional info below:"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: demo/map.php:9
|
353 |
+
msgid "Google Map"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: demo/map.php:16
|
357 |
+
msgid "Hanoi, Vietnam"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#: demo/map.php:20
|
361 |
+
msgid "Location"
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#: demo/number.php:9
|
365 |
+
msgid "Number Field Demo"
|
366 |
+
msgstr ""
|
367 |
+
|
368 |
+
#: demo/number.php:23
|
369 |
+
msgid "Enter number:"
|
370 |
+
msgstr ""
|
371 |
+
|
372 |
+
#: demo/oembed.php:9
|
373 |
+
msgid "oEmbed Demo"
|
374 |
+
msgstr ""
|
375 |
+
|
376 |
+
#: demo/oembed.php:13
|
377 |
+
msgid "oEmbed(s)"
|
378 |
+
msgstr ""
|
379 |
+
|
380 |
+
#: demo/post.php:9
|
381 |
+
msgid "Post Field Demo"
|
382 |
+
msgstr ""
|
383 |
+
|
384 |
+
#: demo/post.php:13
|
385 |
+
msgid "Post"
|
386 |
+
msgstr ""
|
387 |
+
|
388 |
+
#: demo/radio.php:9
|
389 |
+
msgid "Radio Field Demo"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: demo/range.php:9
|
393 |
+
msgid "Range Field Demo"
|
394 |
+
msgstr ""
|
395 |
+
|
396 |
+
#: demo/range.php:16
|
397 |
+
msgid "Background Opacity"
|
398 |
+
msgstr ""
|
399 |
+
|
400 |
+
#: demo/select.php:9
|
401 |
+
msgid "Select Field Demo"
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
#: demo/select.php:35
|
405 |
+
msgid "Select Advanced"
|
406 |
+
msgstr ""
|
407 |
+
|
408 |
+
#: demo/slider.php:9
|
409 |
+
msgid "Slider Demo"
|
410 |
+
msgstr ""
|
411 |
+
|
412 |
+
#: demo/taxonomy-advanced.php:9
|
413 |
+
msgid "Taxonomy_Advanced Demo"
|
414 |
+
msgstr ""
|
415 |
+
|
416 |
+
#: demo/taxonomy.php:9
|
417 |
+
msgid "Taxonomy Demo"
|
418 |
+
msgstr ""
|
419 |
+
|
420 |
+
#: demo/text-list.php:10
|
421 |
+
msgid "Text List Demo"
|
422 |
+
msgstr ""
|
423 |
+
|
424 |
+
#: demo/text-list.php:14
|
425 |
+
msgid "Text List"
|
426 |
+
msgstr ""
|
427 |
+
|
428 |
+
#: demo/text.php:9
|
429 |
+
msgid "Text Demo"
|
430 |
+
msgstr ""
|
431 |
+
|
432 |
+
#: demo/text.php:24 demo/textarea.php:24
|
433 |
+
msgid "Enter something here"
|
434 |
+
msgstr ""
|
435 |
+
|
436 |
+
#: demo/text.php:35
|
437 |
+
msgid "What"
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
#: demo/text.php:36
|
441 |
+
msgid "When"
|
442 |
+
msgstr ""
|
443 |
+
|
444 |
+
#: demo/text.php:37
|
445 |
+
msgid "Where"
|
446 |
+
msgstr ""
|
447 |
+
|
448 |
+
#: demo/text.php:38
|
449 |
+
msgid "Why"
|
450 |
+
msgstr ""
|
451 |
+
|
452 |
+
#: demo/text.php:39
|
453 |
+
msgid "Who"
|
454 |
+
msgstr ""
|
455 |
+
|
456 |
+
#: demo/textarea.php:9
|
457 |
+
msgid "Textarea Demo"
|
458 |
+
msgstr ""
|
459 |
+
|
460 |
+
#: demo/textarea.php:18
|
461 |
+
msgid "Default textarea value"
|
462 |
+
msgstr ""
|
463 |
+
|
464 |
+
#: demo/url.php:6
|
465 |
+
msgid "URL Demo"
|
466 |
+
msgstr ""
|
467 |
+
|
468 |
+
#: demo/url.php:10
|
469 |
+
msgid "URL(s)"
|
470 |
+
msgstr ""
|
471 |
+
|
472 |
+
#: demo/user.php:9
|
473 |
+
msgid "User Field Demo"
|
474 |
+
msgstr ""
|
475 |
+
|
476 |
+
#: demo/user.php:13
|
477 |
+
msgid "User"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: demo/user.php:24
|
481 |
+
msgid "Select an author"
|
482 |
+
msgstr ""
|
483 |
+
|
484 |
+
#: inc/common.php:53
|
485 |
+
msgid "Documentation"
|
486 |
+
msgstr ""
|
487 |
+
|
488 |
+
#: inc/common.php:54
|
489 |
+
msgid "Extensions"
|
490 |
+
msgstr ""
|
491 |
+
|
492 |
+
#: inc/field.php:244
|
493 |
+
msgid "+"
|
494 |
+
msgstr ""
|
495 |
+
|
496 |
+
#: inc/field.php:257
|
497 |
+
msgid "–"
|
498 |
+
msgstr ""
|
499 |
+
|
500 |
+
#: inc/fields/autocomplete.php:18 inc/fields/autocomplete.php:83
|
501 |
+
#: inc/fields/autocomplete.php:100 inc/fields/file-advanced.php:103
|
502 |
+
#: inc/fields/file.php:168 inc/fields/image-advanced.php:108
|
503 |
+
#: inc/fields/image.php:136
|
504 |
+
msgid "Delete"
|
505 |
+
msgstr ""
|
506 |
+
|
507 |
+
#: inc/fields/button.php:35
|
508 |
+
msgid "Click me"
|
509 |
+
msgstr ""
|
510 |
+
|
511 |
+
#: inc/fields/checkbox.php:75
|
512 |
+
msgid "Yes"
|
513 |
+
msgstr ""
|
514 |
+
|
515 |
+
#: inc/fields/checkbox.php:75
|
516 |
+
msgid "No"
|
517 |
+
msgstr ""
|
518 |
+
|
519 |
+
#: inc/fields/file-advanced.php:23 inc/fields/plupload-image.php:107
|
520 |
+
msgid "Select Files"
|
521 |
+
msgstr "Выберите файлы с компьютера"
|
522 |
+
|
523 |
+
#: inc/fields/file-advanced.php:66
|
524 |
+
msgid "Select or Upload Files"
|
525 |
+
msgstr ""
|
526 |
+
|
527 |
+
#: inc/fields/file-advanced.php:104 inc/fields/file.php:169
|
528 |
+
#: inc/fields/image-advanced.php:109 inc/fields/image.php:137
|
529 |
+
msgid "Edit"
|
530 |
+
msgstr ""
|
531 |
+
|
532 |
+
#: inc/fields/file-input.php:17
|
533 |
+
msgid "Select File"
|
534 |
+
msgstr ""
|
535 |
+
|
536 |
+
#: inc/fields/file-input.php:42
|
537 |
+
msgid "Remove"
|
538 |
+
msgstr ""
|
539 |
+
|
540 |
+
#: inc/fields/file.php:19
|
541 |
+
#, php-format
|
542 |
+
msgid "You may only upload maximum %d file"
|
543 |
+
msgstr ""
|
544 |
+
|
545 |
+
#: inc/fields/file.php:20
|
546 |
+
#, php-format
|
547 |
+
msgid "You may only upload maximum %d files"
|
548 |
+
msgstr ""
|
549 |
+
|
550 |
+
#: inc/fields/file.php:98
|
551 |
+
msgid "Error: Cannot delete file"
|
552 |
+
msgstr ""
|
553 |
+
|
554 |
+
#: inc/fields/file.php:111
|
555 |
+
msgid "Upload Files"
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
+
#: inc/fields/file.php:112
|
559 |
+
msgid "+ Add new file"
|
560 |
+
msgstr ""
|
561 |
+
|
562 |
+
#: inc/fields/image-advanced.php:23
|
563 |
+
msgid "Select Images"
|
564 |
+
msgstr ""
|
565 |
+
|
566 |
+
#: inc/fields/image-advanced.php:71
|
567 |
+
msgid "Select or Upload Images"
|
568 |
+
msgstr ""
|
569 |
+
|
570 |
+
#: inc/fields/image.php:70 inc/fields/thickbox-image.php:34
|
571 |
+
msgid "Upload Images"
|
572 |
+
msgstr ""
|
573 |
+
|
574 |
+
#: inc/fields/image.php:71
|
575 |
+
msgid "+ Add new image"
|
576 |
+
msgstr ""
|
577 |
+
|
578 |
+
#: inc/fields/map.php:46
|
579 |
+
msgid "Find Address"
|
580 |
+
msgstr "Найти адрес на карте"
|
581 |
+
|
582 |
+
#: inc/fields/oembed.php:55
|
583 |
+
msgid "Embed HTML not available."
|
584 |
+
msgstr ""
|
585 |
+
|
586 |
+
#: inc/fields/oembed.php:77
|
587 |
+
msgid "Preview"
|
588 |
+
msgstr ""
|
589 |
+
|
590 |
+
#: inc/fields/plupload-image.php:105
|
591 |
+
msgid "Drop images here"
|
592 |
+
msgstr "Перетащите файлы сюда"
|
593 |
+
|
594 |
+
#: inc/fields/plupload-image.php:106
|
595 |
+
msgid "or"
|
596 |
+
msgstr "или"
|
597 |
+
|
598 |
+
#: inc/fields/plupload-image.php:182
|
599 |
+
msgid "Allowed Image Files"
|
600 |
+
msgstr ""
|
601 |
+
|
602 |
+
#: inc/fields/post.php:67
|
603 |
+
msgid "Select a post"
|
604 |
+
msgstr ""
|
605 |
+
|
606 |
+
#: inc/fields/post.php:71 inc/fields/taxonomy.php:40
|
607 |
+
#, php-format
|
608 |
+
msgid "Select a %s"
|
609 |
+
msgstr "Выберите %s"
|
610 |
+
|
611 |
+
#: inc/fields/select.php:207
|
612 |
+
msgid "All"
|
613 |
+
msgstr "Все"
|
614 |
+
|
615 |
+
#: inc/fields/select.php:207
|
616 |
+
msgid "None"
|
617 |
+
msgstr "Ничего"
|
618 |
+
|
619 |
+
#: inc/fields/user.php:49
|
620 |
+
msgid "Select an user"
|
621 |
+
msgstr ""
|
622 |
+
|
623 |
+
#: inc/meta-box.php:253
|
624 |
+
msgid "Please correct the errors highlighted below and try again."
|
625 |
+
msgstr ""
|
626 |
+
|
627 |
+
#~ msgctxt "image upload"
|
628 |
+
#~ msgid "Drop images here"
|
629 |
+
#~ msgstr "Перетащите файлы сюда"
|
630 |
+
|
631 |
+
#~ msgctxt "image upload"
|
632 |
+
#~ msgid "or"
|
633 |
+
#~ msgstr "или"
|
634 |
+
|
635 |
+
#~ msgctxt "image upload"
|
636 |
+
#~ msgid "Select Files"
|
637 |
+
#~ msgstr "Загрузите с компьютера"
|
{lang → languages}/meta-box-sv_SE.mo
RENAMED
File without changes
|
languages/meta-box-sv_SE.po
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2012-06-03 15:09+0700\n"
|
6 |
+
"PO-Revision-Date: 2012-08-09 16:15+0100\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: Rilwis <rilwis@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
|
13 |
+
"_nx_noop:1,2\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"Language: en_VN\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
19 |
+
|
20 |
+
#: ../meta-box.php:79
|
21 |
+
msgid "RW_Meta_Box Debug:"
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: ../inc/classes/meta-box.php:316
|
25 |
+
msgid "+"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: ../inc/classes/meta-box.php:340
|
29 |
+
msgid "–"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: ../inc/fields/file.php:69
|
33 |
+
msgid "Error: Cannot delete file"
|
34 |
+
msgstr "Fel: Kan inte radera filen"
|
35 |
+
|
36 |
+
#: ../inc/fields/file.php:83
|
37 |
+
msgctxt "file upload"
|
38 |
+
msgid "Uploaded files"
|
39 |
+
msgstr "Uppladdade filer"
|
40 |
+
|
41 |
+
#: ../inc/fields/file.php:84
|
42 |
+
msgctxt "file upload"
|
43 |
+
msgid "Delete this file"
|
44 |
+
msgstr "Radera den här filen"
|
45 |
+
|
46 |
+
#: ../inc/fields/file.php:85
|
47 |
+
msgctxt "file upload"
|
48 |
+
msgid "Delete"
|
49 |
+
msgstr "Radera"
|
50 |
+
|
51 |
+
#: ../inc/fields/file.php:86
|
52 |
+
msgctxt "file upload"
|
53 |
+
msgid "Upload files"
|
54 |
+
msgstr "Ladda upp"
|
55 |
+
|
56 |
+
#: ../inc/fields/file.php:87
|
57 |
+
msgctxt "file upload"
|
58 |
+
msgid "+ Add new file"
|
59 |
+
msgstr "+ Lägg till ny fil"
|
60 |
+
|
61 |
+
#: ../inc/fields/image.php:75
|
62 |
+
msgid "Order saved"
|
63 |
+
msgstr "Ordning sparad"
|
64 |
+
|
65 |
+
#: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
|
66 |
+
msgctxt "image upload"
|
67 |
+
msgid "Uploaded files"
|
68 |
+
msgstr "Uppladdade filer"
|
69 |
+
|
70 |
+
#: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
|
71 |
+
msgctxt "image upload"
|
72 |
+
msgid "Delete this file"
|
73 |
+
msgstr "Radera den här filen"
|
74 |
+
|
75 |
+
#: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
|
76 |
+
msgctxt "image upload"
|
77 |
+
msgid "Delete"
|
78 |
+
msgstr "Radera"
|
79 |
+
|
80 |
+
#: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
|
81 |
+
msgctxt "image upload"
|
82 |
+
msgid "Edit"
|
83 |
+
msgstr "Redigera"
|
84 |
+
|
85 |
+
#: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
|
86 |
+
msgctxt "image upload"
|
87 |
+
msgid "Upload files"
|
88 |
+
msgstr "Ladda upp filer"
|
89 |
+
|
90 |
+
#: ../inc/fields/image.php:96
|
91 |
+
msgctxt "image upload"
|
92 |
+
msgid "+ Add new image"
|
93 |
+
msgstr "+ Lägg till ny bild"
|
94 |
+
|
95 |
+
#: ../inc/fields/plupload-image.php:95
|
96 |
+
msgctxt "image upload"
|
97 |
+
msgid "Allowed Image Files"
|
98 |
+
msgstr "Tillåtna bildformat"
|
99 |
+
|
100 |
+
#: ../inc/fields/plupload-image.php:160
|
101 |
+
msgctxt "image upload"
|
102 |
+
msgid "Drop images here"
|
103 |
+
msgstr "Släpp bilder här"
|
104 |
+
|
105 |
+
#: ../inc/fields/plupload-image.php:161
|
106 |
+
msgctxt "image upload"
|
107 |
+
msgid "or"
|
108 |
+
msgstr "eller"
|
109 |
+
|
110 |
+
#: ../inc/fields/plupload-image.php:162
|
111 |
+
msgctxt "image upload"
|
112 |
+
msgid "Select Files"
|
113 |
+
msgstr "Välj filer"
|
114 |
+
|
115 |
+
#: ../inc/fields/thickbox-image.php:45
|
116 |
+
msgctxt "image upload"
|
117 |
+
msgid "Upload image"
|
118 |
+
msgstr "Ladda upp bild"
|
{lang → languages}/meta-box-tr_TR.mo
RENAMED
File without changes
|
languages/meta-box-tr_TR.po
ADDED
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box Script For WordPress\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-06-03 22:19+0700\n"
|
6 |
+
"PO-Revision-Date: 2013-07-13 01:40+0200\n"
|
7 |
+
"Last-Translator: Rilwis <rilwis@gmail.com>\n"
|
8 |
+
"Language-Team: Rilwis <rilwis@gmail.com>\n"
|
9 |
+
"Language: en_EN\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
|
14 |
+
"_nx_noop:1,2\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Generator: Poedit 1.5.5\n"
|
18 |
+
"X-Poedit-SearchPath-0: ..\n"
|
19 |
+
"X-Poedit-SearchPath-1: ../inc/fields\n"
|
20 |
+
|
21 |
+
#: ../demo/all-custom-post-types.php:20
|
22 |
+
msgid "Personal Information"
|
23 |
+
msgstr "Kişisel Bilgiler"
|
24 |
+
|
25 |
+
#: ../demo/all-custom-post-types.php:25
|
26 |
+
msgid "Full name"
|
27 |
+
msgstr "Tam İsminiz"
|
28 |
+
|
29 |
+
#: ../demo/better-include.php:16 ../demo/include-by-ID-or-page-template.php:8
|
30 |
+
msgid "Meta Box Title"
|
31 |
+
msgstr "Meta Box Başlığı"
|
32 |
+
|
33 |
+
#: ../demo/better-include.php:19 ../demo/include-by-ID-or-page-template.php:14
|
34 |
+
msgid "Your images"
|
35 |
+
msgstr "Resiminiz"
|
36 |
+
|
37 |
+
#: ../demo/date-time-js-options.php:11
|
38 |
+
msgid "Date Time Picker With JS Options"
|
39 |
+
msgstr "JS Seçenekleriyle Tarih Saat Seçici"
|
40 |
+
|
41 |
+
#: ../demo/date-time-js-options.php:15
|
42 |
+
msgid "Date"
|
43 |
+
msgstr "Tarih"
|
44 |
+
|
45 |
+
#: ../demo/date-time-js-options.php:21 ../demo/demo.php:177
|
46 |
+
msgid "(yyyy-mm-dd)"
|
47 |
+
msgstr "(yyyy-aa-gg)"
|
48 |
+
|
49 |
+
#: ../demo/date-time-js-options.php:23
|
50 |
+
msgid "Select Date"
|
51 |
+
msgstr "Tarih Seç"
|
52 |
+
|
53 |
+
#: ../demo/date-time-js-options.php:24 ../demo/demo.php:178
|
54 |
+
msgid "yy-mm-dd"
|
55 |
+
msgstr "yy-aa-gg"
|
56 |
+
|
57 |
+
#: ../demo/date-time-js-options.php:30
|
58 |
+
msgid "Datetime"
|
59 |
+
msgstr "Tarihsaat"
|
60 |
+
|
61 |
+
#: ../demo/date-time-js-options.php:41
|
62 |
+
msgid "Time"
|
63 |
+
msgstr "Saat"
|
64 |
+
|
65 |
+
#: ../demo/demo.php:34
|
66 |
+
msgid "Standard Fields"
|
67 |
+
msgstr "Standart Alanlar"
|
68 |
+
|
69 |
+
#: ../demo/demo.php:53
|
70 |
+
msgid "Text"
|
71 |
+
msgstr "Yazı"
|
72 |
+
|
73 |
+
#: ../demo/demo.php:57
|
74 |
+
msgid "Text description"
|
75 |
+
msgstr "Yazı Açıklaması"
|
76 |
+
|
77 |
+
#: ../demo/demo.php:60
|
78 |
+
msgid "Default text value"
|
79 |
+
msgstr "Varsayılan yazı değeri"
|
80 |
+
|
81 |
+
#: ../demo/demo.php:66
|
82 |
+
msgid "Checkbox"
|
83 |
+
msgstr "Onay Kutusu"
|
84 |
+
|
85 |
+
#: ../demo/demo.php:74
|
86 |
+
msgid "Radio"
|
87 |
+
msgstr "Seçim Kutusu"
|
88 |
+
|
89 |
+
#: ../demo/demo.php:80 ../demo/demo.php:91 ../demo/demo.php:226
|
90 |
+
msgid "Label1"
|
91 |
+
msgstr "Etiket1"
|
92 |
+
|
93 |
+
#: ../demo/demo.php:81 ../demo/demo.php:92 ../demo/demo.php:227
|
94 |
+
msgid "Label2"
|
95 |
+
msgstr "Etiket2"
|
96 |
+
|
97 |
+
#: ../demo/demo.php:86
|
98 |
+
msgid "Select"
|
99 |
+
msgstr "Seç"
|
100 |
+
|
101 |
+
#: ../demo/demo.php:96
|
102 |
+
msgid "Select an Item"
|
103 |
+
msgstr "Bir Nesne Seçin"
|
104 |
+
|
105 |
+
#: ../demo/demo.php:103
|
106 |
+
msgid "Hidden value"
|
107 |
+
msgstr "Gizli Alan"
|
108 |
+
|
109 |
+
#: ../demo/demo.php:107
|
110 |
+
msgid "Password"
|
111 |
+
msgstr "Parola"
|
112 |
+
|
113 |
+
#: ../demo/demo.php:113
|
114 |
+
msgid "Textarea"
|
115 |
+
msgstr "Yazı Alanı"
|
116 |
+
|
117 |
+
#: ../demo/demo.php:114
|
118 |
+
msgid "Textarea description"
|
119 |
+
msgstr "Yazı Alanı Açıklaması"
|
120 |
+
|
121 |
+
#: ../demo/demo.php:131
|
122 |
+
msgid "Password is required"
|
123 |
+
msgstr "Parola Gerekli"
|
124 |
+
|
125 |
+
#: ../demo/demo.php:132
|
126 |
+
msgid "Password must be at least 7 characters"
|
127 |
+
msgstr "Parolanız 7 karakterden fazla olmalıdır"
|
128 |
+
|
129 |
+
#: ../demo/demo.php:140
|
130 |
+
msgid "Advanced Fields"
|
131 |
+
msgstr "Gelişmiş Alanlar"
|
132 |
+
|
133 |
+
#: ../demo/demo.php:145
|
134 |
+
msgid "Slider"
|
135 |
+
msgstr "Slider"
|
136 |
+
|
137 |
+
#: ../demo/demo.php:150
|
138 |
+
msgid "$"
|
139 |
+
msgstr "$"
|
140 |
+
|
141 |
+
#: ../demo/demo.php:151
|
142 |
+
msgid " USD"
|
143 |
+
msgstr "USD"
|
144 |
+
|
145 |
+
#: ../demo/demo.php:162
|
146 |
+
msgid "Number"
|
147 |
+
msgstr "Numara"
|
148 |
+
|
149 |
+
#: ../demo/demo.php:171
|
150 |
+
msgid "Date picker"
|
151 |
+
msgstr "Tarih Seçici"
|
152 |
+
|
153 |
+
#: ../demo/demo.php:186
|
154 |
+
msgid "Datetime picker"
|
155 |
+
msgstr "Tarih Saat Seçici"
|
156 |
+
|
157 |
+
#: ../demo/demo.php:200
|
158 |
+
msgid "Time picker"
|
159 |
+
msgstr "Saat Seçici"
|
160 |
+
|
161 |
+
#: ../demo/demo.php:215
|
162 |
+
msgid "Color picker"
|
163 |
+
msgstr "Renk Seçici"
|
164 |
+
|
165 |
+
#: ../demo/demo.php:221
|
166 |
+
msgid "Checkbox list"
|
167 |
+
msgstr "Onay Kutusu Litesi"
|
168 |
+
|
169 |
+
#: ../demo/demo.php:232
|
170 |
+
msgid "Email"
|
171 |
+
msgstr "E-Posta"
|
172 |
+
|
173 |
+
#: ../demo/demo.php:234
|
174 |
+
msgid "Email description"
|
175 |
+
msgstr "E-Posta Açıklaması"
|
176 |
+
|
177 |
+
#: ../demo/demo.php:240
|
178 |
+
msgid "Range"
|
179 |
+
msgstr "Aralık"
|
180 |
+
|
181 |
+
#: ../demo/demo.php:242
|
182 |
+
msgid "Range description"
|
183 |
+
msgstr "Aralık Açıklması"
|
184 |
+
|
185 |
+
#: ../demo/demo.php:251
|
186 |
+
msgid "URL"
|
187 |
+
msgstr "URL"
|
188 |
+
|
189 |
+
#: ../demo/demo.php:253
|
190 |
+
msgid "URL description"
|
191 |
+
msgstr "URL Açıklaması"
|
192 |
+
|
193 |
+
#: ../demo/demo.php:259
|
194 |
+
msgid "oEmbed"
|
195 |
+
msgstr "oEmbed"
|
196 |
+
|
197 |
+
#: ../demo/demo.php:261
|
198 |
+
msgid "oEmbed description"
|
199 |
+
msgstr "oEmbed Açıklaması"
|
200 |
+
|
201 |
+
#: ../demo/demo.php:266
|
202 |
+
msgid "Taxonomy"
|
203 |
+
msgstr "Taxonomy"
|
204 |
+
|
205 |
+
#: ../demo/demo.php:280
|
206 |
+
msgid "Posts (Pages)"
|
207 |
+
msgstr "Yazılar (Sayfalar)"
|
208 |
+
|
209 |
+
#: ../demo/demo.php:296
|
210 |
+
msgid "WYSIWYG / Rich Text Editor"
|
211 |
+
msgstr "WYSIWYG / Gelişmiş Yazı Editörü"
|
212 |
+
|
213 |
+
#: ../demo/demo.php:301
|
214 |
+
msgid "WYSIWYG default value"
|
215 |
+
msgstr "WYSIWYG varsayılan değer"
|
216 |
+
|
217 |
+
#: ../demo/demo.php:312 ../demo/force-delete.php:15
|
218 |
+
msgid "File Upload"
|
219 |
+
msgstr "Dosya Yükleme"
|
220 |
+
|
221 |
+
#: ../demo/demo.php:318
|
222 |
+
msgid "File Advanced Upload"
|
223 |
+
msgstr "Gelişmiş Dosya Yükleme"
|
224 |
+
|
225 |
+
#: ../demo/demo.php:326 ../demo/force-delete.php:22
|
226 |
+
msgid "Image Upload"
|
227 |
+
msgstr "Resim Yükleme"
|
228 |
+
|
229 |
+
#: ../demo/demo.php:332 ../demo/force-delete.php:28
|
230 |
+
msgid "Thickbox Image Upload"
|
231 |
+
msgstr "Thickbox Resim Yükleme"
|
232 |
+
|
233 |
+
#: ../demo/demo.php:338 ../demo/force-delete.php:35
|
234 |
+
msgid "Plupload Image Upload"
|
235 |
+
msgstr "Plupload Resim Yükleme"
|
236 |
+
|
237 |
+
#: ../demo/demo.php:345
|
238 |
+
msgid "Image Advanced Upload"
|
239 |
+
msgstr "Gelişmiş Resim Yükleme"
|
240 |
+
|
241 |
+
#: ../demo/force-delete.php:11
|
242 |
+
msgid "Test Meta Box"
|
243 |
+
msgstr "Test Meta Box"
|
244 |
+
|
245 |
+
#: ../demo/map.php:9
|
246 |
+
msgid "Google Map"
|
247 |
+
msgstr "Google Haritalar"
|
248 |
+
|
249 |
+
#: ../demo/map.php:13
|
250 |
+
msgid "Address"
|
251 |
+
msgstr "Adres"
|
252 |
+
|
253 |
+
#: ../demo/map.php:15
|
254 |
+
msgid "Hanoi, Vietnam"
|
255 |
+
msgstr "Hanoi, Vietnam"
|
256 |
+
|
257 |
+
#: ../demo/map.php:19
|
258 |
+
msgid "Location"
|
259 |
+
msgstr "Yer Bilgisi"
|
260 |
+
|
261 |
+
#: ../inc/classes/meta-box.php:220
|
262 |
+
msgid "Please correct the errors highlighted below and try again."
|
263 |
+
msgstr "Lütfen işaretlenmiş alanları düzeltin ve tekrar deneyin."
|
264 |
+
|
265 |
+
#: ../inc/classes/meta-box.php:394
|
266 |
+
msgid "+"
|
267 |
+
msgstr "+"
|
268 |
+
|
269 |
+
#: ../inc/classes/meta-box.php:416
|
270 |
+
msgid "–"
|
271 |
+
msgstr "–"
|
272 |
+
|
273 |
+
#: ../inc/fields/file-advanced.php:23
|
274 |
+
#, php-format
|
275 |
+
msgid "You may only upload maximum %d file"
|
276 |
+
msgstr "Yükleme yapabileceğiniz maksimum dosya sayısı %d dır"
|
277 |
+
|
278 |
+
#: ../inc/fields/file-advanced.php:24
|
279 |
+
#, php-format
|
280 |
+
msgid "You may only upload maximum %d files"
|
281 |
+
msgstr "Yükleme yapabileceğiniz maksimum dosya sayısı %d dır"
|
282 |
+
|
283 |
+
#: ../inc/fields/file-advanced.php:25
|
284 |
+
msgid "Select Files"
|
285 |
+
msgstr "Dosya Seç"
|
286 |
+
|
287 |
+
#: ../inc/fields/file-advanced.php:68
|
288 |
+
msgctxt "file upload"
|
289 |
+
msgid "Select or Upload Files"
|
290 |
+
msgstr "Seç veya Dosya Yükle"
|
291 |
+
|
292 |
+
#: ../inc/fields/file-advanced.php:104 ../inc/fields/file.php:133
|
293 |
+
msgctxt "file upload"
|
294 |
+
msgid "Delete"
|
295 |
+
msgstr "Sil"
|
296 |
+
|
297 |
+
#: ../inc/fields/file-advanced.php:105 ../inc/fields/file.php:134
|
298 |
+
msgctxt "file upload"
|
299 |
+
msgid "Edit"
|
300 |
+
msgstr "Düzenle"
|
301 |
+
|
302 |
+
#: ../inc/fields/file.php:66
|
303 |
+
msgid "Error: Cannot delete file"
|
304 |
+
msgstr "Hata: Dosya Silinemedi"
|
305 |
+
|
306 |
+
#: ../inc/fields/file.php:80
|
307 |
+
msgctxt "file upload"
|
308 |
+
msgid "Upload Files"
|
309 |
+
msgstr "Dosya Yükleme"
|
310 |
+
|
311 |
+
#: ../inc/fields/file.php:81
|
312 |
+
msgctxt "file upload"
|
313 |
+
msgid "+ Add new file"
|
314 |
+
msgstr "+ Yeni Dosya Ekle"
|
315 |
+
|
316 |
+
#: ../inc/fields/image-advanced.php:22
|
317 |
+
msgid "Select Images"
|
318 |
+
msgstr "Resim Seç"
|
319 |
+
|
320 |
+
#: ../inc/fields/image-advanced.php:71
|
321 |
+
msgctxt "image upload"
|
322 |
+
msgid "Select or Upload Images"
|
323 |
+
msgstr "Seç veya Resim Yükle"
|
324 |
+
|
325 |
+
#: ../inc/fields/image-advanced.php:107 ../inc/fields/image.php:144
|
326 |
+
msgctxt "image upload"
|
327 |
+
msgid "Delete"
|
328 |
+
msgstr "Sil"
|
329 |
+
|
330 |
+
#: ../inc/fields/image-advanced.php:108 ../inc/fields/image.php:145
|
331 |
+
msgctxt "image upload"
|
332 |
+
msgid "Edit"
|
333 |
+
msgstr "Düzenle"
|
334 |
+
|
335 |
+
#: ../inc/fields/image.php:64
|
336 |
+
msgid "Order saved"
|
337 |
+
msgstr "Görev Kaydedildi"
|
338 |
+
|
339 |
+
#: ../inc/fields/image.php:78 ../inc/fields/thickbox-image.php:35
|
340 |
+
msgctxt "image upload"
|
341 |
+
msgid "Upload Images"
|
342 |
+
msgstr "Resim Yükle"
|
343 |
+
|
344 |
+
#: ../inc/fields/image.php:79
|
345 |
+
msgctxt "image upload"
|
346 |
+
msgid "+ Add new image"
|
347 |
+
msgstr "+ Yeni Resim Ekle"
|
348 |
+
|
349 |
+
#: ../inc/fields/map.php:48
|
350 |
+
msgid "Find Address"
|
351 |
+
msgstr "Adres Bul"
|
352 |
+
|
353 |
+
#: ../inc/fields/plupload-image.php:104
|
354 |
+
msgctxt "image upload"
|
355 |
+
msgid "Drop images here"
|
356 |
+
msgstr "Resimi Buraya Sürükleyin"
|
357 |
+
|
358 |
+
#: ../inc/fields/plupload-image.php:105
|
359 |
+
msgctxt "image upload"
|
360 |
+
msgid "or"
|
361 |
+
msgstr "veya"
|
362 |
+
|
363 |
+
#: ../inc/fields/plupload-image.php:106
|
364 |
+
msgctxt "image upload"
|
365 |
+
msgid "Select Files"
|
366 |
+
msgstr "Dosya Seçin"
|
367 |
+
|
368 |
+
#: ../inc/fields/plupload-image.php:181
|
369 |
+
msgctxt "image upload"
|
370 |
+
msgid "Allowed Image Files"
|
371 |
+
msgstr "İzin Verilen Resim Tipleri"
|
372 |
+
|
373 |
+
#: ../inc/fields/post.php:54
|
374 |
+
msgid "Post"
|
375 |
+
msgstr "Yazı"
|
376 |
+
|
377 |
+
#: ../inc/fields/post.php:68 ../inc/fields/taxonomy.php:40
|
378 |
+
#, php-format
|
379 |
+
msgid "Select a %s"
|
380 |
+
msgstr "Seç bir %s"
|
381 |
+
|
382 |
+
#: ../inc/fields/select-advanced.php:71
|
383 |
+
msgid "Select a value"
|
384 |
+
msgstr "Bir değer seçin"
|
{lang → languages}/meta-box-zh_CN.mo
RENAMED
File without changes
|
languages/meta-box-zh_CN.po
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box v4.8.7\n"
|
4 |
+
"POT-Creation-Date: 2016-06-03 16:24+0800\n"
|
5 |
+
"PO-Revision-Date: \n"
|
6 |
+
"Last-Translator: OOME <1049879335@qq.com>\n"
|
7 |
+
"Language-Team: 偶米工作室 <1049879335@qq.com>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_nx:1,2;_n_noop:1,2\n"
|
13 |
+
"X-Poedit-Basepath: C:\\xampp\\htdocs\\000\\wp-content\\plugins\\meta-box"
|
14 |
+
"\\lang\n"
|
15 |
+
"X-Poedit-SearchPath-0: ..\n"
|
16 |
+
|
17 |
+
#: ../inc/core.php:40
|
18 |
+
msgid "Documentation"
|
19 |
+
msgstr "文档"
|
20 |
+
|
21 |
+
#: ../inc/core.php:41
|
22 |
+
msgid "Extensions"
|
23 |
+
msgstr "扩展"
|
24 |
+
|
25 |
+
#: ../inc/field.php:192
|
26 |
+
msgid "+ Add more"
|
27 |
+
msgstr "+ 新增"
|
28 |
+
|
29 |
+
#: ../inc/validation.php:49
|
30 |
+
msgid "Please correct the errors highlighted below and try again."
|
31 |
+
msgstr "请修正高亮位置的错误,并重新尝试。"
|
32 |
+
|
33 |
+
#: ../inc/fields/autocomplete.php:23 ../inc/fields/autocomplete.php:87
|
34 |
+
#: ../inc/fields/autocomplete.php:104
|
35 |
+
msgid "Delete"
|
36 |
+
msgstr "删除"
|
37 |
+
|
38 |
+
#: ../inc/fields/button.php:29
|
39 |
+
msgid "Click me"
|
40 |
+
msgstr "点我"
|
41 |
+
|
42 |
+
#: ../inc/fields/checkbox.php:82
|
43 |
+
msgid "Yes"
|
44 |
+
msgstr "是"
|
45 |
+
|
46 |
+
#: ../inc/fields/checkbox.php:82
|
47 |
+
msgid "No"
|
48 |
+
msgstr "否"
|
49 |
+
|
50 |
+
#: ../inc/fields/file-input.php:25
|
51 |
+
msgid "Select File"
|
52 |
+
msgstr "选择文件"
|
53 |
+
|
54 |
+
#: ../inc/fields/file-input.php:49 ../inc/fields/select.php:91
|
55 |
+
msgid "Select"
|
56 |
+
msgstr "选择"
|
57 |
+
|
58 |
+
#: ../inc/fields/file-input.php:51
|
59 |
+
msgid "Remove"
|
60 |
+
msgstr "移除"
|
61 |
+
|
62 |
+
#: ../inc/fields/file.php:24
|
63 |
+
#, php-format
|
64 |
+
msgid "You may only upload maximum %d file"
|
65 |
+
msgstr "您允许上传的文件上限为 %d 个。"
|
66 |
+
|
67 |
+
#: ../inc/fields/file.php:25
|
68 |
+
#, php-format
|
69 |
+
msgid "You may only upload maximum %d files"
|
70 |
+
msgstr "您允许上传的文件上限为 %d 个。"
|
71 |
+
|
72 |
+
#: ../inc/fields/file.php:85
|
73 |
+
msgid "Error: Cannot delete file"
|
74 |
+
msgstr "错误:无法删除文件。"
|
75 |
+
|
76 |
+
#: ../inc/fields/file.php:98
|
77 |
+
msgctxt "file upload"
|
78 |
+
msgid "Upload Files"
|
79 |
+
msgstr "上传文件"
|
80 |
+
|
81 |
+
#: ../inc/fields/file.php:99
|
82 |
+
msgctxt "file upload"
|
83 |
+
msgid "+ Add new file"
|
84 |
+
msgstr "+ 新增文件"
|
85 |
+
|
86 |
+
#: ../inc/fields/file.php:162
|
87 |
+
msgctxt "file upload"
|
88 |
+
msgid "Delete"
|
89 |
+
msgstr "删除"
|
90 |
+
|
91 |
+
#: ../inc/fields/file.php:163
|
92 |
+
msgctxt "file upload"
|
93 |
+
msgid "Edit"
|
94 |
+
msgstr "编辑"
|
95 |
+
|
96 |
+
#: ../inc/fields/map.php:49
|
97 |
+
msgid "Find Address"
|
98 |
+
msgstr "查找地址"
|
99 |
+
|
100 |
+
#: ../inc/fields/media.php:25
|
101 |
+
msgctxt "media"
|
102 |
+
msgid "+ Add Media"
|
103 |
+
msgstr "从媒体库选择"
|
104 |
+
|
105 |
+
#: ../inc/fields/media.php:26
|
106 |
+
msgctxt "media"
|
107 |
+
msgid " file"
|
108 |
+
msgstr "文件"
|
109 |
+
|
110 |
+
#: ../inc/fields/media.php:27
|
111 |
+
msgctxt "media"
|
112 |
+
msgid " files"
|
113 |
+
msgstr "文件"
|
114 |
+
|
115 |
+
#: ../inc/fields/media.php:28
|
116 |
+
msgctxt "media"
|
117 |
+
msgid "Remove"
|
118 |
+
msgstr "移除"
|
119 |
+
|
120 |
+
#: ../inc/fields/media.php:29
|
121 |
+
msgctxt "media"
|
122 |
+
msgid "Edit"
|
123 |
+
msgstr "编辑"
|
124 |
+
|
125 |
+
#: ../inc/fields/media.php:30
|
126 |
+
msgctxt "media"
|
127 |
+
msgid "View"
|
128 |
+
msgstr "查看"
|
129 |
+
|
130 |
+
#: ../inc/fields/media.php:31
|
131 |
+
msgctxt "media"
|
132 |
+
msgid "No Title"
|
133 |
+
msgstr "无标题"
|
134 |
+
|
135 |
+
#: ../inc/fields/media.php:34
|
136 |
+
msgctxt "media"
|
137 |
+
msgid "Select Files"
|
138 |
+
msgstr "选择图像"
|
139 |
+
|
140 |
+
#: ../inc/fields/media.php:35
|
141 |
+
msgctxt "media"
|
142 |
+
msgid "or"
|
143 |
+
msgstr " 或"
|
144 |
+
|
145 |
+
#: ../inc/fields/media.php:36
|
146 |
+
msgctxt "media"
|
147 |
+
msgid "Drop files here to upload"
|
148 |
+
msgstr "请把文件拖动到该区域上传"
|
149 |
+
|
150 |
+
#: ../inc/fields/oembed.php:65
|
151 |
+
msgid "Embed HTML not available."
|
152 |
+
msgstr ""
|
153 |
+
"oEmbed 代码无效,请检查。 如需了解更多 oEmbed 信息和支持的网站,请访问 <a "
|
154 |
+
"href=\"http://codex.wordpress.org/Embeds\" target=\"_blank\">WordPress 官网</"
|
155 |
+
"a>。"
|
156 |
+
|
157 |
+
#: ../inc/fields/post.php:34
|
158 |
+
msgid "Select a post"
|
159 |
+
msgstr "选择文章"
|
160 |
+
|
161 |
+
#: ../inc/fields/post.php:38 ../inc/fields/taxonomy.php:51
|
162 |
+
#, php-format
|
163 |
+
msgid "Select a %s"
|
164 |
+
msgstr "选择%s"
|
165 |
+
|
166 |
+
#: ../inc/fields/select-advanced.php:44
|
167 |
+
msgid "Select an item"
|
168 |
+
msgstr "选择项目"
|
169 |
+
|
170 |
+
#: ../inc/fields/select.php:91
|
171 |
+
msgid "All"
|
172 |
+
msgstr "全部"
|
173 |
+
|
174 |
+
#: ../inc/fields/select.php:91
|
175 |
+
msgid "None"
|
176 |
+
msgstr "无"
|
177 |
+
|
178 |
+
#: ../inc/fields/taxonomy.php:47
|
179 |
+
msgid "Select a term"
|
180 |
+
msgstr "选择分类"
|
181 |
+
|
182 |
+
#: ../inc/fields/thickbox-image.php:53
|
183 |
+
msgctxt "image upload"
|
184 |
+
msgid "Upload Images"
|
185 |
+
msgstr "上传图像"
|
186 |
+
|
187 |
+
#: ../inc/fields/user.php:34
|
188 |
+
msgid "Select an user"
|
189 |
+
msgstr "选择用户"
|
{lang → languages}/meta-box-zh_TW.mo
RENAMED
File without changes
|
languages/meta-box-zh_TW.po
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Meta Box v4.8.7\n"
|
4 |
+
"POT-Creation-Date: 2016-06-03 16:24+0800\n"
|
5 |
+
"PO-Revision-Date: \n"
|
6 |
+
"Last-Translator: OOME <1049879335@qq.com>\n"
|
7 |
+
"Language-Team: 偶米工作室 <1049879335@qq.com>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x:2c,1;_nx:1,2;_n_noop:1,2\n"
|
13 |
+
"X-Poedit-Basepath: C:\\xampp\\htdocs\\000\\wp-content\\plugins\\meta-box"
|
14 |
+
"\\lang\n"
|
15 |
+
"X-Poedit-SearchPath-0: ..\n"
|
16 |
+
|
17 |
+
#: ../inc/core.php:40
|
18 |
+
msgid "Documentation"
|
19 |
+
msgstr "文檔"
|
20 |
+
|
21 |
+
#: ../inc/core.php:41
|
22 |
+
msgid "Extensions"
|
23 |
+
msgstr "擴展"
|
24 |
+
|
25 |
+
#: ../inc/field.php:192
|
26 |
+
msgid "+ Add more"
|
27 |
+
msgstr "+ 新增"
|
28 |
+
|
29 |
+
#: ../inc/validation.php:49
|
30 |
+
msgid "Please correct the errors highlighted below and try again."
|
31 |
+
msgstr "請修正高亮位置的錯誤,並重新嘗試。"
|
32 |
+
|
33 |
+
#: ../inc/fields/autocomplete.php:23 ../inc/fields/autocomplete.php:87
|
34 |
+
#: ../inc/fields/autocomplete.php:104
|
35 |
+
msgid "Delete"
|
36 |
+
msgstr "刪除"
|
37 |
+
|
38 |
+
#: ../inc/fields/button.php:29
|
39 |
+
msgid "Click me"
|
40 |
+
msgstr "點我"
|
41 |
+
|
42 |
+
#: ../inc/fields/checkbox.php:82
|
43 |
+
msgid "Yes"
|
44 |
+
msgstr "是"
|
45 |
+
|
46 |
+
#: ../inc/fields/checkbox.php:82
|
47 |
+
msgid "No"
|
48 |
+
msgstr "否"
|
49 |
+
|
50 |
+
#: ../inc/fields/file-input.php:25
|
51 |
+
msgid "Select File"
|
52 |
+
msgstr "選擇檔"
|
53 |
+
|
54 |
+
#: ../inc/fields/file-input.php:49 ../inc/fields/select.php:91
|
55 |
+
msgid "Select"
|
56 |
+
msgstr "選擇"
|
57 |
+
|
58 |
+
#: ../inc/fields/file-input.php:51
|
59 |
+
msgid "Remove"
|
60 |
+
msgstr "移除"
|
61 |
+
|
62 |
+
#: ../inc/fields/file.php:24
|
63 |
+
#, php-format
|
64 |
+
msgid "You may only upload maximum %d file"
|
65 |
+
msgstr "您允許上傳的檔上限為 %d 個。"
|
66 |
+
|
67 |
+
#: ../inc/fields/file.php:25
|
68 |
+
#, php-format
|
69 |
+
msgid "You may only upload maximum %d files"
|
70 |
+
msgstr "您允許上傳的檔上限為 %d 個。"
|
71 |
+
|
72 |
+
#: ../inc/fields/file.php:85
|
73 |
+
msgid "Error: Cannot delete file"
|
74 |
+
msgstr "錯誤:無法刪除檔。"
|
75 |
+
|
76 |
+
#: ../inc/fields/file.php:98
|
77 |
+
msgctxt "file upload"
|
78 |
+
msgid "Upload Files"
|
79 |
+
msgstr "上傳文件"
|
80 |
+
|
81 |
+
#: ../inc/fields/file.php:99
|
82 |
+
msgctxt "file upload"
|
83 |
+
msgid "+ Add new file"
|
84 |
+
msgstr "+ 新增文件"
|
85 |
+
|
86 |
+
#: ../inc/fields/file.php:162
|
87 |
+
msgctxt "file upload"
|
88 |
+
msgid "Delete"
|
89 |
+
msgstr "刪除"
|
90 |
+
|
91 |
+
#: ../inc/fields/file.php:163
|
92 |
+
msgctxt "file upload"
|
93 |
+
msgid "Edit"
|
94 |
+
msgstr "編輯"
|
95 |
+
|
96 |
+
#: ../inc/fields/map.php:49
|
97 |
+
msgid "Find Address"
|
98 |
+
msgstr "查找位址"
|
99 |
+
|
100 |
+
#: ../inc/fields/media.php:25
|
101 |
+
msgctxt "media"
|
102 |
+
msgid "+ Add Media"
|
103 |
+
msgstr "從媒體庫選擇"
|
104 |
+
|
105 |
+
#: ../inc/fields/media.php:26
|
106 |
+
msgctxt "media"
|
107 |
+
msgid " file"
|
108 |
+
msgstr "文件"
|
109 |
+
|
110 |
+
#: ../inc/fields/media.php:27
|
111 |
+
msgctxt "media"
|
112 |
+
msgid " files"
|
113 |
+
msgstr "文件"
|
114 |
+
|
115 |
+
#: ../inc/fields/media.php:28
|
116 |
+
msgctxt "media"
|
117 |
+
msgid "Remove"
|
118 |
+
msgstr "移除"
|
119 |
+
|
120 |
+
#: ../inc/fields/media.php:29
|
121 |
+
msgctxt "media"
|
122 |
+
msgid "Edit"
|
123 |
+
msgstr "編輯"
|
124 |
+
|
125 |
+
#: ../inc/fields/media.php:30
|
126 |
+
msgctxt "media"
|
127 |
+
msgid "View"
|
128 |
+
msgstr "查看"
|
129 |
+
|
130 |
+
#: ../inc/fields/media.php:31
|
131 |
+
msgctxt "media"
|
132 |
+
msgid "No Title"
|
133 |
+
msgstr "無標題"
|
134 |
+
|
135 |
+
#: ../inc/fields/media.php:34
|
136 |
+
msgctxt "media"
|
137 |
+
msgid "Select Files"
|
138 |
+
msgstr "選擇圖像"
|
139 |
+
|
140 |
+
#: ../inc/fields/media.php:35
|
141 |
+
msgctxt "media"
|
142 |
+
msgid "or"
|
143 |
+
msgstr " 或"
|
144 |
+
|
145 |
+
#: ../inc/fields/media.php:36
|
146 |
+
msgctxt "media"
|
147 |
+
msgid "Drop files here to upload"
|
148 |
+
msgstr "請把檔拖動到該區域上傳"
|
149 |
+
|
150 |
+
#: ../inc/fields/oembed.php:65
|
151 |
+
msgid "Embed HTML not available."
|
152 |
+
msgstr ""
|
153 |
+
"oEmbed 代碼無效,請檢查。 如需瞭解更多 oEmbed 資訊和支援的網站,請訪問 <a "
|
154 |
+
"href=\"http://codex.wordpress.org/Embeds\" target=\"_blank\">WordPress 官網</"
|
155 |
+
"a>。"
|
156 |
+
|
157 |
+
#: ../inc/fields/post.php:34
|
158 |
+
msgid "Select a post"
|
159 |
+
msgstr "選擇文章"
|
160 |
+
|
161 |
+
#: ../inc/fields/post.php:38 ../inc/fields/taxonomy.php:51
|
162 |
+
#, php-format
|
163 |
+
msgid "Select a %s"
|
164 |
+
msgstr "選擇%s"
|
165 |
+
|
166 |
+
#: ../inc/fields/select-advanced.php:44
|
167 |
+
msgid "Select an item"
|
168 |
+
msgstr "選擇項目"
|
169 |
+
|
170 |
+
#: ../inc/fields/select.php:91
|
171 |
+
msgid "All"
|
172 |
+
msgstr "全部"
|
173 |
+
|
174 |
+
#: ../inc/fields/select.php:91
|
175 |
+
msgid "None"
|
176 |
+
msgstr "無"
|
177 |
+
|
178 |
+
#: ../inc/fields/taxonomy.php:47
|
179 |
+
msgid "Select a term"
|
180 |
+
msgstr "選擇分類"
|
181 |
+
|
182 |
+
#: ../inc/fields/thickbox-image.php:53
|
183 |
+
msgctxt "image upload"
|
184 |
+
msgid "Upload Images"
|
185 |
+
msgstr "上傳圖像"
|
186 |
+
|
187 |
+
#: ../inc/fields/user.php:34
|
188 |
+
msgid "Select an user"
|
189 |
+
msgstr "選擇用戶"
|
meta-box.php
CHANGED
@@ -3,16 +3,15 @@
|
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields for any post type in WordPress.
|
6 |
-
* Version: 4.9.
|
7 |
* Author: Rilwis
|
8 |
* Author URI: http://www.deluxeblogtips.com
|
9 |
* License: GPL2+
|
10 |
* Text Domain: meta-box
|
11 |
-
* Domain Path: /
|
12 |
*/
|
13 |
|
14 |
-
if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) )
|
15 |
-
{
|
16 |
require_once dirname( __FILE__ ) . '/inc/loader.php';
|
17 |
$loader = new RWMB_Loader;
|
18 |
$loader->init();
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields for any post type in WordPress.
|
6 |
+
* Version: 4.9.7
|
7 |
* Author: Rilwis
|
8 |
* Author URI: http://www.deluxeblogtips.com
|
9 |
* License: GPL2+
|
10 |
* Text Domain: meta-box
|
11 |
+
* Domain Path: /languages/
|
12 |
*/
|
13 |
|
14 |
+
if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
|
|
|
15 |
require_once dirname( __FILE__ ) . '/inc/loader.php';
|
16 |
$loader = new RWMB_Loader;
|
17 |
$loader->init();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.1
|
6 |
Tested up to: 4.6.1
|
7 |
-
Stable tag: 4.9.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a powerful, professional solution to create custom meta boxes and custom fields for WordPress websites.
|
@@ -80,6 +80,14 @@ To getting started with the plugin API, please read [this tutorial](https://meta
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
= 4.9.6 =
|
84 |
* Fix: Wrong CSS selector when cloning wysiwyg field
|
85 |
* Fix: Remove preview for oembed field when cloning
|
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.1
|
6 |
Tested up to: 4.6.1
|
7 |
+
Stable tag: 4.9.7
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a powerful, professional solution to create custom meta boxes and custom fields for WordPress websites.
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 4.9.7 =
|
84 |
+
* Improvement: Re-add change event on media fields to make Conditional Logic extension works with media fields.
|
85 |
+
* Improvement: Add `rwmb_choice_label`, `rwmv_{$field_type}_choice_label` and `rwmb_{field_id}_choice_label` filters for post, user, taxonomy fields, allowing users to customize the labels of choice fields.
|
86 |
+
* Improvement: Change coding styles to follow WordPress Coding Standards.
|
87 |
+
* Various improvements to reduce duplicated code.
|
88 |
+
* Fix: Map field now works in the frontend.
|
89 |
+
* Fix: `std` now works for taxonomy fields.
|
90 |
+
|
91 |
= 4.9.6 =
|
92 |
* Fix: Wrong CSS selector when cloning wysiwyg field
|
93 |
* Fix: Remove preview for oembed field when cloning
|