Skip to content

Commit

Permalink
namespace adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Dec 26, 2017
1 parent c57f814 commit b7344b6
Show file tree
Hide file tree
Showing 65 changed files with 535 additions and 527 deletions.
6 changes: 3 additions & 3 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');

require_once __DIR__ . '/../include/common.php';
//require_once __DIR__ . '/../class/utility.php';
//require_once __DIR__ . '/../class/Utility.php';
require_once __DIR__ . '/../include/config.php';

$moduleDirName = basename(dirname(__DIR__));
Expand All @@ -48,9 +48,9 @@
'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle'>"
];

$myts = MyTextSanitizer::getInstance();
$myts = \MyTextSanitizer::getInstance();

if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
require_once $GLOBALS['xoops']->path('class/template.php');
$GLOBALS['xoopsTpl'] = new XoopsTpl();
$GLOBALS['xoopsTpl'] = new \XoopsTpl();
}
4 changes: 2 additions & 2 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
}

xoops_load('XoopsMediaUploader');
$uploader = new XoopsMediaUploader(publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
$uploader = new \XoopsMediaUploader(publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
if ($uploader->fetchMedia($filename) && $uploader->upload()) {
$categoryObj->setVar('image', $uploader->getSavedFileName());
} else {
Expand Down Expand Up @@ -225,7 +225,7 @@
}
echo "</table>\n";
require_once $GLOBALS['xoops']->path('class/pagenav.php');
$pagenav = new XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
$pagenav = new \XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
echo '<br>';
publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon');
Expand Down
8 changes: 4 additions & 4 deletions admin/clone.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
echo $msg;
} else {
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
$form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
$clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
$form = new \XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
$clone = new \XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
$clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC);
$form->addElement($clone, true);
$form->addElement(new XoopsFormHidden('op', 'submit'));
$form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
$form->addElement(new \XoopsFormHidden('op', 'submit'));
$form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit'));
$form->display();
}

Expand Down
28 changes: 14 additions & 14 deletions admin/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,38 +134,38 @@
} */

if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
$sform = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, 'op', xoops_getenv('PHP_SELF'), 'post', true);
$sform = new \XoopsThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, 'op', xoops_getenv('PHP_SELF'), 'post', true);
$sform->setExtra('enctype="multipart/form-data"');

// Partners to import
$importfile_select = new XoopsFormSelect('', 'importfile', $importfile);
$importfile_select = new \XoopsFormSelect('', 'importfile', $importfile);
$importfile_select->addOptionArray($importfile_select_array);
$importfile_tray = new XoopsFormElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, '&nbsp;');
$importfile_tray = new \XoopsFormElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, '&nbsp;');
$importfile_tray->addElement($importfile_select);
$importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC);
$sform->addElement($importfile_tray);

// Buttons
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'importExecute');
$button_tray = new \XoopsFormElementTray('', '');
$hidden = new \XoopsFormHidden('op', 'importExecute');
$button_tray->addElement($hidden);

$butt_import = new XoopsFormButton('', '', _AM_PUBLISHER_IMPORT, 'submit');
$butt_import = new \XoopsFormButton('', '', _AM_PUBLISHER_IMPORT, 'submit');
$butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
$button_tray->addElement($butt_import);

$butt_cancel = new XoopsFormButton('', '', _AM_PUBLISHER_CANCEL, 'button');
$butt_cancel = new \XoopsFormButton('', '', _AM_PUBLISHER_CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);

$sform->addElement($button_tray);
/*$sform->addElement(new XoopsFormHidden('xfs_version', $xfs_version));
$sform->addElement(new XoopsFormHidden('wfs_version', $wfs_version));*/
$sform->addElement(new XoopsFormHidden('news_version', $news_version));
$sform->addElement(new XoopsFormHidden('xnews_version', $xnews_version));
$sform->addElement(new XoopsFormHidden('ams_version', $ams_version));
$sform->addElement(new XoopsFormHidden('cjaycontent_version', $cjaycontent_version));
$sform->addElement(new XoopsFormHidden('smartsection_version', $smartsection_version));
/*$sform->addElement(new \XoopsFormHidden('xfs_version', $xfs_version));
$sform->addElement(new \XoopsFormHidden('wfs_version', $wfs_version));*/
$sform->addElement(new \XoopsFormHidden('news_version', $news_version));
$sform->addElement(new \XoopsFormHidden('xnews_version', $xnews_version));
$sform->addElement(new \XoopsFormHidden('ams_version', $ams_version));
$sform->addElement(new \XoopsFormHidden('cjaycontent_version', $cjaycontent_version));
$sform->addElement(new \XoopsFormHidden('smartsection_version', $smartsection_version));
$sform->display();
unset($hidden);
} else {
Expand Down
40 changes: 20 additions & 20 deletions admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Xoopsmodules\publisher;

require_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();
$myts = \MyTextSanitizer::getInstance();

$importFromModuleName = 'AMS ' . Request::getString('ams_version', '', 'POST');

Expand Down Expand Up @@ -54,7 +54,7 @@
} else {
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . '</span>';

$form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname");
$form = new \XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname");

//---------- mb ------------------
// add 'publisher' category to 'imagecategory' table
Expand Down Expand Up @@ -130,24 +130,24 @@
$cat_cbox_options[$cid] = "$cat_title ($art_count)";
}

$cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br>', $cat_cbox_options));
$cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br>', $cat_cbox_options));
$cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC);
$form->addElement($cat_label);

// Publisher parent category
$mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories'), 'categoryid', 'parentid');
$mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($module->getVar('dirname', 'n') . '_categories'), 'categoryid', 'parentid');
ob_start();
$mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category');

$parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents());
$parent_cat_sel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents());
$parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC);
$form->addElement($parent_cat_sel);
ob_end_clean();

$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
$form->addElement(new \XoopsFormHidden('op', 'go'));
$form->addElement(new \XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('ams_version', '', 'POST')));
$form->addElement(new \XoopsFormHidden('from_module_version', Request::getString('ams_version', '', 'POST')));

$form->display();
}
Expand Down Expand Up @@ -183,24 +183,24 @@
$newArticleArray = [];

$imageCategoryHandler = xoops_getHandler('imagecategory');
// $criteria = new criteriaCombo;
// $criteria = new \CriteriaCombo;

// get the total number of subcats for this category
// $criteria = new CriteriaCompo();
// $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '='));
// $criteria = new \CriteriaCompo();
// $criteria->add(new \Criteria('imagecategory', $catObj->getVar('cid'), '='));
// $childCount = (int)($mylinksCatHandler->getCount($criteria));

$criteria = new Criteria('imgcat_name', PUBLISHER_DIRNAME);
$criteria = new \Criteria('imgcat_name', PUBLISHER_DIRNAME);
$imageCategoryId = $imageCategoryHandler->getObjects($criteria);

// $criteria = new CriteriaCompo();
// $criteria->add(new Criteria('imagecategory', PUBLISHER_DIRNAME, '='));
// $criteria = new \CriteriaCompo();
// $criteria->add(new \Criteria('imagecategory', PUBLISHER_DIRNAME, '='));

// $newid = $imageCategoryId->getVar('imgcat_id');
$newid = $imageCategoryId[0]->vars['imgcat_id']['value'];
// $newid = $imageCategoryId[0]->vars['imgcat_id'];

// $select_form = new XoopsFormSelect('', $name_current, array(), 1);
// $select_form = new \XoopsFormSelect('', $name_current, array(), 1);
// $select_form->addOption('', _SELECT);
// $select_form->addOptionArray($writerHandler->getList($criteria));

Expand Down Expand Up @@ -314,7 +314,7 @@

$imgHandler = xoops_getHandler('image');

// $criteria = new Criteria('image_name', $arrArticle['picture']);
// $criteria = new \Criteria('image_name', $arrArticle['picture']);
$imageId = $imgHandler->getObjects($criteria);
$newImageId = $imageId[0]->vars['image_id']['value'];
$itemObj->setVar('image', $newImageId);
Expand Down Expand Up @@ -398,8 +398,8 @@

// Looping through category to change the parentID to the new parentID
foreach ($newCatArray as $oldid => $newCat) {
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('categoryid', $newCat['newid']));
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('categoryid', $newCat['newid']));
$oldpid = $newCat['oldpid'];
if (0 == $oldpid) {
$newpid = $parentId;
Expand All @@ -418,8 +418,8 @@

/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('com_modid', $ams_module_id));
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('com_modid', $ams_module_id));
$comments = $commentHandler->getObjects($criteria);
/** @var XoopsComment $comment */
foreach ($comments as $comment) {
Expand Down
14 changes: 7 additions & 7 deletions admin/import/cjaycontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Xoopsmodules\publisher;

require_once dirname(__DIR__) . '/admin_header.php';
$myts = MyTextSanitizer::getInstance();
$myts = \MyTextSanitizer::getInstance();

$importFromModuleName = 'cjaycontent ' . Request::getString('cjaycontent_version', '', 'POST');

Expand Down Expand Up @@ -66,14 +66,14 @@
} else {
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, $totalCat) . '</span>';

$form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname");
$form = new \XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname");

ob_end_clean();

$form->addElement(new XoopsFormHidden('op', 'go'));
$form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
$form->addElement(new \XoopsFormHidden('op', 'go'));
$form->addElement(new \XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));

$form->addElement(new XoopsFormHidden('from_module_version', Request::getString('cjaycontent_version', '', 'POST')));
$form->addElement(new \XoopsFormHidden('from_module_version', Request::getString('cjaycontent_version', '', 'POST')));

$form->display();
}
Expand Down Expand Up @@ -162,8 +162,8 @@
$publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('com_modid', $cjaycontent_module_id));
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('com_modid', $cjaycontent_module_id));
/** @var XoopsComment $comment */
$comments = $commentHandler->getObjects($criteria);
foreach ($comments as $comment) {
Expand Down
Loading

0 comments on commit b7344b6

Please sign in to comment.