本文整理汇总了PHP中rex_extension::registerPoint方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_extension::registerPoint方法的具体用法?PHP rex_extension::registerPoint怎么用?PHP rex_extension::registerPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_extension
的用法示例。
在下文中一共展示了rex_extension::registerPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
static function factory($query, $rowsPerPage = 30, $listName = null, $debug = false, $class = null)
{
if (!$class) {
$class = rex_extension::registerPoint(new rex_extension_point('REX_LIST_CLASSNAME', 'rex_yform_list', ['query' => $query, 'rowsPerPage' => $rowsPerPage, 'listName' => $listName, 'debug' => $debug]));
}
return new $class($query, $rowsPerPage, $listName, $debug);
}
示例2: rex_getUrl
/**
* Gibt eine Url zu einem Artikel zurück.
*
* @param string $_id
* @param int|string $_clang SprachId des Artikels
* @param array|string $_params Array von Parametern
* @param bool $escape Flag whether the argument separator "&" should be escaped (&)
*
* @return string
*
* @package redaxo\structure
*/
function rex_getUrl($_id = '', $_clang = '', $_params = '', $escape = true)
{
$id = (int) $_id;
$clang = (int) $_clang;
// ----- get id
if ($id == 0) {
$id = rex::getProperty('article_id');
}
// ----- get clang
// Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
// Die rexExtension muss selbst entscheiden was sie damit macht
if ($_clang === '' && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
$clang = rex_clang::getCurrentId();
}
// ----- get params
$param_string = rex_param_string($_params, $escape ? '&' : '&');
$name = 'NoName';
if ($id != 0) {
$ooa = rex_article::get($id, $clang);
if ($ooa) {
$name = rex_parse_article_name($ooa->getName());
}
}
// ----- EXTENSION POINT
$url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string, 'escape' => $escape]));
if ($url == '') {
$_clang = '';
if (rex_clang::count() > 1) {
$_clang .= ($escape ? '&' : '&') . 'clang=' . $clang;
}
$url = rex_url::frontendController() . '?article_id=' . $id . $_clang . $param_string;
}
return $url;
}
示例3: rex_getUrl
/**
* Gibt eine Url zu einem Artikel zurück.
*
* @param int|null $id
* @param int|null $clang SprachId des Artikels
* @param array $params Array von Parametern
* @param string $separator
*
* @return string
*
* @package redaxo\structure
*/
function rex_getUrl($id = null, $clang = null, array $params = [], $separator = '&')
{
$id = (int) $id;
$clang = (int) $clang;
// ----- get id
if ($id == 0) {
$id = rex::getProperty('article_id');
}
// ----- get clang
// Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
// Die rexExtension muss selbst entscheiden was sie damit macht
if (!rex_clang::exists($clang) && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
$clang = rex_clang::getCurrentId();
}
// ----- EXTENSION POINT
$url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'clang' => $clang, 'params' => $params, 'separator' => $separator]));
if ($url == '') {
if (rex_clang::count() > 1) {
$clang = $separator . 'clang=' . $clang;
} else {
$clang = '';
}
$params = rex_string::buildQuery($params, $separator);
$params = $params ? $separator . $params : '';
$url = rex_url::frontendController() . '?article_id=' . $id . $clang . $params;
}
return $url;
}
示例4: 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')));
}
示例5: registerPoint
/**
* Extends rex_extension::registerPoint() with FirePHP logging.
*/
public static function registerPoint(rex_extension_point $extensionPoint)
{
$coreTimer = rex::getProperty('timer');
$absDur = $coreTimer->getFormattedDelta();
// start timer for this extensionPoint
$timer = new rex_timer();
$res = parent::registerPoint($extensionPoint);
$epDur = $timer->getFormattedDelta();
$memory = rex_formatter::bytes(memory_get_usage(true), [3]);
self::$log[] = ['type' => 'EP', 'ep' => $extensionPoint->getName(), 'started' => $absDur, 'duration' => $epDur, 'memory' => $memory, 'subject' => $extensionPoint->getSubject(), 'params' => $extensionPoint->getParams(), 'read_only' => $extensionPoint->isReadonly(), 'result' => $res, 'timer' => $epDur];
return $res;
}
示例6: executeAction
function executeAction()
{
$sql = rex_sql::factory();
if ($this->params['debug']) {
$sql->debugsql = true;
}
$main_table = '';
if (!($main_table = $this->getElement(2))) {
$main_table = $this->params['main_table'];
}
if ($main_table == '') {
$this->params['form_show'] = true;
$this->params['hasWarnings'] = true;
$this->params['warning_messages'][] = $this->params['Error-Code-InsertQueryError'];
return false;
}
$sql->setTable($main_table);
$where = '';
if ($where = $this->getElement(3)) {
if ($where == 'main_where') {
$where = $this->params['main_where'];
}
}
foreach ($this->params['value_pool']['sql'] as $key => $value) {
$sql->setValue($key, $value);
if ($where != '') {
$where = str_replace('###' . $key . '###', addslashes($value), $where);
}
}
try {
if ($where != '') {
$sql->setWhere($where);
$saved = $sql->update();
$flag = 'update';
} else {
$saved = $sql->insert();
$flag = 'insert';
$id = $sql->getLastId();
$this->params['main_id'] = $id;
$this->params['value_pool']['email']['ID'] = $id;
// $this->params["value_pool"]["sql"]["ID"] = $id;
}
} catch (Exception $sql) {
$this->params['form_show'] = true;
$this->params['hasWarnings'] = true;
$this->params['warning_messages'][] = $this->params['Error-Code-InsertQueryError'];
echo $sql->getMessage();
}
rex_extension::registerPoint(new rex_extension_point('REX_YFORM_SAVED'), $sql, array('form' => $this, 'sql' => $sql, 'yform' => true));
}
示例7: deleteCLang
/**
* Löscht eine Clang.
*
* @param int $id Zu löschende ClangId
*
* @throws rex_exception
*/
public static function deleteCLang($id)
{
$startClang = rex_clang::getStartId();
if ($id == $startClang) {
throw new rex_functional_exception(rex_i18n::msg('clang_error_startidcanotbedeleted', $startClang));
}
if (!rex_clang::exists($id)) {
throw new rex_functional_exception(rex_i18n::msg('clang_error_idcanotbedeleted', $id));
}
$clang = rex_clang::get($id);
$del = rex_sql::factory();
$del->setQuery('delete from ' . rex::getTablePrefix() . 'clang where id=?', [$id]);
rex_sql_util::organizePriorities(rex::getTable('clang'), 'priority', '', 'priority');
rex_delete_cache();
// ----- EXTENSION POINT
rex_extension::registerPoint(new rex_extension_point('CLANG_DELETED', '', ['id' => $clang->getId(), 'name' => $clang->getName(), 'clang' => $clang]));
}
示例8: testRegister
public function testRegister()
{
$EP = 'TEST_EP_LEVELS';
$callback = function ($str) {
return function (rex_extension_point $ep) use($str) {
return $ep->getSubject() . $str . ' ';
};
};
rex_extension::register($EP, $callback('late1'), rex_extension::LATE);
rex_extension::register($EP, $callback('normal1'));
rex_extension::register($EP, $callback('early1'), rex_extension::EARLY);
rex_extension::register($EP, $callback('late2'), rex_extension::LATE);
rex_extension::register($EP, $callback('normal2'), rex_extension::NORMAL);
rex_extension::register($EP, $callback('early2'), rex_extension::EARLY);
$expected = 'early1 early2 normal1 normal2 late1 late2 ';
$actual = rex_extension::registerPoint(new rex_extension_point($EP, ''));
$this->assertEquals($expected, $actual);
}
示例9: applyEffects
protected function applyEffects($type)
{
$this->type = $type;
if (!$this->isCached($type)) {
$set = $this->effectsFromType($type);
$set = rex_extension::registerPoint(new rex_extension_point('MEDIA_MANAGER_FILTERSET', $set, ['rex_media_type' => $type]));
if (count($set) == 0) {
return $this->media;
}
// execute effects on image
foreach ($set as $effect_params) {
$effect_class = 'rex_effect_' . $effect_params['effect'];
$effect = new $effect_class();
$effect->setMedia($this->media);
$effect->setParams($effect_params['params']);
$effect->execute();
}
}
}
示例10: handleSave
protected function handleSave(array $params, rex_sql $sqlFields)
{
// Nur speichern wenn auch das MetaForm ausgefüllt wurde
// z.b. nicht speichern wenn über be_search select navigiert wurde
if (!rex_post('savemeta', 'boolean')) {
return $params;
}
$article = rex_sql::factory();
// $article->setDebug();
$article->setTable(rex::getTablePrefix() . 'article');
$article->setWhere('id=:id AND clang_id=:clang', ['id' => $params['id'], 'clang' => $params['clang']]);
$article->setValue('name', rex_post('meta_article_name', 'string'));
parent::fetchRequestValues($params, $article, $sqlFields);
// do the save only when metafields are defined
if ($article->hasValues()) {
$article->update();
}
rex_article_cache::deleteMeta($params['id'], $params['clang']);
rex_extension::registerPoint(new rex_extension_point('ART_META_UPDATED', '', $params));
return $params;
}
示例11: sendMail
static function sendMail($template, $template_name = '')
{
$r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_SEND', ['template' => $template, 'template_name' => $template_name, 'status' => false]));
$template = $r['template'];
$template_name = $r['template_name'];
$status = $r['status'];
if ($status) {
return true;
}
$mail = new rex_mailer();
$mail->AddAddress($template['mail_to'], $template['mail_to_name']);
$mail->SetFrom($template['mail_from'], $template['mail_from_name']);
$mail->Subject = $template['subject'];
$mail->Body = $template['body'];
if ($template['body_html'] != '') {
$mail->AltBody = $template['body'];
$mail->MsgHTML($template['body_html']);
} else {
$mail->Body = strip_tags($template['body']);
}
if (is_array($template['attachments'])) {
foreach ($template['attachments'] as $f) {
$mail->AddAttachment($f['path'], $f['name']);
}
}
if ($mail->Send()) {
$template['email_subject'] = $template['subject'];
rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_SENT', $template_name, $template, true));
// read only
return true;
} else {
$template['email_subject'] = $template['subject'];
rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_SENT_FAILED', $template_name, $template, true));
// read only
return false;
}
}
示例12: renderMetaFields
//.........这里部分代码省略.........
$id = $rexInput->getAttribute('id');
$field = $rexInput->getHtml();
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
++$media_id;
break;
case 'REX_MEDIALIST_WIDGET':
$tag = 'div';
$tag_attr = ' class="rex-form-widget"';
$paramArray = rex_string::split($params);
$name .= '[]';
$rexInput = rex_input::factory('medialistbutton');
$rexInput->addAttributes($attrArray);
$rexInput->setButtonId($mlist_id);
$rexInput->setAttribute('name', $name);
$rexInput->setValue($dbvalues[0]);
if (isset($paramArray['category'])) {
$rexInput->setCategoryId($paramArray['category']);
}
if (isset($paramArray['types'])) {
$rexInput->setTypes($paramArray['types']);
}
if (isset($paramArray['preview'])) {
$rexInput->setPreview($paramArray['preview']);
}
$id = $rexInput->getAttribute('id');
$field = $rexInput->getHtml();
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
++$mlist_id;
break;
case 'REX_LINK_WIDGET':
$tag = 'div';
$tag_attr = ' class="rex-form-widget"';
$paramArray = rex_string::split($params);
$category = '';
if (isset($paramArray['category'])) {
$category = $paramArray['category'];
} elseif ($activeItem) {
$category = $activeItem->getValue('category_id');
}
$rexInput = rex_input::factory('linkbutton');
$rexInput->addAttributes($attrArray);
$rexInput->setButtonId($link_id);
$rexInput->setCategoryId($category);
$rexInput->setAttribute('name', $name);
$rexInput->setValue($dbvalues[0]);
$id = $rexInput->getAttribute('id');
$field = $rexInput->getHtml();
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
++$link_id;
break;
case 'REX_LINKLIST_WIDGET':
$tag = 'div';
$tag_attr = ' class="rex-form-widget"';
$paramArray = rex_string::split($params);
$category = '';
if (isset($paramArray['category'])) {
$category = $paramArray['category'];
} elseif ($activeItem) {
$category = $activeItem->getValue('category_id');
}
$name .= '[]';
$rexInput = rex_input::factory('linklistbutton');
$rexInput->addAttributes($attrArray);
$rexInput->setButtonId($llist_id);
$rexInput->setCategoryId($category);
$rexInput->setAttribute('name', $name);
$rexInput->setValue(implode(',', $dbvalues));
$id = $rexInput->getAttribute('id');
$field = $rexInput->getHtml();
$e = [];
$e['label'] = $label;
$e['field'] = $field;
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$field = $fragment->parse('core/form/form.php');
++$llist_id;
break;
default:
// ----- EXTENSION POINT
list($field, $tag, $tag_attr, $id, $label, $labelIt) = rex_extension::registerPoint(new rex_extension_point('METAINFO_CUSTOM_FIELD', [$field, $tag, $tag_attr, $id, $label, $labelIt, 'values' => $dbvalues, 'rawvalues' => $dbvalues, 'type' => $typeLabel, 'sql' => $sqlFields]));
}
$s .= $this->renderFormItem($field, $tag, $tag_attr, $id, $label, $labelIt, $typeLabel);
}
return $s;
}
示例13: htmlspecialchars
$add_td = '<td></td>';
if ($PERMALL) {
$add_td = '<td><input type="checkbox" name="selectedmedia[]" value="' . $file_name . '" /></td>';
}
$panel .= '<tr>
' . $add_td . '
<td data-title="' . rex_i18n::msg('pool_file_thumbnail') . '"><a href="' . $ilink . '">' . $thumbnail . '</a></td>
<td data-title="' . rex_i18n::msg('pool_file_info') . '">
<h3><a href="' . $ilink . '">' . htmlspecialchars($file_title) . '</a></h3>
' . $desc . '
<p>' . htmlspecialchars($file_name) . ' <span class="rex-filesize">' . $file_size . '</span></p>
</td>
<td data-title="' . rex_i18n::msg('pool_last_update') . '"><p class="rex-date">' . $file_stamp . '</p><p class="rex-author">' . htmlspecialchars($file_updateuser) . '</p></td>
<td class="rex-table-action"><a href="' . $ilink . '">' . rex_i18n::msg('edit') . '</a></td>
<td class="rex-table-action">';
$panel .= rex_extension::registerPoint(new rex_extension_point('MEDIA_LIST_FUNCTIONS', $opener_link, ['file_id' => $files->getValue('id'), 'file_name' => $files->getValue('filename'), 'file_oname' => $files->getValue('originalname'), 'file_title' => $files->getValue('title'), 'file_type' => $files->getValue('filetype'), 'file_size' => $files->getValue('filesize'), 'file_stamp' => $files->getDateTimeValue('updatedate'), 'file_updateuser' => $files->getValue('updateuser')]));
$panel .= '</td>
</tr>';
$files->next();
}
// endforeach
// ----- no items found
if ($files->getRows() == 0) {
$panel .= '
<tr>
<td></td>
<td colspan="5">' . rex_i18n::msg('pool_nomediafound') . '</td>
</tr>';
}
$panel .= '
</tbody>
示例14: rex_mediapool_Mediaform
/**
* Ausgabe des Medienpool Formulars.
*/
function rex_mediapool_Mediaform($form_title, $button_title, $rex_file_category, $file_chooser, $close_form)
{
global $ftitle, $warning, $info;
$s = '';
$cats_sel = new rex_media_category_select();
$cats_sel->setStyle('class="form-control"');
$cats_sel->setSize(1);
$cats_sel->setName('rex_file_category');
$cats_sel->setId('rex-mediapool-category');
$cats_sel->addOption(rex_i18n::msg('pool_kats_no'), '0');
$cats_sel->setAttribute('onchange', 'this.form.submit()');
$cats_sel->setSelected($rex_file_category);
if (isset($warning)) {
if (is_array($warning)) {
if (count($warning) > 0) {
$s .= rex_view::error(implode('<br />', $warning));
}
} elseif ($warning != '') {
$s .= rex_view::error($warning);
}
$warning = '';
}
if (isset($info)) {
if (is_array($info)) {
if (count($info) > 0) {
$s .= rex_view::success(implode('<br />', $info));
}
} elseif ($info != '') {
$s .= rex_view::success($info);
}
$info = '';
}
if (!isset($ftitle)) {
$ftitle = '';
}
$arg_fields = '';
foreach (rex_request('args', 'array') as $arg_name => $arg_value) {
$arg_fields .= '<input type="hidden" name="args[' . $arg_name . ']" value="' . $arg_value . '" />' . "\n";
}
$opener_input_field = rex_request('opener_input_field', 'string');
if ($opener_input_field != '') {
$arg_fields .= '<input type="hidden" name="opener_input_field" value="' . htmlspecialchars($opener_input_field) . '" />' . "\n";
}
$add_submit = '';
if ($close_form && $opener_input_field != '') {
$add_submit = '<button class="btn btn-save" type="submit" name="saveandexit" value="' . rex_i18n::msg('pool_file_upload_get') . '"' . rex::getAccesskey(rex_i18n::msg('pool_file_upload_get'), 'save') . '>' . rex_i18n::msg('pool_file_upload_get') . '</button>';
}
$panel = '';
$formElements = [];
$e = [];
$e['label'] = '<label for="rex-mediapool-title">' . rex_i18n::msg('pool_file_title') . '</label>';
$e['field'] = '<input class="form-control" type="text" id="rex-mediapool-title" name="ftitle" value="' . htmlspecialchars($ftitle) . '" />';
$formElements[] = $e;
$e = [];
$e['label'] = '<label for="rex-mediapool-category">' . rex_i18n::msg('pool_file_category') . '</label>';
$e['field'] = $cats_sel->get();
$formElements[] = $e;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$panel .= $fragment->parse('core/form/form.php');
$panel .= rex_extension::registerPoint(new rex_extension_point('MEDIA_FORM_ADD', ''));
if ($file_chooser) {
$e = [];
$e['label'] = '<label for="rex-mediapool-choose-file">' . rex_i18n::msg('pool_file_file') . '</label>';
$e['field'] = '<input id="rex-mediapool-choose-file" type="file" name="file_new" />';
$e['note'] = '<h3>' . rex_i18n::msg('phpini_settings') . '</h3>
<dl class="dl-horizontal">
' . (rex_ini_get('file_uploads') == 0 ? '<dt><span class="text-warning">' . rex_i18n::msg('pool_upload') . '</span></dt><dd><span class="text-warning">' . rex_i18n::msg('pool_upload_disabled') . '</span></dd>' : '') . '
<dt>' . rex_i18n::msg('pool_max_uploadsize') . ':</dt><dd>' . rex_formatter::bytes(rex_ini_get('upload_max_filesize')) . '</dd>
<dt>' . rex_i18n::msg('pool_max_uploadtime') . ':</dt><dd>' . rex_ini_get('max_input_time') . 's</dd>
</dl>';
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$panel .= $fragment->parse('core/form/form.php');
}
$formElements = [];
$e = [];
$e['field'] = '<button class="btn btn-save" type="submit" name="save" value="' . $button_title . '"' . rex::getAccesskey($button_title, 'save') . '>' . $button_title . '</button>';
$formElements[] = $e;
$e = [];
$e['field'] = $add_submit;
$formElements[] = $e;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$buttons = $fragment->parse('core/form/submit.php');
$fragment = new rex_fragment();
$fragment->setVar('title', $form_title, false);
$fragment->setVar('body', $panel, false);
$fragment->setVar('buttons', $buttons, false);
$content = $fragment->parse('core/page/section.php');
$s .= ' <form action="' . rex_url::currentBackendPage() . '" method="post" enctype="multipart/form-data">
<fieldset>
<input type="hidden" name="media_method" value="add_file" />
' . $arg_fields . '
' . $content . '
</fieldset>
';
//.........这里部分代码省略.........
示例15: getMsg
/**
* Returns the translation for the given key.
*
* @param string $key
* @param bool $htmlspecialchars
* @param array $args
*
* @return mixed
*/
private static function getMsg($key, $htmlspecialchars, array $args)
{
if (!self::$loaded) {
self::loadAll();
}
if (self::hasMsg($key)) {
$msg = self::$msg[$key];
} else {
$msg = "[translate:{$key}]";
$msg = rex_extension::registerPoint(new rex_extension_point('I18N_MISSING_TRANSLATION', $msg, ['key' => $key, 'args' => $args]));
}
if ($htmlspecialchars) {
$msg = htmlspecialchars($msg);
$msg = preg_replace('@<(/?(?:b|i|code|kbd)|br ?/?)>@i', '<$1>', $msg);
}
$patterns = [];
$replacements = [];
$argNum = count($args);
if ($argNum > 1) {
for ($i = 1; $i < $argNum; ++$i) {
// zero indexed
$patterns[] = '/\\{' . ($i - 1) . '\\}/';
$replacements[] = $args[$i];
}
}
return preg_replace($patterns, $replacements, $msg);
}