Fetches actual Public Suffix List and writes obtained suffixes to target file.

@return void

@throws IOException
423721
public function run()
    {
        /*
         * Fetching Public Suffix List and parse suffixes.
         * */

        $lines = $this->httpAdapter->get(Update::PUBLIC_SUFFIX_LIST_URL);

        $parser = new Parser($lines);
        $suffixes = $parser->parse();

        /*
         * Write file with exclusive file write lock.
         * */

        $handle = @fopen($this->outputFileName, 'w+');

        if ($handle === false) {
            throw new Exceptions\IOException(error_get_last()['message']);
        }

        if (!flock($handle, LOCK_EX)) {
            throw new Exceptions\IOException(sprintf('Cannot obtain lock to output file (%s)', $this->outputFileName));
        }

        $suffixFile = '<?php' . PHP_EOL . 'return ' . var_export($suffixes, true) . ';';
        $writtenBytes = fwrite($handle, $suffixFile);

        if ($writtenBytes === false || $writtenBytes !== strlen($suffixFile)) {
            throw new Exceptions\IOException(sprintf('Write to output file (%s) failed', $this->outputFileName));
        }

        flock($handle, LOCK_UN);
        fclose($handle);
    }
831458
public function write() {
        $filename = $this->getFileName();
        if(basename($filename) == '.php') {
            throw new CatchableException('Invalid Filename: '.$filename);
        }
        if(!is_dir(dirname($filename))) {
            mkdir(dirname($filename), 0777, true);
        }
        file_put_contents($filename, $this->toString());
    }
847347
private function getOutputs() : string
    {
        ob_start();
        extract($this->data);
        require $this->file;
        $contents = ob_get_contents();
        ob_end_clean();

        return $contents;
    }
14122
private function getSuffixesToTry()
    {
        if ($this->suffixesToTry === null) {
            $this->suffixesToTry = [];

            if (isset($this->conf['salutation'])) {
                if ($this->conf['salutation'] === 'informal') {
                    $this->suffixesToTry[] = '_informal';
                }
                $this->suffixesToTry[] = '_formal';
            }
            $this->suffixesToTry[] = '';
        }

        return $this->suffixesToTry;
    }
929250
private function fetchPrefix(): array
    {
        $prefixBody = fread($this->in, 17);
        if ($prefixBody === false) {
            throw new Exceptions\PrefixException("unable to read prefix from the stream");
        }

        $result = unpack("Cflags/Psize/Jrevs", $prefixBody);
        if (!is_array($result)) {
            throw new Exceptions\PrefixException("invalid prefix");
        }

        if ($result['size'] != $result['revs']) {
            throw new Exceptions\PrefixException("invalid prefix (checksum)");
        }

        return $result;
    }
1072553
private function generateCode(int $length = 4, string $prefix = '', string $suffix = '')
    {
        for ($i = 0; $i < $length; $i++) {
            $prefix .= random_int(0, 1) ? chr(random_int(65, 90)) : random_int(0, 9);
        }

        return $prefix.$suffix;
    }
372371
protected function _processFiles()
    {
        if (isset($_FILES['myfile']['name'])) {
            // process all files
            foreach ($_FILES['myfile']['name'] as $key => $value) {
                $aSource = $_FILES['myfile']['tmp_name'];
                $sSource = $aSource[$key];
                $value = strtolower($value);
                // add type to name
                $aFilename = explode(".", $value);

                //hack?

                $aBadFiles = ["php", 'php4', 'php5', "jsp", "cgi", "cmf", "exe"];

                if (in_array($aFilename[1], $aBadFiles)) {
                    \OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("File didn't pass our allowed files filter.");
                }

                //reading SQL dump file
                if (filesize($sSource) > 0) {
                    $rHandle = fopen($sSource, "r");
                    $sContents = fread($rHandle, filesize($sSource));
                    fclose($rHandle);

                    //reading only one SQL dump file
                    return $sContents;
                }

                return;
            }
        }

        return;
    }
1281882
public void writeTags() throws FileNotFoundException, IOException
	{
		RandomAccessFile raf = null;
		try
		{
			raf = new RandomAccessFile(mp3File, "rw");
			// Write out id3v2 first because if the filesize is changed when an
			// id3v2 is written then the id3v1 may be moved away from the end
			// of the file which would cause it to not be recognized.
			if (id3v2.tagExists())
			{
				id3v2.writeTag(raf);
			}
			if (id3v1.tagExists())
			{
				id3v1.writeTag(raf);
			}
		}
		finally
		{
			if (raf != null) raf.close();
		}
	}
921032
public function write()
    {
        $lines = array();

        foreach ($this->data as $fetch) {
            $data = array($fetch['url'], $fetch['length'], $fetch['filename']);
            array_push($lines, join(' ', $data) . "\n");
        }

        if (count($lines) == 0) {
            if (file_exists($this->fileName)) {
                unlink($this->fileName);
            }
        } else {
            writeFileText($this->fileName, $this->fileEncoding, join('', $lines));
        }
    }
392730
def _write_raw(self, suffix):
        
        if not self.enabled: return

        self.buffer.write(CSI)
        self.buffer.write(suffix)
1135117
def suffixes(self):
        """"""
        name = self.name
        if name.endswith('.'):
            return []
        name = name.lstrip('.')
        return ['.' + suffix for suffix in name.split('.')[1:]]
1021796
public function write()
    {
        
        $tf = $this->getTranslationFile();
        $buffer = "<?php\n";
        foreach ($tf->getTranslationUnits() as $tu){
            // Prevent empty messages.
            if ($tu->getSource() != '' && $tu->getTarget() != ''){
                $escapes = array("\\", '$', '"', "\n", "\t", "\v", "\r", "\f");
                $replace = array("\\\\", '\\$', '\\"', "\\n", "\\t", "\\v", "\\r", "\\f");
                $source = str_replace($escapes, $replace, $tu->getSource());
                $target = str_replace($escapes, $replace, $tu->getTarget());
                $buffer .= '$GLOBALS[\'__l10n\']["' . $source . '"]="' . $target . '";' . "\n";
            }
        }
        $buffer .= "\n?>";
        
        file_put_contents($this->getFilePath(), $buffer);
        
    }
1298333
private function write()
    {
        $cache = serialize($this->records);
        flock($this->file, LOCK_EX);
        rewind($this->file);
        ftruncate($this->file, 0);
        $bytes = fwrite($this->file, $cache);
        flock($this->file, LOCK_UN);

        return $bytes === strlen($cache);
    }
770996
protected function _write()
    {
        $paths = $this->_paths;
        $paths[] = realpath(APP) . DIRECTORY_SEPARATOR;

        usort($paths, function ($a, $b) {
            return strlen($a) - strlen($b);
        });

        $domains = null;
        if (!empty($this->params['domains'])) {
            $domains = explode(',', $this->params['domains']);
        }

        foreach ($this->_translations as $domain => $translations) {
            if (!empty($domains) && !in_array($domain, $domains)) {
                continue;
            }
            if ($this->_merge) {
                $domain = 'default';
            }
            foreach ($translations as $msgid => $contexts) {
                foreach ($contexts as $context => $details) {
                    $references = null;
                    if (!$this->param('no-location')) {
                        $files = $details['references'];
                        $occurrences = [];
                        foreach ($files as $file => $lines) {
                            $lines = array_unique($lines);
                            $occurrences[] = $file . ':' . implode(';', $lines);
                        }
                        $occurrences = implode("\n", $occurrences);
                        $occurrences = str_replace($paths, '', $occurrences);
                        $references = str_replace(DIRECTORY_SEPARATOR, '/', $occurrences);
                    }

                    $this->_save(
                        $domain,
                        $msgid,
                        $details['msgid_plural'] === false ? null : $details['msgid_plural'],
                        $context ?: null,
                        $references
                    );
                }
            }
        }
    }
23089
private function write() {

		if(null === $this -> directory) {
			return trigger_error(sprintf('Directory used in %s() can not be NULL', __METHOD__), E_USER_ERROR);
		}

		if(false === is_string($this -> code)) {
			return trigger_error(sprintf('Code used in %s() must be of the type string, "%s" given', __METHOD__, gettype($this -> code)), E_USER_ERROR);
		}

		$file = $this -> getFileName();
		$file = new File($this -> directory . $file);

		//Create file if not exists
		if(false === $file -> exists()) {
			$file -> create();
		}

		//Append data to file after flushing it
		$file -> flush() -> append($this -> code);

		return $this;
	}
1094243
public function endWrite()
    {
        if (false !== $this->firstHarvestedId) {
            $this->saveFile(
                $this->firstHarvestedId, $this->getCombinedXML($this->innerXML)
            );
        }

        if (!empty($this->deletedIds)) {
            $this->saveDeletedRecords($this->deletedIds);
        }
    }
407929
public function buildIndex()
    {
        $this->file->flock(LOCK_SH);
        $this->file->fseek(0);

        $indexes = [];
        while (!$this->file->eof()) {
            $position = $this->file->ftell();

            // Grab key and value lengths - if its the last (empty) line, break
            if (!$metadata = $this->getMetadata()) {
                break;
            }

            // Gets the key and adds the key and position to the index
            $indexes[$this->file->fread($metadata->klen)] = $position;

            //Skip over the value, to the next key/value pair
            $this->file->fseek($metadata->vlen, SEEK_CUR);
        }
        $this->file->flock(LOCK_UN);

        return $indexes;
    }