IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
583 | 583 | * @uses WP_PLUGIN_DIR |
584 | 584 | */ |
585 | 585 | function plugin_basename($file) { |
586 | | $file = str_replace('\\','/',$file); // sanitize for Win32 installs |
587 | | $file = preg_replace('|/+|','/', $file); // remove any duplicate slash |
588 | | $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs |
589 | | $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash |
590 | | $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs |
591 | | $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash |
| 586 | global $wp_plugin_paths; |
| 587 | $original_file = $file; |
| 588 | |
| 589 | foreach ($wp_plugin_paths as $dir => $realdir) { |
| 590 | if (strpos($file, $realdir) === 0) { |
| 591 | $file = $dir . substr( $file, strlen( $realdir ) ); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | $file = wp_normalize_path($file); |
| 596 | $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); |
| 597 | $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); |
| 598 | |
592 | 599 | $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir |
593 | 600 | $file = trim($file, '/'); |
594 | | return $file; |
| 601 | |
| 602 | /** |
| 603 | * Filter the plugin's basename. |
| 604 | * |
| 605 | * @since 3.7.0 |
| 606 | * |
| 607 | * @param string $file Resolved basename. |
| 608 | * @param string $original_file Filename passed into the function. |
| 609 | */ |
| 610 | return apply_filters( 'plugin_basename', $file, $original_file ); |
| 611 | } |
| 612 | |
| 613 | /** |
| 614 | * Register a plugin's real path. |
| 615 | * |
| 616 | * This is used in {@see plugin_basename()} to resolve symlinked paths. |
| 617 | * |
| 618 | * @param string $file Known path to the file. |
| 619 | */ |
| 620 | function wp_register_plugin_realpath( $file ) { |
| 621 | global $wp_plugin_paths; |
| 622 | |
| 623 | $plugin_path = wp_normalize_path( dirname( $file ) ); |
| 624 | $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); |
| 625 | |
| 626 | if ( $plugin_path !== $plugin_realpath ) { |
| 627 | $wp_plugin_paths[ $plugin_path ] = $plugin_realpath; |
| 628 | } |
595 | 629 | } |
596 | 630 | |
597 | 631 | /** |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | /** |
| 1432 | * Normalize a filesystem path. |
| 1433 | * |
| 1434 | * Replaces backslashes with forward slashes for Windows systems, |
| 1435 | * and ensures no duplicate slashes exist. |
| 1436 | * |
| 1437 | * @param string $path Path to normalize. |
| 1438 | * @return string Normalized path. |
| 1439 | */ |
| 1440 | function wp_normalize_path( $path ) { |
| 1441 | $path = str_replace( '\\', '/', $path ); |
| 1442 | $path = preg_replace( '|/+|','/', $path ); |
| 1443 | return $path; |
| 1444 | } |
| 1445 | |
| 1446 | /** |
1432 | 1447 | * Determines a writable directory for temporary files. |
1433 | 1448 | * Function's preference is the return value of <code>sys_get_temp_dir()</code>, |
1434 | 1449 | * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR, |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
537 | 537 | if ( !empty($redirect) ) |
538 | 538 | wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error |
539 | 539 | ob_start(); |
540 | | include_once(WP_PLUGIN_DIR . '/' . $plugin); |
| 540 | wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
| 541 | include_once( WP_PLUGIN_DIR . '/' . $plugin ); |
541 | 542 | |
542 | 543 | if ( ! $silent ) { |
543 | 544 | /** |
544 | 545 | * Fires before a plugin is activated in activate_plugin() when the $silent parameter is false. |
545 | | * |
| 546 | * |
546 | 547 | * @since 2.9.0 |
547 | 548 | * |
548 | 549 | * @param string $plugin Plugin path to main plugin file with plugin data. |
… |
… |
|
553 | 554 | |
554 | 555 | /** |
555 | 556 | * Fires before a plugin is activated in activate_plugin() when the $silent parameter is false. |
556 | | * |
| 557 | * |
557 | 558 | * The action concatenates the 'activate_' prefix with the $plugin value passed to |
558 | 559 | * activate_plugin() to create a dynamically-named action. |
559 | | * |
| 560 | * |
560 | 561 | * @since 2.0.0 |
561 | 562 | * |
562 | 563 | * @param bool $network_wide Whether to enable the plugin for all sites in the network |
… |
… |
|
577 | 578 | if ( ! $silent ) { |
578 | 579 | /** |
579 | 580 | * Fires after a plugin has been activated in activate_plugin() when the $silent parameter is false. |
580 | | * |
| 581 | * |
581 | 582 | * @since 2.9.0 |
582 | 583 | * |
583 | 584 | * @param string $plugin Plugin path to main plugin file with plugin data. |
… |
… |
|
627 | 628 | /** |
628 | 629 | * Fires for each plugin being deactivated in deactivate_plugins(), before deactivation |
629 | 630 | * and when the $silent parameter is false. |
630 | | * |
| 631 | * |
631 | 632 | * @since 2.9.0 |
632 | 633 | * |
633 | 634 | * @param string $plugin Plugin path to main plugin file with plugin data. |
634 | | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
| 635 | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
635 | 636 | * or just the current site. Multisite only. Default is false. |
636 | 637 | */ |
637 | 638 | do_action( 'deactivate_plugin', $plugin, $network_deactivating ); |
… |
… |
|
657 | 658 | /** |
658 | 659 | * Fires for each plugin being deactivated in deactivate_plugins(), after deactivation |
659 | 660 | * and when the $silent parameter is false. |
660 | | * |
| 661 | * |
661 | 662 | * The action concatenates the 'deactivate_' prefix with the plugin's basename |
662 | 663 | * to create a dynamically-named action. |
663 | | * |
| 664 | * |
664 | 665 | * @since 2.0.0 |
665 | 666 | * |
666 | | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
| 667 | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
667 | 668 | * or just the current site. Multisite only. Default is false. |
668 | 669 | */ |
669 | 670 | do_action( 'deactivate_' . $plugin, $network_deactivating ); |
… |
… |
|
671 | 672 | /** |
672 | 673 | * Fires for each plugin being deactivated in deactivate_plugins(), after deactivation |
673 | 674 | * and when the $silent parameter is false. |
674 | | * |
| 675 | * |
675 | 676 | * @since 2.9.0 |
676 | 677 | * |
677 | 678 | * @param string $plugin Plugin path to main plugin file with plugin data. |
678 | | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
| 679 | * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network |
679 | 680 | * or just the current site. Multisite only. Default is false. |
680 | 681 | */ |
681 | 682 | do_action( 'deactivated_plugin', $plugin, $network_deactivating ); |
… |
… |
|
914 | 915 | unset($uninstallable_plugins); |
915 | 916 | |
916 | 917 | define('WP_UNINSTALL_PLUGIN', $file); |
| 918 | wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . dirname( $file ) ); |
917 | 919 | include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php'; |
918 | 920 | |
919 | 921 | return true; |
… |
… |
|
925 | 927 | update_option('uninstall_plugins', $uninstallable_plugins); |
926 | 928 | unset($uninstallable_plugins); |
927 | 929 | |
| 930 | wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); |
928 | 931 | include WP_PLUGIN_DIR . '/' . $file; |
929 | 932 | |
930 | 933 | add_action( 'uninstall_' . $file, $callable ); |
931 | 934 | |
932 | 935 | /** |
933 | 936 | * Fires in uninstall_plugin() once the plugin has been uninstalled. |
934 | | * |
| 937 | * |
935 | 938 | * The action concatenates the 'uninstall_' prefix with the basename of the |
936 | 939 | * plugin passed to {@see uninstall_plugin()} to create a dynamically-named action. |
937 | 940 | * |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
194 | 194 | register_theme_directory( get_theme_root() ); |
195 | 195 | |
196 | 196 | // Load active plugins. |
197 | | foreach ( wp_get_active_and_valid_plugins() as $plugin ) |
| 197 | $GLOBALS['wp_plugin_paths'] = array(); |
| 198 | foreach ( wp_get_active_and_valid_plugins() as $plugin ) { |
| 199 | wp_register_plugin_realpath($plugin); |
| 200 | |
198 | 201 | include_once( $plugin ); |
| 202 | } |
199 | 203 | unset( $plugin ); |
200 | 204 | |
201 | 205 | // Load pluggable functions. |