WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies()
Displays an admin notice if circular dependencies are installed.
Метод класса: WP_Plugin_Dependencies{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies();
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies() WP Plugin Dependencies::display admin notice for circular dependencies WP 6.6.2
public static function display_admin_notice_for_circular_dependencies() { $circular_dependencies = self::get_circular_dependencies(); if ( ! empty( $circular_dependencies ) && count( $circular_dependencies ) > 1 ) { $circular_dependencies = array_unique( $circular_dependencies, SORT_REGULAR ); $plugins = self::get_plugins(); $plugin_dirnames = self::get_plugin_dirnames(); // Build output lines. $circular_dependency_lines = ''; foreach ( $circular_dependencies as $circular_dependency ) { $first_filepath = $plugin_dirnames[ $circular_dependency[0] ]; $second_filepath = $plugin_dirnames[ $circular_dependency[1] ]; $circular_dependency_lines .= sprintf( /* translators: 1: First plugin name, 2: Second plugin name. */ '<li>' . _x( '%1$s requires %2$s', 'The first plugin requires the second plugin.' ) . '</li>', '<strong>' . esc_html( $plugins[ $first_filepath ]['Name'] ) . '</strong>', '<strong>' . esc_html( $plugins[ $second_filepath ]['Name'] ) . '</strong>' ); } wp_admin_notice( sprintf( '<p>%1$s</p><ul>%2$s</ul><p>%3$s</p>', __( 'These plugins cannot be activated because their requirements are invalid.' ), $circular_dependency_lines, __( 'Please contact the plugin authors for more information.' ) ), array( 'type' => 'warning', 'paragraph_wrap' => false, ) ); } }