@@ -683,7 +683,7 @@ |
||
| 683 | 683 | * |
| 684 | 684 | * @param array $field Field definition. |
| 685 | 685 | * @param string $field_type A CMB2 field type. |
| 686 | - * @param mixed $option_value Option value. |
|
| 686 | + * @param string $option_value Option value. |
|
| 687 | 687 | */ |
| 688 | 688 | static function afo( $field, $field_type, $option_value ) { |
| 689 | 689 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @license GPL-2.0+ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'CMB2_Meta_Box_Post_Type' ) ) { |
|
| 13 | +if ( ! class_exists('CMB2_Meta_Box_Post_Type')) { |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Class CMB2_Meta_Box_Post_Type. |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function __construct() { |
| 57 | 57 | |
| 58 | - add_action( 'init', array( $this, 'init_post_type' ) ); |
|
| 59 | - add_action( 'add_meta_boxes', array( $this, 'remove_meta_box_slugdiv' ) ); |
|
| 60 | - add_action( 'admin_head', array( $this, 'hide_edit_slug_bar' ) ); |
|
| 61 | - add_action( 'pre_current_active_plugins', array( $this, 'hide_cmb2_plugins' ) ); |
|
| 62 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 58 | + add_action('init', array($this, 'init_post_type')); |
|
| 59 | + add_action('add_meta_boxes', array($this, 'remove_meta_box_slugdiv')); |
|
| 60 | + add_action('admin_head', array($this, 'hide_edit_slug_bar')); |
|
| 61 | + add_action('pre_current_active_plugins', array($this, 'hide_cmb2_plugins')); |
|
| 62 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
| 63 | 63 | |
| 64 | - add_filter( 'cmb2_row_classes', array( $this, 'show_hide_classes' ), 10, 2 ); |
|
| 64 | + add_filter('cmb2_row_classes', array($this, 'show_hide_classes'), 10, 2); |
|
| 65 | 65 | |
| 66 | - add_action( 'cmb2_init', array( $this, 'init_meta_box_settings' ) ); |
|
| 67 | - add_action( 'cmb2_init', array( $this, 'init_custom_field_settings' ) ); |
|
| 68 | - add_action( 'cmb2_init', array( $this, 'init_user_defined_meta_boxes_and_fields' ) ); |
|
| 66 | + add_action('cmb2_init', array($this, 'init_meta_box_settings')); |
|
| 67 | + add_action('cmb2_init', array($this, 'init_custom_field_settings')); |
|
| 68 | + add_action('cmb2_init', array($this, 'init_user_defined_meta_boxes_and_fields')); |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
@@ -77,30 +77,30 @@ discard block |
||
| 77 | 77 | public function init_post_type() { |
| 78 | 78 | |
| 79 | 79 | $labels = array( |
| 80 | - 'name' => _x( 'Meta Boxes', 'Post Type General Name', 'cmb2-admin-extension' ), |
|
| 81 | - 'singular_name' => _x( 'Meta Box', 'Post Type Singular Name', 'cmb2-admin-extension' ), |
|
| 82 | - 'menu_name' => __( 'CMB2', 'cmb2-admin-extension' ), |
|
| 83 | - 'name_admin_bar' => __( 'Meta Box', 'cmb2-admin-extension' ), |
|
| 84 | - 'parent_item_colon' => __( 'Meta Box:', 'cmb2-admin-extension' ), |
|
| 85 | - 'all_items' => __( 'All Meta Boxes', 'cmb2-admin-extension' ), |
|
| 86 | - 'add_new_item' => __( 'Add New Meta Box', 'cmb2-admin-extension' ), |
|
| 87 | - 'add_new' => __( 'Add New Meta Box', 'cmb2-admin-extension' ), |
|
| 88 | - 'new_item' => __( 'New Meta Box', 'cmb2-admin-extension' ), |
|
| 89 | - 'edit_item' => __( 'Edit Meta Box', 'cmb2-admin-extension' ), |
|
| 90 | - 'update_item' => __( 'Update Meta Box', 'cmb2-admin-extension' ), |
|
| 91 | - 'view_item' => __( 'View Meta Box', 'cmb2-admin-extension' ), |
|
| 92 | - 'search_items' => __( 'Search Meta Box', 'cmb2-admin-extension' ), |
|
| 93 | - 'not_found' => __( 'Not found', 'cmb2-admin-extension' ), |
|
| 94 | - 'not_found_in_trash' => __( 'Not found in Trash', 'cmb2-admin-extension' ), |
|
| 80 | + 'name' => _x('Meta Boxes', 'Post Type General Name', 'cmb2-admin-extension'), |
|
| 81 | + 'singular_name' => _x('Meta Box', 'Post Type Singular Name', 'cmb2-admin-extension'), |
|
| 82 | + 'menu_name' => __('CMB2', 'cmb2-admin-extension'), |
|
| 83 | + 'name_admin_bar' => __('Meta Box', 'cmb2-admin-extension'), |
|
| 84 | + 'parent_item_colon' => __('Meta Box:', 'cmb2-admin-extension'), |
|
| 85 | + 'all_items' => __('All Meta Boxes', 'cmb2-admin-extension'), |
|
| 86 | + 'add_new_item' => __('Add New Meta Box', 'cmb2-admin-extension'), |
|
| 87 | + 'add_new' => __('Add New Meta Box', 'cmb2-admin-extension'), |
|
| 88 | + 'new_item' => __('New Meta Box', 'cmb2-admin-extension'), |
|
| 89 | + 'edit_item' => __('Edit Meta Box', 'cmb2-admin-extension'), |
|
| 90 | + 'update_item' => __('Update Meta Box', 'cmb2-admin-extension'), |
|
| 91 | + 'view_item' => __('View Meta Box', 'cmb2-admin-extension'), |
|
| 92 | + 'search_items' => __('Search Meta Box', 'cmb2-admin-extension'), |
|
| 93 | + 'not_found' => __('Not found', 'cmb2-admin-extension'), |
|
| 94 | + 'not_found_in_trash' => __('Not found in Trash', 'cmb2-admin-extension'), |
|
| 95 | 95 | ); |
| 96 | 96 | $args = array( |
| 97 | - 'label' => __( 'meta_box', 'cmb2-admin-extension' ), |
|
| 98 | - 'description' => __( 'Create custom meta boxes and fields', 'cmb2-admin-extension' ), |
|
| 97 | + 'label' => __('meta_box', 'cmb2-admin-extension'), |
|
| 98 | + 'description' => __('Create custom meta boxes and fields', 'cmb2-admin-extension'), |
|
| 99 | 99 | 'labels' => $labels, |
| 100 | 100 | 'supports' => array(), |
| 101 | 101 | 'hierarchical' => false, |
| 102 | 102 | 'rewrite' => true, |
| 103 | - 'supports' => array( 'title' ), |
|
| 103 | + 'supports' => array('title'), |
|
| 104 | 104 | 'public' => true, |
| 105 | 105 | 'menu_position' => 100, |
| 106 | 106 | 'menu_icon' => 'dashicons-feedback', |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'capability_type' => 'page', |
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | - if ( $this->is_cmb2_allowed() ) { |
|
| 116 | + if ($this->is_cmb2_allowed()) { |
|
| 117 | 117 | |
| 118 | 118 | $args['show_ui'] = true; |
| 119 | 119 | $args['show_in_menu'] = true; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $args['show_in_menu'] = false; |
| 125 | 125 | |
| 126 | 126 | } |
| 127 | - register_post_type( 'meta_box', $args ); |
|
| 127 | + register_post_type('meta_box', $args); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function remove_meta_box_slugdiv() { |
| 136 | 136 | |
| 137 | - remove_meta_box( 'slugdiv', 'page', 'normal' ); |
|
| 137 | + remove_meta_box('slugdiv', 'page', 'normal'); |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | global $post; |
| 149 | 149 | |
| 150 | - if ( isset( $post->post_type ) && $post->post_type === 'meta_box' ) { |
|
| 150 | + if (isset($post->post_type) && $post->post_type === 'meta_box') { |
|
| 151 | 151 | |
| 152 | 152 | echo '<style type="text/css"> #edit-slug-box, #minor-publishing { display: none; }</style>'; |
| 153 | 153 | |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function is_cmb2_allowed() { |
| 165 | 165 | |
| 166 | - $cmb2_settings = get_option( '_cmb2_settings' ); |
|
| 166 | + $cmb2_settings = get_option('_cmb2_settings'); |
|
| 167 | 167 | |
| 168 | - if ( empty( $cmb2_settings ) ) { |
|
| 168 | + if (empty($cmb2_settings)) { |
|
| 169 | 169 | // No settings saved. |
| 170 | 170 | return true; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $current_user = wp_get_current_user(); |
| 174 | - $allowed_users = isset( $cmb2_settings['_cmb2_user_multicheckbox'] ) ? $cmb2_settings['_cmb2_user_multicheckbox'] : array(); |
|
| 174 | + $allowed_users = isset($cmb2_settings['_cmb2_user_multicheckbox']) ? $cmb2_settings['_cmb2_user_multicheckbox'] : array(); |
|
| 175 | 175 | |
| 176 | - if ( empty( $allowed_users ) || in_array( $current_user->ID, $allowed_users ) ) { |
|
| 176 | + if (empty($allowed_users) || in_array($current_user->ID, $allowed_users)) { |
|
| 177 | 177 | |
| 178 | 178 | return true; |
| 179 | 179 | |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | public function hide_cmb2_plugins() { |
| 193 | 193 | |
| 194 | 194 | global $wp_list_table; |
| 195 | - if ( ! $this->is_cmb2_allowed() ) { |
|
| 196 | - $to_hide = array( CMB2AE_CMB2_PLUGIN_FILE, 'cmb2-admin-extension/cmb2-admin-extension.php' ); |
|
| 195 | + if ( ! $this->is_cmb2_allowed()) { |
|
| 196 | + $to_hide = array(CMB2AE_CMB2_PLUGIN_FILE, 'cmb2-admin-extension/cmb2-admin-extension.php'); |
|
| 197 | 197 | $plugins = $wp_list_table->items; |
| 198 | - foreach ( $plugins as $key => $val ) { |
|
| 199 | - if ( in_array( $key, $to_hide ) ) { |
|
| 200 | - unset( $wp_list_table->items[ $key ] ); |
|
| 198 | + foreach ($plugins as $key => $val) { |
|
| 199 | + if (in_array($key, $to_hide)) { |
|
| 200 | + unset($wp_list_table->items[$key]); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | public function enqueue_scripts() { |
| 213 | 213 | |
| 214 | 214 | $screen = get_current_screen(); |
| 215 | - if ( $screen->post_type === 'meta_box' ) { |
|
| 215 | + if ($screen->post_type === 'meta_box') { |
|
| 216 | 216 | |
| 217 | - wp_register_style( 'cmb2_admin_styles', CMB2AE_URI . '/css/meta-box-fields.css', false, '0.0.8' ); |
|
| 218 | - wp_enqueue_style( 'cmb2_admin_styles' ); |
|
| 219 | - wp_enqueue_script( 'cmb2_admin_scripts', CMB2AE_URI . '/js/meta-box-fields.js', true, array( 'jquery' ), '0.0.8' ); |
|
| 217 | + wp_register_style('cmb2_admin_styles', CMB2AE_URI . '/css/meta-box-fields.css', false, '0.0.8'); |
|
| 218 | + wp_enqueue_style('cmb2_admin_styles'); |
|
| 219 | + wp_enqueue_script('cmb2_admin_scripts', CMB2AE_URI . '/js/meta-box-fields.js', true, array('jquery'), '0.0.8'); |
|
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | * @param array $field_classes CSS Classes. |
| 233 | 233 | * @param string $classes CSS Classes to add. |
| 234 | 234 | */ |
| 235 | - public function conditionally_add_class( $field_id, $field_classes, $classes ) { |
|
| 235 | + public function conditionally_add_class($field_id, $field_classes, $classes) { |
|
| 236 | 236 | |
| 237 | - foreach ( $field_classes as $field => $class ) { |
|
| 238 | - if ( strpos( $field_id, $field ) !== false ) { |
|
| 237 | + foreach ($field_classes as $field => $class) { |
|
| 238 | + if (strpos($field_id, $field) !== false) { |
|
| 239 | 239 | return $classes . ' ' . $class; |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | * @param array $classes CSS Classes. |
| 253 | 253 | * @param object $field CMB2 Field object. |
| 254 | 254 | */ |
| 255 | - public function show_hide_classes( $classes, $field ) { |
|
| 255 | + public function show_hide_classes($classes, $field) { |
|
| 256 | 256 | |
| 257 | 257 | $screen = get_current_screen(); |
| 258 | - if ( $screen->post_type === 'meta_box' ) { |
|
| 258 | + if ($screen->post_type === 'meta_box') { |
|
| 259 | 259 | $field_classes = array( |
| 260 | 260 | 'repeatable_checkbox' => 'cmb_hide_field text text_small text_medium text_email text_url text_money textarea textarea_small textarea_code text_date text_timeselect_timezone text_date_timestamp text_datetime_timestamp text_datetime_timestamp_timezone colorpicker select multicheck multicheck_inline', |
| 261 | 261 | 'protocols_checkbox' => 'cmb_hide_field text_url', |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | 'add_upload_file_text' => 'cmb_hide_field file', |
| 272 | 272 | 'default_value_text' => 'default_value', |
| 273 | 273 | ); |
| 274 | - $classes = $this->conditionally_add_class( $field->args['id'], $field_classes, $classes ); |
|
| 274 | + $classes = $this->conditionally_add_class($field->args['id'], $field_classes, $classes); |
|
| 275 | 275 | } |
| 276 | 276 | return $classes; |
| 277 | 277 | |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function tax_options() { |
| 286 | 286 | |
| 287 | - $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); |
|
| 287 | + $taxonomies = get_taxonomies(array('public' => true), 'objects'); |
|
| 288 | 288 | $tax_options = array(); |
| 289 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 289 | + foreach ($taxonomies as $taxonomy) { |
|
| 290 | 290 | |
| 291 | - $tax_options[ $taxonomy->name ] = $taxonomy->labels->name; |
|
| 291 | + $tax_options[$taxonomy->name] = $taxonomy->labels->name; |
|
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | return $tax_options; |
@@ -304,86 +304,86 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | // Start with an underscore to hide fields from custom fields list. |
| 306 | 306 | $prefix = $this->prefix; |
| 307 | - $post_type_objects = get_post_types( '', 'object' ); |
|
| 307 | + $post_type_objects = get_post_types('', 'object'); |
|
| 308 | 308 | $post_types = array(); |
| 309 | 309 | |
| 310 | - foreach ( $post_type_objects as $post_type_object ) { |
|
| 311 | - if ( $post_type_object->show_ui && $post_type_object->name !== 'meta_box' ) { |
|
| 312 | - $post_types[ $post_type_object->name ] = $post_type_object->label; |
|
| 310 | + foreach ($post_type_objects as $post_type_object) { |
|
| 311 | + if ($post_type_object->show_ui && $post_type_object->name !== 'meta_box') { |
|
| 312 | + $post_types[$post_type_object->name] = $post_type_object->label; |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
| 317 | 317 | * Initiate the metabox. |
| 318 | 318 | */ |
| 319 | - $cmb = new_cmb2_box( array( |
|
| 319 | + $cmb = new_cmb2_box(array( |
|
| 320 | 320 | 'id' => 'metabox_settings', |
| 321 | - 'title' => __( 'Metabox Settings', 'cmb2-admin-extension' ), |
|
| 322 | - 'object_types' => array( 'meta_box' ), // Post type. |
|
| 321 | + 'title' => __('Metabox Settings', 'cmb2-admin-extension'), |
|
| 322 | + 'object_types' => array('meta_box'), // Post type. |
|
| 323 | 323 | 'context' => 'side', |
| 324 | 324 | 'priority' => 'low', |
| 325 | 325 | 'show_names' => true, |
| 326 | - ) ); |
|
| 326 | + )); |
|
| 327 | 327 | |
| 328 | - $cmb->add_field( array( |
|
| 329 | - 'name' => __( 'Post Types', 'cmb2-admin-extension' ), |
|
| 330 | - 'desc' => __( 'Check the post types that you want to add this meta box to.', 'cmb2-admin-extension' ), |
|
| 328 | + $cmb->add_field(array( |
|
| 329 | + 'name' => __('Post Types', 'cmb2-admin-extension'), |
|
| 330 | + 'desc' => __('Check the post types that you want to add this meta box to.', 'cmb2-admin-extension'), |
|
| 331 | 331 | 'id' => $prefix . 'post_type_multicheckbox', |
| 332 | 332 | 'type' => 'multicheck', |
| 333 | 333 | 'options' => $post_types, |
| 334 | 334 | 'inline' => true, |
| 335 | - ) ); |
|
| 335 | + )); |
|
| 336 | 336 | |
| 337 | - $cmb->add_field( array( |
|
| 338 | - 'name' => __( 'Priority', 'cmb2-admin-extension' ), |
|
| 339 | - 'desc' => __( 'This is to control what order your meta box appears in.', 'cmb2-admin-extension' ), |
|
| 337 | + $cmb->add_field(array( |
|
| 338 | + 'name' => __('Priority', 'cmb2-admin-extension'), |
|
| 339 | + 'desc' => __('This is to control what order your meta box appears in.', 'cmb2-admin-extension'), |
|
| 340 | 340 | 'id' => $prefix . 'priority_radio', |
| 341 | 341 | 'type' => 'radio', |
| 342 | 342 | 'default' => 'high', |
| 343 | 343 | 'options' => array( |
| 344 | - 'high' => __( 'High', 'cmb2-admin-extension' ), |
|
| 345 | - 'core' => __( 'Core', 'cmb2-admin-extension' ), |
|
| 346 | - 'default' => __( 'Default', 'cmb2-admin-extension' ), |
|
| 347 | - 'low' => __( 'Low', 'cmb2-admin-extension' ), |
|
| 344 | + 'high' => __('High', 'cmb2-admin-extension'), |
|
| 345 | + 'core' => __('Core', 'cmb2-admin-extension'), |
|
| 346 | + 'default' => __('Default', 'cmb2-admin-extension'), |
|
| 347 | + 'low' => __('Low', 'cmb2-admin-extension'), |
|
| 348 | 348 | ), |
| 349 | 349 | 'inline' => true, |
| 350 | - ) ); |
|
| 350 | + )); |
|
| 351 | 351 | |
| 352 | - $cmb->add_field( array( |
|
| 353 | - 'name' => __( 'Context', 'cmb2-admin-extension' ), |
|
| 354 | - 'desc' => __( 'This additional controls for positioning of the meta box. Advanced displays after Normal. Side places the meta box in the right sidebar.', 'cmb2-admin-extension' ), |
|
| 352 | + $cmb->add_field(array( |
|
| 353 | + 'name' => __('Context', 'cmb2-admin-extension'), |
|
| 354 | + 'desc' => __('This additional controls for positioning of the meta box. Advanced displays after Normal. Side places the meta box in the right sidebar.', 'cmb2-admin-extension'), |
|
| 355 | 355 | 'id' => $prefix . 'context_radio', |
| 356 | 356 | 'type' => 'radio', |
| 357 | 357 | 'default' => 'advanced', |
| 358 | 358 | 'options' => array( |
| 359 | - 'advanced' => __( 'Advanced', 'cmb2-admin-extension' ), |
|
| 360 | - 'normal' => __( 'Normal', 'cmb2-admin-extension' ), |
|
| 361 | - 'side' => __( 'Side', 'cmb2-admin-extension' ), |
|
| 359 | + 'advanced' => __('Advanced', 'cmb2-admin-extension'), |
|
| 360 | + 'normal' => __('Normal', 'cmb2-admin-extension'), |
|
| 361 | + 'side' => __('Side', 'cmb2-admin-extension'), |
|
| 362 | 362 | ), |
| 363 | 363 | 'inline' => true, |
| 364 | - ) ); |
|
| 364 | + )); |
|
| 365 | 365 | |
| 366 | - $cmb->add_field( array( |
|
| 367 | - 'name' => __( 'Show Names', 'cmb2-admin-extension' ), |
|
| 368 | - 'desc' => __( 'Show field names on the left', 'cmb2-admin-extension' ), |
|
| 366 | + $cmb->add_field(array( |
|
| 367 | + 'name' => __('Show Names', 'cmb2-admin-extension'), |
|
| 368 | + 'desc' => __('Show field names on the left', 'cmb2-admin-extension'), |
|
| 369 | 369 | 'id' => $prefix . 'show_names', |
| 370 | 370 | 'type' => 'checkbox', |
| 371 | 371 | 'default' => 'on', |
| 372 | - ) ); |
|
| 372 | + )); |
|
| 373 | 373 | |
| 374 | - $cmb->add_field( array( |
|
| 375 | - 'name' => __( 'Disable CMB2 Styles', 'cmb2-admin-extension' ), |
|
| 376 | - 'desc' => __( 'Check to disable the CMB stylesheet', 'cmb2-admin-extension' ), |
|
| 374 | + $cmb->add_field(array( |
|
| 375 | + 'name' => __('Disable CMB2 Styles', 'cmb2-admin-extension'), |
|
| 376 | + 'desc' => __('Check to disable the CMB stylesheet', 'cmb2-admin-extension'), |
|
| 377 | 377 | 'id' => $prefix . 'disable_styles', |
| 378 | 378 | 'type' => 'checkbox', |
| 379 | - ) ); |
|
| 379 | + )); |
|
| 380 | 380 | |
| 381 | - $cmb->add_field( array( |
|
| 382 | - 'name' => __( 'Closed by Default', 'cmb2-admin-extension' ), |
|
| 383 | - 'desc' => __( 'Check to keep the metabox closed by default', 'cmb2-admin-extension' ), |
|
| 381 | + $cmb->add_field(array( |
|
| 382 | + 'name' => __('Closed by Default', 'cmb2-admin-extension'), |
|
| 383 | + 'desc' => __('Check to keep the metabox closed by default', 'cmb2-admin-extension'), |
|
| 384 | 384 | 'id' => $prefix . 'closed', |
| 385 | 385 | 'type' => 'checkbox', |
| 386 | - ) ); |
|
| 386 | + )); |
|
| 387 | 387 | |
| 388 | 388 | } |
| 389 | 389 | |
@@ -400,42 +400,42 @@ discard block |
||
| 400 | 400 | /** |
| 401 | 401 | * Repeatable Field Groups. |
| 402 | 402 | */ |
| 403 | - $cmb_group = new_cmb2_box( array( |
|
| 403 | + $cmb_group = new_cmb2_box(array( |
|
| 404 | 404 | 'id' => $prefix . 'custom_fields', |
| 405 | - 'title' => __( 'Custom Field Settings', 'cmb2-admin-extension' ), |
|
| 406 | - 'object_types' => array( 'meta_box' ), |
|
| 407 | - ) ); |
|
| 405 | + 'title' => __('Custom Field Settings', 'cmb2-admin-extension'), |
|
| 406 | + 'object_types' => array('meta_box'), |
|
| 407 | + )); |
|
| 408 | 408 | |
| 409 | 409 | // $group_field_id is the field id string, so in this case: $prefix . 'demo'. |
| 410 | - $group_field_id = $cmb_group->add_field( array( |
|
| 410 | + $group_field_id = $cmb_group->add_field(array( |
|
| 411 | 411 | 'id' => $prefix . 'custom_field', |
| 412 | 412 | 'type' => 'group', |
| 413 | - 'description' => __( 'Add the custom fields that you want to display with in this meta box.', 'cmb2-admin-extension' ), |
|
| 413 | + 'description' => __('Add the custom fields that you want to display with in this meta box.', 'cmb2-admin-extension'), |
|
| 414 | 414 | 'options' => array( |
| 415 | - 'group_title' => __( 'Field {#}', 'cmb2-admin-extension' ), // {#} gets replaced by row number. |
|
| 416 | - 'add_button' => __( 'Add Another Field', 'cmb2-admin-extension' ), |
|
| 417 | - 'remove_button' => __( 'Remove Field', 'cmb2-admin-extension' ), |
|
| 415 | + 'group_title' => __('Field {#}', 'cmb2-admin-extension'), // {#} gets replaced by row number. |
|
| 416 | + 'add_button' => __('Add Another Field', 'cmb2-admin-extension'), |
|
| 417 | + 'remove_button' => __('Remove Field', 'cmb2-admin-extension'), |
|
| 418 | 418 | 'sortable' => true, // Beta. |
| 419 | 419 | ), |
| 420 | - ) ); |
|
| 420 | + )); |
|
| 421 | 421 | |
| 422 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 423 | - 'name' => __( 'Name', 'cmb2-admin-extension' ), |
|
| 424 | - 'desc' => __( 'Add a field name.', 'cmb2-admin-extension' ), |
|
| 422 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 423 | + 'name' => __('Name', 'cmb2-admin-extension'), |
|
| 424 | + 'desc' => __('Add a field name.', 'cmb2-admin-extension'), |
|
| 425 | 425 | 'id' => $prefix . 'name_text', |
| 426 | 426 | 'type' => 'text', |
| 427 | - ) ); |
|
| 427 | + )); |
|
| 428 | 428 | |
| 429 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 430 | - 'name' => __( 'Description', 'cmb2-admin-extension' ), |
|
| 431 | - 'desc' => __( 'Add a field description.', 'cmb2-admin-extension' ), |
|
| 429 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 430 | + 'name' => __('Description', 'cmb2-admin-extension'), |
|
| 431 | + 'desc' => __('Add a field description.', 'cmb2-admin-extension'), |
|
| 432 | 432 | 'id' => $prefix . 'decription_textarea', |
| 433 | 433 | 'type' => 'textarea_small', |
| 434 | - ) ); |
|
| 434 | + )); |
|
| 435 | 435 | |
| 436 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 437 | - 'name' => __( 'Field Type', 'cmb2-admin-extension' ), |
|
| 438 | - 'desc' => __( 'Pick what type of field to display.', 'cmb2-admin-extension' ) . '</br>' . __( 'For a full list of fields visit <a href="https://github.com/WebDevStudios/CMB2/wiki/Field-Types">the documentation</a>.', 'cmb2-admin-extension' ) . '</br>* ' . __( 'Not available as a repeatable field.', 'cmb2-admin-extension' ) . '</br>† ' . __( 'Use file_list for repeatable.', 'cmb2-admin-extension' ), |
|
| 436 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 437 | + 'name' => __('Field Type', 'cmb2-admin-extension'), |
|
| 438 | + 'desc' => __('Pick what type of field to display.', 'cmb2-admin-extension') . '</br>' . __('For a full list of fields visit <a href="https://github.com/WebDevStudios/CMB2/wiki/Field-Types">the documentation</a>.', 'cmb2-admin-extension') . '</br>* ' . __('Not available as a repeatable field.', 'cmb2-admin-extension') . '</br>† ' . __('Use file_list for repeatable.', 'cmb2-admin-extension'), |
|
| 439 | 439 | 'id' => $prefix . 'field_type_select', |
| 440 | 440 | 'attributes' => array( |
| 441 | 441 | 'class' => 'cmb2_select field_type_select', |
@@ -443,52 +443,52 @@ discard block |
||
| 443 | 443 | 'type' => 'select', |
| 444 | 444 | 'show_option_none' => false, |
| 445 | 445 | 'options' => array( |
| 446 | - 'title' => 'title: ' . __( 'An arbitrary title field', 'cmb2-admin-extension' ) . ' *', |
|
| 447 | - 'text' => 'text: ' . __( 'Text', 'cmb2-admin-extension' ), |
|
| 448 | - 'text_small' => 'text_small: ' . __( 'Text Small', 'cmb2-admin-extension' ), |
|
| 449 | - 'text_medium' => 'text_medium: ' . __( 'Text Medium', 'cmb2-admin-extension' ), |
|
| 450 | - 'text_email' => 'text_email: ' . __( 'Email', 'cmb2-admin-extension' ), |
|
| 451 | - 'text_url' => 'text_url: ' . __( 'URL', 'cmb2-admin-extension' ), |
|
| 452 | - 'text_money' => 'text_money: ' . __( 'Money', 'cmb2-admin-extension' ), |
|
| 453 | - 'textarea' => 'textarea: ' . __( 'Text Area', 'cmb2-admin-extension' ), |
|
| 454 | - 'textarea_small' => 'textarea_small: ' . __( 'Text Area Small', 'cmb2-admin-extension' ), |
|
| 455 | - 'textarea_code' => 'textarea_code: ' . __( 'Text Area Code', 'cmb2-admin-extension' ), |
|
| 456 | - 'text_date' => 'text_date: ' . __( 'Date Picker', 'cmb2-admin-extension' ), |
|
| 457 | - 'text_time' => 'text_time: ' . __( 'Time picker', 'cmb2-admin-extension' ), |
|
| 458 | - 'select_timezone' => 'select_timezone: ' . __( 'Time zone dropdown', 'cmb2-admin-extension' ), |
|
| 459 | - 'text_date_timestamp' => 'text_date_timestamp: ' . __( 'Date Picker (UNIX timestamp)', 'cmb2-admin-extension' ), |
|
| 460 | - 'text_datetime_timestamp' => 'text_datetime_timestamp: ' . __( 'Text Date/Time Picker Combo (UNIX timestamp)', 'cmb2-admin-extension' ), |
|
| 461 | - 'text_datetime_timestamp_timezone' => 'text_datetime_timestamp_timezone: ' . __( 'Text Date/Time Picker/Time zone Combo (serialized DateTime object)', 'cmb2-admin-extension' ), |
|
| 462 | - 'colorpicker' => 'colorpicker: ' . __( 'Color picker', 'cmb2-admin-extension' ), |
|
| 463 | - 'radio' => 'radio: ' . __( 'Radio Buttons', 'cmb2-admin-extension' ) . ' *', |
|
| 464 | - 'radio_inline' => 'radio_inline: ' . __( 'Radio Buttons Inline', 'cmb2-admin-extension' ) . ' *', |
|
| 465 | - 'taxonomy_radio' => 'taxonomy_radio: ' . __( 'Taxonomy Radio Buttons', 'cmb2-admin-extension' ) . ' *', |
|
| 466 | - 'taxonomy_radio_inline' => 'taxonomy_radio_inline: ' . __( 'Taxonomy Radio Buttons Inline', 'cmb2-admin-extension' ) . ' *', |
|
| 467 | - 'select' => 'select: ' . __( 'Select', 'cmb2-admin-extension' ), |
|
| 468 | - 'taxonomy_select' => 'taxonomy_select: ' . __( 'Taxonomy Select', 'cmb2-admin-extension' ) . ' *', |
|
| 469 | - 'checkbox' => 'checkbox: ' . __( 'Checkbox', 'cmb2-admin-extension' ) . ' *', |
|
| 470 | - 'multicheck' => 'multicheck: ' . __( 'Multiple Checkboxes', 'cmb2-admin-extension' ), |
|
| 471 | - 'multicheck_inline' => 'multicheck_inline: ' . __( 'Multiple Checkboxes Inline', 'cmb2-admin-extension' ), |
|
| 472 | - 'taxonomy_multicheck' => 'taxonomy_multicheck: ' . __( 'Taxonomy Multiple Checkboxes', 'cmb2-admin-extension' ) . ' *', |
|
| 473 | - 'taxonomy_multicheck_inline' => 'taxonomy_multicheck_inline: ' . __( 'Taxonomy Multiple Checkboxes Inline', 'cmb2-admin-extension' ) . ' *', |
|
| 474 | - 'wysiwyg' => 'wysiwyg: ' . __( '(TinyMCE)', 'cmb2-admin-extension' ) . ' *', |
|
| 475 | - 'file' => 'file: ' . __( 'Image/File upload', 'cmb2-admin-extension' ) . ' *†', |
|
| 476 | - 'file_list' => 'file_list: ' . __( 'Image/File list upload', 'cmb2-admin-extension' ), |
|
| 477 | - 'oembed' => 'oembed: ' . __( 'Converts oembed urls (instagram, twitter, youtube, etc. oEmbed in the Codex)', 'cmb2-admin-extension' ), |
|
| 446 | + 'title' => 'title: ' . __('An arbitrary title field', 'cmb2-admin-extension') . ' *', |
|
| 447 | + 'text' => 'text: ' . __('Text', 'cmb2-admin-extension'), |
|
| 448 | + 'text_small' => 'text_small: ' . __('Text Small', 'cmb2-admin-extension'), |
|
| 449 | + 'text_medium' => 'text_medium: ' . __('Text Medium', 'cmb2-admin-extension'), |
|
| 450 | + 'text_email' => 'text_email: ' . __('Email', 'cmb2-admin-extension'), |
|
| 451 | + 'text_url' => 'text_url: ' . __('URL', 'cmb2-admin-extension'), |
|
| 452 | + 'text_money' => 'text_money: ' . __('Money', 'cmb2-admin-extension'), |
|
| 453 | + 'textarea' => 'textarea: ' . __('Text Area', 'cmb2-admin-extension'), |
|
| 454 | + 'textarea_small' => 'textarea_small: ' . __('Text Area Small', 'cmb2-admin-extension'), |
|
| 455 | + 'textarea_code' => 'textarea_code: ' . __('Text Area Code', 'cmb2-admin-extension'), |
|
| 456 | + 'text_date' => 'text_date: ' . __('Date Picker', 'cmb2-admin-extension'), |
|
| 457 | + 'text_time' => 'text_time: ' . __('Time picker', 'cmb2-admin-extension'), |
|
| 458 | + 'select_timezone' => 'select_timezone: ' . __('Time zone dropdown', 'cmb2-admin-extension'), |
|
| 459 | + 'text_date_timestamp' => 'text_date_timestamp: ' . __('Date Picker (UNIX timestamp)', 'cmb2-admin-extension'), |
|
| 460 | + 'text_datetime_timestamp' => 'text_datetime_timestamp: ' . __('Text Date/Time Picker Combo (UNIX timestamp)', 'cmb2-admin-extension'), |
|
| 461 | + 'text_datetime_timestamp_timezone' => 'text_datetime_timestamp_timezone: ' . __('Text Date/Time Picker/Time zone Combo (serialized DateTime object)', 'cmb2-admin-extension'), |
|
| 462 | + 'colorpicker' => 'colorpicker: ' . __('Color picker', 'cmb2-admin-extension'), |
|
| 463 | + 'radio' => 'radio: ' . __('Radio Buttons', 'cmb2-admin-extension') . ' *', |
|
| 464 | + 'radio_inline' => 'radio_inline: ' . __('Radio Buttons Inline', 'cmb2-admin-extension') . ' *', |
|
| 465 | + 'taxonomy_radio' => 'taxonomy_radio: ' . __('Taxonomy Radio Buttons', 'cmb2-admin-extension') . ' *', |
|
| 466 | + 'taxonomy_radio_inline' => 'taxonomy_radio_inline: ' . __('Taxonomy Radio Buttons Inline', 'cmb2-admin-extension') . ' *', |
|
| 467 | + 'select' => 'select: ' . __('Select', 'cmb2-admin-extension'), |
|
| 468 | + 'taxonomy_select' => 'taxonomy_select: ' . __('Taxonomy Select', 'cmb2-admin-extension') . ' *', |
|
| 469 | + 'checkbox' => 'checkbox: ' . __('Checkbox', 'cmb2-admin-extension') . ' *', |
|
| 470 | + 'multicheck' => 'multicheck: ' . __('Multiple Checkboxes', 'cmb2-admin-extension'), |
|
| 471 | + 'multicheck_inline' => 'multicheck_inline: ' . __('Multiple Checkboxes Inline', 'cmb2-admin-extension'), |
|
| 472 | + 'taxonomy_multicheck' => 'taxonomy_multicheck: ' . __('Taxonomy Multiple Checkboxes', 'cmb2-admin-extension') . ' *', |
|
| 473 | + 'taxonomy_multicheck_inline' => 'taxonomy_multicheck_inline: ' . __('Taxonomy Multiple Checkboxes Inline', 'cmb2-admin-extension') . ' *', |
|
| 474 | + 'wysiwyg' => 'wysiwyg: ' . __('(TinyMCE)', 'cmb2-admin-extension') . ' *', |
|
| 475 | + 'file' => 'file: ' . __('Image/File upload', 'cmb2-admin-extension') . ' *†', |
|
| 476 | + 'file_list' => 'file_list: ' . __('Image/File list upload', 'cmb2-admin-extension'), |
|
| 477 | + 'oembed' => 'oembed: ' . __('Converts oembed urls (instagram, twitter, youtube, etc. oEmbed in the Codex)', 'cmb2-admin-extension'), |
|
| 478 | 478 | // 'group' => 'group: ' . __( 'Hybrid field that supports adding other fields as a repeatable group.', 'cmb2-admin-extension' ) . ' *', |
| 479 | 479 | ), |
| 480 | - ) ); |
|
| 480 | + )); |
|
| 481 | 481 | |
| 482 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 483 | - 'name' => __( 'Repeatable', 'cmb2-admin-extension' ), |
|
| 484 | - 'desc' => __( 'Check this box to make the field repeatable. Field types marked with a "*" are not repeatable.', 'cmb2-admin-extension' ), |
|
| 482 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 483 | + 'name' => __('Repeatable', 'cmb2-admin-extension'), |
|
| 484 | + 'desc' => __('Check this box to make the field repeatable. Field types marked with a "*" are not repeatable.', 'cmb2-admin-extension'), |
|
| 485 | 485 | 'id' => $prefix . 'repeatable_checkbox', |
| 486 | 486 | 'type' => 'checkbox', |
| 487 | - ) ); |
|
| 487 | + )); |
|
| 488 | 488 | |
| 489 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 490 | - 'name' => __( 'Protocols', 'cmb2-admin-extension' ), |
|
| 491 | - 'desc' => __( 'Check the boxes for each allowed protocol. If you are unsure then do nothing and all protocols will be allowed.', 'cmb2-admin-extension' ), |
|
| 489 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 490 | + 'name' => __('Protocols', 'cmb2-admin-extension'), |
|
| 491 | + 'desc' => __('Check the boxes for each allowed protocol. If you are unsure then do nothing and all protocols will be allowed.', 'cmb2-admin-extension'), |
|
| 492 | 492 | 'id' => $prefix . 'protocols_checkbox', |
| 493 | 493 | 'type' => 'multicheck_inline', |
| 494 | 494 | 'options' => array( |
@@ -504,28 +504,28 @@ discard block |
||
| 504 | 504 | 'feed' => 'feed', |
| 505 | 505 | 'telnet' => 'telnet', |
| 506 | 506 | ), |
| 507 | - ) ); |
|
| 507 | + )); |
|
| 508 | 508 | |
| 509 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 510 | - 'name' => __( 'Currency Symbol', 'cmb2-admin-extension' ), |
|
| 511 | - 'desc' => __( 'Replaces the default "$".', 'cmb2-admin-extension' ), |
|
| 509 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 510 | + 'name' => __('Currency Symbol', 'cmb2-admin-extension'), |
|
| 511 | + 'desc' => __('Replaces the default "$".', 'cmb2-admin-extension'), |
|
| 512 | 512 | 'id' => $prefix . 'currency_text', |
| 513 | 513 | 'type' => 'text_small', |
| 514 | - ) ); |
|
| 514 | + )); |
|
| 515 | 515 | |
| 516 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 517 | - 'name' => __( 'Date Format', 'cmb2-admin-extension' ), |
|
| 518 | - 'desc' => __( 'Default:', 'cmb2-admin-extension' ) . ' "m/d/Y". ' . __( 'See <a target="_blank" href="http://php.net/manual/en/function.date.php">php.net/manual/en/function.date.php</a>.', 'cmb2-admin-extension' ), |
|
| 516 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 517 | + 'name' => __('Date Format', 'cmb2-admin-extension'), |
|
| 518 | + 'desc' => __('Default:', 'cmb2-admin-extension') . ' "m/d/Y". ' . __('See <a target="_blank" href="http://php.net/manual/en/function.date.php">php.net/manual/en/function.date.php</a>.', 'cmb2-admin-extension'), |
|
| 519 | 519 | 'id' => $prefix . 'date_format', |
| 520 | 520 | 'type' => 'text_small', |
| 521 | - ) ); |
|
| 521 | + )); |
|
| 522 | 522 | |
| 523 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 524 | - 'name' => __( 'Time Format', 'cmb2-admin-extension' ), |
|
| 525 | - 'desc' => __( 'Default:', 'cmb2-admin-extension' ) . ' "h:i A". ' . __( 'See <a target="_blank" href="http://php.net/manual/en/function.date.php">php.net/manual/en/function.date.php</a>.', 'cmb2-admin-extension' ), |
|
| 523 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 524 | + 'name' => __('Time Format', 'cmb2-admin-extension'), |
|
| 525 | + 'desc' => __('Default:', 'cmb2-admin-extension') . ' "h:i A". ' . __('See <a target="_blank" href="http://php.net/manual/en/function.date.php">php.net/manual/en/function.date.php</a>.', 'cmb2-admin-extension'), |
|
| 526 | 526 | 'id' => $prefix . 'time_format', |
| 527 | 527 | 'type' => 'text_small', |
| 528 | - ) ); |
|
| 528 | + )); |
|
| 529 | 529 | |
| 530 | 530 | /* |
| 531 | 531 | @todo Make this field generate options from predefined time zone fields. Maybe both from previously saved fields and ones just created via javascript. |
@@ -539,52 +539,52 @@ discard block |
||
| 539 | 539 | ) ); |
| 540 | 540 | */ |
| 541 | 541 | |
| 542 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 543 | - 'name' => __( 'Options', 'cmb2-admin-extension' ), |
|
| 542 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 543 | + 'name' => __('Options', 'cmb2-admin-extension'), |
|
| 544 | 544 | // 'desc' => __( 'Your field type requires manual options. Please add one option per line. Type value then name seprated by a comma.<br>Example:<br>sml,Small<br>med,Medium<br>lrg,Large', 'cmb2-admin-extension' ), |
| 545 | - 'desc' => __( 'If your field type requires manual options, please add one option per line. Type value then name seprated by a comma.<br>Example:<br>sml,Small<br>med,Medium<br>lrg,Large', 'cmb2-admin-extension' ), |
|
| 545 | + 'desc' => __('If your field type requires manual options, please add one option per line. Type value then name seprated by a comma.<br>Example:<br>sml,Small<br>med,Medium<br>lrg,Large', 'cmb2-admin-extension'), |
|
| 546 | 546 | 'id' => $prefix . 'options_textarea', |
| 547 | 547 | 'type' => 'textarea_small', |
| 548 | - ) ); |
|
| 548 | + )); |
|
| 549 | 549 | |
| 550 | 550 | $tax_options = $this->tax_options(); |
| 551 | - reset( $tax_options ); |
|
| 552 | - $default_tax_options = key( $tax_options ); |
|
| 553 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 554 | - 'name' => __( 'Taxonomy Options', 'cmb2-admin-extension' ), |
|
| 551 | + reset($tax_options); |
|
| 552 | + $default_tax_options = key($tax_options); |
|
| 553 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 554 | + 'name' => __('Taxonomy Options', 'cmb2-admin-extension'), |
|
| 555 | 555 | 'id' => $prefix . 'tax_options_radio_inline', |
| 556 | 556 | 'type' => 'radio_inline', |
| 557 | 557 | 'options' => $this->tax_options(), |
| 558 | 558 | 'default' => $default_tax_options, |
| 559 | - ) ); |
|
| 559 | + )); |
|
| 560 | 560 | |
| 561 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 562 | - 'name' => __( 'No Terms Text', 'cmb2-admin-extension' ), |
|
| 563 | - 'desc' => __( 'Enter text to change the text that is shown when no terms are found.', 'cmb2-admin-extension' ) . '</br>' . __( 'Default:', 'cmb2-admin-extension' ) . ' "' . __( 'No terms', 'cmb2-admin-extension' ) . '".', |
|
| 561 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 562 | + 'name' => __('No Terms Text', 'cmb2-admin-extension'), |
|
| 563 | + 'desc' => __('Enter text to change the text that is shown when no terms are found.', 'cmb2-admin-extension') . '</br>' . __('Default:', 'cmb2-admin-extension') . ' "' . __('No terms', 'cmb2-admin-extension') . '".', |
|
| 564 | 564 | 'id' => $prefix . 'no_terms_text', |
| 565 | 565 | 'type' => 'text_small', |
| 566 | - ) ); |
|
| 566 | + )); |
|
| 567 | 567 | |
| 568 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 569 | - 'name' => __( 'Include a "none" option', 'cmb2-admin-extension' ), |
|
| 570 | - 'desc' => __( 'Check this box to include a "none" option with this field.', 'cmb2-admin-extension' ), |
|
| 568 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 569 | + 'name' => __('Include a "none" option', 'cmb2-admin-extension'), |
|
| 570 | + 'desc' => __('Check this box to include a "none" option with this field.', 'cmb2-admin-extension'), |
|
| 571 | 571 | 'id' => $prefix . 'none_checkbox', |
| 572 | 572 | 'type' => 'checkbox', |
| 573 | - ) ); |
|
| 573 | + )); |
|
| 574 | 574 | |
| 575 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 576 | - 'name' => __( 'Disable select all', 'cmb2-admin-extension' ), |
|
| 577 | - 'desc' => __( 'Check this box to disable the select all button for this field.', 'cmb2-admin-extension' ), |
|
| 575 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 576 | + 'name' => __('Disable select all', 'cmb2-admin-extension'), |
|
| 577 | + 'desc' => __('Check this box to disable the select all button for this field.', 'cmb2-admin-extension'), |
|
| 578 | 578 | 'id' => $prefix . 'select_all_checkbox', |
| 579 | 579 | 'type' => 'checkbox', |
| 580 | - ) ); |
|
| 580 | + )); |
|
| 581 | 581 | |
| 582 | - $cmb_group->add_group_field( $group_field_id, array( |
|
| 583 | - 'name' => __( 'Button Text', 'cmb2-admin-extension' ), |
|
| 584 | - 'desc' => __( 'Enter text to change the upload button text.', 'cmb2-admin-extension' ) . '</br>' . __( 'Default:', 'cmb2-admin-extension' ) . ' "' . __( 'Add or Upload File', 'cmb2-admin-extension' ) . '".', |
|
| 582 | + $cmb_group->add_group_field($group_field_id, array( |
|
| 583 | + 'name' => __('Button Text', 'cmb2-admin-extension'), |
|
| 584 | + 'desc' => __('Enter text to change the upload button text.', 'cmb2-admin-extension') . '</br>' . __('Default:', 'cmb2-admin-extension') . ' "' . __('Add or Upload File', 'cmb2-admin-extension') . '".', |
|
| 585 | 585 | 'id' => $prefix . 'add_upload_file_text', |
| 586 | 586 | 'type' => 'text_small', |
| 587 | - ) ); |
|
| 587 | + )); |
|
| 588 | 588 | |
| 589 | 589 | /* |
| 590 | 590 | $cmb_group->add_group_field( $group_field_id, array( |
@@ -606,9 +606,9 @@ discard block |
||
| 606 | 606 | * @param int $id Post ID. |
| 607 | 607 | * @param string $field The meta key to retrieve. |
| 608 | 608 | */ |
| 609 | - static function cmbf( $id, $field ) { |
|
| 609 | + static function cmbf($id, $field) { |
|
| 610 | 610 | |
| 611 | - return get_post_meta( $id, $field, true ); |
|
| 611 | + return get_post_meta($id, $field, true); |
|
| 612 | 612 | |
| 613 | 613 | } |
| 614 | 614 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * |
| 621 | 621 | * @param string $field_type A CMB2 field type. |
| 622 | 622 | */ |
| 623 | - static function is_repeatable( $field_type ) { |
|
| 623 | + static function is_repeatable($field_type) { |
|
| 624 | 624 | |
| 625 | 625 | $repeatable_fields = array( |
| 626 | 626 | 'text', |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | 'file', |
| 646 | 646 | 'file_list', |
| 647 | 647 | ); |
| 648 | - return in_array( $field_type, $repeatable_fields ); |
|
| 648 | + return in_array($field_type, $repeatable_fields); |
|
| 649 | 649 | |
| 650 | 650 | } |
| 651 | 651 | |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @param string $field_type A CMB2 field type. |
| 659 | 659 | */ |
| 660 | - static function has_options( $field_type ) { |
|
| 660 | + static function has_options($field_type) { |
|
| 661 | 661 | |
| 662 | 662 | $options_fields = array( |
| 663 | 663 | 'radio', |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | 'taxonomy_multicheck', |
| 672 | 672 | 'taxonomy_multicheck_inline', |
| 673 | 673 | ); |
| 674 | - return in_array( $field_type, $options_fields ); |
|
| 674 | + return in_array($field_type, $options_fields); |
|
| 675 | 675 | |
| 676 | 676 | } |
| 677 | 677 | |
@@ -685,9 +685,9 @@ discard block |
||
| 685 | 685 | * @param string $field_type A CMB2 field type. |
| 686 | 686 | * @param mixed $option_value Option value. |
| 687 | 687 | */ |
| 688 | - static function afo( $field, $field_type, $option_value ) { |
|
| 688 | + static function afo($field, $field_type, $option_value) { |
|
| 689 | 689 | |
| 690 | - return in_array( $field['_cmb2_field_type_select'], $field_type ) && isset( $field['_cmb2_add_upload_file_text'] ) && $field['_cmb2_add_upload_file_text'] != ''; |
|
| 690 | + return in_array($field['_cmb2_field_type_select'], $field_type) && isset($field['_cmb2_add_upload_file_text']) && $field['_cmb2_add_upload_file_text'] != ''; |
|
| 691 | 691 | |
| 692 | 692 | } |
| 693 | 693 | |
@@ -706,36 +706,36 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $prefix = $this->prefix; |
| 708 | 708 | |
| 709 | - $user_meta_boxes = get_posts( $args ); |
|
| 709 | + $user_meta_boxes = get_posts($args); |
|
| 710 | 710 | |
| 711 | - foreach ( $user_meta_boxes as $user_meta_box ) { |
|
| 711 | + foreach ($user_meta_boxes as $user_meta_box) { |
|
| 712 | 712 | |
| 713 | 713 | $metabox_id = $user_meta_box->ID; |
| 714 | 714 | |
| 715 | - $title = get_the_title( $metabox_id ); |
|
| 716 | - $id = str_replace( '-', '_', $user_meta_box->post_name ); |
|
| 717 | - $post_type = $this->cmbf( $metabox_id, $prefix . 'post_type_multicheckbox' ); |
|
| 718 | - $context = $this->cmbf( $metabox_id, $prefix . 'context_radio' ); |
|
| 719 | - $priority = $this->cmbf( $metabox_id, $prefix . 'priority_radio' ); |
|
| 720 | - $show_names = $this->cmbf( $metabox_id, $prefix . 'show_names' ); |
|
| 721 | - $disable_styles = $this->cmbf( $metabox_id, $prefix . 'disable_styles' ); |
|
| 722 | - $closed = $this->cmbf( $metabox_id, $prefix . 'closed' ); |
|
| 723 | - $fields = $this->cmbf( $metabox_id, $prefix . 'custom_field' ); |
|
| 715 | + $title = get_the_title($metabox_id); |
|
| 716 | + $id = str_replace('-', '_', $user_meta_box->post_name); |
|
| 717 | + $post_type = $this->cmbf($metabox_id, $prefix . 'post_type_multicheckbox'); |
|
| 718 | + $context = $this->cmbf($metabox_id, $prefix . 'context_radio'); |
|
| 719 | + $priority = $this->cmbf($metabox_id, $prefix . 'priority_radio'); |
|
| 720 | + $show_names = $this->cmbf($metabox_id, $prefix . 'show_names'); |
|
| 721 | + $disable_styles = $this->cmbf($metabox_id, $prefix . 'disable_styles'); |
|
| 722 | + $closed = $this->cmbf($metabox_id, $prefix . 'closed'); |
|
| 723 | + $fields = $this->cmbf($metabox_id, $prefix . 'custom_field'); |
|
| 724 | 724 | |
| 725 | 725 | /** |
| 726 | 726 | * Initiate the metabox |
| 727 | 727 | */ |
| 728 | - ${ 'cmb_' . $id } = new_cmb2_box( array( |
|
| 728 | + ${ 'cmb_' . $id } = new_cmb2_box(array( |
|
| 729 | 729 | 'id' => $id, |
| 730 | 730 | 'title' => $title, |
| 731 | 731 | 'object_types' => $post_type, // Post type. |
| 732 | 732 | 'context' => $context, |
| 733 | 733 | 'priority' => $priority, |
| 734 | - ) ); |
|
| 734 | + )); |
|
| 735 | 735 | |
| 736 | - foreach ( $fields as $field ) { |
|
| 736 | + foreach ($fields as $field) { |
|
| 737 | 737 | |
| 738 | - $field_id = '_' . strtolower( str_replace( ' ', '_', $field['_cmb2_name_text'] ) ); |
|
| 738 | + $field_id = '_' . strtolower(str_replace(' ', '_', $field['_cmb2_name_text'])); |
|
| 739 | 739 | |
| 740 | 740 | $field_args = array( |
| 741 | 741 | 'name' => $field['_cmb2_name_text'], |
@@ -744,52 +744,52 @@ discard block |
||
| 744 | 744 | 'type' => $field['_cmb2_field_type_select'], |
| 745 | 745 | ); |
| 746 | 746 | |
| 747 | - $options = isset( $field['_cmb2_options_textarea'] ) ? $field['_cmb2_options_textarea'] : false; |
|
| 748 | - if ( $options ) { |
|
| 749 | - $options = explode( PHP_EOL, $options ); |
|
| 750 | - foreach ( $options as $option ) { |
|
| 751 | - $opt_arr = explode( ',', $option ); |
|
| 752 | - if ( ! isset( $opt_arr[1] ) ) { |
|
| 747 | + $options = isset($field['_cmb2_options_textarea']) ? $field['_cmb2_options_textarea'] : false; |
|
| 748 | + if ($options) { |
|
| 749 | + $options = explode(PHP_EOL, $options); |
|
| 750 | + foreach ($options as $option) { |
|
| 751 | + $opt_arr = explode(',', $option); |
|
| 752 | + if ( ! isset($opt_arr[1])) { |
|
| 753 | 753 | continue; |
| 754 | 754 | } |
| 755 | - $field_options[ $opt_arr[0] ] = $opt_arr[1]; |
|
| 755 | + $field_options[$opt_arr[0]] = $opt_arr[1]; |
|
| 756 | 756 | } |
| 757 | 757 | $field_args['options'] = $field_options; |
| 758 | 758 | } |
| 759 | - if ( strpos( $field['_cmb2_field_type_select'], 'tax' ) !== false && $field['_cmb2_tax_options_radio_inline'] != '' ) { |
|
| 759 | + if (strpos($field['_cmb2_field_type_select'], 'tax') !== false && $field['_cmb2_tax_options_radio_inline'] != '') { |
|
| 760 | 760 | $field_args['taxonomy'] = $field['_cmb2_tax_options_radio_inline']; |
| 761 | 761 | } |
| 762 | - if ( strpos( $field['_cmb2_field_type_select'], 'tax' ) !== false && isset( $field['_cmb2_no_terms_text'] ) && $field['_cmb2_no_terms_text'] != '' ) { |
|
| 762 | + if (strpos($field['_cmb2_field_type_select'], 'tax') !== false && isset($field['_cmb2_no_terms_text']) && $field['_cmb2_no_terms_text'] != '') { |
|
| 763 | 763 | $field_args['options']['no_terms_text'] = $field['_cmb2_no_terms_text']; |
| 764 | 764 | } |
| 765 | - if ( isset( $field['_cmb2_repeatable_checkbox'] ) && $field['_cmb2_repeatable_checkbox'] == 'on' && $this->is_repeatable( $field['_cmb2_field_type_select'] ) ) { |
|
| 765 | + if (isset($field['_cmb2_repeatable_checkbox']) && $field['_cmb2_repeatable_checkbox'] == 'on' && $this->is_repeatable($field['_cmb2_field_type_select'])) { |
|
| 766 | 766 | $field_args['repeatable'] = true; |
| 767 | 767 | } |
| 768 | - if ( $field['_cmb2_field_type_select'] == 'url' && isset( $field['_cmb2_protocols_checkbox'] ) && ! empty( $field['_cmb2_protocols_checkbox'] ) ) { |
|
| 768 | + if ($field['_cmb2_field_type_select'] == 'url' && isset($field['_cmb2_protocols_checkbox']) && ! empty($field['_cmb2_protocols_checkbox'])) { |
|
| 769 | 769 | $field_args['protocols'] = $field['_cmb2_protocols_checkbox']; |
| 770 | 770 | } |
| 771 | - if ( $this->afo( $field, array( 'text_money' ), '_cmb2_currency_text' ) ) { |
|
| 771 | + if ($this->afo($field, array('text_money'), '_cmb2_currency_text')) { |
|
| 772 | 772 | $field_args['before_field'] = $field['_cmb2_currency_text']; |
| 773 | 773 | } |
| 774 | - if ( $this->afo( $field, array( 'text_time' ), '_cmb2_time_format' ) ) { |
|
| 774 | + if ($this->afo($field, array('text_time'), '_cmb2_time_format')) { |
|
| 775 | 775 | $field_args['time_format'] = $field['_cmb2_time_format']; |
| 776 | 776 | } |
| 777 | - if ( $this->afo( $field, array( 'text_date', 'text_date_timestamp' ), '_cmb2_date_format' ) ) { |
|
| 777 | + if ($this->afo($field, array('text_date', 'text_date_timestamp'), '_cmb2_date_format')) { |
|
| 778 | 778 | $field_args['date_format'] = $field['_cmb2_date_format']; |
| 779 | 779 | } |
| 780 | - if ( $this->afo( $field, array( 'text_date_timestamp' ), '_cmb2_time_zone_key_select' ) ) { |
|
| 780 | + if ($this->afo($field, array('text_date_timestamp'), '_cmb2_time_zone_key_select')) { |
|
| 781 | 781 | $field_args['timezone_meta_key'] = $field['_cmb2_time_zone_key_select']; |
| 782 | 782 | } |
| 783 | - if ( isset( $field['_cmb2_none_checkbox'] ) && $field['_cmb2_none_checkbox'] == 'on' && $this->has_options( $field['_cmb2_field_type_select'] ) ) { |
|
| 783 | + if (isset($field['_cmb2_none_checkbox']) && $field['_cmb2_none_checkbox'] == 'on' && $this->has_options($field['_cmb2_field_type_select'])) { |
|
| 784 | 784 | $field_args['show_option_none'] = true; |
| 785 | 785 | } |
| 786 | - if ( strpos( $field['_cmb2_field_type_select'], 'multicheck' ) !== false && isset( $field['_cmb2_select_all_checkbox'] ) && $field['_cmb2_select_all_checkbox'] == 'on' ) { |
|
| 786 | + if (strpos($field['_cmb2_field_type_select'], 'multicheck') !== false && isset($field['_cmb2_select_all_checkbox']) && $field['_cmb2_select_all_checkbox'] == 'on') { |
|
| 787 | 787 | $field_args['select_all_button'] = false; |
| 788 | 788 | } |
| 789 | - if ( $this->afo( $field, array( 'file' ), '_cmb2_add_upload_file_text' ) ) { |
|
| 789 | + if ($this->afo($field, array('file'), '_cmb2_add_upload_file_text')) { |
|
| 790 | 790 | $field_args['options']['add_upload_file_text'] = $field['_cmb2_add_upload_file_text']; |
| 791 | 791 | } |
| 792 | - ${ 'cmb_' . $id }->add_field( $field_args ); |
|
| 792 | + ${ 'cmb_' . $id }->add_field($field_args); |
|
| 793 | 793 | |
| 794 | 794 | } |
| 795 | 795 | } |
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | * |
| 208 | 208 | * @param array $field Field definition. |
| 209 | 209 | * @param string $field_type A CMB2 field type. |
| 210 | - * @param mixed $option_value Option value. |
|
| 210 | + * @param string $option_value Option value. |
|
| 211 | 211 | */ |
| 212 | 212 | static function afo( $field, $field_type, $option_value ) { |
| 213 | 213 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @license GPL-2.0+ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'CMB2_Meta_Box' ) ) { |
|
| 13 | +if ( ! class_exists('CMB2_Meta_Box')) { |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Class CMB2_Meta_Box. |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct() { |
| 36 | 36 | |
| 37 | - add_action( 'pre_current_active_plugins', array( $this, 'hide_cmb2_plugins' ) ); |
|
| 38 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 39 | - add_action( 'cmb2_init', array( $this, 'init_user_defined_meta_boxes_and_fields' ) ); |
|
| 37 | + add_action('pre_current_active_plugins', array($this, 'hide_cmb2_plugins')); |
|
| 38 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
| 39 | + add_action('cmb2_init', array($this, 'init_user_defined_meta_boxes_and_fields')); |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public static function get_instance() { |
| 49 | 49 | // If the single instance hasn't been set, set it now. |
| 50 | - if ( null == self::$instance ) { |
|
| 50 | + if (null == self::$instance) { |
|
| 51 | 51 | self::$instance = new self; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function is_cmb2_allowed() { |
| 64 | 64 | |
| 65 | - $cmb2_settings = get_option( '_cmb2_settings' ); |
|
| 65 | + $cmb2_settings = get_option('_cmb2_settings'); |
|
| 66 | 66 | |
| 67 | - if ( empty( $cmb2_settings ) ) { |
|
| 67 | + if (empty($cmb2_settings)) { |
|
| 68 | 68 | // No settings saved. |
| 69 | 69 | return true; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $current_user = wp_get_current_user(); |
| 73 | - $allowed_users = isset( $cmb2_settings['_cmb2_user_multicheckbox'] ) ? $cmb2_settings['_cmb2_user_multicheckbox'] : array(); |
|
| 73 | + $allowed_users = isset($cmb2_settings['_cmb2_user_multicheckbox']) ? $cmb2_settings['_cmb2_user_multicheckbox'] : array(); |
|
| 74 | 74 | |
| 75 | - if ( empty( $allowed_users ) || in_array( $current_user->ID, $allowed_users ) ) { |
|
| 75 | + if (empty($allowed_users) || in_array($current_user->ID, $allowed_users)) { |
|
| 76 | 76 | |
| 77 | 77 | return true; |
| 78 | 78 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | public function hide_cmb2_plugins() { |
| 92 | 92 | |
| 93 | 93 | global $wp_list_table; |
| 94 | - if ( ! $this->is_cmb2_allowed() ) { |
|
| 95 | - $to_hide = array( CMB2AE_CMB2_PLUGIN_FILE, 'cmb2-admin-extension/cmb2-admin-extension.php' ); |
|
| 94 | + if ( ! $this->is_cmb2_allowed()) { |
|
| 95 | + $to_hide = array(CMB2AE_CMB2_PLUGIN_FILE, 'cmb2-admin-extension/cmb2-admin-extension.php'); |
|
| 96 | 96 | $plugins = $wp_list_table->items; |
| 97 | - foreach ( $plugins as $key => $val ) { |
|
| 98 | - if ( in_array( $key, $to_hide, true ) ) { |
|
| 99 | - unset( $wp_list_table->items[ $key ] ); |
|
| 97 | + foreach ($plugins as $key => $val) { |
|
| 98 | + if (in_array($key, $to_hide, true)) { |
|
| 99 | + unset($wp_list_table->items[$key]); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | public function enqueue_scripts() { |
| 112 | 112 | |
| 113 | 113 | $screen = get_current_screen(); |
| 114 | - if ( $screen->post_type === 'meta_box' ) { |
|
| 114 | + if ($screen->post_type === 'meta_box') { |
|
| 115 | 115 | |
| 116 | - wp_register_style( 'cmb2_admin_styles', CMB2AE_URI . '/css/meta-box-fields.css', false, '0.0.8' ); |
|
| 117 | - wp_enqueue_style( 'cmb2_admin_styles' ); |
|
| 118 | - wp_enqueue_script( 'cmb2_admin_scripts', CMB2AE_URI . '/js/meta-box-fields.js', true, array( 'jquery' ), '0.0.8' ); |
|
| 116 | + wp_register_style('cmb2_admin_styles', CMB2AE_URI . '/css/meta-box-fields.css', false, '0.0.8'); |
|
| 117 | + wp_enqueue_style('cmb2_admin_styles'); |
|
| 118 | + wp_enqueue_script('cmb2_admin_scripts', CMB2AE_URI . '/js/meta-box-fields.js', true, array('jquery'), '0.0.8'); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * @param int $id Post ID. |
| 131 | 131 | * @param string $field The meta key to retrieve. |
| 132 | 132 | */ |
| 133 | - static function cmbf( $id, $field ) { |
|
| 133 | + static function cmbf($id, $field) { |
|
| 134 | 134 | |
| 135 | - return get_post_meta( $id, $field, true ); |
|
| 135 | + return get_post_meta($id, $field, true); |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @param string $field_type A CMB2 field type. |
| 146 | 146 | */ |
| 147 | - static function is_repeatable( $field_type ) { |
|
| 147 | + static function is_repeatable($field_type) { |
|
| 148 | 148 | |
| 149 | 149 | $repeatable_fields = array( |
| 150 | 150 | 'text', |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | 'file', |
| 170 | 170 | 'file_list', |
| 171 | 171 | ); |
| 172 | - return in_array( $field_type, $repeatable_fields, true ); |
|
| 172 | + return in_array($field_type, $repeatable_fields, true); |
|
| 173 | 173 | |
| 174 | 174 | } |
| 175 | 175 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * @param string $field_type A CMB2 field type. |
| 183 | 183 | */ |
| 184 | - static function has_options( $field_type ) { |
|
| 184 | + static function has_options($field_type) { |
|
| 185 | 185 | |
| 186 | 186 | $options_fields = array( |
| 187 | 187 | 'radio', |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'taxonomy_multicheck', |
| 196 | 196 | 'taxonomy_multicheck_inline', |
| 197 | 197 | ); |
| 198 | - return in_array( $field_type, $options_fields, true ); |
|
| 198 | + return in_array($field_type, $options_fields, true); |
|
| 199 | 199 | |
| 200 | 200 | } |
| 201 | 201 | |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | * @param string $field_type A CMB2 field type. |
| 210 | 210 | * @param mixed $option_value Option value. |
| 211 | 211 | */ |
| 212 | - static function afo( $field, $field_type, $option_value ) { |
|
| 212 | + static function afo($field, $field_type, $option_value) { |
|
| 213 | 213 | |
| 214 | - return ( in_array( $field['_cmb2_field_type_select'], $field_type ) && ( ! empty( $field['_cmb2_add_upload_file_text'] ) && is_string( $field['_cmb2_add_upload_file_text'] ) ) ); |
|
| 214 | + return (in_array($field['_cmb2_field_type_select'], $field_type) && ( ! empty($field['_cmb2_add_upload_file_text']) && is_string($field['_cmb2_add_upload_file_text']))); |
|
| 215 | 215 | |
| 216 | 216 | } |
| 217 | 217 | |
@@ -230,36 +230,36 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $prefix = $this->prefix; |
| 232 | 232 | |
| 233 | - $user_meta_boxes = get_posts( $args ); |
|
| 233 | + $user_meta_boxes = get_posts($args); |
|
| 234 | 234 | |
| 235 | - foreach ( $user_meta_boxes as $user_meta_box ) { |
|
| 235 | + foreach ($user_meta_boxes as $user_meta_box) { |
|
| 236 | 236 | |
| 237 | 237 | $metabox_id = $user_meta_box->ID; |
| 238 | 238 | |
| 239 | - $title = get_the_title( $metabox_id ); |
|
| 240 | - $id = str_replace( '-', '_', $user_meta_box->post_name ); |
|
| 241 | - $post_type = $this->cmbf( $metabox_id, $prefix . 'post_type_multicheckbox' ); |
|
| 242 | - $context = $this->cmbf( $metabox_id, $prefix . 'context_radio' ); |
|
| 243 | - $priority = $this->cmbf( $metabox_id, $prefix . 'priority_radio' ); |
|
| 244 | - $show_names = $this->cmbf( $metabox_id, $prefix . 'show_names' ); |
|
| 245 | - $disable_styles = $this->cmbf( $metabox_id, $prefix . 'disable_styles' ); |
|
| 246 | - $closed = $this->cmbf( $metabox_id, $prefix . 'closed' ); |
|
| 247 | - $fields = $this->cmbf( $metabox_id, $prefix . 'custom_field' ); |
|
| 239 | + $title = get_the_title($metabox_id); |
|
| 240 | + $id = str_replace('-', '_', $user_meta_box->post_name); |
|
| 241 | + $post_type = $this->cmbf($metabox_id, $prefix . 'post_type_multicheckbox'); |
|
| 242 | + $context = $this->cmbf($metabox_id, $prefix . 'context_radio'); |
|
| 243 | + $priority = $this->cmbf($metabox_id, $prefix . 'priority_radio'); |
|
| 244 | + $show_names = $this->cmbf($metabox_id, $prefix . 'show_names'); |
|
| 245 | + $disable_styles = $this->cmbf($metabox_id, $prefix . 'disable_styles'); |
|
| 246 | + $closed = $this->cmbf($metabox_id, $prefix . 'closed'); |
|
| 247 | + $fields = $this->cmbf($metabox_id, $prefix . 'custom_field'); |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * Initiate the metabox. |
| 251 | 251 | */ |
| 252 | - ${ 'cmb_' . $id } = new_cmb2_box( array( |
|
| 252 | + ${ 'cmb_' . $id } = new_cmb2_box(array( |
|
| 253 | 253 | 'id' => $id, |
| 254 | 254 | 'title' => $title, |
| 255 | 255 | 'object_types' => $post_type, // Post type. |
| 256 | 256 | 'context' => $context, |
| 257 | 257 | 'priority' => $priority, |
| 258 | - ) ); |
|
| 258 | + )); |
|
| 259 | 259 | |
| 260 | - foreach ( $fields as $field ) { |
|
| 260 | + foreach ($fields as $field) { |
|
| 261 | 261 | |
| 262 | - $field_id = '_' . strtolower( str_replace( ' ', '_', $field['_cmb2_name_text'] ) ); |
|
| 262 | + $field_id = '_' . strtolower(str_replace(' ', '_', $field['_cmb2_name_text'])); |
|
| 263 | 263 | |
| 264 | 264 | $field_args = array( |
| 265 | 265 | 'name' => $field['_cmb2_name_text'], |
@@ -268,52 +268,52 @@ discard block |
||
| 268 | 268 | 'type' => $field['_cmb2_field_type_select'], |
| 269 | 269 | ); |
| 270 | 270 | |
| 271 | - $options = isset( $field['_cmb2_options_textarea'] ) ? $field['_cmb2_options_textarea'] : false; |
|
| 272 | - if ( $options ) { |
|
| 273 | - $options = explode( PHP_EOL, $options ); |
|
| 274 | - foreach ( $options as $option ) { |
|
| 275 | - $opt_arr = explode( ',', $option ); |
|
| 276 | - if ( ! isset( $opt_arr[1] ) ) { |
|
| 271 | + $options = isset($field['_cmb2_options_textarea']) ? $field['_cmb2_options_textarea'] : false; |
|
| 272 | + if ($options) { |
|
| 273 | + $options = explode(PHP_EOL, $options); |
|
| 274 | + foreach ($options as $option) { |
|
| 275 | + $opt_arr = explode(',', $option); |
|
| 276 | + if ( ! isset($opt_arr[1])) { |
|
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | - $field_options[ $opt_arr[0] ] = $opt_arr[1]; |
|
| 279 | + $field_options[$opt_arr[0]] = $opt_arr[1]; |
|
| 280 | 280 | } |
| 281 | 281 | $field_args['options'] = $field_options; |
| 282 | 282 | } |
| 283 | - if ( strpos( $field['_cmb2_field_type_select'], 'tax' ) !== false && $field['_cmb2_tax_options_radio_inline'] !== '' ) { |
|
| 283 | + if (strpos($field['_cmb2_field_type_select'], 'tax') !== false && $field['_cmb2_tax_options_radio_inline'] !== '') { |
|
| 284 | 284 | $field_args['taxonomy'] = $field['_cmb2_tax_options_radio_inline']; |
| 285 | 285 | } |
| 286 | - if ( strpos( $field['_cmb2_field_type_select'], 'tax' ) !== false && isset( $field['_cmb2_no_terms_text'] ) && $field['_cmb2_no_terms_text'] !== '' ) { |
|
| 286 | + if (strpos($field['_cmb2_field_type_select'], 'tax') !== false && isset($field['_cmb2_no_terms_text']) && $field['_cmb2_no_terms_text'] !== '') { |
|
| 287 | 287 | $field_args['options']['no_terms_text'] = $field['_cmb2_no_terms_text']; |
| 288 | 288 | } |
| 289 | - if ( isset( $field['_cmb2_repeatable_checkbox'] ) && $field['_cmb2_repeatable_checkbox'] === 'on' && $this->is_repeatable( $field['_cmb2_field_type_select'] ) ) { |
|
| 289 | + if (isset($field['_cmb2_repeatable_checkbox']) && $field['_cmb2_repeatable_checkbox'] === 'on' && $this->is_repeatable($field['_cmb2_field_type_select'])) { |
|
| 290 | 290 | $field_args['repeatable'] = true; |
| 291 | 291 | } |
| 292 | - if ( $field['_cmb2_field_type_select'] === 'url' && isset( $field['_cmb2_protocols_checkbox'] ) && ! empty( $field['_cmb2_protocols_checkbox'] ) ) { |
|
| 292 | + if ($field['_cmb2_field_type_select'] === 'url' && isset($field['_cmb2_protocols_checkbox']) && ! empty($field['_cmb2_protocols_checkbox'])) { |
|
| 293 | 293 | $field_args['protocols'] = $field['_cmb2_protocols_checkbox']; |
| 294 | 294 | } |
| 295 | - if ( $this->afo( $field, array( 'text_money' ), '_cmb2_currency_text' ) ) { |
|
| 295 | + if ($this->afo($field, array('text_money'), '_cmb2_currency_text')) { |
|
| 296 | 296 | $field_args['before_field'] = $field['_cmb2_currency_text']; |
| 297 | 297 | } |
| 298 | - if ( $this->afo( $field, array( 'text_time' ), '_cmb2_time_format' ) ) { |
|
| 298 | + if ($this->afo($field, array('text_time'), '_cmb2_time_format')) { |
|
| 299 | 299 | $field_args['time_format'] = $field['_cmb2_time_format']; |
| 300 | 300 | } |
| 301 | - if ( $this->afo( $field, array( 'text_date', 'text_date_timestamp' ), '_cmb2_date_format' ) ) { |
|
| 301 | + if ($this->afo($field, array('text_date', 'text_date_timestamp'), '_cmb2_date_format')) { |
|
| 302 | 302 | $field_args['date_format'] = $field['_cmb2_date_format']; |
| 303 | 303 | } |
| 304 | - if ( $this->afo( $field, array( 'text_date_timestamp' ), '_cmb2_time_zone_key_select' ) ) { |
|
| 304 | + if ($this->afo($field, array('text_date_timestamp'), '_cmb2_time_zone_key_select')) { |
|
| 305 | 305 | $field_args['timezone_meta_key'] = $field['_cmb2_time_zone_key_select']; |
| 306 | 306 | } |
| 307 | - if ( isset( $field['_cmb2_none_checkbox'] ) && $field['_cmb2_none_checkbox'] === 'on' && $this->has_options( $field['_cmb2_field_type_select'] ) ) { |
|
| 307 | + if (isset($field['_cmb2_none_checkbox']) && $field['_cmb2_none_checkbox'] === 'on' && $this->has_options($field['_cmb2_field_type_select'])) { |
|
| 308 | 308 | $field_args['show_option_none'] = true; |
| 309 | 309 | } |
| 310 | - if ( strpos( $field['_cmb2_field_type_select'], 'multicheck' ) !== false && isset( $field['_cmb2_select_all_checkbox'] ) && $field['_cmb2_select_all_checkbox'] === 'on' ) { |
|
| 310 | + if (strpos($field['_cmb2_field_type_select'], 'multicheck') !== false && isset($field['_cmb2_select_all_checkbox']) && $field['_cmb2_select_all_checkbox'] === 'on') { |
|
| 311 | 311 | $field_args['select_all_button'] = false; |
| 312 | 312 | } |
| 313 | - if ( $this->afo( $field, array( 'file' ), '_cmb2_add_upload_file_text' ) ) { |
|
| 313 | + if ($this->afo($field, array('file'), '_cmb2_add_upload_file_text')) { |
|
| 314 | 314 | $field_args['options']['add_upload_file_text'] = $field['_cmb2_add_upload_file_text']; |
| 315 | 315 | } |
| 316 | - ${ 'cmb_' . $id }->add_field( $field_args ); |
|
| 316 | + ${ 'cmb_' . $id }->add_field($field_args); |
|
| 317 | 317 | |
| 318 | 318 | } |
| 319 | 319 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
| 325 | -if ( ! function_exists( 'cmb2ae_metabox' ) ) { |
|
| 325 | +if ( ! function_exists('cmb2ae_metabox')) { |
|
| 326 | 326 | /** |
| 327 | 327 | * Main instance of CMB2_Meta_Box. |
| 328 | 328 | * |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Silence is golden; exit if accessed directly. |
| 44 | 44 | */ |
| 45 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 45 | +if ( ! defined('ABSPATH')) { |
|
| 46 | 46 | exit; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * Define plugin constant. |
| 52 | 52 | */ |
| 53 | -if ( ! defined( 'CMB2AE_CMB2_PLUGIN_FILE' ) ) { |
|
| 54 | - define( 'CMB2AE_CMB2_PLUGIN_FILE', 'cmb2/init.php' ); |
|
| 53 | +if ( ! defined('CMB2AE_CMB2_PLUGIN_FILE')) { |
|
| 54 | + define('CMB2AE_CMB2_PLUGIN_FILE', 'cmb2/init.php'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -if ( ! defined( 'CMB2AE_URI' ) ) { |
|
| 58 | - define( 'CMB2AE_URI', plugins_url( '', __FILE__ ) ); |
|
| 57 | +if ( ! defined('CMB2AE_URI')) { |
|
| 58 | + define('CMB2AE_URI', plugins_url('', __FILE__)); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -if ( ! defined( 'CMB2AE_PATH' ) ) { |
|
| 62 | - define( 'CMB2AE_PATH', plugin_dir_path( __FILE__ ) ); |
|
| 61 | +if ( ! defined('CMB2AE_PATH')) { |
|
| 62 | + define('CMB2AE_PATH', plugin_dir_path(__FILE__)); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->check_for_cmb2(); |
| 93 | 93 | |
| 94 | - add_action( 'init', array( $this, 'load_textdomain' ), 9 ); |
|
| 94 | + add_action('init', array($this, 'load_textdomain'), 9); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public static function get_instance() { |
| 103 | 103 | // If the single instance hasn't been set, set it now. |
| 104 | - if ( null == self::$instance ) { |
|
| 104 | + if (null == self::$instance) { |
|
| 105 | 105 | self::$instance = new self; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -115,19 +115,19 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | private function check_for_cmb2() { |
| 117 | 117 | |
| 118 | - if ( defined( 'CMB2_LOADED' ) && CMB2_LOADED !== false ) { |
|
| 118 | + if (defined('CMB2_LOADED') && CMB2_LOADED !== false) { |
|
| 119 | 119 | |
| 120 | - require_once dirname( __FILE__ ) . '/includes/class-meta-box.php'; |
|
| 121 | - require_once dirname( __FILE__ ) . '/includes/class-meta-box-post-type.php'; |
|
| 122 | - require_once dirname( __FILE__ ) . '/includes/class-meta-box-settings.php'; |
|
| 120 | + require_once dirname(__FILE__) . '/includes/class-meta-box.php'; |
|
| 121 | + require_once dirname(__FILE__) . '/includes/class-meta-box-post-type.php'; |
|
| 122 | + require_once dirname(__FILE__) . '/includes/class-meta-box-settings.php'; |
|
| 123 | 123 | |
| 124 | - } elseif ( file_exists( WP_PLUGIN_DIR . '/' . CMB2AE_CMB2_PLUGIN_FILE ) ) { |
|
| 124 | + } elseif (file_exists(WP_PLUGIN_DIR . '/' . CMB2AE_CMB2_PLUGIN_FILE)) { |
|
| 125 | 125 | |
| 126 | - add_action( 'admin_notices', array( $this, 'cmb2_not_activated' ) ); |
|
| 126 | + add_action('admin_notices', array($this, 'cmb2_not_activated')); |
|
| 127 | 127 | |
| 128 | 128 | } else { |
| 129 | 129 | |
| 130 | - add_action( 'admin_notices', array( $this, 'missing_cmb2' ) ); |
|
| 130 | + add_action('admin_notices', array($this, 'missing_cmb2')); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -137,22 +137,22 @@ discard block |
||
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | 139 | public function load_textdomain() { |
| 140 | - $lang_path = plugin_basename( dirname( __FILE__ ) ) . '/languages'; |
|
| 140 | + $lang_path = plugin_basename(dirname(__FILE__)) . '/languages'; |
|
| 141 | 141 | |
| 142 | - if ( false === strpos( __FILE__, basename( WPMU_PLUGIN_DIR ) ) ) { |
|
| 143 | - $loaded = load_plugin_textdomain( 'cmb2-admin-extension', false, $lang_path ); |
|
| 142 | + if (false === strpos(__FILE__, basename(WPMU_PLUGIN_DIR))) { |
|
| 143 | + $loaded = load_plugin_textdomain('cmb2-admin-extension', false, $lang_path); |
|
| 144 | 144 | } else { |
| 145 | - $loaded = load_muplugin_textdomain( 'cmb2-admin-extension', $lang_path ); |
|
| 145 | + $loaded = load_muplugin_textdomain('cmb2-admin-extension', $lang_path); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ! $loaded ) { |
|
| 149 | - $loaded = load_theme_textdomain( 'cmb2-admin-extension', get_stylesheet_directory() . '/languages' ); |
|
| 148 | + if ( ! $loaded) { |
|
| 149 | + $loaded = load_theme_textdomain('cmb2-admin-extension', get_stylesheet_directory() . '/languages'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if ( ! $loaded ) { |
|
| 153 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'cmb2-admin-extension' ); |
|
| 154 | - $mofile = dirname( __FILE__ ) . '/languages/cmb2-admin-extension-' . $locale . '.mo'; |
|
| 155 | - load_textdomain( 'cmb2-admin-extension', $mofile ); |
|
| 152 | + if ( ! $loaded) { |
|
| 153 | + $locale = apply_filters('plugin_locale', get_locale(), 'cmb2-admin-extension'); |
|
| 154 | + $mofile = dirname(__FILE__) . '/languages/cmb2-admin-extension-' . $locale . '.mo'; |
|
| 155 | + load_textdomain('cmb2-admin-extension', $mofile); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | ?> |
| 167 | 167 | <div class="error"> |
| 168 | - <p><?php printf( esc_html__( 'CMB2 Admin Extension depends on the last version of %s the CMB2 plugin %s to work!', 'cmb2-admin-extension' ), '<a href="https://wordpress.org/plugins/cmb2/">', '</a>' ); ?></p> |
|
| 168 | + <p><?php printf(esc_html__('CMB2 Admin Extension depends on the last version of %s the CMB2 plugin %s to work!', 'cmb2-admin-extension'), '<a href="https://wordpress.org/plugins/cmb2/">', '</a>'); ?></p> |
|
| 169 | 169 | </div> |
| 170 | 170 | <?php |
| 171 | 171 | |
@@ -180,16 +180,16 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | ?> |
| 182 | 182 | <div class="error"> |
| 183 | - <p><?php printf( esc_html__( 'The CMB2 plugin is installed but has not been activated. Please %s activate %s it to use the CMB2 Admin Extension', 'cmb2-admin-extension' ), '<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' ); ?></p> |
|
| 183 | + <p><?php printf(esc_html__('The CMB2 plugin is installed but has not been activated. Please %s activate %s it to use the CMB2 Admin Extension', 'cmb2-admin-extension'), '<a href="' . esc_url(admin_url('plugins.php')) . '">', '</a>'); ?></p> |
|
| 184 | 184 | </div> |
| 185 | 185 | <?php |
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | -add_action( 'plugins_loaded', array( 'CMB2_Admin_Extension_Class', 'get_instance' ), 20 ); |
|
| 190 | +add_action('plugins_loaded', array('CMB2_Admin_Extension_Class', 'get_instance'), 20); |
|
| 191 | 191 | |
| 192 | -if ( ! function_exists( 'cmbf' ) ) { |
|
| 192 | +if ( ! function_exists('cmbf')) { |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * This function needs documentation. |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * @param int $id Post ID. |
| 200 | 200 | * @param string $field The meta key to retrieve. |
| 201 | 201 | */ |
| 202 | - function cmbf( $id, $field ) { |
|
| 202 | + function cmbf($id, $field) { |
|
| 203 | 203 | |
| 204 | - return CMB2_Meta_Box_Post_Type::cmbf( $id, $field ); |
|
| 204 | + return CMB2_Meta_Box_Post_Type::cmbf($id, $field); |
|
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @license GPL-2.0+ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'CMB2_Meta_Box_Settings' ) ) { |
|
| 13 | +if ( ! class_exists('CMB2_Meta_Box_Settings')) { |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Class CMB2_Meta_Box_Settings. |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function __construct() { |
| 57 | 57 | |
| 58 | - add_action( 'admin_init', array( $this, 'register_settings' ) ); |
|
| 59 | - add_action( 'admin_menu', array( $this, 'add_settings_page' ) ); |
|
| 58 | + add_action('admin_init', array($this, 'register_settings')); |
|
| 59 | + add_action('admin_menu', array($this, 'add_settings_page')); |
|
| 60 | 60 | |
| 61 | - add_action( 'cmb2_init', array( $this, 'init_cmb2_settings_page' ) ); |
|
| 61 | + add_action('cmb2_init', array($this, 'init_cmb2_settings_page')); |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function add_settings_page() { |
| 71 | 71 | |
| 72 | - if ( cmb2ae_metabox()->is_cmb2_allowed() ) { |
|
| 73 | - $this->settings_page = add_submenu_page( 'edit.php?post_type=meta_box', __( 'CMB2 Settings', 'cmb2-admin-extension' ), __( 'CMB2 Settings', 'cmb2-admin-extension' ), 'edit_posts', $this->settings_key, array( $this, 'settings_page' ) ); |
|
| 74 | - add_action( "admin_print_styles-{$this->settings_page}", array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
| 72 | + if (cmb2ae_metabox()->is_cmb2_allowed()) { |
|
| 73 | + $this->settings_page = add_submenu_page('edit.php?post_type=meta_box', __('CMB2 Settings', 'cmb2-admin-extension'), __('CMB2 Settings', 'cmb2-admin-extension'), 'edit_posts', $this->settings_key, array($this, 'settings_page')); |
|
| 74 | + add_action("admin_print_styles-{$this->settings_page}", array('CMB2_hookup', 'enqueue_cmb_css')); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function register_settings() { |
| 83 | 83 | |
| 84 | - register_setting( $this->settings_key, $this->settings_key ); |
|
| 84 | + register_setting($this->settings_key, $this->settings_key); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | public function settings_page() { |
| 94 | 94 | |
| 95 | 95 | ?> |
| 96 | - <div class="wrap cmb2-options-page <?php echo esc_attr( $this->settings_key ); ?>"> |
|
| 97 | - <h2><?php echo esc_html__( 'CMB2 Settings', 'cmb2-admin-extension' ); ?></h2> |
|
| 98 | - <?php cmb2_metabox_form( $this->settings_metabox_id, $this->settings_key, array( 'disable_styles' => false ) ); ?> |
|
| 96 | + <div class="wrap cmb2-options-page <?php echo esc_attr($this->settings_key); ?>"> |
|
| 97 | + <h2><?php echo esc_html__('CMB2 Settings', 'cmb2-admin-extension'); ?></h2> |
|
| 98 | + <?php cmb2_metabox_form($this->settings_metabox_id, $this->settings_key, array('disable_styles' => false)); ?> |
|
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | 101 | |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $users = get_users(); |
| 112 | 112 | $user_options = array(); |
| 113 | - foreach ( $users as $user ) { |
|
| 113 | + foreach ($users as $user) { |
|
| 114 | 114 | |
| 115 | - if ( user_can( $user, 'update_plugins' ) || user_can( $user, 'install_plugins' ) || user_can( $user, 'delete_plugins' ) || user_can( $user, 'edit_theme_options' ) ) { |
|
| 116 | - $user_options[ $user->ID ] = $user->display_name; |
|
| 115 | + if (user_can($user, 'update_plugins') || user_can($user, 'install_plugins') || user_can($user, 'delete_plugins') || user_can($user, 'edit_theme_options')) { |
|
| 116 | + $user_options[$user->ID] = $user->display_name; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -130,24 +130,24 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $prefix = $this->prefix; |
| 132 | 132 | |
| 133 | - $cmb_settings = new_cmb2_box( array( |
|
| 133 | + $cmb_settings = new_cmb2_box(array( |
|
| 134 | 134 | 'id' => $this->settings_metabox_id, |
| 135 | 135 | 'hookup' => false, |
| 136 | 136 | 'show_on' => array( |
| 137 | 137 | // These are important, don't remove. |
| 138 | 138 | 'key' => 'options-page', |
| 139 | - 'value' => array( $this->settings_key ), |
|
| 139 | + 'value' => array($this->settings_key), |
|
| 140 | 140 | ), |
| 141 | - ) ); |
|
| 141 | + )); |
|
| 142 | 142 | |
| 143 | - $cmb_settings->add_field( array( |
|
| 144 | - 'name' => __( 'Users', 'cmb2-admin-extension' ), |
|
| 145 | - 'desc' => __( 'Check the users to grant access to this plugin and the CMB2 plugin. Leave unchecked to grant access to all users.', 'cmb2-admin-extension' ), |
|
| 143 | + $cmb_settings->add_field(array( |
|
| 144 | + 'name' => __('Users', 'cmb2-admin-extension'), |
|
| 145 | + 'desc' => __('Check the users to grant access to this plugin and the CMB2 plugin. Leave unchecked to grant access to all users.', 'cmb2-admin-extension'), |
|
| 146 | 146 | 'id' => $prefix . 'user_multicheckbox', |
| 147 | 147 | 'type' => 'multicheck', |
| 148 | 148 | 'options' => $this->user_options(), |
| 149 | 149 | 'inline' => true, |
| 150 | - ) ); |
|
| 150 | + )); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | } |