Ticket #55522: 55522.patch
File 55522.patch, 1.6 KB (added by , 3 years ago) |
---|
-
.php
old new 772 772 /** 773 773 * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in. 774 774 * 775 * @since 2.8.0775 * @since 5.9.2 776 776 * 777 * @param string $file The filename of the plugin (__FILE__). 778 * @return string the filesystem path of the directory that contains the plugin .777 * @param string $file The filename of the plugin (__FILE__). Default empty 778 * @return string the filesystem path of the directory that contains the plugin if a filename is specified. Returns the base plugin directory path otherwise. 779 779 */ 780 function plugin_dir_path( $file ) { 781 return trailingslashit( dirname( $file ) ); 780 function plugin_dir_path( $file = '' ) { 781 return trim( $file ) !== '' 782 ? trailingslashit( dirname( $file ) ) 783 : trailingslashit( WP_CONTENT_DIR . '/plugins' ); 782 784 } 783 785 784 786 /** 785 787 * Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. 786 788 * 787 * @since 2.8.0789 * @since 5.9.2 788 790 * 789 * @param string $file The filename of the plugin (__FILE__). 790 * @return string the URL path of the directory that contains the plugin.791 * @param string $file The filename of the plugin (__FILE__). Default empty 792 * @return string the filesystem path of the directory that contains the plugin if a filename is specified. Returns the base plugin directory path otherwise. 791 793 */ 792 function plugin_dir_url( $file ) { 793 return trailingslashit( plugins_url( '', $file ) ); 794 function plugin_dir_url( $file = '' ) { 795 return trim( $file ) !== '' 796 ? trailingslashit( plugins_url( '', $file ) ) 797 : trailingslashit( plugins_url() ); 794 798 } 795 799 796 800 /**