// Remove empty elements.
self::$dependency_api_data = array_filter( self::$dependency_api_data );
set_site_transient( 'wp_plugin_dependencies_plugin_data', self::$dependency_api_data, 0 );
return self::$dependency_api_data;
}
/**
* Gets plugin directory names.
*
* @since 6.5.0
*
* @return array An array of plugin directory names.
*/
protected static function get_plugin_dirnames() {
if ( is_array( self::$plugin_dirnames ) ) {
return self::$plugin_dirnames;
}
self::$plugin_dirnames = array();
$plugin_files = array_keys( self::get_plugins() );
foreach ( $plugin_files as $plugin_file ) {
$slug = self::convert_to_slug( $plugin_file );
self::$plugin_dirnames[ $slug ] = $plugin_file;
}
return self::$plugin_dirnames;
}
/**
* Gets circular dependency data.
*
* @since 6.5.0
*
* @return array[] An array of circular dependency pairings.
*/
protected static function get_circular_dependencies() {
if ( is_array( self::$circular_dependencies_pairs ) ) {
return self::$circular_dependencies_pairs;
}
if ( null === self::$dependencies ) {
return array();
}
self::$circular_dependencies_slugs = array();
self::$circular_dependencies_pairs = array();
foreach ( self::$dependencies as $dependent => $dependencies ) {
/*
* $dependent is in 'a/a.php' format. Dependencies are stored as slugs, i.e. 'a'.
*
* Convert $dependent to slug format for checking.
*/
$dependent_slug = self::convert_to_slug( $dependent );
self::$circular_dependencies_pairs = array_merge(
self::$circular_dependencies_pairs,
self::check_for_circular_dependencies( array( $dependent_slug ), $dependencies )
);
}
return self::$circular_dependencies_pairs;
}
/**
* Checks for circular dependencies.
*
* @since 6.5.0
*
* @param array $dependents Array of dependent plugins.
* @param array $dependencies Array of plugins dependencies.
* @return array A circular dependency pairing, or an empty array if none exists.
*/
protected static function check_for_circular_dependencies( $dependents, $dependencies ) {
$circular_dependencies_pairs = array();
// Check for a self-dependency.
$dependents_location_in_its_own_dependencies = array_intersect( $dependents, $dependencies );
if ( ! empty( $dependents_location_in_its_own_dependencies ) ) {
foreach ( $dependents_location_in_its_own_dependencies as $self_dependency ) {
self::$circular_dependencies_slugs[] = $self_dependency;
$circular_dependencies_pairs[] = array( $self_dependency, $self_dependency );
// No need to check for itself again.
unset( $dependencies[ array_search( $self_dependency, $dependencies, true ) ] );
}
}
/*
* Check each dependency to see:
* 1. If it has dependencies.
* 2. If its list of dependencies includes one of its own dependents.
*/
foreach ( $dependencies as $dependency ) {
// Check if the dependency is also a dependent.
$dependency_location_in_dependents = array_search( $dependency, self::$dependent_slugs, true );
if ( false !== $dependency_location_in_dependents ) {
$dependencies_of_the_dependency = self::$dependencies[ $dependency_location_in_dependents ];
foreach ( $dependents as $dependent ) {
// Check if its dependencies includes one of its own dependents.
$dependent_location_in_dependency_dependencies = array_search(
$dependent,
$dependencies_of_the_dependency,
true
);
if ( false !== $dependent_location_in_dependency_dependencies ) {
self::$circular_dependencies_slugs[] = $dependent;
self::$circular_dependencies_slugs[] = $dependency;
$circular_dependencies_pairs[] = array( $dependent, $dependency );
// Remove the dependent from its dependency's dependencies.
unset( $dependencies_of_the_dependency[ $dependent_location_in_dependency_dependencies ] );
}
}
$dependents[] = $dependency;
/*
* Now check the dependencies of the dependency's dependencies for the dependent.
*
* Yes, that does make sense.
*/
$circular_dependencies_pairs = array_merge(
$circular_dependencies_pairs,
self::check_for_circular_dependencies( $dependents, array_unique( $dependencies_of_the_dependency ) )
);
}
}
return $circular_dependencies_pairs;
}
/**
* Converts a plugin filepath to a slug.
*
* @since 6.5.0
*
* @param string $plugin_file The plugin's filepath, relative to the plugins directory.
* @return string The plugin's slug.
*/
protected static function convert_to_slug( $plugin_file ) {
if ( 'hello.php' === $plugin_file ) {
return 'hello-dolly';
}
return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file );
}
}
Fatal error: require_once(): Failed opening required '/home/candoodesigncom/public_html/wp-content/plugins/google-analytics-for-wordpress/includes/helpers.php' (include_path='.:/opt/alt/php74/usr/share/pear') in /home/candoodesigncom/public_html/wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php on line 471