本文整理汇总了PHP中rex_path类的典型用法代码示例。如果您正苦于以下问题:PHP rex_path类的具体用法?PHP rex_path怎么用?PHP rex_path使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_path类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: getArticle
public function getArticle($curctype = -1)
{
// bc
if ($this->viasql) {
return parent::getArticle($curctype);
}
$this->ctype = $curctype;
if (!$this->getSlice && $this->article_id != 0) {
// ----- start: article caching
ob_start();
ob_implicit_flush(0);
$article_content_file = rex_path::addonCache('structure', $this->article_id . '.' . $this->clang . '.content');
if (!file_exists($article_content_file)) {
$generated = rex_content_service::generateArticleContent($this->article_id, $this->clang);
if ($generated !== true) {
// fehlermeldung ausgeben
echo $generated;
}
}
if (file_exists($article_content_file)) {
require $article_content_file;
}
// ----- end: article caching
$CONTENT = ob_get_contents();
ob_end_clean();
} else {
// Inhalt ueber sql generierens
$CONTENT = parent::getArticle($curctype);
}
$CONTENT = rex_extension::registerPoint(new rex_extension_point('ART_CONTENT', $CONTENT, ['ctype' => $curctype, 'article' => $this]));
return $CONTENT;
}
示例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;
}
示例4: testAbsoluteConversion
public function testAbsoluteConversion()
{
$path = rex_path::absolute('c:/abc/../def/./xy');
$this->assertEquals($this->path('c:/def/xy'), $path, 'resolves .. and .');
$path = rex_path::absolute('c:\\abc\\..\\def\\.\\xy');
$this->assertEquals($this->path('c:\\def\\xy'), $path, 'resolves .. and .');
}
示例5: execute
public function execute()
{
if ($this->params['mediapath'] != '') {
$media_path = rex_path::frontend($this->params['mediapath'] . '/' . rex_media_manager::getMediaFile());
$this->media->setMediapath($media_path);
}
}
示例6: 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"));
}
示例7: checkFilesystem
/**
* checks permissions of all required filesystem resources.
*
* @return array An array of error messages
*/
public static function checkFilesystem()
{
// -------------------------- SCHREIBRECHTE
$writables = [rex_path::media(), rex_path::assets(), rex_path::cache(), rex_path::data(), rex_path::src()];
$func = function ($dir) use(&$func) {
if (!rex_dir::isWritable($dir)) {
return ['setup_304' => [$dir]];
}
$res = [];
foreach (rex_finder::factory($dir) as $path => $file) {
if ($file->isDir()) {
$res = array_merge_recursive($res, $func($path));
} elseif (!$file->isWritable()) {
$res['setup_305'][] = $path;
}
}
return $res;
};
$res = [];
foreach ($writables as $dir) {
if (@is_dir($dir)) {
$res = array_merge_recursive($res, $func($dir));
} else {
$res['setup_306'][] = $dir;
}
}
return $res;
}
示例8: rex_mailer
function rex_mailer()
{
global $REX;
$this->From = 'from@example.com';
$this->FromName = 'Mailer';
$this->ConfirmReadingTo = '';
$this->AdminBcc = '';
$this->Mailer = 'mail';
$this->Host = 'localhost';
$this->Port = 25;
$this->CharSet = 'utf-8';
$this->WordWrap = 120;
$this->Encoding = '8bit';
$this->Priority = 3;
$this->SMTPSecure = '';
$this->SMTPAuth = false;
$this->Username = '';
$this->Password = '';
$settings = rex_path::addonData('phpmailer', 'settings.inc.php');
if (file_exists($settings)) {
include $settings;
}
$this->PluginDir = $REX['INCLUDE_PATH'] . '/addons/phpmailer/classes/';
if ($this->AdminBcc !== '') {
parent::AddBCC($this->AdminBcc);
}
}
示例9: __construct
public function __construct()
{
$this->root_dir = rex_path::addon('be_style');
$this->scss_file = rex_path::addon('be_style', 'assets') . 'styles.scss';
$this->css_file = rex_path::addon('be_style', 'assets') . 'styles.css';
$this->formatter = 'scss_formatter_compressed';
$this->strip_comments = true;
}
示例10: __construct
public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
{
parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
if (OOAddon::isAvailable('metainfo')) {
require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
$this->sqlFields = _rex_a62_metainfo_sqlfields(global_settings_metainfo::PREFIX, '');
}
}
示例11: doAction
protected function doAction()
{
if (($msg = $this->extractArchiveTo(rex_path::addon($this->addonkey))) !== true) {
return $msg;
}
rex_package_manager::synchronizeWithFileSystem();
rex_install_packages::addedPackage($this->addonkey);
}
示例12: __construct
public function __construct($tableName, $fieldset, $whereCondition, $method = 'post', $debug = false)
{
parent::rex_form($tableName, $fieldset, $whereCondition, $method, $debug);
if (OOAddon::isAvailable('metainfo')) {
require_once rex_path::addon('metainfo', 'extensions/extension_art_metainfo.inc.php');
$sqlCols = rex_asd_news_config::getConfig('sql');
$this->sqlFields = _rex_a62_metainfo_sqlfields('asd_', 'AND (`p`.`restrictions` = "" OR p.`restrictions` LIKE "%|' . $this->getValue($sqlCols['category']) . '|%") ');
}
}
示例13: executeAction
function executeAction()
{
$template_name = $this->getElement(2);
if ($etpl = rex_yform_email_template::getTemplate($template_name)) {
$mail_to = rex::getErrorEmail();
if ($this->getElement(3) != false && $this->getElement(3) != '') {
foreach ($this->params['value_pool']['email'] as $key => $value) {
if ($this->getElement(3) == $key) {
$mail_to = $value;
break;
}
}
}
// ---- fix mailto from definition
if ($this->getElement(4) != false && $this->getElement(4) != '') {
$mail_to = $this->getElement(4);
}
if ($this->params['debug']) {
echo '<hr /><pre>';
var_dump($etpl);
echo '</pre><hr />';
}
$etpl = rex_yform_email_template::replaceVars($etpl, $this->params['value_pool']['email']);
if ($this->params['debug']) {
echo '<hr /><pre>';
var_dump($etpl);
echo '</pre><hr />';
}
$etpl['mail_to'] = $mail_to;
$etpl['mail_to_name'] = $mail_to;
if ($etpl['attachments'] != '') {
$f = explode(',', $etpl['attachments']);
$etpl['attachments'] = array();
foreach ($f as $v) {
$etpl['attachments'][] = array('name' => $v, 'path' => rex_path::media($v));
}
} else {
$etpl['attachments'] = array();
}
if (!rex_yform_email_template::sendMail($etpl, $template_name)) {
if ($this->params['debug']) {
echo 'email could be sent';
}
return false;
} else {
if ($this->params['debug']) {
echo 'email sent';
}
return true;
}
} else {
if ($this->params['debug']) {
echo '<p>Template: "' . htmlspecialchars($template_name) . '" not found';
}
}
return false;
}
示例14: defaultLocator
public static function defaultLocator()
{
$locator = new self();
$locator->addTestFolder(rex_path::core(self::TESTS_FOLDER));
foreach (rex_package::getAvailablePackages() as $package) {
$locator->addTestFolder($package->getPath(self::TESTS_FOLDER));
}
return $locator;
}
示例15: rex_delete_cache
/**
* Deletes the cache.
*
* @package redaxo\core
*/
function rex_delete_cache()
{
// close logger, so the logfile can also be deleted
rex_logger::close();
$finder = rex_finder::factory(rex_path::cache())->recursive()->childFirst()->ignoreFiles(['.htaccess', '.redaxo'], false)->ignoreSystemStuff(false);
rex_dir::deleteIterator($finder);
rex_clang::reset();
// ----- EXTENSION POINT
return rex_extension::registerPoint(new rex_extension_point('CACHE_DELETED', rex_i18n::msg('delete_cache_message')));
}