wp/wp-admin/plugins.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    69 			}
    69 			}
    70 
    70 
    71 			if ( ! is_network_admin() ) {
    71 			if ( ! is_network_admin() ) {
    72 				$recent = (array) get_option( 'recently_activated' );
    72 				$recent = (array) get_option( 'recently_activated' );
    73 				unset( $recent[ $plugin ] );
    73 				unset( $recent[ $plugin ] );
    74 				update_option( 'recently_activated', $recent );
    74 				update_option( 'recently_activated', $recent, false );
    75 			} else {
    75 			} else {
    76 				$recent = (array) get_site_option( 'recently_activated' );
    76 				$recent = (array) get_site_option( 'recently_activated' );
    77 				unset( $recent[ $plugin ] );
    77 				unset( $recent[ $plugin ] );
    78 				update_site_option( 'recently_activated', $recent );
    78 				update_site_option( 'recently_activated', $recent );
    79 			}
    79 			}
   134 			foreach ( $plugins as $plugin ) {
   134 			foreach ( $plugins as $plugin ) {
   135 				unset( $recent[ $plugin ] );
   135 				unset( $recent[ $plugin ] );
   136 			}
   136 			}
   137 
   137 
   138 			if ( ! is_network_admin() ) {
   138 			if ( ! is_network_admin() ) {
   139 				update_option( 'recently_activated', $recent );
   139 				update_option( 'recently_activated', $recent, false );
   140 			} else {
   140 			} else {
   141 				update_site_option( 'recently_activated', $recent );
   141 				update_site_option( 'recently_activated', $recent );
   142 			}
   142 			}
   143 
   143 
   144 			wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
   144 			wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
   209 			}
   209 			}
   210 
   210 
   211 			deactivate_plugins( $plugin, false, is_network_admin() );
   211 			deactivate_plugins( $plugin, false, is_network_admin() );
   212 
   212 
   213 			if ( ! is_network_admin() ) {
   213 			if ( ! is_network_admin() ) {
   214 				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
   214 				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ), false );
   215 			} else {
   215 			} else {
   216 				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
   216 				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
   217 			}
   217 			}
   218 
   218 
   219 			if ( headers_sent() ) {
   219 			if ( headers_sent() ) {
   256 			foreach ( $plugins as $plugin ) {
   256 			foreach ( $plugins as $plugin ) {
   257 				$deactivated[ $plugin ] = time();
   257 				$deactivated[ $plugin ] = time();
   258 			}
   258 			}
   259 
   259 
   260 			if ( ! is_network_admin() ) {
   260 			if ( ! is_network_admin() ) {
   261 				update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
   261 				update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ), false );
   262 			} else {
   262 			} else {
   263 				update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
   263 				update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
   264 			}
   264 			}
   265 
   265 
   266 			wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
   266 			wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
   434 			update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false );
   434 			update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false );
   435 			wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) );
   435 			wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) );
   436 			exit;
   436 			exit;
   437 		case 'clear-recent-list':
   437 		case 'clear-recent-list':
   438 			if ( ! is_network_admin() ) {
   438 			if ( ! is_network_admin() ) {
   439 				update_option( 'recently_activated', array() );
   439 				update_option( 'recently_activated', array(), false );
   440 			} else {
   440 			} else {
   441 				update_site_option( 'recently_activated', array() );
   441 				update_site_option( 'recently_activated', array() );
   442 			}
   442 			}
   443 
   443 
   444 			break;
   444 			break;
   564 		'content' =>
   564 		'content' =>
   565 				'<p>' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' .
   565 				'<p>' . __( 'Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.' ) . '</p>' .
   566 				'<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
   566 				'<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
   567 				'<p>' . sprintf(
   567 				'<p>' . sprintf(
   568 					/* translators: %s: WordPress Plugin Directory URL. */
   568 					/* translators: %s: WordPress Plugin Directory URL. */
   569 					__( 'If you would like to see more plugins to choose from, click on the &#8220;Add New Plugin&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
   569 					__( 'If you would like to see more plugins to choose from, click on the &#8220;Add Plugin&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they are free!' ),
   570 					__( 'https://wordpress.org/plugins/' )
   570 					__( 'https://wordpress.org/plugins/' )
   571 				) . '</p>',
   571 				) . '</p>',
   572 	)
   572 	)
   573 );
   573 );
   574 get_current_screen()->add_help_tab(
   574 get_current_screen()->add_help_tab(
   598 					'<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>',
   598 					'<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>',
   599 		)
   599 		)
   600 	);
   600 	);
   601 
   601 
   602 	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
   602 	$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
       
   603 }
       
   604 
       
   605 if ( current_user_can( 'install_plugins' ) ) {
       
   606 	get_current_screen()->add_help_tab(
       
   607 		array(
       
   608 			'id'      => 'plugins-dependencies',
       
   609 			'title'   => __( 'Dependencies' ),
       
   610 			'content' =>
       
   611 				'<p>' . __( 'Plugin Dependencies aims to make the process of installing and activating add-ons (dependents) and the plugins they rely on (dependencies) consistent and easy.' ) . '</p>' .
       
   612 				'<p>' . __( 'If a required plugin is deleted, a notice will be displayed on the Plugin administration screen informing the user that there is some missing dependencies to install and/or activate. Additionally, each plugin whose dependencies are not met will have an error notice on their plugin row.' ) . '</p>' .
       
   613 				'<p>' . __( 'If a dependent plugin is missing some dependencies, its activation button will be disabled until the required dependencies are activated.' ) . '</p>',
       
   614 		)
       
   615 	);
   603 }
   616 }
   604 
   617 
   605 get_current_screen()->set_help_sidebar(
   618 get_current_screen()->set_help_sidebar(
   606 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   619 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   607 	'<p>' . __( '<a href="https://wordpress.org/documentation/article/manage-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' .
   620 	'<p>' . __( '<a href="https://wordpress.org/documentation/article/manage-plugins/">Documentation on Managing Plugins</a>' ) . '</p>' .
   752 </h1>
   765 </h1>
   753 
   766 
   754 <?php
   767 <?php
   755 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) {
   768 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can( 'install_plugins' ) ) {
   756 	?>
   769 	?>
   757 	<a href="<?php echo esc_url( self_admin_url( 'plugin-install.php' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Add New Plugin' ); ?></a>
   770 	<a href="<?php echo esc_url( self_admin_url( 'plugin-install.php' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Add Plugin' ); ?></a>
   758 	<?php
   771 	<?php
   759 }
   772 }
   760 
   773 
   761 if ( strlen( $s ) ) {
   774 if ( strlen( $s ) ) {
   762 	echo '<span class="subtitle">';
   775 	echo '<span class="subtitle">';