PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
← All changes | libraries/cmb2/includes/CMB2_Field_Display.php +17 -15 5.8.6 → 6.0.3 View file →
@@ -9,8 +9,9 @@
9 9 * @author CMB2 team
10 10 * @license GPL-2.0+
11 11 * @link https://cmb2.io
12 12 */
13 +#[AllowDynamicProperties] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes -- Back-compat: allow dynamic props (PHP 8.2+) on this class + subclasses.
13 14 class CMB2_Field_Display {
14 15
15 16 /**
16 17 * A CMB field object
@@ -153,9 +154,8 @@
153 154 echo '<ul class="cmb2-' . esc_attr( sanitize_html_class( str_replace( '_', '-', $this->field->type() ) ) ) . '">';
154 155 foreach ( $this->field->value as $val ) {
155 156 $this->value = $val;
156 157 echo '<li>', $this->_display(), '</li>';
157 - ;
158 158 }
159 159 echo '</ul>';
160 160 }
161 161 } else {
@@ -317,27 +317,28 @@
317 317 *
318 318 * @since 2.2.2
319 319 */
320 320 protected function _display() {
321 - $field = $this->field;
322 -
323 321 if ( empty( $this->value ) ) {
324 322 return;
325 323 }
326 324
327 - $datetime = maybe_unserialize( $this->value );
328 - $this->value = $tzstring = '';
329 -
330 - if ( $datetime && $datetime instanceof DateTime ) {
331 - $tz = $datetime->getTimezone();
332 - $tzstring = $tz->getName();
333 - $this->value = $datetime->getTimestamp();
325 + $datetime = CMB2_Utils::get_datetime_from_value( $this->value );
326 + if ( ! $datetime || ! $datetime instanceof DateTime ) {
327 + return;
334 328 }
335 329
336 - $date = $this->field->get_timestamp_format( 'date_format', $this->value );
337 - $time = $this->field->get_timestamp_format( 'time_format', $this->value );
330 + $date = $datetime->format( stripslashes( $this->field->args( 'date_format' ) ) );
331 + $time = $datetime->format( stripslashes( $this->field->args( 'time_format' ) ) );
332 + $timezone = $datetime->getTimezone()->getName();
338 333
339 - echo $date, ( $time ? ' ' . $time : '' ), ( $tzstring ? ', ' . $tzstring : '' );
334 + echo $date;
335 + if ( $time ) {
336 + echo ' ' . $time;
337 + }
338 + if ( $timezone ) {
339 + echo ', ' . $timezone;
340 + }
340 341 }
341 342 }
342 343
343 344 class CMB2_Display_Taxonomy_Radio extends CMB2_Field_Display {
@@ -360,9 +361,9 @@
360 361 }
361 362
362 363 if ( $term ) {
363 364 $link = get_edit_term_link( $term->term_id, $taxonomy );
364 - echo '<a href="', esc_url( $link ), '">', esc_html( $term->name ), '</a>';
365 + echo '<a href="', esc_url( $link ? $link : '' ), '">', esc_html( $term->name ), '</a>';
365 366 }
366 367 }
367 368 }
368 369
@@ -393,9 +394,9 @@
393 394
394 395 $links = array();
395 396 foreach ( $terms as $term ) {
396 397 $link = get_edit_term_link( $term->term_id, $taxonomy );
397 - $links[] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>';
398 + $links[] = '<a href="' . esc_url( $link ? $link : '' ) . '">' . esc_html( $term->name ) . '</a>';
398 399 }
399 400 // Then loop and output.
400 401 echo '<div class="cmb2-taxonomy-terms-', esc_attr( sanitize_html_class( $taxonomy ) ), '">';
401 402 echo implode( ', ', $links );
@@ -480,8 +481,9 @@
480 481 echo '</ul>';
481 482 }
482 483 }
483 484
485 +// phpcs:ignore PEAR.NamingConventions.ValidClassName.Invalid -- "oEmbed" is the correct brand casing; renaming this public class is a BC break.
484 486 class CMB2_Display_oEmbed extends CMB2_Field_Display {
485 487 /**
486 488 * Display oembed value.
487 489 *