예제 #1
0
 function regexp()
 {
     return '(?=.*\\b' . glob_to_pcre($this->word) . '\\b)';
 }
예제 #2
0
파일: stdlib.php 프로젝트: hugcoday/wiki
 function fileSet($directory, $filepattern = false)
 {
     $this->_fileList = array();
     $this->_pattern = $filepattern;
     if ($filepattern) {
         $this->_pcre_pattern = glob_to_pcre($this->_pattern);
     }
     $this->_case = !isWindows();
     $this->_pathsep = '/';
     if (empty($directory)) {
         trigger_error(sprintf(_("%s is empty."), 'directoryname'), E_USER_NOTICE);
         return;
         // early return
     }
     @($dir_handle = opendir($dir = $directory));
     if (empty($dir_handle)) {
         trigger_error(sprintf(_("Unable to open directory '%s' for reading"), $dir), E_USER_NOTICE);
         return;
         // early return
     }
     while ($filename = readdir($dir_handle)) {
         if ($filename[0] == '.' || filetype($dir . $this->_pathsep . $filename) != 'file') {
             continue;
         }
         if ($this->_filenameSelector($filename)) {
             array_push($this->_fileList, "{$filename}");
             //trigger_error(sprintf(_("found file %s"), $filename),
             //                      E_USER_NOTICE); //debugging
         }
     }
     closedir($dir_handle);
 }
예제 #3
0
<?php

error_reporting(~E_ALL);
// fix "lib/stdlib.php:1348: Warning[2]: Compilation failed: unmatched parentheses at offset 2"
include dirname(__FILE__) . "/../lib/stdlib.php";
foreach (array("test", "test*", "test*.mpg", "Calendar/test*.mpg", "Calendar/*", "test.mpg*", "test\\*", "test\\.*", "test.*", "test\$", "*test", "*test.mpg", "te()st", "tes(t]", "tes<t>") as $s) {
    echo '"', $s, '" => "', glob_to_pcre($s), "\"\n";
}