WordPress.org

Make WordPress Core

Ticket #6341: 6341.r9125.diff

File 6341.r9125.diff, 4.7 KB (added by jacobsantos, 6 years ago)

completes feature request based off of r9125

  • plugin.php

     
    1616 * 
    1717 * @package WordPress 
    1818 * @subpackage Plugin 
    19  * @since 1.5 
     19 * @since 1.5.0 
    2020 */ 
    2121 
    2222/** 
     
    7676 * 
    7777 * @package WordPress 
    7878 * @subpackage Plugin 
    79  * @since 2.5 
     79 * @since 2.5.0 
    8080 * @global array $wp_filter Stores all of the filters 
    8181 * 
    8282 * @param string $tag The name of the filter hook. 
     
    186186 * 
    187187 * @package WordPress 
    188188 * @subpackage Plugin 
    189  * @since 1.2 
     189 * @since 1.2.0 
    190190 * 
    191191 * @param string $tag The filter hook to which the function to be removed is hooked. 
    192192 * @param callback $function_to_remove The name of the function which should be removed. 
     
    212212/** 
    213213 * Remove all of the hooks from a filter. 
    214214 * 
    215  * @since 2.7 
     215 * @since 2.7.0 
    216216 * 
    217217 * @param string $tag The filter to remove hooks from. 
    218218 * @param int $priority The priority number to remove. 
     
    239239 * 
    240240 * @package WordPress 
    241241 * @subpackage Plugin 
    242  * @since 2.5 
     242 * @since 2.5.0 
    243243 * 
    244244 * @return string Hook name of the current filter or action. 
    245245 */ 
     
    261261 * 
    262262 * @package WordPress 
    263263 * @subpackage Plugin 
    264  * @since 1.2 
     264 * @since 1.2.0 
    265265 * 
    266266 * @param string $tag The name of the action to which the $function_to_add is hooked. 
    267267 * @param callback $function_to_add The name of the function you wish to be called. 
     
    288288 * 
    289289 * @package WordPress 
    290290 * @subpackage Plugin 
    291  * @since 1.2 
     291 * @since 1.2.0 
    292292 * @global array $wp_filter Stores all of the filters 
    293293 * @global array $wp_actions Increments the amount of times action was triggered. 
    294294 * 
     
    348348 * 
    349349 * @package WordPress 
    350350 * @subpackage Plugin 
    351  * @since 2.1 
     351 * @since 2.1.0 
    352352 * @global array $wp_actions Increments the amount of times action was triggered. 
    353353 * 
    354354 * @param string $tag The name of the action hook. 
     
    371371 * 
    372372 * @package WordPress 
    373373 * @subpackage Plugin 
    374  * @since 2.1 
     374 * @since 2.1.0 
    375375 * @global array $wp_filter Stores all of the filters 
    376376 * @global array $wp_actions Increments the amount of times action was triggered. 
    377377 * 
     
    423423 * 
    424424 * @package WordPress 
    425425 * @subpackage Plugin 
    426  * @since 2.5 
     426 * @since 2.5.0 
    427427 * @see has_filter() has_action() is an alias of has_filter(). 
    428428 * 
    429429 * @param string $tag The name of the action hook. 
     
    443443 * 
    444444 * @package WordPress 
    445445 * @subpackage Plugin 
    446  * @since 1.2 
     446 * @since 1.2.0 
    447447 * 
    448448 * @param string $tag The action hook to which the function to be removed is hooked. 
    449449 * @param callback $function_to_remove The name of the function which should be removed. 
     
    458458/** 
    459459 * Remove all of the hooks from an action. 
    460460 * 
    461  * @since 2.7 
     461 * @since 2.7.0 
    462462 * 
    463463 * @param string $tag The action to remove hooks from. 
    464464 * @param int $priority The priority number to remove them from. 
     
    479479 * 
    480480 * @package WordPress 
    481481 * @subpackage Plugin 
    482  * @since 1.5 
    483  * 
     482 * @since 1.5.0 
     483 * @uses WP_PLUGIN_DIR 
    484484 * @access private 
    485485 * 
    486  * @param string $file The filename of plugin. 
     486 * @param string $file The path to plugin. 
    487487 * @return string The name of a plugin. 
    488  * @uses WP_PLUGIN_DIR 
    489488 */ 
    490489function plugin_basename($file) { 
    491490        $file = str_replace('\\','/',$file); // sanitize for Win32 installs 
     
    497496} 
    498497 
    499498/** 
     499 * Retrieve the plugin base URL directory. 
     500 * 
     501 * The path has the trailing slash, so it doesn't need to be added. 
     502 * 
     503 * @link http://trac.wordpress.org/ticket/6341 Reason for function. 
     504 * @since 2.7.0 
     505 * @uses plugin_basename() 
     506 * 
     507 * @param string $file The path to plugin. 
     508 * @return string Full URL path, including domain, to plugin base directory. 
     509 */ 
     510function plugin_baseurl($file) { 
     511        $file = dirname($file); 
     512        $file = plugin_basename($file); 
     513 
     514        if ( empty( $file ) ) 
     515                return trailingslashit(WP_PLUGIN_URL); 
     516 
     517        return WP_PLUGIN_URL . '/'. trailingslashit($file); 
     518} 
     519 
     520/** 
    500521 * Set the activation hook for a plugin. 
    501522 * 
    502523 * When a plugin is activated, the action 'activate_PLUGINNAME' hook is 
     
    510531 * 
    511532 * @package WordPress 
    512533 * @subpackage Plugin 
    513  * @since 2.0 
     534 * @since 2.0.0 
    514535 * 
    515536 * @access private 
    516537 * 
     
    537558 * 
    538559 * @package WordPress 
    539560 * @subpackage Plugin 
    540  * @since 2.0 
     561 * @since 2.0.0 
    541562 * 
    542563 * @access private 
    543564 * 
     
    569590 * should always check for the 'WP_UNINSTALLING_PLUGIN' constant, before 
    570591 * executing. 
    571592 * 
    572  * @since 2.7 
     593 * @since 2.7.0 
    573594 * 
    574595 * @param string $file 
    575596 * @param callback $callback The callback to run when the hook is called. 
     
    596617 * 
    597618 * @package WordPress 
    598619 * @subpackage Plugin 
    599  * @since 2.5 
     620 * @since 2.5.0 
    600621 * @access private 
    601622 * 
    602623 * @uses $wp_filter Used to process all of the functions in the 'all' hook