public function getField() { $field = new rex_form_widget_linkmap_element(); $field->setAttribute('class', 'rex-form-widget'); $field->setLabel(rex_i18n::msg('system_setting_' . $this->key)); $field->setValue(rex_config::get('structure', $this->key, 1)); return $field; }
public function testRemoveNamespace() { rex_config::set('test-ns', 'mykey1', 'myvalA'); rex_config::set('test-ns', 'mykey2', 'myvalB'); rex_config::removeNamespace('test-ns'); $this->assertFalse(rex_config::has('test-ns'), 'removeNamespace() removes the whole namespace'); $this->assertFalse(rex_config::has('test-ns', 'mykey1'), 'removeNamespace() all keys1'); $this->assertFalse(rex_config::has('test-ns', 'mykey2'), 'removeNamespace() all keys2'); $this->assertNull(rex_config::get('test-ns', 'mykey1'), 'removeNamespace() all keys1'); $this->assertNull(rex_config::get('test-ns', 'mykey2'), 'removeNamespace() all keys2'); }
public function asImage() { if ($this->asImage) { return; } $this->asImage = true; $this->image = []; $this->image['format'] = strtolower(rex_file::extension($this->getMediapath())); $this->image['src'] = false; // if mimetype detected and in imagemap -> change format if (class_exists('finfo') && ($finfo = new finfo(FILEINFO_MIME_TYPE))) { if ($ftype = @$finfo->file($this->image['filepath'])) { if (array_key_exists($ftype, $this->mimetypeMap)) { $this->image['format'] = $this->mimetypeMap[$ftype]; } } } if ($this->image['format'] == 'jpg' || $this->image['format'] == 'jpeg') { $this->image['format'] = 'jpeg'; $this->image['quality'] = rex_config::get('media_manager', 'jpg_quality', 80); $this->image['src'] = @imagecreatefromjpeg($this->getMediapath()); } elseif ($this->image['format'] == 'gif') { $this->image['src'] = @imagecreatefromgif($this->getMediapath()); } elseif ($this->image['format'] == 'wbmp') { $this->image['src'] = @imagecreatefromwbmp($this->getMediapath()); } else { $this->image['src'] = @imagecreatefrompng($this->getMediapath()); imagealphablending($this->image['src'], false); imagesavealpha($this->img['src'], true); $this->image['format'] = 'png'; } if (!$this->image['src']) { $this->setMediapath(rex_path::addon('media_manager', 'media/warning.jpg')); $this->asImage(); } else { $this->refreshImageDimensions(); } }
/** * {@inheritdoc} */ public function getConfig($key = null, $default = null) { return rex_config::get($this->getPackageId(), $key, $default); }
public static function checkPermissions($ep) { $AddonPerm = rex_config::get('slice_ui'); $article = rex_sql::factory(); // $article->setDebug(); $articleTable = rex::getTablePrefix() . 'article'; $article->setTable($articleTable); // $article->setDebug(); $article->setQuery(' SELECT article.*, template.attributes as template_attributes FROM ' . rex::getTablePrefix() . 'article as article LEFT JOIN ' . rex::getTablePrefix() . 'template as template ON template.id=article.template_id WHERE article.id = ? AND clang_id = ?', array($ep['article_id'], $ep['clang'])); $ctype = 1; if ($c = rex_request('ctype')) { $ctype = $c; } $template_attributes = json_decode($article->getValue('template_attributes'), 1); if ($template_attributes === null) { $template_attributes = array(); } $AddonPerm['ctypes'] = $AddonPerm['ctypes'][$article->getValue('template_id')]; if (!rex_template::hasModule($template_attributes, $ep['ctype'], $ep['module_id'])) { return false; } elseif (!(rex::getUser()->isAdmin() || rex::getUser()->hasPerm('module[' . $ep['module_id'] . ']') || rex::getUser()->hasPerm('module[0]'))) { return false; } if (strpos(rex_get('page', 'string'), 'content/paste') === false) { if (!empty($AddonPerm['modules']) && !in_array('all', $AddonPerm['modules']) && !in_array($ep['module_id'], $AddonPerm['modules']) || !empty($AddonPerm['ctypes']) && !in_array('all', $AddonPerm['ctypes']) && !in_array($ep['ctype'], $AddonPerm['ctypes'])) { return false; } } return true; }
public static function getDefaultId() { return rex_config::get('structure/content', 'default_template_id', 1); }
public static function isClangSwitchMode() { return \rex_config::get('sprog', 'wildcard_clang_switch', '1') == 1 ? true : false; }
protected function getImageSource() { ob_start(); if ($this->image['format'] == 'jpg' || $this->image['format'] == 'jpeg') { $this->image['quality'] = rex_config::get('media_manager', 'jpg_quality', 80); imagejpeg($this->image['src'], null, $this->image['quality']); } elseif ($this->image['format'] == 'png') { imagepng($this->image['src']); } elseif ($this->image['format'] == 'gif') { imagegif($this->image['src']); } elseif ($this->image['format'] == 'wbmp') { imagewbmp($this->image['src']); } $src = ob_get_contents(); ob_end_clean(); return $src; }
<?php $Config = rex_config::get('slice_ui'); if (empty($_SESSION['slice_ui'])) { slice_ui::emptyClipboard(1); } rex_extension::register('PAGE_BODY_ATTR', function ($ep) { $Subject = $ep->getSubject(); if ($_SESSION['slice_ui']['slice_id'] != 0) { $Subject['class'][] = 'copy'; } return $Subject; }); if (rex::isBackend() && is_object(rex::getUser())) { rex_perm::register('copy[]'); rex_perm::register('slice_ui[]', null, rex_perm::OPTIONS); rex_perm::register('slice_ui[settings]', null, rex_perm::OPTIONS); } if (rex::isBackend()) { rex_view::addCssFile($this->getAssetsUrl('slice_ui.css')); rex_view::addCssFile($this->getAssetsUrl('jquery-ui.datepicker.css')); rex_view::addJsFile($this->getAssetsUrl('slice_ui.js')); rex_view::addJsFile($this->getAssetsUrl('jquery-ui.datepicker.js')); } if (rex_post('update_slice_status') != 1 && rex_get('function') == '') { rex_extension::register('SLICE_SHOW', 'slice_ui::extendBackendSlices'); } rex_extension::register('SLICE_SHOW', 'slice_ui::isActive'); if (strpos(rex_request('page'), 'content/emptyclipboard') !== false) { slice_ui::emptyClipboard(); }
<?php /** @var rex_addon $this */ if (rex_string::versionCompare($this->getVersion(), '2.0.1', '<') && rex_config::has('install')) { rex_file::putCache($this->getDataPath('config.json'), rex_config::get('install')); rex_config::removeNamespace('install'); }
/** * @see rex_config::get() */ public static function getConfig($key = null, $default = null) { return rex_config::get(self::CONFIG_NAMESPACE, $key, $default); }