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 | includes/desktop-files/shares-store.php +14 -26 1.1.2 → 1.1.12 View file →
@@ -1555,9 +1555,9 @@
1555 1555 if ( $folder ) {
1556 1556 $shape['folderName'] = (string) $folder['name'];
1557 1557 $shape['ownerId'] = (int) $folder['owner_id'];
1558 1558 $owner_user = get_userdata( (int) $folder['owner_id'] );
1559 - $shape['ownerName'] = $owner_user ? $owner_user->display_name : '';
1559 + $shape['ownerName'] = $owner_user ? openstation_plain_text_title( $owner_user->display_name ) : '';
1560 1560 $shape['ownerAvatar'] = $owner_user ? get_avatar_url( $owner_user->ID, array( 'size' => 48 ) ) : '';
1561 1561 }
1562 1562 $pending[] = $shape;
1563 1563 }
@@ -1568,13 +1568,16 @@
1568 1568 }
1569 1569 add_filter( 'openstation_shell_config', 'openstation_files_share_inject_shell_config', 20 );
1570 1570
1571 1571 /**
1572 - * Place an icon at the next free row-major slot in a user's view
1573 - * of `$parent_id`. Internal helper used by share-accept and
1574 - * fan-out. Mirrors the grid math in `src/desktop-files/grid.ts`
1575 - * (padding 16 + col 96 + row 110).
1572 + * Place an icon at the next free slot in a user's view of
1573 + * `$parent_id`. Internal helper used by share-accept and fan-out.
1576 1574 *
1575 + * "Next free" follows the destination's own reading order — columns
1576 + * on the desktop, rows in a folder — so a shared thing arriving
1577 + * unannounced lands where the next tile the user created would have.
1578 + * Grid math lives in `includes/desktop-files/grid.php`.
1579 + *
1577 1580 * @param int $user_id Viewer.
1578 1581 * @param int $parent_id Folder id (0 = desktop root).
1579 1582 * @param string $type File-type slug.
1580 1583 * @param string $ref Entity reference.
@@ -1596,26 +1599,14 @@
1596 1599 $parent_id
1597 1600 ),
1598 1601 ARRAY_A
1599 1602 );
1600 - $occupied = array();
1601 - foreach ( (array) $existing as $row ) {
1602 - $col = max( 0, (int) round( ( (int) $row['x'] - 16 ) / 96 ) );
1603 - $r = max( 0, (int) round( ( (int) $row['y'] - 16 ) / 110 ) );
1604 - $occupied[ "$col,$r" ] = true;
1605 - }
1603 + $occupied = openstation_files_grid_occupied( $existing );
1606 1604
1607 - $pick_col = 0;
1608 - $pick_row = 0;
1609 - for ( $r = 0; $r < 999; $r++ ) {
1610 - for ( $col = 0; $col < 999; $col++ ) {
1611 - if ( ! isset( $occupied[ "$col,$r" ] ) ) {
1612 - $pick_col = $col;
1613 - $pick_row = $r;
1614 - break 2;
1615 - }
1616 - }
1617 - }
1605 + list( $pick_col, $pick_row ) = openstation_files_grid_next_free(
1606 + $occupied,
1607 + openstation_files_grid_order( $parent_id )
1608 + );
1618 1609
1619 1610 return openstation_files_place(
1620 1611 $user_id,
1621 1612 $parent_id,
@@ -1620,10 +1611,7 @@
1620 1611 $user_id,
1621 1612 $parent_id,
1622 1613 $type,
1623 1614 $ref,
1624 - array(
1625 - 'x' => 16 + $pick_col * 96,
1626 - 'y' => 16 + $pick_row * 110,
1627 - )
1615 + openstation_files_grid_cell_to_point( $pick_col, $pick_row )
1628 1616 );
1629 1617 }