本文整理汇总了PHP中OOArticle类的典型用法代码示例。如果您正苦于以下问题:PHP OOArticle类的具体用法?PHP OOArticle怎么用?PHP OOArticle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OOArticle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_db_articles
/**
* GET SITEMAP ARTICLES FROM DB
*
* @return (array) sitemap articles
*/
private function get_db_articles()
{
global $REX, $SEO42_URLS;
if ($REX['ADDON']['seo42']['settings']['rewriter']) {
// use seo42 pathlist
array_multisort($SEO42_URLS);
foreach ($SEO42_URLS as $url) {
$article = OOArticle::getArticleById($url['id'], $url['clang']);
if (OOArticle::isValid($article)) {
$hasPermission = true;
// community addon
if (class_exists('rex_com_auth') && !rex_com_auth::checkPerm($article)) {
$hasPermission = false;
}
// add sitemap block
if (($article->isOnline() || $article->getId() == $REX['START_ARTICLE_ID'] && $article->getClang() == $REX['START_CLANG_ID']) && !isset($url['status']) && $hasPermission) {
$db_articles[$url['id']][$url['clang']] = array('loc' => rex_getUrl($url['id'], $url['clang']), 'lastmod' => date('c', $article->getValue('updatedate')), 'changefreq' => self::calc_article_changefreq($article->getValue('updatedate'), ''), 'priority' => self::calc_article_priority($url['id'], $url['clang'], $article->getValue('path'), ''), 'noindex' => $article->getValue('seo_noindex'));
}
}
}
} else {
// at the moment: no sitemap urls if rewriter is turned off
}
// EXTENSIONPOINT SEO42_SITEMAP_ARRAY_CREATED
$db_articles = rex_register_extension_point('SEO42_SITEMAP_ARRAY_CREATED', $db_articles);
// EXTENSIONPOINT SEO42_SITEMAP_ARRAY_FINAL (READ ONLY)
rex_register_extension_point('SEO42_SITEMAP_ARRAY_FINAL', $db_articles);
$this->db_articles = $db_articles;
}
示例2: getBreadcrumb
function getBreadcrumb($startPageLabel, $includeCurrent = FALSE, $category_id = 0)
{
if (!$this->_setActivePath()) {
return FALSE;
}
global $REX;
$path = $this->path;
$i = 1;
$lis = '';
if ($startPageLabel) {
$lis .= '<li class="rex-lvl' . $i . '"><a href="' . rex_getUrl($REX['START_ARTICLE_ID']) . '">' . htmlspecialchars($startPageLabel) . '</a></li>';
$i++;
// StartArticle nicht doppelt anzeigen
if (isset($path[0]) && $path[0] == $REX['START_ARTICLE_ID']) {
unset($path[0]);
}
}
foreach ($path as $pathItem) {
if ($cat = OOCategory::getCategoryById($pathItem) && $this->_check($cat, $i)) {
$lis .= '<li class="rex-lvl' . $i . '"><a href="' . $cat->getUrl() . '">' . htmlspecialchars($cat->getName()) . '</a></li>';
$i++;
}
}
if ($includeCurrent) {
if ($art = OOArticle::getArticleById($this->current_article_id) && $this->_check($art, $i)) {
if (!$art->isStartpage()) {
$lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($art->getName()) . '</li>';
} else {
$cat = OOCategory::getCategoryById($this->current_article_id);
$lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($cat->getName()) . '</li>';
}
}
}
return '<ul class="rex-breadcrumb">' . $lis . '</ul>';
}
示例3: rex_getUrl
function rex_getUrl($id, $clang = "", $params = "")
{
/*
* Object Helper Function:
* Returns a url for linking to this article
* This url respects the setting for mod_rewrite
* support!
*
* If you pass an associative array for $params,
* then these parameters will be attached to the URL.
* e.g.:
* $param = array("order" => "123", "name" => "horst");
* $article->getUrl($param);
* will return:
* index.php?article_id=1&order=123&name=horst
* or if mod_rewrite support is activated:
* /1-The_Article_Name?order=123&name=horst
*/
global $REX;
// ----- definiere sprache
if ($clang == "") {
$clang = $REX[CUR_CLANG];
}
// ----- get article Name
$id = $id + 0;
if ($id == 0) {
$name = "NoName";
} else {
$ooa = OOArticle::getArticleById($id);
if ($ooa) {
$name = strtolower($ooa->getName());
}
$name = preg_replace("/[^a-zA-Z]/", "", $name);
}
// ----- get params
$param_string = "";
if (is_array($params)) {
$first = true;
foreach ($params as $key => $value) {
// Nur Wenn MOD_REWRITE aktiv ist, das erste "&" entfernen.
if ($first && $REX['MOD_REWRITE']) {
$first = false;
} else {
$param_string .= '&';
}
$param_string .= $key . '=' . $value;
}
} else {
if ($params != "") {
$param_string = str_replace('&', '&', $params);
}
}
if ($REX['MOD_REWRITE'] && $param_string != "") {
$param_string = "?" . $param_string;
}
// ----- create url
$url = $REX['MOD_REWRITE'] ? "{$id}-{$clang}-{$name}.html" : "index.php?article_id={$id}&clang={$clang}";
return $REX['WWW_PATH'] . "{$url}" . "{$param_string}";
}
示例4: rex_a62_metainfo_form
/**
* Erweitert das Meta-Formular um die neuen Meta-Felder
*/
function rex_a62_metainfo_form($params)
{
$OOArt = OOArticle::getArticleById($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 $params['subject'] . _rex_a62_metainfo_form('art_', $params, '_rex_a62_metainfo_art_handleSave');
}
示例5: rex_a128_historyHandler
function rex_a128_historyHandler($params)
{
global $page, $subpage, $REX_USER, $REX;
$mypage = $params['mypage'];
require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_historyManager.inc.php';
require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_history.inc.php';
require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_historyItem.inc.php';
$function = rex_request('function', 'string');
$mode = rex_request('mode', 'string');
// Alle Histories registrierens
$articleHistory =& rexHistoryManager::getHistory('articles');
$templateHistory =& rexHistoryManager::getHistory('templates');
$moduleHistory =& rexHistoryManager::getHistory('modules');
$actionHistory =& rexHistoryManager::getHistory('actions');
$sql = new rex_sql();
$sql->debugsql = true;
if ($page == 'module' && $function == 'edit' && ($module_id = rex_get('modul_id', 'int')) != 0) {
$result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'modultyp WHERE id=' . $module_id);
if (isset($result[0])) {
$link = 'index.php?page=' . $page . '&function=' . $function . '&modul_id=' . $module_id;
$title = $result[0]['name'];
if ($REX_USER->hasPerm('advancedMode[]')) {
$title .= ' [' . $module_id . ']';
}
$moduleHistory->addItem(new rexHistoryItem($title, $link));
}
} elseif ($page == 'module' && $subpage == 'actions' && $function == 'edit' && ($action_id = rex_get('action_id', 'int')) != 0) {
$result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'action WHERE id=' . $action_id);
if (isset($result[0])) {
$link = 'index.php?page=' . $page . '&subpage=' . $subpage . '&function=' . $function . '&modul_id=' . $action_id;
$title = $result[0]['name'];
if ($REX_USER->hasPerm('advancedMode[]')) {
$title .= ' [' . $action_id . ']';
}
$actionHistory->addItem(new rexHistoryItem($title, $link));
}
} elseif ($page == 'template' && $function == 'edit' && ($template_id = rex_get('template_id', 'int')) != 0) {
$result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'template WHERE id=' . $template_id);
if (isset($result[0])) {
$link = 'index.php?page=' . $page . '&function=' . $function . '&template_id=' . $template_id;
$title = $result[0]['name'];
if ($REX_USER->hasPerm('advancedMode[]')) {
$title .= ' [' . $template_id . ']';
}
$templateHistory->addItem(new rexHistoryItem($title, $link));
}
} elseif ($page == 'content' && $mode == 'edit' && ($article_id = rex_get('article_id', 'int')) != 0) {
$art = OOArticle::getArticleById($article_id);
if (OOArticle::isValid($art)) {
$link = 'index.php?page=' . $page . '&mode=' . $mode . '&article_id=' . $article_id;
$title = $art->getName();
if ($REX_USER->hasPerm('advancedMode[]')) {
$title .= ' [' . $article_id . ']';
}
$articleHistory->addItem(new rexHistoryItem($title, $link));
}
}
}
示例6: matchArticle
function matchArticle($content, $replaceInTemplate = false)
{
global $REX;
$var = 'REX_ARTICLE';
$matches = $this->getVarParams($content, $var);
foreach ($matches as $match) {
list($param_str, $args) = $match;
list($article_id, $args) = $this->extractArg('id', $args, 0);
list($clang, $args) = $this->extractArg('clang', $args, '$REX[\'CUR_CLANG\']');
list($ctype, $args) = $this->extractArg('ctype', $args, -1);
list($field, $args) = $this->extractArg('field', $args, '');
$tpl = '';
if ($article_id == 0) {
// REX_ARTICLE[field=name] keine id -> feld von aktuellem artikel verwenden
if ($field) {
if (OOArticle::hasValue($field)) {
$tpl = '<?php echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, '$this->getValue(\'' . addslashes($field) . '\')') . '); ?>';
}
} else {
if ($replaceInTemplate) {
// aktueller Artikel darf nur in Templates, nicht in Modulen eingebunden werden
// => endlossschleife
$tpl = '<?php echo ' . $this->handleGlobalVarParamsSerialized($var, $args, '$this->getArticle(' . $ctype . ')') . '; ?>';
}
}
} else {
if ($article_id > 0) {
// REX_ARTICLE[field=name id=5] feld von gegebene artikel id verwenden
if ($field) {
if (OOArticle::hasValue($field)) {
// bezeichner wählen, der keine variablen
// aus modulen/templates überschreibt
$varname = '$__rex_art';
$tpl = '<?php
' . $varname . ' = OOArticle::getArticleById(' . $article_id . ', ' . $clang . ');
if(' . $varname . ') echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, $varname . '->getValue(\'' . addslashes($field) . '\')') . ');
?>';
}
} else {
// bezeichner wählen, der keine variablen
// aus modulen/templates überschreibt
$varname = '$__rex_art';
$tpl = '<?php
' . $varname . ' = new rex_article();
' . $varname . '->setArticleId(' . $article_id . ');
' . $varname . '->setClang(' . $clang . ');
echo ' . $this->handleGlobalVarParamsSerialized($var, $args, $varname . '->getArticle(' . $ctype . ')') . ';
?>';
}
}
}
if ($tpl != '') {
$content = str_replace($var . '[' . $param_str . ']', $tpl, $content);
}
}
return $content;
}
示例7: getArticleName
function getArticleName()
{
$article_id = $this->getValue();
$article_name = '';
if ($article_id != '' && $article_id != 0) {
$ooa = OOArticle::getArticleById($article_id);
if ($ooa !== null) {
$article_name = $ooa->getName();
}
}
return $article_name;
}
示例8: matchArticleVar
/**
* Wert für die Ausgabe
*/
function matchArticleVar($content)
{
global $article_id, $clang;
$var = 'REX_ARTICLE_VAR';
$matches = $this->getArticleVarInputParams($content, $var);
$article = OOArticle::getArticleById($article_id, $clang);
foreach ($matches as $match) {
list($param_str) = $match;
$content = str_replace($var . '[' . $param_str . ']', $article->getValue($param_str), $content);
}
return $content;
}
示例9: control
public static function control()
{
global $REX;
$myself = 'url_control';
$addon = $REX['ADDON'][$myself]['addon'];
$rewriter = $REX['ADDON'][$myself]['rewriter'];
// http://www.domain.de/kategorie/artikel.html
$url_full = parent::getFullRequestedUrl();
$parse = parse_url($url_full);
$url_path = $parse['path'];
$sql = rex_sql::factory();
//$sql->debugsql = true;
$sql->setQuery('SELECT *
FROM ' . $REX['TABLE_PREFIX'] . 'url_control_manager
WHERE status = "1"
AND (
url = "' . mysql_real_escape_string($url_full) . '"
OR
url = "' . mysql_real_escape_string($url_path) . '"
)
');
if ($sql->getRows() == 1) {
$method = $sql->getValue('method');
$params = unserialize($sql->getValue('method_parameters'));
switch ($method) {
case 'article':
$article_id = (int) $params['article']['article_id'];
$clang = (int) $params['article']['clang'];
if ($params['article']['action'] == 'view') {
return array('article_id' => $article_id, 'clang' => $clang);
} elseif ($params['article']['action'] == 'redirect') {
$a = OOArticle::getArticleById((int) $params['article']['article_id'], (int) $params['article']['clang']);
if ($a instanceof OOArticle) {
if (isset($rewriter[$addon]['get_url'])) {
$func = $rewriter[$addon]['get_url'];
$url = call_user_func($func, $article_id, $clang);
} else {
$url = $a->getUrl();
}
}
//$url = rex_getUrl((int) $params['article']['article_id'], (int) $params['article']['clang']);
self::redirect($a->getUrl(), $params['http_type']['code']);
}
break;
case 'target_url':
$url = $params['target_url']['url'];
self::redirect($url, $params['http_type']['code']);
break;
}
}
return false;
}
示例10: rex_linkmap_format_label
function rex_linkmap_format_label($OOobject)
{
global $REX_USER, $I18N;
$label = $OOobject->getName();
if (trim($label) == '') {
$label = ' ';
}
if ($REX_USER->hasPerm('advancedMode[]')) {
$label .= ' [' . $OOobject->getId() . ']';
}
if (OOArticle::isValid($OOobject) && !$OOobject->hasTemplate()) {
$label .= ' [' . $I18N->msg('lmap_has_no_template') . ']';
}
return $label;
}
示例11: rex_getUrl
/**
* Object Helper Function:
* Returns a url for linking to this article
* This url respects the setting for mod_rewrite
* support!
*
* If you pass an associative array for $params,
* then these parameters will be attached to the URL.
*
*
* USAGE:
* $param = array("order" => "123", "name" => "horst");
* $url = $article->getUrl($param);
*
* - OR -
*
* $url = $article->getUrl("order=123&name=horst");
*
* RETURNS:
* index.php?article_id=1&order=123&name=horst
* or if mod_rewrite support is activated:
* /1-The_Article_Name?order=123&name=horst
*/
function rex_getUrl($id = '', $clang = '', $params = '')
{
global $REX, $article_id;
$id = (int) $id;
$clang = (int) $clang;
// ----- get id
if (strlen($id) == 0 || $id == 0) {
$id = $article_id;
}
// ----- get clang
// Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
// Die rexExtension muss selbst entscheiden was sie damit macht
if (strlen($clang) == 0 && (count($REX['CLANG']) > 1 || rex_extension_is_registered('URL_REWRITE'))) {
$clang = $REX['CUR_CLANG'];
}
// ----- get params
$param_string = '';
if (is_array($params)) {
foreach ($params as $key => $value) {
$param_string .= '&' . $key . '=' . $value;
}
} elseif ($params != '') {
$param_string = str_replace('&', '&', $params);
}
// ----- get article name
$id = (int) $id;
if ($id != 0) {
$ooa = OOArticle::getArticleById($id, $clang);
if ($ooa) {
$name = rex_parseArticleName($ooa->getName());
}
}
if (!isset($name) or $name == '') {
$name = 'NoName';
}
// ----- EXTENSION POINT
$url = rex_register_extension_point('URL_REWRITE', '', array('id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string));
if ($url == '') {
// ----- get rewrite function
if ($REX['MOD_REWRITE'] === true || $REX['MOD_REWRITE'] == 'true') {
$rewrite_fn = 'rexrewrite_apache_rewrite';
} else {
$rewrite_fn = 'rexrewrite_no_rewrite';
}
$url = call_user_func($rewrite_fn, $id, $name, $clang, $param_string);
}
return $url;
}
示例12: enterObject
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
{
global $REX;
if (!isset($REX["xform_classes_be_link"])) {
$REX["xform_classes_be_link"] = 0;
}
$REX["xform_classes_be_link"]++;
$i = $REX["xform_classes_be_link"];
if ($this->value == "" && !$send) {
if (isset($this->elements[3])) {
$this->value = $this->elements[3];
}
}
$wc = "";
if (isset($warning[$this->getId()])) {
$wc = $warning[$this->getId()];
}
$linkname = "";
if ($this->getValue() != "" && ($a = OOArticle::getArticleById($this->getValue()))) {
$linkname = $a->getName();
}
$form_output[] = '
<div class="xform-element formbe_mediapool formlabel-' . $this->getName() . '">
<label class="text ' . $wc . '" for="el_' . $this->getId() . '" >' . $this->elements[2] . '</label>
<div class="rex-widget">
<div class="rex-widget-link">
<p class="rex-widget-field">
<input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']" id="LINK_' . $i . '" value="' . $this->getValue() . '" />
<input type="text" size="30" name="LINK_' . $i . '_NAME" value="' . htmlspecialchars($linkname) . '" id="LINK_' . $i . '_NAME" readonly="readonly" />
</p>
<p class="rex-widget-icons rex-widget-1col">
<span class="rex-widget-column rex-widget-column-first">
<a href="#" class="rex-icon-file-open" onclick="openLinkMap(\'LINK_' . $i . '\', \'&clang=0&category_id=1\');return false;" title="Link auswŠhlen" tabindex="21"></a>
<a href="#" class="rex-icon-file-delete" onclick="deleteREXLink(' . $i . ');return false;" title="AusgewŠhlten Link lšschen" tabindex="22"></a>
</span>
</p>
</div>
</div>
<div class="rex-clearer"></div>
</div>
';
$email_elements[$this->elements[1]] = stripslashes($this->value);
if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
$sql_elements[$this->elements[1]] = $this->value;
}
}
示例13: enterObject
function enterObject()
{
static $counter = 0;
$counter++;
if ($this->getValue() == '' && !$this->params['send']) {
$this->setValue($this->getElement(3));
}
$linkName = '';
if ($this->getValue() != '' && ($a = OOArticle::getArticleById($this->getValue()))) {
$linkName = $a->getName();
}
$this->params['form_output'][$this->getId()] = $this->parse('value.be_link.tpl.php', compact('counter', 'linkName'));
$this->params['value_pool']['email'][$this->getName()] = stripslashes($this->getValue());
if ($this->getElement(4) != 'no_db') {
$this->params['value_pool']['sql'][$this->getName()] = $this->getValue();
}
}
示例14: navi
function navi()
{
echo "<ul>";
// start HTML-List
$max_depth = 3;
// max nesting-depth root is depth=0
$inc_art = true;
// include articles
$inc_root_art = false;
// include root articles
$inc_start_art = false;
// include start article
$config = array($max_depth, $inc_art, $inc_start_art, $inc_root_art);
// config array
$items = [];
// wrapper for subitem sizes
$count = 0;
// items per nesting level
foreach (OOCategory::getRootCategories() as $item) {
if (!$item->isOnline()) {
continue;
}
$count++;
// initalize each root-item
// print root-item
echo '<li><a href="' . $item->getUrl() . '" title="' . $item->getName() . '">' . $item->getName() . '</a></li>';
$d = 0;
// set nesting-depth for root-item
getSubItems($item, $d, $config);
$d = 0;
// REset nesting-depth for root-item
}
// get Root Articles
if (sizeof(OOArticle::getRootArticles()) >= 1 && $config[3]) {
foreach (OOArticle::getRootArticles() as $art) {
if (!$art->isOnline()) {
continue;
}
echo '<li><a href="' . $art->getUrl() . '" title="' . $art->getName() . '">' . $art->getName() . '</a></li>';
}
}
echo "</ul>";
}
示例15: setArticleId
function setArticleId($article_id)
{
// bc
if ($this->viasql) {
return parent::setArticleId($article_id);
}
global $REX;
$article_id = (int) $article_id;
$this->article_id = $article_id;
$OOArticle = OOArticle::getArticleById($article_id, $this->clang);
if (OOArticle::isValid($OOArticle)) {
$this->category_id = $OOArticle->getCategoryId();
$this->template_id = $OOArticle->getTemplateId();
return TRUE;
}
$this->article_id = 0;
$this->template_id = 0;
$this->category_id = 0;
return FALSE;
}