$plugin_template_system ) { self::generate_for( $plugin_name, $plugin_template_system ); } self::wrap_report(); return self::$complete_report; } protected static function registered_plugins() { /** * Provides a mechanism for plugins to register information about their template/view * setups. * * This should be done by adding an entry to $registere_template_systems where the key * should be the plugin name and the element an array structured as follows: * * [ * plugin_version, * path_to_included_views, * path_to_theme_overrides * ] * * @var array $registered_template_systems */ return apply_filters( 'tribe_support_registered_template_systems', [] ); } /** * Creates a report for the specified plugin. * * @param string $plugin_name * @param array $template_system */ protected static function generate_for( $plugin_name, array $template_system ) { $report = '
' . esc_html( $plugin_name ) . '
'; $scanner = new Tribe__Support__Template_Checker( $template_system[ self::VERSION_INDEX ], $template_system[ self::INCLUDED_VIEWS_INDEX ], $template_system[ self::THEME_OVERRIDES_INDEX ] ); $newly_introduced_or_updated = $scanner->get_views_tagged_this_release(); $outdated_or_unknown = $scanner->get_outdated_overrides( true ); if ( empty( $newly_introduced_or_updated ) && empty( $outdated_or_unknown ) ) { $report .= '
' . __( 'No notable changes detected', 'tribe-common' ) . '
'; } if ( ! empty( $newly_introduced_or_updated ) ) { $report .= '

' . sprintf( __( 'Templates introduced or updated with this release (%s):', 'tribe-common' ), $template_system[ self::VERSION_INDEX ] ) . '

'; } if ( ! empty( $outdated_or_unknown ) ) { $report .= '

' . __( 'Existing theme overrides that may need revision:', 'tribe-common' ) . '

'; } self::$plugin_reports[ $plugin_name ] = $report; } /** * Wraps the individual plugin template reports ready for display. */ protected static function wrap_report() { if ( empty( self::$plugin_reports ) ) { self::$complete_report = '

' . __( 'No notable template changes detected.', 'tribe-common' ) . '

'; } else { self::$complete_report = '

' . __( 'Information about recent template changes and potentially impacted template overrides is provided below.', 'tribe-common' ) . '

' . '
' . join( ' ', self::$plugin_reports ) . '
'; } } }