diff --git a/admin/about.php b/admin/about.php
index 81da7b70..c5b0cf0a 100644
--- a/admin/about.php
+++ b/admin/about.php
@@ -23,7 +23,7 @@
xoops_cp_header();
$adminObject->displayNavigation(basename(__FILE__));
-$adminObject->setPaypal('xoopsfoundation@gmail.com');
+$adminObject::setPaypal('xoopsfoundation@gmail.com');
$adminObject->displayAbout(false);
require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/admin_header.php b/admin/admin_header.php
index 2601cf28..f2ec712d 100644
--- a/admin/admin_header.php
+++ b/admin/admin_header.php
@@ -27,21 +27,17 @@
require_once __DIR__ . '/../include/config.php';
$moduleDirName = basename(dirname(__DIR__));
-
-if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
-} else {
- $moduleHelper = Xmf\Module\Helper::getHelper('system');
-}
+$helper = \Xmf\Module\Helper::getHelper($moduleDirName);
$adminObject = \Xmf\Module\Admin::getInstance();
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
-$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
+$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
// Load language files
-$moduleHelper->loadLanguage('admin');
-$moduleHelper->loadLanguage('modinfo');
-$moduleHelper->loadLanguage('main');
+$helper->loadLanguage('admin');
+$helper->loadLanguage('modinfo');
+$helper->loadLanguage('main');
$imagearray = [
'editimg' => "",
diff --git a/admin/category.php b/admin/category.php
index 72fedb7f..a79f8385 100644
--- a/admin/category.php
+++ b/admin/category.php
@@ -33,11 +33,11 @@
switch ($op) {
case 'del':
- $categoryObj = $publisher->getHandler('category')->get($categoryid);
+ $categoryObj = $helper->getHandler('category')->get($categoryid);
$confirm = Request::getInt('confirm', '', 'POST');
$name = Request::getString('name', '', 'POST');
if ($confirm) {
- if (!$publisher->getHandler('category')->delete($categoryObj)) {
+ if (!$helper->getHandler('category')->delete($categoryObj)) {
redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR);
// exit();
}
@@ -65,9 +65,9 @@
$parentid = Request::getInt('parentid');
if (0 != $categoryid) {
- $categoryObj = $publisher->getHandler('category')->get($categoryid);
+ $categoryObj = $helper->getHandler('category')->get($categoryid);
} else {
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
}
// Uploading the image, if any
@@ -78,9 +78,9 @@
$temp2 = Request::getArray('xoops_upload_file', [], 'POST');
if ($filename = $temp2[0]) {
// TODO : implement publisher mimetype management
- $max_size = $publisher->getConfig('maximum_filesize');
- $max_imgwidth = $publisher->getConfig('maximum_image_width');
- $max_imgheight = $publisher->getConfig('maximum_image_height');
+ $max_size = $helper->getConfig('maximum_filesize');
+ $max_imgwidth = $helper->getConfig('maximum_image_width');
+ $max_imgheight = $helper->getConfig('maximum_image_height');
$allowed_mimetypes = PublisherUtility::getAllowedImagesTypes();
if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) {
redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR);
@@ -143,7 +143,7 @@
for ($i = 0; $i < $sizeof; ++$i) {
$temp = Request::getArray('scname', [], 'POST');
if ('' != $temp[$i]) {
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$temp2 = Request::getArray('scname', [], 'POST');
$categoryObj->setVar('name', $temp2[$i]);
$categoryObj->setVar('parentid', $parentCat);
@@ -169,7 +169,7 @@
$categoryid = 0;
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));
$categoryObj->setVar('description', Request::getString('description', '', 'POST'));
$categoryObj->setVar('weight', Request::getInt('weight', 0, 'POST'));
@@ -199,7 +199,7 @@
echo '';
// Creating the objects for top categories
- $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0);
+ $categoriesObj = $helper->getHandler('category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0);
PublisherUtility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);
@@ -210,7 +210,7 @@
echo "
" . _CO_PUBLISHER_WEIGHT . '';
echo " | " . _AM_PUBLISHER_ACTION . '';
echo '';
- $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0);
+ $totalCategories = $helper->getHandler('category')->getCategoriesCount(0);
if (count($categoriesObj) > 0) {
foreach ($categoriesObj as $key => $thiscat) {
PublisherUtility::displayCategory($thiscat);
@@ -224,7 +224,7 @@
}
echo "\n";
require_once $GLOBALS['xoops']->path('class/pagenav.php');
- $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
+ $pagenav = new XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
echo ' ' . $pagenav->renderNav() . ' ';
echo ' ';
PublisherUtility::closeCollapsableBar('createdcategories', 'createdcategoriesicon');
diff --git a/admin/clone.php b/admin/clone.php
index 7b7be590..28719111 100644
--- a/admin/clone.php
+++ b/admin/clone.php
@@ -68,7 +68,7 @@
echo $msg;
} else {
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
- $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
+ $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
$clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
$clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC);
$form->addElement($clone, true);
diff --git a/admin/file.php b/admin/file.php
index 495e5d14..6470b645 100644
--- a/admin/file.php
+++ b/admin/file.php
@@ -19,6 +19,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
require_once __DIR__ . '/admin_header.php';
@@ -31,13 +32,13 @@
*/
function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
// if there is a parameter, and the id exists, retrieve data: we're editing a file
if (0 != $fileid) {
// Creating the File object
- $fileObj = $publisher->getHandler('file')->get($fileid);
+ $fileObj = $helper->getHandler('file')->get($fileid);
if ($fileObj->notLoaded()) {
redirect_header('javascript:history.go(-1)', 1, _AM_PUBLISHER_NOFILESELECTED);
@@ -50,7 +51,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
PublisherUtility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
} else {
// there's no parameter, so we're adding an item
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVar('itemid', $itemid);
echo "" . _AM_PUBLISHER_FILE_ADDING . '';
echo '' . _AM_PUBLISHER_FILE_ADDING_DSC . '';
@@ -100,9 +101,9 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
// Creating the file object
if (0 != $fileid) {
- $fileObj = $publisher->getHandler('file')->get($fileid);
+ $fileObj = $helper->getHandler('file')->get($fileid);
} else {
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
}
// Putting the values in the file object
@@ -124,13 +125,13 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
$fileid = Request::getInt('fileid', 0, 'POST');
$fileid = Request::getInt('fileid', $fileid, 'GET');
- $fileObj = $publisher->getHandler('file')->get($fileid);
+ $fileObj = $helper->getHandler('file')->get($fileid);
$confirm = Request::getInt('confirm', 0, 'POST');
$title = Request::getString('title', '', 'POST');
if ($confirm) {
- if (!$publisher->getHandler('file')->delete($fileObj)) {
+ if (!$helper->getHandler('file')->delete($fileObj)) {
redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
// exit;
}
diff --git a/admin/import.php b/admin/import.php
index 7eab2ad1..e83fb669 100644
--- a/admin/import.php
+++ b/admin/import.php
@@ -27,7 +27,7 @@
switch ($op) {
case 'importExecute':
$importfile = Request::getString('importfile', 'nonselected', 'POST');
- $importfile_path = $GLOBALS['xoops']->path('modules/' . $publisher->getModule()->dirname() . '/admin/import/' . $importfile . '.php');
+ $importfile_path = $GLOBALS['xoops']->path('modules/' . $helper->getModule()->dirname() . '/admin/import/' . $importfile . '.php');
require_once $importfile_path;
break;
diff --git a/admin/import/ams.php b/admin/import/ams.php
index 79096c56..62973510 100644
--- a/admin/import/ams.php
+++ b/admin/import/ams.php
@@ -215,7 +215,7 @@
$newCat['oldid'] = $arrCat['topic_id'];
$newCat['oldpid'] = $arrCat['topic_pid'];
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVar('parentid', $arrCat['topic_pid']);
$categoryObj->setVar('image', $arrCat['topic_imgurl']);
@@ -253,7 +253,7 @@
}
}
- if (!$publisher->getHandler('category')->insert($categoryObj)) {
+ if (!$helper->getHandler('category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . ' ';
continue;
}
@@ -292,7 +292,7 @@
// insert article
/** @var XoopsPersistableObjectHandler $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -354,7 +354,7 @@
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) {
/** @var PublisherFile $fileObj */
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVar('name', $arrFile['filerealname']);
$fileObj->setVar('description', $arrFile['filerealname']);
$fileObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE);
@@ -405,7 +405,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -413,7 +413,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . ' ';
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php
index f53b9b21..3669a94d 100644
--- a/admin/import/cjaycontent.php
+++ b/admin/import/cjaycontent.php
@@ -105,7 +105,7 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('itemid', $arrArticle['id']);
// $itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -158,7 +158,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . ' ';
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php
index 1b40e32a..023ef802 100644
--- a/admin/import/fmcontent.php
+++ b/admin/import/fmcontent.php
@@ -92,7 +92,7 @@
// Publisher parent category
xoops_load('tree');
- $categoryHdlr = $publisher->getHandler('category');
+ $categoryHdlr = $helper->getHandler('category');
$catObjs = $categoryHdlr->getAll();
$myObjTree = new XoopsObjectTree($catObjs, 'categoryid', 'parentid');
$moduleDirName = basename(dirname(__DIR__));
@@ -158,7 +158,7 @@
// create Publsher category to hold FmContent Content items with no Topic (content_topic=0)
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVars([
'parentid' => $parentId,
'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME,
@@ -176,7 +176,7 @@
// insert articles for this category
foreach ($fmContentObjs as $thisFmContentObj) {
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVars([
'categoryid' => $categoryObj->categoryid(),
'title' => $thisFmContentObj->getVar('content_title'),
@@ -240,7 +240,7 @@
'oldpid' => $thisFmTopicObj->getVar('topic_pid')
];
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVars([
'parentid' => $thisFmTopicObj->getVar('topic_pid'),
@@ -255,7 +255,7 @@
$categoryObj->setVar('image', $thisFmTopicObj->getVar('topic_img'));
}
}
- if (!$publisher->getHandler('category')->insert($categoryObj)) {
+ if (!$helper->getHandler('category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $thisFmTopicObj->getVar('topic_title')) . " \n";
continue;
}
@@ -274,7 +274,7 @@
// insert articles for this category
/** @var PublisherItem $itemObj */
foreach ($fmContentObjs as $thisFmContentObj) {
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVars([
'categoryid' => $CatIds['newid'],
'title' => $thisFmContentObj->getVar('content_title'),
@@ -330,7 +330,7 @@
$criteria->add(new Criteria('categoryid', $CatIds['newid']));
$oldpid = $CatIds['oldpid'];
$newpid = (0 == $oldpid) ? $parentId : $newCatArray[$oldpid]['newid'];
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $CatIds);
@@ -338,7 +338,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . " \n";
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/news.php b/admin/import/news.php
index 84ba2144..190bd0fe 100644
--- a/admin/import/news.php
+++ b/admin/import/news.php
@@ -122,7 +122,7 @@
$newCat['oldid'] = $arrCat['topic_id'];
$newCat['oldpid'] = $arrCat['topic_pid'];
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVar('parentid', $arrCat['topic_pid']);
$categoryObj->setVar('weight', 0);
@@ -136,7 +136,7 @@
}
}
- if (!$publisher->getHandler('category')->insert($categoryObj)) {
+ if (!$helper->getHandler('category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . ' ';
continue;
}
@@ -151,7 +151,7 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -246,7 +246,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -254,7 +254,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . ' ';
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php
index c2140c76..858d7b51 100644
--- a/admin/import/smartsection.php
+++ b/admin/import/smartsection.php
@@ -122,7 +122,7 @@
$newCat['oldid'] = $arrCat['categoryid'];
$newCat['oldpid'] = $arrCat['parentid'];
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVars($arrCat);
$categoryObj->setVar('categoryid', 0);
@@ -132,7 +132,7 @@
copy($GLOBALS['xoops']->path('uploads/smartsection/images/category/' . $arrCat['image']), $GLOBALS['xoops']->path('uploads/publisher/images/category/' . $arrCat['image']));
}
- if (!$publisher->getHandler('category')->insert($categoryObj)) {
+ if (!$helper->getHandler('category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['name']) . ' ';
continue;
}
@@ -148,7 +148,7 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVars($arrArticle);
$itemObj->setVar('itemid', 0);
@@ -183,7 +183,7 @@
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filename']))) {
/** @var PublisherFile $fileObj */
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVars($arrFile);
$fileObj->setVar('fileid', 0);
@@ -221,7 +221,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -229,7 +229,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . ' ';
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php
index df955a94..0bc94b1c 100644
--- a/admin/import/wfsection.php
+++ b/admin/import/wfsection.php
@@ -113,7 +113,7 @@
$newCatArray = [];
while (false !== ($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat))) {
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$newCat = [];
@@ -156,7 +156,7 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -197,7 +197,7 @@
if (file_exists($filename)) {
if (copy($filename, PUBLISHER_UPLOAD_PATH . '/' . $arrFile['filerealname'])) {
/** @var PublisherFile $fileObj */
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVar('name', $arrFile['fileshowname']);
$fileObj->setVar('description', $arrFile['filedescript']);
$fileObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE);
@@ -234,7 +234,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -246,7 +246,7 @@
$moduleObj = $moduleHandler->getByDirname('wfsection');
$news_module_id = $moduleObj->getVar('mid');
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php
index ec6a64b1..25ccc97d 100644
--- a/admin/import/xfsection.php
+++ b/admin/import/xfsection.php
@@ -108,7 +108,7 @@
$newCatArray = [];
while (false !== ($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat))) {
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$newCat = [];
@@ -149,7 +149,7 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -196,7 +196,7 @@
if (file_exists($filename)) {
if (copy($filename, PUBLISHER_UPLOAD_PATH . '/' . $arrFile['filerealname'])) {
/** @var PublisherFile $fileObj */
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVar('name', $arrFile['fileshowname']);
$fileObj->setVar('description', $arrFile['filedescript']);
$fileObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE);
@@ -233,7 +233,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -245,7 +245,7 @@
$moduleObj = $moduleHandler->getByDirname('xfsection');
$news_module_id = $moduleObj->getVar('mid');
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
diff --git a/admin/import/xnews.php b/admin/import/xnews.php
index ba549786..3abdcba9 100644
--- a/admin/import/xnews.php
+++ b/admin/import/xnews.php
@@ -216,7 +216,7 @@
$newCat['oldpid'] = $arrCat['topic_pid'];
/* @var $categoryObj PublisherCategory */
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$categoryObj->setVar('parentid', $arrCat['topic_pid']);
$categoryObj->setVar('image', $arrCat['topic_imgurl']);
@@ -254,7 +254,7 @@
}
}
- if (!$publisher->getHandler('category')->insert($categoryObj)) {
+ if (!$helper->getHandler('category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . ' ';
continue;
}
@@ -291,7 +291,7 @@
// insert article
/** @var PublisherItem $itemObj */
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
@@ -353,7 +353,7 @@
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) {
/* @var $fileObj PublisherFile */
- $fileObj = $publisher->getHandler('file')->create();
+ $fileObj = $helper->getHandler('file')->create();
$fileObj->setVar('name', $arrFile['filerealname']);
$fileObj->setVar('description', $arrFile['filerealname']);
$fileObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE);
@@ -404,7 +404,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
- $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria);
+ $helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
@@ -412,7 +412,7 @@
// Looping through the comments to link them to the new articles and module
echo _AM_PUBLISHER_IMPORT_COMMENTS . ' ';
- $publisher_module_id = $publisher->getModule()->mid();
+ $publisher_module_id = $helper->getModule()->mid();
/* @var $commentHandler XoopsCommentHandler */
$commentHandler = xoops_getHandler('comment');
diff --git a/admin/index.php b/admin/index.php
index ac6d8e0c..6b431113 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -48,7 +48,7 @@
$adminObject->displayNavigation(basename(__FILE__));
//------------- Test Data ----------------------------
-if ($publisher->getConfig('displaySampleButton')) {
+if ($helper->getConfig('displaySampleButton')) {
xoops_loadLanguage('admin/modulesadmin', 'system');
require_once __DIR__ . '/../testdata/index.php';
$adminObject->addItemButton(_AM_SYSTEM_MODULES_INSTALL_TESTDATA, '__DIR__ . /../../testdata/index.php?op=load', 'add');
diff --git a/admin/item.php b/admin/item.php
index 4efe0088..a56bb5c2 100644
--- a/admin/item.php
+++ b/admin/item.php
@@ -20,6 +20,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
require_once __DIR__ . '/admin_header.php';
@@ -45,7 +46,7 @@
switch ($op) {
case 'clone':
if (0 == $itemid) {
- $totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1);
+ $totalcategories = $helper->getHandler('category')->getCategoriesCount(-1);
if (0 == $totalcategories) {
redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM);
// exit();
@@ -57,7 +58,7 @@
case 'mod':
if (0 == $itemid) {
- $totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1);
+ $totalcategories = $helper->getHandler('category')->getCategoriesCount(-1);
if (0 == $totalcategories) {
redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM);
// exit();
@@ -72,9 +73,9 @@
$redirect_msg = $error_msg = '';
// Creating the item object
if (0 != $itemid) {
- $itemObj = $publisher->getHandler('item')->get($itemid);
+ $itemObj = $helper->getHandler('item')->get($itemid);
} else {
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
}
$itemObj->setVarsFromRequest();
@@ -144,11 +145,11 @@
break;
case 'del':
- $itemObj = $publisher->getHandler('item')->get($itemid);
+ $itemObj = $helper->getHandler('item')->get($itemid);
$confirm = Request::getInt('confirm', 0, 'POST');
if ($confirm) {
- if (!$publisher->getHandler('item')->delete($itemObj)) {
+ if (!$helper->getHandler('item')->delete($itemObj)) {
redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . PublisherUtility::formatErrors($itemObj->getErrors()));
// exit();
}
@@ -180,9 +181,9 @@
PublisherUtility::openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP);
// Get the total number of submitted ITEM
- $totalitems = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_SUBMITTED]);
+ $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_SUBMITTED]);
- $itemsObj = $publisher->getHandler('item')->getAllSubmitted($publisher->getConfig('idxcat_perpage'), $submittedstartitem, -1, $orderBy, $ascOrDesc);
+ $itemsObj = $helper->getHandler('item')->getAllSubmitted($helper->getConfig('idxcat_perpage'), $submittedstartitem, -1, $orderBy, $ascOrDesc);
$totalItemsOnPage = count($itemsObj);
@@ -222,7 +223,7 @@
echo "\n";
echo " \n";
- $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $submittedstartitem, 'submittedstartitem');
+ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $submittedstartitem, 'submittedstartitem');
echo '' . $pagenav->renderNav() . ' ';
PublisherUtility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon');
@@ -231,9 +232,9 @@
PublisherUtility::openCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC);
// Get the total number of published ITEM
- $totalitems = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
+ $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
- $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $publishedstartitem, -1, $orderBy, $ascOrDesc);
+ $itemsObj = $helper->getHandler('item')->getAllPublished($helper->getConfig('idxcat_perpage'), $publishedstartitem, -1, $orderBy, $ascOrDesc);
$totalItemsOnPage = count($itemsObj);
@@ -274,7 +275,7 @@
echo "\n";
echo " \n";
- $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $publishedstartitem, 'publishedstartitem');
+ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $publishedstartitem, 'publishedstartitem');
echo '' . $pagenav->renderNav() . ' ';
PublisherUtility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon');
@@ -282,9 +283,9 @@
// Display Offline articles
PublisherUtility::openCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP);
- $totalitems = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_OFFLINE]);
+ $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_OFFLINE]);
- $itemsObj = $publisher->getHandler('item')->getAllOffline($publisher->getConfig('idxcat_perpage'), $offlinestartitem, -1, $orderBy, $ascOrDesc);
+ $itemsObj = $helper->getHandler('item')->getAllOffline($helper->getConfig('idxcat_perpage'), $offlinestartitem, -1, $orderBy, $ascOrDesc);
$totalItemsOnPage = count($itemsObj);
@@ -326,7 +327,7 @@
echo "\n";
echo " \n";
- $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $offlinestartitem, 'offlinestartitem');
+ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $offlinestartitem, 'offlinestartitem');
echo '' . $pagenav->renderNav() . ' ';
PublisherUtility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon');
@@ -335,8 +336,8 @@
PublisherUtility::openCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP);
// Get the total number of Rejected ITEM
- $totalitems = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]);
- $itemsObj = $publisher->getHandler('item')->getAllRejected($publisher->getConfig('idxcat_perpage'), $rejectedstartitem, -1, $orderBy, $ascOrDesc);
+ $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]);
+ $itemsObj = $helper->getHandler('item')->getAllRejected($helper->getConfig('idxcat_perpage'), $rejectedstartitem, -1, $orderBy, $ascOrDesc);
$totalItemsOnPage = count($itemsObj);
@@ -376,7 +377,7 @@
echo "\n";
echo " \n";
- $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $rejectedstartitem, 'rejectedstartitem');
+ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $rejectedstartitem, 'rejectedstartitem');
echo '' . $pagenav->renderNav() . ' ';
PublisherUtility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon');
@@ -391,7 +392,7 @@
*/
function publisher_editItem($showmenu = false, $itemid = 0, $clone = false)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $publisherCurrentPage;
xoops_load('XoopsFormLoader');
@@ -403,7 +404,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false)
if (0 != $itemid) {
// Creating the ITEM object
- $itemObj = $publisher->getHandler('item')->get($itemid);
+ $itemObj = $helper->getHandler('item')->get($itemid);
if (!$itemObj) {
redirect_header('item.php', 1, _AM_PUBLISHER_NOITEMSELECTED);
@@ -487,10 +488,10 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false)
} else {
// there's no parameter, so we're adding an item
- $itemObj = $publisher->getHandler('item')->create();
+ $itemObj = $helper->getHandler('item')->create();
$itemObj->setVarsFromRequest();
- $categoryObj = $publisher->getHandler('category')->create();
+ $categoryObj = $helper->getHandler('category')->create();
$breadcrumbAction1 = _AM_PUBLISHER_ITEMS;
$breadcrumbAction2 = _AM_PUBLISHER_CREATINGNEW;
$buttonCaption = _AM_PUBLISHER_CREATE;
diff --git a/admin/main.php b/admin/main.php
index 97d90f98..fae5e74d 100644
--- a/admin/main.php
+++ b/admin/main.php
@@ -32,7 +32,7 @@
$sortsel = Request::getString('sortsel', Request::getString('sortsel', 'itemid', 'GET'), 'POST');
$ordersel = Request::getString('ordersel', Request::getString('ordersel', 'DESC', 'GET'), 'POST');
-$module_id = $publisher->getModule()->mid();
+$module_id = $helper->getModule()->mid();
/* @var $gpermHandler XoopsGroupPermHandler */
$gpermHandler = xoops_getHandler('groupperm');
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
@@ -45,22 +45,22 @@
//publisher_adminMenu(0, _AM_PUBLISHER_INDEX);
// Total ITEMs -- includes everything on the table
-$totalitems = $publisher->getHandler('item')->getItemsCount();
+$totalitems = $helper->getHandler('item')->getItemsCount();
// Total categories
-$totalcategories = $publisher->getHandler('category')->getCategoriesCount(-1);
+$totalcategories = $helper->getHandler('category')->getCategoriesCount(-1);
// Total submitted ITEMs
-$totalsubmitted = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_SUBMITTED]);
+$totalsubmitted = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_SUBMITTED]);
// Total published ITEMs
-$totalpublished = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
+$totalpublished = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
// Total offline ITEMs
-$totaloffline = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_OFFLINE]);
+$totaloffline = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_OFFLINE]);
// Total rejected
-$totalrejected = $publisher->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]);
+$totalrejected = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]);
// Check Path Configuration
if ((PublisherUtility::getPathStatus('root', true) < 0)
@@ -234,10 +234,10 @@
// Get number of entries in the selected state
$statusSelected = (0 == $statussel) ? -1 : $statussel;
-$numrows = $publisher->getHandler('item')->getItemsCount(-1, $statusSelected);
+$numrows = $helper->getHandler('item')->getItemsCount(-1, $statusSelected);
// creating the Q&As objects
-$itemsObj = $publisher->getHandler('item')->getItems($publisher->getConfig('idxcat_perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel);
+$itemsObj = $helper->getHandler('item')->getItems($helper->getConfig('idxcat_perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel);
$totalItemsOnPage = count($itemsObj);
@@ -257,14 +257,14 @@
. "'>getModule()->dirname()
+ . $helper->getModule()->dirname()
. "/assets/images/links/approve.gif' title='"
. _AM_PUBLISHER_SUBMISSION_MODERATE
. "' alt='"
. _AM_PUBLISHER_SUBMISSION_MODERATE
. "'> ";
$clone = '';
- $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'>";
+ $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'>";
$modify = '';
break;
@@ -272,18 +272,18 @@
$statustxt = _CO_PUBLISHER_PUBLISHED;
$approve = '';
- $modify = "getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'> ";
- $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
- $clone = "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
+ $modify = "getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'> ";
+ $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
+ $clone = "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
break;
case PublisherConstants::PUBLISHER_STATUS_OFFLINE:
$statustxt = _CO_PUBLISHER_OFFLINE;
$approve = '';
- $modify = "getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'> ";
- $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
+ $modify = "getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_ITEM_EDIT . "' alt='" . _AM_PUBLISHER_ITEM_EDIT . "'> ";
+ $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
$clone = /** @lang text */
- "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
+ "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
break;
case PublisherConstants::PUBLISHER_STATUS_REJECTED:
@@ -294,14 +294,14 @@
. "'>getModule()->dirname()
+ . $helper->getModule()->dirname()
. "/assets/images/links/edit.gif' title='"
. _AM_PUBLISHER_REJECTED_EDIT
. "' alt='"
. _AM_PUBLISHER_REJECTED_EDIT
. "'> ";
- $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
- $clone = "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
+ $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'> ";
+ $clone = "getModule()->dirname() . "/assets/images/links/clone.gif' title='" . _AM_PUBLISHER_CLONE_ITEM . "' alt='" . _AM_PUBLISHER_CLONE_ITEM . "'> ";
break;
case 'default':
@@ -314,13 +314,13 @@
. "'>getModule()->dirname()
+ . $helper->getModule()->dirname()
. "/assets/images/links/edit.gif' title='"
. _AM_PUBLISHER_REJECTED_EDIT
. "' alt='"
. _AM_PUBLISHER_REJECTED_EDIT
. "'> ";
- $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'>";
+ $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'>";
break;
}
@@ -348,9 +348,9 @@
}
echo "\n";
echo "$status_explaination";
-$pagenav = new XoopsPageNav($numrows, $publisher->getConfig('idxcat_perpage'), $startentry, 'startentry', "statussel=$statussel&sortsel=$sortsel&ordersel=$ordersel");
+$pagenav = new XoopsPageNav($numrows, $helper->getConfig('idxcat_perpage'), $startentry, 'startentry', "statussel=$statussel&sortsel=$sortsel&ordersel=$ordersel");
-if (1 == $publisher->getConfig('format_image_nav')) {
+if (1 == $helper->getConfig('format_image_nav')) {
echo '' . $pagenav->renderImageNav() . ' ';
} else {
echo '' . $pagenav->renderNav() . ' ';
diff --git a/admin/menu.php b/admin/menu.php
index cd4646fa..ef53883e 100644
--- a/admin/menu.php
+++ b/admin/menu.php
@@ -20,19 +20,17 @@
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
-$moduleDirName = basename(dirname(__DIR__));
+use Xoopsmodules\publisher;
-if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
-} else {
- $moduleHelper = Xmf\Module\Helper::getHelper('system');
-}
+//require_once __DIR__ . '/../class/Helper.php';
+//require_once __DIR__ . '/../include/common.php';
+$moduleDirName = basename(dirname(__DIR__));
-$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
-$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
+$helper = publisher\Helper::getInstance();
-$moduleHelper->loadLanguage('modinfo');
-$moduleHelper->loadLanguage('admin');
+$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
+$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
require_once dirname(__DIR__) . '/include/config.php';
diff --git a/admin/mimetypes.php b/admin/mimetypes.php
index 95f7ce86..280644de 100644
--- a/admin/mimetypes.php
+++ b/admin/mimetypes.php
@@ -20,6 +20,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
require_once __DIR__ . '/admin_header.php';
xoops_load('XoopsPagenav');
@@ -93,7 +94,7 @@ class PublisherMimetypesUtility
{
public static function add()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $limit, $start;
$error = [];
if (!Request::getString('add_mime', '', 'POST')) {
@@ -218,14 +219,14 @@ public static function add()
header('Location: ' . PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false));
}
- $mimeType = $publisher->getHandler('mimetype')->create();
+ $mimeType = $helper->getHandler('mimetype')->create();
$mimeType->setVar('mime_ext', $mimeExt);
$mimeType->setVar('mime_name', $mimeName);
$mimeType->setVar('mime_types', $mimeTypes);
$mimeType->setVar('mime_admin', $mimeAdmin);
$mimeType->setVar('mime_user', $mimeUser);
- if (!$publisher->getHandler('mimetype')->insert($mimeType)) {
+ if (!$helper->getHandler('mimetype')->insert($mimeType)) {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_ADD_MIME_ERROR);
} else {
self::clearAddSessionVars();
@@ -236,7 +237,7 @@ public static function add()
public static function delete()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $start, $limit;
$mimeId = 0;
if (0 == Request::getInt('id', 0, 'GET')) {
@@ -244,8 +245,8 @@ public static function delete()
} else {
$mimeId = Request::getInt('id', 0, 'GET');
}
- $mimeType = $publisher->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object
- if (!$publisher->getHandler('mimetype')->delete($mimeType, true)) {
+ $mimeType = $helper->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object
+ if (!$helper->getHandler('mimetype')->delete($mimeType, true)) {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&id=$mimeId&limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR);
} else {
header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start");
@@ -254,7 +255,7 @@ public static function delete()
public static function edit()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $start, $limit;
$mimeId = 0;
$error = [];
@@ -264,7 +265,7 @@ public static function edit()
} else {
$mimeId = Request::getInt('id', 0, 'GET');
}
- $mimeTypeObj = $publisher->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object
+ $mimeTypeObj = $helper->getHandler('mimetype')->get($mimeId); // Retrieve mimetype object
if (!Request::getString('edit_mime', '', 'POST')) {
$session = PublisherSession::getInstance();
@@ -386,7 +387,7 @@ public static function edit()
$mimeTypeObj->setVar('mime_admin', $mimeAdmin);
$mimeTypeObj->setVar('mime_user', $mimeUser);
- if (!$publisher->getHandler('mimetype')->insert($mimeTypeObj, true)) {
+ if (!$helper->getHandler('mimetype')->insert($mimeTypeObj, true)) {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&id=$mimeId", 3, _AM_PUBLISHER_MESSAGE_EDIT_MIME_ERROR);
} else {
self::clearEditSessionVars($mimeId);
@@ -397,7 +398,7 @@ public static function edit()
public static function manage()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $imagearray, $start, $limit, $aSortBy, $aOrderBy, $aLimitBy, $aSearchBy;
if (Request::getString('deleteMimes', '', 'POST')) {
@@ -405,7 +406,7 @@ public static function manage()
$crit = new Criteria('mime_id', '(' . implode($aMimes, ',') . ')', 'IN');
- if ($publisher->getHandler('mimetype')->deleteAll($crit)) {
+ if ($helper->getHandler('mimetype')->deleteAll($crit)) {
header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start");
} else {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR);
@@ -433,8 +434,8 @@ public static function manage()
$crit->setStart($start);
$crit->setLimit($limit);
$crit->setSort($sort);
- $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit); // Retrieve a list of all mimetypes
- $mimeCount = $publisher->getHandler('mimetype')->getCount();
+ $mimetypes = $helper->getHandler('mimetype')->getObjects($crit); // Retrieve a list of all mimetypes
+ $mimeCount = $helper->getHandler('mimetype')->getCount();
$nav = new XoopsPageNav($mimeCount, $limit, $start, 'start', "op=manage&limit=$limit");
echo "";
@@ -539,7 +540,7 @@ public static function manage()
public static function search()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
global $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy;
if (Request::getString('deleteMimes', '', 'POST')) {
@@ -547,7 +548,7 @@ public static function search()
$crit = new Criteria('mime_id', '(' . implode($aMimes, ',') . ')', 'IN');
- if ($publisher->getHandler('mimetype')->deleteAll($crit)) {
+ if ($helper->getHandler('mimetype')->deleteAll($crit)) {
header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start");
} else {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR);
@@ -603,8 +604,8 @@ public static function search()
$crit->setOrder($order);
$crit->setLimit($limit);
$crit->setStart($start);
- $mimeCount = $publisher->getHandler('mimetype')->getCount($crit);
- $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit);
+ $mimeCount = $helper->getHandler('mimetype')->getCount($crit);
+ $mimetypes = $helper->getHandler('mimetype')->getObjects($crit);
$nav = new XoopsPageNav($mimeCount, $limit, $start, 'start', "op=search&limit=$limit&order=$order&sort=$sort&mime_search=1&search_by=$searchField&search_text=" . htmlentities($searchText, ENT_QUOTES));
// Display results
echo '';
@@ -731,8 +732,8 @@ public static function updateMimeValue()
'limit' => Request::getInt('limit', 15, 'GET'),
];
- $publisher = Publisher::getInstance();
- $mimeTypeObj = $publisher->getHandler('mimetype')->get($hiddens['id']);
+ $helper = publisher\Helper::getInstance();
+ $mimeTypeObj = $helper->getHandler('mimetype')->get($hiddens['id']);
if (Request::hasVar('mime_admin')) {
$hiddens['mime_admin'] = Request::getInt('mime_admin', 0, 'GET');
$msg = sprintf(_AM_PUBLISHER_MIME_ACCESS_CONFIRM_ADMIN, $mimeTypeObj->getVar('mime_name'));
@@ -750,7 +751,7 @@ public static function updateMimeValue()
public static function confirmUpdateMimeValue()
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$limit = Request::getInt('limit', 0, 'POST');
$start = Request::getInt('start', 0, 'POST');
@@ -759,7 +760,7 @@ public static function confirmUpdateMimeValue()
redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, _AM_PUBLISHER_MESSAGE_NO_ID);
}
- $mimeTypeObj = $publisher->getHandler('mimetype')->get($mimeId);
+ $mimeTypeObj = $helper->getHandler('mimetype')->get($mimeId);
if (-1 !== ($mimeAdmin = Request::getInt('mime_admin', -1, 'POST'))) {
$mimeAdmin = self::changeMimeValue($mimeAdmin);
@@ -768,7 +769,7 @@ public static function confirmUpdateMimeValue()
$mimeUser = self::changeMimeValue($mimeUser);
$mimeTypeObj->setVar('mime_user', $mimeUser);
}
- if ($publisher->getHandler('mimetype')->insert($mimeTypeObj, true)) {
+ if ($helper->getHandler('mimetype')->insert($mimeTypeObj, true)) {
header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start");
} else {
redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3);
diff --git a/admin/permissions.php b/admin/permissions.php
index e697ae25..96f5a378 100644
--- a/admin/permissions.php
+++ b/admin/permissions.php
@@ -30,9 +30,9 @@
$block_view = [];
PublisherUtility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS);
-$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($publisher->getDirname() . '_categories') . ' ');
+$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
- $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'category_read', '', 'admin/permissions.php');
+ $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'category_read', '', 'admin/permissions.php');
while (false !== ($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view))) {
$form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name']));
}
@@ -45,9 +45,9 @@
// Submit Categories permissions
echo " \n";
PublisherUtility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
-$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($publisher->getDirname() . '_categories') . ' ');
+$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
- $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'item_submit', '', 'admin/permissions.php');
+ $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'item_submit', '', 'admin/permissions.php');
while (false !== ($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view))) {
$form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name']));
}
@@ -60,9 +60,9 @@
// Moderators Categories permissions
echo " \n";
PublisherUtility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
-$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($publisher->getDirname() . '_categories') . ' ');
+$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
- $form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php');
+ $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php');
while (false !== ($myrow_view = $GLOBALS['xoopsDB']->fetcharray($result_view))) {
$form_submit->addItem($myrow_view['categoryid'], $myts->displayTarea($myrow_view['name']));
}
@@ -103,7 +103,7 @@
PublisherConstants::PUBLISHER_SUBTITLE => _CO_PUBLISHER_SUBTITLE,
PublisherConstants::PUBLISHER_AUTHOR_ALIAS => _CO_PUBLISHER_AUTHOR_ALIAS
];
-$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'form_view', '', 'admin/permissions.php');
+$form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'form_view', '', 'admin/permissions.php');
foreach ($form_options as $key => $value) {
$form_submit->addItem($key, $value);
}
@@ -115,7 +115,7 @@
echo " \n";
PublisherUtility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC);
$editors = PublisherUtility::getEditors();
-$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'editors', '', 'admin/permissions.php');
+$form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'editors', '', 'admin/permissions.php');
foreach ($editors as $key => $value) {
$form_submit->addItem($key, $value['title']);
}
@@ -130,7 +130,7 @@
PublisherConstants::PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH,
PublisherConstants::PUBLISHER_RATE => _AM_PUBLISHER_RATE
];
-$form_submit = new XoopsGroupPermForm('', $publisher->getModule()->mid(), 'global', '', 'admin/permissions.php');
+$form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'global', '', 'admin/permissions.php');
foreach ($form_options as $key => $value) {
$form_submit->addItem($key, $value);
}
diff --git a/admin/preferences.php b/admin/preferences.php
index b1c2def7..15a6dcf4 100644
--- a/admin/preferences.php
+++ b/admin/preferences.php
@@ -22,7 +22,7 @@
require_once __DIR__ . '/admin_header.php';
-$module = $publisher->getModule();
+$module = $helper->getModule();
$mod = $module->mid();
$modname = $module->name();
diff --git a/admin/pw_upload_file.php b/admin/pw_upload_file.php
index 32b9d496..c466b316 100644
--- a/admin/pw_upload_file.php
+++ b/admin/pw_upload_file.php
@@ -19,6 +19,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
require_once __DIR__ . '/admin_header.php';
@@ -42,12 +43,12 @@ function publisher_pagewrap_upload(&$errors)
// require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
xoops_load('XoopsMediaUploader');
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$postField = 'fileupload';
- $maxFileSize = $publisher->getConfig('maximum_filesize');
- $maxImageWidth = $publisher->getConfig('maximum_image_width');
- $maxImageHeight = $publisher->getConfig('maximum_image_height');
+ $maxFileSize = $helper->getConfig('maximum_filesize');
+ $maxImageWidth = $helper->getConfig('maximum_image_width');
+ $maxImageHeight = $helper->getConfig('maximum_image_height');
if (!is_dir(PublisherUtility::getUploadDir(true, 'content'))) {
mkdir(PublisherUtility::getUploadDir(true, 'content'), 0757);
diff --git a/archive.php b/archive.php
index 634d56e8..440f123f 100644
--- a/archive.php
+++ b/archive.php
@@ -57,7 +57,7 @@
$pgtitle = sprintf(' - %d - %d', $fromyear, $frommonth);
}
-$dateformat = $publisher->getConfig('format_date');
+$dateformat = $helper->getConfig('format_date');
if ('' === $dateformat) {
$dateformat = 'm';
@@ -79,12 +79,12 @@
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('status', 2), 'AND');
$criteria->add(new Criteria('datesub', time(), '<='), 'AND');
-$categoriesGranted = $publisher->getHandler('permission')->getGrantedItems('category_read');
+$categoriesGranted = $helper->getHandler('permission')->getGrantedItems('category_read');
$criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
//Get all articles dates as an array to save memory
-$items = $publisher->getHandler('item')->getAll($criteria, ['datesub'], false);
+$items = $helper->getHandler('item')->getAll($criteria, ['datesub'], false);
$itemsCount = count($items);
if (!($itemsCount > 0)) {
@@ -171,12 +171,12 @@
$count = 0;
- $itemHandler = $publisher->getHandler('item');
- $itemHandler->table_link = $GLOBALS['xoopsDB']->prefix($publisher->getDirname() . '_categories');
+ $itemHandler = $helper->getHandler('item');
+ $itemHandler->table_link = $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories');
$itemHandler->field_link = 'categoryid';
$itemHandler->field_object = 'categoryid';
// Categories for which user has access
- $categoriesGranted = $publisher->getHandler('permission')->getGrantedItems('category_read');
+ $categoriesGranted = $helper->getHandler('permission')->getGrantedItems('category_read');
$grantedCategories = new Criteria('l.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
$criteria = new CriteriaCompo();
$criteria->add($grantedCategories, 'AND');
diff --git a/author_items.php b/author_items.php
index 54468516..159018a7 100644
--- a/author_items.php
+++ b/author_items.php
@@ -35,7 +35,7 @@
// exit();
}
-if (!$publisher->getConfig('perm_author_items')) {
+if (!$helper->getConfig('perm_author_items')) {
redirect_header('index.php', 2, _CO_PUBLISHER_ERROR);
//mb exit();
}
@@ -49,15 +49,15 @@
$criteria = new CriteriaCompo(new Criteria('datesub', time(), '<='));
$criteria->add(new Criteria('uid', $uid));
-$items = $publisher->getHandler('item')->getItems($limit = 0, $start = 0, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, 'datesub', 'DESC', '', true, $criteria);
+$items = $helper->getHandler('item')->getItems($limit = 0, $start = 0, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, 'datesub', 'DESC', '', true, $criteria);
unset($criteria);
$count = count($items);
$xoopsTpl->assign('total_items', $count);
-$xoopsTpl->assign('permRating', $publisher->getConfig('perm_rating'));
+$xoopsTpl->assign('permRating', $helper->getConfig('perm_rating'));
xoops_load('XoopsUserUtility');
-$author_name = XoopsUserUtility::getUnameFromId($uid, $publisher->getConfig('format_realname'), true);
+$author_name = XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true);
$xoopsTpl->assign('author_name_with_link', $author_name);
$xoopsTpl->assign('user_avatarurl', XOOPS_URL . '/uploads/' . $thisuser->getVar('user_avatar'));
//$xoopsLocal = new XoopsLocal();
diff --git a/backend.php b/backend.php
index d1e102f5..88a7859b 100644
--- a/backend.php
+++ b/backend.php
@@ -35,7 +35,7 @@
$categoryid = Request::getInt('categoryid', -1, 'GET');
if ($categoryid != -1) {
- $categoryObj = $publisher->getHandler('category')->get($categoryid);
+ $categoryObj = $helper->getHandler('category')->get($categoryid);
}
header('Content-Type:text/xml; charset=' . _CHARSET);
@@ -45,7 +45,7 @@
$myts = MyTextSanitizer::getInstance();
if (!$tpl->is_cached('db:publisher_rss.tpl')) {
// xoops_load('XoopsLocal');
- $channel_category = $publisher->getModule()->name();
+ $channel_category = $helper->getModule()->name();
// Check if ML Hack is installed, and if yes, parse the $content in formatForML
if (method_exists($myts, 'formatForML')) {
$GLOBALS['xoopsConfig']['sitename'] = $myts->formatForML($GLOBALS['xoopsConfig']['sitename']);
@@ -66,7 +66,7 @@
}
$tpl->assign('channel_category', htmlspecialchars($channel_category));
- $tpl->assign('channel_generator', $publisher->getModule()->name());
+ $tpl->assign('channel_generator', $helper->getModule()->name());
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
$dimention = getimagesize($GLOBALS['xoops']->path('images/logo.gif'));
@@ -80,7 +80,7 @@
}
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
- $sarray = $publisher->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) {
diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php
index 40338b76..6e0329f3 100644
--- a/blocks/category_items_sel.php
+++ b/blocks/category_items_sel.php
@@ -18,6 +18,8 @@
* @author trabis
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -29,11 +31,11 @@
*/
function publisher_category_items_sel_show($options)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$block = $item = [];
- $categories = $publisher->getHandler('category')->getCategories(0, 0, -1);
+ $categories = $helper->getHandler('category')->getCategories(0, 0, -1);
if (0 === count($categories)) {
return $block;
@@ -53,7 +55,7 @@ function publisher_category_items_sel_show($options)
}
$criteria = new Criteria('categoryid', $catID);
- $items = $publisher->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, true);
+ $items = $helper->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, true);
unset($criteria);
if (0 === count($items)) {
diff --git a/blocks/date_to_date.php b/blocks/date_to_date.php
index fb9ff6d0..6b2d3c01 100644
--- a/blocks/date_to_date.php
+++ b/blocks/date_to_date.php
@@ -19,6 +19,8 @@
* @author The SmartFactory
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -31,7 +33,7 @@
function publisher_date_to_date_show($options)
{
$myts = MyTextSanitizer::getInstance();
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$block = $newItems = [];
@@ -42,7 +44,7 @@ function publisher_date_to_date_show($options)
$criteria->setOrder('DESC');
// creating the ITEM objects that belong to the selected category
- $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
+ $itemsObj = $helper->getHandler('item')->getObjects($criteria);
$totalItems = count($itemsObj);
if ($itemsObj) {
@@ -62,9 +64,9 @@ function publisher_date_to_date_show($options)
$block['lang_category'] = _MB_PUBLISHER_CATEGORY;
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
- $moduleName = $myts->displayTarea($publisher->getModule()->getVar('name'));
+ $moduleName = $myts->displayTarea($helper->getModule()->getVar('name'));
$block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $moduleName;
- $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
+ $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], isset($options[1]) ? $options[1] : 0);
}
return $block;
diff --git a/blocks/items_columns.php b/blocks/items_columns.php
index af87a08b..51d276a7 100644
--- a/blocks/items_columns.php
+++ b/blocks/items_columns.php
@@ -19,6 +19,8 @@
* @author Bandit-x
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -33,7 +35,7 @@
function publisher_items_columns_show($options)
{
// global $xoTheme;
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
//Column Settings
$optNumColumns = isset($options[0]) ? (int)$options[0] : '2';
@@ -49,7 +51,7 @@ function publisher_items_columns_show($options)
$selCategoriesObj = [];
//get permited categories only once
- $categoriesObj = $publisher->getHandler('category')->getCategories(0, 0, -1);
+ $categoriesObj = $helper->getHandler('category')->getCategories(0, 0, -1);
//if not selected 'all', let's get the selected ones
if (!in_array(0, $selCategories)) {
@@ -77,7 +79,7 @@ function publisher_items_columns_show($options)
$columns = $mainItem = $subItem = [];
foreach ($selCategoriesObj as $categoryId => $mainItemCatObj) {
- $categoryItemsObj = $publisher->getHandler('item')->getAllPublished($optCatItems, 0, $categoryId);
+ $categoryItemsObj = $helper->getHandler('item')->getAllPublished($optCatItems, 0, $categoryId);
$scount = count($categoryItemsObj);
if ($scount > 0 && is_array($categoryItemsObj)) {
reset($categoryItemsObj);
diff --git a/blocks/items_menu.php b/blocks/items_menu.php
index 90156359..e67ed845 100644
--- a/blocks/items_menu.php
+++ b/blocks/items_menu.php
@@ -20,6 +20,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
@@ -34,17 +35,17 @@ function publisher_items_menu_show($options)
{
$block = [];
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
// Getting all top cats
- $blockCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, 0);
+ $blockCategoriesObj = $helper->getHandler('category')->getCategories(0, 0, 0);
if (0 == count($blockCategoriesObj)) {
return $block;
}
// Are we in Publisher ?
- $block['inModule'] = (isset($GLOBALS['xoopsModule']) && $GLOBALS['xoopsModule']->getVar('dirname') == $publisher->getDirname());
+ $block['inModule'] = (isset($GLOBALS['xoopsModule']) && $GLOBALS['xoopsModule']->getVar('dirname') == $helper->getDirname());
$catLinkClass = 'menuMain';
diff --git a/blocks/items_new.php b/blocks/items_new.php
index 1d668db3..d2e522fe 100644
--- a/blocks/items_new.php
+++ b/blocks/items_new.php
@@ -19,6 +19,8 @@
* @author The SmartFactory
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -30,7 +32,7 @@
*/
function publisher_items_new_show($options)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$selectedcatids = explode(',', $options[0]);
@@ -53,7 +55,7 @@ function publisher_items_new_show($options)
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');
+ $itemsObj = $helper->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');
$totalitems = count($itemsObj);
if ($itemsObj && $totalitems > 0) {
diff --git a/blocks/items_random_item.php b/blocks/items_random_item.php
index cdda4e1e..53a47cec 100644
--- a/blocks/items_random_item.php
+++ b/blocks/items_random_item.php
@@ -19,6 +19,8 @@
* @author The SmartFactory
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -31,9 +33,9 @@
function publisher_items_random_item_show($options)
{
$block = [];
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
// creating the ITEM object
- $itemsObj = $publisher->getHandler('item')->getRandomItem('', [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
+ $itemsObj = $helper->getHandler('item')->getRandomItem('', [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]);
if (!is_object($itemsObj)) {
return $block;
diff --git a/blocks/items_recent.php b/blocks/items_recent.php
index 1d683468..b7dfd70e 100644
--- a/blocks/items_recent.php
+++ b/blocks/items_recent.php
@@ -19,6 +19,8 @@
* @author The SmartFactory
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -30,7 +32,7 @@
*/
function publisher_items_recent_show($options)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$myts = MyTextSanitizer::getInstance();
$block = $newItems = [];
@@ -54,7 +56,7 @@ function publisher_items_recent_show($options)
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');
+ $itemsObj = $helper->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');
$totalItems = count($itemsObj);
@@ -76,7 +78,7 @@ function publisher_items_recent_show($options)
$block['lang_category'] = _MB_PUBLISHER_CATEGORY;
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
- $moduleName = $myts->displayTarea($publisher->getModule()->getVar('name'));
+ $moduleName = $myts->displayTarea($helper->getModule()->getVar('name'));
$block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $moduleName;
}
diff --git a/blocks/items_spot.php b/blocks/items_spot.php
index e78c17d4..0b313e94 100644
--- a/blocks/items_spot.php
+++ b/blocks/items_spot.php
@@ -17,6 +17,9 @@
* @author trabis
* @author The SmartFactory
*/
+
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -29,7 +32,7 @@
function publisher_items_spot_show($options)
{
// global $xoTheme;
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$optDisplayLast = $options[0];
$optItemsCount = $options[1];
$optCategoryId = $options[2];
@@ -44,12 +47,12 @@ function publisher_items_spot_show($options)
}
$block = [];
if (1 == $optDisplayLast) {
- $itemsObj = $publisher->getHandler('item')->getAllPublished($optItemsCount, 0, $optCategoryId, $sort = 'datesub', $order = 'DESC', 'summary');
+ $itemsObj = $helper->getHandler('item')->getAllPublished($optItemsCount, 0, $optCategoryId, $sort = 'datesub', $order = 'DESC', 'summary');
$i = 1;
$itemsCount = count($itemsObj);
if ($itemsObj) {
if ($optCategoryId != -1 && $optCatImage) {
- $cat = $publisher->getHandler('category')->get($optCategoryId);
+ $cat = $helper->getHandler('category')->get($optCategoryId);
$category['name'] = $cat->name();
$category['categoryurl'] = $cat->getCategoryUrl();
if ('blank.png' !== $cat->getImage()) {
@@ -77,7 +80,7 @@ function publisher_items_spot_show($options)
$i = 1;
$itemsCount = count($selItems);
foreach ($selItems as $itemId) {
- $itemObj = $publisher->getHandler('item')->get($itemId);
+ $itemObj = $helper->getHandler('item')->get($itemId);
if (!$itemObj->notLoaded()) {
$item = $itemObj->toArraySimple();
$item['who_when'] = sprintf(_MB_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->getDatesub());
@@ -124,11 +127,11 @@ function publisher_items_spot_edit($options)
$autoEle = new XoopsFormRadioYN(_MB_PUBLISHER_AUTO_LAST_ITEMS, 'options[0]', $options[0]);
$countEle = new XoopsFormText(_MB_PUBLISHER_LAST_ITEMS_COUNT, 'options[1]', 2, 255, $options[1]);
$catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[2], 0, true, 'options[2]'));
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$criteria = new CriteriaCompo();
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
- $itemsObj = $publisher->getHandler('item')->getList($criteria);
+ $itemsObj = $helper->getHandler('item')->getList($criteria);
$keys = array_keys($itemsObj);
unset($criteria);
if (empty($options[3]) || (0 == $options[3])) {
diff --git a/blocks/latest_files.php b/blocks/latest_files.php
index 2f8f5737..8f2adafc 100644
--- a/blocks/latest_files.php
+++ b/blocks/latest_files.php
@@ -19,6 +19,8 @@
* @author The SmartFactory
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -30,7 +32,7 @@
*/
function publisher_latest_files_show($options)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
/**
* $options[0] : Category
* $options[1] : Sort order - datesub | counter
@@ -46,7 +48,7 @@ function publisher_latest_files_show($options)
$directDownload = $options[3];
// creating the files objects
- $filesObj = $publisher->getHandler('file')->getAllFiles(0, PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order, explode(',', $options[0]));
+ $filesObj = $helper->getHandler('file')->getAllFiles(0, PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE, $limit, 0, $sort, $order, explode(',', $options[0]));
foreach ($filesObj as $fileObj) {
$aFile = [];
$aFile['link'] = $directDownload ? $fileObj->getFileLink() : $fileObj->getItemLink();
diff --git a/blocks/latest_news.php b/blocks/latest_news.php
index 8fe0a5c4..bc1dfd2b 100644
--- a/blocks/latest_news.php
+++ b/blocks/latest_news.php
@@ -20,6 +20,8 @@
* @author Mowaffak
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -34,7 +36,7 @@ function publisher_latest_news_show($options)
$block = [];
xoops_loadLanguage('main', 'publisher');
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$start = $options[0]; // You can show articles from specified range
$limit = $options[1];
@@ -72,7 +74,7 @@ function publisher_latest_news_show($options)
$criteria->add(new Criteria('itemid', '(' . $selectedStories . ')', 'IN'));
}
- $itemsObj = $publisher->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'itemid');
+ $itemsObj = $helper->getHandler('item')->getItems($limit, $start, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'itemid');
$scount = count($itemsObj);
@@ -198,7 +200,7 @@ function publisher_latest_news_show($options)
}
$item['pdf'] = '';
- if ($publisher->getConfig('display_pdf')) {
+ if ($helper->getConfig('display_pdf')) {
if (1 == $options[25]) {
$item['pdf'] = "itemid() . "' rel='nofollow'> ";
}
diff --git a/blocks/search.php b/blocks/search.php
index 5d6daab1..e86941b5 100644
--- a/blocks/search.php
+++ b/blocks/search.php
@@ -20,6 +20,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
@@ -33,8 +34,8 @@
function publisher_search_show($options)
{
$block = [];
- $publisher = Publisher::getInstance();
- $categories = $publisher->getHandler('category')->getCategoriesForSearch();
+ $helper = publisher\Helper::getInstance();
+ $categories = $helper->getHandler('category')->getCategoriesForSearch();
if (0 == count($categories)) {
return $block;
}
diff --git a/category.php b/category.php
index 792923af..b1207891 100644
--- a/category.php
+++ b/category.php
@@ -26,7 +26,7 @@
$categoryid = Request::getInt('categoryid', 0, 'GET');
// Creating the category object for the selected category
-$categoryObj = $publisher->getHandler('category')->get($categoryid);
+$categoryObj = $helper->getHandler('category')->get($categoryid);
// if the selected category was not found, exit
if (!is_object($categoryObj) || $categoryObj->notLoaded()) {
@@ -45,7 +45,7 @@
$item_page_id = Request::getInt('page', -1, 'GET');
-$totalItems = $publisher->getHandler('category')->publishedItemsCount();
+$totalItems = $helper->getHandler('category')->publishedItemsCount();
// if there is no Item under this categories or the sub-categories, exit
// why?
@@ -57,16 +57,16 @@
// Added by skalpa: custom template support
$GLOBALS['xoopsOption']['template_main'] = $categoryObj->template();
if (empty($GLOBALS['xoopsOption']['template_main'])) {
- $GLOBALS['xoopsOption']['template_main'] = 'publisher_display' . '_' . $publisher->getConfig('idxcat_items_display_type') . '.tpl';
+ $GLOBALS['xoopsOption']['template_main'] = 'publisher_display' . '_' . $helper->getConfig('idxcat_items_display_type') . '.tpl';
}
require_once $GLOBALS['xoops']->path('header.php');
require_once PUBLISHER_ROOT_PATH . '/footer.php';
-$module_id = $publisher->getModule()->getVar('mid');
+$module_id = $helper->getModule()->getVar('mid');
// creating the Item objects that belong to the selected category
-switch ($publisher->getConfig('format_order_by')) {
+switch ($helper->getConfig('format_order_by')) {
case 'title':
$sort = 'title';
$order = 'ASC';
@@ -103,7 +103,7 @@
break;
}
-$itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->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) {
@@ -116,25 +116,25 @@
// Populating the smarty variables with informations related to the selected category
$category = $categoryObj->toArraySimple(null, true);
-$category['categoryPath'] = $categoryObj->getCategoryPath($publisher->getConfig('format_linked_path'));
+$category['categoryPath'] = $categoryObj->getCategoryPath($helper->getConfig('format_linked_path'));
-//$totalItems = $publisher_categoryHandler->publishedItemsCount($publisher->getConfig('idxcat_display_last_item'));
+//$totalItems = $publisher_categoryHandler->publishedItemsCount($helper->getConfig('idxcat_display_last_item'));
-if (1 == $publisher->getConfig('idxcat_display_last_item')) {
+if (1 == $helper->getConfig('idxcat_display_last_item')) {
// Get the last smartitem
- $lastItemObj = $publisher->getHandler('item')->getLastPublishedByCat([[$categoryObj]]);
+ $lastItemObj = $helper->getHandler('item')->getLastPublishedByCat([[$categoryObj]]);
}
-$lastitemsize = (int)$publisher->getConfig('idxcat_last_item_size');
+$lastitemsize = (int)$helper->getConfig('idxcat_last_item_size');
// Creating the sub-categories objects that belong to the selected category
-$subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryid);
+$subcatsObj = $helper->getHandler('category')->getCategories(0, 0, $categoryid);
$total_subcats = count($subcatsObj);
$total_items = 0;
$subcategories = [];
-if ('no' !== $publisher->getConfig('idxcat_show_subcats')) {
+if ('no' !== $helper->getConfig('idxcat_show_subcats')) {
// if this category has subcats
if (isset($subcatsObj) && $total_subcats > 0) {
foreach ($subcatsObj as $key => $subcat) {
@@ -142,7 +142,7 @@
$subcat_total_items = isset($totalItems[$key]) ? $totalItems[$key] : 0;
// Do we display empty sub-cats ?
- if (($subcat_total_items > 0) || ('all' === $publisher->getConfig('idxcat_show_subcats'))) {
+ if (($subcat_total_items > 0) || ('all' === $helper->getConfig('idxcat_show_subcats'))) {
$subcat_id = $subcat->getVar('categoryid');
// if we retreived the last item object for this category
if (isset($lastItemObj[$subcat_id])) {
@@ -196,7 +196,7 @@
// Adding the items of the selected category
for ($i = 0; $i < $totalItemOnPage; ++$i) {
- $item = $itemsObj[$i]->toArraySimple('default', $publisher->getConfig('item_title_size'));
+ $item = $itemsObj[$i]->toArraySimple('default', $helper->getConfig('item_title_size'));
$item['categoryname'] = $categoryObj->name();
$item['categorylink'] = "categoryid(), $categoryObj->short_url()) . "'>" . $categoryObj->name() . '';
$item['who_when'] = $itemsObj[$i]->getWhoAndWhen();
@@ -208,7 +208,7 @@
$category['last_title_link'] = $lastItemObj[$categoryObj->getVar('categoryid')]->getItemLink(false, $lastitemsize);
}
- $xoopsTpl->assign('show_subtitle', $publisher->getConfig('cat_disp_subtitle'));
+ $xoopsTpl->assign('show_subtitle', $helper->getConfig('cat_disp_subtitle'));
}
$categories = [];
@@ -217,20 +217,20 @@
$xoopsTpl->assign('categories', $categories);
// Language constants
-$xoopsTpl->assign('sectionname', $publisher->getModule()->getVar('name'));
-$xoopsTpl->assign('whereInSection', $publisher->getModule()->getVar('name'));
-$xoopsTpl->assign('module_dirname', $publisher->getDirname());
+$xoopsTpl->assign('sectionname', $helper->getModule()->getVar('name'));
+$xoopsTpl->assign('whereInSection', $helper->getModule()->getVar('name'));
+$xoopsTpl->assign('module_dirname', $helper->getDirname());
$xoopsTpl->assign('lang_category_summary', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY, $categoryObj->name()));
$xoopsTpl->assign('lang_category_summary_info', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY_INFO, $categoryObj->name()));
$xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name()));
-$xoopsTpl->assign('module_home', PublisherUtility::moduleHome($publisher->getConfig('format_linked_path')));
+$xoopsTpl->assign('module_home', PublisherUtility::moduleHome($helper->getConfig('format_linked_path')));
$xoopsTpl->assign('categoryPath', '' . $category['categoryPath'] . '');
$xoopsTpl->assign('selected_category', $categoryid);
// The Navigation Bar
require_once $GLOBALS['xoops']->path('class/pagenav.php');
-$pagenav = new XoopsPageNav($thiscategory_itemcount, $publisher->getConfig('idxcat_index_perpage'), $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
-if (1 == $publisher->getConfig('format_image_nav')) {
+$pagenav = new XoopsPageNav($thiscategory_itemcount, $helper->getConfig('idxcat_index_perpage'), $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
+if (1 == $helper->getConfig('format_image_nav')) {
$navbar = '' . $pagenav->renderImageNav() . ' ';
} else {
$navbar = '' . $pagenav->renderNav() . ' ';
@@ -244,7 +244,7 @@
$publisherMetagen->createMetaTags();
// RSS Link
-if (1 == $publisher->getConfig('idxcat_show_rss_link')) {
+if (1 == $helper->getConfig('idxcat_show_rss_link')) {
$link = sprintf("", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryid, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED);
$xoopsTpl->assign('rssfeed_link', $link);
}
diff --git a/class/helper.php b/class/Helper.php
similarity index 93%
rename from class/helper.php
rename to class/Helper.php
index ff533a7b..530a05b4 100644
--- a/class/helper.php
+++ b/class/Helper.php
@@ -1,4 +1,5 @@
-
* @author The SmartFactory
*/
+
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -29,7 +32,7 @@ class PublisherCategory extends XoopsObject
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
/**
* @var array
@@ -41,7 +44,7 @@ class PublisherCategory extends XoopsObject
*/
public function __construct()
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
$this->initVar('categoryid', XOBJ_DTYPE_INT, null, false);
$this->initVar('parentid', XOBJ_DTYPE_INT, null, false);
$this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 100);
@@ -365,14 +368,14 @@ class PublisherCategoryHandler extends XoopsPersistableObjectHandler
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
/**
* @param null|XoopsDatabase $db
*/
public function __construct(XoopsDatabase $db)
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
parent::__construct($db, 'publisher_categories', 'PublisherCategory', 'categoryid', 'name');
}
@@ -562,7 +565,7 @@ public function &getCategoriesForSubmit()
$criteria->add(new Criteria('moderator', $GLOBALS['xoopsUser']->getVar('uid')), 'OR');
}
}
- $categories =& $this->getAll($criteria, ['categoryid', 'parentid', 'name'], false, false);
+ $categories = $this->getAll($criteria, ['categoryid', 'parentid', 'name'], false, false);
if (0 == count($categories)) {
return $ret;
}
@@ -604,7 +607,7 @@ public function getCategoriesForSearch()
$criteria->add(new Criteria('moderator', $GLOBALS['xoopsUser']->getVar('uid')), 'OR');
}
}
- $categories =& $this->getAll($criteria, ['categoryid', 'parentid', 'name'], false, false);
+ $categories = $this->getAll($criteria, ['categoryid', 'parentid', 'name'], false, false);
if (0 == count($categories)) {
return $ret;
}
diff --git a/class/file.php b/class/file.php
index c888cf67..b222c584 100644
--- a/class/file.php
+++ b/class/file.php
@@ -16,6 +16,9 @@
* @author trabis
* @author The SmartFactory
*/
+
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
require_once dirname(__DIR__) . '/include/common.php';
@@ -34,14 +37,14 @@ class PublisherFile extends XoopsObject
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
/**
* @param null|int $id
*/
public function __construct($id = null)
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
$this->db = XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('fileid', XOBJ_DTYPE_INT, 0, false);
$this->initVar('itemid', XOBJ_DTYPE_INT, null, true);
@@ -291,14 +294,14 @@ class PublisherFileHandler extends XoopsPersistableObjectHandler
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
/**
* @param null|XoopsDatabase $db
*/
public function __construct(XoopsDatabase $db)
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
parent::__construct($db, 'publisher_files', 'PublisherFile', 'fileid', 'name');
}
diff --git a/class/form/category.php b/class/form/category.php
index 795f7beb..b1767e9d 100644
--- a/class/form/category.php
+++ b/class/form/category.php
@@ -20,6 +20,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
// defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined");
@@ -37,7 +38,7 @@ class PublisherCategoryForm extends XoopsThemeForm
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
public $targetObject;
@@ -51,7 +52,7 @@ class PublisherCategoryForm extends XoopsThemeForm
*/
public function __construct(&$target, $subCatsCount = 4)
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
$this->targetObject =& $target;
$this->subCatsCount = $subCatsCount;
diff --git a/class/form/file.php b/class/form/file.php
index 7f5179bb..719199af 100644
--- a/class/form/file.php
+++ b/class/form/file.php
@@ -19,6 +19,8 @@
* @author trabis
*/
+use Xoopsmodules\publisher;
+
// defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined");
require_once dirname(dirname(__DIR__)) . '/include/common.php';
@@ -36,7 +38,7 @@ class PublisherFileForm extends XoopsThemeForm
* @var Publisher
* @access public
*/
- public $publisher;
+ public $helper;
public $targetObject;
@@ -45,7 +47,7 @@ class PublisherFileForm extends XoopsThemeForm
*/
public function __construct(&$target)
{
- $this->publisher = Publisher::getInstance();
+ $this->publisher = publisher\Helper::getInstance();
$this->targetObject =& $target;
parent::__construct(_AM_PUBLISHER_UPLOAD_FILE, 'form', xoops_getenv('PHP_SELF'), 'post', true);
diff --git a/class/form/item.php b/class/form/item.php
index 2b68ba54..2ca09b84 100644
--- a/class/form/item.php
+++ b/class/form/item.php
@@ -21,6 +21,7 @@
*/
use Xmf\Request;
+use Xoopsmodules\publisher;
// defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined");
@@ -93,9 +94,9 @@ public function setCheckPermissions($checkperm)
*/
public function isGranted($item)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
$ret = false;
- if (!$this->checkperm || $publisher->getHandler('permission')->isGranted('form_view', $item)) {
+ if (!$this->checkperm || $helper->getHandler('permission')->isGranted('form_view', $item)) {
$ret = true;
}
@@ -131,9 +132,9 @@ public function hasTab($tab)
*/
public function createElements($obj)
{
- $publisher = Publisher::getInstance();
+ $helper = publisher\Helper::getInstance();
- $allowedEditors = PublisherUtility::getEditors($publisher->getHandler('permission')->getGrantedItems('editors'));
+ $allowedEditors = PublisherUtility::getEditors($helper->getHandler('permission')->getGrantedItems('editors'));
if (!is_object($GLOBALS['xoopsUser'])) {
$group = [XOOPS_GROUP_ANONYMOUS];
@@ -148,7 +149,7 @@ public function createElements($obj)
// Category
$categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
$categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
- $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit());
+ $categoryFormSelect->addOptionArray($helper->getHandler('category')->getCategoriesForSubmit());
$this->addElement($categoryFormSelect);
// ITEM TITLE
@@ -188,19 +189,19 @@ public function createElements($obj)
$editor = (null !== $GLOBALS['xoopsUser']->getVar('publisher_editor')) ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : ''; // Need set through user profile
}
}
- $editor = (empty($editor) || !in_array($editor, $allowedEditors)) ? $publisher->getConfig('submit_editor') : $editor;
+ $editor = (empty($editor) || !in_array($editor, $allowedEditors)) ? $helper->getConfig('submit_editor') : $editor;
$formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
$this->addElement($formEditor);
} else {
- $editor = $publisher->getConfig('submit_editor');
+ $editor = $helper->getConfig('submit_editor');
}
$editorConfigs = [];
- $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
- $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
- $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width');
- $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height');
+ $editorConfigs['rows'] = !$helper->getConfig('submit_editor_rows') ? 35 : $helper->getConfig('submit_editor_rows');
+ $editorConfigs['cols'] = !$helper->getConfig('submit_editor_cols') ? 60 : $helper->getConfig('submit_editor_cols');
+ $editorConfigs['width'] = !$helper->getConfig('submit_editor_width') ? '100%' : $helper->getConfig('submit_editor_width');
+ $editorConfigs['height'] = !$helper->getConfig('submit_editor_height') ? '400px' : $helper->getConfig('submit_editor_height');
// SUMMARY
if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) {
@@ -398,18 +399,18 @@ public function createElements($obj)
$js_data = new XoopsFormLabel('', '
diff --git a/print.php b/print.php
index f2c949b8..c6601708 100644
--- a/print.php
+++ b/print.php
@@ -32,7 +32,7 @@
}
// Creating the ITEM object for the selected ITEM
-$itemObj = $publisher->getHandler('item')->get($itemid);
+$itemObj = $helper->getHandler('item')->get($itemid);
// if the selected ITEM was not found, exit
if ($itemObj->notLoaded()) {
@@ -62,8 +62,8 @@
}
$xoopsTpl->assign('item', $item);
$xoopsTpl->assign('printtitle', $GLOBALS['xoopsConfig']['sitename'] . ' - ' . PublisherUtility::html2text($categoryObj->getCategoryPath()) . ' > ' . $myts->displayTarea($itemObj->getTitle()));
-$xoopsTpl->assign('printlogourl', $publisher->getConfig('print_logourl'));
-$xoopsTpl->assign('printheader', $myts->displayTarea($publisher->getConfig('print_header'), 1));
+$xoopsTpl->assign('printlogourl', $helper->getConfig('print_logourl'));
+$xoopsTpl->assign('printheader', $myts->displayTarea($helper->getConfig('print_header'), 1));
$xoopsTpl->assign('lang_category', _CO_PUBLISHER_CATEGORY);
$xoopsTpl->assign('lang_author_date', sprintf(_MD_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->getDatesub()));
@@ -77,13 +77,13 @@
$xoopsTpl->assign('smartPopup', $smartPopup);
$xoopsTpl->assign('current_language', $GLOBALS['xoopsConfig']['language']);
-if ('item footer' === $publisher->getConfig('print_footer') || 'both' === $publisher->getConfig('print_footer')) {
- $xoopsTpl->assign('itemfooter', $myts->displayTarea($publisher->getConfig('item_footer'), 1));
+if ('item footer' === $helper->getConfig('print_footer') || 'both' === $helper->getConfig('print_footer')) {
+ $xoopsTpl->assign('itemfooter', $myts->displayTarea($helper->getConfig('item_footer'), 1));
}
-if ('index footer' === $publisher->getConfig('print_footer') || 'both' === $publisher->getConfig('print_footer')) {
- $xoopsTpl->assign('indexfooter', $myts->displayTarea($publisher->getConfig('index_footer'), 1));
+if ('index footer' === $helper->getConfig('print_footer') || 'both' === $helper->getConfig('print_footer')) {
+ $xoopsTpl->assign('indexfooter', $myts->displayTarea($helper->getConfig('index_footer'), 1));
}
-$xoopsTpl->assign('display_whowhen_link', $publisher->getConfig('item_disp_whowhen_link'));
+$xoopsTpl->assign('display_whowhen_link', $helper->getConfig('item_disp_whowhen_link'));
$xoopsTpl->display('db:publisher_print.tpl');
diff --git a/rate.php b/rate.php
index e0026e0b..5874deec 100644
--- a/rate.php
+++ b/rate.php
@@ -31,10 +31,10 @@
$gpermHandler = xoops_getModuleHandler('groupperm');
/* @var $configHandler XoopsConfigHandler */
$configHandler = xoops_getHandler('config');
-$module_id = $publisher->getModule()->getVar('mid');
+$module_id = $helper->getModule()->getVar('mid');
//Checking permissions
-if (!$publisher->getConfig('perm_rating') || !$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_RATE, $groups, $module_id)) {
+if (!$helper->getConfig('perm_rating') || !$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_RATE, $groups, $module_id)) {
redirect_header(PUBLISHER_URL . '/item.php?itemid=' . $itemid, 2, _NOPERM);
// exit();
}
@@ -45,7 +45,7 @@
}
$criteria = new Criteria('itemid', $itemid);
-$ratingObjs = $publisher->getHandler('rating')->getObjects($criteria);
+$ratingObjs = $helper->getHandler('rating')->getObjects($criteria);
$uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
$count = count($ratingObjs);
@@ -66,19 +66,19 @@
// exit();
}
-$newRatingObj = $publisher->getHandler('rating')->create();
+$newRatingObj = $helper->getHandler('rating')->create();
$newRatingObj->setVar('itemid', $itemid);
$newRatingObj->setVar('ip', $ip);
$newRatingObj->setVar('uid', $uid);
$newRatingObj->setVar('rate', $rating);
$newRatingObj->setVar('date', time());
-$publisher->getHandler('rating')->insert($newRatingObj);
+$helper->getHandler('rating')->insert($newRatingObj);
$current_rating += $rating;
++$count;
-$publisher->getHandler('item')->updateAll('rating', number_format($current_rating / $count, 4), $criteria, true);
-$publisher->getHandler('item')->updateAll('votes', $count, $criteria, true);
+$helper->getHandler('item')->updateAll('rating', number_format($current_rating / $count, 4), $criteria, true);
+$helper->getHandler('item')->updateAll('votes', $count, $criteria, true);
redirect_header(PUBLISHER_URL . '/item.php?itemid=' . $itemid, 2, _MD_PUBLISHER_VOTE_THANKS);
//exit();
diff --git a/search.php b/search.php
index ddd3a36c..cbb2de40 100644
--- a/search.php
+++ b/search.php
@@ -33,10 +33,10 @@
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gpermHandler = xoops_getModuleHandler('groupperm', PUBLISHER_DIRNAME);
-$module_id = $publisher->getModule()->mid();
+$module_id = $helper->getModule()->mid();
//Checking permissions
-if (!$publisher->getConfig('perm_search') || !$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_SEARCH, $groups, $module_id)) {
+if (!$helper->getConfig('perm_search') || !$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_SEARCH, $groups, $module_id)) {
redirect_header(PUBLISHER_URL, 2, _NOPERM);
// exit();
}
@@ -45,10 +45,10 @@
$GLOBALS['xoopsOption']['template_main'] = 'publisher_search.tpl';
include $GLOBALS['xoops']->path('header.php');
-$module_info_search = $publisher->getModule()->getInfo('search');
+$module_info_search = $helper->getModule()->getInfo('search');
require_once PUBLISHER_ROOT_PATH . '/' . $module_info_search['file'];
-$limit = 10; //$publisher->getConfig('idxcat_perpage');
+$limit = 10; //$helper->getConfig('idxcat_perpage');
$uid = 0;
$queries = [];
$andor = Request::getString('andor', '', 'POST');
@@ -120,10 +120,9 @@
$next_search['sortby'] = $sortby;
$next_search['searchin'] = implode('|', $searchin);
+ $extra = '';
if (!empty($time)) {
$extra = '';
- } else {
- $extra = '';
}
if ($uname_required && (!$uid || count($uid) < 1)) {
@@ -197,7 +196,7 @@
$typeSelect .= '';
/* category */
-$categories = $publisher->getHandler('category')->getCategoriesForSearch();
+$categories = $helper->getHandler('category')->getCategoriesForSearch();
$categorySelect = ' |