@inheritdoc

@see filterJSFiles
@see filterJSInline
@see filterCSSFiles
@see filterCSSInline
967090
public function resourceFilterByFn(\Closure $callback)
    {
        $this->filterJSFiles($callback);
        $this->filterJSInline($callback);
        $this->filterCSSFiles($callback);
        $this->filterCSSInline($callback);
    }
988908
private function getCss($cssFiles = array())
    {
        $css = '';
        foreach ($cssFiles as $file) {
            if (file_exists($file)) {
                $css .= file_get_contents($file) . "\n";
            }
        }
        return $css;
    }
1345955
private function setJavascriptFileCDNjQuery($jsFileName)
    {
        $jQueryPosition     = strpos($jsFileName, 'jquery-');
        $jQueryMajorVersion = substr($jsFileName, 7, 1);
        if (($jQueryPosition !== false) && is_numeric($jQueryMajorVersion) && (substr($jsFileName, -7) == '.min.js')) {
            return [
                true,
                $this->sCloundFlareUrl . 'jquery/' . $this->getCmpltVers($jsFileName, 'jquery-') . '/jquery.min.js',
                '<script>window.jQuery || document.write(\'<script src="' . $this->sanitizeString($jsFileName)
                . '">\x3C/script>\')</script>',
            ];
        }
        return null;
    }
1181145
protected function setCssFile($cssFileName, $hostsWithoutCDNrq = null)
    {
        if (is_null($hostsWithoutCDNrq)) {
            $hostsWithoutCDNrq = [];
        }
        if (in_array($this->getClientRealIpAddress(), $hostsWithoutCDNrq)) {
            return '<link rel="stylesheet" type="text/css" href="'
                . filter_var($cssFileName, FILTER_SANITIZE_STRING) . '" />';
        }
        $patternFound = $this->setCssFileCDN($cssFileName);
        return '<link rel="stylesheet" type="text/css" href="'
            . filter_var($patternFound[1], FILTER_SANITIZE_STRING) . '" />';
    }
897289
public function includeJavaScriptValidationAndConditionFiles()
    {
        $javaScriptValidationFiles = $this->getJavaScriptFiles();
        $assetHandlerConnectorStates = $this->assetHandlerConnectorManager
            ->getAssetHandlerConnectorStates();

        foreach ($javaScriptValidationFiles as $file) {
            if (false === in_array($file, $assetHandlerConnectorStates->getAlreadyIncludedValidationJavaScriptFiles())) {
                $assetHandlerConnectorStates->registerIncludedValidationJavaScriptFiles($file);
                $this->includeJsFile(StringService::get()->getResourceRelativePath($file));
            }
        }

        return $this;
    }
1279171
function (a) {
            var self = this;
            if (a.file && a.line && !self.options.nocode) {
                a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line;
                if (a.path) {
                    a.foundAt = a.path + '#l' + a.line;
                }
            }
            return a;
        }
194581
public function filterDump(AssetInterface $asset)
    {
        $commandline = $this->nodeBin
            ? array($this->nodeBin, $this->uglifyjsBin)
            : array($this->uglifyjsBin);

        if ($this->noCopyright) {
            array_push($commandline, '--no-copyright');
        }

        if ($this->beautify) {
            array_push($commandline, '--beautify');
        }

        if ($this->unsafe) {
            array_push($commandline, '--unsafe');
        }

        if (false === $this->mangle) {
            array_push($commandline, '--no-mangle');
        }

        if ($this->defines) {
            foreach ($this->defines as $define) {
                array_push($commandline, '-d', $define);
            }
        }

        // input and output files
        $input = FilesystemUtils::createTemporaryFile('uglifyjs_in');
        $output = FilesystemUtils::createTemporaryFile('uglifyjs_out');

        file_put_contents($input, $asset->getContent());
        array_push($commandline, '-o', $output, $input);

        $proc = new Process(implode(' ', $commandline));
        $code = $proc->run();
        unlink($input);

        if (0 !== $code) {
            if (file_exists($output)) {
                unlink($output);
            }

            if (127 === $code) {
                throw new \RuntimeException('Path to node executable could not be resolved.');
            }

            throw FilterException::fromProcess($proc)->setInput($asset->getContent());
        }

        if (!file_exists($output)) {
            throw new \RuntimeException('Error creating output file.');
        }

        $uglifiedJs = file_get_contents($output);
        unlink($output);

        $asset->setContent($uglifiedJs);
    }
267970
public function filteredInput()
    {
        $files = $this->arrayFilterRecursive(Request::file());
        $input = array_replace_recursive(Request::input(), $files);

        return Library\Utils\Collection::nullEmpties($input);
    }
485409
function _applyFilters(rawdata, filterOptions) {
			var dataToWorkOn = (JSON.parse(JSON.stringify(rawdata)));
			var containerWidth = document.querySelector('#sapUiSupportPerfHeaderTimeline').offsetWidth - document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').offsetWidth;
			var scrollWidth = 20;
			var filteredTime = 1;

			dataToWorkOn = _filterByTime(filterOptions.filterByTime, dataToWorkOn);
			dataToWorkOn = _sortBy(filterOptions.orderByValue, dataToWorkOn);
			dataToWorkOn = _filterMinValue(filterOptions.minValue, dataToWorkOn);

			if (dataToWorkOn.length) {
				filteredTime = filterOptions.filterByTime.end - filterOptions.filterByTime.start;
			}

			_widthSingleUnit = ((containerWidth - scrollWidth) / filteredTime); //ms in px

			return dataToWorkOn;
		}
641584
static function filterDefaults( $defaults ) {

		// SASS => WP
		$overrides = [
			'body-font-size' => 'pdf_body_font_size',
			'body-line-height' => 'pdf_body_line_height',
			'page-margin-top' => 'pdf_page_margin_top',
			'page-margin-inside' => 'pdf_page_margin_inside',
			'page-margin-bottom' => 'pdf_page_margin_bottom',
			'page-margin-outside' => 'pdf_page_margin_outside',
			'front-matter-running-content-left' => 'running_content_front_matter_left',
			'front-matter-running-content-right' => 'running_content_front_matter_right',
			'introduction-running-content-left' => 'running_content_introduction_left',
			'introduction-running-content-right' => 'running_content_introduction_right',
			'part-running-content-left' => 'running_content_part_left',
			'part-running-content-right' => 'running_content_part_right',
			'chapter-running-content-left' => 'running_content_chapter_left',
			'chapter-running-content-right' => 'running_content_chapter_right',
			'back-matter-running-content-left' => 'running_content_back_matter_left',
			'back-matter-running-content-right' => 'running_content_back_matter_right',
		];

		$transient_name = 'pressbooks_theme_options_pdf_parsed_sass_variables';
		$parsed_sass_variables = get_transient( $transient_name );
		if ( $parsed_sass_variables === false ) {
			// Order of files matter. If a variable is duplicated in other files then the last one takes precedence
			$parsed_sass_variables = [];
			$sass = Container::get( 'Sass' );
			$path_to_global = $sass->pathToGlobals();
			$path_to_theme = get_stylesheet_directory();
			$files = [
				$path_to_global . '/variables/_elements.scss',
				$path_to_global . '/variables/_structure.scss',
				$path_to_theme . '/assets/styles/components/_elements.scss',
				$path_to_theme . '/assets/styles/components/_structure.scss',
			];
			foreach ( $files as $file ) {
				if ( file_exists( $file ) ) {
					$parsed_sass_variables[] = $sass->parseVariables( \Pressbooks\Utility\get_contents( $file ) );
				}
			}
			set_transient( $transient_name, $parsed_sass_variables );
		}

		foreach ( $parsed_sass_variables as $parsed_variables ) {
			foreach ( $overrides as $sass_var => $wp_option ) {
				if ( isset( $parsed_variables[ $sass_var ] ) ) {
					$val = self::parseSassValue( $parsed_variables[ $sass_var ] );
					if ( ! empty( $val ) ) {
						if ( in_array( $wp_option, self::getFloatOptions(), true ) ) {
							$val = (float) preg_replace( '/[^0-9.]/', '', $val ); // Extract digits and periods
						} elseif ( in_array( $wp_option, self::getIntegerOptions(), true ) ) {
							$val = (int) preg_replace( '/[^0-9]/', '', $val ); // Extract digits
						} elseif ( in_array( $wp_option, self::getBooleanOptions(), true ) ) {
							$val = filter_var( $val, FILTER_VALIDATE_BOOLEAN ); // Convert to boolean
						} elseif ( strpos( $wp_option, 'running_content', true ) ) {
							$val = self::replaceRunningContentStrings( $val );
						}
						$defaults[ $wp_option ] = $val; // Override default with new value
					}
				}
			}
		}

		return $defaults;
	}
416455
public function minifyJs($sourceFileList, $targetFile) {
        $sourceFileList = (array)$sourceFileList;
        $sourceFileList = array_map(array($this, '_createFullPath'), $sourceFileList);
        $sourceFileList = implode(' ', $sourceFileList);
        $targetFile = $this->_createFullPath($targetFile);

        $uglifyJsCommand = 'uglifyjs '.$sourceFileList.' -o '.$targetFile.' -c -m';
        `$uglifyJsCommand`;
    }
125581
public function filter(
        GitChangeSet $gitChangeSet,
        string $filter = '',
        string $blacklistToken = '',
        string $whitelistToken = ''
    ) {
        $whitelist = [];
        $deDuped = true;

        if ($whitelistToken !== '') {
            $deDuped = false;
            $whitelist = $this->blacklistFactory->findTokenDirectories($whitelistToken);
        }
        $blacklist = $this->blacklistFactory->build($blacklistToken, $deDuped);

        $list = $this->mergeLists($blacklist, $whitelist);
        $files = $gitChangeSet->getFiles();

        $result = $this->iterateOverFiles($filter, $files, $list);

        $gitChangeSet->setFiles($result);
    }
863675
protected function filterCSSInline(\Closure $callback)
    {
        if ($this->css) {
            $filteredCSS = array();
            foreach ($this->css as $key => $cssStyleTag) {
                if (call_user_func($callback, $cssStyleTag, RSmartLoad::RESOURCE_TYPE_CSS_INLINE)) {
                    $filteredCSS[$key] = $cssStyleTag;
                }
            }
            $this->css = $filteredCSS;
        }
    }
671950
public static ArrayList<String> getFilteredLinesFromFile(final String fileName, final String filter)
      throws IOException {
    return getFilteredLinesFromFile(fileName, filter, null, null);
  }
979196
function filterFolder(posts) {
      var reFolder = new RegExp(folder);
      return posts.filter(function filterPosts(post) {
        return reFolder.test(post.source.substr(0, post.source.lastIndexOf(path.sep)));
      });
    }
674922
function _filter(file) {
            return !LanguageManager.getLanguageForPath(file.fullPath).isBinary() ||
                MainViewFactory.findSuitableFactoryForPath(file.fullPath);
        }
503110
function filterFile(file, done) {
      if (files[file].partial) {
        // Discover whether it is explicitly declared as a partial.
        return done(null, files[file].partial)
      } else if (opts.pattern) {
        // Check if it matches the partial pattern.
        return done(null, minimatch(file, opts.pattern))
      }
      // The file is not a partial.
      done(null, false)
    }