本文整理汇总了PHP中rex_file::get方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_file::get方法的具体用法?PHP rex_file::get怎么用?PHP rex_file::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_file
的用法示例。
在下文中一共展示了rex_file::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCopyToExistingDir
public function testCopyToExistingDir()
{
$orig = $this->getPath('orig2');
$copy = $this->getPath('copy2');
// dir1 only in /orig
rex_dir::create($orig . '/dir1');
// dir2 only in /copy
rex_dir::create($copy . '/dir2');
// file1 only in /orig
rex_file::put($orig . '/file1.txt', '');
rex_file::put($orig . '/dir3/file1.txt', '');
// file2 with newest version in /orig
rex_file::put($copy . '/file2.txt', 'file2_old');
touch($copy . '/file2.txt', 1);
rex_file::put($copy . '/dir3/file2.txt', 'file2_old');
touch($copy . '/dir3/file2.txt', 1);
rex_file::put($orig . '/file2.txt', 'file2_new');
rex_file::put($orig . '/dir3/file2.txt', 'file2_new');
$this->assertTrue(rex_dir::copy($orig, $copy), 'copy() returns true on success');
$this->assertTrue(is_dir($copy . '/dir1'), 'subdir of source dir exists in destination dir');
$this->assertTrue(is_dir($copy . '/dir2'), 'existsing subdir of destination dir still exists');
$this->assertTrue(is_file($copy . '/file1.txt'), 'file of source dir exists in destination dir');
$this->assertTrue(is_file($copy . '/dir3/file1.txt'), 'existing file of destination dir still exists');
$this->assertEquals('file2_new', rex_file::get($copy . '/file2.txt'), 'existing file in destination dir will be replaced');
$this->assertEquals('file2_new', rex_file::get($copy . '/dir3/file2.txt'), 'existing file in destination dir will be replaced');
}
示例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);
}
示例3: getTemplate
public function getTemplate()
{
$file = $this->getFile();
if (!$file) {
return false;
}
return rex_file::get($file);
}
示例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);
}
示例5: testAdd
/**
* @depends testConstruct
*/
public function testAdd()
{
$path = $this->getPath('test3.log');
$log = new rex_log_file($path);
$log->add(['test1a', 'test1b']);
$log->add(['test2a', 'test2b', 'test2c']);
$format = <<<'EOF'
%i-%i-%i %i:%i:%i | test1a | test1b
%i-%i-%i %i:%i:%i | test2a | test2b | test2c
EOF;
$this->assertStringMatchesFormat($format, rex_file::get($path));
}
示例6: foreach
echo rex_view::title('yform');
if (rex::getUser()->isAdmin()) {
$content = '';
$searchtext = 'module:yform_basic_output';
$gm = rex_sql::factory();
$gm->setQuery('select * from rex_module where output LIKE "%' . $searchtext . '%"');
$module_id = 0;
$module_name = '';
foreach ($gm->getArray() as $module) {
$module_id = $module['id'];
$module_name = $module['name'];
}
$yform_module_name = 'YForm Formbuilder';
if (rex_request('install', "integer") == 1) {
$input = rex_file::get(rex_path::addon('yform', 'module/module_input.inc'));
$output = rex_file::get(rex_path::addon('yform', 'module/module_output.inc'));
$mi = rex_sql::factory();
// $mi->debugsql = 1;
$mi->setTable('rex_module');
$mi->setValue('input', $input);
$mi->setValue('output', $output);
if ($module_id == rex_request('module_id', 'integer', -1)) {
$mi->setWhere('id="' . $module_id . '"');
$mi->update();
echo rex_view::success('Modul "' . $module_name . '" wurde aktualisiert');
} else {
$mi->setValue('name', $yform_module_name);
$mi->insert();
$module_id = (int) $mi->getLastId();
$module_name = $yform_module_name;
echo rex_view::success('yform Modul wurde angelegt unter "' . $yform_module_name . '"');
示例7: 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);
}
示例8: testCopyToDir
public function testCopyToDir()
{
$orig = $this->getPath('file.txt');
$copyDir = $this->getPath('copy');
$copyFile = $this->getPath('copy/file.txt');
$content = 'test';
rex_file::put($orig, $content);
rex_dir::create($copyDir);
$this->assertTrue(rex_file::copy($orig, $copyDir), 'copy() returns true on success');
$this->assertEquals($content, rex_file::get($copyFile), 'content of new file is the same as of original file');
}
示例9: Parsedown
<?php
$file = rex_file::get(rex_path::addon('focuspoint', 'license.md'));
$Parsedown = new Parsedown();
$content = $Parsedown->text($file);
$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', $this->i18n('licence'), false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
示例10: loadFile
/**
* Loads the translation definitions of the given file.
*
* @param string $file Path to the file
*
* @return bool TRUE on success, FALSE on failure
*/
private static function loadFile($file)
{
if (($content = rex_file::get($file)) && preg_match_all("/^([^\\s]*)\\s*=\\s*(.*\\S)?\\s*\$/m", $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
self::addMsg($match[1], $match[2]);
}
}
}
示例11: rex_request
<?php
$func = rex_request('func', 'string');
if ($func == 'import_beispieldaten') {
$current_user = rex::getUser()->getId();
$sql = rex_sql::factory();
//$sql->setDebug();
$sql->setQuery('SELECT * FROM rex_user WHERE id = ' . $current_user);
$user = $sql->getValue('name');
$qry = "\n\n -- Aufgaben\n\n INSERT IGNORE `rex_aufgaben` VALUES\n (1, 'Fav Icon erstellen', 'Wird immer benötigt',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n (2, 'Touch Icon erstellen', '',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n (3, 'Meta Infos erstellen', 'Sind Ortsbezogene meta Infos wichtig?',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n (4, 'Print.css entwickeln', 'Wird immer vergessen',1,1,0,1,now(),now(),'{$user}','{$user}','',''),\n (5, 'robots.txt prüfen', ':-)',7,1,0,1,now(),now(),'{$user}','{$user}','','');\n\n -- Kategorien\n\n INSERT IGNORE `rex_aufgaben_categories` VALUES\n (1,'Grundlagen','#9EAEC2'),\n (2,'Backend','#588D76'),\n (3,'Design','#8D588A'),\n (4,'Funktion','#9EAEC2'),\n (5,'Fehler','#72A3A7'),\n (6,'Wunsch','#FFD83D'),\n (7,'SEO','#437047');\n\n-- User Settings\n\n INSERT IGNORE `rex_aufgaben_user_settings` VALUES (1,{$current_user},5);\n ";
$sql = rex_sql::factory();
// $sql->setDebug();
$sql->setQuery($qry);
echo '<div class="alert alert-success">Der Beispieldaten wurden eingefügt.</div>';
$func = '';
}
$file = rex_file::get(rex_path::addon('aufgaben', 'README.md'));
$Parsedown = new Parsedown();
$content = '<div id="aufgaben">' . $Parsedown->text($file);
$content .= '
<hr/>
<p><a href="index.php?page=aufgaben/info&func=import_beispieldaten"><i class="rex-icon rex-icon-module"></i> Beispieldaten importieren</a>
</p>
</div>
';
$fragment = new rex_fragment();
$fragment->setVar('title', 'Hilfe');
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
示例12: Parsedown
<?php
$file = rex_file::get(rex_path::addon('aufgaben', 'CHANGELOG.md'));
$Parsedown = new Parsedown();
$content = '<div id="aufgaben">' . $Parsedown->text($file) . '</div>';
$fragment = new rex_fragment();
$fragment->setVar('title', $this->i18n('aufgaben_changelog'));
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
示例13: Parsedown
<?php
$file = rex_file::get(rex_path::addon('out5', 'README.md'));
$Parsedown = new Parsedown();
$content = $Parsedown->text($file);
$fragment = new rex_fragment();
$fragment->setVar('title', 'Hilfe');
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
$file = rex_file::get(rex_path::addon('out5', 'CHANGELOG.md'));
$Parsedown = new Parsedown();
$content = $Parsedown->text($file);
$fragment = new rex_fragment();
$fragment->setVar('title', 'Changelog');
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
$file = rex_file::get(rex_path::addon('out5', 'LICENSE.md'));
$Parsedown = new Parsedown();
$content = $Parsedown->text($file);
$fragment = new rex_fragment();
$fragment->setVar('title', 'Lizenz');
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
示例14: ob_start
if ($subpage == 'help') {
$package = rex_package::get(rex_request('package', 'string'));
$name = $package->getPackageId();
$version = $package->getVersion();
$author = $package->getAuthor();
$supportPage = $package->getSupportPage();
if (is_readable($package->getPath('help.php'))) {
if (!$package->isAvailable() && is_readable($package->getPath('lang'))) {
rex_i18n::addDirectory($package->getPath('lang'));
}
ob_start();
$package->includeFile('help.php');
$content .= ob_get_clean();
} elseif (is_readable($package->getPath('README.md'))) {
$fragment = new rex_fragment();
$fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($package->getPath('README.md'))), false);
$content .= $fragment->parse('core/page/docs.php');
} else {
$content .= rex_view::info(rex_i18n::msg('package_no_help_file'));
}
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ' . $name, false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
$credits = '';
$credits .= '<dl class="dl-horizontal">';
$credits .= '<dt>' . rex_i18n::msg('credits_name') . '</dt><dd>' . htmlspecialchars($name) . '</dd>';
if ($version) {
$credits .= '<dt>' . rex_i18n::msg('credits_version') . '</dt><dd>' . $version . '</dd>';
}
if ($author) {
示例15: rex_fragment
<?php
$fragment = new rex_fragment();
$content = '
<p>Folgendes im Template einfügen:</p>
';
$content .= rex_string::highlight(rex_file::get(rex_path::addon('focuspoint', 'pages/info_template.inc')));
$content .= '
<p>Bei der Installation wurde ein Effekt beim Media Manager AddOn hinzugefügt. Sollte dieser fehlen, bitte ein reinstall durchführen</p>
<p>Diese Ausgabe dient als Beispiel für ein Modul:</p>
';
$content .= rex_string::highlight(rex_file::get(rex_path::addon('focuspoint', 'pages/info_modul.inc')));
$fragment = new rex_fragment();
$fragment->setVar('class', 'info', false);
$fragment->setVar('title', $this->i18n('help'), false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');