*
 * @category  Moodle
 * @package   webservice
 * @copyright Copyright (c) 1999 onwards Martin Dougiamas     http://dougiamas.com
 * @license   http://www.gnu.org/copyleft/gpl.html     GNU GPL License
 */
/**
 * This file generate a web service documentation in HTML
 * This documentation describe how to call a Moodle Web Service
 */
require_once '../config.php';
require_once 'lib.php';
$protocol = optional_param('protocol', "soap", PARAM_ALPHA);
print_header(get_string('wspagetitle', 'webservice'), get_string('wspagetitle', 'webservice') . ":", true);
webservice_lib::display_webservices_availability($protocol);
generate_documentation($protocol);
generate_functionlist();
print_footer();
/**
 * Generate documentation specific to a protocol
 * @param string $protocol
 */
function generate_documentation($protocol)
{
    switch ($protocol) {
        case "soap":
            $documentation = get_string('soapdocumentation', 'webservice');
            break;
        case "xmlrpc":
            $documentation = get_string('xmlrpcdocumentation', 'webservice');
            break;
Example #2
0
        die;
    }
    $l = $languages[$extension];
    // The dividing token we feed into Pygments, to delimit the boundaries between
    // sections.
    $l["divider_text"] = "\n" . $l["symbols"][0] . "DIVIDER\n";
    // The mirror of `divider_text` that we expect Pygments to return. We can split
    // on this to recover the original sections.
    $l["divider_html"] = '/\\n*?<span class="c[1]?">' . $l["symbols"][0] . 'DIVIDER<\\/span>\\n*?/s';
    return $l;
}
global $options;
global $sources;
$sources = array();
$args = new Args();
//Default options
$options = array("outputdir" => "docs");
if ($outputdir = $args->flag("o")) {
    $options["outputdir"] = $outputdir;
}
if (count($args->args) == 0) {
    print "You must supply a filename to continue.\n";
}
foreach ($args->args as $filename) {
    $e = explode(".", $filename);
    $basename = $e[0];
    $sources[] = $basename;
}
foreach ($args->args as $filename) {
    generate_documentation($filename);
}