本文整理汇总了PHP中eZDebugSetting::writeNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebugSetting::writeNotice方法的具体用法?PHP eZDebugSetting::writeNotice怎么用?PHP eZDebugSetting::writeNotice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebugSetting
的用法示例。
在下文中一共展示了eZDebugSetting::writeNotice方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run($url = '', $args = array())
{
if (empty($url)) {
return '';
}
$args = array_merge($this->embed_defaults, $args);
foreach ($this->handlers as $handler) {
if (in_array('OCCustomEmbedHandlerInterface', class_implements($handler))) {
if ($regex = call_user_func(array($handler, 'regex'))) {
if (preg_match($regex, $url, $matches)) {
if (false !== ($result = call_user_func(array($handler, 'callback'), $matches, $url, $args))) {
eZDebugSetting::writeNotice('ocembed', 'Autoembed has found url "' . $url . '" in ' . $handler, __METHOD__);
return $result;
}
}
}
}
}
$oembed = new OCoEmbed();
$result = $oembed->get_html($url, $args);
if ($result) {
eZDebugSetting::writeNotice('ocembed', 'Autoembed has found url "' . $url . '" in a OEmbed provider', __METHOD__);
if (!eZINI::instance('ocembed.ini')->hasVariable('Settings', 'DisableFixHttps')) {
$result = str_replace('http://', '//', $result);
}
return $result;
}
// Still unknown
eZDebugSetting::writeNotice('ocembed', 'Autoembed did not find url "' . $url . '"', __METHOD__);
return array($this->maybe_make_link($url));
}
示例2: modify
function modify(&$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
switch ($operatorName) {
case 'tidy_output':
eZDebugSetting::writeNotice("extension-eztidy", "Use 'tidy_output' template operator", "eZTidy::tidyCleaner()");
$tidy = eZTidy::instance('OutputFilter');
$operatorValue = $tidy->tidyCleaner($operatorValue);
break;
}
}
示例3: executeSending
/**
* Execute sending process in Email
* @see extension/ezcomments/classes/ezcomNotificationManager#executeSending($subject, $body, $subscriber)
*/
public function executeSending($subject, $body, $subscriber)
{
$email = $subscriber->attribute('email');
$parameters = array();
$parameters['content_type'] = $this->emailContentType;
$parameters['from'] = $this->emailFrom;
$transport = eZNotificationTransport::instance('ezmail');
$result = $transport->send(array($email), $subject, $body, null, $parameters);
if ($result === false) {
throw new Exception('Send email error! Subscriber id:' . $subscriber->attribute('id'));
}
eZDebugSetting::writeNotice('extension-ezcomments', "An email has been sent to '{$email}' (subject: {$subject})", __METHOD__);
}
示例4: addComment
/**
* Add comment into ezcomment table and do action
* The adding doesn't validate the data in http
* @param $comment: ezcomComment object which has not been stored
* title, name, url, email, created, modified, text, notification
* @param $user: user object
* @param $time: comment time
* @return true : if adding succeeds
* false otherwise
*
*/
public function addComment($comment, $user, $time = null, $notification = null)
{
if ($time === null) {
$time = time();
}
$beforeAddingResult = $this->beforeAddingComment($comment, $user, $notification);
if ($beforeAddingResult !== true) {
return $beforeAddingResult;
}
$comment->store();
eZDebugSetting::writeNotice('extension-ezcomments', 'Comment has been added', __METHOD__);
$this->afterAddingComment($comment, $notification);
return true;
}
示例5: sendUserNotification
/**
* Send the notification after registeration
*/
public static function sendUserNotification($userID)
{
eZDebugSetting::writeNotice('Sending approval notification to the user.', 'kernel-user', 'user register');
$user = eZUser::fetch($userID);
$ini = eZINI::instance();
// Send mail
$tpl = eZTemplate::factory();
$tpl->setVariable('user', $user);
$templateResult = $tpl->fetch('design:user/registrationapproved.tpl');
$mail = new eZMail();
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
} else {
$subject = ezpI18n::tr('kernel/user/register', 'User registration approved');
}
$mail->setSender($emailSender);
$receiver = $user->attribute('email');
$mail->setReceiver($receiver);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
}
示例6: storeString
static function storeString($filename, $data)
{
$file = @fopen($filename, 'w');
if ($file) {
fwrite($file, $data);
fclose($file);
eZPackage::applyStorageFilePermissions($filename);
eZDebugSetting::writeNotice('kernel-ezpackage-store', "Stored file {$filename}", 'eZPackage::storeString');
return true;
} else {
eZDebug::writeError("Failed to write package '{$filename}'");
}
return false;
}
示例7: loadTranslationFile
/**
* Loads a translation file
* Will load from cache if possible, or generate cache if needed
*
* Also checks for translation files expiry based on mtime if RegionalSettings.TranslationCheckMTime is enabled
*
* @access private
* @param string $locale
* @param string $filename
* @param string $requestedContext
*
* @return bool The operation status, true or false
*/
function loadTranslationFile($locale, $filename, $requestedContext)
{
// First try for current charset
$charset = eZTextCodec::internalCharset();
$tsTimeStamp = false;
$ini = eZINI::instance();
$checkMTime = $ini->variable('RegionalSettings', 'TranslationCheckMTime') === 'enabled';
if (!$this->RootCache) {
$roots = array($ini->variable('RegionalSettings', 'TranslationRepository'));
$extensionBase = eZExtension::baseDirectory();
$translationExtensions = $ini->variable('RegionalSettings', 'TranslationExtensions');
foreach ($translationExtensions as $translationExtension) {
$extensionPath = $extensionBase . '/' . $translationExtension . '/translations';
if (!$checkMTime || file_exists($extensionPath)) {
$roots[] = $extensionPath;
}
}
$this->RootCache = array('roots' => $roots);
} else {
$roots = $this->RootCache['roots'];
if (isset($this->RootCache['timestamp'])) {
$tsTimeStamp = $this->RootCache['timestamp'];
}
}
// Load cached translations if possible
if ($this->UseCache == true) {
if (!$tsTimeStamp) {
$expiry = eZExpiryHandler::instance();
$globalTsTimeStamp = $expiry->getTimestamp(self::EXPIRY_KEY, 0);
$localeTsTimeStamp = $expiry->getTimestamp(self::EXPIRY_KEY . '-' . $locale, 0);
$tsTimeStamp = max($globalTsTimeStamp, $localeTsTimeStamp);
if ($checkMTime && $tsTimeStamp < time()) {
// iterate over each known TS file, and get the highest timestamp
// this value will be used to check for cache validity
foreach ($roots as $root) {
$path = eZDir::path(array($root, $locale, $charset, $filename));
if (file_exists($path)) {
$timestamp = filemtime($path);
if ($timestamp > $tsTimeStamp) {
$tsTimeStamp = $timestamp;
}
} else {
$path = eZDir::path(array($root, $locale, $filename));
if (file_exists($path)) {
$timestamp = filemtime($path);
if ($timestamp > $tsTimeStamp) {
$tsTimeStamp = $timestamp;
}
}
}
}
}
$this->RootCache['timestamp'] = $tsTimeStamp;
}
$key = 'cachecontexts';
if ($this->HasRestoredCache or eZTranslationCache::canRestoreCache($key, $tsTimeStamp)) {
eZDebug::accumulatorStart('tstranslator_cache_load', 'tstranslator', 'TS cache load');
if (!$this->HasRestoredCache) {
if (!eZTranslationCache::restoreCache($key)) {
$this->BuildCache = true;
}
$contexts = eZTranslationCache::contextCache($key);
if (!is_array($contexts)) {
$contexts = array();
}
$this->HasRestoredCache = $contexts;
} else {
$contexts = $this->HasRestoredCache;
}
if (!$this->BuildCache) {
$contextName = $requestedContext;
if (!isset($this->CachedMessages[$contextName])) {
eZDebug::accumulatorStart('tstranslator_context_load', 'tstranslator', 'TS context load');
if (eZTranslationCache::canRestoreCache($contextName, $tsTimeStamp)) {
if (!eZTranslationCache::restoreCache($contextName)) {
$this->BuildCache = true;
}
$this->CachedMessages[$contextName] = eZTranslationCache::contextCache($contextName);
foreach ($this->CachedMessages[$contextName] as $key => $msg) {
$this->Messages[$key] = $msg;
}
}
eZDebug::accumulatorStop('tstranslator_context_load');
}
}
eZDebugSetting::writeNotice('i18n-tstranslator', "Loading cached translation", __METHOD__);
eZDebug::accumulatorStop('tstranslator_cache_load');
//.........这里部分代码省略.........
示例8: afterUpdatingComment
/**
* clean up subscription after updating comment
* @see extension/ezcomments/classes/ezcomCommentManager#afterUpdatingComment($comment, $notified)
*/
public function afterUpdatingComment($comment, $notified, $time)
{
$user = eZUser::fetch($comment->attribute('user_id'));
// if notified is true, add subscription, else cleanup the subscription on the user and content
$contentID = $comment->attribute('contentobject_id');
$languageID = $comment->attribute('language_id');
$subscriptionType = 'ezcomcomment';
if (!is_null($notified)) {
$subscriptionManager = ezcomSubscriptionManager::instance();
if ($notified === true) {
//add subscription but not send activation
try {
$subscriptionManager->addSubscription($comment->attribute('email'), $user, $contentID, $languageID, $subscriptionType, $time, false);
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), __METHOD__);
switch ($e->getCode()) {
case ezcomSubscriptionManager::ERROR_SUBSCRIBER_DISABLED:
return 'The subscriber is disabled.';
default:
return false;
}
}
} else {
$subscriptionManager->deleteSubscription($comment->attribute('email'), $comment->attribute('contentobject_id'), $comment->attribute('language_id'));
}
}
//3. update queue. If there is subscription, add one record into queue table
// if there is subcription on this content, add one item into queue
if (ezcomSubscription::exists($contentID, $languageID, $subscriptionType)) {
$notification = ezcomNotification::create();
$notification->setAttribute('contentobject_id', $comment->attribute('contentobject_id'));
$notification->setAttribute('language_id', $comment->attribute('language_id'));
$notification->setAttribute('comment_id', $comment->attribute('id'));
$notification->store();
eZDebugSetting::writeNotice('extension-ezcomments', 'There are subscriptions, added an update notification to the queue.', __METHOD__);
} else {
// todo: if there is no subscription on this content, consider to clean up the queue
}
return true;
}
示例9: addSubscription
/**
* Add an subscription. If the subscriber is disabled, throw an exception
* If there is no subscriber, add one.
* If there is no subscription for the content, add one
* @param $email: user's email
* @return void
*/
public function addSubscription($email, $user, $contentID, $languageID, $subscriptionType, $currentTime, $activate = true)
{
//1. insert into subscriber
$ezcommentsINI = eZINI::instance('ezcomments.ini');
$subscriber = ezcomSubscriber::fetchByEmail($email);
//if there is no data in subscriber for same email, save it
if (is_null($subscriber)) {
$subscriber = ezcomSubscriber::create();
$subscriber->setAttribute('user_id', $user->attribute('contentobject_id'));
$subscriber->setAttribute('email', $email);
if ($user->isAnonymous()) {
$util = ezcomUtility::instance();
$hashString = $util->generateSusbcriberHashString($subscriber);
$subscriber->setAttribute('hash_string', $hashString);
}
$subscriber->store();
eZDebugSetting::writeNotice('extension-ezcomments', 'Subscriber does not exist, added one', __METHOD__);
$subscriber = ezcomSubscriber::fetchByEmail($email);
} else {
if ($subscriber->attribute('enabled') == false) {
throw new Exception('Subscription can not be added because the subscriber is disabled.', self::ERROR_SUBSCRIBER_DISABLED);
}
}
//3 insert into subscription table
// if there is no data in ezcomment_subscription with given contentobject_id and subscriber_id
$hasSubscription = ezcomSubscription::exists($contentID, $languageID, $subscriptionType, $email);
if ($hasSubscription === false) {
$subscription = ezcomSubscription::create();
$subscription->setAttribute('user_id', $user->attribute('contentobject_id'));
$subscription->setAttribute('subscriber_id', $subscriber->attribute('id'));
$subscription->setAttribute('subscription_type', $subscriptionType);
$subscription->setAttribute('content_id', $contentID);
$subscription->setAttribute('language_id', $languageID);
$subscription->setAttribute('subscription_time', $currentTime);
$defaultActivated = $ezcommentsINI->variable('CommentSettings', 'SubscriptionActivated');
if ($user->isAnonymous() && $defaultActivated !== 'true' && $activate === true) {
$subscription->setAttribute('enabled', 0);
$utility = ezcomUtility::instance();
$subscription->setAttribute('hash_string', $utility->generateSubscriptionHashString($subscription));
$subscription->store();
$result = ezcomSubscriptionManager::sendActivationEmail(eZContentObject::fetch($contentID), $subscriber, $subscription);
if (!$result) {
eZDebug::writeError("Error sending mail to '{$email}'", __METHOD__);
}
} else {
$subscription->setAttribute('enabled', 1);
$subscription->store();
}
eZDebugSetting::writeNotice('extension-ezcomments', 'No existing subscription for this content and user, added one', __METHOD__);
}
}
示例10: _fetch_with_format
function _fetch_with_format($provider_url_with_args, $format)
{
$provider_url_with_args = $this->_add_query_arg('format', $format, $provider_url_with_args);
if (!self::getDataByUrl($provider_url_with_args, true)) {
return false;
}
$response = self::getDataByUrl($provider_url_with_args);
eZDebugSetting::writeNotice('ocembed', $provider_url_with_args, __METHOD__);
if (!$response) {
return false;
}
$parse_method = "_parse_{$format}";
return $this->{$parse_method}($response);
}