PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.12
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.12
1.1.12 1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 All 36 releases
← All changes | apps/my-wordpress/parts/lists.php +26 -17 1.1.6 → 1.1.12 View file →
@@ -55,10 +55,10 @@
55 55 if ( ! function_exists( 'openstation_my_wordpress_post_lock_payload' ) ) {
56 56 return '';
57 57 }
58 58 $lock = openstation_my_wordpress_post_lock_payload( (int) $post_id );
59 - if ( is_array( $lock ) && ! empty( $lock['locked'] ) && ! empty( $lock['name'] ) ) {
60 - return (string) $lock['name'];
59 + if ( is_array( $lock ) ) {
60 + return (string) $lock['userName'];
61 61 }
62 62 return '';
63 63 }
64 64
@@ -193,15 +193,15 @@
193 193 $items = array();
194 194 foreach ( $posts->posts as $post ) {
195 195 $items[] = array(
196 196 'id' => (int) $post->ID,
197 - 'title' => '' !== $post->post_title ? (string) $post->post_title : __( '(no title)', 'desktop-mode' ),
197 + 'title' => '' !== $post->post_title ? openstation_plain_text_title( $post->post_title ) : __( '(no title)', 'desktop-mode' ),
198 198 'subtitle' => $is_media
199 199 ? (string) $post->post_mime_type
200 200 : sprintf(
201 201 /* translators: 1: author display name, 2: date. */
202 202 __( '%1$s — %2$s', 'desktop-mode' ),
203 - (string) get_the_author_meta( 'display_name', (int) $post->post_author ),
203 + openstation_plain_text_title( get_the_author_meta( 'display_name', (int) $post->post_author ) ),
204 204 (string) get_the_date( '', $post )
205 205 ),
206 206 'status' => $is_media ? '' : (string) $post->post_status,
207 207 // For the hover card — the original tooltip's excerpt,
@@ -258,9 +258,9 @@
258 258 $parent = (int) $post->post_parent;
259 259 $shortlink = (string) wp_get_shortlink( $post->ID );
260 260 return array(
261 261 'slug' => (string) $post->post_name,
262 - 'author' => (string) get_the_author_meta( 'display_name', (int) $post->post_author ),
262 + 'author' => openstation_plain_text_title( get_the_author_meta( 'display_name', (int) $post->post_author ) ),
263 263 'authorId' => (int) $post->post_author,
264 264 'date' => (string) get_the_date( 'c', $post ),
265 265 'modified' => (string) get_the_modified_date( 'c', $post ),
266 266 'comments' => (int) $post->comment_count,
@@ -265,9 +265,9 @@
265 265 'modified' => (string) get_the_modified_date( 'c', $post ),
266 266 'comments' => (int) $post->comment_count,
267 267 'shortlink' => '' !== $shortlink ? esc_url_raw( $shortlink ) : '',
268 268 'parent' => $parent,
269 - 'parentTitle' => $parent > 0 ? (string) get_the_title( $parent ) : '',
269 + 'parentTitle' => $parent > 0 ? openstation_plain_text_title( get_the_title( $parent ) ) : '',
270 270 'words' => str_word_count( wp_strip_all_tags( (string) $post->post_content ) ),
271 271 );
272 272 }
273 273
@@ -288,14 +288,15 @@
288 288 'file' => $file ? wp_basename( $file ) : '',
289 289 'bytes' => $bytes,
290 290 'size' => $bytes > 0 ? (string) size_format( $bytes ) : '',
291 291 'dimensions' => isset( $meta['width'], $meta['height'] ) ? $meta['width'] . ' × ' . $meta['height'] : '',
292 - 'author' => (string) get_the_author_meta( 'display_name', (int) $post->post_author ),
292 + 'alt' => (string) get_post_meta( $post->ID, '_wp_attachment_image_alt', true ),
293 + 'author' => openstation_plain_text_title( get_the_author_meta( 'display_name', (int) $post->post_author ) ),
293 294 'authorId' => (int) $post->post_author,
294 295 'date' => (string) get_the_date( 'c', $post ),
295 296 'modified' => (string) get_the_modified_date( 'c', $post ),
296 297 'parent' => $parent,
297 - 'parentTitle' => $parent > 0 ? (string) get_the_title( $parent ) : '',
298 + 'parentTitle' => $parent > 0 ? openstation_plain_text_title( get_the_title( $parent ) ) : '',
298 299 );
299 300 }
300 301
301 302 /**
@@ -312,12 +313,12 @@
312 313 */
313 314 function user_row( \WP_User $user, callable $can_edit, $post_count = null ) {
314 315 return array(
315 316 'id' => (int) $user->ID,
316 - 'title' => (string) $user->display_name,
317 + 'title' => openstation_plain_text_title( $user->display_name ),
317 318 // The REST spelling too — the shared seam subscribers were
318 319 // written against `/wp/v2/users` rows.
319 - 'name' => (string) $user->display_name,
320 + 'name' => openstation_plain_text_title( $user->display_name ),
320 321 'subtitle' => (string) $user->user_email,
321 322 'status' => implode( ', ', array_map( 'ucfirst', (array) $user->roles ) ),
322 323 'excerpt' => '',
323 324 'thumb' => (string) get_avatar_url( $user->ID, array( 'size' => 96 ) ),
@@ -394,9 +395,10 @@
394 395 *
395 396 * An iframe never reports its own title, so a window opened on a bare
396 397 * URL keeps that URL as its name for as long as it lives — on a phone
397 398 * the top bar then reads `…/wp-admin/post.php?post=…`. The item's own
398 - * title is what the user tapped; the window says the same.
399 + * title is what the user tapped; the window says the same, decoded:
400 + * stored titles and display names carry entities (`&`).
399 401 *
400 402 * @param array<string,mixed> $section Section descriptor.
401 403 * @param int $id Item id.
402 404 * @return string The title, or '' when the item is gone.
@@ -401,17 +403,24 @@
401 403 * @param int $id Item id.
402 404 * @return string The title, or '' when the item is gone.
403 405 */
404 406 function edit_title( array $section, $id ) {
407 + // An order's post is WooCommerce's `Order &ndash; <date>` stamp, or
408 + // an untitled placeholder without sync: it wears its pane's title.
409 + if ( woo_section_is( $section, 'wc-orders' ) ) {
410 + $detail = woo_detail( $section, (int) $id );
411 + return $detail ? (string) $detail['title'] : '';
412 + }
405 413 if ( 'user' === $section['kind'] ) {
406 414 $user = get_userdata( (int) $id );
407 - return $user ? (string) $user->display_name : '';
415 + return $user ? openstation_plain_text_title( $user->display_name ) : '';
408 416 }
409 417 $post = get_post( (int) $id );
410 418 if ( ! $post ) {
411 419 return '';
412 420 }
413 - return '' !== $post->post_title ? (string) $post->post_title : __( '(no title)', 'desktop-mode' );
421 + $title = openstation_plain_text_title( $post->post_title );
422 + return '' !== $title ? $title : __( '(no title)', 'desktop-mode' );
414 423 }
415 424
416 425 /**
417 426 * The dossier payload for the open item — everything the detail pane
@@ -442,9 +451,9 @@
442 451 // through the same callback and its filters.
443 452 return array(
444 453 'kind' => 'user',
445 454 'id' => $id,
446 - 'title' => (string) $user->display_name,
455 + 'title' => openstation_plain_text_title( $user->display_name ),
447 456 'avatar' => (string) get_avatar_url( $id, array( 'size' => 192 ) ),
448 457 'facts' => Os::facts(
449 458 array(
450 459 array( __( 'Email', 'desktop-mode' ), (string) $user->user_email, 'bio' ),
@@ -461,9 +470,9 @@
461 470 $post = get_post( $id );
462 471 if ( ! $post || $post->post_type !== $section['post_type'] ) {
463 472 return null;
464 473 }
465 - $title = '' !== $post->post_title ? (string) $post->post_title : __( '(no title)', 'desktop-mode' );
474 + $title = '' !== $post->post_title ? openstation_plain_text_title( $post->post_title ) : __( '(no title)', 'desktop-mode' );
466 475
467 476 if ( 'media' === $section['kind'] ) {
468 477 $file = get_attached_file( $id );
469 478 $meta = (array) wp_get_attachment_metadata( $id );
@@ -470,9 +479,9 @@
470 479 $used = array();
471 480 if ( function_exists( 'openstation_my_wordpress_media_usage_build' ) ) {
472 481 foreach ( array_slice( (array) ( openstation_my_wordpress_media_usage_build( $post )['usedIn'] ?? array() ), 0, 12 ) as $row ) {
473 482 $used[] = array(
474 - 'title' => (string) ( $row['title'] ?? '' ),
483 + 'title' => openstation_plain_text_title( $row['title'] ?? '' ),
475 484 'usedAs' => (string) ( $row['usedAs'] ?? '' ),
476 485 );
477 486 }
478 487 }
@@ -514,9 +523,9 @@
514 523 'lockedBy' => lock_holder( $id ),
515 524 'facts' => Os::facts(
516 525 array(
517 526 array( __( 'Status', 'desktop-mode' ), ucfirst( (string) $post->post_status ) ),
518 - array( __( 'Author', 'desktop-mode' ), (string) get_the_author_meta( 'display_name', (int) $post->post_author ) ),
527 + array( __( 'Author', 'desktop-mode' ), openstation_plain_text_title( get_the_author_meta( 'display_name', (int) $post->post_author ) ) ),
519 528 array( __( 'Published', 'desktop-mode' ), (string) get_the_date( '', $post ) ),
520 529 array( __( 'Modified', 'desktop-mode' ), (string) get_the_modified_date( '', $post ) ),
521 530 array( __( 'Words', 'desktop-mode' ), number_format_i18n( str_word_count( wp_strip_all_tags( (string) $post->post_content ) ) ) ),
522 531 )