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


PHP rex_get_file_contents函数代码示例

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


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

示例1: getTemplate

 function getTemplate()
 {
     $file = $this->getFile();
     if (!$file) {
         return false;
     }
     return rex_get_file_contents($file);
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:8,代码来源:class.rex_template.inc.php

示例2: rex_send_file

/**
 * Sendet eine Datei zum Client
 *
 * @param $file string Pfad zur Datei
 * @param $contentType ContentType der Datei
 * @param $environment string Die Umgebung aus der der Inhalt gesendet wird
 * (frontend/backend)
 */
function rex_send_file($file, $contentType, $environment = 'backend')
{
    global $REX;
    // Cachen für Dateien aktivieren
    $temp = $REX['USE_LAST_MODIFIED'];
    $REX['USE_LAST_MODIFIED'] = true;
    header('Content-Type: ' . $contentType);
    header('Content-Disposition: inline; filename="' . basename($file) . '"');
    $content = rex_get_file_contents($file);
    $cacheKey = md5($content . $file . $contentType . $environment);
    rex_send_content($content, filemtime($file), $cacheKey, $environment);
    // Setting zurücksetzen
    $REX['USE_LAST_MODIFIED'] = $temp;
}
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:22,代码来源:function_rex_client_cache.inc.php

示例3: getTemplate

 function getTemplate()
 {
     if ($this->getId() < 1) {
         return FALSE;
     }
     $file = $this->getFilePath($this->getId());
     if (file_exists($file)) {
         return rex_get_file_contents($file);
     } else {
         if ($this->generate()) {
             return rex_get_file_contents($file);
         }
     }
     return FALSE;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:15,代码来源:class.rex_template.inc.php

示例4: __readTar

 function __readTar($filename = '')
 {
     // Set the filename to load
     if (!$filename) {
         $filename = $this->filename;
     }
     // Read in the TAR file
     //    $fp = fopen($filename,"rb");
     //    $this->tar_file = fread($fp,filesize($filename));
     //    fclose($fp);
     // STM: hier mit get_file_contents ist viel schneller
     $this->tar_file = rex_get_file_contents($filename);
     if ($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
         if (!function_exists("gzinflate")) {
             return false;
         }
         $this->isGzipped = TRUE;
         $this->tar_file = gzinflate(substr($this->tar_file, 10, -4));
     }
     // Parse the TAR file
     $this->__parseTar();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:23,代码来源:class.rex_tar.inc.php

示例5: rex_editCLang

/**
 * Ändert eine Clang
 *
 * @param $id   Id der Clang
 * @param $name Name der Clang
 */
function rex_editCLang($id, $name)
{
    global $REX;
    $REX['CLANG'][$id] = $name;
    $file = $REX['INCLUDE_PATH'] . "/clang.inc.php";
    $cont = rex_get_file_contents($file);
    $cont = ereg_replace("(REX\\['CLANG'\\]\\['{$id}\\'].?\\=.?)[^;]*", "\\1\"" . $name . "\"", $cont);
    rex_put_file_contents($file, $cont);
    $edit = new rex_sql();
    $edit->setQuery("update " . $REX['TABLE_PREFIX'] . "clang set name='{$name}' where id='{$id}'");
    // ----- EXTENSION POINT
    rex_register_extension_point('CLANG_UPDATED', '', array('id' => $id, 'name' => $name));
}
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:19,代码来源:function_rex_generate.inc.php

示例6: rex_post

$fromname = rex_post('fromname', 'string', $testMailer->FromName);
$from = rex_post('from', 'string', $testMailer->From);
$confirmto = rex_post('confirmto', 'string', $testMailer->ConfirmReadingTo);
$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);
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:31,代码来源:settings.inc.php

示例7: 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);
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:36,代码来源:class.log.inc.php

示例8: rex_title

 * @author <a href="http://www.yakamara.de">www.yakamara.de</a>
 */
rex_title('XForm', $REX['ADDON']['xform']['SUBPAGES']);
$searchtext = 'module:xform_basic_out';
$gm = rex_sql::factory();
$gm->setQuery('select * from rex_module where ausgabe LIKE "%' . $searchtext . '%"');
$module_id = 0;
$module_name = '';
foreach ($gm->getArray() as $module) {
    $module_id = $module['id'];
    $module_name = $module['name'];
}
if (isset($_REQUEST['install']) && $_REQUEST['install'] == 1) {
    $xform_module_name = 'XForm Formbuilder';
    $in = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/xform/plugins/setup/module/module_in.inc');
    $out = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/xform/plugins/setup/module/module_out.inc');
    $mi = rex_sql::factory();
    // $mi->debugsql = 1;
    $mi->setTable('rex_module');
    $mi->setValue('eingabe', addslashes($in));
    $mi->setValue('ausgabe', addslashes($out));
    if (isset($_REQUEST['module_id']) && $module_id == $_REQUEST['module_id']) {
        $mi->setWhere('id="' . $module_id . '"');
        $mi->update();
        echo rex_info('Modul "' . $module_name . '" wurde aktualisiert');
    } else {
        $mi->setValue('name', $xform_module_name);
        $mi->insert();
        $module_id = (int) $mi->getLastId();
        $module_name = $xform_module_name;
        echo rex_info('XForm Modul wurde angelegt unter "' . $xform_module_name . '"');
开发者ID:alexbarnhill,项目名称:redaxo_xform,代码行数:31,代码来源:index.inc.php

示例9: rex_get_file_contents

<?php

/**
 * News Addon 
 * @author Jens Fuchs <fuchs at d-mind.de>
 * @project Redaxo-News-Addon
 * @date 05.11.2012
 */
$mypage = 'news';
$news_input = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/news_input.module.phps');
$news_output = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/news_output.module.phps');
$rss_input = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/rss_input.module.phps');
$rss_output = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/rss_output.module.phps');
$rssGetter_input = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/rssGetter_input.module.phps');
$rssGetter_output = rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/modules/rssGetter_output.module.phps');
?>

<div class="rex-addon-output">
	<h2 class="rex-hl2">Einrichtung der Module</h2>
	<div class="rex-addon-content">
		<p class="rex-tx1">Bitte ein neues Modul anlegen, und für Ein- und Ausgabe den Code von unten hineinkopieren.<br />
        Aktuell gibt es drei Module: Newsausgabe, RSS-Ausgabe und RSS-Import eines fremden RSS.<br />
        <br />
        Zu beachten ist, dass bei der RSS-Ausgabe ein leeres Template dem Artikel zuzuweisen ist, also etwas in der Form: 
        <?php 
rex_highlight_string('echo $this->getArticle();');
?>
</p>
	</div>
	<div class="redaxo-addon-content">
       <ul>
开发者ID:brt-tito,项目名称:rex-news,代码行数:31,代码来源:install.inc.php

示例10: 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>';
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:31,代码来源:setup.inc.php

示例11: rex_warning

                    echo rex_warning('Template "' . htmlspecialchars($template[2]) . '" konnte nicht aktualisiert werden, da diese nicht gefunden wurde.');
                }
            } else {
                $mi->insert();
                echo rex_info('Template "' . htmlspecialchars($template[2]) . '" wurde angelegt.');
            }
            rex_deleteDir($REX['INCLUDE_PATH'] . "/generated/templates", 0);
        }
    }
}
// ***** ADD EMAIL
if ($func == "email" && $request_email != "") {
    $emails = $REX["ADDON"]["community"]["plugins"]["setup"]["emails"];
    foreach ($emails as $email) {
        if ($request_email == $email[0] . "." . $email[1]) {
            $body = rex_get_file_contents($REX["INCLUDE_PATH"] . "/addons/community/plugins/" . $email[0] . "/emails/" . $email[1] . ".email");
            $body = str_replace("\r", "\n", $body);
            $body = str_replace("\n\n", "\n", $body);
            foreach ($REX["ADDON"]["community"]["plugins"]["setup"]["ids"] as $k) {
                $body = str_replace('###' . $k . '###', constant($k), $body);
            }
            $body = str_replace('###REXCOM_SERVER###', $REX['SERVER'], $body);
            $body = str_replace('###REXCOM_EMAIL###', $REX['ERROR_EMAIL'], $body);
            $mi = new rex_sql();
            // $mi->debugsql = 1;
            $mi->setTable("rex_xform_email_template");
            $mi->setValue("name", addslashes($email[2]));
            $mi->setValue("subject", addslashes($email[3]));
            $mi->setValue("mail_from", addslashes($email[4]));
            $mi->setValue("mail_from_name", addslashes($email[5]));
            $mi->setValue("body", addslashes($body));
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:index.inc.php

示例12: getDebugInfo

    public static function getDebugInfo($articleId = 0)
    {
        global $I18N, $REX;
        if ($articleId != 0) {
            self::initArticle($articleId);
        }
        if (!OOArticle::isValid(self::$curArticle)) {
            return '';
        }
        $out = '<div id="seo42-debug">';
        $out .= '<h1>---------- SEO42 DEBUG BEGIN ----------<h1>';
        // general information
        $out .= '<h2>General Information</h2>';
        $out .= '<table>';
        $out .= '<tr><td class="left"><code>REDAXO Version</code></td><td class="right"><code>' . $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>SEO42 Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['seo42'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>PHP Version</code></td><td class="right"><code>' . phpversion() . '</code></td></tr>';
        if (isset($REX['ADDON']['version']['community'])) {
            $out .= '<tr><td class="left"><code>Community Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['community'] . '</code></td></tr>';
        }
        $out .= '</table>';
        // methods
        $out .= '<h2>Class Methods</h2>';
        $out .= '<table>';
        $out .= self::getDebugInfoRow('rex_getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTrimmedUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getFullUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTitle');
        $out .= self::getDebugInfoRow('seo42::getTitlePart');
        $out .= self::getDebugInfoRow('seo42::getDescription');
        $out .= self::getDebugInfoRow('seo42::getKeywords');
        $out .= self::getDebugInfoRow('seo42::getRobotRules');
        $out .= self::getDebugInfoRow('seo42::getCanonicalUrl');
        $out .= self::getDebugInfoRow('seo42::getArticleName');
        $out .= self::getDebugInfoRow('seo42::isStartArticle');
        $out .= self::getDebugInfoRow('seo42::getWebsiteName');
        $out .= self::getDebugInfoRow('seo42::getLangCode', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangSlug', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getOriginalLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getServerProtocol');
        $out .= self::getDebugInfoRow('seo42::getBaseUrl');
        $out .= self::getDebugInfoRow('seo42::getServerUrl');
        $out .= self::getDebugInfoRow('seo42::getServer');
        $out .= self::getDebugInfoRow('seo42::getServerWithSubDir');
        $out .= self::getDebugInfoRow('seo42::getServerSubDir');
        $out .= self::getDebugInfoRow('seo42::isWwwServerUrl');
        $out .= self::getDebugInfoRow('seo42::hasTemplateBaseTag');
        $out .= self::getDebugInfoRow('seo42::isSubDirInstall');
        $out .= self::getDebugInfoRow('seo42::isMultiLangInstall');
        $out .= self::getDebugInfoRow('seo42::getLangCount');
        $out .= self::getDebugInfoRow('seo42::getTitleDelimiter');
        $out .= self::getDebugInfoRow('seo42::getUrlStart');
        $out .= self::getDebugInfoRow('seo42::has404ResponseFlag');
        $out .= self::getDebugInfoRow('seo42::getQueryString');
        $out .= self::getDebugInfoRow('seo42::getMediaDir');
        $out .= self::getDebugInfoRow('seo42::getMediaDirName');
        $out .= self::getDebugInfoRow('seo42::getMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaUrl', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getAbsoluteMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaAddonDir');
        $out .= self::getDebugInfoRow('seo42::getLangTags');
        $out .= self::getDebugInfoRow('seo42::getHtml');
        $out .= self::getDebugInfoRow('seo42::getImageTag', array('image.png', 'rex_mediapool_detail', '150', '100'));
        $out .= self::getDebugInfoRow('seo42::getImageManagerFile', array('image.png', 'rex_mediapool_detail'));
        $out .= self::getDebugInfoRow('seo42::getDownloadFile', array('doc.pdf'));
        $out .= self::getDebugInfoRow('seo42::getUrlString', array("The Hitchhiker's Guide to the Galaxy!"));
        $out .= self::getDebugInfoRow('seo42::getAnswer');
        $out .= '</table>';
        // settings
        $out .= '<h2>Settings</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['ADDON']['seo42']['settings'], true);
        $out .= '</pre>';
        // cached redirects
        $out .= '<h2>Cached Redirects</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['SEO42_CACHED_REDIRECTS'], true);
        $out .= '</pre>';
        // pathlist
        $out .= '<h2>Pathlist</h2>';
        $pathlistRoot = SEO42_PATHLIST;
        if (file_exists($pathlistRoot)) {
            $content = rex_get_file_contents($pathlistRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $pathlistRoot;
        }
        // .htaccess
        $out .= '<h2>.htaccess</h2>';
        $htaccessRoot = $REX['FRONTEND_PATH'] . '/.htaccess';
        if (file_exists($htaccessRoot)) {
            $content = rex_get_file_contents($htaccessRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $htaccessRoot;
        }
        $out .= '<h1>---------- SEO42 DEBUG END ----------</h1>';
        $out .= '</div>';
//.........这里部分代码省略.........
开发者ID:ReggaePanda,项目名称:seo42,代码行数:101,代码来源:class.seo42.inc.php

示例13: rex_highlight_string

    <?php 
echo $I18N->msg('tinymce_help_module_input');
?>
    </p>
    <?php 
rex_highlight_string(rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/tinymce/modul_input.txt'));
?>
  </div>

</div>

<div class="rex-addon-output">

  <h2 class="rex-hl2"><?php 
echo $I18N->msg('tinymce_title_module_output');
?>
</h2>

  <div class="rex-addon-content">
    <p class="rex-tx1">
    <?php 
echo $I18N->msg('tinymce_help_module_output');
?>
    </p>
    <?php 
rex_highlight_string(rex_get_file_contents($REX['INCLUDE_PATH'] . '/addons/tinymce/modul_output.txt'));
?>
  </div>

</div>
开发者ID:nightstomp,项目名称:tinymce,代码行数:30,代码来源:help.inc.php

示例14: rex_replace_dynamic_contents

function rex_replace_dynamic_contents($path, $content)
{
    if (file_exists($path) && ($fcontent = rex_get_file_contents($path))) {
        $content = "// --- DYN\n" . trim($content) . "\n// --- /DYN";
        $fcontent = preg_replace("@(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)@s", $content, $fcontent, -1, $count);
        return $count && rex_put_file_contents($path, $fcontent);
    }
    return false;
}
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:9,代码来源:function_rex_other.inc.php

示例15: rex_a1_export_db


//.........这里部分代码省略.........
    if (!is_object($I18N)) {
        $I18N = rex_create_lang($REX['LANG']);
    }
    $sql = rex_sql::factory();
    $nl = "\n";
    $insertSize = 5000;
    // ----- EXTENSION POINT
    rex_register_extension_point('A1_BEFORE_DB_EXPORT');
    // Versionsstempel hinzufügen
    fwrite($fp, '## Redaxo Database Dump Version ' . $REX['VERSION'] . $nl);
    fwrite($fp, '## Prefix ' . $REX['TABLE_PREFIX'] . $nl);
    fwrite($fp, '## charset ' . $I18N->msg('htmlcharset') . $nl . $nl);
    //  fwrite($fp, '/*!40110 START TRANSACTION; */'.$nl);
    if (is_null($tables)) {
        $tables = array();
        foreach (rex_sql::showTables(1, $REX['TABLE_PREFIX']) as $table) {
            if ($table != $REX['TABLE_PREFIX'] . 'user' && substr($table, 0, strlen($REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX'])) != $REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX']) {
                // Tabellen die mit rex_tmp_ beginnne, werden nicht exportiert!
                $tables[] = $table;
            }
        }
    }
    foreach ($tables as $table) {
        //---- export metadata
        $create = rex_sql::showCreateTable($table);
        fwrite($fp, "DROP TABLE IF EXISTS `{$table}`;\n");
        fwrite($fp, "{$create};\n");
        $fields = $sql->getArray("SHOW FIELDS FROM `{$table}`");
        foreach ($fields as $idx => $field) {
            if (preg_match('#^(bigint|int|smallint|mediumint|tinyint|timestamp)#i', $field['Type'])) {
                $fields[$idx] = 'int';
            } elseif (preg_match('#^(float|double|decimal)#', $field['Type'])) {
                $fields[$idx] = 'double';
            } elseif (preg_match('#^(char|varchar|text|longtext|mediumtext|tinytext)#', $field['Type'])) {
                $fields[$idx] = 'string';
            }
            // else ?
        }
        //---- export tabledata
        $start = 0;
        $max = $insertSize;
        do {
            $sql->freeResult();
            $sql->setQuery("SELECT * FROM `{$table}` LIMIT {$start},{$max}");
            if ($sql->getRows() > 0 && $start == 0) {
                fwrite($fp, "\nLOCK TABLES `{$table}` WRITE;");
                fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` DISABLE KEYS */;");
            } elseif ($sql->getRows() == 0) {
                break;
            }
            $start += $max;
            $values = array();
            while ($sql->hasNext()) {
                $record = array();
                foreach ($fields as $idx => $type) {
                    $column = $sql->getValue($idx);
                    switch ($type) {
                        case 'int':
                            $record[] = intval($column);
                            break;
                        case 'double':
                            $record[] = sprintf('%.10F', (double) $column);
                            break;
                        case 'string':
                        default:
                            $record[] = $sql->escape($column, "'", true);
                            break;
                    }
                }
                $values[] = $nl . '  (' . implode(',', $record) . ')';
                $sql->next();
            }
            if (!empty($values)) {
                $values = implode(',', $values);
                fwrite($fp, "\nINSERT INTO `{$table}` VALUES {$values};");
                unset($values);
            }
        } while ($sql->getRows() >= $max);
        if ($start > 0) {
            fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;");
            fwrite($fp, "\nUNLOCK TABLES;\n\n");
        }
    }
    fclose($fp);
    $hasContent = true;
    // Den Dateiinhalt geben wir nur dann weiter, wenn es unbedingt notwendig ist.
    if (rex_extension_is_registered('A1_AFTER_DB_EXPORT')) {
        $content = rex_get_file_contents($filename);
        $hashBefore = md5($content);
        // ----- EXTENSION POINT
        $content = rex_register_extension_point('A1_AFTER_DB_EXPORT', $content);
        $hashAfter = md5($content);
        if ($hashAfter != $hashBefore) {
            rex_put_file_contents($filename, $content);
            $hasContent = !empty($content);
            unset($content);
        }
    }
    return $hasContent;
}
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:101,代码来源:function_import_export.inc.php


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