Ticket #11644: 11644.12.diff
File 11644.12.diff, 14.9 KB (added by , 15 years ago) |
---|
-
wp-includes/load.php
374 374 * @since 3.0.0 375 375 * @return array Files to include 376 376 */ 377 function wp_ muplugins_to_load() {377 function wp_load_mu_plugins() { 378 378 $mu_plugins = array(); 379 379 if ( !is_dir( WPMU_PLUGIN_DIR ) ) 380 380 return $mu_plugins; … … 401 401 * @since 3.0.0 402 402 * @return array Files to include 403 403 */ 404 function wp_ plugins_to_load() {404 function wp_load_plugins() { 405 405 $plugins = array(); 406 406 407 407 // Check for hacks file if the option is enabled 408 408 if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) 409 409 $plugins[] = ABSPATH . 'my-hacks.php'; 410 410 411 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ); 412 if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) ) 411 $active_plugins = (array) apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ); 412 413 // Get active network plugins 414 if ( is_multisite() ) { 415 $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); 416 if ( !empty($active_sitewide_plugins) ) { 417 $active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) ); 418 sort( $active_plugins ); 419 } 420 } 421 422 if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) ) 413 423 return $plugins; 424 414 425 foreach ( $active_plugins as $plugin ) { 415 if ( validate_file( $plugin ) // $plugin must validate as file416 || '.php' != substr( $plugin, -4 ) // $plugin must end with '.php'417 || !file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist426 if ( ! validate_file( $plugin ) // $plugin must validate as file 427 && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php' 428 && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist 418 429 ) 419 continue;420 430 $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; 421 431 } 422 432 return $plugins; -
wp-includes/ms-load.php
23 23 } 24 24 25 25 /** 26 * Returns array of sitewide plugin files to be included in global scope.27 *28 * @access private29 * @since 3.0.030 * @return array Files to include31 */32 function ms_network_plugins() {33 $network_plugins = array();34 $deleted_sitewide_plugins = array();35 $wpmu_sitewide_plugins = (array) maybe_unserialize( get_site_option( 'wpmu_sitewide_plugins' ) );36 foreach ( $wpmu_sitewide_plugins as $plugin_file => $activation_time ) {37 if ( !$plugin_file )38 continue;39 40 if ( !file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) )41 $deleted_sitewide_plugins[] = $plugin_file;42 else43 $network_plugins[] = WP_PLUGIN_DIR . '/' . $plugin_file;44 }45 46 if ( !empty( $deleted_sitewide_plugins ) ) {47 $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );48 49 /* Remove any deleted plugins from the wpmu_sitewide_plugins array */50 foreach ( $deleted_sitewide_plugins as $plugin_file ) {51 unset( $wpmu_sitewide_plugins[$plugin_file] );52 unset( $active_sitewide_plugins[$plugin_file] );53 }54 55 update_site_option( 'wpmu_sitewide_plugins', $wpmu_sitewide_plugins );56 update_site_option( 'active_sitewide_plugins', $wpmu_sitewide_plugins );57 }58 59 return $network_plugins;60 }61 62 /**63 26 * Checks status of current blog. 64 27 * 65 28 * Checks if the blog is deleted, inactive, archived, or spammed. -
wp-includes/ms-functions.php
1932 1932 } 1933 1933 add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' ); 1934 1934 1935 function mu_filter_plugins_list( $active_plugins ) { 1936 $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' ); 1937 1938 if ( !$active_sitewide_plugins ) 1939 return $active_plugins; 1940 1941 $plugins = array_merge( (array) $active_plugins, array_keys( (array) $active_sitewide_plugins ) ); 1942 sort( $plugins ); 1943 return $plugins; 1944 } 1945 add_filter( 'active_plugins', 'mu_filter_plugins_list' ); 1946 1947 /** 1935 /** 1948 1936 * Whether to force SSL on content. 1949 1937 * 1950 1938 * @since 2.8.5 -
wp-settings.php
136 136 wp_default_constants( 'wp_included' ); 137 137 138 138 // Load must-use plugins. 139 foreach ( wp_muplugins_to_load() as $mu_plugin )139 foreach ( wp_load_mu_plugins() as $mu_plugin ) { 140 140 include_once( $mu_plugin ); 141 } 141 142 unset( $mu_plugin ); 142 143 143 // Load network-wide plugins if multisite.144 if ( is_multisite() ) {145 foreach ( ms_network_plugins() as $plugin_file )146 include_once( $plugin_file );147 unset( $plugin_file );148 }149 150 144 do_action( 'muplugins_loaded' ); 151 145 152 146 // Check site status if multisite. … … 170 164 create_initial_taxonomies(); 171 165 172 166 // Load active plugins. 173 foreach ( wp_plugins_to_load() as $plugin )167 foreach ( wp_load_plugins() as $plugin ) 174 168 include_once( $plugin ); 175 169 unset( $plugin ); 176 170 -
wp-admin/includes/plugin.php
544 544 } 545 545 546 546 /** 547 * validate active plugins547 * Validate active plugins 548 548 * 549 * validate all active plugins, deactivates invalid and550 * returns an array of deactiv ed ones.549 * Validate all active plugins, deactivates invalid and 550 * returns an array of deactivated ones. 551 551 * 552 552 * @since unknown 553 553 * @return array invalid plugins, plugin as key, error as value 554 554 */ 555 555 function validate_active_plugins() { 556 556 $plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ); 557 558 557 // validate vartype: array 559 if ( ! is_array( $plugins ) ) {560 update_option( 'active_plugins', array());561 return;558 if ( ! is_array( $plugins ) ) { 559 update_option( 'active_plugins', array() ); 560 $plugins = array(); 562 561 } 563 562 563 if ( is_multisite() && is_super_admin() ) { 564 $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); 565 $plugins = array_merge( (array) $plugins, $network_plugins ); 566 } 567 568 if ( empty( $plugins ) ) 569 return; 570 564 571 $invalid = array(); 565 572 566 573 // invalid plugins get deactivated … … 659 666 660 667 /** 661 668 * Add a top level menu page 662 * 669 * 663 670 * This function takes a capability which will be used to determine whether 664 671 * or not a page is included in the menu. 665 * 672 * 666 673 * The function which is hooked in to handle the output of the page must check 667 674 * that the user has the required capability as well. 668 * 675 * 669 676 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 670 677 * @param string $menu_title The text to be used for the menu 671 678 * @param string $capability The capability required for this menu to be displayed to the user. … … 706 713 707 714 /** 708 715 * Add a top level menu page in the 'objects' section 709 * 716 * 710 717 * This function takes a capability which will be used to determine whether 711 718 * or not a page is included in the menu. 712 * 719 * 713 720 * The function which is hooked in to handle the output of the page must check 714 721 * that the user has the required capability as well. 715 * 722 * 716 723 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 717 724 * @param string $menu_title The text to be used for the menu 718 725 * @param string $capability The capability required for this menu to be displayed to the user. … … 730 737 731 738 /** 732 739 * Add a top level menu page in the 'utility' section 733 * 740 * 734 741 * This function takes a capability which will be used to determine whether 735 742 * or not a page is included in the menu. 736 * 743 * 737 744 * The function which is hooked in to handle the output of the page must check 738 745 * that the user has the required capability as well. 739 * 746 * 740 747 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 741 748 * @param string $menu_title The text to be used for the menu 742 749 * @param string $capability The capability required for this menu to be displayed to the user. … … 754 761 755 762 /** 756 763 * Add a sub menu page 757 * 764 * 758 765 * This function takes a capability which will be used to determine whether 759 766 * or not a page is included in the menu. 760 * 767 * 761 768 * The function which is hooked in to handle the output of the page must check 762 769 * that the user has the required capability as well. 763 * 770 * 764 771 * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page) 765 772 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 766 773 * @param string $menu_title The text to be used for the menu … … 813 820 814 821 /** 815 822 * Add sub menu page to the tools main menu. 816 * 823 * 817 824 * This function takes a capability which will be used to determine whether 818 825 * or not a page is included in the menu. 819 * 826 * 820 827 * The function which is hooked in to handle the output of the page must check 821 828 * that the user has the required capability as well. 822 * 829 * 823 830 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 824 831 * @param string $menu_title The text to be used for the menu 825 832 * @param string $capability The capability required for this menu to be displayed to the user. … … 832 839 833 840 /** 834 841 * Add sub menu page to the options main menu. 835 * 842 * 836 843 * This function takes a capability which will be used to determine whether 837 844 * or not a page is included in the menu. 838 * 845 * 839 846 * The function which is hooked in to handle the output of the page must check 840 847 * that the user has the required capability as well. 841 * 848 * 842 849 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 843 850 * @param string $menu_title The text to be used for the menu 844 851 * @param string $capability The capability required for this menu to be displayed to the user. … … 851 858 852 859 /** 853 860 * Add sub menu page to the themes main menu. 854 * 861 * 855 862 * This function takes a capability which will be used to determine whether 856 863 * or not a page is included in the menu. 857 * 864 * 858 865 * The function which is hooked in to handle the output of the page must check 859 866 * that the user has the required capability as well. 860 * 867 * 861 868 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 862 869 * @param string $menu_title The text to be used for the menu 863 870 * @param string $capability The capability required for this menu to be displayed to the user. … … 870 877 871 878 /** 872 879 * Add sub menu page to the Users/Profile main menu. 873 * 880 * 874 881 * This function takes a capability which will be used to determine whether 875 882 * or not a page is included in the menu. 876 * 883 * 877 884 * The function which is hooked in to handle the output of the page must check 878 885 * that the user has the required capability as well. 879 * 886 * 880 887 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 881 888 * @param string $menu_title The text to be used for the menu 882 889 * @param string $capability The capability required for this menu to be displayed to the user. … … 892 899 } 893 900 /** 894 901 * Add sub menu page to the Dashboard main menu. 895 * 902 * 896 903 * This function takes a capability which will be used to determine whether 897 904 * or not a page is included in the menu. 898 * 905 * 899 906 * The function which is hooked in to handle the output of the page must check 900 907 * that the user has the required capability as well. 901 * 908 * 902 909 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 903 910 * @param string $menu_title The text to be used for the menu 904 911 * @param string $capability The capability required for this menu to be displayed to the user. … … 911 918 912 919 /** 913 920 * Add sub menu page to the posts main menu. 914 * 921 * 915 922 * This function takes a capability which will be used to determine whether 916 923 * or not a page is included in the menu. 917 * 924 * 918 925 * The function which is hooked in to handle the output of the page must check 919 926 * that the user has the required capability as well. 920 * 927 * 921 928 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 922 929 * @param string $menu_title The text to be used for the menu 923 930 * @param string $capability The capability required for this menu to be displayed to the user. … … 930 937 931 938 /** 932 939 * Add sub menu page to the media main menu. 933 * 940 * 934 941 * This function takes a capability which will be used to determine whether 935 942 * or not a page is included in the menu. 936 * 943 * 937 944 * The function which is hooked in to handle the output of the page must check 938 945 * that the user has the required capability as well. 939 * 946 * 940 947 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 941 948 * @param string $menu_title The text to be used for the menu 942 949 * @param string $capability The capability required for this menu to be displayed to the user. … … 949 956 950 957 /** 951 958 * Add sub menu page to the links main menu. 952 * 959 * 953 960 * This function takes a capability which will be used to determine whether 954 961 * or not a page is included in the menu. 955 * 962 * 956 963 * The function which is hooked in to handle the output of the page must check 957 964 * that the user has the required capability as well. 958 * 965 * 959 966 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 960 967 * @param string $menu_title The text to be used for the menu 961 968 * @param string $capability The capability required for this menu to be displayed to the user. … … 968 975 969 976 /** 970 977 * Add sub menu page to the pages main menu. 971 * 978 * 972 979 * This function takes a capability which will be used to determine whether 973 980 * or not a page is included in the menu. 974 * 981 * 975 982 * The function which is hooked in to handle the output of the page must check 976 983 * that the user has the required capability as well. 977 * 984 * 978 985 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 979 986 * @param string $menu_title The text to be used for the menu 980 987 * @param string $capability The capability required for this menu to be displayed to the user. … … 987 994 988 995 /** 989 996 * Add sub menu page to the comments main menu. 990 * 997 * 991 998 * This function takes a capability which will be used to determine whether 992 999 * or not a page is included in the menu. 993 * 1000 * 994 1001 * The function which is hooked in to handle the output of the page must check 995 1002 * that the user has the required capability as well. 996 * 1003 * 997 1004 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 998 1005 * @param string $menu_title The text to be used for the menu 999 1006 * @param string $capability The capability required for this menu to be displayed to the user.