/**
  * Render the #get_web_data parser function
  */
 static function doGetWebData(&$parser)
 {
     global $wgTitle, $edgCurPageName, $edgValues;
     // If we're handling multiple pages, reset $edgValues
     // when we move from one page to another.
     $cur_page_name = $wgTitle->getText();
     if (!isset($edgCurPageName) || $edgCurPageName != $cur_page_name) {
         $edgValues = array();
         $edgCurPageName = $cur_page_name;
     }
     $params = func_get_args();
     array_shift($params);
     // we already know the $parser ...
     $args = EDUtils::parseParams($params);
     // parse params into name-value pairs
     if (array_key_exists('url', $args)) {
         $url = $args['url'];
     } else {
         return;
     }
     $url = str_replace(' ', '%20', $url);
     // do some minor URL-encoding
     // if the URL isn't allowed (based on a whitelist), exit
     if (!EDUtils::isURLAllowed($url)) {
         return;
     }
     if (array_key_exists('format', $args)) {
         $format = strtolower($args['format']);
     } else {
         $format = '';
     }
     $external_values = EDUtils::getDataFromURL($url, $format);
     if (count($external_values) == 0) {
         return;
     }
     if (array_key_exists('data', $args)) {
         // parse the 'data' arg into mappings
         $mappings = EDUtils::paramToArray($args['data'], false, true);
     } else {
         return;
     }
     if (array_key_exists('filters', $args)) {
         // parse the 'filters' arg
         $filters = EDUtils::paramToArray($args['filters'], true, false);
     } else {
         $filters = array();
     }
     self::setGlobalValuesArray($external_values, $filters, $mappings);
 }
 /**
  * Render the #get_soap_data parser function.
  */
 static function doGetSOAPData(&$parser)
 {
     global $edgCurPageName, $edgValues, $edgCacheExpireTime;
     // If we're handling multiple pages, reset $edgValues
     // when we move from one page to another.
     $cur_page_name = $parser->getTitle()->getText();
     if (!isset($edgCurPageName) || $edgCurPageName != $cur_page_name) {
         $edgValues = array();
         $edgCurPageName = $cur_page_name;
     }
     $params = func_get_args();
     array_shift($params);
     // we already know the $parser ...
     $args = EDUtils::parseParams($params);
     // parse params into name-value pairs
     if (array_key_exists('url', $args)) {
         $url = $args['url'];
     } else {
         return EDUtils::formatErrorMessage(wfMessage('externaldata-no-param-specified', 'url')->parse());
     }
     $url = str_replace(' ', '%20', $url);
     // do some minor URL-encoding
     // if the URL isn't allowed (based on a whitelist), exit
     if (!EDUtils::isURLAllowed($url)) {
         return EDUtils::formatErrorMessage("URL is not allowed");
     }
     if (array_key_exists('request', $args)) {
         $requestName = $args['request'];
     } else {
         return EDUtils::formatErrorMessage(wfMessage('externaldata-no-param-specified', 'request')->parse());
     }
     if (array_key_exists('requestData', $args)) {
         $requestData = EDUtils::paramToArray($args['requestData']);
     } else {
         return EDUtils::formatErrorMessage(wfMessage('externaldata-no-param-specified', 'requestData')->parse());
     }
     if (array_key_exists('response', $args)) {
         $responseName = $args['response'];
     } else {
         return EDUtils::formatErrorMessage(wfMessage('externaldata-no-param-specified', 'response')->parse());
     }
     if (array_key_exists('data', $args)) {
         $mappings = EDUtils::paramToArray($args['data']);
         // parse the data arg into mappings
     } else {
         return EDUtils::formatErrorMessage(wfMessage('externaldata-no-param-specified', 'data')->parse());
     }
     $external_values = EDUtils::getSOAPData($url, $requestName, $requestData, $responseName, $mappings);
     if (is_string($external_values)) {
         // It's an error message - display it on the screen.
         return EDUtils::formatErrorMessage($external_values);
     }
     self::setGlobalValuesArray($external_values, array(), $mappings);
 }