Example #1
0
 public function __construct($article_id = 0, $clang = null)
 {
     if ($article_id == 0) {
         $article_id = rex_article::getCurrentId();
     }
     if (is_null($clang)) {
         $clang = rex_clang::getCurrentId();
     }
     if ($article = rex_article::get($article_id, $clang)) {
         $this->article = $article;
         $this->domain = rex_yrewrite::getDomainByArticleId($article_id, $clang);
     }
 }
 * YREWRITE Addon.
 *
 * @author jan.kristinus@yakamara.de
 *
 * @package redaxo\yrewrite
 *
 * @var rex_addon $this
 */
// TODO: content/yrewrite_url: { title: 'translate:mode_url', perm: 'yrewrite[url]' }
ob_start();
$addon = rex_addon::get('yrewrite');
$article_id = $params['article_id'];
$clang = $params['clang'];
$ctype = $params['ctype'];
// $yrewrite_url = stripslashes(rex_request('yrewrite_url'));
$domain = rex_yrewrite::getDomainByArticleId($article_id, $clang);
$isStartarticle = rex_yrewrite::isDomainStartArticle($article_id, $clang);
$autoUrl = rex_getUrl();
if (0 === strpos($autoUrl, $domain->getUrl())) {
    $autoUrl = substr($autoUrl, strlen($domain->getUrl()));
} else {
    $autoUrl = substr($autoUrl, strlen($domain->getPath()));
}
if ($isStartarticle) {
    echo rex_view::warning($addon->i18n('startarticleisalways', $domain->getName()));
} else {
    $yform = new rex_yform();
    $yform->setObjectparams('form_action', rex_url::backendController(['page' => 'content/edit', 'article_id' => $article_id, 'clang' => $clang, 'ctype' => $ctype], false));
    $yform->setObjectparams('form_id', 'yrewrite-url');
    $yform->setObjectparams('form_name', 'yrewrite-url');
    $yform->setHiddenField('yrewrite_func', 'url');