本文整理汇总了PHP中viscacha_function_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP viscacha_function_exists函数的具体用法?PHP viscacha_function_exists怎么用?PHP viscacha_function_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了viscacha_function_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load()
{
global $config;
if ($this->exists() == true) {
$this->import();
} else {
if (viscacha_function_exists('xml_parser_create')) {
$rssnews = get_remote('http://version.viscacha.org/news/rss');
include 'classes/magpie_rss/rss_fetch.inc.php';
$rss = new MagpieRSS($rssnews);
$news = '';
foreach ($rss->items as $item) {
$news .= '<li><a href="' . htmlspecialchars($item['link']) . '" style="font-weight: bold;" target="_blank">' . htmlspecialchars($item['title']) . '</a>';
if (isset($item['description'])) {
$news .= '<br /><span style="font-size: 0.9em;">' . htmlspecialchars($item['description']) . '</span>';
}
$news .= '</li>';
}
if (!empty($news)) {
$news = '<ul>' . $news . '</ul>';
}
} else {
$news = get_remote('http://version.viscacha.org/news');
}
$this->data = array('comp' => get_remote('http://version.viscacha.org/compare/?version=' . base64_encode($config['version'])), 'version' => get_remote('http://version.viscacha.org/version'), 'news' => $news);
$this->export();
}
}
示例2: isWindows
function isWindows()
{
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
return true;
} elseif (isset($_SERVER['OS']) && strpos(strtolower($_SERVER['OS']), 'Windows') !== false) {
return true;
} elseif (viscacha_function_exists('php_uname') && stristr(@php_uname(), 'windows')) {
} else {
return false;
}
}
示例3: DB
function DB($host = 'localhost', $user = 'root', $pwd = '', $dbname = '', $dbprefix = '', $open = true)
{
$this->system = 'mysql';
if (version_compare(PHP_VERSION, "4.3.0", ">=") && viscacha_function_exists('mysql_real_escape_string') == true) {
$this->escaper = 'mysql_real_escape_string';
} else {
$this->escaper = 'mysql_escape_string';
}
$this->errlogfile = 'data/errlog_' . $this->system . '.inc.php';
parent::DB_Driver($host, $user, $pwd, $dbname, $dbprefix, $open);
$this->freeResult = $this->persistence == 1;
}
示例4: CanGZIP
function CanGZIP() {
if (headers_sent() || connection_aborted() || !extension_loaded("zlib") || !viscacha_function_exists('gzcompress')){
return false;
}
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) {
return "x-gzip";
}
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false) {
return "gzip";
}
return false;
}
示例5: VeriWord
function VeriWord()
{
// Get Font-Files
$handle = opendir($this->dir_font);
$pre = 'captcha_';
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && !is_dir($this->dir_font . $file)) {
$nfo = pathinfo($this->dir_font . $file);
$prefix = substr($nfo['basename'], 0, strlen($pre));
if ($nfo['extension'] == 'ttf' && $prefix == $pre) {
$this->fonts[] = $nfo['basename'];
}
}
}
// Get Noise-Files
$handle = opendir($this->dir_noise);
while ($file = readdir($handle)) {
if ($file != "." && $file != ".." && !is_dir($this->dir_noise . $file)) {
$nfo = pathinfo($this->dir_noise . $file);
if ($nfo['extension'] == 'jpg' || $nfo['extension'] == 'jpeg') {
$this->noises[] = $nfo['basename'];
}
}
}
ImageTypes();
$lang = new lang();
$lang->group("thumbnail.class");
$this->lang = $lang->return_array();
if (viscacha_function_exists('imagejpeg') && IMG_JPEG) {
define('IMAGEJPEG', true);
} else {
define('IMAGEJPEG', false);
}
if (viscacha_function_exists('imagegif') && IMG_GIF) {
define('IMAGEGIF', true);
} else {
define('IMAGEGIF', false);
}
if (viscacha_function_exists('imagepng') && IMG_PNG) {
define('IMAGEPNG', true);
} else {
define('IMAGEPNG', false);
}
srand((double) microtime() * time());
mt_srand((double) microtime() * 1000000);
}
示例6: readRssInfo
function readRssInfo() {
if (!viscacha_function_exists('xml_parser_create')) {
return false;
}
global $config;
$rssData = get_remote('http://version.viscacha.org/news/rss/?version='.base64_encode($config['version']));
$xml = xml_parser_create();
xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml, array($this, "startRssElement"), array($this, "endRssElement"));
xml_set_character_data_handler($xml, array($this, "getRssElementData"));
$success = xml_parse($xml, $rssData);
xml_parser_free($xml);
if (!$success || empty($this->data['news'])) {
$this->data['news'] = '';
return false;
}
else {
$this->data['news'] = '<ul>'.$this->data['news'].'</ul>';
return true;
}
}
示例7: php4_create_parser
/**
* Instaniate an XML parser under PHP4
*
* Unfortunately PHP4's support for character encodings
* and especially XML and character encodings sucks. As
* long as the documents you parse only contain characters
* from the ISO-8859-1 character set (a superset of ASCII,
* and a subset of UTF-8) you're fine. However once you
* step out of that comfy little world things get mad, bad,
* and dangerous to know.
*
* The following code is based on SJM's work with FoF
* @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
*
*/
function php4_create_parser($source, $in_enc, $detect)
{
if (!$detect) {
return array(xml_parser_create($in_enc), $source);
}
if (!$in_enc) {
if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
$in_enc = strtoupper($m[1]);
$this->source_encoding = $in_enc;
} else {
$in_enc = 'UTF-8';
}
}
if ($this->known_encoding($in_enc)) {
return array(xml_parser_create($in_enc), $source);
}
// the dectected encoding is not one of the simple encodings PHP knows
// attempt to use the iconv extension to
// cast the XML to a known encoding
// @see http://php.net/iconv
if (viscacha_function_exists('iconv')) {
$encoded_source = iconv($in_enc, 'UTF-8', $source);
if ($encoded_source) {
return array(xml_parser_create('UTF-8'), $encoded_source);
}
}
// iconv didn't work, try mb_convert_encoding
// @see http://php.net/mbstring
if (viscacha_function_exists('mb_convert_encoding')) {
$encoded_source = mb_convert_encoding($source, 'UTF-8', $in_enc);
if ($encoded_source) {
return array(xml_parser_create('UTF-8'), $encoded_source);
}
}
// else
$this->error("Feed is in an unsupported character encoding. ({$in_enc}) " . "You may see strange artifacts, and mangled characters.", E_USER_NOTICE);
return array(xml_parser_create(), $source);
}
示例8: unset
unset($input);
}
if (get_magic_quotes_gpc() == 1) {
$_GET = $gpc->stripslashes($_GET);
$_POST = $gpc->stripslashes($_POST);
$_REQUEST = $gpc->stripslashes($_REQUEST);
}
// Thanks to phpBB for this 6 lines
if (isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
trigger_error("Hacking attempt (Globals)", E_USER_ERROR);
}
if (isset($_SESSION) && !is_array($_SESSION)) {
trigger_error("Hacking attempt (Session Variable)", E_USER_ERROR);
}
$http_svars = array('PHP_SELF', 'HTTP_USER_AGENT', 'SERVER_SOFTWARE', 'REMOTE_ADDR', 'SCRIPT_NAME', 'SERVER_PORT', 'SERVER_NAME', 'HTTP_REFERER', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REQUEST_URI', 'HTTP_ACCEPT_ENCODING', 'DOCUMENT_ROOT');
if (viscacha_function_exists('getallheaders')) {
$ref = @getallheaders();
} else {
$ref = array();
}
foreach ($http_svars as $http_var) {
$func_key = '';
if (substr($http_var, 0, 5) == 'HTTP_') {
$func_key = strtolower(str_replace('_', ' ', substr($http_var, 5)));
$func_key = str_replace(' ', '-', ucwords($func_key));
}
if (empty($_SERVER[$http_var]) && !empty($ref[$func_key])) {
$_SERVER[$http_var] = $ref[$func_key];
} else {
$_SERVER[$http_var] = getenv($http_var);
}
示例9: preg_replace
// (?:p)? => p?
$list = preg_replace('#\\(\\?\\:(.)\\)\\?#', '\\1?', $list);
// (?:a|b|c|d|...)? => [abcd...]?
// TODO: a|bb|c => [ac]|bb
static $callback_2;
if (!isset($callback_2)) {
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
}
$list = preg_replace_callback('#\\(\\?\\:((?:.\\|)+.)\\)#', $callback_2, $list);
}
// return $list without trailing pipe
return substr($list, 0, -1);
}
}
// End Class GeSHi
if (!viscacha_function_exists('geshi_highlight')) {
/**
* Easy way to highlight stuff. Behaves just like highlight_string
*
* @param string The code to highlight
* @param string The language to highlight the code in
* @param string The path to the language files. You can leave this blank if you need
* as from version 1.0.7 the path should be automatically detected
* @param boolean Whether to return the result or to echo
* @return string The code highlighted (if $return is true)
* @since 1.0.2
*/
function geshi_highlight($string, $language, $path = null, $return = false)
{
$geshi = new GeSHi($string, $language, $path);
$geshi->set_header_type(GESHI_HEADER_NONE);
示例10: error
function error($errcomment)
{
// Try to get better results for line and file.
if (viscacha_function_exists('debug_backtrace') == true) {
$backtraceInfo = debug_backtrace();
// 0 is class.mysql.php, 1 is the calling code...
if (isset($backtraceInfo[1]) == true) {
$errline = $backtraceInfo[1]['line'];
$errfile = $backtraceInfo[1]['file'];
}
}
if ($this->logerrors) {
if (file_exists($this->errlogfile)) {
$lines = file($this->errlogfile);
foreach ($lines as $key => $value) {
$value = trim($value);
if (empty($value)) {
unset($lines[$key]);
} else {
$lines[$key] = $value;
// Also trim it for the file
}
}
} else {
$lines = array();
}
$cols = array($this->errno(), makeOneLine($this->errstr()), $errfile, $errline, makeOneLine($_SERVER['REQUEST_URI']), time(), makeOneLine($errcomment));
$lines[] = implode("\t", $cols);
@file_put_contents($this->errlogfile, implode("\n", $lines));
}
$errcomment = nl2br($errcomment);
return "DB ERROR " . $this->errno() . ": " . $this->errstr() . "<br />File: {$errfile} on line {$errline}<br />Query: <code>{$errcomment}</code>";
}
示例11: foot
"></td>
</tr>
</table>
</form>
<?php
echo foot();
} elseif ($job == 'datetime2') {
echo head();
$c->getdata();
$c->updateconfig('new_dformat4', int);
$c->updateconfig('timezone', str);
$c->savedata();
ok('admin.php?action=settings&job=settings');
} elseif ($job == 'http') {
$config = $gpc->prepare($config);
if (!extension_loaded("zlib") || !viscacha_function_exists('gzcompress')) {
$gzip = '<span style="color: #aa0000;">' . $lang->phrase('admin_not_enabled') . '</span>';
} else {
$gzip = '<span style="color: #00aa00;">' . $lang->phrase('admin_enabled') . '</span>';
}
echo head();
?>
<form name="form" method="post" action="admin.php?action=settings&job=http2">
<table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
<tr>
<td class="obox" colspan="2"><?php
echo $lang->phrase('admin_headers_cookies_gzip');
?>
</td>
</tr>
<tr>
示例12: privSwapBackMagicQuotes
function privSwapBackMagicQuotes()
{
$v_result = 1;
// ----- Look if function exists
if (!viscacha_function_exists("get_magic_quotes_runtime") || !viscacha_function_exists("set_magic_quotes_runtime")) {
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Look if something to do
if ($this->magic_quotes_status != -1) {
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Swap back magic_quotes
if ($this->magic_quotes_status == 1) {
@set_magic_quotes_runtime($this->magic_quotes_status);
}
// ----- Return
return $v_result;
}
示例13: error
function error($errcomment)
{
// Try to get better results for line and file.
if (viscacha_function_exists('debug_backtrace') == true) {
$backtraceInfo = debug_backtrace();
// 0 is class.mysql.php, 1 is the calling code...
if (isset($backtraceInfo[1]) == true) {
$errline = $backtraceInfo[1]['line'];
$errfile = $backtraceInfo[1]['file'];
}
}
if ($this->logerrors) {
$logs = array();
if (file_exists($this->errlogfile)) {
$logs = file($this->errlogfile);
$logs = array_empty_trim($logs);
}
$row = array($this->errno(), $this->errstr(), $errfile, $errline, $errcomment, $_SERVER['REQUEST_URI'], time(), PHP_VERSION . " (" . PHP_OS . ")");
$row = array_map('makeOneLine', $row);
$logs[] = implode("\t", $row);
@file_put_contents($this->errlogfile, implode("\n", $logs));
}
$errcomment = nl2br($errcomment);
return "Database error " . $this->errno() . ": " . $this->errstr() . "<br />File: {$errfile} on line {$errline}<br />Query: <code>{$errcomment}</code>";
}
示例14: OpenSocket
function OpenSocket($server, $port)
{
if (viscacha_function_exists("dns_get_record")) {
$record = dns_get_record("_xmpp-client._tcp.{$server}", DNS_SRV);
if (!empty($record)) {
$server = $record[0]["target"];
$port = $record[0]["port"];
}
}
if ($this->active_socket = @fsockopen($server, $port)) {
@socket_set_blocking($this->active_socket, 0);
@socket_set_timeout($this->active_socket, 31536000);
return TRUE;
} else {
return FALSE;
}
}
示例15: pemftp_class_module
function pemftp_class_module()
{
if (extension_loaded('ftp')) {
return 'ext';
} else {
$mod_sockets = true;
if (!extension_loaded('sockets')) {
if (!viscacha_function_exists('dl')) {
$mod_sockets = false;
} else {
$prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
if (!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) {
$mod_sockets = false;
}
}
}
if ($mod_sockets == true) {
return 'sockets';
} elseif ($mod_sockets == false && viscacha_function_exists('fsockopen')) {
return 'pure';
} else {
die('Viscacha needs at least fsockopen, sockets extension or ftp extension to work! Please enable one of this features or you cannot use Viscacha!');
}
}
}