$a[2]; } ); // Generate the markup for the entries. $titles = ''; foreach ( $widget_data as $entry ) { if ( empty( $entry ) ) { continue; } $titles .= '
  • '; $titles .= '' . esc_html( $entry[0] ) . ''; $titles .= ''; $titles .= ''; $titles .= '
  • '; } // Return the data, JSON encoded or as-is. if ( $return_json ) { return wp_json_encode( $titles ); } else { return $titles; } } /** * Update widget data: option or user meta. * * @since 1.0.0 * * @param array $widget_data Array of titles data. * @param string $private Is the title private or global. */ public static function aitt_update_widget_data( array $widget_data, string $private ) : void { if ( $private ) { update_user_meta( get_current_user_id(), '_aitt_dashboard_widget_data', $widget_data ); } else { update_option( 'aitt_dashboard_widget_data', $widget_data, false ); } } }