protected static function _fileExport($entry, &$exportPath, &$rootPath, $options) { if (empty($entry)) { return; } $relativePath = trim(str_replace($rootPath, '', $entry), '/'); if (in_array($relativePath, $options['excludes'])) { echo "<span style='color: #ddd'>Excluded {$relativePath}</span>\n"; return; } foreach ($options['excludeRegExs'] as $excludeRegEx) { if (preg_match($excludeRegEx, $relativePath)) { echo "<span style='color: #ddd'>RegExcluded {$relativePath}</span>\n"; return; } } if (is_dir($entry)) { echo "<span style='color: #ddd'>Browsing {$relativePath}</span>\n"; $children = array(); $dh = opendir($entry); while ($child = readdir($dh)) { if (substr($child, 0, 1) === '.') { // ignore . (current directory) // ignore .. (parent directory) // ignore hidden files (dot files/directories) continue; } $children[] = $child; } foreach ($children as $child) { if (!empty($options['force'])) { $options['force'] = false; } // reset `force` option for children self::_fileExport($entry . '/' . $child, $exportPath, $rootPath, $options); } } elseif (is_file($entry)) { $ext = XenForo_Helper_File::getFileExtension($entry); if (!empty($options['force']) || in_array($ext, $options['extensions']) && strpos(basename($entry), '.') !== 0 || in_array(strtolower(basename($entry)), $options['filenames_lowercase'])) { if ($options['addon_id'] == 'devHelper') { $isDevHelper = strpos($entry, 'DevHelper/DevHelper') !== false; } else { $isDevHelper = strpos($entry, 'DevHelper') !== false; } if (!$isDevHelper) { $entryExportPath = $exportPath . '/' . $relativePath; if ($ext === 'php') { DevHelper_Helper_ShippableHelper::checkForUpdate($entry); } $contents = self::fileGetContents($entry); if (!empty($contents)) { if ($ext === 'php') { DevHelper_Helper_Phrase::parsePhpForPhraseTracking($relativePath, $contents); DevHelper_Helper_Xfcp::parsePhpForXfcpClass($relativePath, $contents); } $result = self::writeFile($entryExportPath, $contents, false, false); if ($result === true) { echo "Exporting {$relativePath} OK\n"; } elseif ($result === 'skip') { echo "<span style='color: #ddd'>Exporting {$relativePath} SKIPPED</span>\n"; } } } } } }