本文整理汇总了PHP中OOAddon类的典型用法代码示例。如果您正苦于以下问题:PHP OOAddon类的具体用法?PHP OOAddon怎么用?PHP OOAddon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OOAddon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rex_a256_search_mpool_query
function rex_a256_search_mpool_query($params)
{
global $REX;
if (!$REX['USER']->hasPerm('be_search[mediapool]')) {
return $params['subject'];
}
$media_name = rex_request('a256_media_name', 'string');
if ($media_name == '') {
return $params['subject'];
}
$qry = $params['subject'];
$category_id = $params['category_id'];
$qry = str_replace('f.category_id=' . $category_id, '1=1', $qry);
$where = " (f.filename LIKE '%" . $media_name . "%' OR f.title LIKE '%" . $media_name . "%')";
$searchmode = OOAddon::getProperty('be_search', 'searchmode', 'local');
// global search - all
if ($searchmode == 'global') {
$qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry);
return $qry;
// local search - all categories and with no category
} elseif ($category_id == 0) {
$qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry);
// local search - categorie and subcategories
} else {
$where .= ' AND f.category_id = c.id ';
$where .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ') ';
$qry = str_replace('FROM ', 'FROM ' . $REX['TABLE_PREFIX'] . 'file_category c,', $qry);
$qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry);
}
return $qry;
}
示例2: rex_a256_search_mpool_query
function rex_a256_search_mpool_query($params)
{
global $REX;
if (!$REX['USER']->hasPerm('be_search[mediapool]')) {
return $params['subject'];
}
$media_name = rex_request('a256_media_name', 'string');
if ($media_name == '') {
return $params['subject'];
}
$qry = $params['subject'];
$category_id = $params['category_id'];
$where = " f.category_id = c.id AND (f.filename LIKE '%" . $media_name . "%' OR f.title LIKE '%" . $media_name . "%')";
switch (OOAddon::getProperty('be_search', 'searchmode', 'local')) {
case 'local':
// Suche auf aktuellen Kontext eingrenzen
if ($category_id != 0) {
$where .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ") ";
} else {
$qry = str_replace('f.category_id=0', '1=1', $qry);
}
}
$qry = str_replace('FROM ', 'FROM ' . $REX['TABLE_PREFIX'] . 'file_category c,', $qry);
$qry = str_replace('WHERE ', 'WHERE ' . $where . ' AND ', $qry);
return $qry;
}
示例3: 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);
}
示例4: rex_uninstall_addon
function rex_uninstall_addon($addons, $addonname, $regenerate_addons = true)
{
global $REX, $I18N;
$state = true;
$uninstall_file = $REX['INCLUDE_PATH'] . "/addons/{$addonname}/uninstall.inc.php";
if (is_readable($uninstall_file)) {
include $uninstall_file;
// Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch
if (OOAddon::isInstalled($addonname) || !empty($REX['ADDON']['installmsg'][$addonname])) {
$state = $I18N->msg('addon_no_uninstall', $addonname) . '<br/>';
if (empty($REX['ADDON']['installmsg'][$addonname])) {
$state .= $I18N->msg('addon_no_reason');
} else {
$state .= $REX['ADDON']['installmsg'][$addonname];
}
} else {
$state = rex_deactivate_addon($addons, $addonname);
if ($state === true && $regenerate_addons) {
// regenerate Addons file
$state = rex_generateAddons($addons);
}
}
} else {
$state = $I18N->msg("addon_uninstall_not_found");
}
return $state;
}
示例5: getAvailableAddons
/**
* Gibt ein Array von verf�gbaren Addons zur�ck.
*
* @return array Array der verf�gbaren Addons
*/
function getAvailableAddons()
{
$avail = array();
foreach (OOAddon::getRegisteredAddons() as $addonName) {
if (OOAddon::isAvailable($addonName)) {
$avail[] = $addonName;
}
}
return $avail;
}
示例6: addFields
/**
* added the metafields
* @return string
*/
public static function addFields()
{
global $REX;
$class = '';
if (OOAddon::isAvailable('tinymce')) {
$class = 'tinyMCEEditor';
} elseif (OOAddon::isAvailable('ckeditor')) {
$class = 'ckeditor';
}
return self::checkErrorMessage(a62_add_field('translate:content_category', 'asd_category', 2, '', 3, '', 'SELECT `name`, `id` FROM ' . rex_asd_news_config::getTableCategory()), a62_add_field('translate:asd_news_picture', 'asd_picture', 3, '', 6, ''), a62_add_field('translate:asd_news_text', 'asd_text', 4, 'class=' . $class, 2, ''));
}
示例7: 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);
}
示例8: rexMediaButtonField
function rexMediaButtonField($name, $label, $attributes = array(), $id = '')
{
global $REX;
$this->popupButtonField($name, $label, $attributes, $id);
$this->enablePreview();
if (OOAddon::isAvailable('image_resize')) {
$this->setPreviewUrl('index.php?rex_resize=100w__%filename%');
} else {
$this->setPreviewUrl($REX['MEDIAFOLDER'] . '/%filename%');
}
}
示例9: setProperty
/**
* set the property for the metainfo.
* added Entrys in metaTables and prefixes
*/
public static function setProperty()
{
global $REX;
$metaTables = OOAddon::getProperty('metainfo', 'metaTables', array());
$metaTables[self::PREFIX] = $REX['TABLE_PREFIX'] . self::TABLE;
OOAddon::setProperty('metainfo', 'metaTables', $metaTables);
$prefixes = OOAddon::getProperty('metainfo', 'prefixes', array());
if (!in_array(self::PREFIX, $prefixes)) {
$prefixes[] = self::PREFIX;
}
OOAddon::setProperty('metainfo', 'prefixes', $prefixes);
}
示例10: textile
protected function textile($string)
{
if (OOAddon::isAvailable("textile")) {
if ($string != "") {
$string = str_replace("\t", "", $string);
$string = htmlspecialchars_decode($string);
$string = str_replace("<br />", "", $string);
return rex_a79_textile($string);
}
} else {
return $string;
}
}
示例11: setProperty
function setProperty($plugin, $property, $value)
{
global $REX;
// Plugin in Liste aufnehmen
$plugins = OOPlugin::getRegisteredPlugins();
if (!in_array($plugin, $plugins)) {
$plugins[$plugin] = $plugin;
OOAddon::setProperty('community', 'pluginlist', $plugins);
}
if (!isset($REX['ADDON']['plugins']['community'][$plugin])) {
$REX['ADDON']['plugins']['community'][$plugin] = array();
}
// Property fuer das Plugin setzen
$REX['ADDON']['plugins']['community'][$plugin][$property] = $value;
}
示例12: getUpdatePackages
public static function getUpdatePackages()
{
if (is_array(self::$updatePackages)) {
return self::$updatePackages;
}
self::$updatePackages = self::getPackages();
foreach (self::$updatePackages as $key => $addon) {
if (is_dir(rex_path::addon($key)) && isset($addon['files'])) {
self::unsetOlderVersions($key, OOAddon::getVersion($key));
} else {
unset(self::$updatePackages[$key]);
}
}
return self::$updatePackages;
}
示例13: rex_a256_search_mpool_query
function rex_a256_search_mpool_query($params)
{
global $REX, $REX_USER;
if (!($REX_USER->isAdmin() || $REX_USER->hasPerm('be_search[medienpool]'))) {
return $params['subject'];
}
$media_name = rex_request('a256_media_name', 'string');
if ($media_name == '') {
return $params['subject'];
}
$category_id = $params['category_id'];
$qry = "SELECT *\n FROM " . $REX['TABLE_PREFIX'] . "file f, " . $REX['TABLE_PREFIX'] . "file_category c\n WHERE f.category_id = c.id AND (filename LIKE '%" . $media_name . "%' OR title LIKE '%" . $media_name . "%')";
switch (OOAddon::getProperty('be_search', 'searchmode', 'local')) {
case 'local':
// Suche auf aktuellen Kontext eingrenzen
if ($category_id != 0) {
$qry .= " AND (c.path LIKE '%|" . $params['category_id'] . "|%' OR c.id=" . $params['category_id'] . ") ";
}
}
$qry .= 'ORDER BY f.updatedate desc';
$qry = rex_register_extension_point('A256_MEDIENPOOL_QUERY', $qry);
return $qry;
}
示例14: foreach
" />
</a>
<a href="#" onclick="deleteREXLink(3);return false;">
<img src="media/file_del.gif" width="16" height="16" title="<?php
echo $I18N_KURSE->msg('remove_link');
?>
" alt="<?php
echo $I18N_KURSE->msg('remove_link');
?>
" />
</a>
</p>
</div>
<?php
if (OOAddon::isActivated('multinewsletter')) {
?>
<div class="rex-form-row rex-form-element-v1">
<p class="rex-form-text">
<label for="multinewsletter_group"><?php
echo $I18N_KURSE->msg('multinewsletter_gruppe');
?>
</label>
<?php
require_once $REX['INCLUDE_PATH'] . '/addons/multinewsletter/classes/class.multinewsletter_group.inc.php';
$groups = new rex_select();
$groups->setSize(1);
$groups->setAttribute('class', 'myrex_select');
$groups->addOption($I18N_KURSE->msg('multinewsletter_nicht_anmelden'), '0');
$newsletter_groups = MultinewsletterGroupList::getAll($REX['TABLE_PREFIX']);
foreach ($newsletter_groups as $group) {
示例15: a401_perform_ajax
function a401_perform_ajax($_rex_ajax, $rxa, $REX)
{
$rxa['ajaxdir'] .= $REX['REDAXO'] ? 'backend/' : 'frontend/';
if (!$REX['REDAXO'] and !$rxa['settings']['frontend_active']) {
return;
}
if ($REX['REDAXO'] and !$rxa['settings']['backend_active']) {
return;
}
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$rxa['ajaxdir'] = str_replace("/", "\\", $rxa['ajaxdir']);
}
// Code ausführen falls die Datei vorhanden ist
if (file_exists($rxa['ajaxdir'] . $_rex_ajax . '.inc.php')) {
@ob_end_clean();
@ob_end_clean();
// Fix für REDAXO < 4.2.x
if (isset($REX_ARTICLE)) {
$REX['ARTICLE'] = $REX_ARTICLE;
}
// Include der Datei
include_once $rxa['ajaxdir'] . $_rex_ajax . '.inc.php';
exit;
} else {
if (trim($REX["ADDON"][$rxa['name']]["settings"]["errormail"]) != '') {
$_subject = 'REX_Ajax Error ' . $REX['SERVER'] . ' ' . $REX['SERVERNAME'];
$_mailtext = $_subject . "\n\n" . date('d.m.Y h:i:s') . "\n\n";
ob_start();
var_dump($_REQUEST);
$_mailtext .= "_REQUEST\n";
$_mailtext .= ob_get_contents();
ob_end_clean();
ob_start();
var_dump($_SESSION);
$_mailtext .= "\n_SESSION\n";
$_mailtext .= ob_get_contents();
ob_end_clean();
ob_start();
var_dump($_SERVER);
$_mailtext .= "\n_SERVER\n";
$_mailtext .= ob_get_contents();
ob_end_clean();
$_to = $REX["ADDON"][$rxa['name']]["settings"]["errormail"];
$_header = 'From: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'Reply-To: ' . $REX['ERROR_EMAIL'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
if (OOAddon::isAvailable('phpmailer')) {
if (!isset($I18N)) {
$I18N = rex_create_lang($REX['LANG']);
}
include $REX['INCLUDE_PATH'] . '/addons/phpmailer/config.inc.php';
$mail = new rex_mailer();
$mail->From = $REX['ERROR_EMAIL'];
$mail->Subject = $_subject;
$mail->Body = $_mailtext;
$mail->AddAddress($_to, '');
$mail->Send();
} else {
@mail($_to, $_subject, $_mailtext, $_header);
}
}
}
}