@@ -18,26 +18,26 @@ |
||
| 18 | 18 | * @return string Heading element |
| 19 | 19 | */ |
| 20 | 20 | public function render() { |
| 21 | - $name = $this->field->args( 'name' ); |
|
| 21 | + $name = $this->field->args('name'); |
|
| 22 | 22 | $tag = 'span'; |
| 23 | 23 | |
| 24 | - if ( ! empty( $name ) ) { |
|
| 24 | + if ( ! empty($name)) { |
|
| 25 | 25 | $tag = $this->field->object_type == 'post' ? 'h5' : 'h3'; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $a = $this->parse_args( 'title', array( |
|
| 28 | + $a = $this->parse_args('title', array( |
|
| 29 | 29 | 'tag' => $tag, |
| 30 | - 'class' => empty( $name ) ? 'cmb2-metabox-title-anchor' : 'cmb2-metabox-title', |
|
| 30 | + 'class' => empty($name) ? 'cmb2-metabox-title-anchor' : 'cmb2-metabox-title', |
|
| 31 | 31 | 'name' => $name, |
| 32 | - 'desc' => $this->_desc( true ), |
|
| 33 | - 'id' => str_replace( '_', '-', sanitize_html_class( $this->field->id() ) ), |
|
| 34 | - ) ); |
|
| 32 | + 'desc' => $this->_desc(true), |
|
| 33 | + 'id' => str_replace('_', '-', sanitize_html_class($this->field->id())), |
|
| 34 | + )); |
|
| 35 | 35 | |
| 36 | 36 | return $this->rendered( |
| 37 | 37 | sprintf( |
| 38 | 38 | '<%1$s %2$s>%3$s</%1$s>%4$s', |
| 39 | 39 | $a['tag'], |
| 40 | - $this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ), |
|
| 40 | + $this->concat_attrs($a, array('tag', 'name', 'desc')), |
|
| 41 | 41 | $a['name'], |
| 42 | 42 | $a['desc'] |
| 43 | 43 | ) |
@@ -20,70 +20,70 @@ discard block |
||
| 20 | 20 | * @since 1.1.0 |
| 21 | 21 | * @return string Form wysiwyg element |
| 22 | 22 | */ |
| 23 | - public function render( $args = array() ) { |
|
| 23 | + public function render($args = array()) { |
|
| 24 | 24 | $field = $this->field; |
| 25 | - $a = $this->parse_args( 'wysiwyg', array( |
|
| 26 | - 'id' => $this->_id( '', false ), |
|
| 27 | - 'value' => $field->escaped_value( 'stripslashes' ), |
|
| 28 | - 'desc' => $this->_desc( true ), |
|
| 25 | + $a = $this->parse_args('wysiwyg', array( |
|
| 26 | + 'id' => $this->_id('', false), |
|
| 27 | + 'value' => $field->escaped_value('stripslashes'), |
|
| 28 | + 'desc' => $this->_desc(true), |
|
| 29 | 29 | 'options' => $field->options(), |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | - if ( ! $field->group ) { |
|
| 32 | + if ( ! $field->group) { |
|
| 33 | 33 | |
| 34 | - $a = $this->maybe_update_attributes_for_char_counter( $a ); |
|
| 34 | + $a = $this->maybe_update_attributes_for_char_counter($a); |
|
| 35 | 35 | |
| 36 | - if ( $this->has_counter ) { |
|
| 37 | - $a['options']['editor_class'] = ! empty( $a['options']['editor_class'] ) |
|
| 36 | + if ($this->has_counter) { |
|
| 37 | + $a['options']['editor_class'] = ! empty($a['options']['editor_class']) |
|
| 38 | 38 | ? $a['options']['editor_class'] . ' cmb2-count-chars' |
| 39 | 39 | : 'cmb2-count-chars'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return $this->rendered( $this->get_wp_editor( $a ) . $a['desc'] ); |
|
| 42 | + return $this->rendered($this->get_wp_editor($a) . $a['desc']); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Character counter not currently working for grouped WYSIWYG |
| 46 | 46 | $this->field->args['char_counter'] = false; |
| 47 | 47 | |
| 48 | 48 | // wysiwyg fields in a group need some special handling. |
| 49 | - $field->add_js_dependencies( 'wp-util', 'cmb2-wysiwyg' ); |
|
| 49 | + $field->add_js_dependencies('wp-util', 'cmb2-wysiwyg'); |
|
| 50 | 50 | |
| 51 | 51 | // Hook in our template-output to the footer. |
| 52 | - add_action( is_admin() ? 'admin_footer' : 'wp_footer', array( $this, 'add_wysiwyg_template_for_group' ) ); |
|
| 52 | + add_action(is_admin() ? 'admin_footer' : 'wp_footer', array($this, 'add_wysiwyg_template_for_group')); |
|
| 53 | 53 | |
| 54 | 54 | return $this->rendered( |
| 55 | - sprintf( '<div class="cmb2-wysiwyg-wrap">%s', parent::render( array( |
|
| 55 | + sprintf('<div class="cmb2-wysiwyg-wrap">%s', parent::render(array( |
|
| 56 | 56 | 'class' => 'cmb2_textarea cmb2-wysiwyg-placeholder', |
| 57 | 57 | 'data-groupid' => $field->group->id(), |
| 58 | 58 | 'data-iterator' => $field->group->index, |
| 59 | - 'data-fieldid' => $field->id( true ), |
|
| 60 | - 'desc' => '</div>' . $this->_desc( true ), |
|
| 61 | - ) ) ) |
|
| 59 | + 'data-fieldid' => $field->id(true), |
|
| 60 | + 'desc' => '</div>' . $this->_desc(true), |
|
| 61 | + ))) |
|
| 62 | 62 | ); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - protected function get_wp_editor( $args ) { |
|
| 65 | + protected function get_wp_editor($args) { |
|
| 66 | 66 | ob_start(); |
| 67 | - wp_editor( $args['value'], $args['id'], $args['options'] ); |
|
| 67 | + wp_editor($args['value'], $args['id'], $args['options']); |
|
| 68 | 68 | return ob_get_clean(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function add_wysiwyg_template_for_group() { |
| 72 | 72 | $group_id = $this->field->group->id(); |
| 73 | - $field_id = $this->field->id( true ); |
|
| 73 | + $field_id = $this->field->id(true); |
|
| 74 | 74 | $hash = $this->field->hash_id(); |
| 75 | 75 | $options = $this->field->options(); |
| 76 | 76 | $options['textarea_name'] = 'cmb2_n_' . $group_id . $field_id; |
| 77 | 77 | |
| 78 | 78 | // Initate the editor with special id/value/name so we can retrieve the options in JS. |
| 79 | - $editor = $this->get_wp_editor( array( |
|
| 79 | + $editor = $this->get_wp_editor(array( |
|
| 80 | 80 | 'value' => 'cmb2_v_' . $group_id . $field_id, |
| 81 | 81 | 'id' => 'cmb2_i_' . $group_id . $field_id, |
| 82 | 82 | 'options' => $options, |
| 83 | - ) ); |
|
| 83 | + )); |
|
| 84 | 84 | |
| 85 | 85 | // Then replace the special id/value/name with underscore placeholders. |
| 86 | - $editor = str_replace( array( |
|
| 86 | + $editor = str_replace(array( |
|
| 87 | 87 | 'cmb2_n_' . $group_id . $field_id, |
| 88 | 88 | 'cmb2_v_' . $group_id . $field_id, |
| 89 | 89 | 'cmb2_i_' . $group_id . $field_id, |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | '{{ data.name }}', |
| 92 | 92 | '{{{ data.value }}}', |
| 93 | 93 | '{{ data.id }}', |
| 94 | - ), $editor ); |
|
| 94 | + ), $editor); |
|
| 95 | 95 | |
| 96 | 96 | // And put the editor instance in a JS template wrapper. |
| 97 | 97 | echo '<script type="text/template" id="tmpl-cmb2-wysiwyg-' . $group_id . '-' . $field_id . '">'; |
@@ -21,18 +21,18 @@ |
||
| 21 | 21 | |
| 22 | 22 | public function render() { |
| 23 | 23 | return $this->rendered( |
| 24 | - $this->types->radio( array( |
|
| 24 | + $this->types->radio(array( |
|
| 25 | 25 | 'class' => $this->get_wrapper_classes(), |
| 26 | 26 | 'options' => $this->get_term_options(), |
| 27 | - ), 'taxonomy_multicheck_hierarchical' ) |
|
| 27 | + ), 'taxonomy_multicheck_hierarchical') |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - protected function list_term_input( $term, $saved_terms ) { |
|
| 32 | - $options = parent::list_term_input( $term, $saved_terms ); |
|
| 33 | - $children = $this->build_children( $term, $saved_terms ); |
|
| 31 | + protected function list_term_input($term, $saved_terms) { |
|
| 32 | + $options = parent::list_term_input($term, $saved_terms); |
|
| 33 | + $children = $this->build_children($term, $saved_terms); |
|
| 34 | 34 | |
| 35 | - if ( ! empty( $children ) ) { |
|
| 35 | + if ( ! empty($children)) { |
|
| 36 | 36 | $options .= $children; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -13,18 +13,18 @@ |
||
| 13 | 13 | class CMB2_Type_Select extends CMB2_Type_Multi_Base { |
| 14 | 14 | |
| 15 | 15 | public function render() { |
| 16 | - $a = $this->parse_args( 'select', array( |
|
| 16 | + $a = $this->parse_args('select', array( |
|
| 17 | 17 | 'class' => 'cmb2_select', |
| 18 | 18 | 'name' => $this->_name(), |
| 19 | 19 | 'id' => $this->_id(), |
| 20 | - 'desc' => $this->_desc( true ), |
|
| 20 | + 'desc' => $this->_desc(true), |
|
| 21 | 21 | 'options' => $this->concat_items(), |
| 22 | - ) ); |
|
| 22 | + )); |
|
| 23 | 23 | |
| 24 | - $attrs = $this->concat_attrs( $a, array( 'desc', 'options' ) ); |
|
| 24 | + $attrs = $this->concat_attrs($a, array('desc', 'options')); |
|
| 25 | 25 | |
| 26 | 26 | return $this->rendered( |
| 27 | - sprintf( '<select%s>%s</select>%s', $attrs, $a['options'], $a['desc'] ) |
|
| 27 | + sprintf('<select%s>%s</select>%s', $attrs, $a['options'], $a['desc']) |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | ? $this->field->get_default() |
| 19 | 19 | : CMB2_Utils::timezone_string(); |
| 20 | 20 | |
| 21 | - $this->args = wp_parse_args( $this->args, array( |
|
| 21 | + $this->args = wp_parse_args($this->args, array( |
|
| 22 | 22 | 'class' => 'cmb2_select cmb2-select-timezone', |
| 23 | - 'options' => wp_timezone_choice( $this->field->escaped_value() ), |
|
| 23 | + 'options' => wp_timezone_choice($this->field->escaped_value()), |
|
| 24 | 24 | 'desc' => $this->_desc(), |
| 25 | - ) ); |
|
| 25 | + )); |
|
| 26 | 26 | |
| 27 | 27 | return parent::render(); |
| 28 | 28 | } |
@@ -15,26 +15,26 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function render() { |
| 17 | 17 | return $this->rendered( |
| 18 | - $this->types->radio( array( |
|
| 18 | + $this->types->radio(array( |
|
| 19 | 19 | 'options' => $this->get_term_options(), |
| 20 | - ), 'taxonomy_radio' ) |
|
| 20 | + ), 'taxonomy_radio') |
|
| 21 | 21 | ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function get_term_options() { |
| 25 | 25 | $all_terms = $this->get_terms(); |
| 26 | 26 | |
| 27 | - if ( ! $all_terms || is_wp_error( $all_terms ) ) { |
|
| 28 | - return $this->no_terms_result( $all_terms ); |
|
| 27 | + if ( ! $all_terms || is_wp_error($all_terms)) { |
|
| 28 | + return $this->no_terms_result($all_terms); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $saved_term = $this->get_object_term_or_default(); |
| 32 | - $option_none = $this->field->args( 'show_option_none' ); |
|
| 32 | + $option_none = $this->field->args('show_option_none'); |
|
| 33 | 33 | $options = ''; |
| 34 | 34 | |
| 35 | - if ( ! empty( $option_none ) ) { |
|
| 35 | + if ( ! empty($option_none)) { |
|
| 36 | 36 | |
| 37 | - $field_id = $this->_id( '', false ); |
|
| 37 | + $field_id = $this->_id('', false); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Default (option-none) taxonomy-radio value. |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param string $option_none_value Default (option-none) taxonomy-radio value. |
| 45 | 45 | */ |
| 46 | - $option_none_value = apply_filters( 'cmb2_taxonomy_radio_default_value', '' ); |
|
| 46 | + $option_none_value = apply_filters('cmb2_taxonomy_radio_default_value', ''); |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Default (option-none) taxonomy-radio value. |
@@ -54,39 +54,39 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param string $option_none_value Default (option-none) taxonomy-radio value. |
| 56 | 56 | */ |
| 57 | - $option_none_value = apply_filters( "cmb2_taxonomy_radio_{$field_id}_default_value", $option_none_value ); |
|
| 57 | + $option_none_value = apply_filters("cmb2_taxonomy_radio_{$field_id}_default_value", $option_none_value); |
|
| 58 | 58 | |
| 59 | - $options .= $this->list_term_input( (object) array( |
|
| 59 | + $options .= $this->list_term_input((object) array( |
|
| 60 | 60 | 'slug' => $option_none_value, |
| 61 | 61 | 'name' => $option_none, |
| 62 | - ), $saved_term ); |
|
| 62 | + ), $saved_term); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $options .= $this->loop_terms( $all_terms, $saved_term ); |
|
| 65 | + $options .= $this->loop_terms($all_terms, $saved_term); |
|
| 66 | 66 | |
| 67 | 67 | return $options; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - protected function loop_terms( $all_terms, $saved_term ) { |
|
| 70 | + protected function loop_terms($all_terms, $saved_term) { |
|
| 71 | 71 | $options = ''; |
| 72 | - foreach ( $all_terms as $term ) { |
|
| 73 | - $options .= $this->list_term_input( $term, $saved_term ); |
|
| 72 | + foreach ($all_terms as $term) { |
|
| 73 | + $options .= $this->list_term_input($term, $saved_term); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $options; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function list_term_input( $term, $saved_term ) { |
|
| 79 | + protected function list_term_input($term, $saved_term) { |
|
| 80 | 80 | $args = array( |
| 81 | 81 | 'value' => $term->slug, |
| 82 | 82 | 'label' => $term->name, |
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | - if ( $saved_term == $term->slug ) { |
|
| 85 | + if ($saved_term == $term->slug) { |
|
| 86 | 86 | $args['checked'] = 'checked'; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return $this->list_input( $args, ++$this->counter ); |
|
| 89 | + return $this->list_input($args, ++$this->counter); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | * @return mixed Array of terms on success |
| 27 | 27 | */ |
| 28 | 28 | public function get_object_terms() { |
| 29 | - switch ( $this->field->object_type ) { |
|
| 29 | + switch ($this->field->object_type) { |
|
| 30 | 30 | case 'options-page': |
| 31 | 31 | case 'term': |
| 32 | 32 | return $this->options_terms(); |
| 33 | 33 | case 'post': |
| 34 | 34 | // WP caches internally so it's better to use |
| 35 | - return get_the_terms( $this->field->object_id, $this->field->args( 'taxonomy' ) ); |
|
| 35 | + return get_the_terms($this->field->object_id, $this->field->args('taxonomy')); |
|
| 36 | 36 | |
| 37 | 37 | default: |
| 38 | 38 | return $this->non_post_object_terms(); |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | * @return mixed Array of terms on success |
| 47 | 47 | */ |
| 48 | 48 | public function options_terms() { |
| 49 | - if ( empty( $this->field->value ) ) { |
|
| 49 | + if (empty($this->field->value)) { |
|
| 50 | 50 | return array(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $terms = (array) $this->field->value; |
| 54 | 54 | |
| 55 | - foreach ( $terms as $index => $term ) { |
|
| 56 | - $terms[ $index ] = get_term_by( 'slug', $term, $this->field->args( 'taxonomy' ) ); |
|
| 55 | + foreach ($terms as $index => $term) { |
|
| 56 | + $terms[$index] = get_term_by('slug', $term, $this->field->args('taxonomy')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $terms; |
@@ -67,17 +67,17 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function non_post_object_terms() { |
| 69 | 69 | $object_id = $this->field->object_id; |
| 70 | - $taxonomy = $this->field->args( 'taxonomy' ); |
|
| 70 | + $taxonomy = $this->field->args('taxonomy'); |
|
| 71 | 71 | |
| 72 | 72 | $cache_key = "cmb-cache-{$taxonomy}-{$object_id}"; |
| 73 | 73 | |
| 74 | 74 | // Check cache |
| 75 | - $cached = get_transient( $cache_key ); |
|
| 75 | + $cached = get_transient($cache_key); |
|
| 76 | 76 | |
| 77 | - if ( ! $cached ) { |
|
| 78 | - $cached = wp_get_object_terms( $object_id, $taxonomy ); |
|
| 77 | + if ( ! $cached) { |
|
| 78 | + $cached = wp_get_object_terms($object_id, $taxonomy); |
|
| 79 | 79 | // Do our own (minimal) caching. Long enough for a page-load. |
| 80 | - set_transient( $cache_key, $cached, 60 ); |
|
| 80 | + set_transient($cache_key, $cached, 60); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | return $cached; |
@@ -92,41 +92,41 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function get_terms() { |
| 94 | 94 | $args = array( |
| 95 | - 'taxonomy' => $this->field->args( 'taxonomy' ), |
|
| 95 | + 'taxonomy' => $this->field->args('taxonomy'), |
|
| 96 | 96 | 'hide_empty' => false, |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - if ( null !== $this->parent ) { |
|
| 99 | + if (null !== $this->parent) { |
|
| 100 | 100 | $args['parent'] = $this->parent; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $args = wp_parse_args( $this->field->prop( 'query_args', array() ), $args ); |
|
| 103 | + $args = wp_parse_args($this->field->prop('query_args', array()), $args); |
|
| 104 | 104 | |
| 105 | - return CMB2_Utils::wp_at_least( '4.5.0' ) |
|
| 106 | - ? get_terms( $args ) |
|
| 107 | - : get_terms( $this->field->args( 'taxonomy' ), http_build_query( $args ) ); |
|
| 105 | + return CMB2_Utils::wp_at_least('4.5.0') |
|
| 106 | + ? get_terms($args) |
|
| 107 | + : get_terms($this->field->args('taxonomy'), http_build_query($args)); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - protected function no_terms_result( $error, $tag = 'li' ) { |
|
| 111 | - if ( is_wp_error( $error ) ) { |
|
| 110 | + protected function no_terms_result($error, $tag = 'li') { |
|
| 111 | + if (is_wp_error($error)) { |
|
| 112 | 112 | $message = $error->get_error_message(); |
| 113 | - $data = 'data-error="' . esc_attr( $error->get_error_code() ) . '"'; |
|
| 113 | + $data = 'data-error="' . esc_attr($error->get_error_code()) . '"'; |
|
| 114 | 114 | } else { |
| 115 | - $message = $this->_text( 'no_terms_text', esc_html__( 'No terms', 'cmb2' ) ); |
|
| 115 | + $message = $this->_text('no_terms_text', esc_html__('No terms', 'cmb2')); |
|
| 116 | 116 | $data = ''; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $this->field->args['select_all_button'] = false; |
| 120 | 120 | |
| 121 | - return sprintf( '<%3$s><label %1$s>%2$s</label></%3$s>', $data, esc_html( $message ), $tag ); |
|
| 121 | + return sprintf('<%3$s><label %1$s>%2$s</label></%3$s>', $data, esc_html($message), $tag); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function get_object_term_or_default() { |
| 125 | 125 | $saved_terms = $this->get_object_terms(); |
| 126 | 126 | |
| 127 | - return is_wp_error( $saved_terms ) || empty( $saved_terms ) |
|
| 127 | + return is_wp_error($saved_terms) || empty($saved_terms) |
|
| 128 | 128 | ? $this->field->get_default() |
| 129 | - : array_shift( $saved_terms )->slug; |
|
| 129 | + : array_shift($saved_terms)->slug; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return string List of terms. |
| 141 | 141 | */ |
| 142 | - protected function loop_terms( $all_terms, $saved_terms ) { |
|
| 142 | + protected function loop_terms($all_terms, $saved_terms) { |
|
| 143 | 143 | return ''; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @return string List of terms. |
| 153 | 153 | */ |
| 154 | - protected function build_children( $parent_term, $saved ) { |
|
| 155 | - if ( empty( $parent_term->term_id ) ) { |
|
| 154 | + protected function build_children($parent_term, $saved) { |
|
| 155 | + if (empty($parent_term->term_id)) { |
|
| 156 | 156 | return ''; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | $terms = $this->get_terms(); |
| 162 | 162 | $options = ''; |
| 163 | 163 | |
| 164 | - if ( ! empty( $terms ) && is_array( $terms ) ) { |
|
| 165 | - $options .= $this->child_option_output( $terms, $saved ); |
|
| 164 | + if ( ! empty($terms) && is_array($terms)) { |
|
| 165 | + $options .= $this->child_option_output($terms, $saved); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | return $options; |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return string Child option output. |
| 180 | 180 | */ |
| 181 | - public function child_option_output( $terms, $saved ) { |
|
| 181 | + public function child_option_output($terms, $saved) { |
|
| 182 | 182 | $output = '<li class="cmb2-indented-hierarchy"><ul>'; |
| 183 | - $output .= $this->loop_terms( $terms, $saved ); |
|
| 183 | + $output .= $this->loop_terms($terms, $saved); |
|
| 184 | 184 | $output .= '</ul></li>'; |
| 185 | 185 | |
| 186 | 186 | return $output; |
@@ -12,30 +12,30 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class CMB2_Type_Oembed extends CMB2_Type_Text { |
| 14 | 14 | |
| 15 | - public function render( $args = array() ) { |
|
| 15 | + public function render($args = array()) { |
|
| 16 | 16 | $field = $this->field; |
| 17 | 17 | |
| 18 | - $meta_value = trim( $field->escaped_value() ); |
|
| 18 | + $meta_value = trim($field->escaped_value()); |
|
| 19 | 19 | |
| 20 | - $oembed = ! empty( $meta_value ) |
|
| 21 | - ? cmb2_ajax()->get_oembed( array( |
|
| 20 | + $oembed = ! empty($meta_value) |
|
| 21 | + ? cmb2_ajax()->get_oembed(array( |
|
| 22 | 22 | 'url' => $field->escaped_value(), |
| 23 | 23 | 'object_id' => $field->object_id, |
| 24 | 24 | 'object_type' => $field->object_type, |
| 25 | 25 | 'oembed_args' => array( |
| 26 | 26 | 'width' => '640', |
| 27 | 27 | ), |
| 28 | - 'field_id' => $this->_id( '', false ), |
|
| 29 | - ) ) |
|
| 28 | + 'field_id' => $this->_id('', false), |
|
| 29 | + )) |
|
| 30 | 30 | : ''; |
| 31 | 31 | |
| 32 | - return parent::render( array( |
|
| 32 | + return parent::render(array( |
|
| 33 | 33 | 'class' => 'cmb2-oembed regular-text', |
| 34 | 34 | 'data-objectid' => $field->object_id, |
| 35 | 35 | 'data-objecttype' => $field->object_type, |
| 36 | - ) ) |
|
| 36 | + )) |
|
| 37 | 37 | . '<p class="cmb-spinner spinner"></p>' |
| 38 | - . '<div id="' . $this->_id( '-status' ) . '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>'; |
|
| 38 | + . '<div id="' . $this->_id('-status') . '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | } |
@@ -32,20 +32,20 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function render() { |
| 34 | 34 | return $this->rendered( |
| 35 | - $this->types->select( array( |
|
| 35 | + $this->types->select(array( |
|
| 36 | 36 | 'options' => $this->get_term_options(), |
| 37 | - ), 'taxonomy_select_hierarchical' ) |
|
| 37 | + ), 'taxonomy_select_hierarchical') |
|
| 38 | 38 | ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function select_option( $args = array() ) { |
|
| 42 | - if ( $this->level > 0 ) { |
|
| 43 | - $args['label'] = str_repeat( ' ', $this->level ) . $args['label']; |
|
| 41 | + public function select_option($args = array()) { |
|
| 42 | + if ($this->level > 0) { |
|
| 43 | + $args['label'] = str_repeat(' ', $this->level) . $args['label']; |
|
| 44 | 44 | } |
| 45 | - $option = parent::select_option( $args ); |
|
| 46 | - $children = $this->build_children( $this->current_term, $this->saved_term ); |
|
| 45 | + $option = parent::select_option($args); |
|
| 46 | + $children = $this->build_children($this->current_term, $this->saved_term); |
|
| 47 | 47 | |
| 48 | - if ( ! empty( $children ) ) { |
|
| 48 | + if ( ! empty($children)) { |
|
| 49 | 49 | $option .= $children; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string Child option output. |
| 64 | 64 | */ |
| 65 | - public function child_option_output( $terms, $saved ) { |
|
| 65 | + public function child_option_output($terms, $saved) { |
|
| 66 | 66 | $this->level++; |
| 67 | - $output = $this->loop_terms( $terms, $saved ); |
|
| 67 | + $output = $this->loop_terms($terms, $saved); |
|
| 68 | 68 | $this->level--; |
| 69 | 69 | |
| 70 | 70 | return $output; |