当前位置: 首页>>代码示例>>PHP>>正文


PHP SaveToFile函数代码示例

本文整理汇总了PHP中SaveToFile函数的典型用法代码示例。如果您正苦于以下问题:PHP SaveToFile函数的具体用法?PHP SaveToFile怎么用?PHP SaveToFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SaveToFile函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MakeFont

function MakeFont($fontfile, $afmfile, $enc = 'cp1252', $patch = array(), $type = 'TrueType')
{
    //Generate a font definition file
    set_magic_quotes_runtime(0);
    ini_set('auto_detect_line_endings', '1');
    if ($enc) {
        $map = ReadMap($enc);
        foreach ($patch as $cc => $gn) {
            $map[$cc] = $gn;
        }
    } else {
        $map = array();
    }
    if (!file_exists($afmfile)) {
        die('<B>Error:</B> AFM file not found: ' . $afmfile);
    }
    $fm = ReadAFM($afmfile, $map);
    if ($enc) {
        $diff = MakeFontEncoding($map);
    } else {
        $diff = '';
    }
    $fd = MakeFontDescriptor($fm, empty($map));
    //Find font type
    if ($fontfile) {
        $ext = strtolower(substr($fontfile, -3));
        if ($ext == 'ttf') {
            $type = 'TrueType';
        } elseif ($ext == 'pfb') {
            $type = 'Type1';
        } else {
            die('<B>Error:</B> unrecognized font file extension: ' . $ext);
        }
    } else {
        if ($type != 'TrueType' and $type != 'Type1') {
            die('<B>Error:</B> incorrect font type: ' . $type);
        }
    }
    //Start generation
    $s = '<?php' . "\n";
    $s .= '$type=\'' . $type . "';\n";
    $s .= '$name=\'' . $fm['FontName'] . "';\n";
    $s .= '$desc=' . $fd . ";\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
    $w = MakeWidthArray($fm);
    $s .= '$cw=' . $w . ";\n";
    $s .= '$enc=\'' . $enc . "';\n";
    $s .= '$diff=\'' . $diff . "';\n";
    $basename = substr(basename($afmfile), 0, -4);
    if ($fontfile) {
        //Embedded font
        if (!file_exists($fontfile)) {
            die('<B>Error:</B> font file not found: ' . $fontfile);
        }
        if ($type == 'TrueType') {
            CheckTTF($fontfile);
        }
        $f = fopen($fontfile, 'rb');
        if (!$f) {
            die('<B>Error:</B> Can\'t open ' . $fontfile);
        }
        $file = fread($f, filesize($fontfile));
        fclose($f);
        if ($type == 'Type1') {
            //Find first two sections and discard third one
            $header = ord($file[0]) == 128;
            if ($header) {
                //Strip first binary header
                $file = substr($file, 6);
            }
            $pos = strpos($file, 'eexec');
            if (!$pos) {
                die('<B>Error:</B> font file does not seem to be valid Type1');
            }
            $size1 = $pos + 6;
            if ($header and ord($file[$size1]) == 128) {
                //Strip second binary header
                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
            }
            $pos = strpos($file, '00000000');
            if (!$pos) {
                die('<B>Error:</B> font file does not seem to be valid Type1');
            }
            $size2 = $pos - $size1;
            $file = substr($file, 0, $size1 + $size2);
        }
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($file), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
            echo 'Font file compressed (' . $cmp . ')<BR>';
        } else {
            $s .= '$file=\'' . basename($fontfile) . "';\n";
//.........这里部分代码省略.........
开发者ID:google-code-backups,项目名称:zeybux,代码行数:101,代码来源:makefont.php

示例2: MakeFont

function MakeFont($fontfile, $afmfile, $enc = 'cp1252', $patch = array())
{
    //Generate a font definition file
    set_magic_quotes_runtime(0);
    if ($enc) {
        $map = ReadMap($enc);
        foreach ($patch as $cc => $gn) {
            $map[$cc] = $gn;
        }
    } else {
        $map = array();
    }
    if (!file_exists($afmfile)) {
        die('<B>Error:</B> AFM file not found: ' . $afmfile);
    }
    $fm = ReadAFM($afmfile, $map);
    if ($enc) {
        $diff = MakeFontEncoding($map);
    } else {
        $diff = '';
    }
    $fd = MakeFontDescriptor($fm, empty($map));
    $s = '<?php' . "\n";
    $s .= '$type=\'TrueType' . "';\n";
    $s .= '$name=\'' . $fm['FontName'] . "';\n";
    $s .= '$desc=' . $fd . ";\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
    $w = MakeWidthArray($fm);
    $s .= '$cw=' . $w . ";\n";
    $s .= '$enc=\'' . $enc . "';\n";
    $s .= '$diff=\'' . $diff . "';\n";
    $basename = substr(basename($afmfile), 0, -4);
    if ($fontfile) {
        //Embedded font
        if (!file_exists($fontfile)) {
            die('<B>Error:</B> font file not found: ' . $fontfile);
        }
        if (function_exists('gzcompress')) {
            $f = fopen($fontfile, 'rb');
            $ttf = fread($f, filesize($fontfile));
            fclose($f);
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($ttf), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
            echo 'Font file compressed (' . $cmp . ')<BR>';
        } else {
            echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>';
            $s .= '$file=\'' . basename($fontfile) . "';\n";
        }
        $s .= '$originalsize=' . filesize($fontfile) . ";\n";
    } else {
        //Not embedded font
        $s .= '$file=' . "'';\n";
    }
    $s .= "?>\n";
    SaveToFile($basename . '.php', $s);
    echo 'Font definition file generated (' . $basename . '.php' . ')<BR>';
}
开发者ID:nesmaster,项目名称:msclink,代码行数:65,代码来源:makefont.php

示例3: MakeFont


//.........这里部分代码省略.........
        $fd = MakeFontDescriptor($fm, empty($map));
    } elseif ($fmext == 'ufm') {
        $enc = "";
        if ($ffext == 'ttf') {
            $type = 'TrueTypeUnicode';
        } else {
            die('Error: not a TrueType font: ' . $ffext);
        }
        $fm = ReadUFM($fmfile, $cidtogidmap);
        $fd = MakeFontDescriptor($fm, false);
    }
    //Start generation
    $s = '<?php' . "\n";
    $s .= '$type=\'' . $type . "';\n";
    $s .= '$name=\'' . $fm['FontName'] . "';\n";
    $s .= '$desc=' . $fd . ";\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
    $w = MakeWidthArray($fm);
    $s .= '$cw=' . $w . ";\n";
    $s .= '$enc=\'' . $enc . "';\n";
    $s .= '$diff=\'' . $diff . "';\n";
    $basename = substr(basename($fmfile), 0, -4);
    if ($embedded) {
        //Embedded font
        if ($type == 'TrueType' or $type == 'TrueTypeUnicode') {
            CheckTTF($fontfile);
        }
        $f = fopen($fontfile, 'rb');
        if (!$f) {
            die('Error: Unable to open ' . $fontfile);
        }
        $file = fread($f, filesize($fontfile));
        fclose($f);
        if ($type == 'Type1') {
            //Find first two sections and discard third one
            $header = ord($file[0]) == 128;
            if ($header) {
                //Strip first binary header
                $file = substr($file, 6);
            }
            $pos = strpos($file, 'eexec');
            if (!$pos) {
                die('Error: font file does not seem to be valid Type1');
            }
            $size1 = $pos + 6;
            if ($header and ord($file[$size1]) == 128) {
                //Strip second binary header
                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
            }
            $pos = strpos($file, '00000000');
            if (!$pos) {
                die('Error: font file does not seem to be valid Type1');
            }
            $size2 = $pos - $size1;
            $file = substr($file, 0, $size1 + $size2);
        }
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($file), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
            print "Font file compressed (" . $cmp . ")\n";
            if (!empty($cidtogidmap)) {
                $cmp = $basename . '.ctg.z';
                SaveToFile($cmp, gzcompress($cidtogidmap), 'b');
                print "CIDToGIDMap created and compressed (" . $cmp . ")\n";
                $s .= '$ctg=\'' . $cmp . "';\n";
            }
        } else {
            $s .= '$file=\'' . basename($fontfile) . "';\n";
            print "Notice: font file could not be compressed (zlib extension not available)\n";
            if (!empty($cidtogidmap)) {
                $cmp = $basename . '.ctg';
                $f = fopen($cmp, 'wb');
                fwrite($f, $cidtogidmap);
                fclose($f);
                print "CIDToGIDMap created (" . $cmp . ")\n";
                $s .= '$ctg=\'' . $cmp . "';\n";
            }
        }
        if ($type == 'Type1') {
            $s .= '$size1=' . $size1 . ";\n";
            $s .= '$size2=' . $size2 . ";\n";
        } else {
            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
        }
    } else {
        //Not embedded font
        $s .= '$file=' . "'';\n";
    }
    $s .= "?>";
    SaveToFile($basename . '.php', $s);
    print "Font definition file generated (" . $basename . ".php)\n";
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:makefont.php

示例4: MakeFont

function MakeFont($fontfile, $ufmfile)
{
    //Generate a font definition file
    set_magic_quotes_runtime(0);
    if (!file_exists($ufmfile)) {
        die('<B>Error:</B> UFM file not found: ' . $ufmfile);
    }
    $cidtogidmap = '';
    $fm = ReadUFM($ufmfile, $cidtogidmap);
    $fd = MakeFontDescriptor($fm);
    //Find font type
    if ($fontfile) {
        $ext = strtolower(substr($fontfile, -3));
        if ($ext == 'ttf') {
            $type = 'TrueTypeUnicode';
        } else {
            die('<B>Error:</B> not a truetype font: ' . $ext);
        }
    } else {
        if ($type != 'TrueTypeUnicode') {
            die('<B>Error:</B> incorrect font type: ' . $type);
        }
    }
    //Start generation
    $basename = strtolower(substr(basename($ufmfile), 0, -4));
    $s = 'TCPDFFontDescriptor.define(\'' . $basename . "') do |font|\n";
    $s .= "  font[:type]='" . $type . "'\n";
    $s .= "  font[:name]='" . $fm['FontName'] . "'\n";
    $s .= "  font[:desc]=" . $fd . "\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= "  font[:up]=" . $fm['UnderlinePosition'] . "\n";
    $s .= "  font[:ut]=" . $fm['UnderlineThickness'] . "\n";
    $s .= "  font[:cw]=" . MakeWidthArray($fm) . "\n";
    $s .= "  font[:enc]=''\n";
    $s .= "  font[:diff]=''\n";
    if ($fontfile) {
        //Embedded font
        if (!file_exists($fontfile)) {
            die('<B>Error:</B> font file not found: ' . $fontfile);
        }
        CheckTTF($fontfile);
        $f = fopen($fontfile, 'rb');
        if (!$f) {
            die('<B>Error:</B> Can\'t open ' . $fontfile);
        }
        $file = fread($f, filesize($fontfile));
        fclose($f);
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($file), 'b');
            $s .= '  font[:file]=\'' . $cmp . "'\n";
            echo 'Font file compressed (' . $cmp . ')<BR>';
            $cmp = $basename . '.ctg.z';
            SaveToFile($cmp, gzcompress($cidtogidmap), 'b');
            echo 'CIDToGIDMap created and compressed (' . $cmp . ')<BR>';
            $s .= '  font[:ctg]=\'' . $cmp . "'\n";
        } else {
            $s .= '$file=\'' . basename($fontfile) . "'\n";
            echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>';
            $cmp = $basename . '.ctg';
            $f = fopen($cmp, 'wb');
            fwrite($f, $cidtogidmap);
            fclose($f);
            echo 'CIDToGIDMap created (' . $cmp . ')<BR>';
            $s .= '  font[:ctg]=\'' . $cmp . "'\n";
        }
        if ($type == 'Type1') {
            $s .= '  font[:size1]=' . $size1 . "\n";
            $s .= '  font[:size2]=' . $size2 . "\n";
        } else {
            $s .= '  font[:originalsize]=' . filesize($fontfile) . "\n";
        }
    } else {
        //Not embedded font
        $s .= '  font[:file]=' . "''\n";
    }
    $s .= "end\n";
    SaveToFile($basename . '.rb', $s);
    echo 'Font definition file generated (' . $basename . '.rb' . ')<BR>';
}
开发者ID:ravalmj,项目名称:openproject,代码行数:85,代码来源:makefontuni_ruby.php

示例5: MakeFont

function MakeFont($fontfile, $enc = 'cp1252', $embed = true)
{
    // Generate a font definition file
    if (get_magic_quotes_runtime()) {
        @set_magic_quotes_runtime(0);
    }
    ini_set('auto_detect_line_endings', '1');
    if (!file_exists($fontfile)) {
        Error('Font file not found: ' . $fontfile);
    }
    $ext = strtolower(substr($fontfile, -3));
    if ($ext == 'ttf' || $ext == 'otf') {
        $type = 'TrueType';
    } elseif ($ext == 'pfb') {
        $type = 'Type1';
    } else {
        Error('Unrecognized font file extension: ' . $ext);
    }
    $map = LoadMap($enc);
    if ($type == 'TrueType') {
        $info = GetInfoFromTrueType($fontfile, $embed, $map);
    } else {
        $info = GetInfoFromType1($fontfile, $embed, $map);
    }
    $basename = substr(basename($fontfile), 0, -4);
    if ($embed) {
        if (function_exists('gzcompress')) {
            $file = $basename . '.z';
            SaveToFile($file, gzcompress($info['Data']), 'b');
            $info['File'] = $file;
            Message('Font file compressed: ' . $file);
        } else {
            $info['File'] = basename($fontfile);
            Notice('Font file could not be compressed (zlib extension not available)');
        }
    }
    MakeDefinitionFile($basename . '.php', $type, $enc, $embed, $map, $info);
    Message('Font definition file generated: ' . $basename . '.php');
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:39,代码来源:makefont.php

示例6: saveArrayToFile

 /**
  * @return void
  * @param string $filename 文件名
  * @param array $inputArray 要输出的数组
  * @desc 将数组输出到文件中
  */
 function saveArrayToFile($filename, $inputArray)
 {
     $str = var_export($inputArray);
     SaveToFile($filename, $str, 'w');
 }
开发者ID:uwitec,项目名称:outbuying,代码行数:11,代码来源:Base.php

示例7: saveTranslated

function saveTranslated($out)
{
    SaveToFile("/home/www/cb3/temp/translated.txt", $out);
}
开发者ID:laiello,项目名称:cartonbank,代码行数:4,代码来源:index.php

示例8: MakeFont

function MakeFont($fontfile, $afmfile, $destdir, $destfile, $enc)
{
    // Generate a font definition file
    set_magic_quotes_runtime(0);
    ini_set('auto_detect_line_endings', '1');
    $manager = ManagerEncoding::get();
    $map = $manager->get_encoding_glyphs($enc);
    $fm = ReadAFM($afmfile, $map);
    if (is_null($fm)) {
        error_log(sprintf("Notice: Missing AFM file '%s'; attempting to parse font file '%s' directly", $afmfile, $fontfile));
        $fm = ReadTTF($fontfile, $manager->getEncodingVector($enc));
        if (is_null($fm)) {
            die(sprintf("Cannot get font metrics for '%s'", $fontfile));
        }
    }
    $diff = MakeFontEncoding($map);
    $cmap = MakeFontCMap($enc);
    $fd = MakeFontDescriptor($fm, empty($map));
    //Find font type
    if ($fontfile) {
        $ext = strtolower(substr($fontfile, -3));
        if ($ext == 'ttf') {
            $type = 'TrueType';
        } elseif ($ext == 'pfb') {
            $type = 'Type1';
        } else {
            die('<B>Error:</B> unrecognized font file extension: ' . $ext);
        }
    } else {
        if ($type != 'TrueType' and $type != 'Type1') {
            die('<B>Error:</B> incorrect font type: ' . $type);
        }
    }
    //Start generation
    $s = '<?php' . "\n";
    $s .= '$type=\'' . $type . "';\n";
    $s .= '$name=\'' . $fm['FontName'] . "';\n";
    $s .= '$desc=' . $fd . ";\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
    $w = MakeWidthArray($fm);
    $s .= '$cw=' . $w . ";\n";
    $s .= '$enc=\'' . $enc . "';\n";
    $s .= '$diff=\'' . $diff . "';\n";
    $s .= '$cmap=' . $cmap . ";\n";
    $basename = substr(basename($afmfile), 0, -4);
    if ($fontfile) {
        //Embedded font
        if (!file_exists($fontfile)) {
            die('<B>Error:</B> font file not found: ' . $fontfile);
        }
        if ($type == 'TrueType') {
            CheckTTF($fontfile);
        }
        $f = fopen($fontfile, 'rb');
        if (!$f) {
            die('<B>Error:</B> Can\'t open ' . $fontfile);
        }
        $file = fread($f, filesize($fontfile));
        fclose($f);
        if ($type == 'Type1') {
            //Find first two sections and discard third one
            $header = ord($file[0]) == 128;
            if ($header) {
                //Strip first binary header
                $file = substr($file, 6);
            }
            $pos = strpos($file, 'eexec');
            if (!$pos) {
                die('<B>Error:</B> font file does not seem to be valid Type1');
            }
            $size1 = $pos + 6;
            if ($header and ord($file[$size1]) == 128) {
                //Strip second binary header
                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
            }
            $pos = strpos($file, '00000000');
            if (!$pos) {
                die('<B>Error:</B> font file does not seem to be valid Type1');
            }
            $size2 = $pos - $size1;
            $file = substr($file, 0, $size1 + $size2);
        }
        $gzcompress_exists = function_exists('gzcompress');
        if ($gzcompress_exists) {
            $cmp = $basename . '.z';
            SaveToFile($destdir . $cmp, gzcompress($file), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
        } else {
            $cmp = $basename . '.ttf';
            SaveToFile($destdir . $cmp, $file, 'b');
            $s .= '$file=\'' . basename($fontfile) . "';\n";
            error_log('Notice: font file could not be compressed (zlib extension not available)');
        }
//.........这里部分代码省略.........
开发者ID:isantiago,项目名称:foswiki,代码行数:101,代码来源:pdf.fpdf.makefont.php

示例9: MakeFont


//.........这里部分代码省略.........
            die('Error: Unable to open ' . $fontfile);
        }
        $file = stream_get_contents($f);
        fclose($f);
        if ($type == 'Type1') {
            //Find first two sections and discard third one
            $header = ord($file[0]) == 128;
            if ($header) {
                //Strip first binary header
                $file = substr($file, 6);
            }
            $pos = strpos($file, 'eexec');
            if (!$pos) {
                die('Error: font file does not seem to be valid Type1');
            }
            $size1 = $pos + 6;
            if ($header and ord($file[$size1]) == 128) {
                //Strip second binary header
                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
            }
            $pos = strpos($file, '00000000');
            if (!$pos) {
                die('Error: font file does not seem to be valid Type1');
            }
            $size2 = $pos - $size1;
            $file = substr($file, 0, $size1 + $size2);
        }
        $basename = strtolower($basename);
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            // BEGIN SUGARCRM SPECIFIC
            /*
            			// END SUGARCRM SPECIFIC
            			SaveToFile($cmp, gzcompress($file, 9), 'b');
            			// BEGIN SUGARCRM SPECIFIC
            */
            SaveToFile($dirname . "/" . $cmp, gzcompress($file, 9), 'b');
            // END SUGARCRM SPECIFIC
            $s .= '$file=\'' . $cmp . "';\n";
            print "Font file compressed (" . $cmp . ")\n";
            if (!empty($cidtogidmap)) {
                $cmp = $basename . '.ctg.z';
                // BEGIN SUGARCRM SPECIFIC
                /*
                // END SUGARCRM SPECIFIC
                				SaveToFile($cmp, gzcompress($cidtogidmap, 9), 'b');
                // BEGIN SUGARCRM SPECIFIC
                */
                SaveToFile($dirname . "/" . $cmp, gzcompress($cidtogidmap, 9), 'b');
                // END SUGARCRM SPECIFIC
                print "CIDToGIDMap created and compressed (" . $cmp . ")\n";
                $s .= '$ctg=\'' . $cmp . "';\n";
            }
        } else {
            $s .= '$file=\'' . basename($fontfile) . "';\n";
            print "Notice: font file could not be compressed (zlib extension not available)\n";
            if (!empty($cidtogidmap)) {
                $cmp = $basename . '.ctg';
                // BEGIN SUGARCRM SPECIFIC
                /*
                // END SUGARCRM SPECIFIC
                				$f = fopen($cmp, 'wb');
                // BEGIN SUGARCRM SPECIFIC
                */
                $f = fopen($dirname . "/" . $cmp, 'wb');
                // END SUGARCRM SPECIFIC
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:67,代码来源:makefont.php

示例10: MakeFontTTF

function MakeFontTTF($fontfile, $ufmfile)
{
    //Generate a font definition file
    if (ini_get("magic_quotes_runtime")) {
        set_magic_quotes_runtime(0);
    }
    if (!file_exists($ufmfile)) {
        die('<B>Error:</B> UFM file not found: ' . $ufmfile);
    }
    $cidtogidmap = '';
    $fm = ReadUFM($ufmfile, $cidtogidmap);
    $fd = MakeFontDescriptorTTF($fm);
    //Find font type
    if ($fontfile) {
        $ext = strtolower(substr($fontfile, -3));
        if ($ext == 'ttf') {
            $type = 'TrueTypeUnicode';
        } else {
            die('<B>Error:</B> not a truetype font: ' . $ext);
        }
    } else {
        if ($type != 'TrueTypeUnicode') {
            die('<B>Error:</B> incorrect font type: ' . $type);
        }
    }
    //Start generation
    $s = '<?php' . "\n";
    $s .= '$type=\'' . $type . "';\n";
    $s .= '$name=\'' . $fm['FontName'] . "';\n";
    $s .= '$desc=' . $fd . ";\n";
    if (!isset($fm['UnderlinePosition'])) {
        $fm['UnderlinePosition'] = -100;
    }
    if (!isset($fm['UnderlineThickness'])) {
        $fm['UnderlineThickness'] = 50;
    }
    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
    $w = MakeWidthArrayTTF($fm);
    $s .= '$cw=' . $w . ";\n";
    $s .= "\$enc='';\n";
    $s .= "\$diff='';\n";
    $basename = substr(basename($ufmfile), 0, -4);
    if ($fontfile) {
        //Embedded font
        if (!file_exists($fontfile)) {
            die('<B>Error:</B> font file not found: ' . $fontfile);
        }
        CheckTTF($fontfile);
        $f = fopen($fontfile, 'rb');
        if (!$f) {
            die('<B>Error:</B> Can\'t open ' . $fontfile);
        }
        $file = fread($f, filesize($fontfile));
        fclose($f);
        if (function_exists('gzcompress')) {
            $cmp = $basename . '.z';
            SaveToFile($cmp, gzcompress($file), 'b');
            $s .= '$file=\'' . $cmp . "';\n";
            // echo 'Font file compressed ('.$cmp.')<BR>';
            $cmp = $basename . '.ctg.z';
            SaveToFile($cmp, gzcompress($cidtogidmap), 'b');
            //echo 'CIDToGIDMap created and compressed ('.$cmp.')<BR>';
            $s .= '$ctg=\'' . $cmp . "';\n";
        } else {
            $s .= '$file=\'' . basename($fontfile) . "';\n";
            echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>';
            $cmp = $basename . '.ctg';
            $f = fopen($cmp, 'wb');
            fwrite($f, $cidtogidmap);
            fclose($f);
            echo 'CIDToGIDMap created (' . $cmp . ')<BR>';
            $s .= '$ctg=\'' . $cmp . "';\n";
        }
        if ($type == 'Type1') {
            $s .= '$size1=' . $size1 . ";\n";
            $s .= '$size2=' . $size2 . ";\n";
        } else {
            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
        }
    } else {
        //Not embedded font
        $s .= '$file=' . "'';\n";
    }
    $s .= "?>\n";
    SaveToFile($basename . '.php', $s);
    // echo 'Font definition file generated ('.$basename.'.php'.')<BR>';
    return true;
}
开发者ID:shailendra999,项目名称:hr_admin,代码行数:89,代码来源:makefonts.php

示例11: RecountDBStructure

 /**
  * Метод выполняет перерасчет стркутуры базы данных хранящейся в конфигурации сайта на основании структур
  * таблиц различных модулей, при этом происходит сохранение сгенерированной структуры.
  */
 function RecountDBStructure()
 {
     if ($arModules = $this->GetList(false, array('active' => 1))) {
         $arResultStructure = array();
         foreach ($arModules as $arModule) {
             if (file_exists(KS_MODULES_DIR . '/' . $arModule['title'] . '/install/db/db_structure.php')) {
                 include KS_MODULES_DIR . '/' . $arModule['title'] . '/install/db/db_structure.php';
                 $arResultStructure = array_merge($arResultStructure, $arStructure);
             }
         }
         if (file_exists(KS_MODULES_DIR . '/koloslib/install/db/db_structure.php')) {
             include KS_MODULES_DIR . '/koloslib/install/db/db_structure.php';
             $arResultStructure = array_merge($arResultStructure, $arStructure);
         }
         SaveToFile(KS_MODULES_DIR . '/koloslib/cache/db_structure.php', '$arStructure', $arResultStructure);
     }
 }
开发者ID:ASDAFF,项目名称:bitrix-koloslib,代码行数:21,代码来源:class.CKSModules.php

示例12: tabelarycznyAction

 /**
  * Akcja dla	:http://raport/tabelaryczny
  * i			:http://raport/tabelaryczny/ankieta/#id
  */
 public function tabelarycznyAction($excel = 0, $id_ankieta = 0)
 {
     $poll = new Ankiety();
     $db = $poll->getAdapter();
     if (!$excel) {
         $post = new Zend_Filter_Input($_POST);
         $pollId = $this->_getParam('ankieta');
         if (empty($pollId)) {
             $pollId = $post->getInt('ankieta_id');
         }
     } else {
         $pollId = $id_ankieta;
     }
     /*
     $pytanie=false;
     $queId=$this->_getParam('pytanie');
     if  (empty($queId)) $queId = $post->getInt('pytanie_id');
     if (!empty($queId)) {$this->view->queId=$queId; $pytanie=true;}
     */
     $this->view->pollId = $pollId;
     $this->view->pool = $poll->find($pollId);
     $question = new Pytania();
     $this->view->questions = $question->findAllWithAnkietaId($pollId);
     $this->view->qV = array('jednokrotne' => 0, 'wielokrotne' => 1, 'otwarte' => 2);
     $rap = new Raporty();
     $this->view->info = $rap->FindInformationsAboutAnkietaId($pollId);
     $this->view->fill = $rap->AmountOfFilledId($pollId);
     $this->view->ques = $rap->AmountOfQuestionsId($pollId);
     $this->view->body = $this->view->render('/raport/raportTabelaryczny.php');
     /*if ($pytanie) { 
      		$this->view->queInfo=$rap->InfoAboutQuestionId($queId);
      		if ($this->view->queInfo["nazwa_typu"]!='otwarte') {
      			$this->view->ansInfo=$rap->InfoAboutAnswersId($queId);
      			$this->view->body.=$this->view->render('/raport/PytZamkniete.php');
      		} else {
      			$this->view->ansInfo=$rap->AnswersOpened($queId);
      			$this->view->body.=$this->view->render('/raport/PytOtwarte.php');
      		}
      			
      	}
      	*/
     foreach ($this->view->questions as $row) {
         $queId = $row->idPytanie;
         $this->view->queInfo = $rap->InfoAboutQuestionId($queId);
         if ($this->view->queInfo["nazwa_typu"] != 'otwarte') {
             $this->view->ansInfo = $rap->InfoAboutAnswersId($queId);
             $ilResp = $rap->AmountOfRespondentsWhoAnsweredId($queId);
             $this->view->ilResp = $ilResp["ilresp"];
             $this->view->body .= $this->view->render('/raport/PytZamkniete.php');
         } else {
             $this->view->ansInfo = $rap->AnswersOpened($queId);
             $this->view->queId = $queId;
             $this->view->excel = $excel;
             $this->view->limit = 2;
             //tu decydujemy ile ma sie wyswietalc odpowiedzi otwartych
             $this->view->body .= $this->view->render('/raport/PytOtwarte.php');
             SaveToFile("/documents/raporty/OA_{$queId}.txt", $this->view->ansInfo);
         }
     }
     if (!$excel) {
         $this->display();
     } else {
         return $this->view->body;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phppool,代码行数:69,代码来源:RaportController.php


注:本文中的SaveToFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。