english/libraries/loader.php
/**
	 * Method to discover classes of a given type in a given path.
	 *
	 * @param   string  $classPrefix  The class name prefix to use for discovery.
	 * @param   string  $parentPath   Full path to the parent folder for the classes to discover.
	 * @param   bool    $force        True to overwrite the autoload path value for the class if it already exists.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 */
Method to discover classes of a given type in a given path.
@param   string  $classPrefix  The class name prefix to use for discovery.
@param   string  $parentPath   Full path to the parent folder for the classes to discover.
@param   bool    $force        True to overwrite the autoload path value for the class if it already exists.

@return  void


Method to discover classes of a given type in a given path . @param string $classPrefix The class name prefix to use for discovery . @param string $parentPath Full path to the parent folder for the classes to discover . @param bool $force True to overwrite the autoload path value for the class if it already exists . @return void
public static function discover($classPrefix, $parentPath, $force = true)
	{
		if (is_dir($parentPath)) {
			$d = dir($parentPath);
			while (false !== ($entry = $d->read()))
			{
				if (file_exists($parentPath.'/'.$entry) && (substr($entry, strrpos($entry, '.') + 1) == 'php')) {
					$class = strtolower($classPrefix.preg_replace('#\.[^.]*$#', '', $entry));
					$path  = $parentPath.'/'.$entry;
					if (empty(self::$_classes[$class]) || $force) {
						JLoader::register($class, $path);
					}
				}
			}
			$d->close();
		}
	}
public static function discover ( $ classPrefix , $ parentPath , $ force = true ) { if ( is_dir ( $ parentPath ) ) { $ d = dir ( $ parentPath ) ; while ( false !== ( $ entry = $ d -> read ( ) ) ) { if ( file_exists ( $ parentPath . '/' . $ entry ) && ( substr ( $ entry , strrpos ( $ entry , '.' ) + 1 ) == 'php' ) ) { $ class = strtolower ( $ classPrefix . preg_replace ( '#\.[^.]*$#' , '' , $ entry ) ) ; $ path = $ parentPath . '/' . $ entry ; if ( empty ( self :: $ _classes [ $ class ] ) || $ force ) { JLoader :: register ( $ class , $ path ) ; } } } $ d -> close ( ) ; } }
Method to discover classes of a given type in a given path.
Method to discover classes of a given type in a given path .
// Ignore the operation if the folder doesn't exist. // Open the folder. // Iterate through the folder contents to search for input classes. // Only load for php files. // Get the class name and full path for each file. // Register the class with the autoloader if not already registered or the force flag is set. // Close the folder.