本文整理汇总了PHP中eZExtension::activeExtensions方法的典型用法代码示例。如果您正苦于以下问题:PHP eZExtension::activeExtensions方法的具体用法?PHP eZExtension::activeExtensions怎么用?PHP eZExtension::activeExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZExtension
的用法示例。
在下文中一共展示了eZExtension::activeExtensions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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() );
}
示例4: operator
/**
Executes the needed operator(s).
Checks operator names, and calls the appropriate functions.
*/
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
case 'eZDebug':
$operatorValue = $this->eZdebug($operatorValue, $namedParameters['debuglvl'], $namedParameters['label']);
break;
case 'objDebug':
$operatorValue = $this->objdebug($operatorValue, $namedParameters['show_values'] == 'show', $namedParameters['level']);
break;
case 'objInspect':
require_once 'kernel/common/template.php';
$tpl = templateInit();
$tpl->setVariable('counter', self::$inspectcounter);
$exts = eZExtension::activeExtensions();
$wstransport = '';
if (in_array('ezjscore', $exts)) {
$wstransport = 'ezjscore';
} else {
if (in_array('ggwebservices', $exts)) {
$wstransport = 'ggwebservices';
}
}
$tpl->setVariable('transport', $wstransport);
if (class_exists('ezPOInspector')) {
$tpl->setVariable('value', json_encode(ezPOInspector::objInspect($operatorValue)));
$tpl->setVariable('error', false);
} else {
$tpl->setVariable('value', null);
$tpl->setVariable('error', "Cannot inspect value: extension ezpersistentobject_inspector most likely missing");
}
$tpl->setVariable('sort_attributes', $namedParameters['sort_attributes']);
$tpl->setVariable('send_to_debug', $namedParameters['send_to_debug']);
$operatorValue = $tpl->fetch('design:ezdebug/objinspect.tpl');
if ($namedParameters['send_to_debug']) {
// send div to debug output via a debug msg
$tpl = templateInit();
$tpl->setVariable('counter', self::$inspectcounter);
eZDebug::writeDebug($tpl->fetch('design:ezdebug/objinspectdebugoutput.tpl'), 'objInspect ' . self::$inspectcounter);
}
self::$inspectcounter++;
break;
case 'addTimingPoint':
eZDebug::addTimingPoint($namedParameters['label']);
$operatorValue = '';
break;
case 'numQueries':
$operatorValue = $this->numqueries($namedParameters['cluster']);
break;
case 'getDefinedVars':
$operatorValue = $this->getDefinedVars($tpl, $namedParameters['namespace'], $rootNamespace, $currentNamespace);
break;
}
}
示例5: run
/**
* Startup and run script.
*/
public function run()
{
$this->Script->startup();
$this->Options = $this->Script->getOptions("[db-host:][db-user:][db-password:][db-database:][db-type:|db-driver:][sql][clean][clean-all][conc:][php-exec:][commit-within:][class-identifiers:]", "", array('db-host' => "Database host", 'db-user' => "Database user", 'db-password' => "Database password", 'db-database' => "Database name", 'db-driver' => "Database driver", 'db-type' => "Database driver, alias for --db-driver", 'sql' => "Display sql queries", 'clean' => "Remove all search data of the current installation id before beginning indexing", 'clean-all' => "Remove all search data for all installations", 'conc' => 'Parallelization, number of concurent processes to use', 'php-exec' => 'Full path to PHP executable', 'commit-within' => 'Commit to Solr within this time in seconds (default ' . self::DEFAULT_COMMIT_WITHIN . ' seconds)', 'class-identifiers' => 'Index objects belonging to this class/content type only, can be a comma separated list of identifiers or numerical values (no spaces) '));
$this->Script->initialize();
// check if ezfind is enabled and exit if not
if (!in_array('ezfind', eZExtension::activeExtensions())) {
$this->CLI->error('eZ Find extension is not enabled and because of that index process will fail. Please enable it and run this script again.');
$this->Script->shutdown(0);
}
// Fix siteaccess
$siteAccess = $this->Options['siteaccess'] ? $this->Options['siteaccess'] : false;
$this->classIdentifiers = array();
if (isset($this->Options['class-identifiers'])) {
$this->classIdentifiers = preg_split('/,/', $this->Options['class-identifiers']);
}
if ($siteAccess) {
$this->changeSiteAccessSetting($siteAccess);
} else {
$this->CLI->warning('You did not specify a siteaccess. The admin siteaccess is a required option in most cases.');
$input = readline('Are you sure the default siteaccess has all available languages defined? ([y] or [q] to quit )');
if ($input === 'q') {
$this->Script->shutdown(0);
}
}
// Check that Solr server is up and running
if (!$this->checkSolrRunning()) {
$this->Script->shutdown(1);
exit;
}
$this->initializeDB();
// call clean up routines which will deal with the CLI arguments themselves
$this->cleanUp();
$this->cleanUpAll();
if (isset($this->Options['commit-within']) && is_numeric($this->Options['commit-within'])) {
$this->commitWithin = (int) $this->Options['commit-within'];
}
$this->CLI->output('Starting object re-indexing');
// Get PHP executable from user.
$this->getPHPExecutable();
$this->runMain();
}
示例6: findPathToSiteAccess
/**
* Returns path to site access
*
* @param string $siteAccess
* @return string|false Return path to siteacces or false if invalid
*/
static function findPathToSiteAccess($siteAccess)
{
$ini = eZINI::instance();
$siteAccessList = $ini->variable('SiteAccessSettings', 'AvailableSiteAccessList');
if (!in_array($siteAccess, $siteAccessList)) {
return false;
}
$currentPath = 'settings/siteaccess/' . $siteAccess;
if (file_exists($currentPath)) {
return $currentPath;
}
$activeExtensions = eZExtension::activeExtensions();
$baseDir = eZExtension::baseDirectory();
foreach ($activeExtensions as $extension) {
$currentPath = $baseDir . '/' . $extension . '/settings/siteaccess/' . $siteAccess;
if (file_exists($currentPath)) {
return $currentPath;
}
}
return 'settings/siteaccess/' . $siteAccess;
}
示例7: getIniValue
/**
* Tries to load an ini value, including the settings from this extension even when it is not active.
* Note: when not active, the settings of this extensions are loaded with lower precedence compared to same settings
* from other extensions.
*
* @param string $fileName
* @param string $blockName
* @param string $varName
* @param int $type
* @return array|mixed|null
*/
static function getIniValue($fileName, $blockName, $varName, $type = self::TYPE_SCALAR)
{
if ($type == self::TYPE_SCALAR) {
$value = null;
} else {
$value = array();
}
$ini = eZINI::instance($fileName);
if (in_array('ggsysinfo', eZExtension::activeExtensions())) {
return $ini->hasVariable($blockName, $varName) ? $ini->variable($blockName, $varName) : $value;
} else {
// load still what possible values are added from other extensions
$value = $ini->hasVariable($blockName, $varName) ? $ini->variable($blockName, $varName) : $value;
$ini = eZINI::fetchFromFile(__DIR__ . '/../settings/sysinfo.ini');
if ($type == self::TYPE_SCALAR) {
return array_merge($value, $ini->variable($blockName, $varName));
} else {
if ($value !== null) {
return $value;
}
return $ini->variable($blockName, $varName);
}
}
}
示例8: foreach
$script->initialize();
$dataTypeName = $options['datatype'];
if ($dataTypeName === null) {
$cli->output("Error: The option --datatype is required. Add --help for more information.");
}
$allowedDatatypes = eZDataType::allowedTypes();
if ($dataTypeName !== null and in_array($dataTypeName, $allowedDatatypes)) {
// Inserting data from the dba-data files of the datatypes
eZDataType::loadAndRegisterAllTypes();
$registeredDataTypes = eZDataType::registeredDataTypes();
if (isset($registeredDataTypes[$dataTypeName])) {
$dataType = $registeredDataTypes[$dataTypeName];
if ($dataType->importDBDataFromDBAFile()) {
$cli->output("The database is updated for the datatype: " . $cli->style('emphasize') . $dataType->DataTypeString . $cli->style('emphasize-end') . "\n" . 'dba-data is imported from the file: ' . $cli->style('emphasize') . $dataType->getDBAFilePath() . $cli->style('emphasize-end'));
} else {
$activeExtensions = eZExtension::activeExtensions();
$errorString = "Failed importing datatype related data into database: \n" . ' datatype - ' . $dataType->DataTypeString . ", \n" . ' checked dba-data file - ' . $dataType->getDBAFilePath(false);
foreach ($activeExtensions as $activeExtension) {
$fileName = eZExtension::baseDirectory() . '/' . $activeExtension . '/datatypes/' . $dataType->DataTypeString . '/' . $dataType->getDBAFileName();
$errorString .= "\n" . str_repeat(' ', 23) . ' - ' . $fileName;
if (file_exists($fileName)) {
$errorString .= " (found, but not successfully imported)";
}
}
$cli->error($errorString);
}
} else {
$cli->error("Error: The datatype " . $dataTypeName . " does not exist.");
}
} else {
$cli->error("Error: The datatype " . $dataTypeName . " is not registered.");
示例9: activeModuleRepositories
/**
* Returns the list of active module repositories, as defined in module.ini
*
* @param boolean $useExtensions
* If true, module.ini files in extensions will be scanned as well.
* If false, only the module.ini overrides in settings will be.
*
* @return array a path list of currently active modules
*/
static function activeModuleRepositories($useExtensions = true)
{
$moduleINI = eZINI::instance('module.ini');
$moduleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories');
if ($useExtensions) {
$extensionRepositories = $moduleINI->variable('ModuleSettings', 'ExtensionRepositories');
$extensionDirectory = eZExtension::baseDirectory();
$activeExtensions = eZExtension::activeExtensions();
$globalExtensionRepositories = array();
foreach ($extensionRepositories as $extensionRepository) {
$extPath = $extensionDirectory . '/' . $extensionRepository;
$modulePath = $extPath . '/modules';
if (!in_array($extensionRepository, $activeExtensions)) {
eZDebug::writeWarning("Extension '{$extensionRepository}' was reported to have modules but has not yet been activated.\n" . "Check the setting ModuleSettings/ExtensionRepositories in module.ini for your extensions\n" . "or make sure it is activated in the setting ExtensionSettings/ActiveExtensions in site.ini.");
} else {
if (file_exists($modulePath)) {
$globalExtensionRepositories[] = $modulePath;
} else {
if (!file_exists($extPath)) {
eZDebug::writeWarning("Extension '{$extensionRepository}' was reported to have modules but the extension itself does not exist.\n" . "Check the setting ModuleSettings/ExtensionRepositories in module.ini for your extensions.\n" . "You should probably remove this extension from the list.");
} else {
eZDebug::writeWarning("Extension '{$extensionRepository}' does not have the subdirectory 'modules' allthough it reported it had modules.\n" . "Looked for directory '" . $modulePath . "'\n" . "Check the setting ModuleSettings/ExtensionRepositories in module.ini for your extension.");
}
}
}
}
$moduleRepositories = array_merge($moduleRepositories, $globalExtensionRepositories);
}
return $moduleRepositories;
}
示例10: findHandler
function findHandler(&$result, $mimeInfo)
{
// Check for specific mime handler plugin
$uploadINI = eZINI::instance('upload.ini');
$uploadSettings = $uploadINI->variable('CreateSettings', 'MimeUploadHandlerMap');
$mime = $mimeInfo['name'];
$elements = explode('/', $mime);
$mimeGroup = $elements[0];
$handlerName = false;
// Check first for MIME-Type group, this allows a handler to work
// with an entire group, e.g. image
if (isset($uploadSettings[$mimeGroup])) {
$handlerName = $uploadSettings[$mimeGroup];
} else {
if (isset($uploadSettings[$mime])) {
$handlerName = $uploadSettings[$mime];
}
}
if ($handlerName !== false) {
$baseDirectory = eZExtension::baseDirectory();
$extensionDirectories = eZExtension::activeExtensions();
// Check all extension directories for an upload handler for this mimetype
foreach ($extensionDirectories as $extensionDirectory) {
$handlerPath = $baseDirectory . '/' . $extensionDirectory . '/uploadhandlers/' . $handlerName . ".php";
if (!file_exists($handlerPath)) {
continue;
}
include_once $handlerPath;
$handlerClass = $handlerName;
$handler = new $handlerClass();
if (!$handler instanceof eZContentUploadHandler) {
eZDebug::writeError("Content upload handler '{$handlerName}' is not inherited from eZContentUploadHandler. All upload handlers must do this.", __METHOD__);
return false;
}
return $handler;
}
$result['errors'][] = array('description' => ezpI18n::tr('kernel/content/upload', "Could not find content upload handler '%handler_name'", null, array('%handler_name' => $handlerName)));
return false;
}
return true;
}
示例11: testCycleInvolvesNoReordering2
public function testCycleInvolvesNoReordering2()
{
self::setExtensions(array('cycle2', 'cycle1'));
$this->assertSame(array('cycle2', 'cycle1'), eZExtension::activeExtensions());
}
示例12: ezgeshiAvailable
static function ezgeshiAvailable()
{
if (in_array('ezsh', eZExtension::activeExtensions())) {
$info = eZExtension::extensionInfo('ezsh');
// since ezp 4.4, we have a lowercase version info
return version_compare(@$info['Version'], '1.3') >= 0 || version_compare(@$info['version'], '1.3') >= 0;
}
return false;
}
示例13: handleEZXFormToken
/**
*
* Handles casese where the token is reset during a request.
*
* @param bool $restore
*
* @return bool
*
*/
public static function handleEZXFormToken($restore = false)
{
$activeExtensions = \eZExtension::activeExtensions();
if (in_array('ezformtoken', $activeExtensions)) {
if ($restore) {
if (isset(self::$ezxFormToken) && !empty(self::$ezxFormToken)) {
\eZSession::set(\ezxFormToken::SESSION_KEY, self::$ezxFormToken);
}
} else {
self::$ezxFormToken = \eZSession::get(\ezxFormToken::SESSION_KEY);
}
return self::$ezxFormToken;
}
return false;
}
示例14: checkSiteaccess
function checkSiteaccess($siteAccess, $bailOutOnError = false)
{
$extensionBaseDir = eZExtension::baseDirectory();
$extensionNameArray = eZExtension::activeExtensions();
$siteAccessSettingsDir = '/settings/siteaccess/';
$siteAccessExists = false;
if (file_exists('settings/siteaccess/' . $siteAccess)) {
$siteAccessExists = true;
} else {
// Not found, check if it exists in extensions
foreach ($extensionNameArray as $extensionName) {
$extensionSiteaccessPath = $extensionBaseDir . '/' . $extensionName . $siteAccessSettingsDir . $siteAccess;
if (file_exists($extensionSiteaccessPath)) {
$siteAccessExists = true;
break;
}
}
}
if (!$siteAccessExists && $bailOutOnError) {
showError("Siteaccess '" . $siteAccess . "' does not exist. Exiting...");
}
return $siteAccessExists;
}
示例15: prependExtensionSiteAccesses
/**
* Prepend extension siteaccesses
*
* @param string|false $accessName Optional access name, will use global if false
* @param eZINI|false|null $ini
* @param true $globalDir
* @param string|false|null See {@link eZExtension::prependSiteAccess()}
* @param bool $order Prepend extensions in reverse order by setting this to false
*/
static function prependExtensionSiteAccesses( $accessName = false, $ini = false, $globalDir = true, $identifier = null, $order = true )
{
$extensionList = eZExtension::activeExtensions( 'default' );
if ( !$order )
{
$extensionList = array_reverse( $extensionList );
}
foreach( $extensionList as $extension )
{
self::prependSiteAccess( $extension, $accessName, $ini, $globalDir, $identifier );
}
}