本文整理汇总了PHP中eZExtension::getHandlerClass方法的典型用法代码示例。如果您正苦于以下问题:PHP eZExtension::getHandlerClass方法的具体用法?PHP eZExtension::getHandlerClass怎么用?PHP eZExtension::getHandlerClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZExtension
的用法示例。
在下文中一共展示了eZExtension::getHandlerClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runPreRoutingFilters
public function runPreRoutingFilters( ezcMvcRequest $request )
{
$prefixFilterOptions = new ezpExtensionOptions();
$prefixFilterOptions->iniFile = 'rest.ini';
$prefixFilterOptions->iniSection = 'System';
$prefixFilterOptions->iniVariable = 'PrefixFilterClass';
$prefixFilterOptions->handlerParams = array( $request, $this->apiPrefix );
$prefixFilter = eZExtension::getHandlerClass( $prefixFilterOptions );
$prefixFilter->filter();
// We call this method here, so that implementors won't have to remember
// adding this call to their own filter() implementation.
$prefixFilter->filterRequestUri();
try
{
$this->runCustomFilters( self::FILTER_TYPE_PREROUTING, array( 'request' => $request ) );
}
catch ( Exception $e )
{
$request->variables['exception'] = $e;
$request->uri = $this->apiPrefix . '/fatal';
return new ezcMvcInternalRedirect( $request );
}
}
示例2: getHandler
/**
* Returns an ajaxuploader handler instance from the ezjscore function
* arguments.
*
* @param array $args the arguments of the ezjscore ajax function
* @return ezpAjaxUploaderHandlerInterface
*
* @throws InvalidArgumentException if the handler cannot be instanciated
*/
private static function getHandler( array $args )
{
if ( !isset( $args[0] ) )
{
throw new InvalidArgumentException(
ezpI18n::tr(
'extension/ezjscore/ajaxuploader',
'Unable to find the identifier of ajax upload handler'
)
);
}
$http = eZHTTPTool::instance();
$handlerData = $http->postVariable( 'AjaxUploadHandlerData', array() );
$handlerOptions = new ezpExtensionOptions();
$handlerOptions->iniFile = 'ezjscore.ini';
$handlerOptions->iniSection = 'AjaxUploader';
$handlerOptions->iniVariable = 'AjaxUploadHandler';
$handlerOptions->handlerIndex = $args[0];
$handlerOptions->handlerParams = $handlerData;
$handler = eZExtension::getHandlerClass( $handlerOptions );
if ( !$handler instanceof ezpAjaxUploaderHandlerInterface )
{
throw new InvalidArgumentException(
ezpI18n::tr(
'extension/ezjscore/ajaxuploader',
'Unable to load the ajax upload handler'
)
);
}
return $handler;
}
示例3: __construct
/**
* Constructor.
*
* $filePath File path. If specified, file metadata is fetched in the constructor.
*/
function __construct( $filePath = false )
{
$filePath = eZDBFileHandler::cleanPath( $filePath );
eZDebugSetting::writeDebug( 'kernel-clustering', "db::ctor( '$filePath' )" );
if ( self::$dbbackend === null )
{
$optionArray = array( 'iniFile' => 'file.ini',
'iniSection' => 'ClusteringSettings',
'iniVariable' => 'DBBackend' );
$options = new ezpExtensionOptions( $optionArray );
self::$dbbackend = eZExtension::getHandlerClass( $options );
self::$dbbackend->_connect( false );
// connection failed
if( self::$dbbackend->db === false )
throw new eZClusterHandlerDBNoConnectionException( self::$dbbackend->dbparams['host'], self::$dbbackend->dbparams['user'], self::$dbbackend->dbparams['pass'] );
}
$this->filePath = $filePath;
if ( !isset( $GLOBALS['eZDBFileHandler_Settings'] ) )
{
$fileINI = eZINI::instance( 'file.ini' );
$GLOBALS['eZDBFileHandler_Settings']['NonExistantStaleCacheHandling'] = $fileINI->variable( "ClusteringSettings", "NonExistantStaleCacheHandling" );
unset( $fileINI );
}
$this->nonExistantStaleCacheHandling = $GLOBALS['eZDBFileHandler_Settings']['NonExistantStaleCacheHandling'];
$this->filePermissionMask = octdec( eZINI::instance()->variable( 'FileSettings', 'StorageFilePermissions' ) );
}
示例4: getUserHash
/**
* Gets an instance of the StaticCacheHandler and ask it for the user hash.
*
* @return string
*/
static function getUserHash()
{
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
return $staticCacheHandler->getUserHash();
}
示例5: __construct
/**
* Constructor
*
* If provided with $filePath, will use this file for further operations.
* If not given, the file* methods must be used instead
*
* @param string $filePath Path of the file to handle
*
* @throws eZDBNoConnectionException DB connection failed
*/
function __construct($filePath = false)
{
if (self::$nonExistantStaleCacheHandling === null) {
$fileINI = eZINI::instance('file.ini');
self::$nonExistantStaleCacheHandling = $fileINI->variable("ClusteringSettings", "NonExistantStaleCacheHandling");
unset($fileINI);
}
// DB Backend init
if (self::$dbbackend === null) {
self::$dbbackend = eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'file.ini', 'iniSection' => 'eZDFSClusteringSettings', 'iniVariable' => 'DBBackend')));
self::$dbbackend->_connect(false);
$fileINI = eZINI::instance('file.ini');
if ($fileINI->variable('ClusterEventsSettings', 'ClusterEvents') === 'enabled' && self::$dbbackend instanceof eZClusterEventNotifier) {
$listener = eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'file.ini', 'iniSection' => 'ClusterEventsSettings', 'iniVariable' => 'Listener', 'handlerParams' => array(new eZClusterEventLoggerEzdebug()))));
if ($listener instanceof eZClusterEventListener) {
self::$dbbackend->registerListener($listener);
$listener->initialize();
}
}
}
if ($filePath !== false) {
$filePath = self::cleanPath($filePath);
eZDebugSetting::writeDebug('kernel-clustering', "dfs::ctor( '{$filePath}' )");
} else {
eZDebugSetting::writeDebug('kernel-clustering', "dfs::ctor()");
}
$this->filePath = $filePath;
}
示例6: __construct
/**
* Constructor
*
* If provided with $filePath, will use this file for further operations.
* If not given, the file* methods must be used instead
*
* @param string $filePath Path of the file to handle
*
* @throws eZDBNoConnectionException DB connection failed
*/
function __construct( $filePath = false )
{
if ( self::$nonExistantStaleCacheHandling === null )
{
$fileINI = eZINI::instance( 'file.ini' );
self::$nonExistantStaleCacheHandling = $fileINI->variable( "ClusteringSettings", "NonExistantStaleCacheHandling" );
unset( $fileINI );
}
// DB Backend init
if ( self::$dbbackend === null )
{
self::$dbbackend = eZExtension::getHandlerClass(
new ezpExtensionOptions(
array( 'iniFile' => 'file.ini',
'iniSection' => 'eZDFSClusteringSettings',
'iniVariable' => 'DBBackend' ) ) );
self::$dbbackend->_connect( false );
}
if ( $filePath !== false )
{
$filePath = eZDBFileHandler::cleanPath( $filePath );
eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::ctor( '$filePath' )" );
}
else
{
eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::ctor()" );
}
$this->filePath = $filePath;
}
示例7: updateBlockPoolByBlockID
/**
* Update block pool for block with given $blockID
*
* @static
* @param string $blockID
* @param integer $publishedBeforeOrAt
* @return integer
*/
public static function updateBlockPoolByBlockID($block, $publishedBeforeOrAt = false)
{
$db = eZDB::instance();
$blockINI = eZINI::instance('block.ini');
if (!$publishedBeforeOrAt) {
$publishedBeforeOrAt = time();
}
if (!$blockINI->hasVariable($block['block_type'], 'FetchClass')) {
// Pure manual block, nothing is going to be fetched, but we need to update last_update as it is used for rotations
if ($block['rotation_type'] != self::ROTATION_NONE) {
$db->query("UPDATE ezm_block SET last_update={$publishedBeforeOrAt} WHERE id='" . $block['id'] . "'");
}
return 0;
}
$fetchClassOptions = new ezpExtensionOptions();
$fetchClassOptions->iniFile = 'block.ini';
$fetchClassOptions->iniSection = $block['block_type'];
$fetchClassOptions->iniVariable = 'FetchClass';
$fetchInstance = eZExtension::getHandlerClass($fetchClassOptions);
if (!$fetchInstance instanceof eZFlowFetchInterface) {
eZDebug::writeWarning("Can't create an instance of the {$fetchClass} class", "eZFlowOperations::updateBlockPoolByBlockID('" . $block['id'] . "')");
return false;
}
$fetchFixedParameters = array();
if ($blockINI->hasVariable($block['block_type'], 'FetchFixedParameters')) {
$fetchFixedParameters = $blockINI->variable($block['block_type'], 'FetchFixedParameters');
}
$fetchParameters = unserialize($block['fetch_params']);
if (!is_array($fetchParameters)) {
// take care of blocks existing in db where ini definition changed
eZDebug::writeWarning("Found existing block which has no necessary parameters serialized in the db (block needs updating)", "eZFlowOperations::updateBlockPoolByBlockID('" . $block['id'] . "')");
$fetchParameters = array();
}
$parameters = array_merge($fetchFixedParameters, $fetchParameters);
$newItems = array();
foreach ($fetchInstance->fetch($parameters, $block['last_update'], $publishedBeforeOrAt) as $item) {
$newItems[] = array('blockID' => $block['id'], 'objectID' => $item['object_id'], 'nodeID' => $item['node_id'], 'priority' => 0, 'timestamp' => $item['ts_publication']);
}
$itemsToRemove = 0;
if (isset($parameters['Limit'])) {
$count = $db->arrayQuery("SELECT count(*) as count FROM ezm_pool WHERE block_id='" . $block['id'] . "'");
$itemsToRemove = (int) $count[0]['count'] + count($newItems) - (int) $parameters['Limit'];
}
if (!empty($newItems) || $itemsToRemove > 0) {
$db->begin();
if ($itemsToRemove > 0) {
$db->query("DELETE FROM ezm_pool WHERE block_id='" . $block['id'] . "' ORDER BY ts_publication ASC LIMIT " . $itemsToRemove);
}
if (!empty($newItems)) {
eZFlowPool::insertItems($newItems);
}
$db->query("UPDATE ezm_block SET last_update={$publishedBeforeOrAt} WHERE id='" . $block['id'] . "'");
$db->commit();
}
return count($newItems);
}
示例8: getRouteFilter
/**
* Returns the currently configured class for handling Route security.
*
* @static
* @throws ezpRestRouteSecurityFilterNotFoundException
* @return ezpRestRouteFilterInterface
*/
public static function getRouteFilter()
{
$opt = new ezpExtensionOptions();
$opt->iniFile = 'rest.ini';
$opt->iniSection = 'RouteSettings';
$opt->iniVariable = 'RouteSettingImpl';
$routeSecurityFilterInstance = eZExtension::getHandlerClass($opt);
if (!$routeSecurityFilterInstance instanceof self) {
throw new ezpRestRouteSecurityFilterNotFoundException();
}
return $routeSecurityFilterInstance;
}
示例9: send
static function send(eZMail $mail)
{
$ini = eZINI::instance();
$transportType = trim($ini->variable('MailSettings', 'Transport'));
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'MailSettings', 'iniVariable' => 'TransportAlias', 'handlerIndex' => strtolower($transportType));
$options = new ezpExtensionOptions($optionArray);
$transportClass = eZExtension::getHandlerClass($options);
if (!is_object($transportClass)) {
eZDebug::writeError("No class available for mail transport type '{$transportType}', cannot send mail", __METHOD__);
}
return $transportClass->sendMail($mail);
}
示例10: createFormatter
/**
* Searches for the output formatter handler class for a given format
*
* @static
* @param string $format
* @return ezpAttributeOperatorFormatterInterface
*/
protected static function createFormatter($format)
{
$formatterOptions = new ezpExtensionOptions();
$formatterOptions->iniFile = 'template.ini';
$formatterOptions->iniSection = 'AttributeOperator';
$formatterOptions->iniVariable = 'OutputFormatter';
$formatterOptions->handlerIndex = $format;
$formatterInstance = eZExtension::getHandlerClass($formatterOptions);
if (!$formatterInstance instanceof ezpAttributeOperatorFormatterInterface) {
eZDebug::writeError("Undefined output formatter for '{$format}'", __METHOD__);
}
return $formatterInstance;
}
示例11: runPreRoutingFilters
public function runPreRoutingFilters(ezcMvcRequest $request)
{
$prefixFilterOptions = new ezpExtensionOptions();
$prefixFilterOptions->iniFile = 'rest.ini';
$prefixFilterOptions->iniSection = 'System';
$prefixFilterOptions->iniVariable = 'PrefixFilterClass';
$prefixFilterOptions->handlerParams = array($request, $this->apiPrefix);
$prefixFilter = eZExtension::getHandlerClass($prefixFilterOptions);
$prefixFilter->filter();
// We call this method here, so that implementors won't have to remember
// adding this call to their own filter() implementation.
$prefixFilter->filterRequestUri();
}
示例12: createProvider
/**
* @param string $provider
* @return ezpRestProviderInterface
*/
protected static function createProvider($provider)
{
$providerOptions = new ezpExtensionOptions();
$providerOptions->iniFile = 'rest.ini';
$providerOptions->iniSection = 'ApiProvider';
$providerOptions->iniVariable = 'ProviderClass';
$providerOptions->handlerIndex = $provider;
$providerInstance = eZExtension::getHandlerClass($providerOptions);
if (!$providerInstance instanceof ezpRestProviderInterface) {
throw new ezpRestProviderNotFoundException($provider);
}
return $providerInstance;
}
示例13: filter
public function filter()
{
if ( eZINI::instance( 'rest.ini' )->variable( 'Authentication', 'RequireHTTPS') === 'enabled' &&
$this->req->isEncrypted === false )
{
// When an unencrypted connection is identified, we have to alter the
// flag to avoid infinite loop, when the request is rerouted to the error controller.
// This should be improved in the future.
$this->req->isEncrypted = true;
throw new ezpRestHTTPSRequiredException();
}
// 0. Check if the given route needs authentication.
if ( !$this->shallAuthenticate() )
{
$this->filter = new ezpRestNoAuthStyle();
}
else if ( $this->filter === null )
{
$opt = new ezpExtensionOptions();
$opt->iniFile = 'rest.ini';
$opt->iniSection = 'Authentication';
$opt->iniVariable = 'AuthenticationStyle';
$authFilter = eZExtension::getHandlerClass( $opt );
if ( !$authFilter instanceof ezpRestAuthenticationStyle )
{
throw new ezpRestAuthStyleNotFoundException();
}
$this->filter = $authFilter;
}
// 1. Initialize the context needed for authenticating the user.
$auth = $this->filter->setup( $this->req );
if ( $auth instanceof ezcMvcInternalRedirect )
return $auth;
// 2.Perform the authentication
// Result of authentication filter can be a valid ezp user (auth succeeded) or an internal redirect (ezcMvcInternalRedirect)
$user = $this->filter->authenticate( $auth, $this->req );
if ( $user instanceof eZUser )
{
eZUser::setCurrentlyLoggedInUser( $user, $user->attribute( 'contentobject_id' ) );
$this->filter->setUser( $user );
}
else if ( $user instanceof ezcMvcInternalRedirect )
{
return $user;
}
}
示例14: createRenderer
/**
* Returns ezpRestContentProviderInterface object for requested renderer
*
* @param string $renderer
* @param ezpContent $content
* @return ezpRestContentProviderInterface
*/
protected static function createRenderer($renderer, ezpContent $content, ezpRestMvcController $controller)
{
$rendererOptions = new ezpExtensionOptions();
$rendererOptions->iniFile = 'rest.ini';
$rendererOptions->iniSection = 'OutputSettings';
$rendererOptions->iniVariable = 'RendererClass';
$rendererOptions->handlerIndex = $renderer;
$rendererOptions->handlerParams = array($content, $controller);
$rendererInstance = eZExtension::getHandlerClass($rendererOptions);
if (!$rendererInstance instanceof ezpRestContentRendererInterface) {
throw new ezpRestContentRendererNotFoundException($renderer);
}
return $rendererInstance;
}
示例15: clusterDBHandler
/**
* Returns a connection to the cluster db handler - which might be implemented using different php classes...
* Null if not clustered
*
* @return eZClusterFileHandlerInterface|...
*/
public static function clusterDBHandler()
{
$ini = eZINI::instance('file.ini');
$handler = $ini->variable('ClusteringSettings', 'FileHandler');
if ($handler == 'ezdb' || $handler == 'eZDBFileHandler') {
return eZClusterFileHandler::instance();
} else {
if ($handler == 'eZDFSFileHandler') {
// This is even worse: we have no right to know if db connection is ok.
// So we replicate some code here...
return eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'file.ini', 'iniSection' => 'eZDFSClusteringSettings', 'iniVariable' => 'DBBackend')));
}
}
return null;
}