Example #1
0
function buildDir($dir)
{
    global $filesToBuild;
    global $ext;
    $files = preg_grep('/^([^.])/', scandir($dir));
    //过滤隐藏文件
    foreach ($files as $idx => $item) {
        if (!is_dir($dir . DS . $item)) {
            //file
            $filePath = $dir . DS . $item;
            if (preg_match("/" . $ext . "/", $filePath) && !isExcluded($filePath)) {
                //只替换ext文件类型
                buildFile($filePath);
            }
        } else {
            buildDir($dir . DS . $item);
        }
    }
}
Example #2
0
     $base = $stream;
 }
 if (strstr($base, 'rtmp')) {
     preg_match("@.+(rtmp.+) app.+@", $base, $match);
     $base = $match[1];
     $match = null;
     unset($match);
 }
 if (trim($base) == '') {
     continue;
 }
 if (@strstr($stream, '#')) {
     continue;
 }
 # ? des fois $stream est un array
 if (isExcluded($base)) {
     print "[DBG] exclude {$base}\n";
     continue;
 } else {
     print "[DBG] test: {$base}\n";
 }
 foreach ($type as $t => $proto) {
     $flux = str_replace("{$t}://", $proto, $flux);
 }
 if (DEBUG) {
     print "[DBG]\tstart test (" . date("c") . ")\n";
 }
 $todo++;
 $pid[$base] = null;
 $pid[$base] = pcntl_fork();
 if ($pid[$base] == -1) {
Example #3
0
function listanchors($text)
{
    global $pageurl;
    print '<ul>';
    $regexp = "<a\\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\\/a>";
    if (preg_match_all("/{$regexp}/siU", $text, $matches)) {
        foreach ($matches[0] as $m) {
            $originalmatch = $m;
            preg_match('/href="([^"]*)"/i', $m, $regs);
            if ($regs[1] == "") {
                preg_match('/href=\'([^\']*)\'/i', $m, $regs);
            }
            $url = $regs[1];
            $reconstructedurl = $url;
            if (strpos($url, "#") === 0) {
                $reconstructedurl = $pageurl . $url;
                $m = str_replace($url, $reconstructedurl, $m);
            }
            print '<li>';
            print preg_replace('/style=".*?"/', '', preg_replace('/class=".*?"/', '', $m));
            print '<br/>' . htmlspecialchars($originalmatch);
            if (isExcluded($reconstructedurl)) {
                print '<br><span class="excluded">' . get_string('exclusion', 'linkschecker') . '</span>';
            }
            if (!isinCourse($reconstructedurl, "page")) {
                print '<br><span class="outside"></span>';
            }
            print '</li>';
        }
    } else {
        /*         * * if no match is found ** */
        echo '<li>' . get_string('resourcesnotfound', 'linkschecker') . '</li>';
    }
    print '</ul>';
    //print '<br>';
}