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


PHP rex_file::put方法代码示例

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


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

示例1: factory

 /**
  * Prepares a new stream.
  *
  * @param string $path    Virtual path which should describe the content (e.g. "template/1"), only relevant for error messages
  * @param string $content Content which will be included
  *
  * @throws InvalidArgumentException
  *
  * @return string Full path with protocol (e.g. "rex://template/1")
  */
 public static function factory($path, $content)
 {
     if (!is_string($path) || empty($path)) {
         throw new InvalidArgumentException('Expecting $path to be a string and not empty!');
     }
     if (!is_string($content)) {
         throw new InvalidArgumentException('Expecting $content to be a string!');
     }
     if (null === self::$useRealFiles) {
         self::$useRealFiles = extension_loaded('suhosin') && !preg_match('/(?:^|,)rex(?::|,|$)/', ini_get('suhosin.executor.include.whitelist'));
     }
     if (self::$useRealFiles) {
         $hash = substr(sha1($content), 0, 7);
         $path = rex_path::coreCache('stream/' . $path . '/' . $hash);
         if (!file_exists($path)) {
             rex_file::put($path, $content);
         }
         return $path;
     }
     if (!self::$registered) {
         stream_wrapper_register('rex', __CLASS__);
         self::$registered = true;
     }
     $path = 'rex://' . $path;
     self::$nextContent[$path] = $content;
     return $path;
 }
开发者ID:VIEWSION,项目名称:redaxo,代码行数:37,代码来源:stream.php

示例2: updateVersion

 private function updateVersion()
 {
     $file = rex_path::core('boot.php');
     $content = rex_file::get($file);
     $content = preg_replace('/(?<=^rex::setProperty\\(\'version\', \').*?(?=\')/m', $this->version, $content);
     rex_file::put($file, $content);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:7,代码来源:release.php

示例3: testDelete

 public function testDelete()
 {
     $path = $this->getPath('delete.log');
     $path2 = $path . '.2';
     rex_file::put($path, '');
     rex_file::put($path2, '');
     rex_log_file::delete($path);
     $this->assertFileNotExists($path);
     $this->assertFileNotExists($path2);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:10,代码来源:log_file_test.php

示例4: compile

 /**
  * Compile a fragment.
  *
  * @param string $value
  */
 public function compile($file)
 {
     if ($this->isExpired($file)) {
         $content = rex_file::get($file);
         if (rex_file::put($this->getCompiledFile($file), $this->compileString($content)) === false) {
             throw new rex_exception('Unable to generate fragment ' . $file . '!');
         }
     }
     return $this->getCompiledFile($file);
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:15,代码来源:compiler.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param string   $path        File path
  * @param int|null $maxFileSize Maximum file size
  */
 public function __construct($path, $maxFileSize = null)
 {
     $this->path = $path;
     if (!file_exists($path)) {
         rex_file::put($path, '');
     }
     if ($maxFileSize && file_exists($path) && filesize($path) > $maxFileSize) {
         rename($path, $path . '.2');
     }
     $this->file = fopen($path, 'a+b');
 }
开发者ID:staabm,项目名称:redaxo,代码行数:17,代码来源:log_file.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     rex_file::put($this->getPath('file1.txt'), '');
     rex_file::put($this->getPath('file2.yml'), '');
     rex_file::put($this->getPath('dir1/file3.txt'), '');
     rex_file::put($this->getPath('dir2/file4.yml'), '');
     rex_file::put($this->getPath('dir2/dir/file5.yml'), '');
     rex_dir::create($this->getPath('dir1/dir'));
     rex_dir::create($this->getPath('dir2/dir1'));
     rex_dir::create($this->getPath('dir'));
     rex_file::put($this->getPath('.DS_Store'), '');
     rex_file::put($this->getPath('dir1/Thumbs.db'), '');
 }
开发者ID:staabm,项目名称:redaxo,代码行数:14,代码来源:finder_test.php

示例7: backup

 private function backup()
 {
     $content = '<!-- ' . PHP_EOL . date('d.m.Y H:i:s') . PHP_EOL;
     $content .= 'From : ' . $this->From . PHP_EOL;
     $content .= 'To : ' . implode(', ', array_column($this->getToAddresses(), 0)) . PHP_EOL;
     $content .= 'Subject : ' . $this->Subject . PHP_EOL;
     $content .= ' -->' . PHP_EOL;
     $content .= $this->Body;
     $dir = rex_path::addonData('phpmailer', 'mail_backup/' . date('Y') . '/' . date('m'));
     $count = 1;
     $backupFile = $dir . '/' . date('Y-m-d_H_i_s') . '.html';
     while (file_exists($backupFile)) {
         $backupFile = $dir . '/' . date('Y-m-d_H_i_s') . '_' . ++$count . '.html';
     }
     rex_file::put($backupFile, $content);
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:16,代码来源:mailer.php

示例8: generate

 public function generate()
 {
     $template_id = $this->getId();
     if ($template_id < 1) {
         return false;
     }
     $sql = rex_sql::factory();
     $qry = 'SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id = ' . $template_id;
     $sql->setQuery($qry);
     if ($sql->getRows() == 1) {
         $templateFile = self::getFilePath($template_id);
         $content = $sql->getValue('content');
         $content = rex_var::parse($content, rex_var::ENV_FRONTEND, 'template');
         if (rex_file::put($templateFile, $content) !== false) {
             return true;
         } else {
             throw new rex_exception('Unable to generate template ' . $template_id . '!');
         }
     } else {
         throw new rex_exception('Template with id "' . $template_id . '" does not exist!');
     }
 }
开发者ID:staabm,项目名称:redaxo,代码行数:22,代码来源:api_template.php

示例9: elseif

     }
     $filename = $filename . '_' . $i;
 }
 if ($exporttype == 'sql') {
     // ------------------------------ FUNC EXPORT SQL
     $header = 'plain/text';
     $hasContent = rex_backup::exportDb($export_path . $filename . $ext, $EXPTABLES);
     // ------------------------------ /FUNC EXPORT SQL
 } elseif ($exporttype == 'files') {
     // ------------------------------ FUNC EXPORT FILES
     $header = 'tar/gzip';
     if (empty($EXPDIR)) {
         $error = rex_i18n::msg('backup_please_choose_folder');
     } else {
         $content = rex_backup::exportFiles($EXPDIR);
         $hasContent = rex_file::put($export_path . $filename . $ext, $content);
     }
     // ------------------------------ /FUNC EXPORT FILES
 }
 if ($hasContent) {
     if ($exportdl) {
         $filename = $filename . $ext;
         rex_response::sendFile($export_path . $filename, $header, 'attachment');
         rex_file::delete($export_path . $filename);
         exit;
     } else {
         $success = rex_i18n::msg('backup_file_generated_in') . ' ' . strtr($filename . $ext, '\\', '/');
     }
 } else {
     $error = rex_i18n::msg('backup_file_could_not_be_generated') . ' ' . rex_i18n::msg('backup_check_rights_in_directory') . ' ' . $export_path;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:31,代码来源:export.php

示例10: generateArticleContent

 /**
  * Generiert den Artikel-Cache des Artikelinhalts.
  *
  * @param int $article_id Id des zu generierenden Artikels
  * @param int $clang      ClangId des Artikels
  *
  * @return bool TRUE bei Erfolg, FALSE wenn eine ungütlige article_id übergeben wird, sonst eine Fehlermeldung
  */
 public static function generateArticleContent($article_id, $clang = null)
 {
     foreach (rex_clang::getAllIds() as $_clang) {
         if ($clang !== null && $clang != $_clang) {
             continue;
         }
         $CONT = new rex_article_content_base();
         $CONT->setCLang($_clang);
         $CONT->setEval(false);
         // Content nicht ausführen, damit in Cachedatei gespeichert werden kann
         if (!$CONT->setArticleId($article_id)) {
             return false;
         }
         // --------------------------------------------------- Artikelcontent speichern
         $article_content_file = rex_path::addonCache('structure', "{$article_id}.{$_clang}.content");
         $article_content = $CONT->getArticle();
         // ----- EXTENSION POINT
         $article_content = rex_extension::registerPoint(new rex_extension_point('GENERATE_FILTER', $article_content, ['id' => $article_id, 'clang' => $_clang, 'article' => $CONT]));
         if (rex_file::put($article_content_file, $article_content) === false) {
             return rex_i18n::msg('article_could_not_be_generated') . ' ' . rex_i18n::msg('check_rights_in_directory') . rex_path::addonCache('structure');
         }
     }
     return true;
 }
开发者ID:VIEWSION,项目名称:redaxo,代码行数:32,代码来源:content_service.php

示例11: rex_post

<?php

/** @var i18n $I18N */
$content = '';
$settings = rex_post('settings', array(array('backups', 'bool', false), array('api_login', 'string'), array('api_key', 'string')), null);
if (is_array($settings)) {
    $settingsContent = "<?php\n\n";
    foreach ($settings as $key => $value) {
        $settingsContent .= "\$REX['ADDON'][" . var_export($key, true) . "]['install'] = " . var_export($value, true) . ";\n";
        OOAddon::setProperty('install', $key, $value);
    }
    if (rex_file::put(rex_path::addonData('install', 'settings.inc.php'), $settingsContent)) {
        echo rex_info($I18N->msg('install_settings_saved'));
    } else {
        echo rex_warning($I18N->msg('install_settings_not_saved'));
    }
    rex_install_webservice::deleteCache();
}
$content .= '
    <div class="rex-addon-output">
        <h2 class="rex-hl2">' . $I18N->msg('install_subpage_settings') . '</h2>

        <div class="rex-form">
            <form action="index.php?page=install&subpage=settings" method="post">
                <fieldset class="rex-form-col-1">
                    <legend>' . $I18N->msg('install_settings_general') . '</legend>

                    <div class="rex-form-wrapper">';
$content .= '
                        <div class="rex-form-row">
                            <p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:31,代码来源:settings.php

示例12: generateConfig

 public static function generateConfig()
 {
     $filecontent = '<?php ' . "\n";
     $gc = rex_sql::factory();
     $domains = $gc->getArray('select * from rex_yrewrite_domain order by alias_domain, mount_id, clangs');
     foreach ($domains as $domain) {
         if ($domain['domain'] != '') {
             if ($domain['alias_domain'] != '') {
                 $filecontent .= "\n" . 'rex_yrewrite::addAliasDomain("' . $domain['domain'] . '", "' . $domain['alias_domain'] . '", ' . $domain['clang_start'] . ');';
             } elseif ($domain['start_id'] > 0 && $domain['notfound_id'] > 0) {
                 $filecontent .= "\n" . 'rex_yrewrite::addDomain(new rex_yrewrite_domain(' . '"' . $domain['domain'] . '", ' . $domain['mount_id'] . ', ' . $domain['start_id'] . ', ' . $domain['notfound_id'] . ', ' . (strlen(trim($domain['clangs'])) ? 'array(' . $domain['clangs'] . ')' : 'null') . ', ' . $domain['clang_start'] . ', ' . '"' . htmlspecialchars($domain['title_scheme']) . '", ' . '"' . htmlspecialchars($domain['description']) . '", ' . '"' . htmlspecialchars($domain['robots']) . '"' . '));';
             }
         }
     }
     rex_file::put(self::$configfile, $filecontent);
 }
开发者ID:tzfrs,项目名称:redaxo_yrewrite,代码行数:16,代码来源:yrewrite.php

示例13: save

 static function save($name, $success, $message = '', $id = null)
 {
     global $REX;
     $year = date('Y');
     $month = date('m');
     // in den Log-Dateien festes Datumsformat verwenden
     // wird bei der Ausgabe entsprechend der lokalen Einstellungen umgewandelt
     // rex_formatter nicht verwenden, da im Frontend nicht verfuegbar
     $newline = date('Y-m-d H:i');
     if ($success) {
         $newline .= ' | SUCCESS | ';
     } else {
         $newline .= ' |  ERROR  | ';
     }
     if (!$id) {
         $id = '--';
     } else {
         $id = str_pad($id, 2, ' ', STR_PAD_LEFT);
     }
     $newline .= $id . ' | ' . $name;
     if ($message) {
         $newline .= ' | ' . str_replace(array("\r\n", "\n"), ' | ', trim(strip_tags($message)));
     }
     $dir = REX_CRONJOB_LOG_FOLDER . $year;
     $content = '';
     $file = $dir . '/' . $year . '-' . $month . '.log';
     if (file_exists($file)) {
         $content = rex_file::get($file);
     }
     $content = $newline . "\n" . $content;
     return rex_file::put($file, $content);
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:32,代码来源:class.log.inc.php

示例14: testGetOutput

 public function testGetOutput()
 {
     $file = $this->getPath('test.php');
     rex_file::put($file, 'a<?php echo "b";');
     $this->assertEquals('ab', rex_file::getOutput($file), 'getOutput() returns the executed content');
 }
开发者ID:staabm,项目名称:redaxo,代码行数:6,代码来源:file_test.php

示例15: generateConfig

 public static function generateConfig()
 {
     $content = '<?php ' . "\n";
     $gc = rex_sql::factory();
     $domains = $gc->getArray('select * from ' . rex::getTable('yrewrite_domain') . ' order by alias_domain, mount_id, clangs');
     foreach ($domains as $domain) {
         if (!$domain['domain']) {
             continue;
         }
         $name = $domain['domain'];
         if (false === strpos($name, '//')) {
             $name = '//' . $name;
         }
         $parts = parse_url($name);
         $name = $parts['host'];
         if (isset($parts['port'])) {
             $name .= ':' . $parts['port'];
         }
         $path = '/';
         if (isset($parts['path'])) {
             $path = rtrim($parts['path'], '/') . '/';
         }
         if ($domain['alias_domain'] != '') {
             $content .= "\n" . 'rex_yrewrite::addAliasDomain("' . $name . '", "' . $domain['alias_domain'] . '", ' . $domain['clang_start'] . ');';
         } elseif ($domain['start_id'] > 0 && $domain['notfound_id'] > 0) {
             $content .= "\n" . 'rex_yrewrite::addDomain(new rex_yrewrite_domain(' . '"' . $name . '", ' . (isset($parts['scheme']) ? '"' . $parts['scheme'] . '"' : 'null') . ', ' . '"' . $path . '", ' . $domain['mount_id'] . ', ' . $domain['start_id'] . ', ' . $domain['notfound_id'] . ', ' . (strlen(trim($domain['clangs'])) ? 'array(' . $domain['clangs'] . ')' : 'null') . ', ' . $domain['clang_start'] . ', ' . '"' . htmlspecialchars($domain['title_scheme']) . '", ' . '"' . htmlspecialchars($domain['description']) . '", ' . '"' . htmlspecialchars($domain['robots']) . '"' . '));';
         }
     }
     rex_file::put(self::$configfile, $content);
 }
开发者ID:VIEWSION,项目名称:redaxo_yrewrite,代码行数:30,代码来源:yrewrite.php


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