本文整理汇总了PHP中Framework::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::debug方法的具体用法?PHP Framework::debug怎么用?PHP Framework::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::debug方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addError
public function addError()
{
if (func_num_args() < 1) {
\Framework::debug("Need at least 1 parameter");
}
$args = func_get_args();
switch (count($args)) {
case 1:
if (is_object($args[0])) {
$this->errors->add($args[0]);
} elseif (is_string($args[0])) {
$this->errors->add(new ErrorGlobal($args[0]));
} else {
\Framework::debug("Wrong argument passed to add errors");
}
break;
case 2:
$this->errors->add(new ErrorForm($args[0], $args[1]));
break;
case 3:
$this->errors->add(new ErrorForm($args[0], $args[1], $args[2]));
break;
default:
\Framework::debug("This function can't has " . count($args) . " arguments");
break;
}
}
示例2: getItems
/**
* @return array<list_Item>
*/
public final function getItems()
{
try {
$request = Controller::getInstance()->getContext()->getRequest();
$questionId = intval($request->getParameter('questionId', 0));
$question = DocumentHelper::getDocumentInstance($questionId);
} catch (Exception $e) {
if (Framework::isDebugEnabled()) {
Framework::debug(__METHOD__ . ' EXCEPTION: ' . $e->getMessage());
}
return array();
}
// Here we must use instanceof and not getDocumentModelName to work with injection.
$results = array();
if ($question instanceof form_persistentdocument_boolean) {
$trueLabel = $question->getTruelabel();
$falseLabel = $question->getFalselabel();
$results[$trueLabel] = new list_Item($trueLabel, $trueLabel);
$results[$falseLabel] = new list_Item($falseLabel, $falseLabel);
} else {
if ($question instanceof form_persistentdocument_list) {
$results = $question->getDataSource()->getItems();
}
}
return $results;
}
示例3: sendFile_Rangable
function sendFile_Rangable($filename, $contentType = "binary/octet")
{
if (!file_exists($filename)) {
return Framework::debug(DEBUG_FATAL, "sendFile_Ranagable() - Unknown file {$filename}");
}
header("Content-Type: {$contentType}");
$fp = @fopen($filename, 'rb');
header("Accept-Ranges: bytes");
$size = filesize($filename);
// File size
$length = $size;
// Content length
$start = 0;
// Start byte
$end = $size - 1;
// End byte
if (isset($_SERVER['HTTP_RANGE'])) {
$c_start = $start;
$c_end = $end;
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
if (strpos($range, ',') !== false) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes {$start}-{$end}/{$size}");
exit;
}
if ($range == '-') {
$c_start = $size - substr($range, 1);
} else {
$range = explode('-', $range);
$c_start = $range[0];
$c_end = isset($range[1]) && is_numeric($range[1]) ? $range[1] : $size;
}
$c_end = $c_end > $end ? $end : $c_end;
if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes {$start}-{$end}/{$size}");
exit;
}
$start = $c_start;
$end = $c_end;
$length = $end - $start + 1;
fseek($fp, $start);
header('HTTP/1.1 206 Partial Content');
}
header("Content-Range: bytes {$start}-{$end}/{$size}");
header("Content-Length: " . $length);
$buffer = 1024 * 8;
while (!feof($fp) && ($p = ftell($fp)) <= $end) {
if ($p + $buffer > $end) {
$buffer = $end - $p + 1;
}
set_time_limit(0);
echo fread($fp, $buffer);
flush();
}
fclose($fp);
exit;
}
示例4: getMessage
protected function getMessage($msgType)
{
switch ($msgType) {
case Error::ERROR_MESSAGE_HTML:
return $this->getHTML();
break;
case Error::ERROR_MESSAGE_RAW:
return $this->getRawMessage();
break;
default:
\Framework::debug("Unknown message type");
break;
}
}
示例5: preSave
/**
* @param form_persistentdocument_field $document
* @param Integer $parentNodeId Parent node ID where to save the document (optionnal).
* @return void
*/
protected function preSave($document, $parentNodeId = null)
{
$fieldName = $document->getFieldName();
if (f_util_StringUtils::isEmpty($fieldName)) {
$this->fieldNameCounter = $this->fieldNameCounter + 1;
$fieldName = 'f' . time() . $this->fieldNameCounter;
if (Framework::isDebugEnabled()) {
Framework::debug(__METHOD__ . ' Generate FieldName: ' . $fieldName . ' for document ' . $document->__toString());
}
$document->setFieldName($fieldName);
}
$parentDoc = $parentNodeId != null ? DocumentHelper::getDocumentInstance($parentNodeId) : $this->getParentOf($document);
form_BaseformService::getInstance()->checkFieldNameAvailable($document, $parentDoc->getId());
$this->fixRequiredConstraint($document);
}
示例6: sendCameraImage
function sendCameraImage($camName, $ImageName, $mode = "full")
{
global $hostConfig;
// Verify Camera definition was loaded..
if (!isset($this->camList[$camName])) {
return Framework::debug(DEBUG_FATAL, "<CENTER><H1>Requested Camera [{$camName}] not found</h1></center>");
}
// Verify Image file exists
$ImageFile = $this->camList[$camName]['folder'] . "/{$ImageName}";
if (!file_exists($ImageFile)) {
return Framework::debug(DEBUG_FATAL, "<CENTER><H1>Requested Image not found</h1></center>");
}
// Return correct varient of image..
switch ($mode) {
case 'thumb':
return makeThumbnail($ImageFile, "{$hostConfig['Folder_Base']}/thumb", $hostConfig['ThumbSize']);
break;
case 'full':
return sendFile_Rangable($this->camList[$camName]['folder'] . "/{$ImageName}", "image/jpeg");
break;
default:
Framework::debug(DEBUG_FATAL, "Unknown 'Mode' parameter");
}
}
示例7: setHeader
/**
* Adds or replace headers array
*
* @param string|array $header
*/
public function setHeader($header, $append = true)
{
if ($append) {
if (is_string($header)) {
$this->headers[] = $header;
} elseif (is_array($header)) {
$this->headers = array_merge($this->headers, $header);
} else {
\Framework::debug("Invalid header type");
}
} else {
if (is_string($header)) {
$header = array($header);
}
if (is_array($header)) {
$this->headers = $header;
} else {
\Framework::debug("Invalid header type");
}
}
return $this;
}
示例8: sendAcknowledgement
/**
* @param form_persistentdocument_baseform $form
* @param form_persistentdocument_response $response
* @param block_BlockRequest $request
* @param array $result
* @param String $acknowledgmentReceiver
* @param String $replyTo
* @return void
*/
protected function sendAcknowledgement($form, $response, $request, $result, $acknowledgmentReceiver, $replyTo)
{
$recipients = new mail_MessageRecipients();
$recipients->setTo(array($acknowledgmentReceiver));
$parameters = $this->getAcknowledgementNotificationParameters($form, $response, $request, $result, $acknowledgmentReceiver, $replyTo);
if (Framework::isDebugEnabled()) {
Framework::debug(__METHOD__ . " Form \"" . $form->getLabel() . "\" (id=" . $form->getId() . ")");
Framework::debug(__METHOD__ . " Parameters: " . var_export($parameters, true));
Framework::debug(__METHOD__ . " To : " . join(", ", $recipients->getTo()));
Framework::debug(__METHOD__ . " ReplyTo : " . $replyTo);
}
$ns = notification_NotificationService::getInstance();
$ns->setMessageService(MailService::getInstance());
$notification = $form->getAcknowledgmentNotification();
$senderEmail = $this->getOverrideNotificationSender($form);
return $ns->send($notification, $recipients, $parameters, 'form', $replyTo, $senderEmail);
}
示例9: sendEmail
/**
* @param form_persistentdocument_form $form
* @param form_persistentdocument_response $response
* @param block_BlockRequest $request
* @param String $copyMail
* @param String $replyTo
* @return void
*/
private function sendEmail($form, $response, $request, $copyMail, $replyTo)
{
$recipients = new mail_MessageRecipients();
if ($request->hasParameter('receiverIds')) {
$this->handleReceveirIds($request->getParameter('receiverIds'), $recipients);
}
// Determine the message recipients for this form.
// Note that the following method may be overriden to allow the developper
// to build specific mail recipients, depending on the request data for
// example.
$this->buildMessageRecipients($form, $recipients, $request);
if (!$recipients->isEmpty()) {
if ($form->getMessageSendingType() == self::SEND_EMAIL_AND_APPEND_TO_MAILBOX) {
$messageService = mailbox_MessageService::getInstance();
Framework::debug(__METHOD__ . " Getting mailbox_MessageService instance.");
} else {
$messageService = MailService::getInstance();
Framework::debug(__METHOD__ . " Getting MailService instance.");
}
$contentTemplate = TemplateLoader::getInstance()->setPackageName('modules_form')->setMimeContentType(K::HTML)->load('Form-MailContent');
$contentTemplate->setAttribute('items', $response->getAllData());
$contentTemplate->setAttribute('response', $response->getResponseInfos());
$parameters = $response->getData();
$parameters[self::CONTENT_REPLACEMENT_NAME] = $contentTemplate->execute();
$parameters[self::FORM_LABEL_REPLACEMENT_NAME] = $form->getLabel();
if (Framework::isDebugEnabled()) {
Framework::debug(__METHOD__ . " Form \"" . $form->getLabel() . "\" (id=" . $form->getId() . ")");
Framework::debug(__METHOD__ . " Parameters: " . var_export($parameters, true));
if ($recipients->hasTo()) {
Framework::debug(__METHOD__ . " To : " . join(", ", $recipients->getTo()));
}
if ($recipients->hasBCC()) {
Framework::debug(__METHOD__ . " CC : " . join(", ", $recipients->getCC()));
}
if ($recipients->hasBCC()) {
Framework::debug(__METHOD__ . " BCC : " . join(", ", $recipients->getBcc()));
}
Framework::debug(__METHOD__ . " ReplyTo : " . $replyTo);
}
$ns = notification_NotificationService::getInstance();
$ns->setMessageService($messageService);
if ($copyMail === null) {
return $ns->send($form->getNotification(), $recipients, $parameters, 'form', $replyTo, $this->getOverrideNotificationSender($form));
} else {
$copyRecipient = new mail_MessageRecipients();
$copyRecipient->setTo(array($copyMail));
$notification = $form->getNotification();
$sender = $this->getOverrideNotificationSender($form);
return $ns->send($notification, $recipients, $parameters, 'form', $replyTo, $sender) && $ns->send($notification, $copyRecipient, $parameters, 'form', $replyTo, $sender);
}
}
return true;
}