本文整理汇总了PHP中eZModule::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP eZModule::exists方法的具体用法?PHP eZModule::exists怎么用?PHP eZModule::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZModule
的用法示例。
在下文中一共展示了eZModule::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exitWithInternalError
$db = eZDB::instance();
if ( $db->isConnected() )
{
eZSession::start();
}
else
{
exitWithInternalError();
return;
}
$moduleINI = eZINI::instance( 'module.ini' );
$globalModuleRepositories = $moduleINI->variable( 'ModuleSettings', 'ModuleRepositories' );
eZModule::setGlobalPathList( $globalModuleRepositories );
$module = eZModule::exists( 'content' );
if ( !$module )
{
exitWithInternalError();
return;
}
$function_name = 'treemenu';
$uri->increase();
$uri->increase();
$currentUser = eZUser::currentUser();
$siteAccessResult = $currentUser->hasAccessTo( 'user', 'login' );
$hasAccessToSite = false;
if ( $siteAccessResult[ 'accessWord' ] == 'limited' )
{
示例2: 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;
}
示例3: 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));
示例4:
<?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);
}
示例5: array
} else {
$operationResult = eZContentOperationCollection::removeFeedForNode($nodeID);
}
}
if (!isset($operationResult['status']) || !$operationResult['status']) {
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
return $module->redirectToView('view', array('full', $nodeID));
} else {
// Check if there are any custom actions to handle
$customActions = eZINI::instance('datatype.ini')->variable('ViewSettings', 'CustomActionMap');
foreach ($customActions as $customActionName => $customActionUrl) {
if ($http->hasPostVariable($customActionName)) {
if (strpos($customActionUrl, '/') !== false) {
list($customActionModuleName, $customActionViewName) = explode('/', $customActionUrl);
$customActionModule = eZModule::exists($customActionModuleName);
if (!$customActionModule instanceof eZModule) {
eZDebug::writeError("Could not load custom action module for: {$customActionUrl}", "kernel/content/action.php");
}
$result = $customActionModule->run($customActionViewName, array());
if (isset($result['content']) && $result['content']) {
return $result;
} else {
$module->setExitStatus($customActionModule->exitStatus());
$module->setRedirectURI($customActionModule->redirectURI());
return $result;
}
} else {
return $module->run($customActionUrl);
}
}
示例6: array
$tpl->setVariable('current_module', $currentModule);
$tpl->setVariable('functions', $functionNames);
$tpl->setVariable('no_functions', false);
$Result = array();
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Create new policy, step two: select function')));
$Result['content'] = $tpl->fetch('design:role/createpolicystep2.tpl');
return;
}
if ($http->hasPostVariable('CreatePolicy') || $http->hasPostVariable('Step1')) {
// Set flag for audit. If true audit will be processed
$http->setSessionVariable('RoleWasChanged', true);
$Module->setTitle('Edit ' . $role->attribute('name'));
$tpl->setVariable('modules', $modules);
$moduleList = array();
foreach ($modules as $module) {
$moduleList[] = eZModule::exists($module);
}
$tpl->setVariable('module_list', $moduleList);
$tpl->setVariable('role', $role);
$tpl->setVariable('module', $Module);
$Result = array();
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Create new policy, step one: select module')));
$Result['content'] = $tpl->fetch('design:role/createpolicystep1.tpl');
return;
}
// Set flag for audit. If true audit will be processed
// Cancel button was pressed
if ($http->hasPostVariable('CancelPolicyButton')) {
$http->setSessionVariable('RoleWasChanged', false);
}
$policies = $role->attribute('policies');
示例7: array
$currentModule = $policy->attribute( 'module_name' );
$currentFunction = $policy->attribute( 'function_name' );
$roleID = $policy->attribute( 'role_id' );
$role = eZRole::fetch( $roleID );
$roleName = $role->attribute( 'name' );
$limitationValueList = $policy->limitationList();
$nodeList = array();
$subtreeList = array();
if ( $currentModule == '*' )
{
$functions = array();
}
else
{
$mod = eZModule::exists( $currentModule );
$functions = $mod->attribute( 'available_functions' );
}
$currentFunctionLimitations = array();
if ( isset( $functions[$currentFunction] ) && $functions[$currentFunction] )
{
foreach ( $functions[$currentFunction] as $key => $limitation )
{
if ( ( count( $limitation['values'] ) == 0 ) && array_key_exists( 'class', $limitation ) )
{
$obj = new $limitation['class']( array() );
$limitationValueList = call_user_func_array( array( $obj, $limitation['function'] ), $limitation['parameter'] );
$limitationValueArray = array();
foreach ( $limitationValueList as $limitationValue )
{
$limitationValuePair = array();
示例8: 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
示例9: dispatchLoop
//.........这里部分代码省略.........
eZDebugSetting::writeDebug('kernel-siteaccess', $policy['SiteAccess'], $crc32AccessName);
if (in_array($crc32AccessName, $policy['SiteAccess'])) {
$hasAccessToSite = true;
break;
}
}
if ($hasAccessToSite) {
break;
}
}
if (!$policyChecked) {
$hasAccessToSite = true;
}
} else {
if ($siteAccessResult['accessWord'] === 'yes') {
eZDebugSetting::writeDebug('kernel-siteaccess', "access is yes");
$hasAccessToSite = true;
} else {
if ($siteAccessResult['accessWord'] === 'no') {
$accessList = $siteAccessResult['accessList'];
}
}
}
if ($hasAccessToSite) {
$accessParams = array();
$moduleAccessAllowed = $currentUser->hasAccessToView($this->module, $functionName, $accessParams);
if (isset($accessParams['accessList'])) {
$accessList = $accessParams['accessList'];
}
} else {
eZDebugSetting::writeDebug('kernel-siteaccess', $this->access, 'not able to get access to siteaccess');
$moduleAccessAllowed = false;
if ($ini->variable("SiteAccessSettings", "RequireUserLogin") == "true") {
$this->module = eZModule::exists('user');
if ($this->module instanceof eZModule) {
$moduleResult = $this->module->run('login', array(), array('SiteAccessAllowed' => false, 'SiteAccessName' => $this->access['name']));
$runModuleView = false;
}
}
}
}
$GLOBALS['eZRequestedModule'] = $this->module;
if ($runModuleView) {
if ($objectHasMovedError == true) {
$moduleResult = $this->module->handleError(eZError::KERNEL_MOVED, 'kernel', array('new_location' => $objectHasMovedURI));
} else {
if (!$moduleAccessAllowed) {
if (isset($availableViewsInModule[$functionName]['default_navigation_part'])) {
$defaultNavigationPart = $availableViewsInModule[$functionName]['default_navigation_part'];
}
if (isset($accessList)) {
$moduleResult = $this->module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array('AccessList' => $accessList));
} else {
$moduleResult = $this->module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
if (isset($defaultNavigationPart)) {
$moduleResult['navigation_part'] = $defaultNavigationPart;
unset($defaultNavigationPart);
}
} else {
if (!isset($userParameters)) {
$userParameters = false;
}
// Check if we should switch access mode (http/https) for this module view.
eZSSLZone::checkModuleView($this->module->attribute('name'), $functionName);
$moduleResult = $this->module->run($functionName, $params, false, $userParameters);
示例10: fetchModule
function fetchModule($uri, $check, &$module, &$module_name, &$function_name, &$params)
{
$module_name = $uri->element();
if ($check !== null and isset($check["module"])) {
$module_name = $check["module"];
}
// Try to fetch the module object
$module = eZModule::exists($module_name);
if (!$module instanceof eZModule) {
return false;
}
$uri->increase();
$function_name = "";
if (!$module->singleFunction()) {
$function_name = $uri->element();
$uri->increase();
}
// Override it if required
if ($check !== null and isset($check["function"])) {
$function_name = $check["function"];
}
$params = $uri->elements(false);
return true;
}
示例11: redirectionURI
/**
* Creates the redirection URI for a given module, view & parameters.
* Unlike redirectionURIForModule(), the $module parameter is the module name
*
* @param string $moduleName Redirection module name
* @param string $viewName Redirection view name
* @param array $parameters View parameters
* @param array $unorderedParameters Unordered parameters
* @param array $userParameters User parameters
* @param string $anchor Redirection URI anchor
*
* @return string|boolean The redirection URI, or false if the module isn't found
*
* @see redirect(), redirectionURIForModule(), redirectToView(), redirectModule()
*/
function redirectionURI($moduleName, $viewName, $parameters = array(), $unorderedParameters = null, $userParameters = false, $anchor = false)
{
$module = eZModule::exists($moduleName);
if ($module) {
return $this->redirectionURIForModule($module, $viewName, $parameters, $unorderedParameters, $userParameters, $anchor);
} else {
eZDebug::writeError('Undefined module: ' . $moduleName, 'eZModule::redirectionURI');
}
return false;
}
示例12: 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;
}
示例13: 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;
}
}
示例14: 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'])) {
示例15: run
/**
* Execution point for controller actions.
* Returns false if not supported
*
* @return ezpKernelResult
*/
public function run()
{
$db = eZDB::instance();
if ($db->isConnected()) {
$this->sessionInit();
} else {
return $this->exitWithInternalError(ezpI18n::tr('kernel/content/treemenu', 'Database is not connected'));
}
$moduleINI = eZINI::instance('module.ini');
$globalModuleRepositories = $moduleINI->variable('ModuleSettings', 'ModuleRepositories');
eZModule::setGlobalPathList($globalModuleRepositories);
$module = eZModule::exists('content');
if (!$module) {
return $this->exitWithInternalError(ezpI18n::tr('kernel/content/treemenu', '"content" module could not be found.'));
}
$function_name = 'treemenu';
$this->uri->increase();
$this->uri->increase();
$currentUser = eZUser::currentUser();
$siteAccessResult = $currentUser->hasAccessTo('user', 'login');
$hasAccessToSite = false;
if ($siteAccessResult['accessWord'] == 'limited') {
$policyChecked = false;
foreach ($siteAccessResult['policies'] as $policy) {
if (isset($policy['SiteAccess'])) {
$policyChecked = true;
$crc32AccessName = eZSys::ezcrc32($this->access['name']);
if (in_array($crc32AccessName, $policy['SiteAccess'])) {
$hasAccessToSite = true;
break;
}
}
if ($hasAccessToSite) {
break;
}
}
if (!$policyChecked) {
$hasAccessToSite = true;
}
} else {
if ($siteAccessResult['accessWord'] == 'yes') {
$hasAccessToSite = true;
}
}
if (!$hasAccessToSite) {
return $this->exitWithInternalError(ezpI18n::tr('kernel/content/treemenu', 'Insufficient permissions to display the treemenu.'), 403);
}
$GLOBALS['eZRequestedModule'] = $module;
$content = $module->run($function_name, $this->uri->elements(false), false, array('use-cache-headers' => $this->settings['use-cache-headers']));
$attributes = isset($content['lastModified']) ? array('lastModified' => $content['lastModified']) : array();
$this->shutdown();
return new ezpKernelResult($content['content'], $attributes);
}