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


PHP jFile::write方法代码示例

本文整理汇总了PHP中jFile::write方法的典型用法代码示例。如果您正苦于以下问题:PHP jFile::write方法的具体用法?PHP jFile::write怎么用?PHP jFile::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jFile的用法示例。


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

示例1: compile

 /**
  * compile the given class id.
  */
 public function compile($selector)
 {
     jDaoCompiler::$daoId = $selector->toString();
     jDaoCompiler::$daoPath = $selector->getPath();
     jDaoCompiler::$dbType = $selector->driver;
     // chargement du fichier XML
     $doc = new DOMDocument();
     if (!$doc->load(jDaoCompiler::$daoPath)) {
         throw new jException('jelix~daoxml.file.unknow', jDaoCompiler::$daoPath);
     }
     if ($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE . 'dao/1.0') {
         throw new jException('jelix~daoxml.namespace.wrong', array(jDaoCompiler::$daoPath, $doc->namespaceURI));
     }
     $parser = new jDaoParser();
     $parser->parse(simplexml_import_dom($doc));
     global $gJConfig;
     if (!isset($gJConfig->_pluginsPathList_db[$selector->driver]) || !file_exists($gJConfig->_pluginsPathList_db[$selector->driver])) {
         throw new jException('jelix~db.error.driver.notfound', $selector->driver);
     }
     require_once $gJConfig->_pluginsPathList_db[$selector->driver] . $selector->driver . '.daobuilder.php';
     $class = $selector->driver . 'DaoBuilder';
     $generator = new $class($selector->getDaoClass(), $selector->getDaoRecordClass(), $parser);
     // génération des classes PHP correspondant à la définition de la DAO
     $compiled = '<?php ' . $generator->buildClasses() . "\n?>";
     jFile::write($selector->getCompiledFilePath(), $compiled);
     return true;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:30,代码来源:jDaoCompiler.class.php

示例2: compile

 public function compile($selector)
 {
     global $gJCoord;
     global $gJConfig;
     $sel = clone $selector;
     $this->sourceFile = $selector->getPath();
     // chargement du fichier XML
     $doc = new DOMDocument();
     if (!$doc->load($this->sourceFile)) {
         throw new jException('jelix~formserr.invalid.xml.file', array($this->sourceFile));
     }
     if ($doc->documentElement->namespaceURI == JELIX_NAMESPACE_BASE . 'forms/1.0') {
         require_once JELIX_LIB_PATH . 'forms/jFormsCompiler_jf_1_0.class.php';
         $compiler = new jFormsCompiler_jf_1_0($this->sourceFile);
     } elseif ($doc->documentElement->namespaceURI == JELIX_NAMESPACE_BASE . 'forms/1.1') {
         if ($doc->documentElement->localName != 'form') {
             throw new jException('jelix~formserr.bad.root.tag', array($doc->documentElement->localName, $this->sourceFile));
         }
         require_once JELIX_LIB_PATH . 'forms/jFormsCompiler_jf_1_1.class.php';
         $compiler = new jFormsCompiler_jf_1_1($this->sourceFile);
     } else {
         throw new jException('jelix~formserr.namespace.wrong', array($this->sourceFile));
     }
     $source = array();
     $source[] = '<?php ';
     $source[] = 'class ' . $selector->getClass() . ' extends jFormsBase {';
     $source[] = ' public function __construct($sel, &$container, $reset = false){';
     $source[] = '          parent::__construct($sel, $container, $reset);';
     $compiler->compile($doc, $source);
     $source[] = "  }\n} ?>";
     jFile::write($selector->getCompiledFilePath(), implode("\n", $source));
     return true;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:33,代码来源:jFormsCompiler.class.php

示例3: compile

 public function compile($selector)
 {
     $sel = clone $selector;
     $this->sourceFile = $selector->getPath();
     // load XML file
     $doc = new DOMDocument();
     if (!$doc->load($this->sourceFile)) {
         throw new jException('jelix~formserr.invalid.xml.file', array($this->sourceFile));
     }
     if ($doc->documentElement->namespaceURI == JELIX_NAMESPACE_BASE . 'forms/1.0') {
         require_once JELIX_LIB_PATH . 'forms/jFormsCompiler_jf_1_0.class.php';
         $compiler = new jFormsCompiler_jf_1_0($this->sourceFile);
     } elseif ($doc->documentElement->namespaceURI == JELIX_NAMESPACE_BASE . 'forms/1.1') {
         if ($doc->documentElement->localName != 'form') {
             throw new jException('jelix~formserr.bad.root.tag', array($doc->documentElement->localName, $this->sourceFile));
         }
         require_once JELIX_LIB_PATH . 'forms/jFormsCompiler_jf_1_1.class.php';
         $compiler = new jFormsCompiler_jf_1_1($this->sourceFile);
     } else {
         throw new jException('jelix~formserr.namespace.wrong', array($this->sourceFile));
     }
     $source = array();
     $source[] = "<?php \nif (jApp::config()->compilation['checkCacheFiletime'] &&\n";
     $source[] .= "filemtime('" . $this->sourceFile . '\') > ' . filemtime($this->sourceFile) . "){ return false;\n}else{\n";
     $source[] = 'class ' . $selector->getClass() . ' extends jFormsBase {';
     $source[] = ' public function __construct($sel, &$container, $reset = false){';
     $source[] = '          parent::__construct($sel, $container, $reset);';
     $compiler->compile($doc, $source);
     $source[] = "  }\n}\n return true;}";
     jFile::write($selector->getCompiledFilePath(), implode("\n", $source));
     return true;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:32,代码来源:jFormsCompiler.class.php

示例4: compile

 /**
  * Launch the compilation of a template
  *
  * Store the result (a php content) into a cache file given by the selector.
  * @param jSelectorTpl $selector the template selector
  * @return boolean true if ok
  */
 public function compile($selector)
 {
     $this->_sourceFile = $selector->getPath();
     $cachefile = $selector->getCompiledFilePath();
     $this->outputType = $selector->outputType;
     $this->trusted = $selector->trusted;
     $this->_modifier = array_merge($this->_modifier, $selector->userModifiers);
     $this->_userFunctions = $selector->userFunctions;
     jContext::push($selector->module);
     if (!file_exists($this->_sourceFile)) {
         $this->doError0('errors.tpl.not.found');
     }
     $result = $this->compileContent(file_get_contents($this->_sourceFile));
     $header = "<?php \n";
     foreach ($this->_pluginPath as $path => $ok) {
         $header .= ' require_once(\'' . $path . "');\n";
     }
     $header .= 'function template_meta_' . md5($selector->module . '_' . $selector->resource . '_' . $this->outputType . ($this->trusted ? '_t' : '')) . '($t){';
     $header .= "\n" . $this->_metaBody . "\n}\n";
     $header .= 'function template_' . md5($selector->module . '_' . $selector->resource . '_' . $this->outputType . ($this->trusted ? '_t' : '')) . '($t){' . "\n?>";
     $result = $header . $result . "<?php \n}\n?>";
     jFile::write($cachefile, $result);
     jContext::pop();
     return true;
 }
开发者ID:Calmacil,项目名称:ffdvh,代码行数:32,代码来源:jTplCompiler.class.php

示例5: compileString

 public function compileString($templatecontent, $cachefile, $userModifiers, $userFunctions, $md5)
 {
     $this->_modifier = array_merge($this->_modifier, $userModifiers);
     $this->_userFunctions = $userFunctions;
     $result = $this->compileContent($templatecontent);
     $header = "<?php \n";
     foreach ($this->_pluginPath as $path => $ok) {
         $header .= ' require_once(\'' . $path . "');\n";
     }
     $header .= 'function template_meta_' . $md5 . '($t){';
     $header .= "\n" . $this->_metaBody . "\n}\n";
     $header .= 'function template_' . $md5 . '($t){' . "\n?>";
     $result = $header . $result . "<?php \n}\n?>";
     jFile::write($cachefile, $result);
     return true;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:16,代码来源:jTplCompiler.class.php

示例6: output

    function output()
    {
        if ($this->_outputOnlyHeaders) {
            $this->sendHttpHeaders();
            return true;
        }
        $this->_commonProcess();
        if (count($this->_commands) <= 0) {
            $this->addDefaultCommands();
        }
        $data = join("\n", $this->_commands) . '
\\begin{document}
\\title{' . $this->title . '}
\\author{';
        foreach ($this->authors as $a) {
            $data .= $a . '\\\\' . "\n";
        }
        $data .= '}
\\date{' . $this->date . '}
';
        $data .= $this->body->fetch($this->bodyTpl);
        $data .= '

\\end{document}';
        $fbase = 'cache-' . md5($data);
        $texFile = $this->cachePath . $fbase . '.tex';
        $pdfFile = $this->cachePath . $fbase . '.pdf';
        if (!file_exists($pdfFile)) {
            jFile::write($texFile, $data);
            $output = array();
            $retVal = 1;
            exec($this->pdflatexPath . ' --interaction batchmode --output-directory ' . $this->cachePath . ' ' . $texFile, $output, $retval);
            if ($retVal != 0) {
                $outputStr = implode('<br />', $output);
                throw new jException('jelix~errors.ltx2pdf.exec', array($this->pdflatexPath, $outputStr));
            }
        }
        $this->_httpHeaders['Content-Type'] = 'application/pdf';
        $this->_httpHeaders['Content-length'] = @filesize($pdfFile);
        $this->_httpHeaders['Content-Disposition'] = 'attachment; filename=' . $this->outputFileName;
        $this->sendHttpHeaders();
        readfile($pdfFile);
        return true;
    }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:44,代码来源:jResponseLatexToPdf.class.php

示例7: compile

 /**
  * compile the given class id.
  * @param jSelectorDao $selector
  */
 public function compile($selector)
 {
     $daoPath = $selector->getPath();
     // load the XML file
     $doc = new DOMDocument();
     if (!$doc->load($daoPath)) {
         throw new jException('jelix~daoxml.file.unknown', $daoPath);
     }
     if ($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE . 'dao/1.0') {
         throw new jException('jelix~daoxml.namespace.wrong', array($daoPath, $doc->namespaceURI));
     }
     $tools = jApp::loadPlugin($selector->driver, 'db', '.dbtools.php', $selector->driver . 'DbTools');
     if (is_null($tools)) {
         throw new jException('jelix~db.error.driver.notfound', $selector->driver);
     }
     $parser = new jDaoParser($selector);
     $parser->parse(simplexml_import_dom($doc), $tools);
     $class = $selector->dbType . 'DaoBuilder';
     if (!jApp::includePlugin($selector->dbType, 'daobuilder', '.daobuilder.php', $class)) {
         throw new jException('jelix~dao.error.builder.notfound', $selector->dbType);
     }
     $generator = new $class($selector, $tools, $parser);
     // generation of PHP classes corresponding to the DAO definition
     $compiled = '<?php ';
     $compiled .= "\nif (jApp::config()->compilation['checkCacheFiletime']&&(\n";
     $compiled .= "\n filemtime('" . $daoPath . '\') > ' . filemtime($daoPath);
     $importedDao = $parser->getImportedDao();
     if ($importedDao) {
         foreach ($importedDao as $selimpdao) {
             $path = $selimpdao->getPath();
             $compiled .= "\n|| filemtime('" . $path . '\') > ' . filemtime($path);
         }
     }
     $compiled .= ")){ return false;\n}\nelse {\n";
     $compiled .= $generator->buildClasses() . "\n return true; }";
     jFile::write($selector->getCompiledFilePath(), $compiled);
     return true;
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:42,代码来源:jDaoCompiler.class.php

示例8: endCompile

 public function endCompile($cachefile)
 {
     $content = '<?php $GLOBALS["JELIX_EVENTS"] = ' . var_export($this->eventList, true) . ";\n?>";
     jFile::write($cachefile, $content);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:5,代码来源:jEventCompiler.class.php

示例9: copyMail

 protected function copyMail($header, $body)
 {
     $dir = rtrim($this->filePath, '/') . '/copy-' . date('Ymd') . '/';
     if (isset(jApp::coord()->request)) {
         $ip = jApp::coord()->request->getIP();
     } else {
         $ip = "no-ip";
     }
     $filename = $dir . 'mail-' . $ip . '-' . date('Ymd-His') . '-' . uniqid(mt_rand(), true);
     jFile::write($filename, $header . $body);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:11,代码来源:jMailer.class.php

示例10: _updateWSDL

 /**
  * Update the WSDL cache file
  */
 private function _updateWSDL()
 {
     static $updated = FALSE;
     if ($updated) {
         return;
     }
     $mustCompile = jApp::config()->compilation['force'] || !file_exists($this->_cachePath);
     if (jApp::config()->compilation['checkCacheFiletime'] && !$mustCompile) {
         if (filemtime($this->_ctrlpath) > filemtime($this->_cachePath)) {
             $mustCompile = true;
         }
     }
     if ($mustCompile) {
         jFile::write($this->_cachePath, $this->_compile());
     }
     $updated = TRUE;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:20,代码来源:jWSDL.php

示例11: compile


//.........这里部分代码省略.........
             $u->module = (string) $url['module'];
             if (isset($url['https'])) {
                 $u->isHttps = (string) $url['https'] == 'true';
             }
             if (isset($url['noentrypoint']) && (string) $url['noentrypoint'] == 'true') {
                 $u->entryPointUrl = '';
             }
             if (isset($url['include'])) {
                 $this->readInclude($url, $u);
                 continue;
             }
             // in the case of a non default entry point, if there is just an
             // <url module="" />, so all actions of this module will be assigned
             // to this entry point.
             if (!$u->isDefault && !isset($url['action']) && !isset($url['handler'])) {
                 $this->parseInfos[] = array($u->module, '', '/.*/', array(), array(), array(), false, $this->checkHttps && $u->isHttps);
                 $createUrlInfosDedicatedModules[$u->getFullSel()] = array(3, $u->entryPointUrl, $u->isHttps, true);
                 continue;
             }
             $u->action = (string) $url['action'];
             if (strpos($u->action, ':') === false) {
                 $u->action = 'default:' . $u->action;
             }
             if (isset($url['actionoverride'])) {
                 $u->actionOverride = preg_split("/[\\s,]+/", (string) $url['actionoverride']);
                 foreach ($u->actionOverride as &$each) {
                     if (strpos($each, ':') === false) {
                         $each = 'default:' . $each;
                     }
                 }
             }
             // if there is an indicated handler, so, for the given module
             // (and optional action), we should call the given handler to
             // parse or create an url
             if (isset($url['handler'])) {
                 $this->newHandler($u, $url);
                 continue;
             }
             // parse dynamic parameters
             if (isset($url['pathinfo'])) {
                 $path = (string) $url['pathinfo'];
                 $regexppath = $this->extractDynamicParams($url, $path, $u);
             } else {
                 $regexppath = '.*';
                 $path = '';
             }
             $tempOptionalTrailingSlash = $optionalTrailingSlash;
             if (isset($url['optionalTrailingSlash'])) {
                 $tempOptionalTrailingSlash = $url['optionalTrailingSlash'] == 'true';
             }
             if ($tempOptionalTrailingSlash) {
                 if (substr($regexppath, -1) == '/') {
                     $regexppath .= '?';
                 } else {
                     $regexppath .= '\\/?';
                 }
             }
             // parse static parameters
             foreach ($url->static as $var) {
                 $t = "";
                 if (isset($var['type'])) {
                     switch ((string) $var['type']) {
                         case 'lang':
                             $t = '$l';
                             break;
                         case 'locale':
                             $t = '$L';
                             break;
                         default:
                             throw new Exception('urls definition: invalid type on a <static> element');
                     }
                 }
                 $u->statics[(string) $var['name']] = $t . (string) $var['value'];
             }
             $this->parseInfos[] = array($u->module, $u->action, '!^' . $regexppath . '$!', $u->params, $u->escapes, $u->statics, $u->actionOverride, $this->checkHttps && $u->isHttps);
             $this->appendUrlInfo($u, $path, false);
             if ($u->actionOverride) {
                 foreach ($u->actionOverride as $ao) {
                     $u->action = $ao;
                     $this->appendUrlInfo($u, $path, true);
                 }
             }
         }
         $c = count($createUrlInfosDedicatedModules);
         foreach ($createUrlInfosDedicatedModules as $k => $inf) {
             if ($c > 1) {
                 $inf[3] = false;
             }
             $this->createUrlInfos[$k] = $inf;
         }
         $parseContent .= '$GLOBALS[\'SIGNIFICANT_PARSEURL\'][\'' . rawurlencode($this->defaultUrl->entryPoint) . '\'] = ' . var_export($this->parseInfos, true) . ";\n?>";
         jFile::write(jApp::tempPath('compiled/urlsig/' . $aSelector->file . '.' . rawurlencode($this->defaultUrl->entryPoint) . '.entrypoint.php'), $parseContent);
     }
     $this->createUrlContent .= ")) { return false; } else {\n";
     $this->createUrlContent .= $this->createUrlContentInc;
     $this->createUrlContent .= '$GLOBALS[\'SIGNIFICANT_CREATEURL\'] =' . var_export($this->createUrlInfos, true) . ";\nreturn true;";
     $this->createUrlContent .= "\n}\n";
     jFile::write(jApp::tempPath('compiled/urlsig/' . $aSelector->file . '.creationinfos_15.php'), $this->createUrlContent);
     return true;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:101,代码来源:jSignificantUrlsCompiler.class.php

示例12: getContent

 /**
  * get the zone content
  * Return the cache content if it is activated and if it's exists, or call _createContent
  * @return string  zone content
  */
 public function getContent()
 {
     global $gJConfig;
     if ($this->_useCache && !$gJConfig->zones['disableCache']) {
         $f = $this->_getCacheFile();
         if (file_exists($f)) {
             if ($this->_cacheTimeout > 0) {
                 clearstatcache();
                 if (time() - filemtime($f) > $this->_cacheTimeout) {
                     // timeout : regenerate the cache
                     unlink($f);
                     $this->_cancelCache = false;
                     $content = $this->_createContent();
                     if (!$this->_cancelCache) {
                         jFile::write($f, $content);
                     }
                     return $content;
                 }
             }
             if ($this->_tplname != '') {
                 $this->_tpl = new jTpl();
                 $this->_tpl->assign($this->_params);
                 $this->_tpl->meta($this->_tplname, $this->_tplOuputType);
             }
             $content = file_get_contents($f);
         } else {
             $this->_cancelCache = false;
             $content = $this->_createContent();
             if (!$this->_cancelCache) {
                 jFile::write($f, $content);
             }
         }
     } else {
         $content = $this->_createContent();
     }
     return $content;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:42,代码来源:jZone.class.php

示例13: _loadLocales

 /**
  * Loads the resources for a given locale/charset.
  * @param string $locale     the locale
  * @param string $charset    the charset
  */
 protected function _loadLocales($locale, $charset)
 {
     $this->_loadedCharset[] = $charset;
     $source = $this->fic->getPath();
     $cache = $this->fic->getCompiledFilePath();
     // check if we have a compiled version of the ressources
     if (is_readable($cache)) {
         $okcompile = true;
         if (App::config()->compilation['force']) {
             $okcompile = false;
         } else {
             if (App::config()->compilation['checkCacheFiletime']) {
                 if (is_readable($source) && filemtime($source) > filemtime($cache)) {
                     $okcompile = false;
                 }
             }
         }
         if ($okcompile) {
             include $cache;
             $this->_strings[$charset] = $_loaded;
             return;
         }
     }
     $reader = new \jPropertiesFileReader($source, $charset);
     $reader->parse();
     $this->_strings[$charset] = $reader->getProperties();
     $content = '<?php $_loaded= ' . var_export($this->_strings[$charset], true) . ' ?>';
     \jFile::write($cache, $content);
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:34,代码来源:Bundle.php

示例14: output

    /**
     * output the pdf content
     *
     * @return boolean    true if the generated content is ok
     */
    function output()
    {
        $this->_commonProcess();
        if (count($this->_commands) <= 0) {
            //No commands, likewise we need some...
            $this->addDefaultCommands();
        }
        $data = join("\n", $this->_commands) . '
\\begin{document}
\\title{' . $this->title . '}
\\author{';
        foreach ($this->authors as $a) {
            $data .= $a . '\\\\' . "\n";
        }
        $data .= '}
\\date{\\today}
\\maketitle
';
        $data .= $this->body->fetch($this->bodyTpl);
        $data .= '

\\end{document}';
        $fbase = 'cache-' . md5($data);
        $texFile = $this->cachePath . $fbase . '.tex';
        $pdfFile = $this->cachePath . $fbase . '.pdf';
        if (!file_exists($pdfFile)) {
            // Naïve cache: we have an md5 on the content of the tex file. If the pdf
            // corresponding to this content already exists, just serve it.
            // No managment of cache deletion :o/
            jFile::write($texFile, $data);
            $output = array();
            $retVal = 1;
            exec('
            TEXMFOUTPUT=' . $this->cachePath . ' && export TEXMFOUTPUT && TEXINPUTS=:' . $this->cachePath . ' && export TEXINPUTS &&
            ' . $this->pdflatexPath . ' --interaction=batchmode ' . $texFile, $output, $retVal);
            if ($retVal == 0) {
                $outputStr = implode('<br />', $output);
                throw new jException('jelix~errors.ltx2pdf.exec', array($this->pdflatexPath, $outputStr));
            }
        }
        $this->_httpHeaders['Content-Type'] = 'application/pdf';
        $this->_httpHeaders['Content-length'] = @filesize($pdfFile);
        $this->_httpHeaders['Content-Disposition'] = 'attachment; filename=' . $this->title . '.pdf';
        $this->sendHttpHeaders();
        readfile($pdfFile);
        return true;
    }
开发者ID:alienpham,项目名称:helenekling,代码行数:52,代码来源:jResponseLatexToPdf.class.php

示例15: _saveCompiledString

 protected function _saveCompiledString($cachefile, $result)
 {
     jFile::write($cachefile, $result);
 }
开发者ID:rodacom,项目名称:jelix,代码行数:4,代码来源:jTplCompiler.class.php


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