Loads language for article object.

@param \OxidEsales\Eshop\Application\Model\Article $article
@param string                                      $oxId

@return \OxidEsales\Eshop\Application\Model\Article
432573
protected function updateArticle($article, $oxId)
    {
        $article->loadInLang(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage"), $oxId);

        return $article;
    }
872129
public function importAuthors($oldArticleId, $article)
    {
        $this->consoleOutput->writeln("Reading authors...");

        $authorSql = "SELECT first_name, last_name, email, seq FROM authors " .
            "WHERE submission_id = :id ORDER BY first_name, last_name, email";
        $authorStatement = $this->dbalConnection->prepare($authorSql);
        $authorStatement->bindValue('id', $oldArticleId);
        $authorStatement->execute();

        $authors = $authorStatement->fetchAll();
        foreach ($authors as $pkpAuthor) {
            $author = new Author();
            $author->setCurrentLocale('en');
            $author->setFirstName(!empty($pkpAuthor['first_name']) ? $pkpAuthor['first_name'] : '-');
            $author->setLastName(!empty($pkpAuthor['last_name']) ? $pkpAuthor['last_name'] : '-');
            $author->setEmail(
                !empty($pkpAuthor['email']) && $pkpAuthor['email'] !== '-' ?
                    $pkpAuthor['email'] :
                    'author@example.com'
            );

            $articleAuthor = new ArticleAuthor();
            $articleAuthor->setAuthor($author);
            $articleAuthor->setArticle($article);
            $articleAuthor->setAuthorOrder(!empty($pkpAuthor['seq']) ? $pkpAuthor['seq'] : 0);
        }
    }
1253963
public function update(Article $article, ArticlesFormRequest $request)
    {
        $article->fill($request->all());
        $article->published     = $request->get('published', false);
        $article->featured      = $request->get('featured', false);
        $article->authenticated = $request->get('authenticated', false);
        $article->is_page       = $request->get('is_page', false);
        $article->save();

        $article->permissions()->sync($request->get('permissions', []));
        if ($request->tags) {
            $article->retag(explode(',', $request->tags));
        }

        event(new ArticleWasUpdated($article));

        flash()->success(trans('cms::article.update.success'));

        return redirect()->route('administrator.articles.index');
    }
1109150
public function load( $sOxId )
    {
        $sSQL = sprintf(
            'SELECT `OXID`, `OXUSERID`, `OXPAYMENTSID`, DECODE( `OXVALUE`, "%s" ) AS `OXVALUE`,
              `OXPSPAYMORROWBANKNAME`, `OXPSPAYMORROWIBAN`, `OXPSPAYMORROWBIC`, `OXPSPAYMORROWORDERID`
              FROM `oxuserpayments` WHERE `OXID` = %s',
            $this->getPaymentKey(),
            oxDb::getDb()->quote( $sOxId )
        );

        return $this->assignRecord( $sSQL );
    }
131300
public function importCitations($oldArticleId, $article)
    {
        $this->consoleOutput->writeln("Reading citations...");

        $citationSql = "SELECT * FROM citations WHERE assoc_id = :id";
        $citationStatement = $this->dbalConnection->prepare($citationSql);
        $citationStatement->bindValue('id', $oldArticleId);
        $citationStatement->execute();

        $orderCounter = 0;
        $citations = $citationStatement->fetchAll();
        foreach ($citations as $pkpCitation) {
            $citation = new Citation();
            $citation->setRaw(!empty($pkpCitation['raw_citation']) ? $pkpCitation['raw_citation'] : '-');
            $citation->setOrderNum(!empty($pkpCitation['seq']) ? $pkpCitation['seq'] : $orderCounter);
            $article->addCitation($citation);

            $orderCounter++;
        }
    }
340704
public function getRecommListsUrl(\OxidEsales\Eshop\Application\Model\Article $oArticle)
    {
        $oLang = Registry::getLang();
        $iLang = $oLang->getBaseLanguage();

        return $this->_prepareUrl(
            "cl=rss&amp;fnc=recommlists&amp;anid=" . $oArticle->getId(),
            $oLang->translateString("LISTMANIA", $iLang) . "/" . $oArticle->oxarticles__oxtitle->value
        );
    }
785697
public function getArticle($articleNumber)
    {
        $requestData = new Get\RequestData();
        $requestData->setArticleNumber($articleNumber);

        $request = new Get\Request($requestData);
        $request->setLimit(1);

        /** @var Get\ApiResponse $apiResponse */
        $apiResponse = $this->sendRequest($request, Get\ApiResponse::class);
        $articles = $apiResponse->getResponse()->getArticles();

        return isset($articles[0]) ? $articles[0] : null;
    }
1315919
private function loadTranslation($language)
    {
        /** @var $translation ActiveRecord */
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        $oldAttributes = $this->owner->getOldAttributes();
        $searchFields = [$this->languageField => $language];

        foreach ($relation->link as $languageModelField => $mainModelField) {
            if (empty($oldAttributes)) {
                $searchFields[$languageModelField] = $this->owner->$mainModelField;
            } else {
                $searchFields[$languageModelField] = $oldAttributes[$mainModelField];
            }
        }

        $translation = $class::findOne($searchFields);

        if ($translation === null) {
            $translation = new $class;
            $translation->setAttributes($searchFields, false);
        }

        return $translation;
    }
987515
protected function onVendorActionArticleUpdateConditions($articleIds)
    {
        return 'oxid in (' . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($articleIds)) . ')';
    }
942625
def publish_article(article, language, changed_by=None):
    
    article = article.reload()

    # get username
    if changed_by:
        username = changed_by.get_username()
    else:
        username = 'script'

    with current_user(username):
        article.publish(language)

    return article.reload()
605479
public function saveinnlang()
    {
        parent::save();

        $soxId = $this->getEditObjectId();
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");

        if (isset($aParams['oxcontents__oxloadid'])) {
            $aParams['oxcontents__oxloadid'] = $this->_prepareIdent($aParams['oxcontents__oxloadid']);
        }

        // checkbox handling
        if (!isset($aParams['oxcontents__oxactive'])) {
            $aParams['oxcontents__oxactive'] = 0;
        }

        $oContent = oxNew(\OxidEsales\Eshop\Application\Model\Content::class);

        if ($soxId != "-1") {
            $oContent->loadInLang($this->_iEditLang, $soxId);
        } else {
            $aParams['oxcontents__oxid'] = null;
        }

        $oContent->setLanguage(0);
        $oContent->assign($aParams);

        // apply new language
        $oContent->setLanguage(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("new_lang"));
        $oContent->save();

        // set oxid if inserted
        $this->setEditObjectId($oContent->getId());
    }
1072289
protected function _loadFromDb($articleId)
    {
        $sSelect = $this->buildSelectString([$this->getViewName() . ".oxid" => $articleId]);

        return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->getRow($sSelect);
    }
57589
private function loadTranslation($language) {
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        $language = strtolower($language);
        if ($this->owner->getPrimarykey()) {
            $translation = $class::findOne(
                            [$this->languageField => $language, key($relation->link) => $this->owner->getPrimarykey()]
            );
        }
        if ($translation === null) {
            $translation = new $class;
            $translation->{key($relation->link)} = $this->owner->getPrimaryKey();
            $translation->{$this->languageField} = $language;
        }
        return $translation;
    }
1343686
public function saveinnlang()
    {
        $soxId = $this->getEditObjectId();
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
        // checkbox handling
        if (!isset($aParams['oxlinks__oxactive'])) {
            $aParams['oxlinks__oxactive'] = 0;
        }

        $oLinks = oxNew(\OxidEsales\Eshop\Application\Model\Links::class, getViewName('oxlinks'));
        $iEditLanguage = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editlanguage");

        if ($soxId != "-1") {
            $oLinks->loadInLang($iEditLanguage, $soxId);
        } else {
            $aParams['oxlinks__oxid'] = null;
            //$aParams = $oLinks->ConvertNameArray2Idx( $aParams);
        }

        //Disable editing for derived items
        if ($oLinks->isDerived()) {
            return;
        }

        $oLinks->setLanguage(0);
        $oLinks->assign($aParams);

        // apply new language
        $oLinks->setLanguage(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("new_lang"));
        $oLinks->save();

        // set oxid if inserted
        $this->setEditObjectId($oLinks->getId());
    }
376632
protected function _loadArticles($oVendor)
    {
        $sVendorId = $oVendor->getId();

        // load only articles which we show on screen
        $iNrOfCatArticles = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNrofCatArticles');
        $iNrOfCatArticles = $iNrOfCatArticles ? $iNrOfCatArticles : 1;

        $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $oArtList->setSqlLimit($iNrOfCatArticles * $this->_getRequestPageNr(), $iNrOfCatArticles);
        $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent()));

        // load the articles
        $this->_iAllArtCnt = $oArtList->loadVendorArticles($sVendorId, $oVendor);

        // counting pages
        $this->_iCntPages = ceil($this->_iAllArtCnt / $iNrOfCatArticles);

        return [$oArtList, $this->_iAllArtCnt];
    }
1367910
public static function filter(&$article)
		{
			// Can't perform this filter unless language is known
			if(!isset($article->language) || empty($article->language))
			{
				return;
			}
			
			// Stop words are language dependant so this filter relies on previously detected language
			$stopWordResource = new \WebArticleExtractor\ResourceProvider("stop_words/".$article->language.".lst");
			$article->keywords = array();
			
			// Append article title, its likely keywords will be in here.
			$sentences = KeywordFilter::getSentences(str_replace('\u00a0'," ",str_replace("\r\n",'.',$article->title.". ".$article->text)));
			$phrases = KeywordFilter::getPhrases($sentences, $stopWordResource);
			$wordScores = KeywordFilter::getWordScores($phrases);
			$candidatePhrases = KeywordFilter::getPhraseScores($phrases, $wordScores);
			
			// Clean candidates
			foreach ($candidatePhrases as $key => $value) 
			{
				if($value > self::WORD_SCORE_THRESHOLD)
				{
					$article->keywords[] = trim($key);
				}
			}
			
			//TODO: Weight by candidate phrase's word occurences in other top candidate phrases
		}
569777
public static function filter(&$article)
		{
			$StopWordLanguageMap = new \WebArticleExtractor\ResourceProvider("stop_words");
			
			$topLang = '';
			$topScore = 0;
			foreach ($StopWordLanguageMap->resourceContent as $value) 
			{
				//echo json_encode($value);
				$regex = LanguageFilter::regexForWordList($value[1],self::WORD_MATCH_THRESSHOLD);
				$languageScore = preg_match_all($regex,$article->text);
				
				// Uncomment for debug
				//echo $value[0].'-'.$languageScore;
				//echo '<br/>';
				
				if($languageScore > $topScore)
				{
					$topLang = $value[0];
					$topScore = $languageScore;
				}
				
				$article->language = $topLang;
			}
		}