Skip to content

Commit

Permalink
refactor icons and ModuleStats
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Jan 1, 2021
1 parent d505e85 commit 754f2c1
Show file tree
Hide file tree
Showing 19 changed files with 151 additions and 162 deletions.
9 changes: 3 additions & 6 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Xmf\Module\Admin;
use XoopsModules\Publisher\Helper;
use XoopsModules\Publisher\Common\Configurator;

require dirname(__DIR__) . '/preloads/autoloader.php';

Expand All @@ -46,12 +47,8 @@
$helper->loadLanguage('modinfo');
$helper->loadLanguage('main');

$imagearray = [
'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle'>",
'deleteimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_delete.png' alt='" . _AM_PUBLISHER_ICO_DELETE . "' align='middle'>",
'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle'>",
'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle'>",
];
$configurator = new Configurator();
$icons = $configurator->icons;

$myts = \MyTextSanitizer::getInstance();

Expand Down
13 changes: 8 additions & 5 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Publisher\{Helper
use XoopsModules\Publisher\{
Common\Configurator,
Helper
};

require __DIR__ . '/admin_header.php';
Expand Down Expand Up @@ -69,6 +71,9 @@ function listBlocks()
xoops_loadLanguage('admin/blocksadmin', 'system');
xoops_loadLanguage('admin/groups', 'system');

$configurator = new Configurator();
$icons = $configurator->icons;

/** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
/** @var \XoopsMemberHandler $memberHandler */
Expand Down Expand Up @@ -259,12 +264,10 @@ function listBlocks()

// Actions

echo "<td class='$class' align='center'><a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/edit.png' . " alt='" . _EDIT . "' title='" . _EDIT . "'>
</a> <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'>
echo "<td class='$class' align='center'><a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar('bid') . "'>" . $icons->edit . "</a> <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'>
</a>";
if (!in_array($i->getVar('block_type'), ['S', 'M'])) {
echo "&nbsp;<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=' . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'>
</a>";
echo "&nbsp;<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=' . $i->getVar('bid') . "'>" . $icons->delete . "</a>";
}
echo "
<input type='hidden' name='oldtitle[" . $i->getVar('bid') . "]' value='" . $i->getVar('title') . "'>
Expand Down
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$adminObject->addConfigBoxLine('<span style="color:#ff0000;"><img src="' . $pathIcon16 . '/0.png" alt="!">' . _MD_PUBLISHER_ERROR_NO_PDF . '</span>', 'default');
}

$moduleStats = $utility::getModuleStats($configurator);
$moduleStats = $utility::getModuleStats();

$adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY'));
if ($moduleStats && is_array($moduleStats)) {
Expand Down
22 changes: 11 additions & 11 deletions admin/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/approve.gif' title='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "' alt='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "'></a>&nbsp;";
$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>&nbsp;";
$clone = '';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
$modify = '';

echo '<tr>';
Expand Down Expand Up @@ -247,9 +247,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "'></a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . "</a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>";

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down Expand Up @@ -301,9 +301,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "'></a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . "</a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>";

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down Expand Up @@ -354,9 +354,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "'></a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . "</a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>";

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down
37 changes: 13 additions & 24 deletions admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,51 +245,40 @@
switch ($itemsObj[$i]->status()) {
case Constants::PUBLISHER_STATUS_SUBMITTED:
$statustxt = _CO_PUBLISHER_SUBMITTED;
$approve = "<a href='item.php?op=mod&itemid="
. $itemsObj[$i]->itemid()
. "'><img src='"
. XOOPS_URL
. '/modules/'
. $helper->getModule()->dirname()
. "/assets/images/links/approve.gif' title='"
. _AM_PUBLISHER_SUBMISSION_MODERATE
. "' alt='"
. _AM_PUBLISHER_SUBMISSION_MODERATE
. "'></a>&nbsp;";
$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->moderate . "</a>&nbsp;";
$clone = '';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
$modify = '';
break;
case Constants::PUBLISHER_STATUS_PUBLISHED:
$statustxt = _CO_PUBLISHER_PUBLISHED;
$approve = '';

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'></a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>&nbsp;";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>&nbsp;";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . "</a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>&nbsp;";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>&nbsp;";
break;
case Constants::PUBLISHER_STATUS_OFFLINE:
$statustxt = _CO_PUBLISHER_OFFLINE;
$approve = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'></a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>&nbsp;";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . "</a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>&nbsp;";
$clone = /** @lang text */
"<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>&nbsp;";
"<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>&nbsp;";
break;
case Constants::PUBLISHER_STATUS_REJECTED:
$statustxt = _CO_PUBLISHER_REJECTED;
$approve = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_REJECTED_EDIT . "' alt='" . _AM_PUBLISHER_REJECTED_EDIT . "'></a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>&nbsp;";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'></a>&nbsp;";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->rejectededit . "</a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>&nbsp;";
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . "</a>&nbsp;";
break;
case 'default':
default:
$statustxt = _AM_PUBLISHER_STATUS0;
$approve = '';
$clone = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_REJECTED_EDIT . "' alt='" . _AM_PUBLISHER_REJECTED_EDIT . "'></a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $helper->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'></a>";
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->rejectededit . "</a>&nbsp;";
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . "</a>";
break;
}

Expand Down
4 changes: 2 additions & 2 deletions admin/mimetypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
MimetypesUtility::edit();
break;
case 'search':
MimetypesUtility::search();
MimetypesUtility::search($icons);
break;
case 'updateMimeValue':
MimetypesUtility::updateMimeValue();
Expand All @@ -76,6 +76,6 @@
break;
case 'manage':
default:
MimetypesUtility::manage();
MimetypesUtility::manage($icons);
break;
}
10 changes: 5 additions & 5 deletions blocks/latest_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ function publisher_latest_news_show($options)
}

if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin(-1)) {
$item['admin'] = "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $itemObj->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif'" . " title='" . _CO_PUBLISHER_EDIT . "' alt='" . _CO_PUBLISHER_EDIT . "'></a>&nbsp;";
$item['admin'] .= "<a href='" . PUBLISHER_URL . '/admin/item.php?op=del&amp;itemid=' . $itemObj->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png'" . " title='" . _CO_PUBLISHER_DELETE . "' alt='" . _CO_PUBLISHER_DELETE . "'></a>";
$item['admin'] = "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $itemObj->itemid() . "'" . $icons->edit . "</a>&nbsp;";
$item['admin'] .= "<a href='" . PUBLISHER_URL . '/admin/item.php?op=del&amp;itemid=' . $itemObj->itemid() . "'>" . $icons->delete . "</a>";
} else {
$item['admin'] = '';
}
Expand Down Expand Up @@ -223,19 +223,19 @@ function publisher_latest_news_show($options)

$item['print'] = '';
if (1 == $options[24]) {
$item['print'] = '<a href="' . Seo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow"><img src="' . PUBLISHER_URL . '/assets/images/links/print.gif" title="' . _CO_PUBLISHER_PRINT . '" alt="' . _CO_PUBLISHER_PRINT . '"></a>&nbsp;';
$item['print'] = '<a href="' . Seo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow">" . $icons->print . "</a>&nbsp;';
}

$item['pdf'] = '';

if (1 == $options[25]) {
$item['pdf'] = "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $itemObj->itemid() . "' rel='nofollow'><img src='" . PUBLISHER_URL . "/assets/images/links/pdf.gif' title='" . _CO_PUBLISHER_PDF . "' alt='" . _CO_PUBLISHER_PDF . "'></a>&nbsp;";
$item['pdf'] = "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $itemObj->itemid() . "' rel='nofollow'>" . $icons->pdf . "</a>&nbsp;";
}

$item['email'] = '';
if (1 == $options[26]) {
$maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&amp;body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl();
$item['email'] = '<a href="' . $maillink . '"><img src="' . PUBLISHER_URL . '/assets/images/links/friend.gif" title="' . _CO_PUBLISHER_MAIL . '" alt="' . _CO_PUBLISHER_MAIL . '"></a>&nbsp;';
$item['email'] = '<a href="' . $maillink . '">' . $icons->mail . '</a>&nbsp;';
}

$block['morelink'] = '';
Expand Down
5 changes: 1 addition & 4 deletions class/Common/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ class Configurator
{
public $name;
public $paths = [];
public $icons = [];
public $uploadFolders = [];
public $copyBlankFiles = [];
public $copyTestFolders = [];
public $templateFolders = [];
public $oldFiles = [];
public $oldFolders = [];
public $renameTables = [];
public $moduleStats = [];
public $modCopyright;
public $icons;

/**
* Configurator constructor.
Expand All @@ -50,15 +49,13 @@ public function __construct()
{
$config = require \dirname(__DIR__, 2) . '/config/config.php';

$this->name = $config->name;
$this->uploadFolders = $config->uploadFolders;
$this->copyBlankFiles = $config->copyBlankFiles;
$this->copyTestFolders = $config->copyTestFolders;
$this->templateFolders = $config->templateFolders;
$this->oldFiles = $config->oldFiles;
$this->oldFolders = $config->oldFolders;
$this->renameTables = $config->renameTables;
$this->moduleStats = $config->moduleStats;
$this->modCopyright = $config->modCopyright;

$this->paths = require \dirname(__DIR__, 2) . '/config/paths.php';
Expand Down
Loading

0 comments on commit 754f2c1

Please sign in to comment.