本文整理汇总了PHP中wddx_serialize_value函数的典型用法代码示例。如果您正苦于以下问题:PHP wddx_serialize_value函数的具体用法?PHP wddx_serialize_value怎么用?PHP wddx_serialize_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wddx_serialize_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: encode
/**
* @param mixed $decoded
*
* @return string
*/
public function encode($decoded) : string
{
if ($this->hasComment()) {
return wddx_serialize_value($decoded, $this->getComment());
}
return wddx_serialize_value($decoded);
}
开发者ID:blar,项目名称:wddx,代码行数:12,代码来源:Wddx.php
示例2: useSlowPrinter
public static function useSlowPrinter()
{
if (!function_exists('wddx_serialize_value')) {
return true;
}
// Some versions of PHP have a broken wddx_serialize_value, see
// PHP bug 45314. Test encoding an affected character (U+00A0)
// to avoid this.
$expected = "<wddxPacket version='1.0'><header/><data><string> </string></data></wddxPacket>";
if (wddx_serialize_value(" ") !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode ampersands.
$expected = "<wddxPacket version='1.0'><header/><data><string>&</string></data></wddxPacket>";
if (wddx_serialize_value('&') !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode empty arrays as subvalues.
$expected = "<wddxPacket version='1.0'><header/><data><array length='1'><array length='0'></array></array></data></wddxPacket>";
if (wddx_serialize_value(array(array())) !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode associative arrays with numeric keys.
$expected = "<wddxPacket version='1.0'><header/><data><struct><var name='2'><number>1</number></var></struct></data></wddxPacket>";
if (wddx_serialize_value(array(2 => 1)) !== $expected) {
return true;
}
return false;
}
开发者ID:rploaiza,项目名称:dbpedia-latinoamerica,代码行数:29,代码来源:ApiFormatWddx.php
示例3: ftp_ErrorHandler
function ftp_ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
if ($errno != 2 && $errno != 8) {
// timestamp for the error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are 2,8,256,512 and 1024
$errortype = array(1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice");
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errnumber>\n";
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
debug($err);
}
}
开发者ID:poef,项目名称:ariadne,代码行数:25,代码来源:loader.php
示例4: test
function test()
{
$v = new t1();
$v->set();
echo wddx_serialize_value($v);
print "\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:wddx_serialize_value.php
示例5: serialize
/**
* @param array $value
* @return string
*/
public function serialize($value)
{
if ($value === null || is_array($value) && count($value) == 0) {
return '';
}
return wddx_serialize_value($value);
}
开发者ID:beberlei,项目名称:Doctrine-Workflow,代码行数:11,代码来源:WddxSerializer.php
示例6: asXML
public function asXML()
{
$asArray = $this->asArray();
$this->complete(&$asArray);
$erg = wddx_serialize_value($asArray);
return $erg;
}
开发者ID:vladfechetecatalin,项目名称:CrossJobPoster,代码行数:7,代码来源:Abstract.php
示例7: userErrorHandler
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err .= "Errornummer:" . $errno . " ";
$err .= "Errortyp" . $errortype[$errno] . " ";
$err .= "Errormessage:" . $errmsg . " ";
$err .= "Filename:" . $filename . " ";
$err .= "on Line:" . $linenum . " ";
if (in_array($errno, $user_errors)) {
$err .= "Vartrace: " . wddx_serialize_value($vars, "Variables");
}
// for testing
//echo $err;
// save to the error log, and e-mail me if there is a critical user error
/* error_log($err, 3, "/usr/local/php4/error.log");
if ($errno == E_USER_ERROR) {
mail("[email protected]", "Critical User Error", $err);
}*/
}
开发者ID:hersche,项目名称:Peta,代码行数:27,代码来源:log.php.php
示例8: logError
public function logError($errno, $errmsg, $filename, $linenum, $vars)
{
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = '<errorEntry>';
$err .= '<dateTime>' . date('Y-m-d H:i:s') . '</dateTime>';
$err .= '<errorNum>' . $errno . '</errorNum>';
$err .= '<errorType>' . $errortype[$errno] . '</errorType>';
$err .= '<errorMsg>' . $errmsg . '</errorMsg>';
$err .= '<scriptName>' . $filename . '</scriptName>';
$err .= '<scriptLineNum>' . $linenum . '</scriptLineNum>';
$err .= '<uri>' . (php_sapi_name() === 'cli') ? __FILE__ : $_SERVER['REQUEST_URI'] . '</uri>';
$err .= '<param>';
$array = array_merge($_GET, $_POST);
if (count($array) > 1) {
foreach ($array as $key => $value) {
$err .= '<var>' . $key . '=' . $value . '</var>';
}
}
$err .= '</param>';
if (in_array($errno, $user_errors)) {
$err .= '<varTrace>' . wddx_serialize_value($vars, 'Variables') . '</varTrace>';
}
$err .= '</errorEntry>' . PHP_EOL;
// save to the error log, and e-mail me if there is a critical user error
error_log($err, 3, $this->path . $this->fileName);
if ($errno == E_USER_ERROR) {
//Helper::enviarEmail($err,'Erro critico '.date('Y-m-d H:i:s'));
}
}
开发者ID:webunion,项目名称:log,代码行数:31,代码来源:Log.php
示例9: serialize
public function serialize($v)
{
if (!$this->len) {
return wddx_serialize_value($v);
}
if (is_bool($v) || !is_scalar($v)) {
return $this->prefix . wddx_serialize_value($v);
}
return $v;
}
开发者ID:Gaia-Interactive,项目名称:gaia_core_php,代码行数:10,代码来源:wddx.php
示例10: execute
public function execute()
{
if (function_exists('wddx_serialize_value')) {
$this->printText(wddx_serialize_value($this->getResultData()));
} else {
$this->printText('<?xml version="1.0" encoding="utf-8"?>');
$this->printText('<wddxPacket version="1.0"><header/><data>');
$this->slowWddxPrinter($this->getResultData());
$this->printText('</data></wddxPacket>');
}
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:11,代码来源:ApiFormatWddx.php
示例11: myErrorHandler
function myErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s ");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice");
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
if (isset($errortype[$errno])) {
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
}
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$err .= "\t<user-agent>" . $_SERVER['HTTP_USER_AGENT'] . "</user-agent>\n";
}
if (MOBIKAR_LOGGING_WDDX == TRUE && in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
$err_line = $dt;
if (isset($errortype[$errno])) {
$err_line .= "[" . $errortype[$errno] . "]";
}
$err_line .= $errmsg . " " . $filename . " " . $linenum . "\n";
// for testing
// echo $err;
// save to the error log, and e-mail me if there is a critical user error
if ($errno == E_USER_ERROR) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_ERROR);
if (MOBIKAR_LOGGING_EMAIL != NULL) {
mail(MOBIKAR_LOGGING_EMAIL, "Critical User Error", $err);
}
} else {
if ($errno == E_USER_WARNING) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_WARNING);
} else {
if ($errno == E_USER_NOTICE) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_NOTICE);
} else {
error_log($err, 3, MOBIKAR_LOGGING_E_SYS);
}
}
}
error_log($err_line, 3, MOBIKAR_LOGGING_LOG);
}
开发者ID:bouda,项目名称:mobikar,代码行数:53,代码来源:myErrorHandler.php
示例12: errorHandler
function errorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
$errorReporting = ini_get('error_reporting');
if ($errorReporting === 0 || !($errorReporting & $errno)) {
return FALSE;
}
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
$err = sprintf("%s -- ", $errortype[$errno], wddx_serialize_value($vars, "Variables"));
print "<pre>";
var_dump($vars);
print "</pre>";
error_log($err);
}
开发者ID:PseudoAj,项目名称:mfcs,代码行数:13,代码来源:migrate.php
示例13: xpress_error_handler
function xpress_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
$module_dirpath = dirname(dirname(__FILE__));
$root_path = dirname(dirname(dirname(dirname(__FILE__))));
$show_backtrace = true;
// Time stamp of error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice");
if (strstr($errstr, 'Use of undefined constant xpress_debug_message - assumed') !== false) {
return;
}
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "\t<errormsg>" . $errstr . "</errormsg>\n";
$err .= "\t<scriptname>" . $errfile . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $errline . "</scriptlinenum>\n";
$err .= "\t<errcontext>" . $errcontext . "</errcontext>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
$err_trace = '';
if ($show_backtrace) {
$backtraces = array_reverse(debug_backtrace());
$err_trace .= "BACK TRACE\n";
foreach ($backtraces as $backtrace) {
$trace = @$backtrace['file'] . "\tLINE(" . @$backtrace['line'] . ")\t" . @$backtrace['function'] . "()\n";
$trace = str_replace($root_path, "", $trace);
$trace = str_replace("\\", "/", $trace);
$trace = str_replace($root_path, "", $trace);
$trace = "\t" . $trace;
$err_trace .= $trace;
}
}
$head = "\n***** XPressME ERROR LOG ****************************************************************************************************\n";
$message = $head . $err . $err_trace;
$_debug_file = $module_dirpath . '/wp-content/xpress_error.log';
if ($errno != E_STRICT) {
$_fp = fopen($_debug_file, 'a');
fwrite($_fp, $message);
fclose($_fp);
}
}
开发者ID:nouphet,项目名称:rata,代码行数:51,代码来源:xpress_debug_log.php
示例14: errorHandler
/**
* Handle & log errors
*
* @return void
* @see http://php.net/manual/en/errorfunc.examples.php
*/
public static function errorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<errortype>" . self::errorType($errno) . "</errortype>\n";
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
Logger::Log("ERROR", $err, $filename, $linenum);
self::viewError();
}
开发者ID:reallysend,项目名称:miniPHP,代码行数:20,代码来源:Error.php
示例15: serialize
/**
* Serialize PHP to WDDX
*
* @param mixed $value
* @param array $opts
* @return string
* @throws Zend\Serializer\Exception on wddx error
*/
public function serialize($value, array $opts = array())
{
$opts = $opts + $this->_options;
if (isset($opts['comment']) && $opts['comment']) {
$wddx = wddx_serialize_value($value, (string) $opts['comment']);
} else {
$wddx = wddx_serialize_value($value);
}
if ($wddx === false) {
$lastErr = error_get_last();
throw new RuntimeException($lastErr['message']);
}
return $wddx;
}
开发者ID:alab1001101,项目名称:zf2,代码行数:22,代码来源:WDDX.php
示例16: serialize
/**
* Serialize PHP to WDDX
*
* @param mixed $value
* @return string
* @throws Exception\RuntimeException on wddx error
*/
public function serialize($value)
{
$comment = $this->getOptions()->getComment();
ErrorHandler::start();
if ($comment !== '') {
$wddx = wddx_serialize_value($value, $comment);
} else {
$wddx = wddx_serialize_value($value);
}
$error = ErrorHandler::stop();
if ($wddx === false) {
throw new Exception\RuntimeException('Serialization failed', 0, $error);
}
return $wddx;
}
开发者ID:raZ3l,项目名称:zf2,代码行数:22,代码来源:Wddx.php
示例17: serialize
/**
* Serialize PHP to WDDX
*
* @param mixed $value
* @param array $opts
* @return string
* @throws Zend_Serializer_Exception on wddx error
*/
public function serialize($value, array $opts = array())
{
$opts = $opts + $this->_options;
if (isset($opts['comment']) && $opts['comment']) {
$wddx = wddx_serialize_value($value, (string) $opts['comment']);
} else {
$wddx = wddx_serialize_value($value);
}
if ($wddx === false) {
$lastErr = error_get_last();
require_once 'Zend/Serializer/Exception.php';
throw new Zend_Serializer_Exception($lastErr['message']);
}
return $wddx;
}
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:23,代码来源:Wddx.php
示例18: xml
/**
* @param $date
* @param $errno
* @param $errType
* @param $errMsg
* @param $file
* @param $line
* @param $vars
* @param null $stackTrace
* @return string
*/
public static function xml($date, $errno, $errType, $errMsg, $file, $line, $vars, $stackTrace = null)
{
$user_errors = array(E_ERROR, E_WARNING, E_PARSE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $date . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
$err .= "\t<errortype>" . $errType . "</errortype>\n";
$err .= "\t<errormsg>" . $errMsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $file . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $line . "</scriptlinenum>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
return $err;
}
开发者ID:pecqueurS,项目名称:hylacore,代码行数:27,代码来源:ErrorMessage.php
示例19: userErrorHandler
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
$dt = date("Y-m-d H:i:s");
$errortype = array(1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice");
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = array("datetime" => $dt, "errornum" => $errno, "errortype" => $errortype[$errno], "errormsg" => $errmsg, "scriptname" => $filename, "scriptlinenum" => $linenum);
if (in_array($errno, $user_errors)) {
$err["vartrace"] = wddx_serialize_value($vars, "Variables");
}
echo '<pre>';
foreach ($err as $k => $v) {
echo "{$k}: \t {$v}\n";
}
echo '</pre>';
exit;
}
开发者ID:anatoliychakkaev,项目名称:webdesk,代码行数:16,代码来源:console.php
示例20: metallopdb
function metallopdb()
{
/*{{{*/
if (!$_REQUEST['metal']) {
echo "<b>ERROR: Missing parameters.</b>\n";
return false;
}
$metal = strtolower($_REQUEST['metal']);
$mode = isset($_REQUEST['mode']) ? strtolower($_REQUEST['mode']) : 'first';
$count = isset($_REQUEST['count']) ? intval($_REQUEST['count']) : 5;
$format = isset($_REQUEST['format']) ? strtolower($_REQUEST['format']) : 'csv';
$result = getPDBFromMetal($metal, $mode, $count);
if (is_object($result) && DB::isError($result)) {
echo "<b>ERROR " . $result->getCode() . ": " . $result->getMessage() . "</b>\n";
return false;
}
if ($result == false) {
echo "";
return false;
}
switch ($format) {
case "wddx":
header("Content-type: text/xml");
echo wddx_serialize_value($result);
break;
case "serialize":
header("Content-type: text/plain");
echo serialize($result);
break;
case "rss":
header("Content-type: text/xml");
echo toRSS($result, $GLOBALS['server_remote']);
break;
case "csv":
default:
header("Content-type: text/plain");
$fields = array_keys($result[0]);
$out = toCSV($fields);
for ($i = 0; $i < count($result); $i++) {
$out .= toCSV(array_values($result[$i]));
}
echo $out;
break;
}
return true;
}
开发者ID:SandyS1,项目名称:presentations,代码行数:46,代码来源:api.php
注:本文中的wddx_serialize_value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论