本文整理汇总了PHP中ModUtil::getModule方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::getModule方法的具体用法?PHP ModUtil::getModule怎么用?PHP ModUtil::getModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModUtil
的用法示例。
在下文中一共展示了ModUtil::getModule方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reloadRoutesByModule
/**
* Reload routes for one module by name
* @param string $moduleName (default: ZikulaRoutesModule)
* @return boolean $hadRoutes
*/
public function reloadRoutesByModule($moduleName = "ZikulaRoutesRoutes")
{
$routeRepository = $this->entityManager->getRepository('ZikulaRoutesModule:RouteEntity');
$module = \ModUtil::getModule($moduleName);
if ($module === null) {
throw new NotFoundHttpException();
}
/** @var \Zikula\RoutesModule\Entity\Repository\Route $routeRepository */
$hadRoutes = $routeRepository->removeAllOfModule($module);
/** @var \Zikula\RoutesModule\Routing\RouteFinder $routeFinder */
$routeFinder = $this->get('zikularoutesmodule.routing_finder');
$routeCollection = $routeFinder->find($module);
if ($routeCollection->count() > 0) {
$routeRepository->addRouteCollection($module, $routeCollection);
}
return $hadRoutes;
}
示例2: smarty_function_img
//.........这里部分代码省略.........
$plugpath = "plugins/{$osplugdir}/images";
// form the array of paths
$paths = array($pluglangpath, $plugpath);
} else {
// module directory
if ($modname != 'core') {
$modinfo = ModUtil::getInfoFromName($modname);
$osmoddir = DataUtil::formatForOS($modinfo['directory']);
$moduleDir = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
}
if ($modplugin) {
$osmodplugdir = DataUtil::formatForOS($modplugin);
$modpluglangpath = "{$moduleDir}/{$osmoddir}/plugins/{$osmodplugdir}/Resources/public/images/{$lang}";
$modplugpath = "{$moduleDir}/{$osmoddir}/plugins/{$osmodplugdir}/Resources/public/images";
$modpluglangpathOld = "{$moduleDir}/{$osmoddir}/plugins/{$osmodplugdir}/images/{$lang}";
$modplugpathOld = "{$moduleDir}/{$osmoddir}/plugins/{$osmodplugdir}/images";
// form the array of paths
$paths = array($modpluglangpath, $modplugpath, $modpluglangpathOld, $modplugpathOld);
} else {
// theme directory
$ostheme = DataUtil::formatForOS(UserUtil::getTheme());
$theme = ThemeUtil::getTheme($ostheme);
$themePath = null === $theme ? '' : $theme->getRelativePath() . '/Resources/public/images';
$themepath = $themePath;
$corethemepath = "themes/{$ostheme}/images";
if ($modname == 'core') {
$modpath = "images";
$paths = array($themepath, $corethemepath, $modpath);
} else {
$osmodname = DataUtil::formatForOS($modname);
$themelangpath = "{$themePath}/{$lang}";
$themelangpathOld = "themes/{$ostheme}/templates/modules/{$osmodname}/images/{$lang}";
$themepathOld = "themes/{$ostheme}/templates/modules/{$osmodname}/images";
$module = ModUtil::getModule($modinfo['name']);
$moduleBasePath = null === $module ? '' : $module->getRelativePath() . '/Resources/public/images';
$modlangpath = "{$moduleBasePath}/{$lang}";
$modpath = $moduleBasePath;
$modlangpathOld = "{$moduleDir}/{$osmoddir}/images/{$lang}";
$modpathOld = "{$moduleDir}/{$osmoddir}/images";
$modlangpathOld2 = "{$moduleDir}/{$osmoddir}/pnimages/{$lang}";
$modpathOld2 = "{$moduleDir}/{$osmoddir}/pnimages";
// form the array of paths
if (preg_match('/^admin.(png|gif|jpg)$/', $params['src'])) {
// special processing for modules' admin icon
$paths = array($modlangpath, $modpath, $modlangpathOld, $modpathOld, $modlangpathOld, $modpathOld, $modlangpathOld2, $modpathOld2);
} else {
$paths = array($themelangpath, $themepath, $themelangpathOld, $themepathOld, $corethemepath, $modlangpath, $modpath, $modlangpathOld, $modpathOld, $modlangpathOld2, $modpathOld2);
}
}
}
}
$ossrc = DataUtil::formatForOS($params['src']);
// search for the image
$imgsrc = '';
foreach ($paths as $path) {
$fullpath = $path . ($osset ? "/{$osset}/" : '/') . $ossrc;
if (is_readable($fullpath)) {
$imgsrc = $fullpath;
break;
}
}
if ($imgsrc == '' && isset($params['default'])) {
$imgsrc = $params['default'];
}
// default for the optional flag
$optional = isset($params['optional']) ? $params['optional'] : true;
示例3: getSelector_ModuleTables
/**
* Selector for a module's tables or entities.
*
* This method is Backward Compatible with all Core versions back to 1.2.x
* It scans for tables in `tables.php` as well as locating Doctrine 1 tables
* or Doctrine 2 entities in either the 1.3.0 type directories or 1.4.0++ type
*
* @param string $modname Module name.
* @param string $name Select field name.
* @param string $selectedValue Selected value.
* @param string $defaultValue Value for "default" option.
* @param string $defaultText Text for "default" option.
* @param boolean $submit Submit on choose.
* @param string $remove Remove string from table name.
* @param boolean $disabled Add Disabled attribute to select.
* @param integer $nStripChars Strip the first n characters.
* @param integer $multipleSize Size for multiple selects.
*
* @return string The rendered output.
*/
public static function getSelector_ModuleTables($modname, $name, $selectedValue = '', $defaultValue = 0, $defaultText = '', $submit = false, $remove = '', $disabled = false, $nStripChars = 0, $multipleSize = 1)
{
if (!$modname) {
throw new \Exception(__f('Invalid %1$s passed to %2$s.', array('modname', 'HtmlUtil::getSelector_ModuleTables')));
}
// old style 'tables.php' modules (Core 1.2.x--)
$tables = ModUtil::dbInfoLoad($modname, '', true);
$data = array();
if (is_array($tables) && $tables) {
foreach ($tables as $k => $v) {
if (strpos($k, '_column') === false && strpos($k, '_db_extra_enable') === false && strpos($k, '_primary_key_column') === false) {
$checkColumns = $k . '_column';
if (!isset($tables[$checkColumns])) {
continue;
}
}
if (strpos($k, '_column') === false && strpos($k, '_db_extra_enable') === false && strpos($k, '_primary_key_column') === false) {
if (strpos($k, 'z_') === 0) {
$k = substr($k, 4);
}
if ($remove) {
$k2 = str_replace($remove, '', $k);
} else {
$k2 = $k;
}
if ($nStripChars) {
$k2 = ucfirst(substr($k2, $nStripChars));
}
// Use $k2 for display also (instead of showing the internal table name)
$data[$k2] = $k2;
}
}
}
if (!empty($data)) {
return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, null, null, $submit, $disabled, $multipleSize);
}
// Doctrine 1 models (Core 1.3.0 - 1.3.5)
DoctrineUtil::loadModels($modname);
$records = Doctrine::getLoadedModels();
$data = array();
foreach ($records as $recordClass) {
// remove records from other modules
if (substr($recordClass, 0, strlen($modname)) != $modname) {
continue;
}
// get table name of remove table prefix
$tableNameRaw = Doctrine::getTable($recordClass)->getTableName();
sscanf($tableNameRaw, Doctrine_Manager::getInstance()->getAttribute(Doctrine::ATTR_TBLNAME_FORMAT), $tableName);
if ($remove) {
$tableName = str_replace($remove, '', $tableName);
}
if ($nStripChars) {
$tableName = ucfirst(substr($tableName, $nStripChars));
}
$data[$tableName] = $tableName;
}
if (!empty($data)) {
return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, null, null, $submit, $disabled, $multipleSize);
}
// Doctrine 2 entities (Core 1.3.0++)
// Core-2.0 spec
$module = ModUtil::getModule($modname);
if (null !== $module && !class_exists($module->getVersionClass())) {
// this check just confirming a Core-2.0 spec bundle - remove in 2.0.0
$capabilities = $module->getMetaData()->getCapabilities();
if (isset($capabilities['categorizable'])) {
$data = array();
foreach ($capabilities['categorizable'] as $fullyQualifiedEntityName) {
$nameParts = explode('\\', $fullyQualifiedEntityName);
$entityName = array_pop($nameParts);
$data[$entityName] = $entityName;
}
$selectedValue = count($data) == 1 ? $entityName : $defaultValue;
return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, null, null, $submit, $disabled, $multipleSize);
}
}
// (Core-1.3 spec)
$modinfo = ModUtil::getInfo(ModUtil::getIdFromName($modname));
$modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
$osdir = DataUtil::formatForOS($modinfo['directory']);
//.........这里部分代码省略.........
示例4: editregistryAction
/**
* @Route("/editregistry")
* @Method("GET")
*
* edit category registry
*
* @param Request $request
*
* @return Response symfony response object
*
* @throws AccessDeniedException Thrown if the user doesn't have permission to administrate the module
*/
public function editregistryAction(Request $request)
{
if (!SecurityUtil::checkPermission('ZikulaCategoriesModule::', '::', ACCESS_ADMIN)) {
throw new AccessDeniedException();
}
$root_id = $request->get('dr', 1);
$id = $request->get('id', 0);
$obj = new CategoryRegistryEntity();
$category_registry = $request->query->get('category_registry', null);
if ($category_registry) {
$obj->merge($category_registry);
$obj = $obj->toArray();
}
$registries = $this->entityManager->getRepository('ZikulaCategoriesModule:CategoryRegistryEntity')->findBy(array(), array('modname' => 'ASC', 'property' => 'ASC'));
$modules = $this->entityManager->getRepository('Zikula\\ExtensionsModule\\Entity\\ExtensionEntity')->findBy(array('state' => 3), array('displayname' => 'ASC'));
$moduleOptions = array();
foreach ($modules as $module) {
$bundle = \ModUtil::getModule($module['name']);
if (null !== $bundle && !class_exists($bundle->getVersionClass())) {
// this check just confirming a Core-2.0 spec bundle - remove in 2.0.0
// then instead of getting MetaData, could just do ModUtil::getCapabilitiesOf($module['name'])
$capabilities = $bundle->getMetaData()->getCapabilities();
if (!isset($capabilities['categorizable'])) {
continue;
// skip this module if not categorizable
}
}
$moduleOptions[$module['name']] = $module['displayname'];
}
$this->view->assign('objectArray', $registries)->assign('moduleOptions', $moduleOptions)->assign('newobj', $obj)->assign('root_id', $root_id)->assign('id', $id);
return $this->response($this->view->fetch('Admin/registry_edit.tpl'));
}
示例5: __construct
//.........这里部分代码省略.........
$this->caching = (int) ModUtil::getVar('ZikulaThemeModule', 'render_cache');
}
$this->compile_id = '';
$this->cache_id = '';
// template compilation
$this->compile_dir = CacheUtil::getLocalDir('view_compiled');
$this->compile_check = ModUtil::getVar('ZikulaThemeModule', 'render_compile_check');
$this->force_compile = ModUtil::getVar('ZikulaThemeModule', 'render_force_compile');
// template caching
$this->cache_dir = CacheUtil::getLocalDir('view_cache');
$this->cache_lifetime = ModUtil::getVar('ZikulaThemeModule', 'render_lifetime');
$this->expose_template = ModUtil::getVar('ZikulaThemeModule', 'render_expose_template') == true ? true : false;
// register resource type 'z' this defines the way templates are searched
// during {include file='my_template.tpl'} this enables us to store selected module
// templates in the theme while others can be kept in the module itself.
$this->register_resource('z', array('Zikula_View_Resource', 'z_get_template', 'z_get_timestamp', 'z_get_secure', 'z_get_trusted'));
// set 'z' as default resource type
$this->default_resource_type = 'z';
// process some plugins specially when Render cache is enabled
if (!$this instanceof Zikula_View_Theme && $this->caching) {
$this->register_nocache_plugins();
}
// register the 'nocache' block to allow dynamic zones caching templates
$this->register_block('nocache', array('Zikula_View_Resource', 'block_nocache'), false);
// For ajax requests we use the short urls filter to 'fix' relative paths
if ($this->serviceManager->get('zikula')->getStage() & Zikula_Core::STAGE_AJAX && System::getVar('shorturls')) {
$this->load_filter('output', 'shorturls');
}
// register prefilters
$this->register_prefilter('z_prefilter_add_literal');
$this->register_prefilter('z_prefilter_gettext_params');
//$this->register_prefilter('z_prefilter_notifyfilters');
// assign some useful settings
$this->assign('homepage', $this->homepage)->assign('modinfo', $this->modinfo)->assign('module', $moduleName)->assign('toplevelmodule', $this->toplevelmodule)->assign('type', $this->type)->assign('func', $this->func)->assign('lang', $this->language)->assign('themeinfo', $this->themeinfo)->assign('themepath', isset($themeBundle) ? $themeBundle->getRelativePath() : $this->baseurl . 'themes/' . $theme)->assign('baseurl', $this->baseurl)->assign('baseuri', $this->baseuri)->assign('moduleBundle', ModUtil::getModule($moduleName))->assign('themeBundle', $themeBundle);
if (isset($themeBundle)) {
$stylePath = $themeBundle->getRelativePath() . "/Resources/public/css";
$javascriptPath = $themeBundle->getRelativePath() . "/Resources/public/js";
$imagePath = $themeBundle->getRelativePath() . "/Resources/public/images";
$imageLangPath = $themeBundle->getRelativePath() . "/Resources/public/images/" . $this->language;
} else {
$stylePath = $this->baseurl . "themes/{$theme}/style";
$javascriptPath = $this->baseurl . "themes/{$theme}/javascript";
$imagePath = $this->baseurl . "themes/{$theme}/images";
$imageLangPath = $this->baseurl . "themes/{$theme}/images/" . $this->language;
}
$this->assign('stylepath', $stylePath)->assign('scriptpath', $javascriptPath)->assign('imagepath', $imagePath)->assign('imagelangpath', $imageLangPath);
// for {gt} template plugin to detect gettext domain
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->modinfo['name']);
}
// make render object available to modifiers
parent::assign('zikula_view', $this);
// add ServiceManager, EventManager and others to all templates
parent::assign('serviceManager', $this->serviceManager);
parent::assign('eventManager', $this->eventManager);
parent::assign('zikula_core', $this->serviceManager->get('zikula'));
parent::assign('request', $this->request);
$modvars = ModUtil::getModvars();
// Get all modvars from any modules that have accessed their modvars at least once.
// provide compatibility 'alias' array keys
// @todo remove after v1.4.0
if (isset($modvars['ZikulaAdminModule'])) {
$modvars['Admin'] = $modvars['ZikulaAdminModule'];
}
if (isset($modvars['ZikulaBlocksModule'])) {
$modvars['Blocks'] = $modvars['ZikulaBlocksModule'];
示例6: setState
/**
* Set the state of a module.
*
* @param int[] $args {
* @type int $id The module id
* @type int $state The new state
* }
*
* @return boolean True if successful, false otherwise
*
* @throws \InvalidArgumentException Thrown if either the id or state parameters are not set or numeric
* @throws AccessDeniedException Thrown if the user doesn't have edit permissions over the module or
* if the module cannot be obtained from the database
* @throws \RuntimeException Thrown if the requested state transition is invalid
*/
public function setState($args)
{
// Argument check
if (!isset($args['id']) || !is_numeric($args['id']) || !isset($args['state']) || !is_numeric($args['state'])) {
throw new \InvalidArgumentException(__('Invalid arguments array received'));
}
// Security check
if (!System::isInstalling()) {
if (!SecurityUtil::checkPermission('ZikulaExtensionsModule::', '::', ACCESS_EDIT)) {
throw new AccessDeniedException();
}
}
// get module
$module = $this->entityManager->getRepository(self::EXTENSION_ENTITY)->find($args['id']);
if (empty($module)) {
return false;
}
if ($module === false) {
throw new AccessDeniedException();
}
// Check valid state transition
switch ($args['state']) {
case ModUtil::STATE_UNINITIALISED:
if ($this->serviceManager['multisites.enabled'] == 1) {
if (!SecurityUtil::checkPermission('ZikulaExtensionsModule::', '::', ACCESS_ADMIN)) {
throw new \RuntimeException($this->__('Error! Invalid module state transition.'));
}
}
break;
case ModUtil::STATE_INACTIVE:
$eventName = CoreEvents::MODULE_DISABLE;
break;
case ModUtil::STATE_ACTIVE:
if ($module->getState() === ModUtil::STATE_INACTIVE) {
// ACTIVE is used for freshly installed modules, so only register the transition
// if previously inactive.
$eventName = CoreEvents::MODULE_ENABLE;
}
break;
case ModUtil::STATE_MISSING:
break;
case ModUtil::STATE_UPGRADED:
$oldstate = $module->getState();
if ($oldstate == ModUtil::STATE_UNINITIALISED) {
throw new \RuntimeException($this->__('Error! Invalid module state transition.'));
}
break;
}
// change state
$module->setState($args['state']);
$this->entityManager->flush();
// clear the cache before calling events
/** @var $cacheClearer \Zikula\Bundle\CoreBundle\CacheClearer */
$cacheClearer = $this->get('zikula.cache_clearer');
$cacheClearer->clear('symfony.config');
// state changed, so update the ModUtil::available-info for this module.
$modinfo = ModUtil::getInfo($args['id']);
ModUtil::available($modinfo['name'], true);
if (isset($eventName)) {
// only notify for enable or disable transitions
$moduleBundle = \ModUtil::getModule($modinfo['name']);
$event = new ModuleStateEvent($moduleBundle, $moduleBundle === null ? $modinfo : null);
$this->getDispatcher()->dispatch($eventName, $event);
}
return true;
}
示例7: smarty_function_helplink
/**
* Zikula_View function to create help link.
*
* This function creates a help link.
*
* To make the link appear as a button, wrap it in a div or span with a class
* of z-buttons.
*
* Available parameters:
* - filename: name of file, defaults to 'help.txt'.
* - anchor: anchor marker.
* - popup: opens the help file in a new window using javascript.
* - width: width of the window if newwindow is set, default 600.
* - height: height of the window if newwindow is set, default 400.
* - title: name of the new window if new window is set, default is 'Help'.
* - link_contents the text for the link (between the <a> and </a> tags); optional, if not specified, then the title is used.
* - icon_type an optional icon type to include in the link, separated from the link_contents (or title) by a non-breaking space; equivalent to the type parameter from the {icon} template function
* - icon_size the size of the icon (e.g., extrasmall); optional if link_icon_type is specified, defaults to 'extrasmall', otherwise ignored;
* equivalent to the size parameter of the {icon} template function
* - icon_width the width of the icon in pixels; optional if link_icon_type is specified, if not specified, then obtained from size, otherwise ignored;
* equivalent to the width parameter of the {icon} template function
* - icon_height the height of the icon in pixels; optional if link_icon_type is specified, if not specified, then obtained from size, otherwise ignored;
* equivalent to the height parameter of the {icon} template function
* - icon_alt the alternate text for the icon, used for the alt param of the {icon} template function; optional if link_icon_type is specified,
* defaults to an empty string, otherwise ignored
* - icon_title the title text for the icon, used for the title param of the {icon} template function; optional if link_icon_type is specified,
* defaults to an empty string, otherwise ignored
* - icon_optional if true and the icon image is not found then an error will not be returned, used for the optinal param of the {icon} template
* function; optional if link_icon_type is specified, defaults to false, otherwise ignored
* - icon_default the full path to an image file to use if the icon is not found, used for the default param of the {icon} template
* function; optional if link_icon_type is specified, defaults to an empty string, otherwise ignored
* - icon_right if true, then the icon is placed on the right side of the link text (the text from either link_contents or title); optional,
* defaults to false (placing the icon on the left side of the text)
* - icon_* all remaining parameters with a "icon_" prefix are passed to the {icon} function and subsequently to the <img> tag, except for
* 'icon_assign' which is completely ignored; optional if link_icon_type is specified, otherwise ignored
* - class: class for use in the <a> tag.
* - assign: if set, the results (array('url', 'link') are assigned to the corresponding variable instead of printed out.
*
* Example: A pop-up help window with a width of 400 and a height of 300, containing the contents of help.txt, and a title of 'Help'
* {helplink popup='1' width='400' height='300' filename='help.txt' title='Help'}
*
* Example: The same as above, except displayed as a button with an icon image placed on the left side of the text 'Help' separated by a non-breaking space.
* The image does not have either alternate text nor a title.
* <div class="z-buttons">
* {helplink popup='1' width='400' height='300' filename='help.txt' title='Help' icon_type='help' icon_size='extrasmall'}
* </div>
*
* Example: The same as above, except the icon's <img> tag will contain a class attrbute with the value "my_class"
* <div class="z-buttons">
* {helplink popup='1' width='400' height='300' filename='help.txt' title='Help' icon_type='help' icon_size='extrasmall' icon_class='my_class'}
* </div>
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string|void
*/
function smarty_function_helplink($params, Zikula_View $view)
{
$userLang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
$systemLang = System::getVar('language_i18n');
$iconParams = array();
if (!empty($params) && is_array($params)) {
foreach ($params as $key => $value) {
if (strpos($key, 'icon_') === 0 && strlen($key) > 5) {
$iconParams[substr($key, 5)] = $value;
unset($params[$key]);
}
}
}
if (!empty($iconParams) && isset($iconParams['type'])) {
// We need to make sure the icon template function is available so we can call it.
require_once $view->_get_plugin_filepath('function', 'icon');
$iconRightSide = false;
if (isset($iconParams['right'])) {
$iconRightSide = (bool) $iconParams['right'];
unset($iconParams['right']);
}
if (isset($iconParams['assign'])) {
// We cannot use the assign parameter with the icon function in this context.
unset($iconParams['assign']);
}
} else {
$iconParams = false;
$iconRightSide = false;
}
$title = isset($params['title']) ? $params['title'] : 'Help';
$linkContents = isset($params['link_contents']) ? $params['link_contents'] : $title;
$fileName = isset($params['filename']) ? $params['filename'] : 'help.txt';
$chapter = isset($params['anchor']) ? '#' . $params['anchor'] : '';
$class = isset($params['class']) ? $params['class'] : null;
$width = isset($params['width']) ? $params['width'] : 600;
$height = isset($params['height']) ? $params['height'] : 400;
$popup = isset($params['popup']) ? true : false;
$modname = $view->getModuleName();
$linkID = isset($params['linkid']) ? $params['linkid'] : DataUtil::formatForDisplay(strtolower('manuallink_' . $modname . '_' . hash('md5', serialize($params))));
$paths = array();
$module = ModUtil::getModule($modname);
if ($module) {
$base = $module->getPath();
//.........这里部分代码省略.........
示例8: getModuleStylesheet
/**
* Get the modules stylesheet from several possible sources.
*
* @param string $modname The modules name (optional, defaults to top level module).
* @param string $stylesheet The stylesheet file (optional).
*
* @return string Path of the stylesheet file, relative to PN root folder.
*/
public static function getModuleStylesheet($modname = '', $stylesheet = '')
{
// default for the module
if (empty($modname)) {
$modname = ModUtil::getName();
}
// default for the style sheet
if (empty($stylesheet)) {
$stylesheet = ModUtil::getVar($modname, 'modulestylesheet');
if (empty($stylesheet)) {
$stylesheet = 'style.css';
}
}
$module = ModUtil::getModule($modname);
$osstylesheet = DataUtil::formatForOS($stylesheet);
$osmodname = DataUtil::formatForOS($modname);
$paths = array();
// config directory
$configstyledir = 'config/style';
$paths[] = "{$configstyledir}/{$osmodname}";
// theme directory
$themeName = DataUtil::formatForOS(UserUtil::getTheme());
$theme = self::getTheme($themeName);
if ($theme) {
$bundleRelativePath = substr($theme->getPath(), strpos($theme->getPath(), 'themes'), strlen($theme->getPath()));
$bundleRelativePath = str_replace('\\', '/', $bundleRelativePath);
}
$paths[] = null === $theme ? "themes/{$themeName}/style/{$osmodname}" : $bundleRelativePath . '/Resources/css/' . $theme->getName();
// module directory
$modinfo = ModUtil::getInfoFromName($modname);
$osmoddir = DataUtil::formatForOS($modinfo['directory']);
if ($module) {
$dir = ModUtil::getModuleBaseDir($modname);
$bundleRelativePath = substr($module->getPath(), strpos($module->getPath(), $dir), strlen($module->getPath()));
$bundleRelativePath = str_replace('\\', '/', $bundleRelativePath);
$paths[] = $bundleRelativePath . "/Resources/public/css";
}
$paths[] = "modules/{$osmoddir}/style";
$paths[] = "system/{$osmoddir}/style";
// search for the style sheet
$csssrc = '';
foreach ($paths as $path) {
if (is_readable("{$path}/{$osstylesheet}")) {
$csssrc = "{$path}/{$osstylesheet}";
break;
}
}
return $csssrc;
}
示例9: getModuleDomain
/**
* Get module domain.
*
* @param string $name Module name.
*
* @return string
*/
public static function getModuleDomain($name)
{
$module = ModUtil::getModule($name);
return null === $module ? strtolower('module_' . $name) : $module->getTranslationDomain();
}
示例10: removeAllOfModule
/**
* @param AbstractModule $module
* @param bool $userRoutes
* @return bool
*/
public function removeAllOfModule(AbstractModule $module, $userRoutes = false)
{
$routes = $this->findBy(array('userRoute' => $userRoutes, 'bundle' => $module->getName()));
if (empty($routes)) {
return false;
}
$workflowHelper = new WorkflowUtil(\ServiceUtil::getManager(), \ModUtil::getModule('ZikulaRoutesModule'));
foreach ($routes as $routeEntity) {
$workflowHelper->executeAction($routeEntity, 'delete');
}
return true;
}