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


PHP is_windows函数代码示例

本文整理汇总了PHP中is_windows函数的典型用法代码示例。如果您正苦于以下问题:PHP is_windows函数的具体用法?PHP is_windows怎么用?PHP is_windows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: pdftk

/**
 *@name  pdftk
 *@brief Validate with xmlint (external tool) an xml file using the schema (XML|DTD|XSD|RNG|SCH)
 *@access public 
 *@note 	This function will call pdftk/pdftk.exe like this:
 *	pdftk form.pdf fill_form data.fdf output out.pdf flatten
 *	(pdftk form.filled.pdf output out.pdf flatten is not supported)
 *
 *	 If  the  input  FDF file includes Rich Text formatted data in
 *	 addition to plain text, then the Rich	Text  data  is	packed
 *	 into  the  form fields as well as the plain text.  Pdftk also
 *	 sets a flag that cues Acrobat/Reader to  generate  new  field
 *	 appearances  based on the Rich Text data.  That way, when the
 *	 user opens the PDF, the viewer  will  create  the  Rich  Text
 *	 fields  on  the spot.	If the user's PDF viewer does not sup-
 *	 port Rich Text, then the user will see the  plain  text  data
 *	 instead.   If	you  flatten  this  form  before Acrobat has a
 *	 chance to create (and save) new field appearances,  then  the
 *	 plain text field data is what you'll see.
 *	 
 *@internal Wrapper to call pdftk, a shell command, in background.
 *@param String pdf_file absolute pathname to a pdf form file
 *@param String fdf_file absolute pathname to a pdf data file
 *@param String settings 
 *
 *	Output modes 'compress', 'uncompress', 'flatten' ..(see pdftk --help)
 *@return Array an associative array with two keys: 
 *	Boolean success a flag , if positive meaning the process is a success
 *	String return the path to the pdf generated or the error message 
 **/
function pdftk($pdf_file, $fdf_file, $settings)
{
    //------------------------------------------
    $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
    $output_modes = $settings['output_modes'];
    $security = $settings['security'];
    $cwd = '/tmp';
    $env = array('misc_options' => 'aeiou');
    $err = '';
    $success = 0;
    if (is_windows()) {
        $cmd = "pdftk.exe";
        //For windows
    } else {
        $cmd = "pdftk";
        //For linux and mac
    }
    $dircmd = fix_path(dirname(__FILE__));
    if (file_exists("{$dircmd}/{$cmd}")) {
        $pdf_out = FPDM_CACHE . "pdf_flatten.pdf";
        $cmdline = "{$dircmd}/{$cmd} \"{$pdf_file}\" fill_form \"{$fdf_file}\" output \"{$pdf_out}\" {$output_modes} {$security}";
        //direct to ouptut
        //echo htmlentities("$cmdline , $descriptorspec, $cwd, $env");
        if (PHP5_ENGINE) {
            // Php5
            $process = proc_open($cmdline, $descriptorspec, $pipes, $cwd, $env);
        } else {
            //Php4
            $process = proc_open($cmdline, $descriptorspec, $pipes);
        }
        if (is_resource($process)) {
            if (PHP5_ENGINE) {
                $err = stream_get_contents($pipes[2]);
            } else {
                //Php4
                $err = "";
                while ($str = fgets($pipes[2], 4096)) {
                    $err .= "{$str}\n";
                }
            }
            fclose($pipes[2]);
            //Its important to close the pipes before proc_close call to avoid  dead locks
            $return_value = proc_close($process);
        } else {
            $err = "No more resource to execute the command";
        }
    } else {
        $err = "Sorry but pdftk binary is not provided / Cette fonctionnalite requiere pdftk non fourni ici<ol>";
        $err .= "<li>download it from / telecharger ce dernier a partir de <br><blockquote><a href=\"http://www.pdflabs.com/docs/install-pdftk/\">pdflabs</a></blockquote>";
        $err .= "<li>copy the executable in this directory / Copier l'executable dans<br><blockquote><b>{$dircmd}</b></blockquote>";
        $err .= "<li>set \$cmd to match binary name in / configurer \$cmd pour  qu'il corresponde dans le fichier<br><blockquote><b>" . __FILE__ . "</b></blockquote></ol>";
    }
    if ($err) {
        $ret = array("success" => false, "return" => $err);
    } else {
        $ret = array("success" => true, "return" => $pdf_out);
    }
    return $ret;
}
开发者ID:bryan-615,项目名称:sunwindwater,代码行数:89,代码来源:pdftk.php

示例2: testAssertWritable

 public function testAssertWritable()
 {
     $fs = new Filesystem();
     if (!is_windows()) {
         $this->assertEquals('/tmp', $fs->assertFolderWritable('/tmp'));
     } else {
         $this->assertTrue(true);
     }
 }
开发者ID:blendsdk,项目名称:blendengine,代码行数:9,代码来源:FilesystemTest.php

示例3: load_extension

function load_extension($ext_name)
{
    if (is_windows()) {
        $loaded = @dl($ext_name . '.dll');
    } else {
        $loaded = @dl($ext_name . '.so');
    }
    return $loaded;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:9,代码来源:pdo_sqlite.php

示例4: setUp

 public function setUp()
 {
     if (is_windows()) {
         $this->markTestSkipped('Skipping on Windows');
     }
     $this->_filename = realpath(dirname(__FILE__) . '/../../../cache/') . 'file_utils_override' . mt_rand() . '.txt';
     touch($this->_filename);
     $this->_old_default_permissions = $GLOBALS['sugar_config']['default_permissions'];
     $GLOBALS['sugar_config']['default_permissions'] = array('dir_mode' => 0777, 'file_mode' => 0660, 'user' => $this->_getCurrentUser(), 'group' => $this->_getCurrentGroup());
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:10,代码来源:SugarFileUtilsTest.php

示例5: mkdir_recursive

function mkdir_recursive($path, $check_is_parent_dir = false)
{
    if (sugar_is_dir($path, 'instance')) {
        return true;
    }
    if (sugar_is_file($path, 'instance')) {
        if (!empty($GLOBALS['log'])) {
            $GLOBALS['log']->fatal("ERROR: mkdir_recursive(): argument {$path} is already a file.");
        }
        return false;
    }
    //make variables with file paths
    $pathcmp = $path = rtrim(clean_path($path), '/');
    $basecmp = $base = rtrim(clean_path(getcwd()), '/');
    if (is_windows()) {
        //make path variable lower case for comparison in windows
        $pathcmp = strtolower($path);
        $basecmp = strtolower($base);
    }
    if ($basecmp == $pathcmp) {
        return true;
    }
    $base .= "/";
    if (strncmp($pathcmp, $basecmp, strlen($basecmp)) == 0) {
        /* strip current path prefix */
        $path = substr($path, strlen($base));
    }
    $thePath = '';
    $dirStructure = explode("/", $path);
    if ($dirStructure[0] == '') {
        // absolute path
        $base = '/';
        array_shift($dirStructure);
    }
    if (is_windows()) {
        if (strlen($dirStructure[0]) == 2 && $dirStructure[0][1] == ':') {
            /* C: prefix */
            $base = array_shift($dirStructure) . "\\";
        } elseif ($dirStructure[0][0] . $dirStructure[0][1] == "\\\\") {
            /* UNC absolute path */
            $base = array_shift($dirStructure) . "\\" . array_shift($dirStructure) . "\\";
            // we won't try to mkdir UNC share name
        }
    }
    foreach ($dirStructure as $dirPath) {
        $thePath .= $dirPath . "/";
        $mkPath = $base . $thePath;
        if (!is_dir($mkPath)) {
            if (!sugar_mkdir($mkPath)) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:55,代码来源:dir_inc.php

示例6: show_prompt

function show_prompt()
{
    $user = trim($_SESSION['user']);
    $host = trim($_SESSION['host']);
    $path = trim($_SESSION['path']);
    if (is_windows()) {
        echo "{$user}@{$host}&lt;{$path}&gt;";
    } else {
        echo "{$user}@{$host}:{$path}" . '$';
    }
}
开发者ID:jbagel2,项目名称:pentest-tools,代码行数:11,代码来源:webshell.php

示例7: clean_path

/**
 * Convert all \ to / in path, remove multiple '/'s and '/./'
 * @param string $path
 * @return string
 */
function clean_path($path)
{
    // clean directory/file path with a functional equivalent
    $appendpath = '';
    if (is_windows() && strlen($path) >= 2 && $path[0] . $path[1] == "\\\\") {
        $path = substr($path, 2);
        $appendpath = "\\\\";
    }
    $path = str_replace("\\", "/", $path);
    $path = str_replace("//", "/", $path);
    $path = str_replace("/./", "/", $path);
    return $appendpath . $path;
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:18,代码来源:file_utils.php

示例8: dns_cname

function dns_cname($domain)
{
    if (is_windows()) {
        $url = "http://opencdn.sinaapp.com/dns.php?domain={$domain}&type=CNAME";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $content = curl_exec($ch);
        curl_close($ch);
        return json_decode($content, true);
    } else {
        return dns_get_record($domain, DNS_CNAME);
    }
}
开发者ID:yukisky,项目名称:OpenCDN,代码行数:14,代码来源:common.php

示例9: isValidCopyPath

/**
 * Checks if the given path is a valid destination for package files
 *
 * @param string $path
 * @return bool
 */
function isValidCopyPath($path)
{
    $path = str_replace('\\', '/', $path);
    // check if path is absolute
    if ($path === '' || $path[0] === '/') {
        return false;
    }
    // additionally check if path starts with a drive letter for Windows
    if (is_windows() && preg_match('/^[a-z]:/i', $path)) {
        return false;
    }
    // check if path contains reference to parent directory
    if (preg_match('/(^|\\/)\\.\\.(\\/|$)/', $path)) {
        return false;
    }
    return true;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:23,代码来源:file_utils.php

示例10: isSchedulerSet

 public function isSchedulerSet($api, array $args)
 {
     global $sugar_flavor;
     // if it's CE, always show scheduler data
     if ($sugar_flavor != 'CE' && AddonBoilerplate_Helper::is_ondemand_instance() === true) {
         return array('ondemand' => true, 'scheduler_ran' => '', 'is_windows' => '', 'realpath' => '');
     }
     $scheduler_ran = false;
     $instructions = '';
     $scheduler = BeanFactory::getBean('Schedulers');
     $scheduler_list = $scheduler->get_list('', 'last_run is not null');
     if (!empty($scheduler_list) && $scheduler_list['row_count'] > 0) {
         $scheduler_ran = true;
     }
     if (!isset($_SERVER['Path'])) {
         $_SERVER['Path'] = getenv('Path');
     }
     return array('ondemand' => false, 'scheduler_ran' => $scheduler_ran, 'is_windows' => is_windows(), 'realpath' => SUGAR_PATH);
 }
开发者ID:betobaz,项目名称:sugarcrm-addon-boilerplate,代码行数:19,代码来源:AddonBoilerplateApi.php

示例11: logThis

 * Reserved. Contributor(s): ______________________________________..
 * *******************************************************************************/
logThis('[At systemCheck.php]');
$stop = false;
// flag to prevent going to next step
///////////////////////////////////////////////////////////////////////////////
////	FILE CHECKS
logThis('Starting file permission check...');
$filesNotWritable = array();
$filesNWPerms = array();
// add directories here that should be skipped when doing file permissions checks (cache/upload is the nasty one)
$skipDirs = array($sugar_config['upload_dir'], '.svn');
$files = uwFindAllFiles(getcwd(), array(), true, $skipDirs);
$i = 0;
$filesOut = "\n\t<a href='javascript:void(0); toggleNwFiles(\"filesNw\");'>{$mod_strings['LBL_UW_SHOW_NW_FILES']}</a>\n\t<div id='filesNw' style='display:none;'>\n\t<table cellpadding='3' cellspacing='0' border='0'>\n\t<tr>\n\t\t<th align='left'>{$mod_strings['LBL_UW_FILE']}</th>\n\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_PERMS']}</th>\n\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_OWNER']}</th>\n\t\t<th align='left'>{$mod_strings['LBL_UW_FILE_GROUP']}</th>\n\t</tr>";
$isWindows = is_windows();
foreach ($files as $file) {
    if ($isWindows) {
        if (!is_writable_windows($file)) {
            logThis('WINDOWS: File [' . $file . '] not readable - saving for display');
            // don't warn yet - we're going to use this to check against replacement files
            $filesNotWritable[$i] = $file;
            $filesNWPerms[$i] = substr(sprintf('%o', fileperms($file)), -4);
            $filesOut .= "<tr>" . "<td><span class='error'>{$file}</span></td>" . "<td>{$filesNWPerms[$i]}</td>" . "<td>" . $mod_strings['ERR_UW_CANNOT_DETERMINE_USER'] . "</td>" . "<td>" . $mod_strings['ERR_UW_CANNOT_DETERMINE_GROUP'] . "</td>" . "</tr>";
        }
    } else {
        if (!is_writable($file)) {
            logThis('File [' . $file . '] not writable - saving for display');
            // don't warn yet - we're going to use this to check against replacement files
            $filesNotWritable[$i] = $file;
            $filesNWPerms[$i] = substr(sprintf('%o', fileperms($file)), -4);
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:systemCheck.php

示例12: pathinfo

    ?>
			</ol>
			<?php 
}
?>
		</div>

		<div class="chunk">
			<p class="footnote"><strong>NOTE</strong>: Passing this test does not guarantee that the AWS SDK for PHP will run on your web server &mdash; it only ensures that the requirements have been addressed.</p>
		</div>
	</div>

</div>

<?php 
if (!is_windows()) {
    ?>
<script type="text/javascript" charset="utf-8">
reqwest('<?php 
    echo pathinfo(__FILE__, PATHINFO_BASENAME);
    ?>
?ssl_check', function(resp) {
	$sslCheck = document.getElementById('ssl_check');
	$sslCheck.innerHTML = '';
	$sslCheck.innerHTML = '<code>' + resp + '</code>';
});
</script>
<?php 
}
?>
开发者ID:lucasmilin,项目名称:filemanager-php-s3-plugin,代码行数:30,代码来源:sdk_compatibility_test.php

示例13: quietechorun

function quietechorun($e)
{
    // enclose in "" on Windows for PHP < 5.3
    if (is_windows() && phpversion() < '5.3') {
        $e = '"' . $e . '"';
    }
    passthru($e);
}
开发者ID:guoyu07,项目名称:NYAF,代码行数:8,代码来源:configure.php

示例14: return_module_language

}
if (!isset($sugar_config['cache_dir'])) {
    $sugar_config['cache_dir'] = $sugar_config_defaults['cache_dir'];
}
if (!isset($sugar_config['site_url'])) {
    $sugar_config['site_url'] = $_SESSION['setup_site_url'];
}
if (!isset($sugar_config['translation_string_prefix'])) {
    $sugar_config['translation_string_prefix'] = $sugar_config_defaults['translation_string_prefix'];
}
$mod_strings_scheduler = return_module_language($GLOBALS['current_language'], 'Schedulers');
$error = '';
if (!isset($_SERVER['Path'])) {
    $_SERVER['Path'] = getenv('Path');
}
if (is_windows()) {
    if (isset($_SERVER['Path']) && !empty($_SERVER['Path'])) {
        // IIS IUSR_xxx may not have access to Path or it is not set
        if (!strpos($_SERVER['Path'], 'php')) {
            //        $error = '<em>'.$mod_strings_scheduler['LBL_NO_PHP_CLI'].'</em>';
        }
    }
    $cronString = '
			<tr>
			    <td align="left" colspan="2">
			    <font color="red">
						' . $mod_strings_scheduler['LBL_CRON_WINDOWS_DESC'] . '<br>
				</font>
						cd ' . realpath('./') . '<br>
						php.exe -f cron.php
						<br>' . $error . '
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:31,代码来源:confirmSettings.php

示例15: find_temp_dir

function find_temp_dir()
{
    global $path_to_site, $img_dir;
    if (is_windows()) {
        $guess = array(txpath . DS . 'tmp', getenv('TMP'), getenv('TEMP'), getenv('SystemRoot') . DS . 'Temp', 'C:' . DS . 'Temp', $path_to_site . DS . $img_dir);
        foreach ($guess as $k => $v) {
            if (empty($v)) {
                unset($guess[$k]);
            }
        }
    } else {
        $guess = array(txpath . DS . 'tmp', '', DS . 'tmp', $path_to_site . DS . $img_dir);
    }
    foreach ($guess as $dir) {
        $tf = @tempnam($dir, 'txp_');
        if ($tf) {
            $tf = realpath($tf);
        }
        if ($tf and file_exists($tf)) {
            unlink($tf);
            return dirname($tf);
        }
    }
    return false;
}
开发者ID:nope,项目名称:Tipattern,代码行数:25,代码来源:txplib_misc.php


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