~ubuntu-branches/ubuntu/utopic/kdevelop-php/utopic

« back to all changes in this revision

Viewing changes to create_functions.php

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2010-05-18 12:21:48 UTC
  • mto: (5.1.1 squeeze) (1.1.5)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20100518122148-04mq5800fnjfbs48
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
$skipClasses[] = 'parent';
36
36
$skipClasses[] = '__php_incomplete_class';
37
37
$skipClasses[] = 'php_user_filter';
 
38
$skipClasses[] = 'static'; // O_o where does that come from?
38
39
 
39
40
///TODO: re-enable them once they have their do(), echo() or list() methods removed.
40
41
$skipClasses[] = 'gearmanclient';
74
75
 
75
76
    $dirs = array(
76
77
        $_SERVER['argv'][1]."/reference",
 
78
        $_SERVER['argv'][1]."/features",
77
79
        $_SERVER['argv'][1]."/appendices",
78
80
        $_SERVER['argv'][1]."/language/predefined/"
79
81
    );
146
148
    // remove <para> and other stuff
147
149
    ///TODO: support web-links, lists and tables
148
150
    $comment = strip_tags($comment);
 
151
    $comment = html_entity_decode($comment);
 
152
 
 
153
    // make sure no */ occurs in a comment...
 
154
    $comment = preg_replace('#\*/#', '* /', $comment);
149
155
 
150
156
    $comment = preg_replace('#(?<=[^\n])\n(?=[^\n])#s', ' ', $comment);
151
157
 
368
374
    if (substr($file->getFilename(), -4) != '.xml') return false;
369
375
    if (substr($file->getFilename(), 0, 9) == 'entities.') return false;
370
376
    $string = file_get_contents($file->getPathname());
371
 
    $string = preg_replace('#<!\\[CDATA\\[.*?\\]\\]>#s', '', $string);
372
377
    $isInterface = strpos($string, '<phpdoc:classref') !== false &&
373
378
                   strpos($string, '&reftitle.interfacesynopsis;') !== false;
374
379
 
380
385
        $string = preg_replace('#'.preg_quote('<section xml:id="'.$i.'">').'.*?</section>#s', '', $string);
381
386
    }
382
387
    echo "reading documentation from {$file->getPathname()}\n";
383
 
    $xml = new SimpleXMLElement($string);
 
388
    $xml = simplexml_load_string($string,  "SimpleXMLElement",  LIBXML_NOCDATA);
384
389
 
385
390
    if ( $file->getFilename() == 'versions.xml' ) {
386
391
        foreach ( $xml->xpath('/versions/function') as $f ) {
447
452
                    // check for comment
448
453
                    // next entry is the value of the constant which is followed by the comment
449
454
                    if ( isset($consts[$i+2]) && !$consts[$i+2]->children() ) {
450
 
                        $comment = (string)$consts[$i+2];
 
455
                        $comment = $consts[$i+2]->asXml();
451
456
                        if ( !empty($comment) ) {
452
457
                            $constants_comments[(string)$p->constant] = $comment;
453
458
                        }
456
461
                $constants[(string)$p->constant] = (string)$p->type;
457
462
            }
458
463
        }
 
464
    } else if (!isset($xml->variablelist) && $file->getFilename() == 'commandline.xml') {
 
465
        // yay for non-unified xml structures :-X
 
466
        $consts = $xml->xpath("//db:row");
 
467
        foreach ( $consts as $i=>$p ) {
 
468
            $constant = "";
 
469
                    // default to integer constants
 
470
            $type = "integer";
 
471
            if ( isset($p->entry[0]) && isset($p->entry[0]->constant) ) {
 
472
                $constant = trim((string) $p->entry[0]->constant);
 
473
                if ( isset($p->entry[0]->constant->type) ) {
 
474
                    $type = (string)$p->entry[0]->constant->type;
 
475
                }
 
476
            }
 
477
            if (empty($constant)) {
 
478
                continue;
 
479
            }
 
480
            // check for comment
 
481
            // next entry is the comment
 
482
            if ( isset($p->entry[1]) ) {
 
483
                $comment = $p->entry[1]->para->asXml();
 
484
                if ( !empty($comment) ) {
 
485
                    $constants_comments[$constant] = $comment;
 
486
                }
 
487
            }
 
488
            $constants[$constant] = $type;
 
489
        }
459
490
    }
460
491
    if ($list = $xml->xpath('//db:sect2[starts-with(@xml:id, "reserved.classes")]/db:variablelist/db:varlistentry')) {
461
492
        foreach ($list as $l) {