本文整理汇总了PHP中ModUtil::getInfoFromName方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::getInfoFromName方法的具体用法?PHP ModUtil::getInfoFromName怎么用?PHP ModUtil::getInfoFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModUtil
的用法示例。
在下文中一共展示了ModUtil::getInfoFromName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update module information.
*
* @param array $args All parameters passed to this function.
* numeric $args['id'] The id number of the module to update.
* string $args['displayname'] The new display name of the module.
* string $args['description'] The new description of the module.
*
* @return boolean True on success, false on failure.
*/
public function update($args)
{
// Argument check
if (!isset($args['id']) || !is_numeric($args['id']) || !isset($args['displayname']) || !isset($args['description']) || !isset($args['url'])) {
return LogUtil::registerArgsError();
}
// Security check
if (!SecurityUtil::checkPermission('Extensions::', "::{$args['id']}", ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// check for duplicate display names
// get the module info for the module being updated
$moduleinforeal = ModUtil::getInfo($args['id']);
// validate URL
$moduleinfourl = ModUtil::getInfoFromName($args['url']);
// If the two real module name don't match then the new display name can't be used
if ($moduleinfourl && $moduleinfourl['name'] != $moduleinforeal['name']) {
return LogUtil::registerError($this->__('Error! Could not save the module URL information. A duplicate module URL was detected.'));
}
if (empty($args['url'])) {
return LogUtil::registerError($this->__('Error! Module URL is a required field, please enter a unique name.'));
}
if (empty($args['displayname'])) {
return LogUtil::registerError($this->__('Error! Module URL is a required field, please enter a unique name.'));
}
// Rename operation
$obj = array('id' => $args['id'], 'displayname' => $args['displayname'], 'description' => $args['description'], 'url' => $args['url']);
if (!DBUtil::updateObject($obj, 'modules')) {
return LogUtil::registerError($this->__('Error! Could not save your changes.'));
}
return true;
}
示例2: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategoreymenu()
* @param array $params All attributes passed to this function from the template
* @param object $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
示例3: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategorymenu()
* @param array $params All attributes passed to this function from the template
* @param \Zikula_View $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, \Zikula_View $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('ZikulaAdminModule'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
$path = array('_controller' => 'ZikulaAdminModule:Admin:categorymenu', 'acid' => $acid);
$subRequest = $view->getRequest()->duplicate(array(), null, $path);
return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
示例4: getPathWithBundlePrefix
/**
* Returns the route's path prepended with the bundle prefix.
*
* @param null $container Can be used to set the container for \ServiceUtil in case it is not already set.
*
* @return string
*/
public function getPathWithBundlePrefix($container = null)
{
if (!isset($this->options['zkNoBundlePrefix']) || !$this->options['zkNoBundlePrefix']) {
$bundle = $this->getBundle();
if (!\ServiceUtil::hasContainer()) {
\ServiceUtil::setContainer($container);
}
$modinfo = \ModUtil::getInfoFromName($bundle);
return "/" . $modinfo["url"] . $this->path;
}
return $this->path;
}
示例5: smarty_function_adminonlinemanual
/**
* Smarty function to displaya modules online manual
*
* Admin
* {adminonlinemanual}
*
* @see function.admincategorymenu.php::smarty_function_admincategoreymenu()
* @param array $params All attributes passed to this function from the template
* @param object $smarty Reference to the Smarty object
* @param int xhtml if set, the link to the navtabs.css will be xhtml compliant
* @return string the results of the module function
*/
function smarty_function_adminonlinemanual($params, $smarty)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('adminonlinemanual')), E_USER_DEPRECATED);
$lang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
$modinfo = ModUtil::getInfoFromName(ModUtil::getName());
$modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
$file = DataUtil::formatForOS("{$modpath}/{$modinfo['directory']}/lang/{$lang}/manual.html");
$man_link = '';
if (is_readable($file)) {
PageUtil::addVar('javascript', 'zikula.ui');
$man_link = '<div style="margin-top: 20px; text-align:center">[ <a id="online_manual" href="' . $file . '">' . __('Online manual') . '</a> ]</div>' . "\n";
$man_link .= '<script type="text/javascript">var online_manual = new Zikula.UI.Window($(\'online_manual\'),{resizable: true})</script>' . "\n";
}
return $man_link;
}
示例6: smarty_function_moduleheader
/**
* Smarty function build module header in user content page.
*
* {moduleheader}
*
* Available parameters:
* modname Module name to display header for (optional, defaults to current module)
* type Type for module links (defaults to 'user')
* title Title to display in header (optional, defaults to module name)
* titlelink Link to attach to title (optional, defaults to none)
* setpagetitle If set to true, {pagesetvar} is used to set page title
* insertstatusmsg If set to true, {insert name='getstatusmsg'} is put in front of template
* menufirst If set to true, menu is first, then title
* putimage If set to true, module image is also displayed next to title
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string A formatted string containing navigation for the module admin panel.
*/
function smarty_function_moduleheader($params, $view)
{
if (!isset($params['modname']) || !ModUtil::available($params['modname'])) {
$params['modname'] = ModUtil::getName();
}
if (empty($params['modname'])) {
return false;
}
$type = isset($params['type']) ? $params['type'] : 'user';
$assign = isset($params['assign']) ? $params['assign'] : null;
$menufirst = isset($params['menufirst']) ? $params['menufirst'] : false;
$putimage = isset($params['putimage']) ? $params['putimage'] : false;
$setpagetitle = isset($params['setpagetitle']) ? $params['setpagetitle'] : false;
$insertstatusmsg = isset($params['insertstatusmsg']) ? $params['insertstatusmsg'] : false;
$cutlenght = isset($params['cutlenght']) ? $params['cutlenght'] : 20;
if ($putimage) {
$image = isset($params['image']) ? $params['image'] : ModUtil::getModuleImagePath($params['modname']);
} else {
$image = '';
}
if (!isset($params['title'])) {
$modinfo = ModUtil::getInfoFromName($params['modname']);
if (isset($modinfo['displayname'])) {
$params['title'] = $modinfo['displayname'];
} else {
$params['title'] = ModUtil::getName();
}
}
$titlelink = isset($params['titlelink']) ? $params['titlelink'] : false;
$renderer = Zikula_View::getInstance('Theme');
$renderer->setCaching(Zikula_View::CACHE_DISABLED);
$renderer->assign('userthemename', UserUtil::getTheme());
$renderer->assign('modname', $params['modname']);
$renderer->assign('type', $params['type']);
$renderer->assign('title', $params['title']);
$renderer->assign('titlelink', $titlelink);
$renderer->assign('truncated', mb_strlen($params['title']) > $cutlenght);
$renderer->assign('titletruncated', mb_substr($params['title'], 0, $cutlenght) . '...');
$renderer->assign('setpagetitle', $setpagetitle);
$renderer->assign('insertstatusmsg', $insertstatusmsg);
$renderer->assign('menufirst', $menufirst);
$renderer->assign('image', $image);
if ($assign) {
$view->assign($assign, $renderer->fetch('moduleheader.tpl'));
} else {
return $renderer->fetch('moduleheader.tpl');
}
}
示例7: loadModels
/**
* Aggressively load models.
*
* This helper is required because we are using PEAR naming standards with
* our own autoloading. Doctrine's model loading doesn't take this into
* account in non agressive modes.
*
* In general, this method is NOT required.
*
* @param string $modname Module name to load models for.
*
* @return void
*/
public static function loadModels($modname)
{
$modname = isset($modname) ? strtolower((string) $modname) : '';
$modinfo = ModUtil::getInfoFromName($modname);
$osdir = DataUtil::formatForOS($modinfo['directory']);
$base = $modinfo['type'] == ModUtil::TYPE_MODULE ? 'modules' : 'system';
$dm = Doctrine_Manager::getInstance();
$save = $dm->getAttribute(Doctrine_Core::ATTR_MODEL_LOADING);
$dm->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE);
$path = "{$base}/{$osdir}/lib/{$osdir}/Model";
// prevent exception when model folder does not exist
if (file_exists($path)) {
Doctrine_Core::loadModels(realpath($path));
}
$dm->setAttribute(Doctrine::ATTR_MODEL_LOADING, $save);
}
示例8: handler
/**
* Event handler.
*
* @param Zikula_Event $event Event.
*
* @return void
*/
public function handler(Zikula_Event $event)
{
// subject must be an instance of Theme class.
$theme = $event->getSubject();
if (!$theme instanceof Theme) {
return;
}
// register output filter to add MultiHook environment if requried
if (ModUtil::available('MultiHook')) {
$modinfo = ModUtil::getInfoFromName('MultiHook');
if (version_compare($modinfo['version'], '5.0', '>=') == 1) {
$theme->load_filter('output', 'multihook');
ModUtil::apiFunc('MultiHook', 'theme', 'preparetheme');
}
}
}
示例9: smarty_function_debugenvironment
/**
* Zikula_View function to get all session variables.
*
* This function gets all session vars from the Zikula system assigns the names and
* values to two array. This is being used in pndebug to show them.
*
* Example
* {debugenvironment}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return void
*/
function smarty_function_debugenvironment($params, Zikula_View $view)
{
$view->assign('_ZSession_keys', array_keys($_SESSION));
$view->assign('_ZSession_vals', array_values($_SESSION));
$view->assign('_smartyversion', $view->_version);
$_theme = ModUtil::getInfoFromName('ZikulaThemeModule');
$view->assign('_themeversion', $_theme['version']);
$view->assign('_force_compile', ModUtil::getVar('ZikulaThemeModule', 'force_compile') ? __('On') : __('Off'));
$view->assign('_compile_check', ModUtil::getVar('ZikulaThemeModule', 'compile_check') ? __('On') : __('Off'));
$view->assign('_baseurl', System::getBaseUrl());
$view->assign('_baseuri', System::getBaseUri());
$plugininfo = isset($view->_plugins['function']['zdebug']) ? $view->_plugins['function']['zdebug'] : $view->_plugins['function']['zpopup'];
$view->assign('_template', $plugininfo[1]);
$view->assign('_path', $view->get_template_path($plugininfo[1]));
$view->assign('_line', $plugininfo[2]);
}
示例10: _findpath
/**
* Find the path of the file by searching overrides and the module location.
*
* @param string $file Name of file to find (can include relative path).
* @param string $module Module name.
*
* @return mixed string of path or bool false
*/
public static function _findpath($file, $module = null)
{
// if no module specified, default to calling module
if (empty($module)) {
$module = ModUtil::getName();
}
// Get module info
$modinfo = ModUtil::getInfoFromName($module);
if (!$modinfo) {
return z_exit(__f('%1$s: The specified module [%2$s] does not exist.', array('Zikula_Workflow_Util', $module)));
}
$moduledir = $modinfo['directory'];
// determine which folder to look in (system or modules)
if ($modinfo['type'] == ModUtil::TYPE_SYSTEM) {
// system module
$modulepath = "system/{$moduledir}";
} else {
if ($modinfo['type'] == ModUtil::TYPE_MODULE) {
// non system module
$modulepath = "modules/{$moduledir}";
} else {
return z_exit(__f('%s: Unsupported module type.', 'Zikula_Workflow_Util'));
}
}
// ensure module is active
if (!$modinfo['state'] == 3) {
return z_exit(__f('%1$s: The module [%2$s] is not active.', array('Zikula_Workflow_Util', $module)));
}
$themedir = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
$themepath = DataUtil::formatForOS("themes/{$themedir}/workflows/{$moduledir}/{$file}");
$configpath = DataUtil::formatForOS("config/workflows/{$moduledir}/{$file}");
$modulepath = DataUtil::formatForOS("{$modulepath}/workflows/{$file}");
// find the file in themes or config (for overrides), else module dir
if (is_readable($themepath)) {
return $themepath;
} else {
if (is_readable($configpath)) {
return $configpath;
} else {
if (is_readable($modulepath)) {
return $modulepath;
} else {
return false;
}
}
}
}
示例11: newVersionAvailable
public function newVersionAvailable()
{
$lastNewVersionCheck = \ModUtil::getVar('CmfcmfMediaModule', 'lastNewVersionCheck', 0);
if (time() - 24 * 60 * 60 > $lastNewVersionCheck && $this->versionChecker->checkRateLimit()) {
\ModUtil::setVar('CmfcmfMediaModule', 'lastNewVersionCheck', time());
$info = \ModUtil::getInfoFromName('CmfcmfMediaModule');
if (($release = $this->versionChecker->getReleaseToUpgradeTo($info['version'])) !== false) {
\ModUtil::setVar('CmfcmfMediaModule', 'newVersionAvailable', $release['tag_name']);
return $release['tag_name'];
}
}
$newVersionAvailable = \ModUtil::getVar('CmfcmfMediaModule', 'newVersionAvailable', false);
if ($newVersionAvailable != false) {
return $newVersionAvailable;
}
return false;
}
示例12: generateI18nPatterns
/**
* {@inheritDoc}
*/
public function generateI18nPatterns($routeName, Route $route)
{
$patterns = array();
foreach ($route->getOption('i18n_locales') ?: $this->locales as $locale) {
// Check if translation exists in the translation catalogue to avoid errors being logged by
// the new LoggingTranslator of Symfony 2.6. However, the LoggingTranslator did not implement
// the interface until Symfony 2.6.5, so an extra check is needed.
if ($this->translator instanceof TranslatorBagInterface || $this->translator instanceof LoggingTranslator) {
// Check if route is translated.
if (!$this->translator->getCatalogue($locale)->has($routeName, $this->translationDomain)) {
// No translation found.
$i18nPattern = $route->getPath();
} else {
// Get translation.
$i18nPattern = $this->translator->trans($routeName, array(), $this->translationDomain, $locale);
}
} else {
// if no translation exists, we use the current pattern
if ($routeName === ($i18nPattern = $this->translator->trans($routeName, array(), $this->translationDomain, $locale))) {
$i18nPattern = $route->getPath();
}
}
///////////////////////////////////////
// Begin customizations
// prefix with zikula module url if requested
if ($route->hasDefault('_zkModule')) {
$zkNoBundlePrefix = $route->getOption('zkNoBundlePrefix');
if (!isset($zkNoBundlePrefix) || !$zkNoBundlePrefix) {
$modinfo = \ModUtil::getInfoFromName($route->getDefault('_zkModule'));
$i18nPattern = "/" . $modinfo["url"] . $i18nPattern;
}
}
// End customizations
///////////////////////////////////////
// prefix with locale if requested
if (self::STRATEGY_PREFIX === $this->strategy || self::STRATEGY_PREFIX_EXCEPT_DEFAULT === $this->strategy && $this->defaultLocale !== $locale) {
$i18nPattern = '/' . $locale . $i18nPattern;
if (null !== $route->getOption('i18n_prefix')) {
$i18nPattern = $route->getOption('i18n_prefix') . $i18nPattern;
}
}
$patterns[$i18nPattern][] = $locale;
}
return $patterns;
}
示例13: display
/**
* display block
*/
public function display($blockinfo)
{
// Security check
if (!SecurityUtil::checkPermission('Admin:adminnavblock', "{$blockinfo['title']}::{$blockinfo['bid']}", ACCESS_ADMIN)) {
return;
}
// Get variables from content block
$vars = BlockUtil::varsFromContent($blockinfo['content']);
// Call the modules API to get the items
if (!ModUtil::available('Admin')) {
return;
}
$items = ModUtil::apiFunc('Admin', 'admin', 'getall');
// Check for no items returned
if (empty($items)) {
return;
}
// get admin capable modules
$adminmodules = ModUtil::getAdminMods();
$adminmodulescount = count($adminmodules);
// Display each item, permissions permitting
$admincategories = array();
foreach ($items as $item) {
if (SecurityUtil::checkPermission('Admin::', "{$item['catname']}::{$item['cid']}", ACCESS_READ)) {
$adminlinks = array();
foreach ($adminmodules as $adminmodule) {
// Get all modules in the category
$catid = ModUtil::apiFunc('Admin', 'admin', 'getmodcategory', array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
if ($catid == $item['cid'] || $catid == false && $item['cid'] == $this->getVar('defaultcategory')) {
$modinfo = ModUtil::getInfoFromName($adminmodule['name']);
$menutexturl = ModUtil::url($modinfo['name'], 'admin');
$menutexttitle = $modinfo['displayname'];
$adminlinks[] = array('menutexturl' => $menutexturl, 'menutexttitle' => $menutexttitle);
}
}
$admincategories[] = array('url' => ModUtil::url('Admin', 'admin', 'adminpanel', array('cid' => $item['cid'])), 'title' => DataUtil::formatForDisplay($item['catname']), 'modules' => $adminlinks);
}
}
$this->view->assign('admincategories', $admincategories);
// Populate block info and pass to theme
$blockinfo['content'] = $this->view->fetch('admin_block_adminnav.tpl');
return BlockUtil::themeBlock($blockinfo);
}
示例14: ZikulaUsersModule_tables
/**
* Populate pntables array for Users module.
*
* This function is called internally by the core whenever the module is
* loaded. It delivers the table information to the core.
* It can be loaded explicitly using the ModUtil::dbInfoLoad() API function.
*
* @param string $forVersion The module version number for which db information should be returned.
*
* @return array The table information.
*/
function ZikulaUsersModule_tables($forVersion = null)
{
if (!isset($forVersion)) {
if (isset($GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x']) && $GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x']) {
// This check comes before System::isInstalling().
return Users_tables_for_113();
}
if (System::isInstalling()) {
// new installs
return Users_tables_for_220();
}
// Remaining cases - this should be deleted.
$usersModInfo = ModUtil::getInfoFromName('ZikulaUsersModule');
$forVersion = $usersModInfo['version'];
}
if (version_compare($forVersion, '2.2.0') >= 0) {
return Users_tables_for_220();
} else {
return Users_tables_for_113();
}
}
示例15: display
public function display($blockinfo)
{
// security check
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:SubPagesBlock:', "{$blockinfo['title']}::", ACCESS_READ), LogUtil::getErrorMsgPermission());
// Break out options from our content field
$vars = BlockUtil::varsFromContent($blockinfo['content']);
// --- Setting of the Defaults
if (!isset($vars['usecaching'])) {
$vars['usecaching'] = false;
}
if (!isset($vars['checkinmenu'])) {
$vars['checkinmenu'] = true;
}
// decode the query string (works with and without shorturls)
System::queryStringDecode();
$query['module'] = isset($_REQUEST['module']) ? $_REQUEST['module'] : 'notcontent';
$query['func'] = isset($_REQUEST['func']) ? $_REQUEST['func'] : 'notview';
$query['pid'] = isset($_REQUEST['pid']) ? $_REQUEST['pid'] : 0;
$this->view->setCacheId($blockinfo['bid']);
$this->view->setCaching($vars['usecaching']);
if (!$vars['usecaching'] || $vars['usecaching'] && !$this->view->is_cached('block/subpages.tpl')) {
$modinfo = ModUtil::getInfoFromName('content');
if (strtolower($query['module']) == $modinfo['url'] && strtolower($query['func']) == 'view' && $query['pid'] > 0) {
$options = array('orderBy' => 'setLeft', 'makeTree' => true, 'includeContent' => false, 'enableEscape' => false, 'filter' => array());
// checkInMenu, checkActive is done implicitely
$options['filter']['checkInMenu'] = $vars['checkinmenu'];
$options['filter']['parentId'] = $query['pid'];
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if ($pages === false) {
return false;
}
} else {
$pages = null;
}
$this->view->assign('subPages', $pages);
}
$blockinfo['content'] = $this->view->fetch('block/subpages.tpl');
return BlockUtil::themeBlock($blockinfo);
}