Skip to content

Commit

Permalink
Merge pull request #17 from mambax7/master
Browse files Browse the repository at this point in the history
Remove pass-by-reference instances
  • Loading branch information
mambax7 authored May 28, 2017
2 parents 8dad3bb + f7373bf commit c41a18b
Show file tree
Hide file tree
Showing 22 changed files with 2,654 additions and 2,451 deletions.
10 changes: 5 additions & 5 deletions admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
* @uses ModuleAdmin::addNavigation to set the display page
* @uses ModuleAdmin::renderAbout to display the page passing PAYPAL key to method
*/

require_once __DIR__ . '/admin_header.php';
xoops_cp_header();

$aboutAdmin = new ModuleAdmin();

echo $aboutAdmin->addNavigation(basename(__FILE__));
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
$adminObject->displayNavigation(basename(__FILE__));
\Xmf\Module\Admin::setPaypal('[email protected]');
$adminObject->displayAbout(false);

include_once __DIR__ . '/admin_footer.php';
require_once __DIR__ . '/admin_footer.php';
30 changes: 26 additions & 4 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,31 @@
$moduleHandler = xoops_getHandler('module');
$moduleInfo = $moduleHandler->get($GLOBALS['xoopsModule']->getVar('mid'));

$pathImageAdmin = '../' . $moduleInfo->getInfo('icons32');
//$pathImageAdmin = '../' . $moduleInfo->getInfo('icons32');
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);

echo "<div class='adminfooter'>\n" . " <div class='center'>\n" . " <a href='" . $moduleInfo->getInfo('author_website_url') . "' target='_blank'><img src='{$pathImageAdmin}" . "/xoopsmicrobutton.gif' alt='"
. $xoopsModule->getInfo('author_website_name') . "' title='" . $moduleInfo->getInfo('author_website_name') . "' /></a>\n" . " </div>\n" . " <div class='center smallsmall italic pad5'>\n" . ' ' . _AM_XOOPSPOLL_MAINTAINED_BY
. " <a class='tooltip' rel='external' href='http://" . $GLOBALS['xoopsModule']->getInfo('module_website_url') . "' " . "title='" . _AM_XOOPSPOLL_MAINTAINTED_TITLE . "'>" . _AM_XOOPSPOLL_MAINTAINTED_TEXT . "</a>\n" . " </div>\n" . '</div>';
echo "<div class='adminfooter'>\n"
. " <div class='center'>\n"
. " <a href='"
. $moduleInfo->getInfo('author_website_url')
. "' target='_blank'><img src='{$pathIcon32}"
. "/xoopsmicrobutton.gif' alt='"
. $xoopsModule->getInfo('author_website_name')
. "' title='"
. $moduleInfo->getInfo('author_website_name')
. "' /></a>\n"
. " </div>\n"
. " <div class='center smallsmall italic pad5'>\n"
. ' '
. _AM_XOOPSPOLL_MAINTAINED_BY
. " <a class='tooltip' rel='external' href='http://"
. $GLOBALS['xoopsModule']->getInfo('module_website_url')
. "' "
. "title='"
. _AM_XOOPSPOLL_MAINTAINTED_TITLE
. "'>"
. _AM_XOOPSPOLL_MAINTAINTED_TEXT
. "</a>\n"
. " </div>\n"
. '</div>';
xoops_cp_footer();
47 changes: 22 additions & 25 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,30 @@
* required as they are done by cp_header.php}
*/

$path = dirname(dirname(dirname(__DIR__)));
require_once $path . '/include/cp_header.php';
require_once __DIR__ . '/../../../include/cp_header.php';

/** Load language files
* {@internal the following load is not needed, it's done in ./include/cp_header.php}
*/
//xoops_loadLanguage('admin', 'xoopspoll');
xoops_loadLanguage('modinfo', 'xoopspoll');
xoops_loadLanguage('main', 'xoopspoll');
xoops_load('constants', 'xoopspoll');

$pathIcon16 = '../' . $GLOBALS['xoopsModule']->getInfo('icons16');
$pathIcon32 = '../' . $GLOBALS['xoopsModule']->getInfo('icons32');
$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin');

// technically this isn't needed if only supporting XOOPS >= 2.5.5+
//if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin . "/moduleadmin.php"))) {
include_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php');
//} else {
// redirect_header($GLOBALS['xoops']->path('admin.php'), XoopspollConstants::REDIRECT_DELAY_LONG, _AM_XOOPSPOLL_ADMIN_MISSING, false);
//}
if (!isset($moduleDirName)) {
$moduleDirName = basename(dirname(__DIR__));
}

if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
} else {
$moduleHelper = Xmf\Module\Helper::getHelper('system');
}
$adminObject = \Xmf\Module\Admin::getInstance();

$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');

// Load language files
$moduleHelper->loadLanguage('admin');
$moduleHelper->loadLanguage('modinfo');
$moduleHelper->loadLanguage('main');

$myts = MyTextSanitizer::getInstance();

/*
if (!isset($GLOBALS['xoopsTpl']) || !$GLOBALS['xoopsTpl'] instanceof XoopsTpl) {
include_once $GLOBALS['xoops']->path("class" . "/template.php");
$GLOBALS['xoopsTpl'] = new XoopsTpl();
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
require_once $GLOBALS['xoops']->path('class/template.php');
$xoopsTpl = new XoopsTpl();
}
*/
16 changes: 8 additions & 8 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
require_once __DIR__ . '/admin_header.php';
xoops_cp_header();

$admin_class = new ModuleAdmin();
$adminObject = \Xmf\Module\Admin::getInstance();

$pollHandler = xoops_getModuleHandler('poll', 'xoopspoll');
$totalPolls = $pollHandler->getCount();
Expand All @@ -50,15 +50,15 @@
$totalWaitingPolls = $pollHandler->getCount($criteria);
$totalExpiredPolls = $totalPolls - $totalActivePolls - $totalWaitingPolls;

$admin_class->addInfoBox(_MD_XOOPSPOLL_DASHBOARD);
$admin_class->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALACTIVE . '</span>', $totalActivePolls, 'Green');
$admin_class->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALWAITING . '</span>', $totalWaitingPolls, 'Green');
$admin_class->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALEXPIRED . '</span>', $totalExpiredPolls, 'Red');
$admin_class->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALPOLLS . "</span><span class='infotext'>", $totalPolls . '</span>');
$adminObject->addInfoBox(_MD_XOOPSPOLL_DASHBOARD);
$adminObject->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALACTIVE . '</span>', $totalActivePolls, 'Green');
$adminObject->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALWAITING . '</span>', $totalWaitingPolls, 'Green');
$adminObject->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALEXPIRED . '</span>', $totalExpiredPolls, 'Red');
$adminObject->addInfoBoxLine(_MD_XOOPSPOLL_DASHBOARD, "<span class='infolabel'>" . _MD_XOOPSPOLL_TOTALPOLLS . "</span><span class='infotext'>", $totalPolls . '</span>');

/* use templates just in case we want to easily modify display in the future */
$GLOBALS['xoopsTpl']->assign('navigation', $admin_class->addNavigation(basename(__FILE__)));
$GLOBALS['xoopsTpl']->assign('renderindex', $admin_class->renderIndex());
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation(basename(__FILE__)));
$GLOBALS['xoopsTpl']->assign('renderindex', $adminObject->displayIndex());
$GLOBALS['xoopsTpl']->display($GLOBALS['xoops']->path('modules/xoopspoll/templates/admin/xoopspoll_index.tpl'));

require_once __DIR__ . '/admin_footer.php';
Loading

0 comments on commit c41a18b

Please sign in to comment.