本文整理汇总了PHP中rex_article类的典型用法代码示例。如果您正苦于以下问题:PHP rex_article类的具体用法?PHP rex_article怎么用?PHP rex_article使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_article类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enterObject
function enterObject()
{
$article = new rex_article();
if ($article->setArticleId($this->getElement(1))) {
$this->params['form_output'][$this->getId()] = $this->parse('value.article.tpl.php', array('article' => $article));
}
}
示例2: rex_newsletter_sendmail
function rex_newsletter_sendmail($userinfo, $aid, $mail_reply, $mail_subject)
{
global $REX;
$tmp_redaxo = $REX['REDAXO'];
$REX['REDAXO'] = true;
// ***** HTML VERSION KOMPLETT
$REX_ARTICLE = new rex_article();
$REX_ARTICLE->setCLang(0);
$REX_ARTICLE->setArticleId($aid);
$REX_ARTICLE->getContentAsQuery(TRUE);
// $REX_ARTICLE->setTemplateId(xx);
$REX['ADDON']['NEWSLETTER_TEXT'] = FALSE;
$html_body = $REX_ARTICLE->getArticleTemplate();
// ***** TEXT VERSION
$REX_ARTICLE = new rex_article();
$REX_ARTICLE->setCLang(0);
$REX_ARTICLE->setArticleId($aid);
$REX_ARTICLE->getContentAsQuery(TRUE);
// $REX_ARTICLE->setTemplateId(xx);
$REX['ADDON']['NEWSLETTER_TEXT'] = TRUE;
// FILTERN VERSION KOMPLETT
$text_body = $REX_ARTICLE->getArticle();
$text_body = str_replace("<br />", "<br />", $text_body);
$text_body = str_replace("<p>", "\n\n</p>", $text_body);
$text_body = str_replace("<ul>", "\n\n</ul>", $text_body);
$text_body = preg_replace("#(\\<)(.*)(\\>)#imsU", "", $text_body);
$text_body = html_entity_decode($text_body);
$REX['REDAXO'] = true;
// ***** MAIL VERSAND
// Allgemeine Initialisierung
// $mail = new PHPMailer();
$mail = new rex_mailer();
$mail->AddAddress($userinfo["email"]);
$mail->From = $mail_reply;
$mail->FromName = $mail_reply;
$subject = $mail_subject;
// Subject
// Bodies
// html
foreach ($userinfo as $k => $v) {
$subject = str_replace("###" . $k . "###", $v, $subject);
$html_body = str_replace("###" . $k . "###", $v, $html_body);
$text_body = str_replace("###" . $k . "###", $v, $text_body);
$subject = str_replace("###" . strtoupper($k) . "###", $v, $subject);
$html_body = str_replace("###" . strtoupper($k) . "###", $v, $html_body);
$text_body = str_replace("###" . strtoupper($k) . "###", $v, $text_body);
}
// text
// echo "<pre>$text_body</pre>";
$mail->Subject = $subject;
$mail->AltBody = $text_body;
$mail->Body = $html_body;
$mail->Send();
$REX['REDAXO'] = $tmp_redaxo;
}
示例3: addNewstoSitemap
public static function addNewstoSitemap($params)
{
$mainArticle = rex_asd_news_config::getConfig('article');
$mainArticle = new rex_article($mainArticle);
foreach (rex_asd_news::getByWhere(array('clang' => null)) as $news) {
/** @var rex_asd_news $news */
$fragment = array('loc' => $news->getUrl(), 'lastmod' => $news->getPublishDate()->format('c'), 'changefreq' => self::calc_article_changefreq($news->getPublishDate()->getTimestamp()), 'priority' => self::calc_article_priority($mainArticle->getValue('id'), $mainArticle->getValue('clang'), $mainArticle->getValue('path') . '|' . $news->getValue('id')));
$params['subject'][rex_asd_news_config::getName()][] = $fragment;
}
return $params['subject'];
}
示例4: matchArticle
/**
* Wert für die Ausgabe
*/
function matchArticle($content)
{
$var = 'REX_ARTICLE';
$matches = $this->getArticleInputParams($content, $var);
foreach ($matches as $match) {
list($param_str, $article_id, $clang) = $match;
$article = new rex_article($article_id, $clang);
$content = str_replace($var . '[' . $param_str . ']', $article->getArticle(), $content);
}
return $content;
}
示例5: getListValue
static function getListValue($params)
{
if (intval($params['value']) < 1) {
return '-';
}
if ($art = new rex_article($params['value'])) {
return $art->getValue('name');
} else {
return 'article ' . $params['value'] . ' not found';
}
}
示例6: getCustomUrl
/**
* @param rex_article $art
* @param rex_yrewrite_domain $domain
*
* @return string|false
*/
public function getCustomUrl(rex_article $art, rex_yrewrite_domain $domain)
{
if ($domain->getStartId() == $art->getId()) {
if ($domain->getStartClang() == $art->getClang()) {
return '/';
}
return $this->getClang($art->getClang(), $domain) . '/';
}
if ($url = $art->getValue('yrewrite_url')) {
return $url;
}
return false;
}
示例7: 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;
}
示例8: getForward
public static function getForward($params)
{
// Url wurde von einer anderen Extension bereits gesetzt
if (isset($params['subject']) && $params['subject'] != '') {
return $params['subject'];
}
self::init();
$domain = $params['domain'];
if ($domain == 'undefined') {
$domain = '';
}
$url = $params['url'];
foreach (self::$paths as $p) {
if ($p['domain'] == $domain && ($p['url'] == $url || $p['url'] . '/' == $url)) {
$forward_url = '';
if ($p['type'] == 'article' && ($art = rex_article::get($p['article_id'], $p['clang']))) {
$forward_url = rex_getUrl($p['article_id'], $p['clang']);
} elseif ($p['type'] == 'media' && ($media = rex_media::get($p['media']))) {
$forward_url = '/files/' . $p['media'];
} elseif ($p['type'] == 'extern' && $p['extern'] != '') {
$forward_url = $p['extern'];
}
if ($forward_url != '') {
header('HTTP/1.1 ' . self::$movetypes[$p['movetype']]);
header('Location: ' . $forward_url);
exit;
}
}
}
return false;
}
示例9: getWidget
public static function getWidget($id, $name, $value, array $args = [])
{
$art_name = '';
$art = rex_article::get($value);
$category = 0;
// Falls ein Artikel vorausgewählt ist, dessen Namen anzeigen und beim öffnen der Linkmap dessen Kategorie anzeigen
if ($art instanceof rex_article) {
$art_name = $art->getName();
$category = $art->getCategoryId();
}
$open_params = '&clang=' . rex_clang::getCurrentId();
if ($category || isset($args['category']) && ($category = (int) $args['category'])) {
$open_params .= '&category_id=' . $category;
}
$class = ' rex-disabled';
$open_func = '';
$delete_func = '';
if (rex::getUser()->getComplexPerm('structure')->hasStructurePerm()) {
$class = '';
$open_func = 'openLinkMap(\'REX_LINK_' . $id . '\', \'' . $open_params . '\');';
$delete_func = 'deleteREXLink(' . $id . ');';
}
$e = [];
$e['field'] = '<input class="form-control" type="text" name="REX_LINK_NAME[' . $id . ']" value="' . htmlspecialchars($art_name) . '" id="REX_LINK_' . $id . '_NAME" readonly="readonly" /><input type="hidden" name="' . $name . '" id="REX_LINK_' . $id . '" value="' . $value . '" />';
$e['functionButtons'] = '
<a href="#" class="btn btn-popup' . $class . '" onclick="' . $open_func . 'return false;" title="' . rex_i18n::msg('var_link_open') . '"><i class="rex-icon rex-icon-open-linkmap"></i></a>
<a href="#" class="btn btn-popup' . $class . '" onclick="' . $delete_func . 'return false;" title="' . rex_i18n::msg('var_link_delete') . '"><i class="rex-icon rex-icon-delete-link"></i></a>';
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$media = $fragment->parse('core/form/widget.php');
return $media;
}
示例10: 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_article::getCurrentId();
}
// ----- 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;
}
示例11: replaceVars
static function replaceVars($template, $er = array())
{
$r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_REPLACEVARS', ['template' => $template, 'search_replace' => $er, 'status' => false]));
$template = $r['template'];
$er = $r['search_replace'];
$status = $r['status'];
if ($status) {
return true;
}
$er['REX_SERVER'] = rex::getServer();
$er['REX_ERROR_EMAIL'] = rex::getErrorEmail();
$er['REX_SERVERNAME'] = rex::getServerName();
$er['REX_NOTFOUND_ARTICLE_ID'] = rex_article::getNotfoundArticleId();
$er['REX_ARTICLE_ID'] = rex_article::getCurrentId();
$template['body'] = rex_var::parse($template['body'], '', 'yform_email_template', $er);
$template['body_html'] = rex_var::parse($template['body_html'], '', 'yform_email_template', $er);
// rex_vars bug: sonst wird der Zeilenumbruch entfernt - wenn DATA_VAR am Ende einer Zeile
if (rex_string::versionCompare(rex::getVersion(), '5.0.1', '<')) {
$template['body'] = str_replace("?>\r", "?>\r\n\r", $template['body']);
$template['body'] = str_replace("?>\n", "?>\n\r\n", $template['body']);
$template['body_html'] = str_replace("?>\r", "?>\r\n\r", $template['body_html']);
$template['body_html'] = str_replace("?>\n", "?>\n\r\n", $template['body_html']);
}
$template['body'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body', $template['body']));
$template['body_html'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body_html', $template['body_html']));
return $template;
}
示例12: isValid
public function isValid($value)
{
$article = rex_article::get($value);
if (!$article instanceof rex_article) {
return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
}
return true;
}
示例13: getForm
public function getForm(array $params)
{
$OOArt = rex_article::get($params['id'], $params['clang']);
$params['activeItem'] = $params['article'];
// Hier die category_id setzen, damit beim klick auf den REX_LINK_BUTTON der Medienpool in der aktuellen Kategorie startet
$params['activeItem']->setValue('category_id', $OOArt->getCategoryId());
return parent::renderFormAndSave(self::PREFIX, $params);
}
示例14: getArticleValue
public static function getArticleValue($id, $field, $clang = null)
{
if ($clang === null) {
$clang = rex_clang::getCurrentId();
}
$article = rex_article::get($id, $clang);
return htmlspecialchars($article->getValue($field));
}
示例15: hasValue
public function hasValue($value)
{
// bc
if ($this->viasql) {
return parent::hasValue($value);
}
$value = $this->correctValue($value);
return rex_article::get($this->article_id, $this->clang)->hasValue($value);
}