Generates the file path to the serial file corresponding to
the configuration and definition name
@param HTMLPurifier_Config $config
@return string
@todo Make protected
964180
public function generateFilePath($config)
    {
        $key = $this->generateKey($config);
        return $this->generateDirectoryPath($config) . '/' . $key . '.ser';
    }
86807
public function getFileList($config)
    {
        if (strpos($config, ',')) {
            return array_filter(explode(',', $config));
        }

        if (!$this->isAbsolutePath($config)) {
            $config = getcwd().'/'.$config;
        }

        if (!file_exists($config)) {
            throw new InvalidArgumentException(sprintf('Configuration file "%s" does not exist.', $config));
        }

        $result = require $config;

        if ($result instanceof Config) {
            return $result->getFilenames();
        }

        if (is_array($result)) {
            return $result;
        }

        throw new InvalidArgumentException('Config must return an array of filenames or a Config object.');
    }
364785
public function describe(Config $config)
    {
        $data = [];

        if (!is_file('bin/phploc')) {
            return $data;
        }

        $tmpFile = tempnam(sys_get_temp_dir(), 'loc');

        if (!$tmpFile) {
            return $data;
        }

        `bin/phploc src --log-xml=$tmpFile`;

        $d = simplexml_load_file($tmpFile);
        unlink($tmpFile);

        $data['loc']     = (int) $d->loc;
        $data['ncloc']   = (int) $d->ncloc;
        $data['ccn']     = (int) $d->ccn;
        $data['classes'] = (int) $d->classes;

        return $data;
    }
1299127
public function inputStringPreparer($config)
    {
        $inputString = '';
        $beforeAfterCondition = ($this->before($config) > '' || $this->after($config) > '');
        $method = $this->getGeneratorMethod($config['inputType']);

        if ($beforeAfterCondition) {
            $inputString .= '<div class="'.config('form-maker.form.before_after_input_wrapper', 'input-group').'">';
        }

        $inputString .= $this->before($config);
        $inputString .= $this->inputStringGenerator($config);
        $inputString .= $this->after($config);

        if ($beforeAfterCondition) {
            $inputString .= '</div>';
        }

        if (config('form-maker.form.orientation') == 'horizontal' && !in_array($method, $this->selectedMethods)) {
            return '<div class="'.config('form-maker.form.input-column', '').'">'.$inputString.'</div>';
        }

        return $inputString;
    }
818352
private String getConfigUrlHtml(Config config) {

        return "<br/>点击<a href='http://" + applicationPropertyConfig.getDomain() + "/modifyFile.html?configId=" +
                config.getId() + "'> 这里 </a> 进入查看<br/>";
    }
416364
protected static function get_config_file_path() {
        global $CFG;
        if (!empty($CFG->altcacheconfigpath)) {
            $path = $CFG->altcacheconfigpath;
            if (is_dir($path) && is_writable($path)) {
                // Its a writable directory, thats fine.
                return $path.'/cacheconfig.php';
            } else if (is_writable(dirname($path)) && (!file_exists($path) || is_writable($path))) {
                // Its a file, either it doesn't exist and the directory is writable or the file exists and is writable.
                return $path;
            }
        }
        // Return the default location within dataroot.
        return $CFG->dataroot.'/muc/config.php';
    }
420862
public function configPath(?string $configPath = null) {
        if ($configPath != null) {
            $this->configPath = $configPath;
        }
        else {
            if (!isset($this->configPath)) {
                $this->configPath = $this->basePath() . DIRECTORY_SEPARATOR . "config";
            }
        }
        return $this->configPath;
    }
424769
public function createDir($dirname, array $config = [])
    {
        list($prefix, $dirname) = $this->getPrefixAndPath($dirname);

        return $this->getFilesystem($prefix)->createDir($dirname);
    }
645750
public function getSchemeObj($config, $context) {
        $registry = HTMLPurifier_URISchemeRegistry::instance();
        if ($this->scheme !== null) {
            $scheme_obj = $registry->getScheme($this->scheme, $config, $context);
            if (!$scheme_obj) return false; // invalid scheme, clean it out
        } else {
            // no scheme: retrieve the default one
            $def = $config->getDefinition('URI');
            $scheme_obj = $registry->getScheme($def->defaultScheme, $config, $context);
            if (!$scheme_obj) {
                // something funky happened to the default scheme object
                trigger_error(
                    'Default scheme object "' . $def->defaultScheme . '" was not readable',
                    E_USER_WARNING
                );
                return false;
            }
        }
        return $scheme_obj;
    }
90704
public function phpDoctor($config = 'default.ini')
    {

        // record start time
        $this->_startTime = $this->_getTime();

        // set the path
        $this->_path = dirname(dirname(__FILE__));

        // read config file
        if (is_file($config)) {
            $this->_options = @parse_ini_file($config);
            if (count($this->_options) == 0) {
                $this->error('Could not parse configuration file "'.$config.'"');
                exit;
            }
        } else {
            $this->error('Could not find configuration file "'.$config.'"');
            exit;
        }

        // set phpdoctor options
        if (isset($this->_options['verbose'])) {
            $this->_verbose = $this->_options['verbose'];
            $this->verbose('Being verbose');
        }
        if (isset($this->_options['quiet'])) $this->_quiet = $this->_options['quiet'];

        if (isset($this->_options['source_path'])) {
            $this->_sourcePath = array();
            foreach (explode(',', $this->_options['source_path']) as $path) {
                $this->_sourcePath[] = $this->fixPath($path, getcwd());
            }
        }

        if (isset($this->_options['subdirs'])) {
            $this->_subdirs = $this->_options['subdirs'];
        }

        if (isset($this->_options['files'])) {
            $files = explode(',', $this->_options['files']);
        } else {
            $files = array('*.php');
        }
        if (isset($this->_options['ignore'])) {
            $this->_ignore = explode(',', $this->_options['ignore']);
        }

        $this->verbose('Searching for files to parse...');
        $this->_files = array();
        foreach ($this->_sourcePath as $path) {
            $this->_files[$path] = array_unique($this->_buildFileList($files, $path));
        }
        if (count($this->_files) == 0) {
            $this->error('Could not find any files to parse');
            exit;
        }

        if (isset($this->_options['default_package'])) $this->_defaultPackage = $this->_options['default_package'];
        if (isset($this->_options['use_class_path_as_package'])) $this->_useClassPathAsPackage = $this->_options['use_class_path_as_package'];
        if (isset($this->_options['ignore_package_tags'])) $this->_ignorePackageTags = $this->_options['ignore_package_tags'];

    // use first path element
        if (isset($this->_options['overview'])) $this->_overview = $this->makeAbsolutePath($this->_options['overview'], $this->_sourcePath[0]);
        if (isset($this->_options['package_comment_dir'])) $this->_packageCommentDir = $this->makeAbsolutePath($this->_options['package_comment_dir'], $this->_sourcePath[0]);

        if (isset($this->_options['globals'])) $this->_globals = $this->_options['globals'];
        if (isset($this->_options['constants'])) $this->_constants = $this->_options['constants'];
        if (isset($this->_options['tree'])) $this->_tree = $this->_options['tree'];

        if (isset($this->_options['private']) && $this->_options['private']) {
            $this->_public = TRUE;
            $this->_protected = TRUE;
            $this->_private = TRUE;
        } elseif (isset($this->_options['protected']) && $this->_options['protected']) {
            $this->_public = TRUE;
            $this->_protected = TRUE;
            $this->_private = FALSE;
        } elseif (isset($this->_options['public']) && $this->_options['public']) {
            $this->_public = TRUE;
            $this->_protected = FALSE;
            $this->_private = FALSE;
        }

        if (isset($this->_options['doclet'])) $this->_doclet = $this->_options['doclet'];
        if (isset($this->_options['doclet_path'])) $this->_docletPath = $this->_options['doclet_path'];
        else $this->_docletPath = $this->_path.DIRECTORY_SEPARATOR.$this->_docletPath;
        if (isset($this->_options['taglet_path'])) $this->_tagletPath = $this->_options['taglet_path'];
        if (isset($this->_options['formatter'])) $this->_formatter = $this->_options['formatter'];
        if (isset($this->_options['formatter_path'])) $this->_formatterPath = $this->_options['formatter_path'];
        else $this->_formatterPath = $this->_path.DIRECTORY_SEPARATOR.$this->_formatterPath;

        if (isset($this->_options['pear_compat'])) $this->_pearCompat = $this->_options['pear_compat'];
    }
1239685
public function createFacade($config)
    {
        $this->fileService->mkdir($config['_path_facade_'], 0777, true);

        $facade = $this->fileService->get($config['template_source'].'/Facade.txt');

        foreach ($config as $key => $value) {
            $facade = str_replace($key, $value, $facade);
        }

        $facade = $this->putIfNotExists($config['_path_facade_'].'/'.$config['_camel_case_'].'.php', $facade);

        return $facade;
    }
796318
public function load(Config $config)
    {
        $config->setDefault(
            [
                'cs_ruleset'     => 'default',
                'cs_dirs'        => 'src',
                'cs_ignore_dirs' => null,
            ]
        );

        $locations = [
            getcwd().'/'.$config['cs_ruleset'],
            getcwd().'/'.$config['cs_ruleset'].'.xml',
            getcwd().'/ruleset'.(('default' === $config['cs_ruleset']) ? '' : ('-'.$config['cs_ruleset'])).'.xml',
            __DIR__.'/../Resources/rulesets/'.$config['cs_ruleset'].'.xml',
        ];

        foreach ($locations as $location) {
            if (is_file($location)) {
                $config['cs_ruleset'] = realpath($location);
                break;
            }
        }

        $codeSnifferConfFile = getcwd().'/vendor/squizlabs/php_codesniffer/CodeSniffer.conf';

        $config['cs_path_to_install'] = [];

        $found = false;

        if (is_file($codeSnifferConfFile)) {
            include $codeSnifferConfFile;
            if (isset($phpCodeSnifferConfig['installed_paths']) && false !== strpos($phpCodeSnifferConfig['installed_paths'], 'vendor/escapestudios/symfony2-coding-standard')) {
                $found = true;
            }
        }

        if (!$found) {
            $config['cs_path_to_install'][] = 'vendor/escapestudios/symfony2-coding-standard';
        }

        $config['cs_path_to_install'] = join(' ', $config['cs_path_to_install']);

        $config->setDefaultItem('commands', 'cs', "#cs,check code convention");
        $config->setDefaultItem('commands', 'csf', "#cs-fix,fix code convention problems");
        $config->setDefaultItem('commands', 'csx', "#cs-summary,display summary of code convention checking");
    }
1371207
public function create($type, $config)
    {
        $method = $config->get('Cache.DefinitionImpl');
        if ($method === null) {
            return new HTMLPurifier_DefinitionCache_Null($type);
        }
        if (!empty($this->caches[$method][$type])) {
            return $this->caches[$method][$type];
        }
        if (isset($this->implementations[$method]) &&
            class_exists($class = $this->implementations[$method], false)) {
            $cache = new $class($type);
        } else {
            if ($method != 'Serializer') {
                trigger_error("Unrecognized DefinitionCache $method, using Serializer instead", E_USER_WARNING);
            }
            $cache = new HTMLPurifier_DefinitionCache_Serializer($type);
        }
        foreach ($this->decorators as $decorator) {
            $new_cache = $decorator->decorate($cache);
            // prevent infinite recursion in PHP 4
            unset($cache);
            $cache = $new_cache;
        }
        $this->caches[$method][$type] = $cache;
        return $this->caches[$method][$type];
    }
1060328
protected function getPathFile($config_name, $file_name, $file_suffix = '', $extra_dir = '', $format_psr4 = null)
    {
        $format_psr4 = $format_psr4 === null ? false : (bool) $format_psr4;
        $prefix_ns = "";

        if (!$format_psr4) {
            $prefix_ns = str_replace('\\', '/', trim($this->prefix_ns, '\\'));
        }

        $elements =
            [
                rtrim($this->prefix_dir, '/'),
                $prefix_ns,
                Inflector::studlyCaps($config_name),
                Inflector::studlyCaps(sprintf("%s_schema", $this->schema)),
                $extra_dir,
                sprintf("%s%s.php", Inflector::studlyCaps($file_name), $file_suffix)
            ];

        return join('/', array_filter($elements, function ($val) { return $val != null; }));
    }
220329
private function getRootFolderName(SiteConfig $siteConfig)
    {
        return ($this->owner->has_extension('RootFolder')) ? $this->owner->getRootFolderName() : $siteConfig->getRootFolderName();
    }
1358321
protected function parseDescriptorField($config)
    {
        if (is_array($config)) {
            $descriptor = [];
            foreach ($config as $field) {
                if (!empty($this->{$field})) {
                    $descriptor[] = $this->{$field};
                }
            }

            return implode(' ', $descriptor);
        } else {
            return $this->{$config};
        }
    }
97765
private function placeholderSilhuette($config): string
    {
        $source = $config['source'] ?? null;
        $size = $config['size'];
        $color = $config['color'] ?? '#fefefe';
        $fgColor = $config['fgColor'] ?? '#e0e0e0';
        $silhouetteType = $config['silhouetteType'];
        
        if ($source === null) {
            throw new ImagerException('Placeholder of type "silhouette" needs a source image.');
        }
        
        try {
            $sourceModel = new LocalSourceImageModel($source);
            $sourceModel->getLocalCopy();
        } catch (ImagerException $e) {
            return '';
        }
        
        $tracer = new Potracio();
        $tracer->loadImageFromFile($sourceModel->getFilePath());
        $tracer->process();
        $data = $tracer->getSVG($size, $silhouetteType, $color, $fgColor);
        
        return 'data:image/svg+xml;charset=utf-8,' . rawurlencode($data);
    }