本文整理汇总了PHP中eZDebug类的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug类的具体用法?PHP eZDebug怎么用?PHP eZDebug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZDebug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: solrMetaDataExists
private function solrMetaDataExists( $contentObjectID=0, $attributeIdentifier='', $subattr='' )
{
try
{
$contentObject = eZContentObject::fetch( $contentObjectID );
$dataMap = $contentObject->dataMap();
if ( array_key_exists( $attributeIdentifier, $dataMap ) )
{
$contentObjectAttribute = $dataMap[$attributeIdentifier];
$eZType = eZDataType::create( solrMetaDataType::DATA_TYPE_STRING );
$value = $eZType->getValue( $contentObjectAttribute->ID, $subattr );
return ( ! empty( $value ) );
}
else
{
eZDebug::writeError( 'Object '.$contentObjectID.' has no attribute '.$attributeIdentifier, 'solrMetaDataExists Error' );
}
return false;
}
catch ( Exception $e )
{
eZDebug::writeError( $e, 'solrMetaDataExists Exception' );
return false;
}
}
示例2: getInstance
/**
* Get singleton instance for filter
* @param string $filterID
* @return eZFindExtendedAttributeFilterInterface|false
*/
public static function getInstance($filterID)
{
if (!isset(self::$instances[$filterID])) {
try {
if (!self::$filtersList) {
$ini = eZINI::instance('ezfind.ini');
self::$filtersList = $ini->variable('ExtendedAttributeFilters', 'FiltersList');
}
if (!isset(self::$filtersList[$filterID])) {
throw new Exception($filterID . ' extended attribute filter is not defined');
}
$className = self::$filtersList[$filterID];
if (!class_exists($className)) {
throw new Exception('Could not find class ' . $className);
}
$instance = new $className();
if (!$instance instanceof eZFindExtendedAttributeFilterInterface) {
throw new Exception($className . ' is not a valid eZFindExtendedAttributeFilterInterface');
}
self::$instances[$filterID] = $instance;
} catch (Exception $e) {
eZDebug::writeWarning($e->getMessage(), __METHOD__);
self::$instances[$filterID] = false;
}
}
return self::$instances[$filterID];
}
示例3: install
function install($package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
{
$path = $package->path();
$databaseType = false;
if (isset($parameters['database-type'])) {
$databaseType = $parameters['database-type'];
}
$path .= '/' . eZDBPackageHandler::sqlDirectory();
if ($databaseType) {
$path .= '/' . $databaseType;
}
if (file_exists($path)) {
$db = eZDB::instance();
$canInsert = true;
if ($databaseType and $databaseType != $db->databaseName()) {
$canInsert = false;
}
if ($canInsert) {
eZDebug::writeDebug("Installing SQL file {$path}/{$filename}");
$db->insertFile($path, $filename, false);
return true;
} else {
eZDebug::writeDebug("Skipping SQL file {$path}/{$filename}");
}
} else {
eZDebug::writeError("Could not find SQL file {$path}/{$filename}");
}
return false;
}
示例4: filterQueryParams
/**
* Modifies SolR query params according to filter parameters
* @param array $queryParams
* @param array $filterParams
* @return array $queryParams
*/
public function filterQueryParams(array $queryParams, array $filterParams)
{
try {
if (!isset($filterParams['field'])) {
throw new Exception('Missing filter parameter "field"');
}
if (!isset($filterParams['latitude'])) {
throw new Exception('Missing filter parameter "latitude"');
}
if (!isset($filterParams['longitude'])) {
throw new Exception('Missing filter parameter "longitude"');
}
$fieldName = eZSolr::getFieldName($filterParams['field']);
//geodist custom parameters
$queryParams['sfield'] = $fieldName;
$queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude'];
//sort by geodist
$queryParams['sort'] = 'geodist() asc,' . $queryParams['sort'];
//exclude unlocated documents
$queryParams['fq'][] = $fieldName . ':[-90,-90 TO 90,90]';
} catch (Exception $e) {
eZDebug::writeWarning($e->getMessage(), __CLASS__);
}
return $queryParams;
}
示例5: generateMarkup
public function generateMarkup()
{
$ttlInfos = $this->parseTTL();
$markup = '<esi:include src="' . $this->Src . '" ttl="' . $ttlInfos['ttl_value'] . $ttlInfos['ttl_unit'] . '" onerror="continue"/>';
eZDebug::writeNotice($markup, __METHOD__);
return $markup;
}
示例6: attribute
/**
* Returns the specified attribute
*
* @param string $name
* @return mixed
*/
function attribute($name)
{
switch ($name) {
case 'tags':
return $this->tags();
break;
case 'tag_ids':
return $this->IDArray;
break;
case 'id_string':
return $this->idString();
break;
case 'keyword_string':
return $this->keywordString();
break;
case 'meta_keyword_string':
return $this->keywordString(", ");
break;
case 'parent_string':
return $this->parentString();
break;
default:
eZDebug::writeError("Attribute '{$name}' does not exist", "eZTags::attribute");
return null;
break;
}
}
示例7: checkRecurrenceCondition
function checkRecurrenceCondition($newsletter)
{
if (!$newsletter->attribute('recurrence_condition')) {
return true;
}
if (0 < count($this->conditionExtensions)) {
foreach ($this->conditionExtensions as $conditionExtension) {
// TODO: Extend to ask multiple condition extensions to allow more complex checks
$siteINI = eZINI::instance();
$siteINI->loadCache();
$extensionDirectory = $siteINI->variable('ExtensionSettings', 'ExtensionDirectory');
$extensionDirectories = eZDir::findSubItems($extensionDirectory);
$directoryList = eZExtension::expandedPathList($extensionDirectories, 'condition_handler');
foreach ($directoryList as $directory) {
$handlerFile = $directory . '/' . strtolower($conditionExtension) . 'handler.php';
// we only check one extension for now
if ($conditionExtension === $newsletter->attribute('recurrence_condition') && file_exists($handlerFile)) {
include_once $handlerFile;
$className = $conditionExtension . 'Handler';
if (class_exists($className)) {
$impl = new $className();
// Ask if condition is fullfilled
return $impl->checkCondition($newsletter);
} else {
eZDebug::writeError("Class {$className} not found. Unable to verify recurrence condition. Blocked recurrence.");
return false;
}
}
}
}
}
// If we have a condition but no match we prevent the sendout
eZDebug::writeError("Newsletter recurrence condition '" . $newsletter->attribute('recurrence_condition') . "' extension not found ");
return false;
}
示例8: runFile
function runFile( $Params, $file, $params_as_var )
{
$Result = null;
if ( $params_as_var )
{
foreach ( $Params as $key => $dummy )
{
if ( $key != "Params" and
$key != "this" and
$key != "file" and
!is_numeric( $key ) )
{
${$key} = $Params[$key];
}
}
}
if ( file_exists( $file ) )
{
$includeResult = include( $file );
if ( empty( $Result ) &&
$includeResult != 1 )
{
$Result = $includeResult;
}
}
else
eZDebug::writeWarning( "PHP script $file does not exist, cannot run.",
"eZProcess" );
return $Result;
}
示例9: validateClassAttributeHTTPInput
function validateClassAttributeHTTPInput($http, $base, $classAttribute)
{
//checking if the recaptcha key is set up if recaptcha is enabled
$ini = eZINI::instance('ezcomments.ini');
$fields = $ini->variable('FormSettings', 'AvailableFields');
if (in_array('recaptcha', $fields)) {
$publicKey = $ini->variable('RecaptchaSetting', 'PublicKey');
$privateKey = $ini->variable('RecaptchaSetting', 'PrivateKey');
if ($publicKey === '' || $privateKey === '') {
eZDebug::writeNotice('reCAPTCHA key is not set up. For help please visit http://projects.ez.no/ezcomments', __METHOD__);
}
}
if ($http->hasPostVariable('StoreButton') || $http->hasPostVariable('ApplyButton')) {
// find the class and count how many Comments dattype
$cond = array('contentclass_id' => $classAttribute->attribute('contentclass_id'), 'version' => eZContentClass::VERSION_STATUS_TEMPORARY, 'data_type_string' => $classAttribute->attribute('data_type_string'));
$classAttributeList = eZContentClassAttribute::fetchFilteredList($cond);
// if there is more than 1 comment attribute, return it as INVALID
if (!is_null($classAttributeList) && count($classAttributeList) > 1) {
if ($classAttributeList[0]->attribute('id') == $classAttribute->attribute('id')) {
eZDebug::writeNotice('There are more than 1 comment attribute in the class.', __METHOD__);
return eZInputValidator::STATE_INVALID;
}
}
}
return eZInputValidator::STATE_ACCEPTED;
}
示例10: handleFileDownload
function handleFileDownload($contentObject, $contentObjectAttribute, $type, $fileInfo)
{
$fileName = $fileInfo['filepath'];
$file = eZClusterFileHandler::instance($fileName);
if ($fileName != "" and $file->exists()) {
$fileSize = $file->size();
if (isset($_SERVER['HTTP_RANGE']) && preg_match("/^bytes=(\\d+)-(\\d+)?\$/", trim($_SERVER['HTTP_RANGE']), $matches)) {
$fileOffset = $matches[1];
$contentLength = isset($matches[2]) ? $matches[2] - $matches[1] + 1 : $fileSize - $matches[1];
} else {
$fileOffset = 0;
$contentLength = $fileSize;
}
// Figure out the time of last modification of the file right way to get the file mtime ... the
$fileModificationTime = $file->mtime();
// stop output buffering, and stop the session so that browsing can be continued while downloading
eZSession::stop();
ob_end_clean();
eZFile::downloadHeaders($fileName, self::dispositionType($fileInfo['mime_type']) === 'attachment', false, $fileOffset, $contentLength, $fileSize);
try {
$file->passthrough($fileOffset, $contentLength);
} catch (eZClusterFileHandlerNotFoundException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Internal Server Error');
} catch (eZClusterFileHandlerGeneralException $e) {
eZDebug::writeError($e->getMessage, __METHOD__);
header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
}
eZExecution::cleanExit();
}
return eZBinaryFileHandler::RESULT_UNAVAILABLE;
}
示例11: run
function run( &$benchmark, $display = false )
{
$this->Results = array();
$this->CurrentResult = false;
if ( is_subclass_of( $benchmark, 'ezbenchmarkunit' ) )
{
$markList = $benchmark->markList();
foreach ( $markList as $mark )
{
$type = $this->markEntryType( $benchmark, $mark );
if ( $type )
{
$mark['type'] = $type;
$this->prepareMarkEntry( $benchmark, $mark );
$this->runMarkEntry( $benchmark, $mark );
$this->finalizeMarkEntry( $benchmark, $mark, $display );
}
else
$this->addToCurrentResult( $mark,
"Unknown mark type for mark " . $benchmark->name() . '::' . $mark['name'] );
}
}
else
{
eZDebug::writeWarning( "Tried to run test on an object which is not subclassed from eZBenchmarkCase", __METHOD__ );
}
}
示例12: continueWorkflow
static function continueWorkflow($workflowProcessID)
{
$operationResult = null;
$theProcess = eZWorkflowProcess::fetch($workflowProcessID);
if ($theProcess != null) {
//restore memento and run it
$bodyMemento = eZOperationMemento::fetchChild($theProcess->attribute('memento_key'));
if ($bodyMemento === null) {
eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
return $operationResult;
}
$bodyMementoData = $bodyMemento->data();
$mainMemento = $bodyMemento->attribute('main_memento');
if (!$mainMemento) {
return $operationResult;
}
$mementoData = $bodyMemento->data();
$mainMementoData = $mainMemento->data();
$mementoData['main_memento'] = $mainMemento;
$mementoData['skip_trigger'] = false;
$mementoData['memento_key'] = $theProcess->attribute('memento_key');
$bodyMemento->remove();
$operationParameters = array();
if (isset($mementoData['parameters'])) {
$operationParameters = $mementoData['parameters'];
}
$operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
}
return $operationResult;
}
示例13: getEvents
public static function getEvents(eZContentObjectTreeNode $node, array $parameters)
{
$events = array();
$base = array('name' => $node->attribute('name'), 'main_node_id' => $node->attribute('main_node_id'), 'main_url_alias' => $node->attribute('url_alias'), 'fields' => array('attr_from_time_dt' => 0, 'attr_to_time_dt' => 0));
try {
$startDate = new DateTime('now', OCCalendarData::timezone());
$startDate->setDate(date('Y', $parameters['search_from_timestamp']), date('n', $parameters['search_from_timestamp']), date('j', $parameters['search_from_timestamp']));
$endDate = clone $startDate;
$endDate->add(new DateInterval($parameters['interval']));
$byDayInterval = new DateInterval('P1D');
/** @var DateTime[] $byDayPeriod */
$byDayPeriod = new DatePeriod($startDate, $byDayInterval, $endDate);
$timeTable = self::getTimeTableFromNode($node);
foreach ($byDayPeriod as $date) {
$weekDay = $date->format('w');
if (isset($timeTable[$weekDay])) {
foreach ($timeTable[$weekDay] as $value) {
$newEvent = $base;
$date->setTime($value['from_time']['hour'], $value['from_time']['minute']);
$newEvent['fields']['attr_from_time_dt'] = $date->format('Y-m-d\\TH:i:s\\Z');
$date->setTime($value['to_time']['hour'], $value['to_time']['minute']);
$newEvent['fields']['attr_to_time_dt'] = $date->format('Y-m-d\\TH:i:s\\Z');
$item = OCCalendarItem::fromEzfindResultArray($newEvent);
$events[] = $item;
}
}
}
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), __METHOD__);
}
return $events;
}
示例14: getXMLString
function getXMLString($name = false, $data, $ret = false, $debug = false)
{
// given string $data, will return the text string content of the $name attribute content of a given valid xml document.
if ($debug) {
ezDebug::writeNotice($name, 'getXMLString:name');
}
// get information out of eZXML
$xml = new eZXML();
$xmlDoc = $data;
if ($debug) {
ezDebug::writeNotice($data, 'getXMLString:data');
}
// continue only with content
if ($xmlDoc != null and $name != null) {
$dom = $xml->domTree($xmlDoc);
$element = $dom->elementsByName("{$name}");
if (is_object($element[0])) {
$string = $element[0]->textContent();
$ret = $string;
} else {
eZDebug::writeNotice('Key "' . $name . '" does not exist.', 'wrap_operator');
}
}
if ($debug) {
ezDebug::writeNotice($ret, 'getXMLString:ret');
}
return $ret;
}
示例15: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$sendmailOptions = '';
$emailFrom = $mail->sender();
$emailSender = $emailFrom['email'];
if (!$emailSender || count($emailSender) <= 0) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
}
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
if (!eZMail::validate($emailSender)) {
$emailSender = false;
}
$isSafeMode = ini_get('safe_mode');
if ($isSafeMode and $emailSender and $mail->sender() == false) {
$mail->setSenderText($emailSender);
}
$filename = time() . '-' . mt_rand() . '.mail';
$data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
$returnedValue = eZFile::create($filename, 'var/log/mail', $data);
if ($returnedValue === false) {
eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
}
return $returnedValue;
}