function processGet(array $aArgs)
{
    header('Content-Type: application/json');
    try {
        $sType = WWWUtility::validateArg($aArgs, 'type', '/^(data|group)$/');
        switch ($sType) {
            case 'group':
                print processGroup($aArgs);
                break;
            case 'data':
                print processData($aArgs);
        }
    } catch (InvalidArgumentException $iae) {
        print "error: " . $iae->getMessage() . ";";
    }
}
Exemple #2
0
 function processGroup($xml, $tags = array())
 {
     $errors = array();
     // tags are the words of the outline parent
     if ((string) $xml['title'] && $xml['title'] != '/') {
         $tags[] = (string) $xml['title'];
     }
     foreach ($xml->outline as $outline) {
         if ((string) $outline['type']) {
             $ret = addSubscription($outline, $tags);
             if ($ret !== true) {
                 $errors[] = $ret;
             }
         }
         if ($outline['type'] == 'folder') {
             //folder type, no functionality yet!
             echo "Folder type:<br>";
         } else {
             $ret = processGroup($outline, $tags);
             //$errors = array_merge($errors, $ret);
         }
     }
 }