Filter tin-canny-learndash-reporting

uo_tincanny_uploader_exclude_files

Filters the list of files excluded from the Tincanny uploader, allowing developers to customize which files are hidden.

add_filter( 'uo_tincanny_uploader_exclude_files', $callback, 10, 1 );

Description

Allows developers to modify the default list of files and directories excluded from Tincanny zip uploads. Use this filter to add or remove patterns for items that should not be processed by the uploader.


Usage

add_filter( 'uo_tincanny_uploader_exclude_files', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter( 'uo_tincanny_uploader_exclude_files', 'my_custom_tincanny_exclude_files', 10, 1 );

/**
 * Add custom file exclusions to the Tincanny uploader.
 *
 * This function adds additional file names or patterns to be excluded
 * by the Tincanny zip uploader. This can be useful for excluding
 * deployment-specific files or temporary build artifacts.
 *
 * @param array $excluded_files An array of file names or patterns to exclude.
 * @return array The modified array of excluded files.
 */
function my_custom_tincanny_exclude_files( $excluded_files ) {
	// Add a specific file to the exclusion list.
	$excluded_files[] = 'temp_build_output.zip';

	// Add a directory pattern to exclude all files within it.
	$excluded_files[] = 'logs/';

	// Add another common development artifact.
	$excluded_files[] = 'yarn-error.log';

	return $excluded_files;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/tincanny-zip-uploader/tincanny-zip-uploader.php:299

private function invalid_files() {
		return apply_filters(
			'uo_tincanny_uploader_exclude_files',
			array(
				'__MACOSX',
				'.DS_Store',
				'.git',
				'.gitignore',
				//'.htaccess',
				'.idea',
				'.sass-cache',
				'.vscode',
				'bower_components',
				'composer.lock',
				'composer.phar',
				'node_modules',
				'npm-debug.log',
				//'package-lock.json',
				//'package.json',
				'phpcs.xml',
				'phpunit.xml',
				'phpunit.xml.dist',
			)
		);
	}

Scroll to Top