本文整理汇总了PHP中XoopsLoad::fileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLoad::fileExists方法的具体用法?PHP XoopsLoad::fileExists怎么用?PHP XoopsLoad::fileExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLoad
的用法示例。
在下文中一共展示了XoopsLoad::fileExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDump
/**
* @return void
*/
public function getDump()
{
$xoops = Xoops::getInstance();
$maintenance = new Maintenance();
parent::__construct('', "form_dump", "dump.php", 'post', true);
$dump_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_DUMP_TABLES_OR_MODULES, '');
$select_tables1 = new Xoops\Form\Select('', "dump_tables", '', 7, true);
$select_tables1->addOptionArray($maintenance->displayTables(true));
$dump_tray->addElement($select_tables1, false);
$ele = new Xoops\Form\Select(' ' . _AM_MAINTENANCE_OR . ' ', 'dump_modules', '', 7, true);
$module_list = XoopsLists::getModulesList();
$module_handler = $xoops->getHandlerModule();
foreach ($module_list as $file) {
if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) {
clearstatcache();
$file = trim($file);
$module = $module_handler->create();
$module->loadInfo($file);
if ($module->getInfo('tables') && $xoops->isActiveModule($file)) {
$ele->addOption($module->getInfo('dirname'), $module->getInfo('name'));
}
unset($module);
}
}
$dump_tray->addElement($ele);
$this->addElement($dump_tray);
$this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_DUMP_DROP, 'drop', 1));
$this->addElement(new Xoops\Form\Hidden("op", "dump_save"));
$this->addElement(new Xoops\Form\Button("", "dump_save", XoopsLocale::A_SUBMIT, "submit"));
}
示例2: execute
/**
* execute the command
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$xoops = \Xoops::getInstance();
$module = $input->getArgument('module');
if (false === \XoopsLoad::fileExists($xoops->path("modules/{$module}/xoops_version.php"))) {
$output->writeln(sprintf('<error>No module named %s found!</error>', $module));
return;
}
$output->writeln(sprintf('Installing %s', $module));
if (false !== $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s module is already installed!</error>', $module));
return;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
$sysmod = new \SystemModule();
$result = $sysmod->install($module);
foreach ($sysmod->trace as $message) {
if (is_array($message)) {
foreach ($message as $subMessage) {
if (!is_array($subMessage)) {
$output->writeln(strip_tags($subMessage));
}
}
} else {
$output->writeln(strip_tags($message));
}
}
if ($result === false) {
$output->writeln(sprintf('<error>Install of %s failed!</error>', $module));
} else {
$output->writeln(sprintf('<info>Install of %s completed.</info>', $module));
}
$xoops->cache()->delete('system');
}
示例3: init
/**
* Init the module
*
* @return null|void
*/
public function init()
{
if (XoopsLoad::fileExists($hnd_file = \XoopsBaseConfig::get('root-path') . '/modules/xlanguage/include/vars.php')) {
include_once $hnd_file;
}
if (XoopsLoad::fileExists($hnd_file = \XoopsBaseConfig::get('root-path') . '/modules/xlanguage/include/functions.php')) {
include_once $hnd_file;
}
$this->setDirname('xlanguage');
}
示例4: smarty_compiler_xoModuleIconsBookmarks
/**
* xoModuleIcons16 Smarty compiler plug-in
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author Andricq Nicolas (AKA MusS)
* @since 2.5.2
*/
function smarty_compiler_xoModuleIconsBookmarks($argStr, &$smarty)
{
$xoops = Xoops::getInstance();
if (XoopsLoad::fileExists($xoops->path('media/xoops/images/icons/bookmarks/index.html'))) {
$url = $xoops->url('media/xoops/images/icons/bookmarks/' . $argStr);
} else {
if (XoopsLoad::fileExists($xoops->path('modules/system/images/icons/default/' . $argStr))) {
$url = $xoops->url('modules/system/images/icons/default/' . $argStr);
} else {
$url = $xoops->url('modules/system/images/icons/default/xoops/xoops.png');
}
}
return "\necho '" . addslashes($url) . "';";
}
示例5: XoopsGTicket
function XoopsGTicket()
{
$xoops = Xoops::getInstance();
$language = $xoops->getConfig('language');
// language file
if ($language && !strstr($language, '/')) {
if (XoopsLoad::fileExists(dirname(__DIR__) . '/language/' . $language . '/gticket_messages.phtml')) {
include dirname(__DIR__) . '/language/' . $language . '/gticket_messages.phtml';
}
}
// default messages
if (empty($this->messages)) {
$this->messages = array('err_general' => 'GTicket Error', 'err_nostubs' => 'No stubs found', 'err_noticket' => 'No ticket found', 'err_nopair' => 'No valid ticket-stub pair found', 'err_timeout' => 'Time out', 'err_areaorref' => 'Invalid area or referer', 'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?', 'btn_repost' => 'repost');
}
}
示例6: smarty_compiler_xoModuleIcons16
/**
* xoModuleIcons16 Smarty compiler plug-in
*
* @copyright XOOPS Project (http://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Andricq Nicolas (AKA MusS)
* @since 2.5.2
* @version $Id$
*/
function smarty_compiler_xoModuleIcons16($params, Smarty $smarty)
{
$xoops = Xoops::getInstance();
$arg = reset($params);
$ico = trim($arg, " '\"\t\n\r\v");
if (XoopsLoad::fileExists($xoops->path('media/xoops/images/icons/16/index.html'))) {
$url = $xoops->url('media/xoops/images/icons/16/' . $ico);
} else {
if (XoopsLoad::fileExists($xoops->path('modules/system/images/icons/default/' . $ico))) {
$url = $xoops->url('modules/system/images/icons/default/' . $ico);
} else {
$url = $xoops->url('modules/system/images/icons/default/xoops/xoops2.png');
}
}
return "<?php echo '" . addslashes($url) . "'; ?>";
}
示例7: smarty_compiler_xoAdminNav
/**
* xoAdminNav Smarty compiler plug-in
*
* @copyright XOOPS Project (http://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Andricq Nicolas (AKA MusS)
* @since 2.5
* @version $Id$
*/
function smarty_compiler_xoAdminNav($argStr, &$smarty)
{
$xoops = Xoops::getInstance();
$icons = $xoops->getModuleConfig('typebreadcrumb', 'system');
if ($icons == '') {
$icons = 'default';
}
$url = '';
if (XoopsLoad::fileExists($xoops->path('modules/system/images/breadcrumb/' . $icons . '/index.html'))) {
$url = $xoops->url('modules/system/images/breadcrumb/' . $icons . '/' . $argStr);
} else {
if (XoopsLoad::fileExists($xoops->path('modules/system/images/breadcrumb/default/' . $argStr))) {
$url = $xoops->url('modules/system/images/icons/default/' . $argStr);
}
}
return "\necho '" . addslashes($url) . "';";
}
示例8: smarty_compiler_xoAdminIcons
/**
* xoAdminIcons Smarty compiler plug-in
*
* @copyright XOOPS Project (http://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Andricq Nicolas (AKA MusS)
* @since 2.5
* @version $Id$
*/
function smarty_compiler_xoAdminIcons($params, Smarty $smarty)
{
$xoops = Xoops::getInstance();
$arg = reset($params);
$ico = trim($arg, " '\"\t\n\r\v");
$icons = $xoops->getModuleConfig('typeicons', 'system');
if ($icons == '') {
$icons = 'default';
}
if (XoopsLoad::fileExists($xoops->path('modules/system/images/icons/' . $icons . '/index.html'))) {
$url = $xoops->url('modules/system/images/icons/' . $icons . '/' . $ico);
} else {
if (XoopsLoad::fileExists($xoops->path('modules/system/images/icons/default/' . $ico))) {
$url = $xoops->url('modules/system/images/icons/default/' . $ico);
} else {
$url = $xoops->url('modules/system/images/icons/default/xoops/xoops.png');
}
}
return "<?php echo '" . addslashes($url) . "'; ?>";
}
示例9: build
/**
* build a module handler for legacy module
*
* @param FactorySpec $spec specification for requested handler
*
* @return XoopsObjectHandler|null
*/
public function build(FactorySpec $spec)
{
$handler = null;
$name = strtolower($spec->getName());
$dirname = strtolower($spec->getDirname());
$handlerFile = \XoopsBaseConfig::get('root-path') . "/modules/{$dirname}/class/{$name}.php";
if (\XoopsLoad::fileExists($handlerFile)) {
include_once $handlerFile;
}
$class = ucfirst($dirname) . ucfirst($name) . 'Handler';
if (class_exists($class, false)) {
$handler = new $class($spec->getFactory()->db());
}
if ($handler === null) {
if (false === $spec->getOptional()) {
throw new NoHandlerException(sprintf('Class not found %s', $class));
}
}
return $handler;
}
示例10: b_system_main_show
/**
* Blocks functions
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author Kazumi Ono (AKA onokazu)
* @package system
* @version $Id$
*/
function b_system_main_show()
{
$xoops = Xoops::getInstance();
$block = array();
$block['lang_home'] = XoopsLocale::HOME;
$block['lang_close'] = XoopsLocale::A_CLOSE;
$module_handler = $xoops->getHandlerModule();
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$criteria->add(new Criteria('weight', 0, '>'));
$modules = $module_handler->getObjectsArray($criteria, true);
$moduleperm_handler = $xoops->getHandlerGroupperm();
$groups = $xoops->getUserGroups();
$read_allowed = $moduleperm_handler->getItemIds('module_read', $groups);
/* @var $module XoopsModule */
foreach ($modules as $i => $module) {
if (in_array($i, $read_allowed)) {
$block['modules'][$i]['name'] = $module->getVar('name');
$block['modules'][$i]['dirname'] = $module->getVar('dirname');
if (XoopsLoad::fileExists($xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_small.png'))) {
$block['modules'][$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_small.png');
}
if ($xoops->isModule() && $i == $xoops->module->getVar('mid')) {
$block['modules'][$i]['highlight'] = true;
$block['nothome'] = true;
}
if ($xoops->module && $i == $xoops->module->getVar('mid')) {
$block['modules'][$i]['highlight'] = true;
$block['nothome'] = true;
}
/* @var $plugin MenusPluginInterface */
if ($xoops->isModule() && $module->getVar('dirname') == $xoops->module->getVar('dirname') && ($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'menus'))) {
$sublinks = $plugin->subMenus();
foreach ($sublinks as $sublink) {
$block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => \XoopsBaseConfig::get('url') . '/modules/' . $module->getVar('dirname') . '/' . $sublink['url']);
}
}
}
}
return $block;
}
示例11: array
$xoops->tpl()->assign('ignored_queries', $ignored_queries);
$modules_result = array();
foreach ($mids as $mid) {
$mid = (int) $mid;
/* @var $module XoopsModule */
$module = $modules[$mid];
/* @var $plugin SearchPluginInterface */
$plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search');
$results = $plugin->search($queries, $andor, 5, 0, null);
$count = count($results);
$mid = $module->getVar('mid');
$res = array();
if (is_array($results) && $count > 0) {
$nomatch = false;
$modules_result[$mid]['name'] = $module->getVar('name');
if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) {
$modules_result[$mid]['image'] = $xoops->url($image);
} else {
$modules_result[$mid]['image'] = $xoops->url('images/icons/posticon2.gif');
}
$res = array();
for ($i = 0; $i < $count; ++$i) {
if (!preg_match("/^http[s]*:\\/\\//i", $results[$i]['link'])) {
$res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']);
} else {
$res[$i]['link'] = $results[$i]['link'];
}
$res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
$res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>\$1</span>", $myts->htmlSpecialChars($results[$i]['title']));
if (!empty($results[$i]['uid'])) {
$res[$i]['uid'] = (int) $results[$i]['uid'];
示例12: deny_by_htaccess
function deny_by_htaccess($ip = null)
{
if (empty($ip)) {
$ip = @$_SERVER['REMOTE_ADDR'];
}
if (empty($ip)) {
return false;
}
if (!function_exists('file_get_contents')) {
return false;
}
$target_htaccess = \XoopsBaseConfig::get('root-path') . '/.htaccess';
$backup_htaccess = \XoopsBaseConfig::get('root-path') . '/uploads/.htaccess.bak';
$ht_body = file_get_contents($target_htaccess);
// make backup as uploads/.htaccess.bak automatically
if ($ht_body && !XoopsLoad::fileExists($backup_htaccess)) {
$fw = fopen($backup_htaccess, "w");
fwrite($fw, $ht_body);
fclose($fw);
}
// if .htaccess is broken, restore from backup
if (!$ht_body && XoopsLoad::fileExists($backup_htaccess)) {
$ht_body = file_get_contents($backup_htaccess);
}
// new .htaccess
if ($ht_body === false) {
$ht_body = '';
}
if (preg_match("/^(.*)#PROTECTOR#\\s+(DENY FROM .*)\n#PROTECTOR#\n(.*)\$/si", $ht_body, $regs)) {
if (substr($regs[2], -strlen($ip)) == $ip) {
return true;
}
$new_ht_body = $regs[1] . "#PROTECTOR#\n" . $regs[2] . " {$ip}\n#PROTECTOR#\n" . $regs[3];
} else {
$new_ht_body = "#PROTECTOR#\nDENY FROM {$ip}\n#PROTECTOR#\n" . $ht_body;
}
// error_log( "$new_ht_body\n" , 3 , "/tmp/error_log" ) ;
$fw = fopen($target_htaccess, "w");
@flock($fw, LOCK_EX);
fwrite($fw, $new_ht_body);
@flock($fw, LOCK_UN);
fclose($fw);
return true;
}
示例13: resourcePath
/**
* Return a themable file resource path
*
* @param string $path file path
*
* @return string
*/
public function resourcePath($path)
{
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
$xoops_root_path = \XoopsBaseConfig::get('root-path');
//\Xoops::getInstance()->events()->triggerEvent('debug.log', $this);
if (\XoopsLoad::fileExists($xoops_root_path . "/{$this->themesPath}/{$this->folderName}/{$path}")) {
//\Xoops::getInstance()->events()->triggerEvent('debug.log', "custom theme path {$this->themesPath}/{$this->folderName}/{$path}");
return "{$this->themesPath}/{$this->folderName}/{$path}";
}
if (\XoopsLoad::fileExists($xoops_root_path . "/themes/{$this->folderName}/{$path}")) {
//\Xoops::getInstance()->events()->triggerEvent('debug.log', "main theme folder themes/{$this->folderName}/{$path}");
return "themes/{$this->folderName}/{$path}";
}
//\Xoops::getInstance()->events()->triggerEvent('debug.log', "drop thru {$path}");
return $path;
}
示例14: header
function header()
{
$xoops = Xoops::getInstance();
$xoops->loadLocale('system');
$xoops->theme()->addBaseStylesheetAssets('@jqueryuicss');
$xoops->theme()->addStylesheet('media/xoops/css/moduladmin.css');
$xoops->theme()->addStylesheet(\XoopsBaseConfig::get('adminthemes-url') . '/default/css/style.css');
$xoops->theme()->addBaseScriptAssets('@jquery');
// bootstrap has to come before jquery.ui or dialog close buttons are blank
$xoops->theme()->addBaseScriptAssets('@bootstrap');
$xoops->theme()->addBaseScriptAssets('@jqueryui');
$xoops->theme()->addBaseScriptAssets('@jgrowl');
// ddsmoothmenu
$xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/ddsmoothmenu.js');
$xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/tooltip.js');
$quick = array();
$quick[] = array('title' => SystemLocale::CONTROL_PANEL, 'link' => \XoopsBaseConfig::get('url') . '/admin.php');
$quick[] = array('title' => XoopsLocale::HOME_PAGE, 'link' => \XoopsBaseConfig::get('url'));
$quick[] = array('title' => DefaultThemeLocale::XOOPS_NEWS, 'link' => \XoopsBaseConfig::get('url') . '/admin.php?xoopsorgnews=1');
$quick[] = array('title' => 'separator');
$quick[] = array('title' => XoopsLocale::A_LOGOUT, 'link' => \XoopsBaseConfig::get('url') . '/user.php?op=logout');
$xoops->tpl()->assign('quick_menu', $quick);
XoopsLoad::load('module', 'system');
XoopsLoad::load('extension', 'system');
$system_module = new SystemModule();
$system_extension = new SystemExtension();
$adminmenu = null;
include __DIR__ . '/menu.php';
if (!$xoops->isModule() || 'system' == $xoops->module->getVar('dirname', 'n')) {
$modpath = \XoopsBaseConfig::get('url') . '/admin.php';
$modname = DefaultThemeLocale::SYSTEM_OPTIONS;
$modid = 1;
$moddir = 'system';
$mod_options = $adminmenu;
foreach (array_keys($mod_options) as $item) {
$mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . '/modules/' . $moddir . '/' . $mod_options[$item]['link'] : $mod_options[$item]['link'];
$mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : \XoopsBaseConfig::get('adminthemes-url') . '/default/' . $mod_options[$item]['icon'];
unset($mod_options[$item]['icon_small']);
}
} else {
$moddir = $xoops->module->getVar('dirname', 'n');
$modpath = \XoopsBaseConfig::get('url') . '/modules/' . $moddir;
$modname = $xoops->module->getVar('name');
$modid = $xoops->module->getVar('mid');
$mod_options = $xoops->module->getAdminMenu();
foreach (array_keys($mod_options) as $item) {
$mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link'];
if (XoopsLoad::fileExists($xoops->path("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']))) {
$mod_options[$item]['icon'] = $xoops->url("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']);
} else {
$mod_options[$item]['icon'] = $xoops->url("/modules/" . $xoops->module->dirname() . "/icons/32/" . $mod_options[$item]['icon']);
}
}
}
$xoops->tpl()->assign('mod_options', $mod_options);
$xoops->tpl()->assign('modpath', $modpath);
$xoops->tpl()->assign('modname', $modname);
$xoops->tpl()->assign('modid', $modid);
$xoops->tpl()->assign('moddir', $moddir);
// Modules list
$module_list = $system_module->getModuleList();
$xoops->tpl()->assign('module_menu', $module_list);
unset($module_list);
// Extensions list
$extension_list = $system_extension->getExtensionList();
$xoops->tpl()->assign('extension_menu', $extension_list);
unset($extension_list);
$extension_mod = $system_extension->getExtension($moddir);
$xoops->tpl()->assign('extension_mod', $extension_mod);
// add preferences menu
$menu = array();
$OPT = array();
$menu[] = array('link' => \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences', 'title' => XoopsLocale::PREFERENCES, 'absolute' => 1, 'url' => \XoopsBaseConfig::get('url') . '/modules/system/', 'options' => $OPT);
$menu[] = array('title' => 'separator');
// Module adminmenu
if ($xoops->isModule() && $xoops->module->getVar('dirname') != 'system') {
if ($xoops->module->getInfo('system_menu')) {
//$xoops->theme()->addStylesheet('modules/system/css/menu.css');
$xoops->module->loadAdminMenu();
// Get menu tab handler
/* @var $menu_handler SystemMenuHandler */
$menu_handler = $xoops->getModuleHandler('menu', 'system');
// Define top navigation
$menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=preferences&op=showmod&mod=" . $xoops->module->getVar('mid', 'e'), XoopsLocale::PREFERENCES);
if ($xoops->module->getInfo('extension')) {
$menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=extensions&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
} else {
$menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE);
}
if ($xoops->module->getInfo('blocks')) {
$menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen=" . $xoops->module->getVar('mid', 'e') . "&selmod=-2&selgrp=-1&selvis=-1", XoopsLocale::BLOCKS);
}
if ($xoops->module->getInfo('hasMain')) {
$menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/" . $xoops->module->getVar('dirname', 'e') . "/", SystemLocale::GO_TO_MODULE);
}
// Define main tab navigation
$i = 0;
$current = $i;
foreach ($xoops->module->adminmenu as $menu) {
if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
//.........这里部分代码省略.........
示例15: publisher_createLogo
function publisher_createLogo($dirname)
{
if (!extension_loaded("gd")) {
return false;
} else {
$required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox");
foreach ($required_functions as $func) {
if (!function_exists($func)) {
return false;
}
}
}
if (!XoopsLoad::fileExists($imageBase = \XoopsBaseConfig::get('root-path') . "/modules/" . $dirname . "/images/module_logo.png") || !XoopsLoad::fileExists($font = \XoopsBaseConfig::get('root-path') . "/modules/" . $dirname . "/images/VeraBd.ttf")) {
return false;
}
$imageModule = imagecreatefrompng($imageBase);
//Erase old text
$grey_color = imagecolorallocate($imageModule, 237, 237, 237);
imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color);
// Write text
$text_color = imagecolorallocate($imageModule, 0, 0, 0);
$space_to_border = (80 - strlen($dirname) * 6.5) / 2;
imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array());
// Set transparency color
$white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
imagefill($imageModule, 0, 0, $white);
imagecolortransparent($imageModule, $white);
imagepng($imageModule, \XoopsBaseConfig::get('root-path') . "/modules/" . $dirname . "/images/module_logo.png");
imagedestroy($imageModule);
return true;
}