Skip to content

Commit

Permalink
Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Aug 29, 2021
1 parent fea27b0 commit de3f4c6
Show file tree
Hide file tree
Showing 20 changed files with 154 additions and 118 deletions.
2 changes: 2 additions & 0 deletions admin/blockform.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);

$helper->loadLanguage('blocksadmin');

$form = new \XoopsThemeForm($block['form_title'], 'blockform', 'blocksadmin.php', 'post', true);
if (isset($block['name'])) {
$form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_NAME, $block['name']));
Expand Down
16 changes: 8 additions & 8 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

// Where do we start ?
$startcategory = Request::getInt('startcategory', 0, 'GET');
$categoryId = Request::getInt('categoryid', null);
$categoryid = Request::getInt('categoryid', null);

switch ($op) {
case 'del':
$categoryObj = $helper->getHandler('Category')->get($categoryId);
$categoryObj = $helper->getHandler('Category')->get($categoryid);
$confirm = Request::getString('confirm', '', 'POST');
$name = Request::getString('name', '', 'POST');
if ($confirm) {
Expand All @@ -60,14 +60,14 @@
//end of fx2024 code

Utility::cpHeader();
Utility::editCategory(true, $categoryId, $numberSubcats);
Utility::editCategory(true, $categoryid, $numberSubcats);
break;
case 'addcategory':
global $modify;

$parentid = Request::getInt('parentid');
if (0 != $categoryId) {
$categoryObj = $helper->getHandler('Category')->get($categoryId);
if (0 != $categoryid) {
$categoryObj = $helper->getHandler('Category')->get($categoryid);
} else {
$categoryObj = $helper->getHandler('Category')->create();
}
Expand Down Expand Up @@ -164,7 +164,7 @@
//Added by fx2024

case 'addsubcats':
$categoryId = 0;
$categoryid = 0;
$numberSubcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');

$categoryObj = $helper->getHandler('Category')->create();
Expand All @@ -176,7 +176,7 @@
}

Utility::cpHeader();
Utility::editCategory(true, $categoryId, $numberSubcats, $categoryObj);
Utility::editCategory(true, $categoryid, $numberSubcats, $categoryObj);
exit();
//end of fx2024 code

Expand Down Expand Up @@ -216,7 +216,7 @@
echo '<tr>';
echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . '</td>';
echo '</tr>';
$categoryId = '0';
$categoryid = '0';
}
echo "</table>\n";
require_once $GLOBALS['xoops']->path('class/pagenav.php');
Expand Down
28 changes: 14 additions & 14 deletions admin/import/fmcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

const DIRNAME = 'fmcontent';

/** @var \XoopsPersistableObjectHandler $fmContentHdlr */
/** @var \XoopsPersistableObjectHandler $fmTopicHdlr */
/** @var \XoopsPersistableObjectHandler $fmContentHandler */
/** @var \XoopsPersistableObjectHandler $fmTopicHandler */

require_once \dirname(__DIR__) . '/admin_header.php';
$myts = \MyTextSanitizer::getInstance();
Expand All @@ -52,15 +52,15 @@
Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO);
$moduleId = $helper->getModule()->getVar('mid');

$fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent');
$fmTopicCount = $fmTopicHdlr->getCount(new \Criteria('topic_modid', $moduleId));
$fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent');
$fmTopicCount = $fmTopicHandler->getCount(new \Criteria('topic_modid', $moduleId));

if (empty($fmTopicCount)) {
echo "<span style='color: #567; margin: 3px 0 12px 0; font-size: small; display: block;'>" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . '</span>';
} else {
require_once $GLOBALS['xoops']->path('www/class/xoopstree.php');
$fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent');
$fmContentCount = $fmContentHdlr->getCount(new \Criteria('content_modid', $moduleId));
$fmContentHandler = xoops_getModuleHandler('page', 'fmcontent');
$fmContentCount = $fmContentHandler->getCount(new \Criteria('content_modid', $moduleId));

if (empty($fmContentCount)) {
echo "<span style='color: #567; margin: 3px 0 12px 0; font-size: small; display: block;'>" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . '</span>';
Expand All @@ -87,7 +87,7 @@
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('content_modid', $moduleId));
$criteria->add(new \Criteria('content_topic', 0));
$cnt_tla_contents = $fmContentHdlr->getCount($criteria);
$cnt_tla_contents = $fmContentHandler->getCount($criteria);
if ($cnt_tla_contents) {
$catCboxOptions[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})";
}
Expand All @@ -102,8 +102,8 @@

// Publisher parent category
xoops_load('tree');
$categoryHdlr = $helper->getHandler('Category');
$catObjs = $categoryHdlr->getAll();
$categoryHandler = $helper->getHandler('Category');
$catObjs = $categoryHandler->getAll();
$myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid');
$moduleDirName = \basename(\dirname(__DIR__));
$module = \XoopsModule::getByDirname($moduleDirName);
Expand Down Expand Up @@ -150,12 +150,12 @@
$parentId = Request::getInt('parent_category', 0, 'POST');

// get all FmContent Content items without a category (content_topic=0)
$fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent');
$fmContentHandler = xoops_getModuleHandler('page', 'fmcontent');

$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('content_modid', $moduleId));
$criteria->add(new \Criteria('content_topic', 0));
$fmContentObjs = $fmContentHdlr->getAll($criteria);
$fmContentObjs = $fmContentHandler->getAll($criteria);

if ($fmContentObjs && is_array($fmContentObjs)) {
++$cnt_imported_cat; //count category if there was content to import
Expand All @@ -178,7 +178,7 @@
);
$categoryObj->store();

$fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent');
$fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent');

// insert articles for this category
foreach ($fmContentObjs as $thisFmContentObj) {
Expand Down Expand Up @@ -240,7 +240,7 @@
$newArticleArray = [];
$oldToNew = [];

$fmTopicObjs = $fmTopicHdlr->getAll(new \Criteria('topic_modid', $moduleId));
$fmTopicObjs = $fmTopicHandler->getAll(new \Criteria('topic_modid', $moduleId));

// first create FmContent Topics as Publisher Categories
foreach ($fmTopicObjs as $thisFmTopicObj) {
Expand Down Expand Up @@ -280,7 +280,7 @@
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('content_modid', $moduleId)); //only for this instance of fmcontent
$criteria->add(new \Criteria('content_topic', $thisFmTopicObj->getVar('topic_id'))); //for this category
$fmContentObjs = $fmContentHdlr->getAll($criteria);
$fmContentObjs = $fmContentHandler->getAll($criteria);

// insert articles for this category
/** @var Item $itemObj */
Expand Down
2 changes: 1 addition & 1 deletion admin/migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

$configurator = new Configurator();

$migrator = new Migrate($configurator);
$migrator = new Migrate();

$op = Request::getCmd('op', 'show');
$opShow = Request::getCmd('show', null, 'POST');
Expand Down
10 changes: 5 additions & 5 deletions backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
mb_http_output('pass');
}

$categoryId = Request::getInt('categoryid', -1, 'GET');
$categoryid = Request::getInt('categoryid', -1, 'GET');

if (-1 != $categoryId) {
$categoryObj = $helper->getHandler('Category')->get($categoryId);
if (-1 != $categoryid) {
$categoryObj = $helper->getHandler('Category')->get($categoryid);
}

header('Content-Type:text/xml; charset=' . _CHARSET);
Expand All @@ -63,7 +63,7 @@
$tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )');
$tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )');

if (-1 != $categoryId) {
if (-1 != $categoryid) {
$channelCategory .= ' > ' . $categoryObj->name();
}

Expand All @@ -83,7 +83,7 @@
$height = round($height, 0, PHP_ROUND_HALF_UP);
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
$sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryId);
$sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryid);
if (!empty($sarray) && is_array($sarray)) {
$count = $sarray;
foreach ($sarray as $item) {
Expand Down
6 changes: 3 additions & 3 deletions blocks/items_columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function publisher_items_columns_show($options)
$k = 0;
$columns = $mainItem = $subItem = [];

foreach ($selCategoriesObj as $categoryId => $mainItemCatObj) {
$categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId);
foreach ($selCategoriesObj as $categoryid => $mainItemCatObj) {
$categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid);
$scount = count($categoryItemsObj);
if ($scount > 0 && is_array($categoryItemsObj)) {
reset($categoryItemsObj);
Expand Down Expand Up @@ -140,7 +140,7 @@ function publisher_items_columns_show($options)
}
}
}
unset($categoryId);
unset($categoryid);

$block['template'] = $options[4];
$block['columns'] = $columns;
Expand Down
8 changes: 4 additions & 4 deletions blocks/items_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ function publisher_items_menu_show($options)

$catLinkClass = 'menuMain';

$categoryId = 0;
$categoryid = 0;

if ($block['inModule']) {
// Are we in a category and if yes, in which one ?
$categoryId = Request::getInt('categoryid', 0, 'GET');
$categoryid = Request::getInt('categoryid', 0, 'GET');

if (0 != $categoryId) {
if (0 != $categoryid) {
// if we are in a category, then the $categoryObj is already defined in publisher/category.php
global $categoryObj;
$block['currentcat'] = $categoryObj->getCategoryLink('menuTop');
Expand All @@ -69,7 +69,7 @@ function publisher_items_menu_show($options)
}

foreach ($blockCategoriesObj as $catId => $blockCategoryObj) {
if ($catId != $categoryId) {
if ($catId != $categoryid) {
$block['categories'][$catId]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass);
}
}
Expand Down
4 changes: 2 additions & 2 deletions blocks/items_new.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function publisher_items_new_show($options)
}

// $optCatItems = (int)$options[2];
// $categoryId = -1;
// $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId);
// $categoryid = -1;
// $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid);

$itemsObj = $itemHandler->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');

Expand Down
11 changes: 8 additions & 3 deletions blocks/latest_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* @author Mowaffak
*/

use XoopsModules\Publisher\{Constants,
use XoopsModules\Publisher\{
Common\Configurator,
Constants,
Helper,
ItemHandler,
Seo,
Expand All @@ -38,6 +40,9 @@ function publisher_latest_news_show($options)
{
$block = [];

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

$helper = Helper::getInstance();
$helper->loadLanguage('main');
/** @var ItemHandler $itemHandler */
Expand Down Expand Up @@ -223,7 +228,7 @@ 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">" . $icons['print'] . "</a>&nbsp;';
$item['print'] = '<a href="' . Seo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow">' . $icons['print'] . '</a>&nbsp;';
}

$item['pdf'] = '';
Expand All @@ -244,7 +249,7 @@ function publisher_latest_news_show($options)
}

$item['more'] = '';
if (1 == $options[28] && '' != $itemObj->body() || $itemObj->comments() > 0) {
if ((1 == $options[28] && '' != $itemObj->body()) || $itemObj->comments() > 0) {
$item['more'] = '<a href="' . $itemObj->getItemUrl() . '">' . _MB_PUBLISHER_READMORE . '</a>';
}

Expand Down
16 changes: 8 additions & 8 deletions category.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

require_once __DIR__ . '/header.php';

$categoryId = Request::getInt('categoryid', 0, 'GET');
$categoryid = Request::getInt('categoryid', 0, 'GET');

// Creating the category object for the selected category
/** @var Helper $helper */
$categoryObj = $helper->getHandler('Category')->get($categoryId);
$categoryObj = $helper->getHandler('Category')->get($categoryid);

// if the selected category was not found, exit
if (!is_object($categoryObj) || $categoryObj->notLoaded()) {
Expand All @@ -56,7 +56,7 @@

// if there is no Item under this categories or the sub-categories, exit
// why?
if (!isset($totalItems[$categoryId]) || 0 == $totalItems[$categoryId]) {
if (!isset($totalItems[$categoryid]) || 0 == $totalItems[$categoryid]) {
//redirect_header("index.php", 1, _MD_PUBLISHER_MAINNOFAQS);
}

Expand Down Expand Up @@ -104,7 +104,7 @@
break;
}

$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryId, $sort, $order);
$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryid, $sort, $order);

$totalItemOnPage = 0;
if ($itemsObj) {
Expand All @@ -128,7 +128,7 @@
$lastitemsize = (int)$helper->getConfig('idxcat_last_item_size');

// Creating the sub-categories objects that belong to the selected category
$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryId);
$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryid);
$totalSubcats = count($subcatsObj);

$total_items = 0;
Expand Down Expand Up @@ -180,7 +180,7 @@
$category['subcats'] = $subcategories;
$category['subcatscount'] = count($subcategories);

$thiscategory_itemcount = $totalItems[$categoryId] ?? 0;
$thiscategory_itemcount = $totalItems[$categoryid] ?? 0;
$category['total'] = $thiscategory_itemcount;

if (count($itemsObj) > 0) {
Expand Down Expand Up @@ -226,7 +226,7 @@
$xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name()));
$xoopsTpl->assign('module_home', Utility::moduleHome($helper->getConfig('format_linked_path')));
$xoopsTpl->assign('categoryPath', '<li>' . $category['categoryPath'] . '</li>');
$xoopsTpl->assign('selected_category', $categoryId);
$xoopsTpl->assign('selected_category', $categoryid);

// The Navigation Bar
require_once $GLOBALS['xoops']->path('class/pagenav.php');
Expand All @@ -246,7 +246,7 @@

// RSS Link
if (1 == $helper->getConfig('idxcat_show_rss_link')) {
$link = sprintf("<a href='%s' title='%s'><img src='%s' border=0 alt='%s'></a>", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryId, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED);
$link = sprintf("<a href='%s' title='%s'><img src='%s' border=0 alt='%s'></a>", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryid, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED);
$xoopsTpl->assign('rssfeed_link', $link);
}

Expand Down
7 changes: 3 additions & 4 deletions class/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
* @author The SmartFactory <www.smartfactory.ca>
*/

use XoopsModules\Publisher\{Form,
Helper,
Utility
use XoopsModules\Publisher\{
Form
};

/** @var Helper $this->helper */
Expand All @@ -44,7 +43,7 @@ class Category extends \XoopsObject
* @var array
*/
public $categoryPath = false;
public $categoryId;
public $categoryid;
public $parentid;
public $name;
public $description;
Expand Down
3 changes: 1 addition & 2 deletions class/Common/ModuleStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ trait ModuleStats
{
/**
* @param \XoopsModules\Publisher\Common\Configurator $configurator
* @param array $moduleStats
* @return array
*/

public static function getModuleStats($configurator, $moduleStats)
public static function getModuleStats($configurator)
{
if (\count($configurator->moduleStats) > 0) {
foreach (\array_keys($configurator->moduleStats) as $i) {
Expand Down
Loading

0 comments on commit de3f4c6

Please sign in to comment.