integrations if their conditionals are met.
*
* @return void
*/
public function load_integrations() {
foreach ( $this->integrations as $class ) {
if ( ! $this->conditionals_are_met( $class ) ) {
continue;
}
$integration = $this->get_class( $class );
if ( $integration === null ) {
continue;
}
$integration->register_hooks();
}
}
/**
* Loads all registered routes if their conditionals are met.
*
* @return void
*/
public function load_routes() {
foreach ( $this->routes as $class ) {
if ( ! $this->conditionals_are_met( $class ) ) {
continue;
}
$route = $this->get_class( $class );
if ( $route === null ) {
continue;
}
$route->register_routes();
}
}
/**
* Checks if all conditionals of a given loadable are met.
*
* @param string $loadable_class The class name of the loadable.
*
* @return bool Whether all conditionals of the loadable are met.
*/
protected function conditionals_are_met( $loadable_class ) {
// In production environments do not fatal if the class does not exist but log and fail gracefully.
if ( \YOAST_ENVIRONMENT === 'production' && ! \class_exists( $loadable_class ) ) {
if ( \defined( 'WP_DEBUG' ) && \WP_DEBUG ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
\error_log(
\sprintf(
/* translators: %1$s expands to Yoast SEO, %2$s expands to the name of the class that could not be found. */
\__( '%1$s attempted to load the class %2$s but it could not be found.', 'wordpress-seo' ),
'Yoast SEO',
$loadable_class
)
);
}
return false;
}
$conditionals = $loadable_class::get_conditionals();
foreach ( $conditionals as $class ) {
$conditional = $this->get_class( $class );
if ( $conditional === null || ! $conditional->is_met() ) {
return false;
}
}
return true;
}
/**
* Gets a class from the container.
*
* @param string $class_name The class name.
*
* @return object|null The class or, in production environments, null if it does not exist.
*
* @throws Throwable If the class does not exist in development environments.
*/
protected function get_class( $class_name ) {
try {
return $this->container->get( $class_name );
} catch ( Throwable $e ) {
// In production environments do not fatal if the class could not be constructed but log and fail gracefully.
if ( \YOAST_ENVIRONMENT === 'production' ) {
if ( \defined( 'WP_DEBUG' ) && \WP_DEBUG ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
\error_log( $e->getMessage() );
}
return null;
}
throw $e;
}
}
}
Fatal error: Uncaught Error: Class 'Yoast\WP\SEO\Loader' not found in /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/src/generated/container.php:5141
Stack trace:
#0 /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(271): Yoast\WP\SEO\Generated\Cached_Container->getLoaderService()
#1 /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/lib/abstract-main.php(54): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\Lo...')
#2 /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/src/functions.php(34): Yoast\WP\Lib\Abstract_Main->load()
#3 /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/wp-seo-main.php(445): YoastSEO()
#4 /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/wp-seo.php(50): require_once('/home/htzanetat...')
#5 /home/htzanetatos/public_html/wp-settings.php(545): include_once('/home/htzanetat...')
#6 /home/htzanetatos/public_html/wp-config.php(83) in /home/htzanetatos/public_html/wp-content/plugins/wordpress-seo/src/generated/container.php on line 5141