在下面末尾的函数中,变量$plugin\\u path用作数组的索引。
既然上面的一些行调用了一个返回字符串的函数(请参见代码行$plugin\\u path=wp\\u normalize\\u path(dirname($file)),这怎么可能呢。
这是正常的还是PHP技巧?
有人能帮我解决这个问题吗?
非常感谢
function wp_register_plugin_realpath( $file ) {
global $wp_plugin_paths;
// Normalize, but store as static to avoid recalculation of a constant value
static $wp_plugin_path = null, $wpmu_plugin_path = null;
if ( ! isset( $wp_plugin_path ) ) {
$wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
}
$plugin_path = wp_normalize_path( dirname( $file ) );
$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
return false;
}
if ( $plugin_path !== $plugin_realpath ) {
$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
}
return true;
}