Beispiel #1
0
    }
    if (!$defs->enabled) {
        continue;
    }
    $next = array($defs->url);
    $visited = array();
    $items = array();
    $count = 0;
    do {
        $url = $next[0];
        $visited[$url] = 1;
        $dom = get_dom($url);
        $nodes = $dom->query($defs->root);
        debug(count($nodes) . ' nodes');
        foreach ($nodes as $node) {
            if ($result = parse_item($node, $defs, $fix)) {
                $items[] = $result;
            }
        }
        $next = array();
        if ($defs->next) {
            foreach ($dom->query($defs->next) as $node) {
                $next[] = base_url($node->getAttribute('href'));
            }
        }
    } while (!empty($next) && !isset($visited[$next[0]]) && ++$count != 5);
    // max 5 pages
    //debug($items); exit();
    ical($defs, $items);
}
function parse_item($node, $defs, $fix)
Beispiel #2
0
                     $guild = parse_guild($xml);
                     parse_item($xml, '/guild/room/*', $guild);
                     $list_guild[$guild->id] = $guild;
                 } else {
                     if (ryzom_character_valid_key($key, $uid, $slot, $full)) {
                         $list_correct_ckey[] = $ckey;
                         $xml = ryzom_character_simplexml($key, 'full');
                         if ($xml == null) {
                             throw new Exception(__("Connection with ryzom_api impossible."));
                         }
                         $character = parse_character($xml);
                         $xml_inv = ryzom_character_simplexml($key, 'items');
                         if ($xml == null) {
                             throw new Exception(__("Connection with ryzom_api impossible."));
                         }
                         parse_item($xml_inv, '/items/room/*', $character);
                         $list_guild[$character->id] = $character;
                     } else {
                         $error_msg .= __('Invalid key') . "<br />";
                     }
                 }
             } catch (Exception $e) {
                 $error_msg .= $e->getMessage() . "<br />";
                 array_pop($list_correct_ckey);
             }
         }
     }
 }
 if ($error_msg != "") {
     $error_msg = '<div class="error">' . $error_msg . '</div>';
     $error_msg .= '<br /><a class="ryzom-ui-button" href="?">' . __("Select your API Key again") . '</a><hr/><br />';