本文整理汇总了PHP中MiscLib::win32方法的典型用法代码示例。如果您正苦于以下问题:PHP MiscLib::win32方法的具体用法?PHP MiscLib::win32怎么用?PHP MiscLib::win32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiscLib
的用法示例。
在下文中一共展示了MiscLib::win32方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHeader
public function getHeader()
{
ob_start();
$my_url = $this->page_url;
?>
<!DOCTYPE html>
<html>
<?php
echo "<head>";
echo "<title>COREPOS</title>";
// 18Aug12 EL Add content/charset.
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}css/pos.css\">";
if (MiscLib::win32()) {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}js/jquery-1.8.3.min.js\"></script>";
} else {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}js/jquery.js\"></script>";
}
$this->paycard_jscript_functions();
$this->head_content();
echo "</head>";
echo '<body class="' . $this->body_class . '">';
echo "<div id=\"boundingBox\">";
$this->input_header($this->action);
return ob_get_clean();
}
示例2: print_page
function print_page()
{
$my_url = $this->page_url;
?>
<!DOCTYPE html>
<html>
<?php
echo "<head>";
// 18Aug12 EL Add content/charset.
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}css/pos.css\">";
// include store css file if it exists
if (file_exists(dirname(__FILE__) . '/../store.css')) {
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}/store.css\">";
}
if (MiscLib::win32()) {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery-1.8.3.min.js\"></script>";
} else {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery.js\"></script>";
}
$this->head_content();
echo "</head>";
echo '<body class="' . $this->body_class . '">';
echo "<div id=\"boundingBox\">";
$this->noinput_header();
echo DisplayLib::printheaderb();
$this->body_content();
echo "<div id=\"footer\">";
echo DisplayLib::printfooter();
echo "</div>";
echo "</div>";
$this->scale_box();
$this->scanner_scale_polling(false);
if (!empty($this->onload_commands)) {
echo "\n<script type=\"text/javascript\">\n";
echo "\$(document).ready(function(){\n";
echo $this->onload_commands;
echo "});\n";
echo "</script>\n";
}
// 18Aug12 EL Moved after ready-script.
echo "</body>\n";
print "</html>";
}
示例3: testMiscLib
public function testMiscLib()
{
chdir(dirname(__FILE__) . '/../../pos/is4c-nf/gui-modules/');
$rel = MiscLib::baseURL();
$this->assertEquals('../', $rel);
$this->assertEquals(1, MiscLib::nullwrap(1));
$this->assertEquals(1.5, MiscLib::nullwrap(1.5));
$this->assertEquals('test', MiscLib::nullwrap('test'));
$this->assertEquals(0, MiscLib::nullwrap(False));
$this->assertEquals(1, MiscLib::truncate2(1));
$this->assertEquals(1.99, MiscLib::truncate2(1.99));
$this->assertEquals(1.99, MiscLib::truncate2("1.99"));
$this->assertEquals(1.35, MiscLib::truncate2("1.345"));
$hostCheck = MiscLib::pingport(CoreLocal::get('localhost'), CoreLocal::get('DBMS'));
$this->assertInternalType('integer', $hostCheck);
$hostCheck = MiscLib::win32();
$this->assertInternalType('integer', $hostCheck);
$scale = MiscLib::scaleObject();
if ($scale !== 0) {
$this->assertInstanceOf('ScaleDriverWrapper', $scale);
}
}
示例4: curlSend
/**
Send a curl request with the specified data.
@param $data string of data
@param $type 'GET', 'POST', or 'SOAP'
@param $xml True or False
@param $extraOpts array of curl options and values
@param $auto_handle [boolean]
true => call handleResponse method automatically
false => just return curl result
@return integer error code
The url should be specified in $this->GATEWAY.
SOAP requests should aso set $this->$SOAPACTION.
Data is usually a string of XML or an HTTP
argument like key1=val1&key2=val2...
Setting xml to True adds an content-type header
This function calls the handleResponse method
and returns the result of that call.
*/
function curlSend($data = False, $type = 'POST', $xml = False, $extraOpts = array(), $auto_handle = true)
{
if ($data && $type == 'GET') {
$this->GATEWAY .= $data;
}
$curl_handle = curl_init($this->GATEWAY);
curl_setopt($curl_handle, CURLOPT_HEADER, 0);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, false);
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, true);
curl_setopt($curl_handle, CURLOPT_TIMEOUT, 30);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
if (MiscLib::win32()) {
curl_setopt($curl_handle, CURLOPT_CAINFO, LOCAL_CERT_PATH);
}
if ($type == 'SOAP') {
$headers = array();
if (!empty($this->SOAPACTION)) {
$headers[] = "SOAPAction: " . $this->SOAPACTION;
}
$headers[] = "Content-type: text/xml";
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);
} else {
if ($xml) {
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("Content-type: text/xml"));
}
}
foreach ($extraOpts as $opt => $value) {
curl_setopt($curl_handle, $opt, $value);
}
if ($data && ($type == 'POST' || $type == 'SOAP')) {
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
}
set_time_limit(60);
$response = curl_exec($curl_handle);
// request sent; get rid of PAN info
$this->setPAN(array());
if ($type == "SOAP") {
$response = str_replace("<", "<", $response);
$response = str_replace(">", ">", $response);
}
$funcReturn = array('curlErr' => curl_errno($curl_handle), 'curlErrText' => curl_error($curl_handle), 'curlTime' => curl_getinfo($curl_handle, CURLINFO_TOTAL_TIME), 'curlHTTP' => curl_getinfo($curl_handle, CURLINFO_HTTP_CODE), 'response' => $response);
curl_close($curl_handle);
if ($auto_handle) {
return $this->handleResponse($funcReturn);
} else {
return $funcReturn;
}
}
示例5: loadSampleData
/**
Load sample data into the table
@param $sql [SQLManager object] connected to database
@param $table [string] table name
@param $quiet [boolean, default false] suppress output
@return [boolean] success
*/
public static function loadSampleData($sql, $table, $quiet = false)
{
$success = true;
$loaded = 0;
ob_start();
echo "Loading `{$table}` ";
if (file_exists(dirname(__FILE__) . "/data/{$table}.sql")) {
echo "from data/{$table}.sql<br>\n";
$fp = fopen(dirname(__FILE__) . "/data/{$table}.sql", "r");
while ($line = fgets($fp)) {
$query = "INSERT INTO {$table} VALUES {$line}";
$try = $sql->query("INSERT INTO {$table} VALUES {$line}");
if ($try === false) {
$error = $sql->error();
$success = false;
echo "<br><small style='color:red;'>" . (strlen($error) ? $error : 'Unknown error') . " executing:<br><code>{$query}</code></small><br>\n";
} else {
if (++$loaded % 50 === 0) {
echo "<br>\n";
flush();
}
echo ".";
}
}
fclose($fp);
echo ($success ? ' success!' : "<br>\n'{$table}' load " . ($loaded ? 'partial success;' : 'failed;')) . " {$loaded} " . ($loaded == 1 ? 'record was' : 'records were') . " loaded.<br>\n";
} else {
if (file_exists(dirname(__FILE__) . "/data/{$table}.csv")) {
echo "from data/{$table}.csv ";
$LOCAL = 'LOCAL';
if (CoreLocal::get('localhost') == '127.0.0.1' || CoreLocal::get('localhost') == 'localhost') {
$LOCAL = '';
}
$path = realpath(dirname(__FILE__) . "/data/{$table}.csv");
/**
Handle symlinks on windows by checking if the first line
of the file contains the name of another CSV file.
*/
if (MiscLib::win32()) {
$fp = fopen($path, 'r');
$first_line = trim(fgets($fp));
if (substr($first_line, -4) == '.csv') {
$path = realpath(substr($first_line, 3));
if (!file_exists($path)) {
if (!$quiet) {
echo 'File not found: ' . $path . '<br />';
echo ob_end_clean();
}
return false;
}
}
fclose($fp);
$path = str_replace('\\', '/', $path);
}
$query = "LOAD DATA {$LOCAL} INFILE\n '{$path}'\n INTO TABLE {$table}\n FIELDS TERMINATED BY ','\n ESCAPED BY '\\\\'\n OPTIONALLY ENCLOSED BY '\"'\n LINES TERMINATED BY '\\r\\n'";
$prep = $sql->prepare_statement($query);
$try = $sql->exec_statement($prep);
if ($try === false) {
$error = $sql->error();
echo "<br><span style='color:red;'>" . (strlen($error) ? $error : 'Unknown error') . " executing:<br><code>{$query}</code><br></span><br>\n";
}
/** alternate implementation
for non-mysql and/or LOAD DATA LOCAL
not allowed */
if ($try !== false) {
echo "succeeded!<br>\n";
} else {
echo "line-by-line<br>\n";
$fp = fopen($path, 'r');
$stmt = false;
while (!feof($fp)) {
$line = fgetcsv($fp);
if (!is_array($line)) {
continue;
}
if ($stmt === false) {
$query = 'INSERT INTO ' . $table . ' VALUES (';
foreach ($line as $field) {
$query .= '?,';
}
$query = substr($query, 0, strlen($query) - 1) . ')';
$stmt = $sql->prepare_statement($query);
if ($stmt === false) {
$error = $sql->error();
$success = false;
echo "<br><span style='color:red;'>" . (strlen($error) ? $error : 'Unknown error') . " preparing:<br><code>{$query}</code></span><br>\n";
break;
}
}
$try = $sql->exec_statement($stmt, $line);
if ($try === false) {
$error = $sql->error();
$success = false;
//.........这里部分代码省略.........
示例6: getHeader
public function getHeader()
{
$my_url = $this->page_url;
ob_start();
?>
<!DOCTYPE html>
<html>
<?php
echo "<head>";
echo "<title>COREPOS</title>";
$charset = CoreLocal::get('CoreCharSet') === '' ? 'utf-8' : CoreLocal::get('CoreCharSet');
// 18Aug12 EL Add content/charset.
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}/css/pos.css\">";
// include store css file if it exists
if (file_exists(dirname(__FILE__) . '/../css/store.css')) {
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}/css/store.css\">";
}
if (MiscLib::win32()) {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery-1.8.3.min.js\"></script>";
} else {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery.js\"></script>";
}
$this->head_content();
echo "</head>";
echo '<body class="' . $this->body_class . '">';
echo "<div id=\"boundingBox\">";
return ob_get_clean();
}
示例7: print_page
/**
Print HTML output
@return None
Print the page. This version includes the scale
weight display as well as the head and body
content from those methods. Javascript commands
that have been requested via add_onload_command
are all run on page load.
*/
function print_page()
{
$my_url = $this->page_url;
?>
<!DOCTYPE html>
<html>
<?php
echo "<head>";
echo "<title>COREPOS</title>";
$charset = CoreLocal::get('CoreCharSet') === '' ? 'utf-8' : CoreLocal::get('CoreCharSet');
// 18Aug12 EL Add content/charset.
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}/css/pos.css\">";
// include store css file if it exists
if (file_exists(dirname(__FILE__) . '/../css/store.css')) {
echo "<link rel=\"stylesheet\" type=\"text/css\"\n href=\"{$my_url}/css/store.css\">";
}
if (MiscLib::win32()) {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery-1.8.3.min.js\"></script>";
} else {
echo "<script type=\"text/javascript\"\n src=\"{$my_url}/js/jquery.js\"></script>";
}
$this->head_content();
echo "</head>";
echo '<body class="' . $this->body_class . '">';
echo "<div id=\"boundingBox\">";
$this->body_content();
echo "</div>";
$this->scale_box();
$this->scanner_scale_polling();
// body_content populates onload_commands
if (!empty($this->onload_commands)) {
echo "\n<script type=\"text/javascript\">\n";
echo "\$(document).ready(function(){\n";
echo $this->onload_commands;
echo "});\n";
echo "</script>\n";
}
// 18Aug12 EL Moved after ready-script.
echo "</body>\n";
echo "</html>";
}