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


PHP rex_file类代码示例

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


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

示例1: 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

示例2: focus_setup_metainfo

function focus_setup_metainfo()
{
    global $REX;
    if (!isset($REX['USER'])) {
        return;
    }
    $install_metas = array('med_focuspoint_data' => array('Focuspoint Data', 'med_focuspoint_data', 200, '', 1, '', '', '', ''), 'med_focuspoint_css' => array('Focuspoint CSS', 'med_focuspoint_css', 201, '', 1, '', '', '', ''));
    $db = new rex_sql();
    foreach ($db->getDbArray('SHOW COLUMNS FROM `rex_file` LIKE \'med_focuspoint_%\';') as $column) {
        unset($install_metas[$column['Field']]);
    }
    foreach ($install_metas as $k => $v) {
        $db->setQuery('SELECT `name` FROM `rex_62_params` WHERE `name`=\'' . $k . '\';');
        if ($db->getRows() > 0) {
            // FIELD KNOWN TO METAINFO BUT MISSING IN ARTICLE..
            $db->setQuery('ALTER TABLE `rex_file` ADD `' . $k . '` TEXT NOT NULL;');
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde repariert.');
            }
        } else {
            if (!function_exists('a62_add_field')) {
                require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/functions/function_metainfo.inc.php';
            }
            a62_add_field($v[0], $v[1], $v[2], $v[3], $v[4], $v[5], $v[6], $v[7], $v[8]);
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde angelegt.');
            }
        }
    }
    rex_file::copy(rex_path::addon("focuspoint", "classes/class.rex_effect_focuspoint_resize.inc.php"), rex_path::addon("image_manager", "classes/effects/class.rex_effect_focuspoint_resize.inc.php"));
}
开发者ID:olien,项目名称:rex_focuspoint,代码行数:31,代码来源:install.inc.php

示例3: 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;
     }
     // 3 slashes needed to sidestep some server url include protections
     // example: https://www.strato.de/faq/article/622/Warum-erhalte-ich-über-PHP-die-Fehlermeldung-%22Warning:-main()-…:-include(….).html
     $path = 'rex:///' . $path;
     self::$nextContent[$path] = $content;
     return $path;
 }
开发者ID:redaxo,项目名称:redaxo,代码行数:39,代码来源:stream.php

示例4: execute

 public function execute()
 {
     global $I18N;
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', array(array('upload_file', 'bool'), array('oldversion', 'string'), array('redaxo', 'array[string]'), array('description', 'string'), array('status', 'int'), array('replace_assets', 'bool'), array('ignore_tests', 'bool')));
     $file = array();
     $archive = null;
     $file['version'] = $upload['upload_file'] ? OOAddon::getVersion($addonkey) : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = stripslashes($upload['description']);
     $file['status'] = $upload['status'];
     if ($upload['upload_file']) {
         $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
         $exclude = array();
         if ($upload['replace_assets']) {
             $exclude[] = 'files';
         }
         if ($upload['ignore_tests']) {
             $exclude[] = 'tests';
         }
         rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
         if ($upload['replace_assets']) {
             rex_install_archive::copyDirToArchive(rex_path::addonAssets($addonkey), $archive, $addonkey . '/files');
         }
         $file['checksum'] = md5_file($archive);
     }
     rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), array('file' => $file), $archive);
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return $I18N->msg('install_info_addon_uploaded', $addonkey);
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:35,代码来源:api_package_upload.php

示例5: replaceVars

 static function replaceVars($template, $er = array())
 {
     $r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_REPLACEVARS', ['template' => $template, 'search_replace' => $er, 'status' => false]));
     $template = $r['template'];
     $er = $r['search_replace'];
     $status = $r['status'];
     if ($status) {
         return true;
     }
     $er['REX_SERVER'] = rex::getServer();
     $er['REX_ERROR_EMAIL'] = rex::getErrorEmail();
     $er['REX_SERVERNAME'] = rex::getServerName();
     $er['REX_NOTFOUND_ARTICLE_ID'] = rex_article::getNotfoundArticleId();
     $er['REX_ARTICLE_ID'] = rex_article::getCurrentId();
     $template['body'] = rex_var::parse($template['body'], '', 'yform_email_template', $er);
     $template['body_html'] = rex_var::parse($template['body_html'], '', 'yform_email_template', $er);
     // rex_vars bug: sonst wird der Zeilenumbruch entfernt - wenn DATA_VAR am Ende einer Zeile
     if (rex_string::versionCompare(rex::getVersion(), '5.0.1', '<')) {
         $template['body'] = str_replace("?>\r", "?>\r\n\r", $template['body']);
         $template['body'] = str_replace("?>\n", "?>\n\r\n", $template['body']);
         $template['body_html'] = str_replace("?>\r", "?>\r\n\r", $template['body_html']);
         $template['body_html'] = str_replace("?>\n", "?>\n\r\n", $template['body_html']);
     }
     $template['body'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body', $template['body']));
     $template['body_html'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body_html', $template['body_html']));
     return $template;
 }
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:27,代码来源:yform_email_template.php

示例6: deleteCache

 public function deleteCache()
 {
     if ($this->id < 1) {
         return false;
     }
     $file = $this->getFilePath($this->getId());
     rex_file::delete($file);
     return true;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:9,代码来源:api_template.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: execute

 public function execute()
 {
     // error_reporting(E_ALL);ini_set("display_errors",1);
     if (!isset(self::$convert_to[$this->params['convert_to']])) {
         $convert_to = self::$convert_to[self::$convert_to_default];
     } else {
         $convert_to = self::$convert_to[$this->params['convert_to']];
     }
     $density = (int) $this->params['density'];
     if (!in_array($density, self::$densities)) {
         $density = self::$density_default;
     }
     $from_path = realpath($this->media->getMediapath());
     $ext = rex_file::extension($from_path);
     if (!$ext) {
         return;
     }
     if (!in_array(strtolower($ext), self::$convert_types)) {
         return;
     }
     $convert_path = self::getConvertPath();
     if ($convert_path == '') {
         return;
     }
     $filename = $this->media->getMediaFilename();
     $filename_wo_ext = substr($filename, 0, strlen($filename) - strlen($ext));
     $to_path = rex_path::addonCache('media_manager', 'media_manager__convert2img_' . md5($this->media->getMediapath()) . '_' . $filename_wo_ext . $convert_to['ext']);
     $cmd = $convert_path . ' -density ' . $density . ' "' . $from_path . '[0]" -colorspace RGB "' . $to_path . '"';
     exec($cmd, $out, $ret);
     if ($ret != 0) {
         return false;
     }
     $image_src = call_user_func($convert_to['createfunc'], $to_path);
     if (!$image_src) {
         return;
     }
     $this->media->setImage($image_src);
     $this->media->refreshImageDimensions();
     $this->media->setFormat($convert_to['ext']);
     $this->media->setMediaFilename($filename);
     $this->media->setHeader('Content-Type', $convert_to['content-type']);
     unlink($to_path);
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:43,代码来源:effect_convert2img.php

示例12: execute

 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $addonkey = rex_request('addonkey', 'string');
     $upload = rex_request('upload', [['upload_file', 'bool'], ['oldversion', 'string'], ['redaxo', 'array[string]'], ['description', 'string'], ['status', 'int'], ['replace_assets', 'bool'], ['ignore_tests', 'bool']]);
     $file = [];
     $archive = null;
     $file['version'] = $upload['upload_file'] ? rex_addon::get($addonkey)->getVersion() : $upload['oldversion'];
     $file['redaxo_versions'] = $upload['redaxo'];
     $file['description'] = $upload['description'];
     $file['status'] = $upload['status'];
     try {
         if ($upload['upload_file']) {
             $archive = rex_path::addonCache('install', md5($addonkey . time()) . '.zip');
             $exclude = [];
             if ($upload['replace_assets']) {
                 $exclude[] = 'assets';
             }
             if ($upload['ignore_tests']) {
                 $exclude[] = 'tests';
             }
             rex_install_archive::copyDirToArchive(rex_path::addon($addonkey), $archive, null, $exclude);
             if ($upload['replace_assets']) {
                 rex_install_archive::copyDirToArchive(rex_url::addonAssets($addonkey), $archive, $addonkey . '/assets');
             }
             $file['checksum'] = md5_file($archive);
         }
         rex_install_webservice::post(rex_install_packages::getPath('?package=' . $addonkey . '&file_id=' . rex_request('file', 'int', 0)), ['file' => $file], $archive);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     if ($archive) {
         rex_file::delete($archive);
     }
     unset($_REQUEST['addonkey']);
     unset($_REQUEST['file']);
     rex_install_packages::deleteCache();
     return new rex_api_result(true, rex_i18n::msg('install_info_addon_uploaded', $addonkey));
 }
开发者ID:staabm,项目名称:redaxo,代码行数:41,代码来源:api_package_upload.php

示例13: execute

 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('You do not have the permission!');
     }
     $this->addonkey = rex_request('addonkey', 'string');
     $function = static::GET_PACKAGES_FUNCTION;
     $packages = rex_install_packages::$function();
     $this->fileId = rex_request('file', 'int');
     if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
         return null;
     }
     $this->file = $packages[$this->addonkey]['files'][$this->fileId];
     $this->checkPreConditions();
     try {
         $archivefile = rex_install_webservice::getArchive($this->file['path']);
     } catch (rex_functional_exception $e) {
         throw new rex_api_exception($e->getMessage());
     }
     $message = '';
     $this->archive = $archivefile;
     if ($this->file['checksum'] != md5_file($archivefile)) {
         $message = rex_i18n::msg('install_warning_zip_wrong_checksum');
     } elseif (!$this->isCorrectFormat($archivefile)) {
         $message = rex_i18n::msg('install_warning_zip_wrong_format');
     } elseif (is_string($msg = $this->doAction())) {
         $message = $msg;
     }
     rex_file::delete($archivefile);
     if ($message) {
         $message = rex_i18n::msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
         $success = false;
     } else {
         $message = rex_i18n::msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="' . rex_url::backendPage('packages') . '">' . rex_i18n::msg('install_to_addon_page') . '</a>' : '');
         $success = true;
         unset($_REQUEST['addonkey']);
     }
     return new rex_api_result($success, $message);
 }
开发者ID:eaCe,项目名称:redaxo,代码行数:39,代码来源:api_package_download.php

示例14: execute

 public function execute()
 {
     global $I18N;
     $this->addonkey = rex_request('addonkey', 'string');
     $function = static::GET_PACKAGES_FUNCTION;
     $packages = rex_install_packages::$function();
     $this->fileId = rex_request('file', 'int');
     if (!isset($packages[$this->addonkey]['files'][$this->fileId])) {
         return null;
     }
     $this->file = $packages[$this->addonkey]['files'][$this->fileId];
     $this->checkPreConditions();
     $archivefile = rex_install_webservice::getArchive($this->file['path']);
     $message = '';
     $this->archive = $archivefile;
     if ($this->file['checksum'] != md5_file($archivefile)) {
         $message = $I18N->msg('install_warning_zip_wrong_checksum');
     } elseif (!file_exists("phar://{$archivefile}/" . $this->addonkey)) {
         $message = $I18N->msg('install_warning_zip_wrong_format');
     } elseif (is_string($msg = $this->doAction())) {
         $message = $msg;
     }
     rex_file::delete($archivefile);
     if ($message) {
         $message = $I18N->msg('install_warning_addon_not_' . static::VERB, $this->addonkey) . '<br />' . $message;
         $success = false;
     } else {
         $message = $I18N->msg('install_info_addon_' . static::VERB, $this->addonkey) . (static::SHOW_LINK ? ' <a href="index.php?page=addon">' . $I18N->msg('install_to_addon_page') . '</a>' : '');
         $success = true;
         unset($_REQUEST['addonkey']);
     }
     if ($success) {
         return $message;
     } else {
         throw new rex_install_functional_exception($message);
     }
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:37,代码来源:api_package_download.php

示例15: catch

        } catch (InvalidArgumentException $e) {
            $error[] = rex_i18n::msg($key . '_invalid');
        }
    }
    $config['debug'] = isset($settings['debug']) && $settings['debug'];
    rex::setProperty('debug', $config['debug']);
    foreach (rex_system_setting::getAll() as $setting) {
        $key = $setting->getKey();
        if (isset($settings[$key])) {
            if (($msg = $setting->setValue($settings[$key])) !== true) {
                $error[] = $msg;
            }
        }
    }
    if (empty($error)) {
        if (rex_file::putConfig($configFile, $config) > 0) {
            $success = rex_i18n::msg('info_updated');
        }
    }
}
$sel_lang = new rex_select();
$sel_lang->setStyle('class="form-control"');
$sel_lang->setName('settings[lang]');
$sel_lang->setId('rex-id-lang');
$sel_lang->setSize(1);
$sel_lang->setSelected(rex::getProperty('lang'));
foreach (rex_i18n::getLocales() as $l) {
    $sel_lang->addOption($l, $l);
}
if (!empty($error)) {
    echo rex_view::error(implode('<br />', $error));
开发者ID:staabm,项目名称:redaxo,代码行数:31,代码来源:system.settings.php


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