PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.13
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.13
1.1.13 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 All 37 releases
← All changes | includes/core/payload.php +30 -1 1.1.11 → 1.1.13 View file →
@@ -1027,9 +1027,9 @@
1027 1027 if ( ! is_string( $file ) || '' === $file ) {
1028 1028 return null;
1029 1029 }
1030 1030 $plugins_dir = wp_normalize_path( WP_PLUGIN_DIR );
1031 - $norm = wp_normalize_path( $file );
1031 + $norm = openstation_plugin_link_path( wp_normalize_path( $file ) );
1032 1032 if ( 0 !== strpos( $norm, $plugins_dir . '/' ) ) {
1033 1033 return null;
1034 1034 }
1035 1035 if ( ! function_exists( 'get_plugins' ) ) {
@@ -1498,8 +1498,9 @@
1498 1498 $norm = wp_normalize_path( (string) $frame['file'] );
1499 1499 if ( '' !== $self_dir && 0 === strpos( $norm, $self_dir ) ) {
1500 1500 continue;
1501 1501 }
1502 + $norm = openstation_plugin_link_path( $norm );
1502 1503 foreach ( $dirs as $dir ) {
1503 1504 if ( 0 === strpos( $norm, $dir ) ) {
1504 1505 return $norm;
1505 1506 }
@@ -1505,8 +1506,36 @@
1505 1506 }
1506 1507 }
1507 1508 }
1508 1509 return null;
1510 +}
1511 +
1512 +/**
1513 + * Map a path PHP reported back to the plugin folder WordPress loaded
1514 + * it through.
1515 + *
1516 + * PHP resolves symlinks in file names, so a plugin folder linked into
1517 + * `plugins/` from elsewhere shows up in backtraces and reflection outside
1518 + * `WP_PLUGIN_DIR`. WordPress.com's managed plugins are linked that way:
1519 + * `plugins/woocommerce` resolves to `/wordpress/plugins/woocommerce/<version>/`.
1520 + * Core records each active plugin's link and target in
1521 + * `$wp_plugin_paths` before loading it, and `plugin_basename()` maps
1522 + * through the same list.
1523 + *
1524 + * @param string $path Normalized absolute path.
1525 + * @return string The same file under the plugin's link, or `$path`
1526 + * when no active plugin is linked from there.
1527 + */
1528 +function openstation_plugin_link_path( $path ) {
1529 + global $wp_plugin_paths;
1530 +
1531 + foreach ( (array) $wp_plugin_paths as $link => $target ) {
1532 + $target = trailingslashit( (string) $target );
1533 + if ( 0 === strpos( $path, $target ) ) {
1534 + return trailingslashit( (string) $link ) . substr( $path, strlen( $target ) );
1535 + }
1536 + }
1537 + return $path;
1509 1538 }
1510 1539
1511 1540 add_action(
1512 1541 'registered_post_type',