Exemplo n.º 1
0
 public function crawlingAction()
 {
     $site = $this->getSite();
     $conf = Pimcore_Google_Webmastertools::getSiteConfig($site);
     $service = $this->getService();
     $data = $service->getFeed("https://www.google.com/webmasters/tools/feeds/" . urlencode($conf->profile) . "/crawlissues/");
     $issues = array();
     foreach ($data as $d) {
         $issue = array("title" => (string) $d->getTitle(), "linkedfrom" => array());
         $e = $d->getExtensionElements();
         foreach ($e as $a) {
             if ($a->rootElement == "linked-from") {
                 $issue["linkedfrom"][] = $a->getText();
             } else {
                 $issue[str_replace("-", "", $a->rootElement)] = $a->getText();
             }
         }
         $issue["linkedfrom"] = implode("\n", $issue["linkedfrom"]);
         $issues[] = $issue;
     }
     $this->_helper->json(array("issues" => $issues));
 }