@param Articles $articles
@param int      $absolute

@return string
496407
public function getArticleShowPermalink(Articles $articles, $absolute = 1)
    {
        return $this->getContainer()->get('router')->generate($this->getArticleShowRoute(), $this->getArticleShowRouteParameters($articles), $absolute);
    }
395726
public function edit(Article $article)
    {
        $categories = ArticleCategory::getAllList();

        return $this->view('titan::blog.create_edit', compact('categories'))->with('item', $article);
    }
984813
public static function filter(&$article)
		{
			$prevBlock;
			$nextBlock;
			$count = 0;
			foreach ($article->textBlocks as $textBlock) 
			{
				$validContent = false;
				$currentBlock = $textBlock;
				
				if(sizeof($article->textBlocks) > $count)
				{
					$nextBlock = $article->textBlocks[$count+1];
				}
				else
				{
					break; // No next block
				}
				
				if(!isset($prevBlock))
				{
					$prevBlock = $textBlock;
					continue;
				}
				
				// Check link densities
				if($currentBlock->linkDensity <= 0.333333)
				{
					if($prevBlock->linkDensity <= 0.555556)
					{
						if($currentBlock->numWords <= 16)
						{
							if($nextBlock->numWords <= 15)
							{
								if($prevBlock->numWords <= 4)
								{
									$validContent = false;
								}
								else
								{
									$validContent = true;
								}
							}
							else
							{
								$validContent = true;
							}
						}
						else
						{
							$validContent = true;
						}
					}
					else
					{
						if($currentBlock->numWords <= 40)
						{
							if($nextBlock->numWords <= 17)
							{
								$validContent = false;
							}
							else
							{
								$validContent = true;
							}
						}
						else
						{
							$validContent = true;
						}
					}
				}
				else
				{
					$validContent = false;
				}
				
				$textBlock->isContent = $validContent;
				$prevBlock = $textBlock;
				$count++;
			}
		}
830524
public static function filter(&$article)
		{
			$numberOfWords = 0;
			$foundEndOfText = false;
			
			foreach ($article->textBlocks as $textBlock) 
			{
				$endBlock = in_array(Labels::END_BLOCK_LABEL, $textBlock->labels);

				if($textBlock->isContent)
				{
					$numberOfWords += $textBlock->numFullTextWords;
				}
				
				if($endBlock && $numberOfWords >= self::WORD_COUNT_THRESHOLD)
				{
					$foundEndOfText = true;
				}
				
				if($foundEndOfText)
				{
					$textBlock->isContent = false;
				}
			}
		}
866788
public static function filter(&$article)
		{
			if(count($article->textBlocks) < 2)
			{
				return;
			}
			
			$largestCount = -1;
			$largestCountKey = NULL;
			
			foreach ($article->textBlocks as $key => $textBlock) 
			{
				if($textBlock->numWords > $largestCount)
				{
					$largestCountKey = $key;
					$largestCount = $textBlock->numWords;
				}
			}
			
			foreach ($article->textBlocks as $key => $textBlock) 
			{
				if($key != $largestCountKey)
				{
					$textBlock->isContent = false;
					$textBlock->labels[] = Labels::POSSIBLY_CONTENT_LABEL;
				}
			}
		}
640965
public function setArticle(Article $article = null)
    {
        $this->article = $article;
        $this->url = null;

        return $this;
    }
417786
public function getUrl( $absolute = TRUE ){
		$url	= new ADT_URL( getEnv( 'REQUEST_URI' ) );
		if( $absolute ){
			$url->setScheme( getEnv( 'REQUEST_SCHEME' ) );
			$url->setHost( getEnv( 'HTTP_HOST' ) );
		}
		return $url;
	}
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;
    }
149593
public static function generateRelativePath($absolutePath)
    {
        if ($start = strpos($absolutePath, '/pages/')) {
            return substr($absolutePath, $start + 7);
        } elseif ($start = strpos($absolutePath, '/templates/')) {
            return substr($absolutePath, $start + 11);
        }

        return $absolutePath;
    }
1249033
private function findWritingLockMeta(ArticleInterface $article)
    {
        $metaLock = null;

        //search writing_lock data
        foreach($article->getMetaData() as $meta)
        {
            if($meta->getKey() == 'writing_locked')
            {
                $metaLock = $meta;

                break;
            }
        }

        return $metaLock;
    }
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;
			}
		}
1212020
public function edit(Article $article)
    {
        $tags         = Article::existingTags()->pluck('name');
        $selectedTags = implode(',', $article->tagNames());

        return view('administrator.articles.edit', compact('article', 'tags', 'selectedTags'));
    }
632059
public function deleteAction(Article $article)
    {
        $blogViewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $article->getBlog()->getId()]);

        $this->get('victoire_blog.manager.article')->delete($article);

        $message = $this->get('translator')->trans('victoire.blog.article.delete.success', [], 'victoire');
        $this->congrat($message);

        $response = [
            'success' => true,
            'url'     => $this->generateUrl('victoire_core_page_show', [
                    'url' => $blogViewReference->getUrl(),
                ]
            ),
            'message' => $message,
        ];

        return new JsonResponse($response);
    }
959976
protected function getNameOfSmallestPacketForArticle( $articleName )
	{
		foreach( array_keys( $this->packets ) as $packetName )
			if( $this->volumes[$packetName][$articleName] <= 1 )
				return $packetName;
	}
811258
public function getLink($rel, $absolute = true)
    {
        if (!$this->hasLink($rel)) {
            throw new \InvalidArgumentException("Link not found: $rel");
        }
        $url = $this->data['_links'][$rel]['href'];
        if ($absolute && strpos($url, '//') === false) {
            $url = $this->makeAbsoluteUrl($url);
        }
        return $url;
    }
1197279
public function run(Article $article): self {
        $this->document($article->getDoc());

        $this->removeXPath('//comment()');
        $this->replace('em, strong, b, i, strike, del, ins', function($node) {
            return !$node->find('img')->count();
        });
        $this->replace('span[class~=dropcap], span[class~=drop_cap]');
        $this->remove('script, style');
        $this->remove('header, footer, input, form, button, aside');
        $this->removeBadTags();
        $this->remove("[id='caption'],[class='caption']");
        $this->remove("[id*=' google '],[class*=' google ']");
        $this->remove("[id*='more']:not([id^=entry-]),[class*='more']:not([class^=entry-])");
        $this->remove("[id*='facebook']:not([id*='-facebook']),[class*='facebook']:not([class*='-facebook'])");
        $this->remove("[id*='facebook-broadcasting'],[class*='facebook-broadcasting']");
        $this->remove("[id*='twitter']:not([id*='-twitter']),[class*='twitter']:not([class*='-twitter'])");
        $this->replace('span', function($node) {
            if (is_null($node->parent())) {
                return false;
            }

            return $node->parent()->is('p');
        });
        $this->convertToParagraph('div, span, article');

        return $this;
    }
525889
public function getNamespaceNames($absolute = FALSE) {
    $iterator = function(NamespaceNode $ns) use ($absolute) {
      $name = $ns->getName();
      return $absolute ? $name->getAbsolutePath() : $name->getPath();
    };
    return array_map($iterator, $this->getNamespaces()->toArray());
  }