本文整理汇总了PHP中eZExtension类的典型用法代码示例。如果您正苦于以下问题:PHP eZExtension类的具体用法?PHP eZExtension怎么用?PHP eZExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
function initialize()
{
$ini = eZINI::instance( 'xmlinstaller.ini' );
$extensionDirectoryList = array_unique( $ini->variable( 'XMLInstallerSettings', 'ExtensionDirectories' ) );
$handlerList = array_unique( $ini->variable( 'XMLInstallerSettings', 'XMLInstallerHandler' ) );
foreach( $extensionDirectoryList as $extensionDirectory )
{
$handler = reset( $handlerList );
do
{
$fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/xmlinstallerhandler/' . $handler . '.php';
if ( file_exists( $fileName ) )
{
include_once( $fileName );
$className = $handler;
$info = call_user_func(array($className, 'handlerInfo'));
if ( array_key_exists( 'XMLName', $info ) && array_key_exists( 'Info', $info ) )
{
$this->HandlerList[$info['XMLName']] = array( 'Info' => $info['Info'],
'File' => $fileName,
'Class' => $className );
}
unset($handlerList[key($handlerList)]);
$handler = current( $handlerList );
}
else
{
$handler = next( $handlerList );
}
} while ( $handler );
}
}
示例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: 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 );
}
}
示例4: __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' ) );
}
示例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 );
}
if ( $filePath !== false )
{
$filePath = eZDBFileHandler::cleanPath( $filePath );
eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::ctor( '$filePath' )" );
}
else
{
eZDebugSetting::writeDebug( 'kernel-clustering', "dfs::ctor()" );
}
$this->filePath = $filePath;
}
示例6: testComplexReordering
public function testComplexReordering()
{
self::setExtensions( array( 'ezfind', 'ezflow', 'ezgmaplocation', 'ezjscore', 'ezmultiupload', 'ezoe', 'ezwebin', 'ezwt' ) );
$this->assertSame(
array( 'ezfind', 'ezflow', 'ezgmaplocation', 'ezjscore', 'ezmultiupload', 'ezoe', 'ezwebin', 'ezwt' ),
eZExtension::activeExtensions() );
}
示例7: gather
static function gather()
{
$contentTypes = array('Objects (including users)' => array('table' => 'ezcontentobject'), 'Users' => array('table' => 'ezuser'), 'Nodes' => array('table' => 'ezcontentobject_tree'), 'Content Classes' => array('table' => 'ezcontentclass'), 'Information Collections' => array('table' => 'ezinfocollection'), 'Pending notification events' => array('table' => 'eznotificationevent', 'wherecondition' => 'status = 0'), 'Objects pending indexation' => array('table' => 'ezpending_actions', 'wherecondition' => "action = 'index_object'"), 'Binary files (content)' => array('table' => 'ezbinaryfile'), 'Image files (content)' => array('table' => 'ezimagefile'), 'Media files (content)' => array('table' => 'ezmedia'), 'Maximum children per node' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY parent_node_id ) nodes'), 'Maximum nodes per object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY contentobject_id ) nodes'), 'Maximum incoming relations to an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY to_contentobject_id ) links', 'nvl' => 0), 'Maximum outgoing relations from an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY from_contentobject_id ) links', 'nvl' => 0));
$db = eZDB::instance();
$contentList = array();
foreach ($contentTypes as $key => $desc) {
if (isset($desc['table'])) {
$sql = 'SELECT COUNT(*) AS NUM FROM ' . $desc['table'];
if (@$desc['wherecondition']) {
$sql .= ' WHERE ' . $desc['wherecondition'];
}
} else {
$sql = $desc['sql'];
}
$count = $db->arrayQuery($sql);
$contentList[$key] = $count[0]['NUM'] === null ? $desc['nvl'] : $count[0]['NUM'];
}
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$ezfindpingurl = $ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp";
$data = eZHTTPTool::getDataByURL($ezfindpingurl, false);
//var_dump( $data );
if (preg_match('#<stat +name="numDocs" ?>([^<]+)</stat>#', $data, $matches)) {
$contentList['Documents in SOLR'] = trim($matches[1]);
} else {
$contentList['Documents in SOLR'] = 'Unknown';
}
}
return $contentList;
}
示例8: instance
/**
* Returns a shared instance of the eZShopAccountHandler class
* as defined in shopaccount.ini[HandlerSettings]Repositories
* and ExtensionRepositories.
*
* @return eZDefaultShopAccountHandler Or similar clases.
*/
static function instance()
{
$accountHandler = null;
if ( eZExtension::findExtensionType( array( 'ini-name' => 'shopaccount.ini',
'repository-group' => 'HandlerSettings',
'repository-variable' => 'Repositories',
'extension-group' => 'HandlerSettings',
'extension-variable' => 'ExtensionRepositories',
'type-group' => 'AccountSettings',
'type-variable' => 'Handler',
'alias-group' => 'AccountSettings',
'alias-variable' => 'Alias',
'subdir' => 'shopaccounthandlers',
'type-directory' => false,
'extension-subdir' => 'shopaccounthandlers',
'suffix-name' => 'shopaccounthandler.php' ),
$out ) )
{
$filePath = $out['found-file-path'];
include_once( $filePath );
$class = $out['type'] . 'ShopAccountHandler';
$accountHandler = new $class( );
}
else
{
$accountHandler = new eZDefaultShopAccountHandler();
}
return $accountHandler;
}
示例9: register
/**
* Register ezote/Autoloader::autoload as autoloader
*/
public static function register($extensionDir = false)
{
if (!static::$registered) {
static::$extensionDir = $extensionDir ?: \eZExtension::baseDirectory();
static::$registered = spl_autoload_register(array(new self(), 'autoload'));
}
}
示例10: loadHandler
static function loadHandler($directories, $handlerString)
{
$foundHandler = false;
$includeFile = '';
$baseDirectory = eZExtension::baseDirectory();
$notificationINI = eZINI::instance('notification.ini');
$repositoryDirectories = $notificationINI->variable('NotificationEventHandlerSettings', 'RepositoryDirectories');
$extensionDirectories = $notificationINI->variable('NotificationEventHandlerSettings', 'ExtensionDirectories');
foreach ($extensionDirectories as $extensionDirectory) {
$extensionPath = "{$baseDirectory}/{$extensionDirectory}/notification/handler/";
if (file_exists($extensionPath)) {
$repositoryDirectories[] = $extensionPath;
}
}
foreach ($repositoryDirectories as $repositoryDirectory) {
$repositoryDirectory = trim($repositoryDirectory, '/');
$includeFile = "{$repositoryDirectory}/{$handlerString}/{$handlerString}handler.php";
if (file_exists($includeFile)) {
$foundHandler = true;
break;
}
}
if (!$foundHandler) {
eZDebug::writeError("Notification handler does not exist: {$handlerString}", __METHOD__);
return false;
}
include_once $includeFile;
$className = $handlerString . "handler";
return new $className();
}
示例11: instance
/**
* Returns a new instance of the eZUser class pr $protocol.
*
* @param string $protocol If not set to 'standard' (default), then the code will look
* for handler first in kernel/classes/datatypes/ezuser/, then according to
* site.ini[UserSettings]ExtensionDirectory settings
* @return eZUser
*/
static function instance($protocol = "standard")
{
$triedFiles = array();
if ($protocol == "standard") {
$impl = new eZUser(0);
return $impl;
} else {
$ezuserFile = 'kernel/classes/datatypes/ezuser/ez' . strtolower($protocol) . 'user.php';
$triedFiles[] = $ezuserFile;
if (file_exists($ezuserFile)) {
include_once $ezuserFile;
$className = 'eZ' . $protocol . 'User';
$impl = new $className();
return $impl;
} else {
$ini = eZINI::instance();
$extensionDirectories = $ini->variable('UserSettings', 'ExtensionDirectory');
$directoryList = eZExtension::expandedPathList($extensionDirectories, 'login_handler');
foreach ($directoryList as $directory) {
$userFile = $directory . '/ez' . strtolower($protocol) . 'user.php';
$triedFiles[] = $userFile;
if (file_exists($userFile)) {
include_once $userFile;
$className = 'eZ' . $protocol . 'User';
$impl = new $className();
return $impl;
}
}
}
}
// if no one appropriate instance was found
eZDebug::writeWarning("Unable to find user login handler '{$protocol}', searched for these files: " . implode(', ', $triedFiles), __METHOD__);
$impl = null;
return $impl;
}
示例12: 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;
}
示例13: get
function get($oid)
{
$oidroot = $this->oidRoot();
$oidroot = $oidroot[0];
switch (preg_replace('/\\.0$/', '', $oid)) {
case $oidroot . '1.1':
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/ping", false);
if (stripos($data, '<str name="status">OK</str>') !== false) {
$status = 1;
} else {
$status = 0;
}
} else {
$status = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
case $oidroot . '1.2':
if (in_array('ezfind', eZExtension::activeExtensions())) {
$ini = eZINI::instance('solr.ini');
$data = eZHTTPTool::getDataByURL($ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp", false);
if (preg_match('#<stat +name="numDocs" +>[ \\t\\r\\n]*(\\d+)[ \\t\\r\\n]*</stat>#', $data, $status)) {
$status = $status[1];
} else {
$status = -2;
}
} else {
$status = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $status);
}
return self::NO_SUCH_OID;
}
示例14: __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;
}
示例15: 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();
}