本文整理汇总了PHP中Seitenbau\Registry::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getLogger方法的具体用法?PHP Registry::getLogger怎么用?PHP Registry::getLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seitenbau\Registry
的用法示例。
在下文中一共展示了Registry::getLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authCallback
/**
* @param string $username
* @param string $password
*
* @return bool
*/
public function authCallback($username, $password)
{
try {
$accessManager = AccessManager::singleton();
$authResult = $accessManager->checkLogin($username, $password);
// module development must be enabled to login via WebDav
$quota = new \Cms\Quota();
if (!$quota->getModuleQuota()->getEnableDev()) {
Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: module development is disabled (%s)', $username), SbLog::ERR);
return false;
}
// login success?
if (!$accessManager->isAuthResultValid($authResult)) {
Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: incorrect user credentials (%s)', $username), SbLog::NOTICE);
return false;
}
// only superusers are allowed to login via webdav
$identity = $authResult->getIdentity();
if (!is_array($identity) || !isset($identity['superuser']) || $identity['superuser'] != true) {
Registry::getLogger()->log(__METHOD__, __LINE__, sprintf('DAV access denied: user is not a superuser (%s)', $username), SbLog::ERR);
return false;
}
} catch (\Exception $e) {
Registry::getLogger()->logException(__METHOD__, __LINE__, $e, SbLog::ERR);
return false;
}
// authentication successful
return true;
}
示例2: validate
/**
* validate a request object on basis of function-name(action)
*
* @param string $function
* @param \Cms\Request\Abstract $actionRequest
* @param boolean $setHttpErrorCode
* @return true
* @throws Exception
*/
public function validate($function, Request $actionRequest, $abortExceptions = true)
{
$methodName = 'validateMethod' . $function;
if (method_exists($this, $methodName)) {
try {
$this->{$methodName}($actionRequest);
} catch (PropertyAccessException $e) {
$message = str_replace('%name%', $e->getName(), $this->_('error.validation.missing_parameter'));
$this->addError(new Error($e->getName(), null, array($message)));
}
if (count($this->getErrors()) > 0) {
foreach ($this->getErrors() as $error) {
\Cms\ExceptionStack::addException($error);
}
if (count(\Cms\ExceptionStack::getExceptions()) > 0) {
// soll nur der Status-Code veraendert werden (Bsp: Rueckgabe Images)
if ($abortExceptions == true) {
// bisherige Fehler loggen und reset
foreach (\Cms\ExceptionStack::getExceptions() as $exception) {
\Seitenbau\Registry::getLogger()->logException(__METHOD__, __LINE__, $exception, \Seitenbau\Log::NOTICE);
}
//\Cms\ExceptionStack::reset();
return false;
} else {
\Cms\ExceptionStack::throwErrors();
}
}
}
return true;
} else {
$data = array('method' => $methodName);
throw new \Cms\Exception(-12, __METHOD__, __LINE__, $data);
}
}
示例3: getLog
public function getLog()
{
if (!Registry::getLogger()) {
return false;
}
$log = Registry::getLogger();
return $log;
}
示例4: getThumbnail
/**
* Erstellt ein Thumbnail der angegebenen Orginaldatei
*
* @param string $originFilePath
* @param string $cacheFilePath
* @param int $width
* @param int $height
* @return Thumbnail|false
*/
public function getThumbnail($originFilePath, $cacheFilePath, $width, $height)
{
try {
return new Thumbnail($originFilePath, $cacheFilePath, $width, $height);
} catch (\Exception $e) {
Registry::getLogger()->logException(__METHOD__, __LINE__, $e, \Seitenbau\Log::ERR);
return false;
}
}
示例5: _initLogger
protected function _initLogger()
{
// Falls Logger vorhanden, diesen zuerst entfernen
$logger = Registry::getLogger();
if ($logger instanceof Seitenbau\Logger) {
$logger = null;
}
parent::_initLogger();
}
示例6: create
/**
* creates the publisher object
*
* @param string $publisherName
* @return
*/
protected static function create($publisherName)
{
$publisherClassName = '\\Cms\\Publisher\\Type\\' . ucfirst($publisherName);
if (!class_exists($publisherClassName)) {
$errorMessage = 'Class ' . $publisherClassName . ' doesn\'t exist';
Registry::getLogger()->log(__METHOD__, __LINE__, $errorMessage, Log::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
return new $publisherClassName();
}
示例7: getUuids
/**
* Gibt Uuids einer angegebenen Klasse zurueck
*
* @param string $dataClassName
* @param integer $count
* @throws Cms\Exception
*/
public function getUuids($dataClassName, $count)
{
$dataClass = sprintf("Orm\\Data\\%s", ucfirst($dataClassName));
if (!class_exists($dataClass)) {
$errorMessage = sprintf("Data class '%s' does not exist", $dataClass);
Registry::getLogger()->log(__METHOD__, __LINE__, $errorMessage, \Seitenbau\Log::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
$uuids = $this->generateUuids(new $dataClass(), $count);
return $uuids;
}
示例8: publisherstatuschangedAction
public function publisherstatuschangedAction()
{
try {
$validatedRequest = $this->getValidatedRequest('Builder', 'PublisherStatusChanged');
$this->getBusiness()->checkUserRights('publisherStatusChanged', array('websiteId' => $validatedRequest->getWebsiteId()));
$this->getBusiness()->getWebsiteBuildById($validatedRequest->getWebsiteId(), $validatedRequest->getBuildId());
} catch (\Exception $logOnly) {
// log only to make hacking more complicating
Registry::getLogger()->log(__METHOD__, __LINE__, $logOnly->getMessage(), Log::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
}
示例9: checkUserRights
/**
* Prueft die Rechte des angemeldeten Users fuer die aufgerufene Aktion im
* Zusammenhang mit der Website-ID und Page-ID
* Hat der User keine Rechte, so wird eine Exception geworfen
*
* @param string $rightname
* @param mixed $check
* @return boolean
* @throws \Cms\Exception
*/
public final function checkUserRights($rightname, $check = null)
{
if (Registry::getConfig()->group->check->activ == true) {
$identity = $this->getIdentityAsArray();
$userHaveRights = $this->hasUserRights($identity, $rightname, $check);
if ($userHaveRights == false) {
Registry::getLogger()->logData(__METHOD__, __LINE__, 'User has no privilege', array('check' => array('business' => get_class($this), 'right' => $rightname, 'data' => $check), 'identity' => array('id' => isset($identity['id']) ? $identity['id'] : 'n/a')), SbLog::ERR);
throw new \Cms\Exception(7, __METHOD__, __LINE__);
}
}
return true;
}
示例10: getCreatorClassName
/**
* @param string $creatorName
*
* @return string
* @throws CmsException
*/
protected static function getCreatorClassName($creatorName)
{
$fullCreatorName = ucfirst($creatorName) . 'Creator';
$creatorClassName = 'Cms\\Creator\\Adapter\\' . $fullCreatorName;
$creatorFileName = __DIR__ . '/Adapter/' . $fullCreatorName . '.php';
if (file_exists($creatorFileName)) {
if (class_exists($creatorClassName)) {
return $creatorClassName;
}
}
Registry::getLogger()->log(__METHOD__, __LINE__, 'Class ' . $creatorClassName . ' does not exist', Log::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
示例11: findMultipleByIds
/**
* Gibt mehrere Media-Objekte anhand der uebergebenen Ids zurueck
*
* @param array $ids
* @param string $websiteId
* @param array
*/
public function findMultipleByIds(array $ids, $websiteId)
{
$dql = 'SELECT m FROM Orm\\Entity\\Media m' . ' WHERE m.id IN (:ids) ' . ' AND m.websiteid = :websiteid';
$query = $this->_em->createQuery($dql);
$query->setParameters(array('ids' => $ids, 'websiteid' => $websiteId));
try {
$result = $query->getResult();
} catch (\Exception $e) {
\Seitenbau\Registry::getLogger()->logException(__METHOD__, __LINE__, $e, \Seitenbau\Log::NOTICE);
$result = null;
}
return $result;
}
示例12: getHasher
/**
*
* @return Hashers\IPasswordHasher[]
*/
protected function getHasher()
{
if (is_null($this->hashers)) {
$this->hashers = array();
foreach ($this->password_hashers as $h) {
try {
$this->hashers[] = new $h();
} catch (\Exception $e) {
Registry::getLogger()->logException(__METHOD__, __LINE__, $e, Log::WARN);
}
}
}
return $this->hashers;
}
示例13: get
/**
* @return string
*/
public function get($useInternalUrl = false)
{
$config = Registry::getConfig();
$credential = null;
if ($config->screens->accessticket->authentication) {
$credential = array('username' => RandomGenerator::generateString(10), 'password' => RandomGenerator::generateString(10));
}
$requestConfig = $this->getShootRequest();
\Seitenbau\Registry::getLogger()->logData(__METHOD__, __LINE__, "ShootRequest:", $requestConfig, \Seitenbau\Log::DEBUG);
$ticketUrl = '';
if (isset($requestConfig) && !empty($requestConfig)) {
$ticketBusiness = $this->newTicketInstance();
$ticketUrl = $ticketBusiness->createTicketUrl($this->websiteId, false, true, $requestConfig, $config->screens->accessticket->ticketLifetime, $config->screens->accessticket->remainingCalls, $config->screens->accessticket->sessionLifetime, $credential, $credential, $useInternalUrl);
}
return $ticketUrl;
}
示例14: create
/**
* creates the screenshot object
*
* @param string $adapterName
* @param array $config
* @return
*/
protected static function create($adapterName, array $config)
{
$screentoolClassName = '\\Seitenbau\\Screenshot\\Type\\' . ucfirst($adapterName);
if (!class_exists($screentoolClassName)) {
$errorMessage = 'Class ' . $screentoolClassName . ' doesn\'t exist';
Registry::getLogger()->log(__METHOD__, __LINE__, $errorMessage, SbLog::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
$screentool = new $screentoolClassName($config);
if (!$screentool instanceof ScreenshotFiles\Screenshot) {
$errorMessage = 'Type class ' . $screentoolClassName . ' does not extend \\Seitenbau\\Screenshot\\Screenshot';
Registry::getLogger()->log(__METHOD__, __LINE__, $errorMessage, SbLog::ERR);
throw new CmsException('1', __METHOD__, __LINE__);
}
return $screentool;
}
示例15: factory
/**
* Erstellt ein Bildverarbeitungs-Tool Seitenbau\Image\Base
*
* @param array $config
*/
public static function factory($config = null)
{
//set memory limit for large images
if (!isset(self::$_memory_limit)) {
self::setMemoryLimit();
}
$imageAdapterName = null;
if ($config instanceof \Zend_Config) {
$config = $config->toArray();
}
if (!is_array($config)) {
$globalConfig = Registry::getConfig();
if (isset($globalConfig->imageAdapter) && !empty($globalConfig->imageAdapter)) {
$config = $globalConfig->imageAdapter->toArray();
}
}
if (isset($config['adapter']) && !empty($config['adapter'])) {
$imageAdapterName = (string) $config['adapter'];
} else {
// Default/Fallback
$imageAdapterName = 'Phpgd';
}
if (!is_string($imageAdapterName) || empty($imageAdapterName)) {
throw new \Exception('Type name must be specified in a string');
}
$imageAdapterName = ucfirst($imageAdapterName);
if (!self::loadClass($imageAdapterName)) {
throw new \Exception("Image adpater class '{$imageAdapterName}' couldn't be loaded");
}
$imageAdapterClassName = '\\Seitenbau\\Image\\Adapter\\' . $imageAdapterName;
if (!class_exists($imageAdapterClassName)) {
$errorMessage = sprintf("Image processing class '%s' doesn't exist", $imageAdapterClassName);
Registry::getLogger()->log(__METHOD__, __LINE__, $errorMessage, \Seitenbau\Log::ERR);
throw new \Exception($errorMessage);
}
try {
$config = is_array($config) ? $config : array();
$imageTool = new $imageAdapterClassName($config);
} catch (\Exception $e) {
Registry::getLogger()->logException(__METHOD__, __LINE__, $e, $e->getCode());
}
if (!$imageTool instanceof ImageFiles\Image) {
throw new \Exception("Type class '{$imagetoolName}' does not extend \\Seitenbau\\Image\\Image");
}
return $imageTool;
}