@@ -22,13 +21,11 @@
use XoopsModules\Publisher;
-
require_once dirname(__DIR__) . '/preloads/autoloader.php';
$moduleDirName = basename(dirname(__DIR__));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
-/** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$helper->loadLanguage('common');
$helper->loadLanguage('feedback');
@@ -63,6 +60,15 @@
'link' => 'admin/item.php',
'icon' => $pathIcon32 . '/content.png',
];
+
+// Trello
+$adminmenu[] = [
+ 'title' => _MI_PUBLISHER_ADMENU7,
+ 'link' => 'admin/trello.php',
+ 'icon' => $pathIcon32 . '/extention.png',
+];
+
+
// Permissions
$adminmenu[] = [
'title' => _MI_PUBLISHER_ADMENU4,
diff --git a/admin/migrate.php b/admin/migrate.php
index e62ee881..f6d2d209 100644
--- a/admin/migrate.php
+++ b/admin/migrate.php
@@ -55,13 +55,11 @@
//XoopsLoad::load('migrate', 'newbb');
-/** @var Publisher\Common\Configurator $configurator */
$configurator = new Publisher\Common\Configurator();
-/** @var \XoopsModules\Publisher\Common\Migrate $migrator */
-$migrator = new \XoopsModules\Publisher\Common\Migrate($configurator);
+$migrator = new \XoopsModules\Publisher\Common\Migrate($configurator = null);
-$op = Request::getCmd('op', 'default');
+$op = Request::getCmd('op', 'show');
$opShow = Request::getCmd('show', null, 'POST');
$opMigrate = Request::getCmd('migrate', null, 'POST');
$opSchema = Request::getCmd('schema', null, 'POST');
@@ -73,6 +71,7 @@
switch ($op) {
case 'show':
+ default:
$queue = $migrator->getSynchronizeDDL();
if (!empty($queue)) {
echo "\n";
@@ -84,15 +83,16 @@
break;
case 'migrate':
$migrator->synchronizeSchema();
- $message = 'Database migrated to current schema.';
+ $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
break;
case 'schema':
- xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm');
+ xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
break;
case 'confirmwrite':
if ($GLOBALS['xoopsSecurity']->check()) {
$migrator->saveCurrentSchema();
- $message = 'Current schema file written';
+
+ $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
}
break;
}
diff --git a/admin/mimetypes.php b/admin/mimetypes.php
index dd742069..e3120561 100644
--- a/admin/mimetypes.php
+++ b/admin/mimetypes.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Admin
- * @subpackage Action
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -23,6 +21,7 @@
use Xmf\Request;
use XoopsModules\Publisher;
+use XoopsModules\Publisher\MimetypesUtility;
require_once __DIR__ . '/admin_header.php';
xoops_load('XoopsPagenav');
@@ -52,31 +51,31 @@
switch ($op) {
case 'add':
- Publisher\MimetypesUtility::add();
+ MimetypesUtility::add();
break;
case 'delete':
- Publisher\MimetypesUtility::delete();
+ MimetypesUtility::delete();
break;
case 'edit':
- Publisher\MimetypesUtility::edit();
+ MimetypesUtility::edit();
break;
case 'search':
- Publisher\MimetypesUtility::search();
+ MimetypesUtility::search();
break;
case 'updateMimeValue':
- Publisher\MimetypesUtility::updateMimeValue();
+ MimetypesUtility::updateMimeValue();
break;
case 'confirmUpdateMimeValue':
- Publisher\MimetypesUtility::confirmUpdateMimeValue();
+ MimetypesUtility::confirmUpdateMimeValue();
break;
case 'clearAddSession':
- Publisher\MimetypesUtility::clearAddSession();
+ MimetypesUtility::clearAddSession();
break;
case 'clearEditSession':
- Publisher\MimetypesUtility::clearEditSession();
+ MimetypesUtility::clearEditSession();
break;
case 'manage':
default:
- Publisher\MimetypesUtility::manage();
+ MimetypesUtility::manage();
break;
}
diff --git a/admin/pagewrap.php b/admin/pagewrap.php
index bf547e25..f3809fc7 100644
--- a/admin/pagewrap.php
+++ b/admin/pagewrap.php
@@ -14,22 +14,22 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
require_once __DIR__ . '/admin_header.php';
-Publisher\Utility::cpHeader();
+Utility::cpHeader();
//publisher_adminMenu(-1, _AM_PUBLISHER_ITEMS . " > " . _AM_PUBLISHER_PAGEWRAP);
-Publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
+Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
-$dir = Publisher\Utility::getUploadDir(true, 'content');
+$dir = Utility::getUploadDir(true, 'content');
if (false !== mb_strpos(decoct(fileperms($dir)), '777')) {
echo "" . _AM_PUBLISHER_PERMERROR . ' ';
@@ -47,7 +47,7 @@
// Delete File
$form = new \XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php');
-$pWrapSelect = new \XoopsFormSelect(Publisher\Utility::getUploadDir(true, 'content'), 'address');
+$pWrapSelect = new \XoopsFormSelect(Utility::getUploadDir(true, 'content'), 'address');
$folder = dir($dir);
while ($file == $folder->read()) {
if ('.' !== $file && '..' !== $file) {
@@ -63,6 +63,6 @@
$form->addElement($submit);
$form->display();
-Publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon');
+Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon');
require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/permissions.php b/admin/permissions.php
index c0970ce1..9d5fcd7d 100644
--- a/admin/permissions.php
+++ b/admin/permissions.php
@@ -14,7 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -22,21 +21,21 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
+use XoopsModules\Publisher\Utility;
require_once __DIR__ . '/admin_header.php';
require_once dirname(__DIR__) . '/include/common.php';
require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php');
$myts = \MyTextSanitizer::getInstance();
-Publisher\Utility::cpHeader();
+Utility::cpHeader();
//publisher_adminMenu(3, _AM_PUBLISHER_PERMISSIONS);
-/** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
// View Categories permissions
$item_list_view = [];
$block_view = [];
-Publisher\Utility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS);
+Utility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS);
$result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
@@ -48,11 +47,11 @@
} else {
echo _AM_PUBLISHER_NOPERMSSET;
}
-Publisher\Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view');
+Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view');
// Submit Categories permissions
echo " \n";
-Publisher\Utility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
+Utility::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($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
$form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'item_submit', '', 'admin/permissions.php');
@@ -63,11 +62,11 @@
} else {
echo _AM_PUBLISHER_NOPERMSSET;
}
-Publisher\Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit');
+Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit');
// Moderators Categories permissions
echo " \n";
-Publisher\Utility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
+Utility::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($helper->getDirname() . '_categories') . ' ');
if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) {
$form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php');
@@ -78,11 +77,11 @@
} else {
echo _AM_PUBLISHER_NOPERMSSET;
}
-Publisher\Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation');
+Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation');
// Form permissions
echo " \n";
-Publisher\Utility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC);
+Utility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC);
$form_options = [
Constants::PUBLISHER_SUMMARY => _AM_PUBLISHER_SUMMARY,
//Constants::PUBLISHER_DISPLAY_SUMMARY => _CO_PUBLISHER_DISPLAY_SUMMARY,
@@ -118,23 +117,23 @@
}
unset($key, $value);
echo $form_submit->render();
-Publisher\Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form');
+Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form');
// Editors permissions
echo " \n";
-Publisher\Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC);
-$editors = Publisher\Utility::getEditors();
+Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC);
+$editors = Utility::getEditors();
$form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'editors', '', 'admin/permissions.php');
foreach ($editors as $key => $value) {
$form_submit->addItem($key, $value['title']);
}
unset($key, $value);
echo $form_submit->render();
-Publisher\Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors');
+Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors');
// Global permissions
echo " \n";
-Publisher\Utility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC);
+Utility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC);
$form_options = [
Constants::PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH,
Constants::PUBLISHER_RATE => _AM_PUBLISHER_RATE,
@@ -145,6 +144,6 @@
}
unset($key, $value);
echo $form_submit->render();
-Publisher\Utility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global');
+Utility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global');
require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/preferences.php b/admin/preferences.php
index 175ec61a..50098db9 100644
--- a/admin/preferences.php
+++ b/admin/preferences.php
@@ -14,7 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author Kazumi Ono (AKA onokazu)
@@ -22,10 +21,10 @@
use Xmf\Request;
use XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
require_once __DIR__ . '/admin_header.php';
-/** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$module = $helper->getModule();
@@ -66,7 +65,7 @@
$xv_configs = $module->getInfo('config');
$config_cats = $module->getInfo('configcat');
- if (!array_key_exists('others', $config_cats)) {
+ if (is_array($config_cats) && !array_key_exists('others', $config_cats)) {
$config_cats['others'] = [
'name' => _MI_PUBLISHER_CONFCAT_OTHERS,
'description' => _MI_PUBLISHER_CONFCAT_OTHERS_DSC,
@@ -86,10 +85,12 @@
xoops_load('XoopsFormLoader');
- foreach ($config_cats as $formCat => $info) {
- $$formCat = new \XoopsThemeForm($info['name'], 'pref_form_' . $formCat, 'preferences.php', 'post', true);
+ if (is_array($config_cats)) {
+ foreach ($config_cats as $formCat => $info) {
+ $$formCat = new \XoopsThemeForm($info['name'], 'pref_form_' . $formCat, 'preferences.php', 'post', true);
+ }
+ unset($formCat, $info);
}
- unset($formCat, $info);
for ($i = 0; $i < $count; ++$i) {
foreach ($xv_configs as $xv_config) {
@@ -102,7 +103,7 @@
$formCat = $xv_config['category'] ?? '';
unset($xv_config);
- if (!array_key_exists($formCat, $config_cats)) {
+ if (is_array($config_cats) && !array_key_exists($formCat, $config_cats)) {
$formCat = 'others';
$cat_others_used = true;
}
@@ -177,12 +178,14 @@
break;
}
$hidden = new \XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id'));
- $$formCat->addElement($ele);
- $$formCat->addElement($hidden);
- unset($ele, $hidden);
+ if (isset($$formCat) && null !== $$formCat) {
+ $$formCat->addElement($ele);
+ $$formCat->addElement($hidden);
+ unset($ele, $hidden);
+ }
}
- Publisher\Utility::cpHeader();
+ Utility::cpHeader();
//publisher_adminMenu(5, _PREFERENCES);
foreach ($config_cats as $formCat => $info) {
if ('others' === $formCat && !$cat_others_used) {
@@ -190,9 +193,9 @@
}
$$formCat->addElement(new \XoopsFormHidden('op', 'save'));
$$formCat->addElement(new \XoopsFormButton('', 'button', _GO, 'submit'));
- Publisher\Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']);
+ Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']);
$$formCat->display();
- Publisher\Utility::closeCollapsableBar($formCat . '_table', $formCat . '_icon');
+ Utility::closeCollapsableBar($formCat . '_table', $formCat . '_icon');
}
unset($formCat, $info);
xoops_cp_footer();
diff --git a/admin/pw_delete_file.php b/admin/pw_delete_file.php
index 2b4f500e..6deffb04 100644
--- a/admin/pw_delete_file.php
+++ b/admin/pw_delete_file.php
@@ -14,7 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
diff --git a/admin/pw_upload_file.php b/admin/pw_upload_file.php
index bad30106..a653ecc9 100644
--- a/admin/pw_upload_file.php
+++ b/admin/pw_upload_file.php
@@ -14,7 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -22,6 +21,7 @@
use Xmf\Request;
use XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
require_once __DIR__ . '/admin_header.php';
@@ -45,7 +45,6 @@ function publisher_pagewrap_upload(&$errors)
// require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
xoops_load('XoopsMediaUploader');
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$postField = 'fileupload';
@@ -53,13 +52,13 @@ function publisher_pagewrap_upload(&$errors)
$maxImageWidth = $helper->getConfig('maximum_image_width');
$maxImageHeight = $helper->getConfig('maximum_image_height');
- if (!is_dir(Publisher\Utility::getUploadDir(true, 'content'))) {
- if (!mkdir($concurrentDirectory = Publisher\Utility::getUploadDir(true, 'content'), 0757) && !is_dir($concurrentDirectory)) {
+ if (!is_dir(Utility::getUploadDir(true, 'content'))) {
+ if (!mkdir($concurrentDirectory = Utility::getUploadDir(true, 'content'), 0757) && !is_dir($concurrentDirectory)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
}
}
$allowedMimeTypes = ['text/html', 'text/plain', 'application/xhtml+xml'];
- $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
+ $uploader = new \XoopsMediaUploader(Utility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
if ($uploader->fetchMedia($postField)) {
$uploader->setTargetFileName($uploader->getMediaName());
if ($uploader->upload()) {
diff --git a/admin/trello.php b/admin/trello.php
new file mode 100644
index 00000000..96dd9962
--- /dev/null
+++ b/admin/trello.php
@@ -0,0 +1,38 @@
+displayNavigation(basename(__FILE__));
+
+$statusArray = [
+ Constants::PUBLISHER_STATUS_SUBMITTED => \_CO_PUBLISHER_SUBMITTED,
+ Constants::PUBLISHER_STATUS_PUBLISHED => \_CO_PUBLISHER_PUBLISHED,
+ Constants::PUBLISHER_STATUS_OFFLINE => \_CO_PUBLISHER_OFFLINE,
+ Constants::PUBLISHER_STATUS_REJECTED => \_CO_PUBLISHER_REJECTED,
+];
+
+$projectName = 'StartTuts';
+$trelloManagement = new TrelloManagement();
+$statusResult = $trelloManagement->getAllStatus();
+
+foreach ($statusResult as $statusRow) {
+// $itemResult[] = $trelloManagement->getProjectTaskByStatus($statusRow['id'], $projectName);
+// $itemResult[] = $trelloManagement->getProjectTaskByStatus($statusRow['itemid'], $statusRow['itemid']);
+}
+
+//$xoopsTpl->assign('taskResult', $itemResult);
+$xoopsTpl->assign('statusResult', $statusResult);
+$xoopsTpl->assign('itemResult', $statusResult);
+$xoopsTpl->assign('statusArray', $statusArray);
+$xoopsTpl->assign('publisher_url', PUBLISHER_URL);
+
+
+require_once __DIR__ . '/admin_footer.php';
diff --git a/admin/trellostatus.php b/admin/trellostatus.php
new file mode 100644
index 00000000..147ec2a8
--- /dev/null
+++ b/admin/trellostatus.php
@@ -0,0 +1,10 @@
+editTaskStatus($statusId, $itemId);
diff --git a/archive.php b/archive.php
index 5c22c441..e5c5f775 100644
--- a/archive.php
+++ b/archive.php
@@ -14,7 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author Bandit-X
* @author trabis
@@ -163,18 +162,18 @@
$xoopsTpl->assign('lang_actions', _MD_PUBLISHER_ACTIONS);
$xoopsTpl->assign('lang_date', _MD_PUBLISHER_DATE);
$xoopsTpl->assign('lang_views', _MD_PUBLISHER_HITS);
- $xoopsTpl->assign('lang_category', _MD_PUBLISHER_CATEGORY);
+ $xoopsTpl->assign('lang_category', _MD_PUBLISHER_CATEGORY);
$xoopsTpl->assign('lang_author', _MD_PUBLISHER_AUTHOR);
-
+
// must adjust the selected time to server timestamp
- $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ'];
- $timeoffsethours = (int)$timeoffset;
- $timeoffsetminutes = intval(($timeoffset - $timeoffsethours) * 60);
+ $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ'];
+ $timeoffsethours = (int)$timeoffset;
+ $timeoffsetminutes = ($timeoffset - $timeoffsethours) * 60;
$monthstart = mktime(0 - $timeoffsethours, 0 - $timeoffsetminutes, 0, $frommonth, 1, $fromyear);
$monthend = mktime(23 - $timeoffsethours, 59 - $timeoffsetminutes, 59, $frommonth + 1, 0, $fromyear);
- $monthend = ($monthend > time()) ? time() : $monthend;
+ $monthend = ($monthend > time()) ? time() : $monthend;
$count = 0;
@@ -203,33 +202,33 @@
foreach ($storyarray as $item) {
$story = [];
- $htmltitle = '';
+ $htmltitle = '';
$story['title'] = "' . $item->getTitle() . ' ';
$story['cleantitle'] = strip_tags($item->getTitle());
- $story['itemurl'] = $item->getItemUrl();
- $story['category'] = "categoryid() . "'>" . $item->getCategoryName() . ' ';
- $story['counter'] = $item->counter();
+ $story['itemurl'] = $item->getItemUrl();
+ $story['category'] = "categoryid() . "'>" . $item->getCategoryName() . ' ';
+ $story['counter'] = $item->counter();
$story['date'] = $item->getDatesub();
$story['print_link'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/print.php?itemid=' . $item->itemid();
$story['mail_link'] = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $item->getItemUrl();
$story['pdf_link'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/makepdf.php?itemid=' . $item->itemid();
$story['author'] = $item->getWho();
- $story['summary'] = $item->getSummary();
- $story['cancomment'] = $item->cancomment();
-
- $mainImage = $item->getMainImage();
- if (empty($mainImage['image_path'])) {
- $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
- //check to see if GD function exist
+ $story['summary'] = $item->getSummary();
+ $story['cancomment'] = $item->cancomment();
+
+ $mainImage = $item->getMainImage();
+ if (empty($mainImage['image_path'])) {
+ $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ }
+ //check to see if GD function exist
if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) {
- $story['item_image'] = $mainImage['path'];
+ $story['item_image'] = $mainImage['path'];
} else {
- $story['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
- $story['image_path'] = $mainImage['image_path'];
- }
-
- $comments = $item->comments();
+ $story['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
+ $story['image_path'] = $mainImage['image_path'];
+ }
+
+ $comments = $item->comments();
if ($comments > 0) {
//shows 1 comment instead of 1 comm. if comments ==1
//langugage file modified accordingly
@@ -239,11 +238,11 @@
$story['comment'] = ' ' . $comments . ' ' . _MD_PUBLISHER_COMMENTS . ' ';
}
} else {
- $story['comment'] = ' ' . _MD_PUBLISHER_NO_COMMENTS . ' ';
+ $story['comment'] = ' ' . _MD_PUBLISHER_NO_COMMENTS . ' ';
}
$xoopsTpl->append('stories', $story);
}
- //unset($item);
+ //unset($item);
}
$xoopsTpl->assign('lang_printer', _MD_PUBLISHER_PRINTERFRIENDLY);
$xoopsTpl->assign('lang_sendstory', _MD_PUBLISHER_SENDSTORY);
@@ -251,7 +250,7 @@
} else {
$xoopsTpl->assign('show_articles', false);
}
-
+
$xoopsTpl->assign('lang_newsarchives', _MD_PUBLISHER_ARCHIVES);
require_once $GLOBALS['xoops']->path('footer.php');
diff --git a/assets/css/publisher.css b/assets/css/publisher.css
index c3ab737b..08f39b85 100644
--- a/assets/css/publisher.css
+++ b/assets/css/publisher.css
@@ -269,7 +269,7 @@ ul.publisher_breadcrumb li {
}
ul.publisher_breadcrumb li+li:before {
padding: 8px;
- color: black;
+ color: #000000;
content: "/\00a0";
}
ul.publisher_breadcrumb li a {
diff --git a/assets/css/trello.css b/assets/css/trello.css
new file mode 100644
index 00000000..d01cace2
--- /dev/null
+++ b/assets/css/trello.css
@@ -0,0 +1,73 @@
+body {
+ font-family: arial;
+}
+.task-board {
+ background: #2c7cbc;
+ display: inline-block;
+ padding: 12px;
+ border-radius: 3px;
+ width: 98%;
+ white-space: nowrap;
+ overflow-x: scroll;
+ min-height: 300px;
+}
+
+.status-card {
+ width: 250px;
+ margin-right: 8px;
+ background: #e2e4e6;
+ border-radius: 3px;
+ display: inline-block;
+ vertical-align: top;
+ font-size: 0.9em;
+}
+
+.status-card:last-child {
+ margin-right: 0px;
+}
+
+.card-header {
+ width: 100%;
+ padding: 10px 10px 0px 10px;
+ box-sizing: border-box;
+ border-radius: 3px;
+ display: block;
+ font-weight: bold;
+}
+
+.card-header-text {
+ display: block;
+}
+
+ul.sortable {
+ padding-bottom: 10px;
+}
+
+ul.sortable li:last-child {
+ margin-bottom: 0px;
+}
+
+ul {
+ list-style: none;
+ margin: 0;
+ padding: 0px;
+}
+
+.text-row {
+ padding: 15px 10px;
+ margin: 10px;
+ background: #fff;
+ box-sizing: border-box;
+ border-radius: 3px;
+ border-bottom: 1px solid #ccc;
+ cursor: pointer;
+ font-size: 0.8em;
+ white-space: normal;
+ line-height: 20px;
+}
+
+.ui-sortable-placeholder {
+ visibility: inherit !important;
+ background: transparent;
+ border: #666 2px dashed;
+}
diff --git a/assets/js/trello.js b/assets/js/trello.js
new file mode 100644
index 00000000..85e22176
--- /dev/null
+++ b/assets/js/trello.js
@@ -0,0 +1,15 @@
+$( function() {
+ var url = 'trellostatus.php';
+ $('ul[itemid^="sort"]').sortable({
+ connectWith: ".sortable",
+ receive: function (e, ui) {
+ var status_id = $(ui.item).parent(".sortable").data("status-id");
+ var item_id = $(ui.item).data("item-id");
+ $.ajax({
+ url: url+'?status='+status_id+'&itemid='+item_id,
+ success: function(response){
+ }
+ });
+ }
+ }).disableSelection();
+} );
diff --git a/author_items.php b/author_items.php
index d4698f8f..44c92919 100644
--- a/author_items.php
+++ b/author_items.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Action
* @since 1.0
* @author trabis
*/
@@ -59,8 +57,8 @@
$xoopsTpl->assign('permRating', $helper->getConfig('perm_rating'));
xoops_load('XoopsUserUtility');
-$author_name = \XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true);
-$xoopsTpl->assign('author_name_with_link', $author_name);
+$authorName = \XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true);
+$xoopsTpl->assign('author_name_with_link', $authorName);
$xoopsTpl->assign('user_avatarurl', XOOPS_URL . '/uploads/' . $thisuser->getVar('user_avatar'));
//$xoopsLocal = new \XoopsLocal();
$categories = [];
@@ -77,55 +75,53 @@
];
}
//mb start
- $mainImage = $item->getMainImage();
- if (empty($mainImage['image_path'])) {
+ $mainImage = $item->getMainImage();
+ if (empty($mainImage['image_path'])) {
$mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
+ }
// check to see if GD function exist
if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) {
$image = $mainImage['image_path'];
} else {
- $image = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
- }
+ $image = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
+ }
//mb end
- $comments = $item->comments();
- if ($comments > 0) {
- //shows 1 comment instead of 1 comm. if comments ==1
- //langugage file modified accordingly
- if (1 == $comments) {
- $comment = ' ' . _MB_PUBLISHER_ONECOMMENT . ' ';
- } else {
- $comment = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' ';
- }
+ $comments = $item->comments();
+ if ($comments > 0) {
+ //shows 1 comment instead of 1 comm. if comments ==1
+ //langugage file modified accordingly
+ if (1 == $comments) {
+ $comment = ' ' . _MB_PUBLISHER_ONECOMMENT . ' ';
} else {
- $comment = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
+ $comment = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' ';
}
-
-
-
+ } else {
+ $comment = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
+ }
+
$categories[$catId]['count_items']++;
$categories[$catId]['count_hits'] += $item->counter();
$categories[$catId]['items'][] = [
- 'title' => $item->getTitle(),
- 'cleantitle'=> strip_tags($item->getTitle()),
- 'itemurl' => $item->getItemUrl(),
- 'summary' => $item->getSummary(),
- 'comment' => $comment,
- 'cancomment'=> $item->cancomment(),
- 'hits' => $item->counter(),
- 'link' => $item->getItemLink(),
- 'published' => $item->getDatesub(),
- //'published' => $item->getDatesub(_SHORTDATESTRING),
+ 'title' => $item->getTitle(),
+ 'cleantitle' => strip_tags($item->getTitle()),
+ 'itemurl' => $item->getItemUrl(),
+ 'summary' => $item->getSummary(),
+ 'comment' => $comment,
+ 'cancomment' => $item->cancomment(),
+ 'hits' => $item->counter(),
+ 'link' => $item->getItemLink(),
+ 'published' => $item->getDatesub(),
+ //'published' => $item->getDatesub(_SHORTDATESTRING),
//'rating' => $xoopsLocal->number_format((float)$item->rating())
- 'rating' => $item->rating(),
- 'image' => $image,
+ 'rating' => $item->rating(),
+ 'image' => $image,
];
}
}
unset($item);
$xoopsTpl->assign('categories', $categories);
-$title = _MD_PUBLISHER_ITEMS_SAME_AUTHOR . ' - ' . $author_name;
+$title = _MD_PUBLISHER_ITEMS_SAME_AUTHOR . ' - ' . $authorName;
/**
* Generating meta information for this page
diff --git a/backend.php b/backend.php
index 24846f9e..e145f047 100644
--- a/backend.php
+++ b/backend.php
@@ -14,15 +14,12 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Action
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use Xmf\Request;
-use XoopsModules\Publisher;
require_once __DIR__ . '/header.php';
//xoops_load('XoopsLocal'); //mb
@@ -35,10 +32,10 @@
mb_http_output('pass');
}
-$categoryid = Request::getInt('categoryid', -1, 'GET');
+$categoryId = Request::getInt('categoryid', -1, 'GET');
-if (-1 != $categoryid) {
- $categoryObj = $helper->getHandler('Category')->get($categoryid);
+if (-1 != $categoryId) {
+ $categoryObj = $helper->getHandler('Category')->get($categoryId);
}
header('Content-Type:text/xml; charset=' . _CHARSET);
@@ -46,15 +43,15 @@
$tpl->caching = 2;
//$tpl->xoops_setCacheTime(0);
$tpl->cache_lifetime = 0;
-$myts = \MyTextSanitizer::getInstance();
+$myts = \MyTextSanitizer::getInstance();
if (!$tpl->is_cached('db:publisher_rss.tpl')) {
// xoops_load('XoopsLocal');
- $channel_category = $helper->getModule()->name();
+ $channelCategory = $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']);
$GLOBALS['xoopsConfig']['slogan'] = $myts->formatForML($GLOBALS['xoopsConfig']['slogan']);
- $channel_category = $myts->formatForML($channel_category);
+ $channelCategory = $myts->formatForML($channelCategory);
}
$tpl->assign('channel_charset', _CHARSET);
$tpl->assign('channel_title', htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5));
@@ -65,11 +62,11 @@
$tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )');
$tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )');
- if (-1 != $categoryid) {
- $channel_category .= ' > ' . $categoryObj->name();
+ if (-1 != $categoryId) {
+ $channelCategory .= ' > ' . $categoryObj->name();
}
- $tpl->assign('channel_category', htmlspecialchars($channel_category, ENT_QUOTES | ENT_HTML5));
+ $tpl->assign('channelCategory', htmlspecialchars($channelCategory, ENT_QUOTES | ENT_HTML5));
$tpl->assign('channel_generator', $helper->getModule()->name());
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.png');
@@ -85,18 +82,18 @@
$height = round($height, 0, PHP_ROUND_HALF_UP);
$tpl->assign('image_width', $width);
$tpl->assign('image_height', $height);
- $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryid);
+ $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryId);
if (!empty($sarray) && is_array($sarray)) {
$count = $sarray;
foreach ($sarray as $item) {
$tpl->append(
'items',
[
- 'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES | ENT_HTML5),
- 'link' => htmlspecialchars($item->getItemUrl(), ENT_QUOTES | ENT_HTML5),
- 'guid' => $item->getItemUrl(),
- //mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
- 'pubdate' => formatTimestamp($item->getVar('datesub'), 'rss'),
+ 'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES | ENT_HTML5),
+ 'link' => htmlspecialchars($item->getItemUrl(), ENT_QUOTES | ENT_HTML5),
+ 'guid' => $item->getItemUrl(),
+ //mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
+ 'pubdate' => formatTimestamp($item->getVar('datesub'), 'rss'),
'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES | ENT_HTML5),
]
);
diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php
index 98e42e05..149eb164 100644
--- a/blocks/category_items_sel.php
+++ b/blocks/category_items_sel.php
@@ -14,16 +14,13 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
*/
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
@@ -34,7 +31,6 @@
*/
function publisher_category_items_sel_show($options)
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$block = $item = [];
@@ -49,14 +45,14 @@ function publisher_category_items_sel_show($options)
$selectedcatids = explode(',', $options[0]);
$sort = $options[1];
- $order = Publisher\Utility::getOrderBy($sort);
+ $order = Utility::getOrderBy($sort);
$limit = $options[2];
$start = 0;
// creating the ITEM objects that belong to the selected category
$block['categories'] = [];
foreach ($categories as $catId => $catObj) {
- if (!in_array(0, $selectedcatids) && !in_array($catId, $selectedcatids)) {
+ if (!in_array(0, $selectedcatids, true) && !in_array($catId, $selectedcatids, true)) {
continue;
}
@@ -95,10 +91,6 @@ function publisher_category_items_sel_show($options)
unset($items, $categories, $itemObj, $catId, $catObj);
- if (0 === count($block['categories'])) {
- return $block;
- }
-
return $block;
}
@@ -114,7 +106,7 @@ function publisher_category_items_sel_edit($options)
$form = new Publisher\BlockForm();
- $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0]), 'options[0]');
+ $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0]), 'options[0]');
$orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
$orderEle->addOptionArray(
[
diff --git a/blocks/date_to_date.php b/blocks/date_to_date.php
index 2abf5e6d..904a6391 100644
--- a/blocks/date_to_date.php
+++ b/blocks/date_to_date.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -23,8 +21,6 @@
use XoopsModules\Publisher;
-
-
require_once dirname(__DIR__) . '/include/common.php';
/**
@@ -35,7 +31,6 @@
function publisher_date_to_date_show($options)
{
$myts = \MyTextSanitizer::getInstance();
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$block = $newItems = [];
diff --git a/blocks/items_columns.php b/blocks/items_columns.php
index f1fbde02..b4bf72e3 100644
--- a/blocks/items_columns.php
+++ b/blocks/items_columns.php
@@ -14,30 +14,26 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author Bandit-x
*/
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
/***
* Function To Show Publisher Items From Categories In Their Own Columns
*
- * @param array $options Block Options
+ * @param array $options Block Options
*
* @return bool|array
*/
function publisher_items_columns_show($options)
{
// global $xoTheme;
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\CategoryHandler $categoryHandler */
$categoryHandler = $helper->getHandler('Category');
@@ -60,9 +56,9 @@ function publisher_items_columns_show($options)
$categoriesObj = $categoryHandler->getCategories(0, 0, -1);
//if not selected 'all', let's get the selected ones
- if (!in_array(0, $selCategories)) {
+ if (!in_array(0, $selCategories, true)) {
foreach ($categoriesObj as $key => $value) {
- if (in_array($key, $selCategories)) {
+ if (in_array($key, $selCategories, true)) {
$selCategoriesObj[$key] = $value;
}
}
@@ -98,10 +94,10 @@ function publisher_items_columns_show($options)
$mainItem['itemurl'] = $thisItem->getItemUrl();
$mainItem['date'] = $thisItem->getDatesub();
- $mainImage = $thisItem->getMainImage();
+ $mainImage = $thisItem->getMainImage();
if (empty($mainImage['image_path'])) {
- $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
+ $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ }
// check to see if GD function exist
$mainItem['item_image'] = $mainImage['image_path'];
if (!empty($mainImage['image_path']) && function_exists('imagecreatetruecolor')) {
@@ -118,15 +114,15 @@ function publisher_items_columns_show($options)
//The Rest
if ($scount > 1) {
- // while ((list($itemid, $thisItem) = each($categoryItemsObj)) !== false) {
- foreach ($categoryItemsObj as $itemid => $thisItem) {
+ // while ((list($itemId, $thisItem) = each($categoryItemsObj)) !== false) {
+ foreach ($categoryItemsObj as $itemId => $thisItem) {
//TODO do I need to start with 2nd element?
$subItem['title'] = $thisItem->getTitle();
$subItem['cleantitle'] = strip_tags($thisItem->getTitle());
$subItem['link'] = $thisItem->getItemLink();
$subItem['itemurl'] = $thisItem->getItemUrl();
$subItem['summary'] = $thisItem->getBlockSummary($optCatTruncate);
- $subItem['date'] = $thisItem->getDatesub();
+ $subItem['date'] = $thisItem->getDatesub();
$mainItem['subitem'][] = $subItem;
unset($subItem);
}
@@ -142,11 +138,11 @@ function publisher_items_columns_show($options)
}
unset($categoryId, $mainItemCatObj);
- $block['template'] = $options[4];
- $block['columns'] = $columns;
- $block['columnwidth'] = (int)(100 / $optNumColumns);
- $block['display_datemainitem'] = $options[5];
- $block['display_datesubitem'] = $options[6];
+ $block['template'] = $options[4];
+ $block['columns'] = $columns;
+ $block['columnwidth'] = (int)(100 / $optNumColumns);
+ $block['display_datemainitem'] = $options[5] ?? '';
+ $block['display_datesubitem'] = $options[6] ?? '';
$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css');
@@ -156,7 +152,7 @@ function publisher_items_columns_show($options)
/***
* Edit Function For Multi-Column Category Items Display Block
*
- * @param array $options Block Options
+ * @param array $options Block Options
*
* @return string
*/
@@ -169,34 +165,36 @@ function publisher_items_columns_edit($options)
$colEle = new \XoopsFormSelect(_MB_PUBLISHER_NUMBER_COLUMN_VIEW, 'options[0]', $options[0]);
$colEle->addOptionArray(
[
- '1' => 1,
- '2' => 2,
- '3' => 3,
- '4' => 4,
- '5' => 5,
+ '1' => 1,
+ '2' => 2,
+ '3' => 3,
+ '4' => 4,
+ '5' => 5,
]
);
- $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[1], 0, true, 'options[1]'));
+ $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[1], 0, true, 'options[1]'));
- $cItemsEle = new \XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]);
+ $cItemsEle = new \XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]);
$truncateEle = new \XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[3]', 4, 255, $options[3]);
$tempEle = new \XoopsFormSelect(_MB_PUBLISHER_TEMPLATE, 'options[4]', $options[4]);
$tempEle->addOptionArray(
[
- 'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL,
- 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED,
- ]);
+ 'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL,
+ 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED,
+ ]
+ );
$dateMain = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_MAINITEM, 'options[5]', $options[5]);
- $dateSub = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_SUBITEM, 'options[6]', $options[6]);
+ $dateSub = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_SUBITEM, 'options[6]', $options[6]);
$form->addElement($colEle);
$form->addElement($catEle);
$form->addElement($cItemsEle);
$form->addElement($truncateEle);
$form->addElement($tempEle);
- $form->addElement($dateMain);
- $form->addElement($dateSub);
+ $form->addElement($dateMain);
+ $form->addElement($dateSub);
+
return $form->render();
}
diff --git a/blocks/items_menu.php b/blocks/items_menu.php
index b5a92ef8..acbcc93e 100644
--- a/blocks/items_menu.php
+++ b/blocks/items_menu.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -23,8 +21,7 @@
use Xmf\Request;
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
@@ -37,7 +34,6 @@ function publisher_items_menu_show($options)
{
$block = [];
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
// Getting all top cats
@@ -54,13 +50,13 @@ function publisher_items_menu_show($options)
$catLinkClass = 'menuMain';
- $categoryid = 0;
+ $categoryId = 0;
if ($block['inModule']) {
// Are we in a category and if yes, in which one ?
- $categoryid = Request::getInt('categoryid', 0, 'GET');
+ $categoryId = Request::getInt('categoryid', 0, 'GET');
- if (0 != $categoryid) {
+ if (0 != $categoryId) {
// if we are in a category, then the $categoryObj is already defined in publisher/category.php
global $categoryObj;
$block['currentcat'] = $categoryObj->getCategoryLink('menuTop');
@@ -69,7 +65,7 @@ function publisher_items_menu_show($options)
}
foreach ($blockCategoriesObj as $catId => $blockCategoryObj) {
- if ($catId != $categoryid) {
+ if ($catId != $categoryId) {
$block['categories'][$catId]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass);
}
}
@@ -89,7 +85,7 @@ function publisher_items_menu_edit($options)
$form = new Publisher\BlockForm();
- $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]'));
+ $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]'));
$orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
$orderEle->addOptionArray(
[
diff --git a/blocks/items_new.php b/blocks/items_new.php
index 537a2a68..42b0377b 100644
--- a/blocks/items_new.php
+++ b/blocks/items_new.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -24,8 +22,6 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
require_once dirname(__DIR__) . '/include/common.php';
/**
@@ -35,7 +31,6 @@
*/
function publisher_items_new_show($options)
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\ItemHandler $itemHandler */
$itemHandler = $helper->getHandler('Item');
@@ -44,7 +39,7 @@ function publisher_items_new_show($options)
$block = [];
$allcats = false;
- if (in_array(0, $selectedcatids)) {
+ if (in_array(0, $selectedcatids, true)) {
$allcats = true;
}
@@ -62,42 +57,42 @@ function publisher_items_new_show($options)
$criteria->add(new \Criteria('categoryid', '(' . $options[0] . ')', 'IN'));
}
- $publisherIsAdmin = $helper->isUserAdmin();
- if (!$publisherIsAdmin) {
- if (null === $criteria) {
- $criteria = new \CriteriaCompo();
- }
- $criteriaDateSub = new \Criteria('datesub', time(), '<=');
- $criteria->add($criteriaDateSub);
+ $publisherIsAdmin = $helper->isUserAdmin();
+ if (!$publisherIsAdmin) {
+ if (null === $criteria) {
+ $criteria = new \CriteriaCompo();
}
+ $criteriaDateSub = new \Criteria('datesub', time(), '<=');
+ $criteria->add($criteriaDateSub);
+ }
-// $optCatItems = (int)$options[2];
-// $categoryId = -1;
-// $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId);
+ // $optCatItems = (int)$options[2];
+ // $categoryId = -1;
+ // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId);
$itemsObj = $itemHandler->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none');
$totalitems = count($itemsObj);
if ($totalitems > 0) {
foreach ($itemsObj as $iValue) {
- $item = [];
- $item['itemurl']= $iValue->getItemUrl();
- $item['link'] = $iValue->getItemLink(false, $options[4] ?? 65);
- $item['id'] = $iValue->itemid();
- $item['poster'] = $iValue->posterName(); // for make poster name linked, use getLinkedPosterName() instead of posterName()
+ $item = [];
+ $item['itemurl'] = $iValue->getItemUrl();
+ $item['link'] = $iValue->getItemLink(false, $options[4] ?? 65);
+ $item['id'] = $iValue->itemid();
+ $item['poster'] = $iValue->posterName(); // for make poster name linked, use getLinkedPosterName() instead of posterName()
$item['categorylink'] = $iValue->getCategoryLink();
- $item['date'] = $iValue->getDatesub();
- $item['hits'] = $iValue->counter();
- $item['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available
- $item['rating'] = $iValue->rating();
- $item['votes'] = $iValue->votes();
- $item['lang_fullitem'] = _MB_PUBLISHER_FULLITEM;
- $item['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
- $item['lang_date'] = _MB_PUBLISHER_ON;
- $item['lang_category'] = _MB_PUBLISHER_CATEGORY;
- $item['lang_hits'] = _MB_PUBLISHER_TOTALHITS;
- $item['cancomment'] = $iValue->cancomment();
- $comments = $iValue->comments();
+ $item['date'] = $iValue->getDatesub();
+ $item['hits'] = $iValue->counter();
+ $item['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available
+ $item['rating'] = $iValue->rating();
+ $item['votes'] = $iValue->votes();
+ $item['lang_fullitem'] = _MB_PUBLISHER_FULLITEM;
+ $item['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
+ $item['lang_date'] = _MB_PUBLISHER_ON;
+ $item['lang_category'] = _MB_PUBLISHER_CATEGORY;
+ $item['lang_hits'] = _MB_PUBLISHER_TOTALHITS;
+ $item['cancomment'] = $iValue->cancomment();
+ $comments = $iValue->comments();
if ($comments > 0) {
//shows 1 comment instead of 1 comm. if comments ==1
//langugage file modified accordingly
@@ -109,25 +104,22 @@ function publisher_items_new_show($options)
} else {
$item['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
}
-
-
-
if ('article' === $image) {
- $item['image'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ $item['image'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
$item['image_name'] = '';
$images = $iValue->getImages();
-
- if (empty($images['image_path'])) {
- $images['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
+
+ if (empty($images['image_path'])) {
+ $images['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ }
if (is_object($images['main'])) {
// check to see if GD function exist
if (!function_exists('imagecreatetruecolor')) {
$item['image'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name');
} else {
- $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '';
- $item['image_path'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '';
+ $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '';
+ $item['image_path'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '';
}
$item['image_name'] = $images['main']->getVar('image_nicename');
}
@@ -146,14 +138,13 @@ function publisher_items_new_show($options)
$item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '&w=50';
}
}
- } else {
// check to see if GD function exist
- if (!function_exists('imagecreatetruecolor')) {
- $item['image'] = XOOPS_URL . '/uploads/' . $iValue->posterAvatar();
- } else {
- $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $iValue->posterAvatar() . '&w=50';
- }
+ } elseif (!function_exists('imagecreatetruecolor')) {
+ $item['image'] = XOOPS_URL . '/uploads/' . $iValue->posterAvatar();
+ } else {
+ $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $iValue->posterAvatar() . '&w=50';
}
+
$item['image_name'] = $iValue->posterName();
}
@@ -177,14 +168,15 @@ function publisher_items_new_show($options)
}
}
- $block['show_order'] = $options[2];
- $block['show_summary'] = $options[6];
- $block['show_poster'] =$options[7];
- $block['show_date'] =$options[8];
- $block['show_category'] =$options[9];
- $block['show_hits'] =$options[10];
- $block['show_comment'] =$options[11];
- $block['show_rating'] =$options[12];
+ $block['show_order'] = $options[2];
+ $block['show_summary'] = $options[6];
+ $block['show_poster'] = $options[7];
+ $block['show_date'] = $options[8];
+ $block['show_category'] = $options[9];
+ $block['show_hits'] = $options[10];
+ $block['show_comment'] = $options[11];
+ $block['show_rating'] = $options[12];
+
return $block;
}
@@ -204,12 +196,12 @@ function publisher_items_new_edit($options)
$orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
$orderEle->addOptionArray(
[
- 'datesub' => _MB_PUBLISHER_DATE,
- 'counter' => _MB_PUBLISHER_HITS,
- 'weight' => _MB_PUBLISHER_WEIGHT,
- 'rating' => _MI_PUBLISHER_ORDERBY_RATING,
- 'votes' => _MI_PUBLISHER_ORDERBY_VOTES,
- 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS,
+ 'datesub' => _MB_PUBLISHER_DATE,
+ 'counter' => _MB_PUBLISHER_HITS,
+ 'weight' => _MB_PUBLISHER_WEIGHT,
+ 'rating' => _MI_PUBLISHER_ORDERBY_RATING,
+ 'votes' => _MI_PUBLISHER_ORDERBY_VOTES,
+ 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS,
]
);
@@ -220,19 +212,19 @@ function publisher_items_new_edit($options)
$imageEle = new \XoopsFormSelect(_MB_PUBLISHER_IMAGE_TO_DISPLAY, 'options[5]', $options[5]);
$imageEle->addOptionArray(
[
- 'none' => _NONE,
- 'article' => _MB_PUBLISHER_IMAGE_ARTICLE,
- 'category' => _MB_PUBLISHER_IMAGE_CATEGORY,
- 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR,
+ 'none' => _NONE,
+ 'article' => _MB_PUBLISHER_IMAGE_ARTICLE,
+ 'category' => _MB_PUBLISHER_IMAGE_CATEGORY,
+ 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR,
]
);
$showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[6]', $options[6]);
- $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]);
- $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]);
- $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[9]', $options[9]);
- $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[10]', $options[10]);
+ $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]);
+ $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]);
+ $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[9]', $options[9]);
+ $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[10]', $options[10]);
$showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[11]', $options[11]);
- $showRating = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_RATING, 'options[12]', $options[12]);
+ $showRating = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_RATING, 'options[12]', $options[12]);
$form->addElement($catEle);
$form->addElement($orderEle);
@@ -240,12 +232,12 @@ function publisher_items_new_edit($options)
$form->addElement($dispEle);
$form->addElement($charsEle);
$form->addElement($imageEle);
- $form->addElement($showSummary);
+ $form->addElement($showSummary);
$form->addElement($showPoster);
$form->addElement($showDate);
- $form->addElement($showCategory);
- $form->addElement($showHits);
- $form->addElement($showComment);
+ $form->addElement($showCategory);
+ $form->addElement($showHits);
+ $form->addElement($showComment);
$form->addElement($showRating);
return $form->render();
diff --git a/blocks/items_random_item.php b/blocks/items_random_item.php
index 59874a0b..6cabaa64 100644
--- a/blocks/items_random_item.php
+++ b/blocks/items_random_item.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -24,8 +22,6 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
require_once dirname(__DIR__) . '/include/common.php';
/**
@@ -38,8 +34,7 @@
function publisher_items_random_item_show($options)
{
$block = [];
-
- /** @var Publisher\Helper $helper */
+
$helper = Publisher\Helper::getInstance();
/** @var Publisher\ItemHandler $itemHandler */
$itemHandler = $helper->getHandler('Item');
@@ -54,54 +49,54 @@ function publisher_items_random_item_show($options)
$block['id'] = $itemsObj->itemid();
$block['url'] = $itemsObj->getItemUrl();
$block['lang_fullitem'] = _MB_PUBLISHER_FULLITEM;
- $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
- $block['lang_date'] = _MB_PUBLISHER_ON;
- $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
- $block['lang_reads'] = _MB_PUBLISHER_HITS;
- $block['titlelink'] = $itemsObj->getItemLink('titlelink');
- $block['alt'] = strip_tags($itemsObj->getItemLink());
+ $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
+ $block['lang_date'] = _MB_PUBLISHER_ON;
+ $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
+ $block['lang_reads'] = _MB_PUBLISHER_HITS;
+ $block['titlelink'] = $itemsObj->getItemLink('titlelink');
+ $block['alt'] = strip_tags($itemsObj->getItemLink());
$block['date'] = $itemsObj->getDatesub();
$block['poster'] = $itemsObj->getLinkedPosterName();
$block['categorylink'] = $itemsObj->getCategoryLink();
- $block['hits'] = ' ' . $itemsObj->counter() . ' ' . _READS . '';
-
- $mainImage = $itemsObj->getMainImage(); // check to see if GD function exist
- if (empty($mainImage['image_path'])) {
- $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
- if (!function_exists('imagecreatetruecolor')) {
- $block['item_image'] = $mainImage['image_path'];
- } else {
- $block['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
- $block['image_path'] = $mainImage['image_path'];
- }
-
- $block['cancomment'] = $itemsObj->cancomment();
- $comments = $itemsObj->comments();
- if ($comments > 0) {
- //shows 1 comment instead of 1 comm. if comments ==1
- //langugage file modified accordingly
- if (1 == $comments) {
- $block['comment'] = ' ' . _MB_PUBLISHER_ONECOMMENT . ' ';
- } else {
- $block['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' ';
- }
- } else {
- $block['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
- }
- $block['display_summary'] =$options[0];
- $block['display_item_image'] =$options[1];
- $block['display_poster'] =$options[2];
- $block['display_date'] =$options[3];
- $block['display_categorylink'] =$options[4];
- $block['display_hits'] =$options[5];
- $block['display_comment'] =$options[6];
- $block['display_lang_fullitem'] =$options[7];
-
- $block['items'][] = $block;
- return $block;
-
- }
+ $block['hits'] = ' ' . $itemsObj->counter() . ' ' . _READS . '';
+
+ $mainImage = $itemsObj->getMainImage(); // check to see if GD function exist
+ if (empty($mainImage['image_path'])) {
+ $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ }
+ if (!function_exists('imagecreatetruecolor')) {
+ $block['item_image'] = $mainImage['image_path'];
+ } else {
+ $block['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
+ $block['image_path'] = $mainImage['image_path'];
+ }
+
+ $block['cancomment'] = $itemsObj->cancomment();
+ $comments = $itemsObj->comments();
+ if ($comments > 0) {
+ //shows 1 comment instead of 1 comm. if comments ==1
+ //langugage file modified accordingly
+ if (1 == $comments) {
+ $block['comment'] = ' ' . _MB_PUBLISHER_ONECOMMENT . ' ';
+ } else {
+ $block['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' ';
+ }
+ } else {
+ $block['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
+ }
+ $block['display_summary'] = $options[0];
+ $block['display_item_image'] = $options[1];
+ $block['display_poster'] = $options[2];
+ $block['display_date'] = $options[3];
+ $block['display_categorylink'] = $options[4];
+ $block['display_hits'] = $options[5];
+ $block['display_comment'] = $options[6];
+ $block['display_lang_fullitem'] = $options[7];
+
+ $block['items'][] = $block;
+
+ return $block;
+}
/**
* @param $options
@@ -112,24 +107,24 @@ function publisher_items_random_item_edit($options)
// require_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
xoops_load('XoopsFormLoader');
- $form = new Publisher\BlockForm();
- $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[0]', $options[0]);
- $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[1]', $options[1]);
- $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[2]', $options[2]);
- $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[3]', $options[3]);
- $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[4]', $options[4]);
- $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[5]', $options[5]);
+ $form = new Publisher\BlockForm();
+ $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[0]', $options[0]);
+ $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[1]', $options[1]);
+ $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[2]', $options[2]);
+ $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[3]', $options[3]);
+ $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[4]', $options[4]);
+ $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[5]', $options[5]);
$showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[6]', $options[6]);
- $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[7]', $options[7]);
-
- $form->addElement($showSummary);
+ $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[7]', $options[7]);
+
+ $form->addElement($showSummary);
$form->addElement($showImage);
$form->addElement($showPoster);
$form->addElement($showDate);
- $form->addElement($showCategory);
- $form->addElement($showHits);
- $form->addElement($showComment);
- $form->addElement($dispMoreEle);
-
+ $form->addElement($showCategory);
+ $form->addElement($showHits);
+ $form->addElement($showComment);
+ $form->addElement($dispMoreEle);
+
return $form->render();
}
diff --git a/blocks/items_recent.php b/blocks/items_recent.php
index 86420624..f58a39ea 100644
--- a/blocks/items_recent.php
+++ b/blocks/items_recent.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -24,8 +22,6 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
require_once dirname(__DIR__) . '/include/common.php';
/**
@@ -35,7 +31,6 @@
*/
function publisher_items_recent_show($options)
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\ItemHandler $itemHandler */
$itemHandler = $helper->getHandler('Item');
@@ -79,9 +74,9 @@ function publisher_items_recent_show($options)
if ($itemsObj && $totalItems > 0) {
foreach ($itemsObj as $iValue) {
$newItems['itemid'] = $iValue->itemid();
- $newItems['itemurl'] = $iValue->getItemUrl();
+ $newItems['itemurl'] = $iValue->getItemUrl();
$newItems['title'] = $iValue->getTitle();
- $newItems['alt'] = strip_tags($iValue->getItemLink());
+ $newItems['alt'] = strip_tags($iValue->getItemLink());
$newItems['categoryname'] = $iValue->getCategoryName();
$newItems['categoryid'] = $iValue->categoryid();
$newItems['date'] = $iValue->getDatesub();
@@ -89,20 +84,20 @@ function publisher_items_recent_show($options)
$newItems['itemlink'] = $iValue->getItemLink(false, $options[3] ?? 65);
$newItems['categorylink'] = $iValue->getCategoryLink();
$newItems['hits'] = ' ' . $iValue->counter() . ' ' . _READS . '';
- $newItems['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available
-
- $mainImage = $iValue->getMainImage(); // check to see if GD function exist
- if (empty($mainImage['image_path'])) {
- $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
- if (!function_exists('imagecreatetruecolor')) {
- $newItems['item_image'] = $mainImage['image_path'];
- } else {
- $newItems['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
- $newItems['image_path'] = $mainImage['image_path'];
- }
- $newItems['cancomment'] = $iValue->cancomment();
- $comments = $iValue->comments();
+ $newItems['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available
+
+ $mainImage = $iValue->getMainImage(); // check to see if GD function exist
+ if (empty($mainImage['image_path'])) {
+ $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
+ }
+ if (!function_exists('imagecreatetruecolor')) {
+ $newItems['item_image'] = $mainImage['image_path'];
+ } else {
+ $newItems['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '';
+ $newItems['image_path'] = $mainImage['image_path'];
+ }
+ $newItems['cancomment'] = $iValue->cancomment();
+ $comments = $iValue->comments();
if ($comments > 0) {
//shows 1 comment instead of 1 comm. if comments ==1
//langugage file modified accordingly
@@ -112,31 +107,28 @@ function publisher_items_recent_show($options)
$newItems['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' ';
}
} else {
- $newItems['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
+ $newItems['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' ';
}
-
-
-
+
$block['items'][] = $newItems;
}
- $block['publisher_url'] = PUBLISHER_URL;
+ $block['publisher_url'] = PUBLISHER_URL;
$block['lang_title'] = _MB_PUBLISHER_ITEMS;
$block['lang_category'] = _MB_PUBLISHER_CATEGORY;
$block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
$block['lang_date'] = _MB_PUBLISHER_DATE;
$moduleName = $myts->displayTarea($helper->getModule()->getVar('name'));
$block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $moduleName;
-
- $block['show_image'] = $options[4];
- $block['show_summary'] = $options[5];
- $block['show_category'] =$options[6];
- $block['show_poster'] =$options[7];
- $block['show_date'] =$options[8];
- $block['show_hits'] =$options[9];
- $block['show_comment'] =$options[10];
- $block['show_morelink'] =$options[11];
-
- }
+
+ $block['show_image'] = $options[4];
+ $block['show_summary'] = $options[5];
+ $block['show_category'] = $options[6];
+ $block['show_poster'] = $options[7];
+ $block['show_date'] = $options[8];
+ $block['show_hits'] = $options[9];
+ $block['show_comment'] = $options[10];
+ $block['show_morelink'] = $options[11];
+ }
return $block;
}
@@ -162,29 +154,29 @@ function publisher_items_recent_edit($options)
'weight' => _MB_PUBLISHER_WEIGHT,
]
);
- $dispEle = new \XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
- $charsEle = new \XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]);
- $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[4]', $options[4]);
+ $dispEle = new \XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
+ $charsEle = new \XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]);
+ $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[4]', $options[4]);
$showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[5]', $options[5]);
- $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[6]', $options[6]);
- $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]);
- $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]);
- $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[9]', $options[9]);
+ $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[6]', $options[6]);
+ $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]);
+ $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]);
+ $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[9]', $options[9]);
$showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[10]', $options[10]);
- $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[11]', $options[11]);
-
-
+ $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[11]', $options[11]);
+
$form->addElement($catEle);
$form->addElement($orderEle);
$form->addElement($dispEle);
$form->addElement($charsEle);
- $form->addElement($showImage);
- $form->addElement($showSummary);
- $form->addElement($showCategory);
- $form->addElement($showPoster);
+ $form->addElement($showImage);
+ $form->addElement($showSummary);
+ $form->addElement($showCategory);
+ $form->addElement($showPoster);
$form->addElement($showDate);
- $form->addElement($showHits);
- $form->addElement($showComment);
+ $form->addElement($showHits);
+ $form->addElement($showComment);
$form->addElement($dispMoreEle);
+
return $form->render();
}
diff --git a/blocks/items_spot.php b/blocks/items_spot.php
index ffeccf65..b0f0e801 100644
--- a/blocks/items_spot.php
+++ b/blocks/items_spot.php
@@ -14,16 +14,13 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
@@ -35,32 +32,31 @@
function publisher_items_spot_show($options)
{
// global $xoTheme;
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\CategoryHandler $categoryHandler */
$categoryHandler = $helper->getHandler('Category');
/** @var Publisher\ItemHandler $itemHandler */
$itemHandler = $helper->getHandler('Item');
- xoops_loadLanguage('main', 'publisher');
+ xoops_loadLanguage('main', 'publisher');
+
+ $optDisplayLast = $options[0];
+ $optItemsCount = $options[1];
+ $optCategoryId = $options[2];
+ $selItems = isset($options[3]) ? explode(',', $options[3]) : '';
+ $optDisplayPoster = $options[4];
+ $optDisplayComment = $options[5];
+ $optDisplayType = $options[6];
+ $optTruncate = (int)$options[7];
+ $optCatImage = $options[8];
+ $optSortOrder = $options[9] ?? '';
+ $optBtnDisplayMore = $options[10] ?? '';
+ $optDisplayReads = $options[11] ?? '';
+ $optdisplayitemimage = $options[12] ?? '';
+ $optdisplaywhenlink = $options[13] ?? '';
+ $optdisplaycategorylink = $options[14] ?? '';
+ $optdisplayadminlink = $options[15] ?? '';
+ $optdisplayreadmore = $options[16] ?? '';
- $optDisplayLast = $options[0];
- $optItemsCount = $options[1];
- $optCategoryId = $options[2];
- $selItems = isset($options[3]) ? explode(',', $options[3]) : '';
- $optDisplayPoster = $options[4];
- $optDisplayComment = $options[5];
- $optDisplayType = $options[6];
- $optTruncate = (int)$options[7];
- $optCatImage = $options[8];
- $optSortOrder = $options[9] ?? '';
- $optBtnDisplayMore = $options[10] ?? '';
- $optDisplayReads = $options[11] ?? '';
- $optdisplayitemimage=$options[12];
- $optdisplaywhenlink=$options[13];
- $optdisplaycategorylink=$options[14];
- $optdisplayadminlink=$options[15];
- $optdisplayreadmore =$options[16];
-
if (0 == $optCategoryId) {
$optCategoryId = -1;
}
@@ -106,7 +102,7 @@ function publisher_items_spot_show($options)
$category['name'] = $cat->name;
$category['categoryurl'] = $cat->getCategoryUrl();
if ('blank.png' !== $cat->getImage()) {
- $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $cat->getImage();
+ $category['image_path'] = Utility::getImageDir('category', false) . $cat->getImage();
} else {
$category['image_path'] = '';
}
@@ -145,7 +141,7 @@ function publisher_items_spot_show($options)
}
if ($optTruncate > 0) {
$block['truncate'] = true;
- $item['summary'] = Publisher\Utility::truncateHtml($item['summary'], $optTruncate);
+ $item['summary'] = Utility::truncateHtml($item['summary'], $optTruncate);
}
$block['items'][] = $item;
++$i;
@@ -156,25 +152,25 @@ function publisher_items_spot_show($options)
if (!isset($block['items']) || 0 == count($block['items'])) {
return false;
}
- $block['lang_reads'] = _MB_PUBLISHER_READS;
- $block['lang_comments'] = _MB_PUBLISHER_COMMENTS;
- $block['lang_readmore'] = _MB_PUBLISHER_READMORE;
- $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
- $block['lang_date'] = _MB_PUBLISHER_ON;
- $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
-
+ $block['lang_reads'] = _MB_PUBLISHER_READS;
+ $block['lang_comments'] = _MB_PUBLISHER_COMMENTS;
+ $block['lang_readmore'] = _MB_PUBLISHER_READMORE;
+ $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
+ $block['lang_date'] = _MB_PUBLISHER_ON;
+ $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
+
$block['display_whowhen_link'] = $optDisplayPoster;
- $block['display_who_link'] = $optDisplayPoster;
+ $block['display_who_link'] = $optDisplayPoster;
$block['display_comment_link'] = $optDisplayComment;
$block['display_type'] = $optDisplayType;
$block['display_reads'] = $optDisplayReads;
- $block['display_cat_image'] = $optCatImage;
- $block['display_item_image'] =$optdisplayitemimage;
- $block['display_when_link'] =$optdisplaywhenlink;
- $block['display_categorylink'] =$optdisplaycategorylink;
- $block['display_adminlink'] =$optdisplayadminlink;
- $block['display_readmore'] =$optdisplayreadmore;
-
+ $block['display_cat_image'] = $optCatImage;
+ $block['display_item_image'] = $optdisplayitemimage;
+ $block['display_when_link'] = $optdisplaywhenlink;
+ $block['display_categorylink'] = $optdisplaycategorylink;
+ $block['display_adminlink'] = $optdisplayadminlink;
+ $block['display_readmore'] = $optdisplayreadmore;
+
if ($optBtnDisplayMore) {
$block['lang_displaymore'] = _MB_PUBLISHER_MORE_ITEMS;
}
@@ -197,8 +193,7 @@ function publisher_items_spot_edit($options)
$form = new Publisher\BlockForm();
$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, Publisher\Utility::createCategorySelect($options[2], 0, true, 'options[2]', false));
- /** @var Publisher\Helper $helper */
+ $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[2], 0, true, 'options[2]', false));
$helper = Publisher\Helper::getInstance();
/** @var Publisher\ItemHandler $itemHandler */
$itemHandler = $helper->getHandler('Item');
@@ -220,8 +215,8 @@ function publisher_items_spot_edit($options)
$typeEle = new \XoopsFormSelect(_MB_PUBLISHER_DISPLAY_TYPE, 'options[6]', $options[6]);
$typeEle->addOptionArray(
[
- 'block' => _MB_PUBLISHER_DISPLAY_TYPE_BLOCK,
- 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET,
+ 'block' => _MB_PUBLISHER_DISPLAY_TYPE_BLOCK,
+ 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET,
]
);
$truncateEle = new \XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[7]', 4, 255, $options[7]);
@@ -229,39 +224,40 @@ function publisher_items_spot_edit($options)
$sortEle = new \XoopsFormSelect(_MI_PUBLISHER_ORDERBY, 'options[9]', $options[9]);
$sortEle->addOptionArray(
[
- 'title' => _MI_PUBLISHER_ORDERBY_TITLE,
- 'date' => _MI_PUBLISHER_ORDERBY_DATE,
- 'counter' => _MI_PUBLISHER_ORDERBY_HITS,
- 'rating' => _MI_PUBLISHER_ORDERBY_RATING,
- 'votes' => _MI_PUBLISHER_ORDERBY_VOTES,
- 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS,
- 'weight' => _MI_PUBLISHER_ORDERBY_WEIGHT,
+ 'title' => _MI_PUBLISHER_ORDERBY_TITLE,
+ 'date' => _MI_PUBLISHER_ORDERBY_DATE,
+ 'counter' => _MI_PUBLISHER_ORDERBY_HITS,
+ 'rating' => _MI_PUBLISHER_ORDERBY_RATING,
+ 'votes' => _MI_PUBLISHER_ORDERBY_VOTES,
+ 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS,
+ 'weight' => _MI_PUBLISHER_ORDERBY_WEIGHT,
]
);
- $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[10]', $options[10]);
- $readsEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[11]', $options[11]);
- $dispImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[12]', $options[12]);
- $dispDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[13]', $options[13]);
- $dispCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[14]', $options[14]);
- $dispAdminlink = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_ADMINLINK, 'options[15]', $options[15]);
- $dispReadmore = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[16]', $options[16]);
-
+ $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[10]', $options[10]);
+ $readsEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[11]', $options[11]);
+ $dispImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[12]', $options[12]);
+ $dispDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[13]', $options[13]);
+ $dispCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[14]', $options[14]);
+ $dispAdminlink = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_ADMINLINK, 'options[15]', $options[15]);
+ $dispReadmore = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[16]', $options[16]);
+
$form->addElement($autoEle);
$form->addElement($countEle);
$form->addElement($catEle);
$form->addElement($itemEle);
$form->addElement($whoEle);
- $form->addElement($comEle);
+ $form->addElement($comEle);
$form->addElement($typeEle);
$form->addElement($truncateEle);
$form->addElement($imageEle);
$form->addElement($sortEle);
$form->addElement($dispMoreEle);
$form->addElement($readsEle);
- $form->addElement($dispImage);
- $form->addElement($dispDate);
- $form->addElement($dispCategory);
- $form->addElement($dispAdminlink);
- $form->addElement($dispReadmore);
+ $form->addElement($dispImage);
+ $form->addElement($dispDate);
+ $form->addElement($dispCategory);
+ $form->addElement($dispAdminlink);
+ $form->addElement($dispReadmore);
+
return $form->render();
}
diff --git a/blocks/latest_files.php b/blocks/latest_files.php
index 9b89ee8e..496fa314 100644
--- a/blocks/latest_files.php
+++ b/blocks/latest_files.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -23,8 +21,7 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
@@ -35,7 +32,6 @@
*/
function publisher_latest_files_show($options)
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\FileHandler $fileHandler */
$fileHandler = $helper->getHandler('File');
@@ -50,7 +46,7 @@ function publisher_latest_files_show($options)
$block = [];
$sort = $options[1];
- $order = Publisher\Utility::getOrderBy($sort);
+ $order = Utility::getOrderBy($sort);
$limit = $options[2];
$directDownload = $options[3];
@@ -84,7 +80,7 @@ function publisher_latest_files_edit($options)
$form = new Publisher\BlockForm();
- $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]'));
+ $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]'));
$orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
$orderEle->addOptionArray(
[
diff --git a/blocks/latest_news.php b/blocks/latest_news.php
index 74a676dd..530e12c0 100644
--- a/blocks/latest_news.php
+++ b/blocks/latest_news.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author Bandit-x
@@ -24,8 +22,7 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
+use XoopsModules\Publisher\Utility;
require_once dirname(__DIR__) . '/include/common.php';
@@ -38,7 +35,6 @@ function publisher_latest_news_show($options)
{
$block = [];
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$helper->loadLanguage('main');
/** @var Publisher\ItemHandler $itemHandler */
@@ -51,7 +47,7 @@ function publisher_latest_news_show($options)
$letters = $options[3];
$selectedStories = $options[4];
$sort = $options[9];
- $order = Publisher\Utility::getOrderBy($sort);
+ $order = Utility::getOrderBy($sort);
$imgWidth = $options[11];
$imgHeight = $options[12];
$border = $options[13];
@@ -62,7 +58,7 @@ function publisher_latest_news_show($options)
$allcats = false;
if (!isset($options[31])) {
$allcats = true;
- } elseif (in_array(0, explode(',', $options[31]))) {
+ } elseif (in_array(0, explode(',', $options[31]), true)) {
$allcats = true;
}
@@ -100,7 +96,7 @@ function publisher_latest_news_show($options)
$k = 0;
$columns = [];
- foreach ($itemsObj as $itemid => $itemObj) {
+ foreach ($itemsObj as $itemId => $itemObj) {
$item = [];
$item['itemurl'] = $itemObj->getItemUrl();
$item['title'] = $itemObj->getItemLink();
@@ -108,19 +104,19 @@ function publisher_latest_news_show($options)
$mainImage = $itemObj->getMainImage();
if (empty($mainImage['image_path'])) {
$mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg';
- }
+ }
// check to see if GD function exist
if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) {
$item['item_image'] = $mainImage['image_path'];
} else {
$item['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=' . $imgWidth; // No $imgHeight for autoheight option
$item['image_path'] = $mainImage['image_path'];
- }
- $item['text'] = $itemObj->getBlockSummary($letters);
- $item['display_item_image'] =$options[10];
- $item['display_summary'] =$options[16];
- $item['display_adminlink'] =$options[29];
- $item = $itemObj->getMainImage($item); //returns an array
+ }
+ $item['text'] = $itemObj->getBlockSummary($letters);
+ $item['display_item_image'] = $options[10];
+ $item['display_summary'] = $options[16];
+ $item['display_adminlink'] = $options[29];
+ $item = $itemObj->getMainImage($item); //returns an array
$lsHeight = $imgPosition = $lsMargin = '';
if (0 != $options[12]) {
@@ -128,24 +124,24 @@ function publisher_latest_news_show($options)
} // set height = 0 in block option for auto height
if ('LEFT' === $options[15]) {
- $imgPosition = 'float: left';
- $lsMargin = '-right';
- $block['position'] = $imgPosition;
- $block['margin'] = $lsMargin;
+ $imgPosition = 'float: left';
+ $lsMargin = '-right';
+ $block['position'] = $imgPosition;
+ $block['margin'] = $lsMargin;
}
if ('CENTER' === $options[15]) {
- $imgPosition = 'text-align:center';
- $lsMargin = '';
- $block['position'] = $imgPosition;
- $block['margin'] = $lsMargin;
+ $imgPosition = 'text-align:center';
+ $lsMargin = '';
+ $block['position'] = $imgPosition;
+ $block['margin'] = $lsMargin;
}
if ('RIGHT' === $options[15]) {
- $imgPosition = 'float: right';
- $lsMargin = '-left';
- $block['position'] = $imgPosition;
- $block['margin'] = $lsMargin;
+ $imgPosition = 'float: right';
+ $lsMargin = '-left';
+ $block['position'] = $imgPosition;
+ $block['margin'] = $lsMargin;
}
//Image
@@ -166,11 +162,11 @@ function publisher_latest_news_show($options)
}
$block['topiclink'] = '';
-
+
if (1 == $options[16]) {
- $block['text'] = $itemObj->getBlockSummary($letters);
+ $block['text'] = $itemObj->getBlockSummary($letters);
}
-
+
$block['archivelink'] = '';
if (1 == $options[17]) {
$block['archivelink'] = '| ' . _MB_PUBLISHER_ARCHIVE . ' ';
@@ -184,30 +180,30 @@ function publisher_latest_news_show($options)
$item['poster'] = '';
if (1 == $options[19]) {
- $item['poster'] = $itemObj->posterName();
- $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
+ $item['poster'] = $itemObj->posterName();
+ $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
}
$item['posttime'] = '';
if (1 == $options[20]) {
- $item['posttime'] = $itemObj->getDatesub();
- $block['lang_date'] = _MB_PUBLISHER_ON;
+ $item['posttime'] = $itemObj->getDatesub();
+ $block['lang_date'] = _MB_PUBLISHER_ON;
}
$item['topic_title'] = '';
if (1 == $options[21]) {
- $item['topic_title'] = $itemObj->getCategoryLink();
- $item['category'] = strip_tags($itemObj->getCategoryLink());
- $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
- }
+ $item['topic_title'] = $itemObj->getCategoryLink();
+ $item['category'] = strip_tags($itemObj->getCategoryLink());
+ $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
+ }
$item['read'] = '';
if (1 == $options[22]) {
- $item['read'] = $itemObj->counter();
- $block['lang_reads'] = _MB_PUBLISHER_READS;
+ $item['read'] = $itemObj->counter();
+ $block['lang_reads'] = _MB_PUBLISHER_READS;
}
- $item['cancomment'] = $itemObj->cancomment();
- $comments = $itemObj->comments();
+ $item['cancomment'] = $itemObj->cancomment();
+ $comments = $itemObj->comments();
if (1 == $options[23]) {
if ($comments > 0) {
//shows 1 comment instead of 1 comm. if comments ==1
@@ -228,14 +224,14 @@ function publisher_latest_news_show($options)
}
$item['pdf'] = '';
-
- if (1 == $options[25]) {
- $item['pdf'] = "itemid() . "' rel='nofollow'> ";
- }
-
+
+ if (1 == $options[25]) {
+ $item['pdf'] = "itemid() . "' rel='nofollow'> ";
+ }
+
$item['email'] = '';
- if (1 == $options[26]) {
- $maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl();
+ if (1 == $options[26]) {
+ $maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl();
$item['email'] = ' ';
}
@@ -260,12 +256,12 @@ function publisher_latest_news_show($options)
$block['template'] = $options[30];
- $block['imgwidth'] = $options[11];
- $block['imgheight'] = $options[12];
- $block['border'] = $options[13];
+ $block['imgwidth'] = $options[11];
+ $block['imgheight'] = $options[12];
+ $block['border'] = $options[13];
$block['bordercolor'] = $options[14];
-
- $block['letters'] = $letters;
+
+ $block['letters'] = $letters;
$columns[$k][] = $item;
++$k;
@@ -429,7 +425,7 @@ function publisher_latest_news_edit($options)
//Select Which Categories To Show
$form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4; // Topics Options
$form .= $tabletag1 . _MB_PUBLISHER_TOPICSDISPLAY . $tabletag2;
- $form .= Publisher\Utility::createCategorySelect($options[31], 0, true, 'options[31]');
+ $form .= Utility::createCategorySelect($options[31], 0, true, 'options[31]');
$form .= '';
$form .= '';
diff --git a/blocks/search.php b/blocks/search.php
index 84e2c9f4..b3fc0f73 100644
--- a/blocks/search.php
+++ b/blocks/search.php
@@ -14,8 +14,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Blocks
* @since 1.0
* @author trabis
* @author phppp
@@ -24,8 +22,6 @@
use Xmf\Request;
use XoopsModules\Publisher;
-
-
require_once dirname(__DIR__) . '/include/common.php';
/**
@@ -36,7 +32,6 @@
function publisher_search_show($options)
{
$block = [];
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\CategoryHandler $categoryHandler */
$categoryHandler = $helper->getHandler('Category');
@@ -63,15 +58,15 @@ function publisher_search_show($options)
//mb TODO simplify next lines with category
$category = Request::getArray('category', [], 'POST') ?: Request::getArray('category', null, 'GET');
- if (empty($category) || (is_array($category) && in_array('all', $category))) {
+ if (empty($category) || (is_array($category) && in_array('all', $category, true))) {
$category = [];
} else {
$category = (!is_array($category)) ? explode(',', $category) : $category;
$category = array_map('\intval', $category);
}
- $andor = in_array(mb_strtoupper($andor), ['OR', 'AND', 'EXACT']) ? mb_strtoupper($andor) : 'OR';
- $sortby = in_array(mb_strtolower($sortby), ['itemid', 'datesub', 'title', 'categoryid']) ? mb_strtolower($sortby) : 'itemid';
+ $andor = in_array(mb_strtoupper($andor), ['OR', 'AND', 'EXACT'], true) ? mb_strtoupper($andor) : 'OR';
+ $sortby = in_array(mb_strtolower($sortby), ['itemid', 'datesub', 'title', 'categoryid'], true) ? mb_strtolower($sortby) : 'itemid';
/* type */
$typeSelect = '';
@@ -102,7 +97,7 @@ function publisher_search_show($options)
$categorySelect .= '>' . _ALL . '';
foreach ($categories as $id => $cat) {
$categorySelect .= '';
@@ -113,32 +108,32 @@ function publisher_search_show($options)
/* scope */
$searchSelect = '';
$searchSelect .= '
* @author The SmartFactory
@@ -26,10 +24,11 @@
require_once __DIR__ . '/header.php';
-$categoryid = Request::getInt('categoryid', 0, 'GET');
+$categoryId = Request::getInt('categoryid', 0, 'GET');
// Creating the category object for the selected category
-$categoryObj = $helper->getHandler('Category')->get($categoryid);
+/** @var \XoopsModules\Publisher\Helper $helper */
+$categoryObj = $helper->getHandler('Category')->get($categoryId);
// if the selected category was not found, exit
if (!is_object($categoryObj) || $categoryObj->notLoaded()) {
@@ -44,13 +43,13 @@
// At which record shall we start
$start = Request::getInt('start', 0, 'GET');
-$item_page_id = Request::getInt('page', -1, 'GET');
+$itemPageId = Request::getInt('page', -1, 'GET');
$totalItems = $helper->getHandler('Category')->publishedItemsCount();
// if there is no Item under this categories or the sub-categories, exit
// why?
-if (!isset($totalItems[$categoryid]) || 0 == $totalItems[$categoryid]) {
+if (!isset($totalItems[$categoryId]) || 0 == $totalItems[$categoryId]) {
//redirect_header("index.php", 1, _MD_PUBLISHER_MAINNOFAQS);
}
@@ -64,7 +63,7 @@
require_once $GLOBALS['xoops']->path('header.php');
require_once PUBLISHER_ROOT_PATH . '/footer.php';
-$module_id = $helper->getModule()->getVar('mid');
+$moduleId = $helper->getModule()->getVar('mid');
// creating the Item objects that belong to the selected category
switch ($helper->getConfig('format_order_by')) {
@@ -98,7 +97,7 @@
break;
}
-$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryid, $sort, $order);
+$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryId, $sort, $order);
$totalItemOnPage = 0;
if ($itemsObj) {
@@ -122,8 +121,8 @@
$lastitemsize = (int)$helper->getConfig('idxcat_last_item_size');
// Creating the sub-categories objects that belong to the selected category
-$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryid);
-$total_subcats = count($subcatsObj);
+$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryId);
+$totalSubcats = count($subcatsObj);
$total_items = 0;
@@ -131,36 +130,36 @@
if ('no' !== $helper->getConfig('idxcat_show_subcats')) {
// if this category has subcats
- if (isset($subcatsObj) && $total_subcats > 0) {
+ if (isset($subcatsObj) && $totalSubcats > 0) {
foreach ($subcatsObj as $key => $subcat) {
// Get the items count of this very category
- $subcat_total_items = $totalItems[$key] ?? 0;
+ $subcatTotalItems = $totalItems[$key] ?? 0;
// Do we display empty sub-cats ?
- if (($subcat_total_items > 0) || ('all' === $helper->getConfig('idxcat_show_subcats'))) {
- $subcat_id = $subcat->getVar('categoryid');
+ if (($subcatTotalItems > 0) || ('all' === $helper->getConfig('idxcat_show_subcats'))) {
+ $subcatId = $subcat->getVar('categoryid');
// if we retreived the last item object for this category
- if (isset($lastItemObj[$subcat_id])) {
- $subcat->setVar('last_itemid', $lastItemObj[$subcat_id]->itemid());
+ if (isset($lastItemObj[$subcatId])) {
+ $subcat->setVar('last_itemid', $lastItemObj[$subcatId]->itemid());
$subcat->setVar('last_title_link', $lastItemObj[$key]->getItemLink(false, $lastitemsize));
}
- $numItems = isset($totalItems[$subcat_id]) ? $totalItems[$key] : 0;
+ $numItems = isset($totalItems[$subcatId]) ? $totalItems[$key] : 0;
$subcat->setVar('itemcount', $numItems);
// Put this subcat in the smarty variable
$subcategories[$key] = $subcat->toArraySimple();
//$total += $numItems;
}
- if ($subcat_total_items > 0) {
- $subcat_id = $subcat->getVar('categoryid');
+ if ($subcatTotalItems > 0) {
+ $subcatId = $subcat->getVar('categoryid');
// if we retreived the last item object for this category
- if (isset($lastItemObj[$subcat_id])) {
- $subcat->setVar('last_itemid', $lastItemObj[$subcat_id]->itemid());
+ if (isset($lastItemObj[$subcatId])) {
+ $subcat->setVar('last_itemid', $lastItemObj[$subcatId]->itemid());
$subcat->setVar('last_title_link', $lastItemObj[$key]->getItemLink(false, $lastitemsize));
}
- $numItems = isset($totalItems[$subcat_id]) ? $totalItems[$key] : 0;
+ $numItems = isset($totalItems[$subcatId]) ? $totalItems[$key] : 0;
$subcat->setVar('itemcount', $numItems);
// Put this subcat in the smarty variable
$subcategories[$key] = $subcat->toArraySimple();
@@ -174,14 +173,14 @@
$category['subcats'] = $subcategories;
$category['subcatscount'] = count($subcategories);
-$thiscategory_itemcount = $totalItems[$categoryid] ?? 0;
+$thiscategory_itemcount = $totalItems[$categoryId] ?? 0;
$category['total'] = $thiscategory_itemcount;
if (count($itemsObj) > 0) {
/*$userids = [];
if ($itemsObj) {
foreach ($itemsObj as $key => $thisItem) {
- $itemids[] = $thisItem->getVar('itemid');
+ $itemIds[] = $thisItem->getVar('itemid');
$userids[$thisItem->uid()] = 1;
}
}
@@ -220,7 +219,7 @@
$xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name()));
$xoopsTpl->assign('module_home', Publisher\Utility::moduleHome($helper->getConfig('format_linked_path')));
$xoopsTpl->assign('categoryPath', '' . $category['categoryPath'] . ' ');
-$xoopsTpl->assign('selected_category', $categoryid);
+$xoopsTpl->assign('selected_category', $categoryId);
// The Navigation Bar
require_once $GLOBALS['xoops']->path('class/pagenav.php');
@@ -240,7 +239,7 @@
// 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);
+ $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/BaseObjectHandler.php b/class/BaseObjectHandler.php
index 78ba0295..2a5b52fe 100644
--- a/class/BaseObjectHandler.php
+++ b/class/BaseObjectHandler.php
@@ -19,7 +19,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -27,8 +26,6 @@
use XoopsModules\Publisher;
-
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -36,7 +33,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author Nazar Aziz
@@ -56,7 +52,6 @@ class BaseObjectHandler extends \XoopsPersistableObjectHandler
* @var string
*/
protected $idfield = 'id';
-
public $helper = null;
public $publisherIsAdmin = null;
@@ -89,9 +84,9 @@ public function create($isNew = true)
/**
* retrieve an object from the database, based on. use in child classes
*
- * @param int $id ID
+ * @param int|null $id ID
*
- * @param null $fields
+ * @param array|null $fields
* @return mixed object if id exists, false if not
*/
public function get($id = null, $fields = null)
@@ -116,11 +111,11 @@ public function get($id = null, $fields = null)
/**
* retrieve objects from the database
*
- * @param \CriteriaElement $criteria {@link CriteriaElement}
- * conditions to be met
- * @param bool $idAsKey Should the department ID be used as array key
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
+ * conditions to be met
+ * @param bool $idAsKey Should the department ID be used as array key
*
- * @param bool $asObject
+ * @param bool $asObject
* @return array array of objects
*/
public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null, $idAsKey = false)
@@ -202,7 +197,7 @@ public function insert(\XoopsObject $obj, $force = false)// insert($obj, $force
/**
* Create a "select" SQL query
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement} to match
+ * @param \CriteriaElement|null $criteria {@link \CriteriaElement} to match
*
* @return string SQL query
*/
@@ -223,8 +218,7 @@ private function selectQuery(\CriteriaElement $criteria = null)
/**
* count objects matching a criteria
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
- * to match
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement} to match
*
* @return int count of objects
*/
@@ -272,10 +266,10 @@ public function delete(\XoopsObject $obj, $force = false) //delete($obj, $force
/**
* delete department matching a set of conditions
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
*
- * @param bool $force
- * @param bool $asObject
+ * @param bool $force
+ * @param bool $asObject
* @return bool FALSE if deletion failed
*/
public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
@@ -294,11 +288,11 @@ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asO
/**
* Assign a value to 1 field for tickets matching a set of conditions
*
- * @param string $fieldname
- * @param string $fieldvalue
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement}
+ * @param string $fieldname
+ * @param string $fieldvalue
+ * @param \CriteriaElement|null $criteria {@link \CriteriaElement}
*
- * @param bool $force
+ * @param bool $force
* @return bool FALSE if update failed
*/
public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null, $force = false) //updateAll($fieldname, $fieldvalue, $criteria = null)
diff --git a/class/BlockForm.php b/class/BlockForm.php
index 809c3efe..ac259960 100644
--- a/class/BlockForm.php
+++ b/class/BlockForm.php
@@ -19,15 +19,12 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
*/
use XoopsModules\Publisher;
-
-
\xoops_load('XoopsForm');
/**
diff --git a/class/Category.php b/class/Category.php
index e7cad3bf..5eaa7d66 100644
--- a/class/Category.php
+++ b/class/Category.php
@@ -17,15 +17,14 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Helper;
+use XoopsModules\Publisher\Utility;
require_once \dirname(__DIR__) . '/include/common.php';
@@ -35,15 +34,14 @@
class Category extends \XoopsObject
{
/**
- * @var Publisher\Helper
+ * @var Helper
*/
public $helper;
-
/**
* @var array
*/
public $categoryPath = false;
- public $categoryid;
+ public $categoryId;
public $parentid;
public $name;
public $description;
@@ -63,8 +61,8 @@ class Category extends \XoopsObject
*/
public function __construct()
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
- $this->helper = \XoopsModules\Publisher\Helper::getInstance();
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
+ $this->helper = 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);
@@ -113,7 +111,7 @@ public function notLoaded()
public function checkPermission()
{
$ret = false;
- if (Publisher\Utility::userIsAdmin()) {
+ if (Utility::userIsAdmin()) {
return true;
}
if (\is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->getVar('uid') == $this->moderator) {
@@ -122,7 +120,7 @@ public function checkPermission()
/** @var \XoopsModules\Publisher\PermissionHandler $permissionHandler */
$permissionHandler = $this->helper->getHandler('Permission');
$categoriesGranted = $permissionHandler->getGrantedItems('category_read');
- if (\in_array($this->categoryid(), $categoriesGranted)) {
+ if (\in_array($this->categoryid(), $categoriesGranted, true)) {
$ret = true;
}
@@ -179,7 +177,7 @@ public function getCategoryPath($withAllLink = true)
if ($parentObj->notLoaded()) {
throw new \RuntimeException(_NOPERM);
}
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$this->helper->addLog($e);
// redirect_header('', 1, _NOPERM);
}
@@ -211,7 +209,7 @@ public function getCategoryPathForMetaTitle()
if ($parentObj->notLoaded()) {
throw new \RuntimeException('NOT LOADED');
}
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$this->helper->addLog($e);
// redirect_header('', 1, _NOPERM);
}
@@ -304,7 +302,7 @@ public function sendNotifications()
$tags['MODULE_NAME'] = $this->helper->getModule()->getVar('name');
$tags['CATEGORY_NAME'] = $this->name();
$tags['CATEGORY_URL'] = $this->getCategoryUrl();
- /* @var \XoopsNotificationHandler $notificationHandler */
+ /** @var \XoopsNotificationHandler $notificationHandler */
$notificationHandler = \xoops_getHandler('notification');
$notificationHandler->triggerEvent('global_item', 0, 'category_created', $tags);
}
@@ -331,7 +329,7 @@ public function toArraySimple($category = [])
$category['last_title_link'] = $this->getVar('last_title_link', 'n');
}
if ('blank.png' !== $this->getImage()) {
- $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $this->getImage();
+ $category['image_path'] = Utility::getImageDir('category', false) . $this->getImage();
} else {
$category['image_path'] = '';
}
@@ -356,7 +354,7 @@ public function toArrayTable($category = [])
$category['last_title_link'] = $this->getVar('last_title_link', 'n');
}
if ('blank.png' !== $this->getImage()) {
- $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $this->getImage();
+ $category['image_path'] = Utility::getImageDir('category', false) . $this->getImage();
} else {
$category['image_path'] = '';
}
diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php
index f7fe9dac..59c67219 100644
--- a/class/CategoryHandler.php
+++ b/class/CategoryHandler.php
@@ -17,15 +17,13 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Helper;
require_once \dirname(__DIR__) . '/include/common.php';
@@ -35,7 +33,6 @@
* of Category class objects.
*
* @author marcan
- * @package Publisher
*/
class CategoryHandler extends \XoopsPersistableObjectHandler
{
@@ -45,15 +42,11 @@ class CategoryHandler extends \XoopsPersistableObjectHandler
public $helper;
public $publisherIsAdmin;
- /**
- * @param \XoopsDatabase $db
- * @param \XoopsModules\Publisher\Helper|null $helper
- */
- public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null)
+ public function __construct(\XoopsDatabase $db = null, Helper $helper = null)
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
+ /** @var Helper $this->helper */
if (null === $helper) {
- $this->helper = \XoopsModules\Publisher\Helper::getInstance();
+ $this->helper = Helper::getInstance();
} else {
$this->helper = $helper;
}
@@ -163,10 +156,10 @@ public function delete(\XoopsObject $category, $force = false) //delete(&$catego
/**
* retrieve categories from the database
*
- * @param \CriteriaElement $criteria {@link CriteriaElement} conditions to be met
- * @param bool $idAsKey use the categoryid as key for the array?
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement} conditions to be met
+ * @param bool $idAsKey use the categoryid as key for the array?
*
- * @param bool $as_object
+ * @param bool $as_object
* @return array array of XoopsItem objects
*/
public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $as_object = true) //&getObjects($criteria = null, $idAsKey = false)
@@ -397,10 +390,10 @@ public function getSubCats($categories)
/**
* delete categories matching a set of conditions
*
- * @param \CriteriaElement $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
*
- * @param bool $force
- * @param bool $asObject
+ * @param bool $force
+ * @param bool $asObject
* @return bool FALSE if deletion failed
*/
public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
diff --git a/class/Cloner.php b/class/Cloner.php
index 98ba326b..a511d20d 100644
--- a/class/Cloner.php
+++ b/class/Cloner.php
@@ -10,7 +10,6 @@
class Cloner
{
// recursive cloning script
-
/**
* @param $path
*/
@@ -39,7 +38,7 @@ public static function cloneFileFolder($path)
}
} else {
$noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf'];
- if (\in_array(mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions)) {
+ if (\in_array(mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions, true)) {
// image
\copy($path, $newPath);
} else {
@@ -94,7 +93,7 @@ public static function createLogo($dirname)
// Write text
$textColor = \imagecolorallocate($imageModule, 0, 0, 0);
- $spaceToBorder = intval((80 - mb_strlen($dirname) * 6.5) / 2);
+ $spaceToBorder = (int)((80 - mb_strlen($dirname) * 6.5) / 2);
\imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($dirname), []);
// Set transparency color
diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php
index 9f8d49ab..8c8021b0 100644
--- a/class/Common/Breadcrumb.php
+++ b/class/Common/Breadcrumb.php
@@ -19,7 +19,6 @@
* @copyright XOOPS Project (https://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author lucio
- * @package Publisher
*
* Example:
* $breadcrumb = new Publisher\Common\Breadcrumb();
@@ -28,6 +27,7 @@
* $breadcrumb->addLink( 'bread 3', 'index3.php' );
* echo $breadcrumb->render();
*/
+
/**
* Class Breadcrumb
*/
@@ -38,7 +38,7 @@ class Breadcrumb
public function __construct()
{
- $this->dirname = \basename(\dirname(\dirname(__DIR__)));
+ $this->dirname = \basename(dirname(__DIR__, 2));
}
/**
@@ -56,21 +56,33 @@ public function addLink($title = '', $link = '')
}
/**
- * Render Pedigree BreadCrumb
+ * Render BreadCrumb
*/
public function render()
{
+ /*
+ TODO if you want to use the render code below,
+ 1) create ./templates/MODULENAME_common_breadcrumb.tpl)
+ 2) add declaration to xoops_version.php
+ */
+ /*
if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
- require_once $GLOBALS['xoops']->path('class/theme.php');
+ require $GLOBALS['xoops']->path('class/theme.php');
+
$GLOBALS['xoTheme'] = new \xos_opal_Theme();
}
- require_once $GLOBALS['xoops']->path('class/template.php');
+ require $GLOBALS['xoops']->path('class/template.php');
+
$breadcrumbTpl = new \XoopsTpl();
+
$breadcrumbTpl->assign('breadcrumb', $this->bread);
+
$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
+
unset($breadcrumbTpl);
return $html;
+ */
}
}
diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php
index 11e98006..9cf7d6ab 100644
--- a/class/Common/Configurator.php
+++ b/class/Common/Configurator.php
@@ -20,7 +20,6 @@
* @copyright XOOPS Project (https://xoops.org)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author XOOPS Development Team
- * @package Publisher
* @since 1.05
*/
@@ -49,7 +48,7 @@ class Configurator
*/
public function __construct()
{
- $config = require \dirname(\dirname(__DIR__)) . '/config/config.php';
+ $config = require dirname(__DIR__, 2) . '/config/config.php';
$this->name = $config->name;
$this->uploadFolders = $config->uploadFolders;
@@ -62,7 +61,7 @@ public function __construct()
$this->moduleStats = $config->moduleStats;
$this->modCopyright = $config->modCopyright;
- $this->paths = require \dirname(\dirname(__DIR__)) . '/config/paths.php';
- $this->icons = require \dirname(\dirname(__DIR__)) . '/config/icons.php';
+ $this->paths = require dirname(__DIR__, 2) . '/config/paths.php';
+ $this->icons = require dirname(__DIR__, 2) . '/config/icons.php';
}
}
diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php
index bd7e7ed0..c98e7287 100644
--- a/class/Common/FilesManagement.php
+++ b/class/Common/FilesManagement.php
@@ -38,7 +38,7 @@ public static function createFolder($folder)
file_put_contents($folder . '/index.html', '');
}
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
echo 'Caught exception: ', $e->getMessage(), ' ';
}
}
@@ -149,11 +149,8 @@ public static function deleteDirectory($src)
if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
break;
}
- } else {
- // delete the file
- if (!($success = \unlink($fileInfo->getRealPath()))) {
- break;
- }
+ } elseif (!($success = \unlink($fileInfo->getRealPath()))) {
+ break;
}
}
// now delete this (sub)directory if all the files are gone
diff --git a/class/Common/Meta.php b/class/Common/Meta.php
index 32314af0..dc6d5500 100644
--- a/class/Common/Meta.php
+++ b/class/Common/Meta.php
@@ -15,48 +15,52 @@
final class Meta
{
/**
- * @param string $locale_code
+ * @param string $localeCode
* @return string
*/
- public static function getStatik($locale_code)
+
+ public static function getStatik($localeCode)
{
return '
-
-
-
-
-
-
-
- ';
+
+
+
+
+
+
+
+ ';
}
/**
* @return string
*/
+
public static function getRobot()
{
return '
-
-
-
- ';
+
+
+
+ ';
}
/**
* @return string
*/
+
public static function getNorobot()
{
return '
-
- ';
+
+ ';
}
/**
* @param $title
* @return string
*/
+
public static function getTitle($title)
{
return '' . $title . ' ';
@@ -66,6 +70,7 @@ public static function getTitle($title)
* @param $desc
* @return string
*/
+
public static function getDescription($desc)
{
return ' ';
@@ -75,34 +80,43 @@ public static function getDescription($desc)
* @param $langList
* @return string
*/
+
public static function getAlternate($langList)
{
- $LL = '';
+ $alternateLangList = '';
+
if (\count($langList) > 1):
foreach ($langList as $lang):
- $LL .= '
- ';
+ $alternateLangList .= '
+ ';
endforeach;
else:
- $LL = '
- ';
+ $alternateLangList = '
+ ';
+
endif;
- return $LL;
+
+ return $alternateLangList;
}
/**
* @param $fb
* @return string
*/
+
public static function getFacebook($fb)
{
$fbh = '';
+
if (\is_array($fb)):
foreach ($fb as $fbkey => $fbrow):
$fbh .= '
- ';
+ ';
+
endforeach;
+
endif;
+
return $fbh;
}
@@ -110,14 +124,19 @@ public static function getFacebook($fb)
* @param $tw
* @return string
*/
+
public static function getTwitter($tw)
{
$twh = '';
+
if (\is_array($tw)):
foreach ($tw as $twkey => $twrow):
$twh .= ' ';
+
endforeach;
+
endif;
+
return $twh;
}
@@ -125,14 +144,19 @@ public static function getTwitter($tw)
* @param $icon
* @return string
*/
+
public static function getIcon($icon)
{
$iconh = '';
+
if (\is_array($icon)):
foreach ($icon as $iconkey => $iconrow):
$iconh .= ' ';
+
endforeach;
+
endif;
+
return $iconh;
}
@@ -140,6 +164,7 @@ public static function getIcon($icon)
* @param $author
* @return string
*/
+
public static function getAuthor($author)
{
return ' ';
@@ -149,6 +174,7 @@ public static function getAuthor($author)
* @param $canonical
* @return string
*/
+
public static function getCanonical($canonical)
{
return ' ';
@@ -158,6 +184,7 @@ public static function getCanonical($canonical)
* @param $manifest
* @return string
*/
+
public static function getManifest($manifest)
{
return ' ';
@@ -167,6 +194,7 @@ public static function getManifest($manifest)
* @param $google
* @return string
*/
+
public static function getGoogle($google)
{
return ' ';
@@ -176,16 +204,18 @@ public static function getGoogle($google)
* @param $bing
* @return string
*/
+
public static function getBing($bing)
{
return '
- ';
+ ';
}
/**
* @param $yandex
* @return string
*/
+
public static function getgetYandex($yandex)
{
return ' ';
@@ -195,6 +225,7 @@ public static function getgetYandex($yandex)
* @param $amp
* @return string
*/
+
public static function getAmp($amp)
{
return ' ';
@@ -204,32 +235,43 @@ public static function getAmp($amp)
* @param $crumb
* @return string
*/
+
public static function getBreadcrumb($crumb)
{
- $h = '';
- $count = 0;
+ $h = '';
+
+ $count = 0;
+
$bcount = \count($crumb);
+
if (\is_array($crumb)):
$h .= '';
+
endif;
+
return $h;
}
}
diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php
index 4987fcae..08928710 100644
--- a/class/Common/Migrate.php
+++ b/class/Common/Migrate.php
@@ -41,7 +41,7 @@ public function __construct()
$configurator = new $class();
$this->renameTables = $configurator->renameTables;
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
parent::__construct($moduleDirName);
}
diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php
index 7fce8e9e..12b9d552 100644
--- a/class/Common/ModuleFeedback.php
+++ b/class/Common/ModuleFeedback.php
@@ -68,7 +68,7 @@ public function getFormFeedback($action = false)
if (!$action) {
$action = $_SERVER['REQUEST_URI'];
}
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
// Get Theme Form
\xoops_load('XoopsFormLoader');
@@ -84,9 +84,9 @@ public function getFormFeedback($action = false)
$your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site);
$your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"');
$form->addElement($your_site);
- $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);
- $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');
- $form->addElement($your_mail);
+ $yourMail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email);
+ $yourMail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"');
+ $form->addElement($yourMail);
$fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type);
$fbtypeSelect->addOption('', '');
diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php
index ad32e7b3..6234fe98 100644
--- a/class/Common/ModuleStats.php
+++ b/class/Common/ModuleStats.php
@@ -17,6 +17,7 @@ trait ModuleStats
* @param array $moduleStats
* @return array
*/
+
public static function getModuleStats($configurator, $moduleStats)
{
if (\count($configurator->moduleStats) > 0) {
diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php
index 6f84dd44..1b1d44d1 100644
--- a/class/Common/ServerStats.php
+++ b/class/Common/ServerStats.php
@@ -29,7 +29,7 @@ trait ServerStats
public static function getServerStats()
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
\xoops_loadLanguage('common', $moduleDirName);
$html = '';
diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php
index 3897ce3d..1e8ddaa0 100644
--- a/class/Common/SysUtility.php
+++ b/class/Common/SysUtility.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-namespace XoopsModules\Publisher\Helper;
namespace XoopsModules\Publisher\Common;
/*
@@ -19,10 +18,9 @@
*/
/**
- *
* @license https://www.fsf.org/copyleft/gpl.html GNU public license
* @copyright https://xoops.org 2000-2020 © XOOPS Project
- * @author ZySpec
+ * @author ZySpec
* @author Mamba
*/
@@ -30,6 +28,7 @@
use XoopsFormDhtmlTextArea;
use XoopsFormTextArea;
use XoopsModules\Publisher;
+use XoopsModules\Publisher\Helper;
/**
* Class SysUtility
@@ -74,58 +73,58 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac
}
// splits all html-tags to scanable lines
\preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER);
- $total_length = mb_strlen($ending);
- $open_tags = [];
+ $totalLength = mb_strlen($ending);
+ $openTags = [];
$truncate = '';
- foreach ($lines as $line_matchings) {
+ foreach ($lines as $lineMatchings) {
// if there is any html-tag in this line, handle it and add it (uncounted) to the output
- if (!empty($line_matchings[1])) {
+ if (!empty($lineMatchings[1])) {
// if it's an "empty element" with or without xhtml-conform closing slash
- if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) {
+ if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $lineMatchings[1])) {
// do nothing
// if tag is a closing tag
- } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
- // delete tag from $open_tags list
- $pos = \array_search($tag_matchings[1], $open_tags, true);
+ } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $lineMatchings[1], $tagMatchings)) {
+ // delete tag from $openTags list
+ $pos = \array_search($tagMatchings[1], $openTags, true);
if (false !== $pos) {
- unset($open_tags[$pos]);
+ unset($openTags[$pos]);
}
// if tag is an opening tag
- } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) {
- // add tag to the beginning of $open_tags list
- \array_unshift($open_tags, mb_strtolower($tag_matchings[1]));
+ } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $lineMatchings[1], $tagMatchings)) {
+ // add tag to the beginning of $openTags list
+ \array_unshift($openTags, mb_strtolower($tagMatchings[1]));
}
// add html-tag to $truncate'd text
- $truncate .= $line_matchings[1];
+ $truncate .= $lineMatchings[1];
}
// calculate the length of the plain text part of the line; handle entities as one character
- $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2]));
- if ($total_length + $content_length > $length) {
+ $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $lineMatchings[2]));
+ if ($totalLength + $content_length > $length) {
// the number of characters which are left
- $left = $length - $total_length;
- $entities_length = 0;
+ $left = $length - $totalLength;
+ $entitiesLength = 0;
// search for html entities
- if (\preg_match_all('/&[0-9a-z]{2,8};|[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) {
+ if (\preg_match_all('/&[0-9a-z]{2,8};|[0-9]{1,7};|[0-9a-f]{1,6};/i', $lineMatchings[2], $entities, \PREG_OFFSET_CAPTURE)) {
// calculate the real length of all entities in the legal range
foreach ($entities[0] as $entity) {
- if ($left >= $entity[1] + 1 - $entities_length) {
+ if ($left >= $entity[1] + 1 - $entitiesLength) {
$left--;
- $entities_length += mb_strlen($entity[0]);
+ $entitiesLength += mb_strlen($entity[0]);
} else {
// no more characters left
break;
}
}
}
- $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length);
+ $truncate .= mb_substr($lineMatchings[2], 0, $left + $entitiesLength);
// maximum lenght is reached, so get off the loop
break;
}
- $truncate .= $line_matchings[2];
- $total_length += $content_length;
+ $truncate .= $lineMatchings[2];
+ $totalLength += $content_length;
// if the maximum length is reached, get off the loop
- if ($total_length >= $length) {
+ if ($totalLength >= $length) {
break;
}
}
@@ -148,7 +147,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac
$truncate .= $ending;
if ($considerHtml) {
// close all unclosed html-tags
- foreach ($open_tags as $tag) {
+ foreach ($openTags as $tag) {
$truncate .= '' . $tag . '>';
}
}
@@ -157,8 +156,8 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac
}
/**
- * @param \Xmf\Module\Helper $helper
- * @param array|null $options
+ * @param null|\Helper $helper
+ * @param array|null $options
* @return \XoopsFormDhtmlTextArea|\XoopsFormEditor
*/
public static function getEditor($helper = null, $options = null)
diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php
index e028d5c8..d5a5d7ea 100644
--- a/class/Common/VersionChecks.php
+++ b/class/Common/VersionChecks.php
@@ -24,14 +24,14 @@ trait VersionChecks
/**
* Verifies XOOPS version meets minimum requirements for this module
* @static
- * @param \XoopsModule $module
*
- * @param null|string $requiredVer
+ * @param \XoopsModule|null $module
+ * @param null|string $requiredVer
* @return bool true if meets requirements, false if not
*/
public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
{
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
if (null === $module) {
$module = \XoopsModule::getByDirname($moduleDirName);
@@ -63,7 +63,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
*/
public static function checkVerPhp(\XoopsModule $module = null)
{
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
if (null === $module) {
$module = \XoopsModule::getByDirname($moduleDirName);
@@ -98,7 +98,7 @@ public static function checkVerPhp(\XoopsModule $module = null)
*/
public static function checkVerModule($helper, $source = 'github', $default = 'master')
{
- $moduleDirName = \basename(\dirname(\dirname(__DIR__)));
+ $moduleDirName = \basename(dirname(__DIR__, 2));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
$update = '';
$repository = 'XoopsModules25x/' . $moduleDirName;
diff --git a/class/Constants.php b/class/Constants.php
index 37613f3f..2c57d5d8 100644
--- a/class/Constants.php
+++ b/class/Constants.php
@@ -17,13 +17,10 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
- * @subpackage Include
* @since 1.0
* @author trabis
*/
-
/**
* interface Constants
*/
@@ -36,13 +33,11 @@ interface Constants
public const PUBLISHER_STATUS_PUBLISHED = 2;
public const PUBLISHER_STATUS_OFFLINE = 3;
public const PUBLISHER_STATUS_REJECTED = 4;
-
// Notification Events
public const PUBLISHER_NOT_CATEGORY_CREATED = 1;
public const PUBLISHER_NOTIFY_ITEM_SUBMITTED = 2;
public const PUBLISHER_NOTIFY_ITEM_PUBLISHED = 3;
public const PUBLISHER_NOTIFY_ITEM_REJECTED = 4;
-
// Form constants
public const PUBLISHER_SUMMARY = 1;
//const PUBLISHER_DISPLAY_SUMMARY = 2;
@@ -70,16 +65,13 @@ interface Constants
public const PUBLISHER_SUBTITLE = 24;
public const PUBLISHER_AUTHOR_ALIAS = 25;
public const PUBLISHER_DATEEXPIRE = 26;
-
// Global constants
public const PUBLISHER_SEARCH = 1;
public const PUBLISHER_RATE = 2;
-
// File status
public const PUBLISHER_STATUS_FILE_NOTSET = -1;
public const PUBLISHER_STATUS_FILE_ACTIVE = 1;
public const PUBLISHER_STATUS_FILE_INACTIVE = 2;
-
// Image categories
public const PUBLISHER_IMGCAT_ALL = 'all';
}
diff --git a/class/File.php b/class/File.php
index 49ff49fc..7cc82290 100644
--- a/class/File.php
+++ b/class/File.php
@@ -17,15 +17,13 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
*/
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Utility;
require_once \dirname(__DIR__) . '/include/common.php';
@@ -49,9 +47,9 @@ class File extends \XoopsObject
*/
public function __construct($id = null)
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
- /** @var \XoopsDatabase $db */
+ /** @var \XoopsMySQLDatabase $db */
$this->db = \XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('fileid', \XOBJ_DTYPE_INT, 0, false);
$this->initVar('itemid', \XOBJ_DTYPE_INT, null, true);
@@ -109,7 +107,7 @@ public function checkUpload($postField, $allowedMimetypes, &$errors)
$maxfilewidth = $this->helper->getConfig('maximum_image_width');
$maxfileheight = $this->helper->getConfig('maximum_image_height');
\xoops_load('XoopsMediaUploader');
- $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
+ $uploader = new \XoopsMediaUploader(Utility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($postField)) {
return true;
}
@@ -129,22 +127,22 @@ public function storeUpload($postField, $allowedMimetypes, &$errors)
{
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $this->helper->getHandler('Mimetype');
- $itemid = $this->getVar('itemid');
+ $itemId = $this->getVar('itemid');
if (0 === \count($allowedMimetypes)) {
$allowedMimetypes = $mimetypeHandler->getArrayByType();
}
$maxfilesize = $this->helper->getConfig('maximum_filesize');
$maxfilewidth = $this->helper->getConfig('maximum_image_width');
$maxfileheight = $this->helper->getConfig('maximum_image_height');
- if (!\is_dir(Publisher\Utility::getUploadDir())) {
- if (!\mkdir($concurrentDirectory = Publisher\Utility::getUploadDir(), 0757) && !\is_dir($concurrentDirectory)) {
+ if (!\is_dir(Utility::getUploadDir())) {
+ if (!\mkdir($concurrentDirectory = Utility::getUploadDir(), 0757) && !\is_dir($concurrentDirectory)) {
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $concurrentDirectory));
}
}
\xoops_load('XoopsMediaUploader');
- $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
+ $uploader = new \XoopsMediaUploader(Utility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($postField)) {
- $uploader->setTargetFileName($itemid . '_' . $uploader->getMediaName());
+ $uploader->setTargetFileName($itemId . '_' . $uploader->getMediaName());
if ($uploader->upload()) {
$this->setVar('filename', $uploader->getSavedFileName());
if ('' == $this->getVar('name')) {
@@ -216,7 +214,7 @@ public function notLoaded()
*/
public function getFileUrl()
{
- return Publisher\Utility::getUploadDir(false) . $this->filename();
+ return Utility::getUploadDir(false) . $this->filename();
}
/**
@@ -224,7 +222,7 @@ public function getFileUrl()
*/
public function getFilePath()
{
- return Publisher\Utility::getUploadDir() . $this->filename();
+ return Utility::getUploadDir() . $this->filename();
}
/**
diff --git a/class/FileHandler.php b/class/FileHandler.php
index 1fff5011..878783ed 100644
--- a/class/FileHandler.php
+++ b/class/FileHandler.php
@@ -17,7 +17,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -25,8 +24,6 @@
use XoopsModules\Publisher;
-
-
require_once \dirname(__DIR__) . '/include/common.php';
// File status
@@ -40,7 +37,6 @@
* of File class objects.
*
* @author marcan
- * @package Publisher
*/
class FileHandler extends \XoopsPersistableObjectHandler
{
@@ -50,13 +46,9 @@ class FileHandler extends \XoopsPersistableObjectHandler
*/
public $helper;
- /**
- * @param \XoopsDatabase $db
- * @param \XoopsModules\Publisher\Helper|null $helper
- */
public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null)
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
if (null === $helper) {
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
} else {
@@ -110,7 +102,7 @@ public function deleteItemFiles(\XoopsObject $itemObj)
/**
* retrieve all files
*
- * @param int $itemid
+ * @param int $itemId
* @param int|array $status
* @param int $limit
* @param int $start
@@ -120,7 +112,7 @@ public function deleteItemFiles(\XoopsObject $itemObj)
*
* @return array array of {@link File} objects
*/
- public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = [])
+ public function getAllFiles($itemId = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = [])
{
$files = [];
@@ -151,9 +143,9 @@ public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $
$criteriaCategory->add(new \Criteria('l.categoryid', $cat), 'OR');
}
}
- $criteriaItemid = new \Criteria('o.itemid', $itemid);
+ $criteriaItemid = new \Criteria('o.itemid', $itemId);
$criteria = new \CriteriaCompo();
- if (0 != $itemid) {
+ if (0 != $itemId) {
$criteria->add($criteriaItemid);
}
if ($hasStatusCriteria) {
diff --git a/class/Form/CategoryForm.php b/class/Form/CategoryForm.php
index 91ce84da..2eec7db4 100644
--- a/class/Form/CategoryForm.php
+++ b/class/Form/CategoryForm.php
@@ -19,15 +19,14 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
*/
use Xmf\Request;
use XoopsModules\Publisher;
-
-
+use XoopsModules\Publisher\Helper;
+use XoopsModules\Publisher\Utility;
// require_once dirname(dirname(__DIR__)) . '/include/common.php';
@@ -43,11 +42,8 @@ class CategoryForm extends \XoopsThemeForm
* @var Publisher\Helper
*/
public $helper;
-
public $targetObject;
-
public $subCatsCount = 4;
-
public $userGroups = [];
/**
@@ -56,8 +52,8 @@ class CategoryForm extends \XoopsThemeForm
*/
public function __construct(&$target, $subCatsCount = 4)
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
- $this->helper = \XoopsModules\Publisher\Helper::getInstance();
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
+ $this->helper = Helper::getInstance();
$this->targetObject = &$target;
$this->subCatsCount = $subCatsCount;
@@ -82,7 +78,7 @@ public function createElements()
$myTree = new \XoopsObjectTree($this->helper->getHandler('Category')->getObjects($criteria), 'categoryid', 'parentid');
$moduleDirName = \basename(\dirname(__DIR__));
$module = \XoopsModule::getByDirname($moduleDirName);
- if (Publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
+ if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
$catSelect = $myTree->makeSelectElement('parentid', 'name', '--', $this->targetObject->parentid(), true, 0, '', \_AM_PUBLISHER_PARENT_CATEGORY_EXP);
$this->addElement($catSelect);
} else {
@@ -100,19 +96,19 @@ public function createElements()
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$grouppermHandler = $this->helper->getHandler('GroupPerm');
$moduleId = $this->helper->getModule()->mid();
- $allowedEditors = Publisher\Utility::getEditors($grouppermHandler->getItemIds('editors', $groups, $moduleId));
+ $allowedEditors = Utility::getEditors($grouppermHandler->getItemIds('editors', $groups, $moduleId));
$nohtml = false;
if (\count($allowedEditors) > 0) {
$editor = Request::getString('editor', '', 'POST');
if (!empty($editor)) {
- Publisher\Utility::setCookieVar('publisher_editor', $editor);
+ Utility::setCookieVar('publisher_editor', $editor);
} else {
- $editor = Publisher\Utility::getCookieVar('publisher_editor');
+ $editor = Utility::getCookieVar('publisher_editor');
if (empty($editor) && \is_object($GLOBALS['xoopsUser'])) {
$editor = $GLOBALS['xoopsUser']->getVar('publisher_editor') ?? ''; // Need set through user profile
}
}
- $editor = (empty($editor) || !\in_array($editor, $allowedEditors)) ? $this->helper->getConfig('submit_editor') : $editor;
+ $editor = (empty($editor) || !\in_array($editor, $allowedEditors, true)) ? $this->helper->getConfig('submit_editor') : $editor;
$formEditor = new \XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
$this->addElement($formEditor);
} else {
@@ -133,20 +129,20 @@ public function createElements()
$this->addElement($textHeader);
// IMAGE
- $imageArray = \XoopsLists::getImgListAsArray(Publisher\Utility::getImageDir('category'));
+ $imageArray = \XoopsLists::getImgListAsArray(Utility::getImageDir('category'));
$imageSelect = new \XoopsFormSelect('', 'image', $this->targetObject->getImage());
//$imageSelect -> addOption ('-1', '---------------');
$imageSelect->addOptionArray($imageArray);
$imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . '", "", "' . XOOPS_URL . "\")'");
$imageTray = new \XoopsFormElementTray(\_AM_PUBLISHER_IMAGE, ' ');
$imageTray->addElement($imageSelect);
- $imageTray->addElement(new \XoopsFormLabel('', " targetObject->getImage() . "' name='image3' id='image3' alt=''>"));
+ $imageTray->addElement(new \XoopsFormLabel('', " targetObject->getImage() . "' name='image3' id='image3' alt=''>"));
$imageTray->setDescription(\_AM_PUBLISHER_IMAGE_DSC);
$this->addElement($imageTray);
// IMAGE UPLOAD
- $max_size = 5000000;
- $fileBox = new \XoopsFormFile(\_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size);
+ $maxSize = 5000000;
+ $fileBox = new \XoopsFormFile(\_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $maxSize);
$fileBox->setExtra("size ='45'");
$fileBox->setDescription(\_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
$this->addElement($fileBox);
@@ -183,8 +179,8 @@ public function createElements()
$groupsReadCheckbox = new \XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead());
- foreach ($this->userGroups as $group_id => $group_name) {
- $groupsReadCheckbox->addOption($group_id, $group_name);
+ foreach ($this->userGroups as $groupId => $groupName) {
+ $groupsReadCheckbox->addOption($groupId, $groupName);
}
$readPermissionsTray->addElement($groupsReadCheckbox);
$this->addElement($readPermissionsTray);
@@ -200,8 +196,8 @@ public function createElements()
$submitPermissionsTray->addElement($selectAllSubmitCheckbox);
$groupsSubmitCheckbox = new \XoopsFormCheckBox('', 'groupsSubmit[]', $this->targetObject->getGroupsSubmit());
- foreach ($this->userGroups as $group_id => $group_name) {
- $groupsSubmitCheckbox->addOption($group_id, $group_name);
+ foreach ($this->userGroups as $groupId => $groupName) {
+ $groupsSubmitCheckbox->addOption($groupId, $groupName);
}
$submitPermissionsTray->addElement($groupsSubmitCheckbox);
$this->addElement($submitPermissionsTray);
@@ -218,8 +214,8 @@ public function createElements()
$groupsModerationCheckbox = new \XoopsFormCheckBox('', 'groupsModeration[]', $this->targetObject->getGroupsModeration());
- foreach ($this->userGroups as $group_id => $group_name) {
- $groupsModerationCheckbox->addOption($group_id, $group_name);
+ foreach ($this->userGroups as $groupId => $groupName) {
+ $groupsModerationCheckbox->addOption($groupId, $groupName);
}
$moderatePermissionsTray->addElement($groupsModerationCheckbox);
$this->addElement($moderatePermissionsTray);
diff --git a/class/Form/FileForm.php b/class/Form/FileForm.php
index 31ca0f5c..366fa853 100644
--- a/class/Form/FileForm.php
+++ b/class/Form/FileForm.php
@@ -19,7 +19,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
*/
@@ -27,14 +26,11 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
// require_once dirname(dirname(__DIR__)) . '/include/common.php';
\xoops_load('XoopsFormLoader');
//todo: move to admin?
//xoops_loadLanguage('main', 'publisher');
-/** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
$helper->loadLanguage('main');
@@ -47,15 +43,15 @@ class FileForm extends \XoopsThemeForm
* @var Publisher\Helper
*/
public $helper;
-
public $targetObject;
/**
+ * FileForm constructor.
* @param $target
*/
public function __construct(&$target)
{
- /** @var Publisher\Helper $this ->helper */
+ /** @var Publisher\Helper $this->helper */
$this->helper = Publisher\Helper::getInstance();
$this->targetObject = &$target;
diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php
index 99726769..37acd5df 100644
--- a/class/Form/ItemForm.php
+++ b/class/Form/ItemForm.php
@@ -19,8 +19,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Class
- * @subpackage Forms
* @since 1.0
* @author trabis
*/
@@ -28,8 +26,8 @@
use Xmf\Request;
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;
-
-
+use XoopsModules\Publisher\Helper;
+use XoopsModules\Publisher\Utility;
// require_once dirname(dirname(__DIR__)) . '/include/common.php';
@@ -51,7 +49,6 @@ class ItemForm extends Publisher\ThemeTabForm
\_CO_PUBLISHER_TAB_FILES => 'filesTab',
\_CO_PUBLISHER_TAB_OTHERS => 'othersTab',
];
-
public $mainTab = [
Constants::PUBLISHER_SUBTITLE,
Constants::PUBLISHER_ITEM_SHORT_URL,
@@ -69,15 +66,12 @@ class ItemForm extends Publisher\ThemeTabForm
Constants::PUBLISHER_AVAILABLE_PAGE_WRAP,
Constants::PUBLISHER_UID,
];
-
public $imagesTab = [
Constants::PUBLISHER_IMAGE_ITEM,
];
-
public $filesTab = [
Constants::PUBLISHER_ITEM_UPLOAD_FILE,
];
-
public $othersTab = [
Constants::PUBLISHER_ITEM_META_KEYWORDS,
Constants::PUBLISHER_ITEM_META_DESCRIPTION,
@@ -100,8 +94,7 @@ public function setCheckPermissions($checkperm)
*/
public function isGranted($item)
{
- /** @var Publisher\Helper $helper */
- $helper = Publisher\Helper::getInstance();
+ $helper = Helper::getInstance();
$ret = false;
if (!$this->checkperm || $helper->getHandler('Permission')->isGranted('form_view', $item)) {
$ret = true;
@@ -139,15 +132,14 @@ public function hasTab($tab)
*/
public function createElements($obj)
{
- /** @var Publisher\Helper $helper */
- $helper = Publisher\Helper::getInstance();
+ $helper = Helper::getInstance();
+ $timeoffset = null;
- $allowedEditors = Publisher\Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors'));
+ $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors'));
if (!\is_object($GLOBALS['xoopsUser'])) {
$group = [XOOPS_GROUP_ANONYMOUS];
$currentUid = 0;
- $timeoffset = null;
} else {
$group = $GLOBALS['xoopsUser']->getGroups();
$currentUid = $GLOBALS['xoopsUser']->uid();
@@ -184,7 +176,6 @@ public function createElements($obj)
require_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
$textTags = new \XoopsModules\Tag\FormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
$textTags->setClass('form-control');
- /** @var \XoopsModules\Tag\FormTag $textTags */
$this->addElement($textTags);
}
@@ -195,15 +186,15 @@ public function createElements($obj)
} elseif (\count($allowedEditors) > 0) {
$editor = Request::getString('editor', '', 'POST');
if (!empty($editor)) {
- Publisher\Utility::setCookieVar('publisher_editor', $editor);
+ Utility::setCookieVar('publisher_editor', $editor);
} else {
- $editor = Publisher\Utility::getCookieVar('publisher_editor');
+ $editor = Utility::getCookieVar('publisher_editor');
if (empty($editor) && \is_object($GLOBALS['xoopsUser'])) {
// $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile
$editor = $GLOBALS['xoopsUser']->getVar('publisher_editor') ?? ''; // Need set through user profile
}
}
- $editor = (empty($editor) || !\in_array($editor, $allowedEditors)) ? $helper->getConfig('submit_editor') : $editor;
+ $editor = (empty($editor) || !\in_array($editor, $allowedEditors, true)) ? $helper->getConfig('submit_editor') : $editor;
$formEditor = new \XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
$this->addElement($formEditor);
@@ -242,8 +233,8 @@ public function createElements($obj)
|| $this->isGranted(Constants::PUBLISHER_DOIMAGE)
|| $this->isGranted(Constants::PUBLISHER_DOLINEBREAK)) {
if ($this->isGranted(Constants::PUBLISHER_DOHTML)) {
- $html_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
- $this->addElement($html_radio);
+ $htmlRadio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
+ $this->addElement($htmlRadio);
}
if ($this->isGranted(Constants::PUBLISHER_DOSMILEY)) {
$smiley_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
@@ -265,7 +256,7 @@ public function createElements($obj)
// Available pages to wrap
if ($this->isGranted(Constants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
- $wrapPages = \XoopsLists::getHtmlListAsArray(Publisher\Utility::getUploadDir(true, 'content'));
+ $wrapPages = \XoopsLists::getHtmlListAsArray(Utility::getUploadDir(true, 'content'));
$availableWrapPagesText = [];
foreach ($wrapPages as $page) {
$availableWrapPagesText[] = "$page ";
@@ -350,18 +341,16 @@ public function createElements($obj)
if ($obj->isNew()) {
$dateexpire = \time();
$dateexpire_opt = 0;
+ } elseif (0 == $obj->getVar('dateexpire')) {
+ $dateexpire_opt = 0;
+ $dateexpire = \time();
} else {
- if (0 == $obj->getVar('dateexpire')) {
- $dateexpire_opt = 0;
- $dateexpire = \time();
- } else {
- $dateexpire_opt = 1;
- $dateexpire = $obj->getVar('dateexpire');
- }
+ $dateexpire_opt = 1;
+ $dateexpire = $obj->getVar('dateexpire');
}
$dateExpireYesNo = new \XoopsFormRadioYN('', 'use_expire_yn', $dateexpire_opt);
- $dateexpire = formatTimestamp($dateexpire, 'U', $timeoffset);
+ $dateexpire = \strtotime(\formatTimestamp($dateexpire)); //set to user timezone
$dateexpire_datetime = new \XoopsFormDateTime('', 'dateexpire', $size = 15, $dateexpire, true);
if (0 == $dateexpire_opt) {
$dateexpire_datetime->setExtra('disabled="disabled"');
@@ -401,7 +390,7 @@ public function createElements($obj)
$catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
}
$imgcatConfig = $helper->getConfig('submit_imgcat');
- if (\in_array(Constants::PUBLISHER_IMGCAT_ALL, $imgcatConfig)) {
+ if (\in_array(Constants::PUBLISHER_IMGCAT_ALL, $imgcatConfig, true)) {
$catids = \array_keys($catlist);
} else {
// compare selected in options with readable of user
diff --git a/class/FormDateTime.php b/class/FormDateTime.php
index f557f9c4..888409c4 100644
--- a/class/FormDateTime.php
+++ b/class/FormDateTime.php
@@ -18,12 +18,9 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
*/
-
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -49,7 +46,7 @@ public function __construct($caption, $name, $size = 15, $value = 0, $showtime =
}
$datetime = \getdate($value);
- $this->addElement(new \XoopsFormTextDateSelect('', $name . '[date]', $size, $value, $showtime));
+ $this->addElement(new \XoopsFormTextDateSelect('', $name . '[date]', $size, $value));
$timearray = [];
for ($i = 0; $i < 24; ++$i) {
for ($j = 0; $j < 60; $j += 10) {
diff --git a/class/GroupPermHandler.php b/class/GroupPermHandler.php
index c1aefa72..8c55710f 100644
--- a/class/GroupPermHandler.php
+++ b/class/GroupPermHandler.php
@@ -19,13 +19,9 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
*/
-
-
-
require_once $GLOBALS['xoops']->path('kernel/groupperm.php');
require_once \dirname(__DIR__) . '/include/common.php';
diff --git a/class/Helper.php b/class/Helper.php
index 11ba5d01..1acbe295 100644
--- a/class/Helper.php
+++ b/class/Helper.php
@@ -18,8 +18,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Class
- * @subpackage Utils
* @since 1.0
* @author trabis
*/
@@ -89,6 +87,7 @@ public function getHandler($name)
$helper = self::getInstance();
$ret = new $class($db, $helper);
$this->addLog("Getting handler '{$name}'");
+
return $ret;
}
}
diff --git a/class/Highlighter.php b/class/Highlighter.php
index d8a6fdac..1a771b9d 100644
--- a/class/Highlighter.php
+++ b/class/Highlighter.php
@@ -31,7 +31,6 @@ class Highlighter
* @var bool
*/
protected $simple = false;
-
/**
* Only match whole words in the string
* (off by default)
@@ -39,7 +38,6 @@ class Highlighter
* @var bool
*/
protected $wholeWords = false;
-
/**
* Case sensitive matching
* (off by default)
@@ -47,14 +45,12 @@ class Highlighter
* @var bool
*/
protected $caseSens = false;
-
/**
* Overwrite links if matched
* This should be used when the replacement string is a link
* (off by default)
*/
protected $stripLinks = false;
-
/**
* Style for the output string
*
@@ -108,7 +104,7 @@ public function setReplacementString($value)
* @param string $text Haystack - The text to search
* @param array|string $needle Needle - The string to highlight
*
- * @return string $text with needle highlighted
+ * @return string $text (with needle highlighted)
*/
public function highlight($text, $needle)
{
diff --git a/class/Item.php b/class/Item.php
index 9a4ced19..7a4159ea 100644
--- a/class/Item.php
+++ b/class/Item.php
@@ -17,7 +17,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -25,10 +24,10 @@
use Xmf\Request;
use XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
//namespace Publisher;
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -41,7 +40,6 @@ class Item extends \XoopsObject
*/
public $helper;
public $groupsRead = [];
-
/**
* @var Publisher\Category
*/
@@ -54,8 +52,8 @@ public function __construct($id = null)
{
/** @var \XoopsModules\Publisher\Helper $this->helper */
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
- /** @var \XoopsDatabase $this->db */
- $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
+ /** @var \XoopsMySQLDatabase $this->db */
+ $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('itemid', \XOBJ_DTYPE_INT, 0);
$this->initVar('categoryid', \XOBJ_DTYPE_INT, 0, false);
$this->initVar('title', \XOBJ_DTYPE_TXTBOX, '', true, 255);
@@ -132,7 +130,7 @@ public function getTitle($maxLength = 0, $format = 'S')
if (0 != $maxLength) {
if (!XOOPS_USE_MULTIBYTES) {
if (mb_strlen($ret) >= $maxLength) {
- $ret = Publisher\Utility::substr($ret, 0, $maxLength);
+ $ret = Utility::substr($ret, 0, $maxLength);
}
}
}
@@ -152,7 +150,7 @@ public function getSubtitle($maxLength = 0, $format = 'S')
if (0 != $maxLength) {
if (!XOOPS_USE_MULTIBYTES) {
if (mb_strlen($ret) >= $maxLength) {
- $ret = Publisher\Utility::substr($ret, 0, $maxLength);
+ $ret = Utility::substr($ret, 0, $maxLength);
}
}
}
@@ -176,9 +174,9 @@ public function getSummary($maxLength = 0, $format = 'S', $stripTags = '')
if (0 != $maxLength) {
if (!XOOPS_USE_MULTIBYTES) {
if (mb_strlen($ret) >= $maxLength) {
- //$ret = Publisher\Utility::substr($ret , 0, $maxLength);
- // $ret = Publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false);
- $ret = Publisher\Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false);
+ //$ret = Utility::substr($ret , 0, $maxLength);
+ // $ret = Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false);
+ $ret = Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false);
}
}
}
@@ -215,7 +213,7 @@ public function getBlockSummary($maxLength = 0, $fullSummary = false)
public function wrapPage($fileName)
{
$content = '';
- $page = Publisher\Utility::getUploadDir(true, 'content') . $fileName;
+ $page = Utility::getUploadDir(true, 'content') . $fileName;
if (\file_exists($page)) {
// this page uses smarty template
\ob_start();
@@ -256,8 +254,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '')
while (!(false === $wrapPos)) {
$endWrapPos = mb_strpos($ret, ']', $wrapPos);
if ($endWrapPos) {
- $wrap_page_name = mb_substr($ret, $wrapPos + $wrapCodeLength, $endWrapPos - $wrapCodeLength - $wrapPos);
- $wrapPages[] = $wrap_page_name;
+ $wrapPagename = mb_substr($ret, $wrapPos + $wrapCodeLength, $endWrapPos - $wrapCodeLength - $wrapPos);
+ $wrapPages[] = $wrapPagename;
}
$wrapPos = mb_strpos($ret, '[pagewrap=', $endWrapPos - 1);
}
@@ -278,8 +276,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '')
if (0 != $maxLength) {
if (!XOOPS_USE_MULTIBYTES) {
if (mb_strlen($ret) >= $maxLength) {
- //$ret = Publisher\Utility::substr($ret , 0, $maxLength);
- $ret = Publisher\Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false);
+ //$ret = Utility::substr($ret , 0, $maxLength);
+ $ret = Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false);
}
}
}
@@ -319,7 +317,7 @@ public function getDateExpire($dateFormat = '', $format = 'S')
return \formatTimestamp($this->getVar('dateexpire', $format), $dateFormat);
}
-
+
/**
* @param int $realName
*
@@ -444,7 +442,7 @@ public function getCategoryPath($withAllLink = true)
*/
public function getCategoryImagePath()
{
- return Publisher\Utility::getImageDir('category', false) . $this->getCategory()->getImage();
+ return Utility::getImageDir('category', false) . $this->getCategory()->getImage();
}
/**
@@ -462,21 +460,21 @@ public function getAdminLinks()
{
$adminLinks = '';
if (\is_object($GLOBALS['xoopsUser'])
- && (Publisher\Utility::userIsAdmin() || Publisher\Utility::userIsAuthor($this)
+ && (Utility::userIsAdmin() || Utility::userIsAuthor($this)
|| $this->helper->getHandler('Permission')->isGranted('item_submit', $this->categoryid()))) {
- if (Publisher\Utility::userIsAdmin() || Publisher\Utility::userIsAuthor($this) || Publisher\Utility::userIsModerator($this)) {
- if ($this->helper->getConfig('perm_edit') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) {
+ if (Utility::userIsAdmin() || Utility::userIsAuthor($this) || Utility::userIsModerator($this)) {
+ if ($this->helper->getConfig('perm_edit') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Edit button
$adminLinks .= "itemid() . "'> ";
$adminLinks .= ' ';
}
- if ($this->helper->getConfig('perm_delete') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) {
+ if ($this->helper->getConfig('perm_delete') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Delete button
$adminLinks .= "itemid() . "'> ";
$adminLinks .= ' ';
}
}
- if ($this->helper->getConfig('perm_clone') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) {
+ if ($this->helper->getConfig('perm_clone') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Duplicate button
$adminLinks .= "itemid() . "'> ";
$adminLinks .= ' ';
@@ -485,41 +483,43 @@ public function getAdminLinks()
return $adminLinks;
}
-
- /**
+
+ /**
* @return string
*/
public function getPdfButton()
{
- $pdfButton = '';
+ $pdfButton = '';
// PDF button
- if (!\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) {
- // if (is_object($GLOBALS['xoopsUser']) && Publisher\Utility::userIsAdmin()) {
- // $GLOBALS['xoTheme']->addStylesheet('/modules/system/css/jquery.jgrowl.min.css');
- // $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
- // $adminLinks .= '';
- // }
- } else {
- $pdfButton .= "itemid() . "' rel='nofollow' target='_blank'> ";
- $pdfButton .= ' ';
- }
- return $pdfButton;
+ if (!\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) {
+ // if (is_object($GLOBALS['xoopsUser']) && Utility::userIsAdmin()) {
+ // $GLOBALS['xoTheme']->addStylesheet('/modules/system/css/jquery.jgrowl.min.css');
+ // $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
+ // $adminLinks .= '';
+ // }
+ } else {
+ $pdfButton .= "itemid() . "' rel='nofollow' target='_blank'> ";
+ $pdfButton .= ' ';
}
- /**
+ return $pdfButton;
+ }
+
+ /**
* @return string
*/
public function getPrintLinks()
{
- $printLinks = '';
+ $printLinks = '';
// Print button
$printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'> ";
$printLinks .= ' ';
+
return $printLinks;
}
@@ -569,7 +569,7 @@ public function setDefaultPermissions()
{
$memberHandler = \xoops_getHandler('member');
$groups = $memberHandler->getGroupList();
- $groupIds = 0 < \count($groups) ? \array_keys($groups) : [];
+ $groupIds = \count($groups) > 0 ? \array_keys($groups) : [];
/*
$j = 0;
$groupIds = [];
@@ -718,10 +718,10 @@ public function buildMainText($itemPageId = -1, $body = null)
public function getImages()
{
static $ret;
- $itemid = $this->getVar('itemid');
- if (!isset($ret[$itemid])) {
- $ret[$itemid]['main'] = '';
- $ret[$itemid]['others'] = [];
+ $itemId = $this->getVar('itemid');
+ if (!isset($ret[$itemId])) {
+ $ret[$itemId]['main'] = '';
+ $ret[$itemId]['others'] = [];
$imagesIds = [];
$image = $this->getVar('image');
$images = $this->getVar('images');
@@ -740,16 +740,16 @@ public function getImages()
}
foreach ($imageObjs as $id => $imageObj) {
if ($id == $image) {
- $ret[$itemid]['main'] = $imageObj;
+ $ret[$itemId]['main'] = $imageObj;
} else {
- $ret[$itemid]['others'][] = $imageObj;
+ $ret[$itemId]['others'][] = $imageObj;
}
unset($imageObj);
}
unset($imageObjs);
}
- return $ret[$itemid];
+ return $ret[$itemId];
}
/**
@@ -767,50 +767,50 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS
$itemPageId = $display;
$display = 'all';
}
- $item['itemid'] = $this->itemid();
- $item['uid'] = $this->uid();
- $item['itemurl'] = $this->getItemUrl();
- $item['titlelink'] = $this->getItemLink('titlelink', $maxCharTitle);
- $item['subtitle'] = $this->subtitle();
- $item['datesub'] = $this->getDatesub();
- $item['dateexpire'] = $this->getDateExpire();
- $item['counter'] = $this->counter();
- $item['hits'] = ' ' . $this->counter() . ' ' . _READS . '';
- $item['who'] = $this->getWho();
- $item['when'] = $this->getWhen();
- $item['category'] = $this->getCategoryName();
- $item['categorylink'] = $this->getCategoryLink();
- $item['cancomment'] = $this->cancomment();
- $comments = $this->comments();
- if ($comments > 0) {
- //shows 1 comment instead of 1 comm. if comments ==1
- //langugage file modified accordingly
- if (1 == $comments) {
- $item['comments'] = ' ' . \_MD_PUBLISHER_ONECOMMENT . ' ';
- } else {
- $item['comments'] = ' ' . $comments . ' ' . \_MD_PUBLISHER_COMMENTS . ' ';
- }
+ $item['itemid'] = $this->itemid();
+ $item['uid'] = $this->uid();
+ $item['itemurl'] = $this->getItemUrl();
+ $item['titlelink'] = $this->getItemLink('titlelink', $maxCharTitle);
+ $item['subtitle'] = $this->subtitle();
+ $item['datesub'] = $this->getDatesub();
+ $item['dateexpire'] = $this->getDateExpire();
+ $item['counter'] = $this->counter();
+ $item['hits'] = ' ' . $this->counter() . ' ' . _READS . '';
+ $item['who'] = $this->getWho();
+ $item['when'] = $this->getWhen();
+ $item['category'] = $this->getCategoryName();
+ $item['categorylink'] = $this->getCategoryLink();
+ $item['cancomment'] = $this->cancomment();
+ $comments = $this->comments();
+ if ($comments > 0) {
+ //shows 1 comment instead of 1 comm. if comments ==1
+ //langugage file modified accordingly
+ if (1 == $comments) {
+ $item['comments'] = ' ' . \_MD_PUBLISHER_ONECOMMENT . ' ';
} else {
- $item['comments'] = ' ' . \_MD_PUBLISHER_NO_COMMENTS . ' ';
+ $item['comments'] = ' ' . $comments . ' ' . \_MD_PUBLISHER_COMMENTS . ' ';
}
- $item = $this->getMainImage($item);
+ } else {
+ $item['comments'] = ' ' . \_MD_PUBLISHER_NO_COMMENTS . ' ';
+ }
+ $item = $this->getMainImage($item);
switch ($display) {
case 'summary':
- $item = $this->toArrayFull($item);
+ $item = $this->toArrayFull($item);
$item = $this->toArrayAll($item, $itemPageId);
case 'list':
- $item = $this->toArrayFull($item);
+ $item = $this->toArrayFull($item);
$item = $this->toArrayAll($item, $itemPageId);
- //break;
+ //break;
case 'full':
- $item = $this->toArrayFull($item);
+ $item = $this->toArrayFull($item);
$item = $this->toArrayAll($item, $itemPageId);
case 'wfsection':
- $item = $this->toArrayFull($item);
+ $item = $this->toArrayFull($item);
$item = $this->toArrayAll($item, $itemPageId);
case 'default':
- $item = $this->toArrayFull($item);
- $item = $this->toArrayAll($item, $itemPageId);
+ $item = $this->toArrayFull($item);
+ $item = $this->toArrayAll($item, $itemPageId);
$summary = $this->getSummary($maxCharSummary);
if (!$summary) {
$summary = $this->getBody($maxCharSummary);
@@ -847,20 +847,20 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS
*/
public function toArrayFull($item)
{
- $item['title'] = $this->getTitle();
- $item['clean_title'] = $this->getTitle();
- $item['itemurl'] = $this->getItemUrl();
-
+ $item['title'] = $this->getTitle();
+ $item['clean_title'] = $this->getTitle();
+ $item['itemurl'] = $this->getItemUrl();
+
$item['adminlink'] = $this->getAdminLinks();
- $item['pdfbutton'] = $this->getPdfButton();
- $item['printlink'] = $this->getPrintLinks();
+ $item['pdfbutton'] = $this->getPdfButton();
+ $item['printlink'] = $this->getPrintLinks();
$item['categoryPath'] = $this->getCategoryPath($this->helper->getConfig('format_linked_path'));
$item['who_when'] = $this->getWhoAndWhen();
$item['who'] = $this->getWho();
$item['when'] = $this->getWhen();
$item['category'] = $this->getCategoryName();
- $item['body'] = $this->getBody();
- $item['more'] = $this->getItemUrl();
+ $item['body'] = $this->getBody();
+ $item['more'] = $this->getItemUrl();
$item = $this->getMainImage($item);
return $item;
@@ -1028,7 +1028,7 @@ public function getForm($title = 'default', $checkperm = true)
*/
public function accessGranted()
{
- if (Publisher\Utility::userIsAdmin()) {
+ if (Utility::userIsAdmin()) {
return true;
}
if (Constants::PUBLISHER_STATUS_PUBLISHED != $this->getVar('status')) {
@@ -1048,11 +1048,11 @@ public function accessGranted()
public function setVarsFromRequest()
{
//Required fields
- // if (!empty($categoryid = Request::getInt('categoryid', 0, 'POST'))) {
- // $this->setVar('categoryid', $categoryid);}
+ // if (!empty($categoryId = Request::getInt('categoryid', 0, 'POST'))) {
+ // $this->setVar('categoryid', $categoryId);}
if (\is_object($GLOBALS['xoopsUser'])) {
$userTimeoffset = $GLOBALS['xoopsUser']->getVar('timezone_offset');
- }else{
+ } else {
$userTimeoffset = null;
}
$this->setVar('categoryid', Request::getInt('categoryid', 0, 'POST'));
@@ -1079,7 +1079,7 @@ public function setVarsFromRequest()
if ($imageName == $imageFeatured) {
$this->setVar('image', $id);
}
- if (\in_array($imageName, $imageItem)) {
+ if (\in_array($imageName, $imageItem, true)) {
$imageItemIds[] = $id;
}
}
@@ -1103,8 +1103,8 @@ public function setVarsFromRequest()
// if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
// $this->setVar('datesub', strtotime(Request::getArray('datesub', array(), 'POST')['date']) + Request::getArray('datesub', array(), 'POST')['time']);
// } else {
- $resDate = Request::getArray('datesub', [], 'POST');
- $resTime = Request::getArray('datesub', [], 'POST');
+ $resDate = Request::getArray('datesub', [], 'POST');
+ $resTime = Request::getArray('datesub', [], 'POST');
$dateTimeObj = \DateTime::createFromFormat(_SHORTDATESTRING, $resDate['date']);
$dateTimeObj->setTime(0, 0, (int)$resTime['time']);
$serverTimestamp = userTimeToServerTime($dateTimeObj->getTimestamp(), $userTimeoffset);
@@ -1113,12 +1113,12 @@ public function setVarsFromRequest()
} elseif ($this->isNew()) {
$this->setVar('datesub', \time());
}
-
+
// date expire
if (0 !== Request::getInt('use_expire_yn', 0, 'POST')) {
if ('' !== Request::getString('dateexpire', '', 'POST')) {
- $resExDate = Request::getArray('dateexpire', [], 'POST');
- $resExTime = Request::getArray('dateexpire', [], 'POST');
+ $resExDate = Request::getArray('dateexpire', [], 'POST');
+ $resExTime = Request::getArray('dateexpire', [], 'POST');
$dateTimeObj = \DateTime::createFromFormat(_SHORTDATESTRING, $resExDate['date']);
$dateTimeObj->setTime(0, 0, (int)$resExTime['time']);
$serverTimestamp = userTimeToServerTime($dateTimeObj->getTimestamp(), $userTimeoffset);
diff --git a/class/ItemHandler.php b/class/ItemHandler.php
index 7a85d384..2ae614f4 100644
--- a/class/ItemHandler.php
+++ b/class/ItemHandler.php
@@ -17,7 +17,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -25,7 +24,6 @@
use XoopsModules\Publisher;
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -34,25 +32,19 @@
* of Q&A class objects.
*
* @author marcan
- * @package Publisher
*/
class ItemHandler extends \XoopsPersistableObjectHandler
{
/**
* @var Publisher\Helper
*/
- public $helper;
- public $publisherIsAdmin;
-
+ public $helper;
+ public $publisherIsAdmin;
protected $resultCatCounts = [];
- /**
- * @param \XoopsDatabase $db
- * @param \XoopsModules\Publisher\Helper|null $helper
- */
public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null)
{
- /** @var Publisher\Helper $this ->helper */
+ /** @var Publisher\Helper $this->helper */
if (null === $helper) {
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
} else {
@@ -82,11 +74,11 @@ public function create($isNew = true)
/**
* retrieve an item
*
- * @param int $id itemid of the user
+ * @param null|int $id itemid of the user
*
- * @param null $fields
+ * @param array|null $fields
* @return mixed reference to the Item object, FALSE if failed
- * object, FALSE if failed
+ * object, FALSE if failed
*/
public function get($id = null, $fields = null)
{
@@ -168,13 +160,12 @@ public function delete(\XoopsObject $item, $force = false)
/**
* retrieve items from the database
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
* conditions to be met
- * @param bool|string $idKey what shall we use as array key ? none, itemid, categoryid
- * @param bool $as_object
- * @param string|bool $notNullFields
+ * @param bool|string $idKey what shall we use as array key ? none, itemid, categoryid
+ * @param bool $as_object
+ * @param string|null $notNullFields
* @return array array of Item objects
- * objects
*/
public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
{
@@ -230,14 +221,15 @@ public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none',
/**
* count items matching a condition
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
* to match
- * @param string $notNullFields
+ * @param string|null $notNullFields
*
* @return int count of items
*/
- public function getCount(\CriteriaElement $criteria = null, $notNullFields = '')
+ public function getCount(\CriteriaElement $criteria = null, $notNullFields = null)
{
+ $notNullFields = (null !== $notNullFields) ?: '';
$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->helper->getDirname() . '_items');
if (null !== $criteria && $criteria instanceof \CriteriaElement) {
$whereClause = $criteria->renderWhere();
@@ -262,14 +254,15 @@ public function getCount(\CriteriaElement $criteria = null, $notNullFields = '')
}
/**
- * @param int $categoryid
+ * @param int $categoryId
* @param string|array $status
- * @param string $notNullFields
+ * @param string|null $notNullFields
* @param null|\CriteriaCompo $criteriaPermissions
* @return \CriteriaCompo
*/
- private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = '', $criteriaPermissions = null)
+ private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields = null, $criteriaPermissions = null)
{
+ // $notNullFields = (null !== $notNullFields) ?: '';
// global $publisherIsAdmin;
// $ret = 0;
// if (!$publisherIsAdmin) {
@@ -284,8 +277,8 @@ private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields
// }
// }
$criteriaCategory = null;
- if (isset($categoryid) && -1 != $categoryid) {
- $criteriaCategory = new \Criteria('categoryid', $categoryid);
+ if (isset($categoryId) && -1 != $categoryId) {
+ $criteriaCategory = new \Criteria('categoryid', $categoryId);
}
$criteriaStatus = new \CriteriaCompo();
if (!empty($status) && \is_array($status)) {
@@ -310,14 +303,15 @@ private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields
}
/**
- * @param $categoryid
- * @param string $status
- * @param string $notNullFields
+ * @param $categoryId
+ * @param string $status
+ * @param string|null $notNullFields
*
* @return int
*/
- public function getItemsCount($categoryid = -1, $status = '', $notNullFields = '')
+ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = null)
{
+ $notNullFields = (null !== $notNullFields) ?: '';
$criteriaPermissions = null;
if (!$this->publisherIsAdmin) {
$criteriaPermissions = new \CriteriaCompo();
@@ -331,11 +325,11 @@ public function getItemsCount($categoryid = -1, $status = '', $notNullFields = '
}
}
// $ret = [];
- $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions);
+ $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions);
/*
- if (isset($categoryid) && $categoryid != -1) {
- $criteriaCategory = new \Criteria('categoryid', $categoryid);
+ if (isset($categoryId) && $categoryId != -1) {
+ $criteriaCategory = new \Criteria('categoryid', $categoryId);
}
$criteriaStatus = new \CriteriaCompo();
if (!empty($status) && is_array($status)) {
@@ -364,18 +358,19 @@ public function getItemsCount($categoryid = -1, $status = '', $notNullFields = '
/**
* @param int $limit
* @param int $start
- * @param int $categoryid
+ * @param int $categoryId
* @param string $sort
* @param string $order
- * @param string $notNullFields
+ * @param string|null $notNullFields
* @param bool $asObject
* @param string $idKey
* @param bool $excludeExpired
*
* @return array
*/
- public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none', $excludeExpired = true)
+ public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true)
{
+ $notNullFields = (null !== $notNullFields) ?: '';
$otherCriteria = new \CriteriaCompo();
if (!$this->publisherIsAdmin) {
$criteriaDateSub = new \Criteria('datesub', \time(), '<=');
@@ -389,28 +384,29 @@ public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort
$otherCriteria->add($criteriaExpire);
}
- return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey);
+ return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey);
}
/**
- * @param int $limit
- * @param int $start
- * @param int $categoryid
- * @param string $sort
- * @param string $order
- * @param string $notNullFields
- * @param bool $asObject
- * @param string $idKey
+ * @param int $limit
+ * @param int $start
+ * @param int $categoryId
+ * @param string $sort
+ * @param string $order
+ * @param string|null $notNullFields
+ * @param bool $asObject
+ * @param string $idKey
*
* @return array
*/
- public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
+ public function getAllExpired($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
{
+ $notNullFields = (null !== $notNullFields) ?: '';
$otherCriteria = new \CriteriaCompo();
$otherCriteria->add(new \Criteria('dateexpire', \time(), '<='));
$otherCriteria->add(new \Criteria('dateexpire', 0, '>'));
- return $this->getItems($limit, $start, -1, $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey);
+ return $this->getItems($limit, $start, -1, $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey);
}
/**
@@ -453,24 +449,25 @@ public function getNextPublished($obj)
/**
* @param int $limit
* @param int $start
- * @param int $categoryid
+ * @param int $categoryId
* @param string $sort
* @param string $order
- * @param string $notNullFields
+ * @param string|null $notNullFields
* @param bool $asObject
* @param string $idKey
*
* @return array
*/
- public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
+ public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
{
- return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey);
+ $notNullFields = (null !== $notNullFields) ?: '';
+ return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey);
}
/**
* @param int $limit
* @param int $start
- * @param int $categoryid
+ * @param int $categoryId
* @param string $sort
* @param string $order
* @param string $notNullFields
@@ -479,15 +476,15 @@ public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort
*
* @return array
*/
- public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
+ public function getAllOffline($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
{
- return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey);
+ return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey);
}
/**
* @param int $limit
* @param int $start
- * @param int $categoryid
+ * @param int $categoryId
* @param string $sort
* @param string $order
* @param string $notNullFields
@@ -496,27 +493,28 @@ public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort =
*
* @return array
*/
- public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
+ public function getAllRejected($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
{
- return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey);
+ return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey);
}
/**
* @param int $limit
* @param int $start
* @param array|string $status
- * @param int $categoryid
+ * @param int $categoryId
* @param string $sort
* @param string $order
- * @param string $notNullFields
+ * @param string|null $notNullFields
* @param bool $asObject
* @param null|\CriteriaCompo $otherCriteria
* @param bool|string $idKey
* @return array
* @internal param bool $asObject
*/
- public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $otherCriteria = null, $idKey = 'none')
+ public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none')
{
+ $notNullFields = (null !== $notNullFields) ?: '';
$criteriaPermissions = null;
if (!$this->publisherIsAdmin) {
$criteriaPermissions = new \CriteriaCompo();
@@ -530,10 +528,10 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1,
}
}
- $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions);
+ $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions);
/*
- if (isset($categoryid) && $categoryid != -1) {
- $criteriaCategory = new \Criteria('categoryid', $categoryid);
+ if (isset($categoryId) && $categoryId != -1) {
+ $criteriaCategory = new \Criteria('categoryid', $categoryId);
}
$criteriaStatus = new \CriteriaCompo();
if (!empty($status) && is_array($status)) {
@@ -563,7 +561,7 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1,
$criteria->setStart($start);
$criteria->setSort($sort);
$criteria->order = $order; // patch for XOOPS <= 2.5.10 does not set order correctly using setOrder() method
- $ret = &$this->getObjects($criteria, $idKey, $notNullFields);
+ $ret = &$this->getObjects($criteria, $idKey, true);
return $ret;
}
@@ -575,7 +573,6 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1,
*
* @return bool
* @throws \Exception
- * @throws \Exception
*/
public function getRandomItem($field = '', $status = '', $categoryId = -1)
{
@@ -585,10 +582,10 @@ public function getRandomItem($field = '', $status = '', $categoryId = -1)
$totalItems = $this->getItemsCount($categoryId, $status, $notNullFields);
if ($totalItems > 0) {
--$totalItems;
- $entryNumber = \random_int(0, $totalItems); //TODO switch in PHP 7 to random_int()
-// $entryNumber2 = random_int(0, $totalItems);
+ $entryNumber = \random_int(0, $totalItems);
+ // $entryNumber2 = random_int(0, $totalItems);
- $item = $this->getItems(1, $entryNumber, $status, $categoryId, $sort = 'datesub', $order = 'DESC', $notNullFields);
+ $item = $this->getItems(1, $entryNumber, $status, $categoryId, $sort = 'datesub', $order = 'DESC', $notNullFields);
if ($item) {
$ret = $item[0];
}
@@ -600,10 +597,10 @@ public function getRandomItem($field = '', $status = '', $categoryId = -1)
/**
* delete Items matching a set of conditions
*
- * @param \CriteriaElement $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
*
- * @param bool $force
- * @param bool $asObject
+ * @param bool $force
+ * @param bool $asObject
* @return bool FALSE if deletion failed
*/
public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
@@ -618,13 +615,13 @@ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asO
}
/**
- * @param $itemid
+ * @param $itemId
*
* @return bool
*/
- public function updateCounter($itemid)
+ public function updateCounter($itemId)
{
- $sql = 'UPDATE ' . $this->db->prefix($this->helper->getDirname() . '_items') . ' SET counter=counter+1 WHERE itemid = ' . $itemid;
+ $sql = 'UPDATE ' . $this->db->prefix($this->helper->getDirname() . '_items') . ' SET counter=counter+1 WHERE itemid = ' . $itemId;
if ($this->db->queryF($sql)) {
return true;
}
@@ -673,11 +670,11 @@ public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0,
$count = 0;
$ret = [];
$criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
- /* @var \XoopsGroupPermHandler $grouppermHandler */
+ /** @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = \xoops_getHandler('groupperm');
$groups = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$searchin = empty($searchin) ? ['title', 'body', 'summary'] : (\is_array($searchin) ? $searchin : [$searchin]);
- if (\in_array('all', $searchin) || 0 === \count($searchin)) {
+ if (\in_array('all', $searchin, true) || 0 === \count($searchin)) {
$searchin = ['title', 'subtitle', 'body', 'summary', 'meta_keywords'];
//add support for searching in tags if Tag module exists and is active
if (false !== $this->helper::getHelper('tag')) {
diff --git a/class/Metagen.php b/class/Metagen.php
index 5416ef59..05a962e1 100644
--- a/class/Metagen.php
+++ b/class/Metagen.php
@@ -17,7 +17,6 @@
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -25,8 +24,6 @@
use XoopsModules\Publisher;
-
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -38,37 +35,30 @@ class Metagen
* @var Publisher\Helper
*/
public $helper;
-
/**
* @var \MyTextSanitizer
*/
public $myts;
-
/**
* @var string
*/
public $title;
-
/**
* @var string
*/
public $originalTitle;
-
/**
* @var string
*/
public $keywords;
-
/**
* @var string
*/
public $categoryPath;
-
/**
* @var string
*/
public $description;
-
/**
* @var int
*/
@@ -82,7 +72,7 @@ class Metagen
*/
public function __construct($title, $keywords = '', $description = '', $categoryPath = '')
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
$this->myts = \MyTextSanitizer::getInstance();
$this->setCategoryPath($categoryPath);
@@ -199,7 +189,7 @@ public function findMetaKeywords($text, $minChar)
$secondRoundKeywords = \explode("'", $originalKeyword);
foreach ($secondRoundKeywords as $secondRoundKeyword) {
if (mb_strlen($secondRoundKeyword) >= $minChar) {
- if (!\in_array($secondRoundKeyword, $keywords)) {
+ if (!\in_array($secondRoundKeyword, $keywords, true)) {
$keywords[] = \trim($secondRoundKeyword);
}
}
@@ -342,14 +332,16 @@ public static function generateSeoTitle($title = '', $withExt = true)
$repPat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o'];
$title = \preg_replace($pattern, $repPat, $title);
$tableau = \explode('-', $title); // Transforms the string in table //Transforme la chaine de caractères en tableau
- $tableau = \array_filter($tableau, ['XoopsModules\Publisher\Metagen', 'emptyString']); // Remove empty strings of the table //Supprime les chaines vides du tableau
+ $tableau = \array_filter($tableau, [__CLASS__, 'emptyString']); // Remove empty strings of the table //Supprime les chaines vides du tableau
$title = \implode('-', $tableau); // Transforms a character string in table separated by a hyphen //Transforme un tableau en chaine de caractères séparé par un tiret
if ($title && !(\is_array($title))) {
if ($withExt) {
$title .= '.html';
}
+
return $title;
}
+
return '';
}
diff --git a/class/Mimetype.php b/class/Mimetype.php
index 78117b28..9dc06f37 100644
--- a/class/Mimetype.php
+++ b/class/Mimetype.php
@@ -19,7 +19,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -27,15 +26,12 @@
use XoopsModules\Publisher;
-
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
* Mimetype class
*
* @author Eric Juden
- * @package publisher
*/
class Mimetype extends \XoopsObject
{
diff --git a/class/MimetypeHandler.php b/class/MimetypeHandler.php
index 0ca82d1a..4b915151 100644
--- a/class/MimetypeHandler.php
+++ b/class/MimetypeHandler.php
@@ -19,7 +19,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -27,8 +26,6 @@
use XoopsModules\Publisher;
-
-
require_once \dirname(__DIR__) . '/include/common.php';
/**
@@ -38,13 +35,12 @@ class MimetypeHandler extends BaseObjectHandler
{
/**
* Constructor
- *
- * @param \XoopsDatabase $db
+ * @param \XoopsDatabase|null $db
* @param \XoopsModules\Publisher\Helper|null $helper
*/
public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null)
{
- /** @var \XoopsModules\Publisher\Helper $this ->helper */
+ /** @var \XoopsModules\Publisher\Helper $this->helper */
if (null === $helper) {
$this->helper = \XoopsModules\Publisher\Helper::getInstance();
} else {
@@ -59,9 +55,9 @@ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\H
/**
* retrieve a mimetype object from the database
*
- * @param int $id ID of mimetype
+ * @param int|null $id ID of mimetype
*
- * @param null $fields
+ * @param array|null $fields
* @return bool|Mimetype
*/
public function get($id = null, $fields = null)
@@ -86,13 +82,13 @@ public function get($id = null, $fields = null)
/**
* retrieve objects from the database
*
- * @param \CriteriaElement $criteria {@link CriteriaElement}
- * conditions to be met
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
+ * conditions to be met
*
- * @param bool $idAsKey
- * @param bool $asObject
+ * @param bool $idAsKey
+ * @param bool $asObject
* @return array array of Mimetype objects
- * objects
+ * objects
*/
public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null)
{
@@ -167,11 +163,11 @@ public function getArray($mimeExt = null)
public function checkMimeTypes($postField)
{
$ret = false;
- $allowed_mimetypes = $this->getArrayByType();
- if (empty($allowed_mimetypes)) {
+ $allowedMimetypes = $this->getArrayByType();
+ if (empty($allowedMimetypes)) {
return $ret;
}
- foreach ($allowed_mimetypes as $mime) {
+ foreach ($allowedMimetypes as $mime) {
if ($mime == $_FILES[$postField]['type']) {
$ret = $mime;
break;
@@ -200,9 +196,9 @@ public function getArrayByType()
/**
* Create a "select" SQL query
*
- * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
+ * @param \CriteriaElement|null $criteria {@link CriteriaElement}
* to match
- * @param bool $join
+ * @param bool $join
*
* @return string string SQL query
*/
@@ -219,8 +215,7 @@ private function selectQuery(\CriteriaElement $criteria = null, $join = false)
if ($join) {
throw new \RuntimeException('no need for join...');
}
- } catch (\Exception $e) {
- /** @var Publisher\Helper $helper */
+ } catch (\Throwable $e) {
$helper = Publisher\Helper::getInstance();
$helper->addLog($e);
echo 'no need for join...';
diff --git a/class/MimetypesUtility.php b/class/MimetypesUtility.php
index 20fc9bab..cb932f0e 100644
--- a/class/MimetypesUtility.php
+++ b/class/MimetypesUtility.php
@@ -3,6 +3,7 @@
declare(strict_types=1);
namespace XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
/*
You may not change or alter any portion of this comment or credits
@@ -19,7 +20,6 @@
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Publisher
* @since 1.0
* @author trabis
* @author The SmartFactory
@@ -37,17 +37,16 @@ class MimetypesUtility
{
public static function add()
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $helper->getHandler('Mimetype');
global $limit, $start;
$error = [];
if (!Request::getString('add_mime', '', 'POST')) {
- Publisher\Utility::cpHeader();
+ Utility::cpHeader();
//publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES);
- Publisher\Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', \_AM_PUBLISHER_MIME_ADD_TITLE);
+ Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', \_AM_PUBLISHER_MIME_ADD_TITLE);
$session = Publisher\Session::getInstance();
$mimeType = $session->get('publisher_addMime');
@@ -55,7 +54,7 @@ public static function add()
//Display any form errors
if (false === !$mimeErrors) {
- Publisher\Utility::renderErrors($mimeErrors, Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession']));
+ Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession']));
}
if (false === $mimeType) {
@@ -125,7 +124,7 @@ public static function add()
echo '';
- Publisher\Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon');
+ Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon');
\xoops_cp_footer();
} else {
@@ -162,7 +161,7 @@ public static function add()
$mime['mime_user'] = $mimeUser;
$session->set('publisher_addMime', $mime);
$session->set('publisher_addMimeErr', $error);
- \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false));
+ \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false));
}
$mimeType = $mimetypeHandler->create();
@@ -183,7 +182,6 @@ public static function add()
public static function delete()
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $helper->getHandler('Mimetype');
@@ -204,7 +202,6 @@ public static function delete()
public static function edit()
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $helper->getHandler('Mimetype');
@@ -225,14 +222,14 @@ public static function edit()
$mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId);
// Display header
- Publisher\Utility::cpHeader();
+ Utility::cpHeader();
//publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_EDIT);
- Publisher\Utility::openCollapsableBar('mimemedittable', 'mimeediticon', \_AM_PUBLISHER_MIME_EDIT_TITLE);
+ Utility::openCollapsableBar('mimemedittable', 'mimeediticon', \_AM_PUBLISHER_MIME_EDIT_TITLE);
//Display any form errors
if (false === !$mimeErrors) {
- Publisher\Utility::renderErrors($mimeErrors, Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId]));
+ Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId]));
}
if (false === $mimeType) {
@@ -291,7 +288,7 @@ public static function edit()
";
echo '';
// end of edit form
- Publisher\Utility::closeCollapsableBar('mimeedittable', 'mimeediticon');
+ Utility::closeCollapsableBar('mimeedittable', 'mimeediticon');
// xoops_cp_footer();
require_once \dirname(__DIR__) . '/admin/admin_footer.php';
} else {
@@ -330,7 +327,7 @@ public static function edit()
$mime['mime_user'] = $mimeUser;
$session->set('publisher_editMime_' . $mimeId, $mime);
$session->set('publisher_editMimeErr_' . $mimeId, $error);
- \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false));
+ \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false));
}
$mimeTypeObj->setVar('mime_ext', Request::getString('mime_ext', '', 'POST'));
@@ -350,10 +347,8 @@ public static function edit()
public static function manage()
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
- /** @var Publisher\Utility $utility */
- $utility = new Publisher\Utility();
+ $utility = new Utility();
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $helper->getHandler('Mimetype');
global $imagearray, $start, $limit, $aSortBy, $aOrderBy, $aLimitBy, $aSearchBy;
@@ -378,9 +373,9 @@ public static function manage()
\redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php?op=search', 3, \_AM_PUBLISHER_MIME_SEARCH);
}
- Publisher\Utility::cpHeader();
+ Utility::cpHeader();
////publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES);
- Publisher\Utility::openCollapsableBar('mimemanagetable', 'mimemanageicon', \_AM_PUBLISHER_MIME_MANAGE_TITLE, \_AM_PUBLISHER_MIME_INFOTEXT);
+ Utility::openCollapsableBar('mimemanagetable', 'mimemanageicon', \_AM_PUBLISHER_MIME_MANAGE_TITLE, \_AM_PUBLISHER_MIME_INFOTEXT);
$crit = new \CriteriaCompo();
$order = Request::getString('order', 'ASC', 'POST');
$sort = Request::getString('sort', 'mime_ext', 'POST');
@@ -487,7 +482,7 @@ public static function manage()
echo '';
echo "" . $nav->renderNav() . '
';
- Publisher\Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon');
+ Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon');
// xoops_cp_footer();
require_once \dirname(__DIR__) . '/admin/admin_footer.php';
@@ -495,7 +490,6 @@ public static function manage()
public static function search()
{
- /** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();
/** @var Publisher\MimetypeHandler $mimetypeHandler */
$mimetypeHandler = $helper->getHandler('Mimetype');
@@ -520,10 +514,10 @@ public static function search()
$order = Request::getString('order', 'ASC');
$sort = Request::getString('sort', 'mime_name');
- Publisher\Utility::cpHeader();
+ Utility::cpHeader();
//publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH);
- Publisher\Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', \_AM_PUBLISHER_MIME_SEARCH);
+ Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', \_AM_PUBLISHER_MIME_SEARCH);
if (!Request::hasVar('mime_search')) {
echo "