本文整理匯總了PHP中vCal::quote方法的典型用法代碼示例。如果您正苦於以下問題:PHP vCal::quote方法的具體用法?PHP vCal::quote怎麽用?PHP vCal::quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vCal
的用法示例。
在下文中一共展示了vCal::quote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: write
/**
* Writes the property out in vCalendar format.
*
* @access public
* @return string
*
*/
function write()
{
$out = $this->name . "\r\n";
foreach ($this->parameters as $key => $value) {
if (is_array($value)) {
$vals = array();
foreach ($value as $k => $v) {
$value[$k] = vCal::quote($v);
$vals[] = $key . '=' . $value[$k];
}
//$out .= vCal::fold (join (',', $value)) . "\r\n";
// it doesn't look like people use commas in other implementations,
// and it seems that multiple properties and parameters may use
// the same name, which means hashes don't work so well here.
// $out .= vCal::fold (join (';', $value)) . "\r\n";
$out .= ' ;' . vCal::fold(join("\r\n ;", $vals)) . "\r\n";
} else {
$out .= ' ;' . $key . '=';
$out .= vCal::fold(vCal::quote($value)) . "\r\n";
}
}
if (is_array($this->value)) {
$numeric = false;
foreach ($this->value as $key => $value) {
if (is_numeric($key)) {
$numeric = true;
} else {
$numeric = false;
}
break;
}
$out .= ' :';
$buf = array();
foreach ($this->value as $key => $value) {
// to handle values and parameters whose values are arrays...
if (is_array($value)) {
foreach ($value as $k => $v) {
$value[$k] = vCal::quote($v);
}
$value = join(';', $value);
}
if ($numeric) {
$buf[] = vCal::fold(vCal::quote($value));
} else {
$buf[] = $key . '=' . vCal::fold(vCal::quote($value));
}
}
//if ($numeric) {
//$out .= join (',', $buf) . "\r\n";
//} else {
$out .= join(';', $buf) . "\r\n";
//}
} else {
$out .= ' :' . vCal::fold($this->value) . "\r\n";
}
return $out;
}