Meta Box - Version 5.0.0

Version Description

Download this release

Release Info

Developer rilwis
Plugin Icon 128x128 Meta Box
Version 5.0.0
Comparing to
See all releases

Code changes from version 4.18.4 to 5.0.0

css/input-list.css CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  .rwmb-input-list {
2
  margin: 0;
3
  line-height: 1.8;
1
+ .rwmb-toggle-all-wrapper {
2
+ margin-top: 0;
3
+ }
4
  .rwmb-input-list {
5
  margin: 0;
6
  line-height: 1.8;
css/style.css CHANGED
@@ -67,6 +67,8 @@
67
  position: absolute;
68
  top: 0;
69
  right: 0;
 
 
70
  }
71
  .rwmb-button.remove-clone .dashicons {
72
  font-size: 14px;
67
  position: absolute;
68
  top: 0;
69
  right: 0;
70
+ width: 20px;
71
+ height: 20px;
72
  }
73
  .rwmb-button.remove-clone .dashicons {
74
  font-size: 14px;
inc/core.php CHANGED
@@ -47,12 +47,11 @@ class RWMB_Core {
47
  * - no need to check for class existences.
48
  */
49
  public function register_meta_boxes() {
50
- $configs = apply_filters( 'rwmb_meta_boxes', array() );
51
- $meta_boxes = rwmb_get_registry( 'meta_box' );
52
 
53
  foreach ( $configs as $config ) {
54
- $meta_box = rwmb_get_meta_box( $config );
55
- $meta_boxes->add( $meta_box );
56
  $meta_box->register_fields();
57
  }
58
  }
47
  * - no need to check for class existences.
48
  */
49
  public function register_meta_boxes() {
50
+ $configs = apply_filters( 'rwmb_meta_boxes', array() );
51
+ $registry = rwmb_get_registry( 'meta_box' );
52
 
53
  foreach ( $configs as $config ) {
54
+ $meta_box = $registry->make( $config );
 
55
  $meta_box->register_fields();
56
  }
57
  }
inc/fields/input-list.php CHANGED
@@ -89,7 +89,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field {
89
  */
90
  public static function get_select_all_html( $field ) {
91
  if ( $field['multiple'] && $field['select_all_none'] ) {
92
- return sprintf( '<p><button class="rwmb-input-list-select-all-none button" data-name="%s">%s</button></p>', $field['id'], __( 'Toggle All', 'meta-box' ) );
93
  }
94
  return '';
95
  }
89
  */
90
  public static function get_select_all_html( $field ) {
91
  if ( $field['multiple'] && $field['select_all_none'] ) {
92
+ return sprintf( '<p class="rwmb-toggle-all-wrapper"><button class="rwmb-input-list-select-all-none button" data-name="%s">%s</button></p>', $field['id'], __( 'Toggle All', 'meta-box' ) );
93
  }
94
  return '';
95
  }
inc/fields/media.php CHANGED
@@ -68,6 +68,9 @@ class RWMB_Media_Field extends RWMB_File_Field {
68
  */
69
  $ids = (array) $meta;
70
  if ( $field['clone'] ) {
 
 
 
71
  $ids = call_user_func_array( 'array_merge', $ids );
72
  }
73
  update_meta_cache( 'post', $ids );
@@ -149,7 +152,7 @@ class RWMB_Media_Field extends RWMB_File_Field {
149
  $attributes['value'] = implode( ',', $value );
150
 
151
  // Add attachment details.
152
- $attachments = array_values( array_filter( array_map( 'wp_prepare_attachment_for_js', $value ) ) );
153
  $attributes['data-attachments'] = json_encode( $attachments );
154
 
155
  return $attributes;
68
  */
69
  $ids = (array) $meta;
70
  if ( $field['clone'] ) {
71
+ foreach ( $ids as &$value ) {
72
+ $value = (array) $value;
73
+ }
74
  $ids = call_user_func_array( 'array_merge', $ids );
75
  }
76
  update_meta_cache( 'post', $ids );
152
  $attributes['value'] = implode( ',', $value );
153
 
154
  // Add attachment details.
155
+ $attachments = array_values( array_filter( array_map( 'wp_prepare_attachment_for_js', $value ) ) );
156
  $attributes['data-attachments'] = json_encode( $attachments );
157
 
158
  return $attributes;
inc/fields/wysiwyg.php CHANGED
@@ -20,6 +20,7 @@ class RWMB_Wysiwyg_Field extends RWMB_Field {
20
  * Enqueue scripts and styles.
21
  */
22
  public static function admin_enqueue_scripts() {
 
23
  wp_enqueue_style( 'rwmb-wysiwyg', RWMB_CSS_URL . 'wysiwyg.css', array(), RWMB_VER );
24
  wp_enqueue_script( 'rwmb-wysiwyg', RWMB_JS_URL . 'wysiwyg.js', array( 'jquery' ), RWMB_VER, true );
25
  }
20
  * Enqueue scripts and styles.
21
  */
22
  public static function admin_enqueue_scripts() {
23
+ wp_enqueue_editor();
24
  wp_enqueue_style( 'rwmb-wysiwyg', RWMB_CSS_URL . 'wysiwyg.css', array(), RWMB_VER );
25
  wp_enqueue_script( 'rwmb-wysiwyg', RWMB_JS_URL . 'wysiwyg.js', array( 'jquery' ), RWMB_VER, true );
26
  }
inc/functions.php CHANGED
@@ -235,8 +235,20 @@ if ( ! function_exists( 'rwmb_check_meta_box_supports' ) ) {
235
  }
236
  $prop = 'taxonomies';
237
  break;
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
- if ( ! $type || ! in_array( $type, $meta_box->meta_box[ $prop ], true ) ) {
240
  $meta_box = false;
241
  }
242
  }
@@ -331,24 +343,3 @@ if ( ! function_exists( 'rwmb_get_storage' ) ) {
331
  return apply_filters( 'rwmb_get_storage', $storage, $object_type, $meta_box );
332
  }
333
  }
334
-
335
- if ( ! function_exists( 'rwmb_get_meta_box' ) ) {
336
- /**
337
- * Get meta box object from meta box data.
338
- *
339
- * @param array $meta_box Array of meta box data.
340
- * @return RW_Meta_Box
341
- */
342
- function rwmb_get_meta_box( $meta_box ) {
343
- /**
344
- * Allow filter meta box class name.
345
- *
346
- * @var string Meta box class name.
347
- * @var array Meta box data.
348
- */
349
- $class_name = apply_filters( 'rwmb_meta_box_class_name', 'RW_Meta_Box', $meta_box );
350
-
351
- return new $class_name( $meta_box );
352
- }
353
- }
354
-
235
  }
236
  $prop = 'taxonomies';
237
  break;
238
+ case 'user':
239
+ $type = 'user';
240
+ $prop = 'user';
241
+ break;
242
+ case 'setting':
243
+ $type = 'setting';
244
+ $prop = 'settings_pages';
245
+ break;
246
+ }
247
+ if ( ! $type ) {
248
+ $meta_box = false;
249
+ return;
250
  }
251
+ if ( isset( $meta_box->meta_box[ $prop ] ) && ! in_array( $type, $meta_box->meta_box[ $prop ], true ) ) {
252
  $meta_box = false;
253
  }
254
  }
343
  return apply_filters( 'rwmb_get_storage', $storage, $object_type, $meta_box );
344
  }
345
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
- define( 'RWMB_VER', '4.18.4' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
@@ -81,6 +81,7 @@ class RWMB_Loader {
81
  $autoloader->add( RWMB_INC_DIR . 'interfaces', 'RWMB_', '_Interface' );
82
  $autoloader->add( RWMB_INC_DIR . 'storages', 'RWMB_', '_Storage' );
83
  $autoloader->add( RWMB_INC_DIR . 'helpers', 'RWMB_Helpers_' );
 
84
  $autoloader->register();
85
 
86
  // Plugin core.
@@ -105,6 +106,12 @@ class RWMB_Loader {
105
  $wpml = new RWMB_WPML();
106
  $wpml->init();
107
 
 
 
 
 
 
 
108
  // Public functions.
109
  require_once RWMB_INC_DIR . 'functions.php';
110
  }
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
+ define( 'RWMB_VER', '5.0.0' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
81
  $autoloader->add( RWMB_INC_DIR . 'interfaces', 'RWMB_', '_Interface' );
82
  $autoloader->add( RWMB_INC_DIR . 'storages', 'RWMB_', '_Storage' );
83
  $autoloader->add( RWMB_INC_DIR . 'helpers', 'RWMB_Helpers_' );
84
+ $autoloader->add( RWMB_INC_DIR . 'update', 'RWMB_Update_' );
85
  $autoloader->register();
86
 
87
  // Plugin core.
106
  $wpml = new RWMB_WPML();
107
  $wpml->init();
108
 
109
+ // Update.
110
+ $update_checker = new RWMB_Update_Checker();
111
+ $update_checker->init();
112
+ $update_settings = new RWMB_Update_Settings( $update_checker );
113
+ $update_settings->init();
114
+
115
  // Public functions.
116
  require_once RWMB_INC_DIR . 'functions.php';
117
  }
inc/meta-box-registry.php CHANGED
@@ -17,6 +17,20 @@ class RWMB_Meta_Box_Registry {
17
  */
18
  private $data = array();
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Add a meta box to the registry.
22
  *
17
  */
18
  private $data = array();
19
 
20
+ /**
21
+ * Create a meta box object.
22
+ *
23
+ * @param array $settings Meta box settings.
24
+ * @return \RW_Meta_Box
25
+ */
26
+ public function make( $settings ) {
27
+ $class_name = apply_filters( 'rwmb_meta_box_class_name', 'RW_Meta_Box', $settings );
28
+
29
+ $meta_box = new $class_name( $settings );
30
+ $this->add( $meta_box );
31
+ return $meta_box;
32
+ }
33
+
34
  /**
35
  * Add a meta box to the registry.
36
  *
inc/meta-box.php CHANGED
@@ -61,10 +61,10 @@ class RW_Meta_Box {
61
  * @param array $meta_box Meta box definition.
62
  */
63
  public function __construct( $meta_box ) {
64
- $meta_box = self::normalize( $meta_box );
65
  $this->meta_box = $meta_box;
66
 
67
- $this->meta_box['fields'] = self::normalize_fields( $meta_box['fields'], $this->get_storage() );
68
 
69
  $this->meta_box = apply_filters( 'rwmb_meta_box_settings', $this->meta_box );
70
 
@@ -151,6 +151,8 @@ class RW_Meta_Box {
151
  wp_enqueue_style( 'rwmb-rtl', RWMB_CSS_URL . 'style-rtl.css', array(), RWMB_VER );
152
  }
153
 
 
 
154
  // Load clone script conditionally.
155
  foreach ( $this->fields as $field ) {
156
  if ( $field['clone'] ) {
@@ -355,6 +357,7 @@ class RW_Meta_Box {
355
  'autosave' => false,
356
  'default_hidden' => false,
357
  'style' => 'default',
 
358
  )
359
  );
360
 
61
  * @param array $meta_box Meta box definition.
62
  */
63
  public function __construct( $meta_box ) {
64
+ $meta_box = static::normalize( $meta_box );
65
  $this->meta_box = $meta_box;
66
 
67
+ $this->meta_box['fields'] = static::normalize_fields( $meta_box['fields'], $this->get_storage() );
68
 
69
  $this->meta_box = apply_filters( 'rwmb_meta_box_settings', $this->meta_box );
70
 
151
  wp_enqueue_style( 'rwmb-rtl', RWMB_CSS_URL . 'style-rtl.css', array(), RWMB_VER );
152
  }
153
 
154
+ wp_enqueue_script( 'rwmb', RWMB_JS_URL . 'script.js', array( 'jquery' ), RWMB_VER, true );
155
+
156
  // Load clone script conditionally.
157
  foreach ( $this->fields as $field ) {
158
  if ( $field['clone'] ) {
357
  'autosave' => false,
358
  'default_hidden' => false,
359
  'style' => 'default',
360
+ 'fields' => array(),
361
  )
362
  );
363
 
inc/update/checker.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main update logic for updating Meta Box extensions.
4
+ *
5
+ * @package Meta Box
6
+ */
7
+
8
+ /**
9
+ * The updater class for Meta Box extensions
10
+ *
11
+ * @package Meta Box
12
+ */
13
+ class RWMB_Update_Checker {
14
+ /**
15
+ * Update API endpoint URL.
16
+ *
17
+ * @var string
18
+ */
19
+ private $api_url = 'https://metabox.io/index.php';
20
+
21
+ /**
22
+ * The update option.
23
+ *
24
+ * @var string
25
+ */
26
+ private $option = 'meta_box_updater';
27
+
28
+ /**
29
+ * Add hooks to check plugin updates.
30
+ */
31
+ public function init() {
32
+ add_action( 'init', array( $this, 'enable_update' ), 1 );
33
+ }
34
+
35
+ /**
36
+ * Enable update checker when premium extensions are installed.
37
+ */
38
+ public function enable_update() {
39
+ if ( $this->has_extensions() ) {
40
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_updates' ) );
41
+ add_filter( 'plugins_api', array( $this, 'get_info' ), 10, 3 );
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Check if any premium extension is installed.
47
+ *
48
+ * @return bool
49
+ */
50
+ public function has_extensions() {
51
+ if ( ! function_exists( 'get_plugins' ) ) {
52
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
53
+ }
54
+
55
+ $extensions = array(
56
+ 'mb-admin-columns',
57
+ 'mb-blocks',
58
+ 'mb-custom-table',
59
+ 'mb-frontend-submission',
60
+ 'mb-revision',
61
+ 'mb-settings-page',
62
+ 'mb-term-meta',
63
+ 'mb-user-meta',
64
+ 'mb-user-profile',
65
+ 'meta-box-aio',
66
+ 'meta-box-builder',
67
+ 'meta-box-columns',
68
+ 'meta-box-conditional-logic',
69
+ 'meta-box-geolocation',
70
+ 'meta-box-group',
71
+ 'meta-box-include-exclude',
72
+ 'meta-box-show-hide',
73
+ 'meta-box-tabs',
74
+ 'meta-box-template',
75
+ );
76
+ $plugins = get_plugins();
77
+ $plugins = array_map( 'dirname', array_keys( $plugins ) );
78
+
79
+ $installed_extensions = array_intersect( $extensions, $plugins );
80
+
81
+ return ! empty( $installed_extensions );
82
+ }
83
+
84
+ /**
85
+ * Check plugin for updates
86
+ *
87
+ * @param object $data The plugin update data.
88
+ *
89
+ * @return mixed
90
+ */
91
+ public function check_updates( $data ) {
92
+ static $plugins = null;
93
+
94
+ // Make sure to send remote request once.
95
+ if ( null === $plugins ) {
96
+ $plugins = $this->request( 'action=check_updates' );
97
+ }
98
+
99
+ if ( false === $plugins ) {
100
+ return $data;
101
+ }
102
+
103
+ if ( ! isset( $data->response ) ) {
104
+ $data->response = array();
105
+ }
106
+
107
+ $plugins = array_filter( $plugins, array( $this, 'has_update' ) );
108
+ foreach ( $plugins as $plugin ) {
109
+ $data->response[ $plugin->plugin ] = $plugin;
110
+ }
111
+
112
+ $option = $this->get_option();
113
+ $option['plugins'] = array_keys( $plugins );
114
+ if ( is_multisite() ) {
115
+ update_site_option( $this->option, $option );
116
+ } else {
117
+ update_option( $this->option, $option );
118
+ }
119
+
120
+ return $data;
121
+ }
122
+
123
+ /**
124
+ * Get plugin information
125
+ *
126
+ * @param object $data The plugin update data.
127
+ * @param string $action Request action.
128
+ * @param object $args Extra parameters.
129
+ *
130
+ * @return mixed
131
+ */
132
+ public function get_info( $data, $action, $args ) {
133
+ $option = $this->get_option();
134
+ $plugins = isset( $option['plugins'] ) ? $option['plugins'] : array();
135
+ if ( 'plugin_information' !== $action || ! isset( $args->slug ) || ! in_array( $args->slug, $plugins, true ) ) {
136
+ return $data;
137
+ }
138
+
139
+ $info = $this->request(
140
+ array(
141
+ 'action' => 'get_info',
142
+ 'product' => $args->slug,
143
+ )
144
+ );
145
+
146
+ return false === $info ? $data : $info;
147
+ }
148
+
149
+ /**
150
+ * Send request to remote host
151
+ *
152
+ * @param array|string $args Query arguments.
153
+ *
154
+ * @return mixed
155
+ */
156
+ public function request( $args = '' ) {
157
+ // Add email and API key to the request params.
158
+ $option = $this->get_option();
159
+ $args = wp_parse_args( $args, $option );
160
+ $args = array_filter( $args );
161
+
162
+ $request = wp_remote_post(
163
+ $this->api_url,
164
+ array(
165
+ 'body' => $args,
166
+ )
167
+ );
168
+
169
+ $response = wp_remote_retrieve_body( $request );
170
+ if ( $response ) {
171
+ $data = @unserialize( $response );
172
+
173
+ return $data;
174
+ }
175
+
176
+ return false;
177
+ }
178
+
179
+ /**
180
+ * Check if a plugin has an update to a new version.
181
+ *
182
+ * @param object $plugin_data The plugin update data.
183
+ *
184
+ * @return bool
185
+ */
186
+ private function has_update( $plugin_data ) {
187
+ $plugins = get_plugins();
188
+
189
+ return isset( $plugins[ $plugin_data->plugin ] ) && version_compare( $plugins[ $plugin_data->plugin ]['Version'], $plugin_data->new_version, '<' );
190
+ }
191
+
192
+ /**
193
+ * Get update option.
194
+ *
195
+ * @return array
196
+ */
197
+ private function get_option() {
198
+ return is_multisite() ? get_site_option( $this->option, array() ) : get_option( $this->option, array() );
199
+ }
200
+ }
inc/update/settings.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class handles plugin settings, including adding settings page, show fields, save settings
4
+ *
5
+ * @package Meta Box
6
+ */
7
+
8
+ /**
9
+ * Meta Box Update Settings class
10
+ *
11
+ * @package Meta Box
12
+ */
13
+ class RWMB_Update_Settings {
14
+ /**
15
+ * Update option.
16
+ *
17
+ * @var string
18
+ */
19
+ private $option = 'meta_box_updater';
20
+
21
+ /**
22
+ * Settings page ID.
23
+ *
24
+ * @var string
25
+ */
26
+ private $page_id = 'meta-box-updater';
27
+
28
+ /**
29
+ * Settings page hook.
30
+ *
31
+ * @var string
32
+ */
33
+ private $page_hook;
34
+
35
+ /**
36
+ * The update checker object
37
+ *
38
+ * @var object
39
+ */
40
+ private $checker;
41
+
42
+ /**
43
+ * Constructor.
44
+ *
45
+ * @param object $checker Update checker object.
46
+ */
47
+ public function __construct( $checker ) {
48
+ $this->checker = $checker;
49
+ }
50
+
51
+ /**
52
+ * Add hooks to create the settings page and show admin notice.
53
+ */
54
+ public function init() {
55
+ // Whether to enable Meta Box menu. Priority 1 makes sure it runs before adding Meta Box menu.
56
+ add_action( 'admin_menu', array( $this, 'enable_menu' ), 1 );
57
+
58
+ // Add submenu. Use priority 80 to show it just above the About page (priority = 90).
59
+ $admin_menu_hook = is_multisite() ? 'network_admin_menu' : 'admin_menu';
60
+ add_action( $admin_menu_hook, array( $this, 'add_settings_page' ), 80 );
61
+
62
+ $admin_notices_hook = is_multisite() ? 'network_admin_notices' : 'admin_notices';
63
+ add_action( $admin_notices_hook, array( $this, 'notify' ) );
64
+ }
65
+
66
+ /**
67
+ * Whether to enable Meta Box menu.
68
+ */
69
+ public function enable_menu() {
70
+ if ( $this->checker->has_extensions() ) {
71
+ add_filter( 'rwmb_admin_menu', '__return_true' );
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Add settings page.
77
+ */
78
+ public function add_settings_page() {
79
+ $parent = is_multisite() ? 'settings.php' : 'meta-box';
80
+ $capability = is_multisite() ? 'manage_network_options' : 'manage_options';
81
+ $title = is_multisite() ? esc_html__( 'Meta Box Updater', 'meta-box-updater' ) : esc_html__( 'License', 'meta-box-updater' );
82
+ $this->page_hook = add_submenu_page(
83
+ $parent,
84
+ $title,
85
+ $title,
86
+ $capability,
87
+ $this->page_id,
88
+ array( $this, 'render' )
89
+ );
90
+ add_action( "load-{$this->page_hook}", array( $this, 'save' ) );
91
+ }
92
+
93
+ /**
94
+ * Render the content of settings page.
95
+ */
96
+ public function render() {
97
+ ?>
98
+ <div class="wrap">
99
+ <h1><?php esc_html_e( 'Meta Box License' ); ?></h1>
100
+ <p><?php esc_html_e( 'Please enter your license key to receive automatic updates for Meta Box extensions.', 'meta-box-updater' ); ?></p>
101
+ <p>
102
+ <?php
103
+ printf(
104
+ // Translators: %s - URL to MetaBox.io website.
105
+ wp_kses_post( __( 'To get the license key, please visit your profile page at <a href="%s" target="_blank">metabox.io website</a>.', 'meta-box-updater' ) ),
106
+ 'https://metabox.io/my-account/'
107
+ );
108
+ ?>
109
+ </p>
110
+
111
+ <form action="" method="post">
112
+ <?php wp_nonce_field( 'meta-box-updater' ); ?>
113
+
114
+ <?php
115
+ $option = is_multisite() ? get_site_option( $this->option ) : get_option( $this->option );
116
+ $key = isset( $option['api_key'] ) ? $option['api_key'] : '';
117
+ ?>
118
+
119
+ <table class="form-table">
120
+ <tr>
121
+ <th scope="row"><?php esc_html_e( 'License Key', 'meta-box-updater' ); ?></th>
122
+ <td><input required class="regular-text" name="<?php echo esc_attr( $this->option ); ?>[api_key]" value="<?php echo esc_attr( $key ); ?>" type="password"></td>
123
+ </tr>
124
+ </table>
125
+
126
+ <?php submit_button( __( 'Save Changes', 'meta-box-updater' ) ); ?>
127
+ </form>
128
+ </div>
129
+ <?php
130
+ }
131
+
132
+ /**
133
+ * Save update settings.
134
+ */
135
+ public function save() {
136
+ static $message_shown = false;
137
+
138
+ if ( empty( $_POST['submit'] ) ) {
139
+ return;
140
+ }
141
+ check_admin_referer( 'meta-box-updater' );
142
+
143
+ // @codingStandardsIgnoreLine
144
+ $option = isset( $_POST[ $this->option ] ) ? $_POST[ $this->option ] : array();
145
+ $option = (array) $option;
146
+ $option['status'] = 'success';
147
+
148
+ $args = $option;
149
+ $args['action'] = 'check_license';
150
+ $message = $this->checker->request( $args );
151
+
152
+ if ( $message ) {
153
+ add_settings_error( '', 'invalid', $message );
154
+ $option['status'] = 'error';
155
+ } else {
156
+ add_settings_error( '', 'success', __( 'Settings saved.', 'meta-box-updater' ), 'updated' );
157
+ }
158
+
159
+ // Non-multisite auto shows update message. See wp-admin/options-head.php.
160
+ if ( is_multisite() ) {
161
+ add_action( 'network_admin_notices', array( $this, 'show_update_message' ) );
162
+ }
163
+
164
+ if ( is_multisite() ) {
165
+ update_site_option( $this->option, $option );
166
+ } else {
167
+ update_option( $this->option, $option );
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Show update message.
173
+ */
174
+ public function show_update_message() {
175
+ settings_errors();
176
+ }
177
+
178
+ /**
179
+ * Notify users to enter license key.
180
+ */
181
+ public function notify() {
182
+ $messages = array(
183
+ // Translators: %1$s - URL to Meta Box Updater settings page, %2$s - URL to MetaBox.io website.
184
+ 'no_key' => __( '<b>Warning!</b> You have not set your Meta Box license key yet, which means you are missing out on automatic updates and support! <a href="%1$s">Enter your license key</a> or <a href="%2$s" target="_blank">get one here</a>.', 'meta-box-updater' ),
185
+ // Translators: %1$s - URL to Meta Box Updater settings page, %2$s - URL to MetaBox.io website.
186
+ 'invalid' => __( '<b>Warning!</b> Your license key for Meta Box is invalid or expired. Please <a href="%1$s">fix it</a> or <a href="%2$s" target="_blank">renew</a> to receive automatic updates and premium support.', 'meta-box-updater' ),
187
+ );
188
+ $status = $this->get_license_status();
189
+ $admin_url = is_multisite() ? network_admin_url( "settings.php?page={$this->page_id}" ) : admin_url( "admin.php?page={$this->page_id}" );
190
+ if ( isset( $messages[ $status ] ) ) {
191
+ echo '<div class="notice notice-warning"><p>', wp_kses_post( sprintf( $messages[ $status ], $admin_url, 'https://metabox.io/pricing/' ) ), '</p></div>';
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Get license status.
197
+ */
198
+ public function get_license_status() {
199
+ $option = is_multisite() ? get_site_option( $this->option ) : get_option( $this->option );
200
+ if ( empty( $option['api_key'] ) ) {
201
+ return 'no_key';
202
+ }
203
+ if ( isset( $option['status'] ) && 'success' !== $option['status'] ) {
204
+ return 'invalid';
205
+ }
206
+ return 'valid';
207
+ }
208
+ }
js/autocomplete.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
  /**
@@ -38,12 +38,17 @@ jQuery( function ( $ ) {
38
  } );
39
  }
40
 
41
- $( '.rwmb-autocomplete-wrapper input[type="hidden"]' ).each( updateAutocomplete );
42
- $( document )
 
 
 
 
 
 
 
 
 
43
  .on( 'clone', '.rwmb-autocomplete', updateAutocomplete )
44
- // Handle remove action
45
- .on( 'click', '.rwmb-autocomplete-result .actions', function () {
46
- // remove result
47
- $( this ).parent().remove();
48
- } );
49
- } );
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
  /**
38
  } );
39
  }
40
 
41
+ function deleteSelection( e ) {
42
+ e.preventDefault();
43
+ $( this ).parent().remove();
44
+ }
45
+
46
+ function init( e ) {
47
+ $( e.target ).find( '.rwmb-autocomplete-wrapper input[type="hidden"]' ).each( updateAutocomplete );
48
+ }
49
+
50
+ rwmb.$document
51
+ .on( 'mb_ready', init )
52
  .on( 'clone', '.rwmb-autocomplete', updateAutocomplete )
53
+ .on( 'click', '.rwmb-autocomplete-result .actions', deleteSelection );
54
+ } )( jQuery, rwmb );
 
 
 
 
js/button-group.js CHANGED
@@ -1,7 +1,7 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- function update() {
5
  var $this = $( this ),
6
  $input = $this.find( 'input' ),
7
  $label = $input.parent();
@@ -31,7 +31,12 @@ jQuery( function ( $ ) {
31
  }
32
  }
33
 
34
- $( '.rwmb-button-input-list li' ).each( update );
35
- $( document ).on( 'click', '.rwmb-button-input-list li', clickHandler );
36
- $( document ).on( 'clone', '.rwmb-button-input-list', update );
37
- } );
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ function setActiveClass() {
5
  var $this = $( this ),
6
  $input = $this.find( 'input' ),
7
  $label = $input.parent();
31
  }
32
  }
33
 
34
+ function init( e ) {
35
+ $( e.target ).find( '.rwmb-button-input-list li' ).each( setActiveClass );
36
+ }
37
+
38
+ rwmb.$document
39
+ .on( 'mb_ready', init )
40
+ .on( 'click', '.rwmb-button-input-list li', clickHandler )
41
+ .on( 'clone', '.rwmb-button-input-list', setActiveClass );
42
+ } )( jQuery, rwmb );
js/clone.js CHANGED
@@ -1,5 +1,4 @@
1
- /* global jQuery */
2
- jQuery( function ( $ ) {
3
  'use strict';
4
 
5
  // Object holds all methods related to fields' index when clone
@@ -188,84 +187,84 @@ jQuery( function ( $ ) {
188
  $button.toggle( isNaN( maxClone ) || ( maxClone && numClone < maxClone ) );
189
  }
190
 
191
- /**
192
- * Initialize clone sorting.
193
- */
194
- function initSortable() {
195
- $( '.rwmb-input' ).each( function () {
196
- var $container = $( this );
197
 
198
- if ( undefined !== $container.sortable( 'instance' ) ) {
199
- return;
200
- }
201
 
202
- $container.sortable( {
203
- handle: '.rwmb-clone-icon',
204
- placeholder: ' rwmb-clone rwmb-sortable-placeholder',
205
- items: '> .rwmb-clone',
206
- start: function ( event, ui ) {
207
- // Make the placeholder has the same height as dragged item
208
- ui.placeholder.height( ui.item.outerHeight() );
209
- }
210
- } );
211
- } );
212
  }
213
 
214
- $( document )
215
- // Add clones
216
- .on( 'click', '.add-clone', function ( e ) {
217
- e.preventDefault();
218
 
219
- var $container = $( this ).closest( '.rwmb-input' );
220
- clone( $container );
221
 
222
- toggleRemoveButtons( $container );
223
- toggleAddButton( $container );
224
- initSortable();
225
- } )
226
- // Remove clones
227
- .on( 'click', '.remove-clone', function ( e ) {
228
- e.preventDefault();
229
 
230
- var $this = $( this ),
231
- $container = $this.closest( '.rwmb-input' );
 
 
232
 
233
- // Remove clone only if there are 2 or more of them
234
- if ( $container.children( '.rwmb-clone' ).length < 2 ) {
235
- return;
236
- }
 
 
237
 
238
- $this.parent().trigger( 'remove' ).remove();
239
- toggleRemoveButtons( $container );
240
- toggleAddButton( $container );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  } );
 
242
 
243
- $( '.rwmb-input' ).each( function () {
244
  var $container = $( this );
245
  toggleRemoveButtons( $container );
246
  toggleAddButton( $container );
247
 
248
- $container
249
- .data( 'next-index', $container.children( '.rwmb-clone' ).length )
250
- .sortable( {
251
- handle: '.rwmb-clone-icon',
252
- placeholder: ' rwmb-clone rwmb-sortable-placeholder',
253
- items: '> .rwmb-clone',
254
- start: function ( event, ui ) {
255
- // Make the placeholder has the same height as dragged item
256
- ui.placeholder.height( ui.item.outerHeight() );
257
-
258
- // Fixed WYSIWYG field blank when inside a sortable, cloneable group.
259
- // https://stackoverflow.com/a/25667486/371240
260
- $( ui.item ).find( '.rwmb-wysiwyg' ).each( function () {
261
- tinymce.execCommand( 'mceRemoveEditor', false, this.id );
262
- } );
263
- },
264
- stop: function(e,ui) {
265
- $( ui.item ).find( '.rwmb-wysiwyg' ).each( function () {
266
- tinymce.execCommand( 'mceAddEditor', true, this.id );
267
- } );
268
- }
269
- } );
270
- } );
271
- } );
1
+ ( function ( $, rwmb ) {
 
2
  'use strict';
3
 
4
  // Object holds all methods related to fields' index when clone
187
  $button.toggle( isNaN( maxClone ) || ( maxClone && numClone < maxClone ) );
188
  }
189
 
190
+ function addClone( e ) {
191
+ e.preventDefault();
 
 
 
 
192
 
193
+ var $container = $( this ).closest( '.rwmb-input' );
194
+ clone( $container );
 
195
 
196
+ toggleRemoveButtons( $container );
197
+ toggleAddButton( $container );
198
+ sortClones.apply( $container[0] );
 
 
 
 
 
 
 
199
  }
200
 
201
+ function removeClone( e ) {
202
+ e.preventDefault();
 
 
203
 
204
+ var $this = $( this ),
205
+ $container = $this.closest( '.rwmb-input' );
206
 
207
+ // Remove clone only if there are 2 or more of them
208
+ if ( $container.children( '.rwmb-clone' ).length < 2 ) {
209
+ return;
210
+ }
 
 
 
211
 
212
+ $this.parent().trigger( 'remove' ).remove();
213
+ toggleRemoveButtons( $container );
214
+ toggleAddButton( $container );
215
+ }
216
 
217
+ /**
218
+ * Sort clones.
219
+ * Expect this = .rwmb-input element.
220
+ */
221
+ function sortClones() {
222
+ var $container = $( this );
223
 
224
+ if ( undefined !== $container.sortable( 'instance' ) ) {
225
+ return;
226
+ }
227
+ if ( 0 === $container.children( '.rwmb-clone' ).length ) {
228
+ return;
229
+ }
230
+
231
+ $container.sortable( {
232
+ handle: '.rwmb-clone-icon',
233
+ placeholder: ' rwmb-clone rwmb-sortable-placeholder',
234
+ items: '> .rwmb-clone',
235
+ start: function ( event, ui ) {
236
+ // Make the placeholder has the same height as dragged item
237
+ ui.placeholder.height( ui.item.outerHeight() );
238
+
239
+ // Fixed WYSIWYG field blank when inside a sortable, cloneable group.
240
+ // https://stackoverflow.com/a/25667486/371240
241
+ $( ui.item ).find( '.rwmb-wysiwyg' ).each( function () {
242
+ tinymce.execCommand( 'mceRemoveEditor', false, this.id );
243
+ } );
244
+ },
245
+ stop: function(e,ui) {
246
+ $( ui.item ).find( '.rwmb-wysiwyg' ).each( function () {
247
+ tinymce.execCommand( 'mceAddEditor', true, this.id );
248
+ } );
249
+ }
250
  } );
251
+ }
252
 
253
+ function start() {
254
  var $container = $( this );
255
  toggleRemoveButtons( $container );
256
  toggleAddButton( $container );
257
 
258
+ $container.data( 'next-index', $container.children( '.rwmb-clone' ).length );
259
+ sortClones.apply( this );
260
+ }
261
+
262
+ function init( e ) {
263
+ $( e.target ).find( '.rwmb-input' ).each( start );
264
+ }
265
+
266
+ rwmb.$document
267
+ .on( 'mb_ready', init )
268
+ .on( 'click', '.add-clone', addClone )
269
+ .on( 'click', '.remove-clone', removeClone );
270
+ } )( jQuery, rwmb );
 
 
 
 
 
 
 
 
 
 
 
js/color.js CHANGED
@@ -1,11 +1,10 @@
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(
@@ -30,6 +29,11 @@ jQuery( function ( $ ) {
30
  $this.wpColorPicker( data );
31
  }
32
 
33
- $( '.rwmb-color' ).each( update );
34
- $( document ).on( 'clone', '.rwmb-color', update );
35
- } );
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
  /**
5
+ * Transform an input into a color picker.
 
6
  */
7
+ function transform() {
8
  var $this = $( this ),
9
  $container = $this.closest( '.wp-picker-container' ),
10
  data = $.extend(
29
  $this.wpColorPicker( data );
30
  }
31
 
32
+ function init( e ) {
33
+ $( e.target ).find( '.rwmb-color' ).each( transform );
34
+ }
35
+
36
+ rwmb.$document
37
+ .on( 'mb_ready', init )
38
+ .on( 'clone', '.rwmb-color', transform );
39
+ } )( jQuery, rwmb );
js/date.js CHANGED
@@ -1,11 +1,10 @@
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' ),
@@ -20,29 +19,29 @@ jQuery( function ( $ ) {
20
  };
21
  }
22
 
23
- if ( $inline.length ) {
24
- options.altField = '#' + $this.attr( 'id' );
25
- $this.on( 'keydown', _.debounce( function () {
26
- // if val is empty, return to allow empty datepicker input.
27
- if ( !$this.val() ) {
28
- return;
29
- }
30
- $picker
31
- .datepicker( 'setDate', $this.val() )
32
- .find( ".ui-datepicker-current-day" )
33
- .trigger( "click" );
34
- }, 600 ) );
35
-
36
- $inline
37
- .removeClass( 'hasDatepicker' )
38
- .empty()
39
- .prop( 'id', '' )
40
- .datepicker( options )
41
- .datepicker( 'setDate', current );
42
- }
43
- else {
44
  $this.removeClass( 'hasDatepicker' ).datepicker( options );
 
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  /**
@@ -53,12 +52,17 @@ jQuery( function ( $ ) {
53
  */
54
  function getTimestamp( date ) {
55
  if ( date === null ) {
56
- return "";
57
  }
58
  var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
59
  return Math.floor( milliseconds / 1000 );
60
  }
61
 
62
- $( '.rwmb-date' ).each( update );
63
- $( document ).on( 'clone', '.rwmb-date', update );
64
- } );
 
 
 
 
 
1
+ ( function ( $, _, rwmb ) {
2
  'use strict';
3
 
4
  /**
5
+ * Transform an input into a date picker.
 
6
  */
7
+ function transform() {
8
  var $this = $( this ),
9
  options = $this.data( 'options' ),
10
  $inline = $this.siblings( '.rwmb-datetime-inline' ),
19
  };
20
  }
21
 
22
+ if ( ! $inline.length ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  $this.removeClass( 'hasDatepicker' ).datepicker( options );
24
+ return;
25
  }
26
+
27
+ options.altField = '#' + $this.attr( 'id' );
28
+ $this.on( 'keydown', _.debounce( function () {
29
+ // if val is empty, return to allow empty datepicker input.
30
+ if ( ! $this.val() ) {
31
+ return;
32
+ }
33
+ $picker
34
+ .datepicker( 'setDate', $this.val() )
35
+ .find( '.ui-datepicker-current-day' )
36
+ .trigger( 'click' );
37
+ }, 600 ) );
38
+
39
+ $inline
40
+ .removeClass( 'hasDatepicker' )
41
+ .empty()
42
+ .prop( 'id', '' )
43
+ .datepicker( options )
44
+ .datepicker( 'setDate', current );
45
  }
46
 
47
  /**
52
  */
53
  function getTimestamp( date ) {
54
  if ( date === null ) {
55
+ return '';
56
  }
57
  var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
58
  return Math.floor( milliseconds / 1000 );
59
  }
60
 
61
+ function init( e ) {
62
+ $( e.target ).find( '.rwmb-date' ).each( transform );
63
+ }
64
+
65
+ rwmb.$document
66
+ .on( 'mb_ready', init )
67
+ .on( 'clone', '.rwmb-date', transform );
68
+ } )( jQuery, _, rwmb );
js/datetime.js CHANGED
@@ -1,11 +1,10 @@
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' ),
@@ -20,25 +19,29 @@ jQuery( function ( $ ) {
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()
35
- .prop( 'id', '' )
36
- .datetimepicker( options )
37
- .datetimepicker( 'setDate', current );
38
- }
39
- else {
40
  $this.removeClass( 'hasDatepicker' ).datetimepicker( options );
 
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
 
44
  /**
@@ -49,21 +52,27 @@ jQuery( function ( $ ) {
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
- $.timepicker.setDefaults( $.timepicker.regional[""] );
60
- if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.locale ) ) {
61
- $.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.locale] );
 
 
 
62
  }
63
- else if ( $.timepicker.regional.hasOwnProperty( RWMB_Datetime.localeShort ) ) {
64
- $.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.localeShort] );
 
65
  }
66
 
67
- $( '.rwmb-datetime' ).each( update );
68
- $( document ).on( 'clone', '.rwmb-datetime', update );
69
- } );
 
 
1
+ ( function ( $, _, rwmb, i18n ) {
2
  'use strict';
3
 
4
  /**
5
+ * Transform an input into a datetime picker.
 
6
  */
7
+ function transform() {
8
  var $this = $( this ),
9
  options = $this.data( 'options' ),
10
  $inline = $this.siblings( '.rwmb-datetime-inline' ),
19
  };
20
  }
21
 
22
+ if ( ! $inline.length ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  $this.removeClass( 'hasDatepicker' ).datetimepicker( options );
24
+ return;
25
  }
26
+
27
+ options.altField = '#' + $this.attr( 'id' );
28
+ $this.on( 'keydown', _.debounce( function () {
29
+ // if val is empty, return to allow empty datepicker input.
30
+ if ( ! $this.val() ) {
31
+ return;
32
+ }
33
+ $picker
34
+ .datepicker( 'setDate', $this.val() )
35
+ .find( '.ui-datepicker-current-day' )
36
+ .trigger( 'click' );
37
+ }, 600 ) );
38
+
39
+ $inline
40
+ .removeClass( 'hasDatepicker' )
41
+ .empty()
42
+ .prop( 'id', '' )
43
+ .datetimepicker( options )
44
+ .datetimepicker( 'setDate', current );
45
  }
46
 
47
  /**
52
  */
53
  function getTimestamp( date ) {
54
  if ( date === null ) {
55
+ return '';
56
  }
57
  var milliseconds = Date.UTC( date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() );
58
  return Math.floor( milliseconds / 1000 );
59
  }
60
 
61
  // Set language if available
62
+ function setTimeI18n() {
63
+ if ( $.timepicker.regional.hasOwnProperty( i18n.locale ) ) {
64
+ $.timepicker.setDefaults( $.timepicker.regional[i18n.locale] );
65
+ } else if ( $.timepicker.regional.hasOwnProperty( i18n.localeShort ) ) {
66
+ $.timepicker.setDefaults( $.timepicker.regional[i18n.localeShort] );
67
+ }
68
  }
69
+
70
+ function init( e ) {
71
+ $( e.target ).find( '.rwmb-datetime' ).each( transform );
72
  }
73
 
74
+ setTimeI18n();
75
+ rwmb.$document
76
+ .on( 'mb_ready', init )
77
+ .on( 'clone', '.rwmb-datetime', transform );
78
+ } )( jQuery, _, rwmb, RWMB_Datetime );
js/file-input.js CHANGED
@@ -1,10 +1,9 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- var frame,
5
- $doc = $( document );
6
 
7
- $doc.on( 'click', '.rwmb-file-input-select', function ( e ) {
8
  e.preventDefault();
9
  var $el = $( this );
10
 
@@ -28,16 +27,19 @@ jQuery( function ( $ ) {
28
  var url = frame.state().get( 'selection' ).first().toJSON().url;
29
  $el.siblings( 'input' ).val( url ).siblings( 'a' ).removeClass( 'hidden' );
30
  } );
31
- } );
32
 
33
- // Clear selected images
34
- $doc.on( 'click', '.rwmb-file-input-remove', function ( e ) {
35
  e.preventDefault();
36
  $( this ).addClass( 'hidden' ).siblings( 'input' ).val( '' );
37
- } );
38
 
39
- // Hide the Remove button when cloning
40
- $doc.on( 'clone', '.rwmb-file_input', function () {
41
  $( this ).siblings( '.rwmb-file-input-remove' ).addClass( 'hidden' );
42
- } );
43
- } );
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ var frame;
 
5
 
6
+ function openSelectPopup( e ) {
7
  e.preventDefault();
8
  var $el = $( this );
9
 
27
  var url = frame.state().get( 'selection' ).first().toJSON().url;
28
  $el.siblings( 'input' ).val( url ).siblings( 'a' ).removeClass( 'hidden' );
29
  } );
30
+ }
31
 
32
+ function clearSelection( e ) {
 
33
  e.preventDefault();
34
  $( this ).addClass( 'hidden' ).siblings( 'input' ).val( '' );
35
+ }
36
 
37
+ function hideRemoveButtonWhenCloning() {
 
38
  $( this ).siblings( '.rwmb-file-input-remove' ).addClass( 'hidden' );
39
+ }
40
+
41
+ rwmb.$document
42
+ .on( 'click', '.rwmb-file-input-select', openSelectPopup )
43
+ .on( 'click', '.rwmb-file-input-remove', clearSelection )
44
+ .on( 'clone', '.rwmb-file_input', hideRemoveButtonWhenCloning );
45
+ } )( jQuery, rwmb );
js/file-upload.js CHANGED
@@ -1,6 +1,4 @@
1
- window.rwmb = window.rwmb || {};
2
-
3
- jQuery( function ( $ ) {
4
  'use strict';
5
 
6
  var views = rwmb.views = rwmb.views || {},
@@ -174,17 +172,26 @@ jQuery( function ( $ ) {
174
  }
175
  } );
176
 
177
- /**
178
- * Initialize fields
179
- * @return void
180
- */
181
- function init() {
182
- var view = new FileUploadField( { input: this } );
183
- //Remove old then add new
184
- $( this ).siblings( 'div.rwmb-media-view' ).remove();
185
- $( this ).after( view.el );
 
 
 
 
 
 
 
 
186
  }
187
 
188
- $( '.rwmb-file_upload' ).each( init );
189
- $( document ).on( 'clone', '.rwmb-file_upload', init )
190
- } );
 
1
+ ( function ( $, wp, rwmb ) {
 
 
2
  'use strict';
3
 
4
  var views = rwmb.views = rwmb.views || {},
172
  }
173
  } );
174
 
175
+ function initFileUpload() {
176
+ var $this = $( this ),
177
+ view = $this.data( 'view' );
178
+
179
+ if ( view ) {
180
+ return;
181
+ }
182
+
183
+ view = new FileUploadField( { input: this } );
184
+
185
+ $this.siblings( '.rwmb-media-view' ).remove();
186
+ $this.after( view.el );
187
+ $this.data( 'view', view );
188
+ }
189
+
190
+ function init( e ) {
191
+ $( e.target ).find( '.rwmb-file_upload' ).each( initFileUpload );
192
  }
193
 
194
+ rwmb.$document
195
+ .on( 'mb_ready', init )
196
+ .on( 'clone', '.rwmb-file_upload', initFileUpload )
197
+ } )( jQuery, wp, rwmb );
js/file.js CHANGED
@@ -1,5 +1,4 @@
1
- /* global jQuery */
2
- ( function ( $, document ) {
3
  'use strict';
4
 
5
  var file = {};
@@ -119,17 +118,19 @@
119
  }
120
  };
121
 
122
- // Initialize when document ready.
123
- $( function ( $ ) {
124
- $( document )
125
- .on( 'click', '.rwmb-file-add', file.addHandler )
126
- .on( 'click', '.rwmb-file-delete', file.deleteHandler )
127
- .on( 'clone', '.rwmb-file-input', file.resetClone );
128
 
129
- var $uploaded = $( '.rwmb-uploaded' );
130
  $uploaded.each( file.sort );
131
  $uploaded.each( file.updateVisibility );
132
 
133
- $( '.rwmb-file-wrapper' ).each( file.setRequired );
134
- } );
135
- } )( jQuery, document );
 
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
 
2
  'use strict';
3
 
4
  var file = {};
118
  }
119
  };
120
 
121
+ function init( e ) {
122
+ var $el = $( e.target ),
123
+ $uploaded = $el.find( '.rwmb-uploaded' );
 
 
 
124
 
 
125
  $uploaded.each( file.sort );
126
  $uploaded.each( file.updateVisibility );
127
 
128
+ $el.find( '.rwmb-file-wrapper' ).each( file.setRequired );
129
+ }
130
+
131
+ rwmb.$document
132
+ .on( 'mb_ready', init )
133
+ .on( 'click', '.rwmb-file-add', file.addHandler )
134
+ .on( 'click', '.rwmb-file-delete', file.deleteHandler )
135
+ .on( 'clone', '.rwmb-file-input', file.resetClone );
136
+ } )( jQuery, rwmb );
js/image-advanced.js CHANGED
@@ -1,6 +1,4 @@
1
- window.rwmb = window.rwmb || {};
2
-
3
- jQuery( function ( $ ) {
4
  'use strict';
5
 
6
  var views = rwmb.views = rwmb.views || {},
@@ -29,19 +27,25 @@ jQuery( function ( $ ) {
29
  * Initialize image fields
30
  */
31
  function initImageField() {
32
- var view = new ImageField( { input: this } );
33
- $( this ).after( view.el );
 
 
 
 
 
 
 
 
 
 
34
  }
35
 
36
- /**
37
- * Remove views for uploaded images.
38
- */
39
- function removeView() {
40
- $( this ).siblings( '.rwmb-media-view' ).remove();
41
  }
42
 
43
- $( '.rwmb-image_advanced' ).each( initImageField );
44
- $( document )
45
- .on( 'clone', '.rwmb-image_advanced', removeView )
46
- .on( 'after_clone', '.rwmb-image_advanced', initImageField );
47
- } );
1
+ ( function ( $, rwmb ) {
 
 
2
  'use strict';
3
 
4
  var views = rwmb.views = rwmb.views || {},
27
  * Initialize image fields
28
  */
29
  function initImageField() {
30
+ var $this = $( this ),
31
+ view = $this.data( 'view' );
32
+
33
+ if ( view ) {
34
+ return;
35
+ }
36
+
37
+ view = new ImageField( { input: this } );
38
+
39
+ $this.siblings( '.rwmb-media-view' ).remove();
40
+ $this.after( view.el );
41
+ $this.data( 'view', view );
42
  }
43
 
44
+ function init( e ) {
45
+ $( e.target ).find( '.rwmb-image_advanced' ).each( initImageField );
 
 
 
46
  }
47
 
48
+ rwmb.$document
49
+ .on( 'mb_ready', init )
50
+ .on( 'clone', '.rwmb-image_advanced', initImageField );
51
+ } )( jQuery, rwmb );
 
js/image-select.js CHANGED
@@ -1,7 +1,7 @@
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' ),
@@ -15,6 +15,13 @@ jQuery( function ( $ ) {
15
  } else {
16
  $parent.removeClass( 'rwmb-active' );
17
  }
18
- } );
19
- $( '.rwmb-image-select input' ).trigger( 'change' );
20
- } );
 
 
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ function setActiveClass() {
5
  var $this = $( this ),
6
  type = $this.attr( 'type' ),
7
  selected = $this.is( ':checked' ),
15
  } else {
16
  $parent.removeClass( 'rwmb-active' );
17
  }
18
+ }
19
+
20
+ function init( e ) {
21
+ $( e.target ).find( '.rwmb-image-select input' ).trigger( 'change' );
22
+ }
23
+
24
+ rwmb.$document
25
+ .on( 'mb_ready', init )
26
+ .on( 'change', '.rwmb-image-select input', setActiveClass );
27
+ } )( jQuery, rwmb );
js/image-upload.js CHANGED
@@ -1,6 +1,4 @@
1
- window.rwmb = window.rwmb || {};
2
-
3
- jQuery( function ( $ ) {
4
  'use strict';
5
 
6
  var views = rwmb.views = rwmb.views || {},
@@ -14,18 +12,26 @@ jQuery( function ( $ ) {
14
  }
15
  } );
16
 
17
- /**
18
- * Initialize fields
19
- * @return void
20
- */
21
- function init() {
22
- var view = new ImageUploadField( { input: this } );
23
- //Remove old then add new
24
- $( this ).siblings( 'div.rwmb-media-view' ).remove();
25
- $( this ).after( view.el );
 
 
 
 
 
 
 
 
26
  }
27
 
28
- $( '.rwmb-image_upload, .rwmb-plupload_image' ).each( init );
29
- $( document )
30
- .on( 'clone', '.rwmb-image_upload, .rwmb-plupload_image', init )
31
- } );
1
+ ( function ( $, rwmb ) {
 
 
2
  'use strict';
3
 
4
  var views = rwmb.views = rwmb.views || {},
12
  }
13
  } );
14
 
15
+ function initImageUpload() {
16
+ var $this = $( this ),
17
+ view = $this.data( 'view' );
18
+
19
+ if ( view ) {
20
+ return;
21
+ }
22
+
23
+ view = new ImageUploadField( { input: this } );
24
+
25
+ $this.siblings( '.rwmb-media-view' ).remove();
26
+ $this.after( view.el );
27
+ $this.data( 'view', view );
28
+ }
29
+
30
+ function init( e ) {
31
+ $( e.target ).find( '.rwmb-image_upload, .rwmb-plupload_image' ).each( initImageUpload );
32
  }
33
 
34
+ rwmb.$document
35
+ .on( 'mb_ready', init )
36
+ .on( 'clone', '.rwmb-image_upload, .rwmb-plupload_image', initImageUpload )
37
+ } )( jQuery, rwmb );
js/input-list.js CHANGED
@@ -1,24 +1,18 @@
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.rwmb-collapse input[type="checkbox"]', update )
18
- .on( 'clone', '.rwmb-input-list.rwmb-collapse input[type="checkbox"]', update );
19
- $( '.rwmb-input-list.rwmb-collapse input[type="checkbox"]' ).each( update );
20
-
21
- $( document ).on( 'click', '.rwmb-input-list-select-all-none', function( e ) {
22
  e.preventDefault();
23
 
24
  var $this = $( this ),
@@ -32,5 +26,15 @@ jQuery( function ( $ ) {
32
 
33
  checked = ! checked;
34
  $this.data( 'checked', checked );
35
- } );
36
- } );
 
 
 
 
 
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
+ 'use strict';
3
+
4
+ function toggleTree() {
5
  var $this = $( this ),
6
  $children = $this.closest( 'li' ).children( 'ul' );
7
 
8
  if ( $this.is( ':checked' ) ) {
9
  $children.removeClass( 'hidden' );
10
  } else {
11
+ $children.addClass( 'hidden' ).find( 'input' ).prop( 'checked', false );
 
 
 
12
  }
13
  }
14
 
15
+ function toggleAll( e ) {
 
 
 
 
 
16
  e.preventDefault();
17
 
18
  var $this = $( this ),
26
 
27
  checked = ! checked;
28
  $this.data( 'checked', checked );
29
+ }
30
+
31
+ function init( e ) {
32
+ $( e.target ).find( '.rwmb-input-list.rwmb-collapse input[type="checkbox"]' ).each( toggleTree );
33
+ }
34
+
35
+ rwmb.$document
36
+ .on( 'mb_ready', init )
37
+ .on( 'change', '.rwmb-input-list.rwmb-collapse input[type="checkbox"]', toggleTree )
38
+ .on( 'clone', '.rwmb-input-list.rwmb-collapse input[type="checkbox"]', toggleTree )
39
+ .on( 'click', '.rwmb-input-list-select-all-none', toggleAll );
40
+ } )( jQuery, rwmb );
js/map.js CHANGED
@@ -1,6 +1,4 @@
1
- /* global google */
2
-
3
- (function ( $, document, window, google, i18n ) {
4
  'use strict';
5
 
6
  // Use function construction to store map & DOM elements separately for each instance
@@ -248,23 +246,27 @@
248
  }
249
  };
250
 
251
- function update() {
252
- $( '.rwmb-map-field' ).each( function () {
253
- var $this = $( this ),
254
- controller = $this.data( 'mapController' );
255
- if ( controller ) {
256
- return;
257
- }
258
 
259
- controller = new MapField( $this );
260
- controller.init();
261
- $this.data( 'mapController', controller );
262
- } );
263
  }
264
 
265
- $( function () {
266
- update();
267
- $( '.rwmb-input' ).on( 'clone', update );
268
- } );
 
 
 
269
 
270
- })( jQuery, document, window, google, RWMB_Map );
 
 
 
1
+ ( function ( $, document, window, google, rwmb, i18n ) {
 
 
2
  'use strict';
3
 
4
  // Use function construction to store map & DOM elements separately for each instance
246
  }
247
  };
248
 
249
+ function initMap() {
250
+ var $this = $( this ),
251
+ controller = $this.data( 'mapController' );
252
+ if ( controller ) {
253
+ return;
254
+ }
 
255
 
256
+ controller = new MapField( $this );
257
+ controller.init();
258
+ $this.data( 'mapController', controller );
 
259
  }
260
 
261
+ function init( e ) {
262
+ $( e.target ).find( '.rwmb-map-field' ).each( initMap );
263
+ }
264
+
265
+ function restart() {
266
+ $( '.rwmb-map-field' ).each( initMap );
267
+ }
268
 
269
+ rwmb.$document
270
+ .on( 'mb_ready', init )
271
+ .on( 'clone', '.rwmb-input', restart );
272
+ } )( jQuery, document, window, google, rwmb, RWMB_Map );
js/media.js CHANGED
@@ -1,8 +1,4 @@
1
- /* global jQuery, _,i18nRwmbMedia */
2
-
3
- window.rwmb = window.rwmb || {};
4
-
5
- jQuery( function ( $ ) {
6
  'use strict';
7
 
8
  var views = rwmb.views = rwmb.views || {},
@@ -389,7 +385,7 @@ jQuery( function ( $ ) {
389
  }
390
  },
391
  render: function () {
392
- this.$el.html( this.template( {text: i18nRwmbMedia.add} ) );
393
  return this;
394
  },
395
 
@@ -567,17 +563,26 @@ jQuery( function ( $ ) {
567
  }
568
  } );
569
 
570
- /**
571
- * Initialize media fields
572
- * @return void
573
- */
574
  function initMediaField() {
575
- var view = new MediaField( { input: this } );
576
- //Remove old then add new
577
- $( this ).siblings( 'div.rwmb-media-view' ).remove();
578
- $( this ).after( view.el );
 
 
 
 
 
 
 
 
 
 
 
 
579
  }
580
 
581
- $( '.rwmb-file_advanced' ).each( initMediaField );
582
- $( document ).on( 'clone', '.rwmb-file_advanced', initMediaField );
583
- } );
 
1
+ ( function ( $, wp, _, rwmb, i18n ) {
 
 
 
 
2
  'use strict';
3
 
4
  var views = rwmb.views = rwmb.views || {},
385
  }
386
  },
387
  render: function () {
388
+ this.$el.html( this.template( {text: i18n.add} ) );
389
  return this;
390
  },
391
 
563
  }
564
  } );
565
 
 
 
 
 
566
  function initMediaField() {
567
+ var $this = $( this ),
568
+ view = $this.data( 'view' );
569
+
570
+ if ( view ) {
571
+ return;
572
+ }
573
+
574
+ view = new MediaField( { input: this } );
575
+
576
+ $this.siblings( '.rwmb-media-view' ).remove();
577
+ $this.after( view.el );
578
+ $this.data( 'view', view );
579
+ }
580
+
581
+ function init( e ) {
582
+ $( e.target ).find( '.rwmb-file_advanced' ).each( initMediaField );
583
  }
584
 
585
+ rwmb.$document
586
+ .on( 'mb_ready', init )
587
+ .on( 'clone', '.rwmb-file_advanced', initMediaField );
588
+ } )( jQuery, wp, _, rwmb, i18nRwmbMedia );
js/oembed.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
  /**
@@ -29,7 +29,7 @@ jQuery( function ( $ ) {
29
  $( this ).siblings( '.rwmb-embed-media' ).html( '' );
30
  }
31
 
32
- $( document )
33
  .on( 'change', '.rwmb-oembed', _.debounce( showPreview, 250 ) )
34
  .on( 'clone', '.rwmb-oembed', removePreview );
35
- } );
1
+ ( function ( $, _, rwmb ) {
2
  'use strict';
3
 
4
  /**
29
  $( this ).siblings( '.rwmb-embed-media' ).html( '' );
30
  }
31
 
32
+ rwmb.$document
33
  .on( 'change', '.rwmb-oembed', _.debounce( showPreview, 250 ) )
34
  .on( 'clone', '.rwmb-oembed', removePreview );
35
+ } )( jQuery, _, rwmb );
js/osm.js CHANGED
@@ -1,4 +1,4 @@
1
- ( function( $, L, i18n ) {
2
  'use strict';
3
 
4
  // Use function construction to store map & DOM elements separately for each instance
@@ -260,23 +260,27 @@
260
  }
261
  };
262
 
263
- function update() {
264
- $( '.rwmb-osm-field' ).each( function () {
265
- var $this = $( this ),
266
- controller = $this.data( 'osmController' );
267
- if ( controller ) {
268
- return;
269
- }
270
 
271
- controller = new OsmField( $this );
272
- controller.init();
273
- $this.data( 'osmController', controller );
274
- } );
275
  }
276
 
277
- $( function () {
278
- update();
279
- $( '.rwmb-input' ).on( 'clone', update );
280
- } );
 
 
 
281
 
282
- } )( jQuery, L, RWMB_Osm );
 
 
 
1
+ ( function( $, L, rwmb, i18n ) {
2
  'use strict';
3
 
4
  // Use function construction to store map & DOM elements separately for each instance
260
  }
261
  };
262
 
263
+ function initOsmMap() {
264
+ var $this = $( this ),
265
+ controller = $this.data( 'osmController' );
266
+ if ( controller ) {
267
+ return;
268
+ }
 
269
 
270
+ controller = new OsmField( $this );
271
+ controller.init();
272
+ $this.data( 'osmController', controller );
 
273
  }
274
 
275
+ function init( e ) {
276
+ $( e.target ).find( '.rwmb-osm-field' ).each( initOsmMap );
277
+ }
278
+
279
+ function restart() {
280
+ $( '.rwmb-osm-field' ).each( initOsmMap );
281
+ }
282
 
283
+ rwmb.$document
284
+ .on( 'mb_ready', init )
285
+ .on( 'clone', '.rwmb-input', restart );
286
+ } )( jQuery, L, rwmb, RWMB_Osm );
js/range.js CHANGED
@@ -1,20 +1,23 @@
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
 
18
- $( '.rwmb-range' ).each( update );
19
- $( document ).on( 'clone', '.rwmb-range', update );
20
- } );
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
  /**
5
+ * Update text value.
 
6
  */
7
  function update() {
8
  var $this = $( this ),
9
  $output = $this.siblings( '.rwmb-output' );
10
 
11
+ $this.on( 'input propertychange change', function () {
12
  $output.html( $this.val() );
13
  } );
14
+ }
15
 
16
+ function init( e ) {
17
+ $( e.target ).find( '.rwmb-range' ).each( update );
18
  }
19
 
20
+ rwmb.$document
21
+ .on( 'mb_ready', init )
22
+ .on( 'clone', '.rwmb-range', update );
23
+ } )( jQuery, rwmb );
js/script.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Global object for shared functions and data.
2
+ window.rwmb = window.rwmb || {};
3
+
4
+ ( function( $, document, rwmb ) {
5
+ 'use strict';
6
+
7
+ // Trigger a custom ready event for all scripts to hook to.
8
+ // Used for static DOM and dynamic DOM (loaded in MB Blocks extension for Gutenberg).
9
+ rwmb.$document = $( document );
10
+ rwmb.$document.on( 'ready', function() {
11
+ rwmb.$document.trigger( 'mb_ready' );
12
+ } );
13
+ } )( jQuery, document, rwmb );
js/select-advanced.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
  /**
@@ -19,20 +19,15 @@ jQuery( function ( $ ) {
19
  }
20
 
21
  /**
22
- * Turn select field into beautiful dropdown with select2 library
23
- * This function is called when document ready and when clone button is clicked (to update the new cloned field)
24
- *
25
- * @return void
26
  */
27
- function update() {
28
  var $this = $( this ),
29
  options = $this.data( 'options' );
30
  $this.removeClass( 'select2-hidden-accessible' );
31
  $this.siblings( '.select2-container' ).remove();
32
  $this.show().select2( options );
33
 
34
- rwmbSelect.bindEvents( $this );
35
-
36
  if ( ! $this.attr( 'multiple' ) ) {
37
  return;
38
  }
@@ -50,6 +45,11 @@ jQuery( function ( $ ) {
50
  } );
51
  }
52
 
53
- $( '.rwmb-select_advanced' ).each( update );
54
- $( document ).on( 'clone', '.rwmb-select_advanced', update );
55
- } );
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
  /**
19
  }
20
 
21
  /**
22
+ * Transform select fields into beautiful dropdown with select2 library.
 
 
 
23
  */
24
+ function transform() {
25
  var $this = $( this ),
26
  options = $this.data( 'options' );
27
  $this.removeClass( 'select2-hidden-accessible' );
28
  $this.siblings( '.select2-container' ).remove();
29
  $this.show().select2( options );
30
 
 
 
31
  if ( ! $this.attr( 'multiple' ) ) {
32
  return;
33
  }
45
  } );
46
  }
47
 
48
+ function init( e ) {
49
+ $( e.target ).find( '.rwmb-select_advanced' ).each( transform );
50
+ }
51
+
52
+ rwmb.$document
53
+ .on( 'mb_ready', init )
54
+ .on( 'clone', '.rwmb-select_advanced', transform );
55
+ } )( jQuery, rwmb );
js/select-tree.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
  function setInitialRequiredProp() {
@@ -46,9 +46,15 @@ jQuery( function ( $ ) {
46
  toggleTree.call( this );
47
  }
48
 
49
- $( '.rwmb-select-tree > select' ).select2();
50
- $( '.rwmb-select-tree > select' ).each( setInitialRequiredProp );
51
- $( '.rwmb-input' )
 
 
 
 
 
 
52
  .on( 'change', '.rwmb-select-tree > select', toggleTree )
53
  .on( 'clone', '.rwmb-select-tree > select', instantiateSelect2 );
54
- } );
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
  function setInitialRequiredProp() {
46
  toggleTree.call( this );
47
  }
48
 
49
+ function init( e ) {
50
+ var $el = $( e.target );
51
+
52
+ $el.find( '.rwmb-select-tree > select' ).select2();
53
+ $el.find( '.rwmb-select-tree > select' ).each( setInitialRequiredProp );
54
+ }
55
+
56
+ rwmb.$document
57
+ .on( 'mb_ready', init )
58
  .on( 'change', '.rwmb-select-tree > select', toggleTree )
59
  .on( 'clone', '.rwmb-select-tree > select', instantiateSelect2 );
60
+ } )( jQuery, rwmb );
js/select.js CHANGED
@@ -1,51 +1,22 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- /**
5
- * Object stores all necessary methods for select All/None actions
6
- * Assign to global variable so we can access to this object from select advanced field
7
- */
8
- var select = {
9
- /**
10
- * Select all/none for select tag
11
- * @param event Click event.
12
- */
13
- selectAllNone: function ( event ) {
14
- event.preventDefault();
15
- var $this = $( this ),
16
- $element = $this.parent().siblings( 'select' );
17
 
18
- if ( 'none' === $this.data( 'type' ) ) {
19
- $element.val( [] ).trigger( 'change' );
20
- return;
21
- }
22
- var selected = [];
23
- $element.find( 'option' ).each( function ( index, option ) {
24
- selected.push( option.value );
25
- } );
26
- $element.val( selected ).trigger( 'change' );
27
- },
28
 
29
- /**
30
- * Add event listener for select all/none links when click
31
- * @param $el jQuery select element
32
- */
33
- bindEvents: function ( $el ) {
34
- $el.closest( '.rwmb-input' ).on( 'click', '.rwmb-select-all-none a', select.selectAllNone );
35
  }
 
 
 
 
 
36
  };
37
 
38
- /**
39
- * Update select field when clicking clone button
40
- */
41
- function update() {
42
- select.bindEvents( $( this ) );
43
- }
44
-
45
- // Run for select field.
46
- $( '.rwmb-select' ).each( update );
47
- $( document ).on( 'clone', '.rwmb-select', update );
48
-
49
- // Export to use for select_advanced.
50
- window.rwmbSelect = select;
51
- } );
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ function toggleAll( e ) {
5
+ e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ var $this = $( this ),
8
+ $select = $this.parent().siblings( 'select' );
 
 
 
 
 
 
 
 
9
 
10
+ if ( 'none' === $this.data( 'type' ) ) {
11
+ $select.val( [] ).trigger( 'change' );
12
+ return;
 
 
 
13
  }
14
+ var selected = [];
15
+ $select.find( 'option' ).each( function ( index, option ) {
16
+ selected.push( option.value );
17
+ } );
18
+ $select.val( selected ).trigger( 'change' );
19
  };
20
 
21
+ rwmb.$document.on( 'click', '.rwmb-select-all-none a', toggleAll );
22
+ } )( jQuery, rwmb );
 
 
 
 
 
 
 
 
 
 
 
 
js/slider.js CHANGED
@@ -1,7 +1,7 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- function update() {
5
  var $input = $( this ),
6
  $slider = $input.siblings( '.rwmb-slider' ),
7
  $valueLabel = $slider.siblings( '.rwmb-slider-value-label' ).find( 'span' ),
@@ -31,6 +31,11 @@ jQuery( function ( $ ) {
31
  $slider.slider( options );
32
  }
33
 
34
- $( '.rwmb-slider-value' ).each( update );
35
- $( document ).on( 'clone', '.rwmb-slider-value', update );
36
- } );
 
 
 
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ function transform() {
5
  var $input = $( this ),
6
  $slider = $input.siblings( '.rwmb-slider' ),
7
  $valueLabel = $slider.siblings( '.rwmb-slider-value-label' ).find( 'span' ),
31
  $slider.slider( options );
32
  }
33
 
34
+ function init( e ) {
35
+ $( e.target ).find( '.rwmb-slider-value' ).each( transform );
36
+ }
37
+
38
+ rwmb.$document
39
+ .on( 'mb_ready', init )
40
+ .on( 'clone', '.rwmb-slider-value', transform );
41
+ } )( jQuery, rwmb );
js/taxonomy.js CHANGED
@@ -1,8 +1,10 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- $( document ).on( 'click', '.rwmb-taxonomy-add-button', function( e ) {
5
  e.preventDefault();
6
  this.nextElementSibling.classList.toggle( 'rwmb-hidden' );
7
- } );
8
- } );
 
 
1
+ ( function ( $, rwmb ) {
2
  'use strict';
3
 
4
+ function toggleAddInput( e ) {
5
  e.preventDefault();
6
  this.nextElementSibling.classList.toggle( 'rwmb-hidden' );
7
+ }
8
+
9
+ rwmb.$document.on( 'click', '.rwmb-taxonomy-add-button', toggleAddInput );
10
+ } )( jQuery, rwmb );
js/time.js CHANGED
@@ -1,11 +1,10 @@
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,29 +12,35 @@ jQuery( function ( $ ) {
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' )
20
- .empty()
21
- .prop( 'id', '' )
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
 
39
- $( '.rwmb-time' ).each( update );
40
- $( '.rwmb-input' ).on( 'clone', '.rwmb-time', update );
41
- } );
 
 
1
+ ( function ( $, rwmb, i18n ) {
2
  'use strict';
3
 
4
  /**
5
+ * Transform an input into a time picker.
 
6
  */
7
+ function transform() {
8
  var $this = $( this ),
9
  options = $this.data( 'options' ),
10
  $inline = $this.siblings( '.rwmb-datetime-inline' ),
12
 
13
  $this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text
14
 
15
+ if ( ! $inline.length ) {
 
 
 
 
 
 
 
 
 
16
  $this.removeClass( 'hasDatepicker' ).timepicker( options );
17
+ return;
18
  }
19
+
20
+ options.altField = '#' + $this.attr( 'id' );
21
+ $inline
22
+ .removeClass( 'hasDatepicker' )
23
+ .empty()
24
+ .prop( 'id', '' )
25
+ .timepicker( options )
26
+ .timepicker( 'setTime', current );
27
  }
28
 
29
  // Set language if available
30
+ function setTimeI18n() {
31
+ if ( $.timepicker.regional.hasOwnProperty( i18n.locale ) ) {
32
+ $.timepicker.setDefaults( $.timepicker.regional[i18n.locale] );
33
+ } else if ( $.timepicker.regional.hasOwnProperty( i18n.localeShort ) ) {
34
+ $.timepicker.setDefaults( $.timepicker.regional[i18n.localeShort] );
35
+ }
36
  }
37
+
38
+ function init( e ) {
39
+ $( e.target ).find( '.rwmb-time' ).each( transform );
40
  }
41
 
42
+ setTimeI18n();
43
+ rwmb.$document
44
+ .on( 'mb_ready', init )
45
+ .on( 'clone', '.rwmb-time', transform );
46
+ } )( jQuery, rwmb, RWMB_Time );
js/video.js CHANGED
@@ -1,7 +1,4 @@
1
- window.rwmb = window.rwmb || {};
2
-
3
- jQuery( function ( $ )
4
- {
5
  'use strict';
6
 
7
  var views = rwmb.views = rwmb.views || {},
@@ -29,18 +26,18 @@ jQuery( function ( $ )
29
  }
30
  } );
31
 
32
- /**
33
- * Initialize image fields
34
- * @return void
35
- */
36
- function initVideoField()
37
- {
38
- var view = new VideoField( { input: this } );
39
- //Remove old then add new
40
- $( this ).siblings( 'div.rwmb-media-view' ).remove();
41
- $( this ).after( view.el );
42
  }
43
- $( '.rwmb-video' ).each( initVideoField );
44
- $( document )
45
- .on( 'clone', '.rwmb-video', initVideoField )
46
- } );
 
1
+ ( function ( $, rwmb ) {
 
 
 
2
  'use strict';
3
 
4
  var views = rwmb.views = rwmb.views || {},
26
  }
27
  } );
28
 
29
+ function initVideoField() {
30
+ var $this = $( this ),
31
+ view = new VideoField( { input: this } );
32
+ $this.siblings( '.rwmb-media-view' ).remove();
33
+ $this.after( view.el );
34
+ }
35
+
36
+ function init( e ) {
37
+ $( e.target ).find( '.rwmb-video' ).each( initVideoField );
 
38
  }
39
+
40
+ rwmb.$document
41
+ .on( 'mb_ready', init )
42
+ .on( 'clone', '.rwmb-video', initVideoField );
43
+ } )( jQuery, rwmb );
js/wysiwyg.js CHANGED
@@ -1,113 +1,135 @@
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
-
26
- // Update the DOM
27
- $this.show();
28
- updateDom( $wrapper, id );
29
-
30
- // TinyMCE
31
- if ( tinyMCEPreInit.mceInit.hasOwnProperty( originalId ) ) {
32
- var settings = tinyMCEPreInit.mceInit[originalId],
33
- editor = new tinymce.Editor(id, settings, tinymce.EditorManager);
34
- editor.render();
35
- }
36
-
37
- // Quick tags
38
- if ( typeof quicktags === 'function' && tinyMCEPreInit.qtInit.hasOwnProperty( originalId ) ) {
39
- var qtSettings = tinyMCEPreInit.qtInit[originalId];
40
- qtSettings.id = id;
41
- quicktags( qtSettings );
42
- QTags._buttonsInit();
43
- }
44
- }
45
-
46
- /**
47
- * Get original ID of the textarea
48
- * The ID will be used to reference to tinyMCE and quick tags settings
49
- * @param $el Current cloned textarea
50
- */
51
- function getOriginalId( $el ) {
52
- var $clone = $el.closest( '.rwmb-clone' ),
53
- currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
54
-
55
- if ( /_\d+$/.test( currentId ) ) {
56
- currentId = currentId.replace( /_\d+$/, '' );
57
- }
58
- if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
59
- return currentId;
60
- }
61
-
62
- return '';
63
- }
64
-
65
- /**
66
- * Update id, class, [data-] attributes, ... of the cloned editor.
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( 'tmce-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
- /**
93
- * Handles updating tiny mce instances when saving a gutenberg post.
94
- * https://metabox.io/support/topic/data-are-not-saved-into-the-database/
95
- * https://github.com/WordPress/gutenberg/issues/7176
96
- */
97
- function ensureSave() {
98
- if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
99
- return;
100
- }
101
- wp.data.subscribe( function() {
102
- var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
103
-
104
- if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
105
- window.tinyMCE.triggerSave();
106
- }
107
- } );
108
- }
109
-
110
- $( '.rwmb-wysiwyg' ).each( update );
111
- $( document ).on( 'clone', '.rwmb-wysiwyg', update );
112
- ensureSave();
113
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function ( $, wp, window, rwmb ) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Transform textarea into wysiwyg editor.
6
+ */
7
+ function transform() {
8
+ var $this = $( this ),
9
+ $wrapper = $this.closest( '.wp-editor-wrap' ),
10
+ id = $this.attr( 'id' );
11
+
12
+ // Ignore existing editor.
13
+ if ( tinyMCEPreInit.mceInit[id] ) {
14
+ return;
15
+ }
16
+
17
+ // Update the DOM
18
+ $this.show();
19
+ updateDom( $wrapper, id );
20
+
21
+ // Get id of the original editor to get its tinyMCE and quick tags settings
22
+ var originalId = getOriginalId( $this ),
23
+ settings = getEditorSettings( originalId );
24
+
25
+ // TinyMCE
26
+ if ( window.tinymce ) {
27
+ var editor = new tinymce.Editor(id, settings.tinymce, tinymce.EditorManager);
28
+ editor.render();
29
+ }
30
+
31
+ // Quick tags
32
+ if ( window.quicktags ) {
33
+ settings.quicktags.id = id;
34
+ quicktags( settings.quicktags );
35
+ QTags._buttonsInit();
36
+ }
37
+ }
38
+
39
+ function getEditorSettings( id ) {
40
+ var settings = getDefaultEditorSettings();
41
+
42
+ if ( id && tinyMCEPreInit.mceInit.hasOwnProperty( id ) ) {
43
+ settings.tinymce = tinyMCEPreInit.mceInit[id];
44
+ }
45
+ if ( id && window.quicktags && tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) {
46
+ settings.quicktags = tinyMCEPreInit.qtInit[id];
47
+ }
48
+
49
+ return settings;
50
+ }
51
+
52
+ function getDefaultEditorSettings() {
53
+ var settings = wp.editor.getDefaultSettings();
54
+
55
+ settings.tinymce.toolbar1 = 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,fullscreen,wp_adv';
56
+ settings.tinymce.toolbar2 = 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help';
57
+
58
+ settings.quicktags.buttons = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
59
+
60
+ return settings;
61
+ }
62
+
63
+ /**
64
+ * Get original ID of the textarea
65
+ * The ID will be used to reference to tinyMCE and quick tags settings
66
+ * @param $el Current cloned textarea
67
+ */
68
+ function getOriginalId( $el ) {
69
+ var $clone = $el.closest( '.rwmb-clone' ),
70
+ currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
71
+
72
+ if ( /_\d+$/.test( currentId ) ) {
73
+ currentId = currentId.replace( /_\d+$/, '' );
74
+ }
75
+ if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
76
+ return currentId;
77
+ }
78
+
79
+ return '';
80
+ }
81
+
82
+ /**
83
+ * Update id, class, [data-] attributes, ... of the cloned editor.
84
+ * @param $wrapper Editor wrapper element
85
+ * @param id Editor ID
86
+ */
87
+ function updateDom( $wrapper, id ) {
88
+ // Wrapper div and media buttons
89
+ $wrapper.attr( 'id', 'wp-' + id + '-wrap' )
90
+ .removeClass( 'html-active' ).addClass( 'tmce-active' ) // Active the visual mode by default
91
+ .find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
92
+ .find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
93
+ .find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
94
+ .find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
95
+
96
+ // Editor tabs
97
+ $wrapper.find( '.switch-tmce' )
98
+ .attr( 'id', id + 'tmce' )
99
+ .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
100
+ .find( '.switch-html' )
101
+ .attr( 'id', id + 'html' )
102
+ .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
103
+
104
+ // Quick tags
105
+ $wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
106
+ .find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
107
+ }
108
+
109
+ /**
110
+ * Handles updating tiny mce instances when saving a gutenberg post.
111
+ * https://metabox.io/support/topic/data-are-not-saved-into-the-database/
112
+ * https://github.com/WordPress/gutenberg/issues/7176
113
+ */
114
+ function ensureSave() {
115
+ if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
116
+ return;
117
+ }
118
+ wp.data.subscribe( function() {
119
+ var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
120
+
121
+ if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
122
+ window.tinyMCE.triggerSave();
123
+ }
124
+ } );
125
+ }
126
+
127
+ function init( e ) {
128
+ $( e.target ).find( '.rwmb-wysiwyg' ).each( transform );
129
+ }
130
+
131
+ ensureSave();
132
+ rwmb.$document
133
+ .on( 'mb_blocks_edit', init )
134
+ .on( 'clone', '.rwmb-wysiwyg', transform );
135
+ } )( jQuery, wp, window, rwmb );
languages/meta-box-pt_BR.mo DELETED
Binary file
languages/meta-box-pt_BR.po DELETED
@@ -1,124 +0,0 @@
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 "&#8211;"
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
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/meta-box-ru_RU.mo DELETED
Binary file
languages/meta-box-ru_RU.po DELETED
@@ -1,637 +0,0 @@
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 "&#8211;"
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 "Загрузите с компьютера"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
- * Version: 4.18.4
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
@@ -14,6 +14,17 @@
14
  */
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
 
 
 
 
 
 
 
 
 
 
 
17
  require_once dirname( __FILE__ ) . '/inc/loader.php';
18
  $rwmb_loader = new RWMB_Loader();
19
  $rwmb_loader->init();
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
+ * Version: 5.0.0
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
14
  */
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
17
+ register_activation_hook( __FILE__, 'rwmb_check_php_version' );
18
+
19
+ /**
20
+ * Display notice for old PHP version.
21
+ */
22
+ function rwmb_check_php_version() {
23
+ if ( version_compare( phpversion(), '5.3', '<' ) ) {
24
+ die( esc_html__( 'Meta Box requires PHP version 5.3+. Please contact your host to upgrade.', 'meta-box' ) );
25
+ }
26
+ }
27
+
28
  require_once dirname( __FILE__ ) . '/inc/loader.php';
29
  $rwmb_loader = new RWMB_Loader();
30
  $rwmb_loader->init();
readme.txt CHANGED
@@ -3,8 +3,9 @@ Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, rua
3
  Donate link: https://metabox.io/pricing/
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
 
6
  Tested up to: 5.2.2
7
- Stable tag: 4.18.4
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
3
  Donate link: https://metabox.io/pricing/
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
+ Requires PHP: 5.3
7
  Tested up to: 5.2.2
8
+ Stable tag: 5.0.0
9
  License: GPLv2 or later
10
 
11
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.