本文整理汇总了PHP中Tinebase_Helper::urlExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Helper::urlExists方法的具体用法?PHP Tinebase_Helper::urlExists怎么用?PHP Tinebase_Helper::urlExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Helper
的用法示例。
在下文中一共展示了Tinebase_Helper::urlExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _convertVevent
//.........这里部分代码省略.........
// * we need to have a mapping externalid / internalid (where?)
if (!$attachment) {
$readFromURL = true;
$url = $property->getValue();
} else {
$attachments->addRecord($attachment);
}
} elseif ('URI' === $value) {
/*
* ATTACH;VALUE=URI:https://server.com/calendars/__uids__/0AA0
3A3B-F7B6-459A-AB3E-4726E53637D0/dropbox/4971F93F-8657-412B-841A-A0FD913
9CD61.dropbox/Canada.png
*/
$url = $property->getValue();
$urlParts = parse_url($url);
$host = $urlParts['host'];
$name = pathinfo($urlParts['path'], PATHINFO_BASENAME);
// iCal 10.7 places URI before uploading
if (parse_url(Tinebase_Core::getHostname(), PHP_URL_HOST) != $host) {
$readFromURL = true;
}
} else {
// @TODO: implement (check if add / update / update is needed)
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' attachment found that could not be imported due to missing managed id');
}
}
if ($readFromURL) {
if (preg_match('#^(https?://)(.*)$#', str_replace(array("\n", "\r"), '', $url), $matches)) {
// we are client and found an external hosted attachment that we need to import
$userCredentialCache = Tinebase_Core::getUserCredentialCache();
$url = $matches[1] . $userCredentialCache->username . ':' . $userCredentialCache->password . '@' . $matches[2];
$attachmentInfo = $matches[1] . $matches[2] . ' ' . $name . ' ' . $managedId;
if (Tinebase_Helper::urlExists($url)) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Downloading attachment: ' . $attachmentInfo);
}
$stream = fopen($url, 'r');
$attachment = new Tinebase_Model_Tree_Node(array('name' => rawurldecode($name), 'type' => Tinebase_Model_Tree_Node::TYPE_FILE, 'contenttype' => (string) $property['FMTTYPE'], 'tempFile' => $stream), true);
$attachments->addRecord($attachment);
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Url not found (got 404): ' . $attachmentInfo . ' - Skipping attachment');
}
}
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Attachment found with malformed url: ' . $url);
}
}
}
break;
case 'X-MOZ-LASTACK':
$lastAck = $this->_convertToTinebaseDateTime($property);
break;
case 'X-MOZ-SNOOZE-TIME':
$snoozeTime = $this->_convertToTinebaseDateTime($property);
break;
default:
// thunderbird saves snooze time for recurring event occurrences in properties with names like this -
// we just assume that the event/recur series has only one snooze time
if (preg_match('/^X-MOZ-SNOOZE-TIME-[0-9]+$/', $property->name)) {
$snoozeTime = $this->_convertToTinebaseDateTime($property);
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found snooze time for recur occurrence: ' . $snoozeTime->toString());
}