当前位置: 首页>>代码示例>>PHP>>正文


PHP rex_article::get方法代码示例

本文整理汇总了PHP中rex_article::get方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_article::get方法的具体用法?PHP rex_article::get怎么用?PHP rex_article::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rex_article的用法示例。


在下文中一共展示了rex_article::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:46,代码来源:function_rex_url.php

示例2: 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;
 }
开发者ID:tzfrs,项目名称:redaxo_yrewrite,代码行数:31,代码来源:forward.php

示例3: 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;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:32,代码来源:var_link.php

示例4: enterObject

 function enterObject()
 {
     $article = rex_article::get($this->getElement(1));
     if ($article) {
         $this->params['form_output'][$this->getId()] = $this->parse('value.article.tpl.php', array('article' => $article));
     }
 }
开发者ID:xong,项目名称:redaxo_yform,代码行数:7,代码来源:article.php

示例5: 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));
 }
开发者ID:staabm,项目名称:redaxo,代码行数:8,代码来源:var_article.php

示例6: 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);
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:8,代码来源:article_handler.php

示例7: 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;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:8,代码来源:system_setting_article_id.php

示例8: 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);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:9,代码来源:article_content.php

示例9: setValue

 public function setValue($value)
 {
     $value = (int) $value;
     $article = rex_article::get($value);
     if (!$article instanceof rex_article) {
         return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
     }
     rex_config::set('structure', $this->key, $value);
     return true;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:10,代码来源:system_setting_article_id.php

示例10: getListValue

 static function getListValue($params)
 {
     if (intval($params['value']) < 1) {
         return '-';
     }
     if ($article = rex_article::get($params['value'])) {
         return $article->getValue('name');
     } else {
         return 'article ' . $params['value'] . ' not found';
     }
 }
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:11,代码来源:be_link.php

示例11: getWidget

 public static function getWidget($id, $name, $value, array $args = [])
 {
     $open_params = '&clang=' . rex_clang::getCurrentId();
     if (isset($args['category']) && ($category = (int) $args['category'])) {
         $open_params .= '&amp;category_id=' . $category;
     }
     $options = '';
     $linklistarray = explode(',', $value);
     if (is_array($linklistarray)) {
         foreach ($linklistarray as $link) {
             if ($link != '') {
                 if ($article = rex_article::get($link)) {
                     $options .= '<option value="' . $link . '">' . htmlspecialchars($article->getName()) . '</option>';
                 }
             }
         }
     }
     $disabled = ' disabled';
     $open_func = '';
     $delete_func = '';
     if (rex::getUser()->getComplexPerm('structure')->hasStructurePerm()) {
         $disabled = '';
         $open_func = 'openREXLinklist(' . $id . ', \'' . $open_params . '\');';
         $delete_func = 'deleteREXLinklist(' . $id . ');';
     }
     $e = [];
     $e['field'] = '
             <select class="form-control" name="REX_LINKLIST_SELECT[' . $id . ']" id="REX_LINKLIST_SELECT_' . $id . '" size="10">
                 ' . $options . '
             </select>
             <input type="hidden" name="' . $name . '" id="REX_LINKLIST_' . $id . '" value="' . $value . '" />';
     $e['moveButtons'] = '
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'top\');return false;" title="' . rex_i18n::msg('var_linklist_move_top') . '"><i class="rex-icon rex-icon-top"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'up\');return false;" title="' . rex_i18n::msg('var_linklist_move_up') . '"><i class="rex-icon rex-icon-up"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'down\');return false;" title="' . rex_i18n::msg('var_linklist_move_down') . '"><i class="rex-icon rex-icon-down"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'bottom\');return false;" title="' . rex_i18n::msg('var_linklist_move_bottom') . '"><i class="rex-icon rex-icon-bottom"></i></a>';
     $e['functionButtons'] = '
                 <a href="#" class="btn btn-popup" onclick="' . $open_func . 'return false;" title="' . rex_i18n::msg('var_link_open') . '"' . $disabled . '><i class="rex-icon rex-icon-open-linkmap"></i></a>
                 <a href="#" class="btn btn-popup" onclick="' . $delete_func . 'return false;" title="' . rex_i18n::msg('var_link_delete') . '"' . $disabled . '><i class="rex-icon rex-icon-delete-link"></i></a>';
     $fragment = new rex_fragment();
     $fragment->setVar('elements', [$e], false);
     $link = $fragment->parse('core/form/widget_list.php');
     return $link;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:44,代码来源:var_linklist.php

示例12: execute

 public function execute()
 {
     $article_id = rex_request('article_id', 'int');
     $clang = rex_request('clang', 'int');
     $slice_id = rex_request('slice_id', 'int');
     $direction = rex_request('direction', 'string');
     $ooArt = rex_article::get($article_id, $clang);
     if (!$ooArt instanceof rex_article) {
         throw new rex_api_exception('Unable to find article with id "' . $article_id . '" and clang "' . $clang . '"!');
     }
     $category_id = $ooArt->getCategoryId();
     /**
      * @var rex_user
      */
     $user = rex::getUser();
     // check permissions
     if (!$user->hasPerm('moveSlice[]')) {
         throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
     }
     if (!$user->getComplexPerm('structure')->hasCategoryPerm($category_id)) {
         throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
     }
     // modul und rechte vorhanden ?
     $CM = rex_sql::factory();
     $CM->setQuery('select * from ' . rex::getTablePrefix() . 'article_slice left join ' . rex::getTablePrefix() . 'module on ' . rex::getTablePrefix() . 'article_slice.module_id=' . rex::getTablePrefix() . 'module.id where ' . rex::getTablePrefix() . "article_slice.id='{$slice_id}' and clang_id={$clang}");
     if ($CM->getRows() != 1) {
         throw new rex_api_exception(rex_i18n::msg('module_not_found'));
     } else {
         $module_id = (int) $CM->getValue(rex::getTablePrefix() . 'article_slice.module_id');
         // ----- RECHTE AM MODUL ?
         if ($user->getComplexPerm('modules')->hasPerm($module_id)) {
             $message = rex_content_service::moveSlice($slice_id, $clang, $direction);
         } else {
             throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
         }
     }
     $result = new rex_api_result(true, $message);
     return $result;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:39,代码来源:api_content.php

示例13: rex_metainfo_content_sidebar

function rex_metainfo_content_sidebar($extionPointParams)
{
    $params = $extionPointParams->getParams();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $content = $fragment->parse('core/page/section.php');
    return $content;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:24,代码来源:extension_content_sidebar.php

示例14: getStartArticle

 /**
  * Return the start article for this category.
  *
  * @return rex_article
  */
 public function getStartArticle()
 {
     return rex_article::get($this->id, $this->clang_id);
 }
开发者ID:staabm,项目名称:redaxo,代码行数:9,代码来源:category.php

示例15: rex_mediapool_mediaIsInUse

/**
 * @param $filename
 *
 * @return bool|string
 */
function rex_mediapool_mediaIsInUse($filename)
{
    $sql = rex_sql::factory();
    $filename = addslashes($filename);
    // FIXME move structure stuff into structure addon
    $values = [];
    for ($i = 1; $i < 21; ++$i) {
        $values[] = 'value' . $i . ' REGEXP "(^|[^[:alnum:]+_-])' . $filename . '"';
    }
    $files = [];
    $filelists = [];
    for ($i = 1; $i < 11; ++$i) {
        $files[] = 'media' . $i . '="' . $filename . '"';
        $filelists[] = 'FIND_IN_SET("' . $filename . '",medialist' . $i . ')';
    }
    $where = '';
    $where .= implode(' OR ', $files) . ' OR ';
    $where .= implode(' OR ', $filelists) . ' OR ';
    $where .= implode(' OR ', $values);
    $query = 'SELECT DISTINCT article_id, clang_id FROM ' . rex::getTablePrefix() . 'article_slice WHERE ' . $where;
    $warning = [];
    $res = $sql->getArray($query);
    if ($sql->getRows() > 0) {
        $warning[0] = rex_i18n::msg('pool_file_in_use_articles') . '<br /><ul>';
        foreach ($res as $art_arr) {
            $aid = $art_arr['article_id'];
            $clang = $art_arr['clang_id'];
            $ooa = rex_article::get($aid, $clang);
            $name = $ooa->getName();
            $warning[0] .= '<li><a href="javascript:openPage(\'' . rex_url::backendPage('content', ['article_id' => $aid, 'mode' => 'edit', 'clang' => $clang]) . '\')">' . $name . '</a></li>';
        }
        $warning[0] .= '</ul>';
    }
    // ----- EXTENSION POINT
    $warning = rex_extension::registerPoint(new rex_extension_point('MEDIA_IS_IN_USE', $warning, ['filename' => $filename]));
    if (!empty($warning)) {
        return implode('<br />', $warning);
    }
    return false;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:45,代码来源:function_rex_mediapool.php


注:本文中的rex_article::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。