本文整理汇总了PHP中eZDebug::writeDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::writeDebug方法的具体用法?PHP eZDebug::writeDebug怎么用?PHP eZDebug::writeDebug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::writeDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shorten
public function shorten($url)
{
$call = $this->serviceCallUrl . urlencode($url);
$shortUrl = $this->shortenUrl($call);
eZDebug::writeDebug("Shortened {$url} to {$shortUrl}", __METHOD__);
return $shortUrl;
}
示例2: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($parameters['object_id']);
$versionID = $parameters['version'];
if (!$object) {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$version = $object->version($versionID);
if (!$version) {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$akismetObject = new eZContentObjectAkismet();
$comment = $akismetObject->akismetInformationExtractor($version);
if ($comment) {
$akismet = new eZAkismet($comment);
if ($akismet) {
$isSpam = $akismet->isCommentSpam();
eZDebug::writeDebug($comment);
eZDebug::writeDebug("this is spam: " . $isSpam);
} else {
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if (!$isSpam) {
$response = $akismet->submitHam();
return eZWorkflowType::STATUS_ACCEPTED;
}
return eZWorkflowType::STATUS_REJECTED;
}
}
示例3: execute
function execute($process, $event)
{
// get object being published
$parameters = $process->attribute('parameter_list');
$objectID = $parameters['object_id'];
eZDebug::writeDebug('Update object state for object: ' . $objectID);
$object = eZContentObject::fetch($objectID);
$state_before = $event->attribute('state_before');
$state_after = $event->attribute('state_after');
if ($object == null) {
eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if ($state_before == null || $state_after == null) {
eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$currentStateIDArray = $object->attribute('state_id_array');
if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
$canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
} else {
eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
} else {
eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
}
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例4: searchActivities
public function searchActivities($query, $limit = 20, $sorting = 'best')
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_google_activities_search';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'activities/search');
$cacheFileHandler = $this->getCacheFileHandler('_activities_search', array($query, $limit, $sorting));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('query' => $query, 'limit' => $limit, 'sorting' => $sorting), self::$debugMessagesGroup);
$response = $this->API->activities->search($query, array('maxResults' => $limit, 'orderBy' => $sorting));
$activities = array();
$currentTime = time();
foreach ($response['items'] as $activity) {
$createdAt = strtotime($activity['published']);
$activity['created_ago'] = self::getCreatedAgoString($createdAt, $currentTime);
$activity['created_timestamp'] = $createdAt;
$activities[] = $activity;
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($activities));
} else {
$activities = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $activities;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e, self::$debugMessagesGroup);
return $result;
}
}
示例5: addFiles
function addFiles(&$index, $dirname, $dirArray)
{
try {
$dir = new eZClusterDirectoryIterator($dirname);
} catch (Exception $e) {
if ($e instanceof UnexpectedValueException) {
eZDebug::writeDebug("Cannot add {$dirname} to the sitemaps index because it does not exist");
return;
}
}
foreach ($dir as $file) {
$f = eZClusterFileHandler::instance($file->name());
if ($f->exists()) {
$exists = true;
break;
}
}
if (false != $exists) {
foreach ($dir as $file) {
if (in_array($file->name(), $dirArray)) {
continue;
}
if ($file->size() > 50) {
$date = new xrowSitemapItemModified();
$date->date = new DateTime("@" . $file->mtime());
$loc = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $file->name();
if (!in_array($loc, $GLOBALS['loc'])) {
$GLOBALS['loc'][] = $loc;
$index->add($loc, array($date));
}
}
}
}
}
示例6: getTimeline
public function getTimeline($pageID = false, $limit = 20, $type = 'feed')
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_facebook_timeline';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'timeline');
$cacheFileHandler = $this->getCacheFileHandler('_timeline', array($pageID, $limit, $type));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('page_id' => $pageID, 'limit' => $limit), self::$debugMessagesGroup);
$response = $this->API->api(($pageID === false ? 'me/home' : '/' . $pageID) . '/' . $type, array('access_token' => $this->acessToken, 'limit' => $limit));
$messages = array();
$currentTime = time();
foreach ($response['data'] as $message) {
$createdAt = strtotime($message['created_time']);
$message['created_ago'] = self::getCreatedAgoString($createdAt, $currentTime);
$message['created_timestamp'] = $createdAt;
if (isset($message['message'])) {
$message['message'] = self::fixMessageLinks($message['message']);
}
$messages[] = $message;
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($messages));
} else {
$messages = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $messages;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
return $result;
}
}
示例7: 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;
}
示例8: fetchElement
/**
* Helper function for {@link eZHTTPPersistence::fetch()}
*
* @param string $base_name
* @param array $def Definition for $object, uses the same syntax as {@link eZPersistentObject}
* @param object $object
* @param eZHTTPTool $http
* @param int|string|false $index Index in HTTP POST data corresponding to $object.
* Set as string will make use of corresponding field in $def
* Set to false if posted data is not an array.
* @see eZHTTPPersistence::fetch()
* @return void
*/
static function fetchElement($base_name, array $def, $object, eZHTTPTool $http, $index)
{
$fields = $def["fields"];
$keys = $def["keys"];
foreach ($fields as $field_name => $field_member) {
if (!in_array($field_name, $keys)) {
$post_var = $base_name . "_" . $field_name;
if ($http->hasPostVariable($post_var)) {
$post_value = $http->postVariable($post_var);
if ($index === false) {
if ($post_value !== null && $field_member['datatype'] === 'string' && array_key_exists('max_length', $field_member) && $field_member['max_length'] > 0 && strlen($post_value) > $field_member['max_length']) {
$post_value = substr($post_value, 0, $field_member['max_length']);
eZDebug::writeDebug($post_value, "truncation of {$field_name} to max_length=" . $field_member['max_length']);
}
$object->setAttribute($field_name, $post_value);
} else {
if (is_string($index)) {
$object->setAttribute($field_name, $post_value[$object->attribute($index)]);
} else {
$object->setAttribute($field_name, $post_value[$index]);
}
}
}
}
}
}
示例9: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
if ($operatorName == 'ezjssd_cleanup') {
$operatorValue = str_replace(array('<p>', '</p>'), '', $operatorValue);
$operatorValue = str_replace(array('<br />'), "\n", $operatorValue);
eZDebug::writeDebug($operatorValue, __METHOD__);
}
}
示例10: getMediaRecent
public function getMediaRecent($pageID = false, $limit = 20)
{
$result = array('result' => array());
$accumulator = $this->debugAccumulatorGroup . '_instagram_media_recent';
eZDebug::accumulatorStart($accumulator, $this->debugAccumulatorGroup, 'media_recent');
$cacheFileHandler = $this->getCacheFileHandler('_media_recent', array($pageID, $limit));
try {
if ($this->isCacheExpired($cacheFileHandler)) {
eZDebug::writeDebug(array('page_id' => $pageID, 'limit' => $limit), self::$debugMessagesGroup);
$items = array();
$userData = eZHTTPTool::getDataByURL('https://api.instagram.com/v1/users/search?' . 'q=' . $pageID . '&' . 'client_id=' . $this->API['key']);
$userID = false;
if ($userData !== false) {
$userDataArray = json_decode($userData, true);
if (count($userDataArray['data'])) {
foreach ($userDataArray['data'] as $user) {
if ($user['username'] == $pageID) {
$userID = $user['id'];
break;
}
}
}
}
if ($userID !== false) {
$leftLimit = $limit;
$feedData = eZHTTPTool::getDataByURL('https://api.instagram.com/v1/users/' . $userID . '/media/recent/?' . 'access_token=' . $this->API['token']);
if ($feedData !== false) {
$feedDataArray = json_decode($feedData, true);
if (isset($feedDataArray['data'])) {
$items = array_merge($items, array_slice($feedDataArray['data'], 0, $leftLimit));
$leftLimit = $leftLimit - count($feedDataArray['data']);
}
$endlessLoopBreaker = 0;
while ($endlessLoopBreaker < 50 && $leftLimit > 0 && isset($feedDataArray['pagination']['next_url'])) {
$endlessLoopBreaker++;
$feedData = eZHTTPTool::getDataByURL($feedDataArray['pagination']['next_url']);
if ($feedData !== false) {
$feedDataArray = json_decode($feedData, true);
$items = array_merge($items, array_slice($feedDataArray['data'], 0, $leftLimit));
}
$leftLimit = $leftLimit - count($feedDataArray['data']);
}
}
}
$cacheFileHandler->fileStoreContents($cacheFileHandler->filePath, serialize($items));
} else {
$items = unserialize($cacheFileHandler->fetchContents());
}
eZDebug::accumulatorStop($accumulator);
$result['result'] = $items;
return $result;
} catch (Exception $e) {
eZDebug::accumulatorStop($accumulator);
eZDebug::writeError($e->getMessage(), self::$debugMessagesGroup);
return $result;
}
}
示例11: exportAttribute
function exportAttribute(&$attribute, $seperationChar)
{
eZDebug::writeDebug($attribute, "SMILE");
$content = $attribute->content();
$relation_list = $content['relation_list'];
eZDebug::writeDebug($content, "SMILE");
$names = array();
foreach ($relation_list as $relation) {
$object = eZContentObject::fetch($relation['contentobject_id']);
$names[] = $object->name();
}
return $this->escape(join(" ", $names), $seperationChar);
}
示例12: shorten
public function shorten($url)
{
$shortUrl = false;
$owly = OwlyApi::factory(array('key' => eZINI::instance('nxcsocialnetworks.ini')->variable('LinkShortenHandlerOwly', 'ApiKey')));
try {
$responseUrl = $owly->shorten($url);
if ($responseUrl != '') {
$shortUrl = $responseUrl;
}
} catch (Exception $e) {
// Catch any API errors here
}
eZDebug::writeDebug("Shortened {$url} to {$shortUrl}", __METHOD__);
return $shortUrl;
}
示例13: save
/**
* Saves the xml content
*
* @param $filename Path to file
*/
function save($filename = 'sitemap.xml')
{
$file = eZClusterFileHandler::instance($filename);
if ($file->exists()) {
eZDebug::writeDebug("Time: " . date('d.m.Y H:i:s') . ". Action: " . $filename . " exists. File will be remove.");
if (!$isQuiet) {
$cli = eZCLI::instance();
$cli->output("Time: " . date('d.m.Y H:i:s') . ". Action: " . $filename . " exists. File will be remove.");
$cli->output("\n");
}
$file->delete();
}
$xml = $this->dom->saveXML();
return $file->storeContents($xml, 'sitemap', 'text/xml');
}
示例14: shorten
public function shorten($url)
{
$shortUrl = false;
$bitly = new Bitly(null, null, eZINI::instance('nxcsocialnetworks.ini')->variable('LinkShortenHandlerBitly', 'GenericAccessToken'));
try {
$response = $bitly->shorten($url);
$responseUrl = $response['url'];
if ($responseUrl != '') {
$shortUrl = $responseUrl;
}
} catch (Exception $e) {
// Catch any API errors here
}
eZDebug::writeDebug("Shortened {$url} to {$shortUrl}", __METHOD__);
return $shortUrl;
}
示例15: execute
function execute($process, $event)
{
// get object being published
$parameters = $process->attribute('parameter_list');
$objectId = $parameters['object_id'];
eZDebug::writeDebug('Expire remote cache event begins execution for object ' . $objectId);
$ini = eZINI::instance('ezworkflowcollection.ini');
$object = eZContentObject::fetch($objectId);
if ($object != null) {
if ($ini->variable('ExpireRemoteCacheFlowSettings', 'ExpireOnlyObjectNodes') == 'enabled') {
// basic version
// get list of nodes this object is published with
$assigned_nodes = $object->attribute('assigned_nodes');
} else {
// smart-cache enabled version
// get list of nodes whose view-cache is expired
$assigned_nodes = array();
eZContentCacheManager::nodeListForObject($object, true, eZContentCacheManager::CLEAR_DEFAULT, $assigned_nodes, $handledObjectList);
foreach ($assigned_nodes as $i => $nodeID) {
$assigned_nodes[$i] = eZContentObjectTreeNode::fetch($nodeID);
}
}
$domains = $ini->variable('ExpireRemoteCacheFlowSettings', 'ExpireDomains');
foreach ($assigned_nodes as $assigned_node) {
// for every node, call eZHTTPCacheManager to clean the remote cache
$url = $assigned_node->urlAlias();
if (is_array($domains) && (count($domains) > 1 || count($domains) > 0 && $domains[0] != '')) {
eZURI::transformURI($url);
foreach ($domains as $domain) {
eZHTTPCacheManager::execute($domain . $url);
}
} else {
eZURI::transformURI($url, false, 'full');
eZHTTPCacheManager::execute($url);
}
}
} else {
eZDebug::writeError('Expire remote cache event triggered for inexisting object: ' . $objectId);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
return eZWorkflowType::STATUS_ACCEPTED;
}