public function setTitle($title)
 {
     $this->title = $title;
     $globalTitleObj = (array) GlobalTitle::explodeURL($this->title);
     $this->setArticleName($globalTitleObj['articleName']);
     $this->setWikiId($globalTitleObj['wikiId']);
 }
Ejemplo n.º 2
0
 public function getLandingParams()
 {
     return GlobalTitle::explodeURL($this->landingTitle);
 }
Ejemplo n.º 3
0
 protected function findIdForUrls($urls, $source = null)
 {
     $data = [];
     if (!empty($urls)) {
         foreach ($urls as $item) {
             $url = $item['url'];
             $result = GlobalTitle::explodeURL($url);
             $wikia_id = $result['wikiId'];
             $articleName = $result['articleName'];
             if (!(empty($wikia_id) || empty($articleName))) {
                 $res = ApiService::foreignCall(WikiFactory::IDtoDB($wikia_id), ['action' => 'query', 'titles' => $articleName, 'indexpageids', 'format' => 'json']);
                 if (!empty($res['query']['pages'])) {
                     $pages = array_keys($res['query']['pages']);
                     $page_id = array_shift($pages);
                     $newItem = $item;
                     $newItem['wikia_id'] = $wikia_id;
                     $newItem['page_id'] = $page_id;
                     $newItem['source'] = $source;
                     $data[] = $newItem;
                 }
             }
         }
     }
     return $data;
 }