/** * Extracts category tags from wikitext and returns a hash of the categories * and the wikitext with categories removed. If wikitext is not provided, it will * attempt to pull it from the current article. * * @param String $wikitext * @param Boolean $force by default === false; set it to true if you want to skip cache * * @return Array */ public static function getExtractedCategoryData($wikitext = '', $force = false) { if (!isset(self::$data)) { // Try to extract wikitext from the article if (empty($wikitext)) { /** @var Article $article */ $article = F::app()->wg->Article; if (isset($article)) { $wikitext = $article->fetchContent(); } } if (!empty($wikitext)) { self::$data = self::extractCategoriesFromWikitext($wikitext, $force); } } return self::$data; }