当前位置: 首页>>代码示例>>PHP>>正文


PHP OS_Guess::getSignature方法代码示例

本文整理汇总了PHP中OS_Guess::getSignature方法的典型用法代码示例。如果您正苦于以下问题:PHP OS_Guess::getSignature方法的具体用法?PHP OS_Guess::getSignature怎么用?PHP OS_Guess::getSignature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OS_Guess的用法示例。


在下文中一共展示了OS_Guess::getSignature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: switch

 function _installFile($file, $atts, $tmp_path)
 {
     static $os;
     if (isset($atts['platform'])) {
         if (empty($os)) {
             include_once "OS/Guess.php";
             $os = new OS_Guess();
         }
         // return if this file is meant for another platform
         if (!$os->matchSignature($atts['platform'])) {
             $this->log(3, "skipped {$file} (meant for {$atts['platform']}, we are " . $os->getSignature() . ")");
             return PEAR_INSTALLER_SKIPPED;
         }
     }
     switch ($atts['role']) {
         case 'doc':
         case 'data':
         case 'test':
             $dest_dir = $this->config->get($atts['role'] . '_dir') . DIRECTORY_SEPARATOR . $this->pkginfo['package'];
             unset($atts['baseinstalldir']);
             break;
         case 'ext':
         case 'php':
             $dest_dir = $this->config->get($atts['role'] . '_dir');
             break;
         case 'script':
             $dest_dir = $this->config->get('bin_dir');
             break;
         case 'src':
         case 'extsrc':
             $this->source_files++;
             return;
         default:
             return $this->raiseError("Invalid role `{$atts['role']}' for file {$file}");
     }
     if (!empty($atts['baseinstalldir'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), DIRECTORY_SEPARATOR, array($dest_file, $orig_file));
     $installed_as = $dest_file;
     $final_dest_file = $this->_prependPath($dest_file, $this->installroot);
     $dest_dir = dirname($final_dest_file);
     $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
     if (!@is_dir($dest_dir)) {
         if (!$this->mkDirHier($dest_dir)) {
             return $this->raiseError("failed to mkdir {$dest_dir}", PEAR_INSTALLER_FAILED);
         }
         $this->log(3, "+ mkdir {$dest_dir}");
     }
     if (empty($atts['replacements'])) {
         if (!@copy($orig_file, $dest_file)) {
             return $this->raiseError("failed to write {$dest_file}", PEAR_INSTALLER_FAILED);
         }
         $this->log(3, "+ cp {$orig_file} {$dest_file}");
         if (isset($atts['md5sum'])) {
             $md5sum = md5_file($dest_file);
         }
     } else {
         $fp = fopen($orig_file, "r");
         $contents = fread($fp, filesize($orig_file));
         fclose($fp);
         if (isset($atts['md5sum'])) {
             $md5sum = md5($contents);
         }
         $subst_from = $subst_to = array();
         foreach ($atts['replacements'] as $a) {
             $to = '';
             if ($a['type'] == 'php-const') {
                 if (preg_match('/^[a-z0-9_]+$/i', $a['to'])) {
                     eval("\$to = {$a['to']};");
                 } else {
                     $this->log(0, "invalid php-const replacement: {$a['to']}");
                     continue;
                 }
             } elseif ($a['type'] == 'pear-config') {
                 $to = $this->config->get($a['to']);
             } elseif ($a['type'] == 'package-info') {
                 $to = $this->pkginfo[$a['to']];
             }
             if ($to) {
                 $subst_from[] = $a['from'];
                 $subst_to[] = $to;
             }
         }
         $this->log(3, "doing " . sizeof($subst_from) . " substitution(s) for {$final_dest_file}");
         if (sizeof($subst_from)) {
             $contents = str_replace($subst_from, $subst_to, $contents);
         }
         $wp = @fopen($dest_file, "w");
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:logicalframe,代码行数:101,代码来源:Installer.php

示例2: substr

 /**
  * @param string filename
  * @param array attributes from <file> tag in package.xml
  * @param string path to install the file in
  * @param array options from command-line
  * @access private
  */
 function _installFile($file, $atts, $tmp_path, $options)
 {
     // {{{ return if this file is meant for another platform
     static $os;
     if (!isset($this->_registry)) {
         $this->_registry =& $this->config->getRegistry();
     }
     if (isset($atts['platform'])) {
         if (empty($os)) {
             $os = new OS_Guess();
         }
         if (strlen($atts['platform']) && $atts['platform'][0] == '!') {
             $negate = true;
             $platform = substr($atts['platform'], 1);
         } else {
             $negate = false;
             $platform = $atts['platform'];
         }
         if ((bool) $os->matchSignature($platform) === $negate) {
             $this->log(3, "skipped {$file} (meant for {$atts['platform']}, we are " . $os->getSignature() . ")");
             return PEAR_INSTALLER_SKIPPED;
         }
     }
     // }}}
     $channel = $this->pkginfo->getChannel();
     // {{{ assemble the destination paths
     switch ($atts['role']) {
         case 'doc':
         case 'data':
         case 'test':
             $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel) . DIRECTORY_SEPARATOR . $this->pkginfo->getPackage();
             unset($atts['baseinstalldir']);
             break;
         case 'ext':
         case 'php':
             $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel);
             break;
         case 'script':
             $dest_dir = $this->config->get('bin_dir', null, $channel);
             break;
         case 'src':
         case 'extsrc':
             $this->source_files++;
             return;
         default:
             return $this->raiseError("Invalid role `{$atts['role']}' for file {$file}");
     }
     $save_destdir = $dest_dir;
     if (!empty($atts['baseinstalldir'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_file, $orig_file));
     $final_dest_file = $installed_as = $dest_file;
     if (isset($this->_options['packagingroot'])) {
         $installedas_dest_dir = dirname($final_dest_file);
         $installedas_dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
         $final_dest_file = $this->_prependPath($final_dest_file, $this->_options['packagingroot']);
     } else {
         $installedas_dest_dir = dirname($final_dest_file);
         $installedas_dest_file = $installedas_dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
     }
     $dest_dir = dirname($final_dest_file);
     $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
     // }}}
     if (empty($this->_options['register-only']) && !@is_dir($dest_dir)) {
         if (!$this->mkDirHier($dest_dir)) {
             return $this->raiseError("failed to mkdir {$dest_dir}", PEAR_INSTALLER_FAILED);
         }
         $this->log(3, "+ mkdir {$dest_dir}");
     }
     // pretty much nothing happens if we are only registering the install
     if (empty($this->_options['register-only'])) {
         if (empty($atts['replacements'])) {
             if (!file_exists($orig_file)) {
                 return $this->raiseError("file {$orig_file} does not exist", PEAR_INSTALLER_FAILED);
             }
             if (!@copy($orig_file, $dest_file)) {
                 return $this->raiseError("failed to write {$dest_file}", PEAR_INSTALLER_FAILED);
             }
             $this->log(3, "+ cp {$orig_file} {$dest_file}");
             if (isset($atts['md5sum'])) {
                 $md5sum = md5_file($dest_file);
//.........这里部分代码省略.........
开发者ID:zseand,项目名称:kloxo,代码行数:101,代码来源:Installer.php

示例3: htmlspecialchars

//C:\php\pear\docs\XML_Util\examples\example.php
require_once 'XML/Util.php';
/**
 * building document type declaration
 */
print 'building DocType declaration:<br>';
print htmlspecialchars(XML_Util::getDocTypeDeclaration('package', 'http://pear.php.net/dtd/package-1.0'));
print "\n<br><br>\n";
$modes = mcrypt_list_modes();
echo "mcrypt_list_modes <br>\n";
echo print_r_xml($modes);
//F:\bit5411\php\PEAR\OS\Guess.php  class OS_Guess
require_once 'OS/Guess.php';
$phpwhat = new OS_Guess();
//$phpwhat = OS_Guess::getSignature();  //fatal this
$tmp = $phpwhat->getSignature();
echo $tmp;
echo PHP_EOL;
$tmp = $phpwhat->getSysname();
echo $tmp;
echo PHP_EOL;
$tmp = $phpwhat->getNodename();
echo $tmp;
echo PHP_EOL;
$tmp = $phpwhat->getCpu();
echo $tmp;
echo PHP_EOL;
$tmp = $phpwhat->getRelease();
echo $tmp;
echo PHP_EOL;
$tmp = $phpwhat->getExtra();
开发者ID:gmgj,项目名称:gjsoap,代码行数:31,代码来源:gjrsi.php


注:本文中的OS_Guess::getSignature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。