本文整理汇总了PHP中find_max函数的典型用法代码示例。如果您正苦于以下问题:PHP find_max函数的具体用法?PHP find_max怎么用?PHP find_max使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_max函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($package == 'sawfish') {
return find_max($lines, "/sawfish/", "/^.*sawfish_([\\d\\.]*\\d)\\.tar.*\$/");
}
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-?([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:JamesLinus,项目名称:BLFS,代码行数:60,代码来源:blfs-chapter26.php
示例2: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
global $kde_ver;
global $kde_lines;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
// No ftp for kde apps
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
if ($package == "konsole" || $package == "kdeplasma-addons" || $package == "kate" || $package == "gwenview") {
return "check manually";
}
if (!is_array($kde_lines)) {
$dirpath = "http://download.kde.org/stable/applications/";
$lines = http_get_file($dirpath);
$kde_ver = find_max($lines, "/4\\./", "/^.*;(1[\\d\\.]+\\d)\\/.*\$/");
$kde_lines = http_get_file("{$dirpath}/{$kde_ver}/src");
}
if (!is_array($kde_lines)) {
return $lines;
}
return find_max($kde_lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
}
// End fetch
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:renodr,项目名称:blfs-currency,代码行数:53,代码来源:blfs-chapter29.php
示例3: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
global $previous;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
// glib type packages
if ($book_index == "pygobject1" || $book_index == "pygobject" || $book_index == "pygtk" || $book_index == "pyatspi") {
// Parent listing
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines = http_get_file("{$dirpath}/");
if ($book_index == "pygobject") {
$dir = find_even_max($lines, '/^2[\\d\\.]+$/', '/^(2[\\d\\.]+)$/');
} else {
$dir = find_even_max($lines, '/^[\\d\\.]+$/', '/^([\\d\\.]+)$/');
}
$dirpath .= "/{$dir}/";
}
// gcc and similar
if ($book_index == "gcc") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines = http_get_file("{$dirpath}/");
return find_max($lines, "/gcc-\\d/", "/^.*gcc-(\\d[\\d\\.]+).*\$/");
}
// slang
if ($book_index == "slang") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position) . "/latest";
}
if ($book_index == "vala") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines = http_get_file("{$dirpath}/");
$dir = find_even_max($lines, "/\\d[\\d\\.]+/", "/^(\\d[\\d\\.]+).*/");
$dirpath .= "/{$dir}/";
}
if ($book_index == "cvs") {
// Get the max directory
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines = http_get_file("{$dirpath}/");
return find_max($lines, "/\\d\\.[\\d\\.]+/", "/^.* (\\d\\.[\\d\\.]+)\$/");
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
// glib type packages
if ($book_index == "pygobject1" || $book_index == "pygobject" || $book_index == "pygtk" || $book_index == "pyatspi") {
// Parent listing
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines1 = http_get_file($dirpath);
if ($book_index == "pygobject") {
$dir = find_even_max($lines1, '/^\\s+2[\\d\\.]+.*$/', '/^\\s+(2[\\d\\.]+).*$/');
} else {
$dir = find_even_max($lines1, '/^\\s+[\\d\\.]+.*$/', '/^\\s+([\\d\\.]+).*$/');
}
$dirpath .= "/{$dir}/";
}
// Customize http directories as needed
if ($book_index == "cmake") {
//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:BLFS,代码行数:101,代码来源:blfs-chapter13.php
示例4: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// These are constant - have not changed in 10 years
if ($package == "docbk") {
return "31";
}
if ($package == "docbook") {
return "4.5";
}
if ($package == "openjade") {
return "1.3.2";
}
if ($package == "docbook-dsssl") {
return "1.79";
}
if ($package == "docbook-dsssl-doc") {
return "1.79";
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($package == "texlive") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
$dir = find_max($dirs, "/20\\d\\d/", "/^.*(20\\d\\d).*\$/");
$lines = http_get_file("{$dirpath}/{$dir}/");
$ver = find_max($lines, "/texlive-/", "/^.*texlive-(\\d+).*\$/");
return $ver == "0" ? "pending" : $ver;
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
if ($book_index == "gnu-gs-fonts-other") {
$dirs = http_get_file($dirpath);
$dir = find_max($dirs, "/misc.*GPL/", "/^\\s*([\\d\\.]+.*)\$/");
$dir = preg_replace("/ /", '%20', $dir);
$dir = preg_replace("/\\(/", '%28', $dir);
$dir = preg_replace("/\\)/", '%29', $dir);
$dirpath .= "/{$dir}";
}
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($package == "cups") {
return find_max($lines, "/^.*cups-/", "/^.*cups-([\\d\\.]+)-source.*\$/");
}
if ($package == "sgml-common") {
return find_max($lines, "/sgml-common/", "/^.*sgml-common-([\\d\\.]+).tgz.*\$/");
}
if ($package == "docbook-xml") {
return find_max($lines, "/4\\.\\d/", "/^.*(4\\.\\d),.*\$/");
}
if ($package == "docbook-xsl") {
return find_max($lines, "/\\.\\d+/", "/^\\s*([\\d\\.]+)\$/");
}
//.........这里部分代码省略.........
开发者ID:renodr,项目名称:blfs-currency,代码行数:101,代码来源:blfs-chapter43.php
示例5: get_packages
function get_packages($package, $dirpath)
{
global $exceptions;
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
if ($book_index == "mplayer") {
return "daily";
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($package == "cdparanoia-III") {
return find_max($lines, "/^.*cdparanoia-III-/", "/^.*cdparanoia-III-([\\d\\.]+).src.tgz.*\$/");
}
if ($package == "amarok") {
return find_max($lines, "/\\d\\./", "/^.*;([\\d\\.]+)\\/.*\$/");
}
if ($package == "xine-ui") {
return find_max($lines, "/\\d\\./", "/^\\s*([\\d\\.]+)\$/");
}
if ($package == "dvd+rw-tools") {
return find_max($lines, "/dvd\\+/", "/^.*dvd\\+rw-tools-([\\d\\.]+).tar.*\$/");
}
if ($package == "vlc") {
return find_max($lines, "/\\d\\.[\\d\\.]+\\//", "/^([\\d\\.]+)\\/.*\$/");
}
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:renodr,项目名称:blfs-currency,代码行数:76,代码来源:blfs-chapter40.php
示例6: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
if ($package == "x") {
return 'daily';
}
// Daily snapshot for x264
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($package == "audiofile" || $package == "esound" || $package == "opal") {
// Default ftp enties for this chapter
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
exec("echo 'ls -1;bye' | ncftp {$dirpath}/", $dirs);
$dir = find_max($dirs, "/^\\d/", "/^([\\d\\.]+).*\$/");
$dirpath .= "/{$dir}/";
}
// Get listing
exec("echo 'ls -1;bye' | ncftp {$dirpath}/", $lines);
} else {
if ($package == "libdvdcss" || $package == "libdvdnav" || $package == "libdvdread") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$lines = http_get_file($dirpath . "/");
return find_max($lines, "/^\\d\\./", ":^(\\d[\\d\\.]+)/.*\$:", TRUE);
}
// Directories are in the form of mmddyy :(
if ($package == "libmpeg3") {
$a = array();
$dirs = http_get_file($dirpath);
foreach ($dirs as $d) {
// Isolate the version and put in an array
$slice = preg_replace("/^\\s*(\\d{2})(\\d{2})(\\d{2})\\s*\$/", "\$3\$2\$1", $d);
if ("x{$slice}" == "x{$d}") {
continue;
}
array_push($a, $slice);
}
rsort($a, SORT_NATURAL);
// Max version is at the top
$dir = $a[0];
$lines = http_get_file("{$dirpath}/{$dir}");
return find_max($lines, "/libmpeg3/", "/^.*libmpeg3-(\\d[\\d\\.]+)-src.*\$/");
}
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($package == "faad2") {
return find_max($lines, "/faad2-\\d/", "/^.*faad2-([\\d\\.]+).*\$/");
}
if ($package == "gst-plugins-bad") {
return find_max($lines, "/^.*bad-/", "/^.*bad-(0.10[\\d\\.]+).tar.*\$/");
}
//.........这里部分代码省略.........
开发者ID:renodr,项目名称:blfs-currency,代码行数:101,代码来源:blfs-chapter39.php
示例7: tal
?>
</tbody>
</table>
@endif
<script type="text/javascript">
function tal(event){
//DIRECT HIRE PRODUCTION | SALES Monthly
<?php
foreach ($users as $user) {
$maxpointDaily = find_max(max($pointDaily[$user->cont]));
$maxpointMonthly = find_max(max($pointMonthly[$user->cont]));
$maxdirectHire = find_max(max($directHire[$user->cont]));
$maxdirectHireAnnual = find_max(max($directHireAnnual[$user->cont]));
$maxtempGMP = find_max(max($gmp[$user->cont]));
$maxgmpAnnual = find_max(max($gmpAnnual[$user->cont]));
?>
var pointDaily = '#pointDaily' +<?php
echo $user->id;
?>
;
var pointMonthly = '#pointMonthly' +<?php
echo $user->id;
?>
;
var directHire = '#directHire' +<?php
echo $user->id;
?>
;
var directHireAnnual = '#directHireAnnual' +<?php
echo $user->id;
开发者ID:villar88,项目名称:salesperformanceindicator,代码行数:31,代码来源:_companyuserlist.blade.php
示例8: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($package == 'network-manager-applet') {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
$dir = find_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
// Not even
$dirpath .= "/{$dir}/";
} else {
// All other ftp enties for this chapter
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
$dir = find_even_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
$dirpath .= "/{$dir}/";
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:JamesLinus,项目名称:BLFS,代码行数:78,代码来源:blfs-chapter31.php
示例9: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
global $libreoffice;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($package == "seamonkey" || $package == "firefox" || $package == "thunderbird") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 2
$dirpath .= "/";
$dirs = http_get_file($dirpath);
if ($package == "seamonkey") {
return find_max($dirs, "/\\d\\./", "/^.* (\\d\\.[\\.\\d]+)\$/");
} else {
return find_max($dirs, "/\\d\\./", "/^.*(\\d{2}[\\.\\d]+)\$/");
}
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
if (preg_match("/abiword/", $dirpath)) {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 2
}
if ($book_index == "gnucash-docs") {
$dirs = http_get_file($dirpath);
$dir = find_max($dirs, "/^\\s+\\d\\./", "/^\\s+(\\d\\.[\\d\\.]+)\$/");
$dirpath .= "/{$dir}/";
}
if ($book_index == "xchat") {
$dirs = http_get_file($dirpath);
$dir = find_max($dirs, "/^\\s*\\d\\./", ":^\\s*(\\d\\.[\\d\\.]+)/.*\$:");
$dirpath .= "/{$dir}/";
}
if (preg_match("/^libre/", "{$package}")) {
if (count($libreoffice) == 0) {
$dirs = http_get_file($dirpath);
$dir = find_max($dirs, "/\\d\\./", "/^.*;([\\d\\.]+)\\/.*\$/");
$dirpath = "http://download.documentfoundation.org/libreoffice/src/{$dir}";
$libreoffice = http_get_file($dirpath);
}
return find_max($libreoffice, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
}
if ($package == "gimp") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$dirs = http_get_file("{$dirpath}/");
$dir = find_max($dirs, "/v\\d\\./", "/^.*(v\\d\\.[\\d\\.]+).*\$/");
$dirpath .= "/{$dir}/";
}
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
//.........这里部分代码省略.........
开发者ID:renodr,项目名称:blfs-currency,代码行数:101,代码来源:blfs-chapter36.php
示例10: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($book_index == "bind") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$lines1 = http_get_file("{$dirpath}/");
$dir = find_max($lines1, "/\\d\$/", "/^.* ([\\d\\.P\\-]+)\$/");
$dirpath .= "/{$dir}/";
$lines2 = http_get_file($dirpath);
return find_max($lines2, "/bind-/", "/^.*bind-(\\d+[\\d\\.P\\-]+).tar.*\$/");
}
if ($book_index == "dhcp") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$lines = http_get_file("{$dirpath}/");
$dir = find_max($lines, "/\\d\$/", "/^.* (\\d\\.[\\d\\.P\\-]+)\$/");
$dirpath .= "/{$dir}/";
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
if ($book_index == "NetworkManager") {
// Get the max directory and adjust the directory path
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$lines1 = http_get_file($dirpath);
$dir = find_max($lines1, "/\\d[\\d\\.]+/", "/^\\s*(\\d[\\d\\.]+).*\$/");
$dirpath .= "/{$dir}/";
}
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
if ($book_index == "exiv") {
$ver = "2-{$ver}";
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($book_index == "dhcp") {
return find_max($lines, '/dhcp/', '/^.*dhcp-([\\d\\.P-]+).tar.*$/');
}
if ($book_index == "ncftp") {
return find_max($lines, '/ncftp/', '/^.*ncftp-([\\d\\.]+)-src.tar.*$/');
}
if ($book_index == "net-tools-CVS") {
return find_max($lines, '/net-tools/', '/^.*_(\\d+).tar.*$/');
}
if ($book_index == "ntp") {
$dir = max_parent($dirpath, "ntp-");
$lines = http_get_file("{$dir}");
return find_max($lines, '/ntp-.*tar/', '/^ntp-([\\d\\.p]+).tar.*$/');
}
//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:BLFS,代码行数:101,代码来源:blfs-chapter14.php
示例11: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
global $kde_ver;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($book_index == "polkit-gnome") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
}
if ($book_index == "libsecret") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
$dir = find_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
$dirpath .= "/{$dir}/";
}
// gsettings-desktop-schemas and similar
if ($book_index == "gsettings-desktop-schemas" || $book_index == "GConf" || $book_index == "gcr" || $book_index == "gvfs" || $book_index == "yelp-xsl" || $book_index == "gnome-desktop" || $book_index == "gnome-keyring" || $book_index == "gnome-video-effects" || $book_index == "gtksourceview" || $book_index == "libgtop" || $book_index == "libpeas" || $book_index == "libwnck" || $book_index == "totem-pl-parser" || $book_index == "vte" || $book_index == "dconf" || $book_index == "gnome-icon-theme" || $book_index == "gnome-icon-theme-symbolic" || $book_index == "gnome-themes-standard" || $book_index == "notification-daemon" || $book_index == "yelp" || $book_index == "libgnome-keyring") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
//if ( $book_index == "libpeas" )
// $dir = find_max( $dirs, "/\d$/", "/^.* ([\d\.]+)$/" );
//else
$dir = find_even_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
$dirpath .= "/{$dir}/";
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($book_index == "polkit-gnome") {
return find_max($lines, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
}
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:JamesLinus,项目名称:BLFS,代码行数:92,代码来源:blfs-chapter30.php
示例12: get_packages
function get_packages($package, $dirpath)
{
global $regex;
global $book_index;
global $url_fix;
global $current;
global $kde_ver;
if (isset($current) && $book_index != "{$current}") {
return 0;
}
// Fix up directory path
foreach ($url_fix as $u) {
$replace = $u['replace'];
$match = $u['match'];
if (isset($u['pkg'])) {
if ($package == $u['pkg']) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
} else {
if (preg_match("/{$match}/", $dirpath)) {
$dirpath = preg_replace("/{$match}/", "{$replace}", $dirpath);
break;
}
}
}
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
if ($book_index == "polkit-gnome") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
}
if ($book_index == "libsecret") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
$dir = find_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
$dirpath .= "/{$dir}/";
}
// gsettings-desktop-schemas and similar
if ($book_index == "gsettings-desktop-schemas" || $book_index == "libsecret" || $book_index == "totem-pl-parser" || $book_index == "vte" || $book_index == "yelp-xsl" || $book_index == "GConf" || $book_index == "gcr" || $book_index == "geocode-glib" || $book_index == "gjs" || $book_index == "gnome-desktop" || $book_index == "gnome-menus" || $book_index == "gnome-video-effects" || $book_index == "grilo" || $book_index == "gtkhtml" || $book_index == "gtksourceview" || $book_index == "libchamplain" || $book_index == "libgee" || $book_index == "libgtop" || $book_index == "libgweather" || $book_index == "libpeas" || $book_index == "rest" || $book_index == "libwnck" || $book_index == "gnome-online-accounts" || $book_index == "libgdata" || $book_index == "evolution-data-server" || $book_index == "caribou" || $book_index == "dconf" || $book_index == "gnome-backgrounds" || $book_index == "adwaita-icon-theme" || $book_index == "gnome-themes-standard" || $book_index == "gvfs" || $book_index == "nautilus" || $book_index == "zenity" || $book_index == "gnome-bluetooth" || $book_index == "gnome-keyring" || $book_index == "gnome-settings-daemon" || $book_index == "gnome-control-center" || $book_index == "mutter" || $book_index == "gnome-shell" || $book_index == "gnome-shell-extensions" || $book_index == "gnome-session" || $book_index == "gdm" || $book_index == "gnome-user-docs" || $book_index == "yelp") {
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
// Up 1
$dirs = http_get_file("{$dirpath}/");
if ($book_index == "gjs" || $book_index == "gnome-menus" || $book_index == "rest") {
$dir = find_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
} else {
$dir = find_even_max($dirs, "/\\d\$/", "/^.* ([\\d\\.]+)\$/");
}
$dirpath .= "/{$dir}/";
}
// Get listing
$lines = http_get_file("{$dirpath}/");
} else {
$lines = http_get_file($dirpath);
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
foreach ($lines as $l) {
if (preg_match('/^\\h*$/', $l)) {
continue;
}
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
return $ver;
// Return first match of regex
}
return 0;
// This is an error
}
if ($book_index == "telepathy-glib" || $book_index == "telepathy-mission-control") {
return find_even_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
}
// Most packages are in the form $package-n.n.n
// Occasionally there are dashes (e.g. 201-1)
$max = find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.]*\\d)\\.tar.*\$/");
return $max;
}
开发者ID:renodr,项目名称:blfs-currency,代码行数:93,代码来源:blfs-chapter30.php
示例13: get_packages
function get_packages($package, $dirpath)
{
global $exceptions;
global $regex;
global $book_index;
// Check for ftp
if (preg_match("/^ftp/", $dirpath)) {
$dirpath = substr($dirpath, 6);
// Remove ftp://
$dirpath = rtrim($dirpath, "/");
// Trim any trailing slash
$position = strpos($dirpath, "/");
// Divide at first slash
$server = substr($dirpath, 0, $position);
$path = substr($dirpath, $position);
//echo "server=$server path=$path\n";
$conn = ftp_connect($server);
if (!isset($conn)) {
//echo "No connection\n";
return -7;
}
if (!ftp_login($conn, "anonymous", "")) {
//echo "anonymous ftp login failed\n";
return -8;
}
// See if we need special handling
if (isset($exceptions[$package])) {
$specials = explode(":", $exceptions[$package]);
foreach ($specials as $i) {
list($op, $regexp) = explode("=", $i);
switch ($op) {
case "UPDIR":
// Remove last dir from $path
$position = strrpos($path, "/");
$path = substr($path, 0, $position);
// Get dir listing
$lines = ftp_rawlist($conn, $path);
$max = find_max($lines, $regexp, $regexp);
break;
case "DOWNDIR":
// Append found directory
$path .= "/{$max}";
break;
default:
echo "Error in specials array for {$package}\n";
return 0;
break;
}
}
}
//echo "start ftp_rawlist path=$path\n";
$lines = ftp_rawlist($conn, $path);
//print_r($lines);
ftp_close($conn);
} else {
// Customize http directories as needed
if ($package == 'cracklib') {
$dirpath = "http://sourceforge.net/projects/cracklib/files/{$package}";
}
// Need to get max directory from here
if ($package == 'cracklib-words') {
$dirpath = "http://sourceforge.net/projects/cracklib/files/{$package}";
$lines = http_get_file($dirpath);
//print_r( $lines );
$max = find_max($lines, "/\\d{4}-\\d{2}-\\d{2}/", "/^.*(\\d{4}-\\d{2}-\\d{2}).*\$/");
if ($max == 0) {
return -6;
}
$dirpath .= "/{$max}";
$lines = http_get_file($dirpath);
return find_max($lines, "/{$package}/", "/^.*{$package}-([\\d\\.-]*\\d)\\.gz.*\$/");
}
if ($book_index == "krb") {
// Remove last two dirs from $path
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
$position = strrpos($dirpath, "/");
$dirpath = substr($dirpath, 0, $position);
}
$lines = http_get_file($dirpath);
//print_r( $lines );
if (!is_array($lines)) {
return $lines;
}
}
// End fetch
if (isset($regex[$package])) {
// Custom search for latest package name
//print_r($lines);
foreach ($lines as $l) {
$ver = preg_replace($regex[$package], "\$1", $l);
if ($ver == $l) {
continue;
}
echo "ver={$ver} l={$l}\n";
if ($package == 'krb') {
$ver = "5-{$ver}";
}
return $ver;
// Return first match of regex
//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:BLFS,代码行数:101,代码来源:blfs-latest.php
-
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1291|2022-08-30
-
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1205|2022-08-17
-
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:1002|2022-11-06
-
Vesta v1.0.0-5 was discovered to contain a cross-site scripting (XSS) vulnerabil
阅读:533|2022-07-29
-
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1401|2022-08-18
-
sslcommerz/SSLCommerz-Laravel: SSLCOMMERZ is a bangladeshi payment gateway provi
阅读:917|2022-08-13
-
qiangxi/CheckUpdateLibrary: Android检查更新库
阅读:881|2022-08-15
-
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:518|2022-08-16
-
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:669|2022-11-06
-
这个文章不会说具体0到1的代码流程,我会着重讲几个问题的解决 准备以下依赖 amp;quot
阅读:643|2022-07-18
|
请发表评论