本文整理汇总了PHP中rex_put_file_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP rex_put_file_contents函数的具体用法?PHP rex_put_file_contents怎么用?PHP rex_put_file_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rex_put_file_contents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: a685_search_highlighter_saveSettings
function a685_search_highlighter_saveSettings($_settings)
{
global $REX;
$parent = 'rexsearch';
$mypage = 'search_highlighter';
return rex_put_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $parent . '/plugins/' . $mypage . '/settings.conf', serialize($_settings));
}
示例2: a587_plaintext_saveSettings
function a587_plaintext_saveSettings($_settings)
{
global $REX;
$parent = 'rexsearch';
$mypage = 'plaintext';
return rex_put_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $parent . '/plugins/' . $mypage . '/settings.conf', serialize($_settings));
}
示例3: updateSettingsFile
public static function updateSettingsFile($showSuccessMsg = true)
{
global $REX, $I18N;
$settingsFile = self::getSettingsFile();
$msg = self::checkDirForFile($settingsFile);
if ($msg != '') {
if ($REX['REDAXO']) {
echo rex_warning($msg);
}
} else {
if (!file_exists($settingsFile)) {
self::createDynFile($settingsFile);
}
// deprecated settings
unset($REX['ADDON']['open_graph']['settings']['cached_redirects']);
unset($REX['ADDON']['open_graph']['settings']['no_double_content_redirects_only_frontend']);
$content = "<?php\n\n";
foreach ((array) $REX['ADDON']['open_graph']['settings'] as $key => $value) {
$content .= "\$REX['ADDON']['open_graph']['settings']['{$key}'] = " . var_export($value, true) . ";\n";
}
if (rex_put_file_contents($settingsFile, $content)) {
if ($REX['REDAXO'] && $showSuccessMsg) {
echo rex_info($I18N->msg('open_graph_config_ok'));
}
} else {
if ($REX['REDAXO']) {
echo rex_warning($I18N->msg('open_graph_config_error'));
}
}
}
}
示例4: updateSettingsFile
/**
* Aktualisiert die gespeicherten Benutzereinstellungen .
* @global mixed[] $REX Redaxo Variable
* @global i18n $I18N Objekt mir Übersetzungen fürs Backend
* @param boolean $showSuccessMsg True, wenn Meldung bei erfolgreichem
* Speichern angezeigt werden soll.
*/
public static function updateSettingsFile($showSuccessMsg = true)
{
global $REX, $I18N;
$settingsFile = self::getSettingsFile();
$msg = self::checkDirForFile($settingsFile);
if ($msg != '') {
if ($REX['REDAXO']) {
echo rex_warning($msg);
}
} else {
if (!file_exists($settingsFile)) {
self::createDynFile($settingsFile);
}
$content = "<?php\n\n";
foreach ((array) $REX['ADDON']['hr4you_sync']['settings'] as $key => $value) {
$content .= "\$REX['ADDON']['hr4you_sync']['settings']['{$key}'] = " . var_export($value, true) . ";\n";
}
if (rex_put_file_contents($settingsFile, $content)) {
if ($REX['REDAXO'] && $showSuccessMsg) {
echo rex_info($I18N->msg('d2u_stellenmarkt_hr4you_sync_config_ok'));
}
} else {
if ($REX['REDAXO']) {
echo rex_warning($I18N->msg('d2u_stellenmarkt_hr4you_sync_config_error'));
}
}
}
}
示例5: rex_replace_dynamic_contents
function rex_replace_dynamic_contents($path, $content)
{
if ($fcontent = rex_get_file_contents($path)) {
$content = "// --- DYN\n" . trim($content) . "\n// --- /DYN";
$fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent);
return rex_put_file_contents($path, $fcontent);
}
return false;
}
示例6: a724_generatePathnamesFromTable
function a724_generatePathnamesFromTable($params)
{
$debug = false;
$sql = new rex_sql();
$results = $sql->getArray('SELECT article_id, url_table, url_table_parameters FROM rex_a724_frau_schultze WHERE url_table != "" AND url_table_parameters != ""');
$URLPATH = array();
if ($sql->getRows() >= 1) {
a724_deletePathnamesFromTable();
foreach ($results as $result) {
if (is_array($result) && count($result) > 0) {
$path = rex_getUrl($result['article_id']) . '/';
$path = str_replace('.html', '', $path);
$table = $result['url_table'];
$params = unserialize($result['url_table_parameters']);
$col_name = $params[$table][$table . "_name"];
$col_id = $params[$table][$table . "_id"];
// Daten zum Aufbau der Urls holen
$sqlu = new rex_sql();
$sqlu->setDebug($debug);
$res = $sqlu->getArray('SELECT ' . $col_name . ' AS name, ' . $col_id . ' AS id FROM ' . $table);
if ($sqlu->getRows() >= 1) {
// Urls in die Datenbank schreiben
$sqli = new rex_sql();
$sqli->setDebug($debug);
foreach ($res as $re) {
$table_path = $path . strtolower(rex_parse_article_name($re['name'])) . '.html';
$table_id = $re['id'];
$URLPATH[$result['url_table']][$table_id] = $table_path;
$sqli->setTable('rex_a724_frau_schultze');
$sqli->setValue('article_id', $result['article_id']);
$sqli->setValue('status', '1');
$sqli->setValue('url_table', $result['url_table']);
$sqli->setValue('name', $table_path);
$sqli->insert();
}
}
}
}
}
rex_put_file_contents(A724_URL_TABLE_PATHLIST, "<?php\n\$URLPATH = " . var_export($URLPATH, true) . ";\n");
}
示例7: toTar
function toTar($filename, $useGzip)
{
// Encode processed files into TAR file format
$this->__generateTar();
// GZ Compress the data if we need to
if ($useGzip) {
// Make sure we have gzip support
if (!function_exists("gzencode")) {
return false;
}
$file = gzencode($this->tar_file);
} else {
$file = $this->tar_file;
}
// Write the TAR file
// $fp = fopen($filename,"wb");
// fwrite($fp,$file);
// fclose($fp);
// kein Filename gegeben => Inhalt zurueckgeben
if (!$filename) {
return $file;
}
// STM: hier mit put_file_contents ist viel schneller
return rex_put_file_contents($filename, $file) !== false;
}
示例8: rex_tabindex
<input type="text" value="' . $redaxo_user_pass . '" id="redaxo_user_pass" name="redaxo_user_pass"' . rex_tabindex() . '/>
</p>';
if ($user_sql->getRows() > 0) {
echo '
<p>
<input class="rex-chckbx" type="checkbox" id="noadmin" name="noadmin" value="1"' . rex_tabindex() . '/>
<label class="rex-lbl-right" for="noadmin">' . $I18N->msg("setup_048") . '</label>
</p>';
}
echo '
<p>
<input class="rex-sbmt" type="submit" value="' . $I18N->msg("setup_049") . '"' . rex_tabindex() . ' />
</p>
</fieldset>
</form>';
}
// ---------------------------------- MODUS 5 | Setup verschieben ...
if ($checkmodus == 5) {
$master_file = $REX['INCLUDE_PATH'] . '/master.inc.php';
$cont = rex_get_file_contents($master_file);
$cont = ereg_replace("(REX\\['SETUP'\\].?\\=.?)[^;]*", '\\1false', $cont);
if (rex_put_file_contents($master_file, $cont) !== false) {
$errmsg = "";
} else {
$errmsg = $I18N->msg('setup_050');
}
rex_setup_title($I18N->msg('setup_step5'));
echo $I18N->msg('setup_051', '<h2>', '</h2>', '<a href="index.php">', '</a>');
}
echo '</div>';
示例9: rex_post
$mailer = rex_post('mailer', 'string', $testMailer->Mailer);
$host = rex_post('host', 'string', $testMailer->Host);
$charset = rex_post('charset', 'string', $testMailer->CharSet);
$wordwrap = rex_post('wordwrap', 'int', $testMailer->WordWrap);
$encoding = rex_post('encoding', 'string', $testMailer->Encoding);
$priority = rex_post('priority', 'int', $testMailer->Priority);
$message = '';
if (rex_post('btn_save', 'string') != '') {
$file = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/class.rex_mailer.inc.php';
$message = rex_is_writable($file);
if ($message === true) {
$message = $I18N_A93->msg('config_saved_error');
if ($file_content = rex_get_file_contents($file)) {
$template = "// --- DYN\n \$this->From = '" . $from . "';\n \$this->FromName = '" . $fromname . "';\n \$this->ConfirmReadingTo = '" . $confirmto . "';\n \$this->Mailer = '" . $mailer . "';\n \$this->Host = '" . $host . "';\n \$this->CharSet = '" . $charset . "';\n \$this->WordWrap = " . $wordwrap . ";\n \$this->Encoding = '" . $encoding . "';\n \$this->Priority = " . $priority . ";\n // --- /DYN";
$file_content = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $template, $file_content);
if (rex_put_file_contents($file, $file_content)) {
$message = $I18N_A93->msg('config_saved_successful');
}
}
}
}
$sel_mailer = new rex_select();
$sel_mailer->setId('mailer');
$sel_mailer->setName('mailer');
$sel_mailer->setSize(1);
$sel_mailer->setSelected($mailer);
foreach (array('mail', 'sendmail', 'smtp') as $type) {
$sel_mailer->addOption($type, $type);
}
$sel_encoding = new rex_select();
$sel_encoding->setId('encoding');
示例10: save
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;
if (!is_dir($dir)) {
mkdir($dir);
chmod($dir, $REX['DIRPERM']);
}
$content = '';
$file = $dir . '/' . $year . '-' . $month . '.log';
if (file_exists($file)) {
$content = rex_get_file_contents($file);
}
$content = $newline . "\n" . $content;
return rex_put_file_contents($file, $content);
}
示例11: rex_warning
if (rex_put_file_contents($htaccessRoot, $content) > 0) {
//echo rex_info($I18N->msg('seo42_setup_htaccess_patch_ok'));
} else {
echo rex_warning($I18N->msg('seo42_setup_htaccess_patch_failed'));
}
}
} elseif ($func == "apply_settings") {
$server = str_replace("\\'", "'", rex_post('server', 'string'));
$servername = str_replace("\\'", "'", rex_post('servername', 'string'));
$masterFile = $REX['INCLUDE_PATH'] . '/master.inc.php';
$content = rex_get_file_contents($masterFile);
$search = array('\\"', "'", '$');
$destroy = array('"', "\\'", '\\$');
$replace = array('search' => array("@(REX\\['SERVER'\\].?\\=.?).*\$@m", "@(REX\\['SERVERNAME'\\].?\\=.?).*\$@m"), 'replace' => array("\$1'" . str_replace($search, $destroy, $server) . "';", "\$1'" . str_replace($search, $destroy, $servername) . "';"));
$content = preg_replace($replace['search'], $replace['replace'], $content);
if (rex_put_file_contents($masterFile, $content) > 0) {
echo rex_info($I18N->msg('seo42_setup_settings_saved'));
$REX['SERVER'] = stripslashes($server);
$REX['SERVERNAME'] = stripslashes($servername);
// reinit because of subdir check in step 2
seo42::init();
} else {
echo rex_warning($I18N->msg('seo42_setup_settings_save_failed'));
}
}
?>
<div class="rex-addon-output">
<h2 class="rex-hl2"><?php
echo $I18N->msg('seo42_setup_step1');
?>
示例12: rex_tabindex
<input type="text" value="' . $redaxo_user_pass . '" id="redaxo_user_pass" name="redaxo_user_pass"' . rex_tabindex() . '/>
</p>';
if ($user_sql->getRows() > 0) {
echo '
<p>
<input class="rex-chckbx" type="checkbox" id="noadmin" name="noadmin" value="1"' . rex_tabindex() . '/>
<label class="rex-lbl-right" for="noadmin">' . $I18N->msg("setup_048") . '</label>
</p>';
}
echo '
<p>
<input class="rex-sbmt" type="submit" value="' . $I18N->msg("setup_049") . '"' . rex_tabindex() . ' />
</p>
</fieldset>
</form>';
}
// ---------------------------------- MODUS 5 | Setup verschieben ...
if ($checkmodus == 5) {
$master_file = $REX['INCLUDE_PATH'] . '/master.inc.php';
$cont = rex_get_file_contents($master_file);
$cont = ereg_replace("(REX\\['SETUP'\\].?\\=.?)[^;]*", '\\1false', $cont);
if (rex_put_file_contents($master_file, $cont)) {
$errmsg = "";
} else {
$errmsg = $I18N->msg('setup_050');
}
rex_setup_title($I18N->msg('setup_step5'));
echo $I18N->msg('setup_051', '<h2>', '</h2>', '<a href="index.php">', '</a>');
}
echo '</div>';
示例13: rex_generateTemplate
/**
* Generiert den TemplateCache im Filesystem
*
* @param $template_id Id des zu generierenden Templates
*
* @return TRUE bei Erfolg, sonst FALSE
*/
function rex_generateTemplate($template_id)
{
global $REX;
$sql = rex_sql::factory();
$qry = 'SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'template WHERE id = ' . $template_id;
$sql->setQuery($qry);
if ($sql->getRows() == 1) {
$templatesDir = rex_template::getTemplatesDir();
$templateFile = rex_template::getFilePath($template_id);
$content = $sql->getValue('content');
foreach ($REX['VARIABLES'] as $var) {
$content = $var->getTemplate($content);
}
if (rex_put_file_contents($templateFile, $content) !== FALSE) {
return TRUE;
} else {
trigger_error('Unable to generate template ' . $template_id . '!', E_USER_ERROR);
if (!is_writable()) {
trigger_error('directory "' . $templatesDir . '" is not writable!', E_USER_ERROR);
}
}
} else {
trigger_error('Template with id "' . $template_id . '" does not exist!', E_USER_ERROR);
}
return FALSE;
}
示例14: seo42_generate_pathlist
//.........这里部分代码省略.........
$articleId = $db->getValue('id');
$clangId = $db->getValue('clang');
if ($urlField != '' || isset($REX['SEO42_URL_CLONE'][$articleId])) {
$urlData = seo42_utils::getUrlTypeData($urlField);
$jsonData = json_decode($urlData, true);
if (isset($REX['SEO42_URL_CLONE'][$articleId]) && !isset($jsonData['url_type'])) {
$jsonData = $REX['SEO42_URL_CLONE'][$articleId];
}
switch ($jsonData['url_type']) {
case SEO42_URL_TYPE_DEFAULT:
// do nothing
break;
case SEO42_URL_TYPE_USERDEF_INTERN:
$customUrl = $jsonData['custom_url'];
if ($SEO42_IDS[$articleId][$clangId]['url'] != $customUrl) {
// only if custom url ist different then auto url
$SEO42_URLS[$customUrl] = $SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
}
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
break;
case SEO42_URL_TYPE_USERDEF_EXTERN:
$customUrl = $jsonData['custom_url'];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
break;
case SEO42_URL_TYPE_MEDIAPOOL:
$customUrl = $REX['MEDIA_DIR'] . '/' . $jsonData['file'];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => $customUrl);
break;
case SEO42_URL_TYPE_INTERN_REPLACE:
$customArticleId = $jsonData['article_id'];
$interReplaceIds[$clangId][$articleId] = array('id' => $customArticleId, 'clang' => $clangId);
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
if (isset($SEO42_IDS[$customArticleId][$clangId]['url'])) {
$SEO42_IDS[$articleId][$clangId] = array('url' => $SEO42_IDS[$customArticleId][$clangId]['url']);
} else {
$SEO42_IDS[$articleId][$clangId] = array('url' => '');
}
break;
case SEO42_URL_TYPE_INTERN_REPLACE_CLANG:
$customArticleId = $jsonData['article_id'];
$customClangId = $jsonData['clang_id'];
$interReplaceIds[$clangId][$articleId] = array('id' => $customArticleId, 'clang' => $customClangId);
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
if (isset($SEO42_IDS[$customArticleId][$customClangId]['url'])) {
$SEO42_IDS[$articleId][$clangId] = array('url' => $SEO42_IDS[$customArticleId][$customClangId]['url']);
} else {
$SEO42_IDS[$articleId][$clangId] = array('url' => '');
}
break;
case SEO42_URL_TYPE_REMOVE_ROOT_CAT:
$curUrl = $SEO42_IDS[$articleId][$clangId]['url'];
$newUrl = seo42_utils::removeRootCatFromUrl($curUrl, $clangId);
if ($newUrl != '') {
// same as SEO42_URL_TYPE_USERDEF_INTERN
$SEO42_URLS[$newUrl] = $SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']];
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => $newUrl);
}
break;
case SEO42_URL_TYPE_CALL_FUNC:
if ($jsonData['no_url']) {
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
}
break;
case SEO42_URL_TYPE_LANGSWITCH:
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
break;
case SEO42_URL_TYPE_NONE:
unset($SEO42_URLS[$SEO42_IDS[$articleId][$clangId]['url']]);
$SEO42_IDS[$articleId][$clangId] = array('url' => '');
break;
}
unset($jsonData);
}
$db->next();
}
// workaround for #177
foreach ($interReplaceIds as $clangId => $value) {
foreach ($value as $interReplaceId => $targetArticle) {
if (isset($SEO42_IDS[$targetArticle['id']][$targetArticle['clang']]['url'])) {
$SEO42_IDS[$interReplaceId][$clangId] = array('url' => $SEO42_IDS[$targetArticle['id']][$targetArticle['clang']]['url']);
}
}
}
// -----------------------------------------------------------------------------------------------------------
// EXTENSION POINT "SEO42_PATHLIST_CREATED"
$subject = array('SEO42_IDS' => $SEO42_IDS, 'SEO42_URLS' => $SEO42_URLS);
$subject = rex_register_extension_point('SEO42_PATHLIST_CREATED', $subject);
// EXTENSION POINT "SEO42_PATHLIST_FINAL" - READ ONLY
rex_register_extension_point('SEO42_PATHLIST_FINAL', $subject);
// ASSEMBLE, COMPRESS & WRITE PATHLIST TO FILE
$pathlist_content = '$SEO42_IDS = ' . var_export($subject['SEO42_IDS'], true) . ';' . PHP_EOL . '$SEO42_URLS = ' . var_export($subject['SEO42_URLS'], true) . ';';
$pathlist_content = seo42_compressPathlist($pathlist_content);
rex_put_file_contents(SEO42_PATHLIST, '<?php' . PHP_EOL . $pathlist_content);
// PURGE *.CONTENT CACHEFILES TO UPDATE INTERNAL LINKS CREATED BY replceLinks() in rex_article_base
seo42_purgeCacheFiles();
}
示例15: header
header("Content-Disposition: attachment; filename={$filename}");
echo $content;
exit;
} else {
// check filename ob vorhanden
// aendern filename
// speicher content in files
$export_path = $REX['INCLUDE_PATH'] . "/addons/{$page}/files/";
if (file_exists($export_path . $filename . $ext)) {
$i = 1;
while (file_exists($export_path . $filename . '_' . $i . $ext)) {
$i++;
}
$filename = $filename . '_' . $i;
}
if (rex_put_file_contents($export_path . $filename . $ext, $content)) {
$msg = $I18N_IM_EXPORT->msg('file_generated_in') . ' ' . strtr($filename . $ext, '\\', '/');
} else {
$msg = $I18N_IM_EXPORT->msg('file_could_not_be_generated') . ' ' . $I18N->msg('check_rights_in_directory') . ' ' . $export_path;
}
}
}
}
}
require $REX['INCLUDE_PATH'] . "/layout/top.php";
rex_title($I18N_IM_EXPORT->msg("importexport"), "");
if ($msg != '') {
echo rex_warning($msg);
}
?>
<div class="rex-cnt-cols">