本文整理汇总了PHP中eZModule类的典型用法代码示例。如果您正苦于以下问题:PHP eZModule类的具体用法?PHP eZModule怎么用?PHP eZModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDefinition
/**
* Loads the operations definition for the current module
* @return bool true if the operations were loaded, false if an error occured
*/
function loadDefinition()
{
$pathList = eZModule::globalPathList();
foreach ( $pathList as $path )
{
$definitionFile = $path . '/' . $this->ModuleName . '/operation_definition.php';
if ( file_exists( $definitionFile ) )
break;
$definitionFile = null;
}
if ( $definitionFile === null )
{
eZDebug::writeError( 'Missing operation definition file for module: ' . $this->ModuleName, __METHOD__ );
return false;
}
unset( $OperationList );
include( $definitionFile );
if ( !isset( $OperationList ) )
{
eZDebug::writeError( 'Missing operation definition list for module: ' . $this->ModuleName, __METHOD__ );
return false;
}
$this->OperationList = $OperationList;
$this->IsValid = true;
return true;
}
示例2: loadDefinition
function loadDefinition()
{
$definitionFile = null;
$pathList = eZModule::globalPathList();
if ($pathList) {
foreach ($pathList as $path) {
$definitionFile = $path . '/' . $this->ModuleName . '/function_definition.php';
if (file_exists($definitionFile)) {
break;
}
$definitionFile = null;
}
}
if ($definitionFile === null) {
eZDebug::writeError('Missing function definition file for module: ' . $this->ModuleName, 'eZModuleFunctionInfo::loadDefinition');
return false;
}
unset($FunctionList);
include $definitionFile;
if (!isset($FunctionList)) {
eZDebug::writeError('Missing function definition list for module: ' . $this->ModuleName, 'eZModuleFunctionInfo::loadDefinition');
return false;
}
$this->FunctionList = $FunctionList;
$this->IsValid = true;
return true;
}
示例3: redirect
/**
* Trasforma le variabili $_GET in view_parameters e redirige la richiesta in base al parametro $_GET['RedirectUrlAlias']
*
* @see modules/ocsearch/action.php
* @param array $requestFields
* @param eZModule $module
*/
public static function redirect(array $requestFields, eZModule $module = null)
{
$result = new OCClassSearchFormFetcher();
$result->setRequestFields($requestFields);
if ($module) {
$redirect = '/';
if (isset($requestFields['RedirectUrlAlias'])) {
$redirect = $requestFields['RedirectUrlAlias'];
} elseif (isset($requestFields['RedirectNodeID'])) {
$node = eZContentObjectTreeNode::fetch($requestFields['RedirectNodeID']);
if ($node instanceof eZContentObjectTreeNode) {
$redirect = $node->attribute('url_alias');
}
}
$redirect = rtrim($redirect, '/') . $result->getViewParametersString();
$module->redirectTo($redirect);
}
}
示例4: modify
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{
$uri = new eZURI( $namedParameters[ 'uri' ] );
$moduleName = $uri->element( 0 );
$moduleList = eZINI::instance( 'module.ini' )->variable( 'ModuleSettings', 'ModuleList' );
if ( in_array( $moduleName, $moduleList, true ) )
$check = eZModule::accessAllowed( $uri );
$operatorValue = isset( $check['result'] ) ? $check['result'] : false;
}
示例5: getModuleList
/**
* Finds all available modules in the system
* @return array $modulename => $path
*/
static function getModuleList()
{
$out = array();
foreach (eZModule::globalPathList() as $path) {
foreach (scandir($path) as $subpath) {
if ($subpath != '.' && $subpath != '..' && is_dir($path . '/' . $subpath) && file_exists($path . '/' . $subpath . '/module.php')) {
$out[$subpath] = $path . '/' . $subpath . '/module.php';
}
}
}
return $out;
}
示例6: array
/**
* List all existing operations (optionally, in a given module)
* @author G. Giunta
* @copyright (C) G. Giunta 2010-2016
* @license Licensed under GNU General Public License v2.0. See file license.txt
*
*/
// generic info for all views: module name, extension name, ...
$operationList = array();
$modules = eZModuleLister::getModuleList();
if ($Params['modulename'] != '' && !array_key_exists($Params['modulename'], $modules)) {
/// @todo
} else {
foreach ($modules as $modulename => $path) {
if ($Params['modulename'] == '' || $Params['modulename'] == $modulename) {
$module = eZModule::exists($modulename);
if ($module instanceof eZModule) {
$moduleOperationInfo = new eZModuleOperationInfo($modulename);
/// @todo prevent warning to be generated here
$moduleOperationInfo->loadDefinition();
if ($moduleOperationInfo->isValid()) {
$extension = '';
if (preg_match('#extension/([^/]+)/modules/#', $path, $matches)) {
$extension = $matches[1];
}
foreach ($moduleOperationInfo->OperationList as $op) {
$operationList[$op['name'] . '_' . $modulename] = $op;
$operationList[$op['name'] . '_' . $modulename]['module'] = $modulename;
$operationList[$op['name'] . '_' . $modulename]['extension'] = $extension;
}
}
示例7: array
if ( isset( $rerunURLList[$errorNumber] ) )
$errorRerunURL = $rerunURLList[$errorNumber];
$Result = array();
$Result['content'] = false;
$Result['rerun_uri'] = $errorRerunURL;
$module->setExitStatus( eZModule::STATUS_RERUN );
return $Result;
}
else if ( $errorHandlerType == 'embed' )
{
$errorEmbedURL = $errorINI->variable( 'ErrorSettings', 'DefaultEmbedURL' );
if ( isset( $embedURLList[$errorNumber] ) )
$errorEmbedURL = $embedURLList[$errorNumber];
$uri = new eZURI( $errorEmbedURL );
$moduleName = $uri->element();
$embedModule = eZModule::exists( $moduleName );
if ( $module instanceof eZModule )
{
$uri->increase();
$viewName = false;
if ( !$embedModule->singleFunction() )
{
$viewName = $uri->element();
$uri->increase();
}
$embedParameters = $uri->elements( false );
$embedResult = $embedModule->run( $viewName, $embedParameters );
$embedContent = $embedResult['content'];
}
// write reason to debug
示例8: array
}
$db->commit();
}
}
$tpl = eZTemplate::factory();
$triggers = eZTrigger::fetchList(array('module' => $moduleName, 'function' => $functionName));
$showModuleList = false;
$showFunctionList = false;
$functionList = array();
$moduleList = array();
if ($moduleName == '*') {
$showModuleList = true;
$ini = eZINI::instance('module.ini');
$moduleList = $ini->variable('ModuleSettings', 'ModuleList');
} elseif ($functionName == '*') {
$mod = eZModule::exists($moduleName);
$functionList = array_keys($mod->attribute('available_functions'));
eZDebug::writeNotice($functionList, "functions");
$showFunctionList = true;
}
$tpl->setVariable('current_module', $moduleName);
$tpl->setVariable('current_function', $functionName);
$tpl->setVariable('show_functions', $showFunctionList);
$tpl->setVariable('show_modules', $showModuleList);
$tpl->setVariable('possible_triggers', $possibleTriggers);
$tpl->setVariable('modules', $moduleList);
$tpl->setVariable('functions', $functionList);
$tpl->setVariable('triggers', $triggers);
$tpl->setVariable('module', $Module);
$Result['content'] = $tpl->fetch('design:trigger/list.tpl');
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/trigger', 'Trigger'), 'url' => false), array('text' => ezpI18n::tr('kernel/trigger', 'List'), 'url' => false));
示例9: exitWithInternalError
}
$GLOBALS['eZCurrentAccess'] = $access;
// Check for new extension loaded by siteaccess
eZExtension::activateExtensions('access');
$db = eZDB::instance();
if ($db->isConnected()) {
eZSession::start();
} else {
exitWithInternalError();
return;
}
$moduleINI = eZINI::instance('module.ini');
$globalModuleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories');
$globalModuleRepositories[] = 'extension/eztags/modules';
eZModule::setGlobalPathList($globalModuleRepositories);
$module = eZModule::exists('tags');
if (!$module) {
exitWithInternalError();
return;
}
$function_name = 'treemenu';
$uri->increase();
$uri->increase();
$currentUser = eZUser::currentUser();
$siteAccessResult = $currentUser->hasAccessTo('user', 'login');
$tagsReadResult = $currentUser->hasAccessTo('tags', 'read');
$hasAccessToSite = false;
if ($siteAccessResult['accessWord'] == 'limited') {
$policyChecked = false;
foreach ($siteAccessResult['policies'] as $policy) {
if (isset($policy['SiteAccess'])) {
示例10:
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.11.1
* @package kernel
*/
// Redirect to visual module which is the correct place for this functionality
$module = $Params['Module'];
$parameters = $Params["Parameters"];
$visualModule = eZModule::exists('visual');
if ($visualModule) {
return $module->forward($visualModule, 'templatecreate', $parameters);
}
示例11: urlToAction
public static function urlToAction($url)
{
if (preg_match("#^content/view/full/([0-9]+)\$#", $url, $matches)) {
return "eznode:" . $matches[1];
}
if (preg_match("#^([a-zA-Z0-9]+)/#", $url, $matches)) {
$name = $matches[1];
$module = eZModule::exists($name);
if ($module !== null) {
return 'module:' . $url;
}
}
return false;
}
示例12: setUseExceptions
/**
* Sets whether to use exceptions inside the kernel.
*
* @param bool $useExceptions
*/
public function setUseExceptions($useExceptions)
{
eZModule::$useExceptions = (bool) $useExceptions;
}
示例13: allValuesAsArrayWithNames
function allValuesAsArrayWithNames()
{
$returnValue = null;
$valueList = $this->attribute('values_as_array');
$names = array();
$policy = $this->attribute('policy');
if (!$policy) {
return $returnValue;
}
$currentModule = $policy->attribute('module_name');
$mod = eZModule::exists($currentModule);
if (!is_object($mod)) {
eZDebug::writeError('Failed to fetch instance for module ' . $currentModule);
return $returnValue;
}
$functions = $mod->attribute('available_functions');
$functionNames = array_keys($functions);
$currentFunction = $policy->attribute('function_name');
$limitationValueArray = array();
$limitation = $functions[$currentFunction][$this->attribute('identifier')];
if ($limitation && isset($limitation['class']) && count($limitation['values'] == 0)) {
$obj = new $limitation['class'](array());
$limitationValueList = call_user_func_array(array($obj, $limitation['function']), $limitation['parameter']);
foreach ($limitationValueList as $limitationValue) {
$limitationValuePair = array();
$limitationValuePair['Name'] = $limitationValue['name'];
$limitationValuePair['value'] = $limitationValue['id'];
$limitationValueArray[] = $limitationValuePair;
}
} else {
if ($limitation['name'] === 'Node') {
foreach ($valueList as $value) {
$node = eZContentObjectTreeNode::fetch($value, false, false);
if ($node == null) {
continue;
}
$limitationValuePair = array();
$limitationValuePair['Name'] = $node['name'];
$limitationValuePair['value'] = $value;
$limitationValuePair['node_data'] = $node;
$limitationValueArray[] = $limitationValuePair;
}
} else {
if ($limitation['name'] === 'Subtree') {
foreach ($valueList as $value) {
$subtreeObject = eZContentObjectTreeNode::fetchByPath($value, false);
if ($subtreeObject != null) {
$limitationValuePair = array();
$limitationValuePair['Name'] = $subtreeObject['name'];
$limitationValuePair['value'] = $value;
$limitationValuePair['node_data'] = $subtreeObject;
$limitationValueArray[] = $limitationValuePair;
}
}
} else {
$limitationValueArray = $limitation['values'];
}
}
}
$limitationValuesWithNames = array();
foreach (array_keys($valueList) as $key) {
$value = $valueList[$key];
if (isset($limitationValueArray)) {
reset($limitationValueArray);
foreach (array_keys($limitationValueArray) as $ckey) {
if ($value == $limitationValueArray[$ckey]['value']) {
$limitationValuesWithNames[] = $limitationValueArray[$ckey];
}
}
}
}
return $limitationValuesWithNames;
}
示例14: contentViewGenerateError
/**
* @param eZModule $Module
* @param int $error
* @param bool $store
* @param array $errorParameters
*
* @return array
*/
protected static function contentViewGenerateError(eZModule $Module, $error, $store = true, array $errorParameters = array())
{
$content = $Module->handleError($error, 'kernel', $errorParameters);
return array('content' => $content, 'scope' => 'viewcache', 'store' => $store, 'binarydata' => serialize($content));
}
示例15: accessAllowed
/**
* Checks if access is allowed to a module/view based on site.ini[SiteAccessRules]Rules settings
*
* @see eZModule::accessAllowed()
* @param eZURI $uri
* @return array An associative array with:
* 'result' => bool Indicates if access is allowed
* 'module' => string Module name
* 'view' => string View name
* 'view_checked' => bool Indicates if view access has been checked
*/
function accessAllowed(eZURI $uri)
{
return eZModule::accessAllowed($uri);
}