本文整理汇总了PHP中rex_path::addonData方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_path::addonData方法的具体用法?PHP rex_path::addonData怎么用?PHP rex_path::addonData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_path
的用法示例。
在下文中一共展示了rex_path::addonData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: doAction
public function doAction()
{
$path = rex_path::addon($this->addonkey);
$temppath = rex_path::addon('.new.' . $this->addonkey);
if (($msg = $this->extractArchiveTo($temppath)) !== true) {
return $msg;
}
if ($this->addon->isAvailable() && ($msg = $this->checkRequirements()) !== true) {
return $msg;
}
// ---- include update.php
if ($this->addon->isInstalled() && file_exists($temppath . rex_package::FILE_UPDATE)) {
try {
$this->addon->includeFile('../.new.' . $this->addonkey . '/' . rex_package::FILE_UPDATE);
} catch (rex_functional_exception $e) {
return $e->getMessage();
} catch (rex_sql_exception $e) {
return 'SQL error: ' . $e->getMessage();
}
if (($msg = $this->addon->getProperty('updatemsg', '')) != '') {
return $msg;
}
if (!$this->addon->getProperty('update', true)) {
return rex_i18n::msg('package_no_reason');
}
}
// ---- backup
$assets = $this->addon->getAssetsPath();
if (rex_addon::get('install')->getConfig('backups')) {
$archivePath = rex_path::addonData('install', $this->addonkey . '/');
rex_dir::create($archivePath);
$archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', $this->addon->getVersion('0'))) . '.zip';
rex_install_archive::copyDirToArchive($path, $archive);
if (is_dir($assets)) {
rex_install_archive::copyDirToArchive($assets, $archive, 'assets');
}
}
// ---- copy plugins to new addon dir
foreach ($this->addon->getRegisteredPlugins() as $plugin) {
$pluginPath = $temppath . '/plugins/' . $plugin->getName();
if (!is_dir($pluginPath)) {
rex_dir::copy($plugin->getPath(), $pluginPath);
} elseif ($plugin->isInstalled() && is_dir($pluginPath . '/assets')) {
rex_dir::copy($pluginPath . '/assets', $plugin->getAssetsPath());
}
}
// ---- update main addon dir
rex_dir::delete($path);
rename($temppath, $path);
// ---- update assets
$origAssets = $this->addon->getPath('assets');
if ($this->addon->isInstalled() && is_dir($origAssets)) {
rex_dir::copy($origAssets, $assets);
}
$this->addon->setProperty('version', $this->file['version']);
rex_install_packages::updatedPackage($this->addonkey, $this->fileId);
}
示例3: doAction
public function doAction()
{
global $I18N, $REX;
// $REX is needed for update.inc.php
$path = rex_path::addon($this->addonkey);
$temppath = rex_path::addon('.new.' . $this->addonkey);
if (($msg = $this->extractArchiveTo($temppath)) !== true) {
return $msg;
}
// ---- include update.php
if (file_exists($temppath . 'update.inc.php')) {
try {
require $temppath . 'update.inc.php';
} catch (rex_install_functional_exception $e) {
return $e->getMessage();
}
if (($msg = OOAddon::getProperty($this->addonkey, 'updatemsg', '')) != '') {
return $msg;
}
if (!OOAddon::getProperty($this->addonkey, 'update', true)) {
return $I18N->msg('package_no_reason');
}
}
// ---- backup
$assets = rex_path::addonAssets($this->addonkey);
if (OOAddon::getProperty('install', 'backups')) {
$archivePath = rex_path::addonData('install', $this->addonkey . '/');
rex_dir::create($archivePath);
$archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', OOAddon::getVersion($this->addonkey))) . '.zip';
rex_install_archive::copyDirToArchive($path, $archive);
if (is_dir($assets)) {
rex_install_archive::copyDirToArchive($assets, $archive, 'assets');
}
}
// ---- copy plugins to new addon dir
foreach (OOPlugin::getRegisteredPlugins($this->addonkey) as $plugin) {
$pluginPath = $temppath . '/plugins/' . $plugin;
if (!is_dir($pluginPath)) {
rex_dir::copy(rex_path::plugin($this->addonkey, $plugin), $pluginPath);
} elseif (OOPlugin::isInstalled($this->addonkey, $plugin) && is_dir($pluginPath . '/files')) {
rex_dir::copy($pluginPath . '/files', rex_path::pluginAssets($this->addonkey, $plugin));
}
}
// ---- update main addon dir
rex_dir::delete($path);
rename($temppath, $path);
// ---- update assets
$origAssets = rex_path::addon($this->addonkey, 'assets');
if (is_dir($origAssets)) {
rex_dir::copy($origAssets, $assets);
}
OOAddon::setProperty($this->addonkey, 'version', $this->file['version']);
rex_install_packages::updatedPackage($this->addonkey, $this->fileId);
}
示例4: readFolder
function readFolder($dir)
{
if (!is_dir($dir)) {
rex_dir::copy(rex_path::addon('import_export', 'backup'), rex_path::addonData('import_export', 'backups'));
}
$hdl = opendir($dir);
$folder = array();
while (false !== ($file = readdir($hdl))) {
$folder[] = $file;
}
return $folder;
}
示例5: log
public function log($success, $message)
{
$name = $this->name;
if (!$name) {
if ($this->cronjob instanceof rex_cronjob) {
$name = rex::isBackend() ? $this->cronjob->getTypeName() : $this->cronjob->getType();
} else {
$name = '[no name]';
}
}
$log = new rex_log_file(rex_path::addonData('cronjob', 'cronjob.log'), 2000000);
$data = [$success ? 'SUCCESS' : 'ERROR', $this->id ?: '--', $name, strip_tags($message)];
$log->add($data);
}
示例6: 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);
}
示例7: getImportDir
function getImportDir()
{
return rex_path::addonData('import_export', 'backups');
}
示例8: rex_post
<?php
/** @var i18n $I18N */
$content = '';
$settings = rex_post('settings', array(array('backups', 'bool', false), array('api_login', 'string'), array('api_key', 'string')), null);
if (is_array($settings)) {
$settingsContent = "<?php\n\n";
foreach ($settings as $key => $value) {
$settingsContent .= "\$REX['ADDON'][" . var_export($key, true) . "]['install'] = " . var_export($value, true) . ";\n";
OOAddon::setProperty('install', $key, $value);
}
if (rex_file::put(rex_path::addonData('install', 'settings.inc.php'), $settingsContent)) {
echo rex_info($I18N->msg('install_settings_saved'));
} else {
echo rex_warning($I18N->msg('install_settings_not_saved'));
}
rex_install_webservice::deleteCache();
}
$content .= '
<div class="rex-addon-output">
<h2 class="rex-hl2">' . $I18N->msg('install_subpage_settings') . '</h2>
<div class="rex-form">
<form action="index.php?page=install&subpage=settings" method="post">
<fieldset class="rex-form-col-1">
<legend>' . $I18N->msg('install_settings_general') . '</legend>
<div class="rex-form-wrapper">';
$content .= '
<div class="rex-form-row">
<p class="rex-form-col-a rex-form-checkbox rex-form-label-right">
示例9: rex_request
*/
echo rex_view::title(rex_i18n::msg('yform'));
$page = rex_request('page', 'string', '');
$yform = new rex_yform();
$yform->setHiddenField('page', $page);
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('hide_top_warning_messages', true);
$yform->setObjectparams('form_showformafterupdate', 1);
$yform->setValueField('upload', array('name' => 'importfile', 'label' => rex_i18n::msg('yform_manager_tableset_import_jsonimportfile'), 'max_size' => '1000', 'types' => '.json', 'required' => 1, 'messages' => array(rex_i18n::msg('yform_manager_table_importset_warning_min'), rex_i18n::msg('yform_manager_table_importset_warning_max'), rex_i18n::msg('yform_manager_table_importset_warning_type'), rex_i18n::msg('yform_manager_table_importset_warning_selectfile')), 'modus' => 'no_save', 'no_db' => 'no_db'));
$form = $yform->getForm();
if ($yform->objparams['actions_executed']) {
try {
$content = file_get_contents(rex_path::addonData('yform', 'uploads/' . $yform->objparams['value_pool']['email']['importfile']));
rex_yform_manager_table_api::importTablesets($content);
echo rex_view::success(rex_i18n::msg('yform_manager_tableset_import_success'));
} catch (Exception $e) {
echo rex_view::warning(rex_i18n::msg('yform_manager_tableset_import_failed', '', $e->getMessage()));
}
rex_file::delete(rex_path::addonData('yform', 'uploads/' . $yform->objparams['value_pool']['email']['importfile']));
} else {
if ($yform->objparams['send']) {
echo rex_view::warning(rex_i18n::msg('yform_manager_tableset_import_warning_selectfile'));
}
}
$fragment = new rex_fragment();
$fragment->setVar('class', 'edit', false);
$fragment->setVar('title', rex_i18n::msg('yform_manager_tableset_import'));
$fragment->setVar('body', $form, false);
// $fragment->setVar('buttons', $buttons, false);
$form = $fragment->parse('core/page/section.php');
echo $form;
示例10: getPath
public function getPath($file = '')
{
return rex_path::addonData('tests', 'rex_finder_test/' . $file);
}
示例11: init
/**
* set all necessary information about the addon
* @param $folder
* @param $table
* @param $tableCategory
*/
public static function init($folder, $table, $tableCategory)
{
global $REX;
self::$folderName = $folder;
self::$tableName = $REX['TABLE_PREFIX'] . $table;
self::$tableNameCategory = $REX['TABLE_PREFIX'] . $tableCategory;
self::$defaultConfigFile = rex_path::addon(self::$folderName, 'data/config.json');
self::$configFile = rex_path::addonData(self::$folderName, 'config.json');
self::$defaultConfig = json_decode(file_get_contents(self::$defaultConfigFile), true);
self::$config = json_decode(file_get_contents(self::$configFile), true);
self::setBaseUrl();
}
示例12:
<?php
rex_dir::copy(__DIR__ . '/backup', rex_path::addonData('import_export', 'backups'));
$REX['ADDON']['install']['import_export'] = 1;
// ERRMSG IN CASE: $REX[ADDON][installmsg]["import_export"] = "Leider konnte nichts installiert werden da.";
示例13: array
<?php
/** @var i18n $I18N */
$mypage = 'install';
$REX['ADDON']['version'][$mypage] = '1.0.1';
$REX['ADDON']['author'][$mypage] = 'Gregor Harlan';
$REX['ADDON']['supportpage'][$mypage] = 'redaxo.org/de/forum';
if ($REX['REDAXO']) {
$I18N->appendFile(__DIR__ . '/lang/');
$REX['ADDON']['name'][$mypage] = $I18N->msg('install_title');
$REX['ADDON']['perm'][$mypage] = 'admin[]';
$REX['ADDON']['navigation'][$mypage]['block'] = 'system';
$REX['ADDON']['pages'][$mypage] = array(array('', $I18N->msg('install_subpage_update')), array('add', $I18N->msg('install_subpage_add')), array('upload', $I18N->msg('install_subpage_upload')), array('settings', $I18N->msg('install_subpage_settings')));
$REX['ADDON']['backups']['install'] = false;
$REX['ADDON']['api_login']['install'] = '';
$REX['ADDON']['api_key']['install'] = '';
$settings = rex_path::addonData('install', 'settings.inc.php');
if (file_exists($settings)) {
include $settings;
}
}
示例14: rex_request
<?php
/**
* image_manager Addon
*
* @author markus.staab[at]redaxo[dot]de Markus Staab
* @author jan.kristinus[at]yakmara[dot]de Jan Kristinus
*
* @package redaxo4
* @version svn:$Id$
*/
// rex_request();
$func = rex_request('func', 'string');
$jpg_quality = rex_request('jpg_quality', 'int');
$old_syntax = rex_request('old_syntax', 'int');
$config_file = rex_path::addonData('image_manager', 'settings.inc.php');
if ($func == 'update') {
if ($jpg_quality > 100) {
$jpg_quality = 100;
} elseif ($jpg_quality < 0) {
$jpg_quality = 0;
}
$REX['ADDON']['image_manager']['jpg_quality'] = $jpg_quality;
$content = '<?php
$REX[\'ADDON\'][\'image_manager\'][\'jpg_quality\'] = ' . $jpg_quality . ';
';
if (rex_file::put($config_file, $content) !== false) {
echo rex_info($I18N->msg('imanager_config_saved'));
} else {
echo rex_warning($I18N->msg('imanager_config_not_saved'));
示例15: rex_register_extension
<?php
$REX['ADDON']['yform']['templatepaths'][] = $REX['INCLUDE_PATH'] . '/addons/yform/templates/';
rex_register_extension('ADDONS_INCLUDED', function () {
$REX['ADDON']['yform']['templatepaths'][] = rex_path::addonData('yform', 'templates/');
}, array(), REX_EXTENSION_EARLY);
include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_radio.inc.php';
include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_yform_list.inc.php';
include_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/basic/class.rex_yform.inc.php';
if ($REX['REDAXO'] && $REX['USER']) {
rex_i18n::msgappendFile($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/');
$REX['ADDON'][$mypage]['SUBPAGES'] = array();
$REX['ADDON'][$mypage]['SUBPAGES'][] = array('', rex_i18n::msg('yform_overview'));
if (rex::getUser()->isAdmin()) {
$REX['ADDON'][$mypage]['SUBPAGES'][] = array('description', rex_i18n::msg('yform_description'));
}
function rex_yform_css($params)
{
$params['subject'] .= "\n " . '<link rel="stylesheet" type="text/css" href="../files/addons/yform/yform.css" media="screen, projection, print" />';
$params['subject'] .= "\n " . '<script src="../files/addons/yform/manager.js" type="text/javascript"></script>';
if ($REX['REDAXO']) {
$params['subject'] .= "\n " . '<link rel="stylesheet" type="text/css" href="../files/addons/yform/manager.css" media="screen, projection, print" />';
}
return $params['subject'];
}
rex_register_extension('PAGE_HEADER', 'rex_yform_css');
}