Utils/WikiTagUtils.php
changeset 129 65c12455ce74
parent 120 6fd1ff318825
--- a/Utils/WikiTagUtils.php	Tue Apr 08 13:13:30 2014 +0200
+++ b/Utils/WikiTagUtils.php	Fri Jul 04 16:57:17 2014 +0200
@@ -224,7 +224,8 @@
             }
         }
         
-        $url = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates")["wikipedia_api"].'?'.$params_str;
+        $url_templates = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates");
+        $url = $url_templates["wikipedia_api"].'?'.$params_str;
         
         $res = WikiTagUtils::curlRequest($url);
         $val = json_decode($res, true);
@@ -260,10 +261,11 @@
     /**
      * Builds DbPedia URI
      */
-    public static function getDbpediaUri($label, $params=[], $throw_error=true, $req_param="label")
+    public static function getDbpediaUri($label, $params=array(), $throw_error=true, $req_param="label")
     {
     	// Get lang from url
-    	$dbp_url = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates")["dbpedia_sparql"];
+    	$url_templates = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates");
+    	$dbp_url = $url_templates["dbpedia_sparql"];
     	$lang = substr($dbp_url, 7, 2);
     	// filter with regexp to avoid results with "category:LABEL" or other "abc:LABEL"
     	$query = 'select distinct * where { ?s rdfs:label "'.$label.'"@'.$lang.' . FILTER (regex(?s, "^http\\\\://[^:]+$")) }';
@@ -274,10 +276,10 @@
     		$query = 'select distinct * where { ?s foaf:isPrimaryTopicOf <'.$label.'> }';
     	}
     	
-    	$params = [
+    	$params = array(
     		"query" => $query,
     		"format" => 'application/json',
-    	];
+    	);
     	
     	$params_str = '';
     	foreach ($params as $key => $value) {
@@ -289,7 +291,8 @@
     		}
     	}
     	
-    	$url = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates")["dbpedia_sparql"].'?'.$params_str;
+    	$url_templates = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.url_templates");
+    	$url = $url_templates["dbpedia_sparql"].'?'.$params_str;
     	
     	$res = WikiTagUtils::curlRequest($url, $throw_error);
     	$val = json_decode($res, true);